Compile-time calculation: Difference between revisions

(→‎{{header|6502 Assembly}}: Simplify by using .STRING)
Line 60:
{{works with|ca65}}
 
The ca65 cross-assembler supports computing and storing double-word (32-bit) integer values; unfortunately most 8-bit systems have no built-in support for manipulating such values. But the assembler also supports converting such values directly to strings inwhich can be stored directly into memory. So, here's a straightforward Commodore port:
 
<lang 6502>; Display the value of 10!, which is precomputed at assembly time
Line 76:
 
.code
 
lda #<tenfactorial
sta temp
Line 90 ⟶ 91:
rts
 
.data
; the actual value to print
tenfactorial: .byte 13,"10! = ",.string(10*9*8*7*6*5*4*3*2*1),13,0</lang>
1,480

edits