cli in fasm (in >fasm<)

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
VolTeK
Member
Member
Posts: 815
Joined: Sat Nov 15, 2008 2:37 pm
Location: The Fire Nation

cli in fasm (in >fasm<)

Post by VolTeK »

could somebody give me some demo code on how to make my kernel do cli and get the users input. if you could give it to me in realmode that would be exelent
M-Saunders
Member
Member
Posts: 155
Joined: Fri Oct 27, 2006 5:11 am
Location: Oberbayern
Contact:

Re: cli in fasm (in >fasm<)

Post by M-Saunders »

My project (see sig) has a real mode CLI, albeit written for NASM syntax, but it'll be easy to convert.

M
MikeOS -- simple, well-documented x86 real-mode OS written in assembly language
http://mikeos.sourceforge.net
User avatar
VolTeK
Member
Member
Posts: 815
Joined: Sat Nov 15, 2008 2:37 pm
Location: The Fire Nation

Re: cli in fasm (in >fasm<)

Post by VolTeK »

thanks ill take a look at it
User avatar
VolTeK
Member
Member
Posts: 815
Joined: Sat Nov 15, 2008 2:37 pm
Location: The Fire Nation

Re: cli in fasm (in >fasm<)

Post by VolTeK »

alright i will use it and convert it from nasm, but wheres the source?
M-Saunders
Member
Member
Posts: 155
Joined: Fri Oct 27, 2006 5:11 am
Location: Oberbayern
Contact:

Re: cli in fasm (in >fasm<)

Post by M-Saunders »

In the 'source' directory :-) os_cli.asm in 2.0, or features/cli.asm in 2.9.3.

M
MikeOS -- simple, well-documented x86 real-mode OS written in assembly language
http://mikeos.sourceforge.net
User avatar
VolTeK
Member
Member
Posts: 815
Joined: Sat Nov 15, 2008 2:37 pm
Location: The Fire Nation

Re: cli in fasm (in >fasm<)

Post by VolTeK »

yep found it in the down load, thanks for the information!
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Re: cli in fasm (in >fasm<)

Post by Dex »

You could also take a look at MiniDos, which is real mode, written in fasm and has a CLI.
see here: http://board.flatassembler.net/topic.php?t=5275&start=0
User avatar
kmtdk
Member
Member
Posts: 263
Joined: Sat May 17, 2008 4:05 am
Location: Cyperspace, Denmark
Contact:

Re: cli in fasm (in >fasm<)

Post by kmtdk »

and if you have trouble programming the LDT ( when you have to tell the compiler, where the IRQ is) then ask here ( or look at the wiki)
because it can be a little tricky, if the address is above 1 mb ..

KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: cli in fasm (in >fasm<)

Post by bubach »

There's absolutely no fun in using other peoples code. Unless you have some valid reason (can't think of one right now), I suggest that you try to code it yourself first.

Break it down. What do you need to have a _very_ basic CLI taking commands?

You need keyboard input. (keyboard driver)
You need a function (using the driver) to read in 1 key
You need some loop that saves the typed characters into a buffer and also prints it to the screen.
Inside the loop you will have to add if statments for stuff like backspace and deal with it.
Inside the loop you'll need to check if the key entered was ENTER and if so call your "check for command" function.
Your check for command function can simply compare the string entered with an array of available commands. If the command wasn't found, print error + new prompt and go back to the loop. If the command was found somewhere in the array of available commands you can have another array with the addresses of the function to call. For example if it was command 3, jump to the address on location 3 in the function adress array.

This is basically what i do in assembly to get my CLI working.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
Post Reply