; ######################################################################################### ; # Indiana University # ; # Computer Science Department # ; # # ; # Example Program #1 (C335 Lab Tutorial) # ; # # ; # DESCRIPTION: # ; # # ; # 68K assembly language program to output the characters of the string "HELLO" on the # ; # PC terminal (hyperterminal) using TRAP #15 mode 1. As each character in "HELLO" is # ; # output, a counter is incremented and displayed on the target's seven segment display # ; # using TRAP #15 mode 4. TRAP #15 mode 0 is used to terminate the program's execution. # ; # # ; # AUTHOR: # ; # Bryce Himebaugh (bhimebau@cs.indiana.edu) # ; # IUCS Staff # ; # 6/17/99 # ; # # ; ######################################################################################### SECTION code START: ; "START" label required (debugger) at beginning of code clr.b d2 ; initialize loop counter to be put on 7 segment display lea message,a0 ; load the base address of "message" into A0 loop: move.b (a0)+,d0 ; put a char from "message" in D0 and point at next char beq exit ; exit if a 0 (end of message) was just moved to D0 moveq.l #1,d1 ; setup to cause a TRAP #15 putchar to terminal trap #15 ; execute putchar nop ; NOP to deal with debugger TRAP anomoly addq.b #1,d2 ; increment the current count value. move.b d2,d0 ; load the current loop count value into D0 moveq.l #4,d1 ; setup to cause a TRAP #15 write to 7-segment display trap #15 ; execute write to 7-segment display nop ; NOP to deal with debugger TRAP anomoly bra loop ; branch back to get the next character in "message". exit: clr.b d1 ; setup to cause the TRAP #15 to terminate the program trap #15 ; execute program termination message: dc.b "hello",0