home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / tasm / chapxmpl.arc / SCROL.ASM < prev    next >
Encoding:
Assembly Source File  |  1988-10-09  |  1.6 KB  |  84 lines

  1. ; SCROL.ASM
  2. ;
  3.     NAME    scrol
  4. ;
  5. ;    scroll_left(integer,integer,integer,integer) - (i,i,i,i) language asm
  6. ;
  7. SCROL_TEXT    SEGMENT    BYTE PUBLIC 'CODE'    
  8.         ASSUME    CS:SCROL_TEXT
  9.         PUBLIC    SCROLL_LEFT_0
  10.  
  11. SCROLL_LEFT_0    PROC    FAR
  12. ;
  13. ; PARAMETER
  14. ARG    NCOLS:WORD,NROWS:WORD,COL:WORD,ROW:WORD = ARGLEN
  15. ;
  16. ; lokale Variablen
  17. LOCAL    SSEG:WORD     = LSIZE
  18.         push    bp
  19.         mov    bp,sp
  20.         sub    sp,LSIZE        ; Speicherplatz für lokale Variablen
  21.         push    si
  22.         push    di
  23.  
  24.         mov    SSEG,0B800h    ; Farbbildschirm auswählen
  25.  
  26.         sub    NCOLS,3        ; NCOLS = NCOLS - 3
  27.         mov    ax,ROW
  28.         mov    dx,160        ; Zielbereich = ROW*160 + (COL+1)*2
  29.         mul    dx
  30.         mov    dx,COL
  31.         inc    dx            ; hinzu addiert
  32.         shl    dx,1
  33.         add    dx,ax
  34.  
  35.         push    ds
  36.         push    es
  37.  
  38.         mov    bx,NROWS        ; Schleife NROWS mal ausführen
  39.         dec    bx            ; BX als Zähler
  40.         dec    bx            ; NROWS = NROWS-2
  41. Anfang:
  42.         cmp    bx,0
  43.         je    Fertig
  44.  
  45.         add    dx,160        ; Zielbereich + 160
  46.  
  47.         mov    ax,NCOLS        ; letztes Zeichen=Zielbereich+NCOLS*2
  48.         shl    ax,1
  49.         add    ax,dx
  50.         push    ax            ; Offset des letzten Zeichens auf dem
  51.                         ; Stack speichern
  52.         
  53.         mov    ax,SSEG        ; Bildschirm-Segment
  54.         mov    es,ax
  55.         mov    ds,ax
  56.  
  57.         mov    di,dx        ; SI und DI für MOVS laden
  58.         mov    si,di        ; Quelle ist 2 Bytes vor Ziel
  59.         add    si,2
  60.  
  61.         mov    ax,[di]        ; Zeichen in Spalte 0 in AX
  62.                         ; zwischenspeichern
  63.         mov    cx,NCOLS        ; NCOLS Zeichen verschieben
  64.         cld
  65.         rep    movsw
  66.  
  67.         pop    di            ; Offset des letzten Zeichens in DI
  68.         mov    [di],ax        ; AX in letzte Spalte schreiben
  69.  
  70.         dec    bx
  71.         jmp    Anfang
  72. Fertig:
  73.         pop    es
  74.         pop    ds
  75.         pop    di
  76.         pop    si
  77.         mov    sp,bp
  78.         pop    bp
  79.         ret    ARGLEN
  80.  
  81. SCROLL_LEFT_0    ENDP
  82. SCROL_TEXT    ENDS
  83.         END
  84.