mirror of
https://github.com/bobbimanners/Applecorn.git
synced 2025-01-14 03:31:12 +00:00
Label-ize absolute references to Apple II I/O locations.
Fix a typo-ed reference to CLRALTCHAR to correct location.
This commit is contained in:
parent
03e263dd5b
commit
8f83ea188e
83
applecorn.s
83
applecorn.s
@ -34,8 +34,12 @@ A4H EQU $43
|
||||
STRTL EQU $3ED
|
||||
STRTH EQU $3EE
|
||||
|
||||
* Apple II BREAK vector
|
||||
BREAKV EQU $3F0
|
||||
|
||||
* Reset vector (2 bytes + 1 byte checksum)
|
||||
RSTV EQU $3F2
|
||||
PWRDUP EQU $3F4
|
||||
|
||||
* IRQ vector
|
||||
A2IRQV EQU $3FE
|
||||
@ -66,6 +70,55 @@ P8BMAP282F EQU $BF5D
|
||||
P8BMAP3037 EQU $BF5E
|
||||
P8BMAP383F EQU $BF5F
|
||||
|
||||
*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
|
||||
|
||||
KBDSTRB EQU $C010
|
||||
RDVBL EQU $C019
|
||||
RD80VID EQU $C01F
|
||||
|
||||
TBCOLOR EQU $C022 ; GS-specific, used but commented out
|
||||
|
||||
SPKR EQU $C030
|
||||
CLOCKCTL EQU $C034 ; GS-specific, Clock control register
|
||||
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
|
||||
|
||||
|
||||
* IO Buffer for reading file (1024 bytes)
|
||||
IOBUF0 EQU $0C00 ; For loading/saving, OSFILE, *.
|
||||
IOBUF1 EQU $1000 ; Four open files for langs
|
||||
@ -88,7 +141,7 @@ FDRAWADDR EQU $9400
|
||||
FONTADDR EQU $A900
|
||||
|
||||
* Address in aux memory where ROM will be loaded
|
||||
AUXADDR EQU $8000
|
||||
ROMAUXADDR EQU $8000
|
||||
|
||||
* Address in aux memory where the MOS shim is located
|
||||
AUXMOS1 EQU $2000 ; Temp staging area in Aux
|
||||
@ -99,8 +152,8 @@ AUXMOS EQU $D000 ; Final location in aux LC
|
||||
* routine in aux memory
|
||||
XF2AUX MAC
|
||||
SEI ; Disable IRQ before XFER
|
||||
LDX $C08B ; R/W LC RAM, bank 1
|
||||
LDX $C08B
|
||||
LDX LCBANK1 ; R/W LC RAM, bank 1
|
||||
LDX LCBANK1
|
||||
LDX #<]1
|
||||
STX STRTL
|
||||
LDX #>]1
|
||||
@ -146,8 +199,8 @@ ENTAUX MAC
|
||||
* Careful: This enables IRQ - not for use in ISR
|
||||
ENTMAIN MAC
|
||||
TXS ; Main SP already in X
|
||||
LDX $C081 ; Bank in ROM
|
||||
LDX $C081
|
||||
LDX ROMIN ; Bank in ROM
|
||||
LDX ROMIN
|
||||
CLI ; Re-enable IRQ after XFER
|
||||
EOM
|
||||
|
||||
@ -166,20 +219,20 @@ IENTAUX MAC
|
||||
* For use in interrupt handlers (no CLI!)
|
||||
IENTMAIN MAC
|
||||
TXS ; Main SP already in X
|
||||
LDX $C081 ; Bank in ROM
|
||||
LDX $C081
|
||||
LDX ROMIN ; Bank in ROM
|
||||
LDX ROMIN
|
||||
EOM
|
||||
|
||||
* Enable writing to main memory (for code running in aux)
|
||||
WRTMAIN MAC
|
||||
PHP
|
||||
SEI ; Keeps IRQ handler easy
|
||||
STA $C004 ; Write to main memory
|
||||
STA WRMAINRAM ; Write to main memory
|
||||
EOM
|
||||
|
||||
* Go back to writing to aux (for code running in aux)
|
||||
WRTAUX MAC
|
||||
STA $C005 ; Write to aux memory
|
||||
STA WRCARDRAM ; Write to aux memory
|
||||
PLP ; Normal service resumed
|
||||
EOM
|
||||
|
||||
@ -187,16 +240,16 @@ WRTAUX MAC
|
||||
ALTZP MAC
|
||||
PHP
|
||||
SEI ; Disable IRQ when AltZP on
|
||||
LDA $C08B ; R/W LC bank 1
|
||||
LDA $C08B
|
||||
STA $C009 ; Alt ZP and LC
|
||||
LDA LCBANK1 ; R/W LC bank 1
|
||||
LDA LCBANK1
|
||||
STA SETALTZP ; 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
|
||||
STA SETSTDZP ; Main ZP and LC
|
||||
LDA ROMIN ; Bank ROM back in
|
||||
LDA ROMIN
|
||||
PLP ; Turn IRQ back on
|
||||
EOM
|
||||
|
||||
|
@ -344,12 +344,13 @@ WORD05IO LDA OSINTWS+0 ; X CORRUPTED BY XF2MAIN
|
||||
WORD05IO1 >>> XF2MAIN,MAINRDMEM
|
||||
|
||||
* <8000xxxx language memory
|
||||
* ????xxxx main memory RAM paged in via STA $C002
|
||||
* ????xxxx MAIN RAM is activated by writing to RDMAINRAM ($C002)
|
||||
* AUX RAM us activated by writing to RDCARDRAM ($C003)
|
||||
* ????xxxx main memory ROM paged in via XFER
|
||||
|
||||
STA $C002 ; Switch to main memory
|
||||
STA RDMAINRAM ; Switch to main memory
|
||||
WORD05A LDA (OSINTWS) ; Get byte
|
||||
STA $C003 ; Back to aux memory
|
||||
STA RDCARDRAM ; Back to aux memory
|
||||
STA (OSCTRL),Y ; Store it
|
||||
RTS
|
||||
|
||||
|
@ -105,7 +105,7 @@ KBDINIT LDX #DEFBYTEEND-DEFBYTE-1
|
||||
BIT SETV
|
||||
JSR KBDTEST
|
||||
BCS :KBDINITOK ; Return default MODE=0
|
||||
STA $C010 ; Ack. keypress
|
||||
STA KBDSTRB ; Ack. keypress
|
||||
TAX ; Use keypress as default MODE
|
||||
:KBDINITOK TXA
|
||||
RTS
|
||||
@ -169,11 +169,11 @@ INKEY5 DEX
|
||||
INKEY6 PHY
|
||||
*
|
||||
* VBLK pulses at 50Hz/60Hz, toggles at 100Hz/120Hz
|
||||
LDX $C019 ; Get initial VBLK state
|
||||
INKEY8 BIT $C000
|
||||
LDX RDVBL ; Get initial VBLK state
|
||||
INKEY8 BIT KEYBOARD
|
||||
BMI INKEY4 ; Key pressed
|
||||
TXA
|
||||
EOR $C019
|
||||
EOR RDVBL
|
||||
BPL INKEY8 ; Wait for VBLK change
|
||||
BMI INKEYLP ; Loop back to key test
|
||||
|
||||
@ -364,15 +364,15 @@ KEYCOPY LDA FXTABCHAR ; Prepare TAB if no copy cursor
|
||||
* Cursors -> $CC-$CF
|
||||
*
|
||||
KBDREAD CLV ; VC=return keypress
|
||||
KBDTEST LDA $C000 ; VS here to test for keypress
|
||||
KBDTEST LDA KEYBOARD ; VS here to test for keypress
|
||||
EOR #$80 ; Toggle bit 7
|
||||
CMP #$80
|
||||
BCS KBDDONE ; No key pressed
|
||||
BVS KBDDONE ; VS=test for keypress
|
||||
STA $C010 ; Ack. keypress
|
||||
BIT $C061
|
||||
STA KBDSTRB ; Ack. keypress
|
||||
BIT BUTTON0
|
||||
BMI KBDLALT ; Left Apple pressed
|
||||
BIT $C062
|
||||
BIT BUTTON1
|
||||
BMI KBDRALT ; Right Apple pressed
|
||||
CMP #$09
|
||||
BEQ KBDTAB ; TAB is dual action TAB/COPY
|
||||
@ -398,10 +398,10 @@ KBDLALT CMP #$40 ; Left Apple key pressed
|
||||
BCS KBDCHKESC ; >'9'
|
||||
KBDFUNC AND #$0F ; Convert Apple-Num to function key
|
||||
ORA #$80
|
||||
BIT $C062
|
||||
BIT BUTTON1
|
||||
BPL KBDCHKESC ; Left+Digit -> $8x
|
||||
ORA #$90 ; Right+Digit -> $9x
|
||||
BIT $C061
|
||||
BIT BUTTON0
|
||||
BPL KBDCHKESC
|
||||
EOR #$30 ; Left+Right+Digit -> $Ax
|
||||
BRA KBDCHKESC
|
||||
|
@ -32,11 +32,11 @@ MOSINIT SEI ; Disable IRQ while initializing
|
||||
LDX #$FF ; Initialize Alt SP to $1FF
|
||||
TXS
|
||||
|
||||
STA $C005 ; Make sure we are writing aux
|
||||
STA $C000 ; Make sure 80STORE is off
|
||||
STA WRCARDRAM ; Make sure we are writing aux
|
||||
STA 80STOREOFF ; Make sure 80STORE is off
|
||||
|
||||
LDA $C08B ; LC RAM Rd/Wt, 1st 4K bank
|
||||
LDA $C08B
|
||||
LDA LCBANK1 ; LC RAM Rd/Wt, 1st 4K bank
|
||||
LDA LCBANK1
|
||||
|
||||
:MODBRA BRA :RELOC ; NOPped out on first run
|
||||
BRA :NORELOC
|
||||
@ -104,9 +104,9 @@ MOSINIT SEI ; Disable IRQ while initializing
|
||||
:S7 BRA :L2
|
||||
|
||||
:NORELOC
|
||||
:S8 STA $C00D ; 80 col on
|
||||
STA $C003 ; Alt charset off
|
||||
STA $C055 ; PAGE2
|
||||
:S8 STA SET80VID ; 80 col on
|
||||
STA CLRALTCHAR ; Alt charset off (?)
|
||||
STA PAGE2 ; PAGE2
|
||||
JMP MOSHIGH ; Ensure executing in high memory here
|
||||
|
||||
MOSHIGH SEI ; Disable IRQ while initializing
|
||||
@ -126,7 +126,7 @@ MOSHIGH SEI ; Disable IRQ while initializing
|
||||
DEX
|
||||
BPL :INITPG2
|
||||
|
||||
LDA $C036 ; GS speed register
|
||||
LDA CYAREG ; GS speed register
|
||||
AND #$80 ; Speed bit only
|
||||
STA GSSPEED ; In Alt LC for IRQ/BRK hdlr
|
||||
|
||||
@ -157,7 +157,7 @@ BYTE8E PHP ; Save CLC=RESET, SEC=Not RESET
|
||||
JSR OSNEWL
|
||||
PLP ; Get entry type back
|
||||
LDA #$01
|
||||
JMP AUXADDR
|
||||
JMP ROMAUXADDR
|
||||
|
||||
* OSBYTE $8F - Issue service call
|
||||
* X=service call, Y=parameter
|
||||
|
@ -35,7 +35,7 @@ ADVALBUF INX
|
||||
BEQ :ADVALOK ; Serial input, return 0
|
||||
LDX #$01 ; For outputs, return 1 char free
|
||||
RTS
|
||||
:ADVALKBD BIT $C000 ; Test keyboard data/strobe
|
||||
:ADVALKBD BIT KEYBOARD ; Test keyboard data/strobe
|
||||
BPL :ADVALOK ; No Strobe, return 0
|
||||
INX ; Strobe, return 1
|
||||
:ADVALOK RTS
|
||||
@ -73,7 +73,7 @@ BEEP PHA
|
||||
BNE :L2 ; 3cy/2cy (BEEPX-1) * 3cy + 1 * 2cy
|
||||
*------------------------------------------------------
|
||||
* BEEPX*5-1cy
|
||||
LDA $C030 ; 4cy BEEPX*5+5
|
||||
LDA SPKR ; 4cy BEEPX*5+5
|
||||
DEY ; 2cy BEEPX*5+7
|
||||
BNE :L1 ; 3cy/2cy BEEPX*5+10
|
||||
PLY ;
|
||||
@ -361,9 +361,9 @@ EVENT RTS
|
||||
|
||||
* Initialize ROMTAB according to user selection in menu
|
||||
ROMINIT STZ MAXROM ; One sideways ROM only
|
||||
STA $C002 ; Read main mem
|
||||
STA RDMAINRAM ; Read main mem
|
||||
LDA USERSEL ; *TO DO* Should be actual number of ROMs
|
||||
STA $C003 ; Read aux mem
|
||||
STA RDCARDRAM ; Read aux mem
|
||||
|
||||
CMP #6
|
||||
BNE :X1
|
||||
@ -387,9 +387,9 @@ GSBRKAUX >>> IENTAUX ; IENTAUX does not do CLI
|
||||
IRQBRKHDLR PHA
|
||||
* Mustn't enable IRQs within the IRQ handler
|
||||
* Do not use WRTMAIN/WRTAUX macros
|
||||
STA $C004 ; Write to main memory
|
||||
STA WRMAINRAM ; Write to main memory
|
||||
STA $45 ; $45=A for ProDOS IRQ handlers
|
||||
STA $C005 ; Write to aux memory
|
||||
STA WRCARDRAM ; Write to aux memory
|
||||
|
||||
TXA
|
||||
PHA
|
||||
|
@ -735,7 +735,7 @@ EXECNOTFND JMP ERRNOTFND ; File not found
|
||||
* --------------------
|
||||
* Turn Apple II accelerators on
|
||||
CMDFAST LDA #$80 ; Apple IIgs
|
||||
TSB $C036
|
||||
TSB CYAREG
|
||||
STA GSSPEED
|
||||
JSR ZIPUNLOCK ; ZipChip
|
||||
JSR ZIPDETECT
|
||||
@ -749,7 +749,7 @@ CMDFAST LDA #$80 ; Apple IIgs
|
||||
* --------------------
|
||||
* Turn Apple II accelerators off
|
||||
CMDSLOW LDA #$80 ; Apple IIgs
|
||||
TRB $C036
|
||||
TRB CYAREG
|
||||
STZ GSSPEED
|
||||
JSR ZIPUNLOCK ; ZipChip
|
||||
JSR ZIPDETECT
|
||||
|
74
auxmem.vdu.s
74
auxmem.vdu.s
@ -321,7 +321,7 @@ VDU127 JSR VDU08 ; Move cursor back
|
||||
|
||||
* Display character at current (TEXTX,TEXTY)
|
||||
PRCHRC PHA ; Save character
|
||||
LDA $C000
|
||||
LDA KEYBOARD
|
||||
BPL :RESUME ; No key pressed
|
||||
EOR #$80
|
||||
:PAUSE1 JSR KBDCHKESC ; Ask KBD to test if Escape
|
||||
@ -329,8 +329,8 @@ PRCHRC PHA ; Save character
|
||||
BMI :RESUMEACK ; Escape, skip pausing
|
||||
CMP #$13
|
||||
BNE :RESUME ; Not Ctrl-S
|
||||
STA $C010 ; Ack. keypress
|
||||
:PAUSE2 LDA $C000
|
||||
STA KBDSTRB ; Ack. keypress
|
||||
:PAUSE2 LDA KEYBOARD
|
||||
BPL :PAUSE2 ; Loop until keypress
|
||||
EOR #$80
|
||||
CMP #$11 ; Ctrl-Q
|
||||
@ -338,7 +338,7 @@ PRCHRC PHA ; Save character
|
||||
JSR KBDCHKESC ; Ask KBD to test if Escape
|
||||
BIT ESCFLAG
|
||||
BPL :PAUSE2 ; No Escape, keep pausing
|
||||
:RESUMEACK STA $C010 ; Ack. keypress
|
||||
:RESUMEACK STA KBDSTRB ; Ack. keypress
|
||||
:RESUME PLA
|
||||
|
||||
* Put character to screen
|
||||
@ -385,9 +385,9 @@ GETCHRC JSR CHARADDR ; Find character address
|
||||
BIT VDUBANK
|
||||
BMI GETCHRGS
|
||||
BCC GETCHR6 ; Aux memory
|
||||
STA $C002 ; Read main memory
|
||||
STA RDMAINRAM ; Read main memory
|
||||
GETCHR6 LDA (VDUADDR),Y ; Get character
|
||||
STA $C003 ; Read aux memory
|
||||
STA RDCARDRAM ; Read aux memory
|
||||
TAY ; Convert character
|
||||
AND #$A0
|
||||
BNE GETCHR7
|
||||
@ -400,9 +400,9 @@ GETCHR7 TYA
|
||||
TAX ; X=char
|
||||
GETCHROK RTS
|
||||
GETCHRGS BCC GETCHR8 ; Aux memory
|
||||
STA $C002 ; Read main memory
|
||||
STA RDMAINRAM ; Read main memory
|
||||
GETCHR8 LDA [VDUADDR],Y ; Get character
|
||||
STA $C003 ; Read aux memory
|
||||
STA RDCARDRAM ; Read aux memory
|
||||
TAY ; Convert character
|
||||
AND #$A0
|
||||
BNE GETCHR9
|
||||
@ -433,7 +433,7 @@ CHARADDRY ASL
|
||||
LDA SCNTAB+1,Y ; MSB of row address
|
||||
STA VDUADDR+1
|
||||
LDA VDUTEXTX
|
||||
BIT $C01F
|
||||
BIT RD80VID
|
||||
SEC
|
||||
BPL CHARADDR40 ; 40-col
|
||||
LSR A
|
||||
@ -545,7 +545,7 @@ VDU31 LDY VDUQ+8
|
||||
LDX VDUQ+7
|
||||
CPX #80
|
||||
BCS :DONE
|
||||
BIT $C01F
|
||||
BIT RD80VID
|
||||
BMI :T9A
|
||||
CPX #40
|
||||
BCS :DONE
|
||||
@ -598,15 +598,15 @@ VDU22 LDA VDUQ+8
|
||||
STA CURSORED ; Edit cursor when editing
|
||||
JSR VDU20 ; Default colours
|
||||
JSR VDU26 ; Default windows
|
||||
STA $C052 ; Clear MIXED
|
||||
STA FULLGR ; Clear MIXED mode
|
||||
LDA VDUSCREEN
|
||||
BMI VDU22G ; b7=1, graphics mode
|
||||
AND #$01 ; 40col/80col bit
|
||||
TAX
|
||||
STA $C00C,X ; Select 40col/80col
|
||||
STA $C051 ; Enable Text
|
||||
STA $C055 ; PAGE2
|
||||
STA $C00F ; Enable alt charset
|
||||
STA CLR80VID,X ; Select 40col/80col
|
||||
STA TEXTON ; Enable Text
|
||||
STA PAGE2 ; PAGE2
|
||||
STA SETALTCHAR ; Enable alt charset
|
||||
* Fall through into CLS
|
||||
|
||||
|
||||
@ -638,10 +638,10 @@ VDU12 STZ FXLINES
|
||||
VDU12SOFT JMP VDU16 ; *TEMP*
|
||||
|
||||
VDU22G JSR VDU12 ; Clear text and HGR screen
|
||||
STA $C057 ; Hi-Res
|
||||
STA $C050 ; Enable Graphics
|
||||
STA $C054 ; PAGE1
|
||||
STA $C00C ; Select 40col text
|
||||
STA HIRES ; Hi-Res
|
||||
STA GRON ; Enable Graphics
|
||||
STA PAGE1 ; PAGE1
|
||||
STA CLR80VID ; Select 40col text
|
||||
RTS
|
||||
|
||||
|
||||
@ -650,7 +650,7 @@ CLREOL JSR CHARADDR ; Set VDUADDR=>start of line
|
||||
INC TXTWINRGT
|
||||
BIT VDUBANK
|
||||
BMI CLREOLGS ; AppleGS
|
||||
BIT $C01F
|
||||
BIT RD80VID
|
||||
BPL :FORTY ; 40-col mode
|
||||
:EIGHTY LDX VDUTEXTX ; Addr offset for column
|
||||
:L1 TXA ; Column/2 into Y
|
||||
@ -679,7 +679,7 @@ CLREOLDONE DEC TXTWINRGT
|
||||
BPL :NOHIRES
|
||||
JMP HSCRCLREOL ; Clear an HGR line
|
||||
:NOHIRES RTS
|
||||
CLREOLGS BIT $C01F
|
||||
CLREOLGS BIT RD80VID
|
||||
BPL :FORTY ; 40-col mode
|
||||
:EIGHTY LDX VDUTEXTX ; Addr offset for column
|
||||
:L1 TXA ; Column/2 into Y
|
||||
@ -788,7 +788,7 @@ DOSCR1LINE INC TXTWINRGT
|
||||
BIT VDUBANK
|
||||
BMI SCR1LINEGS ; AppleGS
|
||||
LDX TXTWINLFT ; Addr offset for column
|
||||
BIT $C01F
|
||||
BIT RD80VID
|
||||
BPL :FORTY ; 40-col mode
|
||||
:EIGHTY
|
||||
:L1 TXA ; Column/2 into Y
|
||||
@ -799,10 +799,10 @@ DOSCR1LINE INC TXTWINRGT
|
||||
STA (VDUADDR2),Y
|
||||
BRA :SKIPMAIN
|
||||
:MAIN >>> WRTMAIN
|
||||
STA $C002 ; Read main memory
|
||||
STA RDMAINRAM ; Read main memory
|
||||
LDA (VDUADDR),Y
|
||||
STA (VDUADDR2),Y
|
||||
STA $C003 ; Read aux memory
|
||||
STA RDCARDRAM ; Read aux memory
|
||||
>>> WRTAUX
|
||||
:SKIPMAIN INX
|
||||
CPX TXTWINRGT
|
||||
@ -811,10 +811,10 @@ DOSCR1LINE INC TXTWINRGT
|
||||
:FORTY TXA
|
||||
TAY
|
||||
:L2 >>> WRTMAIN
|
||||
STA $C002 ; Read main memory
|
||||
STA RDMAINRAM ; Read main memory
|
||||
LDA (VDUADDR),Y
|
||||
STA (VDUADDR2),Y
|
||||
STA $C003 ; Read aux memory
|
||||
STA RDCARDRAM ; Read aux memory
|
||||
>>> WRTAUX
|
||||
INY
|
||||
CPY TXTWINRGT
|
||||
@ -823,7 +823,7 @@ SCR1LNDONE DEC TXTWINRGT
|
||||
PLA
|
||||
RTS
|
||||
SCR1LINEGS LDX TXTWINLFT
|
||||
BIT $C01F
|
||||
BIT RD80VID
|
||||
BPL :FORTY ; 40-col mode
|
||||
:EIGHTY
|
||||
:L1 TXA ; Column/2 into Y
|
||||
@ -834,20 +834,20 @@ SCR1LINEGS LDX TXTWINLFT
|
||||
STA VDUBANK
|
||||
STA VDUBANK2
|
||||
>>> WRTMAIN
|
||||
STA $C002 ; Read main memory
|
||||
STA RDMAINRAM ; Read main memory
|
||||
LDA [VDUADDR],Y ; Even cols in bank $E1
|
||||
STA [VDUADDR2],Y
|
||||
STA $C003 ; Read aux memory
|
||||
STA RDCARDRAM ; Read aux memory
|
||||
>>> WRTAUX
|
||||
BRA :SKIPE0
|
||||
:E0 LDA #$E0
|
||||
STA VDUBANK
|
||||
STA VDUBANK2
|
||||
>>> WRTMAIN
|
||||
STA $C002 ; Read main memory
|
||||
STA RDMAINRAM ; Read main memory
|
||||
LDA [VDUADDR],Y ; Odd cols in bank $E0
|
||||
STA [VDUADDR2],Y
|
||||
STA $C003 ; Read aux memory
|
||||
STA RDCARDRAM ; Read aux memory
|
||||
>>> WRTAUX
|
||||
:SKIPE0 INX
|
||||
CPX TXTWINRGT
|
||||
@ -858,10 +858,10 @@ SCR1LINEGS LDX TXTWINLFT
|
||||
LDA #$E0
|
||||
STA VDUBANK
|
||||
:L2 >>> WRTMAIN
|
||||
STA $C002 ; Read main memory
|
||||
STA RDMAINRAM ; Read main memory
|
||||
LDA [VDUADDR],Y
|
||||
STA [VDUADDR2],Y
|
||||
STA $C003 ; Read aux memory
|
||||
STA RDCARDRAM ; Read aux memory
|
||||
>>> WRTAUX
|
||||
INY
|
||||
CPY TXTWINRGT
|
||||
@ -884,14 +884,14 @@ VDU16 JMP HSCRCLEAR
|
||||
VDU20
|
||||
* THE FOLLOWING TWO LINES ARE FOR GS ONLY & NOT SAFE ON //c
|
||||
* LDA #$F0
|
||||
* STA $C022 ; Set text palette
|
||||
* STA TBCOLOR ; Set text palette
|
||||
LDX #VDUCOLEND-TXTFGD
|
||||
LDA #$00
|
||||
VDU20LP STA TXTFGD,X ; Clear all colours
|
||||
DEX ; and gcol actions
|
||||
BPL VDU20LP
|
||||
* THE FOLLOWING LINE IS FOR GS ONLY & NOT SAFE ON //c
|
||||
* STA $C034 ; Set border
|
||||
* STA CLOCKCTL ; Set border
|
||||
LDA #$80
|
||||
JSR HSCRSETTCOL ; Set txt background
|
||||
LDX #$00
|
||||
@ -917,7 +917,7 @@ VDU17BORDER AND #$0F
|
||||
STA VDUBORDER
|
||||
TAX
|
||||
LDA CLRTRANS16,X
|
||||
STA $C034
|
||||
STA CLOCKCTL
|
||||
RTS
|
||||
|
||||
* VDU 18 - GCOL k,a - select graphics colour and plot action
|
||||
@ -1091,7 +1091,7 @@ VDU25BACKUP2 LDA GFXPOSNX,X ; POSN becomes LAST
|
||||
LDA VDUPIXELS
|
||||
BEQ :S2
|
||||
JSR HGRPLOTTER
|
||||
:S2 LDA $C000 ; This and PRCHRC need to be
|
||||
:S2 LDA KEYBOARD ; This and PRCHRC need to be
|
||||
EOR #$80 ; made more generalised
|
||||
BMI VDU25EXIT ; No key pressed
|
||||
JSR KBDCHKESC ; Ask KBD to test if Escape
|
||||
|
@ -92,13 +92,13 @@ GSBRK >>> XF2AUX,GSBRKAUX
|
||||
*:S1 RTS
|
||||
*
|
||||
* Reset handler - invoked on Ctrl-Reset
|
||||
* XFER to AUXMOS ($C000) in aux, AuxZP on, LC on
|
||||
* XFER to AUXMOS ($D000) in aux, AuxZP on, LC on
|
||||
RESET TSX
|
||||
STX $0100
|
||||
LDA $C058 ; AN0 off
|
||||
LDA $C05A ; AN1 off
|
||||
LDA $C05D ; AN2 on
|
||||
LDA $C05F ; AN3 on
|
||||
LDA AN0OFF ; AN0 off
|
||||
LDA AN1OFF ; AN1 off
|
||||
LDA AN2ON ; AN2 on
|
||||
LDA AN3ON ; AN3 on
|
||||
>>> XF2AUX,AUXMOS
|
||||
RTS
|
||||
|
||||
|
157
mainmem.ldr.s
157
mainmem.ldr.s
@ -71,7 +71,7 @@ RTSINST LDA CMDPATH
|
||||
CMP #'/'
|
||||
BEQ DISCONN ; CMDPATH already absolute path
|
||||
:GETPFX JSR MLI
|
||||
DB $C7 ; Get Prefix
|
||||
DB GPFXCMD ; Get Prefix
|
||||
DW GETPFXPARM
|
||||
|
||||
* Disconnect /RAM ramdrive to avoid aux corruption
|
||||
@ -154,12 +154,12 @@ DISCONN LDA MACHID
|
||||
LDA #>RESET
|
||||
STA RSTV+1
|
||||
EOR #$A5 ; Checksum
|
||||
STA RSTV+2
|
||||
STA PWRDUP
|
||||
|
||||
LDA #<GSBRK ; Set BRK vector in main mem
|
||||
STA $3F0
|
||||
LDA #<GSBRK ; Set BREAK vector in main mem
|
||||
STA BREAKV
|
||||
LDA #>GSBRK
|
||||
STA $3F0+1
|
||||
STA BREAKV+1
|
||||
|
||||
JSR GFXINIT ; Initialize FDraw graphics
|
||||
|
||||
@ -184,14 +184,14 @@ UNSUPLP LDA UNSUPMSG,X
|
||||
JSR COUT1
|
||||
INX
|
||||
BNE UNSUPLP
|
||||
UNSUPWAIT STA $C010
|
||||
UNSUPKEY LDA $C000
|
||||
UNSUPWAIT STA KBDSTRB
|
||||
UNSUPKEY LDA KEYBOARD
|
||||
BPL UNSUPKEY
|
||||
STA $C010
|
||||
STA KBDSTRB
|
||||
|
||||
JSR MLI
|
||||
DB QUITCMD
|
||||
DW UNSUPQPARM
|
||||
DB QUITCMD
|
||||
DW UNSUPQPARM
|
||||
UNSUPQPARM DB $04,$00,$00,$00,$00,$00,$00
|
||||
|
||||
UNSUPMSG ASC "APPLECORN REQUIRES AN APPLE IIGS, APPLE", 8D
|
||||
@ -200,140 +200,3 @@ UNSUPMSG ASC "APPLECORN REQUIRES AN APPLE IIGS, APPLE", 8D
|
||||
ASC "PRESS ANY KEY TO QUIT TO PRODOS", 00
|
||||
|
||||
ENDSYSTEM
|
||||
|
||||
; Original APPLECORN.BIN code started here
|
||||
|
||||
*START
|
||||
* LDA #>AUXADDR ; Address in aux
|
||||
* LDX #<AUXADDR
|
||||
* SEC ; Load into aux
|
||||
* JSR LOADCODE ; Load lang ROM
|
||||
*
|
||||
* JSR GFXINIT ; Initialize FDraw graphics
|
||||
*
|
||||
* TSX ; Save SP at $0100 in aux
|
||||
* >>> ALTZP
|
||||
* STX $0100
|
||||
* >>> MAINZP
|
||||
* >>> XF2AUX,AUXMOS1
|
||||
*
|
||||
* Load image from file into memory
|
||||
* On entry: OPENPL set up to point to leafname of file to load
|
||||
* Loads file from directory applecorn started from
|
||||
* Uses BLKBUF at loading buffer
|
||||
* Load address in A,X
|
||||
* Carry set->load to aux, carry clear->load to main
|
||||
*LOADCODE PHP ; Save carry flag
|
||||
* STA :ADDRH ; MSB of load address
|
||||
* STX :ADDRL ; LSB of load address
|
||||
* STZ :BLOCKS
|
||||
*
|
||||
* LDX #0
|
||||
*:LP1 LDA CMDPATH+1,X ; Copy Applecorn path to MOSFILE
|
||||
* STA MOSFILE2+1,X
|
||||
* INX
|
||||
* CPX CMDPATH
|
||||
* BCC :LP1
|
||||
*:LP2 DEX
|
||||
* LDA MOSFILE2+1,X
|
||||
* CMP #'/'
|
||||
* BNE :LP2
|
||||
* LDA OPENPL+1
|
||||
* STA A1L
|
||||
* LDA OPENPL+2
|
||||
* STA A1H
|
||||
* LDY #1
|
||||
* LDA (A1L),Y
|
||||
* CMP #'/'
|
||||
* BEQ :L4 ; Already absolute path
|
||||
*:LP3 LDA (A1L),Y
|
||||
* STA MOSFILE2+2,X
|
||||
* INX
|
||||
* INY
|
||||
* TYA
|
||||
* CMP (A1L)
|
||||
* BCC :LP3
|
||||
* BEQ :LP3
|
||||
* INX
|
||||
* STX MOSFILE2+0
|
||||
* LDA #<MOSFILE2 ; Point to absolute path
|
||||
* STA OPENPL+1
|
||||
* LDA #>MOSFILE2
|
||||
* STA OPENPL+2
|
||||
*
|
||||
*:L4 JSR OPENFILE ; Open ROM file
|
||||
* BCC :S1
|
||||
* PLP
|
||||
* BCC :L1A ; Load to main, report error
|
||||
* RTS ; Load to aux, return CS=Failed
|
||||
*:L1A LDX #$00
|
||||
*:L1B LDA :CANTOPEN,X ; Part one of error msg
|
||||
* BEQ :S0
|
||||
* JSR COUT1
|
||||
* INX
|
||||
* BRA :L1B
|
||||
*:S0 LDA OPENPL+1 ; Print filename
|
||||
* STA A1L
|
||||
* LDA OPENPL+2
|
||||
* STA A1H
|
||||
* LDY #$00
|
||||
* LDA (A1L),Y
|
||||
* STA :LEN
|
||||
*:L1C CPY :LEN
|
||||
* BEQ :ERR1
|
||||
* INY
|
||||
* LDA (A1L),Y
|
||||
* JSR COUT1
|
||||
* BRA :L1C
|
||||
*:ERR1 JSR CROUT
|
||||
* JSR BELL
|
||||
*:SPIN BRA :SPIN
|
||||
*:S1 LDA OPENPL+5 ; File reference number
|
||||
* STA READPL+1
|
||||
*:L2 PLP
|
||||
* PHP
|
||||
* BCS :L2A ; Loading to aux, skip dots
|
||||
* LDA #'.'+$80 ; Print progress dots
|
||||
* JSR COUT1
|
||||
*:L2A JSR RDFILE ; Read file block by block
|
||||
* BCS :CLOSE ; EOF (0 bytes left) or some error
|
||||
* LDA #<BLKBUF ; Source start addr -> A1L,A1H
|
||||
* STA A1L
|
||||
* LDA #>BLKBUF
|
||||
* STA A1H
|
||||
* LDA #<BLKBUFEND ; Source end addr -> A2L,A2H
|
||||
* STA A2L
|
||||
* LDA #>BLKBUFEND
|
||||
* STA A2H
|
||||
* LDA :ADDRL ; Dest in aux -> A4L, A4H
|
||||
* STA A4L
|
||||
* LDA :ADDRH
|
||||
* LDX :BLOCKS
|
||||
*:L3 CPX #$00
|
||||
* BEQ :S2
|
||||
* INC
|
||||
* INC
|
||||
* DEX
|
||||
* BRA :L3
|
||||
*:S2 STA A4H
|
||||
* PLP ; Recover carry flag
|
||||
* PHP
|
||||
* BCS :TOAUX
|
||||
* JSR MEMCPY ; Destination in main mem
|
||||
* BRA :S3
|
||||
*:TOAUX JSR AUXMOVE ; Carry already set (so to aux)
|
||||
*:S3 INC :BLOCKS
|
||||
* BRA :L2
|
||||
*:CLOSE LDA OPENPL+5 ; File reference number
|
||||
* STA CLSPL+1
|
||||
* JSR CLSFILE
|
||||
* JSR CROUT
|
||||
* PLP
|
||||
* CLC ; CC=Ok
|
||||
* RTS
|
||||
*:ADDRL DB $00 ; Destination address (LSB)
|
||||
*:ADDRH DB $00 ; Destination address (MSB)
|
||||
*:BLOCKS DB $00 ; Counter for blocks read
|
||||
*:LEN DB $00 ; Length of filename
|
||||
*:CANTOPEN ASC "Unable to open "
|
||||
* DB $00
|
||||
|
@ -20,9 +20,9 @@ ROMMENU JSR HOME ; Clear screen
|
||||
BNE :LP0
|
||||
:LP1
|
||||
|
||||
:KEYIN LDA $C000 ; Kdb data / strobe
|
||||
:KEYIN LDA KEYBOARD ; Kdb data / strobe
|
||||
BPL :KEYIN ; Wait for keystroke
|
||||
STA $C010 ; Clear strobe
|
||||
STA KBDSTRB ; Clear strobe
|
||||
AND #$7F
|
||||
SEC
|
||||
SBC #'1' ; '1'->0, '2'->1 etc.
|
||||
|
@ -27,14 +27,14 @@ MEMCPY LDA (A1L)
|
||||
* Copy 512 bytes from BLKBUF to AUXBLK in aux LC
|
||||
COPYAUXBLK >>> ALTZP ; Alt ZP & Alt LC on
|
||||
LDY #$00
|
||||
STA $C005 ; Write aux mem
|
||||
STA WRCARDRAM ; Write aux mem
|
||||
:L1 LDA BLKBUF+$000,Y
|
||||
STA AUXBLK+$000,Y
|
||||
LDA BLKBUF+$100,Y
|
||||
STA AUXBLK+$100,Y
|
||||
INY
|
||||
BNE :L1
|
||||
STA $C004 ; Write main mem
|
||||
STA WRMAINRAM ; Write main mem
|
||||
:S2 >>> MAINZP ; Alt ZP off, ROM back in
|
||||
RTSINSTR RTS
|
||||
|
||||
@ -98,12 +98,12 @@ EXISTS LDA #<MOSFILE
|
||||
* Preserves A
|
||||
COPYFB PHA
|
||||
LDX #$11 ; 18 bytes in FILEBLK
|
||||
STA $C005 ; Write to aux mem
|
||||
STA WRCARDRAM ; Write to aux mem
|
||||
:L1 LDA FILEBLK,X
|
||||
STA OSFILECB,X
|
||||
DEX
|
||||
BPL :L1
|
||||
STA $C004 ; Write to main mem again
|
||||
STA WRMAINRAM ; Write to main mem again
|
||||
PLA
|
||||
RTS
|
||||
|
||||
|
@ -359,9 +359,9 @@ GBPB >>> ENTMAIN
|
||||
LDA GBPBDAT+1
|
||||
STA ZPMOS+1
|
||||
LDA BLKBUF
|
||||
STA $C005 ; Write to aux
|
||||
STA WRCARDRAM ; Write to aux
|
||||
STA (ZPMOS) ; Store byte in aux mem
|
||||
STA $C004 ; Write to main again
|
||||
STA WRMAINRAM ; Write to main again
|
||||
BRA :UPDCB
|
||||
:WRITE LDA #<BLKBUF ; Start of destination
|
||||
STA A4L
|
||||
@ -400,7 +400,7 @@ GBPB >>> ENTMAIN
|
||||
:ERR
|
||||
:ZERO PLA ; Throw away A
|
||||
>>> ALTZP ; Control block can be in ZP!
|
||||
STA $C005 ; Write to aux
|
||||
STA WRCARDRAM ; Write to aux
|
||||
LDA GBPBAUXCB+0 ; Copy control block back to aux
|
||||
STA $B0+0 ; $B0 in AltZP is temp FS workspace
|
||||
LDA GBPBAUXCB+1
|
||||
@ -410,7 +410,7 @@ GBPB >>> ENTMAIN
|
||||
STA ($B0),Y
|
||||
DEY
|
||||
BPL :L2
|
||||
STA $C004 ; Write to main again
|
||||
STA WRMAINRAM ; Write to main again
|
||||
>>> MAINZP
|
||||
>>> XF2AUX,OSGBPBRET
|
||||
|
||||
@ -939,9 +939,9 @@ CHKNOTFND CMP #$44 ; Convert ProDOS 'not found'
|
||||
|
||||
|
||||
* Quit to ProDOS
|
||||
QUIT INC $03F4 ; Invalidate powerup byte
|
||||
STA $C054 ; PAGE2 off
|
||||
STA $C00E ; Alt font off
|
||||
QUIT INC PWRDUP ; Invalidate powerup byte
|
||||
STA PAGE1 ; PAGE2 off
|
||||
STA CLRALTCHAR ; Alt font off
|
||||
JSR MLI
|
||||
DB QUITCMD
|
||||
DW QUITPL
|
||||
@ -1196,8 +1196,8 @@ MULTIDEL >>> ENTMAIN
|
||||
|
||||
|
||||
* Read machid from auxmem
|
||||
MACHRD LDA $C081
|
||||
LDA $C081
|
||||
MACHRD LDA ROMIN
|
||||
LDA ROMIN
|
||||
LDA $FBC0
|
||||
SEC
|
||||
JSR $FE1F
|
||||
@ -1206,8 +1206,8 @@ MACHRD LDA $C081
|
||||
* Read mainmem from auxmem
|
||||
MAINRDMEM STA A1L
|
||||
STY A1H
|
||||
LDA $C081
|
||||
LDA $C081
|
||||
LDA ROMIN
|
||||
LDA ROMIN
|
||||
LDA (A1L)
|
||||
MAINRDEXIT >>> XF2AUX,NULLRTS ; Back to an RTS
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user