Chiptunes-pms150c.git
7 months agoAdd Readme master
Tobias Girstmair [Sun, 2 May 2021 15:03:04 +0000 (17:03 +0200)]
Add Readme

7 months agomake sram section absolute
Tobias Girstmair [Sun, 2 May 2021 14:41:09 +0000 (16:41 +0200)]
make sram section absolute

since the note selection code depends on absolute addresses, make it
explicit. this doesn't change anything in the output.

7 months agofix IDXM'ing of the wrong notes
Tobias Girstmair [Fri, 30 Apr 2021 17:10:28 +0000 (19:10 +0200)]
fix IDXM'ing of the wrong notes

turns out, set1 M.n can only be used with 4-bit memory addresses, but
those are used by the notes array. supplying a 5-bit address (0x16 in
our case) causes it to be silently truncated (to 0x06, which
incidentally already has the modified bit set, so no change was
visible). this does not appear to be mentioned in the datasheet, but the
free-pdk instruction set documentation notes the allowed length of the
memory address.

even though this introduces two additional cycles per g(), the totoal
cycle count estimation is still (as) accurate, because we overestimated
the multiplication cycles by the same amount (0x9d is most "expensive"
number, takes 55 cycles).

for debugging this, ucsim (distributed with sdcc) was very helpful. the
setup looked like this:
- interrupt and timers not supported, so call interrupt() in a loop after init()
- disable the t1sn intrq check and s/reti/ret/i, since we are now
  calling interrupt() directly
- remove ENGINT instruction, as it halts ucsim ("invalid instruction")
- in the OSEG (ram), add a new variable `simif: .ds 1 ;0x18`
- to output a byte to a file, write 'w' to simif, then the byte to send.
  mov a, #'w'
  mov simif, a
  mov a, the_value
  mov simif, a
- run the debugger for a few seconds, then ^C to quit:
  spdk -Pt PDK13 -I if='ram[0x18],out='/tmp/out.bin -g bsv.ihx
- recreate the same screnario with bsv.c (e.g. fakeasm) using putchar()
- vimdiff each <(<$FILE head -c131072 | xxd | sed 's/^[0-9a-f]://' | uniq -c)

7 months agoadd option to simulate program to makefile
Tobias Girstmair [Fri, 30 Apr 2021 11:59:49 +0000 (13:59 +0200)]
add option to simulate program to makefile

7 months agoproperly clear pa,tm2b,pwm; explain paph use
Tobias Girstmair [Wed, 28 Apr 2021 07:26:25 +0000 (09:26 +0200)]
properly clear pa,tm2b,pwm; explain paph use

7 months agobetter way to skip calibration when programming same chip multiple times
Tobias Girstmair [Wed, 28 Apr 2021 07:24:27 +0000 (09:24 +0200)]
better way to skip calibration when programming same chip multiple times

7 months agofix notes bank selection
Tobias Girstmair [Tue, 27 Apr 2021 19:27:26 +0000 (21:27 +0200)]
fix notes bank selection

we want the 2nd "bank" when i2&3 != 0, so when f.z is not set. hence, we
want to skip adding 8 to the index when f.z is set. yep, it's confusing.

7 months agofix IDXR invocation and minor bugs
Tobias Girstmair [Tue, 27 Apr 2021 14:37:49 +0000 (16:37 +0200)]
fix IDXR invocation and minor bugs

- IDXR was called with the wrong endianness, and the hi-byte of notes_ix
  is now properly cleared. also, we use one less SRAM location.
- in the big multiplication in g(), we accidentally used SRC instead of
  SR in some places. by pure chance the bug wasn't triggered.
- some space is now left after the interrupt vector, so new code can be
  appended to the end, and the GOTO programmed 'over' with a NOP.
- fix some typos in comments.

this gets the music mostly working; there are some wrong notes, but it
is recongizable.

7 months agoincrease PWM frequency to 64kHz
Tobias Girstmair [Tue, 27 Apr 2021 08:15:07 +0000 (10:15 +0200)]
increase PWM frequency to 64kHz

audio is still borked, though

7 months agomake timer16 overflow every 512 cycles
Tobias Girstmair [Tue, 27 Apr 2021 08:07:49 +0000 (10:07 +0200)]
make timer16 overflow every 512 cycles

music is still _way_ to slow; need to investigate.

7 months agofix debug signal
Tobias Girstmair [Tue, 27 Apr 2021 07:58:05 +0000 (09:58 +0200)]
fix debug signal

the binary representation of set1 and set0 make it possible to do this
in-place. also commenting out the calibration placeholder, so we don't
break it during re-programming.

7 months agoupdate cycle count
Tobias Girstmair [Mon, 26 Apr 2021 14:09:59 +0000 (16:09 +0200)]
update cycle count

7 months agouse Makefile from test programs
Tobias Girstmair [Mon, 26 Apr 2021 13:58:00 +0000 (15:58 +0200)]
use Makefile from test programs

7 months agosave 1 instruction cycle
Tobias Girstmair [Mon, 26 Apr 2021 07:26:28 +0000 (09:26 +0200)]
save 1 instruction cycle

7 months agoadd initialisation code
Tobias Girstmair [Mon, 26 Apr 2021 07:22:58 +0000 (09:22 +0200)]
add initialisation code

prototyped seperately as 06-timer16ivr-v2/main.asm

8 months agoadd cycle count and some comments
Tobias Girstmair [Fri, 12 Mar 2021 18:42:27 +0000 (19:42 +0100)]
add cycle count and some comments

8 months agotransscribe fakeasm to realasm
Tobias Girstmair [Fri, 5 Mar 2021 13:27:59 +0000 (14:27 +0100)]
transscribe fakeasm to realasm

the memory locations (w.r.t. aliases) have been set/fixed, too.

8 months agonew version
Tobias Girstmair [Fri, 5 Mar 2021 13:20:28 +0000 (14:20 +0100)]
new version

a1 and a2 had to be renamed, since the sdcc-assembler complains about
them (yes, i started working on the port to realasm already).

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 22:30:41 +0000 (23:30 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 22:30:05 +0000 (23:30 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 22:17:40 +0000 (23:17 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 22:16:27 +0000 (23:16 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 21:44:02 +0000 (22:44 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 21:41:24 +0000 (22:41 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 21:39:43 +0000 (22:39 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 21:38:26 +0000 (22:38 +0100)]
new version

code borrowed from attiny version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 17:02:19 +0000 (18:02 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 16:53:23 +0000 (17:53 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 16:34:37 +0000 (17:34 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 15:43:05 +0000 (16:43 +0100)]
new version

notes mapping:
0x84=[0]=[5]
0x9d=[1]=[4]
0xb0=[2]=[A]
0x69=[3]=[6]=[B]=[E]
0x58=[7]=[F]
0x75=[8]=[D]
0x8c=[9]=[C]

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 15:22:52 +0000 (16:22 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 15:15:15 +0000 (16:15 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 15:14:52 +0000 (16:14 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 15:13:38 +0000 (16:13 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 15:12:51 +0000 (16:12 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 15:11:56 +0000 (16:11 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 15:08:22 +0000 (16:08 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 14:59:34 +0000 (15:59 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 14:55:28 +0000 (15:55 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 14:52:25 +0000 (15:52 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 14:52:10 +0000 (15:52 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 14:51:39 +0000 (15:51 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 14:49:20 +0000 (15:49 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 14:41:02 +0000 (15:41 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 14:24:31 +0000 (15:24 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 14:14:41 +0000 (15:14 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 14:02:27 +0000 (15:02 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 13:07:57 +0000 (14:07 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 13:05:26 +0000 (14:05 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 12:57:20 +0000 (13:57 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 12:45:34 +0000 (13:45 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 12:44:52 +0000 (13:44 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 12:41:18 +0000 (13:41 +0100)]
new version

div10 was prototyped with this program:

typedef unsigned char u8;
int main(void) {
for (int i = 0; i <= 0x78; i++) {
u8 real = i/10;
u8 test = i;
i++;

test >>= 1;
test += i;

test >>= 1;
test += 0;

test >>= 1;
test += 0;

test >>= 1;
test += i;

test >>= 1;
test += i;

test >>= 1;
test += 0;

test >>= 1;
test += 0;

test >>= 1;
test += 0;

test >>= 1;
i--;
if (test != real)
printf ("%hhd/10 == %hhd != %hhd\n", i, real, test);
}
return 0;
}

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 12:27:09 +0000 (13:27 +0100)]
new version

div6 was prototyped with this program:

typedef unsigned char u8;
int main(void) {
for (int i = 0; i <= 0x78; i++) {
u8 real = i/6;
u8 test = i;

test >>= 1;
test += i;

test >>= 1;
test += 0;

test >>= 1;
test += i;

test >>= 1;
test += 0;

test >>= 1;
test += i;

test >>= 1;
test += 0;

test >>= 1;
test >>= 1;

if (test != real)
printf ("%hhd/6 == %hhd != %hhd\n", i, real, test);
}
return 0;
}

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 12:26:26 +0000 (13:26 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 12:24:45 +0000 (13:24 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 02:15:59 +0000 (03:15 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 02:07:07 +0000 (03:07 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 01:51:56 +0000 (02:51 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 01:33:22 +0000 (02:33 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 01:31:04 +0000 (02:31 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 01:25:16 +0000 (02:25 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 01:23:59 +0000 (02:23 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 01:14:32 +0000 (02:14 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 01:02:38 +0000 (02:02 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 00:44:48 +0000 (01:44 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 00:43:51 +0000 (01:43 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 00:39:48 +0000 (01:39 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 00:18:52 +0000 (01:18 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 00:17:02 +0000 (01:17 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 00:11:59 +0000 (01:11 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 00:09:10 +0000 (01:09 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 00:07:54 +0000 (01:07 +0100)]
new version

8 months agoonly loop through once
Tobias Girstmair [Thu, 4 Mar 2021 00:06:48 +0000 (01:06 +0100)]
only loop through once

same change as with attiny4 version; allows us to get rid of i3.

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 00:04:04 +0000 (01:04 +0100)]
new version

8 months agonew version
Tobias Girstmair [Thu, 4 Mar 2021 00:01:13 +0000 (01:01 +0100)]
new version

8 months agonew version
Tobias Girstmair [Wed, 3 Mar 2021 23:52:15 +0000 (00:52 +0100)]
new version

8 months agonew version
Tobias Girstmair [Wed, 3 Mar 2021 23:45:49 +0000 (00:45 +0100)]
new version

8 months agonew version
Tobias Girstmair [Wed, 3 Mar 2021 23:42:02 +0000 (00:42 +0100)]
new version

8 months agonew version
Tobias Girstmair [Wed, 3 Mar 2021 23:36:37 +0000 (00:36 +0100)]
new version

8 months agonew version
Tobias Girstmair [Wed, 3 Mar 2021 23:28:46 +0000 (00:28 +0100)]
new version

8 months agonew version
Tobias Girstmair [Wed, 3 Mar 2021 23:26:52 +0000 (00:26 +0100)]
new version

8 months agonew version
Tobias Girstmair [Wed, 3 Mar 2021 23:01:04 +0000 (00:01 +0100)]
new version

8 months agonew version
Tobias Girstmair [Wed, 3 Mar 2021 22:54:41 +0000 (23:54 +0100)]
new version

8 months agoinitial commit
Tobias Girstmair [Wed, 3 Mar 2021 22:52:50 +0000 (23:52 +0100)]
initial commit

Imprint / Impressum