Page 1 of 1

Spectrum 128

Posted: Tue Jan 01, 2019 7:26 pm
by dwinters18
Hi,

I know this will sound like a bit of a silly question to some of you out there, but I have been doing some z80 stuff for the 48k spectrum and would like to explore the spectrum 128 side of doing z80 for it - namely accessing the extra ram and using the AY sound chip.

Is there any quick reference as to how easy it could be to start doing code for the spectrum 128 as oppsoed to the 48k?

I am using SpecNet IDE that does support spectrum 128 apparantly.

Thanks in advance for any assistance/help/thoughts!

D.

Re: Spectrum 128

Posted: Tue Jan 01, 2019 8:07 pm
by Ast A. Moore
Nothing silly about your question. Here’s a good place to start—a fairly comprehensive description of the 128K Spectrum architecture.

Re: Spectrum 128

Posted: Tue Jan 01, 2019 8:12 pm
by dwinters18
Hi.

Thanks for that link.

It doesn't seem to really outline how you would go about coding something to use the extra memory.

I know it has to be paged, but how does that affect where your code is running from if you page to elsewhere in memory?

(Told you it's a silly question!)

D

Re: Spectrum 128

Posted: Tue Jan 01, 2019 8:20 pm
by Ralf
I would say it's not a big difference. You have the same CPU and the same graphic mode. Most of programs written for 48 kB will work on 128 kB as well. So you can write universal programs, working both on 48 kB and 128 kB

The differences are:

- AY music (although 48 kB may play AY as well with external interface attached)
- extra memory (but you can't access it all at the same time so problem of memory paging emerges)
- second display screen
- subtle differences with timings (ignore it now)

As for the AY, most of people don't write their own music playing routines but rather use existing tools and formats. This is relatively easy. Of course the music itself must be created first ;) but I suppose we go here beyond "coding"

As for the memory paging (which also include switching between visible screens) check this info at start:
https://www.worldofspectrum.org/faq/ref ... erence.htm

EDIT: Looks like you already have been given this link.

You ask how paging affects your code. In theory it's simple - with a single command part of your memory is replaced with a different content from different memory page.

Using it in practice may sometimes be awkward. I've seen several people on the forums claiming that they hate paging ;) You just have to develop your own tricks, I guess. And keep connected stuff together so when you change the page you have everything you need in main memory

Re: Spectrum 128

Posted: Tue Jan 01, 2019 8:31 pm
by dwinters18
Hi,

Thanks - very interesting.

1) Out of curiosity, is the second screen something that can be used in conjunction with the first for something like double buffering for games or does it not work like that?

2) Also you say paging part of your memory - I am struggling to understand (if it's possible to answer this briefly) how the extra memory works with for example my game code (as i say for accessing maybe map data for instance)

D.

Re: Spectrum 128

Posted: Tue Jan 01, 2019 8:44 pm
by dfzx
dwinters18 wrote: Tue Jan 01, 2019 8:12 pm I know it has to be paged, but how does that affect where your code is running from if you page to elsewhere in memory?
Just trying to get my head around what you're actually asking here...

The paging works by changing the contents of the top 16K of RAM. You really don't want to be running code which is in that RAM bank at the point you page in a different one! You don't want your stack in there either! So generally speaking, to keep things simple you'd make sure the code you're running is in the 0x4000 to 0xbfff range, and it's data you page in an out of the top bank as needed. I'm simplifying, of course. You can do all sorts of weird things if you see advantage in it. :)

There's a long an illuminating thread on the subject of double buffering here.