Jump to content
IGNORED

IntyBASIC compiler v1.2.9: The good things are now better!


Recommended Posts

  • 3 weeks later...

Feature request : volume for music.

It could be used to fade in and out songs and to lower the music in case of relevant sfx or speech (from intellivoice)

 

I second that. I would actually request for per-note volume control. That way, performance control can be simulated, like in MIDI.

Link to comment
Share on other sites

Feature request: music synthesizer support. I really, really want to play with this now :)

 

Attached is an example of how to interface my scan_syn assembly code to IntyBASIC. If you're willing to put up with a few inline assembly statements to get things initialized, you can hook up a pair of routines to receive synth key-down and key-up events. You just need to arrange fro SCAN_SYN to get called regularly.

 

If nanochess wants to integrate this more cleanly into IntyBASIC, by all means do so.

 

This code steals a few bytes from the top of ECS RAM to do its work. As far as I can tell, IntyBASIC doesn't even know about the 2K of ECS RAM from $4040 - $47FF.

 

I haven't tested it on the ECS just yet, but I will soon.

 

All this code is released into the public domain. If nanochess or someone else wants to adapt it into IntyBASIC, great. If you want to just use it as is, also great.

 

The BASIC side of things is really, really simple. Sure there's a dozen lines of inline ASM, but after that, it's all BASIC.

.

' Really simple demonstration of interfacing the Intellivision Synth
' to IntyBASIC with a small external assembly routine.
'
' This demo doesn't play any music.  Rather, it simply fills 3 rows of
' the screen with squares indicating which of the 49 synth keys are 
' currently pressed.  
'
' J. Zbiciak, 2015
' Hereby released to the public domain.

            CONST   syn_key_addr = $47F4 
            DEF FN  syn_key = PEEK( syn_key_addr )

            ASM     INCLUDE "scan_syn.asm"

            CLS

            ' Initialize the synthesizer code.
            ASM     CALL    INIT_SYN        ;' clear all the state vars

            RESTORE my_syn_dn
            ASM     MVI     _read, R0       ;'\   Call 'my_syn_dn' for 
            ASM     MVO     R0, SYNDN       ;' |_ key-down events.  The key
            ASM     SWAP    R0              ;' |  pressed is in syn_key
            ASM     MVO     R0, SYNDN+1     ;'/

            RESTORE my_syn_up
            ASM     MVI     _read, R0       ;'\   Call 'my_syn_up' for 
            ASM     MVO     R0, SYNUP       ;' |_ key-up events.  The key
            ASM     SWAP    R0              ;' |  released is in syn_key
            ASM     MVO     R0, SYNUP+1     ;'/

            ' For this simple demo, just keep repeatedly scanning the 
            ' synthesizer keyboard

forever:    ASM     CALL    SCAN_SYN
            GOTO    forever


            ' On key-down, go put a '#' on the screen according to the 
            ' key number.  Keys 0-15 go in row 5, keys 16-31 go in row 6 
            ' and keys 32-48 go in row 7.
my_syn_dn:  PROCEDURE
            ofs = syn_key
            IF ofs >= 32 THEN ofs = ofs + 4
            IF ofs >= 16 THEN ofs = ofs + 4
            PRINT AT ofs + 102 COLOR 7, "#"
            END 

            ' On key-up, go put a ' ' on the screen according to the 
            ' key number.  Keys 0-15 go in row 5, keys 16-31 go in row 6 
            ' and keys 32-48 go in row 7.
my_syn_up:  PROCEDURE
            ofs = syn_key
            IF ofs >= 32 THEN ofs = ofs + 4
            IF ofs >= 16 THEN ofs = ofs + 4
            PRINT AT ofs + 102 COLOR 0, " "
            END 


synthbas.zip

Link to comment
Share on other sites

And yes, this is a massive hack because I didn't see an equivalent to VARPTR to get the address of a label associated with a PROCEDURE. Otherwise this could have been a couple POKE statements:

.

            RESTORE my_syn_dn
            ASM     MVI     _read, R0       ;'\   Call 'my_syn_dn' for 
            ASM     MVO     R0, SYNDN       ;' |_ key-down events.  The key
            ASM     SWAP    R0              ;' |  pressed is in syn_key
            ASM     MVO     R0, SYNDN+1     ;'/
  • Like 1
Link to comment
Share on other sites

*drool*. Can't wait till I get home and have some spare time. The ECS etc will work just fine with a model 1 console, right? I don't think I want to be timing the reset button that much, so my dev setup may end up being frankenkit.

 

I assume that a synth-based game is simply detecting keypresses, and playing an appropriate tone for as long as it's depressed. It only now occurs to me that there's no actual "music" generation happening here; this is simply a 49 button controller. All the magic has to happen within the ROM itself.

 

Need to brainstorm some random and wacky ideas for this thing. Yay, a piano player! And um... what the hell other kinds of games/programs can you really do with something like this? No wonder no one else made one of these :lol:

Link to comment
Share on other sites

The ECS etc will work just fine with a model 1 console, right?

 

Yep, works just dandy! I do a lot of my testing with various combinations of Inty1 or Inty2, ECS and Intellivoice. They may not all match in appearance, but they're all compatible.

 

 

I assume that a synth-based game is simply detecting keypresses, and playing an appropriate tone for as long as it's depressed. It only now occurs to me that there's no actual "music" generation happening here; this is simply a 49 button controller. All the magic has to happen within the ROM itself.

 

Yep, it's a big 49-button controller. It's got a full complement of diodes so there's zero ghosting. All 49 keys are fully independent. The SCAN_SYN code I posted uses a callback architecture to deliver keyup/keydown events back to the host program from the main scanning routine that's meant to be called periodically. If you want a different architecture, you'll have to modify the code.

 

All tone generation and association between tones and keys is up to the ROM itself. If you dig through the programming forum archives, I believe you can find my original synth program which does play notes.

 

The SCAN_SYN code I posted above is nearly identical to the SCAN_SYN driver in that demo. I made a couple minor modifications to integrate it into IntyBASIC. I've placed both versions in the public domain. Folks, go nuts!

Edited by intvnut
Link to comment
Share on other sites

Feature request: music synthesizer support. I really, really want to play with this now :)

 

I was scratching my head reading this, but you mean music keyboard! :)

 

I didn't knew it was called music synthetizer.

 

Feature request : volume for music.

It could be used to fade in and out songs and to lower the music in case of relevant sfx or speech (from intellivoice)

 

Oh yes! I've this in my list since First Spear requested it.

 

 

I second that. I would actually request for per-note volume control. That way, performance control can be simulated, like in MIDI.

 

That would require a change in music format.

 

Lol! You've had one for fifteen minutes that you got from the back of some guy's car in an underground garage and you already want to program with it.

 

:) :) :)

 

 

I third this.

 

(I eight the sandbox?)

 

:) :thumbsup:

 

 

 

Attached is an example of how to interface my scan_syn assembly code to IntyBASIC. If you're willing to put up with a few inline assembly statements to get things initialized, you can hook up a pair of routines to receive synth key-down and key-up events. You just need to arrange fro SCAN_SYN to get called regularly.

 

If nanochess wants to integrate this more cleanly into IntyBASIC, by all means do so.

 

This code steals a few bytes from the top of ECS RAM to do its work. As far as I can tell, IntyBASIC doesn't even know about the 2K of ECS RAM from $4040 - $47FF.

 

I haven't tested it on the ECS just yet, but I will soon.

 

All this code is released into the public domain. If nanochess or someone else wants to adapt it into IntyBASIC, great. If you want to just use it as is, also great.

 

The BASIC side of things is really, really simple. Sure there's a dozen lines of inline ASM, but after that, it's all BASIC.

.

' Really simple demonstration of interfacing the Intellivision Synth
' to IntyBASIC with a small external assembly routine.
'
' This demo doesn't play any music.  Rather, it simply fills 3 rows of
' the screen with squares indicating which of the 49 synth keys are 
' currently pressed.  
'
' J. Zbiciak, 2015
' Hereby released to the public domain.

            CONST   syn_key_addr = $47F4 
            DEF FN  syn_key = PEEK( syn_key_addr )

            ASM     INCLUDE "scan_syn.asm"

            CLS

            ' Initialize the synthesizer code.
            ASM     CALL    INIT_SYN        ;' clear all the state vars

            RESTORE my_syn_dn
            ASM     MVI     _read, R0       ;'\   Call 'my_syn_dn' for 
            ASM     MVO     R0, SYNDN       ;' |_ key-down events.  The key
            ASM     SWAP    R0              ;' |  pressed is in syn_key
            ASM     MVO     R0, SYNDN+1     ;'/

            RESTORE my_syn_up
            ASM     MVI     _read, R0       ;'\   Call 'my_syn_up' for 
            ASM     MVO     R0, SYNUP       ;' |_ key-up events.  The key
            ASM     SWAP    R0              ;' |  released is in syn_key
            ASM     MVO     R0, SYNUP+1     ;'/

            ' For this simple demo, just keep repeatedly scanning the 
            ' synthesizer keyboard

forever:    ASM     CALL    SCAN_SYN
            GOTO    forever


            ' On key-down, go put a '#' on the screen according to the 
            ' key number.  Keys 0-15 go in row 5, keys 16-31 go in row 6 
            ' and keys 32-48 go in row 7.
my_syn_dn:  PROCEDURE
            ofs = syn_key
            IF ofs >= 32 THEN ofs = ofs + 4
            IF ofs >= 16 THEN ofs = ofs + 4
            PRINT AT ofs + 102 COLOR 7, "#"
            END 

            ' On key-up, go put a ' ' on the screen according to the 
            ' key number.  Keys 0-15 go in row 5, keys 16-31 go in row 6 
            ' and keys 32-48 go in row 7.
my_syn_up:  PROCEDURE
            ofs = syn_key
            IF ofs >= 32 THEN ofs = ofs + 4
            IF ofs >= 16 THEN ofs = ofs + 4
            PRINT AT ofs + 102 COLOR 0, " "
            END 


 

I'm amazed by this.

 

I suspect the INCLUDE "scan_syn.asm" should be at end of the IntyBASIC program.

 

Hmmmm! a new feature request for IntyBASIC, procedure addresses ;)

 

To play notes, you can create "music" data in internal 16-bit RAM, first word would be speed, next word would be the note.

 

Then use PLAY varptr(my_music(0))

 

The other way would be to extract the frequency table from intybasic_epilogue.asm and play the simple notes.

  • Like 1
Link to comment
Share on other sites

I suspect the INCLUDE "scan_syn.asm" should be at end of the IntyBASIC program.

 

 

You noticed! :D Actually, if you look at scan_syn.asm, there's a big branch-around. I did this so I wouldn't get warnings about forward references to SET/EQU symbols. (SYNDN, SYNUP and so on.) So, yeah, the INCLUDE belongs at the top, not the bottom.

  • Like 1
Link to comment
Share on other sites

 

 

You noticed! :D Actually, if you look at scan_syn.asm, there's a big branch-around. I did this so I wouldn't get warnings about forward references to SET/EQU symbols. (SYNDN, SYNUP and so on.) So, yeah, the INCLUDE belongs at the top, not the bottom.

 

Oh! I see. If there is a branch then there is no problem ;)

 

 

BTW... do you like my hack for working around it? :D

 

Impressive and very well thought! :)

 

 

Yep. I'm guessing you didn't / don't have one. It says "Music Synthesizer" right on the keyboard, at least here in the US.

 

attachicon.gifsynth.jpg

 

Okie-dokie! now I'll not forget it :)

  • Like 1
Link to comment
Share on other sites

 

Ah, I also got confused by that. "Why are people calling it a synthesizer? shirley they must know it's just a keyboard..."

 

post-14113-0-78528100-1445370935_thumb.jpg ;) ;) ;) ;) ;) ;)

 

Yeah, the actual synthesizer is the Intellivision itself (specifically, its PSGs). :P

 

Otherwise, I've just been calling it by whatever name it has on the label, even if the name on the label doesn't quite make sense. :)

Edited by intvnut
Link to comment
Share on other sites

I call it the synthesizer so that people don't get it confused with a) the Keyboard component, or b) the ECS keyboard.

 

nanochess, my thinking is that it would be cool to have this available as "only" a controller - and *what* happens in response to a key press is entirely up to the programmer. As opposed to tying it into the MUSIC stuff, or whatever.

 

A 49 key controller is ridiculously impractical. But I do have ideas. Think Ferris Buhler as a tease.

  • Like 2
Link to comment
Share on other sites

I call it the synthesizer so that people don't get it confused with a) the Keyboard component, or b) the ECS keyboard.

 

nanochess, my thinking is that it would be cool to have this available as "only" a controller - and *what* happens in response to a key press is entirely up to the programmer. As opposed to tying it into the MUSIC stuff, or whatever.

 

A 49 key controller is ridiculously impractical. But I do have ideas. Think Ferris Buhler as a tease.

 

I don't know who is Ferris Buhler...

Link to comment
Share on other sites

 

Well, without totally ruining the surprise - let's just say I may want "other" sounds to come from the keyboard, not just musical notes :)

 

Just I searched for the name, I've saw the movie ;) for some reason I didn't remember the name of the character but of course Matthew Broderick.

  • Like 1
Link to comment
Share on other sites

I call it the synthesizer so that people don't get it confused with a) the Keyboard component, or b) the ECS keyboard.

 

nanochess, my thinking is that it would be cool to have this available as "only" a controller - and *what* happens in response to a key press is entirely up to the programmer. As opposed to tying it into the MUSIC stuff, or whatever.

 

A 49 key controller is ridiculously impractical. But I do have ideas. Think Ferris Buhler as a tease.

 

Ahh... I see you're thinking 1980s sampler-synth combo! Welcome to Euro-pop and Elektro! :lol:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...