Debug.Asm – Z80 Development Tool

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.

Download

Hello World – Z80 development

(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.

Hello World

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

Download:

Help – resolved

Can you do the following and let me know your results:

  1. Download this zip file
  2. Unzip it and start AdamEm with File Manager as disk 1 and the image called Heather as disk 2
  3. Press F5 to switch to disk 2, F2 for Media Functions and F4 for edit
  4. Press F3 for Block Number and type in a 2 and hit enter.
  5. Press Enter again
  6. 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)
  7. Does it look like the screen shot to the right? All zeros?
  8. If it doesn’t let me know
  9. 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
  10. 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:

0 -> 0
1 -> 1
2 -> 10
3 -> 11
4 -> 4
5 -> 5
6 -> 14
7 -> 15
8 -> 8
9 -> 9
10 -> 2
11 -> 3
12 -> 12
13 -> 13
14 -> 6
15 -> 7

 

Replacement Power Supply

If you are looking to dump the printer and use a newer power supply you can use this one from Jameco (RQ-50B). I have made a number of them so far. It is very easy to do if you are willing to sacrifice the power cable from the printer (click here for a video on making your own cable). Just cut the two cables off the printer and then wire them up according to the photo on the left. I use a power strip for the on and off switch.

Converting an Audio Tape Into a Digital Data Pack

If you are using an Adam computer with just a digital data drive you will eventually come to a point where you will need more data packs. There are a few possibilities available, you can purchase used ones and hope they are still good, you can buy NOS (New / Old Stock) (ANN sells them here) or you can make your own!

Getting started:

To get started making your own you will need a few things:

  1. A dual cassette tape deck, the simpler the better. Those with complicated levels and equalizers will make it hard for you to get it right. I use a $5 all-in-one system (Record, Radio, Dual Cassette) I got at a yard sale and it works flawlessly
  2. A good digital data pack to use as a master that has a holes in it for the capstan
  3. 60 minute blank cassettes. I have used Scotch, JVC and Maxwell but others will work too
  4. A simple soldering iron (or a drill with 1/4″ bit) and a utility knife or exacto-knife

Step 1: Preparing the audio and testing

We need to prepare the audio tape as follows:

  1. Turn tape over so side B is showing
  2. Plug in soldering iron
  3. When iron is hot we will melt two holes in the top of the case right below the record enable tabs, refer to the pictures and an original data pack. Do not go through the other side, just the B side
  4. Once plastic is cool use the utility knife to clean off any excess

Now we want to test if the tape will work in an Adam. Some tapes are made cheaply and they bounce around at high speed. To test it:

  1. Turn on your Adam
  2. Press Escape / WP to get into word processor mode
  3. Put in the new tape into drive A, it should go in easy, if it is hard to get in make sure the holes are big enough and that you cleaned away all the debris
  4. Press Store / Get
  5. Press VI (Get)
  6. Press III (Drive A)

The tape should fast forward to the beginning and back a few times before Smart Write gives up. You want to listen to be sure that the tape is not bouncing around. If it is do not use that tape, if it isn’t then we can proceed.

Step 2: Testing the Master Data Pack

We need to make sure the data pack will work in your tape recorder. Original Coleco data packs will not without doing a little “surgery” to the case. Before we do this check all of the data packs you have and look for ones that have 4 holes in the tape read area. The Coleco packs had 2 next to the place where the read head goes and the markings for the other 2. If you do a side by side comparison of the data packs and the audio tape you will immediately see the holes I am talking about. If you do not have a data pack with the necessary holes you can create them with a drill but you have to be very careful and pull the tape away from the hole.

Once you have located or created a Master Data Pack, put it in the tape record and make sure that it will go in correctly like an audio tape will.

Step 3: Setting up the Tapes for Copying

Before copying we need to get the tapes into position. To do this:

  1. Rewind both tapes on Side A – (on a data pack, Side A is the side without the two holes on top – the side you see when it is in the Adam)
  2. Use a pen or pencil to slowly advance the tape until the leader is just about ready to go around the roller

Step 4: Copying

I am going to use my tape deck setup as the example.

  1. Put the audio tape in the record deck. Press Pause and then the Record / Play button
  2. Put the Master tape into the play back deck
  3. Press Play on the master, the record deck starts automatically
  4. Once the master is done playing stop the record deck
  5. Rewind the master a bit and listen for the high pitched sound of the data. Keep doing this till you find it and then let it play till it stops and go about 5 seconds further. Press stop and flip the tape over
  6. Rewind the audio tape the same as you did with the master, listening for the end of the data and then go about 5 seconds further. Press stop and flip over
  7. Press Pause and then the Record / Play button on the audio tape
  8. Press Play on the master

Step 5: Did It Work

If all has gone well you should now have a copy of the master on the audio tape. You can try to use it in the Adam now but I have learned that the copies are not faithful. But this is ok, we really only wanted the index marks that the Adam reads on the data pack from the master data pack, not the data. So my next step involves using CP/M to format and then verify the tape. The reason I use CP/M is that the verify actually verifies every block where as the INIT (initialize) in Smart Basic only initializes the directory. You can use Smart Basic if that is all you have, or even TDOS or File Manager.

Over the past 2 days I have made 12 Audio Data Packs, seven from older audio tapes I had and 5 from brand new ones. Of the older tapes, 2 failed. Of the new tapes all 5 worked.

Good Luck 🙂

P.S. The beautiful woman in the pictures is my wife Heather <3

P.S.S. Let me know if in the comments if you try this and the results you get.

Initial Release: Adam 2018 *** UPDATED ***

What is Adam 2018?

Adam 2018 is a software package that helps improve your Coleco Adam experience. The initial release is a front end to the excellent Adam emulator originally created by Marcel de Kogel and currently maintained by Geoffrey Oltmans.

Upcoming version release information:

  1. Initial release – Adam Emulator Front End (November 2017)
  2. Image manipulation, view directories and files in images, copy and paste (December 2017)
  3. Adam Virtual Disk Drive (AViD) integration (Spring 2018)


 

Installing Adam 2018

Once I decide on a good installer (i.e. free) I will automate this:

  1. Unzip the archive – I suggest putting it in C:\ADAM2018
  2. Right click on t he “Adam 2018.exe” icon and select Send To .. Desktop Shortcut
  3. Navigate to where you unzipped it and enter the “vc” folder
  4. Run the program “VC_redist.x86.exe” – this will install the needed DLL’s
  5. Restart your computer – this is a must else the DLL’s will not be registered
  6. If you do not have a working copy of Adam EM on your computer continue these steps, else run Adam 2018 and use the Configuration / Program option to tell Adam 2018 where the emulator is (see menu options below)
  7. Windows 7, 8 and 10:
    1. Navigate to the “emulator” folder and right click on the program adamem.exe
    2. Select Properties
    3. Select Compatibility
    4. Click the “Change settings for all users” button
    5. Check the “Run this program as an administrator” option
    6. Click OK
    7. Click OK again
    8. Now run AdamEm.exe, if pop ups show asking if you want to allow changes tell it yes, tell always / never ask again
  8. Windows XP (and possibly Vista):
    1. Navigate to the “dosemu” folder
    2. Double click on the “adamem.exe” file
    3. When it asks if you want to run it uncheck the ‘Always ask before opening file” box and click Run
    4. When Smart Writer opens, press CTRL+F9 and then select Quit Emulator

Adam 2018 is now ready to use. If you installed for XP you will need to initially go to Configuration / Program in the Adam 2018 program and navigate to the “dosemu” folder and select adamem.exe as the emulator.

 

Adam 2018 Main Menu Options:

  • Adam – Starts the Adam Emulator using the configuration given. If you have not configured it yet it will start in Smart Writer.
  • Colecovision – Lets you select a cartridge (.rom) file and then starts the emulator in Colecovision mode.
  • Configuration – Shows the configuration options:
    • Program – Select where the Adam emulator is. By default it will use the copy that came with Adam 2018
    • Disk Images- Select up to 4 disk images (.dsk) to use with the emulator.
    • Tape Images – Select up to 4 tape images (.ddp) to use with the emulator.
    • IDE Images – Select up to 2 IDE images to use with the emulator. You will also need to have your first disk image be the IDE boot software. You can use the supplied image bootide.dsk in the support folder.
    • Expansion RAM – Select the size of expansion ram to use.
    • Additional Options – Any other options you may want to use to configure the emulator. A full list of these options is in the file AdamEm.txt in the emulator folder.
  • Help – Shows the help options:
    • About – About Adam 2018
  • Exit – Quit Adam 2018


 

Drag and Drop:

You can drag and drop any disk (.dsk), tape (.ddp), IDE (.img) image or cartridge (.rom) into the window (or program icon) and Adam 2018 will immediately start it. If you drag an IDE image it will also start the bootide.dsk image.


 

Customizing:

You can change the background of Adam 2018 by replacing the file background.bmp in the support folder with one of you own choosing. The dimensions used are 600 pixels wide and 300 high at 72 dpi and 24 bit color depth.

Downloads: