View Single Post
Old 26th May 2021, 7:11 pm   #15
Michael Haardt
Triode
 
Join Date: May 2021
Location: Titz, Germany.
Posts: 41
Default Re: New SC/MP II system

I tried to fix up the pointer register 12 bit overflow, but did not save much runtime, because checking the pointer registers is almost as bad as a 16 bit increment. I don't quite get what you suggest for the counter. My problem is that I cannot easily load a byte from P to A: xpal, xae, lde, xpal, lde just takes too long.

Copying aligned 256 byte pages can be made quite efficient, but the code looks strange, because I have to copy 255 bytes with auto increment, then 1 byte without and perform a 16 bit pointer increment. Otherwise the 12 bit restriction hits again. Only using a 256 byte page counter saves a little bit, but the code is not pretty, just fast. Well, say not as slow. I could still unroll the loop, but I am amazed the first attempt works at all.

copyloop1:
ccl
ldi 1
copypage1:
xae
ld @1(p1) ; copy from source to destination
st @1(p2)
lde
adi 1
jnz copypage1
ld 1(p1) ; copy last byte of page
st 1(p2)

ccl ; 16 bit increment of p1
xpal p1
adi 1
xpal p1
xpah p1
adi 0
xpah p1

ccl ; 16 bit increment of p2
xpal p2
adi 1
xpal p2
xpah p2
adi 0
xpah p2

ld @-1(p3) ; decrement p3
xpal p3
xae
lde
xpal p3
lde
jnz copyloop1

I guess I should accept it is a memory machine and put the length in memory, pointing p3 to the workspace.

Michael
Michael Haardt is offline