Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
where can I get help with the memory on the spectrum 128k?
#1
hello, good day.

where can I get help with the memory on the spectrum 128k?

thanks.
greetings
Reply
#2
The support for Memory with 128k is *very* limited.
There are some post in this forum, but for up-to-date techniques, please join the Telegram channel. :-)
Reply
#3
hello, good day.
I found something for the bank and did a test.
https://worldofspectrum.org/faq/referenc...erence.htm

I wrote in bank 3 and bank4 :
_bank3()
poke($c00a,128)
_bank4()
poke($c007,5)

I then did the bank test and it works great.

how can you pass the value for the bank in the asm program? I don't know.

That's why I wrote the asm program twice.
thanks

-----------------------------
Sub _bank4 ()
ASM
  ld a,(0x5b5c)
  and 0xf8
  or 4 ;bank 4 auswählen
  ld bc,0x7ffd
  di
  ld (0x5b5c),a
  out ©,a
  ei
END ASM
end sub

Sub _bank3 ()
ASM
  ld a,(0x5b5c)
  and 0xf8
  or 3 ;bank 3 auswählen
  ld bc,0x7ffd
  di
  ld (0x5b5c),a
  out ©,a
  ei
END ASM
end sub

CLS
_bank3()
poke($c00a,128)
_bank4()
poke($c007,5)

_bank3()
print peek($c000)
print peek($c00a)

_bank4()
print peek($c000)
print peek($c007)


WHILE INKEY$ = ""
END WHILE
-----------------------------------------
Reply
#4
Dealing with banks is a bit complicated and the compiler does not support them.
Maybe someone else can help you here, or, as said, ask for help in the Telegram channel, since many people is doing things with banking already.

EDIT: You can write pure asm functions using Fastcall, and the 1st parameter comes in A register if the parameter is 8 bits sized:
Code:
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
Reply
#5
hello thanks for info.

greeting

hello were is with :
Code:
Sub fastcall _bank(n as UByte , x as UByte)

greeting
Reply
#6
spectrum 128 :
here is a demo for bank 1,3,4

is wonderful.

Bank 1 can also be filled with a different value for testing purposes using poke...

greetings


------------------------------------------
#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 ©,a
  ei
END ASM
end sub

CLS

CIRCLE 128, 87, 87
SPFill(128, 87, USR "ud")
_bank(1)
MemMove($4000, $c000, 6144)

for wert=$4000 to $4000+6143
  poke wert,129
next wert
_bank(3)
MemMove($4000, $c000, 6144)

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
------------------------------------------------
Reply
#7
hello, good day.

the way it works here for me is that you can switch on the bank at $c000 and then draw on it and then copy from $c000 to $4000.

you don't need to first draw on $4000 and then copy $c000 into the bank.

so you have two screens $4000 and when a bank is switched on $c000.

draw a graphic in the background ($c000) and then copy to $4000.

greetings


-----------------------------------------
#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 ©,a
  ei
END ASM
end sub

CLS

_bank(3)
for wert=$c000 to $c000+6143
  poke wert,129
next wert

_bank(1)
for wert=$c000 to $c000+6143
  poke wert,137
next wert

do
    IF INKEY$ = "w" THEN
      _bank(1)
      MemMove($c000, $4000, 6144)
end if
IF INKEY$ = "e" THEN
      _bank(3)
      MemMove($c000, $4000, 6144)
end if 
loop

------------------------------------------------
Reply
#8
Hey, that's great!!

EDIT: Ensure you have downloaded the latest version 1.17.3, btw.
Reply
#9
hello tanks.

i have latest version 1.17.3.

------------------------------------


how do you pass 2 Ubytes in asm?

how do you pass 1 or 2 UIntegers in asm?

greeting.
Reply
#10
This is a common question already explained in this forum.
At this moment, *only the 1st parameter* will be passed in the registers. The others are passed in the stack.
Follow this thread
https://www.boriel.com/forum/showthread....650#pid650
and then don´t hesitate to ask any further question!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)