Re: A86: Input string


[Prev][Next][Index][Thread]

Re: A86: Input string




In a message dated 11/22/98 12:17:34 Eastern Standard Time, Bowser797@aol.com
writes:

> I need a string input routine.  At ticalc.org, I found this one (below), 
> which
>  says it outputs to op1.  I'm new to asm, and I don't really know what op1
is.
> 
>  I thought it had something to do with floating point calculations.  Also, I
>  don't really understand how to use it.  What are cleantmp and ptempcnt?  I
>  would appreciate any help.
>  
>  Thanks,
>  Bowser
>  

the op registers are 10 byte (actually, 11, but one is wasted) areas of ram
which can contain several things.  they are used for all floating points math.
however, they can also contain variable names.  in this input routine, the
string is stored in a variable, and that variable's name is stored in op1


    
>      ld      de,_ioprompt
>      ld      hl,str_prmpt
>      call    _mov10b ; move prompt to prompt buffer , 21 max
>      ld hl,(_cleantmp)
>      push hl	;Saves current cleantmp value
>      ld hl,(_PTempCnt)
>      ld (_cleantmp),hl ; cleantmp=ptempcnt so input errors save temp var
>      ld a,0Ch
>      ld (_asap_ind),a ; set for 'inputstring'
>      call _exec_pg3 ; get string, op1 = var containing string

at this point, the variable name is in op1.  if you want to get the actual
string, do this:

	rst 10h		 ;call _findsym
	;bde is pointer to data in ram
	ld a,b				;\
	ld h,d				; >ahl=bde
	ld l,e				;/
	call _load_ram_ahl		;load page containing variable.  hl is pointer to start
of data
	inc hl				;move past lower size byte
	inc hl 				;move past upper size byte

now hl points to the first byte of the string.  the string isn't 0 terminated,
so beware.  good luck.