I through something together. Trap task 7 is used to test for keyboard input.
Code:
*-----------------------------------------------------------
* Title : Read key without waiting
* Written by : Charles Kelly
* Date : Dec-22-2016
* Description: Read a keypress from the keyboard without
* waiting for input.
*-----------------------------------------------------------
ORG $1000
START: ; first instruction of program
* Put program code here
clr.l count ; count = 0
Loop
add.l #1,count ; count = count + 1
move.b #7,D0 ; Task 7, Check for keyboard input. Set D1.B to 1 if keyboard input is pending,
; otherwise set to 0. Use task 5 to read pending key.
trap #15
if.b D1 <eq> #1 then.s ; if keyboard input pending
move.b #5,D0 ; Task 5, Read single ASCII character from the keyboard into D1.B.
trap #15
move.l count,D1 ; get count value
move.b #3,D0 ; Task 6, Display number in D1.L
trap #15 ; Display loop count
endi
bra loop
SIMHALT ; halt simulator
* Put variables and constants here
count ds.l 1 ; loop counter
END START ; last line of source