flat assembler
Message board for the users of flat assembler.

Index > OS Construction > OS Loader dont works

Author
Thread Post new topic Reply to topic
sadosex



Joined: 26 Jan 2020
Posts: 2
sadosex
I make a bootstrap program to be installed on boot sector of TAILS, Windows however the software that i make only work showing the boot message to the user when s/he power on the PC and startup my OS bootloader. I dont know what are wrong at my source because my source works on MS-DOS however dont works in Windows or TAILS Linux. Read carefully my source in FASM:

Code:
org 0x100
OS_LOADER:
    cli       
    xor ax,ax
    mov ds,ax
    mov es,ax
    mov ss,ax
    mov sp,07C00h
    sti
    Kernel:

    MOV AX,1300h
    MOV BX,30h
    MOV CX,10Ch
    MOV DX,0
    PUSH CS
    POP ES
    MOV BP,7C68h
    INT 10h
    L1:
    IN AL,60H
    CMP AL,1
    JNZ L1
    JMP L2
    Texto db "",0   ;198 bytes message
    L2:
    mov ah,8
    mov dl,80H
    mov di,0
    push es
    mov es,di
    INT 13H
    pop es 
    sub cl,6

    mov ax,0000h
    mov es,ax
    mov bx,500h
    mov dl,80h
    mov al,01h
    mov ah,02h
    int 13h
    jmp 0000:0500h

    codesize:

    SETOR db 512 dup (0)

Please someone tell me where is my error in my source.    
Post 26 Jan 2020, 11:35
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
The first thing I notice is that you don't have the AA55 signature at the end of the 512-byte boot sector.
Post 26 Jan 2020, 17:21
View user's profile Send private message Visit poster's website Reply with quote
N-LG



Joined: 14 Feb 2019
Posts: 37
Location: france
N-LG
this program seem to be write for an execution in Dos (the .com format) because of the org 0x100 directive

there are almost no comments, it does not make reading possible, I am lazy to find out what each call corresponds to so that I can say what is wrong
Post 26 Jan 2020, 22:31
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 821
Location: Belarus
DimonSoft
Apart from other things already mentioned, you have no notion of filling CX and DH registers before reading from disk. int 13h/08h doesn’t return meaningful values for int 13h/02h and, for floppies, may not return meaningful values at all.
Post 27 Jan 2020, 13:53
View user's profile Send private message Visit poster's website Reply with quote
sadosex



Joined: 26 Jan 2020
Posts: 2
sadosex
That is my full source:
Code:
org 0x100
mov ax,201h
mov bx,SETOR
mov cx,1
mov dx,80H
int 13h

mov ah,8
mov dx,80H
mov di,0
push es
mov es,di
INT 13H
pop es

mov ax,301h
sub cl,6
mov dl,80H
MOV WORD[SETOR+510],0AA55H
mov bx,SETOR
INT 13H

LEA DI,[SETOR]
MOV SI,OS_LOADER
MOV CX,336
REP MOVSB

mov bx,SETOR
MOV WORD[SETOR+510],0AA55H
mov ax,301h
mov cx,1
mov dx,80H
INT 13H

ret
OS_LOADER:
            cli       
            xor ax,ax
            mov ds,ax
            mov es,ax
            mov ss,ax
            mov sp,07C00h
            sti
                Kernel:

MOV AX,1300h
MOV BX,30h
MOV CX,10Ch
MOV DX,0
PUSH CS
POP ES
MOV BP,7C68h
INT 10h
L1:
IN AL,60H
CMP AL,1
JNZ L1
JMP L2
Texto db "",0   ;message of 198 bytes
L2:
mov ah,8
mov dl,80H
mov di,0
push es
mov es,di
INT 13H
pop es
sub cl,6

mov ax,0000h
mov es,ax
mov bx,500h
mov dl,80h
mov al,01h
mov ah,02h
int 13h
jmp 0000:0500h

codesize:

SETOR db 512 dup (0)

    

Now tell me why i couldn't install my boot loader in Linux and Windows?
Post 27 Jan 2020, 14:45
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.