Features!

This forum is dedicated to those who want support programming in ugBASIC.
Questo forum è dedicato a chi desidera supporto per programmare in ugBASIC.
Ce forum est dédié à ceux qui souhaitent prendre en charge la programmation en ugBASIC.
Post Reply
PaoloRaven
Posts: 2
Joined: Mon Oct 09, 2023 10:04 am

Features!

Post by PaoloRaven »

Hey everyone,

I would point out some issues that I'm having with ugBasic and suggest some features in order to improve it.

1) ASM implementation is foggy: some commands seem to work while some others are not.

Try this:

ON CPU6809 BEGIN ASM
LDB #20
LDB #20
END ASM

It throws a critical error due to the double LDB statement, while instead the single LDB statement works, so in general I can't really test any code since I can't know while the error is internal in the compiler or what else is there (I guess the compiler should translate the asm code as it is hence doesn't make sense to get an error just bcs I'm replicating a statement).

This is the routine I was trying to execute, it should lock the text window between lines 16 and 24:

ON CPU6809 BEGIN ASM
' top line
LDB #$1F ' code US for CONSOLE x, y
SWI #$02 ' PUTC routine
LDB #$21 ' top line first decimal
SWI #$02 ' PUTC routine
LDB #$26 ' top line second decimal -- top line is 16
SWI #$02 ' PUTC routine
END ASM

2) Is there a way to edit fonts somehow? Since ugBasic uses its own system to print text, it would be useful to have a way to load or define specific fonts - for some screen res like 160x200 a 6x8 font would be really appreciate in order to fit the screen size without having those wide characters

3) Is there a way to redefine characters for Thomson, like DEFGR$ does in BASIC in order to print them as graphic tiles?

Thank you for your support and keep up the good work :)
spotlessmind1975
Site Admin
Posts: 149
Joined: Fri Oct 06, 2023 8:25 pm

Re: Features!

Post by spotlessmind1975 »

Hi PaoloRaven, first of all, thank you very much for the message!

I try to answer each question precisely, let's see if we can solve it. If anything, if there are any fixes, I implement them in the beta version to keep them until the next official release.
PaoloRaven wrote: Sun Jan 14, 2024 3:13 pm 1) ASM implementation is foggy: some commands seem to work while some others are not.
Yes, you are absolutely right. The reason it's "foggy", in fact, is because we're integrating an alien language into a well-defined language. So I can't introduce any kind of evaluation as what is written is passed, "as is", to the underlying assembler.
PaoloRaven wrote: Sun Jan 14, 2024 3:13 pm

Code: Select all

ON CPU6809 BEGIN ASM
LDB #20
LDB #20
END ASM
It throws a critical error due to the double LDB statement,
It seems to me that the error is linked to the lack of spaces in front of each instruction. I tried to repeat the same thing, both with Linux and Windows. Strangely, I receive a different error: "syntax error, unexpected end of file, expecting AsmSnippet". I get the same error with both the "main" and "beta" versions. Although the error is strange, because this syntax is absolutely, allowed, I suspect we are working with different versions. Try, first, downloading the latest version of the compiler, so you get the same error as me.

Secondly, try rewriting it like this (you can omit ON CPU6809, if you are not interested in multitargetting):

Code: Select all

BEGIN ASM
LDB #20
LDB #20
END ASM ON CPU6809
If that also fails, try inserting spaces in front of each statement, like this:

Code: Select all

BEGIN ASM
   LDB #20
   LDB #20
END ASM ON CPU6809
PaoloRaven wrote: Sun Jan 14, 2024 3:13 pm This is the routine I was trying to execute, it should lock the text window between lines 16 and 24:
So, for this code to work, we need to make sure the banks are set up correctly. You should do some debugging on the fly to check if, once loaded into memory from the media, and the startup routine executed, the bank configuration is the one that allows the system routines to work. Obviously, this is a suggestion of mine, it is not a constraint, because I don't remember if I modify the banks (beyond double buffering on mode 0, I mean), and I don't know if this modification impacts the ROMs.
PaoloRaven wrote: Sun Jan 14, 2024 3:13 pm 2) Is there a way to edit fonts somehow?
In theory there would be a way to define a new font set but, at the moment, it is not implemented under pc128op. In the meantime, I opened a ticket to implement the output (it takes relatively little effort). So you will able to use the following command:

Code: Select all

FONT LOAD filename [AT screencode]
Where filename must be an image of 8x8 pixel for each character, while screencode is the initial screen code to replace. In order to use a 6x8 font, however, I have to change the actual font rendering routines since they are aligned with byte. You could actually use IMAGES as a workaround, using the frame number as the ASCII letter, but I understand that's not convenient -- also, the PUT IMAGE is subject to resolution-dependent pixel bounding anyway, so I don't know if you'd be able to get to 6 pixels.
PaoloRaven wrote: Sun Jan 14, 2024 3:13 pm 3) Is there a way to redefine characters for Thomson, like DEFGR$ does in BASIC in order to print them as graphic tiles?
I found this documentation, which explains how to use the command DEFGR$ and I also added a ticket, to add the specific instruction. This command will be able to change the character at run time. At compile time, however,I think the previous answer also answers this question, but I would like confirmation from you. Again, there is no implementation for Thomson at the moment but it will come and, actually, the implementation will be 8x8 pixel bounded. I need more time (and a specific ticket, as well).
Post Reply