Previous Thread
Next Thread
Print Thread
Page 5 of 6 1 2 3 4 5 6
Re: c64 super sketch [Re: Golden Child] #116260 10/23/19 01:50 PM
Joined: Feb 2014
Posts: 354
G
Golden Child Offline OP
Senior Member
OP Offline
Senior Member
G
Joined: Feb 2014
Posts: 354
Chalk Board's LogicMaster is really a lame game, but it's far more interesting to find out how it works. The game is just mastermind with card suits and colors. Personally I like the Coleco Digits game for a mastermind-type game. It'd be an interesting exercise to make a coleco digits overlay and game for the powerpad.

The overlay has got a lot of "buttons", there are 34.


[Linked Image from i.imgur.com]

So let's try to make a list of buttons to press:

Code
int powerpad_map[64][2];  // map buttons to powerpad coordinates


void apple2_state::powerpad_make_buttons(int loc,int xo,int yo, int xnum, int ynum, int xoffset, int yoffset, int xrowoffset, int yrowoffset) {

for (int y=0;y<ynum;y++){
for (int x=0;x<xnum;x++){
       powerpad_map[loc][0]=(xo +xoffset*x + xrowoffset*y);
       powerpad_map[loc][1]=(yo+ yoffset*x + yrowoffset*y);
       printf("Add button  %d  %x  at (%d,%d)\n",loc,loc,powerpad_map[loc][0],powerpad_map[loc][1]);
       powerpad_map[loc][0]*=-1;
       powerpad_map[loc][0]+=119;  // xcoordinates are reversed since x=0 is at the right
       loc++;
}
}
}


Code
static int makebuttonsflag=0;
if (!makebuttonsflag){

powerpad_make_buttons(1*8,38,62,6,1,12,0,0,0);  // 123456 
powerpad_make_buttons(2*8,45,11,2,2,12,-7,12,14);  // suits  
powerpad_make_buttons(3*8,93,5,2,3,14,8,0,16);  // colors
powerpad_make_buttons(4*8,79,105,3,2,14,-8,14,8);  // lower right
powerpad_make_buttons(5*8,56,97,1,2,14,-8,0,16);  // lower middle
powerpad_make_buttons(6*8,8,90,3,2,14,8,0,16);  // lower left
powerpad_make_buttons(7*8,8,45,2,2,14,-8,0,16);  // middle left
powerpad_make_buttons(0*8,8,15,2,1,14,-8,0,16);  // upper left

makebuttonsflag=1;
}



When running it I get a list of buttons as I make them:
Add button 8 8 at (38,62)
Add button 9 9 at (50,62)
Add button 10 a at (62,62)
Add button 11 b at (74,62)
Add button 12 c at (86,62)
Add button 13 d at (98,62)
Add button 16 10 at (45,11)
Add button 17 11 at (57,4)
Add button 18 12 at (57,25)
etc


then we can scan our button numpadkeys from 0 to 7, then 8 to 15 and if they're both pressed, issue the coordinates from our 8x8 table, ignoring it if the coordinates are 0,0.

Code
int but1,but2;
int buttonread;
int item;

for(but1=0;but1<8;but1++){
for(but2=0;but2<8;but2++){  
    buttonread=m_test_buttons->read() ^ 0xffff; 
    if ( ((buttonread) & (1<<but1)) && ((buttonread) & (1<<(but2+8))) )
     { 
     item = but1*8+but2;
     printf("item = %d   (%d,%d)\n",item,119-powerpad_map[item][0],powerpad_map[item][1]);     
     if ((powerpad_map[item][0] !=0) && (powerpad_map[item][1] !=0))
        {powerpad_list_counter++;
         powerpad_list[powerpad_list_counter][0]= powerpad_map[item][0];
         powerpad_list[powerpad_list_counter][1]= powerpad_map[item][1];
        }
     }
   }
   }




and expand our test buttons up to 16 buttons, using up all the keypad keys
Code
     PORT_START("TEST_BUTTONS")
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON16 ) PORT_NAME("BUT0") PORT_CODE(KEYCODE_0_PAD)
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("BUT1") PORT_CODE(KEYCODE_1_PAD)
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("BUT2") PORT_CODE(KEYCODE_2_PAD)
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("BUT3") PORT_CODE(KEYCODE_3_PAD)
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("BUT4") PORT_CODE(KEYCODE_4_PAD)
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("BUT5") PORT_CODE(KEYCODE_5_PAD)
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("BUT6") PORT_CODE(KEYCODE_6_PAD)
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("BUT7") PORT_CODE(KEYCODE_7_PAD)
        PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("BUT8") PORT_CODE(KEYCODE_8_PAD)
        PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("BUT9") PORT_CODE(KEYCODE_9_PAD)
        PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("BUTA") PORT_CODE(KEYCODE_SLASH_PAD)
        PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("BUTB") PORT_CODE(KEYCODE_ASTERISK)
        PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_NAME("BUTC") PORT_CODE(KEYCODE_MINUS_PAD)
        PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_NAME("BUTD") PORT_CODE(KEYCODE_PLUS_PAD)
        PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON14 ) PORT_NAME("BUTE") PORT_CODE(KEYCODE_ENTER_PAD)
        PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("BUTF") PORT_CODE(KEYCODE_DEL_PAD)



It's not easy to enter button presses with a chord keyboard but it works.

So now I can "play" a game, but something's weird with the randomization, I get the same card/suits for each item.

This game is really complicated enough that I had to read the manual to figure out what's going on, S= suits, C=colors,Sp =Suit correct position, Cp = color correct position.

Here's the game setup for 6 cards, 4 suits and 6 colors.

[Linked Image from i.imgur.com]

I guessed it correctly, 6 white hearts!

[Linked Image from i.imgur.com]

Re: c64 super sketch [Re: Golden Child] #116269 10/24/19 03:01 AM
Joined: Feb 2014
Posts: 354
G
Golden Child Offline OP
Senior Member
OP Offline
Senior Member
G
Joined: Feb 2014
Posts: 354
With some digging into the code, I was able to find the table of buttons and the code that reads them.

LogicMaster on the Apple II has a button compare routine that looks like this:

There's $22=34 different buttons and we match the coordinate given within $0a=10 units.

[Linked Image from i.imgur.com]

and the compare coordinate table is:

[Linked Image from i.imgur.com]


We have LogicMaster on the Atari 800 (which doesn't work properly for some reason, it runs, just very very slowly)

The read routine is virtually identical and the compare coordinate table is identical. The only difference is the addresses for the tablet x and y coordinates: $6a/6b for apple, $08/09 for atari.

[Linked Image from i.imgur.com]
[Linked Image from i.imgur.com]




Let's see them side by side:

Apple on left/Atari on right
[Linked Image from i.imgur.com][Linked Image from i.imgur.com]



Finding a .d64 of Leo's Links for the C64, the compare routine is similar, but it wants to be more exact, within 5 units. It has the x and y coords in $08/$09 like atari. This table has $23=35 different buttons.

[Linked Image from i.imgur.com]
[Linked Image from i.imgur.com]

[Linked Image from i.imgur.com]


The only picture of the Leo's Links overlay that I could find.

[Linked Image from i.imgur.com]

Youtube Video of Leo's links on the c64.

https://www.youtube.com/watch?v=OI-fYOtOLpw

Taped for the Commodore Vegas Expo v12 2016, Roger Van Pelt shows the Chalk Board PowerPad, a large tablet which came with optional accessory applications, like Leo's Links, Leo's Lectric Paintbrush, and MicroMaestro. Filmed by Robert Bernardo


Re: c64 super sketch [Re: Golden Child] #116270 10/24/19 11:05 AM
Joined: Feb 2014
Posts: 354
G
Golden Child Offline OP
Senior Member
OP Offline
Senior Member
G
Joined: Feb 2014
Posts: 354
So let's see if we can draw this target list on the screen:

If we pause the emulation we can "draw" on the screen:
Code
ram=emu.item(manager:machine().devices[":ram"].items["0/m_pointer"])
tablesize=ram:read(0x811d) tablex=0x8153 tabley=0x8176  boxsize=5 xmult=320/120 ymult=200/120
emu:pause() for i=0,tablesize-1 do 
x=ram:read(tablex+i) y=ram:read(tabley+i) print(i,x,y)
manager:machine().screens[":screen"]:draw_box((x)*xmult,y*ymult,(x+boxsize)*xmult,(y+boxsize)*ymult,0xc0ffffff,0xff000000) 
end 
-- emu:unpause() to get things running again

Interestingly, the x coordinates aren't reversed in the table.

[Linked Image from i.imgur.com]


For Apple II Logicmaster:

X coordinates are reversed in this table (matches the pad xcoordinates)

Code
ram=emu.item(manager:machine().devices[":ram"].items["0/m_pointer"])
emu:unpause()
emu:pause() for i=0,ram:read(0x6ef9)-1 do 
x=ram:read(0x6eb4+i) y = ram:read(0x6ed6+i) print (i,x,y) 
manager:machine().screens[":screen"]:draw_box((119-x)*2,y,(119-x-10)*2,y+10,0xc0ffffff,0xff000000) end 

[Linked Image from i.imgur.com]


Re: c64 super sketch [Re: Golden Child] #116271 10/24/19 01:46 PM
Joined: Mar 2001
Posts: 16,371
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,371
I was a bit confused what the Power Pad actually was until I saw that it uses overlays for these special-function games. Good work reverse-engineering it, I'm just fuzzy on how we'd emulate it right now smile

Re: c64 super sketch [Re: R. Belmont] #116275 10/25/19 03:32 PM
Joined: Feb 2014
Posts: 354
G
Golden Child Offline OP
Senior Member
OP Offline
Senior Member
G
Joined: Feb 2014
Posts: 354
Thanks, RB! (and thanks again for converting LogicMaster for me)

My plan was to create an additional screen and load in a picture of the overlay. Then draw the overlay and also a cursor based on an analog input. I've been looking at the png loading code in rendutil.cpp:


bool render_load_png(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, const char *filename, bool load_as_alpha_to_existing)

and it loads the png into a bitmap_argb32 with:

if (PNGERR_NONE != png.copy_to_bitmap(bitmap, hasalpha))


The part that I'm having trouble with is how to draw this loaded bitmap_argb32 to my screen bitmap which is rgb32. They're both 32 bits, right?

Re: c64 super sketch [Re: Golden Child] #116276 10/25/19 03:37 PM
Joined: May 2009
Posts: 1,818
J
Just Desserts Offline
Very Senior Member
Offline
Very Senior Member
J
Joined: May 2009
Posts: 1,818
They're both 32 bits. Just write each pixel as 0xff000000 | srcbitmap.pix32(y, x); or whatever.

Re: c64 super sketch [Re: Just Desserts] #116279 10/26/19 12:55 AM
Joined: Feb 2014
Posts: 354
G
Golden Child Offline OP
Senior Member
OP Offline
Senior Member
G
Joined: Feb 2014
Posts: 354
Thanks for your suggestion, JD. It works a treat.

I hacked up a little code (copied from render_load_png) to read a png called "LogicMasterMylar.png" which I resized to 560 pixel width and loaded that into a 560x384 screen that matched the size of the apple 2 screen.


Code

//adding a powerpad_bitmap member:

bitmap_argb32 powerpad_bitmap;  // not a bitmap_rgb32


int32_t apple2_state::screen_update_powerpad(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{

if (!powerpad_bitmap.valid())      
{
        const char * filename="LogicMasterMylar.png";

        emu_file file("",OPEN_FLAG_READ);;
        osd_file::error const filerr = file.open(filename);
        if (filerr != osd_file::error::NONE)
                {printf("no file!"); return 0;}

        // read the PNG data
        png_info png;
        png_error const result = png.read_file(file);
        file.close();
        if (result != PNGERR_NONE)
        {
                osd_printf_error("%s: Error reading PNG file\n", filename);
                return 0;
        }
      bool hasalpha=false;
      if (PNGERR_NONE != png.copy_to_bitmap(powerpad_bitmap, hasalpha))
                {
                        osd_printf_error("%s: Error copying PNG bitmap to MAME bitmap\n", filename);
                        return false;
                }
printf("powerpad bitmap size %d %d\n",powerpad_bitmap.width(),powerpad_bitmap.height());
printf("screen bitmap size %d %d\n",bitmap.width(),bitmap.height());
}

for (int x=0;x<bitmap.width();x++)
for (int y=0;y<bitmap.height();y++) 
      bitmap.pix32(y,x)=powerpad_bitmap.pix32(y,x);
  
return 0;
}

Yes, I need to probably resize the graphic to fit, but I was so happy to see it load a png for the first time.

[Linked Image from i.imgur.com]

Re: c64 super sketch [Re: Golden Child] #116280 10/26/19 10:14 AM
Joined: Feb 2014
Posts: 354
G
Golden Child Offline OP
Senior Member
OP Offline
Senior Member
G
Joined: Feb 2014
Posts: 354
Since I can read pngs now why not have a hand graphic.

Now I've got a "hand" pointer that moves around by reading the analog inputs, drawing it with alpha=128.

Since the original mylar images were roughly 900x900 why not just go with 900x900.

[Linked Image from i.imgur.com]


Code
powerpad_handx = m_mypot0->read()*(900/120.0);
powerpad_handy = m_mypot1->read()*(900/120.0);

int xo=powerpad_handx-fingertipx;
int yo=powerpad_handy-fingertipy;

for (int x=xo;x<xo+powerpad_hand_bitmap.width();x++)
for (int y=yo;y<yo+powerpad_hand_bitmap.height();y++)
      if ((x>=0) && (x<bitmap.width()) && (y>=0) && (y<bitmap.height())) 
           bitmap.pix32(y,x)=alpha_blend_r32(bitmap.pix32(y,x),powerpad_hand_bitmap.pix32(y-yo,x-xo),0x80);




It's sooooo much easier to play using a mouse than my wacky chord keyboard. There's still something weird about the complete lack of randomization.

[Linked Image from i.imgur.com]

If I overlay the buttons, they're pretty close to the graphics.

Code
emu:unpause()
ram=emu.item(manager:machine().devices[":ram"].items["0/m_pointer"])
emu.pause() for i=0,ram:read(0x6ef9)-1 do x=ram:read(0x6eb4+i) y = ram:read(0x6ed6+i) print (i,x,y) manager:machine().screens[":powerpad_screen"]:draw_box((119-x)*(900/120),y*(900/120),(119-x-10)*(900/120),(y+10)*(900/120),0xc0ffffff,0xff000000) end

[Linked Image from i.imgur.com]

Re: c64 super sketch [Re: Golden Child] #116288 10/26/19 06:00 PM
Joined: Feb 2014
Posts: 354
G
Golden Child Offline OP
Senior Member
OP Offline
Senior Member
G
Joined: Feb 2014
Posts: 354
It's interesting what you find when searching for information on the PowerPad and ChalkBoard.

I was able to find out the author of the software: Richard Ben Satterfield and discover that the Powerpad had a life after ChalkBoard, where it was sold by Dunamis, inc for Assistive Technology (AT) Applications.

from Ben Satterfield's CV:

Software Design:

Educational designer and team leader for development of these products:
• BearJam (1983) © Chalkboard, Inc.
• LogicMaster (1983) © Chalkboard, Inc.
• PowerPad Programming Kit (1983) © Chalkboard, Inc.
• Leo’s Links (1984) © Chalkboard, Inc.
• SimpleCom I (1985) © Dunamis, Inc.
• SimpleCom II (1986) © Dunamis, Inc.
• Powerpad ToolKit (1990) © Dunamis, Inc.



searching google on "dunamis powerpad" gets some interesting hits:

https://www.simcobox.com/blog/60/

Simco is "Standard Injection Molding Co" who injection molded the interface modules.

There was actually an interface that connected the Powerpad to a Macintosh.

[Linked Image from i.imgur.com]



According to another article that there were at least 75,000 Powerpads. It was used in a project called Power Art which used a mac and hyperstudio 2.0.

[Linked Image from i.imgur.com]

https://books.google.com/books?id=D...p;lpg=RA1-PA22&dq=power+art+powerpad

Re: c64 super sketch [Re: Golden Child] #116289 10/26/19 06:34 PM
Joined: Mar 2013
Posts: 305
I
ICEknight Offline
Senior Member
Offline
Senior Member
I
Joined: Mar 2013
Posts: 305
Originally Posted by Golden Child
[Linked Image from i.imgur.com]

Will there be a way to un-squash the buttons view so that the original proportions will be displayed?


LCD artwork scans and cleanups: https://mega.nz/#F!uFYSzK7S!U-lJon9jsqyoCX_3y7_KLA
Page 5 of 6 1 2 3 4 5 6

Who's Online Now
4 registered members (Fake Shemp, Carbon, R. Belmont, 1 invisible), 145 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,710
Posts114,489
Members4,869
Most Online510
Aug 26th, 2019
Powered by UBB.threads™ PHP Forum Software 7.7.3