Release candidate 4
This commit is contained in:
parent
50816d1499
commit
4df575bd62
Binary file not shown.
BIN
bin/RAM2Eutil.po
BIN
bin/RAM2Eutil.po
Binary file not shown.
|
@ -0,0 +1,98 @@
|
|||
.setcpu "65816"
|
||||
.autoimport on
|
||||
.importzp sp
|
||||
|
||||
.export _gsram_getsize
|
||||
|
||||
.macro A8
|
||||
sep #$20 ; put the 65C816 in 8-bit accumulator mode
|
||||
.A8
|
||||
.endmacro
|
||||
|
||||
.macro I8
|
||||
sep #$10 ; put the 65C816 in 8-bit index register mode
|
||||
.I8
|
||||
.endmacro
|
||||
|
||||
.macro AI8
|
||||
sep #$30 ; put the 65C816 in 8-bit accumulator and index register mode
|
||||
.A8
|
||||
.I8
|
||||
.endmacro
|
||||
|
||||
.macro A16
|
||||
rep #$20 ; put the 65C816 in 8-bit accumulator mode
|
||||
.A16
|
||||
.endmacro
|
||||
|
||||
.macro I16
|
||||
rep #$10 ; put the 65C816 in 8-bit index register mode
|
||||
.I16
|
||||
.endmacro
|
||||
|
||||
.macro AI16
|
||||
rep #$30 ; put the 65C816 in 8-bit accumulator and index register mode
|
||||
.A16
|
||||
.I16
|
||||
.endmacro
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
.proc _gsram_getsize: near
|
||||
.A8
|
||||
.I8
|
||||
; Preamble
|
||||
php ; Push status
|
||||
sei ; Disable interrupts
|
||||
clc ; Clear carry
|
||||
xce ; Clear emulation bit
|
||||
php ; Push status
|
||||
phb ; Push bank
|
||||
AI8
|
||||
|
||||
; Store bank number at address 0xFFFF in each bank
|
||||
ldy #$7F ; Start at bank 0x7F
|
||||
BankSetLoop:
|
||||
phy ; Push future bank
|
||||
plb ; Pull bank
|
||||
lda $8000 ; Get address 0xFFFF in this bank
|
||||
pha ; Save old address 0xFFFF contents
|
||||
tya ; A = Y
|
||||
eor #$FF ; Flip all bits
|
||||
tay ; Y = A
|
||||
sty $8000 ; Overwrite address 0xFFFF with bank number
|
||||
eor #$FF ; Flip all bits back
|
||||
tay ; Y = A
|
||||
dey ; Decrement bank number
|
||||
cpy #$FF ; Have we wrapped around?
|
||||
bne BankSetLoop ; If not, repeat
|
||||
|
||||
; Count banks with matching bank number
|
||||
ldy #$00 ; Y is bank
|
||||
ldx #$00 ; X is count
|
||||
CountLoop:
|
||||
phy ; Push future bank
|
||||
plb ; Pull bank
|
||||
tya ; A = Y
|
||||
eor #$FF ; Flip all bits
|
||||
tay ; Y = A
|
||||
cpy $8000 ; Is bank num stored at address 0xFFFF?
|
||||
bne AfterInc ; If not, skip increment
|
||||
inx ; If so, increment bank count
|
||||
AfterInc:
|
||||
eor #$FF ; Flip all bits back
|
||||
tay ; Y = A
|
||||
pla ; Get contents to restore
|
||||
sta $8000 ; Restore address 0xFFFF in this bank
|
||||
iny ; Move to next bank
|
||||
cpy #$80 ; Are we at bank 0x80 yet?
|
||||
bne CountLoop ; If not, repeat
|
||||
|
||||
; Postamble
|
||||
plb ; Restore bank
|
||||
plp ; Restore status
|
||||
xce ; Restore emulation bit
|
||||
txa ; Transfer bank count to A
|
||||
plp ; Pull status again to pull I flag
|
||||
rts
|
||||
.endproc
|
87
ram2gs_asm.s
87
ram2gs_asm.s
|
@ -40,72 +40,15 @@
|
|||
|
||||
.segment "CODE"
|
||||
|
||||
.proc _gsram_getsize: near
|
||||
.A8
|
||||
.I8
|
||||
; Preamble
|
||||
sei ; Disable interrupts
|
||||
clc ; Clear carry
|
||||
xce ; Clear emulation bit
|
||||
php ; Push status
|
||||
phb ; Push bank
|
||||
AI8
|
||||
|
||||
; Store bank number at address 0xFFFF in each bank
|
||||
ldy #$7F ; Start at bank 0x7F
|
||||
BankSetLoop:
|
||||
phy ; Push future bank
|
||||
plb ; Pull bank
|
||||
lda $8000 ; Get address 0xFFFF in this bank
|
||||
pha ; Save old address 0xFFFF contents
|
||||
tya ; A = Y
|
||||
eor #$FF ; Flip all bits
|
||||
tay ; Y = A
|
||||
sty $8000 ; Overwrite address 0xFFFF with bank number
|
||||
eor #$FF ; Flip all bits back
|
||||
tay ; Y = A
|
||||
dey ; Decrement bank number
|
||||
cpy #$FF ; Have we wrapped around?
|
||||
bne BankSetLoop ; If not, repeat
|
||||
|
||||
; Count banks with matching bank number
|
||||
ldy #$00 ; Y is bank
|
||||
ldx #$00 ; X is count
|
||||
CountLoop:
|
||||
phy ; Push future bank
|
||||
plb ; Pull bank
|
||||
tya ; A = Y
|
||||
eor #$FF ; Flip all bits
|
||||
tay ; Y = A
|
||||
cpy $8000 ; Is bank num stored at address 0xFFFF?
|
||||
bne AfterInc ; If not, skip increment
|
||||
inx ; If so, increment bank count
|
||||
AfterInc:
|
||||
eor #$FF ; Flip all bits back
|
||||
tay ; Y = A
|
||||
pla ; Get contents to restore
|
||||
sta $8000 ; Restore address 0xFFFF in this bank
|
||||
iny ; Move to next bank
|
||||
cpy #$80 ; Are we at bank 0x80 yet?
|
||||
bne CountLoop ; If not, repeat
|
||||
|
||||
; Postamble
|
||||
plb ; Restore bank
|
||||
plp ; Restore status
|
||||
xce ; Restore emulation bit
|
||||
cli ; Enable interrupts
|
||||
txa ; Transfer bank count to A
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _ram2gs_getsize: near
|
||||
.A8
|
||||
.I8
|
||||
; Preamble
|
||||
php ; Push status
|
||||
sei ; Disable interrupts
|
||||
clc ; Clear carry
|
||||
xce ; Clear emulation bit
|
||||
php ; Push status
|
||||
php ; Push status again, reflecting emulation bit
|
||||
phb ; Push bank
|
||||
AI8
|
||||
|
||||
|
@ -152,8 +95,8 @@
|
|||
plb ; Restore bank
|
||||
plp ; Restore status
|
||||
xce ; Restore emulation bit
|
||||
cli ; Enable interrupts
|
||||
txa ; Transfer bank count to A
|
||||
plp ; Pull status again to pull I flag
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
@ -210,10 +153,11 @@
|
|||
.A8
|
||||
.I8
|
||||
; Preamble
|
||||
php ; Push status
|
||||
sei ; Disable interrupts
|
||||
clc ; Clear carry
|
||||
xce ; Clear emulation bit
|
||||
php ; Push status
|
||||
php ; Push status again, reflecting emulation bit
|
||||
phb ; Push bank
|
||||
AI8
|
||||
|
||||
|
@ -278,16 +222,22 @@
|
|||
plb ; Restore bank
|
||||
plp ; Restore status
|
||||
xce ; Restore emulation bit
|
||||
cli ; Enable interrupts
|
||||
plp ; Pull status again to pull I flag
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _ram2gs_cmd: near
|
||||
.A8
|
||||
.I8
|
||||
; Save current bank and command in accumulator
|
||||
phb
|
||||
pha
|
||||
; Preamble
|
||||
php ; Push status
|
||||
sei ; Disable interrupts
|
||||
clc ; Clear carry
|
||||
xce ; Clear emulation bit
|
||||
php ; Push status again, reflecting emulation bit
|
||||
phb ; Push bank
|
||||
pha ; Push command in accumulator
|
||||
AI8
|
||||
; Switch to bank 0xFB
|
||||
lda #$FB
|
||||
pha
|
||||
|
@ -300,7 +250,10 @@
|
|||
; Pull and submit command
|
||||
pla
|
||||
sta $FFFD
|
||||
; Restore bank and return
|
||||
plb
|
||||
; Postamble
|
||||
plb ; Restore bank
|
||||
plp ; Restore status
|
||||
xce ; Restore emulation bit
|
||||
plp ; Pull status again to pull I flag
|
||||
rts
|
||||
.endproc
|
||||
|
|
Loading…
Reference in New Issue