Jump to content
IGNORED

How many different fonts could you have on screen theoretically at the same time?


Steril707

Recommended Posts

Actually you can have up to 30 lines (at least PAL machines can show them on screen, NTSC differs by used monitor a lot more) each with a different charset loaded. So 30kB just for the fonts is needed then. 

 

Machine should handle this perfect. 

Edited by pps
Link to comment
Share on other sites

44 minutes ago, tebe said:

30, if you want to get rid of "bad lines"

 

240 :) 

they can be switched every line

 

you can also change the set in the middle of the line

Ah, never thought so far... Seems I have to try out something with this (new to me) knowledge 😏

Link to comment
Share on other sites

Unlimited (to an extent)

You also have CHACT which can be used for effects such as vertically inverting the font and turning inverse video on and off.

Would need to check, but fairly sure the v-inversion is an instantaneous thing and just acts on the lower 3 address bits when a character set fetch is performed, ie every scanline during character mode when each character's font data is fetched.

Edited by Rybags
  • Like 1
Link to comment
Share on other sites

2 hours ago, Rybags said:

You also have CHACT which can be used for effects such as vertically inverting the font and turning inverse video on and off.

Would need to check, but fairly sure the v-inversion is an instantaneous thing and just acts on the lower 3 address bits when a character set fetch is performed, ie every scanline during character mode when each character's font data is fetched.

I have such an effect in the "drawer" that uses CHACT (Video Reflect) and switching sets every line, there was no such effect on XE/XL yet

Link to comment
Share on other sites

1 hour ago, pirx said:

exactly! It'd be fantastic to have an option in MADS to reserve portions of memory and fill the rest with the code as it goes. I mentioned it to @tebe some time ago, but I understand it would be challenging to implement.

What exactly do you mean by this?

 

Reserving memory is usually done with org *+value or .ds value, but I assume you mean something different?

Link to comment
Share on other sites

Real-world scenario:

- text mode, each line is a different charset, say 20 lines = 20 fonts.

- I need 54 different characters in each line, which means 432 bytes used in each charset. It means 592 bytes are left unused in each charset.

so the definition would look like this (typing from memory, the syntax might be incorrect):

	align $400
charset01
    ins 'chset01.fnt',,432

	align $400
charset02
    ins 'chset02.fnt',,432
...
	align $400
charset20
    ins 'chset20.fnt',,432

And in RAM I have 

20KiB taken and 19 holes 592 bytes each.

 

Now, imagine you could tell MADS that these holes are free to use... It could fill it up with procedures, tables, and such.

It is definitely not an easy task, maybe even impossible for a cross-assembler - a very simple approach would add jumps around reserved areas. A more sophisticated approach would be to reorganize procs and data chunks to best fit the holes. But it smells like a higher-level language, not an assembler really.

  • Thanks 1
Link to comment
Share on other sites

Hi!

4 hours ago, pirx said:

Real-world scenario:

- text mode, each line is a different charset, say 20 lines = 20 fonts.

- I need 54 different characters in each line, which means 432 bytes used in each charset. It means 592 bytes are left unused in each charset.

so the definition would look like this (typing from memory, the syntax might be incorrect):

	align $400
charset01
    ins 'chset01.fnt',,432

	align $400
charset02
    ins 'chset02.fnt',,432
...
	align $400
charset20
    ins 'chset20.fnt',,432

And in RAM I have 

20KiB taken and 19 holes 592 bytes each.

 

Now, imagine you could tell MADS that these holes are free to use... It could fill it up with procedures, tables, and such.

It is definitely not an easy task, maybe even impossible for a cross-assembler - a very simple approach would add jumps around reserved areas. A more sophisticated approach would be to reorganize procs and data chunks to best fit the holes. But it smells like a higher-level language, not an assembler really.

This is easy to do with CA65/LD65 and a custom linker script: you need to define memory areas for each 1k block, and then add (at least) two segments to each memory area, one with the font and another one with the code.

 

MEMORY {
    ZP:         file = "", define = yes, start = $0082, size = $007E;
    FONT1:      file = %O, define = yes, start = $2000, size = $400;
    FONT2:      file = %O, define = yes, start = $2400, size = $400;
    FONT3:      file = %O, define = yes, start = $2800, size = $400;
    FONT4:      file = %O, define = yes, start = $2C00, size = $400;
    FONT5:      file = %O, define = yes, start = $3000, size = $400;
    FONT6:      file = %O, define = yes, start = $3400, size = $400;
    FONT7:      file = %O, define = yes, start = $3800, size = $400;
    FONT8:      file = %O, define = yes, start = $3C00, size = $400;
    MAIN:       file = %O, define = yes, start = $4000, size = $4000;
}
FILES {
    %O: format = atari;
}
FORMATS {
    atari: runad = start;
}
SEGMENTS {
    ZEROPAGE:  load = ZP,         type = zp;
    FONT1:     load = FONT1,      type = ro, define = yes;
    FONT2:     load = FONT2,      type = ro, define = yes;
    FONT3:     load = FONT3,      type = ro, define = yes;
    FONT4:     load = FONT4,      type = ro, define = yes;
    FONT5:     load = FONT5,      type = ro, define = yes;
    FONT6:     load = FONT6,      type = ro, define = yes;
    FONT7:     load = FONT7,      type = ro, define = yes;
    FONT8:     load = FONT8,      type = ro, define = yes;
    CODE:      load = MAIN,       type = ro;
    CODE1:     load = FONT1,      type = ro;
    CODE2:     load = FONT2,      type = ro;
    CODE3:     load = FONT3,      type = ro;
    CODE4:     load = FONT4,      type = ro;
    CODE5:     load = FONT5,      type = ro;
    CODE6:     load = FONT6,      type = ro;
    CODE7:     load = FONT7,      type = ro;
    CODE8:     load = FONT8,      type = ro;
    DATA:      load = MAIN,       type = rw;
}

 

You then need to assign different procedures / tables to different segments CODE, CODE1, CODE2, etc., like this:

 

	.segment "FONT1"
	.byte  1,2,3,4,.....

	.segment "FONT2"
	.byte  1,2,3,4,.....

	.segment "FONT3"
	.byte  1,2,3,4,.....

	.segment "CODE1"
	.proc my_proc
	; ....
	.endproc

	.segment "CODE2"
	.proc my_table
	.byte 1,2,3,4,....
	.endproc

	.segment "CODE1"
	.proc other_proc
	; ....
	.endproc

	;... and so on...

 

Note that the order does not matter, as the linker script specify that the "FONT" segments are at the start of each memory section.

 

What LD65 does not (yet) support is writing a segment to more than one memory area, you need to specify on which area each segment is written and then assign a segment manually to each procedure, but IMHO, this would not be difficult to implement. I would like a syntax similar to the GNU LD linker, where you can specify segments with a pattern (like, "code.*"), and then each procedure can be written to a different segment and sorted accordingly.

 

Have Fun!

  • Like 2
Link to comment
Share on other sites

1 hour ago, dmsc said:

Hi!

6 hours ago, pirx said:

Real-world scenario:

- text mode, each line is a different charset, say 20 lines = 20 fonts.

- I need 54 different characters in each line, which means 432 bytes used in each charset. It means 592 bytes are left unused in each charset.

so the definition would look like this (typing from memory, the syntax might be incorrect):

	align $400
charset01
    ins 'chset01.fnt',,432

	align $400
charset02
    ins 'chset02.fnt',,432
...
	align $400
charset20
    ins 'chset20.fnt',,432

And in RAM I have 

20KiB taken and 19 holes 592 bytes each.

 

Now, imagine you could tell MADS that these holes are free to use... It could fill it up with procedures, tables, and such.

It is definitely not an easy task, maybe even impossible for a cross-assembler - a very simple approach would add jumps around reserved areas. A more sophisticated approach would be to reorganize procs and data chunks to best fit the holes. But it smells like a higher-level language, not an assembler really.

Expand  

This is easy to do with CA65/LD65 and a custom linker script: you need to define memory areas for each 1k block, and then add (at least) two segments to each memory area, one with the font and another one with the code.

That's fantastic!

Link to comment
Share on other sites

21 hours ago, pirx said:

Real-world scenario:

- text mode, each line is a different charset, say 20 lines = 20 fonts.

- I need 54 different characters in each line, which means 432 bytes used in each charset. It means 592 bytes are left unused in each charset.

so the definition would look like this (typing from memory, the syntax might be incorrect):

	align $400
charset01
    ins 'chset01.fnt',,432

	align $400
charset02
    ins 'chset02.fnt',,432
...
	align $400
charset20
    ins 'chset20.fnt',,432

And in RAM I have 

20KiB taken and 19 holes 592 bytes each.

 

Now, imagine you could tell MADS that these holes are free to use... It could fill it up with procedures, tables, and such.

It is definitely not an easy task, maybe even impossible for a cross-assembler - a very simple approach would add jumps around reserved areas. A more sophisticated approach would be to reorganize procs and data chunks to best fit the holes. But it smells like a higher-level language, not an assembler really.

use G2F

Special -> Limitations -> First Char ; Last Char

Link to comment
Share on other sites

On 9/15/2023 at 11:41 AM, tebe said:

30, if you want to get rid of "bad lines"

 

240 :) 

they can be switched every line

 

you can also change the set in the middle of the line

 

split.png

split_charset_2.asm 1.29 kB · 7 downloads split_charset_2.obx 2.2 kB · 8 downloads

I wonder what is the advantage (besides 5th color) of char mode over bitmap mode in this particular screen?

Link to comment
Share on other sites

3 minutes ago, Cyprian said:

I wonder what is the advantage (besides 5th color) of char mode over bitmap mode in this particular screen?

That you can flip the charset in-line and so quickly the visualization contrary to bitmap, where you would have to copy the contents which is not possible in this speed...

  • Like 1
Link to comment
Share on other sites

With the swirl effect where you have image change that can occur practically anywhere, the only way you could do that in bitmap is by bankswitching on a 128K or higher machine.

Additionally to enable the character set change on any line, there's VSCROL tricks in use so that there's only a badline at the top of the window, otherwise you'd not be able to do the change in hires char modes on the first scanline of each character.

Link to comment
Share on other sites

VScrol tricks to create shorter characters mean you can have the PF2/PF3 choice in a smaller area.

It can become wasteful though.

A good compromise can be using 4 scanline high chars, then you can use CHACT to flip the characters such that the entirety of the font data is used.

Though if you're doing a bitmap simulation you'd likely be using 120 characters only so 8 would go to waste.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...