[A83] Re: statvars...??? [Ti83+]


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

[A83] Re: statvars...??? [Ti83+]




> Van: Kirk Meyer <kirk.meyer@colorado.edu>
> 
> There's no reason MirageOS should need to save registers via pushing an
> popping -- interrupt is what the shadow registers are mainly for. Any
> program that uses shadow registers would DI before such code and EI
> afterward. It doesn't seem as though there would be a very big gain to
using
> the shadow registers in a C compiler -- they're only efficient sometimes
in
> hand-coded assembly, and that's when you can create 2 distinct sets of
> things that you need. Doing exx all the time is hardly efficient.

You might want to know that the compiler hasn't been created for the Ti's
alone, it has bee around since the '80s... It seems that this platform is
the first (from 15 others!) that doesn't preserve all registers in
interrupt, therefor we use this code:

[..header stuff..]
	call	tidi
	call	_main

; Deallocate memory which has been allocated here!	
.cleanup
	call	tiei
[..exiting stuff..]
	ret

.tiei
	exx
	ld	hl,(hl1save)
	ld	bc,(bc1save)
	ld	de,(de1save)
	exx
	ld	iy,(iysave)
IF DEFINED_GRAYlib
	im	1
ELSE
	ei
ENDIF
	ret

.tidi
IF DEFINED_GRAYlib
	im	2
ELSE
	di
ENDIF
	exx
	ld	(hl1save),hl
	ld	(bc1save),bc
	ld	(de1save),de
	exx
	ld	(iysave),iy
	ret

I hope you now all understand why we don't have problems with the IM1
interrupt.

BTW: I do notice that it should be GREYlib (with an E), but it was an
Italian who made it... And it doesn't matter...




Follow-Ups: