use strict; # send a string over the serial port sub sendc($) { my $data = shift; $::ob->write($data); } # send a string prepended by it's 16-bit size sub send_wsize($) { my $data = shift; my ($l, $m); # convert jpg to mci? if ($::jpg2mci == 1) { print "Converting jpeg to MCI\n"; $data = jpg2mci($data); } # sanity checks if (length($data) == 0) { sendc("."); print "No data!\n"; goto SENDWS_DONE; } if (length($data) > 65535) { sendc("?"); } # low and high byte of length $l = chr(length($data) & 255); $m = chr(length($data) >> 8); sendc("!"); fsleep(0.05); # wait while cbm prints loading ... sendc($l . $m . $data); SENDWS_DONE: } return(1);