Author Topic: Count to 10,000 in ASM  (Read 9290 times)

0 Members and 1 Guest are viewing this topic.

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Count to 10,000 in ASM
« Reply #15 on: February 18, 2012, 11:31:15 am »
You might wanna skip frames :)
If you like my work: why not give me an internet?








Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Count to 10,000 in ASM
« Reply #16 on: February 18, 2012, 11:32:56 am »
Too bad I do not have a compiler. I just want the program for the calc to stop when it gets to 10,000 , without displaying the number.

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Count to 10,000 in ASM
« Reply #17 on: February 18, 2012, 11:42:08 am »
Why don't you use axe? You'll get a less optimized, but decent asm program.
Code: [Select]
0->C
While C+1->C-10000
End
Disp "Finished"
My TI 83+ does that in less than a second.

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Count to 10,000 in ASM
« Reply #18 on: February 18, 2012, 11:43:38 am »
and if you use TI-84+ speed, it's 2.5 times faster than TI 83+ does, so... you do the math XD
Sig wipe!

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Count to 10,000 in ASM
« Reply #19 on: February 18, 2012, 11:54:45 am »
How many seconds does it take for it to get to 100,000 in Axe? I can't calculate it because all you said was "less than a second."

BTW, what does the -> mean in Axe?

EDIT: Could you send me the .8xp?
« Last Edit: February 18, 2012, 11:57:32 am by nxtboy III »

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Count to 10,000 in ASM
« Reply #20 on: February 18, 2012, 11:57:00 am »
it's actually →, which is used for storing.
also, axe only goes up to 65535. D:
Sig wipe!

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Count to 10,000 in ASM
« Reply #21 on: February 18, 2012, 12:00:47 pm »
Ok, then make it count to 60,000.

EDIT: So I guess Axe can only handle 16-bit values. The max for a 16-bit value on my NXT is also 65535, if it is unsigned (Can only be a postitive number). But the NXT can handle 32-bit values. The max for an unsigned 32-bit value is 4294967295.
« Last Edit: February 18, 2012, 12:04:30 pm by nxtboy III »

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Count to 10,000 in ASM
« Reply #22 on: February 18, 2012, 12:05:01 pm »
My TI 83+ takes 1.39 seconds from 0 to 60000 (interrupts turned off).
« Last Edit: February 18, 2012, 12:05:59 pm by MGOS »

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Count to 10,000 in ASM
« Reply #23 on: February 18, 2012, 12:06:24 pm »
My NXT takes about 1.5 seconds to count from 60000 to 0.

EDIT: Actually, it takes about 2.2 seconds.
« Last Edit: February 18, 2012, 12:10:01 pm by nxtboy III »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Count to 10,000 in ASM
« Reply #24 on: February 18, 2012, 02:40:05 pm »
The reason why nxtboy III asked this program is because he wanted to compare the speed of the LEGO Mindstorm NXT with the TI-84 Plus. Assuming his Mindstorm program did not display a counter or update the LCD until the very end, then it seems like the 84+ is much faster despite being 15 MHz instead of over 40.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Count to 10,000 in ASM
« Reply #25 on: February 18, 2012, 03:14:05 pm »
My NXT takes about 1.5 seconds to count from 60000 to 0.

EDIT: Actually, it takes about 2.2 seconds.

Did you make sure to turn off whatever OS overhead the lego thing has and write the test in a compiled language? The z80 is a very old chip, so I'd be a bit surprised if the more modern chip in an NXT is beaten by it.

EDIT:

??? Are you sure it can count to 10,000 in about 1/30th of a second?
That seems super fast.......


The z80 in an 84+ is running at around 15MHz in full speed. That's 15 million cycles per second, which gives a couple million operations per second. counting to 10,000 in a fraction of a second seems a lot more reasonable in that light. Also, counting isn't the best way to compare CPUs. More modern CPUs are going to be able to take advantage of counter hardware or very, very fast ALUs.
« Last Edit: February 18, 2012, 03:19:48 pm by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Count to 10,000 in ASM
« Reply #26 on: February 18, 2012, 05:42:42 pm »
I don't think there is a way to turn off the OS overhead, unless it already does.
Well the NXT's processor runs at 48 Mhz, though it seems slower.

What's an ALU?

EDIT: Looked it up. The ALU is the part that calculates math stuff.
« Last Edit: February 18, 2012, 06:06:32 pm by nxtboy III »

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Count to 10,000 in ASM
« Reply #27 on: February 18, 2012, 06:08:25 pm »
Looks like the NXT has an ARM7 chip inside. I can pretty much guarantee that an ARM7 at 48 MHz is faster than the z80 in the 84+. It's RISC, it has a real pipeline, caching, etc. If it's indeed an ARM7, then there's no real need to do anything more than compile this in with whatever your favorite NXT C/C++ compiler is and compare it to the Axe code given previously.

Code: [Select]
#include <stdio.h>
int main(){
  a=60000;
  while(a){
    a=a-1;
  }
  printf("Done\n");
  return 0;
}

Edit: Forgot main()...
« Last Edit: February 18, 2012, 06:09:39 pm by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Count to 10,000 in ASM
« Reply #28 on: February 18, 2012, 06:15:05 pm »
Well... That's not exactly how to program it but I made a program that basically does that, and it goes slower than the calc. It would be better if I had a .8xp that does that for the calc so I can test it. Could someone post a .8xp for that?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Count to 10,000 in ASM
« Reply #29 on: February 19, 2012, 02:29:46 am »
Well the above code is written in C so someone would need to turn it in Z80.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)