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
        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

can anyone tell me what exactly does 4 mean?
-> contents of base pointer, but what is 4 ??

Any comments are appreciated
Posted on 2010-08-26 22:17:53 by puneet21
Given the context alone, that would suggest in less ambiguous syntax.
Posted on 2010-08-27 02:42:30 by SpooK
What does the line above it do?
Posted on 2010-08-27 08:26:31 by Homer
What syntax is that? Looks like as86 to me...


Posted on 2010-08-28 13:17:01 by fbkotler

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
Posted on 2010-08-28 16:21:00 by MikDay
Look in Ralf's Interrupt List.

mov ah, 14h
int 10h
Posted on 2010-08-28 17:28:13 by skywalker
"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...


Posted on 2010-08-28 18:00:15 by fbkotler
Yep, that's what I was aiming at too... what the stack looks like on entry to the function ;)
Posted on 2010-08-28 22:19:25 by Homer