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 <info@paoloamoroso.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
call putchar
loop: lxi h, ANIM ; Initialize frame pointer...
mvi b, FRAMES ; ...and count
loop1: mvi a, HOME ; Go to home
call putchar
mov a, m ; Print current frame
call putchar
push psw
in STATUS
ani READY ; Key pressed?
jnz exit ; Yes
pop psw
inx h
dcr b
jnz loop1
jmp loop
exit: pop psw ; Clear psw left on stack
hlt
ANIM: db '|/-\|/-\' ; 8 frames
include 'include\putchar.inc'
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.
Discuss... Email | Reply @amoroso@oldbytes.space