-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello-world.asm
93 lines (79 loc) · 1.76 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
;
; CPU operation source addresses
;
pc equ 0
pc+2 equ 1
pc+4 equ 2
pc+6 equ 3
[a] equ 7
a equ 8
sf equ 9
zf equ 10
cf equ 12
;
; CPU operation destination addresses
;
pcs equ 1 ; pc if negative
pcz equ 2 ; pc if zero
pcc equ 4 ; pc if carry
a- equ 9
-a equ 10
a+ equ 11
a^ equ 12
a| equ 13
a& equ 14
a>> equ 15
;
; UART registers
;
tx equ 0xfffc ; Transmit register
?tx equ 0xfffd ; Bit 0 transmiter busy
rx equ 0xfffe ; Receive register
?rx equ 0xffff ; Bit 0 receive register empty
org 0x10
mov pc,#start
hello db 'MISC-16',0xa,'Hello World!',0xa,0
#hello dw hello
#0 dw 0
#1 dw 1
#ff dw 0xff
ptr dw 0
#start dw start
#lp1 dw lp1
#end dw end
#test dw test
t0 dw 0
text db 'AC'
start mov a,#hello
mov ptr,a
lp1 mov a,[a]
mov a>>,a
mov a>>,a
mov a>>,a
mov a>>,a
mov a>>,a
mov a>>,a
mov a>>,a
mov a>>,a
mov a&,#ff
mov pcz,#test
mov tx,a
mov a,ptr
mov a,[a]
mov a&,#ff
mov pcz,#test
mov tx,a
mov a,ptr
mov a+,#1
mov ptr,a
mov pc,#lp1
test mov pc,pc+4
mov tx,text ; This line skipped
mov tx,text
mov tx,text
end mov t0,pc+2
mov a>>,?rx
mov pcc,t0
mov tx,rx
mov pc,#end
; End of file