vak: (Default)
[personal profile] vak posting in [community profile] besm6
Сделал утилитку dis, которая показывает содержимое объектного файла БЭСМ-6. Фактически отдалённый аналог objdump.

И еще скрипт madlen-to-obj.py: транслирует ассемблер Madlen в объектный файл. К примеру, компилируем следующий файл:
 objfmt:    ,name,
 extvar:    ,lc  , 1    . Common block
 loc:       ,lp  , 2    . Private block, short name
 loclong:   ,lp  , 3    . Private block, long name
 extfunc:   ,subp,
            ,wtc , myvar
            ,utc , myconst
            ,wtc , myvar+1
            ,utc , myconst+1
            ,utc , 77754b
          13,vjm , extfunc
          13,vjm , extfunc+1
          1 ,vzm , mycode
            ,uj  , mycode+1
 mycode:    ,xta , myvar
            ,atx , extvar
            ,atx , extvar+5
            ,arx , myconst
            ,a+x , mycode
            ,aox , extfunc
            ,aax , extfunc+1
            ,a*x , 4567b
            ,amx , loc
            ,avx , loclong
 myconst:   ,log , 1234 5670 2222 5555
 myvar:     ,bss , 1
            ,data,
 mydata:    ,log , 1771 2662 3553 4444
          1 ,set , mydata   . Рассылка данных
          1 ,    , myvar
            ,end ,
Получаем объектный файл, смотрим посредством dis:
$ besm6-dis example.obj 
example.obj: file format besm6

     Code size: 10 words
    Const size: 1 words
     Data size: 1 words
      Set size: 1 words
   Symhdr size: 1 words
   Symtab size: 11 words
  Longsym size: 3 words
    Debug size: 0 words
      BSS size: 1 words

Disassembly of code:

OBJFMT:
    c0:  00 23 40013  wtc d13
         00 22 40012  utc d12
    c1:  00 23 40014  wtc d14
         00 22 40013  utc d13
    c2:  00 22 74005  utc 77754
         15 31 74004  vjm EXTFUNC(13)
    c3:  15 31 74006  vjm EXTFUNC+1(13)
         00 22 00000  utc 
    c4:  01 34 40005  vzm c5(1)
         00 30 40006  uj c6
    c5:  00 010 4007  xta d13
         00 000 4001  atx EXTVAR
    c6:  00 000 4010  atx EXTVAR+5
         00 013 4011  arx d12
    c7:  00 004 4012  a+x c5
         00 015 4004  aox EXTFUNC
   c10:  00 011 4006  aax EXTFUNC+1
         00 017 4013  a*x 4567
   c11:  00 007 4002  amx LOC
         00 014 4003  avx LOCLONG

Initialized data:

   d12:  1234 5670 2222 5555  )..I+m  *ПNX22MM

Uninitialized data:

   d13:  1 word

Transient data:

   t13:  1771 2662 3553 4444  ?..v.$  /Y6R-KDD

SET directives:

   t14:  0001 4007 0001 4007  1 word from t13 to d13

Symbol table:

  4001:  0000 4016 6700 0001  EXTVAR (Common 1 word)
  4002:  5457 4300 4600 0002  LOC (Private 2 words)
  4003:  0000 4014 6600 0003  LOCLONG (Private 3 words)
  4004:  0000 4015 6300 0000  EXTFUNC
  4005:  0000 0000 4007 7754  77754
  4006:  0000 4004 0000 0001  EXTFUNC + 1
  4007:  0000 0000 4100 0013  d13
  4010:  0000 4001 0000 0005  EXTVAR + 5
  4011:  0000 0000 4100 0012  d12
  4012:  0000 0000 4100 0005  c5
  4013:  0000 0000 4000 4567  4567

Long names:

  4014:  5457 4354 5756 4700  LOCLONG
  4015:  4570 6446 6556 4300  EXTFUNC
  4016:  4570 6466 4162 0000  EXTVAR
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

Сообщество любителей БЭСМ-6

December 2025

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930 31   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 15th, 2026 09:56 pm
Powered by Dreamwidth Studios