Message board for the users of flat assembler.
> OS Construction > I Have A Problem With Command Interpreter
Goto page 1, 2, 3 Next
Dexter 10 Jul 2004, 12:11
Look at the code
It's explained everything in the file
|10 Jul 2004, 12:11||
crc 10 Jul 2004, 13:58
Here's a fixed version (I rewrote the CStr procedure and modified the keyboard procedure as well)
ORG 100H USE16 include 'macros.inc' push cs pop ax mov ds,ax mov es,ax mov ax,03h int 10h callp WriteStr,0,1,0,9,Intro callp WriteStr,0,2,0,12,Prompt Main: callp WriteKey,5,2,0,10,Command push $ callp CStr,Command,SkipMe cmp ax,0 jz .Skipme callp CStr,Command,Ver cmp ax,0 jz .CVer callp CStr,Command,Exit cmp ax,0 jz CExit pop cx callp CLine,5,2,0 jmp Main .CVer: call CVer ; Functions need simple wrappers to work properly jmp Main ; You can't just RET from a jump, so we jump, then call .Skipme: jmp Main ; Used to handle an error I haven't traced yet proc CStr,a,b begin mov si, [a] mov di, [b] .a: mov ax, [si] cmp ax, [di] jnz .e cmp ax, 0 jz .b inc si inc di jmp .a .b: xor ax, ax .e: endp proc WriteKey,x,y,b,f,buff begin mov cx,[x] mov dx,126 add dx,cx mov di,[buff] .aloop: mov [di],byte 0 xor ax,ax int 16h cmp al,13 je .e cmp cx,dx je .e mov [di],al pusha callp WriteStr,cx,[y],[b],[f],di popa inc cx inc di jmp .aloop .e: endp proc Cls,c begin mov ax,0B800h mov es,ax xor di,di mov ah, byte [c] shl ah, 4 or ah, al mov cx,4000 rep stosw endp proc CLine,x,y,c begin mov ax, [y] dec ax mov cx, 80 mul cx add ax, [x] shl ax, 1 mov di, ax mov ax,0B800h mov es,ax mov ah, byte [c] shl ah, 4 or ah, al mov cx, 160 rep stosw endp proc WriteStr,x,y,b,f,msg begin pusha mov ax,0B800h mov es,ax mov ax, [y] dec ax mov cx, 80 mul cx add ax, [x] shl ax, 1 mov di, ax mov si, [msg] mov ah, byte [b] mov al, byte [f] shl ah, 4 or ah, al lodsb Continue: stosw lodsb or al, 0 jnz Continue popa endp CVer: callp WriteStr,0,1,0,15,Ver ret CCls: callp Cls,'a' ret CExit: int 20h Intro db 'Command interpreter',0 Prompt db 'xcmd>',0 Ver db 'ver',0 Exit db 'exit',0 RAM db 'ram',0 SkipMe db 'skipme',0 Command: times 128 db 0
|10 Jul 2004, 13:58||
crc 10 Jul 2004, 14:01
Pesonally, I'd recommend scrapping the procedures and using normal routines + macros instead. Procs make the code more confusing than it actually needs to be IMO. Either way, good luck with this
|10 Jul 2004, 14:01||
Gambino 11 Jul 2004, 14:35
Great it's working
We will see the first version very soon
I will wait to see what Dexter says...
Should i create a forum for this OS wannabe ?
( i can make a forum for this but it will not be even 60% up and running because of the internet connection )
Or posting here is fine ?
|11 Jul 2004, 14:35||
Gambino 11 Jul 2004, 20:35
Here Is The Very First Working Version...
Made By Dexter And Me
crc can u replace the writestr procedure with your writestr macro ?
The macro is much better because we don't need 0 terminated strings
and we can pass the string directly
|11 Jul 2004, 20:35||
Gambino 12 Jul 2004, 05:03
This is the 3rd post and still no response....
Oh well here is the second release of XBIOC
There is a new WriteStr procedure wich allows multiple attributes in a string and i added the blink feature too ( just add blink to the foreground color, you can view the full efect with the 'ver' command )
Type 'help' For A List Of Commands...
Have Fun With This... And Tell Me What You Think...
Ahhh....almost forgot, crc can u make a proc that converts a hex/integer value to string ?
Last edited by Gambino on 12 Jul 2004, 05:20; edited 1 time in total
|12 Jul 2004, 05:03||
crc 12 Jul 2004, 05:14
I'm working on both things you asked for, just be patient -- I have a lot to do today
|12 Jul 2004, 05:14||
Gambino 12 Jul 2004, 06:58
Did u like the new version
Encourage us to work more, tell us nice things about XBIOC
Waiting for reply.....
|12 Jul 2004, 06:58||
pelaillo 12 Jul 2004, 13:26
This is good stuff !
Write a bootsector as loader for your command-liner and the OS can start kicking
btw. This is going to work with STDIN, STDOUT, STDERR?
btw2. There is a version without szStrings?
|12 Jul 2004, 13:26||
ASHLEY4 12 Jul 2004, 16:49
Nice work, have you seen this program?, its called "bootprog" it loads a com or exe from a floppy disk, just put your prog on a floppy and restart your pc and it will boot it. you can not use dos int as there is no dos, but you can use bios int.
I us it for my os testing and its the best prog i,v found.
You can get it from here: http://alexfru.chat.ru/epm.html
Its called "bootprog.zip" , just read the readme file and have fun
|12 Jul 2004, 16:49||
Gomer73 12 Jul 2004, 17:11
For printing out hex, you can use my routines in my vesa info prog(cv.asm) found on this forum.
print_dec.end_numb is where everything gets printed(including hex). print_hex prints a word, print_hex_big prints a dword. It prints it without lead zero, so 1 would be printed as 1 and not 00000001.
Thanks to Bogdan for giving the hex convertor without using jmps, I modified it a bit to save an instruction or two.
Here is the code though:
push word 0
push word 0
push word ','
push word 0
|12 Jul 2004, 17:11||
Gambino 13 Jul 2004, 14:18
Now me and Dexter we are working on a 'dir' command
So posting will delay a bit until we finish that...
Also making the os wannabe to boot from floppy
Gomer73 , i can't use that ! this is an os wannabe , we don't have int 21h (int 21h works only in DOS), i will modify how the routine prints.
btw. This is going to work with STDIN, STDOUT, STDERR?
pelaillo i will let Dexter answer those two...
( i don't know what STDIN,STDOUT,STDERR stands for... Silly Me )
( szStrings ?!? hmmm... explain better i'm from Romania )
btw Nice screenshot
|13 Jul 2004, 14:18||
Dexter 13 Jul 2004, 19:24
if szStrings means zero terminated string
I ask you, what is the problem why do you whant to change it ?
do you whant to calculate the size your self as for
This is going to work with STDIN, STDOUT, STDERR?
I don't understand explain better
I am glad you liked our "console"
|13 Jul 2004, 19:24||
Gomer73 14 Jul 2004, 16:27
STDIN, STDOUT, STDERR stand for standard in, out, and error.
These are basically file handle type things.
stdin usually comes from the keyboard, but you can "pipe" it from another file.
stdout typically goes to the screen, but you can also "pipe" it to a file or the input of another file.
same thing with stderr, handy if you only want the errors going to a log file.
For my program it uses stdout, which is why I used the int 21 rather than the int 10.
Unless you use the dos stuff, this would require significant programming, because you would need to create your own stream architecture.
|14 Jul 2004, 16:27||
Gambino 18 Jul 2004, 14:32
Sorry for not posting for so long, but we was bussy with exams...
In a few days we will continue to work on XBIOC...
Btw we did make XBIOC boot from floppy ( That was a piece of cake )
Any idea how to find out how much RAM has a computer ?
( Found some ints but they are old and only report 64MB max so they are no good.... )
|18 Jul 2004, 14:32||
Gambino 24 Jul 2004, 20:54
I see that everybody lost interest on this one....
Nobody is posting anymore...
|24 Jul 2004, 20:54||
crc 24 Jul 2004, 22:48
Just because no one is posting doesn't mean there is no interest. For me, I'm pretty busy with work (retail; we're starting to approach the holiday season) and am finishing up RetroForth 7.0; I'll continue to do some hacking on XBIOC in early August
|24 Jul 2004, 22:48||
Gambino 26 Jul 2004, 07:09
OK Nice to hear that !!!
Some good news... did that 'how much ram a computer has' thingie
( 2 routines wich do the same thing... u will understand better when i will upload the latest release )
Also added 3 new (crappy, but useful) commands:
Ram - Finally Made This... Displays Total Memory
Reboot - Restarts The Computer (doh!)
Shutdown - Turns Off Computer ( APM Power Off Command )
And 2 routines :
Hex2Str converts hex value in str like : Input
mov eax,1234FACEh (can be a var)
string db '1234FACEh',0
Dec2Str converts decimal value in str : idem
Stay tuned for the new release....
|26 Jul 2004, 07:09||
ASHLEY4 26 Jul 2004, 14:33
This is code for v2os command.com for pmode, int 20h is the int's for v2os like dos's int 21h.
[BITS 32] ;Set code generation to 32 bit mode[ORG 0x0100] ;Set code start address to 0100h[SEGMENT .text] ;Main code segmentmain:mov ah, 46call clear_screencall welcome_msgjmp disp_promptwelcome_msg:mov al, 4mov edi, welcome_strint 0x20retdisp_prompt:mov al, 4mov edi, prompt_strint 0x20user_input:mov al, 40mov edi, input_strint 0x20call upper_casetest_input:;Begin test for directory commandmov esi, dir_test_strmov edi, input_strmov al, 30int 0x20test al, aljz dir_command;Begin test for reboot commandmov esi, reboot_strmov edi, input_strmov al, 30int 0x20test al, aljz reboot_command;Begin test for exit commandmov esi, exit_strmov edi, input_strmov al, 30int 0x20test al, aljz exit;Begin test for cls commandmov esi, cls_strmov edi, input_strmov al, 30int 0x20test al, aljz cls_command;Begin test for help commandmov esi, help_strmov edi, input_strmov al, 30int 0x20test al, aljz help_commandexecute_input:mov al, 4mov edi, temp_msgint 0x20jmp disp_promptreboot_command:mov al, 13int 0x20help_command:mov al, 4mov edi, help_msgint 0x20jmp disp_promptcls_command:mov ah, 46call clear_screenjmp disp_promptdir_command:mov al, 25mov edi, dirint 0x20jmp disp_promptupper_case:mov esi, input_strmov al, 31int 0x20retclear_screen:mov al, 4mov edi, blankint 0x20dec ahjnz clear_screenretexit:retf[SEGMENT .data] ;Initialised data segmentprompt_str: db 'A:\>',0temp_msg: db 'Bad command or file name',13,10,0dir: db 'files',0dir_test_str: db 'DIR',0exit_str: db 'EXIT',0reboot_str: db 'REBOOT',0cls_str: db 'CLS',0help_str: db 'HELP',0input_str: times 256 db 0blank: db ' ',13,10,0;temp_buff: times 255 db 0welcome_str: db 13,10,'Ã›ÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃ›',13,10 db 'Ã› Welcome to V2-DOS. Ã›',13,10 db 'Ã› Ã›',13,10 db 'Ã› by: Ã›',13,10 db 'Ã› Stalin Ã›',13,10 db 'Ã›ÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃ›',13,10,13,10,0help_msg: db 13,10,'Ã›ÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃŸÃ›',13,10 db 'Ã› dir: list files Ã›',13,10 db 'Ã› cls: clear screen Ã›',13,10 db 'Ã› exit: exit shell Ã›',13,10 db 'Ã› reboot: quick reboot Ã›',13,10 db 'Ã›ÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃœÃ›',13,10,13,10,0
|26 Jul 2004, 14:33||
Gambino 26 Jul 2004, 18:16
You posted on the wrong topic or i don't get it...
What is this that code for ...
It's a command interpreter like ours, but why did u post that code ?
I don't see nothing helpful in that code and all those commands except 'dir' where already implemented in the version that will be released in a few days...
P.S. Where is the source of the int20 ?
|26 Jul 2004, 18:16||
|Goto page 1, 2, 3 Next
< Last Thread | Next Thread >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.