home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / PC1BITPL.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-09-06  |  2.3 KB  |  89 lines

  1. ; pc1bitpl.asm
  2. ;
  3. ; 7/07/89 by Ted
  4. ;
  5. ; font plotter for 1 bit per pixel display modes
  6. ;
  7. ; Copyright (c) 1989 Oakland Group Inc.
  8. ; ALL RIGHTS RESERVED
  9. ;
  10. ;------------------------REVISION HISTORY--------------------------------------;
  11. ; 9/06/89 ted    Initialized ds in large data models; I forgot to before.
  12. ;------------------------------------------------------------------------------;
  13. include    PCDECL.MAC
  14. include    PCDATA.MAC
  15.  
  16.     PSEG
  17. ;------------------------------------------------------------------------------;
  18. ; void DIGPRIV pc_1bitplotchar()
  19.  
  20. pubproc DIGPRIV    pc_1bitplotchar
  21.     pushm <bp, ds, es, di, si>    ; no args, so bp is not needed
  22.  
  23. IF FAR_DATA
  24.     mov ax, seg pcdatastruc_ext
  25.     mov ds, ax
  26. ENDIF
  27.  
  28. ;; get everything we need out of pcdatastruc_ext
  29.     mov si, word ptr pcdatastruc_ext.fontoffs
  30.     mov di, pcdatastruc_ext.vidaddr
  31.     mov es, pcdatastruc_ext.dispseg
  32.  
  33.     mov dx, pcdatastruc_ext.starty        ; put y in dx
  34.     mov bp, dx
  35.     add bp, pcdatastruc_ext.fontlines    ; put ending y val in bp
  36.  
  37. ;; find out if chars are black on black or white on white
  38.     mov ax, word ptr pcdatastruc_ext.fgcol    ; al = fgcol; ah = bgcol
  39.     xor ah, al                    ; set ah lo bit if colors different
  40.     sar al, 1                    ; shift al lo bit into ah:
  41.     rcl ah, 1                    ; bit 0 of ah now shows fgcol lo bit
  42.                                 ; bit 1 of ah now shows if text has contrast
  43. linesloop:
  44.     mov al, 0FFh
  45.     test ah, 2                    ; test contrast bit
  46.     jz nocontrast
  47.     mov bx, ds                    ;  save ds temporarily in bx
  48.     mov ds, pcdatastruc_ext.fontseg
  49.     lodsb                        ; load font byte for this line; inc fontaddr
  50.     mov ds, bx                    ;  restore ds
  51. nocontrast:
  52.  
  53. ;; check for inverse or normal video
  54.     test ah, 1                    ; test fgcolbit
  55.     jnz normal
  56.     not al
  57. normal:
  58.  
  59. ; plot this scanline for all 'nsame' chars
  60.     mov cx, pcdatastruc_ext.nsame
  61.     mov bx, di                    ;  save vidaddr in bx temporarily
  62.     rep stosb
  63.     mov di, bx
  64.  
  65. ;; if (++y > endy) break;
  66.     inc dx
  67.     cmp dx, bp
  68.     jae alldone
  69.  
  70. ;; vidaddr += ((y & ilmask) == 0) ? vbincr : ilsize;
  71.     test dx, pcdatastruc_ext.ilmask
  72.     jz incvidbuf
  73.     add di, pcdatastruc_ext.ilsize
  74.     jmp linesloop
  75. incvidbuf:
  76.     add di, pcdatastruc_ext.vbincr
  77.     jmp linesloop
  78.  
  79. ;---------
  80. alldone:
  81.     popm <si, di, es, ds, bp>
  82.     ret
  83. endproc pc_1bitplotchar
  84. ;------------------------------------------------------------------------------;
  85.     ENDPS
  86.     end
  87. ;------------------------------------------------------------------------------;
  88.  
  89.