#! perl # # copyright P K JULY 2000 # version 1.0 public release - only outputs mode 4 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 ql4.raw print("\n\nNEW RUN\n"); if (! -e "ql4.raw" ) { print("NO INPUT");exit(0); } open(RAW,"ql4.raw"); open(CNV,"> img_ql4"); $line=0; while ( $line < 256 ) { print("$line\n");&readline();$line++ } sub readline { $px=0; while ( $px < 64 ) { read RAW,$n,24; @twpix = split(//,$n); $ga = ((ord $twpix[1]) > 128) * 128; $gb = ((ord $twpix[4]) > 128) * 64; $gc = ((ord $twpix[7]) > 128) * 32; $gd = ((ord $twpix[10]) > 128) * 16; $ge = ((ord $twpix[13]) > 128) * 8; $gf = ((ord $twpix[16]) > 128) * 4; $gg = ((ord $twpix[19]) > 128) * 2; $gh = ((ord $twpix[22]) > 128) * 1; $ra = ((ord $twpix[0]) > 128) * 128; $rb = ((ord $twpix[3]) > 128) * 64; $rc = ((ord $twpix[6]) > 128) * 32; $rd = ((ord $twpix[9]) > 128) * 16; $re = ((ord $twpix[12]) > 128) * 8; $rf = ((ord $twpix[15]) > 128) * 4; $rg = ((ord $twpix[18]) > 128) * 2; $rh = ((ord $twpix[21]) > 128) * 1; $byteone = chr($ga + $gb + $gc + $gd + $ge + $gf + $gg + $gh); $bytetwo = chr($ra + $rb + $rc + $rd + $re + $rf + $rg + $rh); print(CNV "$byteone$bytetwo"); $px++; } } close(RAW); close(CNV); exit(0);