2021-08-16 18:58:05 +00:00
|
|
|
* APPLECORN.S
|
|
|
|
* (c) Bobbi 2021 GPLv3
|
|
|
|
*
|
2021-07-25 23:04:51 +00:00
|
|
|
* Load an Acorn BBC Micro ROM in aux memory and
|
2021-07-16 02:16:22 +00:00
|
|
|
* Provide an environment where it can run
|
2021-07-27 00:07:51 +00:00
|
|
|
*
|
2021-08-16 18:58:05 +00:00
|
|
|
* Assembled with the Merlin 8 v2.58 assembler on Apple II.
|
2021-07-16 02:16:22 +00:00
|
|
|
|
2021-07-28 04:17:47 +00:00
|
|
|
XC ; 65c02
|
|
|
|
ORG $2000 ; Load addr of loader in main memory
|
2021-07-16 02:16:22 +00:00
|
|
|
|
|
|
|
* Monitor routines
|
|
|
|
BELL EQU $FBDD
|
|
|
|
PRBYTE EQU $FDDA
|
|
|
|
COUT1 EQU $FDED
|
|
|
|
CROUT EQU $FD8E
|
2021-08-18 00:13:51 +00:00
|
|
|
HOME EQU $FC58
|
2021-07-16 02:16:22 +00:00
|
|
|
AUXMOVE EQU $C311
|
|
|
|
XFER EQU $C314
|
|
|
|
|
|
|
|
* Monitor ZP locations
|
|
|
|
A1L EQU $3C
|
|
|
|
A1H EQU $3D
|
|
|
|
A2L EQU $3E
|
|
|
|
A2H EQU $3F
|
|
|
|
A4L EQU $42
|
|
|
|
A4H EQU $43
|
|
|
|
|
|
|
|
* Used by XFER
|
|
|
|
STRTL EQU $3ED
|
|
|
|
STRTH EQU $3EE
|
|
|
|
|
|
|
|
* Reset vector (2 bytes + 1 byte checksum)
|
|
|
|
RSTV EQU $3F2
|
|
|
|
|
2021-08-06 03:02:13 +00:00
|
|
|
* IRQ vector
|
|
|
|
A2IRQV EQU $3FE
|
|
|
|
|
2021-07-16 02:16:22 +00:00
|
|
|
* MLI entry point
|
|
|
|
MLI EQU $BF00
|
|
|
|
|
2021-07-28 04:17:47 +00:00
|
|
|
* IO Buffer for reading file (1024 bytes)
|
2021-08-29 05:13:31 +00:00
|
|
|
IOBUF0 EQU $0C00 ; For loading/saving, OSFILE, *.
|
|
|
|
IOBUF1 EQU $1000 ; Four open files for langs
|
|
|
|
IOBUF2 EQU $1400
|
|
|
|
IOBUF3 EQU $1800
|
|
|
|
IOBUF4 EQU $1C00
|
2021-07-16 02:16:22 +00:00
|
|
|
|
2021-07-29 00:47:26 +00:00
|
|
|
* 512 byte buffer sufficient for one disk block
|
2021-09-17 21:29:36 +00:00
|
|
|
BLKBUF EQU $6000 ; Can't use $400 as ProDOS uses
|
|
|
|
BLKBUFEND EQU $6200 ; 'hidden' bytes within screen
|
2021-07-16 02:16:22 +00:00
|
|
|
|
2021-09-16 02:03:57 +00:00
|
|
|
* 512 byte buffer for file copy (*COPY)
|
2021-09-17 21:29:36 +00:00
|
|
|
COPYBUF EQU $6200 ; File copy needs separate buffer
|
|
|
|
*COPYBUFEND EQU $6400
|
2021-09-16 02:03:57 +00:00
|
|
|
|
2021-07-16 02:16:22 +00:00
|
|
|
* Address in aux memory where ROM will be loaded
|
|
|
|
AUXADDR EQU $8000
|
|
|
|
|
|
|
|
* Address in aux memory where the MOS shim is located
|
2021-07-28 04:17:47 +00:00
|
|
|
AUXMOS1 EQU $2000 ; Temp staging area in Aux
|
2021-08-28 04:44:45 +00:00
|
|
|
EAUXMOS1 EQU $5000 ; End of staging area
|
2021-07-28 04:17:47 +00:00
|
|
|
AUXMOS EQU $D000 ; Final location in aux LC
|
2021-07-16 02:16:22 +00:00
|
|
|
|
2021-08-01 00:37:18 +00:00
|
|
|
* Called by code running in main mem to invoke a
|
|
|
|
* routine in aux memory
|
|
|
|
XF2AUX MAC
|
2021-08-14 05:18:35 +00:00
|
|
|
LDX $C08B ; R/W LC RAM, bank 1
|
|
|
|
LDX $C08B
|
|
|
|
LDX #<]1
|
|
|
|
STX STRTL
|
|
|
|
LDX #>]1
|
|
|
|
STX STRTH
|
2021-08-16 18:58:05 +00:00
|
|
|
SEI ; Disable IRQ before XFER
|
2021-08-01 00:37:18 +00:00
|
|
|
SEC ; Use aux memory
|
|
|
|
BIT $FF58 ; Set V: use alt ZP and LC
|
|
|
|
JMP XFER
|
2021-07-30 20:49:34 +00:00
|
|
|
EOM
|
|
|
|
|
2021-08-01 01:39:05 +00:00
|
|
|
* Called by code running in aux mem to invoke a
|
|
|
|
* routine in main memory
|
|
|
|
XF2MAIN MAC
|
2021-08-14 05:18:35 +00:00
|
|
|
LDX STRTL
|
|
|
|
STX STRTBCKL
|
|
|
|
LDX STRTH
|
|
|
|
STX STRTBCKH
|
|
|
|
LDX #<]1
|
|
|
|
STX STRTL
|
|
|
|
LDX #>]1
|
|
|
|
STX STRTH
|
2021-08-16 18:58:05 +00:00
|
|
|
SEI ; Disable IRQ before XFER
|
2021-08-01 00:19:15 +00:00
|
|
|
TSX
|
|
|
|
STX $0101 ; Save alt SP
|
2021-08-15 19:27:35 +00:00
|
|
|
LDX $0100 ; Load main SP into X
|
2021-08-01 01:39:05 +00:00
|
|
|
CLC ; Use main mem
|
|
|
|
CLV ; Use main ZP and LC
|
|
|
|
JMP XFER
|
2021-07-30 21:33:50 +00:00
|
|
|
EOM
|
|
|
|
|
2021-07-31 22:58:59 +00:00
|
|
|
* Macro called on re-entry to aux memory
|
2021-08-19 17:50:59 +00:00
|
|
|
* Careful: This enables IRQ - not for use in ISR
|
2021-07-31 22:58:59 +00:00
|
|
|
ENTAUX MAC
|
2021-08-16 18:58:05 +00:00
|
|
|
LDX $0101 ; Recover alt SP
|
|
|
|
TXS
|
|
|
|
CLI ; Re-enable IRQ after XFER
|
2021-08-14 05:18:35 +00:00
|
|
|
LDX STRTBCKL
|
|
|
|
STX STRTL
|
|
|
|
LDX STRTBCKH
|
|
|
|
STX STRTH
|
2021-07-30 21:33:50 +00:00
|
|
|
EOM
|
|
|
|
|
2021-07-31 22:58:59 +00:00
|
|
|
* Macro called on re-entry to main memory
|
2021-08-19 17:50:59 +00:00
|
|
|
* Careful: This enables IRQ - not for use in ISR
|
2021-07-31 21:33:08 +00:00
|
|
|
ENTMAIN MAC
|
2021-08-15 19:27:35 +00:00
|
|
|
TXS ; Main SP already in X
|
2021-08-14 05:18:35 +00:00
|
|
|
LDX $C081 ; Bank in ROM
|
|
|
|
LDX $C081
|
2021-08-16 18:58:05 +00:00
|
|
|
CLI ; Re-enable IRQ after XFER
|
2021-07-31 21:33:08 +00:00
|
|
|
EOM
|
|
|
|
|
2021-08-17 16:00:50 +00:00
|
|
|
* Macro called on re-entry to aux memory
|
|
|
|
* For use in interrupt handlers (no CLI!)
|
|
|
|
IENTAUX MAC
|
|
|
|
LDX $0101 ; Recover alt SP
|
|
|
|
TXS
|
|
|
|
LDX STRTBCKL
|
|
|
|
STX STRTL
|
|
|
|
LDX STRTBCKH
|
|
|
|
STX STRTH
|
|
|
|
EOM
|
|
|
|
|
|
|
|
* Macro called on re-entry to main memory
|
|
|
|
* For use in interrupt handlers (no CLI!)
|
|
|
|
IENTMAIN MAC
|
|
|
|
TXS ; Main SP already in X
|
|
|
|
LDX $C081 ; Bank in ROM
|
|
|
|
LDX $C081
|
|
|
|
EOM
|
|
|
|
|
2021-08-06 03:02:13 +00:00
|
|
|
* Enable writing to main memory (for code running in aux)
|
|
|
|
WRTMAIN MAC
|
|
|
|
SEI ; Keeps IRQ handler easy
|
|
|
|
STA $C004 ; Write to main memory
|
|
|
|
EOM
|
|
|
|
|
2021-08-16 18:58:05 +00:00
|
|
|
* Go back to writing to aux (for code running in aux)
|
2021-08-06 03:02:13 +00:00
|
|
|
WRTAUX MAC
|
|
|
|
STA $C005 ; Write to aux memory
|
|
|
|
CLI ; Normal service resumed
|
|
|
|
EOM
|
|
|
|
|
2021-08-16 18:58:05 +00:00
|
|
|
* Manually enable AltZP (for code running in main)
|
|
|
|
ALTZP MAC
|
|
|
|
SEI ; Disable IRQ when AltZP on
|
|
|
|
LDA $C08B ; R/W LC bank 1
|
|
|
|
LDA $C08B
|
|
|
|
STA $C009 ; Alt ZP and LC
|
|
|
|
EOM
|
|
|
|
|
|
|
|
* Manually disable AltZP (for code running in main)
|
|
|
|
MAINZP MAC
|
|
|
|
STA $C008 ; Main ZP and LC
|
|
|
|
LDA $C081 ; Bank ROM back in
|
|
|
|
LDA $C081
|
|
|
|
CLI ; Turn IRQ back on
|
|
|
|
EOM
|
|
|
|
|
2021-07-30 20:49:34 +00:00
|
|
|
* Code is all included from PUT files below ...
|
2021-08-08 02:48:24 +00:00
|
|
|
* ... order matters!
|
2021-09-07 01:39:36 +00:00
|
|
|
PUT MAINMEM.LDR
|
2021-09-07 01:38:20 +00:00
|
|
|
PUT MAINMEM.MENU
|
2021-09-07 02:28:07 +00:00
|
|
|
PUT MAINMEM.FSEQU
|
|
|
|
PUT MAINMEM.INIT
|
|
|
|
PUT MAINMEM.SVC
|
|
|
|
PUT MAINMEM.PATH
|
2021-09-09 05:01:39 +00:00
|
|
|
PUT MAINMEM.WILD
|
2021-09-07 02:28:07 +00:00
|
|
|
PUT MAINMEM.LISTS
|
|
|
|
PUT MAINMEM.MISC
|
2021-08-10 01:27:44 +00:00
|
|
|
PUT AUXMEM.MOSEQU
|
|
|
|
PUT AUXMEM.INIT
|
|
|
|
PUT AUXMEM.VDU
|
|
|
|
PUT AUXMEM.HOSTFS
|
2021-08-15 03:42:06 +00:00
|
|
|
PUT AUXMEM.OSCLI
|
2021-08-10 01:27:44 +00:00
|
|
|
PUT AUXMEM.BYTWRD
|
|
|
|
PUT AUXMEM.CHARIO
|
|
|
|
PUT AUXMEM.MISC
|
|
|
|
|
2021-08-30 23:08:22 +00:00
|
|
|
* Automatically save the object file:
|
2021-08-28 02:47:31 +00:00
|
|
|
SAV APPLECORN
|
2021-08-26 21:36:46 +00:00
|
|
|
|
2021-09-07 03:43:42 +00:00
|
|
|
|
|
|
|
|
2021-09-09 17:38:27 +00:00
|
|
|
|
|
|
|
|
2021-09-10 05:10:16 +00:00
|
|
|
|
|
|
|
|
2021-09-10 18:53:24 +00:00
|
|
|
|
|
|
|
|
2021-09-10 20:11:57 +00:00
|
|
|
|
|
|
|
|
2021-09-12 06:05:17 +00:00
|
|
|
|
|
|
|
|
2021-09-17 03:16:05 +00:00
|
|
|
|
|
|
|
|