; UPC-A Barcode Generator ; ; Michael Vincent - michael@radicalsoft.org ; http://www.radicalsoft.org ; ; (C) 2000, by Michael Vincent. All rights reserved. ; .nolist #include "tse.inc" .list .org usermem-3 .db $BB,$6D ret .db "TSE",1 ; header prgtitle: .db " Barcode Generator", 0 ; title .dw 60 start: bcall(_clrscrnfull) bcall(_clrtxtshd) bcall(_homeup) ld hl,prompt bcall(_puts) bcall(_newline) bcall(_cursoron) ld ix,inputnum xor a ld (inputlen),a NumInputLoop: ei \ halt bcall(_getcsc) or a jr z,NumInputLoop cp skDel jr z,numbackspace cp skStat jr nz,nostat call _tseForceYield jr start nostat: ld d,0 ld e,a ld hl,chartable-10 add hl,de ld a,(hl) cp '.' jr z,NumInputLoop ld (ix),a inc ix push af ld a,(inputlen) inc a ld (inputlen),a pop af push ix push af bcall(_putc) pop af ld hl,chartable2-10 ld ,0 ld e,a add hl,de ld a,(hl) pop ix ld (ix),a ld a,(inputlen) cp 11 jr nz,NumInputLoop jr numinputdone numbackspace: ld a,(inputlen) or a jr z,NumInputLoop dec ix xor a ld (ix),a ld hl,curcol dec (hl) ld a,$20 ;Space push ix bcall(_putc) ld hl,curcol dec (hl) pop ix jr NumInputLoop numinputdone: bcall(_cursoroff) bcall(_clrscrnfull) bcall(_grbufclr) ld bc,20 ld de,50 bcall(_darkline) ld b,2 ld d,2 bcall(_darkline) ld b,6 ld ix,inputnum leftloop: push bc ld a,(ix) ld b,a ld hl,barcodetableleft-1 ld de,7 leftloop2: add hl,de djnz leftloop2 inc ix pop bc djnz leftloop finishedloop: ei \ halt bcall(_getcsc) or a jr z,finishedloop cp skStat jr nz,nostat2 call _tseForceYield jr finishedloop nostat2: jp start prompt: .db "11-digit #:",0 .db "................." .db "................." chartable: .db "......" .db "..369.....258..." .db ".0147..........." .db "................" .db "................" chartable2: .db "......" .db "..",3,6,9,".....",2,5,8,"..." .db ".",0,1,4,7,"..........." .db "................" .db "................" barcodetableleft: .db 0,0,0,1,1,0,1 .db 0,0,1,1,0,0,1 .db 0,0,1,0,0,1,1 .db 0,1,1,1,1,0,1 .db 0,1,0,0,0,1,1 .db 0,1,1,0,0,0,1 .db 0,1,0,1,1,1,1 .db 0,1,1,1,0,1,1 .db 0,1,1,0,1,1,1 .db 0,0,0,1,0,1,1 extdata: inputlen .equ extdata inputnum .equ extdata+1 .end