mirror of
https://github.com/bobbimanners/Applecorn.git
synced 2025-01-16 16:30:54 +00:00
commit
6b6023cd1a
@ -14,7 +14,7 @@ ZP1 EQU $90 ; $90-$9f are spare Econet space
|
||||
ZP2 EQU $92
|
||||
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
|
||||
|
||||
MOSSHIM
|
||||
@ -28,7 +28,7 @@ MOSSHIM
|
||||
*
|
||||
* 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
|
||||
TXS
|
||||
|
||||
@ -105,11 +105,11 @@ MOSINIT SEI ; Disable IRQ while initializing
|
||||
|
||||
:NORELOC
|
||||
:S8 STA SET80VID ; 80 col on
|
||||
STA CLRALTCHAR ; Alt charset off (?)
|
||||
STA CLRALTCHAR ; Alt charset off
|
||||
STA PAGE2 ; PAGE2
|
||||
JMP MOSHIGH ; Ensure executing in high memory here
|
||||
|
||||
MOSHIGH SEI ; Disable IRQ while initializing
|
||||
MOSHIGH SEI ; Ensure IRQs disabled
|
||||
LDX #$FF
|
||||
TXS ; Initialise stack
|
||||
INX ; X=$00
|
||||
@ -137,10 +137,11 @@ MOSHIGH SEI ; Disable IRQ while initializing
|
||||
LDA #7
|
||||
JSR OSWRCH
|
||||
JSR OSNEWL
|
||||
LDX MAXROM ; TEMP X=language to enter
|
||||
LDX MAXROM ; *TEMP* X=language to enter
|
||||
CLC
|
||||
|
||||
* OSBYTE $8E - Enter language ROM
|
||||
*********************************
|
||||
* X=ROM number to select
|
||||
*
|
||||
BYTE8E PHP ; Save CLC=RESET, SEC=Not RESET
|
||||
@ -156,10 +157,12 @@ BYTE8E PHP ; Save CLC=RESET, SEC=Not RESET
|
||||
JSR OSNEWL
|
||||
JSR OSNEWL
|
||||
PLP ; Get entry type back
|
||||
LDA #$01
|
||||
LDA #$01 ; $01=Entering code with a header
|
||||
JMP ROMAUXADDR
|
||||
|
||||
|
||||
* OSBYTE $8F - Issue service call
|
||||
*********************************
|
||||
* X=service call, Y=parameter
|
||||
*
|
||||
SERVICE TAX ; Enter here with A=Service Num
|
||||
@ -167,17 +170,14 @@ BYTE8F
|
||||
SERVICEX LDA $F4
|
||||
PHA ; Save current ROM
|
||||
|
||||
* LDA $E0 ; *DEBUG*
|
||||
* AND #$20
|
||||
* BEQ :SERVDEBUG
|
||||
* TXA
|
||||
* JSR PRHEX
|
||||
* LDA OSLPTR+1
|
||||
* JSR PRHEX
|
||||
* LDA OSLPTR+0
|
||||
* JSR PRHEX ; *DEBUG*
|
||||
*:SERVDEBUG
|
||||
|
||||
*DEBUG
|
||||
LDA $E0
|
||||
AND #$20 ; Test debug *OPT255,32
|
||||
BEQ :SERVDEBUG
|
||||
CPX #$06
|
||||
BEQ :SERVDONE ; If debug on, ignore SERV06
|
||||
:SERVDEBUG
|
||||
*DEBUG
|
||||
TXA
|
||||
LDX MAXROM ; Start at highest ROM
|
||||
:SERVLP JSR ROMSELECT ; Bring it into memory
|
||||
@ -198,9 +198,9 @@ SERVICEX LDA $F4
|
||||
RTS
|
||||
|
||||
|
||||
PRHELLO LDA #<HELLO
|
||||
PRHELLO LDX #<HELLO
|
||||
LDY #>HELLO
|
||||
JSR PRSTR
|
||||
JSR OSPRSTR
|
||||
JMP OSNEWL
|
||||
|
||||
BYTE00XX
|
||||
@ -211,12 +211,6 @@ BYTE00A BRK
|
||||
DB $F7
|
||||
HELLO ASC 'Applecorn MOS 2022-10-15'
|
||||
DB $00 ; Unify MOS messages
|
||||
* TO DO: Move into RAM
|
||||
GSSPEED DB $00 ; $80 if GS is fast, $00 for slow
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
109
auxmem.misc.s
109
auxmem.misc.s
@ -9,7 +9,7 @@
|
||||
* 26-Oct-2021 Corrected entry parameters to OSRDRM.
|
||||
* 03-Nov-2021 Temp'y fix, if can't find SROM, ignores it.
|
||||
* 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
|
||||
@ -35,18 +35,14 @@ ADVALBUF INX
|
||||
BEQ :ADVALOK ; Serial input, return 0
|
||||
LDX #$01 ; For outputs, return 1 char free
|
||||
RTS
|
||||
:ADVALKBD BIT KEYBOARD ; Test keyboard data/strobe
|
||||
:ADVALKBD BIT KBDDATA ; Test keyboard data/strobe
|
||||
BPL :ADVALOK ; No Strobe, return 0
|
||||
INX ; Strobe, return 1
|
||||
:ADVALOK RTS
|
||||
|
||||
|
||||
******************
|
||||
* Helper functions
|
||||
******************
|
||||
|
||||
* Beep
|
||||
*
|
||||
******
|
||||
* Sound measurement shows the tone formula is:
|
||||
* 1.230 MHz
|
||||
* ------------- = cycles
|
||||
@ -79,23 +75,26 @@ BEEP PHA
|
||||
PLY ;
|
||||
PLX
|
||||
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
|
||||
|
||||
* Print string pointed to by A,Y to the screen
|
||||
PRSTR STA OSTEXT+0 ; String in A,Y
|
||||
STY OSTEXT+1
|
||||
:L1 LDA (OSTEXT) ; Ptr to string in OSTEXT
|
||||
BEQ PRSTROK
|
||||
JSR OSASCI
|
||||
PHP ; Save EQ
|
||||
INC OSTEXT
|
||||
BNE :L1
|
||||
BNE :L2
|
||||
INC OSTEXT+1
|
||||
:L2 PLP ; Get EQ back
|
||||
BEQ PRSTROK ; End of string
|
||||
JSR OSASCI
|
||||
BRA :L1
|
||||
PRSTROK RTS
|
||||
|
||||
* Print NL if not already at column 0
|
||||
FORCENL LDA #$86
|
||||
@ -104,12 +103,14 @@ FORCENL LDA #$86
|
||||
BEQ PRSTROK
|
||||
JMP OSNEWL
|
||||
|
||||
* Print XY in hex
|
||||
* OSPR2HEX - Print XY in hex
|
||||
****************************
|
||||
OUT2HEX TYA
|
||||
JSR OUTHEX
|
||||
TXA ; Continue into OUTHEX
|
||||
|
||||
* Print hex byte in A
|
||||
* OSPR1HEX - Print hex byte in A
|
||||
********************************
|
||||
OUTHEX PHA
|
||||
LSR
|
||||
LSR
|
||||
@ -130,19 +131,8 @@ PRNIB CMP #$0A
|
||||
:S1 ADC #'0' ; < $0A
|
||||
JMP OSWRCH
|
||||
|
||||
* TEMP ENTRY *
|
||||
* 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
|
||||
* OSPRDEC - Print up to 32-bit decimal number
|
||||
*********************************************
|
||||
* See forum.6502.org/viewtopic.php?f=2&t=4894
|
||||
* 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
|
||||
|
||||
|
||||
* Read a byte from sideways ROM
|
||||
* OSRDROM - Read a byte from sideways ROM
|
||||
*****************************************
|
||||
* On entry, Y=ROM to read from
|
||||
* (ROMPTR)=>byte to read
|
||||
* On exit, A=byte read, X=current ROM, Y=$00
|
||||
RDROM LDA ROMID
|
||||
PHA ; Save current ROM
|
||||
TYA
|
||||
TAX ; X=ROM to read from
|
||||
JSR ROMSELECT ; Page in the required ROM
|
||||
LDY #$00
|
||||
LDY #$00 ; NOTE BBC sets Y=0, Master preserves
|
||||
LDA (ROMPTR),Y ; Read the byte
|
||||
PLX
|
||||
|
||||
* Select a sideways ROM
|
||||
* X=ROM to select
|
||||
* All registers must be preserved
|
||||
* ROMSELECT - Select a sideways ROM
|
||||
***********************************
|
||||
* On entry, X=ROM to select
|
||||
* On exit, All registers must be preserved
|
||||
*
|
||||
ROMSELECT
|
||||
* Insert code here for faking sideways ROMs by loading or otherwise
|
||||
* fetching code to $8000. All registers must be preserved.
|
||||
PHP
|
||||
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
|
||||
PHA
|
||||
PHX
|
||||
@ -354,11 +348,6 @@ ROMSELDONE >>> ENTAUX
|
||||
ROMSELOK PLP
|
||||
RTS
|
||||
|
||||
|
||||
|
||||
EVENT RTS
|
||||
|
||||
|
||||
* Initialize ROMTAB according to user selection in menu
|
||||
ROMINIT STZ MAXROM ; One sideways ROM only
|
||||
STA RDMAINRAM ; Read main mem
|
||||
@ -371,7 +360,12 @@ ROMINIT STZ MAXROM ; One sideways ROM only
|
||||
:X1 CMP #7
|
||||
BNE :X2
|
||||
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
|
||||
|
||||
* IRQ/BRK handler
|
||||
*****************
|
||||
IRQBRKHDLR PHA
|
||||
* Mustn't enable IRQs within the IRQ handler
|
||||
* Do not use WRTMAIN/WRTAUX macros
|
||||
@ -428,6 +423,20 @@ IRQBRKRET
|
||||
PLA
|
||||
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
|
||||
PRERRLP LDA (FAULT),Y
|
||||
BEQ PRERR1
|
||||
@ -437,20 +446,9 @@ PRERRLP LDA (FAULT),Y
|
||||
NULLRTS
|
||||
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
|
||||
*************************
|
||||
DEFVEC DW NULLRTS ; $200 USERV
|
||||
DW MOSBRKHDLR ; $202 BRKV
|
||||
DW NULLRTI ; $204 IRQ1V
|
||||
@ -500,7 +498,8 @@ OSSCANDEC JMP SCANDEC ; FF9E SCANDEC
|
||||
OSSCANHEX JMP SCANHEX ; FFA1 SCANHEX
|
||||
OSFFA4 JMP NULLRTS ; FFA4 (DISKACC)
|
||||
OSFFA7 JMP NULLRTS ; FFA7 (DISKCCP)
|
||||
PRHEX JMP OUTHEX ; FFAA PRHEX
|
||||
PRHEX
|
||||
PR1HEX JMP OUTHEX ; FFAA PRHEX
|
||||
PR2HEX JMP OUT2HEX ; FFAD PR2HEX
|
||||
OSFFB0 JMP PRINTDEC ; FFB0 (USERINT)
|
||||
OSWRRM JMP NULLRTS ; FFB3 OSWRRM
|
||||
@ -544,8 +543,6 @@ MOSVEND
|
||||
|
||||
* Buffer for one 512 byte disk block in aux mem
|
||||
AUXBLK
|
||||
;ASC '**ENDOFCODE**'
|
||||
; ASC '**ENDOFCODE**'
|
||||
; DS $200-13
|
||||
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
* DEBUG EQU $00 ; $00=*OPT 255 debug code removed
|
||||
DEBUG EQU $E0 ; $E0=*OPT 255 debug code included
|
||||
* ; $E1
|
||||
* GSSPEED EQU $E1 ; $E1 **TEMP**
|
||||
FSFLAG1 EQU $E2 ; $E2
|
||||
FSFLAG2 EQU $E3 ; $E3 HOSTFS *OPT settings
|
||||
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
|
||||
MINCHAR EQU OSTEXT+3 ; $E9 $E9 OSNUM+3
|
||||
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
|
||||
OSKBD2 EQU OSKBD1+1 ; $ED 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
|
||||
ROMID EQU $F4 ; $F4 current ROM
|
||||
ROMTMP EQU $F5 ; $F5
|
||||
ROMPTR EQU $F6 ; $F6 =>
|
||||
* ; $F8 *TEMP* pseudo-SROM settings
|
||||
* ; $F9 *TEMP* pseudo-SROM settings
|
||||
ROMPTR EQU $F6 ; $F6 => ROM addresses
|
||||
* ; $F8 pseudo-SROM settings
|
||||
ROMMAX EQU $F9 ; $F9 pseudo-SROM settings: maximum ROM number
|
||||
OSINTWS EQU $FA ; $FA IRQ ZP pointer, use when IRQs off
|
||||
OSINTA EQU $FC ; $FC IRQ register A store
|
||||
FAULT EQU $FD ; $FD Error message pointer
|
||||
@ -74,9 +76,3 @@ OSGBPBCB EQU OSFILECB+1 ; OSGBPB control block
|
||||
|
||||
* $0300-$03DF
|
||||
* $03E0-$03FF Used for interfacing with ProDOS XFER
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -176,9 +176,10 @@ MAININS >>> ENTMAIN
|
||||
|
||||
|
||||
* 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 exit: If examination, A next byte, X preserved, Y=offset to next char
|
||||
* If removal, A undef, X preserved, Y value of byte removed
|
||||
* On exit: If examination, A next byte, X preserved, Y=next byte
|
||||
* If removal, A undef, X preserved, Y=value of byte removed
|
||||
* If buffer already empty C=1, else C=0
|
||||
REM PHP ; Save flags, turn off interrupts
|
||||
SEI
|
||||
@ -201,6 +202,7 @@ REM PHP ; Save flags, turn off interrupts
|
||||
CLC ; Success
|
||||
RTS
|
||||
:EXAM PLA ; Char read from buffer
|
||||
TAY ; BUGFIX: Omitted on OS1.20
|
||||
PLP
|
||||
CLC ; Success
|
||||
RTS
|
||||
|
Loading…
x
Reference in New Issue
Block a user