Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

inline assembly print function not working

$
0
0

Here is my new kernel code that should print a(btw the reason it's called printstack is because I'm trying to pass parameters by stack, but that didn't work):

void printstack(char in){ /*print function*/       asm ("mov ah,0x0e\n""mov al,%0\n""int 0x10\n"    ::"r"(in)    ); }void main(){ /*kernel entry point*/  printstack('a');}

However when I test it in QEMU, it only print spaces.

Here is the full script that build os.flp:

 echo ">>> Creating floppy image..."   mkdosfs -C os.flp 1440 || exit       echo ">>> Assembling bootloader..."    nasm -O0 -w+orphan-labels -f bin -o source/bootload/bootload.bin source/bootload/bootload.asm || exit    echo "compiling kernel"    gcc -c ./source/kernel.c -masm=intel     ld --oformat binary kernel.o -o ./source/kernel.bin  -e main    echo ">>> Adding bootloader to floppy image..."    dd status=noxfer conv=notrunc if=source/bootload/bootload.bin   of=os.flp || exit    echo ">>> Copying kernel"    rm -rf tmp-loop    mkdir tmp-loop && mount -o loop -t vfat os.flp tmp-loop && cp source/kernel.bin tmp-loop/    sleep 0.2    echo ">>> Unmounting loopback floppy..."    umount tmp-loop || exit    rm -rf tmp-loopt    echo '>>> Done!'

Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>