[BITS 16] ;This tells us we are using 16 Bits
[ORG 0x7C00] ;We need to tell it the origin now
start:
jmp $
times 510-($-$$) db 0 ;This fills the rest of unused space with 0s
dw 0xAA55 ;Now our signature
[BITS 16] ;This tells us we are using 16 Bits
[ORG 0x7C00] ;We need to tell it the origin now
start:
xor ax, ax ; Make AX = 0
mov cs, ax ; Setup our registers
mov ds, ax ; Setup our registers
mov es, ax ; Setup our registers
mov fs, ax ; Setup our registers
mov ah, 0Eh
mov al, 'J'
mov bh, 0
mov bl, 0x07
int 10h
jmp $
times 510-($-$$) db 0 ;This fills the rest of unused space with 0s
dw 0xAA55 ;Now our signature
[BITS 16] ;This tells us we are using 16 Bits
[ORG 0x7C00] ;We need to tell it the origin now
start:
;xor ax, ax ; Make AX = 0
;mov cs, ax ; Setup our registers
;mov ds, ax ; Setup our registers
;mov es, ax ; Setup our registers
;mov fs, ax ; Setup our registers
mov ah, 0Eh
mov bh, 0
mov bl, 0x07
mov al, 'J'
int 10h
mov al, 'o'
int 10h
mov al, 'e'
int 10h
mov al, 'O'
int 10h
mov al, 'S'
int 10h
jmp $
times 510-($-$$) db 0 ;This fills the rest of unused space with 0s
dw 0xAA55 ;Now our signature
;-----------------------------------------------------------------------------------------
; These are my string constats. 0x01 is a smily face, 0x0D is a CR, 0x0A is a LF, and 0x00
; is a null terminator. Anything in quotes is the text of the string.
msgwelcome db "Welcome to JoeOS by Joe[x86]! ", 0x01, 0x0D, 0x0A, 0x00
msghalt db "Bootloader halted.", 0x0D, 0x0A, 0x00
msgshutdownsafe db "It is now safe to shutdown your computer.", 0x0D, 0x0A, 0x00
msgnewline db 0x0D, 0x0A, 0x00
; ----------------------------------------------------------------------------------------
; Here is the information that shows the processor where the origin of the bootloader is,
; and how many bits we're using.
[BITS 16] ; This tells us we are using 16 Bits
[ORG 0x0] ; Origin = 0x00
jmp 0x7c0:start ; Set start to 0x07C0 and start the procecdure "start" there
;-----------------------------------------------------------------------------------------
; This is my start procedure. This initiates the operating system environment, and calls
; my print procedure to display some messages
start:
xor ax, ax
mov ax, cs
mov ds, ax
mov es, ax
mov fs, ax
; Here I set the value of ax, ds, es, and fs to 0. I cant access these directly, so I xor
; ax to make it zero and move it to each of them.
mov si, msgwelcome
call print
; "Welcome to JoeOS by Joe[x86]! (smile)"
mov si, msghalt
callcprint
; "Bootloader halted."
mov si, msgshutdownsafe
call print
; "It is now safe to shutdown your computer."
jmp $ ; Hang
times 510-($-$$) db 0 ; This fills the rest of unused space with 0s
dw 0xAA55 ; Include bootloader signature
;-----------------------------------------------------------------------------------------
; Here is the print procedure I will be using. Written by Warrior[x86]. Broken. =/.
print:
mov ah, 0x10
mov bh, 0x00 ; Page = 0
mov bl, 0x09 ; Color = Blue
lodsb ; Load SI into AL
cmp al, 0 ; If we hit a null terminator..
je .Done ; Go to the label ".Done"
int 0x10 ; print the character
jmp print ; print until the whole string is printed
.Done: ; The label ".Done"
ret
[15:25:22] <Joe[x86]2> wtf
[15:25:24] <Joe[x86]2> well
[15:25:30] <Joe[x86]2> It loads stage 1 just fine
[15:25:37] <Joe[x86]2> attempts to load stage two
[15:25:38] <Joe[x86]2> and does
[15:25:39] <Joe[x86]2> and
[15:25:49] <Joe[x86]2> stage two prints its welcome message.. *counts*
[15:25:57] <Joe[x86]2> 10 fucking times
Quote[15:25:22] <Joe[x86]2> wtf
[15:25:24] <Joe[x86]2> well
[15:25:30] <Joe[x86]2> It loads stage 1 just fine
[15:25:37] <Joe[x86]2> attempts to load stage two
[15:25:38] <Joe[x86]2> and does
[15:25:39] <Joe[x86]2> and
[15:25:49] <Joe[x86]2> stage two prints its welcome message.. *counts*
[15:25:57] <Joe[x86]2> 10 fucking times
Oh man, I need to cut myself. I've done a lot of cutting myself lately. By the way, I hope you know I'm not serious about cutting myself. I haven't even hit my head against the wall yet.
You know I don't like people talking about my BO issue. =(Well, its public now.
Shut up. You know I don't like people talking about my BO issue. =(
I already fixed it. I was ret'ing instead of jmp'ing.
It's just a joke, he doesn't have a BO problem. We're just trying to make people laugh!
Then post a picture of your mom.
Also Joe what advantage does JoeOS have over say Windows XP? I've been thinking of down-grading to the stone age but I don't know if you are there yet.
AH = 0Eh
AL = character to write
BH = page number
BL = foreground color (graphics modes only)
printf:
; Take in the arguments
pop ax ; String length
pop bx ; String pointer
; Set the interrupt arguments
mov ah, 0Eh
mov bh, 0
mov bl, 07h
xor cx, cx ; cx is counter, set to 0
.startloop
mv al, [bx+cx] ;[bx+cx] is the character to print
int 10h
cmp cx, ax
je .end
jmp startloop
.end
ret
I'm still not confortable using the stack before PMode, it's more to cleanup and the same could be acomplished by using the registers which are doing very little..You know, even DOS C libraries had printf. Psh.