Author Topic: Can the CPC do this?  (Read 3679 times)

0 Members and 1 Guest are viewing this topic.

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.108
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1276
  • Likes Given: 2557
Can the CPC do this?
« on: 20:43, 30 September 11 »

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1981
  • Likes Given: 4650
Re: Can the CPC do this?
« Reply #1 on: 21:50, 30 September 11 »
Can the CPC do this?


Yes, the CPC can do that, suggested help is the CPC-Booster+.
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

norecess

  • Guest
Re: Can the CPC do this?
« Reply #2 on: 02:03, 01 October 11 »
I don't care actually if CPC can or can not do this.


But the real thing is : wow, this is awesome! The guys who thought about generating PCM such a way (and finding the right algorithm sounding good) are just pure geniouses !


Thanks for sharing this link.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Can the CPC do this?
« Reply #3 on: 12:07, 01 October 11 »
Hmmm tried this in BASIC:
Code: [Select]
10 a=((t OR (t/512 OR t/128))*t AND (t/2048 OR t/512))
20 OUT &FF10,a
30 t=t+1
40 GOTO 10

But after a while I get an Overflow in 10
Whats wrong here?
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Cosi

  • CPC464
  • **
  • Posts: 10
  • Country: pl
    • Vintage Palmtops
  • Liked: 0
  • Likes Given: 2
Re: Can the CPC do this?
« Reply #4 on: 12:37, 01 October 11 »
Maybe the problem is that in BASIC t is represented as a long real number, while C "clears the counter" every time t reaches 65536.

(I'm not into Amstrad's BASIC, so please don't kill me if I'm wrong :) )

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Can the CPC do this?
« Reply #5 on: 13:29, 01 October 11 »
Maybe the problem is that in BASIC t is represented as a long real number, while C "clears the counter" every time t reaches 65536.

(I'm not into Amstrad's BASIC, so please don't kill me if I'm wrong :) )

Sure right,
but the Overflow happens when t=182  :'(
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Cosi

  • CPC464
  • **
  • Posts: 10
  • Country: pl
    • Vintage Palmtops
  • Liked: 0
  • Likes Given: 2
Re: Can the CPC do this?
« Reply #6 on: 13:48, 01 October 11 »
Well... :(

Could you please try to replace those divisions with integer divisions (int(x/y) or something)?

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Can the CPC do this?
« Reply #7 on: 14:33, 01 October 11 »
Sure, this makes no difference  ???
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.378
  • Country: 00
  • Liked: 1286
  • Likes Given: 2030
Re: Can the CPC do this?
« Reply #8 on: 15:07, 01 October 11 »
BASIC will not complete a logical expression with a number over 32767.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Can the CPC do this?
« Reply #9 on: 15:34, 01 October 11 »
BASIC will not complete a logical expression with a number over 32767.

I see... But why? This makes no sense :(
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.378
  • Country: 00
  • Liked: 1286
  • Likes Given: 2030
Re: Can the CPC do this?
« Reply #10 on: 15:51, 01 October 11 »
I see... But why? This makes no sense :(

PRINT 32768 AND 1 fails, but
PRINT &8000 AND 1 works fine.
 
Is this because BASIC treats numbers over 7FFF as negative; ie &8000 (-32768) to &FFFF (-1).
 
If you view this program in DEBUG, you'll see where I'm coming from... but why it refuses to complete logical expressions beyond my technical knowledge.
 
10 a=65535
20 b=&FFFF
 
 
 
EDIT: Here's a slightly updated version of Devilmarkus's BASIC program. This brings the value of t% to 255 before failing (due to numbers beyond FFFF).
Code: [Select]

10 WHILE t%<256
20 a$=HEX$((t% OR (t%/512 OR t%/128))*t%)
30 b$=HEX$(t% OR (t%/2048 OR t%/512))
40 c$=HEX$(VAL("&"+a$) AND VAL("&"+b$))
50 OUT &FF10,VAL("&"+c$)
60 t%=t%+1
70 WEND
And, of course, you can always add a PRINT statement in the routine to see what a$, b$, c$ and t% are doing as you require.
 
EDIT2: Is there a non-CPCBooster OUT command direct to the chip? WinAPE loves silence, but I don't.
« Last Edit: 17:24, 01 October 11 by tastefulmrship »

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Can the CPC do this?
« Reply #11 on: 22:21, 01 October 11 »
Thankyou.
Tried it, also poked the values into RAM, and then played it through Amdrum / Digiblaster.
But sounds strange :D
Code: [Select]
10 adr=&1000
20 WHILE t%<256
30 a$=HEX$((t% OR (t%/512 OR t%/128))*t%)
40 b$=HEX$(t% OR (t%/2048 OR t%/512))
50 c$=HEX$(VAL("&"+a$) AND VAL("&"+b$))
60 POKE adr,VAL("&"+c$):adr=adr+1
70 t%=t%+1
80 WEND
90 FOR t=0 TO 255:OUT &FF10,PEEK(&1000+t):NEXT:GOTO 90
Amdrum! Digiblaster needs port &EF10

http://cpc-live.com/bastest

Perhaps an ASM playback routine would be clearer?

When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.378
  • Country: 00
  • Liked: 1286
  • Likes Given: 2030
Re: Can the CPC do this?
« Reply #12 on: 23:24, 01 October 11 »
Yes, it needs a lot more samples than 256 to sound like those in the original one-liner, but it's surely getting there!
Maybe if someone could run a C program on PC that creates more samples, then take those results and play them through Amdrum or Digiblaster... but that's kinda missing the point!
 
If you amend the program with these lines
60 SOUND 1,VAL("&"+c$),10,15:SOUND 2,VAL("&"+c$)*10,10,15:SOUND 4,VAL("&"+c$),10,15
90 t%=0:GOTO 20
you get a pretty weird tune... which actually sounds quite good further in.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Can the CPC do this?
« Reply #13 on: 23:41, 01 October 11 »
Indeed...
Well I "tried" the routines shown in the video and combined 3 loops to a stereo sound.
Result: (Don't regard the "Ready", I quickly tweaked the audio routine, so no CPC was really used for!)
http://cpc-live.com/craptest

Code was like this:
Code: [Select]
        ppo++;
        if (ppo == 6) {
            r = ((t >> 6 | t | t >> (t >> 16)) * 10 + ((t >> 11) & 7));
            q = (t | (t >> 9 | t >> 7)) * t & (t >> 11 | t >> 9);
            p = ((t & 4096) != 0) ? ((t * (t ^ t % 255) | (t >> 4)) >> 1)
                    : (t >> 3) | (((t & 8192) != 0) ? t << 2 : t);
            t++;
            ppo = 0;
        }
        leftO = ((r & 0x07f) + (q & 0x07f));
        rightO = ((q & 0x07f) + (p & 0x07f));
        player.writeStereo(leftO ^ 0x80, rightO ^ 0x80);
« Last Edit: 23:46, 01 October 11 by Devilmarkus »
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Can the CPC do this?
« Reply #14 on: 23:59, 01 October 11 »
Goal should be a oneliner ;)
So in BASIC:
Code: [Select]
10 FOR t%=0 TO 255:a$=HEX$((t% OR (t%/512 OR t%/128))*t%):b$=HEX$(t% OR (t%/2048 OR t%/512)):c$=HEX$(VAL("&"+a$) AND VAL("&"+b$)):SOUND 3,VAL("&"+c$)*10,10,15:t%=t%+1:NEXT:GOTO 10
But it's really completely different :D
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.378
  • Country: 00
  • Liked: 1286
  • Likes Given: 2030
Re: Can the CPC do this?
« Reply #15 on: 00:14, 02 October 11 »
Code: [Select]
        ppo++;
        if (ppo == 6) {
            r = ((t >> 6 | t | t >> (t >> 16)) * 10 + ((t >> 11) & 7));
            q = (t | (t >> 9 | t >> 7)) * t & (t >> 11 | t >> 9);
            p = ((t & 4096) != 0) ? ((t * (t ^ t % 255) | (t >> 4)) >> 1)
                    : (t >> 3) | (((t & 8192) != 0) ? t << 2 : t);
            t++;
            ppo = 0;
        }
        leftO = ((r & 0x07f) + (q & 0x07f));
        rightO = ((q & 0x07f) + (p & 0x07f));
        player.writeStereo(leftO ^ 0x80, rightO ^ 0x80);
Ok, what happens if you collate a number of results (I dunno, 1000? Maybe even 1000 per channel) from the above code on PC and copy them into CPC memory (as long as they are 8bit, of course), then play them through external audio hardware (Amdrum, Digiblaster)? Does it sound similar to the original? If so, all we need is assem code that can deal with numbers over &FFFF (possible?) and run it through PSG/external hardware.
 

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Can the CPC do this?
« Reply #16 on: 00:17, 02 October 11 »
Well, this could work...
Dunno... Who can code it?
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.378
  • Country: 00
  • Liked: 1286
  • Likes Given: 2030
Re: Can the CPC do this?
« Reply #17 on: 00:24, 02 October 11 »
Can you get get C code to send results to screen/file rather than to PCM?
I don't mind converting the results to CPC and seeing what happens...
 
If someone could get this programmed in assem, we could send it back to the 32/64 bit community before the C64 lot get their mitts on it! One-up for the Amstrad posse!
 

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Can the CPC do this?
« Reply #18 on: 00:37, 02 October 11 »
Well I did this:
A little routine in Java:
Code: [Select]
    public void doSong(){
        for (int t=0; t< 0x4000;t++){
            POKE(0x4000+t,((t >> 6 | t | t >> (t >> 16)) * 10 + ((t >> 11) & 7)));
        }

This produced a 16k samplefile.
This DATA I played via digiblaster with 8khz.
Result:
http://cpc-live.com/sampletest

now we need someone who does ALL in realtime in ASM ;)

When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Can the CPC do this?
« Reply #19 on: 01:04, 02 October 11 »
My DSK:
RUN"64" -> 32k sample to AY
RUN"64D" -> 32k sample to digiblaster
(both use screen ram!)

RUN"128" / RUN"128D" same but using 2 BANKs
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Can the CPC do this?
« Reply #20 on: 01:17, 02 October 11 »
We should do this instead:
Floppy music DUO - Imperial march
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.378
  • Country: 00
  • Liked: 1286
  • Likes Given: 2030
Re: Can the CPC do this?
« Reply #21 on: 11:05, 02 October 11 »
Isn't that the same principle as this;
Renault F1 Car playing God Save The Queen
 
 
I tried to get some "tonal music" from the TAPE loading noise, but it only produces 10 or so original tones and so I had to quit!
 

Offline SyX

  • 6128 Plus
  • ******
  • Posts: 1.129
  • Country: br
  • Liked: 1118
  • Likes Given: 1871
Re: Can the CPC do this?
« Reply #22 on: 13:59, 02 October 11 »
Hi ;)

I have cheated because i'm using the expansion ram how storage for the datas generated by the equation (t>>7|t|t>>6)*10+4*(t&t>>13|t>>6)  (t = 0 - 65535) , mainly because i'm lazy today :P , but for a fast testing you only have to replace the datas in the expansion ram, by the new datas generated for other equation ;)

Of course, the source code for the player:
Code: [Select]
    ORG  $2000

start
    DI

replay
    LD   BC,$7FC4
    OUT  (C),C
    CALL play
    LD   BC,$7FC5
    OUT  (C),C
    CALL play
    LD   BC,$7FC6
    OUT  (C),C
    CALL play
    LD   BC,$7FC7
    OUT  (C),C
    CALL play
    JR   replay

play
    LD   HL,$4000
    LD   B,$EF
loop_play
    DEFS 64 - 14
    LD   A,(HL)
    OUT  (C),A

    INC  HL
    LD   A,H
    CP   $80
    JP   NZ,loop_play
    RET

    END
PD: digi2 replay signed bytes and digi3 unsigned bytes (an extra XOR $80 between LD A,(HL) and OUT (C),A ).
« Last Edit: 14:05, 02 October 11 by SyX »

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Can the CPC do this?
« Reply #23 on: 16:08, 02 October 11 »
Something seem to be weird with your asm source...
Compiled it many times but only 1x I was able to hear the sound?!?

Hummmm... Edit:
I see: you did not generate the data! That was just the playback :D
« Last Edit: 16:19, 02 October 11 by Devilmarkus »
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline SyX

  • 6128 Plus
  • ******
  • Posts: 1.129
  • Country: br
  • Liked: 1118
  • Likes Given: 1871
Re: Can the CPC do this?
« Reply #24 on: 16:39, 02 October 11 »
Yes, Markus, it's only the playback, sorry, jejeje... but i generated the datas using Protext, PhrozenC and Maxam, that it must be a +1 cpc geek point  ;D