Advertisement
taylorza

Untitled

Feb 22nd, 2022
1,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     ld hl, 0
  2.     ld (___ticksperframe__), hl     ; store value to global __ticksperframe__(uint16)
  3. ; FuncCallAst @38,1 : setspeed
  4.     ld a, 3
  5.     push af
  6.     inc sp
  7.     call _setspeed
  8.     ld hl, 1
  9.     add hl, sp
  10.     ld sp, hl
  11. ; FuncCallAst @94,1 : setup
  12.     call _setup
  13. ; WhileAst @96,15
  14. .LOOP_1:
  15. ; condition
  16.     ld hl, 178
  17.     ex de, hl
  18.     ld hl, (_i)         ; load value from global i
  19.     or a
  20.     sbc hl, de
  21.     ld a, 0
  22.     rla
  23.     or a
  24.     jp z, .ENDLOOP_1
  25. ; Loop body start
  26. ; FuncCallAst @97,5 : gotoxy
  27.     ld bc, 6917         ; 27,5
  28.     call lib.gotoxy
  29. ; PrintAst @97,19
  30.     ld hl, (_i)         ; load value from global i
  31.     call lib.printUint
  32.     ld a, ' '
  33.     call lib.putch
  34.     ld hl, -106
  35.     ld (_j), hl         ; store value to global j(int16)
  36. ; WhileAst @98,23
  37. .LOOP_2:
  38. ; condition
  39.     ld hl, 107
  40.     ex de, hl
  41.     ld hl, (_j)         ; load value from global j
  42.     ld a, l
  43.     sub a, e
  44.     ld a, h
  45.     sbc a, d
  46.     jp po, .LEAVESIGN_3
  47.     xor a, 0x80
  48. .LEAVESIGN_3:
  49.     rlca
  50.     ld a, 0
  51.     rla
  52.     or a
  53.     jp z, .ENDLOOP_2
  54. ; Loop body start
  55. ; FuncCallAst @99,9 : gotoxy
  56.     ld bc, 6922         ; 27,10
  57.     call lib.gotoxy
  58. ; PrintAst @99,24
  59.     ld hl, (_j)         ; load value from global j
  60.     call lib.printInt
  61.     ld a, ' '
  62.     call lib.putch
  63. ; FuncCallAst @100,17 : shoot
  64.     ld hl, (_j)         ; load value from global j
  65.     push hl
  66. ; CastAst @100,23 int16(uint16)
  67.     ld hl, (_i)         ; load value from global i
  68.     push hl
  69.     call _shoot
  70.     ex de, hl
  71.     ld hl, 4
  72.     add hl, sp
  73.     ld sp, hl
  74.     ex de, hl
  75.     ld (_s), hl         ; store value to global s(int16)
  76. ; IfAst @101,9
  77. .IF_4:
  78. ; condition
  79.     ld hl, 0
  80.     ex de, hl
  81.     ld hl, (_s)         ; load value from global s
  82.     or a
  83.     sbc hl, de
  84.     jp nz, .NE_5
  85.     ld a, 1
  86.     jp .DONE_5
  87. .NE_5:
  88.     xor a, a
  89. .DONE_5:
  90.     or a
  91.     jp z, .ELSE_4
  92. ; FuncCallAst @102,13 : setpixel
  93. ; CastAst @102,22 uint8(int16)
  94.     ld hl, (_j)         ; load value from global j
  95.     ex de, hl
  96.     ld hl, 106
  97.     add hl, de
  98.     ld a, l
  99.     push af
  100. ; CastAst @102,29 uint8(uint16)
  101.     ld hl, 14
  102.     ex de, hl
  103.     ld hl, (_i)         ; load value from global i
  104.     add hl, de
  105.     ld a, l
  106.     pop bc
  107.     ld c, a
  108.     ld a, 255
  109.     call lib.setpixel
  110.     ld hl, -1
  111.     ld (_last), hl      ; store value to global last(int16)
  112.     ld hl, (_hits)      ; load value from global hits
  113.     inc hl
  114.     ld (_hits), hl      ; store value to global hits(int16)
  115. ; FuncCallAst @105,13 : gotoxy
  116.     ld bc, 6932         ; 27,20
  117.     call lib.gotoxy
  118. ; PrintAst @105,28
  119.     ld hl, (_hits)      ; load value from global hits
  120.     call lib.printInt
  121.     jp .ENDIF_4
  122. .ELSE_4:
  123. ; FuncCallAst @107,13 : setpixel
  124. ; CastAst @107,22 uint8(int16)
  125.     ld hl, (_j)         ; load value from global j
  126.     ex de, hl
  127.     ld hl, 106
  128.     add hl, de
  129.     ld a, l
  130.     push af
  131. ; CastAst @107,29 uint8(uint16)
  132.     ld hl, 14
  133.     ex de, hl
  134.     ld hl, (_i)         ; load value from global i
  135.     add hl, de
  136.     ld a, l
  137.     pop bc
  138.     ld c, a
  139. ; CastAst @107,35 uint8(int16)
  140.     ld a, (_s)          ; load low byte from global s
  141.     call lib.setpixel
  142. ; IfAst @108,13
  143. .IF_6:
  144. ; condition
  145.     ld hl, (_j)         ; load value from global j
  146.     ex de, hl
  147.     ld hl, 0
  148.     ld a, l
  149.     sub a, e
  150.     ld a, h
  151.     sbc a, d
  152.     jp po, .LEAVESIGN_7
  153.     xor a, 0x80
  154. .LEAVESIGN_7:
  155.     rlca
  156.     ld a, 0
  157.     rla
  158.     or a
  159.     jp z, .ENDIF_6
  160. ; IfAst @109,17
  161. .IF_8:
  162. ; condition
  163.     ld hl, (_last)      ; load value from global last
  164.     ex de, hl
  165.     ld hl, (_s)         ; load value from global s
  166.     or a
  167.     sbc hl, de
  168.     jp nz, .NE_9
  169.     ld a, 1
  170.     jp .DONE_9
  171. .NE_9:
  172.     xor a, a
  173. .DONE_9:
  174.     or a
  175.     jp z, .ELSE_8
  176.     ld hl, (_count)     ; load value from global count
  177.     inc hl
  178.     ld (_count), hl     ; store value to global count(int16)
  179. ; IfAst @111,21
  180. .IF_10:
  181. ; condition
  182.     ld hl, (_count)     ; load value from global count
  183.     ex de, hl
  184.     ld hl, 5
  185.     ld a, l
  186.     sub a, e
  187.     ld a, h
  188.     sbc a, d
  189.     jp po, .LEAVESIGN_11
  190.     xor a, 0x80
  191. .LEAVESIGN_11:
  192.     rlca
  193.     ld a, 0
  194.     rla
  195.     or a
  196.     jp z, .ENDIF_10
  197. ; FuncCallAst @112,25 : line
  198. ; CastAst @112,50 uint8(int16)
  199.     ld a, (_s)          ; load low byte from global s
  200.     push af
  201.     inc sp
  202.     ld hl, (_j)         ; load value from global j
  203.     ex de, hl
  204.     ld hl, 106
  205.     or a
  206.     sbc hl, de
  207.     push hl
  208. ; CastAst @112,37 int16(uint16)
  209.     ld hl, 14
  210.     ex de, hl
  211.     ld hl, (_i)         ; load value from global i
  212.     add hl, de
  213.     push hl
  214.     ld hl, (_j)         ; load value from global j
  215.     ex de, hl
  216.     ld hl, 107
  217.     add hl, de
  218.     push hl
  219.     call _line
  220.     ld hl, 7
  221.     add hl, sp
  222.     ld sp, hl
  223. ; BreakAst @113,25
  224.     jp .ENDLOOP_2
  225. .ENDIF_10:
  226.     jp .ENDIF_8
  227. .ELSE_8:
  228.     ld hl, (_s)         ; load value from global s
  229.     ld (_last), hl      ; store value to global last(int16)
  230.     ld hl, 1
  231.     ld (_count), hl     ; store value to global count(int16)
  232. .ENDIF_8:
  233.     jp .ENDIF_6
  234. .ENDIF_6:
  235. .ENDIF_4:
  236. ; Loop body end
  237. ; Loop step start
  238. .STEPLOOP_2:
  239.     ld hl, (_j)         ; load value from global j
  240.     inc hl
  241.     ld (_j), hl         ; store value to global j(int16)
  242. ; Loop step end
  243.     jp .LOOP_2
  244. .ENDLOOP_2:
  245. ; Loop body end
  246. ; Loop step start
  247. .STEPLOOP_1:
  248.     ld hl, (_i)         ; load value from global i
  249.     inc hl
  250.     ld (_i), hl         ; store value to global i(uint16)
  251. ; Loop step end
  252.     jp .LOOP_1
  253. .ENDLOOP_1:
  254. ; FuncCallAst @124,1 : ink
  255.     ld a, 0x10          ; ROM ink
  256.     rst 0x10
  257.     ld a, 0
  258.     rst 0x10
  259. ; FuncCallAst @125,1 : paper
  260.     ld a, 0x11          ; ROM paper
  261.     rst 0x10
  262.     ld a, 6
  263.     rst 0x10
  264. ; FuncCallAst @126,1 : gotoxy
  265.     ld bc, 1            ; 0,1
  266.     call lib.gotoxy
  267. ; PrintAst @126,14
  268.     ld a, ' '
  269.     call lib.putch
  270. __HALT_12:
  271.     jp __HALT_12
  272. _wait:
  273. .FUNC_13:
  274.     push ix
  275.     ld ix, 0
  276.     add ix, sp
  277.     ld hl, -1
  278.     add hl, sp
  279.     ld sp, hl
  280. ; FuncCallAst @5,15 : peek
  281. ; CastAst @5,20 uint16(int16)
  282.     ld hl, 23672
  283.     ld a, (hl)
  284.     ld (ix-1), a        ; store value to local start(uint8)
  285. ; WhileAst @6,3
  286. .LOOP_14:
  287. ; condition
  288.     ld a, (ix+4)        ; load value from parameter n
  289.     push af
  290.     ld a, (ix-1)        ; load value from local start
  291.     push af
  292. ; FuncCallAst @6,10 : peek
  293.     ld a, (23672)
  294.     pop bc
  295.     sub a, b
  296.     pop bc
  297.     sub a, b
  298.     ld a, 0
  299.     rla
  300.     or a
  301.     jp z, .ENDLOOP_14
  302. ; Loop body start
  303. ; Loop body end
  304.     jp .LOOP_14
  305. .ENDLOOP_14:
  306. .ENDFUNC_13:
  307.     ld sp, ix
  308.     pop ix
  309.     ret
  310. _calibrate:
  311. .FUNC_15:
  312.     push ix
  313.     ld ix, 0
  314.     add ix, sp
  315.     ld hl, -1
  316.     add hl, sp
  317.     ld sp, hl
  318. ; AsmAst @11,5
  319. __asm_16:
  320. ; start inline asm
  321.         ld a, i         ; Get IF1 loaded into P/V flag
  322.         jp pe, .skip    ; If enabled we are fine,
  323.         ld a, i         ;   if disabled we need to load again just incase an interrupt fired during the first load
  324. .skip:
  325.         push af
  326.         ei
  327.    
  328. ; end inline asm
  329.     ld hl, 0
  330.     ld (___ticksperframe__), hl     ; store value to global __ticksperframe__(uint16)
  331. ; FuncCallAst @14,15 : peek
  332. ; CastAst @14,20 uint16(int16)
  333.     ld hl, 23672
  334.     ld a, (hl)
  335.     ld (ix-1), a        ; store value to local start(uint8)
  336. ; WhileAst @15,3
  337. .LOOP_17:
  338. ; condition
  339.     ld a, 2
  340.     push af
  341.     ld a, (ix-1)        ; load value from local start
  342.     push af
  343. ; FuncCallAst @15,10 : peek
  344.     ld a, (23672)
  345.     pop bc
  346.     sub a, b
  347.     pop bc
  348.     sub a, b
  349.     ld a, 0
  350.     rla
  351.     or a
  352.     jp z, .ENDLOOP_17
  353. ; Loop body start
  354. ; Loop body end
  355.     jp .LOOP_17
  356. .ENDLOOP_17:
  357. ; FuncCallAst @18,11 : peek
  358.     ld a, (23672)
  359.     ld (ix-1), a        ; store value to local start(uint8)
  360. ; WhileAst @19,3
  361. .LOOP_18:
  362. ; condition
  363.     ld a, 1
  364.     push af
  365.     ld a, (ix-1)        ; load value from local start
  366.     push af
  367. ; FuncCallAst @19,10 : peek
  368.     ld a, (23672)
  369.     pop bc
  370.     sub a, b
  371.     pop bc
  372.     sub a, b
  373.     ld a, 0
  374.     rla
  375.     or a
  376.     jp z, .ENDLOOP_18
  377. ; Loop body start
  378.     ld hl, (___ticksperframe__)     ; load value from global __ticksperframe__
  379.     inc hl
  380.     ld (___ticksperframe__), hl     ; store value to global __ticksperframe__(uint16)
  381. ; Loop body end
  382.     jp .LOOP_18
  383. .ENDLOOP_18:
  384.     ld hl, 50
  385.     ex de, hl
  386.     ld hl, (___ticksperframe__)     ; load value from global __ticksperframe__
  387.     call lib.udiv16
  388.     ld (___ticksperframe__), hl     ; store value to global __ticksperframe__(uint16)
  389. ; AsmAst @23,3
  390. __asm_19:
  391. ; start inline asm
  392.         pop af
  393.         jp  pe, .keepEnabled
  394.         di
  395. .keepEnabled:
  396.    
  397. ; end inline asm
  398. .ENDFUNC_15:
  399.     ld sp, ix
  400.     pop ix
  401.     ret
  402. _setspeed:
  403. .FUNC_20:
  404.     push ix
  405.     ld ix, 0
  406.     add ix, sp
  407. ; FuncCallAst @27,5 : nextreg
  408.     ld a, 4
  409.     ld b, a
  410.     ld a, (ix+4)        ; load value from parameter speed
  411.     call lib.udiv8
  412.     ld a, b
  413.     nextreg 7, a
  414. ; FuncCallAst @28,5 : calibrate
  415.     call _calibrate
  416. .ENDFUNC_20:
  417.     pop ix
  418.     ret
  419. _waitticks:
  420. .FUNC_21:
  421.     push ix
  422.     ld ix, 0
  423.     add ix, sp
  424.     ld hl, (___ticksperframe__)     ; load value from global __ticksperframe__
  425.     ex de, hl
  426.     ld l, (ix + 4)      ; load value from parameter n
  427.     ld h, (ix + 5)
  428.     call lib.umul16
  429.     ld (ix + 5), h      ; store value to parameter n(uint16)
  430.     ld (ix + 4), l
  431. ; WhileAst @33,5
  432. .LOOP_22:
  433. ; condition
  434.     ld l, (ix + 4)      ; load value from parameter n
  435.     ld h, (ix + 5)
  436.     ex de, hl
  437.     ld hl, 0
  438.     or a
  439.     sbc hl, de
  440.     ld a, 0
  441.     rla
  442.     or a
  443.     jp z, .ENDLOOP_22
  444. ; Loop body start
  445.     ld l, (ix + 4)      ; load value from parameter n
  446.     ld h, (ix + 5)
  447.     dec hl
  448.     ld (ix + 5), h      ; store value to parameter n(uint16)
  449.     ld (ix + 4), l
  450. ; Loop body end
  451.     jp .LOOP_22
  452. .ENDLOOP_22:
  453. .ENDFUNC_21:
  454.     pop ix
  455.     ret
  456. _line:
  457. .FUNC_23:
  458.     push ix
  459.     ld ix, 0
  460.     add ix, sp
  461.     ld hl, -2
  462.     add hl, sp
  463.     ld sp, hl
  464.     ld hl, 0
  465.     ld (ix-2), l        ; store value to local i(int16)
  466.     ld (ix-1), h
  467. ; WhileAst @14,14
  468. .LOOP_24:
  469. ; condition
  470.     ld l, (ix + 8)      ; load value from parameter length
  471.     ld h, (ix + 9)
  472.     ex de, hl
  473.     ld l, (ix-2)        ; load value from local i
  474.     ld h, (ix-1)
  475.     ld a, l
  476.     sub a, e
  477.     ld a, h
  478.     sbc a, d
  479.     jp po, .LEAVESIGN_25
  480.     xor a, 0x80
  481. .LEAVESIGN_25:
  482.     rlca
  483.     ld a, 0
  484.     rla
  485.     or a
  486.     jp z, .ENDLOOP_24
  487. ; Loop body start
  488. ; FuncCallAst @15,9 : setpixel
  489. ; CastAst @15,18 uint8(int16)
  490.     ld l, (ix-2)        ; load value from local i
  491.     ld h, (ix-1)
  492.     ex de, hl
  493.     ld l, (ix + 4)      ; load value from parameter x
  494.     ld h, (ix + 5)
  495.     add hl, de
  496.     ld a, l
  497.     push af
  498. ; CastAst @15,25 uint8(int16)
  499.     ld a, (ix + 6)      ; load low byte from parameter y
  500.     pop bc
  501.     ld c, a
  502.     ld a, (ix+10)       ; load value from parameter color
  503.     call lib.setpixel
  504. ; Loop body end
  505. ; Loop step start
  506. .STEPLOOP_24:
  507.     ld l, (ix-2)        ; load value from local i
  508.     ld h, (ix-1)
  509.     inc hl
  510.     ld (ix-2), l        ; store value to local i(int16)
  511.     ld (ix-1), h
  512. ; Loop step end
  513.     jp .LOOP_24
  514. .ENDLOOP_24:
  515. .ENDFUNC_23:
  516.     ld sp, ix
  517.     pop ix
  518.     ret
  519. _shoot:
  520. .FUNC_26:
  521.     push ix
  522.     ld ix, 0
  523.     add ix, sp
  524.     ld hl, -6
  525.     add hl, sp
  526.     ld sp, hl
  527.     ld hl, 0
  528.     ld (ix-2), l        ; store value to local x(int16)
  529.     ld (ix-1), h
  530.     ld hl, 0
  531.     ld (ix-4), l        ; store value to local y(int16)
  532.     ld (ix-3), h
  533.     ld hl, -32768
  534.     ld (ix-6), l        ; store value to local high(int16)
  535.     ld (ix-5), h
  536. ; WhileAst @24,5
  537. .LOOP_27:
  538. ; Loop body start
  539.     ld l, (ix + 4)      ; load value from parameter dx
  540.     ld h, (ix + 5)
  541.     ex de, hl
  542.     ld l, (ix-2)        ; load value from local x
  543.     ld h, (ix-1)
  544.     add hl, de
  545.     ld (ix-2), l        ; store value to local x(int16)
  546.     ld (ix-1), h
  547.     ld l, (ix + 6)      ; load value from parameter dy
  548.     ld h, (ix + 7)
  549.     ex de, hl
  550.     ld l, (ix-4)        ; load value from local y
  551.     ld h, (ix-3)
  552.     add hl, de
  553.     ld (ix-4), l        ; store value to local y(int16)
  554.     ld (ix-3), h
  555. ; IfAst @28,9
  556. .IF_28:
  557. ; condition
  558.     ld l, (ix-4)        ; load value from local y
  559.     ld h, (ix-3)
  560.     ex de, hl
  561.     ld l, (ix-6)        ; load value from local high
  562.     ld h, (ix-5)
  563.     ld a, l
  564.     sub a, e
  565.     ld a, h
  566.     sbc a, d
  567.     jp po, .LEAVESIGN_29
  568.     xor a, 0x80
  569. .LEAVESIGN_29:
  570.     rlca
  571.     ld a, 0
  572.     rla
  573.     or a
  574.     jp z, .ENDIF_28
  575.     ld l, (ix-4)        ; load value from local y
  576.     ld h, (ix-3)
  577.     ld (ix-6), l        ; store value to local high(int16)
  578.     ld (ix-5), h
  579.     jp .ENDIF_28
  580. .ENDIF_28:
  581. ; IfAst @32,9
  582. .IF_30:
  583. ; condition
  584.     ld l, (ix + 4)      ; load value from parameter dx
  585.     ld h, (ix + 5)
  586.     ex de, hl
  587.     ld hl, 0
  588.     ld a, l
  589.     sub a, e
  590.     ld a, h
  591.     sbc a, d
  592.     jp po, .LEAVESIGN_31
  593.     xor a, 0x80
  594. .LEAVESIGN_31:
  595.     rlca
  596.     ld a, 0
  597.     rla
  598.     or a
  599.     jp z, .ELSEIF_30.0
  600.     ld l, (ix + 4)      ; load value from parameter dx
  601.     ld h, (ix + 5)
  602.     dec hl
  603.     ld (ix + 5), h      ; store value to parameter dx(int16)
  604.     ld (ix + 4), l
  605.     jp .ENDIF_30
  606. .ELSEIF_30.0:
  607. ; condition
  608.     ld hl, 0
  609.     ex de, hl
  610.     ld l, (ix + 4)      ; load value from parameter dx
  611.     ld h, (ix + 5)
  612.     ld a, l
  613.     sub a, e
  614.     ld a, h
  615.     sbc a, d
  616.     jp po, .LEAVESIGN_32
  617.     xor a, 0x80
  618. .LEAVESIGN_32:
  619.     rlca
  620.     ld a, 0
  621.     rla
  622.     or a
  623.     jp z, .ENDIF_30
  624.     ld l, (ix + 4)      ; load value from parameter dx
  625.     ld h, (ix + 5)
  626.     inc hl
  627.     ld (ix + 5), h      ; store value to parameter dx(int16)
  628.     ld (ix + 4), l
  629.     jp .ENDIF_30
  630. .ENDIF_30:
  631.     ld l, (ix + 6)      ; load value from parameter dy
  632.     ld h, (ix + 7)
  633.     dec hl
  634.     ld (ix + 7), h      ; store value to parameter dy(int16)
  635.     ld (ix + 6), l
  636. ; IfAst @39,9
  637. .IF_33:
  638. ; condition
  639.     ld hl, -71
  640.     ex de, hl
  641.     ld l, (ix-4)        ; load value from local y
  642.     ld h, (ix-3)
  643.     ld a, e
  644.     sub a, l
  645.     ld a, d
  646.     sbc a, h
  647.     jp po, .LEAVESIGN_34
  648.     xor a, 0x80
  649. .LEAVESIGN_34:
  650.     rlca
  651.     ld a, 0
  652.     rla
  653.     xor a, 1
  654.     or a
  655.     jp z, .ENDIF_33
  656. ; IfAst @40,13
  657. .IF_35:
  658. ; condition
  659.     ld hl, -106
  660.     ex de, hl
  661.     ld l, (ix-4)        ; load value from local y
  662.     ld h, (ix-3)
  663.     ld a, l
  664.     sub a, e
  665.     ld a, h
  666.     sbc a, d
  667.     jp po, .LEAVESIGN_36
  668.     xor a, 0x80
  669. .LEAVESIGN_36:
  670.     rlca
  671.     ld a, 0
  672.     rla
  673.     push af
  674.     ld hl, 0
  675.     ex de, hl
  676.     ld l, (ix + 6)      ; load value from parameter dy
  677.     ld h, (ix + 7)
  678.     ld a, l
  679.     sub a, e
  680.     ld a, h
  681.     sbc a, d
  682.     jp po, .LEAVESIGN_37
  683.     xor a, 0x80
  684. .LEAVESIGN_37:
  685.     rlca
  686.     ld a, 0
  687.     rla
  688.     pop bc
  689.     or a
  690.     jp z, .FALSE_38
  691.     ld a, b
  692. .FALSE_38:
  693.     or a
  694.     jp z, .ENDIF_35
  695. ; IfAst @41,17
  696. .IF_39:
  697. ; condition
  698.     ld hl, 143
  699.     ex de, hl
  700.     ld l, (ix-2)        ; load value from local x
  701.     ld h, (ix-1)
  702.     ld a, l
  703.     sub a, e
  704.     ld a, h
  705.     sbc a, d
  706.     jp po, .LEAVESIGN_40
  707.     xor a, 0x80
  708. .LEAVESIGN_40:
  709.     rlca
  710.     ld a, 0
  711.     rla
  712.     or a
  713.     jp z, .ELSEIF_39.0
  714. ; ReturnAst @42,21
  715.     ld l, (ix-2)        ; load value from local x
  716.     ld h, (ix-1)
  717.     ex de, hl
  718.     ld hl, 143
  719.     or a
  720.     sbc hl, de
  721.     jp .ENDFUNC_26
  722. .ELSEIF_39.0:
  723. ; condition
  724.     ld l, (ix-2)        ; load value from local x
  725.     ld h, (ix-1)
  726.     ex de, hl
  727.     ld hl, 177
  728.     ld a, l
  729.     sub a, e
  730.     ld a, h
  731.     sbc a, d
  732.     jp po, .LEAVESIGN_41
  733.     xor a, 0x80
  734. .LEAVESIGN_41:
  735.     rlca
  736.     ld a, 0
  737.     rla
  738.     or a
  739.     jp z, .ELSE_39
  740. ; ReturnAst @44,21
  741.     ld hl, 177
  742.     ex de, hl
  743.     ld l, (ix-2)        ; load value from local x
  744.     ld h, (ix-1)
  745.     or a
  746.     sbc hl, de
  747.     jp .ENDFUNC_26
  748. .ELSE_39:
  749. ; ReturnAst @46,21
  750.     ld l, (ix-4)        ; load value from local y
  751.     ld h, (ix-3)
  752.     ex de, hl
  753.     ld hl, -106
  754.     or a
  755.     sbc hl, de
  756.     jp .ENDFUNC_26
  757. .ENDIF_39:
  758.     jp .ENDIF_35
  759. .ENDIF_35:
  760. ; IfAst @50,13
  761. .IF_42:
  762. ; condition
  763.     ld l, (ix-4)        ; load value from local y
  764.     ld h, (ix-3)
  765.     ex de, hl
  766.     ld hl, -106
  767.     ld a, e
  768.     sub a, l
  769.     ld a, d
  770.     sbc a, h
  771.     jp po, .LEAVESIGN_43
  772.     xor a, 0x80
  773. .LEAVESIGN_43:
  774.     rlca
  775.     ld a, 0
  776.     rla
  777.     xor a, 1
  778.     push af
  779.     ld hl, 177
  780.     ex de, hl
  781.     ld l, (ix-2)        ; load value from local x
  782.     ld h, (ix-1)
  783.     ld a, e
  784.     sub a, l
  785.     ld a, d
  786.     sbc a, h
  787.     jp po, .LEAVESIGN_44
  788.     xor a, 0x80
  789. .LEAVESIGN_44:
  790.     rlca
  791.     ld a, 0
  792.     rla
  793.     xor a, 1
  794.     push af
  795.     ld l, (ix-2)        ; load value from local x
  796.     ld h, (ix-1)
  797.     ex de, hl
  798.     ld hl, 143
  799.     ld a, e
  800.     sub a, l
  801.     ld a, d
  802.     sbc a, h
  803.     jp po, .LEAVESIGN_45
  804.     xor a, 0x80
  805. .LEAVESIGN_45:
  806.     rlca
  807.     ld a, 0
  808.     rla
  809.     xor a, 1
  810.     pop bc
  811.     or a
  812.     jp z, .FALSE_46
  813.     ld a, b
  814. .FALSE_46:
  815.     pop bc
  816.     or a
  817.     jp z, .FALSE_47
  818.     ld a, b
  819. .FALSE_47:
  820.     or a
  821.     jp z, .ENDIF_42
  822. ; IfAst @51,17
  823. .IF_48:
  824. ; condition
  825.     ld l, (ix-6)        ; load value from local high
  826.     ld h, (ix-5)
  827.     ex de, hl
  828.     ld hl, (_best)      ; load value from global best
  829.     ld a, l
  830.     sub a, e
  831.     ld a, h
  832.     sbc a, d
  833.     jp po, .LEAVESIGN_49
  834.     xor a, 0x80
  835. .LEAVESIGN_49:
  836.     rlca
  837.     ld a, 0
  838.     rla
  839.     or a
  840.     jp z, .ENDIF_48
  841.     ld l, (ix-6)        ; load value from local high
  842.     ld h, (ix-5)
  843.     ld (_best), hl      ; store value to global best(int16)
  844. ; FuncCallAst @53,21 : gotoxy
  845.     ld bc, 6927         ; 27,15
  846.     call lib.gotoxy
  847. ; PrintAst @54,21
  848.     ld hl, (_best)      ; load value from global best
  849.     call lib.printInt
  850.     jp .ENDIF_48
  851. .ENDIF_48:
  852. ; ReturnAst @56,17
  853.     ld hl, 0
  854.     jp .ENDFUNC_26
  855. .ENDIF_42:
  856.     jp .ENDIF_33
  857. .ENDIF_33:
  858. ; Loop body end
  859.     jp .LOOP_27
  860. .ENDLOOP_27:
  861. .ENDFUNC_26:
  862.     ld sp, ix
  863.     pop ix
  864.     ret
  865. _setup:
  866. .FUNC_50:
  867.     push ix
  868.     ld ix, 0
  869.     add ix, sp
  870.     ld hl, -2
  871.     add hl, sp
  872.     ld sp, hl
  873. ; FuncCallAst @63,5 : setspeed
  874.     ld a, 3
  875.     push af
  876.     inc sp
  877.     call _setspeed
  878.     ld hl, 1
  879.     add hl, sp
  880.     ld sp, hl
  881. ; FuncCallAst @64,5 : mode256x192
  882.     call lib.mode256x192
  883. ; FuncCallAst @66,5 : cls
  884.     ld a, 227
  885.     call lib.cls
  886. ; FuncCallAst @68,5 : bright
  887.     ld a, 0x13          ; ROM bright
  888.     rst 0x10
  889.     ld a, 0
  890.     rst 0x10
  891. ; FuncCallAst @69,5 : paper
  892.     ld a, 0x11          ; ROM paper
  893.     rst 0x10
  894.     ld a, 0
  895.     rst 0x10
  896. ; FuncCallAst @70,5 : ink
  897.     ld a, 0x10          ; ROM ink
  898.     rst 0x10
  899.     ld a, 7
  900.     rst 0x10
  901. ; PrintAst @72,5
  902.     ld hl, @str_0
  903.     call lib.printString
  904.     ld hl, 0
  905.     ld (ix-2), l        ; store value to local i(int16)
  906.     ld (ix-1), h
  907. ; WhileAst @73,14
  908. .LOOP_51:
  909. ; condition
  910.     ld hl, 7
  911.     ex de, hl
  912.     ld l, (ix-2)        ; load value from local i
  913.     ld h, (ix-1)
  914.     ld a, e
  915.     sub a, l
  916.     ld a, d
  917.     sbc a, h
  918.     jp po, .LEAVESIGN_52
  919.     xor a, 0x80
  920. .LEAVESIGN_52:
  921.     rlca
  922.     ld a, 0
  923.     rla
  924.     xor a, 1
  925.     or a
  926.     jp z, .ENDLOOP_51
  927. ; Loop body start
  928. ; FuncCallAst @74,9 : line
  929.     ld a, 224
  930.     push af
  931.     inc sp
  932.     ld hl, 8
  933.     push hl
  934.     ld l, (ix-2)        ; load value from local i
  935.     ld h, (ix-1)
  936.     ex de, hl
  937.     ld hl, 7
  938.     or a
  939.     sbc hl, de
  940.     push hl
  941.     ld l, (ix-2)        ; load value from local i
  942.     ld h, (ix-1)
  943.     ex de, hl
  944.     ld hl, 208
  945.     add hl, de
  946.     push hl
  947.     call _line
  948.     ld hl, 7
  949.     add hl, sp
  950.     ld sp, hl
  951. ; FuncCallAst @75,9 : line
  952.     ld a, 252
  953.     push af
  954.     inc sp
  955.     ld hl, 8
  956.     push hl
  957.     ld l, (ix-2)        ; load value from local i
  958.     ld h, (ix-1)
  959.     ex de, hl
  960.     ld hl, 7
  961.     or a
  962.     sbc hl, de
  963.     push hl
  964.     ld l, (ix-2)        ; load value from local i
  965.     ld h, (ix-1)
  966.     ex de, hl
  967.     ld hl, 216
  968.     add hl, de
  969.     push hl
  970.     call _line
  971.     ld hl, 7
  972.     add hl, sp
  973.     ld sp, hl
  974. ; FuncCallAst @76,9 : line
  975.     ld a, 28
  976.     push af
  977.     inc sp
  978.     ld hl, 8
  979.     push hl
  980.     ld l, (ix-2)        ; load value from local i
  981.     ld h, (ix-1)
  982.     ex de, hl
  983.     ld hl, 7
  984.     or a
  985.     sbc hl, de
  986.     push hl
  987.     ld l, (ix-2)        ; load value from local i
  988.     ld h, (ix-1)
  989.     ex de, hl
  990.     ld hl, 224
  991.     add hl, de
  992.     push hl
  993.     call _line
  994.     ld hl, 7
  995.     add hl, sp
  996.     ld sp, hl
  997. ; FuncCallAst @77,9 : line
  998.     ld a, 31
  999.     push af
  1000.     inc sp
  1001.     ld hl, 8
  1002.     push hl
  1003.     ld l, (ix-2)        ; load value from local i
  1004.     ld h, (ix-1)
  1005.     ex de, hl
  1006.     ld hl, 7
  1007.     or a
  1008.     sbc hl, de
  1009.     push hl
  1010.     ld l, (ix-2)        ; load value from local i
  1011.     ld h, (ix-1)
  1012.     ex de, hl
  1013.     ld hl, 232
  1014.     add hl, de
  1015.     push hl
  1016.     call _line
  1017.     ld hl, 7
  1018.     add hl, sp
  1019.     ld sp, hl
  1020. ; Loop body end
  1021. ; Loop step start
  1022. .STEPLOOP_51:
  1023.     ld l, (ix-2)        ; load value from local i
  1024.     ld h, (ix-1)
  1025.     inc hl
  1026.     ld (ix-2), l        ; store value to local i(int16)
  1027.     ld (ix-1), h
  1028. ; Loop step end
  1029.     jp .LOOP_51
  1030. .ENDLOOP_51:
  1031. ; FuncCallAst @80,5 : gotoxy
  1032.     ld bc, 6916         ; 27,4
  1033.     call lib.gotoxy
  1034. ; PrintAst @80,19
  1035.     ld hl, @str_1
  1036.     call lib.printString
  1037. ; FuncCallAst @81,5 : gotoxy
  1038.     ld bc, 6921         ; 27,9
  1039.     call lib.gotoxy
  1040. ; PrintAst @81,19
  1041.     ld hl, @str_2
  1042.     call lib.printString
  1043. ; FuncCallAst @82,5 : gotoxy
  1044.     ld bc, 6926         ; 27,14
  1045.     call lib.gotoxy
  1046. ; PrintAst @82,20
  1047.     ld hl, @str_3
  1048.     call lib.printString
  1049. ; FuncCallAst @83,5 : gotoxy
  1050.     ld bc, 6931         ; 27,19
  1051.     call lib.gotoxy
  1052. ; PrintAst @83,20
  1053.     ld hl, @str_4
  1054.     call lib.printString
  1055. ; FuncCallAst @85,5 : paper
  1056.     ld a, 0x11          ; ROM paper
  1057.     rst 0x10
  1058.     ld a, 7
  1059.     rst 0x10
  1060. ; FuncCallAst @86,5 : ink
  1061.     ld a, 0x10          ; ROM ink
  1062.     rst 0x10
  1063.     ld a, 0
  1064.     rst 0x10
  1065. ; FuncCallAst @87,5 : bright
  1066.     ld a, 0x13          ; ROM bright
  1067.     rst 0x10
  1068.     ld a, 1
  1069.     rst 0x10
  1070. ; FuncCallAst @88,5 : gotoxy
  1071.     ld bc, 6917         ; 27,5
  1072.     call lib.gotoxy
  1073. ; PrintAst @88,20
  1074.     ld hl, @str_5
  1075.     call lib.printString
  1076. ; FuncCallAst @89,5 : gotoxy
  1077.     ld bc, 6922         ; 27,10
  1078.     call lib.gotoxy
  1079. ; PrintAst @89,20
  1080.     ld hl, @str_5
  1081.     call lib.printString
  1082. ; FuncCallAst @90,5 : gotoxy
  1083.     ld bc, 6927         ; 27,15
  1084.     call lib.gotoxy
  1085. ; PrintAst @90,20
  1086.     ld hl, @str_5
  1087.     call lib.printString
  1088. ; FuncCallAst @91,5 : gotoxy
  1089.     ld bc, 6932         ; 27,20
  1090.     call lib.gotoxy
  1091. ; PrintAst @91,20
  1092.     ld hl, @str_5
  1093.     call lib.printString
  1094. .ENDFUNC_50:
  1095.     ld sp, ix
  1096.     pop ix
  1097.     ret
  1098. ___ticksperframe__  dw  0
  1099. _last   dw  -1
  1100. _best   dw  -32768
  1101. _hits   dw  0
  1102. _count  dw  0
  1103. _i  dw  0
  1104. _j  dw  -106
  1105. _s  dw  0
  1106. @str_0  db  32,0,"ZXPrinter's Trick Shot          "
  1107. @str_1  db  5,0,"x-vel"
  1108. @str_2  db  5,0,"y-vel"
  1109. @str_3  db  5,0,"y-max"
  1110. @str_4  db  5,0,"Hits "
  1111. @str_5  db  5,0," 0   "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement