summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/zx81.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/source/zx81.c b/source/zx81.c
index b8143cd..fb6f801 100644
--- a/source/zx81.c
+++ b/source/zx81.c
@@ -887,11 +887,27 @@ void ZX81Init(uint16 *text_vram, uint16* bitmap_vram, Z80 *z80)
RAMBOT=0x4000;
RAMTOP=RAMBOT+0x4000;
- for(f=RAMBOT;f<=RAMTOP;f++)
- mem[f]=0;
+ for(f = RAMBOT; f <= RAMTOP; f++)
+ {
+ mem[f] = 0;
+ }
+
+ for(f = 0; f < 8; f++)
+ {
+ matrix[f] = 0x1f;
+ }
+
+ /* Fill the upper 32K with RET opcodes -- hopefully by simply returning
+ RET for ULA reads we save a lot of ROM patching shenanigans.
+
+ Note that this check used to be in ZX81ReadMem, but obviously this
+ should cut down on a *lot* of pointless expression evaluation!
+ */
+ for(f = 0x8000; f <= RAMTOP; f++)
+ {
+ mem[f] = 0xc9;
+ }
- for(f=0;f<8;f++)
- matrix[f]=0x1f;
}
@@ -917,17 +933,7 @@ void ZX81HandleKey(SoftKey key, int is_pressed)
Z80Byte ZX81ReadMem(Z80 *z80, Z80Word addr)
{
- /* Hopefully by simply returning RET for ULA reads we save a lot of
- ROM patching shenanigans.
- */
- if (addr>0x7fff)
- {
- return 0xc9;
- }
- else
- {
- return mem[addr];
- }
+ return mem[addr];
}