ROTATING CHARACTWR ASSEMBLER ROUTINE

Discussions related to using the integrated assembler
Repton
Posts: 42
Joined: Tue 22 May 2018, 13:51

ROTATING CHARACTWR ASSEMBLER ROUTINE

Post by Repton »

I found an assembler routine in 6502 assembler to rotate text character from basic. Could something similar be done for the BBCsdl?
Ric
Posts: 200
Joined: Tue 17 Apr 2018, 21:03

Re: ROTATING CHARACTWR ASSEMBLER ROUTINE

Post by Ric »

Does it have to be in asm? If you look at accessing the API in the bb4w manual there is a section on writing text at any given angle. I'm sure there must be an equivalent call for the SDL.
Given that it had to be in asm, the text would have to be broken down into individual pixels and then rotated. Not impossible, but much more difficult than a simple API call.
Regards Ric
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
RichardRussell

Re: ROTATING CHARACTWR ASSEMBLER ROUTINE

Post by RichardRussell »

Ric wrote: Thu 29 Oct 2020, 18:08 Does it have to be in asm? If you look at accessing the API in the bb4w manual there is a section on writing text at any given angle. I'm sure there must be an equivalent call for the SDL.
The most straightforward way is probably to draw the text conventionally (but invisibly) and save it as a BMP file, then to display that image with rotation using the imglib library. The only likely problem is that the text won't have an anti-aliased edge, so it won't look very good if drawn on anything other than a plain background.
RichardRussell

Re: ROTATING CHARACTWR ASSEMBLER ROUTINE

Post by RichardRussell »

Here's an example (error trapping and cleanup omitted for clarity). It's compatible with both BB4W and BBCSDL (although strictly you ought to select the font differently) so long as the IMGLIB.BBC library is available:

Code: Select all

      INSTALL @lib$ + "imglib"
      PROC_imgInit

      OSCLI "FONT """ + @lib$ + "DejaVuSans"", 20"
      VDU 5
      MOVE 0,60
      s$ = "Hello world!"
      f$ = @tmp$ + "hello.bmp"
      *REFRESH OFF
      PRINT s$;
      OSCLI "GSAVE """ + f$ + """ 0,0,"+STR$(WIDTH(s$))+",60"

      hello%% = FN_imgLoad(f$)
      REPEAT
        WAIT 4
        angle += 1
        CLS
        PROC_imgPlot(hello%%, 640, 500, 1, 1, angle)
        *REFRESH
      UNTIL FALSE