This is a simple addition program that can be entered into RAM using the program loader routine.
| Line no. | Location | Contents | Label | Instruction | Comment |
|---|---|---|---|---|---|
| 0001 | 0000 | ;Z-80 Simple Adding program | |||
| 0002 | 0000 | ;2/21/03 | |||
| 0003 | 0800 | .org 0800h | ;Start of RAM, program loaded here | ||
| 0004 | 0800 | DB 00 | start | in a,(0) | ;First number from input port 0 |
| 0005 | 0802 | 47 | ld b,a | ;Put in register b | |
| 0006 | 0803 | DB 01 | in a,(1) | ;Second number from input port 1 | |
| 0007 | 0805 | 80 | add a,b | ;Add to first number | |
| 0008 | 0806 | D3 00 | out (0),a | ;Output result to output port 0 | |
| 0009 | 0808 | 18 F6 | jr start | ;start over. | |
| 0010 | 080A | .end |
© Donn Stewart 2004