Pset Posted December 5, 2013 Share Posted December 5, 2013 (edited) Presenting Aquarius Bitmap Composer Livecode Project With binaries for Mac, Windows and Linux. The stack, ie the project file containing the GUI and the scripts works in Livecode 602 It breaks in higher versions. Progress is the great hair puller. The program opens and save simple texts files containing lines of sixty four ones and zeros. The Aquarius font is the base "custom property" of the stack. Now I need code to Write the roms please. and sleep.mostly sleep. I was working up an introduction to Livecode over at the retrogamecoding forums. Lots to see there. So tired I forgot to post the instructions.Click the around the character window to paint. Export options- White with Alpha, Black with Alpha, Inverted White with Alpha. Exports to png in folder path of the application or stack "/Images/" & the size of the images & the choice Will export 256 images at a go. -- remind me to make a requester. Keyboard commands. Arrow keys scroll the current character in the array Tilde and Tab keys move back and forth through the character set list, applying any changes. Space, Return, and keypad Enter are redunant apply buttons --to be changed. Command key on the Mac, Control key on windows AND S save a text file representing the graphics as binary bits, ie, "0101010" O Open a text file that contains lines of sixty four 1s and 0s representing graphics characters C Copy current graphics V Paste the black of the graphic in memory Z undo, i think i broke this. AquariusBitmapComposerv1.0.0.1.zip Edited December 5, 2013 by Pset 1 Quote Link to comment Share on other sites More sharing options...
Pset Posted December 8, 2013 Share Posted December 8, 2013 And now Aquarius ASCII Draw v0.0.0.1 for Mac OS X, Windows, and Linux. Its very simple. No color, no undo, no special draw tools or converstion functions , but it saves BASIC pokes to a file, or use Command/control X or C to put that on the clipboard and paste into the emulator. You can also paste in text for conversion to Aquarius graphics, for instance if you want to layout instructions, scores, and the like. I've gone too far on this version, with its limitations of editing image source of text characters, but its a good prototype for what I've wanted to do for a good long while. I highly suggest you jump into the source code stack and poke around. Made with Livecode 6.0.2 available here http://downloads.livecode.com/livecode/6_0_2/ There's more to it than this script, but not much, a few more scripts and some custom property data, have a look see /* Aquarius Ascii Drawtool v1.0.0.1 December 7 2013 Use Aquarius character set to draw on simulated 40x25 character screen Left click to put character on canvas at mouse Right click to put empty space character on canvas at mouse Alt/Option key and mouse click on canvas character to make it the current brush Command /Control and: -- N to start a fresh draw -- C to copy BASIC code text for pasting into Aquarius emulator or text editor -- S to save .txt file of BASIC code -- arrowkeys cycle through the character set -- No undo and colors yet. -- 256 images are loaded as internal controls of the stack -- another method would be to load the images as file references--next versions maybe -- the image IDs are reset in sequence from 400000 to 4000255 to match the ASCII when called later. --- drawing on mouse drag is handled by the field script of stack "aquatextchanger" handler : mouseDrawOnField -- defaultImages will reset stack size and the images in case I mangle things in other scripts. --Note if you are going to hack this document, the resizeable of the main stack is set to false --resizing the mainstack and thereby the images it contains, resizes the imageSources of the characters in the "AquaTextChanger" stack field "AquaScreen" */ on defaultImages put 399999 into BID -- IDs below 2999999 are reserved to livecode put 1 into x put 1 into y put 1 into c -- columns counter repeat with i = 1 to number of images of card 1 of this stack set the width of image i to 16 set the height of image i to 16 set the topLeft of image i to x,y set the ID of image i to BID+i add 32 to x add 1 to c if c > 16 then put 1 into x put 1 into c add 16 to y end if end repeat put right of image (number of images of card 1 of this stack) into NewW put bottom of image (number of images of card 1 of this stack) into NewH set the width of this stack to NewW set the height of this stack to NewH end defaultImages --Updates the character preview, colorizes characters, ensures (S)ize is set. on updateImages S put 1 into c put 1 into x put 1 into y if S is empty then put the width of stack (the mainStack of this stack)/16 into S put lineOffset("Gray0",the colorNames) into xo put xo into NC -- repeat with i= 1 to the number of images of group "AquariusCharacterSet" of card 1 of stack (the mainStack of this stack) set the width of image i to S set the height of image i to S set the topLeft of image i to (x*S)-S,(y*S)-S put trunc((x*S)-S) & comma & trunc((y*S)-S) & comma & trunc((x*S)) & comma & trunc((y*s)) & cr after tRects put the ID of image i into TID put the ImageToUse of stack (the mainstack of this stack) into ITC if TID is ITC then set the colorOverlay["color"] of image i to "Red" else set the colorOverlay["color"] of image i to line NC of the colorNames end if add 1 to x add 1 to c add 7 to NC -- differentiate by new color. if c > 16 then put 1 into x put 1 into c add 1 to y end if if NC > xo+48 then put xo into NC -- color range end repeat set the ImageRects of stack(the mainStack of this stack) to char 1 to -2 of tRects end updateImages -- snap grid graphics to size of stack minus the border for export / number of squares across --resize is disabled as it increases the size of the graphics in the text field on resizeStack newWidth if the mouseLoc is within the rect of stack(the mainStack of this stack) then put the topLeft of this stack into TL set the height of this stack to newWidth put trunc((newWidth)/16) into S set the top of stack (the mainStack of this stack) to item 2 of TL set the topleft of group "AquariusCharacterSet" to 1,1 updateImages S set the title of stack (the mainStack of this stack) to "Aquarius Characters" && S else exit resizeStack end if end resizeStack -- command and control key , new file and save. on commandKeyDown cKey if the tool is not "browse tool" then exit commandKeyDown switch cKey case "n" open stack "AquaTextChanger" go to card 1 of stack "AquaTextChanger" fillFieldWithEmptyImages focus nothing break case "s" ask file "Save text file out" if it is not empty then put getPokes() into BASICfile put "file:" & it into tURL if char -4 to -1 of tURL <>".txt" then put ".txt" after tURL put BASICfile into URL tURL end if break case "c" case "x" set the clipboardData["text"] to getPokes() break end switch pass commandKeyDown end commandKeyDown -- arrow keys cycle through the images and set the brush on arrowKey tkey put the ImageToUse of stack (the mainStack of this stack) into TC switch tkey case "left" subtract 1 from TC break case "up" subtract 16 from TC break case "right" add 1 to TC break case "down" add 16 to TC break end switch if TC > 400255 then put 400000 into TC if TC < 400000 then put 400255 into TC set the ImageToUse of stack (the mainStack of this stack) to TC updateImages pass arrowkey end arrowKey -- fill the field with empty clickable images representing default PEEKS of aquarius screen ram. on fillFieldWithEmptyImages if the EmptyField of stack (the mainStack of this stack) is empty then put 1 into p put empty into field 1 of stack "Aquatextchanger" put the ID of image "032.png" of stack (the mainStack of this stack) into SP -- 400032 repeat with l = 1 to 25 repeat with c = 1 to 40 put space after field 1 of stack "Aquatextchanger" set the imageSource of char -1 of field 1 of stack "AquatextChanger" to SP end repeat put cr after field 1 stack "AquaTextChanger" end repeat set the EmptyField of stack (the mainStack of this stack) to HTMLText of field 1 of stack "AquaTextchanger" else set the HTMLText field 1 of stack "AquaTextChanger" to (the EmptyField of stack (the mainStack of this stack) ) end if set the itemToChange of stack (the mainStack of this stack) to "char 1 to 1 of field 1" end fillFieldWithEmptyImages -- change image source of selected character of field "Aquascreen" to image selected in preview on updateText put the ImageToUse of stack (the mainStack of this stack) into TC put the itemToChange of stack (the mainStack of this stack) into ITC if ITC is not empty and TC is not empty then put the mouseDownMemory of stack(the mainStack of this stack) into MDM put cr & word 2 of ITC & comma & TC after MDM -- character number in the list set the mouseDownMemory of stack (the mainStack of this stack) to MDM put "set the imageSource of" && ITC && "to" && TC into todoit end if do todoit end updateText -- extract picture to Aquarius BASIC output function getPokes put 12287 into FCerror put the ID of image "000.png" of stack (the mainStack of this stack)-400000 into tChrBase put the ID of image "032.png" of stack (the mainStack of this stack)-400000 into tSpc put 0 into dcount put 0 into i repeat with c = 1 to 25 repeat with e = 1 to 40 put (the imageSource of char e of line c of field 1 of card 1 of stack "AquaTextChanger" )-400000into PEEK put i && peek & cr after tlist if PEEK is not a number then put 32 into Peek put PEEK into ASC put "32" & comma & tspc into tignore if ASC is not among the items of tignore then add 1 to dcount put i & comma & ASC & cr after TPokes end if add 1 to i end repeat end repeat replace cr with comma in Tpokes put 1 into n put 9990 into LC repeat with i = number of items of Tpokes down to 1 add 1 to n if n = 8 then subtract 5 from LC put cr & LC && "Data" & space before item i of Tpokes put 1 into n end if end repeat subtract 5 from LC put LC && "Data " before tPokes subtract 5 from LC put LC && "Data" && dcount & cr before tPokes replace (comma & cr) with cr in tPokes repeat with d = number of lines of tPokes down to 1 if word 3 of line d of tPokes is empty then delete line d of tPokes end repeat put the BASICHeader of stack (the mainstack of this stack) & cr & char 1 to -2 of Tpokes & cr & "run" & cr into tBASIC return tBASIC end getPokes -- convert text input to imageSource data on convertTextToImageSources tText repeat with C = 1 to number of characters of tText put charToNum(char c of tText) && comma after tTextNums end repeat set the currentInputText of stack (the mainStack of this stack) to tTextNums put the ImageToUse of stack (the mainStack of this stack) into TC put the itemToChange of stack (the mainStack of this stack) into ITC put ITC into oldITC put false into TabBool if tTextNums is not empty then if TC is empty then put 400032 into TC if ITC is empty then put "char 1 to 1 of field 1" into ITC put word 2 of ITC-1 into N put 1 into itemLineCounter set itemDelimiter to comma repeat with i = 1 to number of items of tTextNums put 400000+item i of tTextNums into TC if item i of tTextNums = 9 then put true into TabBool add 2 to N put 4000032 into TC end if add 1 to itemLineCounter if item i of tTextNums = 10 then add (42-itemLineCounter) to N put 1 into itemLineCounter if TabBool is true then subtract 2 from N put false into TabBool end if next repeat else set the imageToUse of stack (the mainStack of this stack) to TC put "char" && N+i && "to" && N+i && "of field 1 of stack" && quote & "AquaTextChanger" & quote into ITC set the itemToChange of stack (the mainStack of this stack) to ITC updateText end if end repeat end if set the itemToChange of stack (the mainStack of this stack) to oldITC put oldITC into field "CurrentLocation" of stack "TextInput" focus nothing end convertTextToImageSources on printchr0to255 put empty into TS put 0 into c repeat with i = 0 to 255 put numTochar(i) after TS add 1 to c if c = 14 then put 0 into c put cr & TS else put space after TS end if end repeat convertTextToImageSources TS end printchr0to255 on preOpenStack set the mouseDownMemory of stack (the mainStack of this stack) to empty set the itemToChange of stack (the mainStack of this stack) to "char 1 to 1 of field 1" set the ImageToUse of stack (the mainStack of this stack) to 400255 -- FullBlock set the currentInputText of stack (the mainStack of this stack) to empty choose browse tool lock messages updateImages (the width of this stack/16)-- set icons to 16x16, they are a mess for some reason when stack opens open stack "AquaTextChanger" fillFieldWithEmptyImages open stack "TextInput" unlock messages put 1 into field "CurrentLocation" of stack "TextInput" put char 1 to -1 of the IntroHelp of stack (the mainStack of this stack) into Halp convertTextToImageSources Halp focus nothing end preOpenStack on ImageToUseClicked put the ImageRects of stack (the mainStack of this stack) into IR repeat with i= 1 to the number of lines of IR put line i of IR into tRect if the mouseLoc is within tRect then set the ImageToUse of stack (the mainStack of this stack) to the ID of image i of group "AquariusCharacterSet" of stack (the mainStack of this stack) updateImages (the width of this stack/16) end if end repeat end ImageToUseClicked AquariusAsciiDrawv0001.zip 4 Quote Link to comment Share on other sites More sharing options...
catsfolly Posted December 8, 2013 Share Posted December 8, 2013 Pset - I gave it a try. It works pretty well so far. Occasionally, I needed a extra right click here and there to get things working. But it was easy to put some characters on the screen and generate a basic program that would put the same characters on the Aquarius. It's a nice way to get familar with the character set. Thanks, Catsfolly Quote Link to comment Share on other sites More sharing options...
jaybird3rd Posted December 8, 2013 Author Share Posted December 8, 2013 Very interesting! Thanks for putting this together; I'll definitely give it a try. Quote Link to comment Share on other sites More sharing options...
Pset Posted December 8, 2013 Share Posted December 8, 2013 The field of the bitmap composer with the window size and file/export options may lock up and require a control key click to reset it. That field needs to be removed and replace with proper menu/key command system. The Command / Control C for the new Ascii Draw seems to be bugged and you need to use Command / Control X to grab the BASIC code into the clipboard. And this may or may not just grab a blank character. There's all kinds of ways to do this different, I just wanted to get this code up so you all have it before I make it too deep for an introduction. Livecode is super simple to use, it should be very much be like learning Aquarius BASIC all over again for you, only with functional programs. You can all can at least prototype interfaces very quickly and then fill the blanks over time. Quote Link to comment Share on other sites More sharing options...
Pset Posted December 12, 2013 Share Posted December 12, 2013 (edited) Coming soon. What is being called The Aquarius TypePSETter for lack of a better name, especialling since it does not handle painting very well at all. As you can guess by the name it uses the PSET commands, draws Aquarius ASCII data enlarged, and of course spits out BASIC code for the image. I struggled to capture the pokes from the same locations, maybe my values are wrong, I was starting at 12288..damnPSET(0,0) is at 12288+40 well now I know. Just a picture preview for now. alpha app to come soon. oh joy. Edited December 12, 2013 by Pset 1 Quote Link to comment Share on other sites More sharing options...
jaybird3rd Posted December 12, 2013 Author Share Posted December 12, 2013 Congratulations! I'd like to do something similar with my own screen editor. One of my inspirations is TheDraw, as I've mentioned, and TheDraw had an add-on ("TDFONTS", I believe it was called) which included several different fonts that were composed using the IBM PC block and line characters. I think there are lots of possibilities for something similar on the Aquarius. Regarding the SuperFont upgrade: I've been taking a closer look at the Aquarius video circuitry lately, and I still think I can implement the upgrade as part of the new Mini Expander, without requiring the user to desolder or socket any chips in the Aquarius computer. I'll need to recreate part of the video circuitry, and tap into some signals that are not provided through the cartridge port. When it's finished, the installation will require removing the RF shielding, running a new cable into the computer and soldering in a few wires (five, by the looks of it), and lifting one pin or cutting one trace on the board, but most users should be able to do it in an hour or so. Removing that shielding will probably be the hardest part! Quote Link to comment Share on other sites More sharing options...
Aquaman Posted December 12, 2013 Share Posted December 12, 2013 Congratulations! I'd like to do something similar with my own screen editor. One of my inspirations is TheDraw, as I've mentioned, and TheDraw had an add-on ("TDFONTS", I believe it was called) which included several different fonts that were composed using the IBM PC block and line characters. I think there are lots of possibilities for something similar on the Aquarius. Regarding the SuperFont upgrade: I've been taking a closer look at the Aquarius video circuitry lately, and I still think I can implement the upgrade as part of the new Mini Expander, without requiring the user to desolder or socket any chips in the Aquarius computer. I'll need to recreate part of the video circuitry, and tap into some signals that are not provided through the cartridge port. When it's finished, the installation will require removing the RF shielding, running a new cable into the computer and soldering in a few wires (five, by the looks of it), and lifting one pin or cutting one trace on the board, but most users should be able to do it in an hour or so. Removing that shielding will probably be the hardest part! That's exiting news you are giving us Quote Link to comment Share on other sites More sharing options...
Aquaman Posted December 12, 2013 Share Posted December 12, 2013 Coming soon. What is being called The Aquarius TypePSETter for lack of a better name, especialling since it does not handle painting very well at all. As you can guess by the name it uses the PSET commands, draws Aquarius ASCII data enlarged, and of course spits out BASIC code for the image. Looks very nice indeed! Quote Link to comment Share on other sites More sharing options...
Pset Posted December 27, 2013 Share Posted December 27, 2013 (edited) Current conditions and C# are keeping me from concentrating on this particular code. 80x70MapMode editor,aka Aquarius TypePSETter lets you draw via the PSET locations. It translates input text to the Aquarius character set and converts the pixel location to PSETs. Control C will copy the BASIC code for the Aquarius to the clipboard. Control S will ask to save that to a text file. Arrow keys will draw lines around the image area. Tab and Tilde will move through the character set. Toggling Live Type will reproduce your text in the Aquarius screen simulation as you type. I'm pretty sure my math for the POKE location is still broken. There was some odd behavior where if a bloxel was hit twice while using the arrow key, it would be enabled (black) in the simulation but turned of for the BASIC program. I want to get this posted as a resource before I get sidetracked. The 'source code' stack is included with the binaries for Mac, Windows, and Linux. You can open and edit that with Livecode, and I encourage you to try that. I'm sticking with Livecode 6.0.2 until they fix the Import/Export Image functions. Oh before I forget my reason for rushing this to post. Jay, please post and explain your algorithms for reading and writing Aquarius Character Roms. I don't know if it will sink in but its a key to the whole point of having cool graphics tools for Aquarius. Or you could just write an import/export for your app that reads those easy to parse lines of 64 bits that I'm using. When you have the time and mind to explore that, it would be really appreciated. Oh and you know, I was thinking, a cool program to make would be a character editor in the Aquarius. You have 8x8 poke locations, you move your cursor with the keyboard, poke in the bits with the space bar, LPRINT or save the data to a CAQ for some other program to convert to a workable ROM.Of course the poor hardware could never enjoy such an awesome program, so nobody ever wrote it. Edited December 27, 2013 by Pset Quote Link to comment Share on other sites More sharing options...
jaybird3rd Posted December 28, 2013 Author Share Posted December 28, 2013 Jay, please post and explain your algorithms for reading and writing Aquarius Character Roms. I don't know if it will sink in but its a key to the whole point of having cool graphics tools for Aquarius. Or you could just write an import/export for your app that reads those easy to parse lines of 64 bits that I'm using. When you have the time and mind to explore that, it would be really appreciated. Oh and you know, I was thinking, a cool program to make would be a character editor in the Aquarius. You have 8x8 poke locations, you move your cursor with the keyboard, poke in the bits with the space bar, LPRINT or save the data to a CAQ for some other program to convert to a workable ROM. Of course the poor hardware could never enjoy such an awesome program, so nobody ever wrote it. The Aquarius Character ROM is plain linear bitmap data. The first 64 bits of the ROM is the 8x8 bitmap for the first character, the next 64 bits is for the second character, and so on through the whole 2K ROM (256 character bitmaps at 64 bits per character adds up to 16,384 bits, or 2 kilobytes). As I recall, the character data in my editor is stored internally as a two-dimensional array of bytes, and I'm just serializing it and writing it to a file as binary data when the characters are saved to a ROM image. I remember a character editor program for the TI-99/4A that was similar to the one you're describing (it was a type-in BASIC program provided in the 99/4A manuals). You could edit the characters using an on-screen interface on the 99/4A, and after you were done, the program would convert it into hexadecimal data that you could use in a DATA statement in your programs. I'm planning on putting together a "sampler" of programs and demos for the new Mini Expander, and this sounds like it would be a good one to include. Quote Link to comment Share on other sites More sharing options...
Pset Posted December 29, 2013 Share Posted December 29, 2013 Knew I should take my cue's from Clu and be dogged and relentless. That information was "All I wanted for Christmas". This bit of Livecode reads ROM .bin file and returns the 256 lines of 64 bits I use to make my other apps go. Hoorah. Should have some ROM .bin I/O action updated apps happening real soon. Happy Holidays! // Livcode convert Aquarius character binary file to 256 lines of 64 1s and 0s function binDecodeAquariusCharacterRom // must initialize variables for binaryDecode global tData, tContainer // file requester to find a rom answer file "Aquarius character set ROM" with filter "*.bin" if it is not empty then put "binfile:" & it into tBinaryFile put URL tBinaryFile into tData // converted 2048 "b"its, of tData to 1 or 0, hold the conversion in tContainer put binaryDecode("b2048", tData, tContainer) into tN //returns number of converted data types // access 64 bits of data in tContainer per step to get 8x8 bitmap put the length of tContainer into tLen repeat with i = 1 to tLen step 64 put char i to (i+63) of tContainer & cr after tBinaryCharacterList end repeat return tBinaryCharacterList end if end binDecodeAquariusCharacterRom 1 Quote Link to comment Share on other sites More sharing options...
Pset Posted January 7, 2014 Share Posted January 7, 2014 Oh Apparently I forgot to attach the 80x70map mode program. So here you go: And a Binary file viewer to. 80x70MapMode.zip 2KRomBinaryDataViewer.zip 2 Quote Link to comment Share on other sites More sharing options...
jaybird3rd Posted January 7, 2014 Author Share Posted January 7, 2014 Cool! It's great to see all these new tools appearing for the Aquarius! Quote Link to comment Share on other sites More sharing options...
Aquaman Posted January 7, 2014 Share Posted January 7, 2014 Indeed, this is indeed another fine tool from the hands of Pset 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.