-
Notifications
You must be signed in to change notification settings - Fork 1
/
udg.asm
142 lines (71 loc) · 2.73 KB
/
udg.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
include "myMacros.inc"
.assume adl=1 ; ez80 ADL memory mode
.org $40000 ; load code here
jp start_here ; jump to start of code
.align 64 ; MOS header
.db "MOS",0,1
start_here:
push af ; store all the registers
push bc
push de
push ix
push iy
; ------------------
; This is our actual code
; Setup UDG character
ld hl, udgData ; address of string to use
ld bc, endUgdData - udgData ; length of string
rst.lil $18 ; Call the MOS API to send data to VDP
; prepare the screen
SET_MODE 8 ; mode 8 is 640x480 pixels, 64 colours
SET_COLOUR bright_red ; colours are define at end of this code
TAB_TO 5,10
ld a, alien
rst.lil $10 ; print our UDG
SET_COLOUR blue
SET_BG_COLOUR white
TAB_TO 10,15
; Sending a VDU byte stream
ld hl, VDUdata ; address of string to use
ld bc, endVDUdata - VDUdata ; length of string
rst.lil $18 ; Call the MOS API to send data to VDP
; reset the colours
SET_COLOUR bright_white
SET_BG_COLOUR black
; ------------------
; This is where we exit the program
pop iy ; Pop all registers back from the stack
pop ix
pop de
pop bc
pop af
ld hl,0 ; Load the MOS API return code (0) for no errors.
ret ; Return to MOS
; ------------------
; UGD data
alien: equ 128
udgData:
.db 23, alien ; define UDG character number
.db 10000010b ; binary data 0
.db 01111100b ; binary data 1
.db 10101010b ; binary data 2
.db 10000010b ; binary data 3
.db 11000110b ; binary data 4
.db 00111000b ; binary data 5
.db 01000100b ; binary data 6
.db 10000010b ; binary data 7
endUgdData:
; ------------------
; This is the text data we send to VDP
VDUdata:
.db "Hello Agon UDGs" ; print this text
.db 13,10 ; CR, LF
endVDUdata:
; ------------------
; colour data
bright_red: equ 9
green: equ 2
blue: equ 4
white: equ 7
black: equ 0
bright_white: equ 15