Message board for the users of flat assembler.
> Main > flags, cmp, and add...
hi I'm really kindof a newbie to asm(just know the basics mov and concepts)
and well I'm creating an x86 emulator(don't say I should be fluent in asm first lol)
I really do not understand what the bits in the flag register do
I've tried reading the intel docs and just got done reading some tuts in your faq
I understand how cmp will set the flags but exactly what do the bits mean like cf
is cf like overflow where when you add 1 to 0xFFFF(unsigned)
and I do not understand at all what cf does in sub(tract) in my docs it uses wierd terms like "borrow into the high order bit" which I do not understand at all!
x86 CPU Emulation library: http://sourceforge.net/projects/x86lib
|12 Nov 2006, 02:15||
zero flag for example works like so
cmp eax,ecx ;zero flag will be set to 0 if equal
jnz some_label ;if not equal jump somewhere else
call some_thing ;code continues here if equal
ive never played with carry flag, here is some info on it: http://en.wikipedia.org/wiki/Carry_flag
|12 Nov 2006, 04:26||
Here's how you add two 32-bit numbers (using 16-bit assembly). Double-check your result in CALC.EXE, if you want.
[ WinXP ] Sat 11/11/2006>type test.asm org 100h mov ax,5150h mov bx,0FFEEh mov cx,1000h mov dx,2000h add bx,dx adc ax,cx int3 int 20h [ WinXP ] Sat 11/11/2006>fasm test.asm flat assembler version 1.67.14 (455416 kilobytes memory) 1 passes, 19 bytes. [ WinXP ] Sat 11/11/2006>debug test.com -g AX=6151 BX=1FEE CX=1000 DX=2000 SP=FFFE BP=0000 SI=0000 DI=0000 DS=14F6 ES=14F6 SS=14F6 CS=14F6 IP=0110 NV UP EI PL NZ NA PO NC 14F6:0110 CC INT 3 -q [ WinXP ] Sat 11/11/2006>scrndump
EDIT: I know, I know, I should've just used ADD reg16, imm16.
|12 Nov 2006, 05:57||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.
Website powered by rwasa.