Added assembler check for string outside Data Segment.

This commit is contained in:
Anachronaut
2026-08-17 20:10:33 -04:00
parent 9e3425d34b
commit a842c884e8
7 changed files with 60 additions and 10 deletions
+2
View File
@@ -24,6 +24,8 @@ Any token beginning with a '0' is read as a numerical literal, so a malformed on
A string may be up to 255 characters. Each one is written down with a zero byte on the end, which is what lets a program find where it stops, and it means two strings written one after the other are not one longer string: there is a zero between them. A run of bytes longer than a string can hold has to be written as literals, or put there by the program itself while it runs.
**Strings belong in the Data Segment, and only there.** This is a Harvard machine: no instruction reads Program Memory, so a string put in the Program Segment could not be read by the program carrying it, and only the memory controller could reach it at all. The assembler refuses one rather than emitting bytes nothing can use. Single byte literals are a different matter and may go in either segment — a table of bytes a program branches through is a reasonable thing to want in Program Memory.
The one exception to the single byte rule is #Align and #Reserve, whose numbers are never emitted as bytes and may go up to 0xFFFF. See Moving The Cursor Along.
## Labels: