#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Please convert this code into ASM

Can any one convert the below function to Assembly language. I am not able to do calculations since I only know 16-bit calculations or addressing. But this program uses 32-bit calculations and memory addressing. Please help! Thankyou in advance.

//Putpixel function for 256 Color SVGA 640x480 VESA mode.

void putpixel(unsigned int x,unsigned int y,unsigned char color)

{

long p =(long)(y) * 640 + (long)(x);

char p2 =p >>16;

if( p2 != lastwrite) setwritebank( p2 );

*((char far *)0xA0000000 + p) = color;

}

• Just search for it in the menu's and turn on "Generate assembly code"

• : Can any one convert the below function to Assembly language. I am not able to do calculations since I only know 16-bit calculations or addressing. But this program uses 32-bit calculations and memory addressing. Please help! Thankyou in advance.

:

: //Putpixel function for 256 Color SVGA 640x480 VESA mode.

:

: void putpixel(unsigned int x,unsigned int y,unsigned char color)

//Note: assuming 16bit ints and 8bit chars

//PutPixel:

//push ebp

//mov ebp, esp

: {

: long p =(long)(y) * 640 + (long)(x);

//movzx eax, WORD PTR [ebp+8]

//mov ebx, eax

//shl eax, 6

//shl ebx, 8

//shl eax, 1

//movzx ebx, WORD PTR [ebp+10]

: char p2 =p >>16;

//mov ebx, eax

//shr ebx, 16

//xor bh, bh

: if( p2 != lastwrite) setwritebank( p2 );

//cmp bl, BYTE PTR [lastwrite]

//je label1

//push bx

//call setwritebank

//label1:

: *((char far *)0xA0000000 + p) = color;

//mov bl, BYTE PTR [color]

//mov BYTE PTR [eax], bl

//ret

: }

:

:

• I give no gaurantee it will work. In fact I'm pretty sure it won't. Anyways your compiler should have an option to set it to produces 32-bit code. In Borland it's /3.