Assembling to different banks

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
R-Tape
Site Admin
Posts: 6409
Joined: Thu Nov 09, 2017 11:46 am

Assembling to different banks

Post by R-Tape »

How do you assemble to different banks? Previously I've done this the long way by dealing with them separately as .TAP blocks and loading them in, but I assume there's an assembly language shortcut? (And does SPIN have this feature?)
User avatar
Seven.FFF
Manic Miner
Posts: 744
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: Assembling to different banks

Post by Seven.FFF »

Some assemblers like Sjasmplus and Zeus know about specific computer models, and can assemble into a device memory map specific to that model. So you can can use bank numbers of the correct size in your assembler directives. These directives are not part of assembly language per se, as the language is just concerned with runtime instructions for a generic Z80. They’re compile-time meta-instructions specific to each assembler.

Take a look at DEVICE, MMU, SLOT and PAGE in the sjasmplus docs for an example. ORG, DISP and ENT are also quite useful when assembling for banks that can appear at more than one address. It also comes with a bunch of example programs demonstrating that kind of thing.

https://z00m128.github.io/sjasmplus/documentation.html

For assemblers that aren’t device-aware, you can also do it more manually, by changing ORG multiple times and outputting multiple binary files. Many assemblers will also write tap/tzx/sna/z80 files directly, but to write 128K versions of those automatically also requires device awareness.

No idea about Spin but I never had much luck with its assembler, it kept crashing on me whenever I did non-trivial things.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
Post Reply