-
Notifications
You must be signed in to change notification settings - Fork 0
/
sc.mac
43 lines (36 loc) · 1.05 KB
/
sc.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
TITLE SC,<FILE NAME SCANNER>,08,06-SEP-80,TG/GPK
.SBTTL CSI - 6B - DO IT RIGHT
ORG SC
;+
; THIS CALLS THE FILE NAME STRING SCAN
;-
CSI:: MOV R0,-(SP) ; SAVE SOME REGS PLEASE
MOV R1,-(SP) ; THIS ONE TOO
MOV R2,-(SP) ; TWO MORE
MOV R3,-(SP) ; LAST ONE
MOV #XRB+XRBSIZ,R1 ; START HERE
10$: CLR -(R1) ; CLEAR IT OUT
CMP R1,#FIRQB ; ALL THE WAY DOWN TO HERE
BHI 10$ ; BOTH AT THE SAME TIME
MOV R3,@#XRB+XRLOC ; POINT AT STRING
CLR R1 ; START WITH NOTHING
20$: TSTB (R3)+ ; ENDS WITH A NULL
BEQ 30$ ; WE FOUND IT
INC R1 ; COUNT ONE
BR 20$ ; AND KEEP LOOKING
30$: TST R1 ; DID WE FIND ANYTHING ???
BEQ 40$ ; ALL IS WELL
MOV R1,@#XRB+XRLEN ; SET IT IN HERE
MOV R1,@#XRB+XRBC ; AND HERE
.FSS ; AND DO IT CLEM
TST @#XRB+10 ; DON'T ALLOW UNDEFINED LOGICALS
BPL CSDNE ; ALL IS WELL
40$: MOVB #BADNAM,@#IOSTS ; SAY ERROR
CSDNE: CALLX CLRXRB ; CLEAR IT OUT PLEASE
MOV (SP)+,R3 ; NOW WE MUST RESTORE
MOV (SP)+,R2 ; ALL FROM
MOV (SP)+,R1 ; WHENCE
MOV (SP)+,R0 ; THEY CAME
RTS PC ; AND GO AWAY
GLOBAL <BADNAM>
.END