home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 85
/
085.d81
/
filecrypt.s
< prev
next >
Wrap
Text File
|
2022-08-26
|
2KB
|
130 lines
;**encrypt/decrypt file
;by Jeff Jones
;open files in BASIC then
;logical file 2 is source
;logical file 3 is output
;sys addr,"password" to encrypt
;sys addr+3,"password# to decrypt
;the longer the password, the better
open =$ffc0
readst =$ffb7
setlfs =$ffba
setnam =$ffbd
load =$ffd5
getin =$ffe4
clrchn =$ffcc
close =$ffc3 ;a
chrin =$ffcf
chkout =$ffc9 ;x
chkin =$ffc6 ;x
plot =$fff0
chrout =$ffd2
color'pointer =243
screen'line'pointer =209
print'number =$bdcd ;x,a
clear'line =59903
password'index =251
string'length =252
temp =250
flag =249
.org $033c
;mem
.obj "@0:filecrypt.o"
jmp start
jmp decrypt
start jsr get'password
jsr clrchn
ldx #2
jsr chkout
ldy #0
sty password'index
- lda $bdcd,y
sty temp
jsr scramble'unscramble
jsr chrout
ldy temp
iny
cpy #10
bne -
lda #0
sta password'index
encrypt'the'file jsr clrchn
ldx #1
jsr chkin
jsr getin
jsr scramble'unscramble
sta temp
jsr readst
and #64
bne close'files
jsr clrchn
ldx #2
jsr chkout
lda temp
jsr chrout
jmp encrypt'the'file
close'files lda #49
sta 631
inc 198
jsr clrchn
ldx #2
jsr chkout
lda temp
jsr chrout
jsr clrchn
lda #1
jsr close
lda #2
jmp close
decrypt jsr get'password
jsr clrchn
ldx #1
jsr chkin
ldy #0
sty 198
sty password'index
- jsr getin
sty temp
jsr scramble'unscramble
ldy temp
cmp $bdcd,y
bne close'files
iny
cpy #10
bne -
lda #0
sta password'index
jmp encrypt'the'file
get'password jsr $aefd
jsr $ad9e
jsr $b6a3
sta string'length
stx 253
sty 254
rts
scramble'unscramble ldy password'index
inc password'index
cpy string'length
bcc +
ldy #0
sty password'index
+ eor (253),y
rts