The MASM Forum

General => The Campus => Topic started by: daydreamer on August 20, 2018, 07:17:21 PM

Title: palettemaking with masm
Post by: daydreamer on August 20, 2018, 07:17:21 PM
Hi
I have earlier seen some palettemaking with help of assembler,not sure what assembler its made with
so I want to learn how to make my own
first I want to make a palette data part red,green,blue,white each have 4 parts of it
I have seen some conditional assembly creates palettes ,loops thru db red,green,blue until 256x3 data is created
Title: Re: palettemaking with masm
Post by: hutch-- on August 20, 2018, 08:13:10 PM
Magnus,

It sounds like an array or a table, depends on how many colours you want in your palette. 2, 16 and 256 colour palettes are conventional but you start to need RGB for more colours and RGBA if you want transparency as well.
Title: Re: palettemaking with masm
Post by: daydreamer on August 20, 2018, 09:51:56 PM
Quote from: hutch-- on August 20, 2018, 08:13:10 PM
Magnus,
Y
It sounds like an array or a table, depends on how many colours you want in your palette. 2, 16 and 256 colour palettes are conventional but you start to need RGB for more colours and RGBA if you want transparency as well.
Actually first Starcraft manages to cheat transparency in 256 color mode
Your fpu macro thread and jjs average macro inspired me,to learn create palette data with macro capabilities I seen in old 16 bit demos
It makes use of several loops conditional assembly,not sure what assembler it was in?
Like this:
Db I,0,0
I=I+4
Rept 15
; and continues with other colors
Db 63,i,0
I=I+4
Rept 15
Db 63,63,i
I=I+4
Rept 15

And so on
This creates a nice fire palette
Could be good for other uses to learn to create data this way,without of tedious entering data or waste clock cycles for creating simplest lookup tables

Title: Re: palettemaking with masm
Post by: mineiro on August 21, 2018, 12:23:33 AM
This is just a table, or array  :biggrin:
By default, if rgb have the same values you have gray scale colors, if differs you have a color palete.
Depends about how you show an image on screen, well, file format too. Some jpeg images have a lossy compression while bmp,gif, have lossless compression. Not really, I think they created jpeg2000 to deal with lossless compression.
Lossy compression you lost some data while lossless no. So, the same picture saved as jpeg and gif means that jpeg picture is similar but not 100% equal to gif picture.
Other point about images is that we live on a rectangle or square world. So, to display an image on screen the image size is a multiple of prime numbers. Better words, if you have raw data and want to display on screen so you need get size of raw data and factor to have some possible combinations. This is why we don't see a prime number raw data stored (only if we draw a line). Well, not really, I suppose they created sprites (like tetris) to deal with this.

;--edit
We can use a gif file format as file compressor, just like a zip file. Of course that the image seen is like a noise, but we can call that abstract art.
Title: Re: palettemaking with masm
Post by: daydreamer on August 21, 2018, 01:22:51 AM
I wanted some macro examples minerio but thanks for "greyscale" inspiring me to one way to use palettes for
1: First either import or create greyscale heightmap for terrain procedural
And make palette :start with white and grey for highest value(mountains),  green,brown, yellow,blue(rivers,lakes), optional to add some random noise.
And use it together with heightmap as texture bitmap for that terrain

Title: Re: palettemaking with masm
Post by: dedndave on August 21, 2018, 01:58:11 AM
this is a "standardized" 256-color palette that i use from time to time
it allows for 20 application defined variable colors
practically any image i have converted using the palette looks good
the 6x6x6 color cube (216 colors) could easily be generated by a loop

Pal256  db 005h,005h,005h,0 ;00 (00h-13h: sepia/application defined)
        db 00Fh,00Fh,00Fh,0 ;01 (00h-08h: application defined: additional dark grays)
        db 019h,019h,019h,0 ;02
        db 024h,024h,024h,0 ;03 (B,G,R,0)
        db 02Eh,02Eh,02Eh,0 ;04
        db 038h,038h,038h,0 ;05
        db 042h,042h,042h,0 ;06
        db 04Ch,04Ch,04Ch,0 ;07
        db 057h,057h,057h,0 ;08
        db 0DFh,0DFh,0DFh,0 ;09 (09h-13h: application defined: outine light grays)
        db 0E4h,0E4h,0E4h,0 ;0A
        db 0E9h,0E9h,0E9h,0 ;0B
        db 0EDh,0EDh,0EDh,0 ;0C
        db 0EFh,0EFh,0EFh,0 ;0D
        db 0F4h,0F4h,0F4h,0 ;0E
        db 0F8h,0F8h,0F8h,0 ;0F
        db 0F9h,0F9h,0F9h,0 ;10
        db 0FBh,0FBh,0FBh,0 ;11
        db 0FDh,0FDh,0FDh,0 ;12
        db 0FEh,0FEh,0FEh,0 ;13
        db 00Ah,00Ah,00Ah,0 ;14 (14h-27h: standard grays)
        db 014h,014h,014h,0 ;15
        db 01Fh,01Fh,01Fh,0 ;16
        db 029h,029h,029h,0 ;17
        db 03Dh,03Dh,03Dh,0 ;18
        db 047h,047h,047h,0 ;19
        db 052h,052h,052h,0 ;1A
        db 05Ch,05Ch,05Ch,0 ;1B
        db 070h,070h,070h,0 ;1C
        db 07Ah,07Ah,07Ah,0 ;1D
        db 085h,085h,085h,0 ;1E
        db 08Fh,08Fh,08Fh,0 ;1F
        db 0A3h,0A3h,0A3h,0 ;20
        db 0ADh,0ADh,0ADh,0 ;21
        db 0B8h,0B8h,0B8h,0 ;22
        db 0C2h,0C2h,0C2h,0 ;23
        db 0D6h,0D6h,0D6h,0 ;24
        db 0E0h,0E0h,0E0h,0 ;25
        db 0EBh,0EBh,0EBh,0 ;26
        db 0F5h,0F5h,0F5h,0 ;27
        db 000h,000h,000h,0 ;28 (28h-FFh: 6x6x6 color cube)
        db 033h,000h,000h,0 ;29 (includes black, white, and 4 other grays)
        db 066h,000h,000h,0 ;2A
        db 099h,000h,000h,0 ;2B
        db 0CCh,000h,000h,0 ;2C
        db 0FFh,000h,000h,0 ;2D
        db 000h,000h,033h,0 ;2E
        db 033h,000h,033h,0 ;2F
        db 066h,000h,033h,0 ;30
        db 099h,000h,033h,0 ;31
        db 0CCh,000h,033h,0 ;32
        db 0FFh,000h,033h,0 ;33
        db 000h,000h,066h,0 ;34
        db 033h,000h,066h,0 ;35
        db 066h,000h,066h,0 ;36
        db 099h,000h,066h,0 ;37
        db 0CCh,000h,066h,0 ;38
        db 0FFh,000h,066h,0 ;39
        db 000h,000h,099h,0 ;3A
        db 033h,000h,099h,0 ;3B
        db 066h,000h,099h,0 ;3C
        db 099h,000h,099h,0 ;3D
        db 0CCh,000h,099h,0 ;3E
        db 0FFh,000h,099h,0 ;3F
        db 000h,000h,0CCh,0 ;40
        db 033h,000h,0CCh,0 ;41
        db 066h,000h,0CCh,0 ;42
        db 099h,000h,0CCh,0 ;43
        db 0CCh,000h,0CCh,0 ;44
        db 0FFh,000h,0CCh,0 ;45
        db 000h,000h,0FFh,0 ;46
        db 033h,000h,0FFh,0 ;47
        db 066h,000h,0FFh,0 ;48
        db 099h,000h,0FFh,0 ;49
        db 0CCh,000h,0FFh,0 ;4A
        db 0FFh,000h,0FFh,0 ;4B
        db 000h,033h,000h,0 ;4C
        db 033h,033h,000h,0 ;4D
        db 066h,033h,000h,0 ;4E
        db 099h,033h,000h,0 ;4F
        db 0CCh,033h,000h,0 ;50
        db 0FFh,033h,000h,0 ;51
        db 000h,033h,033h,0 ;52
        db 033h,033h,033h,0 ;53
        db 066h,033h,033h,0 ;54
        db 099h,033h,033h,0 ;55
        db 0CCh,033h,033h,0 ;56
        db 0FFh,033h,033h,0 ;57
        db 000h,033h,066h,0 ;58
        db 033h,033h,066h,0 ;59
        db 066h,033h,066h,0 ;5A
        db 099h,033h,066h,0 ;5B
        db 0CCh,033h,066h,0 ;5C
        db 0FFh,033h,066h,0 ;5D
        db 000h,033h,099h,0 ;5E
        db 033h,033h,099h,0 ;5F
        db 066h,033h,099h,0 ;60
        db 099h,033h,099h,0 ;61
        db 0CCh,033h,099h,0 ;62
        db 0FFh,033h,099h,0 ;63
        db 000h,033h,0CCh,0 ;64
        db 033h,033h,0CCh,0 ;65
        db 066h,033h,0CCh,0 ;66
        db 099h,033h,0CCh,0 ;67
        db 0CCh,033h,0CCh,0 ;68
        db 0FFh,033h,0CCh,0 ;69
        db 000h,033h,0FFh,0 ;6A
        db 033h,033h,0FFh,0 ;6B
        db 066h,033h,0FFh,0 ;6C
        db 099h,033h,0FFh,0 ;6D
        db 0CCh,033h,0FFh,0 ;6E
        db 0FFh,033h,0FFh,0 ;6F
        db 000h,066h,000h,0 ;70
        db 033h,066h,000h,0 ;71
        db 066h,066h,000h,0 ;72
        db 099h,066h,000h,0 ;73
        db 0CCh,066h,000h,0 ;74
        db 0FFh,066h,000h,0 ;75
        db 000h,066h,033h,0 ;76
        db 033h,066h,033h,0 ;77
        db 066h,066h,033h,0 ;78
        db 099h,066h,033h,0 ;79
        db 0CCh,066h,033h,0 ;7A
        db 0FFh,066h,033h,0 ;7B
        db 000h,066h,066h,0 ;7C
        db 033h,066h,066h,0 ;7D
        db 066h,066h,066h,0 ;7E
        db 099h,066h,066h,0 ;7F
        db 0CCh,066h,066h,0 ;80
        db 0FFh,066h,066h,0 ;81
        db 000h,066h,099h,0 ;82
        db 033h,066h,099h,0 ;83
        db 066h,066h,099h,0 ;84
        db 099h,066h,099h,0 ;85
        db 0CCh,066h,099h,0 ;86
        db 0FFh,066h,099h,0 ;87
        db 000h,066h,0CCh,0 ;88
        db 033h,066h,0CCh,0 ;89
        db 066h,066h,0CCh,0 ;8A
        db 099h,066h,0CCh,0 ;8B
        db 0CCh,066h,0CCh,0 ;8C
        db 0FFh,066h,0CCh,0 ;8D
        db 000h,066h,0FFh,0 ;8E
        db 033h,066h,0FFh,0 ;8F
        db 066h,066h,0FFh,0 ;90
        db 099h,066h,0FFh,0 ;91
        db 0CCh,066h,0FFh,0 ;92
        db 0FFh,066h,0FFh,0 ;93
        db 000h,099h,000h,0 ;94
        db 033h,099h,000h,0 ;95
        db 066h,099h,000h,0 ;96
        db 099h,099h,000h,0 ;97
        db 0CCh,099h,000h,0 ;98
        db 0FFh,099h,000h,0 ;99
        db 000h,099h,033h,0 ;9A
        db 033h,099h,033h,0 ;9B
        db 066h,099h,033h,0 ;9C
        db 099h,099h,033h,0 ;9D
        db 0CCh,099h,033h,0 ;9E
        db 0FFh,099h,033h,0 ;9F
        db 000h,099h,066h,0 ;A0
        db 033h,099h,066h,0 ;A1
        db 066h,099h,066h,0 ;A2
        db 099h,099h,066h,0 ;A3
        db 0CCh,099h,066h,0 ;A4
        db 0FFh,099h,066h,0 ;A5
        db 000h,099h,099h,0 ;A6
        db 033h,099h,099h,0 ;A7
        db 066h,099h,099h,0 ;A8
        db 099h,099h,099h,0 ;A9
        db 0CCh,099h,099h,0 ;AA
        db 0FFh,099h,099h,0 ;AB
        db 000h,099h,0CCh,0 ;AC
        db 033h,099h,0CCh,0 ;AD
        db 066h,099h,0CCh,0 ;AE
        db 099h,099h,0CCh,0 ;AF
        db 0CCh,099h,0CCh,0 ;B0
        db 0FFh,099h,0CCh,0 ;B1
        db 000h,099h,0FFh,0 ;B2
        db 033h,099h,0FFh,0 ;B3
        db 066h,099h,0FFh,0 ;B4
        db 099h,099h,0FFh,0 ;B5
        db 0CCh,099h,0FFh,0 ;B6
        db 0FFh,099h,0FFh,0 ;B7
        db 000h,0CCh,000h,0 ;B8
        db 033h,0CCh,000h,0 ;B9
        db 066h,0CCh,000h,0 ;BA
        db 099h,0CCh,000h,0 ;BB
        db 0CCh,0CCh,000h,0 ;BC
        db 0FFh,0CCh,000h,0 ;BD
        db 000h,0CCh,033h,0 ;BE
        db 033h,0CCh,033h,0 ;BF
        db 066h,0CCh,033h,0 ;C0
        db 099h,0CCh,033h,0 ;C1
        db 0CCh,0CCh,033h,0 ;C2
        db 0FFh,0CCh,033h,0 ;C3
        db 000h,0CCh,066h,0 ;C4
        db 033h,0CCh,066h,0 ;C5
        db 066h,0CCh,066h,0 ;C6
        db 099h,0CCh,066h,0 ;C7
        db 0CCh,0CCh,066h,0 ;C8
        db 0FFh,0CCh,066h,0 ;C9
        db 000h,0CCh,099h,0 ;CA
        db 033h,0CCh,099h,0 ;CB
        db 066h,0CCh,099h,0 ;CC
        db 099h,0CCh,099h,0 ;CD
        db 0CCh,0CCh,099h,0 ;CE
        db 0FFh,0CCh,099h,0 ;CF
        db 000h,0CCh,0CCh,0 ;D0
        db 033h,0CCh,0CCh,0 ;D1
        db 066h,0CCh,0CCh,0 ;D2
        db 099h,0CCh,0CCh,0 ;D3
        db 0CCh,0CCh,0CCh,0 ;D4
        db 0FFh,0CCh,0CCh,0 ;D5
        db 000h,0CCh,0FFh,0 ;D6
        db 033h,0CCh,0FFh,0 ;D7
        db 066h,0CCh,0FFh,0 ;D8
        db 099h,0CCh,0FFh,0 ;D9
        db 0CCh,0CCh,0FFh,0 ;DA
        db 0FFh,0CCh,0FFh,0 ;DB
        db 000h,0FFh,000h,0 ;DC
        db 033h,0FFh,000h,0 ;DD
        db 066h,0FFh,000h,0 ;DE
        db 099h,0FFh,000h,0 ;DF
        db 0CCh,0FFh,000h,0 ;E0
        db 0FFh,0FFh,000h,0 ;E1
        db 000h,0FFh,033h,0 ;E2
        db 033h,0FFh,033h,0 ;E3
        db 066h,0FFh,033h,0 ;E4
        db 099h,0FFh,033h,0 ;E5
        db 0CCh,0FFh,033h,0 ;E6
        db 0FFh,0FFh,033h,0 ;E7
        db 000h,0FFh,066h,0 ;E8
        db 033h,0FFh,066h,0 ;E9
        db 066h,0FFh,066h,0 ;EA
        db 099h,0FFh,066h,0 ;EB
        db 0CCh,0FFh,066h,0 ;EC
        db 0FFh,0FFh,066h,0 ;ED
        db 000h,0FFh,099h,0 ;EE
        db 033h,0FFh,099h,0 ;EF
        db 066h,0FFh,099h,0 ;F0
        db 099h,0FFh,099h,0 ;F1
        db 0CCh,0FFh,099h,0 ;F2
        db 0FFh,0FFh,099h,0 ;F3
        db 000h,0FFh,0CCh,0 ;F4
        db 033h,0FFh,0CCh,0 ;F5
        db 066h,0FFh,0CCh,0 ;F6
        db 099h,0FFh,0CCh,0 ;F7
        db 0CCh,0FFh,0CCh,0 ;F8
        db 0FFh,0FFh,0CCh,0 ;F9
        db 000h,0FFh,0FFh,0 ;FA
        db 033h,0FFh,0FFh,0 ;FB
        db 066h,0FFh,0FFh,0 ;FC
        db 099h,0FFh,0FFh,0 ;FD
        db 0CCh,0FFh,0FFh,0 ;FE
        db 0FFh,0FFh,0FFh,0 ;FF
Title: Re: palettemaking with masm
Post by: dedndave on August 21, 2018, 02:05:16 AM
this is a different palette that i generate using code
it is also 256-color, and is used for a height-map as you see in the app picture below

;***********************************************************************************************

PalInit PROC

;                B     G     R     L
;
;black   2040   000   000   000   000
;
;red     1785   000   000   255   029
;
;yellow  1020   000   255   255   226     center
;
;green   0765   000   255   000   160
;
;cyan    0510   255   255   000   095
;
;blue    0255   255   000   000   029
;
;black   0000   000   000   000   000
;
;note: the luminance value stored in the table is 226-L, to simplify palette generation

;--------------------------------------------------

;generate the blue values

        mov     edx,offset PalTable
        mov     ecx,255
        xor     eax,eax

PInit0: mov     [edx],al               ;colors 0 to 254
        add     edx,4                  ;values = 0 to 254
        inc     eax
        dec     ecx
        jnz     PInit0

        mov     ecx,eax                ;ECX = EAX = 255

PInit1: mov     [edx],al               ;colors 255 to 509
        add     edx,4                  ;value = 255
        dec     ecx
        jnz     PInit1

PInit2: mov     [edx],al               ;colors 510 to 764
        add     edx,4                  ;values = 255 to 1
        dec     eax
        jnz     PInit2

;generate the green values

        mov     edx,offset PalTable+4*255+1
        mov     cl,255

PInit3: mov     [edx],al               ;colors 255 to 509
        add     edx,4                  ;values = 0 to 254
        inc     eax
        dec     ecx
        jnz     PInit3

        mov     cx,511

PInit4: mov     [edx],al               ;colors 510 to 1020
        add     edx,4                  ;value = 255
        dec     ecx
        jnz     PInit4

        dec     eax                    ;EAX = 254

PInit5: mov     [edx],al               ;colors 1021 to 1782
        mov     [edx+4],al             ;values = 254 to 1
        mov     [edx+8],al
        add     edx,12
        dec     eax
        jnz     PInit5

;generate the red values

        mov     edx,offset PalTable+4*765+2
        mov     cl,255

PInit6: mov     [edx],al               ;colors 765 to 1019
        add     edx,4                  ;values = 0 to 254
        inc     eax
        dec     ecx
        jnz     PInit6

        mov     cx,765

PInit7: mov     [edx],al               ;colors 1020 to 1784
        add     edx,4                  ;value = 255
        dec     ecx
        jnz     PInit7

PInit8: mov     [edx],al               ;colors 1785 to 2039
        add     edx,4                  ;values = 255 to 1
        dec     eax
        jnz     PInit8

;generate the luminance taper values

        push    esi
        push    edi
        push    ebx
        push    ebp
        mov     esi,offset PalTable+4*1020+3
        xor     edx,edx
        xor     eax,eax
        xor     ebx,ebx
        mov     ecx,41D68F0Ah
        mov     edi,esi
        mov     ebp,765

PInit9: mov     [esi],dl
        mov     [edi],dl
        add     esi,4
        sub     edi,4
        add     eax,ecx
        adc     edx,ebx
        dec     ebp
        jnz     PInit9

        mov     ecx,1D000000h
        mov     ebp,256

PInitA: mov     [esi],dl
        mov     [edi],dl
        add     esi,4
        sub     edi,4
        add     eax,ecx
        adc     edx,ebx
        dec     ebp
        jnz     PInitA

        pop     ebp
        pop     ebx
        pop     edi
        pop     esi

;generate the initial palette and set it into the palette image and HR DIBs

        call    PalGen
        ret

PalInit ENDP

;***********************************************************************************************
Title: Re: palettemaking with masm
Post by: felipe on August 21, 2018, 02:43:25 AM
dedndave is that a software made by you? looks pretty nice and cool.  8)  :icon14:
Title: Re: palettemaking with masm
Post by: dedndave on August 21, 2018, 02:48:25 AM
yes - my biggest project to date  :P
i could probably make some money on it, if i spent a little more time on it
there is a company here in the Phoenix area that would love to have it (Medtronic Inc)
Title: Re: palettemaking with masm
Post by: daydreamer on August 21, 2018, 03:06:42 AM
thanks Dave for sharing  :t,one book I have on game programming meantions that when you run a program in 8bit palette mode,windows don't let you define all 256,but reserves 16 something so it can display its own stuff
but as there are more detailed heightmaps between 0-255,0-65535 and various text encoded files,if you only use it internally in 32bit mode,you can pick custom sized palettes if you want to or for a 0-65535 heightmap have a proc that blends between palette entries for example 100 and 101

I gonna share my research on creating with macros
REPT =old version of REPEAT
remember what you learned first time you programmed that every character Counts and can make a different meaning of statement:
.WHILE
.IF
.ENDIF
etc
is for creating runtime code,highlevel macros that makes it easier for you to use conditional code,without get lost in the many conditional jumps
WHILE ;notice its without beginning "."
IF
ENDM ;uses same ENDM as for macros
etc
is for conditional assembly,so you can create LUT,palettes or any Array that is easily produced with math at assembly time
maybe even possible to start with having some of the first fibonnaci numbers in .data statements,giving your program a headstart compared to your fellow students :P

cool Dave,this is just a hobby Project

is there any way to code in DB binary values?



Title: Re: palettemaking with masm
Post by: dedndave on August 21, 2018, 03:36:40 AM
that must be an old book  :lol:

windows would only do that if your display settings were set to 256-colors
that may have been practical back in the win95/98 days, when EGA and VGA adapters were relatively new
(they needed to reserve desktop colors for things like start menu, taskbar, icon text,  etc)

nowdays, almost any display system allows for at least 16-bit color
so, no color index dedication is required

i have had a great deal of success with 256-color code
not surprisingly, working with 256-color DIB's is considerably faster than full-color images
that is why i have spent so much time developing versatile palettes
Title: Re: palettemaking with masm
Post by: dedndave on August 21, 2018, 03:37:47 AM
you can use binary values in define statements easily
it will require more work, of course
Title: Re: palettemaking with masm
Post by: daydreamer on August 21, 2018, 04:06:55 AM
Quote from: dedndave on August 21, 2018, 03:36:40 AM
i have had a great deal of success with 256-color code
not surprisingly, working with 256-color DIB's is considerably faster than full-color images
that is why i have spent so much time developing versatile palettes
I just want to put together several codings to one complete tiny program
goals I had is make an assembly game and when I came in touch with masm32 programming I also want to make a tiny 1k or 4k or 64k demo
Title: Re: palettemaking with masm
Post by: aw27 on August 21, 2018, 09:55:28 PM
Color palettes are still optionally used by some remote access software, including one title I produce. It really makes a difference if you are on dial-up. Well, I don't think anyone is on dial-up anymore  :badgrin: *, so it is probably a useless features but does not hurt keeping the feature available.

* There are still 2.1 million people on AOL in the USA, but they are too retarded to be considered.
Title: Re: palettemaking with masm
Post by: daydreamer on August 21, 2018, 11:44:52 PM
Quote from: AW on August 21, 2018, 09:55:28 PM
Color palettes are still optionally used by some remote access software, including one title I produce. It really makes a difference if you are on dial-up. Well, I don't think anyone is on dial-up anymore  :badgrin: , so it is probably a useless features but does not hurt keeping the feature available.
Hi AW
how is it with your 3dmodelling today?
have you tried make a huge 600mb or more animation?
I recommend mp4 over animated gif,but unfortunatly not allowed to post mp4 everywhere,about the same size but with long animation with many different lightsetting/colors its becomes terrible crappy
and what can happen when you have been enjoying assembly and start 3dmodelling? you have twice the fun in size reduction,first the fun in least amount of bytes are as fun as least amount of polys
second the fun afterwards of seeing your lowpoly object makes hours of difference when rendering an animation
so maybe a (red)martian animation would work better,or a (blue/White)starry starfield would work better for .gif animations?
but sometimes when you model an object,you notice the approach is influenced by your coding and math skills

Title: Re: palettemaking with masm
Post by: avcaballero on August 22, 2018, 02:57:30 AM
Stictly speaking, there's no such a thing as palette in W32 bits, and there's no need to use it. Nevertheless we can simulate it doing easier working with some graphics effects as plasmas, etc.

You can see here (http://abreojosensamblador.net/Productos/AOW32_/html/Pags/Cap03.html#VentanaPantallaCompleta) an example of a fire demo wit palette. But hurry up if you want to catch up, not available for much time.

(http://abreojosensamblador.net/Productos/AOW32_/html/Imags/Cap03/Fig_03_31.gif)
Title: Re: palettemaking with masm
Post by: daydreamer on August 22, 2018, 03:30:14 AM
Quote from: caballero on August 22, 2018, 02:57:30 AM
Stictly speaking, there's no such a thing as palette in W32 bits, and there's no need to use it. Nevertheless we can simulate it doing easier working with some graphics effects as plasmas, etc.

You can see here (http://abreojosensamblador.net/Productos/AOW32_/html/Pags/Cap03.html#VentanaPantallaCompleta) an example of a fire demo wit palette. But hurry up if you want to catch up, not available for much time.

(http://abreojosensamblador.net/Productos/AOW32_/html/Imags/Cap03/Fig_03_31.gif)
thats cool demo :t
I know many things was achieved with palette tricks Before when computers wasnt that powerful to do things in realtime
thats the Point,to try write something of my own inspired by palette tricks
Title: Re: palettemaking with masm
Post by: aw27 on August 22, 2018, 04:14:34 AM
Quote from: caballero on August 22, 2018, 02:57:30 AM
Stictly speaking, there's no such a thing as palette in W32 bits
Probably you are talking about something you dreamed about and are redefining well know and accepted concepts.
Title: Re: palettemaking with masm
Post by: avcaballero on August 22, 2018, 04:51:35 AM
All these nonsense to say that I'm wrong. If so simply give us an example, I can live with it and I will be glad to see it.
Title: Re: palettemaking with masm
Post by: aw27 on August 22, 2018, 05:23:21 AM
Of course you are wrong, you appear not to have the slightest idea that for 256 colors or less Windows manages colors through indexed lists of colors called PALETTES. You can use google to find tens of thousands of results explaining in detail all the mechanics, if you want of course, otherwise keep using well established names for completely different things and contribute to a more messy world.  :biggrin:
Title: Re: palettemaking with masm
Post by: jj2007 on August 22, 2018, 05:41:52 AM
Quote from: caballero on August 22, 2018, 02:57:30 AMStictly speaking, there's no such a thing as palette in W32 bits, and there's no need to use it.

There are still palettes around in Win32, but there is indeed no need to use them, since most machines are set on 32-bit colour depth nowadays.
Title: Re: palettemaking with masm
Post by: aw27 on August 22, 2018, 06:08:53 AM
There are palettes and there is a need to use them. We can't produce a GIF file with more than 256 colors and we can't prepare a FAX image with more than 2 colors.
Title: Re: palettemaking with masm
Post by: avcaballero on August 22, 2018, 06:49:53 AM
As I see you have to set up your video mode to 16 bits to use the paletty apis. I had already seen it in Charles Petzold's examples but I did not bother to try it, it just did not work in my system and I invented my own way. I do not think anyone is going to worry on setting its video display mode to 256 colors to see a demo.

I will not discuss with you about it. I think we can reach an agreement: I was strictly wrong and you are an arrant pedant.
Title: Re: palettemaking with masm
Post by: aw27 on August 22, 2018, 07:26:59 AM
No, you will not change video mode. Actually, most modern machines are capped at 32-bit video modes. This does not prevent them from seeing 256 color GIFs for example.

Yes, it is better not to discuss further you need a full recycling seminar on the basics of these matters.  :t
Title: Re: palettemaking with masm
Post by: jj2007 on August 22, 2018, 07:37:16 AM
Quote from: caballero on August 22, 2018, 06:49:53 AMarrant pedant

Caballero, check if your keyboard is working properly. It seems sometimes it's missing the "o" and "g" characters.
Title: Re: palettemaking with masm
Post by: avcaballero on August 22, 2018, 08:12:39 AM
> you need a full recycling seminar on the basics of these matters
Yes, with no doubt. I want to excuse if I was rude. You say something that is interesting to me, I didn't know that.

In MS-DOS you construct your palette accessing ports that basically is an array of colors. When you write on your vga memory card, let's say 13h, it knows how to show the images because you previously have constructed these array of colors and say which index you want to paint.

Any image file, let's say 8 bits as your gif or any bmp, pcx, tga, etc has inside the palette info and the color info. In no moment you need access to the palette port, you simply need to read the info in your binay file to construct your rgba color and show it. So why do you need the palette system to show a gif? You simply send the image you have constructed. At least I don't use it in my programs, just read and show.

Without double meaning, this is something I did not know and I appreciate any information about it. Is there another way to do it apart from what I already do?


JJ. I'm not an English speaker, so I won't understand any double meaning, tell me clear if you want I understand it.

PD: I'm always learning
Title: Re: palettemaking with masm
Post by: hutch-- on August 22, 2018, 09:25:41 AM
My Axialis IconWorkshop does "swatches" which is just another name for a pallette. One technique I have seen which is a pest with 256 color images that apart from the orginal colours in the image, you cannot edit them easily because they do not contain any other colours. I gather it is to keep the file size down.
Title: Re: palettemaking with masm
Post by: aw27 on August 22, 2018, 10:44:29 PM
Quote from: caballero on August 22, 2018, 08:12:39 AM
Is there another way to do it apart from what I already do?
I can't see what you have done - I can't download anything from the URL you provided. All I was doing was commenting your statment "Stictly speaking, there's no such a thing as palette in W32 bits". My feeling is that you produce the effect by changing the palette and force a re-rendering of the image but this contradicts your statement that there is no palette (strictly speaking)!
Title: Re: palettemaking with masm
Post by: avcaballero on August 23, 2018, 02:17:11 AM
> I can't download anything from the URL you provided.
Yeah, so late, man. My site is no longer available. They wanted to charge me € 120 / year, so we have reached an agreement: they are left with their site and I with my money. Qué misterio (https://youtu.be/lJNtNOC81oA?list=RDlJNtNOC81oA)

Did not read my entire post? You were alarmed in the first sentence. In VGA you can set the graphical palette on 3C8h and 3C9h ports (an array of 256 colors). This is what I understand by palette (physical). I use in memory an array of colors many times, to what I can call a logical palette, the use is very similar, but it is not the same. As far as I know Windows is no longer concerning with those ports to define a palette, that's why I said that there's no real (physical) palette but we can do one (logical) for our own purposes.

For a moment I had understood you that Windows sent the palette of 8-bits image files to the VGA palette to see them (as your gif), which left me very surprised and interested.

The fire effect has nothing to do with rotating the palette, although it has a logic one. Nothing to do with the VGA palette, you know the ports one.
Title: Re: palettemaking with masm
Post by: aw27 on August 23, 2018, 05:31:51 AM
VGA has gone, ports can only be accessed from kernel mode and there are no more 256 color screens.

There is one thing called a device context, which has been around since the early Windows days. When you have a 256 color bitmap (where each byte is an index into a color table), and you want it to appear on your 32-bit screen monitor a few magic steps take place to make that bitmap be transformed to the 32-bit screen color depth and be rendered to your eyes.