GNU assembler for HC11

Site Admin
User avatar
Posts: 6396
Joined: Sat Feb 28, 2009 8:34 pm

GNU assembler for HC11

Postby antus » Thu Aug 27, 2009 1:43 pm

Ive been trying to figure out how to disassemble and reassemble 128kbit bins. Ive got a good disassembly now in GNU Assembler format. I can assemble the code to an elf file.

On linux, do this to get the toolchain (windows after installing cygwin is probably pretty similar, but i cant help with that):

Code: Select all
wget http://ftp.gnu.org/pub/gnu/binutils/binutils-2.19.tar.gz
tar xzvf binutils-2.19.tar.gz
cd binutils-2.19
./configure --target=m6811-elf --program-prefix=m6811-elf-
make
su -c 'make install'
Have you read the FAQ? For lots of information and links to significant threads see here: viewtopic.php?f=7&t=1396

Site Admin
User avatar
Posts: 6396
Joined: Sat Feb 28, 2009 8:34 pm

Re: GNU assembler for HC11

Postby antus » Thu Aug 27, 2009 7:14 pm

Heres a disassembly for the lower 64k half of the VS BSTK.bin. Kudos to anyone who can get it to assemble and match the lower half of the original BSTK1451.BIN, and post some instructions here. It does appear to assemble with the m6811-elf- toolchain, but all the locations referenced by symbol name come out pointing to 0x0000. Not sure if im missing an assembler or a linker switch, or if its the result of a bug!

Im running:

$ m6811-elf-as --version

GNU assembler (GNU Binutils) 2.19
Copyright 2007 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `m6811-elf'.
Have you read the FAQ? For lots of information and links to significant threads see here: viewtopic.php?f=7&t=1396

Site Admin
User avatar
Posts: 6396
Joined: Sat Feb 28, 2009 8:34 pm

Re: GNU assembler for HC11

Postby antus » Fri Aug 28, 2009 5:45 pm

Close now. assemble with:

Code: Select all
m6811-elf-as BSTKgnu.asm

create a file, memory.x with:

Code: Select all
MEMORY
{
  page0(rwx) : ORIGIN = 0x0000, LENGTH = 0x03FF
  text(rwx) : ORIGIN = 0x0000, LENGTH = 0x10000
  data(rwx) : ORIGIN = 0x0000, LENGTH = 0x10000
  bss(rwx)  : ORIGIN = 0x0000, LENGTH = 0x10000
  eeprom(r) : ORIGIN = 0x0E00, LENGTH = 0x1FF
}


The linker seems to crash when creating binary files, but creating srec works around it so:

Code: Select all
m6811-elf-ld a.out -m m68hc11elfb --oformat srec -o bstk.srec
m6811-elf-objcopy -I srec bstk.srec -O binary bstk.bin


This gives a pretty correct looking lower half binfile.. so thats it for this part of the project... hopefully some doors are now open, and i'll crawl back in to my cave and keep delco hacking :mrgreen: :thumbup:

BSTKlow.bin is the lower original half of the file, bstk.bin was created from the above :punk:
Code: Select all
[ant@media vs]$ md5sum bstk.bin BSTKlow.bin
2e39bffede15f1a4db2f5b1f3956e3eb  bstk.bin
2e39bffede15f1a4db2f5b1f3956e3eb  BSTKlow.bin
Have you read the FAQ? For lots of information and links to significant threads see here: viewtopic.php?f=7&t=1396

User avatar
Posts: 10016
Joined: Sat Feb 28, 2009 9:05 pm
Location: Tenambit, NSW

Re: GNU assembler for HC11

Postby Holden202T » Fri Aug 28, 2009 6:47 pm

you make good progress when you talk to yourself :D

Site Admin
User avatar
Posts: 6396
Joined: Sat Feb 28, 2009 8:34 pm

Re: GNU assembler for HC11

Postby antus » Fri Aug 28, 2009 7:14 pm

Yep, them voices in my head must be good for something :think:
So how do you deal with 128k bins? thats how! the door is open.... watch this space... you saw it here on delco hacking first :afro:
Have you read the FAQ? For lots of information and links to significant threads see here: viewtopic.php?f=7&t=1396

User avatar
Posts: 4991
Joined: Sun Mar 01, 2009 2:54 pm
Location: Perth, WA

Re: GNU assembler for HC11

Postby VL400 » Sat Aug 29, 2009 12:10 am

Nicely done antus, this should get the 128k bin development started.

Site Admin
User avatar
Posts: 6396
Joined: Sat Feb 28, 2009 8:34 pm

Re: GNU assembler for HC11

Postby antus » Sat Aug 29, 2009 12:04 pm

Code: Select all
[ant@media bstk]$ make
m6811-elf-as  BSTKhigh.asm -o BSTKhigh.o
m6811-elf-ld -m m68hc11elfb --oformat srec BSTKhigh.o -o BSTKhigh.srec
m6811-elf-ld: warning: cannot find entry symbol _start; defaulting to 00000000
m6811-elf-objcopy -I srec BSTKhigh.srec -O binary BSTKhigh.bin
m6811-elf-as  BSTKlow.asm -o BSTKlow.o
m6811-elf-ld -m m68hc11elfb --oformat srec BSTKlow.o -o BSTKlow.srec
m6811-elf-objcopy -I srec BSTKlow.srec -O binary BSTKlow.bin
cat BSTKlow.bin BSTKhigh.bin > BSTK.bin

[ant@media bstk]$ ls -lh *.bin
-rw-rw-r-- 1 ant ant 128K 2009-08-29 11:37 BSTK.bin
-rw-rw-r-- 1 ant ant  64K 2009-08-29 11:37 BSTKhigh.bin
-rw-rw-r-- 1 ant ant  64K 2009-08-29 11:37 BSTKlow.bin


:thumbup:
Have you read the FAQ? For lots of information and links to significant threads see here: viewtopic.php?f=7&t=1396

User avatar
Posts: 5315
Joined: Sat Feb 28, 2009 8:38 pm
Location: Wellington NZ

Re: GNU assembler for HC11

Postby delcowizzid » Tue Sep 01, 2009 10:00 am

i go away for a week and you bust out the brilliance nice work mate
If Its Got Gas Or Ass Count Me In.if it cant be fixed with a hammer you have an electrical problem

Posts: 67
Joined: Thu Jan 14, 2010 1:03 am

Re: GNU assembler for HC11

Postby sabercatpuck » Thu Jan 14, 2010 1:12 am

I know when I dissasembled the code on my Saturn 128k bin I had to do it in 4 parts. treating each quadrent of the the bin file seperatly. Had alot of jumps outside of code, but got a clean dissasembly out of it. I know on mine there are several routines arround $5666 that the system loads the x register with the jump address, calls the appropriate routine to change a couple pins on port g of the 68hc11F1 and that in turn changes the addressing to the chip's upper memory half banking in 3 different halves.

Return to Disassembly and Reassembly

Who is online

Users browsing this forum: No registered users and 1 guest