Skip to content

BASIC OUT Statement

Curtis F Kaylor edited this page May 20, 2024 · 3 revisions

OUT

TYPE: USB BASIC system statement


FORMAT: OUT port , byte

Action: Sends byte to the I/O port port.

  • port is an integer expression specifying the I/O port the byte is to be sent to.
    • If port is in the range 0 through 255, it directly corresponds to the I/O port number.
    • If port is in the ranges -32768 through -1 or 256 through 32767.
      • The the low byte specifies the I/O port to be written to.
      • The high byte is placed on lines 7 through 15 of the address bus.
  • byte is an integer between 0 and 255 specifying the value to be sent to the port.

Examples of OUT:

OUT 246, 12

Send a value of 12 to the SOUND chip

10 X=14:OUT 254, X

Send a value of 14 to the Cassette sound port


plusBASIC v0.22w enhancements


FORMAT: OUT port , bytes { ; port , bytes ...}

Action: Sends one or more bytes to one or more Z80 I/O ports.

  • port is an integer in the range -65536 through 65535.
    • The low byte of port specifies the I/O port to be written to
    • The high byte of port is place on lines 7 through 15 of the address bus.
  • bytes is is a list of one or more byte values and/or strings, separated by commas.

Examples of OUT:

P$="ABCD":OUT 252,P$

Send bytes with values 64, 65, 66, and 67 to cassette port

10 OUT 254,0,$"010203",4

Sends bytes with values 0, 1, 2, 3, and 4, to the printer port.

OUT $EA,17;$EB,$"0468"

Sets the second color of palette 1 to RGB values 6, 4, and 8, respectively.

Clone this wiki locally