M a65.c => a65.c +14 -8
@@ 330,7 330,7 @@ do_zero_page:
static void pseudo_op() {
SCRATCH char *s;
- SCRATCH unsigned *o, result, u;
+ SCRATCH unsigned count, *o, result, u;
SCRATCH SYMBOL *l;
FILE *binfp;
size_t size;
@@ 389,9 389,10 @@ static void pseudo_op() {
if (filesp) { listhex = FALSE; error('*'); }
else {
done = eject = TRUE;
+ /*
if (pass == 2 && (lex() -> attr & TYPE) != EOL) {
unlex(); bseek(address = expr());
- }
+ }*/
if (ifsp) error('I');
}
break;
@@ 504,9 505,12 @@ static void pseudo_op() {
u = expr();
if (forwd) error('P');
else {
- /* round up pc to next multiple of align val */
- pc = address = ((pc + (u / 2)) / u) * u;
- if (pass == 2) bseek(pc);
+ /* calculate amount to pad the file */
+ if (pc % u) u -= pc % u;
+ else u = 0;
+ if (pass == 2) bpad(u);
+ pc += u;
+ address = pc;
}
do_label();
break;
@@ 522,8 526,10 @@ static void pseudo_op() {
u = expr();
if (forwd) error('P');
else {
+ count = u - pc;
+ /* only pad if we're not at the initial offset */
+ if ((pass == 2) && (pc != 0)) bpad(count);
pc = address = u;
- if (pass == 2) bseek(pc);
}
do_label();
break;
@@ 541,11 547,11 @@ static void pseudo_op() {
case RMB:
do_label();
- u = word(pc + expr());
+ u = expr();
if (forwd) error('P');
else {
pc = u;
- if (pass == 2) bseek(pc);
+ if (pass == 2) bpad(u);
}
break;
M a65.sln => a65.sln +6 -0
@@ 7,12 7,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "a65", "a65.vcxproj", "{9B21
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug - working copy|x64 = Debug - working copy|x64
+ Debug - working copy|x86 = Debug - working copy|x86
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9B211D7E-3BBA-4483-A0B7-36FC2DB24243}.Debug - working copy|x64.ActiveCfg = Debug - working copy|x64
+ {9B211D7E-3BBA-4483-A0B7-36FC2DB24243}.Debug - working copy|x64.Build.0 = Debug - working copy|x64
+ {9B211D7E-3BBA-4483-A0B7-36FC2DB24243}.Debug - working copy|x86.ActiveCfg = Debug - working copy|Win32
+ {9B211D7E-3BBA-4483-A0B7-36FC2DB24243}.Debug - working copy|x86.Build.0 = Debug - working copy|Win32
{9B211D7E-3BBA-4483-A0B7-36FC2DB24243}.Debug|x64.ActiveCfg = Debug|x64
{9B211D7E-3BBA-4483-A0B7-36FC2DB24243}.Debug|x64.Build.0 = Debug|x64
{9B211D7E-3BBA-4483-A0B7-36FC2DB24243}.Debug|x86.ActiveCfg = Debug|Win32
M a65.vcxproj => a65.vcxproj +50 -0
@@ 1,6 1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug - working copy|Win32">
+ <Configuration>Debug - working copy</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug - working copy|x64">
+ <Configuration>Debug - working copy</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
@@ 32,6 40,12 @@
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - working copy|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
@@ 45,6 59,12 @@
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - working copy|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
@@ 60,12 80,18 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug - working copy|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug - working copy|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
@@ 82,6 108,18 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug - working copy|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
@@ 111,6 149,18 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug - working copy|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
M a65util.c => a65util.c +6 -21
@@ 348,6 348,7 @@ static void check_page() {
static FILE *outfile = NULL;
static unsigned cnt = 0;
static unsigned addr = 0;
+static unsigned bbase = 0;
static uint8_t buf[HEXSIZE];
/* Binary file open routine. If the file is already open, a warning */
@@ 377,30 378,14 @@ void bputc(unsigned c) {
}
}
-/* Binary file address set routine. Note that this can only be used to */
-/* seek forwards in the file. Seeking backwards will cause an error. */
+/* Pads the output file. The len parameter is the number of bytes to */
+/* pad the file by. */
-void bseek(unsigned a) {
- unsigned cursor = (addr + cnt) & 0xFFFF;
- unsigned difference;
+void bpad(unsigned len) {
int i;
- if (outfile) {
- /* initial ORG statement */
- if (cursor == 0) {
- addr = a;
- }
- /* don't allow seeking backwards */
- else if (cursor > a) {
- error('V');
- }
- /* pad the file to make up the difference */
- else {
- difference = a - cursor;
- for (i = 0; i < difference; i++) {
- bputc(0);
- }
- }
+ for (i = 0; i < len; i++) {
+ bputc(0);
}
}
M a65util.h => a65util.h +3 -3
@@ 123,10 123,10 @@ void bopen(char *nam);
void bputc(unsigned c);
-/* Binary file address set routine. Note that this can only be used to */
-/* seek forwards in the file. Seeking backwards will cause an error. */
+/* Pads the output file. The len parameter is the number of bytes to */
+/* pad the file by. */
-void bseek(unsigned a);
+void bpad(unsigned len);
/* Binary file close routine. All buffered data is written to disk, */