; acquireline gets HSYNC low -> active video time constant from ARM
; If time constant is 0, skip this line and repeat on next line.
; Otherwise acquireline waits for time constant after HSYNC falling edge.
; Acquireline also preloads Y register with value 8.
acquireline:
wait 1 gpio hsync_gpio ; wait for HSYNC high
pull block; load wait constant from ARM
mov X OSR ; move constant into X
wait 0 gpio hsync_gpio ; wait for HSYNC low
jmp !x acquireline ; if wait time from ARM is 0, that means skip this line
acquireline_wait:
jmp !x-- acquireline_wait
set y 8
; pixloop_512 makes eight 64-bit acquisitions for a total of 512 pixels.
pixloop_512:
pull ; load loop constant (64) from ARM
mov X OSR ; move constant into X
jmp !y acquireline
nop
nop
jmp !y-- pixloopend
pixloop:
jmp !x pixloop_512 ; if x==0, skip this iteration and go back to pixloop_512
nop ; pad loop out to 8 instructions using nops
nop
nop
nop
nop
pixloop_end:
in pins, 1 ; get pixel from Mac
jmp !x-- pixloop ; decrement x and go back to top
; jump is always taken because we handle x==0 case at beginning of loop