[ home ] [ q / soy / qa / r / nate ] [ a / health / incel / int / mtv / pol / psy / raid / sci ] [ overboard ] [ rules ] [ bans ] [ wiki ] [ booru ] [ archive ] [ merch ] [ donate ]

/tech/ - Technology

Name
Options
Comment
File
Embed
Password (For file deletion.)

File: 1687113147707.png (109.22 KB, 640x714, 1637968873954.png)ImgOps

 6243

>mov al, bl
>aam 3
>cmp al, 0
>jnz .fif

 6246

>>6243
>cmp al, 0
or al, al
>aam 3
based bcd instruction

 6251

>>6246
yes
>AAM is shown as a two byte encoding used to divide AL by 10, putting the quotient in AH, and the remainder in AL. However, AAM is listed in the op code map as a single byte instruction. This leads one to wonder why a two-byte opcode is listed in the single-byte opcode map. In reality, the second byte is an undocumented operand to AAM. The operand is the divisor. In its documented incarnation, AAM is encoded as D4 0A. The operand 0A is the divisor. This divisor can be changed to any value between 0 and FF. Using AAM in this manner is useful -- as it extends the CPU instruction set to include a DIV IMM8 instruction that is not available from any other form of the DIV instruction. The extended form of the AAM instruction is also useful because it sets the flags register according to the results, unlike the DIV or IDIV instruction. According to Intel documentation, SF, ZF, and PF flags are set according to the result, while OF, AF, and CF are undefined. However, if AAM were used strictly as documented, then the Sign Flag (SF) could not be set under any circumstances, since anything divided by 10 will leave a remainder between 0 and 9. Obviously the remainder could never be between 128 and 255 (or -1 and -128 if you prefer) if used only as documented. Since AAM divides an 8 bit number by another 8-bit number, a carry or overflow could never occur. Therefore CF and OF always=0. Intel claims they are undefined, but my observations are consistent with my theory. Contrary to documentation, AAM will generate exceptions in real mode, protected mode, and V86 mode. AAM can only generate Exception 0 -- divide by 0. Finally, in the Pentium User's Manual, this heretofore undocumented form of AMM is described. Intel says:

>"Note: imm8 has the value of the instruction's second byte. The second byte under normally assembly [sic] of this instruction will be 0A, however, explicit modification of this byte will result in the operation described above and may alter results."


>This instruction exists in this form on all Intel x86 processors. See the file AAM.ASM for diagnostics source code for this instruction.

 6357

aam updated the zero flag so no need for "or al, al", code size is now 69 bytes with the call to printf being deduplicated

 6358

DOLLLLLLLLLLLLLLLL ADD COPDE TAGS
section .text

extern printf
global main

main:
push ebp
mov ebp, esp
xor ebx, ebx; i

.loop:
inc bl
cmp bl, 100; max
jge .exit

mov al, bl
aam 3
jnz .fif

; &&

mov al, bl
aam 5
jnz .fif

push fizzbuzz
jmp .print

.fif:
mov al, bl
aam 3
jnz .sif

push fizz
jmp .print

.sif:
mov al, bl
aam 5
jnz .tif

push buzz
jmp .print

.tif:
push ebx
push nil
jmp .print

.exit:
mov esp, ebp
leave
ret

.print:;duplicate code removal
call printf
jmp .loop

section .data
nil:db'%d',13,10,0
fizz:db'fizz',13,10,0
buzz:db'buzz',13,10,0
fizzbuzz:db'fizzbuzz',13,10,0

 6359

File: 1687205040863.png (5.65 KB, 204x198, ClipboardImage.png)ImgOps

beat that executable size rust trannies

 6361

wtf is aam and cool .fif name

 6362

>>6361
see >>6251
also, label names are always incomprehensible jiberish

 6363

>>6362
lables can be anything

 6365

>>6359
you can make it even smaller by unaligning the sections.

 6367

>>6359
the test can be replaced with the loop instruction.

 6371

>>6367
He is counting up though. loop would count down from 100 with cl.

 6372

>>6358
[[fizz]pss]sz[[buzz]pss]sb[[fizzbuzz]pss]sc[p]sp1[.1ssd3%vsad5%2*la+d2=zd4=zd1=b0=clsX1=p1+d100>f]dsfx though

 6374

>>6371
and ecx is bulldozed by printf, requiring a push and pop on the stack, bytes saved would be instantly taken up push/pop instructions

 6375

>>6359
unironically too big

 6376

>All X86 opcodes are supported. Only ATT syntax is supported (source then destination operand order). If no size suffix is given, TinyCC tries to guess it from the operand sizes.
jeez, tcc is garbage, plus i cant find the section thing, doesnt help that the nigger rigged build script is also trash lmao

>..\..\..\..\global_tools\nasm -felf fizzbuzz.asm

>..\..\..\..\global_tools\tcc\tcc.exe -m32 fizzbuzz.o

 6377

>>6359
It's crazy to think that entire operating systems used to fit on a floppy

 6381

>>6376
why are you using tcc as a linker? FASM can output pe executables natively.

 6382

--g--

 6383

--g--

 6384

--g--

 6531

>flddword [fiveNineths]
>flddword [thirtyTwo]
>flddword [ebp - 4]
>fsub
>fdiv
>fstdword [ebp - 4]

hope this works first try lol

 6532

>>6531
DOOOOOOOOOOOOOOOLL DONT DELETE TABS, REPLACE THEM WITH SPACES

 6538

>>6532
this

 6542

DOOOOOOOOOOOOOOOOOOOOLL ADD CODE TAGS
it works!


section .text

extern printf, scanf
global main

main:
push ebp
mov ebp, esp
sub esp, 8

push str_option
call printf
add esp, 4
lea eax, [ebp - 4]
push eax
push str_num
call scanf
add esp, 8

push str_input
call printf
add esp, 4
lea eax, [ebp - 8]
push eax
push str_num
call scanf
add esp, 8


mov eax, [ebp - 4]
and eax, 1
jnz .toFahrenheit


.toCelsius:
fild dword [ebp - 8]
fild dword [thirtyTwo]
fsub
fld dword [fiveNineths]
fdiv
fist dword [ebp - 8]
jmp .printResult

.toFahrenheit:
fild dword [thirtyTwo]
fld dword [fiveNineths]
fild dword [ebp - 8]
fmul
fadd
fist dword [ebp - 8]

.printResult:
push dword [ebp - 8]
push str_format_result
call printf

xor eax, eax
add esp, 16
pop ebp
mov esp, ebp
leave
ret

section .data
fiveNineths: dd 1.8
thirtyTwo: dd 32
str_option: db '[0]toCelsius, [1]toFahrenheit: ', 0
str_input: db 'input temperature: ', 0
str_format_result: db 'Result: %d',13,10,0
str_num: db '%d', 0

 7203

File: 1688056207462.png (160.42 KB, 1360x768, ClipboardImage.png)ImgOps

>ONE BYTE

 7205

i should write an actual keygen for this garbage, how bad can it be?

 7214

File: 1688077169370.png (146 KB, 1360x768, ClipboardImage.png)ImgOps

>hmm, this keygen seems to be .net, witch would be much better than trying to make sense of x86 co- ACK!

 7219

>>7214
>for(;;)
is that even valid C# syntax? i doubt so

 7220

>>7219
yea thats how you do infinite loops with a plain for statement instead of do{...}while(...)

 7222

>>7220
so its the for version of while(true)?

 7224


 7225

>>7224
nice, didnt know that

 7271

File: 1688146072164-0.png (322.78 KB, 1775x3772, registration.png)ImgOps

File: 1688146072164-1.png (183.5 KB, 1360x768, ClipboardImage.png)ImgOps

File: 1688146072164-2.png (13.53 KB, 711x254, ClipboardImage.png)ImgOps

unpatched function, witch cence has been patched with EB in 4 places runs free and just works, as i cant find the function for the welcome window

 7478

File: 1688350632667.png (432.49 KB, 1360x768, ClipboardImage.png)ImgOps

I HATE WORKING WITH GRAPHICS CODE
I HATE WORKING WITH GRAPHICS CODE
I HATE WORKING WITH GRAPHICS CODE
I HATE WORKING WITH GRAPHICS CODE
I HATE WORKING WITH GRAPHICS CODE
I HATE WORKING WITH GRAPHICS CODE
I HATE WORKING WITH GRAPHICS CODE

 7480

still need to de-minify it, but it works as a great space heater lmao

>int x;float y,v,z,i,a=acos(-1.);float s(float x,float y){return clamp( iTime-x,0.,y)/y;}vec3 m,l;vec4 f,c,e,d;mat2 s(float x){return mat2(cos(x),sin(x),-sin(x),cos(x));}vec3 n,w;vec2 s(vec3 x,float z,int m){vec2 v,f=vec2(length(x)-2.,5);f.x=max(abs(f.x)-.2,abs(x.y)-1.);v=vec2(length(x)-2.,3);v.x=max(abs(v.x)-.1,abs(x.y)-1.2);v.x=min(v.x,length(x.xz)-z);v.x=min(v.x,length(x.xy)-z*(1.+e.y-abs(x.z*(.15-.05*i))));f=f.x<v.x?f:v;v=vec2(length(abs(x)-vec3(0,1,0))-1.2,6);v.x=max(abs(v.x)-.1,abs(x.y)-1.9);if(length(l)>.9)n[m]+=.1/(.1+v.x*v.x*(100.-sin(l.y*l.z*.02-y*2.*a/.9376)*99.*w.x));f=f.x<v.x?f:v;v=vec2(length(abs(x)-vec3(0,1,0))-1.2,5);v.x=max(abs(v.x)-.05,abs(x.y)-2.);f=f.x<v.x?f:v;v=vec2(length(x.xz)-2.5,6);v.x=max(abs(v.x)-.1,abs(x.y)-.5);f=f.x<v.x?f:v;f.x*=.7;return f;}vec2 p(vec3 m){l=m;if(x>5){if(x>7)m.xy*=s(sin(m.z*.1+y)*.3),m.z=mod(m.z+y*-10.,40.)-20.;else m.y+=sin(m.z*.1+y*e.z)*4.,m.z=mod(m.z+y*10.*e.z,48.)-24.,m=m.xzy,v=m.z;}vec4 a=vec4(m,1)*.3;a.xy*=s(c.x);for(int i=0;i<int(f.z);i++)a.xy*=s(.785*c.y),a.xyz=abs(a.xyz)-vec3(f.y,0,0),a=a*1.3/clamp(dot(a.xyz,a.xyz),.17,.95);vec2 i,d=s(mix(a.xzy,a.xyz,c.y-e.x),f.w,0);d.x/=a.w;if(x>3)d.x=max(d.x,-(length(m.xy)-.2));m.xy*=s(.785*c.y+c.x);i=s(abs(m*.3)-vec3(0,f.x,0),.1,1);i.x*=3.;d=d.x<i.x?d:i;m.xz*=s(sin(m.y*.3)*.3+y);i=vec2(length(sin(m-vec3(0,y*5.,0))),6);i.x=max(i.x,length(m.xz)-5.);n+=.1/(.1+i.x*i.x*50.);d=d.x<i.x?d:i;if(x>5){if(x>7)i=vec2(length(m.xz)-17.,6.),i.x=max(abs(i.x)-1.,abs(abs(m.y)-18.)-2.),d=d.x<i.x?d:i,i=vec2(length(m.xz)-17.,3.),i.x=max(abs(i.x)-1.2,abs(abs(m.y)-18.)-1.),d=d.x<i.x?d:i,m.yz*=s(1.57),i=s(abs(m)-vec3(0,0,7),0.,1),d=d.x<i.x?d:i;else i=vec2(.8*v,6),d=d.x<i.x?d:i;}return d;}const float r[]=float[18](-.5,2.,2.5,1.05,2.,1.5,0.,0.,4.,0.,9.,-3.,5.,15.,6.,20.,10.,7.);void mainImage( out vec4 fragColor, in vec2 fragCoord){y=mod( iTime,60.),x=int(floor( iTime/15.));w=vec3(0.);vec2 l,g=vec2(0),b=vec2(.1),o=(fragCoord.xy/iResolution.xy-.5)/vec2(iResolution.x/iResolution.y,1),h=vec2(.00035,-.00035);i=sin(y*2.*a/.4688),z=sin(y*2.*a/.4688+.9376);if(x>4)z= iTime<127.5?sin(y*2.*a/.9376)*1.5:0.;if( iTime<15.|| iTime>56.25&& iTime<60.|| iTime>75.)i=0.;d=vec4(r[x],4.,mix(25.,r[x+12],s(0.,15.)),.2);f=vec4(2.+s(0.,5.)*2.+i*.1,-.2+1.4*s(5.,10.)+z*.05*step(30., iTime),3.,.1*s(15.,1.));c=vec4(step(30., iTime)*(mod(y,15.)*.5+3.14*smoothstep(0.,1.,min(mod(y,15.),1.))),s(15.,15.),.5,80);e=vec4(0,0,1,.0001);v=-1.+2.*ceil(sin(y*a/7.5));m=v*vec3(cos(y*d.w+d.x)*d.z+r[x+6],d.y,sin(y*d.w+d.x)*d.z);if(x>3)f.xyz+=vec3(1.,.2,1.);if(x>5){m=vec3(cos(y*.5)*5.,10.+sin(y*.5)*5.,-11.);c.xzw=vec3(0.,0.,1.);e.xyz=vec3(1.,1.,1.-2.*step(105., iTime));if( iTime<105.|| iTime>120.)m.x*=v;w.x=1.;}if(x>7)f.xyz+=vec3(.5,.1,0.),e.yzw=vec3(1,-1,4e-05),m.z=10.,m.y=3.,m.x*=-v,w.xz=vec2(step( iTime,127.5),1.);vec3 u=normalize(vec3(0)-m),k=normalize(cross(u,normalize(vec3(c.z,1,0)))),F=normalize(cross(k,u)),C=mat3(k,F,u)*normalize(vec3(o,.5)),Z=normalize(m),Y,X,W,V,U;Y=X=vec3(.1)-length(o)*.1-C.y*.1;for(int T=0;T<128;T++){l=p(m+C*b.x);if(l.x<.0001||b.x>80.)break;b.x+=l.x;b.y=l.y;}if(b.x>80.)b.y=0.;k=.2*vec3(.95,.4,.05);F=.2*vec3(.05,.15,.6);u=n.x*F+n.y*k;g[int(step( iTime,120.))]=1.;if(b.y>0.)W=m+C*b.x,V=normalize(h.xyy*p(W+h.xyy).x+h.yyx*p(W+h.yyx).x+h.yxy*p(W+h.yxy).x+h.xxx*p(W+h.xxx).x),U=b.y==5.?vec3(.1,.2,.4):vec3(b.y<5.?0.:1.),Y=mix(pow(max(dot(reflect(-Z,V),-C),0.),40.)+mix(vec3(.8),vec3(1),abs(C))*U*(clamp(p(W+V*.1).x/.1,0.,1.)*clamp(p(W+V*.3).x/.3,0.,1.)+.2)*(max(0.,dot(V,Z))+smoothstep(0.,1.,p(W+Z).x)),X,min(pow(1.+dot(V,C),4.),.2)),Y=mix(X,Y+u*g.x,exp(-e.w*b.x*b.x*b.x));fragColor=vec4(mix(vec3(0),pow(Y+u*g.y+n.z*k*w.z,vec3(.65)),s(0.,3.)-s(137.,3.)),-.5+clamp(b.x*.1+.5,0.,.9));}

 7495

>>7478
>>7480
also more info,
>uniform vec3 t;
t.x is a "time" counter input (shadertoy 'iTime')
t.yz is the target resolution, (shadertoy iResolution.xy)

 7507

File: 1688368627847.gif (1.87 MB, 467x481, 1687023711573.gif)ImgOps

DOOOOOOOOOOOOOOOOOOLL ADD CODE TAGS ALLREADY DAMMIT

 7516

File: 1688397839789.png (271.55 KB, 728x589, ClipboardImage.png)ImgOps

>>7478
this nigga uses edge



[Return][Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ home ] [ q / soy / qa / r / nate ] [ a / health / incel / int / mtv / pol / psy / raid / sci ] [ overboard ] [ rules ] [ bans ] [ wiki ] [ booru ] [ archive ] [ merch ] [ donate ]