It is currently Thu Oct 19, 2017 11:19 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Fri Dec 02, 2016 11:52 am 
Offline

Joined: Thu Aug 28, 2008 1:17 am
Posts: 591
tepples wrote:
I'm beginning to understand why some Game Boy games ran at 30 fps or slower

There were master system games that ventured into that 30fps territory too. Earlier titles.

A lot of z80 programmers tend to boast about the available regs to work with on the z80 compared to accumulate based processors (65x, 6809, etc). But I always found it to be the complete opposite. Data registers are kind of a moot point on the 65x simply because it has a lot of direct memory addressing modes (and fast mode; direct or zero page). A lot more operations actually have to go through the A reg on the z80, from another reg or from indirection (address regs). I always felt like a constraint of constantly juggling things - way more than what might be done with Acc on the 65x. And the having ZP as off processor address registers (address vectors) - feels soo free in comparison. Even the 68k felt a tiny bit cramped in this respect to the 65x (only 7 address regs; SP is the 8th address reg).

Of course, the context of 65x to me is not limited to the NES - so my view of optimization and use of quick LUTs for logic are probably expanded compared to the NES environment.

_________________
__________________________
http://pcedev.wordpress.com


Top
 Profile  
 
PostPosted: Sun Dec 18, 2016 9:12 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19102
Location: NE Indiana, USA (NTSC)
C64 vs. Speccy wars concluded that a full Z80 (with IX and IY) has 1/3 of the IPC of a 6502.


Top
 Profile  
 
PostPosted: Thu Jul 27, 2017 3:03 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19102
Location: NE Indiana, USA (NTSC)
In this post, TmEE wrote:
Z80 assembly came next as I needed means to play sound without tying up the main CPU. It was much more painful than 68K which pretty much had spoiled me. x86 still felt worse though... Nowdays I also do Master System and SC-3000 / SG-1000 stuff, whole game in Z80 isn't actually all that bad.

Is that based on IX/IY (SG1K/SMS/GG only) or some other way to step through fields of an actor structure?


Top
 Profile  
 
PostPosted: Fri Jul 28, 2017 1:16 am 
Offline
User avatar

Joined: Wed Feb 13, 2008 9:10 am
Posts: 575
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
I pretty much only use IX(IXL,IXH) and IY(IYL,IYH) as temporary variables and all else goes by structures aligned to 256 bytes and BC/DE/HL addressing with lot of incrementing the C/E/L rather than direct specifying of elements to access through them. Autoincrement comes for free on 68K and incrementing is faster on Z80 than directly specifying the element to access too, data is always laid out in the order of use to accomodate that approach.

_________________
http://www.tmeeco.eu


Top
 Profile  
 
PostPosted: Fri Jul 28, 2017 6:38 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19102
Location: NE Indiana, USA (NTSC)
TmEE wrote:
data is always laid out in the order of use

That's what others were recommending but I'm somehow not fully grokking. Say there are 16 bytes of state for each actor in an action platformer:

X position (24 bits; 16.8)
X velocity (16 bits; 8.8 signed)
Y position (16 bits; 8.8)
Y velocity (16 bits; 8.8 signed)
Current frame
Timing state
Facing direction
Height of last hitbox to hit this actor relative to the actor's feet; used for collision response
Health
Actor type ID
VRAM location for actor's sprite cels

Are there some generic rules of thumb for field layout to ensure "data is always laid out in the order of use"? If not, how can I predict "the order of use" in all cases? Do I need to prototype all the routines used by a sample of the actor types in a high-level language, and then reorder the fields to be either after or one bit different from the previous field before translating the routines to Z80/LR35902?


Top
 Profile  
 
PostPosted: Fri Jul 28, 2017 8:24 am 
Offline

Joined: Sun Mar 27, 2011 10:49 am
Posts: 192
Well, I feel as though I've suggested this before, but the best rule of thumb in general is probably "structs of arrays" rather than "arrays of structs".

Otherwise you do your best, focus on the needs of the most speed-sensitive code, maybe iterate on your design a few times, and if worst comes to worst, you might need to suck it up and manually index - which, as long as you keep your data page-aligned and/or so that it never crosses page boundaries, really isn't too bad: we're talking about, in 6502 terms, no more than a handful of extra cycles. Outside of a vblank handler, it's extremely rare that you really need to worry about that in the average game.


Top
 Profile  
 
PostPosted: Fri Jul 28, 2017 8:40 am 
Offline
User avatar

Joined: Wed Feb 13, 2008 9:10 am
Posts: 575
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Jaa, sometimse you just got to suck it up. My process is iterative, with refactors as new ways to improve something present themselves. Prototyping in a higher level language probably gets you somewhere sooner.

_________________
http://www.tmeeco.eu


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 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