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

  1. ; pc2bitpl.asm
  2. ;
  3. ; 7/07/89 by Ted
  4. ;
  5. ; font plotter for 2 bit per pixel display modes (CGA modes 4, 5)
  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. ; 9/06/89 ted    Moved coltab to code segment to make it more accessible.
  13. ;------------------------------------------------------------------------------;
  14. include    PCDECL.MAC
  15. include    PCDATA.MAC
  16.  
  17.     PSEG
  18.  
  19.     coltab    db    000h, 055h, 0AAh, 0FFh
  20. ;------------------------------------------------------------------------------;
  21. ; void DIGPRIV pc_2bitplotchar()
  22.  
  23. pubproc DIGPRIV    pc_2bitplotchar
  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.     mov dx, pcdatastruc_ext.starty        ; put y in dx
  37.     mov bp, dx
  38.     add bp, pcdatastruc_ext.fontlines    ; put ending y val in bp
  39.  
  40. ; get fg, bg colors into ax
  41.     mov ax, word ptr pcdatastruc_ext.fgcol    ; al = fgcol; ah = bgcol
  42.     and ax, 0303h        ; mask both colors at once
  43.  
  44.     xor bh, bh
  45.     mov bl, al
  46.     mov cl, cs:coltab[bx]    ; fg
  47.     mov bl, ah
  48.     mov ch, cs:coltab[bx]    ; bg
  49. linesloop:
  50.  
  51.     mov bx, ds
  52.     mov ds, pcdatastruc_ext.fontseg
  53.     lodsb                        ; load font byte for this line; inc fontaddr
  54.     mov ds, bx
  55.  
  56. ; expand the font byte and put the colors in
  57.     xor bx, bx
  58.     mov ah, 8
  59. fontx:
  60.     shr al, 1
  61.     rcr bx, 1
  62.     sar bx, 1
  63.     dec ah
  64.     jnz fontx
  65.  
  66.     mov ax, bx
  67.     and al, cl    ; fg
  68.     and ah, cl    ; fg
  69.     not bx
  70.     and bl, ch    ; bg
  71.     and bh, ch    ; bg
  72.     or  ax, bx
  73.     xchg ah, al    ; put bytes in right order
  74.  
  75. ; plot this scanline for all 'nsame' chars
  76.     mov bx, di
  77.     push cx
  78.     mov cx, pcdatastruc_ext.nsame
  79.     rep stosw
  80.     pop  cx
  81.     mov di, bx
  82.  
  83. ;; if (++y > endy) break;
  84.     inc dx
  85.     cmp dx, bp
  86.     jae alldone
  87.  
  88. ;; vidaddr += ((y & ilmask) == 0) ? vbincr : ilsize;
  89.     test dx, pcdatastruc_ext.ilmask
  90.     jz incvidbuf
  91.     add di, pcdatastruc_ext.ilsize
  92.     jmp linesloop
  93. incvidbuf:
  94.     add di, pcdatastruc_ext.vbincr
  95.     jmp linesloop
  96.  
  97. ;---------
  98. alldone:
  99.     popm <si, di, es, ds, bp>
  100.     ret
  101. endproc pc_2bitplotchar
  102. ;------------------------------------------------------------------------------;
  103.     ENDPS
  104.     end
  105. ;------------------------------------------------------------------------------;
  106.  
  107.