0 Members and 2 Guests are viewing this topic.
Get String from OSGet X,Y coordinatesGet # of rows and colsStore them to Coor;Calc 2+maxX+4. Character is 4 pixels wide.ld a,(tCol)ld b,3__:add a,adjnz __add a,6ld (mX),a;now 2+maxY+6. Character is 6 pixels long.ld a,(tRow)ld b,5___:add a,adjnz ___add a,8ld (mY),acall DrawRect;string starts at X+2,Y+2call ResetLinePut string length in bcld ix,String;until it reads through all the textLoop:push bc ;save lengthld a,(mX)cp (penCol)call z,NextLineld a,(mY)cp (penRow)call z,ResetLineld a,(ix) ;now start checking characterscp 'o' ;the degree sign - force cursor to next linejr nz,Jump1call NextLineJump1:cp 'e^';e^ will make it wait for a keypressjr nz,Jump2call WaitForKeyJump2:ld (HChara),ald hl,HCharabcall(_VPutS)inc ixcall Delay ;force delay between textspop bcdec bcjr c, Loop ;if c is set, that means the loop went through all the text I think?retDrawRect:;Draw Rectangle at (X,Y,X+2+4*col,Y+2+6*row)ld d,apush de;Something that clears inside the rectld l,(cX)ld h,(cY)ld a,(tCol)sub 4ld e,ald a,(tRow)sub 6ld d,abcall(_DrawRectBorder)pop deld a,dretNextLine:ld d,ald a,(cX)add a,2ld (penCol),ald a,(penRow)add a,6ld (penRow),ald a,dretResetLine:jr DrawRectld d,ald a,(cX)inc ainc ald (penCol),ald a,(cY)inc ainc ald (penRow),ald a,dretPause:ld b,(Delay)_:nopdjnz _retWaitForKey:ld d,abcall(_getKey)ld a,dretDelay:.db 40cX:.db xcY:.db ytCol:.db coltRow:.db rowmX:.db 2+maxX+4mY:.db 2+maxY+6HChara:.db 0
#include "ti83plus.inc".org $9D93.db t2ByteTok,tAsmCmp bcall(_ClrLCDFull) ld hl,StringData rst 20h;rMov9ToOP1 rst 10h;rFindSym ret c;quit if string is not found ex de,hl ld c,(hl);grab string size inc hl ld b,(hl) inc hlloop: ld a,(hl) bcall(_IsA2ByteTok);Check if first token is 2 bytes z=two bytes jr z, _ ld d,0 ld e,(hl) jr ___: ld d,(hl) inc hl dec bc;decrease bc since token was 2-bytes ld e,(hl)__: push hl;need these for cpi push bc; bcall(_PutTokString) pop bc pop hl cpi jp pe,loop; pe is used to test if BC reached 0. bcall(_getKey) retStringData: .db StrngObj,tVarStrng,tStr1,0
_Get_Tok_Str bcall
#include "ti83plus.inc".org $9D93.db t2ByteTok,tAsmCmp bcall(_ClrLCDFull) ld hl,StringData rst 20h;rMov9ToOP1 rst 10h;rFindSym ret c;quit if string is not found ex de,hl ld c,(hl);grab string size inc hl ld b,(hl) inc hlloop: ld a,(hl) bcall(_IsA2ByteTok);Check if first token is 2 bytes z=two bytes jr z, _ ld d,h ld e,l jr ___: ld d,h ld e,l inc hl;increase hl for next calc since token was 2-bytes dec bc;decrease bc since token was 2-bytes__: push hl;need these for cpi push bc; push de; ex de,hl bcall(_Get_Tok_Strng) ld hl,op3 ld a,(hl) bcall(_VPutMap) pop de pop bc pop hl cpi jp pe,loop; pe is used to test if BC reached 0. bcall(_getKey) retStringData: .db StrngObj,tVarStrng,tStr1,0
puttokloop: ld a,(hl) inc hl bcall(_VPutMap) dec c jr nz,puttokloop
#include "ti83plus.inc".org $9D93.db t2ByteTok,tAsmCmp bcall(_RclAns) dec a ret nz ;quit if answer is non-list inc de inc de ;oh look size is 2 bytes silly TI ex de,hl ld ix,cX ;apparently I do need ix here because my HL DE BCs are used a lot ld b,4 ;list should have 4 numbersloop4times: push bc rst 20h push hl bcall(_ConvOP1) pop hl ld (ix),a inc ix pop bc djnz loop4times bcall(_ClrLCDFull) ld hl,0 ld (penCol),hl ld hl,StringData rst 20h;rMov9ToOP1 rst 10h;rFindSym ret c;quit if string is not found ex de,hl ld c,(hl);grab string size inc hl ld b,(hl) inc hlloop: ld a,(hl) bcall(_IsA2ByteTok);Check if first token is 2 bytes z=two bytes jr z, _ ld d,h ld e,l jr ___: ld d,h ld e,l inc hl;increase hl for next calc since token was 2-bytes dec bc;decrease bc since token was 2-bytes__: push hl;need these for cpi push bc; push de; ex de,hl bcall(_Get_Tok_Strng) ld hl,op3tokenloop: ld a,(hl) inc hl bcall(_VPutMap) dec c jr nz,tokenloop ld a,1 ld (curRow),a ld (curCol),a ld b,4 ld hl,cXdisplaynum: push hl ld a,(hl) ld h,0 ld l,a bcall(_DispHL) pop hl inc hl ld a,(curRow) ;because DispHL is not pretty inc a ld (curRow),a ld a,0 ld (curCol),a djnz displaynum pop de pop bc pop hl cpi jp pe,loop; pe is used to test if BC reached 0. bcall(_getKey) retStringData: .db StrngObj,tVarStrng,tStr1,0cX: .db 0cY: .db 0width: .db 0height: .db 0
#include "ti83plus.inc".org $9D93.db t2ByteTok,tAsmCmp bcall(_RclAns) dec a ret nz ;quit if answer is non-list inc de inc de ;oh look size is 2 bytes silly TI ex de,hl ld ix,cX ;apparently I do need ix here because my HL DE BCs are used a lot ld b,4 ;list should have 4 numbersloop4times: push bc rst 20h push hl bcall(_ConvOP1) pop hl ld (ix),a inc ix pop bc djnz loop4times bcall(_ClrLCDFull) call Resetrect ld hl,StringData rst 20h;rMov9ToOP1 rst 10h;rFindSym ret c;quit if string is not found ex de,hl ld c,(hl);grab string size inc hl ld b,(hl) inc hlloop: ld a,(hl) bcall(_IsA2ByteTok);Check if first token is 2 bytes z=two bytes jr z, _ ld d,h ld e,l jr ___: ld d,h ld e,l inc hl;increase hl for next calc since token was 2-bytes dec bc;decrease bc since token was 2-bytes__: push hl;need these for cpi push bc; ex de,hl bcall(_Get_Tok_Strng) ld hl,op3tokenloop: call CheckXPos inc hl ld a,(hl) inc hl bcall(_VPutMap) dec c jr nz,tokenloop pop bc pop hl cpi jp pe,loop; pe is used to test if BC reached 0. bcall(_getKey) retCheckXPos: push de push bc ; I should have hl as pointer for string still dec hl ld (hl),1 ; Put size byte. This string should always be 1 byte long. bcall(_SStringLength) ;This destroys all but HL ld d,a ld a,(penCol) add a,d ; Grab the future penCol position push af ld a,(mX) ld d,a pop af inc d cp d ; call Resetcur if pencol > mX call nc,Resetcur pop bc pop de retResetcur: ld a,(cX) inc a ;if pencol > mX, change the cursor position inc a ;to next line before writing ld (penCol),a ld a,(penRow) add a,6 ld (penRow),a retResetrect: push hl;Long push list yeah but I'll remove some push de;when I see that I don't need to save them push bc;later on when I code more push af; ld a,(cX) ld l,a ;start setting rect boundary ld a,(cY) ld h,a ld a,(cX) inc a inc a ld (penCol),a ;set cursor column dec a dec a ld d,a ld a,(width) ld b,a ld a,d add a,b dec a ld e,a dec a dec a ld (mX),a ;set max c-length for x ld a,(cY) inc a ld (penRow),a ;set cursor row dec a ld d,a ld a,(height) ld b,a ld a,d add a,b dec a ld d,a dec a dec a ld (mY),a ;set max c-length for y bcall(_DrawRectBorderClear) pop af pop bc pop de pop hl retStringData: .db StrngObj,tVarStrng,tStr1,0cX: .db 0cY: .db 0width: .db 0height: .db 0mX: .db 0mY: .db 0
ld c,(hl);grab string size inc hl ld b,(hl) inc hlloop: ld a,(hl) ;Need to check if it is a two-byte token, later push af ;Save A for later push hl push bc bcall(_Get_Tok_Strng) ld hl,op3-1 ;point to the byte *before* the output characters.tokenloop: push hl ;save HL push bc ;and BC call CheckXPos pop bc pop hl inc hl ;Need to increment first to get to the character since we started one byte behind ld a,(hl) bcall(_VPutMap) dec c jr nz,tokenloop pop bc pop hl pop af bcall(_IsA2ByteTok) ;Check if it was a 2 byte token jr nz,+_ inc hl ;increment hl for next calc since token was 2 bytes dec bc ;decrement bc since token was 2 bytes_: cpi jp pe,loop ; pe is used to test if BC reached 0. bcall(_getKey) retCheckXPos: ld (hl),1 ;Just want a 1-byte string. HL points to an already drawn char, so no need to save it bcall(_SStringLength) ;Returns length in A and B ld a,(penCol) add a,b ; Grab the future penCol position ld b,a dec b dec b ld a,(mX) cp b ; call Resetcur if pencol > mX ret ncResetcur: ld a,(cX) inc a ;if pencol > mX, change the cursor position inc a ;to next line before writing ld (penCol),a ld a,(penRow) add a,6 ld (penRow),a ret
#include "ti83plus.inc".org $9D93.db t2ByteTok,tAsmCmp bcall(_RclAns) dec a ret nz ;quit if answer is non-list inc de inc de ;oh look size is 2 bytes silly TI ex de,hl ld ix,cX ;apparently I do need ix here because my HL DE BCs are used a lot ld b,4 ;list should have 4 numbersloop4times: push bc rst 20h push hl bcall(_ConvOP1) pop hl ld (ix),a inc ix pop bc djnz loop4times bcall(_ClrLCDFull) call Resetrect ld hl,StringData rst 20h;rMov9ToOP1 rst 10h;rFindSym ret c;quit if string is not found ex de,hl ld c,(hl);grab string size inc hl ld b,(hl) inc hlloop: ld a,(hl) ;Need to check if it is a two-byte token, later push af ;Save A for later push hl push bc bcall(_Get_Tok_Strng) ld hl,op3-1 ;point to the byte *before* the output characters. push hl inc hl ld a,(hl) cp 14h ;check if string is degree sign. deg = newline pop hl jr nz,notdegree ;skip if not degree sign call Resetcur pop bc pop hl pop af jr +_notdegree: push hl inc hl ld a,(hl) cp 15h ;check if string is radian sign. rad = resetrect pop hl jr nz,tokenloop ;skip if not radian sign bcall(_getKey) call Resetrect pop bc pop hl pop af jr +_tokenloop: push hl ;save HL push bc ;and BC call CheckXPos pop bc pop hl inc hl ;Need to increment first to get to the character since we started one byte behind ld a,(hl) bcall(_VPutMap) dec c jr nz,tokenloop pop bc pop hl pop af bcall(_IsA2ByteTok) ;Check if it was a 2 byte token jr nz,+_ inc hl ;increment hl for next calc since token was 2 bytes dec bc ;decrement bc since token was 2 bytes_: cpi jp pe,loop ; pe is used to test if BC reached 0. bcall(_getKey) retCheckXPos: ld (hl),1 ; Put size byte. This string should always be 1 byte long. bcall(_SStringLength) ;This destroys all but HL ld a,(penCol) add a,b ; Grab the future penCol position ld b,a dec b dec b ld a,(mX) cp b ret ncResetcur: ld a,(cX) inc a ;if pencol > mX, change the cursor position inc a ;to next line before writing ld (penCol),a ld a,(penRow) add a,6 ld (penRow),a ld b,a ;check the YPos ld a,(mY) sub 6 cp b ; test if penRow > mY ret nc ; skip if penRow <= mY bcall(_getKey) call Resetrect retResetrect: push hl;Long push list yeah but I'll remove some push de;when I see that I don't need to save them push bc;later on when I code more push af; ld a,(cX) ld l,a ;start setting rect boundary ld a,(cY) ld h,a ld a,(cX) inc a inc a ld (penCol),a ;set cursor column dec a dec a ld d,a ld a,(width) ld b,a ld a,d add a,b dec a ld e,a dec a dec a ld (mX),a ;set max c-length for x ld a,(cY) inc a ld (penRow),a ;set cursor row dec a ld d,a ld a,(height) ld b,a ld a,d add a,b dec a ld d,a dec a dec a ld (mY),a ;set max c-length for y bcall(_DrawRectBorderClear) pop af pop bc pop de pop hl retStringData: .db StrngObj,tVarStrng,tStr1,0cX: .db 0cY: .db 0width: .db 0height: .db 0mX: .db 0mY: .db 0
#include "ti83plus.inc".org $9D93.db t2ByteTok,tAsmCmp ld (8000h),sp ; This stores the stack pointer to spsave... for later dark ritual. bcall(_RclAns) dec a ret nz ;quit if answer is non-list ex de,hl ld b,(hl) inc hl cp (hl) ret nz inc hl ; grabbed list size in b ld a,b ;our list needs to be either 4 or 6 elements cp 4 jr z,Pass cp 6 ret nzPass: ld ix,cX ;apparently I do need ix here because my HL DE BCs are used a lotloopbtimes: push bc rst 20h ;rMov9ToOP1 push hl bcall(_ConvOP1) pop hl ld (ix),a inc ix pop bc djnz loopbtimes ;bcall(_ClrLCDFull) call Resetrect ld hl,StringData rst 20h rst 10h ;rFindSym ret c ;quit if string is not found ex de,hl ld c,(hl) ;grab string size inc hl ld b,(hl) inc hlloop: ld a,(hl) ;Need to check if it is a two-byte token, later push af ;Save A for later push hl push bc bcall(_Get_Tok_Strng) ld hl,op3-1 ;point to the byte *before* the output characters. push hl inc hl ld a,(hl) cp 1bh ;check if string is Exponent E. E = original 8 delay pop hl jr nz,notDelay1 ;skip if not ld a,8 ld (Delay),a pop bc pop hl pop af jr +_NotDelay1: push hl inc hl ld a,(hl) cp 11h ;check if string is -1. -1 = 16 Delay pop hl jr nz,notDelay2 ;skip if not ld a,16 ld (Delay),a pop bc pop hl pop af jr +_NotDelay2: push hl inc hl ld a,(hl) cp 12h ;check if string is ^2. ^2 = slowest 32 pop hl jr nz,notDelay3 ;skip if not ld a,32 ld (Delay),a pop bc pop hl pop af jr +_NotDelay3: push hl inc hl ld a,(hl) cp 14h ;check if string is degree sign. deg = newline pop hl jr nz,notdegree ;skip if not degree sign call Resetcur pop bc pop hl pop af jr +_notdegree: push hl inc hl ld a,(hl) cp 15h ;check if string is radian sign. rad = resetrect pop hl jr nz,tokenloop ;skip if not radian sign call NextPageKey call Resetrect pop bc pop hl pop af jr +_tokenloop: push hl ;save HL push bc ;and BC call CheckXPos pop bc pop hl inc hl ;Need to increment first to get to the character since we started one byte behind ld a,(hl) bcall(_VPutMap) push bc ei ld a,(Delay) ld b,a ld a,(843Fh) ld c,a ld a,(SkipKey) cp c jr nz,PauseTime srl bPauseTime: call Waith djnz PauseTime pop bc dec c jr nz,tokenloop pop bc pop hl pop af bcall(_IsA2ByteTok) ;Check if it was a 2 byte token jr nz,+_ inc hl ;increment hl for next calc since token was 2 bytes dec bc ;decrement bc since token was 2 bytes_: cpi jp pe,loop ; pe is used to test if BC reached 0. call NextPageKey retWaith: ei halt bit onInterrupt,(iy+onFlags) ret zHardExit: ld sp,(8000h) retNextPageKey: ld a,(NPKey) ld c,aSub1: call Waith ld a,(843Fh) cp c jr nz,Sub1 retCheckXPos: ld (hl),1 ; Put size byte. This string should always be 1 byte long. bcall(_SStringLength) ;This destroys all but HL ld a,(penCol) add a,b ; Grab the future penCol position ld b,a dec b dec b ld a,(mX) cp b ret ncResetcur: ld a,(cX) inc a ;if pencol > mX, change the cursor position inc a ;to next line before writing ld (penCol),a ld a,(penRow) add a,6 ld (penRow),a ld b,a ;check the YPos ld a,(mY) sub 6 cp b ; test if penRow > mY ret nc ; skip if penRow <= mY call NextPageKey call Resetrect retResetrect: push hl;Long push list yeah but I'll remove some push de;when I see that I don't need to save them push bc;later on when I code more push af; ld a,(cX) ld l,a ;start setting rect boundary ld a,(cY) ld h,a ld a,(cX) inc a inc a ld (penCol),a ;set cursor column dec a dec a ld d,a ld a,(width) ld b,a ld a,d add a,b dec a ld e,a dec a dec a ld (mX),a ;set max c-length for x ld a,(cY) inc a ld (penRow),a ;set cursor row dec a ld d,a ld a,(height) ld b,a ld a,d add a,b dec a ld d,a dec a dec a ld (mY),a ;set max c-length for y bcall(_DrawRectBorderClear) ; y u destroi all me registers pop af pop bc pop de pop hl retStringData: .db StrngObj,tVarStrng,tStr1,0cX: .db 0cY: .db 0width: .db 0height: .db 0mX: .db 0mY: .db 0NPKey: .db 36hSkipKey: .db 30hDelay: .db 8