pouët.net

Go to bottom

Random line of code thread

category: code [glöplog]
$d40b is that line count register?
added on the 2010-07-21 19:51:42 by linde linde
#define == =
added on the 2010-07-22 00:37:33 by neoneye neoneye
Quote:
$d40b is that line count register?

Yes, it counts up 1 every 2 real scan lines. But that's enough for polling. And for interrupts, there is a different mechanism.
added on the 2010-07-22 09:07:48 by JAC! JAC!
Code:move.w 10(a6),d0 and.w #$f0ff,d0 cmp.w #$e059,d0 ; rol/r.w #x,d1 beq.b DoRoxW

added on the 2010-07-30 02:35:38 by StingRay StingRay
stingray just won the thread :p
Code:/**** SearchNext routine, brute force version ******************************/ /* To speed up this routine, copy beforehand the string to search at the */ /* end of the text (you must allocate a bit more memory) and remove the */ /* TextPos+StringLength<=TextLength condition in main loop. The routine */ /* will always find a string, once this is done, compare Pos+Length and */ /* return -1 if it is the one we added! */ int SearchNext(char *String,int StringLength, char *Text,int TextLength,int TextPos) { int NbMatch=0; while((NbMatch<StringLength) && (TextPos+StringLength<=TextLength)) { if(Text[TextPos+NbMatch]==String[NbMatch]) { NbMatch++; } else { NbMatch=0; TextPos++; } } if(NbMatch==StringLength) { return(TextPos); } else { return(-1); } }
added on the 2010-08-02 14:23:45 by baah baah
Code: .loop move.w (a0),d0 and.w #$f0ff,d0 cmp.w #$40ef,d0 ; lea x(a7),ax bne.b .nolea move.l (a0)+,d0 swap d0 ror.w #8,d0 and.w #%1110,d0 lsr.w #1,d0 ; destination reg moveq #9,d2 lsl.w d2,d0 move.w .dest(pc),d1 ; patch dest reg in and.w #%1111000111111111,d1 ; move.l #$4711,ax instruction or.w d0,d1 move.w d1,.dest move.w .offs(pc),d1 ; patch dest reg in and.w #%1111000111111111,d1 ; sub.l #$4711,ax instruction or.w d0,d1 move.w d1,.offs swap d0 neg.w d0 and.l #$ffff,d0 move.l #$7f59,d1 sub.l d0,d1 add.l #buf,d1 move.l d1,.dest+2 ; patch value move.w #.size/2-1,d6 ;moveq #6/2-1,d6 lea .dest(pc),a2 .copy move.w (a2)+,(a1)+ dbf d6,.copy bra.b .next


semi-intelligent decrypters ftw \o/
added on the 2010-08-04 22:35:47 by StingRay StingRay
Just used this one to make a double recursion for M arrays, each one going though all possible nCk combinations...

Code:// Show combinations of K elements amongst N // Alain Brobecker - 2010/02/12 #include <stdio.h> /* file functions, etc... */ #include <stdlib.h> /* exit(), malloc() */ #define K 2 #define N 3 int Position[K]; char State[N]; int NbCombinations=0; void Process() { int c; for(c=0;c<N;c++) { State[c]='.'; } for(c=0;c<K;c++) { State[Position[c]]='*'; } for(c=0;c<N;c++) { printf("%c",State[c]); } printf("\n"); } //Recursive setup of all combinations //Call it with "Combinations(0,0,N-K);" void Combinations(int Variable,int start,int end) { int c; for(c=start;c<=end;c++) { Position[Variable]=c; if(Variable==K-1) { Process(); //Put here the routine to process one combination NbCombinations++; } else { Combinations(Variable+1,c+1,end+1); } } } int main(argc,argv) int argc; char *argv[]; { setbuf(stdout, NULL); /* no buffering for output! */ Combinations(0,0,N-K); printf("nCk(%d;%d)=%d\n",N,K,NbCombinations); exit(0); }
added on the 2010-08-14 00:01:45 by baah baah
org 0x100

mov ax, 13h
int 10h

:)
Code: assert( ( o-------------o |L \ | L \ | L \ | o-------------o | ! ! ! ! ! o | ! L | ! L | ! L| ! o-------------o ).volume == ( o-------------o | ! ! ! ! ! o-------------o ).area * int(I-------------I) );

what language is this? answer here
added on the 2010-09-11 19:17:10 by neoneye neoneye
clr.l -(a7)
added on the 2010-09-11 21:02:01 by spiny spiny
Code: // in jeder zelle den groessten suchen
added on the 2010-10-25 12:32:57 by raer raer
i know old esoteric languange is old but still: here comes CHEF

Code: Hello World Souffle. This recipe prints the immortal words "Hello world!", in a basically brute force way. It also makes a lot of food for one person. Ingredients. 72 g haricot beans 101 eggs 108 g lard 111 cups oil 32 zucchinis 119 ml water 114 g red salmon 100 g dijon mustard 33 potatoes Method. Put potatoes into the mixing bowl. Put dijon mustard into the mixing bowl. Put lard into the mixing bowl. Put red salmon into the mixing bowl. Put oil into the mixing bowl. Put water into the mixing bowl. Put zucchinis into the mixing bowl. Put oil into the mixing bowl. Put lard into the mixing bowl. Put lard into the mixing bowl. Put eggs into the mixing bowl. Put haricot beans into the mixing bowl. Liquefy contents of the mixing bowl. Pour contents of the mixing bowl into the baking dish. Serves 1.
added on the 2010-10-25 13:08:36 by wysiwtf wysiwtf
cd \
del *.*
added on the 2010-10-25 14:47:04 by closed closed
++n;
added on the 2010-11-05 15:18:15 by ltipl ltipl
ECHO|Y DELTREE *.*
added on the 2010-11-05 22:58:06 by FunGas FunGas
Code://include in your precompiled header: #define == = #define false true #define true rand() #define if while #define private public


Lovely \o/ happy debugging.
added on the 2010-11-18 12:07:48 by xTr1m xTr1m
Code: #define sizeof(x) (rand() % sizeof(x) + 1)

...forgot about that one :)
added on the 2010-11-18 12:08:27 by xTr1m xTr1m
And obviously this one:

Code:#define else if (rand())
added on the 2010-11-18 12:35:06 by PiN PiN
PiN that would cause trouble with this block:
Code:if (condition1) statement1(); else if (condition2) statement2(); else statement3();
added on the 2010-11-18 12:45:34 by xTr1m xTr1m
oh, I see, not really ;) evil indeed.
added on the 2010-11-18 12:45:57 by xTr1m xTr1m
ctrl+space
added on the 2010-11-18 13:05:42 by pista pista
Code: ;IN a0.l=@dest ; a1.l=@src ; a5=@probas ; d7.=random number ;KILLS d0-d6/a0-a2 RNDCELL MACRO add.l d1,d1 ;bits 19;18;17 are pixels n-1;n;n+1 move.l d1,d2 swap.w d2 and.l d6,d2 ;bits 3;2;1 are pixels n-1;n;n+1 move.w (a5,d2.w),d2 ;d2=proba according to those 3 pixels RANDOM d7,d3 and.w d5,d3 ;d3=rnd in [0;255]*64 add.l d0,d0 ;set dest pixel to 0 cmp.w d2,d3 ;flags=rnd-proba dc.w $6d02 ;blt.s +2 ;rnd<proba then pixel=0 addq.l #1,d0 ; else pixel=1 ENDM RndCell ; move.l (a2),d7 ;d7=Random number moveq.l #%1110,d6 ;d6=mask for isolating three pixels*2 move.w #255*64,d5 ;d5=mask for probability move.w 152(a1),d1 swap.w d1 move.w (a1),d1 addq.l #8,a1 add.l d1,d1 add.l d1,d1 ;PIXELS 0-287 REPT 18 RNDCELL ...etc...

And it will give this: http://abrobecker.free.fr/java/rndcell.htm
added on the 2010-12-25 21:19:41 by baah baah
BB Image
added on the 2011-01-01 09:54:24 by w00t! w00t!
retard.pf=pf[0];
added on the 2011-02-09 11:36:16 by raer raer

login

Go to top