Sim68K Text I/O


TRAP #15 is used for I/O.  Put the task number in D0.

 Task

  0  Display n characters of string at (A1), n is D1.W (stops on NULL or max 255) with CR, LF. (see task 13)
  1  Display n characters of string at (A1), n is D1.W (max 255) without CR, LF. (see task 14)
  2  Read string from keyboard and store at (A1), NULL (0) terminated, length returned in D1.W (max 80)
  3  Display signed number in D1.L in decimal in smallest field. (see task 15 & 20)
  4  Read a number from the keyboard into D1.L.
  5  Read single ASCII character from the keyboard into D1.B.
  6  Display single ASCII character in D1.B. 
  7

 Check for keyboard input. Set D1.B to 1 if keyboard input is pending, otherwise set to 0.
 Use task 2 or 5 to read pending key.

  8  Return time in hundredths of a second since midnight in D1.L.
  9  Terminate the program. (Halts the simulator)
 10

 Print the NULL terminated string at (A1) to the default printer.
 (Always send a Form Feed character to end printing. See below.)

 11

 Cursor Position, Set/Get or Clear Screen
 Set cursor position:
    The high byte of D1.W holds the COL number (0-255),  
    The low byte holds the ROW number (0-128).
    0,0 is top left. 
    Out of range coordinates are ignored.
 Get cursor position:
    Set D1.W to $00FF
    Returns COL number, ROW number in high and low byte of D1.W respectively. 
 Clear Screen : Set D1.W to $FF00.
 (Task 95 supports exact pixel placement of text)

 12

 Keyboard Echo.
    D1.B = 0 to turn off keyboard echo.
    D1.B = non zero to enable. (default).
    Echo is restored on 'Reset' or when a new file is loaded.

 13

 Display the NULL terminated string at (A1) with CR, LF.

 14

 Display the NULL terminated string at (A1) without CR, LF.

 15

 Display the unsigned number in D1.L converted to number base (2 through 36) contained in D2.B.
    For example, to display D1.L in base16 put 16 in D2.B
 Values of D2.B outside the range 2 to 36 inclusive are ignored.

 16

 Adjust display properties
    D1.B = 0 to turn off the display of the input prompt.
    D1.B = 1 to turn on the display of the input prompt. (default)
    D1.B = 2 do not display a line feed when Enter pressed during Trap task #2 input
    D1.B = 3 display a line feed when Enter key pressed during Trap task #2 input (default)
 Other values of D1 reserved for future use.
 Input prompt display is enabled by default and by 'Reset' or when a new file is loaded.

 17

 Combination of Trap codes 14 & 3.
 Display the NULL terminated string at (A1) without CR, LF then
 Display the decimal number in D1.L.

 18

 Combination of Trap codes 14 & 4.
 Display the NULL terminated string at (A1) without CR, LF then
 Read a number from the keyboard into D1.L.

 19

 Returns current state of up to 4 specified keys or returns key scan code.
  Pre: D1.L = four 1-byte key codes
  Post: D1.L contains four 1-byte Booleans.
           $FF = corresponding key is pressed, $00 = corresponding key not pressed.
  Pre: D1.L = $00000000
  Post: D1.L upper word contains key code of last key up.
           D1.L lower word contains key code of last key down.

Example:

     MOVE.B #19,D0    

     MOVE.L #'A'<<24+'S'<<16+'D'<<8+'F',D1 ; check for keypress (a,s,d,f)

     TRAP   #15
     BTST.L #24,D1     ; test for 'a'
     IF <NE> THEN      ; if 'a'
         {a code}
     ENDI
     BTST.L #16,D1     ; test for 's'
     IF <NE> THEN      ; if 's'
        ... etc

 20

 Display signed number in D1.L in decimal in field D2.B columns wide.

 21

 Set font properties where:
    D1.L is color as 0x00BBGGRR
        BB is amount of blue from 0x00 to 0xFF
        GG is amount of green from 0x00 to 0xFF
        RR is amount of red from 0x00 to 0xFF
    D2.L
        Low word is style by bits 0 = off, 1 = on
            bit0 is Bold
            bit1 is Italic
            bit2 is Underline
            bit3 is StrikeOut
        High word (low byte) is Size in points (High word = 0, keep current font)
            8, 9, 10, 11, 12, 14, 16, 18 (not all sizes are valid for all fonts)
            Font sizes in multiples of valid sizes ( size * n) results in a scaled appearance. For example:
            in Fixedsys font sizes of 9*2, 9*3, ..9*n will result in larger characters but the characters will have
            pixelated edges.
        High word (high byte) is Font
            1 - Fixedsys (size: 9)
            2 - Courier (sizes: 10, 12, 15)
            3 - Courier New (sizes 8,9,10,11,12,14,16,18)
            4 - Lucida Console (sizes 8,9,10,11,12,14,16,18)
            5 - Lucida Sans Typewriter (sizes 8,9,10,11,12,14,16,18)
            6 - Consolas (sizes 8,9,10,11,12,14,16,18)
            7 - Terminal (sizes 9,12,14)
    Example: D2.L = $01090005 is Fixedsys, 9 point, Bold Underline

 22  Read char at Row,Col of text screen.
  Pre: D1.L = High 16 bits = Row
                    Low 16 bits = Column
  Post: D1.B contains ASCII code of character.
 23  Delay n/100 of a second
  Pre: D1.L = n as unsigned number 0 through $FFFFFFFF
  Delay releases CPU which reduces power consumption. 
 24  Text I/O control
  Pre: D1.L = 0, Enable simulator shortcut keys. (default)
         D1.L = 1, Disable simulator shortcut keys.
                           All key codes are made available for 68000 program read using task 19.
                    all other values reserved.
  Shortcuts are restored by Rewind or Reload.
 25  Scroll Text Rectangle
  Pre: D1.L = High 16 bits = Top row (0 to 128)
                    Low 16 bits = Left column (0 to 255)
         D2.L = High 16 bits = Height in rows (Top + Height max 128)
                    Low 16 bits = Width in columns (Left + Width max 255)
         D3.W = 0 scroll up
         D3.W = 1 scroll down
         D3.W = 2 scroll left
         D3.W = 3 scroll right
                     all other values reserved
Task numbers 0 - 9 and 11 - 12 are compatible with the Teesside simulator.

The following control characters are supported. The labels shown (BEL, BS, HT, etc.) are not predefined in EASy68K. Placing the code in your program will equate the labels with the control characters.

BEL EQU  $07   Bell
BS  EQU  $08   Backspace
HT  EQU  $09   Tab (horizontal 5 characters)
LF  EQU  $0A   Line Feed
VT  EQU  $0B   Vertical tab (4 lines)
FF  EQU  $0C   Form Feed (Always end printing with a Form Feed.)
CR  EQU  $0D   Carriage Return