Previous Thread
Next Thread
Print Thread
Page 33 of 80 1 2 31 32 33 34 35 79 80
Joined: Mar 2008
Posts: 230
Likes: 8
R
Senior Member
Senior Member
R Offline
Joined: Mar 2008
Posts: 230
Likes: 8
Hmmm, how does the Vectrex driver manage the overlays per game?

Joined: Mar 2001
Posts: 17,239
Likes: 263
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,239
Likes: 263
It seems like SVG_SCREEN would work for this, we just need the SVG renderer to cache the image instead of re-parsing it each frame.

Joined: May 2004
Posts: 1,772
Likes: 34
H
Very Senior Member
Very Senior Member
H Offline
Joined: May 2004
Posts: 1,772
Likes: 34
Originally Posted by robcfg
Hmmm, how does the Vectrex driver manage the overlays per game?

badly last time I checked (everything in one layout file, switchable from the artwork menu)

but that might have been changed?

Joined: Feb 2014
Posts: 1,135
Likes: 198
G
Very Senior Member
Very Senior Member
G Offline
Joined: Feb 2014
Posts: 1,135
Likes: 198
Here's more silly fun: patch the rom while the driver's running:

I wanted to see if I could get the Apple Graphics Tablet to return values up to +9999, but the firmware doesn't actually allow that, topping out at 0xa00.

But if we patch the rom code, we can get it to return something larger:


In the rom there's a CMP #$0a (for a maximum counter value of 0xa00), so let's see if we can make it CMP #$0e (for 0xe00)


[Linked Image from i.imgur.com]


We can use the lua console:

Code
MAME]> print(manager:machine():memory().regions[":sl2:agraphtablet:agraphtablet_rom"]:read_u8(0x47a))
10
[MAME]> print(manager:machine():memory().regions[":sl2:agraphtablet:agraphtablet_rom"]:write_u8(0x47a,0xe0))

[MAME]> print(manager:machine():memory().regions[":sl2:agraphtablet:agraphtablet_rom"]:read_u8(0x47a))
224
[MAME]> emu.item(manager:machine().devices[":sl2:agraphtablet"].items["0/m_tabletmax"]):write(0,0xd05)



Or use the mame debugger memory window to set 0x47a to 0x0f:

[Linked Image from i.imgur.com]

and set the m_tabletmax to 0xd05

[Linked Image from i.imgur.com]

A little basic program with scale set to 1, "S1" in the initialization string.

Code
emu.keypost(''..
'      90 PR#2:PRINT"D,M1" : REM DEFAULT, MIXED MODE PAGE 1\n'..
'     100 PR#2:PRINT"P,X291,Y291,S1"\n'..
'     110 IN#2:INPUT "";X$,Y$,Z$:IN#0\n'..
'     120 VTAB 22:PRINT X$Y$Z$\n'..
'     125 POKE -16368,0\n'..
'     140 GOTO 110\n'..
'     RUN\n')




Oh yeah, +9999+9999!

The values seem to be multiplied by 3, so 0xd05 * 3 = 9999.

[Linked Image from i.imgur.com]


I can also "patch" the Apple 2 character graphics rom with the same idea:

Code
-- changing the @ sign 
-- just start the apple2p driver with the debugger and step until you get a text screen with @ signs:
-- you may need to step the debugger to get the screen to update

[MAME]> print(manager:machine():memory().regions[":gfx1"]:write_u8(0x0,0x01))
[MAME]> print(manager:machine():memory().regions[":gfx1"]:write_u8(0x1,0x02))
[MAME]> print(manager:machine():memory().regions[":gfx1"]:write_u8(0x2,0x04))
[MAME]> print(manager:machine():memory().regions[":gfx1"]:write_u8(0x3,0x08))

[Linked Image from i.imgur.com]


If you reset the driver with Shift+F3, your rom patching disappears.

Joined: Feb 2014
Posts: 1,135
Likes: 198
G
Very Senior Member
Very Senior Member
G Offline
Joined: Feb 2014
Posts: 1,135
Likes: 198
I thought I'd try to see if I could get a "slider" adjuster working:

The PORT_ADJUSTER looked very promising but it was limited to 0 to 100. What if I did a define of my own that had a mask of 0xffff for 16 bits?

If I make my own PORT_ADJUSTER_16MASK macro based on the PORT_ADJUSTER macro in src/emu/ioport.h and change the mask, I can get 16 bits.

It seems to work but it says percent in the display.

So now I have an adjuster that goes from 97 to 2559 and I can hit ALT+LEFT or ALT+RIGHT arrow to go to each end of the full extent and CTRL+ARROWS to change the value faster.


Code
#define PORT_ADJUSTER_16MASK(_default, _name)					\
        configurer.field_alloc(IPT_ADJUSTER, (_default), 0xffff, (_name)); \
        configurer.field_set_min_max(0, 100);


static INPUT_PORTS_START( tablet_adjusters )
        PORT_START("Position Min") /*  */
        PORT_ADJUSTER_16MASK(97,"Tablet Position Min")
        PORT_MINMAX(97,2559)


        PORT_START("Position Max") /*  */
        PORT_ADJUSTER_16MASK(2559,"Tablet Position Max")
        PORT_MINMAX(97,2559)
//      PORT_BIT(0xffff, 0x00,  IPT_ADJUSTER)  // this didn't work
INPUT_PORTS_END

static INPUT_PORTS_START(gfxall)
    PORT_INCLUDE(mouse)
    PORT_INCLUDE(apple2_joystick3)
    PORT_INCLUDE(tablet_adjusters)
INPUT_PORTS_END


and I can read the adjusters with:

    m_tabletmin = ioport("Position Min")->read();
    m_tabletmax = ioport("Position Max")->read();
    
    printf("ioport adjusters %x %x\n",ioport("Position Min")->read(),ioport("Position Max")->read());


and with a little Applesoft program we can see the values change in realtime with the sliders:
2559 * 3 = 7677

Code
emu.keypost(''..
'     NEW\n'..
'      90 PR#2:PRINT"D,M1" : REM DEFAULT, MIXED MODE PAGE 1\n'..
'     100 PR#2:PRINT"P,X0,Y0,S1"\n'..
'     110 IN#2:INPUT "";X$,Y$,Z$:IN#0\n'..
'     120 VTAB 22:PRINT X$Y$Z$\n'..
'     125 POKE -16368,0\n'..
'     128 A=FRE(0) : REM APPLESOFT NEEDS GC OR HIRES PAGE GETS CLOBBERED\n'..   -- fre needs a parameter
'     140 GOTO 110\n'..
'     RUN\n')



[Linked Image from i.imgur.com]

Last edited by Golden Child; 04/18/19 12:04 AM.
Joined: Feb 2014
Posts: 1,135
Likes: 198
G
Very Senior Member
Very Senior Member
G Offline
Joined: Feb 2014
Posts: 1,135
Likes: 198
More dumb fun: Using cassettes with the apple2 driver:

I typed in a short little applesoft program but didn't load DOS, so how to save it?

Just create a cassette image with the file manager with a .wav suffix (it won't work otherwise), then go to tape control, record and type SAVE and return from the command line.

After it beeps twice, your program is saved. Make sure you're recording before you type SAVE or you'll miss some of the program.

To load your program, type LOAD and return then rewind and play your tape image.

The wav file gets large, like 4MB to save a 4K file, but it works!

Once you reboot and load DOS 3.3, just LOAD from your cassette image.


Joined: Feb 2014
Posts: 1,135
Likes: 198
G
Very Senior Member
Very Senior Member
G Offline
Joined: Feb 2014
Posts: 1,135
Likes: 198
So you want to see bigger fonts in the debugger?

You could use the -debugger_font_size option from the command line or
change the option from the lua console. You won't see it unless you open a new dasm or memory window.

Code
[MAME]> function printt(a) for i,j in pairs(a) do print(i,j) end end
[MAME]> printt(manager:options().entries)

homepath	sol.core_options::entry*: 0x5603fbf64898
screen	sol.core_options::entry*: 0x5603fbf5d608
snapbilinear	sol.core_options::entry*: 0x5603fbf6fa28
gl_forcepow2texture	sol.core_options::entry*: 0x5603fbf361a8
volume	sol.core_options::entry*: 0x5603fbf6f1a8
... etc

[MAME]> print(manager:options().entries["debugger_font_size"]:description())
font size to use for debugger views

[MAME]> print(manager:options().entries["debugger_font_size"]:value())                -- 0.0 is the default
0.0
[MAME]> print(manager:options().entries["debugger_font_size"]:value(5.0))    -- font size for Tiny Elvis
[MAME]> print(manager:options().entries["debugger_font_size"]:value())
5.0
[MAME]> print(manager:options().entries["debugger_font_size"]:value(12.0))   -- mame's default seems to be about 12
[MAME]> print(manager:options().entries["debugger_font_size"]:value(13.0))
[MAME]> print(manager:options().entries["debugger_font_size"]:value(15.0))

[Linked Image from i.imgur.com]

Why not change the font too?

(monospace fonts are the best, memory views can get weird)

Code
MAME]> print(manager:options().entries["debugger_font"]:value())
auto
[MAME]> print(manager:options().entries["debugger_font"]:value("Verdana"))
[MAME]> print(manager:options().entries["debugger_font"]:value("NanumSquare Bold"))
[MAME]> print(manager:options().entries["debugger_font"]:value("Noto Mono"))



[Linked Image from i.imgur.com]

Last edited by Golden Child; 04/18/19 01:25 PM.
Joined: Feb 2014
Posts: 1,135
Likes: 198
G
Very Senior Member
Very Senior Member
G Offline
Joined: Feb 2014
Posts: 1,135
Likes: 198
I tried to make a layout file and struggled mightily.

If you want to see mame segfault, just put a stray < somewhere inside the layout file. That was fun to figure out.


I took a layout file from the snspell artwork at Mr. Do's and could not get the buttons to work. I tried and tried and tried, I put the flag MACHINE_CLICKABLE_ARTWORK in apple2p.cpp which didn't help.

COMP( 1979, apple2p, apple2, 0, apple2p, apple2p, apple2_state, empty_init, "Apple Computer", "Apple ][+", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK )


I could see the buttons but they didn't work.

I thought I was going to go insane!


And then I found the answer at http://www.mameworld.info/ubbthread...page=&view=&sb=5&o=&vc=1

Quote
So I noticed none of the buttons (clickable; move up/down when you press them) in this artwork file (mslug2) worked anymore. I look, and the neogeo driver was updated some time back.

I look some more, and I see that the controllers for neogeo are now bus devices.

...


> Because Neo Geo controllers are now bus devices, the input tags also need to be
> changed to edge:joy:JOY1 and edge:joy:JOY2. These tags appear in the -listxml output.


Ah... knew it would be something simple. I had simply changed them to JOY1 and JOY2.

That will help me with other thing, too.

Thank you!!! :cheers5:


So after changing INPUTTAG="joystick_3_buttons" to INPUTTAG="sl2:agraphtablet:joystick_3_buttons" they started working!!!


Sure enough, if you look at the ioports table it will be prefaced with sl2:agraphtablet:

Code
[MAME]> print(manager:machine():ioport().ports)
table: 0x555dcaf592b0
[MAME]> function printt(a) for i,j in pairs(a) do print(i,j) end end 
[MAME]> printt(manager:machine():ioport().ports)
:X6	sol.ioport_port*: 0x555dcaf5a5d8
:sl2:agraphtablet:joystick_3_buttons	sol.ioport_port*: 0x555dcaf5ac68
:sl2:agraphtablet:a2mse_y	sol.ioport_port*: 0x555dcaf5acd8
:X2	sol.ioport_port*: 0x555dcaf5a798
:joystick_2_x	sol.ioport_port*: 0x555dcaf5aa38
...
:sl2:agraphtablet:Position Max	sol.ioport_port*: 0x555dcaf5ae98
:reset_dip	sol.ioport_port*: 0x555dcaf5ab88
:sl2:agraphtablet:joystick_3_y	sol.ioport_port*: 0x555dcaf5af08
:X3	sol.ioport_port*: 0x555dcaf5a728
:joystick_2_y	sol.ioport_port*: 0x555dcaf5a9c8
:joystick_buttons	sol.ioport_port*: 0x555dcaf5a958


I don't know what was worse, struggling to get this working or watching Aquaman at the same time... 8-)

Baby steps...


Code
<!-- taken from snspell.lay and modified -->

<mamelayout version="2">
	<element name="shadow" defstate="0">
		<text string=" ">
			<bounds x="0" y="0" width="1" height="1" />
			<color red="0.0" green="0.0" blue="0.0" />
		</text>
			<disk state="0">
			<bounds x="0.07" y="0.07" width="0.86" height="0.86" />
			<color red="1.0" green="0.0" blue="0.0" />
		</disk>
		<disk state="1">
			<bounds x="0.07" y="0.07" width="0.86" height="0.86" />
			<color red="0.0" green="0.0" blue="0.0" />
		</disk>
	</element>
	<view name="Handheld_Artwork">
		   <screen index="0">
			<bounds x="0" y="0" width="5554" height="7842" />
		</screen> 

		<!-- Keypad	-->
		<!-- ABCDE -->
			<cpanel element="shadow" inputtag="sl2:agraphtablet:joystick_3_buttons" inputmask="0x10"><bounds y="4484" x="600" width="305" height="305"/><color alpha="0.85" /></cpanel>
			<cpanel element="shadow" inputtag="sl2:agraphtablet:joystick_3_buttons" inputmask="0x20"><bounds y="4484" x="1060" width="305" height="305"/><color alpha="0.85" /></cpanel>
	</view>
</mamelayout>


[Linked Image from i.imgur.com]

Last edited by Golden Child; 04/20/19 05:01 AM.
Joined: Feb 2014
Posts: 1,135
Likes: 198
G
Very Senior Member
Very Senior Member
G Offline
Joined: Feb 2014
Posts: 1,135
Likes: 198
Has anyone made an apple II layout that shows the disk drive LED status?

I was fiddling around and can see the status in the sl6:diskiing;wozfdc/0/external_io_select (0 for drive 1, 1 for drive 2) and the motor in sl6:diskiing;wozfdc/0/active (0 for off, 1 for on, 2 for getting ready to stop)

It should be theoretically possible to do a track LED display too like those indus GT drives.

[Linked Image from i.imgur.com]

Joined: Feb 2014
Posts: 1,135
Likes: 198
G
Very Senior Member
Very Senior Member
G Offline
Joined: Feb 2014
Posts: 1,135
Likes: 198
I wanted to see if I could control the ioports for the joystick and after much fiddling and adding some code to luaengine and ioports.h and ioports.cpp I think I've got it.

Yes, it's a bit of a hack, but it's pretty useful to be able to precisely control an anlog input.

So now I can draw spirals with the graphics tablet:

Code
function spiral()
for i=16384,16384+8192-1 do manager:machine().devices[":maincpu"].spaces["program"]:write_u8(i,0) end
for i=0,256*16,1 do 
x=math.cos(i/256.0*math.pi*2.0)*i/256.0*8.0*1024
y=math.sin(i/256.0*math.pi*2.0)*i/256.0*8.0*1024
ioports=manager:machine():ioport().ports ioports[":sl2:agraphtablet:joystick_3_x"].fields["P3 Joystick X"].live:set_analog_value(math.floor(x),math.floor(x),0)
ioports=manager:machine():ioport().ports ioports[":sl2:agraphtablet:joystick_3_y"].fields["P3 Joystick Y"].live:set_analog_value(math.floor(y),math.floor(y),0)
print (i,x,y,ioports[":sl2:agraphtablet:joystick_3_x"]:read(),ioports[":sl2:agraphtablet:joystick_3_y"]:read())
emu.wait(1/60+.001) 
print (i,x,y,ioports[":sl2:agraphtablet:joystick_3_x"]:read(),ioports[":sl2:agraphtablet:joystick_3_y"]:read())
end 
end
co1=coroutine.create(spiral) ok,err=coroutine.resume(co1) print(ok,err)


I wrote a function set_analog_value that just stuffs values into m_accum and m_previousvalue for the live ioport analog member. m_previousanalog doesn't seem to have any effect.

Code
       // live analog value tracking
        s32                 m_accum;                // accumulated value (including relative adjustments)
        s32                 m_previous;             // previous adjusted value
        s32                 m_previousanalog;       // previous analog value

In ioport.h

Code
struct ioport_field_live
{
        // construction/destruction
        ioport_field_live(ioport_field &field, analog_field *analog);

        void set_value(ioport_value newvalue) {value = newvalue;};
        void set_analog_value(s32 newaccumvalue, s32 newpreviousvalue, s32 newpreviousanalogvalue);



In ioport.cpp

Code
void ioport_field_live::set_analog_value(s32 newaccumvalue, s32 newpreviousvalue, s32 newpreviousanalogvalue)
   {analog->set_accum(newaccumvalue); analog->set_previous(newpreviousvalue); analog->set_previousanalog(newpreviousanalogvalue);}

Just added set_accum, set_previous and set_previousanalog to class analog field:

Code
// ======================> analog_field

// live analog field information
class analog_field
{
        friend class simple_list<analog_field>;
        friend class ioport_manager;
        friend void ioport_field::set_user_settings(const ioport_field::user_settings &settings);

public:
        // construction/destruction
        analog_field(ioport_field &field);

        // getters
        analog_field *next() const { return m_next; }
        ioport_manager &manager() const { return m_field.manager(); }
        ioport_field &field() const { return m_field; }
        s32 sensitivity() const { return m_sensitivity; }
        bool reverse() const { return m_reverse; }
        s32 delta() const { return m_delta; }
        s32 centerdelta() const { return m_centerdelta; }

        // readers
        void read(ioport_value &value);
        float crosshair_read();
        void frame_update(running_machine &machine);

        void set_accum(s32 newvalue){m_accum=newvalue;};
        void set_previous(s32 newvalue){m_previous=newvalue;};
        void set_previousanalog(s32 newvalue){m_previousanalog=newvalue;};


In luaengine.cpp

Code
/* field.live
 */

	sol().registry().new_usertype<ioport_field_live>("ioport_field_live", "new", sol::no_constructor,
                        "set_value", &ioport_field_live::set_value,
                        "set_analog_value", &ioport_field_live::set_analog_value,		
			"name", &ioport_field_live::name,
                        "value", &ioport_field_live::value);

It kinda looks like a fingerprint.


[Linked Image from i.imgur.com]

Page 33 of 80 1 2 31 32 33 34 35 79 80

Link Copied to Clipboard
Who's Online Now
0 members (), 88 guests, and 5 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,331
Posts122,197
Members5,077
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Powered by UBB.threads™ PHP Forum Software 8.0.0