[TI ASM] Edit buffer questions

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
User avatar
silver calc
New Member
Posts: 73
Joined: Tue 28 Mar, 2006 10:50 pm
Location: Wouldn't you like to know?

[TI ASM] Edit buffer questions

Post by silver calc »

I'm trying to create an edit buffer. However, I can't get it to display 2nd/alpha correctly. I'm using bcall(_GetCSC), so don't tell me to use GetKey instead.

Code: Select all

;sk2nd detected
set2nd
 bit Shift2nd,(IY+ShiftFlags)
 jr z,res2nd
 set Shift2nd,(IY+ShiftFlags)
 ret
; 
res2nd
 res Shift2nd,(IY+ShiftFlags)
 ret
; 
;skalpha detected
;setalpha
 bit ShiftAlpha,(IY+ShiftFlags)
 jr z,resalpha
 bit ShiftAlock,(IY+ShiftFlags)
 jr z,resalpha
 bit Shift2nd,(IY+ShiftFlags)
 jr z,setalphalock
; 
;resalpha
 res ShiftAlpha,(IY+ShiftFlags)
 res ShiftALock,(IY+ShiftFlags)
 ret
;
;setalphalock
 res Shift2nd,(IY+ShiftFlags)
 set ShiftAlock,(IY+ShiftFlags)
 ret
Please "encourage" me to work more on Image any way you deem necessary
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

You're not setting the Alpha flag anywhere, are however checking the same bit twice and jumping to the same label. So I guess you made a mistake there, which could be part of your answer. The other part could be that displaying the 2nd and Alpha icons requires some code to draw them. If I'm not mistaken that gets done by the default interrupt routine, so make sure you're not disabling that. Also make sure you're not refreshing the screen in your getcsc loop or whereever, as that would of course erase the icons.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
silver calc
New Member
Posts: 73
Joined: Tue 28 Mar, 2006 10:50 pm
Location: Wouldn't you like to know?

Post by silver calc »

Yes, I have the cursor able flag turned on. I am also not updating the display (other than the default interrupts). The code isn't that it doesn't change the cursor, but that It resets the calc (actually, I am using PindurTI, so it resets that).
Here's updated code to fix the set alpha problem (which still doesn't work):

Code: Select all

;sk2nd detected 
set2nd 
 bit Shift2nd,(IY+ShiftFlags) 
 jr z,res2nd 
 set Shift2nd,(IY+ShiftFlags) 
 ret 
; 
res2nd 
 res Shift2nd,(IY+ShiftFlags) 
 ret 
; 
;skalpha detected 
setalpha 
 bit ShiftAlpha,(IY+ShiftFlags) 
 jr z,resalpha 
 bit ShiftAlock,(IY+ShiftFlags) 
 jr z,resalpha 
 bit Shift2nd,(IY+ShiftFlags) 
 jr z,setalphalock 
 set ShiftAlpha,(IY+ShiftFlags)
 ret
; 
resalpha 
 res ShiftAlpha,(IY+ShiftFlags) 
 res ShiftALock,(IY+ShiftFlags) 
 ret 
; 
setalphalock 
 res Shift2nd,(IY+ShiftFlags) 
 set ShiftAlock,(IY+ShiftFlags) 
 ret 
It doesn't restart now (bad calling), but still fails to display set the correct flags and/or display the correct cursor.
Please "encourage" me to work more on Image any way you deem necessary
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Well, this looks ok now. At least I'm quite sure this doesn't crash your calculator. How do you display the cursor?
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

messing around with shift-flags should never crash your calc anyway..
User avatar
silver calc
New Member
Posts: 73
Joined: Tue 28 Mar, 2006 10:50 pm
Location: Wouldn't you like to know?

Post by silver calc »

Here's what's wrong:
bit returns the opposite of what the nth bit of the byte.
It seems that my routing had it backwards, so it was always reseting.

Here's another question I have:

I'm making a clear buffer routine for my edit buffer. Here's what I have:

Code: Select all

Clearbuf:
 set appTextSave, (IY + appFlags)		;buffer is stored in the textshadow, makes it easier to empty
 bcall(_ClrScrnFull)
 res appTextSave, (IY + appFlags)
 
 ld hl,0				;reset cursor
 ld (curRow),hl

 ld hl,Inputbuf			;buffer location
 ld b,0				;buffer counter
 
 res Shift2nd,(IY+ShiftFlags)	;reset shift flags
 call resalpha

 ret
It works perfectly the 1st time, but when I type some more and press [clear] again, instead of reseting the cursor to (0,0) as it should, it sets it to (0,1), not even clearing (0,0)! What is wrong, and how do I fix this?
Please "encourage" me to work more on Image any way you deem necessary
Post Reply