RosettaCodeData/Task/Machine-code/6502-Assembly/machine-code-2.6502

34 lines
904 B
Plaintext

main:
LDX #$00 ;initialize array offset to 0
LDA #$A9 ;LDA #immediate
STA Array,x ;store at offset 0
INX ;next offset
LDA #$07 ;first parameter
STA Array,x ;store at offset 1
INX ;next offset
LDA #$18 ;CLC
STA Array,x ;store at offset 2
INX ;next offset
LDA #$69 ;ADC #immediate
STA Array,x ;store at offset 3
INX ;next offset
LDA #$0C ;second parameter
STA Array,x ;store at offset 4
INX ;next offset
LDA #$60 ;RTS
STA Array,x ;store at offset 5
JMP Array ;assuming we used a JSR to get to main, the RTS at the end of this RAM will return us back to BASIC.
;if array is directly underneath this statement, we can actually omit this JMP entirely
;and execution will simply fall through to the array.
Array:
byte 0,0,0,0,0,0