Working on memtest
This commit is contained in:
parent
2ba63877bf
commit
8d38709c46
@ -21,14 +21,14 @@ MON_COMMAND_ZERO: DB "ZERO",0
|
|||||||
MON_COMMAND_LOAD: DB "LOAD",0
|
MON_COMMAND_LOAD: DB "LOAD",0
|
||||||
MON_COMMAND_RUN: DB "RUN",0
|
MON_COMMAND_RUN: DB "RUN",0
|
||||||
MON_COMMAND_ADB: DB "ADB",0
|
MON_COMMAND_ADB: DB "ADB",0
|
||||||
|
MON_COMMAND_MEMTEST: DB "MEMTEST",0
|
||||||
MON_COMMAND_QUIT: DB "QUIT",0
|
MON_COMMAND_QUIT: DB "QUIT",0
|
||||||
MON_ARG_HEX: DB " 0x",0
|
MON_ARG_HEX: DB " 0x",0
|
||||||
MON_HELP: DB 10,"Available commands:\nHELP prints this message\nDUMP [ADDR] shows memory content\nSET [ADDR] sets memory content\nZERO [ADDR] [ADDR] sets all bytes to 0 in the specified range\nLOAD\nRUN [ADDR] executes code starting from ADDR\nADB starts Assembly Deploy Bridge\nQUIT exits",0
|
MON_HELP: DB 10,"Available commands:\nHELP prints this message\nDUMP [ADDR] shows memory content\nSET [ADDR] sets memory content\nZERO [ADDR] [ADDR] sets all bytes to 0 in the specified range\nLOAD\nRUN [ADDR] executes code starting from ADDR\nADB starts Assembly Deploy Bridge\nMEMTEST checks ram boundaries\nQUIT exits",0
|
||||||
MON_MSG_ADB: DB 10,"Waiting for data.",0
|
MON_MSG_ADB: DB 10,"Waiting for data.",0
|
||||||
MON_ERR_SYNTAX: DB " Syntax error",0
|
MON_ERR_SYNTAX: DB " Syntax error",0
|
||||||
MON_RAMTEST_INTRO: DB "Memory check... ",0
|
MON_RAMTEST_INTRO: DB " Checking memory... ",0
|
||||||
MON_RAMTEST_RAMSTART: DB " Ram starts at 0x",0
|
MON_RAMTEST_RAMSTART: DB " Ram starts at 0x",0
|
||||||
MON_RAMTEST_OK: DB " bytes OK",0
|
|
||||||
;MON_ADB_TIMEOUT: EQU 0xFF // Number of cycles after an ADB binary transfer is considered completed
|
;MON_ADB_TIMEOUT: EQU 0xFF // Number of cycles after an ADB binary transfer is considered completed
|
||||||
MON_DUMP_BYTES_LINES: EQU 8
|
MON_DUMP_BYTES_LINES: EQU 8
|
||||||
MON_DUMP_BYTES_PER_LINE: EQU 8
|
MON_DUMP_BYTES_PER_LINE: EQU 8
|
||||||
@ -70,6 +70,9 @@ Monitor_main:
|
|||||||
ld hl, MON_COMMAND_ADB
|
ld hl, MON_COMMAND_ADB
|
||||||
cp (hl)
|
cp (hl)
|
||||||
jp z, monitor_adb
|
jp z, monitor_adb
|
||||||
|
ld hl, MON_COMMAND_MEMTEST
|
||||||
|
cp (hl)
|
||||||
|
jp z, monitor_memtest
|
||||||
ld hl, MON_COMMAND_QUIT
|
ld hl, MON_COMMAND_QUIT
|
||||||
cp (hl)
|
cp (hl)
|
||||||
jp z, monitor_quit
|
jp z, monitor_quit
|
||||||
@ -555,54 +558,51 @@ monitor_copyTermToAppMem:
|
|||||||
; Starting from last memory position, writes 0xFF, reads it back, writes 0x00, reads it back.
|
; Starting from last memory position, writes 0xFF, reads it back, writes 0x00, reads it back.
|
||||||
; Exits when the first value differs from the written value (this may be caused by a bad ram
|
; Exits when the first value differs from the written value (this may be caused by a bad ram
|
||||||
; block or the start of rom in memory map). Prints the last good address on exit.
|
; block or the start of rom in memory map). Prints the last good address on exit.
|
||||||
monitor_ramTest:
|
; monitor_memtest:
|
||||||
; Prints intro
|
; ld bc, MON_COMMAND_MEMTEST + 1 ; autocomplete command
|
||||||
ld bc, MON_RAMTEST_INTRO
|
; call Sys_Print
|
||||||
call Sys_Print
|
; ; Prints intro
|
||||||
; Starts checking
|
; ld bc, MON_RAMTEST_INTRO
|
||||||
ld hl, MEM_END
|
; call Sys_Print
|
||||||
monitor_ramTest_loop:
|
; ; Starts checking
|
||||||
; Write 0xFF
|
; ld hl, MEM_END
|
||||||
ld a, 0xFF
|
; monitor_memtest_loop:
|
||||||
ld (hl), a
|
; ; Save current byte value for later restore
|
||||||
; Read and compare 0xFF
|
; ld c, (hl)
|
||||||
ld a, (hl)
|
; ; Write 0xFF
|
||||||
cp 0xFF
|
; ld a, 0xFF
|
||||||
jp nz, monitor_ramTest_badram
|
; ld (hl), a
|
||||||
; Write 0x00
|
; ; Read and compare 0xFF
|
||||||
ld a, 0x00
|
; ld a, (hl)
|
||||||
ld (hl), a
|
; cp 0xFF
|
||||||
; Read and compare 0xFF
|
; jp nz, monitor_memtest_badram
|
||||||
ld a, (hl)
|
; ; Write 0x00
|
||||||
cp 0x00
|
; ld a, 0x00
|
||||||
jp nz, monitor_ramTest_badram
|
; ld (hl), a
|
||||||
; Memory byte is good, next one
|
; ; Read and compare 0xFF
|
||||||
dec hl
|
; ld a, (hl)
|
||||||
jp monitor_ramTest_loop
|
; cp 0x00
|
||||||
monitor_ramTest_badram:
|
; jp nz, monitor_memtest_badram
|
||||||
; Found a bad memory byte (or entered rom block).
|
; ; Memory byte is good, restore previous value
|
||||||
ld bc, MON_RAMTEST_RAMSTART
|
; ld (hl), c
|
||||||
call Sys_Print
|
; ; Next one
|
||||||
; Print memory addr
|
; dec hl
|
||||||
ld a, h
|
; jp monitor_memtest_loop
|
||||||
call monitor_printHexByte
|
; monitor_memtest_badram:
|
||||||
ld a, l
|
; ; Found a bad memory byte (or entered rom block).
|
||||||
call monitor_printHexByte
|
; ld bc, MON_RAMTEST_RAMSTART
|
||||||
; Print message
|
; call Sys_Print
|
||||||
ld a, ','
|
; ; Print last valid memory addr
|
||||||
call Sys_Printc
|
; inc hl
|
||||||
ld a, ' '
|
; ld a, h
|
||||||
call Sys_Printc
|
; call monitor_printHexByte
|
||||||
; Print number of valid bytes
|
; ld a, l
|
||||||
ld bc, hl ; move hl to bc
|
; call monitor_printHexByte
|
||||||
ld hl, 0xFFFF
|
; ; Newline
|
||||||
sbc hl, bc ; obtain number of good mem bytes
|
; ld a, 10
|
||||||
; TODO: Implement 16-bit integer print
|
; call Sys_Printc
|
||||||
|
; ; Back to menu
|
||||||
; Print message
|
; jp monitor_main_loop
|
||||||
ld bc, MON_RAMTEST_OK
|
|
||||||
call Sys_Print
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user