A89: strings


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

A89: strings



All right, I fixed my problem earlier.  Unfortunately, I ran into some more.  My counter needed to be a word, since if it was a byte it could only count to 256, so I tried changing every add scounter.b to an add scounter.w.  If scounter represented less than a byte, shouldn't that equal to the same thing?  When I tried running my program, it gave me a string that was 5k rather than the 24 bytes it was originally.  Here is the code that I wanted to change:
 
 
 move.b tvar,d0            ;tvar is just how much to increment the scounter (like 8 or 9)
 clr.w d1
 add.b scounter,d1       ;if i changed add.b to add.w, shouldn't it be the same?
 lea.l string(pc),a1
 jsr filelib::writefile
 move.b tvar,d4
 add.b d4,scounter
 
 move.w #1,d0
 clr.w d1
 add.b scounter,d1    ;same with this one
 lea.l zero(pc),a1
 jsr filelib::writefile
 add.b #%00000001,scounter
 
 bsr Write_Schar
 rts
 
Write_Schar:   ;Writes $2D to the end of the file so that it is a string
 move.w #2,d0
 clr.w d1
 add.b scounter,d1    ;and this one
 lea.l schar(pc),a1
 jsr filelib::writefile
 rts
 
Any help would be greatly appreciated.  Thanks.