Previous Thread
Next Thread
Print Thread
Page 37 of 46 1 2 35 36 37 38 39 45 46
Re: 8bit Apples - Apple I, II, /// and the 16 bit GS [Re: Golden Child] #115251 05/09/19 02:47 PM
Joined: Feb 2014
Posts: 280
G
Golden Child Offline
Senior Member
Offline
Senior Member
G
Joined: Feb 2014
Posts: 280
More fun:

I thought I'd see if I could figure out the AlphaSyntauri keyboard:

[Linked Image]

Hacking on the apple2e driver, I think I've figured it out:

If I put the keyboard interface in slot 7, the i/o addresses would be c0f0-c0ff (c080+70 to c08f + 70) and it looks like it's actually pretty simple (though getting there was hard and exasperating, I don't know how you guys figure out the really hard stuff).

Using the AlphaSyntauri alphaplus software as my testing ground,
There are 61 keys for a 5 octave keyboard, 12 for each octave * 5 plus the start of one extra octave.

The lower 8 bytes (c0f0-c0f7) are the key off bits.
The upper 8 bytes (c0f8-c0ff) are the key on bits.

(corrected this - oops - need more sleep)

c0f0,c0f8 bit 0 = lowest octave c
c0f0,c0f8 bit 1 = + 8 half tones from c (c#,d,d#,e,f,f#,g,g#) g#
c0f0,c0f8 bit 2 = + 8 half tones (a,a#,b,c,c#,d,d#,e) e
c0f0,c0f8 bit 3 = + 24 half tones (f,f#,g,g#,a,a#,b,c) ( 2 octaves higher c)
c0f0,c0f8 bit 4 = + 32 half tones g#
c0f0,c0f8 bit 5 = + 40 half tones e
c0f0,c0f8 bit 6 = + 48 half tones ( 4 octaves higher c)
c0f0,c0f8 bit 7 = + 56 half tones
...

c0f1 - starts at c#, bits increment at +8 half tones
c0f2 - starts at d, bits increment at +8 half tones


and etc.

I haven't figured everything out yet, like how you can do velocity sensitive key testing? or how the pedals map into this, but it's a start.

According to an article I found:
Quote

Velocity sensing. Each key on the alphaSyntauri keyboard has two electrical contacts, one of which makes [contact] about one-third of the key-down travel, the other of which makes [contact] at the bottom. When a key is pressed, the following occurs:

The lower contact closes. A count register in the Apple II's memory which is assigned and maintained for each key is set to zero. No other action takes place.
The upper contact closes. The accumulated count value in the key's timing register is used to index into the velocity assignment table. Attack rate and attack target volume (envelope) of the oscillators are determined. (Note, both attack rate and attack volume are varied. Psychoacoustic research tells us that we perceive loudness to increase not only with absolute loudness increase, but also as a function of the rate of increase and the linearity of the curve.)
A new oscillator is assigned for the key which has been pressed.



I added a bunch more buttons to the apple joystick so now I have 16 buttons to map:

(I just don't have enough keys on the keyboard, I'm gonna have to figure out how to do multiple keyboards on Ubuntu)

Code
      PORT_START("joystick_buttons")
        PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)  PORT_PLAYER(1)            PORT_CODE(KEYCODE_0_PAD)    PORT_CODE(JOYCODE_BUTTON1)
        PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2)  PORT_PLAYER(1)            PORT_CODE(KEYCODE_ENTER_PAD)PORT_CODE(JOYCODE_BUTTON2)
        PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1)  PORT_PLAYER(2)            PORT_CODE(JOYCODE_BUTTON1)
        PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2)  PORT_PLAYER(2)            PORT_CODE(JOYCODE_BUTTON2)
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3)  PORT_PLAYER(1)            PORT_CODE(JOYCODE_BUTTON3)
        PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON4)  PORT_PLAYER(1)            PORT_CODE(JOYCODE_BUTTON4)
        PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON5)  PORT_PLAYER(1)            PORT_CODE(JOYCODE_BUTTON5)
        PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON6)  PORT_PLAYER(1)            PORT_CODE(JOYCODE_BUTTON6)
        PORT_BIT( 0x20000, IP_ACTIVE_HIGH, IPT_BUTTON7)  PORT_PLAYER(1)         PORT_CODE(JOYCODE_BUTTON7)
        PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_BUTTON8)  PORT_PLAYER(1)            PORT_CODE(JOYCODE_BUTTON8)
        PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_BUTTON9)  PORT_PLAYER(1)            PORT_CODE(JOYCODE_BUTTON9)
        PORT_BIT( 0x400, IP_ACTIVE_HIGH, IPT_BUTTON10)  PORT_PLAYER(1)            PORT_CODE(JOYCODE_BUTTON10)
        PORT_BIT( 0x800, IP_ACTIVE_HIGH, IPT_BUTTON11)  PORT_PLAYER(1)            PORT_CODE(JOYCODE_BUTTON11)
        PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_BUTTON12)  PORT_PLAYER(1)            PORT_CODE(JOYCODE_BUTTON12)
        PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON13)  PORT_PLAYER(1)            PORT_CODE(JOYCODE_BUTTON13)
        PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON14)  PORT_PLAYER(1)            PORT_CODE(JOYCODE_BUTTON14)
        PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON15)  PORT_PLAYER(1)            PORT_CODE(JOYCODE_BUTTON15)
        PORT_BIT( 0x10000, IP_ACTIVE_HIGH, IPT_BUTTON16)  PORT_PLAYER(1)            PORT_CODE(JOYCODE_BUTTON16)


and then mangled READ8_MEMBER(apple2e_state::c080_r) some more:

Code
if ((offset<=0x70) && (offset<=0x7f))  if (m_joybuttons->read() & 0x20000) printf("m_joybuttons = %x\n",m_joybuttons->read());
if ((offset>=0x70) && (offset<=0x70)) return ((m_joybuttons->read() & 0x10) ? 0xff : 0); 
else if ((offset==0x71)) return ((m_joybuttons->read() & 0x20) ? 0xff : 0);  
else if ((offset==0x72)) return ((m_joybuttons->read() & 0x40) ? 0xff : 0); 
else if ((offset==0x73)) return ((m_joybuttons->read() & 0x80) ? 0xff : 0); 
else if ((offset==0x74)) return ((m_joybuttons->read() & 0x01) ? 0xff : 0); 
else if ((offset==0x75)) return ((m_joybuttons->read() & 0x02) ? 0xff : 0); 

etc.



returning 0xff from c0f8
[Linked Image]

returning 0xff from c0fc

(hey I hit the high c! note that there are 5 octaves, 12 tones per octave, each bar is 3 lo-res pixels wide. Screen display has 5 rows, each with 12 bars, top most row has 13 bars)
[Linked Image]

returning 0xff from c0f8 to c0fe: (do you think I can be the organist for the movie Interstellar?)
[Linked Image]

and had to map all of the buttons in the ui:
(so many buttons to map, I didn't want the side effect of pressing keys on the emulated keyboard, the numeric pad came in handy)

[Linked Image]

What would be really awesome is to get a real midi keyboard and map that to an emulated AlphaSyntauri keyboard.

Last edited by Golden Child; 05/09/19 05:23 PM.
Re: 8bit Apples - Apple I, II, /// and the 16 bit GS [Re: rfka01] #115252 05/09/19 05:40 PM
Joined: Mar 2001
Posts: 16,273
R
R. Belmont Offline
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,273
Neat! Schematics of the keyboard interface and keyboard are on http://www.appleii-box.de/H212_0_AppleIIalphaSyntauriPage.htm smile

Re: 8bit Apples - Apple I, II, /// and the 16 bit GS [Re: R. Belmont] #115256 05/10/19 12:08 PM
Joined: Feb 2014
Posts: 280
G
Golden Child Offline
Senior Member
Offline
Senior Member
G
Joined: Feb 2014
Posts: 280
I think I understand how it does the velocity sensitive aspect, there are two paired addresses for each set of keys

C0F0 and it's companion at +8 bytes C0F8 (and the rest, C0F1-C0F9, C0F2-C0FA etc)

and the lower address is the lower keyswitch, the upper address is the upper keyswitch.

If I map a controller button to an address and hit both buttons simultaneously, it will make it louder with the velocity piano.

Hitting the button for the upper address only (upper keyswitch) and releasing will turn it on and leave the sound on.

Hitting the button for the lower address only (lower keyswitch) and releasing will only shut the sound off, not turn it on.



Been thinking about how to read the midi controller, it looks like I can just open the midi device and start reading bytes. Now I've gotta find a usb midi interface, I know it's around here somewhere 8-)

https://ccrma.stanford.edu/~craig/articles/linuxmidi/input/section1.html

Re: 8bit Apples - Apple I, II, /// and the 16 bit GS [Re: rfka01] #115257 05/10/19 12:45 PM
Joined: Mar 2001
Posts: 16,273
R
R. Belmont Offline
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,273
MAME has a built-in MIDI framework using the PortMIDI library. Add a MIDI IN port to your card and parse the incoming 31500 bps serial data (look at the Apple II MIDI card for details).

Re: 8bit Apples - Apple I, II, /// and the 16 bit GS [Re: R. Belmont] #115258 05/10/19 02:55 PM
Joined: Feb 2014
Posts: 280
G
Golden Child Offline
Senior Member
Offline
Senior Member
G
Joined: Feb 2014
Posts: 280
Thanks for the suggestion, RB. I found a PDF of the Passport MIDI that I'm going to study. It tells about the PTM and the ACIA (so many acronyms 8-)

Just for fun, I was curious how many times the AlphaSyn reads the keyboard per second.

Let's throw some code into READ8_MEMBER(apple2e_state::c080_r)

Code
static int readcounter[16];
static double lastinterval;

if (machine().time().as_double() > lastinterval) {
lastinterval=machine().time().as_double()+5.0;
printf("%f  : ",lastinterval);
for (int i=0;i<16;i++) {printf("%d=%3d ",i,readcounter[i]); readcounter[i]=0;} printf("\n");
}
if ((offset>=0x70) && (offset<=0x7f)) readcounter[offset-0x70]+=1;


which produces this output:
Code
306.151057  : 0=7634 1=7634 2=7634 3=7634 4=7634 5=7634 6=7634 7=7634 8=7633 9=7633 10=7633 11=7633 12=7633 13=7633 14=7633 15=7634 
311.151146  : 0=7623 1=7623 2=7623 3=7623 4=7623 5=7623 6=7623 7=7623 8=7624 9=7624 10=7624 11=7624 12=7624 13=7624 14=7624 15=7624 
316.151269  : 0=7634 1=7634 2=7634 3=7634 4=7634 5=7634 6=7634 7=7634 8=7634 9=7634 10=7634 11=7634 12=7634 13=7634 14=7634 15=7634 


It looks like about 7600 times per 5.0 second interval or 1520 times per second.

7600/5 = 1520

5.0 / 7600 = 0.00065789473 seconds per read which is 25x faster than checking it every 1/60 of a second.

so I think it could definitely detect how quickly the switches change for velocity sensing.

Re: 8bit Apples - Apple I, II, /// and the 16 bit GS [Re: rfka01] #115259 05/10/19 05:49 PM
Joined: Mar 2001
Posts: 16,273
R
R. Belmont Offline
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,273
See if you can figure out the timing range for minimum velocity to full velocity. I can handle emulating the keyboard card with a MIDI input then.

Re: 8bit Apples - Apple I, II, /// and the 16 bit GS [Re: R. Belmont] #115260 05/10/19 07:23 PM
Joined: Feb 2014
Posts: 280
G
Golden Child Offline
Senior Member
Offline
Senior Member
G
Joined: Feb 2014
Posts: 280
Hi RB, ok let's see if we can figure out the delay:

Making a saveitem of m_testdelay:

Code
static int mykeystate=0;
static double mykeysecondtimedown;

if ((m_joybuttons->read()&0x10) && (mykeystate==0))  // state 0 = key up
{             mykeystate=1;
              mykeysecondtimedown=machine().time().as_double()+(1.0/1520)*m_testdelay;
              printf("delay = %f\n",mykeysecondtimedown-machine().time().as_double());
}
else if (!(m_joybuttons->read()&0x10))  // button up, set keystate to 0
               mykeystate=0;

if ((offset==0x70)) // c0f0 slot 7
{           if ((mykeystate==1) && (machine().time().as_double() > mykeysecondtimedown))
                return 0xff;
           else
                return 0;
}
else if ((offset==0x78)) // c0f0 slot 7
if (mykeystate==1) return 0xff; else return 0;



Code
print (emu.item(emu:items()["Apple //e/:/0/m_testdelay"]):write(0,0))   -- loudest
print (emu.item(emu:items()["Apple //e/:/0/m_testdelay"]):write(0,12))   -- quietest



using 1/1520 as a reference I was able to see that it got the quietest on 12 * 1/1520 of delay. More than 12x didn't see to make a difference. So I'd say it goes from 0 delay to 12x.


12 = delay = 0.007895



I ran the Alphaplus software and pressed the 0 key for "Velocity Piano". The other instruments(1-9) don't seem to be velocity sensitive.


If you hit CTRL+T in AlphaPlus there are adjustments that can be made to the Velocity Sensitivity.

0 = most sensitive, 7 is least

(p.67 of the alphaplus tutorial manual)

[Linked Image]

Re: 8bit Apples - Apple I, II, /// and the 16 bit GS [Re: Golden Child] #115261 05/10/19 10:08 PM
Joined: Feb 2014
Posts: 280
G
Golden Child Offline
Senior Member
Offline
Senior Member
G
Joined: Feb 2014
Posts: 280
Ok, there's 61 keys, and 8 bytes with 8 bits each for 64 possible keys. So the pedals must be in the high bits of bytes 5, 6 or 7.

Testing it out, it looks like the sustain pedal is byte 6, bit 7 0x80 of address C0F6 (for slot 7). I don't think it worries about the pedals being velocity sensitive, just on or off.

The portamento pedal I couldn't hear the difference (it's supposed to sweep the pitch from one note to the other) but it must be the high bit of either byte 5 or 7.

Re: 8bit Apples - Apple I, II, /// and the 16 bit GS [Re: rfka01] #115262 05/11/19 05:51 AM
Joined: Sep 2013
Posts: 14
S
Spk Offline
Member
Offline
Member
S
Joined: Sep 2013
Posts: 14
I've been playing with Apple IIgs SCSI drives in MAME .209 and they work great. I can get both cd-roms and hard-drives mounted and functioning together. And I can boot from a cd-rom on its own.

But when I try to boot directly off a SCSI hard-drive with no cd-rom, the IIgs hangs for about 60 seconds before starting to boot, after which it's all good.

So this command works:

mame64 apple2gs -sl7 scsi -hard1 D:\Mame\software\apple2gs\SCSIHD.chd -sl7 scsi -cdrom1 D:\Mame\software\apple2gs\cd.iso

And so does this:

mame64 apple2gs -sl7 scsi -cdrom1 D:\Mame\software\apple2gs\cd.iso

But this results in a temporary hang:

mame64 apple2gs -sl7 scsi -hard1 D:\Mame\software\apple2gs\SCSIHD.chd

Is there a command to set the cd-rom to null when just using a SCSI hard-drive?

Re: 8bit Apples - Apple I, II, /// and the 16 bit GS [Re: rfka01] #115264 05/11/19 10:58 AM
Joined: Mar 2001
Posts: 16,273
R
R. Belmont Offline
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,273
Indeed there is! You can actually set the 6 SCSI IDs to any combination of hard disks and CD-ROMs like so. These are only valid after "-sl7 scsi" of course.

-sl7:scsi:scsibus:1 "" (no device)
-sl7:scsi:scsibus:1 harddisk
-sl7:scsi:scsibus:2 cdrom


By default, the hard disk is SCSI ID 6 and the CD-ROM is ID 1.

I'm also gonna investigate if there's some way to speed up the timeout without removing the CD-ROM drive.

Page 37 of 46 1 2 35 36 37 38 39 45 46

Who's Online Now
2 registered members (mixmaster, Dorando), 91 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,673
Posts113,788
Members4,852
Most Online418
Aug 14th, 2019
Powered by UBB.threads™ PHP Forum Software 7.7.3