-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello_uart.k65
More file actions
40 lines (35 loc) · 838 Bytes
/
hello_uart.k65
File metadata and controls
40 lines (35 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* Hello UART example for X65 RIA
*
* This example demonstrates how to send a string over UART using the X65 RIA architecture.
* It waits until the UART is ready to transmit, then sends each character of the string "Hello, World!"
* followed by a carriage return and line feed. Finally, it halts the CPU.
*/
/// UART register addresses
var UART_READY = $FFE0
var UART_DATA = $FFE1
/// API operation address
var API_OP = $FFF1
data VECTORS {
segment VECTORS
word 0 0 0 0 0 0 0 0
word 0 0 0 0 0 0 main 0
}
func main {
x = %0
{
{ a&?UART_READY } n-? // Wait until UART is ready (bit 7 - TX FIFO not full)
UART_DATA = a = text,x
x++
a?0
} !=
API_OP = a = [$FF] // Halt CPU
}
data text {
"Hello, World!"
$0D $0A $00
}
data INFO {
segment INFO
"Hello UART example for X65 RIA"
}