NASM Forum > Other Discussion

TASM32, MASM32, MASM64 Quines

<< < (2/2)

alCoPaUL:
I noticed that Windows moved away from hardcoded CrLf, which is still the defacto [Enter] in DOS/DOSBox/DOSBox-X, and just went to the MacOS UNIX standard of Lf only.

And this is why the first post had spaces (which is still valid in the context of being quine since it is defined as "a program that displays its own source code" and the sources display themselves without spaces) because when you use file1.exe > file1.txt, it will add an extra 0Dh to 0Dh0Ah, making the linebreak 0Dh0DhAh when you redirect the console output to save to file.

and with this post, i modded the sources from the original post to display themselves properly - whether seeing output from the console or redirected text output to file


--- Code: ---; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
; Benu
; by alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf]
; 2/27/2023 NYC
; tasm32 benu.asm
; tlink32 ~Tpe ~ap benu.obj,benu.exe,,tmsvcrt.lib,,
; /////////////////////////////////////////////////////////////////////////////////////////////
.686
.model flat,stdcall
extrn _printf:proc
.code
start:
enter 0,0
mov al,0Ah
mov bl,2Dh
z:lea edx,[a]
mov cx,1318
r:cmp byte ptr[edx],bl
je s
jmp u
s:mov byte ptr[edx],al
u:inc edx
dec cx
cmp cx,0
jnz r
cmp bl,0Ah
je td
push offset a
push offset i
call _printf
jmp ll
td:
lea edi,[n]
lea esi,[a]
mov cx,1372
sn:mov al,byte ptr[esi]
mov byte ptr[edi],al
inc esi
inc edi
dec cx
cmp cx,1224
je t
cmp cx,1074
je t
cmp cx,924
je t
cmp cx,774
je t
cmp cx,624
je t
cmp cx,474
je t
cmp cx,324
je t
cmp cx,174
je t
cmp cx,24
je t
jmp sts
t:mov byte ptr[edi],27h
mov byte ptr[edi+1],0Ah
mov byte ptr[edi+2],64h
mov byte ptr[edi+3],62h
mov byte ptr[edi+4],20h
mov byte ptr[edi+5],27h
add edi,6
jmp sts
sts:cmp cx,0
jne sn
push offset n
push offset i
call _printf
ll:mov al,0Ah
cmp bl,2Dh
xchg al,bl
je z
push offset x
push offset i
call _printf
leave
ret
.data
x db 2Ch,32h,37h,68h,2Ch,30h,0Ah,65h,6eh,64h,20h,73h,74h,61h,72h,74h,0
i db 25h,73h,0
n db 1319 DUP(0)
a db '; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////-; Benu-; by alCoPaUL [GIMO][As]'
db '[aBrA][NPA][b8][BCVG][rRlf]-; 2/27/2023 NYC-; tasm32 benu.asm-; tlink32 ~Tpe ~ap benu.obj,benu.exe,,tmsvcrt.lib,,-; //////////////////////////////////'
db '///////////////////////////////////////////////////////////-.686-.model flat,stdcall-extrn _printf:proc-.code-start:-enter 0,0-mov al,0Ah-mov bl,2Dh-z'
db ':lea edx,[a]-mov cx,1318-r:cmp byte ptr[edx],bl-je s-jmp u-s:mov byte ptr[edx],al-u:inc edx-dec cx-cmp cx,0-jnz r-cmp bl,0Ah-je td-push offset a-push '
db 'offset i-call _printf-jmp ll-td:-lea edi,[n]-lea esi,[a]-mov cx,1372-sn:mov al,byte ptr[esi]-mov byte ptr[edi],al-inc esi-inc edi-dec cx-cmp cx,1224-j'
db 'e t-cmp cx,1074-je t-cmp cx,924-je t-cmp cx,774-je t-cmp cx,624-je t-cmp cx,474-je t-cmp cx,324-je t-cmp cx,174-je t-cmp cx,24-je t-jmp sts-t:mov byte'
db ' ptr[edi],27h-mov byte ptr[edi+1],0Ah-mov byte ptr[edi+2],64h-mov byte ptr[edi+3],62h-mov byte ptr[edi+4],20h-mov byte ptr[edi+5],27h-add edi,6-jmp st'
db 's-sts:cmp cx,0-jne sn-push offset n-push offset i-call _printf-ll:mov al,0Ah-cmp bl,2Dh-xchg al,bl-je z-push offset x-push offset i-call _printf-leave'
db '-ret-.data-x db 2Ch,32h,37h,68h,2Ch,30h,0Ah,65h,6eh,64h,20h,73h,74h,61h,72h,74h,0-i db 25h,73h,0-n db 1319 DUP(0)-a db ',27h,0
end start

; ///////////////////////////////////////////////////////////////////////////////////////////
;
; Firebird
; by alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf]
; 2/27/2023 Revised: 3/03/2023 @ NYC
; ml64.exe firebird.asm /link /subsystem:console /defaultlib:64mscrt.lib /entry:main
;
; /////////////////////////////////////////////////////////////////////////////////////
extrn printf:proc
.code
main proc
sub rsp,28h
mov al,0Ah
mov bl,2Dh
z:lea r9,[a]
mov dx,1318
r:cmp byte ptr[r9],bl
je s
jmp u
s:mov byte ptr[r9],al
u:inc r9
dec dx
cmp dx,0
jnz r
cmp bl,0Ah
je td
lea rdx,[a]
lea rcx,[i]
call printf
jmp ll
td:
lea rdi,[n]
lea rsi,[a]
mov cx,1372
sn:mov al,byte ptr[rsi]
mov byte ptr[rdi],al
inc rsi
inc rdi
dec cx
cmp cx,1224
je t
cmp cx,1074
je t
cmp cx,924
je t
cmp cx,774
je t
cmp cx,624
je t
cmp cx,474
je t
cmp cx,324
je t
cmp cx,174
je t
cmp cx,24
je t
jmp sts
t:mov byte ptr[rdi],27h
mov byte ptr[rdi+1],0Ah
mov byte ptr[rdi+2],64h
mov byte ptr[rdi+3],62h
mov byte ptr[rdi+4],20h
mov byte ptr[rdi+5],27h
add rdi,6
jmp sts
sts:cmp cx,0
jne sn
lea rdx,[n]
lea rcx,[i]
call printf
ll:mov al,0Ah
cmp bl,2Dh
xchg al,bl
je z
lea rdx,[x]
lea rcx,[i]
call printf
add rsp,28h
ret
main endp
.data
b db 27h,0Dh,0Ah,64h,62h,20h,27h,0
x db 2Ch,32h,37h,68h,2Ch,30h,0Ah,65h,6eh,64h,0
i db 25h,73h,0
n db 1319 DUP(0)
a db '; ///////////////////////////////////////////////////////////////////////////////////////////-;-; Firebird-; by alCoPaUL [GIMO][As][aBrA][NPA][b8][B'
db 'CVG][rRlf]-; 2/27/2023 Revised: 3/03/2023 @ NYC-; ml64.exe firebird.asm /link /subsystem:console /defaultlib:64mscrt.lib /entry:main-;-; /////////////'
db '////////////////////////////////////////////////////////////////////////-extrn printf:proc-.code-main proc-sub rsp,28h-mov al,0Ah-mov bl,2Dh-z:lea r9,'
db '[a]-mov dx,1318-r:cmp byte ptr[r9],bl-je s-jmp u-s:mov byte ptr[r9],al-u:inc r9-dec dx-cmp dx,0-jnz r-cmp bl,0Ah-je td-lea rdx,[a]-lea rcx,[i]-call pr'
db 'intf-jmp ll-td:-lea rdi,[n]-lea rsi,[a]-mov cx,1372-sn:mov al,byte ptr[rsi]-mov byte ptr[rdi],al-inc rsi-inc rdi-dec cx-cmp cx,1224-je t-cmp cx,1074-j'
db 'e t-cmp cx,924-je t-cmp cx,774-je t-cmp cx,624-je t-cmp cx,474-je t-cmp cx,324-je t-cmp cx,174-je t-cmp cx,24-je t-jmp sts-t:mov byte ptr[rdi],27h-mov'
db ' byte ptr[rdi+1],0Ah-mov byte ptr[rdi+2],64h-mov byte ptr[rdi+3],62h-mov byte ptr[rdi+4],20h-mov byte ptr[rdi+5],27h-add rdi,6-jmp sts-sts:cmp cx,0-jn'
db 'e sn-lea rdx,[n]-lea rcx,[i]-call printf-ll:mov al,0Ah-cmp bl,2Dh-xchg al,bl-je z-lea rdx,[x]-lea rcx,[i]-call printf-add rsp,28h-ret-main endp-.data-'
db 'b db 27h,0Dh,0Ah,64h,62h,20h,27h,0-x db 2Ch,32h,37h,68h,2Ch,30h,0Ah,65h,6eh,64h,0-i db 25h,73h,0-n db 1319 DUP(0)-a db ',27h,0
end

; //////////////////////////////////////////////
;
; Feng Huang
; by alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf]
; 2/27/2023 Revised: 3/03/2023 @ NYC
; ml.exe fenghuang.asm /link /subsystem:console /defaultlib:32mscrt.lib /entry:main
;
; ////////////////////////////////////////////////////////////////
.686
.model flat,stdcall
extern printf:proc
.code
start:
main proc
enter 0,0
mov al,0Ah
mov bl,2Dh
z:lea edx,[a]
mov cx,1318
r:cmp byte ptr[edx],bl
je s
jmp u
s:mov byte ptr[edx],al
u:inc edx
dec cx
cmp cx,0
jnz r
cmp bl,0Ah
je td
push offset a
push offset i
call printf
jmp ll
td:
lea edi,[n]
lea esi,[a]
mov cx,1372
sn:mov al,byte ptr[esi]
mov byte ptr[edi],al
inc esi
inc edi
dec cx
cmp cx,1224
je t
cmp cx,1074
je t
cmp cx,924
je t
cmp cx,774
je t
cmp cx,624
je t
cmp cx,474
je t
cmp cx,324
je t
cmp cx,174
je t
cmp cx,24
je t
jmp sts
t:mov byte ptr[edi],27h
mov byte ptr[edi+1],0Ah
mov byte ptr[edi+2],64h
mov byte ptr[edi+3],62h
mov byte ptr[edi+4],20h
mov byte ptr[edi+5],27h
add edi,6
jmp sts
sts:cmp cx,0
jne sn
push offset n
push offset i
call printf
ll:mov al,0Ah
cmp bl,2Dh
xchg al,bl
je z
push offset x
push offset i
call printf
leave
ret
main endp
.data
b db 27h,0Dh,0Ah,64h,62h,20h,27h,0
x db 2Ch,32h,37h,68h,2Ch,30h,0Ah,65h,6eh,64h,20h,73h,74h,61h,72h,74h,0
i db 25h,73h,0
n db 1319 DUP(0)
a db '; //////////////////////////////////////////////-;-; Feng Huang-; by alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf]-; 2/27/2023 Revised: 3/03/2023 @'
db ' NYC-; ml.exe fenghuang.asm /link /subsystem:console /defaultlib:32mscrt.lib /entry:main-;-; /////////////////////////////////////////////////////////'
db '///////-.686-.model flat,stdcall-extern printf:proc-.code-start:-main proc-enter 0,0-mov al,0Ah-mov bl,2Dh-z:lea edx,[a]-mov cx,1318-r:cmp byte ptr[ed'
db 'x],bl-je s-jmp u-s:mov byte ptr[edx],al-u:inc edx-dec cx-cmp cx,0-jnz r-cmp bl,0Ah-je td-push offset a-push offset i-call printf-jmp ll-td:-lea edi,[n'
db ']-lea esi,[a]-mov cx,1372-sn:mov al,byte ptr[esi]-mov byte ptr[edi],al-inc esi-inc edi-dec cx-cmp cx,1224-je t-cmp cx,1074-je t-cmp cx,924-je t-cmp cx'
db ',774-je t-cmp cx,624-je t-cmp cx,474-je t-cmp cx,324-je t-cmp cx,174-je t-cmp cx,24-je t-jmp sts-t:mov byte ptr[edi],27h-mov byte ptr[edi+1],0Ah-mov b'
db 'yte ptr[edi+2],64h-mov byte ptr[edi+3],62h-mov byte ptr[edi+4],20h-mov byte ptr[edi+5],27h-add edi,6-jmp sts-sts:cmp cx,0-jne sn-push offset n-push of'
db 'fset i-call printf-ll:mov al,0Ah-cmp bl,2Dh-xchg al,bl-je z-push offset x-push offset i-call printf-leave-ret-main endp-.data-b db 27h,0Dh,0Ah,64h,62h'
db ',20h,27h,0-x db 2Ch,32h,37h,68h,2Ch,30h,0Ah,65h,6eh,64h,20h,73h,74h,61h,72h,74h,0-i db 25h,73h,0-n db 1319 DUP(0)-a db ',27h,0
end start

--- End code ---
regards,

alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf]

Navigation

[0] Message Index

[*] Previous page

Go to full version