Black squares...

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
1024MAK
Bugaboo
Posts: 3118
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: Black squares...

Post by 1024MAK »

A better colour version:

Code: Select all

1 FOR a=0 TO 14444: POKE PEEK a+PEEK (a+1) +PEEK (a+2) +22528,RND*56: NEXT a: GO TO 1
Mark
:!: Standby alert :!:
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :dance
Looking forward to summer later in the year.
llewelyn
Manic Miner
Posts: 205
Joined: Thu Feb 22, 2018 3:27 pm
Location: virginias eastern shore
Contact:

Re: Black squares...

Post by llewelyn »

That's cool Mark. I typed it in and ran it, noticed that diagonal tendency to the way the squares are placed. Interesting.

BTW is there a command to make the keyboard window in Fuse get bigger somehow? I have to use a magnifying glass to read it.
User avatar
PROSM
Manic Miner
Posts: 476
Joined: Fri Nov 17, 2017 7:18 pm
Location: Sunderland, England
Contact:

Re: Black squares...

Post by PROSM »

llewelyn wrote: Sat Aug 03, 2019 12:33 pm BTW is there a command to make the keyboard window in Fuse get bigger somehow? I have to use a magnifying glass to read it.
If you're talking about the "Keyboard Helper" window, then I'm afraid not - that's the biggest it gets. If you are having trouble with the keyword entry system, you might want to try typing in your BASIC programs from 128K mode; you can type your commands out letter by letter from there.
All software to-date
Working on something, as always.
llewelyn
Manic Miner
Posts: 205
Joined: Thu Feb 22, 2018 3:27 pm
Location: virginias eastern shore
Contact:

Re: Black squares...

Post by llewelyn »

Thanks Prosm! Does that also include key command words and punctuation?
User avatar
PROSM
Manic Miner
Posts: 476
Joined: Fri Nov 17, 2017 7:18 pm
Location: Sunderland, England
Contact:

Re: Black squares...

Post by PROSM »

llewelyn wrote: Sat Aug 03, 2019 2:50 pm Thanks Prosm! Does that also include key command words and punctuation?
In 128K mode, the only key positions you'll have to remember are for the punctuation marks. Everything else is typed out letter by letter, including key command words.

You may also want to consider trying out the "Keyboard Helper" function in ZX Spin. This allows you to write out whole BASIC statements using the PC keyboard mapping by first typing them into a separate input box, and then by clicking a button, allowing the emulator to convert these to Spectrum key presses.

In addition, the BASin development environment allows you to write BASIC programs in a standard Windows environment, and test them out in an integrated emulator at any time. It also comes with many useful features, such as a UDG editor, a debugger and a line renumbering facility.

To get slightly back on topic... :)
spider wrote: Fri Aug 02, 2019 4:01 pm ... I think if you added a splash of colour to the squares in your routine it would be even better 8-)
Image

Not yet random colour, but somewhat prettier:

Code: Select all

org 28000

c_mosaicfade:
		ld a,39					; Galois LFSR seed
		ld d,$38				; LFSR mask (and mask for attributes)
c_mosaicfade_l1:
		ld b,3					; 9 squares per frame
c_mosaicfade_l2:
		call c_mosaicfade_plot			; Plot square
		djnz c_mosaicfade_l2
		halt
		jr c_mosaicfade_l1

c_mosaicfade_plot:
		rrca					; Rotate
		jr nc,c_mosaicfade_plot_l1
		xor d					; XOR if last bit cycled was 1 (feedback part)

c_mosaicfade_plot_l1:
		ld l,a
		ld h,$58

		call c_matchcolours
		ld (hl),a				; 1st attr. page
		
		ld a,l
		inc h
		xor %00110110				; Randomise position
		ld l,a
		call c_matchcolours			; Set ink to be same colour as paper
		ld (hl),a

		ld a,l					; Get page position value
		inc h
		xor %11001001				; Randomise position
		ld l,a
		call c_matchcolours
		ld (hl),a
		
		ld a,l
		cpl					; Restore to original value (equiv. to XOR $FF)

c_mosaicfade_plot_l2:
		cp 39					; Are we back to the start of the period?
		ret nz					; Return if not
		or a
		ret z
		pop hl					; We want to return directly to the caller

		xor a
		jr c_mosaicfade_plot_l1

c_matchcolours:
		and d					; Keep only the paper colour
		ld c,a
		rrca
		rrca
		rrca					; Rotate paper colour into ink colour slot
		or c					; Combine paper and ink colours
		ret

end 28000
All software to-date
Working on something, as always.
dfzx
Manic Miner
Posts: 681
Joined: Mon Nov 13, 2017 6:55 pm
Location: New Forest, UK
Contact:

Re: Black squares...

Post by dfzx »

llewelyn wrote: Sat Aug 03, 2019 12:33 pm BTW is there a command to make the keyboard window in Fuse get bigger somehow? I have to use a magnifying glass to read it.
The Fuse keyboard graphic was replaced by a much better one back in December. Unfortunately development of Fuse has rather stalled and they've not released a new version since before then. :(
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
Post Reply