RC2014Z80 / RC2014

Official RC2014 repository for hardware schematics / software and more!
313 stars 42 forks source link

Building under Linux #4

Closed lachesis closed 7 years ago

lachesis commented 7 years ago

How can I build the HexLoadr ROM under Arch Linux? I have yasm, nasm, and z88dk, but tasm seems to be DOS/Windows only.

fbergama commented 7 years ago

Hi Iachesis, z88dk has a built-in assembler that can be used to build some roms that I did time ago (like the hexload). For the others (like the Nascom Basic or the HexLoadr you mentioned) you need tasm. I've run it with no troubles using freedos (http://www.freedos.org). Unfortunately, it's a bit tedious to copy files back and forth if you seriously use it for development...

Filippo

feilipu commented 7 years ago

@lachesis I converted the HexLoadr ROM to z88dk in June. So TASM is now unnecessary, for the init32k.asm file. Similarly, I migrated hexload to z88dk about a month a go.

As I'm too lazy to convert the entire Microsoft Basic file to work with z88dk, you still need TASM in a dosbox to assemble the bas32k.asm file.

To assemble both HexLoadr and hexload under z88dk, you'll need to have a working environment, including zsdcc. There is a z88dk wiki entry for that, or I've made my own notes under Ubuntu 16.04.

For HexLoadr specifically, there are two incantations you need from the command line z88dk for int32k.asm

> zcc +z80 --no-crt -v -m --list -Ca--filler=0xFF @nascom32k.lst -o int32k
> appmake +glue -b int32k --ihex --pad --filler 0xFF --recsize 24 --clean

This generates an .ihx file from int32k.asm that can be cut and pasted onto the start of your .ihx file generated by TASM from the bas32k.asm file. This, and the relevant incantation for TASM, are located in the _ASSEMBLE_32K.BAT file.

To use TASM, I use either v3.1 under Linux DOSBOX, 16 bit. Or is also possible to use v3.2 under Windows 32 bit environments.

The resulting integrated (renamed) file is nascom32_hexloadr.hex, with the bas32k.ihx file starting at line 38. This file is your ROM, and can be loaded using any EEPROM writer that can understand Intel HEX.

For hexload specifically, the Makefile has been adjusted to use z88dk, so there's no need for for TASM at all. But you don't need to use make to use hexload, as the Basic version is prepared to use as it is. The instructions are on the README.

The throughput of the hexload assembly code has been improved substantially, so there is now no need to use slowprint.py to upload ihx files (although it is still necessary for Basic), you can just cat them from the command line.

Just let me know if this hasn't covered it.

lachesis commented 7 years ago

Thanks for the comments, @feilipu and @fbergama. I've got a process working using DOSEMU and TASM.EXE from Grant Searle's CP/M page. Now I'm just waiting for my RomWBW board to come so I actually have a re-programmable ROM chip. Here's what my build.sh looks like:

#!/bin/sh
# Assumes the following:
#   TASM.EXE and TASM80.TAB are in this directory
#   latest z88dk is installed and has rc2014.cfg linked to z80.cfg

# Build int32.hex
export ZCCCFG=/usr/lib/z88dk/lib/config/ Z80_OZFILES=/usr/lib/z88dk/lib/
zcc +z80 --no-crt -v -m --list -Ca--filler=0xFF @nascom32k.lst -o int32k
appmake +glue -b int32k --ihex --pad --filler 0xFF --recsize 24 --clean

# Build bas32k.hex
cat > b_bas32k.bat <<EOF
tasm -80 -a7 -fff -c -l d:bas32k.asm d:bas32k.hex
EOF
dosemu b_bas32k.bat

# Concat the files together (except for the last line of int32k.hex, since it is a "quit hexloader" line)
head -n -1 int32k.hex > rom.hex
cat bas32k.hex >> rom.hex
echo "Output ROM in rom.hex"

Thanks again for the help. Feel free to close this. :)

feilipu commented 7 years ago

I just checked Grant's TASM version to be the very ancient v3.01 version :stuck_out_tongue_closed_eyes: from 1994. The most recent v3.1 version is available from the TICalc site.

Total of the changes from v3.01 are:

11/30/97 Version 3.1    LINUX support.
                        Protect mode version (tasmp) with better memory 
                          management (more labels allowed, etc.)
                        Added an 8096 table.
                        Added Logical NOT unary operator.
                        Added an object file format with word address

As noted there's also a v3.2 version available from the same archive, specifically for Windows32 environments (which doesn't work with DOSBOX).

09/01/01 version 3.2    Increased LINESIZ to 512 to enable use of longer macros.
                        Eliminated -r command line option (to set 
                        read buffer size - Now obsolete.)
                        Improved list() function to put a max of 
                        six bytes per line to avoid problems with
                        directives that generate large blocks of 
                        object code (i.e. .FILL).
                        Built as a 32 bit version using MS C++ 6.0