4 ms·
I remember seeing that the "zero page" instructions were all significantly faster and thinking "This Changes EVERYTHING!" As if I could rewrite my code to run
by billpg 7y ago
I remember seeing that the "zero page" instructions were all significantly faster and thinking "This Changes EVERYTHING!"
As if I could rewrite my code to run in only 256 bytes of working memory.
- forinti 7y agoYou would put only your data (or the most frequently used values, at least) in the zero page. Your code would then be smaller and faster. You would save a byte every time you had to load/save a value from zero page into/from a register. BBC Basic puts the work area for maths functions in the zero page.
- bonzini 7y agoYou can check at http://commodore64.se/wiki/index.php/Commodore_64_Memory_Map http://commodore64.se/wiki/index.php/Commodore_64_Memory_Map what kind of stuff goes in the zero page for Commodore's kernal and Basic. In particular, Basic puts the whole "get next byte" routine there at $0073. It is self-modifying code where the address of the next program byte is the operand of an LDA instruction. Placing the whole routine in zero page saves enough cycles on incrementing the next program byte that it's worth spending 5% of the whole zero page on it.
- forinti 7y agoCool stuff. I've seen something similar for handling interrupts when reading from floppies. It didn't use the zero page, but it could have.
- schlupa 7y ago65C816 and also Motorola 6809 could set any page as 0 page (called direct page).