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
1 changed files with 7 additions and 0 deletions

View File

@ -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));
}