I made a test asm program for converting numbers in mmeory to decimal and print them. by debugging the program actually works but _putC has a weird behaviour. So I created a smaller, basical program and it present similar problems:

it prints correctly 73820 but followed by 70194 that is "7382070194"

if I limit the loop to the 4 iterations it prints 738270194. So where does that appendix come from?
Am I using _putC in the wrong way or have I initialized memory in the wrong place?
thank you.


Code:

#define equ .equ
#define EQU .EQU
#include "../tasm32/ti86asm.inc"
.org _asm_exec_ram   ; the address of mem from where to start
   
   call _clrLCD
   
   ld A,3
   ld (_curRow),A
   ld A,1
   ld (_curCol),A
   
   
   ld BC,0
reading_loop:   
   ld IX, list_of_byte;
   add IX, BC
   
   ld A, (ix)
   add A, L0
   call _putC
   inc C
   ld A, C
   cp 5
   jp NZ, reading_loop
   

ret

list_of_byte:
   .db 7, 3, 8, 2, 0
;

.end
I finally solved.
the Ti system calls are destructive of more registers than declared. So better saving the content of the used registers before calling _putC:


Code:


#define equ .equ
#define EQU .EQU
#include "../tasm32/ti86asm.inc"
.org _asm_exec_ram   ; the address of mem from where to start
   
   call _clrLCD
   
   ld A,3
   ld (_curRow),A
   ld A,1
   ld (_curCol),A
   
   
   ld BC,0
   ld IX, list_of_byte;
reading_loop:   
      
   
   
   push BC
   push IX
   
   ld A, (IX)
   add A, L0
   
   call _putC
   
   pop IX
   pop BC
   
   inc C
   inc IX
   ld A, C
   cp 5
   jp NZ, reading_loop
   
   call _getKey
ret

list_of_byte:
   .db 2, 5, 8, 3, 9
;

.end

  
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