I finally finished the program where it starts at zero and counts up to 100!

Code:
#include "ti83plus.inc"
.org $9D95
.db $BB,$6D

Start:
    LD A, 0
    bcall _ClrScrnFull
Loop:
    LD H, 0
    LD L, A
    PUSH AF
    bcall _DispHL
    bcall _NewLine
    POP AF
    INC A
    CP 101
    JR Z, End
    JR Loop
End:
    ret
As you just pointed out on IRC, this really shouldn't have worked. The following would be correct:


Code:
#include "ti83plus.inc"
.org $9D93
    .db $BB,$6D

Start:
    LD A, 0                  ;this should be xor a to save a byte
    bcall _ClrScrnFull
Loop:
    LD H, 0
    LD L, A
    PUSH AF
    bcall _DispHL
    bcall _NewLine
    POP AF
    INC A
    CP 101
    JR nZ, Loop    ;by changing the logic here, I saved two bytes
;    JR Loop
End:
    ret


Edit: Since you used only jr (jump relative), with no jumps (jp) nor calls (call), then it actually would have worked even with $9d95 instead of $9d93. Smile
Also are you sure that _ClrScrnFull preserves the A register? It doesn't say so in the sdk although they usually don't document that kind of stuff well anyway. But just to be safe, I would switch the order so its this:


Code:
bcall _ClrScrnFull
ld a,0


and even better, would be to this:


Code:
bcall _ClrScrnFull
xor a


Since that's the optimized way to load 0 in a in only one byte.
Ah yes, I'm pretty sure it does nothing of the sort and simply rampages through all the registers. Good catch, Quigibo.
  
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