Page 2 of 2

Re: Nspire Compatibility

Posted: Sun 06 Dec, 2009 2:40 am
by benryves
Does VDU 4 crash as well?

Re: Nspire Compatibility

Posted: Sun 06 Dec, 2009 3:06 am
by bwang
VDU 4 does not crash.

Re: Nspire Compatibility

Posted: Sun 06 Dec, 2009 3:22 pm
by benryves
Well, I'm stumped, then!

The various text outputting routines are vectored, so when switching MODE or between VDU 4/VDU 5 the routines that are responsible for outputting text are swapped. In theory, if it's part of the sprite-drawing code that's to blame (which is used to draw characters in VDU 5 mode) then it should only crash when text is output, but an infinite loop to suppress output didn't apparently help.

VDU 5 does nothing special that should trigger a crash that VDU 4 doesn't do, as far as I can see (source):

Code: Select all

; ========================================================================================
; VDU 4                                                           DRAW TEXT AT TEXT CURSOR
; ========================================================================================
Vdu4
	ld hl,(Text.4.PutMapNoWriteBuffer)
	ld (Text.PutMapNoWritebuffer+1),hl
	ld hl,(Text.4.PutMap)
	ld (Text.PutMap+1),hl
	ld hl,Text.Cursor.Up.Routine    \ ld (Text.Cursor.Up+1),hl
	ld hl,Text.Cursor.Down.Routine  \ ld (Text.Cursor.Down+1),hl
	ld hl,Text.Cursor.Left.Routine  \ ld (Text.Cursor.Left+1),hl
	ld hl,Text.Cursor.Right.Routine \ ld (Text.Cursor.Right+1),hl
	ld hl,Text.Cursor.PutBlinking.Routine \ ld (Text.Cursor.PutBlinking+1),hl
	ld hl,Text.Cursor.MoveToLeft.Routine \ ld (Vdu.Text.Cursor.MoveToLeft+1),hl
	xor a
-	ld (Text.GraphicalText),a
	ret


; ========================================================================================
; VDU 5                                                       DRAW TEXT AT GRAPHICS CURSOR
; ========================================================================================
Vdu5
	ld hl,Text.Graphical.PutMap.Routine
	ld (Text.PutMapNoWritebuffer+1),hl
	ld (Text.PutMap+1),hl
	ld hl,Text.Graphical.Cursor.Up.Routine    \ ld (Text.Cursor.Up+1),hl
	ld hl,Text.Graphical.Cursor.Down.Routine  \ ld (Text.Cursor.Down+1),hl
	ld hl,Text.Graphical.Cursor.Left.Routine  \ ld (Text.Cursor.Left+1),hl
	ld hl,Text.Graphical.Cursor.Right.Routine \ ld (Text.Cursor.Right+1),hl
	ld hl,Text.Graphical.Cursor.PutBlinking.Routine \ ld (Text.Cursor.PutBlinking+1),hl
	ld hl,Text.Graphical.Cursor.MoveToLeft.Routine \ ld (Vdu.Text.Cursor.MoveToLeft+1),hl
	ld a,$FF
	jr -

Re: Nspire Compatibility

Posted: Mon 07 Dec, 2009 10:32 am
by darkstone knight
well, vdu4 loads (Text.4.PutMapNoWriteBuffer) in (Text.PutMapNoWritebuffer+1), but vdu5 loads the adress of a routine? :?:

Re: Nspire Compatibility

Posted: Mon 07 Dec, 2009 11:14 am
by benryves
Text.4.PutMap is a variable that stores the address of the routine that is used to put characters on the screen and text buffer in VDU 4 mode (Text.4.PutMapNoWriteBuffer is the same but doesn't draw the underlying character to the text buffer at the same time, used for the flashing cursor). These variables contain Large.PutMap.Routine and Large.PutMapNoWriteBuffer.Routine when the large font is in use, Small.PutMap.Routine and Small.PutMapNoWriteBuffer.Routine when the small font is in use. (See Lib\VDU\Text\Modes.asm for example).

The graphical text routines are more flexible, as they don't need to draw the characters to a text buffer, just the screen. For this reason everything goes via Text.Graphical.PutMap.Routine, which performs the decisions to draw using the small or large font itself (bearing in mind you can change to the "wrong" font for the current mode with the *FONT command).