puts() using asm
Posted: Sun Dec 16, 2007 2:51 am
Hi guys,
I've been studying Demo 5 a lot, and I was thinking we could implement <tt>puts()</tt> using inline assembly.
At the beginning of <tt>kmain()</tt>, there would be asm that defines the <tt>Print</tt> macro for printing the string.
Then there would be the <tt>puts()</tt> function itself. It would go something like this:
Anyone else like the idea? Anyone have a better idea? Anyone have some bugfixes?
EDIT: Wait, that'd only work for real mode....
I've been studying Demo 5 a lot, and I was thinking we could implement <tt>puts()</tt> using inline assembly.
At the beginning of <tt>kmain()</tt>, there would be asm that defines the <tt>Print</tt> macro for printing the string.
Then there would be the <tt>puts()</tt> function itself. It would go something like this:
Code: Select all
inline unsigned char _cdecl puts (unsigned char str)
{
_asm {
msg db str,13,10,0
mov si, msg
call Print
}
EDIT: Wait, that'd only work for real mode....