Browse Source

memtest

snake
Stephen D 1 year ago
parent
commit
68b6a9866a
2 changed files with 77 additions and 16 deletions
  1. +33
    -16
      boot.asm
  2. +44
    -0
      memtest.asm

+ 33
- 16
boot.asm View File

@@ -66,6 +66,7 @@ loop:
jmp loop

;; Print has to be kept here so that disk errors can be printed
%include "print.asm"
%include "disk.asm"
@@ -158,6 +159,11 @@ cmd:
cmp cl, 1
je cmd_clear

mov dx, CMD_MEMTEST_STR
call strcmp
cmp cl, 1
je cmd_memtest

;; don't print unknown command message if cmd is empty
cmp [CMD_BUFFER_POS], byte 0
je clear_cmd_buffer
@@ -165,23 +171,13 @@ cmd:

mov bx, RTN_UNKNOWN_STR
call print
clear_cmd_buffer:
mov [CMD_BUFFER_POS], byte 0
ret

cmd_help:
mov bx, RTN_HELP_STR
call print
jmp clear_cmd_buffer

cmd_sedit:
call sedit_init
jmp clear_cmd_buffer

cmd_clear:
mov ax, 0x03
int 0x10
cmd_memtest:
pusha
mov bx, 0x8300
mov ax, 0xFFFF
call memtest_init
popa
jmp clear_cmd_buffer
@@ -199,7 +195,27 @@ STARTUP: db "Starting Steve16...", 0xA, 0xD,
;; SECTOR 2 & 3
%include "string.asm"
%include "textedit.asm"
%include "memtest.asm"

clear_cmd_buffer:
mov [CMD_BUFFER_POS], byte 0
ret

cmd_help:
mov bx, RTN_HELP_STR
call print
jmp clear_cmd_buffer

cmd_sedit:
call sedit_init
jmp clear_cmd_buffer

cmd_clear:
mov ax, 0x03
int 0x10
jmp clear_cmd_buffer

CMD_MEMTEST_STR: db "MEMTEST", 0
CMD_SEDIT_STR: db "SEDIT", 0
CMD_HELP_STR: db "HELP", 0
CMD_CLEAR_STR: db "CLEAR", 0
@@ -210,6 +226,7 @@ RTN_HELP_STR:
db " HELP This screen", 0xA, 0xD
db " SEDIT Steve16 Text Editor", 0xA, 0xD
db " CLEAR Clears the screen", 0xA, 0xD
db " MEMTEST Runs a memory test", 0xA, 0xD
db 0

RTN_UNKNOWN_STR:


+ 44
- 0
memtest.asm View File

@@ -0,0 +1,44 @@
;; Used to test memory

;; bx - start of byte to test
;; ax - last byte to test(not inclusive)
;; writes all 0s, verifies, writes all 1s, verifies
memtest_init:
pusha

memtest_test_ram:
cmp bx, ax
jge memtest_done
mov [bx], byte 0
cmp [bx], byte 0
jne memtest_byte_error
mov [bx], byte 0xFF
cmp [bx], byte 0xFF
jne memtest_byte_error
add bx, 1
jmp memtest_test_ram
memtest_byte_error:
push bx
mov bx, MEM_ERROR
call print
pop bx
push ax
mov ax, bx
call print_hex

mov al, 0xD
call print_char
mov al, 0xA
call print_char

pop ax
add bx, 1
jmp memtest_test_ram

memtest_done:
popa
ret

MEM_ERROR: db "MEMORY ERROR: ", 0

Loading…
Cancel
Save