OS Development in other languages II : Am i going in the rig
Posted: Fri Dec 23, 2005 8:39 am
Ok..here is a nice question. I have here a simple bootloader code that I've found in a site. It boots a simple 'kernel' in ASM too, that displays a "Hello World" message on screen You don't need to read the bootloader, just the kernel:
-----bootloader---------------
ORG 7C00h]
inicio:
;
cli
mov ax, 0x9000
mov ss,
mov sp, 0
sti
mov [bootdrv], dl
call carregar
jmp far 1000h:0
;
bootdrv db 0
carregar:
push ds
.reset:
mov ax, 0
mov dl, [bootdrv]
int 13h
jc .reset
pop ds
.leitura:
mov ax,0x1000
mov es,ax
mov bx, 0
mov ah, 2
mov al, 5
mov cx, 2
mov dh, 0 ;
mov dl, [bootdrv]
int 13h
jc .leitura ;
retn ;
times 512-($-$$)-2 db 0 ;
dw 0AA55h ;
----------------"KERNEL"------------------------------
mov ax, 1000h ;
mov ds, ax ;
mov es, ax ;
mov si, msg
call poeString
loopp:
jmp loopp
poeString:
lodsb
or al,al
jz short volta
mov ah,0x0E
mov bx,0x0007
int 0x10
jmp poeString
volta:
retn
msg db 'Operating System Test IIIIIII',13,10,0
----------------------------------------------------
OK.. IT WORKS.....I tested and everything is OK. My question is if can I make the kernel in other language like Pascal. Here is how I want to do it:
1: Write a simple program in Pascal that display a message on screen
2: Put a inline assembly code in the beggining of my Pascal program :
mov ax, 1000h ;
mov ds, ax ;
mov es, ax ;
3:Compile to EXE.
4:Use EXE2BIN to convert my .EXE to a .BIN file
5:Write the bootloader and this new 'kernel" in a floopy with PartCopy like a did before.
-------
Am i going in the right direction? Will it work or everything I wrote is crap??
PLZ HELP me...
thanks...:P
-----bootloader---------------
ORG 7C00h]
inicio:
;
cli
mov ax, 0x9000
mov ss,
mov sp, 0
sti
mov [bootdrv], dl
call carregar
jmp far 1000h:0
;
bootdrv db 0
carregar:
push ds
.reset:
mov ax, 0
mov dl, [bootdrv]
int 13h
jc .reset
pop ds
.leitura:
mov ax,0x1000
mov es,ax
mov bx, 0
mov ah, 2
mov al, 5
mov cx, 2
mov dh, 0 ;
mov dl, [bootdrv]
int 13h
jc .leitura ;
retn ;
times 512-($-$$)-2 db 0 ;
dw 0AA55h ;
----------------"KERNEL"------------------------------
mov ax, 1000h ;
mov ds, ax ;
mov es, ax ;
mov si, msg
call poeString
loopp:
jmp loopp
poeString:
lodsb
or al,al
jz short volta
mov ah,0x0E
mov bx,0x0007
int 0x10
jmp poeString
volta:
retn
msg db 'Operating System Test IIIIIII',13,10,0
----------------------------------------------------
OK.. IT WORKS.....I tested and everything is OK. My question is if can I make the kernel in other language like Pascal. Here is how I want to do it:
1: Write a simple program in Pascal that display a message on screen
2: Put a inline assembly code in the beggining of my Pascal program :
mov ax, 1000h ;
mov ds, ax ;
mov es, ax ;
3:Compile to EXE.
4:Use EXE2BIN to convert my .EXE to a .BIN file
5:Write the bootloader and this new 'kernel" in a floopy with PartCopy like a did before.
-------
Am i going in the right direction? Will it work or everything I wrote is crap??
PLZ HELP me...
thanks...:P