*
refers to current address location, and can be read
from or written to*=....
line to set the
starting address.byte
values must be hexadecimal only, and single byte
hexadecimal must always include 2 characters.
i.e. $0e
will work, but $e
won’t work.#$01
will work.
#$1
won’t work.
library(c64asm)
asm <- '
*=$0801
.byte $0c, $08, $0a, $00, $9e, $20
.byte $32, $30, $38, $30, $00, $00
.byte $00
*=$0820
lda #$93 ; Clear the screen
jsr $ffd2
ldx #$00 ; initialise the offset pointer into our message
loop lda message,x ; load a character and write it to screen
and #$3f ; Manually place chars on screen
sta $0400,x
inx
cpx #$0e
bne loop
rts
message
.text "Hello #rstats!"
'
c64asm::compile()
to convert ASM into bytes.prg_df
data.frame to view and save.
prg <- c64asm::compile(asm)
prg
#> [1] 01 08 0c 08 0a 00 9e 20 32 30 38 30 00 00 00 00 00 00 00 00 00 00 00 00 00
#> [26] 00 00 00 00 00 00 00 00 a9 93 20 d2 ff a2 00 bd 35 08 29 3f 9d 00 04 e8 e0
#> [51] 0e d0 f3 60 c8 45 4c 4c 4f 20 23 52 53 54 41 54 53 21
c64asm
isn’t a complete or bug-free assembler by any
means!
line_tokens <- c64asm::create_line_tokens(asm)
prg_df <- c64asm::create_prg_df(line_tokens)
prg_df <- c64asm::process_symbols(prg_df)
prg_df <- c64asm::process_zero_padding(prg_df)
c64asm::extract_prg_bytes(prg_df)
#> [1] 01 08 0c 08 0a 00 9e 20 32 30 38 30 00 00 00 00 00 00 00 00 00 00 00 00 00
#> [26] 00 00 00 00 00 00 00 00 a9 93 20 d2 ff a2 00 bd 35 08 29 3f 9d 00 04 e8 e0
#> [51] 0e d0 f3 60 c8 45 4c 4c 4f 20 23 52 53 54 41 54 53 21