New JSON-based object extractor and compiler (does ucode, no disassembly yet)
authorNick Downing <nick@ndcode.org>
Sat, 25 Jun 2022 09:19:11 +0000 (19:19 +1000)
committerNick Downing <nick@ndcode.org>
Tue, 28 Jun 2022 03:21:37 +0000 (13:21 +1000)
.gitignore
disasm/Makefile
disasm/disasm.py
disasm/object.txt [deleted file]
disasm/object_compile.py [new file with mode: 0755]
disasm/object_extract.py [new file with mode: 0755]
disasm/shape_compile.py
disasm/shape_extract.py
disasm/star_blazer.asm.patch
disasm/star_blazer.txt
loader/star_blazer_segments.txt

index 0ff2e9d..1f2d497 100644 (file)
@@ -9,6 +9,9 @@
 *.rel
 *.rst
 *.seed
+/disasm/object.json
+/disasm/object_data.inc
+/disasm/object_index.inc
 /disasm/shape.json
 /disasm/shape_data.inc
 /disasm/shape_index.inc
index a548ec8..c7733fb 100644 (file)
@@ -40,8 +40,9 @@ star_blazer.ihx: star_blazer.rel
 -b text2=0x1e00 \
 -b data1=0x1f80 \
 -b data2=0x4000 \
--b data3=0x5c00 \
--b data4=0x8e00 \
+-b data3=0x4800 \
+-b data4=0x5c00 \
+-b data5=0x8e00 \
 -b udata1=0xa800 \
 $@ $<
 
@@ -54,8 +55,9 @@ shape_index_pixel.inc \
 shape_data_pixel.inc \
 shape_index.inc \
 shape_data.inc \
-ucode_defs.inc \
-ucode_data.inc
+object_index.inc \
+object_data.inc \
+ucode_defs.inc
        ${AS6500} -3 -l -o $<
 
 shape_index_pixel.inc shape_data_pixel.inc: star_blazer.txt shape_pixel.json
@@ -70,6 +72,12 @@ shape_index.inc shape_data.inc: star_blazer.txt shape.json
 shape.json: star_blazer.txt ../loader/star_blazer.ihx
        ./shape_extract.py $^ $@
 
+object_index.inc object_data.inc: star_blazer.txt object.json
+       ./object_compile.py 0x4800 $^ object_index.inc object_data.inc
+
+object.json: star_blazer.txt ../loader/star_blazer.ihx
+       ./object_extract.py $^ $@
+
 ucode_data.inc: star_blazer.asm
        sed -ne '/^ucode1080_countdown_30_pixel:/,/; 9dec/p' $< |\
 ./ucode_disasm.py >$@
index 59715d1..ca5e4bd 100755 (executable)
@@ -137,7 +137,7 @@ area_addr = []
 area_info = []
 item_addr = []
 item_info = []
-with open(addrs_txt, 'r') as fin:
+with open(addrs_txt) as fin:
   def get_line():
     while True:
       line = fin.readline()
diff --git a/disasm/object.txt b/disasm/object.txt
deleted file mode 100644 (file)
index 32eef15..0000000
+++ /dev/null
@@ -1,590 +0,0 @@
-object_10_pixel
-  shape_04_pixel4
-object_11_pixel
-  shape_04_pixel4
-object_12_pixel
-  shape_04_pixel4
-object_13_pixel
-  shape_04_pixel4
-object_14_fragment
-  shape_60_fragment0
-  shape_61_fragment1
-  shape_62_fragment2
-  shape_63_fragment3
-  shape_64_fragment4
-  shape_65_fragment5
-  shape_66_fragment6
-  shape_67_fragment7
-object_15_fragment
-  shape_60_fragment0
-  shape_61_fragment1
-  shape_62_fragment2
-  shape_63_fragment3
-  shape_64_fragment4
-  shape_65_fragment5
-  shape_66_fragment6
-  shape_67_fragment7
-object_16_fragment
-  shape_60_fragment0
-  shape_61_fragment1
-  shape_62_fragment2
-  shape_63_fragment3
-  shape_64_fragment4
-  shape_65_fragment5
-  shape_66_fragment6
-  shape_67_fragment7
-object_17_fragment
-  shape_60_fragment0
-  shape_61_fragment1
-  shape_62_fragment2
-  shape_63_fragment3
-  shape_64_fragment4
-  shape_65_fragment5
-  shape_66_fragment6
-  shape_67_fragment7
-object_18_fragment
-  shape_60_fragment0
-  shape_61_fragment1
-  shape_62_fragment2
-  shape_63_fragment3
-  shape_64_fragment4
-  shape_65_fragment5
-  shape_66_fragment6
-  shape_67_fragment7
-object_19_fragment
-  shape_60_fragment0
-  shape_61_fragment1
-  shape_62_fragment2
-  shape_63_fragment3
-  shape_64_fragment4
-  shape_65_fragment5
-  shape_66_fragment6
-  shape_67_fragment7
-object_1a_fragment
-  shape_60_fragment0
-  shape_61_fragment1
-  shape_62_fragment2
-  shape_63_fragment3
-  shape_64_fragment4
-  shape_65_fragment5
-  shape_66_fragment6
-  shape_67_fragment7
-object_1b_fragment
-  shape_60_fragment0
-  shape_61_fragment1
-  shape_62_fragment2
-  shape_63_fragment3
-  shape_64_fragment4
-  shape_65_fragment5
-  shape_66_fragment6
-  shape_67_fragment7
-object_1c_fragment
-  shape_60_fragment0
-  shape_61_fragment1
-  shape_62_fragment2
-  shape_63_fragment3
-  shape_64_fragment4
-  shape_65_fragment5
-  shape_66_fragment6
-  shape_67_fragment7
-object_1d_fragment
-  shape_60_fragment0
-  shape_61_fragment1
-  shape_62_fragment2
-  shape_63_fragment3
-  shape_64_fragment4
-  shape_65_fragment5
-  shape_66_fragment6
-  shape_67_fragment7
-object_1e_fragment
-  shape_60_fragment0
-  shape_61_fragment1
-  shape_62_fragment2
-  shape_63_fragment3
-  shape_64_fragment4
-  shape_65_fragment5
-  shape_66_fragment6
-  shape_67_fragment7
-object_1f_fragment
-  shape_60_fragment0
-  shape_61_fragment1
-  shape_62_fragment2
-  shape_63_fragment3
-  shape_64_fragment4
-  shape_65_fragment5
-  shape_66_fragment6
-  shape_67_fragment7
-object_20_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_04_pixel4
-object_21_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_04_pixel4
-object_22_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_04_pixel4
-object_23_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_04_pixel4
-object_24_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_04_pixel4
-object_25_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_04_pixel4
-object_26_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_04_pixel4
-object_27_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_04_pixel4
-object_28_exhaust
-  shape_13_exhaust1
-object_29_pixel
-  shape_04_pixel4
-object_2a_explosion
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_2c_pixel
-  shape_04_pixel4
-object_2d_pixel
-  shape_04_pixel4
-object_2e_pixel
-  shape_04_pixel4
-object_2f_pixel
-  shape_04_pixel4
-object_30_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_31_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_32_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_33_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_34_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_35_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_36_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_37_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_38_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_39_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_3a_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_3b_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_3c_pixel
-  shape_04_pixel4
-object_3d_pixel
-  shape_04_pixel4
-object_40_bird
-  shape_0c_bird0
-  shape_0d_bird1
-  shape_0e_bird2
-object_41_tree_cactus
-  shape_78_tree
-  shape_79_cactus
-object_42_tree_cactus
-  shape_78_tree
-  shape_79_cactus
-object_43_tree_cactus
-  shape_78_tree
-  shape_79_cactus
-object_44_missile_launcher
-  shape_50_missile_launcher0_empty
-  shape_51_missile_launcher1_empty
-  shape_52_missile_launcher2_empty
-  shape_54_missile_launcher0
-  shape_55_missile_launcher1
-  shape_56_missile_launcher2
-object_45_missile_launcher
-  shape_50_missile_launcher0_empty
-  shape_51_missile_launcher1_empty
-  shape_52_missile_launcher2_empty
-  shape_54_missile_launcher0
-  shape_55_missile_launcher1
-  shape_56_missile_launcher2
-object_46_missile_launcher
-  shape_50_missile_launcher0_empty
-  shape_51_missile_launcher1_empty
-  shape_52_missile_launcher2_empty
-  shape_54_missile_launcher0
-  shape_55_missile_launcher1
-  shape_56_missile_launcher2
-object_47_pylon
-  shape_36_pylon
-object_48_pylon
-  shape_36_pylon
-object_49_silo
-  shape_30_silo0
-  shape_31_silo1
-object_4a_silo_haystack
-  shape_30_silo0
-  shape_31_silo1
-  shape_70_haystack
-object_4b_haystack_house
-  shape_70_haystack
-  shape_71_house
-object_4c_silo_house
-  shape_30_silo0
-  shape_31_silo1
-  shape_71_house
-object_4d_headquarters_radar_icbm
-  shape_72_headquarters
-  shape_73_radar0
-  shape_74_radar1
-  shape_75_radar2
-  shape_76_icbm
-object_4e_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_4f_pixel
-  shape_01_pixel1
-  shape_02_pixel2
-  shape_03_pixel3
-  shape_05_pixel5
-  shape_06_pixel6
-  shape_07_pixel7
-object_50_bullet
-  shape_08_bullet3
-  shape_09_bullet5
-  shape_0a_bullet7
-  shape_0b_bullet9
-object_51_bullet
-  shape_08_bullet3
-  shape_09_bullet5
-  shape_0a_bullet7
-  shape_0b_bullet9
-object_52_bullet
-  shape_08_bullet3
-  shape_09_bullet5
-  shape_0a_bullet7
-  shape_0b_bullet9
-object_53_pixel_balloon_explosion
-  shape_04_pixel4
-  shape_28_balloon0
-  shape_29_balloon1
-  shape_2a_balloon2
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_54_pixel_balloon_explosion
-  shape_04_pixel4
-  shape_28_balloon0
-  shape_29_balloon1
-  shape_2a_balloon2
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_55_pixel_balloon_explosion
-  shape_04_pixel4
-  shape_28_balloon0
-  shape_29_balloon1
-  shape_2a_balloon2
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_56_pixel_balloon_explosion
-  shape_04_pixel4
-  shape_28_balloon0
-  shape_29_balloon1
-  shape_2a_balloon2
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_57_pixel_balloon_explosion
-  shape_04_pixel4
-  shape_28_balloon0
-  shape_29_balloon1
-  shape_2a_balloon2
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_58_bomb_explosion
-  shape_20_bomb0
-  shape_21_bomb1
-  shape_22_bomb2
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_59_bomb_explosion
-  shape_20_bomb0
-  shape_21_bomb1
-  shape_22_bomb2
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_5a_bomb_explosion
-  shape_20_bomb0
-  shape_21_bomb1
-  shape_22_bomb2
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_5b_bomb_explosion
-  shape_20_bomb0
-  shape_21_bomb1
-  shape_22_bomb2
-  shape_23_bomb3
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_5c_bomb_explosion
-  shape_20_bomb0
-  shape_21_bomb1
-  shape_22_bomb2
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_5d_bomb_explosion
-  shape_20_bomb0
-  shape_21_bomb1
-  shape_22_bomb2
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_5e_bomb_explosion
-  shape_20_bomb0
-  shape_21_bomb1
-  shape_22_bomb2
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_5f_bomb_explosion
-  shape_20_bomb0
-  shape_21_bomb1
-  shape_22_bomb2
-  shape_23_bomb3
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_60_pixel
-  shape_04_pixel4
-object_61_ship
-  shape_10_ship
-  shape_11_ship_open
-object_62_ship
-  shape_10_ship
-object_63_pixel
-  shape_04_pixel4
-object_64_pixel_ship
-  shape_04_pixel4
-  shape_10_ship
-object_65_pixel_exhaust
-  shape_04_pixel4
-  shape_12_exhaust0
-object_66_ship
-  shape_10_ship
-object_67_bird
-  shape_0f_bird3
-object_68_missile
-  shape_40_missile0
-  shape_41_missile1
-  shape_42_missile2
-  shape_43_missile3
-  shape_44_missile4
-  shape_45_missile5
-  shape_46_missile6
-  shape_47_missile7
-  shape_48_missile8
-  shape_49_missile9
-  shape_4a_missile10
-  shape_4b_missile11
-  shape_4c_missile12
-  shape_4d_missile13
-  shape_4e_missile14
-  shape_4f_missile15
-object_69_missile
-  shape_40_missile0
-  shape_41_missile1
-  shape_42_missile2
-  shape_43_missile3
-  shape_44_missile4
-  shape_45_missile5
-  shape_46_missile6
-  shape_47_missile7
-  shape_48_missile8
-  shape_49_missile9
-  shape_4a_missile10
-  shape_4b_missile11
-  shape_4c_missile12
-  shape_4d_missile13
-  shape_4e_missile14
-  shape_4f_missile15
-object_6a_missile
-  shape_40_missile0
-  shape_41_missile1
-  shape_42_missile2
-  shape_43_missile3
-  shape_44_missile4
-  shape_45_missile5
-  shape_46_missile6
-  shape_47_missile7
-  shape_48_missile8
-  shape_49_missile9
-  shape_4a_missile10
-  shape_4b_missile11
-  shape_4c_missile12
-  shape_4d_missile13
-  shape_4e_missile14
-  shape_4f_missile15
-object_6b_helicopter_enemy_plane
-  shape_2c_helicopter
-  shape_2e_enemy_plane0
-  shape_2f_enemy_plane1
-object_6c_helicopter_enemy_plane
-  shape_2c_helicopter
-  shape_2e_enemy_plane0
-  shape_2f_enemy_plane1
-object_6d_helicopter_enemy_plane
-  shape_2c_helicopter
-  shape_2e_enemy_plane0
-  shape_2f_enemy_plane1
-object_6e_helicopter_enemy_plane
-  shape_2c_helicopter
-  shape_2e_enemy_plane0
-  shape_2f_enemy_plane1
-object_6f_helicopter_enemy_plane
-  shape_2c_helicopter
-  shape_2e_enemy_plane0
-  shape_2f_enemy_plane1
-object_70_supply_plane
-  shape_18_supply_plane
-object_71_parachute
-  shape_14_parachute0
-  shape_15_parachute1
-  shape_16_parachute_open
-object_72_fuel_explosion
-  shape_17_fuel
-  shape_88_explosion0
-  shape_89_explosion1
-  shape_8a_explosion2
-  shape_8b_explosion3
-object_73_bullet
-  shape_08_bullet3
-  shape_09_bullet5
-  shape_0a_bullet7
-  shape_0b_bullet9
-object_74_bullet
-  shape_08_bullet3
-  shape_09_bullet5
-  shape_0a_bullet7
-  shape_0b_bullet9
-object_75_bullet
-  shape_08_bullet3
-  shape_09_bullet5
-  shape_0a_bullet7
-  shape_0b_bullet9
-object_76_pixel
-  shape_04_pixel4
-object_77_tank
-  shape_1c_tank
-  shape_1e_missile_tank
-  shape_1f_missile_tank_empty
-object_78_pixel
-  shape_04_pixel4
-object_79_pixel
-  shape_04_pixel4
-object_7a_pixel
-  shape_04_pixel4
-object_7b_pixel
-  shape_04_pixel4
-object_7c_pixel
-  shape_04_pixel4
-object_7d_pixel
-  shape_04_pixel4
-object_7e_pixel
-  shape_04_pixel4
-object_7f_pixel
-  shape_04_pixel4
diff --git a/disasm/object_compile.py b/disasm/object_compile.py
new file mode 100755 (executable)
index 0000000..3bf27dd
--- /dev/null
@@ -0,0 +1,146 @@
+#!/usr/bin/env python3
+
+import json
+import sys
+from intelhex import IntelHex
+
+EXIT_SUCCESS = 0
+EXIT_FAILURE = 1
+
+if len(sys.argv) < 6:
+  print(
+    f'usage: {sys.argv[0]:s} load_addr addrs.txt in.json out_index.inc out_data.inc'
+  )
+  sys.exit(EXIT_FAILURE)
+load_addr = int(sys.argv[1], 0)
+addrs_txt = sys.argv[2]
+in_json = sys.argv[3]
+out_index_inc = sys.argv[4]
+out_data_inc = sys.argv[5]
+
+print('reading addrs')
+object_tables = {}
+with open(addrs_txt) as fin:
+  def get_line():
+    while True:
+      line = fin.readline()
+      if len(line) == 0:
+        return []
+      i = line.find('#')
+      if i >= 0:
+        line = line[:i]
+      fields = line.strip().split(',')
+      if fields != ['']:
+        #print('fields', fields)
+        return fields
+
+  fields = get_line()
+  while len(fields):
+    assert len(fields) == 1
+    section = fields[0]
+    print(section)
+
+    if section == 'items':
+      fields = get_line()
+      while len(fields) >= 2:
+        assert len(fields) >= 4
+        addr = int(fields[0], 0)
+        name = fields[2]
+        _type = fields[3]
+        if (
+          (_type == 'byte' or _type == 'word') and
+            name[:6] == 'object' and
+            name[6:7] in '0123456789abcdef' and
+            name[7:8] in '0123456789abcdef' and
+            name[8:9] in '0123456789abcdef' and
+            name[9:10] in '0123456789abcdef' and
+            name[10:11] == '_'
+        ):
+          object_tables[name[11:]] = (
+            addr,
+              int(name[6:8], 16),
+              int(name[8:10], 16),
+              _type == 'word'
+          )
+        fields = get_line()
+      continue
+
+    # unknown section, skip
+    fields = get_line()
+    while len(fields) >= 2:
+      fields = get_line()
+
+byte_tables = {
+  'ucode_animate_shape',
+  'ucode_collision_test',
+  'ucode_homing',
+  'ucode_test_fire_in_state_f0',
+  'ucode_test_fire_in_state_f1',
+  'ucode_test_fire_in_state_f2',
+  'ucode_test_fire_in_state_f3',
+}
+object0 = min([i for _, i, _, _ in object_tables.values()])
+object1 = max([i for _, _, i, _ in object_tables.values()])
+
+print('reading json')
+with open(in_json) as fin:
+  data = json.load(fin)
+
+print('writing index')
+dot = load_addr
+with open(out_index_inc, 'w') as fout:
+  for table, (addr, index0, index1, word) in object_tables.items():
+    # only if we have some data for the table (otherwise it's udata)
+    if any([table in data[i - object0] for i in range(index0, index1)]):
+      if addr > dot:
+        i = addr - dot
+        fout.write(f'\t.ds\t0x{i:x}\n' if i >= 0x10 else f'\t.ds\t{i:d}\n')
+        dot = addr
+      fout.write(f'object{index0:02x}{index1:02x}_{table:s}: ; {addr:04x}\n')
+
+      if table[-4:] == '_ptr':
+        table1 = table[:-4]
+        table_data = []
+        for i in range(index0, index1):
+          value = '0'
+          if data[i - object0][table1] is not None:
+            name = data[i - object0]['name']
+            if name is None:
+              name = f'{i:02x}'
+            value = f'object{index0:02x}{index1:02x}_{table1:s}_{name:s}'
+          table_data.append(value)
+      else:
+        table_data = [
+          data[i - object0][table]
+          for i in range(index0, index1)
+        ]
+
+      op = '.dw' if word else '.db'
+      fout.write(''.join([f'\t{op:s}\t{i:s}\n' for i in table_data]))
+
+      dot += (index1 - index0) * 2 if word else index1 - index0
+print('writing data')
+
+# generate output
+out = []
+for table, (addr, index0, index1, word) in object_tables.items():
+  if table[-4:] == '_ptr':
+    table1 = table[:-4]
+    for i in range(index0, index1):
+      value = data[i - object0][table1]
+      if value is not None:
+        name = data[i - object0]['name']
+        if name is None:
+          name = f'{i:02x}'
+        addr = int(data[i - object0][table], 0)
+        text = f'object{index0:02x}{index1:02x}_{table1:s}_{name:s}: ; {addr:04x}\n'
+
+        op = '.db' if table1 in byte_tables else '.dw'
+        text += ''.join([f'\t{op:s}\t{i:s}\n' for i in value]) + '\t.db\t0\n'
+
+        out.append((addr, i, text))
+
+# write output in order of address in original executable
+with open(out_data_inc, 'w') as fout:
+  for _, _, text in sorted(out):
+    fout.write(text)
diff --git a/disasm/object_extract.py b/disasm/object_extract.py
new file mode 100755 (executable)
index 0000000..f784504
--- /dev/null
@@ -0,0 +1,143 @@
+#!/usr/bin/env python3
+
+import bisect
+import json
+import sys
+from intelhex import IntelHex
+
+EXIT_SUCCESS = 0
+EXIT_FAILURE = 1
+
+if len(sys.argv) < 4:
+  print(f'usage: {sys.argv[0]:s} addrs.txt in.ihx out.json')
+  sys.exit(EXIT_FAILURE)
+addrs_txt = sys.argv[1]
+in_ihx = sys.argv[2]
+out_json = sys.argv[3]
+
+print('reading addrs')
+object_tables = {}
+objects = {}
+with open(addrs_txt) as fin:
+  def get_line():
+    while True:
+      line = fin.readline()
+      if len(line) == 0:
+        return []
+      i = line.find('#')
+      if i >= 0:
+        line = line[:i]
+      fields = line.strip().split(',')
+      if fields != ['']:
+        #print('fields', fields)
+        return fields
+
+  fields = get_line()
+  while len(fields):
+    assert len(fields) == 1
+    section = fields[0]
+    print(section)
+
+    if section == 'items':
+      fields = get_line()
+      while len(fields) >= 2:
+        assert len(fields) >= 4
+        addr = int(fields[0], 0)
+        name = fields[2]
+        _type = fields[3]
+        if (
+          (_type == 'byte' or _type == 'word') and
+            name[:6] == 'object' and
+            name[6:7] in '0123456789abcdef' and
+            name[7:8] in '0123456789abcdef' and
+            name[8:9] in '0123456789abcdef' and
+            name[9:10] in '0123456789abcdef' and
+            name[10:11] == '_'
+        ):
+          object_tables[name[11:]] = (
+            addr,
+              int(name[6:8], 16),
+              int(name[8:10], 16),
+              _type == 'word'
+          )
+        fields = get_line()
+      continue
+
+    if section == 'objects':
+      fields = get_line()
+      while len(fields) >= 2:
+        assert len(fields) == 2
+        index = int(fields[0], 0)
+        name = fields[1]
+        objects[index] = name
+        fields = get_line()
+      continue
+
+    # unknown section, skip
+    fields = get_line()
+    while len(fields) >= 2:
+      fields = get_line()
+
+byte_tables = {
+  'ucode_animate_shape',
+  'ucode_collision_test',
+  'ucode_homing',
+  'ucode_test_fire_in_state_f0',
+  'ucode_test_fire_in_state_f1',
+  'ucode_test_fire_in_state_f2',
+  'ucode_test_fire_in_state_f3',
+}
+object0 = min([i for _, i, _, _ in object_tables.values()])
+object1 = max([i for _, _, i, _ in object_tables.values()])
+
+print('reading ihx')
+intelhex = IntelHex(in_ihx)
+segments = [j for i in intelhex.segments() for j in i]
+for i in range(0, len(segments), 2):
+  print(f'[{segments[i]:04x}, {segments[i + 1]:04x})')
+
+print('extracting')
+data = [
+  {'name': f'{i:02x}_{objects[i]}' if i in objects else None}
+  for i in range(object0, object1)
+]
+
+for table, (addr, index0, index1, word) in object_tables.items():
+  i = bisect.bisect_right(segments, addr) - 1
+  if (i & 1) == 0: # if initialized in ihx file
+    #for i in range(object0, object1):
+    #  data[i - object0][table] = None
+    if word:
+      addr -= index0 * 2
+      for i in range(index0, index1):
+        value = intelhex[addr + 2 * i] | (intelhex[addr + 2 * i + 1] << 8)
+        data[i - object0][table] = f'0x{value:04x}'
+    else:
+      addr -= index0
+      for i in range(index0, index1):
+        value = intelhex[addr + i]
+        data[i - object0][table] = str(value)
+
+  # extract pointed-to data if applicable
+  if table[-4:] == '_ptr':
+    table1 = table[:-4]
+    for i in range(index0, index1):
+      addr1 = int(data[i - object0][table], 0)
+      value = None
+      if addr1:
+        value = []
+        if table1 in byte_tables:
+          while intelhex[addr1]:
+            value1 = intelhex[addr1]
+            value.append(f'0x{value1:02x}')
+            addr1 += 1
+        else:
+          while intelhex[addr1]:
+            value1 = intelhex[addr1] | (intelhex[addr1 + 1] << 8)
+            value.append(f'0x{value1:04x}')
+            addr1 += 2
+      data[i - object0][table1] = value
+
+print('writing json')
+with open(out_json, 'w') as fout:
+  json.dump(data, fout, indent = 2)
index 44a0262..c88b7b7 100755 (executable)
@@ -17,7 +17,7 @@ out_data_inc = sys.argv[4]
 
 print('reading addrs')
 shape_tables = {}
-with open(addrs_txt, 'r') as fin:
+with open(addrs_txt) as fin:
   def get_line():
     while True:
       line = fin.readline()
@@ -59,10 +59,9 @@ with open(in_json) as fin:
   data = json.load(fin)
 
 print('writing index')
-
 with open(out_index_inc, 'w') as fout:
   for table, addr in shape_tables.items():
-    fout.write(f'shape_{table:s}:\n')
+    fout.write(f'shape_{table:s}: ; {addr:04x}\n')
 
     prefix = ''
     if table[-3:] == '_lo':
@@ -92,33 +91,41 @@ with open(out_index_inc, 'w') as fout:
 
 print('writing data')
 
-# preserve ordering from the original executable, based on data_ptr
-order = sorted(
-  [
-    (int(data[i]['data_ptr'], 0), i)
-    for i in range(0x100)
-    if data[i]['name'] is not None
-  ]
-)
-
-with open(out_data_inc, 'w') as fout:
-  for i in range(len(order)):
-    addr, index = order[i]
-    name = data[index]['name']
-    fout.write(f'shape_{name:s}:\n')
-
-    # check for reuse of same shape data in original executable
-    # if so, don't bother outputting the shape data, use next one
-    if i + 1 < len(order):
-      addr1, index1 = order[i + 1]
-      if addr1 == addr and data[index1]['data'] == data[index]['data']:
-        continue
-
-    fout.write(
-      ''.join(
+# create an index of what is where
+# used for merging duplicate shape data
+addrs = {}
+for i in range(0x100):
+  name = data[i]['name']
+  if name is not None:
+    addr = int(data[i]['data_ptr'], 0)
+    if addr not in addrs:
+      addrs[addr] = []
+    addrs[addr].append(i)
+
+# generate output
+out = []
+for i in range(0x100):
+  name = data[i]['name']
+  if name is not None:
+    value = data[i]['data']
+    addr = int(data[i]['data_ptr'], 0)
+    size_bytes = int(data[i]['size_bytes'], 0)
+    text = f'shape_{name:s}: ; {max(addr - 3 * size_bytes, 0):04x}\n'
+
+    # only output data if different from next entry at same address
+    same_addr = addrs[addr]
+    j = same_addr.index(i) + 1
+    if j >= len(same_addr) or data[same_addr[j]]['data'] != value:
+      text += ''.join(
         [
-          ''.join(['\t.db\t{0:s}\n'.format(', '.join(j)) for j in i]) + '\n'
-          for i in data[index]['data']
+          ''.join(['\t.db\t{0:s}\n'.format(', '.join(k)) for k in j]) + '\n'
+          for j in value
         ]
       )
-    )
+
+    out.append((addr, i, text))
+
+# write output in order of address in original executable
+with open(out_data_inc, 'w') as fout:
+  for _, _, text in sorted(out):
+    fout.write(text)
index 543cd12..bd84aee 100755 (executable)
@@ -22,7 +22,7 @@ print('reading addrs')
 shape_tables = {}
 pixel_tables = {}
 shapes = {}
-with open(addrs_txt, 'r') as fin:
+with open(addrs_txt) as fin:
   def get_line():
     while True:
       line = fin.readline()
index b71aa50..3b45c9a 100644 (file)
@@ -1,11 +1,11 @@
---- star_blazer.asm0   2022-06-25 14:50:24.743820370 +1000
-+++ star_blazer.asm    2022-06-25 15:16:37.251800919 +1000
+--- star_blazer.asm0   2022-06-25 20:38:17.371562181 +1000
++++ star_blazer.asm    2022-06-25 20:41:40.595559667 +1000
 @@ -1,3 +1,9 @@
 +UNREACHABLE = 1
 +DHGR = 0
 +PIXEL_SHAPE = 0
 +SHAPE = 1
-+UCODE = 0
++OBJECT = 1
 +
  HIRES_SCREEN = 0x2000                 ; 2000
  HW_KBD = 0xc000                               ; c000
  draw_misc_table:
        .db     0x01                    ; 4600 r
        .db     0x07                    ; 4601 r
-@@ -9271,6 +9746,15 @@
+@@ -5139,6 +5614,164 @@
+       .db     0x00                    ; 47fe r
+       .db     0x00                    ; 47ff r
  
++.if OBJECT
++; move these to here where they'll overlay data3 and fill in gaps
++score_var_4800:
++      .db     0x03                    ; 4800 r
++score_table_4801:
++      .db     0x6c                    ; 4801 r
++      .db     0x6c                    ; 4802 r
++      .db     0x6c                    ; 4803 r
++      .db     0x6c                    ; 4804 r
++      .db     0x6c                    ; 4805 r
++      .db     0x6c                    ; 4806 r
++      .db     0x6c                    ; 4807 r
++      .db     0x6c                    ; 4808 r
++      .db     0x6c                    ; 4809 r
++      .db     0x6c                    ; 480a r
++      .db     0x6c                    ; 480b r
++      .db     0x6c                    ; 480c r
++      .db     0x6c                    ; 480d r
++      .db     0x6c                    ; 480e r
++      .db     0x6c                    ; 480f r
++      .ds     0x70
++score_var_4880:
++      .db     0x00                    ; 4880 r
++score_table_4881:
++      .db     0x94                    ; 4881 r
++      .db     0x94                    ; 4882 r
++      .db     0x94                    ; 4883 r
++      .db     0x94                    ; 4884 r
++      .db     0x94                    ; 4885 r
++      .db     0x94                    ; 4886 r
++      .db     0x94                    ; 4887 r
++      .db     0x94                    ; 4888 r
++      .db     0x94                    ; 4889 r
++      .db     0x94                    ; 488a r
++      .db     0x94                    ; 488b r
++      .db     0x94                    ; 488c r
++      .db     0x94                    ; 488d r
++      .db     0x94                    ; 488e r
++      .db     0x94                    ; 488f r
++      .ds     0x70
++score_var_4900:
++      .db     0x00                    ; 4900 r
++score_table_4901:
++      .db     0x28                    ; 4901 r
++      .db     0x28                    ; 4902 r
++      .db     0x28                    ; 4903 r
++      .db     0x28                    ; 4904 r
++      .db     0x28                    ; 4905 r
++      .db     0x28                    ; 4906 r
++      .db     0x28                    ; 4907 r
++      .db     0x28                    ; 4908 r
++      .db     0x28                    ; 4909 r
++      .db     0x28                    ; 490a r
++      .db     0x28                    ; 490b r
++      .db     0x28                    ; 490c r
++      .db     0x28                    ; 490d r
++      .db     0x28                    ; 490e r
++      .db     0x28                    ; 490f r
++      .ds     0x70
++score_var_4980:
++      .db     0x30                    ; 4980 r
++score_table_4981:
++      .db     0xd0                    ; 4981 r
++      .db     0xd0                    ; 4982 r
++      .db     0xd0                    ; 4983 r
++      .db     0xd0                    ; 4984 r
++      .db     0xd0                    ; 4985 r
++      .db     0xd0                    ; 4986 r
++      .db     0xd0                    ; 4987 r
++      .db     0xd0                    ; 4988 r
++      .db     0xd0                    ; 4989 r
++      .db     0xd0                    ; 498a r
++      .db     0xd0                    ; 498b r
++      .db     0xd0                    ; 498c r
++      .db     0xd0                    ; 498d r
++      .db     0xd0                    ; 498e r
++      .db     0xd0                    ; 498f r
++      .ds     0x70
++score_var_4a00:
++      .db     0x00                    ; 4a00 r
++score_table_4a01:
++      .db     0x20                    ; 4a01 r
++      .db     0x20                    ; 4a02 r
++      .db     0x20                    ; 4a03 r
++      .db     0x20                    ; 4a04 r
++      .db     0x20                    ; 4a05 r
++      .db     0x20                    ; 4a06 r
++      .db     0x20                    ; 4a07 r
++      .db     0x20                    ; 4a08 r
++      .db     0x20                    ; 4a09 r
++      .db     0x20                    ; 4a0a r
++      .db     0x20                    ; 4a0b r
++      .db     0x20                    ; 4a0c r
++      .db     0x20                    ; 4a0d r
++      .db     0x20                    ; 4a0e r
++      .db     0x20                    ; 4a0f r
++      .ds     0x70
++score_var_4a80:
++      .db     0x04                    ; 4a80 r
++score_table_4a81:
++      .db     0x0f                    ; 4a81 r
++      .db     0x0f                    ; 4a82 r
++      .db     0x0f                    ; 4a83 r
++      .db     0x0f                    ; 4a84 r
++      .db     0x0f                    ; 4a85 r
++      .db     0x0f                    ; 4a86 r
++      .db     0x0f                    ; 4a87 r
++      .db     0x0f                    ; 4a88 r
++      .db     0x0f                    ; 4a89 r
++      .db     0x0f                    ; 4a8a r
++      .db     0x0f                    ; 4a8b r
++      .db     0x0f                    ; 4a8c r
++      .db     0x0f                    ; 4a8d r
++      .db     0x0f                    ; 4a8e r
++      .db     0x0f                    ; 4a8f r
++      .ds     0x70
++score_var_4b00:
++      .db     0x00                    ; 4b00 r
++score_table_4b01:
++      .db     0x99                    ; 4b01 r
++      .db     0x99                    ; 4b02 r
++      .db     0x99                    ; 4b03 r
++      .db     0x99                    ; 4b04 r
++      .db     0x99                    ; 4b05 r
++      .db     0x99                    ; 4b06 r
++      .db     0x99                    ; 4b07 r
++      .db     0x99                    ; 4b08 r
++      .db     0x99                    ; 4b09 r
++      .db     0x99                    ; 4b0a r
++      .db     0x99                    ; 4b0b r
++      .db     0x99                    ; 4b0c r
++      .db     0x99                    ; 4b0d r
++      .db     0x99                    ; 4b0e r
++      .db     0x99                    ; 4b0f r
++      .ds     0x70
++score_var_4b80:
++      .db     0x62                    ; 4b80 r
++score_table_4b81:
++      .db     0x99                    ; 4b81 r
++      .db     0x99                    ; 4b82 r
++      .db     0x99                    ; 4b83 r
++      .db     0x99                    ; 4b84 r
++      .db     0x99                    ; 4b85 r
++      .db     0x99                    ; 4b86 r
++      .db     0x99                    ; 4b87 r
++      .db     0x99                    ; 4b88 r
++      .db     0x99                    ; 4b89 r
++      .db     0x99                    ; 4b8a r
++      .db     0x99                    ; 4b8b r
++      .db     0x99                    ; 4b8c r
++      .db     0x99                    ; 4b8d r
++      .db     0x99                    ; 4b8e r
++      .db     0x99                    ; 4b8f r
++
++      .area   data3
++
++.include "object_index.inc"
++.else
        .area   data3
  
+ score_var_4800:
+@@ -9271,9 +9904,19 @@
+       .dw     0x0000                  ; 5bba r
+       .dw     bvar_9d1d               ; 5bbc r
+       .dw     0x0000                  ; 5bbe r
++.endif
+       .area   data4
 +.if DHGR
 +.include "../shape/dhgr_pixel_shape_data_main.inc"
 +.else
        .db     0x5c                    ; 5c00
        .db     0x02                    ; 5c01
        .db     0x00                    ; 5c02
-@@ -21696,9 +22180,15 @@
+@@ -21699,9 +22342,15 @@
        .db     0xe0                    ; 8c05
        .db     0x83                    ; 8c06
        .db     0x9e                    ; 8c07
 +.endif
 +.endif
  
-       .area   data4
+       .area   data5
  
-+.if UCODE
-+.include "ucode_data.inc"
++.if OBJECT
++.include "object_data.inc"
 +.else
  bvar_8e00:
        .db     0x30                    ; 8e00 r
        .db     0x0f                    ; 8e01
-@@ -26269,6 +26759,13 @@
+@@ -26272,6 +26921,13 @@
        .db     0x7c                    ; 9dea
        .db     0x98                    ; 9deb
        .db     0x00                    ; 9dec
 +.endif
 +
 +.if DHGR
-+      .area   data5
++      .area   data6
 +
 +.include "../shape/dhgr_pixel_shape_data_aux.inc"
 +.endif
index 963cf4c..d2d0064 100644 (file)
@@ -6,9 +6,10 @@ areas
 0x1800,0x05c6,text1,init
 0x1e00,0x0139,text2,init
 0x1f80,0x0080,data1,init
-0x4000,0x1bc0,data2,init
-0x5c00,0x3008,data3,init
-0x8e00,0x0fed,data4,init
+0x4000,0x0800,data2,init
+0x4800,0x13c0,data3,init
+0x5c00,0x3008,data4,init
+0x8e00,0x0fed,data5,init
 0xa800,0x0d80,udata1,uninit
 
 items
@@ -63,10 +64,10 @@ items
 0x00c9,0x0001,ucode_x_save_c9,byte
 0x00ca,0x0001,ucode_y_save_ca,byte
 # seems to preserve a value from one of:
-#   object6080_b500 (execute_ucode6080_fire_state_f0)
-#   object6080_b520 (execute_ucode6080_fire_state_f1)
-#   object6080_b540 (execute_ucode6080_fire_state_f2)
-#   object6080_b560 (execute_ucode6080_fire_state_f3)
+#   object6080_b500 (execute_object6080_ucode_fire_in_state_f0)
+#   object6080_b520 (execute_object6080_ucode_fire_in_state_f1)
+#   object6080_b540 (execute_object6080_ucode_fire_in_state_f2)
+#   object6080_b560 (execute_object6080_ucode_fire_in_state_f3)
 # and also used as an index into ucode in ucode_execute_10d1
 0x00cb,0x0001,ucode_state_save,byte
 # may contain a value from object1080_ucode_start_sentinel (basically
@@ -141,7 +142,7 @@ items
 0x0d38,0x0001,maybe_copy_one_of_arr_52a0_52e0_5320_5360_to_arr_b480,code
 0x0d5e,0x0001,calculate_object_direction,code
 0x0d6c,0x0001,calculate_object_shape,code
-# example: ucode1080_animate_shape_4d_headquarters_radar_icbm
+# example: object1080_ucode_animate_shape_4d_headquarters_radar_icbm
 #              -> implied start of section 0xf0
 #      .db     0x72 headquarters shape
 #      .db     0xf2 -> start of section 0xf2
@@ -317,48 +318,48 @@ items
 0x11b2,0x0001,make_object_inactive_and_erase,code
 # called from update_object, when:
 #   object1080_countdown_b120 or object1080_countdown_b190 expires
-0x11bd,0x0001,execute_ucode1080_countdown,code
+0x11bd,0x0001,execute_object1080_ucode_countdown,code
 # called from update_object, when:
 #   test_object_collision returns cf=1
-0x11cd,0x0001,execute_ucode1080_collision,code
+0x11cd,0x0001,execute_object1080_ucode_collision,code
 # called from update_object for objects >= 40, when:
 #   object1080_x_hi outside [object4080_x_hi_min, object4080_x_hi_max)
-0x11dd,0x0001,execute_ucode4080_x_outside,code
+0x11dd,0x0001,execute_object4080_ucode_x_outside,code
 # called from update_object for objects >= 40, when:
 #   object1080_y_hi outside [object4080_y_hi_min, object4080_y_hi_max)
-0x11ed,0x0001,execute_ucode4080_y_outside,code
+0x11ed,0x0001,execute_object4080_ucode_y_outside,code
 # called from update_object for objects >= 60, when:
 #   object1080_start_sentinel == 0xf0
-#   and then test_object_fire_state_f0 returns cf=1
-0x11fd,0x0001,execute_ucode6080_fire_state_f0,code
+#   and then test_object_fire_in_state_f0 returns cf=1
+0x11fd,0x0001,execute_object6080_ucode_fire_in_state_f0,code
 # called from update_object for objects >= 60, when:
 #   object1080_start_sentinel == 0xf1
-#   and then test_object_fire_state_f1 returns cf=1
-0x1222,0x0001,execute_ucode6080_fire_state_f1,code
+#   and then test_object_fire_in_state_f1 returns cf=1
+0x1222,0x0001,execute_object6080_ucode_fire_in_state_f1,code
 # called from update_object for objects >= 60, when:
 #   object1080_start_sentinel == 0xf2
-#   and then test_object_fire_state_f2 returns cf=1
-0x1247,0x0001,execute_ucode6080_fire_state_f2,code
+#   and then test_object_fire_in_state_f2 returns cf=1
+0x1247,0x0001,execute_object6080_ucode_fire_in_state_f2,code
 # called from update_object for objects >= 60, when:
 #   object1080_start_sentinel == 0xf3
-#   and then test_object_fire_state_f3 returns cf=1
-0x126c,0x0001,execute_ucode6080_fire_state_f3,code
+#   and then test_object_fire_in_state_f3 returns cf=1
+0x126c,0x0001,execute_object6080_ucode_fire_in_state_f3,code
 # called from accelerate_object_towards_another
 # seems to have a chance to intervene in the homing logic
-0x1291,0x0001,execute_ucode6080_homing,code
+0x1291,0x0001,execute_object6080_ucode_homing,code
 0x12e1,0x0001,accelerate_object_towards_another,code
 0x133f,0x0001,sign_extend_a_to_ya_asl_by_4,code
 0x1350,0x0001,accelerate_object_somehow,code
 0x1388,0x0001,move_object_by_velocity,code
 0x13d0,0x0001,test_object_collision,code
 0x1447,0x0001,accelerate_object_anyhow,code
-0x14ef,0x0001,test_object_fire_state_f0,code
-0x150f,0x0001,test_object_fire_state_f1,code
+0x14ef,0x0001,test_object_fire_in_state_f0,code
+0x150f,0x0001,test_object_fire_in_state_f1,code
 0x152c,0x0001,test_object_fire_entry,code
 0x153f,0x0001,test_object_fire_false,code
 0x1542,0x0001,test_object_fire_player,code
-0x1549,0x0001,test_object_fire_state_f2,code
-0x1569,0x0001,test_object_fire_state_f3,code
+0x1549,0x0001,test_object_fire_in_state_f2,code
+0x1569,0x0001,test_object_fire_in_state_f3,code
 0x1589,0x0001,objects_init,code
 0x1595,0x0001,objects_init_entry,code
 0x15d7,0x0001,maybe_calculate_object_shape_and_update,code
@@ -442,10 +443,10 @@ items
 0x4990,0x0070,object1080_animate1,byte
 0x4a00,0x0001,score_var_4a00,byte
 0x4a01,0x000f,score_table_4a01,byte
-# 4a10 not referenced, spare?
+# 0x4a10 spare
 0x4a80,0x0001,score_var_4a80,byte
 0x4a81,0x000f,score_table_4a81,byte
-# 4a90 not referenced, spare?
+# 0x4a90 spare
 0x4b00,0x0001,score_var_4b00,byte
 0x4b01,0x000f,score_table_4b01,byte
 0x4b10,0x0070,object1080_4b10,byte
@@ -456,9 +457,9 @@ items
 0x4c70,0x0070,object1080_velocity_x_random_range,byte
 0x4ce0,0x0070,object1080_velocity_y_random_base,byte
 0x4d50,0x0070,object1080_velocity_y_random_range,byte
-# gap, spares?
+# 0x4dc0 spare
 0x4ed0,0x0030,object4070_4ed0,byte # might be bigger
-# 4f00 not referenced, spare?
+# 0x4f00 spare
 0x4f40,0x0040,object4080_4f40,byte
 0x4f80,0x0040,object4080_x_random_base,byte
 0x4fc0,0x0040,object4080_x_random_range,byte
@@ -474,40 +475,40 @@ items
 0x5270,0x0030,object5080_difference_5270,byte
 0x52a0,0x0030,object5080_difference_52a0,byte
 0x52d0,0x0030,object5080_difference_52d0,byte
-0x5300,0x0020,object6080_fire_count_init_state_f0,byte
-# used from execute_ucode6080_fire_state_f0
+0x5300,0x0020,object6080_fire_count_init_in_state_f0,byte
+# used from execute_object6080_ucode_fire_in_state_f0
 0x5320,0x0020,object6080_5320,byte
-0x5340,0x0020,object6080_fire_count_init_state_f1,byte
-# used from execute_ucode6080_fire_state_f1
+0x5340,0x0020,object6080_fire_count_init_in_state_f1,byte
+# used from execute_object6080_ucode_fire_in_state_f1
 0x5360,0x0020,object6080_5360,byte
-0x5380,0x0020,object6080_fire_count_init_state_f2,byte
-# used from execute_ucode6080_fire_state_f2
+0x5380,0x0020,object6080_fire_count_init_in_state_f2,byte
+# used from execute_object6080_ucode_fire_in_state_f2
 0x53a0,0x0020,object6080_53a0,byte
-0x53c0,0x0020,object6080_fire_count_init_state_f3,byte
-# used from execute_ucode6080_fire_state_f2
+0x53c0,0x0020,object6080_fire_count_init_in_state_f3,byte
+# used from execute_object6080_ucode_fire_in_state_f2
 0x53e0,0x0020,object6080_53e0,byte
 # the partitioning below is approximate and just tries to cover everything
 0x5400,0x0020,,word
-0x5420,0x00e0,ucode1080_animate_shape,word
-0x5500,0x0020,ucode0010_init_or_zero,word
-0x5520,0x00e0,ucode1080_countdown,word
+0x5420,0x00e0,object1080_ucode_animate_shape_ptr,word
+0x5500,0x0020,object0010_ucode_init_or_zero_ptr,word
+0x5520,0x00e0,object1080_ucode_countdown_ptr,word
 0x5600,0x0020,,word
-0x5620,0x00e0,ucode1080_collision_test,word
+0x5620,0x00e0,object1080_ucode_collision_test_ptr,word
 0x5700,0x0020,,word
-0x5720,0x00e0,ucode1080_collision,word
-0x5800,0x0080,ucode4080_x_outside,word
-0x5880,0x0080,ucode4080_y_outside,word
+0x5720,0x00e0,object1080_ucode_collision_ptr,word
+0x5800,0x0080,object4080_ucode_x_outside_ptr,word
+0x5880,0x0080,object4080_ucode_y_outside_ptr,word
 0x5900,0x0020,,word
-0x5920,0x0030,ucode6080_homing,word
+0x5920,0x0030,object6080_ucode_homing_ptr,word
 0x5950,0x0070,,word
-0x59c0,0x0040,ucode6080_test_fire_state_f0,word
-0x5a00,0x0040,ucode6080_fire_state_f0,word
-0x5a40,0x0040,ucode6080_test_fire_state_f1,word
-0x5a80,0x0040,ucode6080_fire_state_f1,word
-0x5ac0,0x0040,ucode6080_test_fire_state_f2,word
-0x5b00,0x0040,ucode6080_fire_state_f2,word
-0x5b40,0x0040,ucode6080_test_fire_state_f3,word
-0x5b80,0x0040,ucode6080_fire_state_f3,word
+0x59c0,0x0040,object6080_ucode_test_fire_in_state_f0_ptr,word
+0x5a00,0x0040,object6080_ucode_fire_in_state_f0_ptr,word
+0x5a40,0x0040,object6080_ucode_test_fire_in_state_f1_ptr,word
+0x5a80,0x0040,object6080_ucode_fire_in_state_f1_ptr,word
+0x5ac0,0x0040,object6080_ucode_test_fire_in_state_f2_ptr,word
+0x5b00,0x0040,object6080_ucode_fire_in_state_f2_ptr,word
+0x5b40,0x0040,object6080_ucode_test_fire_in_state_f3_ptr,word
+0x5b80,0x0040,object6080_ucode_fire_in_state_f3_ptr,word
 # 0x5bc0 padding
 # 0x5c00 shape data
 # 0x8c08 padding
@@ -551,13 +552,13 @@ items
 0xb480,0x0030,object5080_abs_difference_b480,byte
 0xb4b0,0x0030,object5080_abs_difference_b4b0,byte
 0xb4e0,0x0020,object6080_fire_count,byte
-# used from execute_ucode6080_fire_state_f0
+# used from execute_object6080_ucode_fire_in_state_f0
 0xb500,0x0020,object6080_b500,byte
-# used from execute_ucode6080_fire_state_f1
+# used from execute_object6080_ucode_fire_in_state_f1
 0xb520,0x0020,object6080_b520,byte
-# used from execute_ucode6080_fire_state_f2
+# used from execute_object6080_ucode_fire_in_state_f2
 0xb540,0x0020,object6080_b540,byte
-# used from execute_ucode6080_fire_state_f3
+# used from execute_object6080_ucode_fire_in_state_f3
 0xb560,0x0020,object6080_b560,byte
 0xc000,0x0001,HW_KBD,byte
 0xc010,0x0001,HW_KBDSTRB,byte
@@ -595,7 +596,7 @@ shapes
 0x13,exhaust
 0x14,parachute
 0x15,parachute
-0x16,parachute_open
+0x16,parachute
 0x17,fuel
 0x18,supply_plane
 0x1c,tank
index b6fdefd..6b7d274 100644 (file)
@@ -28,5 +28,9 @@
 [0x1800, 0x1dc6)
 [0x1e00, 0x1f39)
 [0x1f80, 0x2000)
-[0x4000, 0x8c08)
+[0x4000, 0x4a10)
+[0x4a80, 0x4a90)
+[0x4b00, 0x4dc0)
+[0x4ed0, 0x4f00)
+[0x4f40, 0x8c08)
 [0x8e00, 0x9ded)