Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Play on a bank ($c000) in spectrum128 and then copy to $4000
#4
funkheld Wrote:how can you use $c000 as a screen?
can you print at $c000?
how can you direct the output to $c000 with asm?

thanks.
regards

Yes. All standard routines support printing and drawing in any RAM address ("standard" means, they came bundled with the compiler).
The same for attributes. You can draw attributes in a different region of the screen: this is useful if you want to use only a small buffer (i.e. 2/3 of the screen) and put the attributes just after that, so saving 2k of (scarce ram).

Code:
#include <scrbuffer.bas>
#include <memcopy.bas>

DIM scr_addr, attr_addr as UInteger

CLS: PRINT "PRESS A KEY"

scr_addr = GetScreenBufferAddr() : REM Original screen address ($4000)
attr_addr = GetAttrBufferAddr(): REM Original Attr address

SetScreenBufferAddr($C000)
SetAttrBufferAddr($C000 + 6144) :REM uses standard screen + attribute region

CLS: REM Clears new Screen (it may contain random bits)
PRINT INK 6; PAPER 1; "HELLO WORLD"

PAUSE 0
MemCopy(0xC000, scr_addr, 6144) : REM Copy only pixels region
PAUSE 0
MemCopy(0xC000 + 6144, attr_addr, 32 * 24): REM Copy attributes region

This example (untested, typed here directly), PRINTS in another region. Then copy (blits) the pixels to the actual screen and later the attributes.
If the buffer is in a contiguous region, you can copy all the buffer in one single MemCopy call.

EDIT: Program fixed and tested :-)
---
Boriel
Reply


Messages In This Thread
RE: Play on a bank ($c000) in spectrum128 and then copy to $4000 - by boriel - 01-10-2025, 04:20 PM

Forum Jump:


Users browsing this thread: 4 Guest(s)