Page 1 of 1

cli in fasm (in >fasm<)

Posted: Sat Nov 22, 2008 9:12 am
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

Re: cli in fasm (in >fasm<)

Posted: Sat Nov 22, 2008 9:22 am
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

Re: cli in fasm (in >fasm<)

Posted: Sat Nov 22, 2008 10:49 am
by VolTeK
thanks ill take a look at it

Re: cli in fasm (in >fasm<)

Posted: Sat Nov 22, 2008 10:58 am
by VolTeK
alright i will use it and convert it from nasm, but wheres the source?

Re: cli in fasm (in >fasm<)

Posted: Sat Nov 22, 2008 12:23 pm
by M-Saunders
In the 'source' directory :-) os_cli.asm in 2.0, or features/cli.asm in 2.9.3.

M

Re: cli in fasm (in >fasm<)

Posted: Sat Nov 22, 2008 12:46 pm
by VolTeK
yep found it in the down load, thanks for the information!

Re: cli in fasm (in >fasm<)

Posted: Sat Nov 22, 2008 1:08 pm
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

Re: cli in fasm (in >fasm<)

Posted: Sat Nov 22, 2008 1:41 pm
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

Re: cli in fasm (in >fasm<)

Posted: Wed Dec 03, 2008 9:35 am
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.