-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathZ80MODE.MAC
138 lines (113 loc) · 2.44 KB
/
Z80MODE.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
.z80
jp START
; -------------------------------------------------------------------------------
db 13
db "Z80MODE - Enable or disable Z80 access mode for a legacy driver",13,10
db 13,10
db "By default, MSX-DOS will enable the Z80 access mode for all legacy drivers",13,10
db "when running on MSX Turbo-R computers. When this mode is enabled, Z80 CPU is",13,10
db "switched prior to every access to any drive on the driver. This function",13,10
db "allows to disable the Z80 access mode for any legacy driver, so drives on",13,10
db "these drivers can be accessed in R800 mode; and to re-enable it.",13,10
db 13,10
db "Z80 mode applies to legacy drivers only. MSX-DOS will never switch to Z80",13,10
db "CPU when accessing MSX-DOS 2.50 drivers (both device-based and drive-based).",13,10
db 13,10
db "Note that this program will work on MSX Turbo-R computers only.",13,10
db 13,10
db "Usage: Z80MODE <slot>[-<subslot>]|0 [ON|OFF]",13,10
db 13,10
db "If 0 is specified, the primary disk controller slot is assumed",13,10
db 1Ah
USAGE_S:
db "Z80MODE - Enable or disable Z80 access mode for a legacy driver",13,10
db 13,10
db "Usage: Z80MODE <slot>[-<subslot>]|0 [ON|OFF]",13,10
db 13,10
db "TYPE Z80MODE.COM for more details.",13,10
db 0
START:
call CHK250##
ld de,BUF
ld a,1
call EXTPAR##
jr nz,FOUND_PARAMS
ld de,USAGE_S
ld c,_ZSTROUT##
call 5
ld b,a
ld c,_TERM##
jp 5
FOUND_PARAMS:
;--- Get slot number
ld hl,BUF
call GETSLOT##
or a
jr nz,NO_PRIMARY
ld a,(0F348h)
NO_PRIMARY:
ld (SLOT),a
ld a,b
inc a
ld b,.IDRVR##
ld c,_TERM##
jp nz,5
;--- Get ON/OFF switch
ld a,2
ld de,BUF2
call EXTPAR
jr c,DO_GET
ld hl,BUF2
call CHKONOFF##
;--- Set value
ld d,a
ld a,(SLOT)
ld b,1
ld c,_Z80MODE##
call 5
ld b,a
ld c,_TERM##
jp nz,5
;--- Get current value and print it
DO_GET:
ld a,(SLOT)
ld b,0
ld c,_Z80MODE##
call 5
ld b,a
ld c,_TERM##
jp nz,5
push de
ld de,MODE_MSG
ld c,_ZSTROUT##
call 5
ld de,BUF
ld c,_ZSTROUT##
call 5
ld de,IS_MSG
ld c,_ZSTROUT##
call 5
pop af
ld de,OFF_MSG
or a
jr z,DO_GET2
ld de,ON_MSG
DO_GET2:
ld c,_ZSTROUT##
call 5
ld b,a
ld c,_TERM##
jp 5
MODE_MSG:
db "Z80 access mode for driver in slot ",0
IS_MSG:
db " is ",0
ON_MSG:
db "ON",13,10,0
OFF_MSG:
db "OFF",13,10,0
SLOT:
db 0
BUF:
BUF2 equ BUF+16
end