home *** CD-ROM | disk | FTP | other *** search
- ; pcevgapl.asm
- ;
- ; 7/17/89 by Ted
- ;
- ; font plotter for EGA/VGA multi-plane display modes.
- ;
- ; 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.
- ;------------------------------------------------------------------------------;
- include PCDECL.MAC
- include PCDATA.MAC
-
- GCADDR = 3CEh
-
- PSEG
- ;------------------------------------------------------------------------------;
- ; void DIGPRIV pc_evgaplotchar()
-
- pubproc DIGPRIV pc_evgaplotchar
- 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
-
- ; Set up video mode registers; from Video Systems book.
- ; Read in color compare mode but w/don't care bits set so all 1's are read.
- ; Write in color-thru-planes mode. Use 'and' instruction to read-then-write.
-
- mov dx, GCADDR
- mov ax, 0A05h ; ah = write mode 2, read mode 1; al = mode reg no.
- out dx, ax
-
- mov ax, 0007h ; ah = color don't care bits; al = color don't care reg.
- out dx, ax
-
- ; Set up y and endy
- mov dx, pcdatastruc_ext.starty ; put y in dx
- mov bp, dx
- add bp, pcdatastruc_ext.fontlines ; put ending y val in bp
-
- mov bx, word ptr pcdatastruc_ext.fgcol ; bl = fgcol; bh = bgcol
-
- linesloop:
- push ds
- mov ds, pcdatastruc_ext.fontseg
- lodsb ; load font byte for this line; inc fontaddr
- pop ds
- mov ah, al ; save font byte in ah
-
- ; plot this scanline for all 'nsame' chars
- push dx ; save y
- push di ; save vidaddr
-
- mov dx, GCADDR ; put graphics control port address in dx
- mov cx, pcdatastruc_ext.nsame
- charloop:
- ; fg
- mov al, 08 ; index of bit mask register
- out dx, ax ; use font byte for fg mask
- and es:[di], bl ; fg
- ; bg
- mov al, 08 ; index of bit mask register
- not ah ; invert font byte for bg mask
- out dx, ax ; use inverted font byte for bg mask
- and es:[di], bh ; bg
- inc di
- not ah ; de-invert font byte
- loop charloop
-
- pop di ; restore vidaddr
- pop dx ; restore y
-
- ;; 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:
- ; Restore full bit mask
- mov dx, GCADDR
- mov ax, 0FF08h
- out dx, ax
-
- ; Restore color don't care register
- mov ax, 0F07h ; ah = color care bits; al = color don't care reg.
- out dx, ax
-
- ; Restore write mode 0
- mov ax, 0005h
- out dx, ax ; index of mode register ; write mode 0
-
- popm <si, di, es, ds, bp>
- ret
- endproc pc_evgaplotchar
- ;------------------------------------------------------------------------------;
- ENDPS
- end
- ;------------------------------------------------------------------------------;
-