Forum
Store array information in extended memory (128kb) - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Help & Support (https://www.boriel.com/forum/forumdisplay.php?fid=16)
+---- Thread: Store array information in extended memory (128kb) (/showthread.php?tid=2546)



Store array information in extended memory (128kb) - rbiondi - 03-10-2024

Hello,

Is it possible storing arrays and/or Strings in Zx Spectrum Extended Memory (128kb)? 
How could this would be accomplished?

Thank you very much!
Rogerio


RE: Store array information in extended memory (128kb) - funkheld - 11-24-2024

spectrum 128 and banking.
https://worldofspectrum.org/faq/reference/128kreference.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


RE: Store array information in extended memory (128kb) - rbiondi - 01-11-2025

Thank you very much for your help!

Kind regards,
Rogerio