Sunday, September 27, 2015
Smart Label Pro - first steps with QBasic
I'll just make a recognizable pattern of some bytes with gaps in between.
CHR$(9) sends the CMD_TAB followed by how many pixels to tab across.
CHR$(4) sends the CMD_PRINT followed by the number of bytes to follow.
OPEN "COM1:9600,N,8,1,CD0,CS0,DS0,OP0,RB65535" FOR RANDOM AS #1
FOR t = 80 TO 150 STEP 8
FOR k = 1 TO 10 'repeat this pattern 10 times, if just 1 line it's hard to see
PRINT #1, CHR$(9); CHR$(t); 'tab bytes
PRINT #1, CHR$(4); CHR$(8 * 3); 'do 24 bytes of data
FOR i = 0 TO 7:
mybyte = 0
FOR j = 0 TO i: mybyte = mybyte + 2 ^ j: NEXT j
PRINT #1, CHR$(mybyte); CHR$(0); CHR$(mybyte);
NEXT i
NEXT k
NEXT t
close #1
and this adds lines between the patterns.
OPEN "COM1:9600,N,8,1,CD0,CS0,DS0,OP0,RB65535" FOR RANDOM AS #1
FOR t = 80 TO 150 STEP 8
FOR k = 1 TO 10
PRINT #1, CHR$(9); CHR$(t); 'tab bytes
PRINT #1, CHR$(4); CHR$(8 * 3); 'do 24 bytes of data
FOR i = 0 TO 7:
mybyte = 0
FOR j = 0 TO i: mybyte = mybyte + 2 ^ j: NEXT j
PRINT #1, CHR$(mybyte); CHR$(0); CHR$(mybyte);
NEXT i
NEXT k
NEXT t
'make a horizontal line - use 254 so there's a one pixel gap in the line
PRINT #1, CHR$(9); CHR$(80);
PRINT #1, CHR$(4); CHR$(220 / 8);
FOR m = 0 TO (220 / 8)
PRINT #1, CHR$(254);
NEXT m
close #1
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment