
The ZXSimulator is not open source in the sense that it's a project that others work on. I did include the code so people can see an example of an interpreter in C (in the form of a recursive descent parser).
So, May I take this code in Digital C and use it on my own to play around with it?bwinkel67 wrote: Thu Dec 05, 2024 12:09 am So the Workbench demo is just that zip file that I posted here.
....
maybe once I finish it I would look into going further with an actual prototype written in Digital 'C' SE (that's my favorite QL environment to code). I think it would be interesting just to create a workable mock-up of Workbench 2.1 to show all those Amiga users that it's not that impossible to recreate![]()
I share the code so someone can learn how to write a simple BASIC interpreter.Popopo wrote: Thu Dec 05, 2024 8:57 am So, May I take this code in Digital C and use it on my own to play around with it?
You misunderstand, the Digitial 'C' code does not do anything with a GUI, it's just a BASIC interpreter. Again, the thing that implements the Workbench-like GUI is mostly QDOS with a small SuperBASIC program (below). That's the program you want to modify and it's written in SuperBASIC, so easy to understand:Popopo wrote: Thu Dec 05, 2024 8:57 am If you allow me, I will take it and use it freely. Otherwise I will use another one to start with. That's fine and your work is magic itself and a great demo about how a GUI alternative would be for QL.
Code: Select all
10 REMark Amiga on QL
15 MODE 4: PRINT #0,"Device? ";:INPUT #0,_mdv$
20 LET adr=RESPR(17396): LBYTES _mdv$&"tk2_bin",adr: CALL adr+1380
25 SPJOB 0,0,128
30 EXEC _mdv$&"WBLines_exe"
35 EXEC _mdv$&"WBBasic_exe"
40 INPUT #0,"At OK prompt write BASIC program, switch with Ctrl-C & enter to continue."; stop$
45 LBYTES _mdv$&"QLWB21_scr",131072
50 WINDOW #0,470,64,16,182: PAPER #0,5: INK #0, 0
55 WINDOW #1,470,64,16,182: PAPER #1,5: INK #1, 0
60 WINDOW #2,470,64,16,182: PAPER #2,5: INK #2, 0
65 FOR i=1 TO 7: PRINT #0: PRINT #1: PRINT #2
I should probably add a README file to my ZXSimulator distribution because looking at the code it isn't clear what my intentions (wishes) are. Each .c and .h module has a GPL v3 marking in the header and I'm fine with someone using any portion of that code to add to their project -- i.e. if you want a simple interpreter (or parts of one) that you want to add to your project, use and change that code as you want.Popopo wrote: Thu Dec 05, 2024 8:57 am Of course, in case you allows me to do with the code any modification or distribute it as I please, I will mention you on it (credits).
Just I am afraid to use a code to work around and suddenly discover an author that claim for rights with all my effort falling apart (noway).
So, do you allow me?
Agree with you,bwinkel67 wrote: Thu Dec 05, 2024 11:31 am ...
What I wouldn't want is for someone to take the ZXSimulator project as a whole, put it on GitHub, and subsequently started releasing variations of my emulator (I might put it on GitHub someday when I have a bit more time). So the project as a whole is not under GPL v3...again, I need a README to specify that. The QL community is so small that I've never been worried about that and so, as a teacher, I kind of wanted the code shared as a learning tool and if parts of it could help someone, that would be excellent.
So the BASIC script starts up two programs, a compiled BASIC program called Baton Twirler that used Supercharge to compile, and a BASIC interpreter that used Digital 'C' SE to compile. The BASIC interpreter loads fine but the Baton Twriler seems to not load. You seem to get an error from the Supercharged executable that the original BASIC halted at line 140. Here is the original BASIC code:Popopo wrote: Sat Dec 14, 2024 10:35 pm After testing it with my real QL and at the end a ram expansion, I don't understand how to get the whole demo working properly.
Do you mind to check this video where I was testing my expansion RAM card (derived from Alvaro's one) and got some troubles to make the demo working as you do in your screenshot?
https://www.facebook.com/551014941/vide ... 082276876/
Code: Select all
100 REMark =============================
105 REMark ********* BATON_bas *********
110 REMark =============================
115 :
120 REMark Graphic Simulation of a Baton
125 REMark QLWorld Issue May 1990
130 REMark Contributed by Peter Hale
135 REMark Modification by Ed Kingsley
140 REMark BATON_ex is a compiled version
145 REMark Read BATON_doc for Info
150 :
200 WINDOW 512,250,0,0
210 PAPER 0:INK 5:CLS:PRINT\\\"BATON TWIRLER":INK 2:PRINT\\\ "SELECT NUMBER OF TRAILING IMAGES"\"INPUT A NUMBER BETWEEN 1 & 45 ";:INK 7:INPUT R
220 PAPER 0: CLS
230 DIM ypos1(50): DIM xpos1(50)
240 DIM ypos2(50): DIM xpos2(50)
250 x1inc = 1.9 : x2inc = 2.7
260 y1inc = 2.7 : y2inc = 3.1
270 x1pos = 50 : x2pos = 55
280 y1pos = 55 : y2pos = 60
290 xmax = 120
300 ymax = 100
310 index = 0
320 REPeat loop
330 index1=(index) MOD 50
340 index = (index+1) MOD 100
350 INK (2+(index MOD 6))
360 LINE (x1pos),(y1pos) TO (x2pos),(y2pos)
370 xpos1(index1)=x1pos : xpos2(index1)=x2pos
380 ypos1(index1)=y1pos : ypos2(index1)=y2pos
390 x1pos = x1pos+x1inc
400 y1pos = y1pos+y1inc
410 x2pos = x2pos+x2inc
420 y2pos = y2pos+y2inc
430 IF x1pos < 0 THEN
440 x1inc = -x1inc : x1pos = 0
450 END IF
460 IF y1pos < 0 THEN
470 y1inc = -y1inc : y1pos = 0
480 END IF
490 IF x1pos > xmax THEN
500 x1pos=xmax : x1inc = -x1inc
510 END IF
520 IF y1pos > ymax THEN
530 y1pos=ymax : y1inc = -y1inc
540 END IF
550 IF x2pos < 0 THEN
560 x2inc = -x2inc : x2pos = 0
570 END IF
580 IF x2pos > xmax THEN
590 x2pos=xmax : x2inc = -x2inc
600 END IF
610 IF y2pos < 0 THEN
620 y2inc = -y2inc : y2pos = 0
630 END IF
640 IF y2pos > ymax THEN
650 y2pos=ymax : y2inc = -y2inc
660 END IF
670 index2 =(index-R) MOD 50
680 INK 0
690 LINE (xpos1(index2)),(ypos1(index2)) TO (xpos2(index2)),(ypos2(index2))
700 END REPeat loop
SuperCharge stores the start of each line with a code word, then a word with the line number.bwinkel67 wrote: Sun Dec 15, 2024 5:48 am But what's confusing is that's it is compiled code. I'm not quite sure how Supercharge compiles its code...does it keep track of each chunk of code and what line number it is?
how strange, I will try to list this line ASAPbwinkel67 wrote: Sun Dec 15, 2024 5:48 am As you can see, 140 is just a REM statement so that's weird. Perhaps what's going on is that a bad medium error caused the program to stop loading at that area. But what's confusing is that's it is compiled code. I'm not quite sure how Supercharge compiles its code...does it keep track of each chunk of code and what line number it is?
??? in my stock QL it doesn't work at all. I had to use an expansion RAM to get it run, before only in QEmulator with more than 128Kbwinkel67 wrote: Sun Dec 15, 2024 5:48 am I can run it on an unexpanded 128K QL so it's not a memory issue.
After second try it ran as you see in the video. But always I need to run it twice.bwinkel67 wrote: Sun Dec 15, 2024 5:48 am I'd run the whole thing again to see if you can avoid getting the "bad or changed medium" error, as that was the likely culprit (maybe before you run the whole thing, try running the Baton.exe alone by itself to make sure it can run on your system).
How could I see those codes? I get what I have shown in the video, just that.Martin_Head wrote: Sun Dec 15, 2024 2:25 pmSuperCharge stores the start of each line with a code word, then a word with the line number.bwinkel67 wrote: Sun Dec 15, 2024 5:48 am But what's confusing is that's it is compiled code. I'm not quite sure how Supercharge compiles its code...does it keep track of each chunk of code and what line number it is?
So in your program you would get
.
.
code word,$0087 For an empty line 135
code word,$008C For an empty line 140
code word,$0091 For an empty line 145
.
.
Non empty lines would have code after the line number.
If you think something's gone wrong with the copy, you could try decompiling it
I just tried it on Q-emuLator 3.5.1 (the latest version) with 128K and ROMs: QL_ROM_JS & TK2_rom it works. I usually do it in F2, but also tried it to F1. Note it doesn't need TK2_rom since I soft-load it as well. With my stock QL, I use JSU ROM and have the ICE ROM in the back with only 128K.Popopo wrote: Sun Dec 15, 2024 6:00 pm ??? in my stock QL it doesn't work at all. I had to use an expansion RAM to get it run, before only in QEmulator with more than 128K