PDA

View Full Version : Music in EPROM project


Grant Stockly
07-09-2007, 05:42 AM
I want to make a set of EPROMs for VTL-2 for the 8080. The 5th EPROM is only used for 9 bytes. What a waste!

The "Fool on the Hill" and "Daisy" songs from Steve Dompler are 215 bytes long. I used a combination of OCR and hand correction to convert the listing into text. From here I will need to convert the octal into hex. I thought I had located an octal to hex online coverter, but I can't find it now!

FC10-FCFF are free. That's 240 bytes. (Technically there are 6 more bytes ahead of that if we need them). The music COULD be run out of ROM, but then the tempo and start/stop address could not be changed. Also, the modification for playing the song backwards wouldn't be possible.

The loader I came up with is:
01 0000 ;Loader to move 215 bytes from ROM to RAM
02 0000 ;
03 FC28 .EQU SOURCE,H'FC28 ;ADDRESS OF START
04 0000 .EQU DESTINATION,H'0000 ;DESTINATION ADDRESS
05 00D7 .EQU LENGTH,215 ;LENGTH OF COPY
06 0000 ;
07 FC10 .org H'FC10 ;FC10 IS PROGRAM STARTING POINT IN MEMORY
08 FC10 ;
09 FC10 0128FC INIT: LXI B, SOURCE ;STARTING ADDRESS IN ROM FOR SOURCE
10 FC13 110000 LXI D, DESTINATION ;STARTING ADDRESS IN RAM FOR DESTINATION
11 FC16 0A LOADLP: LDAX B ;LOAD BYTE FROM ROM
12 FC17 12 STAX D ;STORE BYTE IN RAM
13 FC18 03 INX B ;INCREASE ROM ADDRESS POINTER BY ONE
14 FC19 13 INX D ;INCREASE RAM ADDRESS POINTER BY ONE
15 FC1A
16 FC1A 7B MOV A,E ;COMPARE LOW MEMORY POINTER TO GOAL
17 FC1B FED7 CPI ((DESTINATION+LENGTH)&H'00FF)
18 FC1D C216FC JNZ LOADLP ;NOT EQUAL, CONTINUE
19 FC20 ; MOV A,D ;COMPARE HIGH MEMORY POINTER TO GOAL
20 FC20 ; CPI ((DESTINATION+LENGTH)&H'FF00)>>8
21 FC20 ; JNZ LOADLP ;NOT EQUAL, CONTINUE
22 FC20
23 FC20 C30000 JMP H'0000 ;MEMORY COPIED, JMP to 0000
DESTINAT=0000
INIT =FC10
LENGTH =00D7
LOADLP =FC16
SOURCE =FC28


I didn't have enough space to do the high address compare, but with only 215 bytes it isn't necessary.

Does anyone see any mistakes?

Here is the data to occur at 0xFC28 to FCFE.

000 LXl H 041
001 b2 xxx
002 b3 xxx
003 MOV A,M 176
004 CPI 376
005 b2 377
006 JZ 312
007 b2 000
010 b3 000

011 MVI D 026
012 b2 xxx
013 DCR B 005
014 JNZ 302
015 b2 020
016 b3 000
017 MOV B,M 106

020 DCR C 015
021 JNZ 302
022 b2 013
023 b3 000
024 DCR D 025
025 JNZ 302
026 b2 013
027 b3 000

030 INR L 054
031 JMP 303
032 b2 003
033 b3 000
034 N/A
035 N/A
036 N/A
037 N/A

040 105
041 105
042 125
043 100
044 071
045 063
046 063
047 063

050 071
051 063
052 055
053 053
054 053
055 055
05รณ 071
057 063

060 046
061 046
062 046
063 071
064 063
065 046
066 046
067 053

070 042
071 046
072 046
073 063
074 071
075 063
076 053
077 053

100 063
101 053
102 071
103 063
104 063
105 071
106 063
107 046

110 046
111 046
112 053
113 042
114 053
115 046
116 046
117 053

120 055
121 053
122 071
123 066
124 100
125 071
126 071
127 100

130 071
131 066
132 066
133 071
134 100
135 100
136 100
137 071

140 066
141 060
142 060
143 066
144 071
145 066
146 066
147 060

150 053
151 046
152 046
153 046
154 046
155 044
156 046
157 053

160 053
161 053
162 053
163 053
164 002
165 002
166 002
167 377

170 034
171 034
172 034
173 042
174 042
175 042
176 053
177 053

200 053
201 071
202 071
203 071
204 063
205 055
206 053
207 063

210 063
211 053
212 071
213 071
214 071
215 071
216 071
217 071

220 046
221 046
222 046
223 034
224 034
225 034
226 042
227 042

230 042
231 053
232 053
233 053
234 063
235 055
236 053
237 046

240 046
241 042
242 046
243 046
244 046
245 046
246 046
247 042

250 040
251 042
252 046
253 034
254 034
255 042
256 046
257 053

260 053
261 053
262 053
263 046
264 042
265 042
266 053
267 063

270 063
271 053
272 063
273 071
274 071
275 071
276 071
277 071

300 053
301 053
302 042
303 046
304 046
305 071
306 053
307 053

310 042
311 046
312 042
313 040
314 034
315 042
316 053
317 046

320 046
321 071
322 053
323 053
324 053
325 053
326 002
327 377

Grant Stockly
07-09-2007, 06:24 AM
I think that I should have added 1 to the test. Because I am increasing the pointer AFTER the copy, I need to be 1 ahead... Unless I put the compare routine BEFORE the copy+increment.

Here is the new version of the code which includes the program/music data. No need for an octal to hex conversion, the assembler can handle it. :)

Anyone see any problems before I burn it? By examining FC10 on the Altair and pressing the "RUN" switch the Altair will begin playing music! Much better than sitting in front of the thing for 45 minutes every time. And all of this in the unused part of the VTL ROM. :D

000001 0000 ;Loader to move 215 bytes from ROM to RAM
000002 0000 ;
000003 FC28 .EQU SOURCE,H'FC28 ;ADDRESS OF START
000004 0000 .EQU DESTINATION,H'0000 ;DESTINATION ADDRESS
000005 00D7 .EQU LENGTH,215 ;LENGTH OF COPY
000006 0000 ;
000007 FC10 .org H'FC10 ;FC10 IS PROGRAM STARTING POINT IN MEMORY
000008 FC10 ;
000009 FC10 0128FC INIT: LXI B, SOURCE ;STARTING ADDRESS IN ROM FOR SOURCE
000010 FC13 110000 LXI D, DESTINATION ;STARTING ADDRESS IN RAM FOR DESTINATION
000011 FC16 0A LOADLP: LDAX B ;LOAD BYTE FROM ROM
000012 FC17 12 STAX D ;STORE BYTE IN RAM
000013 FC18 03 INX B ;INCREASE ROM ADDRESS POINTER BY ONE
000014 FC19 13 INX D ;INCREASE RAM ADDRESS POINTER BY ONE
000015 FC1A
000016 FC1A 7B MOV A,E ;COMPARE LOW MEMORY POINTER TO GOAL
000017 FC1B FED8 CPI ((DESTINATION+LENGTH+1)&H'00FF)
000018 FC1D C216FC JNZ LOADLP ;NOT EQUAL, CONTINUE
000019 FC20 ; MOV A,D ;COMPARE HIGH MEMORY POINTER TO GOAL
000020 FC20 ; CPI ((DESTINATION+LENGTH+1)&H'FF00)>>8
000021 FC20 ; JNZ LOADLP ;NOT EQUAL, CONTINUE
000022 FC20 ;
000023 FC20 C30000 JMP H'0000 ;MEMORY COPIED, JMP to 0000
000024 FC23 ;
000025 FC23 ;*****MUSIC PROGRAM/DATA START*****
000026 FC23 ;
000027 FC23 ;FILLER (FOR EPROM READABILITY)
000028 FC23 0000000000 .db Q'000, Q'000, Q'000, Q'000, Q'000
000029 FC28 ;
000030 FC28 ;PROGRAM (START=000 WHEN COPIED) TEMPO=040, MUSIC START=000040
000031 FC28 2120007EFEFFCA00 .db Q'041, Q'040, Q'000, Q'176, Q'376, Q'377, Q'312, Q'000, Q'000
FC30 00
000032 FC31 162005C2100046 .db Q'026, Q'040, Q'005, Q'302, Q'020, Q'000, Q'106
000033 FC38 0DC20B0015C20B00 .db Q'015, Q'302, Q'013, Q'000, Q'025, Q'302, Q'013, Q'000
000034 FC40 2CC30300 .db Q'054, Q'303, Q'003, Q'000
000035 FC44 ;
000036 FC44 ;FILLER (START=034 WHEN COPIED)
000037 FC44 00000000 .db Q'000, Q'000, Q'000, Q'000
000038 FC48 ;
000039 FC48 ;MUSIC DATA (START=040 WHEN COPIED)
000040 FC48 4545554039333333 .db Q'105, Q'105, Q'125, Q'100, Q'071, Q'063, Q'063, Q'063
000041 FC50 39332D2B2B2D3933 .db Q'071, Q'063, Q'055, Q'053, Q'053, Q'055, Q'071, Q'063
000042 FC58 262626393326262B .db Q'046, Q'046, Q'046, Q'071, Q'063, Q'046, Q'046, Q'053
000043 FC60 2226263339332B2B .db Q'042, Q'046, Q'046, Q'063, Q'071, Q'063, Q'053, Q'053
000044 FC68 332B393333393326 .db Q'063, Q'053, Q'071, Q'063, Q'063, Q'071, Q'063, Q'046
000045 FC70 26262B222B26262B .db Q'046, Q'046, Q'053, Q'042, Q'053, Q'046, Q'046, Q'053
000046 FC78 2D2B393640393940 .db Q'055, Q'053, Q'071, Q'066, Q'100, Q'071, Q'071, Q'100
000047 FC80 3936363940404039 .db Q'071, Q'066, Q'066, Q'071, Q'100, Q'100, Q'100, Q'071
000048 FC88 3630303639363630 .db Q'066, Q'060, Q'060, Q'066, Q'071, Q'066, Q'066, Q'060
000049 FC90 2B2626262624262B .db Q'053, Q'046, Q'046, Q'046, Q'046, Q'044, Q'046, Q'053
000050 FC98 2B2B2B2B020202FF .db Q'053, Q'053, Q'053, Q'053, Q'002, Q'002, Q'002, Q'377
000051 FCA0 1C1C1C2222222B2B .db Q'034, Q'034, Q'034, Q'042, Q'042, Q'042, Q'053, Q'053
000052 FCA8 2B393939332D2B33 .db Q'053, Q'071, Q'071, Q'071, Q'063, Q'055, Q'053, Q'063
000053 FCB0 332B393939393939 .db Q'063, Q'053, Q'071, Q'071, Q'071, Q'071, Q'071, Q'071
000054 FCB8 2626261C1C1C2222 .db Q'046, Q'046, Q'046, Q'034, Q'034, Q'034, Q'042, Q'042
000055 FCC0 222B2B2B332D2B26 .db Q'042, Q'053, Q'053, Q'053, Q'063, Q'055, Q'053, Q'046
000056 FCC8 2622262626262622 .db Q'046, Q'042, Q'046, Q'046, Q'046, Q'046, Q'046, Q'042
000057 FCD0 2022261C1C22262B .db Q'040, Q'042, Q'046, Q'034, Q'034, Q'042, Q'046, Q'053
000058 FCD8 2B2B2B2622222B33 .db Q'053, Q'053, Q'053, Q'046, Q'042, Q'042, Q'053, Q'063
000059 FCE0 332B333939393939 .db Q'063, Q'053, Q'063, Q'071, Q'071, Q'071, Q'071, Q'071
000060 FCE8 2B2B222626392B2B .db Q'053, Q'053, Q'042, Q'046, Q'046, Q'071, Q'053, Q'053
000061 FCF0 222622201C222B26 .db Q'042, Q'046, Q'042, Q'040, Q'034, Q'042, Q'053, Q'046
000062 FCF8 26392B2B2B2B02FF .db Q'046, Q'071, Q'053, Q'053, Q'053, Q'053, Q'002, Q'377
000063 FD00 ;IF THIS LINE ISN'T FD00, WE HAVE A PROBLEM
DESTINAT=0000
INIT =FC10
LENGTH =00D7
LOADLP =FC16
SOURCE =FC28

marty
07-09-2007, 01:34 PM
Hi Grant;
As Soon as I have some time.:p
I will convert your program to octal and enter in at the addresses you have and try to run it on my machine, since it should work, I don't expect any problems, but if there are any, it should show up, I would expect mostly operator error - with the entering - even though I am not using ROM, but Ram instead, that should not make any difference. that will test to see if it is copying all the bytes. And see whether it works !!:eek:
Thanks Marty

marty
07-09-2007, 02:42 PM
Hi Grant;
IF I Remember RIGHT the 'FF' at the end of line 'FCA8' needs to be changed to either '00' or to '02' for the program to play both songs, the 'FF' says to the program to 'stop' and so it won't play the second song. :(
I will find out when I toggle it in my machine. :rolleyes:

marty
07-09-2007, 02:55 PM
Hi Grant;
I put the wrong address for you to look at -- it should be FC98 NOT FCA8.;)
Thanks Marty

Grant Stockly
07-09-2007, 06:41 PM
I typed in the listing with as few changes as I could. I had to add the tempo and starting address because they were not given in the original documentation.

The scans are available here: (half way down the page)

http://www.digibarn.com/collections/weirdstuff/altair-sheetmusic/index.html

marty
07-10-2007, 12:52 AM
I enter the program into my computer at 'FC10' and it copied fine and played the song fool on a hill, but because the 'FF' was not changed as stated in my other message above, it would only play fool on a hill, I had to change the 'FF' to an '02' for it to play both songs.:) Thanks Marty