ld65 -o $*.prg -C c64.cfg -m $*.c64.map -vm $< $(IP65LIB) $(C64DRIVERLIB) c64.lib
FEATURES { STARTADDRESS: default = $8000; } SYMBOLS { __LOADADDR__: type = import; # __EXEHDR__: type = import; __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $7700; } MEMORY { ZP: file = "", define = yes, start = $0002, size = $001A; LOADADDR: file = %O, start = %S - 2, size = $0002; HEADER: file = %O, define = yes, start = %S, size = $000D; MAIN: file = %O, define = yes, start = __HEADER_LAST__, size = __HIMEM__ - __HEADER_LAST__; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; LOADADDR: load = LOADADDR, type = ro; # EXEHDR: load = HEADER, type = ro; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; RODATA: load = MAIN, type = ro; DATA: load = MAIN, type = rw; INIT: load = MAIN, type = rw; ONCE: load = MAIN, type = ro, define = yes; BSS: load = BSS, type = bss, define = yes; } FEATURES { CONDES: type = constructor, label = __CONSTRUCTOR_TABLE__, count = __CONSTRUCTOR_COUNT__, segment = ONCE; CONDES: type = destructor, label = __DESTRUCTOR_TABLE__, count = __DESTRUCTOR_COUNT__, segment = RODATA; CONDES: type = interruptor, label = __INTERRUPTOR_TABLE__, count = __INTERRUPTOR_COUNT__, segment = RODATA, import = __CALLIRQ__; }
.include "../inc/common.i" .include "../inc/commonprint.i" .include "../inc/net.i" .export start .import exit_to_basic .import print_a .import get_key .import ascii_to_native .import parser_init .import parser_skip_next .importzp copy_src .importzp copy_dest .import url_ip .import url_port .import url_selector .import url_resource_type .import url_parse .import url_download .import url_download_buffer .import url_download_buffer_length temp_buff = copy_dest ; keep LD65 happy .segment "INIT" .segment "ONCE" .segment "STARTUP" ; switch to lower case charset lda #14 jsr print_a lda #0 sta $d020 sta $d021 start: jsr print_cr init_ip_via_dhcp jsr print_ip_config ldax #url_1 jsr test_url_download ldax #url_2 jsr test_url_download jmp exit_to_basic test_url_download: stax temp_url_ptr ldax #downloading jsr print ldax temp_url_ptr jsr print jsr print_cr ldax #dl_buffer stax url_download_buffer ldax #dl_buffer_length stax url_download_buffer_length ldax temp_url_ptr jsr url_download bcc :+ jmp print_errorcode : ldax #dl_buffer jsr parser_init @next_title: ldax #title jsr parser_skip_next bcs @done jsr print_tag_contents jsr print_cr jmp @next_title @done: rts wait_key: ldax #press_a_key jsr print jmp get_key print_tag_contents: stax temp_buff lda #0 sta string_offset @next_byte: ldy string_offset lda (temp_buff),y beq @done cmp #'<' beq @done jsr ascii_to_native jsr print_a inc string_offset beq @done inc $d020 jmp @next_byte @done: rts .data title: .byte "<title>",0 url_1: .byte "http://wbochar.com/dl/test.txt",0 url_2: .byte "http://wbochar.com/dl/test.htm",0 downloading: .asciiz "DOWNLOADING " press_a_key: .byte "PRESS ANY KEY TO CONTINUE",13,0 .bss string_offset: .res 1 selector_ptr: .res 2 temp_url_ptr: .res 2 dl_buffer_length = 8092 dl_buffer: .res dl_buffer_length
Remove LOADADDR and HEADER alltogether firstly if you wanna make a .crt-file.
(C:$ff4b) d $8000 .C:8000 09 80 ORA #$80 .C:8002 09 80 ORA #$80 .C:8004 C3 C2 DCP ($C2,X) .C:8006 CD 38 30 CMP $3038 .C:8009 EA NOP .C:800a EA NOP .C:800b EA NOP .C:800c EA NOP .C:800d EA NOP .C:800e A9 1A LDA #$1A .C:8010 20 D2 FF JSR $FFD2 .C:8013 A9 01 LDA #$01 .C:8015 8D 20 D0 STA $D020 .C:8018 8D 21 D0 STA $D021 .C:801b EE 21 D0 INC $D021 .C:801e 4C 15 80 JMP $8015 .C:8021 20 90 9B JSR $9B90 .C:8024 20 1D 8B JSR $8B1D .C:8027 08 PHP .C:8028 A9 24 LDA #$24 ...
FEATURES {} SYMBOLS { __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $8000-300; } MEMORY { ZP: file = "", define = yes, start = $0002, size = $001A; MAIN: file = %O, define = yes, start = $8000, size=$4000; TEMP: file ="", define=yes, start=$4000, size = $1000; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; RODATA: load = MAIN, type = ro; DATA: load = TEMP, type = rw; INIT: load = MAIN, type = rw; ONCE: load = MAIN, type = ro, define = yes; BSS: load = BSS, type = bss, define = yes; }