Skip to content

Commit

Permalink
2.36.02
Browse files Browse the repository at this point in the history
  • Loading branch information
nidud committed Nov 1, 2024
1 parent 0d69fa0 commit 82ea2f7
Show file tree
Hide file tree
Showing 13 changed files with 330 additions and 163 deletions.
Binary file modified bin/dz.exe
Binary file not shown.
6 changes: 3 additions & 3 deletions bin/st/asm.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
0=W XF cs ds es ss fs gs

[.cpu_acc]
0=W X4 rax eax ax al ah
0=W X9 rax eax ax al ah

[.cpu_reg1]
0=W X2 rcx ecx cx cl ch
Expand Down Expand Up @@ -269,7 +269,7 @@
2=.ELSEIFD .ELSEIFS .ELSEIFSD

[.conditional_control_flow]
0=W XF .ASSERT .BREAK .CASE .CLASS .CONTINUE .COMDEF .DEFAULT .ENUM .ENUMT .ENDW
0=W XF .ASSERT .ASSERTD .BREAK .CASE .CLASS .CONTINUE .COMDEF .DEFAULT .ENUM .ENUMT .ENDW
1=.ENDC .ENDN .ENDSW .ENDS .FOR .GOTOSW .INLINE .NAMESPACE .NEW .OPERATOR .REPEAT
2=.RETURN .STATIC .SWITCH .TEMPLATE .UNTIL .untilb .UNTILCXZ .WHILE .ENDF

Expand Down Expand Up @@ -314,7 +314,7 @@
0=W XF ENDM FOR FORC GOTO REPEAT WHILE

[.scope]
0=W XF COMM EXTERN EXTERNDEF PUBLIC
0=W XF COMM EXTERN EXTERNDEF PUBLIC EXPORT

[.segment]
0=W XF .ALPHA ASSUME .DOSSEG END ENDS GROUP SEGMENT .SEQ
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ Asmc Macro Assembler Reference
- [Symbols Reference](doc/symbol/readme.md)
- [Operators Reference](doc/operator/readme.md)
- [Asmc Build Tools Reference](doc/tools/readme.md)

![AddPackageSample.asm](source/tools/bitmap/imgconv/default.png)
6 changes: 6 additions & 0 deletions source/libc/conio/_rczip.asm
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ compress:
jmp .6
.2:
inc ebx
bt ebx,16
jc .9
add rsi,4
mov al,[rsi]
cmp al,[rsi+4]
Expand All @@ -189,6 +191,10 @@ compress:
mov al,dl
stosb
jmp .7
.9:
dec ebx
inc ecx
jmp .4
.5:
xchg ah,al
.6:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ wmain proc argc:int_t, argv:ptr wstring_t
.new Status:AsyncStatus = 0
.new progressHandler:ptr ProgressHandler(&completedEvent, &Status)
mov hr,deploymentOperation.put_Completed(progressHandler)
;.if (SUCCEEDED(hr))
; mov hr,deploymentOperation.put_Progress(progressHandler)
;.endif
.endif

.if (SUCCEEDED(hr))
Expand All @@ -121,11 +118,12 @@ wmain proc argc:int_t, argv:ptr wstring_t

.if (Status == AsyncStatus_Error)

.new errorMsg:ptr wchar_t = "Unknown"
.new errorMsg:wstring_t = "Unknown"
.new errorCode:int_t = 0

.new deploymentResult:ptr Windows::Management::Deployment::IDeploymentResult = nullptr
mov hr,deploymentOperation.GetResults(&deploymentResult)

.if (SUCCEEDED(hr))

.new errorText:HSTRING = nullptr
Expand Down
128 changes: 92 additions & 36 deletions source/tools/bitmap/conbmp/conbmp.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; Copyright (c) The Asmc Contributors. All rights reserved.
; Consult your license regarding permissions and restrictions.
;
; Capture the console window to (a relatively large) bitmap.
; Capture the console window to bitmap.
;
include stdio.inc
include windows.inc
Expand All @@ -25,20 +25,69 @@ _tmain proc argc:int_t, argv:array_t
.new retval:DWORD = 1
.new rc:RECT
.new bf:BITMAPFILEHEADER
.new color[256]:DWORD
.new bi:BITMAPINFOHEADER
.new hWnd:HWND
.new file:tstring_t = "default.bmp"
.new bits:int_t = 4
.new colors:int_t = 16

.if ( argc > 1 )
.for ( ebx = 1 : ebx < argc : ebx++ )

mov rcx,argv
mov rbx,[rcx+size_t]
.if ( byte ptr [rbx] == '-' || byte ptr [rbx] == '/' )
_putts("usage: CONBMP [<bmp_file>]\n")
.return( 0 )
mov rcx,[rcx+rbx*size_t]
mov eax,[rcx]
.if ( al == '-' || al == '/' )
shr eax,8
.switch al
.case '1'
.if ( ah == '6' )
mov bits,16
mov colors,0
.else
mov bits,1
mov colors,2
.endif
.endc
.case '2'
.if ( ah == '4' )
mov bits,24
mov colors,0
.else
mov bits,2
mov colors,4
.endif
.endc
.case '4'
mov bits,4
mov colors,16
.endc
.case '8'
mov bits,8
mov colors,256
.endc
.case '3'
mov bits,32
mov colors,0
.endc
.default
_putts(
"usage: CONBMP [ -<bits_per_pixel> ] [ <bmp_file> ]\n"
"\n"
"-1 2 colors (monochrome)\n"
"-2 4 colors\n"
"-4 16 colors (default)\n"
"-8 256 colors\n"
"-16 2^16 colors\n"
"-24 2^24 colors\n"
"-32 2^32 colors\n"
"\n" )
.return( 0 )
.endsw
.else
mov file,rcx
.endif
mov file,rbx
.endif
.endf

mov hWnd,GetConsoleWindow()
GetClientRect(hWnd, &rc)
Expand Down Expand Up @@ -79,40 +128,47 @@ _tmain proc argc:int_t, argv:array_t
mov bi.biWidth,bmp.bmWidth
mov bi.biHeight,bmp.bmHeight
mov bi.biPlanes,1
mov bi.biBitCount,32
mov bi.biBitCount,bits
mov bi.biCompression,BI_RGB
mov bi.biSizeImage,0
mov bi.biXPelsPerMeter,0
mov bi.biYPelsPerMeter,0
mov bi.biClrUsed,0
mov bi.biClrUsed,colors
mov bi.biClrImportant,0

movzx ecx,bi.biBitCount
mov eax,bmp.bmWidth
mul ecx
add eax,31
shr eax,5
shl eax,2
mul bmp.bmHeight
mov bmpsize,eax

mov rsi,GlobalAlloc(GHND, bmpsize)
mov rdi,GlobalLock(rsi)
GetDIBits(hdc, hbm, 0, bmp.bmHeight, rdi, &bi, DIB_RGB_COLORS)
mov rbx,CreateFile(file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)
mov eax,bmpsize
add eax,BITMAPFILEHEADER + BITMAPINFOHEADER
mov dibsize,eax
mov bf.bfOffBits, BITMAPFILEHEADER + BITMAPINFOHEADER
mov bf.bfSize,dibsize
mov bf.bfType,0x4D42 ; BM.
WriteFile(rbx, &bf, BITMAPFILEHEADER, &written, NULL)
WriteFile(rbx, &bi, BITMAPINFOHEADER, &written, NULL)
WriteFile(rbx, rdi, bmpsize, &written, NULL)
GlobalUnlock(rsi)
GlobalFree(rsi)
CloseHandle(rbx)
mov retval,0
.ifd GetDIBits(hdc, hbm, 0, bmp.bmHeight, 0, &bi, DIB_RGB_COLORS)

mov bmpsize,bi.biSizeImage

mov rsi,GlobalAlloc(GHND, bmpsize)
mov rdi,GlobalLock(rsi)

.ifd GetDIBits(hdc, hbm, 0, bmp.bmHeight, rdi, &bi, DIB_RGB_COLORS)

mov rbx,CreateFile(file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)
mov eax,bmpsize
add eax,BITMAPFILEHEADER + BITMAPINFOHEADER
mov dibsize,eax
mov bf.bfOffBits, BITMAPFILEHEADER + BITMAPINFOHEADER
mov bf.bfSize,dibsize
mov bf.bfType,0x4D42 ; BM.
WriteFile(rbx, &bf, BITMAPFILEHEADER, &written, NULL)
WriteFile(rbx, &bi, BITMAPINFOHEADER, &written, NULL)
.if ( colors )
imul ecx,colors,4
WriteFile(rbx, &color, ecx, &written, NULL)
.endif
WriteFile(rbx, rdi, bmpsize, &written, NULL)
CloseHandle(rbx)
mov retval,0
.else
_putts("GetDIBits failed\n")
.endif
GlobalUnlock(rsi)
GlobalFree(rsi)
.else
_putts("GetDIBits failed\n")
.endif
done:
DeleteObject(hbm)
DeleteObject(mdc)
Expand Down
3 changes: 2 additions & 1 deletion source/tools/bitmap/conbmp/makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
conbmp.exe:
asmc64 -pe -frame $*.asm
asmc64 -pe -frame -Fo ..\..\..\..\bin\$@ $*.asm
$@ -?
Loading

0 comments on commit 82ea2f7

Please sign in to comment.