Skip to content
RetroNick's Youtube Channel edited this page Dec 20, 2022 · 3 revisions

GW-BASIC ASM CODE NOTES

Step 1 Create Object (*.obj) Code in TASM - Parameter Passing is unique to GW-BASIC. TASM NYCODE.ASM

The same method does not work in Turbo Pascal even though you can link it Take a look at SetRGB/SetERGB and Mouse code to see format of parameter passing

Step 2 Use TLINK to link to object (*.OBJ) to .EXE TLINK MYCODE.OBJ

Step 3 Use EXE2BIN to convert *.EXE file to *.COM (could be other extension like *.BIN) if you are using Dosbox use the WATCOM EXE2BIN EXE2BIN NYCODE.EXE MYCODE.COM

Step 4 Use BIN2BSV to convert *.COM to *.BSV file - Use BLOAD to load into an array. BIN2BSV MYCODE.COM NYCODE.BSV

eg V1%=10:V2%=20 'must assign values to variables before calling - you cannot just call mycmd(10,20) the variables are needed for returning values also. This is just way GW-BASIC expects things to be done

DIM CODE%(200):BLOAD "MYCMD.BSV",VARPTR(CODE%(0)):CALL MYCMD(V1%,V2%)

or Use BIN2SRC to convert *.COM to DATA statements that can be read into an array. eg DIM CODE%(200):FOR I=1 to 100:READ CODE%(I):NEXT I

or Use BIN2SRC to convert *.COM to array elements with values assigned (this works well when code is very small)

Clone this wiki locally