[Coco] More Color Forth

Stephen Pereira spereira1952 at comcast.net
Sun Jan 25 14:01:45 EST 2015


Hello again, all,

In my continuing Color Forth project, I am attempting to install a brute force save of the Color Forth code screens to disk.  When I am eventually successful, I hope to at least be able to save and load the entire set of Color Forth screens 1-8 to and from disk, so we can be free from pre-loading only one set of screens 1-8 as it is now.

I am hoping to use the SAVEM (and LOADM) command from DECB.

I am a pretty good programmer in 8080 machine language, but I am an outright beginner on the 6809.  Please forgive my non-optimal code for now.  I am only hoping to get something going and then look for doing it well after I understand it all.

From my reading of “Disk Basic Unravelled,” I see that one can load the filename at $094C and the file extension at $0954, then put the start address, end address and execute address on the stack, and finally call SAVEM at $CF7E.  Yes, I know that is not the official entry point, I am bypassing the initial code to get the file name and addresses from the Basic input buffer.

Here is the snippet of (brute force) code that I wrote:

	PSHS	CC,A,B,DP,X,Y,U	SAVE ALL JUST IN CASE
	LDX	#$094C
	LDA	#$53	S
	STA	,X+
	LDA	#$43	C
	STA	,X+
	LDA	#$52	R
	STA	,X+
	LDA	#$4E	N
	STA	,X+
	LDA	#$31	1
	STA	,X+
	LDA	#$54	T
	STA	,X+
	LDA	#$4F	O
	STA	,X+
	LDA	#$38	8
	STA	,X
	LDX	#$0954
	LDA	#$42	B
	STA	,X+
	LDA	#$49	I
	STA	,X+
	LDA	#$4E	N
	STA	,X
	LDD	#$2382	START SCR 1
	PSHS	A,B
	LDD	#$439F	END   SCR 8
	PSHS	A,B
	LDD	#$0000	EXEC
	PSHS	A,B
	JSR	$CF7E	SAVEM
	PULS	U,Y,X,DP,B,A,CC	RESTORE ALL

What I am concerned about is whether or not I am getting the addresses onto the stack in the right order, and with the correct byte order.

The reason I’m asking is that this code “kind of works” in my Color Forth.  I do get a file onto disk called SCRN1TO8.BIN, but it is 21 blocks long, instead of 4 blocks, like I expected.

Finally, while my Drivewire UI shows the disk activity start and end, my code does not return to the command line in Color Forth, so I am also concerned about that.  I see in the “Disk Basic Unravelled” that the SAVEM command dose end with an RTS, so I did expect my code to return.

Thanks very much, in advance, for any comments or advice you may offer!

smp
--
Stephen M. Pereira
Bedford, NH  03110
KB1SXE




More information about the Coco mailing list