mirror of
https://github.com/koute/pinky.git
synced 2025-04-02 10:31:50 -04:00
102 lines
2 KiB
Text
102 lines
2 KiB
Text
|
|
result = $f8
|
|
|
|
default_test_name:
|
|
.db 0
|
|
.default test_name = default_test_name
|
|
|
|
; Report error if last result was non-zero
|
|
error_if_ne:
|
|
bne report_final_result_
|
|
rts
|
|
; Report error if last result was zero
|
|
error_if_eq:
|
|
beq report_final_result_
|
|
rts
|
|
; Report passing result
|
|
tests_passed:
|
|
lda #1
|
|
sta result
|
|
; Report final result code and wait forever
|
|
report_final_result:
|
|
report_final_result_:
|
|
sei ; disable interrupts
|
|
lda #0
|
|
sta $2000
|
|
jsr init_runtime
|
|
|
|
lda test_name
|
|
beq no_name
|
|
jsr debug_char
|
|
ldx #1
|
|
: lda test_name,x
|
|
beq no_name
|
|
jsr debug_char_no_wait
|
|
inx
|
|
jmp -
|
|
|
|
no_name:
|
|
jsr debug_newline
|
|
|
|
lda result
|
|
cmp #1
|
|
beq test_passed
|
|
|
|
lda #'F'
|
|
jsr debug_char
|
|
lda #'A'
|
|
jsr debug_char_no_wait
|
|
lda #'I'
|
|
jsr debug_char_no_wait
|
|
lda #'L'
|
|
jsr debug_char_no_wait
|
|
lda #'E'
|
|
jsr debug_char_no_wait
|
|
lda #'D'
|
|
jsr debug_char_no_wait
|
|
lda #32 ; ' '
|
|
jsr debug_char_no_wait
|
|
lda #'#'
|
|
jsr debug_char_no_wait
|
|
|
|
lda result
|
|
cmp #10
|
|
bcc +
|
|
clc
|
|
adc #-10
|
|
pha
|
|
lda #'1'
|
|
jsr debug_char_no_wait
|
|
pla
|
|
: clc
|
|
adc #'0'
|
|
jsr debug_char_no_wait
|
|
report_beeps:
|
|
lda result
|
|
jsr debug_beeps
|
|
jmp forever
|
|
|
|
test_passed:
|
|
lda #'P'
|
|
jsr debug_char
|
|
lda #'A'
|
|
jsr debug_char_no_wait
|
|
lda #'S'
|
|
jsr debug_char_no_wait
|
|
lda #'S'
|
|
jsr debug_char_no_wait
|
|
lda #'E'
|
|
jsr debug_char_no_wait
|
|
lda #'D'
|
|
jsr debug_char_no_wait
|
|
jmp report_beeps
|
|
.code
|
|
|
|
.default nmi = default_nmi
|
|
.default irq = default_irq
|
|
.code
|
|
default_irq:
|
|
bit $4015
|
|
default_nmi:
|
|
rti
|
|
|