--- Balthasar Indermuehle wrote: > > > 2. an IF statement: > > > > > > Pseudo code: > > > if (x > y) { > > > do something > > > } > > > > > > > do the same as above but this time add an extra > line > > after subwf, which is sublw 0x1. Check for Zero > again. > > Work it out on paper and you will get it. > > > > > > Thanks John, > > So an if statement essentially has to loop through? > Is there no bit wise > operator that lets me figure out which value of two > is larger? > Correct me if I am wrong but basic NOT AND and XOR can building all sort of gates which ultimately can build comparators. But what you want is whether the bitwise operator can do comparison when they are equal which lives in the instruction set. Unfortunately subwf is a better alternative for you to determine whether it is greater or not. Here is a macro that uses the subwf ;macro movff ;args arg1 - file register,src ; arg2 - file register,dest ;comment move the contents from arg1 to arg2 ;results now arg2 has arg1 movff macro arg1,arg2 movfw arg1 movwf arg2 endm ;macro cmp16ff ;args arg1 - addr of file register,16 bits ; arg2 - addr of the file register,16 bits ; arg3 - tmp value ;comment compares arg1 and arg2 ;results arg1>arg2 -set C ,arg1==arg2 set Z,arg2>arg1 unset C cmp16ff macro arg1,arg2,arg3 movfw arg2 subwf arg1 movwf arg3 btfsc STATUS,Z goto next_byte btfss STATUS,C goto end_cmp16ff next_byte movlf arg2,FSR incf FSR movff INDF,arg3 movlf arg1,FSR incf FSR movfw arg3 subwf INDF goto end_cmp16ff end_cmp16ff endm John > I'm new to the bit-level way of thinking as you can > see... > > Cheers > > - Balt > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > ____________________________________________________________________________________ Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. http://videogames.yahoo.com/platform?platform=120121 -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist