Skip to content
This repository
Browse code

Overhauled data insertion. String formats, db->dp (bytes are 16 bits)…

… and fill.
  • Loading branch information...
commit 08fe8d59b155f8c853d635ee3a9969cdeb902b2d 1 parent 2df56c6
mbs6597 authored April 30, 2012

Showing 1 changed file with 86 additions and 30 deletions. Show diff stats Hide diff stats

  1. 116  ASM/Spec_0xSCA.txt
116  ASM/Spec_0xSCA.txt
@@ -248,38 +248,98 @@ Kuijpers & Beermann                                             [Page 4]
248 248
 4.3.3.  Data insertion
249 249
 
250 250
    .dw value [,value...]
251  
-   .db value [,value...]
252  
-   .ascii "string"
  251
+   .dp value [,value...]
  252
+   .fill count[,value]
  253
+   .ascii [flags][<value>]"string"
253 254
 
254 255
    dw (data word) MUST store the values literally and unpacked at the
255 256
    location of the directive.
256 257
 
257  
-   db (data byte) MUST pack (i.e. two bytes per word, first byte is LSB)
258  
-   the values at the location of the directive.  Words are filled with
259  
-   empty bytes when the data does not evenly fit into 16-bit words.
  258
+   dp (data pack) MUST pack pairs of values into a single word. The
  259
+   first value is placed into the high octet, and the second is placed
  260
+   into the low octet of the word. Should there be an odd number of
  261
+   values after a dp declaration, the remaining octet MUST be filled
  262
+   with the value 0.
  263
+
  264
+   fill (fill words) Must insert a count of words, initialized to the
  265
+   specified value.  If the value is not provided, the assembler MUST
  266
+   assusme 0.
  267
+
  268
+   ascii (ascii string) MUST pack the ascii values of the string as 
  269
+   described below.
  270
+   
  271
+   String declarations MAY have a set of control flags sepecified before
  272
+   a string contained in double quotes, and a value as allowed by flags.
  273
+   
  274
+   This will insert the ASCII values for the characters in the string,
  275
+   in a maner controlled by the flags. The optional value parameter in 
  276
+   between less than (< U+003C) and greater than (> U+003E) is used with
  277
+   unpacked modes to specifiy the upper octet of each word written.
  278
+   
  279
+Kuijpers & Beermann                                             [Page 5]
  280
+
  281
+                           Assembly Syntactics                April 2012
  282
+   
  283
+   
  284
+   The control flags are:
260 285
 
261  
-   ascii MUST store the string unpacked (i.e. character is LSB, one word
262  
-   per character) at the location of the directive.
  286
+    k: The ascii values are "packed." Each character is mapped to an
  287
+	   octet of data. These are written in order. Certain other flags
  288
+	   may place octets that precede the first character's octet.
263 289
 
264  
-   asciip (a pascal string) MUST store the string unpacked (i.e.
265  
-   character is LSB, one word per character) at the location of the
266  
-   directive, prepending the string with its length.
  290
+    s: The ascii values are "packed" and "swapped." Like k, each
  291
+	   character uses one octet, however the order of the octets is
  292
+	   reversed within each word. Flags k and s are incompatible with
  293
+	   eachother. Certain other flags may place octets before the first
  294
+	   character octet.
  295
+	   
  296
+	z: Zero terminate the string, inheriting character width. A null
  297
+	   character will be appended to the string. If the string is one of
  298
+	   the packed formats only one octet will be added, where unpacked
  299
+	   strings will have a full word of zero. For the purpose of
  300
+	   determining string length, this zero counts as one character.
  301
+	   
  302
+	Z: Word Zero terminate the string. This will zero terminate the
  303
+	   string, forcing a zero word onto the end of the string. If the
  304
+	   string is packed and of an odd length, a zero octet will be 
  305
+	   placed at the end of the content, before the zero word. For the 
  306
+	   purpose of determining string length, this zero will add quantity
  307
+	   of zero octets added divided by the octet width of each character.
  308
+	   
  309
+	   For example, an unpacked string will always have 1 added to the
  310
+	   string length by the Z flag. A packed string of odd length will
  311
+	   have 3 added to the string length, where an even length packed
  312
+	   string will have 2 added to the length;
  313
+	   
  314
+	   Flags Z and z are incompatible.
  315
+	   
  316
+	p: Octet Pascal Length. This will prepend the length of the string
  317
+	   as an octet to the string content. This is only compatible with 
  318
+	   a packed mode, either k or s. (For swapped mode, this will end
  319
+	   up being the lower (second) octet of the first word.)
  320
+	   
  321
+	P: Word Pascal Length. This will prepend the length of the string
  322
+	   as a full word to the string content. This is compatible with 
  323
+	   either packed or unpacked modes.
267 324
 
268  
-   asciic (a C string) MUST store the string unpacked (i.e. character is
269  
-   LSB, one word per character) at the location of the directive,
270  
-   appending 0x0000 (\0).
271 325
 
272  
-4.3.4.  Origin relocation
273 326
 
274  
-   .org address
275 327
 
276 328
 
277 329
 
278 330
 
279  
-Kuijpers & Beermann                                             [Page 5]
  331
+
  332
+
  333
+
  334
+
  335
+Kuijpers & Beermann                                             [Page 6]	   
280 336
 
281 337
                            Assembly Syntactics                April 2012
  338
+	   
  339
+	   
  340
+4.3.4.  Origin relocation
282 341
 
  342
+   .org address
283 343
 
284 344
    The org preprocessor directive MUST take an address as the only
285 345
    argument.  Assemblers SHOULD verify the address is 16-bit sized.
@@ -328,11 +388,7 @@ Kuijpers & Beermann                                             [Page 5]
328 388
 
329 389
 
330 390
 
331  
-
332  
-
333  
-
334  
-
335  
-Kuijpers & Beermann                                             [Page 6]
  391
+Kuijpers & Beermann                                             [Page 7]
336 392
 
337 393
                            Assembly Syntactics                April 2012
338 394
 
@@ -388,7 +444,7 @@ Kuijpers & Beermann                                             [Page 6]
388 444
 
389 445
 
390 446
 
391  
-Kuijpers & Beermann                                             [Page 7]
  447
+Kuijpers & Beermann                                             [Page 8]
392 448
 
393 449
                            Assembly Syntactics                April 2012
394 450
 
@@ -413,11 +469,11 @@ Kuijpers & Beermann                                             [Page 7]
413 469
 5.1.  Labels
414 470
 
415 471
    Labels MUST be single-worded identifiers containing only alphabetical
416  
-   characters (/[A-Za-z]/), numbers (/[0-9]/) and underscores (_
417  
-   U+005F).  The label MUST represent the address of following
418  
-   instruction or data.  A label MUST NOT start with a number or an
419  
-   underscore.  A label SHOULD end with a colon (: U+003A), but starting
420  
-   with a colon MAY be supported.
  472
+   characters (/[A-Za-z]/), numbers (/[0-9]/), underscores (_ U+005F),
  473
+   and periods (. U+002E).  The label MUST represent the address of 
  474
+   following instruction or data.  A label MUST NOT start with a number 
  475
+   or an underscore.  A label SHOULD end with a colon (: U+003A), but 
  476
+   starting with a colon MAY be supported.
421 477
 
422 478
    Local labels MUST start with an underscore (_ U+002E) and end with a
423 479
    colon (: U+003A).  Local labels MUST be scoped between the
@@ -444,7 +500,7 @@ Kuijpers & Beermann                                             [Page 7]
444 500
 
445 501
 
446 502
 
447  
-Kuijpers & Beermann                                             [Page 8]
  503
+Kuijpers & Beermann                                             [Page 9]
448 504
 
449 505
                            Assembly Syntactics                April 2012
450 506
 
@@ -500,7 +556,7 @@ Kuijpers & Beermann                                             [Page 8]
500 556
 
501 557
 
502 558
 
503  
-Kuijpers & Beermann                                             [Page 9]
  559
+Kuijpers & Beermann                                            [Page 10]
504 560
 
505 561
                            Assembly Syntactics                April 2012
506 562
 
@@ -556,5 +612,5 @@ Authors' Addresses
556 612
 
557 613
 
558 614
 
559  
-Kuijpers & Beermann                                            [Page 10]
  615
+Kuijpers & Beermann                                            [Page 11]
560 616
 

0 notes on commit 08fe8d5

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