ASM and aout
Posted: Mon Dec 20, 2004 5:49 pm
I'm trying to combine C and asm.
I know that my asm print function works in .bin format (have tried it in bochs), but as soon as I compile it to aout format (so that ld can handle it) it gets weird.
Here is the print function (only used in 80x25 mode that's why it's so simple).
here is the string declaration:
here is when I call print_string_real():
SCREEN_ADDR is set to 0b8000h and STANDARD_COLOR is set to 4.
Let me know if you need more info
I know that my asm print function works in .bin format (have tried it in bochs), but as soon as I compile it to aout format (so that ld can handle it) it gets weird.
Here is the print function (only used in 80x25 mode that's why it's so simple).
Code: Select all
print_string_real:
;ds:esi - String addr
;es:edi - Screen offset
;ecx - String Length
;ah - Color attribute
load_save_loop:
lodsb
stosw
loop load_save_loop
ret
Code: Select all
cpuid_works db '386+ CPU detected' ;Len: 17
Code: Select all
mov ax,0000h
mov ds,ax
mov esi,cpuid_works
mov ax,(SCREEN_ADDR/16)
mov es,ax
mov edi,0000h+0*160
mov ecx,17
mov ah,STANDARD_COLOR
call near print_string_real
Let me know if you need more info