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 |
|---|---|---|---|---|
core/src/main/c/share/asmlib/debugbreak64.asm | jerrinot/questdb | 8,451 | 94106 | ;************************* debugbreak64.asm **********************************
; Author: <NAME>
; Date created: 2011-07-09
; Last modified: 2011-07-09
; Source URL: www.agner.org/optimize
; Project: asmlib.zip
; Language: assembly, NASM/YASM syntax, 32 bit
;
; C++ prototype:
; extern "C" void A_DebugBreak(void);
;
; Description:
; Makes a debug breakpoint. Works only when running under a debugger
;
;
; Copyright (c) 2011 GNU General Public License www.gnu.org/licenses
;******************************************************************************
;
; C++ prototype:
; extern "C" void A_DebugBreak(void);
global A_DebugBreak
SECTION .text
A_DebugBreak:
int3
nop
ret
;A_DebugBreak ENDP
|
oeis/106/A106256.asm | neoneye/loda-programs | 11 | 245273 | ; A106256: Numbers n such that 12*n^2 + 13 is a square.
; Submitted by <NAME>
; 1,3,17,43,237,599,3301,8343,45977,116203,640377,1618499,8919301,22542783,124229837,313980463,1730298417,4373183699,24099948001,60910591323,335668973597,848375094823,4675265682357,11816340736199
lpb $0
sub $3,$0
sub $0,1
add $2,1
trn $3,$0
mov $1,$3
mul $1,12
add $2,1
add $2,$1
add $3,$2
lpe
mov $0,$2
add $0,1
|
audio/sfx/faint_fall.asm | AmateurPanda92/pokemon-rby-dx | 9 | 13413 | SFX_Faint_Fall_Ch4:
duty 1
pitchenvelope 10, -7
squarenote 15, 15, 2, 1920
pitchenvelope 0, 0
endchannel
|
programs/oeis/053/A053307.asm | neoneye/loda | 22 | 100344 | ; A053307: Number of nonnegative integer 2 X 2 matrices with sum of elements equal to n, under row and column permutations.
; 1,1,4,5,11,14,24,30,45,55,76,91,119,140,176,204,249,285,340,385,451,506,584,650,741,819,924,1015,1135,1240,1376,1496,1649,1785,1956,2109,2299,2470,2680,2870,3101,3311,3564,3795,4071,4324,4624,4900,5225,5525,5876,6201,6579,6930,7336,7714,8149,8555,9020,9455,9951,10416,10944,11440,12001,12529,13124,13685,14315,14910,15576,16206,16909,17575,18316,19019,19799,20540,21360,22140,23001,23821,24724,25585,26531,27434,28424,29370,30405,31395,32476,33511,34639,35720,36896,38024,39249,40425,41700,42925
add $0,1
mov $2,1
lpb $0
sub $0,1
add $1,$2
add $2,2
add $2,$0
trn $0,1
add $3,2
sub $2,$3
lpe
mov $0,$1
|
src/vn/ductt/verk/tmp/MytestParser.g4 | bynoud/verk | 0 | 5606 |
parser grammar MytestParser;
options { tokenVocab=MytestLexer; }
top: Directive_define | Verilog_directive;
|
main.asm | CrociDB/retro2048 | 6 | 987 | <filename>main.asm
%ifdef dos ; DOS version
org 0x0100
%elifdef bootsector ; Bootsector version
org 0x7c00
%else ; Bootsector version, but for DOS
org 0x0100
%endif
start:
%ifdef bootsector
push cs
push cs
pop ds
pop ss
%endif
; Set 80-25 text mode
mov ax, 0x0002
int 0x10
mov ax, 0xb800 ; Segment for the video data
mov es, ax
cld
%ifdef dos
; Game title
mov ah, 0x67
mov bp, title_string
mov cx, 62
call print_string
; Score
mov ah, 0x08
mov bp, score_string
mov cx, 160*4+44
call print_string
; Drawing the box
push 0x3800
push 0x1125 ; Rect size 37x16 (25x11)
push 44 ; Offset 22 chars on left
push 160 * 5 ; Offset 5 lines on top
call draw_box
%endif
%ifdef dos
mov word [current_offset], 1
mov word [current_cell_pointer], board
call add_new_cell
%endif
main_loop:
mov word [current_offset], 1
mov word [current_cell_pointer], board
call add_new_cell
call print_board
check_input:
mov ah, 0 ; Get keystroke
int 0x16 ; BIOS service to get keyboard
cmp ah, 0x48 ; Up key
je _up
cmp ah, 0x4b ; Left key
je _left
cmp ah, 0x4d ; Right key
je _right
cmp ah, 0x50 ; Down key
je _down
cmp ah, 0x1 ; Esc key
jne check_input
jmp exit
_up:
mov bp, movement_up
jmp _movement
_left:
mov bp, movement_left
jmp _movement
_right:
mov bp, movement_right
jmp _movement
_down:
mov bp, movement_down
_movement:
mov al, byte [bp]
cbw
mov word [current_offset], ax
mov ax, board
add al, byte [bp+1]
xor dx, dx
mov dl, byte [bp+2]
call compute_movement
call print_board
%ifdef dos
call wait_time
%endif
jmp main_loop
%ifdef dos
;
; Wait time function
;
wait_time:
xor dx, dx
mov cx, 5
mov ah, 0x86
int 0x0015
mov ah, 0x0c
int 0x0021
ret
%endif
;
; Add new cell function
; it will first count how many empty cells there are, then get a random cell and adds a random value
;
add_new_cell:
%ifdef dos
mov cx, 17 ; Sets the board size
mov bp, board ; Gets the pointer to the board
xor bx, bx ; Initializes the zero counter
_count_empty:
mov dl, byte [bp] ; Gets the value of the current cell
cmp dl, 0 ; Checks if the current cell is empty
jne _count_continue ; ... if not empty, iterate
inc bl ; ... if empty, increase zero counter
_count_continue:
inc bp ; Increases the pointer to the next cell
loop _count_empty ; Iterates counter
cmp bl, 0 ; Checks if there are empty cells
je _add_new_cell_exit ; ... if no empty cells, just exit
mov ah, 0x00 ; BIOS service to get system time
int 0x1a
mov ax, dx ; Copies the time fetched by interruption
xor dx, dx ; Resets DX because DIV will use DXAX
div bx ; AX = (DXAX) / bx ; DX = remainder
mov bh, dl ; Gets the remainder of the division in BH
mov cx, 16 ; Set she board size iterator - we don't need to iterate all the board
mov bp, board ; Gets the pointer to the board
xor bl, bl ; Initializes the zero counter
_check_item:
mov dl, byte [bp] ; Gets the value of the current cell
cmp dl, 0 ; Checks if it's an empty cell
jne _check_item_loop ; ... if not, iterates
cmp bl, bh ; Compares if the current counter is the randomized value selected
je _add_and_exit ; ... if so, adds new cell and exit
inc bl ; Increases the current zero counter
_check_item_loop:
inc bp ; Increases the pointer to the board
loop _check_item ; Iterates item adding
_add_and_exit:
and al, 1 ; Gets one bit of the divided value (our so called random)
inc al ; Adds 1 to it, it it's either 1 or 2 (cell value 2 or 4)
mov byte [bp], al ; Set the above value to the board
_add_new_cell_exit:
ret
%else
mov cx, 17 ; Sets the board size
mov bp, board ; Gets the pointer to the board
_count_empty:
mov ah, byte [bp] ; Gets the value of the current cell
cmp ah, 0 ; Checks if the current cell is empty
je _add_and_exit
inc bp ; Increases the pointer to the next cell
loop _count_empty ; Iterates counter
_add_and_exit:
mov byte [bp], 1 ; Set the above value to the board
ret
%endif
;
; Compute movement function
; Params: [current_offset] - the offset between elements
; DX - line offset
; AX - initial cell pointer
;
compute_movement:
mov cx, 4
_compute_line:
mov word [current_cell_pointer], ax
pusha
call compute_board_line
popa
add ax, dx
loop _compute_line
ret
;
; Compute board line function - this will compute a line/column of the board
; Params - [current_cell_pointer] - start cell ID
; [current_offset] - offset between items of the line (direction)
;
compute_board_line:
mov cx, 3 ; The amount of iterations we'll do
_item:
mov bp, [current_cell_pointer]
mov ah, byte [bp]
cmp ah, 0
jne _add
; ---- MOVE
_move:
mov bx, cx
mov bp, [current_cell_pointer]
_move_find:
add bp, [current_offset]
mov dl, byte [bp]
cmp dl, 0
je _skip_move
mov byte [bp], 0
mov bp, [current_cell_pointer]
mov byte [bp], dl
jmp _item
_skip_move:
dec bx
cmp bx, 0
jne _move_find
; ---- ADD
_add:
mov bx, cx
mov bp, [current_cell_pointer]
_add_find:
add bp, [current_offset]
mov dl, byte [bp]
cmp dl, 0
je _skip_add
cmp dl, ah
jne _return
mov byte [bp], 0
mov bp, [current_cell_pointer]
inc byte [bp]
%ifdef dos
add byte [score], dl
%endif
jmp _return
_skip_add:
dec bx
cmp bx, 0
jne _add_find
_return:
mov bx, [current_offset]
add [current_cell_pointer], bx
loop _item
ret
;
; Print board function
;
print_board:
mov cx, 17 ; The amount of cells
_loop_cell:
pusha ; Saves the counter, because print_cell uses it
mov al, cl ; Saves the id to AL, input to print_cell
dec al ; Decreases 1 from the counter
call print_cell
popa
loop _loop_cell
%ifdef dos
push 0x8f00
push 160*4+58
mov ax, word [score]
call print_number
add sp, 4
%endif
ret
;
; Print cell function
; Params: AL - board index
;
print_cell:
xor ah, ah ; Resets AH
mov bp, board
mov [current_cell_pointer], bp
add [current_cell_pointer], al
xor ch, ch
mov bx, [current_cell_pointer] ; Pointer to the board
mov cl, byte [bx] ; Gets actual value on the board
xor bl, bl
%ifdef dos
mov bp, board_colors ; Gets the pointer to the first color
add bp, cx ; Adds the value id to color pointer
mov bh, [bp] ; Gets the value of the color
%else
mov bh, 0x1f
shl cl, 4
add bh, cl
%endif
; First print the box
push bx ; Box color
push 0x0306 ; Box size
mov bx, board_offset_row ; Gets the row offset
xor ch, ch ; Resets CX
mov cl, al
shr cl, 2 ; Divides by four since the offset is the same for every 4 items
shl cl, 1 ; Multiplies the current cell id by two because the row offset is a word
add bx, cx ; Adds the id to the pointer
mov cx, word [bx] ; Gets the offset value
mov [current_offset], cx ; Saves the offset value, to be used on the number
push cx ; Pushes to draw_box function
mov bl, 4
div bl ; Divides current index by 4
shr ax, 8 ; And get the remainder, because the column offset cycles 0-3
mov bx, board_offset_column ; Gets the column offset
add bx, ax ; Gets the cell id
xor ch, ch ; Resets CX
mov cl, byte [bx] ; Copies the value of the offset (byte)
add [current_offset], cx ; Adds it to current_offset, to be used on the number
push cx ; Pushes to draw_box function
call draw_box
add sp, 6 ; Remove parameters from stack, but not the color
mov bx, [current_offset] ; Gets the current total screen offset
add bx, 162 ; Adds one line and one char
push bx ; Pushes current position offset to print_number function
mov bx, [current_cell_pointer] ; Pointer to the board
mov cl, byte [bx] ; Gets actual value on the board
cmp cl, 0
je _pc_exit
mov ax, 1
shl ax, cl
call print_number
_pc_exit:
add sp, 4 ; Removes parameters from stack
ret
;
; Draw box function
; Params: [bp+2] - row offset
; [bp+4] - column offset
; [bp+6] - box dimensions
; [bp+8] - char/Color
;
draw_box:
mov bp, sp ; Store the base of the stack, to get arguments
xor di, di ; Sets DI to screen origin
add di, [bp+2] ; Adds the row offset to DI
mov dx, [bp+6] ; Copy dimensions of the box
mov ax, [bp+8] ; Copy the char/color to print
mov bl, dh ; Get the height of the box
xor ch, ch ; Resets CX
mov cl, dl ; Copy the width of the box
add di, [bp+4] ; Adds the line offset to DI
rep stosw
add word [bp+2], 160 ; Add a line (180 bytes) to offset
sub byte [bp+7], 0x01 ; Remove one line of height - it's 0x0100 because height is stored in the msb
mov cx, [bp+6] ; Copy the size of the box to test
cmp ch, 0 ; Test the height of the box
jnz draw_box ; If not zero, draw the rest of the box
ret
%ifdef dos
;
; Print string function
; Params: AH - background/foreground color
; BP - string addr
; CX - position/offset
;
print_string:
mov di, cx ; Adds offset to DI
mov al, byte [bp] ; Copies the char to AL (AH already contains color data)
cmp al, 0 ; If the char is zero, string finished
jz _0 ; ... return
stosw
add cx, 2 ; Adds more 2 bytes the offset
inc bp ; Increments the string pointer
jmp print_string ; Repeats the rest of the string
_0:
ret
%endif
;
; Print number function
; Params: AX - num value
; [bp+2] - position/offset
; [bp+4] - background/foreground color
;
print_number:
%ifdef dos
cmp ax, 0
je _p_exit
%endif
mov bp, sp
mov di, [bp+2]
xor cx, cx
_get_unit:
cmp ax, 0
je _print
xor dx, dx
mov bx, 10
div bx
xor bx, bx
mov bl, dl
push bx
inc cx
jmp _get_unit
_print:
pop ax
add al, '0' ; Add char `0` to value
mov ah, byte [bp+5] ; Copy color info
stosw
loop _print
_p_exit:
ret
exit:
int 0x20 ; exit
%ifdef dos
title_string: db " r e t r o 2 0 4 8 ",0
score_string: db "Score: ",0
%endif
current_cell_pointer: dw 0x0000
current_offset: dw 0x0000
%ifdef dos
score: dw 0x0000
%endif
board_offset_row:
dw 160*6, 160*10, 160*14, 160*18
board_offset_column:
db 48, 66, 84, 102
%ifdef dos
board_colors:
; 0 2 4 8 16 32 64 128 256 512 1024 2048
db 0x00, 0x2f, 0x1f, 0x4f, 0x5f, 0x6f, 0x79, 0x29, 0x15, 0xce, 0xdc, 0x8e
%endif
movement_up: db 4, 0, 1
movement_left: db 1, 0, 4
movement_right: db -1, 3, 4
movement_down: db -4, 12, 1
board:
db 0,0,0,0
db 0,0,0,0
db 0,0,0,0
db 0,0,0,0
%ifdef bootsector
times 510-($-$$) db 0x4f
db 0x55, 0xaa ; bootable signature
%endif
|
Data/Boolean/NaryOperators.agda | Lolirofle/stuff-in-agda | 6 | 217 | <filename>Data/Boolean/NaryOperators.agda
module Data.Boolean.NaryOperators where
open import Data.Boolean
import Data.Boolean.Operators
open Data.Boolean.Operators.Logic
open import Function.DomainRaise
open import Numeral.Natural
private variable n : ℕ
-- N-ary conjunction (AND).
-- Every term is true.
∧₊ : (n : ℕ) → (Bool →̂ Bool)(n)
∧₊(0) = 𝑇
∧₊(1) x = x
∧₊(𝐒(𝐒(n))) x = (x ∧_) ∘ (∧₊(𝐒(n)))
-- N-ary disjunction (OR).
-- There is a term which is true.
∨₊ : (n : ℕ) → (Bool →̂ Bool)(n)
∨₊(0) = 𝐹
∨₊(1) x = x
∨₊(𝐒(𝐒(n))) x = (x ∨_) ∘ (∨₊(𝐒(n)))
-- N-ary implication.
-- All left terms together imply the right-most term.
⟶₊ : (n : ℕ) → (Bool →̂ Bool)(n)
⟶₊(0) = 𝑇
⟶₊(1) x = x
⟶₊(𝐒(𝐒(n))) x = (x ⟶_) ∘ (⟶₊(𝐒(n)))
-- N-ary NAND.
-- Not every term is true.
-- There is a term which is false.
⊼₊ : (n : ℕ) → (Bool →̂ Bool)(n)
⊼₊(0) = 𝐹
⊼₊(1) x = ¬ x
⊼₊(𝐒(𝐒(n))) x = (x ⊼_) ∘ ((¬) ∘ (⊼₊(𝐒(n))))
-- N-ary NOR.
-- There are no terms that are true.
-- Every term is false.
⊽₊ : (n : ℕ) → (Bool →̂ Bool)(n)
⊽₊(0) = 𝐹
⊽₊(1) x = ¬ x
⊽₊(𝐒(𝐒(n))) x = (x ⊽_) ∘ ((¬) ∘ (⊽₊(𝐒(n))))
|
libsrc/graphics/px8/w_plotpixl.asm | Toysoft/z88dk | 8 | 7676 | INCLUDE "graphics/grafix.inc"
SECTION code_clib
PUBLIC w_plotpixel
EXTERN l_cmp
EXTERN __gfx_coords
EXTERN px8_conout
;
; $Id: w_plotpixl.asm, stefano - 2017 $
;
; ******************************************************************
;
; Plot pixel at (x,y) coordinate.
;
; Wide resolution (WORD based parameters) version by <NAME>
;
; Design & programming by <NAME>, Copyright (C) InterLogic 1995
;
; The (0,0) origin is placed at the top left corner.
;
; in: hl,de = (x,y) coordinate of pixel
;
; registers changed after return:
; ......../ixiy same
; afbcdehl/.... different
;
.w_plotpixel
push hl
ld hl,maxy
call l_cmp
pop hl
ret nc ; Return if Y overflows
push de
ld de,maxx
call l_cmp
pop de
ret c ; Return if X overflows
ld (__gfx_coords),hl ; store X
ld (__gfx_coords+2),de ; store Y: COORDS must be 2 bytes wider
push hl
push de
ld c,27 ; ESCape
call px8_conout
ld c,0xc7 ; PSET/PRESET
call px8_conout
ld c,1 ; PSET (PRESET=0)
call px8_conout
pop de
ld c,e
call px8_conout ; y
pop hl
push hl
ld c,h
call px8_conout ; x (msb)
pop hl
ld c,l
jp px8_conout ; x (lsb)
|
source/rules.ads | jquorning/CELLE | 0 | 7520 | <filename>source/rules.ads
--
-- The author disclaims copyright to this source code. In place of
-- a legal notice, here is a blessing:
--
-- May you do good and not evil.
-- May you find forgiveness for yourself and forgive others.
-- May you share freely, not taking more than you give.
--
with Ada.Strings.Unbounded;
with Ada.Containers.Vectors;
with Types;
limited with Symbols;
with Rule_Lists;
package Rules is
subtype Rule_Access is Rule_Lists.Rule_Access;
subtype Rule_List is Rule_Lists.Lists.List;
type Dot_Type is new Natural;
Ignore : constant Dot_Type := Dot_Type'Last;
type Rule_Symbol_Access is access all Symbols.Symbol_Record;
subtype Line_Number is Types.Line_Number;
package RHS_Vectors is
new Ada.Containers.Vectors (Index_Type => Dot_Type,
Element_Type => Rule_Symbol_Access);
use Ada.Strings.Unbounded;
package Alias_Vectors is
new Ada.Containers.Vectors (Index_Type => Dot_Type,
Element_Type => Unbounded_String);
subtype T_Code is Unbounded_String;
Null_Code : T_Code renames Null_Unbounded_String;
function "=" (Left, Right : in T_Code) return Boolean
renames Ada.Strings.Unbounded."=";
-- A configuration is a production rule of the grammar together with
-- a mark (dot) showing how much of that rule has been processed so far.
-- Configurations also contain a follow-set which is a list of terminal
-- symbols which are allowed to immediately follow the end of the rule.
-- Every configuration is recorded as an instance of the following:
-- Each production rule in the grammar is stored in the following
-- structure.
type Index_Number is new Integer;
type Rule_Number is new Integer;
type Rule_Record is
record
LHS : Rule_Symbol_Access := null;
LHS_Alias : Unbounded_String := Null_Unbounded_String;
-- Alias for the LHS (NULL if none)
LHS_Start : Boolean := False;
-- True if left-hand side is the start symbol
Rule_Line : Line_Number := 0;
-- Line number for the rule
RHS : RHS_Vectors.Vector := RHS_Vectors.Empty_Vector;
-- The RHS symbols
RHS_Alias : Alias_Vectors.Vector := Alias_Vectors.Empty_Vector;
-- An alias for each RHS symbol (NULL if none)
Line : Line_Number := 0;
-- Line number at which code begins
Code : T_Code := Null_Unbounded_String;
-- The code executed when this rule is reduced
Code_Prefix : T_Code := Null_Unbounded_String;
-- Setup code before code[] above
Code_Suffix : T_Code := Null_Unbounded_String;
-- Breakdown code after code[] above
No_Code : Boolean := False;
-- True if this rule has no associated C code
Code_Emitted : Boolean := False;
-- True if the code has been emitted already
Prec_Symbol : Rule_Symbol_Access := null;
-- Precedence symbol for this rule
Index : Index_Number := 0;
-- An index number for this rule
Number : Rule_Number := 0;
-- Rule number as used in the generated tables
Can_Reduce : Boolean := False;
-- True if this rule is ever reduced
Does_Reduce : Boolean := False;
-- Reduce actions occur after optimization
Never_Reduce : Boolean := False;
-- Reduce is theoretically possible, but prevented
-- by actions or other outside implementation
Next_LHS : Rule_Access := null;
-- Next rule with the same LHS
end record;
procedure Rule_Sort (List : in out Rule_List);
-- Sort a list of rules in order of increasing iRule Value
procedure Assing_Sequential_Rule_Numbers (List : in out Rule_List);
end Rules;
|
code/Forec/t22.asm | KongoHuster/assembly-exercise | 1 | 20635 | ;; last edit date: 2016/10/25
;; author: Forec
;; LICENSE
;; Copyright (c) 2015-2017, Forec <<EMAIL>>
;; Permission to use, copy, modify, and/or distribute this code for any
;; purpose with or without fee is hereby granted, provided that the above
;; copyright notice and this permission notice appear in all copies.
;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
title forec_t22
.model small
.data
table dw 100h dup(?)
;; 此题也可用栈处理,但所需空间增大
.code
start:
mov ax, @data
mov ds, ax
mov es, ax
mov si, 00h
mov ax, 00h ;; ax 暂存出现次数最多的数
mov bx, 00h ;; bx 暂存最多出现次数
mov cx, 100h
check:
cmp si, 100h
jz quit
mov di, 00h ;; 下标
mov cx, 00h ;; 次数
mov dx, table[si]
inside:
cmp di, 100h
jz quitloop ;; 比较完成
cmp dx, table[di]
jnz pass1
inc cx
pass1:
add di, 2h
jmp inside
quitloop:
cmp cx, bx ;; 比较当前次数与最大次数
jle pass2
mov bx, cx ;; 更新最大次数和数
mov ax, dx
pass2:
add si, 2h
jmp check
quit:
mov cx, bx
mov ah, 4ch
int 21h
end start |
extern/gnat_sdl/gnat_sdl2/src/tmmintrin_h.ads | AdaCore/training_material | 15 | 1829 | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
package tmmintrin_h is
-- Copyright (C) 2006-2017 Free Software Foundation, Inc.
-- This file is part of GCC.
-- GCC 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 3, or (at your option)
-- any later version.
-- GCC 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.
-- Under Section 7 of GPL version 3, you are granted additional
-- permissions described in the GCC Runtime Library Exception, version
-- 3.1, as published by the Free Software Foundation.
-- 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/>.
-- Implemented from the specification included in the Intel C++ Compiler
-- User Guide and Reference, version 9.1.
-- We need definitions from the SSE3, SSE2 and SSE header files
-- skipped func _mm_hadd_epi16
-- skipped func _mm_hadd_epi32
-- skipped func _mm_hadds_epi16
-- skipped func _mm_hadd_pi16
-- skipped func _mm_hadd_pi32
-- skipped func _mm_hadds_pi16
-- skipped func _mm_hsub_epi16
-- skipped func _mm_hsub_epi32
-- skipped func _mm_hsubs_epi16
-- skipped func _mm_hsub_pi16
-- skipped func _mm_hsub_pi32
-- skipped func _mm_hsubs_pi16
-- skipped func _mm_maddubs_epi16
-- skipped func _mm_maddubs_pi16
-- skipped func _mm_mulhrs_epi16
-- skipped func _mm_mulhrs_pi16
-- skipped func _mm_shuffle_epi8
-- skipped func _mm_shuffle_pi8
-- skipped func _mm_sign_epi8
-- skipped func _mm_sign_epi16
-- skipped func _mm_sign_epi32
-- skipped func _mm_sign_pi8
-- skipped func _mm_sign_pi16
-- skipped func _mm_sign_pi32
-- skipped func _mm_abs_epi8
-- skipped func _mm_abs_epi16
-- skipped func _mm_abs_epi32
-- skipped func _mm_abs_pi8
-- skipped func _mm_abs_pi16
-- skipped func _mm_abs_pi32
end tmmintrin_h;
|
aspectj/AspectJLexer.g4 | ChristianWulf/grammars-v4 | 4 | 5828 |
/*
[The "BSD licence"]
Copyright (c) 2015 <NAME>
All rights reserved.
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. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
/*
Derived from
https://eclipse.org/aspectj/doc/next/quick5.pdf
https://eclipse.org/aspectj/doc/next/progguide/starting.html
https://eclipse.org/aspectj/doc/next/adk15notebook/grammar.html
*/
/*
This grammar builds on top of the ANTLR4 Java grammar, but it uses
lexical modes to lex the annotation form of AspectJ; hence in order to use it
you need to break Java.g4 into Separate Lexer (JavaLexer.g4) and Parser (JavaParser.g4) grammars.
*/
lexer grammar AspectJLexer;
import JavaLexer;
DOTDOT : '..';
DQUOTE : '"';
ADVICEEXECUTION : 'adviceexecution';
ANNOTATION : 'annotation';
ARGS : 'args';
AFTER : 'after';
AROUND : 'around';
ASPECT : 'aspect';
BEFORE : 'before';
CALL : 'call';
CFLOW : 'cflow';
CFLOWBELOW : 'cflowbelow';
DECLARE : 'declare';
ERROR : 'error';
EXECUTION : 'execution';
GET : 'get';
HANDLER : 'handler';
INITIALIZATION : 'initialization';
ISSINGLETON : 'issingleton';
PARENTS : 'parents';
PERCFLOW : 'percflow';
PERCFLOWBELOW : 'percflowbelow';
PERTARGET : 'pertarget';
PERTHIS : 'perthis';
PERTYPEWITHIN : 'pertypewithin';
POINTCUT : 'pointcut';
PRECEDENCE : 'precedence';
PREINITIALIZATION : 'preinitialization';
PRIVILEGED : 'privileged';
RETURNING : 'returning';
SET : 'set';
SOFT : 'soft';
STATICINITIALIZATION : 'staticinitialization';
TARGET : 'target';
THROWING : 'throwing';
WARNING : 'warning';
WITHIN : 'within';
WITHINCODE : 'withincode';
ANNOTATION_AFTER : 'After';
ANNOTATION_AFTERRETURNING : 'AfterReturning';
ANNOTATION_AFTERTHROWING : 'AfterThrowing';
ANNOTATION_AROUND : 'Around';
ANNOTATION_ASPECT : 'Aspect';
ANNOTATION_BEFORE : 'Before';
ANNOTATION_DECLAREPARENTS : 'DeclareParents';
ANNOTATION_DECLAREMIXIN : 'DeclareMixin';
ANNOTATION_DECLAREWARNING : 'DeclareWarning';
ANNOTATION_DECLAREERROR : 'DeclareError';
ANNOTATION_DECLAREPRECEDENCE : 'DeclarePrecedence';
ANNOTATION_POINTCUT : 'Pointcut';
ANNOTATION_CONSTRUCTOR : 'constructor';
ANNOTATION_DEFAULTIMPL : 'defaultImpl';
ANNOTATION_FIELD : 'field';
ANNOTATION_INTERFACES : 'interfaces';
ANNOTATION_TYPE : 'type';
ANNOTATION_METHOD : 'method';
ANNOTATION_VALUE : 'value';
AT : '@' -> pushMode(Annotation);
mode Annotation;
ANNOTATION_AFTER1 : ANNOTATION_AFTER -> type(ANNOTATION_AFTER), mode(AspectJAnnotationMode);
ANNOTATION_AFTERRETURNING1 : ANNOTATION_AFTERRETURNING -> type(ANNOTATION_AFTERRETURNING), mode(AspectJAnnotationMode);
ANNOTATION_AFTERTHROWING1 : ANNOTATION_AFTERTHROWING -> type(ANNOTATION_AFTERTHROWING), mode(AspectJAnnotationMode);
ANNOTATION_AROUND1 : ANNOTATION_AROUND -> type(ANNOTATION_AROUND), mode(AspectJAnnotationMode);
ANNOTATION_ASPECT1 : ANNOTATION_ASPECT -> type(ANNOTATION_ASPECT), mode(AspectJAnnotationMode);
ANNOTATION_BEFORE1 : ANNOTATION_BEFORE -> type(ANNOTATION_BEFORE), mode(AspectJAnnotationMode);
ANNOTATION_DECLAREPARENTS1 : ANNOTATION_DECLAREPARENTS -> type(ANNOTATION_DECLAREPARENTS), mode(AspectJAnnotationMode);
ANNOTATION_DECLAREMIXIN1 : ANNOTATION_DECLAREMIXIN -> type(ANNOTATION_DECLAREMIXIN), mode(AspectJAnnotationMode);
ANNOTATION_DECLAREWARNING1 : ANNOTATION_DECLAREWARNING -> type(ANNOTATION_DECLAREWARNING), mode(AspectJAnnotationMode);
ANNOTATION_DECLAREERROR1 : ANNOTATION_DECLAREERROR -> type(ANNOTATION_DECLAREERROR), mode(AspectJAnnotationMode);
ANNOTATION_DECLAREPRECEDENCE1 : ANNOTATION_DECLAREPRECEDENCE -> type(ANNOTATION_DECLAREPRECEDENCE), mode(AspectJAnnotationMode);
ANNOTATION_POINTCUT1 : ANNOTATION_POINTCUT -> type(ANNOTATION_POINTCUT), mode(AspectJAnnotationMode);
ARGS1 : ARGS -> type(ARGS), mode(DEFAULT_MODE);
TARGET1 : TARGET -> type(TARGET), mode(DEFAULT_MODE);
THIS1 : THIS -> type(THIS), mode(DEFAULT_MODE);
Identifier1 : Identifier -> type(Identifier), mode(DEFAULT_MODE);
WS1 : [ \t\r\n\u000C]+ -> skip;
COMMENT1 : '/*' .*? '*/' -> skip;
LINE_COMMENT1 : '//' ~[\r\n]* -> skip;
INVALID1 : . -> mode(DEFAULT_MODE);
mode AspectJAnnotationMode;
ABSTRACT2 : ABSTRACT -> type(ABSTRACT), mode(DEFAULT_MODE);
ASSERT2 : ASSERT -> type(ASSERT), mode(DEFAULT_MODE);
BOOLEAN2 : BOOLEAN -> type(BOOLEAN), mode(DEFAULT_MODE);
BREAK2 : BREAK -> type(BREAK), mode(DEFAULT_MODE);
BYTE2 : BYTE -> type(BYTE), mode(DEFAULT_MODE);
CASE2 : CASE -> type(CASE), mode(DEFAULT_MODE);
CATCH2 : CATCH -> type(CATCH), mode(DEFAULT_MODE);
CHAR2 : CHAR -> type(CHAR), mode(DEFAULT_MODE);
CLASS2 : CLASS -> type(CLASS), mode(DEFAULT_MODE);
CONST2 : CONST -> type(CONST), mode(DEFAULT_MODE);
CONTINUE2 : CONTINUE -> type(CONTINUE), mode(DEFAULT_MODE);
DEFAULT2 : DEFAULT -> type(DEFAULT), mode(DEFAULT_MODE);
DO2 : DO -> type(DO), mode(DEFAULT_MODE);
DOUBLE2 : DOUBLE -> type(DOUBLE), mode(DEFAULT_MODE);
ELSE2 : ELSE -> type(ELSE), mode(DEFAULT_MODE);
ENUM2 : ENUM -> type(ENUM), mode(DEFAULT_MODE);
EXTENDS2 : EXTENDS -> type(EXTENDS), mode(DEFAULT_MODE);
FINAL2 : FINAL -> type(FINAL), mode(DEFAULT_MODE);
FINALLY2 : FINALLY -> type(FINALLY), mode(DEFAULT_MODE);
FLOAT2 : FLOAT -> type(FLOAT), mode(DEFAULT_MODE);
FOR2 : FOR -> type(FOR), mode(DEFAULT_MODE);
IF2 : IF -> type(IF), mode(DEFAULT_MODE);
GOTO2 : GOTO -> type(GOTO), mode(DEFAULT_MODE);
IMPLEMENTS2 : IMPLEMENTS -> type(IMPLEMENTS), mode(DEFAULT_MODE);
IMPORT2 : IMPORT -> type(IMPORT), mode(DEFAULT_MODE);
INSTANCEOF2 : INSTANCEOF -> type(INSTANCEOF), mode(DEFAULT_MODE);
INT2 : INT -> type(INT), mode(DEFAULT_MODE);
INTERFACE2 : INTERFACE -> type(INTERFACE), mode(DEFAULT_MODE);
LONG2 : LONG -> type(LONG), mode(DEFAULT_MODE);
NATIVE2 : NATIVE -> type(NATIVE), mode(DEFAULT_MODE);
NEW2 : NEW -> type(NEW), mode(DEFAULT_MODE);
PACKAGE2 : PACKAGE -> type(PACKAGE), mode(DEFAULT_MODE);
PRIVATE2 : PRIVATE -> type(PRIVATE), mode(DEFAULT_MODE);
PROTECTED2 : PROTECTED -> type(PROTECTED), mode(DEFAULT_MODE);
PUBLIC2 : PUBLIC -> type(PUBLIC), mode(DEFAULT_MODE);
RETURN2 : RETURN -> type(RETURN), mode(DEFAULT_MODE);
SHORT2 : SHORT -> type(SHORT), mode(DEFAULT_MODE);
STATIC2 : STATIC -> type(STATIC), mode(DEFAULT_MODE);
STRICTFP2 : STRICTFP -> type(STRICTFP), mode(DEFAULT_MODE);
SUPER2 : SUPER -> type(SUPER), mode(DEFAULT_MODE);
SWITCH2 : SWITCH -> type(SWITCH), mode(DEFAULT_MODE);
SYNCHRONIZED2 : SYNCHRONIZED -> type(SYNCHRONIZED), mode(DEFAULT_MODE);
THIS2 : THIS -> type(THIS), mode(DEFAULT_MODE);
THROW2 : THROW -> type(THROW), mode(DEFAULT_MODE);
THROWS2 : THROWS -> type(THROWS), mode(DEFAULT_MODE);
TRANSIENT2 : TRANSIENT -> type(TRANSIENT), mode(DEFAULT_MODE);
TRY2 : TRY -> type(TRY), mode(DEFAULT_MODE);
VOID2 : VOID -> type(VOID), mode(DEFAULT_MODE);
VOLATILE2 : VOLATILE -> type(VOLATILE), mode(DEFAULT_MODE);
WHILE2 : WHILE -> type(WHILE), mode(DEFAULT_MODE);
ADVICEEXECUTION2 : ADVICEEXECUTION -> type(ADVICEEXECUTION), mode(DEFAULT_MODE);
ANNOTATION2 : ANNOTATION -> type(ANNOTATION), mode(DEFAULT_MODE);
ARGS2 : ARGS -> type(ARGS), mode(DEFAULT_MODE);
AFTER2 : AFTER -> type(AFTER), mode(DEFAULT_MODE);
AROUND2 : AROUND -> type(AROUND), mode(DEFAULT_MODE);
ASPECT2 : ASPECT -> type(ASPECT), mode(DEFAULT_MODE);
BEFORE2 : BEFORE -> type(BEFORE), mode(DEFAULT_MODE);
CALL2 : CALL -> type(CALL), mode(DEFAULT_MODE);
CFLOW2 : CFLOW -> type(CFLOW), mode(DEFAULT_MODE);
CFLOWBELOW2 : CFLOWBELOW -> type(CFLOWBELOW), mode(DEFAULT_MODE);
DECLARE2 : DECLARE -> type(DECLARE), mode(DEFAULT_MODE);
ERROR2 : ERROR -> type(ERROR), mode(DEFAULT_MODE);
EXECUTION2 : EXECUTION -> type(EXECUTION), mode(DEFAULT_MODE);
GET2 : GET -> type(GET), mode(DEFAULT_MODE);
HANDLER2 : HANDLER -> type(HANDLER), mode(DEFAULT_MODE);
INITIALIZATION2 : INITIALIZATION -> type(INITIALIZATION), mode(DEFAULT_MODE);
ISSINGLETON2 : ISSINGLETON -> type(ISSINGLETON), mode(DEFAULT_MODE);
PARENTS2 : PARENTS -> type(PARENTS), mode(DEFAULT_MODE);
PERCFLOW2 : PERCFLOW -> type(PERCFLOW), mode(DEFAULT_MODE);
PERCFLOWBELOW2 : PERCFLOWBELOW -> type(PERCFLOWBELOW), mode(DEFAULT_MODE);
PERTARGET2 : PERTARGET -> type(PERTARGET), mode(DEFAULT_MODE);
PERTHIS2 : PERTHIS -> type(PERTHIS), mode(DEFAULT_MODE);
PERTYPEWITHIN2 : PERTYPEWITHIN -> type(PERTYPEWITHIN), mode(DEFAULT_MODE);
POINTCUT2 : POINTCUT -> type(POINTCUT), mode(DEFAULT_MODE);
PRECEDENCE2 : PRECEDENCE -> type(PRECEDENCE), mode(DEFAULT_MODE);
PREINITIALIZATION2 : PREINITIALIZATION -> type(PREINITIALIZATION), mode(DEFAULT_MODE);
PRIVILEGED2 : PRIVILEGED -> type(PRIVILEGED), mode(DEFAULT_MODE);
RETURNING2 : RETURNING -> type(RETURNING), mode(DEFAULT_MODE);
SET2 : SET -> type(SET), mode(DEFAULT_MODE);
SOFT2 : SOFT -> type(SOFT), mode(DEFAULT_MODE);
STATICINITIALIZATION2 : STATICINITIALIZATION -> type(STATICINITIALIZATION), mode(DEFAULT_MODE);
TARGET2 : TARGET -> type(TARGET), mode(DEFAULT_MODE);
THROWING2 : THROWING -> type(THROWING), mode(DEFAULT_MODE);
WARNING2 : WARNING -> type(WARNING), mode(DEFAULT_MODE);
WITHIN2 : WITHIN -> type(WITHIN), mode(DEFAULT_MODE);
WITHINCODE2 : WITHINCODE -> type(WITHINCODE), mode(DEFAULT_MODE);
IntegerLiteral2 : IntegerLiteral -> type(IntegerLiteral), pushMode(AspectJAnnotationScope);
FloatingPointLiteral2 : FloatingPointLiteral -> type(FloatingPointLiteral), pushMode(AspectJAnnotationScope);
BooleanLiteral2 : BooleanLiteral -> type(BooleanLiteral), pushMode(AspectJAnnotationScope);
CharacterLiteral2 : CharacterLiteral -> type(CharacterLiteral), pushMode(AspectJAnnotationScope);
StringLiteral2 : StringLiteral -> type(StringLiteral), pushMode(AspectJAnnotationScope);
NullLiteral2 : NullLiteral -> type(NullLiteral), pushMode(AspectJAnnotationScope);
LPAREN2 : LPAREN -> type(LPAREN), pushMode(AspectJAnnotationScope);
RPAREN2 : RPAREN -> type(RPAREN), mode(DEFAULT_MODE);
LBRACE2 : LBRACE -> type(LBRACE), mode(DEFAULT_MODE);
RBRACE2 : RBRACE -> type(RBRACE), mode(DEFAULT_MODE);
LBRACK2 : LBRACK -> type(LBRACK), mode(DEFAULT_MODE);
RBRACK2 : RBRACK -> type(RBRACK), mode(DEFAULT_MODE);
SEMI2 : SEMI -> type(SEMI), mode(DEFAULT_MODE);
COMMA2 : COMMA -> type(COMMA), mode(DEFAULT_MODE);
DOT2 : DOT -> type(DOT), mode(DEFAULT_MODE);
DOTDOT2 : DOTDOT -> type(DOTDOT), mode(DEFAULT_MODE);
DQUOTE2 : DQUOTE -> type(DQUOTE), mode(DEFAULT_MODE);
ASSIGN2 : ASSIGN -> type(ASSIGN), mode(DEFAULT_MODE);
GT2 : GT -> type(GT), mode(DEFAULT_MODE);
LT2 : LT -> type(LT), mode(DEFAULT_MODE);
BANG2 : BANG -> type(BANG), mode(DEFAULT_MODE);
TILDE2 : TILDE -> type(TILDE), mode(DEFAULT_MODE);
QUESTION2 : QUESTION -> type(QUESTION), mode(DEFAULT_MODE);
COLON2 : COLON -> type(COLON), mode(DEFAULT_MODE);
EQUAL2 : EQUAL -> type(EQUAL), mode(DEFAULT_MODE);
LE2 : LE -> type(LE), mode(DEFAULT_MODE);
GE2 : GE -> type(GE), mode(DEFAULT_MODE);
NOTEQUAL2 : NOTEQUAL -> type(NOTEQUAL), mode(DEFAULT_MODE);
AND2 : AND -> type(ADD), mode(DEFAULT_MODE);
OR2 : OR -> type(OR), mode(DEFAULT_MODE);
INC2 : INC -> type(INC), mode(DEFAULT_MODE);
DEC2 : DEC -> type(DEC), mode(DEFAULT_MODE);
ADD2 : ADD -> type(ADD), mode(DEFAULT_MODE);
SUB2 : SUB -> type(SUB), mode(DEFAULT_MODE);
MUL2 : MUL -> type(MUL), mode(DEFAULT_MODE);
DIV2 : DIV -> type(DIV), mode(DEFAULT_MODE);
BITAND2 : BITAND -> type(BITAND), mode(DEFAULT_MODE);
BITOR2 : BITOR -> type(BITOR), mode(DEFAULT_MODE);
CARET2 : CARET -> type(CARET), mode(DEFAULT_MODE);
MOD2 : MOD -> type(MOD), mode(DEFAULT_MODE);
ADD_ASSIGN2 : ADD_ASSIGN -> type(ADD_ASSIGN), mode(DEFAULT_MODE);
SUB_ASSIGN2 : SUB_ASSIGN -> type(SUB_ASSIGN), mode(DEFAULT_MODE);
MUL_ASSIGN2 : MUL_ASSIGN -> type(MUL_ASSIGN), mode(DEFAULT_MODE);
DIV_ASSIGN2 : DIV_ASSIGN -> type(DIV_ASSIGN), mode(DEFAULT_MODE);
AND_ASSIGN2 : AND_ASSIGN -> type(AND_ASSIGN), mode(DEFAULT_MODE);
OR_ASSIGN2 : OR_ASSIGN -> type(OR_ASSIGN), mode(DEFAULT_MODE);
XOR_ASSIGN2 : XOR_ASSIGN -> type(XOR_ASSIGN), mode(DEFAULT_MODE);
MOD_ASSIGN2 : MOD_ASSIGN -> type(MOD_ASSIGN), mode(DEFAULT_MODE);
LSHIFT_ASSIGN2 : LSHIFT_ASSIGN -> type(LSHIFT_ASSIGN), mode(DEFAULT_MODE);
RSHIFT_ASSIGN2 : RSHIFT_ASSIGN -> type(RSHIFT_ASSIGN), mode(DEFAULT_MODE);
URSHIFT_ASSIGN2 : URSHIFT_ASSIGN -> type(URSHIFT_ASSIGN), mode(DEFAULT_MODE);
Identifier2 : Identifier -> type(Identifier), mode(DEFAULT_MODE);
AT2 : AT -> type(AT), mode(Annotation);
ELLIPSIS2 : ELLIPSIS -> type(ELLIPSIS), mode(DEFAULT_MODE);
WS2 : WS -> skip;
COMMENT2 : COMMENT -> skip;
LINE_COMMENT2 : LINE_COMMENT -> skip;
mode AspectJAnnotationScope;
RPAREN3 : RPAREN -> type(RPAREN), mode(DEFAULT_MODE);
DQUOTE3 : DQUOTE -> type(DQUOTE), pushMode(AspectJAnnotationString);
AT3 : AT -> type(AT), pushMode(Annotation);
ASSIGN3 : ASSIGN -> type(ASSIGN);
LBRACE3 : LBRACE -> type(LBRACE);
RBRACE3 : RBRACE -> type(RBRACE);
COMMA3 : COMMA -> type(COMMA);
DOT3 : DOT -> type(DOT);
CLASS3 : CLASS -> type(CLASS);
DEFAULTIMPL3 : ANNOTATION_DEFAULTIMPL -> type(ANNOTATION_DEFAULTIMPL);
ANNOTATION_INTERFACES3 : ANNOTATION_INTERFACES -> type(ANNOTATION_INTERFACES);
POINTCUT3 : POINTCUT -> type(POINTCUT);
RETURNING3 : RETURNING -> type(RETURNING);
VALUE3 : ANNOTATION_VALUE -> type(ANNOTATION_VALUE);
Identifier3 : Identifier -> type(Identifier);
WS3 : [ \t\r\n\u000C]+ -> skip;
COMMENT3 : '/*' .*? '*/' -> skip;
LINE_COMMENT3 : '//' ~[\r\n]* -> skip;
INVALID3 : . -> mode(DEFAULT_MODE);
mode AspectJAnnotationString;
DQUOTE4 : DQUOTE -> type(DQUOTE), popMode;
LPAREN4 : LPAREN -> type(LPAREN);
RPAREN4 : RPAREN -> type(RPAREN);
COLON4 : COLON -> type(COLON);
AND4 : AND -> type(AND);
OR4 : OR -> type(OR);
COMMA4 : COMMA -> type(COMMA);
DOT4 : DOT -> type(DOT);
DOTDOT4 : DOTDOT -> type(DOTDOT);
EQUAL4 : EQUAL -> type(EQUAL);
ADD4 : ADD -> type(ADD);
LBRACE4 : LBRACE -> type(LBRACE);
RBRACE4 : RBRACE -> type(RBRACE);
BANG4 : BANG -> type(BANG);
MUL4 : MUL -> type(MUL);
ASSIGN4 : ASSIGN -> type(ASSIGN);
BOOLEAN4 : BOOLEAN -> type(BOOLEAN);
BYTE4 : BYTE -> type(BYTE);
CHAR4 : CHAR -> type(CHAR);
IF4 : IF -> type(IF);
INT4 : INT -> type(INT);
LONG4 : LONG -> type(LONG);
NEW4 : NEW -> type(NEW);
SHORT4 : SHORT -> type(SHORT);
THIS4 : THIS -> type(THIS);
VOID4 : VOID -> type(VOID);
ADVICEEXECUTION4 : ADVICEEXECUTION -> type(ADVICEEXECUTION);
ANNOTATION4 : ANNOTATION -> type(ANNOTATION);
ARGS4 : ARGS -> type(ARGS);
AFTER4 : AFTER -> type(AFTER);
AROUND4 : AROUND -> type(AROUND);
ASPECT4 : ASPECT -> type(ASPECT);
BEFORE4 : BEFORE -> type(BEFORE);
CALL4 : CALL -> type(CALL);
CFLOW4 : CFLOW -> type(CFLOW);
CFLOWBELOW4 : CFLOWBELOW -> type(CFLOWBELOW);
DECLARE4 : DECLARE -> type(DECLARE);
ERROR4 : ERROR -> type(ERROR);
EXECUTION4 : EXECUTION -> type(EXECUTION);
GET4 : GET -> type(GET);
HANDLER4 : HANDLER -> type(HANDLER);
INITIALIZATION4 : INITIALIZATION -> type(INITIALIZATION);
ISSINGLETON4 : ISSINGLETON -> type(ISSINGLETON);
PARENTS4 : PARENTS -> type(PARENTS);
PERCFLOW4 : PERCFLOW -> type(PERCFLOW);
PERCFLOWBELOW4 : PERCFLOWBELOW -> type(PERCFLOWBELOW);
PERTARGET4 : PERTARGET -> type(PERTARGET);
PERTHIS4 : PERTHIS -> type(PERTHIS);
PERTYPEWITHIN4 : PERTYPEWITHIN -> type(PERTYPEWITHIN);
POINTCUT4 : POINTCUT -> type(POINTCUT);
PRECEDENCE4 : PRECEDENCE -> type(PRECEDENCE);
PREINITIALIZATION4 : PREINITIALIZATION -> type(PREINITIALIZATION );
PRIVILEGED4 : PRIVILEGED -> type(PRIVILEGED);
RETURNING4 : RETURNING -> type(RETURNING);
SET4 : SET -> type(SET );
SOFT4 : SOFT -> type(SOFT );
STATICINITIALIZATION4 : STATICINITIALIZATION -> type(STATICINITIALIZATION);
TARGET4 : TARGET -> type(TARGET );
THROWING4 : THROWING -> type(THROWING);
WARNING4 : WARNING -> type(WARNING);
WITHIN4 : WITHIN -> type(WITHIN );
WITHINCODE4 : WITHINCODE -> type(WITHINCODE);
Identifier4 : Identifier -> type(Identifier);
WS4 : [ \t\r\n\u000C]+ -> skip;
COMMENT4 : '/*' .*? '*/' -> skip;
LINE_COMMENT4 : '//' ~[\r\n]* -> skip;
INVALID4 : . -> popMode, mode(DEFAULT_MODE);
|
PIC1_Main.asm | mikadam/PIC-Stuff | 0 | 173075 | <reponame>mikadam/PIC-Stuff<gh_stars>0
;----------------------------------------------------------;
; Program title: 4 operator calculator ;
;----------------------------------------------------------;
; Written by: <NAME> ;
;----------------------------------------------------------;
; Date: 19th September 2014 ;
;----------------------------------------------------------;
; Version: 1.0 ;
;----------------------------------------------------------;
; Device: PIC16F627A ;
;----------------------------------------------------------;
; Oscillator: Internal 37 kHz ;
;----------------------------------------------------------;
LIST P=PIC16F627A
;select device
;Tells MPLAB what processor IC is being used
INCLUDE c:\program files (x86)\microchip\MPASM Suite\P16F627A.inc
;include header file
;from default location
;tells the MPLAB where to find the files
__config 0x3F10
;sets config to; internal I/O, no watchdog,Power
;up timer on, master Reset off,
;no brown-out, no LV program, no read protect,
;no code protect
;----------------------------------------------------------;
; DEFINE REGISTERS ;
;----------------------------------------------------------;
cblock 0x20
temp
temp_value_lo
temp_value_hi
store
;temporary registers used in loop counting and space for calculations
operator
;stores code for the next operation to execute
value_hi
value_lo
;stores currently displayed value
old_value_hi
old_value_lo
;stores non displayed operator argument
out_value_lo
out_value_hi
;temporary registers used in calculations
update_flag
;contains various bit flags: 0-screen update 7- minus sign 6-temp storage 5-operator repeat
;4-remainder note 3-all clear counter 2-multiplication overflow flag
rep_value_lo
rep_value_hi
;store values for repeated operations
endc
;INITIALISATION
MOVLW d'07'
MOVWF CMCON ;disable comparators
init BSF STATUS, RP0 ;select bank1 for setup
BCF PCON, OSCF ;selects 37 kHz oscillator
MOVLW b'11111000' ;configure PORTB for button multiplexing
MOVWF TRISB
MOVLW b'10000000'
MOVWF TRISA ;configure PORTA for clear of A7 and A0,1,2 as display outputs
;PORTA 0=clear 1=clock 2=data, 7=clear
BCF STATUS, RP0 ;RETURN to bank0 for program operation
BSF PORTA,0 ;prime display modules
;clear registers to prevent ghosting from previous runs
CLRF temp
CLRF temp_value_lo
CLRF temp_value_hi
CLRF store
CLRF operator
CLRF value_hi
CLRF value_lo
CLRF old_value_hi
CLRF old_value_lo
CLRF out_value_lo
CLRF out_value_hi
CLRF rep_value_lo
CLRF rep_value_hi
CLRF update_flag
main ;wait for till input loop - multiplexes buttons
BCF PORTA,0 ;display values
CLRF PORTB ;sets all multiplex columns off
BTFSC PORTA,7 ;check if clear button was pressed
GOTO no_clear_calc
clear_debounce BTFSS PORTA,7
GOTO clear_debounce
BTFSC update_flag,3 ;test how many times clear button was pressed
GOTO all_clear
BSF update_flag,3 ;count one button press
CLRF value_lo ;if yes clear all relevant registers
CLRF value_hi
CLRF operator
BCF update_flag,0
CALL write_value ;will leave 0 character
GOTO no_clear_calc
all_clear ;second time button was pressed
CLRF value_lo ;if yes clear all relevant registers
CLRF value_hi
CLRF old_value_lo
CLRF old_value_hi
CLRF rep_value_lo
CLRF rep_value_hi
CLRF operator
CLRF update_flag
CLRF store ;Artificially prepare for write_value
BSF PORTA,0
CALL no_negative ;Clear all characters
no_clear_calc ;no clear took place
BSF PORTB,0 ;Enable left column for multiplexing
MOVF PORTB,W ;copy inputs to temp
MOVWF temp
XORLW D'1'
BTFSC STATUS, Z ;check if button was pressed
GOTO bone ;button not pressed
bpone MOVF PORTB,W ;debouncing loop- wait till unpress
XORLW D'1'
BTFSs STATUS, Z ;button unpressed?
GOTO bpone
GOTO button_decode ;decode button code functionality
bone BCF PORTB,0 ;Disable left column for multiplexing
BSF PORTB,1 ;Enable centre column for multiplexing
MOVF PORTB,W ;copy inputs to W
MOVWF temp
XORLW D'2'
BTFSC STATUS, Z ;check if button was pressed
GOTO btwo ;button not pressed
bptwo MOVF PORTB,W ;debouncing loop- wait till unpress
XORLW D'2'
BTFSs STATUS, Z ;button unpressed?
GOTO bptwo
GOTO button_decode ;decode button code functionality
btwo BCF PORTB,1 ;Disable centre column for multiplexing
BSF PORTB,2 ;Enable centre column for multiplexing
MOVF PORTB,W ;copy inputs to W
MOVWF temp
XORLW D'4'
BTFSC STATUS, Z ;check if button was pressed
GOTO bthr ;button not pressed
bpthr MOVF PORTB,W ;debouncing loop- wait till unpress
XORLW D'4'
BTFSs STATUS, Z ;button unpressed?
GOTO bpthr
GOTO button_decode ;decode button code functionality
bthr BCF PORTB,2 ;Disable right column for multiplexing
GOTO main ;loop while awaiting input
segment_look ADDWF PCL,F ;Appearances of characters on screen
;7-Decimal Point
RETLW b'01011111' ;0
RETLW b'00000101' ;1
RETLW b'01110110' ;2
RETLW b'01110101' ;3
RETLW b'00101101' ;4
RETLW b'01111001' ;5
RETLW b'01111011' ;6
RETLW b'01000101' ;7
RETLW b'01111111' ;8
RETLW b'01111101' ;9
GOTO unexpected_error ;something unpredicted happened
button_decode ;subroutine decodes button codes
BCF update_flag,3 ;resets clear counter
BTFSS update_flag,0 ;test if previous button press was operator and value needs clearing
GOTO no_update
BCF update_flag,0 ;clear flag
CLRF value_hi ;clear value
CLRF value_lo
no_update
MOVF temp,w
XORLW D'132'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO sub_act
MOVF temp,w
XORLW D'130'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO div_act
MOVF temp,w
XORLW D'129'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO mul_act
MOVF temp,w
XORLW D'68'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO add_act
MOVF temp,w
XORLW D'66'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO zero_act
MOVF temp,w
XORLW D'65'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO equ_act
MOVF temp,w
XORLW D'36'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO one_act
MOVF temp,w
XORLW D'34'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO two_act
MOVF temp,w
XORLW D'33'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO three_act
MOVF temp,w
XORLW D'20'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO four_act
MOVF temp,w
XORLW D'18'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO five_act
MOVF temp,w
XORLW D'17'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO six_act
MOVF temp,w
XORLW D'12'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO seven_act
MOVF temp,w
XORLW D'10'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO eight_act
MOVF temp,w
XORLW D'9'
BTFSC STATUS,Z ;does temp match the buttons code?
GOTO nine_act
GOTO multi_key ;more than 1 button was pressed, display error code
equ_act
BTFSC update_flag,5 ;was equals pressed twice?
GOTO equ_act_rep
BSF update_flag,5 ;notify that previous button press was equals
MOVFW value_lo ;store current argument for future double press
MOVWF rep_value_lo
MOVFW value_hi
MOVWF rep_value_hi
CALL equ_function ;run appropriate calculation
CALL write_value ;push value to display
GOTO main ;RETURN to main loop
equ_act_rep ;Equals double press
MOVFW value_lo ;use value as old argument
MOVWF old_value_lo
MOVFW value_hi
MOVWF old_value_hi
MOVFW rep_value_lo ;used rep_value as current argument
MOVWF value_lo
MOVFW rep_value_hi
MOVWF value_hi
CALL equ_function ;run appropriate calculation
CALL write_value ;push value to display
GOTO main ;RETURN to main loop
mul_act
BTFSC update_flag,5 ;stops in auto-calculating repeated operation
GOTO mul_rep_skip
CALL equ_function ;If yes calculate them
CALL write_value ;And display them
mul_rep_skip
BCF update_flag,5 ;Resets repetition flag
MOVLW D'2' ;remember which operator is active in register
MOVWF operator
MOVF value_hi, W ;move value to old_value to be used a previous argument
MOVWF old_value_hi
MOVF value_lo, W
MOVWF old_value_lo
BSF update_flag,0 ;clear value next time button is presed
GOTO main ;wait for button input
div_act
BTFSC update_flag,5 ;stops in auto-calculating repeated operation
GOTO div_rep_skip
CALL equ_function ;If yes calculate them
CALL write_value ;And display them
div_rep_skip
BCF update_flag,5 ;Resets repetition flag
MOVLW D'3' ;remember which operator is active in register
MOVWF operator
MOVF value_hi, W ;move value to old_value to be used a previous argument
MOVWF old_value_hi
MOVF value_lo, W
MOVWF old_value_lo
BSF update_flag,0 ;clear value next time button is presed
GOTO main ;wait for button input
sub_act
BTFSC update_flag,5 ;stops in auto-calculating repeated operation
GOTO sub_rep_skip
CALL equ_function ;If yes calculate them
CALL write_value ;And display them
sub_rep_skip
BCF update_flag,5 ;Resets repetition flag
MOVLW D'1' ;remember which operator is active in register
MOVWF operator
MOVF value_hi, W ;move value to old_value to be used a previous argument
MOVWF old_value_hi
MOVF value_lo, W
MOVWF old_value_lo
BSF update_flag,0 ;clear value next time button is pressed
GOTO main ;wait for button input
add_act
BTFSC update_flag,5 ;stops in auto-calculating repeated operation
GOTO add_rep_skip
CALL equ_function ;If yes calculate them
CALL write_value ;And display them
add_rep_skip
BCF update_flag,5 ;Resets repetition flag
MOVLW D'0' ;remember which operator is active in register
MOVWF operator
MOVF value_hi, W ;move value to old_value to be used a previous argument
MOVWF old_value_hi
MOVF value_lo, W
MOVWF old_value_lo
BSF update_flag,0 ;clear value next time button is pressed
GOTO main ;wait for button input
one_act MOVLW D'1' ;copy digit to store and append to end of value base10
MOVWF store
GOTO shift_digits
two_act MOVLW D'2' ;copy digit to store and append to end of value base10
MOVWF store
GOTO shift_digits
three_act MOVLW D'3' ;copy digit to store and append to end of value base10
MOVWF store
GOTO shift_digits
four_act MOVLW D'4' ;copy digit to store and append to end of value base10
MOVWF store
GOTO shift_digits
five_act MOVLW D'5' ;copy digit to store and append to end of value base10
MOVWF store
GOTO shift_digits
six_act MOVLW D'6' ;copy digit to store and append to end of value base10
MOVWF store
GOTO shift_digits
seven_act MOVLW D'7' ;copy digit to store and append to end of value base10
MOVWF store
GOTO shift_digits
eight_act MOVLW D'8' ;copy digit to store and append to end of value base10
MOVWF store
GOTO shift_digits
nine_act MOVLW D'9' ;copy digit to store and append to end of value base10
MOVWF store
GOTO shift_digits
zero_act MOVLW D'0' ;copy digit to store and append to end of value base10
MOVWF store
GOTO shift_digits
shift_digits
;Multiply by 10 by Multiplying by 2,8 and adding
;Multiply by 2, by register rotation
CLRF temp
RLF value_lo, F ;2*
BCF value_lo,0 ;ensures zero is shifted in
BTFSC STATUS, C ;uses temp as carry flag holder
BSF temp,0
RLF value_hi, F ;2*
BCF value_lo,0 ;ensures zero is shifted in
BTFSC STATUS,C ;test to ensure number is in 16bit range
GOTO overflow
BTFSC temp,0 ;carry bit in temporary flag
BSF value_hi,0 ;
;keep temp_value for later addition
MOVF value_lo, W
MOVWF temp_value_lo
MOVF value_hi, W
MOVWF temp_value_hi
;Multiply by 4, by register rotation
CLRF temp
RLF value_lo, F ;2*
BCF value_lo,0 ;ensures zero is shifted in
BTFSC STATUS, C ;uses temp as carry flag holder
BSF temp,0
RLF value_hi, F ;2*
BCF value_hi,0 ;ensures zero is shifted in
BTFSC STATUS,C ;test to ensure number is in 16bit range
GOTO overflow
BTFSC temp,0 ;carry bit in temporary flag
BSF value_hi,0
;Multiply by 8, by register rotation
CLRF temp
RLF value_lo, F ;2*
BCF value_lo,0 ;ensures zero is shifted in
BTFSC STATUS, C ;uses temp as carry flag holder
BSF temp,0
RLF value_hi, F ;2*
BCF value_hi,0 ;ensures zero is shifted in
BTFSC STATUS,C ;test to ensure number is in 16bit range
GOTO overflow
BTFSC temp,0 ;carry bit in temporary flag
BSF value_hi,0
;Add x*2 + x*8 to make 10*x
MOVF temp_value_lo,W
ADDWF value_lo,F ;Add lowest bits
BTFSS STATUS,C ;Test for carry to higher bits
GOTO shift_digits_no_overflow;No carry
INCF temp_value_hi, F ;increment hi from carry
BTFSC STATUS,Z ;if carry out occurred temp_value_hi==0
GOTO overflow ;display overflow error
shift_digits_no_overflow
MOVF temp_value_hi,W ;Add higher byte
ADDWF value_hi,F
BTFSC STATUS,C ;test for overflow
GOTO overflow
;Add digit stored in store
MOVF store,W ;Add store to value
ADDWF value_lo,F
MOVLW d'0' ;Trick for conditional increment and test without labels
BTFSC STATUS,C ;If carry, add 1 insteed of 0
MOVLW d'1'
ADDWF value_hi,F ;Add 1 or 0 to execute or not execute carry
BTFSC STATUS,C ;Test for overflow
GOTO overflow
CALL write_value ;update displayed value
GOTO main ;RETURN to main loop
equ_function ;Actually does the CALLing of calculating functions
MOVF operator,W ;Tests if operator matches + code
XORLW D'0'
BTFSC STATUS, Z ;If yes go to designated subroutine
GOTO actual_add
MOVF operator,W ;Tests if operator matches - code
XORLW D'1'
BTFSC STATUS, Z ;If yes go to designated subroutine
GOTO actual_sub
MOVF operator,W ;Tests if operator matches * code
XORLW D'2'
BTFSC STATUS, Z ;If yes go to designated subroutine
GOTO actual_mul
MOVF operator,W ;Tests if operator matches / code
XORLW D'3'
BTFSC STATUS, Z ;If yes go to designated subroutine
GOTO actual_div
GOTO unexpected_error ;Abnormal operator code, display error code
back_to_equ_function RETURN ;After calculations RETURN to CALL point
actual_add ;subroutine for adding old_value and value
MOVF old_value_lo,W ;Add low bytes
ADDWF value_lo,F
BTFSS STATUS, C ;Test if carry out of low byte occurred
GOTO add_no_carry
INCF old_value_hi, F ;Execute carry
BTFSC STATUS,Z ;If hi byte carried out it==0
GOTO overflow ;display overflow code
add_no_carry
MOVF old_value_hi,W ;Add hi bytes
ADDWF value_hi,F
BTFSC STATUS, C ;Test if overflow occurred
GOTO overflow
GOTO back_to_equ_function ;equ_function for display and further RETURN
actual_mul ;Multiplication via binary algorithm
MOVFW value_lo ;keep value in temp_value for manipulation
MOVWF temp_value_lo
MOVFW value_hi
MOVWF temp_value_hi
CLRF value_hi ;clear value - it will be used as output
CLRF value_lo
CLRF temp ;temp will count number of bit shifts executed - target 16
BCF update_flag,2
mul_loop_bit
INCF temp,F ;increment loop counter
BTFSS temp_value_lo,0 ;Tests lowest bit to see if value is to be added
GOTO mul_no_add
;Adds old_value to value
BTFSC update_flag,2
GOTO overflow
MOVF old_value_lo,W ;Adds lower bytes
ADDWF value_lo,F
BTFSS STATUS, C ;Tests for carry
GOTO mul_no_carry
INCF value_hi, F ;Executes carry to hi byte
BTFSC STATUS,Z ;Tests if 16bit overflow occurred
GOTO overflow
mul_no_carry
MOVF old_value_hi,W ;Added high bytes
ADDWF value_hi,F
BTFSC STATUS, C ;Tests if 16bit overflow occurred
GOTO overflow
mul_no_add
;Multiplies old_value by 2
RLF old_value_lo,F ;rotate lower byte
RLF old_value_hi,F ;rotate higher byte - carry handled by STATUS,C
BTFSC STATUS,C ;Test if 16bit overflow occurred
BSF update_flag,2
BCF old_value_lo,0 ;Ensure new bit is==0
RRF temp_value_hi,F ;Prepare new bit for conditional addition
RRF temp_value_lo,F
BCF temp_value_hi,7 ;Ensure new bit is=0-not necessary by keeps code nice
MOVFW temp ;Testing if loop run 16 times
XORLW d'16'
BTFSS STATUS,Z ;If no repeat
GOTO mul_loop_bit
end_mul GOTO back_to_equ_function
;equ_function for display and further RETURN
actual_sub ;
BCF update_flag,7 ;clears the minus sign flag
MOVF value_lo,W ;subtracts low bytes
SUBWF old_value_lo, F
BTFSC STATUS, C ;tests if borrow occurred
GOTO sub_no_carry
DECF old_value_hi, F ;borrows bit from high byte
MOVFw old_value_hi
XORLW d'255' ;Tests if borrow there was something to borrow from
BTFSC STATUS,Z
BSF update_flag,7 ;If no then set minus sign
sub_no_carry
MOVF value_hi,W ;Subtracts high bytes
SUBWF old_value_hi, F
BTFSS STATUS, C ;If borrow occurred - nothing to borrow from
BSF update_flag,7 ;Set minus sign
BTFSS update_flag,7 ;Test if numbers need to be adjusted for minus
GOTO sub_no_neg
;Execute two's compliment conversion if minus is present
MOVFW old_value_lo ;XOR with 11111111 == flip all bits
XORLW d'255' ;this is twos compliment notation
MOVWF old_value_lo
MOVFW old_value_hi ;XOR with 11111111 == flip all bits
XORLW d'255' ;this is twos compliment notation
MOVWF old_value_hi
INCF old_value_lo,F ;Compensate for zero not being negative by adding 1
BTFSC STATUS,Z
INCF old_value_hi
sub_no_neg
MOVF old_value_lo, W ;Store result in value so it will be displayed
MOVWF value_lo
MOVF old_value_hi, W
MOVWF value_hi
sub_end GOTO back_to_equ_function
;equ_function for display and further RETURN
actual_div ;Division via repeated subtraction
MOVFW value_lo ;Test if lower byte of right operand is ==0
XORLW d'0'
BTFSS STATUS,Z
GOTO no_div_zero
MOVFW value_hi ;Test if higher byte of right operand is ==0
XORLW d'0'
BTFSC STATUS,Z
GOTO unexpected_error ;Output an Error as division by 0 is undefined
no_div_zero
MOVFW value_lo ;copy value to temp_value for manipulation
MOVWF temp_value_lo
MOVFW value_hi
MOVWF temp_value_hi
CLRF value_lo ;value will be used as output
CLRF value_hi
div_sub_loop
MOVFW temp_value_lo ;Subtract lower bytes
SUBWF old_value_lo,F
BTFSC STATUS,C ;Check for a borrow from high byte
GOTO div_no_borrow
DECF old_value_hi,F ;Borrow from high byte
MOVFW old_value_hi
XORLW d'255' ;Test if high byte went negative
BTFSC STATUS,Z
GOTO div_sub_end ;If yes GOTO ending
div_no_borrow
MOVFW temp_value_hi ;Subtract higher bytes
SUBWF old_value_hi,F
BTFSS STATUS,C ;Check if result went negative - borrow from non existent byte
GOTO div_sub_end
INCF value_lo,F ;Increment counter on number of successful subtractions
BTFSC STATUS,Z
INCF value_hi,F ;Carry into high byte
GOTO div_sub_loop
div_sub_end
MOVFW temp_value_lo ;fix offset in low byte for one too many subtractions
ADDWF old_value_lo,F
BTFSC STATUS,C ;carry addition to high byte
INCF old_value_hi,F
MOVFW temp_value_hi ;fix offset in high byte for one too many subtractions
ADDWF old_value_hi,F
BCF update_flag,4 ;Remainder flag=0
MOVFW old_value_lo
XORLW d'0' ;Test if division was exact in low byte
BTFSS STATUS,Z
BSF update_flag,4 ;Remainder flag=1
MOVFW old_value_hi
XORLW d'0' ;Test if division was exact in high byte
BTFSS STATUS,Z
BSF update_flag,4
end_div GOTO back_to_equ_function
write_value ;writes value_hi,value_lo to the display
BSF PORTA,0 ;prepare display modules for data transfer
MOVF value_hi, W ;use temp_value to prevent changing value as it will be used in calculations
MOVWF temp_value_hi
MOVF value_lo, W
MOVWF temp_value_lo
CLRF store ;store will count the number of characters already displayed target-6
BTFSS update_flag,4 ;Was division result exact or with a remainder?
GOTO no_remainder
INCF store,F ;Increment number of characters displayed
MOVLW b'10100010' ;Display code for reminder -looks like a r.
MOVWF out_value_lo
CLRF temp ;Temp will count number of bits shifted - target 8 (7 segments + decimal point)
shift_loop_remainder
INCF temp,F ;Increment counter of bits shifted out
BCF PORTA,2 ;Set data pin to 0
BTFSC out_value_lo,0 ;If data pin is meant to be 1
BSF PORTA,2 ;make it 1
BCF PORTA,1 ;raise the clock - shift value
RRF out_value_lo,F ;prepare to shift out next bit
BSF PORTA,1 ;fall the clock
MOVFW temp ;Tests if all 8 bits were shifted out
XORLW d'8'
BTFSS STATUS,Z ;If yes continue to next step
GOTO shift_loop_remainder
no_remainder
CLRF out_value_lo ;out_value will store integer part of division by 10
CLRF out_value_hi ;temp will store remainder of division by 10
write_loop
INCF out_value_lo, F ;counts the number of 10s subtracted
BTFSC STATUS,Z ;carry when counting 10s
INCF out_value_hi, F ;Division ensures no 16bit overflow
MOVLW D'10'
SUBWF temp_value_lo,F ;actually subtracts the 10 from temp
BTFSC STATUS,C ;checks if a borrow occurred
GOTO write_loop ;Subtract another 10
MOVF temp_value_hi,W
BTFSC STATUS,Z ;If all temp_value is <0 division finishes. Must be zero at one point as 10<255
GOTO write_digit_calc ;Process done, move to next step
DECF temp_value_hi,F ;borrow from hi byte
GOTO write_loop ;Subtract another 10
write_digit_calc
MOVLW D'10' ;Compensates for 10 subtracted to make temp_value negative
ADDWF temp_value_lo,F
DECF out_value_lo,F ;Compensates counter for added 10
MOVFW out_value_lo
XORLW d'255' ;check borrow from hi byte
BTFSC STATUS,Z
DECF out_value_hi,F ;Execute borrow from high
INCF store,F ;Tracks number of characters written to display
MOVFW temp_value_lo ;Look up code for calculated character
CALL segment_look ;Access table
MOVWF temp_value_lo
CLRF temp ;Temp will count number of bits shifted - target 8 (7 segments + decimal point)
shift_loop_main
INCF temp,F ;Count number of bits shifted out
BCF PORTA,2 ;Copy temp_value_lo,0 into PORTA,2
BTFSC temp_value_lo,0
BSF PORTA,2
BCF PORTA,1 ;Raise the clock - shift value
RRF temp_value_lo,F ;Prepare next bit in temp_value_lo while waiting for display value
BSF PORTA,1 ;Fall the clock
MOVFW temp ;Test if 8 bits already shifted out
XORLW d'8'
BTFSS STATUS,Z
GOTO shift_loop_main ;If no shift out next bit
BCF update_flag,6 ;Clean bit for temporary bit flag
MOVF out_value_hi,W
MOVWF temp_value_hi ;Copy low byte of integer part of division by 10 for next division
BTFSC STATUS, Z ;If ==0 to copy remember in temporary flag
BSF update_flag,6
MOVF out_value_lo, W
MOVWF temp_value_lo ;Copy hi byte of integer part of division by 10 for next division
BTFSS STATUS, Z ;Test if ==0 for finishing condition
GOTO no_remainder ;Run division loop again
BTFSS update_flag,6 ;If both hi and low byte ==0 continue to next section
GOTO no_remainder ;Run division loop again
BTFSS update_flag,7 ;If minus sign flag clear then
GOTO no_negative ;Don't display a minus
INCF store,F ;Count number of characters written
MOVLW b'00100000' ;Display code for a minus sign -
MOVWF temp_value_lo
CLRF temp ;Temp will count number of bits shifted - target 8 (7 segments + decimal point)
shift_loop_neg
INCF temp,F ;Count number of bits shifted out
BCF PORTA,2 ;Copy temp_value_lo,0 into PORTA,2
BTFSC temp_value_lo,0
BSF PORTA,2
BCF PORTA,1 ;Raise the clock - shift value
RRF temp_value_lo,F ;Prepare next bit in temp_value_lo while waiting for display value
BSF PORTA,1 ;Fall the clock
MOVFW temp ;Test if 8 bits already shifted out
XORLW d'8'
BTFSS STATUS,Z
GOTO shift_loop_neg ;If no shift out next bit
no_negative
BCF update_flag,7 ;Clear minus sign flag
BCF update_flag,4 ;Clear reminder flag
MOVFW store ;Tests if all 6 characters are written to
XORLW d'6'
BTFSC STATUS,Z
RETURN ;If yes: RETURN to CALL point
INCF store,F ;Count number of characters written to display
BCF PORTA,2 ;Shift outs b'00000000' - an empty character
CLRF temp ;Temp will count number of bits shifted - target 8 (7 segments + decimal point)
shift_loop_null
INCF temp,F ;Count number of bits shifted out
BCF PORTA,1 ;Raise the clock - shift value
;Delay not need as display PIC runs with a faster clock speed
BSF PORTA,1 ;Fall the clock
MOVFW temp ;Test if 8 bits already shifted out
XORLW d'8'
BTFSS STATUS,Z
GOTO shift_loop_null ;If no shift out next bit
GOTO no_negative
;Subroutines for handling exceptions in the code
multi_key ;triggers when two buttons are pressed simultaneously and PIC can't distinguish them
BSF PORTA,0 ;Prepare display modules for data
MOVLW b'10001111' ;multi key press code. Two Parallel line followed by a period
MOVWF temp_value_lo
CLRF temp ;Temp will count number of bits shifted - target 8 (7 segments + decimal point)
shift_loop_multi
INCF temp,F ;Count number of bits shifted out
BCF PORTA,2 ;Copy temp_value_lo,0 into PORTA,2
BTFSC temp_value_lo,0
BSF PORTA,2
BCF PORTA,1 ;Raise the clock - shift value
RRF temp_value_lo,F ;Move to next bit in temp_value_lo
BSF PORTA,1 ;Fall the clock
MOVFW temp ;Test if 8 bits already shifted out
XORLW d'8'
BTFSS STATUS,Z
GOTO shift_loop_multi ;If no shift out next bit
GOTO main ;resume normal operation
overflow ;Indicates program encountered a 16bit overflow while preforming large calculation
BSF PORTA,0 ;Prepare display modules for data
MOVLW b'11101010' ;Display a F. symbol to indicate operation Failed
MOVWF temp_value_lo
CLRF temp ;Temp will count number of bits shifted - target 8 (7 segments + decimal point)
shift_loop_overflow
INCF temp,F ;Count number of bits shifted out
BCF PORTA,2 ;Copy temp_value_lo,0 into PORTA,2
BTFSC temp_value_lo,0
BSF PORTA,2
BCF PORTA,1 ;Raise the clock - shift value
RRF temp_value_lo,F ;Move to next bit in temp_value_lo
BSF PORTA,1 ;Fall the clock
MOVFW temp ;Test if 8 bits already shifted out
XORLW d'8'
BTFSS STATUS,Z
GOTO shift_loop_overflow ;If no shift out next bit
GOTO main ;resume normal operation
unexpected_error ;Signifies a unclassified error occurred. EG division by 0
BSF PORTA,0 ;Prepare display modules for data
MOVLW b'11111010' ;Display a E. symbol to indicate and Error
MOVWF temp_value_lo
CLRF temp ;Temp will count number of bits shifted - target 8 (7 segments + decimal point)
shift_loop_error
INCF temp,F ;Count number of bits shifted out
BCF PORTA,2 ;Copy temp_value_lo,0 into PORTA,2
BTFSC temp_value_lo,0
BSF PORTA,2
BCF PORTA,1 ;Raise the clock - shift value
RRF temp_value_lo,F ;Move to next bit in temp_value_lo
BSF PORTA,1 ;Fall the clock
MOVFW temp ;Test if 8 bits already shifted out
XORLW d'8'
BTFSS STATUS,Z
GOTO shift_loop_error ;If no shift out next bit
GOTO main ;resume normal operation
END ;Opcode need for compilation. PIC should never reach this |
Task/Huffman-coding/Ada/huffman-coding-1.ada | LaudateCorpus1/RosettaCodeData | 1 | 154 | with Ada.Containers.Indefinite_Ordered_Maps;
with Ada.Containers.Ordered_Maps;
with Ada.Finalization;
generic
type Symbol_Type is private;
with function "<" (Left, Right : Symbol_Type) return Boolean is <>;
with procedure Put (Item : Symbol_Type);
type Symbol_Sequence is array (Positive range <>) of Symbol_Type;
type Frequency_Type is private;
with function "+" (Left, Right : Frequency_Type) return Frequency_Type
is <>;
with function "<" (Left, Right : Frequency_Type) return Boolean is <>;
package Huffman is
-- bits = booleans (true/false = 1/0)
type Bit_Sequence is array (Positive range <>) of Boolean;
Zero_Sequence : constant Bit_Sequence (1 .. 0) := (others => False);
-- output the sequence
procedure Put (Code : Bit_Sequence);
-- type for freqency map
package Frequency_Maps is new Ada.Containers.Ordered_Maps
(Element_Type => Frequency_Type,
Key_Type => Symbol_Type);
type Huffman_Tree is private;
-- create a huffman tree from frequency map
procedure Create_Tree
(Tree : out Huffman_Tree;
Frequencies : Frequency_Maps.Map);
-- encode a single symbol
function Encode
(Tree : Huffman_Tree;
Symbol : Symbol_Type)
return Bit_Sequence;
-- encode a symbol sequence
function Encode
(Tree : Huffman_Tree;
Symbols : Symbol_Sequence)
return Bit_Sequence;
-- decode a bit sequence
function Decode
(Tree : Huffman_Tree;
Code : Bit_Sequence)
return Symbol_Sequence;
-- dump the encoding table
procedure Dump_Encoding (Tree : Huffman_Tree);
private
-- type for encoding map
package Encoding_Maps is new Ada.Containers.Indefinite_Ordered_Maps
(Element_Type => Bit_Sequence,
Key_Type => Symbol_Type);
type Huffman_Node;
type Node_Access is access Huffman_Node;
-- a node is either internal (left_child/right_child used)
-- or a leaf (left_child/right_child are null)
type Huffman_Node is record
Frequency : Frequency_Type;
Left_Child : Node_Access := null;
Right_Child : Node_Access := null;
Symbol : Symbol_Type;
end record;
-- create a leaf node
function Create_Node
(Symbol : Symbol_Type;
Frequency : Frequency_Type)
return Node_Access;
-- create an internal node
function Create_Node (Left, Right : Node_Access) return Node_Access;
-- fill the encoding map
procedure Fill
(The_Node : Node_Access;
Map : in out Encoding_Maps.Map;
Prefix : Bit_Sequence);
-- huffman tree has a tree and an encoding map
type Huffman_Tree is new Ada.Finalization.Controlled with record
Tree : Node_Access := null;
Map : Encoding_Maps.Map := Encoding_Maps.Empty_Map;
end record;
-- free memory after finalization
overriding procedure Finalize (Object : in out Huffman_Tree);
end Huffman;
|
oeis/325/A325596.asm | neoneye/loda-programs | 11 | 24795 | <gh_stars>10-100
; A325596: a(n) = Sum_{d|n} mu(n/d) * (-1)^(d + 1) * d.
; Submitted by <NAME>(s4)
; 1,-3,2,-2,4,-6,6,-4,6,-12,10,-4,12,-18,8,-8,16,-18,18,-8,12,-30,22,-8,20,-36,18,-12,28,-24,30,-16,20,-48,24,-12,36,-54,24,-16,40,-36,42,-20,24,-66,46,-16,42,-60,32,-24,52,-54,40,-24,36,-84,58,-16,60,-90,36,-32,48
mov $1,$0
seq $0,10 ; Euler totient function phi(n): count numbers <= n and prime to n.
seq $1,319998 ; a(n) = Sum_{d|n, d is even} mu(n/d)*d, where mu(n) is Moebius function A008683.
mul $1,2
sub $0,$1
|
base/Kernel/Native/arm/Crt/memcpy.asm | sphinxlogic/Singularity-RDK-2.0 | 0 | 176169 | <reponame>sphinxlogic/Singularity-RDK-2.0<filename>base/Kernel/Native/arm/Crt/memcpy.asm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Microsoft Research Singularity
;;;
;;; Copyright (c) Microsoft Corporation. All rights reserved.
;;;
;;; This file contains ARM-specific assembly code.
;;;
;**********************************************************************
; void *
; memcpy( void *dest, const void *src, size_t count );
; The memcpy function copies count bytes of src to dest.
; If the source and destination overlap, this function does
; not ensure that the original source bytes in the overlapping
; region are copied before being overwritten. Use memmove to
; handle overlapping regions.
;
;**********************************************************************
OPT 2 ; disable listing
INCLUDE kxarm.inc
OPT 1 ; reenable listing
dest RN R0
source RN R1
count RN R2
temp1 RN R3
temp2 RN R4
temp3 RN R5
temp4 RN R12
IF Thumbing
THUMBAREA
ENDIF
NESTED_ENTRY memcpy
ROUT
IF Thumbing
; Switch from Thumb mode to ARM mode
DCW 0x4778 ; bx pc
DCW 0x46C0 ; nop
ENDIF
;//Save registers onto the stack
STMDB sp!, {dest,temp2,temp3,lr} ; save registers
PROLOG_END
; Use a threshold to determine which code to use:
;
; if destination & source are naturally aligned, then
; threshold = 512
; else
; threshold = 128
;
; if copy size > threshold, then
; use memcpybigblk
; else
; use .NET code
ORR temp1, dest, source
TST temp1, #3
MOVEQ temp1, #512
MOVNE temp1, #128
CMP count, temp1
BHI UNDO_PROLOG ; revert and continue to memcpybigblk
; NOTE: UNDO_PROLOG just restores SP, so do NOT modify anything other
; than r3 (temp1) and r12 (temp4) before this point
;**********************************************************************
; Copy from head to tail to avoid source overwrite because the source
; destination the source
;**********************************************************************
HEAD_TO_TAIL
;if LT 8 bytes store them and exit
CMP count, #8 ; 2-3 cycles
BLT BYTEMOVE4
;Check alignment of parameters
ANDS temp1, dest, #3 ; 2-3 cycles
BEQ SRCALIGN
; destination is at least 1 byte misaligned
; Read and write (4 - alignment) bytes to align destination.
RSB temp1, temp1, #4 ; 9 cycles
LDRB temp2, [source], #1
CMP temp1, #2
STRB temp2, [dest], #1
LDRGEB temp3, [source], #1 ; >= 2 == at least 2 bytes
LDRGTB temp2, [source], #1 ; > 2 == 3 bytes unaligned
SUB count, count, temp1
STRGEB temp3, [dest], #1
STRGTB temp2, [dest], #1
SRCALIGN ; 3 - 7 cycles
TST source, #1 ; save alignment of src
BNE UNALIGNED ; src 3 byte unaligned.
TST source, #2
BNE HWORDMOVE ; src and dst are hword aligned
;
;word aligned source and destination, move blocks of 32 bytes
;until we have less than 32 bytes left, then divide moves in
;half down to less than 4, where we will move the last 3 or less
;bytes
;
WORDMOVE
SUBS count, count, #32 ; 2-3 cycles
BLT BLK16
BLK32 ; 20 cycles/32 bytes
LDMIA source!, {temp1,temp2,temp3,lr}
STMIA dest!, {temp1,temp2,temp3,lr}
LDMIA source!, {temp1,temp2,temp3,lr}
SUBS count, count, #32
STMIA dest!, {temp1,temp2,temp3,lr}
BGE BLK32
BLK16 ; 11-4 cycles/16 bytes
ADDS count, count, #16
LDMGEIA source!, {temp1, temp2, temp3, lr}
STMGEIA dest!, {temp1, temp2, temp3, lr}
BEQ WORD_BYTES_EXIT
SUBGTS count, count, #16
BLK8 ; 6 cycles/8 bytes
ADDS count, count, #8
LDMGEIA source!, {temp1, temp2}
SUBGE count, count, #8
STMGEIA dest!, {temp1, temp2}
BLK4
ADDS count, count, #4 ; 6-9 cycles/4 bytes
LDRGE temp1, [source], #4
STRGE temp1, [dest], #4
WORD_BYTES
ADDLTS count, count, #4
BEQ WORD_BYTES_EXIT ; On zero, Return to caller
LDR temp1, [source], #4 ; 10 cycles/1-3 bytes
CMP count, #2
STRGEH temp1, [dest], #2
STRLTB temp1, [dest], #1
MOVGT temp1, temp1, LSR #16
STRGTB temp1, [dest], #1
WORD_BYTES_EXIT
IF Interworking :LOR: Thumbing
LDMIA sp!, {dest, temp2, temp3, lr}
BX lr
ELSE
LDMIA sp!, {dest, temp2, temp3, pc}
ENDIF
;
; half word align source and destination
;
HWORDMOVE ; 2-3 cycles
LDRH temp1, [source], #2
SUBS count, count, #32
BLT HWORD8_TST
HWORD32 ; 35 cycles/32 bytes
LDMIA source!, {temp2,temp3,temp4,lr}
ORR temp1, temp1, temp2, LSL #16
MOV temp2, temp2, LSR #16
ORR temp2, temp2, temp3, LSL #16
MOV temp3, temp3, LSR #16
ORR temp3, temp3, temp4, LSL #16
MOV temp4, temp4, LSR #16
ORR temp4, temp4, lr, LSL #16
STMIA dest!, {temp1,temp2,temp3,temp4} ; Store bytes 1-16
MOV temp1, lr, LSR #16
LDMIA source!, {temp2,temp3,temp4,lr}
ORR temp1, temp1, temp2, LSL #16
MOV temp2, temp2, LSR #16
ORR temp2, temp2, temp3, LSL #16
MOV temp3, temp3, LSR #16
ORR temp3, temp3, temp4, LSL #16
MOV temp4, temp4, LSR #16
ORR temp4, temp4, lr, LSL #16
STMIA dest!, {temp1,temp2,temp3,temp4} ; Store bytes 17-32
SUBS count, count, #32
MOV temp1, lr, LSR #16
BGE HWORD32
HWORD8_TST
ADDS count, count, #24
BLT HWORD4
HWORD8 ; 11 cycles/8 bytes
LDMIA source!, {temp2,temp3}
ORR temp1, temp1, temp2, LSL #16
MOV temp2, temp2, LSR #16
ORR temp2, temp2, temp3, LSL #16
STMIA dest!, {temp1, temp2}
SUBS count, count, #8
MOV temp1, temp3, LSR #16
BGE HWORD8
HWORD4 ; 3-7 cycles/4 bytes
ADDS count, count, #4
BLT HWORD_BYTES
LDR temp2, [source], #4
ORR temp1, temp1, temp2, LSL #16
STR temp1, [dest], #4
MOV temp1, temp2, LSR #16
HWORD_BYTES ; 5-11 cycles/1-3 bytes
ADDLTS count, count, #4
BEQ HWORD_BYTES_EXIT ; On zero, Return to caller
CMP count, #2
STRLTB temp1, [dest], #1
LDRGTB temp2, [source], #1
STRGEH temp1, [dest], #2
STRGTB temp2, [dest], #1
HWORD_BYTES_EXIT
IF Interworking :LOR: Thumbing
LDMIA sp!, {dest, temp2, temp3, lr}
BX lr
ELSE
LDMIA sp!, {dest, temp2, temp3, pc}
ENDIF
;
; Unaligned Moves
;
UNALIGNED
TST source, #2
BEQ UNALIGNED1
UNALIGNED3 ; 3-4 cycles
LDRB temp1, [source], #1
SUBS count, count, #32
BLT OFFTHREE8_TST
OFFTHREE32 ; 35 cycles/32 bytes
LDMIA source!, {temp2,temp3,temp4,lr}
ORR temp1, temp1, temp2, LSL #8
MOV temp2, temp2, LSR #24
ORR temp2, temp2, temp3, LSL #8
MOV temp3, temp3, LSR #24
ORR temp3, temp3, temp4, LSL #8
MOV temp4, temp4, LSR #24
ORR temp4, temp4, lr, LSL #8
STMIA dest!, {temp1,temp2,temp3,temp4} ; Store bytes 1-16
MOV temp1, lr, LSR #24
LDMIA source!, {temp2,temp3,temp4,lr}
ORR temp1, temp1, temp2, LSL #8
MOV temp2, temp2, LSR #24
ORR temp2, temp2, temp3, LSL #8
MOV temp3, temp3, LSR #24
ORR temp3, temp3, temp4, LSL #8
MOV temp4, temp4, LSR #24
ORR temp4, temp4, lr, LSL #8
STMIA dest!, {temp1,temp2,temp3,temp4} ; Store bytes 17-32
SUBS count, count, #32
MOV temp1, lr, LSR #24
BGE OFFTHREE32
OFFTHREE8_TST
ADDS count, count, #24
BLT OFFTHREE4
OFFTHREE8 ; 11 cycles/8 bytes
LDMIA source!, {temp2,temp3}
ORR temp1, temp1, temp2, LSL #8
MOV temp2, temp2, LSR #24
ORR temp2, temp2, temp3, LSL #8
STMIA dest!, {temp1, temp2}
SUBS count, count, #8
MOV temp1, temp3, LSR #24
BGE OFFTHREE8
OFFTHREE4 ; 3-7 cycles/4 bytes
ADDS count, count, #4
BLT OFFTHREE_BYTES
LDR temp2, [source], #4
ORR temp1, temp1, temp2, LSL #8
STR temp1, [dest], #4
MOV temp1, temp2, LSR #24
OFFTHREE_BYTES ; 5-12 cycles/ 1-3 bytes
ADDLTS count, count, #4
BEQ OFFTHREE_EXIT ; On zero, Return to caller
CMP count, #2
LDRGEH temp2, [source], #2
STRB temp1, [dest], #1
STRGEB temp2, [dest], #1
MOVGT temp2, temp2, LSR #8
STRGTB temp2, [dest], #1
OFFTHREE_EXIT
IF Interworking :LOR: Thumbing
LDMIA sp!, {dest, temp2, temp3, lr}
BX lr
ELSE
LDMIA sp!, {dest, temp2, temp3, pc} ; On zero, Return to caller
ENDIF
;
; Source is one byte from word alignment.
; Read a byte & half word then multiple words and a byte. Then
; shift and ORR them into consecutive words for STM writes
UNALIGNED1 ; 5-6 cycles
LDRB temp1, [source], #1
LDRH temp2, [source], #2
SUBS count, count, #32
ORR temp1, temp1, temp2, LSL #8
BLT OFFONE8_TST
OFFONE32 ; 35 cycles/32 bytes
LDMIA source!, {temp2, temp3, temp4, lr}
ORR temp1, temp1, temp2, LSL #24
MOV temp2, temp2, LSR #8
ORR temp2, temp2, temp3, LSL #24
MOV temp3, temp3, LSR #8
ORR temp3, temp3, temp4, LSL #24
MOV temp4, temp4, LSR #8
ORR temp4, temp4, lr, LSL #24
STMIA dest!, {temp1,temp2,temp3,temp4} ; Store bytes 1-16
MOV temp1, lr, LSR #8
LDMIA source!, {temp2,temp3,temp4,lr}
ORR temp1, temp1, temp2, LSL #24
MOV temp2, temp2, LSR #8
ORR temp2, temp2, temp3, LSL #24
MOV temp3, temp3, LSR #8
ORR temp3, temp3, temp4, LSL #24
MOV temp4, temp4, LSR #8
ORR temp4, temp4, lr, LSL #24
STMIA dest!, {temp1,temp2,temp3,temp4} ; Store bytes 17-32
SUBS count, count, #32
MOV temp1, lr, LSR #8
BGE OFFONE32
OFFONE8_TST
ADDS count, count, #24
BLT OFFONE4
OFFONE8 ; 11 cycles/8 bytes
LDMIA source!, {temp2,temp3}
ORR temp1, temp1, temp2, LSL #24
MOV temp2, temp2, LSR #8
ORR temp2, temp2, temp3, LSL #24
STMIA dest!, {temp1,temp2}
SUBS count, count, #8
MOV temp1, temp3, LSR #8
BGE OFFONE8
OFFONE4 ; 3-9 cycles/4 bytes
ADDS count, count, #4
BLT OFFONE_BYTES
LDR temp2, [source], #4
ORR temp1, temp1, temp2, LSL #24
STR temp1, [dest], #4
BEQ OFFONE_EXIT
MOV temp1, temp2, LSR #8
OFFONE_BYTES ; 11 cycles/1-3 bytes
ADDLTS count, count, #4
BEQ OFFONE_EXIT
CMP count, #2
STRLTB temp1, [dest], #1
STRGEH temp1, [dest], #2
MOVGT temp1, temp1, LSR #16
STRGTB temp1, [dest], #1
OFFONE_EXIT
IF Interworking :LOR: Thumbing
LDMIA sp!, {dest, temp2, temp3, lr}
BX lr
ELSE
LDMIA sp!, {dest, temp2, temp3, pc} ; Return to caller
ENDIF
BYTEMOVE4 ; 12 cycles/4 bytes
CMP count, #4
BLT MMOVEXIT
LDRB temp1, [source], #1
SUB count, count, #4
LDRB temp2, [source], #1
LDRB temp3, [source], #1
LDRB lr, [source], #1
STRB temp1, [dest], #1
STRB temp2, [dest], #1
STRB temp3, [dest], #1
STRB lr, [dest], #1
MMOVEXIT ; 2-5 cycles
CMP count, #0
IF Interworking :LOR: Thumbing
LDMEQIA sp!, {dest, temp2, temp3, lr}
BXEQ lr
ELSE
LDMEQIA sp!, {dest, temp2, temp3, pc} ; On zero, Return to caller
ENDIF
;
; Store last 3 or so bytes and exit
;
BYTEMOVE ; 4-7 cycles/1 byte
LDRB temp1, [source], #1
CMP count, #2
STRB temp1, [dest], #1
BLT BYTEMOVE_EXIT
LDRGEB temp2, [source], #1 ; 8 cycles/1-2 bytes
LDRGTB temp3, [source], #1
STRGEB temp2, [dest], #1
STRGTB temp3, [dest], #1
BYTEMOVE_EXIT
IF Interworking :LOR: Thumbing
LDMIA sp!, {dest, temp2, temp3, lr}
BX lr
ELSE
LDMIA sp!, {dest, temp2, temp3, pc} ; Return to caller
ENDIF
; THIS IS NOT A RETURN
; The following reverts the stack to its state at the point of entry
; of memcpy. It then falls through to memcpybigblk to perform the
; large copy
UNDO_PROLOG
ADD sp, sp, #0x10
;
; FALLTHRU
;
ENTRY_END memcpy
NESTED_ENTRY memcpybigblk
ROUT
;//Save registers onto the stack
;//R3 should be OK to destroy. If not, we stack it off too.
stmfd sp!, {r0,r4-r11, lr}
PROLOG_END
prefetch_setup
;//Prefetch the source.
;//Have to align source register with word boundary first
mov r5, r1
and r5, r5, #~0x3
;//The PLD instruction just happens to be a Never Execute on ARM V4,
;//so we can in-line the PLD instruction and still maintain V4 compatibility
;// 0x0000000c: f5d5f000 .... PLD [r5,#0]
;// 0x00000010: f5d5f020 ... PLD [r5,#0x20]
;// 0x00000014: f5d5f040 @... PLD [r5,#0x40]
DCD 0xf5d5f000
DCD 0xf5d5f020
DCD 0xf5d5f040
;//If there are 4 or less bytes to copy, we just jump to the end
;//and do a straight byte copy.
cmp r2, #4
bls finish
;//Align the destination to a word boundary.
rsb r4, r0, #0 ;//Figure out how many bytes
ands r4, r4, #0x2 ;//See if we need to do 2 copies
ldrneb r5, [r1], #1 ;//Read the two bytes
ldrneb r6, [r1], #1
subne r2, r2, #2 ;//Decrement count by 2
strneb r5, [r0], #1 ;//Now store the two bytes
strneb r6, [r0], #1 ;//Have to do two seperate byte stores
;//because of possible address misalignment
ands r4, r0, #0x1 ;//See if we need to do 1 copy
ldrneb r5, [r1], #1 ;//Load the single byte
subne r2, r2, #1 ;//Decrement count by 1
strneb r5, [r0], #1 ;//Store the single byte
;//We need to choose which memcpy we use based
;//on how the source is now aligned. If the destination and source
;//are both aligned, then we fall through to the aligned copy
;//Check the byte alignment of the source
;//We do it in reverse order just because. If most memcopies are
;//expected to be off by a certain #, that should be placed first.
and r3, r1, #3
cmp r3, #3 ;//If both bits are set, go do case 3, off by 3 bytes
beq memcpyoffby3 ;//Goto case 3
cmp r3, #2 ;//Check for case 2, off by 2 bytes
beq memcpyoffby2 ;//Goto case 2
cmp r3, #1 ;//Check for case 1, off by 1 byte
beq memcpyoffby1 ;//Goto case 1
;//The source and destination are word aligned. We get an easy job.
memcpyoffby0
;//Now we need to align the destination to a cache line boundary
;//We need to figure out how many words are needed to align it.
;//If the number of words to align it are less than the number of words
;//we're asked to copy, just copy the required number of words.
and r4, r0, #0x1C ;//Grab the low bits of the destination
rsb r4, r4, #32 ;//Negate them and
;//add 32 to the low bits(this is
;//how many we need to move to get aligned)
and r5, r2, #0x1C ;//Check only the number of words from count
cmp r4, r2 ;//Compare low bits to align against the words from count
movhi r4, r5 ;//If words to align is greater than the count, then
;//use the words from count instead
cmp r4, #0
beq offby0mainloop
;//r4 now contains the number of times we need to do a word load/store
;//So we need to sortof back-calculate how many of the word load/stores to
;//skip in memcpyoffby0cachelinealignload/store
rsb r3, r4, #32
and r3, r3, #0x1C
;//r3 now contains the number of *instructions* to skip over.
;//Deduct words from size
sub r2, r2, r4
;//Because the & 0x1C corresponds to words, we don't have to shift anything
;//when we jump into load table
;//Using two jump tables is faster because it gives the processor a chance to load
;//data before we try to store it out.
adr r12, offby0cachelinealignload
add pc, r12, r3
offby0cachelinealignload ;//Need to have up to 8 words (1 cache line)
ldr r4, [r1], #4 ;//Could also do load/store pairs, and shift
ldr r5, [r1], #4 ;//r3 left 1 bit to calculate jump address
ldr r6, [r1], #4
ldr r7, [r1], #4
ldr r8, [r1], #4
ldr r9, [r1], #4
ldr r10,[r1], #4
ldr r11,[r1], #4
;//Now jump into the store table
adr r12, offby0cachelinealignstore
add pc, r12, r3
offby0cachelinealignstore
str r4, [r0], #4
str r5, [r0], #4
str r6, [r0], #4
str r7, [r0], #4
str r8, [r0], #4
str r9, [r0], #4
str r10,[r0], #4
str r11,[r0], #4
;//We are now cache line aligned.
;//We loop around doing prefetches and copies based on how far ahead we want to look
offby0mainloop
cmp r2, #(32*3 + 32) ;//Only keep looking ahead by 4 cache lines
bmi offby0endofmainloop
;//Preload the data
;// 0x000000f4: f5d1f060 `... PLD [r1,#0x60]
;// 0x000000f8: f5d1f080 .... PLD [r1,#0x80]
DCD 0xf5d1f060
DCD 0xf5d1f080
;//Here is the main loop that handles pipelining the loads
ldmia r1!, {r4-r11}
stmia r0!, {r4-r11}
ldmia r1!, {r4-r11}
stmia r0!, {r4-r11}
sub r2, r2, #64 ;//Take 64 bytes off of count
b offby0mainloop
offby0endofmainloop
;//If we still have more than 32*4 words to move, do one more preload
cmp r2, #32*4
bls offby0nopreload
;// 0x0000011c: f5d1f080 .... PLD [r1,#0x80]
DCD 0xf5d1f080
offby0nopreload
;//Now we finish up the copy without any preloads. The data should have already
;//been loaded into the caches
;//Copy 32 bytes at a time
offby0finishcachelines
cmp r2, #32
bmi offby0endoffinishcachelines
ldmia r1!, {r4-r11}
stmia r0!, {r4-r11}
sub r2, r2, #32 ;//Take 32 bytes off of count
b offby0finishcachelines
offby0endoffinishcachelines
;//Now we need to finish off any partial cache lines that may be left. We do a similar
;//algorithm to the cachelinealign loop above.
ands r3, r2, #0x1C ;//Get number of words left
beq finish ;//If words left==0, then branch to finish
sub r2, r2, r3 ;//Subtract words left from count
rsb r3, r3, #32 ;//Get 32-number of words left
adr r12, offby0finishload ;//That's the instructions to skip
add pc, r12, r3
offby0finishload ;//Need to have up to 8 words (1 cache line)
ldr r4, [r1], #4 ;//Could also do load/store pairs, and shift
ldr r5, [r1], #4 ;//r3 left 1 bit to calculate jump address
ldr r6, [r1], #4
ldr r7, [r1], #4
ldr r8, [r1], #4
ldr r9, [r1], #4
ldr r10,[r1], #4
ldr r11,[r1], #4
;//Now jump into the store table
adr r12, offby0finishstore
add pc, r12, r3
offby0finishstore
str r4, [r0], #4
str r5, [r0], #4
str r6, [r0], #4
str r7, [r0], #4
str r8, [r0], #4
str r9, [r0], #4
str r10,[r0], #4
str r11,[r0], #4
;//Copy the last 4 bytes, if necessary
rsb r2, r2, #4 ;//Find how many bytes to copy (0, 1,2,3, or 4)
adr r12, finishloadby0
add pc, r12, r2, LSL #2 ;//Need to shift r2 left by 2 bits to jump instructions
finishloadby0
ldrb r3, [r1], #1
ldrb r4, [r1], #1
ldrb r5, [r1], #1
ldrb r6, [r1], #1
adr r12, finishstoreby0
add pc, r12, r2, LSL #2
finishstoreby0
strb r3, [r0], #1
strb r4, [r0], #1
strb r5, [r0], #1
strb r6, [r0], #1
;//Return to calling function
IF Interworking :LOR: Thumbing
ldmfd sp!, {r0,r4-r11, lr}
bx lr
ELSE
ldmfd sp!, {r0,r4-r11, pc}
ENDIF
;//The source and destination are not aligned. We're going to have
;//to load and shift data from a temporary buffer. Stuff needs to be
;//shifted to the right by 8 bits to align properly
memcpyoffby1
;//First we need to word align the source
and r3, r1, #~0x3
;//Load the first value into the holding buffer (lr)
ldr lr, [r3], #4
mov lr, lr, LSR #8
;//Now we need to align the destination to a cache line boundary
;//We need to figure out how many words are needed to align it.
;//If the number of words to align it are less than the number of words
;//we're asked to copy, just copy the required number of words.
and r4, r0, #0x1C ;//Grab the low bits of the destination
rsb r4, r4, #32 ;//Negate them
;//Add 32 to the low bits(this is
;//how many we need to move to get aligned)
and r5, r2, #0x1C ;//Check only the number of words from count
cmp r4, r2 ;//Compare low bits to align against the words from count
movhi r4, r5 ;//If words to align is greater than the count, then
;//use the words from count instead
cmp r4, #0
beq offby1mainloop
;//r4 now contains the number of times we need to do a word load/store
;//So we need to sortof back-calculate how many of the word load/stores to
;//skip in memcpyoffby1cachelinealignload
rsb r6, r4, #32
and r6, r6, #0x1C
;//r3 now contains the number of *words* to skip over.
;//Deduct words from size
sub r2, r2, r4
;//Because the & 0x1C corresponds to words, we DO need to shift this time around
;//when we jump into load table
adr r12, offby1cachelinealignload
add pc, r12, r6, LSL #2 ;//Allows 4 instructions per byteblit
;//Because there is no convenient way to split the load/store into multiples of 2
;//unless we keep them together, for misaligned data we leave them together.
offby1cachelinealignload ;//Need to have up to 8 words (1 cache line)
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
;//We are now cache line aligned.
;//We loop around doing prefetches and copies based on how far ahead we want to look
offby1mainloop
cmp r2, #(32*4 + 32) ;//Only keep looking ahead by 4 cache lines
bmi offby1endofmainloop
;//Preload
;// 0x00000264: f5d3f060 `... PLD [r3,#0x60]
;// 0x00000268: f5d3f080 .... PLD [r3,#0x80]
DCD 0xf5d3f060
DCD 0xf5d3f080
;//Here is the main loop that handles pipelining the loads for off by 1
ldmia r3!, {r4, r5, r6, r7, r8, r9, r10, r11}
orr r1,lr, r4, LSL #24
mov lr, r4, LSR #8
orr r4, lr, r5, LSL #24
mov lr, r5, LSR #8
orr r5, lr, r6, LSL #24
mov lr, r6, LSR #8
orr r6, lr, r7, LSL #24
mov lr, r7, LSR #8
orr r7, lr, r8, LSL #24
mov lr, r8, LSR #8
orr r8, lr, r9, LSL #24
mov lr, r9, LSR #8
orr r9, lr, r10, LSL #24
mov lr, r10, LSR #8
orr r10, lr, r11, LSL #24
mov lr, r11, LSR #8
stmia r0!, {r1, r4, r5, r6, r7, r8, r9, r10}
ldmia r3!, {r4, r5, r6, r7, r8, r9, r10, r11}
orr r1,lr, r4, LSL #24
mov lr, r4, LSR #8
orr r4, lr, r5, LSL #24
mov lr, r5, LSR #8
orr r5, lr, r6, LSL #24
mov lr, r6, LSR #8
orr r6, lr, r7, LSL #24
mov lr, r7, LSR #8
orr r7, lr, r8, LSL #24
mov lr, r8, LSR #8
orr r8, lr, r9, LSL #24
mov lr, r9, LSR #8
orr r9, lr, r10, LSL #24
mov lr, r10, LSR #8
orr r10, lr, r11, LSL #24
mov lr, r11, LSR #8
stmia r0!, {r1, r4, r5, r6, r7, r8, r9, r10}
sub r2, r2, #64 ;//Take 64 bytes off of count
b offby1mainloop
offby1endofmainloop
;//If we still have more than 32*4 words to move, do one more preload
cmp r2, #32*4
bls offby1nopreload
;// 0x00000338: f5d3f080 .... PLD [r3,#0x80]
DCD 0xf5d3f080
offby1nopreload
;//Now we finish up the copy without any preloads. The data should have alread
;//been loaded into the caches
;//Copy 32 bytes at a time
offby1finishcachelines
cmp r2, #32
bmi offby1endoffinishcachelines
ldmia r3!, {r4, r5, r6, r7, r8, r9, r10, r11}
orr r1,lr, r4, LSL #24
mov lr, r4, LSR #8
orr r4, lr, r5, LSL #24
mov lr, r5, LSR #8
orr r5, lr, r6, LSL #24
mov lr, r6, LSR #8
orr r6, lr, r7, LSL #24
mov lr, r7, LSR #8
orr r7, lr, r8, LSL #24
mov lr, r8, LSR #8
orr r8, lr, r9, LSL #24
mov lr, r9, LSR #8
orr r9, lr, r10, LSL #24
mov lr, r10, LSR #8
orr r10, lr, r11, LSL #24
mov lr, r11, LSR #8
stmia r0!, {r1, r4, r5, r6, r7, r8, r9, r10}
sub r2, r2, #32 ;//Take 32 bytes off of count
b offby1finishcachelines
offby1endoffinishcachelines
;//Now we need to finish off any partial cache lines that may be left. We do a similar
;//algorithm to the cachelinealign loop above.
ands r6, r2, #0x1C ;//Get number of words left
subeq r1, r3, #3 ;//Realign source on exact byte if need to branch
beq finish ;//If words left==0, then branch to finish
sub r2, r2, r6 ;//Subtract words left from count
rsb r6, r6, #32 ;//Get 32-number of words left
adr r12, offby1finishload ;//That's the copies to skip
add pc, r12, r6, LSL #2 ;//..but need to multiply by 4 to get instructions
offby1finishload ;//Need to have up to 8 words (1 cache line)
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
ldr r4, [r3], #4
orr r12,lr, r4, LSL #24
str r12,[r0], #4
mov lr, r4, LSR #8
sub r1, r3, #3 ;//Realign source on exact byte
;//Copy the last 4 bytes, if necessary
rsb r2, r2, #4 ;//Find how many bytes to copy (1,2,3, or 4)
adr r12, finishloadby1
add pc, r12, r2, LSL #2 ;//Need to shift r2 left by 2 bits to jump instructions
finishloadby1
ldrb r3, [r1], #1
ldrb r4, [r1], #1
ldrb r5, [r1], #1
ldrb r6, [r1], #1
adr r12, finishstoreby1
add pc, r12, r2, LSL #2
finishstoreby1
strb r3, [r0], #1
strb r4, [r0], #1
strb r5, [r0], #1
strb r6, [r0], #1
;//Return to calling function
IF Interworking :LOR: Thumbing
ldmfd sp!, {r0,r4-r11, lr}
bx lr
ELSE
ldmfd sp!, {r0,r4-r11, pc}
ENDIF
;//The source and destination are not aligned. We're going to have to load
;//and shift data from a temporary buffer. Stuff needs to be shifted to the
;//right by 16 bits to align properly
memcpyoffby2
;//First we need to word align the source
and r3, r1, #~0x3
;//Load the first value into the holding buffer (lr)
ldr lr, [r3], #4
mov lr, lr, LSR #16
;//Now we need to align the destination to a cache line boundary
;//We need to figure out how many words are needed to align it.
;//If the number of words to align it are less than the number of words
;//we're asked to copy, just copy the required number of words.
and r4, r0, #0x1C ;//Grab the low bits of the destination
rsb r4, r4, #32 ;//Negate them
;//Add 32 to the low bits(this is
;//how many we need to move to get aligned)
and r5, r2, #0x1C ;//Check only the number of words from count
cmp r4, r2 ;//Compare low bits to align against the words from count
movhi r4, r5 ;//If words to align is greater than the count, then
;//use the words from count instead
cmp r4, #0
beq offby2mainloop
;//r4 now contains the number of times we need to do a word load/store
;//So we need to sortof back-calculate how many of the word load/stores to
;//skip in memcpyoffby2cachelinealignload
rsb r6, r4, #32
and r6, r6, #0x1C
;//r3 now contains the number of *words* to skip over.
;//Deduct words from size
sub r2, r2, r4
;//Because the & 0x1C corresponds to words, we DO need to shift this time around
;//when we jump into load table
adr r12, offby2cachelinealignload
add pc, r12, r6, LSL #2 ;//Allows 4 instructions per byteblit
;//Because there is no convenient way to split the load/store into multiples of 2
;//unless we keep them together, for misaligned data we leave them together.
offby2cachelinealignload ;//Need to have up to 8 words (1 cache line)
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
;//So in theory we should now be cache line aligned.
;//We loop around doing prefetches and copies based on how far ahead we want to look
offby2mainloop
cmp r2, #(32*4 + 32) ;//Only keep looking ahead by 4 cache lines
bmi offby2endofmainloop
;//Preload
;// 0x00000514: f5d3f060 `... PLD [r3,#0x60]
;// 0x00000518: f5d3f080 .... PLD [r3,#0x80]
DCD 0xf5d3f060
DCD 0xf5d3f080
;//Here is the main loop that handles pipelining the loads for off by 2
ldmia r3!, {r4, r5, r6, r7, r8, r9, r10, r11}
orr r1,lr, r4, LSL #16
mov lr, r4, LSR #16
orr r4, lr, r5, LSL #16
mov lr, r5, LSR #16
orr r5, lr, r6, LSL #16
mov lr, r6, LSR #16
orr r6, lr, r7, LSL #16
mov lr, r7, LSR #16
orr r7, lr, r8, LSL #16
mov lr, r8, LSR #16
orr r8, lr, r9, LSL #16
mov lr, r9, LSR #16
orr r9, lr, r10, LSL #16
mov lr, r10, LSR #16
orr r10, lr, r11, LSL #16
mov lr, r11, LSR #16
stmia r0!, {r1, r4, r5, r6, r7, r8, r9, r10}
ldmia r3!, {r4, r5, r6, r7, r8, r9, r10, r11}
orr r1,lr, r4, LSL #16
mov lr, r4, LSR #16
orr r4, lr, r5, LSL #16
mov lr, r5, LSR #16
orr r5, lr, r6, LSL #16
mov lr, r6, LSR #16
orr r6, lr, r7, LSL #16
mov lr, r7, LSR #16
orr r7, lr, r8, LSL #16
mov lr, r8, LSR #16
orr r8, lr, r9, LSL #16
mov lr, r9, LSR #16
orr r9, lr, r10, LSL #16
mov lr, r10, LSR #16
orr r10, lr, r11, LSL #16
mov lr, r11, LSR #16
stmia r0!, {r1, r4, r5, r6, r7, r8, r9, r10}
sub r2, r2, #64 ;//Take 64 bytes off of count
b offby2mainloop
offby2endofmainloop
;//If we still have more than 32*4 words to move, do one more preload
cmp r2, #32*4
bls offby2nopreload
;// 0x000005e8: f5d3f080 .... PLD [r3,#0x80]
DCD 0xf5d3f080
offby2nopreload
;//Now we finish up the copy without any preloads. The data should have already
;//been loaded into the caches
;//Copy 32 bytes at a time
offby2finishcachelines
cmp r2, #32
bmi offby2endoffinishcachelines
ldmia r3!, {r4, r5, r6, r7, r8, r9, r10, r11}
orr r1,lr, r4, LSL #16
mov lr, r4, LSR #16
orr r4, lr, r5, LSL #16
mov lr, r5, LSR #16
orr r5, lr, r6, LSL #16
mov lr, r6, LSR #16
orr r6, lr, r7, LSL #16
mov lr, r7, LSR #16
orr r7, lr, r8, LSL #16
mov lr, r8, LSR #16
orr r8, lr, r9, LSL #16
mov lr, r9, LSR #16
orr r9, lr, r10, LSL #16
mov lr, r10, LSR #16
orr r10, lr, r11, LSL #16
mov lr, r11, LSR #16
stmia r0!, {r1, r4, r5, r6, r7, r8, r9, r10}
sub r2, r2, #32 ;//Take 32 bytes off of count
b offby2finishcachelines
offby2endoffinishcachelines
;//Now we need to finish off any partial cache lines that may be left. We do a similar
;//algorithm to the cachelinealign loop above.
ands r6, r2, #0x1C ;//Get number of words left
subeq r1, r3, #2 ;//Realign source on exact byte if need to branch
beq finish ;//If words left==0, then branch to finish
sub r2, r2, r6 ;//Subtract words left from count
rsb r6, r6, #32 ;//Get 32-number of words left
adr r12, offby2finishload ;//That's the copies to skip
add pc, r12, r6, LSL #2 ;//..but need to multiply by 4 to get instructions
offby2finishload ;//Need to have up to 8 words (1 cache line)
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
ldr r4, [r3], #4
orr r12,lr, r4, LSL #16
str r12,[r0], #4
mov lr, r4, LSR #16
sub r1, r3, #2 ;//Realign source on exact byte
;//Copy the last 4 bytes, if necessary
rsb r2, r2, #4 ;//Find how many bytes to copy (1,2,3, or 4)
adr r12, finishloadby2
add pc, r12, r2, LSL #2 ;//Need to shift r2 left by 2 bits to jump instructions
finishloadby2
ldrb r3, [r1], #1
ldrb r4, [r1], #1
ldrb r5, [r1], #1
ldrb r6, [r1], #1
adr r12, finishstoreby2
add pc, r12, r2, LSL #2
finishstoreby2
strb r3, [r0], #1
strb r4, [r0], #1
strb r5, [r0], #1
strb r6, [r0], #1
;//Return to calling function
IF Interworking :LOR: Thumbing
ldmfd sp!, {r0,r4-r11, lr}
bx lr
ELSE
ldmfd sp!, {r0,r4-r11, pc}
ENDIF
;//The source and destination are not aligned. We're going to have to load
;//and shift data from a temporary buffer. Stuff needs to be shifted to the
;//right by 24 bits to align properly
memcpyoffby3
;//First we need to word align the source
and r3, r1, #~0x3
;//Load the first value into the holding buffer (lr)
ldr lr, [r3], #4
mov lr, lr, LSR #24
;//Now we need to align the destination to a cache line boundary
;//We need to figure out how many words are needed to align it.
;//If the number of words to align it are less than the number of words
;//we're asked to copy, just copy the required number of words.
and r4, r0, #0x1C ;//Grab the low bits of the destination
rsb r4, r4, #32 ;//Negate them
;//Add 32 to the low bits(this is
;//how many we need to move to get aligned)
and r5, r2, #0x1C ;//Check only the number of words from count
cmp r4, r2 ;//Compare low bits to align against the words from count
movhi r4, r5 ;//If words to align is greater than the count, then
;//use the words from count instead
cmp r4, #0
beq offby3mainloop
;//r4 now contains the number of times we need to do a word load/store
;//So we need to sortof back-calculate how many of the word load/stores to
;//skip in memcpyoffby3cachelinealignload
rsb r6, r4, #32
and r6, r6, #0x1C
;//r3 now contains the number of *words* to skip over.
;//Deduct words from size
sub r2, r2, r4
;//Because the & 0x1C corresponds to words, we DO need to shift this time around
;//when we jump into load table
adr r12, offby3cachelinealignload
add pc, r12, r6, LSL #2 ;//Allows 4 instructions per byteblit
;//Because there is no convenient way to split the load/store into multiples of 2
;//unless we keep them together, for misaligned data we leave them together.
offby3cachelinealignload ;//Need to have up to 8 words (1 cache line)
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
;//So in theory we should now be cache line aligned.
;//We loop around doing prefetches and copies based on how far ahead we want to look
offby3mainloop
cmp r2, #(32*4 + 32) ;//Only keep looking ahead by 4 cache lines
bmi offby3endofmainloop
;//Preload
;// 0x000007c4: f5d3f060 `... PLD [r3,#0x60]
;// 0x000007c8: f5d3f080 .... PLD [r3,#0x80]
DCD 0xf5d3f060
DCD 0xf5d3f080
;//Here is the main loop that handles pipelining the loads for off by 1
ldmia r3!, {r4, r5, r6, r7, r8, r9, r10, r11}
orr r1,lr, r4, LSL #8
mov lr, r4, LSR #24
orr r4, lr, r5, LSL #8
mov lr, r5, LSR #24
orr r5, lr, r6, LSL #8
mov lr, r6, LSR #24
orr r6, lr, r7, LSL #8
mov lr, r7, LSR #24
orr r7, lr, r8, LSL #8
mov lr, r8, LSR #24
orr r8, lr, r9, LSL #8
mov lr, r9, LSR #24
orr r9, lr, r10, LSL #8
mov lr, r10, LSR #24
orr r10, lr, r11, LSL #8
mov lr, r11, LSR #24
stmia r0!, {r1, r4, r5, r6, r7, r8, r9, r10}
ldmia r3!, {r4, r5, r6, r7, r8, r9, r10, r11}
orr r1,lr, r4, LSL #8
mov lr, r4, LSR #24
orr r4, lr, r5, LSL #8
mov lr, r5, LSR #24
orr r5, lr, r6, LSL #8
mov lr, r6, LSR #24
orr r6, lr, r7, LSL #8
mov lr, r7, LSR #24
orr r7, lr, r8, LSL #8
mov lr, r8, LSR #24
orr r8, lr, r9, LSL #8
mov lr, r9, LSR #24
orr r9, lr, r10, LSL #8
mov lr, r10, LSR #24
orr r10, lr, r11, LSL #8
mov lr, r11, LSR #24
stmia r0!, {r1, r4, r5, r6, r7, r8, r9, r10}
sub r2, r2, #64 ;//Take 64 bytes off of count
b offby3mainloop
offby3endofmainloop
;//If we still have more than 32*4 words to move, do one more preload
cmp r2, #32*4
bls offby3nopreload
;// 0x00000898: f5d3f080 .... PLD [r3,#0x80]
DCD 0xf5d3f080
offby3nopreload
;//Now we finish up the copy without any preloads. The data should have alread
;//been loaded into the caches
;//Copy 32 bytes at a time
offby3finishcachelines
cmp r2, #32
bmi offby3endoffinishcachelines
ldmia r3!, {r4, r5, r6, r7, r8, r9, r10, r11}
orr r1,lr, r4, LSL #8
mov lr, r4, LSR #24
orr r4, lr, r5, LSL #8
mov lr, r5, LSR #24
orr r5, lr, r6, LSL #8
mov lr, r6, LSR #24
orr r6, lr, r7, LSL #8
mov lr, r7, LSR #24
orr r7, lr, r8, LSL #8
mov lr, r8, LSR #24
orr r8, lr, r9, LSL #8
mov lr, r9, LSR #24
orr r9, lr, r10, LSL #8
mov lr, r10, LSR #24
orr r10, lr, r11, LSL #8
mov lr, r11, LSR #24
stmia r0!, {r1, r4, r5, r6, r7, r8, r9, r10}
sub r2, r2, #32 ;//Take 32 bytes off of count
b offby3finishcachelines
offby3endoffinishcachelines
;//Now we need to finish off any partial cache lines that may be left. We do a similar
;//algorithm to the cachelinealign loop above.
ands r6, r2, #0x1C ;//Get number of words left
subeq r1, r3, #1 ;//Realign source on exact byte if need to branch
beq finish ;//If words left==0, then branch to finish
sub r2, r2, r6 ;//Subtract words left from count
rsb r6, r6, #32 ;//Get 32-number of words left
adr r12, offby3finishload ;//That's the copies to skip
add pc, r12, r6, LSL #2 ;//..but need to multiply by 4 to get instructions
offby3finishload ;//Need to have up to 8 words (1 cache line)
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
ldr r4, [r3], #4
orr r12,lr, r4, LSL #8
str r12,[r0], #4
mov lr, r4, LSR #24
sub r1, r3, #1 ;//Realign source on exact byte
;// b finish ;//Not needed, just fall through
;//Copy the last 4 bytes, if necessary
finish ;//This finish also used in < 4 bytes case
rsb r2, r2, #4 ;//Find how many bytes to copy (1,2,3, or 4)
adr r12, finishloadby3
add pc, r12, r2, LSL #2 ;//Need to shift r2 left by 2 bits to jump instructions
finishloadby3
ldrb r3, [r1], #1
ldrb r4, [r1], #1
ldrb r5, [r1], #1
ldrb r6, [r1], #1
adr r12, finishstoreby3
add pc, r12, r2, LSL #2
finishstoreby3
strb r3, [r0], #1
strb r4, [r0], #1
strb r5, [r0], #1
strb r6, [r0], #1
;//Return to calling function
IF Interworking :LOR: Thumbing
ldmfd sp!, {r0,r4-r11, lr}
bx lr
ELSE
ldmfd sp!, {r0,r4-r11, pc}
ENDIF
ENTRY_END memcpybigblk
END
|
oeis/139/A139526.asm | neoneye/loda-programs | 11 | 81444 | ; A139526: Triangle A061356 read right to left.
; Submitted by <NAME>
; 1,1,2,1,6,9,1,12,48,64,1,20,150,500,625,1,30,360,2160,6480,7776,1,42,735,6860,36015,100842,117649,1,56,1344,17920,143360,688128,1835008,2097152,1,72,2268,40824,459270,3306744,14880348,38263752,43046721,1,90
mov $2,1
lpb $0
add $1,1
sub $0,$1
add $2,1
lpe
bin $1,$0
pow $2,$0
mul $1,$2
mov $0,$1
|
Transynther/x86/_processed/AVXALIGN/_ht_st_zr_/i7-7700_9_0x48_notsx.log_21829_1600.asm | ljhsiun2/medusa | 9 | 10732 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r15
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1c963, %rbx
nop
nop
nop
add %rdi, %rdi
movups (%rbx), %xmm1
vpextrq $0, %xmm1, %r15
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_D_ht+0x1336b, %r10
nop
nop
nop
nop
nop
add %rdi, %rdi
movl $0x61626364, (%r10)
nop
nop
nop
sub $13565, %rdi
lea addresses_A_ht+0xae6b, %rsi
lea addresses_WC_ht+0x968b, %rdi
nop
nop
nop
and %r13, %r13
mov $107, %rcx
rep movsw
nop
nop
nop
add $28281, %r13
lea addresses_WC_ht+0x5ba, %rsi
lea addresses_WT_ht+0xda7b, %rdi
nop
nop
xor $10290, %r12
mov $123, %rcx
rep movsb
nop
xor $21770, %r13
lea addresses_WT_ht+0x338b, %rcx
nop
and $146, %r15
mov $0x6162636465666768, %r10
movq %r10, (%rcx)
nop
nop
nop
inc %r13
lea addresses_WT_ht+0x838b, %r15
nop
nop
nop
nop
xor %rbx, %rbx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm1
vmovups %ymm1, (%r15)
nop
nop
nop
sub $44237, %rbx
lea addresses_UC_ht+0xa837, %r12
nop
nop
nop
nop
add %r10, %r10
movw $0x6162, (%r12)
cmp %r12, %r12
lea addresses_WC_ht+0x5a4b, %rsi
lea addresses_D_ht+0x5f2b, %rdi
nop
nop
add %r10, %r10
mov $99, %rcx
rep movsq
nop
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_WT_ht+0x14a1b, %rsi
lea addresses_UC_ht+0xac8b, %rdi
clflush (%rsi)
nop
nop
nop
nop
inc %rbx
mov $78, %rcx
rep movsw
nop
nop
nop
dec %r10
lea addresses_UC_ht+0x1948b, %r13
nop
nop
nop
sub $47165, %r10
movw $0x6162, (%r13)
nop
and $46174, %rsi
lea addresses_normal_ht+0x368b, %r15
nop
nop
nop
nop
nop
dec %rsi
movl $0x61626364, (%r15)
sub %r10, %r10
lea addresses_normal_ht+0x23db, %r10
nop
cmp %rsi, %rsi
mov (%r10), %r13
nop
inc %r12
lea addresses_UC_ht+0x500b, %rsi
lea addresses_normal_ht+0xe38b, %rdi
nop
nop
nop
nop
dec %r12
mov $98, %rcx
rep movsw
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_WT_ht+0x5d8b, %rcx
nop
nop
nop
nop
nop
sub $15567, %r15
movl $0x61626364, (%rcx)
nop
nop
nop
nop
inc %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r9
push %rax
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_WC+0x13f4b, %rsi
lea addresses_normal+0xb8b, %rdi
nop
nop
nop
nop
sub $60504, %r9
mov $83, %rcx
rep movsq
xor $18177, %r9
// Load
mov $0x117bfd0000000a8b, %r14
clflush (%r14)
nop
xor $41050, %rax
mov (%r14), %r12d
nop
nop
nop
nop
dec %r9
// Store
mov $0x5ab0af00000008b7, %rsi
xor $971, %rdi
movw $0x5152, (%rsi)
nop
nop
nop
nop
nop
sub %rdi, %rdi
// Store
mov $0x2bb9a4000000098b, %rax
nop
nop
nop
nop
inc %rsi
movw $0x5152, (%rax)
nop
nop
nop
nop
nop
add %r12, %r12
// Faulty Load
lea addresses_D+0x12b8b, %rdi
nop
cmp $29625, %r12
movaps (%rdi), %xmm6
vpextrq $1, %xmm6, %rcx
lea oracles, %r9
and $0xff, %rcx
shlq $12, %rcx
mov (%r9,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D', 'congruent': 0}}
{'dst': {'same': False, 'congruent': 11, 'type': 'addresses_normal'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WC'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_NC', 'congruent': 7}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_NC', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_NC', 'congruent': 9}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': True, 'size': 16, 'type': 'addresses_D', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal_ht', 'congruent': 2}}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 4, 'type': 'addresses_D_ht', 'congruent': 4}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': True, 'congruent': 4, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal_ht', 'congruent': 7}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal_ht', 'congruent': 4}}
{'dst': {'same': True, 'congruent': 11, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT_ht', 'congruent': 8}, 'OP': 'STOR'}
{'45': 21, '44': 9, '48': 487, '49': 102, '38': 12408, '00': 8802}
38 00 38 00 38 38 38 00 38 00 00 38 38 38 38 00 38 00 00 38 38 38 38 38 38 38 38 00 00 00 38 00 38 00 00 00 38 38 48 38 38 38 38 00 00 38 00 00 38 38 38 38 38 38 38 00 38 38 38 38 00 38 00 00 38 38 48 00 38 38 00 00 00 38 38 00 00 38 38 38 38 38 38 38 38 00 38 38 38 38 38 00 38 38 38 38 00 38 38 38 38 38 38 00 38 48 38 38 38 38 38 00 38 38 38 00 00 00 38 38 38 38 00 38 00 38 00 38 38 00 38 48 38 38 00 00 00 38 38 38 38 38 00 00 38 38 00 38 38 00 00 38 38 38 00 00 38 00 38 38 38 38 48 38 00 00 38 00 38 00 00 38 00 00 00 38 48 00 38 38 00 38 00 38 38 00 38 00 38 00 38 38 00 38 00 00 00 00 00 00 00 38 00 00 38 38 38 38 38 38 38 00 38 00 38 38 00 38 00 38 38 38 00 38 38 00 38 00 00 00 38 38 38 38 38 38 48 38 00 38 00 00 38 38 38 00 00 38 38 38 48 00 00 38 00 00 38 00 00 38 00 00 00 38 38 38 00 38 38 38 38 00 38 00 38 38 38 38 38 38 00 38 00 38 00 00 38 38 00 38 38 38 38 38 38 38 00 00 00 38 00 00 38 38 38 38 00 38 00 00 00 00 38 38 38 38 38 00 48 38 00 00 38 38 38 38 00 00 00 00 38 38 38 38 38 00 38 00 38 00 38 38 00 00 00 38 38 00 00 00 38 00 00 38 00 00 00 38 38 00 38 49 38 00 00 38 00 38 00 00 38 38 38 00 38 48 00 38 38 38 38 00 38 00 00 38 00 38 00 00 00 00 38 38 00 00 00 00 00 38 38 38 38 00 00 38 00 00 38 00 38 38 00 38 38 38 38 38 38 38 00 00 00 00 00 38 38 38 38 38 00 00 38 38 38 38 38 00 38 38 48 38 00 38 38 38 00 38 00 38 00 00 38 00 00 38 38 38 00 38 00 00 00 38 00 00 00 00 00 00 38 38 38 00 38 38 00 00 38 38 00 38 38 38 38 48 38 38 38 00 00 00 00 00 38 00 00 00 38 38 38 38 38 48 38 00 38 38 00 00 38 38 38 38 00 38 38 38 00 38 38 38 00 38 00 38 00 38 00 00 00 00 00 38 00 00 00 00 38 00 38 38 00 38 38 38 00 00 38 38 38 38 48 38 38 38 38 00 00 38 38 38 00 38 48 38 00 38 38 38 38 00 00 00 00 38 38 38 00 38 38 00 38 00 38 00 00 38 38 00 38 38 00 38 00 38 38 00 38 00 38 00 38 38 00 38 49 38 38 00 00 38 38 00 38 00 38 00 38 00 38 38 38 38 38 00 38 38 00 38 38 00 38 38 38 00 38 00 00 00 38 00 00 00 38 00 00 38 38 38 38 38 38 38 38 38 38 00 38 00 38 38 38 38 48 00 00 38 38 38 38 38 00 00 00 38 38 48 00 38 38 38 38 00 00 00 00 00 38 38 38 38 38 38 00 38 38 38 00 00 00 00 38 38 38 38 38 38 38 38 00 00 00 00 00 38 38 38 00 38 48 38 00 38 38 38 38 00 00 38 38 38 38 38 00 00 38 38 38 38 38 38 00 00 00 00 38 00 38 48 38 38 38 38 00 38 38 00 00 38 00 38 00 38 00 38 38 38 38 00 38 38 00 38 38 00 38 38 38 38 38 38 38 38 00 38 38 38 00 38 49 00 00 38 00 38 38 38 38 00 38 00 00 38 38 38 38 48 38 38 38 38 38 00 38 38 00 38 38 38 38 38 38 00 00 00 38 38 00 00 00 38 38 00 38 38 00 38 00 38 00 38 00 38 38 38 00 38 48 38 38 38 00 00 00 00 38 38 38 00 38 00 38 00 00 00 38 00 38 38 38 38 38 38 38 38 48 00 38 38 38 38 38 00 00 38 38 00 38 00 38 38 38 00 38 38 38 38 00 00 00 38 38 00 38 38 00 38 00 00 38 38 00 00 00 38 38 00 00 38 00 38 00 38 38 38 38 38 38 00 00 38 00 00 38 38 38 38 00 38 38 00 00 38 00 00 38 38 38 38 38 00 00 00 38 00 38 00 00 38 38 00 38 38 38 38 00 38 38 38 38 00 38 38 00 38 38 48 38 38 00 38 38 00 38 38 00 00 38 00 38 00 48 00 00 38 38 38 38 38
*/
|
asm/linux-helloworld.asm | icefoxen/lang | 0 | 12641 | msg: db 'Hello world!',0x0A,0
msgend: db 0
global _start
_start:
mov eax, 4 ; "Write" system call
mov ebx, 1 ; stdout
mov ecx, msg ; String
mov edx, msgend - msg ; String length
int 0x80
mov eax, 1 ; "_exit" system call
mov ebx, 0 ; EXIT_SUCCESS
int 0x80
|
src/gpr_tools-gprslaves-db.adb | persan/gprTools | 2 | 26037 | <filename>src/gpr_tools-gprslaves-db.adb
with GNAT.Spitbol; use GNAT.Spitbol;
with Ada.Strings.Unbounded;
with GNAT.Expect;
with GNATCOLL.Projects;
with GNATCOLL.Utils;
with GNAT.OS_Lib; use GNAT.OS_Lib;
use GNAT.Expect;
with Ada.Unchecked_Deallocation;
package body GPR_Tools.Gprslaves.DB is
use GNAT.Spitbol.Table_VString;
use type Ada.Strings.Unbounded.Unbounded_String;
--------------
-- Register --
--------------
procedure Register
(Self : in out Table;
Host : Host_Address;
Keys : GNAT.Spitbol.Table_VString.Table)
is
begin
for I of Self.Hosts loop
if I.Host = Host then
I.Keys := Keys;
return;
end if;
end loop;
Self.Hosts.Append (Info_Struct'(Host, Keys));
end Register;
----------
-- Find --
----------
function Find
(Self : Table;
Keys : GNAT.Spitbol.Table_VString.Table)
return Host_Info_Vectors.Vector
is
begin
return Ret : Host_Info_Vectors.Vector do
for Candidate of Self.Hosts loop
declare
Search_Keys : constant Table_Array := Convert_To_Array (Keys);
OK : Boolean := True;
begin
for I of Search_Keys loop
if Present (Candidate.Keys, I.Name) then
if Get (Candidate.Keys, I.Name) /= I.Value then
OK := False;
end if;
else
OK := False;
end if;
if OK then
Ret.Append (Candidate.Host);
end if;
end loop;
end;
end loop;
end return;
end Find;
procedure Append (Self : in out Info_Struct;
Key_Name : String;
Key_Value : String) is
begin
Set (Self.Keys, Key_Name, V (Key_Value));
end Append;
function Get_Free_Port (Default : GNAT.Sockets.Port_Type := 8484) return GNAT.Sockets.Port_Type is
S : GNAT.Sockets.Socket_Type;
A : GNAT.Sockets.Sock_Addr_Type;
begin
A.Addr := GNAT.Sockets.Any_Inet_Addr;
A.Port := Default;
GNAT.Sockets.Create_Socket (S);
begin
GNAT.Sockets.Bind_Socket (S, A);
GNAT.Sockets.Close_Socket (S);
exception
when others =>
A.Port := GNAT.Sockets.Any_Port;
GNAT.Sockets.Bind_Socket (S, A);
A := GNAT.Sockets.Get_Socket_Name (S);
GNAT.Sockets.Close_Socket (S);
end;
return A.Port;
end Get_Free_Port;
function Get_Gnat_Version return String is
Env : GNATCOLL.Projects.Project_Environment_Access;
Fd : GNAT.Expect.Process_Descriptor_Access;
Gnatls_Args : GNAT.OS_Lib.Argument_List_Access :=
Argument_String_To_List ("gnatls" & " -v");
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Process_Descriptor'Class, Process_Descriptor_Access);
begin
GNATCOLL.Projects.Initialize (Env);
GNATCOLL.Projects.Spawn_Gnatls (Self => Env.all, Fd => Fd, Gnatls_Args => Gnatls_Args, Errors => null);
if Fd /= null then
declare
S : constant String := GNATCOLL.Utils.Get_Command_Output (Fd);
Index : Integer := S'First;
First : Integer;
Last : Integer;
begin
GNATCOLL.Utils.Skip_To_String (S, Index, "GNATLS");
while S (Index) /= ' ' loop
Index := Index + 1;
end loop;
GNATCOLL.Utils.Skip_Blanks (S, Index);
First := Index;
Last := GNATCOLL.Utils.Line_End (S, Index);
Unchecked_Free (Fd);
return S (First .. Last);
end;
end if;
Free (Gnatls_Args);
return "--";
end Get_Gnat_Version;
procedure Initialize (Self : in out Info_Struct;
HostName : String := GNAT.Sockets.Host_Name;
Port : GNAT.Sockets.Port_Type := Get_Free_Port) is
begin
Self.Host := (V (HostName), Port);
Self.Append ("GNAT", Get_Gnat_Version);
end Initialize;
end GPR_Tools.Gprslaves.DB;
|
programs/oeis/177/A177154.asm | karttu/loda | 1 | 12258 | ; A177154: Fractional part of the conversion from degrees Centigrade (or Celsius) to Fahrenheit.
; 0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2
mov $1,$0
mul $1,8
mod $1,10
|
src/shaders/h264/mc/Intra_PCM.asm | me176c-dev/android_hardware_intel-vaapi-driver | 192 | 242425 | /*
* Decode Intra_PCM macroblock
* Copyright © <2010>, Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* This file was originally licensed under the following license
*
* 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.
*
*/
// Kernel name: Intra_PCM.asm
//
// Decoding of I_PCM macroblock
//
// $Revision: 8 $
// $Date: 10/18/06 4:10p $
//
// ----------------------------------------------------
// Main: Intra_PCM
// ----------------------------------------------------
.kernel Intra_PCM
INTRA_PCM:
#ifdef _DEBUG
// WA for FULSIM so we'll know which kernel is being debugged
mov (1) acc0:ud 0x03aa55a5:ud
#endif
#include "SetupForHWMC.asm"
// Not actually needed here but just want to slow down the Intra-PCM to avoid race condition
//
#ifdef SW_SCOREBOARD
and (1) REG_INTRA_PRED_AVAIL_FLAG_WORD<1>:w REG_INTRA_PRED_AVAIL_FLAG_WORD<0;1,0>:w 0xffe0:w // Ensure all neighbor avail flags are "0"
CALL(scoreboard_start_intra,1)
wait n0:ud // Now wait for scoreboard to response
#endif
//
// Decoding Y blocks
//
// In I_PCM mode, the samples are already arranged in raster scan order within the macroblock.
// We just need to save them to picture buffers
//
#include "save_I_PCM.asm" // Save to destination picture buffers
#ifdef SW_SCOREBOARD
#include "scoreboard_update.asm"
#endif
// Terminate the thread
//
#include "EndIntraThread.asm"
// End of Intra_PCM
|
cwiczenia2/enter_k_c.asm | adamczykpiotr/AGH_WIMiIP_Architektury_Komputerow | 1 | 103323 | <reponame>adamczykpiotr/AGH_WIMiIP_Architektury_Komputerow<gh_stars>1-10
extern scanf
section .data
znak db "",0
format db "%c",0
section .text
global main
main:
xor rax, rax
mov rdi, format
mov rsi, znak
call scanf
cmp byte [znak], "k"
jne main
mov rax, 1
mov rbx, 0
int 80h
|
src/demo.asm | RingingResonance/8085-Assembler | 4 | 477 | <gh_stars>1-10
;*********************************************************************************
; Robot Pet Obstacle Avoidance Program *
; *
; <NAME> *
;*********************************************************************************
MVI A, 00 ; Setup timer B
OUT 44
MVI A, 42 ; Setup timer B
OUT 45
MVI A, CE ; Start timer B and set up port BB and BC to OUTPUT
OUT 40
MVI A, 02 ; Enable front sonar
OUT 43
LXI SP, 40FF ; Set stack pointer
JMP PRE
ORG 44
PRE: MVI A, 0C ; Set Servo Port to OUTPUT
OUT 00
MVI A, 20 ; Center Shaft
OUT 03
CENTER: IN 41 ; Wait until shaft is centered
ANI 08
JZ CENTER
START: MVI A, 21 ; Move shaft forward and drive
OUT 03
MVI A, 02 ; Enable front sonar
OUT 43
PING_POLL: CALL SUB_PING ; Poll for obstical
CPI 4F
JNC PING_POLL
MVI A, 20 ; Stop
OUT 03
MVI A, 01 ; Enable left sonar
OUT 43
CALL SUB_PING ; Read left distance
MOV L,A ; Store left distance in L
MVI A, 03 ; Enable right sonar
OUT 43
CALL SUB_PING ; Read right distance
CMP L ; Compare right distance to left distance
JC LEFT ; Turn left if there is more room to the left
JZ FLIP ; Turn left or right if distances are equal
MVI A, 3C ; Turn shaft right
OUT 03
JMP TURN
LEFT: MVI A, 00 ; Turn shaft left
OUT 03
JMP TURN
FLIP: LDA TurnDir
XRI 3C
STA TurnDir
OUT 03
TURN: IN 41 ; Wait for shaft to finish turning
ANI 08
JZ TURN
IN 03 ; Turn on drive motor to turn
INR A
OUT 03
CALL SUB_TURN_DELAY ; Wait for turn to finish
JMP START ; Loop back to START
SUB_PING: ; Ping subroutine
CALL SUB_DELAY ; Rest delay
LXI B, 800A ; Setup timeout timer
CALL SUB_TMR
POLL: IN 41 ; Poll for echo or timout
ANI 05
CPI 05
JZ POLL
CPI 01 ; If timout reached jump to set max distance
JZ CLEAR
IN 44 ; If echo, calculate distance
MOV B,A
MVI A, FF
SUB B
JMP WRITE
CLEAR: MVI A, FF ; Set distance to max if no object detected
WRITE: OUT 42 ; Write distance to LED readout
RET ; Return, note that distance is in A
SUB_TMR: MOV A,B ; Timer subroutine
OUT 05
MOV A,C
OUT 04
MVI A, CC
OUT 00
RET ; Return
SUB_DELAY: LXI B,0C37 ; Delay subroutine for PING refresh (50ms)
DELAYLoop: DCX B
MOV A,B
ORA C
JNZ DELAYLoop
RET ; Return
SUB_TURN_DELAY:
MVI B, 08 ; Delay subroutine for turning (2s)
LOOP1: MVI C, D6
LOOP2: MVI D, 7C
LOOP3: DCR D
JNZ LOOP3
DCR C
JNZ LOOP2
DCR B
JNZ LOOP1
RET ; Return
ORG F4
TurnDir: DB 3C |
include/sf-graphics-primitivetype.ads | Fabien-Chouteau/ASFML | 0 | 6992 | <reponame>Fabien-Chouteau/ASFML<filename>include/sf-graphics-primitivetype.ads<gh_stars>0
--//////////////////////////////////////////////////////////
-- SFML - Simple and Fast Multimedia Library
-- Copyright (C) 2007-2015 <NAME> (<EMAIL>)
-- This software is provided 'as-is', without any express or implied warranty.
-- In no event will the authors be held liable for any damages arising from the use of this software.
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it freely,
-- subject to the following restrictions:
-- 1. The origin of this software must not be misrepresented;
-- you must not claim that you wrote the original software.
-- If you use this software in a product, an acknowledgment
-- in the product documentation would be appreciated but is not required.
-- 2. Altered source versions must be plainly marked as such,
-- and must not be misrepresented as being the original software.
-- 3. This notice may not be removed or altered from any source distribution.
--//////////////////////////////////////////////////////////
package Sf.Graphics.PrimitiveType is
--//////////////////////////////////////////////////////////
--/ @brief Types of primitives that a sf::VertexArray can render
--/
--/ Points and lines have no area, therefore their thickness
--/ will always be 1 pixel, regardless the current transform
--/ and view.
--/
--//////////////////////////////////////////////////////////
--/< List of individual points
--/< List of individual lines
--/< List of connected lines, a point uses the previous point to form a line
--/< List of individual triangles
--/< List of connected triangles, a point uses the two previous points to form a triangle
--/< List of connected triangles, a point uses the common center and the previous point to form a triangle
--/< List of individual quads
--/< @deprecated Use sfLineStrip instead
--/< @deprecated Use sfTriangleStrip instead
--/< @deprecated Use sfTriangleFan instead
subtype sfPrimitiveType is sfUint32;
sfPoints : constant sfPrimitiveType := 0;
sfLines : constant sfPrimitiveType := 1;
sfLineStrip : constant sfPrimitiveType := 2;
sfTriangles : constant sfPrimitiveType := 3;
sfTriangleStrip : constant sfPrimitiveType := 4;
sfTriangleFan : constant sfPrimitiveType := 5;
sfQuads : constant sfPrimitiveType := 6;
sfLinesStrip : constant sfPrimitiveType := 2;
sfTrianglesStrip : constant sfPrimitiveType := 4;
sfTrianglesFan : constant sfPrimitiveType := 5;
end Sf.Graphics.PrimitiveType;
|
runtime/ravenscar-sfp-stm32f427/gnarl-common/s-tpobmu.adb | TUM-EI-RCS/StratoX | 12 | 10050 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K I N G . P R O T E C T E D _ O B J E C T S . --
-- M U L T I P R O C E S S O R S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2010-2015, AdaCore --
-- --
-- GNARL 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. GNARL 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/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
with System.Task_Primitives.Operations;
with System.Multiprocessors;
with System.Multiprocessors.Fair_Locks;
with System.Multiprocessors.Spin_Locks;
with System.OS_Interface;
with System.BB.Protection;
with System.BB.CPU_Primitives.Multiprocessors;
with System.BB.Threads.Queues;
package body System.Tasking.Protected_Objects.Multiprocessors is
use System.Multiprocessors;
use System.Multiprocessors.Spin_Locks;
use System.Multiprocessors.Fair_Locks;
package STPO renames System.Task_Primitives.Operations;
package BCPRMU renames System.BB.CPU_Primitives.Multiprocessors;
type Entry_Call_List is limited record
List : Entry_Call_Link;
Lock : Fair_Lock;
end record;
Served_Entry_Call : array (CPU) of Entry_Call_List :=
(others =>
(List => null,
Lock => (Spinning => (others => False),
Lock => (Flag => Unlocked))));
-- List of served Entry_Call for each CPU
------------
-- Served --
------------
procedure Served (Entry_Call : Entry_Call_Link) is
Caller : constant Task_Id := Entry_Call.Self;
Caller_CPU : constant CPU := STPO.Get_CPU (Caller);
begin
-- The entry caller is on a different CPU
-- We have to signal that the caller task is ready to be rescheduled,
-- but we are not allowed modify the ready queue of the other CPU. We
-- use the Served_Entry_Call list and a poke interrupt to signal that
-- the task is ready.
-- Disabled IRQ ensure atomicity of the operation. Atomicity plus Fair
-- locks ensure bounded execution time.
System.BB.CPU_Primitives.Disable_Interrupts;
Lock (Served_Entry_Call (Caller_CPU).Lock);
-- Add the entry call to the served list
Entry_Call.Next := Served_Entry_Call (Caller_CPU).List;
Served_Entry_Call (Caller_CPU).List := Entry_Call;
Unlock (Served_Entry_Call (Caller_CPU).Lock);
-- Enable interrupts
-- We need to set the hardware interrupt masking level equal to
-- the software priority of the task that is executing.
if System.BB.Threads.Queues.Running_Thread.Active_Priority in
Interrupt_Priority'Range
then
-- We need to mask some interrupts because we are executing at a
-- hardware interrupt priority.
System.BB.CPU_Primitives.Enable_Interrupts
(System.BB.Threads.Queues.Running_Thread.Active_Priority -
System.Interrupt_Priority'First + 1);
else
-- We are neither within an interrupt handler nor within task
-- that has a priority in the range of Interrupt_Priority, so
-- that no interrupt should be masked.
System.BB.CPU_Primitives.Enable_Interrupts (0);
end if;
if STPO.Get_Priority (Entry_Call.Self) >
System.OS_Interface.Current_Priority (Caller_CPU)
then
-- Poke the caller's CPU if the task has a higher priority
System.BB.CPU_Primitives.Multiprocessors.Poke_CPU (Caller_CPU);
end if;
end Served;
-------------------------
-- Wakeup_Served_Entry --
-------------------------
procedure Wakeup_Served_Entry is
CPU_Id : constant CPU := BCPRMU.Current_CPU;
Entry_Call : Entry_Call_Link;
begin
-- Interrupts are always disabled when entering here
Lock (Served_Entry_Call (CPU_Id).Lock);
Entry_Call := Served_Entry_Call (CPU_Id).List;
Served_Entry_Call (CPU_Id).List := null;
Unlock (Served_Entry_Call (CPU_Id).Lock);
while Entry_Call /= null loop
STPO.Wakeup (Entry_Call.Self, Entry_Caller_Sleep);
Entry_Call := Entry_Call.Next;
end loop;
end Wakeup_Served_Entry;
begin
System.BB.Protection.Wakeup_Served_Entry_Callback :=
Wakeup_Served_Entry'Access;
end System.Tasking.Protected_Objects.Multiprocessors;
|
Transynther/x86/_processed/NONE/_ht_zr_un_/i9-9900K_12_0xa0.log_21829_1251.asm | ljhsiun2/medusa | 9 | 86544 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x28c2, %rax
clflush (%rax)
nop
nop
nop
and $49336, %rbp
movw $0x6162, (%rax)
nop
nop
nop
nop
nop
and $15948, %rdx
lea addresses_normal_ht+0x16982, %rcx
nop
nop
nop
nop
nop
add $62134, %r15
mov $0x6162636465666768, %rbp
movq %rbp, %xmm1
and $0xffffffffffffffc0, %rcx
vmovntdq %ymm1, (%rcx)
nop
nop
nop
and $59701, %rcx
lea addresses_UC_ht+0xf12a, %rcx
nop
nop
nop
cmp %rdx, %rdx
mov $0x6162636465666768, %r15
movq %r15, (%rcx)
nop
nop
nop
nop
cmp %rcx, %rcx
lea addresses_normal_ht+0x19c5, %r15
nop
nop
nop
sub %r12, %r12
mov $0x6162636465666768, %r8
movq %r8, %xmm6
movups %xmm6, (%r15)
nop
nop
nop
nop
sub $32049, %rax
lea addresses_D_ht+0x14302, %r15
nop
nop
nop
dec %rbp
mov $0x6162636465666768, %rcx
movq %rcx, %xmm3
vmovups %ymm3, (%r15)
nop
nop
nop
and %rbp, %rbp
lea addresses_WT_ht+0x19d82, %rcx
nop
nop
nop
xor %r15, %r15
movb $0x61, (%rcx)
nop
nop
nop
nop
nop
dec %rax
lea addresses_UC_ht+0xf603, %r8
nop
nop
nop
nop
sub $44631, %rax
mov $0x6162636465666768, %r15
movq %r15, %xmm7
vmovups %ymm7, (%r8)
nop
nop
nop
nop
and $7395, %rbp
lea addresses_D_ht+0x9502, %rsi
lea addresses_normal_ht+0x18582, %rdi
nop
nop
nop
nop
nop
xor %rbp, %rbp
mov $13, %rcx
rep movsb
cmp $24463, %rax
lea addresses_A_ht+0xfe82, %rax
and %r8, %r8
mov (%rax), %r15
nop
and %r12, %r12
lea addresses_UC_ht+0x16fe8, %r12
cmp %rcx, %rcx
movw $0x6162, (%r12)
nop
nop
sub %rsi, %rsi
lea addresses_WT_ht+0x17f82, %r15
clflush (%r15)
nop
nop
cmp %rbp, %rbp
mov (%r15), %r12
nop
nop
and %r15, %r15
lea addresses_D_ht+0x12f82, %rsi
lea addresses_UC_ht+0x13b42, %rdi
nop
nop
xor %rdx, %rdx
mov $98, %rcx
rep movsq
nop
nop
nop
nop
nop
xor %rax, %rax
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r8
push %rax
push %rbx
push %rdx
// Store
lea addresses_US+0x19182, %r12
nop
nop
nop
nop
cmp %rax, %rax
mov $0x5152535455565758, %r10
movq %r10, %xmm7
movups %xmm7, (%r12)
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %r8
nop
nop
nop
nop
cmp %r8, %r8
// Store
lea addresses_D+0xecc2, %r13
nop
add $45083, %rbx
mov $0x5152535455565758, %rdx
movq %rdx, (%r13)
nop
nop
nop
nop
nop
sub %r13, %r13
// Store
lea addresses_D+0x13a8b, %rax
nop
dec %r12
mov $0x5152535455565758, %r10
movq %r10, %xmm3
vmovups %ymm3, (%rax)
nop
nop
nop
cmp $23688, %r12
// Store
lea addresses_UC+0x10f82, %rdx
nop
nop
nop
nop
nop
add $38441, %r13
mov $0x5152535455565758, %rbx
movq %rbx, (%rdx)
nop
nop
nop
nop
nop
and $44439, %r8
// Store
lea addresses_D+0x9782, %rax
nop
nop
add %r10, %r10
movl $0x51525354, (%rax)
// Exception!!!
nop
nop
nop
mov (0), %r10
nop
cmp %r8, %r8
// Store
lea addresses_D+0x382, %r13
nop
nop
nop
nop
dec %rax
movl $0x51525354, (%r13)
nop
nop
nop
cmp $5476, %r8
// Faulty Load
lea addresses_A+0xb382, %r13
nop
nop
xor %rbx, %rbx
movups (%r13), %xmm4
vpextrq $1, %xmm4, %rdx
lea oracles, %r10
and $0xff, %rdx
shlq $12, %rdx
mov (%r10,%rdx,1), %rdx
pop %rdx
pop %rbx
pop %rax
pop %r8
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_US', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_D', 'AVXalign': False, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_D', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_UC', 'AVXalign': False, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 10, 'type': 'addresses_D', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_D', 'AVXalign': False, 'size': 4}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 6, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 3, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 6, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}}
{'src': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}}
{'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 8}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 6, 'type': 'addresses_UC_ht'}}
{'46': 21817, 'ff': 2, '00': 6, '42': 1, '76': 1, '40': 1, '59': 1}
46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46
*/
|
TxMark.Antlr/MarkdownPreprocessor.g4 | aarondh/TxMark | 0 | 3705 | /*
* TxMark 1.0.0.alpha-5-g61bda79
*
* Copyright (c) 2016 <NAME>
*
* 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.
*/
grammar MarkdownPreprocessor;
document
: line* textLine? EOF
;
line
: heading carriageReturn
| list
| blockquote
| textLine carriageReturn
| paragraph_end
;
carriageReturn
: softCarriageReturn
| hardCarriageReturn
;
softCarriageReturn
: space? CARRIAGE_RETURN
;
hardCarriageReturn
: space space CARRIAGE_RETURN
;
list
: (listItem carriageReturn | indentedText carriageReturn )+
;
listItem
: (listItemIndicator whitespace?)+ text
;
indentedText
: (tab+ | space space space space+) (tab|space)* text
;
listItemIndicator
: ASTERISK
| DIGIT+ PERIOD
;
blockquote
: (blockquoteItem carriageReturn | indentedText carriageReturn )+
;
blockquoteItem
: (blockquoteIndicator whitespace?)+ blockQuoteElement
;
blockQuoteElement
: heading
| blockQuoteListItem
| textLine
;
blockQuoteListItem
: (listItemIndicator whitespace?)+ text
;
blockquoteIndicator
: GREATER_THAN
;
heading
: (headingIndicator)+ whitespace text
;
headingIndicator
: HASH
;
textLine
: whitespace* text
;
paragraph_end
: (whitespace* softCarriageReturn)+
;
text
: nonWhitespace+ safeText*
| parenthesisClause textLine*
| openTag textLine*
| closeTag textLine*
;
safeText
: (whitespace | nonWhitespace | HASH | ASTERISK | LESS_THAN | SLASH | PERIOD)
;
attributeContent
: (whitespace|anyNonWhitespace|CARRIAGE_RETURN)*
;
attributeValue
: DOUBLE_QUOTE (whitespace|anyNonWhitespace)*? DOUBLE_QUOTE
| SINGLE_QUOTE (whitespace|anyNonWhitespace)*? SINGLE_QUOTE
;
attributeName
: identifier
;
attribute
: anyWhitespace* attributeName anyWhitespace* EQUAL anyWhitespace* attributeValue
;
tag
: identifier
;
parenthesisClause
: safeText* OPEN_PARENTHESIS (anyWhitespace | nonWhitespace | HASH | ASTERISK | GREATER_THAN | LESS_THAN | SLASH | PERIOD | parenthesisClause )* CLOSE_PARENTHESIS
;
openTag
: safeText* LESS_THAN tag attribute* anyWhitespace* SLASH? GREATER_THAN
;
closeTag
: safeText* LESS_THAN SLASH tag anyWhitespace* GREATER_THAN
;
identifier
: (LETTER | COLON)+ (LETTER | DIGIT | COLON | UNDERBAR | DASH | PERIOD | COLON)*
;
whitespace
: space
| tab
;
space
: SPACE
;
tab
: TAB
;
anyNonWhitespace
: nonWhitespace | HASH | ASTERISK | LESS_THAN | GREATER_THAN | SLASH | PERIOD
;
nonWhitespace
: NON_WHITESPACE
| PUNCTUATION
| DIGIT
| LETTER
| EQUAL
| DOUBLE_QUOTE
| SINGLE_QUOTE
| COLON
| DASH
| UNDERBAR
| PERIOD
;
anyWhitespace
: whitespace
| CARRIAGE_RETURN
;
DOUBLE_QUOTE
: '"'
;
SINGLE_QUOTE
: '\''
;
OPEN_PARENTHESIS
: '('
;
CLOSE_PARENTHESIS
: ')'
;
ASTERISK
: '*'
;
HASH
: '#'
;
PERIOD
: '.'
;
COLON
: ':'
;
UNDERBAR
: '_'
;
DASH
: '-'
;
DIGIT
: [0-9]
;
LETTER
: [a-zA-Z]
;
PUNCTUATION
: [~`!@$%^&+{\[}\]|\\;,?]
;
TAB
: '\t'
;
EQUAL
: '='
;
SPACE
: ' '
;
LESS_THAN
: '<'
;
GREATER_THAN
: '>'
;
SLASH
: '/'
;
CARRIAGE_RETURN
: ('\r'? '\n')
;
NON_WHITESPACE
: ~[ ' ' '\t' '\r' '\n' '#' '*' '/' '<' '>' '.']
;
|
apps/msx.asm | vipoo/msxrc2014 | 1 | 81697 | <reponame>vipoo/msxrc2014
public _cleanexit
include "msx.inc"
SECTION CODE
_cleanexit:
CALL _setTextMode
JP 0
PUBLIC _setTextMode
_setTextMode:
; Reset V9958 read register back to default of 0
XOR A
OUT (VDP_ADDR), A
LD A, 0x80 | 15
OUT (VDP_ADDR), A
ld a, 0
ld ix, CHGMOD
ld iy, (EXPTBL-1)
call CALSLT
ld ix, CHGCLR
ld iy, (EXPTBL-1)
call CALSLT
ld ix, INIT32
ld iy, (EXPTBL-1)
call CALSLT
ld a, 80
ld (LINL40), a
ld ix, INITXT
ld iy, (EXPTBL-1)
call CALSLT
ld ix, INIPLT
JP CALSUB
; CALSUB
;
; In: IX = address of routine in MSX2 SUBROM
; AF, HL, DE, BC = parameters for the routine
;
; Out: AF, HL, DE, BC = depending on the routine
;
; Changes: IX, IY, AF', BC', DE', HL'
;
; Call MSX2 subrom from MSXDOS. Should work with all versions of MSXDOS.
;
; Notice: NMI hook will be changed. This should pose no problem as NMI is
; not supported on the MSX at all.
;
NMI: EQU $0066
EXTROM: EQU $015f
H_NMI: EQU $fdd6
;
CALSUB: exx
ex af,af' ; store all registers
ld hl,EXTROM
push hl
ld hl,$C300
push hl ; push NOP ; JP EXTROM
push ix
ld hl,$21DD
push hl ; push LD IX,<entry>
ld hl,$3333
push hl ; push INC SP; INC SP
ld hl,0
add hl,sp ; HL = offset of routine
ld a,$C3
ld (H_NMI),a
ld (H_NMI+1),hl ; JP <routine> in NMI hook
ex af,af'
exx ; restore all registers
ld ix,NMI
ld iy,(EXPTBL-1)
call CALSLT ; call NMI-hook via NMI entry in ROMBIOS
; NMI-hook will call SUBROM
exx
ex af,af' ; store all returned registers
ld hl,10
add hl,sp
ld sp,hl ; remove routine from stack
ex af,af'
exx ; restore all returned registers
ret
SECTION IGNORE
|
maps/Route8SaffronGate.asm | Dev727/ancientplatinum | 28 | 95049 | <filename>maps/Route8SaffronGate.asm
object_const_def ; object_event constants
const ROUTE8SAFFRONGATE_OFFICER
Route8SaffronGate_MapScripts:
db 0 ; scene scripts
db 0 ; callbacks
Route8SaffronGateOfficerScript:
jumptextfaceplayer Route8SaffronGateOfficerText
Route8SaffronGateOfficerText:
text "Have you been to"
line "LAVENDER TOWN?"
para "There's a tall"
line "RADIO TOWER there."
done
Route8SaffronGate_MapEvents:
db 0, 0 ; filler
db 4 ; warp events
warp_event 0, 4, SAFFRON_CITY, 14
warp_event 0, 5, SAFFRON_CITY, 15
warp_event 9, 4, ROUTE_8, 1
warp_event 9, 5, ROUTE_8, 2
db 0 ; coord events
db 0 ; bg events
db 1 ; object events
object_event 5, 2, SPRITE_OFFICER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, Route8SaffronGateOfficerScript, -1
|
libsrc/target/tvc/games/joystick.asm | Frodevan/z88dk | 640 | 83609 | <filename>libsrc/target/tvc/games/joystick.asm
;
; Game device library for the Enterprise 64/128
; <NAME> - Mar 2011
;
; $Id: joystick.asm,v 1.4 2016-06-16 20:23:51 dom Exp $
;
; MOVE_RIGHT 1
; MOVE_LEFT 2
; MOVE_DOWN 4
; MOVE_UP 8
; MOVE_FIRE 16
; MOVE_FIRE1 MOVE_FIRE
; MOVE_FIRE2 32
; MOVE_FIRE3 64
; MOVE_FIRE4 128
SECTION code_clib
PUBLIC joystick
PUBLIC _joystick
EXTERN l_push_di
EXTERN l_pop_ei
INCLUDE "target/tvc/def/tvc.def"
.joystick
._joystick
;__FASTALL__ : joystick no. in HL
; L is 1 or 2
;
call l_push_di ; let's not allow interrupt, port is written, read..
ld a,(PORT03)
and $c0 ; keep the proper expansion socket (upper 2 bits)
add a,$07
add a,l
out ($03),a ; select the keyboard row (including joy sense)
in a,($58) ; let's read back the columns in the row - 0 active
ld d,a ; store in C
ld a,(PORT03) ; setting back the keyboard row port
out ($03),a
call l_pop_ei ; port is set back, interrupt is OK now.
ld a,d
ld c,0
; B7 B6 B5 B4 B3 B2 B1 B0
; ---- LEFT RIGHT ACC FIRE DOWN UP INS
ld b,$02 ; setting b1 in case LEFT
bit 6,a ; left
call z,set_joy_button
ld b,$01 ; setting b0 in case RIGHT
bit 5,a ; right
call z,set_joy_button
ld b,$20 ; setting b5 in case
bit 4,a ; accelerator
call z,set_joy_button
ld b,$10 ; setting b4 in case
bit 3,a ; fire
call z,set_joy_button
ld b,$04 ; setting b2 in case
bit 2,a ; down
call z,set_joy_button
ld b,$08 ; setting b3 in case
bit 1,a ; up
call z,set_joy_button
ld h,0
ld l,c
ret
.set_joy_button
ld a,c ; return value is stored in C
add b ; adding B
ld c,a ; storing back A to C
ld a,d ; restore A from D
ret
|
oeis/307/A307862.asm | neoneye/loda-programs | 11 | 29118 | <filename>oeis/307/A307862.asm
; A307862: Coefficient of x^n in (1 + x - n*x^2)^n.
; Submitted by <NAME>
; 1,1,-3,-17,49,651,-1259,-38023,26433,2969299,2225101,-289389891,-692529551,33718183045,143578976997,-4559187616649,-29119975483135,699788001188403,6188699469443869,-119828491083854707,-1404529670244379599,22563726025297759345,341997845736800473397,-4613396929614537149493,-89315441100974785763519,1012079288402773219297501,24960444445085190071495661,-235322689811213585272316093,-7442250688473238515064095887,57173596749694601067172799499,2359953622812012502576602960901
mov $1,1
mov $3,$0
mov $4,1
lpb $3
mul $1,$3
sub $3,1
mul $1,$3
mul $1,$0
sub $4,2
add $5,$4
div $1,$5
add $2,$1
sub $3,1
lpe
mov $0,$2
add $0,1
|
oeis/142/A142622.asm | neoneye/loda-programs | 11 | 98748 | ; A142622: Primes congruent to 29 mod 55.
; Submitted by <NAME>
; 29,139,359,1019,1129,1459,1789,2339,2999,3109,3329,3659,3769,3989,4099,4649,4759,5309,5419,5639,5749,6079,6299,6959,7069,7949,8059,8389,8609,8719,9049,9929,10039,10259,10369,10589,11579,11689,11909,12239,12569,12899,13009,13229,13339,13669,13999,14549,14879,15319,15649,16529,17189,17299,17519,17959,18289,18839,19609,20269,20599,20929,21149,21589,22469,23459,23789,23899,24229,24889,25219,25439,26099,26209,26539,26759,27529,27749,28409,29179,29399,30059,30169,30389,30829,31159,31379,31489,32369
mov $1,14
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $2,2
mov $3,$1
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,55
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
mul $0,2
sub $0,109
|
programs/oeis/254/A254962.asm | karttu/loda | 1 | 165662 | ; A254962: Indices of hexagonal numbers (A000384) that are also centered pentagonal numbers (A005891).
; 1,2,12,31,211,552,3782,9901,67861,177662,1217712,3188011,21850951,57206532,392099402,1026529561,7035938281,18420325562,126254789652,330539330551,2265550275451,5931287624352,40653650168462,106432637907781,729500152756861,1909856194715702
mul $0,3
div $0,2
add $0,1
cal $0,5592 ; a(n) = F(2n+1) + F(2n-1) - 1.
mov $1,$0
div $1,4
add $1,1
|
llvm-gcc-4.2-2.9/gcc/ada/prj.ads | vidkidz/crossbridge | 1 | 9809 | <reponame>vidkidz/crossbridge<gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2005, 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, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- The following package declares the data types for GNAT project.
-- These data types may be used by GNAT Project-aware tools.
-- Children of these package implements various services on these data types.
-- See in particular Prj.Pars and Prj.Env.
with Casing; use Casing;
with Scans; use Scans;
with Table;
with Types; use Types;
with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
with GNAT.Dynamic_Tables;
with GNAT.OS_Lib; use GNAT.OS_Lib;
with System.HTable;
package Prj is
All_Packages : constant String_List_Access;
-- Default value of parameter Packages of procedures Parse, in Prj.Pars and
-- Prj.Part, indicating that all packages should be checked.
type Project_Tree_Data;
type Project_Tree_Ref is access all Project_Tree_Data;
-- Reference to a project tree.
-- Several project trees may exist in memory at the same time.
No_Project_Tree : constant Project_Tree_Ref;
function Default_Ada_Spec_Suffix return Name_Id;
pragma Inline (Default_Ada_Spec_Suffix);
-- The Name_Id for the standard GNAT suffix for Ada spec source file
-- name ".ads". Initialized by Prj.Initialize.
function Default_Ada_Body_Suffix return Name_Id;
pragma Inline (Default_Ada_Body_Suffix);
-- The Name_Id for the standard GNAT suffix for Ada body source file
-- name ".adb". Initialized by Prj.Initialize.
function Slash return Name_Id;
pragma Inline (Slash);
-- "/", used as the path of locally removed files
Project_File_Extension : String := ".gpr";
-- The standard project file name extension. It is not a constant, because
-- Canonical_Case_File_Name is called on this variable in the body of Prj.
type Error_Warning is (Silent, Warning, Error);
-- Severity of some situations, such as: no Ada sources in a project where
-- Ada is one of the language.
--
-- When the situation occurs, the behaviour depends on the setting:
--
-- - Silent: no action
-- - Warning: issue a warning, does not cause the tool to fail
-- - Error: issue an error, causes the tool to fail
-----------------------------------------------------
-- Multi-language Stuff That Will be Modified Soon --
-----------------------------------------------------
-- Still should be properly commented ???
type Language_Index is new Nat;
No_Language_Index : constant Language_Index := 0;
First_Language_Index : constant Language_Index := 1;
First_Language_Indexes_Last : constant Language_Index := 5;
Ada_Language_Index : constant Language_Index :=
First_Language_Index;
C_Language_Index : constant Language_Index :=
Ada_Language_Index + 1;
C_Plus_Plus_Language_Index : constant Language_Index :=
C_Language_Index + 1;
Last_Language_Index : Language_Index := No_Language_Index;
subtype First_Language_Indexes is Language_Index
range First_Language_Index .. First_Language_Indexes_Last;
type Header_Num is range 0 .. 2047;
function Hash is new System.HTable.Hash (Header_Num => Header_Num);
function Hash (Name : Name_Id) return Header_Num;
package Language_Indexes is new System.HTable.Simple_HTable
(Header_Num => Header_Num,
Element => Language_Index,
No_Element => No_Language_Index,
Key => Name_Id,
Hash => Hash,
Equal => "=");
-- Mapping of language names to language indexes
package Language_Names is new Table.Table
(Table_Component_Type => Name_Id,
Table_Index_Type => Language_Index,
Table_Low_Bound => 1,
Table_Initial => 4,
Table_Increment => 100,
Table_Name => "Prj.Language_Names");
-- The table for the name of programming languages
procedure Add_Language_Name (Name : Name_Id);
procedure Display_Language_Name (Language : Language_Index);
type Languages_In_Project is array (First_Language_Indexes) of Boolean;
-- Set of supported languages used in a project
No_Languages : constant Languages_In_Project := (others => False);
-- No supported languages are used
type Supp_Language_Index is new Nat;
No_Supp_Language_Index : constant Supp_Language_Index := 0;
type Supp_Language is record
Index : Language_Index := No_Language_Index;
Present : Boolean := False;
Next : Supp_Language_Index := No_Supp_Language_Index;
end record;
package Present_Language_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Supp_Language,
Table_Index_Type => Supp_Language_Index,
Table_Low_Bound => 1,
Table_Initial => 4,
Table_Increment => 100);
-- The table for the presence of languages with an index that is outside
-- of First_Language_Indexes.
type Impl_Suffix_Array is array (First_Language_Indexes) of Name_Id;
-- Suffixes for the non spec sources of the different supported languages
-- in a project.
No_Impl_Suffixes : constant Impl_Suffix_Array := (others => No_Name);
-- A default value for the non spec source suffixes
type Supp_Suffix is record
Index : Language_Index := No_Language_Index;
Suffix : Name_Id := No_Name;
Next : Supp_Language_Index := No_Supp_Language_Index;
end record;
package Supp_Suffix_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Supp_Suffix,
Table_Index_Type => Supp_Language_Index,
Table_Low_Bound => 1,
Table_Initial => 4,
Table_Increment => 100);
-- The table for the presence of languages with an index that is outside
-- of First_Language_Indexes.
type Language_Kind is (GNU, other);
type Name_List_Index is new Nat;
No_Name_List : constant Name_List_Index := 0;
type Name_Node is record
Name : Name_Id := No_Name;
Next : Name_List_Index := No_Name_List;
end record;
package Name_List_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Name_Node,
Table_Index_Type => Name_List_Index,
Table_Low_Bound => 1,
Table_Initial => 10,
Table_Increment => 100);
-- The table for lists of names used in package Language_Processing
type Language_Processing_Data is record
Compiler_Drivers : Name_List_Index := No_Name_List;
Compiler_Paths : Name_Id := No_Name;
Compiler_Kinds : Language_Kind := GNU;
Dependency_Options : Name_List_Index := No_Name_List;
Compute_Dependencies : Name_List_Index := No_Name_List;
Include_Options : Name_List_Index := No_Name_List;
Binder_Drivers : Name_Id := No_Name;
Binder_Driver_Paths : Name_Id := No_Name;
end record;
Default_Language_Processing_Data :
constant Language_Processing_Data :=
(Compiler_Drivers => No_Name_List,
Compiler_Paths => No_Name,
Compiler_Kinds => GNU,
Dependency_Options => No_Name_List,
Compute_Dependencies => No_Name_List,
Include_Options => No_Name_List,
Binder_Drivers => No_Name,
Binder_Driver_Paths => No_Name);
type First_Language_Processing_Data is
array (First_Language_Indexes) of Language_Processing_Data;
Default_First_Language_Processing_Data :
constant First_Language_Processing_Data :=
(others => Default_Language_Processing_Data);
type Supp_Language_Data is record
Index : Language_Index := No_Language_Index;
Data : Language_Processing_Data := Default_Language_Processing_Data;
Next : Supp_Language_Index := No_Supp_Language_Index;
end record;
package Supp_Language_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Supp_Language_Data,
Table_Index_Type => Supp_Language_Index,
Table_Low_Bound => 1,
Table_Initial => 4,
Table_Increment => 100);
-- The table for language data when there are more languages than
-- in First_Language_Indexes.
type Other_Source_Id is new Nat;
No_Other_Source : constant Other_Source_Id := 0;
type Other_Source is record
Language : Language_Index; -- language of the source
File_Name : Name_Id; -- source file simple name
Path_Name : Name_Id; -- source full path name
Source_TS : Time_Stamp_Type; -- source file time stamp
Object_Name : Name_Id; -- object file simple name
Object_Path : Name_Id; -- object full path name
Object_TS : Time_Stamp_Type; -- object file time stamp
Dep_Name : Name_Id; -- dependency file simple name
Dep_Path : Name_Id; -- dependency full path name
Dep_TS : Time_Stamp_Type; -- dependency file time stamp
Naming_Exception : Boolean := False; -- True if a naming exception
Next : Other_Source_Id := No_Other_Source;
end record;
-- Data for a source in a language other than Ada
package Other_Source_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Other_Source,
Table_Index_Type => Other_Source_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100);
-- The table for sources of languages other than Ada
----------------------------------
-- End of multi-language stuff --
----------------------------------
type Verbosity is (Default, Medium, High);
-- Verbosity when parsing GNAT Project Files
-- Default is default (very quiet, if no errors).
-- Medium is more verbose.
-- High is extremely verbose.
Current_Verbosity : Verbosity := Default;
-- The current value of the verbosity the project files are parsed with
type Lib_Kind is (Static, Dynamic, Relocatable);
type Policy is (Autonomous, Compliant, Controlled, Restricted);
-- Type to specify the symbol policy, when symbol control is supported.
-- See full explanation about this type in package Symbols.
-- Autonomous: Create a symbol file without considering any reference
-- Compliant: Try to be as compatible as possible with an existing ref
-- Controlled: Fail if symbols are not the same as those in the reference
-- Restricted: Restrict the symbols to those in the symbol file
type Symbol_Record is record
Symbol_File : Name_Id := No_Name;
Reference : Name_Id := No_Name;
Symbol_Policy : Policy := Autonomous;
end record;
-- Type to keep the symbol data to be used when building a shared library
No_Symbols : constant Symbol_Record :=
(Symbol_File => No_Name,
Reference => No_Name,
Symbol_Policy => Autonomous);
-- The default value of the symbol data
function Empty_String return Name_Id;
-- Return the Name_Id for an empty string ""
type Project_Id is new Nat;
No_Project : constant Project_Id := 0;
-- Id of a Project File
type String_List_Id is new Nat;
Nil_String : constant String_List_Id := 0;
type String_Element is record
Value : Name_Id := No_Name;
Index : Int := 0;
Display_Value : Name_Id := No_Name;
Location : Source_Ptr := No_Location;
Flag : Boolean := False;
Next : String_List_Id := Nil_String;
end record;
-- To hold values for string list variables and array elements.
-- Component Flag may be used for various purposes. For source
-- directories, it indicates if the directory contains Ada source(s).
package String_Element_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => String_Element,
Table_Index_Type => String_List_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100);
-- The table for string elements in string lists
type Variable_Kind is (Undefined, List, Single);
-- Different kinds of variables
subtype Defined_Variable_Kind is Variable_Kind range List .. Single;
-- The defined kinds of variables
Ignored : constant Variable_Kind;
-- Used to indicate that a package declaration must be ignored
-- while processing the project tree (unknown package name).
type Variable_Value (Kind : Variable_Kind := Undefined) is record
Project : Project_Id := No_Project;
Location : Source_Ptr := No_Location;
Default : Boolean := False;
case Kind is
when Undefined =>
null;
when List =>
Values : String_List_Id := Nil_String;
when Single =>
Value : Name_Id := No_Name;
Index : Int := 0;
end case;
end record;
-- Values for variables and array elements. Default is True if the
-- current value is the default one for the variable
Nil_Variable_Value : constant Variable_Value;
-- Value of a non existing variable or array element
type Variable_Id is new Nat;
No_Variable : constant Variable_Id := 0;
type Variable is record
Next : Variable_Id := No_Variable;
Name : Name_Id;
Value : Variable_Value;
end record;
-- To hold the list of variables in a project file and in packages
package Variable_Element_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Variable,
Table_Index_Type => Variable_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100);
-- The table of variable in list of variables
type Array_Element_Id is new Nat;
No_Array_Element : constant Array_Element_Id := 0;
type Array_Element is record
Index : Name_Id;
Src_Index : Int := 0;
Index_Case_Sensitive : Boolean := True;
Value : Variable_Value;
Next : Array_Element_Id := No_Array_Element;
end record;
-- Each Array_Element represents an array element and is linked (Next)
-- to the next array element, if any, in the array.
package Array_Element_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Array_Element,
Table_Index_Type => Array_Element_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100);
-- The table that contains all array elements
type Array_Id is new Nat;
No_Array : constant Array_Id := 0;
type Array_Data is record
Name : Name_Id := No_Name;
Value : Array_Element_Id := No_Array_Element;
Next : Array_Id := No_Array;
end record;
-- Each Array_Data value represents an array.
-- Value is the id of the first element.
-- Next is the id of the next array in the project file or package.
package Array_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Array_Data,
Table_Index_Type => Array_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100);
-- The table that contains all arrays
type Package_Id is new Nat;
No_Package : constant Package_Id := 0;
type Declarations is record
Variables : Variable_Id := No_Variable;
Attributes : Variable_Id := No_Variable;
Arrays : Array_Id := No_Array;
Packages : Package_Id := No_Package;
end record;
-- Contains the declarations (variables, single and array attributes,
-- packages) for a project or a package in a project.
No_Declarations : constant Declarations :=
(Variables => No_Variable,
Attributes => No_Variable,
Arrays => No_Array,
Packages => No_Package);
-- Default value of Declarations: indicates that there is no declarations
type Package_Element is record
Name : Name_Id := No_Name;
Decl : Declarations := No_Declarations;
Parent : Package_Id := No_Package;
Next : Package_Id := No_Package;
end record;
-- A package (includes declarations that may include other packages)
package Package_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Package_Element,
Table_Index_Type => Package_Id,
Table_Low_Bound => 1,
Table_Initial => 100,
Table_Increment => 100);
-- The table that contains all packages
function Image (Casing : Casing_Type) return String;
-- Similar to 'Image (but avoid use of this attribute in compiler)
function Value (Image : String) return Casing_Type;
-- Similar to 'Value (but avoid use of this attribute in compiler)
-- Raises Constraint_Error if not a Casing_Type image.
-- The following record contains data for a naming scheme
type Naming_Data is record
Dot_Replacement : Name_Id := No_Name;
-- The string to replace '.' in the source file name (for Ada)
Dot_Repl_Loc : Source_Ptr := No_Location;
-- The position in the project file source where Dot_Replacement is
-- defined.
Casing : Casing_Type := All_Lower_Case;
-- The casing of the source file name (for Ada)
Spec_Suffix : Array_Element_Id := No_Array_Element;
-- The string to append to the unit name for the
-- source file name of a spec.
-- Indexed by the programming language.
Ada_Spec_Suffix : Name_Id := No_Name;
-- The suffix of the Ada spec sources
Spec_Suffix_Loc : Source_Ptr := No_Location;
-- The position in the project file source where
-- Ada_Spec_Suffix is defined.
Impl_Suffixes : Impl_Suffix_Array := No_Impl_Suffixes;
Supp_Suffixes : Supp_Language_Index := No_Supp_Language_Index;
-- The source suffixes of the different languages
Body_Suffix : Array_Element_Id := No_Array_Element;
-- The string to append to the unit name for the
-- source file name of a body.
-- Indexed by the programming language.
Ada_Body_Suffix : Name_Id := No_Name;
-- The suffix of the Ada body sources
Body_Suffix_Loc : Source_Ptr := No_Location;
-- The position in the project file source where
-- Ada_Body_Suffix is defined.
Separate_Suffix : Name_Id := No_Name;
-- String to append to unit name for source file name of an Ada subunit
Sep_Suffix_Loc : Source_Ptr := No_Location;
-- Position in the project file source where Separate_Suffix is defined
Specs : Array_Element_Id := No_Array_Element;
-- An associative array mapping individual specs to source file names
-- This is specific to Ada.
Bodies : Array_Element_Id := No_Array_Element;
-- An associative array mapping individual bodies to source file names
-- This is specific to Ada.
Specification_Exceptions : Array_Element_Id := No_Array_Element;
-- An associative array listing spec file names that do not have the
-- spec suffix. Not used by Ada. Indexed by programming language name.
Implementation_Exceptions : Array_Element_Id := No_Array_Element;
-- An associative array listing body file names that do not have the
-- body suffix. Not used by Ada. Indexed by programming language name.
end record;
function Standard_Naming_Data
(Tree : Project_Tree_Ref := No_Project_Tree) return Naming_Data;
pragma Inline (Standard_Naming_Data);
-- The standard GNAT naming scheme when Tree is No_Project_Tree.
-- Otherwise, return the default naming scheme for the project tree Tree,
-- which must have been Initialized.
function Same_Naming_Scheme
(Left, Right : Naming_Data) return Boolean;
-- Returns True if Left and Right are the same naming scheme
-- not considering Specs and Bodies.
type Project_List is new Nat;
Empty_Project_List : constant Project_List := 0;
-- A list of project files
type Project_Element is record
Project : Project_Id := No_Project;
Next : Project_List := Empty_Project_List;
end record;
-- Element in a list of project files. Next is the id of the next
-- project file in the list.
package Project_List_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Project_Element,
Table_Index_Type => Project_List,
Table_Low_Bound => 1,
Table_Initial => 100,
Table_Increment => 100);
-- The table that contains the lists of project files
-- The following record describes a project file representation
type Project_Data is record
Externally_Built : Boolean := False;
Languages : Languages_In_Project := No_Languages;
Supp_Languages : Supp_Language_Index := No_Supp_Language_Index;
-- Indicate the different languages of the source of this project
First_Referred_By : Project_Id := No_Project;
-- The project, if any, that was the first to be known as importing or
-- extending this project. Set by Prj.Proc.Process.
Name : Name_Id := No_Name;
-- The name of the project. Set by Prj.Proc.Process
Display_Name : Name_Id := No_Name;
-- The name of the project with the spelling of its declaration.
-- Set by Prj.Proc.Process.
Path_Name : Name_Id := No_Name;
-- The path name of the project file. Set by Prj.Proc.Process
Display_Path_Name : Name_Id := No_Name;
-- The path name used for display purposes. May be different from
-- Path_Name for platforms where the file names are case-insensitive.
Virtual : Boolean := False;
-- True for virtual extending projects
Location : Source_Ptr := No_Location;
-- The location in the project file source of the reserved word
-- project. Set by Prj.Proc.Process.
Mains : String_List_Id := Nil_String;
-- List of mains specified by attribute Main. Set by Prj.Nmsc.Check
Directory : Name_Id := No_Name;
-- Directory where the project file resides. Set by Prj.Proc.Process
Display_Directory : Name_Id := No_Name;
-- comment ???
Dir_Path : String_Access;
-- Same as Directory, but as an access to String. Set by
-- Make.Compile_Sources.Collect_Arguments_And_Compile.
Library : Boolean := False;
-- True if this is a library project. Set by
-- Prj.Nmsc.Language_Independent_Check.
Library_Dir : Name_Id := No_Name;
-- If a library project, directory where resides the library Set by
-- Prj.Nmsc.Language_Independent_Check.
Display_Library_Dir : Name_Id := No_Name;
-- The name of the library directory, for display purposes. May be
-- different from Library_Dir for platforms where the file names are
-- case-insensitive.
Library_TS : Time_Stamp_Type := Empty_Time_Stamp;
-- The timestamp of a library file in a library project.
-- Set by MLib.Prj.Check_Library.
Library_Src_Dir : Name_Id := No_Name;
-- If a Stand-Alone Library project, directory where the sources
-- of the interfaces of the library are copied. By default, if
-- attribute Library_Src_Dir is not specified, sources of the interfaces
-- are not copied anywhere. Set by Prj.Nmsc.Check_Stand_Alone_Library.
Display_Library_Src_Dir : Name_Id := No_Name;
-- The name of the library source directory, for display purposes.
-- May be different from Library_Src_Dir for platforms where the file
-- names are case-insensitive.
Library_ALI_Dir : Name_Id := No_Name;
-- In a library project, directory where the ALI files are copied.
-- If attribute Library_ALI_Dir is not specified, ALI files are
-- copied in the Library_Dir. Set by Prj.Nmsc.Check_Library_Attributes.
Display_Library_ALI_Dir : Name_Id := No_Name;
-- The name of the library ALI directory, for display purposes. May be
-- different from Library_ALI_Dir for platforms where the file names are
-- case-insensitive.
Library_Name : Name_Id := No_Name;
-- If a library project, name of the library
-- Set by Prj.Nmsc.Language_Independent_Check.
Library_Kind : Lib_Kind := Static;
-- If a library project, kind of library
-- Set by Prj.Nmsc.Language_Independent_Check.
Lib_Internal_Name : Name_Id := No_Name;
-- If a library project, internal name store inside the library Set by
-- Prj.Nmsc.Language_Independent_Check.
Standalone_Library : Boolean := False;
-- Indicate that this is a Standalone Library Project File. Set by
-- Prj.Nmsc.Check.
Lib_Interface_ALIs : String_List_Id := Nil_String;
-- For Standalone Library Project Files, indicate the list of Interface
-- ALI files. Set by Prj.Nmsc.Check.
Lib_Auto_Init : Boolean := False;
-- For non static Standalone Library Project Files, indicate if
-- the library initialisation should be automatic.
Symbol_Data : Symbol_Record := No_Symbols;
-- Symbol file name, reference symbol file name, symbol policy
Ada_Sources_Present : Boolean := True;
-- A flag that indicates if there are Ada sources in this project file.
-- There are no sources if any of the following is true:
-- 1) Source_Dirs is specified as an empty list
-- 2) Source_Files is specified as an empty list
-- 3) Ada is not in the list of the specified Languages
Other_Sources_Present : Boolean := True;
-- A flag that indicates that there are non-Ada sources in this project
Sources : String_List_Id := Nil_String;
-- The list of all the source file names.
-- Set by Prj.Nmsc.Check_Ada_Naming_Scheme.
First_Other_Source : Other_Source_Id := No_Other_Source;
Last_Other_Source : Other_Source_Id := No_Other_Source;
-- Head and tail of the list of sources of languages other than Ada
Imported_Directories_Switches : Argument_List_Access := null;
-- List of the -I switches to be used when compiling sources of
-- languages other than Ada.
Include_Path : String_Access := null;
-- Value to be used as CPATH, when using a GCC, instead of a list of
-- -I switches.
Include_Data_Set : Boolean := False;
-- Set True when Imported_Directories_Switches or Include_Path are set
Source_Dirs : String_List_Id := Nil_String;
-- The list of all the source directories.
-- Set by Prj.Nmsc.Language_Independent_Check.
Known_Order_Of_Source_Dirs : Boolean := True;
-- False, if there is any /** in the Source_Dirs, because in this case
-- the ordering of the source subdirs depend on the OS. If True,
-- duplicate file names in the same project file are allowed.
Object_Directory : Name_Id := No_Name;
-- The object directory of this project file.
-- Set by Prj.Nmsc.Language_Independent_Check.
Display_Object_Dir : Name_Id := No_Name;
-- The name of the object directory, for display purposes.
-- May be different from Object_Directory for platforms where the file
-- names are case-insensitive.
Exec_Directory : Name_Id := No_Name;
-- The exec directory of this project file. Default is equal to
-- Object_Directory. Set by Prj.Nmsc.Language_Independent_Check.
Display_Exec_Dir : Name_Id := No_Name;
-- The name of the exec directory, for display purposes. May be
-- different from Exec_Directory for platforms where the file names are
-- case-insensitive.
Extends : Project_Id := No_Project;
-- The reference of the project file, if any, that this project file
-- extends. Set by Prj.Proc.Process.
Extended_By : Project_Id := No_Project;
-- The reference of the project file, if any, that extends this project
-- file. Set by Prj.Proc.Process.
Naming : Naming_Data := Standard_Naming_Data;
-- The naming scheme of this project file.
-- Set by Prj.Nmsc.Check_Naming_Scheme.
First_Language_Processing : First_Language_Processing_Data :=
Default_First_Language_Processing_Data;
-- Comment needed ???
Supp_Language_Processing : Supp_Language_Index := No_Supp_Language_Index;
-- Comment needed
Default_Linker : Name_Id := No_Name;
Default_Linker_Path : Name_Id := No_Name;
Decl : Declarations := No_Declarations;
-- The declarations (variables, attributes and packages) of this
-- project file. Set by Prj.Proc.Process.
Imported_Projects : Project_List := Empty_Project_List;
-- The list of all directly imported projects, if any. Set by
-- Prj.Proc.Process.
All_Imported_Projects : Project_List := Empty_Project_List;
-- The list of all projects imported directly or indirectly, if any.
-- Set by Make.Initialize.
Ada_Include_Path : String_Access := null;
-- The cached value of ADA_INCLUDE_PATH for this project file. Do not
-- use this field directly outside of the compiler, use
-- Prj.Env.Ada_Include_Path instead. Set by Prj.Env.Ada_Include_Path.
Ada_Objects_Path : String_Access := null;
-- The cached value of ADA_OBJECTS_PATH for this project file. Do not
-- use this field directly outside of the compiler, use
-- Prj.Env.Ada_Objects_Path instead. Set by Prj.Env.Ada_Objects_Path
Include_Path_File : Name_Id := No_Name;
-- The cached value of the source path temp file for this project file.
-- Set by gnatmake (Prj.Env.Set_Ada_Paths).
Objects_Path_File_With_Libs : Name_Id := No_Name;
-- The cached value of the object path temp file (including library
-- dirs) for this project file. Set by gnatmake (Prj.Env.Set_Ada_Paths).
Objects_Path_File_Without_Libs : Name_Id := No_Name;
-- The cached value of the object path temp file (excluding library
-- dirs) for this project file. Set by gnatmake (Prj.Env.Set_Ada_Paths).
Config_File_Name : Name_Id := No_Name;
-- The name of the configuration pragmas file, if any.
-- Set by gnatmake (Prj.Env.Create_Config_Pragmas_File).
Config_File_Temp : Boolean := False;
-- An indication that the configuration pragmas file is
-- a temporary file that must be deleted at the end.
-- Set by gnatmake (Prj.Env.Create_Config_Pragmas_File).
Config_Checked : Boolean := False;
-- A flag to avoid checking repetitively the configuration pragmas file.
-- Set by gnatmake (Prj.Env.Create_Config_Pragmas_File).
Language_Independent_Checked : Boolean := False;
-- A flag that indicates that the project file has been checked
-- for language independent features: Object_Directory,
-- Source_Directories, Library, non empty Naming Suffixes.
Checked : Boolean := False;
-- A flag to avoid checking repetitively the naming scheme of
-- this project file. Set by Prj.Nmsc.Check_Ada_Naming_Scheme.
Seen : Boolean := False;
-- A flag to mark a project as "visited" to avoid processing the same
-- project several time.
Need_To_Build_Lib : Boolean := False;
-- Indicates that the library of a Library Project needs to be built or
-- rebuilt.
Depth : Natural := 0;
-- The maximum depth of a project in the project graph.
-- Depth of main project is 0.
Unkept_Comments : Boolean := False;
-- True if there are comments in the project sources that cannot
-- be kept in the project tree.
end record;
function Empty_Project (Tree : Project_Tree_Ref) return Project_Data;
-- Return the representation of an empty project in project Tree tree.
-- The project tree Tree must have been Initialized and/or Reset.
Project_Error : exception;
-- Raised by some subprograms in Prj.Attr
package Project_Table is new GNAT.Dynamic_Tables (
Table_Component_Type => Project_Data,
Table_Index_Type => Project_Id,
Table_Low_Bound => 1,
Table_Initial => 100,
Table_Increment => 100);
-- The set of all project files
type Spec_Or_Body is
(Specification, Body_Part);
type File_Name_Data is record
Name : Name_Id := No_Name;
Index : Int := 0;
Display_Name : Name_Id := No_Name;
Path : Name_Id := No_Name;
Display_Path : Name_Id := No_Name;
Project : Project_Id := No_Project;
Needs_Pragma : Boolean := False;
end record;
-- File and Path name of a spec or body
type File_Names_Data is array (Spec_Or_Body) of File_Name_Data;
type Unit_Id is new Nat;
No_Unit : constant Unit_Id := 0;
type Unit_Data is record
Name : Name_Id := No_Name;
File_Names : File_Names_Data;
end record;
-- Name and File and Path names of a unit, with a reference to its
-- GNAT Project File(s).
package Unit_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Unit_Data,
Table_Index_Type => Unit_Id,
Table_Low_Bound => 1,
Table_Initial => 100,
Table_Increment => 100);
-- Table of all units in a project tree
package Units_Htable is new Simple_HTable
(Header_Num => Header_Num,
Element => Unit_Id,
No_Element => No_Unit,
Key => Name_Id,
Hash => Hash,
Equal => "=");
-- Mapping of unit names to indexes in the Units table
type Unit_Project is record
Unit : Unit_Id := No_Unit;
Project : Project_Id := No_Project;
end record;
No_Unit_Project : constant Unit_Project := (No_Unit, No_Project);
package Files_Htable is new Simple_HTable
(Header_Num => Header_Num,
Element => Unit_Project,
No_Element => No_Unit_Project,
Key => Name_Id,
Hash => Hash,
Equal => "=");
-- Mapping of file names to indexes in the Units table
type Private_Project_Tree_Data is private;
-- Data for a project tree that is used only by the Project Manager
type Project_Tree_Data is
record
Present_Languages : Present_Language_Table.Instance;
Supp_Suffixes : Supp_Suffix_Table.Instance;
Name_Lists : Name_List_Table.Instance;
Supp_Languages : Supp_Language_Table.Instance;
Other_Sources : Other_Source_Table.Instance;
String_Elements : String_Element_Table.Instance;
Variable_Elements : Variable_Element_Table.Instance;
Array_Elements : Array_Element_Table.Instance;
Arrays : Array_Table.Instance;
Packages : Package_Table.Instance;
Project_Lists : Project_List_Table.Instance;
Projects : Project_Table.Instance;
Units : Unit_Table.Instance;
Units_HT : Units_Htable.Instance;
Files_HT : Files_Htable.Instance;
Private_Part : Private_Project_Tree_Data;
end record;
-- Data for a project tree
type Put_Line_Access is access procedure
(Line : String;
Project : Project_Id;
In_Tree : Project_Tree_Ref);
-- Use to customize error reporting in Prj.Proc and Prj.Nmsc
procedure Expect (The_Token : Token_Type; Token_Image : String);
-- Check that the current token is The_Token. If it is not, then
-- output an error message.
procedure Initialize (Tree : Project_Tree_Ref);
-- This procedure must be called before using any services from the Prj
-- hierarchy. Namet.Initialize must be called before Prj.Initialize.
procedure Reset (Tree : Project_Tree_Ref);
-- This procedure resets all the tables that are used when processing a
-- project file tree. Initialize must be called before the call to Reset.
procedure Register_Default_Naming_Scheme
(Language : Name_Id;
Default_Spec_Suffix : Name_Id;
Default_Body_Suffix : Name_Id;
In_Tree : Project_Tree_Ref);
-- Register the default suffixes for a given language. These extensions
-- will be ignored if the user has specified a new naming scheme in a
-- project file.
--
-- Otherwise, this information will be automatically added to Naming_Data
-- when a project is processed, in the lists Spec_Suffix and Body_Suffix.
generic
type State is limited private;
with procedure Action
(Project : Project_Id;
With_State : in out State);
procedure For_Every_Project_Imported
(By : Project_Id;
In_Tree : Project_Tree_Ref;
With_State : in out State);
-- Call Action for each project imported directly or indirectly by project
-- By. Action is called according to the order of importation: if A
-- imports B, directly or indirectly, Action will be called for A before
-- it is called for B. If two projects import each other directly or
-- indirectly (using at least one "limited with"), it is not specified
-- for which of these two projects Action will be called first. Projects
-- that are extended by other projects are not considered. With_State may
-- be used by Action to choose a behavior or to report some global result.
----------------------------------------------------------
-- Other multi-language stuff that may be modified soon --
----------------------------------------------------------
function Is_Present
(Language : Language_Index;
In_Project : Project_Data;
In_Tree : Project_Tree_Ref) return Boolean;
-- Return True when Language is one of the languages used in
-- project In_Project.
procedure Set
(Language : Language_Index;
Present : Boolean;
In_Project : in out Project_Data;
In_Tree : Project_Tree_Ref);
-- Indicate if Language is or not a language used in project In_Project
function Language_Processing_Data_Of
(Language : Language_Index;
In_Project : Project_Data;
In_Tree : Project_Tree_Ref) return Language_Processing_Data;
-- Return the Language_Processing_Data for language Language in project
-- In_Project. Return the default when no Language_Processing_Data are
-- defined for the language.
procedure Set
(Language_Processing : Language_Processing_Data;
For_Language : Language_Index;
In_Project : in out Project_Data;
In_Tree : Project_Tree_Ref);
-- Set the Language_Processing_Data for language Language in project
-- In_Project.
function Suffix_Of
(Language : Language_Index;
In_Project : Project_Data;
In_Tree : Project_Tree_Ref) return Name_Id;
-- Return the suffix for language Language in project In_Project. Return
-- No_Name when no suffix is defined for the language.
procedure Set
(Suffix : Name_Id;
For_Language : Language_Index;
In_Project : in out Project_Data;
In_Tree : Project_Tree_Ref);
-- Set the suffix for language Language in project In_Project
private
All_Packages : constant String_List_Access := null;
No_Project_Tree : constant Project_Tree_Ref := null;
Ignored : constant Variable_Kind := Single;
Nil_Variable_Value : constant Variable_Value :=
(Project => No_Project,
Kind => Undefined,
Location => No_Location,
Default => False);
Virtual_Prefix : constant String := "v$";
-- The prefix for virtual extending projects. Because of the '$', which is
-- normally forbidden for project names, there cannot be any name clash.
Empty_Name : Name_Id;
-- Name_Id for an empty name (no characters). Initialized by the call
-- to procedure Initialize.
procedure Add_To_Buffer
(S : String;
To : in out String_Access;
Last : in out Natural);
-- Append a String to the Buffer
type Naming_Id is new Nat;
package Naming_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Naming_Data,
Table_Index_Type => Naming_Id,
Table_Low_Bound => 1,
Table_Initial => 5,
Table_Increment => 100);
-- Comment ???
package Path_File_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Name_Id,
Table_Index_Type => Natural,
Table_Low_Bound => 1,
Table_Initial => 50,
Table_Increment => 50);
-- Table storing all the temp path file names.
-- Used by Delete_All_Path_Files.
package Source_Path_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Name_Id,
Table_Index_Type => Natural,
Table_Low_Bound => 1,
Table_Initial => 50,
Table_Increment => 50);
-- A table to store the source dirs before creating the source path file
package Object_Path_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Name_Id,
Table_Index_Type => Natural,
Table_Low_Bound => 1,
Table_Initial => 50,
Table_Increment => 50);
-- A table to store the object dirs, before creating the object path file
type Private_Project_Tree_Data is record
Namings : Naming_Table.Instance;
Path_Files : Path_File_Table.Instance;
Source_Paths : Source_Path_Table.Instance;
Object_Paths : Object_Path_Table.Instance;
Default_Naming : Naming_Data;
end record;
-- Comment ???
end Prj;
|
Templates/prog/assembly.asm | ekovegeance/ComputerScience | 4 | 178738 | <gh_stars>1-10
global _start
section .text
_start:
mov eax, 0x4
mov ebx, 0x1
mov ecx, message
mov edx, 0xF
int 0x80
mov eax, 0x1
mov ebx, 0x0
int 0x80
section .data
message: db "give me a bottle of rum!", 0dh, 0ah
|
pixy/src/host/pantilt_in_ada/specs/x86_64_linux_gnu_sys_sysmacros_h.ads | GambuzX/Pixy-SIW | 1 | 23353 | --
-- Copyright (c) 2015, <NAME> <<EMAIL>>
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above copyright
-- notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
-- TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
-- NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
-- CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-- PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-- ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Extensions;
package x86_64_linux_gnu_sys_sysmacros_h is
-- arg-macro: procedure major (dev)
-- gnu_dev_major (dev)
-- arg-macro: procedure minor (dev)
-- gnu_dev_minor (dev)
-- arg-macro: procedure makedev (maj, min)
-- gnu_dev_makedev (maj, min)
function gnu_dev_major (uu_dev : Extensions.unsigned_long_long) return unsigned; -- /usr/include/x86_64-linux-gnu/sys/sysmacros.h:27
pragma Import (C, gnu_dev_major, "gnu_dev_major");
function gnu_dev_minor (uu_dev : Extensions.unsigned_long_long) return unsigned; -- /usr/include/x86_64-linux-gnu/sys/sysmacros.h:30
pragma Import (C, gnu_dev_minor, "gnu_dev_minor");
function gnu_dev_makedev (uu_major : unsigned; uu_minor : unsigned) return Extensions.unsigned_long_long; -- /usr/include/x86_64-linux-gnu/sys/sysmacros.h:33
pragma Import (C, gnu_dev_makedev, "gnu_dev_makedev");
end x86_64_linux_gnu_sys_sysmacros_h;
|
_build/dispatcher/jmp_ippsSMS4_CCMTagLen_91dbe76c.asm | zyktrcn/ippcp | 1 | 89897 | <reponame>zyktrcn/ippcp
extern m7_ippsSMS4_CCMTagLen:function
extern n8_ippsSMS4_CCMTagLen:function
extern y8_ippsSMS4_CCMTagLen:function
extern e9_ippsSMS4_CCMTagLen:function
extern l9_ippsSMS4_CCMTagLen:function
extern n0_ippsSMS4_CCMTagLen:function
extern k0_ippsSMS4_CCMTagLen:function
extern ippcpJumpIndexForMergedLibs
extern ippcpSafeInit:function
segment .data
align 8
dq .Lin_ippsSMS4_CCMTagLen
.Larraddr_ippsSMS4_CCMTagLen:
dq m7_ippsSMS4_CCMTagLen
dq n8_ippsSMS4_CCMTagLen
dq y8_ippsSMS4_CCMTagLen
dq e9_ippsSMS4_CCMTagLen
dq l9_ippsSMS4_CCMTagLen
dq n0_ippsSMS4_CCMTagLen
dq k0_ippsSMS4_CCMTagLen
segment .text
global ippsSMS4_CCMTagLen:function (ippsSMS4_CCMTagLen.LEndippsSMS4_CCMTagLen - ippsSMS4_CCMTagLen)
.Lin_ippsSMS4_CCMTagLen:
db 0xf3, 0x0f, 0x1e, 0xfa
call ippcpSafeInit wrt ..plt
align 16
ippsSMS4_CCMTagLen:
db 0xf3, 0x0f, 0x1e, 0xfa
mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc]
movsxd rax, dword [rax]
lea r11, [rel .Larraddr_ippsSMS4_CCMTagLen]
mov r11, qword [r11+rax*8]
jmp r11
.LEndippsSMS4_CCMTagLen:
|
test/ir/countDigits.asm | shivansh/gogo | 24 | 104643 | <gh_stars>10-100
.data
nStr: .asciiz "Enter n: "
n: .word 0
count: .word 0
str: .asciiz "Number of digits in n: "
.text
runtime:
addi $sp, $sp, -4
sw $ra, 0($sp)
lw $ra, 0($sp)
addi $sp, $sp, 4
jr $ra
.end runtime
.globl main
.ent main
main:
li $2, 4
la $4, nStr
syscall
li $2, 5
syscall
move $3, $2
sw $3, n # spilled n, freed $3
li $3, 0 # count -> $3
# Store dirty variables back into memory
sw $3, count
while:
lw $3, n # n -> $3
ble $3, 0, exit
lw $3, n # n -> $3
div $3, $3, 10
sw $3, n # spilled n, freed $3
lw $3, count # count -> $3
addi $3, $3, 1
# Store dirty variables back into memory
sw $3, count
j while
exit:
li $2, 4
la $4, str
syscall
li $2, 1
lw $3, count # count -> $3
move $4, $3
syscall
li $2, 10
syscall
.end main
|
STM8S103F3P6/Project1/RAMVars.asm | edosedgar/stm8s | 2 | 12469 | ;=======RAMMemory($0000-$07FF)================
Temp EQU $0000
Temp1 EQU $0001
Temp2 EQU $0002
Temp3 EQU $0003
Temp4 EQU $0004
Temp5 EQU $0005
Temp6 EQU $0006
Temp7 EQU $0007
Temp8 EQU $0008
Digit1 EQU $0009
Digit2 EQU $000A
Digit3 EQU $000B
Ms250 EQU $000C
Flags EQU $000D
isShowDigits EQU 0
isClock250mS EQU 1
Min10 EQU $000E
Min1 EQU $000F
Hours10 EQU $0010
Hours1 EQU $0011
Null EQU $0012
Check EQU $0013
Sec1 EQU $0014
Sec10 EQU $0015
CorrectTime EQU $0016
;=============================================
END |
programs/oeis/074/A074794.asm | neoneye/loda | 22 | 174452 | ; A074794: Number of numbers k <= n such that tau(k) == 1 (mod 3) where tau(k) = A000005(k) is the number of divisors of k.
; 1,1,1,1,1,2,2,3,3,4,4,4,4,5,6,6,6,6,6,6,7,8,8,8,8,9,10,10,10,10,10,10,11,12,13,13,13,14,15,15,15,15,15,15,15,16,16,17,17,17,18,18,18,18,19,19,20,21,21,21,21,22,22,23,24,24,24,24,25,25,25,25,25,26,26,26,27,27,27,28,28,29,29,29,30,31,32,32,32,32,33,33,34,35,36,36,36,36,36,36
mov $2,$0
add $2,1
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
seq $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n.
sub $0,1
gcd $0,3
mov $3,$0
div $3,2
add $1,$3
lpe
mov $0,$1
|
programs/oeis/063/A063242.asm | karttu/loda | 1 | 170866 | <filename>programs/oeis/063/A063242.asm
; A063242: Dimension of the space of weight 2n cuspidal newforms for Gamma_0( 92 ).
; 2,6,8,14,16,20,24,28,30,36,38,42,46,50,52,58,60,64,68,72,74,80,82,86,90,94,96,102,104,108,112,116,118,124,126,130,134,138,140,146,148,152,156,160,162,168,170,174,178,182
mov $1,32
add $1,$0
div $0,2
mul $0,8
mul $1,15
sub $1,$0
sub $1,474
div $1,6
mul $1,2
|
src/Categories/Object/Exponential.agda | MirceaS/agda-categories | 0 | 17221 | {-# OPTIONS --without-K --safe #-}
open import Categories.Category
-- Exponential Object
-- TODO: Where is the notation from? It is neither from Wikipedia nor the nLab.
module Categories.Object.Exponential {o ℓ e} (𝒞 : Category o ℓ e) where
open Category 𝒞
open import Level
open import Function using (_$_)
open import Categories.Morphism.Reasoning 𝒞
open import Categories.Object.Product 𝒞
hiding (repack; repack≡id; repack∘; repack-cancel; up-to-iso; transport-by-iso)
open import Categories.Morphism 𝒞
open HomReasoning
private
variable
A B C D X Y : Obj
record Exponential (A B : Obj) : Set (o ⊔ ℓ ⊔ e) where
field
B^A : Obj
product : Product B^A A
module product = Product product
B^A×A : Obj
B^A×A = product.A×B
field
eval : B^A×A ⇒ B
λg : ∀ (X×A : Product X A) → (Product.A×B X×A ⇒ B) → (X ⇒ B^A)
β : ∀ (X×A : Product X A) {g : Product.A×B X×A ⇒ B} →
(eval ∘ [ X×A ⇒ product ] λg X×A g ×id ≈ g)
λ-unique : ∀ (X×A : Product X A) {g : Product.A×B X×A ⇒ B} {h : X ⇒ B^A} →
(eval ∘ [ X×A ⇒ product ] h ×id ≈ g) → (h ≈ λg X×A g)
η : ∀ (X×A : Product X A) {f : X ⇒ B^A } → λg X×A (eval ∘ [ X×A ⇒ product ] f ×id) ≈ f
η X×A {f} = sym (λ-unique X×A refl)
λ-cong : ∀ {X : Obj} (X×A : Product X A) {f g} →
f ≈ g → λg X×A f ≈ λg X×A g
λ-cong X×A {f = f} {g = g} f≡g = λ-unique X×A (trans (β X×A) f≡g)
subst : ∀ (p₂ : Product C A) (p₃ : Product D A) {f g} →
λg p₃ f ∘ g ≈ λg p₂ (f ∘ [ p₂ ⇒ p₃ ] g ×id)
subst p₂ p₃ {f} {g} = λ-unique p₂ (begin
eval ∘ [ p₂ ⇒ product ] λg p₃ f ∘ g ×id
≈˘⟨ refl⟩∘⟨ [ p₂ ⇒ p₃ ⇒ product ]×id∘×id ⟩
eval ∘ [ p₃ ⇒ product ] λg p₃ f ×id ∘ [ p₂ ⇒ p₃ ] g ×id
≈⟨ pullˡ (β p₃) ⟩
f ∘ [ p₂ ⇒ p₃ ] g ×id ∎)
η-id : λg product eval ≈ id
η-id = begin
λg product eval ≈˘⟨ identityʳ ⟩
λg product eval ∘ id ≈⟨ subst _ _ ⟩
λg product (eval ∘ [ product ⇒ product ] id ×id) ≈⟨ η product ⟩
id ∎
λ-unique′ : ∀ (X×A : Product X A) {h i : X ⇒ B^A} →
eval ∘ [ X×A ⇒ product ] h ×id ≈ eval ∘ [ X×A ⇒ product ] i ×id → h ≈ i
λ-unique′ p eq = trans (λ-unique p eq) (sym (λ-unique p refl))
-- some aliases to make proof signatures less ugly
[_]eval : ∀{A B}(e₁ : Exponential A B) → Exponential.B^A×A e₁ ⇒ B
[ e₁ ]eval = Exponential.eval e₁
[_]λ : ∀{A B}(e₁ : Exponential A B)
→ {X : Obj} → (X×A : Product X A) → (Product.A×B X×A ⇒ B) → (X ⇒ Exponential.B^A e₁)
[ e₁ ]λ = Exponential.λg e₁
{-
D×C --id × f--> D×A --g--> B
D --λ (g ∘ id × f)--> B^C
\ ^
\ /
λ g λ (e ∘ id × f)
\ /
v /
B^A
-}
λ-distrib : ∀ (e₁ : Exponential C B) (e₂ : Exponential A B)
(p₃ : Product D C) (p₄ : Product D A) (p₅ : Product (Exponential.B^A e₂) C)
{f} {g : Product.A×B p₄ ⇒ B} →
[ e₁ ]λ p₃ (g ∘ [ p₃ ⇒ p₄ ]id× f)
≈ [ e₁ ]λ p₅ ([ e₂ ]eval ∘ [ p₅ ⇒ Exponential.product e₂ ]id× f) ∘ [ e₂ ]λ p₄ g
λ-distrib e₁ e₂ p₃ p₄ p₅ {f} {g} = sym $ e₁.λ-unique p₃ $ begin
[ e₁ ]eval ∘ ([ p₃ ⇒ p₁ ] [ e₁ ]λ p₅ ([ e₂ ]eval ∘ [ p₅ ⇒ p₂ ]id× f) ∘ [ e₂ ]λ p₄ g ×id)
≈˘⟨ refl⟩∘⟨ [ p₃ ⇒ p₅ ⇒ p₁ ]×id∘×id ⟩
[ e₁ ]eval ∘ [ p₅ ⇒ p₁ ] [ e₁ ]λ p₅ ([ e₂ ]eval ∘ [ p₅ ⇒ p₂ ]id× f) ×id
∘ [ p₃ ⇒ p₅ ] [ e₂ ]λ p₄ g ×id
≈⟨ pullˡ (e₁.β p₅) ⟩
([ e₂ ]eval ∘ [ p₅ ⇒ p₂ ]id× f)
∘ [ p₃ ⇒ p₅ ] [ e₂ ]λ p₄ g ×id
≈⟨ assoc ⟩
[ e₂ ]eval ∘ [ p₅ ⇒ p₂ ]id× f
∘ [ p₃ ⇒ p₅ ] [ e₂ ]λ p₄ g ×id
≈˘⟨ refl⟩∘⟨ [ p₄ ⇒ p₂ , p₃ ⇒ p₅ ]first↔second ⟩
[ e₂ ]eval ∘ [ p₄ ⇒ p₂ ] [ e₂ ]λ p₄ g ×id ∘ [ p₃ ⇒ p₄ ]id× f
≈⟨ pullˡ (e₂.β p₄) ⟩
g ∘ [ p₃ ⇒ p₄ ]id× f ∎
where module e₁ = Exponential e₁
module e₂ = Exponential e₂
p₁ = e₁.product
p₂ = e₂.product
repack : ∀{A B} (e₁ e₂ : Exponential A B) → Exponential.B^A e₁ ⇒ Exponential.B^A e₂
repack e₁ e₂ = e₂.λg e₁.product e₁.eval
where
module e₁ = Exponential e₁
module e₂ = Exponential e₂
repack≡id : ∀{A B} (e : Exponential A B) → repack e e ≈ id
repack≡id = Exponential.η-id
repack∘ : ∀ (e₁ e₂ e₃ : Exponential A B) → repack e₂ e₃ ∘ repack e₁ e₂ ≈ repack e₁ e₃
repack∘ e₁ e₂ e₃ =
let p₁ = product e₁ in
let p₂ = product e₂ in
begin
[ e₃ ]λ p₂ [ e₂ ]eval
∘ [ e₂ ]λ p₁ [ e₁ ]eval
≈⟨ λ-cong e₃ p₂ (introʳ (second-id p₂)) ⟩∘⟨refl ⟩
[ e₃ ]λ p₂ ([ e₂ ]eval ∘ [ p₂ ⇒ p₂ ]id× id)
∘ [ e₂ ]λ p₁ [ e₁ ]eval
≈˘⟨ λ-distrib e₃ e₂ p₁ p₁ p₂ ⟩
[ e₃ ]λ p₁ ([ e₁ ]eval ∘ [ p₁ ⇒ p₁ ]id× id)
≈⟨ λ-cong e₃ p₁ (⟺ (introʳ (second-id (product e₁)))) ⟩
[ e₃ ]λ p₁ [ e₁ ]eval
∎
where open Exponential
repack-cancel : ∀{A B} (e₁ e₂ : Exponential A B) → repack e₁ e₂ ∘ repack e₂ e₁ ≈ id
repack-cancel e₁ e₂ = repack∘ e₂ e₁ e₂ ○ repack≡id e₂
up-to-iso : ∀{A B} (e₁ e₂ : Exponential A B) → Exponential.B^A e₁ ≅ Exponential.B^A e₂
up-to-iso e₁ e₂ = record
{ from = repack e₁ e₂
; to = repack e₂ e₁
; iso = record
{ isoˡ = repack-cancel e₂ e₁
; isoʳ = repack-cancel e₁ e₂
}
}
transport-by-iso : ∀ (e : Exponential A B) → Exponential.B^A e ≅ X → Exponential A B
transport-by-iso {X = X} e e≅X = record
{ B^A = X
; product = X×A
; eval = e.eval
; λg = λ Y×A Y×A⇒B → from ∘ (e.λg Y×A Y×A⇒B)
; β = λ Y×A {h} → begin
e.eval ∘ [ Y×A ⇒ X×A ] from ∘ e.λg Y×A h ×id ≈⟨ refl⟩∘⟨ e.product.⟨⟩-cong₂ (pullˡ (cancelˡ isoˡ))
(elimˡ refl) ⟩
e.eval ∘ [ Y×A ⇒ e.product ] e.λg Y×A h ×id ≈⟨ e.β Y×A ⟩
h ∎
; λ-unique = λ Y×A {h} {i} eq →
switch-tofromˡ e≅X $ e.λ-unique Y×A $ begin
e.eval ∘ [ Y×A ⇒ e.product ] to ∘ i ×id ≈⟨ refl⟩∘⟨ e.product.⟨⟩-cong₂ assoc (introˡ refl) ⟩
e.eval ∘ [ Y×A ⇒ X×A ] i ×id ≈⟨ eq ⟩
h ∎
}
where module e = Exponential e
X×A = Mobile e.product e≅X ≅.refl
open _≅_ e≅X
|
CPU/cpu_test/test_storage/test3_ori_R.asm | SilenceX12138/MIPS-Microsystems | 55 | 22057 | <reponame>SilenceX12138/MIPS-Microsystems
ori $2,$0,202
ori $3,$0,241
addu $1,$2,$3
ori $4,$1,233
ori $5,$0,993
addu $6,$5,$4
nop
ori $7,$6,928 |
oeis/071/A071295.asm | neoneye/loda-programs | 11 | 88405 | ; A071295: Product of numbers of 0's and 1's in binary representation of n.
; Submitted by <NAME>
; 0,0,1,0,2,2,2,0,3,4,4,3,4,3,3,0,4,6,6,6,6,6,6,4,6,6,6,4,6,4,4,0,5,8,8,9,8,9,9,8,8,9,9,8,9,8,8,5,8,9,9,8,9,8,8,5,9,8,8,5,8,5,5,0,6,10,10,12,10,12,12,12,10,12,12,12,12,12,12,10,10,12,12,12,12,12,12,10,12,12,12,10,12,10,10,6,10,12,12,12
mov $1,$0
mov $0,0
mov $2,2
lpb $2
sub $2,1
mov $3,$1
lpb $3
mov $5,$3
div $3,2
mod $5,2
cmp $5,$2
add $4,$5
lpe
lpb $4
add $3,$0
add $0,$2
sub $4,1
lpe
lpe
mov $0,$3
|
test/Fail/Issue3318-3.agda | shlevy/agda | 1,989 | 13960 | primitive
primLevelMax : _
|
programs/oeis/040/A040042.asm | neoneye/loda | 22 | 84949 | <reponame>neoneye/loda
; A040042: Continued fraction for sqrt(50) = 5*sqrt(2).
; 7,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14
pow $1,$0
gcd $1,2
mul $1,7
mov $0,$1
|
src/hardware/hardware-beacon.adb | kisom/rover-mk1 | 0 | 9988 | with Interfaces; use Interfaces;
package body Hardware.Beacon is
procedure Init (Tick_Size : Interfaces.Unsigned_8) is
begin
Resolution := Tick_Size;
MCU.DDRH_Bits (LED1_Bit) := DD_Output;
MCU.DDRH_Bits (LED2_Bit) := DD_Output;
LED1 := Low;
LED2 := Low;
Tick := 0;
Counter := 0;
end Init;
procedure Trigger is
begin
if Tick >= Resolution then
if Counter = 0 then
LED1 := High;
LED2 := High;
Counter := Counter + 1;
elsif Counter = 1 then
LED1 := Low;
LED2 := Low;
Counter := Counter + 1;
elsif Counter = 10 then
Counter := 0;
else
Counter := Counter + 1;
end if;
Tick := 0;
else
Tick := Tick + 1;
end if;
end Trigger;
end Hardware.Beacon;
|
Homework Submission/Homework 1/homework 1 Q1.asm | FariaIslamHridy/CSE331L-Section-10-Fall20-NSU | 0 | 87407 | <reponame>FariaIslamHridy/CSE331L-Section-10-Fall20-NSU<gh_stars>0
org 100h
MOV AX, 4 ;First int
MOV BX, 6 ;Second int
MOV CX, 8 ;Third int
ADD BX, AX ;ADD and store in BX register
ADD CX, BX ;ADD and store in CX register
ret |
Microcontroller_Lab/Lab_6/Read_Code.asm | MuhammadAlBarham/pic16f778_projects | 0 | 242412 | <reponame>MuhammadAlBarham/pic16f778_projects
Include "p16F84A.inc"
; ----------------------------------------------------------
; General Purpose RAM Assignments
; ----------------------------------------------------------
cblock 0x0C
Counter
Endc
; ----------------------------------------------------------
; Macro Definitions
; ----------------------------------------------------------
Read_EEPROM macro
Bcf STATUS, RP0
Clrf EEADR
Bsf STATUS, RP0
Bsf EECON1, RD
Bcf STATUS, RP0
Endm
; ----------------------------------------------------------
; Vector definition
; ----------------------------------------------------------
org 0x000
nop
goto Main
INT_Routine org 0x004
goto INT_Routine
; ----------------------------------------------------------
; The main Program
; ----------------------------------------------------------
Main
Read_EEPROM
Clrf Counter
Bsf STATUS, RP0
Clrf TRISB
Bcf STATUS, RP0
Movlw A'H'
Subwf EEDATA,w
Btfsc STATUS,Z
Goto Finish
Incf Counter,f
Movlw A'M'
Subwf EEDATA,w
Btfsc STATUS,Z
Finish
Incf Counter,f
Call Look_Up
Movwf PORTB
Loop
Goto Loop
; ----------------------------------------------------------
; Sub Routine Definitions
; ----------------------------------------------------------
Look_Up
Movf Counter,w
Addwf PCL,f
Retlw B'00111111'
Retlw B'00000110'
Retlw B'01011011'
Retlw B'01001111'
Retlw B'01100110'
Retlw B'01101101'
end
|
misc/RecursiveDescent/Coinductive/Internal.agda | yurrriq/parser-combinators | 7 | 12066 | <reponame>yurrriq/parser-combinators<filename>misc/RecursiveDescent/Coinductive/Internal.agda
------------------------------------------------------------------------
-- A terminating parser data type and the accompanying interpreter
------------------------------------------------------------------------
module RecursiveDescent.Coinductive.Internal where
open import RecursiveDescent.Index
open import Data.Bool
open import Data.Product.Record
open import Data.Maybe
open import Data.BoundedVec.Inefficient
import Data.List as L
open import Data.Nat
open import Category.Applicative.Indexed
open import Category.Monad.Indexed
open import Category.Monad.State
open import Utilities
------------------------------------------------------------------------
-- Parser data type
-- A type for parsers which can be implemented using recursive
-- descent. The types used ensure that the implementation below is
-- structurally recursive.
codata Parser (tok : Set) : ParserType₁ where
symbol : Parser tok (false , leaf) tok
ret : forall {r} -> r -> Parser tok (true , leaf) r
fail : forall {r} -> Parser tok (false , leaf) r
bind₀ : forall {c₁ e₂ c₂ r₁ r₂}
-> Parser tok (true , c₁) r₁
-> (r₁ -> Parser tok (e₂ , c₂) r₂)
-> Parser tok (e₂ , node c₁ c₂) r₂
bind₁ : forall {c₁ r₁ r₂} {i₂ : r₁ -> Index}
-> Parser tok (false , c₁) r₁
-> ((x : r₁) -> Parser tok (i₂ x) r₂)
-> Parser tok (false , step c₁) r₂
alt₀ : forall {c₁ e₂ c₂ r}
-> Parser tok (true , c₁) r
-> Parser tok (e₂ , c₂) r
-> Parser tok (true , node c₁ c₂) r
alt₁ : forall {c₁} e₂ {c₂ r}
-> Parser tok (false , c₁) r
-> Parser tok (e₂ , c₂) r
-> Parser tok (e₂ , node c₁ c₂) r
------------------------------------------------------------------------
-- Run function for the parsers
-- Parser monad.
P : Set -> IFun ℕ
P tok = IStateT (BoundedVec tok) L.List
PIMonadPlus : (tok : Set) -> RawIMonadPlus (P tok)
PIMonadPlus tok = StateTIMonadPlus (BoundedVec tok) L.monadPlus
PIMonadState : (tok : Set) -> RawIMonadState (BoundedVec tok) (P tok)
PIMonadState tok = StateTIMonadState (BoundedVec tok) L.monad
private
open module LM {tok} = RawIMonadPlus (PIMonadPlus tok)
open module SM {tok} = RawIMonadState (PIMonadState tok)
using (get; put; modify)
-- For every successful parse the run function returns the remaining
-- string. (Since there can be several successful parses a list of
-- strings is returned.)
-- This function is structurally recursive with respect to the
-- following lexicographic measure:
--
-- 1) The upper bound of the length of the input string.
-- 2) The parser's proper left corner tree.
mutual
parse : forall n {tok e c r} ->
Parser tok (e , c) r ->
P tok n (if e then n else pred n) r
parse zero symbol = ∅
parse (suc n) symbol = eat =<< get
parse n (ret x) = return x
parse n fail = ∅
parse n (bind₀ p₁ p₂) = parse n p₁ >>= parse n ∘′ p₂
parse zero (bind₁ p₁ p₂) = ∅
parse (suc n) (bind₁ p₁ p₂) = parse (suc n) p₁ >>= parse↑ n ∘′ p₂
parse n (alt₀ p₁ p₂) = parse n p₁ ∣ parse↑ n p₂
parse n (alt₁ true p₁ p₂) = parse↑ n p₁ ∣ parse n p₂
parse n (alt₁ false p₁ p₂) = parse n p₁ ∣ parse n p₂
parse↑ : forall n {e tok c r} -> Parser tok (e , c) r -> P tok n n r
parse↑ n {true} p = parse n p
parse↑ zero {false} p = ∅
parse↑ (suc n) {false} p = parse (suc n) p >>= \r ->
modify ↑ >>
return r
eat : forall {tok n} -> BoundedVec tok (suc n) -> P tok (suc n) n tok
eat [] = ∅
eat (c ∷ s) = put s >> return c
|
cql/src/main/java/com/huawei/streaming/cql/semanticanalyzer/parser/CQLLexer.g4 | chenqixu/StreamCQL | 8 | 2806 | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
/*
* SQL的词法规则
*/
lexer grammar CQLLexer;
@lexer::header {
package com.huawei.streaming.cql.semanticanalyzer.parser;
}
//key words
KW_CREATE : 'CREATE';
KW_SHOW : 'SHOW';
KW_EXPLAIN : 'EXPLAIN';
KW_SET : 'SET';
KW_GET : 'GET';
KW_LOAD : 'LOAD';
KW_EXPORT : 'EXPORT';
KW_DROP : 'DROP';
KW_ADD : 'ADD';
KW_SELECT : 'SELECT';
KW_COMMENT : 'COMMENT';
KW_FORCE : 'FORCE';
KW_SERDE : 'SERDE';
KW_WITH : 'WITH';
KW_PROPERTIES : 'PROPERTIES';
KW_SOURCE : 'SOURCE';
KW_INPUT : 'INPUT';
KW_STREAM : 'STREAM';
KW_OUTPUT : 'OUTPUT';
KW_SINK : 'SINK';
KW_SUBMIT : 'SUBMIT';
KW_APPLICATION : 'APPLICATION';
KW_DISTINCT : 'DISTINCT';
KW_AND : 'AND';
KW_OR : 'OR';
KW_BETWEEN : 'BETWEEN';
KW_IN : 'IN';
KW_LIKE : 'LIKE';
KW_RLIKE : 'RLIKE';
KW_REGEXP : 'REGEXP';
KW_CASE : 'CASE';
KW_WHEN : 'WHEN';
KW_THEN : 'THEN';
KW_ELSE : 'ELSE';
KW_END : 'END';
KW_CAST : 'CAST';
KW_EXISTS : 'EXISTS';
KW_IF : 'IF';
KW_FALSE : 'FALSE';
KW_AS : 'AS';
KW_NULL : 'NULL';
KW_IS : 'IS';
KW_TRUE : 'TRUE';
KW_ALL : 'ALL';
KW_NOT : 'NOT' | '!';
KW_ASC : 'ASC';
KW_DESC : 'DESC';
KW_SORT : 'SORT';
KW_ORDER : 'ORDER';
KW_GROUP : 'GROUP';
KW_BY : 'BY';
KW_HAVING : 'HAVING';
KW_WHERE : 'WHERE';
KW_FROM : 'FROM';
KW_ON : 'ON';
KW_JOIN : 'JOIN';
KW_FULL : 'FULL';
KW_PRESERVE : 'PRESERVE';
KW_OUTER : 'OUTER';
KW_CROSS : 'CROSS';
KW_SEMI : 'SEMI';
KW_LEFT : 'LEFT';
KW_INNER : 'INNER';
KW_NATURAL : 'NATURAL';
KW_RIGHT : 'RIGHT';
KW_INTO : 'INTO';
KW_INSERT : 'INSERT';
KW_OVERWRITE : 'OVERWRITE';
KW_LIMIT : 'LIMIT';
KW_UNION : 'UNION';
KW_APPLICATIONS : 'APPLICATIONS';
KW_WINDOWS : 'WINDOWS';
KW_EXTENDED : 'EXTENDED';
KW_FUNCTIONS : 'FUNCTIONS';
KW_FILE : 'FILE';
KW_INPATH : 'INPATH';
KW_WINDOW : 'WINDOW';
KW_JAR : 'JAR';
KW_FUNCTION : 'FUNCTION';
KW_COMBINE : 'COMBINE';
KW_UNIDIRECTION : 'UNIDIRECTION';
KW_PARALLEL : 'PARALLEL';
KW_TRIGGER : 'TRIGGER';
KW_PARTITION : 'PARTITION';
KW_SLIDE : 'SLIDE';
KW_BATCH : 'BATCH';
KW_RANGE : 'RANGE';
KW_ROWS : 'ROWS';
KW_TODAY : 'TODAY';
KW_UNBOUNDED : 'UNBOUNDED';
KW_EXCLUDE : 'EXCLUDE';
KW_NOW : 'NOW';
KW_PREVIOUS : 'PREVIOUS';
KW_DATASOURCE : 'DATASOURCE';
KW_SCHEMA : 'SCHEMA';
KW_QUERY : 'QUERY';
KW_DEACTIVE : 'DEACTIVE';
KW_ACTIVE : 'ACTIVE';
KW_WORKER : 'WORKER';
KW_REBALANCE : 'REBALANCE';
KW_OPERATOR : 'OPERATOR';
KW_USING : 'USING';
KW_DISTRIBUTE : 'DISTRIBUTE';
/*
窗口时间单位
*/
KW_DAY : 'DAY'|'DAYS';
KW_HOUR : 'HOUR'|'HOURS';
KW_MINUTES : 'MINUTE'|'MINUTES';
KW_SECONDS : 'SECOND'|'SECONDS';
KW_MILLISECONDS : 'MILLISECOND'|'MILLISECONDS';
//DataTypes
KW_BOOLEAN : 'BOOLEAN';
KW_INT : 'INT';
KW_LONG : 'LONG';
KW_FLOAT : 'FLOAT';
KW_DOUBLE : 'DOUBLE';
KW_STRING : 'STRING';
KW_TIMESTAMP : 'TIMESTAMP';
KW_DATE : 'DATE';
KW_TIME : 'TIME';
KW_DECIMAL : 'DECIMAL';
// generated as a part of Number rule
DOT : '.';
COLON : ':' ;
COMMA : ',' ;
SEMICOLON : ';' ;
LPAREN : '(' ;
RPAREN : ')' ;
LSQUARE : '[' ;
RSQUARE : ']' ;
LCURLY : '{';
RCURLY : '}';
EQUAL : '=' | '==';
EQUAL_NS : '<=>';
NOTEQUAL : '<>' | '!=';
LESSTHANOREQUALTO : '<=';
LESSTHAN : '<';
GREATERTHANOREQUALTO : '>=';
GREATERTHAN : '>';
DIVIDE : '/';
PLUS : '+';
MINUS : '-';
CONCATENATION : '||';
STAR : '*';
MOD : '%';
DIV : 'DIV';
TILDE : '~';
BITWISEOR : '|';
AMPERSAND : '&';
BITWISEXOR : '^';
QUESTION : '?';
DOLLAR : '$';
fragment
Letter
: 'a'..'z' | 'A'..'Z'
;
fragment
HexDigit
: 'a'..'f' | 'A'..'F'
;
fragment
Digit
: '0'..'9'
;
fragment
Exponent
: ('e' | 'E') ( PLUS|MINUS )? (Digit)+
;
LongLiteral
: Number 'L'
;
FloatLiteral
: Number 'F'
;
DoubleLiteral
: Number 'D'
;
DecimalLiteral
: Number 'B' 'D'
;
/**
Date、Time、TimeStamp类型比较特殊,不能使用常量,只能用udf函数的方式创建
比如cast函数或者date函数
*/
StringLiteral
: (
'\'' ( ~('\''|'\\') | ('\\' .) )* '\''
| '\"' ( ~('\"'|'\\') | ('\\' .) )* '\"'
)+
;
CharSetLiteral
: StringLiteral
| '0' 'X' (HexDigit|Digit)+
;
IntegerNumber
: (Digit)+
;
Number
: (Digit)+ ( DOT (Digit)* (Exponent)? | Exponent)?
;
Identifier
: (Letter | Digit) (Letter | Digit | '_')*
;
CharSetName
: '_' (Letter | Digit | '_' | '-' | '.' | ':' )+
;
//
// Whitespace and comments
//
WS
: [ \t\r\n\u000C]+ -> skip
;
COMMENT
: '/*' .*? '*/' -> skip
;
LINE_COMMENT
: '--' ~[\r\n]* -> skip
;
|
Library/Chart/CBody/cbodyNotify.asm | steakknife/pcgeos | 504 | 90305 | <reponame>steakknife/pcgeos
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: cbodyNotify.asm
AUTHOR: <NAME>
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 7/ 8/92 Initial version.
DESCRIPTION:
$Id: cbodyNotify.asm,v 1.1 97/04/04 17:48:17 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ChartBodyAttach
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Set the notification OD and message
PASS: *ds:si = ChartBodyClass object
ds:di = ChartBodyClass instance data
es = segment of ChartBodyClass
RETURN:
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
Inc the in-use count, so that the notification OD won't be
discarded (can't just dirty the block)
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 7/ 8/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ChartBodyAttach method dynamic ChartBodyClass,
MSG_CHART_BODY_ATTACH
.enter
call ObjIncInUseCount
movdw ds:[di].CBI_notificationOD, cxdx
mov ds:[di].CBI_notificationMessage, bp
.leave
ret
ChartBodyAttach endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ChartBodyDetach
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION:
PASS: *ds:si = ChartBodyClass object
ds:di = ChartBodyClass instance data
es = segment of ChartBodyClass
RETURN:
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 12/21/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ChartBodyDetach method dynamic ChartBodyClass,
MSG_CHART_BODY_DETACH
call ObjDecInUseCount
ret
ChartBodyDetach endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ChartBodyNotifyChartDeleted
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Remove a chart from the tree
PASS: *ds:si = ChartBodyClass object
ds:di = ChartBodyClass instance data
es = segment of ChartBodyClass
^lcx:dx - child OD
RETURN: nothing
DESTROYED: ax,cx,dx,bp
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 7/ 8/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ChartBodyNotifyChartDeleted method dynamic ChartBodyClass,
MSG_CHART_BODY_NOTIFY_CHART_DELETED
.enter
;
; Send our notification out that the chart is being deleted.
; This requires the VM block handle of the chart block
;
push cx, si ; chart block, body chunk handle
mov bx, cx ; chart handle
call VMMemBlockToVMBlock
mov_tr cx, ax ; VM block handle
movdw bxsi, ds:[di].CBI_notificationOD
mov ax, ds:[di].CBI_notificationMessage
tst ax
jz afterCall
mov di, mask MF_FIXUP_DS
call ObjMessage
afterCall:
pop cx, si ; chart block, body chunk handle
;
; Remove the child from the linkage
;
mov ax, offset COI_link
clr bx
call ChartBodyGetCompOffset
mov bp, mask CCF_MARK_DIRTY
call ObjCompRemoveChild
.leave
ret
ChartBodyNotifyChartDeleted endm
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_350.asm | ljhsiun2/medusa | 9 | 82576 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x15e0a, %rsi
lea addresses_WT_ht+0x1e4a, %rdi
nop
sub $57969, %r8
mov $17, %rcx
rep movsq
nop
nop
nop
xor %rsi, %rsi
lea addresses_WT_ht+0x13b2a, %rcx
nop
nop
xor %r12, %r12
movl $0x61626364, (%rcx)
nop
nop
and %r12, %r12
lea addresses_normal_ht+0xf50a, %r12
nop
nop
nop
nop
nop
cmp %rsi, %rsi
movw $0x6162, (%r12)
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_WT_ht+0xbb8a, %rcx
add $20843, %r15
mov $0x6162636465666768, %r12
movq %r12, %xmm5
vmovups %ymm5, (%rcx)
nop
nop
nop
cmp %r8, %r8
lea addresses_WT_ht+0x150aa, %rcx
nop
nop
nop
sub $61446, %rsi
mov $0x6162636465666768, %r12
movq %r12, %xmm2
movups %xmm2, (%rcx)
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_normal_ht+0xf152, %rsi
nop
add %rdi, %rdi
mov (%rsi), %r8d
nop
and %r15, %r15
lea addresses_WT_ht+0x10e0a, %rsi
lea addresses_WT_ht+0x178ca, %rdi
nop
nop
nop
dec %r11
mov $63, %rcx
rep movsq
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_D_ht+0x188aa, %r8
nop
nop
nop
nop
sub %r12, %r12
mov (%r8), %r11w
nop
cmp %rdi, %rdi
lea addresses_A_ht+0x1b47f, %rdi
and %r11, %r11
movb $0x61, (%rdi)
nop
sub $26792, %rdi
lea addresses_D_ht+0x974c, %r12
dec %r8
vmovups (%r12), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %r11
nop
sub $23388, %r8
lea addresses_WC_ht+0x13482, %rsi
lea addresses_WC_ht+0x4a0a, %rdi
cmp $55104, %r9
mov $89, %rcx
rep movsl
nop
sub %r8, %r8
lea addresses_A_ht+0x1160a, %rsi
lea addresses_A_ht+0xdd0a, %rdi
nop
sub $41180, %r11
mov $22, %rcx
rep movsb
nop
nop
cmp %r15, %r15
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r15
push %r8
push %rax
push %rsi
// Faulty Load
lea addresses_A+0x560a, %rsi
nop
nop
nop
nop
nop
sub %rax, %rax
mov (%rsi), %r15d
lea oracles, %r11
and $0xff, %r15
shlq $12, %r15
mov (%r11,%r15,1), %r15
pop %rsi
pop %rax
pop %r8
pop %r15
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 10, 'type': 'addresses_A_ht'}, 'dst': {'same': True, 'congruent': 8, 'type': 'addresses_A_ht'}}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
programs/oeis/228/A228317.asm | jmorken/loda | 1 | 28741 | <filename>programs/oeis/228/A228317.asm
; A228317: The hyper-Wiener index of the triangular graph T(n) (n >= 1).
; 0,0,3,21,75,195,420,798,1386,2250,3465,5115,7293,10101,13650,18060,23460,29988,37791,47025,57855,70455,85008,101706,120750,142350,166725,194103,224721,258825,296670,338520,384648,435336,490875,551565,617715,689643
lpb $0
sub $0,1
lpb $0
add $2,$0
sub $0,1
add $3,$2
add $1,$3
lpe
lpe
mul $1,3
|
2018/hxpctf/tiny_elves (real)/shell.asm | theKidOfArcrania/ctf-writeups | 5 | 80682 | <filename>2018/hxpctf/tiny_elves (real)/shell.asm<gh_stars>1-10
BITS 32
global _start
_start:
sub esp, 0x100
xor eax, eax
push eax
mov ecx, esp
mov edx, esp
push dword 0x68732f2f
push dword 0x6e69622f
mov al, 0xb
mov ebx, esp
int 0x80
|
3-mid/opengl/source/lean/renderer/opengl-impostor.adb | charlie5/lace | 20 | 13907 | <filename>3-mid/opengl/source/lean/renderer/opengl-impostor.adb
with
openGL.Camera,
openGL.Model.billboard.textured,
ada.unchecked_Deallocation;
package body openGL.Impostor
is
---------
--- Forge
--
procedure destroy (Self : in out Item)
is
use openGL.Visual,
Model,
Texture;
the_Model : Model.view := Self.Visual.Model;
the_Texture : Texture.Object := Model.billboard.textured.view (the_Model).Texture;
begin
free (the_Texture);
free (the_Model);
free (Self.Visual);
end destroy;
procedure free (Self : in out View)
is
procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View);
begin
if Self /= null then
destroy (Self.all);
deallocate (Self);
end if;
end free;
--------------
--- Attributes
--
procedure Visual_is (Self : in out Item; Now : in openGL.Visual.view)
is
begin
Self.Visual := Now;
end Visual_is;
function Visual (Self : access Item) return openGL.Visual.view
is
begin
return Self.Visual;
end Visual;
function get_Target (Self : in Item) return openGL.Visual.view
is
begin
return Self.Target;
end get_Target;
procedure set_Target (Self : in out Item; Target : in openGL.Visual.view)
is
use type openGL.Visual.view;
Width : constant Real := Target.Model.Bounds.Ball * 2.00;
begin
if Self.Visual = null
then
Self.Visual := new openGL.Visual.item;
end if;
Self.Target := Target;
Self.is_Terrain := Target.is_Terrain;
Self.Visual.Model_is (Model.billboard.textured.Forge.new_Billboard (Scale => (Width, Width, 0.01),
Plane => Model.billboard.xy,
Texture => null_Asset).all'Access);
Self.Visual.Transform_is (Target.Transform);
end set_Target;
function target_camera_Distance (Self : in Item'Class) return Real
is
begin
return Self.target_camera_Distance;
end target_camera_Distance;
function is_Valid (Self : in Item'Class) return Boolean
is
begin
return Self.is_Valid;
end is_Valid;
function never_Updated (Self : in Item'Class) return Boolean
is
begin
return Self.never_Updated;
end never_Updated;
function frame_Count_since_last_update (Self : in Item'Class) return Natural
is
begin
return Natural (Self.freshen_Count);
end frame_Count_since_last_update;
function face_Count (Self : in Item) return Natural
is
pragma unreferenced (Self);
begin
return 1;
end face_Count;
procedure set_Alpha (Self : in out Item; Alpha : in Real)
is
begin
null; -- TODO
end set_Alpha;
function Bounds (Self : in Item) return openGL.Bounds
is
begin
return (others => <>); -- TODO
end Bounds;
function is_Transparent (Self : in Item) return Boolean
is
pragma unreferenced (Self);
begin
return True;
end is_Transparent;
-- Update trigger configuration.
--
procedure set_freshen_count_update_trigger_Mod (Self : in out Item; To : in Positive)
is
begin
Self.freshen_count_update_trigger_Mod := Counter (To);
end set_freshen_count_update_trigger_Mod;
function get_freshen_count_update_trigger_Mod (Self : in Item) return Positive
is
begin
return Positive (Self.freshen_count_update_trigger_Mod);
end get_freshen_count_update_trigger_Mod;
procedure set_size_update_trigger_Delta (Self : in out Item; To : in Positive)
is
begin
Self.size_update_trigger_Delta := gl.glSizeI (To);
end set_size_update_trigger_Delta;
function get_size_update_trigger_Delta (Self : in Item) return Positive
is
begin
return Positive (Self.size_update_trigger_Delta);
end get_size_update_trigger_Delta;
function general_Update_required (Self : access Item; the_Camera_Site : in Vector_3;
the_pixel_Region : in pixel_Region) return Boolean
is
pragma unreferenced (the_pixel_Region);
use linear_Algebra_3d;
use type gl.GLsizei;
Camera_has_moved : constant Boolean := the_Camera_Site /= Self.prior_camera_Position;
Target_has_moved : constant Boolean := get_Translation (Self.Target.Transform) /= Self.prior_target_Position;
begin
Self.freshen_Count := Self.freshen_Count + 1;
if Self.freshen_Count > Self.freshen_count_update_trigger_Mod
then
return True;
end if;
if Camera_has_moved
and then abs (Angle (the_Camera_Site,
Self.prior_target_Position,
Self.prior_camera_Position)) > to_Radians (15.0)
then
return True;
end if;
if Target_has_moved
and then abs (Angle (get_Translation (Self.Target.Transform),
Self.prior_camera_Position,
Self.prior_target_Position)) > to_Radians (15.0)
then
return True;
end if;
if Self.prior_pixel_Region.Width > 40 -- Ignore target rotation triggered updates when target is small on screen.
and then Self.prior_pixel_Region.Height > 40 --
and then Self.prior_target_Rotation /= get_Rotation (Self.Target.Transform)
then
return True;
end if;
return False;
end general_Update_required;
function size_Update_required (Self : access Item; the_pixel_Region : in pixel_Region) return Boolean
is
use GL;
use type gl.GLsizei;
begin
return abs (the_pixel_Region.Width - Self.prior_Width_Pixels) > Self.size_update_trigger_Delta
or abs (the_pixel_Region.Height - Self.prior_Height_pixels) > Self.size_update_trigger_Delta;
end size_Update_required;
function get_pixel_Region (Self : access Item'Class; camera_Spin : in Matrix_3x3;
camera_Site : in Vector_3;
camera_projection_Transform : in Matrix_4x4;
camera_Viewport : in linear_Algebra_3d.Rectangle) return pixel_Region
is
use linear_Algebra_3D;
target_Centre : constant Vector_3 := camera_Spin * ( get_Translation (Self.Target.Transform)
- camera_Site);
target_lower_Left : constant Vector_3 := target_Centre - (Self.Target.Model.Bounds.Ball,
Self.Target.Model.Bounds.Ball,
0.0);
target_Centre_proj : constant Vector_4 := target_Centre * camera_projection_Transform;
target_Lower_Left_proj : constant Vector_4 := target_lower_Left * camera_projection_Transform;
target_Centre_norm : constant Vector_3 := (target_Centre_proj (1) / target_Centre_proj (4),
target_Centre_proj (2) / target_Centre_proj (4),
target_Centre_proj (3) / target_Centre_proj (4));
target_Lower_Left_norm : constant Vector_3 := (target_Lower_Left_proj (1) / target_Lower_Left_proj (4),
target_Lower_Left_proj (2) / target_Lower_Left_proj (4),
target_Lower_Left_proj (3) / target_Lower_Left_proj (4));
target_Centre_norm_0to1 : constant Vector_3 := (target_Centre_norm (1) * 0.5 + 0.5,
target_Centre_norm (2) * 0.5 + 0.5,
target_Centre_norm (3) * 0.5 + 0.5);
target_Lower_Left_norm_0to1 : constant Vector_3 := (target_Lower_Left_norm (1) * 0.5 + 0.5,
target_Lower_Left_norm (2) * 0.5 + 0.5,
target_Lower_Left_norm (3) * 0.5 + 0.5);
viewport_Width : constant Integer := camera_Viewport.Max (1) - camera_Viewport.Min (1) + 1;
viewport_Height : constant Integer := camera_Viewport.Max (2) - camera_Viewport.Min (2) + 1;
Width : constant Real := 2.0 * Real (viewport_Width) * ( target_Centre_norm_0to1 (1)
- target_Lower_Left_norm_0to1 (1));
Width_pixels : constant gl.glSizei := gl.glSizei ( Integer (Real (viewport_Width) * target_Lower_Left_norm_0to1 (1) + Width)
- Integer (Real (viewport_Width) * target_Lower_Left_norm_0to1 (1))
+ 1);
Height : constant Real := 2.0 * Real (viewport_Height) * ( target_Centre_norm_0to1 (2)
- target_Lower_Left_norm_0to1 (2));
Height_pixels : constant gl.glSizei := gl.glSizei ( Integer (Real (viewport_Height) * target_Lower_Left_norm_0to1 (2) + Height)
- Integer (Real (viewport_Height) * target_Lower_Left_norm_0to1 (2))
+ 1);
use type gl.GLsizei;
begin
Self.all.target_camera_Distance := abs (target_Centre); -- NB: Cache distance from camera to target.
return (X => gl.glInt (target_Lower_Left_norm_0to1 (1) * Real (Viewport_Width)) - 0,
Y => gl.glInt (target_Lower_Left_norm_0to1 (2) * Real (viewport_Height)) - 0,
Width => Width_pixels + 0,
Height => Height_pixels + 0);
end get_pixel_Region;
--------------
-- Operations
--
procedure update (Self : in out Item; the_Camera : access Camera.item'Class;
texture_Pool : in texture.Pool_view)
is
pragma unreferenced (the_Camera, texture_Pool);
use openGL.Visual;
-- Width_size : constant openGL.texture.Size := to_Size (Natural (Self.current_Width_pixels));
-- Height_size : constant openGL.texture.Size := to_Size (Natural (Self.current_Height_pixels));
-- texture_Width : constant gl.glSizei := power_of_2_Ceiling (Natural (Self.current_Width_pixels ));
-- texture_Height : constant gl.glSizei := power_of_2_Ceiling (Natural (Self.current_Height_pixels));
the_Model : constant Model.billboard.textured.view := Model.billboard.textured.view (Self.Visual.Model);
-- GL_Error : Boolean;
begin
Self.Visual.all := Self.Target.all;
Self.Visual.Model_is (the_Model.all'Access);
end update;
end openGL.Impostor;
|
TestAppleScript/Test/TestScript.applescript | MrLiu163/TestAppleScript | 1 | 2342 | <filename>TestAppleScript/Test/TestScript.applescript<gh_stars>1-10
--
-- AppDelegate.applescript
-- MarketCheckAndSendMail
--
-- Created by mrliu on 2020/12/21.
--
--
-- 测试方法示例
script TestScript
property parent : class "NSObject"
-- 测试数组方式传参
on testMethodWithListParas_(parasList)
log "parasList = "
log parasList
-- 数组传参形式获取参数
set parasListList to parasList as list --将OC中的__NSArrayI转为AppleScript中的 <NSAppleEventDescriptor: 'list'> (即list)
set str1 to item 1 of parasListList
set str2 to item 2 of parasListList
log "str1 = " & str1 & ", " & "str2 = " & str2
log "parasList's class = "
log class of parasList
end testMethodWithListParas_
-- 测试字典方式传参
on testMethodWithDictParas_(parasDict)
log "parasDict = "
log parasDict
-- 字典传参形式获取参数
set parasRecord to parasDict as record --将OC中的__NSDictionaryI转为 <NSAppleEventDescriptor: 'reco'> (即record)
set nameStr to theName of parasRecord
set ageStr to theAge of parasRecord
log "nameStr = " & nameStr & ", " & "ageStr = " & ageStr
log "parasDict's class = "
log class of parasDict
end testMethodWithDictParas_
-- 测试无传参
on testMethodWithNoParas()
log "No Paras"
end testMethodWithNoParas
end script
|
tp2/ExprArithEval/ExprArithEval.g4 | hogoww/compil | 0 | 5003 | grammar ExprArithEval;
expr returns [int value] :
e = additionExpr {$value = $e.value;} ;
additionExpr returns [int value] :
e1 = multiplyExpr {$value = $e1.value;}
('+' e2 = multiplyExpr {$value += $e2.value;}
| '-' e2 = multiplyExpr {$value -= $e2.value; })* ;
multiplyExpr returns [int value] :
e1 = atomExpr {$value = $e1.value;}
('*' e2 = atomExpr {$value *= $e2.value;}
| '/' e2 = atomExpr {$value /= $e2.value; })* ;
atomExpr returns [int value] :
c = Number {$value = Integer.parseInt($c.text);}
| '(' e1 = additionExpr ')' {$value = $e1.value;}
| '-' e2 = atomExpr {$value = -$e2.value;} ;
Number : ('0'..'9')+ ;
WS : [ \t\r\n]+ -> skip ;
|
Transynther/x86/_processed/NC/_zr_/i3-7100_9_0xca_notsx.log_21829_1386.asm | ljhsiun2/medusa | 9 | 7250 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r15
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x6023, %r10
cmp %r11, %r11
mov (%r10), %r14d
cmp $31405, %r11
lea addresses_normal_ht+0x5e39, %r15
nop
nop
nop
nop
nop
and %r9, %r9
mov (%r15), %r11
nop
nop
nop
and $3478, %r10
lea addresses_UC_ht+0x52ad, %rsi
lea addresses_A_ht+0x199f1, %rdi
clflush (%rdi)
nop
nop
nop
nop
cmp $55151, %r14
mov $114, %rcx
rep movsb
inc %r14
lea addresses_WC_ht+0x16981, %r14
nop
inc %rdi
movb (%r14), %cl
nop
nop
nop
nop
add $45587, %rsi
lea addresses_WC_ht+0x7071, %r9
nop
nop
nop
sub %r15, %r15
mov $0x6162636465666768, %rdi
movq %rdi, (%r9)
nop
nop
nop
and %r9, %r9
lea addresses_A_ht+0x1657d, %rsi
lea addresses_WC_ht+0x471, %rdi
nop
sub $28541, %r14
mov $19, %rcx
rep movsw
nop
nop
nop
nop
sub $6148, %rsi
lea addresses_normal_ht+0x1b531, %r9
nop
nop
add %rdi, %rdi
mov (%r9), %r11
nop
nop
nop
and %rdi, %rdi
lea addresses_WC_ht+0x9271, %rsi
lea addresses_A_ht+0x1b4c7, %rdi
nop
nop
nop
nop
nop
add $55725, %r15
mov $2, %rcx
rep movsw
xor $19127, %r15
lea addresses_A_ht+0x1d471, %r10
nop
nop
nop
sub %rdi, %rdi
movups (%r10), %xmm2
vpextrq $0, %xmm2, %r11
add %r11, %r11
lea addresses_D_ht+0x10381, %r14
nop
nop
nop
nop
nop
sub $42363, %r15
mov (%r14), %rcx
nop
nop
nop
xor %rdi, %rdi
lea addresses_WT_ht+0x3c31, %r11
nop
nop
nop
nop
cmp $15740, %r10
vmovups (%r11), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %rsi
nop
nop
nop
nop
sub $11373, %r9
lea addresses_WT_ht+0x13f71, %r15
nop
nop
nop
cmp %rdi, %rdi
and $0xffffffffffffffc0, %r15
movntdqa (%r15), %xmm2
vpextrq $0, %xmm2, %rsi
nop
nop
nop
cmp %r11, %r11
lea addresses_D_ht+0xd567, %r9
nop
nop
nop
nop
mfence
movups (%r9), %xmm0
vpextrq $0, %xmm0, %rsi
nop
nop
nop
sub %r9, %r9
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %r9
push %rbp
push %rdi
push %rsi
// Store
lea addresses_D+0x19d5d, %rdi
nop
cmp $4, %rsi
mov $0x5152535455565758, %r12
movq %r12, %xmm6
movups %xmm6, (%rdi)
nop
add %r12, %r12
// Store
lea addresses_RW+0x1e2db, %r13
xor %r12, %r12
mov $0x5152535455565758, %rdi
movq %rdi, (%r13)
add $49681, %r8
// Store
mov $0x271, %rdi
nop
sub %r9, %r9
mov $0x5152535455565758, %r13
movq %r13, (%rdi)
nop
nop
nop
nop
add $55150, %r12
// Faulty Load
mov $0xd69090000000471, %r8
nop
nop
nop
nop
nop
inc %rbp
vmovups (%r8), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %r13
lea oracles, %r12
and $0xff, %r13
shlq $12, %r13
mov (%r12,%r13,1), %r13
pop %rsi
pop %rdi
pop %rbp
pop %r9
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_D', 'size': 16, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_RW', 'size': 8, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_P', 'size': 8, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}}
{'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}}
{'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 7, 'NT': True, 'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'00': 21829}
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 00 00 00 00 00 00 00 00 00 00
*/
|
oeis/077/A077148.asm | neoneye/loda-programs | 11 | 162059 | <reponame>neoneye/loda-programs
; A077148: Smallest k such that there are n numbers m relatively prime to n in range n < m < k.
; Submitted by <NAME>
; 3,6,8,12,12,24,16,24,23,34,24,48,28,46,44,48,36,72,40,70,59,70,48,96,57,82,68,94,60,140,64,96,87,106,87,144,76,118,102,140,84,188,88,140,129,142,96,192,107,174,132,164,108,216,130,186,147,178,120,284,124
mov $2,$0
seq $0,69213 ; a(n) = n-th positive integer relatively prime to n.
add $0,$2
add $0,2
|
oeis/038/A038806.asm | neoneye/loda-programs | 11 | 14475 | <filename>oeis/038/A038806.asm
; A038806: Convolution of A008549 with A000302 (powers of 4).
; Submitted by <NAME>
; 0,1,10,69,406,2186,11124,54445,259006,1205790,5519020,24918306,111250140,492051124,2159081192,9409526397,40766269774,175707380630,753876367356,3221460111958,13716223138388,58210889582796,246319029011800,1039521058383314,4376353907025036,18383356268468716,77063554988421304,322444273162786980,1346801053439305336,5616302299126502376,23385416524485225936,97237040045896996381,403785190040289404270,1674701215718375535174,6937859629144523543836,28710773867157087089166,118692396669330180465444
add $0,2
mov $1,$0
add $0,1
mul $1,2
bin $1,$0
sub $0,1
mul $1,2
mov $2,4
pow $2,$0
add $0,1
mul $1,2
sub $2,$1
mul $0,$2
div $0,16
|
test/src/pulsada_test-main.adb | fintatarta/pulsada | 0 | 3754 | with Pulse_Simple_H; use Pulse_Simple_H;
with Pulse_Sample_H; use Pulse_Sample_H;
with Pulse_Def_H; use Pulse_Def_H;
with Interfaces.C.Strings; use Interfaces.C.Strings, Interfaces.C;
with Ada.Text_IO; use Ada.Text_IO;
procedure Pulsada_Test.Main is
pragma Linker_Options ("-lpulse");
pragma Linker_Options ("-lpulse-simple");
type Buffer_Type is array (Positive range <>) of Interfaces.Integer_16;
pragma Convention (C, Buffer_Type);
X : aliased Pa_Sample_Spec := Pa_Sample_Spec'(Format => PA_SAMPLE_S16LE,
Rate => 44100,
Channels => 1);
S : Pa_Simple_Access := null;
Err : aliased Int;
Buf : aliased Buffer_Type (1 .. 44100);
begin
S := Pa_Simple_New (Server => Null_Ptr,
Name => New_String ("prova"),
Dir => PA_STREAM_RECORD,
Dev => Null_Ptr,
Stream_Name => New_String ("record"),
Ss => X'Access,
Map => null,
Attr => null,
Error => Err'Access);
if S = null then
Put_Line (Standard_Error, "Errore: " & Value (Pa_Strerror (Err)));
return;
else
Put_Line (Standard_Error, "OK");
end if;
for N in 1 .. 4 loop
if Pa_Simple_Read (S => S,
Data => Buf'Address,
Bytes => Buf'Size / 8,
Error => Err'Access) < 0
then
Put_Line (Standard_Error, "Errore in read: " & Value (Pa_Strerror (Err)));
else
Put_Line (Standard_Error, "OK");
for K in Buf'Range loop
Put_Line (Buf (K)'Img);
end loop;
end if;
end loop;
end Pulsada_Test.Main;
|
agda-stdlib/src/Data/Nat/GCD.agda | DreamLinuxer/popl21-artifact | 5 | 16886 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Greatest common divisor
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Nat.GCD where
open import Data.Nat.Base
open import Data.Nat.Divisibility
open import Data.Nat.DivMod
open import Data.Nat.GCD.Lemmas
open import Data.Nat.Properties
open import Data.Nat.Induction
using (Acc; acc; <′-Rec; <′-recBuilder; <-wellFounded)
open import Data.Product
open import Data.Sum.Base as Sum using (_⊎_; inj₁; inj₂)
open import Function
open import Induction using (build)
open import Induction.Lexicographic using (_⊗_; [_⊗_])
open import Relation.Binary
open import Relation.Binary.PropositionalEquality as P
using (_≡_; _≢_; subst; cong)
open import Relation.Nullary using (Dec)
open import Relation.Nullary.Negation using (contradiction)
import Relation.Nullary.Decidable as Dec
------------------------------------------------------------------------
-- Definition
-- Calculated via Euclid's algorithm. In order to show progress,
-- avoiding the initial step where the first argument may increase, it
-- is necessary to first define a version `gcd′` which assumes that the
-- first argument is strictly smaller than the second. The full `gcd`
-- function then compares the two arguments and applies `gcd′`
-- accordingly.
gcd′ : ∀ m n → Acc _<_ m → n < m → ℕ
gcd′ m zero _ _ = m
gcd′ m n@(suc n-1) (acc rec) n<m = gcd′ n (m % n) (rec _ n<m) (m%n<n m n-1)
gcd : ℕ → ℕ → ℕ
gcd m n with <-cmp m n
... | tri< m<n _ _ = gcd′ n m (<-wellFounded n) m<n
... | tri≈ _ _ _ = m
... | tri> _ _ n<m = gcd′ m n (<-wellFounded m) n<m
------------------------------------------------------------------------
-- Core properties of gcd′
gcd′[m,n]∣m,n : ∀ {m n} rec n<m → gcd′ m n rec n<m ∣ m × gcd′ m n rec n<m ∣ n
gcd′[m,n]∣m,n {m} {zero} rec n<m = ∣-refl , m ∣0
gcd′[m,n]∣m,n {m} {suc n} (acc rec) n<m
with gcd′[m,n]∣m,n (rec _ n<m) (m%n<n m n)
... | gcd∣n , gcd∣m%n = ∣n∣m%n⇒∣m gcd∣n gcd∣m%n , gcd∣n
gcd′-greatest : ∀ {m n c} rec n<m → c ∣ m → c ∣ n → c ∣ gcd′ m n rec n<m
gcd′-greatest {m} {zero} rec n<m c∣m c∣n = c∣m
gcd′-greatest {m} {suc n} (acc rec) n<m c∣m c∣n =
gcd′-greatest (rec _ n<m) (m%n<n m n) c∣n (%-presˡ-∣ c∣m c∣n)
------------------------------------------------------------------------
-- Core properties of gcd
gcd[m,n]∣m : ∀ m n → gcd m n ∣ m
gcd[m,n]∣m m n with <-cmp m n
... | tri< n<m _ _ = proj₂ (gcd′[m,n]∣m,n {n} {m} _ _)
... | tri≈ _ _ _ = ∣-refl
... | tri> _ _ m<n = proj₁ (gcd′[m,n]∣m,n {m} {n} _ _)
gcd[m,n]∣n : ∀ m n → gcd m n ∣ n
gcd[m,n]∣n m n with <-cmp m n
... | tri< n<m _ _ = proj₁ (gcd′[m,n]∣m,n {n} {m} _ _)
... | tri≈ _ P.refl _ = ∣-refl
... | tri> _ _ m<n = proj₂ (gcd′[m,n]∣m,n {m} {n} _ _)
gcd-greatest : ∀ {m n c} → c ∣ m → c ∣ n → c ∣ gcd m n
gcd-greatest {m} {n} c∣m c∣n with <-cmp m n
... | tri< n<m _ _ = gcd′-greatest _ _ c∣n c∣m
... | tri≈ _ _ _ = c∣m
... | tri> _ _ m<n = gcd′-greatest _ _ c∣m c∣n
------------------------------------------------------------------------
-- Other properties
-- Note that all other properties of `gcd` should be inferable from the
-- 3 core properties above.
gcd[0,0]≡0 : gcd 0 0 ≡ 0
gcd[0,0]≡0 = ∣-antisym (gcd 0 0 ∣0) (gcd-greatest (0 ∣0) (0 ∣0))
gcd[m,n]≢0 : ∀ m n → m ≢ 0 ⊎ n ≢ 0 → gcd m n ≢ 0
gcd[m,n]≢0 m n (inj₁ m≢0) eq = m≢0 (0∣⇒≡0 (subst (_∣ m) eq (gcd[m,n]∣m m n)))
gcd[m,n]≢0 m n (inj₂ n≢0) eq = n≢0 (0∣⇒≡0 (subst (_∣ n) eq (gcd[m,n]∣n m n)))
gcd[m,n]≡0⇒m≡0 : ∀ {m n} → gcd m n ≡ 0 → m ≡ 0
gcd[m,n]≡0⇒m≡0 {zero} {n} eq = P.refl
gcd[m,n]≡0⇒m≡0 {suc m} {n} eq = contradiction eq (gcd[m,n]≢0 (suc m) n (inj₁ λ()))
gcd[m,n]≡0⇒n≡0 : ∀ m {n} → gcd m n ≡ 0 → n ≡ 0
gcd[m,n]≡0⇒n≡0 m {zero} eq = P.refl
gcd[m,n]≡0⇒n≡0 m {suc n} eq = contradiction eq (gcd[m,n]≢0 m (suc n) (inj₂ λ()))
gcd-comm : ∀ m n → gcd m n ≡ gcd n m
gcd-comm m n = ∣-antisym
(gcd-greatest (gcd[m,n]∣n m n) (gcd[m,n]∣m m n))
(gcd-greatest (gcd[m,n]∣n n m) (gcd[m,n]∣m n m))
gcd-universality : ∀ {m n g} →
(∀ {d} → d ∣ m × d ∣ n → d ∣ g) →
(∀ {d} → d ∣ g → d ∣ m × d ∣ n) →
g ≡ gcd m n
gcd-universality {m} {n} forwards backwards with backwards ∣-refl
... | back₁ , back₂ = ∣-antisym
(gcd-greatest back₁ back₂)
(forwards (gcd[m,n]∣m m n , gcd[m,n]∣n m n))
-- This could be simplified with some nice backwards/forwards reasoning
-- after the new function hierarchy is up and running.
gcd[cm,cn]/c≡gcd[m,n] : ∀ c m n {≢0} → (gcd (c * m) (c * n) / c) {≢0} ≡ gcd m n
gcd[cm,cn]/c≡gcd[m,n] c@(suc c-1) m n = gcd-universality forwards backwards
where
forwards : ∀ {d : ℕ} → d ∣ m × d ∣ n → d ∣ gcd (c * m) (c * n) / c
forwards {d} (d∣m , d∣n) = m*n∣o⇒n∣o/m c d (gcd-greatest (*-monoʳ-∣ c d∣m) (*-monoʳ-∣ c d∣n))
backwards : ∀ {d : ℕ} → d ∣ gcd (c * m) (c * n) / c → d ∣ m × d ∣ n
backwards {d} d∣gcd[cm,cn]/c with m∣n/o⇒o*m∣n (gcd-greatest (m∣m*n m) (m∣m*n n)) d∣gcd[cm,cn]/c
... | cd∣gcd[cm,n] =
*-cancelˡ-∣ c-1 (∣-trans cd∣gcd[cm,n] (gcd[m,n]∣m (c * m) _)) ,
*-cancelˡ-∣ c-1 (∣-trans cd∣gcd[cm,n] (gcd[m,n]∣n (c * m) _))
c*gcd[m,n]≡gcd[cm,cn] : ∀ c m n → c * gcd m n ≡ gcd (c * m) (c * n)
c*gcd[m,n]≡gcd[cm,cn] zero m n = P.sym gcd[0,0]≡0
c*gcd[m,n]≡gcd[cm,cn] c@(suc c-1) m n = begin
c * gcd m n ≡⟨ cong (c *_) (P.sym (gcd[cm,cn]/c≡gcd[m,n] c m n)) ⟩
c * (gcd (c * m) (c * n) / c) ≡⟨ m*[n/m]≡n (gcd-greatest (m∣m*n m) (m∣m*n n)) ⟩
gcd (c * m) (c * n) ∎
where open P.≡-Reasoning
gcd[m,n]≤n : ∀ m n → gcd m (suc n) ≤ suc n
gcd[m,n]≤n m n = ∣⇒≤ (gcd[m,n]∣n m (suc n))
n/gcd[m,n]≢0 : ∀ m n {n≢0 : Dec.False (n ≟ 0)} {gcd≢0} → (n / gcd m n) {gcd≢0} ≢ 0
n/gcd[m,n]≢0 m n@(suc n-1) {n≢0} {gcd≢0} = m<n⇒n≢0 (m≥n⇒m/n>0 {n} {gcd m n} {gcd≢0} (gcd[m,n]≤n m n-1))
------------------------------------------------------------------------
-- A formal specification of GCD
module GCD where
-- Specification of the greatest common divisor (gcd) of two natural
-- numbers.
record GCD (m n gcd : ℕ) : Set where
constructor is
field
-- The gcd is a common divisor.
commonDivisor : gcd ∣ m × gcd ∣ n
-- All common divisors divide the gcd, i.e. the gcd is the
-- greatest common divisor according to the partial order _∣_.
greatest : ∀ {d} → d ∣ m × d ∣ n → d ∣ gcd
open GCD public
-- The gcd is unique.
unique : ∀ {d₁ d₂ m n} → GCD m n d₁ → GCD m n d₂ → d₁ ≡ d₂
unique d₁ d₂ = ∣-antisym (GCD.greatest d₂ (GCD.commonDivisor d₁))
(GCD.greatest d₁ (GCD.commonDivisor d₂))
-- The gcd relation is "symmetric".
sym : ∀ {d m n} → GCD m n d → GCD n m d
sym g = is (swap $ GCD.commonDivisor g) (GCD.greatest g ∘ swap)
-- The gcd relation is "reflexive".
refl : ∀ {n} → GCD n n n
refl = is (∣-refl , ∣-refl) proj₁
-- The GCD of 0 and n is n.
base : ∀ {n} → GCD 0 n n
base {n} = is (n ∣0 , ∣-refl) proj₂
-- If d is the gcd of n and k, then it is also the gcd of n and
-- n + k.
step : ∀ {n k d} → GCD n k d → GCD n (n + k) d
step g with GCD.commonDivisor g
step {n} {k} {d} g | (d₁ , d₂) = is (d₁ , ∣m∣n⇒∣m+n d₁ d₂) greatest′
where
greatest′ : ∀ {d′} → d′ ∣ n × d′ ∣ n + k → d′ ∣ d
greatest′ (d₁ , d₂) = GCD.greatest g (d₁ , ∣m+n∣m⇒∣n d₂ d₁)
open GCD public using (GCD) hiding (module GCD)
-- The function gcd fulfils the conditions required of GCD
gcd-GCD : ∀ m n → GCD m n (gcd m n)
gcd-GCD m n = record
{ commonDivisor = gcd[m,n]∣m m n , gcd[m,n]∣n m n
; greatest = uncurry′ gcd-greatest
}
-- Calculates the gcd of the arguments.
mkGCD : ∀ m n → ∃ λ d → GCD m n d
mkGCD m n = gcd m n , gcd-GCD m n
-- gcd as a proposition is decidable
gcd? : (m n d : ℕ) → Dec (GCD m n d)
gcd? m n d =
Dec.map′ (λ { P.refl → gcd-GCD m n }) (GCD.unique (gcd-GCD m n))
(gcd m n ≟ d)
GCD-* : ∀ {m n d c} → GCD (m * suc c) (n * suc c) (d * suc c) → GCD m n d
GCD-* (GCD.is (dc∣nc , dc∣mc) dc-greatest) =
GCD.is (*-cancelʳ-∣ _ dc∣nc , *-cancelʳ-∣ _ dc∣mc)
λ {_} → *-cancelʳ-∣ _ ∘ dc-greatest ∘ map (*-monoˡ-∣ _) (*-monoˡ-∣ _)
GCD-/ : ∀ {m n d c} {≢0} → c ∣ m → c ∣ n → c ∣ d →
GCD m n d → GCD ((m / c) {≢0}) ((n / c) {≢0}) ((d / c) {≢0})
GCD-/ {m} {n} {d} {c@(suc c-1)}
(divides p P.refl) (divides q P.refl) (divides r P.refl) gcd
rewrite m*n/n≡m p c {_} | m*n/n≡m q c {_} | m*n/n≡m r c {_} = GCD-* gcd
GCD-/gcd : ∀ m n {≢0} → GCD ((m / gcd m n) {≢0}) ((n / gcd m n) {≢0}) 1
GCD-/gcd m n {≢0} rewrite P.sym (n/n≡1 (gcd m n) {≢0}) =
GCD-/ {≢0 = ≢0} (gcd[m,n]∣m m n) (gcd[m,n]∣n m n) ∣-refl (gcd-GCD m n)
------------------------------------------------------------------------
-- Calculating the gcd
-- The calculation also proves Bézout's lemma.
module Bézout where
module Identity where
-- If m and n have greatest common divisor d, then one of the
-- following two equations is satisfied, for some numbers x and y.
-- The proof is "lemma" below (Bézout's lemma).
--
-- (If this identity was stated using integers instead of natural
-- numbers, then it would not be necessary to have two equations.)
data Identity (d m n : ℕ) : Set where
+- : (x y : ℕ) (eq : d + y * n ≡ x * m) → Identity d m n
-+ : (x y : ℕ) (eq : d + x * m ≡ y * n) → Identity d m n
-- Various properties about Identity.
sym : ∀ {d} → Symmetric (Identity d)
sym (+- x y eq) = -+ y x eq
sym (-+ x y eq) = +- y x eq
refl : ∀ {d} → Identity d d d
refl = -+ 0 1 P.refl
base : ∀ {d} → Identity d 0 d
base = -+ 0 1 P.refl
private
infixl 7 _⊕_
_⊕_ : ℕ → ℕ → ℕ
m ⊕ n = 1 + m + n
step : ∀ {d n k} → Identity d n k → Identity d n (n + k)
step {d} {n} (+- x y eq) with compare x y
... | equal x = +- (2 * x) x (lem₂ d x eq)
... | less x i = +- (2 * x ⊕ i) (x ⊕ i) (lem₃ d x eq)
... | greater y i = +- (2 * y ⊕ i) y (lem₄ d y n eq)
step {d} {n} (-+ x y eq) with compare x y
... | equal x = -+ (2 * x) x (lem₅ d x eq)
... | less x i = -+ (2 * x ⊕ i) (x ⊕ i) (lem₆ d x eq)
... | greater y i = -+ (2 * y ⊕ i) y (lem₇ d y n eq)
open Identity public using (Identity; +-; -+) hiding (module Identity)
module Lemma where
-- This type packs up the gcd, the proof that it is a gcd, and the
-- proof that it satisfies Bézout's identity.
data Lemma (m n : ℕ) : Set where
result : (d : ℕ) (g : GCD m n d) (b : Identity d m n) → Lemma m n
-- Various properties about Lemma.
sym : Symmetric Lemma
sym (result d g b) = result d (GCD.sym g) (Identity.sym b)
base : ∀ d → Lemma 0 d
base d = result d GCD.base Identity.base
refl : ∀ d → Lemma d d
refl d = result d GCD.refl Identity.refl
stepˡ : ∀ {n k} → Lemma n (suc k) → Lemma n (suc (n + k))
stepˡ {n} {k} (result d g b) =
subst (Lemma n) (+-suc n k) $
result d (GCD.step g) (Identity.step b)
stepʳ : ∀ {n k} → Lemma (suc k) n → Lemma (suc (n + k)) n
stepʳ = sym ∘ stepˡ ∘ sym
open Lemma public using (Lemma; result) hiding (module Lemma)
-- Bézout's lemma proved using some variant of the extended
-- Euclidean algorithm.
lemma : (m n : ℕ) → Lemma m n
lemma m n = build [ <′-recBuilder ⊗ <′-recBuilder ] P gcd″ (m , n)
where
P : ℕ × ℕ → Set
P (m , n) = Lemma m n
gcd″ : ∀ p → (<′-Rec ⊗ <′-Rec) P p → P p
gcd″ (zero , n ) rec = Lemma.base n
gcd″ (suc m , zero ) rec = Lemma.sym (Lemma.base (suc m))
gcd″ (suc m , suc n ) rec with compare m n
... | equal .m = Lemma.refl (suc m)
... | less .m k = Lemma.stepˡ $ proj₁ rec (suc k) (lem₁ k m)
-- "gcd (suc m) (suc k)"
... | greater .n k = Lemma.stepʳ $ proj₂ rec (suc k) (lem₁ k n) (suc n)
-- "gcd (suc k) (suc n)"
-- Bézout's identity can be recovered from the GCD.
identity : ∀ {m n d} → GCD m n d → Identity d m n
identity {m} {n} g with lemma m n
... | result d g′ b with GCD.unique g g′
... | P.refl = b
|
oeis/092/A092534.asm | neoneye/loda-programs | 11 | 3298 | <reponame>neoneye/loda-programs
; A092534: Expansion of (1-x+x^2)*(1+x^4)/((1-x)^2*(1-x^2)).
; Submitted by <NAME>(s3)
; 1,1,3,4,8,10,16,20,28,34,44,52,64,74,88,100,116,130,148,164,184,202,224,244,268,290,316,340,368,394,424,452,484,514,548,580,616,650,688,724,764,802,844,884,928,970,1016,1060,1108,1154,1204,1252,1304,1354,1408,1460,1516,1570,1628,1684,1744,1802,1864,1924,1988,2050,2116,2180,2248,2314,2384,2452,2524,2594,2668,2740,2816,2890,2968,3044,3124,3202,3284,3364,3448,3530,3616,3700,3788,3874,3964,4052,4144,4234,4328,4420,4516,4610,4708,4804
mov $1,$0
div $1,2
sub $0,$1
mul $0,2
mul $1,$0
sub $0,1
trn $0,2
sub $1,$0
mov $0,$1
add $0,1
|
src/dnscatcher/utils/dnscatcher-utils.adb | DNSCatcher/DNSCatcher | 4 | 6594 | -- Copyright 2019 <NAME> <<EMAIL>>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to
-- deal in the Software without restriction, including without limitation the
-- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-- sell copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
with System;
with Ada.Unchecked_Conversion;
with Interfaces.C;
package body DNSCatcher.Utils is
function Ntohs
(Network_Short : Unsigned_16)
return Unsigned_16
is
function Internal
(Network_Short : Unsigned_16)
return Unsigned_16;
pragma Import (C, Internal, "ntohs");
begin
return Internal (Network_Short);
end Ntohs;
function Ntohl
(Network_Long : Unsigned_32)
return Unsigned_32
is
function Internal
(Network_Long : Unsigned_32)
return Unsigned_32;
pragma Import (C, Internal, "ntohl");
begin
return Internal (Network_Long);
end Ntohl;
function Htons
(Host_Short : Unsigned_16)
return Unsigned_16
is
function Internal
(Host_Short : Unsigned_16)
return Unsigned_16;
pragma Import (C, Internal, "htons");
begin
return Internal (Host_Short);
end Htons;
function Htonl
(Host_Long : Unsigned_32)
return Unsigned_32
is
function Internal
(Host_Long : Unsigned_32)
return Unsigned_32;
pragma Import (C, Internal, "htonl");
begin
return Internal (Host_Long);
end Htonl;
-- Bullshit functions to handle Endianess, wish Ada handled this better
function Read_Unsigned_16
(Raw_Data : Stream_Element_Array_Ptr;
Offset : in out Stream_Element_Offset)
return Unsigned_16
is
Network_Short : Unsigned_16;
function From_Network_Value is new Ada.Unchecked_Conversion
(Source => Stream_Element_Array, Target => Unsigned_16);
begin
Network_Short := Ntohs (From_Network_Value (Raw_Data
(Offset .. Offset + 1)));
Offset := Offset + 2;
return Network_Short;
end Read_Unsigned_16;
-- 32-bit bullshit
function Read_Unsigned_32
(Raw_Data : Stream_Element_Array_Ptr;
Offset : in out Stream_Element_Offset)
return Unsigned_32
is
Network_Long : Unsigned_32;
function From_Network_Value is new Ada.Unchecked_Conversion
(Source => Stream_Element_Array, Target => Unsigned_32);
begin
Network_Long := Ntohl (From_Network_Value (Raw_Data
(Offset .. Offset + 3)));
Offset := Offset + 4;
return Network_Long;
end Read_Unsigned_32;
function Inet_Ntop
(Family : IP_Addr_Family;
Raw_Data : Unbounded_String)
return Unbounded_String
is
procedure Internal
(Family : Interfaces.C.int;
Src : System.Address;
Dst : System.Address;
Len : Interfaces.C.int);
pragma Import (C, Internal, "ada_inet_ntop");
-- 16 is the max length of a v4 string + null
C_IP_String : Interfaces.C.char_array (1 .. 16);
begin
-- Call the ada helper function
Internal
(Interfaces.C.int (Family'Enum_Rep), To_String (Raw_Data)'Address,
C_IP_String'Address, 15);
return To_Unbounded_String (Interfaces.C.To_Ada (C_IP_String));
end Inet_Ntop;
end DNSCatcher.Utils;
|
examples/servlets/web_sockets/source/servlets-file.adb | reznikmm/matreshka | 24 | 17941 | <reponame>reznikmm/matreshka<filename>examples/servlets/web_sockets/source/servlets-file.adb<gh_stars>10-100
with Ada.Wide_Wide_Text_IO;
with Ada.Characters.Wide_Wide_Latin_1;
package body Servlets.File is
function "+"
(Text : Wide_Wide_String) return League.Strings.Universal_String
renames League.Strings.To_Universal_String;
----------------------
-- Get_Servlet_Info --
----------------------
overriding function Get_Servlet_Info
(Self : File_Servlet) return League.Strings.Universal_String
is
pragma Unreferenced (Self);
Text : constant Wide_Wide_String :=
"Hello servlet provides WebSocket upgrade responses";
begin
return +Text;
end Get_Servlet_Info;
------------
-- Do_Get --
------------
overriding procedure Do_Get
(Self : in out File_Servlet;
Request : Servlet.HTTP_Requests.HTTP_Servlet_Request'Class;
Response : in out Servlet.HTTP_Responses.HTTP_Servlet_Response'Class)
is
Result : League.Strings.Universal_String;
Input : Ada.Wide_Wide_Text_IO.File_Type;
begin
Ada.Wide_Wide_Text_IO.Open
(Input, Ada.Wide_Wide_Text_IO.In_File, "install/index.html");
while not Ada.Wide_Wide_Text_IO.End_Of_File (Input) loop
Result.Append (Ada.Wide_Wide_Text_IO.Get_Line (Input));
Result.Append (Ada.Characters.Wide_Wide_Latin_1.LF);
end loop;
Ada.Wide_Wide_Text_IO.Close (Input);
Response.Set_Status (Servlet.HTTP_Responses.OK);
Response.Set_Content_Type (+"text/html");
Response.Set_Character_Encoding (+"utf-8");
Response.Get_Output_Stream.Write (Result);
end Do_Get;
-----------------
-- Instantiate --
-----------------
overriding function Instantiate
(Parameters : not null access Servlet.Generic_Servlets
.Instantiation_Parameters'
Class)
return File_Servlet
is
pragma Unreferenced (Parameters);
begin
return (Servlet.HTTP_Servlets.HTTP_Servlet with null record);
end Instantiate;
end Servlets.File;
|
src/kernel/start.asm | JohanLi2333/JAHA-OS | 2 | 14568 | <reponame>JohanLi2333/JAHA-OS<gh_stars>1-10
[bits 32]
extern kernel_init
global _start
_start:
call kernel_init
jmp $
|
src/VMTranslator/fixtures/MemoryAccess/PointerTest/PointerTest.raw.asm | tuzmusic/HackManager | 1 | 99456 | @3030 // ** 1: push constant 3030 **
D=A // store the current address as a value
@SP // >> push constant value (3030) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 2: pop pointer 0 ** (>> pop stack to THIS << (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@THIS
M=D // write value of D to current location -
@3040 // ** 3: push constant 3040 **
D=A // store the current address as a value
@SP // >> push constant value (3040) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 4: pop pointer 1 ** (>> pop stack to THAT << (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@THAT
M=D // write value of D to current location -
@32 // ** 5: push constant 32 **
D=A // store the current address as a value
@SP // >> push constant value (32) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@THIS // ** 6: pop this 2 ** (move to "this" pointer)
D=M // store the "this" base address
@2 // move to address representing offset
D=D+A // D = base addr + offset
@OFFSET // write value of D to "OFFSET"
M=D // write value of D to current location
@SP // >> pop stack to *OFFSET <<
M=M-1
A=M // move to top of stack
D=M // store the top stack value into D
@OFFSET
A=M // move to "OFFSET"
M=D // write value of D to current location -
@46 // ** 7: push constant 46 **
D=A // store the current address as a value
@SP // >> push constant value (46) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@THAT // ** 8: pop that 6 ** (move to "that" pointer)
D=M // store the "that" base address
@6 // move to address representing offset
D=D+A // D = base addr + offset
@OFFSET // write value of D to "OFFSET"
M=D // write value of D to current location
@SP // >> pop stack to *OFFSET <<
M=M-1
A=M // move to top of stack
D=M // store the top stack value into D
@OFFSET
A=M // move to "OFFSET"
M=D // write value of D to current location -
@THIS // ** 9: push pointer 0 **
D=M // store current memory value in D
@SP // >>> push memory value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@THAT // ** 10: push pointer 1 **
D=M // store current memory value in D
@SP // >>> push memory value to top of stack
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 11: add ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
M=M+D // perform binary operation: add
@SP // increment stack pointer
M=M+1 -
@THIS // ** 12: push this 2 ** (move to this)
D=M // store the "this" base address
@2 // move to address representing offset
A=D+A // new addr = base addr + offset
D=M // store current memory value in D
@SP // >>> push memory value to top of stack
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 13: sub ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
M=M-D // perform binary operation: sub
@SP // increment stack pointer
M=M+1 -
@THAT // ** 14: push that 6 ** (move to that)
D=M // store the "that" base address
@6 // move to address representing offset
A=D+A // new addr = base addr + offset
D=M // store current memory value in D
@SP // >>> push memory value to top of stack
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 15: add ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
M=M+D // perform binary operation: add
@SP // increment stack pointer |
Driver/Printer/PrintCom/printcomToshibaCursor.asm | steakknife/pcgeos | 504 | 19907 | <filename>Driver/Printer/PrintCom/printcomToshibaCursor.asm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Toshiba 24-pin print drivers
FILE: printcomToshibaCursor.asm
AUTHOR: <NAME>, 14 March 1990
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 3/14/90 Initial revision
Dave 3/92 moved from epson9 to printcom
DESCRIPTION:
This file contains most of the code to implement the Toshiba 24pin type
print driver cursor movement support
The cursor position is kept in 2 words: integer 48s in Y and
integer 72nds in X
$Id: printcomToshibaCursor.asm,v 1.1 97/04/18 11:50:26 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
include Cursor/cursorDotMatrixCommon.asm
include Cursor/cursorSetCursorTosh.asm
include Cursor/cursorPrLineFeedSetASCII.asm
include Cursor/cursorPrFormFeedGuess.asm
include Cursor/cursorConvert48.asm
|
type.asm | davidgiven/cshell | 3 | 93965 | ; Dumps a file to stdout.
;
; Syntax: type <filename>
.include "c64.inc"
.include "cshell.inc"
.cpu "6502"
CSHELL_HEADER
PTR = 6
jsr open_file
ldx #1
jsr CHKIN
-
jsr READST
and #$40 ; check for EOF
bne +
jsr CHRIN
jsr CHROUT
jmp -
+
ldx #0
jsr CHKIN
jsr CLOSE
rts
; --- Open the directory stream ----------------------------------------------
open_file:
ldy #PPB_ARGPTR
lda (PPB), y
tay
ldx #0
-
lda (PPB), y
beq +
iny
inx
jmp -
+
txa
pha
clc
lda PPB+0
ldy #PPB_ARGPTR
adc (PPB), y
tax
lda PPB+1
adc #0
tay
sta PTR+1
pla
jsr SETNAM
ldy #PPB_DRIVE
lda (PPB), y
tax
lda #1
ldy #0
jsr SETLFS
; Try and open the file.
jsr OPEN
jsr get_drive_status
rts
; Read the drive status bytes into the buffer.
get_drive_status:
ldy #PPB_DRIVE
lda (PPB), y
tax
lda #15
ldy #15
jsr SETLFS
lda #0
jsr SETNAM
jsr OPEN
ldx #15
jsr CHKIN
jsr CHRIN
cmp #'2'
bcc no_drive_error
-
jsr CHROUT
jsr READST
and #$40 ; check for EOF
bne +
jsr CHRIN
jmp -
+
lda #1
ldy #PPB_STATUS
sta (PPB), y
jmp (CSHELL)
; --- Utilities --------------------------------------------------------------
print:
pla ; low byte
sta 2
pla ; high byte
sta 3
ldy #1
-
lda (2), y
inc 2
bne +
inc 3
+
tax ; set flags for A
beq +
jsr CHROUT
jmp -
+
lda 3
pha
lda 2
pha
rts
ldx #0
jsr CHKIN
lda #15
jsr CLOSE
lda #1
ldy #PPB_STATUS
sta (PPB), y
jmp (CSHELL)
no_drive_error:
-
jsr READST
and #$40 ; check for EOF
bne +
jsr CHRIN
jmp -
+
ldx #0
jsr CHKOUT
lda #15
jsr CLOSE
rts
|
llvm-gcc-4.2-2.9/gcc/ada/s-tporft.adb | vidkidz/crossbridge | 1 | 26453 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K _ P R I M I T I V E S . O P E R A T I O N S . --
-- R E G I S T E R _ F O R E I G N _ T H R E A D --
-- --
-- B o d y --
-- --
-- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
-- --
-- GNARL 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. GNARL 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 GNARL; 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. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
with System.Task_Info;
-- Use for Unspecified_Task_Info
with System.Soft_Links;
-- used to initialize TSD for a C thread, in function Self
separate (System.Task_Primitives.Operations)
function Register_Foreign_Thread (Thread : Thread_Id) return Task_Id is
Local_ATCB : aliased Ada_Task_Control_Block (0);
Self_Id : Task_Id;
Succeeded : Boolean;
use type Interfaces.C.unsigned;
begin
-- This section is tricky. We must not call anything that might require
-- an ATCB, until the new ATCB is in place. In order to get an ATCB
-- immediately, we fake one, so that it is then possible to e.g allocate
-- memory (which might require accessing self).
-- Record this as the Task_Id for the thread
Local_ATCB.Common.LL.Thread := Thread;
Local_ATCB.Common.Current_Priority := System.Priority'First;
Specific.Set (Local_ATCB'Unchecked_Access);
-- It is now safe to use an allocator
Self_Id := new Ada_Task_Control_Block (0);
-- Finish initialization
Lock_RTS;
System.Tasking.Initialize_ATCB
(Self_Id, null, Null_Address, Null_Task,
Foreign_Task_Elaborated'Access,
System.Priority'First, Task_Info.Unspecified_Task_Info, 0, Self_Id,
Succeeded);
Unlock_RTS;
pragma Assert (Succeeded);
Self_Id.Master_of_Task := 0;
Self_Id.Master_Within := Self_Id.Master_of_Task + 1;
for L in Self_Id.Entry_Calls'Range loop
Self_Id.Entry_Calls (L).Self := Self_Id;
Self_Id.Entry_Calls (L).Level := L;
end loop;
Self_Id.Common.State := Runnable;
Self_Id.Awake_Count := 1;
Self_Id.Common.Task_Image (1 .. 14) := "foreign thread";
Self_Id.Common.Task_Image_Len := 14;
-- Since this is not an ordinary Ada task, we will start out undeferred
Self_Id.Deferral_Level := 0;
System.Soft_Links.Create_TSD (Self_Id.Common.Compiler_Data);
-- ???
-- The following call is commented out to avoid dependence on
-- the System.Tasking.Initialization package.
-- It seems that if we want Ada.Task_Attributes to work correctly
-- for C threads we will need to raise the visibility of this soft
-- link to System.Soft_Links.
-- We are putting that off until this new functionality is otherwise
-- stable.
-- System.Tasking.Initialization.Initialize_Attributes_Link.all (T);
Enter_Task (Self_Id);
return Self_Id;
end Register_Foreign_Thread;
|
programs/oeis/186/A186948.asm | karttu/loda | 1 | 6656 | <reponame>karttu/loda
; A186948: a(n) = 3^n - 2*n.
; 1,1,5,21,73,233,717,2173,6545,19665,59029,177125,531417,1594297,4782941,14348877,43046689,129140129,387420453,1162261429,3486784361,10460353161,31381059565,94143178781,282429536433,847288609393
mov $1,3
pow $1,$0
sub $1,$0
sub $1,$0
|
resources/scripts/cert/googlect.ads | omarafify1990/Amass | 2 | 15157 | <filename>resources/scripts/cert/googlect.ads
-- Copyright 2017-2021 <NAME>. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local url = require("url")
name = "GoogleCT"
type = "cert"
function start()
setratelimit(1)
end
function vertical(ctx, domain)
local token = ""
local hdrs={
Connection="close",
Referer="https://transparencyreport.google.com/https/certificates",
}
while(true) do
local page, err = request(ctx, {
['url']=buildurl(domain, token),
headers=hdrs,
})
if (err ~= nil and err ~= "") then
break
end
sendnames(ctx, page)
token = gettoken(page)
if token == "" then
break
end
end
end
function buildurl(domain, token)
local base = "https://www.google.com/transparencyreport/api/v3/httpsreport/ct/certsearch"
if token ~= "" then
base = base .. "/page"
end
local params = {
['domain']=domain,
['include_expired']="true",
['include_subdomains']="true",
}
if token ~= "" then
params['p'] = token
end
return base .. "?" .. url.build_query_string(params)
end
function sendnames(ctx, content)
local names = find(content, subdomainre)
if names == nil then
return
end
local found = {}
for i, v in pairs(names) do
if found[v] == nil then
newname(ctx, v)
found[v] = true
end
end
end
function gettoken(content)
local pattern = "\\[(null|\"[a-zA-Z0-9]+\"),\"([a-zA-Z0-9]+)\",null,([0-9]+),([0-9]+)\\]"
local match = submatch(content, pattern)
if (match ~= nil and #match == 5 and (match[4] < match[5])) then
return match[3]
end
return ""
end
|
Micro/Tests/or/or.asm | JavierOramas/CP_AC | 0 | 5271 | <filename>Micro/Tests/or/or.asm
addi r3 r0 0
addi r1 r0 65
or r4 r3 r1
tty r4
halt
#prints A |
adium/ASUnitTests/CloseChat.applescript | sin-ivan/AdiumPipeEvent | 0 | 771 | <reponame>sin-ivan/AdiumPipeEvent<filename>adium/ASUnitTests/CloseChat.applescript<gh_stars>0
global HandyAdiumScripts
on run
tell application "Adium"
set newChat to HandyAdiumScripts's makeNewChat()
tell account (HandyAdiumScripts's defaultAccount)
set newChat2 to make new chat with contacts {contact (HandyAdiumScripts's otherParticipant)} at end of chats of (get window of newChat)
end tell
set c to count chats of (get window of newChat)
close newChat2
if (count chats of (get window of newChat)) is not c - 1 then error
close (get window of newChat)
end tell
end run |
traceur_intermediaire.ads | zyron92/banana_tree_generator | 0 | 9950 | <reponame>zyron92/banana_tree_generator
with Svg_Helpers, Parseur, Ada.Text_Io, Ada.Integer_Text_Io;
use Svg_Helpers, Parseur, Ada.Text_Io, Ada.Integer_Text_Io;
package Traceur_Intermediaire is
--Tracé des arètes et des points de contrôle (ou mise à jours des points de contrôle sans tracer)
procedure Tracer_Arretes_Controls(G: in Graphe; Fichier: in File_Type; Tracer: in Boolean);
--Génération du fichier svg du tracé intermédiaire (avec ou sans le tracé)
procedure Generer_Trace_Intermediaire (Nom_Fichier: in string; Couleur_Trait: in RGB; Epaisseur: in string; G: in Graphe);
--Les entêtes du fichier SVG
procedure Le_Debut(Fichier: in File_Type);
--Les queues & Fermetures du fichier SVG
procedure La_Fin(Fichier: in File_Type);
end Traceur_Intermediaire;
|
oeis/132/A132644.asm | neoneye/loda-programs | 11 | 8588 | <gh_stars>10-100
; A132644: X-values of solutions to the equation X*(X + 1) - 13*Y^2 = 0.
; Submitted by <NAME>
; 0,324,421200,546717924,709639444800,921111452633124,1195601955878350800,1551890417618646705924,2014352566467047545939200,2614628079383810095982376324,3393785232687619037537578530000
mul $0,2
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
mul $2,18
add $3,$2
lpe
mov $0,$3
div $0,2
|
src/sound/sleeping_music/channel4.asm | Gegel85/RunnerGB | 0 | 240256 | <reponame>Gegel85/RunnerGB<filename>src/sound/sleeping_music/channel4.asm
musicChan4SleepingTheme::
setRegisters $3F, $81, $00, $00
stopMusic
jump musicChan4SleepingTheme
setVolume $81
setFrequencyRaw $7D, $80
wait QUAVER
setFrequencyRaw $7D, $80
wait QUAVER
setFrequencyRaw $7D, $80
wait QUAVER
setFrequencyRaw $7D, $80
wait QUAVER
wait QUAVER + CROTCHET + MINIM
setFrequencyRaw $7D, $80
wait SEMIQUAVER
setFrequencyRaw $7D, $80
wait SEMIQUAVER
wait QUAVER + CROTCHET + MINIM
setFrequencyRaw $7D, $80
wait SEMIQUAVER
setFrequencyRaw $7D, $80
wait SEMIQUAVER
wait QUAVER + CROTCHET + MINIM
setFrequencyRaw $7D, $80
wait SEMIQUAVER
setFrequencyRaw $7D, $80
wait SEMIQUAVER
setVolume $21
setFrequencyRaw $6C, $80
wait SEMIQUAVER
setVolume $31
playRaw $80
wait SEMIQUAVER
setVolume $41
setFrequencyRaw $6D, $80
wait SEMIQUAVER
setVolume $51
playRaw $80
wait SEMIQUAVER
setVolume $61
playRaw $80
wait SEMIQUAVER
setVolume $71
playRaw $80
wait SEMIQUAVER
setVolume $81
setFrequencyRaw $6E, $80
wait SEMIQUAVER
setVolume $91
playRaw $80
wait SEMIQUAVER
setVolume $A1
playRaw $80
wait SEMIQUAVER
setVolume $B1
playRaw $80
wait SEMIQUAVER
setVolume $C1
setFrequencyRaw $6F, $80
wait SEMIQUAVER
setVolume $D1
playRaw $80
wait SEMIQUAVER
setVolume $E1
playRaw $80
wait SEMIQUAVER
setVolume $F1
playRaw $80
wait SEMIQUAVER
repeat 8
setVolume $A1
setFrequencyRaw $6C, $80
wait SEMIQUAVER
setFrequencyRaw $6D, $80
wait SEMIQUAVER
setFrequencyRaw $6E, $80
wait QUAVER
setVolume $F1
setFrequencyRaw $34, $80
wait QUAVER
setVolume $A1
setFrequencyRaw $6C, $80
wait SEMIQUAVER
setFrequencyRaw $6D, $80
wait SEMIQUAVER
setFrequencyRaw $6C, $80
wait SEMIQUAVER
setFrequencyRaw $6E, $80
wait QUAVER
playRaw $80
wait SEMIQUAVER
setVolume $F1
setFrequencyRaw $34, $80
wait QUAVER
setVolume $A1
setFrequencyRaw $6D, $80
wait SEMIQUAVER
playRaw $80
wait SEMIQUAVER
continue
setVolume $F1
repeat 4
wait CROTCHET
setFrequencyRaw $34, $80
wait MINIM
setFrequencyRaw $34, $80
wait CROTCHET
continue
wait SEMIBREVE * 3
wait QUAVER
setVolume $21
setFrequencyRaw $6C, $80
wait SEMIQUAVER
setVolume $31
playRaw $80
wait SEMIQUAVER
setVolume $41
setFrequencyRaw $6D, $80
wait SEMIQUAVER
setVolume $51
playRaw $80
wait SEMIQUAVER
setVolume $61
playRaw $80
wait SEMIQUAVER
setVolume $71
playRaw $80
wait SEMIQUAVER
setVolume $81
setFrequencyRaw $6E, $80
wait SEMIQUAVER
setVolume $91
playRaw $80
wait SEMIQUAVER
setVolume $A1
playRaw $80
wait SEMIQUAVER
setVolume $B1
playRaw $80
wait SEMIQUAVER
setVolume $C1
setFrequencyRaw $6F, $80
wait SEMIQUAVER
setVolume $D1
playRaw $80
wait SEMIQUAVER
setVolume $E1
playRaw $80
wait SEMIQUAVER
setVolume $F1
playRaw $80
wait SEMIQUAVER
repeat 7
setVolume $A1
setFrequencyRaw $7A, $80
wait CROTCHET
setVolume $F1
setFrequencyRaw $34, $80
wait QUAVER
setVolume $A1
setFrequencyRaw $6C, $80
wait SEMIQUAVER
setFrequencyRaw $6D, $80
wait SEMIQUAVER
setFrequencyRaw $6C, $80
wait SEMIQUAVER
setFrequencyRaw $6E, $80
wait QUAVER
playRaw $80
wait SEMIQUAVER
setVolume $F1
setFrequencyRaw $34, $80
wait CROTCHET
continue
|
oeis/334/A334396.asm | neoneye/loda-programs | 11 | 11267 | ; A334396: Number of fault-free tilings of a 3 X n rectangle with squares and dominos.
; Submitted by <NAME>
; 0,0,2,2,10,16,52,104,286,634,1622,3768,9336,22152,54106,129610,314546,756728,1831196,4413952,10667462,25735346,62160046,150020016,362257392,874442064,2111291570,5096782418,12305249242,29706645280,71719568260,173144117720,418010496238,1009160753578,2436339052550,5881827452904,14200012413288,34281822418776,82763705566474,199809155375386,482382142809218,1164573236325512,2811528946620524,6787630593737968,16386791001085334,39561211193091170,95509215657074014,230579638834615392,556668499268734944
lpb $0
sub $0,1
add $1,$3
sub $4,$5
add $4,1
add $4,$2
mov $5,$4
mov $4,$2
mov $2,$3
add $4,$1
add $5,$4
mov $3,$5
lpe
mov $0,$2
mul $0,2
|
src/asis/asis-implementation.adb | My-Colaborations/dynamo | 15 | 28723 | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A S I S . I M P L E M E N T A T I O N --
-- --
-- Copyright (C) 1995-2007, Free Software Foundation, Inc. --
-- --
-- ASIS-for-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 --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY 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 ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adaccore.com). --
-- --
------------------------------------------------------------------------------
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Asis.Errors; use Asis.Errors;
with Asis.Exceptions; use Asis.Exceptions;
with A4G.A_Debug; use A4G.A_Debug;
with A4G.A_Opt; use A4G.A_Opt;
with A4G.Contt; use A4G.Contt;
with A4G.Defaults;
with A4G.Vcheck; use A4G.Vcheck;
with A4G.A_Osint; use A4G.A_Osint;
with Gnatvsn;
with Opt;
package body Asis.Implementation is
Package_Name : constant String := "Asis.Implementation.";
----------------------
-- Asis_Implementor --
----------------------
function ASIS_Implementor return Wide_String is
begin
return "AdaCore (http://www.adacore.com)";
end ASIS_Implementor;
----------------------------------
-- ASIS_Implementor_Information --
----------------------------------
function ASIS_Implementor_Information return Wide_String is
begin
return
"Copyright (C) 1995-" &
To_Wide_String (Gnatvsn.Current_Year) &
", Free Software Foundation";
end ASIS_Implementor_Information;
------------------------------
-- ASIS_Implementor_Version --
------------------------------
function ASIS_Implementor_Version return Wide_String is
GNAT_Version : constant String := Gnatvsn.Gnat_Version_String;
First_Idx : constant Positive := GNAT_Version'First;
Last_Idx : Positive := GNAT_Version'Last;
Minus_Detected : Boolean := False;
begin
for J in reverse GNAT_Version'Range loop
if GNAT_Version (J) = '-' then
Last_Idx := J - 1;
Minus_Detected := True;
exit;
end if;
end loop;
if Minus_Detected then
return ASIS_Version & " for GNAT " &
To_Wide_String (GNAT_Version (First_Idx .. Last_Idx)) & ")";
else
return ASIS_Version & " for GNAT " &
To_Wide_String (GNAT_Version (First_Idx .. Last_Idx));
end if;
end ASIS_Implementor_Version;
------------------
-- ASIS_Version --
------------------
function ASIS_Version return Wide_String is
begin
return "ASIS 2.0.R";
end ASIS_Version;
---------------
-- Diagnosis --
---------------
function Diagnosis return Wide_String is
begin
-- The ASIS Diagnosis string uses only the first 256 values of
-- Wide_Character type
return To_Wide_String (Diagnosis_Buffer (1 .. Diagnosis_Len));
end Diagnosis;
--------------
-- Finalize --
--------------
procedure Finalize (Parameters : Wide_String := "") is
S_Parameters : constant String := Trim (To_String (Parameters), Both);
-- all the valid actuals for Parametes should contain only
-- characters from the first 256 values of Wide_Character type
begin
if not A4G.A_Opt.Is_Initialized then
return;
end if;
if Debug_Flag_C or else
Debug_Lib_Model or else
Debug_Mode
then
Print_Context_Info;
end if;
if S_Parameters'Length > 0 then
Process_Finalization_Parameters (S_Parameters);
end if;
A4G.Contt.Finalize;
A4G.A_Opt.Set_Off;
A4G.A_Debug.Set_Off;
A4G.A_Opt.Is_Initialized := False;
exception
when ASIS_Failed =>
A4G.A_Opt.Set_Off;
A4G.A_Debug.Set_Off;
A4G.A_Opt.Is_Initialized := False;
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information (Outer_Call =>
Package_Name & "Finalize");
end if;
raise;
when Ex : others =>
A4G.A_Opt.Set_Off;
A4G.A_Debug.Set_Off;
A4G.A_Opt.Is_Initialized := False;
Report_ASIS_Bug
(Query_Name => Package_Name & "Finalize",
Ex => Ex);
end Finalize;
----------------
-- Initialize --
----------------
procedure Initialize (Parameters : Wide_String := "") is
S_Parameters : constant String := Trim (To_String (Parameters), Both);
-- all the valid actuals for Parametes should contain only
-- characters from the first 256 values of Wide_Character type
begin
if A4G.A_Opt.Is_Initialized then
return;
end if;
if not A4G.A_Opt.Was_Initialized_At_Least_Once then
Opt.Maximum_File_Name_Length := Get_Max_File_Name_Length;
A4G.A_Opt.Was_Initialized_At_Least_Once := True;
end if;
if S_Parameters'Length > 0 then
Process_Initialization_Parameters (S_Parameters);
end if;
A4G.Contt.Initialize;
A4G.Defaults.Initialize;
A4G.A_Opt.Is_Initialized := True;
exception
when ASIS_Failed =>
A4G.A_Opt.Set_Off;
A4G.A_Debug.Set_Off;
A4G.A_Opt.Is_Initialized := False;
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information (Outer_Call =>
Package_Name & "Initialize");
end if;
raise;
when Ex : others =>
A4G.A_Opt.Set_Off;
A4G.A_Debug.Set_Off;
A4G.A_Opt.Is_Initialized := False;
Report_ASIS_Bug
(Query_Name => Package_Name & "Initialize",
Ex => Ex);
end Initialize;
------------------
-- Is_Finalized --
------------------
function Is_Finalized return Boolean is
begin
return not A4G.A_Opt.Is_Initialized;
end Is_Finalized;
--------------------
-- Is_Initialized --
--------------------
function Is_Initialized return Boolean is
begin
return A4G.A_Opt.Is_Initialized;
end Is_Initialized;
----------------
-- Set_Status --
----------------
procedure Set_Status
(Status : Asis.Errors.Error_Kinds := Asis.Errors.Not_An_Error;
Diagnosis : Wide_String := "")
is
begin
A4G.Vcheck.Set_Error_Status (Status => Status,
Diagnosis => To_String (Diagnosis));
end Set_Status;
------------
-- Status --
------------
function Status return Asis.Errors.Error_Kinds is
begin
return Status_Indicator;
end Status;
end Asis.Implementation;
|
regtests/ado-tests.ads | My-Colaborations/ada-ado | 0 | 4226 | -----------------------------------------------------------------------
-- ADO Tests -- Database sequence generator
-- Copyright (C) 2009, 2010, 2011, 2012, 2015 <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.
-----------------------------------------------------------------------
with Util.Tests;
package ADO.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with record
I1 : Integer;
I2 : Integer;
end record;
procedure Set_Up (T : in out Test);
procedure Test_Load (T : in out Test);
procedure Test_Create_Load (T : in out Test);
procedure Test_Not_Open (T : in out Test);
procedure Test_Allocate (T : in out Test);
procedure Test_Create_Save (T : in out Test);
procedure Test_Perf_Create_Save (T : in out Test);
procedure Test_Delete_All (T : in out Test);
-- Test string insert.
procedure Test_String (T : in out Test);
-- Test blob insert.
procedure Test_Blob (T : in out Test);
-- Test the To_Object and To_Identifier operations.
procedure Test_Identifier_To_Object (T : in out Test);
end ADO.Tests;
|
oeis/193/A193361.asm | neoneye/loda-programs | 11 | 2249 | ; A193361: a(0)=0, a(1)=0; for n>1, a(n) = a(n-1) + (n-3)*a(n-2) + 1.
; Submitted by <NAME>
; 0,0,1,2,4,9,22,59,170,525,1716,5917,21362,80533,315516,1281913,5383622,23330405,104084736,477371217,2246811730,10839493637,53528916508,270318789249,1394426035918,7341439399397,39413238225512,215607783811041,1200938739448842,6806741118535909,39232087083654644,229820838402660097,1367551363828644774,8262176515908447685,50656268794596435680,315045917303666761601,1986702787525349139042,12698263975850019033477,82232861539237238899948,539370364669837924105121,3581986241621615763403198
add $0,1
lpb $0
sub $0,2
lpb $0
sub $0,1
add $3,$4
sub $4,$3
add $3,1
mul $4,$2
sub $2,1
lpe
lpe
mov $0,$3
|
smsq/atari/nasty.asm | olifink/smsqe | 0 | 3873 | <filename>smsq/atari/nasty.asm<gh_stars>0
; Nasty Initialisation for Atari ST for SMSQ
section header
xref smsq_end
header_base
dc.l nasty_base-header_base ; length of header
dc.l 0 ; module length unknown
dc.l smsq_end-nasty_base ; loaded length
dc.l 0 ; checksum
dc.l 0 ; always select
dc.b 1 ; 1 level down
dc.b 0
dc.w smsq_name-*
smsq_name
dc.w 26,'SMSQ Atari Initialisation '
dc.l ' '
dc.w $200a
section init
xdef sms_wbase
xref rtc_init
xref at_poll
xref hw_poll
xref init_hdop
xref gu_exvt
xref sms_hdop
xref sms_rrtc
xref sms_srtc
xref sms_artc
include 'dev8_keys_sys'
include 'dev8_keys_psf'
include 'dev8_keys_atari'
include 'dev8_keys_68000'
include 'dev8_keys_qdos_sms'
include 'dev8_smsq_smsq_base_keys'
include 'dev8_mac_assert'
nasty_base
jsr init_hdop ; clean initialisation of hdop server
; The nasty initialisation requires a return to system state
; On exit the interrupts are cleared in the status register
moveq #sms.xtop,d0
trap #do.sms2 ; do code until rts as extop
clr.w psf_sr(a5) ; we can clear interrupts on return
move.b #3,sys_pmem(a6) ; set default protection level
lea at_int2,a0 ; set null interrupt level 2
move.l a0,exv_i2
lea at_int4,a0 ; set null interrupt level 4
move.l a0,exv_i4
lea at_poll,a0
move.l a0,vio_200h+mfp_vbas ; link in polling interrupt
lea hw_poll,a0
move.l a0,sms.hpoll ; and tidy up
lea sms_hdop,a0
move.l a0,sms.t1tab+sms.hdop*4 ; set hdop
assert sms.rrtc,sms.srtc-1,sms.artc-2
lea sms.t1tab+sms.rrtc*4,a1 ; set rtc
lea sms_rrtc,a0
move.l a0,(a1)+
lea sms_srtc,a0
move.l a0,(a1)+
lea sms_artc,a0
move.l a0,(a1)+
bset #mfp..tci,mfp_tcm ; unmask timer interrupt
move.b sys_ptyp(a6),d1 ; processor
cmp.b #$20,d1 ; 020 or more?
blt.s nasty_done ; ... no
moveq #sys.mtyp,d3
and.b sys_mtyp(a6),d3 ; machine type
cmp.b #sys.mmste,d3 ; mega ste of less?
bhi.s nasty_cache ; ... no
lea nasty_hc30e,a0 ; enable hypercache
moveq #exv_accf,d0 ; with access fault protection
jsr gu_exvt
nasty_cache
jsr sms.cenab ; enable both caches
clr.w sys_castt(a6) ; and say enabled
nasty_done
jsr rtc_init
move.l d1,sys_rtc(a6) ; set RTC
rts
nasty_hc30e
or.b #at.hc30e,at_hc30e ; enable hypercache 030 caches
rts
;+++
; Atari SMS2 interrupt 2,4 server sets interrupt mask to level 4
;---
at_int2
at_int4
or.w #$0400,(sp) ; level 2 (or 3)
and.w #$fcff,(sp) ; level 2
rte
sms_wbase
jmp sms.wbase
end
|
test/libraries.adb | treggit/sdlada | 89 | 5332 | <filename>test/libraries.adb
with SDL;
with SDL.Libraries;
with SDL.Log;
-- Run with: LD_LIBRARY_PATH=./gen/debug/test:$LD_LIBRARY_PATH ./gen/debug/test/libraries
procedure Libraries is
Lib : SDL.Libraries.Handles;
begin
SDL.Libraries.Load (Lib, "libtestmaths.so");
SDL.Log.Set (Category => SDL.Log.Application, Priority => SDL.Log.Debug);
declare
type Access_To_Add is access function (A, B : in Integer) return Integer;
type Access_To_Sub is access function (A, B : in Integer) return Integer with
Convention => C;
function Load is new SDL.Libraries.Load_Sub_Program
(Access_To_Sub_Program => Access_To_Add,
Name => "Add");
function Load is new SDL.Libraries.Load_Sub_Program
(Access_To_Sub_Program => Access_To_Sub,
Name => "sub");
Add : constant Access_To_Add := Load (From_Library => Lib);
Sub : constant Access_To_Sub := Load (From_Library => Lib);
begin
SDL.Log.Put_Debug ("1 + 2 = " & Integer'Image (Add (1, 2)));
SDL.Log.Put_Debug ("5 - 1 = " & Integer'Image (Sub (5, 1)));
end;
SDL.Finalise;
end Libraries;
|
scripts/Level changes/Change all cue levels by dialog.applescript | samschloegel/qlab-scripts | 8 | 4541 | <reponame>samschloegel/qlab-scripts<filename>scripts/Level changes/Change all cue levels by dialog.applescript
-- For help, bug reports, or feature suggestions, please visit https://github.com/samschloegel/qlab-scripts
-- Built for QLab 4. v211121-01
set defaultChange to "-2"
set minLevel to -100
tell application id "com.figure53.QLab.4" to tell front workspace
try
set theCue to last item of (selected as list)
if q type of theCue is in {"Audio", "Fade", "Mic"} then
set userInput to display dialog "How much?" default answer defaultChange buttons {"Cancel", "Continue"} default button "Continue"
set userIncrement to text returned of userInput
if button returned of userInput is "Continue" then
set theGangs to {}
repeat with i from 1 to 64
set currentLevel to theCue getLevel row 0 column i
set thisGang to getGang theCue row 0 column i
if (currentLevel > minLevel) and (thisGang is not in theGangs) then
theCue setLevel row 0 column i db currentLevel + userIncrement
if thisGang is not missing value then
set end of theGangs to thisGang
end if
end if
end repeat
end if
end if
on error
return
end try
end tell |
tests/src/container_suite.adb | bracke/brackelib | 1 | 17335 | <filename>tests/src/container_suite.adb
with Stacks_Tests; use Stacks_Tests;
with Queues_Tests; use Queues_Tests;
with AUnit.Test_Caller;
package body Container_Suite is
package Caller is new AUnit.Test_Caller (Stacks_Tests.Test);
package Caller2 is new AUnit.Test_Caller (Queues_Tests.Test);
function Suite return Access_Test_Suite is
Ret : constant Access_Test_Suite := new Test_Suite;
begin
Ret.Add_Test (Caller.Create ("Stacks - Push test", Test_Push'Access));
Ret.Add_Test (Caller.Create ("Stacks - Pop Test", Test_Pop'Access));
Ret.Add_Test (Caller.Create ("Stacks - Top Test", Test_Top'Access));
Ret.Add_Test (Caller.Create ("Stacks - Clear Test", Test_Clear'Access));
Ret.Add_Test (Caller2.Create ("Queues - Enqueue test", Test_Enqueue'Access));
Ret.Add_Test (Caller2.Create ("Queues - Dequeue Test", Test_Dequeue'Access));
Ret.Add_Test (Caller2.Create ("Queues - Clear Test", Test_Clear'Access));
Ret.Add_Test (Caller2.Create ("Queues - Is_Empty Test", Test_Empty'Access));
return Ret;
end Suite;
end Container_Suite;
|
libsrc/_DEVELOPMENT/math/float/am9511/c/sdcc/cam32_sdcc_lmul.asm | dikdom/z88dk | 1 | 99250 | <reponame>dikdom/z88dk
; long __lmul (long left, long right)
SECTION code_clib
SECTION code_fp_am9511
PUBLIC cam32_sdcc_lmul
EXTERN asm_sdcc_readr, asm_am9511_lmul
.cam32_sdcc_lmul
; multiply two sdcc longs
;
; enter : stack = sdcc_long right, sdcc_long left, ret
;
; exit : DEHL = sdcc_long(left*right)
;
; uses : af, bc, de, hl, af', bc', de', hl'
call asm_sdcc_readr
jp asm_am9511_lmul ; enter stack = sdcc_long right, sdcc_long left, ret
; DEHL = sdcc_long right
; return DEHL = sdcc_long
|
duel-main.asm | LeifBloomquist/ArtilleryDuel | 1 | 160621 | <filename>duel-main.asm
; duel-main.asm
; <NAME> - Network game for the Commodore 64!
;
; <NAME> (Game code) <EMAIL>
; <NAME> (Network code)
; <NAME> (Testing)
; <NAME> (Testing)
; <NAME> (Explosions)
; <NAME> (Fixed point math and hardware loan)
processor 6502
org $0801
;zeropage addresses and equates
include "equates.asm"
;macros
include "macros.asm"
include "duel-macros.asm"
BASIC ;6 sys 2064
dc.b $0c,$08,$06,$00,$9e,$20,$32,$30
dc.b $36,$34,$00,$00,$00,$00,$00
START
jsr initTOD
jsr STARTUPSCREEN
; Determine order - in future, random
PRINT CRLF, CG_GR3
PRINT "PRESS ",CG_WHT,"1",CG_GR3," TO CONNECT TO A SERVER", CRLF
PRINT "PRESS ",CG_WHT,"2",CG_GR3," TO SET UP A SERVER", CRLF,CRLF
lda #$00
sta ANNOUNCE_RECEIVED
GETPLAYERNUM
jsr $FFE4 ;GETIN - key in A
cmp #$00
beq GETPLAYERNUM
; Check for 1 or 2 and set my turn
cmp #$31 ;1
bne P2
; Set up Player 1 -------------------------
ldx #$01
stx MYTURN
ldx #$01
stx MYPLAYERNUM
ldx #$02
stx OPP_PLAYERNUM
jmp GETOPPONENTIP
P2
cmp #$32
bne GETPLAYERNUM
; Set up Player 2 -------------------------
ldx #$00
stx MYTURN
ldx #$02
stx MYPLAYERNUM
ldx #$01
stx OPP_PLAYERNUM
jmp NETSETUP ; Don't prompt for opponent address
GETOPPONENTIP
; Ask for opponent's IP address.
PRINT CG_BLU,"OPPONENT IP ADDRESS? ",CG_YEL
jsr getip
lda IP_OK
beq GETOPPONENTIP ;Zero if IP was invalid
PRINT CRLF,CRLF
NETSETUP
lda #<gotip
ldx #>gotip
jsr UDP_SET_DEST_IP
jsr SOUND_SETUP
; Network Setup
jsr net_init
bcc CARD_OK
PRINT CRLF,CG_WHT,"NO CARD FOUND!",CRLF
jmp nomac
CARD_OK
jsr irq_init
; Ports are hardcoded
; Source Port
lda #<3001
ldx #>3001
jsr UDP_SET_SRC_PORT
; Destination Port - same as the one we listen on
lda #<USER_DEST_PORT
ldx #>USER_DEST_PORT
jsr UDP_SET_DEST_PORT
;Figure out order
lda MYPLAYERNUM
cmp #$01
bne PLAYER2SEND
jmp PLAYER1SEND
; ---------------------------------------------------------------
; Player 2 must first "listen" for Player 1
PLAYER2SEND
PRINT CRLF,CG_LBL,"LISTENING FOR ANNOUNCE PACKETS ON UDP PORT "
PRINTWORD USER_DEST_PORT
PRINT CRLF
jsr WAITFORANNOUNCE
;Copy IP address from the incoming packet
PRINT CG_WHT,"OPPONENT IP:", CG_YEL
PRINT_IP INPACKET+$1A
lda #<(INPACKET+$1A)
ldx #>(INPACKET+$1A)
jsr UDP_SET_DEST_IP
jsr GATEWAYMAC ; Get gateway MAC once we know opponent's IP, if needed
;Now send our info, after a 1-second delay
PRINT CG_LBL,"REPLYING...",CRLF
jsr ONESECOND
jsr SENDANNOUNCE ; Blocks until ACK received
jmp MAINLOOP ; And on to the main game!
; ---------------------------------------------------------------
; Player 1 sends to Player 2 first
PLAYER1SEND
jsr GATEWAYMAC ; Get gateway MAC first, if needed
; Send the announce packet(s) to opponent, and wait for response.
PRINT CRLF,CG_LBL,"SENDING ANNOUNCE PACKETS TO UDP PORT "
PRINTWORD USER_DEST_PORT
PRINT " ON "
PRINT_IP UDP_DEST_IP
jsr SENDANNOUNCE ; Blocks until ACK received
PRINT CG_LBL,"WAITING FOR REPLY",CRLF
jsr ONESECOND
jsr WAITFORANNOUNCE
jmp MAINLOOP ; And on to the main game!
; --------------------------------------------------------------
WAITFORANNOUNCE ; Always clear and wait
lda #$00
sta PACKET_RECEIVED
WAITFORANNOUNCE1
lda ANNOUNCE_RECEIVED ; Set by irq
beq WAITFORANNOUNCE1
;Clear flags
lda #$00
sta ANNOUNCE_RECEIVED
sta PACKET_RECEIVED
;Opponent name was already copied in the IRQ
PRINT CRLF,CG_WHT,"OPPONENT NAME:",CG_YEL
PRINTSTRING OPP_NAME
PRINT CRLF
; Grab their player#
;lda INPACKET+$2C
;sta OPP_PLAYERNUM
rts
; =======================================
; Get Gateway MAC address
; =======================================
;Only get gateway MAC if the opponent's not on the local subnet
GATEWAYMAC
lda #<UDP_DEST_IP
ldx #>UDP_DEST_IP
jsr IPMASK
bcc MAC_SKIP
PRINT CG_LBL,CRLF,"RESOLVING GATEWAY MAC..."
jsr get_macs
bcc MAC_OK
;Flag errors
PRINT CRLF,CG_WHT,"ERROR RESOLVING THE GW MAC!",CRLF
nomac jmp nomac
MAC_OK
PRINT CG_LBL, "OK",CRLF
MAC_SKIP
rts
; This part ends around $0a45 - so there are a few hundred wasted bytes here.
; =================================================================
; Binary Includes
; =================================================================
;Include music here
org $0ffe ; $1000-2, because of the load address
incbin "eve_of_war.dat"
;Include charset here
org $1ffe ; $2000-2, because of the load address
incbin "duel2.font"
;Include the explosion sprites here - these are from WizardNJ! No load address
org $2800 ; Sprite block 160 or $A0
incbin "duel-explosions.spr"
; =================================================================
; Game Info
; =================================================================
OPP_NAME
dc.b $00,$00,$00,$00,$00,$00,$00,$00 ; 8 chars max
dc.b $00 ; Guarantee name is zero-terminated
ds.b $10 ; Big buffer on player name !!!! Get rid of this later
OPP_PLAYERNUM
dc.b $FF ; Overwritten
MYPLAYERNUM
dc.b $FF ; Overwritten
; ----------------------------------------------------------------
; Startup Screen
; ----------------------------------------------------------------
STARTUPSCREEN
; Black scary screen with red border
lda #$00
sta $d021
lda #$02
sta $d020
;Set up the font
lda #$19
sta $d018
PRINT CG_DCS ;Inhibit Shift/C=
; Title
PRINT CG_CLR,CG_LBL,"ARTILLERY DUEL ", CG_RED, "NETWORK ", CG_LBL, "1.0",CRLF,CRLF
; PAL/NTSC
jsr SETUP_PAL
PLOT 0,1
;Load and display config
jsr LOADCONFIG
PRINT CRLF,CG_BLU, "WELCOME ", CG_YEL
PRINTSTRING MY_NAME
PRINT CG_BLU, "!", CRLF,CRLF,"MY ADDRESS IS ", CG_YEL
PRINT_IP CARD_IP
PRINT CG_BLU, "MY NETMASK IS ", CG_YEL
PRINT_IP CARD_MASK
PRINT CG_BLU, "MY GATEWAY IS ", CG_YEL
PRINT_IP CARD_GATE
;Cue Music
jsr $1000
sei
lda #$01
sta $d019
sta $d01a
lda #$1b
sta $d011
lda #$7f
sta $dc0d
lda #$31
sta $d012
lda #<MUSIC
sta $0314
lda #>MUSIC
sta $0315
cli
rts
;---------------------------------------------------------------
NTSCCOUNT
.byte $07
MUSIC
inc $d019
lda #$31
sta $d012
;Using a PAL tune. Skip every 6th frame if NTSC
lda $2A6
bne MUSICPLAY
dec NTSCCOUNT
bne MUSICPLAY
lda #$07
sta NTSCCOUNT
jmp MUSIC_x
MUSICPLAY
jsr $1003
MUSIC_x
jmp $ea31
; ----------------------------------------------------------------
LOADCONFIG
; Todo, set up default, so if file isn't read we can still use default
PRINT CRLF,CG_BLU,"LOADING CONFIGURATION...",CRLF
;Check that device# isn't 0 (This is seen with Final Replay)
lda $BA
bne LOADOK
;Since it was, set it to 8
lda #$08
sta $BA
LOADOK
jsr LOADFILE
;MAC Address
lda $c008+0
sta CARD_MAC+0
lda $c008+1
sta CARD_MAC+1
lda $c008+2
sta CARD_MAC+2
lda $c008+3
sta CARD_MAC+3
lda $c008+4
sta CARD_MAC+4
lda $c008+5
sta CARD_MAC+5
; IP Address
lda $c010+0
sta CARD_IP+0
lda $c010+1
sta CARD_IP+1
lda $c010+2
sta CARD_IP+2
lda $c010+3
sta CARD_IP+3
;Netmask
lda $c016+0
sta CARD_MASK+0
lda $c016+1
sta CARD_MASK+1
lda $c016+2
sta CARD_MASK+2
lda $c016+3
sta CARD_MASK+3
;Gateway
lda $c01c+0
sta CARD_GATE+0
lda $c01c+1
sta CARD_GATE+1
lda $c01c+2
sta CARD_GATE+2
lda $c01c+3
sta CARD_GATE+3
;Player Name
ldx #$07
nameloop
lda $c028,x
sta MY_NAME,x
dex
cpx #$ff ; So the zeroth byte gets copied
bne nameloop
rts
; ----------------------------------------------------------------
; Includes
; ----------------------------------------------------------------
include "duel-game.asm"
include "leif-diskroutines.asm"
include "duel-send.asm"
include "duel-receive.asm"
include "duel-utils.asm"
include "duel-ipaddress.asm"
include "duel-chat.asm"
include "duel-screen.asm"
include "duel-trajectory.asm"
include "duel-soundfx.asm"
include "duel-joystick.asm"
include "SIXNET.ASM"
|
programs/oeis/043/A043643.asm | neoneye/loda | 22 | 171493 | <reponame>neoneye/loda
; A043643: Numbers whose base-10 representation has exactly 7 runs.
; 1010101,1010102,1010103,1010104,1010105,1010106,1010107,1010108,1010109,1010120,1010121,1010123,1010124,1010125,1010126,1010127,1010128,1010129,1010130,1010131,1010132,1010134,1010135,1010136
seq $0,43639 ; Numbers whose base-10 representation has exactly 3 runs.
add $0,1010000
|
Task/Create-a-file/Ada/create-a-file.ada | LaudateCorpus1/RosettaCodeData | 1 | 24855 | <filename>Task/Create-a-file/Ada/create-a-file.ada
with Ada.Streams.Stream_IO, Ada.Directories;
use Ada.Streams.Stream_IO, Ada.Directories;
procedure File_Creation is
File_Handle : File_Type;
begin
Create (File_Handle, Out_File, "output.txt");
Close (File_Handle);
Create_Directory("docs");
Create (File_Handle, Out_File, "/output.txt");
Close (File_Handle);
Create_Directory("/docs");
end File_Creation;
|
oslab6/obj/user/faultio.asm | jasha64/OperatingSystems-lab | 0 | 4562 | <filename>oslab6/obj/user/faultio.asm
obj/user/faultio.debug: 文件格式 elf32-i386
Disassembly of section .text:
00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
// See if we were started with arguments on the stack
cmpl $USTACKTOP, %esp
800020: 81 fc 00 e0 bf ee cmp $0xeebfe000,%esp
jne args_exist
800026: 75 04 jne 80002c <args_exist>
// If not, push dummy argc/argv arguments.
// This happens when we are loaded by the kernel,
// because the kernel does not know about passing arguments.
pushl $0
800028: 6a 00 push $0x0
pushl $0
80002a: 6a 00 push $0x0
0080002c <args_exist>:
args_exist:
call libmain
80002c: e8 3e 00 00 00 call 80006f <libmain>
1: jmp 1b
800031: eb fe jmp 800031 <args_exist+0x5>
00800033 <umain>:
#include <inc/lib.h>
#include <inc/x86.h>
void
umain(int argc, char **argv)
{
800033: 55 push %ebp
800034: 89 e5 mov %esp,%ebp
800036: 83 ec 08 sub $0x8,%esp
static inline uint32_t
read_eflags(void)
{
uint32_t eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
800039: 9c pushf
80003a: 58 pop %eax
int x, r;
int nsecs = 1;
int secno = 0;
int diskno = 1;
if (read_eflags() & FL_IOPL_3)
80003b: f6 c4 30 test $0x30,%ah
80003e: 75 1d jne 80005d <umain+0x2a>
asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
800040: b8 f0 ff ff ff mov $0xfffffff0,%eax
800045: ba f6 01 00 00 mov $0x1f6,%edx
80004a: ee out %al,(%dx)
// this outb to select disk 1 should result in a general protection
// fault, because user-level code shouldn't be able to use the io space.
outb(0x1F6, 0xE0 | (1<<4));
cprintf("%s: made it here --- bug\n");
80004b: 83 ec 0c sub $0xc,%esp
80004e: 68 0e 10 80 00 push $0x80100e
800053: e8 04 01 00 00 call 80015c <cprintf>
}
800058: 83 c4 10 add $0x10,%esp
80005b: c9 leave
80005c: c3 ret
cprintf("eflags wrong\n");
80005d: 83 ec 0c sub $0xc,%esp
800060: 68 00 10 80 00 push $0x801000
800065: e8 f2 00 00 00 call 80015c <cprintf>
80006a: 83 c4 10 add $0x10,%esp
80006d: eb d1 jmp 800040 <umain+0xd>
0080006f <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";
void
libmain(int argc, char **argv)
{
80006f: 55 push %ebp
800070: 89 e5 mov %esp,%ebp
800072: 56 push %esi
800073: 53 push %ebx
800074: 8b 5d 08 mov 0x8(%ebp),%ebx
800077: 8b 75 0c mov 0xc(%ebp),%esi
// set thisenv to point at our Env structure in envs[].
// LAB 3: Your code here.
envid_t envid = sys_getenvid();
80007a: e8 b7 0a 00 00 call 800b36 <sys_getenvid>
thisenv = envs + ENVX(envid);
80007f: 25 ff 03 00 00 and $0x3ff,%eax
800084: 6b c0 7c imul $0x7c,%eax,%eax
800087: 05 00 00 c0 ee add $0xeec00000,%eax
80008c: a3 04 20 80 00 mov %eax,0x802004
// save the name of the program so that panic() can use it
if (argc > 0)
800091: 85 db test %ebx,%ebx
800093: 7e 07 jle 80009c <libmain+0x2d>
binaryname = argv[0];
800095: 8b 06 mov (%esi),%eax
800097: a3 00 20 80 00 mov %eax,0x802000
// call user main routine
umain(argc, argv);
80009c: 83 ec 08 sub $0x8,%esp
80009f: 56 push %esi
8000a0: 53 push %ebx
8000a1: e8 8d ff ff ff call 800033 <umain>
// exit gracefully
exit();
8000a6: e8 0a 00 00 00 call 8000b5 <exit>
}
8000ab: 83 c4 10 add $0x10,%esp
8000ae: 8d 65 f8 lea -0x8(%ebp),%esp
8000b1: 5b pop %ebx
8000b2: 5e pop %esi
8000b3: 5d pop %ebp
8000b4: c3 ret
008000b5 <exit>:
#include <inc/lib.h>
void
exit(void)
{
8000b5: 55 push %ebp
8000b6: 89 e5 mov %esp,%ebp
8000b8: 83 ec 14 sub $0x14,%esp
// close_all();
sys_env_destroy(0);
8000bb: 6a 00 push $0x0
8000bd: e8 33 0a 00 00 call 800af5 <sys_env_destroy>
}
8000c2: 83 c4 10 add $0x10,%esp
8000c5: c9 leave
8000c6: c3 ret
008000c7 <putch>:
};
static void
putch(int ch, struct printbuf *b)
{
8000c7: 55 push %ebp
8000c8: 89 e5 mov %esp,%ebp
8000ca: 53 push %ebx
8000cb: 83 ec 04 sub $0x4,%esp
8000ce: 8b 5d 0c mov 0xc(%ebp),%ebx
b->buf[b->idx++] = ch;
8000d1: 8b 13 mov (%ebx),%edx
8000d3: 8d 42 01 lea 0x1(%edx),%eax
8000d6: 89 03 mov %eax,(%ebx)
8000d8: 8b 4d 08 mov 0x8(%ebp),%ecx
8000db: 88 4c 13 08 mov %cl,0x8(%ebx,%edx,1)
if (b->idx == 256-1) {
8000df: 3d ff 00 00 00 cmp $0xff,%eax
8000e4: 74 09 je 8000ef <putch+0x28>
sys_cputs(b->buf, b->idx);
b->idx = 0;
}
b->cnt++;
8000e6: 83 43 04 01 addl $0x1,0x4(%ebx)
}
8000ea: 8b 5d fc mov -0x4(%ebp),%ebx
8000ed: c9 leave
8000ee: c3 ret
sys_cputs(b->buf, b->idx);
8000ef: 83 ec 08 sub $0x8,%esp
8000f2: 68 ff 00 00 00 push $0xff
8000f7: 8d 43 08 lea 0x8(%ebx),%eax
8000fa: 50 push %eax
8000fb: e8 b8 09 00 00 call 800ab8 <sys_cputs>
b->idx = 0;
800100: c7 03 00 00 00 00 movl $0x0,(%ebx)
800106: 83 c4 10 add $0x10,%esp
800109: eb db jmp 8000e6 <putch+0x1f>
0080010b <vcprintf>:
int
vcprintf(const char *fmt, va_list ap)
{
80010b: 55 push %ebp
80010c: 89 e5 mov %esp,%ebp
80010e: 81 ec 18 01 00 00 sub $0x118,%esp
struct printbuf b;
b.idx = 0;
800114: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp)
80011b: 00 00 00
b.cnt = 0;
80011e: c7 85 f4 fe ff ff 00 movl $0x0,-0x10c(%ebp)
800125: 00 00 00
vprintfmt((void*)putch, &b, fmt, ap);
800128: ff 75 0c pushl 0xc(%ebp)
80012b: ff 75 08 pushl 0x8(%ebp)
80012e: 8d 85 f0 fe ff ff lea -0x110(%ebp),%eax
800134: 50 push %eax
800135: 68 c7 00 80 00 push $0x8000c7
80013a: e8 1a 01 00 00 call 800259 <vprintfmt>
sys_cputs(b.buf, b.idx);
80013f: 83 c4 08 add $0x8,%esp
800142: ff b5 f0 fe ff ff pushl -0x110(%ebp)
800148: 8d 85 f8 fe ff ff lea -0x108(%ebp),%eax
80014e: 50 push %eax
80014f: e8 64 09 00 00 call 800ab8 <sys_cputs>
return b.cnt;
}
800154: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80015a: c9 leave
80015b: c3 ret
0080015c <cprintf>:
int
cprintf(const char *fmt, ...)
{
80015c: 55 push %ebp
80015d: 89 e5 mov %esp,%ebp
80015f: 83 ec 10 sub $0x10,%esp
va_list ap;
int cnt;
va_start(ap, fmt);
800162: 8d 45 0c lea 0xc(%ebp),%eax
cnt = vcprintf(fmt, ap);
800165: 50 push %eax
800166: ff 75 08 pushl 0x8(%ebp)
800169: e8 9d ff ff ff call 80010b <vcprintf>
va_end(ap);
return cnt;
}
80016e: c9 leave
80016f: c3 ret
00800170 <printnum>:
* using specified putch function and associated pointer putdat.
*/
static void
printnum(void (*putch)(int, void*), void *putdat,
unsigned long long num, unsigned base, int width, int padc)
{
800170: 55 push %ebp
800171: 89 e5 mov %esp,%ebp
800173: 57 push %edi
800174: 56 push %esi
800175: 53 push %ebx
800176: 83 ec 1c sub $0x1c,%esp
800179: 89 c7 mov %eax,%edi
80017b: 89 d6 mov %edx,%esi
80017d: 8b 45 08 mov 0x8(%ebp),%eax
800180: 8b 55 0c mov 0xc(%ebp),%edx
800183: 89 45 d8 mov %eax,-0x28(%ebp)
800186: 89 55 dc mov %edx,-0x24(%ebp)
// first recursively print all preceding (more significant) digits
if (num >= base) {
800189: 8b 4d 10 mov 0x10(%ebp),%ecx
80018c: bb 00 00 00 00 mov $0x0,%ebx
800191: 89 4d e0 mov %ecx,-0x20(%ebp)
800194: 89 5d e4 mov %ebx,-0x1c(%ebp)
800197: 39 d3 cmp %edx,%ebx
800199: 72 05 jb 8001a0 <printnum+0x30>
80019b: 39 45 10 cmp %eax,0x10(%ebp)
80019e: 77 7a ja 80021a <printnum+0xaa>
printnum(putch, putdat, num / base, base, width - 1, padc);
8001a0: 83 ec 0c sub $0xc,%esp
8001a3: ff 75 18 pushl 0x18(%ebp)
8001a6: 8b 45 14 mov 0x14(%ebp),%eax
8001a9: 8d 58 ff lea -0x1(%eax),%ebx
8001ac: 53 push %ebx
8001ad: ff 75 10 pushl 0x10(%ebp)
8001b0: 83 ec 08 sub $0x8,%esp
8001b3: ff 75 e4 pushl -0x1c(%ebp)
8001b6: ff 75 e0 pushl -0x20(%ebp)
8001b9: ff 75 dc pushl -0x24(%ebp)
8001bc: ff 75 d8 pushl -0x28(%ebp)
8001bf: e8 ec 0b 00 00 call 800db0 <__udivdi3>
8001c4: 83 c4 18 add $0x18,%esp
8001c7: 52 push %edx
8001c8: 50 push %eax
8001c9: 89 f2 mov %esi,%edx
8001cb: 89 f8 mov %edi,%eax
8001cd: e8 9e ff ff ff call 800170 <printnum>
8001d2: 83 c4 20 add $0x20,%esp
8001d5: eb 13 jmp 8001ea <printnum+0x7a>
} else {
// print any needed pad characters before first digit
while (--width > 0)
putch(padc, putdat);
8001d7: 83 ec 08 sub $0x8,%esp
8001da: 56 push %esi
8001db: ff 75 18 pushl 0x18(%ebp)
8001de: ff d7 call *%edi
8001e0: 83 c4 10 add $0x10,%esp
while (--width > 0)
8001e3: 83 eb 01 sub $0x1,%ebx
8001e6: 85 db test %ebx,%ebx
8001e8: 7f ed jg 8001d7 <printnum+0x67>
}
// then print this (the least significant) digit
putch("0123456789abcdef"[num % base], putdat);
8001ea: 83 ec 08 sub $0x8,%esp
8001ed: 56 push %esi
8001ee: 83 ec 04 sub $0x4,%esp
8001f1: ff 75 e4 pushl -0x1c(%ebp)
8001f4: ff 75 e0 pushl -0x20(%ebp)
8001f7: ff 75 dc pushl -0x24(%ebp)
8001fa: ff 75 d8 pushl -0x28(%ebp)
8001fd: e8 ce 0c 00 00 call 800ed0 <__umoddi3>
800202: 83 c4 14 add $0x14,%esp
800205: 0f be 80 32 10 80 00 movsbl 0x801032(%eax),%eax
80020c: 50 push %eax
80020d: ff d7 call *%edi
}
80020f: 83 c4 10 add $0x10,%esp
800212: 8d 65 f4 lea -0xc(%ebp),%esp
800215: 5b pop %ebx
800216: 5e pop %esi
800217: 5f pop %edi
800218: 5d pop %ebp
800219: c3 ret
80021a: 8b 5d 14 mov 0x14(%ebp),%ebx
80021d: eb c4 jmp 8001e3 <printnum+0x73>
0080021f <sprintputch>:
int cnt;
};
static void
sprintputch(int ch, struct sprintbuf *b)
{
80021f: 55 push %ebp
800220: 89 e5 mov %esp,%ebp
800222: 8b 45 0c mov 0xc(%ebp),%eax
b->cnt++;
800225: 83 40 08 01 addl $0x1,0x8(%eax)
if (b->buf < b->ebuf)
800229: 8b 10 mov (%eax),%edx
80022b: 3b 50 04 cmp 0x4(%eax),%edx
80022e: 73 0a jae 80023a <sprintputch+0x1b>
*b->buf++ = ch;
800230: 8d 4a 01 lea 0x1(%edx),%ecx
800233: 89 08 mov %ecx,(%eax)
800235: 8b 45 08 mov 0x8(%ebp),%eax
800238: 88 02 mov %al,(%edx)
}
80023a: 5d pop %ebp
80023b: c3 ret
0080023c <printfmt>:
{
80023c: 55 push %ebp
80023d: 89 e5 mov %esp,%ebp
80023f: 83 ec 08 sub $0x8,%esp
va_start(ap, fmt);
800242: 8d 45 14 lea 0x14(%ebp),%eax
vprintfmt(putch, putdat, fmt, ap);
800245: 50 push %eax
800246: ff 75 10 pushl 0x10(%ebp)
800249: ff 75 0c pushl 0xc(%ebp)
80024c: ff 75 08 pushl 0x8(%ebp)
80024f: e8 05 00 00 00 call 800259 <vprintfmt>
}
800254: 83 c4 10 add $0x10,%esp
800257: c9 leave
800258: c3 ret
00800259 <vprintfmt>:
{
800259: 55 push %ebp
80025a: 89 e5 mov %esp,%ebp
80025c: 57 push %edi
80025d: 56 push %esi
80025e: 53 push %ebx
80025f: 83 ec 2c sub $0x2c,%esp
800262: 8b 75 08 mov 0x8(%ebp),%esi
800265: 8b 5d 0c mov 0xc(%ebp),%ebx
800268: 8b 7d 10 mov 0x10(%ebp),%edi
80026b: e9 c1 03 00 00 jmp 800631 <vprintfmt+0x3d8>
padc = ' ';
800270: c6 45 d4 20 movb $0x20,-0x2c(%ebp)
altflag = 0;
800274: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp)
precision = -1;
80027b: c7 45 d0 ff ff ff ff movl $0xffffffff,-0x30(%ebp)
width = -1;
800282: c7 45 e0 ff ff ff ff movl $0xffffffff,-0x20(%ebp)
lflag = 0;
800289: b9 00 00 00 00 mov $0x0,%ecx
switch (ch = *(unsigned char *) fmt++) {
80028e: 8d 47 01 lea 0x1(%edi),%eax
800291: 89 45 e4 mov %eax,-0x1c(%ebp)
800294: 0f b6 17 movzbl (%edi),%edx
800297: 8d 42 dd lea -0x23(%edx),%eax
80029a: 3c 55 cmp $0x55,%al
80029c: 0f 87 12 04 00 00 ja 8006b4 <vprintfmt+0x45b>
8002a2: 0f b6 c0 movzbl %al,%eax
8002a5: ff 24 85 80 11 80 00 jmp *0x801180(,%eax,4)
8002ac: 8b 7d e4 mov -0x1c(%ebp),%edi
padc = '-';
8002af: c6 45 d4 2d movb $0x2d,-0x2c(%ebp)
8002b3: eb d9 jmp 80028e <vprintfmt+0x35>
switch (ch = *(unsigned char *) fmt++) {
8002b5: 8b 7d e4 mov -0x1c(%ebp),%edi
padc = '0';
8002b8: c6 45 d4 30 movb $0x30,-0x2c(%ebp)
8002bc: eb d0 jmp 80028e <vprintfmt+0x35>
switch (ch = *(unsigned char *) fmt++) {
8002be: 0f b6 d2 movzbl %dl,%edx
8002c1: 8b 7d e4 mov -0x1c(%ebp),%edi
for (precision = 0; ; ++fmt) {
8002c4: b8 00 00 00 00 mov $0x0,%eax
8002c9: 89 4d e4 mov %ecx,-0x1c(%ebp)
precision = precision * 10 + ch - '0';
8002cc: 8d 04 80 lea (%eax,%eax,4),%eax
8002cf: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
ch = *fmt;
8002d3: 0f be 17 movsbl (%edi),%edx
if (ch < '0' || ch > '9')
8002d6: 8d 4a d0 lea -0x30(%edx),%ecx
8002d9: 83 f9 09 cmp $0x9,%ecx
8002dc: 77 55 ja 800333 <vprintfmt+0xda>
for (precision = 0; ; ++fmt) {
8002de: 83 c7 01 add $0x1,%edi
precision = precision * 10 + ch - '0';
8002e1: eb e9 jmp 8002cc <vprintfmt+0x73>
precision = va_arg(ap, int);
8002e3: 8b 45 14 mov 0x14(%ebp),%eax
8002e6: 8b 00 mov (%eax),%eax
8002e8: 89 45 d0 mov %eax,-0x30(%ebp)
8002eb: 8b 45 14 mov 0x14(%ebp),%eax
8002ee: 8d 40 04 lea 0x4(%eax),%eax
8002f1: 89 45 14 mov %eax,0x14(%ebp)
switch (ch = *(unsigned char *) fmt++) {
8002f4: 8b 7d e4 mov -0x1c(%ebp),%edi
if (width < 0)
8002f7: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
8002fb: 79 91 jns 80028e <vprintfmt+0x35>
width = precision, precision = -1;
8002fd: 8b 45 d0 mov -0x30(%ebp),%eax
800300: 89 45 e0 mov %eax,-0x20(%ebp)
800303: c7 45 d0 ff ff ff ff movl $0xffffffff,-0x30(%ebp)
80030a: eb 82 jmp 80028e <vprintfmt+0x35>
80030c: 8b 45 e0 mov -0x20(%ebp),%eax
80030f: 85 c0 test %eax,%eax
800311: ba 00 00 00 00 mov $0x0,%edx
800316: 0f 49 d0 cmovns %eax,%edx
800319: 89 55 e0 mov %edx,-0x20(%ebp)
switch (ch = *(unsigned char *) fmt++) {
80031c: 8b 7d e4 mov -0x1c(%ebp),%edi
80031f: e9 6a ff ff ff jmp 80028e <vprintfmt+0x35>
800324: 8b 7d e4 mov -0x1c(%ebp),%edi
altflag = 1;
800327: c7 45 d8 01 00 00 00 movl $0x1,-0x28(%ebp)
goto reswitch;
80032e: e9 5b ff ff ff jmp 80028e <vprintfmt+0x35>
800333: 8b 4d e4 mov -0x1c(%ebp),%ecx
800336: 89 45 d0 mov %eax,-0x30(%ebp)
800339: eb bc jmp 8002f7 <vprintfmt+0x9e>
lflag++;
80033b: 83 c1 01 add $0x1,%ecx
switch (ch = *(unsigned char *) fmt++) {
80033e: 8b 7d e4 mov -0x1c(%ebp),%edi
goto reswitch;
800341: e9 48 ff ff ff jmp 80028e <vprintfmt+0x35>
putch(va_arg(ap, int), putdat);
800346: 8b 45 14 mov 0x14(%ebp),%eax
800349: 8d 78 04 lea 0x4(%eax),%edi
80034c: 83 ec 08 sub $0x8,%esp
80034f: 53 push %ebx
800350: ff 30 pushl (%eax)
800352: ff d6 call *%esi
break;
800354: 83 c4 10 add $0x10,%esp
putch(va_arg(ap, int), putdat);
800357: 89 7d 14 mov %edi,0x14(%ebp)
break;
80035a: e9 cf 02 00 00 jmp 80062e <vprintfmt+0x3d5>
err = va_arg(ap, int);
80035f: 8b 45 14 mov 0x14(%ebp),%eax
800362: 8d 78 04 lea 0x4(%eax),%edi
800365: 8b 00 mov (%eax),%eax
800367: 99 cltd
800368: 31 d0 xor %edx,%eax
80036a: 29 d0 sub %edx,%eax
if (err >= MAXERROR || (p = error_string[err]) == NULL)
80036c: 83 f8 0f cmp $0xf,%eax
80036f: 7f 23 jg 800394 <vprintfmt+0x13b>
800371: 8b 14 85 e0 12 80 00 mov 0x8012e0(,%eax,4),%edx
800378: 85 d2 test %edx,%edx
80037a: 74 18 je 800394 <vprintfmt+0x13b>
printfmt(putch, putdat, "%s", p);
80037c: 52 push %edx
80037d: 68 53 10 80 00 push $0x801053
800382: 53 push %ebx
800383: 56 push %esi
800384: e8 b3 fe ff ff call 80023c <printfmt>
800389: 83 c4 10 add $0x10,%esp
err = va_arg(ap, int);
80038c: 89 7d 14 mov %edi,0x14(%ebp)
80038f: e9 9a 02 00 00 jmp 80062e <vprintfmt+0x3d5>
printfmt(putch, putdat, "error %d", err);
800394: 50 push %eax
800395: 68 4a 10 80 00 push $0x80104a
80039a: 53 push %ebx
80039b: 56 push %esi
80039c: e8 9b fe ff ff call 80023c <printfmt>
8003a1: 83 c4 10 add $0x10,%esp
err = va_arg(ap, int);
8003a4: 89 7d 14 mov %edi,0x14(%ebp)
printfmt(putch, putdat, "error %d", err);
8003a7: e9 82 02 00 00 jmp 80062e <vprintfmt+0x3d5>
if ((p = va_arg(ap, char *)) == NULL)
8003ac: 8b 45 14 mov 0x14(%ebp),%eax
8003af: 83 c0 04 add $0x4,%eax
8003b2: 89 45 cc mov %eax,-0x34(%ebp)
8003b5: 8b 45 14 mov 0x14(%ebp),%eax
8003b8: 8b 38 mov (%eax),%edi
p = "(null)";
8003ba: 85 ff test %edi,%edi
8003bc: b8 43 10 80 00 mov $0x801043,%eax
8003c1: 0f 44 f8 cmove %eax,%edi
if (width > 0 && padc != '-')
8003c4: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
8003c8: 0f 8e bd 00 00 00 jle 80048b <vprintfmt+0x232>
8003ce: 80 7d d4 2d cmpb $0x2d,-0x2c(%ebp)
8003d2: 75 0e jne 8003e2 <vprintfmt+0x189>
8003d4: 89 75 08 mov %esi,0x8(%ebp)
8003d7: 8b 75 d0 mov -0x30(%ebp),%esi
8003da: 89 5d 0c mov %ebx,0xc(%ebp)
8003dd: 8b 5d e0 mov -0x20(%ebp),%ebx
8003e0: eb 6d jmp 80044f <vprintfmt+0x1f6>
for (width -= strnlen(p, precision); width > 0; width--)
8003e2: 83 ec 08 sub $0x8,%esp
8003e5: ff 75 d0 pushl -0x30(%ebp)
8003e8: 57 push %edi
8003e9: e8 6e 03 00 00 call 80075c <strnlen>
8003ee: 8b 4d e0 mov -0x20(%ebp),%ecx
8003f1: 29 c1 sub %eax,%ecx
8003f3: 89 4d c8 mov %ecx,-0x38(%ebp)
8003f6: 83 c4 10 add $0x10,%esp
putch(padc, putdat);
8003f9: 0f be 45 d4 movsbl -0x2c(%ebp),%eax
8003fd: 89 45 e0 mov %eax,-0x20(%ebp)
800400: 89 7d d4 mov %edi,-0x2c(%ebp)
800403: 89 cf mov %ecx,%edi
for (width -= strnlen(p, precision); width > 0; width--)
800405: eb 0f jmp 800416 <vprintfmt+0x1bd>
putch(padc, putdat);
800407: 83 ec 08 sub $0x8,%esp
80040a: 53 push %ebx
80040b: ff 75 e0 pushl -0x20(%ebp)
80040e: ff d6 call *%esi
for (width -= strnlen(p, precision); width > 0; width--)
800410: 83 ef 01 sub $0x1,%edi
800413: 83 c4 10 add $0x10,%esp
800416: 85 ff test %edi,%edi
800418: 7f ed jg 800407 <vprintfmt+0x1ae>
80041a: 8b 7d d4 mov -0x2c(%ebp),%edi
80041d: 8b 4d c8 mov -0x38(%ebp),%ecx
800420: 85 c9 test %ecx,%ecx
800422: b8 00 00 00 00 mov $0x0,%eax
800427: 0f 49 c1 cmovns %ecx,%eax
80042a: 29 c1 sub %eax,%ecx
80042c: 89 75 08 mov %esi,0x8(%ebp)
80042f: 8b 75 d0 mov -0x30(%ebp),%esi
800432: 89 5d 0c mov %ebx,0xc(%ebp)
800435: 89 cb mov %ecx,%ebx
800437: eb 16 jmp 80044f <vprintfmt+0x1f6>
if (altflag && (ch < ' ' || ch > '~'))
800439: 83 7d d8 00 cmpl $0x0,-0x28(%ebp)
80043d: 75 31 jne 800470 <vprintfmt+0x217>
putch(ch, putdat);
80043f: 83 ec 08 sub $0x8,%esp
800442: ff 75 0c pushl 0xc(%ebp)
800445: 50 push %eax
800446: ff 55 08 call *0x8(%ebp)
800449: 83 c4 10 add $0x10,%esp
for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
80044c: 83 eb 01 sub $0x1,%ebx
80044f: 83 c7 01 add $0x1,%edi
800452: 0f b6 57 ff movzbl -0x1(%edi),%edx
800456: 0f be c2 movsbl %dl,%eax
800459: 85 c0 test %eax,%eax
80045b: 74 59 je 8004b6 <vprintfmt+0x25d>
80045d: 85 f6 test %esi,%esi
80045f: 78 d8 js 800439 <vprintfmt+0x1e0>
800461: 83 ee 01 sub $0x1,%esi
800464: 79 d3 jns 800439 <vprintfmt+0x1e0>
800466: 89 df mov %ebx,%edi
800468: 8b 75 08 mov 0x8(%ebp),%esi
80046b: 8b 5d 0c mov 0xc(%ebp),%ebx
80046e: eb 37 jmp 8004a7 <vprintfmt+0x24e>
if (altflag && (ch < ' ' || ch > '~'))
800470: 0f be d2 movsbl %dl,%edx
800473: 83 ea 20 sub $0x20,%edx
800476: 83 fa 5e cmp $0x5e,%edx
800479: 76 c4 jbe 80043f <vprintfmt+0x1e6>
putch('?', putdat);
80047b: 83 ec 08 sub $0x8,%esp
80047e: ff 75 0c pushl 0xc(%ebp)
800481: 6a 3f push $0x3f
800483: ff 55 08 call *0x8(%ebp)
800486: 83 c4 10 add $0x10,%esp
800489: eb c1 jmp 80044c <vprintfmt+0x1f3>
80048b: 89 75 08 mov %esi,0x8(%ebp)
80048e: 8b 75 d0 mov -0x30(%ebp),%esi
800491: 89 5d 0c mov %ebx,0xc(%ebp)
800494: 8b 5d e0 mov -0x20(%ebp),%ebx
800497: eb b6 jmp 80044f <vprintfmt+0x1f6>
putch(' ', putdat);
800499: 83 ec 08 sub $0x8,%esp
80049c: 53 push %ebx
80049d: 6a 20 push $0x20
80049f: ff d6 call *%esi
for (; width > 0; width--)
8004a1: 83 ef 01 sub $0x1,%edi
8004a4: 83 c4 10 add $0x10,%esp
8004a7: 85 ff test %edi,%edi
8004a9: 7f ee jg 800499 <vprintfmt+0x240>
if ((p = va_arg(ap, char *)) == NULL)
8004ab: 8b 45 cc mov -0x34(%ebp),%eax
8004ae: 89 45 14 mov %eax,0x14(%ebp)
8004b1: e9 78 01 00 00 jmp 80062e <vprintfmt+0x3d5>
8004b6: 89 df mov %ebx,%edi
8004b8: 8b 75 08 mov 0x8(%ebp),%esi
8004bb: 8b 5d 0c mov 0xc(%ebp),%ebx
8004be: eb e7 jmp 8004a7 <vprintfmt+0x24e>
if (lflag >= 2)
8004c0: 83 f9 01 cmp $0x1,%ecx
8004c3: 7e 3f jle 800504 <vprintfmt+0x2ab>
return va_arg(*ap, long long);
8004c5: 8b 45 14 mov 0x14(%ebp),%eax
8004c8: 8b 50 04 mov 0x4(%eax),%edx
8004cb: 8b 00 mov (%eax),%eax
8004cd: 89 45 d8 mov %eax,-0x28(%ebp)
8004d0: 89 55 dc mov %edx,-0x24(%ebp)
8004d3: 8b 45 14 mov 0x14(%ebp),%eax
8004d6: 8d 40 08 lea 0x8(%eax),%eax
8004d9: 89 45 14 mov %eax,0x14(%ebp)
if ((long long) num < 0) {
8004dc: 83 7d dc 00 cmpl $0x0,-0x24(%ebp)
8004e0: 79 5c jns 80053e <vprintfmt+0x2e5>
putch('-', putdat);
8004e2: 83 ec 08 sub $0x8,%esp
8004e5: 53 push %ebx
8004e6: 6a 2d push $0x2d
8004e8: ff d6 call *%esi
num = -(long long) num;
8004ea: 8b 55 d8 mov -0x28(%ebp),%edx
8004ed: 8b 4d dc mov -0x24(%ebp),%ecx
8004f0: f7 da neg %edx
8004f2: 83 d1 00 adc $0x0,%ecx
8004f5: f7 d9 neg %ecx
8004f7: 83 c4 10 add $0x10,%esp
base = 10;
8004fa: b8 0a 00 00 00 mov $0xa,%eax
8004ff: e9 10 01 00 00 jmp 800614 <vprintfmt+0x3bb>
else if (lflag)
800504: 85 c9 test %ecx,%ecx
800506: 75 1b jne 800523 <vprintfmt+0x2ca>
return va_arg(*ap, int);
800508: 8b 45 14 mov 0x14(%ebp),%eax
80050b: 8b 00 mov (%eax),%eax
80050d: 89 45 d8 mov %eax,-0x28(%ebp)
800510: 89 c1 mov %eax,%ecx
800512: c1 f9 1f sar $0x1f,%ecx
800515: 89 4d dc mov %ecx,-0x24(%ebp)
800518: 8b 45 14 mov 0x14(%ebp),%eax
80051b: 8d 40 04 lea 0x4(%eax),%eax
80051e: 89 45 14 mov %eax,0x14(%ebp)
800521: eb b9 jmp 8004dc <vprintfmt+0x283>
return va_arg(*ap, long);
800523: 8b 45 14 mov 0x14(%ebp),%eax
800526: 8b 00 mov (%eax),%eax
800528: 89 45 d8 mov %eax,-0x28(%ebp)
80052b: 89 c1 mov %eax,%ecx
80052d: c1 f9 1f sar $0x1f,%ecx
800530: 89 4d dc mov %ecx,-0x24(%ebp)
800533: 8b 45 14 mov 0x14(%ebp),%eax
800536: 8d 40 04 lea 0x4(%eax),%eax
800539: 89 45 14 mov %eax,0x14(%ebp)
80053c: eb 9e jmp 8004dc <vprintfmt+0x283>
num = getint(&ap, lflag);
80053e: 8b 55 d8 mov -0x28(%ebp),%edx
800541: 8b 4d dc mov -0x24(%ebp),%ecx
base = 10;
800544: b8 0a 00 00 00 mov $0xa,%eax
800549: e9 c6 00 00 00 jmp 800614 <vprintfmt+0x3bb>
if (lflag >= 2)
80054e: 83 f9 01 cmp $0x1,%ecx
800551: 7e 18 jle 80056b <vprintfmt+0x312>
return va_arg(*ap, unsigned long long);
800553: 8b 45 14 mov 0x14(%ebp),%eax
800556: 8b 10 mov (%eax),%edx
800558: 8b 48 04 mov 0x4(%eax),%ecx
80055b: 8d 40 08 lea 0x8(%eax),%eax
80055e: 89 45 14 mov %eax,0x14(%ebp)
base = 10;
800561: b8 0a 00 00 00 mov $0xa,%eax
800566: e9 a9 00 00 00 jmp 800614 <vprintfmt+0x3bb>
else if (lflag)
80056b: 85 c9 test %ecx,%ecx
80056d: 75 1a jne 800589 <vprintfmt+0x330>
return va_arg(*ap, unsigned int);
80056f: 8b 45 14 mov 0x14(%ebp),%eax
800572: 8b 10 mov (%eax),%edx
800574: b9 00 00 00 00 mov $0x0,%ecx
800579: 8d 40 04 lea 0x4(%eax),%eax
80057c: 89 45 14 mov %eax,0x14(%ebp)
base = 10;
80057f: b8 0a 00 00 00 mov $0xa,%eax
800584: e9 8b 00 00 00 jmp 800614 <vprintfmt+0x3bb>
return va_arg(*ap, unsigned long);
800589: 8b 45 14 mov 0x14(%ebp),%eax
80058c: 8b 10 mov (%eax),%edx
80058e: b9 00 00 00 00 mov $0x0,%ecx
800593: 8d 40 04 lea 0x4(%eax),%eax
800596: 89 45 14 mov %eax,0x14(%ebp)
base = 10;
800599: b8 0a 00 00 00 mov $0xa,%eax
80059e: eb 74 jmp 800614 <vprintfmt+0x3bb>
if (lflag >= 2)
8005a0: 83 f9 01 cmp $0x1,%ecx
8005a3: 7e 15 jle 8005ba <vprintfmt+0x361>
return va_arg(*ap, unsigned long long);
8005a5: 8b 45 14 mov 0x14(%ebp),%eax
8005a8: 8b 10 mov (%eax),%edx
8005aa: 8b 48 04 mov 0x4(%eax),%ecx
8005ad: 8d 40 08 lea 0x8(%eax),%eax
8005b0: 89 45 14 mov %eax,0x14(%ebp)
base = 8;
8005b3: b8 08 00 00 00 mov $0x8,%eax
8005b8: eb 5a jmp 800614 <vprintfmt+0x3bb>
else if (lflag)
8005ba: 85 c9 test %ecx,%ecx
8005bc: 75 17 jne 8005d5 <vprintfmt+0x37c>
return va_arg(*ap, unsigned int);
8005be: 8b 45 14 mov 0x14(%ebp),%eax
8005c1: 8b 10 mov (%eax),%edx
8005c3: b9 00 00 00 00 mov $0x0,%ecx
8005c8: 8d 40 04 lea 0x4(%eax),%eax
8005cb: 89 45 14 mov %eax,0x14(%ebp)
base = 8;
8005ce: b8 08 00 00 00 mov $0x8,%eax
8005d3: eb 3f jmp 800614 <vprintfmt+0x3bb>
return va_arg(*ap, unsigned long);
8005d5: 8b 45 14 mov 0x14(%ebp),%eax
8005d8: 8b 10 mov (%eax),%edx
8005da: b9 00 00 00 00 mov $0x0,%ecx
8005df: 8d 40 04 lea 0x4(%eax),%eax
8005e2: 89 45 14 mov %eax,0x14(%ebp)
base = 8;
8005e5: b8 08 00 00 00 mov $0x8,%eax
8005ea: eb 28 jmp 800614 <vprintfmt+0x3bb>
putch('0', putdat);
8005ec: 83 ec 08 sub $0x8,%esp
8005ef: 53 push %ebx
8005f0: 6a 30 push $0x30
8005f2: ff d6 call *%esi
putch('x', putdat);
8005f4: 83 c4 08 add $0x8,%esp
8005f7: 53 push %ebx
8005f8: 6a 78 push $0x78
8005fa: ff d6 call *%esi
num = (unsigned long long)
8005fc: 8b 45 14 mov 0x14(%ebp),%eax
8005ff: 8b 10 mov (%eax),%edx
800601: b9 00 00 00 00 mov $0x0,%ecx
goto number;
800606: 83 c4 10 add $0x10,%esp
(uintptr_t) va_arg(ap, void *);
800609: 8d 40 04 lea 0x4(%eax),%eax
80060c: 89 45 14 mov %eax,0x14(%ebp)
base = 16;
80060f: b8 10 00 00 00 mov $0x10,%eax
printnum(putch, putdat, num, base, width, padc);
800614: 83 ec 0c sub $0xc,%esp
800617: 0f be 7d d4 movsbl -0x2c(%ebp),%edi
80061b: 57 push %edi
80061c: ff 75 e0 pushl -0x20(%ebp)
80061f: 50 push %eax
800620: 51 push %ecx
800621: 52 push %edx
800622: 89 da mov %ebx,%edx
800624: 89 f0 mov %esi,%eax
800626: e8 45 fb ff ff call 800170 <printnum>
break;
80062b: 83 c4 20 add $0x20,%esp
err = va_arg(ap, int);
80062e: 8b 7d e4 mov -0x1c(%ebp),%edi
while ((ch = *(unsigned char *) fmt++) != '%') { //先将非格式化字符输出到控制台。
800631: 83 c7 01 add $0x1,%edi
800634: 0f b6 47 ff movzbl -0x1(%edi),%eax
800638: 83 f8 25 cmp $0x25,%eax
80063b: 0f 84 2f fc ff ff je 800270 <vprintfmt+0x17>
if (ch == '\0') //如果没有格式化字符直接返回
800641: 85 c0 test %eax,%eax
800643: 0f 84 8b 00 00 00 je 8006d4 <vprintfmt+0x47b>
putch(ch, putdat);
800649: 83 ec 08 sub $0x8,%esp
80064c: 53 push %ebx
80064d: 50 push %eax
80064e: ff d6 call *%esi
800650: 83 c4 10 add $0x10,%esp
800653: eb dc jmp 800631 <vprintfmt+0x3d8>
if (lflag >= 2)
800655: 83 f9 01 cmp $0x1,%ecx
800658: 7e 15 jle 80066f <vprintfmt+0x416>
return va_arg(*ap, unsigned long long);
80065a: 8b 45 14 mov 0x14(%ebp),%eax
80065d: 8b 10 mov (%eax),%edx
80065f: 8b 48 04 mov 0x4(%eax),%ecx
800662: 8d 40 08 lea 0x8(%eax),%eax
800665: 89 45 14 mov %eax,0x14(%ebp)
base = 16;
800668: b8 10 00 00 00 mov $0x10,%eax
80066d: eb a5 jmp 800614 <vprintfmt+0x3bb>
else if (lflag)
80066f: 85 c9 test %ecx,%ecx
800671: 75 17 jne 80068a <vprintfmt+0x431>
return va_arg(*ap, unsigned int);
800673: 8b 45 14 mov 0x14(%ebp),%eax
800676: 8b 10 mov (%eax),%edx
800678: b9 00 00 00 00 mov $0x0,%ecx
80067d: 8d 40 04 lea 0x4(%eax),%eax
800680: 89 45 14 mov %eax,0x14(%ebp)
base = 16;
800683: b8 10 00 00 00 mov $0x10,%eax
800688: eb 8a jmp 800614 <vprintfmt+0x3bb>
return va_arg(*ap, unsigned long);
80068a: 8b 45 14 mov 0x14(%ebp),%eax
80068d: 8b 10 mov (%eax),%edx
80068f: b9 00 00 00 00 mov $0x0,%ecx
800694: 8d 40 04 lea 0x4(%eax),%eax
800697: 89 45 14 mov %eax,0x14(%ebp)
base = 16;
80069a: b8 10 00 00 00 mov $0x10,%eax
80069f: e9 70 ff ff ff jmp 800614 <vprintfmt+0x3bb>
putch(ch, putdat);
8006a4: 83 ec 08 sub $0x8,%esp
8006a7: 53 push %ebx
8006a8: 6a 25 push $0x25
8006aa: ff d6 call *%esi
break;
8006ac: 83 c4 10 add $0x10,%esp
8006af: e9 7a ff ff ff jmp 80062e <vprintfmt+0x3d5>
putch('%', putdat);
8006b4: 83 ec 08 sub $0x8,%esp
8006b7: 53 push %ebx
8006b8: 6a 25 push $0x25
8006ba: ff d6 call *%esi
for (fmt--; fmt[-1] != '%'; fmt--)
8006bc: 83 c4 10 add $0x10,%esp
8006bf: 89 f8 mov %edi,%eax
8006c1: eb 03 jmp 8006c6 <vprintfmt+0x46d>
8006c3: 83 e8 01 sub $0x1,%eax
8006c6: 80 78 ff 25 cmpb $0x25,-0x1(%eax)
8006ca: 75 f7 jne 8006c3 <vprintfmt+0x46a>
8006cc: 89 45 e4 mov %eax,-0x1c(%ebp)
8006cf: e9 5a ff ff ff jmp 80062e <vprintfmt+0x3d5>
}
8006d4: 8d 65 f4 lea -0xc(%ebp),%esp
8006d7: 5b pop %ebx
8006d8: 5e pop %esi
8006d9: 5f pop %edi
8006da: 5d pop %ebp
8006db: c3 ret
008006dc <vsnprintf>:
int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
8006dc: 55 push %ebp
8006dd: 89 e5 mov %esp,%ebp
8006df: 83 ec 18 sub $0x18,%esp
8006e2: 8b 45 08 mov 0x8(%ebp),%eax
8006e5: 8b 55 0c mov 0xc(%ebp),%edx
struct sprintbuf b = {buf, buf+n-1, 0};
8006e8: 89 45 ec mov %eax,-0x14(%ebp)
8006eb: 8d 4c 10 ff lea -0x1(%eax,%edx,1),%ecx
8006ef: 89 4d f0 mov %ecx,-0x10(%ebp)
8006f2: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
if (buf == NULL || n < 1)
8006f9: 85 c0 test %eax,%eax
8006fb: 74 26 je 800723 <vsnprintf+0x47>
8006fd: 85 d2 test %edx,%edx
8006ff: 7e 22 jle 800723 <vsnprintf+0x47>
return -E_INVAL;
// print the string to the buffer
vprintfmt((void*)sprintputch, &b, fmt, ap);
800701: ff 75 14 pushl 0x14(%ebp)
800704: ff 75 10 pushl 0x10(%ebp)
800707: 8d 45 ec lea -0x14(%ebp),%eax
80070a: 50 push %eax
80070b: 68 1f 02 80 00 push $0x80021f
800710: e8 44 fb ff ff call 800259 <vprintfmt>
// null terminate the buffer
*b.buf = '\0';
800715: 8b 45 ec mov -0x14(%ebp),%eax
800718: c6 00 00 movb $0x0,(%eax)
return b.cnt;
80071b: 8b 45 f4 mov -0xc(%ebp),%eax
80071e: 83 c4 10 add $0x10,%esp
}
800721: c9 leave
800722: c3 ret
return -E_INVAL;
800723: b8 fd ff ff ff mov $0xfffffffd,%eax
800728: eb f7 jmp 800721 <vsnprintf+0x45>
0080072a <snprintf>:
int
snprintf(char *buf, int n, const char *fmt, ...)
{
80072a: 55 push %ebp
80072b: 89 e5 mov %esp,%ebp
80072d: 83 ec 08 sub $0x8,%esp
va_list ap;
int rc;
va_start(ap, fmt);
800730: 8d 45 14 lea 0x14(%ebp),%eax
rc = vsnprintf(buf, n, fmt, ap);
800733: 50 push %eax
800734: ff 75 10 pushl 0x10(%ebp)
800737: ff 75 0c pushl 0xc(%ebp)
80073a: ff 75 08 pushl 0x8(%ebp)
80073d: e8 9a ff ff ff call 8006dc <vsnprintf>
va_end(ap);
return rc;
}
800742: c9 leave
800743: c3 ret
00800744 <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1
int
strlen(const char *s)
{
800744: 55 push %ebp
800745: 89 e5 mov %esp,%ebp
800747: 8b 55 08 mov 0x8(%ebp),%edx
int n;
for (n = 0; *s != '\0'; s++)
80074a: b8 00 00 00 00 mov $0x0,%eax
80074f: eb 03 jmp 800754 <strlen+0x10>
n++;
800751: 83 c0 01 add $0x1,%eax
for (n = 0; *s != '\0'; s++)
800754: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1)
800758: 75 f7 jne 800751 <strlen+0xd>
return n;
}
80075a: 5d pop %ebp
80075b: c3 ret
0080075c <strnlen>:
int
strnlen(const char *s, size_t size)
{
80075c: 55 push %ebp
80075d: 89 e5 mov %esp,%ebp
80075f: 8b 4d 08 mov 0x8(%ebp),%ecx
800762: 8b 55 0c mov 0xc(%ebp),%edx
int n;
for (n = 0; size > 0 && *s != '\0'; s++, size--)
800765: b8 00 00 00 00 mov $0x0,%eax
80076a: eb 03 jmp 80076f <strnlen+0x13>
n++;
80076c: 83 c0 01 add $0x1,%eax
for (n = 0; size > 0 && *s != '\0'; s++, size--)
80076f: 39 d0 cmp %edx,%eax
800771: 74 06 je 800779 <strnlen+0x1d>
800773: 80 3c 01 00 cmpb $0x0,(%ecx,%eax,1)
800777: 75 f3 jne 80076c <strnlen+0x10>
return n;
}
800779: 5d pop %ebp
80077a: c3 ret
0080077b <strcpy>:
char *
strcpy(char *dst, const char *src)
{
80077b: 55 push %ebp
80077c: 89 e5 mov %esp,%ebp
80077e: 53 push %ebx
80077f: 8b 45 08 mov 0x8(%ebp),%eax
800782: 8b 4d 0c mov 0xc(%ebp),%ecx
char *ret;
ret = dst;
while ((*dst++ = *src++) != '\0')
800785: 89 c2 mov %eax,%edx
800787: 83 c1 01 add $0x1,%ecx
80078a: 83 c2 01 add $0x1,%edx
80078d: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
800791: 88 5a ff mov %bl,-0x1(%edx)
800794: 84 db test %bl,%bl
800796: 75 ef jne 800787 <strcpy+0xc>
/* do nothing */;
return ret;
}
800798: 5b pop %ebx
800799: 5d pop %ebp
80079a: c3 ret
0080079b <strcat>:
char *
strcat(char *dst, const char *src)
{
80079b: 55 push %ebp
80079c: 89 e5 mov %esp,%ebp
80079e: 53 push %ebx
80079f: 8b 5d 08 mov 0x8(%ebp),%ebx
int len = strlen(dst);
8007a2: 53 push %ebx
8007a3: e8 9c ff ff ff call 800744 <strlen>
8007a8: 83 c4 04 add $0x4,%esp
strcpy(dst + len, src);
8007ab: ff 75 0c pushl 0xc(%ebp)
8007ae: 01 d8 add %ebx,%eax
8007b0: 50 push %eax
8007b1: e8 c5 ff ff ff call 80077b <strcpy>
return dst;
}
8007b6: 89 d8 mov %ebx,%eax
8007b8: 8b 5d fc mov -0x4(%ebp),%ebx
8007bb: c9 leave
8007bc: c3 ret
008007bd <strncpy>:
char *
strncpy(char *dst, const char *src, size_t size) {
8007bd: 55 push %ebp
8007be: 89 e5 mov %esp,%ebp
8007c0: 56 push %esi
8007c1: 53 push %ebx
8007c2: 8b 75 08 mov 0x8(%ebp),%esi
8007c5: 8b 4d 0c mov 0xc(%ebp),%ecx
8007c8: 89 f3 mov %esi,%ebx
8007ca: 03 5d 10 add 0x10(%ebp),%ebx
size_t i;
char *ret;
ret = dst;
for (i = 0; i < size; i++) {
8007cd: 89 f2 mov %esi,%edx
8007cf: eb 0f jmp 8007e0 <strncpy+0x23>
*dst++ = *src;
8007d1: 83 c2 01 add $0x1,%edx
8007d4: 0f b6 01 movzbl (%ecx),%eax
8007d7: 88 42 ff mov %al,-0x1(%edx)
// If strlen(src) < size, null-pad 'dst' out to 'size' chars
if (*src != '\0')
src++;
8007da: 80 39 01 cmpb $0x1,(%ecx)
8007dd: 83 d9 ff sbb $0xffffffff,%ecx
for (i = 0; i < size; i++) {
8007e0: 39 da cmp %ebx,%edx
8007e2: 75 ed jne 8007d1 <strncpy+0x14>
}
return ret;
}
8007e4: 89 f0 mov %esi,%eax
8007e6: 5b pop %ebx
8007e7: 5e pop %esi
8007e8: 5d pop %ebp
8007e9: c3 ret
008007ea <strlcpy>:
size_t
strlcpy(char *dst, const char *src, size_t size)
{
8007ea: 55 push %ebp
8007eb: 89 e5 mov %esp,%ebp
8007ed: 56 push %esi
8007ee: 53 push %ebx
8007ef: 8b 75 08 mov 0x8(%ebp),%esi
8007f2: 8b 55 0c mov 0xc(%ebp),%edx
8007f5: 8b 4d 10 mov 0x10(%ebp),%ecx
8007f8: 89 f0 mov %esi,%eax
8007fa: 8d 5c 0e ff lea -0x1(%esi,%ecx,1),%ebx
char *dst_in;
dst_in = dst;
if (size > 0) {
8007fe: 85 c9 test %ecx,%ecx
800800: 75 0b jne 80080d <strlcpy+0x23>
800802: eb 17 jmp 80081b <strlcpy+0x31>
while (--size > 0 && *src != '\0')
*dst++ = *src++;
800804: 83 c2 01 add $0x1,%edx
800807: 83 c0 01 add $0x1,%eax
80080a: 88 48 ff mov %cl,-0x1(%eax)
while (--size > 0 && *src != '\0')
80080d: 39 d8 cmp %ebx,%eax
80080f: 74 07 je 800818 <strlcpy+0x2e>
800811: 0f b6 0a movzbl (%edx),%ecx
800814: 84 c9 test %cl,%cl
800816: 75 ec jne 800804 <strlcpy+0x1a>
*dst = '\0';
800818: c6 00 00 movb $0x0,(%eax)
}
return dst - dst_in;
80081b: 29 f0 sub %esi,%eax
}
80081d: 5b pop %ebx
80081e: 5e pop %esi
80081f: 5d pop %ebp
800820: c3 ret
00800821 <strcmp>:
int
strcmp(const char *p, const char *q)
{
800821: 55 push %ebp
800822: 89 e5 mov %esp,%ebp
800824: 8b 4d 08 mov 0x8(%ebp),%ecx
800827: 8b 55 0c mov 0xc(%ebp),%edx
while (*p && *p == *q)
80082a: eb 06 jmp 800832 <strcmp+0x11>
p++, q++;
80082c: 83 c1 01 add $0x1,%ecx
80082f: 83 c2 01 add $0x1,%edx
while (*p && *p == *q)
800832: 0f b6 01 movzbl (%ecx),%eax
800835: 84 c0 test %al,%al
800837: 74 04 je 80083d <strcmp+0x1c>
800839: 3a 02 cmp (%edx),%al
80083b: 74 ef je 80082c <strcmp+0xb>
return (int) ((unsigned char) *p - (unsigned char) *q);
80083d: 0f b6 c0 movzbl %al,%eax
800840: 0f b6 12 movzbl (%edx),%edx
800843: 29 d0 sub %edx,%eax
}
800845: 5d pop %ebp
800846: c3 ret
00800847 <strncmp>:
int
strncmp(const char *p, const char *q, size_t n)
{
800847: 55 push %ebp
800848: 89 e5 mov %esp,%ebp
80084a: 53 push %ebx
80084b: 8b 45 08 mov 0x8(%ebp),%eax
80084e: 8b 55 0c mov 0xc(%ebp),%edx
800851: 89 c3 mov %eax,%ebx
800853: 03 5d 10 add 0x10(%ebp),%ebx
while (n > 0 && *p && *p == *q)
800856: eb 06 jmp 80085e <strncmp+0x17>
n--, p++, q++;
800858: 83 c0 01 add $0x1,%eax
80085b: 83 c2 01 add $0x1,%edx
while (n > 0 && *p && *p == *q)
80085e: 39 d8 cmp %ebx,%eax
800860: 74 16 je 800878 <strncmp+0x31>
800862: 0f b6 08 movzbl (%eax),%ecx
800865: 84 c9 test %cl,%cl
800867: 74 04 je 80086d <strncmp+0x26>
800869: 3a 0a cmp (%edx),%cl
80086b: 74 eb je 800858 <strncmp+0x11>
if (n == 0)
return 0;
else
return (int) ((unsigned char) *p - (unsigned char) *q);
80086d: 0f b6 00 movzbl (%eax),%eax
800870: 0f b6 12 movzbl (%edx),%edx
800873: 29 d0 sub %edx,%eax
}
800875: 5b pop %ebx
800876: 5d pop %ebp
800877: c3 ret
return 0;
800878: b8 00 00 00 00 mov $0x0,%eax
80087d: eb f6 jmp 800875 <strncmp+0x2e>
0080087f <strchr>:
// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
80087f: 55 push %ebp
800880: 89 e5 mov %esp,%ebp
800882: 8b 45 08 mov 0x8(%ebp),%eax
800885: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for (; *s; s++)
800889: 0f b6 10 movzbl (%eax),%edx
80088c: 84 d2 test %dl,%dl
80088e: 74 09 je 800899 <strchr+0x1a>
if (*s == c)
800890: 38 ca cmp %cl,%dl
800892: 74 0a je 80089e <strchr+0x1f>
for (; *s; s++)
800894: 83 c0 01 add $0x1,%eax
800897: eb f0 jmp 800889 <strchr+0xa>
return (char *) s;
return 0;
800899: b8 00 00 00 00 mov $0x0,%eax
}
80089e: 5d pop %ebp
80089f: c3 ret
008008a0 <strfind>:
// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
8008a0: 55 push %ebp
8008a1: 89 e5 mov %esp,%ebp
8008a3: 8b 45 08 mov 0x8(%ebp),%eax
8008a6: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for (; *s; s++)
8008aa: eb 03 jmp 8008af <strfind+0xf>
8008ac: 83 c0 01 add $0x1,%eax
8008af: 0f b6 10 movzbl (%eax),%edx
if (*s == c)
8008b2: 38 ca cmp %cl,%dl
8008b4: 74 04 je 8008ba <strfind+0x1a>
8008b6: 84 d2 test %dl,%dl
8008b8: 75 f2 jne 8008ac <strfind+0xc>
break;
return (char *) s;
}
8008ba: 5d pop %ebp
8008bb: c3 ret
008008bc <memset>:
#if ASM
void *
memset(void *v, int c, size_t n)
{
8008bc: 55 push %ebp
8008bd: 89 e5 mov %esp,%ebp
8008bf: 57 push %edi
8008c0: 56 push %esi
8008c1: 53 push %ebx
8008c2: 8b 7d 08 mov 0x8(%ebp),%edi
8008c5: 8b 4d 10 mov 0x10(%ebp),%ecx
char *p;
if (n == 0)
8008c8: 85 c9 test %ecx,%ecx
8008ca: 74 13 je 8008df <memset+0x23>
return v;
if ((int)v%4 == 0 && n%4 == 0) {
8008cc: f7 c7 03 00 00 00 test $0x3,%edi
8008d2: 75 05 jne 8008d9 <memset+0x1d>
8008d4: f6 c1 03 test $0x3,%cl
8008d7: 74 0d je 8008e6 <memset+0x2a>
c = (c<<24)|(c<<16)|(c<<8)|c;
asm volatile("cld; rep stosl\n"
:: "D" (v), "a" (c), "c" (n/4)
: "cc", "memory");
} else
asm volatile("cld; rep stosb\n"
8008d9: 8b 45 0c mov 0xc(%ebp),%eax
8008dc: fc cld
8008dd: f3 aa rep stos %al,%es:(%edi)
:: "D" (v), "a" (c), "c" (n)
: "cc", "memory");
return v;
}
8008df: 89 f8 mov %edi,%eax
8008e1: 5b pop %ebx
8008e2: 5e pop %esi
8008e3: 5f pop %edi
8008e4: 5d pop %ebp
8008e5: c3 ret
c &= 0xFF;
8008e6: 0f b6 55 0c movzbl 0xc(%ebp),%edx
c = (c<<24)|(c<<16)|(c<<8)|c;
8008ea: 89 d3 mov %edx,%ebx
8008ec: c1 e3 08 shl $0x8,%ebx
8008ef: 89 d0 mov %edx,%eax
8008f1: c1 e0 18 shl $0x18,%eax
8008f4: 89 d6 mov %edx,%esi
8008f6: c1 e6 10 shl $0x10,%esi
8008f9: 09 f0 or %esi,%eax
8008fb: 09 c2 or %eax,%edx
8008fd: 09 da or %ebx,%edx
:: "D" (v), "a" (c), "c" (n/4)
8008ff: c1 e9 02 shr $0x2,%ecx
asm volatile("cld; rep stosl\n"
800902: 89 d0 mov %edx,%eax
800904: fc cld
800905: f3 ab rep stos %eax,%es:(%edi)
800907: eb d6 jmp 8008df <memset+0x23>
00800909 <memmove>:
void *
memmove(void *dst, const void *src, size_t n)
{
800909: 55 push %ebp
80090a: 89 e5 mov %esp,%ebp
80090c: 57 push %edi
80090d: 56 push %esi
80090e: 8b 45 08 mov 0x8(%ebp),%eax
800911: 8b 75 0c mov 0xc(%ebp),%esi
800914: 8b 4d 10 mov 0x10(%ebp),%ecx
const char *s;
char *d;
s = src;
d = dst;
if (s < d && s + n > d) {
800917: 39 c6 cmp %eax,%esi
800919: 73 35 jae 800950 <memmove+0x47>
80091b: 8d 14 0e lea (%esi,%ecx,1),%edx
80091e: 39 c2 cmp %eax,%edx
800920: 76 2e jbe 800950 <memmove+0x47>
s += n;
d += n;
800922: 8d 3c 08 lea (%eax,%ecx,1),%edi
if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
800925: 89 d6 mov %edx,%esi
800927: 09 fe or %edi,%esi
800929: f7 c6 03 00 00 00 test $0x3,%esi
80092f: 74 0c je 80093d <memmove+0x34>
asm volatile("std; rep movsl\n"
:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
else
asm volatile("std; rep movsb\n"
:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
800931: 83 ef 01 sub $0x1,%edi
800934: 8d 72 ff lea -0x1(%edx),%esi
asm volatile("std; rep movsb\n"
800937: fd std
800938: f3 a4 rep movsb %ds:(%esi),%es:(%edi)
// Some versions of GCC rely on DF being clear
asm volatile("cld" ::: "cc");
80093a: fc cld
80093b: eb 21 jmp 80095e <memmove+0x55>
if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
80093d: f6 c1 03 test $0x3,%cl
800940: 75 ef jne 800931 <memmove+0x28>
:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
800942: 83 ef 04 sub $0x4,%edi
800945: 8d 72 fc lea -0x4(%edx),%esi
800948: c1 e9 02 shr $0x2,%ecx
asm volatile("std; rep movsl\n"
80094b: fd std
80094c: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
80094e: eb ea jmp 80093a <memmove+0x31>
} else {
if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
800950: 89 f2 mov %esi,%edx
800952: 09 c2 or %eax,%edx
800954: f6 c2 03 test $0x3,%dl
800957: 74 09 je 800962 <memmove+0x59>
asm volatile("cld; rep movsl\n"
:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
else
asm volatile("cld; rep movsb\n"
800959: 89 c7 mov %eax,%edi
80095b: fc cld
80095c: f3 a4 rep movsb %ds:(%esi),%es:(%edi)
:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
}
return dst;
}
80095e: 5e pop %esi
80095f: 5f pop %edi
800960: 5d pop %ebp
800961: c3 ret
if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
800962: f6 c1 03 test $0x3,%cl
800965: 75 f2 jne 800959 <memmove+0x50>
:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
800967: c1 e9 02 shr $0x2,%ecx
asm volatile("cld; rep movsl\n"
80096a: 89 c7 mov %eax,%edi
80096c: fc cld
80096d: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
80096f: eb ed jmp 80095e <memmove+0x55>
00800971 <memcpy>:
}
#endif
void *
memcpy(void *dst, const void *src, size_t n)
{
800971: 55 push %ebp
800972: 89 e5 mov %esp,%ebp
return memmove(dst, src, n);
800974: ff 75 10 pushl 0x10(%ebp)
800977: ff 75 0c pushl 0xc(%ebp)
80097a: ff 75 08 pushl 0x8(%ebp)
80097d: e8 87 ff ff ff call 800909 <memmove>
}
800982: c9 leave
800983: c3 ret
00800984 <memcmp>:
int
memcmp(const void *v1, const void *v2, size_t n)
{
800984: 55 push %ebp
800985: 89 e5 mov %esp,%ebp
800987: 56 push %esi
800988: 53 push %ebx
800989: 8b 45 08 mov 0x8(%ebp),%eax
80098c: 8b 55 0c mov 0xc(%ebp),%edx
80098f: 89 c6 mov %eax,%esi
800991: 03 75 10 add 0x10(%ebp),%esi
const uint8_t *s1 = (const uint8_t *) v1;
const uint8_t *s2 = (const uint8_t *) v2;
while (n-- > 0) {
800994: 39 f0 cmp %esi,%eax
800996: 74 1c je 8009b4 <memcmp+0x30>
if (*s1 != *s2)
800998: 0f b6 08 movzbl (%eax),%ecx
80099b: 0f b6 1a movzbl (%edx),%ebx
80099e: 38 d9 cmp %bl,%cl
8009a0: 75 08 jne 8009aa <memcmp+0x26>
return (int) *s1 - (int) *s2;
s1++, s2++;
8009a2: 83 c0 01 add $0x1,%eax
8009a5: 83 c2 01 add $0x1,%edx
8009a8: eb ea jmp 800994 <memcmp+0x10>
return (int) *s1 - (int) *s2;
8009aa: 0f b6 c1 movzbl %cl,%eax
8009ad: 0f b6 db movzbl %bl,%ebx
8009b0: 29 d8 sub %ebx,%eax
8009b2: eb 05 jmp 8009b9 <memcmp+0x35>
}
return 0;
8009b4: b8 00 00 00 00 mov $0x0,%eax
}
8009b9: 5b pop %ebx
8009ba: 5e pop %esi
8009bb: 5d pop %ebp
8009bc: c3 ret
008009bd <memfind>:
void *
memfind(const void *s, int c, size_t n)
{
8009bd: 55 push %ebp
8009be: 89 e5 mov %esp,%ebp
8009c0: 8b 45 08 mov 0x8(%ebp),%eax
8009c3: 8b 4d 0c mov 0xc(%ebp),%ecx
const void *ends = (const char *) s + n;
8009c6: 89 c2 mov %eax,%edx
8009c8: 03 55 10 add 0x10(%ebp),%edx
for (; s < ends; s++)
8009cb: 39 d0 cmp %edx,%eax
8009cd: 73 09 jae 8009d8 <memfind+0x1b>
if (*(const unsigned char *) s == (unsigned char) c)
8009cf: 38 08 cmp %cl,(%eax)
8009d1: 74 05 je 8009d8 <memfind+0x1b>
for (; s < ends; s++)
8009d3: 83 c0 01 add $0x1,%eax
8009d6: eb f3 jmp 8009cb <memfind+0xe>
break;
return (void *) s;
}
8009d8: 5d pop %ebp
8009d9: c3 ret
008009da <strtol>:
long
strtol(const char *s, char **endptr, int base)
{
8009da: 55 push %ebp
8009db: 89 e5 mov %esp,%ebp
8009dd: 57 push %edi
8009de: 56 push %esi
8009df: 53 push %ebx
8009e0: 8b 4d 08 mov 0x8(%ebp),%ecx
8009e3: 8b 5d 10 mov 0x10(%ebp),%ebx
int neg = 0;
long val = 0;
// gobble initial whitespace
while (*s == ' ' || *s == '\t')
8009e6: eb 03 jmp 8009eb <strtol+0x11>
s++;
8009e8: 83 c1 01 add $0x1,%ecx
while (*s == ' ' || *s == '\t')
8009eb: 0f b6 01 movzbl (%ecx),%eax
8009ee: 3c 20 cmp $0x20,%al
8009f0: 74 f6 je 8009e8 <strtol+0xe>
8009f2: 3c 09 cmp $0x9,%al
8009f4: 74 f2 je 8009e8 <strtol+0xe>
// plus/minus sign
if (*s == '+')
8009f6: 3c 2b cmp $0x2b,%al
8009f8: 74 2e je 800a28 <strtol+0x4e>
int neg = 0;
8009fa: bf 00 00 00 00 mov $0x0,%edi
s++;
else if (*s == '-')
8009ff: 3c 2d cmp $0x2d,%al
800a01: 74 2f je 800a32 <strtol+0x58>
s++, neg = 1;
// hex or octal base prefix
if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
800a03: f7 c3 ef ff ff ff test $0xffffffef,%ebx
800a09: 75 05 jne 800a10 <strtol+0x36>
800a0b: 80 39 30 cmpb $0x30,(%ecx)
800a0e: 74 2c je 800a3c <strtol+0x62>
s += 2, base = 16;
else if (base == 0 && s[0] == '0')
800a10: 85 db test %ebx,%ebx
800a12: 75 0a jne 800a1e <strtol+0x44>
s++, base = 8;
else if (base == 0)
base = 10;
800a14: bb 0a 00 00 00 mov $0xa,%ebx
else if (base == 0 && s[0] == '0')
800a19: 80 39 30 cmpb $0x30,(%ecx)
800a1c: 74 28 je 800a46 <strtol+0x6c>
base = 10;
800a1e: b8 00 00 00 00 mov $0x0,%eax
800a23: 89 5d 10 mov %ebx,0x10(%ebp)
800a26: eb 50 jmp 800a78 <strtol+0x9e>
s++;
800a28: 83 c1 01 add $0x1,%ecx
int neg = 0;
800a2b: bf 00 00 00 00 mov $0x0,%edi
800a30: eb d1 jmp 800a03 <strtol+0x29>
s++, neg = 1;
800a32: 83 c1 01 add $0x1,%ecx
800a35: bf 01 00 00 00 mov $0x1,%edi
800a3a: eb c7 jmp 800a03 <strtol+0x29>
if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
800a3c: 80 79 01 78 cmpb $0x78,0x1(%ecx)
800a40: 74 0e je 800a50 <strtol+0x76>
else if (base == 0 && s[0] == '0')
800a42: 85 db test %ebx,%ebx
800a44: 75 d8 jne 800a1e <strtol+0x44>
s++, base = 8;
800a46: 83 c1 01 add $0x1,%ecx
800a49: bb 08 00 00 00 mov $0x8,%ebx
800a4e: eb ce jmp 800a1e <strtol+0x44>
s += 2, base = 16;
800a50: 83 c1 02 add $0x2,%ecx
800a53: bb 10 00 00 00 mov $0x10,%ebx
800a58: eb c4 jmp 800a1e <strtol+0x44>
while (1) {
int dig;
if (*s >= '0' && *s <= '9')
dig = *s - '0';
else if (*s >= 'a' && *s <= 'z')
800a5a: 8d 72 9f lea -0x61(%edx),%esi
800a5d: 89 f3 mov %esi,%ebx
800a5f: 80 fb 19 cmp $0x19,%bl
800a62: 77 29 ja 800a8d <strtol+0xb3>
dig = *s - 'a' + 10;
800a64: 0f be d2 movsbl %dl,%edx
800a67: 83 ea 57 sub $0x57,%edx
else if (*s >= 'A' && *s <= 'Z')
dig = *s - 'A' + 10;
else
break;
if (dig >= base)
800a6a: 3b 55 10 cmp 0x10(%ebp),%edx
800a6d: 7d 30 jge 800a9f <strtol+0xc5>
break;
s++, val = (val * base) + dig;
800a6f: 83 c1 01 add $0x1,%ecx
800a72: 0f af 45 10 imul 0x10(%ebp),%eax
800a76: 01 d0 add %edx,%eax
if (*s >= '0' && *s <= '9')
800a78: 0f b6 11 movzbl (%ecx),%edx
800a7b: 8d 72 d0 lea -0x30(%edx),%esi
800a7e: 89 f3 mov %esi,%ebx
800a80: 80 fb 09 cmp $0x9,%bl
800a83: 77 d5 ja 800a5a <strtol+0x80>
dig = *s - '0';
800a85: 0f be d2 movsbl %dl,%edx
800a88: 83 ea 30 sub $0x30,%edx
800a8b: eb dd jmp 800a6a <strtol+0x90>
else if (*s >= 'A' && *s <= 'Z')
800a8d: 8d 72 bf lea -0x41(%edx),%esi
800a90: 89 f3 mov %esi,%ebx
800a92: 80 fb 19 cmp $0x19,%bl
800a95: 77 08 ja 800a9f <strtol+0xc5>
dig = *s - 'A' + 10;
800a97: 0f be d2 movsbl %dl,%edx
800a9a: 83 ea 37 sub $0x37,%edx
800a9d: eb cb jmp 800a6a <strtol+0x90>
// we don't properly detect overflow!
}
if (endptr)
800a9f: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
800aa3: 74 05 je 800aaa <strtol+0xd0>
*endptr = (char *) s;
800aa5: 8b 75 0c mov 0xc(%ebp),%esi
800aa8: 89 0e mov %ecx,(%esi)
return (neg ? -val : val);
800aaa: 89 c2 mov %eax,%edx
800aac: f7 da neg %edx
800aae: 85 ff test %edi,%edi
800ab0: 0f 45 c2 cmovne %edx,%eax
}
800ab3: 5b pop %ebx
800ab4: 5e pop %esi
800ab5: 5f pop %edi
800ab6: 5d pop %ebp
800ab7: c3 ret
00800ab8 <sys_cputs>:
return ret;
}
void
sys_cputs(const char *s, size_t len)
{
800ab8: 55 push %ebp
800ab9: 89 e5 mov %esp,%ebp
800abb: 57 push %edi
800abc: 56 push %esi
800abd: 53 push %ebx
asm volatile("int %1\n" //执行int T_SYSCALL指令
800abe: b8 00 00 00 00 mov $0x0,%eax
800ac3: 8b 55 08 mov 0x8(%ebp),%edx
800ac6: 8b 4d 0c mov 0xc(%ebp),%ecx
800ac9: 89 c3 mov %eax,%ebx
800acb: 89 c7 mov %eax,%edi
800acd: 89 c6 mov %eax,%esi
800acf: cd 30 int $0x30
syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
800ad1: 5b pop %ebx
800ad2: 5e pop %esi
800ad3: 5f pop %edi
800ad4: 5d pop %ebp
800ad5: c3 ret
00800ad6 <sys_cgetc>:
int
sys_cgetc(void)
{
800ad6: 55 push %ebp
800ad7: 89 e5 mov %esp,%ebp
800ad9: 57 push %edi
800ada: 56 push %esi
800adb: 53 push %ebx
asm volatile("int %1\n" //执行int T_SYSCALL指令
800adc: ba 00 00 00 00 mov $0x0,%edx
800ae1: b8 01 00 00 00 mov $0x1,%eax
800ae6: 89 d1 mov %edx,%ecx
800ae8: 89 d3 mov %edx,%ebx
800aea: 89 d7 mov %edx,%edi
800aec: 89 d6 mov %edx,%esi
800aee: cd 30 int $0x30
return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
800af0: 5b pop %ebx
800af1: 5e pop %esi
800af2: 5f pop %edi
800af3: 5d pop %ebp
800af4: c3 ret
00800af5 <sys_env_destroy>:
int
sys_env_destroy(envid_t envid)
{
800af5: 55 push %ebp
800af6: 89 e5 mov %esp,%ebp
800af8: 57 push %edi
800af9: 56 push %esi
800afa: 53 push %ebx
800afb: 83 ec 0c sub $0xc,%esp
asm volatile("int %1\n" //执行int T_SYSCALL指令
800afe: b9 00 00 00 00 mov $0x0,%ecx
800b03: 8b 55 08 mov 0x8(%ebp),%edx
800b06: b8 03 00 00 00 mov $0x3,%eax
800b0b: 89 cb mov %ecx,%ebx
800b0d: 89 cf mov %ecx,%edi
800b0f: 89 ce mov %ecx,%esi
800b11: cd 30 int $0x30
if(check && ret > 0)
800b13: 85 c0 test %eax,%eax
800b15: 7f 08 jg 800b1f <sys_env_destroy+0x2a>
return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
800b17: 8d 65 f4 lea -0xc(%ebp),%esp
800b1a: 5b pop %ebx
800b1b: 5e pop %esi
800b1c: 5f pop %edi
800b1d: 5d pop %ebp
800b1e: c3 ret
panic("syscall %d returned %d (> 0)", num, ret);
800b1f: 83 ec 0c sub $0xc,%esp
800b22: 50 push %eax
800b23: 6a 03 push $0x3
800b25: 68 3f 13 80 00 push $0x80133f
800b2a: 6a 23 push $0x23
800b2c: 68 5c 13 80 00 push $0x80135c
800b31: e8 2f 02 00 00 call 800d65 <_panic>
00800b36 <sys_getenvid>:
envid_t
sys_getenvid(void)
{
800b36: 55 push %ebp
800b37: 89 e5 mov %esp,%ebp
800b39: 57 push %edi
800b3a: 56 push %esi
800b3b: 53 push %ebx
asm volatile("int %1\n" //执行int T_SYSCALL指令
800b3c: ba 00 00 00 00 mov $0x0,%edx
800b41: b8 02 00 00 00 mov $0x2,%eax
800b46: 89 d1 mov %edx,%ecx
800b48: 89 d3 mov %edx,%ebx
800b4a: 89 d7 mov %edx,%edi
800b4c: 89 d6 mov %edx,%esi
800b4e: cd 30 int $0x30
return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
800b50: 5b pop %ebx
800b51: 5e pop %esi
800b52: 5f pop %edi
800b53: 5d pop %ebp
800b54: c3 ret
00800b55 <sys_yield>:
void
sys_yield(void)
{
800b55: 55 push %ebp
800b56: 89 e5 mov %esp,%ebp
800b58: 57 push %edi
800b59: 56 push %esi
800b5a: 53 push %ebx
asm volatile("int %1\n" //执行int T_SYSCALL指令
800b5b: ba 00 00 00 00 mov $0x0,%edx
800b60: b8 0b 00 00 00 mov $0xb,%eax
800b65: 89 d1 mov %edx,%ecx
800b67: 89 d3 mov %edx,%ebx
800b69: 89 d7 mov %edx,%edi
800b6b: 89 d6 mov %edx,%esi
800b6d: cd 30 int $0x30
syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
800b6f: 5b pop %ebx
800b70: 5e pop %esi
800b71: 5f pop %edi
800b72: 5d pop %ebp
800b73: c3 ret
00800b74 <sys_page_alloc>:
int
sys_page_alloc(envid_t envid, void *va, int perm)
{
800b74: 55 push %ebp
800b75: 89 e5 mov %esp,%ebp
800b77: 57 push %edi
800b78: 56 push %esi
800b79: 53 push %ebx
800b7a: 83 ec 0c sub $0xc,%esp
asm volatile("int %1\n" //执行int T_SYSCALL指令
800b7d: be 00 00 00 00 mov $0x0,%esi
800b82: 8b 55 08 mov 0x8(%ebp),%edx
800b85: 8b 4d 0c mov 0xc(%ebp),%ecx
800b88: b8 04 00 00 00 mov $0x4,%eax
800b8d: 8b 5d 10 mov 0x10(%ebp),%ebx
800b90: 89 f7 mov %esi,%edi
800b92: cd 30 int $0x30
if(check && ret > 0)
800b94: 85 c0 test %eax,%eax
800b96: 7f 08 jg 800ba0 <sys_page_alloc+0x2c>
return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
800b98: 8d 65 f4 lea -0xc(%ebp),%esp
800b9b: 5b pop %ebx
800b9c: 5e pop %esi
800b9d: 5f pop %edi
800b9e: 5d pop %ebp
800b9f: c3 ret
panic("syscall %d returned %d (> 0)", num, ret);
800ba0: 83 ec 0c sub $0xc,%esp
800ba3: 50 push %eax
800ba4: 6a 04 push $0x4
800ba6: 68 3f 13 80 00 push $0x80133f
800bab: 6a 23 push $0x23
800bad: 68 5c 13 80 00 push $0x80135c
800bb2: e8 ae 01 00 00 call 800d65 <_panic>
00800bb7 <sys_page_map>:
int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
800bb7: 55 push %ebp
800bb8: 89 e5 mov %esp,%ebp
800bba: 57 push %edi
800bbb: 56 push %esi
800bbc: 53 push %ebx
800bbd: 83 ec 0c sub $0xc,%esp
asm volatile("int %1\n" //执行int T_SYSCALL指令
800bc0: 8b 55 08 mov 0x8(%ebp),%edx
800bc3: 8b 4d 0c mov 0xc(%ebp),%ecx
800bc6: b8 05 00 00 00 mov $0x5,%eax
800bcb: 8b 5d 10 mov 0x10(%ebp),%ebx
800bce: 8b 7d 14 mov 0x14(%ebp),%edi
800bd1: 8b 75 18 mov 0x18(%ebp),%esi
800bd4: cd 30 int $0x30
if(check && ret > 0)
800bd6: 85 c0 test %eax,%eax
800bd8: 7f 08 jg 800be2 <sys_page_map+0x2b>
return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
800bda: 8d 65 f4 lea -0xc(%ebp),%esp
800bdd: 5b pop %ebx
800bde: 5e pop %esi
800bdf: 5f pop %edi
800be0: 5d pop %ebp
800be1: c3 ret
panic("syscall %d returned %d (> 0)", num, ret);
800be2: 83 ec 0c sub $0xc,%esp
800be5: 50 push %eax
800be6: 6a 05 push $0x5
800be8: 68 3f 13 80 00 push $0x80133f
800bed: 6a 23 push $0x23
800bef: 68 5c 13 80 00 push $0x80135c
800bf4: e8 6c 01 00 00 call 800d65 <_panic>
00800bf9 <sys_page_unmap>:
int
sys_page_unmap(envid_t envid, void *va)
{
800bf9: 55 push %ebp
800bfa: 89 e5 mov %esp,%ebp
800bfc: 57 push %edi
800bfd: 56 push %esi
800bfe: 53 push %ebx
800bff: 83 ec 0c sub $0xc,%esp
asm volatile("int %1\n" //执行int T_SYSCALL指令
800c02: bb 00 00 00 00 mov $0x0,%ebx
800c07: 8b 55 08 mov 0x8(%ebp),%edx
800c0a: 8b 4d 0c mov 0xc(%ebp),%ecx
800c0d: b8 06 00 00 00 mov $0x6,%eax
800c12: 89 df mov %ebx,%edi
800c14: 89 de mov %ebx,%esi
800c16: cd 30 int $0x30
if(check && ret > 0)
800c18: 85 c0 test %eax,%eax
800c1a: 7f 08 jg 800c24 <sys_page_unmap+0x2b>
return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
800c1c: 8d 65 f4 lea -0xc(%ebp),%esp
800c1f: 5b pop %ebx
800c20: 5e pop %esi
800c21: 5f pop %edi
800c22: 5d pop %ebp
800c23: c3 ret
panic("syscall %d returned %d (> 0)", num, ret);
800c24: 83 ec 0c sub $0xc,%esp
800c27: 50 push %eax
800c28: 6a 06 push $0x6
800c2a: 68 3f 13 80 00 push $0x80133f
800c2f: 6a 23 push $0x23
800c31: 68 5c 13 80 00 push $0x80135c
800c36: e8 2a 01 00 00 call 800d65 <_panic>
00800c3b <sys_env_set_status>:
// sys_exofork is inlined in lib.h
int
sys_env_set_status(envid_t envid, int status)
{
800c3b: 55 push %ebp
800c3c: 89 e5 mov %esp,%ebp
800c3e: 57 push %edi
800c3f: 56 push %esi
800c40: 53 push %ebx
800c41: 83 ec 0c sub $0xc,%esp
asm volatile("int %1\n" //执行int T_SYSCALL指令
800c44: bb 00 00 00 00 mov $0x0,%ebx
800c49: 8b 55 08 mov 0x8(%ebp),%edx
800c4c: 8b 4d 0c mov 0xc(%ebp),%ecx
800c4f: b8 08 00 00 00 mov $0x8,%eax
800c54: 89 df mov %ebx,%edi
800c56: 89 de mov %ebx,%esi
800c58: cd 30 int $0x30
if(check && ret > 0)
800c5a: 85 c0 test %eax,%eax
800c5c: 7f 08 jg 800c66 <sys_env_set_status+0x2b>
return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
800c5e: 8d 65 f4 lea -0xc(%ebp),%esp
800c61: 5b pop %ebx
800c62: 5e pop %esi
800c63: 5f pop %edi
800c64: 5d pop %ebp
800c65: c3 ret
panic("syscall %d returned %d (> 0)", num, ret);
800c66: 83 ec 0c sub $0xc,%esp
800c69: 50 push %eax
800c6a: 6a 08 push $0x8
800c6c: 68 3f 13 80 00 push $0x80133f
800c71: 6a 23 push $0x23
800c73: 68 5c 13 80 00 push $0x80135c
800c78: e8 e8 00 00 00 call 800d65 <_panic>
00800c7d <sys_env_set_trapframe>:
int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
800c7d: 55 push %ebp
800c7e: 89 e5 mov %esp,%ebp
800c80: 57 push %edi
800c81: 56 push %esi
800c82: 53 push %ebx
800c83: 83 ec 0c sub $0xc,%esp
asm volatile("int %1\n" //执行int T_SYSCALL指令
800c86: bb 00 00 00 00 mov $0x0,%ebx
800c8b: 8b 55 08 mov 0x8(%ebp),%edx
800c8e: 8b 4d 0c mov 0xc(%ebp),%ecx
800c91: b8 09 00 00 00 mov $0x9,%eax
800c96: 89 df mov %ebx,%edi
800c98: 89 de mov %ebx,%esi
800c9a: cd 30 int $0x30
if(check && ret > 0)
800c9c: 85 c0 test %eax,%eax
800c9e: 7f 08 jg 800ca8 <sys_env_set_trapframe+0x2b>
return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
800ca0: 8d 65 f4 lea -0xc(%ebp),%esp
800ca3: 5b pop %ebx
800ca4: 5e pop %esi
800ca5: 5f pop %edi
800ca6: 5d pop %ebp
800ca7: c3 ret
panic("syscall %d returned %d (> 0)", num, ret);
800ca8: 83 ec 0c sub $0xc,%esp
800cab: 50 push %eax
800cac: 6a 09 push $0x9
800cae: 68 3f 13 80 00 push $0x80133f
800cb3: 6a 23 push $0x23
800cb5: 68 5c 13 80 00 push $0x80135c
800cba: e8 a6 00 00 00 call 800d65 <_panic>
00800cbf <sys_env_set_pgfault_upcall>:
int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
800cbf: 55 push %ebp
800cc0: 89 e5 mov %esp,%ebp
800cc2: 57 push %edi
800cc3: 56 push %esi
800cc4: 53 push %ebx
800cc5: 83 ec 0c sub $0xc,%esp
asm volatile("int %1\n" //执行int T_SYSCALL指令
800cc8: bb 00 00 00 00 mov $0x0,%ebx
800ccd: 8b 55 08 mov 0x8(%ebp),%edx
800cd0: 8b 4d 0c mov 0xc(%ebp),%ecx
800cd3: b8 0a 00 00 00 mov $0xa,%eax
800cd8: 89 df mov %ebx,%edi
800cda: 89 de mov %ebx,%esi
800cdc: cd 30 int $0x30
if(check && ret > 0)
800cde: 85 c0 test %eax,%eax
800ce0: 7f 08 jg 800cea <sys_env_set_pgfault_upcall+0x2b>
return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
800ce2: 8d 65 f4 lea -0xc(%ebp),%esp
800ce5: 5b pop %ebx
800ce6: 5e pop %esi
800ce7: 5f pop %edi
800ce8: 5d pop %ebp
800ce9: c3 ret
panic("syscall %d returned %d (> 0)", num, ret);
800cea: 83 ec 0c sub $0xc,%esp
800ced: 50 push %eax
800cee: 6a 0a push $0xa
800cf0: 68 3f 13 80 00 push $0x80133f
800cf5: 6a 23 push $0x23
800cf7: 68 5c 13 80 00 push $0x80135c
800cfc: e8 64 00 00 00 call 800d65 <_panic>
00800d01 <sys_ipc_try_send>:
int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
800d01: 55 push %ebp
800d02: 89 e5 mov %esp,%ebp
800d04: 57 push %edi
800d05: 56 push %esi
800d06: 53 push %ebx
asm volatile("int %1\n" //执行int T_SYSCALL指令
800d07: 8b 55 08 mov 0x8(%ebp),%edx
800d0a: 8b 4d 0c mov 0xc(%ebp),%ecx
800d0d: b8 0c 00 00 00 mov $0xc,%eax
800d12: be 00 00 00 00 mov $0x0,%esi
800d17: 8b 5d 10 mov 0x10(%ebp),%ebx
800d1a: 8b 7d 14 mov 0x14(%ebp),%edi
800d1d: cd 30 int $0x30
return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
800d1f: 5b pop %ebx
800d20: 5e pop %esi
800d21: 5f pop %edi
800d22: 5d pop %ebp
800d23: c3 ret
00800d24 <sys_ipc_recv>:
int
sys_ipc_recv(void *dstva)
{
800d24: 55 push %ebp
800d25: 89 e5 mov %esp,%ebp
800d27: 57 push %edi
800d28: 56 push %esi
800d29: 53 push %ebx
800d2a: 83 ec 0c sub $0xc,%esp
asm volatile("int %1\n" //执行int T_SYSCALL指令
800d2d: b9 00 00 00 00 mov $0x0,%ecx
800d32: 8b 55 08 mov 0x8(%ebp),%edx
800d35: b8 0d 00 00 00 mov $0xd,%eax
800d3a: 89 cb mov %ecx,%ebx
800d3c: 89 cf mov %ecx,%edi
800d3e: 89 ce mov %ecx,%esi
800d40: cd 30 int $0x30
if(check && ret > 0)
800d42: 85 c0 test %eax,%eax
800d44: 7f 08 jg 800d4e <sys_ipc_recv+0x2a>
return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
800d46: 8d 65 f4 lea -0xc(%ebp),%esp
800d49: 5b pop %ebx
800d4a: 5e pop %esi
800d4b: 5f pop %edi
800d4c: 5d pop %ebp
800d4d: c3 ret
panic("syscall %d returned %d (> 0)", num, ret);
800d4e: 83 ec 0c sub $0xc,%esp
800d51: 50 push %eax
800d52: 6a 0d push $0xd
800d54: 68 3f 13 80 00 push $0x80133f
800d59: 6a 23 push $0x23
800d5b: 68 5c 13 80 00 push $0x80135c
800d60: e8 00 00 00 00 call 800d65 <_panic>
00800d65 <_panic>:
* It prints "panic: <message>", then causes a breakpoint exception,
* which causes JOS to enter the JOS kernel monitor.
*/
void
_panic(const char *file, int line, const char *fmt, ...)
{
800d65: 55 push %ebp
800d66: 89 e5 mov %esp,%ebp
800d68: 56 push %esi
800d69: 53 push %ebx
va_list ap;
va_start(ap, fmt);
800d6a: 8d 5d 14 lea 0x14(%ebp),%ebx
// Print the panic message
cprintf("[%08x] user panic in %s at %s:%d: ",
800d6d: 8b 35 00 20 80 00 mov 0x802000,%esi
800d73: e8 be fd ff ff call 800b36 <sys_getenvid>
800d78: 83 ec 0c sub $0xc,%esp
800d7b: ff 75 0c pushl 0xc(%ebp)
800d7e: ff 75 08 pushl 0x8(%ebp)
800d81: 56 push %esi
800d82: 50 push %eax
800d83: 68 6c 13 80 00 push $0x80136c
800d88: e8 cf f3 ff ff call 80015c <cprintf>
sys_getenvid(), binaryname, file, line);
vcprintf(fmt, ap);
800d8d: 83 c4 18 add $0x18,%esp
800d90: 53 push %ebx
800d91: ff 75 10 pushl 0x10(%ebp)
800d94: e8 72 f3 ff ff call 80010b <vcprintf>
cprintf("\n");
800d99: c7 04 24 0c 10 80 00 movl $0x80100c,(%esp)
800da0: e8 b7 f3 ff ff call 80015c <cprintf>
800da5: 83 c4 10 add $0x10,%esp
// Cause a breakpoint exception
while (1)
asm volatile("int3");
800da8: cc int3
800da9: eb fd jmp 800da8 <_panic+0x43>
800dab: 66 90 xchg %ax,%ax
800dad: 66 90 xchg %ax,%ax
800daf: 90 nop
00800db0 <__udivdi3>:
800db0: 55 push %ebp
800db1: 57 push %edi
800db2: 56 push %esi
800db3: 53 push %ebx
800db4: 83 ec 1c sub $0x1c,%esp
800db7: 8b 54 24 3c mov 0x3c(%esp),%edx
800dbb: 8b 6c 24 30 mov 0x30(%esp),%ebp
800dbf: 8b 74 24 34 mov 0x34(%esp),%esi
800dc3: 8b 5c 24 38 mov 0x38(%esp),%ebx
800dc7: 85 d2 test %edx,%edx
800dc9: 75 35 jne 800e00 <__udivdi3+0x50>
800dcb: 39 f3 cmp %esi,%ebx
800dcd: 0f 87 bd 00 00 00 ja 800e90 <__udivdi3+0xe0>
800dd3: 85 db test %ebx,%ebx
800dd5: 89 d9 mov %ebx,%ecx
800dd7: 75 0b jne 800de4 <__udivdi3+0x34>
800dd9: b8 01 00 00 00 mov $0x1,%eax
800dde: 31 d2 xor %edx,%edx
800de0: f7 f3 div %ebx
800de2: 89 c1 mov %eax,%ecx
800de4: 31 d2 xor %edx,%edx
800de6: 89 f0 mov %esi,%eax
800de8: f7 f1 div %ecx
800dea: 89 c6 mov %eax,%esi
800dec: 89 e8 mov %ebp,%eax
800dee: 89 f7 mov %esi,%edi
800df0: f7 f1 div %ecx
800df2: 89 fa mov %edi,%edx
800df4: 83 c4 1c add $0x1c,%esp
800df7: 5b pop %ebx
800df8: 5e pop %esi
800df9: 5f pop %edi
800dfa: 5d pop %ebp
800dfb: c3 ret
800dfc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
800e00: 39 f2 cmp %esi,%edx
800e02: 77 7c ja 800e80 <__udivdi3+0xd0>
800e04: 0f bd fa bsr %edx,%edi
800e07: 83 f7 1f xor $0x1f,%edi
800e0a: 0f 84 98 00 00 00 je 800ea8 <__udivdi3+0xf8>
800e10: 89 f9 mov %edi,%ecx
800e12: b8 20 00 00 00 mov $0x20,%eax
800e17: 29 f8 sub %edi,%eax
800e19: d3 e2 shl %cl,%edx
800e1b: 89 54 24 08 mov %edx,0x8(%esp)
800e1f: 89 c1 mov %eax,%ecx
800e21: 89 da mov %ebx,%edx
800e23: d3 ea shr %cl,%edx
800e25: 8b 4c 24 08 mov 0x8(%esp),%ecx
800e29: 09 d1 or %edx,%ecx
800e2b: 89 f2 mov %esi,%edx
800e2d: 89 4c 24 08 mov %ecx,0x8(%esp)
800e31: 89 f9 mov %edi,%ecx
800e33: d3 e3 shl %cl,%ebx
800e35: 89 c1 mov %eax,%ecx
800e37: d3 ea shr %cl,%edx
800e39: 89 f9 mov %edi,%ecx
800e3b: 89 5c 24 0c mov %ebx,0xc(%esp)
800e3f: d3 e6 shl %cl,%esi
800e41: 89 eb mov %ebp,%ebx
800e43: 89 c1 mov %eax,%ecx
800e45: d3 eb shr %cl,%ebx
800e47: 09 de or %ebx,%esi
800e49: 89 f0 mov %esi,%eax
800e4b: f7 74 24 08 divl 0x8(%esp)
800e4f: 89 d6 mov %edx,%esi
800e51: 89 c3 mov %eax,%ebx
800e53: f7 64 24 0c mull 0xc(%esp)
800e57: 39 d6 cmp %edx,%esi
800e59: 72 0c jb 800e67 <__udivdi3+0xb7>
800e5b: 89 f9 mov %edi,%ecx
800e5d: d3 e5 shl %cl,%ebp
800e5f: 39 c5 cmp %eax,%ebp
800e61: 73 5d jae 800ec0 <__udivdi3+0x110>
800e63: 39 d6 cmp %edx,%esi
800e65: 75 59 jne 800ec0 <__udivdi3+0x110>
800e67: 8d 43 ff lea -0x1(%ebx),%eax
800e6a: 31 ff xor %edi,%edi
800e6c: 89 fa mov %edi,%edx
800e6e: 83 c4 1c add $0x1c,%esp
800e71: 5b pop %ebx
800e72: 5e pop %esi
800e73: 5f pop %edi
800e74: 5d pop %ebp
800e75: c3 ret
800e76: 8d 76 00 lea 0x0(%esi),%esi
800e79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
800e80: 31 ff xor %edi,%edi
800e82: 31 c0 xor %eax,%eax
800e84: 89 fa mov %edi,%edx
800e86: 83 c4 1c add $0x1c,%esp
800e89: 5b pop %ebx
800e8a: 5e pop %esi
800e8b: 5f pop %edi
800e8c: 5d pop %ebp
800e8d: c3 ret
800e8e: 66 90 xchg %ax,%ax
800e90: 31 ff xor %edi,%edi
800e92: 89 e8 mov %ebp,%eax
800e94: 89 f2 mov %esi,%edx
800e96: f7 f3 div %ebx
800e98: 89 fa mov %edi,%edx
800e9a: 83 c4 1c add $0x1c,%esp
800e9d: 5b pop %ebx
800e9e: 5e pop %esi
800e9f: 5f pop %edi
800ea0: 5d pop %ebp
800ea1: c3 ret
800ea2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
800ea8: 39 f2 cmp %esi,%edx
800eaa: 72 06 jb 800eb2 <__udivdi3+0x102>
800eac: 31 c0 xor %eax,%eax
800eae: 39 eb cmp %ebp,%ebx
800eb0: 77 d2 ja 800e84 <__udivdi3+0xd4>
800eb2: b8 01 00 00 00 mov $0x1,%eax
800eb7: eb cb jmp 800e84 <__udivdi3+0xd4>
800eb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
800ec0: 89 d8 mov %ebx,%eax
800ec2: 31 ff xor %edi,%edi
800ec4: eb be jmp 800e84 <__udivdi3+0xd4>
800ec6: 66 90 xchg %ax,%ax
800ec8: 66 90 xchg %ax,%ax
800eca: 66 90 xchg %ax,%ax
800ecc: 66 90 xchg %ax,%ax
800ece: 66 90 xchg %ax,%ax
00800ed0 <__umoddi3>:
800ed0: 55 push %ebp
800ed1: 57 push %edi
800ed2: 56 push %esi
800ed3: 53 push %ebx
800ed4: 83 ec 1c sub $0x1c,%esp
800ed7: 8b 6c 24 3c mov 0x3c(%esp),%ebp
800edb: 8b 74 24 30 mov 0x30(%esp),%esi
800edf: 8b 5c 24 34 mov 0x34(%esp),%ebx
800ee3: 8b 7c 24 38 mov 0x38(%esp),%edi
800ee7: 85 ed test %ebp,%ebp
800ee9: 89 f0 mov %esi,%eax
800eeb: 89 da mov %ebx,%edx
800eed: 75 19 jne 800f08 <__umoddi3+0x38>
800eef: 39 df cmp %ebx,%edi
800ef1: 0f 86 b1 00 00 00 jbe 800fa8 <__umoddi3+0xd8>
800ef7: f7 f7 div %edi
800ef9: 89 d0 mov %edx,%eax
800efb: 31 d2 xor %edx,%edx
800efd: 83 c4 1c add $0x1c,%esp
800f00: 5b pop %ebx
800f01: 5e pop %esi
800f02: 5f pop %edi
800f03: 5d pop %ebp
800f04: c3 ret
800f05: 8d 76 00 lea 0x0(%esi),%esi
800f08: 39 dd cmp %ebx,%ebp
800f0a: 77 f1 ja 800efd <__umoddi3+0x2d>
800f0c: 0f bd cd bsr %ebp,%ecx
800f0f: 83 f1 1f xor $0x1f,%ecx
800f12: 89 4c 24 04 mov %ecx,0x4(%esp)
800f16: 0f 84 b4 00 00 00 je 800fd0 <__umoddi3+0x100>
800f1c: b8 20 00 00 00 mov $0x20,%eax
800f21: 89 c2 mov %eax,%edx
800f23: 8b 44 24 04 mov 0x4(%esp),%eax
800f27: 29 c2 sub %eax,%edx
800f29: 89 c1 mov %eax,%ecx
800f2b: 89 f8 mov %edi,%eax
800f2d: d3 e5 shl %cl,%ebp
800f2f: 89 d1 mov %edx,%ecx
800f31: 89 54 24 0c mov %edx,0xc(%esp)
800f35: d3 e8 shr %cl,%eax
800f37: 09 c5 or %eax,%ebp
800f39: 8b 44 24 04 mov 0x4(%esp),%eax
800f3d: 89 c1 mov %eax,%ecx
800f3f: d3 e7 shl %cl,%edi
800f41: 89 d1 mov %edx,%ecx
800f43: 89 7c 24 08 mov %edi,0x8(%esp)
800f47: 89 df mov %ebx,%edi
800f49: d3 ef shr %cl,%edi
800f4b: 89 c1 mov %eax,%ecx
800f4d: 89 f0 mov %esi,%eax
800f4f: d3 e3 shl %cl,%ebx
800f51: 89 d1 mov %edx,%ecx
800f53: 89 fa mov %edi,%edx
800f55: d3 e8 shr %cl,%eax
800f57: 0f b6 4c 24 04 movzbl 0x4(%esp),%ecx
800f5c: 09 d8 or %ebx,%eax
800f5e: f7 f5 div %ebp
800f60: d3 e6 shl %cl,%esi
800f62: 89 d1 mov %edx,%ecx
800f64: f7 64 24 08 mull 0x8(%esp)
800f68: 39 d1 cmp %edx,%ecx
800f6a: 89 c3 mov %eax,%ebx
800f6c: 89 d7 mov %edx,%edi
800f6e: 72 06 jb 800f76 <__umoddi3+0xa6>
800f70: 75 0e jne 800f80 <__umoddi3+0xb0>
800f72: 39 c6 cmp %eax,%esi
800f74: 73 0a jae 800f80 <__umoddi3+0xb0>
800f76: 2b 44 24 08 sub 0x8(%esp),%eax
800f7a: 19 ea sbb %ebp,%edx
800f7c: 89 d7 mov %edx,%edi
800f7e: 89 c3 mov %eax,%ebx
800f80: 89 ca mov %ecx,%edx
800f82: 0f b6 4c 24 0c movzbl 0xc(%esp),%ecx
800f87: 29 de sub %ebx,%esi
800f89: 19 fa sbb %edi,%edx
800f8b: 8b 5c 24 04 mov 0x4(%esp),%ebx
800f8f: 89 d0 mov %edx,%eax
800f91: d3 e0 shl %cl,%eax
800f93: 89 d9 mov %ebx,%ecx
800f95: d3 ee shr %cl,%esi
800f97: d3 ea shr %cl,%edx
800f99: 09 f0 or %esi,%eax
800f9b: 83 c4 1c add $0x1c,%esp
800f9e: 5b pop %ebx
800f9f: 5e pop %esi
800fa0: 5f pop %edi
800fa1: 5d pop %ebp
800fa2: c3 ret
800fa3: 90 nop
800fa4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
800fa8: 85 ff test %edi,%edi
800faa: 89 f9 mov %edi,%ecx
800fac: 75 0b jne 800fb9 <__umoddi3+0xe9>
800fae: b8 01 00 00 00 mov $0x1,%eax
800fb3: 31 d2 xor %edx,%edx
800fb5: f7 f7 div %edi
800fb7: 89 c1 mov %eax,%ecx
800fb9: 89 d8 mov %ebx,%eax
800fbb: 31 d2 xor %edx,%edx
800fbd: f7 f1 div %ecx
800fbf: 89 f0 mov %esi,%eax
800fc1: f7 f1 div %ecx
800fc3: e9 31 ff ff ff jmp 800ef9 <__umoddi3+0x29>
800fc8: 90 nop
800fc9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
800fd0: 39 dd cmp %ebx,%ebp
800fd2: 72 08 jb 800fdc <__umoddi3+0x10c>
800fd4: 39 f7 cmp %esi,%edi
800fd6: 0f 87 21 ff ff ff ja 800efd <__umoddi3+0x2d>
800fdc: 89 da mov %ebx,%edx
800fde: 89 f0 mov %esi,%eax
800fe0: 29 f8 sub %edi,%eax
800fe2: 19 ea sbb %ebp,%edx
800fe4: e9 14 ff ff ff jmp 800efd <__umoddi3+0x2d>
|
programs/oeis/271/A271035.asm | karttu/loda | 0 | 429 | <reponame>karttu/loda<gh_stars>0
; A271035: Number of 3 X 3 X 3 triangular 0..n arrays with some element less than a w, nw or ne neighbor exactly once.
; 10,72,294,896,2268,5040,10164,19008,33462,56056,90090,139776,210392,308448,441864,620160,854658,1158696,1547854,2040192,2656500,3420560,4359420,5503680,6887790,8550360,10534482,12888064,15664176,18921408,22724240,27143424,32256378,38147592,44909046,52640640,61450636,71456112,82783428,95568704,109958310,126109368,144190266,164381184,186874632,211876000,239604120,270291840,304186610,341551080,382663710,427819392,477330084,531525456,590753548,655381440,725795934,802404248,885634722,975937536,1073785440,1179674496,1294124832,1417681408,1550914794,1694421960,1848827078,2014782336,2192968764,2384097072,2588908500,2808175680,3042703510,3293330040,3560927370,3846402560,4150698552,4474795104,4819709736,5186498688,5576257890,5990123944,6429275118,6894932352,7388360276,7910868240,8463811356,9048591552,9666658638,10319511384,11008698610,11735820288,12502528656,13310529344,14161582512,15057504000,16000166490,16991500680,18033496470,19128204160,20277735660,21484265712,22750033124,24077342016,25468563078,26926134840,28452564954,30050431488,31722384232,33471146016,35299514040,37210361216,39206637522,41291371368,43467670974,45738725760,48107807748,50578272976,53153562924,55837205952,58632818750,61544107800,64574870850,67728998400,71010475200,74423381760,77971895872,81660294144,85492953546,89474352968,93609074790,97901806464,102357342108,106980584112,111776544756,116750347840,121907230326,127252543992,132791757098,138530456064,144474347160,150629258208,157001140296,163596069504,170420248642,177480009000,184781812110,192332251520,200138054580,208206084240,216543340860,225156964032,234054234414,243242575576,252729555858,262522890240,272630442224,283060225728,293820406992,304919306496,316365400890,328167324936,340333873462,352874003328,365796835404,379111656560,392827921668,406955255616,421503455334,436482491832,451902512250,467773841920,484106986440,500912633760,518201656280,535985112960,554274251442,573080510184,592415520606,612291109248,632719299940,653712315984,675282582348,697442727872,720205587486,743584204440,767591832546,792241938432,817548203808,843524527744,870185028960,897544048128,925616150186,954416126664,983958998022,1014260016000,1045334665980,1077198669360,1109867985940,1143358816320,1177687604310,1212871039352,1248926058954,1285869851136,1323719856888,1362493772640,1402209552744,1442885411968,1484539828002,1527191543976
mov $1,$0
add $1,5
bin $1,$0
add $0,5
mul $1,$0
mul $1,2
|
lib/devices/ios/osa/background.scpt | zhichaoren/appium | 0 | 774 | on run argv
if (count of argv) > 1 then
set appName to item 1 of argv
set delayInSec to item 2 of argv as integer
end if
tell application "System Events" to tell process "Simulator"
activate
set frontmost to true
keystroke "h" using {shift down, command down} # background app
delay delayInSec
set frontmost to true
keystroke "h" using {shift down, command down} # go to home screen, page 1
delay 1
tell slider 1 of window 1
set pos to position
set s to size
end tell
set sliderTitle to title of slider 1 of window 1
set pageTotalText to text ((offset of "of " in sliderTitle) + 2) thru -1 in sliderTitle
set numCount to count of characters in pageTotalText
set pageTotal to pageTotalText as integer
repeat while pageTotal > 0 and appName is not in title of UI elements of window 1
click at {((item 1 of pos) + (item 1 of s) * 0.7), ((item 2 of pos) + (item 2 of s) / 2)}
delay 1
set pageTotal to pageTotal - 1
end repeat
click UI element appName of window 1
delay 1 # give it a few moment to launch
end tell
end run
|
programs/oeis/032/A032828.asm | neoneye/loda | 0 | 105558 | <reponame>neoneye/loda<filename>programs/oeis/032/A032828.asm
; A032828: Numbers whose set of base 16 digits is {1,4}.
; 1,4,17,20,65,68,273,276,321,324,1041,1044,1089,1092,4369,4372,4417,4420,5137,5140,5185,5188,16657,16660,16705,16708,17425,17428,17473,17476,69905,69908,69953,69956,70673,70676,70721,70724,82193,82196,82241,82244,82961,82964,83009,83012,266513,266516,266561,266564,267281,267284,267329,267332,278801,278804,278849,278852,279569,279572,279617,279620,1118481,1118484,1118529,1118532,1119249,1119252,1119297,1119300,1130769,1130772,1130817,1130820,1131537,1131540,1131585,1131588,1315089,1315092,1315137,1315140,1315857,1315860,1315905,1315908,1327377,1327380,1327425,1327428,1328145,1328148,1328193,1328196,4264209,4264212,4264257,4264260,4264977,4264980
seq $0,32925 ; Numbers whose set of base 4 digits is {1,2}.
seq $0,1196 ; Double-bitters: only even length runs in binary expansion.
div $0,3
|
oeis/052/A052576.asm | neoneye/loda-programs | 11 | 174368 | ; A052576: E.g.f. (1+x^2-2x^3)/(1-2x).
; Submitted by <NAME>
; 1,2,10,48,384,3840,46080,645120,10321920,185794560,3715891200,81749606400,1961990553600,51011754393600,1428329123020800,42849873690624000,1371195958099968000,46620662575398912000
mul $0,2
add $0,1
mov $2,$0
lpb $0
sub $2,$0
mov $3,$2
dif $3,$0
sub $0,1
cmp $3,$2
mul $2,$0
cmp $3,0
mul $3,$0
sub $0,1
lpe
sub $2,2
sub $3,$2
mov $0,$3
|
src/Human/IO.agda | MaisaMilena/JuiceMaker | 6 | 3027 | module Human.IO where
postulate IO : ∀ {a} → Set a → Set a
{-# BUILTIN IO IO #-}
|
source/runtime/pb_support-stdio_streams.adb | mgrojo/protobuf | 12 | 27138 | -- MIT License
--
-- Copyright (c) 2020 <NAME>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
package body PB_Support.Stdio_Streams is
-----------
-- Flush --
-----------
procedure Flush (Self : in out Stdio_Stream'Class) is
Ignore : Interfaces.C_Streams.int;
begin
Ignore := Interfaces.C_Streams.fflush (Self.stdout);
end Flush;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : in out Stdio_Stream'Class;
stdin : Interfaces.C_Streams.FILEs := Interfaces.C_Streams.stdin;
stdout : Interfaces.C_Streams.FILEs := Interfaces.C_Streams.stdout) is
begin
Self.stdin := stdin;
Self.stdout := stdout;
end Initialize;
----------
-- Read --
----------
overriding procedure Read
(Self : in out Stdio_Stream;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset)
is
use type Ada.Streams.Stream_Element_Count;
Size : constant Interfaces.C_Streams.size_t :=
Interfaces.C_Streams.fread
(buffer => Item'Address,
size => 1,
count => Item'Length,
stream => Self.stdin);
begin
Last := Item'First + Ada.Streams.Stream_Element_Count (Size) - 1;
end Read;
-----------
-- Write --
-----------
overriding procedure Write
(Self : in out Stdio_Stream;
Item : Ada.Streams.Stream_Element_Array)
is
use type Interfaces.C_Streams.size_t;
Size : constant Interfaces.C_Streams.size_t :=
Interfaces.C_Streams.fwrite
(buffer => Item'Address,
size => 1,
count => Item'Length,
stream => Self.stdout);
begin
pragma Assert (Size = Item'Length);
end Write;
end PB_Support.Stdio_Streams;
|
tests/lr35902/op_ED.asm | fengjixuchui/sjasmplus | 220 | 163844 | ; almost all of these should fail on LR35902
; (some will emit damaged machine code of legit LR35902 instruction, like LD A,R)
; `RETI` has valid opcode 0xD9 on LR35902, `LD (nn),sp` has valid opcode 0x08
in b,(c) ; #ED40
out (c),b ; #ED41
sbc hl,bc ; #ED42
ld (#100),bc ; #ED430001
neg ; #ED44
retn ; #ED45
im 0 ; #ED46
ld i,a ; #ED47
in c,(c) ; #ED48
out (c),c ; #ED49
adc hl,bc ; #ED4A
ld bc,(#100) ; #ED4B0001
reti ; #ED4D on Z80, #D9 on LR35902
ld r,a ; #ED4F
in d,(c) ; #ED50
out (c),d ; #ED51
sbc hl,de ; #ED52
ld (#100),de ; #ED530001
im 1 ; #ED56
ld a,i ; #ED57
in e,(c) ; #ED58
out (c),e ; #ED59
adc hl,de ; #ED5A
ld de,(#100) ; #ED5B0001
ld a,r ; #ED5F
in h,(c) ; #ED60
out (c),h ; #ED61
sbc hl,hl ; #ED62
rrd ; #ED67
in l,(c) ; #ED68
out (c),l ; #ED69
adc hl,hl ; #ED6A
rld ; #ED6F
in f,(c) ; #ED70
out (c),0 ; #ED71
sbc hl,sp ; #ED72
ld (#100),sp ; #ED730001 on Z80, #080001 on LR35902
in a,(c) ; #ED78
out (c),a ; #ED79
adc hl,sp ; #ED7A
ld sp,(#100) ; #ED7B0001
ldi ; #EDA0
cpi ; #EDA1
ini ; #EDA2
outi ; #EDA3
ldd ; #EDA8
cpd ; #EDA9
ind ; #EDAA
outd ; #EDAB
ldir ; #EDB0
cpir ; #EDB1
inir ; #EDB2
otir ; #EDB3
lddr ; #EDB8
cpdr ; #EDB9
indr ; #EDBA
otdr ; #EDBB
|
oeis/292/A292897.asm | neoneye/loda-programs | 11 | 24801 | <reponame>neoneye/loda-programs
; A292897: a(n) = -Sum_{k=1..3}(-1)^(n-k)*hypergeom([k, k-n-3], [], 1).
; Submitted by <NAME>
; 3,7,27,129,755,5187,40923,364333,3611811,39448095,470573723,6086754297,84847445907,1267953887899,20220829211355,342759892460517,6153802869270083,116652857267320503,2328215691932062491,48800672765792988145,1071780020853500289843
mov $2,1
mov $4,1
lpb $0
mul $2,$0
mov $3,2
mul $3,$0
sub $0,1
add $4,1
add $2,$4
add $2,$3
add $3,$4
mov $4,$2
add $2,$3
lpe
mov $0,$4
add $0,2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.