-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathdata.mac
591 lines (554 loc) · 15.7 KB
/
data.mac
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
.z80
name('data')
title MSX-DOS 2 Copyright (1986) IS Systems Ltd.
subttl Page-3 Fixed System Data Area
;-----------------------------------------------------------------------------
;
INCLUDE macros.inc
INCLUDE const.inc
;
;-----------------------------------------------------------------------------
;
spare macro size
ram_ad defl ram_ad+(size)
endm
;
var macro name,size,fixed
if1
ifnb <fixed>
if ram_ad ne x'&fixed'
.radix 16
pr_hex <name address is>,%ram_ad
.radix 10
endif
endif
endif
const name,ram_ad
ram_ad defl ram_ad+(size)
endm
;
var0 macro name,fixed
var name,0,fixed
endm
;
var1 macro name,fixed
var name,1,fixed
endm
;
var2 macro name,fixed
var name,2,fixed
endm
;
var3 macro name,fixed
var name,3,fixed
endm
;
;-----------------------------------------------------------------------------
;
const DATABASE,0F1C9h
ram_ad defl DATABASE
;
; ------------------------
;
var PRTBUF,6,F1C9 ;MSX-DOS1 compatible string output routine
; ------------------------
; These are available in MSX-DOS 1 mode too thanks to the modification
; of the STROUT routine, see dos1ker.mac
spare 1
;NOTE! BK4_ADD is manually defined in bank5/dos.h, and must be updated if it changes
var2 BK4_ADD,F1D0 ;Address of routine to be called in bank 4
var TMP_SEC,4 ;Used for temporary storage of a 32 bit sector number
;
; ------------------------
;
var0 JUMPBASE,F1D6 ;Start of jump table.
;
var3 RD_LDIR ;inter-slot LDIR routine for RAMdisk
var3 P0_LDIR ;Data transfer routine used by read/write code
var3 P0_CALL ;Call an MSX BIOS subroutine from kernel RAM
var3 $FLUSH ;Screen buffer flushing routine
var3 GO_DRV ;Call driver routine
var3 JP_VECT ;DOS1 compatible error jump
;
;var3 $IRQ ;Moved below DTA_ADDR to make room right before JUMPBASE
;(which was F1D3 originally)
;
var3 $RDSLT ;Inter-slot read
var3 $WRSLT ;Inter-slot write
var3 $CALSLT ;Inter-slot call (address IYh:IX)
var3 $ENASLT ;Enable slot permanently
var3 $CALLF ;Inter-slot call (address after call)
;
var3 PUT_BDOS ;Switch kernel RAM into page-0 & page-2
var3 PUT_USER ;Restore caller's pages.
var3 P0_RAM ;Switch from BIOS ROM to kernel RAM in page-0
;
var0 MAP_VECT,F200
;
var3 ALL_SEG ;Allocate a RAM segment
var3 FRE_SEG ;Free a RAM segment
var3 RD_SEG ;Read from a RAM segment
var3 WR_SEG ;Write to a RAM segment
var3 CAL_SEG ;Inter-segment call (address in IYh:IX)
var3 CALLS ;Inter-segment call (address in code)
;
var3 PUT_PH ;Put segment into page at (HL)
var3 GET_PH ;Get segment in page at (HL)
var3 PUT_P0 ;\
var3 GET_P0 ; \
var3 PUT_P1 ; | Routines to read and write
var3 GET_P1 ; \ specific page registers.
var3 PUT_P2 ; /
var3 GET_P2 ; |
var3 PUT_P3 ; /
var3 GET_P3 ;/
var3 CALL_MAP ;UNAPI RAM helper compliant routines
var3 RD_MAP
var3 CLL_MAPI
var3 WR_MAP
;
var1 CUR_DRV ;Current logical drive (1=A:)
var2 DTA_ADDR,F23D ;DMAADD used by MSXDOS1.SYS - can not move.
;
var3 $IRQ ;Interrupt entry point
var3 RAM_ABORT ;Stores a RET and a pointer to it (see SET_BOOT_VECTORS in dosboot.mac)
spare 1
;
var1 DIRBFD, F246 ;** May be corrupted sometimes.
;
var KNJWRK,8,F247 ;Work area for parasite Kanji driver
;
; ------------------------
;
var0 HOOKBEG,F24F
;
var3 H.PROMPT,F24F ;Disk change prompt hook
;
var3 H_BDOS ;KBDOS function routine hook F252 H.UNPA
var3 H_UP ;Upper case routine hook F255 H.DEVN
var3 H_16CH ;16-bit character routine hook F258 H.CONT
var3 H_CHIN ;Console input hook F25B H.GETE
var3 H_CHOUT ;Console output hook F25E H.NEXT
var3 H_CHST ;Console status hook F261 H.MOVN
var3 H_CHFL ;Console output buffer flush hook F264 H.DOOP
var3 H_LSTOUT ;List output hook F267 H.FATR
var3 H_LSTST ;List status hook F26A H.GETI
;
spare 6*3 ;Unsupported hooks
; F26D H.FATW F270 H.DREA F273 H.FATA
; F276 H.DIRW F279 H.DWRI F27C H.MUL1
;
var3 H.DIV32,F27F ;Hook for divide, used by old slave code.
;
spare 18*3 ;Unsupported hooks
; F282 H.FNDC F285 H.SKPC F288 H.BUFR
; F28B H.BUFW F28E H.ENUF F291 H.SETF
; F294 H.SETC F297 H.WRTE F29A H.NORN
; F29D H.WRTL F2A0 H.OPTI F2A3 H.FIGR
; F2A6 H.ALLO F2A9 H.RELB F2AC H.GETC
; F2AF H.OUT F2B2 H.DATE F2B5 H.SETY
;
const HOOKLEN,ram_ad-HOOKBEG
;
; ------------------------
;
var1 TIM_RATE ;Frequency of calling kernel IRQ.
var1 TIM_COUNT ;Number of interrupts since last deci-sec
var3 RANDOM ;23 bit random number value.
var1 ST_COUNT ;Timeout counter for BIOS console status
; reset to 1 by each interrupt forces check.
var1 CH_COUNT ;Timeout counter for BIOS console buffer
; flush.
var1 TIM_TICK ;Deferred timeout counter for unit descriptor
; timeouts.
;
var TIMI_SAVE,5 ;Save address for old interrupt hook
;(in DOS 1 mode TM1_SAVE is used instead)
;
var2 MAP_TAB ;Pointer to mapper records.
;
var1 P0_SEG ;Current segments. These are just images
var1 P1_SEG ; of the paging variables and should never
var1 P2_SEG ; be accessed directly by the user.
var1 P3_SEG
;
var1 P0_TPA ;\
var1 P1_TPA ; \ These are the four "TPA" segments which
var1 P2_TPA ; / KBDOS uses for data transfers.
var1 P3_TPA ;/
;
var1 DATA_SEG ;Segment number of kernel data
var1 CODE_SEG ;Segment number of kernel code
;
; ------------------------
;
var2 SP_IRQ ;Saved stack pointer for interrupts
const IRQS_SZ,200 ;Size of the interrupt stack
var2 IRQ_STACK ;Pointer to interrupt stack which must be
; immediately below the BDOS stack.
;
; ------------------------
;
var FCALSAV,5 ;Hook chain for extended BIOS
;
; ------------------------
;
var2 $ERR_MSG ;Address of page-1 error message routine
var2 $PROMPT ;Address of page-1 disk change prompt routine
var2 $BDOS ;Address of page-1 BDOS entry
;
var1 SS_TEMP ;Temporary storage for slot handling
;
var2 RD_ADDR ;Transfer address \
var2 RD_SNUM ;Current sector number > For RAMdisk
var1 RD_SCNT ;Number of sectors left /
;
var2 IX_BDOS ;IX saved past inter-slot call to BDOS_GO
var2 SP_BDOS ;User's saved SP in BDOS_GO
;
var1 PS_BDOS ;Primary slot register for GO_BDOS
var1 SS_BDOS ;RAM secondary slot register for GO_BDOS
;
var1 DSK_CHK ;Disk check control flag
;
spare 2
var1 MFLAGS ;Miscellaneous flags
const FASTOUT,0 ;bit 0: set for fast STROUT
const FIRSTLD,1 ;bit 1: set while booting NEXTOR.SYS for the first time
const ZALLOC,2 ;bit 2: reduced alloc info mode becomes zero info mode (SET ZALLOC ON)
const ERRL,3 ;bit 3: always show error messages in English (SET ERRLANG ON)
const KILLD,4 ;bit 4: kill DSKI and DSKO BASIC commands (SET KILLDSKIO ON)
const SYST2,7 ;Bit 7: force boot in MSXDOS2.SYS (temporary, reset after read)
spare 1 ;Available for DOS 2
;
var2 BLDCHK
var2 BSVCHK
;
const LEN_1,100 ;\
var2 BUF_1 ; \
const LEN_2,64 ; | Addresses and sizes of buffers
var2 BUF_2 ; > for BDOS_GO to copy FCB's and
const LEN_3,100 ; | so on into.
var2 BUF_3 ; /
var2 ERR_BUF ;/
;
; ------------------------
;
var1 BOOT_DRV ;Drive to re-boot from
;
const BDS_SZ,300 ;Size of "BDOS_STACK" area.
var2 BDOS_STACK ;Pointer to page-3 stack for calling KBDOS
;
var2 KDSK_VECT ;Kernel disk error vector
var2 KAB_VECT ;Kernel abort vector
;
; ------------------------
;
var2 SPSAVE, F304 ;\
var1 CPMCALL,F306 ; > Accessed by MSXDOS1.SYS - cannot move.
var2 SRCHFCB,F307 ;/
;
; ------------------------
;
spare 4
;
var1 RAWFLG, F30D ;Read-after write flag - must not move
var1 COUNTRY,F30E ;Accessed by COMMAND.COM - can't move
var KANJTABLE,4,F30F;
;
; var0 FUTURE, F313 ;Following 16 bytes had been reserved by DOS1
;
var1 DOS_VER ;DOS version number 2.x
;
var1 P0_64K ;\ These are the basic 64k RAM segment
var1 P1_64K ; \ numbers which should never be changed
var1 P2_64K ; / by anyone (including the system).
var1 P3_64K ;/
const DVB_TABLE,P0_64K ;Pointer to table of device-based drives for DOS1
const KSLOT,P2_64K ;Slot of disk controller being called (used in DOS 1 mode)
;
var1 NXT_VER ;Nextor version numbr
var1 MAIN_BANK ;Will be 0 in normal mode or 3 in DOS 1 mode
var KER250,4 ;Nextor kernel slots,
;bit 6 is set if timer interrupt routine is to be called
;bit 5 is set if the driver provides configuration
var TM1_SAVE,5,F31E ;Save address for old interrupt hook (used in DOS 1 mode)
;
; ------------------------
;
var2 DISKVECT,F323 ;BDOS_GO disk error vector
var2 BREAKVECT,F325 ;BDOS_GO ctrl-stop vector
;
var AUXBODY,10,F327
spare 2
var2 $DOS1 ;MSX-DOS1 compatible page-1 BDOS entry
spare 1
;
; ------------------------
;
var1 KEYVLD, F336 ;\
var1 KEYCHR, F337 ; >
var1 TIMFLG, F338 ;/
;
spare 2 ; was F_SPSAVE, F339
var2 PATHNAM ; was CURDATE, F33B
var2 RECSIZE ; used by Disk BASIC
;
var1 TARGET, F33F ;\
var1 NOTFIRST,F340 ; \
var1 RAMAD0, F341 ; |
var1 RAMAD1, F342 ; |
var1 RAMAD2, F343 ; | These should all be kept
var1 RAMAD3, F344 ; > at the same address for
;
var1 FILMAX, F345 ; | various reasons of compatibility.
var1 DOSFLG, F346 ; |
var1 $NUMDRV,F347 ; |
;
var1 MASTER_SLOT,F348; |
var2 HIMSAV, F349 ; |
var2 DOSHIM, F34B ; |
var2 $SECBUF,F34D ; |
var2 $MAXSEC ; | was $BUFFER, F34F
var2 $DIRBUF,F351 ; |
var2 RM_DPB ; / RAMdisk DPB (was FCBBASE,F353)
var $DPBLIST,16,F355;/
;
; ------------------------
;
var3 RSLREG, F365 ;Read slot register \
var3 $DOSON, F368 ;Enable master slot \ used by old slave
var3 $DOSOFF,F36B ;Enable RAM slot / must not move.
var3 XFER, F36E ;RAM LDIR /
var3 $AUXIN, F371 ;\ Auxiliary device hooks
var3 $AUXOUT,F374 ;/
;
var3 GO_BIOS,F377 ;Internal KBIOS entry point
var3 GO_BDOS,F37A ;Internal KBDOS entry point
;
var3 BDOS, F37D ;Main BDOS entry point
;
const DATASIZE,ram_ad-DATABASE
;
IF1
IF ram_ad NE 0F380h
.radix 16
pr_hex <Fixed work area end address is>,%ram_ad
.radix 10
ENDIF
ENDIF
;
;-----------------------------------------------------------------------------
;
; PAGE ZERO ENTRY POINTS
; ==========================
;
; The following are entry points for various routines in page-0. Care must
; be taken when calling these about what is in page-0 since not all of these
; routines are available in all page-0's. There are three different page-0's
; which need to be considered:
; BIOS ROM
; MSX-DOS page-0 TPA segment
; MSX-DOS kernel code segment
;
; ---------------------------------
;
; The following routines are used to access multiple slots. They are
; present in all three page-0's, but the version in the BIOS ROM is rather
; different internally from the version in the two RAM segments. In
; particular the RAM segment versions can alter page-0 successfully, but the
; BIOS ROM version can only alter page-0 between the BIOS ROM and the SUB-ROM.
;
const RDSLT, 000Ch ;Read from slot
const WRSLT, 0014h ;Write to slot
const CALSLT, 001Ch ;Inter-slot call
const ENASLT, 0024h ;Enable slot
const ID_BYTE,002Bh ;Only in MSX BIOS ROM
const CALLF, 0030h ;Inter-slot call
const LOAD_FLAG,0037h ;Only in TAP segment
const INTRPT, 0038h ;Main interrupt entry
;
; ---------------------------------
;
; The following three entry points are routines to switch secondary slots.
; On entry register A is the main slot register setting required to access the
; secondary slot register and register B is the main slot setting which should
; be restored afterwards. These routine are available only in the MSX-DOS
; page-0 RAM segment when MSX-DOS is running, and in in the DOS kernel code
; segment. They are not available in the BIOS ROM.
;
const SSLOT, 003Bh ;Select slot (FFFFh)&H+D
const SSLOTL,0046h ;Select slot L
const SSLOTE,004Bh ;Select slot E
const SSLSZ, 001Ah ;Size of secondary slot switching code
;
; ---------------------------------
;
; The following are entry points to the kernel code segment. "KINIT" is
; only used for initialization, "KBDOS" is used to access all the BDOS
; functions, "KTIMI" is for timer interrupts and the remainder are for the
; BIOS routines.
;
const KINIT, 0000h ;Kernel initialization routine
const KBDOS, 0005h ;Kernel BDOS function dispatcher
;
const $ALL_SEG,005Ch ;Mapper support allocate segment
const $FRE_SEG,005Fh ;Mapper support free segment
;
const KCONIN, 0080h ;BIOS console input routine
const KCONOUT,0083h ;BIOS console output routine
const KCONST, 0086h ;BIOS console status routine
const KLIST, 0089h ;BIOS list output routine
const KLISTST,008Ch ;BIOS list status routine
const KPUNCH, 008Fh ;BIOS punch output routine
const KREADER,0092h ;BIOS reader input routine
;
;
; ---------------------------------
;
; Routines available on kernel page 0
;
const GSLOT1,402Dh
const RDBANK,403Ch
const CALBAS,403Fh
const CALBNK,4042h
const GWORK,4045h
const CALDRV,4048h
;-----------------------------------------------------------------------------
;
; PAGE-3 MSX SYSTEM VARIABLES
; ===============================
;
const DRVTBL,0FB21h ;Table of disk driver slots
;
const BOTTOM,0FC48h ;Bottom of available RAM
const HIMEM, 0FC4Ah ;Top of available RAM
;
const INTFLG,0FC9Bh ;ctrl-STOP flag
const ESCCNT,0FCA7h ;Escape sequence counter
;
const EXPTBL,0FCC1h ;Expanded slot flags
const SLTTBL,0FCC5h ;Secondary slot register images
const SLTATR,0FCC9h ;Attributes for each slot
const SLTWRK,0FD09h ;Work area address for each slot
;
const KBUF, 0F41Fh ;\ Buffer space in main MSX work
const BUF, 0F55Eh ; > area. May or may not use this
;/ depending where it is used.
;
; MAP_SCAN temporary scratch. Copied later to real locations.
;
const MAP_REC,KBUF ;Temporary mapper record 16*2 + 1
const CH_TYPE,KBUF ;Type of character generator 0...3
; (controls upper-casing routine)
;
const H.KEYI,0FD9Ah ;Interrupt hook address
const H.TIMI,0FD9Fh ;Timer interrupt hook address
;
;-----------------------------------------------------------------------------
;
; Jump table for bank 4 public routines
ram_ad defl 4100h
var3 F_GENV
var3 F_SENV
var3 F_FENV
var3 GET_ENV
var3 F_FOPEN
var3 F_FCLOSE
var3 F_SFIRST
var3 F_SNEXT
var3 F_RDSEQ
var3 F_WRSEQ
var3 F_FMAKE
var3 F_FDEL
var3 F_FREN
var3 F_RDRND
var3 F_WRRND
var3 F_WRZER
var3 F_FSIZE
var3 F_SETRND
var3 F_RDBLK
var3 F_WRBLK
var3 F_GPART
var3 GDRIVER
var3 AUTODRV
var3 MKDPB
var3 F_GDRVR
var3 F_GDLI
var3 F_CDRVR
var3 F_MAPDRV
var3 F_Z80MODE
var3 UNMAPALL
var3 DOSV1
var3 CMAPDRV
var3 CLOCKDRV
var3 CUSR
var3 CCURDRV
var3 CNEXTOR
var3 CCHDRV
var3 CDRVINFO
var3 CDRIVERS
var3 F_GDATE
var3 F_SDATE
var3 F_GTIME
var3 F_STIME
var3 CLK_INIT
var3 GT_DATE_TIME
var3 ALLSEG
var3 FRESEG
var3 FREUSEG
var3 F_LOCK
var3 F_FOUT
var3 F_RALLOC
var3 F_DSPACE
var3 DRVS2
var3 AUTO_ASPART
var3 F_GETCLUS
var3 F_RAMD
var3 ZAP_RAMD
;-----------------------------------------------------------------------------
;
; Routines on ROM page 0 and on disk drivers
const DV_BANK,7 ;Bank number of disk driver
ram_ad defl 403Ch
var3 DH_RDBANK
var3 DH_CALBAS
var3 DH_CABNK
var3 DH_GWORK
ram_ad defl 4100h
;Common routines
var DV_SIGN,14
var1 DV_TYPE
spare 1
var DV_NAME,32
var3 DV_TIMI
var3 DV_VERSION
var3 DV_INIT
var3 DV_OEMST
var3 DV_BASDEV
var3 DV_EXTBIO
var3 DV_D0
var3 DV_D1
var3 DV_D2
var3 DV_D3
var3 DV_D4
var3 DV_CONFIG
spare 12
;Routines for drive-based and device-based drivers
var0 DV_DSKIO
var3 DEV_RW
var0 DV_CHGDSK
var3 DEV_INFO
var0 DV_GETDPB
var3 DEV_STATUS
var0 DV_CHOICE
var3 LUN_INFO
var0 DV_FORMAT
var3 DEV_FORMAT
var0 DV_MTOFF
var3 DEV_CMD
;-----------------------------------------------------------------------------
;
finish <DATA>
end
;