Merge JGH's 'Consolidate graphics ops' PR.

This commit is contained in:
Bobbi Webber-Manners 2021-09-20 14:04:19 -04:00
parent ed157d5bc3
commit 568d27e98c
7 changed files with 107 additions and 94 deletions

Binary file not shown.

View File

@ -184,6 +184,7 @@ MAINZP MAC
PUT AUXMEM.MOSEQU
PUT AUXMEM.INIT
PUT AUXMEM.VDU
PUT AUXMEM.GFX
PUT AUXMEM.HOSTFS
PUT AUXMEM.OSCLI
PUT AUXMEM.BYTWRD

View File

@ -28,7 +28,7 @@
* 15-Sep-2021 INKEY(0) tests once and returns immediately.
* TO DO: move these to VDU
OLDCHAR EQU OSKBD1 ; *TEMP* ; character under cursor
* OLDCHAR EQU OSKBD1 ; *TEMP* ; character under cursor
* COPYCHAR EQU OSKBD2 ; *TEMP* ; character under copy cursor
FLASHER EQU BYTEVARBASE+176 ; VSync counter for flashing cursor

98
auxmem.gfx.s Normal file
View File

@ -0,0 +1,98 @@
* AUXMEM.GFX.S
* (c) Bobbi 2021 GPLv3
*
* Graphics operations
* Convert high-resolution screen coordinates
* from 1280x1024 to 280x192
CVTCOORD
* X-coordinate in VDUQ+5,+6 1280/4*7/8=280
LDA VDUQ+5 ; X-coord -> ZP1 and ZP2
STA ZP1+0
STA ZP2+0
LDA VDUQ+6
STA ZP1+1
STA ZP2+1
CLC ; ZP1 divide by 2 (0-639 now)
ROR ZP1+1
ROR ZP1+0
CLC ; ZP1 divide by 2 (0-319 now)
ROR ZP1+1
ROR ZP1+0
CLC ; ZP1+ZP2->ZP2
LDA ZP1+0
ADC ZP2+0
STA ZP2+0
LDA ZP1+1
ADC ZP2+1
STA ZP2+1
CLC ; ZP1+ZP2->ZP2
LDA ZP1+0
ADC ZP2+0
STA ZP2+0
LDA ZP1+1
ADC ZP2+1
STA ZP2+1
CLC ; ZP1+ZP2->ZP2
LDA ZP1+0
ADC ZP2+0
STA ZP2+0
LDA ZP1+1
ADC ZP2+1
STA ZP2+1
CLC ; ZP2 divide by 2
ROR ZP2+1
ROR ZP2+0
CLC ; ZP2 divide by 2
ROR ZP2+1
ROR ZP2+0
CLC ; ZP2 divide by 2
ROR ZP2+1
ROR ZP2+0
LDA ZP2+0
STA VDUQ+5
LDA ZP2+1
STA VDUQ+6
* Y-coordinate in VDUQ+7,+8 1024/4*3/4=192
LDA VDUQ+7 ; Y-coord -> ZP1
STA ZP1+0
LDA VDUQ+8
STA ZP1+1
CLC ; ZP1 divide by 2 (0-512 now)
ROR ZP1+1
ROR ZP1+0
CLC ; ZP1 divide by 2 (0-256 now)
ROR ZP1+1
ROR ZP1+0
LDA ZP1+0 ; Copy ZP1->ZP2
STA ZP2+0
LDA ZP1+1
STA ZP2+1
CLC ; ZP1+ZP2->ZP2
LDA ZP1+0
ADC ZP2+0
STA ZP2+0
LDA ZP1+1
ADC ZP2+1
STA ZP2+1
CLC ; ZP1+ZP2->ZP2
LDA ZP1+0
ADC ZP2+0
STA ZP2+0
LDA ZP1+1
ADC ZP2+1
STA ZP2+1
CLC ; ZP2 divide by 2
ROR ZP2+1
ROR ZP2+0
CLC ; ZP2 divide by 2
ROR ZP2+1
ROR ZP2+0
LDA ZP2+0
STA VDUQ+7
LDA ZP2+1
STA VDUQ+8
RTS

View File

@ -168,98 +168,6 @@ PRDECPAD STA OSPAD
DW 1000
DW 10000
* Convert high-resolution screen coordinates
* from 1280x1024 to 280x192
CVTCOORD
* X-coordinate in VDUQ+5,+6 1280/4*7/8=280
LDA VDUQ+5 ; X-coord -> ZP1 and ZP2
STA ZP1+0
STA ZP2+0
LDA VDUQ+6
STA ZP1+1
STA ZP2+1
CLC ; ZP1 divide by 2 (0-639 now)
ROR ZP1+1
ROR ZP1+0
CLC ; ZP1 divide by 2 (0-319 now)
ROR ZP1+1
ROR ZP1+0
CLC ; ZP1+ZP2->ZP2
LDA ZP1+0
ADC ZP2+0
STA ZP2+0
LDA ZP1+1
ADC ZP2+1
STA ZP2+1
CLC ; ZP1+ZP2->ZP2
LDA ZP1+0
ADC ZP2+0
STA ZP2+0
LDA ZP1+1
ADC ZP2+1
STA ZP2+1
CLC ; ZP1+ZP2->ZP2
LDA ZP1+0
ADC ZP2+0
STA ZP2+0
LDA ZP1+1
ADC ZP2+1
STA ZP2+1
CLC ; ZP2 divide by 2
ROR ZP2+1
ROR ZP2+0
CLC ; ZP2 divide by 2
ROR ZP2+1
ROR ZP2+0
CLC ; ZP2 divide by 2
ROR ZP2+1
ROR ZP2+0
LDA ZP2+0
STA VDUQ+5
LDA ZP2+1
STA VDUQ+6
* Y-coordinate in VDUQ+7,+8 1024/4*3/4=192
LDA VDUQ+7 ; Y-coord -> ZP1
STA ZP1+0
LDA VDUQ+8
STA ZP1+1
CLC ; ZP1 divide by 2 (0-512 now)
ROR ZP1+1
ROR ZP1+0
CLC ; ZP1 divide by 2 (0-256 now)
ROR ZP1+1
ROR ZP1+0
LDA ZP1+0 ; Copy ZP1->ZP2
STA ZP2+0
LDA ZP1+1
STA ZP2+1
CLC ; ZP1+ZP2->ZP2
LDA ZP1+0
ADC ZP2+0
STA ZP2+0
LDA ZP1+1
ADC ZP2+1
STA ZP2+1
CLC ; ZP1+ZP2->ZP2
LDA ZP1+0
ADC ZP2+0
STA ZP2+0
LDA ZP1+1
ADC ZP2+1
STA ZP2+1
CLC ; ZP2 divide by 2
ROR ZP2+1
ROR ZP2+0
CLC ; ZP2 divide by 2
ROR ZP2+1
ROR ZP2+0
LDA ZP2+0
STA VDUQ+7
LDA ZP2+1
STA VDUQ+8
RTS
* GSINIT - Initialise for GSTRANS string parsing
************************************************

View File

@ -63,7 +63,8 @@ FSCV EQU $21E ; FSCV misc file ops
BYTEVARBASE EQU $190 ; Base of OSBYTE variables
OSFILECB EQU $2EE ; OSFILE control block
COPYCHAR EQU OSKBD2 ; ** TEMP **
* Moved to VDU
* COPYCHAR EQU OSKBD2 ; ** TEMP **
* $0300-$03DF
* $03E0-$03FF Used for interfacing with ProDOS XFER

View File

@ -34,6 +34,11 @@ VDUSTATUS EQU $D0 ; $D0 # VDU status
VDUCHAR EQU VDUSTATUS+1 ; $D1
VDUADDR EQU VDUSTATUS+4 ; $D4 address of current char cell
* TO DO: move these to VDU
OLDCHAR EQU OSKBD1 ; *TEMP* ; character under cursor
COPYCHAR EQU OSKBD2 ; *TEMP* ; character under copy cursor
* VDU DRIVER MAIN WORKSPACE
***************************
FXLINES EQU BYTEVARBASE+217 ; Paged scrolling line counter