flat assembler
Message board for the users of flat assembler.

Index > DOS > Create Palette in macro?

Author
Thread Post new topic Reply to topic
IdioticMoron



Joined: 17 Oct 2018
Posts: 4
IdioticMoron 17 Oct 2018, 01:47
In TASM, the below is a legal declaration in the data segment. Is there any equivalent structure in FASM?

Palette LABEL BYTE
i=0
REPT 32
db i/4,i,i/4
i=i+1
ENDM
...blah...

We can set the palette colors directly like below

mov dx,3c8h ; set color index port
xor ax,ax
out dx,al ; output color index 0
inc dx ; inc dx = 3C9h, color write port
...blah out this out that.....

but if I'm trying palette rotation, I don't know how to get the values back into a var so I can increase the color index and set the palette again.

Any help is appreciated!

_________________
gee that's a large beetle
i wonder if it's poisonous?
Post 17 Oct 2018, 01:47
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20520
Location: In your JS exploiting you and your system
revolution 17 Oct 2018, 02:57
You can do this in fasm:
Code:
Palette:
repeat 32
 db (%-1)/4,%-1,(%-1)/4
end repeat    
% is the repeat counter generated internally by fasm.
Post 17 Oct 2018, 02:57
View user's profile Send private message Visit poster's website Reply with quote
IdioticMoron



Joined: 17 Oct 2018
Posts: 4
IdioticMoron 17 Oct 2018, 03:51
Thanks, it works like a charm Cool

_________________
gee that's a large beetle
i wonder if it's poisonous?
Post 17 Oct 2018, 03:51
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.