home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TUR6_101.ZIP / V4.ASM < prev    next >
Encoding:
Assembly Source File  |  1986-06-07  |  5.0 KB  |  82 lines

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