News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Resource compiler for console applications

Started by nidud, October 24, 2012, 12:59:39 AM

Previous topic - Next topic

nidud

deleted

TouEnMasm

see this sample who create a palette of 256 colors.
http://masm32.com/board/index.php?topic=813.msg7226#msg7226
and forget all you know on the 16 bits.
Fa is a musical note to play with CL

dedndave

you have a lot of ground to cover before you even think about re-writing the app for 32-bit

software INT's - a thing of the past
segmented memory model - same
manipulating the vga registers directly - not likely

start out by learning some 32-bit basics, then move into graphics
if you install the masm32 package, have a look at the examples and help folders

nidud

#3
deleted

jj2007

Quote from: nidud on October 24, 2012, 03:39:48 AM
So the question is (still), is there anybody who know anything about the function used in this API?

Which function used in which API?

Also, when you post sources, do not assume that we have these includes, or that we know what mouseon etc do.

include clib.inc
include conio.inc
include mouse.inc

.code

main proc c
invoke mouseon
or byte ptr console,CON_COLOR
.if !func(editpal)
    invoke resetpal
.else
   and console,not CON_REVGA
.endif
invoke mouseoff
sub ax?,ax?
ret
main endp

    end


The typical template used here looks like this:
include \masm32\include\masm32rt.inc

.code
start:   nop
   exit

end start


Anything more idiosyncratic is likely to get ignored by forum members (because it means wasting time to rewrite the whole thing).

Oh, and before I forget: Welcome to the Forum :icon14:

japheth

Quote
So the question is (still), is there anybody who know anything about the function used in this API?

Well, yes.  :bgrin:

There is no equivalent in the Win32 API to set the VGA attribute controller registers or DACs in text mode ( console ). You are more or less stuck to the 16 default colors.


nidud

#6
deleted

dedndave

i am not sure that is strictly true
some functions, like RealizePalette, may alter the vga palette registers, indirectly
i haven't played with it much - it seems it would make more of a difference if i were using a 256-color mode
because newer systems have far improved graphics capabilities, we don't have as much need to do it

keep in mind, that if you were using a 256-color mode, and you changed the palette,
it would affect all visible windows, including the desktop

TouEnMasm

Quote
So the question is (still), is there anybody who know anything about the function used in this API?
The ddk is a good source for this.It's the perfect level where they can be used.
There is a graphic vga card sample.
firmware can also give some code.
The API are here to do not know all the material details and normalize there use.

Fa is a musical note to play with CL

nidud

#9
deleted

MichaelW


;==============================================================================
include \masm32\include\masm32rt.inc
;==============================================================================
.data
    hwndCon dd 0
    hdcCon  dd 0
.code
;==============================================================================
start:
;==============================================================================

    invoke GetConsoleWindow
    mov hwndCon, eax
    printf("hwndCon %X\n",eax)

    invoke GetDC, hwndCon
    mov hdcCon, eax
    printf("hdcCon %X\n",eax)

    invoke GetDeviceCaps, hdcCon, SIZEPALETTE
    printf("SIZEPALETTE %d\n\n",eax)

    invoke GetDeviceCaps, hdcCon, RASTERCAPS
    mov ebx, eax

    ; RC_BANDING Requires banding support.
    .IF ebx & RC_BANDING
        printf("RC_BANDING\n")
    .ENDIF
    ; RC_BITBLT Capable of transferring bitmaps.
    .IF ebx & RC_BITBLT
        printf("RC_BITBLT\n")
    .ENDIF
    ; RC_BITMAP64 Capable of supporting bitmaps larger than 64 KB.
    .IF ebx & RC_BITMAP64
        printf("RC_BITMAP64\n")
    .ENDIF
    ; RC_DI_BITMAP Capable of supporting the SetDIBits and GetDIBits functions.
    .IF ebx & RC_DI_BITMAP
        printf("RC_DI_BITMAP\n")
    .ENDIF
    ; RC_DIBTODEV Capable of supporting the SetDIBitsToDevice function.
    .IF ebx & RC_DIBTODEV
        printf("RC_DIBTODEV\n")
    .ENDIF
    ; RC_FLOODFILL Capable of performing flood fills.
    .IF ebx & RC_FLOODFILL
        printf("RC_FLOODFILL\n")
    .ENDIF
    ; RC_PALETTE Specifies a palette-based device.
    .IF ebx & RC_PALETTE
        printf("RC_PALETTE\n")
    .ENDIF
    ; RC_SCALING Capable of scaling.
    .IF ebx & RC_SCALING
        printf("RC_SCALING\n")
    .ENDIF
    ; RC_STRETCHBLT Capable of performing the StretchBlt function.
    .IF ebx & RC_STRETCHBLT
        printf("RC_STRETCHBLT\n")
    .ENDIF
    ; RC_STRETCHDIB Capable of performing the StretchDIBits function
    .IF ebx & RC_STRETCHDIB
        printf("RC_STRETCHDIB\n\n")
    .ENDIF

    inkey
    exit
;==============================================================================
end start

I'm not sure what to make of the GetDeviceCaps-RASTERCAPS return value. The console is not a palette-based device, but apparently supports bitmaps.

hwndCon 102D4
hdcCon E2010545
SIZEPALETTE 0

RC_BITBLT
RC_BITMAP64
RC_DI_BITMAP
RC_DIBTODEV
RC_FLOODFILL
RC_STRETCHBLT
RC_STRETCHDIB

Well Microsoft, here's another nice mess you've gotten us into.

nidud

#11
deleted

dedndave

i am not aware of a "kernel32-only" rule   :shock:

that is a very crippling rule, as many win32 functions lie outside kernel32

nidud

#13
deleted

jj2007

Quote from: nidud on October 24, 2012, 04:41:25 AM
Don't waste your time on this jj, it's complicated: stick to the Basic, its easy and comfy   :P

Well, under the hood it's often not comfy at all :greensml:

By the way, I liked your discussion of the expansion problem, and would support the warning option, especially since the workaround is very straightforward:

include \masm32\MasmBasic\MasmBasic.inc   ; download
  Init
  Let esi="This is a stupid test"
  .if Instr_(esi, "stuupid")
     PrintLine "stuupid found"
  .elseif Instr_(esi, "test")
     PrintLine "test found"
  .endif
  Inkey "Found something??", CrLf$
  .if Instr_(esi, "stuupid")
     PrintLine "stuupid found"
  .else
     .if Instr_(esi, "test")
          PrintLine "test found"
     .endif
  .endif
  Inkey "better??"
  Exit
end start