.include "common.a" .include "testing.a" jmp_6ff: .byte $6C ; JMP ($6FF) (to avoid warning) .word $6FF main: set_test 3,"JMP ($6FF) should get high byte from $600" lda #$F0 sta $6FF lda #$07 sta $600 lda #$06 sta $700 lda #$E8 ; INX sta $7F0 lda #$60 ; RTS sta $7F1 sta $6F0 ldx #0 jsr jmp_6ff cpx #1 jne test_failed set_test 4,"RTS should return to addr+1" lda #>:+ pha lda #<:+ pha ldx #0 rts inx : inx inx cpx #1 jne test_failed set_test 5,"RTI should return to addr" lda #>:+ pha lda #<:+ pha ldx #0 php rti inx : inx inx cpx #2 jne test_failed set_test 6,"JSR should push addr of next instr - 1" lda #$20 ; JSR sta $6FE lda #<:+ sta $6FF lda #>:+ sta $700 jmp $6FE : pla cmp #$00 jne test_failed pla cmp #$07 jne test_failed jmp tests_passed