Shop OBEX P1 Docs P2 Docs Learn Events
Assembly and tri-state bussing quandry — Parallax Forums

Assembly and tri-state bussing quandry

HarleyHarley Posts: 997
edited 2007-04-29 22:48 in Propeller 1
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.

                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 BakerPaul Baker Posts: 6,351
    edited 2007-04-24 21:21
    You cant inline mathmatics like that in assembly. You must explictily code the operations unless all elements are a compile time constant in which you must declare it as so using the CONSTANT operator.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • HarleyHarley Posts: 997
    edited 2007-04-24 21:52
    Paul Baker said...
    You cant inline mathmatics like that in assembly. You must explictily code the operations unless all elements are a compile time constant in which you must declare it as so using the CONSTANT operator.

    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'... yeah.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Harley Shanko
    h.a.s. designn
  • HarleyHarley Posts: 997
    edited 2007-04-29 22:48
    I don't have all the hardward in place to test this code yet. But am wondering if this implements 'tri-state' conditions properly.

        waitpeq  State, mask       ' wait for request
        andn      OUTA, DTmask  ' zero value in output reg
        or          OUTA, temp      ' before loading byte
        andn      DIRA, DTmask  ' make DTbus pins output
        waitpne  State, mask      ' wait until request terminates
        or          DIRA, DTmask  ' make DTbus tri-state
    
    


    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
Sign In or Register to comment.