home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c081_11 / 9.ddi / CHAPXMPL.ZIP / SCROL.ASM < prev    next >
Encoding:
Assembly Source File  |  1991-02-13  |  1.9 KB  |  88 lines

  1. ; Turbo Assembler    Copyright (c) 1988, 1991 By Borland International, Inc.
  2.  
  3. ;  SCROL.ASM
  4. ;
  5. ;  Interfacing Turbo Assembler and Turbo Prolog.
  6.  
  7.      name   scrol
  8. ;
  9. ;
  10. SCROL_TEXT     SEGMENT  BYTE PUBLIC 'CODE'
  11.      ASSUME    CS:SCROL_TEXT
  12.  
  13. PUBLIC SCROLL_LEFT_0
  14.  
  15. SCROLL_LEFT_0  PROC FAR
  16. ;
  17. ; parameters
  18. arg  NCOLS:WORD, NROWS:WORD, COL:WORD, ROW:WORD = ARGLEN
  19. ;
  20. ; local variable
  21. local      SSEG :WORD = LSIZE
  22.      push  bp
  23.      mov   bp,sp
  24.      sub   sp,LSIZE              ;room for local variables
  25.      push  si
  26.      push  di
  27.  
  28.      mov   SSEG, 0B800h
  29.  
  30.      sub   NCOLS, 3              ;NCOLS = NCOLS - 3
  31.  
  32.      mov   ax, ROW               ;DEST = ROW*160 + (COL+1)*2
  33.      mov   dx,160
  34.      mul   dx
  35.      mov   dx, COL
  36.      inc   dx                    ;added
  37.      shl   dx,1
  38.      add   dx,ax
  39.  
  40.      push  ds
  41.      push  es
  42.  
  43.      mov   bx , NROWS            ;loop NROWS times using BX as counter
  44.      dec   bx                    ;NROWS = NROWS - 2
  45.      dec   bx
  46.  
  47. Top: cmp   bx ,0
  48.      je    Done
  49.  
  50.      add   dx, 160               ;dest = dest + 160
  51.  
  52.      mov   ax,NCOLS              ;lastchar = dest + nc*2
  53.      shl   ax,1
  54.      add   ax,dx
  55.      push  ax                    ;push lastchar offset on stack
  56.  
  57.      mov   ax,SSEG               ;load screen segment into ES, DS
  58.      mov   es,ax
  59.      mov   ds,ax
  60.  
  61.      mov   di,dx                 ;set up SI and DI for movs
  62.      mov   si,di                 ;source is 2 bytes above DEST
  63.      add   si,2
  64.  
  65.      mov   ax,[di]               ;save the char in col 0 in AX
  66.  
  67.      mov   cx,NCOLS              ;mov NCOLS words
  68.      cld
  69.      rep   movsw
  70.  
  71.      pop   di                    ;pop lastchar offset to DI
  72.      mov   [di],ax               ;put char in AX to last column
  73.  
  74.      dec   bx
  75.      jmp   Top
  76. Done:pop   es
  77.      pop   ds
  78.      pop   di
  79.      pop   si
  80.      mov   sp,bp
  81.      pop   bp
  82.      ret   ARGLEN
  83. SCROLL_LEFT_0  ENDP
  84. SCROL_TEXT     ENDS
  85.      END
  86.  
  87.  
  88.