English Amiga Board


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 30 December 2017, 23:04   #41
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,959
It's probably guaranteed that a real Amix tape has a filemark after the last file, since Commodore made them like that.

Most Unix tape drivers probably automatically write a filemark when the file is closed by default. But it's perfectly possible for an arbitrary tape to not have any filemarks after the last file. (With direct SCSI access, just issue a WRITE command then eject the tape.)
mark_k is offline  
Old 31 December 2017, 16:56   #42
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,959
The way WinUAE emulates writing filemarks is quite broken at the moment.

If you manually create an emulated tape by editing index.tape to contain e.g.
file1
file2
file3

with a linefeed after each filename, WinUAE emulates a tape with file1 data, filemark, file2 data, filemark, file3 data, filemark. Or at least that's what I think it should do.

However, when an Amiga program issues WRITE FILEMARKS (opcode $10), WinUAE creates an empty file and appends its name to index.tape. So if you issue ten successive WRITE FILEMARKS commands which each write a single filemark (CDB 10 00 00 00 01 00 each time), you end up with ten empty files in your tape directory and listed in index.tape.

Thus running any program that writes multiple files (with one filemark in between each) to tape, WinUAE creates an empty file in between every "actual" file: 00001.tape actual file, 00002.tape empty, 00003.tape actual file, 00004.tape empty etc.

Also, if multiple filemarks are written with a single command, WinUAE only creates one empty file. E.g. issuing 10 00 00 00 20 00 should write 32 successive filemarks.

To fix that, whenever WRITE FILEMARKS is issued you could just append that number of linefeeds to index.tape. And on reading, treat each linefeed in index.tape as indicating a filemark.

Last edited by mark_k; 31 December 2017 at 17:02.
mark_k is offline  
Old 31 December 2017, 18:02   #43
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 21,727
Writing was never really the main point and I never bothered to test it (and still don't )

But perhaps it now works more logically..
Toni Wilen is online now  
Old 31 December 2017, 22:01   #44
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,959
Thanks, seems to work OK now with writing a linefeed for each filemark to index.tape.

After writing several filemarks in a row and rewinding, I noticed an issue with using SPACE to move forward one filemark at a time:
TAPEEMU: 11.01.00.00.01.00
TAPEEMU: SPACE code=1 count=1
TAPEEMU: Next file
TAPEEMU: Extra Filemark
TAPEEMU: 11.01.00.00.01.00
TAPEEMU: SPACE code=1 count=1
TAPEEMU: Next file
TAPEEMU: end of data
TAPEEMU SENSE: F0.00.08.00.00.00.01.06.00.00.00.00.00.05.
...
TAPEEMU: 11.01.00.00.01.00
TAPEEMU: SPACE code=1 count=1
TAPEEMU: Next file
TAPEEMU: end of media
TAPEEMU SENSE: F0.00.48.00.00.00.01.06.00.00.00.00.00.05.


After the SPACE which positions the head after the last filemark (so just before the end-of-data mark), the next SPACE returns sense data BLANK CHECK, END-OF-DATA DETECTED. I think that's correct. And that command wouldn't change the head position.

If you then attempt another SPACE though, the EOM bit is set in the sense data (byte 2 is $48 not $08). It shouldn't be.


Edit to add: Also, the emulated tape drive doesn't support setmarks. So on receiving a WRITE FILEMARKS command with WSmk set (CDB[1] bit 1) you should return INVALID FIELD IN CDB.


Edit 2: winuae.exe 2017-12-31 18:14 seems to only allow writing 256 filemarks at a time. For example, if you issue WRITE FILEMARKS to write 16777215 = $FFFFFF filemarks (CDB 10 00 FF FF FF 00), checking index.tape shows it only contains 256 linefeed characters.

Last edited by mark_k; 31 December 2017 at 22:37.
mark_k is offline  
Old 01 January 2018, 09:41   #45
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 21,727
Quote:
If you then attempt another SPACE though, the EOM bit is set in the sense data (byte 2 is $48 not $08). It shouldn't be.
Fixed. Still some remains of old behavior.

Quote:
Edit to add: Also, the emulated tape drive doesn't support setmarks. So on receiving a WRITE FILEMARKS command with WSmk set (CDB[1] bit 1) you should return INVALID FIELD IN CDB.
Yes but did original spec mention that bit is reserved and should be zero? If not, old drives may ignore it.

Quote:
Edit 2: winuae.exe 2017-12-31 18:14 seems to only allow writing 256 filemarks at a time. For example, if you issue WRITE FILEMARKS to write 16777215 = $FFFFFF filemarks (CDB 10 00 FF FF FF 00), checking index.tape shows it only contains 256 linefeed characters.
I added 256 filemark limit sanity check. More than 10 probably never happens in real world anyway.
Toni Wilen is online now  
Old 01 January 2018, 21:00   #46
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,959
Quote:
Originally Posted by Toni Wilen View Post
Yes but did original spec mention that bit is reserved and should be zero? If not, old drives may ignore it.
SCSI-1 (s1-r17b.txt) shows CDB[1] bits [4:0] as reserved. The Wangtek 5525ES manual (p.107 of the PDF) shows that bit as 0. Ideally it would need real-hardware confirmation, but I think it's better to give an error, since you don't emulate setmarks.
Quote:
Originally Posted by Toni Wilen View Post
I added 256 filemark limit sanity check. More than 10 probably never happens in real world anyway.
Probably true. Maybe a good idea to mention that "truncation" in log output though.
mark_k is offline  
Old 24 January 2018, 18:27   #47
Saghalie
Registered User

Saghalie's Avatar
 
Join Date: Nov 2014
Location: FT Lewis, WA
Posts: 199
Just thought I would send out a "Thank you!!" to you guys for working through this and
getting the TAPEEMU to work!

I greatly appreciate the effort and am enjoying the fruits of your labor!

Thanks again!
Saghalie is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kickstart 1.3 with scsi.device 8bitbubsy support.Hardware 53 06 February 2018 13:14
Which scsi.device for emulation? MartinW support.WinUAE 17 04 September 2017 00:56
What is 2nd.scsi.device videofx support.Hardware 2 25 May 2014 18:45
Instaling SCSI.DEVICE in CWB 3.9 paulo_becas support.Other 13 21 April 2014 15:57
Which scsi.device? dannyp1 support.Apps 7 25 January 2012 22:10

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:17.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.06576 seconds with 12 queries