home *** CD-ROM | disk | FTP | other *** search
/ CBM Funet Archive / cbm-funet-archive-2003.iso / cbm / src / pet / ADD-ON-MON.txt < prev    next >
Encoding:
Text File  |  1998-10-18  |  57.2 KB  |  1,492 lines

  1. add-on-m*......page 0001
  2.  
  3. line# loc   code        line
  4.  
  5.  
  6.  
  7. 00001 0000              ;*****************************************
  8. 00002 0000              ;*                                       *
  9. 00003 0000              ;*  aaa  dddd  dddd       000  n   n     *
  10. 00004 0000              ;* a   a d   d d   d     o   0 nn  n     *
  11. 00005 0000              ;* a   a d   d d   d *** o   0 n n n     *
  12. 00006 0000              ;* aaaaa d   d d   d *** o   o n n n     *
  13. 00007 0000              ;* a   a d   d d   d     o   o n  nn     *
  14. 00008 0000              ;* a   a dddd  dddd       ooo  n   n     *
  15. 00009 0000              ;*                                       *
  16. 00010 0000              ;*       m   m  ooo  n   n               *
  17. 00011 0000              ;*       mm mm o   o nn  n               *
  18. 00012 0000              ;*  ***  m m m o   o n n n               *
  19. 00013 0000              ;*  ***  m   m o   o n n n               *
  20. 00014 0000              ;*       m   m o   o n  nn               *
  21. 00015 0000              ;*       m   m  ooo  n   n               *
  22. 00016 0000              ;*                                       *
  23. 00017 0000              ;****************************************
  24.  
  25.  
  26. 00019 0000              ;*****************************************
  27. 00020 0000              ;*                                       *
  28. 00021 0000              ;*  64k-add-on monitor                   *
  29. 00022 0000              ;*                                       *
  30. 00023 0000              ;*  this program allows a user to        *
  31. 00024 0000              ;*  examine, modify, and run programs    *
  32. 00025 0000              ;*  with breakpoints in the 64k add-on   *
  33. 00026 0000              ;*  memory. it is functionally the same  *
  34. 00027 0000              ;*  as the pet resident monitor.         *
  35. 00028 0000              ;*                                       *
  36. 00029 0000              ;*  29jan81 rjf         29jul81 rjf      *
  37. 00030 0000              ;*                                       *
  38. 00031 0000              ;*  cbm part # 8032118 - 01 rev b        *
  39. 00032 0000              ;*                                       *
  40. 00033 0000              ;*****************************************
  41.  
  42.  
  43.  
  44. add-on-m*......page 0002
  45.  
  46. line# loc   code        line
  47.  
  48. 00035 0000              ;
  49. 00036 0000              ;virtual registers
  50. 00037 0000              ;
  51. 00038 0000              pch    *=*+1           ;program counter
  52. 00039 0001              pcl    *=*+1
  53. 00040 0002              flgs   *=*+1           ;processor status
  54. 00041 0003              acc    *=*+1           ;accumulator
  55. 00042 0004              xr     *=*+1           ;x index
  56. 00043 0005              yr     *=*+1           ;y index
  57. 00044 0006              sp     *=*+1           ;stack pointer
  58. 00045 0007              invh   *=*+1           ;user  irq vector
  59. 00046 0008              invl   *=*+1
  60. 00047 0009              memmap *=*+1           ;add-on control reg
  61. 00048 000a              ;
  62. 00049 000a              ;indirect pointers
  63. 00050 000a              ;
  64. 00051 000a              stal   *=*+1           ;save store pointer
  65. 00052 000b              stah   *=*+1
  66. 00053 000c              ;
  67. 00054 000c              sal    *=*+1           ;load/save start
  68. 00055 000d              sah    *=*+1
  69. 00056 000e              ;
  70. 00057 000e              eal    *=*+1           ;load/save end
  71. 0005b 000f              eah    *=*+1
  72. 00059 0010              ;
  73. 00060 0010              tmp0   *=*+2           ;monitor indirects
  74. 00061 0012              ;
  75. 00062 0012              tmp2   *=*+2
  76. 00063 0014              ;
  77. 00064 0014              ;working variables
  78. 00065 0014              ;
  79. 00066 0014              tmpc   *=*+1
  80. 00067 0015              savx   *=*+1
  81. 00068 0016              wrap   *=*+1           ;wrap flag for displym
  82. 00069 0017              ;
  83. 00070 0017              tmpa   *=*+1           ;.a save for irq
  84. 00071 0018              tmpps  *=*+1           ;.p save for irq
  85.  
  86.  
  87.  
  88. add-on-m*......page 0003
  89.  
  90. line# loc   code        line
  91.  
  92. 00073 0019              ;.
  93. 00074 0019              cinv   =$90
  94. 00075 0019              cbinv  =$92
  95. 00076 0019              buf    =$200
  96. 00077 0019              fnadr  =$da
  97. 00078 0019              fnlen  =$d1
  98. 00079 0019              cr     =$d
  99. 00080 0019              bad    =$100
  100. 00091 0019              status =$96
  101. 00082 0019              fa     =$d4
  102. 00093 0019              sa     =$d3
  103. 00084 0019              rclrch =$f2a6
  104. 00095 0019              rlistn =$fod5
  105. 00086 0019              rsecho =$f143
  106. 00097 0019              rciout =$f19e
  107. 00088 0019              runlsn =$f1b9
  108. 00089 0019              rtalk  =$f0d2
  109. 00090 0019              rtksa  =$f193
  110. 00091 0019              racptr =$f1c0
  111. 00092 0019              runtlk =$f1ae
  112. 00093 0019              ropeni =$f4a5
  113. 00094 0019              stkey  =$9b
  114. 00095 0019              ndx    =$9e
  115.  
  116.  
  117.  
  118. add-on-m*......page 0004
  119.  
  120. line# loc   code        line
  121.  
  122. 00097 0019              ;
  123. 00098 0019                     * =1024
  124. 00099 0400              sys    =158            ;basic token value
  125. 00100 0400              ;
  126. 00101 0400              ;enter compiled basic text
  127. 00102 0400              ;
  128. 00103 0400  00                 .byt 0
  129. 00104 0401  00 04              .wor init-2
  130. 00105 0403  10 00              .wor $10
  131. 00106 0405  9e                 .byt sys
  132. 00107 0406  28 31              .byt '(1039)',0,0,0
  133. 00107 040c  00
  134. 00107 0400  00
  135. 00107 040e  00
  136. 00108 040f              ;
  137. 00109 040f              ;initialize interrupt process
  138. 00110 040f              ;
  139. 00111 040f  79          init   sei
  140. 00112 0410  a9 80              lda #%10000000
  141. 00113 0412  85 09              sta memmap
  142. 00114 0414  bd fo ff           sta $fff0
  143. 00115 0417  20 2b 04           jsr setirq
  144. 00116 041a  a9 98              lda #%10001000
  145. 00117 041c  bd fo ff           sta $fff0
  146. 00118 041f  20 2b 04           jsr setirq
  147. 00119 0422  a5 09              lda memmap
  148. 00120 0424  8d fo ff           sta $fff0
  149. 00121 0427              ;
  150. 00122 0427  5b                 cli
  151. 00123 0428  4c 7a 04           jmp timc
  152.  
  153.  
  154.  
  155. add-on-m*......page 0005
  156.  
  157. line# loc   code        line
  158.  
  159. 00125 042b  a9 40       setirq lda #<irq
  160. 00126 0420  od fe ff           sta $fffe
  161. 00127 0430  a9 04              lda #>irq
  162. 00129 0432  8d ff ff           sta $ffff
  163. 00129 0435  a9 59              lda #<nmi
  164. 00130 0437  8d fa ff           sta $fffa
  165. 00131 043a  a9 04              lda #>nmi
  166. 00132 043c  8d fb ff           sta $fffb
  167. 00133 043f  60                 rts
  168.  
  169.  
  170. 00135 0440              ;process irq
  171. 00136 0440              ;
  172. 00137 0440  85 17       irq    sta tmpa        ;preserve a
  173. 00139 0442              ;
  174. 00139 0442  68                 pla
  175. 00140 0443  48                 pha
  176. 00141 0444  85 18              sta tmpps
  177. 00142 0446              ;
  178. 00143 0446  a9 00              lda #%00000000
  179. 00144 0448  8d f0 ff           sta $fff0
  180. 00145 044b              ;
  181. 00146 044b              ;push return from interrupt address
  182. 00147 044b              ;
  183. 00148 044b  a9 04              lda  #>rtip
  184. 00149 0440  48                 pha
  185. 00150 044e  a9 72              lda  #<rtip
  186. 00151 0450  48                 pha
  187. 00152 0451              ;
  188. 00153 0451  a5 16              lda tmpps
  189. 00154 0453  48                 pha             ;push dummy status
  190. 00155 0454              ;
  191. 00156 0454  a5 17              lda tmpa        ;restore a
  192. 00157 0456              ;
  193. 00158 0456              ;go to rom irq service
  194. 00159 0456              ;
  195. 00160 0456  6c fe ff           jmp ($fffe)
  196.  
  197.  
  198. 00162 0459              ;process nmi
  199. 00163 0459              ;
  200. 00164 0459              ;process nmi
  201. 00165 0459              ;
  202. 00166 0459  85 17       nmi    sta tmpa        ;preserve a
  203. 00167 045b              ;
  204. 00168 045b  68                 pla
  205. 00169 045c  48                 pha
  206. 00170 045d  85 18              sta tmpps
  207. 00171 045f              ;
  208.  
  209.  
  210.  
  211. add-on-m*......page 0006
  212.  
  213. line* loc   code        line
  214.  
  215. 00172 045f              ;
  216. 00173 045f  a9 00              lda #%00000000
  217. 00174 0461  8d f0 ff           sta $fff0
  218. 00175 0464              ;
  219. 00176 0464              ;push return from interrupt address
  220. 00177 0464              ;
  221. 00178 0464  a9 04              lda #>rtip
  222. 00179 0466  49                 pha
  223. 00180 0467  a9 72              lda #<rtip
  224. 00181 0469  48                 pha
  225. 00192 046a              ;
  226. 00183 046a  a5 19              lda tmpps
  227. 00184 046c  48                 pha             ;push dummy status
  228. 00185 0460              ;
  229. 00186 0460  a5 17              lda tmpa
  230. 00187 046f              ;
  231. 00188 046f              ;g0 to rom irq service
  232. 00189 046f              ;
  233. 00190 046f  6c fa ff           jmp  ($fffa)
  234.  
  235.  
  236. 00192 0472              ;return from interrupt process
  237. 00193 0472              ;
  238. 00194 0472  49          rtip   pha
  239. 00195 0473              ;
  240. 00196 0473              ;map back to original ram
  241. 00197 0473              ;
  242. 0019b 0473  a5 09              lda memmap
  243. 00199 0475  8d f0 ff           sta $fff0
  244. 00200 0479              ;
  245. 00201 0478              ;restore old .a
  246. 00202 0478              ;
  247. 00203 0478  68                 pla
  248. 00204 0479              ;
  249. 00205 0479              ;back to user
  250. 00206 0479              ;
  251. 00207 0479  40                 rti
  252.  
  253.  
  254.  
  255. monitor......page 0007
  256.  
  257. line# loc   code        line
  258.  
  259. 00209 047a              ;************************************************
  260. 00210 047a              ;*                                              *
  261. 00211 047a              ;* kernal monitor                               *
  262. 00212 047a              ;*                                              *
  263. 00213 047a              ;* entry via call (jmp) or breakpoint (brk)     *
  264. 00214 047a              ;* --- functions---                             *
  265. 00215 047a              ;* <:> alter memory                             *
  266. 00216 047a              ;* <;> alter registers                          *
  267. 00217 047a              ;* <r> display registers                        *
  268. 00218 047a              ;* <m> display memory                           *
  269. 00219 047a              ;* <g> start execution of code                  *
  270. 00220 047a              ;* <l> load memory                              *
  271. 00221 047a              ;* <s> save memory                              *
  272. 00222 047a              ;* <@> disk command                             *
  273. 00223 047a              ;* <*> add-on control register                  *
  274. 00224 047a              ;* <other> load and execute from disk           *
  275. 00225 047a              ;*                                              *
  276. 00226 047a              ;* for syntax & semantics see cbm kernal manual *
  277. 00227 047a              ;* copyright (c) 1980 by cbm                    *
  278. 0022E 047a              ;************************************************
  279.  
  280.  
  281.  
  282. monitor......page 0008
  283.  
  284. line# loc   code        line
  285.  
  286. 00230 047a              ;*****call entry*****
  287. 00231 047a              ;
  288. 00232 047a              timc
  289. 00233 047a  a9 88              lda #<timb
  290. 00234 047c  85 92              sta cbinv
  291. 00235 047e  a9 04              lda #>timb
  292. 00236 0480  85 93              sta cbinv+1
  293. 00237 0492  a9 5e              lda #ms34-ms1   ;call entry
  294. 00238 0484  95 14              sta tmpc
  295. 00239 0486  d0 10              bne b3          ;branch always
  296. 00240 0489              ;
  297. 00241 0489              ;*****break entry*****
  298. 00242 0489              ;
  299. 00243 0488  20 91 09    timb   jsr clrch       ;clr channels
  300. 00244 046b  a9 75              lda #ms36-ms1   ;break entry
  301. 00245 048d  85 14              sta tmpc
  302. 00246 048f  d8                 cld
  303. 00247 0490              ;
  304. 00248 0490              ;save .y,.x,.a,flags, and pc
  305. 00249 0490              ;
  306. 00250 0490  a2 05              ldx #5
  307. 00251 0492  68          b1     pla
  308. 00252 0493  95 00              sta pch,x
  309. 00253 0495  ca                 dex
  310. 00254 0496  10 fa              bpl b1
  311. 00255 0498              ;
  312. 00256 0498  a5 90       b3     lda cinv
  313. 00257 049a  85 08              sta invl        ;save irq low
  314. 00250 049c  a5 91              lda cinv+1
  315. 00259 049e  95 07              sta invh        ;save irq high
  316. 00260 04a0              ;
  317. 00261 04a0  ba                 tsx
  318. 00262 04a1  86 06              stx sp          ;save original sp
  319. 00263 04a3  58                 cli             ;clear ints
  320. 00264 04a4              ;
  321. 00265 04a4  a4 14       b5     ldy tmpc        ;message code
  322. 00266 04a6  20 62 09           jsr msg         ;print break/call
  323. 00267 04a9              ;
  324. 0026E 04a9  a9 52              lda #'r         ;display regs on entry
  325. 00269 04ab  do 17              bne so          ;branch always
  326. 0027c 04ad              ;
  327. 00271 04ad              ;*****error entry*****
  328. 00272 04ad              ;
  329. 00273 04ad  20 50 05    erropr jsr outqst
  330. 00274 04b0  68                 pla
  331. 00275 04b1  60                 pla
  332. 00276 04b2              ;
  333. 00277 04b2              ;*****command interpreter entry*****
  334. 0027b 04b2              ;
  335. 00279 04b2              strtm1=*-1
  336. 00280 04b2  a2 00              ldx #<buf       ;place to put file name
  337. 00281 04b4  ao 02              ldy #>buf
  338. 00292 04b6  86 da              stx fnadr
  339. 00203 04b8  94 db              sty fnadr+1
  340. 002e4 04ba  20 53 05           jsr crlf
  341.  
  342.  
  343.  
  344. monitor......page 0009
  345.  
  346. line# loc   code        line
  347.  
  348. 00285 04bd              ;
  349. 00286 04od  20 71 09    st1    jsr basin       ;read command
  350. 00287 04c0  c9 20              cmp #$20
  351. 00289 04c2  fo f9              beg st1         ;span blanks
  352. 002b9 04c4              ;
  353. 00290 04c4              ;command interpreter
  354. 00291 04c4              ;
  355. 00292 04c4  a2 00       so     ldx #0
  356. 00293 04c6  96 16              stx wrap
  357. 00294 04c8  86 d1              stx fnlen
  358. 00295 04ca  a8                 tay             :save current command
  359. 00296 04c8              ;
  360. 00297 04cb              ;put return address for comands on stack
  361. 00299 04cb              ;
  362. 00299 04cb  a9 04              lda #>strtm1
  363. 00300 04cd  48                 pha
  364. 00301 04ce  a9 b1              lda #<strtm1
  365. 00302 04d0  48                 pha
  366. 00303 04d1              ;
  367. 00304 04d1  98                 tya             ;current command in .a
  368. 00305 04d2              ;
  369. 00306 04d2  dd 16 05    s1     cmp cmds,x      ;is it this one?
  370. 00307 04d3  do of              bne s2          ;notit
  371. 00309 04d7              ;
  372. 00309 04d7  85 15              sta savx        ;save current command
  373. 00310 04d9              ;
  374. 00311 04d9              ;indirekt jmp from table
  375. 00312 04d9              ;
  376. 00313 04d9  bd 17 05           lda cmds+1,x
  377. 00314 04dc  85 10              sta tmp0
  378. 00315 04de  bd 18 05           lda cmds+2,x
  379. 00316 04e1  85 11              sta tmp0+1
  380. 00317 04e3  6c 10 00           jmp (tmp0)
  381. 00318 04e6              ;
  382. 00319 04e6              ;each table entry is 3 long---skip to next
  383. 00320 04e6              ;
  384. 00321 04e6  e8          s2     inx
  385. 00322 04e7  e8                 inx
  386. 00323 04e9  e8                 inx
  387. 00324 04e9  eo 1b              cpx #cmdend-cmds
  388. 00325 04eb  90 e5              bcc s1          ;loop f0r all commands
  389. 00326 04ed              ;
  390. 00327 04ed              ;command not in table.,.look on disk.
  391. 0g328 04ed              ;command name can be any length and
  392. 00329 04ed              ;have parameters.
  393. 00330 04ed              ;
  394. 00331 04ed  a2 00              ldy #0          ;length to zero
  395. 00332 04ef  c9 00       s3     cmp #$d         ;end of name?
  396. 00333 04f1  fo 00              beq s4          ;yes...
  397. 00334 04f3  c9 20              cmp #$20        ;blank?
  398. 00335 04f5  fo 09              beq s4          ;yes
  399. 00336 04f7  9d 00 02           sta buf,x
  400. 00337 04fa  20 71 09           jsr basin       ;get next
  401. 00338 04fd  e8                 inx             ;count char
  402. 00339 04fe  do ef              bne s3          ;and continue
  403.  
  404.  
  405.  
  406. monitor......page 0010
  407.  
  408. line# loc   code        line
  409.  
  410. 30340 0500              ;
  411. 00341 0500  85 14       s4     sta tmpc
  412. 30342 0502  8a                 txa             ;count
  413. 00343 0503  f0 10              beq s6          ;is zero
  414. 00344 0505              ;
  415. 00345 0505  85 01              sta fnlen
  416. 00346 0507  a9 08              lda #8
  417. 00347 0509  85 04              sta fa          ;will use device #8
  418. 00348 050b  20 96 07           jsr load        ;try to load command
  419. 00349 050e  bo 05              bcs s6          ;bad load...
  420. 00350 0510              ;
  421. 00351 0510  a5 14              lda tmpc        ;pass last character
  422. 00352 0512  6c oa 00           jmp (stal)      ;go do it
  423. 00353 0515              ;
  424. 00354 0515  60          s6     rts
  425.  
  426. 00356 0516  3a          cmds   .byt ':'        ;alter memI3ry
  427. 00357 0517  of 06              .wor altm
  428. 00359 0519  3b                 .byt ';'        ;alter registers
  429. 00359 051a  f5 05              .wor altr
  430. 00360 051c  52                 .byt 'r'        ;display registeps
  431. 00361 0510  73 05              .wor dsplyr
  432. 00362 051f  40                 .byt 'm'        ;display memory
  433. 00363 0520  84 05              .wor dsplym
  434. 00364 0522  47                 .byt 'g'        ;start execution
  435. 00365 0523  32 06              .wor go
  436. 00366 0525  4c                 .byt 'l'        ;load memory
  437. 00367 0526  5e 06              .wor ld
  438. 00368 0529  53                 .byt 's'        ;save memory
  439. 00369 0529  5e 06              .wor ld
  440. 00370 052b  2a                 .byt '*'        ;map memory
  441. 00371 052c  2c 06              .wor mapper
  442. 00372 052e  40                 .byt '@'        ;disk command (alternate)
  443. 00373 052f  49 07              .wor disk
  444. 00374 0531              cmdend
  445.  
  446. 00376 0531  a5 10       putp   lda tmp0        ;move tmp0 to pch,pcl
  447. 00377 0533  85 01              sta pcl
  448. 00378 0535  a5 11              lda tmp0+l
  449. 00379 0537  95 00              sta pch
  450. 00380 0539  60                 rts
  451.  
  452. 00382 053a  a9 02       setr   lda #<flgs      ;set to access regs
  453. 00393 053c  85 10              sta tmp0
  454. 00384 053e  a9 00              lda #>flgs
  455.  
  456.  
  457.  
  458. monitor......page 0011
  459.  
  460. line# loc   code        line
  461.  
  462. 00395 0540  95 11              sta tmp0+l
  463. 00386 0542  a9 05              lda #5
  464. 00397 0544  60                 rts
  465.  
  466. 00389 0545              ;prints ':' or ';' before data to permit
  467. 00390 0545              ;alter after 'm' or 'r' command
  468. 00391 0545              ;
  469. 00392 0545  48          altrit pha             ;preserve alter character
  470. 00393 0546  20 53 05           jsr crlf
  471. 00394 0549  6E                 pla
  472. 00395 054a  20 81 09           jsr bsout
  473.  
  474. 00397 0540  a9 20       space  lda #$20        ;output a spacf
  475. 00398 054f  2c                 .byt $2c        ;skip two bytes
  476. 00399 0550  a9 3f       outqst lda #'?'        ;output question
  477. 00400 0552  2c                 .byt $2c        ;skip two bytes
  478. 00401 0553  a9 od       crlf   lda #$d         ;do carriage return
  479. 00402 0555  4c 91 09           jmp bsout
  480.  
  481. 00404 0559              ;data for register display heading
  482. 00405 055b              ;
  483. 00406 0558  00  regk           .byt cr,$20,$20 ;3 spaces
  484. 00406 0559  20
  485. 00406 055a  20
  486. 00407 0552  20 50              .byt ' pc ',' irq ',' sr ac xr yr sp'
  487. 00407 055f  20 49
  488. 00407 0564  20 53
  489.  
  490. 00409 0573              ;display register function
  491. 00410 0573              ;
  492. 00411 0573  a2 00       dsplyr ldx  #0
  493. 00412 0575  bd 58 05    d2     lda regk,x
  494. 00413 0578  20 81 09           jsr bsout       ;print heading
  495. 00414 057b  e8                 inx
  496. 00415 057c  e0 1b              cpx #dsplyr-regk ;max lenoth
  497. 00416 057e  do f5              bne d2
  498. 00417 0580  a9 39              lda #';'
  499. 00418 0582  20 45 05           jsr altrit      ;allow alter after display
  500. 00419 0585  a6 00              ldx pch
  501. 00420 0587  a4 01              ldy pcl
  502. 00421 0589  20 dc 06           jsr wroa        ;print program cmmter
  503.  
  504.  
  505.  
  506. monitor......page 0012
  507.  
  508. line# loc   code        line
  509.  
  510. 00422 058c  20 4d 05           jsr space
  511. 00423 058f  a6 07              ldx invh
  512. 00424 0591  a4 08              ldy invl
  513. 00425 0593  20 dc 06           jsr wroa        ;print irq vector
  514. 00426 0596  20 3a 05           jsr setr        ;set to print .p,.a,.x,.y,.s
  515. 00427 0599              ;
  516. 00429 0599              ;display memory subroutine
  517. 00429 0599              ;
  518. 00430 0599  85 14       dm     sta tmpc        ;byte count
  519. 00431 059b  ao 00              ldy #0          ;indirect index
  520. 00432 059d  20 40 05    dm1    jsr space       ;space tween bytes
  521. 00433 05a0  81 10              lda (tmp0),y
  522. 00434 05a2  20 e1 06           jsr wrob        ;write byte of memory
  523. 00435 05a5              ;
  524. 00436 05a5              ;increment indirect
  525. 00437 05a5              ;
  526. 00438 05a5  e6 10              inc tmp0
  527. 00439 05a7  do 06              bne dm2
  528. 00440 05a9  e6 11              inc tmp0+1
  529. 00441 05ab  do 02              bne dm2
  530. 00442 05ad  e6 16              inc wrap
  531. 00443 05af              ;
  532. 00444 05af  c6 14       dm2    dec tmpc        ;count bytes
  533. 00445 0581  do fa              bne dm1         ;until zero
  534. 00446 0583  60                 rts
  535.  
  536. 00448 05b4              ;display memory function
  537. 00449 05b4              ;
  538. 00450 05b4  20 09 07    dsplym jsr rdoa        ;read start adr
  539. 00451 05b7  do 39              bcs errs1       ;err if no sa
  540. 00452 05b9  20 f9 06           jsr t2t2        ;sa to tmp2
  541. 00453 059c              ;
  542. 00454 05bc              ;allow user to type just one address
  543. 00455 05bc              ;
  544. 00456 05bc  20 09 07           jsr rdoa        ;read end adr
  545. 00457 05bf  90 06              bcc dsp1o       ;g00d.. no default
  546. 00458 05c1              ;
  547. 00459 05c1  a5 12              lda tmp2
  548. 00460 05c3  05 10              sta tmp0        ;default low byte
  549. 00461 05c5  a5 13              lda tmp2+1
  550. 00462 05c7  85 11              sta tmp0+1      ;default hi byte
  551. 00463 05c9              ;
  552. 00464 05c9  20 f9 06    dsp10  jsr t2t2        ;sa to tmp0, ea to tmp2
  553. 00465 05cc  20 aa 08    dsp1   jsr stop        ;stop key?
  554. 00466 05cf  fo 20              beq beqs1       ;yes...break list
  555. 00467 05d1              ;
  556. 00468 05d1  a9 3a              lda ':'
  557. 00469 05d3  20 45 05           jsr altrit      ;allow alter
  558. 00470 05d6  a6 11              ldx tmp0+1
  559. 00471 05d8  a4 10              ldy tmp0
  560. 00472 05da  20 dc 06           jsr wroa        ;write start address
  561.  
  562.  
  563.  
  564. monitor......page 0013
  565.  
  566. line# loc   code        line
  567.  
  568. 00473 05dd  a9 09              lda #8          ;count of bytes
  569. 00474 05df  20 99 05           jsr dm          ;display bytes
  570. 00475 05e2  a5 16              lda wrap
  571. 00476 05e4  do ob              bne beqs1
  572. 00477 05e6              ;
  573. 00478 05e6              ;check for end of display
  574. 00479 05e6              ;
  575. 00400 05e6  38                 sec
  576. 00481 05e7  a5 12              lda tmp2
  577. 004b2 05e9  e5 10              sbc tmp0
  578. 00483 05eb  a5 13              lda tmp2+1
  579. 00484 05ed  e5 11              sbc tmp0+l
  580. 00485 05ef  bo db              bcs dsp1        ;end >= start
  581. 00486 05f1              ;
  582. 00487 05f1  60          beqs1  rts             ;a.o.k. exit
  583. 00488 05f2              ;
  584. 00499 05f2  4c ad 04    errs1  jmp erropr      ;syntax error
  585.  
  586. 00491 05f5              ;alter register function
  587. 00492 05f5              ;
  588. 00493 05f5 20 09 07     altr   jsr rdoa        ;read new pc
  589. 00494 05f8 bo fs               bcs errs1       ;error... no adoress
  590. 00495 05fa              ;
  591. 00496 05fa 20 31 05            jsr putp        ;alter pc
  592. 00497 05fd              ;
  593. 00498 05fd 20 09 07            jsr rdoa        ;read new irq
  594. 00499 0600 bo fo               bcs errs1       ;error...no address
  595. 00500 0602              ;
  596. 00501 0602 a5 10               lda tmp0
  597. 00502 0604 85 08               sta invl        ;alter irq vector
  598. 00503 0606 a5 11               lda tmp0+1
  599. 00504 0608 85 07               sta invh
  600. 00505 060a              ;
  601. 00506 060a 20 3a 05            jsr setr        ;set to alter r's
  602. 00507 060d d0 07               bne a4          ;branch always
  603.  
  604. 00509 060f              ;alter memory - read adr and data
  605. 00510 060f              ;
  606. 00511 060f  20 09 07    altm   jsr rdoa        ;read alter adr
  607. 00512 0612  bo de              bcs errs1       ;if space,err
  608. 00513 0614              ;
  609. 00514 0614  a9 08              lda #8          ;allow eight bytes change
  610. 00515 0616              ;
  611. 00516 0616              ;common code for ':' and ';'
  612. 00517 0616              ;
  613. 00519 0616  85 14       a4     sta tmpc        ;number of bytes to change
  614. 00519 0618              ;
  615.  
  616.  
  617.  
  618. monitor......page 0014
  619.  
  620. line# loc   code        line
  621.  
  622. 00520 0618  20 16 07    a5     jsr rdob        ;read byte
  623. 00521 061b  bo oe              bcs a9          ;none...end of line
  624. 00522 061d              ;
  625. 00523 061d  a2 00              ldx #0
  626. 00524 061f  81 10              sta (tmp0,x)    ;store it away
  627. 00525 0621              ;
  628. 00526 0621              ;increment store address
  629. 00527 0621              ;
  630. 00528 0621  e6 10              inc tmp0
  631. 00529 0623  do 02              bne a6
  632. 00530 0625  e6 11              inc tmp0+1
  633. 00531 0627              ;
  634. @0532 0627  c6 14       a6     dec tmpc        ;count byte
  635. 00533 0629  do ed              bne a5          ;until zero
  636. 00534 062b              ;
  637. 00535 062b  60          a9     rts
  638.  
  639. 00537 062c              ;map memory
  640. 00538 062c              ;
  641. 00539 062c  20 16 07    mapper jsr rdob
  642. 00540 062f  95 09              sta memmap
  643. 00541 0631  60                 rts
  644.  
  645. 00543 0632              ;start execution function
  646. 00544 0632              ;
  647. 00545 0632  20 45 07    go     jsr rdoc        ;see if default
  648. 00546 0635  fo 08              beq g1          ;yes... pc is address
  649. 00547 0637              ;
  650. 00548 0637  20 09 07           jsr rdoa        ;n0.. get new addr
  651. 00549 o63a  bo 1f              bcs errl        ;error.. address screwed up
  652. 00550 063c              ;
  653. 00551 063c  20 31 05           jsr putp        ;move addr to p.c.
  654. 00552 063f              ;
  655. 00553 063f  a6 06       g1     ldx sp
  656. 00554 0641  9a                 txs             ;orig or new sp value to sp
  657. 00555 0642              ;
  658. 00556 0642  78                 sei             ;prevent disaster
  659. 00557 0643              ;
  660. 00559 0643  a5 07              lda invh
  661. 00559 0645  85 91              sta cinv+1     ;set up irq vector
  662. 00560 0647  a5 08              lda invl
  663. 00561 0649  85 90              sta cinv
  664. 00562 064b              ;
  665. 00563 064b              ;get flags,pch,pcl,.a,.x,.y
  666. 00564 064b              ;
  667. 00565 0648  a2 00              ldx #0
  668. 00566 064d  b5 00       g2     lda pch,x
  669.  
  670.  
  671.  
  672. monitor......page 0015
  673.  
  674. line# loc   code        line
  675.  
  676. 00567 064f  48                 pha            ;everybody on siack
  677. 00568 0650  e8                 inx
  678. 00569 0651  e0 06              cpx #6
  679. 00570 0653  d0 fs              bne g2
  680. 00571 0655              ;
  681. 00572 0655              ;interrupt return sets everybody up
  682. 00573 0655              ;from data on stack
  683. 00574 0655              ;
  684. 00575 0655  68          prend  pla
  685. 00576 0656  a8                 tay
  686. 00577 0657  68                 pla
  687. 00579 0658  aa                 tax
  688. 00579 0659  69                 pla
  689. 00590 065a  40                 rti
  690.  
  691.  
  692. 00582 065b  4c ad 04    errl   jmp erropr     ;syntax error jump
  693.  
  694.  
  695. 00594 065e              ;load ram function
  696. 00595 065e              ;
  697. 00586 065e  a0 01       ld     ldy #1
  698. 00587 0660  94 04              sty fa         ;default device #L
  699. 00588 0662  88                 dey            ;.y=0 to count name length
  700. 00589 0663              ;
  701. 00590 0663  20 45 07    l1     jsr rdoc       ;default?
  702. 00591 0666  f0 1c              beq l5         ;yes...try load
  703. 00592 0668              ;
  704. 00593 0668  c9 20              cmp #'
  705. 00594 066a  fo f7              beg l1         ;span blanks
  706. 00595 066c              ;
  707. 00596 066c  c9 22              cmp #'"        ;string next?
  708. 00597 066e  d0 eb       l2     bne errl       ;n0 file name
  709. 00598 0670              ;
  710. 00599 0670  20 45 07    l3     jsr rdoc       ;get character of name
  711. 00600 0673  fo of              beq l5         ;end...asssume load
  712. 00601 0675              ;
  713. 00603 0675  c9 22              cmp #'"        ;end of string?
  714. 00603 0677  f0 14              beq l8         ;yes...could still be 'l' or
  715. 00604 0679              ;
  716. 00605 0679  91 da              sta (fnadr)y   ;store name
  717. 00606 067b  e6 01              inc fnlen
  718. 00607 0670  c8                 iny
  719. 00608 067e  co 10              cpy #16        ;max filf name length
  720. 00609 0680              ;
  721. 00610 0680  fc 09       l4     beq errl       ;file name tod long
  722. 00611 0682  do ec              bne l3         ;branch always
  723. 00612 0684              ;
  724. 00613 0684              ;see if we got a load
  725. 00614 0B84              ;
  726. 00615 0684  a5 15       l5     lda savx       ;get last command
  727. 00616 0696  c9 4c              cmp #'l
  728. 00617 0688  do e4              bne l2         ;no..not a load..error
  729.  
  730.  
  731. monitor......page 0016
  732.  
  733. line# loc   code        line
  734.  
  735. 00618 068a              ;
  736. 00619 068a  4c 96 07           jmp load       ;yes...do load
  737. 00620 068d              ;
  738. 00621 068d              l8     jsr rdoc       ;more stuff?
  739. 00622 0690  fo f2              beq l5         ;no... defualt load
  740. 00623 0692              ;
  741. 00624 0692  c9 2c              cmp #',        ;deleimeter?
  742. 00625 0694  do d8       l9     bne l2         ;nd...bad syntax
  743. 00626 0696              ;
  744. 00627 0696  20 16 07           jsr rdob       ;yes...get next parm
  745. 00628 0699  do 3e              bcs l15        ;not good
  746. 00629 0690              ;
  747. 00630 069b  85 04              sta fa
  748. 00631 0690              ;
  749. 00632 0690  20 45 07           jsr rdoc       ;more parms?
  750. 00633 06a0  fo e2              beq l5         ;no... default load
  751. 00634 06a2              ;
  752. 00635 06a2  c9 2c              cmp #',        ;delimeter?
  753. 00636 06a4  d0 ee       l12    bne l9         ;no...bad syntax
  754. 00637 06a6              ;
  755. 00638 06a6  20 09 07           jsr rdoa       ;start address?
  756. 00639 06a9  b0 2e              bcs l15        ;no...bad
  757. 00640 06ab              ;
  758. 00641 06a8  20 f9 06           jsr t2t2       ;preserve start
  759. 00642 06ae  20 71 09           jsr basin      ;delimeter?
  760. 00643 06b1  c9 2c              cmp #',
  761. 00644 06b3  d0 ef       l13    bne l12        ;no...
  762. 00645 06b5  20 09 07           jsr rdoa       ;try to read end
  763. 00646 06bE  do 1f              bcs l15        ;none...error
  764. 00647 06ba              ;
  765. 00648 06ba              ;set up end save address
  766. 00649 06ba              ;
  767. 00650 068a  a5 10              lda tmp0
  768. 00651 06bc  85 0e              sta eal
  769. 00652 06be  a5 11              lda tmp0+l
  770. 00653 06c0  85 of              sta eah
  771. 00654 06c2  20 f9 06           jsr t2t2
  772. 00655 06c5              ;
  773. 00656 06c5  20 71 09    l20    jsr basin
  774. 00657 06c8  C9 20              cmp #$20       ;span blanks
  775. 00658 06ca  fo f9              beq l20
  776. 00659 06cc              ;
  777. 00660 06cc  c9 od              cmp #cr
  778. 00661 06ce  do e3       l14    bne l13        ;missing cr at end
  779. 00662 06d0  a5 15              lda savx       ;was command save?
  780. 00663 06d2  c9 53              cmp #'s
  781. 00664 06d4  do fe              bne l14        ;no...load can't have parms
  782. 00665 06d6  4c 20 08           jmp save
  783. 00666 06d9              ;
  784. 00667 06d9  4c ad 04    l15    jmp erropr
  785.  
  786.  
  787. monitor......page 0017
  788.  
  789. line  loc   code        line
  790.  
  791. 00669 06dc              ;write adr from tmp0 stores
  792. 00670 06dc              ;
  793. 00671 06dc 8a           wroa   txa            ;hi-byte
  794. 00672 06dd 20 e1 06            jsr wrob
  795. 00673 06e0 98                  tya            ;low--byte
  796.  
  797. 00675 06e1              ;write byte --- a = byte
  798. 00676 06e1              ;unpack byte data into two ascii
  799. 00677 06e1              ;characters. a=byte; x,a=chars
  800. 00678 06e1 49           wrob   pha
  801. 00679 06e2 4a                  lsr a
  802. 00690 06e3 4a                  lsr a
  803. 006EL 06e4 4a                  lsr a
  804. 00692 06e5 4a                  lsr a
  805. 00683 06e6 20 ed 06            jsr ascii             ;convert to ascii
  806. 00684 06e9 aa                  tax
  807. 00685 06ea 69                  pla
  808. 00696 06eb 29 of               and #$of
  809.  
  810. 00688 06ed              ;cdnvert nybble in a to ascii and
  811. 00699 06ed              ;print it
  812. 00690 06ed              ;
  813. 00691 06ed 18           ascii  clc
  814. 00692 06ee 69 f6               adc #$f6
  815. 00693 06f0 90 02               bcc asc1
  816. 00694 06f2 69 06               adc #$06
  817. 00695 06f4 69 3a        asc1   adc #$3a
  818. 00696 06f6 4c 81 09            jmp bbout
  819.  
  820.  
  821. 00698 06f9              ;exchange tempoparies
  822. 00699 06f9              ;
  823. 00700 06f9 a2 02        t2t2   ldx #2
  824. 00701 06fb b5 of        t2t21  lda tmp0-1,x
  825. 00702 06fd 49                  pha
  826. 00703 06fe b5 11               lda tmp2-1,x
  827. 00704 0700 95 of               sta tmp0-1,x
  828. 00705 0702 68                  pla
  829. 00706 0703 95 11               sta tmp2-1,x
  830. 00707 0705 ca                  dex
  831. 00709 0706 d0 f3               bne t2t21
  832. 00709 0709 60                  rts
  833.  
  834. 00711 0709              ;read hex adr,return hi in tmp0,
  835.  
  836.  
  837. monitor......page 0018
  838.  
  839. line# loc   code        line
  840.  
  841. 00712 0709              ;lo in tmp0+1,and cy=1
  842. 00713 0709              ;if sp cy=0
  843. 00714 0709              ;
  844. 00715 0709 20 16 07     rdoa   jsr rdob              ;read 2-char byte
  845. 00716 070c bo 07               bcs rdoa2             ;space
  846. 00717 070e 85 11               sta tmp0+1
  847. 00719 0710 20 16 07            jsr rdob
  848. 00719 0713 85 10               sta  tmp0
  849. 00720 0715 60           rdoa2  rts
  850. 00721 0716              ;read hex byte and return in a
  851. 00722 0716              ;and cy=0 if sp cy=1
  852. 00723 0716 a9 00        rdob   lda #0                ;space
  853. 00724 0718 bd 00 01            sta bad               ;read next char
  854. 00725 0719 20 45 07            jsr rdoc
  855. 00726 07Le fo 19               beq rdob4             ;fail on cr
  856. 00727 0720 c9 20               cmp #'                ;blank?
  857. 00729 0722 fo f2               beq rdob              ;span blanks...
  858. 00729 0724              ;
  859. 00730 0724 20 3a 07            jsr hexit             ;convert to hex nybble
  860. 00731 0727 oa                  asl a
  861. 00732 0729 oa                  asl a
  862. 00733 0729 oa                  asl a
  863. 00734 072a oa                  asl a
  864. 00735 072b 8d 00 01            sta bad
  865. 00736 072e 20 45 07            jsr rdoc              ;2nd char assumed hex
  866. 00737 0731 fo 06               beq rdob4             ;fail on cr
  867. 00738 0733 20 3a 07            jsr hexit
  868. 00739 0736 od 00 01            ora bad
  869. 00740 0739              ;
  870. 00741 0739 60           rdob4  rts
  871.  
  872. 00743 073a              ;convert ascii char to hex nybble
  873. 00744 073a              ;
  874. 00745 073a c9 3a        hexit  cmp #$3a
  875. 00746 073c 08                  php                   ;save flags
  876. 00747 0730 29 of               and #$of
  877. 00749 073f 2A                  plp
  878. 00749 0740 90 02               bcc hex09             ;0-9
  879. 00750 0742 69 08               adc #8                ;alpha add 8+cy=9
  880. 00751 0744 60           hex09  rts
  881.  
  882. 00753 0745              ;get character and test for cr
  883. 00754 0745              ;
  884. 00755 0745 20 71 09     rdoc   jsr basin
  885. 00756 0748 c9 od               cmp #$od              ;is it a cr
  886. 00757 074a 60                  rts                   ;return with flags
  887.  
  888.  
  889. monitor......page 0019
  890.  
  891. line# loc   code        line
  892.  
  893. 00759 074b              ;send disk command or read status
  894. 00760 0740              ;
  895. 00761 0748 a9 00        disk   lda #0                ;clear status @ i/0 begin
  896. 00762 0740 85 96               sta status
  897. 00763 074f              ;
  898. 00764 074f 20 45 07            jsr rdoc              ;see if status check
  899. 00765 0752 fo 22               beq disk20            ;yes
  900. 00766 0754              ;
  901. 00767 0754 48                  pha
  902. 00768 0755 a9 08               lda #8                ;floppy is device #8
  903. 00769 0757 20 9f 09            jsr listn             ;tell floppy to receive
  904. 00770 075a a9 6f               lda #15+$60
  905. 00771 075c 20 af 09            jsr secnd             ;on command channel
  906. 00772 075f              ;
  907. 00773 073f 68                  pla
  908. 00774 0760 a6 96               ldx status            ;error?
  909. 00775 0762 10 06               bpl disk15            ;no... ok
  910. 00776 0764              ;
  911. 00777 0764 4c c6 08     disk5  jmp error5            ;device not present
  912. 00778 0767              ;
  913. 00779 0767 20 71 09     disk10 jsr basin             ;get a character
  914. 00780 076a c9 od        disk15 cmp #$d               ;see if end
  915. 00791 076c 08                  php                   ;save for later
  916. 00792 0760 20 bf 09            jsr ciout             ;out to floppy
  917. 00783 0770 28                  plp                   ;end?
  918. 00784 0771 d0 f4               bne disk10            ;no,..continue
  919. 00785 0773              ;
  920. 00786 0773 4c cf 09            jmp unlsn             ;yes... floppy done
  921. 00797 0776              ;
  922. 00788 0776 20 53 05     disk20 jsr crlf
  923. 00799 0779 a9 06               lda #8                ;floppy is device #8
  924. 00790 077b 20 dd 09            jsr talk              ;tell floppy to speak
  925. 00791 077e a9 6f               lda #15+$60
  926. 00792 0780 20 ed 09            jsr tksa              ;from error channel
  927. 00793 0783              ;
  928. 00794 0783 a5 96               lda status            ;an error?
  929. 00795 0785 30 dd               bmi disk5             ;yes...
  930. 00796 0787              ;
  931. 00797 0787 20 fd 09     disk25 jsr acptr             ;get a character
  932. 00798 076a c9 od               cmp #$d               ;see if end
  933. 00799 07ec 09                  php                   ;test later
  934. 00800 0780 20 81 09            jsr bsout             ;out to screen
  935. 00801 0790 28                  plp                   ;end?
  936. 00802 0791 00 f4               bne disk25            ;n0 ..
  937. 00803 0793 4c od oa            jmp untlk             ;yes,. flopbpy done
  938.  
  939.  
  940. load function......page 0020
  941.  
  942. line# loc  code         line
  943.  
  944. 00805 0796              ;**********************************
  945. 00806 0796              ;* load ram function              *
  946. 00807 0796              ;*                                *
  947. 00808 0796              ;* loads from cassette 1 or 2, or *
  948. 00809 0796              ;* ieee bus devices >=4 to 31 as  *
  949. 00810 0796              ;* determined by contents of      *
  950. 00811 0796              ;* variable fa. verify flag in .a *
  951. 00812 0796              ;* high load return in x,y.       *
  952. 00813 0796              ;* .a=0 performs load,<> is verify*
  953. 00814 0796              ;*                                *
  954. 00815 0796              ;**********************************
  955.  
  956. 00817 0796              load
  957. 00818 0796 a9 00               lda #0
  958. 00819 0799 95 96               sta status
  959. 00820 079a              ;
  960. 00821 079a a5 d4               lda fa                ;check device number
  961. 00822 079c c9 04               cmp #4
  962. 00823 079e bo 03               bcs ld20
  963. 00824 07a0              ;
  964. 00825 07a0 4c 02 08     ld10   jmp error9            ;bad device #
  965. 00826 07a3              ;
  966. 00827 07a3              ld20
  967. 00828 07a3              ;
  968. 00829 07a3              ;load from cbm ieee device
  969. 00830 07a3              ;
  970. 00831 07a3 a9 60               lda #$60              ;special load command
  971. 00832 07a5 85 d3               sta sa
  972. 00833 07a7              ;
  973. 00834 07a7 a4 d1               ldy fnlen             ;must have i@ile name
  974. 00835 07a9 do 03               bne ld25              ;yes...ok
  975. 00836 07ab              ;
  976. 00837 07ab 4c cf 09            jmp error8            ;missing file name
  977. 00838 07ae              ;
  978. 00839 07ae 20 od 08     ld25   jsr luking            ;tell user looking
  979. 00840 07b1 20 1b oa            jsr openi             ;open the file
  980. 00841 07b4              ;
  981. 00842 07b4 a5 04               lda fa
  982. 00843 07b6 20 dd 09            jsr talk              ;establish the channel
  983. 00844 07b9 a5 03               lda sa
  984. 00845 07bb 20 ed 09            jsr tksa              ;tell it to load
  985. 00846 07be              ;
  986. 00847 07be 20 fd 09            jsr acptr             ;get first byte
  987. 00849 07c1 85 oe               sta eal
  988. 00849 07c3 85 oa               sta stal
  989. 00850 07c5              ;
  990. 00851 07c5 a5 96               lda status            ;test status for error
  991. 00852 07c7 4a                  lsr a
  992. 00853 07c9 4a                  lsr a
  993. 00854 07c9 bo 39               bcs ld90              ;file not f0und...
  994. 00855 07c3 20 fd 09            jsr acptr
  995. 00856 07ce 85 of               sta eah
  996. 00057 07d0 85 ob               sta stah
  997.  
  998.  
  999. load function......page 0021
  1000.  
  1001. line# loc  code         line
  1002.  
  1003. 00858 0702              ;
  1004. 00859 0702 20 28 09            jsr loding            ;tell user loading
  1005. 00860 0705              ;
  1006. 00861 0705 a9 fd        ld40   lda #$fd              ;mask off timeout
  1007. 00962 0707 25 96               and status
  1008. 00863 0709 9596                sta status
  1009. 00864 07db              ;
  1010. 00865 07db 20 aa 08            jsr stop              ;stop key?
  1011. 00866 07de do 03               bne ld45              ;no...
  1012. 00867 07e0              ;
  1013. 00968 07e0 4c 78 08            jmp break             ;stop key pressed
  1014. 00069 07e3              ;
  1015. 00870 07e3 20 fd 09     ld45   jsr acptr             ;get byte off ieee
  1016. 00971 07e6 aa                  tax
  1017. 00072 07e7 a5 96               lda status            ;was there a timeout?
  1018. 00873 07e9 4a                  lsr a
  1019. 00874 07ea 4a                  lsr a
  1020. 00875 07eb bo es               bcs ld40              ;yes...try again
  1021. 00976 07ed 8a                  txa
  1022. 00877 07ee ao 00               ldy #0
  1023. 00879 07f0 91 oe               sta (eal)y
  1024. 00679 07f2 e6 oe        ld60   inc eal               ;tncrement store addr
  1025. 00090 07f4 do 02               bne ld64
  1026. 00881 07f6 e6 of               inc eah
  1027. 00892 07f8 24 96        ld64   bit status            ;eoi?
  1028. 00883 07fa 50 09               bvc ld40              ;no...continue load
  1029. 00994 07fc              ;
  1030. 00895 07fc 20 od oa            jsr untlk             ;close channel
  1031. 00986 07ff 20 oa 08            jsr clsei             ;close the file
  1032. 00887 0802 90 03               bcc ld180             ;branch always
  1033. 00888 0804              ;
  1034. 00629 0804 4c c3 08     ld90   jmp error4            ;file not found
  1035. 00090 0807              ;
  1036. 00891 0807              ;
  1037. 00892 0807 16           ld180  clc                   ;good exit
  1038. 00893 0808              ;
  1039. 00894 0808              ;set up end load address
  1040. 00895 0808              ;
  1041. 00896 0808 a6 oe               ldx eal
  1042. 00897 080a a4 0f               ldx eah
  1043. 00898 080c              ;
  1044. 00899 oboc 60           ld190  rts
  1045.  
  1046. 00901 o80d              ;suprduiine to print to console:
  1047. 00902 obod              ;
  1048. 00903 obod              ;searching [for name]
  1049. 00904 oood              ;
  1050. 00905 09od              luking
  1051. 00906 obod a0 oc               ldy #ms5-ms1          ;"searching"
  1052. 00907 ooof 20 62 09            jsr msg
  1053. 00908 0812 a5 d1               lda fnlen
  1054.  
  1055.  
  1056. load function......page 0022
  1057.  
  1058. line# loc  code         line
  1059.  
  1060. 00909 0814 fo 11               beq ld115
  1061. 00910 0816 ao 17               ldy #ms6-ms1          ;"for"
  1062. 00911 0818 20 62 09            jsr msg
  1063.  
  1064. 00913 o81b              ;subroutine to output file name
  1065. 00914 081b              ;
  1066. 00915 081b              outfn
  1067. 00916 o81b ao 00               ldy #0
  1068. 00917 081d b1 da        ld110  lda (fnadr)y
  1069. 00918 081f 20 81 09            jsr bsout
  1070. 00919 0822 c8                  iny
  1071. 00920 0823 c4 d1               cpy fnlen
  1072. 00921 0825 do f6               bne ld110
  1073. 00922 0927              ;
  1074. 00923 0927 60           ld115  rts
  1075.  
  1076. 00925 0828              ;subroutine to print:
  1077. 00926 0828              ;
  1078. 00927 0828              ;loading/verifing
  1079. 00928 0b28              ;
  1080. 00929 0828 ao 39        loding ldy #ms10-ms1         ;assume 'loading'
  1081. 00930 082a 4c 62 09     ld410  jmp spmsg
  1082.  
  1083.  
  1084.  
  1085. save function......page 0023
  1086.  
  1087. line# loc  code         line
  1088.  
  1089. 00932 082d              ;***********************************
  1090. 00933 082d              ;* save                            *
  1091. 00934 082d              ;*                                 *
  1092. 00935 082d              ;* saves to cassette 1 or 2, or    *
  1093. 00936 082d              ;* ieee devices 4>=n>=31 as select-*
  1094. 00937 082d              ;* ed by variable fa.              *
  1095. 00938 082d              ;*                                 *
  1096. 00939 082d              ;* start of save is memstr...end of*
  1097. 00940 082d              ;* save is .x,.y                   *
  1098. 00941 082d              ;***********************************
  1099.  
  1100. 00943 082d a5 d4        save   lda fa  ***monitor entry
  1101. 00944 082f c9 04               cmp #4
  1102. 00945 0831 bo 03               bcs sv20
  1103. 00946 0833              ;
  1104. 00947 0833 4c 02 08     sv10   jmp error9            ;bad device
  1105. 00948 0836              ;
  1106. 00949 0836              sv20
  1107. 00950 0836 a9 61               lda #$61
  1108. 00951 0838 85 03               sta sa
  1109. 00952 083a a4 d1               ldy fnlen
  1110. 00953 083c do 03               bne sv25
  1111. 00954 083e              ;
  1112. 00955 083e 4c cf 08            jmp error8            ;missing file name
  1113. 00956 0841              ;
  1114. 00957 0841 20 1e oa     sv25   jsr openi
  1115. 00958 0844 20 a1 08            jsr saving
  1116. 00959 0947 a5 04               lda fa
  1117. 00960 0849 20 9f 09            jsr listn
  1118. 00961 084c a5 03               lda sa
  1119. 00962 084e 20 af 09            jsr secnd
  1120. 00963 0851 ao 00               ldy #0
  1121. 00964 0853 a5 ob               lda stah
  1122. 00965 0855 85 od               sta sah
  1123. 00966 0857 a5 oa               lda stal
  1124. 00967 0959 85 oc               sta sal
  1125. 00968 0858 20 bf 09            jsr ciout
  1126. 00969 085e a5 od               lda sah
  1127. 00970 0860 20 bf 09            jsr ciout
  1128. 90971 0863 38           sv30   sec
  1129. 00972 0964 a5 oc               lda sal
  1130. 00973 0866 e5 oe               sbc eal
  1131. 00974 0668 a5 od               lda sah
  1132. 90975 086a e5 of               sbc eah
  1133. 00976 os6c do 19               bcs sv50              ;have reached end
  1134. 00977 086e b1 oc               lda (sal)y
  1135. 00978 0870 20 bf 09            jsr ciout
  1136. 30979 0873 20 aa 09            jsr stop
  1137. 00990 0b76 do 07               bne sv40
  1138. 0o9b1 0878
  1139. 30992 0878 20 sa 08     break  jsr clsei
  1140. 30983 087b a9 00               lda #0
  1141. 30984 087d 38                  sec
  1142.  
  1143.  
  1144. save function......page 0024
  1145.  
  1146. line# loc  code         line
  1147.  
  1148. 00985 087e 60                  rts
  1149. 00986 097f              ;
  1150. 009b7 097f e6 oc        sv40   inc sal
  1151. 00999 0891 do 02               bne incr
  1152. 00999 0893 e6 od               inc sah
  1153. 00990 0895              incr
  1154. 00991 0985 do dc               bne sv30
  1155. 00992 0887 20 cf 09     sv50   jsr unlsn
  1156.  
  1157. 00994 088a 24 d3        clsei  bit sa
  1158. 00995 obbc 30 11               bmi clsei2
  1159. 00996 obbe a5 d4               lda fa
  1160. 00997 0990 20 9f 09            jsr listn
  1161. 00999 0893 a5 d3               lda sa
  1162. 00999 0895 29 ef               and #$ef
  1163. 01000 0897 09 eo               ora #$eo
  1164. 01001 0999 20 af 09            jsr secnd
  1165. 01002 os9c 20 cf 09            jsr unlsn
  1166. 01003 089f              ;
  1167. 01004 089f 18           clsei2 clc
  1168. 01005 obao 60                  rts
  1169.  
  1170. 01oo8 08a1              ;subroutine to output:
  1171. 01009 08a1              ;'saving <file name>'
  1172. 01010 08a1              ;
  1173. 01011 oba1              saving
  1174. 01012 08a1              ;
  1175. 01013 08a1 ao 41               ldy #ms11-ms1         ;'saving'
  1176. 01014 08a3 20 62 09            jsr msg
  1177. 01015 08a6 20 1b 08            jsr outfn             ;<file name>
  1178. 31016 08a9              ;
  1179. 31017 09a9 60           sav100 rts
  1180.  
  1181.  
  1182. error handler......page 0025
  1183.  
  1184. line# loc  code         line
  1185.  
  1186. 01019 obaa              ;***************************************
  1187. 01020 obaa              ;* stop -- check stop key flag and     *
  1188. 01021 obaa              ;* return z flag set if flag true.     *
  1189. 01022 obaa              ;* also closes active channels and     *
  1190. 01023 obaa              ;* flushes keybdard queue.             *
  1191. 01024 obaa              ;* also returns key downs from last    *
  1192. 01025 obaa              ;* keyboard row in .a.                 *
  1193. 01026 obaa              ;***************************************
  1194. 01027 obaa a5 9b        stop   lda stkey             ;value of last row
  1195. 01028 obac c9 ef               cmp #$ef              ;check siop key position
  1196. 01029 obae 00 09               bne stop2             ;not down
  1197. 01030 obbo ob                  php
  1198. 01031 obb1 20 91 09            jsr clrch             ;clear channels
  1199. 01032 09b4 a9 00               lda #0
  1200. 01033 0606 85 9e               sta ndx               ;flush gueue
  1201. 01034 obdb 29                  plp
  1202. 01035 0889 60           stop2  rts
  1203.  
  1204. 01037 08ba              ;***********************************
  1205. 01038 o8ba              ;*                                 *
  1206. 01039 o8ba              ;* error handler                   *
  1207. 01040 o8ba              ;*                                 *
  1208. 01041 obba              ;* with error # in a and carry.    *
  1209. 01042 obba              ;*                                 *
  1210. 01043 obba              ;***********************************
  1211. 01044 osba              ;
  1212. 01045 088a a9 01        error1 lda #1                ;too many files
  1213. 01046 obbc 2c                  .byt $2c
  1214. 01047 obbd a9 02        error2 lda #2                ;file open
  1215. 01048 obbf 2c                  .byt $2c
  1216. 01049 osco a9 03        error3 lda #3                ;file not open
  1217. 01050 08c2 2c                  .byt $2c
  1218. 01051 08c3 a9 04        error4 lda #4                ;file not found
  1219. 01052 08c5 2c                  .byt $2c
  1220. 01053 08c6 a9 05        error5 lda #5                ;device not present
  1221. 01054 oscb 2c                  .byt $2c
  1222. 01055 08c9 a9 06        error6 lda #6                ;not input file
  1223. 01056 oscb 2c                  .byt $2c
  1224. 01057 0Ecc a9 07        error7 lda #7                ;not output file
  1225. 01058 osce 2c                  .byt $2c
  1226. 01059 obcf a9 08        errors lda #8                ;missing file name
  1227. 91060 0Ed1 2c                  .byt $2c
  1228. 01061 09d2 a9 09        error9 lda #9                ;bad device #
  1229. 01062 0Ed4              ;
  1230. 01063 08d4 48                  pha                   ;error number on stack
  1231. 01064 09d5 20 91 09            jsr  clrch            ;restore i/0 channels
  1232. 01065 obdb              ;
  1233. 01066 obdb ao 00               ldy  #ms1-ms1
  1234. 01067 obda              ;
  1235. 01068 obda 20 62 09            jsr  msg              ;print "cbm i/0 error #"
  1236. 01069 osdd 66                  pla
  1237.  
  1238.  
  1239. error handler......page 0026
  1240.  
  1241. line* loc  code         line
  1242.  
  1243. 01070 obde 48                  pha
  1244. 01071 obuf 09 30               ora #$30              ;make error ascii
  1245. 01072 obei 20 81 09            jsr bsout             ;print it
  1246. 01073 obe4              ;
  1247. 01074 obe4 68           erexit pla
  1248. 01075 obe5 39                  sec
  1249. 01076 obe6 60                  rts
  1250.  
  1251.  
  1252. messages......page 0027
  1253.  
  1254. line# loc  code         line
  1255.  
  1256. 01079 obe7 od           ms1    .byt $d,'i/o error ',$a3
  1257. 01078 obes 49 2f
  1258. 01078 08f2 a3
  1259. 01079 08f3 od           ms5    .byt $d,'searching',$ao
  1260. 01079 08f4 53 45
  1261. 01079 o8fd ao
  1262. 01080 obfe 46 4f 52     ms6    .byt 'for',$ao
  1263. 01080 0901 ag
  1264. 01081 0902 od           ms7    .byt $d,'press play',$ao
  1265. 01091 0903 50 52
  1266. 01091 0900 ag
  1267. 01082 090e 26 20        ms8    .byt '& record',$ao
  1268. 01082 0916 ao
  1269. 01083 0917 4f 4e        ms9    .byt 'on tape ',$a3
  1270. 01083 091f a3
  1271. 01084 0920 od           ms10   .byt $d,'loadin',$c7
  1272. 01084 0921 4c 4f
  1273. 01094 0927 c7
  1274. 01095 0928 od           ms11   .byt $d,'saving',$ao
  1275. 010b5 0929 53 41
  1276. 01065 092f ao
  1277. 01096 0930 od           ms21   .byt $d,'verifyin',$c7
  1278. 01096 0931 56 45
  1279. 01096 0939 c7
  1280. 01087 093a od           ms17   .byt $d,'found",$a0
  1281. 01087 093b 46 4f
  1282. 01097 0940 ao
  1283. 010b8 0941 od           ms18   .byt $d,'ok',$8d
  1284. 01099 0942 4f 4b
  1285. 01099 0944 sd
  1286. 01089 0945 od           ms34   .byt $d,'***cbm monitor 1.0***',$8d
  1287. 31089 0946 2a 2a
  1288. 21089 095b sd
  1289. 01090 095C od           ms36   .byt $d,'brea",$cb
  1290. 31090 0950 42 52
  1291. 21090 0961 cb
  1292.  
  1293. 01092 0962              ;print message to screen only if
  1294. 01093 0962              ;output enabled
  1295. 01094 0962              ;
  1296. 01095 0962              spmsg
  1297. 01096 0962 59 e7 08     msg    lda ms1,y
  1298. 01097 0965 08                  php
  1299. 01098 0966 29 7f               and #$7f
  1300. 01099 0968 20 91 09            jsr bsout
  1301. 01100 096b cb                  iny
  1302. 01101 096c 28                  plp
  1303. 01102 0960 10 f3               bpl msg
  1304. 01103 096f 18           msg10  clc
  1305. 01104 0970 60                  rts
  1306.  
  1307.  
  1308. messages......page 0028
  1309.  
  1310. line# loc  code         line
  1311.  
  1312. 01106 0971              ;
  1313. 01107 0971              basin
  1314. 01109 0971 a9 00               lda #0
  1315. 01109 0973 bd fo ff            sta $fff0
  1316. 01110 0976 20 cf ff            jsr $ffcf
  1317. 01111 0979 48                  pha
  1318. 01112 097a a5 09               lda memmap
  1319. 01113 097c bd fo pf            sta $fff0
  1320. 01114 097f 6b                  pla
  1321. 01115 0980 60                  rts
  1322.  
  1323. 01117 0981              bsout
  1324. 01110 0961 48                  pha
  1325. 01119 09b2 a9 00               lda #0
  1326. 01120 0984 50 fo ff            sta $fff0
  1327. 01121 0987 60                  pla
  1328. 01122 0999 20 d2 ff            jsr $ffd2
  1329. 01123 099b a5 09               lda memmap
  1330. 01124 0980 50 fo ff            sta $fff0
  1331. 01125 0990 60                  rts
  1332.  
  1333. 01127 0991 a9 00        clrch  lda #0
  1334. 01128 0993 sd fo ff            sta $fff0
  1335. 01129 0996 20 a6 f2            jsr rclrch
  1336. 01130 0999 a5 09               lda memmap
  1337. 01131 099b gd fo ff            sta $fff0
  1338. 01132 099e 60                  rts
  1339.  
  1340. 01134 099f 95 d4        listn  sta fa
  1341. 01135 09a1 a9 00               lda #0
  1342. 01136 09a3 00 fo ff            sta $fff0
  1343. 01137 09a6 20 d5 fo            jsr rlistn
  1344. 01138 09a9 a5 09               lda memmap
  1345. 01139 09a0 50 fo ff            sta $fff0
  1346. 01140 09ae 60                  rts
  1347.  
  1348. 01142 09af 49           secnd  pha
  1349. 01143 09b0 a9 00               lda #0
  1350. 01144 09b2 bd fo ff            sta $fff0
  1351.  
  1352.  
  1353. messages......page 0029
  1354.  
  1355. line# loc  code         line
  1356.  
  1357. 01145 09b5 68                  pla
  1358. 01146 09b6 20 43 fL            jsr rsecnd
  1359. 01147 09b9 a5 09               lda memmap
  1360. 01148 09bb bd fo ff            sta $fff0
  1361. 01149 09be 60                  rts
  1362.  
  1363. 01151 099f 48           ciout  pha
  1364. 01152 09c0 a9 00               lda #0
  1365. 01153 09c2 bd fo ff            sta $fff0
  1366. 01154 09c5 68                  pla
  1367. 01155 09c6 20 9e fL            jsr rciout
  1368. 01156 09c9 a5 09               lda memmap
  1369. 01157 09c8 bd fo ff            sta $fff0
  1370. 0115b 09ce 60                  rts
  1371.  
  1372. 01160 09cf              unlsn
  1373. 01161 09cf a9 00               lda #0
  1374. 01162 0901 bd fo ff            sta $fff0
  1375. 01163 09d4 20 b9 fL            jsr runlsn
  1376. 01164 09d7 a5 09               lda memmap
  1377. 01165 09d9 od fo ff            sta $fff0
  1378. 01166 09dc 60                  rts
  1379.  
  1380. 01168 09dd 85 d4        talk   sta fa
  1381. 01169 09df a9 00               lda #0
  1382. 01170 09e1 bd fo ff            sta $fff0
  1383. 31171 09e4 20 d2 fo            jsr rtalk
  1384. 11172 09e7 a5 09               lda memmap
  1385. 01173 09e9 bd fo ff            sta $fff0
  1386. 31174 09ec 60                  rts
  1387.  
  1388. 01176 09ed 48           tksa   pha
  1389. 01177 09ee a9 00               lda #0
  1390. 01178 09f0 00 fo ff            sta $fff0
  1391. 31179 09f3 68                  pla
  1392. 01180 09f4 20 93 fL            jsr rtksa
  1393. 01181 09f7 a5 09               lda memmap
  1394. 01182 09f9 00 fo ff            sta $fff0
  1395. 31183 09fc 60                  rts
  1396.  
  1397.  
  1398. messages......page 0030
  1399.  
  1400. line# loc  code         line
  1401.  
  1402. 01185 09fd              acptr
  1403. 01186 09fd a9 00               lda #0
  1404. 01187 09ff 50 fo ff            sta $fff0
  1405. 01188 0a02 20 co fL            jsr racptr
  1406. 01189 0a05 48                  pha
  1407. 01190 0a06 a5 09               lda memmap
  1408. 01191 oaob bd fo ff            sta $fff0
  1409. 01192 oaob 68                  pla
  1410. 01193 oaoc 60                  rts
  1411.  
  1412. 01195 oaod              untlk
  1413. 01196 gaod a9 00               lda #0
  1414. 01197 oaof bd fo ff            sta $fff0
  1415. 01198 0a12 20 ae fL            jsr runtlk
  1416. 01199 0a15 a5 09               lda memmap
  1417. 01200 0a17 bd fo ff            sta $fff0
  1418. 01201 oaia 60                  rts
  1419.  
  1420. 01203 oaib 48           openi  pha
  1421. 01204 oaic a9 00               lda #0
  1422. 01205 oaie bd fo ff            sta $fff0
  1423. 01206 0a21 68                  pla
  1424. 01207 0a22 20 a5 f4            jsr ropeni
  1425. 01208 0a25 a5 09               lda memmap
  1426. 01209 0a27 bd fo ff            sta $fff0
  1427. 01210 0a2a 60                  rts
  1428. 01211 0a2b                     .end
  1429.  
  1430. errors = 00000
  1431.  
  1432. symbol table
  1433.  
  1434. symbol value
  1435.  a4        0616    a5        0618    a6        0627    a9        062b
  1436.  acc       0003    acptr     09fd    altm      060f    altr      05f5
  1437.  altrit    0545    asc1      06f4    ascii     06ed    b1        0492
  1438.  b3        0498    b5        04a4    bad       0100    basin     0971
  1439.  beqs1     05f1    break     0878    bsout     0981    buf       0200
  1440.  cbinv     0092    cinv      0090    ciout     09bf    clrch     0991
  1441.  clsei     088a    clsei2    089f    cmdend    0531    cmds      0516
  1442.  cr        0ood    crlf      0553    d2        0575    disk      074b
  1443.  disk1o    0767    disk15    076a    disk20    0776    disk25    0787
  1444.  disk5     0764    dm        0599    dm1       059d    dm2       05af
  1445.  dsp1      05cc    dsp10     05c9    dsplym    05b4    dsplyr    0573
  1446.  
  1447. symbol table
  1448.  
  1449. symbol value
  1450.  eah       ooof    eal       oooe    erexit    08e4    errl      065b
  1451.  erropr    04ad    error1    o8ba    error2    08b0    error3    o8co
  1452.  error4    08c3    error5    08c6    error6    08c9    error7    08cc
  1453.  error8    o8cf    error9    o8d2    errs1     05f2    fa        0004
  1454.  flgs      0002    fnadr     ooda    fnlen     00d1    g1        063f
  1455.  g2        064d    go        0632    hex09     0744    hexit     073a
  1456.  incr      0885    init      040f    invh      0007    invl      0008
  1457.  irq       0440    l1        0663    l12       06a4    l13       06b3
  1458.  l14       06ce    l15       06d9    l2        066e    l20       06c5
  1459.  l3        0670    l4        0680    l5        0684    l8        068d
  1460.  l9        0694    ld        065e    ld10      07a0    ld110     081d
  1461.  ld115     0b27    ld180     0807    ld190     080c    ld20      07a3
  1462.  ld25      07ae    ld40      07d5    ld410     082a    ld45      07e3
  1463.  ld60      07f2    ld64      07f8    ld90      0804    listn     099f
  1464.  load      0796    loding    0828    luking    o8od    mapper    062c
  1465.  memmap    0009    ms1       o8e7    ms10      0920    ms11      0928
  1466.  ms17      093a    ms18      0941    ms21      0930    ms34      0945
  1467.  ms36      095c    ms5       o8f3    ms6       08fe    ms7       0902
  1468.  ms8       090e    ms9       0917    msg       0962    msg10     096f
  1469.  ndx       009e    nmi       0459    openi     0a1b    outfn     081b
  1470.  outqst    0550    pch       0000    pcl       0001    prend     0655
  1471.  putp      0531    racptr    f1c0    rciout    f19e    rclrch    f2a6
  1472.  rdoa      0709    rdoa2     0715    rdob      0716    rdob4     0739
  1473.  rdoc      0745    regk      0558    rlistn    f0d5    ropeni    f4a5
  1474.  rsecnd    f143    rtalk     f0d2    rtip      0472    rtksa     f193
  1475.  runlsn    f1b9    runtlk    f1ae    s0        04c4    s1        04d2
  1476.  s2        04e6    s3        04ef    s4        0500    s6        0515
  1477.  sa        00d3    sah       oood    sal       000c    savioo    08a9
  1478.  save      082d    saving    08a1    savx      0015    secnd     09af
  1479.  setirq    042b    setr      053a    sp        0006    space     054d
  1480.  spmsg     0962    st1       04bd    stah      ooob    stal      000a
  1481.  status    0096    stkey     009b    stop      o8aa    stop2     08b9
  1482.  strtm1    04b1    sv10      0833    sv20      0836    sv25      0841
  1483.  sv30      0863    sv40      087f    sv50      0887    sys       009e
  1484.  t2t2      06f9    t2t21     06fb    talk      09dd    timb      0488
  1485.  timc      047a    tksa      09ed    tmp0      0010    tmp2      0012
  1486.  tmpa      0017    tmpc      0014    tmpps     0018    unlsn     09cf
  1487.  untlk     0a0d    wrap      0016    wroa      06dc    wrob      06e1
  1488.  xr        0004    yr        0005
  1489. end of assembly
  1490.  
  1491.  
  1492.