flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > [HOW] Execute next file from boot sector? |
Author |
|
ASHLEY4 25 Aug 2004, 02:22
Hi cod3b453, The best advice i would give you is to go here: http://alexfru.chat.ru/epm.html
and get "bootprog.zip" it's a program that fits on the boot sector and lets you boot a com or mz exe from the floppy disk, so all you do is assemble your OS as a com or exe put it on the floppy like you would any other program and reboot, and it will run your OS , do not use dos int's in your OS, as there is no dos, but you can use bios in realmode. I use that program for my OS, if you want to try it and have windows, get my vesa demo from here http://board.flatassembler.net/topic.php?t=1940 (called VesaDemo.zip with code) and when finshed with demo, you can put your OS on the disk just by deleting the demo(the file on the disk called kernel32.exe) and renaming your OS "kernel32.exe" and put it on the disk and reboot. Hope this helps. Here is a example of how to make your own int's WITH OUT DOS. Note: these are for realmode, also you can still use bios int's with out dos. Code: ;----------------------------------------------------------------------------install_int: push ds cli xor ax, ax mov ds, ax ; set int 20h mov word [ds:20h*4], int20 ; (terminate com files) mov word [ds:20h*4+2], cs mov word [ds:21h*4], int21 ; and int 21h (DOS) mov word [ds:21h*4+2], cs sti pop ds ret;----------------------------------------------------------------------------;----------------------------------------------------------------------------;* int 20H: terminate .COM program.;----------------------------------------------------------------------------int20: push cs pop ax mov ds, ax mov es, ax jmp halt;----------------------------------------------------------------------------;* int 21H: DOS emulation;----------------------------------------------------------------------------int21: sti ; enables interrupts cmp ah, 0 je near _func00 ; terminate program cmp ah, 25h je near _func25 ; set int vec cmp ah, 35h je near _func35 ; get int vec cmp ah, 48h je near _func48 ; alloc ram memory cmp ah, 4Ch je near _func4C ; terminate program jmp int21_error;----------------------------------------------------------------------------; terminate program_func00: jmp near int20;----------------------------------------------------------------------------; write string; input es:dx = string (ended with '$')_func09: push bx mov bx, dx.next: mov al, byte [es:bx] cmp al, '$' je .done call chrout inc bx jmp .next.done: pop bx mov al, '$' jmp int21_exit;----------------------------------------------------------------------------; set interrupt vector_func25: cmp al, 19h ; do not allow to change int 19h (for rebooting) je near int21_error cli xor ah, ah shl ax, 2 push si push bx push es mov si, ax xor bx, bx mov es, bx mov word [es:si], dx ; offset mov bx, ds mov word [es:si+2], bx ; segment pop es pop bx pop si sti jmp int21_exit;----------------------------------------------------------------------------; get interrupt vector_func35: push ds push si xor ah, ah shl ax, 2 mov si, ax xor bx, bx mov ds, bx ; DS = 0 mov bx, word [ds:si+2] ; segment push bx mov bx, word [ds:si] ; offset pop es ; get segment pop si pop ds jmp int21_exit;----------------------------------------------------------------------------; alloc ram memory_func48: mov ax, word [cs:end_memory] add ax, bx cmp ax, word [cs:top_memory] jg .error mov word [cs:top_memory], ax.error: mov bx, word [cs:top_memory] ; return in bx free paragraphs sub bx, word [cs:end_memory] stc jmp int21_error;----------------------------------------------------------------------------_func4C: jmp near int20int21_error: mov ax, 0FFFFhint21_exit: iret;---------------------------------------------------------------------------- Also these are writen in nasm, so may need conveting for fasm. \\\\||//// (@@) ASHLEY4. |
|||
25 Aug 2004, 02:22 |
|
cod3b453 25 Aug 2004, 03:00
Thanks for the quick reply! I'll try it ASAP.
Are int's 10 and 16 BIOS int's? Thanks, cod3b453 |
|||
25 Aug 2004, 03:00 |
|
Mac2004 25 Aug 2004, 05:27
Yes, ints 0x10 and 0x16 are bios ints.
regards Mac2004 |
|||
25 Aug 2004, 05:27 |
|
kake_zinger 06 Sep 2004, 09:37
If all you want is to execute more code, load the sectors you want where you want and jump there.
Most simple is to load the next code right after your bootsector code. I've made it so that the whole boot stage is one program only which is written on sectors 1-18, the first sector loads sectors 2-18 immediately after the first sector and execution continues forward. Use for example int 13h for loading the sectors from fdd. It's absolutely unnecessary to have things set up as files at this moment, just load raw sectors. You can use DEBUG for writing the sectors, or other specialized programs (I like John Fine's PARTCOPY). |
|||
06 Sep 2004, 09:37 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.