News:

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

Main Menu

Uncle Remus Tales

Started by Mikl__, May 26, 2017, 08:43:47 PM

Previous topic - Next topic

zedd151

Quote from: Mikl__.... But it was just a bot

Hey,  we showed up too...    :icon_mrgreen:

Mikl__

Hi, zedd151!
I'm glad to see you again

zedd151

#77
Just for the record I downloaded movie 01-04, renamed zips  and extracted movie.gif.  so what's the next step?


:bgrin:

zedd151

#78
No, okay I got it. I read further on and in the source == exe looking for movie.gif.

That's pretty good there, Mikl__.

edit == converted the screen capture to gif for size.

Mikl__

Windows Creator
A training program for experimenting with numerous parameters of the functions used - so you do not have to edit and compile the source code of the "training" project each time, and you could select the necessary options right in the dialog box and immediately see the result.
Because the forum does not allow you to attach more than four files, so I had to break the message into three parts

Mikl__


Mikl__

ending
asm-/exe- and resource-files and bat-file for building

jj2007

Fascinating stuff, Mikl! In particular, I wonder how you build that 48-bit code ;)

Mikl__

#83
Ciao, Jochen!
Why did you write about 48-bit code?

jj2007

Have a closer look at the path:

Mikl__

#85
In the beginning there was a directory "masm64", then I created a new directory "masm63", then, well, you can guess yourself...

zedd151

Quote from: Mikl__ on August 04, 2018, 02:16:58 AM
then I created a new directory "masm63"



Sounded like masm64 was a little under par.

Mikl__

#87
Ciao, Jochen!
Hi, All!
Tiny help for the windows creator
  • If you click on Edit->Save you create file "tut_03b.asm".
  • If you click on File-> create window you run "asm3.bat tut_03b.asm".
You must have a directory of masm48 and subdirectories of bin, lib, include. There are ml64.exe, link.exe etc. in masm48\bin and lib- and inc-files in lib- and include-subdirectories. You can change the folder name "masm48" to the one you use. Look carefully at the contents of the file asm3.bat and configure it for yourself. The names of the folders and the structure of your package with the assembler compiler ONLY inside the file asm3.bat.
  • There is attached lib-folder
  • There is attached include-folder
  • There aren't ml64.exe and link.exe in attached bin-folder for obvious reasons, I do not want to violate Microsoft copyrights
If you see errors in the description in English, please write me about them and I will make corrections.

Mikl__

Rotating Text Window
I once laid out the program with rotating text, now I had to update it, because with a sharp change in the size of the window, the rotating inscription lost the center of the window and its movements became unpredictable. Now I have corrected this defect
; GUI #
include win64a.inc
.code
WinMain proc
local msg:MSG

    xor ebx,ebx
    mov esi,IMAGE_BASE
    mov edi,offset ClassName
mov ecx,offset FileName
invoke LoadCursorFromFile
mov r12,rax
        mov ecx,0FF0000h
invoke CreateSolidBrush
    push r12 ;hIconSm
    push rdi ;lpszClassName
    push rbx ;lpszMenuName
    push rax ;hbrBackground
    push 10003h ;hCursor
    push r12 ;hIcon
    push rsi ;hInstance
    push rbx ;cbClsExtra & cbWndExtra
    pushaddr WndProc    ;lpfnWndProc
    push sizeof WNDCLASSEX;cbSize & style
    invoke RegisterClassEx,esp    ;addr WNDCLASSEX
    push rbx
    push rsi ;rsi=400000h
    shr esi,7 ;Special CreateWindow position value CW_USEDEFAULT=8000h
    push rbx
    push rbx
    push rsi
    push rsi
    push rsi
    push rsi
    sub esp,20h
    invoke CreateWindowEx,0,edi,edi,WS_OVERLAPPEDWINDOW or WS_VISIBLE
;create timer #0 in 50mSec
    invoke SetTimer,eax,0,50,0
; +---------------------------+
; | entering the message loop |
; +---------------------------+
lea edi,msg
@@: invoke GetMessage,edi,0,0,0
invoke DispatchMessage,edi
jmp @b
WinMain endp
WndProc proc hwnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
local ps:PAINTSTRUCT
local newFont:qword
local oldFont:qword
local x1:dword
local y1:dword
local hDC:qword
local lpPoint:POINT

    mov hwnd,rcx

    cmp edx,WM_DESTROY
    je wmDESTROY
    cmp edx,WM_PAINT
    je wmPAINT
        cmp edx,WM_SIZE
    je wmSIZE
    cmp edx,WM_TIMER
    je wmTIMER
    leave
    jmp NtdllDefWindowProc_
wmDESTROY:invoke KillTimer,,0;destroy timer #0
invoke RtlExitUserProcess,0
wmSIZE: mov edx,offset expRect
invoke GetClientRect    ;get the size of the client area.
;Dimensions return to a variable expRect
mov eax,expRect.bottom
shr eax,1   
mov y,eax ;y-coordinate of the middle of the screen
mov eax,expRect.right
shr eax,1   
mov x,eax ;x-coordinate of the middle of the screen
jmp wmBYE
wmTIMER:invoke InvalidateRect,,0,TRUE;redraw the text with the current angle value
finit
jmp wmBYE
wmPAINT:lea edx,ps
invoke BeginPaint
mov hDC,rax
invoke SetTextColor,hDC,32C8C8h;RGB=50,200,200 golden letters
invoke SetBkColor,hDC,0FF0000h;RGB=0,0,255 on a blue background
;create a font with the rotation angle specified in lfEscapement and lfOrientation
pushaddr expFont
push DEFAULT_PITCH or FF_SCRIPT
push rbx        ;DEFAULT_QUALITY=0
push rbx        ;CLIP_DEFAULT_PRECIS=0
push rbx        ;OUT_DEFAULT_PRECIS=0
push OEM_CHARSET
push rbx
push rbx
push rbx
push 400
sub esp,20h
invoke CreateFont,26,12,angle,r8
mov newFont,rax
invoke SelectObject,hDC,rax
mov oldFont,rax
;---------text output
mov qword ptr [rsp+20h],sizeof expTxt;length of string
mov r9d,offset expTxt           ;line address
;---------I calculate the position of the beginning of the text
fld angle2;angle of text rotation in radians
fld st(0)
fsincos ;in st(0) the sine of the angle, in st(1) cosine
mov y1,227    ;half of hypotenuse
fimul y1    ;hypotenuse * sin = x
fistp x1
mov edx,x
add edx,x1
fimul y1    ;hypotenuse * cos = y
fistp y1    ;-y
fadd delta      ;increased the angle by 1.6 degrees
fst angle2
fmul delta2 ;translate radians to degrees
fsub delta3  ;The angle of the text is lagging behind the rotation angle by 180 degrees
fld st(0)
fmul delta4
fsubp st(1),st(0)
fistp angle     ;divide the angle by 360 degrees and remember the remainder
mov r8d,y
sub r8d,y1
invoke TextOut,hDC
invoke DeleteObject,newFont ;delete the new font
invoke SelectObject,hDC,oldFont;return the old font to the system
invoke EndPaint,hwnd,&ps
wmBYE:leave
    retn
WndProc endp
;---------------------------------------
ClassName db "Uncle Remus tales:#5 Painting with Rotation Text",0
expTxt  db "Win64 assembly with MASM is great and easy!",0
expFont db "script",0
angle   dq 0
angle2  dq 3.14159265358979323846264338328
delta   dq 0.02792526803190927323077905229;pi*1,6/180
delta2 dq 572.957795130823208767981548141;1800/pi
delta3 dq 1800.0
delta4 dq 0.00027777777777777777777777778;1/3600
hIcon dq ?
FileName db "br_Rabbit3.cur",0
expRect  RECT <>
x dd ?
y dd ?
end

zedd151

Could be a problem on my end, (no video driver available for Win 7 for this new hardware) but the text stays centered, but there is a lot of flicker in the text (disappearing and reappearing - correct  location, though)  Windows 7 , AMD A6-9220e, RADEON graphics.

I'm going to fire up windws 10 (has all drivers installed) and take another look at it...   8)