home *** CD-ROM | disk | FTP | other *** search
- ;---------------------------------------------------------------
- ; MYLIB.MAC
- ; Macro library from ASSEMBLING FROM SQUARE ONE
- ;
- ; by Jeff Duntemann
- ; MASM/TASM
- ; Last update 3/16/89
- ;---------------------------------------------------------------
-
-
- ;---------------------------------------------------------------
- ; CLEAR -- Clears the entire visible screen buffer
- ; Last update 3/16/89
- ;
- ; Caller must pass:
- ; In VidAddress: The name of the string to be poked at
- ; In TheChar: The character to be pocked into the string
- ; In ToPos: The 0-based position in the string to poke to
- ; Action: Pokes character passed in TheChar into string
- ; passed in Target to position passed in ToPos.
- ; The first character in the string is 0, etc.
- ;---------------------------------------------------------------
- Clear MACRO VidAddress,ClearAtom,BufLength
- les DI,DWORD PTR VidAddress
- mov AX,ClearAtom
- mov CX,BufLength
- rep stosw
- GotoXY 0,0
- ENDM
-
-
- ;---------------------------------------------------------------
- ; GOTOXY -- Positions the hardware cursor to X,Y
- ; Last update 3/5/89
- ;
- ; Caller must pass:
- ; In NewX: The new X value
- ; In NewY: The new Y value
- ; These are both 0-based; i.e., they assume a screen
- ; whose dimensions are 24 by 79, not 25 by 80.
- ; Action: Moves the hardware cursor to the X,Y position
- ; passed as NewX and NewY.
- ;---------------------------------------------------------------
- GotoXY MACRO NewX,NewY
- mov DH,NewY
- mov DL,NewX
- mov AH,02H ; Select VIDEO service 2: Position cursor
- mov BH,0 ; Stay with display page 0
- int 10H ; Call VIDEO
- ENDM
-
-
- ;---------------------------------------------------------------
- ; NEWLINE -- Sends a newline sequence to DOS Standard Output
- ; via DOS service 40H
- ; Last update 3/16/89
- ;
- ; Caller need not pass any parameters.
- ; Action: Sends a newline sequence DOS Standard Output
- ;---------------------------------------------------------------
-
- Newline MACRO
- Write CRLF,2
- ENDM
-
-
- ;---------------------------------------------------------------
- ; POKECHAR -- Inserts a single character into a string
- ; Last update 3/16/89
- ;
- ; Caller must pass:
- ; In Target: The name of the string to be poked at
- ; In TheChar: The character to be pocked into the string
- ; In ToPos: The 0-based position in the string to poke to
- ; Action: Pokes character passed in TheChar into string
- ; passed in Target to position passed in ToPos.
- ; The first character in the string is 0, etc.
- ;---------------------------------------------------------------
- PokeChar MACRO Target,TheChar,ToPos
- lea BX,Target ; Load the address of target string into BX
- mov BYTE PTR [BX+ToPos],TheChar ; Move char into the string
- ENDM
-
-
- ;---------------------------------------------------------------
- ; WRITE -- Displays information to the screen via DOS
- ; service 40: Print String to Standard Output
- ; Last update 3/16/89
- ;
- ; Caller must pass:
- ; In ShowIt: The name of the string to be displayed
- ; In ShowLength: The length of the string to be displayed
- ; Action: Displays the string to DOS Standard Output
- ;---------------------------------------------------------------
- Write MACRO ShowIt,ShowLength
- mov BX,1 ; Selects DOS file handle 1: Standard Output
- mov CX,ShowLength ; Length of string passed in CX
- lea DX,Showit ; Offset address of string is passed in DX
- mov AH,40H ; Select DOS service 40: Print String
- int 21H ; Call DOS
- ENDM
-
- ;---------------------------------------------------------------
- ; WRITELN -- Displays information to the screen via DOS
- ; service 40H: Display to Standard Output, then
- ; issues a newline
- ; Last update 3/16/89
- ;
- ; Caller must pass:
- ; In ShowIt: The name of the string to be displayed
- ; In ShowLength: The length of the string to be displayed
- ; Action: Displays the string in ShowIt, then issues a
- ; newline. Hardware cursor will move to the
- ; left margin of the following line. If the
- ; display is to the bottom screen line, the
- ; screen will scroll.
- ; Calls: Write
- ;---------------------------------------------------------------
-
- Writeln MACRO ShowIt,ShowLength
- Write ShowIt,ShowLength ; Display the string proper through Write
- Write CRLF,2 ; Display the newline string through Write
- ENDM
-
-