1. I setup my environment. A Linux box with KDE and QuickBasic 4.0 running in DOSBOX
2. I use a linux text editor (its called kate) to create my code, and nasm assembler to assemble it. It creates the binary file. I'm well aware that I can simply load the binary file into my program every time I want to execute it but that's another file to worry about and the program can be easily corrupted if a byte in the file is modified since its a binary file instead of a configuration file.
3. So I take the binary file and thanks to a nice linux program, I can create hexadecimal code required for the program to execute. then I open my code in the same linux text editor and copy and paste.
4. Finally I launch DOSBOX with QuickBasic 4.0 loading the code.
The interpreter itself has no problem running the code when I do the usual run (shift+F5), but when it comes to compiling, BC not only becomes fussy about line lengths, it tells me the same error twice, prints some happy faces in a couple of random spots, and the DOS screen locks up (I habe to manually close it)
So I go back to my editor to reload the code and it seems that underscores are added where I set the data. After executing the program and closing DOSBOX, I notice in my source code that this:
Code: Select all
w$="XXYYZZ..."
Code: Select all
w$= _
"XXYYZZ..." _
So anyways, I use the below code to load my assembly code into the program before executing it with call absolute. It converts the hex values into actual codes (of which some cant be typed on the screen directly).
Code: Select all
w$="XXYYZZ..."
cd$ = "": FOR z% = 1 TO LEN(w$) STEP 2: cd$ = cd$ + CHR$(VAL("&H" + MID$(w$, z%, 2))): NEXT
acode$ = cd$
Maybe theres syntax in QuickBasic that someone could point out to me that allows me to use long lines when compiling. I wonder if thats what the underscore means?
I want to avoid having the program load the compiled assembly code in from a separate file.
Any ideas?
I attached pictures to show what I have done.