Programming Index > How to create Z80 code for the Jupiter Ace, and the EightyOne emulator?

How to create Z80 code for the Jupiter Ace, and the EightyOne emulator

Q. How can I use Z80 code with the Jupiter Ace, and EightyOne emulator?

Creating Z80 code for your Jupiter Ace or for the EightyOne emulator is can be done very easily.

You need a text editor, I use UltraEdit-32, Edwin likes Crimson Editor. UltraEdit has a special "word file " to highlight the Z80 code to make it more readable, and I'm sure you can get something similar for Crimson. Any code you write save the text file with the extension .asm eg yourcode.asm

Next you need a Cross Assembler which can produce Z80 code on your PC using any code you write saved as text files with your text editor.   There are many around,  but for the Ace I would recommend TASM V3.2. Yes! It will run on Windows XP with SP2, But its a Dos console program so you Will need to make a Dos command prompt short cut to it.

Form the Dos command call TASM like this;

TASM -80 -b -L yourtextfile.asm  result.bin

TASM calls the cross assembler.
-80 tells TASM to the Z80 TAB file.
-B tells the TASM to produce a binary object file.
-L tells TASM to create a produce a label table listing from your text file.

yourtextfile.asm is your code saved with the .asm

result.bin is the assembled Z80 code as a bin file.

To make TASM easer to work with you can set a Windows environment variable for TASM so there will be no need to add the -80 -b -l options. Right click the Your computer icon, select properties. A window will pop then select Advanced Tab, click on the environment variable button and NEW. In the first box enter the name TASMOPT, and the box below -80 -b -l and click OK. - Please read TASMs manual for more details.

Now you have your Z80 code as a bin file you can use EightyOne's emulator "Load Memory Block" command from the File menu. A window opens asking you to which RAM location address to place your code in EightyOne, depending which address you used to assemble your code and browse to your .bin file TASM assembled and call it in the usual way.

You can save your code from EighyOne in the normal way using BSAVE, or record to a wav file, or a ACE Snapshot file. This is how I made and tested the 96KRAMpack, using the code here.

If you have a real Jupiter Ace, play the WAV file you made with EightyOne, with Windows media player and connect the the sound cards output to the Ace's MIC socket. You might have to fiddle about to get the correct volume setting and EQ and your code will load into the real Ace.

Some more tips for using Z80 code on Ace.

Reserving space

Z80 code can be embedded into forth words but it is easier to lower the ramtop and reserve space for it. use the following line to reset the Ace and set ramtop to [ramtop] rather then the end of ram:

[ramtop] 15384 ! 51 CALL

Try the following example

15872 15384 ! 51 CALL

This will reset the Ace and set the ramtop to 15872. On a 3K Ace (1K for forth) There will be just 0.5K ram available for forth now and the other 0.5K ram starting at 15872 is reserved for Z80 code.

saving and loading

To put Z80 code there one can use the oldschool way and write a little hexloader in forth and enter the z80 code byte by byte or or use the import function of 81 emulator to import your binary. Once the code is there it can be saved using:

[address] [length] BSAVE [filename max 10 characters and no spaces]


15872 512 BSAVE MYZ80CODE

Will save 512 bytes at address 15872 to a code file with the name 'MYZ80CODE'. Note that quotes are not used with the filename.

To reload this code use:


Note that the filename is case sensitive and the exact filename must be used or the file will not load. A small byte saving tip in the above line is is to replace the 2nd zero with the duplicate command 'DUP' this will save two bytes in forth. Using short filenames will save even more bytes.

Execute Z80 code:

[address] CALL

Where [address] is the address of the Z80 code to call. Interesting to know is that the HL register pair contains the same value as the address of the call and the DE register points to the first free byte after the data stack (same value as stored in SPARE system variable). This can be used to create a temporary data store.

When returning from Z80 code the instruction JP (IY) should be used rather than a RET instruction.