mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 16:29:21 +00:00
added MEMTOP2 pseudo kernal routine on cx16 to get the number of RAM banks
This commit is contained in:
parent
3550e1214c
commit
ee9f662016
@ -24,7 +24,7 @@ romsub $FF8D = VECTOR(uword userptr @ XY, ubyte dir @ Pc) clobbers(A,Y) ; re
|
||||
romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag
|
||||
romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN
|
||||
romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK
|
||||
romsub $FF99 = MEMTOP(uword address @ XY, ubyte dir @ Pc) -> uword @ XY ; read/set top of memory pointer
|
||||
romsub $FF99 = MEMTOP(uword address @ XY, ubyte dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See MEMTOP2
|
||||
romsub $FF9C = MEMBOT(uword address @ XY, ubyte dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer
|
||||
romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard
|
||||
romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus
|
||||
@ -87,6 +87,17 @@ asmsub RDTIM16() -> uword @AY {
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub MEMTOP2() -> ubyte @A {
|
||||
; -- uses MEMTOP's cx16 extension to query the number of available RAM banks.
|
||||
%asm {{
|
||||
phx
|
||||
sec
|
||||
jsr c64.MEMTOP
|
||||
plx
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cx16 {
|
||||
|
@ -7,12 +7,10 @@ main {
|
||||
|
||||
sub start () {
|
||||
uword mem
|
||||
ubyte num_banks
|
||||
|
||||
mem = 5*mem*c64.MEMTOP(0,1)
|
||||
txt.print_uwhex(mem, 1)
|
||||
|
||||
mem = 5*mem*c64.CHRIN()
|
||||
txt.print_uwhex(mem,1)
|
||||
num_banks = c64.MEMTOP2()
|
||||
txt.print_ub(num_banks)
|
||||
|
||||
test_stack.test()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user