?login_element?

Subversion Repositories NedoOS

Rev

Rev 129 | Blame | Compare with Previous | Last modification | View Log | Download

  1.     OUTPUT "numeric_constants_defX.bin"
  2.     ;; official documentation of v1.10.4 - all possible DEFx directives and synonyms
  3.  
  4.     ; should produce ABCDEFGHIJKLM, all possible numeric literals - byte size
  5.     BYTE    65, 66d
  6.     DB      43h, 0C4h-080h, 0x45, $46, #47
  7.     DEFB    1001000b, 01001001b, %1001010, %01001011
  8.     DEFM    114q, 115o
  9.  
  10.     ;; some char/string literals - quotes parse escape sequences
  11.     ; \n, ", \, ', ', ', ?, ?, \n
  12.     DM      "\n", "\"", "\\", "''\'", "\??", "\N"
  13.    ; 2x "012345678\n" + "012\n"
  14.    db      48-7+"\A", 49-8+"\B", 50-127+"\D", 51-27+"\E", 52-12+"\F"
  15.    db      53-10+"\N", 54-13+"\R", 55-9+"\T", 56-11+"\V", "\n"
  16.    db      "\A"+48-7, "\B"+49-8, "\D"+50-127, "\E"+51-27, "\F"+52-12
  17.    db      "\N"+53-10, "\R"+54-13, "\T"+55-9, "\V"+56-11, "\n"
  18.    db      '0'+0,1+'0','0'+2,10
  19.  
  20.    ; WORD binary data
  21.    WORD    0C000h, "HA"   ,   "HE"
  22.    DW      %0000100010101110
  23.    DEFW    1000101011101001b
  24.  
  25.    ; DWORD binary data
  26.    DWORD   0x12345678
  27.    DD      87654321h,$FFFFFFFF
  28.    DEFD    #DEADF00D   ,   "\nEEB"
  29.  
  30.    ABYTE   64 1, 2, 3          ; +64
  31.    ABYTEC  3 "ABC", 4, "EF"    ; +3, last char of each substring |128
  32.    ABYTEZ  9 "ABC", 4, "EF"    ; +9, extra 0 after last byte
  33.    DC      10, "A", "BC", "DEF" ; last char of each substring |128
  34.    DZ      10, "abc", "def"    ; extra 0 after last byte
  35.  
  36.    ; block/ds directive
  37.    BLOCK   5, "\n"
  38.    DS      16, '*'
  39.  
  40.    ; 7x warning, testing 8/16b checks
  41.    DB      266, 256, -257, -502
  42.    DW      -65537, 65536, "DCBA"   ; last one should produce bytes 'A', 'B'
  43.    ; 5x 8b warnings for whole expressions (checks before "add" in ABYTE directive)
  44.    ABYTE '!' 128+128, 191+'A', 'A'+191, 191+"A", "A"+191
  45.  
  46.    DC      'a', 'ab'               ; DC distincts between single (no |128) and two+ chars
  47.    DC      "a", "ab"               ; but only in apostrophes, quotes make it "string" always
  48.  
  49.    DB                              ; expression expected error
  50.    DB      1,                      ; expression expected error
  51.    DC      "", ''                  ; 2x warning about empty "string" + 1x error "no arguments"
  52.  
  53.    ;; too many arguments error tests:
  54.    ; 2x OK (max 128 bytes)
  55.    DB      "\n123456789ABCDEF","0123456789ABCDEF","0123456789ABCDEF","0123456789ABCDEF","\n123456789ABCDEF","0123456789ABCDEF","0123456789ABCDEF","0123456789ABCDEF"
  56.    DB      "\n123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\n123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
  57.    ; 3x error too many
  58.    DB      "\n123456789ABCDEF","0123456789ABCDEF","0123456789ABCDEF","0123456789ABCDEF",'!',"\n123456789ABCDEF","0123456789ABCDEF","0123456789ABCDEF","0123456789ABCDEF"
  59.    DB      "\n123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\n123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", 1
  60.    DB      "\n123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\n123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF!"
  61.  
  62.    ;; exercising DW a bit more
  63.    DW      'AA',    'BB'     ,       'CC'
  64.    DW                              ; error: Expression expected
  65.    DW      &&$                     ; error: Syntax error
  66.    ; 128 values = OK
  67.    DW      1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
  68.    ; 129 values = error too many
  69.    DW      -1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
  70.  
  71.    ;; exercising DD a bit more
  72.    DD      'AAAA',    'BBBB'     ,       'CCCC'
  73.    DD                              ; error: Expression expected
  74.    DD      &&$                     ; error: Syntax error
  75.    ; 128 values = OK
  76.    DD      -1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
  77.    ; 129 values = error too many
  78.    DD      -1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
  79.  
  80.    ;; exercising D24 a bit more
  81.    D24     'AAA',    'BBB'     ,       'CCC'
  82.    D24    'AAAA',   'BBBB'     ,      'CCCC'       ; 3x int24 warning
  83.    D24                             ; error: Expression expected
  84.    D24     &&$                     ; error: Syntax error
  85.    ; 128 values = OK
  86.    D24     -1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
  87.    ; 129 values = error too many
  88.    D24     -1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
  89.  
  90.    ; check if syntax errors are reported precisely *once* per (tricky) expression
  91.    DB      +                       ; error: Syntax error
  92.    DB      &&$                     ; error: Syntax error
  93.  
  94.    ABYTE & 1 : ABYTEC & 2 : ABYTEZ & 3 ; error: Syntax error
  95.