From: Oliver Schmidt Date: Sun, 7 Apr 2013 20:10:30 +0000 (+0200) Subject: Replaced builtin macro packages with .mac files that are included like ordinary ... X-Git-Tag: V2.14~76 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;ds=sidebyside;h=54299fae5ab746c5399448fac49cfb596a444802;p=cc65 Replaced builtin macro packages with .mac files that are included like ordinary .inc files. The benefits are: - Independency of ca65 build from perl - More transparent behaviour --- diff --git a/asminc/atari.mac b/asminc/atari.mac new file mode 100644 index 000000000..8e76888d7 --- /dev/null +++ b/asminc/atari.mac @@ -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 index 000000000..a6ec9f8db --- /dev/null +++ b/asminc/cbm.mac @@ -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 index 000000000..43c9e160f --- /dev/null +++ b/asminc/cpu.mac @@ -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 index 000000000..02eccef5d --- /dev/null +++ b/asminc/generic.mac @@ -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 index 000000000..d6f6cde8a --- /dev/null +++ b/asminc/longbranch.mac @@ -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 index 7efd9a563..000000000 --- a/src/ca65/macpack.c +++ /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 index 3433198d1..000000000 --- a/src/ca65/macpack.h +++ /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 index 8e76888d7..000000000 --- a/src/ca65/macpack/atari.mac +++ /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 index a6ec9f8db..000000000 --- a/src/ca65/macpack/cbm.mac +++ /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 index 43c9e160f..000000000 --- a/src/ca65/macpack/cpu.mac +++ /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 index 0b56690fd..000000000 --- a/src/ca65/macpack/cvt-mac.pl +++ /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 = ) { - - # 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 index 02eccef5d..000000000 --- a/src/ca65/macpack/generic.mac +++ /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 index d6f6cde8a..000000000 --- a/src/ca65/macpack/longbranch.mac +++ /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 diff --git a/src/ca65/main.c b/src/ca65/main.c index bcc9e889e..eb81c743b 100644 --- a/src/ca65/main.c +++ b/src/ca65/main.c @@ -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 }, diff --git a/src/ca65/make/gcc.mak b/src/ca65/make/gcc.mak index 9d8e782a9..4211fb212 100644 --- a/src/ca65/make/gcc.mak +++ b/src/ca65/make/gcc.mak @@ -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 - - - - - - - - - - diff --git a/src/ca65/pseudo.c b/src/ca65/pseudo.c index 58e2621b2..3f67c2fe6 100644 --- a/src/ca65/pseudo.c +++ b/src/ca65/pseudo.c @@ -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 (); + } } }