I'm beginning to use then ca65 assembler and ld65 linker on WIndows to create binary code for Commodore C64 computer, running on VICE emulator.
I write this small "hello world" source on file "basic2.s"
;--------------------------------------
; objetivo: assembly a header BASIC program
; to run binary code
;
; assembler: ca65
; http://cc65.github.io/doc
;
; v101-c101 2018-08-09 13:50:53 A.Alonso
;-----------------------------------------------------
PRINTTOKEN = $99
SYSTOKEN = $9e
chrout = $ffd2
.org $0801
;
Linea10: .word Linea20
.word 10
.byte PRINTTOKEN
.byte 39," NOMBRE PROGRAMA ",39
.byte 0
;--
Linea20: .word LineaEnd
.word 20
.byte SYSTOKEN
.byte " 2089"
.byte 0
;--
LineaEnd: .word 0 ; fin de lineas
.word 0 ; fin de programa
;--
;
Main: ldx #0
ciclo1: lda saludo,x
jsr chrout
inx
cpx #<(saludofin-saludo)
bcc ciclo1
salida: rts
saludo: .byte "--- HOLA MUNDO! -----"
saludofin: .byte 0
I can assemble with the command:
ca65 -t c64 basic2.s
And generate "basic2.o"
I read the documentation of the linker ld65 and it's confusing
I have tried unsuccessfully:
1-With command
ld65 basic2.o
error is:
ld65: Error: Memory configuration missing
2-With command
ld65 -C c64-asm.cfg basic2.o
error is:
ld65: Warning: c64-asm.cfg(21): Segment `LOADADDR' does not exist
Unresolved external `__LOADADDR__' referenced in:
c64-asm.cfg(5)
ld65: Error: 1 unresolved external(s) found - cannot create output file
Thanks