[cc65] proper linking for c128's EXTROM

From: Chris Cureau <cmcureau1gmail.com>
Date: 2011-10-18 19:05:34
I'm pretty sure this is just a case of "you're doing it wrong", but...

A group of friends and I have been working on a program that fits into
EXTROM on a 128.  Of course, to get it to autostart, we need some magic
bytes ("CBM", rom version 01, etc.) as the first few bytes of the file.  Our
assembly accounts for this:

        .ORG $8000;

        ; c128 Option ROM trickery

        jmp initcold    ; Cold start vector
        jmp initwarm    ; Warm start vector
        .byte "$01"     ; '01' for Autostart
        .byte "$43,$42,$4d" ; "CBM"
        ...

linker config looks like this:

        MEMORY {
          ZP: start = $0002, size = $001A;
          OPTROM: start = $8000, size = $2000, file = "optrom.bin";
          RAM1: start = $1Bff, size = $6401;
        }

        SEGMENTS {
          CODE: load = OPTROM, type = ro;
          RODATA: load = OPTROM, type = ro;
          DATA: load = OPTROM, run = RAM1, type = rw, define = yes;
          BSS: load = RAM1, type = bss, define = yes;
      }

When we attempt to assemble and link, we get weird results...

00000000  4c 14 80 4c 15 80 24 30  31 24 34 33 2c 24 34 32
 |L..L..$01$43,$42|
00000010  2c 24 34 64 60 a5 01 05  83 85 01 ad 0b d0 05 31
 |,$4d`..........1|
00000020  8d 0b d0 ad 1e d0 05 00  8d 1e d0 20 6e 80 20 86  |........... n.
.|
00000030  80 20 a3 80 20 ae 80 20  b7 80 20 d0 80 20 86 80  |. .. .. .. ..
..|
00000040  ad 00 10 a2 ff 9d 00 10  20 a3 80 20 ae 80 ad 01  |........ ..
....|
00000050  81 e6 01 f0 0b 8d 01 81  a6 10 9d e9 80 4c 3d 80
 |.............L=.|
00000060  20 d7 80 ad 00 10 e6 04  8d 00 10 4c 00 10 a9 03  |
..........L....|
00000070  a2 e6 a0 80 20 bd ff a5  02 a6 08 a4 02 20 ba ff  |.... ........
..|
00000080  20 c0 ff b0 5d 60 a9 0a  a2 e9 a0 80 20 bd ff a5  | ...]`......
...|
00000090  0f a6 08 a4 0f 20 ba ff  20 c0 ff b0 45 a6 02 20  |..... .. ...E..
|
000000a0  c6 ff 60 a9 00 85 ae a9  10 85 af a4 00 60 20 cf  |..`..........`
.|
000000b0  ff 91 ae c8 d0 f8 60 ad  00 10 cd f3 80 d0 23 ad
 |......`.......#.|
000000c0  01 10 cd f4 80 d0 1b ad  02 10 cd f5 80 d0 13 60
 |...............`|
000000d0  ad 03 10 8d fe 80 60 a5  0f 20 c3 ff a5 02 20 c3  |......`.. ....
.|
000000e0  ff 60 20 d7 80 60 24 31  37 55 31 20 32 20 38 20  |.` ..`$17U1 2 8
|
000000f0  31 20 30 24 43 30 2c 24  46 46 2c 24 45 45 24 30  |1
0$C0,$FF,$EE$0|
00000100  30 24 30 30                                       |0$00|
00000104

I don't even see CBM in here...what's the issue?

Thanks,
Chris

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Oct 18 19:05:44 2011

This archive was generated by hypermail 2.1.8 : 2011-10-18 19:05:48 CEST