Autor
| Free your creativity - IOMBCC
| AuroraMSX
 msx master Mensajes: 1217 | Publicado: Abril 01 2005, 10:55   | Quote:
| Nice mandelbrot but indeed damn slow... I've seen faster on a MSX...
|
This is BASIC, man. Of course it's dead slow!  | | ricbit msx lover Mensajes: 116 | Publicado: Abril 01 2005, 18:28   |
1 DEFINTA-G:DEFSTRH:DEFSNGI-Z:DIM A[8],AX[8],BX[8],AY[8],BY[8]:COLOR15,0,0:SCREEN7:FORA=1TO15:READB,C,D:COLOR=(A,B,C,D):NEXT:AW=512:AH=212:KX=-1.5:KY=-.8:LX=1.25:LY=.8:FORF2=0TO1STEP0:AX[0]=0:AY[0]=0:BX[0]=AW:BY[0]=AH:F=0:G=0:CLS:GOSUB4:'A
TO1STEP-1:Z=ZX:ZX=Z*Z-ZY*ZY+P:ZY=2*Z*ZY+Q:IF(ZX*ZX+ZY*ZY)<25THENNEXT:RETURNELSERETURN
I *really* didn't know that BASIC arrays could used with [] instead of () !!! Amazing. | | Vampier msx addict Mensajes: 492 | Publicado: Abril 01 2005, 19:29   | ricbit you don't even have to give a size to the array as far as I know.
| | Arjan msx addict Mensajes: 448 | Publicado: Abril 01 2005, 21:37   | I just discovered a little bug in my brainfuck interpreter, which caused some programs to be read incorrectly. The first version also entered in an endless loop after executing all source code. I removed those 3 extra pokes from line 1, and added an termination clause to line 2, so when a BF program ends, the interpreter stops as well. Here's the 2nd version:
1 IFGTHENPRINTCHR$(VAND(-255*(C=46)));:RESUMENEXTELSEDEFINTA-Z:ONERRORGOTO1:G=&H
9000:FORD=GTO&H9100:POKED,0:NEXT:INPUT"File:";H$:OPENH$FORINPUTAS1:Q=&HA000:P=Q-
1:FORA=0TO1:POKEQ,ASC(INPUT$(1,1)):Q=Q+1:A=-EOF(1):NEXT:CLOSE:PRINT"Running..."
2 P=P+1:IFP=QTHENENDELSEC=PEEK(P):G=G+(C=60)-(C=62):V=PEEK(G):POKEG,V+(C=45)-(C=
43):POKEG,ASC(INPUT$(-(C=44))):IFC=91ANDV=0ORC=93ANDVTHENL=1:I=92-C:FORA=0TO1:P=
P+I:C=PEEK(P):L=L-(C=91)*I+(C=93)*I:A=-(L=0):NEXT:GOTO2ELSEGOTO2
Here's another sample program (which runs correctly now  ):
>++++++++++>>+<+[[+++++[>++++++++<-]>.<++++++[>--------<-]+<<]>.>[->[<++>-]<[>+<
-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>[-]>[-]++<<-[>+<-]]]]]]]]]]]+>>]<<]
This program (not made by me) calculates and displays powers of two. | | Arjan msx addict Mensajes: 448 | Publicado: Abril 01 2005, 22:20   | Quote:
| Thanx Arjan for taking one thing out of my TODO list. It is already big enough 
|
You're welcome
btw, could everybody please format their programs nicely (ie, 80 characters per line) so that they won't mess up the forum layout? | | wolf_
 msx legend Mensajes: 4564 | Publicado: Abril 01 2005, 22:50   | This forum needs a codebox!
Which is a limited-sized frame with a vertical and horizontal scrollbar with text of any dimensions inside
| | Arjan msx addict Mensajes: 448 | Publicado: Abril 02 2005, 00:01   | hmm, for some reason I just *have* to toy around with these little programs... I keep thinking what I coded is the best that can be done in 2 lines of basic code, but then I find another cool thing that can be implemented without crossing my 2-line limit
So, another update. This time the program shows the PC and the current instruction. The "Running..." message had to be removed for this, but it's nicer this way since you can see the program is actually running
1 IFGTHENKEY1,HEX$(P)+K$:PRINTCHR$(VAND(-255*(C=46)));:RESUMENEXTELSEDEFINTA-Z:O
NERRORGOTO1:G=&H9000:FORD=GTO&H9100:POKED,0:NEXT:INPUT"File:";H$:OPENH$FORINPUTA
S1:Q=&HA000:P=Q-1:FORA=0TO1:POKEQ,ASC(INPUT$(1,1)):Q=Q+1:A=-EOF(1):NEXT:CLOSE
2 P=P+1:IFP=QTHENENDELSEC=PEEK(P):K$=":"+CHR$(C):G=G+(C=60)-(C=62):V=PEEK(G):POK
EG,V+(C=45)-(C=43):POKEG,ASC(INPUT$(-(C=44))):IFC=91ANDV=0ORC=93ANDVTHENL=1:I=92
-C:FORA=0TO1:P=P+I:C=PEEK(P):L=L-(C=91)*I+(C=93)*I:A=-(L=0):NEXT:GOTO2ELSEGOTO2
| | Arjan msx addict Mensajes: 448 | Publicado: Abril 02 2005, 01:52   | some work-in-progress stuff:
1 'Bomberman Battle IOMBCC
2 'todo: random map
3 ' graphics
4 ' optimize char codes to use to display things
5 ' optimize, optimize, optimize!
10 DEFINTA-Z:ONERRORGOTO80:SCREEN1:WIDTH32:KEYON:LOCATE5,5:PRINT"---------------
---";:C(0)=6408:C(1)=6408+8+64:S$=CHR$(10)+CHR$(13)+SPACE$(5)+"-"+"W"+SPACE$(15)
+"-":S$=S$+S$:PRINTS$;S$;S$;S$:PRINTSPACE$(5);"------------------":P=1
41 GOSUB50:GOSUB50:VPOKEC(0),88:VPOKEC(1),88:GOTO41
50 P=1-P:A=STICK(P):N=C(P)-(A=3)+(A=7)+(A=1)*32-(A=5)*32
60 H=0:M=H:S=M:W=VPEEK(N):IFW=32ORW=42ANDC(P)<>NTHENVPOKEC(P),32:C(P)=N
70 IFSTRIG(P)ANDT(P)=0THENT(P)=50:B(P)=C(P)ELSEIFT(P)>0THENVPOKEB(P),79+32*(T(P)
AND1):T(P)=T(P)-1:E(P)=-15*(T(P)=0)
80 IFHTHENV=B(P)+S:S=S*2:R=VPEEK(V):IFR<>45ANDM=0THENVPOKEV,G:RESUMENEXTELSEM=1:
IFR=87THENVPOKEV,32:RESUMENEXTELSERESUMENEXTELSEW=E(P):IFW>0THENW=W-1:E(P)=W:IFW
=14ORW=0THENG=42+(W=0)*10:H=1:X:S=-1:X:X:M=0:S=1:X:X:M=0:S=-32:X:X:M=0:S=32:X:X
90 IFVPEEK(C(P))=42THENY(1-P)=Y(1-P)+1:KEY2-P,HEX$(Y(1-P)):RETURNELSERETURN
Did we really need 5 years to code Bombaman?!?  | | Vampier msx addict Mensajes: 492 | Publicado: Abril 02 2005, 09:39   | Arjan.. if you place a bomb when the explosion occurs you explosion does not dissapear. So just wait until the exploision has cleared. The count in in hexadecimals too
Nice entry
(ps a key off would help too for people who did not do a set screen) | | manuel msx guru Mensajes: 3321 | Publicado: Abril 02 2005, 12:34   | AuroraMSX: you're right, I totally overlooked the mini manual... hit me please!
| | AuroraMSX
 msx master Mensajes: 1217 | Publicado: Abril 04 2005, 10:09   | /me reaches out from Munich to Nijmegen
Darn. Too far away...
| | dvik msx master Mensajes: 1299 | Publicado: Abril 04 2005, 11:05   | Wow, A lot of new nice entries since last time I checked  I especially like the brainfuck interpreter but the other ones are really impressive as well.
I made some optimizations to the Rally game (mainly interesting for NYYRIKKI I think) I managed to shrink the program with another 100 characters so now there is plenty of space for a nice Chase HQ type ending. Here's the update:
1 DEFINT A-Z:V=14:S$(0)="A18A0CA0FB07C03C01H00A80AE0AF0AFCIFFH00A80AE0AF0AF8AFCBFEAFFP00F3FF7FTFFAF0AF8AFCAFELFFE00A80AC0AE0BF0AF8AFCBFEBFFP00B01B03B07B0FB1FB3FB7FBFFB80BC0BE0BF0BF8BFCBFEBFFP00B01B03B07B0FB1FB3FB7FbFFB80BC0BE0BF0BF8BFCBFE"
2 COLOR15,5,1:X=V:S$(1)="BFFX00A01A07A0FA1FA3FB7FAFFC00A01A07A0FA3FIFFA18A30AF0BE0CC0C80J00A01A03A07B0FA1FA3FB7FBFFA0FA1FA3FA7F\FFFFCFFEDFFG00A1FA20A40A7FBCFA7FB70G00AC0A20A10AF0B98AF0B70J00A0FA10A1FA2FA1FA19K00B80A40B80L00A06A0FA09_00A03"
3 KEYOFF:SCREEN1,3,0:LOCATE9,1:PRINT"PLEASE WAIT!":FORI=256TO991:VPOKE7952+I,85:O=VPEEK(I):VPOKEI,(OORO/2)/(2-(IAND4)/4):NEXT:FORW=0TO1:FORI=1TO212STEP3:Q=ASC(MID$(S$(W),I,1))-65:Y=VAL("&H"+MID$(S$(W),I+1,2)):N=14336:FORA=ATOA+Q:VPOKEA+N,Y
4 NEXT:NEXT:PUTSPRITE8+W,(80+64*W,159),V,6+W:NEXT:FORI=0TO11:FORH=0TO31:VPOKE6528+H+I*32,(I<8ORH<VORH>17)*(-63-ASC(MID$("SRQARBQIARJB",I+1))):NEXT:NEXT:FORI=0TO143:TIME=0:VPOKE1024+I,255*(I/8AND1):VPOKE1311-I,255*(I/4AND1):NEXT:VPOKE8192,V
5 J=S+JAND8191:FORW=0TO2:VPOKE8208+W,50-15*((J\16+W)/3AND1):NEXT:IFTTHENRETURNELSESOUND3,V:SOUND8,V:FORT=VTON/2:GOSUB5:FORW=3TO4:PUTSPRITEW+1,(F*10+W*32,95),V,4*B+W+1:PUTSPRITE3+W,(W*32,127),V,4*F+3+W:NEXT:GOSUB5:PUTSPRITE0,(X+80,156),1,12
6 M=(X>72)-(X<0):U=STICK(0):GOSUB5:S=S-(S<18ANDSTRIG(0))*2-1:S=S*((X-15-E/3)\15<>0ORD<73)*(M=0ANDS>0):GOSUB5:T=T+S-1:X=X+5*(M+(U=7)-(U=3))-S*B\4:LOCATE1,1:SOUND9,V:SOUND1,83:SOUND0,255-S*V:F=B:N=N+9-S:GOSUB5:IFC<TTHENC=V+T+TMOD99:B=CMOD3-1
7 PRINTUSING"SPEED:####kmh RANK:###";S*10;(N-65)/128-82:D=96-(NAND127):E=NAND128:Y=D>0:D=D*D/96:GOSUB5:PUTSPRITE1,(115-(D<34)*((24-D)*B+F*10)+(E-64)*D/225,-Y*(98+D)-31),6,16-D/24:NEXT:BEEP:A=TIME\60:A$=SPACE$(V):FORJ=0TO999:LOCATE6,4
8 PRINTMID$(A$+"Game Over Time ="+STR$(A)+"s"+A$,J\6MOD42+1,16):NEXT:SCREEN0' IOMBCC 2005 by dvik and NYYRIKKI
| | snout
 msx legend Mensajes: 4991 | Publicado: Abril 04 2005, 12:34   | w00t! | | Arjan msx addict Mensajes: 448 | Publicado: Abril 04 2005, 19:08   | I just did some optimizations to the Bomberman Battle game, now everything is squeezed into 4 BASIC lines. The bug mentioned by Vampier has been fixed (I already did before, but sometimes I accidently press F12 in blueMSX  ), plus I also disabled the keyclick.
1 'Bomberman Battle IOMBCC
2 'todo: map, grahics
3 ' 32=space,33=explosion,34=brick,35=player,36=bomb,37=wall,36+32
4 DEFINTA-Z:ONERRORGOTO7:SCREEN1,,0:WIDTH18:KEYOFF:LOCATE,5:L$=STRING$(18,"%"):C
(0)=6410:C(1)=6482:S$=CHR$(37)+CHR$(34)+SPACE$(15)+CHR$(37):S$=S$+S$:PRINTL$;S$;
S$;S$;S$;L$:FORP=0TO3:H=0:M=H:S=M:P=X:D=H:A=STICK(P):GOSUB5:VPOKEC(P),35:NEXT
5 N=C(P)-(A=3)+(A=7)+((A=1)-(A=5))*32:IFVPEEK(N)<34ANDC(P)<>NTHENVPOKEC(P),32:C(
P)=N:GOSUB8ELSEGOSUB8
7 IFHTHENV=B(P)+S:S=S*2:R=VPEEK(V):IFR<>37ANDM=0THENVPOKEV,G:RESUMENEXTELSEM=1:I
FR=34THENVPOKEV,32:RESUMENEXTELSERESUMENEXTELSEW=E(P):D=1:IFWTHENW=W-1:E(P)=W:IF
W=11ORW=0THENG=33+(W=0):H=1:X:S=-1:X:X:M=0:S=1:X:X:M=0:S=-32:X:X:M=0:S=32:X:X
8 IFDTHENX=1-P:IFVPEEK(C(P))=33THENY(X)=Y(X)+1:LOCATEX*10,2:PRINTY(X):RETURNELSE
RETURNELSEIFSTRIG(P)AND(T(P)+E(P))=0THENT(P)=25:B(P)=C(P):RETURNELSEIFT(P)>0THEN
VPOKEB(P),36+32*(T(P)AND1):T(P)=T(P)-1:E(P)=-12*(T(P)=0):RETURNELSERETURN
There's still enough room to implement a nice map (or maybe multiple maps) and some graphics. | | NYYRIKKI msx master Mensajes: 1474 | Publicado: Abril 04 2005, 20:02   | Quote:
| This is BASIC, man. Of course it's dead slow! 
|
If you don't have all the time in the world, here is raped version, that works on X-BASIC as well...
0 ' MANDEL.BAS -- by AuroraMSX -- MSX2 and up -- for MSX.org's IOMBCC 2005
1 DEFINTA-G:DEFSTRH:DEFSNGI-Z:DIM A(8),AX(8),BX(8),AY(8),BY(8):COL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