I have 2 questions:

1. where is that 10-lines BASIC contest, and can I still enter ?

2. regarding your statement:
> My original goal was to implement 2048 on the 100,
> which I might still do, just not in 10 lines
Implementing 2048 ???

Greetings from the TyRannoSaurus / Jan-80@work

-----Original Message-----
From: M100 [mailto:m100-boun...@lists.bitchin100.com] On Behalf Of Josh Malone
Sent: woensdag 31 januari 2018 04:52
To: m...@bitchin100.com
Subject: Re: [M100] BASIC syntax question

Wow. That's super clever. I had actually read the rules as
"self-written" equating to any ML code that I wrote. So, it was legal
to call ROM routines, but not legal to embed my own ML. But, maybe I'm
wrong. It's clearly translated from German so reading the true intent
is difficult.

In either case, I found a better way to write my routine but
eventually realized that what I wanted to do wouldn't fit in 10 lines
no matter what. (My original goal was to implement 2048 on the 100,
which I might still do, just not in 10 lines). I'm *super* ignorant of
ML stuff on the 100 so seeing your test code would be very cool.

I'm shooting for the PUR-80 category, since the M100 only has a
built-in BASIC anyway :)

Thanks for the pointers!

-Josh

On Tue, Jan 30, 2018 at 10:10 PM, Ken Pettit <petti...@gmail.com> wrote:
> Josh,
>
> Turns out it actually *IS* possible to execute code past the end of an ELSE
> block from the IF cod block.  And I believe it doesn't violate the
> programming contest rules.  If you are very careful that is.
>
> The Rules state:
>
> 2. The 10 lines must not contain any self-written machine programs
> 3. All code must be visible in the listing: self-modifying code or hidden
> initializations are not allowed
>
> So running a machine language routine is okay as long as it is not
> self-written or self-modifying.  Initializing A$="blah" with a 5 byte ML
> routine and then jumping to it should be okay, so long as it doesn't modify
> anything.  Given this, it is possible to use a CALL instruction as the last
> operation in an IF statement and have it skip over the ELSE code.
>
> A CALL operation will push the address of the next BASIC instruction to be
> executed to the stack (normally held in HL) prior to executing the CALL.
> You can pass parameters in A and HL as part of the CALL instruction.  So the
> idea is to pre-calculate the number of bytes the ELSE code occupies and then
> simply skip it by popping that "next instruction address" from the stack,
> adding to it and simply returning.  A DAD D or DAD B instruction would be
> needed, but these don't actually *appear* in the listing and can't be used.
> But there is a DAD D, RET at address 4598H that can be used.  So the ML code
> in A$ would be:
>
>     POP D         Pop ret address
>     POP D         Get BASIC line address       (These are all characters
> that will "appear" in a listing of the program.)
>     JMP 4598H
>
> 4598H:
>     DAD D       Add offset to BASIC line
>     RET           Return to BASIC execution at new line location
>
> Then issue a CALL 0,offset BASIC instruction.  The only tricky part is to
> get "offset" right or the BASIC intrepreter will get lost in it's parsing of
> the code.  I tested this out with a simple program that I could provide.
>
> Ken
>
>
> On 1/30/18 6:16 PM, John R. Hogerhuis wrote:
>>
>> Download some The Rainbow coco magazines online. They had a one liner
>> contest ongoing and they printed the winners to fill dead space in the
>> magazine. Lots of tricks there.
>>
>> Some things I can think of:
>>
>> Compute complicated logic and do one IF then else. Traditional Microsoft
>> basic is “unstructured” definitely no endif.
>> Use loops even if it’s kind of inappropriate since you can have multiple
>> loops in the same line.
>> Tail recursion with goto. Idea is that your single conditional is at the
>> end of the line and you go back to the same line or proceed to the next
>> line.
>> I think the Basic Stack is pretty limited for actual GOSUB recursion but
>> you could try it
>> Model 100 basic has some ability to create interrupt / events handlers.
>> For example, on serial data. I think maybe keys and timers too.
>> On goto / on GOSUB are good for major control flow.
>> I don’t know if your contest has limitations on embedded ML. Of course in
>> ml you can do any possible control flow.  You can embed machine code using
>> data statements or, more efficiently as static strings, dynamic strings or
>> REM statements.
>> Also there’s the ROM you can call into.
>>
>> — John.
>>
>>
>
VIVAQUA et HYDROBRU ont fusionné.
VIVAQUA est votre société d'eau en Région de Bruxelles-Capitale.

VIVAQUA en HYDROBRU zijn gefusioneerd.
VIVAQUA is uw waterbedrijf in het Brusselse Hoofdstedelijk Gewest.

[http://www.vivaqua.be/facebook.png] Rejoignez-nous sur Facebook - Volg ons op 
Facebook

DISCLAIMER
Pensez à l'environnement, n'imprimez cette page et ses annexes que si c'est 
nécessaire. Ce message électronique, y compris ses annexes, est confidentiel et 
réservé à l’attention de son destinataire.  Si vous n'êtes pas le destinataire 
de ce message, merci de le détruire et d’en informer l’expéditeur. Toute 
divulgation, copie ou utilisation de ce mail est dans ce cas interdite. La 
sécurité et l'exactitude des transmissions de messages électroniques ne peuvent 
être garanties.
Denk aan het milieu; druk deze pagina en de bijlagen alleen af als het nodig 
is. Dit e-mailbericht (inclusief zijn bijlagen) is vertrouwelijk en is 
uitsluitend bestemd voor de geadresseerde. Als dit bericht niet voor u bestemd 
is, wordt u verzocht het te wissen en de afzender te informeren. Het is in dat 
geval niet toegestaan dit bericht te verspreiden, te kopiëren of te gebruiken. 
We kunnen niet garanderen dat de gegevensoverdracht via het internet veilig en 
nauwkeurig is.

Reply via email to