Memory banking in 128K model

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
User avatar
jorgegv
Member
Posts: 35
Joined: Wed Nov 18, 2020 5:08 pm

Memory banking in 128K model

Post by jorgegv »

Hi people,

I have done my due diligence on the issue of memory banking for the 128K: how to do it inside the program, how to organize the memory for it, and how to instruct the compiler for putting code in each of the banks, and also how to load all this in memory at program load time (the TAP file). I found a great reference about the subject at https://zxspectrumcoding.wordpress.com/ ... ng-part-1/ and the subsequent articles.

These references basically amount to:
  • compile the code for the different sections
  • create a trivial bank switcher routine
  • create a basic loader that calls that routine and loads each bank's contents, then loads the main program in the home bank
  • convert the basic loader to TAP with BAS2TAP
Is there something in Z88DK for automating this kind of setup (since I presume it's done almost always in a similar way for all 128K programs), or the above link is all there is to it? It's not difficult at all and the reference is great, But I'd like to know if special support for it exists in Z88DK, just in case.

Thanks
Jorge
andydansby
Member
Posts: 39
Joined: Fri May 27, 2016 8:58 pm

Re: Memory banking in 128K model

Post by andydansby »

At the time that I wrote that article, there is not an in-built function, all done manually. I'm still working at 1.99C so something might have change in later versions of Z88DK. I wrote that article at the time with Mr. Albright's help.

As for the setup, it's a bit of a pain, but not horrible. I've got a simplified setup at
https://github.com/andydansby/zx-spectr ... ing-sccz80

I might have another bouncing around somewhere as well.

Andy
User avatar
dom
Well known member
Posts: 1420
Joined: Sun Jul 15, 2007 10:01 pm

Re: Memory banking in 128K model

Post by dom »

If you’re using classic then take a look at the example linked from this section: https://github.com/z88dk/z88dk/wiki/Mor ... -and-zsdcc
User avatar
jorgegv
Member
Posts: 35
Joined: Wed Nov 18, 2020 5:08 pm

Re: Memory banking in 128K model

Post by jorgegv »

Mmmm thanks! From the example it seems that using banking is dead easy. Also I'll need to check not onl code pointers, but data as well. My main need for banking now is due to data, not code.

My current setup fpr my engine is newlib+sdcc, but I'll dig into it. Thanks again.

J.
andydansby
Member
Posts: 39
Joined: Fri May 27, 2016 8:58 pm

Re: Memory banking in 128K model

Post by andydansby »

jorgegv wrote: Sun Jun 20, 2021 8:34 am Mmmm thanks! From the example it seems that using banking is dead easy. Also I'll need to check not onl code pointers, but data as well. My main need for banking now is due to data, not code.

My current setup fpr my engine is newlib+sdcc, but I'll dig into it. Thanks again.

J.
User avatar
jorgegv
Member
Posts: 35
Joined: Wed Nov 18, 2020 5:08 pm

Re: Memory banking in 128K model

Post by jorgegv »

Hi,

as a personal exercise I have written my design document for memory banking and memory map, you can read it here: https://github.com/jorgegv/rage1/blob/m ... -DESIGN.md

This document is intended for personal use, but any comments are welcome, of course.

Regards
J.
Post Reply