]> git.sur5r.net Git - cc65/commitdiff
Replaced builtin macro packages with .mac files that are included like ordinary ...
authorOliver Schmidt <ol.sc@web.de>
Sun, 7 Apr 2013 20:10:30 +0000 (22:10 +0200)
committerOliver Schmidt <ol.sc@web.de>
Sun, 7 Apr 2013 22:11:05 +0000 (00:11 +0200)
The benefits are:
- Independency of ca65 build from perl
- More transparent behaviour

16 files changed:
asminc/atari.mac [new file with mode: 0644]
asminc/cbm.mac [new file with mode: 0644]
asminc/cpu.mac [new file with mode: 0644]
asminc/generic.mac [new file with mode: 0644]
asminc/longbranch.mac [new file with mode: 0644]
src/ca65/macpack.c [deleted file]
src/ca65/macpack.h [deleted file]
src/ca65/macpack/atari.mac [deleted file]
src/ca65/macpack/cbm.mac [deleted file]
src/ca65/macpack/cpu.mac [deleted file]
src/ca65/macpack/cvt-mac.pl [deleted file]
src/ca65/macpack/generic.mac [deleted file]
src/ca65/macpack/longbranch.mac [deleted file]
src/ca65/main.c
src/ca65/make/gcc.mak
src/ca65/pseudo.c

diff --git a/asminc/atari.mac b/asminc/atari.mac
new file mode 100644 (file)
index 0000000..8e76888
--- /dev/null
@@ -0,0 +1,59 @@
+; Convert characters to screen codes
+                                                              
+; Helper macro that converts and outputs one character
+.macro _scrcode char
+        .if (char >= 0) .and (char <= 31)
+                .byte   (char + 64)
+        .elseif (char >= 32) .and (char <= 95)
+                .byte   (char - 32)
+        .elseif (char >= 96) .and (char <= 127)
+                .byte   char
+        .elseif (char >= 128) .and (char <= 159)
+                .byte   (char + 64)
+        .elseif (char >= 160) .and (char <= 223)
+                .byte   (char - 32)
+        .elseif (char >= 224) .and (char <= 255)
+                .byte   char
+        .else
+                .error  "scrcode: Character constant out of range"
+        .endif
+.endmacro
+
+.macro  scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
+
+        ; Bail out if next argument is empty
+        .if     .blank (arg1)
+                .exitmacro
+        .endif
+
+        ; Check for a string
+        .if     .match ({arg1}, "")
+
+                ; Walk over all string chars
+                .repeat .strlen (arg1), i
+                        _scrcode        {.strat (arg1, i)}
+                .endrepeat
+
+        ; Check for a number
+        .elseif .match (.left (1, {arg1}), 0)
+
+                ; Just output the number
+                _scrcode        arg1
+
+        ; Check for a character
+        .elseif .match (.left (1, {arg1}), 'a')
+
+                ; Just output the character
+                _scrcode        arg1
+
+        ; Anything else is an error
+        .else
+
+                .error  "scrcode: invalid argument type"
+
+        .endif
+
+        ; Call the macro recursively with the remaining args
+        scrcode arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
+.endmacro
+
diff --git a/asminc/cbm.mac b/asminc/cbm.mac
new file mode 100644 (file)
index 0000000..a6ec9f8
--- /dev/null
@@ -0,0 +1,62 @@
+; Convert characters to screen codes
+
+; Helper macro that converts and outputs one character
+.macro _scrcode char
+        .if (char >= '@' .and char <= 'z')
+                .byte   (char - '@')
+        .elseif (char >= 'A' .and char <= 'Z')
+                .byte   (char - 'A' + 65)
+        .elseif (char = '[')
+                .byte   27
+        .elseif (char = ']')
+                .byte   29
+        .elseif (char = '^')
+                .byte   30
+        .elseif (char = '_')
+                .byte   31
+        .elseif (char < 256)
+                .byte   char
+        .else
+                .error  "scrcode: Character constant out of range"
+        .endif
+.endmacro
+
+.macro  scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
+
+        ; Bail out if next argument is empty
+        .if     .blank (arg1)
+                .exitmacro
+        .endif
+
+        ; Check for a string
+        .if     .match ({arg1}, "")
+
+                ; Walk over all string chars
+                .repeat .strlen (arg1), i
+                        _scrcode        {.strat (arg1, i)}
+                .endrepeat
+
+        ; Check for a number
+        .elseif .match (.left (1, {arg1}), 0)
+
+                ; Just output the number
+                _scrcode        arg1
+
+        ; Check for a character
+        .elseif .match (.left (1, {arg1}), 'a')
+
+                ; Just output the character
+                _scrcode        arg1
+
+        ; Anything else is an error
+        .else
+
+                .error  "scrcode: invalid argument type"
+
+        .endif
+
+        ; Call the macro recursively with the remaining args
+        scrcode arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
+.endmacro
+
+
diff --git a/asminc/cpu.mac b/asminc/cpu.mac
new file mode 100644 (file)
index 0000000..43c9e16
--- /dev/null
@@ -0,0 +1,24 @@
+
+; CPU bitmask constants
+CPU_ISET_NONE      = $0001
+CPU_ISET_6502      = $0002
+CPU_ISET_6502X     = $0004
+CPU_ISET_65SC02    = $0008
+CPU_ISET_65C02     = $0010
+CPU_ISET_65816     = $0020
+CPU_ISET_SUNPLUS   = $0040
+CPU_ISET_SWEET16   = $0080
+CPU_ISET_HUC6280   = $0100
+
+; CPU capabilities
+CPU_NONE           = CPU_ISET_NONE
+CPU_6502           = CPU_ISET_6502
+CPU_6502X          = CPU_ISET_6502|CPU_ISET_6502X
+CPU_65SC02         = CPU_ISET_6502|CPU_ISET_65SC02
+CPU_65C02          = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02
+CPU_65816          = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65816
+CPU_SUNPLUS        = CPU_ISET_SUNPLUS
+CPU_SWEET16        = CPU_ISET_SWEET16
+CPU_HUC6280        = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02|CPU_ISET_HUC6280
+
+                                                                                  
diff --git a/asminc/generic.mac b/asminc/generic.mac
new file mode 100644 (file)
index 0000000..02eccef
--- /dev/null
@@ -0,0 +1,45 @@
+
+; add - Add without carry
+.macro  add     Arg1, Arg2
+        clc
+        .if .paramcount = 2
+                adc     Arg1, Arg2
+        .else
+                adc     Arg1
+        .endif
+.endmacro
+
+; sub - subtract without borrow
+.macro  sub     Arg1, Arg2
+        sec
+        .if .paramcount = 2
+                sbc     Arg1, Arg2
+        .else
+                sbc     Arg1
+        .endif
+.endmacro
+
+; bge - jump if unsigned greater or equal
+.macro  bge     Arg
+        bcs     Arg
+.endmacro
+
+; blt - Jump if unsigned less
+.macro  blt     Arg
+        bcc     Arg
+.endmacro
+
+; bgt - jump if unsigned greater
+.macro  bgt     Arg
+        .local  L
+        beq     L
+        bcs     Arg
+L:
+.endmacro
+
+; ble - jump if unsigned less or equal
+.macro  ble     Arg
+        beq     Arg
+        bcc     Arg
+.endmacro
+
diff --git a/asminc/longbranch.mac b/asminc/longbranch.mac
new file mode 100644 (file)
index 0000000..d6f6cde
--- /dev/null
@@ -0,0 +1,88 @@
+.macro  jeq     Target
+        .if     .match(Target, 0)
+        bne     *+5
+        jmp     Target
+        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
+                beq     Target
+        .else
+                bne     *+5
+                jmp     Target
+        .endif
+.endmacro
+.macro  jne     Target
+        .if     .match(Target, 0)
+                beq     *+5
+                jmp     Target
+        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
+                bne     Target
+        .else
+                beq     *+5
+                jmp     Target
+        .endif
+.endmacro
+.macro  jmi     Target
+        .if     .match(Target, 0)
+                bpl     *+5
+                jmp     Target
+        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
+                bmi     Target
+        .else
+                bpl     *+5
+                jmp     Target
+        .endif
+.endmacro
+.macro  jpl     Target
+        .if     .match(Target, 0)
+                bmi     *+5
+                jmp     Target
+        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
+                bpl     Target
+        .else
+                bmi     *+5
+                jmp     Target
+        .endif
+.endmacro
+.macro  jcs     Target
+        .if     .match(Target, 0)
+                bcc     *+5
+                jmp     Target
+        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
+                bcs     Target
+        .else
+                bcc     *+5
+                jmp     Target
+        .endif
+.endmacro
+.macro  jcc     Target
+        .if     .match(Target, 0)
+                bcs     *+5
+                jmp     Target
+        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
+                bcc     Target
+        .else
+                bcs     *+5
+                jmp     Target
+        .endif
+.endmacro
+.macro  jvs     Target
+        .if     .match(Target, 0)
+                bvc     *+5
+                jmp     Target
+        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
+                bvs     Target
+        .else
+                bvc     *+5
+                jmp     Target
+        .endif
+.endmacro
+.macro  jvc     Target
+        .if     .match(Target, 0)
+                bvs     *+5
+                jmp     Target
+        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
+                bvc     Target
+        .else
+                bvs     *+5
+                jmp     Target
+        .endif
+.endmacro
diff --git a/src/ca65/macpack.c b/src/ca65/macpack.c
deleted file mode 100644 (file)
index 7efd9a5..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*****************************************************************************/
-/*                                                                           */
-/*                                macpack.c                                 */
-/*                                                                           */
-/*          Predefined macro packages for the ca65 macroassembler           */
-/*                                                                           */
-/*                                                                           */
-/*                                                                           */
-/* (C) 1998-2008, Ullrich von Bassewitz                                      */
-/*                Roemerstrasse 52                                            */
-/*                D-70794 Filderstadt                                        */
-/* EMail:         uz@cc65.org                                                */
-/*                                                                           */
-/*                                                                           */
-/* This software is provided 'as-is', without any expressed or implied       */
-/* warranty.  In no event will the authors be held liable for any damages    */
-/* arising from the use of this software.                                    */
-/*                                                                           */
-/* Permission is granted to anyone to use this software for any purpose,     */
-/* including commercial applications, and to alter it and redistribute it    */
-/* freely, subject to the following restrictions:                            */
-/*                                                                           */
-/* 1. The origin of this software must not be misrepresented; you must not   */
-/*    claim that you wrote the original software. If you use this software   */
-/*    in a product, an acknowledgment in the product documentation would be  */
-/*    appreciated but is not required.                                       */
-/* 2. Altered source versions must be plainly marked as such, and must not   */
-/*    be misrepresented as being the original software.                      */
-/* 3. This notice may not be removed or altered from any source              */
-/*    distribution.                                                          */
-/*                                                                           */
-/*****************************************************************************/
-
-
-
-/* common */
-#include "check.h"
-#include "strbuf.h"
-#include "strutil.h"
-
-/* ca65 */
-#include "error.h"
-#include "scanner.h"
-#include "macpack.h"
-
-
-
-/*****************************************************************************/
-/*                                          Data                                    */
-/*****************************************************************************/
-
-
-
-/* Predefined macro packages converted into C strings by a perl script */
-#include "atari.inc"
-#include "cbm.inc"
-#include "cpu.inc"
-#include "generic.inc"
-#include "longbranch.inc"
-
-/* Table with pointers to the different packages */
-static struct {
-    const char* Name;
-    char*       Package;
-} MacPackages[MAC_COUNT] = {
-    /* Packages sorted by id */
-    { "atari",          MacAtari        },
-    { "cbm",            MacCBM          },
-    { "cpu",            MacCPU          },
-    { "generic",        MacGeneric      },
-    { "longbranch",     MacLongBranch   },
-};
-
-/* Directory that contains standard macro package files */
-static StrBuf MacPackDir = STATIC_STRBUF_INITIALIZER;
-
-
-
-/*****************************************************************************/
-/*                                          Code                                    */
-/*****************************************************************************/
-
-
-
-int MacPackFind (const StrBuf* Name)
-/* Find a macro package by name. The function will either return the id or
- * -1 if the package name was not found.
- */
-{
-    int I;
-
-    for (I = 0; I < MAC_COUNT; ++I) {
-        if (SB_CompareStr (Name, MacPackages[I].Name) == 0) {
-            /* Found */
-            return I;
-        }
-    }
-
-    /* Not found */
-    return -1;
-}
-
-
-
-int MacPackInsert (int Id)
-/* Insert the macro package with the given id in the input stream. Returns
- * true if the macro package was found and successfully inserted. Returns
- * false otherwise.
- */
-{                   
-    int RetCode;
-
-    /* Check the parameter */
-    CHECK (Id >= 0 && Id < MAC_COUNT);
-
-    /* If we have a macro package directory given, load a file from the
-     * directory, otherwise use the builtin stuff.
-     */
-    if (SB_IsEmpty (&MacPackDir)) {
-
-        /* Insert the builtin package */
-        NewInputData (MacPackages[Id].Package, 0);
-
-        /* Always successful */
-        RetCode = 1;
-
-    } else {
-
-        StrBuf Filename = AUTO_STRBUF_INITIALIZER;
-
-        /* Build the complete file name */
-        SB_Copy (&Filename, &MacPackDir);
-        SB_AppendStr (&Filename, MacPackages[Id].Name);
-        SB_AppendStr (&Filename, ".mac");
-        SB_Terminate (&Filename);
-
-        /* Open the macro package as include file */
-        RetCode = NewInputFile (SB_GetConstBuf (&Filename));
-
-        /* Destroy the contents of Filename */
-        SB_Done (&Filename);
-
-    }
-
-    /* Return the success code */
-    return RetCode;
-}
-
-
-
-void MacPackSetDir (const StrBuf* Dir)
-/* Set a directory where files for macro packages can be found. Standard is
- * to use the builtin packages. For debugging macro packages, external files
- * can be used.
- */
-{
-    /* Copy the directory name to the buffer */
-    SB_Copy (&MacPackDir, Dir);
-
-    /* Make sure that the last character is a path delimiter */
-    if (SB_NotEmpty (&MacPackDir)) {
-        char C = SB_LookAtLast (&MacPackDir);
-        if (C != '\\' && C != '/') {
-            SB_AppendChar (&MacPackDir, '/');
-        }
-    }
-
-    /* Terminate the buffer so it's usable as a C string */
-    SB_Terminate (&MacPackDir);
-}
-
-
-
diff --git a/src/ca65/macpack.h b/src/ca65/macpack.h
deleted file mode 100644 (file)
index 3433198..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*****************************************************************************/
-/*                                                                           */
-/*                                macpack.h                                 */
-/*                                                                           */
-/*          Predefined macro packages for the ca65 macroassembler           */
-/*                                                                           */
-/*                                                                           */
-/*                                                                           */
-/* (C) 1998-2008, Ullrich von Bassewitz                                      */
-/*                Roemerstrasse 52                                           */
-/*                D-70794 Filderstadt                                        */
-/* EMail:         uz@cc65.org                                                */
-/*                                                                           */
-/*                                                                           */
-/* This software is provided 'as-is', without any expressed or implied       */
-/* warranty.  In no event will the authors be held liable for any damages    */
-/* arising from the use of this software.                                    */
-/*                                                                           */
-/* Permission is granted to anyone to use this software for any purpose,     */
-/* including commercial applications, and to alter it and redistribute it    */
-/* freely, subject to the following restrictions:                            */
-/*                                                                           */
-/* 1. The origin of this software must not be misrepresented; you must not   */
-/*    claim that you wrote the original software. If you use this software   */
-/*    in a product, an acknowledgment in the product documentation would be  */
-/*    appreciated but is not required.                                       */
-/* 2. Altered source versions must be plainly marked as such, and must not   */
-/*    be misrepresented as being the original software.                      */
-/* 3. This notice may not be removed or altered from any source              */
-/*    distribution.                                                          */
-/*                                                                           */
-/*****************************************************************************/
-
-
-
-#ifndef MACPACK_H
-#define MACPACK_H
-
-
-
-/* common */
-#include "strbuf.h"
-
-
-
-/*****************************************************************************/
-/*                                          Data                                    */
-/*****************************************************************************/
-
-
-
-/* Constants for the predefined packages */
-enum {
-    MAC_ATARI,
-    MAC_CBM,
-    MAC_CPU,
-    MAC_GENERIC,
-    MAC_LONGBRANCH,
-
-    /* Number of known packages */
-    MAC_COUNT
-};
-
-
-
-/*****************************************************************************/
-/*                                          Code                                    */
-/*****************************************************************************/
-
-
-
-int MacPackFind (const StrBuf* Name);
-/* Find a macro package by name. The function will either return the id or
- * -1 if the package name was not found.
- */
-
-int MacPackInsert (int Id);
-/* Insert the macro package with the given id in the input stream. Returns
- * true if the macro package was found and successfully inserted. Returns
- * false otherwise.
- */
-
-void MacPackSetDir (const StrBuf* Dir);
-/* Set a directory where files for macro packages can be found. Standard is
- * to use the builtin packages. For debugging macro packages, external files
- * can be used.
- */
-
-
-
-/* End of macpack.h */
-
-#endif
-
-
-
diff --git a/src/ca65/macpack/atari.mac b/src/ca65/macpack/atari.mac
deleted file mode 100644 (file)
index 8e76888..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-; Convert characters to screen codes
-                                                              
-; Helper macro that converts and outputs one character
-.macro _scrcode char
-        .if (char >= 0) .and (char <= 31)
-                .byte   (char + 64)
-        .elseif (char >= 32) .and (char <= 95)
-                .byte   (char - 32)
-        .elseif (char >= 96) .and (char <= 127)
-                .byte   char
-        .elseif (char >= 128) .and (char <= 159)
-                .byte   (char + 64)
-        .elseif (char >= 160) .and (char <= 223)
-                .byte   (char - 32)
-        .elseif (char >= 224) .and (char <= 255)
-                .byte   char
-        .else
-                .error  "scrcode: Character constant out of range"
-        .endif
-.endmacro
-
-.macro  scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
-
-        ; Bail out if next argument is empty
-        .if     .blank (arg1)
-                .exitmacro
-        .endif
-
-        ; Check for a string
-        .if     .match ({arg1}, "")
-
-                ; Walk over all string chars
-                .repeat .strlen (arg1), i
-                        _scrcode        {.strat (arg1, i)}
-                .endrepeat
-
-        ; Check for a number
-        .elseif .match (.left (1, {arg1}), 0)
-
-                ; Just output the number
-                _scrcode        arg1
-
-        ; Check for a character
-        .elseif .match (.left (1, {arg1}), 'a')
-
-                ; Just output the character
-                _scrcode        arg1
-
-        ; Anything else is an error
-        .else
-
-                .error  "scrcode: invalid argument type"
-
-        .endif
-
-        ; Call the macro recursively with the remaining args
-        scrcode arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
-.endmacro
-
diff --git a/src/ca65/macpack/cbm.mac b/src/ca65/macpack/cbm.mac
deleted file mode 100644 (file)
index a6ec9f8..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-; Convert characters to screen codes
-
-; Helper macro that converts and outputs one character
-.macro _scrcode char
-        .if (char >= '@' .and char <= 'z')
-                .byte   (char - '@')
-        .elseif (char >= 'A' .and char <= 'Z')
-                .byte   (char - 'A' + 65)
-        .elseif (char = '[')
-                .byte   27
-        .elseif (char = ']')
-                .byte   29
-        .elseif (char = '^')
-                .byte   30
-        .elseif (char = '_')
-                .byte   31
-        .elseif (char < 256)
-                .byte   char
-        .else
-                .error  "scrcode: Character constant out of range"
-        .endif
-.endmacro
-
-.macro  scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
-
-        ; Bail out if next argument is empty
-        .if     .blank (arg1)
-                .exitmacro
-        .endif
-
-        ; Check for a string
-        .if     .match ({arg1}, "")
-
-                ; Walk over all string chars
-                .repeat .strlen (arg1), i
-                        _scrcode        {.strat (arg1, i)}
-                .endrepeat
-
-        ; Check for a number
-        .elseif .match (.left (1, {arg1}), 0)
-
-                ; Just output the number
-                _scrcode        arg1
-
-        ; Check for a character
-        .elseif .match (.left (1, {arg1}), 'a')
-
-                ; Just output the character
-                _scrcode        arg1
-
-        ; Anything else is an error
-        .else
-
-                .error  "scrcode: invalid argument type"
-
-        .endif
-
-        ; Call the macro recursively with the remaining args
-        scrcode arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
-.endmacro
-
-
diff --git a/src/ca65/macpack/cpu.mac b/src/ca65/macpack/cpu.mac
deleted file mode 100644 (file)
index 43c9e16..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-
-; CPU bitmask constants
-CPU_ISET_NONE      = $0001
-CPU_ISET_6502      = $0002
-CPU_ISET_6502X     = $0004
-CPU_ISET_65SC02    = $0008
-CPU_ISET_65C02     = $0010
-CPU_ISET_65816     = $0020
-CPU_ISET_SUNPLUS   = $0040
-CPU_ISET_SWEET16   = $0080
-CPU_ISET_HUC6280   = $0100
-
-; CPU capabilities
-CPU_NONE           = CPU_ISET_NONE
-CPU_6502           = CPU_ISET_6502
-CPU_6502X          = CPU_ISET_6502|CPU_ISET_6502X
-CPU_65SC02         = CPU_ISET_6502|CPU_ISET_65SC02
-CPU_65C02          = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02
-CPU_65816          = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65816
-CPU_SUNPLUS        = CPU_ISET_SUNPLUS
-CPU_SWEET16        = CPU_ISET_SWEET16
-CPU_HUC6280        = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02|CPU_ISET_HUC6280
-
-                                                                                  
diff --git a/src/ca65/macpack/cvt-mac.pl b/src/ca65/macpack/cvt-mac.pl
deleted file mode 100755 (executable)
index 0b56690..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/perl
-
-# Check number of params
-die "Usage: cvt-cfg.pl input output varname\n" unless ($#ARGV == 2);
-
-# Get the parameters
-$InputName  = shift (@ARGV);
-$OutputName = shift (@ARGV);
-$VarName    = shift (@ARGV);
-
-# Open both files
-open (IN, "<$InputName") or die "Cannot open $InputName\n";
-open (OUT, ">$OutputName") or die "Cannot open $OutputName\n";
-
-# Print the header to the output file
-print OUT "static char $VarName" . "[] = \n";
-
-# Read from input, print to output
-while ($Line = <IN>) {
-
-    # Remove the newline
-    chomp $Line;
-
-    # Separate an existing comment. No need to be overly clever, just ignore
-    # semicolons in strings.
-    if ($Line =~ /(.*?)(\s*)(;\s*)(.*?)\s*$/) {
-       $Line         = $1;
-       $CommentSpace = $2;
-       $Comment      = $4;
-    } else {
-       $CommentSpace = "";
-       $Comment      = "";
-    }
-
-    # Remove leading and trailing spaces
-    $Line =~ s/^\s*|\s*$//g;
-
-    # Ignore empty lines
-    if ($Line eq "") {
-        if ($Comment ne "") {
-            print OUT "/* $Comment */\n";
-        }
-        next;
-    }
-
-    # Replace control chars
-    $Line =~ s/\\/\\\\/g;
-    $Line =~ s/\"/\\\"/g;
-    $Line =~ s/\'/\\\'/g;
-
-    # Print to output
-    print OUT "\"$Line\\n\"";
-
-    # Add a comment if we have one
-    if ($Comment ne "") {
-       print OUT "$CommentSpace/* $Comment */";
-    }
-
-    # Terminate the line
-    print OUT "\n";
-}
-
-# Terminate the variable declaration
-print OUT ";\n";
-
-# Close the files
-close IN;
-close OUT;
-
-# Done
-exit 0;
-
-
-
-
diff --git a/src/ca65/macpack/generic.mac b/src/ca65/macpack/generic.mac
deleted file mode 100644 (file)
index 02eccef..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-
-; add - Add without carry
-.macro  add     Arg1, Arg2
-        clc
-        .if .paramcount = 2
-                adc     Arg1, Arg2
-        .else
-                adc     Arg1
-        .endif
-.endmacro
-
-; sub - subtract without borrow
-.macro  sub     Arg1, Arg2
-        sec
-        .if .paramcount = 2
-                sbc     Arg1, Arg2
-        .else
-                sbc     Arg1
-        .endif
-.endmacro
-
-; bge - jump if unsigned greater or equal
-.macro  bge     Arg
-        bcs     Arg
-.endmacro
-
-; blt - Jump if unsigned less
-.macro  blt     Arg
-        bcc     Arg
-.endmacro
-
-; bgt - jump if unsigned greater
-.macro  bgt     Arg
-        .local  L
-        beq     L
-        bcs     Arg
-L:
-.endmacro
-
-; ble - jump if unsigned less or equal
-.macro  ble     Arg
-        beq     Arg
-        bcc     Arg
-.endmacro
-
diff --git a/src/ca65/macpack/longbranch.mac b/src/ca65/macpack/longbranch.mac
deleted file mode 100644 (file)
index d6f6cde..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-.macro  jeq     Target
-        .if     .match(Target, 0)
-        bne     *+5
-        jmp     Target
-        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
-                beq     Target
-        .else
-                bne     *+5
-                jmp     Target
-        .endif
-.endmacro
-.macro  jne     Target
-        .if     .match(Target, 0)
-                beq     *+5
-                jmp     Target
-        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
-                bne     Target
-        .else
-                beq     *+5
-                jmp     Target
-        .endif
-.endmacro
-.macro  jmi     Target
-        .if     .match(Target, 0)
-                bpl     *+5
-                jmp     Target
-        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
-                bmi     Target
-        .else
-                bpl     *+5
-                jmp     Target
-        .endif
-.endmacro
-.macro  jpl     Target
-        .if     .match(Target, 0)
-                bmi     *+5
-                jmp     Target
-        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
-                bpl     Target
-        .else
-                bmi     *+5
-                jmp     Target
-        .endif
-.endmacro
-.macro  jcs     Target
-        .if     .match(Target, 0)
-                bcc     *+5
-                jmp     Target
-        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
-                bcs     Target
-        .else
-                bcc     *+5
-                jmp     Target
-        .endif
-.endmacro
-.macro  jcc     Target
-        .if     .match(Target, 0)
-                bcs     *+5
-                jmp     Target
-        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
-                bcc     Target
-        .else
-                bcs     *+5
-                jmp     Target
-        .endif
-.endmacro
-.macro  jvs     Target
-        .if     .match(Target, 0)
-                bvc     *+5
-                jmp     Target
-        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
-                bvs     Target
-        .else
-                bvc     *+5
-                jmp     Target
-        .endif
-.endmacro
-.macro  jvc     Target
-        .if     .match(Target, 0)
-                bvs     *+5
-                jmp     Target
-        .elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
-                bvc     Target
-        .else
-                bvs     *+5
-                jmp     Target
-        .endif
-.endmacro
index bcc9e889e4aff9d56cdc9fdeceadb36d2c210240..eb81c743b66ff12e08c5ccf9aff5ec84802f7833 100644 (file)
@@ -65,7 +65,6 @@
 #include "istack.h"
 #include "lineinfo.h"
 #include "listing.h"
-#include "macpack.h"
 #include "macro.h"
 #include "nexttok.h"
 #include "objfile.h"
@@ -526,18 +525,6 @@ static void OptListing (const char* Opt, const char* Arg)
 
 
 
-static void OptMacPackDir (const char* Opt attribute ((unused)), const char* Arg)
-/* Set a macro package directory */
-{
-    /* Make a string buffer from Arg */
-    StrBuf Dir;
-
-    /* Use the directory */
-    MacPackSetDir (SB_InitFromString (&Dir, Arg));
-}
-
-
-
 static void OptMemoryModel (const char* Opt, const char* Arg)
 /* Set the memory model */
 {
@@ -891,7 +878,6 @@ int main (int argc, char* argv [])
         { "--large-alignment",  0,      OptLargeAlignment       },
         { "--list-bytes",       1,      OptListBytes            },
        { "--listing",          1,      OptListing              },
-        { "--macpack-dir",      1,      OptMacPackDir           },
         { "--memory-model",     1,      OptMemoryModel          },
        { "--pagelength",       1,      OptPageLength           },
         { "--relax-checks",     0,      OptRelaxChecks          },
index 9d8e782a94995d98dbde8ad6956597ee1279da67..4211fb212fd1cf3308e05ac27c4b1adef81a89ad 100644 (file)
@@ -21,9 +21,6 @@ override CFLAGS += -DCA65_INC=$(CA65_INC)
 EBIND  = emxbind
 LDFLAGS        =
 
-# Perl script for macro file conversion
-CVT=macpack/cvt-mac.pl
-
 # -----------------------------------------------------------------------------
 # List of all object files
 
@@ -45,7 +42,6 @@ OBJS =  anonname.o      \
        istack.o        \
        lineinfo.o      \
        listing.o       \
-       macpack.o       \
        macro.o         \
        main.o          \
        nexttok.o       \
@@ -72,12 +68,6 @@ OBJS =  anonname.o      \
 # -----------------------------------------------------------------------------
 # List of all macro files
 
-INCS = atari.inc       \
-       cbm.inc         \
-       cpu.inc         \
-       generic.inc     \
-       longbranch.inc
-
 LIBS = $(COMMON)/common.a
 
 # ------------------------------------------------------------------------------
@@ -93,17 +83,15 @@ all:        depend
        @$(MAKE) -f make/gcc.mak all
 endif
 
-$(EXE):        $(INCS) $(OBJS) $(LIBS)
+$(EXE):        $(OBJS) $(LIBS)
        $(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
        @if [ $(OS2_SHELL) ] ;  then $(EBIND) $(EXE) ; fi
 
-inc:   $(INCS)
-
 clean:
        $(RM) *~ core.* *.map
 
 zap:   clean
-       $(RM) *.o $(EXE) $(INCS) .depend
+       $(RM) *.o $(EXE) .depend
 
 # ------------------------------------------------------------------------------
 # Make the dependencies
@@ -112,31 +100,3 @@ zap:       clean
 depend dep:    $(INCS) $(OBJS:.o=.c)
        @echo "Creating dependency information"
        $(CC) $(CFLAGS) -MM $(OBJS:.o=.c) > .depend
-
-# -----------------------------------------------------------------------------
-# Rules to make config includes
-
-atari.inc:     macpack/atari.mac
-       @$(CVT) $< $@ MacAtari
-
-cbm.inc:       macpack/cbm.mac
-       @$(CVT) $< $@ MacCBM
-
-cpu.inc:       macpack/cpu.mac
-       @$(CVT) $< $@ MacCPU
-
-generic.inc:           macpack/generic.mac
-       @$(CVT) $< $@ MacGeneric
-
-longbranch.inc:        macpack/longbranch.mac
-       @$(CVT) $< $@ MacLongBranch
-
-
-
-
-
-
-
-
-
-
index 58e2621b29f11d40b27bfdba40b932fc9a6b8712..3f67c2fe65b24750ff680032967cad11ec2993e1 100644 (file)
@@ -67,7 +67,6 @@
 #include "incpath.h"
 #include "instr.h"
 #include "listing.h"
-#include "macpack.h"
 #include "macro.h"
 #include "nexttok.h"
 #include "objcode.h"
@@ -1444,28 +1443,16 @@ static void DoLocalChar (void)
 static void DoMacPack (void)
 /* Insert a macro package */
 {
-    int Package;
-
     /* We expect an identifier */
     if (CurTok.Tok != TOK_IDENT) {
        ErrorSkip ("Identifier expected");
-       return;
-    }
-
-    /* Search for the macro package name */
-    LocaseSVal ();
-    Package = MacPackFind (&CurTok.SVal);
-    if (Package < 0) {
-       /* Not found */
-       ErrorSkip ("Invalid macro package");
-       return;
-    }
-
-    /* Insert the package. If this fails, skip the remainder of the line to
-     * avoid additional error messages.
-     */
-    if (MacPackInsert (Package) == 0) {
-        SkipUntilSep ();
+    } else {
+        SB_AppendStr (&CurTok.SVal, ".mac");
+        SB_Terminate (&CurTok.SVal);
+       if (NewInputFile (SB_GetConstBuf (&CurTok.SVal)) == 0) {
+            /* Error opening the file, skip remainder of line */
+            SkipUntilSep ();
+        }
     }
 }