added cx16.rombank() and rambank(). Select kernal rom in i/o heavy programs for faster disk i/o

This commit is contained in:
Irmen de Jong 2021-01-17 19:16:21 +01:00
parent 5c13918f11
commit b270f6f713
4 changed files with 31 additions and 1 deletions

View File

@ -289,6 +289,23 @@ romsub $fecc = monitor() clobbers(A,X,Y)
; ---- utilities -----
inline asmsub rombank(ubyte rombank @A) {
; -- set the rom banks
%asm {{
sta $01 ; rom bank register (new)
sta cx16.d1prb ; rom bank register (old)
}}
}
inline asmsub rambank(ubyte rambank @A) {
; -- set the ram bank
%asm {{
sta $00 ; ram bank register (new)
sta cx16.d1pra ; ram bank register (old)
}}
}
asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A {
; -- get a byte from VERA's video memory
; note: inefficient when reading multiple sequential bytes!

View File

@ -12,7 +12,7 @@
main {
sub start() {
txt.print("\nCommanderX16 65c02 file based assembler.\n\nfilename or enter for interactive: ")
txt.print("\ncommander-x16 65c02 file based assembler.\n\nfilename or enter for interactive: ")
str filename = "?" * 20
if txt.input_chars(filename)
@ -20,6 +20,8 @@ main {
else
user_input()
cx16.rombank(4) ; switch back to basic rom
test_stack.test()
}
@ -57,6 +59,8 @@ main {
txt.print(filename)
txt.spc()
cx16.rombank(0) ; switch to kernal rom for faster file i/o
if diskio.f_open(8, filename) {
c64.SETTIM(0,0,0)
uword line=0

View File

@ -8,6 +8,7 @@
start
stz $9f60 ; switch to kernal bank for faster i/o
phx
ldx #<_filename
@ -48,6 +49,9 @@ _eof
lda #1
jsr $FFC3 ;CLOSE
lda #4
sta $9f60
; print the time taken
jsr $FFDE ; RDTIM -> A,X,Y
tay

View File

@ -12,6 +12,9 @@
main {
sub start() {
cx16.rombank(0) ; switch to kernal rom (for faster file i/o)
; trick to check if we're running on sdcard or host system shared folder
txt.print("\nimage viewer for commander x16\nformats supported: .iff, .pcx, .bmp, .koa (c64 koala)\n\n")
if string.length(diskio.status(8)) {
@ -30,6 +33,8 @@ main {
gfx2.screen_mode(255) ; back to default text mode and palette
txt.print("that was all folks!\n")
cx16.rombank(4) ; switch back to basic rom
}
sub show_pics_sdcard() {