The code now:


Code:

.nolist
#include    "ti83plus.inc"
.list
.org    $9D93
.db    t2ByteTok, tAsmCmp
   Start:
    b_call(_clrLCDFull)
    ld a,$FF
    ld b,12
    ld hl,plotSScreen+(0*12)

    ld b,30
   Loop:
    ld (hl),a
    Inc hl
    djnz Loop
    b_call(_grbufcpy_v)
    b_call(_getKey)
    res PlotDisp, (iy+Plotflags)
    ret
.end
.end


Let's just say it's not working...
No, that is not how it is done. To start off with some styling concerns:
1) You don't need .end .end if you are using the DCS SDK like you should be.
2) Be consistent with your tabbing. The accepted standard, it seems, is to tab out one after a push and back in after a pop.
3) It is called tabbing out your code for a reason. Use tabs instead of spaces.
4) I tend to put an extra blank line after things that are grouped together. For instance, below, I put a space after the djnz so it is easier to see that that is a loop.

Here is your code correctly styled out:
Code:
.nolist
#include    "ti83plus.inc"
.list
   .org    $9D93
   .db    t2ByteTok, tAsmCmp
Start:
   b_call(_clrLCDFull)
   ld a,$FF
   ld b,12
   ld hl,plotSScreen+(0*12)
   ld b,30
Loop:
   ld (hl),a
   Inc hl
   djnz Loop

   b_call(_grbufcpy_v)
   b_call(_getKey)
   res PlotDisp, (iy+Plotflags)
   ret

Now for the actual fixing of your code. It doesn't seem like you understand the concept behind what the code is doing. It mostly looks like you are copy-pasting and trying to hack this together from little things people say that may or may not be related to what you need to do. I also notice that you do a ld b,12 and then don't use that value, except to overwrite it and forget about it. This is a place where you were just copy-pasting code. In my most humble opinion, I don't think you should try to recreate TI Basic commands in ASM, nor do I think that you should do ASM code as if it were TI Basic code. I won't actually fix the code because I have a feeling you will just permutate it somewhere else, in another piece of code and not actually learn the concept, which is the most important part.

Also, late, but thanks Kerm! It was a fun post to type up, and test my knowledge Smile
Basically everything that _player / Tanner said in the above post. And remember, if you're asking people for code help, "it doesn't work" is one of the worst things you could say in terms of motivating people to help you. The best ways to ask for help involve a concise, precise description of the problem, along with what you already tried to fix it.
Well, mentioning how I had already tried to fix it probably wouldn't help you help me at all. My first ASM prgm, and I have a sliver of knowledge about the language. I appreciate the help. Also, have you guys ever tried Google-ing help for this? It's impossible to find anything useful

Edit: I have another dilemma; how do you recall a picture? Like BASIC's "RecallPic".

Quote:
[17:28] <+Souvik> TI_Coder, you get a pointer to the picture with FindSym, and ldir it to plotSScreen


I have no idea how to "use" any of these...
WikiTI is your friend when it comes to learning how to use B_CALLs.
FindSym: http://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:42F4

ldir is an opcode that copies BC bytes from HL to DE.
I need an example of code to help me with this one. That Wiki page wasn't very much help. (I had no idea WikiTI existed)
TI's Documentation is really helpful, too. I think it is in their Flash Debugger. If you look on their website (education.ti.com), you can find it somewhere there.

Edit: http://education.ti.com/educationportal/sites/US/productDetail/us_sdk_73_83_84.html (Found through a google search for "TI Flash Debugger")
How can I recall a picture?...
Try coming up with some code by yourself first, since now you know about ldir and FindSym.
I don't think you guys understand. I have no idea what I'm doing. Asking me to come up with some code is like asking my dog to write a history paper. This is my second day with ASM, and I just need a couple examples to get me started. That's how I learn best. Now, on my calc, I've created a prgm (in BASIC) which recalls pics 1-4, clearing the screen between each pic. Kind of like an animation. I'd like to learn some simple things in ASM like:

Clear Screen - Already know it (b_call(_clrLCDFull))
Recall Pic - Don't know how to do this
Recall Prgm - To make the prgm loop

I'd GREATLY appreciate some help on this. Thanks in advance. You guys have helped me with so much already, and I'm beginning to feel like a nuisance, but you are the only people I know of who can help me
OK, here is the ASM code that I think would display the numbers 1-100


Code:


ld a,1
Loop:
ld a,0
ld (penRow),a
ld a,0
ld (penCol),a
ld hl,String
b_call(_VPutS)
INC a
djnz Loop
TI_Coder wrote:
OK, here is the ASM code that I think would display the numbers 1-100


Code:


ld a,1
Loop:
ld a,0
ld (penRow),a
ld a,0
ld (penCol),a
ld hl,String
b_call(_VPutS)
INC a
djnz Loop

That won't work, because you are trying to display a string that doesn't exist. And, you want to display a number, not a string. Change b_call(_VPuts) to ld l,a \ ld h,0 \ b_call(_DispHL)
I've moved this topic to the z80 programming section.
To start off, no double posting. It doesn't matter that it is a different topic you are talking about, it is in the same literal topic of the forum, and within 24 hours. After that, remember that it is necessary to tab out your code. You can't just have everything on the far left. Labels go on the left, program statements go anywhere but that.

After that, you use the word String, even though it isn't declared anywhere. I would have to take a small guess and say that you are just copying code there from earlier. You are also using the wrong method to display numbers. It is _VDispHL, not _VPutS (DisplayContentsOfHL vs. PutString). Also, your inc a should be an inc hl and your ld a,1 should be a ld hl,0 because A gets trashed on the third line with ld a,0. Don't forget about your ret after all of your code.

Another styling concern, don't change cases. If you are going to go all caps, stay all caps. If you are going to do it all lowercase, follow that for the entire program.
Let's retry this...


Code:

     ld hl,0

Loop:
     ld a,0
     ld (penRow),a
     ld a,0
     ld (penCol),a
     ld hl,String
     b_call(_VPDispHL)
     INC hl
     djnz Loop



Would this work?
TI_Coder wrote:
Let's retry this...


Code:

     ld hl,0

Loop:
     ld a,0
     ld (penRow),a
     ld a,0
     ld (penCol),a
     ld hl,String
     b_call(_VPDispHL)
     INC a
     djnz Loop

Would this work?

No, because the B register determines how long the DJNZ loop is going to run, not the A register. Also, you aren't loading A into HL with ld l, a \ ld h,0 .
How would I fix this?

Code:
     ld hl,0
     ld b,100
Loop:
     xor a
     ld (penRow),a
     ld (penCol),a
     b_call(_VDispHL)
     inc hl
     djnz Loop
     ret
I want you to comment this code and say exactly what it does at each step, now Smile (Note that I made some minor optimizations. xor a stores 0 to A. I can go over the logic later, if you want.)

Code:
     ld hl,0       ;loads 0 into hl
     ld b,100      ;loads 100 into b
Loop:         ;label
     xor a         ;stores 0 into a
     ld (penRow),a     ;loads a into penRow
     ld (penCol),a      ;loads a into penCol
     b_call(_VDispHL)     ;b_call to display the contents of hl
     inc hl         ;increase hl by 1
     djnz Loop      ;run the loop
     ret      ;exit the program




...right?
Those work for technical reasons. But what is the idea behind them. For instance, the comment for ld b,100 could be: Store 100 to B so that the loop will run 100 times. Note, however, that that is a very verbose comment, and probably shouldn't be used with normal code. But for here, it is fine, and wanted. If you don't mind doing the comments over and putting why it is doing what it is doing, that would be great Smile (Also, say what djnz is actually doing, not just "looping").
  
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 3 of 5
» 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