home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 2 / FreeSoftwareCollection2pd199x-jp.img / metal / y_sbios.asm < prev    next >
Assembly Source File  |  1990-06-14  |  13KB  |  790 lines

  1.  
  2. .386p
  3.  
  4.     include     tbios.inc
  5.  
  6. param    struc
  7.     dd    ?        ;return address
  8. p    dd    16 dup(?)    ;paramater
  9. param    ends
  10.  
  11. ;
  12. ; for y_s bios
  13. ;
  14. pattern    struc    ; 4 bytes 2 article
  15. pno    dw    ?    ;pattern no.(for tbios)
  16. pmxy    dw    ?    ;size of x and y(DH:x DL:y)
  17. pattern ends
  18.  
  19. sp_chr    struc    ; 16 byte 8 article
  20. cno    dw    ?    ;sprite charactor no.(for tbios)
  21. cmxy    dw    ?    ;size of x and y(DH:x DL:y)
  22. aix    dw    ?    ;animation pointer
  23. x    dw    ?    ;x_point(dot)
  24. y    dw    ?    ;y_point(dot)
  25. si_b    dw    ?    ;offset, direction flag
  26. di_b    dw    ?    ;color table no.
  27. resev    dw    ?    ;reserve
  28. sp_chr    ends
  29.  
  30. ;
  31. ;    エントリー
  32. ;
  33. code    segment dword public ER use32 'CODE'
  34.     assume    cs:code,ds:data,es:data,ss:sseg
  35.  
  36.     jmp    i_o    ;0
  37.     jmp    gbios    ;5
  38.     jmp    dummy    ;mbios    ;10
  39.     jmp    spbios    ;15
  40.     jmp    sdbios    ;20
  41.     jmp    dummy    ;fbios    ;25
  42.  
  43.     jmp    y_sbios    ;30
  44.  
  45.  
  46. ;
  47. ;
  48. ;
  49. data    segment dword  public RW use32 'DATA'
  50. ;
  51. ; for graphics bios
  52. ;
  53. gsize   equ     1024
  54. gwork   db      gsize dup(?)
  55. ;
  56. ; for sound bios
  57. ;
  58. ;sdsize    equ    1024*16
  59. ;sdwork    db    sdsize dup(?)
  60. ;
  61. ; for y_s bios
  62. ;
  63. x_ofs    dw    0
  64. y_ofs    dw    0
  65. pt    pattern    <128>
  66.     pattern    512-128-1 dup(<>)
  67. at    dw    256 dup(16 dup(?))
  68.     sp_chr    <1024>
  69. ct    sp_chr    256 dup(<>)
  70. prt    dw    256 dup(?)
  71.  
  72. data    ends
  73.  
  74.  
  75.  
  76. dummy    proc    near
  77.     ret
  78. dummy    endp
  79.  
  80. ;
  81. ;    I/O  
  82. ;
  83. i_o    proc    near
  84.     mov    edx,[esp].p[0]
  85.     mov    eax,[esp].p[4]
  86.     out    dx,al
  87.     ret
  88. i_o    endp
  89.  
  90. ;
  91. ;    TBIOS  マクロ
  92. ;
  93.  
  94. ;
  95. ;    グラフィックス
  96. ;
  97. gbios    proc    near
  98.     mov    ebp,esp
  99.     push    tbios
  100.     pop    fs
  101.     mov    edi,offset gwork
  102.     mov    eax,[ebp].p[0]
  103.     call    dword ptr cs:g_jtbl[eax*4]
  104.     ret
  105. gbios    endp
  106. ;
  107. g_jtbl    dd    offset init
  108.     dd    offset scrn_md
  109.     dd    offset scrn_at
  110.     dd    offset view
  111.     dd    offset palette
  112.     dd    offset w_page
  113.     dd    offset d_page
  114.  
  115. ;
  116. ;
  117. ;
  118. init    proc    near
  119.         ginit
  120.     ret
  121. init    endp
  122.  
  123. ;
  124. scrn_md    proc    near
  125.     mov    eax,[ebp].p[4]
  126.     mov    edx,[ebp].p[8]
  127.     graph    01h
  128.     ret
  129. scrn_md    endp
  130.  
  131. ;
  132. scrn_at    proc    near
  133.     mov    eax,[ebp].p[4]
  134.     graph    05h
  135.     mov    al,0
  136.     mov    edx,[ebp].p[8]
  137.     mov    ebx,[ebp].p[12]
  138.     graph    02h
  139.     mov    al,2
  140.     mov    edx,[ebp].p[16]
  141.     mov    ebx,[ebp].p[20]
  142.     graph    02h
  143.     mov    al,3
  144.     mov    edx,[ebp].p[24]
  145.     mov    ebx,[ebp].p[28]
  146.     graph    02h
  147.     ret
  148. scrn_at    endp
  149.  
  150. ;
  151. view    proc    near
  152.     mov    esi,[ebp].p[4]
  153.     graph    03h
  154.     ret
  155. view    endp
  156.  
  157. ;
  158. palette proc    near
  159.     mov    eax,[ebp].p[4]
  160.     mov    esi,[ebp].p[8]
  161.     graph    04h
  162.     ret
  163. palette    endp
  164.  
  165. ;
  166. w_page    proc    near
  167.     mov    eax,[ebp].p[4]
  168.     graph    05h
  169.     ret
  170. w_page    endp
  171.  
  172. ;
  173. d_page    proc    near
  174.     mov    eax,[ebp].p[4]
  175.     mov    edx,[ebp].p[8]
  176.     graph    06h
  177.     ret
  178. d_page    endp
  179.  
  180. ;
  181. ;     サウンド
  182. ;
  183. sdbios    proc    near
  184. ;    mov    ebp,esp
  185. ;    push    tbios
  186. ;    pop    fs
  187. ;    mov    edi,offset sdwork
  188. ;    mov    eax,[ebp].p[0]
  189. ;    call    dword ptr cs:sd_jtbl[eax*4]
  190.     ret
  191. sdbios    endp
  192.  
  193. sd_jtbl    dd    offset sd_init    ;00h
  194.     dd    offset keyon    ;01h
  195.     dd    offset keyoff    ;02h
  196.     dd    offset output    ;03h
  197.     dd    offset c_stype    ;04h
  198.     dd    offset w_sdata    ;05h
  199. ;    dd    offset pad
  200. ;    dd    offset LED
  201.  
  202. ;
  203. sd_init    proc    near
  204.     sound    00h
  205.     ret
  206. sd_init    endp
  207.  
  208. ;
  209. keyon    proc    near
  210.     mov    bl,byte ptr[ebp].p[4]
  211.     mov    dh,byte ptr[ebp].p[8]
  212.     mov    dl,byte ptr[ebp].p[12]
  213.     sound    01h
  214.     ret
  215. keyon    endp
  216.  
  217. ;
  218. keyoff    proc    near
  219.     mov    bl,byte ptr[ebp].p[4]
  220.     sound    02h
  221.     ret
  222. keyoff    endp
  223.  
  224. ;
  225. output    proc    near
  226.     mov    bl,byte ptr[ebp].p[4]
  227.     mov    dl,byte ptr[ebp].p[8]
  228.     sound    03h
  229.     ret
  230. output    endp
  231.  
  232. ;
  233. c_stype    proc    near
  234.     mov    bl,byte ptr[ebp].p[4]
  235.     mov    dh,byte ptr[ebp].p[8]
  236.     sound    04h
  237.     ret
  238. c_stype    endp
  239.  
  240. ;
  241. w_sdata    proc    near
  242.     mov    bl,byte ptr[ebp].p[4]
  243.     mov    dh,byte ptr[ebp].p[8]
  244.     mov    esi,[ebp].p[12]
  245.     sound    05h
  246.     ret
  247. w_sdata    endp
  248.  
  249. ;
  250. ;    スプライト
  251. ;
  252. spbios    proc    near
  253.     push    tbios
  254.     pop    fs
  255.     mov    ebp,esp
  256.     mov    eax,[ebp].p[0]
  257.     call    dword ptr cs:sp_jtbl[eax*4]
  258.     ret
  259. spbios    endp
  260. ;
  261. sp_jtbl    dd    offset spinit    ;00h
  262.     dd    offset sp_dsp    ;01h
  263.     dd    offset sp_def    ;02h
  264.     dd    offset sp_spal    ;03h
  265.     dd    offset sp_spos    ;04h
  266.     dd    offset sp_satr    ;05h
  267.     dd    offset sp_xy    ;06h
  268.     dd    offset sp_ofs    ;07h
  269.     dd    offset sp_gatr    ;08h
  270.  
  271. ;
  272. spinit    proc    near
  273.     sprite    00h
  274.     ret
  275. spinit    endp
  276.  
  277. ;
  278. sp_dsp    proc    near
  279.     mov    al,byte ptr[ebp].p[4]
  280.     mov    cx,word ptr[ebp].p[8]
  281.     sprite    01h
  282.     ret
  283. sp_dsp    endp
  284.  
  285. ;
  286. sp_def    proc    near
  287.     mov    al,byte ptr[ebp].p[4]
  288.     mov    cx,word ptr[ebp].p[8]
  289.     mov    dh,byte ptr[ebp].p[12]
  290.     mov    dl,byte ptr[ebp].p[16]
  291.     mov    esi,[ebp].p[20]
  292.     sprite    02h
  293.     ret
  294. sp_def    endp
  295.  
  296. ;
  297. sp_spal    proc    near
  298.     mov    cx,word ptr[ebp].p[4]
  299.     mov    dx,word ptr[ebp].p[8]
  300.     mov    esi,[ebp].p[12]
  301.     sprite    03h
  302.     ret
  303. sp_spal    endp
  304.  
  305. ;
  306. sp_spos    proc    near
  307.     mov    al,byte ptr[ebp].p[4]
  308.     mov    cx,word ptr[ebp].p[8]
  309.     mov    dh,byte ptr[ebp].p[12]
  310.     mov    dl,byte ptr[ebp].p[16]
  311.     mov    si,word ptr[ebp].p[20]
  312.     mov    di,word ptr[ebp].p[24]
  313.     sprite    04h
  314.     ret
  315. sp_spos    endp
  316.  
  317. ;
  318. sp_satr    proc    near
  319.     mov    cx,word ptr[ebp].p[4]
  320.     mov    dh,byte ptr[ebp].p[8]
  321.     mov    dl,byte ptr[ebp].p[12]
  322.     mov    si,word ptr[ebp].p[16]
  323.     mov    di,word ptr[ebp].p[20]
  324.     sprite    05h
  325.     ret
  326. sp_satr    endp
  327.  
  328. ;
  329. sp_xy    proc    near
  330.     mov    cx,word ptr[ebp].p[4]
  331.     mov    dh,byte ptr[ebp].p[8]
  332.     mov    dl,byte ptr[ebp].p[12]
  333.     mov    si,word ptr[ebp].p[16]
  334.     mov    di,word ptr[ebp].p[20]
  335.     sprite    06h
  336.     ret
  337. sp_xy    endp
  338.  
  339. ;
  340. sp_ofs    proc    near
  341.     mov    si,word ptr[ebp].p[4]
  342.     mov    di,word ptr[ebp].p[8]
  343.     sprite    07h
  344.     ret
  345. sp_ofs    endp
  346. ;
  347. sp_gatr    proc    near
  348.     mov    cx,word ptr[ebp].p[4]
  349.     mov    dh,byte ptr[ebp].p[8]
  350.     mov    dl,byte ptr[ebp].p[12]
  351.     mov    edi,[ebp].p[16]
  352.     sprite  08h
  353.     ret
  354. sp_gatr    endp
  355. ;
  356. ;    Y_S  BIOS
  357. ;
  358. y_sbios    proc    near
  359.     push    tbios
  360.     pop    fs
  361.     mov    ebp,esp
  362.     mov    eax,[ebp].p[0]
  363.     call    dword ptr cs:ys_jtbl[eax*4]
  364.     ret
  365. y_sbios    endp
  366. ;
  367. ys_jtbl    dd    offset y_sinit        ;00h
  368.     dd    offset def_cell        ;01h
  369.     dd    offset def_anime    ;02h
  370.     dd    offset def_schr        ;03h
  371.     dd    offset dsp_anm        ;04h
  372.     dd    offset chg_atr        ;05h
  373.     dd    offset chg_prt        ;06h
  374.  
  375. ;  initialize Y_S BIOS
  376. ;    p[4]=view x point p[8]=view y point
  377.  
  378. y_sinit        proc    near
  379.         sprite    00h
  380.         xor    cx,cx
  381.         mov    dx,1010h    ;x=16 y=16 (256 count)
  382.         mov    si,0000h
  383.         mov    di,2000h    ;no display
  384. yi_lp1:        sprite    05h
  385.         add    cx,256
  386.         cmp    cx,1024
  387.         jne    short yi_lp1
  388.         mov    word ptr pt[0].pno,128    ;initialize pattern no.
  389.         mov    word ptr ct[0].cno,1024    ;initialize sp_chr no.
  390.         mov    ax,word ptr[ebp].p[4]
  391.         mov    x_ofs,ax
  392.         mov    ax,word ptr[ebp].p[8]
  393.         mov    y_ofs,ax
  394.         ret
  395. y_sinit        endp
  396.  
  397. ;  define cell (function 01h)
  398. ;    p[4]=cell top no. p[8]=cell number p[12]=max_x(char) p[16]=max_y(char)
  399. ;    p[20]=pattern top address
  400. ;    <return> eax=next cell top no.
  401.  
  402. def_cell    proc    near
  403.         mov    eax,[ebp].p[8]
  404.         push    eax    ;[esp][8]
  405.  
  406.         mov    ah,byte ptr[ebp].p[12]
  407.         mov    al,byte ptr[ebp].p[16]
  408.         mul    ah
  409.         push    eax    ;[esp][4]=max_x*max_y
  410.  
  411.         shl    ax,7
  412.         push    eax    ;[esp][0]=max_x*max_y*128(offset)
  413.  
  414.         mov    ebx,[ebp].p[4]
  415.         mov    esi,[ebp].p[20]
  416.         mov    dh,byte ptr[ebp].p[12]
  417.         mov    dl,byte ptr[ebp].p[16]
  418. dfc_lp1:    mov    ax,pt[ebx*4].pno
  419.         mov    cx,ax
  420.         add    ax,[esp][4]
  421.         mov    pt[ebx*4][4],ax    ;next .pno
  422.         mov    pt[ebx*4].pmxy,dx
  423.  
  424.         mov    ax,0200h
  425.         call    pword ptr fs:[60h]
  426.  
  427.         inc    ebx
  428.         add    esi,[esp][0]
  429.         dec    dword ptr[esp][8]
  430.         jne    short dfc_lp1
  431.  
  432.         add    esp,12
  433.         mov    eax,ebx
  434.         ret
  435. def_cell    endp
  436.  
  437. ;  define animation (function 02h)
  438. ;    p[4]=top anime no. p[8]=anime number p[12]=top cell no.
  439. ;    p[16]=top anime address
  440. ;    <return> eax=next top anime no.
  441.  
  442. def_anime    proc    near
  443.         mov    ecx,[ebp].p[8]
  444.         mov    edi,[ebp].p[4]
  445.         shl    edi,5
  446.         mov    esi,[ebp].p[16]
  447.  
  448. dfa_lp1:    xor    edx,edx
  449. dfa_lp2:    mov    ax,[esi+edx*2]
  450.         or    ax,ax
  451.         js    short dfa_ed1
  452.         add    ax,word ptr[ebp].p[12]
  453.         mov    at[edi+edx*2],ax
  454.         inc    edx
  455.         jmp    short dfa_lp2
  456. dfa_ed1:    mov    at[edi+edx*2],ax
  457.         add    esi,16*2
  458.         add    edi,16*2
  459.         loop    dfa_lp1
  460.  
  461.         mov    eax,[ebp].p[4]
  462.         add    eax,[ebp].p[8]
  463.         ret
  464. def_anime    endp
  465.  
  466. ;  difine sprite_charactor (function 03h)
  467. ;    p[4]=char no. p[8]=anime no. p[12]=max_x(char) p[16]=max_y(char)
  468. ;    p[20]=point_x(dot) p[24]=point_y(dot) p[28]=color_tbl no
  469. ;    p[32]=offset flag p[36]=direction flag
  470. ;    <return> eax=used sprite count
  471.  
  472. def_schr    proc    near
  473.         mov    ebx,[ebp].p[4]
  474.         shl    ebx,4
  475.  
  476.         mov    ah,byte ptr[ebp].p[12]        ;sp_chr no.
  477.         mov    al,byte ptr[ebp].p[16]
  478.         mul    ah
  479.         mov    cx,ct[ebx][-16]    ;before .cno
  480.         sub    cx,ax
  481.         mov    ct[ebx].cno,cx
  482.  
  483.         mov    eax,[ebp].p[4]            ;priority
  484.         mov    prt[eax*2],ax
  485.  
  486.         mov    dh,byte ptr[ebp].p[12]        ;max x,y
  487.         mov    dl,byte ptr[ebp].p[16]
  488.         mov    ct[ebx].cmxy,dx
  489.  
  490.         mov    eax,[ebp].p[8]            ;anime no=>cell no.
  491.         shl    eax,5
  492.         mov    ct[ebx].aix,ax
  493.         mov    ax,at[eax]            ;cell no.=>pattern no
  494.         mov    si,pt[eax*4]
  495.  
  496.         xor    ah,ah
  497.         mov    al,byte ptr[ebp].p[32]        ;offset flag
  498.         or    al,al
  499.         je    short dfc_skp1
  500.         or    ah,80h
  501. dfc_skp1:    mov    al,byte ptr[ebp].p[36]        ;direction flag
  502.         shl    al,4
  503.         or    ah,al
  504.  
  505.         xor    al,al
  506.         mov    ct[ebx].si_b,ax
  507.         or    si,ax
  508.  
  509.         mov    di,word ptr[ebp].p[28]        ;color table
  510.         or    di,8100h
  511.         mov    ct[ebx].di_b,di
  512.         sprite    05h
  513.  
  514.         mov    si,word ptr[ebp].p[20]        ;point x,y
  515.         mov    ct[ebx].x,si
  516.         mov    di,word ptr[ebp].p[24]
  517.         mov    ct[ebx].y,di
  518.         call    ca_xy1
  519.  
  520.         mov    ax,1024
  521.         sub    ax,cx
  522.         movsx    eax,ax
  523.         ret
  524. def_schr    endp
  525.  
  526. ;  display animation (function 04h)
  527. ;    p[4]=sp_chr no.
  528. ;    <return> eax -1:anime ended
  529.  
  530. dsp_anm        proc    near
  531.         mov    ebx,[ebp].p[4]
  532.         shl    ebx,4
  533.  
  534.         mov    ax,ct[ebx].aix            ;anime no.
  535.         movzx    eax,ax
  536.         mov    ax,at[eax]            ;cell no.=>pattern no
  537.         movzx    eax,ax
  538.         mov    si,pt[eax*4]
  539.         or    si,ct[ebx].si_b
  540.  
  541.         mov    di,ct[ebx].di_b
  542.  
  543.         mov    cx,ct[ebx].cno
  544.         mov    dx,ct[ebx].cmxy
  545.  
  546.         sprite    05h
  547.  
  548.         mov    dx,ct[ebx].aix
  549.         add    dx,2
  550.         movzx    edx,dx
  551.         mov    ax,at[edx]
  552.         or    ax,ax
  553.         jns    short dpa_skp1
  554.         and    dx,0FFE0h
  555. dpa_skp1:    mov    ct[ebx].aix,dx
  556.         movsx    eax,ax
  557.         ret
  558. dsp_anm        endp
  559.  
  560. ;  change attribute (function 05h)
  561. ;    p[4]=chr no. p[8]=change no.
  562. ;      p[8]=0 : p[12]=x point(dot) p[16]=y point(dot)
  563. ;           1 : p[12]=anime no.
  564. ;           2 : p[12]=palette no.
  565. ;           3 : p[12]=direction flag
  566.  
  567. chg_atr    proc    near
  568.     mov    ebx,[ebp].p[4]
  569.     shl    ebx,4
  570.     mov    cx,ct[ebx].cno
  571.     mov    dx,ct[ebx].cmxy
  572.  
  573.     mov    eax,[ebp].p[8]
  574.     call    dword ptr cs:ca_jtbl[eax*4]
  575.     ret
  576. chg_atr    endp
  577. ;
  578. ca_jtbl    dd    offset ca_xy        ;00h
  579.     dd    offset ca_ano        ;01h
  580.     dd    offset ca_cpal        ;02h
  581.     dd    offset ca_cdir        ;03h
  582.  
  583. ca_xy    proc    near
  584.     mov    si,word ptr[ebp].p[12]        ;point x,y
  585.     mov    ct[ebx].x,si
  586.     mov    di,word ptr[ebp].p[16]
  587.     mov    ct[ebx].y,di
  588.  
  589. ca_xy1:    sub    si,x_ofs
  590.     and    si,1FFh
  591.     sub    di,y_ofs
  592.     and    di,1FFh
  593.  
  594.     test    byte ptr ct[ebx].si_b+1,70h
  595.     je    short ca_nml
  596.  
  597.     push    ecx
  598.     push    edx        ;[esp][8]
  599.     push    edx        ;[esp][4]
  600.     mov    al,16
  601.     dec    dh
  602.     mul    dh
  603.     add    si,ax
  604.     push    esi        ;[esp][0]
  605.     mov    dx,0101h
  606. ca_lp1:    mov    al,[esp][9]
  607.     mov    [esp][5],al
  608.     mov    si,[esp][0]
  609. ca_lp2:    mov    ax,0400h
  610.     call    pword ptr fs:[60h]
  611.     inc    cx
  612.     sub    si,16
  613.     dec    byte ptr[esp][5]
  614.     jne    short ca_lp2
  615.     add    di,16
  616.     dec    byte ptr[esp][4]
  617.     jne    short ca_lp1
  618.     add    esp,8
  619.     pop    edx
  620.     pop    ecx
  621.     ret
  622.  
  623. ca_nml:    mov    ax,0400h
  624.     call    pword ptr fs:[60h]
  625.     ret
  626. ca_xy    endp
  627.  
  628. ca_ano    proc    near
  629.     mov    eax,[ebp].p[12]            ;anime no=>cell no.
  630.     shl    eax,5
  631.     mov    ct[ebx].aix,ax
  632.     mov    ax,at[eax]            ;cell no.=>pattern no
  633.     mov    si,pt[eax*4]
  634.     or    si,ct[ebx].si_b
  635.     mov    di,ct[ebx].di_b
  636.     sprite    05h
  637.     ret
  638. ca_ano    endp
  639.  
  640. ca_cpal    proc    near
  641.     xor    eax,eax
  642.     mov    ax,ct[ebx].aix            ;anime no=>cell no.
  643.     mov    ax,at[eax]            ;cell no.=>pattern no
  644.     mov    si,pt[eax*4]
  645.     or    si,ct[ebx].si_b
  646.     mov    di,ct[ebx].di_b
  647.     and    di,0FF00h
  648.     add    di,word ptr[ebp].p[12]
  649.     mov    ct[ebx].di_b,di
  650.     sprite    05h
  651.     ret
  652. ca_cpal    endp
  653.  
  654. ca_cdir        proc    near
  655.         mov    eax,[ebp].p[12]
  656.         shl    eax,12
  657.         mov    si,ct[ebx].si_b
  658.         and    si,7000h
  659.         cmp    ax,si
  660.         je    cacd_end
  661.         mov    si,ct[ebx].si_b
  662.         and    si,8FFFh
  663.         or    si,ax
  664.         mov    ct[ebx].si_b,si
  665.  
  666.         mov    ax,ct[ebx].aix
  667.         mov    ax,at[eax]            ;cell no.=>pattern no
  668.         mov    ax,pt[eax*4]
  669.         or    si,ax
  670.         mov    di,ct[ebx].di_b
  671.         sprite    05h
  672.  
  673.         mov    si,ct[ebx].x
  674.         mov    di,ct[ebx].y
  675.         call    ca_xy1
  676.  
  677. cacd_end:    ret
  678. ca_cdir    endp
  679.  
  680. ;  change prioritys (function 06h)
  681. ;    p[4]=chr count p[8]=prioryty table address
  682. ;    p[12]=sort type (0:normal 1:reverse)
  683.  
  684. chg_prt    proc    near
  685.     mov    ebx,[ebp].p[8]
  686.     xor    edx,edx
  687.     push    edx        ;[esp][4]
  688.  
  689.     xor    esi,esi        ;value C
  690.     mov    edx,[ebp].p[4]    ;CMAX
  691.     push    edx        ;[esp][0]
  692. cp_lp1:      xor    edi,edi        ;value I
  693.       mov    ecx,[ebp].p[4]    ;CMAX
  694.       xor    edx,edx
  695.  
  696. cp_lp2:        mov    ax,[ebx][esi*2]
  697.         cmp    ax,[ebx][edi*2]
  698.         jne    short cp_sk1
  699.           cmp    esi,edi
  700.           ja    short cp_ed1
  701.           jmp    short cp_ed2
  702. cp_sk1:        seta    al
  703.         xor    al,byte ptr[ebp].p[12]
  704.         je    short cp_ed2
  705. cp_ed1:        inc    edx
  706. cp_ed2:      inc    edi
  707.       loop    short cp_lp2
  708.     cmp    si,prt[edx*2]
  709.     je    short cp_sk2
  710.       mov    prt[edx*2],si
  711.       mov    byte ptr[esp][4],255
  712. cp_sk2:    inc    esi
  713.     dec    byte ptr[esp][0]
  714.     jne    short cp_lp1
  715.  
  716.     add    esp,4
  717.     pop    eax
  718.     test    al,255
  719.     je    cp_end
  720.  
  721.     mov    si,prt[0]
  722.     shl    si,4
  723.     mov    word ptr ct[esi].cno,1024
  724.  
  725.     xor    ebx,ebx            ;PR=0
  726.     mov    ecx,[ebp].p[4]        ;CMAX
  727.     dec    ecx
  728.  
  729. cp_lp3:    mov    si,prt[ebx*2]
  730.     shl    si,4
  731.     mov    di,prt[ebx*2+2]
  732.     shl    di,4
  733.  
  734.       mov    ax,ct[esi].cmxy        ;sp_chr no.
  735.       mul    ah
  736.       mov    dx,ct[esi].cno
  737.       sub    dx,ax
  738.       mov    ct[esi].cno,dx
  739.       mov    ct[edi].cno,dx
  740.  
  741.     inc    ebx
  742.     loop    short cp_lp3
  743.  
  744.       mov    ax,ct[edi].cmxy        ;sp_chr no.
  745.       mul    ah
  746.       mov    dx,ct[edi].cno
  747.       sub    dx,ax
  748.       mov    ct[edi].cno,dx
  749.  
  750.         xor    ebx,ebx
  751.         mov    edx,[ebp].p[4]        ;CMAX
  752.         push    edx            ;[esp][0]
  753.  
  754. cp_lp4:        mov    cx,ct[ebx].cno
  755.  
  756.         mov    dx,ct[ebx].cmxy
  757.  
  758.         mov    ax,ct[ebx].aix
  759.         mov    ax,at[eax]            ;cell no.=>pattern no
  760.         mov    si,pt[eax*4]
  761.  
  762.         mov    ax,ct[ebx].si_b
  763.         or    si,ax
  764.  
  765.         mov    di,ct[ebx].di_b
  766.         sprite    05h
  767.  
  768.         mov    si,ct[ebx].x
  769.         mov    di,ct[ebx].y
  770.         call    ca_xy1
  771.  
  772.         add    ebx,16
  773.         dec    byte ptr[esp][0]
  774.         jne    short cp_lp4
  775.         add    esp,4
  776.  
  777. cp_end:        ret
  778. chg_prt        endp
  779.  
  780. code    ends
  781.  
  782. ;
  783. ;
  784. ;
  785. sseg    segment dword stack RW use32 'STACK'
  786.         db      1000h dup(?)
  787. sseg    ends
  788.  
  789.         end
  790.