Contrast tool from JeePee

Ok today I will explain a tiny code about deleting program on a ti83 regular (ti83+ and ti84+ version should be very close to this code anyway).

The code was written by David Eriksson and you can get it here Here's a sample of what you could have :



Ok let's start with headers :



#define equ .equ ; these will make ti83asm.inc and tokens.inc work in TASM #define EQU .equ .NOLIST .INCLUDE "ti83asm.inc" ; TI83 System Routine Equates .INCLUDE "tokens.inc" ; TI83 Tokens .LIST .ORG 9327h ; All TI83 programs have base 9327h


You should understand here that define keyword only create aliases.
There's usual includes, and the origin (9327h is ti83 regular !).
Ok we continue :



CALL _ZEROOOP1 ; clear OP1 LD A, 05h ; object type is program LD (OP1), A LD DE, OP1+1 ; destination LD HL, program_name ; source LD BC, 8 ; length of program name LDIR ; copy! CALL _CHKFINDSYM ; search for symbol in OP1 JP C, error ; carry flag set if not found


Ok so David set OP1 to 0, put 05h into a because we are looking for programs (there's different kind of vars on the calc).
Then he put the name into the next 8 bytes.
The command LDIR simply copy (hl) into (de) then increment hl, increment de, decrement bc...
If bc is not equal to 0, ldir restart and copy (hl) into (de) etc...
So you can easily copy a piece of memory into another place with ldir.
As program name is 8 char (8 bytes) so David put 8 in bc to copy 8 bytes :)

The the call _CHKFINDSYM simply get the adress of the program and update flags register (register f).
If the program was not found, jump to error...


CALL _DELVAR ; delete program! LD HL, ok_msg JP show_msg error: LD HL, err_msg show_msg: CALL _PUTS CALL _NEWLINE RET


Finally call delvar (to delete the program) and print a message of success.
Call _newline simply does a carriage return.


program_name: .DB "DELETEME" err_msg: .DB "Unknown program" .DB 0 ok_msg: .DB "Program deleted",0 .END


To conclude, you have the data (the strings terminated by 0 for puts).

As you can see, deleting a program is very very easy !
I hope you learned something and see you soon for another review (probably a bit harder :p).