LDA #foo sta $01 jsr PrintBytecode foo: ;do stuff rts PrintBytecode: ldy #0 lda $01 ;high byte of starting address of the source jsr PrintHex ;unimplemented routine that separates the "nibbles" of the accumulator, ; adds $30 or $37 to each depending on if it's 0-9 or A-F respectively, which converts hex to ASCII, ; then prints the high nibble then the low. lda $00 ;low byte of the starting address of the source jsr PrintHex jsr NewLine ;unimplemented new line routine loop: lda ($00),y cmp #$60 beq Terminated jsr PrintHex jmp loop Terminated: jsr PrintHex ;print the last instruction of the routine. rts