Difference between revisions of "84PCE:Syscalls:021320"

From WikiTI
Jump to: navigation, search
Line 34: Line 34:
 
  jr c,SomeError
 
  jr c,SomeError
 
  ex de,hl  
 
  ex de,hl  
  call _Load
+
  call _LoadDEInd_s ; get the size of the the string
 +
push de
 +
pop bc
 +
ld de,pixelshadow ; copy it to saferam
 +
ldir
 +
xor a,a
 +
ld (de),a ; null terminate the string
 +
SomeError:
 +
call _DeleteTempEditEqu ; delete the temporary input
 +
call _ClrScrn
 +
jp _HomeUp ; clean up and leave
 +
 +
inputPrompt:
 +
.db "Input:",0 ; Input prompt
 +
inputPrompt_end:

Revision as of 05:19, 31 May 2016

Synopsis

Hypothesized Official Name: GetStringInput

Syscall Address: 021320h

Gets a string of input from the user, much like the common 'Input' command used in TI-Basic programs. This system call does not return until after the user presses enter, but allows for use of all OS menus and input variations, including the Alpha and 2nd Keys special abilities. It works by creating a temporary equation which it then makes the edit buffer. It can also display an optional prompt for the user, in order to be more user friendly. Note that when using this routine, the system monitor completely takes over, so it will act exactly as it does in TI-Basic programs, which may have unintended side effects. It is highly recommended you call DeleteTempEditEqu once you are finished with your input parsing.

Inputs

  • ioPrompt - Copy the optional prompt string here, or write a null byte for no prompt
  • curRow,curCol - Set to the appropriate values for the location where to display the prompt and input string
  • curUnder - This is the character that is first displayed under the cursor. You should set it to 0, unless you want something under the cursor

Outputs

  • editSym - Contains the VAT pointer to the temporary variable used for editing the input string. Can be used with VarNameToOP1HL to lookup the actual input data.

Destroys

  • All

Example

	call	_ClrScrn
	call	_HomeUp					; clean up things
	ld	hl,inputPrompt
	ld	bc,inputPrompt_end-inputPrompt
	ld	de,ioPrompt
	ldir						; copy the input prompt here
	xor	a,a
	ld	(curUnder),a
	call	_GetStringInput				; get the input from the user
	ld	hl,(editSym)
	call	_VarNameToOP1HL				; lookup the temporary input symbol
	call	_ChkFindSym
	jr	c,SomeError
	ex	de,hl 
	call	_LoadDEInd_s				; get the size of the the string
	push	de
	pop	bc
	ld	de,pixelshadow				; copy it to saferam
	ldir
	xor	a,a
	ld	(de),a					; null terminate the string
SomeError:
	call	_DeleteTempEditEqu			; delete the temporary input
	call	_ClrScrn
	jp	_HomeUp					; clean up and leave

inputPrompt:
	.db "Input:",0					; Input prompt
inputPrompt_end: