Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > FLI explained, please...
2009-05-03 20:40
Dragnet

Registered: Nov 2006
Posts: 16
FLI explained, please...

Hola,

I'm looking for an easy-understandable-for-a-novice description, preferably with a *documented* example to go along with it, of how FLI actually works, including a description of how the colordata is stored (so i'll know how to manipulate it). My C64 skills are very novice/rusty indeed, so the more documentation, the better...

I have already been searching this forum and the C64 codebase for the sorts, but found what seems like a trillion different FLI formats (FLI, AFLI, XFLI, IFLI, MUFLI, etc) with different resolutions... But, I'm merely thinking of "normal fli" (if there is such a thing) capable of handling a width of 40 chars (and at least a height of 10 chars), no sprites involved, and 16 colours per char, running as part of the normal IRQ. Make sense?

Furthermore, a reference to a drawing-program that can save in the explained format, or at least in a format that can be converted into it, would be very nice!

That's not much to ask for, is it? :)

Any help will be greatly appreciated...!

Regards /Dragnet
2009-05-03 21:22
MagerValp

Registered: Dec 2001
Posts: 1078
http://www.ffd2.com/fridge/chacking/c=hacking4.txt
2009-05-04 13:58
Mace

Registered: May 2002
Posts: 1799
FLI with a width of 40 chars is only possible if you allow for some chars to the left to only have light grey or background colour.
This is know as the 'FLI bug' and it's ALWAYS there.
2009-05-04 14:17
chatGPZ

Registered: Dec 2001
Posts: 11386
technically FLI _is_ possible in all 40 chars... you just have to stretch the videoram and use a fpp like routine.
2009-05-04 16:11
Krill

Registered: Apr 2002
Posts: 2980
I always considered FLI a forced DMA with VIC line pointer _advance_ though, not a forced DMA with VIC line pointer _reset_ (= forced bad line). That difference is exactly why both are 3 cycles apart and one has this 3-chars bug to the left.. :)

Anyways, yes, you can emulate FLI by using forced bad lines, but you'll quickly run out of unique lines..
2009-05-04 16:45
Graham
Account closed

Registered: Dec 2002
Posts: 990
8 rasterlines to be exact.
2009-05-04 17:17
Krill

Registered: Apr 2002
Posts: 2980
Well, yes, FLI also updates the $d800 colours every 8 lines, while forced bad lines (FPP) doesn't.
2009-05-04 18:35
Mace

Registered: May 2002
Posts: 1799
Stretch videoram, FPP routine, forced bad lines... this is why FLI never has been my thing.
I've never been a 'hardware' coder.
2009-05-04 22:22
MagerValp

Registered: Dec 2001
Posts: 1078
I'd just like to point out that in the FLI bug area you have background color, light gray, and one color that depends on the CPU instruction following the FLI code. Using illegals you can select any of the 16 colors. The next version of Executable Image supports changing the FLI bug color to any color on every line, but unfortunately I don't think there are any tools that let you save an image with that information. FLI Profi is the only editor that lets you edit the area, but it saves an executable program...
2009-05-05 05:14
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: I'd just like to point out that in the FLI bug area you have background color, light gray, and one color that depends on the CPU instruction following the FLI code. Using illegals you can select any of the 16 colors. The next version of Executable Image supports changing the FLI bug color to any color on every line, but unfortunately I don't think there are any tools that let you save an image with that information. FLI Profi is the only editor that lets you edit the area, but it saves an executable program...


Timanthes has that option, or at least hidden.
2009-05-05 05:46
Mace

Registered: May 2002
Posts: 1799
Quote:
one color that depends on the CPU instruction following the FLI code
Cool, didn't know that :)
2009-05-05 07:33
Dragnet

Registered: Nov 2006
Posts: 16
Hola,

Well, I thought the FLI bug had been fixed years ago, cause I seem to remember several demos using what to me seemed like 40 chars of FLI (last I used FLI, merely as a fixed image, was in 1993 using Black Mails old editor, I think... :) ). That's way I asked for 40 chars, but must have been cleverly designed images or just me not understanding what I was looking at... 37 chars will do just fine for me; well, actually 34 to make it nice and symetrical! :)

Anyways - thanks for the replies, and especially the link to the explanation, MagerValp! Would still like some actual documented code examples, though. The discussion here quickly turned way too technical for me - I guess there is no way around me doing some serious homework regarding the technical side of the beloved breadbox!

Regards /Dragnet
2009-05-05 07:55
Frantic

Registered: Mar 2003
Posts: 1648
There is some stuff on codebase on FLI:

http://codebase64.org/doku.php?id=base:vic#custom_graphics_modes

Maybe of interest for you?
2009-05-05 08:34
Graham
Account closed

Registered: Dec 2002
Posts: 990
Atleast every 8th rasterline of an FLI picture can have full 40 chars width. And then you can always use the FLI-bug colors + sprites + rasterbars to make the bug area more useful.
2009-05-05 12:46
MagerValp

Registered: Dec 2001
Posts: 1078
Quote: Hola,

Well, I thought the FLI bug had been fixed years ago, cause I seem to remember several demos using what to me seemed like 40 chars of FLI (last I used FLI, merely as a fixed image, was in 1993 using Black Mails old editor, I think... :) ). That's way I asked for 40 chars, but must have been cleverly designed images or just me not understanding what I was looking at... 37 chars will do just fine for me; well, actually 34 to make it nice and symetrical! :)

Anyways - thanks for the replies, and especially the link to the explanation, MagerValp! Would still like some actual documented code examples, though. The discussion here quickly turned way too technical for me - I guess there is no way around me doing some serious homework regarding the technical side of the beloved breadbox!

Regards /Dragnet


If the picture is designed with the limitations of the FLI bug area in mind, the casual viewer will not know that it's there. The undisputed master of this is Mirage:

Oh Noes, They Be Stealing My Bench
Ms. Pac Man
Fundamentals of Icosahedral Symmetry
Donkey Kong -1LIFE/PAL
Space Invaders

...so how do you get Timanthes to save FLI bug colors?
2009-05-05 17:39
Hein

Registered: Apr 2004
Posts: 954
Quote: If the picture is designed with the limitations of the FLI bug area in mind, the casual viewer will not know that it's there. The undisputed master of this is Mirage:

Oh Noes, They Be Stealing My Bench
Ms. Pac Man
Fundamentals of Icosahedral Symmetry
Donkey Kong -1LIFE/PAL
Space Invaders

...so how do you get Timanthes to save FLI bug colors?


By pressing 'save'
2009-05-05 19:13
Mace

Registered: May 2002
Posts: 1799
...I think he meant "in what format is the FLI bug colour stored inside the file" :-)
No he doesn't...
2009-05-05 19:40
MagerValp

Registered: Dec 2001
Posts: 1078
I don't remember seeing that in the Export As dialog, and I can't test it as Timanthes has decided to crash every damn time I click save or export...
2009-05-05 19:42
Scout

Registered: Dec 2002
Posts: 1570
Quote: I don't remember seeing that in the Export As dialog, and I can't test it as Timanthes has decided to crash every damn time I click save or export...


Mirage uploaded a more recent executable not so long ago. Tried that?
2009-05-05 20:28
MagerValp

Registered: Dec 2001
Posts: 1078
The executable is date stamped 2009-02-20, and the About box says Final Debug Build 3.0.3338.37500. I think that's the latest.
2009-05-05 20:33
Scout

Registered: Dec 2002
Posts: 1570
Quote: The executable is date stamped 2009-02-20, and the About box says Final Debug Build 3.0.3338.37500. I think that's the latest.


Yup, it is.
2009-05-05 20:44
Dragnet

Registered: Nov 2006
Posts: 16
Hola,

Hmm - can't believe I missed Graham's code posted at codebase64, since it is nice and neat - and very well documented! Thanks for the link, Frantic!

I think I have got the basics of FLI right by now, though one thing still puzzles me; quoting the text accompagning Graham's code at codebase64:

"You also can use this for hires FLI, however the first 3 char columns will only show a light grey area. To remove this area, a sprite would be required which takes 5 extra clock cycles per rasterline. This is possible if you unroll the main FLI display loop."

So - what is the alternative to using hires (same as bitmap, right?)? How else can you set the colours individually for each char?

Regards /Dragnet
2009-05-05 22:38
MagerValp

Registered: Dec 2001
Posts: 1078
Hires, as opposed to multicolor. Not bitmap vs char mode.
2009-05-06 06:22
HCL

Registered: Feb 2003
Posts: 728
Hmm.. just to be picky: I'd say Hires(320x200) <> Lores(160x200). MultiColor(~4 colors per char) <> SingleColor (~2 colors per char). Bitmap <> Char.

VIC only allows Hires together with SingleColor, if you want MultiColor you have to go Lores. Then there are all kinds of software tweeks to get *multiple colors* in Hires of course :). I just think that "Hires, as opposed to multicolor" only helps to make the c64-world less understandable :P.

SC-Hires/MC-Lores you set with $d016 bit4.
Bitmap/Char is set with $d011 bit5,6.
2009-05-06 06:41
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: Hmm.. just to be picky: I'd say Hires(320x200) <> Lores(160x200). MultiColor(~4 colors per char) <> SingleColor (~2 colors per char). Bitmap <> Char.

VIC only allows Hires together with SingleColor, if you want MultiColor you have to go Lores. Then there are all kinds of software tweeks to get *multiple colors* in Hires of course :). I just think that "Hires, as opposed to multicolor" only helps to make the c64-world less understandable :P.

SC-Hires/MC-Lores you set with $d016 bit4.
Bitmap/Char is set with $d011 bit5,6.


I fully agree with HCL - but that's just my way of licking his ass for potential future favours I might ask him. :)
2009-05-06 08:03
Ninja

Registered: Jan 2002
Posts: 411
To be _extremly_ nutpicky (while I generally agree): calling it SingleColor and having 2 colors/char in bitmap mode has its odds, too ;) (It will do, though...)
2009-05-06 09:09
enthusi

Registered: May 2004
Posts: 677
I *think* some people use the term "HiRes" to actually describe that standard hires mode. I like to call it TRUE hires (when in fact colors are used per char-block).
Calling the beautyful hires "singlecolor" is indeed a bad idea. There are enough confusing names for modes. WRONG names wont help much and also wont do justice to the awesome HiRes art performed especially during the last months...
So maybe 'HiRes' or 'TrueHires' is an idea? ;-)
2009-05-06 10:55
Oswald

Registered: Apr 2002
Posts: 5094
"VIC only allows Hires together with SingleColor"
"I like to call it TRUE hires"

o_O

Singlecolor = lda #0 sta d011.
true hires = WTF?!


Multicolor Bitmap
Hires Bitmap
Multicolor Charmode
Hires Charmode
ECM Charmode


done.
2009-05-06 12:54
MagerValp

Registered: Dec 2001
Posts: 1078
/me agrees with bogár.
2009-05-06 15:08
HCL

Registered: Feb 2003
Posts: 728
I don't know.. is there a problem with the terms MultiColor and SingleColor!? Yes, if you're weirdo enough you may claim that SingleColor === lda#0 sta$d011. Tho i'm fairly ok with SingleColor meaning that you only have one color except for teh background. No?

Perhaps the term SingleColor is more applicable on sprites, which indeed only have one color plus transparent. I always used the same term for chars..

So.. my list is:

MultiColor Bitmap
SingleColor Bitmap
MultiColor Charmode
SingleColor Charmode
ECM Charmode

..just to be bogár me also :).
2009-05-06 15:21
Oswald

Registered: Apr 2002
Posts: 5094
in singlecolor you have more than 1 color+the background. thats only true for one char cell. if on irc we would chat about coding, and you would say "singlecolor" I would surely ask back "you mean hires?". but if I would say "hires chars" or "hires bitmap" you wouldnt need to ask back what do I mean. :)

anyway use it if you like it. :)

btw still dont get what do you mean with "VIC only allows Hires together with SingleColor" ? that shows how confusing and misleading is this term. There's Hires and Multicolor, Singlecolor is confusing. You use 2 terms on the same thing in one sentence and claim one of them is prequisite of the other...

2009-05-06 18:43
Frantic

Registered: Mar 2003
Posts: 1648
"Singlecolor" is for cp-mongos. It is called hires!
2009-05-06 18:52
Krill

Registered: Apr 2002
Posts: 2980
Ok, and while we're at choosing some sane names for C64 stuff, let's fight weirdo terms like flexible line distance, flexible pixel position, IFFL (sorry, too lazy to look up what that crud means), crunching, etc.pp. :D
2009-05-06 19:12
Dragnet

Registered: Nov 2006
Posts: 16
Quote: in singlecolor you have more than 1 color+the background. thats only true for one char cell. if on irc we would chat about coding, and you would say "singlecolor" I would surely ask back "you mean hires?". but if I would say "hires chars" or "hires bitmap" you wouldnt need to ask back what do I mean. :)

anyway use it if you like it. :)

btw still dont get what do you mean with "VIC only allows Hires together with SingleColor" ? that shows how confusing and misleading is this term. There's Hires and Multicolor, Singlecolor is confusing. You use 2 terms on the same thing in one sentence and claim one of them is prequisite of the other...



Surprise, surprise - I'm still confused.

I understand the terms listed above, e.g. hires vs. multicoler, bitmap vs chars, but do not understand how hires goes together with FLI!? And I still have no clue as to what ECM is, but nevermind...

Anyways, if I read Grahams FLI code correctly from codebase64 (see link somewhere above), colours stored in $d800 are fixed, set on init. Does this (per char) correspond to the background colour or the individual colour per char? Point is, if its the individual colour per char, then how can the FLI technique offer more colours per char, eventhough we split per rasterline? Hence, it must be what is referred to as the background colour of the char, and additional colour ram (for hires bitmap, must be what corresponds to $4000 in Grahams example code) is what constitutes individual char colours. Ergo, this means that hires FLI gives you a total of 1+8 colours per char (plus $d020 value), allowing for two colours per rasterline per char, where one of the two is always the same for the entire char!? Is this correct, or did I just make an arse of myself as usual...? :)

Also, my initial question concerning the colour ram was actually more on how the colour ram is laid out in memory (not the fixed $d800 colours) for "normal" FLI (lores multicolour!). Say, if the colourram starts at $4000, then what is the memory location of the colour ram for the first line in the first char (ok, $4000 I guess for that one... hehe), for the 2nd line in the first char, etc, then for the first line in the second char, etc. Point is, the exact locations must naturally be known to manipulate the colours of a given char. I know this information can probably be deduced from the values stored in $d011 and $d018 in Grahams example, but damn if I know how...

Regards /Dragnet
2009-05-06 19:29
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: Surprise, surprise - I'm still confused.

I understand the terms listed above, e.g. hires vs. multicoler, bitmap vs chars, but do not understand how hires goes together with FLI!? And I still have no clue as to what ECM is, but nevermind...

Anyways, if I read Grahams FLI code correctly from codebase64 (see link somewhere above), colours stored in $d800 are fixed, set on init. Does this (per char) correspond to the background colour or the individual colour per char? Point is, if its the individual colour per char, then how can the FLI technique offer more colours per char, eventhough we split per rasterline? Hence, it must be what is referred to as the background colour of the char, and additional colour ram (for hires bitmap, must be what corresponds to $4000 in Grahams example code) is what constitutes individual char colours. Ergo, this means that hires FLI gives you a total of 1+8 colours per char (plus $d020 value), allowing for two colours per rasterline per char, where one of the two is always the same for the entire char!? Is this correct, or did I just make an arse of myself as usual...? :)

Also, my initial question concerning the colour ram was actually more on how the colour ram is laid out in memory (not the fixed $d800 colours) for "normal" FLI (lores multicolour!). Say, if the colourram starts at $4000, then what is the memory location of the colour ram for the first line in the first char (ok, $4000 I guess for that one... hehe), for the 2nd line in the first char, etc, then for the first line in the second char, etc. Point is, the exact locations must naturally be known to manipulate the colours of a given char. I know this information can probably be deduced from the values stored in $d011 and $d018 in Grahams example, but damn if I know how...

Regards /Dragnet


Hires FLI, more known as AFLI gives you two unique colors per char and raster line.

Normal FLI gives you one common background color. the $d800 colors per char. and two extra unique colors per char and raster line.

FLI simply fetches new color data from screen memory each rasterline. So the memory layout is simple, each color-screen corresponds to the current raster line within a char. Other than that the screens are access like normal.

screen-index: y & 7
screen-pos: (x/8)+(y/8)*40

0<=x<=319 0<=y<=199


2009-05-06 20:21
Oswald

Registered: Apr 2002
Posts: 5094
ok, FLI explained:

make sure you understand how multicolor/hires bitmaps works:

http://codebase64.org/doku.php?id=base:built_in_screen_modes

multicolor fli:

same as multicolor bitmap, except:

you change the location of the screen memory on every rasterline. using 8 screen memory to have a unique scr mem for each 8 lines of each chars.

hires fli:

same as hires bitmap, except:

see above.

naturally $d021 and & d800 doesnt come to play in here. (see the hires bitmap on the link again if you dont get this)
2009-05-06 20:28
MagerValp

Registered: Dec 2001
Posts: 1078
Quote: Ok, and while we're at choosing some sane names for C64 stuff, let's fight weirdo terms like flexible line distance, flexible pixel position, IFFL (sorry, too lazy to look up what that crud means), crunching, etc.pp. :D

Flexible Line Distance makes perfect sense, IMHO. FPP not so much, and IFFL doesn't even really mean anything :)
2009-05-06 20:29
Dragnet

Registered: Nov 2006
Posts: 16
Hola,

I get it... Finally... :)

What got me confused, I guess, was that I had forgotten that the screen can reside in numerous memory locations, e.g. $0400 or $4000, which makes the concept of FLI a bit hard to grasp concerning memory layout. Hence, the memory location (layout) *is* the screen colour data, not some arbitrary format stored to the screen...

Thanks for all the replies...!

Regards /Dragnet

2009-05-06 22:08
Skate

Registered: Jul 2003
Posts: 494
About naming the graphic modes, why don't we give animal names to graphic modes? We wouldn't have any problems by choosing names like hires/single color/almost square (makes sense actually ;)) gfx mode. I vote on Kangaroo and Koala :D

Koala
Kangaroo
Koala Char
Kangaroo Char
<write any Australian animal name here for ECM> Char

Case is closed...
2009-05-07 00:01
Ksubi
Account closed

Registered: Nov 2007
Posts: 87
ECM=Echidna Character Mode :)

2009-05-07 08:50
Jetboy

Registered: Jul 2006
Posts: 337
Quote: Flexible Line Distance makes perfect sense, IMHO. FPP not so much, and IFFL doesn't even really mean anything :)

IFFL means Interleaved File Fast Loader
2009-05-07 09:00
Mace

Registered: May 2002
Posts: 1799
IFFL = InterFlexible File Loader, according to Snacky.
Or Integrated File Flexible Loader according to Cadaver and Soci.

I can hardly imagine one of the Fs ever stood for 'fast' as IFFL was anything but fast when it was invented.

But we digress...
2009-05-07 10:44
HCL

Registered: Feb 2003
Posts: 728
..continue: I don't know if you guys read some C=64-manual from 1980 or something to get the understanding that "Hires" is the exact opposite to "MultiColor". The two words are totally orthogonal.

That's why i like the less VIC-dependant terms Hires vs Lores, MultiColor vs singleColor etc..
2009-05-07 10:46
MagerValp

Registered: Dec 2001
Posts: 1078
Digression FTW.

IFFL is a bit of a retronym though... What we mean by IFFL today (loading files from within an archive, fast T/S scan at startup) isn't what was meant 20 years ago.

But the worst effect name must be tech-tech.
2009-05-07 11:00
Mace

Registered: May 2002
Posts: 1799
Quote:
But the worst effect name must be tech-tech.
Haha, true! :D
2009-05-07 12:33
Skate

Registered: Jul 2003
Posts: 494
No! Tech-Tech is an incredible effect name, but only for Turkish people :) Tech is pronounced as "tek" in Turkish which means one, mono, single etc. So, when it comes to tech-tech, "tek tek" means "one by one" in Turkish. Since raster lines make horizontal moves one by one, it's a very self-explanatory name for us. :D
2009-05-07 12:38
HCL

Registered: Feb 2003
Posts: 728
@skate: Changing "tech-tech" to "one-by-one" wouldn't make any sense to me :/, "tech-tech" neither :P.
2009-05-07 12:51
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: @skate: Changing "tech-tech" to "one-by-one" wouldn't make any sense to me :/, "tech-tech" neither :P.

The name tech-tech comes from this demo iirc: http://www.pouet.net/prod.php?which=4445
2009-05-07 13:33
Skate

Registered: Jul 2003
Posts: 494
@HCL: We can rename it to (H)armonically (C)reeping (L)ines if you prefer ;)
2009-05-08 08:35
LOGAN
Account closed

Registered: Aug 2003
Posts:
Retrofitting new names to old techniques seems pretty useless because it will render old documentation/references pretty useless and will add to the confusion.

So FLI AFLI HFLI WhateverFLI would be good. I still hope to find the memory layout and display routine for every graphic format around (and every graphic editor) to have a neat tight code library for them all.
2009-05-08 12:04
MagerValp

Registered: Dec 2001
Posts: 1078
Quote: Retrofitting new names to old techniques seems pretty useless because it will render old documentation/references pretty useless and will add to the confusion.

So FLI AFLI HFLI WhateverFLI would be good. I still hope to find the memory layout and display routine for every graphic format around (and every graphic editor) to have a neat tight code library for them all.


Executable Image has viewers for the most popular formats, and source is included. Release 3 will include Hires, Multicolor, MCI/Drazlace, AFLI, FLI, and IFLI.

You can find a comprehensive list of file formats on codebase: http://codebase64.org/doku.php?id=base:c64_grafix_files_specs_l..
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
rexbeng
tlr
Mike
MCM/ONSLAUGHT
iAN CooG/HVSC
Dr.Science/Atlantis
LKP/CFN
Elder0010/G★P
zscs
Guests online: 114
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Logo Graphicians
1 t0m3000  (10)
2 Sander  (9.8)
3 Mermaid  (9.5)
4 Facet  (9.4)
5 Shine  (9.4)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.107 sec.