flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Some code that works on 1 PC: and nothing else

Author
Thread Post new topic Reply to topic
jatos



Joined: 04 Nov 2006
Posts: 20
jatos
Hi

I have this program which when compiled will boot of a floppy on my "Toshiba Libretto 100CT" laptop, which is VERY old. However, it won't boot properly on anything else.

Any suggestions much appreciated.
Code:
org 0x7C00
use16

app_start:

func_set_registers:
        MOV ax, 0xB800
      MOV es, ax
  LEA bp, [msg_1]
     MOV si, 0
   MOV bx, 0x0000
      MOV ax, 0x0000
      MOV cx, 0

func_print_string:
     MOV al, [ds:bp]
 CMP al, 0
   JE app_end
  MOV [es:bx], al    

 INC bp
      ADD bx, 2
   JMP func_print_string

jmp app_end

app_data:

   msg_1 db "Please wait while we load this OS", 0 

app_end:
      NOP
 NOP
 NOP
 NOP
 NOP
 NOP
 NOP
 NOP
 NOP
 NOP
 jmp app_end
    

_________________
Jamie
Post 01 Oct 2007, 13:56
View user's profile Send private message Reply with quote
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav
There are 2.5 problems with this program:
1. DS in not initialised - it appears that some BIOSes set it right to 0, other don't.
2. No boot signature - sometimes it is chrecked.
2.5. Only letters are printed, without attribute part - it may lead to invisible text, if BIOS clears the video memory.

Fixed code:
Code:

org 0x7C00
use16

app_start:

func_set_registers:
        MOV ax, 0xB800
        MOV es, ax
        MOV ax, 0x0000
        MOV ds, ax
        LEA bp, [msg_1]
        MOV si, 0
        MOV bx, 0x0000
        MOV ax, 0x0000
        MOV cx, 0
        mov ah,22

func_print_string:
        MOV al, [ds:bp]
        CMP al, 0
        JE app_end
        MOV [es:bx], ax   

        INC bp
        ADD bx, 2
        JMP func_print_string

jmp app_end

app_data:

        msg_1 db "Please wait while we load this OS", 0 

app_end:
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        jmp app_end 

rb 7c00h+512-2-$
sign1       db 055h
sign2        db 0AAh
    
Post 01 Oct 2007, 14:32
View user's profile Send private message Visit poster's website Reply with quote
jatos



Joined: 04 Nov 2006
Posts: 20
jatos
I will add code to clear the screen at some point, I also going to have to find the code for white on black.

Anyway thanks for that, hopefully my program will now work.
Post 01 Oct 2007, 16:04
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.

Powered by rwasa.