Sideways

From Misc Data Digs

An obscure Apple II program for printing spreadsheet data made in 1984.

Source Code[edit | edit source]

In Track 29, source code for the copy protection can be found in the disk.

    PROVIDED UNDER THE TERMS OF
; A LICENSING AGREEMENT BETWEEN 
; TURNING POINT SOFTWARE AND FUNK
; SOFTWARE

;
;**************************************
;
;PAUL: SET THE ORG AND OBJ AS REQUIRED.
;       THE PROGRAM IS $93 BYTES LONG.
;
@ORG =$2000 ;RUN TIME ADDRESS
@OBJ =$2000 ;ASSEMBLE AT THIS ADRS
;
;
;**************************************
;
;SET FUNK TO THE ZERO PAGE ADDRESS YOU
;    DESIRE.  IT IS INITIALIZED TO $FF
;   AND IS INCREASED FOR EACH ERROR
;   DURING CHECKING. THEN IT IS
;   EOR'D WITH SYNCL+1.  SYNCL+1 WILL
;   BE $11 IF DISK IS OK.
;
FUNK =$06 ;=$EE IF DISK IS OK
  ;= ?? IF DISK IS COPIED
;
;**************************************
;
;
;THE FOLLOWING LABELS ARE ADDRESSES
; USED BY THE CHECKER. THEY ARE VALID
; FOR DIVERSA DOS AND DOS 3.3.
;
;
DRVPTCH =$BE4D ;PATCH TO MAKE DOS 
 
; LEAVE DRIVE ON
;

RWTS =$B7B5 ;ADDRESS OF RWTS
PARMS =$B7E8 ;ADDRESS OF PARAMETERS
;
;
;
;**************************************
;
;THESE ARE HARDWARE ADDRESSES IN THE
; I/O SPACE.
;
LC08C =$C08C ;DATA LATCH W/STROBE
DRVOFF =$C088 ;ADDRESS TO TURN OF DRV
;
;
;**************************************
;
;PROGRAM START:
;
; GET DOS TO POS. HEAD ON TRACK=PROTRK
; AND LEAVE THE DRIVE ON
;
PROTRK =$22
;
;**************************************
;
;
CHECK LDA DRVPTCH ;SAVE DRIVE ON
 PHA ;  ; PATCH BYTE
;
 LDA #PROTRK ;SET IOBTRK TO
 STA PARMS+4 ; PROTRK
;
 LDA #$00 ;SET COMMAND TO
 STA PARMS+C ; SEEK
;
 LDA #$60 ;PATCH TO LEAVE
 STA DRVPTCH ; DRIVE ON
;
 LDY #PARMS
 LDA #PARMS+1
 JSR RWTS ;CALL DOS
;
 PLA ;  ;RESTORE DRIVE
 STA DRVPTCH ; ON PATCH
;
 LDA #$FF ;INITIALIZE BYT
 STA FUNK ; FOR FUNK
;
;**************************************
;
;DRIVE IS NOW ON WITH HEAD AT PROTRK
;
;    START ACTUAL CHECK OF TRACK
;
;**************************************
;
FRSTD5 LDA LC08C,X ;FIND A $D5
 BPL FRSTD5
 PHA
 PLA
 CMP #$D5
 BNE FRSTD5
;
INIT LDY #$00 ;INIT SYNCL
 STY SYNCL
;
SCNDD5 LDA LC08C,X ;CHECK FOR NEXT
 BPL SCNDD5 ; D5 AND BRANCH
 CMP #$D5 ; WHEN FOUND
 BEQ FOUND2
;
 CMP #$F7 ;Y<>0 IF $F7
 BNE NOTF7 ; FOUND BETWEEN
 INY ;  ;TWO $D5'S
NOTF7 CLC
 ADC SYNCL ;CALC CHKSUM IN
 STA SYNCL ; CASE THIS IS
 JMP SCNDD5 ; D5-FA-F7-D5
;
FOUND2 TYA ;  ;LOOP BACK IF
 BEQ INIT ; IF NO FA IN
   ; REGION
;
FRSTSYN LDA LC08C,X ;READ SYNC
 BPL FRSTSYN ; BYTES BEFORE
 PHA ;  ; GLITCH
 PLA
 CMP #$FF
 BEQ FRSTSYN
;
 CMP #$D5 ;IF $D5 THEN NO
 BNE CHKGLCH ; GLITCH
;
 INC FUNK
;
CHKGLCH LDY #$05 ;READ 5 BYTES
SKPGLIT LDA LC08C,X ; TO PASS OVER
 BPL SKPGLIT ; GLITCH
 PHA
 PLA
 DEY
 BNE SKPGLIT
;
SCNDSYN LDA LC08C,X ;READ SYNC
 BPL SCNDSYN ; BYTES AFTER
 PHA ;  ; GLITCH. PLA
 CMP #$FF
 BEQ SCNDSYN
;
 CMP #$D5 ;IF NOT $D5
 BEQ CMPFF ; THEN MORE
   ; THAN 1 GLITCH
;
 INC FUNK
;
CMPFF LDA LC08C,X ;CHECK THAT $D5
 BPL CMPFF ; IS FOLLOWED
 CMP #$FF ; BY $FF
 BNE CHKSYNC
;
 INC SYNCL
;
CHKSYNC LDA SYNCL ;EOR SYNCL+1
 EOR FUNK ; WITH FUNK
 STA FUNK ; =$EE IF OK
;
 LDA DRVOFF,X ;DRIVE OFF
;
 RTS
;
;**************************************
;
;DATA BYTE - CONTAINS CHKSUM+1
;
SYNCL .00
;
;
;**************************************
;
;
;END