[A83] How does _ckint works exactly?


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

[A83] How does _ckint works exactly?




How does _ckint works exactly, what is affected and which flags are set how?
According to 83rom.txt the Zero-flag is set if the number is integer and 
reset if the number is not integer. I wrote this:

========================================================================

.NOLIST
#define end .end
#define END .end
#define equ .equ
#define EQU .equ
#include "squish.inc"
#include "ti83asm.inc"
#include "tokens.inc"
.LIST
.org $9327
call _runindicoff       ; blablabla....
call _clrlcdfull        ;
ld de,$821C             ; ================
ld hl,prompt            ;
ld bc,16                ; Get users input
ldir                    ;
ld a,1                  ; and store in op1
ld (asm_ind_call),a     ;
call pgmio_exec         ; ================
call _clrlcdfull        ;
call _homeup            ;
ld hl,op1               ; (so _ckint knows which number to check)
call _trunc             ; round the input
call _op2set2           ;
call _fpdiv             ; divide op1 by 2
call _ckint             ; check if op1 is integer (then the original input 
is even)
jp z,even               ; jump to even when op1 is integer (83rom.txt: 
Zero-flag = 0 if not integer ; 1 if integer)
odd:                     ; =============
call _clrlcdfull        ;
call _homeup            ; when original
ld hl,numberodd         ; input is odd
call _puts              ;
jp endprog              ; =============

even:                    ; =============
call _clrlcdfull        ;
call _homeup            ; when original
ld hl,numbereven        ; input is even
call _puts              ;
jp endprog              ; =============

endprog:                 ; =============
call _newline           ; end program
call _clrtxtshd         ;
ret                     ; =============

prompt:
.db "Number:         ",0
numbereven:
.db "It is even",0
numberodd:
.db "It is odd",0

.end
end

========================================================================

But it never jumps to "even", whatever number I fill in.
Is it because of a wrong use of the Zero-flag? (with the condition "z" you 
check the zero-flag, huh?)

I hope someone can help me and that I provided enough info.

------------
Jelle Fresen
------------

_________________________________________________________________
Meld je aan bij de grootste e-mailservice wereldwijd met MSN Hotmail: 
http://www.hotmail.com/nl