Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    292
  • comments
    557
  • views
    154547

CURSE YOU! CURSE YOU! CURSE YOU! CURSE YOU! CURSE

Sign in to follow this  
TANSTAAFL

142 views

And what is THIS?

0200 GOTO 212
0202 DATA 8D8D
0204 GOSUB 0A9
0206 SKIPIF V1==39
0208 SKIPIF V9==30
020A GOSUB 052
020C DATA 5454
020E GOSUB 08E
0210 VE=V0
0212 GOSUB 4B6
0214 GOSUB 4DA
0216 V0=0F
0218 SKIPIF KEYUP(V0)
021A GOTO 224
021C V0=0E
021E SKIPIF KEYUP(V0)
0220 GOTO 228
0222 GOTO 216
0224 GOSUB 4DA
0226 GOTO 22C
0228 CLS
022A GOTO 22C
022C V1=RND(1F)
022E V1+=10
0230 V2=RND(0F)
0232 V2+=08
0234 V3=RND(03)
0236 V5=V3
0238 V6=V1
023A V7=V2
023C V8=V3
023E SKIPIF V8!=00
0240 V7+=01
0242 SKIPIF V8!=01
0244 V7+=FF
0246 SKIPIF V8!=02
0248 V6+=01
024A SKIPIF V8!=03
024C V6+=FF
024E I=54C
0250 DRAW(V1,V2,1)
0252 DRAW(V6,V7,1)
0254 V4=F0
0256 V9=F1
0258 I=800
025A I+=V4
025C V0=V3
025E SAVE V0,V0
0260 V4+=01
0262 I=800
0264 I+=V4
0266 V0=01
0268 SAVE V0,V0
026A GOSUB 522
026C VA=00
026E VA+=00
0270 V0=DELAY
0272 SKIPIF V0==00
0274 GOTO 29C
0276 SKIPIF VD==00
0278 GOTO 294
027A V0=00
027C LOADFONT(V0)
027E DRAW(VB,VC,5)
0280 SKIPIF VF==01
0282 GOTO 28C
0284 DRAW(VB,VC,5)
0286 GOSUB 522
0288 DELAY=V0
028A GOTO 29C
028C DELAY=VE
028E VD=01
0290 VE=00
0292 GOTO 29C
0294 V0=VE
0296 LOADFONT(V0)
0298 DRAW(VB,VC,5)
029A GOSUB 522
029C V0=03
029E SKIPIF KEYUP(V0)
02A0 V3=00
02A2 V0=06
02A4 SKIPIF KEYUP(V0)
02A6 V3=01
02A8 V0=07
02AA SKIPIF KEYUP(V0)
02AC V3=02
02AE V0=08
02B0 SKIPIF KEYUP(V0)
02B2 V3=03
02B4 SKIPIF V3!=00
02B6 V2+=FF
02B8 SKIPIF V3!=01
02BA V2+=01
02BC SKIPIF V3!=02
02BE V1+=FF
02C0 SKIPIF V3!=03
02C2 V1+=01
02C4 I=54C
02C6 DRAW(V1,V2,1)
02C8 SKIPIF VF==01
02CA GOTO 324
02CC SKIPIF VD==01
02CE GOTO 388
02D0 V0=3F
02D2 V1&=V0
02D4 V0=1F
02D6 V2&=V0
02D8 V0=VB
02DA V0=V1-V0
02DC SKIPIF VF==01
02DE GOTO 388
02E0 V0=VB
02E2 V0+=03
02E4 V0-=V1
02E6 SKIPIF VF==01
02E8 GOTO 388
02EA V0=VC
02EC V0=V2-V0
02EE SKIPIF VF==01
02F0 GOTO 388
02F2 V0=VC
02F4 V0+=04
02F6 V0-=V2
02F8 SKIPIF VF==01
02FA GOTO 388
02FC V0=04
02FE SOUND=V0
0300 VE=RND(07)
0302 VE+=02
0304 VA+=VE
0306 I=54C
0308 DRAW(V1,V2,1)
030A V0=00
030C LOADFONT(V0)
030E DRAW(VB,VC,5)
0310 V0=VE
0312 LOADFONT(V0)
0314 DRAW(VB,VC,5)
0316 V0=30
0318 DELAY=V0
031A V0=DELAY
031C SKIPIF V0==00
031E GOTO 31A
0320 I=54C
0322 DRAW(V1,V2,1)
0324 SKIPIF V3!=V5
0326 GOTO 33E
0328 V4+=01
032A I=800
032C I+=V4
032E V0=V3
0330 SAVE V0,V0
0332 V4+=01
0334 I=800
0336 I+=V4
0338 V0=00
033A SAVE V0,V0
033C V5=V3
033E I=800
0340 I+=V4
0342 LOAD V0,V0
0344 V0+=01
0346 SAVE V0,V0
0348 SKIPIF VA!=00
034A GOTO 358
034C V0=0C
034E V0+=FF
0350 SKIPIF V0==00
0352 GOTO 34E
0354 VA+=FF
0356 GOTO 270
0358 I=54C
035A DRAW(V6,V7,1)
035C SKIPIF V8!=00
035E V7+=FF
0360 SKIPIF V8!=01
0362 V7+=01
0364 SKIPIF V8!=02
0366 V6+=FF
0368 SKIPIF V8!=03
036A V6+=01
036C I=800
036E I+=V9
0370 LOAD V0,V0
0372 V0+=FF
0374 SAVE V0,V0
0376 SKIPIF V0==00
0378 GOTO 270
037A V9+=01
037C I=800
037E I+=V9
0380 LOAD V0,V0
0382 V8=V0
0384 V9+=01
0386 GOTO 270
0388 V0=0D
038A SOUND=V0
038C V0=0B
038E SKIPIF KEYDOWN(V0)
0390 GOTO 38E
0392 VB=01
0394 VC=00
0396 VD=00
0398 VB+=01
039A SKIPIF VB==0A
039C GOTO 3AA
039E VB=00
03A0 VC+=01
03A2 SKIPIF VC==0A
03A4 GOTO 3AA
03A6 VC=00
03A8 VD+=01
03AA I=54C
03AC DRAW(V6,V7,1)
03AE SKIPIF V8!=00
03B0 V7+=FF
03B2 SKIPIF V8!=01
03B4 V7+=01
03B6 SKIPIF V8!=02
03B8 V6+=FF
03BA SKIPIF V8!=03
03BC V6+=01
03BE I=800
03C0 I+=V9
03C2 LOAD V0,V0
03C4 V0+=FF
03C6 SAVE V0,V0
03C8 SKIPIF V0==00
03CA GOTO 398
03CC SKIPIF V9!=V4
03CE GOTO 3DE
03D0 V9+=01
03D2 I=800
03D4 I+=V9
03D6 LOAD V0,V0
03D8 V8=V0
03DA V9+=01
03DC GOTO 398
03DE CLS
03E0 V6=11
03E2 V7=09
03E4 V8=2F
03E6 V9=17
03E8 I=552
03EA DRAW(V6,V7,E)
03EC DRAW(V8,V7,E)
03EE V7+=FF
03F0 I=54E
03F2 DRAW(V6,V7,1)
03F4 DRAW(V6,V9,1)
03F6 V6+=08
03F8 DRAW(V6,V7,1)
03FA DRAW(V6,V9,1)
03FC V6+=08
03FE DRAW(V6,V7,1)
0400 DRAW(V6,V9,1)
0402 V6+=08
0404 I=550
0406 DRAW(V6,V7,1)
0408 DRAW(V6,V9,1)
040A I=59E
040C V6=13
040E V7=11
0410 GOSUB 49A
0412 I=5AE
0414 LOAD V0,V3
0416 SKIPIF V3!=VD
0418 GOTO 424
041A V0=V3
041C V0-=VD
041E SKIPIF VF==01
0420 GOTO 43A
0422 GOTO 444
0424 SKIPIF V2!=VC
0426 GOTO 432
0428 V0=V2
042A V0-=VC
042C SKIPIF VF==01
042E GOTO 43A
0430 GOTO 444
0432 V0=V1
0434 V0-=VB
0436 SKIPIF VF==00
0438 GOTO 444
043A I=5AE
043C V3=VD
043E V2=VC
0440 V1=VB
0442 SAVE V0,V3
0444 I=5AE
0446 LOAD V0,V3
0448 V6=13
044A V7+=F9
044C VD=V3
044E VC=V2
0450 VB=V1
0452 I=5A4
0454 GOSUB 49A
0456 V1=RND(3F)
0458 V2=RND(1F)
045A V0=0D
045C V0-=V1
045E SKIPIF VF==00
0460 GOTO 47C
0462 V0=30
0464 V0=V1-V0
0466 SKIPIF VF==00
0468 GOTO 47C
046A V0=03
046C V0-=V2
046E SKIPIF VF==00
0470 GOTO 47C
0472 V0=18
0474 V0=V2-V0
0476 SKIPIF VF==00
0478 GOTO 47C
047A GOTO 482
047C V3=RND(0F)
047E LOADFONT(V3)
0480 DRAW(V1,V2,5)
0482 V0=0F
0484 SKIPIF KEYUP(V0)
0486 GOTO 490
0488 V0=0E
048A SKIPIF KEYUP(V0)
048C GOTO 496
048E GOTO 456
0490 CLS
0492 GOSUB 4B6
0494 GOTO 22C
0496 CLS
0498 GOTO 22C
049A DRAW(V6,V7,5)
049C I=5AA
049E V6+=02
04A0 DRAW(V6,V7,4)
04A2 LOADFONT(VD)
04A4 V6+=0A
04A6 DRAW(V6,V7,5)
04A8 LOADFONT(VC)
04AA V6+=05
04AC DRAW(V6,V7,5)
04AE LOADFONT(VB)
04B0 V6+=05
04B2 DRAW(V6,V7,5)
04B4 RETURN
04B6 I=54E
04B8 V1=00
04BA V2=00
04BC V6=1F
04BE DRAW(V1,V2,1)
04C0 DRAW(V1,V6,1)
04C2 V1+=08
04C4 SKIPIF V1==40
04C6 GOTO 4BE
04C8 I=552
04CA V2=01
04CC V5=3F
04CE DRAW(V1,V2,F)
04D0 DRAW(V5,V2,F)
04D2 V2+=0F
04D4 DRAW(V1,V2,F)
04D6 DRAW(V5,V2,F)
04D8 RETURN
04DA V1=0C
04DC V2=07
04DE I=562
04E0 DRAW(V1,V2,A)
04E2 I=56C
04E4 V1+=06
04E6 DRAW(V1,V2,A)
04E8 I=576
04EA V1+=06
04EC DRAW(V1,V2,A)
04EE I=56C
04F0 V1+=06
04F2 DRAW(V1,V2,A)
04F4 I=580
04F6 V1+=06
04F8 DRAW(V1,V2,A)
04FA I=56C
04FC V1+=06
04FE DRAW(V1,V2,A)
0500 V1=0E
0502 V2=18
0504 I=58A
0506 DRAW(V1,V2,3)
0508 I=58E
050A V1+=08
050C V2+=FF
050E DRAW(V1,V2,4)
0510 V1+=09
0512 V2+=FE
0514 I=592
0516 DRAW(V1,V2,6)
0518 V1+=06
051A V2+=01
051C I=598
051E DRAW(V1,V2,5)
0520 RETURN
0522 VD=C5
0524 VB=RND(3F)
0526 VE=VB
0528 VE+=VD
052A SKIPIF VF!=01
052C GOTO 524
052E VB+=01
0530 VD=E6
0532 VC=RND(1F)
0534 VE=VC
0536 VE+=VD
0538 SKIPIF VF!=01
053A GOTO 532
053C VC+=01
053E VD=00
0540 VE=RND(3F)
0542 VE+=40
0544 DELAY=VE
0546 VE=RND(3F)
0548 VE+=40
054A RETURN
054C DATA 8000
054E DATA FF00
0550 DATA FE00
0552 DATA 8080
0554 DATA 8080
0556 DATA 8080
0558 DATA 8080
055A DATA 8080
055C DATA 8080
055E DATA 8080
0560 DATA 8080
0562 DATA 1F10
0564 DATA 1010
0566 DATA 1F01
0568 DATA 0101
056A DATA 011F
056C DATA 1111
056E DATA 1111
0570 DATA 1F04
0572 DATA 0404
0574 DATA 0404
0576 DATA 1F01
0578 DATA 0202
057A DATA 0404
057C DATA 0808
057E DATA 101F
0580 DATA 1F11
0582 DATA 1010
0584 DATA 1013
0586 DATA 1111
0588 DATA 111F
058A DATA 0505
058C DATA 0200
058E DATA 7151
0590 DATA 5175
0592 DATA 0C12
0594 DATA 1E14
0596 DATA 1209
0598 DATA 143E
059A DATA 1515
059C DATA 2A00
059E DATA 7744
05A0 DATA 2414
05A2 DATA 7700
05A4 DATA 5752
05A6 DATA 7252
05A8 DATA 5700
05AA DATA 0001
05AC DATA 0001
05AE DATA 0000
05B0 DATA 0000




...why, it's disassembled CHIP8 code for a game called syzygy!

Who disassembled it? ME!

What disassembler did I use? I MADE MY OWN!

Why? &%&^%$ING JOHN HATTAN!

[shakes fist]



As you can tell from the dump (if you give it more than a simple once over and apply the logic you already know from programming whatever it is you happen to program), it needs some help. For one thing, it needs to get better at determining which areas are "program" and which are "data". At the start of this program, there is a GOTO 212, which is then followed by 7 lines which do not make any sense.

The last section (54C and above) is also data, but right now I just have it hacked so that I specify where in the program the data area starts.

Sign in to follow this  


3 Comments


Recommended Comments

Dang, that's the most readable assembly language I've ever seen. Your gosubs are still in hex, though.

The chip8 interpreter in Flash (or Java) is still the way to go. With just a little work, you could make the smallest possible emulator, both in screen and code size --about the size of a large icon. Since the actual programs are 1 or 2k, you could pass the program to the interpreter as a command-parameter in the HTML.

The object would then be to see how many chip8 games you could get on a web page running simultaneously. Also how many you could *play* simultaneously.

Share this comment


Link to comment
I didn't like the assembly language I saw used for CHIP8, so I did what any right thinking person would do (presuming a right thinking person would make a CHIP8 disassembler in the first place). I cobbled together a BASICesque language that borrowed C/C++ operators. End result is way more readable, and rigid enough so that I'll be able to put together an assembler later.

I'll be changing one of them, LOADFONT(Vx), to I=FONT(Vx).

Also, in order to detect the "code" and "data" sections, I'm going to have to send the code through a "virtual run"(deliberately take every goto and gosub), and mark the lines as code.

Also, I don't see a need for all of the line number, nor having to write code with line numbers. Seems to me labels will do just as well, so I'll write code that determines where the GOTOs and GOSUBs actually go, and put labels on them (just a simple label when disassembling, like ".LABEL1".

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!