Printed Amstrad Addict magazine announced, check it out here!
Started by mv, 13:54, 26 September 19
0 Members and 1 Guest are viewing this topic.
Quote from: mv on 13:54, 26 September 19 Ideas, thoughts, contributions are welcome.
10 MODE 0:BORDER 0:INK 1,26:INK 0,0:INK 2,2:INK 3,11:INK 4,2520 GOSUB 300030 x=100:y=100:p=140 WHILE p<>6550 WHILE x<>13260 PLOT x,y,o(p):p=p+1:x=x+470 WEND80 x=100:y=y-290 WEND100 WHILE INKEY$<>CHR$(13):WEND:MODE 2:END3000 DIM o(64):FOR n=1 TO 64:READ o(n):NEXT n:RETURN3010 DATA 1,0,0,0,0,0,0,13020 DATA 2,1,1,1,1,1,1,23030 DATA 2,3,3,4,4,4,3,23040 DATA 2,3,3,4,3,3,3,23050 DATA 2,3,4,4,4,3,3,23060 DATA 2,3,3,4,3,3,3,23070 DATA 2,3,4,4,4,4,3,23080 DATA 0,2,2,2,2,2,2,0
Quote from: AMSDOS on 00:15, 27 September 19Marco, if you need some BASIC stuff to test my Silly Programming Ideas - Turning Text into Graphics has lots of stuff in it. My 1st example wasn't working, I'm guessing because of it using SYMBOL, though this example below wasn't working quite right either.EDIT: Okay I see what's happening. Isn't quite simulating MODE 0 yet, so will produce the colour scheme, but not the horizontal pixel axis.
Quote from: mv on 20:40, 27 September 19Thank you for the pointer. I will check it.SYMBOL was ok, but transparent mode with chr$(22) was not implemented. (I never used it.)I changed the canvas coding to use a pixelbuffer. No filigree lines any more but it looks more like a CPC.And I also put in transpararent mode. Your example seems to work now...
10 MODE 0: INK 0,0:INK 1,26:INK 4,3:INK 6,1:INK 7,2:INK 8,4:INK 9,1620 DIM col%(242):GOSUB 100:a%=130 WHILE (y%<>22)40 FOR x%=1 TO 1150 LOCATE x%,25:PEN col%(a%):PRINT CHR$(143);60 a%=a%+170 NEXT x%:LOCATE 1,25:PRINT CHR$(10):y%=y%+1:WEND80 CALL &BB18:PEN 1:MODE 2:END100 ' Set up Colours110 FOR a%=1 TO 241120 READ c%130 col%(a%)=c%140 NEXT a%:RETURN150 DATA 0,4,4,4,4,4,4,0,0,0,0160 DATA 0,4,4,4,4,4,4,4,4,4,0170 DATA 0,4,4,4,4,4,4,9,4,4,0180 DATA 4,4,4,4,4,4,4,9,4,4,0190 DATA 4,4,4,4,4,4,9,9,9,4,4200 DATA 4,4,4,4,1,0,9,0,1,4,4210 DATA 4,9,4,9,1,0,9,0,1,4,4220 DATA 0,9,4,9,1,0,9,0,1,4,4230 DATA 0,9,9,9,1,0,9,0,1,4,0240 DATA 0,4,9,9,1,1,9,1,9,9,0250 DATA 0,4,9,9,9,1,9,1,9,9,0260 DATA 0,4,9,9,9,9,9,9,9,9,0270 DATA 0,7,4,9,9,9,0,9,9,9,0280 DATA 7,7,7,9,9,9,9,9,9,8,0290 DATA 7,7,7,8,7,7,7,8,7,8,0300 DATA 7,7,9,8,7,7,7,8,9,9,0310 DATA 7,9,9,9,8,8,8,8,9,9,0320 DATA 0,9,9,8,6,1,6,1,8,9,0330 DATA 0,8,8,8,8,6,6,6,6,8,0340 DATA 0,8,8,8,8,8,8,8,8,8,8350 DATA 0,4,6,6,6,0,6,6,6,6,4360 DATA 0,4,4,4,4,0,4,4,4,4,4
70 NEXT x%:LOCATE 1,25:PRINT CHR$(10):y%=y%+1:call &bd19:WEND
100 i=1:FOR i=i TO i+5 ?i;:next
Quote from: mv on 22:50, 01 October 19It was not so difficult to get the rolling effect with chr$(10) working. To see it in the demo, insert "call &bd19" before the "wend", otherwise it would be too fast:Code Select Expand70 NEXT x%:LOCATE 1,25:PRINT CHR$(10):y%=y%+1:call &bd19:WENDWith chr$(11) implemented, https://benchmarko.github.io/CPCBasic/cpcbasic.html?example=cpc464ch works as well (without blinking colors).
QuoteThe block editor was also interesting. I followed the thread to find out why column 20 cannot be selected, but when allowing it and moving in column 20, I cannot see an issues.
QuoteThere were other little surprises, like a "for" loop which was an endless loop (from my own coding):Code Select Expand100 i=1:FOR i=i TO i+5 ?i;:nextThe end condition was evaluated again and again.
QuoteBTW, may I take the code snippets and use them as CPCBasic samples?I am also thinking of a separate collection of BASIC samples with unclear license or copyright.
Quote from: AMSDOS on 11:51, 02 October 19I think it has something to do with how the original BASIC 1.0 manages strings,...
?chr$(30);chr$(10);chr$(;chr$(22)+chr$(0);:if pos(#0)=1 then ?"CPC 464" else ?"CPC 664/6128"
QuoteYeah it's a funny way of handling the use of the cursor keys, it seems to be the only valid way using INKEY$ but I guess if I didn't have UPPER$ it would work, but would have to change the Lines to include upper and lower case letters in the IF statement. I think it was around that time I was trying to use INKEY() instead with the Key Number, but was too fast for a simple Block Editor.
QuoteYeah I'm unsure if the FOR Loop problem relates to this bit of code I posted here, but the following code in there works fine.
QuoteFeel free to use any of my samples, I have a number of other threads with some BASIC stuff in them too as well as little bits and pieces on the CPCWiki Source Code page. Some of the other threads I've made cover past BASIC type-ins from Magazines which I did to cover a problematic listing or something which could of been improved on, in terms of license or copyright if the authors are acknowledged you should be fine.
Quote from: AMSDOS on 09:56, 07 October 19I was getting some interesting results from My Simple Platform Game BASIC examples. Most of those are using Sprite Drivers which I know won't work with CPCBasic, but the 1st 2 examples are entirely in BASIC, the 1st using the standard Character set with simple character and one Redefined Hazard. The 2nd again uses the Transparent Mode and Redefines into the Colourful Graphics I have with the 8x8 Sprite Driver version of the game. I just had to add a CALL &BD19 into the Main Loop of the game for it to be playable, though just thought you maybe interested.
QuoteThe only other thing I noticed with CPCBasic, was while POKE works, it doesn't work when POKEing a Byte to Screen (my other thread has an example of it written in BASIC). At the time I wrote it thought it might of been a bit pointless, though it seems to work well when CPC BASIC 3 Cross Compiler is used.
Quote from: mv on 23:54, 09 October 19Good to hear that it is playable. CPCBasic could also integrate some RSX for sprites. Or at least some pixel scrolling. From the sprite drivers you tested, do you remember which was most useful?
Quote from: AMSDOS on 10:43, 10 October 19With CPCBasic I wasn't sure if you were coding it to have Locomotive BASIC perform like the Compiler, or if you were looking to eventually make it as accurate as Locomotive BASIC....
Quote from: AMSDOS on 11:38, 19 December 19I can't remember what I was thinking back in October regarding Speed Vs. Accuracy. I think it was to do with creating a Compiled or Intrepreted language, I was probably thinking with the compiled aspect it would be looking at more of a CPC BASIC 3 like language, though CPC BASIC 3 is it's own language replacing DEFINT and DEFREAL with DEFBYTE and DEFWORD for example, though including a lot of the Locomotive BASIC traits that work for the Compiler, and removing other parts of Locomotive BASIC that don't quite work with the Compiler.
100 MODE 0:DEFINT a-z:WINDOW#1,5,14,11,19:PAPER#1,1:CLS#1:PAPER#1,0110 s$="1111111111223344433455544433222222221111"120 p1=1:p2=1:p3=11130 x=5:y=10:LOCATE x,y140 WHILE p1 < p3150 p=p1:GOSUB 1000160 p1=p1+1:x=x+1170 WEND180 p2=p2+1:x=5:p1=p2:p3=p1+10190 IF p2=40 THEN p2=1:p1=1:p3=p1+10200 CALL &BD19210 GOTO 1301000 FOR y=1 TO VAL(MID$(s$,p,1))1010 WINDOW#1,x,x,VAL(MID$(s$,p,1))+11,VAL(MID$(s$,p,1))+13:CLS#11020 LOCATE x,val(mid$(s$,p,1))+10:PRINT CHR$(143);:LOCATE x,val(mid$(s$,p,1))+14:PRINT CHR$(143);1030 NEXT y1040 RETURN
Quote from: AMSDOS on 11:41, 22 December 19Oh well, I just put this little thing together below, which is too slow in Interpreted BASIC. With CPC Basic it's very fast, even with a CALL &BD19 included, if I can get a similiar speed in Assembly that would be great.
t!=time+300/2:while time<t!:call &bd19:wend
t!=time+300/2:while time<t! and inkey$="":wend
Quote from: SkulleateR on 23:04, 03 January 20Just noticed this even works on my iPad, Great to test some routines when you're away from home But you can't use keyboard, so no input routines
Quote from: AMSDOS on 23:29, 03 January 20On my Computer I have to click on the Screen, the Border goes from Light Grey to Dark, so it may simply be a matter of pressing the screen area and then the Input Routines will work.
Quote from: SkulleateR on 23:36, 03 January 20Nope, the Keyboard won't open on iPad except inside the Input window at the top...
Quote from: AMSDOS on 03:19, 04 January 20I see what you mean, have the same trouble on my Android Touch-screen phone, the funny thing about it is it worked on my old Android 4.4 phone using the Navigation Keys. Maybe @mv can setup a small touch screen keypad for it?
Quote from: mv on 01:17, 08 January 20Good point. Currently, there is no input routine for the CPC screen on mobile. The input area below can be used to input some text and press Enter. Maybe I can put in more keys.
Page created in 0.113 seconds with 23 queries.