Contributing an 8080 demo to emuStudio
Encouraged by the emuStudio developer, I donated to the project an Intel 8080 Assembly demo. It's a modified version of Twirl, my program to display a twirling bar animation.
Here's the code I contributed:
; Twirling bar animation by Paolo Amoroso <email@example.com>
; Runs on an Altair 8800 with an ADM-3A terminal. Press any key
; to interrupt the program.
FRAMES equ 8 ; Number of animation frames
CLS equ 1ah ; ADM-3A escape sequence
HOME equ 1eh ; ADM-3A escape sequence
STATUS equ 10h ; Input status port
READY equ 1 ; Character ready status mask
mvi a, CLS ; Clear screen
loop: lxi h, ANIM ; Initialize frame pointer...
mvi b, FRAMES ; ...and count
loop1: mvi a, HOME ; Go to home
mov a, m ; Print current frame
ani READY ; Key pressed?
jnz exit ; Yes
exit: pop psw ; Clear psw left on stack
ANIM: db '|/-\|/-\' ; 8 frames
Unlike the original code, which I designed to run on emuStudio and be easy to port to CP/M, this new version is intended to run only on emuStudio. This was an occasion to simplify the code.
The main difference is the escape codes for VT100-compatible terminals on CP/M are strings, whereas the ADM-3A codes Twirl sends on emuStudio are single bytes. This allows the program to print the codes with the
putchar library subroutine instead of
putstr. Doing away with
putstr no longer requires saving and restoring the
HL register pair in the calling sequences.
Finally, I added code to terminate the program if a key is pressed.