mirror of https://github.com/mgcaret/of816.git
GoSXB: stub ROM to launch OF816 at bank
This commit is contained in:
parent
e5cf857866
commit
cf9d37dba8
|
@ -12,4 +12,5 @@ romfs
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.hex
|
*.hex
|
||||||
of816-neon.bin
|
of816-neon.bin
|
||||||
|
platforms/GoSXB/rom
|
||||||
|
|
||||||
|
|
|
@ -13,4 +13,3 @@ SEGMENTS {
|
||||||
FCode: load=ROM, type=ro, optional=yes;
|
FCode: load=ROM, type=ro, optional=yes;
|
||||||
ZEROPAGE: load=ZP, type=bss;
|
ZEROPAGE: load=ZP, type=bss;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,7 @@ set -e -x
|
||||||
ca65 -I ../../inc GoSXB.s -l GoSXB.lst
|
ca65 -I ../../inc GoSXB.s -l GoSXB.lst
|
||||||
../../build.sh GoSXB
|
../../build.sh GoSXB
|
||||||
ld65 -C GoSXB.l -S 0x8000 GoSXB.o ../../forth.o -m forth.map -o forth
|
ld65 -C GoSXB.l -S 0x8000 GoSXB.o ../../forth.o -m forth.map -o forth
|
||||||
ls -l forth
|
ca65 -I ../../inc romboot.s -l romboot.lst
|
||||||
|
ld65 -C romboot.l -S 0x0000 romboot.o -m romboot.map -o rom
|
||||||
|
ls -l rom forth
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ table: .addr _sf_pre_init
|
||||||
|
|
||||||
|
|
||||||
.proc _sf_pre_init
|
.proc _sf_pre_init
|
||||||
.if 1
|
.if 0
|
||||||
plx
|
plx
|
||||||
jmp _sf_success ; assume WDC monitor already did it
|
jmp _sf_success ; assume WDC monitor already did it
|
||||||
.else
|
.else
|
||||||
|
@ -101,25 +101,24 @@ table: .addr _sf_pre_init
|
||||||
.a8
|
.a8
|
||||||
.i8
|
.i8
|
||||||
lda #$00
|
lda #$00
|
||||||
sta VIA2+VIA::ACR
|
sta f:VIA2+VIA::ACR
|
||||||
lda #$00
|
sta f:VIA2+VIA::PCR
|
||||||
sta VIA2+VIA::PCR
|
|
||||||
lda #%00011000 ; b3 = TUSB_RDB; b4 = ???
|
lda #%00011000 ; b3 = TUSB_RDB; b4 = ???
|
||||||
sta VIA2+VIA::ORB
|
sta f:VIA2+VIA::ORB
|
||||||
lda #%00011100 ; set PB2, PB3, PB4 as outputs
|
lda #%00011100 ; set PB2, PB3, PB4 as outputs
|
||||||
sta VIA2+VIA::DDRB
|
sta f:VIA2+VIA::DDRB
|
||||||
lda #$00
|
lda #$00
|
||||||
sta VIA2+VIA::DDRA
|
sta VIA2+VIA::DDRA
|
||||||
lda VIA2+VIA::IRB
|
lda VIA2+VIA::IRB
|
||||||
pha
|
pha
|
||||||
and #%11101111 ; b4 = ???
|
and #%11101111 ; b4 = ???
|
||||||
sta VIA2+VIA::ORB
|
sta f:VIA2+VIA::ORB
|
||||||
ldx #$5d
|
ldx #$5d
|
||||||
jsr wait
|
jsr wait
|
||||||
pla
|
pla
|
||||||
sta VIA2+VIA::ORB
|
sta f:VIA2+VIA::ORB
|
||||||
lda #%00100000 ; b5 = TUSB_PWRENB
|
: lda f:VIA2+VIA::IRB ; wait for USB configuration
|
||||||
: bit VIA2+VIA::IRB ; wait for USB configuration
|
bit #%00100000 ; b5 = TUSB_PWRENB
|
||||||
bne :-
|
bne :-
|
||||||
plp
|
plp
|
||||||
plx
|
plx
|
||||||
|
@ -179,7 +178,7 @@ wait: phx ; note 8-bit mode!
|
||||||
txa
|
txa
|
||||||
sta f:VIA2+VIA::ORB ; strobe FT245RL WR low
|
sta f:VIA2+VIA::ORB ; strobe FT245RL WR low
|
||||||
lda VIA2+VIA::IRA ; get output byte back (we don't really need it)
|
lda VIA2+VIA::IRA ; get output byte back (we don't really need it)
|
||||||
xba
|
xba
|
||||||
lda #$00
|
lda #$00
|
||||||
sta f:VIA2+VIA::DDRA ; switch DDR A back to input
|
sta f:VIA2+VIA::DDRA ; switch DDR A back to input
|
||||||
xba
|
xba
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Note this linker config relies on the fact that bank 3
|
||||||
|
# in the output file has the same lower 16 bit addresses
|
||||||
|
# as the run location. You can't use it to link relative
|
||||||
|
# code into bank 0 or bank 2
|
||||||
|
|
||||||
|
MEMORY {
|
||||||
|
MAINMEM: start = $0000, size=$10000;
|
||||||
|
ROM: start = $000000, size = $020000, fillval=$FF, file = %O;
|
||||||
|
ZP: start = $0000, size = $100;
|
||||||
|
}
|
||||||
|
|
||||||
|
SEGMENTS {
|
||||||
|
ROMBOOT: load=ROM, run=ROM, start=$1FF00, type=ro;
|
||||||
|
VECTORS: load=ROM, run=ROM, start=$1FFE0, type=ro;
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
.p816
|
||||||
|
.a16
|
||||||
|
.i16
|
||||||
|
.include "macros.inc"
|
||||||
|
|
||||||
|
.segment "ROMBOOT"
|
||||||
|
.proc romboot
|
||||||
|
jml f:$200000
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
.proc emuirq
|
||||||
|
pha
|
||||||
|
lda 2,s
|
||||||
|
and #%00100000
|
||||||
|
bne romboot ; if BRK, handle like we reset.
|
||||||
|
pla ; in case we want to RTI or something in the future
|
||||||
|
; fall-through
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
.proc die
|
||||||
|
wdm $FF ; GoSXB will exit
|
||||||
|
hang: bra hang ; Anything else will hang
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
.segment "VECTORS"
|
||||||
|
.proc vectors
|
||||||
|
; native mode vectors
|
||||||
|
.word $FFFF ; FFE0 - reserved
|
||||||
|
.word $FFFF ; FFE2 - reserved
|
||||||
|
.word .loword(die) ; FFE4 - COP
|
||||||
|
.word .loword(romboot) ; FFE6 - BRK
|
||||||
|
.word .loword(die) ; FFE8 - ABORT
|
||||||
|
.word .loword(romboot) ; FFEA - NMI
|
||||||
|
.word $FFFF ; FFEC - reserved
|
||||||
|
.word .loword(die) ; FFEE - IRQ
|
||||||
|
; emulation mode vectors
|
||||||
|
.word $FFFF ; FFF0 - reserved
|
||||||
|
.word $FFFF ; FFF2 - reserved
|
||||||
|
.word .loword(die) ; FFF4 - COP
|
||||||
|
.word $FFFF ; FFF6 - reserved
|
||||||
|
.word .loword(die) ; FFF8 - ABORT
|
||||||
|
.word .loword(romboot) ; FFFA - NMI
|
||||||
|
.word .loword(romboot) ; FFFC - RESET
|
||||||
|
.word .loword(emuirq) ; FFFE - IRQ/BRK
|
||||||
|
.endproc
|
Loading…
Reference in New Issue