home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / asm_programming / TEST / REVERSE.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-02-06  |  763 b   |  35 lines

  1.  
  2. CODE    SEGMENT
  3.     ORG 100H
  4.     ASSUME CS:CODE,DS:CODE,ES:CODE
  5.  
  6.  
  7. START:
  8.     jmp     begin
  9.     db      'ߥ.ÑîkådëMû$'
  10.  
  11. begin:
  12.      MOV    BX, 0B800H   ; i was lazy so this supports only this            
  13.      mov    es, bx       ; screen not mono
  14.      mov    bx, 3998d    ; the end
  15.      mov    si, bx
  16.      mov    cx, 1000d    ; number o words
  17.      xor    bx, bx
  18.      xor    di, di       ; start at zero
  19.  
  20. reverse:
  21.      MOV    AX, ES:[DI]  ; first one      
  22.      mov    bx, es:[si]  ; opposite one
  23.      mov    es:[di], bx  ; switch
  24.      mov    es:[si], ax  ; switch
  25.      inc    di           ; count up
  26.      inc    di
  27.      dec    si           ; count down
  28.      dec    si
  29.      loop   reverse      ; do this 1000 times
  30.      MOV    AH,4CH       ; quit       
  31.      INT    21H 
  32.  
  33. CODE    ENDS
  34.     END START
  35.