Rugxulo

Usono, 04.10.2026, 02:12 |
gwb22c16.zip -- INSTR() not found (Developers) |
T.K. Chia (and others) did a nice job reassembling the published GW-BASIC sources for us. His last binary release seems to be from Dec. 16, 2022.
* https://gitlab.com/tkchia/GW-BASIC
I wrote a very quick line-numbered BASIC program just to play around. (It's only 68 lines but irrelevant here.)
However, the GWBASIC.EXE does not support INSTR() at all. Which was strange to me since it should. I tried looking at the sources, but nothing obvious came up.
But I did recall that he mentioned an incompatibility with MASM having its own INSTR reserved keyword. So what happened was he auto-translated everything to "INSTRC"! And yes, INSTRC() works fine!
I would classify this as a (very tiny) bug.
There's also a tiny other quirk that it seems to pad output text files with Ctrl-Z and junk at the end. If I manually delete that, the output text matches that of a run with QBASIC.
Just FYI. |
Rugxulo

Usono, 04.10.2026, 23:51
@ Rugxulo
|
gwb22c16.zip -- INSTR() not found |
> T.K. Chia (and others) did a nice job reassembling the published
> GW-BASIC sources for us. His last binary release seems to be from
> Dec. 16, 2022.
>
> There's also a tiny other quirk that it seems to pad output text files with
> Ctrl-Z and junk at the end.
I figured out a simple workaround for that (using FreeDOS edlin, not sure if dependent upon compiler):
echo e | edlin file.txt
|
ecm

Düsseldorf, Germany, 05.10.2026, 13:15
@ Rugxulo
|
gwb22c16.zip -- INSTR() not found |
> T.K. Chia (and others) did a nice job reassembling the published
> GW-BASIC sources for us. His last binary release seems to be from
> Dec. 16, 2022.
>
> * https://gitlab.com/tkchia/GW-BASIC
>
> I wrote a very quick line-numbered BASIC program just to play around. (It's
> only 68 lines but irrelevant here.)
>
> However, the GWBASIC.EXE does not support INSTR() at all. Which was strange
> to me since it should. I tried looking at the sources, but nothing obvious
> came up.
>
> But I did recall that he mentioned an incompatibility with MASM having its
> own INSTR reserved keyword. So what happened was he auto-translated
> everything to "INSTRC"! And yes, INSTRC() works fine!
>
> I would classify this as a (very tiny) bug.
I added a patch in https://codeberg.org/tkchia/GW-BASIC/issues/15 --- l |
tkchia

05.10.2026, 18:19 (edited by tkchia, 05.10.2026, 20:50)
@ ecm
|
gwb22c16.zip -- INSTR() not found |
Hello all,
Thanks for the bug report! As I mentioned at Codeberg, I eventually opted to apply a different fix for the INSTR problem. I have uploaded a new binary release at https://codeberg.org/tkchia/GW-BASIC/releases/tag/20261005 .
The trailing ^Z + junk is because the GW-BASIC code as released by Microsoft does file I/O using ancient FCBs, which obligatorily pad files up to some record size (128?).
I had been thinking of updating the code to use file-descriptor-based I/O as supported in MS-DOS 2+ — obviously this is possible! — but I am not familiar enough with the code to know how to do that. Any help in this department will be welcome.
Thank you!
(edit: fixed link to release page) --- https://codeberg.org/tkchia · https://git.disroot.org/tkchia · 😴 "MOV AX,0D500H+CMOS_REG_D+NMI" |
ecm

Düsseldorf, Germany, 05.10.2026, 20:11
@ tkchia
|
OT: disroot.org link |
Hi tkchia,
Your signature's link to https://disroot.org/tkchia seems to lead to an error 404. --- l |
tkchia

05.10.2026, 20:33
@ ecm
|
OT: disroot.org link |
ecm: oops, thanks! It should point into git.disroot.org. --- https://codeberg.org/tkchia · https://git.disroot.org/tkchia · 😴 "MOV AX,0D500H+CMOS_REG_D+NMI" |
ecm

Düsseldorf, Germany, 05.10.2026, 22:59
@ tkchia
|
OT: lfanew meaning |
Something else, what does "lfanew" mean? --- l |
tkchia

06.10.2026, 01:09 (edited by tkchia, 08.10.2026, 20:14)
@ ecm
|
OT: lfanew meaning |
> Something else, what does "lfanew" mean?
It is a reference to the field at offset 0x3c in the MZ header structure definition in the Windows API (edit: or, at least, which used to be part of the API):
typedef struct _IMAGE_DOS_HEADER {
WORD e_magic;
WORD e_cblp;
WORD e_cp;
...
WORD e_lfarlc;
WORD e_ovno;
...
LONG e_lfanew;
} IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER;
As for what it really means: not totally sure — I am guessing it is some form of Hungarian Notation.
Thank you! --- https://codeberg.org/tkchia · https://git.disroot.org/tkchia · 😴 "MOV AX,0D500H+CMOS_REG_D+NMI" |