home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / C / SUPER_C.ZIP / V2LIB.ASM < prev    next >
Encoding:
Assembly Source File  |  1980-01-01  |  3.4 KB  |  75 lines

  1. ;               Video Display Library (part 2)
  2.  
  3. _TEXT   segment byte public 'CODE'      ; Place the code in the code segment
  4.         assume  CS:_TEXT                ; Assume the CS register points to it
  5.  
  6. ; _scrClr()
  7. ;
  8. ; Function: Clear the screen.
  9. ;
  10. ; Algorithm: Call the ROM BIOS scroll up function to do the actual clearing.
  11.  
  12.         public  _scrClr         ; This routine is public (available to
  13.                                 ; other modules)
  14.  
  15. _scrClr proc near               ; This is a NEAR type subroutine
  16.         push    bp              ; Save the BP resgister
  17.         push    si              ; And SI
  18.         push    di              ; And DI
  19.         xor     al,al           ; Set the number of lines to scroll to zero
  20.         mov     ch,al           ; Set the upper left corner row to 0
  21.         mov     cl,al           ; Set the upper left corner column to 0
  22.         mov     dh,24           ; Set the lower right corner row to 24
  23.         mov     dl,79           ; Set the lower right corner column to 79
  24.         mov     bh,7            ; Set the attribute to white-on-black
  25.         mov     ah,6            ; Video function 6: scroll up
  26.         int     10H             ; Call the ROM BIOS video interrupt
  27.         mov     ah,15           ; Do a get state interrupt to get the 
  28.                                 ; page # into bh
  29.         int     10H             ; Video BIOS interrupt
  30.         mov     dx,0            ; Set the row and column to 0
  31.         mov     ah,2            ; Do a set cursor position interrupt
  32.         int     10H             ; Video interrupt
  33.         pop     di              ; Restore the DI register
  34.         pop     si              ; And SI
  35.         pop     bp              ; And BP
  36.         ret                     ; Return to the calling program
  37. _scrClr endp                    ; End of subroutine
  38.  
  39. ; _scrPuts(s)
  40. ;
  41. ; Function: Do a TTY style write of the null-terminated string pointed
  42. ; to by s.
  43. ;
  44. ; Algorithm: Repeatedly call the ROM BIOS TTY style write character
  45. ; function for each character in the string.
  46.  
  47.         public  _scrPuts        ; Routine is available to other modules
  48.  
  49.         s = 4                   ; The offset to the s parameter
  50.  
  51. _scrPuts proc near              ; NEAR type subroutine
  52.         push    bp              ; Save the BP register
  53.         mov     bp,sp           ; Set BP to SP, so we can access the parameters
  54.         push    si              ; Save the SI register
  55.         push    di              ; And DI
  56.         mov     si,[bp+s]       ; Set SI to the string pointer
  57.  
  58. sLoop:  lods    byte ptr [si]   ; AL = *SI++ (get the next byte in the string)
  59.         or      al,al           ; Is it zero (end-of-string)?
  60.         jz      sExit           ; If it is, exit the loop
  61.         mov     bl,3            ; Set foreground color to white
  62.         mov     ah,14           ; Do a TTY style write using the BIOS
  63.         int     10H             ; ROM BIOS video interrupt
  64.         jmp     sLoop           ; Go get the next character
  65.  
  66. sExit:  pop     di              ; Restore the DI register
  67.         pop     si              ; Restore the SI register
  68.         pop     bp              ; Restore the BP register
  69.         ret                     ; Return to calling program
  70. _scrPuts endp                   ; End of subroutine
  71.  
  72. _TEXT   ends                    ; End of code segment
  73.         end                     ; End of assembly code
  74.  
  75.