Skip to content

Commit

Permalink
V1.21 - Fixed the .IF .REF implementation. It will now detect a forwa…
Browse files Browse the repository at this point in the history
…rd reference to a label correctly.

This is useful in building libraries and excluding code from them if the functions or data is not being referenced. i.e. If there is no JSR FUNC1 then the code if the .IF block is not generated.
.IF .DEF func1
     func1 ...
.ENDIF
  • Loading branch information
CycoPH committed Jan 4, 2023
1 parent e5e17ac commit 586bb25
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
@@ -1,6 +1,6 @@
# ATasm v1.20
# ATasm v1.21
### A mostly Mac/65 compatible 6502 cross-assembler
Copyright (c) 1998-2021 Mark Schmelzenbach, modified by Peter Hinz (2022)
Copyright (c) 1998-2021 Mark Schmelzenbach, modified by Peter Hinz (2021-2023)

*ATasm is a 6502 command-line cross-assembler that is compatible with the original Mac/65 macroassembler released by OSS software. Code development can now be performed using "modern" editors and compiles with lightning speed.*

Expand Down
11 changes: 10 additions & 1 deletion VERSION.TXT
Expand Up @@ -170,4 +170,13 @@ Dec 28, 2022
Slight warning and error format change to make it external parsable.

Dec 29, 2022
version 1.20 - Added the .ELSEIF directive to build easier .IF .ELSEIF .ELSE .ENDIF control blocks.
version 1.20 - Added the .ELSEIF directive to build easier .IF .ELSEIF .ELSE .ENDIF control blocks.

Jan 4, 2023
version 1.21 - Fixed the .ref implementation. It will now detect a forward reference to a label correctly.
This is useful in building libraries and excluding code from them if the functions or data
is not being referenced. i.e. If there is no JSR FUNC1 then the code if the .IF block is
not generated.
.IF .DEF func1
func1 ...
.ENDIF
Binary file modified atasm.exe
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/atasm.blurb
@@ -1,6 +1,6 @@
ATasm v1.20
ATasm v1.21
A mostly Mac/65 compatible 6502 cross-assembler
Copyright (c) 1998-2021 Mark Schmelzenbach
Copyright (c) 1998-2023 Mark Schmelzenbach

ATasm is a 6502 command-line cross-assembler that is compatible with the
original Mac/65 macroassembler released by OSS software. Code
Expand Down
Binary file modified docs/atasm.pdf
Binary file not shown.
9 changes: 8 additions & 1 deletion docs/atasm.txt
@@ -1,5 +1,5 @@
============================================================================
ATasm v1.20
ATasm v1.21
A mostly Mac/65 compatible 6502 cross-assembler

Copyright (c) 1998-2022 Mark Schmelzenbach
Expand Down Expand Up @@ -228,6 +228,13 @@ Version 1.19 - Modified the * program counter command to also name a memory regi
Slight warning and error format change to make it external parsable.
Version 1.20 - Added the .ELSEIF directive to build easier .IF .ELSEIF .ELSE .ENDIF
control blocks.
Version 1.21 - Fixed the .ref implementation. It will now detect a forward reference to a label correctly.
This is useful in building libraries and excluding code from them if the functions or data
is not being referenced. i.e. If there is no JSR FUNC1 then the code if the .IF block is
not generated.
.IF .DEF func1
func1 ...
.ENDIF

============================================================================
Chapter 1: ATasm
Expand Down
9 changes: 8 additions & 1 deletion src/setparse.c
Expand Up @@ -301,7 +301,14 @@ int get_signed_expression(char *str, int tp) {
look+=v;
sym=validate_symbol(work);
if (!sym)
*walk++='0';
{
// The symbol does not exist yet, but we can still look in the undefined label list, it might be there later
unkLabel* look = isUnk(work);
if (look)
*walk++ = '1';
else
*walk++ = '0';
}
else {
if (sym->ref)
*walk++='1';
Expand Down
2 changes: 1 addition & 1 deletion src/symbol.h
Expand Up @@ -22,7 +22,7 @@
#define SYMBOL_H

#define MAJOR_VER 1
#define MINOR_VER 20
#define MINOR_VER 21
#define BETA_VER 0

/*==========================================================================*/
Expand Down
18 changes: 18 additions & 0 deletions tests/ifref.asm
@@ -0,0 +1,18 @@
*=$2000

jsr func1
rts

.IF .REF func1
func1
lda #1
sta $4000
rts
.ENDIF

.IF .REF func2
func2
lda #1
sta $4000
rts
.ENDIF

0 comments on commit 586bb25

Please sign in to comment.