Help getting code from A to B!

Do you live and breathe hexadecimal? Do you like speaking to hardware directly?

Moderator: Programming Moderators

Post Reply
Posts: 2
Joined: Tue May 22, 2018 8:36 am

Help getting code from A to B!

Post by mnmorton » Tue May 22, 2018 8:17 pm

Hi All

Playing with Z80 for the first time in many years :) Only ever dabbled when I had the 48K Speccy, but wrote a couple of basic games and apps using part Basic and part Z80. Lots still to learn and understand properly though!

Anyway, I had been using ZXSpin to write/assemble/emulate but I wanted to try playing with the Next Sprite routines - as I understand it this means that you need Zeus as the assembler to support the new codes and Zesaurx to emulate the Next - is that correct or are there other options?

Having written code in Zeus which assembles and having looked at some of the other posts I'm pretty happy that is OK. Now how do I get that into something (tap?) that Zesaurx can run!? As part of that are there any additional keywords I need to include in my Zeus code apart from the 'org' at the start and 'ret' at the end? This whole bit just hasn't clicked in my head yet and I can't seem to find anything that helps explain it!

Thanks for any help :)


Posts: 12
Joined: Tue May 30, 2017 4:53 pm

Re: Help getting code from A to B!

Post by Jonv » Wed May 23, 2018 9:32 pm

Lots of options but recommend CSpect as the emulator and spasm or sjasmplus for assembling. Works well with the Particles and ScrollNutter demo examples.

User avatar
Posts: 211
Joined: Mon Jun 05, 2017 5:30 pm
Location: USA

Re: Help getting code from A to B!

Post by SevenFFF » Wed May 23, 2018 10:20 pm

You can make taps, .z80 snaphots and .sna snapshots in Zeus, with a one-liner.

The Next gives you a USR 0 menu loading taps, which isn't really needed for non-legacy games. Snapshots also have the advantage of containing up to 128K code or data, and will load that into the classic 128K banks, so they're convenient for a development quick start. CSpect can only load .sna snashots, so this is probably the best format to use. An additional advantage of Next .sna files is that, with a bit of extra code, you can append additional data to the end (sprites, music, MMU banks, etc), so you can still write a single file application.

Code: Select all

output_z80 "MyFileName.z80", $FF40, Start
output_sna "MyFileName.sna", $FF40, Start
Include one or other or both of these lines at the bottom of your code. $FF40 is the address of the stack pointer in a clean NextOS or +3 system. Start should be the address of the entry point on your code that you want to jump to after loading.

For better CSpect compatibility, also add these lines before the output line. You don't need them to run on the board or in ZEsarUX, but if you release your files it gives people the chance to use them in CSpect too. They just set up the initial registers and interrupt conditions to match what CSpect expects when it loads the file.

Code: Select all

Zeus_P7FFD = $10; start with 16k-bank 0 paged in at $C000
Zeus_IY = $5C3A ; address of sysvars, NextBASIC expects these to be in IY.
Zeus_AltHL = $5C3A ; Some ROM routines also expect then in HL'
Zeus_IM = 1 ; begin in interrupt mode 1
Zeus_IE = false ; begin with interrupts disabled
Zeus is a very fast and flexible macro assembler which understands all the Next enhanced opcodes. It can send data down a USB serial cable to the ESP port on the Next board, and also do remote debugging on the board. The assembler understands the full 25-bit memory map and MMU banks, so everything can be held in memory at once and assembled together.

Other available assemblers not yet mentioned that support some or all Next enhanced opcodes are: the one in z88dk, nx (work in progress) and this fork of pasmo (work in progress).
Last edited by SevenFFF on Wed May 23, 2018 10:31 pm, edited 1 time in total.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel Spectron 2084blog

User avatar
Posts: 183
Joined: Fri Jun 23, 2017 1:13 pm
Location: Albuquerque, NM USA

Re: Help getting code from A to B!

Post by varmfskii » Wed May 23, 2018 10:26 pm

The assembler that is called from zcc in z88dk (z80asm) also supports the Spectrum Next opcodes and has the advantage of running naively on something other than Windows as does Zesarux.
Backer #2741 - TS2068, Byte, ZX Evolution

Posts: 2
Joined: Tue May 22, 2018 8:36 am

Re: Help getting code from A to B!

Post by mnmorton » Thu May 24, 2018 10:31 am

Thanks all for the replies, especially SevenFFF for the comprehensive one with code snippets. I'll have a play this evening and see if I can get it working :)

Post Reply