pouët.net

Random line of code thread

category: code [glöplog]
Code:All3DPieces[PieceIndex][2+RotationIndex*4*(3+3+Max3DSizeForPiece)+6+(y-BBymin)*SkewedWidth+(BBxmax-x)]=Skewed2DPiece[y*MaxSkewedPieceWidth+x];
added on the 2021-02-15 16:36:39 by baah baah
Code:.loop move.w (a1),d2 asr.w d3,d1 move.w d2,(a1)+

A very expensive NOP. Spotted in Symphonie Pro assembly.
...make that
Code:.loop move.w (a1),d2 asr.w d3,d1 move.w d2,(a1)+ subq.l #1,d0 bne.s .loop

still an expensive NOP.
Code: // // Plugin (per-voice) instance (base) structure // // - must be the first field in actual/derived plugin structs // - there are usually as many instances as there are sample players, multiplied by their polyphony // - the sampleplayer / samplebank / sample pointers can be used to find neighbouring voices, e.g. // for cross modulation purposes // - plugin implementations can store their voice state here // typedef struct st_plugin_voice_s { .. }

plugin.h (MIT license)
(85 plugins available so far)
added on the 2021-02-27 12:52:35 by bsp bsp
Looks like JS, it is JS! Phaser.io. Awesome stuff

Code: function EnemyLvl1Worm (scene) { Phaser.GameObjects.Sprite.call(this, scene, 0, 0, 'gfx_enemylvl1worm_sprite') this.incX = 0 this.incY = Math.random()/2+0.01 this.speed = Phaser.Math.GetSpeed(800, 1) this.setActive(true) this.setVisible(true) },
added on the 2021-02-28 01:51:50 by nodepond nodepond
return 0;
added on the 2021-03-01 22:10:59 by thec thec
eor.l d1,d0 ; Can't believe nobody though of this before... wow the crowd!
added on the 2021-03-12 01:53:17 by DanLemon DanLemon
Code: movem.l d1,-(a7) ; do NOT change to move.l, you have been warned!
added on the 2021-03-15 08:31:48 by StingRay StingRay
Tini Veltman (1931–2021): From Assembly Language to a Nobel Prize
tldr: Won a nobel prize coding assembler for computing Feynman diagram at CERN in the 1960s.
added on the 2021-03-15 21:23:28 by neoneye neoneye
Quote:
Code: movem.l d1,-(a7) ; do NOT change to move.l, you have been warned!

Reminds me of the first instruction of Filliflif, which is
Code:movem.w (a3)+,d4-d7/a0/a4-a6

A3 points 4 bytes before the start, which means that part of the data read by the instruction is the instruction itself. Specifically, the register mask, which is $71F0 in this case, ends up in D7. This is then used for several things:
- To write to $DFF096 to disable most DMAs (but not audio).
- To add each iteration to the state register whose low word is used for background color (thus, blue is unaffected) and volume, and the upper word is used for period, giving an appropriate pitch downslide.

Oh, the craziness you force upon yourself to do 32 byte intros. ;)
added on the 2021-03-17 18:01:36 by Blueberry Blueberry
when arrays not supported
Code: // emulating arrays // if(i) b c d to a equal to a=bcd[i] #define ifibcda(i,b,c,d,a) {if(i==0){a=b;}else{if(i==1){a=c;}else if(i==2){a=d;}}} // if(i) a to b c d equal to bcd[i]=a #define ifiabcd(i,a,b,c,d) {if(i==0){b=a;}else{if(i==1){c=a;}else if(i==2){d=a;}}}
added on the 2021-03-18 00:27:05 by Danilw Danilw
Quote:
Oh, the craziness you force upon yourself to do 32 byte intros. ;)


I for one enjoy reading about it!
added on the 2021-03-18 01:01:38 by grip grip
POKE 59468,14
added on the 2021-03-22 02:13:53 by bodo^rab bodo^rab
Code:mov.b r0h, @SSU_SSTDR:16 ; send r0l
added on the 2021-03-27 20:16:39 by porocyon porocyon
Code:return 10*l*(1-i)*mix(vec3(1),sqrt(l*i),clamp(pow(1-dot(z,vec3(0,0,1)),5),0,1))+n*190000*i*smoothstep(.9969,.9971,f)*y;
added on the 2021-03-27 20:34:18 by noby noby
Quote:
Code:mov.b r0h, @SSU_SSTDR:16 ; send r0l
(spoiler: it does not send r0l)
added on the 2021-03-27 20:36:32 by porocyon porocyon
Code:ldh [OAMDMA+((AYCEScreen_VBlank.bufloc-AYCEScreen_VBlank)+1)],a
added on the 2021-03-30 17:01:38 by DevEd DevEd
Code:di halt
added on the 2021-04-03 01:11:35 by neon neon
Code:cmd_data: .byte 0,0x10,0x18,0xaf,0xb0,0x00,0xa4


magic LCD init sequences are fun
added on the 2021-04-03 01:34:17 by porocyon porocyon
Code:size_t base = 0x06017800; // stolen from mgba's sprite view after setting // up the sprite, instead of calculating it properly


(from Uitslaganticipatieangst 2 source)
added on the 2021-04-10 03:26:58 by porocyon porocyon
Complete code for the Phosphorizer decruncher progress bar:
Code: lda #160 sta $0c00+40*12->uncompressed_start_addr,x
added on the 2021-04-10 12:30:06 by Blueberry Blueberry
Code:// TODO: All this stuff is ass, make it not/less ass
source: everything I've ever written that ships
added on the 2021-04-11 18:13:04 by ferris ferris
Code:out rVDPData,a
added on the 2021-04-11 19:46:25 by DevEd DevEd
Code:response_data.data = data.current_handler.data;
added on the 2021-04-11 22:13:25 by yugecin yugecin
Code: basic += b'\xf9' # randomize + ld sp, hl basic += b'\xc0' # usr + ret nz (taken)
added on the 2021-04-11 23:15:36 by neon neon

login