Ran into the first real problem loading the EPROM HEX file image into the FPGA. The memory configuration wizard asks for the HEX file and acts as if everything is OK, but when I look at the In-System Memory Contents Editor it shows that nothing got loaded.
There's no error when selecting the file initially in the MegaWizard Plug-In Manager for the EPROM.
Looks as if the problem is the offset. The HEX file top looks like:
The code is located at $C000-$CFFF. The wizard tries to load code at the addresses from the hex file. The EPROM in the FPGA doesn't know about this offset. So how can this be fixed?
There's no choice for subtracting an offset in Quartus II.
The as68 assembler manual doesn't offer any option to subtract an offset in the hex file.
SRecord Utility
The SRecord utility can shift offsets in HEX files.
Here's the offset feature:
Shifting the HEX file down by $c000 should solve this problem. The specific program is srec_cat.
From the SRecord doc file examples:
That example writes out a binary file. The program can also write out HEX files. So the goal is to read the HEX file, shift the program down by $C000 and then write out a HEX file.
Steps to Make Relocated HEX file
Assemble source code to produce S-Record output
a68 V2_DIS_corrected.ASM -l V2_DIS_corrected.LST -s smithbug.s
Output looks like:
S113F0008E7F44BF7F0A7F7F0DCEF125FF7F17FFE0 S113F0107F088603B7E0180101018615B77F0CB697 S113F0207F0CB7E0188E7F448E7F627F7F137F7FD3
Note these records are at: 0xF000,
Convert S-Record file to Intel HEX file and Shift Down
srec_cat smithbug.s -offset - -minimum-addr smithbug.s -o smithbug.hex -Intel
Output looks like:
:020000040000FA :20F000008E7F44BF7F0A7F7F0DCEF125FF7F17FF7F088603B7E0180101018615B77F0CB67F :20F020007F0CB7E0188E7F448E7F627F7F137F7F167F7F6DCEF76B8D618D5916BDF0EFCEC2 :20F04000F7C0E100270B0808088CF7FC26F47EF441EE016E00FE7F026E00FE7F086E00FE47
Load into Multicomp
Put file smithbug.hex into the ROMs folder for Multicomp.
Fixed Initialization of ROM
Problem was the wrong size of EPROM file. Set to 4K and it loaded.
The result compares well to the .LST file.
End has:
Middle has text:
Matches the asm file:
TBL FCC "***NOPNOP***" FCC "******TAPTPA" FCC "INXDEXCLVSEV" FCC "CLCSECCLISEI" FCC "SBACBA******" FCC "******TABTBA" FCC "***DAA***ABA" FCC "************" FCC "BRA***BHIBLS" FCC "BCCBCSBNEBEQ" FCC "BVCBVSBPLBMI" FCC "BGEBLTBGTBLE" FCC "TSXINSPULPUL" FCC "DESTXSPSHPSH" FCC "***RTS***RTI" FCC "******WAISWI" FCC "NEG******COM" FCC "LSR***RORASR" FCC "ASLROLDEC***" FCC "INCTSTJMPCLR" FCC "SUBCMPSBCBSR" FCC "ANDBITLDASTA" FCC "EORADCORAADD" FCC "CPXJSRLDSSTS" FCC "LDXSTX" SPLBD0 FCC "#$" FCB $4
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.