-
Notifications
You must be signed in to change notification settings - Fork 170
/
zx_01_output_char_32.m4
167 lines (122 loc) · 4.59 KB
/
zx_01_output_char_32.m4
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
dnl############################################################
dnl## ZX_01_OUTPUT_CHAR_32 STATIC INSTANTIATOR ##
dnl############################################################
dnl## ##
dnl## m4_zx_01_output_char_32(...) ##
dnl## ##
dnl## $1 = label attached to FILE or 0 if fd only ##
dnl## $2 = ioctl_flags (16 bits) ##
dnl## $3 = cursor.x coordinate ##
dnl## $4 = cursor.y coordinate ##
dnl## $5 = window.x coordinate ##
dnl## $6 = window.width ##
dnl## $7 = window.y coordinate ##
dnl## $8 = window.height ##
dnl## $9 = scroll limit (number of scrolls until pause) ##
dnl## $10 = font address ##
dnl## $11 = foreground colour (text attribute) ##
dnl## $12 = foreground mask (set bits = keep screen bits) ##
dnl## $13 = background colour (cls attribute) ##
dnl## ##
dnl############################################################
define(`m4_zx_01_output_char_32',dnl
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; FILE : `ifelse($1,0,`(none)',$1)'
;
; driver: zx_01_output_char_32
; fd : __I_FCNTL_NUM_FD
; mode : write only
; type : 002 = output terminal
;
; ioctl_flags : $2
; cursor coord : `($3,$4)'
; window : `($5,$6,$7,$8)'
; scroll limit : $9
; font address : $10
; text colour : $11
; text mask : $12
; background : $13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
`ifelse($1,0,,dnl
SECTION data_clib
SECTION data_stdio
; FILE *
PUBLIC $1
$1: defw __i_stdio_file_`'__I_STDIO_NUM_FILE + 2
; FILE structure
__i_stdio_file_`'__I_STDIO_NUM_FILE:
; open files link
defw ifelse(__I_STDIO_NUM_FILE,0,0,__i_stdio_file_`'decr(__I_STDIO_NUM_FILE))
; jump to underlying fd
defb 195
defw __i_fcntl_fdstruct_`'__I_FCNTL_NUM_FD
; state_flags_0
; state_flags_1
; conversion flags
; ungetc
defb 0x80 ; write + normal file type
defb 0 ; last operation was write
defb 0
defb 0
; mtx_recursive
defb 0 ; thread owner = none
defb 0x02 ; mtx_recursive
defb 0 ; lock count = 0
defb 0xfe ; atomic spinlock
defw 0 ; list of blocked threads
`define(`__I_STDIO_NUM_FILE', incr(__I_STDIO_NUM_FILE))'dnl
)'dnl
; fd table entry
SECTION data_fcntl_fdtable_body
defw __i_fcntl_fdstruct_`'__I_FCNTL_NUM_FD
; FDSTRUCT structure
SECTION data_fcntl_stdio_heap_body
EXTERN console_01_output_terminal_fdriver
EXTERN zx_01_output_char_32
__i_fcntl_heap_`'__I_FCNTL_NUM_HEAP:
; heap header
defw __i_fcntl_heap_`'incr(__I_FCNTL_NUM_HEAP)
defw 35
defw ifelse(__I_FCNTL_NUM_HEAP,0,0,__i_fcntl_heap_`'decr(__I_FCNTL_NUM_HEAP))
__i_fcntl_fdstruct_`'__I_FCNTL_NUM_FD:
; FDSTRUCT structure
; call to first entry to driver
defb 205
defw console_01_output_terminal_fdriver
; jump to driver
defb 195
defw zx_01_output_char_32
; flags
; reference_count
; mode_byte
defb 0x02 ; type = output terminal
defb `ifelse($1,0,1,2)'
defb 0x02 ; write only
; ioctl_flags
defw $2
; mtx_plain
defb 0 ; thread owner = none
defb 0x01 ; mtx_plain
defb 0 ; lock count = 0
defb 0xfe ; atomic spinlock
defw 0 ; list of blocked threads
; cursor coordinate
; window rectangle
; scroll limit
defb `$3, $4'
defb `$5, $6, $7, $8'
defb $9
; font address
; text colour
; text mask
; background colour
EXTERN $10
defw $10 - 256
defb $11
defb $12
defb $13
`define(`__I_FCNTL_NUM_FD', incr(__I_FCNTL_NUM_FD))'dnl
`define(`__I_FCNTL_HEAP_SIZE', eval(__I_FCNTL_HEAP_SIZE + 35))'dnl
`define(`__I_FCNTL_NUM_HEAP', incr(__I_FCNTL_NUM_HEAP))'dnl
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
)dnl