Author Topic: Assembly Programmers - Help Axe Optimize!  (Read 33612 times)

0 Members and 1 Guest are viewing this topic.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Assembly Programmers - Help Axe Optimize!
« Reply #15 on: March 14, 2010, 05:11:40 pm »
Thanks!  I'll try that :)

What about division?  Clearly I'll need more than just overhead since there's no overflow to loop around.  Is there a more efficient way to do than what I was originally planning with multiplication?
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline xlibman

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55807
  • Rating: +3148/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • CodeWalrus
Re: Assembly Programmers - Help Axe Optimize!
« Reply #16 on: March 14, 2010, 08:11:17 pm »
btw are you planning to provide the source code to some of the hardcore asm coders on this board eventually, in case some people might find some optimizations to make the compiled code smaller? That could maybe help too.
In case you are wondering where I went, I am still active in the TI community, but I left Omni back in 2015 for various  reasons. I might come back one day, depending of certain circumstances, but my new online home (despite me being Omnimaga founder in 2001) is now CodeWalrus ( https://codewalr.us ). Sorry for the inconveniences.

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Assembly Programmers - Help Axe Optimize!
« Reply #17 on: March 15, 2010, 01:44:10 pm »
Kind of.  I'm going to release all of my templated assembly code that the executable programs use, but I don't think I will release the source of the parser itself.  Right now, I'm not too worried about the optimizations.  Its the actual code of the Parser I am trying to finished first so I can release a beta, but I keep getting distracted by wantting to add more commands since they're relatively easier and more fun  :P
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Iambian

  • Coder Of Tomorrow
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 736
  • Rating: +213/-3
  • Cherry Flavoured Nommer of Fishies
    • View Profile
Re: Assembly Programmers - Help Axe Optimize!
« Reply #18 on: March 15, 2010, 02:02:31 pm »
I've got no clue whether or not you've seen this, but I think it might be of some help. http://map.grauw.nl/sources/external/z80bits.html

Will post later if something else catches my eye.
A Cherry-Flavored Iambian draws near... what do you do? ...

Offline xlibman

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55807
  • Rating: +3148/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • CodeWalrus
Re: Assembly Programmers - Help Axe Optimize!
« Reply #19 on: March 15, 2010, 05:46:22 pm »
Kind of.  I'm going to release all of my templated assembly code that the executable programs use, but I don't think I will release the source of the parser itself.  Right now, I'm not too worried about the optimizations.  Its the actual code of the Parser I am trying to finished first so I can release a beta, but I keep getting distracted by wantting to add more commands since they're relatively easier and more fun  :P
Never release the source to public before releasing the software, btw. If for example, you decide to post Axe 0.2 both on Omnimaga and Ticalc at the same time, wait until it makes it to ticalc archives before releasing the source. Better protection against code thieves.
In case you are wondering where I went, I am still active in the TI community, but I left Omni back in 2015 for various  reasons. I might come back one day, depending of certain circumstances, but my new online home (despite me being Omnimaga founder in 2001) is now CodeWalrus ( https://codewalr.us ). Sorry for the inconveniences.

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Assembly Programmers - Help Axe Optimize!
« Reply #20 on: March 15, 2010, 08:57:53 pm »
I've got no clue whether or not you've seen this, but I think it might be of some help. http://map.grauw.nl/sources/external/z80bits.html
Yeah, that's what I've been using, but it doesn't have many signed routines, just unsigned.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Assembly Programmers - Help Axe Optimize!
« Reply #21 on: March 15, 2010, 10:09:55 pm »
Hmmm it would seem so.  Is it really so much of a hassle to flip the negative bit, multiply/divide, then flip it again?  Seems trivial compared to any other modification, although i'm not an asm guy :P

Offline calc84maniac

  • Epic z80 roflpwner
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2887
  • Rating: +463/-17
    • View Profile
Re: Assembly Programmers - Help Axe Optimize!
« Reply #22 on: March 15, 2010, 11:08:03 pm »
Hmmm it would seem so.  Is it really so much of a hassle to flip the negative bit, multiply/divide, then flip it again?  Seems trivial compared to any other modification, although i'm not an asm guy :P
You can't just flip a bit. You have to subtract from zero.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Assembly Programmers - Help Axe Optimize!
« Reply #23 on: March 15, 2010, 11:15:32 pm »
Builderboy, you're thinking of a 1's compliment system where the last bit is just a sign bit.  2's compliment is a little bit different.  The advantage of 2's compliment system is that it is arithmetically (and apparently also multiplicitively) compatible with unsigned numbers.

By the way calcmaniac, your code didn't work.  I tried -1 times 1 and it returned a weird number.  But I was able to create my own routine after looking at some other code.  Its a little slower, but its roughly the same size as the original 8bit routine.
« Last Edit: March 15, 2010, 11:16:03 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline calc84maniac

  • Epic z80 roflpwner
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2887
  • Rating: +463/-17
    • View Profile
Re: Assembly Programmers - Help Axe Optimize!
« Reply #24 on: March 15, 2010, 11:41:33 pm »
By the way calcmaniac, your code didn't work.  I tried -1 times 1 and it returned a weird number.  But I was able to create my own routine after looking at some other code.  Its a little slower, but its roughly the same size as the original 8bit routine.
I just typed it in on my calculator and tried $ffff*$0001 and $0001*$ffff and both gave $ffff. Did you make a typo somewhere or something?
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Assembly Programmers - Help Axe Optimize!
« Reply #25 on: March 15, 2010, 11:48:02 pm »
I meant -1 times -1 sorry.  I just copied and pasted it btw.
« Last Edit: March 15, 2010, 11:48:54 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline calc84maniac

  • Epic z80 roflpwner
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2887
  • Rating: +463/-17
    • View Profile
Re: Assembly Programmers - Help Axe Optimize!
« Reply #26 on: March 15, 2010, 11:59:11 pm »
I tried -1*-1 and I ended up with 1. I dunno, maybe there's something going on with the underscore in the loop label? I've never really used that.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline calc84maniac

  • Epic z80 roflpwner
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2887
  • Rating: +463/-17
    • View Profile
Re: Assembly Programmers - Help Axe Optimize!
« Reply #27 on: March 16, 2010, 09:21:55 pm »
I just made optimized min/max routines that you can use :D
Code: [Select]
Min_HLDE:
 xor a
 sbc hl,de
 jr c,$+4
 ld h,a
 ld l,a
 add hl,de

Code: [Select]
Max_HLDE:
 xor a
 sbc hl,de
 jr nc,$+4
 ld h,a
 ld l,a
 add hl,de
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Assembly Programmers - Help Axe Optimize!
« Reply #28 on: March 16, 2010, 09:58:29 pm »
That's a cleaver trick!  But wouldn't something like this be simpler?

or a
sbc hl,de
add hl,de
jr nc,$+3
ex de,hl


But I'm trying to convert all of my math commands to signed operations anyway, so I would need to tweak it a bit.

I'm going to try your multiplication routine again and see if its smaller.  I think I forgot the ret at the end which might of been what screwed me up.

___Axe_Parser___
Today the calculator, tomorrow the world!

Offline AaroneusTheGreat

  • Moderator
  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 287
  • Rating: +26/-1
    • View Profile
Re: Assembly Programmers - Help Axe Optimize!
« Reply #29 on: March 16, 2010, 10:13:06 pm »
Quote
That's a cleaver trick!

Actually a cleaver trick would be more like juggling butchers knives...  :P

Sorry I saw your typo and thought it was pretty funny, I make mistakes like that all the time and it makes me giggle that someone else does too from time to time.  ;D

</end off topic comment>

BTW I think you're doing a smart thing by asking for help optimizing your code, there are some excellent programmers here who would more than likely love to get their hands on your code to help make this as good a program as it could possibly be.
« Last Edit: March 16, 2010, 10:17:08 pm by AaroneusTheGreat »