;--------------------------------------- ;- MANDELBROT AND JULIA SET PLOTTER - ;--------------------------------------- ;- PROGRAMMING BY DOMINIC FORD - ;--------------------------------------- ;- ORIGINAL CODE: AUTUMN 1995 - ;- ADAPTED: SPRING 1996 - ;- VERSION 3: SPRING 1997 - ;--------------------------------------- ; *= $1000 ; ; VARIABLES XPIXEL = $4103 YPIXEL = $4104 COLOUR = $4105 YPIB = $4106 MAXCOL = $4107 XP = $4108 YP = $4109 XPB = $410A CLICK = $410B HOUR = $410C XPIB = $410D XPBIB = $410E COL0 = $410F COL1 = $4110 COL2 = $4111 COL3 = $4112 COL0S = $4113 COL1S = $4114 COL2S = $4115 COL3S = $4116 OLDTIME = $4117 SPEED = $4118 NEGREG = $4119 FRACTYPE = $411A BITSTEP = $411B XPSTRE = $411C XPMAX = $411D YPMAX = $411E XPOSN = $411F YPOSN = $4120 FRACNEW = $4121 XPIXS = $4122 YPIXS = $4123 TICK = $4124 SECONDS = $4125 ; ROM ROUTINES OUTDO = $E10C SETLFS = $FFBA SETNAM = $FFBD SAVEROM = $FFD8 PLOTRROM = $E56C ; ; MAIN PROGRAM LOOP JSR INIT JSR MTABLE COMEBACK JSR HIRESON CONTROLOP LDA CLICK BNE CONTROLOP CONTLOPB LDA CLICK BEQ CONTLOPB LDA XPB BNE BOT LDA XP CMP #$58 BCC CONTCONT BOT JMP BOX CONTCONT LDA YP CMP #$5A BCC CONTROLOP SEC SBC #$5A LSR A LSR A AND #$FE TAX LDA VECTORS,X STA $FB INX LDA VECTORS,X STA $FC JMP ($FB) ; жецторс VECTORS .WORD SWITCH,CONTROLOP .WORD ZOOMIN,CONTROLOP .WORD POSITION,CONTROLOP .WORD CONTROLOP .WORD COLS,CONTROLOP .WORD COLCYCLE,CONTROLOP .WORD MANDPLOT,CONTROLOP .WORD CONTROLOP .WORD EXIT,CONTROLOP .WORD HELP,CONTROLOP .WORD SAVE,CONTROLOP ; EXIT JSR HIRESOFF LDA #$93 JSR OUTDO LDA #$05 JSR OUTDO LDA #$00 STA $C6 LDA #$37 STA $01 RTS ; вимп роутинес IRQ LDA #$00 STA CLICK LDA $C5 CMP #$01 BNE CONCHECK STA CLICK CONCHECK CMP #$0C BEQ LEFTK LKC CMP #$17 BEQ RIGHTK RKC CMP #$32 BEQ UPK UPKC CMP #$37 BEQ DOWNK DKC LDA $DC00 AND #$01 BEQ UPJ UJC LDA $DC00 AND #$02 BEQ DOWNJ DJC LDA $DC00 AND #$04 BEQ LEFTJ LJC LDA $DC00 AND #$08 BEQ RIGHTJ RJC LDA $DC00 AND #$10 EOR #$10 BEQ CJCH STA CLICK CJCH JMP BOXFLASH LEFTK JSR LEFT JMP LKC RIGHTK JSR RIGHT JMP RKC UPK JSR UP JMP UPKC DOWNK JSR DOWN JMP DKC UPJ JSR UP JMP UJC DOWNJ JSR DOWN JMP DJC LEFTJ JSR LEFT JMP LJC RIGHTJ JSR RIGHT JMP RJC LEFT DEC XP LDA XP CMP #$FF BNE NOTFF LDY #$00 STY XPB NOTFF LDY XPB BNE FIN CMP #$18 BNE FIN INC XP FIN JMP CONTROL RIGHT INC XP LDA XP BNE NOT00 LDY #$01 STY XPB NOT00 LDY XPB BEQ FIN CMP #$58 BNE FIN DEC XP JMP CONTROL UP DEC YP LDA YP CMP #$32 BNE FIN INC YP JMP CONTROL DOWN INC YP LDA YP CMP #$F8 BNE FIN DEC YP ; CONTROL LDA HOUR BEQ NHGLASS LDX #$3A STX $07F8 INX STX $07F9 NHGLASS LDA XP STA $D000 STA $D002 LDA YP STA $D001 STA $D003 LDA $D010 AND #$FC LSR A CLC ADC XPB ASL A CLC ADC XPB STA $D010 LDA #$00 STA $D027 LDA #$01 STA $D028 LDA $D015 ORA #$03 STA $D015 LDA HOUR BNE QTRO LDX #$38 STX $07F8 INX STX $07F9 QTRO RTS ; хирес он/офф INIT LDA #$00 STA $D020 STA $D021 STA XP STA HOUR STA FRACNEW STA $D015 LDA #$01 STA XPB LDA #$80 STA YP RTS HIRESON LDA #$3B STA $D011 LDA #$D8 STA $D016 LDA COL0S STA COL0 LDA COL1S STA COL1 LDA COL2S STA COL2 LDA COL3S STA COL3 JSR SETCOLS JSR LEFT SEI LDA #IRQ STA $0315 CLI LDA #$18 STA $D018 RTS HIRESOFF SEI LDA #$31 STA $0314 LDA #$EA STA $0315 CLI LDA #$00 STA $D015 STA $D021 LDA #$9B STA $D011 LDA #$C8 STA $D016 LDA #$15 STA $D018 RTS ; хелп роутинес HELP JSR HIRESOFF LDA #$1C JSR OUTDO LDA #$93 JSR OUTDO LDA #$00 HELPLOOP PHA ASL A ASL A CLC ADC #$42 STA $FC LDY #$00 STY $FB STY $FD LDA #$04 STA $FE HELPLOOPB LDA ($FB),Y STA ($FD),Y INY BNE HELPLOOPB INC $FC INC $FE LDA $FE CMP #$08 BNE HELPLOOPB HELPKEY LDA $C5 CMP #$40 BNE HELPKEY HELPKEYB LDA $C5 CMP #$40 BEQ HELPKEYB TAX PLA CPX #$01 BEQ HNOMORE CPX #$28 BEQ NEXT CPX #$2B BEQ PREV HELPRET PHA JMP HELPKEYB HNOMORE JMP COMEBACK NEXT CMP #$05 BEQ HELPRET CLC ADC #$01 JMP HELPLOOP PREV CMP #$00 BEQ HELPRET SEC SBC #$01 JMP HELPLOOP ; и/о роутинес ; FNAME .TEXT ""FILENAME: " .TEXT " " .BYTE 0 DEVN .TEXT " DEVICE NUMBER: 08" .BYTE 0 INSD .TEXT " INSERT DISK " TENS .BYTE 0,10,20,30,40,50 .BYTE 60,70,80,90 ; PSTRING LDY #$00 PSTRLOP LDA ($FB),Y BEQ PSTRQUIT JSR OUTDO INY JMP PSTRLOP PSTRQUIT RTS ONOFF LDA $040A,Y EOR #$80 STA $040A,Y RTS GETKEY LDA $C5 CMP #$40 BNE GETKEY GETKEYB LDA $C5 CMP #$40 BEQ GETKEYB TAX LDA KEYTABLE,X BEQ GETKEY RTS SAVE JSR HIRESOFF LDX #$00 LDA #$20 FNAMECLR STA $41F0,X INX CPX #$10 BNE FNAMECLR LDA #FNAME STA $FC JSR PSTRING LDA #$00 PHA SAVELOOP TAY JSR ONOFF JSR GETKEY PHA JSR ONOFF PLA CMP #$80 BCS DECODE TAY PLA TAX TYA STA $040A,X CMP #$20 BCS NOSPC CLC ADC #$40 NOSPC STA $41F0,X INCPOS CPX #$0F BEQ SAVERELOP INX SAVERELOP TXA PHA JMP SAVELOOP DECODE CMP #$80 BEQ SAVECONT CMP #$81 BEQ DELETE CMP #$82 BNE SAVELOOP+1 PLA TAX LDA $028D AND #$01 BEQ INCPOS DECPOS CPX #$00 BEQ SAVERELOP DEX JMP SAVERELOP DELETE PLA TAX LDA #$20 STA $040A,X STA $41F0,X JMP DECPOS SAVECONT PLA LDA #DEVN STA $FC JSR PSTRING DEVICE JSR GETKEY CMP #$80 BEQ DISKSAVE CMP #$30 BCC DEVICE CMP #$3A BCS DEVICE TAX LDA $0460 STA $045F STX $0460 JMP DEVICE DISKSAVE LDA #INSD STA $FC JSR PSTRING LDA $045F SEC SBC #48 TAX LDA TENS,X CLC ADC $0460 SEC SBC #48 TAX TAPECONT LDA $C5 CMP #$3C BNE TAPECONT LDA #$01 TAY JSR SETLFS LDX #$10 FNAMELEN LDA $41EF,X CMP #$20 BNE FNAMEGOT DEX BEQ FNAMEGOT JMP FNAMELEN FNAMEGOT TXA LDX #$F0 LDY #$41 JSR SETNAM LDA #$20 STA $FC LDX #$00 STX $FB LDY #$40 LDA #$FB JSR SAVEROM JMP COMEBACK ; кеыбоард децоде табле ; KEYTABLE .BYTE $81,$80,$82 .BYTE 0,0,0,0,$83,51,23,1,52 .BYTE 26,19,5,0,53,18,4,54,3,6 .BYTE 20,24,55,25,7,56,2,8,21 .BYTE 22,57,9,10,48,13,11,15 .BYTE 14,43,16,12,45,46,0,0,44 .BYTE 0,0,0,0,0,0,30,47,49,31,0 .BYTE 50,32,0,17,0,0 ; ; манделброт сет цалцулатор MANDLE LDA FRACTYPE CMP #$02 BNE MANDOK PLA PLA RTS MANDOK LDA CLICK BNE MANDOK LDA #$01 STA HOUR JSR LEFT LDA FRACNEW BEQ NEWMAND LDA YPIXS STA YPIXEL LDA XPIXS STA XPIXEL JMP XRELOP NEWMAND LDA #$80 STA BITSTEP BITSTL LDA #$00 STA YPIXEL STA YPOSN LDA #$03 STA $4100 LDA #$06 STA $4102 JSR EQUAL YRELOP LDA #$00 STA XPIXEL LDA #$01 STA $4100 LDA #$05 STA $4102 JSR EQUAL XRELOP LDA XPOSN AND #$01 BNE NOTDM LDA YPOSN AND #$01 BEQ DONEM NOTDM LDA XPIXEL AND #$01 BNE MCERT MCERT JSR MANDEL JSR PLOTRECT DONEM LDA #$05 STA $4100 STA $4102 LDA #$02 STA $4101 LDA BITSTEP LSR A BNE GAPXM LDA #$01 GAPXM PHA JSR ADDITION PLA SEC SBC #$01 BNE GAPXM INC XPOSN LDA BITSTEP CMP #$01 BNE NOTLSX INC XPIXEL NOTLSX LDA XPIXEL CLC ADC BITSTEP STA XPIXEL BCC XRELOPT LDA #$06 STA $4100 STA $4102 LDA #$04 STA $4101 LDA BITSTEP GA(YM PHA JSR ADDITION PLA SEC SBC #$01 BNE GA(YM INC YPOSN LDA #$00 STA XPOSN LDA YPIXEL CLC ADC BITSTEP STA YPIXEL BCS FINMSCR CMP #$C8 BCC YRELOPT FINMSCR LDA BITSTEP LSR A STA BITSTEP BNE BITSTLT LDA #$00 STA HOUR STA FRACNEW JMP RIGHT BITSTLT JMP BITSTL YRELOPT JMP YRELOP XRELOK JMP XRELOP XRELOPT LDA XPB BNE XRELOK LDA CLICK BEQ XRELOK LDA XP CMP #$58 BCS XRELOPT LDA YP SEC SBC #$B2 CMP #$08 BCS XRELOPT LDA #$01 STA FRACNEW LDA #$00 STA HOUR LDA XPIXEL STA XPIXS LDA YPIXEL STA YPIXS JMP RIGHT ; MANDPIX LDA #$05 STA $4100 LDA #$07 STA $4102 JSR EQUAL INC $4100 INC $4102 JSR EQUAL LDA #$00 STA COLOUR LOOP LDA #$07 STA $4100 STA $4101 LDA #$10 STA $4102 JSR MULTIPLY LDA #$08 STA $4100 STA $4101 LDA #$11 STA $4102 JSR MULTIPLY LDX #$10 STX $4100 INX STX $4101 INX STX $4102 JSR ADDITION LDA $4091 CMP #$04 BCC FAIL CMP #$50 BCS FAIL SUCPASS JMP SUCCESS FAIL INC COLOUR LDA COLOUR CMP MAXCOL BEQ SUCPASS JSR SUBTRACT LDA #$12 STA $4100 LDA #$05 STA $4101 LDA #$13 STA $4102 JSR ADDITION LDA #$07 STA $4100 LDA #$08 STA $4101 INC $4102 JSR MULTIPLY LDA #$14 STA $4100 STA $4101 LDA #$15 STA $4102 JSR ADDITION LDA #$15 STA $4100 LDA #$06 STA $4101 LDA #$16 STA $4102 JSR ADDITION LDA #$13 STA $4100 LDA #$07 STA $4102 JSR EQUAL LDA #$16 STA $4100 LDA #$08 STA $4102 JSR EQUAL JMP LOOP SUCCESS RTS ; MANDPLOT JSR MANDLE ; NOTE SPELLING! JMP CONTROLOP ; ; цолоур хандлинг SETCOLS LDA COL0 STA $D021 LDY #$00 STY $FB LDA #$D8 STA $FC LDA COL3 SETCLOPA STA ($FB),Y INY BNE SETCLOPA INC $FC LDX $FC CPX #$DC BNE SETCLOPA LDA #$04 STA $FC LDA COL1 ASL A ASL A ASL A ASL A ORA COL2 SETCLOPB STA ($FB),Y INY BEQ SETCLOPC CPY #$F8 BNE SETCLOPB LDX $FC CPX #$07 BNE SETCLOPB RTS SETCLOPC INC $FC JMP SETCLOPB COLCWAIT LDA OLDTIME CLC ADC SPEED STA OLDTIME COLCLOP CMP $A2 BNE COLCLOP RTS COLCKEYS LDA $C5 CMP #$28 BEQ SPUP CMP #$2B BEQ SLDN CMP #$01 BEQ COLCOFF NOKEY RTS COLCOFF PLA PLA JMP COMEBACK SPUP LDA SPEED CMP #$03 BEQ NOKEY DEC SPEED RTS SLDN LDA SPEED CMP #$19 BEQ NOKEY INC SPEED RTS ; цолоур цыцлинг COLCYCLE LDA $C5 CMP #$40 BNE COLCYCLE LDA #$0A STA SPEED LDA $A2 STA OLDTIME COLCYCLOP LDA COL0S STA COL0 LDA COL1S STA COL1 LDA COL2S STA COL2 LDA COL3S STA COL3 JSR SETCOLS JSR COLCKEYS JSR COLCWAIT LDA COL3S STA COL0 LDA COL0S STA COL1 LDA COL1S STA COL2 LDA COL2S STA COL3 JSR SETCOLS JSR COLCKEYS JSR COLCWAIT LDA COL2S STA COL0 LDA COL3S STA COL1 LDA COL0S STA COL2 LDA COL1S STA COL3 JSR SETCOLS JSR COLCKEYS JSR COLCWAIT LDA COL1S STA COL0 LDA COL2S STA COL1 LDA COL3S STA COL2 LDA COL0S STA COL3 JSR SETCOLS JSR COLCKEYS JSR COLCWAIT JMP COLCYCLOP ; цолоур + итератион роутинес ITERPRINT LDA MAXCOL AND #$F0 LSR A LSR A LSR A LSR A CMP #$0A BCC ITADD SEC SBC #$39 ITADD CLC ADC #$30 STA $0505 LDA MAXCOL AND #$0F CMP #$0A BCC NOADDIT SEC SBC #$39 NOADDIT CLC ADC #$30 STA $0506 RTS ; COLTEXT .TEXT ""╟ц(r)╟ц(r)╟ц(r)╟ц(r) " .TEXT "б 'бб 'бб 'бб 'б " .TEXT "<- SCREEN COLOURS " .TEXT "╜ц1/2╜ц1/2╜ц1/2╜ц1/2 " .TEXT " 1 2 3 4 " .TEXT " PRESS 1-4 TO CHANGE" .TEXT " " .TEXT "MAXIMUM ITERATIONS: $$$" .TEXT " (+/-)" .BYTE 0 ; COLS JSR HIRESOFF LDA #COLTEXT STA $FC JSR PSTRING LDA COL0S STA $D829 LDA COL1S STA $D82C LDA COL2S STA $D82F LDA COL3S STA $D832 JSR ITERPRINT COLLOOPK JSR GETKEY CMP #$80 BEQ COLQUIT CMP #$31 BEQ COL1ADD CMP #$32 BEQ COL2ADD CMP #$33 BEQ COL3ADD CMP #$34 BEQ COL4ADD CMP #$2B BEQ ITERPLUS CMP #$2D BNE COLLOOPK DEC MAXCOL JSR ITERPRINT JMP COLLOOPK ITERPLUS INC MAXCOL JSR ITERPRINT JMP COLLOOPK COLQUIT JMP COMEBACK COL1ADD INC COL0S LDA COL0S AND #$0F STA COL0S STA $D829 JMP COLLOOPK COL2ADD INC COL1S LDA COL1S AND #$0F STA COL1S STA $D82C JMP COLLOOPK COL3ADD INC COL2S LDA COL2S AND #$0F STA COL2S STA $D82F JMP COLLOOPK COL4ADD INC COL3S LDA COL3S AND #$0F STA COL3S STA $D832 JMP COLLOOPK ; аритхматиц роутинес GETDIGIT CLD ASL A ASL A ASL A STA $02 TXA LSR A STA $24 LDA #$07 SEC SBC $24 CLC ADC $02 TAY LDA $4000,Y TAY TXA AND #$01 BEQ LSNGD TYA AND #$F0 LSR A LSR A LSR A LSR A RTS LSNGD TYA AND #$0F RTS MULTIPLYB JSR NEGATIVE LDA $4102 ASL A ASL A ASL A TAX LDA #$00 TAY MLOPA STA $4000,X INY INX CPY #$08 BNE MLOPA LDA #$03 STA $FC NEWDIGIT LDA $4101 LDX $FC JSR GETDIGITS CMP #$00 BEQ DMOVER STA $FD LDA #$03 STA $FB DMLOP LDA $4100 LDX $FB JSR GETDIGITS CMP #$00 BEQ DMOVER TAY LDA $5E00,Y CLC ADC $FD STA $22 LDA $5E01,Y ADC #$00 STA $23 LDY #$00 LDA ($22),Y STA OLDTIME INY LDA ($22),Y STA COL0 LDA $FB CLC ADC $FC SEC SBC #$06 STA SPEED LDA $4102 ASL A ASL A ASL A CLC ADC #$07 SEC SBC SPEED TAY SED LDA $4000,Y CLC ADC OLDTIME STA $4000,Y CLD DEY SED LDA $4000,Y ADC COL0 STA $4000,Y CLD MALP BCC DMOVER DEY SED LDA $4000,Y ADC #$00 STA $4000,Y CLD JMP MALP DMOVER INC $FB LDA $FB CMP #$07 BCC DMLOPB INC $FC LDA $FC CMP #$07 BCC NEWDIGITB LDA YPIB BEQ QUIT LDA $4102 STA $4101 LDA #$1D STA $4100 JSR SUBTRACT QUIT RTS DMLOPB JMP DMLOP NEWDIGITB JMP NEWDIGIT MSUP LDA $4100 ASL A ASL A ASL A TAX DEX STX $FB LDA $4101 ASL A ASL A ASL A TAX DEX STX $FD LDA $4102 ASL A ASL A ASL A TAX DEX STX $22 LDA #$40 STA $FC STA $FE STA $23 RTS EQUAL JSR MSUP LDY #$08 ELOP LDA ($FB),Y STA ($22),Y DEY BNE ELOP RTS ADDITION JSR MSUP LDY #$08 SED CLC ADLOP LDA ($FB),Y ADC ($FD),Y STA ($22),Y DEY BNE ADLOP CLD RTS SUBTRACT JSR MSUP LDY #$08 SED SEC SULOP LDA ($FB),Y SBC ($FD),Y STA ($22),Y DEY BNE SULOP CLD RTS NEGATIVE LDA #$00 PHA LDA $4100 TAY ASL A ASL A ASL A TAX LDA $4001,X CMP #$50 BCC NEGRMOVEAB PLA ADC #$00 PHA JMP NEGRMOVEA NEGRMOVEAB LDA $4101 TAY ASL A ASL A ASL A TAX LDA $4001,X CMP #$50 PLA BCC NOEOR EOR #$01 PHA BCS NEGRMOVEB NEGRMOVEBB PLA NOEOR STA YPIB RTS NEGRMOVE LDA $4100 PHA LDA $4101 PHA LDA $4102 PHA TYA STA $4101 STA $4102 LDA #$1D STA $4100 JSR SUBTRACT PLA STA $4102 PLA STA $4101 PLA STA $4100 RTS NEGRMOVEA JSR NEGRMOVE JMP NEGRMOVEAB NEGRMOVEB JSR NEGRMOVE JMP NEGRMOVEBB MULTIPLY LDA $4102 PHA LDA $4101 PHA LDA #$18 STA $4102 JSR EQUAL INC $4102 PLA STA $4100 JSR EQUAL LDA #$18 STA $4100 LDA #$19 STA $4101 PLA STA $4102 JMP MULTIPLYB ; MTEXT .BYTE 8,142 .TEXT ""PLEASE WAIT. . ." .BYTE 0 ; MTABLE LDA #MTEXT STA $FC JSR PSTRING LDA #$36 STA $01 JMP MKETABLE ; GETDIGITS CLD ASL A ASL A ASL A STA $02 STX $24 LDA #$07 SEC SBC $24 CLC ADC $02 TAY LDA $4000,Y STA COL1 AND #$0F STA COL2 LDA COL1 AND #$F0 LSR A STA COL3 LDA COL1 AND #$F0 LSR A LSR A LSR A CLC ADC COL2 ADC COL3 ASL A RTS ; репоситион плоттер ; POSTEXT .TEXT "" " .TEXT "P O S I T I O N " .TEXT "XMIN: XMAX: YMIN: YMAX:" .TEXT " CURSOR AND NUMBER" .TEXT " KEYS TO MOVE AND TYPE " .TEXT "+/- CHANGE SIGN " .TEXT "RETURN WHEN DONE" .BYTE 0 PNO PHA ASL A ASL A ASL A TAX LDA $4001,X CMP #$50 BCS PNOVER LDA #$2B JSR OUTDO LDA #$00 STA NEGREG JMP PNCONT PNOVER LDA #$2D JSR OUTDO LDA #$01 STA NEGREG PLA PHA STA $4101 STA $4102 LDA #$1D STA $4100 JSR SUBTRACT PNCONT LDX #$0C PNCB STX $22 PLA PHA JSR GETDIGIT CLC ADC #$30 JSR OUTDO LDX $22 BEQ PNDQ CPX #$0C BEQ PNDOT DEX JMP PNCB PNDOT LDA #$2E JSR OUTDO DEX JMP PNCB PNDQ PLA LDX NEGREG BEQ NOGREG STA $4101 STA $4102 LDA #$1D STA $4100 JSR SUBTRACT NOGREG RTS POSITION JSR HIRESOFF LDA #POSTEXT STA $FC JSR PSTRING LDA #$07 STA $D3 LDA #$03 STA $D6 JSR PLOTRROM LDA #$01 JSR PNO LDA #$07 STA $D3 LDA #$04 STA $D6 JSR PLOTRROM LDA #$1E JSR PNO LDA #$07 STA $D3 LDA #$05 STA $D6 JSR PLOTRROM LDA #$03 JSR PNO LDA #$07 STA $D3 LDA #$06 STA $D6 JSR PLOTRROM LDA #$1F JSR PNO LDX #$01 LDY #$00 JSR POSONOFF POSLOP TXA PHA POSLOPB JSR GETKEY CMP #$2B BEQ POSIPOS CMP #$2D BEQ POSINEG CMP #$82 BEQ XPOSMOVE CMP #$83 BEQ YPOSMOVE CMP #$80 BEQ POSCALCT CMP #$30 BCC POSLOPB CMP #$3A BCS POSLOPB STA $23 PLA PHA TAX JSR GETMEMAD STX $22 TAX LDA $23 EOR #$80 STA $047F,X JMP POSRIGHT POSCALCT JMP POSCALC POSIPOS LDX #$00 JSR GETMEMAD TAX LDA #$2B STA $047F,X JMP POSLOPB POSINEG LDX #$00 JSR GETMEMAD TAX LDA #$2D STA $047F,X JMP POSLOPB XPOSMOVE LDA $028D AND #$01 BEQ POSRIGHT PLA TAX CPX #$01 BEQ POSLOP LMISS JSR POSONOFF DEX JSR POSONOFF CPX #$02 BEQ LMISS JMP POSLOP POSRIGHT PLA TAX CPX #$0E BEQ POSLOP RMISS JSR POSONOFF INX JSR POSONOFF CPX #$02 BEQ RMISS JMP POSLOP YPOSMOVE PLA TAX LDA $028D AND #$01 BEQ POSDOWN CPY #$00 BEQ POSLOPT JSR POSONOFF DEY JSR POSONOFF JMP POSLOPT POSDOWN CPY #$03 BEQ POSLOPT JSR POSONOFF INY JSR POSONOFF JMP POSLOPT POSLOPT JMP POSLOP ; POSSURE .TEXT " REPOSITION: " .TEXT "ARE YOU SURE (Y/N)" .BYTE 0 ; POSCALC PLA TAX JSR POSONOFF LDA #POSSURE STA $FC JSR PSTRING SURELOP JSR GETKEY CMP #$19 BEQ SETPOS CMP #$0E BEQ NOSET JMP SURELOP NOSET JMP COMEBACK SETPOS LDA #$80 STA $FB LDA #$04 STA $FC LDA #$01 JSR SETVAR LDA #$A8 STA $FB LDA #$04 STA $FC LDA #$1E JSR SETVAR LDA #$D0 STA $FB LDA #$04 STA $FC LDA #$03 JSR SETVAR LDA #$F8 STA $FB LDA #$04 STA $FC LDA #$1F JSR SETVAR JSR HIRESON JMP CALCSTEP SETVAR STA $23 ASL A ASL A ASL A STA $FD LDA #$40 STA $FE LDA #$00 TAX TAY STA ($FD),Y INY TYA PHA TXA TAY LDA ($FB),Y STA $22 TYA TAX PLA TAY LDA $22 SEC SBC #$30 STA ($FD),Y INY INX INX SETVLOP TYA PHA TXA TAY LDA ($FB),Y SEC SBC #$30 ASL A ASL A ASL A ASL A INY CLC ADC ($FB),Y SEC SBC #$30 INY STA $22 TYA TAX PLA TAY LDA $22 STA ($FD),Y INY CPY #$08 BNE SETVLOP DEC $FB LDY #$00 LDA ($FB),Y CMP #$2D BEQ MAKENEG RTS MAKENEG LDA $23 STA $4101 STA $4102 LDA #$1D STA $4100 JMP SUBTRACT GETMEMAD TYA ASL A ASL A ASL A STA $22 ASL A ASL A CLC ADC $22 STX $22 ADC $22 CMP #$C8 BCC GMMQUIT CLC ADC #$28 GMMQUIT RTS POSONOFF JSR GETMEMAD STA $22 TXA PHA LDX $22 LDA $047F,X EOR #$80 STA $047F,X PLA TAX RTS ; пиьел сет/цлеар PLOTPC LDA #$47 STA $FB LDA #$3F STA $FC LDA YPIXEL LSR A LSR A LSR A STA YPIB AND #$03 ASL A ASL A ASL A ASL A ASL A ASL A STA $02 LDA $FB SEC SBC $02 STA $FB LDA $FC SBC #$00 SBC YPIB PHA LDA YPIB LSR A LSR A STA $02 PLA SEC SBC $02 STA $FC LDA YPIXEL AND #$07 STA YPIB LDA $FB SEC SBC YPIB PHA LDA XPIXEL AND #$F8 STA YPIB PLA CLC ADC YPIB STA $FB LDA $FC SBC #$00 STA $FC LDA XPIXEL AND #$07 TAX LDA #$80 GBITLP CPX #$00 BEQ PPCONT LSR A DEX JMP GBITLP PPCONT STA $FD RTS PLOTON JSR PLOTPC LDY #$00 LDA ($FB),Y ORA $FD STA ($FB),Y RTS PLOTOFF JSR PLOTPC LDA $FD EOR #$FF STA $FD LDY #$00 LDA ($FB),Y AND $FD STA ($FB),Y RTS PLOT LDA COLOUR AND #$02 BNE PPAON JSR PLOTOFF JMP PPACNT PPAON JSR PLOTON PPACNT INC XPIXEL LDA COLOUR AND #$01 BNE PPBON JSR PLOTOFF JMP PPBCNT PPBON JSR PLOTON PPBCNT DEC XPIXEL RTS PLOTRECT LDA COLOUR AND #$03 STA COLOUR LDA BITSTEP CMP #$07 BCC ONESQ JSR PLOTPC LDA $FB SEC SBC #$08 STA $FB LDA $FC SBC #$00 STA $FC LDA BITSTEP LSR A LSR A LSR A STA XPSTRE LDX COLOUR LDA COLBIT,X PRLOPB LDY BITSTEP PRLOP STA ($FB),Y DEY BNE PRLOP PHA LDA $FB SEC SBC #$40 STA $FB LDA $FC SBC #$01 STA $FC CMP #$20 BCC ENDRECT PLA DEC XPSTRE BNE PRLOPB RECTEND RTS ENDRECT PLA RTS COLBIT .BYTE %00000000 .BYTE %01010101 .BYTE %10101010 .BYTE %11111111 ONESQ JSR PLOTPC LDA $FD LSR A STA $FD ASL A CLC ADC $FD EOR #$FF STA YPMAX LDY COLOUR LDA #$00 ROLRECT CPY #$00 BEQ RECTREND CLC ADC $FD DEY JMP ROLRECT RECTREND STA XPMAX LDA BITSTEP LSR A BNE NOTLR LDA #$01 NOTLR STA XPSTRE LDA $FB SEC SBC BITSTEP STA $FB LDA $FC SBC #$00 STA $FC XRREL LDY BITSTEP RECTPUT LDA ($FB),Y AND YPMAX ORA XPMAX STA ($FB),Y DEY BNE RECTPUT DEC XPSTRE BEQ RECTEND LDA YPMAX SEC ROR A ROR A STA YPMAX LDA XPMAX LSR A LSR A STA XPMAX JMP XRREL ; *= $0820 ; ; зоом цалцулатион роутинес NOZOOM JMP CONTROLOP ZOOMIN LDA $D015 AND #$F0 CMP #$F0 BNE NOZOOM LDA #$1E STA $4100 LDA #$01 STA $4101 LDA #$10 STA $4102 JSR SUBTRACT LDA #$01 STA $4100 INC $4102 JSR EQUAL LDA #$10 STA $4100 LDA #$1B STA $4101 LDA #$12 STA $4102 JSR MULTIPLY LDA #$11 STA $4100 STA $4102 LDA #$12 STA $4101 LDA $D008 SEC SBC #$58 CALCINLOPA CMP #$00 BEQ CALCENDIA PHA JSR ADDITION PLA TAX DEX TXA JMP CALCINLOPA CALCENDIA LDA #$01 STA $4100 LDA #$13 STA $4102 JSR EQUAL LDA #$13 STA $4100 STA $4102 LDA #$12 STA $4101 LDA $D00A SEC SBC #$40 CALCINLOPB CMP #$00 BEQ CALCENDIB PHA JSR ADDITION PLA TAX DEX TXA JMP CALCINLOPB CALCENDIB LDA #$11 STA $4100 LDA #$01 STA $4102 JSR EQUAL LDA #$13 STA $4100 LDA #$1E STA $4102 JSR EQUAL LDA #$1F STA $4100 LDA #$03 STA $4101 LDA #$10 STA $4102 JSR SUBTRACT LDA #$03 STA $4100 INC $4102 JSR EQUAL LDA #$10 STA $4100 LDA #$12 STA $4102 LDA #$1A STA $4101 JSR MULTIPLY LDA #$11 STA $4100 STA $4102 LDA #$12 STA $4101 LDA #$E5 SEC SBC $D00D CALCINYA CMP #$00 BEQ CALCENDIC PHA JSR ADDITION PLA TAX DEX TXA JMP CALCINYA CALCENDIC LDA #$03 STA $4100 LDA #$13 STA $4102 JSR EQUAL LDA #$13 STA $4100 STA $4102 LDA #$12 STA $4101 LDA #$FA SEC SBC $D009 CALCINYB CMP #$00 BEQ CALCENDID PHA JSR ADDITION PLA TAX DEX TXA JMP CALCINYB CALCENDID LDA #$11 STA $4100 LDA #$03 STA $4102 JSR EQUAL LDA #$13 STA $4100 LDA #$1F STA $4102 JSR EQUAL CALCSTEP LDA #$1E STA $4100 LDA #$01 STA $4101 LDA #$10 STA $4102 JSR SUBTRACT LDA #$10 STA $4100 LDA #$17 STA $4101 LDA #$02 STA $4102 JSR MULTIPLY LDA #$1F STA $4100 LDA #$03 STA $4101 LDA #$10 STA $4102 JSR SUBTRACT LDA #$10 STA $4100 LDA #$1A STA $4101 LDA #$04 STA $4102 JSR MULTIPLY LDA #$00 STA FRACNEW JSR MANDLE JMP CONTROLOP ; фрацтал селецтор MANDEL LDA FRACTYPE BNE JULP JMP MANDPIX JULP JMP JULIPIX NOSW JMP CONTROLOP SWITCH LDA $D015 AND #$F0 CMP #$F0 BNE NOSW LDA #$00 STA FRACNEW LDA FRACTYPE EOR #$01 STA FRACTYPE BNE JULIASW LDA #$20 STA $FC LDA #$60 STA $FE LDY #$00 STY $FB STY $FD SWILOP LDA ($FD),Y STA ($FB),Y INY BNE SWILOP INC $FC INC $FE LDA $FC CMP #$41 BNE SWILOP JMP CONTROLOP JULIASW LDA #$20 STA $FC LDA #$60 STA $FE LDY #$00 STY $FB STY $FD JSWLOP LDA ($FB),Y STA ($FD),Y INY BNE JSWLOP INC $FC INC $FE LDA $FC CMP #$41 BNE JSWLOP INC FRACTYPE JSR ZOOMIN DEC FRACTYPE LDA #$01 STA $4100 LDA #$09 STA $4102 JSR EQUAL LDA #$03 STA $4100 INC $4102 JSR EQUAL LDA #$1C STA $4100 LDA #$1E STA $4102 JSR EQUAL INC $4102 JSR EQUAL LDA #$0B STA $4100 LDA #$01 STA $4102 JSR EQUAL LDA #$03 STA $4102 JSR EQUAL JMP CALCSTEP ; боь роутинес BOX LDA XP STA XPIB LDA YP STA YPIB LDA XPB STA XPBIB LDX #$3C STX $07FC INX STX $07FD INX STX $07FE INX STX $07FF LDA $D015 ORA #$F0 STA $D015 BOXWAIT LDA CLICK BNE BOXWAIT BOXLOOP LDA XPBIB CMP XPB BEQ CHECKFINE BCS LESSTHAN JMP MORETHAN CHECKFINE LDA XPIB CMP XP BCS LESSTHAN MORETHAN LDA XPIB STA $D008 STA $D00C LDX #$00 LDA XPBIB BEQ NOXPBADD LDX #$50 NOXPBADD LDA $D010 AND #$AF STX $02 CLC ADC $02 STA $D010 LDX #$00 LDA XP SEC SBC #$18 STA $D00A STA $D00E BCC MTSUB LDX XPB BEQ MTSUB LDX #$A0 MTSUB LDA $D010 AND #$5F STX $02 CLC ADC $02 STA $D010 JMP BOXCONT LESSTHAN LDA XP LDX XPB BNE NOTOUT CMP #$58 BCS NOTOUT LDA #$58 NOTOUT STA $D008 STA $D00C CPX #$00 BEQ LTNOADD LDX #$50 LTNOADD LDA $D010 AND #$AF STX $02 CLC ADC $02 STA $D010 LDX #$00 LDA XPIB SEC SBC #$18 STA $D00A STA $D00E BCC LTSUB LDX XPBIB BEQ LTSUB LDX #$A0 LTSUB LDA $D010 AND #$5F STX $02 CLC ADC $02 STA $D010 BOXCONT LDA YP CMP YPIB BCC LESSY LDA YPIB STA $D009 STA $D00B LDA YP SEC SBC #$15 STA $D00D STA $D00F JMP BOXCONTII LESSY LDA YP STA $D009 STA $D00B LDA YPIB SEC SBC #$15 STA $D00D STA $D00F BOXCONTII LDA CLICK BNE BOXEND JMP BOXLOOP BOXEND JMP CONTROLOP BOXFLASH LDA $A2 AND #$3C LSR A LSR A TAX LDA BOXCOLS,X STA $D02B STA $D02C STA $D02D STA $D02E JMP $EA31 BOXCOLS .BYTE 0,9,2,8,10,7,13,1 .BYTE 1,13,3,5,14,4,6,0 ; ; йулиа сет плоттер JULIPIX LDA #$05 STA $4100 LDA #$07 STA $4102 JSR EQUAL INC $4100 INC $4102 JSR EQUAL LDA #$00 STA COLOUR JLOOP LDA #$07 STA $4100 STA $4101 LDA #$10 STA $4102 JSR MULTIPLY LDA #$08 STA $4100 STA $4101 LDA #$11 STA $4102 JSR MULTIPLY LDX #$10 STX $4100 INX STX $4101 INX STX $4102 JSR ADDITION LDA $4091 CMP #$04 BCC JFAIL CMP #$50 BCS JFAIL JSUCPASS JMP JSUCCESS JFAIL INC COLOUR LDA COLOUR CMP MAXCOL BEQ JSUCPASS JSR SUBTRACT LDA #$12 STA $4100 LDA #$09 STA $4101 LDA #$13 STA $4102 JSR ADDITION LDA #$07 STA $4100 LDA #$08 STA $4101 INC $4102 JSR MULTIPLY LDA #$14 STA $4100 STA $4101 LDA #$15 STA $4102 JSR ADDITION LDA #$15 STA $4100 LDA #$0A STA $4101 LDA #$16 STA $4102 JSR ADDITION LDA #$13 STA $4100 LDA #$07 STA $4102 JSR EQUAL LDA #$16 STA $4100 LDA #$08 STA $4102 JSR EQUAL JMP JLOOP JSUCCESS RTS ; маке мултиплицатион табле MKETABLE SEI LDA #COUNTDOWN STA $0315 LDA #1 STA TICK LDA #$20 STA SECONDS CLI LDA #$81 STA $FC LDY #$00 STY $FB LDX #$00 MTLOP TYA PHA JSR MULTXY LDY #$00 LDA $FD STA ($FB),Y INY LDA $FE STA ($FB),Y LDA $FB CLC ADC #$02 STA $FB LDA $FC ADC #$00 STA $FC PLA TAY INY CPY #$64 BNE MTLOP LDY #$00 SED TXA CLC ADC #$01 TAX CLD CPX #$00 BNE MTLOP LDA #$81 STA $FC LDX #$00 STX $FB STX $FD STX $FE OHLOP LDA $FB STA $5E00,X LDA $FC STA $5E01,X LDA $FD STA $5F00,X LDA $FE STA $5F01,X INX INX LDA $FB CLC ADC #$C8 STA $FB LDA $FC ADC #$00 STA $FC LDA $FD CLC ADC #$64 STA $FD LDA $FE ADC #$00 STA $FE CPX #$CA BNE OHLOP SEI LDA #$31 STA $0314 LDA #$EA STA $0315 CLI RTS MULTXY LDA #$00 STA $FD STA $FE CPX #$00 BEQ MULTFIN CPY #$00 BEQ MULTFIN STX $22 XYLOOP SED LDA $FD CLC ADC $22 STA $FD LDA $FE ADC #$00 STA $FE CLD DEY BNE XYLOOP MULTFIN RTS COUNTDOWN DEC TICK BEQ DOWNSEC JMP $EA31 DOWNSEC SED LDA SECONDS SEC SBC #1 STA SECONDS CLD LDA #50 STA TICK LDA SECONDS LSR A LSR A LSR A LSR A CLC ADC #48 STA $0454 LDA SECONDS AND #$0F CLC ADC #48 STA $0455 JMP $EA81 ; басиц *= $0800 ; .BYTE $00,$12,$08,$0A,$00,$8F .TEXT " MANDELPLOT" .BYTE $00,$1D,$08,$14,$00,$9E .TEXT " 4096" .BYTE $00,$00,$00