[Unix-jun72] status on disassembler

Brad Parker brad at heeltoe.com
Thu May 22 00:05:51 AEST 2008


Here's an example from 'ls'.  It's not ment to be good dis-assembly,
just a rough approximation, but it shows references and how the short
spans get used to assign labels.

ps: I'm not trying to write a disassembler.  This is from a binary code
recompilation hobby project.  It just happened that there was enough
info already in the code to figure out where the labels might go.

I'm happy to share the code if this would be helpful.

-brad

...
004374: span 4346 - 4376
004416: span 4410 - 4532
004436: span 4436 - 4446
004454: span 4434 - 4454
004456: span 4456 - 4476
...
local 4374; 1 (4346-4376)
assign1 4376; 1
assign1 4410; 0
assign1 4424; 0
assign1 4434; 0
local 4436; 1 (4436-4446)
assign1 4446; 2
assign1 4452; 1
local 4454; 1 (4434-4454)
local 4456; 0 (4456-4476)
assign1 4476; 1
...
004374: L1
 2 004376
 2 004346
004376: 
 1 004374
004410: 
 1 004416
004416: L2318
 2 004532
 2 004524
 2 004452
 2 004410
004424: 
 1 004602
004434: 
 1 004454
004436: L2
 2 004446
004446: 
 1 004436
004452: 
 1 004416
004454: L1
 2 004434
004456: L1
 2 004476
004476: 
 1 004456
...

 12    004370 000000 HALT R5
 12    004372 000207 RTS R5
1:
 12 -> 004374 112423 MOVB R4 R3
 13    004376 001376 BNE R3 ; (ref 4374, 1b)
 13    004400 005303 DEC R3
 13    004402 126327 CPMB R3 R7
              177777
       004406 000057 ?
 14    004410 001402 BEQ R7 ; (ref 4416, L2318)
 14    004412 112723 MOVB R7 R3
              000057
L2318:
 14 -> 004416 004567 JSR R7
              002722
 14    004422 044052 BIC R0 R2
 15    004424 103466 BLO R2 ; (ref 4602, L2434)
 15    004426 012746 MOV R7 R6
              000004
 15    004432 005700 TST R0
 16    004434 001007 BNE R0 ; (ref 4454, 1f)
2:
 16 -> 004436 004567 JSR R7
              002702
 16    004442 044052 BIC R0 R2
 16    004444 005316 DEC R6
 17    004446 001373 BNE R6 ; (ref 4436, 2b)
 17    004450 005726 TST R6
 18    004452 000761 BR R6 ; (ref 4416, L2318)
1:
 17 -> 004454 010302 MOV R3 R2
1:
 17 -> 004456 004567 JSR R7
              002662
 17    004462 044052 BIC R0 R2
 17    004464 010021 MOV R0 R1
 17    004466 110022 MOVB R0 R2
 17    004470 000300 SWAB R0
 17    004472 110022 MOVB R0 R2
 17    004474 005316 DEC R6
 18    004476 001367 BNE R6 ; (ref 4456, 1b)
 18    004500 005726 TST R6
 18    004502 105022 CLRB R2
 18    004504 005767 TST R7
              003232



More information about the TUHS mailing list