From 7098513bbb2601f796058ae408d7b6eae5d49a76 Mon Sep 17 00:00:00 2001 From: leslie Date: Sat, 26 Jul 2008 14:13:53 +0800 Subject: [PATCH] nagra1: fix/update read-write handler --- systems/nagra/nagra1.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/systems/nagra/nagra1.c b/systems/nagra/nagra1.c index 1eddc3d..4867984 100644 --- a/systems/nagra/nagra1.c +++ b/systems/nagra/nagra1.c @@ -200,6 +200,7 @@ public: cEmuRom3Core::cEmuRom3Core(void) { + hasReadHandler=hasWriteHandler=true; special05=false; } @@ -332,20 +333,32 @@ protected: struct Map { unsigned char A[64], B[64], C[64], D[4], opSize; } map; // virtual void Stepper(void); + virtual void ReadHandler(unsigned char seg, unsigned short ea, unsigned char &op); bool DoMaps(bool hasExt, int romSize); bool CoreInitSetup(void); bool CoreUpdateSetup(const unsigned char *emm); +public: + cEmuRom10Core(void); }; +cEmuRom10Core::cEmuRom10Core(void) +{ + hasReadHandler=true; +} + void cEmuRom10Core::Stepper(void) +{} + +void cEmuRom10Core::ReadHandler(unsigned char seg, unsigned short ea, unsigned char &op) { - int rnd=random(); - unsigned char mem7=Get(0x07); - if(cc.i) mem7&=0xFD; else mem7|=0x02; - Set(0x07,mem7); - if(bitset(mem7,1) && bitset(mem7,7)) { - Set(0x05,(rnd&0xFF00)>>8); - Set(0x06,rnd&0xFF); + switch(ea) { + case 0x05: + case 0x06: + if(cc.i && (Get(0x07)&0x80)) op=random()&0xFF; + break; + case 0x07: + if(cc.i) op&=0xFD; else op|=0x02; + break; } } -- 2.39.5