Page 6 of 6

Re: Graphics program for SMSQ/E

Posted: Mon Dec 20, 2021 4:45 pm
by NormanDunbar
Hi Marcel,

USE, PICK$ and REPLACE were all from Simon N Goodwin's DIY Toolkit. I don;t remember PURGE being a DIY command though, but with my memory, I wouldn't be surprised if it was.


Cheers,
Norm.

Re: Graphics program for SMSQ/E

Posted: Tue Dec 21, 2021 9:40 am
by mk79
NormanDunbar wrote:USE, PICK$ and REPLACE were all from Simon N Goodwin's DIY Toolkit. I don't remember PURGE being a DIY command though, but with my memory, I wouldn't be surprised if it was.
Christ, Norm, you just saved me a ton of time. While looking up these commands in the SBasic online manual I stumbled upon the more complex ones I struggled with in the QDesign extension and only then realized that they are based on the open source BGI package! I will still have to disassemble them because they are extended versions, but god this makes things sooo much easier. Thanks!

Re: Graphics program for SMSQ/E

Posted: Tue Dec 21, 2021 9:46 am
by Martin_Head
mk79 wrote:Again, thanks. I have found 2 curious things:

Code: Select all

17764    READ var05C8(1776,var02D8(var06F0))
The 1776 index is way out of bounds and suspiciously similar to the line number.

Code: Select all

17830  RETurn MK_LIL
All the parameters for MK_LIL are missing.
I had a little look last night.

For the RETurn MK_LIL problem, The decompiler finds a long parameter string and adds it to the MK_LIL, and then PRINT's it to my stack/pipe with PRINT#3,c$!p$. where c$ is the MK_LIL, and p$ is the parameter string. Only when the stack/pipe is read only the MK_LIL comes out.

If I change it to PRINT#3,c$:" ";p$ it then works OK. I'm guessing the ! does not just add them together with a space between the two strings and send them to the pipe, but the two strings are sent separately.

The 1776 in the READ is actually the variable reference 'var06F0' as 1776=$06F0. I had forgotten to convert it to hex and add the 'var'.

I'm not to sure how READ's into a array work exactly. I think the line should be something like 17764 READ var05C8(var02D8). I need to stare at it a bit longer, and think about it.

When I'm done, I will have to decompile all four programs again, and look to see if makes any changes to them.

Re: Graphics program for SMSQ/E

Posted: Tue Dec 21, 2021 2:02 pm
by NormanDunbar
mk79 wrote: Christ, Norm, you just saved me a ton of time.
My work here is done! :D

Re: Graphics program for SMSQ/E

Posted: Tue Dec 21, 2021 3:54 pm
by Martin_Head
OK, I think I have sorted out the 2 problems Marcel found. And done a bit of a rewrite of READ handling

Which has a knock on effect for the other programs
The following lines change in each program, you can just cut and paste them in
fonted -

Code: Select all

14252 var05E0 = MK_AOL (var0750,var05B0%(-1,0 TO 1),var05D8$,var05B8%( ),var05C0$,var05C8(1),var05C8(2),var05C8(3))
17764  READ var05C8(var06F0,var02D8(var06F0))
17830 RETurn MK_LIL (var06E0,var06A8%(-1,0 TO 1),var06A8%(-1,2 TO 3),var06A8%(-1,4 TO 5),var0700$,var06A8%(-1,6),var0708$,var05C8(1),var05C8(2),var05C8(3))
18470  READ var05C8(var06F0,var02D8(var06F0))
18588 RETurn MK_IOL (var06A8%(-1,0 TO 1),var06A8%(-1,2 TO 3),var05C8(0),var06A8%(-1,4),var0708$,var05C8(1),var05C8(2),var05C8(3))
19360 RETurn MK_APPW (var06A8%(  TO 3),var06A8%(4 TO 7),var05C8(0),var0700$,var05C8(1),var05C8(2),var0738%(0),var0738%(1),var0740(0),var0740(1),var0740(2),var0740(3),var0740(4))
19586 RETurn MK_APPW (var06A8%,var06A0%,var05C8(0),var0700$,var05C8(1),var05C8(2),var0738%(0),var0738%(1),var0740(0),var0740(1),var0740(2),var0740(3),var0740(4))
Qdesign (full size)-

Code: Select all

6168 var0BD8 = MCALL (#var0C28,-3,(var0A40% = 1),-4,(var0A40% = 2),-5,(var0A40% = 3),-10,var0C58%)
14672  var0D40 = MCALL (#var0D30\var07F0,var0DE0%,var0BE0,var0BE8%,var0BF0,var0BF8%,-4,var0DF8%,-5,-(var0DE8% > 12))
36204 var0BD8 = MCALL (#var0C28,var07F0,var0DE0%,-4,var12B0%,-5,var12B8%,-6,var12C0%,-7,var1238%,-8,var1240%,-9,var1248%,-11,var12C8%,-12,var12D0%,-13,var08E8%,-14,var1250%)
42566  var0D40 = MCALL (#var0D30\-11,var1488%,-1,-var06F0,-2,-var06F0,-4,-var06F0,-5,-var06F0,var07F0,var0D50,var0BE0,var1478,-12,var1490%)
43504  var0D40 = MCALL (#var0D30\-4,var09C8%,-5,var09D0%,-6,var09E8%,-7,var09F0%,-8,var09E0%,-9,var09D8%,-10,var0A08%,-11,var09F8%,-12,var14A8%,var07F0,var0DE0%)
56888 var0BD8 = MCALL (#var0C28,var07F0,var0800%,-3,(var0A48% = 1),-4,(var0A48% = 2),-5,(var0A48% = 3),-6,(var1700% = 1),-7,(var1708% = 1))
59922 var17B0$ = FILE_SELECT$ (,var17B8$,var06C8$,var17A8$ & var17C0$,11,(var0AC8% + 2),(var0AD8% + 6),1,1)
62936 var1838% = MCALL (#var0C28,-4,var1840%,-5,var1848%,-6,var1850%,-7,var1858%,-8,var18B8,-9,var18C0,-10,var1238%,-11,var1240%,-12,var1248%,-13,var1250%,-14,0,-15,var1860%,-16,var1868%,-17,var18C8,-18,var18D0)
Qdesign (renumbered)-

Code: Select all

2135 var0BD8 = MCALL (#var0C28,-3,(var0A40% = 1),-4,(var0A40% = 2),-5,(var0A40% = 3),-10,var0C58%)
4335  var0D40 = MCALL (#var0D30\var07F0,var0DE0%,var0BE0,var0BE8%,var0BF0,var0BF8%,-4,var0DF8%,-5,-(var0DE8% > 12))
11750 var0BD8 = MCALL (#var0C28,var07F0,var0DE0%,-4,var12B0%,-5,var12B8%,-6,var12C0%,-7,var1238%,-8,var1240%,-9,var1248%,-11,var12C8%,-12,var12D0%,-13,var08E8%,-14,var1250%)
13775  var0D40 = MCALL (#var0D30\-11,var1488%,-1,-var06F0,-2,-var06F0,-4,-var06F0,-5,-var06F0,var07F0,var0D50,var0BE0,var1478,-12,var1490%)
14060  var0D40 = MCALL (#var0D30\-4,var09C8%,-5,var09D0%,-6,var09E8%,-7,var09F0%,-8,var09E0%,-9,var09D8%,-10,var0A08%,-11,var09F8%,-12,var14A8%,var07F0,var0DE0%)
18160 var0BD8 = MCALL (#var0C28,var07F0,var0800%,-3,(var0A48% = 1),-4,(var0A48% = 2),-5,(var0A48% = 3),-6,(var1700% = 1),-7,(var1708% = 1))
19025 var17B0$ = FILE_SELECT$ (,var17B8$,var06C8$,var17A8$ & var17C0$,11,(var0AC8% + 2),(var0AD8% + 6),1,1)
20225 var1838% = MCALL (#var0C28,-4,var1840%,-5,var1848%,-6,var1850%,-7,var1858%,-8,var18B8,-9,var18C0,-10,var1238%,-11,var1240%,-12,var1248%,-13,var1250%,-14,0,-15,var1860%,-16,var1868%,-17,var18C8,-18,var18D0)
Qsnap -

Code: Select all

1546 var0330 = MCALL (#var02F0%\var0290,var0250%,-5,var0260,-6,var0268,-7,var0288,-8,var0280,-9,var0218,-10,var0210,-11,var0258%,-12,var0320%,var0298,var0248%,var02A0,var0248%,-13,var0270)
Qdesign_Config

Code: Select all

844 var01A0 = MCALL (#var00E0%,var0118,var0110,var0128,var0120,var0130,var0120,var0138,var0120)
And here's the current decompiler.

Re: Graphics program for SMSQ/E

Posted: Wed Dec 22, 2021 12:09 am
by mk79
Martin_Head wrote:Which has a knock on effect for the other programs
The following lines change in each program, you can just cut and paste them in
fonted -

Code: Select all

14252 var05E0 = MK_AOL (var0750,var05B0%(-1,0 TO 1),var05D8$,var05B8%( ),var05C0$,var05C8(1),var05C8(2),var05C8(3))
17764  READ var05C8(var06F0,var02D8(var06F0))
17830 RETurn MK_LIL (var06E0,var06A8%(-1,0 TO 1),var06A8%(-1,2 TO 3),var06A8%(-1,4 TO 5),var0700$,var06A8%(-1,6),var0708$,var05C8(1),var05C8(2),var05C8(3))
18470  READ var05C8(var06F0,var02D8(var06F0))
18588 RETurn MK_IOL (var06A8%(-1,0 TO 1),var06A8%(-1,2 TO 3),var05C8(0),var06A8%(-1,4),var0708$,var05C8(1),var05C8(2),var05C8(3))
19360 RETurn MK_APPW (var06A8%(  TO 3),var06A8%(4 TO 7),var05C8(0),var0700$,var05C8(1),var05C8(2),var0738%(0),var0738%(1),var0740(0),var0740(1),var0740(2),var0740(3),var0740(4))
19586 RETurn MK_APPW (var06A8%,var06A0%,var05C8(0),var0700$,var05C8(1),var05C8(2),var0738%(0),var0738%(1),var0740(0),var0740(1),var0740(2),var0740(3),var0740(4))
Very well, thanks! I had a first stab at FontEd and the code first failed in procFun17535. Interestingly this seems to be boilerplate QPtr code as I found the exact same function in the source code of another program (SoQLoban from Wolfgang). The first problem was that line 17765 must be deleted as it should have been replaced by 17764. And then the strange "-1" indexes in MK_LIL et al are apparently supposed to be "TO"s without further indexes to indicate the whole range, so the line should read

Code: Select all

17830 RETurn MK_LIL (var06E0,var06A8%(TO,0 TO 1),var06A8%(TO,2 TO 3),var06A8%(TO,4 TO 5),var0700$,var06A8%(TO,6),var0708$,var05C8(1),var05C8(2),var05C8(3))
After these fixes the program seems to work like the original :-o This is pretty cool, Martin, well done! I have attached a slightly refactored version of it. I'll probably not spend much more time on it, but I think it's pretty cool nonetheless.

Re: Graphics program for SMSQ/E

Posted: Wed Dec 22, 2021 11:10 am
by Martin_Head
mk79 wrote:Very well, thanks! I had a first stab at FontEd and the code first failed in procFun17535. Interestingly this seems to be boilerplate QPtr code as I found the exact same function in the source code of another program (SoQLoban from Wolfgang). The first problem was that line 17765 must be deleted as it should have been replaced by 17764. And then the strange "-1" indexes in MK_LIL et al are apparently supposed to be "TO"s without further indexes to indicate the whole range, so the line should read

Code: Select all

17830 RETurn MK_LIL (var06E0,var06A8%(TO,0 TO 1),var06A8%(TO,2 TO 3),var06A8%(TO,4 TO 5),var0700$,var06A8%(TO,6),var0708$,var05C8(1),var05C8(2),var05C8(3))
After these fixes the program seems to work like the original :-o This is pretty cool, Martin, well done! I have attached a slightly refactored version of it. I'll probably not spend much more time on it, but I think it's pretty cool nonetheless.
I cant see a line 17765 in my fonted version. Apart from the qdesign program that I had to renumber. Generally speaking, any odd numbered lines, Are things that I have done during my initial tidy up.

I'm surprised there wasn't more problems that needed sorting out.

Re: Graphics program for SMSQ/E

Posted: Wed Dec 22, 2021 12:51 pm
by mk79
Martin_Head wrote:I cant see a line 17765 in my fonted version.
Oh, must have been one of my earlier tries then, sorry.
I'm surprised there wasn't more problems that needed sorting out.
Me too, compliments to your decompiler!

Re: Graphics program for SMSQ/E

Posted: Fri Dec 24, 2021 3:42 pm
by Martin_Head
I think I have fixed the TO problem the Marcel had. The only one of the four Qdesign programs effected seems to be fonted

Copy and paste as before

Code: Select all

14252 var05E0 = MK_AOL (var0750,var05B0%( TO ,0 TO 1),var05D8$,var05B8%( TO ),var05C0$,var05C8(1),var05C8(2),var05C8(3))
17192 SPSET var0690,var0678,var0680,var0688,var0660$(0 TO var0670,1 TO var0668)
17830 RETurn MK_LIL (var06E0,var06A8%( TO ,0 TO 1),var06A8%( TO ,2 TO 3),var06A8%( TO ,4 TO 5),var0700$,var06A8%( TO ,6),var0708$,var05C8(1),var05C8(2),var05C8(3))
18588 RETurn MK_IOL (var06A8%( TO ,0 TO 1),var06A8%( TO ,2 TO 3),var05C8(0),var06A8%( TO ,4),var0708$,var05C8(1),var05C8(2),var05C8(3))
And here's the latest decompiler.

I think it's now time for me to shut down for Christmas.

Re: Graphics program for SMSQ/E

Posted: Sun Jan 09, 2022 12:44 am
by mk79
I continued the QDesign thread in a more appropriate forum here: viewtopic.php?f=3&t=4026