View Single Post
Old 31 October 2019, 12:06   #1
Antiriad_UK
OCS forever!
 
Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
Really DUMB stuff you learned/unlearned recently

Is there anything you learned recently (or a long time into your asm knowledge) that made you go "I am a moron for thinking that". I'll embarrass myself first.

The big one. I thought that bgt/blt were exactly the same as bhi/blo. Seriously. At some point my 16yr old self has decided that and I never questioned it even during writing https://www.pouet.net/prod.php?which=81350

But I was chatting to ross about a starfield I was doing and I had some code to check that something was in the range 0-128 and I was doing a two tests for 0 and 128. ross showed a snippet of something similar and he was purely doing something like:
cmpi.w #128,d0
bhi.s .outofrange

Which confused me because what about the 0 check... so I dug out my original two books "Amiga Machine Language" and "Amiga System Programmers Guide". The AML book had a tiny section on condition codes and had a table that listed bgt as "greater than" and bhi as "higher than" which is why I think my 16yr old self assumed they were the same. But looking at it now the status flags were different. So I did some more digging and found http://mrjester.hapisan.com/04_MC68/...t07/Index.html

Omg...I understood about treating numbers as signed and unsigned but somehow thought the branch instructions were all signed and you had to "work around it". I WAS MORTIFIED. I checked two other 68000 books online and neither make it clear about the sign vs unsigned as well. Everyone must think it obvious from the status flags table. If I'd written that section it would be in bold

The other thing I never used to use were the carry flag/addx/roxr type instructions and the fact that the shift/overflows end up there and can be checked or rotated in/out. So that's been useful to learn.

So is it just me or does anyone else have anything dumb to admit?

Last edited by Antiriad_UK; 31 October 2019 at 12:24.
Antiriad_UK is offline  
 
Page generated in 0.06368 seconds with 11 queries