Inputting data from the keyboard and outputting results to the screen are handled by Monitor Systems Calls written in by the programmer. They are made by executing a "trap #11" instruction and a .byte word indicating the call. The full list of system calls can be found in the Flight-68k Users Manual but some of the most useful ones will be looked at in this section.
The call:
trap #11 .byte 0,0has the effect of ending the users program and returns control to the monitor. It is usually at the end of all assembly programs.
There are a number of calls that concern output to the screen:
trap #11 .byte 0,8prints out the lowest four bits of d0 to the screen as one hex character.
trap #11 .byte 0,9prints out the lowest eight bits (the byte) of d0 to the screen as two hex characters.
trap #11 .byte 0,10prints out the lowest sixteen bits (the word) of d0 to the screen as four hex characters.
trap #11 .byte 0,11prints out the whole (longword) of d0 to the screen as eight hex character.
trap #11 .byte 0,5prints out a string of characters addressed at a6. After using this code, d0.b is cleared so its previous contents will be lost. The text is defined in the form:
text1: .text "write to screen",00where text1 is a label identifier and write to screen is displayed. To load the text into a6, use the instruction:
lea text1,a6which loads the effective address of text1 into a6. Output examples can be seen in the program add3.
trap #11 .byte 0,19which reads a string of hex characters into d1.l, inserting any leading zeroes in necessary.The string is stopped after a non-hex character is input or eight characters have been input. The register d2.l holds the number of hex characters input and d0.b holds the non- hex terminating character so information previously held in these registers is lost.
A useful system call is:
trap #11 .byte 0,12which starts a new line on the screen.