home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / asmutil / wasm202.zip / CLP.ASM < prev    next >
Assembly Source File  |  1986-12-25  |  4KB  |  96 lines

  1.  
  2.  Title 'Wolfware Assembler Sample', 'BASIC Screen Subroutine'
  3.  
  4. ;=====================================================================;
  5. ;              BASIC Clear Partial Screen Version 1.10                ;
  6. ;                                                                     ;
  7. ; BASIC machine language subroutine to scroll or clear the entire     ;
  8. ; screen or just a window within it.                                  ;
  9. ;                                                                     ;
  10. ; Five integer parameters are passed from BASIC to the subroutine:    ;
  11. ; upper row, left column, lower row, right column, and number of      ;
  12. ; lines to scroll up.  Zero lines to scroll means clear the window.   ;
  13. ;                                                                     ;
  14. ; The following is example BASIC implementation using the subroutine  ;
  15. ; in the file CLP.BLD.  The subroutine is stored in the data space of ;
  16. ; a string variable.  The string MUST NOT BE MODIFIED while the       ;
  17. ; subroutine is still being used.                                     ;
  18. ;                                                                     ;
  19. ; 10 DEF SEG                                  'BASIC data segment     ;
  20. ; 20 CLP$ = STRING$(255,0)                    'create string space    ;
  21. ; 30 CLP = VARPTR(CLP$)                       'string descriptor      ;
  22. ; 40 CLP = PEEK(CLP+1) + (PEEK(CLP+2) * 256)  'string data location   ;
  23. ; 50 BLOAD "CLP.BLD",CLP                      'load routine to CLP$   ;
  24. ; 60 '                                                                ;
  25. ; 70 'clear the entire screen                                         ;
  26. ; 80 A%=1:B%=1:C%=25:D%=80:E%=0               'set coordinates        ;
  27. ; 90 CALL CLP(A%,B%,C%,D%,E%)                 'call routine           ;
  28. ; 100 '                                                               ;
  29. ; 110 'scroll a 5 by 5 window in                                      ;
  30. ; 120 'the upper left corner up 2                                     ;
  31. ; 130 A%=1:B%=1:C%=5:D%=5:E%=2                'set coordinates        ;
  32. ; 140 CALL CLP(A%,B%,C%,D%,E%)                'call routine           ;
  33. ;                                                                     ;
  34. ; Due to a quirk of the BIOS function, the window must be bigger than ;
  35. ; one row or one column, i.e. the smallest window is two rows by two  ;
  36. ; columns.  None of the parameter values are checked, so the BASIC    ;
  37. ; program better better make sure they're valid.                      ;
  38. ;                                                                     ;
  39. ; The object code resulting from assembly is directly BLOADable from  ;
  40. ; BASIC.  Because BLOADable programs are not directly executable, it  ;
  41. ; is a good idea not to use COM (the default) as the object file      ;
  42. ; extension.                                                          ;
  43. ;=====================================================================;
  44.  
  45.  Proc Far
  46.  
  47. Blank_Atr Equ 07h       ;screen attribute for blanked screen
  48.  
  49. ;----- bload header
  50.  
  51.  Db 0fdh                ;bload marker
  52.  Dw 0f000h, 0           ;default load location
  53.  Dw $Size               ;program size
  54.  
  55. ;----- start of code
  56.  
  57. ;----- load upper left row
  58.  
  59.  Mov Bp, Sp             ;base for finding parameters
  60.  Mov Si, [Bp+12]        ;parameter location
  61.  Mov Ch, [Si]           ;load
  62.  Dec Ch                 ;decrement (make 0-24)
  63.  
  64. ;----- load upper left column
  65.  
  66.  Mov Si, [Bp+10]        ;parameter location
  67.  Mov Cl, [Si]           ;load
  68.  Dec Cl                 ;decrement
  69.  
  70. ;----- load lower right row
  71.  
  72.  Mov Si, [Bp+8]         ;parameter location
  73.  Mov Dh, [Si]           ;load
  74.  Dec Dh                 ;decrement
  75.  
  76. ;----- load lower right column
  77.  
  78.  Mov Si, [Bp+6]         ;parameter location
  79.  Mov Dl, [Si]           ;load
  80.  Dec Dl                 ;decrement
  81.  
  82. ;----- load lines to scroll
  83.  
  84.  Mov Si, [Bp+4]         ;parameter location
  85.  Mov Al, [Si]           ;load
  86.  
  87. ;----- scroll window
  88.  
  89.  Mov Bh, Blank_Atr      ;attribute for blanked lines
  90.  Mov Ah, 6h             ;scroll function
  91.  Int 10h                ;execute
  92.  
  93.  Ret 10                 ;exit, return to basic
  94.  Endp
  95.  
  96.