home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / CSCAP323.ZIP / OWLSRC.EXE / PCEVGAPL.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-02-03  |  3.1 KB  |  121 lines

  1. ; pcevgapl.asm
  2. ;
  3. ; 7/17/89 by Ted
  4. ;
  5. ; font plotter for EGA/VGA multi-plane display modes.
  6. ;
  7. ; OWL-PCA 1.2
  8. ; Copyright (c) 1989 Oakland Group Inc.
  9. ; ALL RIGHTS RESERVED
  10. ;
  11. ;------------------------REVISION HISTORY--------------------------------------;
  12. ; 9/06/89 ted    Initialized ds in large data models; I forgot to before.
  13. ;------------------------------------------------------------------------------;
  14. include    PCDECL.MAC
  15. include    PCDATA.MAC
  16.  
  17.     GCADDR = 3CEh
  18.  
  19.     PSEG
  20. ;------------------------------------------------------------------------------;
  21. ; void DIGPRIV pc_evgaplotchar()
  22.  
  23. pubproc DIGPRIV    pc_evgaplotchar
  24.     pushm <bp, ds, es, di, si>    ; no args, so bp is not needed
  25.  
  26. IF FAR_DATA
  27.     mov ax, seg pcdatastruc_ext
  28.     mov ds, ax
  29. ENDIF
  30.  
  31. ; Get everything we need out of pcdatastruc_ext
  32.     mov si, word ptr pcdatastruc_ext.fontoffs
  33.     mov di, pcdatastruc_ext.vidaddr
  34.     mov es, pcdatastruc_ext.dispseg
  35.  
  36. ; Set up video mode registers; from Video Systems book.
  37. ; Read in color compare mode but w/don't care bits set so all 1's are read.
  38. ; Write in color-thru-planes mode. Use 'and' instruction to read-then-write.
  39.  
  40.     mov dx, GCADDR
  41.     mov ax, 0A05h        ; ah = write mode 2, read mode 1; al = mode reg no.
  42.     out dx, ax
  43.  
  44.     mov ax, 0007h        ; ah = color don't care bits; al = color don't care reg.
  45.     out dx, ax
  46.  
  47. ; Set up y and endy
  48.     mov dx, pcdatastruc_ext.starty        ; put y in dx
  49.     mov bp, dx
  50.     add bp, pcdatastruc_ext.fontlines    ; put ending y val in bp
  51.  
  52.     mov bx, word ptr pcdatastruc_ext.fgcol    ; bl = fgcol; bh = bgcol
  53.  
  54. linesloop:
  55.     push ds
  56.     mov ds, pcdatastruc_ext.fontseg
  57.     lodsb                        ; load font byte for this line; inc fontaddr
  58.     pop ds
  59.     mov ah, al                    ;  save font byte in ah
  60.  
  61. ; plot this scanline for all 'nsame' chars
  62.     push dx                        ; save y
  63.     push di                        ; save vidaddr
  64.  
  65.     mov dx, GCADDR                ; put graphics control port address in dx
  66.     mov cx, pcdatastruc_ext.nsame
  67. charloop:
  68. ;  fg
  69.     mov al, 08                    ; index of bit mask register
  70.     out dx, ax                    ; use font byte for fg mask
  71.     and es:[di], bl    ; fg
  72. ; bg
  73.     mov al, 08                    ; index of bit mask register
  74.     not ah                        ; invert font byte for bg mask
  75.     out dx, ax                    ; use inverted font byte for bg mask
  76.     and es:[di], bh    ; bg
  77.     inc di
  78.     not ah                        ; de-invert font byte
  79.     loop charloop
  80.  
  81.     pop di                        ; restore vidaddr
  82.     pop dx                        ; restore y
  83.  
  84. ;; if (++y > endy) break;
  85.     inc dx
  86.     cmp dx, bp
  87.     jae alldone
  88.  
  89. ;; vidaddr += ((y & ilmask) == 0) ? vbincr : ilsize;
  90.     test dx, pcdatastruc_ext.ilmask
  91.     jz incvidbuf
  92.     add di, pcdatastruc_ext.ilsize
  93.     jmp linesloop
  94. incvidbuf:
  95.     add di, pcdatastruc_ext.vbincr
  96.     jmp linesloop
  97.  
  98. ;---------
  99. alldone:
  100. ; Restore full bit mask
  101.     mov dx, GCADDR
  102.     mov ax, 0FF08h
  103.     out dx, ax
  104.  
  105. ; Restore color don't care register
  106.     mov ax, 0F07h        ; ah = color care bits; al = color don't care reg.
  107.     out dx, ax
  108.  
  109. ; Restore write mode 0
  110.     mov ax, 0005h
  111.     out dx, ax    ; index of mode register ; write mode 0
  112.  
  113.     popm <si, di, es, ds, bp>
  114.     ret
  115. endproc pc_evgaplotchar
  116. ;------------------------------------------------------------------------------;
  117.     ENDPS
  118.     end
  119. ;------------------------------------------------------------------------------;
  120.  
  121.