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

  1. ;--------------------------------------------------------------------
  2. ; Author       : Kevin Dahl                                         :
  3. ; Last Revised : June 7, 1986                                       :
  4. ;                                                                   :
  5. ; FILENAME - V7.ENH                                                 :
  6. ;                                                                   :
  7. ; FILLROWATTRIB                                                     :
  8. ;        This routine displays one or more copies of a single       :
  9. ;        attribute byte character to the screen.                    :
  10. ; ENTRY                                                             :
  11. ;        [bp+6]  = Color to be displayed                            :
  12. ;        [bp+8]  = Number of times the color is to be displayed on  :
  13. ;                  the screen.                                      :
  14. ;        [bp+10] = Row the attribute byte is to be displayed in.    :
  15. ;        [bp+12] = Column the attribute byte is to start in.        :
  16. ;                                                                   :
  17. ; EXIT                                                              :
  18. ;        Nothing is returned                                        :
  19. ;--------------------------------------------------------------------
  20. fillrowattrib 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        v28
  30.               cmp       al,3                     ; check if text modes
  31.               ja        v32                      ; 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        v27                      ; 40 cols if jmp
  35.               inc       cx                       ; if get here then 80 cols
  36. v27:
  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       v29
  43. v28:
  44.               mov       ax,0B000h                ; monochrome monitor address
  45. v29:
  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 attribute
  55.               inc       di                       ; set for attribute bytes
  56.               mov       cx,[bp+8]                ; number of times to display color byte
  57.               cmp       cx,1
  58.               jb        v32                      ; no bytes to display
  59.               mov       ah,[bp+6]                ; color byte into ah
  60.               mov       dx,03DAh                 ; status port
  61.               cld                                ; clear direction flag
  62.               cli                                ; clear interrupts
  63. v30:
  64.               in        al,dx                    ; get status
  65.               test      al,1                     ; is it low?
  66.               jnz       v30                      ; wait until it is
  67. v31:
  68.               in        al,dx                    ; get status
  69.               test      al,1                     ; is it high?
  70.               jz        v31                      ; wait until it is
  71.               mov       es:byte ptr[di],ah       ; display attribute byte
  72.               add       di,2                     ; skip to next char position
  73.               loop      v30                      ; repeat until column is filled
  74.               sti                                ; turn interrupts back on
  75. v32:
  76.               mov       sp,bp                    ; restore stack
  77.               pop       bp                       ; restore base pointer
  78.               pop       ds                       ; restore data segment
  79.               ret       8                        ; remove parameters and return
  80. fillrowattrib endp
  81.