diff --git a/.gitignore b/.gitignore index cd2218e..dcfe07f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,12 +2,18 @@ asm6502 *.exe *.o +*.zip /output # ASM6502 output files *.lst *.bin +#packages +pkg/svardos/appinfo +pkg/svardos/devel +pkg/svardos/asm6502.svp + # misc project files doc/asm6502.pdf doc/asm6502.txt diff --git a/LICENSE b/LICENSE index f20e304..9c01f50 100644 --- a/LICENSE +++ b/LICENSE @@ -1,27 +1,20 @@ Copyright (c) 2022-2023 Bernd Boeckmann - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/mkdist.bat b/mkdist.bat deleted file mode 100644 index 8b78d92..0000000 --- a/mkdist.bat +++ /dev/null @@ -1,20 +0,0 @@ -REM BUILD DOS, WIN32 and OS/2 executables and create a ZIP file -REM Expects Open Watcom 1.9 dev environment and InfoZIP in path - -cd project\watcom\dos -ide2make -p asm6502.wpj -wmake -h -f asm6502.mk -cd ..\os2 -ide2make -p asm6502.wpj -wmake -h -f asm6502.mk -cd ..\win32 -ide2make -p asm6502.wpj -wmake -h -f asm6502.mk -cd ..\..\.. -copy project\watcom\dos\asm6502.exe bin\dos\asm6502.exe -copy project\watcom\os2\asm6502.exe bin\os2\asm6502.exe -copy project\watcom\win32\asm6502.exe bin\win32\asm6502.exe -copy readme.txt doc\asm6502.txt -copy LICENSE doc\license.txt -del asm6502.zip -zip -r asm6502.zip bin doc\asm6502.txt doc\asm6502.pdf doc\instrtbl.pdf support diff --git a/project/watcom/dos/asm6502.tgt b/project/watcom/dos/asm6502.tgt deleted file mode 100644 index 5ff47d7..0000000 --- a/project/watcom/dos/asm6502.tgt +++ /dev/null @@ -1,105 +0,0 @@ -40 -targetIdent -0 -MProject -1 -MComponent -0 -2 -WString -3 -EXE -3 -WString -5 -de6en -1 -0 -0 -4 -MCommand -0 -5 -MCommand -0 -6 -MItem -11 -asm6502.exe -7 -WString -3 -EXE -8 -WVList -0 -9 -WVList -0 --1 -1 -1 -0 -10 -WPickList -2 -11 -MItem -3 -*.c -12 -WString -4 -COBJ -13 -WVList -2 -14 -MRState -15 -WString -3 -WCC -16 -WString -18 -??6??Compact model -0 -1 -17 -MRState -18 -WString -3 -WCC -19 -WString -16 -??6??Large model -0 -0 -20 -WVList -0 --1 -1 -1 -0 -21 -MItem -18 -..\..\..\asm6502.c -22 -WString -4 -COBJ -23 -WVList -0 -24 -WVList -0 -11 -1 -1 -0 diff --git a/project/watcom/dos/asm6502.wpj b/project/watcom/dos/asm6502.wpj deleted file mode 100644 index 883de91..0000000 --- a/project/watcom/dos/asm6502.wpj +++ /dev/null @@ -1,43 +0,0 @@ -40 -projectIdent -0 -VpeMain -1 -WRect -2320 -929 -3312 -9168 -2 -MProject -3 -MCommand -0 -4 -MCommand -0 -1 -5 -WFileName -11 -asm6502.tgt -6 -WVList -1 -7 -VComponent -8 -WRect -0 -0 -5680 -4276 -0 -0 -9 -WFileName -11 -asm6502.tgt -0 -0 -7 diff --git a/project/watcom/os2/asm6502.tgt b/project/watcom/os2/asm6502.tgt deleted file mode 100644 index 9c2ea2b..0000000 --- a/project/watcom/os2/asm6502.tgt +++ /dev/null @@ -1,81 +0,0 @@ -40 -targetIdent -0 -MProject -1 -MComponent -0 -2 -WString -4 -OEXE -3 -WString -5 -oc2en -1 -0 -0 -4 -MCommand -0 -5 -MCommand -0 -6 -MItem -11 -asm6502.exe -7 -WString -4 -OEXE -8 -WVList -0 -9 -WVList -0 --1 -1 -1 -0 -10 -WPickList -2 -11 -MItem -3 -*.c -12 -WString -4 -COBJ -13 -WVList -0 -14 -WVList -0 --1 -1 -1 -0 -15 -MItem -18 -..\..\..\asm6502.c -16 -WString -4 -COBJ -17 -WVList -0 -18 -WVList -0 -11 -1 -1 -0 diff --git a/project/watcom/os2/asm6502.wpj b/project/watcom/os2/asm6502.wpj deleted file mode 100644 index 3c57081..0000000 --- a/project/watcom/os2/asm6502.wpj +++ /dev/null @@ -1,43 +0,0 @@ -40 -projectIdent -0 -VpeMain -1 -WRect -2320 -929 -3312 -9159 -2 -MProject -3 -MCommand -0 -4 -MCommand -0 -1 -5 -WFileName -11 -asm6502.tgt -6 -WVList -1 -7 -VComponent -8 -WRect -208 -1412 -5680 -4200 -0 -0 -9 -WFileName -11 -asm6502.tgt -0 -1 -7 diff --git a/project/watcom/win32/asm6502.tgt b/project/watcom/win32/asm6502.tgt deleted file mode 100644 index 2be8a5d..0000000 --- a/project/watcom/win32/asm6502.tgt +++ /dev/null @@ -1,90 +0,0 @@ -40 -targetIdent -0 -MProject -1 -MComponent -0 -2 -WString -4 -NEXE -3 -WString -5 -nc2en -1 -0 -0 -4 -MCommand -0 -5 -MCommand -0 -6 -MItem -11 -asm6502.exe -7 -WString -4 -NEXE -8 -WVList -0 -9 -WVList -1 -10 -ActionStates -11 -WString -4 -&Run -12 -WVList -0 --1 -1 -1 -0 -13 -WPickList -2 -14 -MItem -3 -*.c -15 -WString -4 -COBJ -16 -WVList -0 -17 -WVList -0 --1 -1 -1 -0 -18 -MItem -18 -..\..\..\asm6502.c -19 -WString -4 -COBJ -20 -WVList -0 -21 -WVList -0 -14 -1 -1 -0 diff --git a/project/watcom/win32/asm6502.wpj b/project/watcom/win32/asm6502.wpj deleted file mode 100644 index 14d9098..0000000 --- a/project/watcom/win32/asm6502.wpj +++ /dev/null @@ -1,43 +0,0 @@ -40 -projectIdent -0 -VpeMain -1 -WRect -2320 -929 -3312 -7765 -2 -MProject -3 -MCommand -0 -4 -MCommand -0 -1 -5 -WFileName -11 -asm6502.tgt -6 -WVList -1 -7 -VComponent -8 -WRect -208 -189 -5680 -4276 -0 -0 -9 -WFileName -11 -asm6502.tgt -0 -1 -7 diff --git a/src/.clang-format b/src/.clang-format index 523e91b..0654001 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -1,47 +1,47 @@ -# Visual Studio generated .clang-format file - -# The style options in this file are a best effort attempt to replicate the -# current IDE formatting configuration from Tools > Options. The following -# style options, however, should be verified: -# AfterClass; AfterControlStatement; AfterEnum; AfterFunction; AfterNamespace; -# AfterStruct; AfterUnion - -AccessModifierOffset: -3 -AlignAfterOpenBracket: DontAlign -AllowShortBlocksOnASingleLine: true -AllowShortFunctionsOnASingleLine: All -BasedOnStyle: LLVM -BraceWrapping: - AfterClass: false # TODO: verify - AfterControlStatement: false # TODO: verify - AfterEnum: false # TODO: verify - AfterFunction: false # TODO: verify - AfterNamespace: false # TODO: verify - AfterStruct: false # TODO: verify - AfterUnion: false # TODO: verify - BeforeCatch: true - BeforeElse: true - IndentBraces: false - SplitEmptyFunction: true - SplitEmptyRecord: true -BreakBeforeBraces: Custom -ColumnLimit: 0 -Cpp11BracedListStyle: false -FixNamespaceComments: false -IndentCaseLabels: false -IndentPPDirectives: None -IndentWidth: 3 -MaxEmptyLinesToKeep: 10 -NamespaceIndentation: All -PointerAlignment: Left -SortIncludes: false -SortUsingDeclarations: false -SpaceAfterCStyleCast: false -SpaceBeforeAssignmentOperators: true -SpaceBeforeParens: ControlStatements -SpaceInEmptyParentheses: false -SpacesInCStyleCastParentheses: false -SpacesInParentheses: true -SpacesInSquareBrackets: false -TabWidth: 8 -UseTab: false +# Visual Studio generated .clang-format file + +# The style options in this file are a best effort attempt to replicate the +# current IDE formatting configuration from Tools > Options. The following +# style options, however, should be verified: +# AfterClass; AfterControlStatement; AfterEnum; AfterFunction; AfterNamespace; +# AfterStruct; AfterUnion + +AccessModifierOffset: -3 +AlignAfterOpenBracket: DontAlign +AllowShortBlocksOnASingleLine: true +AllowShortFunctionsOnASingleLine: All +BasedOnStyle: LLVM +BraceWrapping: + AfterClass: false # TODO: verify + AfterControlStatement: false # TODO: verify + AfterEnum: false # TODO: verify + AfterFunction: false # TODO: verify + AfterNamespace: false # TODO: verify + AfterStruct: false # TODO: verify + AfterUnion: false # TODO: verify + BeforeCatch: true + BeforeElse: true + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true +BreakBeforeBraces: Custom +ColumnLimit: 0 +Cpp11BracedListStyle: false +FixNamespaceComments: false +IndentCaseLabels: false +IndentPPDirectives: None +IndentWidth: 3 +MaxEmptyLinesToKeep: 10 +NamespaceIndentation: All +PointerAlignment: Left +SortIncludes: false +SortUsingDeclarations: false +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: true +SpacesInSquareBrackets: false +TabWidth: 8 +UseTab: false diff --git a/src/asm6502.c b/src/asm6502.c index 9f88fa7..09b911f 100644 --- a/src/asm6502.c +++ b/src/asm6502.c @@ -2,30 +2,24 @@ Copyright (c) 2022-2023 Bernd Boeckmann -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* customize the following to adapt to the syntax of other assemblers */ @@ -106,8 +100,8 @@ static asm_file* current_file; /* currently processed file */ static char filename_buf[STR_LEN]; /* position stack is used when processing include files. Every time an - include file is about to be processed, the position after the include - directive gets pushed onto the stack */ + include file is about to be processed, the position after the include + directive gets pushed onto the stack */ static pos_stack pos_stk[MAX_POS_STACK]; static int pos_stk_ptr = 0; @@ -122,7 +116,7 @@ static int symmap_enabled = 0; static FILE* list_file; /* if 0 processing of statements is disabled by conditional assembly - directives */ + directives */ static int process_statements = 1; /* data type used when evaluating expressions */ @@ -549,7 +543,8 @@ static value to_byte( value v ) { } -#define IS_HEX_DIGIT( x ) ( isdigit( ( x ) ) || ( ( ( x ) >= 'a' ) && ( ( x ) <= 'f' ) ) || \ +#define IS_HEX_DIGIT( x ) ( isdigit( ( x ) ) || \ + ( ( ( x ) >= 'a' ) && ( ( x ) <= 'f' ) ) || \ ( ( ( x ) >= 'A' ) && ( ( x ) <= 'F' ) ) ) @@ -663,7 +658,8 @@ static void ident( char** pp, char* id, int numeric, int uppercase ) { int i = 0; char* p = *pp; - if ( ( !numeric && !isalpha( *p ) && ( *p != '_' ) ) || ( !isalnum( *p ) && ( *p != '_' ) ) ) + if ( ( !numeric && !isalpha( *p ) && ( *p != '_' ) ) || + ( !isalnum( *p ) && ( *p != '_' ) ) ) error( ERR_ID ); do { @@ -801,7 +797,11 @@ static value product( char** p ) { skip_white( p ); op = **p; - while ( ( op == '*' ) || ( op == '/' ) || ( op == AND_LETTER && *( *p + 1 ) != AND_LETTER ) || ( **p == '<' && *( *p + 1 ) == '<' ) || ( **p == '>' && *( *p + 1 ) == '>' ) ) { + while ( ( op == '*' ) || + ( op == '/' ) || + ( op == AND_LETTER && *( *p + 1 ) != AND_LETTER ) || + ( **p == '<' && *( *p + 1 ) == '<' ) || + ( **p == '>' && *( *p + 1 ) == '>' ) ) { ( *p )++; if ( **p == '<' || **p == '>' ) ( *p )++; @@ -1340,7 +1340,8 @@ static int instruction_ind( char** p, instruction_desc* instr ) { if ( pass_num == 2 ) { if ( UNDEFINED( v ) ) error( ERR_UNDEF ); - if ( ( am == AM_ZIX || am == AM_ZIY || am == AM_ZIN ) && ( TYPE( v ) != TYPE_BYTE ) ) + if ( ( am == AM_ZIX || am == AM_ZIY || am == AM_ZIN ) && + ( TYPE( v ) != TYPE_BYTE ) ) error( ERR_ILLEGAL_TYPE ); }