Hello Guys,
I am trying to understand the foll 16-bit machine code and i hve few doubts..
! void putc(char c) : print a char
_putc:
push bp
mov bp,sp
movb al,4 ! aL = char
movb ah,#14 ! aH = 14
int 0x10 ! call BIOS to display the char
pop bp
ret
can anyone tell me what exactly does 4 mean?
-> contents of base pointer, but what is 4 ??
Any comments are appreciated
Thanks
I am trying to understand the foll 16-bit machine code and i hve few doubts..
! void putc(char c) : print a char
_putc:
push bp
mov bp,sp
movb al,4 ! aL = char
movb ah,#14 ! aH = 14
int 0x10 ! call BIOS to display the char
pop bp
ret
can anyone tell me what exactly does 4 mean?
-> contents of base pointer, but what is 4 ??
Any comments are appreciated
Thanks
Given the context alone, that would suggest in less ambiguous syntax.
What does the line above it do?
What syntax is that? Looks like as86 to me...
Best,
Frank
Best,
Frank
movb al,4
Before function is called the argument (char c) is pushed to stack. During CALL is performed in stack is pushed ReturnAddress. Iif LARGE or HUGE model is used, IP and CS registers are pushed and occupy 4 bytes on the stack. To derive argument need 4 byte offset
Look in Ralf's Interrupt List.
mov ah, 14h
int 10h
mov ah, 14h
int 10h
"load LCD font"??? If it is, in fact, as86 syntax, the "#" means, not hex, but merely an immediate number - without it, it'd be "movb ah, [14]". As is, in hex, it'd be "movb ah, #0xE" - the bios "putchar" function.
What was confusing puneet21 was the "4". In ordinary(?) Intel Syntax, the "[" is equivalent to "+"... as SpooK explained...
Best,
Frank
What was confusing puneet21 was the "4". In ordinary(?) Intel Syntax, the "[" is equivalent to "+"... as SpooK explained...
Best,
Frank
Yep, that's what I was aiming at too... what the stack looks like on entry to the function ;)