Assembly and tri-state bussing quandry
Harley
Posts: 997
I've been progressing in Spin, but now trying to work up tri-state bussing in assembly (for the speed). I find I get errors that I don't quite understand.
Guess part of it is how to mask, move fields when MOV and other commands only allow 9-bit fields. I thought the below code might work, but for some reason the IDE doesn't like the DTstatReg term. Get the error "Expected a constant, unary operator, or "(".
I only began debugging this and at the 'muxnz' got the first error; wish it would post all the other lines in error so one could somehow print out the offenders.
I'm guessing I need to mask out the OUTA register (w/ ANDN) to be able to copy in (w/ OR) the byte into where the tri-state bus is (A16..A23) from the low 8-bits of each 'register' previously loaded from Spin.
Has anyone dealt with tri-state busses yet and have some clues to do this task properly? Wish the 'Propeller Assembly for Dummies' book was out.....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
Guess part of it is how to mask, move fields when MOV and other commands only allow 9-bit fields. I thought the below code might work, but for some reason the IDE doesn't like the DTstatReg term. Get the error "Expected a constant, unary operator, or "(".
I only began debugging this and at the 'muxnz' got the first error; wish it would post all the other lines in error so one could somehow print out the offenders.
org 0 DTbusRW waitpeq STstate,STmask ' wait for Status reg request muxnz OUTA,(DTstatReg & ByteMask) <<16 'move value to output reg andn DIRA,DTDIRmsk ' make DTbus pins output waitpne STstate,STmask ' wait until request terminates or DIRA,DTDIRmsk ' make DTbus tri-state cmp DTStatReg & 1,1 ' ck if MEM command tjnz DTStatRed,1 ' exit if not MEM ' ' (this continues for transferring several other bytes of info; has been shortened) ' ByteMask long $0000_00FF DTbusMask long $00FF_0000 DTstatReg long 0 STstate long 0000_0002 ' A1 STmask long 0000_00C7 DTDIRmsk long 00FF_0000 LOstate long 0 ' A0..A2 low HIstate long 1 ' A0 HI DATstate long 3 ' A1, A2 HI WrDTbusMsk long 8 ' A4 active LO
I'm guessing I need to mask out the OUTA register (w/ ANDN) to be able to copy in (w/ OR) the byte into where the tri-state bus is (A16..A23) from the low 8-bits of each 'register' previously loaded from Spin.
Has anyone dealt with tri-state busses yet and have some clues to do this task properly? Wish the 'Propeller Assembly for Dummies' book was out.....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Thanks Paul. The light is dawning.
Spin is much more 'fun' to work with. Assembly is still down at the nitty-gritty level.
OK!, back to the 'drawing board'...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
And probably the ANDN, OR lines could be before the waitpeq to minimize the time on the bus.
Any comments appreciated....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
Post Edited (Harley) : 4/30/2007 12:15:39 AM GMT