* convert S19 records to binary data BUFBEG equ $4000 BUFEND equ $5000 org $3000 start sty y_tmp ldx #BUFBEG first character ldy #BUFBEG s19a ldd ,x cmpd #$5331 S1? bne done ldd 2,x length bsr hex2 subb #3 don't count addr or cksum stb length leax 8,x point .x to data s1b ldd ,x++ bsr hex2 stb ,y+ dec length bne s1b leax 2,x skip over checksum s19end cmpx #BUFEND past end of buffer? bhs done decode data lda ,x+ cmpa #$20 blo s19end skip control characters leax -1,x ungetc printable character bra s19a done ldy y_tmp rts * convert 2 ASCII characters in .d to binary number in .b hex2 bsr hex1 LSNybble pshs b tfr a,b bsr hex1 MSNybble lslb lslb lslb lslb orb ,s+ rts hex1 cmpb #$39 bls hex1a subb #7 hex1a andb #$0F rts length rmb 1 length of an s19 record y_tmp rmb 2 .y temp storage