diff --git a/control.asm b/control.asm index 037add9a0..e231807dd 100644 --- a/control.asm +++ b/control.asm @@ -113,13 +113,13 @@ EXIT lda HERE_LSB sec sbc #3 - sta .instr_ptr + tay lda HERE_MSB sbc #0 sta .instr_ptr + 1 lda #OP_JMP .instr_ptr = * + 1 - sta PLACEHOLDER_ADDRESS ; replaced with instruction pointer + sta PLACEHOLDER_ADDRESS,y ; replaced with instruction pointer rts + lda #OP_RTS diff --git a/core.asm b/core.asm index 45dcf28a3..0827b7961 100644 --- a/core.asm +++ b/core.asm @@ -123,10 +123,10 @@ EQUAL +BACKLINK "0=", 2 ZEQU ldy #0 - lda MSB, x - bne + lda LSB, x bne + + lda MSB, x + bne + dey + sty MSB, x sty LSB, x @@ -179,23 +179,21 @@ FETCH +BACKLINK "c!", 2 STOREBYTE - lda LSB,x - sta + + 1 + ldy LSB,x lda MSB,x sta + + 2 lda LSB+1,x -+ sta PLACEHOLDER_ADDRESS ; replaced with addr ++ sta PLACEHOLDER_ADDRESS,y ; replaced with addr inx inx rts +BACKLINK "c@", 2 FETCHBYTE - lda LSB,x - sta + + 1 + ldy LSB,x lda MSB,x sta + + 2 -+ lda PLACEHOLDER_ADDRESS ; replaced with addr ++ lda PLACEHOLDER_ADDRESS,y ; replaced with addr sta LSB,x lda #0 sta MSB,x diff --git a/durexforth.asm b/durexforth.asm index 511552968..0fcc00bf9 100644 --- a/durexforth.asm +++ b/durexforth.asm @@ -68,7 +68,8 @@ K_CLRSCR = $93 K_SPACE = ' ' ; PLACEHOLDER_ADDRESS instances are overwritten using self-modifying code. -PLACEHOLDER_ADDRESS = $1234 +; It must end in 00 for situations where the Y register is used as the LSB of the address. +PLACEHOLDER_ADDRESS = $1200 !ct pet