1. Assembler / Говнокод #25249

    −2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    execute = 0
    i = 100
    while i < $
        load a byte from i
        if a = 0xc3
            execute = i
            i = $
        else
            i = i + 1
        end if
    end while
    
    if execute = 0
    display "ret not found", 13, 10
    execute = $
    ret
    end if

    Прежде чем объявлять подпрограмму, тсарь пройдётся по уже собранному коду в поисках нужных ему байт.

    3oJloTou_neTyx, 01 Января 2019

    Комментарии (23)
  2. Assembler / Говнокод #25239

    +2

    1. 1
    2. 2
    3. 3
    https://www.researchgate.net/publication/325358150_cQASM_v10_Towards_a_Common_Quantum_Assembly_Language
    
    cQASM v1.0: Towards a Common Quantum Assembly Language

    The quantum assembly language (QASM) is a popular intermediate representation used in many quantum compilation and simulation tools to describe quantum circuits. Currently, multiple different dialects of QASM are used in different quantum computing tools. This makes the interaction between those tools tedious and time-consuming due to the need for translators between theses different syntaxes. Beside requiring a multitude of translators, the translation process exposes the constant risk of loosing information due to the potential incompatibilities between the different dialects. Moreover, several tools introduce details of specific target hardware or qubit technologies within the QASM syntax and prevent porting the code to other hardwares. In this paper, we propose a common QASM syntax definition, named cQASM, which aims to abstract away qubit technology details and guarantee the interoperability between all the quantum compilation and simulation tools supporting this standard. Our vision is to enable an extensive quantum computing toolbox shared by all the quantum computing community.

    Вот это я понимаю, а то вон там мелкософт какие-то говношарпы придумывает очередные:

    https://docs.microsoft.com/en-us/quantum/language/?view=qsharp-preview


    Нахер ваши шарпы с вашим сраным дуднетом и прочей такой хуйней, даешь Assembler.

    j123123, 28 Декабря 2018

    Комментарии (187)
  3. Assembler / Говнокод #25228

    +2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    /*
    x86-64 clang (trunk) -O3
    https://godbolt.org/z/t8NDGG
    
    #include <inttypes.h>
    
    uint32_t saturation_add(uint32_t a, uint32_t b)
    {
        const uint64_t tmp = (uint64_t)a + b;
        if (tmp > UINT32_MAX)
        {
            return UINT32_MAX;
        }
        return tmp;
    }
    */
    
    saturation_add:
            mov     edx, esi
            mov     eax, edi
            add     edi, esi
            add     rax, rdx
            mov     edx, 4294967295
            cmp     rax, rdx
            mov     eax, -1   // ЗАЧЕМ???
            cmovbe  eax, edi
            ret

    https://en.wikipedia.org/wiki/Saturation_arithmetic
    Почему компиляторы до сих пор такое говно

    j123123, 26 Декабря 2018

    Комментарии (94)
  4. Assembler / Говнокод #25114

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    DEF "PARSE", 0, PARSE
        MOV    SI, [VAR_TO_IN]
        MOV    CX, [VAR_NTIB]
        SUB    CX, SI
        ADD    SI, [VAR_TIB]
        SUB    BP, 2
        MOV    [BP], SI
        REPNE  SCASB
        SUB    CX, [VAR_NTIB]
        NOT    CX
        MOV    [VAR_TO_IN], CX
        MOV    AX, SI
        SUB    AX, [BP]
        DEC    AX
        RET

    СУКА! УЖЕ В КОТОРЫЙ РАЗ ЗАБЫВАЮ, ЧТО У SCAS ИСПОЛЬЗУЕТСЯ DI, А НЕ SI.

    UPPERCASE, 24 Ноября 2018

    Комментарии (21)
  5. Assembler / Говнокод #25106

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    MOV     CX,4                    ;All devices are 4 letters
    REPE    CMPSB                   ;Check for name in list
    JZ      IOCHK                   ;If first 3 letters OK, check for the rest
    ADD     SI,CX                   ;Point to next device name

    Вроде не обсуждали код MS-DOS
    https://github.com/Microsoft/MS-DOS

    vistefan, 21 Ноября 2018

    Комментарии (53)
  6. Assembler / Говнокод #25053

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    ㅌㄹ ㄱㅌ		; Помещаем в BX текущее значение регистра ES	<───────┐
    ㅈㅿ		; Загружаем младший байт регистра флагов в AH		│
    		;							│
    ㅊㅋ		; В пару ES:DI кладем то, что сейчас находится в AX	│
    		;							|
    ㄹㅅ		; Дважды увеличиваем значение регистра DI		|
    ㄹㅅ		; на одну единицу					|
    		;							│
    ㅎㅋ ㅿㅈ		; Образуем бесконечный цикл			>───────┘

    Господа, ОНО вернулось. Следующая итерация всеми нами любимого и восхваляемого [имя, которое нель̸̗̠̘̘̪̳̩зя произносить]. Я б̞̫͔̜ы на вашем ме̤̣̺͇̫с̨͈те покинул стр̵а̻̘̪̙͎̳̕н̬̙̤̙̪̝̺͠ицу. С̫е̜й̱͎ч̦̦̝͔а̙͓͓с̛̩̞̘ ̫̹͙̲̤̖͉ж̶͉̻е҉̼̦.

    h7381514, 05 Ноября 2018

    Комментарии (50)
  7. Assembler / Говнокод #24834

    0

    1. 1
    https://github.com/Microsoft/MS-DOS/tree/master/v2.0/source

    [MS-DOS 1.25 & 2.0 Source] Copyright (c) Microsoft Corporation All rights reserved. MIT License Permission is hereby granted, freeof charge, to any person obtaining a copy of this software and associateddocumentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,merge, publish, distribute, sublicense, and/or sell copies of the Software, andto permit persons to whom the Software is furnished to do so, subject to the following conditions:

    The above copyright notice andthis permission notice shall be included in all copies or substantial portionsof the Software.

    THE SOFTWARE IS PROVIDED AS IS,WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TOTHE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE ANDNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLEFOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE ORTHE USE OR OTHER DEALINGS IN THE SOFTWARE.

    j123123, 29 Сентября 2018

    Комментарии (19)
  8. Assembler / Говнокод #24779

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    .def temp = r16
    .def rr1 = r17
    .org 0
    Ldi r16, low(RAMEND)
    out SPL, temp
    Ldi r16 high(RANEND)
    out SPH, temp
    
    rjmp start
    start:
    ldi temp,255
    out DDRB, temp
    out PORTB,temp
    rcall delay
    Ldi temp,0x00
    out PORTB,temp
    Rcall delay
    rjmp start
    
    delay:
    ldi rr1, 0xFF
    Pdelay:
    Dec rr1
    brne Pdrlay
    ret

    Почему микроконтроллер не мигает лампочка?
    Но студия не ругается
    (Ассемблер АVR)

    Arduino, 17 Сентября 2018

    Комментарии (42)
  9. Assembler / Говнокод #24698

    −3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    format PE GUI at 0x10000
    
    include 'win32a.inc'
    
    invoke  MessageBoxA, 0, message, caption, MB_ICONQUESTION + MB_OK
    invoke ExitProcess, 0
    
    message db "Just test.", 0
    caption db "Test.", 0
    
    data import
        library kernel32, 'KERNEL32.DLL', user32, 'USER32.DLL'
    
        import kernel32, ExitProcess, 'ExitProcess'
    
        import user32, MessageBoxA, 'MessageBoxA'
    end data

    Не пойму, чочему уменьшив базу на 1 программа перестаёт роботать, но собирается нормально. 0x10000 -- это самое маленькое значение с которым она роботать. С 0x0 какая-то ашипка на счет длл лезит.

    И ксатати, лоли дебагер почему-то не могет зогружать такие програмым.

    yet_another_one_shit, 31 Августа 2018

    Комментарии (47)
  10. Assembler / Говнокод #24532

    −2

    1. 1
    2. 2
    А что если конпелятору переносить комментарии в ассемблерный код?
    Это относится к швабодке?

    OlegUP, 23 Июля 2018

    Комментарии (20)