* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: Having some fun, you can join too  (Read 3031 times)

0 Members and 2 Guests are viewing this topic.

Offline Streetwalrus

  • Professional slacker
  • Super User
  • Original 5
  • Join Date: Nov 2014
  • Location: Israel
  • Posts: 2903
  • Post Rating Ratio: +20/-0
  • ƎW∀⅁ ƎH⊥
  • Gender: Male
Re: Having some fun, you can join too
« Reply #30 on: March 29, 2017, 03:43:31 pm »
Yeah fair enough. It still allowed me to see a bit of a pattern, especially for the nesting.
  • Calculators owned: TI-80, HP 40G, TI-84 Plus rev G (yay 128k RAM), TI-83 Plus Silver Edition (broken LCD), TI-82 Stats.fr (black), TI-Nspire CX rev C (yay Nlaunchy), TI-83+ SE ViewScreen



Offline aeTIos

  • Dabbler in C
  • Super User
  • Original 5
  • Join Date: Nov 2014
  • Location: Ede, NL
  • Posts: 1049
  • Post Rating Ratio: +12/-0
  • hi
    • r_vdijk
    • /u/aetios
    • aetios
  • Gender: Male
Re: Having some fun, you can join too
« Reply #31 on: March 29, 2017, 03:52:59 pm »
So if I understand correctly, () just stands for Ans?
ceci n'est pas une signature

Offline Streetwalrus

  • Professional slacker
  • Super User
  • Original 5
  • Join Date: Nov 2014
  • Location: Israel
  • Posts: 2903
  • Post Rating Ratio: +20/-0
  • ƎW∀⅁ ƎH⊥
  • Gender: Male
Re: Having some fun, you can join too
« Reply #32 on: March 29, 2017, 05:11:08 pm »
Yeah, pretty much.

So here's a first attempt:
Code: [Select]
#!/usr/bin/env python3

haxmap = {
    "/()/()": "1",
    "+()": "*2",
    "+(+())": "*3",
    "*()": "**2",
    "*(*())": "**3",
    "+(/())": "+1"
}

hax = "/()/()+(+())*()+()*()+(+())+(/())+(+(+())+())+(/())+(+())+(+())+(/())->{/()/()+()+(+())*()+(+())*()+(+())}^^r/()/()+()*()+(+())+(/())*()+(+())+(+()+())+(/())+(+(+())+())->{/()/()+(+())*()+()*(*())+(+())+(/())+()}^^r/()/()+(+())*()+()*()+(+())+(/())+(+(+())+())+(/())+(+())+(+())->{/()/()+(+())*(*())+()*()+(+())+(/())+()+()}^^r/()/()+()+(+(+())+())*()+(/())+()+(+())+(+()+())+(/())+(+())+(/())->{/()/()+(+())*()+()*(*())+(/())+()+(+())}^^r/()/()+()*()*()*(*())+(/())+(/())+(/())+(+(+()+())+())->{/()/()+(+()+())*()+()*()+()+(+(+())+())}^^r/()/()+()+(+()+())*()+()+(/())+()+(/())+()+()+()+()+(/())+()+()+()->{/()/()+(+()+())*()+()*()+(+(+())+())+(/())+()}^^r(/()/()+()+(+())*()+(+())*()+(+()))()"
decodedhax = ""

while hax:
    for pattern, op in haxmap.items():
        if hax.startswith(pattern):
            decodedhax += op
            hax = hax[len(pattern):]
            break
    else:
        decodedhax += hax[0]
        hax = hax[1:]

print(decodedhax)

The first line decodes to the following (after adding new lines where it makes sense :P):
Code: [Select]
1*3**2*2**2*3+1+(*3*2)+1*3*3+1->{1*2*3**2*3**2*3}^^r
1*2**2*3+1**2*3+(*2*2)+1+(*3*2)->{1*3**2*2**3*3+1*2}^^r
1*3**2*2**2*3+1+(*3*2)+1*3*3->{1*3**3*2**2*3+1*2*2}^^r
1*2+(*3*2)**2+1*2*3+(*2*2)+1*3+1->{1*3**2*2**3+1*2*3}^^r
1*2**2**2**3+1+1+1+(+(*2*2)*2)->{1+(*2*2)**2*2**2*2+(*3*2)}^^r
1*2+(*2*2)**2*2+1*2+1*2*2*2*2+1*2*2*2->{1+(*2*2)**2*2**2+(*3*2)+1*2}^^r
(1*2*3**2*3**2*3)()

Which can be interpreted (by hand) as:
Code: [Select]
0xEF7D->{0x88B0}^^r
0x4558->{0x88B2}^^r
0xEF7C->{0x88B4}^^r
0x4546->{0x88B6}^^r
0xB021->{0x88B8}^^r
0xC988->{0x88BA}^^r
(0x88B0)()

So I'm seeing a pattern here already. We're placing code at 0x88B0 and then calling it. :P

Disassembly:
Code: [Select]
ld a, l
b_call(HomeUp) ; Not sure about this one
ld a, h
b_call(ClrScrnFull) ; Now we're talking
ld hl, 0x88B0
ret

Not 100% sure what the hell that is for, besides clearing the screen. I'm far from being done.
« Last Edit: March 29, 2017, 06:00:40 pm by Streetwalrus »
  • Calculators owned: TI-80, HP 40G, TI-84 Plus rev G (yay 128k RAM), TI-83 Plus Silver Edition (broken LCD), TI-82 Stats.fr (black), TI-Nspire CX rev C (yay Nlaunchy), TI-83+ SE ViewScreen



Offline Snektron

  • Lvl 69 Russian Snake
  • Super User
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3165
  • Post Rating Ratio: +32/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • quantuminfinity
  • Gender: Male
Re: Having some fun, you can join too
« Reply #33 on: March 29, 2017, 05:25:26 pm »
Using wabbitemu's debugger i found this disassembly:

Code: [Select]
ld a, l
bcall(_HomeUp)
ld a,h
bcall(_ClrScrnFull)
ld hl, 0x88B0
ret

  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Offline Streetwalrus

  • Professional slacker
  • Super User
  • Original 5
  • Join Date: Nov 2014
  • Location: Israel
  • Posts: 2903
  • Post Rating Ratio: +20/-0
  • ƎW∀⅁ ƎH⊥
  • Gender: Male
Re: Having some fun, you can join too
« Reply #34 on: March 29, 2017, 06:00:53 pm »
You're right, I got one byte wrong. Fixed it.
  • Calculators owned: TI-80, HP 40G, TI-84 Plus rev G (yay 128k RAM), TI-83 Plus Silver Edition (broken LCD), TI-82 Stats.fr (black), TI-Nspire CX rev C (yay Nlaunchy), TI-83+ SE ViewScreen



Offline Streetwalrus

  • Professional slacker
  • Super User
  • Original 5
  • Join Date: Nov 2014
  • Location: Israel
  • Posts: 2903
  • Post Rating Ratio: +20/-0
  • ƎW∀⅁ ƎH⊥
  • Gender: Male
Re: Having some fun, you can join too
« Reply #35 on: March 29, 2017, 06:58:39 pm »
(This should be alright for a double post)

Alright, second line:
Code: [Select]
1*3**3+1+1**2*3+1+(*3*2)->{1*3**2*2**3*3+1*2}^^r
1*3**3+1+1**2*3+1+(*3*2)->{1*3**2*2**3+1*2*3}^^r
1*2*3**2*3**2*3

AKA:
Code: [Select]
0x4504->{0x88B2}^^r
0x4504->{0x88B6}^^r
0x88B0

Our disassembly becomes:
Code: [Select]
ld a, l
b_call(PutC)
ld a, h
b_call(PutC)
ld hl, 0x88B0
ret



Line 3:
Code: [Select]
()(1*2*3**2**2+(*2*2)+1+1*2*2)
Or:
Code: [Select]
()(0x6548)
So we call our little saferam routine, abusing HL once more to pass it 'H' (0x48) and e (0x65).



Line 4:
Code: [Select]
()(1*2**2**2**2+1*2*2*3*3*3)
Code: [Select]
()(0x6C6C)
"ll"



Line 5:
Code: [Select]
()(1*2*3**2+1*2*2*2*2+1*2+(*3*2)+1)
Code: [Select]
()(0x206F)
"o "



Line 6:
Code: [Select]
()(1+(*2*2)**2*3+1+(*2*2)+(*2*2)+(*2*2)+1*3)
Code: [Select]
()(0x6F57)
"Wo"



Line 7:
Code: [Select]
()(1*2**2**2**2+1*2*3*3+1*2*3)
Code: [Select]
()(0x6C72)
"rl"



And finally, line 8:
Code: [Select]
(+(/()*2*2))(1*2**2**2*2+(*2*2)**2)
Code: [Select]
(+4)(0x6400)
Here we skip the first 4 bytes (ld a, l // b_call(PutC)) of the routine, and load H with the character 'd' for the finale.



And we have our result on screen: "Hello World".

That was a beautiful hack and a very fun challenge, @Hayleia, thanks a lot. :D
« Last Edit: March 29, 2017, 07:07:22 pm by Streetwalrus »
  • Calculators owned: TI-80, HP 40G, TI-84 Plus rev G (yay 128k RAM), TI-83 Plus Silver Edition (broken LCD), TI-82 Stats.fr (black), TI-Nspire CX rev C (yay Nlaunchy), TI-83+ SE ViewScreen



Offline Hayleia

  • Full User
  • Join Date: Nov 2014
  • Location:
  • Posts: 324
  • Post Rating Ratio: +12/-0
Re: Having some fun, you can join too
« Reply #36 on: March 29, 2017, 07:15:37 pm »
Hehe, well done :D

That was a beautiful hack and a very fun challenge, @Hayleia, thanks a lot. :D
Well if you're not fed up with this, you could try to produce the same output with the same restrictions but with less characters :P
For example, IAMISSAM on TI Planet noticed that the first /() is useless. And indeed, I only put two of them to be sure I get 1 so that the following calculation gives what I want... except that there is a *() not so far from there, so it works with -1 too. And there are probably other ways to save space, not sure how yet but probably. Like not using the same ram area for the asm code but one that is shorter to get, if that exists.

Offline Streetwalrus

  • Professional slacker
  • Super User
  • Original 5
  • Join Date: Nov 2014
  • Location: Israel
  • Posts: 2903
  • Post Rating Ratio: +20/-0
  • ƎW∀⅁ ƎH⊥
  • Gender: Male
Re: Having some fun, you can join too
« Reply #37 on: March 29, 2017, 07:25:09 pm »
Yep, maybe I'll take a look at it tomorrow. I've had enough of this one for tonight, hehe.
  • Calculators owned: TI-80, HP 40G, TI-84 Plus rev G (yay 128k RAM), TI-83 Plus Silver Edition (broken LCD), TI-82 Stats.fr (black), TI-Nspire CX rev C (yay Nlaunchy), TI-83+ SE ViewScreen



 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games