How is assembly code stored
Richard S.
Posts: 70
If one has an assembly program, how are the instructions stored in memory.· For example the instruction line:
·· MOV·· TEMP, INA
Are the·parts stored sequentially in memory·as MOV, TEMP, INA·· or
are they stored sequentially in memory as INA, TEMP, MOV?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard in Michigan
·· MOV·· TEMP, INA
Are the·parts stored sequentially in memory·as MOV, TEMP, INA·· or
are they stored sequentially in memory as INA, TEMP, MOV?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard in Michigan
Comments
the upper 6 bits are a MOV flag, followed by some flags that say that you want to write the result, but not the carry or zero result and that you want to use the data stored at memory location INA instead of a 9bit immediate, followed by 1111 (always execute condition), followed by 2 9bit literals that point to TEMP then INA's memory locations.
All instructions work off the same 6:4:4:9:9 encoding.
====
The :PinSrc is the address of the io read instruction (mov st2, inb), not a subroutine. Those 2 instructions are checking if the pin number is in the range 0..31 or 32..63 and modifying the io address accordingly with the·muxc instruction·altering the source of the input read between ina and inb which only differ in their low bit.
test··· Pin, #$20·············· wc
· If the pin number is in the range 32..63 the carry is set.· If the pin number is in the range 0..31 the carry is cleared
muxc··· :PinSrc, #%1
··By copying the carry into the low bit of the :PinSrc instruction the instructions source address·gets changed between ina and inb. This replaces the low bit of the address so inb is only used when requested by Pin numbers 32..63.inb will be used if the pin number is 32 or more, ina for 0..31. This should support 64 io pin propellor chips.
The initial read of the inputs (mov st2, ina)·ought to have had the same self modifying code applied to it, but that's a minor detail.
RotaryEncoder aka QuadratureEncoder works well as·a 1 to 16·incremental quadrature encoder interface. I have tested it succesfully on actual quadrature encoders. I have faster versions for smaller numbers of encoder incremental interfaces.
====
I understand his explanation.· There are other areas in the assembly code where registers are changed by the program.· It appeared to me that the 'source, destination, instruction'·is the sequence of stored information...since dynamic register changes appear to occur in that order.·
Does that make sense?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard in Michigan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard in Michigan
I would agree with Mr. Green in that you should crack out the manual and take a gander.