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];
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
still an expensive NOP.
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)
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)
},
return 0;
eor.l d1,d0 ; Can't believe nobody though of this before... wow the crowd!
Code:
movem.l d1,-(a7) ; do NOT change to move.l, you have been warned!
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.
tldr: Won a nobel prize coding assembler for computing Feynman diagram at CERN in the 1960s.
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. ;)
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;}}}
Quote:
Oh, the craziness you force upon yourself to do 32 byte intros. ;)
I for one enjoy reading about it!
POKE 59468,14
Code:
mov.b r0h, @SSU_SSTDR:16 ; send r0l
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;
Quote:
(spoiler: it does not send r0l)Code:mov.b r0h, @SSU_SSTDR:16 ; send r0l
Code:
ldh [OAMDMA+((AYCEScreen_VBlank.bufloc-AYCEScreen_VBlank)+1)],a
Code:
di
halt
Code:
cmd_data:
.byte 0,0x10,0x18,0xaf,0xb0,0x00,0xa4
magic LCD init sequences are fun
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)
Complete code for the Phosphorizer decruncher progress bar:
Code:
lda #160
sta $0c00+40*12->uncompressed_start_addr,x
Code:
source: everything I've ever written that ships// TODO: All this stuff is ass, make it not/less ass
Code:
out rVDPData,a
Code:
response_data.data = data.current_handler.data;
Code:
basic += b'\xf9' # randomize + ld sp, hl
basic += b'\xc0' # usr + ret nz (taken)