Read This First
This assumes you have used
gcc/g++underLinux. Please learn the basics of gcc: Common Linux GCC commandsReading the simple compilation part is enough.
Installing dosbox and jwasm
jwasm is the assembler; it turns assembly code into executables.
On
ubuntuthe packages are incomplete and you need to compile it yourself. I recommendManjaro, whereyaourt -S jwasminstalls it directly.
For compiling and installing
jwasm, see the very end of this post.
dosbox is a 16-bit emulator.
Directory Structure
Already packaged at my_asm.tar.gz
1 | . |
The Actual Build Process
1 | jwasm -mz -q -Fo TEST.EXE sample16.asm |
Parameters Explained
-mzgenerate aDOS MZ binary file-qquiet mode, no version or copyright output-Fo TEST.EXEname the generated binaryTEST.EXE
Basic DOSBOX Usage
In the directory containing TEST.EXE, run:
1 | # Run TEST.EXE directly, and set dosbox to use the current directory |
Basic Makefile Usage
Nothing particularly hard about this
Makefile— it just combines the operations above.Use it like a script: each time you write a new program, change the value of
SRC.
1 | SRC := sample16.asm # file to compile |
Appendix: Compiling and Installing Jwasm
The code below can be copied and run directly:
1 | # Create a working directory and enter it |