;---------------------------------------------------------------------------
; write error code for SOS into flash memory (starting at 30 0000h)
-; movlw F_ERROR_H ; set table pointer to point to
-; movwf TBLPTRU ; start of flash p3
-; movlw F_SOS_H
-; movwf TBLPTRH
-; movlw F_SOS_L
-; movwf TBLPTRL
-;
+ movlw F_ERROR_H ; set table pointer to point to
+ movwf TBLPTRU ; start of flash p3
+ movlw F_SOS_H
+ movwf TBLPTRH
+ movlw F_SOS_L
+ movwf TBLPTRL
+
; write message into memory, incrementing tbl pointer each time
-;
-; movlw 10101000b
-; movwf TABLAT
-; tblwt*+
-;
-; movlw 11101110b
-; movwf TABLAT
-; tblwt*+
-;
-; movlw 11100010b
-; movwf TABLAT
-; tblwt*+
-;
-; movlw 10100000b
-; movwf TABLAT
-; tblwt*+
+
+ movlw 10101000b
+ movwf TABLAT
+ tblwt*+
+
+ movlw 11101110b
+ movwf TABLAT
+ tblwt*+
+
+ movlw 11100010b
+ movwf TABLAT
+ tblwt*+
+
+ movlw 10100000b
+ movwf TABLAT
+ tblwt*+
;---------------------------------------------------------------------------
; turn LED green if we have made it this far....
; wrapper round readout to flash the per-pic led red&blue for an
; 8-byte msg
-
+morse_msg_start
+ movlw F_ERROR_H ; set table pointer to point to
+ movwf TBLPTRU ; start of flash p3
+ movlw F_SOS_H
+ movwf TBLPTRH
+ movlw F_SOS_L
+ movwf TBLPTRL
+
+ clrf WREG3,0 ; clear loop counter (WREG4)
+
+morse_loop
+ movlw 8
+ cpfslt WREG3,0 ; if loop counter >=8, goto start of msg
+ goto morse_msg_start
+ tblrd*+
+ movff TABLAT,WREG2
+ call readout
+ incf WREG3
+ goto morse_loop