Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

200 linhas
4.9KB

  1. ; E02-S04: diagnostics and ERR-writer test in x128.
  2. ;
  3. ; Phase A DIAG.N8 six representative diagnostics on a cleared screen
  4. ; Phase D BAD*.N8 ERR name the drive refuses: report, screen-only notice,
  5. ; second report on screen only
  6. ; Phase B LIMIT.N8 25 errors, screen off: 20 reported, then the limit
  7. ; Phase C CLEAN.N8 no errors: the stale CLEAN.ERR is scratched, none made
  8. ; Results (address in MB_DATA+0/1):
  9. ; +0 A count +1 D count +2 D file state +3 B count +4 C count
  10. ; +5..+8 LDTND after A, D, B, C
  11. ; +9..+33 carry returned by each of B's 25 diag_report calls
  12. ; Mailbox PASS means the program ran to the end; the host checks the rest.
  13. .setcpu "6502"
  14. .include "../../src/common/c128.inc"
  15. .include "../../src/common/mailbox.inc"
  16. .include "../../src/common/errors.inc"
  17. .import mmu_init, mmu_bank0, mmu_shutdown, kcall_inline
  18. .import diag_init, diag_report, diag_finish, diag_line, diag_col
  19. .import diag_arg1, diag_arg1_len, diag_arg2, diag_arg2_len
  20. .import diag_screen, diag_file_state
  21. .import __COMPILER_ZP_PAGE__
  22. .segment "LOADADDR"
  23. .word $1C01
  24. .segment "EXEHDR"
  25. .word basic_end
  26. .word 10
  27. .byte $9E
  28. .byte "7181"
  29. .byte $00
  30. basic_end:
  31. .word $0000
  32. .segment "MAILBOX"
  33. .res MB_SIZE
  34. .macro REPORT line, col, code
  35. lda #<(line)
  36. sta diag_line
  37. lda #>(line)
  38. sta diag_line+1
  39. lda #col
  40. sta diag_col
  41. lda #code
  42. jsr diag_report
  43. .endmacro
  44. .macro ARG1 text, len
  45. lda #<text
  46. sta diag_arg1
  47. lda #>text
  48. sta diag_arg1+1
  49. lda #len
  50. sta diag_arg1_len
  51. .endmacro
  52. .macro ARG2 text, len
  53. lda #<text
  54. sta diag_arg2
  55. lda #>text
  56. sta diag_arg2+1
  57. lda #len
  58. sta diag_arg2_len
  59. .endmacro
  60. .macro INIT name, len
  61. lda #<name
  62. ldx #>name
  63. ldy #len
  64. jsr diag_init
  65. .endmacro
  66. .segment "STARTUP"
  67. .export test_entry, results
  68. test_entry:
  69. php
  70. sei
  71. ldx #MB_SIZE - 1
  72. lda #$00
  73. @clr: sta MB_BASE,x
  74. dex
  75. bpl @clr
  76. lda #MB_MAGIC0_VALUE
  77. sta MB_MAGIC0
  78. lda #MB_MAGIC1_VALUE
  79. sta MB_MAGIC1
  80. lda #MB_PROD_PLATFORM
  81. sta MB_PRODUCER
  82. lda #MB_ST_RUNNING
  83. sta MB_STATUS
  84. jsr mmu_init
  85. jsr mmu_bank0
  86. lda #$93 ; clear screen: the host reads it back
  87. jsr kcall_inline
  88. .word CHROUT
  89. ; ------------------------------------------------------ phase A
  90. INIT n_diag, 7
  91. REPORT 3, 11, E_LEX_BAD_CHAR_LITERAL
  92. REPORT 599, 80, E_SYN_EXPECTED_END_PROGRAM
  93. ARG1 a_counter, 7
  94. REPORT 12, 5, E_SEM_DUPLICATE_NAME
  95. ARG1 a_integer, 7
  96. ARG2 a_long, 16
  97. REPORT 40, 17, E_TYP_MISMATCH
  98. ARG1 a_dos, 2
  99. REPORT 1, 1, E_DSK_SOURCE_UNREADABLE
  100. REPORT 65535, 255, E_SYN_EXPECTED_RPAREN
  101. jsr diag_finish
  102. sta results+0
  103. jsr open_files
  104. sta results+5
  105. ; ------------------------------------------------------ phase D
  106. INIT n_bad, 7
  107. REPORT 7, 3, E_LEX_INVALID_CHAR
  108. REPORT 8, 4, E_LEX_INVALID_CHAR
  109. lda diag_file_state
  110. sta results+2
  111. jsr diag_finish
  112. sta results+1
  113. jsr open_files
  114. sta results+6
  115. ; ------------------------------------------------------ phase B
  116. INIT n_limit, 8
  117. lda #$00
  118. sta diag_screen
  119. ldx #$00
  120. @limit: stx b_index
  121. inx ; line = 1..25
  122. stx diag_line
  123. lda #$00
  124. sta diag_line+1
  125. lda #1
  126. sta diag_col
  127. lda #E_LEX_INVALID_CHAR
  128. jsr diag_report
  129. lda #$00
  130. rol a ; carry -> 0/1
  131. ldx b_index
  132. sta results+9,x
  133. inx
  134. cpx #25
  135. bne @limit
  136. jsr diag_finish
  137. sta results+3
  138. jsr open_files
  139. sta results+7
  140. ; ------------------------------------------------------ phase C
  141. INIT n_clean, 8
  142. jsr diag_finish
  143. sta results+4
  144. jsr open_files
  145. sta results+8
  146. jsr mmu_shutdown
  147. lda #<results
  148. sta MB_DATA+0
  149. lda #>results
  150. sta MB_DATA+1
  151. lda #MB_ST_PASS
  152. sta MB_STATUS
  153. plp
  154. ldy #$00
  155. @print: lda ok_msg,y
  156. beq @end
  157. sty b_index
  158. jsr CHROUT
  159. ldy b_index
  160. iny
  161. bne @print
  162. @end: rts
  163. .segment "CODE"
  164. ; A = number of open logical files (system zero page via the P0 swap).
  165. open_files:
  166. lda __COMPILER_ZP_PAGE__ * 256 + LDTND
  167. rts
  168. .segment "RODATA"
  169. n_diag: .byte "DIAG.N8"
  170. n_bad: .byte "BAD*.N8"
  171. n_limit: .byte "LIMIT.N8"
  172. n_clean: .byte "CLEAN.N8"
  173. a_counter: .byte "COUNTER"
  174. a_integer: .byte "INTEGER"
  175. a_long: .byte "VERYLONGCLASSNAM"
  176. a_dos: .byte "62"
  177. ok_msg: .byte "NOVA128 DIAG TEST OK", $0D, $00
  178. .segment "BSS"
  179. results: .res 34
  180. b_index: .res 1

Powered by TurnKey Linux.