flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > pmode |
Author |
|
Redragon 17 Mar 2005, 04:02
i noticed that you didnt start vesa.. could be some of the problem
|
|||
17 Mar 2005, 04:02 |
|
bubach 17 Mar 2005, 17:21
Ehh... What does VESA has to do with anything..?
|
|||
17 Mar 2005, 17:21 |
|
Redragon 17 Mar 2005, 17:38
lol.. i dont really know
|
|||
17 Mar 2005, 17:38 |
|
asmdemon 17 Mar 2005, 21:42
what is the value that is loaded into CS; if it's 0000, then you have a problem of overwriting the interrupt table.
|
|||
17 Mar 2005, 21:42 |
|
dasyar 19 Mar 2005, 15:46
The following is an updated program. It assembles correctly using fasm, and starts after being loaded by my bootsector program. This may be of interest for those of you who DO NOT want to go into pmode from the bootsector program. This is a conversion of one of the programs in the Geezer PMx.xxx series.
Code: ;;;;;;;;;;;;;;;;;;;;;;;;;;;; mov ax,cs mov ds,ax use16 mov si,test1 call writestring xor ebx,ebx mov bx,cs shl ebx,4 lea eax,[ebx] mov [gdt2 + 2],ax mov [gdt3 + 2],ax shr eax,16 mov [gdt2 + 4],al mov [gdt3 + 4],al mov [gdt2 + 7],ah mov [gdt3 + 7],ah lea eax,[ebx + gdt] mov [gdtr + 2],eax cli lgdt [gdtr] mov eax,cr0 or al,1 mov cr0,eax jmp code_sel:do_pm use32 do_pm: mov ax,data_sel mov ds,ax mov es,ax mov fs,ax mov gs,ax mov ss,ax mov ax,linear_sel mov es,ax mov byte [es:dword 0xb8060],'0' mov byte [es:dword 0xb8062],'1' lea esi,[test2] call wrstr jmp $ wrch: pushf push gs push ecx push ebx push eax cli mov ax,linear_sel mov gs,ax movzx eax,byte [CsrY] mov cl,80 mul cl add al,[CsrX] adc ah,0 shl eax,1 lea ebx,[eax + 0xb8000] pop eax push eax mov [gs:ebx],al mov cx,[CsrX] inc cl cmp cl,80 jb wrch2 xor cl,cl inc ch cmp ch,25 jb wrch2 xor ch,ch wrch2: mov [CsrX],cx pop eax pop ebx pop ecx pop gs popf ret wrstr: push esi push eax cld jmp wrstr2 wrstr1: call wrch wrstr2: lodsb or al,al jne wrstr1 pop eax pop esi ret CsrX: db 0 CsrY: db 0 test2 db "In 32 bit mode",0 writestring: pusha .wloop: lodsb or al,al jz .done mov ah,0x0e mov bh,0 mov bl,7 int 0x10 jmp .wloop .done: popa ret test1: db 13,10,'In 16 bit mode',0 gdtr: dw gdt_end - gdt - 1 dd gdt gdt: dw 0 dw 0 db 0 db 0 db 0 db 0 linear_sel = $ - gdt dw 0xffff dw 0 db 0 db 0x92 db 0xcf db 0 code_sel = $ - gdt gdt2: dw 0xffff dw 0 db 0 db 0x9a db 0xcf db 0 data_sel = $ - gdt gdt3: dw 0xffff dw 0 db 0 db 0x92 db 0xcf db 0 gdt_end: moderator notoce: please use [ code ] tags around code. (added code tags) |
|||
19 Mar 2005, 15:46 |
|
AdamMarquis 27 Apr 2005, 18:08
Look at my post titled: "IDE Bootloader take two",
the code patches its 16bits calls into 32bits ones, and have a neat working pmode entry snippet. |
|||
27 Apr 2005, 18:08 |
|
othername 04 May 2005, 20:21
Dasyar, where is your magic number?
_________________ Sorry for my bad English |
|||
04 May 2005, 20:21 |
|
dasyar 05 May 2005, 12:44
Othername, I am not sure what you are refering to. What is the real question?
|
|||
05 May 2005, 12:44 |
|
thomasantony 07 May 2005, 04:11
Hi,
I think he is talking about the Boot Signature. The bytes 55h, AAh at the bottom of the boot sector Thomas |
|||
07 May 2005, 04:11 |
|
dasyar 07 May 2005, 12:56
The idea here was to enter into pmode from a loadable file, and not within the boot sector. So the "magic number" is within the boot sector program. Their are quite a few snippets of pmode entry within the boot sector, I wanted to do it within a loadable file. That way you could still do some stuff while still in 16 bit mode. So, in other words, this is not a "bootable" program, it is a loadable program.
|
|||
07 May 2005, 12:56 |
|
othername 07 May 2005, 21:59
I had EXACLY such problem, and i didn't resolve it. At first i wrote bootsect whitch entered to PM, everything was OK. But when i changet it to simple prog whitch was booted from another bootsec(as you doing now), i got reboot. Now i boot'ing my loadable program(kernel) with GRUB.
I don't know why linux bootsector when it gets control relocates himself to 0x9000, maby you can try to do this. |
|||
07 May 2005, 21:59 |
|
thomasantony 08 May 2005, 15:46
Hi,
Where are you loading this code? I think linux bootsect relocates itself to load some other file at 7C00h Thomas |
|||
08 May 2005, 15:46 |
|
deltre 23 May 2005, 09:37
Quote:
Isn't AA55h FAT only? I'm a beginner in pmode, so if I'm saying something stupid, please be gentile Don't you have to open the A20 line before addressing such a large number in ESP? |
|||
23 May 2005, 09:37 |
|
THEWizardGenius 24 May 2005, 15:54
AA55h is the "magic number" for the BIOS to know the disk is bootable so it doesn't load any non-bootable partitions and try to boot from them. So, if you're going to make a boot loader it needs AA55h, or else BIOS won't recognize it, won't boot from it, and won't work.
BTW that I wouldn't recommend putting a boot sector on a hard drive with another OS unless you back the original one up. Use floppy disks at first, then later use hard disks. You might want to get a hard disk with nothing on it for testing purposes, so you don't mess anything up. |
|||
24 May 2005, 15:54 |
|
Endre 28 May 2005, 13:04
What if you write 'pword' before the jmp operand?
Code: jmp pword 0x08:pmsys |
|||
28 May 2005, 13:04 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.