nonsense in basic..

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

nonsense in basic..

Post by Nomad »

So this is from the spectrum manual. This was supposed to be a candidate for my one liner project. But I can't get it to work. Line 30 has issues - nonsense in basic.

Kinda curious if the POKE USR statement is going to be a problem. Everything else looks just fine.

I am doing this in +3 basic..

Code: Select all

5 LET b=BIN 01111100: LET c=BIN 00111000: LET d=BIN 00010000
	10 FOR n=1 TO 6: READ p$: REM 6 pieces
	20 FOR f=0 TO 7: REM read piece into 8 bytes
	30 READ a: POKE USR p$+f,a
	40 NEXT f
	50 NEXT n
	100 REM bishop
	110 DATA "b",0,d, BIN 00101000,BIN 01000100
	120 DATA BIN 01101100,c,b,0
	130 REM king
	140 DATA "k",0,d,c,d
	150 DATA c, BIN 01000100,c,0
	160 REM rook
	170 DATA "r",0, BIN 01010100,b,c
	180 DATA c,b,b,0
	190 REM queen
	200 DATA "q",0, BIN 01010100, BIN 00101000,d
	210 DATA BIN 01101100,b,b,0
	220 REM pawn
	230 DATA "p",0,0,d,c
	240 DATA c,d,b,0
	250 REM knight
	260 DATA "n",0,d,c, BIN 01111000
	270 DATA BIN 00011000,c,b,0
User avatar
PeterJ
Site Admin
Posts: 6852
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: nonsense in basic..

Post by PeterJ »

Hi [mention]Nomad[/mention] It runs OK for me. I just copied your listing and used bas2tap.

I will email you the .tap file.

Peter
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: nonsense in basic..

Post by Nomad »

Thanks, its probably me being a potato :lol:
User avatar
PeterJ
Site Admin
Posts: 6852
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: nonsense in basic..

Post by PeterJ »

Nomad wrote: Mon Apr 02, 2018 5:53 pm Thanks, its probably me being a potato :lol:
Image
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: nonsense in basic..

Post by Nomad »

Big thanks to Peter.

Image

Now begins the task of trying to get this to work as a 1 liner :lol:

One interesting code point is that the manual listing does not actually give you a UDG printer so without creating your own print code its not actually going to do anything. The listing in the manual is purely loading data into UDGs :lol:
Ralf
Rick Dangerous
Posts: 2279
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: nonsense in basic..

Post by Ralf »

I can see that this code does some smple and nice trick.

It stores some pattern of bits as variables and reuses them while defining graphics for chess pieces like:

Code: Select all

220 REM pawn
230 DATA "p",0,0,d,c
Saves some typing and memory, I guess.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: nonsense in basic..

Post by Nomad »

When I was typing it in I was thinking 'there does not seem to be enough data here...' then I figured out what he was doing reusing the data. :lol: Very slick.

It might be just too long to use as a one liner with the print routine. Will restart the machine and see if I can convince it to take the print routine. Of course I removed the comments :lol:

I got it to print the udg list but I can't save the one liner to disk weirdly. :lol:


Image
Post Reply