Classic Computer Magazine Archive PROGRAM LISTING: 85-08/DLMASTER.ACT


; DISPLAY MASTER
; BY DAVE OBLAD
; (c) 1985, ANTIC PUBLISHING 
; (NOTE:COMPILE DIRECTLY FROM DISK!)
     
BYTE A=$680,B=$681,X=$682,Y=$683
BYTE B0=$684,B1=$685,B2=$686,B3=$687
BYTE C1=$688,C2=$689,C3=$68A,C4=$68B
BYTE D1=$68C,D2=$68D,D3=$68E,D4=$68F
BYTE KEY=$D01F,MASK=$D20A,NOW=$685
CARD SCREEN=$690,DLIST=$692
CARD PNTR=$694,LINE=$696,HOLD=$698
CARD R=$69A,L=$69C
BYTE ARRAY RAM,ORG,REV,STP,FILE
CARD ARRAY DL,SL

PROC FIND()
 GRAPHICS(24)
 DLIST=PEEKC(560)
 SCREEN=PEEKC(DLIST+4)
 RAM=SCREEN
 ORG=RAM-8000
 DL=ORG-400
 SL=DL-400
 REV=SL-300
 STP=REV-300
 FILE=STP-40 
 LINE=SCREEN
 FOR X=0 TO 191
  DO
   SL(X)=LINE:LINE==+40
  OD
 DLIST=FILE-1400:DLIST=DLIST&$FC00
 X=0
 DO
  B3=X&$03:B3=B3 LSH 6
  B2=X&$0C:B2=B2 LSH 2
  B1=X&$30:B1=B1 RSH 2
  B0=X&$C0:B0=B0 RSH 6
  B3=B3%B2:B3=B3%B1:B3=B3%B0
  REV(X)=B3
  X==+1:IF X=0 THEN EXIT:FI
 OD
 D1=PEEK(712)
 D2=PEEK(708)
 D3=PEEK(709)
 D4=PEEK(710)
RETURN

PROC MAKE()
 GRAPHICS(24)
 FOR X=0 TO 191
  DO
   DL(X)=SL(X)
  OD
 POKE(DLIST,112)
 POKE(DLIST+1,112)
 POKE(DLIST+2,112)
 LINE=DLIST+3
 FOR A=0 TO 191
  DO
   POKE(LINE,$4E)
   POKEC(LINE+1,DL(A))
   LINE==+3
  OD   
 POKEC(560,DLIST):POKEC(54274,DLIST)
 POKEC(88,SCREEN)
 POKE(LINE,$41)
 POKEC(LINE+1,DLIST)
RETURN

PROC SHOW()
 LINE=DLIST+3
 FOR A=0 TO 191
  DO 
   POKEC(LINE+1,DL(A))
   LINE==+3
  OD
RETURN

PROC RESTORE()
 FOR X=0 TO 191
  DO
   DL(X)=SL(X)
  OD
 FOR PNTR=0 TO 7679
  DO
   RAM(PNTR)=ORG(PNTR)
   IF KEY<7 THEN EXIT:FI
  OD
 SHOW()
RETURN

PROC FADE()
 POKE(712,C1)
 POKE(708,C2)
 POKE(709,C3)
 POKE(710,C4)
 FOR X=0 TO 100
  DO
   PNTR=0
   DO 
    PNTR==+RAND(60)
    IF PNTR>7679 THEN EXIT:FI
    RAM(PNTR)=ORG(PNTR)&MASK%RAM(PNTR)
    IF KEY<7 THEN EXIT:FI
   OD
  OD
 RESTORE()
RETURN

PROC REVERSE()
 L=0
 FOR Y=0 TO 191
  DO
   R=L+39
   FOR X=0 TO 19
    DO
     A=RAM(L):B=RAM(R)
     RAM(L)=REV(B)
     RAM(R)=REV(A)
     L==+1:R==-1
    OD
   L==+20
  OD
RETURN

PROC MIRROR()
 FOR X=0 TO 95
  DO
   HOLD=DL(X)
   DL(X)=DL(191-X)
   DL(191-X)=HOLD
  OD
 SHOW()
RETURN

PROC SHIFT()
 PNTR=0
 FOR Y=0 TO 191
  DO
   FOR X=0 TO 19
    DO
     A=RAM(PNTR)
     RAM(PNTR)=RAM(PNTR+20)
     RAM(PNTR+20)=A
     PNTR==+1
    OD
  PNTR==+20
  OD
RETURN
 
PROC DOUBLE()
 FOR X=0 TO 95
  DO
   DL(X)=DL(X*2)
  OD
 FOR X=0 TO 95
  DO
   DL(X+96)=DL(X)
  OD
 SHOW()
RETURN
 
PROC UNFOLD()
 X=192
 DO
  X==-1:A=X
  DO
   HOLD=DL(A)
   DL(A)=DL(A-1)
   DL(A-1)=HOLD
   A==-2
   IF A=0 THEN EXIT:FI
   IF A>250 THEN EXIT:FI
  OD
  SHOW()
  IF X=1 THEN EXIT:FI
  IF KEY<7 THEN EXIT:FI
 OD
RETURN

PROC FOLD()
 X=0 
 DO
  A=X
   DO
    HOLD=DL(A)
    DL(A)=DL(A+1)
    DL(A+1)=HOLD
    A==-2
    IF A>250 THEN EXIT:FI
   OD
  SHOW()
  X==+1
  IF X=191 THEN EXIT:FI
  IF KEY<6 THEN EXIT:FI
 OD
RETURN

PROC ROLL()
 FOR X=0 TO 95
  DO
   LINE=DL(191):Y=191
   FOR A=0 TO 94
    DO
     HOLD=DL(Y)
     DL(Y)=DL(Y-2)
     DL(Y-2)=HOLD
     Y==-2
    OD
   HOLD=DL(1)
   DL(1)=DL(0)
   DL(0)=HOLD 
   Y=0
   FOR A=0 TO 94
    DO
     HOLD=DL(Y)
     DL(Y)=DL(Y+2)
     DL(Y+2)=HOLD
     Y==+2
    OD
   DL(190)=LINE
   SHOW()
   IF KEY<7 THEN EXIT:FI
  OD
RETURN

PROC WAIT()
 FOR PNTR=0 TO 60000
  DO
   IF KEY<7 THEN EXIT:FI
  OD
RETURN

PROC MOIRE()
 MAKE()
 POKE(712,D1)
 POKE(708,D2)
 POKE(709,D3)
 POKE(710,D4)
 DO:IF KEY>6 THEN EXIT:FI:OD
 COLOR=1
 Y=RAND(9)+2:X=RAND(9)+2
 Y=Y&$FE:X=X&$FE
 FOR PNTR=0 TO 191
  DO
   PLOT(160,96):DRAWTO(0,PNTR)
   PLOT(159,96):DRAWTO(319,PNTR)
   PNTR==+Y
   IF KEY<7 THEN EXIT:FI
  OD
 FOR PNTR=0 TO 319
  DO
   PLOT(160,96):DRAWTO(PNTR,0)
   PLOT(160,95):DRAWTO(PNTR,191)
   PNTR==+X
   IF KEY<7 THEN EXIT:FI
  OD
 FOR PNTR=0 TO 7679
  DO
   ORG(PNTR)=RAM(PNTR)
   IF KEY<7 THEN EXIT:FI
  OD
RETURN

PROC FETCH()
 MAKE()
 CLOSE(1)
 OPEN(1,FILE,4,0)
 FOR PNTR=0 TO 7679
  DO
   A=GETD(1):ORG(PNTR)=A
  OD
 C1=GETD(1)
 C2=GETD(1)
 C3=GETD(1)
 C4=GETD(1)
 CLOSE(1)
 FADE()
RETURN

PROC GETFILE()
 GRAPHICS(0)
 PRINTE(
"PUT DISK WITH PICTURE FILES IN DRIVE1")
 PRINTE("PUSH ������ KEY WHEN DONE!")
 INPUTS(FILE)
 CLOSE(2)
 OPEN(2,"D:*.?IC",6,0)
 DO
  INPUTSD(2,FILE)
  PRINTE(FILE)
  IF FILE(2)#$20 THEN EXIT:FI
 OD
 CLOSE(2)
 PRINTE("")
 PRINTE("ENTER 'D:FILENAME.EXT'")
 PRINTE("OR JUST HIT ������ TO EXIT.")
 PRINT("?"):INPUTS(FILE)
RETURN

PROC DISPLAY()
 POSITION(1,18):PRINT(">")
 POSITION(2,17)
 NOW==-1
 FOR X=1 TO 3
  DO
   PRINT("STEP ")
   PRINTB(NOW)
   PRINT(" IS OPT                  ")
   POSITION(18,16+X)
   IF STP(NOW)>47 AND STP(NOW)<58
      THEN PRINTB(STP(NOW)-48):FI
   IF STP(NOW)=80 OR STP(NOW)=76
      THEN PRINT(FILE):FI
   IF STP(NOW)=77
      THEN PRINT("MOIRE"):FI
   IF STP(NOW)=0
      THEN PRINT("STOP"):FI
   PRINTE("")
   NOW==+1
  OD
 NOW==-2
RETURN

PROC SETUP()
 GRAPHICS(0):POKE(752,1)
 POKE(763,255):POKE(764,255)
 CLOSE(1)
 OPEN(1,"K:",4,0)
 PRINTE
("Display Master, by Dave Oblad")
 PUTE()        
 PRINTE ("Antic Magazine, 8/85")
 PUTE() PUTE() PUTE()
 PRINTE
("TO MANIPULATE A �ICTURE FILE PUSH 'P'")
 PRINTE
("TO MANIPULATE A �OADED PICT. PUSH 'L'")
 PRINTE
("TO MANIPULATE A �OIRE SCREEN PUSH 'M'")
 PRINTE
("TO SEE A �EMO OF THIS PROGRAM PUSH 'D'")
 PRINT
("PUSH 'P' OR 'L' OR 'M' OR 'D' !")
 POKE(702,64)
 A=GETD(1)
 IF A#76 THEN
   IF A=80 THEN STP(0)=A:GETFILE() 
    ELSE FILE(1)=0
   FI
  ELSE STP(0)=A
 FI
 IF FILE(1)#68 THEN STP(0)=77:FI
 IF A#80 AND A#77 AND A#76 THEN
  STP(0)=77
  RETURN
 FI
 GRAPHICS(0):POKE(752,1)
 PRINTE("")
 PRINTE("1 = RESTORE DISPLAY")
 PRINTE("2 = INVERT DISPLAY")
 PRINTE("3 = MIRROR DISPLAY")
 PRINTE("4 = SHIFT DISPLAY")
 PRINTE("5 = DOUBLE DISPLAY")
 PRINTE("6 = FOLD DISPLAY")
 PRINTE("7 = UNFOLD DISPLAY")
 PRINTE("8 = ROLL DISPLAY 50%")
 PRINTE("9 = WAIT 2 SECONDS")
 PRINTE("0 = REPEAT FROM STEP 1")
 PRINTE("")
 PRINTE("- = BACK 1 INSTRUCTION")
 PRINTE("+ = SKIP TO NEXT INSTRUCTION")
 PRINTE("* = DELETE THIS INSTRUCTION")
 PRINTE("= = BEGIN EXECUTION")
 NOW=1        
 DO
  DISPLAY()
  POSITION(2,22)
  PRINT("CHOOSE AN OPTION:")
  A=GETD(1):PUT(A)
  IF A=45 AND NOW>1 THEN NOW==-1:FI
  IF A=43 AND NOW<250 THEN NOW==+1:FI
  IF A>47 AND A<58 THEN 
   X=253
   DO
    STP(X)=STP(X-1):X==-1
    IF X=NOW THEN STP(X)=A:EXIT:FI
   OD
   NOW==+1
  FI
  IF A=42 THEN X=NOW
   DO
    STP(X)=STP(X+1):X==+1
    IF X=254 THEN EXIT:FI
   OD
  FI
  IF A=61 THEN EXIT:FI
 OD
 CLOSE(1)
 GRAPHICS(0):POKE(752,1):PRINTE("")
 PRINTE
("���� DOWN ���� KEY WHEN TONE SOUNDS") 
 PRINTE
("OR WHEN YOU WANT OPTIONS AGAIN.")
 PRINTE
("")
 PRINTE
("  PUSH ���� KEY NOW TO BEGIN TASKS!")
 DO:IF KEY<7 THEN EXIT:FI:OD
RETURN

PROC MAIN()
 FIND()
 FOR X=0 TO 254
  DO
   STP(X)=0
  OD
 SCOPY(STP,"88766777666878868740")
 DO
  NOW=1:SETUP()
  IF STP(0)#76 THEN
    IF STP(0)=80 THEN FETCH()
    ELSE MOIRE()
    FI
   ELSE
    MAKE()
    POKE(712,C1)
    POKE(708,C2)
    POKE(709,C3)
    POKE(710,C4)
    RESTORE()
  FI
  NOW=1
  DO
   IF STP(NOW)=48 THEN NOW=1:FI
   IF STP(NOW)=49 THEN RESTORE():FI
   IF STP(NOW)=50 THEN MIRROR():FI
   IF STP(NOW)=51 THEN REVERSE():FI
   IF STP(NOW)=52 THEN SHIFT():FI
   IF STP(NOW)=53 THEN DOUBLE():FI
   IF STP(NOW)=54 THEN FOLD():FI
   IF STP(NOW)=55 THEN UNFOLD():FI
   IF STP(NOW)=56 THEN ROLL():FI
   IF STP(NOW)=57 THEN WAIT():FI
   IF STP(NOW)=0 THEN EXIT:FI
   IF KEY<7 THEN EXIT:FI
   NOW==+1
   POKE(77,1)
  OD
  DO
   A=PEEK(20):B=A RSH 5:B=B&1  
   IF B=0 THEN SOUND(0,40,10,8):FI
   IF B=1 THEN SOUND(0,80,10,4):FI
   IF KEY<7 THEN EXIT:FI
  OD
  SNDRST()
 OD
RETURN


Back to previous page