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.

init 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. .PAG 'INIT'
  2. ;RAM & ROM TEST, I/O-DATA INIT
  3. .SKI 3
  4. * = $E040+$141
  5. F7 =$38 ;FAIL STATES
  6. F6 =F7-8
  7. F5 =F6-8
  8. F4 =F5-8
  9. F3 =F4-8
  10. F2 =F3-8
  11. F1 =F2-8
  12. DROMTS LDX #0 ;TEST FOR DROM
  13. LDA #$55 ; TEST FOR $55
  14. DRT05 CMP $D000
  15. BNE DRT10
  16. DEX
  17. BNE DRT05
  18. DRT10 RTS
  19. .SKIP
  20. ; RESET ENTRY ON POWER ON
  21. INIT CLD
  22. SEI
  23. LDX #$FF
  24. TXS
  25. STX IEEEDO ;FREE DATA LINES
  26. STX PBDD1
  27. LDA #DAVO+EOIO+RFDO
  28. STA PAD2 ;FREE CONTROL LINES
  29. LDA #%00011111
  30. STA PADD2 ;THEN SET DDR
  31. LDA #ERRLED+ACTLDB+ACTLDA
  32. STA PBD2
  33. ;LDA #%00111000
  34. STA PBDD2
  35. .SKIP
  36. ;ZERO PAGE TEST
  37. ZPTST LDX #0
  38. TXA
  39. ZPT10 LDY #$55 ;ALTERNATING BITS
  40. STY 0,X
  41. DEX
  42. BNE ZPT10
  43. TAX
  44. ZPT20 LDA #$AA
  45. ASL 0,X
  46. EOR 0,X
  47. STA 0,X
  48. BNE ZPBAD
  49. .SKIP
  50. DEX
  51. BNE ZPT20
  52. .SKIP
  53. JSR DROMTS
  54. BNE EROMCK ;NOT HERE, GOTO E-ROM TEST
  55. JMP $D005 ;DIAGNOSTICS HOOK
  56. .SKIP
  57. ROMTST ;ROM CHECK SUBROUTINE
  58. ;SET IP AS INDIR. PNTR
  59. LDX #16 ;CHECKSUM RETURNED IN .A
  60. LDY #0
  61. TYA
  62. CLC
  63. .SKI
  64. ROMT10 ADC (IP)Y
  65. INY
  66. BNE ROMT10
  67. .SKIP
  68. DEX
  69. BEQ ROMT20
  70. .SKIP
  71. INC IP+1
  72. BNE ROMT10
  73. .SKIP
  74. ROMT20 RTS
  75. ZPBAD LDA #$FF
  76. STA 0,X
  77. BNE ZPBAD
  78. .SKIP
  79. ;E-ROM CHECK
  80. EROMCK LDA #F6
  81. STA PBD2
  82. LDA #$E0 ;E-ROM
  83. STA IP+1
  84. LDA #0
  85. STA IP
  86. JSR ROMTST
  87. .SKI
  88. CMP #0
  89. BEQ FROMCK ;OK, GOTO F-ROM TEST
  90. .SKIP
  91. BADE
  92. STA $E000
  93. JMP BADE
  94. .SKIP
  95. ;F-ROM CHECK
  96. FROMCK LDA #F5
  97. STA PBD2
  98. LDA #$F0
  99. STA IP+1
  100. JSR ROMTST
  101. CMP #0
  102. BEQ DIAGOK ;OK, GOTO 4K TEST
  103. .SKIP
  104. BADF
  105. STA $F000
  106. JMP BADF
  107. .SKIP
  108. DIAGOK LDA #0
  109. STA PBD2
  110. LDA PBD2 ;COMPUTE PRIMARY ADDR
  111. AND #7
  112. ORA #$48 ;TALK ADDRESS
  113. STA TLKADR
  114. EOR #$60 ;LISTEN ADDRESS
  115. STA LSNADR
  116. ;INIT COMMAND CHANNEL
  117. LDA #TALKER+LISNER
  118. STA CHNRDY+CMDCHN
  119. LDA #'0
  120. STA CHNDAT+CMDCHN
  121. DSKINT JSR INTTAB
  122. LDA #$FF
  123. LDX #33
  124. DSKIN1 STA LINTAB,X
  125. DEX
  126. BPL DSKIN1
  127. LDA #CMDRD
  128. STA LINTAB+30
  129. LDA #CMDWRT
  130. STA LINTAB+31
  131. LDA #$3F ;LINDX 0 TO 5 FREE
  132. STA LINUSE
  133. .SKIP
  134. LDA #$0F
  135. STA BUFNUM+12
  136. LDA #$10
  137. STA BUFNUM+14
  138. LDA #$FF
  139. STA BUFNUM+13
  140. STA BUFNUM+15
  141. LDA #$88
  142. STA CHNRDY+CMDRD
  143. LDA #$01
  144. STA CHNRDY+CMDWRT
  145. LDA #0
  146. STA BUFUSE
  147. LDA #$E0
  148. STA BUFUSE+1
  149. JSR USRINT ;INIT USER JMP
  150. LDA #10 ;SET UP SECTOR OFFSET
  151. STA SECINC
  152. .SKIP
  153. ;ALLOW ATN TO INTERRUPT
  154. STA ATNPE
  155. .SKIP3
  156. ; IDLE LOOP, WAITING FOR SOMETHING TO DO
  157. IDLE LDA CMDWAT ; TEST FOR PENDING COMMAND
  158. BEQ IDLE2 ; NO COMMAND WAITING
  159. LDA #0
  160. STA CMDWAT
  161. SEI
  162. JSR PARSXQ ; PARSE AND XEQ COMMAND
  163. IDLE2 CLI ;TEST FOR DRIVE RUNNING OR OPENFILE
  164. LDA #29
  165. STA TEMP+3
  166. LDA #0 ;IF FILE OPEN, TURN ON ACT LED
  167. STA TEMP
  168. STA TEMP+1
  169. FILO1 LDX TEMP+3 ;LOOK THRU LINTAB
  170. LDA LINTAB,X ;FOR ACTIVE FILE
  171. CMP #$FF
  172. BEQ FILO2
  173. STA LINDX
  174. JSR GETACT
  175. TAX
  176. LDA LSTJOB,X ;DETERMINE WHICH DRV IT IS ON
  177. AND #1
  178. TAX
  179. INC TEMP,X
  180. FILO2 DEC TEMP+3 ;SET FLAG INDICATING DRV
  181. BPL FILO1 ;HAS FILE OPEN
  182. TSTFIL LDY #14 ;LOOK THRU JOB QUE FOR
  183. FIL5 LDA JOBS,Y ; FOR JOBS STILL RUNNING
  184. BPL FIL6
  185. AND #1
  186. TAX
  187. INC TEMP,X ;SET FLAG INDICATING DRIVE
  188. FIL6 DEY ;IS ACTIVE
  189. BPL FIL5
  190. LDA PBD2
  191. AND #255-ACTLDA-ACTLDB
  192. STA PBD2
  193. LDA TEMP
  194. BEQ FILO3
  195. LDA PBD2 ;TURN ON LED IF DRIVE FLAG
  196. ORA #ACTLDB ; IF NOT 0
  197. STA PBD2
  198. FILO3 LDA TEMP+1
  199. BEQ FILO4
  200. LDA PBD2
  201. ORA #ACTLDA
  202. STA PBD2
  203. FILO4 JMP IDLE2 ;BACK TO TOP OF LOP
  204. .END