Results 1 to 2 of 2
Hi I'm trying to create a boot disk and I have a few questions
In the code below I basically copy some assembler code from the boot file into the ...
- 04-30-2009 #1
[SOLVED] Creating a boot disk
Hi I'm trying to create a boot disk and I have a few questions
In the code below I basically copy some assembler code from the boot file into the array ch and then I set ch[510] = 0x55, ch[511] = 0xaa. Why do I set the the byte ch[510] = 0x55 and ch[511] = 0xaa?
and question two - how could I get the assembler code below to display some characters. The examples I found on the Internet said to:Code:#include <stdio.h> #include <stdlib.h> #include <fcntl.h> int main(int argc, char**argv) { char ch[512]; int fd = open("boot", O_RDONLY); read(fd, ch, 512); close(fd); fd = open("/dev/fd0", O_RDWR); lseek(fd, 0, SEEK_CUR); ch[510] = 0x55; ch[511] = 0xaa; write(fd, ch, 512); close(fd); exit(EXIT_SUCCESS); }
movw $0xb800, %ax
movw %ax, %es
to here I have no problems
but the next two lines???
I have to move $0x41 into the address 0000 with offset %es or $0xb800
and move $0x1f into address 0001 with offset %es or $0xb800
movb $0x41, into address 0000 with offset 0xb800
movb $0x1f, into address 0000 with offset 0xb8000
this I don't know how to do??
Code:.section .data .section .bss .section .text .global _start _start: loop1: jmp loop1
Make mine Arch Linux
- 04-30-2009 #2
Found the answer...
Code:.code16 .section .data .section .bss .section .text .global _start _start: movw $0xb800, %ax movw %ax, %es movb $0x41, %es:0 movb $0x1f, %es:1 loop1: jmp loop1
Make mine Arch Linux


