#! perl # # copyright P K JULY 2000 # version 1.0 public release - only outputs mode 8 files # # written as a service to the QL community # no responsibility will be assumed for anything this program does # use at your own risk # # converts to QL video dump from raw format # Note: QL video is encoded as 2-byte chunks # msb->lsb (Green Flash Red Blue) # mode 8: GFGFGFGF RBRBRBRB # mode 4: GGGGGGGG RRRRRRRR # in mode 4 R+G=White # # input file must be called ql8.raw print("\n\nNEW RUN\n"); if (! -e "ql8.raw" ) { print("NO INPUT");exit(0); } open(RAW,"ql8.raw"); open(CNV,"> img_ql8"); $line=0; while ( $line < 256 ) { print("$line\n");&readline();$line++ } sub readline { $px=0; while ( $px < 64 ) { read RAW,$n,12; @twpix = split(//,$n); $ga = ((ord $twpix[1]) > 128) * 128; $gb = ((ord $twpix[4]) > 128) * 32; $gc = ((ord $twpix[7]) > 128) * 8; $gd = ((ord $twpix[10]) > 128) * 2; $ra = ((ord $twpix[0]) > 128) * 128; $rb = ((ord $twpix[3]) > 128) * 32; $rc = ((ord $twpix[6]) > 128) * 8; $rd = ((ord $twpix[9]) > 128) * 2; $ba = ((ord $twpix[2]) > 128) * 64; $bb = ((ord $twpix[5]) > 128) * 16; $bc = ((ord $twpix[8]) > 128) * 4; $bd = ((ord $twpix[11]) > 128) * 1; $byteone = chr($ga + $gb + $gc + $gd); $bytetwo = chr($ra + $rb + $rc + $rd + $ba + $bb + $bc + $bd); print(CNV "$byteone$bytetwo"); $px++; } } close(RAW); close(CNV); exit(0);