home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / asm / JED.ZIP / MYLIB.MAC < prev    next >
Encoding:
Text File  |  1989-03-16  |  5.1 KB  |  126 lines

  1. ;---------------------------------------------------------------
  2. ;                         MYLIB.MAC
  3. ;       Macro library from ASSEMBLING FROM SQUARE ONE
  4. ;
  5. ;                                      by Jeff Duntemann
  6. ;                                      MASM/TASM
  7. ;                                      Last update 3/16/89
  8. ;---------------------------------------------------------------
  9.  
  10.  
  11. ;---------------------------------------------------------------
  12. ;   CLEAR    --  Clears the entire visible screen buffer
  13. ;   Last update 3/16/89
  14. ;
  15. ;      Caller must pass:
  16. ;      In VidAddress:  The name of the string to be poked at
  17. ;      In TheChar: The character to be pocked into the string
  18. ;      In ToPos:   The 0-based position in the string to poke to
  19. ;      Action:     Pokes character passed in TheChar into string
  20. ;                  passed in Target to position passed in ToPos.
  21. ;                  The first character in the string is 0, etc.
  22. ;---------------------------------------------------------------
  23. Clear      MACRO VidAddress,ClearAtom,BufLength
  24.            les  DI,DWORD PTR VidAddress
  25.            mov  AX,ClearAtom
  26.            mov  CX,BufLength
  27.            rep  stosw
  28.            GotoXY 0,0
  29.            ENDM
  30.  
  31.  
  32. ;---------------------------------------------------------------
  33. ;   GOTOXY    --  Positions the hardware cursor to X,Y
  34. ;   Last update 3/5/89
  35. ;
  36. ;      Caller must pass:
  37. ;      In NewX: The new X value
  38. ;      In NewY: The new Y value
  39. ;        These are both 0-based; i.e., they assume a screen
  40. ;        whose dimensions are 24 by 79, not 25 by 80.
  41. ;      Action:  Moves the hardware cursor to the X,Y position
  42. ;               passed as NewX and NewY.
  43. ;---------------------------------------------------------------
  44. GotoXY     MACRO NewX,NewY
  45.            mov DH,NewY
  46.            mov DL,NewX
  47.            mov AH,02H        ; Select VIDEO service 2: Position cursor
  48.            mov BH,0          ; Stay with display page 0
  49.            int 10H           ; Call VIDEO
  50.            ENDM
  51.  
  52.  
  53. ;---------------------------------------------------------------
  54. ;   NEWLINE  --  Sends a newline sequence to DOS Standard Output
  55. ;                via DOS service 40H
  56. ;   Last update 3/16/89
  57. ;
  58. ;      Caller need not pass any parameters.
  59. ;      Action:  Sends a newline sequence DOS Standard Output
  60. ;---------------------------------------------------------------
  61.  
  62. Newline    MACRO
  63.            Write CRLF,2
  64.            ENDM
  65.  
  66.  
  67. ;---------------------------------------------------------------
  68. ;   POKECHAR    --  Inserts a single character into a string
  69. ;   Last update 3/16/89
  70. ;
  71. ;      Caller must pass:
  72. ;      In Target:  The name of the string to be poked at
  73. ;      In TheChar: The character to be pocked into the string
  74. ;      In ToPos:   The 0-based position in the string to poke to
  75. ;      Action:     Pokes character passed in TheChar into string
  76. ;                  passed in Target to position passed in ToPos.
  77. ;                  The first character in the string is 0, etc.
  78. ;---------------------------------------------------------------
  79. PokeChar   MACRO Target,TheChar,ToPos
  80.            lea  BX,Target  ; Load the address of target string into BX
  81.            mov  BYTE PTR [BX+ToPos],TheChar  ; Move char into the string
  82.            ENDM
  83.  
  84.  
  85. ;---------------------------------------------------------------
  86. ;   WRITE    --  Displays information to the screen via DOS
  87. ;                service 40: Print String to Standard Output
  88. ;   Last update 3/16/89
  89. ;
  90. ;      Caller must pass:
  91. ;      In ShowIt:     The name of the string to be displayed
  92. ;      In ShowLength: The length of the string to be displayed
  93. ;      Action:  Displays the string to DOS Standard Output
  94. ;---------------------------------------------------------------
  95. Write      MACRO ShowIt,ShowLength
  96.            mov BX,1          ; Selects DOS file handle 1: Standard Output
  97.            mov CX,ShowLength ; Length of string passed in CX
  98.            lea DX,Showit     ; Offset address of string is passed in DX
  99.            mov AH,40H        ; Select DOS service 40: Print String
  100.            int 21H           ; Call DOS
  101.            ENDM
  102.  
  103. ;---------------------------------------------------------------
  104. ;   WRITELN  --  Displays information to the screen via DOS
  105. ;                service 40H: Display to Standard Output, then
  106. ;                issues a newline
  107. ;   Last update 3/16/89
  108. ;
  109. ;      Caller must pass:
  110. ;      In ShowIt: The name of the string to be displayed
  111. ;      In ShowLength: The length of the string to be displayed
  112. ;      Action:  Displays the string in ShowIt, then issues a
  113. ;               newline.  Hardware cursor will move to the
  114. ;               left margin of the following line.  If the
  115. ;               display is to the bottom screen line, the
  116. ;               screen will scroll.
  117. ;      Calls: Write
  118. ;---------------------------------------------------------------
  119.  
  120. Writeln    MACRO ShowIt,ShowLength
  121.            Write ShowIt,ShowLength  ; Display the string proper through Write
  122.            Write CRLF,2             ; Display the newline string through Write
  123.            ENDM
  124.  
  125.  
  126.