[TI ASM] list input through ans

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

[TI ASM] list input through ans

Post by King Harold »

I've been learning asm for some time (3 days now lol)
But im learnin fast.. however, how does one store and access data that is in a list in ans? or a matrix?
is it simply storing it to a .db somewhere? (it got me assemble errors but hey im a noob..)
I'd also like to know how you read/write to/from appvars, i sort of get lost there, it didnt seem to work the same as for normal programs (maybe it does though, i think it should work the same)
threefingeredguy
Calc King
Posts: 2195
Joined: Sun 27 Mar, 2005 4:06 am
Location: sleeping
Contact:

Post by threefingeredguy »

Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

Ok, but where do i get the pointer?
Its in ans so like this?? ld hl,(ans)
that just isnt it..
thanx for that link anyway im sure it will help me in some way
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

In the TIOS you would do something like this:

Code: Select all

{0,1,2,3,4:Asm(prgmANSLIST
And prgmANSLIST would look like this:

Code: Select all

.nolist
#define end .end
#define END .end
#define equ .equ
#define EQU .equ
 
#include "ti83plus.inc"
#define ProgStart $9D95
.list
 
.org ProgStart - 2
.db t2ByteTok, tAsmCmp 
 
start_of_program:
        bcall(_RclAns)                  ; recall Ans
        ld hl,1                         ; 1st element in Real List
        bcall(_GetLtoOp1)               ; get element
        bcall(_ConvOp1)                 ; returns a as LSByte
        ld h,0
        ld l,a                          ; hl = a, the 1st list element
        bcall(_DispHL)                  ; display hl
        ret
 
.end
.END

That will display the 1st element in the list. To get the 2nd element in the list change HL before calling _GetLtoOp1, like so:

Code: Select all

        ld hl,2                         ; 2nd element in Real List
Hope this helps :).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

thanx that looks like it should work
what happens if you try to get an element that isnt there though? im guessing your screen gets filled with strage chars - calc turns off - ramcleared?
or does it return 0 in OP1
or is there a "length of list in ans" function?

Edit: actually, nvm that, it returns a nice 0 and no error. But what about FP numbers?
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Floating point numbers will be placed in Op1, however _ConvOp1 will convert the floating point number to a 16-bit integer and place it into DE (with the LSB in A as well). Of course, if the exponent is > 3 then you will either reieve and error or unexpected results.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

so basically it just throws the value in op1.
is that right?
edit: yes it is, problems solved
Post Reply