Random line of code thread
category: code [glöplog]
$d40b is that line count register?
#define == =
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.
Code:
move.w 10(a6),d0
and.w #$f0ff,d0
cmp.w #$e059,d0 ; rol/r.w #x,d1
beq.b DoRoxW
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);
}
}
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/
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);
}
org 0x100
mov ax, 13h
int 10h
:)
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
clr.l -(a7)
Code:
// in jeder zelle den groessten suchen
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.
cd \
del *.*
del *.*
++n;
ECHO|Y DELTREE *.*
Code:
//include in your precompiled header:
#define == =
#define false true
#define true rand()
#define if while
#define private public
Lovely \o/ happy debugging.
Code:
#define sizeof(x) (rand() % sizeof(x) + 1)
...forgot about that one :)
And obviously this one:
Code:
#define else if (rand())
PiN that would cause trouble with this block:
Code:
if (condition1) statement1();
else if (condition2) statement2();
else statement3();
oh, I see, not really ;) evil indeed.
ctrl+space
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
retard.pf=pf[0];