feat(utils): moved memtest.s to utils.s
This commit is contained in:
60
src/utils.s
Normal file
60
src/utils.s
Normal file
@@ -0,0 +1,60 @@
|
||||
; CHIBI PC-09 Prototype #1 Boot ROM -- Memory Testing Routines
|
||||
; Copyright (c) 2024-2025 Amber Zeller, Gale Faraday
|
||||
; Licensed under MIT
|
||||
|
||||
INCLUDE "hardware.inc"
|
||||
INCLUDE "serial.inc"
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; Memory Testing Routines
|
||||
;;
|
||||
;; This family of BIOS routines does not return, upon completion the CHIBI must
|
||||
;; be reset.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
SECTION MEMTEST
|
||||
|
||||
EXPORT ROBIT
|
||||
|
||||
; RAM testing routine. Ported to 6809 from 6800, based on source for ROBIT-2 for
|
||||
; MIKBUG.
|
||||
ROBIT
|
||||
ldx #STACK_TOP+1 ; bottom of testable SRAM, $0200
|
||||
AGAIN@ ; Store 1 in memory
|
||||
lda #1 ; Set [X] to 1
|
||||
sta 0,x
|
||||
cmpa 0,x ; If failed print out an error indicator
|
||||
bne ERR@
|
||||
NEXT@ ; Loop point for next address
|
||||
asla ; Shift A and [X] left
|
||||
asl 0,x
|
||||
cmpa 0,x ; Compare A and [X]
|
||||
bne ERR@
|
||||
cmpa #$80 ; Only test up to $80
|
||||
bne NEXT@ ; Loop if not $80
|
||||
cmpx #$60FF ; Compare X to end of RAM
|
||||
beq PASS@ ; Finish if we're at the end
|
||||
leax 1,x ; Increment X
|
||||
bra AGAIN@
|
||||
ERR@ ; Write out error indicator
|
||||
ldb #'X
|
||||
jsr POUTCHAR
|
||||
PASS@ ; Pass test
|
||||
ldb #'P
|
||||
jsr POUTCHAR
|
||||
bra HALT
|
||||
|
||||
; Prints a message about completing a memory test prompting the user to reset
|
||||
; then puts the MPU in a loop where it only responds to interrupts, effectively
|
||||
; halting the CHIBI
|
||||
HALT
|
||||
PZSTR MSG_FINISH
|
||||
LOOP@
|
||||
sync
|
||||
bra LOOP@
|
||||
|
||||
MSG_FINISH
|
||||
fcc "Memory test finished! Please reset"
|
||||
fcb $0D,$0A,$00
|
Reference in New Issue
Block a user