Previous Thread
Next Thread
Print Thread
Page 14 of 80 1 2 12 13 14 15 16 79 80
Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
Or how about ask the user if they'd like to exit.

If so, then pass a nil result through.

Code
local lnresult = ln.linenoise('\x1b[1;36m[MAME]\x1b[0m> ')
if (lnresult == nil) then 
  lnresult = "" 
  io.write("CTRL+C detected: are you sure you want to exit?") 
  if io.read() == "y" then lnresult = nil end 
end
return lnresult
]]

Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
So a couple of things I was trying to figure out,
1. how to print to another text console, and
2. how often register_periodic will call a routine.


So how to send lua print output to another text console.

I would get lots of output information that would mess up my command line, so why not send it to another window?

On ubuntu 17.10, you can launch an xterm with a command line like:
Code
xterm -e "tty;cat" &
So it executes the program tty which prints something like "/dev/pts/3" on the top line which is the pseudoterminal assigned to the terminal and then executes cat. The & is to run it in the background so you get your console back.

I tried it with "gnome-terminal -- tty;cat" but it didn't seem to work, giving me some kind of error.

I launch mame with this command line:

Code
./mame64 a2600 stampede -plugin console -debug -window  2>/dev/pts/3

so the 2> redirects stderr to my freshly created xterm at /dev/pts/3.

and any error messages from lua goes to stderr and I can also print stuff directly with

Code
io.stderr:write("This goes to stderr\n")



I was trying to figure out how often a routine registered to emu().register_periodic would get called:

Code
function testperiodic() if not stopprint then if cycles == nil then cycles = 1 end io.stderr:write(" cycles="..(cycles).."  "..os.date().."\n") if cycles then cycles=cycles+1 end end end

-- same function on multiple lines:

function testperiodic() 
  if not stopprint then 
    if cycles == nil then cycles = 1 end 
    io.stderr:write(" cycles="..(cycles).."  "..os.date().."\n") 
    if cycles then cycles=cycles+1 end 
  end 
end

emu.register_periodic(testperiodic)


-- and when you want to stop the printing, set stopprint to true
-- stopprint=true

and you get output like:
Code
 cycles=1  Mon 04 Dec 2017 04:05:44 PM EST
 cycles=2  Mon 04 Dec 2017 04:05:44 PM EST
 cycles=3  Mon 04 Dec 2017 04:05:44 PM EST
 cycles=4  Mon 04 Dec 2017 04:05:44 PM EST
 cycles=5  Mon 04 Dec 2017 04:05:44 PM EST
 cycles=6  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=7  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=8  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=9  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=10  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=11  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=12  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=13  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=14  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=15  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=16  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=17  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=18  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=19  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=20  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=21  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=22  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=23  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=24  Mon 04 Dec 2017 04:05:45 PM EST
 cycles=25  Mon 04 Dec 2017 04:05:46 PM EST

And it looks like you get around 20 cycles per second.

And if you want other terminal output windows, you can use io.open like so:
Code
[MAME]> out2 = io.open("/dev/pts/4","w")
[MAME]> print(out2)
file (0x56300b8219b0)
[MAME]> out2:write("hello wont be seen until newline")
[MAME]> out2:write("hello\n")
[MAME]> out2:write("wont see me until flush")
[MAME]> out2:flush()


Joined: May 2012
Posts: 568
Likes: 10
S
Senior Member
Offline
Senior Member
S
Joined: May 2012
Posts: 568
Likes: 10
Working on Apple disk support in SAMdisk -- this is a (probably cracked) Datasoft Conan disk. And it boots when converted into .DO image:

[Linked Image from img-fotki.yandex.ru]

Code
[a140-023.scp]
35 Cyls Head 0:
cyl 32 head 0 sec 6: invalid gcr at 016 - A5 -> FF
cyl 32 head 0 sec 6: invalid gcr at 017 - 7B -> FF
cyl 32 head 0 sec 6: invalid gcr at 01E - 7F -> FF
cyl 32 head 0 sec 6: invalid gcr at 01F - D5 -> FF
cyl 32 head 0 sec 6: invalid gcr at 020 - 93 -> FF
cyl 32 head 0 sec 6: invalid gcr at 021 - A9 -> FF
250Kbps Apple, 16 sectors,  256 bytes/sector:
  0.0  5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4
  1.0  10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9
  2.0  14 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13
  3.0  2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1
  4.0  7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6
  5.0  11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10
  6.0  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
  7.0  4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3
  8.0  9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8
  9.0  13 14 15 0 1 2 3 4 5 6 7 8 9 10 11 12
 10.0  2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1
 11.0  6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5
 12.0  11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10
 13.0  15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
 14.0  4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3
 15.0  8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7
 16.0  13 14 15 0 1 2 3 4 5 6 7 8 9 10 11 12
 17.0  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0
 18.0  14 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13
 19.0  2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1
 20.0  7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6
 21.0  11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10
 22.0  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
 23.0  4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3
 24.0  9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8
 25.0  13 14 15 0 1 2 3 4 5 6 7 8 9 10 11 12
 26.0  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0
 27.0  6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5
 28.0  11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10
 29.0  15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
 30.0  3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2
 31.0  8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7
 32.0  12 13 14 15 0 1 2 3 4 5 6 7 8 9 10 11
 33.0  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0
 34.0  5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4

Joined: Mar 2001
Posts: 17,217
Likes: 234
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,217
Likes: 234
Very nice!

Joined: Oct 2015
Posts: 24
R
Member
Offline
Member
R
Joined: Oct 2015
Posts: 24
Not to sure where to post this, but this seems like a good place.

One of the members of the Apple /// Facebook group, Madeleine, has noticed an issue in the Apple /// emulation when writing to floppy images. This was noticed when trying to use MAME to help speed up some A3 driver development. After a few operations writing to the disk, then some corruption happens and the disk image will not work anymore.

It is easily reproducable and looks like its been there for quite some time, the current 0.196 has it, and looks like back to 0.158, but 0.153 is ok.

You can test and reproduce with the following disk image:
http://www.apple3.org/Software/programming/basic/Apple3BusBasic.dsk

1. Boot the dsk image mounted as flop1
2. type 'load volumes' (read a basic program to save in)
3. repeat saving the same file many times 'save volumes1', 'save volumes2' ..etc
4. Error can occur after 1 or 2 times, or may take quite a bit more. Looks like you can get two things that happen when the write errors occur
- ?VOLUME NOT FOUND - then the disk directory blocks seem trashed, you can see this if you open up the dks image in ciderpress using the block viewer
- ?I/O ERROR - cannot save after this, but can do a CATALOG but this shows errors. Again, I think the directory sector is trashed some how.

I'm wondering if someone can have a look at why this might be happening?

/Robj

Joined: Apr 2012
Posts: 343
Likes: 60
Senior Member
Offline
Senior Member
Joined: Apr 2012
Posts: 343
Likes: 60
Originally Posted by robj
It is easily reproducable and looks like its been there for quite some time, the current 0.196 has it, and looks like back to 0.158, but 0.153 is ok.
I don't think this is specific to the Apple or any particular format as I've also had BBC users reporting to me something similar. I have been able to replicate the issue myself with bbcb and a ssd format floppy and it seems to insert an extra byte after the first sector rendering the image corrupt. Haven't yet investigated further as it seems core floppy image related.


BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.
Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
I was reading up on the Apple2 game subnodule at John Romero's website and thought I'd give it a spin in Mame's apple2e driver and it doesn't work.

./mame64 apple2e -flop1 subnodule.dsk

and it drops out to the monitor right after booting.

It's quite a good read.

http://rome.ro/subnodule/



Joined: Mar 2001
Posts: 17,217
Likes: 234
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,217
Likes: 234
Yeah, the boot sector loads what appears to be invalid data and jumps to it, even if I switch to the old HLE disk controller. I'll take a more detailed look later today unless Peter Ferrie sees it first smile

Last edited by R. Belmont; 04/23/18 05:50 PM.
Joined: Jun 2014
Posts: 95
Likes: 3
P
Member
Offline
Member
P
Joined: Jun 2014
Posts: 95
Likes: 3
Maybe I need a notification subscription, because I saw this only by accident.
The sectors are ProDOS order (0, E, D, C...), not DOS order (0, 1, 2, 3...).
It works in AppleWin, for example, because they don't do the right thing.
It's not a bug, and not MAME's fault.
Reording the sectors will give you a good image. Do you need me to send one?

Joined: Mar 2001
Posts: 17,217
Likes: 234
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,217
Likes: 234
I can add a heuristic to detect this disk. We already do for a bunch of them. Wasn't quite expecting the disk to be ProDOS order since it has a DOS 3.3-looking BOOT0, but you never know smile

Last edited by R. Belmont; 04/23/18 07:39 PM.
Page 14 of 80 1 2 12 13 14 15 16 79 80

Link Copied to Clipboard
Who's Online Now
1 members (AJR), 366 guests, and 6 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,320
Posts121,944
Members5,074
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
Forum hosted by www.retrogamesformac.com