-
Notifications
You must be signed in to change notification settings - Fork 3
/
MCP.pas
176 lines (139 loc) · 3.41 KB
/
MCP.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
{$LIBRARYPATH './midfile/'}
{$LIBRARYPATH './units/'}
{$LIBRARYPATH './includes/'}
{$DEFINE ROMOFF}
{$DEFINE IRQPATCH}
Uses
MIDFiles,
keys,
CIO,
filestr,
screen,
list,
inputline;
{$I-}
{$i 'macros.inc'}
{$i 'const.inc'}
{$r 'player.rc'}
var
_tm:Byte absolute $14;
otm:Byte absolute $13;
ctm:Byte absolute $12;
OSDTm:Byte absolute $D4;
chn:Byte absolute $D5;
oldv:byte absolute $D6;
v:shortint absolute $D7;
_v:byte absolute $D7;
playerStatus:Byte absolute $D8;
screenStatus:Byte absolute $D9;
// this value is initialized by loader
refreshRate:Byte absolute $D2;
totalXMS:Byte absolute $D3;
//
memAvailable:longint;
// selector variables
listScrAdr:array[0..15] of word absolute SCREEN_ADRSES;
lstYscanLine:Byte absolute $57;
lstY:Byte absolute $60;
oldLstY:Byte absolute $5a;
lstShift:SmallInt absolute $5B;
lstCurrent:SmallInt absolute $70;
lstTotal:SmallInt absolute $74;
curPlay:SmallInt absolute $72;
// counter
timeShowMode:Byte = 1;
counter:Longint absolute $88;
cntBCD:Longint absolute $8c;
//
{$i 'interrupt.inc'}
{$i 'NRPM.inc'}
{$i 'osd.inc'}
{$i 'status.inc'}
{$i 'load.inc'}
{$i 'list.inc'}
procedure fileTypeByExt(s:PString); Forward;
{$i 'playlist.inc'}
{$i 'getdirectory.inc'}
{$i 'keyboard.inc'}
{$i 'autostop_songchange.inc'}
{$i 'init.inc'}
{$i 'remote_control.inc'}
begin
asm lda PORTB \ pha end;
init;
// Loader init `outstr` and now its time to check for correct file specification
validPath; // result in '_v' indicate what part of file spec is available
if isBitClr(_v,dp_name) then // if file name is not specified...
createListEntry(fl_device,outStr) // create Device entry type
else
begin
fileTypeByExt(fn);
createListEntry(p_type,fn);
if p_type=fl_midifile then toggleMinMode;
end;
choiceListFile; resultInputLine:=true; keyb:=k_RETURN;
// Player loop
Repeat
processMIDI;
AutoStopAndSongChange;
// plugin_remoteControl;
if timer(otm,refreshRate) then
begin
resetTimer(otm);
if isBitSet(screenStatus,ss_isOSD) then
begin
if OSDTm>200 then OSDOff else inc(OSDTm,refreshRate);
end;
if isBitSet(screenStatus,ss_isRefresh) then
begin
clrBit(screenStatus,ss_isRefresh);
showList;
end;
counter:=_totalTicks;
if isBitSet(playerStatus,ps_calcLen) and (_songTicks>0) then
begin
_v:=(counter div _songTicks)-1;
if _v<>255 then
asm
icl 'asms/song_progress.a65'
end;
end;
scradr:=screen_time+54;
if timeShowMode=1 then
putHex(counter,6)
else if timeShowMode=2 then
begin
asm
icl 'asms/24bin_6bcd.a65'
end;
putHex(cntBCD,6);
end;
asm icl 'asms/uvmeters_h.a65' end;
if isBitSet(stateInputLine,ils_inprogress) then
if timer(ctm,10) then
begin
resetTimer(ctm);
show_inputLine;
end;
end;
if (keyb<>255) then
begin
if isBitSet(screenStatus,ss_isHelp) then toggleHelpScreen;
if stateInputLine=ils_inprogress then do_inputLine;
asm
lda MAIN.KEYS.keyb
asl @
tay
lda KEY_TABLE_ADDR+1,y
beq key_not_defined
sta jump_addr+1
lda KEY_TABLE_ADDR,y
sta jump_addr
jsr jump_addr:$ffff
key_not_defined:
end;
keyb:=255;
end;
until false;
// End player loop
end.