pouët.net

Go to bottom

Random line of code thread

category: code [glöplog]
square root algorythm in MC680x0 code:

Code: MOVE.W #100,d2 ;P MOVEQ #1,d0 ;a MOVE.L d2,d1 ;b loop: ADD.W d1,d0 DIVS #2,d0 EXT.L d0 MOVE.L d2,d1 DIVS d0,d1 EXT.L d1 MOVE.W d0,d3 MOVE.W d1,d4 SUB.W d3,d4 CMP.W #0,d4 BPL noneg NOT.W d4 noneg: CMP.W #1,d4 BGT loop ADD.W d1,d0 DIVS #2,d0 RTS
added on the 2022-04-28 23:10:31 by Laffik Laffik
68000 popcnt

Code: mov.l d0, d1 REPT 32 lsr.l #1, d1 sub.l d1, d0 ENDR
Code:move.b #1,(_mt_Enable) ; finally figured out why the music wasn't playing
added on the 2022-05-01 14:47:43 by Skynet Skynet
Code://No need to make boundary tests because we added surroundings! void Fill(int x,int y,char TestValue,char FillValue) { Doubled[x][y]=FillValue; if(Doubled[x-1][y]!=TestValue) { Fill(x-1,y,TestValue,FillValue); } if(Doubled[x][y-1]!=TestValue) { Fill(x,y-1,TestValue,FillValue); } if(Doubled[x+1][y]!=TestValue) { Fill(x+1,y,TestValue,FillValue); } if(Doubled[x][y+1]!=TestValue) { Fill(x,y+1,TestValue,FillValue); } }
added on the 2022-05-12 14:56:54 by baah baah
Code: ld a,[DS_CH1AutopanSpeed] and a jr z,.ch2autopan ld hl,DS_CH1AutopanTimer dec [hl] jr nz,.ch2autopan ld a,[DS_CH1AutopanSpeed] ld [hl],a ld a,[DS_CH1AutopanPhase] inc a and 3 ld [DS_CH1AutopanPhase],a ld b,a and a ld a,[DS_CH1Autopan] jr z,:++ : rra rra dec b jr nz,:- : and %00000011 bit 1,a jr z,:+ xor %00010010 : ld [DS_CH1Pan],a
added on the 2022-05-16 00:23:39 by DevEd DevEd
Code: mov al, 13h int 10h %if LINE_REPEAT mov dx,03D4h out dx,ax %endif
Code:plus++;
added on the 2022-05-26 22:59:48 by yugecin yugecin
Code: fld1 fadd st0 fyl2x ; // log2_base
added on the 2022-05-28 16:51:16 by Blueberry Blueberry
Code: #define STR(x) #x #define XSTR(s) STR(s) uint16_t numChannelsMinus1 = numChannels - 1; __asm volatile ( " STEP=" XSTR(LZSS_DECODE_RINGBUFFER) "\n" // step "move.w #STEP*9, %%d1\n" ".Laud_loop:\n" // ac_ptr "moveq #0, %%d0\n" "move.b STEP*1(%[pos]), -(%%sp)\n" // get upper byte via stack - http://www.easy68k.com/paulrsm/doc/trick68k.htm "move.w (%%sp)+, %%d0\n" "move.b 0(%[pos]), %%d0\n" "add.w %%d0, %%d0\n" "add.l %[chipmem], %%d0\n" "move.l %%d0, (%[aud])+\n" // ac_len "move.b STEP*3(%[pos]), (%[aud])+\n" "move.b STEP*2(%[pos]), (%[aud])+\n" // ac_per "move.b STEP*5(%[pos]), (%[aud])+\n" "move.b STEP*4(%[pos]), (%[aud])+\n" // ac_vol - just ignore the upper byte //"clr.b (%[aud])+\n" "move.b STEP*6(%[pos]), 1(%[aud])\n" // repeat "move.b STEP*8(%[pos]), -(%%sp)\n" // get upper byte via stack "move.w (%%sp)+, %%d0\n" "move.b STEP*7(%[pos]), %%d0\n" "add.w %%d0, %%d0\n" "move.w %%d0, 4(%[aud])\n" "add.w %%d1, %[pos]\n" // next pos "addq.l #8, %[aud]\n" // next aud "dbra %[loop], .Laud_loop\n" : [aud]"+a" (aud), [pos]"+a" (pos), [loop]"+d" (numChannelsMinus1) : [chipmem]"r" (chipmem) : "cc", "d0", "d1");
added on the 2022-05-31 16:06:30 by bartman bartman
Quote:


THE low level language and no binary? We have to use defines with hex or bit shifting. When I change flags in hardware and want to put one by one the bits. Someone said make a function that accepts a string and returns back tha value.

But it has octal. Why no binary? Even basic had binary.


Of course we have binary: https://godbolt.org/z/7Y9qfEK7o
added on the 2022-05-31 16:08:51 by bartman bartman
Code:e=x<32 and poke4(130912+x,0>(-x>>1&7)+v*math.sin(v*math.sin(t/99))and 0 or(-x>>1&7)+v*math.sin(v*math.sin(t/99))

Sizecoding on TIC-80 with a compression stage.
Code:_pointsText.text = 0.ToString();
added on the 2022-06-11 12:40:27 by 71M 71M
(Z80, Amstrad CPC) Makes a part of firmware disappear
Code: ScreenSize equ &4000 org &8100 ld hl,&C000 ld de,&C000+1 ld bc,ScreenSize-1 ld (hl),0 ldir ret
#tmp

Code:Tmp0:=(Tmp0E and $CCCCCCCC) or ((Tmp1E and $CCCCCCCC) shr 2); { 0 2 4 6 8 10 12 14 } Tmp1:=((Tmp0E and $33333333) shl 2) or (Tmp1E and $33333333); { 1 3 5 7 9 11 13 15 } Tmp.d[0]:=(Tmp0 and $f0f0f0f0) shr 4; Tmp.d[1]:=(Tmp1 and $f0f0f0f0) shr 4; Tmp.d[2]:=(Tmp0 and $0f0f0f0f); Tmp.d[3]:=(Tmp1 and $0f0f0f0f); { 0, 4, 8, 12, } { 1, 5, 9, 13, } { 2, 6, 10, 14 } { 3, 7, 11, 15 }
added on the 2022-06-28 15:13:55 by Charlie Charlie
Code:// Carbon: package Geometry api; import Math; class Circle { var r: f32; } fn PrintTotalArea(circles: Slice(Circle)) { var area: f32 = 0; for (c: Circle in circles) { area += Math.Pi * c.r * c.r; } Print("Total area: {0}", area); } fn Main() -> i32 { // A dynamically sized array, like `std:vector`. var circles: Array(Circle) = ({.r = 1.0}, .r = 2.0}); // Implicitly converts `Array` to `Slice`. PrintTotalArea(circles); return 0; }
Quote:
Code: fld1 fadd st0 fyl2x ; // log2_base


Oh man ... :D
Thanks for the hint
added on the 2022-08-06 09:08:58 by gopher gopher
Send some screenshots of this thread over to Musk.
added on the 2022-11-20 11:10:29 by Virgill Virgill
Code: DATA(updated_common_fields) = get_updated_common_fields( current_common_fields = select_common_fields( keys = get_keys_for_entity( entity ) table = get_result_table_for_entity( entity ) ) new_common_fields = get_common_fields( changeset_item-entry_provider ) ). .
added on the 2022-11-29 14:15:14 by StingRay StingRay
Code:move.l #$008a0000,(a1)+
added on the 2023-01-15 13:55:13 by Blueberry Blueberry
Code: translate([-5,0,-0.1]) cylinder(h=3, d=12,$fn=3); // actually a triangle
Code: me->match_header->set_number_of_match_items( get_number_of_match_items( ) ).
added on the 2023-02-03 15:39:50 by StingRay StingRay
Code: BlitSrc32(pDest + (((kResY-384)>>1)+100)*kResX + (((kResX-512)>>1)+150), s_pOrange, kResX, 512, 384);
added on the 2023-02-07 05:23:10 by superplek superplek
Code:CONCATENATE <field_description>-name equal_string quotation_mark_string <commmon_field_from_fiori_app> INTO DATA(where_clause_string) SEPARATED BY space.
added on the 2023-02-21 15:55:58 by StingRay StingRay
Code:void I_have_got_to_return_some_videotapes(uint32_t *pDest, float time, float delta);
added on the 2023-02-22 11:23:14 by superplek superplek
Code: impl Drop for JsValue { fn drop(&mut self) { extern "C" { fn heap_drop(idx: u32); } unsafe { heap_drop(self.0); } } }
added on the 2023-03-06 16:39:17 by sagacity sagacity

login

Go to top