home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / nor_asm / cursor18.asm < prev    next >
Assembly Source File  |  1989-05-17  |  3KB  |  126 lines

  1. CR    EQU    13            ;Carriage return
  2. LF    EQU    10            ;Line feed
  3.  
  4. .MODEL    SMALL
  5. .CODE
  6.  
  7.     PUBLIC    CLEAR_SCREEN
  8. ;-----------------------------------------------------------------------;
  9. ; This procedure clears the entire screen.                ;
  10. ;-----------------------------------------------------------------------;
  11. CLEAR_SCREEN    PROC
  12.     PUSH    AX
  13.     PUSH    BX
  14.     PUSH    CX
  15.     PUSH    DX
  16.     XOR    AL,AL            ;Blank entire window
  17.     XOR    CX,CX            ;Upper left corner is at (0,0)
  18.     MOV    DH,24            ;Bottom line of screen is line 24
  19.     MOV    DL,79            ;Right side is at column 79
  20.     MOV    BH,7            ;Use normal attribute for blanks
  21.     MOV    AH,6            ;Call for SCROLL-UP function
  22.     INT    10h            ;Clear the window
  23.     POP    DX
  24.     POP    CX
  25.     POP    BX
  26.     POP    AX
  27.     RET
  28. CLEAR_SCREEN    ENDP
  29.  
  30.  
  31.     PUBLIC    GOTO_XY
  32. ;-----------------------------------------------------------------------;
  33. ; This procedure moves the cursor                    ;
  34. ;                                    ;
  35. ; On entry:    DH    Row (Y)                        ;
  36. ;        DL    Column (X)                    ;
  37. ;-----------------------------------------------------------------------;
  38. GOTO_XY        PROC
  39.     PUSH    AX
  40.     PUSH    BX
  41.     MOV    BH,0            ;Display page 0
  42.     MOV    AH,2            ;Call for SET CURSOR POSITION
  43.     INT    10h
  44.     POP    BX
  45.     POP    AX
  46.     RET
  47. GOTO_XY        ENDP
  48.  
  49.     PUBLIC    CURSOR_RIGHT
  50. ;-----------------------------------------------------------------------;
  51. ; This procedure moves the cursor one position to the right or to the    ;
  52. ; next line if the cursor was at the end of a line.            ;
  53. ;                                    ;
  54. ; Uses:        SEND_CRLF                        ;
  55. ;-----------------------------------------------------------------------;
  56. CURSOR_RIGHT    PROC
  57.     PUSH    AX
  58.     PUSH    BX
  59.     PUSH    CX
  60.     PUSH    DX
  61.     MOV    AH,3            ;Read the current cursor position
  62.     MOV    BH,0            ;On page 0
  63.     INT    10h            ;Read cursor position
  64.     MOV    AH,2            ;Set new cursor position
  65.     INC    DL            ;Set column to next position
  66.     CMP    DL,79            ;Make sure column <= 79
  67.     JBE    OK
  68.     CALL    SEND_CRLF        ;Go to next line
  69.     JMP    DONE
  70. OK:    INT    10h
  71. DONE:    POP    DX
  72.     POP    CX
  73.     POP    BX
  74.     POP    AX
  75.     RET
  76. CURSOR_RIGHT    ENDP
  77.  
  78.     PUBLIC    CLEAR_TO_END_OF_LINE
  79. ;-----------------------------------------------------------------------;
  80. ; This procedure clears the line from the current cursor position to    ;
  81. ; the end of that line.                            ;
  82. ;-----------------------------------------------------------------------;
  83. CLEAR_TO_END_OF_LINE    PROC
  84.     PUSH    AX
  85.     PUSH    BX
  86.     PUSH    CX
  87.     PUSH    DX
  88.     MOV    AH,3            ;Read current cursor position
  89.     XOR    BH,BH            ; on page 0
  90.     INT    10h            ;Now have (X,Y) in DL, DH
  91.     MOV    AH,6            ;Set up to clear to end of line
  92.     XOR    AL,AL            ;Clear window
  93.     MOV    CH,DH            ;All on same line
  94.     MOV    CL,DL            ;Start at the cursor position
  95.     MOV    DL,79            ;And stop at the end of the line
  96.     MOV    BH,7            ;Use normal attribute
  97.     INT    10h
  98.     POP    DX
  99.     POP    CX
  100.     POP    BX
  101.     POP    AX
  102.     RET
  103. CLEAR_TO_END_OF_LINE    ENDP
  104.  
  105.     PUBLIC    SEND_CRLF
  106. ;-----------------------------------------------------------------------;
  107. ; This routine just sends a carriage return-line feed pair to the    ;
  108. ; display, using the DOS routines so that scrolling will be handled    ;
  109. ; correctly.                                ;
  110. ;-----------------------------------------------------------------------;
  111. SEND_CRLF    PROC
  112.     PUSH    AX
  113.     PUSH    DX
  114.     MOV    AH,2
  115.     MOV    DL,CR
  116.     INT    21h
  117.     MOV    DL,LF
  118.     INT    21h
  119.     POP    DX
  120.     POP    AX
  121.     RET
  122. SEND_CRLF    ENDP
  123.  
  124.  
  125.     END
  126.