This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
Jeffrey


Member


Joined: 12 Jun 2003
Posts: 212

Posted: 25 Oct 2003 08:07:04 pm    Post subject:

OK, i can create AppVars, but I cant edit or use them in a program. My ulitimate goal (thanks to Justin W) is to make an asm formula bank that will have a formula editor with it.

So, how do I do the appvars?
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 26 Oct 2003 12:36:49 am    Post subject:

OK Appvars are rather simple.

To access their data you use the ChkFindSym ROM Call to get the appropriate pointers to the appvars data.

Note: This code is to be used if the appvar you are trying to access already exists.



Code:
  ld hl,AppvarName
  rst 20h
  bcall(_ChkFindSym);de=pointer to data in ram   hl=pointer to symbol table entry
  ret c  ;If the appvar doesn't exist return
  inc de
  inc de;by incrementing de twice we have bypassed the size bytes of the appvar
 ;-----here you can read or write data to and from the appvar

AppvarName:
  .db AppVarObj,"TestVar",0


I hope this helps you out Jeffery.
Back to top
Jeffrey


Member


Joined: 12 Jun 2003
Posts: 212

Posted: 26 Oct 2003 09:36:56 am    Post subject:

Ok, so to write to the AppVar itself, would you do like:


Code:
ld hl,stufftoput
ld (de),hl

stufftoput:
.db "Test Text",0


Then how would I read from it?
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 26 Oct 2003 11:13:58 am    Post subject:

Jeffrey wrote:
Ok, so to write to the AppVar itself, would you do like:


Code:
ld hl,stufftoput
ld (de),hl

stufftoput:
.db "Test Text",0


Then how would I read from it?

Actually your code above would not work.

ld (de),hl is not a legal z80 instruction. Even if it was all that would do is load the address of the text string into de.

If you wanted to copy that string into the appvar you would need to


Code:
;Note-de already is at the address we want to copy to, so don't change it.

  ld hl,stufftoput
  ld bc,10  ;10 being the length of the string
  ldir    ;copy the bytes
;whatever code--------
stufftoput:
  .db "Test Text",0


The above would copy the entire 10 bytes of the string stufftoput to the appvar.




Now let's say you wanted to read from the appvar then write the data to a saferam buffer.

Now let's assume that you have just used the code in my first post to get to the start of the appvar's data. Immediately following the 2 inc de's


Code:
ex de,hl    ;swap hl with de so hl is now pointing to the start of the appvars data
ld de,AppBackUpScreen  ;768 bytes buffer for use by asm programs and apps
ld bc,10    ;10 bytes to copy as before
ldir  ;copy the bytes


Now that's to do multiple byte writing and reading.

Let's say you want to read a single byte from the appvar. Once again assume that we have just done the ChkFindSym routine in the first post.

Code:
  ld a,(de)
;here you can do whatever you want with a as it holds the first byte of the appvar


Last edited by Guest on 26 Oct 2003 11:16:27 am; edited 1 time in total
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement