cmp v teq
Pages: 1 2
Colin Ferris (399) 1814 posts |
Which is best for eq/ne results cmp or teq? and msr cpsr_all,r0 v msr cpsr_fc,r0 ie is one quicker/better than the other? |
nemo (145) 2546 posts |
TEQ is a subset of CMP. TEQ (with a zero shift – I’ll come back to this) only affects the N and Z flags… so you’ll often see tricksy code that does a CMP and then a TEQ, and relies on the TEQ not affecting the C flag set by the CMP. However, if the constant in the TEQ has a non-zero shift, then it DOES affect C. There is at least one bit of code in RISC OS that relies on this in isolation. If you’re not being tricksy, use whichever is most clear. CMP for signed and unsigned comparisons, TEQ for equality only. As for MSR, it’s best to only affect the parts you need to, again for clarity more than anything. |
Jon Abbott (1421) 2651 posts |
I use TEQ for code clarity – its immediately obvious its testing for equality and not a range. MSR only set the bits you need too, it avoids having to preserve the reserved bits. |
Colin Ferris (399) 1814 posts |
An extra – is there a front end to the ‘Squash’ module? (I seem to remember there was one -but may be wrong) |
Chris Mahoney (1684) 2165 posts |
There’s an app called Squash in HardDisc4.Apps. I’ve never used it but it wouldn’t surprise me if it uses the Squash module internally. |
Colin Ferris (399) 1814 posts |
Thanks – right under my nose in Apps. Showed when last used – it was 26bit :-) Time to update it to 32bit. |
Colin Ferris (399) 1814 posts |
Does anyone here know how the VRPC ‘rom’ is compressed? It would be nice if you could replace ro4 rom with ro5 – instead of softloading it – after ro4 has started. |
nemo (145) 2546 posts |
VRPC doesn’t require a compressed ROM. Oh. I seem to have an RO5 ROM in RomSets already… from 2012. I have no memory of whether I ever used it successfully. And having tried it again… it doesn’t seem to work. Perhaps the 26bit podules are the problem, I don’t know. |
Colin Ferris (399) 1814 posts |
Thanks for testing – but 26 podules are just ignored -like in a hardware RPC – you just don’t get a HostFS/Filer – unless you put a 32bit version – which in my case is from RedSq. It’s why I was asking – if anyone knew what format the RO4 rom was in. (loading ro5 from {!boot !run} works ok) Set Boot$Dir <Obey$Dir> RMEnsure UtilityModule 5.19 *Run <Boot$Dir> !!!SoftLoad !Run etc |
Colin Ferris (399) 1814 posts |
As a note – ‘Arm BasicEdit’ v1.03 (09 Oct 2012) is in the HardDisc image on the ROOL site. Also what is the last version of ‘ABCLibrary’ ABCLib – I seem to have a copy here v4.15 (06 Jun 2004) – version v4.14 is in the HardDisc image. |
nemo (145) 2546 posts |
I have 4.14 everywhere. Not sure where your 4.15 came from! |
John Williams (567) 768 posts |
A quick Google reveals a posting by David Pitt under the heading “ABCLibrary 4.18, Some Pain”, topics/8971, which concludes that this later version is now pain-free. Version 4.17 appears, curiously, to be shipped with ConfiX Perhaps David can elucidate. |
John Williams (567) 768 posts |
But this loads 4.18, but I haven’t yet discovered how, unless I already have it in System! Which I find I do! Where or when I know not! |
David Pitt (3386) 1248 posts |
ABCLibrary 4.18 (26 Nov 2016) is in ROOL’s Nightly Beta HardDisc4 |
Colin Ferris (399) 1814 posts |
Noticed in Nightly Beta Zip – ARMBasicEditor BasicEdit ver 1.07 (01 Aug 2015) |
Colin Ferris (399) 1814 posts |
Is there a simple way of printing to the top left of the Desktop screen? |
nemo (145) 2546 posts |
I’m assuming you mean from a Wimp program but I may be wrong. |
Colin Ferris (399) 1814 posts |
I was thinking from inside a Module? :-) |
nemo (145) 2546 posts |
OMG. Right, well in general that would be A Bad Idea. That’s what SysLog or the various other debugging avenues are for… BUT… if your module is always being called from the desktop, that’ll work. Especially if it’s not being called in the middle of a VDU sequence. ;-) |
Colin Ferris (399) 1814 posts |
Trying to get my head around -: How to work out which one should be used? Unsigned Signed |
nemo (145) 2546 posts |
Well, it depends whether you want < <= >= or >, and whether you’re comparing signed or unsigned values. s < s LT s <= s LE s >= s GE s > s GT u < u LO / CC u <= u LS u >= u HS / CS u > u HI |
Colin Ferris (399) 1814 posts |
Two’s Complement. In a module – how do you work out which you need to change – or just use Unsigned throughout? |
nemo (145) 2546 posts |
To what end? I don’t understand the context. What are you comparing, addresses? (not signed); Graphics coordinates? (signed); Text coordinates? (not signed); Wimp icon priorities? (signed) The fact the code’s in a module makes no difference. What you are comparing is all that’s important. |
Rick Murray (539) 13840 posts |
Use unsigned throughout, unless you need to handle negative numbers. Something I’m guilty of, from the old days, is using GT to mean “greater than”. On a RiscPC or earlier it was fine. However… What I mean: What the processor might do with GT on a modern ARM machine with lots of memory: So… Stick to unsigned unless you need signed. As to what to change in a module… it’s a very vague question. What’s the code doing? |
nemo (145) 2546 posts |
LOL. Other irrefutable advice in the same vein: • Always turn left, except when you need to turn right. |
Pages: 1 2