]> git.sur5r.net Git - cc65/commitdiff
Nominal support for target Ohio Scientific Challenger 1P
authorStephan Mühlstrasser <stephan.muehlstrasser@web.de>
Sun, 14 Jul 2013 20:50:38 +0000 (22:50 +0200)
committerStephan Mühlstrasser <stephan.muehlstrasser@web.de>
Sun, 14 Jul 2013 20:50:38 +0000 (22:50 +0200)
cfg/c1p.cfg [new file with mode: 0644]
libsrc/Makefile
libsrc/c1p/crt0.s [new file with mode: 0644]
src/ca65/main.c
src/cc65/main.c
src/common/target.c
src/common/target.h

diff --git a/cfg/c1p.cfg b/cfg/c1p.cfg
new file mode 100644 (file)
index 0000000..752e815
--- /dev/null
@@ -0,0 +1,30 @@
+SYMBOLS {
+    __STACKSIZE__: type = weak, value = $0400; # 1k stack
+}
+MEMORY {
+    ZP:       file = "", define = yes, start = $0002, size = $001A;
+    LOADADDR: file = %O,               start = $0FFF, size = $0002;
+    HEADER:   file = %O,               start = $1001, size = $000C;
+    RAM:      file = %O, define = yes, start = $100D, size = $0DF3 - __STACKSIZE__;
+}
+SEGMENTS {
+    STARTUP:  load = RAM,      type = ro;
+    LOWCODE:  load = RAM,      type = ro,                optional = yes;
+    INIT:     load = RAM,      type = ro,  define = yes, optional = yes;
+    CODE:     load = RAM,      type = ro;
+    RODATA:   load = RAM,      type = ro;
+    DATA:     load = RAM,      type = rw;
+    ZPSAVE:   load = RAM,      type = bss;
+    BSS:      load = RAM,      type = bss, define = yes;
+    ZEROPAGE: load = ZP,       type = zp;
+}
+FEATURES {
+    CONDES: type    = constructor,
+            label   = __CONSTRUCTOR_TABLE__,
+            count   = __CONSTRUCTOR_COUNT__,
+            segment = INIT;
+    CONDES: type    = destructor,
+            label   = __DESTRUCTOR_TABLE__,
+            count   = __DESTRUCTOR_COUNT__,
+            segment = RODATA;
+}
index d855d15807fb59febe0a91600223405a9c93d647..9955d6d77d3725e5752e7be96034cc3d27261f0f 100644 (file)
@@ -15,6 +15,7 @@ TARGETS = apple2    \
           atari     \
           atarixl   \
           atmos     \
+          c1p       \
           $(CBMS)   \
           $(GEOS)   \
           lynx      \
diff --git a/libsrc/c1p/crt0.s b/libsrc/c1p/crt0.s
new file mode 100644 (file)
index 0000000..f8005b6
--- /dev/null
@@ -0,0 +1,54 @@
+; ---------------------------------------------------------------------------
+; crt0.s
+; ---------------------------------------------------------------------------
+;
+; Startup code for Ohio Scientific Challenger 1P
+
+.export   _init, _exit
+.import   _main
+
+.export   __STARTUP__ : absolute = 1        ; Mark as startup
+.import   __RAM_START__, __RAM_SIZE__       ; Linker generated
+
+.import    copydata, zerobss, initlib, donelib
+
+.include  "zeropage.inc"
+
+; ---------------------------------------------------------------------------
+; Place the startup code in a special segment
+
+.segment  "STARTUP"
+
+; ---------------------------------------------------------------------------
+; A little light 6502 housekeeping
+
+_init:    LDX     #$FF                 ; Initialize stack pointer to $01FF
+          TXS
+          CLD                          ; Clear decimal mode
+
+; ---------------------------------------------------------------------------
+; Set cc65 argument stack pointer
+
+          LDA     #<(__RAM_START__ + __RAM_SIZE__)
+          STA     sp
+          LDA     #>(__RAM_START__ + __RAM_SIZE__)
+          STA     sp+1
+
+; ---------------------------------------------------------------------------
+; Initialize memory storage
+
+          ; JSR     zerobss              ; Clear BSS segment
+          ; JSR     copydata             ; Initialize DATA segment
+          ; JSR     initlib              ; Run constructors
+
+; ---------------------------------------------------------------------------
+; Call main()
+
+          JSR     _main
+
+; ---------------------------------------------------------------------------
+; Back from main (this is also the _exit entry):  force a software break
+
+_exit:    JSR     donelib              ; Run destructors
+          BRK
+
index 4b2f9d1781a8ac6083b094c347ad4f05d2cb40e2..5a9bf70835b3d15b0c750e0976f73f7ca3ad264c 100644 (file)
@@ -298,6 +298,10 @@ static void SetSys (const char* Sys)
             NewSymbol ("__SIM65C02__", 1);
             break;
 
+               case TGT_C1P:
+            NewSymbol ("__OSIC1P__", 1);
+            break;
+
         default:
             AbEnd ("Invalid target name: `%s'", Sys);
 
index a27822ed8718fe58d700fd7125ae00987bb81b38..6882d56a323190d5e3ec8a3dbe271b240cce2655 100644 (file)
@@ -254,6 +254,10 @@ static void SetSys (const char* Sys)
             DefineNumericMacro ("__SIM65C02__", 1);
             break;
 
+               case TGT_C1P:
+            DefineNumericMacro ("__OSIC1P__", 1);
+            break;
+
         default:
             AbEnd ("Unknown target system type %d", Target);
     }
index a4287ee5699a473827e5ffd08af89fd74f4e2f90..d8d3f9c54bd3dc28c2a2678763e13b063c4e766a 100644 (file)
@@ -119,7 +119,7 @@ struct TargetEntry {
 };
 
 /* Table that maps target names to ids. Sorted alphabetically for bsearch.
- * Allows mupltiple entries for one target id (target name aliases).
+ * Allows multiple entries for one target id (target name aliases).
  */
 static const TargetEntry TargetMap[] = {
     {   "apple2",       TGT_APPLE2      },
@@ -130,6 +130,7 @@ static const TargetEntry TargetMap[] = {
     {   "bbc",          TGT_BBC         },
     {   "c128",         TGT_C128        },
     {   "c16",          TGT_C16         },
+       {   "c1p",          TGT_C1P         },
     {   "c64",          TGT_C64         },
     {   "cbm510",       TGT_CBM510      },
     {   "cbm610",       TGT_CBM610      },
@@ -160,6 +161,7 @@ static const TargetProperties PropertyTable[TGT_COUNT] = {
     { "atarixl",        CPU_6502,       BINFMT_BINARY,      CTAtari },
     { "vic20",          CPU_6502,       BINFMT_BINARY,      CTPET   },
     { "c16",            CPU_6502,       BINFMT_BINARY,      CTPET   },
+    { "c1p",            CPU_6502,       BINFMT_BINARY,      CTNone  },
     { "c64",            CPU_6502,       BINFMT_BINARY,      CTPET   },
     { "c128",           CPU_6502,       BINFMT_BINARY,      CTPET   },
     { "plus4",          CPU_6502,       BINFMT_BINARY,      CTPET   },
index e1675ad651c08e1f61fdcdec4530e1e8b7d4580d..47946a3099d9aba3526660693c2fbe18d06c87b5 100644 (file)
@@ -58,6 +58,7 @@ typedef enum {
     TGT_ATARIXL,
     TGT_VIC20,
     TGT_C16,
+       TGT_C1P,
     TGT_C64,
     TGT_C128,
     TGT_PLUS4,