Nspire Compatibility

Porting Richard Russell's BBC BASIC (Z80) to the TI-83+ and TI-84+ series calculators.

Moderator: benryves

User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: Nspire Compatibility

Post by benryves »

Does VDU 4 crash as well?
bwang
New Member
Posts: 25
Joined: Tue 11 Nov, 2008 7:36 pm

Re: Nspire Compatibility

Post by bwang »

VDU 4 does not crash.
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: Nspire Compatibility

Post 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 -
darkstone knight
New Member
Posts: 67
Joined: Sun 09 Nov, 2008 1:56 pm

Re: Nspire Compatibility

Post by darkstone knight »

well, vdu4 loads (Text.4.PutMapNoWriteBuffer) in (Text.PutMapNoWritebuffer+1), but vdu5 loads the adress of a routine? :?:
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: Nspire Compatibility

Post 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).
Post Reply