Browse code

Don't preseed devices in label tree.

Andrew Alderwick authored on 15/05/2021 17:25:06
Showing 3 changed files
... ...
@@ -23,7 +23,6 @@ spairs = function(t)
23 23
   end
24 24
 end
25 25
 local trees = {
26
-  ['asma-labels'] = { },
27 26
   ['asma-opcodes'] = { }
28 27
 }
29 28
 local opcodes_in_order = { }
... ...
@@ -49,41 +48,6 @@ do
49 48
   end
50 49
   assert(#opcodes_in_order == 32, 'didn\'t find 32 opcodes in assembler code!')
51 50
 end
52
-do
53
-  local add_device
54
-  add_device = function(addr, name, fields)
55
-    addr = tonumber(addr, 16)
56
-    local k
57
-    if name:match('^Audio%x+$') then
58
-      k = 'asma-ldev-Audio'
59
-    else
60
-      k = ('asma-ldev-%s'):format(name)
61
-    end
62
-    trees['asma-labels'][name] = {
63
-      ('"%s 00'):format(name),
64
-      ('00%02x :%s/_entry'):format(addr, k)
65
-    }
66
-    trees[k] = { }
67
-    addr = 0
68
-    for fname, flen in fields:gmatch('%&(%S+) +%$(%x+)') do
69
-      if fname ~= 'pad' then
70
-        trees[k][fname] = {
71
-          ('"%s 00'):format(fname),
72
-          ('00%02x'):format(addr)
73
-        }
74
-      end
75
-      addr = addr + tonumber(flen, 16)
76
-    end
77
-  end
78
-  for l in assert(io.lines('projects/examples/blank.usm')) do
79
-    local f = {
80
-      l:match('^%|(%x%x) +%@(%S+) +%[ (.*) %]')
81
-    }
82
-    if f[1] then
83
-      add_device(unpack(f))
84
-    end
85
-  end
86
-end
87 51
 do
88 52
   local representation = setmetatable({
89 53
     ['&'] = '26 00 ( & )'
... ...
@@ -9,7 +9,6 @@ spairs = (t) ->
9 9
 		keys[i], t[keys[i]]
10 10
 
11 11
 trees = {
12
-	['asma-labels']: {}
13 12
 	['asma-opcodes']: {}
14 13
 }
15 14
 
... ...
@@ -32,32 +31,6 @@ do -- opcodes
32 31
 				table.insert opcodes_in_order, w
33 32
 	assert #opcodes_in_order == 32, 'didn\'t find 32 opcodes in assembler code!'
34 33
 
35
-do -- devices -> labels
36
-	add_device = (addr, name, fields) ->
37
-		addr = tonumber addr, 16
38
-		k = if name\match '^Audio%x+$'
39
-			'asma-ldev-Audio'
40
-		else
41
-			'asma-ldev-%s'\format name
42
-		trees['asma-labels'][name] = {
43
-			'"%s 00'\format name
44
-			'00%02x :%s/_entry'\format addr, k
45
-		}
46
-		trees[k] = {}
47
-		addr = 0
48
-		for fname, flen in fields\gmatch '%&(%S+) +%$(%x+)'
49
-			if fname != 'pad'
50
-				trees[k][fname] = {
51
-					'"%s 00'\format fname,
52
-					'00%02x'\format addr
53
-				}
54
-			addr += tonumber flen, 16
55
-	for l in assert io.lines 'projects/examples/blank.usm'
56
-		f = { l\match '^%|(%x%x) +%@(%S+) +%[ (.*) %]' }
57
-		if f[1]
58
-			add_device unpack f
59
-
60
-
61 34
 do -- first characters
62 35
 	representation = setmetatable {
63 36
 		'&': '26 00 ( & )'
... ...
@@ -148,7 +148,7 @@
148 148
 	#ff ;asma/pass STA
149 149
 	#0000 ;asma/error STA2
150 150
 	;asma-heap ;asma/heap STA2
151
-	;asma-labels/_entry ;asma-trees/labels STA2
151
+	#0000 ;asma-trees/labels STA2
152 152
 	( FIXME should walk the label tree and remove any in the heap )
153 153
 	;asma-opcodes/_entry ;asma-trees/opcodes STA2
154 154
 	#0000 ;asma-trees/macros STA2
... ...
@@ -754,91 +754,6 @@
754 754
 	&7c         :&7b       :&7d         '| 00          :asma-pad-absolute
755 755
 	&7d          $2         $2          '} 00          :asma-ignore
756 756
 
757
-@asma-labels
758
-	&Audio0      $2         $2          "Audio0 00     0030 :asma-ldev-Audio/_entry
759
-	&Audio1     :&Audio0   :&Audio2     "Audio1 00     0040 :asma-ldev-Audio/_entry
760
-	&Audio2      $2         $2          "Audio2 00     0050 :asma-ldev-Audio/_entry
761
-	&Audio3     :&Audio1   :&Controller "Audio3 00     0060 :asma-ldev-Audio/_entry
762
-	&Console     $2         $2          "Console 00    0010 :asma-ldev-Console/_entry
763
-	&Controller :&Console   $2          "Controller 00 0080 :asma-ldev-Controller/_entry
764
-	&_entry     :&Audio3   :&Mouse      "DateTime 00   00b0 :asma-ldev-DateTime/_entry
765
-	&File        $2         $2          "File 00       00a0 :asma-ldev-File/_entry
766
-	&Midi       :&File      $2          "Midi 00       0070 :asma-ldev-Midi/_entry
767
-	&Mouse      :&Midi     :&System     "Mouse 00      0090 :asma-ldev-Mouse/_entry
768
-	&Screen      $2         $2          "Screen 00     0020 :asma-ldev-Screen/_entry
769
-	&System     :&Screen    $2          "System 00     0000 :asma-ldev-System/_entry
770
-
771
-@asma-ldev-Audio
772
-	&addr        $2         $2          "addr 00       000c
773
-	&adsr       :&addr      $2          "adsr 00       0008
774
-	&length     :&adsr     :&output     "length 00     000a
775
-	&output      $2         $2          "output 00     0004
776
-	&_entry     :&length   :&vector     "pitch 00      000f
777
-	&position    $2         $2          "position 00   0002
778
-	&vector     :&position :&volume     "vector 00     0000
779
-	&volume      $2         $2          "volume 00     000e
780
-
781
-@asma-ldev-Console
782
-	&byte        $2         $2          "byte 00       0009
783
-	&char       :&byte      $2          "char 00       0008
784
-	&_entry     :&char     :&string     "short 00      000a
785
-	&string      $2         $2          "string 00     000c
786
-
787
-@asma-ldev-Controller
788
-	&button      $2         $2          "button 00     0002
789
-	&_entry     :&button   :&vector     "key 00        0003
790
-	&vector      $2         $2          "vector 00     0000
791
-
792
-@asma-ldev-DateTime
793
-	&day         $2         $2          "day 00        0003
794
-	&dotw       :&day       $2          "dotw 00       0007
795
-	&doty       :&dotw     :&hour       "doty 00       0008
796
-	&hour        $2         $2          "hour 00       0004
797
-	&_entry     :&doty     :&second     "isdst 00      000a
798
-	&minute      $2         $2          "minute 00     0005
799
-	&month      :&minute    $2          "month 00      0002
800
-	&second     :&month    :&year       "second 00     0006
801
-	&year        $2         $2          "year 00       0000
802
-
803
-@asma-ldev-File
804
-	&length      $2         $2          "length 00     000a
805
-	&load       :&length   :&name       "load 00       000c
806
-	&name        $2         $2          "name 00       0008
807
-	&_entry     :&load     :&success    "offset 00     0004
808
-	&save        $2         $2          "save 00       000e
809
-	&success    :&save     :&vector     "success 00    0002
810
-	&vector      $2         $2          "vector 00     0000
811
-
812
-@asma-ldev-Midi
813
-	&channel     $2         $2          "channel 00    0002
814
-	&note       :&channel   $2          "note 00       0003
815
-	&_entry     :&note     :&velocity   "vector 00     0000
816
-	&velocity    $2         $2          "velocity 00   0004
817
-
818
-@asma-ldev-Mouse
819
-	&chord       $2         $2          "chord 00      0007
820
-	&state      :&chord     $2          "state 00      0006
821
-	&_entry     :&state    :&y          "vector 00     0000
822
-	&x           $2         $2          "x 00          0002
823
-	&y          :&x         $2          "y 00          0004
824
-
825
-@asma-ldev-Screen
826
-	&addr        $2         $2          "addr 00       000c
827
-	&color      :&addr     :&height     "color 00      000e
828
-	&height      $2         $2          "height 00     0004
829
-	&_entry     :&color    :&x          "vector 00     0000
830
-	&width       $2         $2          "width 00      0002
831
-	&x          :&width    :&y          "x 00          0008
832
-	&y           $2         $2          "y 00          000a
833
-
834
-@asma-ldev-System
835
-	&b           $2         $2          "b 00          000c
836
-	&g          :&b        :&r          "g 00          000a
837
-	&r           $2         $2          "r 00          0008
838
-	&_entry     :&g        :&wst        "rst 00        0003
839
-	&vector      $2         $2          "vector 00     0000
840
-	&wst        :&vector    $2          "wst 00        0002
841
-
842 757
 @asma-opcodes
843 758
 	&BRK        :&AND      :&DEI &_disasm "BRK 00
844 759
 	&_entry     :&EQU      :&ROT        "LIT 00