Devices

devices
calendarsave
xyw provides a way to interface with external systems using memory-mapped devices, just like Uxn. Devices are always mapped to page $00 (zero page), and can typically be easily accessed via macros. The xyw specification defines five default devices, each taking up to 16 bytes of memory (a row of a memory page), but an additional eleven devices could be implemented and mapped to the remaining rows. The following sections describe each device and their mapped addresses. === system
;system
.macro system.state           $00
.macro system.error           $01
.macro system.random          $02
.macro system._on_error       $03
.macro system._image_exec     $05
=== terminal
;terminal
.macro terminal.input          $10
.macro terminal.output         $11
.macro terminal.width          $12
.macro terminal.height         $13
.macro terminal._on_keypress   $14
.macro terminal._on_argument   $16
=== clock
;clock
.macro clock.year_w           $20
.macro clock.month            $22
.macro clock.monthday         $23
.macro clock.weekday          $24
.macro clock.hour             $25
.macro clock.minute           $26
.macro clock.second           $27
.macro clock.timer_w          $28
.macro clock._on_timer        $2A
=== file
;file
.macro file._path_s           $30
.macro file.type              $32
.macro file.size_w            $33
.macro file.result_w          $35
.macro file.length_w          $37
.macro file._buffer           $39
.macro file.operation         $3B
.macro file.offset            $3C
=== beeper
;beeper
.macro beeper.pitch_w         $40
.macro beeper.length_w        $42
.macro beeper.level           $44