V20-MBC Assembly Language Programs (cp/m-2.2)

by coopzone in Circuits > Arduino

521 Views, 1 Favorites, 0 Comments

V20-MBC Assembly Language Programs (cp/m-2.2)

part1.png

These are two very simple 8080 assembly language programs, to be used as examples, hopefully to get people started!. They are for use on the V20-MBC when running in cp/m 2.2.

They are for the V20-MBC SBC computer designed by just4fun, found here:

https://hackaday.io/project/170924-v20-mbc-a-v20-8...

The programs show how to control the USER LED / USER SWITCH and how to control the GPIO output to control an LED in this case.

They are written for ASM that's provided under CP/M 2.2 on the computer.

Supplies

I would suggest getting a V20-MBC, either from the shop supporting them or have a search round auction / sales sites, places like EBAY etc.

You will also need a laptop/computer to run a terminal program on in order to talk to the SBC over a USB/TTY adaptor. See the web site provided by the author above. This hardware / software is mostly under GPLv3 and the site contains all the info you need to build your own V20-MBC if you prefer.

Get the Examples

The software can be found on GitHub to download, this is by far the best way to get the source code. Once you have it you can copy it to the V20-MBC by:

1, Manually typing it in. Just like the 1980's computer mags!

2, Use the Xmodem program to transfer the files, normally installed on drive F: (sorry beyond the scope of this instructable to show this)

3, Copy the files to the SD-CARD using your PC and the cpmtools package. (again beyond this instructable)

They can be found at: https://github.com/coopzone-dc/v20-mbc-examples

The files ending with A86 and for running on CP/M-86 and are in 8086 code

The files ending in ASM are for cp/m 2.2 and written in 8080 code

Steps to Compile

Once you have the source code under CP/M-86 on your V20-MBC, you can compile them like this (i assume you have copied them to drive H: here, you should use whatever driver letter you put the files on):

1, check you have them:

<pre style="font-size: 13.5px;">F>h:
H>dir
H: LED      ASM : GPIO     ASM                                                
H><br>

2, Now compile them (i've just shown the GPIO.A86 one here as an example)

<pre style="">H>                                                                              
H>a:asm86 gpio                                                                  
                                                                                
CP/M ASSEMBLER - VER 2.0
0101
000H USE FACTOR
END OF ASSEMBLY                                                                                  
H>

3, This actually produces several files, most of these are for info and debuging (normally on much larger programs!):

SYM - the symbol file, details of the labels used etc

LST - a listing file, shows assembled code. Originally designed to be printed out.

H86 - the assembled code in intel Hex format, see next step for converting this to a cmd file.

DIR example

H>dir                                                                           
H: LED      A86 : GPIO     ASM : GPIO     PRN : GPIO     HEX                                                                                     
H>

Create an Executable COM File

Once you have compiled your programs, you need to convert the Intel Hex file into a CMD file that cp/m-86 can load into the TPA and run:

1, Produce a CMD file

F>a:load gpio                                                                   
                                                                                
FIRST ADDRESS 0100                                                              
LAST  ADDRESS 0100                                                              
BYTES READ    0001                                                              
RECORDS WRITTEN 01                                                              
                      

This step will produce a final file called GPIO.CMD

2, Run the program:

H>gpio                                                                          
User GPIO test, press w for diagram, any key to exit                            
Demo HW wiring (See A250220-sch.pdf schematic):                                 
 GPIO                                                                           
 (J7)                                                                           
+-----+                                                                         
| 1 2 |                                                                         
| 3 4 |   LED         RESISTOR                                                  
| 5 6 |                 680                                                     
| 7 8-+--->|-----------/\/\/--+                                                 
| 9 10|                       |                                                 
|11 12|                       |                                                 
|13 14|                       |                                                 
|15 16|                       |                                                 
|17 18|                       |                                                 
|19 20+-----------------------+ GND                                             
+-----+                                                                         
User GPIO test, press w for diagram, any key to exit

At this point, if you have connect an LED (as shown above after i pressed w for diagram) it should be blinking on and off.

Press a key (including the USRKEY) to exit the program.

Try the LED one next, it's more or less the same, but does not look for the letter 'w'

Thanks