[Coco] Cubix and Coco3 - code snippet

Gary Zwan gary at ccountry.net
Tue Feb 6 23:33:21 EST 2007


Forgive me gents (and ladies?),

Don't really know how to respond to the archive list so it stays in the 
thread.

Here is a portion of the 'command.os' file from cubix:

it lost some of the formatting between  Winderz notepad
and  Xandros Kate(?).


*
* CUBIX Internal (built in) command handlers
*
* FORMAT COMMAND
*
INIT	JSR	PURGE		INSURE NO DISK I/O IN PROG
	JSR	GETDRV		GET DRIVE ID
	STA	>SDRIVE		SELECT IT
	JSR	GETCTL		PT 'U' TO CTRL BLOCK
	LDD	#$0203		DEFAULT INTERLEAVE & ALLOCATION
	STD	>TEMP4		SAVE IT
* GET FORMAT OPERANDS
INI00	JSR	SKIP		ANY MORE OPERANDS?
	BEQ	INI1		NO, THTS ALL
	LDX	#INITAB		POINT TO TABLE
	JSR	TLOOKE		GET DATA
	PSHS	B		SAVE ID
	JSR	GETNUM		GET VALUE
	PULS	A		RESTORE A
	TSTA			INTERLEAVE?
	BNE	INI01		NO
	STB	>TEMP4		SAVE INTERLEAVE
	BRA	INI00		TRY FOR NEXT
INI01	DECA			DIRECTORY?
	BNE	INI02		NO, USE STANDARD OPTIONS
	STB	>TEMP4+1	SET DIRECTORY ALLOCATION
	BRA	INI00		TRY FOR NEXT
INI02	DECA			CONVERT
	CMPA	#3		IN RANGE?
	LBHI	BADOPR		NO, REPORT ERROR
	STB	A,U		SET UP DRIVE
	BRA	INI00		TRY FOR NEXT
* DISPLAY FORMAT
INI1	JSR	WRLIN
	FCCZ	'Formatting '
	LDA	>SDRIVE
	JSR	SHODRV		SHOW THE DISK
	LDX	#INITAB		POINT TO TABLE
	CLRA			DISPLAY INTERLEAVE
	LDB	>TEMP4		GET INTERLEAVE FACTOR
	JSR	SHODRB		DISPLAY IT
	LDA	#1		DISPLAY DIRECTORY EXTENSION
	LDB	>TEMP4+1	GET DIRECTORY EXTENSION
	JSR	SHODRA		DISPLAY IT
	JSR	WRLIN		MESSAGE
	FCB	$0A,$0D		NEW LINE
	FCCZ	'Ok? '
	JSR	GETCHR
	JSR	PUTCHR		ECHO
	ANDA	#$DF		GET IT
	CMPA	#'Y'		
	LBNE	LFCR
	JSR	LFCR		NEW LINE
* FORMAT PHYSICAL DISK
	LDA	>TEMP4		GET INTERLEAVE FACTOR
	JSR	FORMAT		FORMAT THE DISK
	LDA	>TEMP4+1	GET DIRECTORY ALLOC
	STA	>TEMP4		LOCAL COPY OF DIR ALLOC
* SET UP DIRECTORY & LINK TABLE ON DISK
	LDX	#WRKSPC		POINT TO IT
INI2	CLR	,X+		CLEAR ONE
	CMPX	#WRKSPC+512	ARE WE OVER?
	BLO	INI2		NO, KEEP CLEARING
* WRITE BASE DIRECTORY SECTOR
	LDX	#WRKSPC		PT BACK TO IT
	LDD	#DIRSEC		DIRECTORY SECTOR
	JSR	WDISK		WRITE DIRECTORY (NO FILES)
* WRITE NON-BASE LINK SECTORS
	JSR	CURSIZ		GET SIZE OF CURRENT DRIVE
	SUBD	#1		CONVERT TO HIGHEST SECTOR ID
	TFR	A,B		COPY A&B = D/256(ENTRIES/LINKSEC)
	STD	>TEMP3		SAVE FOR LATER
	LDD	#LNKSEC+1	POINT TO LINK SECTOR
INI3	DEC	>TEMP3+1	REDUCE COUNT
	BMI	INI4		END
	JSR	WDISK		WRITE IT
	ADDD	#1		NEXT SECTOR
	BRA	INI3		KEEP GOING
* WRITE NON-BASE DIRECTORY SECTORS
INI4	DEC	>TEMP4		BACKUP
	BMI	INI5		THATS ALL
	JSR	WDISK		WRITE IT
	ADDD	#1		NEXT ONE
	BRA	INI4		DO EM ALL
* WRITE BASE LINK SECTOR


***********************************************

I am glad to see that several heads are still keeping an eye
on this .  I have done various small Assembly programs
but nothing of this magnitude.  Maybe its time I learned
Python -- this would give me the reason I need to learn
it.

BUT YOU KNOW how New Year's resolutions are !~!!!!

I am torn between RSDOS and Cubix as I want to create a
home control system, without a keyboard -- mainly 
the serial way, maybe a monitor.

Gary 




More information about the Coco mailing list