Cbmsh - A Unix-like shell for the commodores

Basic and Machine Language

Moderator: Moderators

User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

pallas wrote:On a side note, do you think the "unit" command should be renamed to "dev"? I used the "unit" term because it's used by cc65, which covers many non-cbm systems as well so it must be generic, but I understand the most used cbm term for it is "device", shortcut to "dev".
Would make sense, at least in principle. In CBM DOS, 'unit' actually refers to the drive number, which is normally fixed to 0 on a single-disk drive, but can be 0 or 1 on a dual-disk drive (like the 8250LP). In BASIC V4, you can tell the drive to show the directory of the disk in unit 1 on device #8 like thus: CATALOG D8 ON U1, or even copy the contents of a disk in unit 0 to another disk in unit 1 (on the same drive!) with BACKUP U0 TO U1.

However, as the number of dual-disk drives is supposedly rather small, it's more an academic problem. They'd all have to be connected to the VIC-20 over IEEE anyway, and then there would be yet another KERNAL expansion on a cartridge in play - where cc65 again would be required to play nice with.

Nethertheless, programs might use the drive number/unit explicitly in the command channel, for example in OPEN 15,8,15, "S0:EXAMPLE.PRG" : CLOSE15, where the drive number is optional between the command (here, Scratch) and the colon. That had been another thing that cropped up during the beta-test phase of the FE3 RAM Disk. ;)
User avatar
freshlamb
Vic 20 Dabbler
Posts: 76
Joined: Sun Apr 04, 2004 5:38 pm
Website: http://www.rufnoiz.com
Location: Prince Albert SK Can

Post by freshlamb »

Just a note. The MSD SD-1 is a dual disk drive that uses the serial line. I only mention this because I own one.
pallas
Vic 20 Devotee
Posts: 212
Joined: Mon Dec 24, 2012 2:38 am

Post by pallas »

I'll have a look at dual drives by vice emulation as soon as I'm done with the priority things like loading multi bank carts and finish testing and fixing all the commands.
Currently I'm working on copy and move between devices, it's already working fine!
User avatar
RobertBe
Vic 20 Elite
Posts: 2304
Joined: Sat Jul 14, 2007 2:48 pm

Post by RobertBe »

freshlamb wrote:The MSD SD-1 is a dual disk drive...
The MSD SD-1 has a single 5 1/4" TEC floppy disk mechanism. The MSD SD-2 has two floppy disk mechanisms.

Writing from Los Angeles,
Robert Bernardo
Fresno Commodore User Group
http://videocam.net.au/fcug
July 27-28 Commodore Vegas Expo v9 -
http://www.portcommodore.com/commvex
pallas
Vic 20 Devotee
Posts: 212
Joined: Mon Dec 24, 2012 2:38 am

Post by pallas »

In order to read from one device and write to another, I switched from using open/read to cbm_open/cbm_read.

But, if I try to cbm_open a non-existing file, it doesn't return any error, nor does cbm_read, so I end up without any error message to the user and an empty target file :-(

Any clues?

Here is the code:

Code: Select all

if (cbm_open(14, <<dev>>, CBM_READ, src)) {
		perror(srcName);
		return FALSE;
	}

	if (cbm_open(15, <<dev>>, CBM_WRITE, tmpdest)) {
		perror(destName);
		cbm_close(14);
		return FALSE;
	}

	do {
		rcc = cbm_read(14, buf, BUF_SIZE);
		if (rcc < 0 || cbm_write(15, buf, rcc) < 0) goto error_exit;
	} while (rcc == BUF_SIZE);

	if (rcc < 0) {
		perror(srcName);
		goto error_exit;
	}

	cbm_close(14);
	cbm_close(15);
	return TRUE;

error_exit:
	cbm_close(14);
	cbm_close(15);
	return FALSE;
cbm_open() always returns 0 and rcc is 0 even if the file doesn't exists.
pallas
Vic 20 Devotee
Posts: 212
Joined: Mon Dec 24, 2012 2:38 am

Post by pallas »

I still haven't found a solution to the problem, this is getting frustrating.
Maybe I should really go back to the latest stable release of cc65 and make cbmsh compatible with it...
FD22
Vic 20 Hobbyist
Posts: 148
Joined: Mon Feb 15, 2010 12:31 pm

Post by FD22 »

What was the reason for not using the latest stable release anyway?

If it was something quite fundamental to the way the project works, it's a decision between switching and reworking to overcome that defecit, or sticking with the release you're on and writing this subroutine in assembly. Which would be the least work?
pallas
Vic 20 Devotee
Posts: 212
Joined: Mon Dec 24, 2012 2:38 am

Post by pallas »

yes, exactly.
the stable version has, among other things, a different way of dealing with the "current unit" (device), so if I was to make it compatible with the stable version, I would then need to undo the changes once there is a new stable release (assuming there will ever be one...).
Or, as you said, I could write my own routines, based on the asm or C versions of the cc65 sources.
I think the first solution is better, because there are other known issues which are probably due to some of the changes introduced recently in the cc65 sources. It just looked lame, and not fun at all, to got backwards :)
and, you know, when you do a program for fun, and you run into weird bugs and get frustrated, you start thinking "is it really worth? better save my sleep".
pallas
Vic 20 Devotee
Posts: 212
Joined: Mon Dec 24, 2012 2:38 am

Post by pallas »

Great cc65 news! They started posting updates on svn again!

I've tried compiling cbmsh with the latest svn commit and... it freezes just after running it :-)

I guess I will have to wait a little bit more ;-)
Or, start bebugging but I really do not have the time.
groepaz
Vic 20 Scientist
Posts: 1180
Joined: Wed Aug 25, 2010 5:30 pm

Post by groepaz »

actually the repository moved to github: https://github.com/oliverschmidt/cc65 ... the old svn is abbandoned
pallas
Vic 20 Devotee
Posts: 212
Joined: Mon Dec 24, 2012 2:38 am

Post by pallas »

thanks, I didn't notice.
I had a look at the git repository and it looks like the svn is fresher (it's updated more than once daily, while the git last commit is jul 10).
groepaz
Vic 20 Scientist
Posts: 1180
Joined: Wed Aug 25, 2010 5:30 pm

Post by groepaz »

which svn are you talking about? the one run by UZ (ie the old one) hasnt been updated at all for a while.
pallas
Vic 20 Devotee
Posts: 212
Joined: Mon Dec 24, 2012 2:38 am

Post by pallas »

the url is:

svn://svn.cc65.org/cc65/trunk

#svn log -r HEAD
------------------------------------------------------------------------
r6014 | uz | 2013-07-16 12:22:11 +0200 (Tue, 16 Jul 2013) | 2 lines

Added functions to copy and move typed values.
pallas
Vic 20 Devotee
Posts: 212
Joined: Mon Dec 24, 2012 2:38 am

Post by pallas »

well I don't know what they are doing with the svn, but it doesn't even compile the compiler.
the git works much better, it can compile and the resulting cbmsh runs, even though the problems I had with some cbm_() calls are still there.
Post Reply