SteveOS for 16 bit processors (286)

memtest.asm 653B

    ;; 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