RosettaCodeData/Task/Compile-time-calculation/6502-Assembly/compile-time-calculation.6502

34 lines
537 B
Plaintext

; Display the value of 10!, which is precomputed at assembly time
; on any Commodore 8-bit.
.ifndef __CBM__
.error "Target must be a Commodore system."
.endif
; zero-page work pointer
temp = $fb
; ROM routines used
chrout = $ffd2
.code
lda #<tenfactorial
sta temp
lda #>tenfactorial
sta temp+1
ldy #0
loop:
lda (temp),y
beq done
jsr chrout
iny
bne loop
done:
rts
.data
; the actual value to print
tenfactorial: .byte 13,"10! = ",.string(10*9*8*7*6*5*4*3*2*1),13,0