Active Threads | Active Posts | Unanswered Today | Since Yesterday | This Week
Non-Windows MAME Support Jump to new posts
Re: plug out and in usb controller to get it working crumpetlump 03/27/20 10:09 PM
R.Belmont do you have any suggestions for me to try and fix this?, it was fine about a year ago , I have been doing make -j5 to compile but havent changed anything in makefile, i used to change a few options in the makefile like a year ago maybe this is part of the problem?
4 186 Read More
MAME Jump to new posts
Re: Battlezone fun Golden Child 03/27/20 05:29 PM
If we know where the locations for our position and direction are in memory, let's see if we can move things around under lua's control.

Moving the player under the control of a lua script:

[Linked Image from i.imgur.com]

Player position is stored at 2d/2e for x position and 31/32 for y position.
Tank position is stored at 2f/30 for x position and 33/34 for y position.
Tank direction is stored at 29/2c 29=lsb and 2c=msb.

The player's direction is stored at 27 = lsb and 2a = msb. When 27/2a are set to 0000 that precisely lines up on the right side of the moon with the target.

Interestingly, only the msb of the direction gets reset on the start of the game, when the game starts it will be very close to the edge of the moon.

[Linked Image from i.imgur.com]

This script will move the tank around, spin it, and move the player around also. It's kind of fun to "trap" the missile with the script and watch it rotate.

Code
mem=manager:machine().devices[":maincpu"].spaces["program"]
mem2=manager:machine():memory().regions[":maincpu"]
function hex(a,digits) digits = digits or 2 return string.format("%0"..digits.."x",a) end

function setlives(l) l=int(l) mem:write_u8(0xcc,l) end
function setscore(s) s=int(s) mem:write_u16(0xb8,s) end

function setmypos(x,y) mem:write_u16(0x2d,int(x)) mem:write_u16(0x31,int(y)) end
function setmydir(d) d=int(d) mem:write_u8(0x27,d&0xff) mem:write_u8(0x2a,(d&0xff00)>>8)  end

function settankposx(x) mem:write_u16(0x2f,int(x)) end
function settankposy(y) mem:write_u16(0x33,int(y)) end
function settankpos(x,y) settankposx(x) settankposy(y) end
function settankdir(d) d=int(d) mem:write_u8(0x29,d&0xff) mem:write_u8(0x2c,(d&0xff00)>>8)  end 

function delay(delaytime)  delaytime = delaytime or 4 emu.wait(delaytime * 1/60) end

function int(i) return math.floor(i) end

function movetank2()
-- move enemy tank in a triangle
movetable = { 10,0,  50,0,  50,10, 10,0, 50,-20, 10,0,}
for pos=1,#movetable-2,2 do
   x1=movetable[pos+0] y1=movetable[pos+1] 
   x2=movetable[pos+2] y2=movetable[pos+3]
   dist=math.sqrt((x2-x1)^2 + (y2-y1)^2)
   vel=20/60
   t=dist/vel
   frames=t
   --print(pos,x1,y1,x2,y2)
   for f=1,frames do
       x=(x2-x1)/frames * f + x1
       y=(y2-y1)/frames * f + y1
       settankpos(x*256,y*256)
       setmypos(0,0)
       setmydir(0)
       print(f,frames,x,y) 
       delay(1)
  end
end
-- spin the enemy tank or missile around 3 times
for i=1,3 do
for d=0,255 do
  setmypos(0,0)
  setmydir(0)
  settankdir(d*256)
  settankpos(0x600,0)
  setlives(4)
  setscore(d)
  delay(2)
end
end
-- move me and fix the enemy tank right in front of me
movetable = { 10,0,  50,0,  50,10, 10,0, 50,-20, 10,0,}
for pos=1,#movetable-2,2 do
   x1=movetable[pos+0] y1=movetable[pos+1] 
   x2=movetable[pos+2] y2=movetable[pos+3]
   dist=math.sqrt((x2-x1)^2 + (y2-y1)^2)
   vel=20/60
   t=dist/vel
   frames=t
   --print(pos,x1,y1,x2,y2)
   for f=1,frames do
       x=(x2-x1)/frames * f + x1
       y=(y2-y1)/frames * f + y1
       setmypos(x*256,y*256)
       settankpos(x*256+0x401,y*256)
       setmydir(0)
       setlives(4)
       setscore(f)
       print(f,frames,x,y) 
       delay(1)
    end
end
end

co1=coroutine.create(movetank2) coroutine.resume(co1)
13 1,301 Read More
MAME Jump to new posts
Re: Wonderswan driver update KanedaFr 03/27/20 09:34 AM
Just Desserts : sorry! I didn't realize the already point me to the right anwser frown I thought you were talking about using socket or not.

pmackinlay, Vas Crabb : I found the bitbanger solution while Googling, on TI82 related page but for some reason I didn't find it on command line... I thought it was since replaced by comm_localhost/comm_remotehost

so what the difference / benetifs of bitbanger vs comm_localhost/comm_remotehost ?
At this time, I successfully send data (TX), I have to fix some part of my receive code (RX) but should I move to bitbanger first ?

I'll try using device_slot after that, based on TI82 or NES example

thanks!!!!
8 460 Read More
Who's Online Now
2 registered members (DarthMarino, kokoboi), 35 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,762
Posts115,156
Members4,888
Most Online890
Jan 17th, 2020
Powered by UBB.threads™ PHP Forum Software 7.7.3