Parallel pin read in PASM2
So, I am having a bit of "writer's block" / procrastination with writing my first block of inline PASM2. I am not sure if I want to use smart pins to manipulate a series of byte reads from the parallel bus on the W6100 or just do it the old fashioned way, with INA. I looked to some code I wrote 10 years ago, a modification of the FullDuplexSerial I called FullDuplexParallel.
' Receive receive jmpret rxcode,txcode 'run chunk of tx code, then return test rxmask,ina wz ' Is RXF# low? Set Z flag if it is if_nz jmp #receive ' If Z not set, jump to receive label xor outa, rdmask ' Set RD# low mov rxdata, ina ' Read pins set for input or outa, rdmask ' Set RD# high shr rxdata, datapin ' Shift data so that the LSB corisponds with D0 ' Save received byte and inc head rdlong t2,par ' Assign the value of rx_head to t2 add t2,rxbuff ' Increment t2 by the address location of rxbuff wrbyte rxdata,t2 ' Write byte from the rxdata into the address located at t2's value (rx_head + rxbuff) sub t2,rxbuff ' Decrement t2 by the address location of rxbuff ' Increment rx_head add t2,#1 ' Increment t2 by 1 bit (same as rx_head + 1) and t2,#$FF ' Perform AND operation on t2's value with $FF (if > $FF then rollerover) wrlong t2,par ' Write long value of t2 in to the address location of par jmp #receive ' byte done, receive next byte '
How would you handle that when it is INB, 8 pins at pins 32+? Maybe have a value at setup that checks the pin mask and sets a variable with $01FE for P31..P0 or $01FE for P63..P32 and mov from the variable?
Or is the old way dumb, and I should use smart pins?
I am stuck and can't start I hate feeling like this, LOL.