
toggle_printer
        ; this allows us to time the bitsnpieces
        Push     "R0-R2, R14"
        MOV      R0, #2
        MOV      R2, #0
        SWI      XParallel_Op

        ; The clock timings are (supposed to be):
        ;
        ;   Condition                     Time
        ;
        ;   Between a STOP and a START    >= 4.7s
        ;   START hold time               >= 4.0s
        ;   Data hold time                   0.0
        ;   STOP hold time                >= 4.7s
        ;   LOW period of clock           >= 4.7s
        ;   HIGH period of clock          >= 4.0s
        ;   SDA/SCL rise time              < 1.0s
        ;   SDA/SCL fall time              < 300ns
        ;
        ; [I2C bus specification, section 10.0
        ; (original) or section 15.0 (newer, 1992)]
        ;
        ; As we work in normal mode, we determine
        ; the best, and easiest solution is to run
        ; run the time-out to 5s. As it is a 2MHz 
        ; ticker, this requires ten clock ticks.
        SWI      XOS_IntOff
        MOV      R2, #IOC             ; &03200000
        MOV      R0, #&FF
        STRB     R0, [R2, #Timer1WL]  ; &50
        STRB     R0, [R2, #Timer1WH]  ; &54
        STRB     R0, [R2, #Timer1GO]  ; &58

        ; Timer1 is a 16 bit down counter,
        ; clocked at 2MHz.

toggle_printer_delay
        STRB     R0, [R2, #Timer1LO] ; &5C
        LDRB     R0, [R2, #Timer1RL] ; &50
        CMP      R0, #&F5    ; 10 counts (5S) less
        BGT      toggle_printer_delay
        SWI      XOS_IntOn

        Pull     "R0-R2, PC"
