MSX Assembly Page update

by Grauw on 02-02-2004, 00:14
Topic: Websites
Languages:

The MAP (MSX Assembly Page) has been updated again with the following:

  • Corrected and added some information in the 'Multiplications and divisions using shifts' article.
  • Added Sqr16, a square root routine by Arjan Bakker based on the one published in MCCM
  • Re-calculated all timing figures to include M1 wait states.

Relevant link: MSX Assembly Page

Comments (12)

By snout

Ascended (15186)

snout's picture

02-02-2004, 00:26

hey, that Div16 routine looks pritty spiff.... Tongue

By Grauw

Ascended (9338)

Grauw's picture

02-02-2004, 00:33

Bah! Wink

By ricbit

Champion (438)

ricbit's picture

05-02-2004, 02:17

This sqrt routine made by me seems to be faster and smaller than the one proposed:

; square root
; enter: HL=x ;16 bits
; exit: D=floor(sqrt(x)) ;8 bits

SQRT:
LD DE,40h
LD A,L
LD L,H
LD H,D
OR A
LD B,8
SQRT_LOOP:
SBC HL,DE
JR NC,SQRT_SKIP
ADD HL,DE
SQRT_SKIP:
CCF
RL D
ADD A,A
ADC HL,HL
ADD A,A
ADC HL,HL
DJNZ SQRT_LOOP
RET

By Arjan

Paladin (718)

Arjan's picture

06-02-2004, 12:49

indeed, yours is 26% faster (tested by running both routines with input values from 0 to 65536)

By Grauw

Ascended (9338)

Grauw's picture

06-02-2004, 19:35

I will add, then Smile.

~Grauw

By Grauw

Ascended (9338)

Grauw's picture

06-02-2004, 19:48

Ok, it's there.

"In the 'Multiplications and divisions using shifts' article, replaced the square root routine with a new (faster) one, thanks to Ricardo Bittencourt."

Ricardo, I wonder, you wrote this one yourself or you let your 'C-to-ASM code optimizer' program take care of it?? If it can do that it must be powerful... Though I think some good ol' crafty optimizing by hand will probably yield faster results :).

~Grauw

By snout

Ascended (15186)

snout's picture

06-02-2004, 21:00

If the Super Optimizer can yield a 26% speed-increase on a routine like this, maybe it's a good idea to start collecting 'highly optimized routines'. (Well, actually that's already the case on the MAP...)... Surely it won't always lead to 26% speed-increase but euhm.. it could be very very very interesting to take MSX Development to a higher level once again!

By anonymous

incognito ergo sum (118)

anonymous's picture

06-02-2004, 21:11

There's a incredibly fast Binary to ASCII Hex convertor on MSX Banzai! :)

By Grauw

Ascended (9338)

Grauw's picture

06-02-2004, 22:21

Yeah yeah I was about to link to the FAQ aswell. Also got another very interesting page from someone from the Sinclair scene, which also has a Z80... Very nice set routines in that, I'll add it to the external articles aswell (it also has a ASCII Hex converter but on first sight the MSX Banzai one is faster).

~Grauw

By Grauw

Ascended (9338)

Grauw's picture

06-02-2004, 22:42

Well, it's there. Enjoy! That 'Z80 Bits' article is really pretty cool.

By ricbit

Champion (438)

ricbit's picture

07-02-2004, 02:42

Actually this routine was handmade by me, based on a idea by the author of Elite.

His homepage is a great resource for numerical algorithms:
http://home.clara.net/iancgbell/maths/index.htm

By Grauw

Ascended (9338)

Grauw's picture

07-02-2004, 17:07

Whaaa wow cool page! And the Elite programmer no less... I feel almost honoured to be able to look into its inner workings ^_^.

~Grauw