Talk:DurexForth

From C64-Wiki
Jump to navigationJump to search

Bug reporting[edit source]

I would suggest to contact the author on his project space on Github. There you may open an issue or add an pull request with you patch or write to author via e-mail.

This wiki is not the right place to submit changes and fixes, it's not the support channel in any kind for the software which is here featured with an article. ;)

--JohannKlasek (talk) 16:41, 21 October 2020 (CEST)


Hi

In durexforth 2.0, the sprite file has some bugs. It was not possible to move sprites in x axis more than 255 and to get the x axis information between 256 and 320.

 sp-x! was taking care of the extra bit for >255, but with an error
 sp-x@ was not taking count of the extra bit 


Here is the revise version of the file <sprite> with the corrections for durexforth v2.0


here $80 c, $40 c, $20 c, $10 c, 8 c, 4 c, 2 c, 1 c,

80lsr [ swap ] literal + c@ ;
7s- 7 swap - ;
getbit ( n addr -- )

swap 80lsr swap c@ and ;

setbit ( n addr -- )

swap 80lsr over c@ or swap c! ;

clrbit ( n addr -- )

swap 80lsr invert over c@ and swap c! ;

sp-x@ ( n -- )

dup 7s- $d010 getbit \ get bit 255+ if 256 else 0 then \ if set 256 swap ( u n ) 2* $d000 + c@ +

sp-y@ ( n -- )

2* $d001 + c@ ;

sp-x! ( x n -- )

2dup ( x n x n ) 2* $d000 + c! \ lsb swap $100 and if 7s- $d010 setbit else 7s- $d010 clrbit then ;

sp-y! ( y n -- ) 2* $d001 + c! ;
sp-xy! ( x y n -- )

tuck sp-y! sp-x! ;

( expand width/height )

sp-1w ( n -- ) 7s- $d01d clrbit ;
sp-2w ( n -- ) 7s- $d01d setbit ;
sp-1h ( n -- ) 7s- $d017 clrbit ;
sp-2h ( n -- ) 7s- $d017 setbit ;
sp-on ( n -- ) 7s- $d015 setbit ;
sp-off ( n -- ) 7s- $d015 clrbit ;
sp-col! ( c n -- ) $d027 + c! ;

( read sprite byte )

ks

2* source drop >in @ + c@ 1 >in +! '.' <> 1 and or ;

rdb ( addr -- addr )

0 ks ks ks ks ks ks ks ks over c! 1+ ;

( read sprite to address )

sp-data ( addr -- )
  1. 21 0 do refill rdb rdb rdb loop drop ;


2* source drop >in @ + c@ 1 >in +! '.' <> 1 and or ;

rdb ( addr -- addr )

0 ks ks ks ks ks ks ks ks over c! 1+ ;

( read sprite to address )

sp-data ( addr -- )
  1. 21 0 do refill rdb rdb rdb loop drop ;

Thanks