damosan Posted December 13, 2019 Share Posted December 13, 2019 I'm working on a game using graphics 8 - are there any Linux utilities out there that will let me paint screens at the proper resolution and save to a format convertible to graphics 8? Thanks. Quote Link to comment Share on other sites More sharing options...
ivop Posted December 13, 2019 Share Posted December 13, 2019 The Gimp. I used it for the Atari Invasion Invitro last year. Draw in b/w-mode, save as PBM RAW and strip of the PBM header (which is ASCII) with 'dd' or some other tool and the resulting file is 1bpp graphics 8. 2 Quote Link to comment Share on other sites More sharing options...
damosan Posted December 13, 2019 Author Share Posted December 13, 2019 Thanks! I was about half way done with a Python app. Quote Link to comment Share on other sites More sharing options...
ivop Posted December 14, 2019 Share Posted December 14, 2019 $ ls -l graphics8.pbm -rw-r--r-- 1 ivo ivo 7730 Dec 14 19:19 graphics8.pbm $ echo $((7730-7680)) 50 $ file graphics8.pbm graphics8.pbm: Netpbm image data, size = 320 x 192, rawbits, bitmap $ od -Ax -tx1 graphics8.pbm | head -n 4 000000 50 34 0a 23 20 43 52 45 41 54 4f 52 3a 20 47 49 000010 4d 50 20 50 4e 4d 20 46 69 6c 74 65 72 20 56 65 000020 72 73 69 6f 6e 20 31 2e 31 0a 33 32 30 20 31 39 000030 32 0a ff ff ff ff ff ff ff ff ff ff ff ff ff ff $ od -Ax -ta graphics8.pbm | head -n 4 000000 P 4 nl # sp C R E A T O R : sp G I 000010 M P sp P N M sp F i l t e r sp V e 000020 r s i o n sp 1 . 1 nl 3 2 0 sp 1 9 000030 2 nl del del del del del del del del del del del del del del $ dd if=graphics8.pbm of=graphics8.dat bs=1 skip=50 7680+0 records in 7680+0 records out 7680 bytes (7.7 kB, 7.5 KiB) copied, 0.0194114 s, 396 kB/s $ Here's an example. I specifically chose 320x192, which is 7680 bytes, a well known size, which is exactly a full screen of graphics 8 (or 15). In both od dumps you can clearly see that the header is 50 (0x32) bytes. But that is just to show it's correct to just do filesize minus 7680, which I did at the top Considering you asked about Linux, I suppose you know how to handle the command line 2 Quote Link to comment Share on other sites More sharing options...
atarixle Posted December 15, 2019 Share Posted December 15, 2019 (edited) My BOSS-X System reads native GR8-sized BMP files (320 x 192 x 1 Bit) directly, it's not complicated, just ignore the header and read them from bottom to top. In Turbo-BASIC it might be slower than BGETting the image as one block, but it works without conversion. GRAPHICS 8:SETCOLOR %2,%0,%0:SETCOLOR %1,%0,15:REM bit set = white BGET #%1,DPEEK(88),50:REM ignore the header (its 50 bytes or 42 bytes?) FOR P=DPEEK(88)+7640 TO DPEEK(88) STEP -40:BGET #%1,P,40:NEXT P:REM read stuff from bottom to top This method might not suit your needs, especially in the final product, but it helps skipping at least one step while developing the game. Edited December 15, 2019 by atarixle Quote Link to comment Share on other sites More sharing options...
damosan Posted December 18, 2019 Author Share Posted December 18, 2019 I hacked the following together and it does the trick with the images I'm editing via Gimp. Error checking? What's that? D. #!/usr/bin/python import sys if len( sys.argv ) != 3: print "usage: pbm2raw inputfile outputfile" else: input_data = open( sys.argv[ 1 ] ).readlines() with open( sys.argv[ 2 ], "wb" ) as output_file: output_file.write( input_data[ 3 ] ) 1 Quote Link to comment Share on other sites More sharing options...
ivop Posted December 18, 2019 Share Posted December 18, 2019 (edited) Here's a one-liner: $ ls -l graphics8.pbm -rw-r--r-- 1 ivo ivo 7730 Dec 18 16:30 graphics8.pbm $ sed 1,3d graphics8.pbm > graphics8.raw $ ls -l graphics8.raw -rw-r--r-- 1 ivo ivo 7680 Dec 18 16:30 graphics8.raw $ graphics8.pbm contains random data after the header. Just as your script, it assumes 3 lines of header. Theoretically, that could be more Edit: $ dd if=graphics8.pbm of=graphics8.dat bs=1 skip=50 7680+0 records in 7680+0 records out 7680 bytes (7.7 kB, 7.5 KiB) copied, 0.0216366 s, 355 kB/s $ diff -s graphics8.dat graphics8.raw Files graphics8.dat and graphics8.raw are identical Edited December 18, 2019 by ivop 1 Quote Link to comment Share on other sites More sharing options...
dmsc Posted December 18, 2019 Share Posted December 18, 2019 Another (simpler?) one liner: tail -c 7680 graphics8.pbm > graphics8.raw That works with any header, as only keeps the last 7680 bytes. Have Fun! 3 Quote Link to comment Share on other sites More sharing options...
ivop Posted December 18, 2019 Share Posted December 18, 2019 (edited) Why am I not surprised that dmsc comes up with an even better solution Seems like -c bytes has been an option to tail, like, forever (and a POSIX standard), but I never used it before and was unaware of it. And if your graphics 8 data is of a different dimension, you can use something like $((40*32)) instead of 7680, for only 32 lines of standard width graphics 8. Edited December 18, 2019 by ivop 1 Quote Link to comment Share on other sites More sharing options...
damosan Posted December 19, 2019 Author Share Posted December 19, 2019 18 hours ago, dmsc said: tail -c 7680 graphics8.pbm > graphics8.raw Nice. I like it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.