-
Notifications
You must be signed in to change notification settings - Fork 1
/
rom1.asm
147 lines (112 loc) · 1.52 KB
/
rom1.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
; z80asm -v -a rom1.asm
SCREEN EQU 61440
STACKTOP EQU 33790
MEMSTART EQU 32768
ORG 00h
START:
ld sp,STACKTOP
JP MAIN
ORG 08h
ORG 10h
ORG 20h
ORG 28h
ORG 30h
ORG 38h
; interrupt handler
ei
reti
ORG 66h
; NMI handler
exx
ex af,af'
ld a, 'X'
ld hl, SCREEN
ld (hl), a
ex af,af'
exx
retn
; CP/M style - real stuff starts here
ORG 100h
MAIN:
ld a,01h ; first led
out (0ffh),a
; save something to RAM and see if we get it back
ld hl, MEMSTART
ld (hl), a
ld d,(hl)
cp d
jr nz, fail
ld a,0AAh ; every second led
out (0ffh),a
fail:
ld a, 22
; just to test that the RAM is working!
push af
startmessage:
ld hl,SCREEN
ld de,message
ld a,(de)
ld b,a
inc de
msgloop:
ld a,(de)
ld (hl),a
inc de
inc hl
ld a,%11001111 ; white on red flashing
ld (hl),a
inc hl
djnz msgloop
; The first byte on the start of the 7th row (160*7 + 1)
ld de, 960
ld a,0
ld c, '*'
ld hl, SCREEN
add hl, de
ld b,8
row1:
push bc
ld b,16
col1:
ld (hl),c
inc hl
ld (hl),a
inc hl
ld (hl),c
inc hl
ld (hl),a
inc hl
inc a
djnz col1
ld de, 96
add hl, de
pop bc
djnz row1
halt
; this is the high-speed character spew. We don't need that now.
ld a,65
startscreen:
ld hl,SCREEN
ld b, 25
rowloop:
push bc
ld b,79
lineloop:
ld (hl),a
inc hl
inc hl
djnz lineloop
pop bc
inc a
djnz rowloop
push af
; toggle LED 6
ld d,32
in a,(0ffh)
xor d
out (0ffh),a
pop af
jp startscreen
message:
DEFB 50
DEFM "This is the FPGA vt100 emulator. Nothing works yet"