Ashbad, I still have a more pessimistic view of it, especially in terms of size: I think that the programs it generates are huge compared to those written by even a mediocre ASM coder (a necessary tradeoff for speed in machine-generated code without a complex optimizer), but I respect your respect for it.
calcman wrote:
Could someone give me an example to make an appvar/store to it/recall information?

Thanks
Gladly.


Code:
;--- Store 8 bytes in an appvar ---
   ld hl,MyAppvarName
   rst 20h ;copy name to Op1
   bcall(_ChkFindSym)
   jr nc,AppvarExists
   ld hl,8  ;we want 8 bytes of space
   bcall(_CreateAppVar)
AppvarExists:
   inc de
   inc de
   ld hl,DataToLoad ;pointer to data to save
   ld bc,8 ;size of data to load
   ldir ;copy it in!

;--- Recall 8 bytes from an appvar ---
   ld hl,MyAppvarName
   rst 20h ;copy name to Op1
   bcall(_ChkFindSym)
   jr c,AppvarDoesNotExist ;define what happens here yourself
   inc de
   inc de
   ld hl,DataDestination
   ex de,hl
   ld bc,8
   ldir ;copy from appvar to memory

AppvarName:
   .db 15h,"AVNAME",0
What does bcall chkFindSym do?
Also where does the memory in Recall from appvar end up in which register?
B_CALL ChkFindSym searches the VAT for a program or an appvar. It outputs a pointer to the first byte of the appvar or program in DE.
So I could do:

Code:

ld l,e
ld h,d
bcall disphl

To display the appvar value?
No, I said it outputs a pointer to the first byte of the appvar. The first byte of the appvar contains the size, and the second byte tells whether the appvar is archived or not. The actual data doesn't start until (de+2). If you want to display a value in the appvar, you could do something like this:

Code:

..... Code that finds the appvar, and outputs the pointer to its first byte in DE.....

 inc de
 inc de ;Now we are at the first byte of the data section
 ex de,hl ;Exchange the values of DE and HL, now DE's value is in HL
 ld a,(hl) ;get the byte that is pointed to by HL into A
 ld l,a ;store A into L
 ld h,0 ;store 0 into H
 B_CALL(_DispHL) ;display HL
 ret
calcman wrote:
What does bcall chkFindSym do?
Also where does the memory in Recall from appvar end up in which register?
After _ChkFindSym, if the variable in question exists (ie, carry flag is reset, aka nc), de points to the size word of the appvar. Increment it twice, and now it points to the first byte of the appvar's data. It sounds to me like you don't understand indirection yet.
That is correct, I do not understand indirection.
Any websites I can learn that? Question
calcman wrote:
That is correct, I do not understand indirection.
Any websites I can learn that? Question

http://www.cemetech.net/forum/viewtopic.php?t=1708
Why doesn't this work?

Code:

org  userMem-2
db   $bb,$6d
Start:
bcall clrlcdfull
bcall runindicoff
ld  B,101
Call $4086    ;irandom
ld A,E
ld D,0
push de
ld hl,0
ld (curcol),hl
ld (currow),hl
ld hl, GuessT
ld B,50
jr Disp
Guess:
bcall  getcsc
cp  skclear
jr z,quit
cp  skright
jr z,Up
cp  skleft
jr z,Down
cp sk2nd
jr z,check
jr guess
Up:
ld a,b
cp 100
jr z,Guess
inc b
jr Disp
Down:
ld a,b
cp 0
jr z,Guess
dec b
Jr Disp
Disp:
ld hl,1
ld (currow),hl
ld  l,b
push bc
bcall disphl
ld a,1
ld (curcol),a
ld hl,Arrow1
bcall puts
ld  a,5
ld (curcol),a
ld hl,Arrow2
bcall puts
pop bc
jr Guess
Quit:
ret
Check:
pop de
ld a,b
cp e
jr z,win
cp e
jr c,high
cp e
jr nz,low
jr Guess
Win:
push de
ld a,6
ld (currow),a
ld  hl,WinT
bcall  puts
bcall  getkey
ret
low:
push de
ld a,6
ld (currow),a
ld hl,lowert
high:
push de
ld a,6
ld (currow),a
ld hl,highert
higherT:
db  'Guess higher",0
LowerT;
db  "guess lower",0
Wint:
db   "you win",0
Arrow1:
db   "<",0
Arrow2:
db  ">",0
Guesst:
db "Guess a # 0-100",0

don't worry about caps
Maybe it's because you are using single quotes and double quotes here:

Code:
db  'Guess higher",0
No mimas wouldn't allow that.
Even if I did do that it would give me a syntax error, so I would have to switch it, It may be something during my check loop, but I am not sure waht I did wrong Neutral
The LowerT label ends in a semicolon (comment) as opposed to a colon (needed for a label)
Calcman, you gotta be more precise than "why doesn't this work". Tell us about what you tried, what the mode of failure is, and what the exact problem is. "It doesn't work" is nowhere near precise enough; it could be anywhere from "this outputs the wrong thing" to "this crashes my calculator".
After pushing 2nd it loops to "check" but it exits after, why?
Edit: It exits out even when I tried different things.
Can someone help? Neutral Does anyone know?
Just off the top of my head, the end of your code flows into your data, which is very bad:


Code:
ld (currow),a
ld hl,highert
[...data...]
What does this mean?

Code:

ld   A,$02

I know it has something to do with increasing A.
What happens if I did this?

Code:

ld   A,$03
LD is the LoaD instruction, it loads a value to a place in memory or a register. That code would store $02 into A, and your code would store $03 into A.
would ld a,$02 be the same as (inc A)x2 and ld a,$03 be the same as (inc A)x3?
Well, if A was zero to begin with, yes.

LD A,$02 just stores 2 to A. INC A increments A, adding one to whatever was there.
So ld A,$03 stores 3 to a?
Also why is ld A,$02 == inc a .. inc a?
  
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
» Goto page Previous  1, 2, 3 ... 11, 12, 13, 14  Next
» View previous topic :: View next topic  
Page 12 of 14
» 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