Ok Steve, more problems.
The following is a line from the listing of bst:
[code]0568(0093) 73 00 7C 5C | skipto1 jmp #start_stp2 [code\]
the next is the same line from the log of BMA:
[code] T0.PC 093 . : jmp 5c7c0093 N D:000 083c01f3 S#093 D=000 083c01f3 [code\]
I am attaching the archive so you can peer at it in your own environment. Stepservo_v3debug-bst-archive-110930-151023.zip I do notice that it also wants to replace nop with wrbyte on a reqular basis:
[code]T0.PC*067 NC : wrbyte 000cafee N D:057 5c7c000f S:1ee 00425249 D=057 5c7c000f [code\]
this line was coded with a nop and not changed dynamically.
The next piece of code I developed so that I could create a constants table of op codes to use for movi instructions.
however when I run it and then list the resulting instructions, all I get is nop. When I examin the opcodes in binary and compare them with the book, they seem to be correct. opcodecongenerator-bst-archive-110930-155601.zip
any ideas?
Jim
The next piece of code I developed so that I could create a constants table of op codes to use for movi instructions. however when I run it and then list the resulting instructions, all I get is nop. When I examin the opcodes in binary and compare them with the book, they seem to be correct.
You get nops because you create nops. mov[dis] only cover operands, opcode and flags (wr, wz, wc). Immediate state (#) and condition code are not touched and remain 0 in your example (I assume BMA shows them as nop in this case). You'd have to OR the assembled instruction with if_always wrbyte 0, 0 (or %1111 << 18) to activate them. HTH
You get nops because you create nops. mov[dis] only cover operands, opcode and flags (wr, wz, wc). Immediate state (#) and condition code are not touched and remain 0 in your example (I assume BMA shows them as nop in this case). You'd have to OR the assembled instruction with if_always wrbyte 0, 0 (or %1111 << 18) to activate them. HTH
Ok, what a learning experience! Kuroneko, I forgot about the next four bits! I bet that if I or each one with the (%1111<<18) before I store it it will disassemble correctly. I only use the reassembled opcodes as check that the reconstituted opcodes are correct. Obviously(now) without the next four bits, the instruction is incomplete. All I wanted to do with this was to take the values dumped from a_abs to xxx to create a table of constants that could be used to correctly use the movi instruction. Once I have completed the table, this little program has no further use other than to serve as a lesson about creating opcodes. If I am using the movi instruction to replace a similar instruction, the condition field will already have contents. This also says that if I were to andn the condition codes with (%1111<<18) I could immediately change that instruction to a nop. Further if I were to preserve the condition field, I could restore the origional instruction by re-inserting the condition code. All interesting ideas just don't know how I would use them just yet.
Steve, I know that the shr tmp1,shift will create a nop, I was expecting to be able to list the instruction created by movi tmp2,tmp1 and get the correct result as a cross check to what I was doing. When I move 0 to each of the destination instructions I really need to move (%1111<<18) into the empty fields and then movi the test instruction. Any further thoughts about the change in destination addresses in pc 93?
Jim
Any further thoughts about the change in destination addresses in pc 93?
Self-inflicted damage I'd say (and Steve already mentioned it). In Cmd_M2 you write jump1 to this location which in itself reads jmp #skipto1 which is exactly what you got. What is it supposed to do?
Kuroneko,
You are absolutely correct. I tripped myself up with my lables. After watching this in animation mode a while, I deceided what I was trying to do was not going to work, so I changed it up a bit and am using JMPRET to interleave the tasks. I have to still figure out how to handle the case of 1 motor finishing its task before the other. Thanks for all your help.
Jim
... at step 08c it is supposed to be a jmp to 064, Not!
It does as it's told. You used an indirect jump.
T0.PC 08c . : jmp 5c3c0064 N D:000 083c01f3 S:064 a0bdba[COLOR="red"]c5[/COLOR] D=000 083c01f3 Z C
T0.PC [COLOR="red"]0c5[/COLOR] C_&_Z : cmpsx c4623918 N D:11c 6120746e S#118 D=11c 6120746e Z C
Another thing I don't quite get, you modify Stp_1 with either _stepf or _steph.
Stp_1 cmp outa,m1mask 'a nusense step for debugger
andn outa,m1mask 'kill all m1 motor pins
mov [COLOR="red"]tmp1[/COLOR],full_step1 'full_step1 has motor position
...
_stepf mov [COLOR="red"]tmp1[/COLOR],full_step1
_steph mov [COLOR="red"]tmp1[/COLOR],half_step1
So tmp1 is loaded with either the full or the half step pattern. But two instructions later you force tmp1 to full_step1 again???
I love having your extra set of eyes on this. Ok, I see where I can simplify things a bit, I will compile the step for full step and only modify it if I need to do a half step. On second thought the steps need to remain aseach pass through must respond to the external input. First time through it might be right but the next pass through it could be wrong. I will re look at the listing and the indirect jmp.
O k I just re-looked at the listing. I put the cmp step at Stp_1 to overcome what I thought was a problem with the debugger. The cmd step that modifies step_1 is modifying the cmp step, not the move step. I will remove the cmp outa,m1 mmask as it gets in the way of what is really supposed to be happening. Step 1 is supposed to have the Full Step or half step depending upon what the CMD_m1 positioned it as.
Thanks
Jim
Ok, I got rid of the indirect jmps and removed the bad step at Stp_1, I found the cmd_2 was loading the wrong full/half step info and corrected that. I can now actually get the program to run a stepper motor! Now to write a demo program that allows the entering of direction,full/half and the number of steps for each motor. that way I will then test if the motors are responding to the input info correctly and stopping after the requested number of steps. Also need to test the ability to set the step rate from the outside world. I think that I will leave the ramping function to the calling object. Again thanks for all the help.
Jim
I am a bit confused. You mention several times that this tool is most effective when used in conjunction with the BSTC list files. How do you intend BMA and BSTC list files to be used together? My guess is you mean the programmer just looks from the list output to the addresses from BMA; aka, no programatic interaction between BMA and the list output.
BSTC -l excerpt:
|===========================================================================|
Object DAT Blocks
|===========================================================================|
0DD4(0000) | org
0DD4(0000) F0 EF BC 0A | adc_read rdlong t1,par wz ' wait for command
0DD8(0001) 00 00 68 5C | if_z jmp #adc_read
0DDC(0002) 70 0A FC 54 | movd :arg,#arg0
0DE0(0003) 77 F0 BC A0 | mov t2,t1
0DE4(0004) 04 F2 FC A0 | mov t3,#4 ' get 4 arguments
0DE8(0005) 78 E0 BC 08 | :arg rdlong arg0,t2 ' store in arg0, arg1, arg2, arg3
0DEC(0006) 6C 0A BC 80 | add :arg, hex200 ' update destination addr for next loop
0DF0(0007) 04 F0 FC 80 | add t2,#4 ' point to next input arg
0DF4(0008) 05 F2 FC E4 | djnz t3,#:arg
0DF8(0009) 12 EE FC 20 | ror t1,#16+2 ' lookup command address
0DFC(000A) 12 EE FC 80 | add t1,#jmptable
0E00(000B) 77 1C BC 50 | movs :tabloc,t1
0E04(000C) 02 EE FC 24 | rol t1,#2
0E08(000D) 03 EE FC 2C | shl t1,#3
0E0C(000E) 00 F0 BC A0 | :tabloc mov t2,0
0E10(000F) 77 F0 BC 28 | shr t2,t1
0E14(0010) FF F0 FC 60 | and t2,#$FF
...
I am a bit confused. You mention several times that this tool is most effective when used in conjunction with the BSTC list files. How do you intend BMA and BSTC list files to be used together? My guess is you mean the programmer just looks from the list output to the addresses from BMA; aka, no programatic interaction between BMA and the list output.
Yes.
The BMA program only gives addresses, instructions, mnemonics, flags, source, and destination fields.
BSTC -ls gives a list file with all the source symbols.
Mapping addresses and source symbols requires some kind of GUI front-end.
Thanks. Scanning through the BSTC .list file is a bit too much work for me, so I made a python script to pick out the relevant DAT sections from the listing. If you don't provide any command line arguments, it will display each of the found DAT blocks in sequence. You can also specify the block that you want to display. You specify by either the block number or the block object name.
I'll post it here in case any body else runs into this problem. I use it with my BSTC compiler script so that every time I download and run to the Propeller a new screen will open up that has the appropriate code for inspection.
import re
import sys
divider = """
|***************************************************************************|
|***************************************************************************|
"""
MAX_OBJECT_NAME_LENGTH = 100
if(len(sys.argv) == 1):
print "Usage: ", sys.argv[0], " filename [block number | objectname] "
sys.exit(1)
data=open(sys.argv[1]).read()
#The below says match anything that says "Object" followed by up to 800 chars, then "Object DAT Blocks", then the assembly
result=re.compile("""(Object.{0,800}?Object DAT Blocks\n.*?)\n\|==========""",re.M|re.DOTALL).findall(data)
if(len(sys.argv) == 2):
for item in result:
print divider
print item
raw_input("Press Enter to continue...")
else:
#Determine if the argument is a object number or name
try:
print result[int(sys.argv[2])]
except ValueError:
#May be multiple matches.
for item in result:
if item.find(sys.argv[2], 0, MAX_OBJECT_NAME_LENGTH) != -1 :
print divider
print item
raw_input("Press Enter to continue...")
print "Number of assembly objects in compiled program:", len(result)
print ""
raw_input("Press Enter to exit...")
ps: the forum prohibits .py files from being uploaded, so I've zipped it.
Thanks. Scanning through the BSTC .list file is a bit too much work for me, so I made a python script to pick out the relevant DAT sections from the listing. If you don't provide any command line arguments, it will display each of the found DAT blocks in sequence. You can also specify the block that you want to display. You specify by either the block number or the block object name.
I'll post it here in case any body else runs into this problem. I use it with my BSTC compiler script so that every time I download and run to the Propeller a new screen will open up that has the appropriate code for inspection.
import re
import sys
divider = """
|***************************************************************************|
|***************************************************************************|
"""
MAX_OBJECT_NAME_LENGTH = 100
if(len(sys.argv) == 1):
print "Usage: ", sys.argv[0], " filename [block number | objectname] "
sys.exit(1)
data=open(sys.argv[1]).read()
#The below says match anything that says "Object" followed by up to 800 chars, then "Object DAT Blocks", then the assembly
result=re.compile("""(Object.{0,800}?Object DAT Blocks\n.*?)\n\|==========""",re.M|re.DOTALL).findall(data)
if(len(sys.argv) == 2):
for item in result:
print divider
print item
raw_input("Press Enter to continue...")
else:
#Determine if the argument is a object number or name
try:
print result[int(sys.argv[2])]
except ValueError:
#May be multiple matches.
for item in result:
if item.find(sys.argv[2], 0, MAX_OBJECT_NAME_LENGTH) != -1 :
print divider
print item
raw_input("Press Enter to continue...")
print "Number of assembly objects in compiled program:", len(result)
print ""
raw_input("Press Enter to exit...")
ps: the forum prohibits .py files from being uploaded, so I've zipped it.
Comments
The following is a line from the listing of bst:
[code]0568(0093) 73 00 7C 5C | skipto1 jmp #start_stp2 [code\]
the next is the same line from the log of BMA:
[code] T0.PC 093 . : jmp 5c7c0093 N D:000 083c01f3 S#093 D=000 083c01f3 [code\]
I am attaching the archive so you can peer at it in your own environment.
Stepservo_v3debug-bst-archive-110930-151023.zip I do notice that it also wants to replace nop with wrbyte on a reqular basis:
[code]T0.PC*067 NC : wrbyte 000cafee N D:057 5c7c000f S:1ee 00425249 D=057 5c7c000f [code\]
this line was coded with a nop and not changed dynamically.
The next piece of code I developed so that I could create a constants table of op codes to use for movi instructions.
however when I run it and then list the resulting instructions, all I get is nop. When I examin the opcodes in binary and compare them with the book, they seem to be correct.
opcodecongenerator-bst-archive-110930-155601.zip
any ideas?
Jim
I'll have to study the other problem later.
Steve, I know that the shr tmp1,shift will create a nop, I was expecting to be able to list the instruction created by movi tmp2,tmp1 and get the correct result as a cross check to what I was doing. When I move 0 to each of the destination instructions I really need to move (%1111<<18) into the empty fields and then movi the test instruction. Any further thoughts about the change in destination addresses in pc 93?
Jim
You are absolutely correct. I tripped myself up with my lables. After watching this in animation mode a while, I deceided what I was trying to do was not going to work, so I changed it up a bit and am using JMPRET to interleave the tasks. I have to still figure out how to handle the case of 1 motor finishing its task before the other. Thanks for all your help.
Jim
check out attached animated listing and see what happens at step 08c it is supposed to be a jmp to 064, Not!
Stepservo_v3debug-bst-archive-111002-182953.zip
log1002_1830.txt
Thanks for all the help!
Jim
O k I just re-looked at the listing. I put the cmp step at Stp_1 to overcome what I thought was a problem with the debugger. The cmd step that modifies step_1 is modifying the cmp step, not the move step. I will remove the cmp outa,m1 mmask as it gets in the way of what is really supposed to be happening. Step 1 is supposed to have the Full Step or half step depending upon what the CMD_m1 positioned it as.
Thanks
Jim
Jim
BSTC -l excerpt:
Yes.
The BMA program only gives addresses, instructions, mnemonics, flags, source, and destination fields.
BSTC -ls gives a list file with all the source symbols.
Mapping addresses and source symbols requires some kind of GUI front-end.
I'll post it here in case any body else runs into this problem. I use it with my BSTC compiler script so that every time I download and run to the Propeller a new screen will open up that has the appropriate code for inspection.
ps: the forum prohibits .py files from being uploaded, so I've zipped it.