So, I am working on getting a program of mine to accept input from Ans (much like using "Some-String":asm(prgmXXX;), but I need some help regarding how RclAns works.

According to wikiti.brandonw.net, Input from ans is stored in OP1. however, Matref said to check bits 0-4 of A, something I thought would be destroyed/not hold useful data. He also said to skip the first two bytes of data, as that would be a size word (or something like that)

since Ans would now consist of a string of bytes, could I really move it by just "LD HL,(OP1)"? or would OP1 point to another location where the entire string is stored? or or, would it span across OP1-6?

Input is expected to be just 8 charecters or less (a program name).
Oh but wait, _RclAns only works if Ans is a number. You'd like to use "bcall _AnsName \ bcall _ChkFindSym", the first of them copying Ans's name into OP1. Then you can do what I said.


Code:
 bcall _AnsName ; $4B42
 bcall _ChkFindSym
 ret c ; Ans hasn't been created
 and $1f ; bits 5 - 7 are garbage
 cp StringObj ; 4
 ret nz
 ex de, hl ; get pointer to content in HL
 ; get size word in BC
 ld c, (hl)
 inc h
 inc hl
 ld de, OP1
 ld a, 8
 cp c
 jr nc, $ + 4
 ld c, 8 ; limit name length to 8
 push hl \ push de \ push bc
 bcall _ZeroOp1
 pop bc \ pop de \ pop hl
 ldir
 ; now you have the name in OP1, do whatever you want with it
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement