Random line of code thread
category: code [glöplog]
Code:
10 PRINT "YAY 1000!"
20 CALL 0Code:
move.l	TaskTrapCode(a0),fuck
Code:
mediafile.maintainAspectRatio = StringManipulation.toBoolean(mediafileNode.@maintainAspectRatio, true);Code:
; Kickstart 1.2 zeropage (used in key calculation routine) loop main
  
squaretunnelrectangle.setPosition((squaretunnelrectsizeo[0]-squaretunnelrectsize[0])/2-(squaretunnelrectsizeo[0]-800)/2,(squaretunnelrectsizeo[1]-squaretunnelrectsize[1])/2-(squaretunnelrectsizeo[0]-600)/2+100);
  
Damn, forgot to use the CODE tags.
Well then, here's another one:
  
Well then, here's another one:
Code:
sineFull.setPosition(sineFullProcess,150+100*sin(sineFullProcess*3.14169265358979323/180*0.8));mov byte[ds:si+293+320*160],bh
  
Code:
#define SAB_MAGIC 0xb16b00b5 // Always look for themCode:
MakeKeyTab
	lea	KeyBuf(pc),a0
	move.l	a0,a1
	move.l	a1,Key-KeyBuf(a0)
	add.w	#$6c,a1
	move.l	a1,Key6c-KeyBuf(a0)
	lea	$dc(a0),a1
	move.l	a1,KeyDc-Keybuf(a0)
	move.l	#$57319753,(a0)
	moveq	#1,d6
	moveq	#55-2,d7
.loop	move.l	(a0)+,d0		; previous key
	move.l	d0,d1
	asl.l	#5,d1
	sub.l	d0,d1
	add.l	d6,d1
	addq.l	#1,d6
	move.l	d1,(a0)
	dbf	d7,.loop
	rts
; original c version of the code above
;	link	a6,#-4
;	move.l	(8,a6),a0
;	move.l	#$57319753,(a0)
;	moveq	#1,d0
;	move.l	d0,(-4,a6)
;.loop	move.l	(-4,a6),d0
;	cmp.l	#55,d0
;	bge.b	.done
;	asl.l	#2,d0
;	move.l	(8,a6),a0
;	add.l	d0,a0
;	subq.l	#4,d0
;	move.l	(8,a6),a1
;	add.l	d0,a1
;	move.l	(a1),d0			; previous key
;	asl.l	#5,d0
;	sub.l	(a1),d0
;	add.l	(-4,a6),d0
;	move.l	d0,(a0)
;	addq.l	#1,(-4,a6)
;	bra.b	.loop
;
;.done	move.l	(8,a6),a0
;	move.l	a0,(Key)
;	add.w	#$6C,a0
;	move.l	a0,(Key6c)
;	move.l	(8,a6),a0
;	add.w	#$DC,a0
;	move.l	a0,(KeyDC)
;	unlk	a6
;	rts 
invoke BlitToScreen, hWin, hMDC, offset img_01_p, offset img_01_d, 10, 24
; bah
  
; bah
jmp eax
  
POP CS
  
Code:
mul bl
Code:
str r1, [r2, r0]Code:
void init(int index, bool satanic, bool white);[code]
* fallback, may work in 99%
[/quote]
  
* fallback, may work in 99%
[/quote]
Code:
 
* fallback, may work in 99%
Date.now()/1000|0
time() in javascript :D
  
time() in javascript :D
Code:
	move.l	#$DEADFACE,d5
Code:
  for(c=0;c<NbVariables;c++) {
    //Search the equation with a pivot for variable c
    d=c;
    Pivot=-1;
    do{
      if(Equation[d][c][0]!=0) {
        Pivot=d;
      }
      d++;
    } while((Pivot==-1) && (d<NbEquations));
    if(Pivot==-1) {
      printf("**** Error: no pivot can be found at this point ****\n");
      PrintSystem();
      exit(-1);
    }
    //Exchange equations
    SwapTwoEquations(c,Pivot);
    //For every equation below the pivot, eliminate the coef for this variable
    d=c+1;
    while(d<NbEquations) {
      LinearCombination(c,d,Equation[d][c][0]*Equation[c][c][1],Equation[d][c][1]*Equation[c][c][0]);
      d++;
    }
    printf("\n");
    PrintSystem();
  }Hi All,
Long time Aussie lurker, yet to make a demo about it. Anyway, I work as a support programmer at a university, fixing all their junk. Every so often I come across some amazing pieces of code that I just don't think are getting the recognition they deserve and wanted to share, but have never bothered with. This one I couldn't resist.
  
Long time Aussie lurker, yet to make a demo about it. Anyway, I work as a support programmer at a university, fixing all their junk. Every so often I come across some amazing pieces of code that I just don't think are getting the recognition they deserve and wanted to share, but have never bothered with. This one I couldn't resist.
Code:
$main::config{'minuteValStr'} = ['','00','05','10','15','20','25','30','35','40','45','50','55'];
sub closestNum {
    my $x=0;
    my $answer;
    my @minuteArray = @{$main::config{'minuteValStr'}};
    while ($x < 14) {
        if ($main::config{'minute'} >= 0 && $main::config{'minute'} < 5) {
            $answer = $minuteArray[1];
        }
        elsif ($main::config{'minute'} >= 5 && $main::config{'minute'} < 10) {
            $answer = $minuteArray[2];
        }
        elsif ($main::config{'minute'} eq $minuteArray[$x]) {
            $answer = $minuteArray[$x];
        }
        elsif ($main::config{'minute'} eq ($minuteArray[$x]+1)) {
            $answer = $minuteArray[$x];
        }
        elsif ($main::config{'minute'} eq ($minuteArray[$x]+2)) {
            $answer = $minuteArray[$x];
        }
        elsif ($main::config{'minute'} eq ($minuteArray[$x]+3)) {
            $answer = $minuteArray[$x];
        }
        elsif ($main::config{'minute'} eq ($minuteArray[$x]+4)) {
            $answer = $minuteArray[$x];
        }
        elsif ($main::config{'minute'} > 55) {
            $answer = $minuteArray[$x-1];
        }
        $x++;
    }
    return $answer;
}
4 colors... ;D
  
Code:
int SizeAndNeighbourgs[NbSquares][1+MaxNeighbourgs+1]={
 {50, 1,10, 9, 8,-1,-1,-1,-1} //a,50,b,k,j,i
...
void RecursiveColoring(int SquareIndex) {
  int CurrentColor,c,Neighbourg,SameColor,d;
  for(CurrentColor=0;CurrentColor<4;CurrentColor++) {
    Colors[SquareIndex]=CurrentColor;
    //check if a neighbourg has the same color
    c=1;
    SameColor=FALSE;
    Neighbourg=SizeAndNeighbourgs[SquareIndex][c];
    while((Neighbourg!=-1) && (SameColor==FALSE)) {
      if(Colors[Neighbourg]==CurrentColor) { SameColor=TRUE; }
      c++;
      Neighbourg=SizeAndNeighbourgs[SquareIndex][c];
    }
    //if no neighbourg has same color, go on
    if(SameColor==FALSE) {
      //if it's not the last Square, recursively color next square
      if(SquareIndex!=NbSquares-1) {
        RecursiveColoring(SquareIndex+1);
      } else { 
      //otherwise compute sizes and print if lowest MaxSurface-MinSurface
        for(c=0;c<4;c++) { Surface[c]=0; }
        for(c=0;c<NbSquares;c++) {
          Surface[Colors[c]]+=SizeAndNeighbourgs[c][0]*SizeAndNeighbourgs[c][0];
        }
        if(    (Surface[0]<=Surface[1])
            && (Surface[1]<=Surface[2])
            && (Surface[2]<=Surface[3])
            && ((Surface[3]-Surface[0])<=LowestDifference)) {
          LowestDifference=Surface[3]-Surface[0];
          printf("Min=%d cm^2, Max=%d cm^2\n",Surface[0],Surface[3]);
          for(c=0;c<4;c++) {
            printf("Color %d:",c);
            for(d=0;d<NbSquares;d++) {
              if(Colors[d]==c) { printf(" %c,",'a'+d); }
            }
            printf(" %d cm^2\n",Surface[c]);
          }
        }
      }
    }
  }
  Colors[SquareIndex]=-1;
}Code:
AddMenu TAR, TAR-GZIP Pack, StdIO "CON:0/16/640/464/Packing TAR-GZIP file...";Archive "tar -cf T:tarfile.tar" "-v";Extern GZIP -V;Extern GZIP -v9 T:tarfile.tar;Move T:tarfile.tar.gz %d;Wait;StdIO CLOSEEnables DiskMaster 2.6 to put files in a combined TAR-GZIP archive from stdin to stdout in one step.
Code:
AddMenu TAR, TAR-GZIP Extract, Window Dest;StdIO "CON:0/16/640/464/Extracting TAR-GZIP archive...";Extern GZIP -V;MakeDir T:temptar;Extern GZIP -dvc %s >T:temptar/tarfile.tar;Extern tar -xvf T:temptar/tarfile.tar;Extern Delete T:temptar ALL QUIET;Wait;Window Dest;StdIO CLOSEThis one lets DiskMaster 2.6 unpack a TAR-GZIP archive from stdin to stdout.
The DM2 configuration supports a very simple (and quite buggy) script syntax to manage such operations. Tricky: all has to be done in a single line without branching'n'stuff!
move.l #cop,$dff080
  















