flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Problem with printing text :(

Author
Thread Post new topic Reply to topic
DataHunter2009



Joined: 10 Jun 2005
Posts: 144
DataHunter2009 13 Sep 2005, 00:12
Hello! I'm writing my first OS in FASM, but I am having problems! I am booting in to 16 bit real mode and trying to print text, but it just hangs in VMWare! (I don't have another computer to test it on yet).

Here's my code:
Code:
org 0x7C00 

use16
; START REALMODE

start:
        xor   ax,ax
        mov   ds,ax
        mov   es,ax
        mov   ss,ax
        mov   sp,0x7C00 

; TURN FLOPPY OFF

        mov   dx,3F2h
        mov   al,0
        out   dx,al

; PRINT TEXT

mov     si,HelloWorld
mov     ah,0Eh

HelloWorld  db  "Hello World!"    

Can anyone tell me what I have done wrong? Thanks! Very Happy
Post 13 Sep 2005, 00:12
View user's profile Send private message Reply with quote
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav 13 Sep 2005, 02:44
And what about int 16h?
Post 13 Sep 2005, 02:44
View user's profile Send private message Visit poster's website Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 13 Sep 2005, 03:16
Code:
mov     si,HelloWorld 
mov     ah,0Eh 
.loop:
mov al,[si]
or al,al
jz .done
int 10h
inc si
jmp .loop

.done:
xor ah,ah
int 16h

HelloWorld  db  "Hello World!",0
    
Post 13 Sep 2005, 03:16
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 13 Sep 2005, 12:56
As your making a realmode OS, you should do this at the end of Matrix text code:
Code:
.done:      jmp $    


And you only need the turn off floppy if your going to pmode.
Post 13 Sep 2005, 12:56
View user's profile Send private message Reply with quote
DataHunter2009



Joined: 10 Jun 2005
Posts: 144
DataHunter2009 13 Sep 2005, 20:56
Thanks! That works! How would I go about printing more than one line?
Post 13 Sep 2005, 20:56
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 14 Sep 2005, 09:31
You could do some thing like this:
Code:
org 0x7C00 use16; START REALMODEstart:xor   ax,axmov   ds,axmov   es,axmov   ss,axmov   sp,0x7C00 ; PRINT TEXT FIRST MSGmov   si,HelloWorld1 mov   ah,0Eh call  print; PRINT TEXT SECOND MSGmov   si,HelloWorld2 mov   ah,0Eh call   printjmp   $;PRINTprint:.loop:mov al,[si]or al,aljz .doneint 10hinc sijmp .loop.done:ret;DATAHelloWorld1  db  "Hello World1",10,13,0HelloWorld2  db  "Hello World2",10,13,0    
Post 14 Sep 2005, 09:31
View user's profile Send private message Reply with quote
DataHunter2009



Joined: 10 Jun 2005
Posts: 144
DataHunter2009 14 Sep 2005, 20:54
Thanks! It works great! This helped me out alot Very Happy
Post 14 Sep 2005, 20:54
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.