Message board for the users of flat assembler.
> DOS > [Beginner’s Guide] Set up Dosbox for Programming with FASM
Hans-Joachim Rudolph 01 Aug 2023, 22:04
Many things in this guide are covered elsewhere. Namely
there is Privalov’s video, there is an elaborate guide from
Vladimir Igonin (in Russian) and, of course, the wealth of
information here in the DOS section. So I hope this guide
still finds it’s niche! In the end you should have a develop-
ment environment with many kinks already ironed out, so
you may have a maximally pleasurable programming
Let me assume, you are a beginner in both assembler and DOS, BUT you have installed things before and you basically know what a command line does and is used for. Part 1: Set up a basic DOS system with FASM (1) Download Dosbox for your platform from dosbox.com, install it and run it. You should see the command prompt coming up showing ’Z:\>’. Hit Ctrl+F1 to open the Keymapper and hit ’Save’. Close the mapper with ESC, then close Dosbox with the command ’exit’. (2) You will need to find the configuration files for dosbox on your system. It is in ~/.dosbox for Linux and %LOCALAPPDATA%\DOSBox for Windows. (2.1) Create a directory where your DOS files will reside (e.g. ~/.dosbox/drive_c). (2.2) In ~/.dosbox replace the dosbox*.conf (current ver‐ sion 0.74‐3) with this: [cpu] cycles=4000 # alleviate impact of busy waiting [sdl] mapperfile=mapper.map # see next sub step [autoexec] mount c ~/.dosbox/drive_c c: # change right away to our mounted drive folder Maybe do a backup of the original, but you can al‐ ways start over by just deleting the configuration files and restarting Dosbox. ’Busy waiting’ may un‐ necessarily heat up your processor and eat away your laptop’s battery, but it is normal with many DOS programs. Look it up, if you have not heard of it before! (2.3) In the same folder, rename the *.map file and call it mapper.map. Then edit it: You will want to re‐ move most of the lines that start with ’hand_’. Dosbox uses most function keys for itself. This may have surprising effects, e.g. you want to compile (only) in fasmd (Ctrl+F9), but this combo is pre‐set to kill Dosbox! Thus it’s wise to delete these lines in mapper.map. Do NOT remove the line with ’hand_capmouse’ though! This will keep you from getting your cursor back with Ctrl+F10, should Dosbox have captured it. I actually rebound it to Ctrl+Esc with "key 27 mod1" to have the function keys clear. (3) Install fasm for DOS from flatassembler.net. Just un‐ pack everything to ~/.dosbox/drive_c/fasm. (4) Start Dosbox. Your first FASM session may look like this: C:\>cd FASM C:\FASM>fasm flat assembler version 1.73.31 error: no 32‐bit DPMI services available. One solution is to get the HX DOS‐Extender from Japheth. From the runtime you only need to extract said DPMI server (hdpmi32.exe) and place it in your drive_c folder. Execute this file before starting fasm and you should see the program telling you it’s command line options, which means it works. Should you notice, that this magic only works once and you need to execute hdpmi32.exe again after each fasm run, try running ’hdpmi32 /r’ :) As a bonus, you can add this line to your dosbox*.conf in the [autoexec] paragraph. (5) Start the FASM DOS IDE (fasmd.exe). Hit F4 and navigate to EXAMPLES\COMDEMO and open comdemo.asm. You will see a simple ’Hello world!’ example. Hit F9 to compile and run it. You may just see a short flicker, since the program terminates instantly. You can hit Alt+F5 to see the user screen (it should show the ’Hello world!’ message). You can, of course, also alter the code to your liking. Without going into detail, insert the following just above ’int 20h’: mov ah,7 int 21h Hit F9! Now you should have plenty of time to look at your program’s output.
That's it for the first part. Please send me your feedback.
Is there somewhere I should elaborate more or be more terse?
This is just a write-up of the notes that I make as I go.
There is plenty of room for mistakes.
If you note any, please let me know.
Is there anything that should be part of future guide parts?
So far I have noted:
|01 Aug 2023, 22:04||
< Last Thread | Next Thread >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.