-
Notifications
You must be signed in to change notification settings - Fork 85
/
system
120 lines (120 loc) · 1.84 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
.PAGE 'SYSTEM ROUTINES'
;
; READ/WRITE THE SUPER SIDE SECTOR
;
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
;
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
;
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
BCC ILLTS1
RTS
ILLTS1
LDA SECTOR
AND #%00011111
CMP SECTRS
BCC ILLTS2
RTS
ILLTS2
LDA SECTOR
AND #%11100000
LSR A
LSR A
LSR A
LSR A
LSR A
CMP HEADS
RTS
.END