(I want to apologize in advance, I am not a fantastic writer)
I like to code in machine language. Using ML you have (almost) complete control over the Adam and can make it do things as fast as it is possible for it to do it.
Writing ML code on the actual Adam for me is hard because I have been been using modern computers for so long I am used to being able to cut and paste, have multiple files, compile fast etc. So I like to create my code in Windows, compile it and then transfer it to a disk image for testing in the AdamEM emulator and if I want moving it to the real hardware.
Doing so has involved using my editor of choice (ConTEXT), and then using DosBox to emulate a DOS machine and compiling the code using the TeleMark cross-assembler. On a 32 bit machine I could have eliminated DosBox and just used the Command prompt in Windows, but with a 64 bit machine DosBox is required because TeleMark is a 16 bit program. Once I compiled the program I would then use various methods to get it into an image, mostly WRDISK and sometimes TDOS if I was programming for a CP/M environment but I always felt these were cumbersome so I have been working on a method of creating a disk (or tape) image of the compiled program I am working on and have it just load when I start the emulator (or real hardware). After disassembling the Smart Basic Loader, studying the EOS programmers Guide and banging my head against the wall with disk interleaving I finally was able to create a “simple” process to take my machine language source code, compile it and create a working disk image using just one command.
At some point every programmer has made a “Hello World” program. In Smart Basic this is as simple as:
10 PRINT “Hello World”
Writing one in machine language to use under EOS is a little more convoluted to get started as you have to initialize the Video Display Processor to even see anything. Once you get that setup then you can print to the screen. (Click here to view the source code).
Compiling the Code
To compile the code use the Assemble batch file. If all goes well and there are no errors you will have a usable disk (and tape) image. If you look at the assemble.bat file you will see how it works:
echo off cls rem This batch file will assemble the source code file rem passed on the command line for example: assemble filename rem where filename is the name of z80 code you wish to rem assemble and has the extension of .asm. Do not add an rem extension. The batch file will use filename for the rem name of the resulting disk and tape images it creates rem Did they pass a filename to assemble? If not then exit if "%1"=="" goto NoFileName rem Do some clean up of old .obj, .lst, .dsk and .ddp files if exist %1.obj del %1.obj if exist %1.lst del %1.lst if exist %1.dsk del %1.dsk if exist %1.ddp del %1.ddp rem Now to assemble the file passed TASM will return an error if rem we could not assemble it and if that happens we will exit tasm -80 -b %1.asm if ERRORLEVEL 1 goto AsmError rem The code assembled ok so now we need to put it in the disk rem image for use with the emulator and a real Adam. If you are rem curious how ImageMkr works just run type imagemkr at the prompt imagemkr %1.obj %1 rem We are all done so lets exit goto Exit :NoFileName echo No file name was passed to assemble goto Exit :AsmError echo Error while assembling if exist %1.obj del %1.obj if exist %1.lst del %1.lst goto Exit rem All done so exit :Exit echo on