- ’DRAW EDITOR
- ’(C)SmileBoom Co.Ltd
- ’
- ’・テキストカ-ソルノヘンスウメイカフ゛リカイヒ
- ’
- CLEAR:ACLS:SPPAGE 1
- BGPAGE 1:BGCLR
- VISIBLE 1,1,1,1,1,1
- RECMAX=8000:HSIZE=256
- TXMAX=4:TXLEN=32
- _CMD=0:_TXY=1:_EXY=2:_MAX=3
- DIM B(RECMAX,_MAX)
- DIM TX$(TXMAX)
- FOR I=0 TO TXMAX-1
- TX$(I)=” ”*TXLEN
- NEXT
- ’---
- DATA ”LINE ”
- DATA ”CIRCLE”
- DATA ”BOX ”
- DATA ”PAINT ”
- DATA ”PSET ”
- DATA ”CLEAR ”
- DATA ”FILL ”
- CMDMAX=7
- DIM C$(CMDMAX)
- FOR I=0 TO CMDMAX-1
- READ C$(I)
- NEXT
- ’---
- N$=”SPS0”
- C$=”0”*8:Z$=C$*8
- B$=”F0000000”+C$*7
- CHRSET N$,0,B$
- CHRSET N$,1,Z$
- CHRSET N$,2,Z$
- CHRSET N$,3,Z$
- A$=”FFF00000”
- A$=A$+”F0F00000”+A$+C$*5
- CHRSET N$,4,A$
- CHRSET N$,5,Z$
- CHRSET N$,6,Z$
- CHRSET N$,7,Z$
- A$=”F0000000”+C$*7
- CHRSET ”BGU0”,1,A$
- A$=”E0E0E0E00E0E0E0E”*4
- CHRSET ”BGU0”,2,A$
- ’---
- SPMAX=88
- FOR I=0 TO SPMAX-1
- SPSET I,0,0,0,0,0
- SPOFS I,-16,-16
- NEXT
- ’---
- PNLTYPE”OFF”
- ICONPUSE=FALSE
- ICONCLR:ICONPMAX=3
- ’---
- FOR I=0 TO 3
- BREPEAT I,20,4
- NEXT
- BREPEAT 7,20,2:’Y BUTTON
- ’---
- OLDCMD=-1:CMD=4
- DR=0:GR=1:TM=FALSE
- REC=0:COL=15:QT=0:WM=16
- MX=0:MY=0:MW=8:MB=-1:MC=0
- GOSUB @INIT
- ’========
- ’ main
- ’========
- @MAIN
- OS=TS:TS=TCHST
- OB=BT:BT=BTRIG():BN=BUTTON()
- IF TM==FALSE THEN @MSKIP
- K$=INKEY$()
- GOSUB @TEXTSUB
- GOTO @MNEXT
- ’---
- @MSKIP
- GOSUB @BUTCTRL
- IF QT THEN @QUIT
- GOSUB @TOUCH
- ’---
- @MNEXT
- GOSUB @PUTCOL
- VSYNC 1
- GOTO @MAIN
- ’---
- @QUIT
- GPAGE 1:GCLS 0:
- GPAGE 0:GCLS 0
- CLS
- PRINT”オツカレサマ!”
- END
- ’==============
- ’ initialize
- ’==============
- @INIT
- CLS
- PRINT”DRAW EDITOR V1.1”
- PRINT”─”*32;
- COLOR 7
- FOR I=0 TO CMDMAX-1
- PRINT ” ”+C$(I)
- NEXT
- ’---
- LOCATE 0,11
- PRINT”А:file К:grid”
- PRINT”Х:delete”
- PRINT
- PRINT”START:setting”
- PRINT” wait( )”
- PRINT” bgm( )”
- ’---
- LOCATE 18,0
- PRINT”REC: C:”
- ’---
- WX=0:WY=20
- LOCATE 0,WY-2:PRINT”Б:text”
- COLOR 0:PRINT ”─”*32;
- GFILL 0,(WY*8)-4,255,(WY+TXMAX)*8-1,255
- BGFILL 0,WX,WY,WX+31,WY+TXMAX-1,&H0002
- GOSUB @PUTST
- GOSUB @PUTREC
- ’---
- GPAGE 0:CX=15:CY=2
- LOCATE CX-1,CY-1
- PRINT”┬”+”─”*16+”┬”;
- FOR Y=0 TO 15
- LOCATE CX-1,CY+Y
- PRINT”│”+” ”*16+”│”;
- FOR X=0 TO 15
- TX=CX*8+X*8:TY=CY*8+Y*8
- C=Y*16+X
- GFILL TX,TY,TX+7,TY+7,C
- NEXT
- NEXT
- LOCATE CX-1,CY+16
- PRINT”└”+”─”*16+”┘”;
- GPAGE 1
- GOSUB @PUTCOL0
- GOSUB @PUTGRID
- RETURN
- ’---
- @PUTGRID
- SC=&H0:IF GR THEN SC=&HE001
- BGFILL 1,0,0,31,23,SC
- RETURN
- ’================
- ’ button control
- ’================
- @BUTCTRL
- D=BT AND 15
- IF D THEN @BUTDIR
- IF BT==128 THEN @BUTY
- IF OB THEN RETURN
- IF BT==32 THEN @BUTB
- IF BT==64 THEN @BUTX
- IF BT==16 THEN @BUTA
- IF BT==512 THEN @BUTR
- IF BT==1024 THEN @BSTART
- RETURN
- ’---
- @BSTART
- VISIBLE 1,1,0,0,0,0:CLS
- INPUT”BGM(0-,-1=OFF)=”;MB
- INPUT”WAIT(0-)=”;MW
- BGMPLAY MB
- VISIBLE 1,1,1,1,1,1
- GOSUB @INIT
- RETURN
- ’---Б:text
- @BUTB
- TM=TRUE:TW=0:PNLTYPE”KYA”
- BGPAGE 0:DR=0
- RETURN
- ’---А:file menu
- @BUTA
- GOSUB @FILE
- GPAGE 0:GCLS 0:GPAGE 1
- GOSUB @INIT
- GOSUB @CLRCOL
- GOSUB @PUTREC
- GOSUB @REPLAY
- RETURN
- ’---К:grid
- @BUTR
- GR=GR XOR 1:DR=0
- GOSUB @PUTGRID
- RETURN
- ’---Х:delete
- @BUTY
- IF REC==0 THEN RETURN
- REC=REC-1:DR=0
- GOSUB @CLRCOL
- GOSUB @PUTREC
- GOSUB @REPLAY
- GOSUB @PUTST
- OLDCMD=-1
- RETURN
- ’---
- @GETVEC
- VX=0:VY=0
- IF D AND 1 THEN VY=-1
- IF D AND 2 THEN VY=1
- IF D AND 4 THEN VX=-1
- IF D AND 8 THEN VX=1
- RETURN
- ’---
- @BUTDIR
- GOSUB @GETVEC
- IF VX+VY==0 THEN @PUTCOL
- ’---
- @MOVCOL
- GOSUB @CLRCOL
- COL=COL+(VY*16)+VX
- COL=COL AND 255
- ’---
- @PUTCOL0
- LOCATE 29,0
- PRINT RIGHT$(” ”+STR$(COL),3);
- ’---
- @PUTCOL
- LOCATE CX+COL%16,CY+COL/16
- CC=RND(15)
- COLOR CC:PRINT”□”:COLOR 15
- RETURN
- ’---
- @CLRCOL
- LOCATE CX+COL%16,CY+COL/16
- PRINT” ”
- RETURN
- ’---Ф:command select
- @BUTX
- LOCATE 0,2+CMD:PRINT” ”
- VY=1:IF BN AND 256 THEN VY=-1
- CMD=CMD+VY
- IF CMD<0 THEN CMD=CMDMAX-1
- CMD=CMD%CMDMAX
- DR=0:GOSUB @PUTST
- RETURN
- ’=============
- ’ check touch
- ’=============
- @TOUCH
- ON DR GOTO @L0,@L1,@L2
- RETURN
- ’---
- @L0
- IF TS==FALSE THEN RETURN
- TX=TCHX:TY=TCHY
- IF CMD==3 THEN @L0P
- IF CMD==5 THEN @L0CLS
- EX=TX:EY=TY:DR=1
- RETURN
- ’---
- @L0P
- N=GSPOIT(TX,TY)
- IF N==COL THEN RETURN
- GPAINT TX,TY,COL
- GOTO @LREC
- ’---
- @L0CLS
- IF OLDCMD==CMD THEN RETURN
- GCLS COL
- GOTO @LREC
- ’---
- @L1
- X=TX:Y=TY
- EX=TCHX:EY=TCHY
- GOSUB @GUIDE
- IF TS==0 THEN @L1SUB
- IF CMD==4 THEN @L1PS
- RETURN
- ’---
- @L1SUB
- ON CMD GOTO @L1L,@L1C,@L1B
- IF CMD!=6 THEN RETURN
- ’---
- GFILL TX,TY,EX,EY,COL
- GOTO @LREC
- ’---
- @L1B
- GBOX TX,TY,EX,EY,COL
- ’---
- @LREC
- GOSUB @CMDREC:DR=0
- RETURN
- ’---
- @L1C
- EX=R:GCIRCLE TX,TY,EX,COL
- GOTO @LREC
- ’---
- @L1L
- GLINE TX,TY,EX,EY,COL
- GOSUB @CMDREC
- TX=EX:TY=EY:DR=2
- RETURN
- ’---
- @L1PS
- GOSUB @L1L:DR=1
- RETURN
- ’---
- @L2
- IF TS==FALSE THEN RETURN
- TX=EX:TY=EY:DR=1
- RETURN
- ’========
- ’ record
- ’========
- @CMDREC
- OLDCMD=CMD
- IF REC>=RECMAX THEN RETURN
- B(REC,_CMD)=CMD+(COL*256)
- B(REC,_TXY)=TX*256+TY
- B(REC,_EXY)=EX*256+EY
- REC=REC+1
- ’---
- @PUTREC
- LOCATE 22,0:R=RECMAX-REC
- PRINT RIGHT$(” ”+STR$(R),4);
- RETURN
- ’---
- @PUTN
- PRINT RIGHT$(” ”+STR$(N),3);
- RETURN
- ’============
- ’ text write
- ’============
- @TEXTSUB
- IF OB THEN @TXTOP
- IF BT!=32 THEN @TXTOP
- ’---Б:exit text
- PNLTYPE”OFF”
- BGPUT 0,MX+WX,MY+WY,1,0,0,0
- BGPAGE 1:TM=FALSE
- RETURN
- ’---
- @TXTOP
- GOSUB @TXIN
- GOSUB @TXCSR
- N=13:IF TW>=8 THEN N=0
- BGPUT 0,MX+WX,MY+WY,N,0,0,0
- TW=TW+1
- IF TW==16 THEN TW=0
- RETURN
- ’---
- @TXCSR
- D=BT:GOSUB @GETVEC
- IF VX+VY!=0 THEN @TXMOV
- RETURN
- ’---
- @BS
- VX=-1:VY=0:K$=” ”
- GOTO @TXIN2
- ’---
- @ENTER
- BGPUT 0,MX+WX,MY+WY,1,0,0,0
- MX=0:VY=1:GOTO @TXMOV
- ’---
- @TXIN
- IF KEYBOARD==15 THEN @BS
- IF KEYBOARD==60 THEN @ENTER
- IF K$==”” THEN RETURN
- VX=1:VY=0
- ’---
- @TXIN2
- TX$(MY)=SUBST$(TX$(MY),MX,1,K$)
- GOSUB @PUTST
- ’---
- @TXMOV
- BGPUT 0,MX+WX,MY+WY,1,0,0,0
- MX=MX+VX:M=TXLEN-1
- IF MX<0 THEN MX=M:VY=VY-1
- IF MX>M THEN MX=0:VY=VY+1
- MY=MY+VY
- IF MY>TXMAX-1 THEN MY=0
- IF MY<0 THEN MY=TXMAX-1
- W=0
- RETURN
- ’============
- ’ put status
- ’============
- @PUTST
- LOCATE 0,2+CMD:PRINT”Ф”
- ’---
- FOR I=0 TO TXMAX-1
- LOCATE WX,WY+I
- PRINT TX$(I);
- PNLSTR WX,WY+I,TX$(I)
- NEXT
- ’---
- LOCATE 6,15:N=MW:GOSUB @PUTN
- LOCATE 6,16:N=MB:GOSUB @PUTN
- RETURN
- ’============
- ’ guide line
- ’============
- @GUIDE
- ON CMD GOTO @SPL,@SPC,@SPB
- IF CMD==6 THEN @SPB
- RETURN
- ’=============
- ’ sprite line
- ’=============
- @SPL
- N=0:M=20:C=RND(16)
- GOSUB @SPLSUB
- GOTO @SPOFF
- ’---
- @SPLSUB
- VX=EX-X:SX=SGN(VX):AX=ABS(VX)
- VY=EY-Y:SY=SGN(VY):AY=ABS(VY)
- J=W:W=W+1:SMX=N+M
- IF AX>AY THEN @XLINE
- ’---
- IF AY==0 THEN RETURN
- VX=VX/AY
- FOR I=Y TO EY STEP SY
- IF (J % WM) THEN @SKIPX
- IF N>=SMX THEN @SKIPX
- SPOFS N,X,I
- SPCHR N,0,C,0,0,0
- N=N+1
- @SKIPX
- X=X+VX:J=J+1
- NEXT
- GOTO @ELINE
- ’---
- @XLINE
- IF AX==0 THEN RETURN
- VY=VY/AX
- FOR I=X TO EX STEP SX
- IF (J % WM) THEN @SKIPY
- IF N>=MX THEN @SKIPY
- SPOFS N,I,Y:SPCHR N,0
- SPCHR N,0,C,0,0,0
- N=N+1
- @SKIPY
- Y=Y+VY:J=J+1
- NEXT
- ’---
- @ELINE
- SPOFS N,EX-1,EY-1
- SPCHR N,1,C,0,0,0
- N=N+1
- RETURN
- ’===============
- ’ sprite circle
- ’===============
- @SPC
- VX=ABS(EX-X)
- VY=ABS(EY-Y)
- R=SQR(VX*VX+VY*VY)
- M=20:ST=360/M
- J=W/ST:W=W+WM
- C=RND(16)
- FOR N=0 TO M-1
- A=RAD(J%360):J=J+ST
- OX=X+COS(A)*R
- OY=Y+SIN(A)*R
- SPOFS N,OX,OY
- SPCHR N,0,C,0,0,0
- NEXT
- SPOFS M,X-1,Y-1
- SPCHR M,1,C,0,0,0
- RETURN
- ’============
- ’ sprite box
- ’============
- @SPB
- TMPX=EX:TMPY=EY
- N=0:M=20:C=RND(16)
- X=TX:Y=TY:EY=Y
- GOSUB @SPLSUB
- X=EX:Y=TY:EY=TMPY
- GOSUB @SPLSUB
- X=EX:Y=EY:EX=TX
- GOSUB @SPLSUB
- X=TX:Y=EY:EX=X:EY=TY
- GOSUB @SPLSUB
- EX=TMPX:EY=TMPY
- ’---
- @SPOFF
- FOR I=N TO SPMAX-1
- SPOFS I,-16,-16
- NEXT
- RETURN
- ’===========
- ’ file menu
- ’===========
- @FILE
- CLS:GPAGE 0:GCLS 0
- GP=1:GPAGE GP
- GF$=”GRP”+STR$(GP)+”:”
- PRINT”FILE MENU”
- PRINT”=”*32;
- PRINT” L:キロクノヨミコミ”
- PRINT” S:キロクノカキコミ”
- PRINT”SG:カ゛ソ゛ウノカキコミ”
- PRINT” X:カ゛メンショウキョ”
- PRINT” Q:メニュ-ヲヌケル”
- PRINT” E:ツ-ルシュウリョウ”
- PRINT”=”*32;
- INPUT”ト゛ウスル”;K$
- IF K$==”S” THEN @SVREC
- IF K$==”L” THEN @LDREC
- IF K$==”SG” THEN @SVGRP
- IF K$==”E” THEN QT=1
- IF K$==”X” THEN @XCLS
- RETURN
- ’==========================
- @XCLS
- INPUT”ショウキヨシマスカ”;K$
- IF K$!=”Y” THEN @FILE
- REC=0
- RETURN
- ’==========================
- @GLNUM
- TOTAL=TOTAL+1
- IF Y>191 THEN @LDERR
- N=GSPOIT(X,Y)
- X=X+1:IF X<256 THEN RETURN
- X=0:Y=Y+1
- RETURN
- ’---
- @GLCHR
- GOSUB @GLNUM
- N$=CHR$(N):RETURN
- ’---
- @GLWORD
- GOSUB @GLNUM:W=N*256
- GOSUB @GLNUM:W=W+N
- RETURN
- ’---
- @LDERR
- PRINT”コノファィルハ、ツカエマセン”
- @LDLOOP
- IF INKEY$()==”” THEN @LDLOOP
- RETURN
- ’==========================
- @LDREC
- GPAGE 1:X=0:Y=0:TOTAL=0
- INPUT”ヨミコムファィルメイ”;K$
- LOAD GF$+K$
- IF RESULT!=TRUE THEN RETURN
- ’--- header
- GOSUB @GLCHR:C$=N$
- GOSUB @GLCHR:C$=C$+N$
- GOSUB @GLCHR:C$=C$+N$
- GOSUB @GLCHR:C$=C$+N$
- IF C$!=”DE1:” THEN @LDERR
- ’---
- GOSUB @GLWORD:H=W
- GOSUB @GLWORD:REC=W
- GOSUB @GLWORD:MW=W
- GOSUB @GLWORD:MB=W-1
- GOSUB @GLWORD
- GOSUB @GLWORD
- ’--- text
- FOR IX=0 TO TXMAX-1
- TX$(IX)=””
- FOR J=0 TO TXLEN-1
- GOSUB @GLCHR
- TX$(IX)=TX$(IX)+N$
- NEXT
- NEXT
- ’--- skip
- FOR I=0 TO (HSIZE-TOTAL)-1
- GOSUB @GLNUM
- NEXT
- ’--- command
- FOR I=0 TO REC-1
- GOSUB @GLWORD:B(I,_CMD)=W
- GOSUB @GLWORD:B(I,_TXY)=W
- GOSUB @GLWORD:B(I,_EXY)=W
- LOCATE 0,23
- PRINT I;”/”;REC;
- NEXT
- RETURN
- ’==========================
- @GSNUM
- TOTAL=TOTAL+1
- IF Y>191 THEN RETURN
- GPSET X,Y,N
- X=X+1:IF X<256 THEN RETURN
- X=0:Y=Y+1
- RETURN
- ’---
- @GSWORD
- N=(W/256) AND 255
- GOSUB @GSNUM
- N=W AND 255
- GOSUB @GSNUM
- RETURN
- ’==========================
- @SVREC
- GPAGE 1:X=0:Y=0:TOTAL=0
- ’--- header
- N=ASC(”D”):GOSUB @GSNUM
- N=ASC(”E”):GOSUB @GSNUM
- N=ASC(”1”):GOSUB @GSNUM
- N=ASC(”:”):GOSUB @GSNUM
- ’--- length
- W=HSIZE:GOSUB @GSWORD
- W=REC:GOSUB @GSWORD
- W=MW:GOSUB @GSWORD
- W=MB+1:GOSUB @GSWORD
- W=0:GOSUB @GSWORD
- W=0:GOSUB @GSWORD
- ’--- text
- FOR IX=0 TO TXMAX-1
- C$=TX$(IX)
- FOR J=0 TO TXLEN-1
- N=ASC(MID$(C$,J,1))
- GOSUB @GSNUM
- NEXT
- NEXT
- ’--- skip
- FOR I=0 TO (HSIZE-TOTAL)-1
- N=0:GOSUB @GSNUM
- NEXT
- ’--- command
- LY=CSRY
- FOR I=0 TO REC-1
- W=B(I,_CMD):GOSUB @GSWORD
- W=B(I,_TXY):GOSUB @GSWORD
- W=B(I,_EXY):GOSUB @GSWORD
- NEXT
- ’---
- INPUT”ホソ゛ンスルファィルメイ”;K$
- SAVE GF$+K$
- RETURN
- ’==========================
- @SVGRP
- GPAGE 1
- INPUT”カ゛ソ゛ウトシテホソ゛ンスルファィルメイ”;K$
- SAVE GF$+K$
- RETURN
- ’==========================
- @REPLAY
- GCLS 0
- FOR IX=0 TO REC-1
- O=_TXY:GOSUB @GETCMD
- TX=X:TY=Y
- O=_EXY:GOSUB @GETCMD
- EX=X:EY=Y
- O=_CMD:GOSUB @GETCMD
- GOSUB @CMDSUB
- NEXT
- RETURN
- ’---
- @GETCMD
- X=B(IX,O):Y=X AND &HFF
- X=(X AND &HFF00)/256
- RETURN
- ’---
- @CMDSUB
- ON Y GOTO @RL,@RC,@RB,@RP,@RL,@RX
- ’---
- GFILL TX,TY,EX,EY,X:RETURN
- ’---
- @RX
- GCLS X:RETURN
- ’---
- @RL
- GLINE TX,TY,EX,EY,X:RETURN
- ’---
- @RC
- GCIRCLE TX,TY,EX,X:RETURN
- ’---
- @RB
- GBOX TX,TY,EX,EY,X:RETURN
- ’---
- @RP
- GPAINT TX,TY,X:RETURN