Pages

vineri, 10 aprilie 2026

FASM : mouse crosshair with lines on the window GDI.

For a year now, it keeps hacking me on Windows. And when I am in a bad mood, I turn to complex things. Today, I wanted to see if I could make a functional assembly code with Microsoft's Copilot artificial intelligence and my assembly knowledge with FASM. Here is what resulted.
The program is a Win32 GUI application written in FASM that draws a crosshair (vertical + horizontal line) following the mouse cursor inside a window classic GDI.
1. Window Setup
The app starts by registering a Win32 window class (WNDCLASSEX) and creating a standard overlapped window. Nothing unusual here — just the classic Win32 boilerplate.
2. Message Loop
The program enters the main loop:
  • GetMessage
  • TranslateMessage
  • DispatchMessage
This keeps the window responsive and forwards events to the window procedure.
3. Tracking the Mouse
Whenever the mouse moves inside the window, Windows sends a WM_MOUSEMOVE message. The program extracts the X and Y coordinates from lParam:
  • LOWORD(lParam) → X
  • HIWORD(lParam) → Y
These values are stored and the window is invalidated so it can be repainted.
4. Drawing the Crosshair (GDI)
All drawing happens inside WM_PAINT using classic GDI:
  • MoveToEx
  • LineTo
  • Ellipse
  • TextOut
  • FillRect
The steps are:
  • Clear the client area
  • Get the window’s current size (GetClientRect)
  • Draw a vertical line at the mouse’s X position
  • Draw a horizontal line at the mouse’s Y position
  • Draw a small circle at the intersection
  • Print the coordinates in the corner
Because the client size is read dynamically, the crosshair always stretches across the entire window — no matter how it’s resized.
See the source code
; mouse_crosshair.asm
format PE GUI 4.0
entry start
include "win32a.inc"

WM_MOUSEMOVE = 0x0200

section '.data' data readable writeable

    szClass db "MouseGraph",0
    szTitle db "Mouse Crosshair Demo",0

    mouseX dd 0
    mouseY dd 0

    fmt    db "X=%d  Y=%d",0
    buffer db 64 dup(0)

    rc  RECT
    ps  PAINTSTRUCT
    wc  WNDCLASSEX
    msg MSG

section '.code' code readable executable

start:
    invoke GetModuleHandle,0
    mov [wc.hInstance],eax

    mov [wc.cbSize],sizeof.WNDCLASSEX
    mov [wc.style],CS_HREDRAW or CS_VREDRAW
    mov [wc.lpfnWndProc],WndProc
    mov [wc.cbClsExtra],0
    mov [wc.cbWndExtra],0
    mov [wc.hIcon],0
    mov [wc.hIconSm],0
    mov [wc.lpszMenuName],0
    mov [wc.lpszClassName],szClass
    mov [wc.hbrBackground],COLOR_WINDOW+1

    invoke LoadCursor,0,IDC_ARROW
    mov [wc.hCursor],eax

    invoke RegisterClassEx,wc

    invoke CreateWindowEx,0,szClass,szTitle,\
           WS_VISIBLE+WS_OVERLAPPEDWINDOW,\
           200,200,800,600,0,0,[wc.hInstance],0

msg_loop:
    invoke GetMessage,msg,0,0,0
    test eax,eax
    jz exit
    invoke TranslateMessage,msg
    invoke DispatchMessage,msg
    jmp msg_loop

exit:
    invoke ExitProcess,0

; ---------------------------------------------------------
proc WndProc hWnd,uMsg,wParam,lParam

    cmp [uMsg],WM_MOUSEMOVE
    je .mouse

    cmp [uMsg],WM_PAINT
    je .paint

    cmp [uMsg],WM_DESTROY
    je .destroy

.def:
    invoke DefWindowProc,[hWnd],[uMsg],[wParam],[lParam]
    ret

; ---------------- WM_MOUSEMOVE ----------------
.mouse:
    mov eax,[lParam]
    and eax,0FFFFh
    mov [mouseX],eax

    mov eax,[lParam]
    shr eax,16
    and eax,0FFFFh
    mov [mouseY],eax

    invoke InvalidateRect,[hWnd],0,TRUE
    ret

; ---------------- WM_PAINT ----------------
.paint:
    invoke BeginPaint,[hWnd],ps
    mov esi,eax ; hdc

    ; clean client
    invoke GetClientRect,[hWnd],rc
    invoke FillRect,esi,rc,COLOR_WINDOW+1

    ; pen red
    invoke CreatePen,PS_SOLID,1,0x0000FF
    mov ebx,eax
    invoke SelectObject,esi,ebx

    ; ---------------- linie verticala (cruce) ----------------
    mov eax,[mouseX]        ; X constant
    mov edx,[rc.bottom]     ; Y max (jos)
    invoke MoveToEx,esi,eax,0,0
    invoke LineTo,esi,eax,edx

    ; ---------------- line  ----------------
    mov eax,[mouseY]        ; Y constant
    mov edx,[rc.right]      ; X max (dreapta)
    invoke MoveToEx,esi,0,eax,0
    invoke LineTo,esi,edx,eax

    ; punct în intersec?ie
    mov eax,[mouseX]
    mov edx,[mouseY]
    invoke Ellipse,esi,eax-4,edx-4,eax+4,edx+4

    ; text coordonate
    invoke wsprintf,buffer,fmt,[mouseX],[mouseY]
    invoke lstrlen,buffer
    invoke TextOut,esi,10,10,buffer,eax

    invoke EndPaint,[hWnd],ps
    ret

; ---------------- WM_DESTROY ----------------
.destroy:
    invoke PostQuitMessage,0
    ret

endp

section '.idata' import data readable
library kernel32,"KERNEL32.DLL",\
        user32,"USER32.DLL",\
        gdi32,"GDI32.DLL"

include "api/kernel32.inc"
include "api/user32.inc"
include "api/gdi32.inc"

News : SASM - SimpleASM has support multiple languages.

... multi-languages for this good assembly editor named SASM - SimpleASM.
SASM (SimpleASM) - simple Open Source crossplatform IDE for NASM, MASM, GAS, FASM assembly languages. SASM has syntax highlighting and debugger. The program works out of the box and is great for beginners to learn assembly language. SASM is translated into Russian, English, Turkish (thanks Ali Goren), Chinese (thanks Ahmed Zetao Yang), German (thanks Sebastian Fischer), Italian (thanks Carlo Dapor), Polish (thanks Krzysztof Rossa), Hebrew (thanks Elian Kamal), Spanish (thanks Mariano Cordoba), Portuguese (thanks alglus), French (thanks Franc Serres), Brazilian Portuguese (thanks williampe99), Japanese (thanks ookatuk). Licensed under the GNU GPL v3.0. Based on the Qt.

Tools : test devv.ai for development with artificial intelligence.

Today I tested devv.ai and I asked it to make me an image generator with a prompt.
The issue was : Create an AI image generator app with gallery and user authentication.
After the application was created , I tested online on this webpage.
I asked on the prompt : A magnificent futuristic city based on Christianity, science and knowledge, robots, rehabilitation centers, food, everything is free and fair, without weapons or coercive institutions.
This is resized result:

marți, 7 aprilie 2026

Tools : Xournal++ best free tool for handwritten notes.

Xournal++ (/ˌzɚnl̟ˌplʌsˈplʌs/) is an open-source and cross-platform note-taking software that is fast, flexible, and functional. A modern rewrite and a more feature-rich version of the wonderful Xournal program.
Support for pressure-sensitive stylus and drawing tablets (Wacom, Huion, XP-Pen, etc.).
Robust and customizable pen, highlighter and eraser tools, allowing you to write how you want to write.
Use layers to make complex notes that are still pleasant to work with.
Keep track of the notes by using page previews.
Add images and create various shapes, from circles to splines to axis.
Snap objects to rectangular grid or degrees of rotation.
Create anything from differential equations to electrical circuits or the structural formula of molecules using our built-in LaTeX editor.
Customize your toolbar to create a new layout, tailor-made for you.
Use a plugin or create your own via the Lua programming language.
Record audio while you write and insert the recording to any object in your note.
Listen to the recorded audio with the 'Play Object' tool.
Xournal++ for Mobile is now available in Beta!
In short, Xournal++ is a powerful, free tool for handwritten notes, PDF annotation, and technical or academic work — especially if you use a stylus.
You can use with yours any operating system: Linux, Apple, mobile and Windows.
This application can be download from the official website.

News : Did you know Riot Games used Moho to animate their latest Valorant short film?

luni, 6 aprilie 2026

News : Google AdSense upcoming changes.

Starting on or after April 20, 2026, Google AdSense will experiment with an updated set of commonly used ad technology partners. If this experiment is deemed beneficial for publishers, the list will be updated on or after June 5, 2026. This update will reflect the partners that work most closely with publishers globally, determined by data collected from all programmatic demand sources, as well as meeting our privacy standards.
You'll be able to find the up-to-date version of the list published at Manage your ad technology partners (ATPs). You can view the controls, the list of current ad technology partners and, once the experiment starts, those who are part of the experiment in your account in Privacy & messaging, on the European regulations settings page, in the "Your ad partners" menu.
If you want to prevent automatic updates or do not want to participate in the experiment, select "Do not automatically include commonly used ad partners". This will create a custom list pre-filled with your current selections, which you can then modify as needed. If you're using a third-party CMP to collect GDPR consent, your list of ad tech partners is managed through your CMP provider.

News : Low price for Trae AI - best and cheap development tool.

See the trae AI tool for development with low prices, started from 3 euro .

Tools : PlayCanvas Developer Site is easy to use ...

You need to read the documantation to be more accurate from the official website.

News : The new Qt Quick 3D with XR and VR applications into new Qt 6.11.

This is an old news from two weeks ago about the Qt 6.11.
Even the Qt was released now the news comes about the Qt Quick 3D:
Qt Quick 3D provides a high-level API for creating 3D content and 3D user interfaces based on Qt Quick. Rather than using an external engine, which creates syncing issues and additional layers of abstraction, Qt Quick 3D provides extensions to the existing Qt Quick Scene Graph for spatial content and a renderer for that extended scene graph. When using the spatial scene graph, it's possible to mix Qt Quick 2D content with 3D content.
Qt Quick 3D also provides for XR and VR applications with Qt Quick 3D Xr.
See the new video from the official youtube channel - Qt Studio about the new released Qt 6.11.