30 May 2017, 21:13 | #61 |
Registered User
Join Date: May 2014
Location: inside the emulator
Posts: 377
|
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. |
04 June 2017, 20:20 | #62 |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,099
|
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. |
04 June 2017, 21:25 | #63 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
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.
|
01 July 2017, 02:03 | #64 |
Registered User
Join Date: Apr 2016
Location: Perth, Australia
Posts: 384
|
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.
|
01 July 2017, 08:58 | #65 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
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. |
01 July 2017, 17:04 | #66 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
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? |
01 July 2017, 22:59 | #67 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
|
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 | 526 | 22 September 2018 21:38 |
4th tutorial on ASM- and HW-coding | Vikke | Coders. Asm / Hardware | 11 | 10 April 2013 20:32 |
3rd tutorial on ASM- and HW-coding | Vikke | Coders. Asm / Hardware | 6 | 26 March 2013 15:57 |
First tutorial on ASM- and HW-coding | Vikke | Coders. Asm / Hardware | 46 | 18 March 2013 12:33 |
2nd tutorial on ASM- and HW-coding | Vikke | Coders. Asm / Hardware | 10 | 17 March 2013 11:49 |
|
|