Assembly "variable" troubles
Posted: Fri Dec 04, 2009 5:25 pm
Hi Everyone.
I'm attempting to write a FAT 12 boot loader. Doing so the "header" of my boot sector contains
the BIOS Parameter block. It looks as follows (AT&T)
I'm linking with the following command ld --oformat binary -Ttext 7c00 -Tdata 7c10 -o boot boot.o
The problem is when I try to access the value of the entries in the header, e.g The value of %ax becomes 7, or 720 (hex).
I wrote the following tiny linux program (that does what is intended,set a "header" variable as the exit status
I do not grasp the difference, hope that someone, can enlighten me.
Thx
I'm attempting to write a FAT 12 boot loader. Doing so the "header" of my boot sector contains
the BIOS Parameter block. It looks as follows (AT&T)
Code: Select all
.code16
.text
.global _start
_start:
jmp begin
nop
bpbHeadsPerCylinder: .word 2
The problem is when I try to access the value of the entries in the header, e.g
Code: Select all
mov bpbHeadsPerCylinder,%ax
I wrote the following tiny linux program (that does what is intended,set a "header" variable as the exit status
Code: Select all
code
.section .text
.global _start
var: .byte 4
_start:
mov var,%bx
mov $1,%ax
int $0x80
Thx