-
Notifications
You must be signed in to change notification settings - Fork 85
/
load
153 lines (153 loc) · 3.24 KB
/
load
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
.PAG 'LOAD FUNCTION'
;**********************************
;* LOAD RAM FUNCTION *
;* *
;* LOADS FROM CASSETTE 1 OR 2, OR *
;* SERIAL BUS DEVICES >=4 TO 31 *
;* AS DETERMINED BY CONTENTS OF *
;* VARIABLE FA. VERIFY FLAG IN .A *
;* *
;* ALT LOAD IF SA=0, NORMAL SA=1 *
;* .X , .Y LOAD ADDRESS IF SA=0 *
;* .A=0 PERFORMS LOAD,<> IS VERIFY*
;* *
;* HIGH LOAD RETURN IN X,Y. *
;* *
;**********************************
.SKI 3
LOADSP STX MEMUSS ;.X HAS LOW ALT START
STY MEMUSS+1
LOAD STA VERCK ;STORE VERIFY FLAG
LDA #0
STA STATUS
;
LDA FA ;CHECK DEVICE NUMBER
BEQ LD30 ;BAD DEVICE #-KEYBOARD
;
LD20 CMP #3
BEQ LD30 ;DISALLOW SCREEN LOAD
BCC LD100 ;HANDLE TAPES DIFFERENT
;
LD30 JMP ERROR9 ;BAD DEVICE #
;
LD90 JMP ERROR4 ;FILE NOT FOUND
;
;LOAD FROM TAPE
;
LD100 LSR A
BCS LD102 ;IF C-SET THEN IT'S CASSETTE
;
JMP ERROR9 ;BAD DEVICE #
;
LD102 JSR ZZZ ;SET POINTERS AT TAPE
BCS LD104
JMP ERROR9 ;DEALLOCATED...
LD104 JSR CSTE1 ;TELL USER ABOUT BUTTONS
BCS LD190 ;STOP KEY PRESSED?
JSR LUKING ;TELL USER SEARCHING
;
LD112 LDA FNLEN ;IS THERE A NAME?
BEQ LD150 ;NONE...LOAD ANYTHING
JSR FAF ;FIND A FILE ON TAPE
BCC LD170 ;GOT IT!
BEQ LD190 ;STOP KEY PRESSED
BCS LD90 ;NOPE...END OF TAPE
;
LD150 JSR FAH ;FIND ANY HEADER
BEQ LD190 ;STOP KEY PRESSED
BCS LD90 ;NO HEADER
;
LD170 LDA STATUS
AND #SPERR ;MUST GOT HEADER RIGHT
SEC
BNE LD190 ;IS BAD
;
CPX #BLF ;IS IT A MOVABLE PROGRAM...
BEQ LD178 ;YES
;
CPX #PLF ;IS IT A PROGRAM
BNE LD112 ;NO...ITS SOMETHING ELSE
;
LD177 LDY #1 ;FIXED LOAD...
LDA (TAPE1)Y ;...THE ADDRESS IN THE...
STA MEMUSS ;...BUFFER IS THE START ADDRESS
INY
LDA (TAPE1)Y
STA MEMUSS+1
BCS LD179 ;JMP ..CARRY SET BY CPX'S
;
LD178 LDA SA ;CHECK FOR MONITOR LOAD...
BNE LD177 ;...YES WE WANT FIXED TYPE
;
LD179 LDY #3 ;TAPEA - TAPESTA
;CARRY SET BY CPX'S
LDA (TAPE1)Y
LDY #1
SBC (TAPE1)Y
TAX ;LOW TO .X
LDY #4
LDA (TAPE1)Y
LDY #2
SBC (TAPE1)Y
TAY ;HIGH TO .Y
;
CLC ;EA = STA+(TAPEA-TAPESTA)
TXA
ADC MEMUSS ;
STA EAL
TYA
ADC MEMUSS+1
STA EAH
LDA MEMUSS ;SET UP STARTING ADDRESS
STA STAL
LDA MEMUSS+1
STA STAH
JSR LODING ;TELL USER LOADING
JSR TRD ;DO TAPE BLOCK LOAD
.BYT $24 ;CARRY FROM TRD
;
LD180 CLC ;GOOD EXIT
;
; SET UP END LOAD ADDRESS
;
LDX EAL
LDY EAH
;
LD190 RTS
.SKI 5
;SUBROUTINE TO PRINT TO CONSOLE:
;
;SEARCHING [FOR NAME]
;
LUKING LDA MSGFLG ;SUPPOSED TO PRINT?
BPL LD115 ;...NO
LDY #MS5-MS1 ;"SEARCHING"
JSR MSG
LDA FNLEN
BEQ LD115
LDY #MS6-MS1 ;"FOR"
JSR MSG
.SKI 3
;SUBROUTINE TO OUTPUT FILE NAME
;
OUTFN LDY FNLEN ;IS THERE A NAME?
BEQ LD115 ;NO...DONE
LDY #0
LD110 LDA (FNADR)Y
JSR BSOUT
INY
CPY FNLEN
BNE LD110
;
LD115 RTS
.SKI 3
;SUBROUTINE TO PRINT:
;
;LOADING/VERIFING
;
LODING LDY #MS10-MS1 ;ASSUME 'LOADING'
LDA VERCK ;CHECK FLAG
BEQ LD410 ;ARE DOING LOAD
LDY #MS21-MS1 ;ARE 'VERIFYING'
LD410 JMP SPMSG
.END