Merge pull request #182 from jgharston/main

Minor bugfixes
This commit is contained in:
Bobbi Webber-Manners 2022-10-19 22:44:44 -04:00 committed by GitHub
commit 6b6023cd1a
4 changed files with 151 additions and 162 deletions

View File

@ -14,7 +14,7 @@ ZP1 EQU $90 ; $90-$9f are spare Econet space
ZP2 EQU $92 ZP2 EQU $92
ZP3 EQU $94 ZP3 EQU $94
STRTBCKL EQU $9D ; *TO DO* don't need to preserve STRTBCKL EQU $9D ; *TO DO* No longer needed to preserve
STRTBCKH EQU $9E STRTBCKH EQU $9E
MOSSHIM MOSSHIM
@ -28,7 +28,7 @@ MOSSHIM
* *
* Initially executing at $3000 until copied to $D000 * Initially executing at $3000 until copied to $D000
MOSINIT SEI ; Disable IRQ while initializing MOSINIT SEI ; Ensure IRQs disabled
LDX #$FF ; Initialize Alt SP to $1FF LDX #$FF ; Initialize Alt SP to $1FF
TXS TXS
@ -105,11 +105,11 @@ MOSINIT SEI ; Disable IRQ while initializing
:NORELOC :NORELOC
:S8 STA SET80VID ; 80 col on :S8 STA SET80VID ; 80 col on
STA CLRALTCHAR ; Alt charset off (?) STA CLRALTCHAR ; Alt charset off
STA PAGE2 ; PAGE2 STA PAGE2 ; PAGE2
JMP MOSHIGH ; Ensure executing in high memory here JMP MOSHIGH ; Ensure executing in high memory here
MOSHIGH SEI ; Disable IRQ while initializing MOSHIGH SEI ; Ensure IRQs disabled
LDX #$FF LDX #$FF
TXS ; Initialise stack TXS ; Initialise stack
INX ; X=$00 INX ; X=$00
@ -137,10 +137,11 @@ MOSHIGH SEI ; Disable IRQ while initializing
LDA #7 LDA #7
JSR OSWRCH JSR OSWRCH
JSR OSNEWL JSR OSNEWL
LDX MAXROM ; TEMP X=language to enter LDX MAXROM ; *TEMP* X=language to enter
CLC CLC
* OSBYTE $8E - Enter language ROM * OSBYTE $8E - Enter language ROM
*********************************
* X=ROM number to select * X=ROM number to select
* *
BYTE8E PHP ; Save CLC=RESET, SEC=Not RESET BYTE8E PHP ; Save CLC=RESET, SEC=Not RESET
@ -156,10 +157,12 @@ BYTE8E PHP ; Save CLC=RESET, SEC=Not RESET
JSR OSNEWL JSR OSNEWL
JSR OSNEWL JSR OSNEWL
PLP ; Get entry type back PLP ; Get entry type back
LDA #$01 LDA #$01 ; $01=Entering code with a header
JMP ROMAUXADDR JMP ROMAUXADDR
* OSBYTE $8F - Issue service call * OSBYTE $8F - Issue service call
*********************************
* X=service call, Y=parameter * X=service call, Y=parameter
* *
SERVICE TAX ; Enter here with A=Service Num SERVICE TAX ; Enter here with A=Service Num
@ -167,17 +170,14 @@ BYTE8F
SERVICEX LDA $F4 SERVICEX LDA $F4
PHA ; Save current ROM PHA ; Save current ROM
* LDA $E0 ; *DEBUG* *DEBUG
* AND #$20 LDA $E0
* BEQ :SERVDEBUG AND #$20 ; Test debug *OPT255,32
* TXA BEQ :SERVDEBUG
* JSR PRHEX CPX #$06
* LDA OSLPTR+1 BEQ :SERVDONE ; If debug on, ignore SERV06
* JSR PRHEX :SERVDEBUG
* LDA OSLPTR+0 *DEBUG
* JSR PRHEX ; *DEBUG*
*:SERVDEBUG
TXA TXA
LDX MAXROM ; Start at highest ROM LDX MAXROM ; Start at highest ROM
:SERVLP JSR ROMSELECT ; Bring it into memory :SERVLP JSR ROMSELECT ; Bring it into memory
@ -198,9 +198,9 @@ SERVICEX LDA $F4
RTS RTS
PRHELLO LDA #<HELLO PRHELLO LDX #<HELLO
LDY #>HELLO LDY #>HELLO
JSR PRSTR JSR OSPRSTR
JMP OSNEWL JMP OSNEWL
BYTE00XX BYTE00XX
@ -211,12 +211,6 @@ BYTE00A BRK
DB $F7 DB $F7
HELLO ASC 'Applecorn MOS 2022-10-15' HELLO ASC 'Applecorn MOS 2022-10-15'
DB $00 ; Unify MOS messages DB $00 ; Unify MOS messages
* TO DO: Move into RAM
GSSPEED DB $00 ; $80 if GS is fast, $00 for slow GSSPEED DB $00 ; $80 if GS is fast, $00 for slow

View File

@ -9,7 +9,7 @@
* 26-Oct-2021 Corrected entry parameters to OSRDRM. * 26-Oct-2021 Corrected entry parameters to OSRDRM.
* 03-Nov-2021 Temp'y fix, if can't find SROM, ignores it. * 03-Nov-2021 Temp'y fix, if can't find SROM, ignores it.
* 13-Nov-2021 ROMSELECT calls mainmem to load ROM. * 13-Nov-2021 ROMSELECT calls mainmem to load ROM.
* 08-Oct-2022 ROMSEL doesn't call loder if already paged in. * 08-Oct-2022 ROMSEL doesn't call loader if already paged in.
* OSBYTE $80 - ADVAL * OSBYTE $80 - ADVAL
@ -35,18 +35,14 @@ ADVALBUF INX
BEQ :ADVALOK ; Serial input, return 0 BEQ :ADVALOK ; Serial input, return 0
LDX #$01 ; For outputs, return 1 char free LDX #$01 ; For outputs, return 1 char free
RTS RTS
:ADVALKBD BIT KEYBOARD ; Test keyboard data/strobe :ADVALKBD BIT KBDDATA ; Test keyboard data/strobe
BPL :ADVALOK ; No Strobe, return 0 BPL :ADVALOK ; No Strobe, return 0
INX ; Strobe, return 1 INX ; Strobe, return 1
:ADVALOK RTS :ADVALOK RTS
******************
* Helper functions
******************
* Beep * Beep
* ******
* Sound measurement shows the tone formula is: * Sound measurement shows the tone formula is:
* 1.230 MHz * 1.230 MHz
* ------------- = cycles * ------------- = cycles
@ -79,23 +75,26 @@ BEEP PHA
PLY ; PLY ;
PLX PLX
PLA PLA
RTS PRSTROK RTS
* Print string pointed to by X,Y to the screen * OSPRSTR - Print string at XY
******************************
* On exit, X,Y preserved, A=$00
OUTSTR TXA OUTSTR TXA
* Print string pointed to by A,Y to the screen * Print string pointed to by A,Y to the screen
PRSTR STA OSTEXT+0 ; String in A,Y PRSTR STA OSTEXT+0 ; String in A,Y
STY OSTEXT+1 STY OSTEXT+1
:L1 LDA (OSTEXT) ; Ptr to string in OSTEXT :L1 LDA (OSTEXT) ; Ptr to string in OSTEXT
BEQ PRSTROK PHP ; Save EQ
JSR OSASCI
INC OSTEXT INC OSTEXT
BNE :L1 BNE :L2
INC OSTEXT+1 INC OSTEXT+1
:L2 PLP ; Get EQ back
BEQ PRSTROK ; End of string
JSR OSASCI
BRA :L1 BRA :L1
PRSTROK RTS
* Print NL if not already at column 0 * Print NL if not already at column 0
FORCENL LDA #$86 FORCENL LDA #$86
@ -104,12 +103,14 @@ FORCENL LDA #$86
BEQ PRSTROK BEQ PRSTROK
JMP OSNEWL JMP OSNEWL
* Print XY in hex * OSPR2HEX - Print XY in hex
****************************
OUT2HEX TYA OUT2HEX TYA
JSR OUTHEX JSR OUTHEX
TXA ; Continue into OUTHEX TXA ; Continue into OUTHEX
* Print hex byte in A * OSPR1HEX - Print hex byte in A
********************************
OUTHEX PHA OUTHEX PHA
LSR LSR
LSR LSR
@ -130,19 +131,8 @@ PRNIB CMP #$0A
:S1 ADC #'0' ; < $0A :S1 ADC #'0' ; < $0A
JMP OSWRCH JMP OSWRCH
* TEMP ENTRY * * OSPRDEC - Print up to 32-bit decimal number
* Print 16-bit value in XY in decimal *********************************************
OSNUM EQU OSTEXT+0
OSPAD EQU OSTEXT+4
*PRDECXY
*PRDECPAD STX OSNUM+0
* STY OSNUM+1
* STZ OSNUM+2
* STZ OSNUM+3
*:PRDEC16 LDY #$05 ; 5 digits
* LDX #OSNUM ; number stored in OSNUM
* Print up to 32-bit decimal number
* See forum.6502.org/viewtopic.php?f=2&t=4894 * See forum.6502.org/viewtopic.php?f=2&t=4894
* and groups.google.com/g/comp.sys.apple2/c/_y27d_TxDHA * and groups.google.com/g/comp.sys.apple2/c/_y27d_TxDHA
* *
@ -318,27 +308,31 @@ GSREADOK INY ; Step to next character
* VC=not control character * VC=not control character
* Read a byte from sideways ROM * OSRDROM - Read a byte from sideways ROM
*****************************************
* On entry, Y=ROM to read from * On entry, Y=ROM to read from
* (ROMPTR)=>byte to read
* On exit, A=byte read, X=current ROM, Y=$00 * On exit, A=byte read, X=current ROM, Y=$00
RDROM LDA ROMID RDROM LDA ROMID
PHA ; Save current ROM PHA ; Save current ROM
TYA TYA
TAX ; X=ROM to read from TAX ; X=ROM to read from
JSR ROMSELECT ; Page in the required ROM JSR ROMSELECT ; Page in the required ROM
LDY #$00 LDY #$00 ; NOTE BBC sets Y=0, Master preserves
LDA (ROMPTR),Y ; Read the byte LDA (ROMPTR),Y ; Read the byte
PLX PLX
* Select a sideways ROM * ROMSELECT - Select a sideways ROM
* X=ROM to select ***********************************
* All registers must be preserved * On entry, X=ROM to select
* On exit, All registers must be preserved
*
ROMSELECT ROMSELECT
* Insert code here for faking sideways ROMs by loading or otherwise * Insert code here for faking sideways ROMs by loading or otherwise
* fetching code to $8000. All registers must be preserved. * fetching code to $8000. All registers must be preserved.
PHP PHP
CPX ROMID ; Speed up by checking if CPX ROMID ; Speed up by checking if
* BEQ ROMSELOK ; already paged in BEQ ROMSELOK ; already paged in
* BUG: This needs ROMID an invalid value on startup so first access works * BUG: This needs ROMID an invalid value on startup so first access works
PHA PHA
PHX PHX
@ -354,11 +348,6 @@ ROMSELDONE >>> ENTAUX
ROMSELOK PLP ROMSELOK PLP
RTS RTS
EVENT RTS
* Initialize ROMTAB according to user selection in menu * Initialize ROMTAB according to user selection in menu
ROMINIT STZ MAXROM ; One sideways ROM only ROMINIT STZ MAXROM ; One sideways ROM only
STA RDMAINRAM ; Read main mem STA RDMAINRAM ; Read main mem
@ -371,7 +360,12 @@ ROMINIT STZ MAXROM ; One sideways ROM only
:X1 CMP #7 :X1 CMP #7
BNE :X2 BNE :X2
STA MAXROM STA MAXROM
:X2 RTS :X2 LDA #$FF
STA ROMID ; Ensure set to invalid value
RTS
EVENT RTS
********************************************************** **********************************************************
@ -384,6 +378,7 @@ GSBRKAUX >>> IENTAUX ; IENTAUX does not do CLI
* TO DO: Check, IENTAUX modifies X * TO DO: Check, IENTAUX modifies X
* IRQ/BRK handler * IRQ/BRK handler
*****************
IRQBRKHDLR PHA IRQBRKHDLR PHA
* Mustn't enable IRQs within the IRQ handler * Mustn't enable IRQs within the IRQ handler
* Do not use WRTMAIN/WRTAUX macros * Do not use WRTMAIN/WRTAUX macros
@ -428,6 +423,20 @@ IRQBRKRET
PLA PLA
NULLRTI RTI NULLRTI RTI
* Default BRK handler
*********************
MOSBRKHDLR LDX #<MSGBRK
LDY #>MSGBRK
JSR OSPRSTR
JSR PRERR
* JSR OSNEWL
* JSR OSNEWL
STOP JMP STOP ; Cannot return from a BRK
MSGBRK DB $0D
ASC 'ERROR: '
DB $00
PRERR LDY #$01 PRERR LDY #$01
PRERRLP LDA (FAULT),Y PRERRLP LDA (FAULT),Y
BEQ PRERR1 BEQ PRERR1
@ -437,20 +446,9 @@ PRERRLP LDA (FAULT),Y
NULLRTS NULLRTS
PRERR1 RTS PRERR1 RTS
MOSBRKHDLR LDA #<MSGBRK
LDY #>MSGBRK
JSR PRSTR
JSR PRERR
JSR OSNEWL
JSR OSNEWL
STOP JMP STOP ; Cannot return from a BRK
MSGBRK DB $0D
ASC 'ERROR: '
DB $00
* Default page 2 contents * Default page 2 contents
*************************
DEFVEC DW NULLRTS ; $200 USERV DEFVEC DW NULLRTS ; $200 USERV
DW MOSBRKHDLR ; $202 BRKV DW MOSBRKHDLR ; $202 BRKV
DW NULLRTI ; $204 IRQ1V DW NULLRTI ; $204 IRQ1V
@ -500,7 +498,8 @@ OSSCANDEC JMP SCANDEC ; FF9E SCANDEC
OSSCANHEX JMP SCANHEX ; FFA1 SCANHEX OSSCANHEX JMP SCANHEX ; FFA1 SCANHEX
OSFFA4 JMP NULLRTS ; FFA4 (DISKACC) OSFFA4 JMP NULLRTS ; FFA4 (DISKACC)
OSFFA7 JMP NULLRTS ; FFA7 (DISKCCP) OSFFA7 JMP NULLRTS ; FFA7 (DISKCCP)
PRHEX JMP OUTHEX ; FFAA PRHEX PRHEX
PR1HEX JMP OUTHEX ; FFAA PRHEX
PR2HEX JMP OUT2HEX ; FFAD PR2HEX PR2HEX JMP OUT2HEX ; FFAD PR2HEX
OSFFB0 JMP PRINTDEC ; FFB0 (USERINT) OSFFB0 JMP PRINTDEC ; FFB0 (USERINT)
OSWRRM JMP NULLRTS ; FFB3 OSWRRM OSWRRM JMP NULLRTS ; FFB3 OSWRRM
@ -544,8 +543,6 @@ MOSVEND
* Buffer for one 512 byte disk block in aux mem * Buffer for one 512 byte disk block in aux mem
AUXBLK AUXBLK
;ASC '**ENDOFCODE**' ; ASC '**ENDOFCODE**'
; DS $200-13 ; DS $200-13

View File

@ -18,7 +18,7 @@
* DEBUG EQU $00 ; $00=*OPT 255 debug code removed * DEBUG EQU $00 ; $00=*OPT 255 debug code removed
DEBUG EQU $E0 ; $E0=*OPT 255 debug code included DEBUG EQU $E0 ; $E0=*OPT 255 debug code included
* ; $E1 * GSSPEED EQU $E1 ; $E1 **TEMP**
FSFLAG1 EQU $E2 ; $E2 FSFLAG1 EQU $E2 ; $E2
FSFLAG2 EQU $E3 ; $E3 HOSTFS *OPT settings FSFLAG2 EQU $E3 ; $E3 HOSTFS *OPT settings
GSFLAG EQU $E4 ; $E4 GSREAD processing flags GSFLAG EQU $E4 ; $E4 GSREAD processing flags
@ -27,7 +27,9 @@ OSTEXT EQU $E6 ; $E6 => text string $E6 OSNUM+0
MAXLEN EQU OSTEXT+2 ; $E8 $E8 OSNUM+2 MAXLEN EQU OSTEXT+2 ; $E8 $E8 OSNUM+2
MINCHAR EQU OSTEXT+3 ; $E9 $E9 OSNUM+3 MINCHAR EQU OSTEXT+3 ; $E9 $E9 OSNUM+3
MAXCHAR EQU OSTEXT+4 ; $EA $EA OSPAD MAXCHAR EQU OSTEXT+4 ; $EA $EA OSPAD
OSTEMP EQU $EB ; $EB $EB OSTEMP OSNUM EQU OSTEXT ; $E6
OSPAD EQU OSNUM+4 ; $EA
OSTEMP EQU $EB ; $EB
OSKBD1 EQU $EC ; $EC kbd ws OSKBD1 EQU $EC ; $EC kbd ws
OSKBD2 EQU OSKBD1+1 ; $ED kbd ws OSKBD2 EQU OSKBD1+1 ; $ED kbd ws
OSKBD3 EQU OSKBD1+2 ; $EE kbd ws OSKBD3 EQU OSKBD1+2 ; $EE kbd ws
@ -38,9 +40,9 @@ OSCTRL EQU OSXREG ; $F0 (XY)=>control block
OSLPTR EQU $F2 ; $F2 => command line OSLPTR EQU $F2 ; $F2 => command line
ROMID EQU $F4 ; $F4 current ROM ROMID EQU $F4 ; $F4 current ROM
ROMTMP EQU $F5 ; $F5 ROMTMP EQU $F5 ; $F5
ROMPTR EQU $F6 ; $F6 => ROMPTR EQU $F6 ; $F6 => ROM addresses
* ; $F8 *TEMP* pseudo-SROM settings * ; $F8 pseudo-SROM settings
* ; $F9 *TEMP* pseudo-SROM settings ROMMAX EQU $F9 ; $F9 pseudo-SROM settings: maximum ROM number
OSINTWS EQU $FA ; $FA IRQ ZP pointer, use when IRQs off OSINTWS EQU $FA ; $FA IRQ ZP pointer, use when IRQs off
OSINTA EQU $FC ; $FC IRQ register A store OSINTA EQU $FC ; $FC IRQ register A store
FAULT EQU $FD ; $FD Error message pointer FAULT EQU $FD ; $FD Error message pointer
@ -74,9 +76,3 @@ OSGBPBCB EQU OSFILECB+1 ; OSGBPB control block
* $0300-$03DF * $0300-$03DF
* $03E0-$03FF Used for interfacing with ProDOS XFER * $03E0-$03FF Used for interfacing with ProDOS XFER

View File

@ -176,9 +176,10 @@ MAININS >>> ENTMAIN
* Remove value from buffer or examine buffer (API same as Acorn MOS REMV) * Remove value from buffer or examine buffer (API same as Acorn MOS REMV)
* NOTE OS1.20 has a bug in the EXAMINE path
* On entry: X is buffer number, V=1 if only examination is requested * On entry: X is buffer number, V=1 if only examination is requested
* On exit: If examination, A next byte, X preserved, Y=offset to next char * On exit: If examination, A next byte, X preserved, Y=next byte
* If removal, A undef, X preserved, Y value of byte removed * If removal, A undef, X preserved, Y=value of byte removed
* If buffer already empty C=1, else C=0 * If buffer already empty C=1, else C=0
REM PHP ; Save flags, turn off interrupts REM PHP ; Save flags, turn off interrupts
SEI SEI
@ -201,6 +202,7 @@ REM PHP ; Save flags, turn off interrupts
CLC ; Success CLC ; Success
RTS RTS
:EXAM PLA ; Char read from buffer :EXAM PLA ; Char read from buffer
TAY ; BUGFIX: Omitted on OS1.20
PLP PLP
CLC ; Success CLC ; Success
RTS RTS