Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : CMM2: TSCP Chess
Page 5 of 7 | |||||
Author | Message | ||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4222 |
Is it possible to compile it as a CSUB ? The .uf2 is a standalone. Just feed it ASCII text (new, d2d4, on, etc) and get chess move in return (g5g7, comment). Actually, even the current terminal interface can be handled by MMBasic, and the correct information stripped out. We could even "decode" the ASCII chess board into the actual chess board. Doesn't look very difficult. I even think that when the best you could do is a UART interface, that I can PIO decode that in parallel to give MMBasic control. Edited 2022-10-06 17:02 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
Hi Kevin this should be it: Small_Col.zip 'no comment |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4222 |
Nice !!!!! Volhout PicomiteVGA PETSCII ROBOTS |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3800 |
Is that valid code in MMBasic? Looks to be wrong e.g. needs to be OPTION DEFAULT INTEGER, I think. Also, is the multiple assignment to an array allowed when not in a DIM? John |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6773 |
Since it can't/won't be done I forgive myself any errors. :) Nope - it's BASIC-like pseudo-code made up on the spur of the moment. It's never intended to run. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
and at last as Sprites the image is enlarged for better visibility, the original image has 240x20 pixels Small_Sprites_Col.zip Cheers Mart!n Edited 2022-10-06 20:13 by Martin H. 'no comment |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9104 |
Remember you can also use colour in mode 1 using the tile command. If each square on the chess board was 48x48 then your board would be 384x384. Within each square you can have individual foreground and background colours allowing the "black and white" squares and "black and white" pieces each to have different colours |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
yes, like in the "good old" Zx Spectrum days 'no comment |
||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 509 |
Thanks Martin, :-) I'll give both of your sets a go asap, the first set should be a swap in, so quick, but the second set will require a rework, so it may be several days or more, as I'm still on holiday, my brother in law has just died from a inoperable brain tumor & to top it off, we're then taking my parents in law to visit their son in France & it's likely to be the last time, as my father in law has dimentia & quite soon won't know which way is up. :-( Regards Kevin. PS. What colours would you suggest as the background for your 240x20 set? |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
Hi Kevin, don't worry, family should always come first Since the figures are all in shades of red/Brown and blue, either a monochrome background, i.e. black and white, or a shade of green for the dark fields remains for the Background. Cheers Mart!n Edited 2022-10-07 02:47 by Martin H. 'no comment |
||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 509 |
Because it was very straight forward, I've been able to test Martins 24 piece colour set. There are a few random black pixels on the left of all the castles. Interestingly, using the 'bench' command, the moves it makes and the number of possibilities analysed are significantly different, from the version Peter compiled, but his version is the very latest and this was converted by Ceptimus 2019. The timings :- 19 nodes per second MMBasic 34981 nodes per second compiled C. Only a very slight difference then. ;-) Regards Kevin. Edited 2022-10-07 04:56 by Bleep |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
Hi Kevin Small_Col_fix.zip There were some pixels where the green value was 63 instead of 64,you can't see that but, these were interpreted as black.. hopefully, I Fixed it. Sometimes the graphics Program (Windows Paint.net) develops a life of its own. I haven't been able to test the images on the Pico yet. I hope, I find the time to transcode the Monochrom 40x40 Tiles for Mode 1 tomorrow to single Files (200 Bytes each) and try Toms Idea, only to load them when they are used. So you need nearly no extra Ram for the Graphic. If I get it running I will give you a simple sample, how to use them. Cheers Mart!n Edited 2022-10-07 05:42 by Martin H. 'no comment |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
So, here we have it every Tile is stored as a single File in the "Tiles" Sub Folder little Demo 'demo paint a Chessboard without using Memory for SPRITE/BLIT 'Tiles are loaded from SD Card, just when they are used 'Filenames are Color, Type, Background coded 'so '"bpw.bin" is a Black Pawn on a with white Background '"wnb.bin" would be a white Knight with black Background ' etc. '----------------------- MODE 1 'create example board Dim BRD%(8,8) LN1$="rnbqkbnr" 'Rock.Knight,Bishop,Queen,King,Bishop,Knight,Rock For y%=0 To 7 For x%=0 To 7 c$="0" If y%<2 Then c$="b" If y%>5 Then c$="w" Select Case y% Case 0,7 c$=c$+Mid$(LN1$,x%+1,1) Case 1,6 c$=c$+"p" Case 2 To 5 c$=c$+"0" End Select stile(c$,x%,y%) Next x% Next y% Print @(0,320):Memory '--------------------------------------- 'paint the Tiles 'Parameters f$ holds the color and type of the figure "bp" "wp".. etc ' if the place is empty F$ is "00" '--------------------------------------- Sub STILE(f$,px%,py%) Local tl$ 'deside the Backgroundcolor If (px%+py%)Mod 2 Then f$=f$+"b.bin" Else f$=f$+"w.bin" f$="Tiles\"+f$ Open f$ For input As #1 tl$=Input$(200,#1) Close #1 GUI bitmap px%*40,py%*40,tl$,40,40 End Sub the Files demo.zip Cheers Mart!n Edited 2022-10-07 17:45 by Martin H. 'no comment |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4222 |
Thank you Martin, I have adapted your demo to use color in 640x480 mode. The code is adapted to use 48x48 tiles (simply extended the 40x40). I only used the white background/black piece tiles, the coloring is in the second layer (the TILE command). You need 48x48 or 32x32 to do this in mode 1, since the background layer is in 16x16 blocks, called TILES.... 'demo paint a Chessboard without using Memory for SPRITE/BLIT 'Tiles are loaded from SD Card, just when they are used 'Filenames are Color, Type, Background coded 'so '"bpw.bin" is a Black Pawn on a with white Background '"wnb.bin" would be a white Knight with black Background ' etc. '----------------------- MODE 1 'create example board Dim BRD%(8,8) LN1$="rnbqkbnr" 'Rock.Knight,Bishop,Queen,King,Bishop,Knight,Rock For y%=0 To 7 For x%=0 To 7 c$="0" If y%<2 Then c$="b" If y%>5 Then c$="w" Select Case y% Case 0,7 c$=c$+Mid$(LN1$,x%+1,1) Case 1,6 c$=c$+"p" Case 2 To 5 c$=c$+"0" End Select stile(c$,x%,y%) Next x% Next y% font 8:Print @(0,400):Memory save image "color" '--------------------------------------- 'paint the Tiles 'Parameters f$ holds the color and type of the figure "bp" "wp".. etc ' if the place is empty F$ is "00" '--------------------------------------- Sub STILE(f$,px%,py%) Local tl$,g$ 'always use the white background, black piece BMP if f$="00" then g$="Tiles\0"+right$(f$,1)+"w.bin" 'always load black piece on white field else g$="Tiles\b"+right$(f$,1)+"w.bin" 'always load black piece on white field end if 'deside the Backgroundcolor 'If (px%+py%)Mod 2 Then f$=f$+"b.bin" Else f$=f$+"w.bin" 'f$="Tiles\"+f$ 'Open f$ For input As #1 'determin the tile (tc%) and piece (pc%)colors if left$(f$,1)="b" then pc%=rgb(red) else pc%=rgb(white) end if If (px%+py%)Mod 2 Then tc%=rgb(green) else tc%=rgb(myrtle) end if open g$ for input as #1 tl$=Input$(200,#1) Close #1 box px%*48,py%*48,48,48,1,rgb(white),rgb(white) 'make the tiles virtually bigger 48x48 GUI bitmap 4+px%*48,4+py%*48,tl$,40,40 'print the 40x40 tile in centre 'color the tile background and ink the piece for dx%=0 to 2 for dy%=0 to 2 tile dx%+3*px%, dy%+3*py%,tc%,pc% next next End Sub @Peter Could you investigate whether it is possible to make the "SAVE IMAGE" also show the TILE color ? a SAVE IMAGE of above chessboard shows as black and white. PicomiteVGA PETSCII ROBOTS |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
Ingenious. This saves half of the images and looks very good. I had written the solution as a suggestion on how this could be implemented. According to the proposal of Tom @thwill. I don't know the source code of the Pico version of TSCP Chess and therefore can't judge how easy it is to implement. In any case, this method would free up a lot of Ram. Edited 2022-10-07 22:02 by Martin H. 'no comment |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9104 |
If I did that then if you tried to subsequently tried to load the saved image it would appear all white Original C code with almost no mods (just msec timer). Very difficult to implement as a CSUB as all the data structures have to survive going between C and Basic which means they must all be re-done as pointers into a Basic supplied array. This is easy for one dimensional arrays but not for the multidimensional ones |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
Thank you Peter, my comment referred to the PICO MM-Basic Trancelation that @Volhout and @Bleep are working on. I am sadly not fit enough in C. Cheers Mart!n Edited 2022-10-07 22:31 by Martin H. 'no comment |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4222 |
Aye.....yes, I understand. It is technically possible to go from screen to BMP, but not from BMP back to screen since the BMP has no awareness there are tiles. So for every 16x16 block you would have to analyze what the dominant color is and pick the closest from the list. Nightmare..... But what about SAVE SCREENSHOT ? NOT reversible as LOAD SCREENSHOT ? I know, I am lazy, and not willing to buy a better phone (better camera) for documenting on TBS.... Plz....Don't kill me..... PicomiteVGA PETSCII ROBOTS |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4222 |
@MartinH You have PM Just attach your "color_small" tile set. The book with settings you can take from the original ZIP. Volhout Edited 2022-10-07 22:54 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4222 |
So this is pretty much the maximum speed possible with the Pico Your terminal program needs local echo on and there is no line editing TSCP.zip Peter, Can this version communicate through a serial port (or only through USB serial). I see a nice christmas project comming up with this in the second socket on your 1.7 VGA board, and a picomite in the primary socket doing all screen and keyboard. Communicating through on board serial port (jumpers on socket 3). The opening book, is that fixed in your version ? Or can it be replaced with a different one (larger). The picomite program could handle that .. right ? Regards, Volhout PicomiteVGA PETSCII ROBOTS |
||||
Page 5 of 7 |
Print this page |