-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_rom.asm
69 lines (47 loc) · 1.55 KB
/
test_rom.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
; Test script
#include "layouts/subeater.asm"
; Allocate a string buffer
#bank ram
string_buffer: #res 256
; Main program
#bank program
reset:
jsr lcd_init ; Init LCD display
jsr event_init ; Init event module
lda #2 ; Wait 20 ms
jsr event_sleep ; for the ROM write protection to fade out
wrw #0x0000 r0 ; Load 0 in word r0
.main: ; Main program
wrw r0 a0 ; Copy value in word r0 to first argument
wrw #string_buffer a2 ; Load string buffer as destination
jsr to_base10 ; Convert to decimal
wrw #string_buffer a0 ; Load string buffer address as source
wrw #rom_data a2 ; Load rom data address as destination
jsr rom_write ; Write to rom
jsr lcd_clear ; Clear LCD
jsr lcd_print_str ; Print string buffer to LCD
lda #":" ; Load a separator
jsr lcd_print_char ; Print the separator
wrw #rom_data a0 ; Load rom data address as argument
jsr lcd_print_str ; Print rom data
lda #":" ; Load a separator
jsr lcd_print_char ; Print the separator
inw r0 ; Increment word in r0
lda #5 ; Load 5 * 10 ms
jsr event_sleep ; Sleep for 50 seconds
jmp .main ; Loop over
; Interrupt
nmi:
rti
irq:
jsr event_irq
rti
; Libraries
#include "libraries/lcd.asm"
#include "libraries/rom.asm"
#include "libraries/event.asm"
#include "libraries/decimal.asm"
; Reserve data
#align 256 * 8 ; Next page
rom_data: ; Reserve a page
#res 256