Subject: Re: [stella] CMP Wizard From: Thomas Jentzsch <tjentzsch@xxxxxx> Date: Sun, 28 Oct 2001 18:34:55 +0100 |
Glenn Saunders wrote: >I've developed this chart and I want to make sure it's correct. > >Please comment. > > ; CMP BRANCH WIZARD > ;--------------------------------------- > ;A = M - use BEQ ; N=0,*Z=1, C=1 > ;A > M - use BCS ; N=0, Z=0,*C=1 > ;A < M - use BMI ; *N=1, Z=0, C=0 > ;A >= M - use BPL*; *N=0, C=1 > ; > ; * No need to set carry ahead of time >- Your matrix should look like this: opcode flags integer type A == M BEQ N=0, Z=1, C=1 A != M BNE N=?, Z=0, C=? A >= M BCS N=?, Z=?, C=1 (unsigned) A > M BCS and BNE N=?, Z=?, C=1 (unsigned) A < M BCC N=?, Z=0, C=0 (unsigned) A >= M BPL N=0,;Z=?, C=? (signed) A > M BPL and BNE N=0,;Z=0, C=? (signed) A < M BMI N=1;;Z=0; C=? (signed) The carry-flag is used for comparing unsigned integers, the negative flag for signed integers. You can remember the flags easier, when you imagine CMP works like a subtraction (A-M): - If the subtraction wraps around zero, then the carry-flag is cleared. - If the result is negative, then the negative-flag is set. - Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] CMP Wizard, Roger Williams | Thread | [stella] VCS.H?, Glenn Saunders |
Re: [stella] CMP Wizard, Roger Williams | Date | [stella] VCS.H?, Glenn Saunders |
Month |