Fixed #199 - ISR now has exclusive use of A3L/A3H.

This commit is contained in:
Bobbi Webber-Manners 2022-12-21 21:04:44 -05:00
parent 754271b618
commit 1027179f6e
7 changed files with 63 additions and 58 deletions

Binary file not shown.

View File

@ -28,6 +28,8 @@ A1L EQU $3C
A1H EQU $3D
A2L EQU $3E
A2H EQU $3F
A3L EQU $40 ; Used for ISR only
A3H EQU $41 ; Used for ISR only
A4L EQU $42
A4H EQU $43

View File

@ -109,11 +109,11 @@ KBDINIT LDX #DEFBYTEEND-DEFBYTE-1
DEX
BPL :KBDINITLP
JSR SOFTKEYCHK ; Clear soft keys
LDX #$C0
LDX #$C3
STX FX254VAR ; b7-b4=default KBD map, b3-b0=default MODE
BIT SETV ; Set V
JSR KBDTEST ; Test if key being pressed
BCS :KBDINITOK ; Return default MODE=0
BCS :KBDINITOK ; Return default MODE=3
STA KBDACK ; Ack. keypress
TAX ; Use keypress as default MODE
:KBDINITOK TXA

View File

@ -13,6 +13,15 @@ HGRTAB 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
* Enable HGR mode
HGRVDU22 JSR VDU12 ; Clear text and HGR screen
STA HIRES ; Hi-Res
STA GRON ; Enable Graphics
STA PAGE1 ; PAGE1
STA CLR80VID ; Select 40col text
RTS
* Write character to HGR screen
PRCHRSOFT CMP #$A0 ; Convert to screen code
BCS :B0

View File

@ -113,14 +113,15 @@ VDUWORKSZ EQU VDUVAREND-VDUWORKSP+1
* Screen definitions
* 0 1 2 3 6 7 ; MODEs sort-of completed
SCNTXTMAXX DB 79, 39, 39, 79, 39, 19, 39, 39 ; Max text column
SCNTXTMAXX DB 79, 39, 39, 79, 39, 39, 39, 39 ; Max text column
SCNTXTMAXY DB 23, 23, 23, 23, 23, 23, 23, 23 ; Max text row
SCNBYTES DB 01, 08, 08, 01, 01, 01, 01, 01 ; Bytes per character
SCNCOLOURS DB 15, 07, 07, 01, 01, 15, 01, 01 ; Colours-1
SCNPIXELS DB 00, 07, 07, 00, 00, 00, 00, 00 ; Pixels per byte
SCNTYPE DB 01,128,128, 01, 00, 00, 00, 64 ; Screen type
* b7=FastDraw
* b6=Teletext
SCNBYTES DB 08, 08, 08, 01, 01, 01, 01, 01 ; Bytes per character
SCNCOLOURS DB 03, 15, 07, 01, 01, 01, 01, 01 ; Colours-1
SCNPIXELS DB 08, 08, 07, 00, 00, 00, 00, 00 ; Pixels per byte
SCNTYPE DB 32, 32,128, 01, 00, 00, 00, 64 ; Screen type
* b7=FastDraw -> HGR mode
* b6=Teletext -> No-op
* b5=SHR mode on Apple IIgs
* b0=40COL/80COL
* Colour table
@ -556,11 +557,12 @@ VDUINIT STA VDUQ+8
* VDU 22 - MODE n
*****************
* At the moment only MODEs available:
* MODE 1 - 280x192 HGR graphics, 40 cols bitmap text
* MODE 0 - 640x200 SHR graphics, 80 cols bitmap text (GS only)
* MODE 1 - 320x200 SHR graphics, 40 cols bitmap text (GS only)
* MODE 2 - 280x192 HGR graphics, 40 cols bitmap text
* MODE 3 - 80x24 text
* MODE 6 - 40x24 text
* MODE 7 - 40x24 with $80-$9F converted to spaces
* MODE 0 defaults to MODE 3
* All others default to MODE 6
*
* Wait for VSync?
@ -592,8 +594,9 @@ VDU22 LDA VDUQ+8
JSR VDU26 ; Default windows
STA FULLGR ; Clear MIXED mode
LDA VDUSCREEN
BMI VDU22G ; b7=1, graphics mode
AND #$01 ; 40col/80col bit
BPL :NOTHGR
JMP HGRVDU22 ; b7=1, graphics mode
:NOTHGR AND #$01 ; 40col/80col bit
TAX
STA CLR80VID,X ; Select 40col/80col
STA TEXTON ; Enable Text
@ -626,16 +629,10 @@ VDU12 STZ FXLINES
STA VDUTEXTX ; COL
RTS
* Clear the graphics screen buffer
VDU12SOFT JMP VDU16 ; *TEMP*
VDU22G JSR VDU12 ; Clear text and HGR screen
STA HIRES ; Hi-Res
STA GRON ; Enable Graphics
STA PAGE1 ; PAGE1
STA CLR80VID ; Select 40col text
RTS
* Clear to EOL, respecting text window boundaries
CLREOL JSR CHARADDR ; Set VDUADDR=>start of line

View File

@ -131,12 +131,12 @@ CURRAMP DB $00
* Get address of sound buffer
* On entry: X is buffer number (4..7)
* On exit: A1L,A1H points to start of buffer
* On exit: A3L,A3H points to start of buffer
* Called with interrupts disabled
GETBUFADDR LDA :BUFADDRL,X
STA A1L
STA A3L
LDA :BUFADDRH,X
STA A1H
STA A3H
RTS
:BUFADDRL DB $00
DB $00
@ -175,9 +175,9 @@ INS PHP ; Save flags, turn off interrupts
BEQ :FULL
LDY ENDINDICES,X ; Current position
STA ENDINDICES,X ; Write updated input pointer
JSR GETBUFADDR ; Buffer address into A1L,A1H
JSR GETBUFADDR ; Buffer address into A3L,A3H
PLA ; Get value to write back
STA (A1L),Y ; Write to buffer
STA (A3L),Y ; Write to buffer
PLY
PLP ; Restore flags
CLC ; Exit with carry clear
@ -211,8 +211,8 @@ REM PHP ; Save flags, turn off interrupts
CMP ENDINDICES,X
BEQ :EMPTY ; Buffer is empty
TAY ; Buffer pointer into Y
JSR GETBUFADDR ; Buffer address into A1L,A1H
LDA (A1L),Y ; Read byte from buffer
JSR GETBUFADDR ; Buffer address into A3L,A3H
LDA (A3L),Y ; Read byte from buffer
PHA ; Stash for later
BVS :EXAM ; If only examination, done
INY ; Next byte
@ -268,12 +268,12 @@ RELNOTE PHX ; Preserve X
TXA ; Audio channel X->A
ORA #$04 ; Convert to queue number
TAX ; Queue number ->X
JSR GETBUFADDR ; Buffer address into A1L,A1H
JSR GETBUFADDR ; Buffer address into A3L,A3H
LDA STARTINDICES,X ; Output pointer for buf X
TAY
LDA (A1L),Y ; Obtain Hold/Sync byte
LDA (A3L),Y ; Obtain Hold/Sync byte
AND #$F0 ; Set sync nybble to zero ..
STA (A1L),Y ; .. to release the note
STA (A3L),Y ; .. to release the note
PLX ; Recover original X
:RTS RTS
@ -568,30 +568,30 @@ ENVTICKS DEC CHANCTR,X ; Decrement counter
* On return: Sets CHANCTR,X to length of each step in 1/100ths
RSTTICKS LDA CHANENV,X ; Get envelope number
TAY
JSR GETENVADDR ; Envelope address in A1L,A1H
JSR GETENVADDR ; Envelope address in A3L,A3H
LDY #ENVT ; Parm for length of each step
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
AND #$7F ; Mask out MSB
STA CHANCTR,X ; Reset counter
RTS
* On entry: Y is envelope number
* On return: A1L,A1H point to start of buffer for this envelope
* On return: A3L,A3H point to start of buffer for this envelope
* X is preserved
GETENVADDR LDA #<ENVBUF0 ; Copy ENVBUF0 to A1L,A1H
STA A1L
GETENVADDR LDA #<ENVBUF0 ; Copy ENVBUF0 to A3L,A3H
STA A3L
LDA #>ENVBUF0
STA A1H
STA A3H
:L1 CPY #$00 ; See if Y is zero
BEQ :DONE ; If so, we are done
LDA A1L ; Add 13 to A1L,A1H
LDA A3L ; Add 13 to A3L,A3H
CLC
ADC #13
STA A1L
LDA A1H
STA A3L
LDA A3H
ADC #00
STA A1H
STA A3H
DEY ; Decr envelopes remaining
BRA :L1 ; Go again
:DONE RTS
@ -602,7 +602,7 @@ GETENVADDR LDA #<ENVBUF0 ; Copy ENVBUF0 to A1L,A1H
* X is preserved
PITCHENV LDA CHANENV,X ; Get envelope number
TAY
JSR GETENVADDR ; Addr of envelope -> A1L,A1H
JSR GETENVADDR ; Addr of envelope -> A3L,A3H
LDA PITCHSECT,X ; See what section we are in
BEQ :SECT1 ; Section 1, encoded as 0
CMP #$01
@ -612,31 +612,31 @@ PITCHENV LDA CHANENV,X ; Get envelope number
RTS ; Other section, do nothing
:SECT1
LDY #ENVPN1 ; Parm: num steps in section 1
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
CMP PITCHSTEP,X ; Are we there yet?
BEQ :NXTSECT ; Yes!
LDY #ENVPI1 ; Parm: change pitch/step section 1
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
JSR UPDPITCH ; Update the pitch
INC PITCHSTEP,X ; One more step
RTS
:SECT2
LDY #ENVPN2 ; Parm: num steps in section 2
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
CMP PITCHSTEP,X ; Are we there yet?
BEQ :NXTSECT ; Yes!
LDY #ENVPI2 ; Parm: change pitch/step section 2
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
JSR UPDPITCH ; Update the pitch
INC PITCHSTEP,X ; One more step
RTS
:SECT3
LDY #ENVPN3 ; Parm: num steps in section 3
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
CMP PITCHSTEP,X ; Are we there yet?
BEQ :LASTSECT ; Yes!
LDY #ENVPI3 ; Parm: change pitch/step section 3
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
JSR UPDPITCH ; Update the pitch
INC PITCHSTEP,X ; One more step
RTS
@ -644,7 +644,7 @@ PITCHENV LDA CHANENV,X ; Get envelope number
STZ PITCHSTEP,X ; Back to step 0 of section
RTS
:LASTSECT LDY #ENVT ; Parm: length/step + autorepeat
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
AND #$80 ; MSB is auto-repeat flag
BNE :NXTSECT ; Not repeating
STZ PITCHSECT,X ; Go back to section 1
@ -669,7 +669,7 @@ UPDPITCH STX OSCNUM
* X is preserved
ADSRENV LDA CHANENV,X ; Get envelope number
TAY
JSR GETENVADDR ; Addr of envelope -> A1L,A1H
JSR GETENVADDR ; Addr of envelope -> A3L,A3H
LDA AMPSECT,X ; See what section we are in
BEQ :ATTACK ; Attack, encoded as 0
CMP #$01
@ -680,31 +680,31 @@ ADSRENV LDA CHANENV,X ; Get envelope number
BEQ :RELEASE ; Release, encoded as 3
RTS ; Otherwise nothing to do
:ATTACK LDY #ENVAA ; Parm: attack change/step
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
PHA
LDY #ENVALA ; Parm: level at end of attack
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
PLY
JSR ADSRPHASE ; Generic ADSR phase handler
BCS :NEXTSECT ; Phase done -> decay
RTS
:DECAY LDY #ENVAD ; Parm: delay change/step
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
PHA
LDY #ENVALD ; Parm: level at end of delay
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
PLY
JSR ADSRPHASE ; Generic ADSR phase handler
BCS :NEXTSECT ; Phase done -> sustain
RTS
:SUSTAIN LDY #ENVAS ; Parm: delay change/step
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
TAY
LDA #$00 ; Target level zero
JSR ADSRPHASE ; Generic ADSR phase handler
RTS
:RELEASE LDY #ENVAR ; Parm: attack change/step
LDA (A1L),Y ; Get value of parm
LDA (A3L),Y ; Get value of parm
TAY
LDA #$00 ; Target level zero
JSR ADSRPHASE ; Generic ADSR phase handler

View File

@ -146,8 +146,6 @@ DRAWCHAR >>> ENTMAIN
* Copy text line A+1 to line A
HGRSCR1L >>> ENTMAIN
PHP ; Disable interrupts ..
SEI ; .. to prevent corruption while scrolling
INC MTXTWINRGT
ASL ; Dest addr->A4L,A4H
TAX
@ -179,7 +177,6 @@ DOHGRSCR1L LDX #$00
INX
CPX #8 ; 8 pixel rows in character
BNE :L1
PLP ; Re-enable interrupts
>>> XF2AUX,HSCR1RET
* Copy text line A to line A+1