-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathsystem
135 lines (135 loc) · 2.08 KB
/
system
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
.PAGE 'SYSTEM ROUTINES'
;
; KILL PROTECTION
;
KILLP
PHA
LDA #1
STA CFLG2 ; TELL CONTOLLER
KILLP2
LDA CFLG2 ; WAIT UNTIL HE'S GOT IT
BNE KILLP2
PLA
RTS
;
; CHECK FOR BIG RELATIVE FILE
;
BIGREL
LDA DOS
BNE BIGRE1 ; 8050/8250
LDA #$FF
RTS ; 4040
BIGRE1
LDA SWITCH ; BIG REL SWITCH
RTS
;
; READ/WRITE THE SUPER SIDE SECTOR (8250)
;
RDSSS
LDX LINDX
LDA #254
CMP SSSGRP,X
BNE RDSSSA ; SS NOT RESIDENT, READ IT
RTS
RDSSSA
LDA #READ
.BYTE $2C ; SKIP NEXT TWO BYTES
WRTSSS
LDA #WRITE
PHA
JSR SETDRN
LDX LINDX
LDA SSSTRK,X
STA TRACK ; SET TRACK
LDA SSSSEC,X
STA SECTOR ; SET SECTOR
LDA #255
STA SSSGRP,X
LDA SS,X ; GET SS BUFFER #
STA JOBNUM
JSR SETH ; SET THE JOB HEADER
PLA ; GET JOB
JSR DOJOB ; DO THE JOB
LDX LINDX
LDA #254
STA SSSGRP,X ; MARK SSS RESIDENT
RTS
;
; READ LAST GROUP (8250)
;
RDLG
LDA #$5A
STA GRPNUM
JSR RDSS1
BNE RDLG1
RTS
RDLG1
DEC GRPNUM
LDA GRPNUM
JSR RDSS1C
BNE RDLG1
RTS
;
; READ SIDE SECTOR 1 OF GROUP N (8250)
;
RDSS1
LDX LINDX
CMP SSSGRP,X
BNE RDSS1A
RTS
RDSS1A
PHA ; SAVE DESIRED GROUP #
JSR RDSSS ; READ THE SSS
RDSS1D
JSR SETDRN ; SET THE DRIVE #
LDA #3
JSR SSDIR ; POINT TO THE FIRST GROUP
PLA ; RESTORE DESIRED GROUP #
RDSS1C
TAX ; SAVE DESIRED GROUP #
ASL A
TAY
LDA (DIRBUF),Y ; GET THE TRACK
BNE RDSS1B ; DOES EXSIT
ORA #255 ; DOES NOT EXIST (RETURN CODE)
RTS
RDSS1B
STA TRACK
INY
LDA (DIRBUF),Y ; GET THE SECTOR
STA SECTOR
TXA ; RESTORE DESIRED GROUP #
PHA
LDA #255
LDX LINDX
STA SSSGRP,X ; MARK GROUP NONRESIDENT
LDA SS,X ; GET SS BUFFER #
STA JOBNUM
JSR SETH ; SET THE JOB HEADER
LDA #READ
JSR DOJOB ; READ THE SS IN
LDX LINDX
PLA
STA SSSGRP,X ; MARK THE GROUP AS RESIDENT
LDA #0 ; RETURN CODE
RTS
;
; CHECK FOR LEGAL TRACK AND SECTOR
; .C = 0 IF LEGAL
; .C = 1 IF ILLEGAL
;
JILLTS
LDA TRACK
BEQ ILLTS1
CMP MAXTRK
BCS ILLTS1
JSR MAXSEC
CMP SECTOR
BEQ ILLTS1
BCC ILLTS1
CLC
RTS
ILLTS1
SEC
RTS
.END