SteveOS for 16 bit processors (286)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

45 lines
653 B

  1. ;; Used to test memory
  2. ;; bx - start of byte to test
  3. ;; ax - last byte to test(not inclusive)
  4. ;; writes all 0s, verifies, writes all 1s, verifies
  5. memtest_init:
  6. pusha
  7. memtest_test_ram:
  8. cmp bx, ax
  9. jge memtest_done
  10. mov [bx], byte 0
  11. cmp [bx], byte 0
  12. jne memtest_byte_error
  13. mov [bx], byte 0xFF
  14. cmp [bx], byte 0xFF
  15. jne memtest_byte_error
  16. add bx, 1
  17. jmp memtest_test_ram
  18. memtest_byte_error:
  19. push bx
  20. mov bx, MEM_ERROR
  21. call print
  22. pop bx
  23. push ax
  24. mov ax, bx
  25. call print_hex
  26. mov al, 0xD
  27. call print_char
  28. mov al, 0xA
  29. call print_char
  30. pop ax
  31. add bx, 1
  32. jmp memtest_test_ram
  33. memtest_done:
  34. popa
  35. ret
  36. MEM_ERROR: db "MEMORY ERROR: ", 0