CRYPTO

Date: 198x
Type: Program
Platform(s): TS 2068

Creates a simple substitution cypher that you define.

Appears on

Capital Area Timex Sinclair User Group’s Library Tape.

Gallery

CRYPTO

Source Code

    5 REM "CRYPTO"
   10 FOR i=65528 TO 65534
   12 POKE i,0
   14 NEXT i
   16 CLS : POKE 23609,30: POKE 65535,128: POKE 23658,8
   20 PRINT AT 9,8;"""CRYPTO"" PAD": PRINT : PRINT : PRINT : PRINT 
   22 PRINT "  A SIMPLE-SUBSTITUTION Cipher           Scratchpad": PRINT : PRINT : PRINT 
   24 PRINT "  Enter Message or Cryptogram-"
   30 LET c$="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
   50 INPUT LINE a$
   55 LET a$=a$+"\u "
   60 CLS 
   70 PRINT 
  100 FOR i=33 TO 1 STEP -1
  110 IF i>LEN a$ THEN LET i=LEN a$
  120 IF a$(i)=" " THEN GO TO 200
  130 NEXT i
  150 LET r$=a$( TO 32): LET a$=a$(33 TO ): GO TO 300
  200 LET r$=a$( TO i-1)
  210 LET a$=a$(i+1 TO )
  300 PRINT r$
  320 PRINT : PRINT 
  325 IF LEN a$=0 THEN GO TO 360
  330 IF a$(1)<>" " THEN GO TO 100
  340 LET a$=a$(2 TO )
  350 GO TO 330
  360 PRINT AT 21,0; FLASH 1;"SETTING PUNCTUATION"
  365 FOR r=1 TO 20 STEP 3
  370 FOR c=0 TO 31
  375 LET p=CODE SCREEN$ (r,c)
  380 IF p=0 THEN GO TO 480
  385 IF p=32 THEN GO TO 395
  390 IF (p<65 OR p>90) THEN PRINT AT r+1,c;SCREEN$ (r,c)
  395 NEXT c
  396 NEXT r
  480 PRINT AT 21,0;"LET "; FLASH 1;"?"; FLASH 0;"=";c$
  490 LET h=0
  495 BEEP .03,20
  500 IF INKEY$<>"" THEN GO TO 500
  501 IF INKEY$="" THEN GO TO 501
  502 LET l$=INKEY$
  504 IF l$>"`" OR l$<" " THEN GO TO 500
  505 BEEP .02,15
  510 PRINT AT 21,4;l$
  515 FOR r=1 TO 20 STEP 3
  520 FOR c=0 TO 31
  530 IF SCREEN$ (r,c)=l$ THEN PRINT AT r,c; FLASH 1;l$: BEEP .03,30: LET h=1
  540 IF CODE SCREEN$ (r,c)=0 THEN GO TO 595
  550 NEXT c
  590 NEXT r
  595 BEEP .01,10
  600 IF NOT h THEN GO TO 480
  605 INPUT "Substitute which letter?";m$
  610 IF m$="" THEN GO TO 605
  612 LET m$=m$(1)
  613 IF m$<" " OR m$>"`" THEN GO TO 605
  615 IF NOT (m$>"@" AND CODE m$<91) THEN GO TO 650
  618 IF c$(CODE m$-64)=" " THEN GO TO 605
  630 LET c$(CODE m$-64)=" "
  650 FOR r=1 TO 20 STEP 3
  655 FOR c=0 TO 31
  660 IF SCREEN$ (r,c)<>l$ THEN GO TO 670
  662 PRINT AT r,c; FLASH 0;l$
  664 LET n$=SCREEN$ (r+1,c)
  666 IF (n$>"@" AND CODE n$<91) THEN LET c$(CODE n$-64)=n$
  668 PRINT AT r+1,c;m$: BEEP .01,27
  670 IF CODE SCREEN$ (r,c)=0 THEN GO TO 480
  680 NEXT c
  690 NEXT r
 9000 SAVE "CRYPTO" LINE 10

People

No people associated with this content.

Scroll to Top