jfl wrote:DavidCooper wrote:db 01001111b
Try changing the two occurrances of this to 11001111b
I'm can't remember what bit-7 of it does, but that's the value I use.
That bit is the granularity. 0 means byte granularity and 1 means page granularity. My limit uses byte granularity.
Yes, I've checked that - you're limiting yourself to a 1MB range instead of 4GB, but while that's unusual it shouldn't stop you accessing the screen.
Code: Select all
jmp 0x08:.flush
.flush:
mov ax,0x10
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
mov ss,ax
ret
You haven't shown how you're trying to print to the screen, but to narrow down where the problem is, why not try adding a bit of code just before the ret in the bit above to print to the screen from there. I work directly in machine code directly using decimals, so I'd put 120 in al, 12 in ah, 0,128,11,0 in edi and post ax to the screen with 102,171 (thereby printing a red capital X to the top left corner of the screen). In assembler that would be something like:-
Code: Select all
mov al,0x78
mov ah,0x0C
mov edi,000B8000h // check that value - I'm not great with hex
stosw // check that too - I'm trying to represent the instruction that sends
// ax to the address in edi
My own code to jump switch from real mode to 32-bit protected mode is as follows, but I'm only giving it to you so you can see if your own code is doing something radically different in case it helps: 250 (disable interrupts), 51 192 (ax=0), 142 208 (ss=0), 188 0 124 (sp = address where boot sector is loaded in, so stack will run downwards from there), 176 209 230 100 (send 209 to port 100), 176 223 230 96 (and 223 to port 96 - A20 now on to open up whole memory range of machine), 190 196 124 (si = address of lgdt pointer to GDT - see below), 15 1 20 (load GDT), 15 32 192 (mov eax, cr0), 12 1 (or ah, 1), 15 34 192 (mov cr0, eax - switch to protected mode made), 102 234 172 125 0 0 8 0 (jump to next byte to load cs).
The thing I called the lgdt pointer is a block of 8 bytes, the first two of which in my case are 39, 0 (which is 5 times 8 minus 1 because I have five entries in my GDT - as you only have three entries you should make these 23, 0 instead), then the two-byte address of the start of your GDT, then four zero bytes (though I can't remember if segment values are part of that - my GDT's in the bottom 64KB of memory so they would be zero anyway).