Well there is something very odd with my code. I have tested this with a simple code and it works.
But not in my code.
The veriable in module TxMenuV1e_events_code is Dim Digital1_TP_New_State as word external
The Veriable in module TxMenuV1e_Digital is Dim Digital1_TP_New_State as word
Below is a LIST of the section giving me trouble, This is with the variable “Digital1_TP_New_State” is Dim’ed externaly.
Code: Select all
module TxMenuV1e_events_code
Dim Digital1_TP_New_State as word external
1. ;TxMenuV1e_events_code.mbas, 1015 :: sub procedure Dig1Button1Click()
2. 0x9D006BE8 0x27BDFFFC ADDIU SP, SP, -4
3. ;TxMenuV1e_events_code.mbas, 1017 :: Digital1_TP_New_State.0 = not Digital1_TP_New_State.0
4. 0x9D006BEC 0x802287EA LB R2, Offset(_Digital1_TP_New_State+0)(GP)
5. 0x9D006BF0 0x7C420000 EXT R2, R2, 0, 1
6. 0x9D006BF4 0x38420001 XORI R2, R2, 1
7. 0x9D006BF8 0x304300FF ANDI R3, R2, 255
8. 0x9D006BFC 0x802287EA LB R2, Offset(_Digital1_TP_New_State+0)(GP)
9. 0x9D006C00 0x7C620004 INS R2, R3, 0, 1
10. 0x9D006C04 0xA02287EA SB R2, Offset(_Digital1_TP_New_State+0)(GP)
11. ;TxMenuV1e_events_code.mbas, 1019 :: end sub
12. L_end_Dig1Button1Click:
13. 0x9D006C08 0x03E00008 JR RA
14. 0x9D006C0C 0x27BD0004 ADDIU SP, SP, 4
15. ; end of _Dig1Button1Click
16. _Dig2Button1Click:
17. ;TxMenuV1e_events_code.mbas, 1021 :: sub procedure Dig2Button1Click()
18. 0x9D006BC0 0x27BDFFFC ADDIU SP, SP, -4
19. ;TxMenuV1e_events_code.mbas, 1023 :: Digital1_TP_New_State.1 = not Digital1_TP_New_State.1
20. 0x9D006BC4 0x802287EA LB R2, Offset(_Digital1_TP_New_State+0)(GP)
21. 0x9D006BC8 0x7C420000 EXT R2, R2, 0, 1
22. 0x9D006BCC 0x38420001 XORI R2, R2, 1
23. 0x9D006BD0 0x304300FF ANDI R3, R2, 255
24. 0x9D006BD4 0x802287EA LB R2, Offset(_Digital1_TP_New_State+0)(GP)
25. 0x9D006BD8 0x7C620004 INS R2, R3, 0, 1
26. 0x9D006BDC 0xA02287EA SB R2, Offset(_Digital1_TP_New_State+0)(GP)
27. ;TxMenuV1e_events_code.mbas, 1025 :: end sub
Note that on line 3 the sub "not"’s the Digital1_TP_New_State.0
Appropriately line 5 states
0x9D006BF0 0x7C420000 EXT R2, R2, 0, 1
............................................
^This 0 is correct.
As it is Digital1_TP_New_State.0 to be altered.
However where is goes wrong is line 21
Line 19 which is to "not" the Digital1_TP_New_State.1 now look at line 21
0x9D006BC8 0x7C420000 EXT R2, R2, 0, 1
...........................................
^This 0 is NOT correct it should be a 1
This code alters bit "0" but should alter bit "1"
However if it is dim’ed the other way round it compiles differently
The veriable in module TxMenuV1e_events_code is Dim Digital1_TP_New_State as word
The Veriable in module TxMenuV1e_Digital is Dim Digital1_TP_New_State as word external
Code: Select all
module TxMenuV1e_events_code
Dim Digital1_TP_New_State as word
1. ;TxMenuV1e_events_code.mbas, 1015 :: sub procedure Dig1Button1Click()
2. 0x9D006BE8 0x27BDFFFC ADDIU SP, SP, -4
3. ;TxMenuV1e_events_code.mbas, 1017 :: Digital1_TP_New_State.0 = not Digital1_TP_New_State.0
4. 0x9D006BEC 0x902287EA LBU R2, Offset(_Digital1_TP_New_State+0)(GP)
5. 0x9D006BF0 0x7C420000 EXT R2, R2, 0, 1
6. 0x9D006BF4 0x38420001 XORI R2, R2, 1
7. 0x9D006BF8 0x304300FF ANDI R3, R2, 255
8. 0x9D006BFC 0x902287EA LBU R2, Offset(_Digital1_TP_New_State+0)(GP)
9. 0x9D006C00 0x7C620004 INS R2, R3, 0, 1
10. 0x9D006C04 0xA02287EA SB R2, Offset(_Digital1_TP_New_State+0)(GP)
11. ;TxMenuV1e_events_code.mbas, 1019 :: end sub
12. L_end_Dig1Button1Click:
13. 0x9D006C08 0x03E00008 JR RA
14. 0x9D006C0C 0x27BD0004 ADDIU SP, SP, 4
15. ; end of _Dig1Button1Click
16. _Dig2Button1Click:
17. ;TxMenuV1e_events_code.mbas, 1021 :: sub procedure Dig2Button1Click()
18. 0x9D006BC0 0x27BDFFFC ADDIU SP, SP, -4
19. ;TxMenuV1e_events_code.mbas, 1023 :: Digital1_TP_New_State.1 = not Digital1_TP_New_State.1
20. 0x9D006BC4 0x902287EA LBU R2, Offset(_Digital1_TP_New_State+0)(GP)
21. 0x9D006BC8 0x7C420040 EXT R2, R2, 1, 1
22. 0x9D006BCC 0x38420001 XORI R2, R2, 1
23. 0x9D006BD0 0x304300FF ANDI R3, R2, 255
24. 0x9D006BD4 0x902287EA LBU R2, Offset(_Digital1_TP_New_State+0)(GP)
25. 0x9D006BD8 0x7C620844 INS R2, R3, 1, 1
26. 0x9D006BDC 0xA02287EA SB R2, Offset(_Digital1_TP_New_State+0)(GP)
27. ;TxMenuV1e_events_code.mbas, 1025 :: end sub
Now look as line 21 the “0” is now a “1” which is correct and this code works.
21. 0x9D006BC8 0x7C420040 EXT R2, R2, 1, 1
................................................^The “0” is now a “1” this is correct
The only diference is
TxMenuV1e_events_code is "Dim Digital1_TP_New_State as word" rather than external and
The Veriable in module TxMenuV1e_Digital is "Dim Digital1_TP_New_State as word external"
This is not just Bizarre and confusing but I can not do this kind of operation in module TxMenuV1e_Digital as I get the same problem !!!!
I have also tried moving the dim,s incase there are bridging memory banks but makes no diference.
Could you email me so I can Email the code to you
Regards
Anthony