Build PDP-8 Assembler Tool
- Assembler macro8x.c generates binary (DEC bin) files from PDP-8 Assembly Language files
- Notes from macro8x.c source code
This program has been built and successfully executed on: Linux (80486 CPU) using gcc RS/6000 (AIX 3.2.5) Borland C++ version 3.1 (large memory model) Borland C++ version 4.52 (large memory model) with no modifications to the source code. On UNIX type systems, store the the program as the pal command and on PC type systems, store it as pal.exe
- Command line to compile assembler (under Linux GCC):
gcc macro8x.c
- macro8x.c would not compile under VisualStudio
- macro8x.c source compiled without error under Linux Mint under VirtualBox
Simple Test Program
I wrote a very simple test program, easy.pal . The program continually increments a memory location, at 10 (oct).
- Compile easy.pal code using:
../macro8x -x easy.pal
List file is:
1 0010 *10 2 00010 0000 linep, 0 3 0200 *200 4 00200 2010 ISZ linep 5 00201 5200 JMP .-1 6 00202 5200 JMP .-2 7 No detected errors
The binary file from macro8x easy.bin as viewed in HxD (as 16-bit hex values) is:
Bin to MIF Utility
The output of the macro8x assembler is DEC bin loader format. The DEC bin format is described in DEC-OO- LBAA-D:
Wrote a utility, bin2mif.py to convert binary loader data to Altera Memory Initialization (MIF) files. The program:
- Ignores the (0x80) header values and ignores the data section (0x4008 0x0000 values)
- Looks for the code section (starting with 0x4200)
- Assumes code starts at 200 (oct). This could be pulled from the 0x4200 location,
- Pads the first 200 (oct) locations with 0000 (oct).
Here's the output:
-- Generated by bin2mif.py -- DEPTH = 131; WIDTH = 12; ADDRESS_RADIX = DECIMAL; DATA_RADIX = OCTAL; CONTENT BEGIN 0000: 0000 0000 0000 0000 0000 0000 0000 0000; 0008: 0000 0000 0000 0000 0000 0000 0000 0000; 0016: 0000 0000 0000 0000 0000 0000 0000 0000; 0024: 0000 0000 0000 0000 0000 0000 0000 0000; 0032: 0000 0000 0000 0000 0000 0000 0000 0000; 0040: 0000 0000 0000 0000 0000 0000 0000 0000; 0048: 0000 0000 0000 0000 0000 0000 0000 0000; 0056: 0000 0000 0000 0000 0000 0000 0000 0000; 0064: 0000 0000 0000 0000 0000 0000 0000 0000; 0072: 0000 0000 0000 0000 0000 0000 0000 0000; 0080: 0000 0000 0000 0000 0000 0000 0000 0000; 0088: 0000 0000 0000 0000 0000 0000 0000 0000; 0096: 0000 0000 0000 0000 0000 0000 0000 0000; 0104: 0000 0000 0000 0000 0000 0000 0000 0000; 0112: 0000 0000 0000 0000 0000 0000 0000 0000; 0120: 0000 0000 0000 0000 0000 0000 0000 0000; 0128: 2010 5200 5200; END;
Loaded the easy.mif file. Got the expected warning loading it into Quartus (it's OK).
Critical Warning (127005): Memory depth (4096) in the design file
differs from memory depth (131) in the Memory Initialization File
"C:/Users/HPz420/Documents/GitHub/Doug Gilliland/Linux-68k/pdp8/
PDP8_Programs/easy.mif" -- setting initial value for remaining
addresses to 0.
Ran. It worked great. The code is at the correct place and increments the location 10 (oct).
Code loaded at 200 (oct) which is 0x80 (hex), Verified data changes with In System Memory Content Editor.
And again:
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.