flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Help with int 13h |
Author |
|
egos 06 Jun 2011, 17:23
Try this:
Code: boot: mov ax,7C0h cli mov ss,ax mov sp,8400h sti cld mov ds,ax mov [bootdev],dl ... phelp: mov bx,7 mov ah,0eh int 10h jmp print ... |
|||
06 Jun 2011, 17:23 |
|
xleelz 06 Jun 2011, 17:51
egos wrote: Try this: Thanks, I tried it but it still doesn't work. It always goes into reboot: when I run it in qemu and it never prints anything to the screen. _________________ The person you don't know is the person that could help you the most... or rape you, whichever they prefer. |
|||
06 Jun 2011, 17:51 |
|
me239 07 Jun 2011, 07:22
xleelz wrote: I'm trying to make a simple boot loader, the only job is to load the kernel and nothing else. It doesn't really work... Try "mov dl, 0" in your routine. Also instead of setting up es and ds, try just setting org to 7c00h. Hope I helped |
|||
07 Jun 2011, 07:22 |
|
BOTOKILLER 07 Jun 2011, 07:57
here is some part of mine:
Code: USE16 ORG 7C00h START1: jmp START DATASECT: DAP: DAP_Size db 10h ;1h DAP_Res1 db 0 ;2h DAP_Bytes2Transfer db 1h ;3h DAP_Res2 db 0 ;4h DAP_Buff_Addr1 dw 0h ;6h DAP_Buff_Addr2 dw 8000h ;8h DAP_LBA dq 1h ;9h DAT_Disk_Num db 80h ;12h number of device 80h-winchester DAT_Num_Of_Sects dw 03h ;13h the number of 512byte sectors, that contain your kernel your kernel END_DAP: END_DATASECT: ERROR: nop jmp ERROR START: REG_LOAD: mov bp, START1 mov ax, cs mov ds, ax mov ss, ax mov sp, 7DFFh SECOND_STAGE_LOAD: ; service for reading data from disk specified DAT_Disk_Num mov ah, 42h xor al, al mov dl, [cs:bp+12h] mov si, DAP mov cx, [cs:bp+13h] READ_LOOP: pusha int 13h jc ERROR popa add word [ds:si+6h], 20h inc byte [ds:si+8h] loop READ_LOOP ;service ends here VIDEO_MODE_CHNG: ; serveice for setting up a video mode xor ah, ah mov al, 3h int 10h mov cx, 0B800h mov es, cx ; service ends here CLS: ;service for clearing the screen mov cx, 2000d mov al, '' mov ah, 1Fh CLS_LOOP: mov si, cx add si, si mov word [es:si], ax loop CLS_LOOP ;service ends PASS_CONTROL: ; this shit passes control to second stage bootloader jmp 8000h:0000h ; bye bye first stage mbr FINISH: jmp FINISH times 410 db 0 dw 0AA55h it works OK and IMO its better to use int 13h ah=42h, here some stuff: http://www.ctyme.com/intr/rb-0708.htm if you still wanna use ah 0 02h http://www.ctyme.com/intr/rb-0607.htm Good luck! |
|||
07 Jun 2011, 07:57 |
|
egos 07 Jun 2011, 10:18
Quote: Thanks, I tried it but it still doesn't work. It always goes into reboot: when I run it in qemu and it never prints anything to the screen. |
|||
07 Jun 2011, 10:18 |
|
xleelz 07 Jun 2011, 18:31
Well, I rewrote it, it's still pretty similar though, and still doesn't work but it's closer because it actually printed something this time
New code: Code: use16 org 7C00h boot: jmp start nop OemName db "TestBoot" start: push cs pop ds cli push cs pop ss mov sp,07FFFh sti mov [bootdev],dl read: pusha xor ah,ah int 13h popa mov ax,1000h mov es,ax xor bx,bx xor ax,ax mov ah,02h mov al,1 xor ch,ch mov cl,2 mov dh,0 mov dl,[bootdev] int 13h jnc done jmp reboot done: jmp 0x1000:0000 reboot: xor esi,esi mov esi,rbmsg call print xor ah,ah int 16h cmp al,0dh je rbz jmp reboot rbz: jmp 0xFFFF:0000 print: lodsb cmp al,0 jne phelp ret phelp: mov ah,0eh int 10h jmp print ;----------------------------------------; bootdev db 0 rbmsg db 0dh,0ah,"ERROR LOADING KERNEL, PRESS <ENTER> TO REBOOT...",0 ;----------------------------------------; times 510-($-$$) db 0 dw 0AA55h and the kernel that I made, is just a test so it's extremely simple: Code: use16 org 0 main: xor ax,ax mov al,'>' mov ah,0eh int 10h hltr: hlt jmp hltr times 512-($-$$) db 0 Starting to get a headache from this _________________ The person you don't know is the person that could help you the most... or rape you, whichever they prefer. |
|||
07 Jun 2011, 18:31 |
|
Mike Gonta 07 Jun 2011, 21:44
xleelz wrote: Starting to get a headache from this Hi xleelz, The code in your first post works fine (simple errors notwithstanding). The problem must be in building the image. It's simple with FASM to assemble the entire image as one file: Code: org 7C00h ; boot sector code times 510-($-$$) db 0 dw 0AA55h org 0 ; kernel code times 512-($-$$) db 0 |
|||
07 Jun 2011, 21:44 |
|
xleelz 07 Jun 2011, 22:13
Quote:
Hah, thanks Mike! It works fine now |
|||
07 Jun 2011, 22:13 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.