Skip to content
Browse files

Merge pull request #65 from mitchskiba/master

ASM spec changes: Overhauled data declarations for different string formats & fill
  • Loading branch information...
2 parents 2df56c6 + 89e113e commit b40bd92f94de4591d46461805a7851ac7c73cebe @0xabad1dea 0xabad1dea committed May 1, 2012
Showing with 96 additions and 40 deletions.
  1. +96 −40 ASM/Spec_0xSCA.txt
View
136 ASM/Spec_0xSCA.txt
@@ -224,7 +224,6 @@ Kuijpers & Beermann [Page 4]
Assembly Syntactics April 2012
-
The latter form of incbin MUST include the file from an
implementation defined location.
@@ -248,38 +247,99 @@ Kuijpers & Beermann [Page 4]
4.3.3. Data insertion
.dw value [,value...]
- .db value [,value...]
- .ascii "string"
+ .dp value [,value...]
+ .fill count[,value]
+ .ascii [flags][<value>]"string"
dw (data word) MUST store the values literally and unpacked at the
location of the directive.
- db (data byte) MUST pack (i.e. two bytes per word, first byte is LSB)
- the values at the location of the directive. Words are filled with
- empty bytes when the data does not evenly fit into 16-bit words.
-
- ascii MUST store the string unpacked (i.e. character is LSB, one word
- per character) at the location of the directive.
-
- asciip (a pascal string) MUST store the string unpacked (i.e.
- character is LSB, one word per character) at the location of the
- directive, prepending the string with its length.
-
- asciic (a C string) MUST store the string unpacked (i.e. character is
- LSB, one word per character) at the location of the directive,
- appending 0x0000 (\0).
-
-4.3.4. Origin relocation
-
- .org address
-
-
-
-
+ dp (data pack) MUST pack pairs of values into a single word. The
+ first value is placed into the high octet, and the second is placed
+ into the low octet of the word. Should there be an odd number of
+ values after a dp declaration, the remaining octet MUST be filled
+ with the value 0.
+
+ fill (fill words) MUST insert a count of words, initialized to the
+ specified value. If the value is not provided, the assembler MUST
+ assusme 0.
+
+ ascii (ascii string) MUST pack the ascii values of the string as
+ described below.
+
+ String declarations MAY have a set of control flags sepecified before
+ a string contained in double quotes, and a value as allowed by flags.
+
+ This will insert the ASCII values for the characters in the string,
+ in a maner controlled by the flags. The optional value parameter in
+ between less than (< U+003C) and greater than (> U+003E) will be
+ bitwise ORed with each character in the string. The upper octet for
+ unpacked strings will default to all 0's before the bitwise OR.
+
Kuijpers & Beermann [Page 5]
Assembly Syntactics April 2012
+
+
+ The control flags are:
+
+ k: The ascii values are "packed." Each character is mapped to an
+ octet of data. These are written in order. Certain other flags
+ may place octets that precede the first character's octet.
+
+ s: The ascii values are "packed" and "swapped." Like k, each
+ character uses one octet, however the order of the octets is
+ reversed within each word. Flags k and s are incompatible with
+ eachother. Certain other flags may place octets before the first
+ character octet.
+
+ z: Zero terminate the string, inheriting character width. A null
+ character will be appended to the string. If the string is one of
+ the packed formats only one octet will be added, where unpacked
+ strings will have a full word of zero. For the purpose of
+ determining string length, this zero counts as one character.
+
+ x: Word Zero terminate the string. This will zero terminate the
+ string, forcing a zero word onto the end of the string. If the
+ string is packed and of an odd length, a zero octet will be
+ placed at the end of the content, before the zero word. For the
+ purpose of determining string length, this zero will add quantity
+ of zero octets added divided by the octet width of each character.
+
+ For example, an unpacked string will always have 1 added to the
+ string length by the Z flag. A packed string of odd length will
+ have 3 added to the string length, where an even length packed
+ string will have 2 added to the length;
+
+ Flags w and x are incompatible.
+
+ a: Octet Pascal Length. This will prepend the length of the string
+ as an octet to the string content. This is only compatible with
+ a packed mode, either k or s. (For swapped mode, this will end
+ up being the lower (second) octet of the first word.)
+
+ p: Word Pascal Length. This will prepend the length of the string
+ as a full word to the string content. This is compatible with
+ either packed or unpacked modes. Flags a and p are incompatible.
+
+
+ Assemblers SHOULD warn the user when string literals excede the
+ length expressable in the pascal length field if the flag is set.
+
+
+
+
+
+
+
+Kuijpers & Beermann [Page 6]
+
+ Assembly Syntactics April 2012
+
+
+4.3.4. Origin relocation
+ .org address
The org preprocessor directive MUST take an address as the only
argument. Assemblers SHOULD verify the address is 16-bit sized.
@@ -328,11 +388,7 @@ Kuijpers & Beermann [Page 5]
-
-
-
-
-Kuijpers & Beermann [Page 6]
+Kuijpers & Beermann [Page 7]
Assembly Syntactics April 2012
@@ -388,7 +444,7 @@ Kuijpers & Beermann [Page 6]
-Kuijpers & Beermann [Page 7]
+Kuijpers & Beermann [Page 8]
Assembly Syntactics April 2012
@@ -413,11 +469,12 @@ Kuijpers & Beermann [Page 7]
5.1. Labels
Labels MUST be single-worded identifiers containing only alphabetical
- characters (/[A-Za-z]/), numbers (/[0-9]/) and underscores (_
- U+005F). The label MUST represent the address of following
- instruction or data. A label MUST NOT start with a number or an
- underscore. A label SHOULD end with a colon (: U+003A), but starting
- with a colon MAY be supported.
+ characters (/[A-Za-z]/), numbers (/[0-9]/), underscores (_ U+005F),
+ and periods (. U+002E). The label MUST represent the address of
+ following instruction or data. A label MUST NOT start with a number
+ or an underscore. A label SHOULD end with a colon (: U+003A), but
+ starting with a colon MAY be supported. An assemblery MAY require
+ labels to not end in a period.
Local labels MUST start with an underscore (_ U+002E) and end with a
colon (: U+003A). Local labels MUST be scoped between the
@@ -443,8 +500,7 @@ Kuijpers & Beermann [Page 7]
-
-Kuijpers & Beermann [Page 8]
+Kuijpers & Beermann [Page 9]
Assembly Syntactics April 2012
@@ -500,7 +556,7 @@ Kuijpers & Beermann [Page 8]
-Kuijpers & Beermann [Page 9]
+Kuijpers & Beermann [Page 10]
Assembly Syntactics April 2012
@@ -556,5 +612,5 @@ Authors' Addresses
-Kuijpers & Beermann [Page 10]
+Kuijpers & Beermann [Page 11]

0 comments on commit b40bd92

Please sign in to comment.
Something went wrong with that request. Please try again.