Davvel Posted January 18, 2016 Share Posted January 18, 2016 This Topic is intended for those who are willing to learn, assist in learning, develop and publish code using GPL, the Graphic Programming Language proprietary to TI 99/4A also known as the GROM Language. To ensure that one can start from scratch and try to dabble a few lines of code in GPL I will list the most basic things that are needed and then show you a very small GPL language program which fills the screen with the letter A. 1. Install python 2.7.11 (Do not install 3.5 as it will not work with the GPL emulator I will propose) https://www.python.org/downloads/ 2. You need an assembler for windows and good documentation according to the assembler chosen. Assembler: https://endlos99.github.io/xdt99/ Documentation : http://www.unige.ch/medecine/nouspikel/ti99/gpl.htm I will assume you install it in C:\XDT99 3. You need a great emulator to run your well crafted virtual cartridges which we shall be creating. Classic 99 is my favourite : http://www.harmlesslion.com/cgi-bin/showprog.cgi?search=Classic99 I will assume you install it in C:\CLASSIC99 4. You need some kind of Editor I prefer Notepad++ : https://notepad-plus-plus.org/ 5. Setting up your assembler > There are clear notes on how to have XGA99 up and running to compile your .GPL code but I will cover this step by step for those who hate reading a lot of material scattered all over the place. Install XDT99, I selected c:\XDT99 folder. Unzip the attached file (xdt99.zip) into C:\XDT99, you can choose a different folder but there are some batch files you would need to change later. This will add a new folder to the standard XDT99 called "myfiles" and also the python program files are in C:\XDT99 (.py files) Point the PATH windows environment variable to point to C:\XDT99 where the.py reside. Please edit C:\XDT99\MYFILES\G.BAT and MG.BAT to point to myfiles and classic99 according to the paths you chose. Please note that all the files you create should be named <filename>G.gpl Example c:\xdt99\myfiles\testG.gpl To compile just go into DOS c:\xdt99\myfiles cd c:\xdt99\myfiles and type G test Note that I did not type G TESTG.GPL as the G.GPL will be auto appended by the G batch file. if no errors just type mg test. This will move TESTG.BIN to CLASSIC99\MODS 6. The last step is to execute the newly created cartridge. Fire Up classic 99 and select Cartridge->User->Open .... navigate to c:\classic99\mods and select the bin file. The TI Program menu will contain the program called TEST in position 2. Have fun... In this post I will place code snippets and BIN files for all to try and enjoy. xdt99.zip 3 Quote Link to comment Share on other sites More sharing options...
+mizapf Posted January 18, 2016 Share Posted January 18, 2016 Here's a tip for MAME/MESS users: This is an empty RPK file for all kinds of GROM-only cartridges. Unzip it, add the GROM file as "contentg.bin", and zip it again as cartridge.rpk. You may have to change the suffix to "zip" if your zipper tool complains about the rpk suffix. You can then try it on MAME/MESS as mess64 ti99_4a -cart cartridge.rpk cartridge.rpk 1 Quote Link to comment Share on other sites More sharing options...
kl99 Posted January 18, 2016 Share Posted January 18, 2016 Joining this GPL Programming Group Quote Link to comment Share on other sites More sharing options...
+mizapf Posted January 18, 2016 Share Posted January 18, 2016 Ehm ... shouldn't this thread better be moved to the development subforum? Quote Link to comment Share on other sites More sharing options...
+Ksarul Posted January 18, 2016 Share Posted January 18, 2016 It should. . .OLDCS1, can you still move threads around? I like this thread--as GPL is one of those uniquely TI things. . . 1 Quote Link to comment Share on other sites More sharing options...
Willsy Posted January 18, 2016 Share Posted January 18, 2016 This is great. Will be installing the software and following the instructions. Top job. This thread should be in the Development Forum. Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted January 18, 2016 Share Posted January 18, 2016 I'm in. ...lee 3 Quote Link to comment Share on other sites More sharing options...
ralphb Posted January 18, 2016 Share Posted January 18, 2016 Great idea, Davvel! Another tip for MESS users: use the "-c" option of xga99 instead of the "-i" option to create an RPK cartridge right away. 3 Quote Link to comment Share on other sites More sharing options...
Davvel Posted January 18, 2016 Author Share Posted January 18, 2016 (edited) As promised earlier this is my first contribution. I must stress that I am still very green on GPL and I am still in my learning phase. So please be kind if anything I write is not using the best practices etc.... Prog1 will fill the entire screen with A and then exit gracefully on pressing any key. Use Notepad++ and save the program as prog1G.gpl Place this file in c:\xdt99\myfiles Go to the folder using DOS Compile with "g prog1" move it to classic99 using "mg prog1" Use Classic99 to run this cartridge. * Prog1* davvel - 18/01/2016* ----------------------------------------------------------------------------------------------------- GROM >6000 Inform the assembler that the address of this GROM is at >6000 AORG >30 Offsets the program by 48 characters to make enough space for the compiler to inject the title and the code necessary to place the Menu Item "PROG1" in position 2 of the TI Program menu. This means that program will start at >6030 which is GROM+AORG * main program * start ALL 65 Fill all the screen with the character 65 (decimal) BACK 0 Set screen color (and text background in text mode). The color value (0 to 15) is defined in the expression. 0=black loop SCAN Scan the keyboard. If any key, joystick button etc... is clicked the COND flag in the GPL STATUS will be set BS done Branch to done if COND is SET (BS=Branch if Set) B loop Unconditional Branch to loop. done EXIT Exit gracefully back to TI splash screen END Required for compiler to know end of source code Same program without comments in case this makes it easier to read/copy Note that the Tab or spaces placed in front of the instructions such as ALL or GROM are required. The left most text such as start or loop is reserved to labels. In fact the compiler parses text as follows: Label (no spaces before it) Instruction (at least 1 space in front of it) Operands, Variables, addresses or operators (Follows an instruction) Comment (Tab + any amount of spaces after your line of code.) GROM >6000 AORG >30 start ALL 65 BACK 0 loop SCAN BS done B loop done EXIT END Try compiling the same code with some intentional errors such as removing tab before comment and leaving just 1 space after your code to start experiencing the different compiler errors that can consume many hours of checking your code for something really small. Edited January 19, 2016 by Davvel Quote Link to comment Share on other sites More sharing options...
RXB Posted January 19, 2016 Share Posted January 19, 2016 Hmm just a suggestion here: LOOP SCAN BR LOOP DONE EXIT I do not see the reason for the B LOOP A branch takes 3 bytes while a BR or BS takes only 2 bytes. Quote Link to comment Share on other sites More sharing options...
Davvel Posted January 19, 2016 Author Share Posted January 19, 2016 Hmm just a suggestion here: LOOP SCAN BR LOOP DONE EXIT I do not see the reason for the B LOOP A branch takes 3 bytes while a BR or BS takes only 2 bytes. RXB, you are right, I agree that in this particular scenario, given the simplicity of the example we can simply Branch if COND is still Reset to Loop. I missed that . It would be required if this same code is expanded a little where we will check which key was pressed and do something about it. This key trapping code would be placed between my "BS Done" and the "B Loop". Quote Link to comment Share on other sites More sharing options...
Davvel Posted January 19, 2016 Author Share Posted January 19, 2016 Prog2G.GPL Fill the screen with the key being pressed. If one presses the letter "A" the program will end. Have fun. Source code and Binary attached. prog2G.zip Quote Link to comment Share on other sites More sharing options...
Willsy Posted January 19, 2016 Share Posted January 19, 2016 Right. That's the perl interpreter, XDT99 assembler installed, and your additional files. PATH environment variables set. I used different paths so edited the files as per your instructions. ALL WORKING! Just assembled prog1G and it worked like a goodun! 1 Quote Link to comment Share on other sites More sharing options...
Asmusr Posted January 19, 2016 Share Posted January 19, 2016 Is GPL assuming fixed locations for the various VDP tables? Otherwise, how does ALL know what to do? 1 Quote Link to comment Share on other sites More sharing options...
+mizapf Posted January 19, 2016 Share Posted January 19, 2016 From TI Intern: GPL ALL: 05A2 D15D MOVB *13,5 Fetch ASCII 05A4 06A0 BL @>08A4 Write VDP address 05A6 08A4 05A8 0207 LI 7,>0300 Screen 05AA 0300 05AC DBC5 MOVB 5,@>FFFE(15) 05AE FFFE 05B0 0607 DEC 7 05B2 16FC JNE >05AC Loop 05B4 020B LI 11,>0070 GPL return address 05B6 0070 05B8 0A37 SLA 7,3 05BA D807 MOVB 7,@>837E New YPT (0) 05BC 837E 05BE 0A87 SLA 7,8 05C0 0937 SRL 7,3 05C2 D807 MOVB 7,@>837F New XPT (0) 05C4 837F 05C6 045B B *11 and on ... 089A D7E0 MOVB @>83EF,*15 Write address VDP 089C 83EF 089E D7C7 MOVB 7,*15 08A0 61CA S 10,7 08A2 045B B *11 Return Write on screen at 0 08A4 0207 LI 7,>4000 08A6 4000 08A8 10F8 JMP >089A Quote Link to comment Share on other sites More sharing options...
Davvel Posted January 19, 2016 Author Share Posted January 19, 2016 (edited) Is GPL assuming fixed locations for the various VDP tables? Otherwise, how does ALL know what to do? Rasmus, Good question, No GPL does not assume fixed locations as you can change VDP registers to point to different memory locations. I am no expert and all I learn is through experimentation. What I assumed was that ALL was intelligent enough to know what to clear but now I remember that VDP registers cannot be read so no program can detect which memory chunk VDP is looking at to draw the screen. I will be soon submitting another example PROG3G which will deal with double buffering by switching the VDP Register 2. I will test ALL with VDP Register 2=2 and get back to you on result. Thanks for pointing this out. Edited January 19, 2016 by Davvel Quote Link to comment Share on other sites More sharing options...
Davvel Posted January 19, 2016 Author Share Posted January 19, 2016 Right. That's the perl interpreter, XDT99 assembler installed, and your additional files. PATH environment variables set. I used different paths so edited the files as per your instructions. ALL WORKING! Just assembled prog1G and it worked like a goodun! I am glad it worked. Please note that many thanks go to everyone in this forum who put their energies for the community for many years. I am a very new contributor (barely a few weeks now) who most probably am still taking more than I am giving. 1 Quote Link to comment Share on other sites More sharing options...
Davvel Posted January 19, 2016 Author Share Posted January 19, 2016 Is GPL assuming fixed locations for the various VDP tables? Otherwise, how does ALL know what to do? Rasmus, "ALL" does not work if you point VDP Register 2 to anything not 0 (default). So as you correctly assumed, ALL only works when the memory used to build the screen is the default memory. Once you start changing it for double buffering etc... "ALL" will not work. I am soon going to post an example (not using "ALL") that shows double buffering in action given that you can still move data into any memory location you want using GPL and then point VDP to that location. Quote Link to comment Share on other sites More sharing options...
Asmusr Posted January 19, 2016 Share Posted January 19, 2016 Rasmus, "ALL" does not work if you point VDP Register 2 to anything not 0 (default). So as you correctly assumed, ALL only works when the memory used to build the screen is the default memory. Once you start changing it for double buffering etc... "ALL" will not work. Thanks for looking into it. Your mentioning of double buffering made me curious as to whether this was really possible in GPL. Quote Link to comment Share on other sites More sharing options...
Willsy Posted January 19, 2016 Share Posted January 19, 2016 Please see the development thread where I am about to post a first draft of a GPL manual. Hopefully site admin will move this thread into the development thread. 1 Quote Link to comment Share on other sites More sharing options...
Davvel Posted January 19, 2016 Author Share Posted January 19, 2016 (edited) All kindly find attached Prog3 which when compared to Prog2 resolves the screen jitter between one screen fill to another. I am using a very simple double buffer technique and cover aspects like VDP registers and XOR/DXOR For those who want to see the end result my attachments will always contain BIN and Source A snippet of the attached is seen below: Prog3G.zip * Prog3* davvel - 19/01/2016* Double Buffering the memory area that controls the screen being displayed to reduce flicker.* You may have noticed that Prog2 flickered when we pressed random keys to switch between one full screen of one character to the next.* In this example which is similar to Prog2 we move the characters in another area of memory and then* instruct the VDP to switch to this new screen once all characters have been moved. So what we see was pre-drawn.* We then draw the memory area which is not being displayed and flip again to the original memory area.* The result is a solid flip between the screen filled with one character to the next* Press = to exit* Please note that I intentionally remove comments from previous program examples which are repeated in this program.* assuming you read the previous program.* In this way I can give more prominence to new comments of new areas covered by this program.* VDP register #2 takes a value from >00 to >0F default = >00. This number is multiplied by >400 and the VDP will build the screen we see from these 1024 bytes starting from R#2 times 1024.* ----------------------------------------------------------------------------------------------------- GROM >6000 Header stored in 6000-6030 AORG >30 Program starts at 6030 Edited January 19, 2016 by Davvel Quote Link to comment Share on other sites More sharing options...
Davvel Posted January 19, 2016 Author Share Posted January 19, 2016 Please see the development thread where I am about to post a first draft of a GPL manual. Hopefully site admin will move this thread into the development thread. Hi Willsy, Thanks for your post. I asked admin to move this thread to development. David Quote Link to comment Share on other sites More sharing options...
Tursi Posted January 19, 2016 Share Posted January 19, 2016 Rasmus, "ALL" does not work if you point VDP Register 2 to anything not 0 (default). So as you correctly assumed, ALL only works when the memory used to build the screen is the default memory. Once you start changing it for double buffering etc... "ALL" will not work. I am soon going to post an example (not using "ALL") that shows double buffering in action given that you can still move data into any memory location you want using GPL and then point VDP to that location. I don't think there are any opcodes besides ALL that have such VDP assumptions, are there? Quote Link to comment Share on other sites More sharing options...
RXB Posted January 20, 2016 Share Posted January 20, 2016 Prog2G.GPL Fill the screen with the key being pressed. If one presses the letter "A" the program will end. Have fun. Source code and Binary attached. prog2G.zip I can not unzip this file and use it? And as I normally use GPL code that works with the RYTE DATA GPL Assembler and the code looks strange to me. Quote Link to comment Share on other sites More sharing options...
Davvel Posted January 20, 2016 Author Share Posted January 20, 2016 I can not unzip this file and use it? And as I normally use GPL code that works with the RYTE DATA GPL Assembler and the code looks strange to me. Not exactly sure about your question on UNZIP. The zip file contains GPL source code for the XGA99 and a BIN file compatible with CLASSIC99 cartridges. I might look into RYTE DATA GPL and see what I can do. 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.