[A86] Re: TI-86 menu routine


[Prev][Next][Index][Thread]

[A86] Re: TI-86 menu routine



Thanks a lot!!  This really helps!  When I finish the routine I will 
probably publish it to this mailing list, so that you can find the bugs 
I didnt find. :)

Thanks agian
Michael
Ricky Cobb wrote:

>>ld b,0xh
>>                          ; here i need to check if a < b
>>
>
> cp b ; update flags
> jr c,CutNow ;if a<b goto CutNow, (or jP if the lable is farther away)
> sub b
>
>>                          ; if a < b, then jp CutNow
>>                          ; if a is not less than b, then sub b
>>jp Loop
>>
>
>
>A carry occurs when one number subtracted from the other number has been 
>'flipped' around (in other words 2-3 = -1 but one byte can only represent 0-255 
>so the carry flag tells when the number subtracted from the other is greater 
>than or less than the other.
>
>NC (no carry) is the same as >= (greater than or equal to). It happens when 
>either the number your comparing is of equal value (resulting subtraction = 0) 
>or it is greater than the number.
>
>If you want to compare just > (greater than but not equal to) then increase the 
>number youre comparing a to by 1.
>
>ex.
>;a=6
> cp 5
> jr nc,aisgreaterthan5
> 
>;a=5
> cp 5
> jr nc,aisgreaterthanorequalto5
>
>;a=4
> cp 5
> jr c,aislessthan5
>
>;a=4
> cp 4
> jr c,aislessthanorequalto4
> jr z,aislessthanorequalto4
>
>
>
>The cp command does not change the register values but it does perform the same 
>operation as the sub command. Basically, it subtracts the number from the other 
>(a-number_comparing_to or hl-number_comparing_to) then it updates the flags. 
>The register contents at this point are not changed. The sub command will do 
>the same thing but the contents of the registers are changed. So if you plan on 
>doing a 'sub b' after up there and if you are planning on doing a sub b at 
>CutNow then you could optimize the above by using sub b instead of cp b because 
>the flags are still updated and you wouldnt need the extra sub b's.
>
>I also wrote a piece about comparing signed numbers (negative 8bit numbers)
>on this mailing list. So if you want to search for that to understand the p and 
>m flags for negative comparisons go right ahead :)
>
>
>Hope this helps,
>
>Ricky Cobb
>http://tip.ti-programmers.com/
>arcadesdude@intercom.net
>[IM]
>icq 41440378
>msn arcadesdude
>y!  arcadesdude
>aim arcadesdude
>
>8/24/02 8:31:51 AM, Michael Williams <spacex@williams-net.org> wrote:
>
>>Hey all!
>>
>>   I havent said anything so far, but I have learned alot from you 
>>guys. Thanks!
>>Anyways, I have a problem, Im trying to make a TI-86 assembly menu routine
>>that does the same thing as the Menu( basic command.  I've run into a 
>>little hiccup though.
>>I need to find out if register a is less than register b.  How do I do this?
>>Thanks a lot for your help.
>>
>>Michael Williams
>>
>>PS. This is what it looks like now
>>
>>CutString:
>>ld de,hl-01h        ;hl -> string to be cut
>>ld a,17h              ; 17h is the number of pixels we have
>>Loop:
>>inc de
>>ld b,(de)
>>cp b,                  ; All the characters that would cause the string 
>>to terminate
>>jp z, CutNow
>>cp b,                  ; All the characters that are six pixels wide
>>jp z, Minus6
>>
>>....
>>....
>>
>>CutNow:
>>ld (de), 00h
>>ret
>>
>>Minusx:               ; this is the same func for all the different 
>>pixelwidths, just cut and pasted
>>                          ; x is between 1 and 6
>>ld b,0xh
>>                          ; here i need to check if a < b
>>                          ; if a < b, then jp CutNow
>>                          ; if a is not less than b, then sub b
>>jp Loop
>>
>>
>>
>>
>>
>>
>
>
>






References: