Sunday, October 14, 2012

CP/M on a C64 - Hello World

I think a good old “Hello World!” application is in order now in our quest of CP/M exploration.
Since I don't know the Z80 assembler (yet) nor the structure of the assembly program for CP/M I again turn to the internet for rescue.
I found one very good comprehensive explanation of how to use assembler compiler 'ASM' under CP/M system and an example of “Hello World!” application written in 8080 CPU assembly (which BTW is a subset of Z80's assembly). Here is the URL.

So, in short – to compile assembler code, saved on the disk under name HELLO2.ASM (I prepared that one with the CP/M's line editor: ED), you invoke CP/M command:


As a resut, the Intel HEX format file is generated along with PRN file: HELLO2.HEX, HELLO2.PRN

The PRN file is of no concern to us at the moment.
Now we need to convert Intel HEX file into CP/M executable. This is done with LOAD utility:


Above command will produce some information about resulting executable (.COM) in the form of first address, last address, bytes read and records written numbers. It will also create HELLO2.COM program on the disk as well.

Now type at the prompt the name of the program:


and enjoy the resulting message:


I think it is enough excitement for a moment. Go ahead and experiment with other CP/M BIOS functions, observe the results and learn if you want.

In the next episode - what I learned about CP/M so far and how I created my own C64 CP/M disk with Infocom's ZORK1 adventure game.

Stay tuned!


No comments:

Post a Comment