-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhello_world.asm
53 lines (37 loc) · 1.16 KB
/
hello_world.asm
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
41
42
43
44
45
46
47
48
49
50
51
52
; Simple program printing "Hello, World!" to the LCD display,
; waiting for a while between each character
#include "layouts/subeater.asm"
#bank program
; Main program
reset:
ldx #0xff ; Initialize the stack pointer at the end of its dedicated page
txs
jsr lcd_init ; Initialize LCD display
jsr event_init ; Initialize event module
.main:
jsr lcd_clear ; Clear display
ldx #0 ; Initalize X register
.print:
lda message,x ; Get a character from message, indexed by X
beq .done ; Start over when the zero char is reached
jsr lcd_print_char ; Print the character
lda #20 ; Load 20 * 10 ms
jsr event_sleep ; Sleep for 0.2 seconds
inx ; Increment the X register
jmp .print ; Loop over
.done:
lda #100 ; Load 100 * 10 ms
jsr event_sleep ; Sleep for 1 second
jmp .main ; Loop over
message:
#d "Hello, World!" ; This is the string to display
#d "\0" ; Null terminated
; Interrupt handling
nmi:
rti
irq:
jsr event_irq
rti
; Libraries
#include "libraries/lcd.asm"
#include "libraries/event.asm"