@hwnd%

Discussions related to graphics (2D and 3D), animation and games programming
Ric
Posts: 279
Joined: Tue 17 Apr 2018, 21:03

Re: @hwnd%

Post by Ric »

I now have my basic terrain rendering program working in BBCSDL32. Thankyou Richard. Starting to convert to BBCSDL64 has thrown up quite a few errors, so ill start with the first.

Code: Select all

 
 3522 DIM code%% NOTEND AND 2047, code%% (2048*40)-1
 3523 DIM ]^O% 2048, ]^L% -1
 3524 ]^P% = code%%
 3525 FOR I% = 0 TO 2 STEP 2
 3526
 3527   [
 3528   opt I%
 3529
 3530   .float4_to_8
 3531
 3532   fld              DWORD [float4]
Not sure about the DIM statements and what they do, but it syntax errors at line 3532.
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Richard Russell
Posts: 611
Joined: Tue 18 Jun 2024, 09:32

Re: @hwnd%

Post by Richard Russell »

Ric wrote: Mon 09 Mar 2026, 20:19 it syntax errors at line 3532.

Code: Select all

 
 3532   fld              DWORD [float4]
I'm no expert in 64-bit assembly language, but my understanding is that the memory operand can't be an absolute address (pointer), because it would require 8 bytes; very few instructions can take an 8-byte absolute address for the same reason. What you have to use instead is a relative address, which needs only four bytes - the same number as the absolute address would in 32-bit code:

Code: Select all

 
 3532   fld              DWORD [rel float4]
I discussed earlier in the thread the technique of using relative pointers rather than absolute ones, to keep the size as 32-bits, and this is an example of the CPU itself adopting the same strategy.