From c73c5ee185f76156119b01caf305a9fba6e4bbbc Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Sat, 19 Feb 2022 11:51:48 -0600 Subject: [PATCH] ecs: check page boundary for critical subs --- src/common/ecs/ecs.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/common/ecs/ecs.ts b/src/common/ecs/ecs.ts index 5816e91e..2fdfa13a 100644 --- a/src/common/ecs/ecs.ts +++ b/src/common/ecs/ecs.ts @@ -317,6 +317,10 @@ export class Dialect_CA65 { alignSegmentStart() { return this.label('__ALIGNORIGIN'); } + warningIfPageCrossed(startlabel: string) { + return ` +.assert >(${startlabel}) = >(*), error, "${startlabel} crosses a page boundary!"` + } warningIfMoreThan(bytes: number, startlabel: string) { return ` .assert (* - ${startlabel}) <= ${bytes}, error, "${startlabel} does not fit in ${bytes} bytes!"` @@ -1454,6 +1458,9 @@ export class EntityScope implements SourceLocated { stats.code, this.dialect.return(), ]; + if (stats.action.critical) { + sublines.push(this.dialect.warningIfPageCrossed(substart)); + } if (stats.action.fitbytes) { sublines.push(this.dialect.warningIfMoreThan(stats.action.fitbytes, substart)); }