libmsx
C library for MSX
Loading...
Searching...
No Matches
workarea.h
Go to the documentation of this file.
1// -*- coding: utf-8-unix -*-
2/*
3 * Copyright (c) 2021-2024 Daishi Mori (mori0091)
4 *
5 * This software is released under the MIT License.\n
6 * See https://github.com/mori0091/libmsx/blob/main/LICENSE
7 *
8 * GitHub libmsx project\n
9 * https://github.com/mori0091/libmsx
10 */
16#pragma once
17
18#ifndef WORKAREA_H
19#define WORKAREA_H
20
21#include <stdint.h>
22
23#include "config.h"
24#include "bios_const.h"
25
26// ---- BDOS/FDC workarea ----
30static volatile __at (0xf323) void ** DISKVE;
31
35static volatile __at (0xf325) void ** BREAKV;
36
44static volatile __at (0xf341) uint8_t RAMAD0;
45
53static volatile __at (0xf342) uint8_t RAMAD1;
54
62static volatile __at (0xf343) uint8_t RAMAD2;
63
71static volatile __at (0xf344) uint8_t RAMAD3;
72
80static volatile __at (0xf348) uint8_t MASTERS;
81
82// ---- sub-routine for inter-slot call ----
83static volatile __at (0xf380) uint8_t RDPRIM[5];
84static volatile __at (0xf385) uint8_t WRPRIM[7];
85static volatile __at (0xf38c) uint8_t CLPRIM[14];
86
87// ---- USR function start address / text screen ----
88static volatile __at (0xf39a) void * USRTAB[10];
89
90static volatile __at (0xf3ae) uint8_t LINL40;
91static volatile __at (0xf3af) uint8_t LINL32;
92static volatile __at (0xf3b0) uint8_t LINLEN;
93static volatile __at (0xf3b1) uint8_t CRTCNT;
94static volatile __at (0xf3b2) uint8_t CLMLST;
95
96// ---- VRAM memory map / other screen setting ----
97static volatile __at (0xf3b3) uint16_t TXTNAM;
98static volatile __at (0xf3b5) uint16_t TXTCOL;
99static volatile __at (0xf3b7) uint16_t TXTCGP;
100static volatile __at (0xf3b9) uint16_t TXTATR;
101static volatile __at (0xf3bb) uint16_t TXTPAT;
102
103static volatile __at (0xf3bd) uint16_t T32NAM;
104static volatile __at (0xf3bf) uint16_t T32COL;
105static volatile __at (0xf3c1) uint16_t T32CGP;
106static volatile __at (0xf3c3) uint16_t T32ATR;
107static volatile __at (0xf3c5) uint16_t T32PAT;
108
109static volatile __at (0xf3c7) uint16_t GRPNAM;
110static volatile __at (0xf3c9) uint16_t GRPCOL;
111static volatile __at (0xf3cb) uint16_t GRPCGP;
112static volatile __at (0xf3cd) uint16_t GRPATR;
113static volatile __at (0xf3cf) uint16_t GRPPAT;
114
115static volatile __at (0xf3d1) uint16_t MLTNAM;
116static volatile __at (0xf3d3) uint16_t MLTCOL;
117static volatile __at (0xf3d5) uint16_t MLTCGP;
118static volatile __at (0xf3d7) uint16_t MLTATR;
119static volatile __at (0xf3d9) uint16_t MLTPAT;
120
121// ---- BASIC ----
122static volatile __at (0xf3db) uint8_t CLIKSW;
123static volatile __at (0xf3dc) uint8_t CSRY;
124static volatile __at (0xf3dd) uint8_t CSRX;
125static volatile __at (0xf3de) uint8_t CNSDFG;
126
127// ---- VDP (TMS9918) register save area, etc. ----
128static volatile __at (0xf3df) uint8_t RG0SAV;
129static volatile __at (0xf3e0) uint8_t RG1SAV;
130static volatile __at (0xf3e1) uint8_t RG2SAV;
131static volatile __at (0xf3e2) uint8_t RG3SAV;
132static volatile __at (0xf3e3) uint8_t RG4SAV;
133static volatile __at (0xf3e4) uint8_t RG5SAV;
134static volatile __at (0xf3e5) uint8_t RG6SAV;
135static volatile __at (0xf3e6) uint8_t RG7SAV;
136
137static volatile __at (0xf3e7) uint8_t STATFL;
138
139// ---- BASIC ----
140static volatile __at (0xf3e8) uint8_t TRGFLG;
141
142static volatile __at (0xf3e9) uint8_t FORCLR;
143static volatile __at (0xf3ea) uint8_t BAKCLR;
144static volatile __at (0xf3eb) uint8_t BDRCLR;
145
146static volatile __at (0xf3ec) uint8_t MAXUPD[3];
147static volatile __at (0xf3ef) uint8_t MINUPD[3];
148static volatile __at (0xf3f2) uint8_t ATRBYT;
149
150static volatile __at (0xf3f3) void * QUEUES;
151
152static volatile __at (0xf3f5) uint8_t FRCNEW;
153static volatile __at (0xf3f6) uint8_t SCNCNT;
154static volatile __at (0xf3f7) uint8_t REPCNT;
155static volatile __at (0xf3f8) void * PUTPNT;
156static volatile __at (0xf3fa) void * GETPNT;
157
158// ---- Cassette Tape, etc. ----
159// f3fc .. f413
160
161// ---- Internal use for BASIC ----
162// f414 .. f6e3
163
164// ---- Parameters for user functions (BASIC) ----
165// f6e4 .. f7c4
166
167// ---- Math-pack ----
168// f7c5 .. f85e
169
170// ---- Data for BASIC ----
171// f85f .. f930
172
176static volatile __at (0xf87f) uint8_t FNKSTR[10][16];
177
182struct cgpnt {
183 uint8_t slot;
184 struct font * addr;
185};
186
195static volatile __at (0xf91f) struct cgpnt const CGPNT;
196
197static volatile __at (0xf922) uint16_t NAMBAS;
198static volatile __at (0xf924) uint16_t CGPBAS;
199static volatile __at (0xf926) uint16_t PATBAS;
200static volatile __at (0xf928) uint16_t ATRBAS;
201
202
203// ---- Data for `CIRCLE`/`PAINT` statements ----
204// f931 .. f955
205
206// ---- Data for `PLAY` statement ----
207// f956 .. faf4
208
209// ---- Workarea for `MSX2` or later ----
210// faf5 .. fb02
216static volatile __at (0xfaf8) uint8_t EXBRSA;
217
218// ---- Data for RS-232C, etc. ----
219// fb03 .. fb28
220
221static volatile __at (0xfb20) uint8_t HOKVLD;
222
241static volatile __at (0xfb21) uint8_t DRVTBL[8];
242
246static volatile __at (0xfc4a) uint16_t HIMEM;
247
248// ---- Data for `PLAY` statement ----
249// fb35 .. fbaf
250
251// ---- Data area ----
252// fbb0 .. fd99
253
254// ------ Timer ------
258static volatile __at (0xfc9e) uint16_t JIFFY;
259
260// ------ Slot workarea ------
277static volatile __at (0xfcc1) uint8_t EXPTBL[4];
278
290static volatile __at (0xfcc5) uint8_t SLTTBL[4];
291
316static volatile __at (0xfcc9) uint8_t SLTATR[64];
317
332static volatile __at (0xfd09) uint8_t SLTWRK[128];
333
334
335// ---- Hooks (interrupts, console I/O, etc.) ----
336// fd9a .. fdee
337static volatile __at(0xfd9a) uint8_t H_KEYI[5];
338static volatile __at(0xfd9f) uint8_t H_TIMI[5];
339
340// ---- Hooks (disk I/O) ----
341// fdef .. feb1
342
343// ---- Hooks (logical device name) ----
344// feb2 .. feca
345
346// ---- Hooks (internal use for BASIC) ----
347// fecb .. ffc9
348
349// ---- Extended BIOS ----
350static volatile __at (0xffca) uint8_t FCALL[5];
351static volatile __at (0xffcf) uint8_t DISINT[5];
352static volatile __at (0xffd4) uint8_t ENAINT[5];
353
354
355// ---- VDP (V9938) register save area. ----
356static volatile __at (0xffe7) uint8_t RG8SAV;
357static volatile __at (0xffe8) uint8_t RG9SAV;
358static volatile __at (0xffe9) uint8_t RG10SA;
359static volatile __at (0xffea) uint8_t RG11SA;
360static volatile __at (0xffeb) uint8_t RG12SA;
361static volatile __at (0xffec) uint8_t RG13SA;
362static volatile __at (0xffed) uint8_t RG14SA;
363static volatile __at (0xffee) uint8_t RG15SA;
364static volatile __at (0xffef) uint8_t RG16SA;
365static volatile __at (0xfff0) uint8_t RG17SA;
366static volatile __at (0xfff1) uint8_t RG18SA;
367static volatile __at (0xfff2) uint8_t RG19SA;
368static volatile __at (0xfff3) uint8_t RG20SA;
369static volatile __at (0xfff4) uint8_t RG21SA;
370static volatile __at (0xfff5) uint8_t RG22SA;
371static volatile __at (0xfff6) uint8_t RG23SA;
372
373// ---- VDP (V9958) register save area. ----
374static volatile __at (0xfffa) uint8_t RG25SA;
375static volatile __at (0xfffb) uint8_t RG26SA;
376static volatile __at (0xfffc) uint8_t RG27SA;
377
378#endif
Constant variables in the MSX BIOS ROM.
MSX Structure of MSX bitmap fonts (256 pattern x 8x8 pix x 1bpp).
Definition bios_const.h:31
Hack for C Compiler portability.
static volatile uint16_t NAMBAS
MSX Current pattern name table address.
Definition workarea.h:197
static volatile uint8_t HOKVLD
MSX Extended BIOS flag.
Definition workarea.h:221
static volatile struct cgpnt const CGPNT
MSX Location of the current fonts.
Definition workarea.h:195
static volatile uint8_t RG1SAV
MSX Saved value for VDP R#1 register.
Definition workarea.h:129
static volatile uint8_t REPCNT
MSX Interval time until auto repeat of key input.
Definition workarea.h:154
static volatile uint8_t CSRX
MSX X coordinate of cursor.
Definition workarea.h:124
static volatile void ** DISKVE
MSX Pointer to pointer to disk error routine.
Definition workarea.h:30
static volatile uint8_t MASTERS
MSX Slot address of the master FDC cartridge.
Definition workarea.h:80
static volatile uint8_t RG2SAV
MSX Saved value for VDP R#2 register.
Definition workarea.h:130
static volatile uint16_t GRPPAT
MSX SCREEN 2 / Sprite pattern generator table address.
Definition workarea.h:113
static volatile void * PUTPNT
MSX Pointer to key buffer for writing.
Definition workarea.h:155
static volatile uint8_t RG22SA
MSX2 Saved value for VDP R#22 register.
Definition workarea.h:370
static volatile uint16_t T32CGP
MSX SCREEN 1 / Pattern generator table address.
Definition workarea.h:105
static volatile uint8_t RG18SA
MSX2 Saved value for VDP R#18 register.
Definition workarea.h:366
static volatile uint8_t RG21SA
MSX2 Saved value for VDP R#21 register.
Definition workarea.h:369
static volatile uint8_t RG11SA
MSX2 Saved value for VDP R#11 register.
Definition workarea.h:359
static volatile uint8_t SLTWRK[128]
MSX Workarea for applications (cartridge).
Definition workarea.h:332
static volatile uint8_t FRCNEW
MSX Internal use of BASIC interpreter.
Definition workarea.h:152
static volatile uint8_t RAMAD0
MSX Slot address of page #0 of RAM.
Definition workarea.h:44
uint8_t slot
Slot of the current fonts.
Definition workarea.h:183
static volatile uint8_t STATFL
MSX Saved value for VDP S#0 register.
Definition workarea.h:137
static volatile uint8_t RG8SAV
MSX2 Saved value for VDP R#8 register.
Definition workarea.h:356
static volatile uint8_t DISINT[5]
MSX Used by DOS.
Definition workarea.h:351
static volatile uint8_t RG7SAV
MSX Saved value for VDP R#7 register.
Definition workarea.h:135
static volatile uint16_t T32COL
MSX SCREEN 1 / Color table address.
Definition workarea.h:104
static volatile void ** BREAKV
MSX Pointer to pointer to CTRL+C routine.
Definition workarea.h:35
static volatile uint16_t GRPCGP
MSX SCREEN 2 / Pattern generator table address.
Definition workarea.h:111
static volatile uint16_t ATRBAS
MSX Current sprite attribute table address.
Definition workarea.h:200
static volatile uint16_t GRPCOL
MSX SCREEN 2 / Color table address.
Definition workarea.h:110
static volatile uint8_t FCALL[5]
MSX Used by extended BIOS.
Definition workarea.h:350
static volatile uint8_t MAXUPD[3]
MSX Internal use of LINE statement.
Definition workarea.h:146
static volatile uint8_t RG4SAV
MSX Saved value for VDP R#4 register.
Definition workarea.h:132
static volatile uint8_t ENAINT[5]
MSX Used by DOS
Definition workarea.h:352
static volatile uint16_t JIFFY
MSX Free-running counter that counts up every VSYNC interrupts.
Definition workarea.h:258
static volatile uint8_t RG3SAV
MSX Saved value for VDP R#3 register.
Definition workarea.h:131
static volatile uint8_t RG10SA
MSX2 Saved value for VDP R#10 register.
Definition workarea.h:358
static volatile uint8_t LINLEN
MSX WIDTH of the current screen.
Definition workarea.h:92
static volatile uint16_t HIMEM
MSX The highest address of free area (bottom of stack).
Definition workarea.h:246
static volatile uint8_t RG20SA
MSX2 Saved value for VDP R#20 register.
Definition workarea.h:368
static volatile uint8_t RG23SA
MSX2 Saved value for VDP R#23 register.
Definition workarea.h:371
static volatile uint16_t T32ATR
MSX SCREEN 1 / Sprite attribute table address.
Definition workarea.h:106
static volatile uint16_t TXTNAM
MSX SCREEN 0 / Pattern name table address.
Definition workarea.h:97
static volatile uint8_t MINUPD[3]
MSX Internal use of LINE statement.
Definition workarea.h:147
static volatile uint8_t RG5SAV
MSX Saved value for VDP R#5 register.
Definition workarea.h:133
static volatile uint8_t LINL40
MSX WIDTH in SCREEN 0
Definition workarea.h:90
static volatile uint8_t CNSDFG
MSX Function Key display switch (0:off, non-zero:on).
Definition workarea.h:125
static volatile uint8_t EXBRSA
MSX2 The slot address of SUB ROM
Definition workarea.h:216
static volatile uint8_t ATRBYT
MSX Color in graphic mode / attribute byte.
Definition workarea.h:148
static volatile uint16_t MLTCGP
MSX SCREEN 3 / Pattern generator table address.
Definition workarea.h:117
static volatile uint8_t RG6SAV
MSX Saved value for VDP R#6 register.
Definition workarea.h:134
static volatile uint8_t H_TIMI[5]
Hook for timer interrupts (VSYNC).
Definition workarea.h:338
static volatile void * GETPNT
MSX Pointer to key buffer for reading.
Definition workarea.h:156
static volatile uint8_t CLMLST
MSX Used for PRINT statement.
Definition workarea.h:94
static volatile uint16_t TXTCGP
MSX SCREEN 0 / Pattern generator table address.
Definition workarea.h:99
static volatile uint8_t BDRCLR
MSX Border color.
Definition workarea.h:144
static volatile uint8_t RAMAD3
MSX Slot address of page #3 of RAM.
Definition workarea.h:71
static volatile uint8_t RG16SA
MSX2 Saved value for VDP R#16 register.
Definition workarea.h:364
static volatile uint8_t CRTCNT
MSX Number of lines of the current screen.
Definition workarea.h:93
static volatile uint8_t RG25SA
MSX2+ Saved value for VDP R#25 register.
Definition workarea.h:374
static volatile uint8_t CLIKSW
MSX Key click beep switch (0:off, non-zero:on).
Definition workarea.h:122
static volatile uint8_t RG15SA
MSX2 Saved value for VDP R#15 register.
Definition workarea.h:363
static volatile uint8_t RG27SA
MSX2+ Saved value for VDP R#27 register.
Definition workarea.h:376
static volatile uint8_t FORCLR
MSX Foreground color.
Definition workarea.h:142
static volatile uint16_t GRPNAM
MSX SCREEN 2 / Pattern name table address.
Definition workarea.h:109
static volatile void * QUEUES
MSX Pointer to the queue table of PLAY statement.
Definition workarea.h:150
static volatile void * USRTAB[10]
MSX Table of start address of USR0..USR9.
Definition workarea.h:88
static volatile uint16_t TXTPAT
(unused)
Definition workarea.h:101
static volatile uint8_t RG14SA
MSX2 Saved value for VDP R#14 register.
Definition workarea.h:362
static volatile uint16_t TXTATR
(unused)
Definition workarea.h:100
static volatile uint8_t DRVTBL[8]
MSX Slot and number of drives for each Floppy Disk Controller (FDC).
Definition workarea.h:241
struct font * addr
Address of the current fonts.
Definition workarea.h:184
static volatile uint16_t GRPATR
MSX SCREEN 2 / Sprite attribute table address.
Definition workarea.h:112
static volatile uint16_t T32PAT
MSX SCREEN 1 / Sprite pattern generator table address.
Definition workarea.h:107
static volatile uint16_t MLTNAM
MSX SCREEN 3 / Pattern name table address.
Definition workarea.h:115
static volatile uint8_t RAMAD1
MSX Slot address of page #1 of RAM.
Definition workarea.h:53
static volatile uint8_t RG12SA
MSX2 Saved value for VDP R#12 register.
Definition workarea.h:360
static volatile uint8_t LINL32
MSX WIDTH in SCREEN 1
Definition workarea.h:91
static volatile uint8_t SLTTBL[4]
MSX Save area for expanded slot select registers.
Definition workarea.h:290
static volatile uint8_t SCNCNT
MSX Key scanning interval time.
Definition workarea.h:153
static volatile uint8_t FNKSTR[10][16]
MSX String for each function keys.
Definition workarea.h:176
static volatile uint8_t SLTATR[64]
MSX Attributes for application (cartridge).
Definition workarea.h:316
static volatile uint8_t RDPRIM[5]
MSX Inter-slot read from primary slot.
Definition workarea.h:83
static volatile uint16_t CGPBAS
MSX Current pattern generator table address.
Definition workarea.h:198
static volatile uint16_t TXTCOL
MSX2 SCREEN 0 / Color table address.
Definition workarea.h:98
static volatile uint8_t RG17SA
MSX2 Saved value for VDP R#17 register.
Definition workarea.h:365
static volatile uint8_t RAMAD2
MSX Slot address of page #2 of RAM.
Definition workarea.h:62
static volatile uint16_t T32NAM
MSX SCREEN 1 / Pattern name table address.
Definition workarea.h:103
static volatile uint8_t H_KEYI[5]
Hook for interrupts.
Definition workarea.h:337
static volatile uint8_t BAKCLR
MSX Background color.
Definition workarea.h:143
static volatile uint8_t CLPRIM[14]
MSX Inter-slot call to primary slot.
Definition workarea.h:85
static volatile uint8_t TRGFLG
MSX Joystick trigger button state.
Definition workarea.h:140
static volatile uint16_t MLTCOL
(unused)
Definition workarea.h:116
static volatile uint16_t MLTPAT
MSX SCREEN 3 / Sprite pattern generator table address.
Definition workarea.h:119
static volatile uint8_t RG26SA
MSX2+ Saved value for VDP R#26 register.
Definition workarea.h:375
static volatile uint16_t PATBAS
MSX Current sprite pattern generator table address.
Definition workarea.h:199
static volatile uint8_t CSRY
MSX Y coordinate of cursor.
Definition workarea.h:123
static volatile uint8_t RG0SAV
MSX Saved value for VDP R#0 register.
Definition workarea.h:128
static volatile uint8_t RG13SA
MSX2 Saved value for VDP R#13 register.
Definition workarea.h:361
static volatile uint8_t RG9SAV
MSX2 Saved value for VDP R#9 register.
Definition workarea.h:357
static volatile uint8_t RG19SA
MSX2 Saved value for VDP R#19 register.
Definition workarea.h:367
static volatile uint16_t MLTATR
MSX SCREEN 3 / Sprite attribute table address.
Definition workarea.h:118
static volatile uint8_t EXPTBL[4]
MSX Expansion flags for each primary slots.
Definition workarea.h:277
static volatile uint8_t WRPRIM[7]
MSX Inter-slot write to primary slot.
Definition workarea.h:84
MSX Structure of CGPNT.
Definition workarea.h:182