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-10-14 23:10:11 +00:00
|
|
|
* 14-Oct-2021 XF2MAIN, ENTAUX no longer save/restore STRTL/STRTH.
|
|
|
|
|
|
|
|
|
2021-07-28 04:17:47 +00:00
|
|
|
XC ; 65c02
|
2022-10-07 03:09:29 +00:00
|
|
|
ORG $2000 ; Load addr of loader in main memory
|
2021-09-18 01:06:24 +00:00
|
|
|
; Clear of first HGR frame buffer
|
2021-07-16 02:16:22 +00:00
|
|
|
|
|
|
|
* Monitor routines
|
|
|
|
BELL EQU $FBDD
|
|
|
|
PRBYTE EQU $FDDA
|
|
|
|
COUT1 EQU $FDED
|
|
|
|
CROUT EQU $FD8E
|
2022-10-14 04:47:42 +00:00
|
|
|
IDROUTINE EQU $FE1F
|
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
|
2022-12-22 02:04:44 +00:00
|
|
|
A3L EQU $40 ; Used for ISR only
|
|
|
|
A3H EQU $41 ; Used for ISR only
|
2021-07-16 02:16:22 +00:00
|
|
|
A4L EQU $42
|
|
|
|
A4H EQU $43
|
|
|
|
|
|
|
|
* Used by XFER
|
|
|
|
STRTL EQU $3ED
|
|
|
|
STRTH EQU $3EE
|
|
|
|
|
2022-10-12 04:00:36 +00:00
|
|
|
* Apple II BREAK vector
|
|
|
|
BREAKV EQU $3F0
|
|
|
|
|
2021-07-16 02:16:22 +00:00
|
|
|
* Reset vector (2 bytes + 1 byte checksum)
|
|
|
|
RSTV EQU $3F2
|
2022-10-12 04:00:36 +00:00
|
|
|
PWRDUP EQU $3F4
|
2021-07-16 02:16:22 +00:00
|
|
|
|
2021-08-06 03:02:13 +00:00
|
|
|
* IRQ vector
|
|
|
|
A2IRQV EQU $3FE
|
|
|
|
|
2022-10-08 09:17:19 +00:00
|
|
|
* ProDOS Global Page equates
|
2021-07-16 02:16:22 +00:00
|
|
|
* MLI entry point
|
|
|
|
MLI EQU $BF00
|
2022-10-09 01:38:12 +00:00
|
|
|
* Device Addresses
|
|
|
|
DEVADR01 EQU $BF10
|
|
|
|
DEVADR32 EQU $BF26
|
|
|
|
* Device List
|
|
|
|
DEVNUM EQU $BF30
|
|
|
|
DEVCNT EQU $BF31
|
|
|
|
DEVLST EQU $BF32
|
|
|
|
* Date & time
|
|
|
|
PRODOSDATE EQU $BF90
|
|
|
|
PRODOSTIME EQU $BF92
|
2022-10-08 09:17:19 +00:00
|
|
|
* Machine ID byte
|
|
|
|
MACHID EQU $BF98
|
|
|
|
* Versioning bytes
|
|
|
|
IBAKVER EQU $BFFC
|
|
|
|
IVERSION EQU $BFFD
|
|
|
|
* System BitMap locations
|
|
|
|
P8BMAP0007 EQU $BF58
|
|
|
|
P8BMAP080F EQU $BF59
|
|
|
|
P8BMAP2027 EQU $BF5C
|
|
|
|
P8BMAP282F EQU $BF5D
|
|
|
|
P8BMAP3037 EQU $BF5E
|
|
|
|
P8BMAP383F EQU $BF5F
|
2021-07-16 02:16:22 +00:00
|
|
|
|
2022-10-12 04:00:36 +00:00
|
|
|
*Hardware I/O locations
|
|
|
|
KEYBOARD EQU $C000
|
|
|
|
80STOREOFF EQU $C000
|
|
|
|
80STOREON EQU $C001 ; Currently not used
|
|
|
|
RDMAINRAM EQU $C002
|
|
|
|
RDCARDRAM EQU $C003
|
|
|
|
WRMAINRAM EQU $C004
|
|
|
|
WRCARDRAM EQU $C005
|
|
|
|
SETSTDZP EQU $C008
|
|
|
|
SETALTZP EQU $C009
|
|
|
|
CLR80VID EQU $C00C
|
|
|
|
SET80VID EQU $C00D
|
|
|
|
CLRALTCHAR EQU $C00E
|
|
|
|
SETALTCHAR EQU $C00F
|
2022-11-21 03:45:40 +00:00
|
|
|
RDRAMRD EQU $C013
|
|
|
|
RDRAMWR EQU $C014
|
2022-10-12 04:00:36 +00:00
|
|
|
KBDSTRB EQU $C010
|
|
|
|
RDVBL EQU $C019
|
|
|
|
RD80VID EQU $C01F
|
|
|
|
|
|
|
|
TBCOLOR EQU $C022 ; GS-specific, used but commented out
|
2022-12-22 18:44:40 +00:00
|
|
|
NEWVIDEO EQU $C029 ; GS-specific, new video register
|
2022-10-12 04:00:36 +00:00
|
|
|
|
|
|
|
SPKR EQU $C030
|
|
|
|
CLOCKCTL EQU $C034 ; GS-specific, Clock control register
|
2022-12-25 04:18:03 +00:00
|
|
|
SHADOW EQU $C035 ; GS-specific, Shadow Register
|
2022-10-12 04:00:36 +00:00
|
|
|
CYAREG EQU $C036 ; GS-specific, CYA Register
|
|
|
|
|
|
|
|
GRON EQU $C050
|
|
|
|
TEXTON EQU $C051
|
|
|
|
FULLGR EQU $C052
|
|
|
|
MIXGRTXT EQU $C053 ; Currently not used
|
|
|
|
PAGE1 EQU $C054
|
|
|
|
PAGE2 EQU $C055
|
|
|
|
LORES EQU $C056 ; Currently not used
|
|
|
|
HIRES EQU $C057
|
|
|
|
AN0OFF EQU $C058
|
|
|
|
AN0ON EQU $C059
|
|
|
|
AN1OFF EQU $C05A
|
|
|
|
AN1ON EQU $C05B
|
|
|
|
AN2OFF EQU $C05C
|
|
|
|
AN2ON EQU $C05D
|
|
|
|
AN3OFF EQU $C05E
|
|
|
|
AN3ON EQU $C05F
|
|
|
|
|
|
|
|
BUTTON0 EQU $C061
|
|
|
|
BUTTON1 EQU $C062
|
|
|
|
|
|
|
|
ROMIN EQU $C081
|
|
|
|
LCBANK1 EQU $C08B
|
|
|
|
|
|
|
|
|
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-18 01:06:24 +00:00
|
|
|
BLKBUF EQU $9000 ; Can't use $400 as ProDOS uses
|
|
|
|
BLKBUFEND EQU $9200 ; '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-18 01:06:24 +00:00
|
|
|
COPYBUF EQU $9200 ; File copy needs separate buffer
|
|
|
|
*COPYBUFEND EQU $9400
|
2021-09-16 02:03:57 +00:00
|
|
|
|
2021-09-22 02:05:42 +00:00
|
|
|
* Location of FDraw library in main memory
|
|
|
|
FDRAWADDR EQU $9400
|
|
|
|
|
2021-09-23 16:59:36 +00:00
|
|
|
* Location of FDraw library in main memory
|
|
|
|
FONTADDR EQU $A900
|
|
|
|
|
2021-07-16 02:16:22 +00:00
|
|
|
* Address in aux memory where ROM will be loaded
|
2022-10-12 04:00:36 +00:00
|
|
|
ROMAUXADDR EQU $8000
|
2021-07-16 02:16:22 +00:00
|
|
|
|
|
|
|
* 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-12-08 16:28:56 +00:00
|
|
|
SEI ; Disable IRQ before XFER
|
2022-10-12 04:00:36 +00:00
|
|
|
LDX LCBANK1 ; R/W LC RAM, bank 1
|
|
|
|
LDX LCBANK1
|
2021-08-14 05:18:35 +00:00
|
|
|
LDX #<]1
|
|
|
|
STX STRTL
|
|
|
|
LDX #>]1
|
|
|
|
STX STRTH
|
2021-08-01 00:37:18 +00:00
|
|
|
SEC ; Use aux memory
|
2021-11-06 02:09:20 +00:00
|
|
|
BIT RTSINSTR ; Set V: use alt ZP and LC
|
2021-08-01 00:37:18 +00:00
|
|
|
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
|
2022-11-28 01:05:53 +00:00
|
|
|
SEI ; Disable IRQ before XFER
|
2021-08-14 05:18:35 +00:00
|
|
|
LDX #<]1
|
|
|
|
STX STRTL
|
|
|
|
LDX #>]1
|
|
|
|
STX STRTH
|
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-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
|
2022-10-12 04:00:36 +00:00
|
|
|
LDX ROMIN ; Bank in ROM
|
|
|
|
LDX ROMIN
|
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
|
|
|
|
EOM
|
|
|
|
|
|
|
|
* Macro called on re-entry to main memory
|
|
|
|
* For use in interrupt handlers (no CLI!)
|
|
|
|
IENTMAIN MAC
|
|
|
|
TXS ; Main SP already in X
|
2022-10-12 04:00:36 +00:00
|
|
|
LDX ROMIN ; Bank in ROM
|
|
|
|
LDX ROMIN
|
2021-08-17 16:00:50 +00:00
|
|
|
EOM
|
|
|
|
|
2021-08-06 03:02:13 +00:00
|
|
|
* Enable writing to main memory (for code running in aux)
|
|
|
|
WRTMAIN MAC
|
2022-09-24 18:50:30 +00:00
|
|
|
PHP
|
2021-08-06 03:02:13 +00:00
|
|
|
SEI ; Keeps IRQ handler easy
|
2022-12-18 23:42:54 +00:00
|
|
|
STZ WRMAINRAM ; Write to main memory
|
2021-08-06 03:02:13 +00:00
|
|
|
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
|
2022-12-18 23:42:54 +00:00
|
|
|
STZ WRCARDRAM ; Write to aux memory
|
2022-09-24 18:50:30 +00:00
|
|
|
PLP ; Normal service resumed
|
2021-08-06 03:02:13 +00:00
|
|
|
EOM
|
|
|
|
|
2022-12-19 00:04:38 +00:00
|
|
|
* Enable reading from main memory (for code running in aux LC)
|
|
|
|
RDMAIN MAC
|
|
|
|
PHP
|
|
|
|
SEI ; Keeps IRQ handler easy
|
|
|
|
STZ RDMAINRAM ; Read from main memory
|
|
|
|
EOM
|
|
|
|
|
|
|
|
* Go back to reading from aux (for code running in aux LC)
|
|
|
|
RDAUX MAC
|
|
|
|
STZ RDCARDRAM ; Read from aux memory
|
|
|
|
PLP ; Normal service resumed
|
|
|
|
EOM
|
|
|
|
|
2022-12-12 01:55:23 +00:00
|
|
|
* Manually enable AltZP + Aux LC (for code running in main)
|
2022-12-12 01:53:34 +00:00
|
|
|
* Banks ROM out
|
2021-08-16 18:58:05 +00:00
|
|
|
ALTZP MAC
|
2022-09-19 23:25:51 +00:00
|
|
|
PHP
|
2021-08-16 18:58:05 +00:00
|
|
|
SEI ; Disable IRQ when AltZP on
|
2022-10-12 04:00:36 +00:00
|
|
|
LDA LCBANK1 ; R/W LC bank 1
|
|
|
|
LDA LCBANK1
|
2022-12-18 23:42:54 +00:00
|
|
|
STZ SETALTZP ; Alt ZP and LC
|
2021-08-16 18:58:05 +00:00
|
|
|
EOM
|
|
|
|
|
2022-12-12 01:55:23 +00:00
|
|
|
* Manually disable AltZP + Aux LC (for code running in main)
|
2022-12-12 01:53:34 +00:00
|
|
|
* Banks ROM in
|
2021-08-16 18:58:05 +00:00
|
|
|
MAINZP MAC
|
2022-12-18 23:42:54 +00:00
|
|
|
STZ SETSTDZP ; Main ZP and LC
|
2022-10-12 04:00:36 +00:00
|
|
|
LDA ROMIN ; Bank ROM back in
|
|
|
|
LDA ROMIN
|
2022-09-19 23:25:51 +00:00
|
|
|
PLP ; Turn IRQ back on
|
2021-08-16 18:58:05 +00:00
|
|
|
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-08-10 01:27:44 +00:00
|
|
|
PUT AUXMEM.MOSEQU
|
|
|
|
PUT AUXMEM.INIT
|
|
|
|
PUT AUXMEM.VDU
|
2022-12-21 05:21:16 +00:00
|
|
|
PUT AUXMEM.HGR
|
2022-12-22 17:19:20 +00:00
|
|
|
PUT AUXMEM.SHR
|
2021-08-10 01:27:44 +00:00
|
|
|
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
|
2022-10-14 04:22:27 +00:00
|
|
|
PUT AUXMEM.AUDIO
|
2021-08-10 01:27:44 +00:00
|
|
|
PUT AUXMEM.MISC
|
2022-10-10 09:23:15 +00:00
|
|
|
PUT MAINMEM.MENU
|
|
|
|
PUT MAINMEM.FSEQU
|
|
|
|
PUT MAINMEM.INIT
|
|
|
|
PUT MAINMEM.SVC
|
2022-12-21 05:21:16 +00:00
|
|
|
PUT MAINMEM.HGR
|
2022-10-10 09:23:15 +00:00
|
|
|
PUT MAINMEM.PATH
|
|
|
|
PUT MAINMEM.WILD
|
|
|
|
PUT MAINMEM.LISTS
|
|
|
|
PUT MAINMEM.MISC
|
2022-10-14 04:22:27 +00:00
|
|
|
PUT MAINMEM.AUDIO
|
2022-11-18 00:31:29 +00:00
|
|
|
PUT MAINMEM.ENSQ
|
2022-11-18 00:38:21 +00:00
|
|
|
PUT MAINMEM.ENSQFREQ
|
|
|
|
PUT MAINMEM.MOCK
|
2022-11-19 03:43:24 +00:00
|
|
|
PUT MAINMEM.MOCKFREQ
|
2022-12-21 04:21:37 +00:00
|
|
|
PUT MAINMEM.FONT8
|
2021-08-10 01:27:44 +00:00
|
|
|
|
2021-08-30 23:08:22 +00:00
|
|
|
* Automatically save the object file:
|
2022-10-07 03:09:29 +00:00
|
|
|
SAV APLCORN.SYSTEM
|
2021-08-26 21:36:46 +00:00
|
|
|
|
2021-09-07 03:43:42 +00:00
|
|
|
|