[boot] Read stuff

This commit is contained in:
Kevin Lange 2011-02-21 14:58:27 -06:00
parent 987b1a07d3
commit 76c8c1652f
3 changed files with 24 additions and 0 deletions

View File

@ -98,6 +98,8 @@ bootloader/stage2.bin: bootloader/stage2/main.o bootloader/stage2/start.o bootlo
@${LD} -o bootloader/stage2.bin -T bootloader/stage2/link.ld bootloader/stage2/start.o bootloader/stage2/main.o
@${ECHO} "\r\033[32;1m ld $<\033[0m"
testdisk: bootloader/stage1.bin bootloader/stage2.bin
cat bootloader/stage1.bin herp bootloader/stage1.bin > testdisk
###############
# clean #

View File

@ -19,6 +19,14 @@ void kprint(short s)
int main() {
kprint((short)(int)"Welcome to C!\r\n");
__asm__("calll _readn");
kprint((short)(int)"Contents of 0x7e00:\r\n");
kprint(0x7e00);
kprint((short)(int)"[end]\r\n");
/* And that's it for now... */
__asm__ __volatile__ ("hlt");
while (1) {};

View File

@ -19,6 +19,7 @@
.global _start
.global _print
.global _readn
_start:
movw $0x00,%ax # Initialize segments...
movw %ax,%ds # ... data
@ -37,6 +38,19 @@ _start:
calll _print # ...
hlt
_readn:
movw $0x0000, %ax # We are segment 0...
movw %ax, %es
movw $0x7e00, %bx # Address to put output
movb $0x01, %al # Count
movb $0x00, %ch # Track
movb $0x02, %cl # Sector
movb $0x00, %dh # Head
movb $0x80, %dl # Disk
movb $0x02, %ah # Command number
int $0x13
retl
_print:
movb $0x0E,%ah # set registers for
movb $0x00,%bh # bios video call