Acorn Arcade forums: Programming: One-line BASIC program for the day
|
One-line BASIC program for the day |
|
Phlamethrower (10:33 10/9/2006) VincceH (10:39 10/9/2006) Phlamethrower (10:44 10/9/2006) ninj (00:33 11/9/2006) adrianl (12:20 11/9/2006) Loris (18:06 11/9/2006) monkeyson2 (18:11 11/9/2006) Phlamethrower (18:21 11/9/2006) Phlamethrower (18:49 11/9/2006)
|
|
Jeffrey Lee |
Message #80012, posted by Phlamethrower at 10:33, 10/9/2006 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
DIMa 256:F.b=1TO255:!a=0:SYS&20009,7,b,a,,,255TO,,c$:IFa!0TH.P.;b,c$:N.EL.N. |
|
[ Log in to reply ] |
|
VinceH |
Message #80013, posted by VincceH at 10:39, 10/9/2006, in reply to message #80012 |
Lowering the tone since the dawn of time
Posts: 1600
|
DIMa 256:F.b=1TO255:!a=0:SYS&20009,7,b,a,,,255TO,,c$:IFa!0TH.P.;b,c$:N.EL.N. Tsk. I fired up VRPCSESATLAETC just to run that, wondering what exciting and original and very clever thing it does. |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #80015, posted by Phlamethrower at 10:44, 10/9/2006, in reply to message #80013 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
Just because it's not exciting, original, or very clever, it doesn't mean it's not useful |
|
[ Log in to reply ] |
|
ninjah |
Message #80045, posted by ninj at 00:33, 11/9/2006, in reply to message #80015 |
Member
Posts: 288
|
Obfuscated BBC BASIC; ye gads. And I thought Perl was bad
But yes, very useful. Well done. |
|
[ Log in to reply ] |
|
Adrian Lees |
Message #80057, posted by adrianl at 12:20, 11/9/2006, in reply to message #80045 |
Member
Posts: 1637
|
Obfuscated BBC BASIC; ye gads. And I thought Perl was bad
But yes, very useful. Well done. It wasn't obfuscated. That's just the way writes code |
|
[ Log in to reply ] |
|
Tony Haines |
Message #80059, posted by Loris at 18:06, 11/9/2006, in reply to message #80012 |
Ha ha, me mine, mwahahahaha
Posts: 1025
|
DIMa 256:F.b=1TO255:!a=0:SYS&20009,7,b,a,,,255TO,,c$:IFa!0TH.P.;b,c$:N.EL.N. Hmmm. So it sets up a 256 byte array, then loops 255 times, calling a mystery swi which takes args: R0 7, R1 loop counter/value, R2 array pointer, R3 [0], R4 [0], R5 255 (array size-1?)
and returns a string in R2, and presumably something in that array, in particular potentially a value in the first array word. Then it prints out the string if that word is non-zero. If I've counted correctly, bit 17 is set so it is the X form of swi 9 really, IIRC. What would that be? OS_Byte or OS_Word? I thought the first 256 or so just output a character, but then the rest of it doesn't make sense.
Um, nope, can't figure it out. |
|
[ Log in to reply ] |
|
Phil Mellor |
Message #80060, posted by monkeyson2 at 18:11, 11/9/2006, in reply to message #80059 |
Please don't let them make me be a monkey butler
Posts: 12380
|
I haven't run it, but my guess is that it shows a list of open files and their handles. |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #80061, posted by Phlamethrower at 18:21, 11/9/2006, in reply to message #80060 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
That monkey sure knows his SWI numbers
Of course it won't work for file handles >255, but that's the price to pay if you've written some code that's left a file handle open |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #80062, posted by Phlamethrower at 18:49, 11/9/2006, in reply to message #80061 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
This one might be a bit more obvious, but it includes a trick I forgot about in the first one
DIMa 20:F.b=0TO255:!a=16:SYS&6120F,b,a+4,a TO;c:IF(c A.1)=0P.;b,(a?6*256+a?7):N.EL.N. |
|
[ Log in to reply ] |
|
|
Acorn Arcade forums: Programming: One-line BASIC program for the day |