From 7c1cd6c8d87c601eaec50ec81d0d74a9479b43cd Mon Sep 17 00:00:00 2001 From: uz Date: Sat, 5 Feb 2011 16:03:06 +0000 Subject: [PATCH] Added two new global options, NewlineAfterJMP and NewlineAfterRTS. git-svn-id: svn://svn.cc65.org/cc65/trunk@4963 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- doc/da65.sgml | 10 ++++++++++ src/da65/global.c | 2 ++ src/da65/global.h | 10 ++++++---- src/da65/handler.c | 11 ++++++++++- src/da65/infofile.c | 32 +++++++++++++++++++++++++++----- src/da65/main.c | 6 +++--- src/da65/scanner.h | 10 ++++++---- 7 files changed, 64 insertions(+), 17 deletions(-) diff --git a/doc/da65.sgml b/doc/da65.sgml index bf934f1de..d1a860189 100644 --- a/doc/da65.sgml +++ b/doc/da65.sgml @@ -365,6 +365,16 @@ following attributes are recognized: . + + This attribute is followed by a boolean value. When true, a newline is + inserted after each + This attribute is followed by a boolean value. When true, a newline is + inserted after each The attribute is followed by string value, which gives the name of the diff --git a/src/da65/global.c b/src/da65/global.c index 8f2a27aee..f3243f0d8 100644 --- a/src/da65/global.c +++ b/src/da65/global.c @@ -56,6 +56,8 @@ unsigned char DebugInfo = 0; /* Add debug info to the object file */ unsigned char FormFeeds = 0; /* Add form feeds to the output? */ unsigned char UseHexOffs = 0; /* Use hexadecimal label offsets */ unsigned char PassCount = 2; /* How many passed do we do? */ +signed char NewlineAfterJMP = -1; /* Add a newline after a JMP insn? */ +signed char NewlineAfterRTS = -1; /* Add a newline after a RTS insn? */ long StartAddr = -1L; /* Start/load address of the program */ long InputOffs = -1L; /* Offset into input file */ long InputSize = -1L; /* Number of bytes to read from input */ diff --git a/src/da65/global.h b/src/da65/global.h index d8aafbdc1..78680c93f 100644 --- a/src/da65/global.h +++ b/src/da65/global.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000-2006 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (C) 2000-2011, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -57,6 +57,8 @@ extern unsigned char DebugInfo; /* Add debug info to the object file */ extern unsigned char FormFeeds; /* Add form feeds to the output? */ extern unsigned char UseHexOffs; /* Use hexadecimal label offsets */ extern unsigned char PassCount; /* How many passed do we do? */ +extern signed char NewlineAfterJMP;/* Add a newline after a JMP insn? */ +extern signed char NewlineAfterRTS;/* Add a newline after a RTS insn? */ extern long StartAddr; /* Start/load address of the program */ extern long InputOffs; /* Offset into input file */ extern long InputSize; /* Number of bytes to read from input */ diff --git a/src/da65/handler.c b/src/da65/handler.c index 82a88bed2..b5c2005ea 100644 --- a/src/da65/handler.c +++ b/src/da65/handler.c @@ -555,6 +555,9 @@ void OH_AbsoluteXIndirect (const OpcDesc* D attribute ((unused))) void OH_Rts (const OpcDesc* D) { OH_Implicit (D); + if (NewlineAfterRTS) { + LineFeed (); + } SeparatorLine(); } @@ -563,6 +566,9 @@ void OH_Rts (const OpcDesc* D) void OH_JmpAbsolute (const OpcDesc* D) { OH_Absolute (D); + if (NewlineAfterJMP) { + LineFeed (); + } SeparatorLine (); } @@ -571,7 +577,10 @@ void OH_JmpAbsolute (const OpcDesc* D) void OH_JmpAbsoluteIndirect (const OpcDesc* D) { OH_AbsoluteIndirect (D); - SeparatorLine (); + if (NewlineAfterJMP) { + LineFeed (); + } + SeparatorLine (); } diff --git a/src/da65/infofile.c b/src/da65/infofile.c index 4a96f700d..dba7a64de 100644 --- a/src/da65/infofile.c +++ b/src/da65/infofile.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000-2007 Ullrich von Bassewitz */ -/* Roemerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (C) 2000-2011, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -85,7 +85,7 @@ static void AsmIncSection (void) { static const IdentTok LabelDefs[] = { { "COMMENTSTART", INFOTOK_COMMENTSTART }, - { "FILE", INFOTOK_FILE }, + { "FILE", INFOTOK_FILE }, { "IGNOREUNKNOWN", INFOTOK_IGNOREUNKNOWN }, }; @@ -190,6 +190,8 @@ static void GlobalSection (void) { "LABELBREAK", INFOTOK_LABELBREAK }, { "MNEMONICCOL", INFOTOK_MNEMONIC_COLUMN }, { "MNEMONICCOLUMN", INFOTOK_MNEMONIC_COLUMN }, + { "NEWLINEAFTERJMP", INFOTOK_NL_AFTER_JMP }, + { "NEWLINEAFTERRTS", INFOTOK_NL_AFTER_RTS }, { "OUTPUTNAME", INFOTOK_OUTPUTNAME }, { "PAGELENGTH", INFOTOK_PAGELENGTH }, { "STARTADDR", INFOTOK_STARTADDR }, @@ -298,6 +300,26 @@ static void GlobalSection (void) InfoNextTok (); break; + case INFOTOK_NL_AFTER_JMP: + InfoNextTok (); + if (NewlineAfterJMP != -1) { + InfoError ("NLAfterJMP already specified"); + } + InfoBoolToken (); + NewlineAfterJMP = (InfoTok != INFOTOK_FALSE); + InfoNextTok (); + break; + + case INFOTOK_NL_AFTER_RTS: + InfoNextTok (); + InfoBoolToken (); + if (NewlineAfterRTS != -1) { + InfoError ("NLAfterRTS already specified"); + } + NewlineAfterRTS = (InfoTok != INFOTOK_FALSE); + InfoNextTok (); + break; + case INFOTOK_OUTPUTNAME: InfoNextTok (); InfoAssureStr (); diff --git a/src/da65/main.c b/src/da65/main.c index aa48629ba..11262b77b 100644 --- a/src/da65/main.c +++ b/src/da65/main.c @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 1998-2009, Ullrich von Bassewitz */ +/* (C) 1998-2011, Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ @@ -340,8 +340,8 @@ static void OptVersion (const char* Opt attribute ((unused)), /* Print the disassembler version */ { fprintf (stderr, - "da65 V%s - (C) Copyright 2000-2009, Ullrich von Bassewitz\n", - GetVersionAsString ()); + "da65 V%s - (C) Copyright 2000-2011, Ullrich von Bassewitz\n", + GetVersionAsString ()); } diff --git a/src/da65/scanner.h b/src/da65/scanner.h index 4ca81774f..d1eeec024 100644 --- a/src/da65/scanner.h +++ b/src/da65/scanner.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000-2007 Ullrich von Bassewitz */ -/* Roemerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (C) 2000-2011, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -78,6 +78,8 @@ typedef enum token_t { INFOTOK_INPUTSIZE, INFOTOK_LABELBREAK, INFOTOK_MNEMONIC_COLUMN, + INFOTOK_NL_AFTER_JMP, + INFOTOK_NL_AFTER_RTS, INFOTOK_OUTPUTNAME, INFOTOK_PAGELENGTH, INFOTOK_STARTADDR, -- 2.39.5