The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cargas de Produndidad / Depth Charge
#6
boriel Wrote:Note: You can directly do that in ZXBasic (replacing the ASM function) with:
Code:
t = PEEK(Ulong, 23672) BAND 0xFFFFFF

It won't be perhaps as fast as the ASM. Can you check it?

Tested and it's way faster than ASM; in fact, I can't control the speed of the sonar pointer. With the ASM function, I can do that changing the 360 in a = t1 / 360 * PI: REM a is the seconds pointer in radians line.
This is how the sonar subroutine is defined right now:
Code:
REM Rutina del sonar SUB sonar() REM sonido del sonar segundos = segundos + 1 if segundos = 15 then beep 0.07,45 : beep 0.13,30 segundos = 0 poke 23164+(RND*3),135 poke 23196+(RND*3),135 poke 23228+(RND*3),135 end if REM grafico del sonar FUNCTION t() as uLong asm DI LD DE,(23674) LD D,0 LD HL,(23672) EI end asm end function DIM t1 AS FLOAT t1 = t() a = t1 / 360 * PI: REM a is the seconds pointer in radians sx = 20 * SIN a : LET sy = 20 * COS a PLOT 237, 28: DRAW sx, sy if sx2 <> sx then over 1 PLOT 237, 28: DRAW sx2, sy2 sx2 = sx : sy2 = sy over 0 CIRCLE 236, 28, 18 CIRCLE 236, 28, 13 CIRCLE 236, 28, 8 plot 236,9 : draw 0,38 plot 217,28 : draw 38,0 end if if sx > 19.9 or sx < -19.9 or (sx > 0 and sx < 3) then resetsonar = resetsonar + 1 if resetsonar = 1 then for y = 18 to 23 print at y,27; " "; next y CIRCLE 236, 28, 18 CIRCLE 236, 28, 13 CIRCLE 236, 28, 8 plot 236,9 : draw 0,38 plot 217,28 : draw 38,0 end if else resetsonar = 0 end if return END sub

Cheers
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)