home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / asm_programming / all.asm < prev    next >
Assembly Source File  |  1988-03-31  |  7KB  |  408 lines

  1. ;
  2. ;    all - use all the op codes
  3. ;
  4. code2seg    segment
  5. farroutine    proc    far
  6.         mov    ax,4c00H
  7.         int    21H    ; if this file is executed, just terminate
  8. farroutine    endp    
  9. ;
  10. code2seg    ends
  11. ;
  12. dataseg        segment
  13. alpha        dw    0
  14. nearindirect    dw    beta
  15. farindirect    dd    farroutine
  16. dataseg    ends
  17. ;
  18. codeseg    segment
  19. ;
  20.     assume ds:dataseg
  21.     assume es:nothing
  22.     assume ss:nothing
  23.     assume cs:codeseg
  24. ;
  25. ;    ensure disassembler synchronization
  26. ;
  27.     nop
  28.     nop
  29.     nop
  30.     nop
  31.     nop
  32.     nop
  33. ;
  34. ;    20 examples of addressing modes
  35. ;
  36.     db    10h,00h
  37.     db    10h,08h
  38.     db    10h,10h
  39.     db    10h,18h
  40.     db    10h,20h
  41.     db    10h,28h
  42.     db    10h,30h
  43.     db    10h,38h
  44.     db    10h,00h
  45.     db    10h,01h
  46.     db    10h,02h
  47.     db    10h,03h
  48.     db    10h,04h
  49.     db    10h,05h
  50.     db    10h,06h,64h,63h
  51.     db    10h,07h
  52.     db    10h,00h
  53.     db    10h,40h,78h
  54.     db    10h,80h,78h,79h
  55.     db    10h,0c0h
  56. ;
  57. ;    another 32 examples of addressing modes
  58. ;
  59.     pop    [bx+si]
  60.     pop    [bx+di]
  61.     pop    ss:[bp+si]
  62.     pop    ss:[bp+di]
  63.     pop    [si]
  64.     pop    [di]
  65.     add     ax, [0006]   ; illustrate immediate addressing with add
  66.                          ; instruction, since there's no immediate pop
  67.     pop    [bx]
  68.     pop    [08+bx+si]
  69.     pop    [09+bx+di]
  70.     pop    ss:[0aH+bp+si]
  71.     pop    ss:[0bH+bp+di]
  72.     pop    [0cH+si]
  73.     pop    [0dH+di]
  74.     pop    ss:[0eH+bp]
  75.     pop    [0fH+bx]
  76.     pop    [1010H+bx+si]
  77.     pop    [1011H+bx+di]
  78.     pop    ss:[1012H+bp+si]
  79.     pop    ss:[1013H+bp+di]
  80.     pop    [1014H+si]
  81.     pop    [1015H+di]
  82.     pop    ss:[1016H+bp]
  83.     pop    [1017H+bx]
  84.     pop    ax
  85.     pop    cx
  86.     pop    dx
  87.     pop    bx
  88.     pop    sp
  89.     pop    bp
  90.     pop    si
  91.     pop    di
  92. ;
  93. ;    illustrate segment register usage
  94. ;
  95.     pop    [bx]        ; default is ds:
  96.     pop    cs:[bx]
  97.     pop    ss:[bx]
  98.     pop    ds:[bx]
  99.     pop    es:[bx]
  100.     pop    [bp]        ; default is ss:
  101.     pop    cs:[bp]
  102.     pop    ss:[bp]
  103.     pop    ds:[bp]
  104.     pop    es:[bp]
  105. ;
  106. nearroutine    proc    near
  107. nearroutine    endp
  108. ;
  109. ;    8088 instructions in alphabetical order
  110. ;    (as in Intel's "iAPX 88 Book")
  111. ;
  112.     aaa
  113.     aad
  114.     aam
  115.     aas
  116.     adc    cx,[bx]
  117.     adc    cx,alpha
  118.     adc    cx,13
  119.     adc    ax,13
  120.     add    cx,[bx]
  121.     and    cx,[bx]
  122.     call    nearroutine
  123.     call    farroutine
  124.     call    nearindirect
  125.     call    farindirect
  126.     cbw
  127.     clc
  128.     cld
  129.     cli
  130.     cmc
  131.     cmp    cx,[bx]
  132.     cmpsb
  133.     cmpsw
  134.     cwd
  135.     daa
  136.     das
  137.     dec    ax
  138.     dec    al
  139.     dec    byte ptr [bx]
  140.     div    cx
  141. ;
  142. ;    esc            floating point operations
  143. ;
  144.     fnop
  145.     fchs
  146.     fabs
  147.     ftst
  148.     fxam
  149.     fld1
  150.     fldl2e
  151.     fldpi
  152.     fldlg2
  153.     fldln2
  154.     fdecstp
  155.     fincstp
  156.     fldz
  157.     f2xm1
  158.     fyl2x
  159.     fptan
  160.     fpatan
  161.     fxtract
  162.     fprem
  163.     fyl2xp1
  164.     fsqrt
  165.     frndint
  166.     fscale
  167.     feni
  168.     fdisi
  169.     fclex
  170.     finit
  171.     fcompp
  172. ;
  173.     hlt
  174.     idiv    dx
  175.     imul    bx
  176.     in    ax,67
  177.     in    ax,dx
  178.     inc    dl
  179.     inc    dx
  180.     int    3
  181.     int    33
  182.     into
  183.     iret
  184.     ja    $+33
  185.     jnbe    $+33
  186.     jae    $+34
  187.     jnb    $+34
  188.     jb    $+35
  189.     jnae    $+35
  190.     jbe    $+36
  191.     jna    $+36
  192.     jc    $+37
  193.     jcxz    $+38
  194.     je    $+39
  195.     jz    $+39
  196.     jg    $+40
  197.     jnle    $+40
  198.     jge    $+41
  199.     jnl    $+41
  200.     jl    $+42
  201.     jnge    $+42
  202.     jle    $+43
  203.     jng    $+43
  204.     jmp    nearroutine
  205.     jmp    farroutine
  206.     jnc    $+44
  207.     jne    $+45
  208.     jnz    $+45
  209.     jno    $+46
  210.     jns    $+47
  211.     jnp    $+48
  212.     jpo    $+48
  213.     jo    $+49
  214.     jp    $+50
  215.     jpe    $+50
  216.     js    $+51
  217.     lahf
  218.     lds    cx,[bx]
  219.     lea    cx,[bx]
  220.     les    cx,[bx]
  221.     lock    add ax,1
  222.     lodsw
  223.     lodsb
  224.     loop    $+33
  225.     loope    $+34
  226.     loopz    $+34
  227.     loopnz    $+35
  228.     loopne    $+35
  229.     mov    ax,bx
  230.     mov    byte ptr [bx],35
  231.     mov    bx,34
  232.     mov    ax,35
  233.     mov    [bx+345],ax
  234.     mov    alpha,ax
  235.     mov    ax,[345]
  236.     mov    ds,ax
  237.     mov    [bx+346],ds
  238.     movsb
  239.     movsw
  240.     mul    bx
  241.     neg    byte ptr [bx]
  242.     nop
  243.     not    byte ptr [bx]
  244.     or    [bx+34],cx
  245.     or    byte ptr [bx+35],78
  246.     or    ax,67
  247.     out    88,ax
  248.     out    dx,al
  249.     pop    [bx+890]
  250.     pop    ax
  251.     pop    ds
  252.     popf
  253.     push    [bx+879]
  254.     push    bx
  255.     push    ds
  256.     pushf
  257.     rcl    byte ptr [bx],1
  258.     rcr    byte ptr [bx],cl
  259.     rep    stosb
  260.     repe    stosb
  261.     repne    stosb
  262. beta    proc    near
  263.     ret
  264.     ret    3
  265. beta    endp
  266. delta    proc    far
  267.     ret
  268.     ret    3
  269. delta    endp
  270.     rol    dx,1
  271.     rol    dx,cl
  272.     ror    dx,1
  273.     ror    byte ptr [bx+3],cl
  274.     sahf
  275.     sal    cx,1
  276.     sal    dx,cl
  277.     sar    dx,1
  278.     sar    dx,cl
  279.     sar    dx,1
  280.     sar    dx,cl
  281.     sbb    dx,cx
  282.     sbb    dx,1
  283.     sbb    al,3
  284.     scasw
  285.     scasb
  286.     shr    ax,1
  287.     shr    ax,cl
  288.     stc
  289.     std
  290.     sti
  291.     stosb
  292.     sub    dx,cx
  293.     sub    dx,3
  294.     sub    ax,3
  295.     test    dx,cx
  296.     wait
  297.     xchg    [bx+45],cx
  298.     xchg    ax,cx
  299.     xlat
  300.     xor    cx,78
  301. ;
  302. ;    80186 & V20 instructions
  303. ;
  304.     db    62h,0        ;bound
  305.     db    0c8h,33,44,5    ;enter procedure
  306.     db    69h,0,33,44    ;imul immediate
  307.     db    69h,0c0h,33,44    ;imul immediate
  308.     db    6bh,0,33    ;imul immediate
  309.     db    6bh,0c0h,33    ;imul immediate
  310.     db    6ch        ;ins dx
  311.     db    0f2h,6ch    ;ins dx repeated by count in cx
  312.     db    0c9h        ;leave procedure
  313.     db    6eh        ;outs dx
  314.     db    0f2h,6eh    ;outs dx repeated by count in cx
  315.     db    61h        ;popa
  316.     db    68h,33,44    ;push immediate
  317.     db    6ah,33        ;push immediate
  318.     db    60h        ;pusha
  319.     db    0c0h,00h,3    ;ROL memory by count
  320.     db    0c0h,08h,3    ;ROR memory by count
  321.     db    0c0h,10h,3    ;RCL memory by count
  322.     db    0c0h,18h,3    ;RCR memory by count
  323.     db    0c0h,20h,3    ;SHL/SAL memory by count
  324.     db    0c0h,28h,3    ;SHR memory by count
  325.     db    0c0h,38h,3    ;SAR memory by count
  326. ;
  327. ;    V20 unique instructions
  328. ;
  329.     db    0fh,20h        ;add4s
  330.     db    0fh,12h,0c0h    ;clr1 reg8,cl
  331.     db    0fh,12h,000h    ;clr1 mem8,cl
  332.     db    0fh,13h,0c0h    ;clr1 reg16,cl
  333.     db    0fh,13h,000h    ;clr1 mem16,cl
  334.     db    0fh,1ah,0c0h,3    ;clr1 reg8,imm3
  335.     db    0fh,1ah,000h,3    ;clr1 mem8,imm3
  336.     db    0fh,1bh,0c0h,3    ;clr1 reg16,imm4
  337.     db    0fh,1bh,000h,3    ;clr1 mem16,imm4
  338.     db    0fh,26h        ;cmp4s
  339.     db    0fh,33h,0c0h    ;ext bit field
  340.     db    0fh,3bh,0c0h,3    ;ext bit field immediate
  341.     db    66h,0c0h    ;fp02
  342.     db    66h,000h    ;fp02
  343.     db    0fh,31h,0c0h    ;insert bit field
  344.     db    0fh,39h,0c0h,3    ;insert bit field immediate
  345.     db    0fh,16h,0c0h    ;not1 reg8,cl
  346.     db    0fh,16h,000h    ;not1 mem8,cl
  347.     db    0fh,17h,0c0h    ;not1 reg16,cl
  348.     db    0fh,17h,000h    ;not1 mem16,cl
  349.     db    0fh,1eh,0c0h,3    ;not1 reg8,imm3
  350.     db    0fh,1eh,000h,3    ;not1 mem8,imm3
  351.     db    0fh,1fh,0c0h,3    ;not1 reg16,imm4
  352.     db    0fh,1fh,000h,3    ;not1 mem16,imm4
  353.     db    65h        ;repc
  354.     db    64h        ;repnc
  355.     db    0fh,28h,0c0h    ;rol4
  356.     db    0fh,28h,000h    ;rol4
  357.     db    0fh,2ah,0c0h    ;ror4
  358.     db    0fh,2ah,000h    ;ror4
  359.     db    0fh,14h,0c0h    ;set1 reg8,cl
  360.     db    0fh,14h,000h    ;set1 mem8,cl
  361.     db    0fh,15h,0c0h    ;set1 reg16,cl
  362.     db    0fh,15h,000h    ;set1 mem16,cl
  363.     db    0fh,1ch,0c0h,3    ;set1 reg8,imm3
  364.     db    0fh,1ch,000h,3    ;set1 mem8,imm3
  365.     db    0fh,1dh,0c0h,3    ;set1 reg16,imm4
  366.     db    0fh,1dh,000h,3    ;set1 mem16,imm4
  367.     db    0fh,22h        ;sub4s
  368.     db    0fh,10h,0c0h    ;test1 reg8,cl
  369.     db    0fh,10h,000h    ;test1 mem8,cl
  370.     db    0fh,11h,0c0h    ;test1 reg16,cl
  371.     db    0fh,11h,000h    ;test1 mem16,cl
  372.     db    0fh,18h,0c0h,3    ;test1 reg8,imm3
  373.     db    0fh,18h,000h,3    ;test1 mem8,imm3
  374.     db    0fh,19h,0c0h,3    ;test1 reg16,imm4
  375.     db    0fh,19h,000h,3    ;test1 mem16,imm4
  376. ;
  377. ;    '386 unique instructions
  378. ;
  379.     db    64h        ;fs:
  380.     mov    byte ptr [bx],35
  381.     db    65h        ;gs:
  382.     mov    byte ptr [bx],35
  383.     db    66h        ;32 bit operand
  384.     adc    cx,1300
  385.     dw    90h,90h
  386.     db    66h        ;32 bit operand
  387.     adc    ax,1300
  388.     dw    90h,90h
  389.     db    67h        ;32 bit address
  390.     ja    $+33
  391.     dw    90h,90h
  392. ;
  393. ;    s-i-b byte instructions
  394. ;
  395.     db    0,0ch,0c0h            ; add  [eax+8*eax],cl               
  396.     db    0,4ch,0c0h,33h            ; add  [eax+8*eax+33],cl            
  397.     db    0,8ch,0c0h,11h,22h,33h,44h    ; add  [eax+8*eax+44332211],cl      
  398.     db    0,8ch,80h,11h,22h,33h,44h    ; add  [eax+4*eax+44332211],cl      
  399.     db    0,8ch,40h,11h,22h,33h,44h    ; add  [eax+2*eax+44332211],cl      
  400.     db    0,8ch,44h,11h,22h,33h,44h    ; add  ss:[eax+2*eax+44332211],cl   
  401.     db    26h,0,8ch,44h,11h,22h,33h,44h    ; add  es:[eax+2*eax+44332211],cl   
  402.  
  403. ;
  404. codeseg    ends
  405. ;
  406.  
  407.     end
  408.