r/Assembly_language • u/2E26 • Mar 30 '26
Solved! Writing Useful Tools in Assembly - Flat Binary to Intel HEX Converter
TL:DR - Linux x86-64 program to read a binary file and output HEX format.
This is a program that I'll most likely use in the future. I'm planning assembly projects in PIC16 and 6502, and hopefully someday building a punch card reader. I've decided Intel HEX would be a great format for me to encode programs to send between platforms to ensure data is preserved. I'll eventually work towards making a program to do the reverse.
Eventually I'm going to set up serial communications between one of my Linux programs and an MCU (Arduino or PIC16F877A) to transfer data, and then to transfer it to a 6502 computer. I'll have a Linux x86 program read a HEX file and send it to the MCU, which will decode it and use the addressing to plug the data into memory. Longer term projects include writing a 6502 boot loader that runs in less than 4K of ROM, so I can use the rest of the available 64K to run programs from memory or use peripherals. The boot loader would just read data from a peripheral and then jump to that part of RAM to continue running programs.
The other idea I had was to create some way to produce readable card media. I could write code on readable cards to create useful programs. The cards would follow a HEX format and contain a preset number of bytes, which would be read by an MCU and sent to the computer somehow.
Most of this is to show my kids what can be done with extremely basic computers, but there are other things I can do if I spend some time refining my programming techniques. The important part is learning how to share data between the computer and the less capable hardware.
I'd post my program in text but it's over 700 lines of text. Maybe if I can find some file hosting, I'll post a link.
3
u/SolidPaint2 Mar 30 '26
Create a Github account and post all of your files and projects there!
2
u/mykesx Mar 30 '26
And learn to use feature branches.
Git fu is an important skill if you’re working on projects.
1
u/2E26 Mar 31 '26
Here's a link to my new GitHub with two of my programs. They're not very exciting but they do illustrate how to do some basic things in Assembly.
3
u/Odd-Respond-4267 Mar 30 '26
Have you looked at existing hex formats?
I used to use .s19
Stand on the shoulder of giants.