English Amiga Board

Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

Thread Tools
Old 31 October 2019, 13:06   #1
OCS forever!

Antiriad_UK's Avatar
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 179
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 13:24.
Antiriad_UK is offline  
Old 31 October 2019, 13:17   #2

Steril707's Avatar
Join Date: Sep 2016
Location: Amiga Island
Posts: 1,271
Lots of dumb shit that I do wrong all the time.
I must be the worst 68k asm coder in the world.

Somehow I managed to code an Amiga game, though..

When I notice something dumb I did in the future, I will write it here...
Steril707 is offline  
Old 31 October 2019, 14:52   #3
Registered User

Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,648
I actually cover this in my up coming episode of amigagamedev.

But yep - i am with you, back in the day i dont think i even considered the flags that much.
mcgeezer is offline  
Old 31 October 2019, 18:03   #4
Rock'n Roll
Registered User

Rock'n Roll's Avatar
Join Date: Aug 2018
Location: Drübeck / Germany
Age: 45
Posts: 5
The branches can be confusing. That's why I had created a table
and a small program for analysis.
Attached Files
File Type: zip branch.zip (388.4 KB, 15 views)
Rock'n Roll is offline  
Old 31 October 2019, 18:13   #5
Per aspera ad astra

ross's Avatar
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,425
Originally Posted by Antiriad_UK View Post
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.
You have to master these, some pure acrobatic code possible
ross is offline  
Old 31 October 2019, 18:28   #6
Registered User

Join Date: Feb 2018
Location: London / UK
Posts: 73
I've released a few AGA demos that didn't use the AGA fetch modes. They had mainly c2p effects, no sprites or hw scrolling, so there was no technical reason I couldn't use 4x fetch.
For example this demo: https://www.pouet.net/prod.php?which=69702 runs about 10% faster with this fixed.
In other cases like when using blitter, on slow CPUs etc the difference can be much bigger.

So, on AGA, always use 4x if you can.
dodke is offline  
Old 31 October 2019, 20:58   #7
Registered User

Join Date: Dec 2016
Location: England
Posts: 86
Amiga coding in general - didn't do any at all when I had my A600

It's only very recently I've got into it.
Spec-Chum is offline  
Old 01 November 2019, 12:52   #8

phx's Avatar
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,569
I had decades of experience in 68k assembler coding and wrote all kinds of hardware scrolling routines since the 80s, but it lasted until 2012, when I read Georg Steger‘s ScrollingTrick (Aminet), before I understood how to do a decent „corkscrew“ scroller.

I felt really dumb, because I thought about scrolling techniques so many times, but I was never able to develop this idea myself.
phx is offline  
Old 03 November 2019, 17:23   #9
Registered User

Apollo's Avatar
Join Date: Sep 2008
Location: Germany
Age: 45
Posts: 127
Had the some problems back then _really_ understanding the differences between the conditional branches when applied best.
Started 65xx assembly last year and developed a theory that, in the 80s, the guys coming from MOS 65xx had something of an advantage here as they had to get this things right in first place.
As I started direct on the 68k I was using 'workarounds' (like in your example using two checks for the upper/lower limit) as I knew they worked for me. Often learned by hours of try/error.

I way too long went on with 'feeled' coding (f.ex. not fully understanding twos complement or making use of the condition codes).

It didn't help either that at least one of the early assembler courses in one of the german Amiga magazines didn't got the conditional branches right.
Apollo is offline  

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Any DirectX11 changes recently behind the scenes? Mclane support.WinUAE 2 24 November 2018 19:07
WinUAE on Hyper-V Lessons Learned. Greyspirit support.WinUAE 3 26 August 2018 14:42
Recently acquired A3000 AmigaJules Hardware pics 9 07 October 2008 11:24
Sensible Soccer or I How I Stopped Worrying and Learned to Love the Ball CodyJarrett Amiga scene 5 14 December 2007 18:43

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 21:41.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.08015 seconds with 14 queries