MSX Assembly Fibonacci

Página 2/2
1 |

Por Gorlock

Supporter (11)

Imagen del Gorlock

17-01-2022, 04:30

That would be awesome! Thank you so much Santiago!

Por thegeps

Paladin (1020)

Imagen del thegeps

17-01-2022, 06:42

I think that the best way is to use BCD math so ASCII conversion and printing will be easier

Por ARTRAG

Enlighted (6828)

Imagen del ARTRAG

17-01-2022, 08:16

If you need code to convert integers to strings look for long2ascii here
It expects a 32 bit number in HLDE and a RAM pointer in BC where to put the result

Por thegeps

Paladin (1020)

Imagen del thegeps

17-01-2022, 11:44

Oh, I remember that routine. It was discussed in this forum too. But when I noticed it I had already ready my BCD score routine for Freedom Fighter

Por ro

Scribe (4669)

Imagen del ro

17-01-2022, 11:54

Ah, cool. Recently I did do a recursive Fibo in asm myself. I was just testing some stuff in the realm of compression techniques, binary trees and stuff. Just for fun and understanding Smile

Por santiontanon

Paragon (1633)

Imagen del santiontanon

17-01-2022, 14:26

There you go:
- example assembler: https://braingames.santiontanon.dev/uploads/tmp/example.asm
- compiled rom: https://braingames.santiontanon.dev/uploads/tmp/example.rom

It's limited to 16 bit numbers, so, if you enter 50000 + 50000, the result will be wrong, of course. Also, only positive numbers :)

Converting ascii to integer and viceversa is always a bit tricky to start (as it involves multiplications and divisions, which the Z80 doesn't know how to do, and hence you have to write routines). But I hope the code is not too confusing :)

I had never used these CHPUT/CHGET BIOS routines, so, it was fun learning how to use them btw :)

Por Gorlock

Supporter (11)

Imagen del Gorlock

17-01-2022, 19:58

Thank you guys! Much appreciated!

Página 2/2
1 |