fastbasic icon indicating copy to clipboard operation
fastbasic copied to clipboard

inc 256

Open ukcroupier opened this issue 6 years ago • 3 comments

I was wondering if you could add a way of incrementing an integer by 256.

I suspect this would be just like inc only you'd increment the hi byte instead of the lo byte of the integer.

ukcroupier avatar Oct 03 '19 08:10 ukcroupier

Hi!

I was wondering if you could add a way of incrementing an integer by 256.

I suspect this would be just like inc only you'd increment the hi byte instead of the lo byte of the integer.

Yes, would be easy to implement, but it would take some extra bytes in the IDE and not be substantially faster.

What is your use case? Do you need something faster than A = A + 256, or do you need smaller code?

Have Fun!

dmsc avatar Oct 03 '19 17:10 dmsc

Yeah, it's just for working with memory, moving things up and down screen when each line is a page.

inc a is 3x faster than a=a+1 so I figured inc256 would be similar speed and not too much work or memory wastage for you.

It's no big requirement, just thought it might be useful if it's simple to code and doesn't use too much space.

ukcroupier avatar Oct 03 '19 18:10 ukcroupier

Hi!

Yeah, it's just for working with memory, moving things up and down screen when each line is a page.

inc a is 3x faster than a=a+1 so I figured inc256 would be similar speed and not too much work or memory wastage for you.

I could add this as an optimization to the cross compiler, converting A=A+256 to a faster variant, so that the native compiler does not get bigger.

If (when) I finish the cross compiler to native code, it will certainly optimize this.

Have Fun!

dmsc avatar Oct 04 '19 02:10 dmsc