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.