flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > test request... |
Author |
|
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 . |
|||
30 Jul 2008, 14:27 |
|
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... |
|||
31 Jul 2008, 00:03 |
|
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.
|
|||
31 Jul 2008, 00:14 |
|
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 Then if we all do that, it will help others. |
|||
31 Jul 2008, 14:46 |
|
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. |
|||
01 Aug 2008, 01:39 |
|
Dex4u 01 Aug 2008, 14:09
First this does not help anyone
abuashraf wrote:
You need to say what happens when you add a new command. |
|||
01 Aug 2008, 14:09 |
|
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 |
|||
02 Aug 2008, 08:32 |
|
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 |
|||
02 Aug 2008, 14:30 |
|
abuashraf 02 Aug 2008, 18:29
Thank you Dex,it's working now.
|
|||
02 Aug 2008, 18:29 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.