home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / TUR6_101.ZIP / V6.ASM < prev    next >
Encoding:
Assembly Source File  |  1986-06-07  |  4.9 KB  |  80 lines

  1. ;--------------------------------------------------------------------
  2. ; Author       : Kevin Dahl                                         :
  3. ; Last Revised : June 7, 1986                                       :
  4. ;                                                                   :
  5. ; FILENAME - V6.ENH                                                 :
  6. ;                                                                   :
  7. ; FILLROW                                                           :
  8. ;        This routine displays one or more copies of a single       :
  9. ;        character to the screen.                                   :
  10. ; ENTRY                                                             :
  11. ;        [bp+6]  = Character to be displayed                        :
  12. ;        [bp+8]  = Number of times the character is to be displayed :
  13. ;                  on the screen.                                   :
  14. ;        [bp+10] = Row the character is to be displayed in.         :
  15. ;        [bp+12] = Column the character is to start in.             :
  16. ;                                                                   :
  17. ; EXIT                                                              :
  18. ;        Nothing is returned                                        :
  19. ;--------------------------------------------------------------------
  20. fillrow       proc      near
  21.               push      ds
  22.               push      bp                       ; save stack
  23.               mov       bp,sp
  24.               mov       ah,0fh                   ; get current video mode
  25.               int       10h                      ; using BIOS services
  26.               xor       dx,dx
  27.               mov       dl,ah                    ; save number columns per line
  28.               cmp       al,7                     ; check for monochrome monitor
  29.               je        v22
  30.               cmp       al,3                     ; check if text modes
  31.               ja        v26                      ; graphics mode - no write
  32.               mov       cx,7                     ; set for 40 col text modes
  33.               cmp       dl,80                    ; check for num of cols
  34.               jb        v21                      ; 40 cols if jmp
  35.               inc       cx                       ; if get here then 80 cols
  36. v21:
  37.               xor       ax,ax                    ; zero out ax
  38.               mov       al,bh                    ; active display page for CGA
  39.               shl       ax,cl                    ; calc address for display page
  40.               mov       cx,0B800h                ; address for CGA
  41.               add       ax,cx                    ; calc starting address
  42.               jmp       v23
  43. v22:
  44.               mov       ax,0B000h                ; monochrome monitor address
  45. v23:
  46.               mov       es,ax                    ; video address into es
  47.               mov       ax,[bp+10]               ; row coordinate
  48.               mov       bx,[bp+12]               ; col coordinate
  49.               dec       ax                       ; (row - 1)
  50.               mul       dx                       ; (row - 1) * number of columns
  51.               add       ax,bx                    ; (row - 1) * # cols + col offset
  52.               dec       ax                       ; (row - 1) * # cols + col offset - 1
  53.               shl       ax,1                     ; ((row-1)* #cols + col offset - 1)*2
  54.               mov       di,ax                    ; offset in display scrn for string
  55.               mov       cx,[bp+8]                ; number of times to display character
  56.               cmp       cx,1
  57.               jb        v26                      ; no characters to display
  58.               mov       ah,[bp+6]                ; character byte into ah
  59.               mov       dx,03DAh                 ; status port
  60.               cld                                ; clear direction flag
  61.               cli                                ; clear interrupts
  62. v24:
  63.               in        al,dx                    ; get status
  64.               test      al,1                     ; is it low?
  65.               jnz       v24                      ; wait until it is
  66. v25:
  67.               in        al,dx                    ; get status
  68.               test      al,1                     ; is it high?
  69.               jz        v25                      ; wait until it is
  70.               mov       es:byte ptr[di],ah       ; display character byte
  71.               add       di,2                     ; skip to next char position
  72.               loop      v24                      ; repeat until column is filled
  73.               sti                                ; turn interrupts back on
  74. v26:
  75.               mov       sp,bp                    ; restore stack
  76.               pop       bp                       ; restore base pointer
  77.               pop       ds                       ; restore data segment
  78.               ret       8                        ; remove parameters and return
  79. fillrow       endp
  80.