mirror of
https://github.com/uffejakobsen/acme.git
synced 2025-02-10 11:31:49 +00:00
in future versions, program counter in pseudopc blocks no longer silently wraps around to zero
git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@398 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
parent
3c390cbde7
commit
fc296d6abd
@ -40,7 +40,7 @@ macro.o: config.h alu.h dynabuf.h global.h input.h section.h symbol.h tree.h mac
|
||||
|
||||
mnemo.o: config.h alu.h cpu.h dynabuf.h global.h input.h output.h tree.h mnemo.h mnemo.c
|
||||
|
||||
output.o: config.h global.h output.h output.c
|
||||
output.o: config.h cpu.h global.h output.h output.c
|
||||
|
||||
platform.o: config.h platform.h platform.c
|
||||
|
||||
|
@ -40,7 +40,7 @@ macro.o: config.h alu.h dynabuf.h global.h input.h section.h symbol.h tree.h mac
|
||||
|
||||
mnemo.o: config.h alu.h cpu.h dynabuf.h global.h input.h output.h tree.h mnemo.h mnemo.c
|
||||
|
||||
output.o: config.h global.h output.h output.c
|
||||
output.o: config.h cpu.h global.h output.h output.c
|
||||
|
||||
platform.o: config.h platform.h platform.c
|
||||
|
||||
|
@ -43,7 +43,7 @@ macro.o: config.h alu.h dynabuf.h global.h input.h section.h symbol.h tree.h mac
|
||||
|
||||
mnemo.o: config.h alu.h cpu.h dynabuf.h global.h input.h output.h tree.h mnemo.h mnemo.c
|
||||
|
||||
output.o: config.h global.h output.h output.c
|
||||
output.o: config.h cpu.h global.h output.h output.c
|
||||
|
||||
platform.o: config.h platform.h platform.c
|
||||
|
||||
|
@ -39,7 +39,7 @@ macro.o: config.h alu.h dynabuf.h global.h input.h section.h symbol.h tree.h mac
|
||||
|
||||
mnemo.o: config.h alu.h cpu.h dynabuf.h global.h input.h output.h tree.h mnemo.h mnemo.c
|
||||
|
||||
output.o: config.h global.h output.h output.c
|
||||
output.o: config.h cpu.h global.h output.h output.c
|
||||
|
||||
platform.o: config.h platform.h platform.c
|
||||
|
||||
|
10
src/cpu.c
10
src/cpu.c
@ -15,52 +15,62 @@
|
||||
static struct cpu_type cpu_type_6502 = {
|
||||
keyword_is_6502_mnemo,
|
||||
CPUFLAG_WARN_ABOUT_FF_PTR | CPUFLAG_INDIRECTJMPBUGGY, // warn about "XYZ ($ff),y" and "jmp ($XYff)"
|
||||
0xffff,
|
||||
234 // !align fills with "NOP"
|
||||
};
|
||||
static struct cpu_type cpu_type_nmos6502 = {
|
||||
keyword_is_nmos6502_mnemo,
|
||||
CPUFLAG_WARN_ABOUT_FF_PTR | CPUFLAG_INDIRECTJMPBUGGY | CPUFLAG_8B_AND_AB_NEED_0_ARG, // ANE/LXA #$xx are unstable unless arg is $00
|
||||
0xffff,
|
||||
234 // !align fills with "NOP"
|
||||
};
|
||||
static struct cpu_type cpu_type_c64dtv2 = {
|
||||
keyword_is_c64dtv2_mnemo,
|
||||
CPUFLAG_WARN_ABOUT_FF_PTR | CPUFLAG_INDIRECTJMPBUGGY | CPUFLAG_8B_AND_AB_NEED_0_ARG,
|
||||
0xffff,
|
||||
234 // !align fills with "NOP"
|
||||
};
|
||||
static struct cpu_type cpu_type_65c02 = {
|
||||
keyword_is_65c02_mnemo,
|
||||
CPUFLAG_WARN_ABOUT_FF_PTR, // from WDC docs
|
||||
0xffff,
|
||||
234 // !align fills with "NOP"
|
||||
};
|
||||
static struct cpu_type cpu_type_r65c02 = {
|
||||
keyword_is_r65c02_mnemo,
|
||||
CPUFLAG_WARN_ABOUT_FF_PTR, // from WDC docs
|
||||
0xffff,
|
||||
234 // !align fills with "NOP"
|
||||
};
|
||||
static struct cpu_type cpu_type_w65c02 = {
|
||||
keyword_is_w65c02_mnemo,
|
||||
CPUFLAG_WARN_ABOUT_FF_PTR, // from WDC docs
|
||||
0xffff,
|
||||
234 // !align fills with "NOP"
|
||||
};
|
||||
static struct cpu_type cpu_type_65816 = {
|
||||
keyword_is_65816_mnemo,
|
||||
// TODO - what about CPUFLAG_WARN_ABOUT_FF_PTR? only needed for old opcodes in emulation mode!
|
||||
CPUFLAG_SUPPORTSLONGREGS, // allows A and XY to be 16bits wide
|
||||
0xffff,
|
||||
234 // !align fills with "NOP"
|
||||
};
|
||||
static struct cpu_type cpu_type_65ce02 = {
|
||||
keyword_is_65ce02_mnemo,
|
||||
CPUFLAG_DECIMALSUBTRACTBUGGY, // SBC does not work reliably in decimal mode
|
||||
0xffff,
|
||||
234 // !align fills with "NOP"
|
||||
};
|
||||
static struct cpu_type cpu_type_4502 = {
|
||||
keyword_is_4502_mnemo,
|
||||
CPUFLAG_DECIMALSUBTRACTBUGGY, // SBC does not work reliably in decimal mode
|
||||
0xffff,
|
||||
234 // !align fills with "NOP"
|
||||
};
|
||||
static struct cpu_type cpu_type_m65 = {
|
||||
keyword_is_m65_mnemo,
|
||||
CPUFLAG_WARN_ABOUT_FF_PTR, // TODO - remove this? check datasheets/realhw!
|
||||
0xffff,
|
||||
234 // !align fills with "NOP"
|
||||
};
|
||||
|
||||
|
@ -17,6 +17,7 @@ struct cpu_type {
|
||||
// because that's where the mnemonic is stored!
|
||||
boolean (*keyword_is_mnemonic)(int);
|
||||
bits flags; // see below for bit meanings
|
||||
int pc_mask; // last value before program counter wraps to zero
|
||||
unsigned char default_align_value;
|
||||
//int reserved_keywords_maxlen; // TODO - add
|
||||
//int (*reserved_keyword_check)(void); // TODO - add
|
||||
|
18
src/output.c
18
src/output.c
@ -11,6 +11,7 @@
|
||||
// 20 Apr 2019 Prepared for "make segment overlap warnings into errors" later on
|
||||
#include "output.h"
|
||||
#include <string.h> // for memset()
|
||||
#include "cpu.h"
|
||||
#include "global.h"
|
||||
|
||||
|
||||
@ -478,10 +479,19 @@ int output_get_statement_size(void)
|
||||
// adjust program counter (called at end of each statement)
|
||||
void output_end_statement(void)
|
||||
{
|
||||
// FIXME - that '&' cannot be right!
|
||||
// it makes sense from a cpu point of view (which wraps around to 0),
|
||||
// but not from "outbuf" point of view.
|
||||
program_counter = (program_counter + statement_size) & (config.outbuf_size - 1);
|
||||
if (config.dialect >= V0_98__PATHS_AND_SYMBOLCHANGE) {
|
||||
program_counter += statement_size;
|
||||
} else {
|
||||
// older versions did this stupid crap:
|
||||
program_counter = (program_counter + statement_size) & cpu_current_type->pc_mask;
|
||||
// making the program counter automatically wrap around from
|
||||
// 0xffff to 0x0000 without any warning or error is just asking
|
||||
// for trouble.
|
||||
// but I think I added this to fulfill a feature request where
|
||||
// demo code was located at $ffxx and in zero page, and with the
|
||||
// dialect feature I can actually be backward-compatible...
|
||||
// ...so there.
|
||||
}
|
||||
statement_size = 0; // reset
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#define RELEASE "0.97" // update before release FIXME
|
||||
#define CODENAME "Zem" // update before release
|
||||
#define CHANGE_DATE "31 Jul" // update before release FIXME
|
||||
#define CHANGE_DATE "1 Aug" // update before release FIXME
|
||||
#define CHANGE_YEAR "2024" // update before release
|
||||
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
|
||||
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME
|
||||
|
@ -1,5 +1,13 @@
|
||||
; 0.97 interprets all file names as relative to the initial directory:
|
||||
*=$3000
|
||||
; file names are relative to the containing file beginning with 0.98:
|
||||
!src "subdir/sub1.inc"
|
||||
!if depth_given_in_included_file != 0 {
|
||||
!error "included wrong file."
|
||||
}
|
||||
; program counter no longer silently wraps to zero beginning with 0.98:
|
||||
!pseudopc $fffe {
|
||||
!by 0, 1, 2, 3
|
||||
label }
|
||||
!if label != 2 {
|
||||
!error "program counter does not wrap to zero"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user