A83: Protecting Programs


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

A83: Protecting Programs




i may be a little late on this (because i didn't answer my mail all
weekend) but there is already a program that does this. that program
doesn't have source included so i made my own.

here is the source for the programs that protect and unprotect programs.
to use them put the name of the program to (un)protect in Ans then run
PROTECT or UNPROTEC

EX:

"IAN"
[Enter]
pgrmPROTECT
[Enter]

zprotect.z80:

.NOLIST
#define equ .equ
#define EQU .equ
#define end .end
#include "ti83asm.inc"
#include "tokens.inc"
.LIST

strngobj .equ 04h
progobj .equ 05h
protprogobj .equ 06h
_errundefined .equ 467Bh
_errsyntax .equ 466Ch
_findsym .equ 442Eh

.org 9327h

     call _zerooop1       ; load var name "Ans"
     ld a,tAns            ;
     ld (op1+1),a         ;
     call _findsym        ; look up
     jp c,_errundefined   ; if it is not found error
     and 1fh              ; mask off bits 0-4
     cp strngobj          ; check if data is a string
     jp nz,_errsyntax     ; if not error
     ld hl,op1            ; object type program
     ld (hl),progobj      ; object type into op1
     inc hl               ; next byte
     ld a,(de)            ; get size of name
     ld c,a               ; size to bc
     ld b,0               ;
     inc de               ; skip 1st length byte of Ans
     inc de               ; skip 2nd length byte of Ans
     ex de,hl             ; exchange de and hl
     ldir                 ; copy name to op1
     call _chkfindsym     ; look up program
     jp c,_errundefined   ; if it is not found error
     ld (hl),protprogobj  ; make protected
     ret

.end
END


zunprote.z80

.NOLIST
#define equ .equ
#define EQU .equ
#define end .end
#include "ti83asm.inc"
#include "tokens.inc"
.LIST

strngobj .equ 04h
progobj .equ 05h
_errundefined .equ 467Bh
_errsyntax .equ 466Ch
_findsym .equ 442Eh

.org 9327h

     call _zerooop1      ; load var name "Ans"
     ld a,tAns           ;
     ld (op1+1),a        ;
     call _findsym       ; look up
     jp c,_errundefined  ; if it is not found error
     and 1fh             ; mask off bits 0-4
     cp strngobj         ; check if data is a string
     jp nz,_errsyntax    ; if not error
     ld hl,op1           ; object type program
     ld (hl),progobj     ; object type into op1
     inc hl              ; next byte
     ld a,(de)           ; get size of name
     ld c,a              ; size to bc
     ld b,0              ;
     inc de              ; skip 1st length byte of Ans
     inc de              ; skip 2nd length byte of Ans
     ex de,hl            ; exchange de and hl
     ldir                ; copy name to op1
     call _chkfindsym    ; look up program
     jp c,_errundefined  ; if it is not found error
     ld (hl),progobj     ; make unprotected
     ret

.end
END