EXAMPLE CODE

OUTPUT

This code will display the text Hello World and the number contained in D1 on the following line.

* Note! asterisk '*' in first column for comments
* labels must start in first column

        ORG $1000            the program will load into address $1000

* Display text greet
* see Help/Simulator IO for a complete list of task numbers
START   MOVE   #14,D0        put text display task number in D0
        LEA    GREET,A1      load address of string to display into A1
        TRAP   #15           activates input/output task

* Display the contents of register D1
* task number 3 is used to display the contents of D1.L as a number
        MOVE.L #12345678,D1  put a number in D1 so we can display it

        MOVE   #3,d0         task number 3 into D0
        TRAP   #15           display number in D1.l

* Stop execution
        STOP   #$2000

GREET   DC.B   'Hello World',$D,$A,0    null terminated string with newline

        END     START        end of program with start address specified
 

 

INPUT

This code will read a number and a string from the keyboard

        ORG $1000            the program will load into address $1000
 

* input a number into register D1.L

START   MOVE.B  #4,D0        trap code 4 (read number into D1.L)

        TRAP    #15          get number

 

* input a string, store in BUFFER
        MOVE   #2,D0         read a string task number in D0
        LEA    BUFFER,A1     load address of buffer for string into A1
        TRAP   #15           activates input/output task

* Stop execution
        STOP   #$2000

BUFFER  DS.B   80            buffer for input string
        END    START         end of program with start address specified
 

See Help and the EXAMPLES folder for more information and example code. More examples are also available at www.easy68k.com