Page 1 of 2

[TI ASM] Typing Strings

Posted: Thu 03 Mar, 2005 3:31 am
by Shadow Phoenix
After some thought I have decided to use a displaying story parts likeit was done in FF. So do I just use _putS and halt is between to achieve typing effect?

Posted: Thu 03 Mar, 2005 7:26 pm
by Gambit
Did you accidentally press "Post" instead of "Reply"? :)

You would use _PutC/_VPutC instead of _PutS/_VPutS for that typing effect.

Posted: Thu 03 Mar, 2005 8:09 pm
by Shadow Phoenix
so you mean I would have to provide each separate letter for the typing effect?

Posted: Thu 03 Mar, 2005 8:38 pm
by jbshaler
so you mean I would have to provide each separate letter for the typing effect?
Basically, you print out the string one character at a time, but it doesn't need to make your code much longer. You would have the text in a string somewhere, and you would make a loop to print out a character and advance the string pointer, delaying after each, until you got to a null character. You will also need to manually update the horizontal (and vertical, possibly) cursor positions, of course.

Posted: Thu 03 Mar, 2005 8:42 pm
by sic
IIRC, _vputc does not update pencol, which is a problem since small letters have variable widths (i.e. "w" is much wider than "i"). It may be easier to 'walk' the string you want to display, and copy each letter to a new 1-character zero-terminated string, and display that (since _vputs does update pencol). You can HALT between characters.

Posted: Thu 03 Mar, 2005 9:01 pm
by Gambit
No, a null-terminated string would suffice. Something like the following would work:

Code: Select all

;Display a NTS @ (curRow,curCol)
;Inputs:
;	hl - pointer to NTS
;	(curRow) - cursor row
;	(curCol) - cursor column
;	Any other _PutC flags
;Outputs:
;	LCD - text drawn
;Destroys:
;	af b hl

typeText:
	ei			;make sure interrupts are enabled
	ld a,(hl)
typeTextLoop:
	push hl
	B_CALL(_PutC)
	pop hl
	call typeTextDelay	
	inc hl
	ld a,(hl)
	or a
	jr nz,typeTextLoop
	ret

typeTextDelay:
	push bc			;Save bc from destruction
	ld b,??			;Enter desired delay
typeTextDelayLoop:
	halt
	djnz typeTextDelayLoop
	pop bc
	ret
My mistake: there is no _VPutC defined in "ti83plus.inc." :oops: Hey, it seemed logical :? You are going to have to resort to _VPutMap if you want small characters. And add the stuff that sic and jbshaler mentioned.

Posted: Thu 03 Mar, 2005 9:46 pm
by koolmansam375
sic wrote:IIRC, _vputc does not update pencol, which is a problem since small letters have variable widths (i.e. "w" is much wider than "i").
i think it does update pencol. _vputmap is the one that doesnt

Posted: Thu 03 Mar, 2005 10:58 pm
by Jim e
_vputmap does update the pencol. it's useful for strings in apps.

Posted: Thu 03 Mar, 2005 11:06 pm
by sic
Are you sure? I am almost positive that while _putc does update the coordinates (currow and curcol), _vputmap does not update penrow/pencol.

Posted: Thu 03 Mar, 2005 11:18 pm
by Jim e
Vputmap I know updates pencol i use it a lot, putc notsure.

Posted: Fri 04 Mar, 2005 4:40 am
by Gambit
_PutC updates curRow/curCol:
sdk83pguide wrote:PutC
Description: Displays a character and advance the cursor
Outputs:
Others: curRow, curCol Updated
And this code has no other explanation other than that VPutMap does update penCol/penRow (taken directly off the SDK):

Code: Select all

VPutSN:
   push af
   push de
   push ix
..10:
   ld a,(hl)
   inc hl
   B_CALL VPutMap
   jr c,PP11
   djnz ..10
PP11:
   pop ix
   pop de
   pop af
   ret
Interesting... I never knew that. :? However, PutMap does not affect the coordinates:
sdk83pguide wrote:PutMap
Description: Displays a character in the large font without affecting the cursor position

Posted: Fri 04 Mar, 2005 4:44 am
by Spencer
True, but given it has to support smaller characters of variable width, it has to autoupdate. VPutMap can write both sizes of character, depending on your flag status.

Posted: Fri 04 Mar, 2005 6:35 pm
by sic
Ah. I must have been remembering _putmap. You must understand, it's been a long time since I've used any ROM calls in any of my programs :)

Posted: Fri 04 Mar, 2005 6:46 pm
by Jim e
Why would you ever want to use a romcall, aside from slowing down your calc. :wink:

Posted: Fri 04 Mar, 2005 7:37 pm
by CoBB
Why, even I used them before I knew about alternatives (I only had docs from ti.com back then).