Assembly Basics: Subroutines
Thread Starter
TGO Supporter
Joined: Jul 2000
Posts: 812
Likes: 1
Engine: 5.7L V8
Transmission: 700R4
Assembly Basics: Addressing Modes
I've moved it to here:
http://wasabi.dynu.com:8080/wiki/ind...HC11Addressing
It should be up most of the time. It's running off my cable modem so it may be slow sometimes.
All of the pages in the Wiki are free to edit, so if you have something to add, please do so!
The main page is here:
http://wasabi.dynu.com:8080/wiki/index.php/68HC11
http://wasabi.dynu.com:8080/wiki/ind...HC11Addressing
It should be up most of the time. It's running off my cable modem so it may be slow sometimes.

All of the pages in the Wiki are free to edit, so if you have something to add, please do so!
The main page is here:
http://wasabi.dynu.com:8080/wiki/index.php/68HC11
Last edited by AlexJH; Dec 1, 2004 at 09:07 PM.
Supreme Member
iTrader: (2)
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
The addressing mode is definatly something you need to remember. Its real easy to get burned by not or fogetting to declare what mode you intend to use (example: forgetting the # sign). I make that mistake all the time and then wonder why something doesnt work.
Thread Starter
TGO Supporter
Joined: Jul 2000
Posts: 812
Likes: 1
Engine: 5.7L V8
Transmission: 700R4
What do people think about using a wiki for this?
http://wasabi.dynu.com:8080/wiki/ind...HC11Addressing
A wiki is basically a web page that anyone can edit, so feel free to ask questions at the bottom of the page, make corrections to my stuff, or add helpful links.
http://wasabi.dynu.com:8080/wiki/ind...HC11Addressing
A wiki is basically a web page that anyone can edit, so feel free to ask questions at the bottom of the page, make corrections to my stuff, or add helpful links.
Thread Starter
TGO Supporter
Joined: Jul 2000
Posts: 812
Likes: 1
Engine: 5.7L V8
Transmission: 700R4
Hmmm... weird, I can see it.
I've posted up an intro on how the checksum is calculated, can you see it?
http://wasabi.dynu.com:8080/wiki/ind...68HC11Checksum
I've posted up an intro on how the checksum is calculated, can you see it?
http://wasabi.dynu.com:8080/wiki/ind...68HC11Checksum
Trending Topics
Thread Starter
TGO Supporter
Joined: Jul 2000
Posts: 812
Likes: 1
Engine: 5.7L V8
Transmission: 700R4
Try this:
http://d154-20-206-110.bchsia.telus.net:8080/wiki/
Make sure you're getting the full URL, Internet Explorer doesn't like it if you use port 8080 without the http.
http://d154-20-206-110.bchsia.telus.net:8080/wiki/
Make sure you're getting the full URL, Internet Explorer doesn't like it if you use port 8080 without the http.
Senior Member
Joined: Oct 1999
Posts: 6,621
Likes: 2
Car: 91 Red Sled
Axle/Gears: 10bolt Richmond 3.73 Torsen
Good examples! I especially thank you for that pointer about indexed. I always was a tad confused about it, it made sence but your explination answered a few questions I had. This is how you look through tables stored in the eprom, very useful for the source code that operates our EFI.
Your comments on the limitations were a huge help.
Your comments on the limitations were a huge help.
Senior Member
Joined: Jun 2000
Posts: 998
Likes: 0
From: Tuscaloosa, AL
Car: 91Z, 91RS, '84 Jimmy
Engine: L98, 355, L98
Transmission: 700R, T56, 700R4
I went looking through the wiki site and I must say there's some good info there!! I corrected a couple typos for ya too in the checksum section....typos in load-to-register commands are bad. 
Speaking of the BUA checksum routines.....the two addy's that are stored to the X and D registers that have no known use....they look suspicious to me. $C008 is obviously the addy where the mask ID is stored, but isn't it also the first byte added to find the checksum? $3FF8 is the total number of bytes to the end of addressing, if you start with $C008 as the first byte. I'm thinking this could be used in a decrementing counter so that the code knows when it has all the bytes added to the checksum that it needs. Maybe this was an early idea for a checksum calc. that got scrapped in favor of the current subroutine?? It's well known that GM didn't mind patching the code to get things to work.
I'm afraid I don't know the commands well enough to go through it all to find out......I just started digging into the code a couple weeks ago. I don't even have a pink book yet.

Speaking of the BUA checksum routines.....the two addy's that are stored to the X and D registers that have no known use....they look suspicious to me. $C008 is obviously the addy where the mask ID is stored, but isn't it also the first byte added to find the checksum? $3FF8 is the total number of bytes to the end of addressing, if you start with $C008 as the first byte. I'm thinking this could be used in a decrementing counter so that the code knows when it has all the bytes added to the checksum that it needs. Maybe this was an early idea for a checksum calc. that got scrapped in favor of the current subroutine?? It's well known that GM didn't mind patching the code to get things to work.
I'm afraid I don't know the commands well enough to go through it all to find out......I just started digging into the code a couple weeks ago. I don't even have a pink book yet.
Thread Starter
TGO Supporter
Joined: Jul 2000
Posts: 812
Likes: 1
Engine: 5.7L V8
Transmission: 700R4
Assembly Basics: Subroutines
Thread Starter
TGO Supporter
Joined: Jul 2000
Posts: 812
Likes: 1
Engine: 5.7L V8
Transmission: 700R4
Originally posted by TheGreatJ
Speaking of the BUA checksum routines.....the two addy's that are stored to the X and D registers that have no known use....they look suspicious to me. $C008 is obviously the addy where the mask ID is stored, but isn't it also the first byte added to find the checksum? $3FF8 is the total number of bytes to the end of addressing, if you start with $C008 as the first byte. I'm thinking this could be used in a decrementing counter so that the code knows when it has all the bytes added to the checksum that it needs. Maybe this was an early idea for a checksum calc. that got scrapped in favor of the current subroutine?? It's well known that GM didn't mind patching the code to get things to work.
I'm afraid I don't know the commands well enough to go through it all to find out......I just started digging into the code a couple weeks ago. I don't even have a pink book yet.
Speaking of the BUA checksum routines.....the two addy's that are stored to the X and D registers that have no known use....they look suspicious to me. $C008 is obviously the addy where the mask ID is stored, but isn't it also the first byte added to find the checksum? $3FF8 is the total number of bytes to the end of addressing, if you start with $C008 as the first byte. I'm thinking this could be used in a decrementing counter so that the code knows when it has all the bytes added to the checksum that it needs. Maybe this was an early idea for a checksum calc. that got scrapped in favor of the current subroutine?? It's well known that GM didn't mind patching the code to get things to work.
I'm afraid I don't know the commands well enough to go through it all to find out......I just started digging into the code a couple weeks ago. I don't even have a pink book yet.
Thanks a lot for the typo fix!!
Thread Starter
TGO Supporter
Joined: Jul 2000
Posts: 812
Likes: 1
Engine: 5.7L V8
Transmission: 700R4
I think it's a typo in the BUA hac.
I think this should actually read
maybe it was deliberate... I can delete it if people in the know want it to be there.
I searched through the code and it looks like the subroutine is used a few times in the code for different things like PROM checks and NV (non-volatile) RAM checks.
TheGreatJ: You are exactly right about the uses. Read up on the checksum subroutine doc in the hac and you will see how it is used.
Note that the A and B register can be treated as a single 16 bit register called D.
Code:
; ; Check Socketed device ; LDX #$C008 ; LDD #$3FF8 ; B Cnt'r Last H.U LF32E ; To Ck SUM
Code:
; ; Check Socketed device ; LDX #$C008 ; LDD #$3FF8 ; B Cnt'r Last H.U JSR LF32E ; To Ck SUM
I searched through the code and it looks like the subroutine is used a few times in the code for different things like PROM checks and NV (non-volatile) RAM checks.
TheGreatJ: You are exactly right about the uses. Read up on the checksum subroutine doc in the hac and you will see how it is used.
Note that the A and B register can be treated as a single 16 bit register called D.
Thread Starter
TGO Supporter
Joined: Jul 2000
Posts: 812
Likes: 1
Engine: 5.7L V8
Transmission: 700R4
Assembly Basics: The checksum calculation
http://wasabi.dynu.com:8080/wiki/ind...68HC11Checksum
Y'all are lucky America's Next Top Model is on right now, otherwise the wife would have me doing some housework tonight.
Y'all are lucky America's Next Top Model is on right now, otherwise the wife would have me doing some housework tonight.
Thread Starter
TGO Supporter
Joined: Jul 2000
Posts: 812
Likes: 1
Engine: 5.7L V8
Transmission: 700R4
$58 hacs
Which would be the best $58 hac to start working on? I see two on Moates.net, 58.zip and 58Turbo.zip.
58Turbo.zip has 2 asm files in there, but only one bin file. Of course, I can only get the other .asm to assemble, and I don't see the BCC listed in it any more. It's the one with the filename "58 Disassembly.asm".
On my system it assembles into a 16k file.
For the other file "AYBN_hac.src", the assembler barfs on this:
C7EE F96: fcb $22,$00,$00,$00,$00,$00,$00,$00
C7F6 fcb $00,$00,$00,$00,$00,$00,$00,$00
C7FE fcb $00,$00,$00,$00,$00,$00,$00,$00
C806 fcb $00,$00,$00,$00,$00,$00,$00,$00
C80E fcb $00,$00,$00,$00,$00,$00,$00,$00
C816 fcb $00,$00,$00,$00,$00,$00
And I don't really understand what it means either. Should they be labels?
Does anyone want to help on this project, or have anything further along that I can help with? What I'd like to do is put together a memory map so we can find out where there is extra space on the PROM and in RAM so we can do some cool stuff like add extra tables, put new stuff in the data stream, etc.
58Turbo.zip has 2 asm files in there, but only one bin file. Of course, I can only get the other .asm to assemble, and I don't see the BCC listed in it any more. It's the one with the filename "58 Disassembly.asm".
On my system it assembles into a 16k file.
For the other file "AYBN_hac.src", the assembler barfs on this:
C7EE F96: fcb $22,$00,$00,$00,$00,$00,$00,$00
C7F6 fcb $00,$00,$00,$00,$00,$00,$00,$00
C7FE fcb $00,$00,$00,$00,$00,$00,$00,$00
C806 fcb $00,$00,$00,$00,$00,$00,$00,$00
C80E fcb $00,$00,$00,$00,$00,$00,$00,$00
C816 fcb $00,$00,$00,$00,$00,$00
And I don't really understand what it means either. Should they be labels?
Does anyone want to help on this project, or have anything further along that I can help with? What I'd like to do is put together a memory map so we can find out where there is extra space on the PROM and in RAM so we can do some cool stuff like add extra tables, put new stuff in the data stream, etc.
Supreme Member
iTrader: (2)
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
I might be able to help with a few of the open ends.
I havnt looked at that ecm specifically, but the prom area is added up in order to verify that each byte can be read and isnt corrupt. The computer checks its result against the stored checksum on the prom and if the two match, it continues w/o any error so long as the mask ID isnt set to $AA. The checksum routine probably works by starting at 0xC008 and adding every hex value at each address untill it gets to teh end and then passes the result in one of the registers or accumulators. Overflows arnt an issue as one only cares about the lowermost byte or two. A bad address read or a bit that has changed will reflect in the 16 bit result, causing a checksum error.
I think there probably is a factory test routine that also performs teh checkum again if its requested. I have that in mine, anyway.
EDIT: if you have an ecm that has onboard hardcoded rom then those routines like the mask ID check make alot more sense since some of the extra code is on the prom and the prom and rom need to match.
I havnt looked at that ecm specifically, but the prom area is added up in order to verify that each byte can be read and isnt corrupt. The computer checks its result against the stored checksum on the prom and if the two match, it continues w/o any error so long as the mask ID isnt set to $AA. The checksum routine probably works by starting at 0xC008 and adding every hex value at each address untill it gets to teh end and then passes the result in one of the registers or accumulators. Overflows arnt an issue as one only cares about the lowermost byte or two. A bad address read or a bit that has changed will reflect in the 16 bit result, causing a checksum error.
I think there probably is a factory test routine that also performs teh checkum again if its requested. I have that in mine, anyway.
EDIT: if you have an ecm that has onboard hardcoded rom then those routines like the mask ID check make alot more sense since some of the extra code is on the prom and the prom and rom need to match.
Last edited by dimented24x7; Dec 2, 2004 at 11:43 AM.
Supreme Member
Joined: Jun 2000
Posts: 7,554
Likes: 1
From: In reality
Car: An Ol Buick
Engine: Vsick
Transmission: Janis Tranny Yank Converter
Don't bother checking you mail.
Neither address accepts the file. One quarantines it, and the others too small.
Got another address of then the one from here, and where you've written me from?.
Neither address accepts the file. One quarantines it, and the others too small.
Got another address of then the one from here, and where you've written me from?.
Supreme Member
iTrader: (2)
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
My bad... From the way you wrote it it sounded like you had some questions.
If I can get around to it, Ill try and do an edit.
BTW, anyone think there should be some standards for doing edits, like maybe a section for people to leave their screen names or whatever, a short blurb about the edit, and the date the edit was done? Maybe itll help keep some order and allow someone to be contacted if there are some questions about material added. Just a thought...
EDIT: saw there is a section there that records the IP of those who do edits.
If I can get around to it, Ill try and do an edit.
BTW, anyone think there should be some standards for doing edits, like maybe a section for people to leave their screen names or whatever, a short blurb about the edit, and the date the edit was done? Maybe itll help keep some order and allow someone to be contacted if there are some questions about material added. Just a thought...
EDIT: saw there is a section there that records the IP of those who do edits.
Last edited by dimented24x7; Dec 2, 2004 at 04:34 PM.
Thread Starter
TGO Supporter
Joined: Jul 2000
Posts: 812
Likes: 1
Engine: 5.7L V8
Transmission: 700R4
Originally posted by dimented24x7
My bad... From the way you wrote it it sounded like you had some questions.
If I can get around to it, Ill try and do an edit.
BTW, anyone think there should be some standards for doing edits, like maybe a section for people to leave their screen names or whatever, a short blurb about the edit, and the date the edit was done? Maybe itll help keep some order and allow someone to be contacted if there are some questions about material added. Just a thought...
EDIT: saw there is a section there that records the IP of those who do edits.
My bad... From the way you wrote it it sounded like you had some questions.
If I can get around to it, Ill try and do an edit.
BTW, anyone think there should be some standards for doing edits, like maybe a section for people to leave their screen names or whatever, a short blurb about the edit, and the date the edit was done? Maybe itll help keep some order and allow someone to be contacted if there are some questions about material added. Just a thought...
EDIT: saw there is a section there that records the IP of those who do edits.

Yeah, the wiki software is really cool, I've been playing with it a lot recently.
If you login with a username, it shows your name on the edit page rather than your IP. I'm not sure if this can be avoided, but I'll check in the documentation page. Some people might not want their IP addresses revealed...
EDIT: Checked the docs, you need to create an account if you don't want to reveal your IP.
Last edited by AlexJH; Dec 2, 2004 at 04:57 PM.
Senior Member
Joined: Oct 1999
Posts: 6,621
Likes: 2
Car: 91 Red Sled
Axle/Gears: 10bolt Richmond 3.73 Torsen
What would happen if you didn't run the checksum code at all and the eprom fell out. Would the RFD be triggered still or would the processor just keep chugging along with 0ms pulse widths and just turn the car off?
Thread Starter
TGO Supporter
Joined: Jul 2000
Posts: 812
Likes: 1
Engine: 5.7L V8
Transmission: 700R4
Good question!!
I don't know what RFD means, I'm still learning all of the GM terms...
If the PROM fell out, the code wouldn't run because it wouldn't be there.
I think it would try to jump to the bus error interrupt vector. After that I don't know what it would do, somehow it needs to fall back on the CALPACK. I know that my car still runs if I pull out the PROM, the CEL goes on, etc.
dimented24x7, thanks for the changes!
Grumpy, I've put up some details on the 68HC11 registers:
http://wasabi.dynu.com:8080/wiki/ind...8HC11Registers
I don't know what RFD means, I'm still learning all of the GM terms...
If the PROM fell out, the code wouldn't run because it wouldn't be there.

I think it would try to jump to the bus error interrupt vector. After that I don't know what it would do, somehow it needs to fall back on the CALPACK. I know that my car still runs if I pull out the PROM, the CEL goes on, etc.
dimented24x7, thanks for the changes!
Grumpy, I've put up some details on the 68HC11 registers:
http://wasabi.dynu.com:8080/wiki/ind...8HC11Registers
Senior Member
Joined: Oct 1999
Posts: 6,621
Likes: 2
Car: 91 Red Sled
Axle/Gears: 10bolt Richmond 3.73 Torsen
RFD (Redundant Fueling Device). When the prom gets kicked out the ecm stops sending the signal to the ESC which means you have a really cruid ignition curve based only on engine speed. Next the RFD takes the fueling over based on the raw inputs and the netres (resistor network).
Without the checksum routines, what would the processor know to fall back onto the RFD?
I've been using $AA for my mask ID for years now
.
I don't see any reason for the checksum, I'd rather just remove it all together. Anybody have a reason not too?
Without the checksum routines, what would the processor know to fall back onto the RFD?
I've been using $AA for my mask ID for years now
.I don't see any reason for the checksum, I'd rather just remove it all together. Anybody have a reason not too?
Supreme Member
iTrader: (2)
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Originally posted by JPrevost
What would happen if you didn't run the checksum code at all and the eprom fell out. Would the RFD be triggered still or would the processor just keep chugging along with 0ms pulse widths and just turn the car off?
What would happen if you didn't run the checksum code at all and the eprom fell out. Would the RFD be triggered still or would the processor just keep chugging along with 0ms pulse widths and just turn the car off?
Supreme Member
Joined: Jun 2000
Posts: 7,554
Likes: 1
From: In reality
Car: An Ol Buick
Engine: Vsick
Transmission: Janis Tranny Yank Converter
RTD, from what I've gathered is Redundant Fuel Devise. It's used when the processor fails. No inputs are needed, since there's nothing to process the information. It's an analog, failsafe.
I usually run a checksum. Do enough chips, long enough, and you'll have some fail between engine run cycles. And it when there's no check sum, and no SES it can waste some time trying to figure out what happened. Usually happens on a none cell phone covered area, in lousy weather.
I usually run a checksum. Do enough chips, long enough, and you'll have some fail between engine run cycles. And it when there's no check sum, and no SES it can waste some time trying to figure out what happened. Usually happens on a none cell phone covered area, in lousy weather.
Supreme Member
iTrader: (2)
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Originally posted by JPrevost
I've been using $AA for my mask ID for years now
.
I don't see any reason for the checksum, I'd rather just remove it all together. Anybody have a reason not too?
I've been using $AA for my mask ID for years now
.I don't see any reason for the checksum, I'd rather just remove it all together. Anybody have a reason not too?
Rumer has it that the 6809s, similar to whats in in our ecms, posess the Halt Catch Fire command. According to legend, this instruction can cause the computer to toggle an address line or something so fast that it burns up. Imagine if one of the corrupt values was the hex value for the HCF instruction?
In reality I dont even think our ecms have this.
Supreme Member
iTrader: (2)
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Originally posted by AlexJH
dimented24x7, thanks for the changes!
[/url]
dimented24x7, thanks for the changes!
[/url]
. My fingers need to go on vacation now. Senior Member
Joined: Jun 2000
Posts: 998
Likes: 0
From: Tuscaloosa, AL
Car: 91Z, 91RS, '84 Jimmy
Engine: L98, 355, L98
Transmission: 700R, T56, 700R4
Originally posted by AlexJH
Note that the A and B register can be treated as a single 16 bit register called D.
Note that the A and B register can be treated as a single 16 bit register called D.
And that JSR typo would explain it very well. If I could get my disassembler to work I'd check the .bin myself to see if you're right.
Joined: Apr 2004
Posts: 3,180
Likes: 3
From: Browns Town
Car: 86 Monte SS (730,$8D,G3,AP,4K,S_V4)
Engine: 406 Hyd Roller 236/242
Transmission: 700R4 HomeBrew, 2.4K stall
Axle/Gears: 3:73 Posi, 7.5 Soon to break
Great job AlexJH !! Thanks.
Really good reading.
:yourock:
Really good reading.
:yourock:
Thread Starter
TGO Supporter
Joined: Jul 2000
Posts: 812
Likes: 1
Engine: 5.7L V8
Transmission: 700R4
Thanks Grumpy!
I found a free assembler that will build the 58.zip code. Although I'm not working on that one any more
http://www.mgtek.com/miniide/download/
I found a free assembler that will build the 58.zip code. Although I'm not working on that one any more

http://www.mgtek.com/miniide/download/
Thread
Thread Starter
Forum
Replies
Last Post
skinny z
Engine/Drivetrain/Suspension Parts for Sale
5
Oct 5, 2015 06:23 PM
Dragonsys
Engine/Drivetrain/Suspension Parts for Sale
2
Sep 25, 2015 03:51 PM







