Author Topic: For those of us who dont know binary...  (Read 6819 times)

0 Members and 1 Guest are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: For those of us who dont know binary...
« Reply #15 on: January 21, 2011, 04:09:03 pm »
I've almost memorized it already

I'm gonna print that so I can remember it all the time, I don't feel like memorizing it.

Ashbad

  • Guest
Re: For those of us who dont know binary...
« Reply #16 on: January 21, 2011, 04:09:29 pm »
I've almost memorized it already

I'm gonna print that so I can remember it all the time, I don't feel like memorizing it.

^++

Offline z80man

  • Casio Traitor
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 977
  • Rating: +85/-3
    • View Profile
Re: For those of us who dont know binary...
« Reply #17 on: January 21, 2011, 05:45:08 pm »
If you don't know binary there is no reason why you can't learn now.
Lets start by reviewing the number system you're probaly used to, the decimal system. It is called the decimal system because there are ten digits. 0 1 2 3 4 5 6 7 8 9. Now you probaly write zero as 0 but for the time being lets call it 0000. ( this will help you with binary later) If you increment 0000 by 1 you get 0001. Now if you do this eight more times you will have 0009. Now we are going to call the digit on the far right the zero's place, the second to right the one's place and so on. The dilema you now face is that there is no digit above 9. (No 10 is not a digit!) So what you can do now is increment the digit to the left of nine to one and you reset the 9 back to zero. 0010. Hey look you got the number 10  ;D. Okay so you're probaly thinking I already know this, but to learn binary you need to go back to the basics and learn the fundamentals of all number systems.

Now lets start learning binary. It is called binary because there are two digits 0 and 1. So lets start at zero. You write zero in binary as 0000. Look it is the same thing in decimal. Binary is easy. And if you increment that. Yep you guessed right 0001 is the number one. Now we face an issue. We are all out of digits. So what do we do? We reset the furthest right digit and increment the one to its left. So you get 0010. Now this looks like the number ten but it is really two. Now if we keep on following thsi we get 0011 0100 0101 0110 0111 1000 ans so on. In binary we call each digit a bit. and 8 bits make a byte. In one unsigned (not negative) byte you can write numbers from 0 to 255. Hope you now know binary  :hyper:

Pop quiz:
1001 =
0011 + 0100 =
1100 - 0101 =
Spoiler For Answers:
9
7
7

List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: For those of us who dont know binary...
« Reply #18 on: January 22, 2011, 03:04:13 am »
Very nice.
As a side note:
Code: [Select]
0->B->C->D
For(A,0,15)
Pt-Off(0,A,{o}A)
End
DispGraph
Should give the same thing. (except for the randomness of whatever is in B, C, and D)
{o}=o

That is an amazingly neat piece of code!  I think

Code: [Select]
For(F,0,15
F->{F*12+L6}
End

might be smaller though ;)

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2897
  • Rating: +467/-17
    • View Profile
    • TI-Boy CE
Re: For those of us who dont know binary...
« Reply #19 on: January 22, 2011, 09:38:36 am »
Don't forget to "last answer" optimize :D
Code: [Select]
For(F,0,15
F->{*12+L6}
End
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: For those of us who dont know binary...
« Reply #20 on: January 22, 2011, 09:56:14 am »
O.O Holy...
Yeah, that's a lot more optimized. Thanks!
Code: [Select]
ClrDraw
For(F,0,15
F->{*12+L6}
End
DispGraph
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: For those of us who dont know binary...
« Reply #21 on: January 22, 2011, 03:03:40 pm »
Don't forget to "last answer" optimize :D
Code: [Select]
For(F,0,15
F->{*12+L6}
End

Bah, I  never remember the tricky optimizations :P

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: For those of us who dont know binary...
« Reply #22 on: January 22, 2011, 06:44:35 pm »
Code: [Select]
0->F
While -16
F->{*12+L6}
F+1->F
End
can't hurt to save a byte



Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: For those of us who dont know binary...
« Reply #23 on: January 22, 2011, 08:14:22 pm »
Code: [Select]
0->F
While -16
F->{*12+L6}
F+1->F
End
can't hurt to save a byte
OMG. That's insane!
I should just write it in ASM and post the hex.
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: For those of us who dont know binary...
« Reply #24 on: January 22, 2011, 08:27:59 pm »
Code: [Select]
0->F
While -16
F->{*12+L6}
F+1->F
End
can't hurt to save a byte
OMG. That's insane!
I should just write it in ASM and post the hex.

Code: [Select]
xor a
ld (plotsScreen), a
inc a
ld (plotsScreen+12), a
inc a
ld (plotsScreen+24), a
inc a
ld (plotsScreen+36), a
inc a
ld (plotsScreen+48), a
inc a
ld (plotsScreen+60), a
inc a
ld (plotsScreen+72), a
inc a
ld (plotsScreen+84), a
inc a
ld (plotsScreen+96), a
inc a
ld (plotsScreen+108), a
inc a
ld (plotsScreen+120), a
inc a
ld (plotsScreen+132), a
inc a
ld (plotsScreen+144), a
inc a
ld (plotsScreen+156), a
inc a
ld (plotsScreen+168), a
inc a
ld (plotsScreen+180), a

cause screw loops.
« Last Edit: January 22, 2011, 08:28:15 pm by nemo »


Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: For those of us who dont know binary...
« Reply #25 on: January 22, 2011, 08:34:07 pm »
Code: [Select]
ld bc,12
ld a,0
ld hl,plotsScreen
ld (hl),a
inc a
add hl,bc
cp 16
jr z,$-5 ;or maybe 6
« Last Edit: January 22, 2011, 08:34:34 pm by Binder News »
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2897
  • Rating: +467/-17
    • View Profile
    • TI-Boy CE
Re: For those of us who dont know binary...
« Reply #26 on: January 22, 2011, 08:39:59 pm »
Unscrew loops!
Code: [Select]
 ld b,15
  ld hl,plotsscreen+12*15
  ld de,-12
loop:
  ld (hl),b
  add hl,de
  djnz loop
  ld (hl),b
Edited due to directional failure
« Last Edit: January 22, 2011, 08:42:11 pm by calc84maniac »
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: For those of us who dont know binary...
« Reply #27 on: January 23, 2011, 02:35:04 am »
Lols its a battle of the wits

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: For those of us who dont know binary...
« Reply #28 on: January 23, 2011, 03:25:13 am »
Here are my best attempts. >:D

Axe (will become 6 bytes smaller if Quigibo implements an If :Goto auto-optimization):

Code: (28 bytes) [Select]
16
Lbl L
-1ā†’{*12+Lā‚†}
If {}
Goto L
End

Assembly (this moves the image down 2 rows and right 24 pixels for extreme optimization :P):

Code: (12 bytes) [Select]
ld hl,17*12+3+plotSScreen ;$940F
ld de,-12
ld b,l
loop:
ld (hl),b
add hl,de
djnz loop
ld (hl),b
« Last Edit: January 23, 2011, 03:35:41 am by Runer112 »