IRF Posted May 27, 2016 Report Share Posted May 27, 2016 How does the Spectrum/machine/emulator know that it should commence interpreting code at the address #8400? Quote Link to comment Share on other sites More sharing options...
Spider Posted May 27, 2016 Report Share Posted May 27, 2016 Its the start of the higher memory area aka 32768 up (uncontended) but I don't really know the specifics other than lower memory timing is 'shared'. This is why things like special funky loaders have to live in higher (uncontended) memory so they can guarantee they will be 'active' when tape data is arriving. Quote Link to comment Share on other sites More sharing options...
IRF Posted May 27, 2016 Author Report Share Posted May 27, 2016 (edited) But 32768 (in binary) equates to #8000, not #8400? So somehow the machine is starting off at a point that is 1 KB further on than the beginning of the Higher Memory Area? Edited May 27, 2016 by IRF Quote Link to comment Share on other sites More sharing options...
Spider Posted May 27, 2016 Report Share Posted May 27, 2016 I might be muddling it up. Contended Screen Ram The block of RAM between &4000 and &7FFF is contented, that is access to the RAM is shared between the processor and the ULA. The ULA has priority access when the screen is being drawn. Code that runs in or accesses contended memory will run slightly slower. For that reason it is recommended that speed critical routines (sprites, scrolling, etc) are not executed in this area of RAM. http://www.animatez.co.uk/computers/zx-spectrum/memory-map/ http://scratchpad.wikia.com/wiki/Contended_memory IRF 1 Quote Link to comment Share on other sites More sharing options...
IRF Posted May 27, 2016 Author Report Share Posted May 27, 2016 (edited) It's clear that #8000 is the start of the uncontended (higher) memory. But I'm still none the wiser as to why the program starts running at #8400?! Is it hard-wired into the processor? i.e. do all Spectrum games have that starting point? Edited May 27, 2016 by IRF Quote Link to comment Share on other sites More sharing options...
Spider Posted May 27, 2016 Report Share Posted May 27, 2016 No they can start anywhere. IRF 1 Quote Link to comment Share on other sites More sharing options...
andrewbroad Posted May 27, 2016 Report Share Posted May 27, 2016 How does the Spectrum/machine/emulator know that it should commence interpreting code at the address #8400? The BASIC loader calls USR 33792. Spider and IRF 2 Quote Link to comment Share on other sites More sharing options...
Spider Posted May 27, 2016 Report Share Posted May 27, 2016 I think I overlooked Ian's obvious question as I was thinking interrupts not execution address. You could for instance Ian insert a JP at say 65000 (assuming last room is empty) to do JP 33792 Then you (could) start the game by doing a USR 65000 instead. IRF 1 Quote Link to comment Share on other sites More sharing options...
IRF Posted May 27, 2016 Author Report Share Posted May 27, 2016 (edited) But if I'm running game files on an emulator, with no loader, how does it know to start at #8400? Edited May 27, 2016 by IRF Quote Link to comment Share on other sites More sharing options...
SkoolKid Posted May 27, 2016 Report Share Posted May 27, 2016 But if I'm running game files on an emulator, with no loader, how does it know to start at #8400? Are you asking how an emulator knows where to begin execution when loading a snapshot file? If so, the answer is that the emulator takes the value of the program counter (PC) that is stored in the snapshot file. In a SNA file, PC is stored at the top of the stack (and must be popped off before execution begins). In a Z80 file, PC is stored in the header (like all the other register values). In an SZX snapshot, PC is stored in the ZXSTZ80REGS block (along with all the other register values). Spider, IRF and andrewbroad 3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.