Compile-time calculation: Difference between revisions
Content added Content deleted
(→{{header|6502 Assembly}}: Add implementation.) |
(→{{header|6502 Assembly}}: let cl65 provide the header) |
||
Line 66: | Line 66: | ||
fac = $61 ; location of the floating point accumulator used by ROM routines |
fac = $61 ; location of the floating point accumulator used by ROM routines |
||
facsgn = fac+5 ; specific location of the sign byte |
facsgn = fac+5 ; specific location of the sign byte |
||
sys = $9e ; BASIC token for the SYS command to call our ML routine |
|||
start_of_basic = $0801 ; where our code is loaded |
|||
; ROM routines used |
; ROM routines used |
||
Line 78: | Line 74: | ||
movfm = $bbd4 ; copy FAC to memory |
movfm = $bbd4 ; copy FAC to memory |
||
.code |
|||
; custom BASIC loader |
|||
.word start_of_basic |
|||
.org start_of_basic |
|||
.word last_line |
|||
.word * |
|||
.byte sys |
|||
.byte $30 + < (main/1000) |
|||
.byte $30 + <((main .mod 1000)/100) |
|||
.byte $30 + <((main .mod 100)/10) |
|||
.byte $30 + < (main .mod 10) |
|||
.byte 0 |
|||
last_line: |
|||
.word 0 |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
main: |
|||
; convert the upper half |
; convert the upper half |
||
ldy tenfactorial+2 |
ldy tenfactorial+2 |
||
Line 141: | Line 114: | ||
; and print out the result |
; and print out the result |
||
jsr putfac |
jsr putfac |
||
rts |
rts |
||
.data |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
.bss |
|||
⚫ | |||
⚫ | |||
{{Out}} |
{{Out}} |