I am running into a problem that I have never had before...
I am trying to clear the RAM from 0x0000:0x0000 to 0x0000:0x0100 in x86 real mode. To do this I built a loop, but my loop is only running 0x40 times... Any ideas?
Note: FS has already been set to 0x0000 when I setup my stacks.
;Clear ram from 0x0000 to 0x0100
mov bx, 0x0000 ;Counter
.clear_loop:
mov byte [fs:bx], 0x00 ;Clear value at (FS:BX) 0x0000:BX
inc bx ;Increment counter, BX
%if DEBUG_CLEAR_LOOP_PRINT_ADDRESS
push bx ;Store BX, counter
mov dx, bx ;Move BX into DX for print of counter
mov bx, 0x000F ;Bios color white for print
call print_dx ;Print DX, value of counter
pop bx ;Restore BX, counter
%endif
;Check if done
cmp bx, 0x0100
jbe .clear_loop ;If BX is less than or equal to 0x0100, go back to .clear_loop
;if done continue on...
Programming is like fishing, you must be very patient if you want to succeed.
That's not a very efficient routine, but still - why not just single-step through it in a debugger to find out why it's not doing what you think it should?
I understand it is very inefficient, but I am debugging it for a friend... The piece of code is in a boot loader so I am unsure on how to run it in a debugger... Any suggestion?
Programming is like fishing, you must be very patient if you want to succeed.
You were correct! I changed the address range to 0x0010:0x0000 - 0x0010:0x0100 and now it is stuck on some really poor disk reading code that I need to go over.
Thank You!
Programming is like fishing, you must be very patient if you want to succeed.
You could debug in an emulator - Bochs, qemu, SimNow. As already said, you will be overwriting the IVT so, if you haven't disabled interrupts or if you are using BIOS functions, the routine won't complete.