Applecorn/applecorn.s

155 lines
4.0 KiB
ArmAsm
Raw Normal View History

* 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
* (c) Bobbi 2021 GPLv3
*
* Assembled with the Merlin 8 assembler.
2021-07-16 02:16:22 +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
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
* IRQ vector
A2IRQV EQU $3FE
2021-07-16 02:16:22 +00:00
* MLI entry point
MLI EQU $BF00
* ProDOS MLI command numbers
2021-07-18 02:51:36 +00:00
QUITCMD EQU $65
2021-07-16 02:16:22 +00:00
GTIMECMD EQU $82
CREATCMD EQU $C0
2021-07-29 00:47:26 +00:00
DESTCMD EQU $C1
2021-07-16 02:16:22 +00:00
ONLNCMD EQU $C5
2021-07-20 02:20:02 +00:00
SPFXCMD EQU $C6
2021-07-16 02:16:22 +00:00
GPFXCMD EQU $C7
OPENCMD EQU $C8
READCMD EQU $CA
WRITECMD EQU $CB
CLSCMD EQU $CC
FLSHCMD EQU $CD
2021-08-01 20:32:15 +00:00
SMARKCMD EQU $CE
GMARKCMD EQU $CF
GEOFCMD EQU $D1
2021-07-16 02:16:22 +00:00
* IO Buffer for reading file (1024 bytes)
IOBUF0 EQU $4000 ; For loading ROM, OSFILE, *.
IOBUF1 EQU $4400 ; Four open files for langs
IOBUF2 EQU $4800
IOBUF3 EQU $4C00
IOBUF4 EQU $5000
2021-07-16 02:16:22 +00:00
2021-07-29 00:47:26 +00:00
* 512 byte buffer sufficient for one disk block
BLKBUF EQU $5200
BLKBUFEND EQU $5400
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
AUXMOS1 EQU $2000 ; Temp staging area in Aux
EAUXMOS1 EQU $3000 ; End of staging area
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
SEI ; EXPERIMENT
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-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
SEI ; Experiment
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-01 00:19:15 +00:00
TSX
STX $0101 ; Save alt SP
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
ENTAUX MAC
2021-08-14 05:18:35 +00:00
LDX STRTBCKL
STX STRTL
LDX STRTBCKH
STX STRTH
2021-07-31 22:58:59 +00:00
LDX $0101 ; Recover alt SP
TXS
CLI
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-07-31 21:33:08 +00:00
ENTMAIN MAC
TXS ; Main SP already in X
2021-08-14 05:18:35 +00:00
LDX $C081 ; Bank in ROM
LDX $C081
CLI
2021-07-31 21:33:08 +00:00
EOM
* Enable writing to main memory (for code running in aux)
WRTMAIN MAC
SEI ; Keeps IRQ handler easy
STA $C004 ; Write to main memory
EOM
* Go back to writing to aux (for code runnign in aux)
WRTAUX MAC
STA $C005 ; Write to aux memory
CLI ; Normal service resumed
EOM
2021-07-30 20:49:34 +00:00
* Code is all included from PUT files below ...
* ... order matters!
PUT LOADER
2021-08-10 19:10:15 +00:00
PUT MAIN.ROMMENU
PUT MAINMEM
PUT AUXMEM.MOSEQU
PUT AUXMEM.INIT
PUT AUXMEM.VDU
PUT AUXMEM.HOSTFS
2021-08-15 03:42:06 +00:00
PUT AUXMEM.OSCLI
PUT AUXMEM.BYTWRD
PUT AUXMEM.CHARIO
PUT AUXMEM.MISC