spectrum 128 and banking.
https://worldofspectrum.org/faq/referenc...erence.htm
write data into bank 1, 3 and 4.
switch to the bank and always get the data from $c000.
the data from the bank is always in $c000.
greetings
mey demo , greeting from germany:
-----------------------------------
Code:
#Include <SP/Fill.bas>
#include <memcopy.bas>
DIM wert AS UInteger
Sub fastcall _bank(n as UByte)
ASM
ld c, a ; A register contains the n parameter
ld a,(0x5b5c)
and 0xf8
or c ;bank N auswählen
ld bc,0x7ffd
di
ld (0x5b5c),a
out (c),a
ei
END ASM
end sub
CLS
_bank(3)
for wert=$c000 to $c000+6143
poke wert,129
next wert
_bank(4)
for wert=$c000 to $c000+6143
poke wert,255
next wert
_bank(1)
for wert=$c000 to $c000+6143
poke wert,137
next wert
do
IF INKEY$ = "q" THEN
_bank(1)
MemMove($c000, $4000, 6144)
end if
IF INKEY$ = "w" THEN
_bank(4)
MemMove($c000, $4000, 6144)
end if
IF INKEY$ = "e" THEN
_bank(3)
MemMove($c000, $4000, 6144)
end if
loop
----------------------------------------
You can also get the data from $c000 and bring it to $c000 with poke/peek.
greting