[A83] Re: SDCC Port


[Prev][Next][Index][Thread]

[A83] Re: SDCC Port









Stupid like a fox!
Look ma, I'm an artist: http://aaronstj.deviantart.com

>Thought about all the different shells? They need different startup code.  
>Hech there isn't even a standard one that you could use that would work in 
>every Ti8x calc. The calcs have minor differences (other than ROM adresses, 
>which can be "fixed" by using the linker) but they are there.

Yes, I had given that some consideration, and had a number of different 
thoughts.  One is that, as I only own a TI-83, I'm really only interested in 
making it work for the TI-83.  I suppose other other authors could work off 
my project to create simliar developement kits for other TI calculators, but 
that's their decision, not mine.

Second is that there is indeed a problem with the multiple shells.  There 
are three solutions that I have conbsidered:

1) Create the library in such a way that the author can specify which shell 
he wants the program to run on

2) Pick one shell to keep copmatibility with and run with it.  It would seem 
reasonable to pick ION, and it's pretty much become the TI-83 standard, as 
far as I can tell, and all new TI-83 shells are ION compatible.

3) Create a new shell specially designed to run these programs.  The shell 
could also contain a commonly-used subset of the CRT to save on storage (IE, 
the sheel would have 1 copy of printf() instead of 3 programs each having 
identical copies).  This, to me, is the most interesting programming 
challenge, but perhaps not the most reasonable.

I believe I will go with #2 at least for early implementation and testing, 
and maybe move to #3 later.

>>looks to me (after some simple tests) that as long as a "good" copy of IY 
>>is saved and restored before you call any system routines or exit the 
>>program, you can change IY all you want.
>
>And what about the system interrupt? You should disable that too,
shouldn't you?

Yes, I considered that.  In the end, it may turn out to be best to create 
some sort of interrupt wrapper, as was mentioned.  I don't yet know enough 
about the TI-83 internals to know exactly when and why interrupts are 
triggered (there seems to be no authoritative technical reference, just 
poorly written 'gurus' by people who don't understand the system well at 
all), but it seems to me so far that you may not need to worry about 
interrupts.

What follows is the test I wrote to test all this.  If you want to copmile 
it yourself, you'll need my TI8xDS assembler, which you can find at 
http://ti8xds.sourceforge.net.  I only tested this on the TI-83 under VTI, 
but it should be trivial to do similar tests on the TI-83+ or real hardware.

----BEGIN CODE----
INCLUDE "ti8xds_ion.inc"

xcall:	MACRO
	pop	IY
	bcall	\1
	push	IY
	ENDM

SECTION "TEST",CODE
Header:
	xor	a
	jr	nc,start
	db	"IY Test", 0
start:
	jp	Main

Main:
	push	IY

.loop
	;delay a while, to test the effects of an interrupt
	;hapenning in the middle of some code
.delay
	dec	BC
	ld	A, B
	or	A, C
	jp	nz, .delay

	;put some text, we're still alive!
	ld	HL, Text
	xcall	_puts

	;get a key, and quit if it's celar
	xcall	_getkey
	cp	$09
	jp	z,.bail

	;fuck with IY
	inc	IY

	jp	.loop

.bail
	pop	IY
	ret

Text:
	DB	" This is a test "
----END CODE----

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus