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

From WikiTI
Jump to: navigation, search
(Inputs)
 
Line 6: Line 6:
 
'''Syscall Address:''' 021320h
 
'''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 [[84PCE:Syscalls:021578|DeleteTempEditEqu]] once you are finished with your input parsing.
+
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 [[84PCE:Syscalls:021578|DeleteTempEditEqu]] once you are finished with your input parsing. It basically calls _NewContext with 50h, _Mon, then _NewContext with 3Fh.
  
 
=== Inputs ===
 
=== Inputs ===
Line 29: Line 29:
 
  xor a,a
 
  xor a,a
 
  ld (curUnder),a
 
  ld (curUnder),a
 +
ld b,(iy+9)
 +
ld c,(iy+28) ;back up old flag values
 +
res 6,(iy+28)
 +
set 7,(iy+9)
 +
push bc
 
  call _GetStringInput ; get the input from the user
 
  call _GetStringInput ; get the input from the user
 +
pop bc
 +
res 4,b ;restore old flag values
 +
ld (iy+9),b
 +
ld (iy+28),c
 
  ld hl,(editSym)
 
  ld hl,(editSym)
 
  call _VarNameToOP1HL ; lookup the temporary input symbol
 
  call _VarNameToOP1HL ; lookup the temporary input symbol

Latest revision as of 17:54, 25 September 2017

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. It basically calls _NewContext with 50h, _Mon, then _NewContext with 3Fh.

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
  • NOTE: You must reset 6,(iy+28) and set 7,(iy+9) before calling this function!

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
	ld	b,(iy+9)
	ld	c,(iy+28)				;back up old flag values
	res	6,(iy+28)
	set	7,(iy+9)
	push	bc
	call	_GetStringInput				; get the input from the user
	pop	bc
	res	4,b					;restore old flag values
	ld	(iy+9),b
	ld	(iy+28),c
	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: