Just Jeff Posted November 10, 2019 Share Posted November 10, 2019 Good Morning, Can anyone please tell me a good way to get Dasm to put op codes and operands in RAM? I'll be running some code there for speed but looking up the op codes and then storing that number seems like it might be more difficult than it has to be. Best I can think of is defining some op codes as constants and then loading and storing them such as: LDAImmediate = $A9 ; Load the accumulator with an immediate And then to write lda #20 in the RAM code, my ROM code would be something like: lda #LDAImmediate sta $80 lda #20 sta $81 Is this a decent method or is there something better? Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted November 10, 2019 Share Posted November 10, 2019 I fixed the code blocks in this blog entry, it might help. 1 Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted November 10, 2019 Share Posted November 10, 2019 Note: I noticed a crucial bit of code was missing - the ROM copy (ZProutineROM) and size calculation (ZPsize). I added that while you were reading the blog post. Quote Link to comment Share on other sites More sharing options...
Just Jeff Posted November 10, 2019 Author Share Posted November 10, 2019 Thanks! So that looks really straight forward if I understand it correctly. Like this?: ZProutineRAM ds 16 ldy #15 InitZP lda ZProutineROM,y sta ZProutineRAM,y dey bpl InitZP ZProutineROM: ;read 3 bytes of garbage from here up. Be careful about the jump to RAM ;address because it can change. I think I might use iny and cpy #15 instead. lda #SomeNumber ; 2 bytes sta SomeRegister ; 2 bytes lda ($44,X) ; 6 bytes jmp KernelEnd ; 3 bytes Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted November 10, 2019 Share Posted November 10, 2019 Looks like your code snippet got a bit mangled, the line with lda LDA, but yep that's the idea. Quote Link to comment Share on other sites More sharing options...
Just Jeff Posted November 10, 2019 Author Share Posted November 10, 2019 OK yeah I fixed it- Thanks... And I see the ZPsize too which would eliminate the jmp issue I mentioned. Though that looks like it can be risky if I don't manage RAM appropriately. Quote Link to comment Share on other sites More sharing options...
bogax Posted November 10, 2019 Share Posted November 10, 2019 (edited) 2 hours ago, BNE Jeff said: Thanks! So that looks really straight forward if I understand it correctly. Like this?: ZProutineRAM ds 16 ldy #15 InitZP lda ZProutineROM,y sta ZProutineRAM,y dey bpl InitZP ZProutineROM: ;read 3 bytes of garbage from here up. Be careful about the jump to RAM ;address because it can change. I think I might use iny and cpy #15 instead. lda #SomeNumber ; 2 bytes sta SomeRegister ; 2 bytes lda ($44,X) ; 6 bytes jmp KernelEnd ; 3 bytes edit never mind Edited November 10, 2019 by bogax I goofed 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.