1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-10 13:29:50 +00:00

Compare commits

...

9 Commits

Author SHA1 Message Date
pm100
85f2a3d512
Merge 9b5d11abde into 2c4d4d3314 2024-05-16 19:06:37 +02:00
mrdudz
2c4d4d3314 add -j2 to make test invocations 2024-05-16 18:57:29 +02:00
mrdudz
86e5acd679 fix race condition as proposed in #2420 2024-05-16 18:57:08 +02:00
Bob Andrews
84153e809e
Merge pull request #2438 from ops/exehdr
Add missing EXEHDR
2024-05-15 14:11:08 +02:00
Olli Savia
074ec82126 Added missing EXEHDR 2024-04-02 19:25:15 +03:00
paul moore
9b5d11abde fix blank lines 2024-03-18 16:08:13 -07:00
paul moore
1f1f2c5a68 move options, add doc 2024-03-18 16:04:49 -07:00
paul moore
c43557d4ed complete first version 2023-12-03 13:58:04 -08:00
paul moore
d21616ea71 initial commit 2023-12-02 09:16:49 -08:00
16 changed files with 9114 additions and 17 deletions

View File

@ -35,7 +35,7 @@ jobs:
run: make -j2 lib QUIET=1
- name: Run the regression tests.
shell: bash
run: make test QUIET=1
run: make -j2 test QUIET=1
- name: Test that the samples can be built.
run: make -C samples platforms
- name: Test that the targettest programs can be built.
@ -89,4 +89,4 @@ jobs:
- name: Run the regression tests (make test)
shell: cmd
run: make test QUIET=1 SHELL=cmd
run: make -j2 test QUIET=1 SHELL=cmd

View File

@ -59,7 +59,7 @@ jobs:
run: make -j2 lib QUIET=1
- name: Run the regression tests.
shell: bash
run: make test QUIET=1
run: make -j2 test QUIET=1
- name: Test that the samples can be built.
shell: bash
run: make -j2 samples

View File

@ -70,7 +70,7 @@ jobs:
- name: Run the regression tests (make test)
if: steps.check-sha.outputs.cache-hit != 'true'
shell: cmd
run: make test QUIET=1 SHELL=cmd
run: make -j2 test QUIET=1 SHELL=cmd
- name: Test that the samples can be built (make samples)
if: steps.check-sha.outputs.cache-hit != 'true'

View File

@ -14,6 +14,7 @@ MEMORY {
SEGMENTS {
ZEROPAGE: load = ZP, type = zp, optional = yes;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;

View File

@ -14,6 +14,7 @@ MEMORY {
SEGMENTS {
ZEROPAGE: load = ZP, type = zp, optional = yes;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;

View File

@ -14,6 +14,7 @@ MEMORY {
SEGMENTS {
ZEROPAGE: load = ZP, type = zp, optional = yes;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;

View File

@ -100,6 +100,7 @@ Short options:
-mm model Set the memory model
-o name Name the output file
-s Enable smart mode
-S Generate segment offsets in listing
-t sys Set the target system
-v Increase verbosity
@ -121,6 +122,7 @@ Long options:
--memory-model model Set the memory model
--pagelength n Set the page length for the listing
--relax-checks Disables some error checks
--segment-list Generate segment offsets in listing
--smart Enable smart mode
--target sys Set the target system
--verbose Increase verbosity

9046
l.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -69,6 +69,7 @@ unsigned char RelaxChecks = 0; /* Relax a few assembler checks */
unsigned char StringEscapes = 0; /* Allow C-style escapes in strings */
unsigned char LongJsrJmpRts = 0; /* Allow JSR/JMP/RTS as alias for JSL/JML/RTL */
unsigned char WarningsAsErrors = 0; /* Error if any warnings */
unsigned char SegList = 0;
/* Emulation features */
unsigned char DollarIsPC = 0; /* Allow the $ symbol as current PC */

View File

@ -71,6 +71,7 @@ extern unsigned char RelaxChecks; /* Relax a few assembler checks */
extern unsigned char StringEscapes; /* Allow C-style escapes in strings */
extern unsigned char LongJsrJmpRts; /* Allow JSR/JMP/RTS as alias for JSL/JML/RTL */
extern unsigned char WarningsAsErrors; /* Error if any warnings */
extern unsigned char SegList;
/* Emulation features */
extern unsigned char DollarIsPC; /* Allow the $ symbol as current PC */

View File

@ -75,7 +75,6 @@ static unsigned ListBytes = 12; /* Number of bytes to list for one line
static int ListingEnabled = 1; /* Enabled if > 0 */
/*****************************************************************************/
/* Code */
/*****************************************************************************/
@ -105,6 +104,7 @@ void NewListingLine (const StrBuf* Line, unsigned char File, unsigned char Depth
L->Next = 0;
L->FragList = 0;
L->FragLast = 0;
L->Seg = ActiveSeg->Num;
L->PC = GetPC ();
L->Reloc = GetRelocMode ();
L->File = File;
@ -181,6 +181,7 @@ void InitListingLine (void)
L = L->Next;
/* Set the values for this line */
CHECK (L != 0);
L->Seg = ActiveSeg->Num;
L->PC = GetPC ();
L->Reloc = GetRelocMode ();
L->Output = (ListingEnabled > 0);
@ -191,6 +192,7 @@ void InitListingLine (void)
/* Set the values for this line */
CHECK (LineCur != 0);
LineCur->Seg = ActiveSeg->Num;
LineCur->PC = GetPC ();
LineCur->Reloc = GetRelocMode ();
LineCur->Output = (ListingEnabled > 0);
@ -276,7 +278,7 @@ static char* MakeLineHeader (char* H, const ListLine* L)
{
char Mode;
char Depth;
unsigned Offset = 0;
/* Setup the PC mode */
Mode = (L->Reloc)? 'r' : ' ';
@ -284,8 +286,18 @@ static char* MakeLineHeader (char* H, const ListLine* L)
Depth = (L->Depth < 10)? L->Depth + '0' : '+';
/* Format the line */
sprintf (H, "%06lX%c %c", L->PC, Mode, Depth);
memset (H+9, ' ', LINE_HEADER_LEN-9);
if (!SegList) {
Offset = 9;
sprintf (H, "%06lX%c %c", L->PC, Mode, Depth);
}else if (L->Reloc){
Offset = 12;
sprintf (H, "%02X.%06lX%c %c",L->Seg, L->PC, Mode, Depth);
} else {
Offset = 12;
sprintf (H, " %06lX%c %c", L->PC, Mode, Depth);
}
memset (H + Offset, ' ', LINE_HEADER_LEN - Offset - (SegList?0:3));
/* Return the buffer */
return H;
@ -313,8 +325,11 @@ void CreateListing (void)
PageNumber = 0;
PrintPageHeader (F, LineList);
/* Terminate the header buffer. The last byte will never get overwritten */
HeaderBuf [LINE_HEADER_LEN] = '\0';
/* Terminate the header buffer. The last byte will never get overwritten
** the - 3 adjust is for when the segnum gets prepended to the header.
*/
HeaderBuf [(SegList ? LINE_HEADER_LEN : LINE_HEADER_LEN - 3)] = '\0';
/* Walk through all listing lines */
L = LineList;
@ -426,7 +441,7 @@ void CreateListing (void)
L->PC += Chunk;
/* Copy the bytes into the line */
P = HeaderBuf + 11;
P = HeaderBuf + (SegList?14: 11);
for (I = 0; I < Chunk; ++I) {
*P++ = *B++;
*P++ = *B++;
@ -448,7 +463,8 @@ void CreateListing (void)
L = L->Next;
}
if (SegList)
ListSegments (F);
/* Close the listing file */
(void) fclose (F);
}

View File

@ -60,7 +60,7 @@ struct StrBuf;
/* Length of the header of a listing line */
#define LINE_HEADER_LEN 24
#define LINE_HEADER_LEN 27
/* One listing line as it is stored in memory */
typedef struct ListLine ListLine;
@ -68,6 +68,7 @@ struct ListLine {
ListLine* Next; /* Pointer to next line */
Fragment* FragList; /* List of fragments for this line */
Fragment* FragLast; /* Last entry in fragment list */
unsigned Seg; /* Which segment this line targets */
unsigned long PC; /* Program counter for this line */
unsigned char Reloc; /* Relocatable mode? */
unsigned char File; /* From which file is the line? */

View File

@ -105,6 +105,7 @@ static void Usage (void)
" -mm model\t\t\tSet the memory model\n"
" -o name\t\t\tName the output file\n"
" -s\t\t\t\tEnable smart mode\n"
" -S\t\t\t\tEnable segment offset listing\n"
" -t sys\t\t\tSet the target system\n"
" -v\t\t\t\tIncrease verbosity\n"
"\n"
@ -126,6 +127,7 @@ static void Usage (void)
" --memory-model model\t\tSet the memory model\n"
" --pagelength n\t\tSet the page length for the listing\n"
" --relax-checks\t\tRelax some checks (see docs)\n"
" --segment-list\t\tEnable segment offset listing\n"
" --smart\t\t\tEnable smart mode\n"
" --target sys\t\t\tSet the target system\n"
" --verbose\t\t\tIncrease verbosity\n"
@ -661,7 +663,12 @@ static void OptVersion (const char* Opt attribute ((unused)),
exit(EXIT_SUCCESS);
}
static void OptSeglist (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Enable segment listing */
{
SegList = 1;
}
static void OptWarningsAsErrors (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
@ -975,6 +982,7 @@ int main (int argc, char* argv [])
{ "--memory-model", 1, OptMemoryModel },
{ "--pagelength", 1, OptPageLength },
{ "--relax-checks", 0, OptRelaxChecks },
{ "--segment-list", 0, OptSeglist },
{ "--smart", 0, OptSmart },
{ "--target", 1, OptTarget },
{ "--verbose", 0, OptVerbose },
@ -1060,6 +1068,10 @@ int main (int argc, char* argv [])
OptSmart (Arg, 0);
break;
case 'S':
OptSeglist (Arg, 0);
break;
case 't':
OptTarget (Arg, GetArg (&I, 2));
break;

View File

@ -476,7 +476,17 @@ void SegDump (void)
printf ("\n");
}
void ListSegments (FILE* destination)
{
/* summary of segments when seglist requested */
unsigned I;
fprintf (destination, "\nSegment summary\n\n");
for (I = 0; I < CollCount (&SegmentList); ++I) {
Segment* S = CollAtUnchecked (&SegmentList, I);
if(S->FragCount)
fprintf (destination, "Segment: %02X = %s\n", S->Num, S->Def->Name);
}
}
void SegInit (void)
/* Initialize segments */

View File

@ -36,7 +36,7 @@
#ifndef SEGMENT_H
#define SEGMENT_H
#include <stdio.h>
/* common */
#include "coll.h"
@ -96,6 +96,9 @@ extern Segment* ActiveSeg;
Fragment* GenFragment (unsigned char Type, unsigned short Len);
/* Generate a new fragment, add it to the current segment and return it. */
void ListSegments (FILE* destination);
/* List the segments to the given file when seglist set */
void UseSeg (const SegDef* D);
/* Use the given segment */

View File

@ -14,7 +14,9 @@ WORKDIR = ../testwrk
.PHONY: test continue mostlyclean clean
test: mostlyclean continue
test:
@$(MAKE) mostlyclean
@$(MAKE) continue
continue:
@$(MAKE) -C asm all