home *** CD-ROM | disk | FTP | other *** search
- ; pc2bitpl.asm
- ;
- ; 7/07/89 by Ted
- ;
- ; font plotter for 2 bit per pixel display modes (CGA modes 4, 5)
- ;
- ; Copyright (c) 1989 Oakland Group Inc.
- ; ALL RIGHTS RESERVED
- ;
- ;------------------------REVISION HISTORY--------------------------------------;
- ; 9/06/89 ted Initialized ds in large data models; I forgot to before.
- ; 9/06/89 ted Moved coltab to code segment to make it more accessible.
- ;------------------------------------------------------------------------------;
- include PCDECL.MAC
- include PCDATA.MAC
-
- PSEG
-
- coltab db 000h, 055h, 0AAh, 0FFh
- ;------------------------------------------------------------------------------;
- ; void DIGPRIV pc_2bitplotchar()
-
- pubproc DIGPRIV pc_2bitplotchar
- pushm <bp, ds, es, di, si> ; no args, so bp is not needed
-
- IF FAR_DATA
- mov ax, seg pcdatastruc_ext
- mov ds, ax
- ENDIF
-
- ;; get everything we need out of pcdatastruc_ext
- mov si, word ptr pcdatastruc_ext.fontoffs
- mov di, pcdatastruc_ext.vidaddr
- mov es, pcdatastruc_ext.dispseg
-
- mov dx, pcdatastruc_ext.starty ; put y in dx
- mov bp, dx
- add bp, pcdatastruc_ext.fontlines ; put ending y val in bp
-
- ; get fg, bg colors into ax
- mov ax, word ptr pcdatastruc_ext.fgcol ; al = fgcol; ah = bgcol
- and ax, 0303h ; mask both colors at once
-
- xor bh, bh
- mov bl, al
- mov cl, cs:coltab[bx] ; fg
- mov bl, ah
- mov ch, cs:coltab[bx] ; bg
- linesloop:
-
- mov bx, ds
- mov ds, pcdatastruc_ext.fontseg
- lodsb ; load font byte for this line; inc fontaddr
- mov ds, bx
-
- ; expand the font byte and put the colors in
- xor bx, bx
- mov ah, 8
- fontx:
- shr al, 1
- rcr bx, 1
- sar bx, 1
- dec ah
- jnz fontx
-
- mov ax, bx
- and al, cl ; fg
- and ah, cl ; fg
- not bx
- and bl, ch ; bg
- and bh, ch ; bg
- or ax, bx
- xchg ah, al ; put bytes in right order
-
- ; plot this scanline for all 'nsame' chars
- mov bx, di
- push cx
- mov cx, pcdatastruc_ext.nsame
- rep stosw
- pop cx
- mov di, bx
-
- ;; if (++y > endy) break;
- inc dx
- cmp dx, bp
- jae alldone
-
- ;; vidaddr += ((y & ilmask) == 0) ? vbincr : ilsize;
- test dx, pcdatastruc_ext.ilmask
- jz incvidbuf
- add di, pcdatastruc_ext.ilsize
- jmp linesloop
- incvidbuf:
- add di, pcdatastruc_ext.vbincr
- jmp linesloop
-
- ;---------
- alldone:
- popm <si, di, es, ds, bp>
- ret
- endproc pc_2bitplotchar
- ;------------------------------------------------------------------------------;
- ENDPS
- end
- ;------------------------------------------------------------------------------;
-