this short program crashes the spectrum

The place for codemasters or beginners to talk about programming any language for the Spectrum.
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

this short program crashes the spectrum

Post by equinox »

10 NEW
worcestersource
Manic Miner
Posts: 530
Joined: Thu Feb 03, 2022 11:05 pm

Re: this short program crashes the spectrum

Post by worcestersource »

That made me chuckle.

This one will too.

10 RANDOMISE USR 0


(actually, is the keyword RANDOMISE or RANDOMIZE?)
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: this short program crashes the spectrum

Post by equinox »

worcestersource wrote: Mon Oct 02, 2023 10:27 pm (actually, is the keyword RANDOMISE or RANDOMIZE?)
Interestingly one of the benefits of the single-key BASIC entry system is that you don't have to care how it's spelled. Because it's (stupidly enough) T, a letter that doesn't even appear in the word.
And they say texting is making our kids stupid...

(Andrew Owen, a man who is particularly keen on UK-US spelling differences, may be along shortly... I won't forgive him for saying "don't mention literature in front of equinox" grrrrrr)
User avatar
1024MAK
Bugaboo
Posts: 3123
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: this short program crashes the spectrum

Post by 1024MAK »

‘tis just a bit more important to spell it right on the 128 BASIC… :P

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.
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: this short program crashes the spectrum

Post by equinox »

1024MAK wrote: Mon Oct 02, 2023 10:40 pm ‘tis just a bit more important to spell it right on the 128 BASIC… :P
While doing my Screwball Scramble CSSCGC game (coming soon, promise, promise) I wanted a variable called "cat" to keep some catapult state information* and I thought "oh! no! you can't do that because of CAT" -- yes yes I could, but it feels dirty. Like ummm writing "void main" in C. Like I'd know or care.

I just want my sweet dead cat back.

* technically known as CSI
User avatar
1024MAK
Bugaboo
Posts: 3123
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: this short program crashes the spectrum

Post by 1024MAK »

worcestersource wrote: Mon Oct 02, 2023 10:27 pm This one will too.

10 RANDOMISE USR 0
Nah, too much typing, use:
1 INK USR 0

;)

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.
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: this short program crashes the spectrum

Post by equinox »

1024MAK wrote: Mon Oct 02, 2023 10:58 pm Nah, too much typing, use:
1 INK USR 0
;)
And we come back to ages ago, when I asked "how can we do USR without any side-effects" -- so no memory allocation or overwrite (LET y=USR x) and no touching anything (CIRCLE USR x,y). I think the best that we came up with was: BEEP 0,0*USR x. Not quite "functional programming" but there's no side-effect your ugly momma can hear. (The multiplication is necessary because BEEP 0,255 would still throw error B.)

Some BASICs allow CALL which is just "(dispose of) USR x" but if I'm bitching about VERIFY in another thread I'm certainly not going to support that kind of thugduggery.

Also, the people who said "the return value doesn't matter, just don't return!!" -- these people are idiots with no understanding of the beauty of a fine piece of code (in God's own language, Hebrew ZX BASIC). DI HALT
AndyC
Dynamite Dan
Posts: 1408
Joined: Mon Nov 13, 2017 5:12 am

Re: this short program crashes the spectrum

Post by AndyC »

equinox wrote: Mon Oct 02, 2023 10:30 pm Interestingly one of the benefits of the single-key BASIC entry system is that you don't have to care how it's spelled. Because it's (stupidly enough) T, a letter that doesn't even appear in the word.
And they say texting is making our kids stupid...

(Andrew Owen, a man who is particularly keen on UK-US spelling differences, may be along shortly... I won't forgive him for saying "don't mention literature in front of equinox" grrrrrr)
RANDOMIZE. Some people will tell you that is the American spelling, but that's because they don't know history.
User avatar
Sokurah
Manic Miner
Posts: 287
Joined: Tue Nov 14, 2017 10:38 am
Contact:

Re: this short program crashes the spectrum

Post by Sokurah »

equinox wrote: Mon Oct 02, 2023 10:09 pm10 NEW
Well, to be precise that command doesn't crash the Spectrum - it resets it. Big difference ;)
Website: Tardis Remakes / Mostly remakes of Arcade and ZX Spectrum games.
My games for the Spectrum: Dingo, The Speccies, The Speccies 2, Vallation & Sqij.
Twitter: Sokurah
User avatar
spider
Dynamite Dan
Posts: 1099
Joined: Wed May 01, 2019 10:59 am
Location: Derby, UK
Contact:

Re: this short program crashes the spectrum

Post by spider »

RUN USR 1298+USR 0
firelord
Manic Miner
Posts: 557
Joined: Wed Nov 03, 2021 10:57 am
Location: Greece - Thessaloniki

Re: this short program crashes the spectrum

Post by firelord »

equinox wrote: Mon Oct 02, 2023 10:09 pm10 NEW
This reminded me this : My ZX spectrum + had a small button at the side. It never worked. Each time I pressed it my ZX crashed ...
sn3j
Manic Miner
Posts: 500
Joined: Mon Oct 31, 2022 12:29 am
Location: Germany

Re: this short program crashes the spectrum

Post by sn3j »

Image
POKE 23614,10: STOP      1..0 hold, SS/m/n colors, b/spc toggle
User avatar
Bedazzle
Manic Miner
Posts: 305
Joined: Sun Mar 24, 2019 9:03 am

Re: this short program crashes the spectrum

Post by Bedazzle »

equinox wrote: Mon Oct 02, 2023 11:05 pm And we come back to ages ago, when I asked "how can we do USR without any side-effects
POKE 0, USR XXXXX
User avatar
SkoolKid
Manic Miner
Posts: 407
Joined: Wed Nov 15, 2017 3:07 pm

Re: this short program crashes the spectrum

Post by SkoolKid »

Code: Select all

10 RESTORE 60000
Looks benign, but don't RUN it unless you've already saved your work...
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
Timmy
Manic Miner
Posts: 230
Joined: Sat Apr 23, 2022 7:13 pm
Location: The Netherlands

Re: this short program crashes the spectrum

Post by Timmy »

equinox wrote: Mon Oct 02, 2023 11:05 pm And we come back to ages ago, when I asked "how can we do USR without any side-effects"

Code: Select all

PRINT USR "a"
of course.
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: this short program crashes the spectrum

Post by equinox »

Timmy wrote: Tue Oct 03, 2023 8:53 pm

Code: Select all

PRINT USR "a"
of course.
The real demoscener packs a tiny routine into 0xFF4C, and also wrote it so that it looks like a pretty UDG.
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: this short program crashes the spectrum

Post by equinox »

Bedazzle wrote: Tue Oct 03, 2023 7:52 pm POKE 0, USR XXXXX
You never had a +2a did you?

(At least, some of the post-+2 machines were able to page out their own ROM. Gross!!! I like the grey one better.)
Last edited by equinox on Mon Oct 09, 2023 1:47 am, edited 1 time in total.
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: this short program crashes the spectrum

Post by equinox »

equinox wrote: Mon Oct 09, 2023 12:48 am The real demoscener packs a tiny routine into 0xFF4C, and also wrote it so that it looks like a pretty UDG.
BTW I'm trying to remember who it was who wrote code that ended up requiring (truly double) USR USR "a".
Was it CSSCGC stuff? Anyway a great laugh.
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: this short program crashes the spectrum

Post by equinox »

worcestersource wrote: Mon Oct 02, 2023 10:27 pm (actually, is the keyword RANDOMISE or RANDOMIZE?)
This kind of dithering is what gave us Unicode
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: this short program crashes the spectrum

Post by equinox »

firelord wrote: Tue Oct 03, 2023 5:58 pm This reminded me this : My ZX spectrum + had a small button at the side. It never worked. Each time I pressed it my ZX crashed ...
The early Spectrum models like the 16K and 48K didn't have this crash button. It was necessary to buy extra hardware (RAM-pack or IF1), stick it in the back, and then half pull it out.
Sinclair rightly argued, "Why should we enforce the purchase of extra hardware for a crash, something that would naturally be expected from a ZX Spectrum? Why not engineer it in?" (see also: Datacorder)
And after a brief but dramatic boxing match with Chris Curry, the reset button was invented.
You can still see it today in Spectaculator, when you accidentally hit F5 and it says "UNDER NORMAL CONDITIONS THIS WILL RESET THE SPECTRUM"-- Yeah yeah, *I want my N-M-I* like Dire Straits. What p's me off is when I accidentally hit Alt+R (because I want to type R for RUN, but my brain is still in Visual Studio mode) and I reset the thing with no warning whatsoever, and I hope my last snapshot was recent. Imagine snapshotting bloody BASIC. But it's quicker than a TZX.

mods, mods, please stop him, I think he got into the liquor cabinet again

P.S. I once carelessly ripped my Plus D disk interface out of the back of my +2. Oops! The poor +2 never booted again: it only guilted me with blocky flashing patterns. But the Plus D survived. Thank God. Much harder to get hold of those at the time.
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: this short program crashes the spectrum

Post by equinox »

SkoolKid wrote: Tue Oct 03, 2023 8:23 pm

Code: Select all

10 RESTORE 60000
Looks benign, but don't RUN it unless you've already saved your work...
Okay, what's the trick here? In empty BASIC, it reports "OK" without apparently fking things up (unlike DEF FN x()=FN x(), or CLOSE #8, which immediately causes screaming chaos). Is this a documented bug? What does it do?
User avatar
1024MAK
Bugaboo
Posts: 3123
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: this short program crashes the spectrum

Post by 1024MAK »

equinox wrote: Thu Oct 12, 2023 4:21 am Okay, what's the trick here?
https://skoolkid.github.io/rom/referenc ... ingRestore

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.
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: this short program crashes the spectrum

Post by equinox »

Damn... when I put some code in a REM (using the classic old Outlook tool Remstore) I also found that it f-ked up RESTORE a bit, because errrr I suppose we don't expect those bytes to be in a BASIC listing.
(Then you think "is it literally counting through all the lines to find this line? Then you think about GO TO and GO SUB. Then you start writing C.)
User avatar
1024MAK
Bugaboo
Posts: 3123
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: this short program crashes the spectrum

Post by 1024MAK »

Try writing code in a REM on a ZX80 if you really want a nightmare of BASIC crashing…
:!: 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.
User avatar
Bedazzle
Manic Miner
Posts: 305
Joined: Sun Mar 24, 2019 9:03 am

Re: this short program crashes the spectrum

Post by Bedazzle »

equinox wrote: Mon Oct 09, 2023 1:43 am You never had a +2a did you?
Never. :-/
48K clone, 128K clone, Next

ok, then something like
POKE NOT PI, PEEK NOT PI + NOT PI * USR xxxx
Post Reply