Jump to content
IGNORED

How to put op codes in RAM


Just Jeff

Recommended Posts

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?

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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 by bogax
I goofed
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...