flat assembler
Message board for the users of flat assembler.

Index > OS Construction > test request...

Author
Thread Post new topic Reply to topic
abuashraf



Joined: 11 Nov 2006
Posts: 88
abuashraf 30 Jul 2008, 01:12
Hi guys,
I've wrote a simple real mode os,but I'm not so sure if it is stable,
beacuse every time I try to add a new command to it I get into a lot of troubles.
would you guys please check it and give me your opinion,and tell me
if there is somthing need to be changed.
here's a floppy image and the source code.


Thanx.


Last edited by abuashraf on 27 Aug 2008, 13:32; edited 1 time in total
Post 30 Jul 2008, 01:12
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 30 Jul 2008, 14:27
Do you know what one of these is
Code:
;-------------------------------------------------------;;                   MiniDos  kernel                     ;;             Coded by Dex(Craig Bamford)               ;;-------------------------------------------------------;;    MiniDos kernel, expects to be loaded at 60h        ;;  Assemble with fasm C:\fasm MiniDOS.asm MiniDOS.com   ;;                                                       ;;    Thank go to anyone who has helped me including     ;;   Tomasz Grysztar(fasm),Alexei A. Frounze(bootprog)   ;;                  Team Dex4u including                 ;;  bubach,crc,jas2o,tonyMac,smiddy,solidus117,redaman.  ;;     also Pype.Clicker and all Dex4u forum members.    ;;                                                       ;;                    www.dex4u.com                      ;;-------------------------------------------------------;    

Its called a acknowledgement, if you are going to use cut and past from other OS, you should play fair and acknowledge other's work.
quick example
MiniDos
Code:
;====================================================;;  Clear screen.                                     ;;====================================================;Cls:        mov   ax,0x0600                    ; AH=06 (scroll),AL=00 (full screen)        mov   bh,0x07                      ; Black background(0) white forground(7)        mov   cx,0x0000                    ; Upper left row:column        mov   dx,0x184f                    ; Lower right row:column        int   10h                          ; Call interrupt service        ret                                ; Return;====================================================;;  Set cursor.                                       ;;====================================================;Cursor:        mov   ah,02                        ; Request set cursor        mov   bh,00                        ; Page number 0        mov   dx,0x0100                    ; DH =row, DL= column        int   10h                          ; Call interrupt service        ret                                ; Return;====================================================;;  Welcome.                                          ;;====================================================;Welcome:           mov   si,mes                       ; Point SI to string        call  print                        ; Call print function        ret                                ; Return;====================================================;;  A: prompt.                                        ;;====================================================;Aprompt:        mov   si,Prompt                    ; Point SI to string        call  print                        ; Call print function        ret                                ; Return;====================================================;;  print.                                            ;;====================================================; print:        mov   ah,0Eh                       ; Request displayagain1:    lodsb                              ; load a byte into AL from DS:SI        or   al,al                         ; Or AL        jz   done1                         ; Jump 0, to label done1      int  10h                           ; Call interrupt service        jmp  again1                        ; Jump to label again1done1:    ret                                ; Return    

Your example
Code:
;-----------------------------------------------;; clear screan                                  ;;-----------------------------------------------;cls:        push    ax bx cx dx        mov     ax,0x0600                 ; AH=06 (scroll),AL=00 (full screen)        mov     bh,0x07                   ; Black background(0) white forground(7)        mov     cx,0x0000                 ; Upper left row:column        mov     dx,0x184f                 ; Lower right row:column        int     10h                       ; Call interrupt service        pop     dx cx bx ax        ret;-----------------------------------------------;;set cursor to 0x0                              ;;-----------------------------------------------;cursor:        push    ax bx dx        mov     ah,02                     ; Request set cursor        mov     bh,00                     ; Page number 0        mov     dx,0x0000                 ; DH =row, DL= column        int     10h                       ; Call interrupt service        pop     dx bx ax        ret;-----------------------------------------------;;prints a string,mov si,msg                     ;;-----------------------------------------------;print:        push    ax        mov     ah,0Eh                     ; Request displayagain1:      lodsb                              ; load a byte into AL from DS:SI        or      al,al                      ; Or AL        jz      done1                      ; Jump 0, to label done1      int     10h                        ; Call interrupt service        jmp     again1                     ; Jump to label again1done1:        pop     ax        ret                             ; Return;-----------------------------------------------;;prints welcome msg                             ;;-----------------------------------------------;welcome:        push    ds si        mov     si,mes                    ;point si to the welcome msg        call    print                     ;call print function        pop     si ds        ret                             ;return !;-----------------------------------------------;;prints out the prompt A:\                      ;;-----------------------------------------------;aprompt:        push    ds si        mov     si,prompt                 ;point si to the prompt msg        call    print                     ;call print function        pop     si ds        ret                             ;return !    

This is just a quick example, than maybe you will get help Mad .
Post 30 Jul 2008, 14:27
View user's profile Send private message Reply with quote
abuashraf



Joined: 11 Nov 2006
Posts: 88
abuashraf 31 Jul 2008, 00:03
To clear things up,I've used this five subroutine just for educational purpose,Also I'm writing a real mode os for educational purpose only,and if you're not comfortable for using this subroutine,I'll rewrite them.
the thing is I just liked your way of coding...
Post 31 Jul 2008, 00:03
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 31 Jul 2008, 00:14
abuashraf: it seems that Dex would be quite comfortable, as long as you give a little acknowledgement where you snipped the code from.
Post 31 Jul 2008, 00:14
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 31 Jul 2008, 14:46
fodder is right, you are free to use any part of MiniDos in your OS, i myself use snips from other peoples code, we all do.
But you should add the fact to your OS, you do not have to give names, just something like
Quote:
References
Here are some pages that were useful in the development of my OS
http://board.flatassembler.net/topic.php?t=5275&start=0

Then if we all do that, it will help others.
Post 31 Jul 2008, 14:46
View user's profile Send private message Reply with quote
abuashraf



Joined: 11 Nov 2006
Posts: 88
abuashraf 01 Aug 2008, 01:39
okay guys how about to tell me ,what bugs do I have in my os,
so I can fix it.
Post 01 Aug 2008, 01:39
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 01 Aug 2008, 14:09
First this does not help anyone
abuashraf wrote:

beacuse every time I try to add a new command to it I get into a lot of troubles.
would you guys please check it and give me your opinion,and tell me
if there is somthing need to be changed.

You need to say what happens when you add a new command.
Post 01 Aug 2008, 14:09
View user's profile Send private message Reply with quote
abuashraf



Joined: 11 Nov 2006
Posts: 88
abuashraf 02 Aug 2008, 08:32
Hi,

I've add a new command to search for a file name,
but every time I execute this command my os acts as it has just been loaded.
I mean instead of tell if if the file existed or not,it clears the screan and
prints the welcome message,could you please help me...

P.S: i tried this code in a .com prog and it worked well.


Last edited by abuashraf on 27 Aug 2008, 13:32; edited 1 time in total
Post 02 Aug 2008, 08:32
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 02 Aug 2008, 14:30
Just a quick look
Code:
search:        mov     cx,16        mov     di,[es:0x0400]          ;the buffer@.loop:        push    cx        mov     cx,0x000B               ;file name length        mov     si,image                    ;file name        push    di        rep     cmpsb        pop     di        je      found                   ;found the file        pop     cx        add     di,0x0020               ;go to the next root directory        loop    @.loop        jmp     notfound                ;file not found found:        mov     si,fon        call    print        jmp     @.quit notfound:        mov     si,nfon        call    print @.quit:        ret    

You push CX but than you have
je found ;found the file
Which would mean that CX does not get pop
So your stack is out of balance.
Try this:
Code:
search:        mov     cx,16        mov     di,[es:0x0400]          ;the buffer@.loop:        push    cx        mov     cx,0x000B               ;file name length        mov     si,image                   ;file name        push    di        rep     cmpsb        pop     di        pop     cx        je      found                   ;found the file        add     di,0x0020               ;go to the next root directory        loop    @.loop        jmp     notfound                ;file not found found:        mov     si,fon        call    print        jmp     @.quit notfound:        mov     si,nfon        call    print @.quit:        ret    
Post 02 Aug 2008, 14:30
View user's profile Send private message Reply with quote
abuashraf



Joined: 11 Nov 2006
Posts: 88
abuashraf 02 Aug 2008, 18:29
Thank you Dex,it's working now. Very Happy
Post 02 Aug 2008, 18:29
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.