nasm label problems
Posted: Wed Aug 06, 2003 12:07 am
hi, i have my main kernel file, kernel.asm which includes the file functions.asm. within functions.asm, there is a function named simple_print, this function looks like this
so when i compile this nasm complains saying 'symbol simple_print_label redefined'. yet if i take this label out i cant declare the local label below it (.load_label). i have also made sure that this label is not redefined anywhere else. i have tried every combination of labels i can find yet i cannot find out how to fix this problem, it gives the same error if i rename simple_print_label also. i have looked through the nasm manual but been unable to find anything about this error or find a label that will work correctly for me. functions.asm is being compiled because it is an include file in kernel.asm which is being compiled as an aout file.
thanks for your time,
Collin
Code: Select all
[global simple_print]
simple_print_label:
;args: point ds:si to the string you want to print
cld ;stosb increments esi, because DF is now clear
mov eax, 160 ;160 decimal is 80*2, or chars_per_line*bytes per char
mul ecx ;ecx * eax, product in eax
mov ecx, eax ;move product from eax to rightful place
mov eax, 0 ;clear eax cause we need it below
;video buffer starts at (pyscial) 0xb8000, 0xb8000 is the first char
; in the top left corner assuming a 80 char per line * 25 line screen
; so if we want to print starting on the second line we would put our
; text and color bytes at b8000 + A0 (160)
;video address is b800 in real mode so physical address is b8000
.load_label
lodsb ;load byte (our letter) at ds:si into al
mov [ds:0xb8000 + ecx], al
add ecx, 1
mov [ds:0xb8000 + ecx], byte 0x07 ;color pattern, while on black
add ecx, 1
cmp al, 0
jne load_label
ret
thanks for your time,
Collin