It is currently Tue Oct 17, 2017 1:44 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Thu Jan 26, 2017 10:25 am 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
A bit of language barrier... :? :oops: :oops:

Example: IGEIAGIP -> address=$D400, value=$15, compare=$45.

If the CPU PC register is at $D400 and the instruction is LDA $D400,X (effective read from $D400). Does the GameGenie compares the PC register fetching the operator at $D400, or only the memory access at $D400? Or both?

In other words, does the GG address compare the PC register OR only memory accesses, like in a LDA $xxxx or LDA $xx?


Top
 Profile  
 
PostPosted: Thu Jan 26, 2017 10:41 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6276
Location: Seattle
The Game Genie is a memory patcher; it doesn't keep track as to whether the 6502 is fetching instructions, instruction parameters, or data.


Top
 Profile  
 
PostPosted: Thu Jan 26, 2017 2:17 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
Still not clear.
Can't the GG patch an instruction like LDA #$38 (the operand #$38) to another value?


Top
 Profile  
 
PostPosted: Thu Jan 26, 2017 2:22 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10046
Location: Rio de Janeiro - Brazil
It can, it just can't tell the difference between that instruction being executed as code from another instruction loading that operand as data. The GG will patch every access to that memory location the same way, seeing as it's just watching the address/data lines and is completely unaware of what happens inside the CPU.


Top
 Profile  
 
PostPosted: Thu Jan 26, 2017 2:26 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6276
Location: Seattle
Exactly. The game genie behaves in exactly one of two ways:

1, six digit code: When the memory address is $XXXX, instead drive the value $YY instead of whatever's coming from the ROM
2, eight digit code: When the memory address is $XXXX, if the value from the ROM is $ZZ, then instead drive the value $YY
At all other times, pass through the ROM verbatim.

So, for an emulator, this is often equivalent to a tiny IPS patch, and thus you can often pre-patch the image according to the game genie code.

(Obviously, a program could be written to make sure that the same value in ROM shows up in multiple different banks, thus detecting the game genie. But I suspect few, if any, do)


Top
 Profile  
 
PostPosted: Thu Jan 26, 2017 2:44 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
tokumaru wrote:
It can, it just can't tell the difference between that instruction being executed as code from another instruction loading that operand as data. The GG will patch every access to that memory location the same way, seeing as it's just watching the address/data lines and is completely unaware of what happens inside the CPU.

Let me give you an example. Take LDA $8520. Will the GG analyse each fetch (LDA byte, $20 and $85) or only the byte at $8520 memory location?


Top
 Profile  
 
PostPosted: Thu Jan 26, 2017 2:52 pm 
Offline
User avatar

Joined: Mon Feb 07, 2011 12:46 pm
Posts: 919
Zepper wrote:
Let me give you an example. Take LDA $8520. Will the GG analyse each fetch (LDA byte, $20 and $85) or only the byte at $8520 memory location?
Each of those four bytes can be patched individually.

_________________
.


Top
 Profile  
 
PostPosted: Thu Jan 26, 2017 2:56 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
zzo38 wrote:
Each of those four bytes can be patched individually.

It's clear enough. Thanks.


Top
 Profile  
 
PostPosted: Thu Jan 26, 2017 2:59 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10046
Location: Rio de Janeiro - Brazil
Zepper wrote:
Let me give you an example. Take LDA $8520. Will the GG analyse each fetch (LDA byte, $20 and $85) or only the byte at $8520 memory location?

The GG analyzes every fetch, but whether it will patch the value will depend on what code you use. Like zzo38 said, these are 4 different addresses.


Top
 Profile  
 
PostPosted: Sun Jan 29, 2017 11:04 am 
Offline
Formerly ~J-@D!~
User avatar

Joined: Sun Mar 12, 2006 12:36 am
Posts: 445
Location: Rive nord de Montréal
The best way to understand the Game Genie is to be the Game Genie.

Suppose you sit between between the cartridge connector and the game pak. In that place, you can see the clock, address lines, data lines, R/W etc. but how can you tell the CPU is fetching an instruction, an operand or a target memory location? If you're not smart, you just can't. If you're smart, you can look at the addresses and fetch values to understand if an instruction is being fetched, which one, and affect only explicit loads from a target address. This is way beyond what was technically feasible at that price point for such a console accessory (you almost reimplemented a 6502), so the Game Genie is not smart and patches whatever load it sees that matches one of the supplied codes. :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: Dwedit 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