home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / CSAPE32.ARJ / SOURCE / OWLSCR / PC1BITPL.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-02-03  |  2.4 KB  |  90 lines

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