English Amiga Board

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

Thread Tools
Old 30 May 2017, 22:13   #61
Registered User

Megol's Avatar
Join Date: May 2014
Location: inside the emulator
Posts: 244
Using FP when integers or fixpoint numbers make more sense, thinking FP are real numbers rather than scaled integers, not understanding NaNs etc.

Now this is the last OT post from me in this thread, if anybody want to discuss this I suggest opening a new thread.
Megol is offline  
AdSense AdSense  
Old 04 June 2017, 21:20   #62
Registered User

Join Date: Feb 2017
Location: Denmark
Posts: 78
A bit late to the party as I've been busy with other stuff, but I must say that's some pretty interesting solutions you guys came up with. I don't have much experience with 020+ instructions (and some of those seem pretty esoteric), so I've certainly learned a great deal. While "winning" is always great, I'm also only doing it for fun and for the learning experience and having more friendly competitions is more important to me than stroking my ego. Also I still feel kind of dirty for not getting all answers right.

As for what to do for a calculator: These days it should definitely support arbitrary precision and as always you're probably best off using a tested library written by somebody else. But if you do find yourself rolling your own, working in a base of the largest power of ten that allows HW-support for mulitplication works well (especially in C or higher level languages that don't expose the carry bit). That would mean base 10000 for 68000 and base 1e9 for most modern 32-bits systems.
paraj is offline  
Old 04 June 2017, 22:25   #63
Computer Nerd

Thorham's Avatar
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 41
Posts: 2,964
Originally Posted by meynaf View Post
But BCD hardware takes much less resources than FP hardware...
Wouldn't be very useful if BCD hardware would still be slower, while BCD is unnecessary for things like 3D games. Use a decimal compatible format for when you deal with decimal numbers, and use binary floating point when it's sufficient.
Thorham is offline  
Old 01 July 2017, 03:03   #64
Registered User

Nightfox's Avatar
Join Date: Apr 2016
Location: Australia
Posts: 206
So is it a good or bad idea to use BCD in games where you have a decimal display of the number on the screen, for example score or lives? I would imagine printing your score on the screen would be easier if the score was in BCD form.
Nightfox is offline  
Old 01 July 2017, 09:58   #65
Join Date: Jul 2008
Location: Sweden
Posts: 2,021
BCD is more cumbersome to use than plain integers, but it's faster to extract the individual digits.

With plain integers you typically use division to get the digits, which is easy but more costly, though it can be sped up with a simple LUT. Another way to speed it up is to use subtraction to figure out the value of each digit.

Personally I'd use integers and division, it's simple and fast enough, and if printing the score should somehow hamper the speed of the game then you can just spread the work out over multiple image frames.
Leffmann is offline  
Old 01 July 2017, 18:04   #66
Photon's Avatar
Join Date: Nov 2004
Location: Hult / Sweden
Posts: 4,451
BCD is an old remnant from 70s 8-bit CPUs and its only use was to save a few instructions for digit formatting for reports and spreadsheet in the old "Terminal, either with printer as screen or an actual real text screen" era.

It's one of the many CISC wishlist instructions of the 68000 that should have been outed to make room for useful instructions.

If you can find a use for them in a program for the "GUI OS era" that started in 1984, it will be random and extremely niched. They're not even useful for a simple score counter in games.

You should definitely not use them for calculations, there's just add and subtract...

Anyway. What was the topic again?
Photon is offline  
Old 01 July 2017, 23:59   #67

phx's Avatar
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,004
Originally Posted by Nightfox View Post
So is it a good or bad idea to use BCD in games
Don't know, but I used BCD scores in all of my games. I'm targetting plain 68000 and it is definitely faster to do some masking than a division.
phx is offline  
AdSense AdSense  

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone up for an ASM coding competition? DanScott Coders. Asm / Hardware 523 02 May 2017 10:24
4th tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 11 10 April 2013 21:32
3rd tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 6 26 March 2013 16:57
First tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 46 18 March 2013 13:33
2nd tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 10 17 March 2013 12:49

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:20.

Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.13522 seconds with 13 queries