You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

427 lines
5.9KB

  1. .PAGE 'BLOCK COMMAND'
  2. ; ROM 1.1 ADDITIONS
  3. ; USER COMMANDS
  4. .SKIP
  5. USER LDY CMDBUF+1
  6. CPY #'0
  7. BNE US10 ;0 RESETS PNTR
  8. .SKIP
  9. USRINT LDA #<UBLOCK ;SET DEFAULT BLOCK ADD
  10. STA USRJMP
  11. LDA #>UBLOCK
  12. STA USRJMP+1
  13. RTS
  14. .SKIP
  15. US10 JSR USREXC ;EXECUTE CODE BY TABLE
  16. JMP ENDCMD
  17. .SKIP
  18. USREXC DEY ;ENTRY IS(((INDEX-1)AND$F)*2)
  19. TYA
  20. AND #$F
  21. ASL A
  22. TAY
  23. LDA (USRJMP)Y
  24. STA IP
  25. INY
  26. LDA (USRJMP)Y
  27. STA IP+1
  28. JMP (IP)
  29. .PAGE 'BLOCK COMMANDS'
  30. ; OPEN DIRECT ACCESS BUFFER
  31. ; FROM OPEN "#"
  32. .SKIP
  33. OPNBLK LDA LSTDRV
  34. STA DRVNUM
  35. LDA SA ;SA IS DESTROYED BY THIS PATCH
  36. PHA
  37. JSR AUTOI ;INIT DISK FOR PROPER CHANNEL ASSIGNMENT
  38. PLA ;RESTORE SA
  39. STA SA
  40. LDX CMDSIZ
  41. DEX
  42. BNE OB10
  43. .SKI
  44. LDA #1 ;GET ANY BUFFER
  45. JSR GETRCH
  46. JMP OB30
  47. .SKIP
  48. OB05 LDA #NOCHNL
  49. JMP CMDERR
  50. .SKIP
  51. OB10 LDY #1 ;BUFFER # IS REQUESTED
  52. JSR BP05
  53. LDX FILSEC
  54. CPX #BFCNT ;MUST BE LESS THAN 13.
  55. BCS OB05
  56. .SKI
  57. LDA #0
  58. STA TEMP
  59. STA TEMP+1
  60. SEC
  61. .SKI
  62. OB15
  63. ROL TEMP
  64. ROL TEMP+1
  65. DEX
  66. BPL OB15
  67. .SKI
  68. LDA TEMP
  69. AND BUFUSE
  70. BNE OB05 ;BUFFER IS USED
  71. LDA TEMP+1
  72. AND BUFUSE+1
  73. BNE OB05 ;BUF IS USED
  74. .SKI
  75. LDA TEMP
  76. ORA BUFUSE ;SET BUFFER AS USED
  77. STA BUFUSE
  78. LDA TEMP+1
  79. ORA BUFUSE+1
  80. STA BUFUSE+1
  81. .SKI
  82. LDA #0 ;SET UP CHANNEL
  83. JSR GETRCH
  84. LDX LINDX
  85. LDA FILSEC
  86. STA BUF0,X
  87. TAX
  88. LDA DRVNUM
  89. STA JOBS,X
  90. STA LSTJOB,X
  91. .SKI
  92. OB30 LDX SA
  93. LDA LINTAB,X ;SET LINDX TABLE
  94. ORA #$40
  95. STA LINTAB,X
  96. .SKI
  97. LDY LINDX
  98. LDA #$FF
  99. STA LSTCHR,Y
  100. .SKIP
  101. LDA #RNDRDY
  102. STA CHNRDY,Y ;SET CHANNEL READY
  103. .SKIP
  104. LDA BUF0,Y
  105. STA CHNDAT,Y ;BUFFER # AS 1ST CHAR
  106. ASL A
  107. TAX
  108. LDA #1
  109. STA BUFTAB,X
  110. LDA #DIRTYP+DIRTYP
  111. STA FILTYP,Y ;SET DIRECT FILE TYPE
  112. JMP ENDCMD
  113. .PAGE
  114. ; BLOCK COMMANDS
  115. BLOCK LDY #0
  116. LDX #0
  117. LDA #'- ;"-" SEPARATES CMD FROM SUBCMD
  118. JSR PARSE ;LOCATE SUB-CMD
  119. BNE BLK40
  120. .SKI
  121. BLK10 LDA #BADCMD
  122. JMP CMDERR
  123. .SKI
  124. BLK30 LDA #BADSYN
  125. JMP CMDERR
  126. .SKI
  127. BLK40 TXA
  128. BNE BLK30
  129. .SKI
  130. LDX #NBCMDS-1 ;FIND COMMAND
  131. LDA CMDBUF,Y
  132. BLK50 CMP BCTAB,X
  133. BEQ BLK60
  134. DEX
  135. BPL BLK50
  136. BMI BLK10
  137. .SKI
  138. BLK60
  139. TXA
  140. ORA #$80
  141. STA CMDNUM
  142. JSR BLKPAR ;PARSE PARMS
  143. .SKI
  144. LDA CMDNUM
  145. ASL A
  146. TAX
  147. LDA BCJMP+1,X
  148. STA TEMP+1
  149. LDA BCJMP,X
  150. STA TEMP
  151. .SKI
  152. JMP (TEMP) ;GOTO COMMAND
  153. .SKI
  154. BCTAB .BYT 'AFRWEP'
  155. NBCMDS =*-BCTAB
  156. .SKIP
  157. BCJMP .WORD BLKALC ;BLOCK-ALLOCATE
  158. .WORD BLKFRE ;BLOCK-FREE
  159. .WORD BLKRD ;BLOCK-READ
  160. .WORD BLKWT ;BLOCK-WRITE
  161. .WORD BLKEXC ;BLOCK-EXECUTE
  162. .WORD BLKPTR ;BLOCK-POINTER
  163. .SKIP
  164. BLKPAR LDY #0 ;PARSE BLOCK PARMS
  165. LDX #0
  166. LDA #':
  167. JSR PARSE
  168. BNE BP05 ;FOUND ":"
  169. .SKIP
  170. LDY #3 ;ELSE CHAR #3 IS BEGINNING
  171. BP05 LDA CMDBUF,Y
  172. CMP #'
  173. BEQ BP10
  174. .SKI
  175. CMP #29 ;SKIP CHARACTER
  176. BEQ BP10
  177. .SKI
  178. CMP #',
  179. BNE BP20
  180. .SKIP
  181. BP10 INY
  182. CPY CMDSIZ
  183. BCC BP05
  184. .SKIP
  185. RTS ;THAT'S ALL
  186. .SKIP
  187. BP20 JSR ASCHEX
  188. INC F1CNT
  189. LDY F2PTR
  190. CPX #MXFILS-1
  191. BCC BP10
  192. .SKIP
  193. BCS BLK30 ;BAD SYNTAX
  194. .SKIP
  195. ; CONVERT ASCII TO HEX (BINARY)
  196. ; & STORE CONVERSION IN TABLES
  197. ; .Y= PTR INTO CMDBUF
  198. ASCHEX LDA #0
  199. STA TEMP
  200. STA TEMP+1
  201. STA TEMP+3
  202. .SKIP
  203. LDX #$FF
  204. AH10 LDA CMDBUF,Y ;TEST FOR DEC #
  205. CMP #$40
  206. BCS AH20 ;NON-NUMERIC TERMINATES
  207. CMP #$30
  208. BCC AH20 ;NON-NUMERIC
  209. .SKIP
  210. AND #$F
  211. PHA
  212. LDA TEMP+1 ;SHIFT DIGITS (*10)
  213. STA TEMP+2
  214. LDA TEMP
  215. STA TEMP+1
  216. PLA
  217. STA TEMP
  218. INY
  219. CPY CMDSIZ
  220. BCC AH10 ;STILL IN STRING
  221. .SKIP
  222. AH20 STY F2PTR ;CONVERT DIGITS TO...
  223. CLC ;...BINARY BY DEC TABLE
  224. LDA #0
  225. .SKIP
  226. AH30 INX
  227. CPX #3
  228. BCS AH40
  229. .SKIP
  230. LDY TEMP,X
  231. AH35 DEY
  232. BMI AH30
  233. .SKIP
  234. ADC DECTAB,X
  235. BCC AH35
  236. .SKIP
  237. CLC
  238. INC TEMP+3
  239. BNE AH35
  240. .SKIP
  241. AH40 PHA
  242. LDX F1CNT
  243. LDA TEMP+3
  244. STA FILTRK,X ;STORE RESULT IN TABLE
  245. PLA
  246. STA FILSEC,X
  247. RTS
  248. .SKIP
  249. DECTAB .BYT 1,10,100 ;DECIMAL TABLE
  250. .SKIP
  251. ;BLOCK-FREE
  252. BLKFRE JSR BLKTST
  253. JSR FRETS
  254. JMP ENDCMD
  255. .SKIP
  256. ;BLOCK-ALLOCATE
  257. LDA #1
  258. STA WBAM
  259. BLKALC
  260. JSR BLKTST
  261. .SKIP
  262. BA10
  263. LDA SECTOR
  264. PHA
  265. JSR GETSEC
  266. BEQ BA15 ;NONE GREATER ON THIS TRACK
  267. PLA
  268. CMP SECTOR
  269. BNE BA30 ;REQUESTED SECTOR NOT AVAIL
  270. JSR WUSED
  271. JMP ENDCMD
  272. ;
  273. BA15
  274. PLA ;POP STACK
  275. BA20
  276. LDA #0
  277. STA SECTOR
  278. INC TRACK
  279. LDA TRACK
  280. CMP MAXTRK
  281. BCS BA40 ;GONE ALL THE WAY
  282. ;
  283. JSR GETSEC
  284. BEQ BA20
  285. BA30
  286. LDA #NOBLK
  287. JSR CMDER2
  288. BA40
  289. LDA #NOBLK
  290. JSR CMDERR ;T=0,S=0 :NONE LEFT
  291. ;
  292. .SKIP
  293. ; BLOCK READ SUBS
  294. BLKRD2 JSR BKOTST ;TEST PARMS
  295. JMP DRTRD
  296. .SKIP
  297. GETSIM JSR GETPRE ;GET BYTE W/O INC
  298. LDA (BUFTAB,X)
  299. RTS
  300. .SKIP
  301. ; BLOCK READ
  302. BLKRD3 JSR BLKRD2
  303. LDA #0
  304. JSR SETPNT
  305. JSR GETSIM ;Y=LINDX
  306. .SKIP
  307. STA LSTCHR,Y
  308. LDA #RNDRDY
  309. STA CHNRDY,Y
  310. RTS
  311. BLKRD
  312. JSR BLKRD3
  313. JSR RNGET1
  314. JMP ENDCMD
  315. .SKIP
  316. ;USER DIRECT READ, LSTCHR=$FF
  317. UBLKRD
  318. JSR BLKPAR
  319. JSR BLKRD3
  320. LDA LSTCHR,Y
  321. STA CHNDAT,Y
  322. LDA #$FF
  323. STA LSTCHR,Y
  324. JMP ENDCMD ;(RTS)
  325. .SKIP 2
  326. ;BLOCK-WRITE
  327. BLKWT JSR BKOTST
  328. .SKIP
  329. JSR GETPNT
  330. TAY
  331. DEY
  332. CMP #2
  333. BCS BW10
  334. LDY #1
  335. .SKIP
  336. BW10 LDA #0 ;SET RECORD SIZE
  337. JSR SETPNT
  338. TYA
  339. JSR PUTBYT
  340. TXA
  341. PHA
  342. .SKIP
  343. BW20 JSR DRTWRT ;WRITE BLOCK
  344. PLA
  345. TAX
  346. JSR RNGET2
  347. JMP ENDCMD
  348. .SKIP
  349. ;USER DIRCT WRITE, NO LSTCHR
  350. UBLKWT JSR BLKPAR
  351. JSR BKOTST
  352. JSR DRTWRT
  353. JMP ENDCMD
  354. .SKIP
  355. ;IN .FILE VECTOR:
  356. ;*=$FFFA-6 ;USER DIRECT ACCESS
  357. ;UBLOCK .WORD UBLKRD
  358. ; .WORD UBLKWT
  359. .SKIP 2
  360. ;BLOCK-EXECUTE
  361. BLKEXC
  362. JSR KILLP ;KILL PROTECT
  363. JSR BLKRD2 ;READ BLOCK & EXECUTE
  364. LDA #0
  365. .SKIP
  366. BE05 STA TEMP
  367. LDX JOBNUM
  368. LDA BUFIND,X
  369. STA TEMP+1
  370. JSR BE10 ;INDIRECT JSR
  371. JMP ENDCMD
  372. .SKIP
  373. BE10 JMP (TEMP)
  374. .SKIP 2
  375. ;BUFFER-POINTER, SET BUFFER POINTER
  376. BLKPTR JSR BUFTST
  377. LDA JOBNUM
  378. ASL A
  379. TAX
  380. LDA FILSEC+1
  381. STA BUFTAB,X
  382. JSR GETPRE
  383. JSR RNGET2 ;SET UP GET
  384. JMP ENDCMD
  385. .SKIP
  386. ;TEST FOR ALLOCATED BUFFER..
  387. ; ..RELATED TO SA
  388. BUFTST LDX F1PTR
  389. INC F1PTR
  390. LDA FILSEC,X
  391. TAY
  392. DEY
  393. DEY
  394. CPY #$C ; SET LIMIT TO # OF SAS
  395. BCC BT20
  396. .SKIP
  397. BT15 LDA #NOCHNL
  398. JMP CMDERR
  399. .SKIP
  400. BT20 STA SA
  401. JSR FNDRCH
  402. BCS BT15
  403. JSR GETACT
  404. STA JOBNUM
  405. RTS
  406. .SKIP
  407. ;TEST BLOCK OPERATION PARMS
  408. BKOTST JSR BUFTST
  409. ;
  410. ;TEST FOR LEGAL BLOCK &..
  411. ; ..SET UP DRV, TRK, SEC
  412. BLKTST LDX F1PTR
  413. LDA FILSEC,X
  414. AND #1
  415. STA DRVNUM
  416. LDA FILSEC+2,X
  417. STA SECTOR
  418. LDA FILSEC+1,X
  419. STA TRACK
  420. BT05
  421. JSR TSCHK
  422. JMP SETLDS ;(RTS)
  423. .SKIP
  424. .END
  425. ; RSR 1/19/80 ADD AUTOI TO #CMD