From: zak100 <zul...@ya...> - 2009-06-29 09:45:43
|
Hi, I have written the following program to be exeuted when my system boots up using int 10h. But its not printing any mesg. Can somebody plz. help me with this?? Zulfi. org 7C00h; starting the program at 7C00H. Address generated at reset section .text section .text; why twice???? call overdata ; Call? WTF? Don't worry, we pop the. ; return address off to get initial IP. ; Note that "call" is longer than ; nop ; "jmp short", so we don't want the nop. At 7C00H we have to make a jmp where our actual code starts db 'MyOS ' ; OEM id - space-padded to 8 bytes dw 200h ; bytes/sector db 1 ; sectors per cluster dw 1 ; sectors before FAT db 2 ; number of FATs dw 0E0h ; max rootdir entries dw 0B40h ; total sectors db 0Fh ; media descriptor dw 9 ; sectors per FAT dw 12h ; sectors per track dw 2 ; number heads times 0Ah db 0 db 29h db 0EFh db 7 db 10h db 24h db 'LINUX BOOT FAT12 ' ; guess where I ; cribbed this from ;----------------------------writing a mesg on screen at startup. We cant use int 21h overdata: xor di,di mov ds,di mov ax,0B800h mov es,ax ; should probably set up a sane stack here, too. ;mov ah,03h ;xor bh, bh ;int 10h ;---------------------------- mov cx, 15 mov bh,0 mov bl,0011_1011b mov bp, msg mov ax,1301h mov dl,10 mov dh,7 int 10h blackhole: jmp blackhole msg db "We be bootin2'!",0 times 510-($-$$) db 0 db 55h, 0AAh ; ??????I know times is like dup.But what is ($-$$) and 55h and 0AAh ; boot sector signature -- View this message in context: http://www.nabble.com/prob-with-bios-int-10h-tp24251227p24251227.html Sent from the nasm-users mailing list archive at Nabble.com. |
From: Frank K. <fbk...@zy...> - 2009-06-29 14:35:31
|
zak100 wrote: This is the problem: > mov ax,0B800h > mov es,ax ; One example you've got puts characters to screen memory, at B800h:????. "stosw" is used to put character and color to es:di. The other example uses bios int 10h, subfunction 13h, which expects es:bp to point to the string (unusual parameters to this interrupt!). (the tut you've got explains other parameters to this int, but fails to mention the es:bp thing) When our bootsector receives control from the bios, we don't know what ds and es are. If we've assembled at "org 0", we want them to be 7C0h. If we've assembled at 7C00h, we want them to be zero... to refer to any data in our bootsector (if we want screen memory, 0B800h - an old ttl mono card wants 0B000h - we probably won't encounter such a thing, but really should check... int 11h, IIRC). The example that prints registers on the screen, is quite "non-standard", and probably isn't a good starting point for other bootsectors. This one uses a different int 10h subfunction, 0Eh, which prints the character in al (put there by lodsb). ;------------------------------------ ; same as boot01, pretty much... ; nasm -f bin -o boot01.bin boot01.asm ; dd count=1 if=boot01.bin of=/dev/fd0 ;------------------------------------- org 7C00h section .text jmp short overdata nop db 'MyOS ' ; OEM id dw 200h ; bytes/sector db 1 ; sectors per cluster dw 1 ; sectors before FAT db 2 ; number of FATs dw 0E0h ; max rootdir entries dw 0B40h ; total sectors db 0Fh ; media descriptor dw 9 ; sectors per FAT dw 12h ; sectors per track dw 2 ; number heads times 0Ah db 0 db 29h db 0EFh db 7 db 10h db 24h db 'LINUX BOOT FAT12 ' ;---------------------------- overdata: xor ax,ax mov ds,ax mov es,ax ; should probably set up a sane stack here, too. mov si,msg ; "our dear string" mov bx,7 mov ah,0Eh msgloop: lodsb or al,al jz blackhole int 10h ; since we're still in RM, we can use bios. jmp msgloop blackhole: jmp blackhole msg db "We be bootin'2!",0 times 510-($-$$) db 90h ; don't think it matters, but we'll use NOP db 55h,0AAh ; boot sector signature ;------------------------- I'll see if I can work up an example using int 10h subfunction 13h... maybe even set up the stack, instead of just saying we should. :) Won't be immediately, but I'll try to get to it "soon"... Best, Frank |