-
Notifications
You must be signed in to change notification settings - Fork 85
/
close
113 lines (113 loc) · 2.35 KB
/
close
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
.PAG 'CLOSE'
;***************************************
;* CLOSE -- CLOSE LOGICAL FILE *
;* *
;* THE LOGICAL FILE NUMBER OF THE*
;* FILE TO BE CLOSED IS PASSED IN .A.*
;* KEYBOARD, SCREEN, AND FILES NOT *
;* OPEN PASS STRAIGHT THROUGH. TAPE *
;* FILES OPEN FOR WRITE ARE CLOSED BY*
;* DUMPING THE LAST BUFFER AND *
;* CONDITIONALLY WRITING AN END OF *
;* TAPE BLOCK.SERIAL FILES ARE CLOSED*
;* BY SENDING A CLOSE FILE COMMAND IF*
;* A SECONDARY ADDRESS WAS SPECIFIED *
;* IN ITS OPEN COMMAND. *
;***************************************
;
NCLOSE JSR JLTLK ;LOOK FILE UP
BEQ JX050 ;OPEN...
CLC ;ELSE RETURN
RTS
;
JX050 JSR JZ100 ;EXTRACT TABLE DATA
TXA ;SAVE TABLE INDEX
PHA
;
LDA FA ;CHECK DEVICE NUMBER
BEQ JX150 ;IS KEYBOARD...DONE
CMP #3
BEQ JX150 ;IS SCREEN...DONE
BCS JX120 ;IS SERIAL...PROCESS
CMP #2 ;RS232?
BNE JX115 ;NO...
JMP ERROR9 ;BAD DEVICE #
;
;CLOSE CASSETTE FILE
;
JX115 LDA SA ;WAS IT A TAPE READ?
AND #$F
BEQ JX150 ;YES
;
JSR ZZZ ;NO. . .IT IS WRITE
LDA #0 ;END OF FILE CHARACTER
SEC ;NEED TO SET CARRY FOR CASOUT (ELSE RS232 OUTPUT!)
JSR CASOUT ;PUT IN END OF FILE
JSR WBLK
BCC JX117 ;NO ERRORS...
PLA ;CLEAN STACK FOR ERROR
LDA #0 ;BREAK KEY ERROR
RTS
;
JX117 LDA SA
CMP #$62 ;WRITE END OF TAPE BLOCK?
BNE JX150 ;NO...
;
LDA #EOT
JSR TAPEH ;WRITE END OF TAPE BLOCK
JMP JX150
;
;CLOSE AN SERIAL FILE
;
JX120 JMP ERROR9 ;BAD DEVICE #
;
;ENTRY TO REMOVE A GIVE LOGICAL FILE
;FROM TABLE OF LOGICAL, PRIMARY,
;AND SECONDARY ADDRESSES
;
JX150 PLA ;GET TABLE INDEX OFF STACK
;
; JXRMV - ENTRY TO USE AS AN RS-232 SUBROUTINE
;
JXRMV TAX
DEC LDTND
CPX LDTND ;IS DELETED FILE AT END?
BEQ JX170 ;YES...DONE
;
;DELETE ENTRY IN MIDDLE BY MOVING
;LAST ENTRY TO THAT POSITION.
;
LDY LDTND
LDA LAT,Y
STA LAT,X
LDA FAT,Y
STA FAT,X
LDA SAT,Y
STA SAT,X
;
JX170 CLC ;CLOSE EXIT
JX175 RTS
.SKI 5
;LOOKUP TABLIZED LOGICAL FILE DATA
;
LOOKUP LDA #0
STA STATUS
TXA
JLTLK LDX LDTND
JX600 DEX
BMI JZ101
CMP LAT,X
BNE JX600
RTS
.SKI 5
;ROUTINE TO FETCH TABLE ENTRIES
;
JZ100 LDA LAT,X
STA LA
LDA FAT,X
STA FA
LDA SAT,X
STA SA
JZ101 RTS
.END
; RSR 5/12/82 - MODIFY FOR CLN232