A83: protection
[Prev][Next][Index][Thread]
A83: protection
ok before anything else, lets get one thing straight. i thought you all
would be able to figure this one out by yourselves, but i guess not. i
got the stuff you need. the first one protects a program. the second one
unprotects a program. the third is a combo, if the prog is protected it
unprotects is and visa-versa. the first two i wrote BY MYSELF about 2
months ago, so don't try to pass it off as your work just give me due
credit. the last one i just made now (i did not test it) so who knows if
it actually works. but it should.
------------------------------------------------------------------------
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 ; clear op1
ld a,tAns ; load var name Ans into op1
ld (op1+1),a ;
call _findsym ; look up Ans
jp c,_errundefined ; error if not found
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 ; error if not found
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 ; clear op1
ld a,tAns ; load var name Ans into op1
ld (op1+1),a ;
call _findsym ; look up
jp c,_errundefined ; error if not found
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 ; error if not found
ld (hl),progobj ; make unprotected
ret
.end
END
------------------------------------------------------------------------
zreverse.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 ; clear op1
ld a,tAns ; load var name Ans into op1
ld (op1+1),a ;
call _findsym ; look up
jp c,_errundefined ; error if not found
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 ; error if not found
ld a,(hl) ; get type
protect:
cp 5 ; is it unprotected? (5 = unprotected)
jr nz,unprotect ; no then unprotect it
inc (hl) ; yes then protect it
ret ; to protect change 5 to 6
; by incrementing (hl) you add 1 to 5
; making it 6, or protected
unprotect:
dec (hl) ; it isn't unprotected, so unprotect it
ret ; to unprotect change 6 to 5
; by decrementing (hl) you sub 1 from 6
; making it 5, or protected
.end
END
References: