Hi,
I shall put some comments in the assembly, if you don't agree with what I
say, there's an error in the implementation (or a mistake on my side ;)
> I have the following subroutine:
>
> ld hl,(table) ; load table into hl
dynamic start of table: the start address is kept at address table
> inc hl ; increase table
> inc hl ; increase table
2 bytes per entry
> ld a,(hl) ; put value in a
> sla a ; *2
> sla a ; *2
> sla a ; *2
might as well use add a,a. makes it better readable
> dec hl ; decrease table
now you only have 1 byte per entry. either you cut out the second dec hl,
or this is a serious error which will cause data corruption.
> The question is how do I put the value in a back in the table. I
> can't do ld (hl),a. That doesn't work....
As others said, it does. but hl must be pointing right.
I hope you can find the problem. Good luck.
Bye,
shevek
main(){int c[4] ,x=4 ,l=getpid() ,i;; for( srand(l);c[ x]=- rand
()%6 ,x-- ;);; for( ;44> x;){ char a[9] ,*p=
"%.1f\n", b[9];x=i=0; gets(a);for (l=4 ;l-- ;)x+=-(a[l] -=48)==
(b[l ]=c[ l]); ;for (l=0;16 >i;l =++i %4)x
+=(b[i/4]+ a[l] ?0:( a[l]=b[i/4] =10)) ;printf(p,x *.1) ;};}
****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED]
and put "unsubscribe msx [EMAIL PROTECTED]" (without the quotes) in
the body (not the subject) of the message.
Problems? contact [EMAIL PROTECTED]
More information on MSX can be found in the following places:
The MSX faq: http://www.faq.msxnet.org/
The MSX newsgroup: comp.sys.msx
The MSX IRC channel: #MSX on Undernet
****