Inline parameters(arguments)

This is where the BIN Hackers and definition junkies discuss the inner workings of the EEC code and hardware. General tuning questions do not go here. Only technical/hardware-specific/code questions and discussions belong here.

Moderators: cgrey8, EDS50, Jon 94GT, 2Shaker

User avatar
cgrey8
Administrator
Posts: 10565
Joined: Fri Jun 24, 2005 5:54 am
Location: Acworth, Ga (Metro Atlanta)
Contact:

Re: Inline parameters(arguments)

Post by cgrey8 » Sat Nov 07, 2015 2:20 pm

I see that there is a shift. I don't know why there's a shift.
...Always Somethin'

89 Ranger Supercab, 331 w/GT40p heads, ported Explorer lower, Crane Powermax 2020 cam, 1.6RRs, FMS Explorer (GT40p) headers, Slot Style MAF, aftermarket T5 'Z-Spec', 8.8" rear w/3.27s, Powertrax Locker, Innovate LC-1, GUFB, Moates QuarterHorse tuned using BE&EA

Member V8-Ranger.com

tvrfan
Tuning Addict
Posts: 368
Joined: Sat May 14, 2011 11:41 pm
Location: New Zealand

Re: Inline parameters(arguments)

Post by tvrfan » Sat Nov 07, 2015 3:25 pm

I'll stick to my 'clue' approach, so it's not all free....

Those opcodes fall into logical operations, if I can put it that way (bit like a set of algebra or maths statements)

1. You know what 45a9 does.
2. then 45ab and 45ae (you should know what this does now)
3. then 45b1 to 45ba do something sneaky
4. then 45bf and 45c2 (as step 2)
5. then 45c5 is the last step
Ignore any more just for now.

So to step 2, you should be able to state what it does from previous discussions here.
Step 3 - see if you can work out WHAT and WHY, and what the result is.
This step is where mpaton and I probably disagree how to do this, but I can't see how else are we to make sense of this stuff. I'm open to any suggestions.
Try to think of those operations in a more 'maths' way to get the answer perhaps stick in a value and see what happens to it....

here is a piece of code which calls the subroutine at 45a9, in case it helps, and I've helped with data already.

Code: Select all

3fd7: ef,cf,05           call  45a9           Sub1();
3fda: 83,60,8d,00        orw   R0,[R60+8d]    # probably data ?
3fde: c7,e4,fa,38        stb   R38,[Re4+fa]   [Re4-6] = R38;        
3fe2: 01,30              clrw  R30            R30 = 0;
Note that my pseudo code shows the shift as a divide - in this case it's actually NOT a divide as such - Typical - Murphy pops up....
TVR, Triumph (cars), kit cars, classics. Ex IT geek, development and databases.

https://github.com/tvrfan/EEC-IV-disassembler

User avatar
cgrey8
Administrator
Posts: 10565
Joined: Fri Jun 24, 2005 5:54 am
Location: Acworth, Ga (Metro Atlanta)
Contact:

Re: Inline parameters(arguments)

Post by cgrey8 » Sat Nov 07, 2015 7:18 pm

In order for me to understand #3, I need to make sure my understanding of the opcodes are correct. Which was the point of an earlier post. I'll repost...
cgrey8 wrote:...The content of R33 is being put in R34 (45b1). And since R34 is being treated as a word and the instruction is "zero-extended," it's clearing R35 to zero....
Is this correct or is my understanding of the instruction just wrong? If it is wrong, in what way?
cgrey8 wrote:...Now 45ba is where I'm getting confused. It appears the upper nibble of the value that was in R33 was actually a pointer to a register (specifically a register in the R0-R15 range). So the value of that register is added to 0x00F0 and stored in R32. But didn't this just overwrite whatever value was stored in R32 at 45ab? So yeah...I'm confused. Did I misinterpret something or is this exactly what's happening up to this point?
So before I start caring about what the actual values of the registers are, I think it more important that I get confirmation that my understanding of the instructions is correct. IF that's wrong, then it doesn't really matter what I think the content of the registers is. I will be wrong.

To get clarity on exactly what the instructions do, I've tried to find them explained in the eectch98.pdf but all that's there is a brief description of the instruction. Then I looked up the 8096 equivalent and looked up in its tech manual what it said about the instruction and it just had some verbiage about D<-A or something like that that wasn't helpful to me. If there is a better document that better details out the instructions, I should be looking there instead. Point me there, and I'll take another swag at it.
...Always Somethin'

89 Ranger Supercab, 331 w/GT40p heads, ported Explorer lower, Crane Powermax 2020 cam, 1.6RRs, FMS Explorer (GT40p) headers, Slot Style MAF, aftermarket T5 'Z-Spec', 8.8" rear w/3.27s, Powertrax Locker, Innovate LC-1, GUFB, Moates QuarterHorse tuned using BE&EA

Member V8-Ranger.com

ironmanisanemic
Regular
Posts: 175
Joined: Tue May 24, 2011 8:33 pm
Location: Vandenberg AFB, CA

Re: Inline parameters(arguments)

Post by ironmanisanemic » Sat Nov 07, 2015 8:13 pm

https://drive.google.com/folder/d/0B3c0 ... h1ZDA/edit

Check this out. To my knowledge it's the only tech data on the processor that was from ford that leaked to the public.

As far as understanding opcodes, ive been using my Google fu and just searching for those specifc ones, but nothing processor specific. From my understanding opcodes are fairly generic across most processors, there naming convention might just be a little different.

Hope this helps
1989 Ford Bronco:
-393W, Edelbrock Performer RPM heads, ProComp Upper and lower intake, Custom Comp Hyd Roller cam, 10:1 compression, 30lb injectors, 75mm TB, Pro-M 80mm MAF, equal length short tube headers, 2.5 inch y pipe merged into single 3 inch with hooker aerochamber muffler and no cat, QH w/ BE and EA running U4P0, AOD

1995 Ford Mustang GT
-Bone stock minus the QH. 5 Speed. T4M0

jsa
Tuning Addict
Posts: 519
Joined: Sat Nov 23, 2013 7:28 pm
Location: 'straya

Re: Inline parameters(arguments)

Post by jsa » Tue Nov 10, 2015 1:44 am

I've stalled at 45BA.

Code: Select all

3F3B  EF????                     call  L45A9
3F3E  8E00                       word  $008E
3F40  B600                       word  $00B6

or maybe we have
3F3B  EF????                     call  L45A9
3F3E  8E                         byte  $8E
3F3F  00                         byte  $00
3F40  B6                         byte  $B6
3F41  00                         byte  $00


	PC           contains           45A9
	SP           contains           3F3E


45A9  CC36          L45A9   popw  REG_36
			CC is POP DIRECT
			0x3F3E is taken from the top of the stack and stored at R36

	PC           contains           45AB
	SP           contains           ----
	REG_36       contains           3E		Address LSB
	REG_37       contains           3F		Address MSB

45AB  B23732                ldb   REG_32,[REG_36]+
			B2 is LDB INDIRECT
			The address at R37/R36 is 0x3F3E. 0x3F3E has the byte 8E
			8E is copied to R32
			The address at R37/R36 increments by 1 to 0x3F3F

	PC           contains           45AE
	SP           contains           ----
	REG_32       contains           8E		Data Byte
	REG_36       contains           3F		Address LSB
	REG_37       contains           3F		Address MSB

45AE  B23733                ldb   REG_33,[REG_36]+
			B2 is LDB INDIRECT
			The address at R37/R36 is 0x3F3F. 0x3F3F has the byte 00
			00 is copied to R33
			The address at R37/R36 increments by 1 to 0x3F40

	PC           contains           45B1
	SP           contains           ----
	REG_32       contains           8E		Data Byte
	REG_33       contains           00		Data Byte
	REG_36       contains           40		Address LSB
	REG_37       contains           3F		Address MSB

45B1  AC3334                ldzbw REG_34,REG_33
			AC is LDZBW DIRECT
			R33 contains 00 and is Zero Extended to 0000
			The 00 at R33 is stored at R34
			The 00 extension is stored at R35

	PC           contains           45B4
	SP           contains           ----
	REG_32       contains           8E		Data Byte
	REG_33       contains           00		Data Byte
	REG_34       contains           00		Word LSB
	REG_35       contains           00		Word MSB
	REG_36       contains           40		Address LSB
	REG_37       contains           3F		Address MSB

45B4  710F33                an2b  REG_33,#$0F
			71 is AN2B IMMEDIATE
			0F is added to the content of R33
			0F+00=0F The result 0F is stored at R33

	PC           contains           45B7
	SP           contains           ----
	REG_32       contains           8E		Data Byte
	REG_33       contains           0F		Data Byte
	REG_34       contains           00		Word LSB
	REG_35       contains           00		Word MSB
	REG_36       contains           40		Address LSB
	REG_37       contains           3F		Address MSB

45B7  080434                shrw  REG_34,#$04
			08 is SHRW DIRECT
			R34/R35 WORD is 0x0000
			Which is BINARY 00000000 00000000 
			Shifted 4 Right     0000 00000000
			Pad Left with 0 00000000 00000000
			0x0000 is stored to R34/R35
	
	PC           contains           45BA
	SP           contains           ----
	REG_32       contains           8E		Data Byte
	REG_33       contains           0F		Data Byte
	REG_34       contains           00		Data Word LSB
	REG_35       contains           00		Data Word MSB
	REG_36       contains           40		Address LSB
	REG_37       contains           3F		Address MSB



45BA  6735F00032            ad2w  REG_32,$00F0[REG_34]
			67 is AD2W SHORT INDEXED
			R35/R34 contains 0x0000
			Signed Byte 0xF0 evaluates to Decimal -16
Cheers

John

95 Escort RS Cosworth - GHAJ0 / ANTI on a COSY box code
Moates QH & BE
ForDiag

decipha

Re: Inline parameters(arguments)

Post by decipha » Tue Nov 10, 2015 2:48 pm

it doesn't look like your stuck, i didn't go over the stuff above but as far as 45ba you've basically got it

34/35 is accessed as a word, it is ADDED to reg32W along with 0x00F0

it can be expressed as Reg32 += [Reg34 + 00F0]

if may be easier if you think of reg34 as being a pointer and 00f0 as being an offset, if reg34 truly equals 0 then its simply taking the value at register F0

(which usually is base address pointer)

jsa
Tuning Addict
Posts: 519
Joined: Sat Nov 23, 2013 7:28 pm
Location: 'straya

Re: Inline parameters(arguments)

Post by jsa » Tue Nov 10, 2015 4:13 pm

decipha wrote:it doesn't look like your stuck
Thanks, didn't pick up it is long indexed, but sorted now.
Cheers

John

95 Escort RS Cosworth - GHAJ0 / ANTI on a COSY box code
Moates QH & BE
ForDiag

jsa
Tuning Addict
Posts: 519
Joined: Sat Nov 23, 2013 7:28 pm
Location: 'straya

Re: Inline parameters(arguments)

Post by jsa » Sat Nov 14, 2015 2:06 am

Thanks to Sailorbob, TVRfan & Decipha, having got a handle on L45BA I have continued on with the example.

I have fixed an error I made at line 45B4.

A number of lines seem to end up with unknown results, so I have not completed all the detail for follow on lines.

Please have a look and critique away.

Hopefully void of stupid typo's, it all looks good at this point in time.

Code: Select all

3F3B  EF????                     call  L45A9
3F3E  8E00                       word  $008E
3F40  B600                       word  $00B6

	PC           contains           45A9
	SP           contains           3F3E


45A9  CC36          L45A9   popw  REG_36
			CC is POP DIRECT
			0x3F3E is taken from the top of the stack and stored at R36

	PC           contains           45AB
	SP           contains           ----
	REG_36       contains           3E		Address LSB
	REG_37       contains           3F		Address MSB

45AB  B23732                ldb   REG_32,[REG_36]+
			B2 is LDB, 37 is odd so INDIRECT AUTO
			The address at R37/R36 is 0x3F3E. 0x3F3E has the byte 8E
			8E is copied to R32
			The address at R37/R36 increments by 1 to 0x3F3F

	PC           contains           45AE
	SP           contains           ----
	REG_32       contains           8E		Data LSB
	REG_36       contains           3F		Address LSB
	REG_37       contains           3F		Address MSB

45AE  B23733                ldb   REG_33,[REG_36]+
			B2 is LDB, 37 is odd so INDIRECT AUTO
			The address at R37/R36 is 0x3F3F. 0x3F3F has the byte 00
			00 is copied to R33
			The address at R37/R36 increments by 1 to 0x3F40

	PC           contains           45B1
	SP           contains           ----
	REG_32       contains           8E		Data LSB
	REG_33       contains           00		Data MSB
	REG_36       contains           40		Address LSB
	REG_37       contains           3F		Address MSB

45B1  AC3334                ldzbw REG_34,REG_33
			AC is LDZBW DIRECT AUTO
			R33 contains 00 and is Zero Extended to 0000
			The 00 at R33 is stored at R34
			The 00 extension is stored at R35

	PC           contains           45B4
	SP           contains           ----
	REG_32       contains           8E		Data LSB
	REG_33       contains           00		Data MSB
	REG_34       contains           00		Address LSB
	REG_35       contains           00		Address MSB
	REG_36       contains           40		Address LSB
	REG_37       contains           3F		Address MSB

45B4  710F33                an2b  REG_33,#$0F
			71 is AN2B IMMEDIATE, so 0F is a Byte of data
			R33 holds 00
			0F is BINARY 0000 1111
			00 is BINARY 0000 0000
			ANDED BINARY 0000 0000
			0F is added to the content of R33
			
			0F AND 00=00 The result 00 is stored at R33

	PC           contains           45B7
	SP           contains           ----
	REG_32       contains           8E		Data LSB
	REG_33       contains           00		Data MSB
	REG_34       contains           00		Address LSB
	REG_35       contains           00		Address MSB
	REG_36       contains           40		Address LSB
	REG_37       contains           3F		Address MSB

45B7  080434                shrw  REG_34,#$04
			08 is SHRW DIRECT
			R34/R35 WORD is 0x0000
			Which is BINARY 00000000 00000000 
			Shifted 4 Right     0000 00000000
			Pad Left with 0 00000000 00000000
			0x0000 is stored to R34/R35
	
	PC           contains           45BA
	SP           contains           ----
	REG_32       contains           8E		Data LSB
	REG_33       contains           00		Data MSB
	REG_34       contains           00		Address LSB
	REG_35       contains           00		Address MSB
	REG_36       contains           40		Address LSB
	REG_37       contains           3F		Address MSB

45BA  6735F00032            ad2w  REG_32,$00F0[REG_34]
			67 is AD2W, 35 is odd, so LONG INDEXED
			R35/R34 contains 0x0000
			F000 is a data WORD 0x00F0
			0x0000+0x00F0=0x00F0 the target address
			The WORD content of the target address 0x00F0 is not known
			R32 contains 0x008E
			0x008E+Unkown content of target address 0x00F0 is stored at R32
			
	PC           contains           45BF
	SP           contains           ----
	REG_32       contains           ??		Data LSB
	REG_33       contains           ??		Data MSB
	REG_34       contains           00		Address LSB
	REG_35       contains           00		Address MSB
	REG_36       contains           40		Address LSB
	REG_37       contains           3F		Address MSB

45BF  B23734                ldb   REG_34,[REG_36]+
			B2 is LDB, 37 is odd so INDIRECT AUTO
			The address at R37/R36 is 0x3F40. 0x3F40 has the byte B6
			B6 is copied to R34
			The address at R37/R36 increments by 1 to 0x3F41

	PC           contains           45C2
	SP           contains           ----
	REG_32       contains           ??		Data LSB
	REG_33       contains           ??		Data MSB
	REG_34       contains           B6		Address LSB
	REG_35       contains           00		Address MSB
	REG_36       contains           41		Address LSB
	REG_37       contains           3F		Address MSB

45C2  B23735                ldb   REG_35,[REG_36]+
			B2 is LDB, 37 is odd so INDIRECT AUTO
			The address at R37/R36 is 0x3F41. 0x3F41 has the byte 00
			00 is copied to R35
			The address at R37/R36 increments by 1 to 0x3F42

	PC           contains           45C5
	SP           contains           ----
	REG_32       contains           ??		Data LSB
	REG_33       contains           ??		Data MSB
	REG_34       contains           B6		Address LSB
	REG_35       contains           00		Address MSB
	REG_36       contains           42		Address LSB
	REG_37       contains           3F		Address MSB

45C5  C836                  pushw REG_36
			C8 is PUSHW DIRECT
			R36 contains 0x3F42
			0x3F42 is placed on the stack

	PC           contains           45C7
	SP           contains           3F42
	REG_32       contains           ??		Data LSB
	REG_33       contains           ??		Data MSB
	REG_34       contains           B6		Address LSB
	REG_35       contains           00		Address MSB
	REG_36       contains           42		Address LSB
	REG_37       contains           3F		Address MSB

45C7  B23434                ldb   REG_34,[REG_34]
			B2 is LDB, 34 is even so INDIRECT
			The address at R35/R4 is 0x00B6.
			The content of target address 0x00B6 is unknown
			The unknown content is stored at R34

	PC           contains           45CA
	SP           contains           3F42
	REG_32       contains           ??		Data LSB
	REG_33       contains           ??		Data MSB
	REG_34       contains           ??		Address LSB
	REG_35       contains           00		Address MSB
	REG_36       contains           42		Address LSB
	REG_37       contains           3F		Address MSB

45CA  9B320234      L45CA   cmpb  REG_34,$02[REG_32]
			9B is CMPB, 32 is even so SHORT INDEXED
			The content of R32 is unknown
			The content of R34 is unknown
			Signed 0x02 equates to +2
			Target address is unknown address+2

	PC           contains           45CE
	SP           contains           3F42
	REG_32       contains           ??		Data LSB
	REG_33       contains           ??		Data MSB
	REG_34       contains           ??		Address LSB
	REG_35       contains           00		Address MSB
	REG_36       contains           42		Address LSB
	REG_37       contains           3F		Address MSB

45CE  3D9D04                jb    REG_9D,BIT_05,L45D5
			3D is JB, D indicates 5th bit of contents of R9D
			Signed 0x04 equates to +4
			If the 5th bit of BYTE in R9D is 0 then PC is 45D1
			If the 5th bit of BYTE in R9D is 1 then PC is 45D5

45D1  DB0A                  jc    L45DD
			DB is JC, Carry flag is a bit in the Program Status Word
			Signed 0x0A equates to +10
			If the Carry bit of PSW is 0 then PC is 45D3
			If the Carry bit of PSW is 1 then PC is 45DD			

45D3  2002                  sjmp  L45D7
			20 is SJMP
			0x20 is 0010 0000 Binary
			0x02 is 0000 0010 Binary
			Jump offset is signed 000 0000 0010 which equates to +2
			PC is 45D7

45D5  D606          L45D5   jge   L45DD
			D6 is JGE, Negative flag is a bit in the Program Status Word
			Signed 0x06 equates to +6
			If the Negative bit of PSW is 0 then PC is 45DD
			If the Negative bit of PSW is 1 then PC is 45D7

45D7  65020032      L45D7   ad2w  REG_32,#$0002
			65 is AD2W IMMEDIATE
			0x2 is added to the unknown content of R32

45DB  27ED                  sjmp  L45CA
			27 is SJMP
			0x27 is 0010 0111 Binary
			0xED is 1110 1101 Binary
			Jump offset is signed 111 1110 1101 which equates to -19
			PC is 45CA

45DD  71DF9D        L45DD   an2b  REG_9D,#$DF
			71 is AN2B IMMEDIATE, so DF is a Byte of data
			Content of R9D is unknown
			DF is BINARY 11011111
                   
45E0  B23336                ldb   REG_36,[REG_32]+
			B2 is LDB, 33 is odd so INDIRECT AUTO

45E3  B23338                ldb   REG_38,[REG_32]+
			B2 is LDB, 33 is odd so INDIRECT AUTO

45E6  7A3236                sb2b  REG_36,[REG_32]
			7A is SB2B, 32 is even so INDIRECT
			Content of R36= Content of R36 - Content of address from R32

45E9  7A3334                sb2b  REG_34,[REG_32]+
			7A is SB2B, 33 is odd so INDIRECT AUTO
			Content of R36 = Content of R36 - Content of address from R32
			Content of R32 is incremented by 1

45EC  7A3238                sb2b  REG_38,[REG_32]
			7A is SB2B, 32 is even so INDIRECT
			Content of R38= Content of R38 - Content of address from R32
Cheers

John

95 Escort RS Cosworth - GHAJ0 / ANTI on a COSY box code
Moates QH & BE
ForDiag

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests