MMBC

Untitled

Jun 21st, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     ld  hl, 39
  2.     push    hl
  3.     call    _gfx_Begin
  4.     pop hl
  5.     call    _gfx_ZeroScreen
  6.     call    _initEnv
  7.     ld  hl, 224
  8.     push    hl
  9.     call    _gfx_SetColor
  10.     pop hl
  11.     ld  de, (_robx)
  12.     ld  iy, (_roby)
  13.     pea iy + 2
  14.     push    de
  15.     push    iy
  16.     push    de
  17.     call    _gfx_Line
  18.     ld  hl, 12
  19.     add hl, sp
  20.     ld  sp, hl
  21.     ld  de, (_robx)
  22.     ld  hl, (_roby)
  23.     push    hl
  24.     push    de
  25.     pop iy
  26.     pea iy + 2
  27.     push    hl
  28.     push    iy
  29.     call    _gfx_Line
  30.     ld  hl, 12
  31.     add hl, sp
  32.     ld  sp, hl
  33.     ld  de, (_robx)
  34.     ld  iy, (_roby)
  35.     pea iy + 2
  36.     lea hl, iy + 0
  37.     push    de
  38.     pop iy
  39.     pea iy + 3
  40.     push    hl
  41.     pea iy + 3
  42.     call    _gfx_Line
  43.     ld  hl, 12
  44.     add hl, sp
  45.     ld  sp, hl
  46.     call    _run
  47.     jp  _gfx_End
  48.  
  49.     .global _drawRob
  50. _drawRob:
  51.     push    ix
  52.     ld  ix, 0
  53.     add ix, sp
  54.     ld  e, (ix + 6)
  55.     push    de
  56.     call    _gfx_SetColor
  57.     pop hl
  58.     ld  de, (_robx)
  59.     ld  iy, (_roby)
  60.     pea iy + 2
  61.     push    de
  62.     push    iy
  63.     push    de
  64.     call    _gfx_Line
  65.     ld  hl, 12
  66.     add hl, sp
  67.     ld  sp, hl
  68.     ld  de, (_robx)
  69.     ld  hl, (_roby)
  70.     push    hl
  71.     push    de
  72.     pop iy
  73.     pea iy + 2
  74.     push    hl
  75.     push    iy
  76.     call    _gfx_Line
  77.     ld  hl, 12
  78.     add hl, sp
  79.     ld  sp, hl
  80.     ld  de, (_robx)
  81.     ld  iy, (_roby)
  82.     pea iy + 2
  83.     lea hl, iy + 0
  84.     push    de
  85.     pop iy
  86.     pea iy + 3
  87.     push    hl
  88.     pea iy + 3
  89.     call    _gfx_Line
  90.     ld  sp, ix
  91.     pop ix
  92.     ret
  93.  
  94.     .global _run
  95. _run:
  96.     push    ix
  97.     ld  ix, 0
  98.     add ix, sp
  99.     lea hl, ix + -22
  100.     ld  sp, hl
  101.     ld  a, 1
  102. BB2_1:
  103.     ld  (ix + -3), a
  104.     ld  hl, 6
  105.     push    hl
  106.     call    _kb_ScanGroup
  107.     pop hl
  108.     cp  a, 64
  109.     ld  a, 0
  110.     jp  z, BB2_3
  111.     ld  a, (ix + -3)
  112. BB2_3:
  113.     ld  (ix + -22), a
  114.     call    _initEnv
  115.     ld  hl, 7
  116.     push    hl
  117.     call    _kb_ScanGroup
  118.     pop hl
  119.     ld  l, a
  120.     add a, -128
  121.     cp  a, -124
  122.     jp  nc, BB2_7
  123.     ld  a, l
  124.     add a, -128
  125.     cp  a, -126
  126.     jp  nc, BB2_10
  127.     ld  a, l
  128.     cp  a, 1
  129.     jp  nz, BB2_17
  130.     or  a, a
  131.     sbc hl, hl
  132.     push    hl
  133.     call    _gfx_SetColor
  134.     pop hl
  135.     ld  de, (_robx)
  136.     ld  iy, (_roby)
  137.     pea iy + 2
  138.     push    de
  139.     push    iy
  140.     push    de
  141.     call    _gfx_Line
  142.     ld  hl, 12
  143.     add hl, sp
  144.     ld  sp, hl
  145.     ld  de, (_robx)
  146.     ld  hl, (_roby)
  147.     push    hl
  148.     push    de
  149.     pop iy
  150.     pea iy + 2
  151.     push    hl
  152.     push    iy
  153.     call    _gfx_Line
  154.     ld  hl, 12
  155.     add hl, sp
  156.     ld  sp, hl
  157.     ld  de, (_robx)
  158.     ld  iy, (_roby)
  159.     pea iy + 2
  160.     lea hl, iy + 0
  161.     push    de
  162.     pop iy
  163.     pea iy + 3
  164.     push    hl
  165.     pea iy + 3
  166.     call    _gfx_Line
  167.     ld  hl, 12
  168.     add hl, sp
  169.     ld  sp, hl
  170.     ld  hl, (_roby)
  171.     inc hl
  172.     jp  BB2_15
  173. BB2_7:
  174.     ld  a, l
  175.     add a, -128
  176.     cp  a, -120
  177.     jp  nc, BB2_13
  178.     ld  a, l
  179.     cp  a, 4
  180.     jp  nz, BB2_17
  181.     or  a, a
  182.     sbc hl, hl
  183.     push    hl
  184.     call    _gfx_SetColor
  185.     pop hl
  186.     ld  de, (_robx)
  187.     ld  iy, (_roby)
  188.     pea iy + 2
  189.     push    de
  190.     push    iy
  191.     push    de
  192.     call    _gfx_Line
  193.     ld  hl, 12
  194.     add hl, sp
  195.     ld  sp, hl
  196.     ld  de, (_robx)
  197.     ld  hl, (_roby)
  198.     push    hl
  199.     push    de
  200.     pop iy
  201.     pea iy + 2
  202.     push    hl
  203.     push    iy
  204.     call    _gfx_Line
  205.     ld  hl, 12
  206.     add hl, sp
  207.     ld  sp, hl
  208.     ld  de, (_robx)
  209.     ld  iy, (_roby)
  210.     pea iy + 2
  211.     lea hl, iy + 0
  212.     push    de
  213.     pop iy
  214.     pea iy + 3
  215.     push    hl
  216.     pea iy + 3
  217.     call    _gfx_Line
  218.     ld  hl, 12
  219.     add hl, sp
  220.     ld  sp, hl
  221.     ld  hl, (_robx)
  222.     inc hl
  223.     jp  BB2_12
  224. BB2_10:
  225.     ld  a, l
  226.     cp  a, 2
  227.     jp  nz, BB2_17
  228.     or  a, a
  229.     sbc hl, hl
  230.     push    hl
  231.     call    _gfx_SetColor
  232.     pop hl
  233.     ld  de, (_robx)
  234.     ld  iy, (_roby)
  235.     pea iy + 2
  236.     push    de
  237.     push    iy
  238.     push    de
  239.     call    _gfx_Line
  240.     ld  hl, 12
  241.     add hl, sp
  242.     ld  sp, hl
  243.     ld  de, (_robx)
  244.     ld  hl, (_roby)
  245.     push    hl
  246.     push    de
  247.     pop iy
  248.     pea iy + 2
  249.     push    hl
  250.     push    iy
  251.     call    _gfx_Line
  252.     ld  hl, 12
  253.     add hl, sp
  254.     ld  sp, hl
  255.     ld  de, (_robx)
  256.     ld  iy, (_roby)
  257.     pea iy + 2
  258.     lea hl, iy + 0
  259.     push    de
  260.     pop iy
  261.     pea iy + 3
  262.     push    hl
  263.     pea iy + 3
  264.     call    _gfx_Line
  265.     ld  hl, 12
  266.     add hl, sp
  267.     ld  sp, hl
  268.     ld  hl, (_robx)
  269.     dec hl
  270. BB2_12:
  271.     ld  (_robx), hl
  272.     jp  BB2_16
  273. BB2_13:
  274.     ld  a, l
  275.     cp  a, 8
  276.     jp  nz, BB2_17
  277.     or  a, a
  278.     sbc hl, hl
  279.     push    hl
  280.     call    _gfx_SetColor
  281.     pop hl
  282.     ld  de, (_robx)
  283.     ld  iy, (_roby)
  284.     pea iy + 2
  285.     push    de
  286.     push    iy
  287.     push    de
  288.     call    _gfx_Line
  289.     ld  hl, 12
  290.     add hl, sp
  291.     ld  sp, hl
  292.     ld  de, (_robx)
  293.     ld  hl, (_roby)
  294.     push    hl
  295.     push    de
  296.     pop iy
  297.     pea iy + 2
  298.     push    hl
  299.     push    iy
  300.     call    _gfx_Line
  301.     ld  hl, 12
  302.     add hl, sp
  303.     ld  sp, hl
  304.     ld  de, (_robx)
  305.     ld  iy, (_roby)
  306.     pea iy + 2
  307.     lea hl, iy + 0
  308.     push    de
  309.     pop iy
  310.     pea iy + 3
  311.     push    hl
  312.     pea iy + 3
  313.     call    _gfx_Line
  314.     ld  hl, 12
  315.     add hl, sp
  316.     ld  sp, hl
  317.     ld  hl, (_roby)
  318.     dec hl
  319. BB2_15:
  320.     ld  (_roby), hl
  321. BB2_16:
  322.     ld  hl, 224
  323.     push    hl
  324.     call    _gfx_SetColor
  325.     pop hl
  326.     ld  de, (_robx)
  327.     ld  iy, (_roby)
  328.     pea iy + 2
  329.     push    de
  330.     push    iy
  331.     push    de
  332.     call    _gfx_Line
  333.     ld  hl, 12
  334.     add hl, sp
  335.     ld  sp, hl
  336.     ld  de, (_robx)
  337.     ld  hl, (_roby)
  338.     push    hl
  339.     push    de
  340.     pop iy
  341.     pea iy + 2
  342.     push    hl
  343.     push    iy
  344.     call    _gfx_Line
  345.     ld  hl, 12
  346.     add hl, sp
  347.     ld  sp, hl
  348.     ld  de, (_robx)
  349.     ld  iy, (_roby)
  350.     pea iy + 2
  351.     lea hl, iy + 0
  352.     push    de
  353.     pop iy
  354.     pea iy + 3
  355.     push    hl
  356.     pea iy + 3
  357.     call    _gfx_Line
  358.     ld  hl, 12
  359.     add hl, sp
  360.     ld  sp, hl
  361. BB2_17:
  362.     ld  hl, 6
  363.     push    hl
  364.     call    _kb_ScanGroup
  365.     pop hl
  366.     cp  a, 1
  367.     jp  nz, BB2_19
  368.     ld  hl, (_waterindex)
  369.     ld  (ix + -9), hl
  370.     add hl, hl
  371.     ld  (ix + -15), hl
  372.     push    hl
  373.     pop iy
  374.     ld  de, _coords
  375.     add iy, de
  376.     ld  (ix + -12), iy
  377.     ld  de, (_robx)
  378.     ld  (ix + -3), de
  379.     ld  iy, (ix + -3)
  380.     lea bc, iy + 1
  381.     ld  (ix + -21), bc
  382.     ld  de, (_roby)
  383.     ld  (ix + -6), de
  384.     ld  hl, (ix + -12)
  385.     ld  (hl), c
  386.     inc hl
  387.     ld  (hl), b
  388.     ld  bc, (ix + -15)
  389.     push    bc
  390.     pop iy
  391.     ld  de, _coords+2
  392.     add iy, de
  393.     ld  (ix + -18), iy
  394.     ld  iy, (ix + -6)
  395.     lea de, iy + 1
  396.     ld  (ix + -12), de
  397.     ld  hl, (ix + -18)
  398.     ld  (hl), e
  399.     inc hl
  400.     ld  (hl), d
  401.     push    bc
  402.     pop iy
  403.     ld  de, _coords+4
  404.     add iy, de
  405.     ld  de, (ix + -21)
  406.     ld  (iy), e
  407.     inc iy
  408.     ld  (iy), d
  409.     push    bc
  410.     pop iy
  411.     ld  de, _coords+6
  412.     add iy, de
  413.     lea hl, iy + 0
  414.     ld  iy, (ix + -6)
  415.     lea de, iy + 2
  416.     ld  (ix + -6), de
  417.     ld  (hl), e
  418.     inc hl
  419.     ld  (hl), d
  420.     push    bc
  421.     pop iy
  422.     ld  de, _coords+8
  423.     add iy, de
  424.     lea hl, iy + 0
  425.     ld  iy, (ix + -3)
  426.     lea de, iy + 2
  427.     ld  (hl), e
  428.     inc hl
  429.     ld  (hl), d
  430.     push    bc
  431.     pop hl
  432.     push    hl
  433.     pop iy
  434.     ld  bc, _coords+10
  435.     add iy, bc
  436.     ld  bc, (ix + -12)
  437.     ld  (iy), c
  438.     inc iy
  439.     ld  (iy), b
  440.     push    hl
  441.     pop iy
  442.     ld  bc, _coords+12
  443.     add iy, bc
  444.     ld  (iy), e
  445.     inc iy
  446.     ld  (iy), d
  447.     ld  de, _coords+14
  448.     add hl, de
  449.     ld  de, (ix + -6)
  450.     ld  (hl), e
  451.     inc hl
  452.     ld  (hl), d
  453.     ld  iy, (ix + -9)
  454.     lea hl, iy + 8
  455.     ld  (_waterindex), hl
  456.     jp  BB2_20
  457. BB2_19:
  458.     ld  hl, (_waterindex)
  459. BB2_20:
  460.     ld  de, -8388608
  461.     add hl, de
  462.     ld  de, 8388607
  463.     add hl, de
  464.     jp  nc, BB2_32
  465.     ld  hl, _coords+2
  466.     push    hl
  467.     pop iy
  468.     ld  de, 0
  469. BB2_22:
  470.     ld  (ix + -9), iy
  471.     ld  (ix + -12), de
  472.     ld  hl, (iy + -2)
  473.     ld  bc, 65535
  474.     call    __iand
  475.     ld  (ix + -6), hl
  476.     ld  hl, (ix + -9)
  477.     ld  hl, (hl)
  478.     call    __iand
  479.     ld  (ix + -3), hl
  480.     or  a, a
  481.     sbc hl, hl
  482.     push    hl
  483.     call    _gfx_SetColor
  484.     pop hl
  485.     ld  hl, (ix + -3)
  486.     push    hl
  487.     ld  hl, (ix + -6)
  488.     push    hl
  489.     call    _gfx_SetPixel
  490.     ld  hl, 6
  491.     add hl, sp
  492.     ld  sp, hl
  493.     ld  iy, (ix + -3)
  494.     pea iy + 1
  495.     ld  hl, (ix + -6)
  496.     push    hl
  497.     ld  iy, (ix + -9)
  498.     lea hl, iy + -2
  499.     ld  (ix + -15), hl
  500.     call    _gfx_GetPixel
  501.     ld  hl, 6
  502.     add hl, sp
  503.     ld  sp, hl
  504.     cp  a, 0
  505.     jp  z, BB2_28
  506.     call    _rand
  507.     ld  bc, 1
  508.     call    __iand
  509.     inc hl
  510.     ld  de, 2
  511.     or  a, a
  512.     sbc hl, de
  513.     add hl, de
  514.     ld  de, -1
  515.     jp  z, BB2_25
  516.     ex  de, hl
  517. BB2_25:
  518.     ld  hl, (ix + -3)
  519.     push    hl
  520.     ld  (ix + -18), de
  521.     ex  de, hl
  522.     ld  de, (ix + -6)
  523.     add hl, de
  524.     ld  (ix + -21), hl
  525.     push    hl
  526.     call    _gfx_GetPixel
  527.     ld  hl, 6
  528.     add hl, sp
  529.     ld  sp, hl
  530.     cp  a, 0
  531.     jp  z, BB2_29
  532.     ld  hl, (ix + -3)
  533.     push    hl
  534.     ld  hl, (ix + -6)
  535.     ld  de, (ix + -18)
  536.     or  a, a
  537.     sbc hl, de
  538.     ld  (ix + -18), hl
  539.     push    hl
  540.     call    _gfx_GetPixel
  541.     ld  hl, 6
  542.     add hl, sp
  543.     ld  sp, hl
  544.     cp  a, 0
  545.     jp  nz, BB2_31
  546.     ld  hl, (ix + -18)
  547.     jp  BB2_30
  548. BB2_28:
  549.     ld  iy, (ix + -3)
  550.     lea iy, iy + 1
  551.     ld  (ix + -3), iy
  552.     jp  BB2_31
  553. BB2_29:
  554.     ld  hl, (ix + -21)
  555. BB2_30:
  556.     ld  (ix + -6), hl
  557. BB2_31:
  558.     ld  hl, 57
  559.     push    hl
  560.     call    _gfx_SetColor
  561.     pop hl
  562.     ld  hl, (ix + -3)
  563.     push    hl
  564.     ld  hl, (ix + -6)
  565.     push    hl
  566.     call    _gfx_SetPixel
  567.     ld  hl, 6
  568.     add hl, sp
  569.     ld  sp, hl
  570.     ld  hl, (ix + -15)
  571.     ld  de, (ix + -6)
  572.     ld  (hl), e
  573.     inc hl
  574.     ld  (hl), d
  575.     ld  iy, (ix + -9)
  576.     ld  hl, (ix + -3)
  577.     push    af
  578.     ld  (iy), l
  579.     ld  a, h
  580.     inc iy
  581.     ld  (iy), a
  582.     dec iy
  583.     pop af
  584.     ld  hl, (_waterindex)
  585.     ld  de, -8388608
  586.     add hl, de
  587.     ld  (ix + -3), hl
  588.     lea iy, iy + 4
  589.     ld  (ix + -9), iy
  590.     ld  iy, (ix + -12)
  591.     lea de, iy + 2
  592.     ld  bc, -8388606
  593.     add iy, bc
  594.     lea hl, iy + 0
  595.     ld  bc, (ix + -3)
  596.     ld  iy, (ix + -9)
  597.     or  a, a
  598.     sbc hl, bc
  599.     add hl, bc
  600.     jp  c, BB2_22
  601. BB2_32:
  602.     ld  hl, 1
  603.     push    hl
  604.     call    _kb_ScanGroup
  605.     pop hl
  606.     cp  a, -128
  607.     ld  de, 0
  608.     jp  nz, BB2_39
  609.     push    de
  610.     call    _gfx_SetColor
  611.     pop hl
  612.     ld  hl, (_waterindex)
  613.     ld  de, -8388608
  614.     add hl, de
  615.     ld  de, 8388607
  616.     add hl, de
  617.     ld  de, 0
  618.     jp  nc, BB2_38
  619.     ld  hl, _coords+2
  620.     ld  (ix + -3), hl
  621.     ld  (ix + -6), de
  622. BB2_35:
  623.     ld  iy, (ix + -3)
  624.     ld  hl, (iy + -2)
  625.     ld  bc, 65535
  626.     call    __iand
  627.     ld  iy, (ix + -3)
  628.     ld  e, (iy)
  629.     push    de
  630.     push    hl
  631.     ld  hl, (ix + -6)
  632.     ld  de, -8388606
  633.     add hl, de
  634.     ld  (ix + -9), hl
  635.     call    _gfx_SetPixel
  636.     ld  hl, 6
  637.     add hl, sp
  638.     ld  sp, hl
  639.     ld  bc, (_waterindex)
  640.     push    bc
  641.     pop hl
  642.     ld  de, -8388608
  643.     add hl, de
  644.     ld  iy, (ix + -3)
  645.     lea iy, iy + 4
  646.     ld  (ix + -3), iy
  647.     ex  de, hl
  648.     ld  iy, (ix + -6)
  649.     lea iy, iy + 2
  650.     ld  (ix + -6), iy
  651.     ld  hl, (ix + -9)
  652.     push    de
  653.     pop iy
  654.     or  a, a
  655.     sbc hl, de
  656.     add hl, de
  657.     jp  c, BB2_35
  658.     ld  de, 8388607
  659.     add iy, de
  660.     ld  hl, 0
  661.     ex  de, hl
  662.     jp  nc, BB2_38
  663.     push    bc
  664.     pop hl
  665.     add hl, hl
  666.     push    hl
  667.     push    de
  668.     ld  hl, _coords
  669.     push    hl
  670.     call    _memset
  671.     ld  de, 0
  672.     ld  hl, 9
  673.     add hl, sp
  674.     ld  sp, hl
  675. BB2_38:
  676.     ld  (_waterindex), de
  677. BB2_39:
  678.     ld  a, (ix + -22)
  679.     cp  a, 0
  680.     jp  nz, BB2_1
  681.     ld  sp, ix
  682.     pop ix
  683.     ret
  684.  
  685.     .global _initWater
  686. _initWater:
  687.     push    ix
  688.     ld  ix, 0
  689.     add ix, sp
  690.     lea hl, ix + -18
  691.     ld  sp, hl
  692.     ld  hl, (_waterindex)
  693.     ld  (ix + -9), hl
  694.     add hl, hl
  695.     ld  (ix + -15), hl
  696.     ld  de, _coords
  697.     add hl, de
  698.     ld  de, (_robx)
  699.     ld  (ix + -3), de
  700.     ld  iy, (ix + -3)
  701.     lea bc, iy + 1
  702.     ld  (ix + -18), bc
  703.     ld  de, (_roby)
  704.     ld  (ix + -6), de
  705.     ld  (hl), c
  706.     inc hl
  707.     ld  (hl), b
  708.     ld  de, _coords+2
  709.     ld  bc, (ix + -15)
  710.     push    bc
  711.     pop hl
  712.     add hl, de
  713.     ld  iy, (ix + -6)
  714.     lea de, iy + 1
  715.     ld  (ix + -12), de
  716.     ld  (hl), e
  717.     inc hl
  718.     ld  (hl), d
  719.     ld  de, _coords+4
  720.     push    bc
  721.     pop iy
  722.     add iy, de
  723.     ld  de, (ix + -18)
  724.     ld  (iy), e
  725.     inc iy
  726.     ld  (iy), d
  727.     ld  de, _coords+6
  728.     push    bc
  729.     pop hl
  730.     add hl, de
  731.     ld  iy, (ix + -6)
  732.     lea de, iy + 2
  733.     ld  (ix + -6), de
  734.     ld  (hl), e
  735.     inc hl
  736.     ld  (hl), d
  737.     ld  de, _coords+8
  738.     push    bc
  739.     pop hl
  740.     add hl, de
  741.     ld  iy, (ix + -3)
  742.     lea de, iy + 2
  743.     ld  (hl), e
  744.     inc hl
  745.     ld  (hl), d
  746.     push    bc
  747.     pop hl
  748.     push    hl
  749.     pop iy
  750.     ld  bc, _coords+10
  751.     add iy, bc
  752.     ld  bc, (ix + -12)
  753.     ld  (iy), c
  754.     inc iy
  755.     ld  (iy), b
  756.     ld  bc, _coords+12
  757.     push    hl
  758.     pop iy
  759.     add iy, bc
  760.     ld  (iy), e
  761.     inc iy
  762.     ld  (iy), d
  763.     ld  de, _coords+14
  764.     add hl, de
  765.     ld  de, (ix + -6)
  766.     ld  (hl), e
  767.     inc hl
  768.     ld  (hl), d
  769.     ld  iy, (ix + -9)
  770.     lea hl, iy + 8
  771.     ld  (_waterindex), hl
  772.     ld  sp, ix
  773.     pop ix
  774.     ret
  775.  
  776.     .global _drawPixels
  777. _drawPixels:
  778.     push    ix
  779.     ld  ix, 0
  780.     add ix, sp
  781.     lea hl, ix + -9
  782.     ld  sp, hl
  783.     ld  e, (ix + 6)
  784.     push    de
  785.     call    _gfx_SetColor
  786.     pop hl
  787.     ld  de, -8388608
  788.     ld  hl, (_waterindex)
  789.     add hl, de
  790.     ld  de, 8388607
  791.     add hl, de
  792.     jp  nc, BB4_3
  793.     or  a, a
  794.     sbc hl, hl
  795.     ld  (ix + -3), hl
  796.     ld  bc, _coords+2
  797. BB4_2:
  798.     push    bc
  799.     pop iy
  800.     ld  (ix + -6), iy
  801.     ld  hl, (iy + -2)
  802.     ld  bc, 65535
  803.     call    __iand
  804.     ld  iy, (ix + -6)
  805.     ld  e, (iy)
  806.     push    de
  807.     push    hl
  808.     ld  hl, (ix + -3)
  809.     ld  de, -8388606
  810.     add hl, de
  811.     ld  (ix + -9), hl
  812.     call    _gfx_SetPixel
  813.     ld  hl, 6
  814.     add hl, sp
  815.     ld  sp, hl
  816.     ld  hl, (_waterindex)
  817.     ld  de, -8388608
  818.     add hl, de
  819.     ex  de, hl
  820.     ld  iy, (ix + -6)
  821.     lea iy, iy + 4
  822.     lea bc, iy + 0
  823.     ld  iy, (ix + -3)
  824.     lea iy, iy + 2
  825.     ld  (ix + -3), iy
  826.     ld  hl, (ix + -9)
  827.     or  a, a
  828.     sbc hl, de
  829.     add hl, de
  830.     jp  c, BB4_2
  831. BB4_3:
  832.     ld  sp, ix
  833.     pop ix
  834.     ret
  835.  
  836.     .global _initEnv
  837. _initEnv:
  838.     ld  hl, 255
  839.     push    hl
  840.     call    _gfx_SetColor
  841.     pop hl
  842.     ld  hl, 239
  843.     push    hl
  844.     or  a, a
  845.     sbc hl, hl
  846.     push    hl
  847.     push    hl
  848.     push    hl
  849.     call    _gfx_Line
  850.     ld  hl, 12
  851.     add hl, sp
  852.     ld  sp, hl
  853.     ld  hl, 239
  854.     push    hl
  855.     ld  de, 319
  856.     push    de
  857.     or  a, a
  858.     sbc hl, hl
  859.     push    hl
  860.     push    de
  861.     call    _gfx_Line
  862.     ld  hl, 12
  863.     add hl, sp
  864.     ld  sp, hl
  865.     ld  hl, 239
  866.     push    hl
  867.     ld  de, 319
  868.     push    de
  869.     push    hl
  870.     or  a, a
  871.     sbc hl, hl
  872.     push    hl
  873.     call    _gfx_Line
  874.     ld  hl, 12
  875.     add hl, sp
  876.     ld  sp, hl
  877.     ld  hl, 90
  878.     push    hl
  879.     ld  hl, 60
  880.     push    hl
  881.     ld  hl, 40
  882.     push    hl
  883.     ld  hl, 10
  884.     push    hl
  885.     call    _gfx_Line
  886.     ld  hl, 12
  887.     add hl, sp
  888.     ld  sp, hl
  889.     ld  hl, 91
  890.     push    hl
  891.     ld  hl, 60
  892.     push    hl
  893.     ld  hl, 41
  894.     push    hl
  895.     ld  hl, 10
  896.     push    hl
  897.     call    _gfx_Line
  898.     ld  hl, 12
  899.     add hl, sp
  900.     ld  sp, hl
  901.     ld  hl, 135
  902.     push    hl
  903.     ld  hl, 70
  904.     push    hl
  905.     ld  hl, 120
  906.     push    hl
  907.     ld  hl, 55
  908.     push    hl
  909.     call    _gfx_Line
  910.     ld  hl, 12
  911.     add hl, sp
  912.     ld  sp, hl
  913.     ld  hl, 136
  914.     push    hl
  915.     ld  hl, 70
  916.     push    hl
  917.     ld  hl, 121
  918.     push    hl
  919.     ld  hl, 55
  920.     push    hl
  921.     call    _gfx_Line
  922.     ld  hl, 12
  923.     add hl, sp
  924.     ld  sp, hl
  925.     ld  hl, 120
  926.     push    hl
  927.     ld  hl, 100
  928.     push    hl
  929.     ld  hl, 135
  930.     push    hl
  931.     ld  hl, 85
  932.     push    hl
  933.     call    _gfx_Line
  934.     ld  hl, 12
  935.     add hl, sp
  936.     ld  sp, hl
  937.     ld  hl, 121
  938.     push    hl
  939.     ld  hl, 100
  940.     push    hl
  941.     ld  hl, 136
  942.     push    hl
  943.     ld  hl, 85
  944.     push    hl
  945.     call    _gfx_Line
  946.     ld  hl, 12
  947.     add hl, sp
  948.     ld  sp, hl
  949.     ld  hl, 160
  950.     push    hl
  951.     ld  hl, 70
  952.     push    hl
  953.     ld  de, 135
  954.     push    de
  955.     push    hl
  956.     call    _gfx_Line
  957.     ld  hl, 12
  958.     add hl, sp
  959.     ld  sp, hl
  960.     ld  hl, 160
  961.     push    hl
  962.     ld  de, 69
  963.     push    de
  964.     ld  hl, 135
  965.     push    hl
  966.     push    de
  967.     call    _gfx_Line
  968.     ld  hl, 12
  969.     add hl, sp
  970.     ld  sp, hl
  971.     ld  hl, 160
  972.     push    hl
  973.     ld  hl, 85
  974.     push    hl
  975.     ld  de, 135
  976.     push    de
  977.     push    hl
  978.     call    _gfx_Line
  979.     ld  hl, 12
  980.     add hl, sp
  981.     ld  sp, hl
  982.     ld  hl, 160
  983.     push    hl
  984.     ld  hl, 86
  985.     push    hl
  986.     ld  de, 135
  987.     push    de
  988.     push    hl
  989.     call    _gfx_Line
  990.     ld  hl, 12
  991.     add hl, sp
  992.     ld  sp, hl
  993.     ld  hl, 175
  994.     push    hl
  995.     ld  hl, 84
  996.     push    hl
  997.     ld  hl, 161
  998.     push    hl
  999.     ld  hl, 70
  1000.     push    hl
  1001.     call    _gfx_Line
  1002.     ld  hl, 12
  1003.     add hl, sp
  1004.     ld  sp, hl
  1005.     ld  hl, 176
  1006.     push    hl
  1007.     ld  hl, 84
  1008.     push    hl
  1009.     ld  hl, 161
  1010.     push    hl
  1011.     ld  hl, 69
  1012.     push    hl
  1013.     call    _gfx_Line
  1014.     ld  hl, 12
  1015.     add hl, sp
  1016.     ld  sp, hl
  1017.     ld  de, 175
  1018.     push    de
  1019.     ld  hl, 100
  1020.     push    hl
  1021.     push    de
  1022.     ld  hl, 85
  1023.     push    hl
  1024.     call    _gfx_Line
  1025.     ld  hl, 12
  1026.     add hl, sp
  1027.     ld  sp, hl
  1028.     ld  de, 176
  1029.     push    de
  1030.     ld  hl, 100
  1031.     push    hl
  1032.     push    de
  1033.     ld  hl, 85
  1034.     push    hl
  1035.     call    _gfx_Line
  1036.     ld  hl, 12
  1037.     add hl, sp
  1038.     ld  sp, hl
  1039.     ld  hl, 9
  1040.     push    hl
  1041.     ld  hl, 210
  1042.     push    hl
  1043.     ld  hl, 100
  1044.     push    hl
  1045.     call    _gfx_Circle
  1046.     ld  hl, 9
  1047.     add hl, sp
  1048.     ld  sp, hl
  1049.     ld  hl, 10
  1050.     push    hl
  1051.     ld  hl, 210
  1052.     push    hl
  1053.     ld  hl, 100
  1054.     push    hl
  1055.     call    _gfx_Circle
  1056.     ld  hl, 9
  1057.     add hl, sp
  1058.     ld  sp, hl
  1059.     ret
  1060.  
  1061.     .global _clean
  1062. _clean:
  1063.     push    ix
  1064.     ld  ix, 0
  1065.     add ix, sp
  1066.     lea hl, ix + -12
  1067.     ld  sp, hl
  1068.     or  a, a
  1069.     sbc hl, hl
  1070.     push    hl
  1071.     call    _gfx_SetColor
  1072.     pop hl
  1073.     ld  de, -8388608
  1074.     ld  hl, (_waterindex)
  1075.     add hl, de
  1076.     ld  de, 8388607
  1077.     add hl, de
  1078.     jp  nc, BB6_5
  1079.     ld  bc, _coords+2
  1080.     or  a, a
  1081.     sbc hl, hl
  1082.     ld  (ix + -3), hl
  1083. BB6_2:
  1084.     push    bc
  1085.     pop iy
  1086.     ld  (ix + -6), iy
  1087.     ld  hl, (iy + -2)
  1088.     ld  bc, 65535
  1089.     call    __iand
  1090.     ld  iy, (ix + -6)
  1091.     ld  e, (iy)
  1092.     push    de
  1093.     push    hl
  1094.     ld  hl, (ix + -3)
  1095.     ld  de, -8388606
  1096.     add hl, de
  1097.     ld  (ix + -9), hl
  1098.     call    _gfx_SetPixel
  1099.     ld  hl, 6
  1100.     add hl, sp
  1101.     ld  sp, hl
  1102.     ld  iy, (_waterindex)
  1103.     ld  (ix + -12), iy
  1104.     ld  de, -8388608
  1105.     add iy, de
  1106.     lea de, iy + 0
  1107.     ld  iy, (ix + -6)
  1108.     lea iy, iy + 4
  1109.     lea bc, iy + 0
  1110.     ld  iy, (ix + -3)
  1111.     lea iy, iy + 2
  1112.     ld  (ix + -3), iy
  1113.     ld  hl, (ix + -9)
  1114.     or  a, a
  1115.     sbc hl, de
  1116.     add hl, de
  1117.     jp  c, BB6_2
  1118.     ld  de, -8388608
  1119.     ld  iy, (ix + -12)
  1120.     lea hl, iy + 0
  1121.     add hl, de
  1122.     ld  de, 8388607
  1123.     add hl, de
  1124.     jp  nc, BB6_5
  1125.     add iy, iy
  1126.     push    iy
  1127.     or  a, a
  1128.     sbc hl, hl
  1129.     push    hl
  1130.     ld  hl, _coords
  1131.     push    hl
  1132.     call    _memset
  1133.     ld  hl, 9
  1134.     add hl, sp
  1135.     ld  sp, hl
  1136. BB6_5:
  1137.     or  a, a
  1138.     sbc hl, hl
  1139.     ld  (_waterindex), hl
  1140.     ld  sp, ix
  1141.     pop ix
  1142.     ret
  1143.  
  1144.     SEGMENT BSS
  1145.     .global _coords
  1146. _coords:
  1147.     .block  20000
  1148.  
  1149.     SEGMENT DATA
  1150.     .global _robx
  1151. _robx:
  1152.     .word24 25
  1153.  
  1154.     .global _roby
  1155. _roby:
  1156.     .word24 10
  1157.  
  1158.     SEGMENT BSS
  1159.     .global _waterindex
  1160. _waterindex:
  1161.     .block  3
  1162.  
  1163.  
  1164.     .extern _rand
  1165.     .extern _memset
  1166.     .extern _gfx_Circle
  1167.     .extern _gfx_End
  1168.     .extern _kb_ScanGroup
  1169.     .extern _gfx_ZeroScreen
  1170.     .extern _gfx_GetPixel
  1171.     .extern _gfx_Begin
  1172.     .extern _gfx_Line
  1173.     .extern _gfx_SetColor
  1174.     .extern __iand
  1175.     .extern _gfx_SetPixel
Advertisement
Add Comment
Please, Sign In to add comment