Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Hi so I'm working on an assembly program that detects if you have a Ti-OS version that supports MathPrint, and then detects whether it's turn on. If it's on it then: turns it off, displays some text with macros that wouldn't work with mathprint, and then turns MathPrint on again. Else it just displays the text. Problem is, the BIT instruction to check if MathPrint is on, doesn't work. Here's the source code.
This is one of my first z80 programs so don't judge:

Code:

.nolist
#include "ti83plus.inc"
#define b_call(label) rst $28 \.dw label
.list
.org $9D93 ;normally, the origin would be at $9D95, but we are storing two bytes under this so we take two from $9D95.
.db t2ByteTok, tAsmCmp ;".db" means do byte. Same as ".byte". Comma is because of endianness.  see what these actually are in ti83+.inc

    b_call(_ClrScrnFull) ;clears the screen, haven't had luck with _ClrLCDFull for some reason
   
   ;this part of the code determines if you have version 2.50 or later.
   b_call(_GetBaseVer) ;stores the Ti OS version in a and b. if you have 2.55, 2 is stored in a, 55 is stored in c.
   cp 2 ;compares a to 2. if a >= 2 then the c flag is reset, if a < 2 it's set.
   jr c,nomath ;if c is set, then jump to nomath, eg. mathprint is not supported.
   LD     HL, $0403    ;for debugging
    LD     (CurRow), HL ;
    LD     A, 'I'       ;
   B_CALL(_PutC)       ;
   ld a, b
   cp 50 ;compares a(b) to 50, which is where mathprint was introduced.
   jr c,nomath
    LD     A, 'I' ;for debugging
   b_call(_PutC) ;

   ;this part determines whether or not mathprint is enabled
   bit 5,(iy+$44) ;if bit 5 in flag 44h is reset, mathprint is off and z flag is set. PROBABLY AN ISSUE HERE
   jr nz, math ;if z flag is not set, then mathprint is on and we should go to math, else it'll just continue down.

;this part displays the text
nomath:
   b_call(_HomeUp); this would make _NewLine not work, if MathPrint was on
   ld hl, text ;standard way of loading a string into hl.
   b_call(_PutS) ;Puts the String stored in hl onto the screen at the cursor location.
   b_call(_NewLine)
   ret ;this won't quit the program, since it is a part of the call instruction.

;this part turns off mathprint, calls nomath, and then enables it again
math:
   res 5,(iy+$44) ;resets bit 5 in $89F0, which is also iy+$44, this disables MathPrint.
   LD     A, 'I' ;for debugging, this doesn't display so THIS IS WHERE THE PROBLEM IS.
   b_call(_PutC) ;
   call nomath ;goes to nomath, returns at next "ret".
   set 5,(iy+$44) ;sets bit 5 in iy+$44, which enables MathPrint.
   ret

text:
   .db "Hello world!", 0

.end

The problem lies on line 25, with the bit instruction:

Code:
 bit 5,(iy+$44)

Please note that i got the information about $44 from here:
http://wikiti.brandonw.net/index.php?title=83Plus:Flags:44

I just don't get what's wrong since i used the exact same syntax in this program, that works a charm.

Code:
 .nolist
#include "ti83plus.inc"
#define b_call(label) rst $28 \.dw label
.list
.org $9D93
.db t2ByteTok, tAsmCmp

    b_call(_ClrScrnFull)
    ld hl, 0
    ld (CurRow), hl
   bit 5,(iy+$44)
   jr z, off
    ld hl, on
    b_call(_PutS)
    b_call(_NewLine)
    ret
off:
   ld hl, zero
   b_call(_PutS)
   b_call(_NewLine)
   ret
on:
   .db "mathprint is on", 0
zero:
   .db "mathprint is off", 0
.end

try it for yourself, it works fine.

If you know what i did wrong or what i can do to fix it, please help.
Thanks in advance.

EDIT: everything's fine now, don't even bother.
What are you trying to run it on (OS version, calculator)? The documentation may not apply equally to all versions. The code looks fine to me.
Tari wrote:
What are you trying to run it on (OS version, calculator)? The documentation may not apply equally to all versions. The code looks fine to me.

Thanks for the reply. I have other problems with this code now, but it seems No one knows what the solution is. If it's possible i'll delete this post or archive it or whatever.
Are you sure the code is actually taking the branches you expect it to take? It might be a better idea to print different characters at different places with the debug code rather than just counting I's, as it would let you know if you have code running at times you don't expect, which could then provide a vital clue.
Travis wrote:
Are you sure the code is actually taking the branches you expect it to take? It might be a better idea to print different characters at different places with the debug code rather than just counting I's, as it would let you know if you have code running at times you don't expect, which could then provide a vital clue.

It does, thing is, what i want the code to do is in theory impossible. Now, the problem is with the set instruction, since it turns one mathprint before exiting the program, resulting in the done message being displayed on the same line as "Hello World" and newline not working at all. I can only fix that by not enabling mathprint. maybe i should actually say what i wanted the program to do:

Check what Ti OS version you're on, if the version has mathprint support, then check if it's enabled. If it is, then check if it's on and disable it. Then display some text with b_calls that wouldn't work in mathprint (_HomeUp disables _Newline), and then turn it on again as to not annoy the user with having to disable it before running the program and/or enable it when it ends.
No one knows what the solution is because you haven't described what you expect to happen! You've stated absolutely no where what you want to see vs. what your program does. I was *repeatedly* asking you this on IRC and you kept avoiding giving an answer.

If you want help, describe the intended operation vs what actually happens. Then people might be inclined to actually help you.
MateoConLechuga wrote:
No one knows what the solution is because you haven't described what you expect to happen! You've stated absolutely no where what you want to see vs. what your program does. I *repeatedly* asking you this on IRC and you kept avoiding giving an answer.

If you want help, describe the intended operation vs what actually happens. Then people might be inclined to actually help you.

i did in my last post in this forum post, the one before yours. but i found my solution to the problem, is there a way to archive the post or delete it?
You did not explain it at all! Read your post again.
sledgehogg wrote:

Check what Ti OS version you're on, if the version has mathprint support, then check if it's enabled. If it is, then check if it's on and disable it. Then display some text with b_calls that wouldn't work in mathprint (_HomeUp disables _Newline), and then turn it on again as to not annoy the user with having to disable it before running the program and/or enable it when it ends.

here
i wan't to see it display hello world or whatever, and then display the done message on the line under that. It didn't do that because of mathprint. I thought the bit instruction didn't work, but it did, it was the jr that should be a jp. the reason i didn't know that is because it says here under z80 hopscotch that "You don't have to worry about the range limitation, because when you assemble, TASM will give you a "Range of relative branch exceeded" error for each JR instruction that's overreaching itself." in the learn z80 in 28 days tutorial http://media.taricorp.net/83pa28d/lesson/day07.html

so the problem was something with mathprint being enabled again (since i wanted that to happen so to not make users have to turn it on again) before the done message displays, which makes the _NewLine not work when you use _HomeUp.
i'll just step down and use

Code:

ld hl, 0
ld (CurRow), hl

instead of

Code:

b_call(_HomeUp)

Crying
  
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 GMT - 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