Author Topic: Resource compiler for console applications  (Read 38571 times)

nidud

  • Member
  • *****
  • Posts: 2388
    • https://github.com/nidud/asmc
Resource compiler for console applications
« on: October 24, 2012, 12:59:39 AM »
deleted
« Last Edit: February 25, 2022, 04:49:17 AM by nidud »

TouEnMasm

  • Member
  • *****
  • Posts: 1804
    • EditMasm
Re: Resource compiler for console applications
« Reply #1 on: October 24, 2012, 01:14:55 AM »
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

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Resource compiler for console applications
« Reply #2 on: October 24, 2012, 01:48:48 AM »
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

  • Member
  • *****
  • Posts: 2388
    • https://github.com/nidud/asmc
Re: Resource compiler for console applications
« Reply #3 on: October 24, 2012, 03:39:48 AM »
deleted
« Last Edit: February 25, 2022, 04:49:38 AM by nidud »

jj2007

  • Member
  • *****
  • Posts: 12661
  • Assembler is fun ;-)
    • MasmBasic
Re: Resource compiler for console applications
« Reply #4 on: October 24, 2012, 03:52:56 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.

Code: [Select]
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

  • Guest
Re: Resource compiler for console applications
« Reply #5 on: October 24, 2012, 03:59:18 AM »
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

  • Member
  • *****
  • Posts: 2388
    • https://github.com/nidud/asmc
Re: Resource compiler for console applications
« Reply #6 on: October 24, 2012, 04:41:25 AM »
deleted
« Last Edit: February 25, 2022, 04:49:56 AM by nidud »

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Resource compiler for console applications
« Reply #7 on: October 24, 2012, 04:43:21 AM »
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

  • Member
  • *****
  • Posts: 1804
    • EditMasm
Re: Resource compiler for console applications
« Reply #8 on: October 24, 2012, 04:45:29 AM »
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

  • Member
  • *****
  • Posts: 2388
    • https://github.com/nidud/asmc
Re: Resource compiler for console applications
« Reply #9 on: October 24, 2012, 05:32:45 AM »
deleted
« Last Edit: February 25, 2022, 04:50:14 AM by nidud »

MichaelW

  • Global Moderator
  • Member
  • *****
  • Posts: 1196
Re: Resource compiler for console applications
« Reply #10 on: October 24, 2012, 05:46:20 AM »
Code: [Select]
;==============================================================================
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.
Code: [Select]
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

  • Member
  • *****
  • Posts: 2388
    • https://github.com/nidud/asmc
Re: Resource compiler for console applications
« Reply #11 on: October 24, 2012, 06:15:39 AM »
deleted
« Last Edit: February 25, 2022, 04:50:30 AM by nidud »

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Resource compiler for console applications
« Reply #12 on: October 24, 2012, 08:39:00 AM »
i am not aware of a "kernel32-only" rule   :shock:

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

nidud

  • Member
  • *****
  • Posts: 2388
    • https://github.com/nidud/asmc
Re: Resource compiler for console applications
« Reply #13 on: October 24, 2012, 09:25:57 AM »
deleted
« Last Edit: February 25, 2022, 04:50:44 AM by nidud »

jj2007

  • Member
  • *****
  • Posts: 12661
  • Assembler is fun ;-)
    • MasmBasic
Re: Resource compiler for console applications
« Reply #14 on: October 24, 2012, 09:32:52 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