;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; File Name: MEMTEST.S
; Descriptions: Writing 0x01..0xFF to memory and then verify
; it.
; Programed by: Teddy Wong
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
XREF STKTOP
XREF DATA
#define BOOTSTRAP
; Define Pointer to Store the Start Address and End Address
pSTART equ $1500
pEND equ $1504
SECTION code
START
movea.l #STKTOP,a7 ;re-istall stack pointer in case bootstrap mode
****************************************************************************
move.l pSTART,a0 ; a0 as the address to write
move.l #1,d1 ; d1 contains the number 0x01-0xFF
clr.b d5 ; clear d5 as a counter for ECHO
WRITE
cmp.b #0,d5
bne NO_W
bsr WRITING
NO_W addi.b #1,d5
move.b d1,(a0)+ ; write d1 to (a0)
add.b #1,d1
cmp.b #0,d1 ; set d1 to 1 if d1==0
bne NEXTWR ; to prevent writing 0 to DRAM
move.b #1,d1 ;
NEXTWR cmp.l pEND,a0 ; check the size copy
blt WRITE
; END of WRITE
****************************************************************************
move.l pSTART,a0 ; a0 as the address to write
clr.l d0
move.l #1,d1 ; d1 contains the number 0x01-0xFF
clr.b d5 ; clear d5 as a counter for ECHO
CHECK
cmp.b #0,d5
bne NO_C
bsr CHECKING
NO_C addi.b #1,d5
move.b (a0)+,d0
cmp.b d0,d1 ; check for error
bne ERR
add.b #1,d1
cmp.b #0,d1 ; set d1 to 1 if d1==0
bne NEXTCHK ;
move.b #1,d1 ;
NEXTCHK cmp.l pEND,a0
blt CHECK
; END of CHECK
****************************************************************************
bra FINISH
ERR
#ifdef BOOTSTRAP
bsr wait
move.b #'e',$FFFFF907 ; display error
bsr wait
move.b #'r',$fffff907
bsr wait
move.b #'r',$fffff907
bsr wait
move.b #'o',$fffff907
bsr wait
move.b #'r',$fffff907
bsr wait
move.b #0,$fffff907
#endif
bra EXIT
FINISH
#ifdef BOOTSTRAP
bsr wait
move.b #'P',$fffff907 ; display PASS
bsr wait
move.b #'A',$fffff907
bsr wait
move.b #'S',$fffff907
bsr wait
move.b #'S',$fffff907
bsr wait
move.b #0,$fffff907
#endif
bra EXIT
wait btst.b #7,$fffff906
beq.b wait
move.w #$fff,d1
lp_wt sub.w #1,d1
bne.b lp_wt
rts
WRITING nop
#ifdef BOOTSTRAP
move.b #'W',$fffff907
nop
move.b #0,$fffff907
nop
#endif
rts
CHECKING
#ifdef BOOTSTRAP
nop
move.b #'C',$fffff907
nop
move.b #0,$fffff907
nop
#endif
rts
EXIT ; return to bootstrap mode
#ifdef BOOTSTRAP
;jmp START ; Loop Test
;jmp $ffffff44 ; EZ
jmp $FFFFFF5A ; VZ
#endif
END
dragonball 的内存检测程序
最新推荐文章于 2022-02-25 21:57:21 发布