1 ; This is a utility program to control the timer of the AVR CP/M emulator.
2 ; This file is stolen from the SIMH AltairZ80 Simulator.
4 ; changed to assemble with z80asm
11 printStringCmd equ 09h
30 usage: db 'Usage: ACT S|P|B|Q|U|T|N',cr,lf
31 db ' S = (Re)Start the timer',cr,lf
32 db ' P = Print elapsed time since last S or Q command',cr,lf
33 db ' B = Print elapsed time for simple benchmark loop. wait < 60s',cr,lf
34 db ' ATmega88 with 20MHz D0 = 035,999s',cr,lf
35 db ' Q = Print the timer, then restart it',cr,lf
36 db ' U = Print uptime',cr,lf
37 db ' T = Trace enable',cr,lf
38 db ' N = Trace disable',cr,lf
39 db ' K = Print stack usage',cr,lf
42 start: ld a,(cmdLine) ; get number of characters on command line
44 jp z,pusage ; print usage, if command line empty
45 ld a,(cmdLine+2) ; get first character
49 ld hl,table ; <HL> points to (letter, port, command)
50 again: ld a,(hl) ; compare command line letter with table entry
51 inc hl ; point to command
54 inc hl ; otherwise proceed to next entry
56 cp '$' ; end of table?
57 jp nz,again ; try next character
59 pusage: ld de,usage ; address of usage text
60 ld c,printStringCmd ; CP/M command for print
61 jp bdos ; print it, get ret from bdos
63 found: ld a,(hl) ; get timer command
67 db 0D3H ;"out (port),a"
73 out (TIMERCTL),a ; start timer
86 out (TIMERCTL),a ; print elapsed time
90 db 'N',DEBUGPORT,StopTraceCmd
91 db 'T',DEBUGPORT,StartTraceCmd
92 db 'K',DEBUGPORT,PrintStackCmd
93 db 'S',TIMERCTL,starttimercmd
94 db 'P',TIMERCTL,printTimerCmd
95 db 'Q',TIMERCTL,quitTimerCmd
96 db 'U',TIMERCTL,uptimeCmd
100 ds ((timend+127) and 0ff80h)-timend ; fill remainder with zeroes
103 ; vim:set ts=8 noet nowrap