I'm a newbie in assembly
Google search was not helping much
can some1 tell me how to write %2 in assembly?

ps. there might be more question coming up since I'm trying to finish my HW

what is %2 supposed to mean? Or do you just want to print %2 on the console screen? If yes, then just use int 21 instructions to do that, assuming you are using Intel or compatible processor.

some NASM code I wrote for you..
tested on intel processor
much faster than int 21h.

jmp main
test1 db "%2",0
main:
 mov ax,0xB800 ;video memory unless in graphics mode
 push es
 mov es,ax
 mov si,test1
 mov ah,0x07  ;colors
 xor bx,bx    ;use bx to position the output..
 .write:
   mov al,[si+0]  ;get next char
   test al,al     ;set flags but don't change register value
     jz .done
   mov word[es:bx],ax ;display value in al
   inc si         ;next char
   add bx,2       ;es displays 2 bytes(attribute, char)
   jmp .write
   .done:
   pop es
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.