HGR text rending, work-in-progress.

This commit is contained in:
Bobbi Webber-Manners 2021-09-23 16:50:16 -04:00
parent 3659a31790
commit 00e52ca2da
2 changed files with 34 additions and 15 deletions

View File

@ -102,8 +102,8 @@ VDUWORKSZ EQU VDUVAREND-VDUWORKSP+1
* 3 6 7 * 3 6 7
SCNTXTMAXX DB 79,39,19,79,39,19,39,39 ; Max text column SCNTXTMAXX DB 79,39,19,79,39,19,39,39 ; Max text column
SCNTXTMAXY DB 23,23,23,23,23,23,23,23 ; Max text row SCNTXTMAXY DB 23,23,23,23,23,23,23,23 ; Max text row
SCNBYTES DB 1,1 SCNBYTES DB 1,1,8
SCNCOLOURS DB 1,1 SCNCOLOURS DB 1,1,8
SCNTYPE DB 1,0,128,1 SCNTYPE DB 1,0,128,1
* b7=FastDraw * b7=FastDraw
* b6=Teletext * b6=Teletext
@ -342,22 +342,30 @@ PRCHR4 PHY
PRCHR6 STA (VDUADDR),Y ; Store it PRCHR6 STA (VDUADDR),Y ; Store it
STA $C005 ; Back to aux memory STA $C005 ; Back to aux memory
PLP ; Restore IRQs PLP ; Restore IRQs
LDY VDUBYTES LDY VDUBYTES
DEY ; If VDUBYTE=1, text mode DEY ; If VDUBYTE=1, text mode
BEQ :DONE BEQ :DONE
JSR HCHARADDR ; Addr in VDUADDR
JSR HCHARADDR PHP ; Disable IRQs while
* TODO: GRAPHICS! SEI ; toggling memory
STA $C004 ; Write to main
LDA VDUADDR+0
STA HGRADDR+0
LDA VDUADDR+1
STA HGRADDR+1
STA $C005 ; Write to aux
PLP ; Restore IRQs
>>> XF2MAIN,DRAWCHAR ; Plot char on HGR screen
:DONE RTS :DONE RTS
PUTCHRET
>>> ENTAUX
RTS
* Fetch character from screen at (TEXTX,TEXTY) and return MODE in Y * Fetch character from screen at (TEXTX,TEXTY) and return MODE in Y
* Always uses text screen (which we maintain even in graphics mode)
BYTE87 BYTE87
GETCHRC LDY VDUBYTES GETCHRC JSR CHARADDR ; Find character address
DEY ; If VDUBYTE=1, text mode
BNE GETCHRSOFT ; Graphics mode
JSR CHARADDR ; Find character address
PHP ; Disable IRQs while PHP ; Disable IRQs while
SEI ; toggling memory SEI ; toggling memory
BCC GETCHR6 ; Aux memory BCC GETCHR6 ; Aux memory
@ -376,7 +384,6 @@ GETCHR7 TYA
LDY VDUMODE ; Y=MODE LDY VDUMODE ; Y=MODE
TAX ; X=char TAX ; X=char
GETCHROK RTS GETCHROK RTS
GETCHRSOFT RTS ; *TODO* Jump to gfx
* Get text cursor position * Get text cursor position
BYTE86 LDY VDUTEXTY ; ROW ; $86 = read cursor pos BYTE86 LDY VDUTEXTY ; ROW ; $86 = read cursor pos
@ -408,13 +415,15 @@ CHARADDR40 TAY ; Y=offset into this row
HCHARADDR LDA VDUTEXTY HCHARADDR LDA VDUTEXTY
ASL ASL
TAX TAX
CLC
LDA HGRTAB+0,X ; LSB of row address LDA HGRTAB+0,X ; LSB of row address
ADC VDUTEXTX
STA VDUADDR+0 STA VDUADDR+0
LDA HGRTAB+1,X ; MSB of row address LDA HGRTAB+1,X ; MSB of row address
ADC #$00
STA VDUADDR+1 STA VDUADDR+1
LDY VDUTEXTX
RTS RTS
* (VDUADDR),Y=>character address * (VDUADDR)=>character address
* Move cursor left * Move cursor left
VDU08 LDA VDUTEXTX ; COL VDU08 LDA VDUTEXTX ; COL

View File

@ -75,11 +75,21 @@ GFXINIT JSR FDRAWADDR+0 ; Initialize FDRAW library
JSR FDRAWADDR+22 ; FDRAW: clear HGR screen JSR FDRAWADDR+22 ; FDRAW: clear HGR screen
RTS RTS
* Plot bitmap character on the HGR screen
DRAWCHAR >>> ENTMAIN
LDA HGRADDR+0
STA A1L
LDA HGRADDR+1
STA A1H
LDA #$FF
STA (A1L)
>>> XF2AUX,PUTCHRET
FGCOLOR DB $00 ; Foreground colour FGCOLOR DB $00 ; Foreground colour
BGCOLOR DB $00 ; Background colour BGCOLOR DB $00 ; Background colour
LINETYPE DB $00 ; 0 normal, 1 XOR LINETYPE DB $00 ; 0 normal, 1 XOR
PLOTMODE DB $00 ; K value for PLOT K,X,Y PLOTMODE DB $00 ; K value for PLOT K,X,Y
HGRADDR DW $0000 ; Address 1st line of HGR char