home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / progrmng / xm.lzh / XDAS.ASM < prev    next >
Assembly Source File  |  1990-10-08  |  6KB  |  330 lines

  1.         .386
  2.     public    Code0, getcode
  3. _DATA        segment    para public USE16 'DATA'
  4. instruct    macro    n,l,s
  5. code&n        db    &n
  6.         db    &l
  7.         dw    offset &s
  8.         endm
  9. x = 0
  10.     rept    6
  11.         instruct    %x,1,s_add
  12. x = x+1
  13.     endm
  14.         instruct    6,1,s_push
  15.         instruct    7,1,s_pop
  16. x = 8
  17.     rept    6
  18.         instruct    %x,1,s_or
  19. x = x+1
  20.     endm
  21.         instruct    0eh,1,s_push
  22.         instruct    0fh,2,s_non
  23. x = 10h
  24.     rept    6
  25.         instruct    %x,1,s_adc
  26. x = x+1
  27.     endm
  28.         instruct    16h,1,s_push
  29.         instruct    17h,1,s_pop
  30. x = 18h
  31.     rept    6
  32.         instruct    %x,1,s_sbb
  33. x = x+1
  34.     endm
  35.         instruct    1eh,1,s_push
  36.         instruct    1fh,1,s_pop
  37. x = 20h
  38.     rept    6
  39.         instruct    %x,1,s_and
  40. x = x+1
  41.     endm
  42.         instruct    26h,1,s_es
  43.         instruct    27h,1,s_daa
  44. x = 28h
  45.     rept    6
  46.         instruct    %x,1,s_sub
  47. x = x+1
  48.     endm
  49.         instruct    2eh,1,s_cs
  50.         instruct    2fh,1,s_das
  51. x = 30h
  52.     rept    6
  53.         instruct    %x,1,s_xor
  54. x = x+1
  55.     endm
  56.         instruct    36h,1,s_ss
  57.         instruct    37h,1,s_aaa
  58. x = 38h
  59.     rept    6
  60.         instruct    %x,1,s_cmp
  61. x = x+1
  62.     endm
  63.         instruct    3eh,1,s_cs
  64.         instruct    3fh,1,s_aas
  65. x = 40h
  66.     rept    8        
  67.         instruct    %x,1,s_inc
  68. x = x+1
  69.     endm    
  70. x = 48h
  71.     rept    8        
  72.         instruct    %x,1,s_dec
  73. x = x+1
  74.     endm    
  75. x = 50h
  76.     rept    8        
  77.         instruct    %x,1,s_push
  78. x = x+1
  79.     endm    
  80.     rept    8        
  81.         instruct    %x,1,s_pop
  82. x = x+1
  83.     endm
  84. x = 60h    
  85.         instruct    60h,1,s_pusha
  86.         instruct    61h,1,s_popa
  87.         instruct    62h,1,s_bound
  88.         instruct    63h,1,s_arpl
  89.         instruct    64h,1,s_fs
  90.         instruct    65h,1,s_gs
  91.         instruct    66h,1,s_size
  92.         instruct    67h,1,s_addr
  93.         instruct    68h,1,s_push
  94.         instruct    69h,1,s_imul
  95.         instruct    6ah,1,s_push
  96.         instruct    6bh,1,s_imul
  97.         instruct    6ch,1,s_ins
  98.         instruct    6dh,1,s_ins
  99.         instruct    6eh,1,s_outs
  100.         instruct    6fh,1,s_outs
  101. x = 70h
  102.     rept 16        
  103.         instruct    %x, 3,s_jc
  104. x = x+1
  105.     endm
  106.     rept 4
  107.         instruct    %x,1,s_qqq
  108. x = x+1
  109.     endm
  110.         instruct    84h,1,s_test
  111.         instruct    85h,1,s_test
  112.         instruct    86h,1,s_xchg
  113.         instruct    87h,1,s_xchg
  114. x = 88h
  115.     rept 5
  116.         instruct    %x,1,s_mov
  117. x = x+1    
  118.     endm    
  119.         instruct    8dh,1,s_lea
  120.         instruct    8eh,1,s_mov
  121.         instruct    8fh,1,s_pop
  122.         instruct    90h,1,s_nop
  123. x = 91h
  124.     rept 7
  125.         instruct    %x,1,s_xchg
  126. x = x+1
  127.     endm
  128.         instruct    98h,1,s_cbw
  129.         instruct    99h,1,s_cwd
  130.         instruct    9ah,1,s_call
  131.         instruct    9bh,1,s_wait
  132.         instruct    9ch,1,s_pushf
  133.         instruct    9dh,1,s_popf
  134.         instruct    9eh,1,s_sahf
  135.         instruct    9fh,1,s_lahf
  136. x = 0a0h
  137.     rept 4        
  138.         instruct    %x,1,s_mov
  139. x = x+1
  140.     endm            
  141.         instruct    0a4h,1,s_movs
  142.         instruct    0a5h,1,s_movs
  143.         instruct    0a6h,1,s_cmps
  144.         instruct    0a7h,1,s_cmps
  145.         instruct    0a8h,1,s_test
  146.         instruct    0a9h,1,s_test
  147.         instruct    0aah,1,s_stos
  148.         instruct    0abh,1,s_stos
  149.         instruct    0ach,1,s_lods
  150.         instruct    0adh,1,s_lods
  151.         instruct    0aeh,1,s_scas
  152.         instruct    0afh,1,s_scas
  153. x = 0b0h
  154.     rept 16
  155.         instruct    %x ,1, s_mov
  156. x = x+1
  157.     endm
  158.         instruct    0c0h,1,s_non        
  159.         instruct    0c1h,1,s_shr        
  160.         instruct    0c2h,1,s_ret
  161.         instruct    0c3h,1,s_ret
  162.         instruct    0c4h,1,s_les
  163.         instruct    0c5h,1,s_lds
  164.         instruct    0c6h,1,s_mov
  165.         instruct    0c7h,1,s_mov
  166.         instruct    0c8h,1,s_enter
  167.         instruct    0c9h,1,s_leave
  168.         instruct    0cah,1,s_ret
  169.         instruct    0cbh,1,s_ret
  170.         instruct    0cch,1,s_int
  171.         instruct    0cdh,2,s_int
  172.         instruct    0ceh,1,s_int
  173.         instruct    0cfh,1,s_iret
  174.         instruct    0d0h,1,s_shr
  175.         instruct    0d1h,1,s_shr
  176.         instruct    0d2h,1,s_shr
  177.         instruct    0d3h,1,s_shr
  178.         instruct    0d4h,1,s_aam
  179.         instruct    0d5h,1,s_aad
  180.         instruct    0d6h,1,s_non
  181.         instruct    0d7h,1,s_xlat
  182. x = 0d8h
  183.     rept    8
  184.         instruct     %x, 1,s_esc
  185. x = x+1
  186.     endm
  187.         instruct    0e0h,1,s_loop
  188.         instruct    0e1h,1,s_loop
  189.         instruct    0e2h,1,s_loop
  190.         instruct    0e3h,1,s_jcxz
  191.         instruct    0e4h,1,s_in
  192.         instruct    0e5h,1,s_in
  193.         instruct    0e6h,1,s_out
  194.         instruct    0e7h,1,s_out
  195.         instruct    0e8h,1,s_call
  196.         instruct    0e9h,1,s_jmp
  197.         instruct    0eah,1,s_jmp
  198.         instruct    0ebh,1,s_jmp
  199.         instruct    0ech,1,s_in
  200.         instruct    0edh,1,s_in
  201.         instruct    0eeh,1,s_out
  202.         instruct    0efh,1,s_out
  203.         instruct    0f0h,1,s_lock
  204.         instruct    0f1h,1,s_non
  205.         instruct    0f2h,1,s_rep
  206.         instruct    0f3h,1,s_rep
  207.         instruct    0f4h,1,s_hlt
  208.         instruct    0f5h,1,s_cmc
  209.         instruct    0f6h,1,s_non
  210.         instruct    0f7h,1,s_non
  211.         instruct    0f8h,1,s_clc
  212.         instruct    0f9h,1,s_stc
  213.         instruct    0fah,1,s_cli
  214.         instruct    0fbh,1,s_sti
  215.         instruct    0fch,1,s_cld
  216.         instruct    0fdh,1,s_std
  217.         instruct    0feh,1,s_non
  218.         instruct    0ffh,1,s_non
  219.     
  220. $instructions    label    byte
  221. s_non        db    '**',0,0
  222. s_add        db    'add',0
  223. s_sub        db    'sub',0
  224. s_sbb        db    'sbb',0
  225. s_and        db    'and',0
  226. s_cmp        db    'cmp',0
  227. s_or        db    'or',0
  228. s_xor        db    'xor',0
  229. s_mul        db    'mul',0
  230. s_pop        db    'pop',0
  231. s_push        db    'push',0
  232. s_adc        db    'adc',0
  233. s_inc        db    'inc',0
  234. s_dec        db    'dec',0
  235. s_cs        db    'cs:',0
  236. s_ds        db    'db:',0
  237. s_es        db    'es:',0
  238. s_fs        db    'fs:',0
  239. s_gs        db    'gs:',0
  240. s_ss        db    'ss:',0
  241. s_das        db    'das',0
  242. s_daa        db    'daa',0
  243. s_aas        db    'aas',0
  244. s_aaa        db    'daa',0
  245. s_jmp        db    'jmp',0
  246. s_jcc        db    'jc*',0
  247. s_mov        db    'mov',0
  248. s_call        db    'call',0
  249. s_in        db    'in',0
  250. s_out        db    'out',0
  251. s_cwd        db    'cwd',0
  252. s_cbw        db    'cbw',0
  253. s_imul        db    'imul',0
  254. s_idiv        db    'idiv',0
  255. s_lea        db    'lea',0
  256. s_outs        db    'outs',0
  257. s_ins        db    'ins',0
  258. s_wait        db    'wait',0
  259. s_test        db    'test',0
  260. s_pushf        db    'pushf',0
  261. s_popf        db    'popf',0
  262. s_pusha        db    'pusha',0
  263. s_popa        db    'popa',0
  264. s_ret        db    'ret',0
  265. s_iret        db    'iret',0
  266. s_stos        db    'stos',0
  267. s_movs        db    'movs',0
  268. s_scas        db    'scas',0
  269. s_cmps        db    'cmps',0
  270. s_lods        db    'lods',0
  271. s_sahf        db    'sahf',0
  272. s_lahf        db    'lahf',0
  273. s_xchg        db    'xchg',0
  274. s_loop        db    'loop',0
  275. s_rep        db    'rep ',0
  276. s_jcxz        db    'jcxz',0
  277. s_hlt        db    'hlt',0
  278. s_cmc        db    'cmc',0
  279. s_xlat        db    'xlat',0
  280. s_aam        db    'aam',0
  281. s_aad        db    'aad',0
  282. s_lfs        db    'lfs',0
  283. s_lgs        db    'lgs',0
  284. s_les        db    'les',0
  285. s_lds        db    'lds',0
  286. s_lss        db    'lss',0
  287. s_bt        db    'bt',0
  288. s_btr        db    'btr',0
  289. s_shld        db    'shld',0
  290. s_shrd        db    'shrd',0
  291. s_lar        db    'lar',0
  292. s_movzx        db    'movzx',0
  293. s_movsx        db    'movsx',0
  294. s_leave        db    'leave',0
  295. s_enter        db    'enter',0
  296. s_esc        db    'esc',0
  297. s_lock        db    'lock',0
  298. s_qqq        db    '???',0
  299. s_jc        db    'jc',0
  300. s_clc        db    'clc',0
  301. s_cli        db    'cli',0
  302. s_stc        db    'stc',0
  303. s_sti        db    'sti',0
  304. s_std        db    'std',0
  305. s_cld        db    'cld',0
  306. s_int        db    'int',0
  307. s_shr        db    'shr',0
  308. s_nop        db    'nop',0
  309. s_size        db    'd16 ',0
  310. s_addr        db    'a16 ',0
  311. s_bound        db    'bound',0
  312. s_arpl        db    'arpl',0
  313.  
  314. _DATA        ends
  315. _TEXT        segment    para public USE16 'CODE'
  316.         assume    cs:_TEXT, ds:_DATA
  317. ;
  318. ; return short disassemble code
  319. ; entry  eax : instruction code, order al, ah, ...
  320. ; exit   si -> nemonic string
  321. ;
  322. getcode        proc    near
  323.         push    ebx
  324.         movzx    ebx, al
  325.         movzx    edx, word ptr code0[ebx*4+2]
  326.         pop    ebx
  327.         ret
  328.         endp
  329. _TEXT        ends
  330.         end