Hex monitor format

Discuss software for the Apple 1/replica 1

Hex monitor format

Postby mfortuna » Jan Wed 02, 2008 2:19 pm

In messing around with stuff to do on my replica 1 I downloaded and successfully complied figforth with the cc65 compiler. I'm a fan of the forth language and even used it to write diagnostics at work many years ago. I'm thinking I can add some custom features to it.

One minor issue I found is how to convert a binary to the monitor format downloadable via the serial port. I can do this using an emacs macro by using hex mode and then erasing columns but I figure there is an easier way. Is there a program or linker switch to do this?

Thanks,

Mike
mfortuna
 
Posts: 49
Joined: Dec Wed 12, 2007 3:30 pm

Postby Kallikak » Jan Wed 02, 2008 3:27 pm

I use this:

Code: Select all
#!/bin/sh

od -t x1 -A x "$1.bin" | tr a-z A-Z | awk '{ print substr($1,3,4) ":" substr($0, 7) }' > "$1.hex"


It's not perfect, but gets it just about right. The output sometimes requires a bit of editing because of duplicate line output using a * (though you can turn that off with -v) and also the addresses will most likely be offset (depending on your binary file). What I do is a simple search and replace using regular expressions to fix up the first digit of the address, but alternatively you could change the awk part of the above to use substr($1,3,0) and then manually add an address on the first line only.

Ken
Kallikak
 
Posts: 172
Joined: Jan Sun 29, 2006 7:42 pm
Location: Sydney

Postby mfortuna » Jan Wed 02, 2008 3:56 pm

Thanks! I will give it a try.

I'm using xp so I will have to download a shell program.

Mike
mfortuna
 
Posts: 49
Joined: Dec Wed 12, 2007 3:30 pm

Postby mfortuna » Jan Thu 03, 2008 10:17 am

I found another way to do this. The sb_assembler outputs apple 1 format hex code. I got figforth to compile although there were a few tweeks that needed to be done. sbasm uses different directives such as .DW instead of .WORD and .EQ instead of =. It also doesn't use : after labels.

Mike
mfortuna
 
Posts: 49
Joined: Dec Wed 12, 2007 3:30 pm

Postby Kallikak » Jan Thu 03, 2008 3:12 pm

I couldn't survive on XP without cygwin. :)
Kallikak
 
Posts: 172
Joined: Jan Sun 29, 2006 7:42 pm
Location: Sydney


Return to Software

Who is online

Users browsing this forum: No registered users and 1 guest

cron