Random line of code thread

category: code [glöplog]
please wrap that in a do{ / }while(0) or it'll bork badly after an if without curly braces

but anyway,
Code:ld a, $80 ldh [rBCPS], a ldh a, [rLY] ldh [rBCPD], a ldh [rBCPD], a
added on the 2019-11-16 21:59:51 by porocyon porocyon
added on the 2019-11-16 23:59:16 by g r ü p g r ü p
Code:lda $0400+(((ScrollPos+4)*40)+1),y
added on the 2019-11-18 00:42:41 by StingRay StingRay
Thanks to earok's nice Amiga Blitz Basic2 extension for Visual Studio Code, this 23 years old code is now getting its final touches. Ohhh the touching!

BB Image
added on the 2019-11-18 04:00:49 by wertstahl wertstahl
lda #$05
sta $d800,x
added on the 2019-11-18 11:21:04 by El Topo El Topo
col = fDesaturate(col, 1.314); // overdoing it gives a nice gold colour
added on the 2019-11-19 16:32:26 by superplek superplek
Code:void draw_line_badly(float x0, float y0, float x1, float y1, float ht)
added on the 2019-11-22 21:41:21 by sol_hsa sol_hsa
sol_hsa: I feel called out


Code:REG_DMA0_ADDR = a0; REG_DMA1_ADDR = a2; // not a typo, the hardware is borked REG_DMA2_ADDR = a1; REG_DMA3_ADDR = a3;
added on the 2019-11-22 22:09:25 by porocyon porocyon
Code:jsr GenSpeedCode
added on the 2019-11-26 16:41:48 by StingRay StingRay
Code:call [r11+rcx*8+0x7fef]
added on the 2019-11-26 22:44:39 by Blueberry Blueberry
Code:\rotatebox{45}{%FFEN {\RU}#1/{\RU}{\RU} }
added on the 2019-11-26 23:29:38 by baah baah
Code: if(direction==FaceDirection::FRONT) { faces[fid].normal = glm::dvec3(0.0,0.0,1.0); unsigned int zOfs = fid/(dims.x*dims.y+2*(dims.x+1)*(dims.y+1)-(dims.x+1)-(dims.y+1)); unsigned int yOfs = (fid%(dims.x*dims.y+2*(dims.x+1)*(dims.y+1)-(dims.x+1)-(dims.y+1)))/(dims.x); unsigned int xOfs = (fid%(dims.x*dims.y+2*(dims.x+1)*(dims.y+1)-(dims.x+1)-(dims.y+1)))%(dims.x); faces[fid].e1 = zOfs*(((2*(dims.x+1)*(dims.y+1))-(dims.x+1)-(dims.y+1))+((dims.x+1)*(dims.y+1))) +(yOfs+1)*(2*dims.x+1)+xOfs+(dims.x+1)*(dims.y+1); faces[fid].e2 = zOfs*(((2*(dims.x+1)*(dims.y+1))-(dims.x+1)-(dims.y+1))+((dims.x+1)*(dims.y+1))) +yOfs*(2*dims.x+1)+(xOfs+1)+dims.x+(dims.x+1)*(dims.y+1); faces[fid].e3 = zOfs*(((2*(dims.x+1)*(dims.y+1))-(dims.x+1)-(dims.y+1))+((dims.x+1)*(dims.y+1))) +yOfs*(2*dims.x+1)+xOfs+(dims.x+1)*(dims.y+1); faces[fid].e4 = zOfs*(((2*(dims.x+1)*(dims.y+1))-(dims.x+1)-(dims.y+1))+((dims.x+1)*(dims.y+1))) +yOfs*(2*dims.x+1)+xOfs+dims.x+(dims.x+1)*(dims.y+1); addEdge(Edge3D((faces[fid].e1)+1,f.v1,f.v2,f.inside)); addEdge(Edge3D((faces[fid].e2)+1,f.v2,f.v3,f.inside)); addEdge(Edge3D((faces[fid].e3)+1,f.v3,f.v4,f.inside)); addEdge(Edge3D((faces[fid].e4)+1,f.v4,f.v1,f.inside)); }
added on the 2019-12-05 00:39:27 by vl4d vl4d
Code: template<typename T> void writeData(float **ptr, const T value) { const float* dataptr = (float *)&value; for (int i = 0; i < sizeof(T) / sizeof(float); i++) { **ptr = *dataptr++; (*ptr)++; } }

This makes me feel positively dirty.
added on the 2019-12-08 22:29:42 by Preacher Preacher
colors .byte vic.COLOR.([DARKGRAY, GRAY, LIGHTGRAY, WHITE][(0, 1, 2, 3, 2, 1, 0)])
added on the 2019-12-09 07:10:28 by soci soci
added on the 2019-12-11 14:42:10 by StingRay StingRay
Code:f32 remap(f32 x, f32 i0, f32 i1, f32 o0, f32 o1) return o0+(o1-o0)*saturate( (x-i0)/(i1-i0) );
added on the 2019-12-11 19:39:03 by hornet hornet
@Preacher, my C++ is rusty. How is that any different than memcpy'ing the value to a float array?
added on the 2019-12-12 09:11:19 by skrebbel skrebbel
little bit magic... sinus wave without FSIN

you can use it for bytebeat :)
f*ck IMUL AL of course
Code: lax xu_shifttab + 1 sbx #-$10 cpx #$60 bcc + lda #$0f sbx #-$02 + stx xu_shifttab + 1
added on the 2019-12-21 18:03:03 by baah baah
Code:move.l #((40-(32/8))<<16)|40-(32/8),$60(a6)
added on the 2019-12-22 19:03:12 by StingRay StingRay
added on the 2019-12-22 21:21:42 by ferris ferris
Code: @ are we a gba or an nds? mov r1, #0x42 mov r2, #0 str r1, [r2] ldr r3, [r2] cmp r3, r1 bne .Lprolly_gba
added on the 2019-12-22 22:13:57 by porocyon porocyon
Code:if (swiCRC16(0x4b32, NULL, 0) == 0x544e) do_magic();
added on the 2019-12-26 04:30:15 by porocyon porocyon