| |
|
|
Written by Gregory R. Panakkal
|
|
Sunday, 05 August 2007 |
|
Test OS - a rather dumb name for a lame attempt at writing a real mode 16 bit operating system. it was an attempt around 6 years back (2001)? Anyway, here is the 'bootloader' that i had written at that time... Since my rest of the 'os' was small, the boot loader read 5 sectors to location 0060:0000.
Here is the source to go...
---------- <boot.asm> ------------
;ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß ; TestOS ; Boot Loader ;ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
.model tiny .code org 7C00h
start: ; Entry Point... jmp real_start
TestOS_Signature db "TestOS - JunkCode"
real_start:
;use a full segment as stack... cli mov ax,09000h mov ss,ax mov sp,0ffffh sti
xor bx, bx mov ds, bx ; CS = DS = 0
mov si, offset WelcomeMsg call Print
.586 xor eax, eax cpuid mov si,offset vendorid mov [si], ebx mov [si+4], edx mov [si+8], ecx mov si, offset vendorid2 call Print mov si, offset vendorid call Print
.8086 mov si, offset PressKey call Print
xor ah, ah ; Get a key int 16h
mov si, offset LoadingMsg call Print
mov bx, 0060h ; Load to 0060:0000 mov es, bx xor bx, bx
mov cx, 5
load: call ReadSector add bx, 512d loop load
db 0EAh ; Jump to 0060:0000 dw 0000h, 0060h
;ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß ; Read A Sector into Memory! ;ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
ReadSector: push ax cx dx mov cl, SectorNo ; Starting Sector No. mov ch, 0h ; Cylinder No. mov dh, 0h ; Head No. mov dl, 0h ; Drive No. 0h-Floppy 80h-HDD
mov ah, 02h ; Read Sector Function No. mov al, 01h ; Sectors To Read int 13h inc SectorNo pop dx cx ax ret
;ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß ; Print A String Pointed by -SI- ;ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
Print: lodsb or al,al jz short finished mov ah,0Eh mov bx,0007h int 10h jmp Print finished: retn
;ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß ; Various Messages Displayed ;ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
WelcomeMsg db 13,10,"Welcome To TestOS",13,10,0 PressKey db "Press Any Key To Continue....",0 LoadingMsg db 13,10,13,10,"Loading TestOS...",0 vendorid2 db 13,10,"CPU Vendor : ",0 vendorid db " ",13,10,13,10,0
;ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß ; Other Variables ;ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
SectorNo db 02h
;ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß ; BootSector - 512 bytes... ;ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
fill db 510-($-start) dup(?) ; Fill upto 510 bytes
;ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß ; Boot Loader Signature ;ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
dw 0AA55h ; Boot Loader Signature
end start ---------- </boot.asm> ------------
You can find the rest of the code here
|
|
Last Updated ( Sunday, 05 August 2007 )
|
Share this page...
|
| |
|
|
|