better output in disasm
[urasm.git] / samples / pt3player / muz00.zas
blobf64ccc20587966a5e7dc1bbf2be47beb37ae5bcf
1   org  32768
3 mainEntry:
4   ei
5   include <open-main-screen>
7   xor  a
8   ld   hl,#5800
9   ld   de,#5801
10   ld   bc,#2FF
11   halt
12   out  (#FE),a
13   ld   (hl),a
14   ldir
16   di
17   ld   hl,pt3mod
18   call PT3Time.GetTimeHL
19   ;ld   hl,(PT3Time.PT3TIME)  ; 1/50 sec (intr)
20   ei
21   ;push hl
22   ;ld   a,13
23   ;rst  #10
24   ;call printdechl
25   ;pop  hl
26   inc  hl
27   ld   (time),hl
28   call PrintTime
30   call PT3Player.SetLoopOff
31   ld   hl,pt3mod
32   call PT3Player.InitHL
34 .playloop:
35   halt
36   ld   a,1
37   out  (#fe),a
39   call PT3Player.PlayOneRow
41  DUP 0
42   ; keyboard check
43   xor  a
44   in   a,(#FE)
45   cpl
46   and  #0F
47   jr   nz,.done
48  EDUP
49   ld   hl,(time)
50   dec  hl
51   ld   (time),hl
52   call PrintTime
54   call 8020
55   jr   nc,.done
57   xor  a
58   out  (#fe),a
60   call PT3Player.IsLoopPassed
61   jr   z,.playloop
63 .done:
64   call PT3Player.ResetLoopPassed
65   call PT3Player.Mute
66   jp   0
67   ret
69 min: db 0
70 sec: db 0
71 time: dw 0
74 PrintTime:
75   ld   a,22
76   rst  #10
77   xor  a
78   rst  #10
79   rst  #10
81   ld   de,(time)
82   ld   hl,0
83   ld   bc,50
84   call UDiv3216_16
85   ld   hl,0
86   ld   bc,60
87   call UDiv3216_16
88   ; e: minutes
89   ; l: seconds
90   push hl
91   call Print2Dig
92   ld   a,':'
93   rst  #10
94   pop  de
95   call Print2Dig
96   ret
99 ;; IN: E -- digit
100 Print2Dig:
101   ld   c,-10
102   call .printdig
103   ld   a,'0'
104   add  a,e
105   rst  #10
106   ret
108 .printdig:
109   ld   b,'0'-1
110   ld   a,e
111 .loop:
112   add  a,c
113   inc  b
114   jr   c,.loop
115   sbc  a,c
116   ld   e,a
117   ld   a,b
118   rst  #10
119   ret
121 pt3mod:
122   ;incbin  "mod0.pt3"
123   ;incbin  "Xenophobe - Introduction.pt3"
124   incbin  "Xenophobe - Kill The Creatures.pt3"
126   include <muldiv_slow.inc>
127   include <printdechl>
128   include "pt3plr.zas"
129   include "pt3time.zas"