Kernel and instruction in C

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
PJ

Kernel and instruction in C

Post by PJ »

write instruction in asm:

_next_line:
mov ah, 0Eh
mov al, 0Dh
int 10h
mov al, 0Ah
int 10h
ret

How write instruction in asm runinng in C??

_print: ........?


_scan: .........?


HELP!!!!!
DennisCGc

Re:Kernel and instruction in C

Post by DennisCGc »

#include <stdio.h>
printf ("\n"); ;)
I don't know when you use it, but should be okay for now ::)
Else you could use inline assembly.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Kernel and instruction in C

Post by Solar »

Dennis, that's nonsense. ???

You can't include anything from the standard library in kernel space because you don't have a standard library in kernel space (unless you ported or implemented one).
Every good solution is obvious once you've found it.
DennisCGc

Re:Kernel and instruction in C

Post by DennisCGc »

Solar wrote: Dennis, that's nonsense. ???

You can't include anything from the standard library in kernel space because you don't have a standard library in kernel space (unless you ported or implemented one).
Oops :-[
He should take a look at the website of Chris Giese www.execpc.com/~geezer
I'm sure he could find some information.
And another thing!
I'm not a C guru, I'm just trying to help ;)
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Kernel and instruction in C

Post by Solar »

No offense intended. I wish it were that easy myself. ;)
Every good solution is obvious once you've found it.
PJ

Re:Kernel and instruction in C

Post by PJ »

Thanks :D

I please demo function in asm please (printf and scanf)

a'la this:

_next_line:
mov ah, 0Eh
mov al, 0Dh
int 10h
mov al, 0Ah
int 10h
ret


Thanks all :D links is good idea :D
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Kernel and instruction in C

Post by Solar »

Check out the FAQ entry Some small kernels with source.

I'm afraid you will not find "the" solution for your problem. printf() and scanf() both assume the existence of a stdin and a stdout, neither of which are available in kernel space (unless you implement them yourself). For the keyboard, you need an interrupt handler. You have the option to implement your output in text or graphics mode. Lots of design decisions - and that's why we're here in the first place, isn't it? ;-)
Every good solution is obvious once you've found it.
Schol-R-LEA

Re:Kernel and instruction in C

Post by Schol-R-LEA »

Er, perhaps we should back up a bit. PJ, could you clarify what you need? Are you trying to call an assembly language function from C (or vis versa)? Trying to use inline assembly code in a C function? Trying to write a printf() function? Some combination of those? Something else?
PJ

Re:Kernel and instruction in C

Post by PJ »

I please links to all tutorials and FAQ of this my problem.

Please!!!

I lite speak english :(


Thanks ALL!! :D
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Kernel and instruction in C

Post by Solar »

Hmm... I am not sure all the FAQ's and tutorials would help you since virtually all of them are in English... and, as Schol-R-LEA correctly pointed out, we're still not even sure what your problem is. You're probably better of trying to explain to us so we can explain to you...

BTW, what is your native language? Perhaps someone speaking the same language is in a mind of contacting you by e-mail...
Every good solution is obvious once you've found it.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Kernel and instruction in C

Post by Pype.Clicker »

Solar wrote: BTW, what is your native language? Perhaps someone speaking the same language is in a mind of contacting you by e-mail...
Given the ".pl" extension of his mailbox, i guess he's from Poland (hope that's the correct spelling)...
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Kernel and instruction in C

Post by Solar »

You're right, of course... *stupidme*...

All I can offer is German... :-\
Every good solution is obvious once you've found it.
Adek336

Re:Kernel and instruction in C

Post by Adek336 »

May I humbly offer my help? Polish- that's my native language.

W czym moge sluzyc, PJ? Zyczysz sobie napisac printf w asm, czy wykorzystac funkcje z asm w C, czy .. ?

(english:How can I help you PJ, do you want to write printf in asm or use an asm routine in C.)

Cheers,
Adrian
PJ

Re:Kernel and instruction in C

Post by PJ »

Chodzi mi o jakieś wytłumaczenie na temat tworzenia funkcji C w asm tzn jak trzeba je konstruować, jak się dane pobiera, jakie są podstawowe przerywania itp może masz jakieś linki o tym a może nawet po polsku?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Kernel and instruction in C

Post by Pype.Clicker »

glad to see you finally found each other ... may i suggest you continue the discussion through a private channel ... the poor us that do not have cyrillic support installed see &#12345678; everywhere ::)
Post Reply