flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Int 13h? Goto page Previous 1, 2, 3 |
Author |
|
rhyno_dagreat 27 Oct 2007, 18:54
[quote="edfed"]
rhyno_dagreat wrote: All it does is set up the offset of the segment address to 600h of certain variables so that they'll be added to whatever is in that ORG statement?|/quote] I've had some bad experiences with trying to find info in the Intel documents myself - to be perfectly honest, mainly I'm not sure half the time where to begin because there are at least 4 different PDF files for the documents. And also I meant offset from the beginning of the segment. I'm thinking back to Starman's site which had an explaination of it: http://mirror.href.com/thestarman/asm/debug/Segments.html |
|||
27 Oct 2007, 18:54 |
|
Dex4u 27 Oct 2007, 19:53
In pmode you normal have one 4GB address space, that starts at 0, now when you set your GDT up, if you set your descriptor to 0 base (most codes do), than ds or es etc, add nothing to the address.
So has long as you have zero based code and data descriptor, you can think of address, as whats in say edi, in this example Code: mov edi,10mov [es:edi],4 ; move 4 into the address 10 Once your in pmode you need to think in teams, of one long continues address space. All ORG does is add that number, to all memory reference in your code. So say in your code there was a Code: MyVar dd 0 At 12 bytes from start of your program and your ORG was "org 0x0000", then that would 12bytes, But if you had a "org 0x100" then the address would be 256 + 12 bytes. |
|||
27 Oct 2007, 19:53 |
|
rhyno_dagreat 28 Oct 2007, 01:21
I think I'm getting it now. Thanks!
|
|||
28 Oct 2007, 01:21 |
|
Mac2004 28 Oct 2007, 07:36
rhyno_dagreat wrote:
Quote:
I use similar boot loader in own protected mode projects. I switch to PM right after the boot loader has finished it's job. I hope my code can help you a bit. regards, Mac2004 Last edited by Mac2004 on 29 Oct 2007, 20:00; edited 1 time in total |
|||
28 Oct 2007, 07:36 |
|
rhyno_dagreat 29 Oct 2007, 04:57
Mac2004 wrote: rhyno_dagreat wrote: It has! In fact, I think I'm the person you wrote that code for originally a while back, lol. |
|||
29 Oct 2007, 04:57 |
|
edfed 29 Oct 2007, 12:29
it really helped
but now my code is far to be like the basic exemple |
|||
29 Oct 2007, 12:29 |
|
Mac2004 29 Oct 2007, 20:03
rhyno_dagreat wrote:
Quote:
That's why I decided to publish the loader example in the first place. I wanted to help others to pass the first hurdle .... regards, Mac2004 |
|||
29 Oct 2007, 20:03 |
|
edfed 12 Nov 2007, 20:21
i think this is the code writen by the designers of the µP
the gdt and the pm switch is hardware what about a pm int 13h |
|||
12 Nov 2007, 20:21 |
|
mikegonta 12 Nov 2007, 22:24
[ Post removed by author. ]
Last edited by mikegonta on 27 Jan 2009, 22:26; edited 1 time in total |
|||
12 Nov 2007, 22:24 |
|
edfed 13 Nov 2007, 01:17
i speak about a simple manner to handle int and irq in pm
not a switch to rm and a call of the desired int i seek, i seek i'll find how to control all the machine |
|||
13 Nov 2007, 01:17 |
|
edfed 28 Nov 2007, 01:47
hi rhyno!
here is the best place to speak about the os project. better than DOS/3D thread. sure it needs to provide install option. but before this, it needs to work. and possess a file system, a text editor, a fasm version, and other stuff... the fact that current os exist is good for us. we don't have to make all since the beginning. we can read many documents. wa can quote/read on the board.flatassembler. we can use fasmw to develop our os. so let's go contact me by PrivateMessage after we'll open a private channel. |
|||
28 Nov 2007, 01:47 |
|
edfed 13 Apr 2008, 19:08
secteur de boot archi simple.
Code: use16 org 7c00h push cs pop ds mov ax,1000h mov es,ax mov bx,7C00h mov ax,0201h mov dx,0 mov cx,1 int 13h jmp far 1000h:there there: push cs pop ds mov ax, 0B800h mov es,ax mov di,0 mov si,hello mov ah,71h @@: mov al,[si] cmp al,0 je @f mov [es:di],ax inc si inc di inc di jmp @b @@: xor ax,ax mov es,ax mov bx,7C00h mov ax,0201h mov dx,80h mov cx,1 int 13h jmp far 0:7C00h hello db 'hello world',0 free = 510-(padding-$$) padding rb free dw 0aa55h while attempting to read and write to Floppy drives, i saw that the multi sectors int13h is not ok. it don't works good. then, to load the second stage and all files on a floppy, sectors read and writes shall be done one by one. if not it will not work. a link to uptade of the INT 13h utilities for DOS and the source code of the prototype routine of read and write on drives using INT 13h Code: ; access all disk db 'disk',0 disk: .read: push es mov al,[.sector] mov ah,[.head] ror eax,16 mov ax,[.track] .nextr: dec [.sectors] jl .endr push eax mov cx,ax mov bl,cl mov cl,ch mov ch,bl shl cl,6 and cl,0c0h ror eax,16 or cl,al mov dh,ah mov dl,[.drive] mov bx,[.segment] mov es,bx mov bx,[.offset] mov ah,2 mov al,1 int 13h add [.offset],512 pop eax ror eax,16 inc al cmp al,[sectors0] jne @f mov al,1 inc ah cmp ah,[heads0] jne @f mov ah,0 ror eax,16 inc ax cmp ax,[tracks0] jne .nextr mov ax,1 @@: ror eax,16 jmp .nextr .endr: pop es ret .write: mov bx,[.segment] push es mov es,bx xor bx,bx mov al,[.sector] mov ah,[.head] ror eax,16 mov ax,[.track] .nextw: dec [.sectors] jl .endw push eax mov cx,ax mov bl,cl mov cl,ch mov ch,bl shl cl,6 and cl,0c0h ror eax,16 or cl,al mov dh,ah mov dl,[.drive] mov ah,3 mov al,1 int 13h add bx,512 pop eax ror eax,16 inc al cmp al,[sectors0] jne @f mov al,1 inc ah cmp ah,[heads0] jne @f mov ah,0 ror eax,16 inc ax cmp ax,[tracks0] jne .nextw mov ax,1 @@: ror eax,16 jmp .nextw .endw: pop es ret .id: mov ah,0 mov dl,[disk.drive] cmp dl,0 je .floppy int 13h jc @f mov ah,8 mov dl,[disk.drive] int 13h inc dh mov [heads0],dh mov bx,cx and cl,not 0c0h mov [sectors0],cl mov cl,ch mov ch,bl shr ch,6 inc cx mov [tracks0],cx mov eax,0 mov al,[sectors0] mov ebx,0 mov bl,[heads0] mov ecx,0 mov cx,[tracks0] imul eax,ebx imul eax,ecx shr eax,1 mov [kbytes0],eax stc ret .floppy: mov [tracks0],80 mov [sectors0],18 mov [heads0],2 mov al,[sectors0] mov ebx,0 mov bl,[heads0] mov ecx,0 mov cx,[tracks0] imul eax,ebx imul eax,ecx shr eax,1 mov [kbytes0],eax stc ret @@: clc ret .sectors db 128 .sector db 1 .track dw 0 .head db 0 .drive db 0 .segment dw 0 .offset dw 0 kbytes0 dd 1 tracks0 dw 1 cnt01 dw 1 sectors0 db 1 heads0 db 1
|
|||||||||||||||||||||
13 Apr 2008, 19:08 |
|
edfed 13 Sep 2009, 18:25
i tested to access the ide0 master with IO, but nothings happend.
i think i miss something in this code.... boot.asm Code: use16 org 7c00h push 1000h pop es mov bx,7C00h mov ax,0201h mov cx,1 int 13h jmp far 1000h:@f @@: mov si,boot call disk jmp far 0:7C00h boot dd disk db disk.read,0 dw 1 dd 1 dd 0:7c00h include 'io.asm' db 'version 1',0 took = padding-$$ free = 510-took padding rb free dw 0aa55h io.asm Code: disk: .call=0 ; function .cmd=4 ; drive command read or write .drv=5 ; drive number, BIOS based .cnt=6 ; count of sectors to read .lba=8 ; sector location in lba .off=12 ; offset part of far pointer to mem .seg=16 ; segment part of far pointer to mem .read=20h ; .write=30h ; .ata: mov dx,1f6h mov al,0 ;Drive 0, chs, h=0 out dx,al mov dx,1f2h mov al,1 ;512bytes out dx,al mov dx,1f3h mov al,1 ;S=1 out dx,al mov dx,1f4h mov al,0 ;Cl=0 out dx,al mov dx,1f5h ;Ch=0 mov al,0 out dx,al mov dx,1f7h mov al,[esi+.cmd] out dx,al @@: in al,dx test al,8 je @b mov cx,256 mov ax,[esi+.seg] mov es,ax mov di,[esi+.off] mov dx,1f0h rep insw ret this gives me a strange result in bochs. int13h_cdrom: function 2,ELDL out of range f0 int13h_cdrom: function 2,ELDL out of range f0 int13h_cdrom: function 2,ELDL out of range f0 int13h_cdrom: function 2,ELDL out of range f0 int13h_cdrom: function 2,ELDL out of range f0 int13h_cdrom: function 2,ELDL out of range f0 int13h_cdrom: function 2,ELDL out of range f0 int13h_cdrom: function 2,ELDL out of range f0 int13h_cdrom: function 2,ELDL out of range f0 int13h_cdrom: function 2,ELDL out of range f0 int13h_cdrom: function 2,ELDL out of range f0 .... |
|||
13 Sep 2009, 18:25 |
|
Goto page Previous 1, 2, 3 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.