In a recent post I gave a quick update on creating a 64MB disk image that I was then able to copy to microSD card and then running a quick program I made that initialized the image to be 64MB in size I could access it on the Adam using microfox’s VDD.
I have since done more testing experimenting and I was able to get a copy of Smart Basic onto the image and have it boot from the image and have access to the whole 64mb. This involved a few steps:
open up the new image in FileManager and using the edit block function look at block 1, the directory block, and see what values it had for total blocks on disk, in this case FFFFh (65535) and how many blocks left, FDFFh (65533)
open up an image of smart basic and look at its directory block, its total blocks was A000h (160) and blocks left after having basic as 7A00h (122)
now I used the block copy feature to copy the 160kb smart basic image to the 65mb blank image. When done the image is still 65mb but the directory block on the image only reports back a 160kb image size
now using file manager again I go into block 1, the directory block of the 65mb image and change A000h to FFFFh and after the blocks left I changed &A00h for E5FFh, this is FFFFh – 26, the number of blocks used by smart basic
after these changes i saved them to the image and then rebooted
Here is the image to download – and it does work in the AdamEM emulator also! (BTW it is 64mb, I typed 65mb in Smart Basic)
I recently found myself needing to create a few CP/M data packs for customers. This is normally no problem, but I needed to load them with programs. Since I normally use the VDD all of my files are in disk images, and a CP/M disk image is limited to 160kb, where as a CP/M data pack image is 256kb. The total amount of the programs was around 200kb so I would need to import files from the PC into 2 CP/M disk images, move those images via microSD card to an Adam and then copy those to a CP/M data pack. This is very tiresome and if you have ever copied files under CP/M it really abuses the data drive. For other purposes under EOS, I normally just copy disk images to data packs and let Backup+ 3.0 correct the directory. This is a simple block copy and it works fast.
So I thought to myself, why not take the tape image with is 256 1kb blocks in sequential order and interleave the 256 byte records so it is now a 256kb disk image. The VDD does not care what the size of the image is. Then I can just use File Manager to do a block copy and have the CP/M image on tape. in one pass, no copying of individual files and abusing the data drive.
Included in this post is a DOS program (requires DOSBOX under windows 7 and up) that takes a data pack image (.ddp) and makes a disk image (.dsk) for you. I am also including the source code in Turbo Basic so you can see how it works.
The following zip file has a copy of the Dragon’s Lair Data Pack image and a conversion to a 256kb disk image which you can use with the VDD or in your emulator or copy back to a data pack using the File Manager Method above.
If you are going to be doing any serious z80 programming then you will quickly find a need for this program. It is code that you can include at the end of your z80 source code and then call it with a simple JP CodeDump command. When you do this it will show you the values of all the registers when it was called and let you move around memory starting at the value you put in the source code at CD_CurLoc. The only caveat is that you need to be in 32 column mode when you enter it. Any other mode will be hard if not impossible to read.
(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:
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
echo No file name was passed to assemble
echo Error while assembling
if exist %1.obj del %1.obj
if exist %1.lst del %1.lst
rem All done so exit
Unzip it and start AdamEm with File Manager as disk 1 and the image called Heather as disk 2
Press F5 to switch to disk 2, F2 for Media Functions and F4 for edit
Press F3 for Block Number and type in a 2 and hit enter.
Press Enter again
Now you are looking at Block 2 Sector 0. On a real Adam press Home and Up arrow until you are looking at Sector 4. In the emulator press the “5” on the keypad and the up Arrow (at same time)
Does it look like the screen shot to the right? All zeros?
If it doesn’t let me know
If it does then humor me and go to Hex Edit and upload the file called HEATHER.DSK and then scroll down till you get to the section starting with 00000A00
You will see that there is code there, but the same corresponding bytes in the image are zeros. You can verify this by scrolling up a to sector 3 in the image on the emulator and seeing the last of the code that loads
Please let me know your results – either here or on Facebook
Thanks to the information from Eric I was able to determine that I was not taking into account the interleaving of the data on a disk image. The tape images do not use that so it confused me when I started working with disk images. If you are curious how it works here it is where the first number is a 256 byte sector and the second number is the actual sector it should go in. This is using 4kb blocks: