2021-09-23 20:19:35 +00:00
|
|
|
* MAINMEM.GFX.S
|
|
|
|
* (c) Bobbi 2021 GPLv3
|
|
|
|
*
|
|
|
|
* Main memory HGR graphics routines.
|
|
|
|
|
|
|
|
* Call FDraw Clear routine
|
2021-09-23 22:16:21 +00:00
|
|
|
CLRHGR >>> ENTMAIN
|
|
|
|
LDA BGCOLOR
|
|
|
|
STA FDRAWADDR+5
|
|
|
|
JSR FDRAWADDR+16 ; FDRAW: SetColor
|
|
|
|
JSR FDRAWADDR+22 ; FDRAW: Clear
|
|
|
|
LDA FGCOLOR
|
|
|
|
STA FDRAWADDR+5
|
|
|
|
JSR FDRAWADDR+16 ; FDRAW: SetColor
|
|
|
|
>>> XF2AUX,VDU16RET
|
2021-09-23 20:19:35 +00:00
|
|
|
|
|
|
|
* Call FDraw SetLineMode routine
|
2021-09-23 22:16:21 +00:00
|
|
|
SETLINE >>> ENTMAIN
|
|
|
|
JSR FDRAWADDR+43 ; FDRAW: SetLineMode
|
|
|
|
>>> XF2AUX,VDU18RET1
|
2021-09-23 20:19:35 +00:00
|
|
|
|
2021-10-10 18:43:57 +00:00
|
|
|
* Helper function to set up colors
|
|
|
|
SETCOLOR LDA PLOTMODE
|
2021-09-23 22:16:21 +00:00
|
|
|
AND #$03
|
|
|
|
CMP #$01 ; Draw in foreground colour
|
|
|
|
BNE :S1
|
|
|
|
LDA FGCOLOR
|
|
|
|
BRA :SETCOLOR
|
|
|
|
:S1 CMP #$02 ; Draw in inverse colour
|
|
|
|
BNE :S2
|
|
|
|
SEC
|
|
|
|
LDA #$07
|
|
|
|
SBC FGCOLOR
|
|
|
|
BRA :SETCOLOR
|
|
|
|
:S2 LDA BGCOLOR ; Draw in background colour
|
|
|
|
:SETCOLOR STA FDRAWADDR+5
|
2021-10-10 18:43:57 +00:00
|
|
|
JMP FDRAWADDR+16 ; FDRAW: SetColor
|
|
|
|
|
|
|
|
* Call FDraw DrawLine routine
|
|
|
|
DRAWLINE >>> ENTMAIN
|
|
|
|
JSR SETCOLOR
|
2021-09-23 22:16:21 +00:00
|
|
|
JSR FDRAWADDR+28 ; FDRAW: DrawLine
|
|
|
|
>>> XF2AUX,VDU25RET
|
2021-09-23 20:19:35 +00:00
|
|
|
|
|
|
|
* Call FDraw DrawPoint routine
|
2021-09-23 22:16:21 +00:00
|
|
|
DRAWPNT >>> ENTMAIN
|
2021-10-10 18:43:57 +00:00
|
|
|
JSR SETCOLOR
|
2021-09-23 22:16:21 +00:00
|
|
|
JSR FDRAWADDR+25 ; FDRAW: DrawPoint
|
|
|
|
>>> XF2AUX,VDU25RET
|
2021-09-23 20:19:35 +00:00
|
|
|
|
2021-10-10 18:43:57 +00:00
|
|
|
* Call FDraw DrawCircle routine
|
|
|
|
DRAWCIRC >>> ENTMAIN
|
|
|
|
JSR SETCOLOR
|
|
|
|
JSR FDRAWADDR+37 ; FDRAW: DrawCircle
|
|
|
|
>>> XF2AUX,VDU25RET
|
|
|
|
|
|
|
|
* Call FDraw FillCircle routine
|
|
|
|
FILLCIRC >>> ENTMAIN
|
|
|
|
JSR SETCOLOR
|
|
|
|
JSR FDRAWADDR+40 ; FDRAW: FillCircle
|
|
|
|
>>> XF2AUX,VDU25RET
|
|
|
|
|
2021-10-10 23:08:37 +00:00
|
|
|
* Call FDraw FillRect routine
|
|
|
|
FILLRECT >>> ENTMAIN
|
|
|
|
JSR SETCOLOR
|
2021-10-14 00:20:44 +00:00
|
|
|
LDA FDRAWADDR+8 ; Y1
|
|
|
|
CMP FDRAWADDR+11 ; Y2
|
|
|
|
BEQ :S1
|
|
|
|
BCS :SWAPY ; Y1>Y2 then swap
|
|
|
|
:S1 LDA FDRAWADDR+7 ; MSB of X1
|
|
|
|
CMP FDRAWADDR+10 ; MSB of X2
|
|
|
|
BEQ :S2
|
|
|
|
BCS :SWAPX ; MSB X1 > MSB X2
|
|
|
|
:S2 LDA FDRAWADDR+6 ; LSB of X1
|
|
|
|
CMP FDRAWADDR+9 ; MSB of X2
|
|
|
|
BEQ :S3
|
|
|
|
BCS :SWAPX ; LSB X1 > LSB X2
|
|
|
|
:S3 JSR FDRAWADDR+34 ; FDRAW: FillRect
|
2021-10-10 23:08:37 +00:00
|
|
|
>>> XF2AUX,VDU25RET
|
2021-10-14 00:20:44 +00:00
|
|
|
:SWAPY LDA FDRAWADDR+8
|
|
|
|
LDY FDRAWADDR+11
|
|
|
|
STY FDRAWADDR+8
|
|
|
|
STA FDRAWADDR+11
|
|
|
|
BRA :S1
|
|
|
|
:SWAPX LDA FDRAWADDR+7
|
|
|
|
LDY FDRAWADDR+10
|
|
|
|
STY FDRAWADDR+7
|
|
|
|
STA FDRAWADDR+10
|
|
|
|
LDA FDRAWADDR+6
|
|
|
|
LDY FDRAWADDR+9
|
|
|
|
STY FDRAWADDR+6
|
|
|
|
STA FDRAWADDR+9
|
|
|
|
BRA :S3
|
2021-10-10 23:08:37 +00:00
|
|
|
|
2021-09-23 20:19:35 +00:00
|
|
|
* Reset colours and linetype
|
2021-09-23 22:16:21 +00:00
|
|
|
GFXINIT JSR FDRAWADDR+0 ; Initialize FDRAW library
|
|
|
|
LDA #$20
|
|
|
|
STA FDRAWADDR+5
|
|
|
|
JSR FDRAWADDR+19 ; FDRAW: Set page $2000
|
|
|
|
STZ LINETYPE
|
|
|
|
STZ FDRAWADDR+5
|
|
|
|
JSR FDRAWADDR+43 ; FDRAW: SetLineMode
|
|
|
|
LDA #$07
|
|
|
|
STA FGCOLOR
|
|
|
|
STA FDRAWADDR+5
|
|
|
|
JSR FDRAWADDR+16 ; FDRAW: SetColor
|
|
|
|
STZ BGCOLOR
|
|
|
|
JSR FDRAWADDR+22 ; FDRAW: clear HGR screen
|
|
|
|
RTS
|
2021-09-23 20:19:35 +00:00
|
|
|
|
2021-09-23 20:50:16 +00:00
|
|
|
* Plot bitmap character on the HGR screen
|
2021-09-23 21:56:39 +00:00
|
|
|
* On entry: char is in A
|
2021-09-23 22:16:21 +00:00
|
|
|
DRAWCHAR >>> ENTMAIN
|
2021-09-26 21:52:17 +00:00
|
|
|
* AND #$7F ; Don't!
|
2021-09-23 22:16:21 +00:00
|
|
|
STA A1L ; A*8 -> A1L,A1H
|
|
|
|
STZ A1H
|
|
|
|
ASL A1L
|
|
|
|
ROL A1H
|
|
|
|
ASL A1L
|
|
|
|
ROL A1H
|
|
|
|
ASL A1L
|
|
|
|
ROL A1H
|
|
|
|
CLC ; FONTADDR+A*8 -> A1L,A1H
|
|
|
|
LDA A1L
|
|
|
|
ADC #<FONTADDR
|
|
|
|
STA A1L
|
|
|
|
LDA A1H
|
|
|
|
ADC #>FONTADDR
|
|
|
|
STA A1H
|
|
|
|
LDA HGRADDR+0 ; HGRADDR -> A4L,A4H
|
|
|
|
STA A4L
|
|
|
|
LDA HGRADDR+1
|
|
|
|
STA A4H
|
|
|
|
LDY #$00
|
|
|
|
:L1 LDA (A1L),Y ; Load line of pixels from font
|
|
|
|
STA (A4L) ; Store them on screen
|
|
|
|
INC A4H ; Skip 1024 bytes to next row
|
|
|
|
INC A4H
|
|
|
|
INC A4H
|
|
|
|
INC A4H
|
|
|
|
INY
|
|
|
|
CPY #$08 ; All eight rows done?
|
|
|
|
BNE :L1
|
|
|
|
>>> XF2AUX,PUTCHRET
|
|
|
|
|
2021-09-24 01:49:35 +00:00
|
|
|
* Copy text line A+1 to line A
|
|
|
|
HGRSCR1L >>> ENTMAIN
|
|
|
|
ASL ; Dest addr->A4L,A4H
|
|
|
|
TAX
|
|
|
|
LDA MHGRTAB,X
|
|
|
|
STA A4L
|
|
|
|
LDA MHGRTAB+1,X
|
|
|
|
STA A4H
|
|
|
|
INX ; Source addr->A1L,A1H
|
|
|
|
INX
|
|
|
|
LDA MHGRTAB,X
|
|
|
|
STA A1L
|
|
|
|
LDA MHGRTAB+1,X
|
|
|
|
STA A1H
|
|
|
|
LDX #$00
|
|
|
|
:L1 LDY #$00
|
|
|
|
:L2 LDA (A1L),Y
|
|
|
|
STA (A4L),Y
|
|
|
|
INY
|
|
|
|
CPY #40 ; 40 chars in line
|
|
|
|
BNE :L2
|
|
|
|
INC A1H ; Advance source 1024 bytes
|
|
|
|
INC A1H
|
|
|
|
INC A1H
|
|
|
|
INC A1H
|
|
|
|
INC A4H ; Advance dest 1024 bytes
|
|
|
|
INC A4H
|
|
|
|
INC A4H
|
|
|
|
INC A4H
|
|
|
|
INX
|
|
|
|
CPX #8 ; 8 pixel rows in character
|
|
|
|
BNE :L1
|
|
|
|
>>> XF2AUX,HSCR1RET
|
|
|
|
|
2021-09-24 23:54:25 +00:00
|
|
|
* Clear one text line on HGR screen
|
|
|
|
HCLRLINE >>> ENTMAIN
|
|
|
|
LDA HGRADDR+0 ; HGRADDR -> A4L,A4H
|
|
|
|
STA A4L
|
|
|
|
LDA HGRADDR+1
|
|
|
|
STA A4H
|
|
|
|
LDA #$00
|
|
|
|
LDX #$00
|
|
|
|
:L1 LDY #$00
|
|
|
|
:L2 STA (A4L),Y
|
|
|
|
INY
|
2021-09-26 21:52:17 +00:00
|
|
|
* CPY #$39
|
|
|
|
CPY #40
|
2021-09-24 23:54:25 +00:00
|
|
|
BNE :L2
|
|
|
|
INC A4H
|
|
|
|
INC A4H
|
|
|
|
INC A4H
|
|
|
|
INC A4H
|
|
|
|
INX
|
|
|
|
CPX #$08
|
|
|
|
BNE :L1
|
|
|
|
>>> XF2AUX,CLRLNRET
|
|
|
|
|
2021-09-23 22:16:21 +00:00
|
|
|
FGCOLOR DB $00 ; Foreground colour
|
|
|
|
BGCOLOR DB $00 ; Background colour
|
|
|
|
LINETYPE DB $00 ; 0 normal, 1 XOR
|
|
|
|
PLOTMODE DB $00 ; K value for PLOT K,X,Y
|
|
|
|
HGRADDR DW $0000 ; Address 1st line of HGR char
|
|
|
|
|
2021-09-24 01:49:35 +00:00
|
|
|
* Addresses of start of pixel rows in PAGE1
|
2021-09-24 02:07:36 +00:00
|
|
|
MHGRTAB DW $2000,$2080,$2100,$2180,$2200,$2280,$2300,$2380
|
|
|
|
DW $2028,$20A8,$2128,$21A8,$2228,$22A8,$2328,$23A8
|
|
|
|
DW $2050,$20D0,$2150,$21D0,$2250,$22D0,$2350,$23D0
|
|
|
|
|
|
|
|
|
2021-09-23 20:19:35 +00:00
|
|
|
|
2021-09-25 16:50:08 +00:00
|
|
|
|
|
|
|
|
2021-09-26 22:25:23 +00:00
|
|
|
|
|
|
|
|
2021-09-29 14:21:04 +00:00
|
|
|
|
|
|
|
|
2021-09-30 20:40:32 +00:00
|
|
|
|
|
|
|
|
2021-10-14 00:57:16 +00:00
|
|
|
|
|
|
|
|
2021-10-14 23:24:26 +00:00
|
|
|
|
|
|
|
|
2021-10-18 22:46:52 +00:00
|
|
|
|
|
|
|
|
2021-10-25 00:38:32 +00:00
|
|
|
|
|
|
|
|