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

0 Members and 1 Guest are viewing this topic.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Count to 10,000 in ASM
« on: February 18, 2012, 01:57:59 am »
Hi,
I was wondering if somebody could make me a .8xp in ASM that counts to 10,000 and displays the number it is on on the screen. This is so I can test the speed of my calc and compare it to other stuff.

Thanks, and have a nice day,
nxtboy III

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Count to 10,000 in ASM
« Reply #1 on: February 18, 2012, 10:39:29 am »
Well, you could use this, but how are you planning to test speed with it?
Quote from: Z80 Assembly
#include    "ti83plus.inc"
#define     progStart   $9D95
.org        progStart-2
.db         $BB,$6D
   bcall(_ClrLCDFull)
   bcall(_HomeUp)
    ld  HL, 0
Loop:
    push    HL
    bcall(_DispHL)
    bcall(_NewLine)
    pop     HL
    inc HL
    ld  DE, 10000
    xor A
    sbc HL, DE
    add HL, DE
    jr  nz, Loop
    ret
Generated by the BBify'r (http://clrhome.org/resources/bbify/)
But it's not very useful at all, since most of the time it takes is to display the number, so it's not much faster than doing it in TI-BASIC (left side is ASM, right side is BASIC):




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 #2 on: February 18, 2012, 10:43:11 am »
Is there a way to make it not display a new line each time? Just on the same line?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Count to 10,000 in ASM
« Reply #3 on: February 18, 2012, 10:48:22 am »
It would just keep going to the right, and after three numbers you wouldn't be able to see any more.




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 #4 on: February 18, 2012, 10:49:30 am »
Oh. Well I was doing this so I could test the speed between my NXT and my calc.

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 #5 on: February 18, 2012, 10:50:56 am »
maybe add extra clrLCDFull somewhere in the loop? even though it will slow things down? or set pencol or whatever it's called?
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 #6 on: February 18, 2012, 10:53:38 am »
I made a program for it on my NXT in assembly that counts and displays the number.(It displays the number in the same place the whole time.) It counts to 10,000 in about 4 seconds.

EDIT: i'm sorry. i accidentally hit the modify button instead of quote =/
*shmibs
« Last Edit: February 20, 2012, 01:50:39 am by shmibs »

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Count to 10,000 in ASM
« Reply #7 on: February 18, 2012, 11:07:00 am »
Without displaying numbers, an optimized z80 assembly loop structure could count to 10000 in about 1/30th of a second. Although I would not recommend comparing processor/language speed by seeing how fast they can count to 10000, simply because there are multiple variables that will skew the results an extreme amount; display or not, scroll or not, how fast the system text routine is, how the screen is updated, and so on. If you have a project in mind, I would say the best way to compare speed is simply to start coding the project for both platforms and compare simplified, test versions of them.
« Last Edit: February 18, 2012, 11:08:39 am by Runer112 »

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 #8 on: February 18, 2012, 11:08:58 am »
??? Are you sure it can count to 10,000 in about 1/30th of a second?
That seems super fast.......
Well, here it is for my NXT:(Sorry it's an avi)

For the calc one:
Could you edit the TI 84 program so it stops when it gets to 10,000?
« Last Edit: February 18, 2012, 11:09:18 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 #9 on: February 18, 2012, 11:15:57 am »
you could add this at the end of the loop: If Ans=10000:Stop
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 #10 on: February 18, 2012, 11:16:43 am »
Do you think you could add it and compile it to an 8xp for me? I don't know how.

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 #11 on: February 18, 2012, 11:17:58 am »
I don't have the source file XP
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 #12 on: February 18, 2012, 11:19:55 am »
Well there's this if this helps:

#include    "ti83plus.inc"
#define     progStart   $9D95
.org        progStart-2
.db         $BB,$6D
   bcall(_ClrLCDFull)
   bcall(_HomeUp)
    ld  HL, 0
Loop:
    push    HL
    bcall(_DispHL)
    bcall(_NewLine)
    pop     HL
    inc HL
    ld  DE, 10000
    xor A
    sbc HL, DE
    add HL, DE
    jr  nz, Loop
    ret

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 #13 on: February 18, 2012, 11:23:15 am »
oh. I thought you were asking about TI-BASIC file XD
sorry, I don't have a compiler.
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 #14 on: February 18, 2012, 11:24:00 am »
What about in BASIC?
Is there another easy way I can compare speed?


EDIT: My NXT counts to 1 million in about 39 seconds in assembly.
« Last Edit: February 18, 2012, 11:29:30 am by nxtboy III »