1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-28 08:50:22 +00:00

ecs: check page boundary for critical subs

This commit is contained in:
Steven Hugg 2022-02-19 11:51:48 -06:00
parent 600e62f0c6
commit c73c5ee185

View File

@ -317,6 +317,10 @@ export class Dialect_CA65 {
alignSegmentStart() { alignSegmentStart() {
return this.label('__ALIGNORIGIN'); return this.label('__ALIGNORIGIN');
} }
warningIfPageCrossed(startlabel: string) {
return `
.assert >(${startlabel}) = >(*), error, "${startlabel} crosses a page boundary!"`
}
warningIfMoreThan(bytes: number, startlabel: string) { warningIfMoreThan(bytes: number, startlabel: string) {
return ` return `
.assert (* - ${startlabel}) <= ${bytes}, error, "${startlabel} does not fit in ${bytes} bytes!"` .assert (* - ${startlabel}) <= ${bytes}, error, "${startlabel} does not fit in ${bytes} bytes!"`
@ -1454,6 +1458,9 @@ export class EntityScope implements SourceLocated {
stats.code, stats.code,
this.dialect.return(), this.dialect.return(),
]; ];
if (stats.action.critical) {
sublines.push(this.dialect.warningIfPageCrossed(substart));
}
if (stats.action.fitbytes) { if (stats.action.fitbytes) {
sublines.push(this.dialect.warningIfMoreThan(stats.action.fitbytes, substart)); sublines.push(this.dialect.warningIfMoreThan(stats.action.fitbytes, substart));
} }