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
29 usage: db 'Usage: TIMER S|P|B|Q|U|T|N',cr,lf
30 db ' S = (Re)Start the timer',cr,lf
31 db ' P = Print elapsed time since last S or Q command',cr,lf
32 db ' B = Print elapsed time for simple benchmark loop. wait < 60s',cr,lf
33 db ' ATmega88 with 20MHz D0 = 035,999s',cr,lf
34 db ' Q = Print the timer, then restart it',cr,lf
35 db ' U = Print uptime',cr,lf
36 db ' T = Trace enable',cr,lf
37 db ' N = Trace disable',cr,lf,'$',1AH
39 start: ld a,(cmdLine) ; get number of characters on command line
41 jp z,pusage ; print usage, if command line empty
42 ld a,(cmdLine+2) ; get first character
46 ld hl,table ; <HL> points to (letter, port, command)
47 again: ld a,(hl) ; compare command line letter with table entry
48 inc hl ; point to command
51 inc hl ; otherwise proceed to next entry
53 cp '$' ; end of table?
54 jp nz,again ; try next character
56 pusage: ld de,usage ; address of usage text
57 ld c,printStringCmd ; CP/M command for print
58 jp bdos ; print it, get ret from bdos
60 found: ld a,(hl) ; get timer command
64 db 0D3H ;"out (port),a"
70 out (TIMERCTL),a ; start timer
83 out (TIMERCTL),a ; print elapsed time
87 db 'N',DEBUGPORT,StopTraceCmd
88 db 'T',DEBUGPORT,StartTraceCmd
89 db 'S',TIMERCTL,starttimercmd
90 db 'P',TIMERCTL,printTimerCmd
91 db 'Q',TIMERCTL,quitTimerCmd
92 db 'U',TIMERCTL,uptimeCmd
96 ds ((timend+127) and 0ff80h)-timend ; fill remainder with zeroes
99 ; vim:set ts=8 noet nowrap