It is currently Wed Oct 23, 2019 9:13 am

All times are UTC - 7 hours



Forum rules





Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sat Jun 08, 2019 6:05 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2897
This will probably be a waste of time, but I'm curious to see how this will turn out. Obviously I don't expect it to run anywhere near the speed of a real 68000, but exactly how slow I don't know.

Just trying to figure out which opcode an instruction is, is going to be complicated. Below is a table of how each instruction is layed out. I can probably do a branch tree, where I narrow it down to instruction type.

http://www.markwrobel.dk/post/amiga-mac ... deep-dive/


Top
 Profile  
 
PostPosted: Sat Jun 08, 2019 9:42 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11418
Location: Rio de Janeiro - Brazil
I'm pretty sure you can emulate any CPU in any other CPU as long as speed isn't a concern and you have the memory for the entire state. Whether there's any use for a slow ass emulator is another issue.

The 65816 already has a hard time competing with the 68000 as it is, so I doubt you'd get anything usable (i.e. not horribly slow) by trying to make it simulate a 68000. I think this would be a waste of time, because you probably wouldn't be able to put this to use in any meaningful way. The novelty of it would wear off almost instantly, after all the hard work to get it done.


Top
 Profile  
 
PostPosted: Sat Jun 08, 2019 9:49 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21644
Location: NE Indiana, USA (NTSC)
At least it'd let you unit-test subroutines for Genesis games on your IIGS.

_________________
Pin Eight | Twitter | GitHub | Patreon


Top
 Profile  
 
PostPosted: Sun Jun 09, 2019 1:00 am 
Offline
User avatar

Joined: Mon Jan 23, 2006 7:47 am
Posts: 207
Location: Germany
IIRC/AFAIK emulation on the PC generally has ~10-30x overhead (e.g. take the host clock speed (4.4 GHz), divide by 30 (for bsnes), divide by guest clock speed (21.48 MHz), multiply by 60 (for NTSC) = 410 fps) just for the CPU emulation... Then divide by 3 for emulating the entire system.

So that'd be ~2 fps just for emulating the 68K CPU on the 65K, as a very rough ballpark figure.

_________________
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10


Top
 Profile  
 
PostPosted: Sun Jun 09, 2019 12:12 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2897
I just did some experimenting with a hypothetical psuedo ASM code where the only addressing mode is absolute addressing, and I got 38 cycles per 3-operator 16-bit ADD, and 66 cycles for a 32-bit ADD. This looks like it can range anywhere between 2 to 6 times slower than real 65816 ASM, depending on what type of instructions.


Top
 Profile  
 
PostPosted: Sun Jun 09, 2019 12:59 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2576
Location: DIGDUG
I suppose you could use it to port a game with very slow game play. Mahjong. Go. Checkers.

I wouldn't. But you could.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Sun Jun 09, 2019 1:10 pm 
Offline
User avatar

Joined: Mon Jan 23, 2006 7:47 am
Posts: 207
Location: Germany
dougeff wrote:
I suppose you could use it to port a game with very slow game play. [...] Go. Checkers.

Without an AI player though...

_________________
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10


Top
 Profile  
 
PostPosted: Sun Jun 09, 2019 1:33 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4210
Location: A world gone mad
What's the practical purpose for this? Or is it just a personal "can it be done" project?

Some of the addressing modes of the 68K are what's going to kill performance, compounded by register sizes. The "Address Register Indirect with Displacement" and "Address Register Indirect with Index" addressing modes are going to really hurt given that the calculations are done at run-time. Things like this (and similar on the x86) are what make the CPU so powerful.


Top
 Profile  
 
PostPosted: Sun Jun 09, 2019 3:06 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2897
Lately I've been needing more and more mathy stuff in my game, and I've been thinking about making some kind of psuedo-ASM language to speed up development, when I have to deal with multiplication and division and signed numbers.

Yeah, I know 68000 ASM is a little too much for this type of thing.


Top
 Profile  
 
PostPosted: Sun Jun 09, 2019 6:11 pm 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 1091
I was messing with an approximate Riemann solver on SNES a while back, and I learned very quickly that using macros is far preferable to manually coding the whole math operation every time.

Tables for unary operations like inverse and square root are extremely helpful as well.

I assume you've seen this: http://wilsonminesco.com/16bitMathTables/ It's for 6502, but the general idea is still relevant to SNES.


Top
 Profile  
 
PostPosted: Mon Jun 10, 2019 12:39 am 
Offline
Formerly Espozo
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3503
Location: Richmond, Virginia
How powerful is ca65's macro support? Macros are such a blessing in Nasm; being able to generate different code based on the number and types of arguments passed is so useful. I even went and made macros that do nothing but move values into registers and call functions. It's easier to shoot myself in the foot and not think about what registers are being overwritten, but it makes the main code so much cleaner.

About your situation psychopathicteen, I would probably make multiplication a macro that writes to, then reads from the fast multiplication registers. It would be very easy to make this a macro because I think the code would stay the same regardless of where it's used.

What would you want to do with signed numbers? Addition and subtraction will result in the same numbers unless you want to implement saturation (values don't wrap around / no overflow). Do either multiplication units not support signed multiplication or division?


Top
 Profile  
 
PostPosted: Mon Jun 10, 2019 12:48 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 975
psycopathicteen wrote:
Lately I've been needing more and more mathy stuff in my game, and I've been thinking about making some kind of psuedo-ASM language to speed up development, when I have to deal with multiplication and division and signed numbers.


It's called C :lol:


Top
 Profile  
 
PostPosted: Mon Jun 10, 2019 1:07 am 
Offline
Formerly Espozo
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3503
Location: Richmond, Virginia
I would say something about how C is prohibitively slow for the 65816, but this is the thread about emulating a 68000 with a 65816...


Top
 Profile  
 
PostPosted: Mon Jun 10, 2019 10:50 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 975
It's not so for the 6502, so why would it be for '816? If you find Little Medusa to not have enough action, perhaps MegaCat's next SNES title will be more to your liking ;)


Top
 Profile  
 
PostPosted: Mon Jun 10, 2019 3:49 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2897
The problem with C, is that I would have to make it from scratch again.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group