EmmBee wrote:pjw wrote:EmmBee, Martin,
There is still a problem with EXT_xxx, but the symptoms have shifted a bit.
I find I get different results on QDOS-Minerva and QPC2. While it works on QDOS, on QPC2 I get error messages of "Keyword must be at start of program", even when EXT_PROC / EXT_FN is already at the start. I have traced this problem to a differing RP_ADDR which does not match the start_adr. How to overcome that I do not know, yet. However, I have come across another puzzle...
At line 19080 in our code, we have ... 19080 DEFine PROCedure Gen_Ext_Proc_FN. During this process, it searches through its own name table looking for a matching name, and if found it does various things and then exits the loop. At least that is how it looks - but it doesn't. The way it's written it only checks the first entry - because of lines 19260 and 19270. I believe this is a mistake and those lines need to be reversed. I would like to ask Martin whether that could have been caused by him when doing the decompile. Alternatively, it might be a hard-coded error in the original code. This mishap could explain the differing results that Per is getting.
Started having a look at this, this afternoon, Got a bit short of time, but this is what I've found
dump from qlib_bas_337
Code: Select all
19080 DEFine PROCedure Gen_Ext_Proc_Fn (class)
19090 IF (RP_ADDR <> start_adr) THEN
19100 program_error 1, 22
19110 ELSE
19120 REPeat loop
19130 Getsym
19140 IF End_of_Stmt% THEN
19150 EXIT loop
19160 END IF
19170 IF (sym1% = 7) THEN
19180 FOR i = 1 TO NumNames%
19190 RNAME name_adr(i), p0%, struct_base%, FOR_ranges%, ExtPFNname$
19200 IF (ExtPFNname$ == sym4$) THEN
19210 unpack
19220 p2% = class
19230 p4% = 1
19240 pack
19250 WNAME name_adr(i), p0%
19260 END IF
19270 EXIT i
19280 END FOR i
19290 ELSE
19300 IF (sym1% = 6) THEN
19310 program_error 0, 24
19320 END IF
19330 END IF
19340 END REPeat loop
19350 END IF
19360 END DEFine Gen_Ext_Proc_Fn
dump from my qlib_bas
Code: Select all
9080 DEFine PROCedure procFun18239 (var08C8)
19090 IF (RP_ADDR <> var08B0) THEN
19100 procFun21693 1,22
19110 ELSE
19120 REPeat var05D8
19130 procFun18547
19140 IF var0630% THEN
19150 EXIT var05D8
19160 END IF
19170 IF (var0450% = 7) THEN
19180 FOR var03E8 = 1 TO var08D0%
19190 RNAME var0578(var03E8),var0580%,var0560%,var0568%,var08D8$
19200 IF (var08D8$ == var07A0$) THEN
19210 procFun18779
19220 var06B0% = var08C8
19230 var06A0% = 1
19240 procFun18833
19250 WNAME var0578(var03E8),var0580%
19260 END IF
19270 EXIT var03E8
19280 END FOR var03E8
19290 ELSE
19300 IF (var0450% = 6) THEN
19310 procFun21693 0,24
19320 END IF
19330 END IF
19340 END REPeat var05D8
19350 END IF
19360 END DEFine procFun18239
dump from my qlib6_bas raw output from the decompiler
Code: Select all
18239 DEFine PROCedure procFun18239 (var08C8)
18248 IF (RP_ADDR <> var08B0) THEN
18262 procFun21693 1,22
18280 ELSE
18286 var05D8 = 0
18294 procFun18547
18300 IF var0630% THEN
18310 GO TO 18510 : END IF
18316 IF (var0450% = 7) THEN
18330 FOR var03E8 = 1 TO var08D0%
18358 RNAME var0578(var03E8),var0580%,var0560%,var0568%,var08D8$
18388 IF (var08D8$ == var07A0$) THEN
18402 procFun18779
18408 var06B0% = var08C8
18416 var06A0% = 1
18424 procFun18833
18430 WNAME var0578(var03E8),var0580%
18448 ELSE
18454 END FOR var03E8 : END IF
18466 ELSE
18472 IF (var0450% = 6) THEN
18486 procFun21693 0,24 : END IF : END IF
18504 GO TO 18294 : END IF
18510 END DEFine procFun18239
Notice the difference around 18430.
dump from my disassembly of the original QLib
Code: Select all
0028733A 0080 08C8
00D6 ori.l #$08C800D6,d0 ......
00287340 06B0008A0001
00D6 addi.l #$008A0001,-$2A(a0,d0.w) ........
00287348 06A0
18424 procFun18833
58
CE 0000019C bclr d0,(a4)+ ..
18430 WNAME var0578(var03E8),var0580%
00287350 0280 03E8
16
86 10 01 0578
78 00 0580 bclr d2,d0 ..
0028735E 0096 0198
00CA 00000010 else? --> 00287374 : exit for
end if
18454 END FOR var03E8
00287368 00A203E8FFFF ori.l #$03E8FFFF,-(a2) ......
0028736E FF9C ILLEGAL INSTRUCTION ..
00287370 00000004 ori.b #$04,d0 ....
00287374 00CA 00000024 else?? --> 28739A
0028737A 00D2 ILLEGAL INSTRUCTION ..
0028737C 0450008A subi.w #$008A,(a0) .P..
00287380 00064ACC ori.b #$CC,d6 ..J.
00287384 00000016 ori.b #$16,d0 ....
00287388 588A addq.l #$04,a2 X.
0028738A 00006600 ori.b #$00,d0 ..f.
I know it looks a bit of a mess, But I was obviously having a bit of confusion around there with the question marks.
I'm a bit short of time to hand decompile today. But I thought I would quickly post this in case something pops out at you.