ECE 2325 UMD S.Norr Fall 2002
EXAMPLE OF CONVERTING THRSim11 Code for use in MWAH 355 Lab:
Code from program 1 of Lab1:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Program 1 puts two Hex values in Page Zero of memory,
; adds them using accumulator A and stores the result back
; in memory. The instructions which manipulate accumulator A
; all use Extended Addressing Mode S.Norr
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
org 0 ;tells the assembler to start at address $0000 (RAM)
DAT1 db D7 ;tells assembler to define memory byte $0000 as hex D7 in
;Page Zero of memory
DAT2 db 16 ;define memory byte for operand 2 (byte $0001)
SUM rmb 1 ;reserve one memory byte for Sum (byte $0002)
org FF00 ; tells the assembler to move to address $FF00 (ROM)
START LDAA $0000 ; load the data from $0000 into accumulator A
ADDA $0001 ; add the data from $0001 to contents of Acc. A
STAA $0002 ; store the contents of Acc. A into memory at $0002
LOOP BRA LOOP ; nice way to stop without running wild.
; this instruction branches back on itself in
; an endless loop.
to edit the program on the EVB monitor.
The cleaned code should look like this:
org c000
Dat1: db d7
Dat2: db 16
org c100
Start: ldaa c000
adda c001
staa c002
swi
Also, remember that transferring this file from a PC to the unix system will expose a ^M character
on the end of each line. This must be edited out of the unix file PRIOR to using the asm11 command.
The best way I have found to edit out the ^M:
Download QVT/Term from the ITSS webpage. Use it as a telnet client with your PC to logon to the university unix system. After logon, you will automatically launch the UMENU client, from which you can select unix as an option. Selecting unix automatically puts you into your home directory on the unix account. Use the command vi filename to edit out the ^M characters.