Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Webdriver Torso assembly remake attempt (no squares)
; Webdriver Torso
format PE GUI 3.1
use16
align 1
entry start
heap 0
stack 0
width = 640
height = 360
include 'win32a.inc'
section '' code data readable executable writeable shareable discardable notpageable
start:
invoke GetModuleHandle, 0
mov [wc.hInstance], eax
;invoke LoadIcon, 0, IDI_APPLICATION
;mov [wc.hIcon], eax
;invoke LoadCursor, 0, IDC_ARROW
;mov [wc.hCursor], eax
invoke GetTickCount
invoke srand, eax
invoke RegisterClass, wc
invoke CreateWindowEx, 0,class,0,WS_VISIBLE+WS_SYSMENU,80,80,width+8,height+36,NULL,NULL,[wc.hInstance],NULL
mov [hwnd], eax
invoke CreateWindowEx, 0,static,0,WS_CHILD,0,0,240,120,[hwnd],NULL,[wc.hInstance],NULL
mov [boxa],eax
invoke GetDC, [hwnd]
invoke SetBkColor, [hdc], $0000FF
invoke CreateWindowEx, 0,static,NULL,WS_VISIBLE+WS_CHILD,8,332,256,16,[hwnd],0,[wc.hInstance],NULL
mov [txtdis],eax
invoke CreateFontA, 14,0,0,0,900,0,0,0,0,0,0,0,20h,fontface,1
mov [font], eax
invoke SendMessage, [txtdis],WM_SETFONT,[font],1
msg_loop:
invoke GetMessage,msg,NULL,0,0
or eax,eax
jz end_loop
invoke TranslateMessage,msg
invoke DispatchMessage,msg
jmp msg_loop
end_loop:
invoke ExitProcess,[msg.wParam]
proc WindowProc hwnd,wmsg,wparam,lparam
push ebx esi edi
cmp [wmsg],WM_PAINT
je .wmpaint
cmp [wmsg],WM_DESTROY
je .wmdestroy
cmp [wmsg],WM_CTLCOLORSTATIC
je .wmcolsta
.defwndproc:
invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
jmp .finish
.wmpaint:
invoke snprintf, strbuf, 22, strfmt, [frame]
invoke SetWindowText, [txtdis], strbuf
invoke rand
xor edx, edx
mov ebx, 1600
div ebx
add edx, 400
invoke Beep, edx, 1000
inc dword [frame]
xor eax, eax
jmp .finish
.wmcolsta:
invoke SetBkColor, hdc, $0000FF
;cmp [wparam], NULL
;je .wmcolsta2
invoke GetStockObject, NULL_BRUSH
ret
;.wmcolsta2:
;invoke CreateSolidBrush, $0000FF
;mov [wparam], eax
;ret
.wmdestroy:
invoke PostQuitMessage,0
xor eax, eax
.finish:
pop edi esi ebx
ret
endp
frame rd 1
strfmt db 'aqua.flv - Slide %04d',0
strbuf rb 22
wc WNDCLASS 0,WindowProc,0,0,NULL,NULL,NULL,NULL,NULL,class
hwnd dd ?
hdc dd ?
msg MSG
class db 'webdrvtorso',0
static db 'static',0
fontface db 'Courier New',0
font dd ?
txtdis dd ?
boxa dd ?
boxb dd ?
section '' import data readable writeable
library kernel,'KERNEL32.DLL',\
user,'USER32.DLL',\
msvcrt,'msvcrt.dll',\
gdi,'gdi32.dll'
import kernel,\
GetModuleHandle,'GetModuleHandleA',\
GetTickCount,'GetTickCount',\
ExitProcess,'ExitProcess',\
Beep,'Beep'
import msvcrt,\
srand,'srand',\
rand,'rand',\
snprintf,'_snprintf'
import user,\
RegisterClass,'RegisterClassA',\
CreateWindowEx,'CreateWindowExA',\
DefWindowProc,'DefWindowProcA',\
GetMessage,'GetMessageA',\
TranslateMessage,'TranslateMessage',\
DispatchMessage,'DispatchMessageA',\
LoadCursor,'LoadCursorA',\
LoadIcon,'LoadIconA',\
PostQuitMessage,'PostQuitMessage',\
SendMessage,'SendMessageA',\
MessageBox,'MessageBoxA',\
SetWindowText,'SetWindowTextA',\
GetDC,'GetDC'
import gdi,\
CreateFontA,'CreateFontA',\
SetBkColor,'SetBkColor',\
CreateSolidBrush,'CreateSolidBrush',\
GetStockObject,'GetStockObject'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.