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 |
|---|---|---|---|---|
lab2/example_d_1.asm | 0000Blaze/Microprocess | 0 | 23240 | # ORG 8000
MVI B,00
MVI C,45
MOV A,B
INR A
MOV B,A
MOV A,C
DCR A
MOV C,A
HLT
|
oeis/064/A064733.asm | neoneye/loda-programs | 11 | 20360 | <gh_stars>10-100
; A064733: Final digits of A005165(2n) for large n, read from right.
; Submitted by <NAME>
; 9,1,0,7,7,5,5,3,6,1,6,1,2,6,3,9,3,5,6,4,4,1,2,8,8,5,7,6,3,2,6,8,6,5,5,0,1,6,0,4,8,5,9,1,6,9,4,6,3,4,0,7,3,8,1,7,6,8,1,3,1,6,8,8,1,1,9,8,9,2,8,8,8,6,0,2,9,5,3,9,9,6,6,3,2,9,9,3,6,3,4,2,4,7,9,0,7,7,4,5
mov $3,$0
add $3,4
mul $3,4
lpb $3
mul $2,$3
sub $2,$1
add $1,$2
mov $2,1
sub $2,$1
sub $3,1
lpe
mov $4,10
pow $4,$0
div $2,$4
mov $0,$2
sub $0,1
mod $0,10
add $0,10
mod $0,10
|
oeis/140/A140787.asm | neoneye/loda-programs | 11 | 164292 | ; A140787: Expansion of 1 / ( (1+x)*(2*x+1)*(-1+2*x)^2 ).
; Submitted by <NAME>
; 1,1,7,9,39,57,199,313,967,1593,4551,7737,20935,36409,94663,167481,422343,757305,1864135,3378745,8155591,14913081,35418567,65244729,152859079,283348537,656175559,1222872633,2803659207,5249404473,11930464711,22429273657,50585170375,95443717689,213793927623,404681363001,900988694983,1710351420985,3787206717895,7207909559865,15881834623431,30297653743161,66459369501127,127054676987449,277565602034119,531674956009017,1157174904254919,2220524816272953,4816349601493447,9257399234039353
mov $2,1
lpb $0
sub $0,2
mul $1,4
mul $2,2
add $1,$2
mul $2,2
add $2,1
lpe
lpb $0
div $0,4
add $2,$1
lpe
add $2,$1
mov $0,$2
|
theorems/stash/CubicalTypes.agda | timjb/HoTT-Agda | 294 | 856 | <gh_stars>100-1000
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
module experimental.CubicalTypes where
data access : ℕ → ℕ → Type₀ where
[] : access O O
_#up : ∀ {n} {k} → access n k → access (S n) k
_#down : ∀ {n} {k} → access n k → access (S n) k
_#keep : ∀ {n} {k} → access n k → access (S n) (S k)
_a∙_ : ∀ {n k l} → access n k → access k l → access n l
_a∙_ [] a₂ = a₂
_a∙_ (a₁ #up) a₂ = (a₁ a∙ a₂) #up
_a∙_ (a₁ #down) a₂ = (a₁ a∙ a₂) #down
_a∙_ (a₁ #keep) (a₂ #up) = (a₁ a∙ a₂) #up
_a∙_ (a₁ #keep) (a₂ #down) = (a₁ a∙ a₂) #down
_a∙_ (a₁ #keep) (a₂ #keep) = (a₁ a∙ a₂) #keep
|
test/Succeed/Issue1194l.agda | shlevy/agda | 1,989 | 3764 | module _ where
module A where
postulate C : Set → Set → Set
syntax C X Y = X , Y
module B where
postulate C : Set
open A
open B
Foo : Set → Set
Foo X = X , X
|
src/file_operations-heap.adb | kraileth/ravenadm | 18 | 10187 | -- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
with Ada.Text_IO.Text_Streams;
package body File_Operations.Heap is
package TIO renames Ada.Text_IO;
package STR renames Ada.Text_IO.Text_Streams;
procedure slurp_file (dossier : String) is
begin
file_contents := new HM_File_String;
if File_Size = 0 then
return;
end if;
declare
handle : TIO.File_Type;
attempts : Natural := 0;
begin
-- The introduction of variants causes a buildsheet to be scanned once per variant.
-- It's possible (even common) for simultaneous requests to scan the same buildsheet to
-- occur. Thus, if the file is already open, wait and try again (up to 5 times)
loop
begin
TIO.Open (handle, TIO.In_File, dossier);
exit;
exception
when TIO.Use_Error | TIO.Status_Error =>
if attempts = 5 then
raise file_handling with "slurp_file: failed open: " & dossier;
end if;
attempts := attempts + 1;
delay 0.1;
end;
end loop;
for arrow in file_contents'Range loop
file_contents (arrow) := Character'Input (STR.Stream (handle));
end loop;
TIO.Close (handle);
exception
when others =>
if TIO.Is_Open (handle) then
TIO.Close (handle);
end if;
raise file_handling with "slurp_file(" & dossier & ") failed";
end;
exception
when Storage_Error =>
raise file_handling with "slurp_file: failed to allocate memory on heap";
end slurp_file;
end File_Operations.Heap;
|
Cubical/Structures/Group.agda | RobertHarper/cubical | 0 | 9242 | <reponame>RobertHarper/cubical
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Structures.Group where
open import Cubical.Structures.Group.Base public
open import Cubical.Structures.Group.Properties public
open import Cubical.Structures.Group.Morphism public
open import Cubical.Structures.Group.MorphismProperties public
|
oeis/252/A252482.asm | neoneye/loda-programs | 11 | 244077 | ; A252482: Exponents n such that the decimal expansion of the power 12^n contains no zeros.
; Submitted by <NAME>
; 0,1,2,3,5,6,8,10,14,20,26
add $0,2
mov $2,20
mov $3,1
lpb $0
add $3,$0
mul $0,$3
div $0,$2
trn $0,1
lpe
mov $0,$3
sub $0,3
|
library/02_functions_batch1/unknown_1000a290.asm | SamantazFox/dds140-reverse-engineering | 1 | 12078 | 1000a290: 55 push ebp
1000a291: 8b ec mov ebp,esp
1000a293: 83 ec 18 sub esp,0x18
1000a296: 53 push ebx
1000a297: ff 75 10 push DWORD PTR [ebp+0x10]
1000a29a: 8d 4d e8 lea ecx,[ebp-0x18]
1000a29d: e8 78 9b ff ff call 0x10003e1a
1000a2a2: 8b 5d 08 mov ebx,DWORD PTR [ebp+0x8]
1000a2a5: 8d 43 01 lea eax,[ebx+0x1]
1000a2a8: 3d 00 01 00 00 cmp eax,0x100
1000a2ad: 77 0f ja 0x1000a2be
1000a2af: 8b 45 e8 mov eax,DWORD PTR [ebp-0x18]
1000a2b2: 8b 80 c8 00 00 00 mov eax,DWORD PTR [eax+0xc8]
1000a2b8: 0f b7 04 58 movzx eax,WORD PTR [eax+ebx*2]
1000a2bc: eb 75 jmp 0x1000a333
1000a2be: 89 5d 08 mov DWORD PTR [ebp+0x8],ebx
1000a2c1: c1 7d 08 08 sar DWORD PTR [ebp+0x8],0x8
1000a2c5: 8d 45 e8 lea eax,[ebp-0x18]
1000a2c8: 50 push eax
1000a2c9: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
1000a2cc: 25 ff 00 00 00 and eax,0xff
1000a2d1: 50 push eax
1000a2d2: e8 6f 00 00 00 call 0x1000a346
1000a2d7: 85 c0 test eax,eax
1000a2d9: 59 pop ecx
1000a2da: 59 pop ecx
1000a2db: 74 12 je 0x1000a2ef
1000a2dd: 8a 45 08 mov al,BYTE PTR [ebp+0x8]
1000a2e0: 6a 02 push 0x2
1000a2e2: 88 45 f8 mov BYTE PTR [ebp-0x8],al
1000a2e5: 88 5d f9 mov BYTE PTR [ebp-0x7],bl
1000a2e8: c6 45 fa 00 mov BYTE PTR [ebp-0x6],0x0
1000a2ec: 59 pop ecx
1000a2ed: eb 0a jmp 0x1000a2f9
1000a2ef: 33 c9 xor ecx,ecx
1000a2f1: 88 5d f8 mov BYTE PTR [ebp-0x8],bl
1000a2f4: c6 45 f9 00 mov BYTE PTR [ebp-0x7],0x0
1000a2f8: 41 inc ecx
1000a2f9: 8b 45 e8 mov eax,DWORD PTR [ebp-0x18]
1000a2fc: 6a 01 push 0x1
1000a2fe: ff 70 14 push DWORD PTR [eax+0x14]
1000a301: ff 70 04 push DWORD PTR [eax+0x4]
1000a304: 8d 45 fc lea eax,[ebp-0x4]
1000a307: 50 push eax
1000a308: 51 push ecx
1000a309: 8d 45 f8 lea eax,[ebp-0x8]
1000a30c: 50 push eax
1000a30d: 8d 45 e8 lea eax,[ebp-0x18]
1000a310: 6a 01 push 0x1
1000a312: 50 push eax
1000a313: e8 45 fc ff ff call 0x10009f5d
1000a318: 83 c4 20 add esp,0x20
1000a31b: 85 c0 test eax,eax
1000a31d: 75 10 jne 0x1000a32f
1000a31f: 38 45 f4 cmp BYTE PTR [ebp-0xc],al
1000a322: 74 07 je 0x1000a32b
1000a324: 8b 45 f0 mov eax,DWORD PTR [ebp-0x10]
1000a327: 83 60 70 fd and DWORD PTR [eax+0x70],0xfffffffd
1000a32b: 33 c0 xor eax,eax
1000a32d: eb 14 jmp 0x1000a343
1000a32f: 0f b7 45 fc movzx eax,WORD PTR [ebp-0x4]
1000a333: 23 45 0c and eax,DWORD PTR [ebp+0xc]
1000a336: 80 7d f4 00 cmp BYTE PTR [ebp-0xc],0x0
1000a33a: 74 07 je 0x1000a343
1000a33c: 8b 4d f0 mov ecx,DWORD PTR [ebp-0x10]
1000a33f: 83 61 70 fd and DWORD PTR [ecx+0x70],0xfffffffd
1000a343: 5b pop ebx
1000a344: c9 leave
1000a345: c3 ret
|
lab4/branch_3_equal/branch3equal.asm | samdsk/lab_arch2 | 0 | 21289 | <gh_stars>0
#Input: tre valori interi, due indirizzi del segmento testo
#Output: nessuno
#$a0, $a1, $a2 <- 3 interi
#$s3 primo addr stack secondo addr
.data
.text
.globl branch3equal
branch3equal:
add $t0 $0 $0
add $v0 $0 $0
bne $a0 $a1 second
addi $t0 $t0 1
second: bne $a0 $a2 third
addi $t0 $t0 1
third: bne $a1 $a2 exit_2
addi $t0 $t0 1
bne $t0 3 end
move $v0 $a3
j end
exit_2: addi $sp $sp 4
lw $v0 0($sp)
end: jr $ra
|
Cubical/Algebra/AbGroup.agda | thomas-lamiaux/cubical | 1 | 14531 | {-# OPTIONS --safe #-}
module Cubical.Algebra.AbGroup where
open import Cubical.Algebra.AbGroup.Base public
open import Cubical.Algebra.AbGroup.Properties public
|
palacios/src/palacios/vmm_symbol.asm | tsinghua-os-spring-2013/palacios | 1 | 162141 | ; -*- fundamental -*-
;;
;; Symbol mangling macros
;; Copyright (c) 2001, <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.
;;
; This file defines macros for dealing with externally-visible
; symbols that must be mangled for some object file formats.
; For example, PECOFF requires a leading underscore, while
; ELF does not.
; EXPORT defines a symbol as global
; IMPORT references a symbol defined in another module
; Thanks to <NAME> for providing the NASM macros
; (thus saving me hours of frustration).
%ifndef __VMM_SYMBOL_ASM
%define __VMM_SYMBOL_ASM
%ifdef NEED_UNDERSCORE
%macro EXPORT 1
[GLOBAL _%1]
%define %1 _%1
%endmacro
%macro IMPORT 1
[EXTERN _%1]
%define %1 _%1
%endmacro
%else
%macro EXPORT 1
[GLOBAL %1]
%endmacro
%macro IMPORT 1
[EXTERN %1]
%endmacro
%endif
%endif
|
Task/Memory-allocation/Ada/memory-allocation-3.ada | LaudateCorpus1/RosettaCodeData | 1 | 26893 | declare
type Integer_Ptr is access Integer;
procedure Free is new Ada.Unchecked_Deallocation (Integer, Integer_Ptr)
Ptr : Integer_Ptr := new Integer; -- Allocated in the heap
begin
Free (Ptr); -- Explicit deallocation
...
end;
|
fe/fe-core/src/main/java/com/starrocks/sql/parser/StarRocksLex.g4 | happut/starrocks | 0 | 103 | <reponame>happut/starrocks<gh_stars>0
// This file is licensed under the Elastic License 2.0. Copyright 2021-present, StarRocks Limited.
lexer grammar StarRocksLex;
@parser::members {public static long sqlMode;}
tokens {
CONCAT
}
ADD: 'ADD';
ADMIN: 'ADMIN';
ALL: 'ALL';
ALTER: 'ALTER';
AND: 'AND';
ANTI: 'ANTI';
ARRAY: 'ARRAY';
AS: 'AS';
ASC: 'ASC';
AVG: 'AVG';
BACKEND: 'BACKEND';
BETWEEN: 'BETWEEN';
BIGINT: 'BIGINT';
BITMAP: 'BITMAP';
BOOLEAN: 'BOOLEAN';
BUCKETS: 'BUCKETS';
BY: 'BY';
CASE: 'CASE';
CAST: 'CAST';
CHAR: 'CHAR';
CONFIG: 'CONFIG';
COLLATE: 'COLLATE';
CONNECTION_ID: 'CONNECTION_ID';
COLUMN: 'COLUMN';
COMMENT: 'COMMENT';
COMMIT: 'COMMIT';
COSTS: 'COSTS';
COUNT: 'COUNT';
CREATE: 'CREATE';
CROSS: 'CROSS';
CUBE: 'CUBE';
CURRENT: 'CURRENT';
CURRENT_USER: 'CURRENT_USER';
DATA: 'DATA';
DATABASE: 'DATABASE';
DATABASES: 'DATABASES';
DATE: 'DATE';
DATETIME: 'DATETIME';
DAY: 'DAY';
DECIMAL: 'DECIMAL';
DECIMALV2: 'DECIMALV2';
DECIMAL32: 'DECIMAL32';
DECIMAL64: 'DECIMAL64';
DECIMAL128: 'DECIMAL128';
DEFAULT: 'DEFAULT';
DELETE: 'DELETE';
DENSE_RANK: 'DENSE_RANK';
DESC: 'DESC';
DESCRIBE: 'DESCRIBE';
DISTINCT: 'DISTINCT';
DISTRIBUTED: 'DISTRIBUTED';
DOUBLE: 'DOUBLE';
DROP: 'DROP';
DUAL: 'DUAL';
ELSE: 'ELSE';
END: 'END';
EXCEPT: 'EXCEPT';
EXISTS: 'EXISTS';
EXPLAIN: 'EXPLAIN';
EXTRACT: 'EXTRACT';
EVERY: 'EVERY';
FALSE: 'FALSE';
FILTER: 'FILTER';
FIRST: 'FIRST';
FIRST_VALUE: 'FIRST_VALUE';
FLOAT: 'FLOAT';
FN: 'FN';
FOLLOWING: 'FOLLOWING';
FOLLOWER: 'FOLLOWER';
FOR: 'FOR';
FORMAT: 'FORMAT';
FREE: 'FREE';
FROM: 'FROM';
FRONTEND: 'FRONTEND';
FULL: 'FULL';
GLOBAL: 'GLOBAL';
GRANT: 'GRANT';
GROUP: 'GROUP';
GROUPING: 'GROUPING';
GROUPING_ID: 'GROUPING_ID';
HASH: 'HASH';
HAVING: 'HAVING';
HLL: 'HLL';
HOUR: 'HOUR';
IF: 'IF';
IN: 'IN';
INDEX: 'INDEX';
INNER: 'INNER';
INSERT: 'INSERT';
INT: 'INT';
INTEGER: 'INTEGER';
INTERSECT: 'INTERSECT';
INTERVAL: 'INTERVAL';
INTO: 'INTO';
IS: 'IS';
JOIN: 'JOIN';
JSON: 'JSON';
LABEL: 'LABEL';
LAG: 'LAG';
LARGEINT: 'LARGEINT';
LAST: 'LAST';
LAST_VALUE: 'LAST_VALUE';
LATERAL: 'LATERAL';
LEAD: 'LEAD';
LEFT: 'LEFT';
LESS: 'LESS';
LIKE: 'LIKE';
LIMIT: 'LIMIT';
LOCAL: 'LOCAL';
LOGICAL: 'LOGICAL';
MATERIALIZED: 'MATERIALIZED';
MAX: 'MAX';
MAXVALUE: 'MAXVALUE';
MERGE: 'MERGE';
MIN: 'MIN';
MINUTE: 'MINUTE';
MINUS: 'MINUS';
MOD: 'MOD';
MONTH: 'MONTH';
NONE: 'NONE';
NOT: 'NOT';
NULL: 'NULL';
NULLS: 'NULLS';
OBSERVER: 'OBSERVER';
OFFSET: 'OFFSET';
ON: 'ON';
OR: 'OR';
ORDER: 'ORDER';
OUTER: 'OUTER';
OUTFILE: 'OUTFILE';
OVER: 'OVER';
PARTITION: 'PARTITION';
PARTITIONS: 'PARTITIONS';
PASSWORD: 'PASSWORD';
PRECEDING: 'PRECEDING';
PERCENTILE: 'PERCENTILE';
PRIMARY: 'PRIMARY';
PROPERTIES: 'PROPERTIES';
QUARTER: 'QUARTER';
RANGE: 'RANGE';
RANK: 'RANK';
REGEXP: 'REGEXP';
REVOKE: 'REVOKE';
REPLICA: 'REPLICA';
RENAME: 'RENAME';
RIGHT: 'RIGHT';
RLIKE: 'RLIKE';
ROLLBACK: 'ROLLBACK';
ROLLUP: 'ROLLUP';
ROW: 'ROW';
ROWS: 'ROWS';
ROW_NUMBER: 'ROW_NUMBER';
SCHEMA: 'SCHEMA';
SECOND: 'SECOND';
SELECT: 'SELECT';
SEMI: 'SEMI';
SESSION: 'SESSION';
SET: 'SET';
SETS: 'SETS';
SET_VAR: 'SET_VAR';
SHOW: 'SHOW';
SMALLINT: 'SMALLINT';
START: 'START';
STATUS: 'STATUS';
STRING: 'STRING';
SUM: 'SUM';
SYSTEM: 'SYSTEM';
TABLE: 'TABLE';
TABLES: 'TABLES';
TABLET: 'TABLET';
TEMPORARY: 'TEMPORARY';
THAN: 'THAN';
THEN: 'THEN';
TIME: 'TIME';
TIMESTAMPADD: 'TIMESTAMPADD';
TIMESTAMPDIFF: 'TIMESTAMPDIFF';
TINYINT: 'TINYINT';
TO: 'TO';
TRUE: 'TRUE';
TYPE: 'TYPE';
UNBOUNDED: 'UNBOUNDED';
UNION: 'UNION';
UPDATE: 'UPDATE';
USE: 'USE';
USER: 'USER';
USING: 'USING';
VALUES: 'VALUES';
VARCHAR: 'VARCHAR';
VERBOSE: 'VERBOSE';
VIEW: 'VIEW';
WEEK: 'WEEK';
WHEN: 'WHEN';
WHERE: 'WHERE';
WITH: 'WITH';
YEAR: 'YEAR';
FORCE: 'FORCE';
EQ : '=';
NEQ : '<>' | '!=';
LT : '<';
LTE : '<=';
GT : '>';
GTE : '>=';
EQ_FOR_NULL: '<=>';
PLUS_SYMBOL: '+';
MINUS_SYMBOL: '-';
ASTERISK_SYMBOL: '*';
SLASH_SYMBOL: '/';
PERCENT_SYMBOL: '%';
LOGICAL_OR: '||' {setType((StarRocksParser.sqlMode & com.starrocks.qe.SqlModeHelper.MODE_PIPES_AS_CONCAT) == 0 ? LOGICAL_OR : StarRocksParser.CONCAT);};
LOGICAL_AND: '&&';
LOGICAL_NOT: '!';
INT_DIV: 'DIV';
BITAND: '&';
BITOR: '|';
BITXOR: '^';
BITNOT: '~';
ARROW: '->';
AT: '@';
INTEGER_VALUE
: DIGIT+
;
DECIMAL_VALUE
: DIGIT+ '.' DIGIT*
| '.' DIGIT+
;
DOUBLE_VALUE
: DIGIT+ ('.' DIGIT*)? EXPONENT
| '.' DIGIT+ EXPONENT
;
SINGLE_QUOTED_TEXT
: '\'' ( ~'\'' | '\'\'' )* '\''
;
DOUBLE_QUOTED_TEXT
: '"' ( '\\'. | '""' | ~('"'| '\\') )* '"'
;
IDENTIFIER
: (LETTER | '_') (LETTER | DIGIT | '_')*
;
DIGIT_IDENTIFIER
: DIGIT (LETTER | DIGIT | '_')+
;
QUOTED_IDENTIFIER
: '"' ( ~'"' | '""' )* '"'
;
BACKQUOTED_IDENTIFIER
: '`' ( ~'`' | '``' )* '`'
;
fragment EXPONENT
: 'E' [+-]? DIGIT+
;
fragment DIGIT
: [0-9]
;
fragment LETTER
: [a-zA-Z_$\u0080-\uffff]
;
SIMPLE_COMMENT
: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN)
;
BRACKETED_COMMENT
: '/*' ~'+' .*? '*/' -> channel(HIDDEN)
;
SEMICOLON: ';';
WS
: [ \r\n\t]+ -> channel(HIDDEN)
;
|
Common/array.asm | Martin-H1/6502 | 3 | 170404 | <reponame>Martin-H1/6502
; -----------------------------------------------------------------------------
; Array abstract data type.
; Note: Array's are not cells, they are not managed by the garbage collector.
; But they can be wrapped by a vector cell which acts as a smart pointer.
; <NAME> <<EMAIL>>
; -----------------------------------------------------------------------------
; establish module level scope to hide module locals.
.scope
;
; Aliases
;
.alias _GROWTH $10 ; array expansion factor.
.alias _HEADER_SIZE CELL ; header contains a current size cell.
;
; Data segments
;
.data ZPDATA
.space _TMPPTR 2 ; pointer used for indirection.
.space _JMPPTR 2 ; pointer used for indirect jump.
.data BSS
.space _CAPACITY 2 ; temporaries to hold value for reuse.
.space _COUNT 2
.space _VALUE 2
.text
;
; Macros
;
.macro _idxToBytes
`pushi 1
jsr lshift16 ; convert index to bytes.
`pushi _HEADER_SIZE
jsr add16 ; add header to offset
.macend
;
; Functions
;
; Allocates memory for an array and initiaizes the count to zero.
; input - number of cells required on stack.
; output - array pointer
arrayAlloc:
`_idxToBytes ; convert to byte count.
jsr halloc
`pushzero
`over
`store
rts
; Appends a value at the end of the array. It may reallocate, so the
; pointer is returned and consumers should save the value just in case.
; input - array pointer (nos) and value (tos)
; output - array pointer which may be reallocated.
arrayAppend:
.scope
`pop _VALUE
`dup
jsr arrayCapacity
`peek _CAPACITY
`over
jsr arrayCount
`peek _COUNT
`if_less16
`push _CAPACITY
`_idxToBytes
`pushi _GROWTH
jsr add16
jsr hrealloc
_else:
`push _COUNT ; ptr, count
`_idxToBytes
`over ; ptr, offset, ptr
jsr add16 ; ptr, end_ptr
`push _VALUE
`swap ; ptr, value, end_ptr
`store
`incw _COUNT ; increment the array count
`push _COUNT
`over
`store
rts
.scend
; Returns the capacity of the array.
; input - array address (tos).
; output - the max number of cells.
arrayCapacity:
jsr hsize ; get allocation size.
`pushi _HEADER_SIZE
jsr sub16
`pushi 1
jsr rshift16
rts
; Returns the number of array elements.
; input - array address (tos).
; output - the number of filled cells.
arrayCount:
`fetch ; count is in header cell.
rts
; Deletes an array item at the specified index and decreases the count
; input - array pointer (nos) and index to delete.
; output - items are droped from the stack
arrayDeleteAt:
.scope
`peek _VALUE ; save the index
`_idxToBytes ; convert to byte offset
`over ; add it to base pointer.
jsr add16
`peek _TMPPTR
`inctos
`inctos
`pop _JMPPTR ; we now have a from and to pointer
`dup
jsr arrayCount ; compute number of cells to copy
`dectos
`peek _COUNT
`push _VALUE
jsr sub16
`pushi 1
jsr lshift16 ; convert to byte count
phy
ldy #0
_loop: `toszero?
beq _endLoop
lda (_JMPPTR),y ; copy the bytes
sta (_TMPPTR),y
iny
bne +
inc _TMPPTR+1
inc _JMPPTR+1
* `decTos
bra _loop
_endloop:
ply
`drop
`push _COUNT
`swap
`store
rts
.scend
; Returns the index of the first instance of a value
; input - array address (nos) and value (tos).
; output - the index containing the value, or -1
arrayFindFirst:
.scope
`pop _VALUE ; save all input arguments,
`dup
jsr arrayCount
`pop _COUNT ; and loop limit.
`pushi _HEADER_SIZE ; advance pointer past the header.
jsr add16
`pop _TMPPTR
`pushzero
_for: `dup
`push _COUNT
`if_less16
.scope
`pushInd _TMPPTR ; retrieve the item value.
`incw _TMPPTR
`push _VALUE
`if_equals16
rts ; return index on stack.
_else:
`inctos
bra _for
.scend
_else: ; end of for loop
`drop
`pushi $ffff
rts
.scend
; Returns the index of the last instance of a value
; input - array address (nos) and value (tos).
; output - the index containing the value, or -1.
arrayFindLast:
.scope
`pop _VALUE ; save all input arguments,
`dup
jsr arrayCount
`dectos ; decrement count to get an index.
`peek _COUNT ; and loop limit.
`_idxToBytes ; Create a pointer to last element.
jsr add16
`pop _TMPPTR
`push _COUNT
`push _TMPPTR
`drop
_for: `dup
`pushTrue ; true is -1
`if_greater16
.scope
`pushInd _TMPPTR ; retrieve the item value.
`push _VALUE
`if_equals16
rts ; return index on stack.
_else:
`decw _TMPPTR ; move back one item.
`decw _TMPPTR
`decw _TMPPTR
`dectos ; decrement the index
bra _for
.scend
_else: ; end of for loop
`drop
`pushi $ffff
rts
.scend
; Returns the array element.
; input - array address (nos) and cell index (tos).
; output - the cell value.
arrayGetAt:
`_idxToBytes ; convert index to a byte offset.
jsr add16 ; add base address to offset
`fetch ; retrieve cell value.
rts
; Returns the array element.
; input - array address (third), cell index (nos), and cell value.
; output - elements are consumed
arraySetAt:
`mrot
`_idxToBytes
jsr add16 ; add base address to offset
`store
rts
; Iterates over an array with the specified function. It pushes the
; array cell value, and calls the function pointer.
; input - pointer to array (nos) and function pointer (tos).
; output - none
arrayForEach:
.scope
phy
ldy #0
`pop _JMPPTR
`dup
jsr arrayCount
`swap
`pushi _HEADER_SIZE
jsr add16 ; add header to offset
`pop _TMPPTR
_loop:
`toszero?
beq _endLoop
`pushIndy _TMPPTR
jsr _indirectJmp
iny
bne +
inc _TMPPTR+1
* `decTos
bra _loop
_endLoop:
`drop
ply
rts
_indirectJmp:
jmp (_JMPPTR)
.scend
; Prints the item capacity, item count, and items.
; input - array pointer
; output - none
arrayPrint:
.scope
`dup
`print _addressMsg
jsr printTosln
`drop
`dup
jsr arrayCapacity
`print _capacityMsg
jsr printTosln
`drop
`dup
jsr arrayCount
`print _countMsg
jsr printTosln
`drop
`print _cellsMsg
`pushi _printTos
jsr arrayForEach
`println _endMsg
rts
_printTos:
jsr printTos
`print _commaMsg
`drop
rts
.scend
_addressMsg: .byte "address = ",0
_capacityMsg: .byte "capacity = ",0
_countMsg: .byte "count = ",0
_cellsMsg: .byte "cells = [ ",0
_commaMsg: .byte ", ",0
_endMsg: .byte "]",0
.scend
|
task.asm | Klaus073/Assembly-language | 0 | 86967 | [org 0x01000]
mov ax,6
add ax,6
add ax,6
add ax,6
add ax,6
add ax,6
add ax,6
mov ax, 0x4c00 ; leave it for upcoming labs
int 0x21 |
Add Two Numbers Using Stack.asm | juancstlm/Assembly-Programming | 0 | 96626 | <reponame>juancstlm/Assembly-Programming<gh_stars>0
; Add Two Numbers using stack
.386
.model flat,stdcall
.stack 4096
INCLUDE Irvine32.inc
ExitProcess proto,dwExitCode:dword
.data
val1 DWORD ?
val2 DWORD ?
.code
main proc
mov val1, 3
mov val2, 4
push val2
push val1
y_param EQU [ebp+12]
x_param EQU [ebp+8]
call AddTwo
invoke ExitProcess,0
main endp
AddTwo PROC
push ebp
mov ebp, esp ; base of the stack frame
mov eax, y_param ; second parameter
add eax, x_param ; first parameter
pop ebp
ret 8 ; clean up the stack
AddTwo ENDP
end main |
ASM/src/debug.asm | deralex/Better-OoT | 289 | 90427 | <reponame>deralex/Better-OoT
.macro debug_print,reg
addi sp, sp, -0x20
sw t0, 0x04(sp)
sw t1, 0x08(sp)
sw t2, 0x0C(sp)
sw t3, 0x10(sp)
sw at, 0x14(sp)
ori t3, reg, 0
li t0, DebugOutput
lw t1, 0x00(t0)
add t2, t0, t1
sw t3, 0x04(t2)
addi t1, t1, 4
sw t1, 0x00(t0)
lw t0, 0x04(sp)
lw t1, 0x08(sp)
lw t2, 0x0C(sp)
lw t3, 0x10(sp)
lw at, 0x14(sp)
addi sp, sp, 0x20
.endmacro
.macro debug_printi,val
addi sp, sp, -0x10
sw at, 0x04(sp)
sw t4, 0x08(sp)
li t4, val
debug_print t4
lw at, 0x04(sp)
lw t4, 0x08(sp)
addi sp, sp, 0x10
.endmacro
|
avx2/zuc_avx2.asm | kevintraynor/intel-ipsec-mb | 0 | 244616 | <filename>avx2/zuc_avx2.asm
;;
;; Copyright (c) 2020, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
%include "include/os.asm"
%include "include/reg_sizes.asm"
%include "include/zuc_sbox.inc"
section .data
default rel
align 32
EK_d:
dw 0x44D7, 0x26BC, 0x626B, 0x135E, 0x5789, 0x35E2, 0x7135, 0x09AF,
dw 0x4D78, 0x2F13, 0x6BC4, 0x1AF1, 0x5E26, 0x3C4D, 0x789A, 0x47AC
align 32
mask31:
dd 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF,
dd 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF,
align 32
swap_mask:
db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04
db 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c
db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04
db 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c
align 32
S1_S0_shuf:
db 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F
db 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F
align 32
S0_S1_shuf:
db 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
db 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
align 32
rev_S1_S0_shuf:
db 0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B, 0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F
db 0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B, 0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F
align 32
rev_S0_S1_shuf:
db 0x08, 0x00, 0x09, 0x01, 0x0A, 0x02, 0x0B, 0x03, 0x0C, 0x04, 0x0D, 0x05, 0x0E, 0x06, 0x0F, 0x07
db 0x08, 0x00, 0x09, 0x01, 0x0A, 0x02, 0x0B, 0x03, 0x0C, 0x04, 0x0D, 0x05, 0x0E, 0x06, 0x0F, 0x07
section .text
align 64
%define MASK31 ymm12
%define OFS_R1 (16*(4*8))
%define OFS_R2 (OFS_R1 + (4*8))
%define OFS_X0 (OFS_R2 + (4*8))
%define OFS_X1 (OFS_X0 + (4*8))
%define OFS_X2 (OFS_X1 + (4*8))
%define OFS_X3 (OFS_X2 + (4*8))
%ifidn __OUTPUT_FORMAT__, win64
%define XMM_STORAGE 16*10
%define GP_STORAGE 8*8
%else
%define XMM_STORAGE 0
%define GP_STORAGE 6*8
%endif
%define VARIABLE_OFFSET XMM_STORAGE + GP_STORAGE
%define GP_OFFSET XMM_STORAGE
%macro FUNC_SAVE 0
mov r11, rsp
sub rsp, VARIABLE_OFFSET
and rsp, ~15
%ifidn __OUTPUT_FORMAT__, win64
; xmm6:xmm15 need to be maintained for Windows
vmovdqa [rsp + 0*16], xmm6
vmovdqa [rsp + 1*16], xmm7
vmovdqa [rsp + 2*16], xmm8
vmovdqa [rsp + 3*16], xmm9
vmovdqa [rsp + 4*16], xmm10
vmovdqa [rsp + 5*16], xmm11
vmovdqa [rsp + 6*16], xmm12
vmovdqa [rsp + 7*16], xmm13
vmovdqa [rsp + 8*16], xmm14
vmovdqa [rsp + 9*16], xmm15
mov [rsp + GP_OFFSET + 48], rdi
mov [rsp + GP_OFFSET + 56], rsi
%endif
mov [rsp + GP_OFFSET], r12
mov [rsp + GP_OFFSET + 8], r13
mov [rsp + GP_OFFSET + 16], r14
mov [rsp + GP_OFFSET + 24], r15
mov [rsp + GP_OFFSET + 32], rbx
mov [rsp + GP_OFFSET + 40], r11 ;; rsp pointer
%endmacro
%macro FUNC_RESTORE 0
%ifidn __OUTPUT_FORMAT__, win64
vmovdqa xmm6, [rsp + 0*16]
vmovdqa xmm7, [rsp + 1*16]
vmovdqa xmm8, [rsp + 2*16]
vmovdqa xmm9, [rsp + 3*16]
vmovdqa xmm10, [rsp + 4*16]
vmovdqa xmm11, [rsp + 5*16]
vmovdqa xmm12, [rsp + 6*16]
vmovdqa xmm13, [rsp + 7*16]
vmovdqa xmm14, [rsp + 8*16]
vmovdqa xmm15, [rsp + 9*16]
mov rdi, [rsp + GP_OFFSET + 48]
mov rsi, [rsp + GP_OFFSET + 56]
%endif
mov r12, [rsp + GP_OFFSET]
mov r13, [rsp + GP_OFFSET + 8]
mov r14, [rsp + GP_OFFSET + 16]
mov r15, [rsp + GP_OFFSET + 24]
mov rbx, [rsp + GP_OFFSET + 32]
mov rsp, [rsp + GP_OFFSET + 40]
%endmacro
;;
;; make_u31()
;;
%macro make_u31 4
%define %%Rt %1
%define %%Ke %2
%define %%Ek %3
%define %%Iv %4
xor %%Rt, %%Rt
shrd %%Rt, %%Iv, 8
shrd %%Rt, %%Ek, 15
shrd %%Rt, %%Ke, 9
%endmacro
;
; bits_reorg8()
;
; params
; %1 - round number
; rax - LFSR pointer
; uses
;
; return
;
%macro bits_reorg8 1
;
; ymm15 = LFSR_S15
; ymm14 = LFSR_S14
; ymm11 = LFSR_S11
; ymm9 = LFSR_S9
; ymm7 = LFSR_S7
; ymm5 = LFSR_S5
; ymm2 = LFSR_S2
; ymm0 = LFSR_S0
;
vmovdqa ymm15, [rax + ((15 + %1) % 16)*32]
vmovdqa ymm14, [rax + ((14 + %1) % 16)*32]
vmovdqa ymm11, [rax + ((11 + %1) % 16)*32]
vmovdqa ymm9, [rax + (( 9 + %1) % 16)*32]
vmovdqa ymm7, [rax + (( 7 + %1) % 16)*32]
vmovdqa ymm5, [rax + (( 5 + %1) % 16)*32]
vmovdqa ymm2, [rax + (( 2 + %1) % 16)*32]
vmovdqa ymm0, [rax + (( 0 + %1) % 16)*32]
vpxor ymm1, ymm1
vpslld ymm15, 1
vpblendw ymm3, ymm14, ymm1, 0xAA
vpblendw ymm15, ymm3, ymm15, 0xAA
vmovdqa [rax + OFS_X0], ymm15 ; BRC_X0
vpslld ymm11, 16
vpsrld ymm9, 15
vpor ymm11, ymm9
vmovdqa [rax + OFS_X1], ymm11 ; BRC_X1
vpslld ymm7, 16
vpsrld ymm5, 15
vpor ymm7, ymm5
vmovdqa [rax + OFS_X2], ymm7 ; BRC_X2
vpslld ymm2, 16
vpsrld ymm0, 15
vpor ymm2, ymm0
vmovdqa [rax + OFS_X3], ymm2 ; BRC_X3
%endmacro
;
; rot_mod32()
;
; uses ymm7
;
%macro rot_mod32 3
vpslld %1, %2, %3
vpsrld ymm7, %2, (32 - %3)
vpor %1, ymm7
%endmacro
;
; nonlin_fun8()
;
; params
; %1 == 1, then calculate W
; uses
;
; return
; ymm0 = W value, updates F_R1[] / F_R2[]
;
%macro nonlin_fun8 1
%if (%1 == 1)
vmovdqa ymm0, [rax + OFS_X0]
vpxor ymm0, [rax + OFS_R1]
vpaddd ymm0, [rax + OFS_R2] ; W = (BRC_X0 ^ F_R1) + F_R2
%endif
vmovdqa ymm1, [rax + OFS_R1]
vmovdqa ymm2, [rax + OFS_R2]
vpaddd ymm1, [rax + OFS_X1] ; W1 = F_R1 + BRC_X1
vpxor ymm2, [rax + OFS_X2] ; W2 = F_R2 ^ BRC_X2
vpslld ymm3, ymm1, 16
vpsrld ymm4, ymm1, 16
vpslld ymm5, ymm2, 16
vpsrld ymm6, ymm2, 16
vpor ymm1, ymm3, ymm6
vpor ymm2, ymm4, ymm5
rot_mod32 ymm3, ymm1, 2
rot_mod32 ymm4, ymm1, 10
rot_mod32 ymm5, ymm1, 18
rot_mod32 ymm6, ymm1, 24
vpxor ymm1, ymm3
vpxor ymm1, ymm4
vpxor ymm1, ymm5
vpxor ymm1, ymm6 ; XMM1 = U = L1(P)
rot_mod32 ymm3, ymm2, 8
rot_mod32 ymm4, ymm2, 14
rot_mod32 ymm5, ymm2, 22
rot_mod32 ymm6, ymm2, 30
vpxor ymm2, ymm3
vpxor ymm2, ymm4
vpxor ymm2, ymm5
vpxor ymm2, ymm6 ; XMM2 = V = L2(Q)
; Shuffle U and V to have all S0 lookups in XMM1 and all S1 lookups in XMM2
; Compress all S0 and S1 input values in each register
vpshufb ymm1, [rel S0_S1_shuf] ; S0: Bytes 0-7,16-23 S1: Bytes 8-15,24-31
vpshufb ymm2, [rel S1_S0_shuf] ; S1: Bytes 0-7,16-23 S0: Bytes 8-15,24-31
vshufpd ymm3, ymm1, ymm2, 0xA ; All S0 input values
vshufpd ymm4, ymm2, ymm1, 0xA ; All S1 input values
; Compute S0 and S1 values
S0_comput_AVX2 ymm3, ymm1, ymm2
S1_comput_AVX2 ymm4, ymm1, ymm2, ymm5
; Need to shuffle back ymm1 & ymm2 before storing output
; (revert what was done before S0 and S1 computations)
vshufpd ymm1, ymm3, ymm4, 0xA
vshufpd ymm2, ymm4, ymm3, 0xA
vpshufb ymm1, [rel rev_S0_S1_shuf]
vpshufb ymm2, [rel rev_S1_S0_shuf]
vmovdqa [rax + OFS_R1], ymm1
vmovdqa [rax + OFS_R2], ymm2
%endmacro
;
; store_kstr8()
;
; params
;
; uses
; ymm0 as input
; return
;
%macro store_kstr8 0
vpxor ymm0, [rax + OFS_X3]
mov rcx, [rsp]
mov rdx, [rsp + 8]
mov r8, [rsp + 16]
mov r9, [rsp + 24]
vpextrd r15d, xmm0, 3
vpextrd r14d, xmm0, 2
vpextrd r13d, xmm0, 1
vpextrd r12d, xmm0, 0
mov [r9], r15d
mov [r8], r14d
mov [rdx], r13d
mov [rcx], r12d
add rcx, 4
add rdx, 4
add r8, 4
add r9, 4
mov [rsp], rcx
mov [rsp + 8], rdx
mov [rsp + 16], r8
mov [rsp + 24], r9
vextracti128 xmm0, ymm0, 1
mov rcx, [rsp + 32]
mov rdx, [rsp + 40]
mov r8, [rsp + 48]
mov r9, [rsp + 56]
vpextrd r15d, xmm0, 3
vpextrd r14d, xmm0, 2
vpextrd r13d, xmm0, 1
vpextrd r12d, xmm0, 0
mov [r9], r15d
mov [r8], r14d
mov [rdx], r13d
mov [rcx], r12d
add rcx, 4
add rdx, 4
add r8, 4
add r9, 4
mov [rsp + 32], rcx
mov [rsp + 40], rdx
mov [rsp + 48], r8
mov [rsp + 56], r9
%endmacro
;
; add_mod31()
; add two 32-bit args and reduce mod (2^31-1)
; params
; %1 - arg1/res
; %2 - arg2
; uses
; ymm2
; return
; %1
%macro add_mod31 2
vpaddd %1, %2
vpsrld ymm2, %1, 31
vpand %1, MASK31
vpaddd %1, ymm2
%endmacro
;
; rot_mod31()
; rotate (mult by pow of 2) 32-bit arg and reduce mod (2^31-1)
; params
; %1 - arg
; %2 - # of bits
; uses
; ymm2
; return
; %1
%macro rot_mod31 2
vpslld ymm2, %1, %2
vpsrld %1, %1, (31 - %2)
vpor %1, ymm2
vpand %1, MASK31
%endmacro
;
; lfsr_updt8()
;
; params
; %1 - round number
; uses
; ymm0 as input (ZERO or W)
; return
;
%macro lfsr_updt8 1
;
; ymm1 = LFSR_S0
; ymm4 = LFSR_S4
; ymm10 = LFSR_S10
; ymm13 = LFSR_S13
; ymm15 = LFSR_S15
;
vpxor ymm3, ymm3
vmovdqa ymm1, [rax + (( 0 + %1) % 16)*32]
vmovdqa ymm4, [rax + (( 4 + %1) % 16)*32]
vmovdqa ymm10, [rax + ((10 + %1) % 16)*32]
vmovdqa ymm13, [rax + ((13 + %1) % 16)*32]
vmovdqa ymm15, [rax + ((15 + %1) % 16)*32]
; Calculate LFSR feedback
add_mod31 ymm0, ymm1
rot_mod31 ymm1, 8
add_mod31 ymm0, ymm1
rot_mod31 ymm4, 20
add_mod31 ymm0, ymm4
rot_mod31 ymm10, 21
add_mod31 ymm0, ymm10
rot_mod31 ymm13, 17
add_mod31 ymm0, ymm13
rot_mod31 ymm15, 15
add_mod31 ymm0, ymm15
vmovdqa [rax + (( 0 + %1) % 16)*32], ymm0
; LFSR_S16 = (LFSR_S15++) = eax
%endmacro
;
; key_expand_8()
;
%macro key_expand_8 2
movzx r8d, byte [rdi + (%1 + 0)]
movzx r9d, word [rbx + ((%1 + 0)*2)]
movzx r10d, byte [rsi + (%1 + 0)]
make_u31 r11d, r8d, r9d, r10d
mov [rax + (((%1 + 0)*32)+(%2*4))], r11d
movzx r12d, byte [rdi + (%1 + 1)]
movzx r13d, word [rbx + ((%1 + 1)*2)]
movzx r14d, byte [rsi + (%1 + 1)]
make_u31 r15d, r12d, r13d, r14d
mov [rax + (((%1 + 1)*32)+(%2*4))], r15d
%endmacro
MKGLOBAL(asm_ZucInitialization_8_avx2,function,internal)
asm_ZucInitialization_8_avx2:
%ifdef LINUX
%define pKe rdi
%define pIv rsi
%define pState rdx
%else
%define pKe rcx
%define pIv rdx
%define pState r8
%endif
FUNC_SAVE
lea rax, [pState] ; load pointer to LFSR
push pState ; Save LFSR Pointer to stack
; setup the key pointer for first buffer key expand
mov rbx, [pKe] ; load the pointer to the array of keys into rbx
push pKe ; save rdi (key pointer) to the stack
lea rdi, [rbx] ; load the pointer to the first key into rdi
; setup the IV pointer for first buffer key expand
mov rcx, [pIv] ; load the pointer to the array of IV's
push pIv ; save the IV pointer to the stack
lea rsi, [rcx] ; load the first IV pointer
lea rbx, [EK_d] ; load D variables
; Expand key packet 1
key_expand_8 0, 0
key_expand_8 2, 0
key_expand_8 4, 0
key_expand_8 6, 0
key_expand_8 8, 0
key_expand_8 10, 0
key_expand_8 12, 0
key_expand_8 14, 0
;; Expand keys for packets 2-7
%assign idx 1
%rep 6
pop rdx ; get IV array pointer from Stack
mov rcx, [rdx+8*idx] ; load offset to next IV in array
lea rsi, [rcx] ; load pointer to next IV
pop rbx ; get Key array pointer from Stack
mov rcx, [rbx+8*idx] ; load offset to next key in array
lea rdi, [rcx] ; load pointer to next Key
push rbx ; save Key pointer
push rdx ; save IV pointer
lea rbx, [EK_d]
; Expand key packet N
key_expand_8 0, idx
key_expand_8 2, idx
key_expand_8 4, idx
key_expand_8 6, idx
key_expand_8 8, idx
key_expand_8 10, idx
key_expand_8 12, idx
key_expand_8 14, idx
%assign idx (idx + 1)
%endrep
; Expand eighth packet key
pop rdx ; get IV array pointer from Stack
mov rcx, [rdx+56] ; load offset to IV 8 in array
lea rsi, [rcx] ; load pointer to IV 8
pop rbx ; get Key array pointer from Stack
mov rcx, [rbx+56] ; load offset to key 8 in array
lea rdi, [rcx] ; load pointer to Key 8
lea rbx, [EK_d]
; Expand key packet 8
key_expand_8 0, 7
key_expand_8 2, 7
key_expand_8 4, 7
key_expand_8 6, 7
key_expand_8 8, 7
key_expand_8 10, 7
key_expand_8 12, 7
key_expand_8 14, 7
; Load read-only registers
vmovdqa ymm12, [rel mask31]
; Shift LFSR 32-times, update state variables
%assign N 0
%rep 32
pop rdx
lea rax, [rdx]
push rdx
bits_reorg8 N
nonlin_fun8 1
vpsrld ymm0,1 ; Shift out LSB of W
pop rdx
lea rax, [rdx]
push rdx
lfsr_updt8 N ; W (ymm0) used in LFSR update - not set to zero
%assign N N+1
%endrep
; And once more, initial round from keygen phase = 33 times
pop rdx
lea rax, [rdx]
push rdx
bits_reorg8 0
nonlin_fun8 0
pop rdx
lea rax, [rdx]
vpxor ymm0, ymm0
lfsr_updt8 0
FUNC_RESTORE
ret
;
; Generate N*4 bytes of keystream
; for 8 buffers (where N is number of rounds)
;
%macro KEYGEN_8_AVX2 1
%define %%NUM_ROUNDS %1 ; [in] Number of 4-byte rounds
%ifdef LINUX
%define pState rdi
%define pKS rsi
%else
%define pState rcx
%define pKS rdx
%endif
FUNC_SAVE
; Store 8 keystream pointers on the stack
sub rsp, 8*8
mov r12, [pKS]
mov r13, [pKS + 8]
mov r14, [pKS + 16]
mov r15, [pKS + 24]
mov [rsp], r12
mov [rsp + 8], r13
mov [rsp + 16], r14
mov [rsp + 24], r15
mov r12, [pKS + 32]
mov r13, [pKS + 40]
mov r14, [pKS + 48]
mov r15, [pKS + 56]
mov [rsp + 32], r12
mov [rsp + 40], r13
mov [rsp + 48], r14
mov [rsp + 56], r15
; Load state pointer in RAX
mov rax, pState
; Load read-only registers
vmovdqa ymm12, [rel mask31]
; Generate 64B of keystream in 16 rounds
%assign N 1
%rep %%NUM_ROUNDS
bits_reorg8 N
nonlin_fun8 1
store_kstr8
vpxor ymm0, ymm0
lfsr_updt8 N
%assign N N+1
%endrep
;; Restore rsp pointer to value before pushing keystreams
add rsp, 8*8
FUNC_RESTORE
%endmacro
;;
;; void asm_ZucGenKeystream64B_8_avx2(state8_t *pSta, u32* pKeyStr[8])
;;
;; WIN64
;; RCX - pSta
;; RDX - pKeyStr
;;
;; LIN64
;; RDI - pSta
;; RSI - pKeyStr
;;
MKGLOBAL(asm_ZucGenKeystream64B_8_avx2,function,internal)
asm_ZucGenKeystream64B_8_avx2:
KEYGEN_8_AVX2 16
ret
;;
;; void asm_ZucGenKeystream8B_8_avx2(state8_t *pSta, u32* pKeyStr[8])
;;
;; WIN64
;; RCX - pSta
;; RDX - pKeyStr
;;
;; LIN64
;; RDI - pSta
;; RSI - pKeyStr
;;
MKGLOBAL(asm_ZucGenKeystream8B_8_avx2,function,internal)
asm_ZucGenKeystream8B_8_avx2:
KEYGEN_8_AVX2 2
ret
;;
;; void asm_ZucCipher64B_8_avx2(state4_t *pSta, u32 *pKeyStr[8], u64 *pIn[8],
;; u64 *pOut[8], u64 bufOff);
;;
;; WIN64
;; RCX - pSta
;; RDX - pKeyStr
;; R8 - pIn
;; R9 - pOut
;; rsp+40 - bufOff
;;
;; LIN64
;; RDI - pSta
;; RSI - pKeyStr
;; RDX - pIn
;; RCX - pOut
;; R8 - bufOff
;;
MKGLOBAL(asm_ZucCipher64B_8_avx2,function,internal)
asm_ZucCipher64B_8_avx2:
%ifdef LINUX
%define pState rdi
%define pKS rsi
%define pIn rdx
%define pOut rcx
%define bufOff r8
%else
%define pState rcx
%define pKS rdx
%define pIn r8
%define pOut r9
%define bufOff r10
%endif
;; Store parameter from stack in register
%ifndef LINUX
mov bufOff, [rsp + 40]
%endif
FUNC_SAVE
; Store 8 keystream pointers and input registers in the stack
sub rsp, 12*8
mov r12, [pKS]
mov r13, [pKS + 8]
mov r14, [pKS + 16]
mov r15, [pKS + 24]
mov [rsp], r12
mov [rsp + 8], r13
mov [rsp + 16], r14
mov [rsp + 24], r15
mov r12, [pKS + 32]
mov r13, [pKS + 40]
mov r14, [pKS + 48]
mov r15, [pKS + 56]
mov [rsp + 32], r12
mov [rsp + 40], r13
mov [rsp + 48], r14
mov [rsp + 56], r15
mov [rsp + 64], pKS
mov [rsp + 72], pIn
mov [rsp + 80], pOut
mov [rsp + 88], bufOff
; Load state pointer in RAX
mov rax, pState
; Load read-only registers
vmovdqa ymm12, [rel mask31]
; Generate 64B of keystream in 16 rounds
%assign N 1
%rep 16
bits_reorg8 N
nonlin_fun8 1
store_kstr8
vpxor ymm0, ymm0
lfsr_updt8 N
%assign N N+1
%endrep
;; Restore input parameters
mov pKS, [rsp + 64]
mov pIn, [rsp + 72]
mov pOut, [rsp + 80]
mov bufOff, [rsp + 88]
;; Restore rsp pointer to value before pushing keystreams
;; and input parameters
add rsp, 12*8
%assign off 0
%rep 2
;; XOR Input buffer with keystream in rounds of 32B
;; Read all 8 streams
mov r12, [pIn]
mov r13, [pIn + 8]
mov r14, [pIn + 16]
mov r15, [pIn + 24]
vmovdqu ymm0, [r12 + bufOff + off]
vmovdqu ymm1, [r13 + bufOff + off]
vmovdqu ymm2, [r14 + bufOff + off]
vmovdqu ymm3, [r15 + bufOff + off]
mov r12, [pIn + 32]
mov r13, [pIn + 40]
mov r14, [pIn + 48]
mov r15, [pIn + 56]
vmovdqu ymm4, [r12 + bufOff + off]
vmovdqu ymm5, [r13 + bufOff + off]
vmovdqu ymm6, [r14 + bufOff + off]
vmovdqu ymm7, [r15 + bufOff + off]
;; Read all 8 keystreams
mov r12, [pKS]
mov r13, [pKS + 8]
mov r14, [pKS + 16]
mov r15, [pKS + 24]
vmovdqa ymm8, [r12 + off]
vmovdqa ymm9, [r13 + off]
vmovdqa ymm10, [r14 + off]
vmovdqa ymm11, [r15 + off]
mov r12, [pKS + 32]
mov r13, [pKS + 40]
mov r14, [pKS + 48]
mov r15, [pKS + 56]
vmovdqa ymm12, [r12 + off]
vmovdqa ymm13, [r13 + off]
vmovdqa ymm14, [r14 + off]
vmovdqa ymm15, [r15 + off]
vpshufb ymm8, [rel swap_mask]
vpshufb ymm9, [rel swap_mask]
vpshufb ymm10, [rel swap_mask]
vpshufb ymm11, [rel swap_mask]
vpshufb ymm12, [rel swap_mask]
vpshufb ymm13, [rel swap_mask]
vpshufb ymm14, [rel swap_mask]
vpshufb ymm15, [rel swap_mask]
;; XOR Input with Keystream and write output for all 8 buffers
vpxor ymm8, ymm0
vpxor ymm9, ymm1
vpxor ymm10, ymm2
vpxor ymm11, ymm3
vpxor ymm12, ymm4
vpxor ymm13, ymm5
vpxor ymm14, ymm6
vpxor ymm15, ymm7
mov r12, [pOut]
mov r13, [pOut + 8]
mov r14, [pOut + 16]
mov r15, [pOut + 24]
vmovdqu [r12 + bufOff + off], ymm8
vmovdqu [r13 + bufOff + off], ymm9
vmovdqu [r14 + bufOff + off], ymm10
vmovdqu [r15 + bufOff + off], ymm11
mov r12, [pOut + 32]
mov r13, [pOut + 40]
mov r14, [pOut + 48]
mov r15, [pOut + 56]
vmovdqu [r12 + bufOff + off], ymm12
vmovdqu [r13 + bufOff + off], ymm13
vmovdqu [r14 + bufOff + off], ymm14
vmovdqu [r15 + bufOff + off], ymm15
%assign off (off + 32)
%endrep
FUNC_RESTORE
ret
;----------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------
%ifdef LINUX
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
|
test/Succeed/Issue204.agda | cruhland/agda | 1,989 | 3940 | <filename>test/Succeed/Issue204.agda
{-# OPTIONS --universe-polymorphism #-}
module Issue204 where
open import Issue204.Dependency
postulate
ℓ : Level
r : R ℓ
d : D ℓ
open R r
open M d
|
programs/oeis/048/A048071.asm | neoneye/loda | 22 | 11494 | <gh_stars>10-100
; A048071: Number of nonempty subsets of {1,2,...,n} in which exactly 1/2 of the elements are <= (n+2)/3.
; 0,1,2,5,9,14,34,55,83,209,329,494,1286,2001,3002,8007,12375,18563,50387,77519,116279,319769,490313,735470,2042974,3124549,4686824,13123109,20030009,30045014,84672314,129024479,193536719
add $0,3
mov $1,$0
sub $0,2
div $1,3
bin $0,$1
sub $0,1
|
sk/music/Chaos Emerald.asm | Cancer52/flamedriver | 9 | 18358 | Snd_Emerald_Header:
smpsHeaderStartSong 3, 1
smpsHeaderVoice Snd_Emerald_Voices
smpsHeaderChan $07, $03
smpsHeaderTempo $01, $35
smpsHeaderDAC Snd_Emerald_DAC
smpsHeaderFM Snd_Emerald_FM1, $F4, $08
smpsHeaderFM Snd_Emerald_FM2, $F4, $08
smpsHeaderFM Snd_Emerald_FM3, $F4, $07
smpsHeaderFM Snd_Emerald_FM4, $F4, $16
smpsHeaderFM Snd_Emerald_FM5, $F4, $16
smpsHeaderFM Snd_Emerald_FM6, $F4, $16
smpsHeaderPSG Snd_Emerald_PSG1, $F4, $02, $00, sTone_04
smpsHeaderPSG Snd_Emerald_PSG2, $F4, $02, $00, sTone_05
smpsHeaderPSG Snd_Emerald_PSG3, $F4, $00, $00, sTone_04
; FM3 Data
Snd_Emerald_FM3:
smpsAlterNote $02
; FM1 Data
Snd_Emerald_FM1:
smpsSetvoice $00
dc.b nE5, $06, nG5, nC6, nE6, $0C, nC6, nG6, $2A
smpsStop
; FM2 Data
Snd_Emerald_FM2:
smpsSetvoice $00
dc.b nC5, $06, nE5, nG5, nC6, $0C, nA5, nD6, $2A
smpsStop
; FM4 Data
Snd_Emerald_FM4:
smpsSetvoice $01
dc.b nE5, $0C, nE5, $06, nG5, $06, nRst, nG5, nRst, nC6, $2A
smpsStop
; FM5 Data
Snd_Emerald_FM5:
smpsSetvoice $01
dc.b nC6, $0C, nC6, $06, nE6, $06, nRst, nE6, nRst, nG6, $2A
smpsStop
; FM6 Data
Snd_Emerald_FM6:
smpsSetvoice $01
dc.b nG5, $0C, nG5, $06, nC6, $06, nRst, nC6, nRst, nE6, $2A
smpsStop
; PSG2 Data
Snd_Emerald_PSG2:
dc.b nRst, $2D
Snd_Emerald_Loop01:
dc.b nG5, $06, nF5, nE5, nD5
smpsPSGAlterVol $03
smpsLoop $00, $04, Snd_Emerald_Loop01
smpsStop
; PSG1 Data
Snd_Emerald_PSG1:
smpsFade $01
dc.b nRst, $02, nRst, $2D
Snd_Emerald_Loop00:
dc.b nG5, $06, nF5, nE5, nD5
smpsPSGAlterVol $03
smpsLoop $00, $04, Snd_Emerald_Loop00
; DAC Data
Snd_Emerald_DAC:
; PSG3 Data
Snd_Emerald_PSG3:
smpsStop
Snd_Emerald_Voices:
; Voice $00
; $04
; $35, $72, $54, $46, $1F, $1F, $1F, $1F, $07, $0A, $07, $0D
; $00, $0B, $00, $0B, $1F, $0F, $1F, $0F, $23, $14, $1D, $80
smpsVcAlgorithm $04
smpsVcFeedback $00
smpsVcUnusedBits $00
smpsVcDetune $04, $05, $07, $03
smpsVcCoarseFreq $06, $04, $02, $05
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $0D, $07, $0A, $07
smpsVcDecayRate2 $0B, $00, $0B, $00
smpsVcDecayLevel $00, $01, $00, $01
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $80, $1D, $14, $23
; Voice $01
; $3C
; $31, $52, $50, $30, $52, $53, $52, $53, $08, $00, $08, $00
; $04, $00, $04, $00, $10, $07, $10, $07, $1A, $80, $16, $80
smpsVcAlgorithm $04
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $03, $05, $05, $03
smpsVcCoarseFreq $00, $00, $02, $01
smpsVcRateScale $01, $01, $01, $01
smpsVcAttackRate $13, $12, $13, $12
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $00, $08, $00, $08
smpsVcDecayRate2 $00, $04, $00, $04
smpsVcDecayLevel $00, $01, $00, $01
smpsVcReleaseRate $07, $00, $07, $00
smpsVcTotalLevel $80, $16, $80, $1A
|
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/a-suenco.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 28036 | <reponame>JCGobbi/Nucleo-STM32G474RE<gh_stars>0
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.STRINGS.UTF_ENCODING.CONVERSIONS --
-- --
-- B o d y --
-- --
-- Copyright (C) 2010-2021, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body Ada.Strings.UTF_Encoding.Conversions is
use Interfaces;
-- Convert from UTF-8/UTF-16BE/LE to UTF-8/UTF-16BE/LE
function Convert
(Item : UTF_String;
Input_Scheme : Encoding_Scheme;
Output_Scheme : Encoding_Scheme;
Output_BOM : Boolean := False) return UTF_String
is
begin
-- Nothing to do if identical schemes, but for UTF_8 we need to
-- handle overlong encodings, so need to do the full conversion.
if Input_Scheme = Output_Scheme
and then Input_Scheme /= UTF_8
then
return Item;
-- For remaining cases, one or other of the operands is UTF-16BE/LE
-- encoded, or we have the UTF-8 to UTF-8 case where we must handle
-- overlong encodings. In all cases, go through UTF-16 intermediate.
else
return Convert (UTF_16_Wide_String'(Convert (Item, Input_Scheme)),
Output_Scheme, Output_BOM);
end if;
end Convert;
-- Convert from UTF-8/UTF-16BE/LE to UTF-16
function Convert
(Item : UTF_String;
Input_Scheme : Encoding_Scheme;
Output_BOM : Boolean := False) return UTF_16_Wide_String
is
begin
if Input_Scheme = UTF_8 then
return Convert (Item, Output_BOM);
else
return To_UTF_16 (Item, Input_Scheme, Output_BOM);
end if;
end Convert;
-- Convert from UTF-8 to UTF-16
function Convert
(Item : UTF_8_String;
Output_BOM : Boolean := False) return UTF_16_Wide_String
is
Result : UTF_16_Wide_String (1 .. Item'Length + 1);
-- Maximum length of result, including possible BOM
Len : Natural := 0;
-- Number of characters stored so far in Result
Iptr : Natural;
-- Next character to process in Item
C : Unsigned_8;
-- Input UTF-8 code
R : Unsigned_16;
-- Output UTF-16 code
procedure Get_Continuation;
-- Reads a continuation byte of the form 10xxxxxx, shifts R left by 6
-- bits, and or's in the xxxxxx to the low order 6 bits. On return Ptr
-- is incremented. Raises exception if continuation byte does not exist
-- or is invalid.
----------------------
-- Get_Continuation --
----------------------
procedure Get_Continuation is
begin
if Iptr > Item'Last then
Raise_Encoding_Error (Iptr - 1);
else
C := To_Unsigned_8 (Item (Iptr));
Iptr := Iptr + 1;
if C < 2#10_000000# or else C > 2#10_111111# then
Raise_Encoding_Error (Iptr - 1);
else
R :=
Shift_Left (R, 6) or Unsigned_16 (C and 2#00_111111#);
end if;
end if;
end Get_Continuation;
-- Start of processing for Convert
begin
-- Output BOM if required
if Output_BOM then
Len := Len + 1;
Result (Len) := BOM_16 (1);
end if;
-- Skip OK BOM
Iptr := Item'First;
if Item'Length >= 3 and then Item (Iptr .. Iptr + 2) = BOM_8 then
Iptr := Iptr + 3;
-- Error if bad BOM
elsif Item'Length >= 2
and then (Item (Iptr .. Iptr + 1) = BOM_16BE
or else
Item (Iptr .. Iptr + 1) = BOM_16LE)
then
Raise_Encoding_Error (Iptr);
-- No BOM present
else
Iptr := Item'First;
end if;
while Iptr <= Item'Last loop
C := To_Unsigned_8 (Item (Iptr));
Iptr := Iptr + 1;
-- Codes in the range 16#00# .. 16#7F#
-- UTF-8: 0xxxxxxx
-- UTF-16: 00000000_0xxxxxxx
if C <= 16#7F# then
Len := Len + 1;
Result (Len) := Wide_Character'Val (C);
-- No initial code can be of the form 10xxxxxx. Such codes are used
-- only for continuations.
elsif C <= 2#10_111111# then
Raise_Encoding_Error (Iptr - 1);
-- Codes in the range 16#80# .. 16#7FF#
-- UTF-8: 110yyyxx 10xxxxxx
-- UTF-16: 00000yyy_xxxxxxxx
elsif C <= 2#110_11111# then
R := Unsigned_16 (C and 2#000_11111#);
Get_Continuation;
Len := Len + 1;
Result (Len) := Wide_Character'Val (R);
-- Codes in the range 16#800# .. 16#D7FF or 16#DF01# .. 16#FFFF#
-- UTF-8: 1110yyyy 10yyyyxx 10xxxxxx
-- UTF-16: yyyyyyyy_xxxxxxxx
elsif C <= 2#1110_1111# then
R := Unsigned_16 (C and 2#0000_1111#);
Get_Continuation;
Get_Continuation;
Len := Len + 1;
Result (Len) := Wide_Character'Val (R);
-- Make sure that we don't have a result in the forbidden range
-- reserved for UTF-16 surrogate characters.
if R in 16#D800# .. 16#DF00# then
Raise_Encoding_Error (Iptr - 3);
end if;
-- Codes in the range 16#10000# .. 16#10FFFF#
-- UTF-8: 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx
-- UTF-16: 110110zz_zzyyyyyy 110111yy_xxxxxxxx
-- Note: zzzz in the output is input zzzzz - 1
elsif C <= 2#11110_111# then
R := Unsigned_16 (C and 2#00000_111#);
Get_Continuation;
-- R now has zzzzzyyyy
-- At this stage, we check for the case where we have an overlong
-- encoding, and the encoded value in fact lies in the single word
-- range (16#800# .. 16#D7FF or 16#DF01# .. 16#FFFF#). This means
-- that the result fits in a single result word.
if R <= 2#1111# then
Get_Continuation;
Get_Continuation;
-- Make sure we are not in the forbidden surrogate range
if R in 16#D800# .. 16#DF00# then
Raise_Encoding_Error (Iptr - 3);
end if;
-- Otherwise output a single UTF-16 value
Len := Len + 1;
Result (Len) := Wide_Character'Val (R);
-- Here for normal case (code value > 16#FFFF and zzzzz non-zero)
else
-- Subtract 1 from input zzzzz value to get output zzzz value
R := R - 2#0000_1_0000#;
-- R now has zzzzyyyy (zzzz minus one for the output)
Get_Continuation;
-- R now has zzzzyy_yyyyyyxx
Len := Len + 1;
Result (Len) :=
Wide_Character'Val
(2#110110_00_0000_0000# or Shift_Right (R, 4));
R := R and 2#1111#;
Get_Continuation;
Len := Len + 1;
Result (Len) :=
Wide_Character'Val (2#110111_00_0000_0000# or R);
end if;
-- Any other code is an error
else
Raise_Encoding_Error (Iptr - 1);
end if;
end loop;
return Result (1 .. Len);
end Convert;
-- Convert from UTF-16 to UTF-8/UTF-16-BE/LE
function Convert
(Item : UTF_16_Wide_String;
Output_Scheme : Encoding_Scheme;
Output_BOM : Boolean := False) return UTF_String
is
begin
if Output_Scheme = UTF_8 then
return Convert (Item, Output_BOM);
else
return From_UTF_16 (Item, Output_Scheme, Output_BOM);
end if;
end Convert;
-- Convert from UTF-16 to UTF-8
function Convert
(Item : UTF_16_Wide_String;
Output_BOM : Boolean := False) return UTF_8_String
is
Result : UTF_8_String (1 .. 3 * Item'Length + 3);
-- Worst case is 3 output codes for each input code + BOM space
Len : Natural;
-- Number of result codes stored
Iptr : Natural;
-- Pointer to next input character
C1, C2 : Unsigned_16;
zzzzz : Unsigned_16;
yyyyyyyy : Unsigned_16;
xxxxxxxx : Unsigned_16;
-- Components of double length case
begin
Iptr := Item'First;
-- Skip BOM at start of input
if Item'Length > 0 and then Item (Iptr) = BOM_16 (1) then
Iptr := Iptr + 1;
end if;
-- Generate output BOM if required
if Output_BOM then
Result (1 .. 3) := BOM_8;
Len := 3;
else
Len := 0;
end if;
-- Loop through input
while Iptr <= Item'Last loop
C1 := To_Unsigned_16 (Item (Iptr));
Iptr := Iptr + 1;
-- Codes in the range 16#0000# - 16#007F#
-- UTF-16: 000000000xxxxxxx
-- UTF-8: 0xxxxxxx
if C1 <= 16#007F# then
Result (Len + 1) := Character'Val (C1);
Len := Len + 1;
-- Codes in the range 16#80# - 16#7FF#
-- UTF-16: 00000yyyxxxxxxxx
-- UTF-8: 110yyyxx 10xxxxxx
elsif C1 <= 16#07FF# then
Result (Len + 1) :=
Character'Val
(2#110_00000# or Shift_Right (C1, 6));
Result (Len + 2) :=
Character'Val
(2#10_000000# or (C1 and 2#00_111111#));
Len := Len + 2;
-- Codes in the range 16#800# - 16#D7FF# or 16#E000# - 16#FFFF#
-- UTF-16: yyyyyyyyxxxxxxxx
-- UTF-8: 1110yyyy 10yyyyxx 10xxxxxx
elsif C1 <= 16#D7FF# or else C1 >= 16#E000# then
Result (Len + 1) :=
Character'Val
(2#1110_0000# or Shift_Right (C1, 12));
Result (Len + 2) :=
Character'Val
(2#10_000000# or (Shift_Right (C1, 6) and 2#00_111111#));
Result (Len + 3) :=
Character'Val
(2#10_000000# or (C1 and 2#00_111111#));
Len := Len + 3;
-- Codes in the range 16#10000# - 16#10FFFF#
-- UTF-16: 110110zzzzyyyyyy 110111yyxxxxxxxx
-- UTF-8: 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx
-- Note: zzzzz in the output is input zzzz + 1
elsif C1 <= 2#110110_11_11111111# then
if Iptr > Item'Last then
Raise_Encoding_Error (Iptr - 1);
else
C2 := To_Unsigned_16 (Item (Iptr));
Iptr := Iptr + 1;
end if;
if (C2 and 2#111111_00_00000000#) /= 2#110111_00_00000000# then
Raise_Encoding_Error (Iptr - 1);
end if;
zzzzz := (Shift_Right (C1, 6) and 2#1111#) + 1;
yyyyyyyy := ((Shift_Left (C1, 2) and 2#111111_00#)
or
(Shift_Right (C2, 8) and 2#000000_11#));
xxxxxxxx := C2 and 2#11111111#;
Result (Len + 1) :=
Character'Val
(2#11110_000# or (Shift_Right (zzzzz, 2)));
Result (Len + 2) :=
Character'Val
(2#10_000000# or Shift_Left (zzzzz and 2#11#, 4)
or Shift_Right (yyyyyyyy, 4));
Result (Len + 3) :=
Character'Val
(2#10_000000# or Shift_Left (yyyyyyyy and 2#1111#, 2)
or Shift_Right (xxxxxxxx, 6));
Result (Len + 4) :=
Character'Val
(2#10_000000# or (xxxxxxxx and 2#00_111111#));
Len := Len + 4;
-- Error if input in 16#DC00# - 16#DFFF# (2nd surrogate with no 1st)
else
Raise_Encoding_Error (Iptr - 2);
end if;
end loop;
return Result (1 .. Len);
end Convert;
end Ada.Strings.UTF_Encoding.Conversions;
|
backend/src/main/antlr4/org/str/backend/lifeparser.g4 | sjrtuxkjvch/gameofdalife | 0 | 6588 | <gh_stars>0
/**
* Define a grammar called lifeparser
*/
grammar lifeparser;
file:
// identify_statement
// description_statements
// rule_statement
pattern_statements
EOF
;
identify_statement: HASH LIFE_ID NL;
description_statements: description_statement*;
description_statement: HASH D NL;
rule_statement: HASH N NL;
pattern_statements: pattern_statement*;
pattern_statement:
HASH P x=SIGNED_INTEGER_CONST y=SIGNED_INTEGER_CONST NL
content+=content_line+
;
content_line:
chars+=(DOT | STAR)+ NL;
// Tokens
HASH: '#';
DOT: '.';
STAR: '*';
D: 'D';
N: 'N';
P: 'P';
LIFE_ID: 'Life 1.05';
// Decimal integer constant
fragment INTEGER_CONST: ('0'..'9')+;
// Signed integer constant
SIGNED_INTEGER_CONST: ('+' | '-')? INTEGER_CONST;
WS : (' ' | '\t' | '\f')+ -> skip ; // skip spaces, tabs, newlines
NL : ('\r' | '\n' | '\r\n'); // -> skip ; // skip newlines
//TEXT: ~('P' | '#' | '*' | '.' | '\r' | '\n') (~('\r' | '\n')) +;
//TEXT: [a-zA-Z0-9]*?;
OTHER: . -> skip;
|
_build/dispatcher/jmp_ippsGFpScratchBufferSize_666fc8cb.asm | zyktrcn/ippcp | 1 | 27406 | extern m7_ippsGFpScratchBufferSize:function
extern n8_ippsGFpScratchBufferSize:function
extern y8_ippsGFpScratchBufferSize:function
extern e9_ippsGFpScratchBufferSize:function
extern l9_ippsGFpScratchBufferSize:function
extern n0_ippsGFpScratchBufferSize:function
extern k0_ippsGFpScratchBufferSize:function
extern ippcpJumpIndexForMergedLibs
extern ippcpSafeInit:function
segment .data
align 8
dq .Lin_ippsGFpScratchBufferSize
.Larraddr_ippsGFpScratchBufferSize:
dq m7_ippsGFpScratchBufferSize
dq n8_ippsGFpScratchBufferSize
dq y8_ippsGFpScratchBufferSize
dq e9_ippsGFpScratchBufferSize
dq l9_ippsGFpScratchBufferSize
dq n0_ippsGFpScratchBufferSize
dq k0_ippsGFpScratchBufferSize
segment .text
global ippsGFpScratchBufferSize:function (ippsGFpScratchBufferSize.LEndippsGFpScratchBufferSize - ippsGFpScratchBufferSize)
.Lin_ippsGFpScratchBufferSize:
db 0xf3, 0x0f, 0x1e, 0xfa
call ippcpSafeInit wrt ..plt
align 16
ippsGFpScratchBufferSize:
db 0xf3, 0x0f, 0x1e, 0xfa
mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc]
movsxd rax, dword [rax]
lea r11, [rel .Larraddr_ippsGFpScratchBufferSize]
mov r11, qword [r11+rax*8]
jmp r11
.LEndippsGFpScratchBufferSize:
|
GParse/Lexing/Composable/regex.g4 | GGG-KILLER/GParse | 1 | 5982 | main
: alternation
| sequence
;
alternation
: main '|' sequence
;
sequence
: suffixed*
;
suffixed
: repetition
| expression
;
repetition
: expression ('?' | '*' | '+' | '{' NUMBER '}' | '{' NUMBER? ',' NUMBER? '}') '?'?
;
expression
: alternation_set
| lookahead
| non_capturing_group
| named_capture_group
| numbered_capture_group
| backreference
| character_class
| CHAR
;
named_capture_group
: '(?<' WORD_CHAR+ '>' main ')'
;
numbered_capture_group
: '(' main ')'
;
backreference
: '\\' ('0'..'9')+
| '\\k<' WORD_CHAR+ '>'
;
non_capturing_group
: '(?:' main ')'
;
lookahead
: '(?' ('=' | '!') main ')'
;
alternation_set
: '[' '^'? ']'? alternation_element+ ']'
;
alternation_element
: character_class
| character_range
| ALTERNATION_CHAR
;
character_range
: ALTERNATION_CHAR '-' ALTERNATION_CHAR
;
ALTERNATION_CHAR
: ESCAPE
| [^\]\\]
;
CHAR
: ESCAPE
| ~SPECIAL_CHAR
;
character_class
: '.'
| '\\' (
'd'
| 'D'
| 'w'
| 'W'
| 's'
| 'S'
)
| UNICODE_CLASS_OR_BLOCK
;
UNICODE_CLASS_OR_BLOCK:
: '\\' ('p' | 'P') '{' UNICODE_CLASS_OR_BLOCK_NAME '}'
;
UNICODE_CLASS_OR_BLOCK_NAME
: (WORD_CHAR | '-')+ /* <any of the names in UnicodeCharacterCategoriesAndCodeBlocks.xml> */
;
ESCAPE
: HEX_ESCAPE
| SIMPLE_ESCAPE
;
HEX_ESCAPE
: '\\x' HEX_DIGIT+
;
SIMPLE_ESCAPE
: '\\a'
/* | '\\b' */
| '\\f'
| '\\n'
| '\\r'
| '\\t'
| '\\v'
| '\\' SPECIAL_CHAR
;
SPECIAL_CHAR
: [.$^{\[(|)*+?\\]
;
NUMBER
: [0-9]+
;
WORD_CHAR
: [a-zA-Z0-9_]
;
HEX_DIGIT
: [a-fA-F0-9]
; |
old/EquivalenceLemmas.agda | UlrikBuchholtz/HoTT-Agda | 294 | 1736 | <gh_stars>100-1000
{-# OPTIONS --without-K #-}
{-
This file lists some basic facts about equivalences
that have to be put in a separate file due to dependency.
-}
open import Types
open import Functions
open import Paths
open import HLevel
open import Equivalences
open import Univalence
open import HLevelBis
module EquivalenceLemmas where
equiv-eq : ∀ {i} {A B : Set i} {f g : A ≃ B} → π₁ f ≡ π₁ g → f ≡ g
equiv-eq p = Σ-eq p $ prop-has-all-paths (is-equiv-is-prop _) _ _
|
programs/oeis/086/A086580.asm | neoneye/loda | 22 | 89502 | ; A086580: a(n) = 9*(10^n - 1).
; 0,81,891,8991,89991,899991,8999991,89999991,899999991,8999999991,89999999991,899999999991,8999999999991,89999999999991,899999999999991,8999999999999991,89999999999999991,899999999999999991,8999999999999999991,89999999999999999991,899999999999999999991
mov $1,10
pow $1,$0
sub $1,1
mul $1,9
mov $0,$1
|
Task/Cholesky-decomposition/Ada/cholesky-decomposition-1.ada | LaudateCorpus1/RosettaCodeData | 1 | 3411 | <reponame>LaudateCorpus1/RosettaCodeData<gh_stars>1-10
with Ada.Numerics.Generic_Real_Arrays;
generic
with package Matrix is new Ada.Numerics.Generic_Real_Arrays (<>);
package Decomposition is
-- decompose a square matrix A by A = L * Transpose (L)
procedure Decompose (A : Matrix.Real_Matrix; L : out Matrix.Real_Matrix);
end Decomposition;
|
arch/ARM/STM32/svd/stm32f7x9/stm32_svd-flash.ads | rocher/Ada_Drivers_Library | 192 | 29064 | -- This spec has been automatically generated from STM32F7x9.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.FLASH is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype ACR_LATENCY_Field is HAL.UInt3;
-- Flash access control register
type ACR_Register is record
-- Latency
LATENCY : ACR_LATENCY_Field := 16#0#;
-- unspecified
Reserved_3_7 : HAL.UInt5 := 16#0#;
-- Prefetch enable
PRFTEN : Boolean := False;
-- Instruction cache enable
ICEN : Boolean := False;
-- Data cache enable
DCEN : Boolean := False;
-- Write-only. Instruction cache reset
ICRST : Boolean := False;
-- Data cache reset
DCRST : Boolean := False;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ACR_Register use record
LATENCY at 0 range 0 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
PRFTEN at 0 range 8 .. 8;
ICEN at 0 range 9 .. 9;
DCEN at 0 range 10 .. 10;
ICRST at 0 range 11 .. 11;
DCRST at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-- Status register
type SR_Register is record
-- End of operation
EOP : Boolean := False;
-- Operation error
OPERR : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- Write protection error
WRPERR : Boolean := False;
-- Programming alignment error
PGAERR : Boolean := False;
-- Programming parallelism error
PGPERR : Boolean := False;
-- Programming sequence error
PGSERR : Boolean := False;
-- unspecified
Reserved_8_15 : HAL.UInt8 := 16#0#;
-- Read-only. Busy
BSY : Boolean := False;
-- unspecified
Reserved_17_31 : HAL.UInt15 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
EOP at 0 range 0 .. 0;
OPERR at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
WRPERR at 0 range 4 .. 4;
PGAERR at 0 range 5 .. 5;
PGPERR at 0 range 6 .. 6;
PGSERR at 0 range 7 .. 7;
Reserved_8_15 at 0 range 8 .. 15;
BSY at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
subtype CR_SNB_Field is HAL.UInt5;
subtype CR_PSIZE_Field is HAL.UInt2;
-- Control register
type CR_Register is record
-- Programming
PG : Boolean := False;
-- Sector Erase
SER : Boolean := False;
-- Mass Erase of sectors 0 to 11
MER : Boolean := False;
-- Sector number
SNB : CR_SNB_Field := 16#0#;
-- Program size
PSIZE : CR_PSIZE_Field := 16#0#;
-- unspecified
Reserved_10_14 : HAL.UInt5 := 16#0#;
-- Mass Erase of sectors 12 to 23
MER1 : Boolean := False;
-- Start
STRT : Boolean := False;
-- unspecified
Reserved_17_23 : HAL.UInt7 := 16#0#;
-- End of operation interrupt enable
EOPIE : Boolean := False;
-- Error interrupt enable
ERRIE : Boolean := False;
-- unspecified
Reserved_26_30 : HAL.UInt5 := 16#0#;
-- Lock
LOCK : Boolean := True;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
PG at 0 range 0 .. 0;
SER at 0 range 1 .. 1;
MER at 0 range 2 .. 2;
SNB at 0 range 3 .. 7;
PSIZE at 0 range 8 .. 9;
Reserved_10_14 at 0 range 10 .. 14;
MER1 at 0 range 15 .. 15;
STRT at 0 range 16 .. 16;
Reserved_17_23 at 0 range 17 .. 23;
EOPIE at 0 range 24 .. 24;
ERRIE at 0 range 25 .. 25;
Reserved_26_30 at 0 range 26 .. 30;
LOCK at 0 range 31 .. 31;
end record;
subtype OPTCR_BOR_LEV_Field is HAL.UInt2;
subtype OPTCR_RDP_Field is HAL.UInt8;
subtype OPTCR_nWRP_Field is HAL.UInt12;
-- Flash option control register
type OPTCR_Register is record
-- Option lock
OPTLOCK : Boolean := True;
-- Option start
OPTSTRT : Boolean := False;
-- BOR reset Level
BOR_LEV : OPTCR_BOR_LEV_Field := 16#3#;
-- unspecified
Reserved_4_4 : HAL.Bit := 16#0#;
-- WDG_SW User option bytes
WDG_SW : Boolean := True;
-- nRST_STOP User option bytes
nRST_STOP : Boolean := True;
-- nRST_STDBY User option bytes
nRST_STDBY : Boolean := True;
-- Read protect
RDP : OPTCR_RDP_Field := 16#AA#;
-- Not write protect
nWRP : OPTCR_nWRP_Field := 16#FFF#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OPTCR_Register use record
OPTLOCK at 0 range 0 .. 0;
OPTSTRT at 0 range 1 .. 1;
BOR_LEV at 0 range 2 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
WDG_SW at 0 range 5 .. 5;
nRST_STOP at 0 range 6 .. 6;
nRST_STDBY at 0 range 7 .. 7;
RDP at 0 range 8 .. 15;
nWRP at 0 range 16 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype OPTCR1_nWRP_Field is HAL.UInt12;
-- Flash option control register 1
type OPTCR1_Register is record
-- unspecified
Reserved_0_15 : HAL.UInt16 := 16#0#;
-- Not write protect
nWRP : OPTCR1_nWRP_Field := 16#FFF#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OPTCR1_Register use record
Reserved_0_15 at 0 range 0 .. 15;
nWRP at 0 range 16 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- FLASH
type FLASH_Peripheral is record
-- Flash access control register
ACR : aliased ACR_Register;
-- Flash key register
KEYR : aliased HAL.UInt32;
-- Flash option key register
OPTKEYR : aliased HAL.UInt32;
-- Status register
SR : aliased SR_Register;
-- Control register
CR : aliased CR_Register;
-- Flash option control register
OPTCR : aliased OPTCR_Register;
-- Flash option control register 1
OPTCR1 : aliased OPTCR1_Register;
end record
with Volatile;
for FLASH_Peripheral use record
ACR at 16#0# range 0 .. 31;
KEYR at 16#4# range 0 .. 31;
OPTKEYR at 16#8# range 0 .. 31;
SR at 16#C# range 0 .. 31;
CR at 16#10# range 0 .. 31;
OPTCR at 16#14# range 0 .. 31;
OPTCR1 at 16#18# range 0 .. 31;
end record;
-- FLASH
FLASH_Periph : aliased FLASH_Peripheral
with Import, Address => System'To_Address (16#40023C00#);
end STM32_SVD.FLASH;
|
src/main/antlr/FreezeTag.g4 | Hyperparticle/FreezeTag | 3 | 4104 | grammar FreezeTag;
start: statement (SEP_S statement)* SEP_S?;
statement: WS? subject (WS? predicate)? WS?;
subject: node;
predicate: relation WS? node;
node: (nodeType WS?)? nodeProperty (WS? nodeProperty)* | nodeType;
nodeType: TYPE_S ID;
nodeProperty: PROP_S ID (WS string)?;
// TODO: request individual properties
relation: PROP_S ID;
string: (ID | WS)+;
SEP_S: ';';
TYPE_S: '@';
PROP_S: '#' | '+' | '-';
ID: ~([ \t\r\n] | '"' | '\'' | ';' | '@' | '#' | '+' | '-')+;
WS: [ \t\r\n]+;
|
programs/oeis/109/A109678.asm | karttu/loda | 1 | 175611 | <reponame>karttu/loda
; A109678: Sequence and first differences include all square numbers exactly once.
; 1,5,14,30,55,91,140,204,285,385,506,650,819,1015,1240,1496,1785,2109,2470,2870,3311,3795,4324,4900,5525,6201,6930,7714,8555,9455,10416,11440,12529,13685,14910,16206,17575,19019,20540,22140,23821,25585
add $0,2
mul $0,2
bin $0,3
mov $1,$0
div $1,4
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_1_1434.asm | ljhsiun2/medusa | 9 | 15089 | <filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_1_1434.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1d64b, %rax
nop
nop
sub %rdi, %rdi
mov $0x6162636465666768, %r8
movq %r8, %xmm5
movups %xmm5, (%rax)
nop
nop
nop
cmp $29215, %rdi
lea addresses_UC_ht+0x13a8b, %rsi
lea addresses_UC_ht+0x37fb, %rdi
clflush (%rdi)
nop
nop
nop
nop
xor $64057, %r12
mov $38, %rcx
rep movsq
nop
nop
nop
nop
nop
dec %rsi
lea addresses_D_ht+0x53fb, %rdi
dec %r8
mov $0x6162636465666768, %rax
movq %rax, %xmm7
movups %xmm7, (%rdi)
xor %rcx, %rcx
lea addresses_UC_ht+0x1dffb, %r12
nop
nop
nop
inc %r9
mov $0x6162636465666768, %rdi
movq %rdi, %xmm1
vmovups %ymm1, (%r12)
nop
nop
inc %rcx
lea addresses_A_ht+0x12849, %rdi
nop
nop
nop
nop
add %r8, %r8
vmovups (%rdi), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %rcx
nop
nop
xor $46016, %r12
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %r8
push %rbp
push %rcx
push %rdx
push %rsi
// Store
mov $0x821e100000006cf, %rcx
nop
nop
nop
xor %r10, %r10
mov $0x5152535455565758, %r8
movq %r8, %xmm5
vmovups %ymm5, (%rcx)
nop
nop
nop
nop
sub %r15, %r15
// Store
lea addresses_US+0x617b, %rsi
nop
nop
nop
nop
cmp %rbp, %rbp
movl $0x51525354, (%rsi)
nop
nop
nop
nop
add $37964, %rdx
// Faulty Load
lea addresses_normal+0xbffb, %rbp
xor $64629, %r10
vmovups (%rbp), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %rcx
lea oracles, %rdx
and $0xff, %rcx
shlq $12, %rcx
mov (%rdx,%rcx,1), %rcx
pop %rsi
pop %rdx
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 6}}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 11}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'34': 1}
34
*/
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_331.asm | ljhsiun2/medusa | 9 | 9559 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r14
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0xd3f2, %r14
nop
add %r13, %r13
movl $0x61626364, (%r14)
nop
nop
nop
nop
xor $64197, %r11
lea addresses_A_ht+0x5eea, %rdi
nop
nop
nop
nop
nop
dec %rsi
mov (%rdi), %rcx
nop
nop
and $58496, %rcx
lea addresses_D_ht+0x3cea, %r13
nop
sub $26990, %rsi
movb $0x61, (%r13)
nop
sub %r14, %r14
lea addresses_UC_ht+0x7f8e, %rsi
nop
nop
nop
nop
and %rcx, %rcx
movw $0x6162, (%rsi)
nop
nop
nop
add $60047, %r12
lea addresses_normal_ht+0x9aea, %r14
clflush (%r14)
nop
nop
nop
nop
nop
sub $19543, %rdi
mov $0x6162636465666768, %r11
movq %r11, (%r14)
nop
nop
nop
nop
nop
xor $6560, %r11
lea addresses_D_ht+0xdbea, %r13
nop
add $44331, %rcx
movb $0x61, (%r13)
nop
xor %r13, %r13
lea addresses_normal_ht+0xc996, %rdi
nop
nop
xor %r11, %r11
vmovups (%rdi), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $1, %xmm6, %r14
nop
inc %rcx
lea addresses_D_ht+0x1d26a, %rsi
lea addresses_A_ht+0x1d9ea, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
nop
xor $47939, %r12
mov $65, %rcx
rep movsb
cmp %rcx, %rcx
lea addresses_normal_ht+0x35cc, %rsi
lea addresses_WC_ht+0x6a7e, %rdi
nop
sub %rbx, %rbx
mov $93, %rcx
rep movsb
nop
nop
xor $42624, %r12
lea addresses_WC_ht+0xcf6a, %rsi
lea addresses_WT_ht+0x3134, %rdi
nop
nop
nop
nop
nop
inc %r11
mov $116, %rcx
rep movsq
dec %rdi
lea addresses_D_ht+0xbbea, %rdi
nop
nop
nop
nop
nop
cmp $1472, %rbx
movb $0x61, (%rdi)
nop
cmp %r14, %r14
lea addresses_WC_ht+0xd5ea, %r12
nop
add $14417, %r13
mov (%r12), %ebx
and %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r15
push %rax
push %rbp
push %rsi
// Store
lea addresses_PSE+0x8ff3, %rbp
clflush (%rbp)
nop
nop
sub %rax, %rax
movb $0x51, (%rbp)
nop
nop
nop
xor $54741, %r15
// Store
lea addresses_A+0x1f2ea, %r13
nop
cmp %rax, %rax
mov $0x5152535455565758, %rsi
movq %rsi, %xmm2
vmovups %ymm2, (%r13)
add %r13, %r13
// Store
lea addresses_D+0x197c6, %rbp
nop
nop
nop
nop
inc %r11
mov $0x5152535455565758, %r13
movq %r13, %xmm2
movups %xmm2, (%rbp)
nop
inc %rax
// Store
lea addresses_PSE+0x19fea, %r13
xor %rsi, %rsi
movb $0x51, (%r13)
nop
sub %r11, %r11
// Faulty Load
lea addresses_UC+0xcfea, %r14
nop
nop
nop
nop
nop
and $36428, %r11
movb (%r14), %r15b
lea oracles, %r11
and $0xff, %r15
shlq $12, %r15
mov (%r11,%r15,1), %r15
pop %rsi
pop %rbp
pop %rax
pop %r15
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 10}}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 3}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': True, 'same': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 9}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 9}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
Ada/gnat/ptask.adb | egustafson/sandbox | 2 | 27667 | with text_io, task_control;
use text_io, task_control;
procedure ptask is
-- y : duration := 0.0005;
package int_io is new integer_io (integer);
use int_io;
task looper is
end;
task body looper is
begin
for j in 1 .. 100 loop
put (j);
new_line;
end loop;
new_line;
put_line ("task integers complete");
new_line;
end;
task scooper is
end;
task body scooper is
begin
task_control.set_time_slice (0.001);
for k in 1..4 loop
for j in 'A'..'Z' loop
put (j);
new_line;
end loop;
new_line;
end loop;
put_line ("task letters complete");
new_line;
end;
begin -- ptask
task_control.pre_emption_on;
for x in 1000 ..1020 loop
-- task_control.set_time_slice (y);
-- y := y + y;
put(x);
new_line;
end loop;
put_line ("proc complete");
end ptask;
|
002-assembly/common-string-len.asm | dingjingmaster/learn-kernel | 0 | 1651 | .macro pushaq
push %rax
push %rcx
push %rdx
push %rbx
push %rbp
push %rsi
push %rdi
.endm # pushaq
.macro popaq
pop %rdi
pop %rsi
pop %rbp
pop %rbx
pop %rdx
pop %rcx
pop %rax
.endm # popaq
.extern print_int
.data
string: .ascii "This string has\na line break in it.\0"
.equ len, (. - string)
.text
.global _start
_start:
# 打印字符串长度应该是: 35
# FIXME:// 暂时结果错误 .......
pushaq
movq $0, %rdi
movq len(%rip), %rdi
call print_int
popaq
mov $60, %rax
xor %rdi, %rdi
syscall
.end
|
a51test/(38)ADDC_A_Rn.a51 | Aimini/51cpu | 0 | 1624 |
MOV 0xD0,#0x00
MOV R0,#0x00
MOV R1,#0x01
MOV R2,#0x02
MOV R3,#0x03
MOV R4,#0x04
MOV R5,#0x05
MOV R6,#0x06
MOV R7,#0x07
MOV 0xD0,#0x08
MOV R0,#0x08
MOV R1,#0x09
MOV R2,#0x0A
MOV R3,#0x0B
MOV R4,#0x0C
MOV R5,#0x0D
MOV R6,#0x0E
MOV R7,#0x0F
MOV 0xD0,#0x10
MOV R0,#0x10
MOV R1,#0x11
MOV R2,#0x12
MOV R3,#0x13
MOV R4,#0x14
MOV R5,#0x15
MOV R6,#0x16
MOV R7,#0x17
MOV 0xD0,#0x18
MOV R0,#0x18
MOV R1,#0x19
MOV R2,#0x1A
MOV R3,#0x1B
MOV R4,#0x1C
MOV R5,#0x1D
MOV R6,#0x1E
MOV R7,#0x1F
DB 0xA5
MOV 0xD0,#0x00
ADDC A,R0
ADDC A,R1
ADDC A,R2
ADDC A,R3
ADDC A,R4
ADDC A,R5
ADDC A,R6
ADDC A,R7
MOV 0xD0,#0x08
ADDC A,R0
ADDC A,R1
ADDC A,R2
ADDC A,R3
ADDC A,R4
ADDC A,R5
ADDC A,R6
ADDC A,R7
MOV 0xD0,#0x10
ADDC A,R0
ADDC A,R1
ADDC A,R2
ADDC A,R3
ADDC A,R4
ADDC A,R5
ADDC A,R6
ADDC A,R7
MOV 0xD0,#0x18
ADDC A,R0
ADDC A,R1
ADDC A,R2
ADDC A,R3
ADDC A,R4
ADDC A,R5
ADDC A,R6
ADDC A,R7
|
programs/oeis/134/A134567.asm | neoneye/loda | 22 | 90544 | ; A134567: a(n) = least m such that {-m*tau} < {n*tau}, where { } denotes fractional part and tau = (1 + sqrt(5))/2.
; 1,3,1,1,8,1,3,1,1,3,1,1,21,1,3,1,1,8,1,3,1,1,3,1,1,8,1,3,1,1,3,1,1,55,1,3,1,1,8,1,3,1,1,3,1,1,21,1,3,1,1,8,1,3,1,1,3,1,1,8,1,3,1,1,3,1,1,21,1,3,1,1,8,1,3,1,1,3,1,1,8,1,3,1,1,3,1,1,144,1,3,1,1,8,1,3,1,1,3,1
seq $0,283233 ; 2*A000201.
div $0,2
lpb $0
mov $1,$0
mov $2,$0
seq $2,66628 ; a(n) = n - the largest Fibonacci number <= n.
mov $0,$2
lpe
mov $0,$1
|
test/full_isa_demo_with_fp.asm | yashadhikari/ELISA | 0 | 25043 | .text
main:
j alu_tester
alu_tester:
########## ADDITION ###########
# Store immediates so we can do some math
addi $r1 $r0 1 # r1 = 1
addi $r1 $r1 2 # r1 = r1 + 2
add $r1 $r1 $r1 # r1 = r1 + r1
lw $r2 expected_add
# If the branch is taken, something went wrong!
bne $r1 $r2 logic_tester # r1 =? r2
########## SUBTRACTION ###########
addi $r3 $r0 100 # r3 = 100
sub $r3 $r3 $r2 # r3 = r3 - r2
lw $r4 expected_sub
# If the branch is taken, something went wrong!
bne $r3 $r4 logic_tester # r4 =? r1
########## ARITHMETIC SHIFT ###########
addi $r5 $r0 0xABC0 # r5 = 0xABC0 (Negative!)
sra $r5 $r5 4 # r5 = $r5 >> 4
lw $r6 expected_sra
# If the branch is taken, something went wrong!
bne $r5 $r6 logic_tester # r5 ?= r6
########## LOGICAL SHIFT & MULTIPLY ###########
addi $r7 $r0 0x7FFF # r7 = 0x7FFF (Positive)
sll $r8 $r7 8 # r8 = r7 << 8 = 0x7FFF00
mult $r7 $r8
# Expected results: 0x3fff000100
# So, we expect: HI = 0x0000003f; LO = 0xff000100
mfhi $r9
lw $r10 expected_mult_hi
bne $r9 $r10 logic_tester # If HI was wrong, skip ahead!
mflo $r11 hhh
lw $r12 expected_mult_lo
bne $r11 $r12 logic_tester # If LO was wrong, skip ahead!
########## DIVIDE ###########
addi $r13 $r0 17
addi $r14 $r0 4
div $r13 $r14
# Expected results: 17 / 4 = 4 with remainder 1
# So, we expect: HI = 1; LO = 4
mfhi $r16
addi $r17 $r0 1
mflo $r18
addi $r19 $r0 4
# If the branch is taken, something went wrong!
bne $r16 $r17 logic_tester
bne $r18 $r19 logic_tester
# If all tests pass, increment the counter!
jal correct
logic_tester:
########## AND ###########
addi $r20 $r0 0x00FF
addi $r21 $r0 0x7F00
# Expected: 0x00FF & 0x7F00 = 0
and $r22 $r20 $r21
bne $r22 $r0 load_n_store_tester
########## XORI ###########
# Expected: 0x00FF ^ 0x7F00 = 0x7FFF
xori $r23 $r20 0x7F00 # r23 = 0x00FF ^ 0x7F00
addi $r24 $r0 0x7FFF
# If the branch is taken, something went wrong!
bne $r23 $r24 load_n_store_tester
# If all tests pass, increment the counter!
jal correct
load_n_store_tester:
# Store some bytes in registers
addi $r5 $r0 0xAB
addi $r6 $r0 0xCD
addi $r7 $r0 0xEF
addi $r8 $r0 0x89
# Set some offsets
addi $r1 $r0 0
addi $r2 $r0 1
addi $r3 $r0 2
addi $r4 $r0 3
# Store the bytes in memory; line 256 is address 0x400
sb $r5 256($r1) # Address 0x1 + 0x400 = 0x400
sb $r6 256($r2) # Address 0x1 + 0x400 = 0x401
sb $r7 256($r3) # Address 0x1 + 0x400 = 0x402
sb $r8 256($r4) # Address 0x1 + 0x400 = 0x403
# Load the word: we expect it to be 0x89EFCDAB,
# since we are little endian
lw $r25 256($r0)
# Load expected value
lw $r26 expected_lw
# If the branch is taken, something went wrong!
bne $r25 $r26 floating_point_tester
jal correct
floating_point_tester:
l.s $f0 one_x # f0 = x
add.s $f0 $f0 $f0 # f0 = f0 + f0
l.s $f1 two_x # f1 = 2x
# Check if x + x == 2x
c.eq.s $f0 $f1
# If the branch is taken, something went wrong!
bc1f exit
jal correct
exit:
# Syscall to exit.
syscall
correct:
addi $r30 $r30 1
jr $ra
.data
expected_add: 6
expected_sub: 94
expected_sra: 0xFFFFFABC
expected_mult_hi: 0x0000003f
expected_mult_lo: 0xff000100
expected_lw: 0x89EFCDAB
one_x: 2.5
two_x: 5.0
|
oeis/293/A293561.asm | neoneye/loda-programs | 11 | 3461 | <reponame>neoneye/loda-programs
; A293561: Column 3 of A142249.
; Submitted by <NAME>
; 3,19,80,286,945,2997,9294,28456,86471,261559,788892,2375010,7141581,21457705,64438874,193447948,580606275,1742343435,5228079240,15686335270,47063200553,141197990749,423610749990,1270865804976,3812664524415,11438127791647,34314651811124,102944492305066,308834550657861,926505799458129,2779521693342642,8338573669963540,25015738189760891,75047248929022195,225141815506544544,675425583958588398,2026277026753673505,6078831630016835845,18236495989562136830,54709490167709667640,164128474901175515703
mov $3,2
mov $5,$0
lpb $3
mov $0,$5
sub $3,1
add $0,$3
trn $0,1
seq $0,112495 ; Third column of triangle A112493 used for e.g.f.s of Stirling2 diagonals.
mov $2,$3
mul $2,$0
add $4,$2
lpe
min $5,1
mul $5,2
mul $5,$0
mov $0,$4
sub $0,$5
|
_incObj/43 Roller.asm | kodishmediacenter/msu-md-sonic | 9 | 12676 | <filename>_incObj/43 Roller.asm
; ---------------------------------------------------------------------------
; Object 43 - Roller enemy (SYZ)
; ---------------------------------------------------------------------------
Roller:
moveq #0,d0
move.b obRoutine(a0),d0
move.w Roll_Index(pc,d0.w),d1
jmp Roll_Index(pc,d1.w)
; ===========================================================================
Roll_Index: dc.w Roll_Main-Roll_Index
dc.w Roll_Action-Roll_Index
; ===========================================================================
Roll_Main: ; Routine 0
move.b #$E,obHeight(a0)
move.b #8,obWidth(a0)
bsr.w ObjectFall
bsr.w ObjFloorDist
tst.w d1
bpl.s locret_E052
add.w d1,obY(a0) ; match roller's position with the floor
move.w #0,obVelY(a0)
addq.b #2,obRoutine(a0)
move.l #Map_Roll,obMap(a0)
move.w #$4B8,obGfx(a0)
move.b #4,obRender(a0)
move.b #4,obPriority(a0)
move.b #$10,obActWid(a0)
locret_E052:
rts
; ===========================================================================
Roll_Action: ; Routine 2
moveq #0,d0
move.b ob2ndRout(a0),d0
move.w Roll_Index2(pc,d0.w),d1
jsr Roll_Index2(pc,d1.w)
lea (Ani_Roll).l,a1
bsr.w AnimateSprite
move.w obX(a0),d0
andi.w #$FF80,d0
move.w (v_screenposx).w,d1
subi.w #$80,d1
andi.w #$FF80,d1
sub.w d1,d0
cmpi.w #$280,d0
bgt.w Roll_ChkGone
bra.w DisplaySprite
; ===========================================================================
Roll_ChkGone:
lea (v_objstate).w,a2
moveq #0,d0
move.b obRespawnNo(a0),d0
beq.s Roll_Delete
bclr #7,2(a2,d0.w)
Roll_Delete:
bra.w DeleteObject
; ===========================================================================
Roll_Index2: dc.w Roll_RollChk-Roll_Index2
dc.w Roll_RollNoChk-Roll_Index2
dc.w Roll_ChkJump-Roll_Index2
dc.w Roll_MatchFloor-Roll_Index2
; ===========================================================================
Roll_RollChk:
move.w (v_player+obX).w,d0
subi.w #$100,d0
bcs.s loc_E0D2
sub.w obX(a0),d0 ; check distance between Roller and Sonic
bcs.s loc_E0D2
addq.b #4,ob2ndRout(a0)
move.b #2,obAnim(a0)
move.w #$700,obVelX(a0) ; move Roller horizontally
move.b #$8E,obColType(a0) ; make Roller invincible
loc_E0D2:
addq.l #4,sp
rts
; ===========================================================================
Roll_RollNoChk:
cmpi.b #2,obAnim(a0)
beq.s loc_E0F8
subq.w #1,$30(a0)
bpl.s locret_E0F6
move.b #1,obAnim(a0)
move.w #$700,obVelX(a0)
move.b #$8E,obColType(a0)
locret_E0F6:
rts
; ===========================================================================
loc_E0F8:
addq.b #2,ob2ndRout(a0)
rts
; ===========================================================================
Roll_ChkJump:
bsr.w Roll_Stop
bsr.w SpeedToPos
bsr.w ObjFloorDist
cmpi.w #-8,d1
blt.s Roll_Jump
cmpi.w #$C,d1
bge.s Roll_Jump
add.w d1,obY(a0)
rts
; ===========================================================================
Roll_Jump:
addq.b #2,ob2ndRout(a0)
bset #0,$32(a0)
beq.s locret_E12E
move.w #-$600,obVelY(a0) ; move Roller vertically
locret_E12E:
rts
; ===========================================================================
Roll_MatchFloor:
bsr.w ObjectFall
tst.w obVelY(a0)
bmi.s locret_E150
bsr.w ObjFloorDist
tst.w d1
bpl.s locret_E150
add.w d1,obY(a0) ; match Roller's position with the floor
subq.b #2,ob2ndRout(a0)
move.w #0,obVelY(a0)
locret_E150:
rts
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
Roll_Stop:
tst.b $32(a0)
bmi.s locret_E188
move.w (v_player+obX).w,d0
subi.w #$30,d0
sub.w obX(a0),d0
bcc.s locret_E188
move.b #0,obAnim(a0)
move.b #$E,obColType(a0)
clr.w obVelX(a0)
move.w #120,$30(a0) ; set waiting time to 2 seconds
move.b #2,ob2ndRout(a0)
bset #7,$32(a0)
locret_E188:
rts
; End of function Roll_Stop
|
src/SlimShader.Tests/Shaders/Sdk/Direct3D11/BasicCompute11/BasicCompute11_Structured.asm | tgjones/slimshader | 125 | 160215 | <filename>src/SlimShader.Tests/Shaders/Sdk/Direct3D11/BasicCompute11/BasicCompute11_Structured.asm
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20714
//
//
///
// Buffer Definitions:
//
// Resource bind info for Buffer0
// {
//
// struct BufType
// {
//
// int i; // Offset: 0
// float f; // Offset: 4
//
// } $Element; // Offset: 0 Size: 8
//
// }
//
// Resource bind info for Buffer1
// {
//
// struct BufType
// {
//
// int i; // Offset: 0
// float f; // Offset: 4
//
// } $Element; // Offset: 0 Size: 8
//
// }
//
// Resource bind info for BufferOut
// {
//
// struct BufType
// {
//
// int i; // Offset: 0
// float f; // Offset: 4
//
// } $Element; // Offset: 0 Size: 8
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// Buffer0 texture struct r/o 0 1
// Buffer1 texture struct r/o 1 1
// BufferOut UAV struct r/w 0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Input
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Output
cs_5_0
dcl_globalFlags refactoringAllowed
dcl_resource_structured t0, 8
dcl_resource_structured t1, 8
dcl_uav_structured u0, 8
dcl_input vThreadID.x
dcl_temps 2
dcl_thread_group 1, 1, 1
ld_structured_indexable(structured_buffer, stride=8)(mixed,mixed,mixed,mixed) r0.xy, vThreadID.x, l(0), t0.xyxx
ld_structured_indexable(structured_buffer, stride=8)(mixed,mixed,mixed,mixed) r0.zw, vThreadID.x, l(0), t1.xxxy
iadd r1.x, r0.z, r0.x
add r1.y, r0.w, r0.y
store_structured u0.xy, vThreadID.x, l(0), r1.xyxx
ret
// Approximately 6 instruction slots used
|
test/container/test_container-write.ads | skill-lang/skillAdaTestSuite | 1 | 29517 | with Ada.Directories;
with Ahven.Framework;
with Container.Api;
with Ada.Text_IO;
package Test_Container.Write is
package Skill renames Container.Api;
use Container;
use Container.Api;
type Test is new Ahven.Framework.Test_Case with null record;
procedure Initialize (T : in out Test);
procedure Set_Up (T : in out Test);
procedure Tear_Down (T : in out Test);
procedure Constant_Length_Array (T : in out Ahven.Framework.Test_Case'Class);
procedure Variable_Length_Array (T : in out Ahven.Framework.Test_Case'Class);
procedure List (T : in out Ahven.Framework.Test_Case'Class);
procedure Set (T : in out Ahven.Framework.Test_Case'Class);
procedure Map (T : in out Ahven.Framework.Test_Case'Class);
end Test_Container.Write;
|
asm/hello2.asm | yoshitsugu/hariboteos_in_rust | 29 | 242661 | [BITS 32]
MOV EDX,2
MOV EBX,msg
INT 0x40
MOV EDX,4
INT 0x40
msg:
DB "hello",0
|
source/types/adam-a_type-access_type.adb | charlie5/aIDE | 3 | 15055 | with
AdaM.Factory;
package body AdaM.a_Type.access_type
is
-- Storage Pool
--
record_Version : constant := 1;
pool_Size : constant := 5_000;
package Pool is new AdaM.Factory.Pools (storage_Folder => ".adam-store",
pool_Name => "access_Types",
max_Items => pool_Size,
record_Version => record_Version,
Item => a_Type.access_type.item,
View => a_Type.access_type.view);
-- Forge
--
procedure define (Self : in out Item; is_access_to_Object : in Boolean)
is
the_Definition : Definition (is_access_to_Object);
begin
if is_access_to_Object
then
the_Definition.Indication := AdaM.subtype_Indication.new_Indication;
else
the_Definition.Subprogram := AdaM.Subprogram.new_Subprogram (Name => "");
end if;
Self.Def := the_Definition;
end define;
procedure destruct (Self : in out Item)
is
begin
null;
end destruct;
function new_Type (is_access_to_Object : in Boolean) return access_Type.view
is
new_View : constant access_Type.view := Pool.new_Item;
begin
define (a_Type.access_type.item (new_View.all),
is_access_to_Object);
return new_View;
end new_Type;
procedure free (Self : in out access_Type.view)
is
begin
destruct (access_Type.item (Self.all));
Pool.free (Self);
end free;
-- Attributes
--
overriding function Id (Self : access Item) return AdaM.Id
is
begin
return Pool.to_Id (Self);
end Id;
-- overriding
-- function Name (Self : in Item) return Identifier
-- is
-- pragma Unreferenced (Self);
-- begin
-- return "";
-- end Name;
overriding
function to_Source (Self : in Item) return text_Vectors.Vector
is
pragma Unreferenced (Self);
the_Source : text_Vectors.Vector;
begin
raise Program_Error with "TODO";
return the_Source;
end to_Source;
function has_not_Null (Self : in Item) return Boolean
is
begin
return Self.has_not_Null;
end has_not_Null;
procedure has_not_Null (Self : in out Item; Now : in Boolean := True)
is
begin
Self.has_not_Null := Now;
end has_not_Null;
function is_access_to_Object (Self : in Item) return Boolean
is
begin
return Self.Def.is_access_to_Object;
end is_access_to_Object;
--- Access to Object
--
function Modifier (Self : in Item) return general_access_Modifier
is
begin
return Self.Def.Modifier;
end Modifier;
procedure Modifier_is (Self : in out Item; Now : in general_access_Modifier)
is
begin
Self.Def.Modifier := Now;
end Modifier_is;
function Indication (Self : in Item) return subtype_Indication.view
is
begin
return Self.Def.Indication;
end Indication;
--- Access to Subprogram.
--
function is_Protected (Self : in Item) return Boolean
is
begin
return Self.Def.is_Protected;
end is_Protected;
procedure is_Protected (Self : in out Item; Now : in Boolean := True)
is
begin
Self.Def.is_Protected := Now;
end is_Protected;
function Subprogram (Self : in Item) return AdaM.Subprogram.view
is
begin
return Self.Def.Subprogram;
end Subprogram;
----------
-- Streams
--
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View)
renames Pool.View_write;
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View)
renames Pool.View_read;
end AdaM.a_Type.access_type;
|
oeis/220/A220694.asm | neoneye/loda-programs | 11 | 173885 | <reponame>neoneye/loda-programs<filename>oeis/220/A220694.asm
; A220694: Irregular table: row n (n>=1) consists of numbers 1..A084556(n).
; Submitted by <NAME>(s3)
; 1,1,2,1,2,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1
mov $2,$0
lpb $0
add $3,1
div $0,$3
sub $0,$3
lpe
add $2,1
add $3,1
mod $2,$3
mov $0,$2
add $0,1
|
Ada/src/Problem_25.adb | Tim-Tom/project-euler | 0 | 380 | <reponame>Tim-Tom/project-euler<filename>Ada/src/Problem_25.adb<gh_stars>0
with Ada.Text_IO;
with BigInteger; use BigInteger;
package body Problem_25 is
package IO renames Ada.Text_IO;
procedure Solve is
term : Positive := 3;
n : BigInt := BigInteger.Create(2);
n_1 : BigInt := BigInteger.Create(1);
n_2 : BigInt := BigInteger.Create(1);
begin
while Magnitude(n) < 1_000 loop
term := term + 1;
n_2 := n_1;
n_1 := n;
n := n_1 + n_2;
end loop;
IO.Put_Line(Positive'Image(term));
end Solve;
end Problem_25;
|
test/interaction/Issue3095-fail.agda | alhassy/agda | 1 | 7655 | <filename>test/interaction/Issue3095-fail.agda
-- Andreas, 2018-05-28, issue #3095, fail on attempt to make hidden parent variable visible
data Nat : Set where
suc : {n : Nat} → Nat
data IsSuc : Nat → Set where
isSuc : ∀{n} → IsSuc (suc {n})
test : ∀{m} → IsSuc m → Set
test p = aux p
where
aux : ∀{n} → IsSuc n → Set
aux isSuc = {!.m!} -- Split on .m here
-- Context:
-- p : IsSuc .m
-- .m : Nat
-- .n : Nat
-- Expected error:
-- Cannot split on module parameter .m
-- when checking that the expression ? has type Set
|
oeis/165/A165186.asm | neoneye/loda-programs | 11 | 1828 | <reponame>neoneye/loda-programs<filename>oeis/165/A165186.asm
; A165186: a(n) = Sum_{k=1..n} (k*(n-k) mod n).
; Submitted by <NAME>(s4)
; 0,1,4,6,10,17,28,36,30,45,66,82,78,105,140,136,136,141,190,230,238,253,322,380,250,325,360,434,406,505,558,592,572,561,700,678,666,741,910,980,820,917,946,1122,1050,1173,1316,1432,1078,1125,1394,1430,1378,1449
add $0,1
mov $2,$0
mul $0,2
lpb $0
sub $0,1
add $3,$0
sub $0,1
mod $3,$2
add $1,$3
lpe
mov $0,$1
|
Task/Linear-congruential-generator/Ada/linear-congruential-generator-2.ada | LaudateCorpus1/RosettaCodeData | 1 | 7599 | <gh_stars>1-10
package body LCG is
State: Base_Type := Base_Type'First;
procedure Initialize(Seed: Base_Type) is
begin
State := Seed;
end Initialize;
function Random return Base_Type is
begin
State := State * Multiplyer + Adder;
return State / Output_Divisor;
end Random;
end LCG;
|
ioq3/build/release-js-js/baseq3/game/g_session.asm | RawTechnique/quake-port | 1 | 89048 | export G_WriteClientSessionData
code
proc G_WriteClientSessionData 20 32
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRGP4 $54
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
ARGI4
ADDRFP4 0
INDIRP4
CNSTI4 620
ADDP4
INDIRI4
ARGI4
ADDRFP4 0
INDIRP4
CNSTI4 624
ADDP4
INDIRI4
ARGI4
ADDRFP4 0
INDIRP4
CNSTI4 628
ADDP4
INDIRI4
ARGI4
ADDRFP4 0
INDIRP4
CNSTI4 632
ADDP4
INDIRI4
ARGI4
ADDRFP4 0
INDIRP4
CNSTI4 636
ADDP4
INDIRI4
ARGI4
ADDRFP4 0
INDIRP4
CNSTI4 640
ADDP4
INDIRI4
ARGI4
ADDRLP4 12
ADDRGP4 va
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 12
INDIRP4
ASGNP4
ADDRGP4 $55
ARGP4
ADDRFP4 0
INDIRP4
CVPU4 4
ADDRGP4 level
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
CNSTI4 776
DIVI4
ARGI4
ADDRLP4 16
ADDRGP4 va
CALLP4
ASGNP4
ADDRLP4 4
ADDRLP4 16
INDIRP4
ASGNP4
ADDRLP4 4
INDIRP4
ARGP4
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 trap_Cvar_Set
CALLV
pop
LABELV $53
endproc G_WriteClientSessionData 20 32
export G_ReadSessionData
proc G_ReadSessionData 1048 36
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRGP4 $55
ARGP4
ADDRFP4 0
INDIRP4
CVPU4 4
ADDRGP4 level
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
CNSTI4 776
DIVI4
ARGI4
ADDRLP4 1040
ADDRGP4 va
CALLP4
ASGNP4
ADDRLP4 1024
ADDRLP4 1040
INDIRP4
ASGNP4
ADDRLP4 1024
INDIRP4
ARGP4
ADDRLP4 0
ARGP4
CNSTI4 1024
ARGI4
ADDRGP4 trap_Cvar_VariableStringBuffer
CALLV
pop
ADDRLP4 0
ARGP4
ADDRGP4 $54
ARGP4
ADDRLP4 1036
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 620
ADDP4
ARGP4
ADDRLP4 1032
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 628
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 632
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 636
ADDP4
ARGP4
ADDRLP4 1028
ARGP4
ADDRGP4 qk_sscanf
CALLI4
pop
ADDRFP4 0
INDIRP4
CNSTI4 616
ADDP4
ADDRLP4 1036
INDIRI4
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 624
ADDP4
ADDRLP4 1032
INDIRI4
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 640
ADDP4
ADDRLP4 1028
INDIRI4
ASGNI4
LABELV $56
endproc G_ReadSessionData 1048 36
export G_InitSessionData
proc G_InitSessionData 16 8
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 0
ADDRFP4 0
INDIRP4
CNSTI4 616
ADDP4
ASGNP4
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 3
LTI4 $58
ADDRLP4 8
CNSTI4 0
ASGNI4
ADDRGP4 g_teamAutoJoin+12
INDIRI4
ADDRLP4 8
INDIRI4
EQI4 $61
CNSTI4 804
ADDRFP4 0
INDIRP4
CVPU4 4
ADDRGP4 level
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
CNSTI4 776
DIVI4
MULI4
ADDRGP4 g_entities+208+216
ADDP4
INDIRI4
CNSTI4 8
BANDI4
ADDRLP4 8
INDIRI4
NEI4 $61
CNSTI4 -1
ARGI4
ADDRLP4 12
ADDRGP4 PickTeam
CALLI4
ASGNI4
ADDRLP4 0
INDIRP4
ADDRLP4 12
INDIRI4
ASGNI4
ADDRFP4 0
INDIRP4
ARGP4
CNSTI4 -1
ARGI4
ADDRGP4 BroadcastTeamChange
CALLV
pop
ADDRGP4 $59
JUMPV
LABELV $61
ADDRLP4 0
INDIRP4
CNSTI4 3
ASGNI4
ADDRGP4 $59
JUMPV
LABELV $58
ADDRFP4 4
INDIRP4
ARGP4
ADDRGP4 $66
ARGP4
ADDRLP4 8
ADDRGP4 Info_ValueForKey
CALLP4
ASGNP4
ADDRLP4 4
ADDRLP4 8
INDIRP4
ASGNP4
ADDRLP4 4
INDIRP4
INDIRI1
CVII4 1
CNSTI4 115
NEI4 $67
ADDRLP4 0
INDIRP4
CNSTI4 3
ASGNI4
ADDRGP4 $68
JUMPV
LABELV $67
ADDRLP4 12
ADDRGP4 g_gametype+12
INDIRI4
ASGNI4
ADDRLP4 12
INDIRI4
CNSTI4 0
EQI4 $72
ADDRLP4 12
INDIRI4
CNSTI4 1
EQI4 $78
ADDRLP4 12
INDIRI4
CNSTI4 2
EQI4 $72
ADDRGP4 $69
JUMPV
LABELV $69
LABELV $72
ADDRGP4 g_maxGameClients+12
INDIRI4
CNSTI4 0
LEI4 $73
ADDRGP4 level+76
INDIRI4
ADDRGP4 g_maxGameClients+12
INDIRI4
LTI4 $73
ADDRLP4 0
INDIRP4
CNSTI4 3
ASGNI4
ADDRGP4 $70
JUMPV
LABELV $73
ADDRLP4 0
INDIRP4
CNSTI4 0
ASGNI4
ADDRGP4 $70
JUMPV
LABELV $78
ADDRGP4 level+76
INDIRI4
CNSTI4 2
LTI4 $79
ADDRLP4 0
INDIRP4
CNSTI4 3
ASGNI4
ADDRGP4 $70
JUMPV
LABELV $79
ADDRLP4 0
INDIRP4
CNSTI4 0
ASGNI4
LABELV $70
LABELV $68
LABELV $59
ADDRLP4 0
INDIRP4
CNSTI4 8
ADDP4
CNSTI4 1
ASGNI4
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 AddTournamentQueue
CALLV
pop
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 G_WriteClientSessionData
CALLV
pop
LABELV $57
endproc G_InitSessionData 16 8
export G_InitWorldSession
proc G_InitWorldSession 1032 12
ADDRGP4 $83
ARGP4
ADDRLP4 0
ARGP4
CNSTI4 1024
ARGI4
ADDRGP4 trap_Cvar_VariableStringBuffer
CALLV
pop
ADDRLP4 0
ARGP4
ADDRLP4 1028
ADDRGP4 qk_atoi
CALLI4
ASGNI4
ADDRLP4 1024
ADDRLP4 1028
INDIRI4
ASGNI4
ADDRGP4 g_gametype+12
INDIRI4
ADDRLP4 1024
INDIRI4
EQI4 $84
ADDRGP4 level+64
CNSTI4 1
ASGNI4
ADDRGP4 $88
ARGP4
ADDRGP4 G_Printf
CALLV
pop
LABELV $84
LABELV $82
endproc G_InitWorldSession 1032 12
export G_WriteSessionData
proc G_WriteSessionData 8 8
ADDRGP4 $90
ARGP4
ADDRGP4 g_gametype+12
INDIRI4
ARGI4
ADDRLP4 4
ADDRGP4 va
CALLP4
ASGNP4
ADDRGP4 $83
ARGP4
ADDRLP4 4
INDIRP4
ARGP4
ADDRGP4 trap_Cvar_Set
CALLV
pop
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $95
JUMPV
LABELV $92
CNSTI4 776
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
NEI4 $97
CNSTI4 776
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
ARGP4
ADDRGP4 G_WriteClientSessionData
CALLV
pop
LABELV $97
LABELV $93
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $95
ADDRLP4 0
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $92
LABELV $89
endproc G_WriteSessionData 8 8
import trap_SnapVector
import trap_GeneticParentsAndChildSelection
import trap_BotResetWeaponState
import trap_BotFreeWeaponState
import trap_BotAllocWeaponState
import trap_BotLoadWeaponWeights
import trap_BotGetWeaponInfo
import trap_BotChooseBestFightWeapon
import trap_BotAddAvoidSpot
import trap_BotInitMoveState
import trap_BotFreeMoveState
import trap_BotAllocMoveState
import trap_BotPredictVisiblePosition
import trap_BotMovementViewTarget
import trap_BotReachabilityArea
import trap_BotResetLastAvoidReach
import trap_BotResetAvoidReach
import trap_BotMoveInDirection
import trap_BotMoveToGoal
import trap_BotResetMoveState
import trap_BotFreeGoalState
import trap_BotAllocGoalState
import trap_BotMutateGoalFuzzyLogic
import trap_BotSaveGoalFuzzyLogic
import trap_BotInterbreedGoalFuzzyLogic
import trap_BotFreeItemWeights
import trap_BotLoadItemWeights
import trap_BotUpdateEntityItems
import trap_BotInitLevelItems
import trap_BotSetAvoidGoalTime
import trap_BotAvoidGoalTime
import trap_BotGetLevelItemGoal
import trap_BotGetMapLocationGoal
import trap_BotGetNextCampSpotGoal
import trap_BotItemGoalInVisButNotVisible
import trap_BotTouchingGoal
import trap_BotChooseNBGItem
import trap_BotChooseLTGItem
import trap_BotGetSecondGoal
import trap_BotGetTopGoal
import trap_BotGoalName
import trap_BotDumpGoalStack
import trap_BotDumpAvoidGoals
import trap_BotEmptyGoalStack
import trap_BotPopGoal
import trap_BotPushGoal
import trap_BotResetAvoidGoals
import trap_BotRemoveFromAvoidGoals
import trap_BotResetGoalState
import trap_BotSetChatName
import trap_BotSetChatGender
import trap_BotLoadChatFile
import trap_BotReplaceSynonyms
import trap_UnifyWhiteSpaces
import trap_BotMatchVariable
import trap_BotFindMatch
import trap_StringContains
import trap_BotGetChatMessage
import trap_BotEnterChat
import trap_BotChatLength
import trap_BotReplyChat
import trap_BotNumInitialChats
import trap_BotInitialChat
import trap_BotNumConsoleMessages
import trap_BotNextConsoleMessage
import trap_BotRemoveConsoleMessage
import trap_BotQueueConsoleMessage
import trap_BotFreeChatState
import trap_BotAllocChatState
import trap_Characteristic_String
import trap_Characteristic_BInteger
import trap_Characteristic_Integer
import trap_Characteristic_BFloat
import trap_Characteristic_Float
import trap_BotFreeCharacter
import trap_BotLoadCharacter
import trap_EA_ResetInput
import trap_EA_GetInput
import trap_EA_EndRegular
import trap_EA_View
import trap_EA_Move
import trap_EA_DelayedJump
import trap_EA_Jump
import trap_EA_SelectWeapon
import trap_EA_MoveRight
import trap_EA_MoveLeft
import trap_EA_MoveBack
import trap_EA_MoveForward
import trap_EA_MoveDown
import trap_EA_MoveUp
import trap_EA_Crouch
import trap_EA_Respawn
import trap_EA_Use
import trap_EA_Attack
import trap_EA_Talk
import trap_EA_Gesture
import trap_EA_Action
import trap_EA_Command
import trap_EA_SayTeam
import trap_EA_Say
import trap_AAS_PredictClientMovement
import trap_AAS_Swimming
import trap_AAS_AlternativeRouteGoals
import trap_AAS_PredictRoute
import trap_AAS_EnableRoutingArea
import trap_AAS_AreaTravelTimeToGoalArea
import trap_AAS_AreaReachability
import trap_AAS_IntForBSPEpairKey
import trap_AAS_FloatForBSPEpairKey
import trap_AAS_VectorForBSPEpairKey
import trap_AAS_ValueForBSPEpairKey
import trap_AAS_NextBSPEntity
import trap_AAS_PointContents
import trap_AAS_TraceAreas
import trap_AAS_PointReachabilityAreaIndex
import trap_AAS_PointAreaNum
import trap_AAS_Time
import trap_AAS_PresenceTypeBoundingBox
import trap_AAS_Initialized
import trap_AAS_EntityInfo
import trap_AAS_AreaInfo
import trap_AAS_BBoxAreas
import trap_BotUserCommand
import trap_BotGetServerCommand
import trap_BotGetSnapshotEntity
import trap_BotLibTest
import trap_BotLibUpdateEntity
import trap_BotLibLoadMap
import trap_BotLibStartFrame
import trap_BotLibDefine
import trap_BotLibVarGet
import trap_BotLibVarSet
import trap_BotLibShutdown
import trap_BotLibSetup
import trap_DebugPolygonDelete
import trap_DebugPolygonCreate
import trap_GetEntityToken
import trap_GetUsercmd
import trap_BotFreeClient
import trap_BotAllocateClient
import trap_EntityContact
import trap_EntitiesInBox
import trap_UnlinkEntity
import trap_LinkEntity
import trap_AreasConnected
import trap_AdjustAreaPortalState
import trap_InPVSIgnorePortals
import trap_InPVS
import trap_PointContents
import trap_Trace
import trap_SetBrushModel
import trap_GetServerinfo
import trap_SetUserinfo
import trap_GetUserinfo
import trap_GetConfigstring
import trap_SetConfigstring
import trap_SendServerCommand
import trap_DropClient
import trap_LocateGameData
import trap_Cvar_VariableStringBuffer
import trap_Cvar_VariableValue
import trap_Cvar_VariableIntegerValue
import trap_Cvar_Set
import trap_Cvar_Update
import trap_Cvar_Register
import trap_SendConsoleCommand
import trap_FS_Seek
import trap_FS_GetFileList
import trap_FS_FCloseFile
import trap_FS_Write
import trap_FS_Read
import trap_FS_FOpenFile
import trap_Args
import trap_Argv
import trap_Argc
import trap_RealTime
import trap_Milliseconds
import trap_Error
import trap_Print
import g_proxMineTimeout
import g_singlePlayer
import g_enableBreath
import g_enableDust
import g_rankings
import pmove_msec
import pmove_fixed
import g_smoothClients
import g_blueteam
import g_redteam
import g_cubeTimeout
import g_obeliskRespawnDelay
import g_obeliskRegenAmount
import g_obeliskRegenPeriod
import g_obeliskHealth
import g_filterBan
import g_banIPs
import g_teamForceBalance
import g_teamAutoJoin
import g_allowVote
import g_blood
import g_doWarmup
import g_warmup
import g_motd
import g_synchronousClients
import g_weaponTeamRespawn
import g_weaponRespawn
import g_debugDamage
import g_debugAlloc
import g_debugMove
import g_inactivity
import g_forcerespawn
import g_quadfactor
import g_knockback
import g_speed
import g_gravity
import g_needpass
import g_password
import g_friendlyFire
import g_capturelimit
import g_timelimit
import g_fraglimit
import g_dmflags
import g_restarted
import g_maxGameClients
import g_maxclients
import g_cheats
import g_dedicated
import g_gametype
import g_entities
import level
import Pickup_Team
import CheckTeamStatus
import TeamplayInfoMessage
import Team_GetLocationMsg
import Team_GetLocation
import SelectCTFSpawnPoint
import Team_FreeEntity
import Team_ReturnFlag
import Team_InitGame
import Team_CheckHurtCarrier
import Team_FragBonuses
import Team_DroppedFlagThink
import AddTeamScore
import TeamColorString
import TeamName
import OtherTeam
import BotTestAAS
import BotAIStartFrame
import BotAIShutdownClient
import BotAISetupClient
import BotAILoadMap
import BotAIShutdown
import BotAISetup
import BotInterbreedEndMatch
import Svcmd_BotList_f
import Svcmd_AddBot_f
import G_BotConnect
import G_RemoveQueuedBotBegin
import G_CheckBotSpawn
import G_GetBotInfoByName
import G_GetBotInfoByNumber
import G_InitBots
import Svcmd_AbortPodium_f
import SpawnModelsOnVictoryPads
import UpdateTournamentInfo
import Svcmd_GameMem_f
import G_InitMemory
import G_Alloc
import CheckObeliskAttack
import Team_CheckDroppedItem
import OnSameTeam
import G_RunClient
import ClientEndFrame
import ClientThink
import ClientCommand
import ClientBegin
import ClientDisconnect
import ClientUserinfoChanged
import ClientConnect
import G_Error
import G_Printf
import SendScoreboardMessageToAllClients
import G_LogPrintf
import AddTournamentQueue
import G_RunThink
import CheckTeamLeader
import SetLeader
import FindIntermissionPoint
import MoveClientToIntermission
import DeathmatchScoreboardMessage
import FireWeapon
import G_FilterPacket
import G_ProcessIPBans
import ConsoleCommand
import SpotWouldTelefrag
import CalculateRanks
import AddScore
import player_die
import ClientSpawn
import InitBodyQue
import BeginIntermission
import ClientRespawn
import CopyToBodyQue
import SelectSpawnPoint
import SetClientViewAngle
import PickTeam
import TeamLeader
import TeamCount
import Weapon_HookThink
import Weapon_HookFree
import CheckGauntletAttack
import SnapVectorTowards
import CalcMuzzlePoint
import LogAccuracyHit
import TeleportPlayer
import trigger_teleporter_touch
import Touch_DoorTrigger
import G_RunMover
import fire_grapple
import fire_bfg
import fire_rocket
import fire_grenade
import fire_plasma
import G_RunMissile
import TossClientCubes
import TossClientItems
import body_die
import G_InvulnerabilityEffect
import G_RadiusDamage
import G_Damage
import CanDamage
import BuildShaderStateConfig
import AddRemap
import G_SetOrigin
import G_AddEvent
import G_AddPredictableEvent
import vectoyaw
import vtos
import tv
import G_TouchTriggers
import G_EntitiesFree
import G_FreeEntity
import G_Sound
import G_TempEntity
import G_Spawn
import G_InitGentity
import G_SetMovedir
import G_UseTargets
import G_PickTarget
import G_Find
import G_KillBox
import G_TeamCommand
import G_SoundIndex
import G_ModelIndex
import SaveRegisteredItems
import RegisterItem
import ClearRegisteredItems
import Touch_Item
import Add_Ammo
import ArmorIndex
import Think_Weapon
import FinishSpawningItem
import G_SpawnItem
import SetRespawn
import LaunchItem
import Drop_Item
import PrecacheItem
import UseHoldableItem
import RespawnItem
import G_RunItem
import G_CheckTeamItems
import Cmd_FollowCycle_f
import SetTeam
import BroadcastTeamChange
import StopFollowing
import Cmd_Score_f
import G_NewString
import G_SpawnEntitiesFromString
import G_SpawnVector
import G_SpawnInt
import G_SpawnFloat
import G_SpawnString
import BG_PlayerTouchesItem
import BG_PlayerStateToEntityStateExtraPolate
import BG_PlayerStateToEntityState
import BG_TouchJumpPad
import BG_AddPredictableEventToPlayerstate
import BG_EvaluateTrajectoryDelta
import BG_EvaluateTrajectory
import BG_CanItemBeGrabbed
import BG_FindItemForHoldable
import BG_FindItemForPowerup
import BG_FindItemForWeapon
import BG_FindItem
import bg_numItems
import bg_itemlist
import Pmove
import PM_UpdateViewAngles
import Com_Printf
import Com_Error
import Info_NextPair
import Info_Validate
import Info_SetValueForKey_Big
import Info_SetValueForKey
import Info_RemoveKey_Big
import Info_RemoveKey
import Info_ValueForKey
import Com_TruncateLongString
import va
import Q_CountChar
import Q_CleanStr
import Q_PrintStrlen
import Q_strcat
import Q_strncpyz
import Q_stristr
import Q_strupr
import Q_strlwr
import Q_stricmpn
import Q_strncmp
import Q_stricmp
import Q_isintegral
import Q_isanumber
import Q_isalpha
import Q_isupper
import Q_islower
import Q_isprint
import Com_RandomBytes
import Com_SkipCharset
import Com_SkipTokens
import Com_sprintf
import Com_HexStrToInt
import Parse3DMatrix
import Parse2DMatrix
import Parse1DMatrix
import SkipRestOfLine
import SkipBracedSection
import COM_MatchToken
import COM_ParseWarning
import COM_ParseError
import COM_Compress
import COM_ParseExt
import COM_Parse
import COM_GetCurrentParseLine
import COM_BeginParseSession
import COM_DefaultExtension
import COM_CompareExtension
import COM_StripExtension
import COM_GetExtension
import COM_SkipPath
import Com_Clamp
import PerpendicularVector
import AngleVectors
import MatrixMultiply
import MakeNormalVectors
import RotateAroundDirection
import RotatePointAroundVector
import ProjectPointOnPlane
import PlaneFromPoints
import AngleDelta
import AngleNormalize180
import AngleNormalize360
import AnglesSubtract
import AngleSubtract
import LerpAngle
import AngleMod
import BoundsIntersectPoint
import BoundsIntersectSphere
import BoundsIntersect
import BoxOnPlaneSide
import SetPlaneSignbits
import AxisCopy
import AxisClear
import AnglesToAxis
import vectoangles
import Q_crandom
import Q_random
import Q_rand
import Q_acos
import Q_log2
import VectorRotate
import Vector4Scale
import VectorNormalize2
import VectorNormalize
import CrossProduct
import VectorInverse
import VectorNormalizeFast
import DistanceSquared
import Distance
import VectorLengthSquared
import VectorLength
import VectorCompare
import AddPointToBounds
import ClearBounds
import RadiusFromBounds
import NormalizeColor
import ColorBytes4
import ColorBytes3
import _VectorMA
import _VectorScale
import _VectorCopy
import _VectorAdd
import _VectorSubtract
import _DotProduct
import ByteToDir
import DirToByte
import ClampShort
import ClampChar
import Q_rsqrt
import Q_fabs
import Q_isnan
import axisDefault
import vec3_origin
import g_color_table
import colorDkGrey
import colorMdGrey
import colorLtGrey
import colorWhite
import colorCyan
import colorMagenta
import colorYellow
import colorBlue
import colorGreen
import colorRed
import colorBlack
import bytedirs
import Hunk_AllocDebug
import FloatSwap
import LongSwap
import ShortSwap
import CopyLongSwap
import CopyShortSwap
import qk_acos
import qk_fabs
import qk_abs
import qk_tan
import qk_atan2
import qk_cos
import qk_sin
import qk_sqrt
import qk_floor
import qk_ceil
import qk_memcpy
import qk_memset
import qk_memmove
import qk_sscanf
import qk_vsnprintf
import qk_strtol
import qk_atoi
import qk_strtod
import qk_atof
import qk_toupper
import qk_tolower
import qk_strncpy
import qk_strstr
import qk_strrchr
import qk_strchr
import qk_strcmp
import qk_strcpy
import qk_strcat
import qk_strlen
import qk_rand
import qk_srand
import qk_qsort
lit
align 1
LABELV $90
byte 1 37
byte 1 105
byte 1 0
align 1
LABELV $88
byte 1 71
byte 1 97
byte 1 109
byte 1 101
byte 1 116
byte 1 121
byte 1 112
byte 1 101
byte 1 32
byte 1 99
byte 1 104
byte 1 97
byte 1 110
byte 1 103
byte 1 101
byte 1 100
byte 1 44
byte 1 32
byte 1 99
byte 1 108
byte 1 101
byte 1 97
byte 1 114
byte 1 105
byte 1 110
byte 1 103
byte 1 32
byte 1 115
byte 1 101
byte 1 115
byte 1 115
byte 1 105
byte 1 111
byte 1 110
byte 1 32
byte 1 100
byte 1 97
byte 1 116
byte 1 97
byte 1 46
byte 1 10
byte 1 0
align 1
LABELV $83
byte 1 115
byte 1 101
byte 1 115
byte 1 115
byte 1 105
byte 1 111
byte 1 110
byte 1 0
align 1
LABELV $66
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 0
align 1
LABELV $55
byte 1 115
byte 1 101
byte 1 115
byte 1 115
byte 1 105
byte 1 111
byte 1 110
byte 1 37
byte 1 105
byte 1 0
align 1
LABELV $54
byte 1 37
byte 1 105
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 37
byte 1 105
byte 1 0
|
bootdict/tc/search.asm | ikysil/ikforth | 8 | 15212 | ;******************************************************************************
;
; search.asm
; IKForth
;
; Unlicense since 1999 by <NAME>
;
;******************************************************************************
; Words search
;******************************************************************************
$VAR 'LAST-WORDLIST',,LATEST_WL
; WID>XT-SEARCH
; D: ( wid -- xt-search )
$COLON 'WID>XT-SEARCH',$WID_TO_XT_SEARCH
CW $WID_TO_VT, $FETCH, $FETCH
$END_COLON
; WID>XT-TRAVERSE
; D: ( wid -- xt-traverse )
$COLON 'WID>XT-TRAVERSE',$WID_TO_XT_TRAVERSE
CW $WID_TO_VT, $FETCH, $CELL_PLUS, $FETCH
$END_COLON
; 172.16.58.3192 SEARCH-WORDLIST
; D: ( c-addr u wid -- 0 | xt 1 | xt -1 )
$COLON 'SEARCH-WORDLIST',$SEARCH_WORDLIST
CW $DUPE, $WID_TO_XT_SEARCH, $EXECUTE
$END_COLON
; 192.168.3.11297 TRAVERSE-WORDLIST
; ( i * x xt wid -- j * x )
$COLON 'TRAVERSE-WORDLIST',$TRAVERSE_WORDLIST
CW $DUPE, $WID_TO_XT_TRAVERSE, $EXECUTE
$END_COLON
$CREATE 'WORDLIST-VT',$WORDLIST_VT
CW $STDWL_SEARCH_ASM
CW $STDWL_TRAVERSE
; D: ( c-addr u -- 0 | xt 1 | xt -1 )
$COLON '(SEARCH-NAME)',$PSEARCH_NAME
CW $FORTH_WORDLIST, $SEARCH_WORDLIST
$END_COLON
; SEARCH-NAME
; D: ( c-addr u -- 0 | xt 1 | xt -1 )
$DEFER 'SEARCH-NAME',$SEARCH_NAME,$PSEARCH_NAME
; 6.1.1550 FIND
; D: ( c-addr -- c-addr 0 | xt 1 | xt -1 )
$COLON 'FIND',$FIND
CW $DUPE, $TO_R, $COUNT, $SEARCH_NAME, $DUPE, $ZERO_NOT_EQUALS
_IF FF_FOUND
CW $R_FROM, $DROP
_ELSE FF_FOUND
CW $R_FROM, $SWAP
_THEN FF_FOUND
$END_COLON
|
source/tasking/required/s-tpoben.ads | ytomino/drake | 33 | 27519 | <reponame>ytomino/drake<gh_stars>10-100
pragma License (Unrestricted);
-- implementation unit required by compiler
with Ada.Exceptions;
with Ada.Finalization;
with Ada.Unchecked_Conversion;
package System.Tasking.Protected_Objects.Entries is
type Node is limited record
Super : aliased Synchronous_Objects.Queue_Node;
E : Protected_Entry_Index;
Uninterpreted_Data : Address;
Caller : Task_Id;
Action : Boolean;
Requeued : Boolean;
Waiting : aliased Synchronous_Objects.Event;
X : Ada.Exceptions.Exception_Occurrence;
end record;
pragma Suppress_Initialization (Node);
type Node_Access is access all Node;
function Downcast is
new Ada.Unchecked_Conversion (
Synchronous_Objects.Queue_Node_Access,
Node_Access);
type Find_Body_Index_Access is access function (
O : Address;
E : Protected_Entry_Index)
return Protected_Entry_Index;
type Protected_Entry_Queue_Max_Array is
array (Positive_Protected_Entry_Index range <>) of Natural;
type Protected_Entry_Queue_Max_Access is
access constant Protected_Entry_Queue_Max_Array;
-- required by compiler
type Protected_Entry_Body_Array is
array (Positive_Protected_Entry_Index range <>) of Entry_Body;
pragma Suppress_Initialization (Protected_Entry_Body_Array);
type Protected_Entry_Body_Access is
access constant Protected_Entry_Body_Array;
-- required by compiler
-- (if it is not controlled type, compiler may be crashed!)
type Protection_Entries (Num_Entries : Protected_Entry_Index) is
limited new Ada.Finalization.Limited_Controlled with
record
Mutex : aliased Synchronous_Objects.Mutex;
Calling : aliased Synchronous_Objects.Queue;
Compiler_Info : Address;
Entry_Bodies : Protected_Entry_Body_Access;
Find_Body_Index : Find_Body_Index_Access;
Raised_On_Barrier : Boolean;
Current_Calling : access Node;
end record;
-- required for synchronized interface by compiler
type Protection_Entries_Access is access all Protection_Entries'Class;
for Protection_Entries_Access'Storage_Size use 0;
-- required by compiler
procedure Initialize_Protection_Entries (
Object : not null access Protection_Entries'Class;
Ceiling_Priority : Integer;
Compiler_Info : Address;
Entry_Queue_Maxes : Protected_Entry_Queue_Max_Access;
Entry_Bodies : Protected_Entry_Body_Access;
Find_Body_Index : Find_Body_Index_Access);
overriding procedure Finalize (Object : in out Protection_Entries);
-- required by compiler
procedure Lock_Entries (
Object : not null access Protection_Entries'Class);
procedure Unlock_Entries (
Object : not null access Protection_Entries'Class);
-- for System.Tasking.Protected_Objects.Operations.Service_Entries
procedure Cancel_Calls (Object : in out Protection_Entries'Class);
-- required by compiler (s-tpoben.ads)
function Get_Ceiling (Object : not null access Protection_Entries'Class)
return Any_Priority;
-- unimplemented subprograms required by compiler
-- Set_Ceiling
end System.Tasking.Protected_Objects.Entries;
|
code/6502/invaders/shield.asm | visrealm/hbc-56 | 65 | 161086 | <filename>code/6502/invaders/shield.asm
; Troy's HBC-56 - 6502 - Invaders - Shields
;
; Copyright (c) 2021 <NAME>
;
; This code is licensed under the MIT license
;
; https://github.com/visrealm/hbc-56
;
;
COLOR_SHIELD = TMS_WHITE << 4 | TMS_BLACK
shieldLayout:
!byte 8,9,10,0,0,0,14,15,16,0,0,0,0,20,21,22,0,0,0,26,27,28
!fill 10, 0
!byte 11,12,13,0,0,0,17,18,19,0,0,0,0,23,24,25,0,0,0,29,30,31
SHIELD_BYTES = * - shieldLayout
; -----------------------------------------------------------------------------
; Setup the shields
; -----------------------------------------------------------------------------
setupShield:
+tmsSetAddrPattTableInd 8
+tmsSendData SHIELD, 8 * 6 ; Shield1 8 - 13
+tmsSendData SHIELD, 8 * 6 ; Shield2 14 - 18
+tmsSendData SHIELD, 8 * 6 ; Shield3 20 - 25
+tmsSendData SHIELD, 8 * 6 ; Shield4 26 - 31
+tmsSetPosWrite 5, 17
+tmsSendData shieldLayout, SHIELD_BYTES
rts
; -----------------------------------------------------------------------------
; testShieldBombed: Shield bombed by alien
; -----------------------------------------------------------------------------
; Inputs:
; A: Shield pattern index
; HIT_TILE_X / HIT_TILE_Y shield tile location
; HIT_TILE_PIX_X / HIT_TILE_PIX_Y pixel offset (hit location in tile)
; Outputs:
; Carry: Set if hit, clear if no hit
; -----------------------------------------------------------------------------
testShieldBombed:
ldy HIT_TILE_PIX_Y
jsr tmsSetPatternRead
; load the pattern row that was hit
+tmsGet
jsr patternHitTest
beq .noBomb
jsr clearShieldBombedPixels
; kill the bomb
ldy #BULLET_Y_LOADED
sty INVADER_BOMB1_Y
sec
rts
.noBomb
clc
rts
; -----------------------------------------------------------------------------
; testShieldPlayerBullet: Test shield hit by player bullet
; -----------------------------------------------------------------------------
; Inputs:
; A: Shield pattern index
; HIT_TILE_X / HIT_TILE_Y shield tile location
; HIT_TILE_PIX_X / HIT_TILE_PIX_Y pixel offset (hit location in tile)
; Outputs:
; Carry: Set if hit, clear if no hit
; -----------------------------------------------------------------------------
testShieldPlayerBullet:
ldy HIT_TILE_PIX_Y
jsr tmsSetPatternRead
; load the pattern row that was hit
+tmsGet
jsr patternHitTest
beq .noHit
jsr clearShieldPlayerBulletPixels
; kill the bullet
ldy #0
sty BULLET_Y
sec
rts
.noHit
clc
rts
; -----------------------------------------------------------------------------
; clearShieldPlayerBulletPixels: Clear pixels in the following shape: X = HIT_TILE_PIX
; -----------------------------------------------------------------------------
;
; O
; OO
; OX
; O
;
clearShieldPlayerBulletPixels:
jsr tileClearPixel ; X
jsr incTileHitY
jsr tileClearPixel
jsr decTileHitX
jsr decTileHitY
jsr tileClearPixel
jsr decTileHitY
jsr incTileHitX
jsr tileClearPixel
jsr incTileHitX
jsr tileClearPixel
jsr decTileHitY
jsr decTileHitX
jsr tileClearPixel
rts
; -----------------------------------------------------------------------------
; clearShieldBombedPixels: Clear pixels in the following shape: X = HIT_TILE_PIX
; -----------------------------------------------------------------------------
;
; OOO
; OXO
; OOO
; OOO
; OO
;
clearShieldBombedPixels:
jsr tileClearPixel
jsr decTileHitY
jsr tileClearPixel
jsr incTileHitX
jsr tileClearPixel
jsr incTileHitX
jsr tileClearPixel
jsr incTileHitY
jsr decTileHitX
jsr tileClearPixel
jsr decTileHitX
jsr decTileHitX
jsr tileClearPixel
jsr incTileHitY
jsr incTileHitX
jsr tileClearPixel
jsr incTileHitX
jsr tileClearPixel
jsr incTileHitX
jsr tileClearPixel
jsr incTileHitY
jsr decTileHitX
jsr tileClearPixel
jsr decTileHitX
jsr tileClearPixel
jsr decTileHitX
jsr tileClearPixel
jsr incTileHitY
jsr incTileHitX
jsr tileClearPixel
jsr incTileHitX
jsr tileClearPixel
rts |
libsrc/math/genmath/c/sccz80/cos.asm | jpoikela/z88dk | 640 | 27778 | <reponame>jpoikela/z88dk
; Small C+ Maths Routines
;
; transcendental floating point routines
;
SECTION code_fp
PUBLIC cos
EXTERN sin
EXTERN hladd
EXTERN __halfpi
;double cos(double val)
;Looks odd, but don't worry..value is already in FA - no need for stack
;
; transcendental functions: sin, cos, tan
;
.cos LD HL,halfpi ;local copy..
CALL hladd
jp sin
.halfpi DEFB $22,$A2,$DA,$0F,$49,$81 ; pi/2
|
Transynther/x86/_processed/NONE/_st_/i7-8650U_0xd2.log_4569_455.asm | ljhsiun2/medusa | 9 | 89418 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r15
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x18ac1, %r14
dec %rbx
mov (%r14), %r15d
nop
cmp $14704, %r12
lea addresses_WC_ht+0x8479, %rbx
nop
nop
nop
nop
and $63250, %r12
movw $0x6162, (%rbx)
nop
dec %rax
lea addresses_WC_ht+0x16841, %rbp
nop
nop
nop
cmp %rdi, %rdi
mov $0x6162636465666768, %r15
movq %r15, %xmm5
and $0xffffffffffffffc0, %rbp
movntdq %xmm5, (%rbp)
nop
add $47451, %r14
lea addresses_UC_ht+0x1c4c1, %rax
nop
nop
nop
xor $14321, %rdi
movb $0x61, (%rax)
xor %rax, %rax
lea addresses_D_ht+0x42c1, %r15
nop
nop
and %rax, %rax
mov (%r15), %r14
nop
xor %rax, %rax
lea addresses_UC_ht+0x1d6c1, %rbx
nop
nop
nop
nop
sub %r12, %r12
mov (%rbx), %r15w
nop
nop
nop
cmp $25797, %rax
lea addresses_WT_ht+0x2bd1, %r14
clflush (%r14)
nop
nop
nop
nop
nop
sub $10171, %rax
mov (%r14), %r12d
add $50443, %rbp
lea addresses_D_ht+0x1c6c1, %rbp
nop
nop
nop
nop
and %rdi, %rdi
mov $0x6162636465666768, %r14
movq %r14, %xmm3
movups %xmm3, (%rbp)
nop
nop
nop
xor $3925, %r14
lea addresses_A_ht+0x1c2c1, %rsi
lea addresses_A_ht+0x92c1, %rdi
cmp $51934, %r15
mov $124, %rcx
rep movsb
nop
nop
nop
dec %rcx
lea addresses_WT_ht+0x9c01, %rsi
lea addresses_WC_ht+0x2ec1, %rdi
nop
and %rbx, %rbx
mov $51, %rcx
rep movsw
nop
xor $100, %rcx
lea addresses_A_ht+0x1aac1, %r15
inc %rcx
mov (%r15), %esi
nop
add %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r15
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %rax
push %rbx
push %rcx
push %rdx
// Store
lea addresses_US+0xbac1, %rbx
nop
nop
dec %r14
movw $0x5152, (%rbx)
nop
nop
nop
and %rbx, %rbx
// Store
lea addresses_D+0x72c1, %rcx
nop
nop
nop
xor $47465, %r12
movl $0x51525354, (%rcx)
nop
nop
nop
xor %rbx, %rbx
// Store
lea addresses_US+0x79b3, %rax
clflush (%rax)
nop
nop
nop
nop
cmp $20473, %rdx
mov $0x5152535455565758, %rbx
movq %rbx, %xmm5
movups %xmm5, (%rax)
nop
nop
nop
and %r10, %r10
// Faulty Load
lea addresses_WC+0x112c1, %r10
nop
add $12141, %rbx
mov (%r10), %r12d
lea oracles, %rdx
and $0xff, %r12
shlq $12, %r12
mov (%rdx,%r12,1), %r12
pop %rdx
pop %rcx
pop %rbx
pop %rax
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'54': 4569}
54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54
*/
|
programs/oeis/084/A084631.asm | neoneye/loda | 22 | 4617 | <reponame>neoneye/loda
; A084631: Floor(C(n+8,8)/C(n+2,2)).
; 1,3,7,16,33,61,107,178,286,442,663,969,1384,1938,2664,3605,4807,6325,8222,10571,13455,16965,21206,26295,32364,39556,48032,57970,69564,83028,98595,116522,137085,160585,187349,217730,252109,290895,334529,383484
add $0,8
bin $0,6
mul $0,2
div $0,56
|
programs/oeis/117/A117366.asm | neoneye/loda | 22 | 27297 | <filename>programs/oeis/117/A117366.asm<gh_stars>10-100
; A117366: a(n) = smallest prime greater than the largest prime dividing n.
; 2,3,5,3,7,5,11,3,5,7,13,5,17,11,7,3,19,5,23,7,11,13,29,5,7,17,5,11,31,7,37,3,13,19,11,5,41,23,17,7,43,11,47,13,7,29,53,5,11,7,19,17,59,5,13,11,23,31,61,7,67,37,11,3,17,13,71,19,29,11,73,5,79,41,7,23,13,17,83,7,5,43,89,11,19,47,31,13,97,7,17,29,37,53,23,5,101,11,13,7
seq $0,61395 ; Let p be the largest prime factor of n; if p is the k-th prime then set a(n) = k; a(1) = 0 by convention.
seq $0,40 ; The prime numbers.
|
Transynther/x86/_processed/NONE/_un_xt_sm_/i9-9900K_12_0xca.log_21829_352.asm | ljhsiun2/medusa | 9 | 244833 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x1c27a, %rsi
lea addresses_normal_ht+0x162aa, %rdi
nop
nop
cmp %r13, %r13
mov $37, %rcx
rep movsq
nop
xor %r9, %r9
lea addresses_A_ht+0x443a, %r12
nop
nop
nop
nop
nop
xor %rsi, %rsi
mov $0x6162636465666768, %r13
movq %r13, %xmm2
movups %xmm2, (%r12)
nop
nop
nop
nop
and $37774, %rdi
lea addresses_WC_ht+0x1d2ba, %r13
nop
nop
xor %rbp, %rbp
mov (%r13), %rsi
nop
nop
nop
nop
nop
add $64223, %rsi
lea addresses_D_ht+0x8a1f, %rbp
nop
inc %r12
mov $0x6162636465666768, %r13
movq %r13, %xmm3
movups %xmm3, (%rbp)
nop
nop
nop
nop
nop
cmp $45203, %rcx
lea addresses_D_ht+0x1acaa, %r12
nop
nop
xor $39568, %rdi
mov $0x6162636465666768, %rbp
movq %rbp, %xmm2
movups %xmm2, (%r12)
nop
and %r9, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %rbp
push %rcx
push %rdi
push %rsi
// Store
mov $0xeaa, %rbp
nop
nop
nop
cmp %r11, %r11
movb $0x51, (%rbp)
nop
nop
nop
nop
nop
xor %r10, %r10
// Load
lea addresses_A+0xf12a, %r14
add %rcx, %rcx
mov (%r14), %r11d
nop
xor $57385, %rsi
// Store
lea addresses_WC+0xceaa, %r11
nop
and $17829, %rsi
movb $0x51, (%r11)
// Exception!!!
nop
mov (0), %rcx
nop
nop
nop
sub %rsi, %rsi
// Faulty Load
lea addresses_WC+0xceaa, %r11
nop
nop
nop
nop
nop
sub %rbp, %rbp
mov (%r11), %r14w
lea oracles, %rdi
and $0xff, %r14
shlq $12, %r14
mov (%rdi,%r14,1), %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': True, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WC', 'same': True, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'c0': 10, '51': 21819}
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 c0 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 c0 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
*/
|
src/sys/serialize/util-serialize-tools.ads | RREE/ada-util | 60 | 24550 | <filename>src/sys/serialize/util-serialize-tools.ads<gh_stars>10-100
-----------------------------------------------------------------------
-- util-serialize-tools -- Tools to Serialize objects in various formats
-- Copyright (C) 2012, 2016 <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.Beans.Objects.Maps;
with Util.Serialize.IO.JSON;
package Util.Serialize.Tools is
-- Serialize the objects defined in the object map <b>Map</b> into the <b>Output</b>
-- JSON stream. Use the <b>Name</b> as the name of the JSON object.
procedure To_JSON (Output : in out Util.Serialize.IO.JSON.Output_Stream'Class;
Name : in String;
Map : in Util.Beans.Objects.Maps.Map);
-- Deserializes the JSON content passed in <b>Content</b> and restore the object map
-- with their values. The object map passed in <b>Map</b> can contain existing values.
-- They will be overriden by the JSON values.
procedure From_JSON (Content : in String;
Map : in out Util.Beans.Objects.Maps.Map);
-- Serialize the objects defined in the object map <b>Map</b> into an JSON stream.
-- Returns the JSON string that contains a serialization of the object maps.
function To_JSON (Map : in Util.Beans.Objects.Maps.Map) return String;
-- Deserializes the XML content passed in <b>Content</b> and restore the object map
-- with their values.
-- Returns the object map that was restored.
function From_JSON (Content : in String) return Util.Beans.Objects.Maps.Map;
end Util.Serialize.Tools;
|
_tests/trconvert/antlr2/python.g4 | SKalt/Domemtech.Trash | 16 | 6419 | /*
[The "BSD licence"]
Copyright (c) 2004 <NAME> and <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.
*/
/** Python 2.3.3 Grammar
*
* <NAME> and <NAME>
* February 2004
*
* This grammar was derived automatically from the Python 2.3.3
* parser grammar to get a syntactically correct ANTLR grammar
* for Python. Then Terence hand tweaked it to be semantically
* correct; i.e., removed lookahead issues etc... It is LL(1)
* except for the (sometimes optional) trailing commas and semi-colons.
* It needs two symbols of lookahead in this case.
*
* Starting with Loring's preliminary lexer for Python, I modified it
* to do my version of the whole nasty INDENT/DEDENT issue just so I
* could understand the problem better. This grammar requires
* PythonTokenStream.java to work. Also I used some rules from the
* semi-formal grammar on the web for Python (automatically
* translated to ANTLR format by an ANTLR grammar, naturally <grin>).
* The lexical rules for python are particularly nasty and it took me
* a long time to get it "right"; i.e., think about it in the proper
* way. Resist changing the lexer unless you've used ANTLR a lot. ;)
*
* I (Terence) tested this by running it on the jython-2.1/Lib
* directory of 40k lines of Python.
*
* REQUIRES ANTLR 2.7.3rc3 at least (to resolve a FOLLOW bug).
*/
grammar Python;
// Start symbols for the grammar:
// single_input is a single interactive statement;
// file_input is a module or sequence of commands read from an input file;
// eval_input is the input for the eval() and input() functions.
// NB: compound_stmt in single_input is followed by extra NEWLINE!
single_input
: NEWLINE
| simple_stmt
| compound_stmt NEWLINE
;
file_input
: (NEWLINE | stmt)* EOF
;
eval_input
: (NEWLINE)* testlist (NEWLINE)* EOF
;
funcdef
: 'def' NAME parameters COLON suite
;
parameters
: LPAREN (varargslist)? RPAREN
;
varargslist
: defparameter (COMMA defparameter)*
(COMMA
( STAR NAME (COMMA DOUBLESTAR NAME)?
| DOUBLESTAR NAME
)?
)?
| STAR NAME (COMMA DOUBLESTAR NAME)?
| DOUBLESTAR NAME
;
defparameter
: fpdef (ASSIGN test)?
;
fpdef
: NAME
| LPAREN fplist RPAREN
;
fplist
: fpdef (COMMA fpdef)* (COMMA)?
;
stmt: simple_stmt
| compound_stmt
;
simple_stmt
: small_stmt (SEMI small_stmt)* (SEMI)? NEWLINE
;
small_stmt: expr_stmt
| print_stmt
| del_stmt
| pass_stmt
| flow_stmt
| import_stmt
| global_stmt
| exec_stmt
| assert_stmt
;
expr_stmt
: testlist
( augassign testlist
| (ASSIGN testlist)+
)?
;
augassign
: PLUSEQUAL
| MINUSEQUAL
| STAREQUAL
| SLASHEQUAL
| PERCENTEQUAL
| AMPEREQUAL
| VBAREQUAL
| CIRCUMFLEXEQUAL
| LEFTSHIFTEQUAL
| RIGHTSHIFTEQUAL
| DOUBLESTAREQUAL
| DOUBLESLASHEQUAL
;
print_stmt:
'print'
( testlist
| RIGHTSHIFT testlist
)?
;
del_stmt: 'del' exprlist
;
pass_stmt: 'pass'
;
flow_stmt: break_stmt
| continue_stmt
| return_stmt
| raise_stmt
| yield_stmt
;
break_stmt: 'break'
;
continue_stmt: 'continue'
;
return_stmt: 'return' (testlist)?
;
yield_stmt: 'yield' testlist
;
raise_stmt: 'raise' (test (COMMA test (COMMA test)?)?)?
;
import_stmt
: 'import' dotted_as_name (COMMA dotted_as_name)*
| 'from' dotted_name 'import'
(STAR | import_as_name (COMMA import_as_name)*)
;
import_as_name
: NAME (NAME NAME)?
;
dotted_as_name: dotted_name (NAME NAME)?
;
dotted_name: NAME (DOT NAME)*
;
global_stmt: 'global' NAME (COMMA NAME)*
;
exec_stmt: 'exec' expr ('in' test (COMMA test)?)?
;
assert_stmt: 'assert' test (COMMA test)?
;
compound_stmt: if_stmt
| while_stmt
| for_stmt
| try_stmt
| funcdef
| classdef
;
if_stmt: 'if' test COLON suite ('elif' test COLON suite)* ('else' COLON suite)?
;
while_stmt: 'while' test COLON suite ('else' COLON suite)?
;
for_stmt: 'for' exprlist 'in' testlist COLON suite ('else' COLON suite)?
;
try_stmt
: 'try' COLON suite
( (except_clause COLON suite)+ ('else' COLON suite)?
| 'finally' COLON suite
)
;
except_clause: 'except' (test (COMMA test)?)?
;
suite: simple_stmt
| NEWLINE INDENT (stmt)+ DEDENT
;
test: and_test ('or' and_test)*
| lambdef
;
and_test
: not_test ('and' not_test)*
;
not_test
: 'not' not_test
| comparison
;
comparison: expr (comp_op expr)*
;
comp_op: LESS
|GREATER
|EQUAL
|GREATEREQUAL
|LESSEQUAL
|ALT_NOTEQUAL
|NOTEQUAL
|'in'
|'not' 'in'
|'is'
|'is' 'not'
;
expr: xor_expr (VBAR xor_expr)*
;
xor_expr: and_expr (CIRCUMFLEX and_expr)*
;
and_expr: shift_expr (AMPER shift_expr)*
;
shift_expr: arith_expr ((LEFTSHIFT|RIGHTSHIFT) arith_expr)*
;
arith_expr: term ((PLUS|MINUS) term)*
;
term: factor ((STAR | SLASH | PERCENT | DOUBLESLASH ) factor)*
;
factor
: (PLUS|MINUS|TILDE) factor
| power
;
power
: atom (trailer)* (DOUBLESTAR factor)?
;
atom: LPAREN (testlist)? RPAREN
| LBRACK (listmaker)? RBRACK
| LCURLY (dictmaker)? RCURLY
| BACKQUOTE testlist BACKQUOTE
| NAME
| INT
| LONGINT
| FLOAT
| COMPLEX
| (STRING)+
;
listmaker: test ( list_for | (COMMA test)* ) (COMMA)?
;
lambdef: 'lambda' (varargslist)? COLON test
;
trailer: LPAREN (arglist)? RPAREN
| LBRACK subscriptlist RBRACK
| DOT NAME
;
subscriptlist
: subscript (COMMA subscript)* (COMMA)?
;
subscript
: DOT DOT DOT
| test (COLON (test)? (sliceop)?)?
| COLON (test)? (sliceop)?
;
sliceop: COLON (test)?
;
exprlist
: expr (COMMA expr)* (COMMA)?
;
testlist
: test (COMMA test)*
(COMMA)?
;
dictmaker
: test COLON test
(COMMA test COLON test)* (COMMA)?
;
classdef: 'class' NAME (LPAREN testlist RPAREN)? COLON suite
;
arglist: argument (COMMA argument)*
( COMMA
( STAR test (COMMA DOUBLESTAR test)?
| DOUBLESTAR test
)?
)?
| STAR test (COMMA DOUBLESTAR test)?
| DOUBLESTAR test
;
argument : test (ASSIGN test)?
;
list_iter: list_for
| list_if
;
list_for: 'for' exprlist 'in' testlist (list_iter)?
;
list_if: 'if' test (list_iter)?
;
LPAREN : '(' ;
RPAREN : ')' ;
LBRACK : '[' ;
RBRACK : ']' ;
COLON : ':' ;
COMMA : ',' ;
SEMI : ';' ;
PLUS : '+' ;
MINUS : '-' ;
STAR : '*' ;
SLASH : '/' ;
VBAR : '|' ;
AMPER : '&' ;
LESS : '<' ;
GREATER : '>' ;
ASSIGN : '=' ;
PERCENT : '%' ;
BACKQUOTE : '`' ;
LCURLY : '{' ;
RCURLY : '}' ;
CIRCUMFLEX : '^' ;
TILDE : '~' ;
EQUAL : '==' ;
NOTEQUAL : '!=' ;
ALT_NOTEQUAL: '<>' ;
LESSEQUAL : '<=' ;
LEFTSHIFT : '<<' ;
GREATEREQUAL : '>=' ;
RIGHTSHIFT : '>>' ;
PLUSEQUAL : '+=' ;
MINUSEQUAL : '-=' ;
DOUBLESTAR : '**' ;
STAREQUAL : '*=' ;
DOUBLESLASH : '//' ;
SLASHEQUAL : '/=' ;
VBAREQUAL : '|=' ;
PERCENTEQUAL : '%=' ;
AMPEREQUAL : '&=' ;
CIRCUMFLEXEQUAL : '^=' ;
LEFTSHIFTEQUAL : '<<=' ;
RIGHTSHIFTEQUAL : '>>=' ;
DOUBLESTAREQUAL : '**=' ;
DOUBLESLASHEQUAL : '//=' ;
NUMBER
: // Hex
'0' ('x' | 'X') ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+
('l' | 'L')?
| // Octal
'0' Int
( FloatTrailer ('j' | 'J')?
| ('l' | 'L')
)?
| '0'
( FloatTrailer ('j' | 'J')?
| ('l' | 'L')
)?
| // Int or float
( NonZeroDigit (Int)?
( ('l' | 'L')
| ('j' | 'J')
| FloatTrailer ('j' | 'J')?
|
)
)
| '.' Int (Exponent)? ('j' | 'J')?
| '.' // DOT (non number; e.g., field access)
;
Int : ( '0' .. '9' )+ ;
NonZeroDigit : '1' .. '9' ;
FloatTrailer
: '.'
| '.' Int (Exponent)?
| Exponent
;
Exponent
: ('e' | 'E') ( '+' | '-' )? Int
;
Name
: ( 'a' .. 'z' | 'A' .. 'Z' | '_')
( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
;
STRING_OR_NAME
: String
|Name
( {prefix.equals("R")||prefix.equals("U")||prefix.equals("UR")}?
String
|
)
;
String
: '\'\'\'' (ESC|NEWLINE|.)* '\'\'\''
| '"' '"' '"' (ESC|NEWLINE|.)* '"' '"' '"'
| '\'' (ESC|~('\\'|'\n'|'\''))* '\''
| '"' (ESC|~('\\'|'\n'|'"'))* '"'
;
ESC
: '\\' .
;
/** Consume a newline and any whitespace at start of next line */
CONTINUED_LINE
: '\\' ('\r')? '\n' (' '|'\t')*
;
/** Grab everything before a real symbol. Then if newline, kill it
* as this is a blank line. If whitespace followed by comment, kill it
* as it's a comment on a line by itself.
*
* Ignore leading whitespace when nested in [..], (..), {..}.
*/
LEADING_WS
: {getColumn()==1}?
// match spaces or tabs, tracking indentation count
( ' '
| '\t'
| '\014' // formfeed is ok
)+
// kill trailing newline or comment
( {implicitLineJoiningLevel==0}? ('\r')? '\n'
| // if comment, then only thing on a line; kill so we
// ignore totally also wack any following newlines as
// they cannot be terminating a statement
'#' (~'\n')* ('\n')+
)?
;
/** Comments not on line by themselves are turned into newlines because
sometimes they are newlines like
b = a # end of line comment
or
a = [1, # weird
2]
This rule is invoked directly by nextToken when the comment is in
first column or when comment is on end of nonwhitespace line.
The problem is that then we have lots of newlines heading to
the parser. To fix that, column==1 implies we should kill whole line.
Consume any newlines following this comment as they are not statement
terminators. Don't let NEWLINE token handle them.
*/
COMMENT
: '#' (~'\n')*
( {startCol==1}? ('\n')+ )?
;
/** Treat a sequence of blank lines as a single blank line. If
* nested within a (..), {..}, or [..], then ignore newlines.
* If the first newline starts in column one, they are to be ignored.
*/
NEWLINE
: (('\r')? '\n')+
;
WS : (' '|'\t')+
;
|
tests/crew-member_data_test_data-member_data_tests.ads | thindil/steamsky | 80 | 22949 | <filename>tests/crew-member_data_test_data-member_data_tests.ads
-- This package has been generated automatically by GNATtest.
-- Do not edit any part of it, see GNATtest documentation for more details.
-- begin read only
with GNATtest_Generated;
package Crew.Member_Data_Test_Data.Member_Data_Tests is
type Test_Member_Data is new GNATtest_Generated.GNATtest_Standard.Crew
.Member_Data_Test_Data
.Test_Member_Data with
null record;
end Crew.Member_Data_Test_Data.Member_Data_Tests;
-- end read only
|
src/test/resources/data/generationtests/glass-labels.asm | cpcitor/mdlz80optimizer | 36 | 88943 | ; Test to check labels are parsed like in Glass (reported by Torihino)
DI ds 1 ; this should parse "DI" as a label |
unittests/arch/x86/insn/bswap64.asm | path64/assembler | 1 | 246297 | [bits 64]
bswap r8 ; 49 0f c8
bswap rax ; 48 0f c8
|
mos/test-data/build/include.asm | RoyJacobs/mosdev | 15 | 162694 | <filename>mos/test-data/build/include.asm
ldx #$00
loop:
lda data, x
beq end
sta $0400, x
inx
jmp loop
end:
rts
data:
.file "include.bin"
.byte 0
|
_anim/Flapping Door.asm | kodishmediacenter/msu-md-sonic | 9 | 92791 | <reponame>kodishmediacenter/msu-md-sonic
; ---------------------------------------------------------------------------
; Animation script - flapping door (LZ)
; ---------------------------------------------------------------------------
Ani_Flap: dc.w @opening-Ani_Flap
dc.w @closing-Ani_Flap
@opening: dc.b 3, 0, 1, 2, afBack, 1
@closing: dc.b 3, 2, 1, 0, afBack, 1
even |
libsrc/_DEVELOPMENT/math/float/am9511/c/sdcc/cam32_sdcc_sinh.asm | dikdom/z88dk | 1 | 16186 |
SECTION code_fp_am9511
PUBLIC cam32_sdcc_sinh
EXTERN asm_sdcc_read1, _am9511_sinh
.cam32_sdcc_sinh
call asm_sdcc_read1
jp _am9511_sinh
|
kernel/libarch/x86/src/longjmp.asm | CarboSauce/Gloxor | 4 | 94684 | bits 64
section .text
global _gloxAsmLongJump
_gloxAsmLongJump:
mov rax, rsp
push 0x10
push rax
pushf
push 0x8
push .1
iretq
.1:
mov eax, 0x10
mov ds,eax;
mov es,eax;
mov fs,eax;
mov gs,eax
mov ss,eax
ret |
tools-src/gnu/gcc/gcc/ada/s-exngen.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 498 | ------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . E X N _ G E N --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992,1993,1994,1995 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains the generic functions which are instantiated with
-- predefined integer and real types to generate the runtime exponentiation
-- functions called by expanded code generated by Expand_Op_Expon. This
-- version of the package contains routines that are compiled with overflow
-- checks suppressed, so they are called for exponentiation operations which
-- do not require overflow checking
package System.Exn_Gen is
pragma Pure (System.Exn_Gen);
-- Exponentiation for float types (checks off)
generic
type Type_Of_Base is digits <>;
function Exn_Float_Type
(Left : Type_Of_Base;
Right : Integer)
return Type_Of_Base;
-- Exponentiation for signed integer base
generic
type Type_Of_Base is range <>;
function Exn_Integer_Type
(Left : Type_Of_Base;
Right : Natural)
return Type_Of_Base;
end System.Exn_Gen;
|
Driver/Printer/PScript/qmsColorScriptf35Info.asm | steakknife/pcgeos | 504 | 242580 |
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1993 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: PostScript driver
FILE: qmsColorScriptf35Info.asm
AUTHOR: <NAME> 13 April 1993
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 4/13/93 Initial revision parsed from pscriptNecColor.asm
DESCRIPTION:
This file contains the device information for the PostScript printer:
QMS ColorScript
Other Printers Supported by this resource:
$Id: qmsColorScriptf35Info.asm,v 1.1 97/04/18 11:56:13 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
qmsColorScriptf35Info segment resource
; info blocks
PrinterInfo < ; ---- PrinterType -------------
< PT_RASTER, BMF_4CMYK>,
; ---- PrinterConnections ------
< IC_NO_IEEE488,
CC_NO_CUSTOM,
SC_SCSI,
RC_RS232C,
CC_CENTRONICS,
FC_FILE,
AC_APPLETALK >,
; ---- PrinterSmarts -----------
PS_PDL,
;-------Custom Entry Routine-------
NULL,
;-------Custom Exit Routine-------
NULL,
; ---- Mode Info Offsets -------
NULL,
NULL,
offset qmsColorScriptf35hires,
NULL,
NULL,
; ---- Font Geometry -----------
NULL,
; ---- Symbol Set list -----------
NULL,
; ---- PaperMargins ------------
< PR_MARGIN_LEFT, ; Tractor Margins
PR_MARGIN_TRACTOR,
PR_MARGIN_RIGHT,
PR_MARGIN_TRACTOR >,
< PR_MARGIN_LEFT, ; ASF Margins
72,
PR_MARGIN_RIGHT,
72 >,
; ---- PaperInputOptions -------
< MF_MANUAL1,
TF_NO_TRACTOR,
ASF_TRAY1 >,
; ---- PaperOutputOptions ------
< OC_COPIES,
PS_REVERSE,
OD_SIMPLEX,
SO_NO_STAPLER,
OS_NO_SORTER,
OB_NO_OUTPUTBIN >,
;
612, ; paper width (points).
NULL, ; Main UI
NoSettingsDialogBox, ; Options UI
offset PrintEvalDummyASF ; UI eval Routine
>
;----------------------------------------------------------------------------
; Graphics modes info
;----------------------------------------------------------------------------
qmsColorScriptf35hires GraphicsProperties < 300, ; xres
300, ; yres
1, ; band height
1, ; buff height
1, ; interleaves
BMF_24BIT, ; color format
NULL > ; color correct
;----------------------------------------------------------------------------
; PostScript Info
;----------------------------------------------------------------------------
; This structure holds PostScript-specific info about the printer. It
; *must* be placed directly after the hires GraphicProperties struct
PSInfoStruct <
PSFL_STANDARD_35C, ; PSFontList
0x9001, ; PSLevel flags
; 9=PSL_CMYK or PSL_FILE
COLORSCRIPT_PROLOG_LEN, ; prolog length
offset qmsColorScriptf35Prolog ; ptr to prolog
> ; (see pscriptConstant.def)
qmsColorScriptf35Prolog label byte
char "GWDict begin", NL
char "/SDC { 85 35 currentscreen 3 1 roll pop pop setscreen", NL
char "{} setblackgeneration {} setundercolorremoval }bdef", NL
char "end", NL
qmsColorScriptf35EndProlog label byte
COLORSCRIPT_PROLOG_LEN equ offset qmsColorScriptf35EndProlog - offset qmsColorScriptf35Prolog
qmsColorScriptf35Info ends
|
libsrc/_DEVELOPMENT/target/zx/driver/terminal/zx_01_output_fzx_tty_z88dk/zx_01_output_fzx_tty_z88dk_02_font_address.asm | jpoikela/z88dk | 640 | 1734 |
SECTION code_driver
SECTION code_driver_terminal_output
PUBLIC zx_01_output_fzx_tty_z88dk_02_font_address
zx_01_output_fzx_tty_z88dk_02_font_address:
; de = parameters *
ld a,(de) ; a = MSB font address
inc de
ld (ix+34),a
ld a,(de) ; a = LSB of font address
ld (ix+33),a
ret
|
test/Succeed/Issue3662.agda | cruhland/agda | 1,989 | 9946 | <filename>test/Succeed/Issue3662.agda
-- Andreas, 2018-04-10, issue #3662.
-- Regression in the termination checker introduced together
-- with collecting function calls also in the type signatures
-- (fix of #1556).
record T : Set₂ where
field
Carr : Set₁
op : Carr → Carr
test : T
T.Carr test = Set
T.op test c = Aux
where
postulate Aux : Set
-- Aux : (c : T.Carr test) → Set
-- ^^^^^^^^^^^
-- Since c as a module parameter to the where-module is parameter of Aux,
-- it contains a recursive call if we also mine type signatures for calls
-- (#1556).
--
-- We get then
--
-- test .op c --> test .Carr
--
-- which is not a decreasing call.
-- However, the call does not compose with itself, thus, with
-- Hyvernat-termination it would not give a false termination alarm.
-- Should termination check.
|
echo.asm | yonigev/OSAssignment2 | 0 | 172057 |
_echo: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 53 push %ebx
e: 51 push %ecx
f: 83 ec 10 sub $0x10,%esp
12: 89 cb mov %ecx,%ebx
int i;
for(i = 1; i < argc; i++)
14: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
1b: eb 3c jmp 59 <main+0x59>
printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n");
1d: 8b 45 f4 mov -0xc(%ebp),%eax
20: 83 c0 01 add $0x1,%eax
23: 3b 03 cmp (%ebx),%eax
25: 7d 07 jge 2e <main+0x2e>
27: ba 01 08 00 00 mov $0x801,%edx
2c: eb 05 jmp 33 <main+0x33>
2e: ba 03 08 00 00 mov $0x803,%edx
33: 8b 45 f4 mov -0xc(%ebp),%eax
36: 8d 0c 85 00 00 00 00 lea 0x0(,%eax,4),%ecx
3d: 8b 43 04 mov 0x4(%ebx),%eax
40: 01 c8 add %ecx,%eax
42: 8b 00 mov (%eax),%eax
44: 52 push %edx
45: 50 push %eax
46: 68 05 08 00 00 push $0x805
4b: 6a 01 push $0x1
4d: e8 f9 03 00 00 call 44b <printf>
52: 83 c4 10 add $0x10,%esp
int
main(int argc, char *argv[])
{
int i;
for(i = 1; i < argc; i++)
55: 83 45 f4 01 addl $0x1,-0xc(%ebp)
59: 8b 45 f4 mov -0xc(%ebp),%eax
5c: 3b 03 cmp (%ebx),%eax
5e: 7c bd jl 1d <main+0x1d>
printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n");
exit();
60: e8 57 02 00 00 call 2bc <exit>
00000065 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
65: 55 push %ebp
66: 89 e5 mov %esp,%ebp
68: 57 push %edi
69: 53 push %ebx
asm volatile("cld; rep stosb" :
6a: 8b 4d 08 mov 0x8(%ebp),%ecx
6d: 8b 55 10 mov 0x10(%ebp),%edx
70: 8b 45 0c mov 0xc(%ebp),%eax
73: 89 cb mov %ecx,%ebx
75: 89 df mov %ebx,%edi
77: 89 d1 mov %edx,%ecx
79: fc cld
7a: f3 aa rep stos %al,%es:(%edi)
7c: 89 ca mov %ecx,%edx
7e: 89 fb mov %edi,%ebx
80: 89 5d 08 mov %ebx,0x8(%ebp)
83: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
86: 90 nop
87: 5b pop %ebx
88: 5f pop %edi
89: 5d pop %ebp
8a: c3 ret
0000008b <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
8b: 55 push %ebp
8c: 89 e5 mov %esp,%ebp
8e: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
91: 8b 45 08 mov 0x8(%ebp),%eax
94: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
97: 90 nop
98: 8b 45 08 mov 0x8(%ebp),%eax
9b: 8d 50 01 lea 0x1(%eax),%edx
9e: 89 55 08 mov %edx,0x8(%ebp)
a1: 8b 55 0c mov 0xc(%ebp),%edx
a4: 8d 4a 01 lea 0x1(%edx),%ecx
a7: 89 4d 0c mov %ecx,0xc(%ebp)
aa: 0f b6 12 movzbl (%edx),%edx
ad: 88 10 mov %dl,(%eax)
af: 0f b6 00 movzbl (%eax),%eax
b2: 84 c0 test %al,%al
b4: 75 e2 jne 98 <strcpy+0xd>
;
return os;
b6: 8b 45 fc mov -0x4(%ebp),%eax
}
b9: c9 leave
ba: c3 ret
000000bb <strcmp>:
int
strcmp(const char *p, const char *q)
{
bb: 55 push %ebp
bc: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
be: eb 08 jmp c8 <strcmp+0xd>
p++, q++;
c0: 83 45 08 01 addl $0x1,0x8(%ebp)
c4: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
c8: 8b 45 08 mov 0x8(%ebp),%eax
cb: 0f b6 00 movzbl (%eax),%eax
ce: 84 c0 test %al,%al
d0: 74 10 je e2 <strcmp+0x27>
d2: 8b 45 08 mov 0x8(%ebp),%eax
d5: 0f b6 10 movzbl (%eax),%edx
d8: 8b 45 0c mov 0xc(%ebp),%eax
db: 0f b6 00 movzbl (%eax),%eax
de: 38 c2 cmp %al,%dl
e0: 74 de je c0 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
e2: 8b 45 08 mov 0x8(%ebp),%eax
e5: 0f b6 00 movzbl (%eax),%eax
e8: 0f b6 d0 movzbl %al,%edx
eb: 8b 45 0c mov 0xc(%ebp),%eax
ee: 0f b6 00 movzbl (%eax),%eax
f1: 0f b6 c0 movzbl %al,%eax
f4: 29 c2 sub %eax,%edx
f6: 89 d0 mov %edx,%eax
}
f8: 5d pop %ebp
f9: c3 ret
000000fa <strlen>:
uint
strlen(char *s)
{
fa: 55 push %ebp
fb: 89 e5 mov %esp,%ebp
fd: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
100: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
107: eb 04 jmp 10d <strlen+0x13>
109: 83 45 fc 01 addl $0x1,-0x4(%ebp)
10d: 8b 55 fc mov -0x4(%ebp),%edx
110: 8b 45 08 mov 0x8(%ebp),%eax
113: 01 d0 add %edx,%eax
115: 0f b6 00 movzbl (%eax),%eax
118: 84 c0 test %al,%al
11a: 75 ed jne 109 <strlen+0xf>
;
return n;
11c: 8b 45 fc mov -0x4(%ebp),%eax
}
11f: c9 leave
120: c3 ret
00000121 <memset>:
void*
memset(void *dst, int c, uint n)
{
121: 55 push %ebp
122: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
124: 8b 45 10 mov 0x10(%ebp),%eax
127: 50 push %eax
128: ff 75 0c pushl 0xc(%ebp)
12b: ff 75 08 pushl 0x8(%ebp)
12e: e8 32 ff ff ff call 65 <stosb>
133: 83 c4 0c add $0xc,%esp
return dst;
136: 8b 45 08 mov 0x8(%ebp),%eax
}
139: c9 leave
13a: c3 ret
0000013b <strchr>:
char*
strchr(const char *s, char c)
{
13b: 55 push %ebp
13c: 89 e5 mov %esp,%ebp
13e: 83 ec 04 sub $0x4,%esp
141: 8b 45 0c mov 0xc(%ebp),%eax
144: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
147: eb 14 jmp 15d <strchr+0x22>
if(*s == c)
149: 8b 45 08 mov 0x8(%ebp),%eax
14c: 0f b6 00 movzbl (%eax),%eax
14f: 3a 45 fc cmp -0x4(%ebp),%al
152: 75 05 jne 159 <strchr+0x1e>
return (char*)s;
154: 8b 45 08 mov 0x8(%ebp),%eax
157: eb 13 jmp 16c <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
159: 83 45 08 01 addl $0x1,0x8(%ebp)
15d: 8b 45 08 mov 0x8(%ebp),%eax
160: 0f b6 00 movzbl (%eax),%eax
163: 84 c0 test %al,%al
165: 75 e2 jne 149 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
167: b8 00 00 00 00 mov $0x0,%eax
}
16c: c9 leave
16d: c3 ret
0000016e <gets>:
char*
gets(char *buf, int max)
{
16e: 55 push %ebp
16f: 89 e5 mov %esp,%ebp
171: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
174: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
17b: eb 42 jmp 1bf <gets+0x51>
cc = read(0, &c, 1);
17d: 83 ec 04 sub $0x4,%esp
180: 6a 01 push $0x1
182: 8d 45 ef lea -0x11(%ebp),%eax
185: 50 push %eax
186: 6a 00 push $0x0
188: e8 47 01 00 00 call 2d4 <read>
18d: 83 c4 10 add $0x10,%esp
190: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
193: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
197: 7e 33 jle 1cc <gets+0x5e>
break;
buf[i++] = c;
199: 8b 45 f4 mov -0xc(%ebp),%eax
19c: 8d 50 01 lea 0x1(%eax),%edx
19f: 89 55 f4 mov %edx,-0xc(%ebp)
1a2: 89 c2 mov %eax,%edx
1a4: 8b 45 08 mov 0x8(%ebp),%eax
1a7: 01 c2 add %eax,%edx
1a9: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1ad: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
1af: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1b3: 3c 0a cmp $0xa,%al
1b5: 74 16 je 1cd <gets+0x5f>
1b7: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1bb: 3c 0d cmp $0xd,%al
1bd: 74 0e je 1cd <gets+0x5f>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1bf: 8b 45 f4 mov -0xc(%ebp),%eax
1c2: 83 c0 01 add $0x1,%eax
1c5: 3b 45 0c cmp 0xc(%ebp),%eax
1c8: 7c b3 jl 17d <gets+0xf>
1ca: eb 01 jmp 1cd <gets+0x5f>
cc = read(0, &c, 1);
if(cc < 1)
break;
1cc: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1cd: 8b 55 f4 mov -0xc(%ebp),%edx
1d0: 8b 45 08 mov 0x8(%ebp),%eax
1d3: 01 d0 add %edx,%eax
1d5: c6 00 00 movb $0x0,(%eax)
return buf;
1d8: 8b 45 08 mov 0x8(%ebp),%eax
}
1db: c9 leave
1dc: c3 ret
000001dd <stat>:
int
stat(char *n, struct stat *st)
{
1dd: 55 push %ebp
1de: 89 e5 mov %esp,%ebp
1e0: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
1e3: 83 ec 08 sub $0x8,%esp
1e6: 6a 00 push $0x0
1e8: ff 75 08 pushl 0x8(%ebp)
1eb: e8 0c 01 00 00 call 2fc <open>
1f0: 83 c4 10 add $0x10,%esp
1f3: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
1f6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1fa: 79 07 jns 203 <stat+0x26>
return -1;
1fc: b8 ff ff ff ff mov $0xffffffff,%eax
201: eb 25 jmp 228 <stat+0x4b>
r = fstat(fd, st);
203: 83 ec 08 sub $0x8,%esp
206: ff 75 0c pushl 0xc(%ebp)
209: ff 75 f4 pushl -0xc(%ebp)
20c: e8 03 01 00 00 call 314 <fstat>
211: 83 c4 10 add $0x10,%esp
214: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
217: 83 ec 0c sub $0xc,%esp
21a: ff 75 f4 pushl -0xc(%ebp)
21d: e8 c2 00 00 00 call 2e4 <close>
222: 83 c4 10 add $0x10,%esp
return r;
225: 8b 45 f0 mov -0x10(%ebp),%eax
}
228: c9 leave
229: c3 ret
0000022a <atoi>:
int
atoi(const char *s)
{
22a: 55 push %ebp
22b: 89 e5 mov %esp,%ebp
22d: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
230: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
237: eb 25 jmp 25e <atoi+0x34>
n = n*10 + *s++ - '0';
239: 8b 55 fc mov -0x4(%ebp),%edx
23c: 89 d0 mov %edx,%eax
23e: c1 e0 02 shl $0x2,%eax
241: 01 d0 add %edx,%eax
243: 01 c0 add %eax,%eax
245: 89 c1 mov %eax,%ecx
247: 8b 45 08 mov 0x8(%ebp),%eax
24a: 8d 50 01 lea 0x1(%eax),%edx
24d: 89 55 08 mov %edx,0x8(%ebp)
250: 0f b6 00 movzbl (%eax),%eax
253: 0f be c0 movsbl %al,%eax
256: 01 c8 add %ecx,%eax
258: 83 e8 30 sub $0x30,%eax
25b: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
25e: 8b 45 08 mov 0x8(%ebp),%eax
261: 0f b6 00 movzbl (%eax),%eax
264: 3c 2f cmp $0x2f,%al
266: 7e 0a jle 272 <atoi+0x48>
268: 8b 45 08 mov 0x8(%ebp),%eax
26b: 0f b6 00 movzbl (%eax),%eax
26e: 3c 39 cmp $0x39,%al
270: 7e c7 jle 239 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
272: 8b 45 fc mov -0x4(%ebp),%eax
}
275: c9 leave
276: c3 ret
00000277 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
277: 55 push %ebp
278: 89 e5 mov %esp,%ebp
27a: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
27d: 8b 45 08 mov 0x8(%ebp),%eax
280: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
283: 8b 45 0c mov 0xc(%ebp),%eax
286: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
289: eb 17 jmp 2a2 <memmove+0x2b>
*dst++ = *src++;
28b: 8b 45 fc mov -0x4(%ebp),%eax
28e: 8d 50 01 lea 0x1(%eax),%edx
291: 89 55 fc mov %edx,-0x4(%ebp)
294: 8b 55 f8 mov -0x8(%ebp),%edx
297: 8d 4a 01 lea 0x1(%edx),%ecx
29a: 89 4d f8 mov %ecx,-0x8(%ebp)
29d: 0f b6 12 movzbl (%edx),%edx
2a0: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2a2: 8b 45 10 mov 0x10(%ebp),%eax
2a5: 8d 50 ff lea -0x1(%eax),%edx
2a8: 89 55 10 mov %edx,0x10(%ebp)
2ab: 85 c0 test %eax,%eax
2ad: 7f dc jg 28b <memmove+0x14>
*dst++ = *src++;
return vdst;
2af: 8b 45 08 mov 0x8(%ebp),%eax
}
2b2: c9 leave
2b3: c3 ret
000002b4 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2b4: b8 01 00 00 00 mov $0x1,%eax
2b9: cd 40 int $0x40
2bb: c3 ret
000002bc <exit>:
SYSCALL(exit)
2bc: b8 02 00 00 00 mov $0x2,%eax
2c1: cd 40 int $0x40
2c3: c3 ret
000002c4 <wait>:
SYSCALL(wait)
2c4: b8 03 00 00 00 mov $0x3,%eax
2c9: cd 40 int $0x40
2cb: c3 ret
000002cc <pipe>:
SYSCALL(pipe)
2cc: b8 04 00 00 00 mov $0x4,%eax
2d1: cd 40 int $0x40
2d3: c3 ret
000002d4 <read>:
SYSCALL(read)
2d4: b8 05 00 00 00 mov $0x5,%eax
2d9: cd 40 int $0x40
2db: c3 ret
000002dc <write>:
SYSCALL(write)
2dc: b8 10 00 00 00 mov $0x10,%eax
2e1: cd 40 int $0x40
2e3: c3 ret
000002e4 <close>:
SYSCALL(close)
2e4: b8 15 00 00 00 mov $0x15,%eax
2e9: cd 40 int $0x40
2eb: c3 ret
000002ec <kill>:
SYSCALL(kill)
2ec: b8 06 00 00 00 mov $0x6,%eax
2f1: cd 40 int $0x40
2f3: c3 ret
000002f4 <exec>:
SYSCALL(exec)
2f4: b8 07 00 00 00 mov $0x7,%eax
2f9: cd 40 int $0x40
2fb: c3 ret
000002fc <open>:
SYSCALL(open)
2fc: b8 0f 00 00 00 mov $0xf,%eax
301: cd 40 int $0x40
303: c3 ret
00000304 <mknod>:
SYSCALL(mknod)
304: b8 11 00 00 00 mov $0x11,%eax
309: cd 40 int $0x40
30b: c3 ret
0000030c <unlink>:
SYSCALL(unlink)
30c: b8 12 00 00 00 mov $0x12,%eax
311: cd 40 int $0x40
313: c3 ret
00000314 <fstat>:
SYSCALL(fstat)
314: b8 08 00 00 00 mov $0x8,%eax
319: cd 40 int $0x40
31b: c3 ret
0000031c <link>:
SYSCALL(link)
31c: b8 13 00 00 00 mov $0x13,%eax
321: cd 40 int $0x40
323: c3 ret
00000324 <mkdir>:
SYSCALL(mkdir)
324: b8 14 00 00 00 mov $0x14,%eax
329: cd 40 int $0x40
32b: c3 ret
0000032c <chdir>:
SYSCALL(chdir)
32c: b8 09 00 00 00 mov $0x9,%eax
331: cd 40 int $0x40
333: c3 ret
00000334 <dup>:
SYSCALL(dup)
334: b8 0a 00 00 00 mov $0xa,%eax
339: cd 40 int $0x40
33b: c3 ret
0000033c <getpid>:
SYSCALL(getpid)
33c: b8 0b 00 00 00 mov $0xb,%eax
341: cd 40 int $0x40
343: c3 ret
00000344 <sbrk>:
SYSCALL(sbrk)
344: b8 0c 00 00 00 mov $0xc,%eax
349: cd 40 int $0x40
34b: c3 ret
0000034c <sleep>:
SYSCALL(sleep)
34c: b8 0d 00 00 00 mov $0xd,%eax
351: cd 40 int $0x40
353: c3 ret
00000354 <uptime>:
SYSCALL(uptime)
354: b8 0e 00 00 00 mov $0xe,%eax
359: cd 40 int $0x40
35b: c3 ret
0000035c <sigprocmask>:
SYSCALL(sigprocmask)
35c: b8 16 00 00 00 mov $0x16,%eax
361: cd 40 int $0x40
363: c3 ret
00000364 <signal>:
SYSCALL(signal)
364: b8 17 00 00 00 mov $0x17,%eax
369: cd 40 int $0x40
36b: c3 ret
0000036c <sigret>:
SYSCALL(sigret)
36c: b8 18 00 00 00 mov $0x18,%eax
371: cd 40 int $0x40
373: c3 ret
00000374 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
374: 55 push %ebp
375: 89 e5 mov %esp,%ebp
377: 83 ec 18 sub $0x18,%esp
37a: 8b 45 0c mov 0xc(%ebp),%eax
37d: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
380: 83 ec 04 sub $0x4,%esp
383: 6a 01 push $0x1
385: 8d 45 f4 lea -0xc(%ebp),%eax
388: 50 push %eax
389: ff 75 08 pushl 0x8(%ebp)
38c: e8 4b ff ff ff call 2dc <write>
391: 83 c4 10 add $0x10,%esp
}
394: 90 nop
395: c9 leave
396: c3 ret
00000397 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
397: 55 push %ebp
398: 89 e5 mov %esp,%ebp
39a: 53 push %ebx
39b: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
39e: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
3a5: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
3a9: 74 17 je 3c2 <printint+0x2b>
3ab: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
3af: 79 11 jns 3c2 <printint+0x2b>
neg = 1;
3b1: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
3b8: 8b 45 0c mov 0xc(%ebp),%eax
3bb: f7 d8 neg %eax
3bd: 89 45 ec mov %eax,-0x14(%ebp)
3c0: eb 06 jmp 3c8 <printint+0x31>
} else {
x = xx;
3c2: 8b 45 0c mov 0xc(%ebp),%eax
3c5: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
3c8: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
3cf: 8b 4d f4 mov -0xc(%ebp),%ecx
3d2: 8d 41 01 lea 0x1(%ecx),%eax
3d5: 89 45 f4 mov %eax,-0xc(%ebp)
3d8: 8b 5d 10 mov 0x10(%ebp),%ebx
3db: 8b 45 ec mov -0x14(%ebp),%eax
3de: ba 00 00 00 00 mov $0x0,%edx
3e3: f7 f3 div %ebx
3e5: 89 d0 mov %edx,%eax
3e7: 0f b6 80 60 0a 00 00 movzbl 0xa60(%eax),%eax
3ee: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
3f2: 8b 5d 10 mov 0x10(%ebp),%ebx
3f5: 8b 45 ec mov -0x14(%ebp),%eax
3f8: ba 00 00 00 00 mov $0x0,%edx
3fd: f7 f3 div %ebx
3ff: 89 45 ec mov %eax,-0x14(%ebp)
402: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
406: 75 c7 jne 3cf <printint+0x38>
if(neg)
408: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
40c: 74 2d je 43b <printint+0xa4>
buf[i++] = '-';
40e: 8b 45 f4 mov -0xc(%ebp),%eax
411: 8d 50 01 lea 0x1(%eax),%edx
414: 89 55 f4 mov %edx,-0xc(%ebp)
417: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
41c: eb 1d jmp 43b <printint+0xa4>
putc(fd, buf[i]);
41e: 8d 55 dc lea -0x24(%ebp),%edx
421: 8b 45 f4 mov -0xc(%ebp),%eax
424: 01 d0 add %edx,%eax
426: 0f b6 00 movzbl (%eax),%eax
429: 0f be c0 movsbl %al,%eax
42c: 83 ec 08 sub $0x8,%esp
42f: 50 push %eax
430: ff 75 08 pushl 0x8(%ebp)
433: e8 3c ff ff ff call 374 <putc>
438: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
43b: 83 6d f4 01 subl $0x1,-0xc(%ebp)
43f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
443: 79 d9 jns 41e <printint+0x87>
putc(fd, buf[i]);
}
445: 90 nop
446: 8b 5d fc mov -0x4(%ebp),%ebx
449: c9 leave
44a: c3 ret
0000044b <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
44b: 55 push %ebp
44c: 89 e5 mov %esp,%ebp
44e: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
451: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
458: 8d 45 0c lea 0xc(%ebp),%eax
45b: 83 c0 04 add $0x4,%eax
45e: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
461: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
468: e9 59 01 00 00 jmp 5c6 <printf+0x17b>
c = fmt[i] & 0xff;
46d: 8b 55 0c mov 0xc(%ebp),%edx
470: 8b 45 f0 mov -0x10(%ebp),%eax
473: 01 d0 add %edx,%eax
475: 0f b6 00 movzbl (%eax),%eax
478: 0f be c0 movsbl %al,%eax
47b: 25 ff 00 00 00 and $0xff,%eax
480: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
483: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
487: 75 2c jne 4b5 <printf+0x6a>
if(c == '%'){
489: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
48d: 75 0c jne 49b <printf+0x50>
state = '%';
48f: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
496: e9 27 01 00 00 jmp 5c2 <printf+0x177>
} else {
putc(fd, c);
49b: 8b 45 e4 mov -0x1c(%ebp),%eax
49e: 0f be c0 movsbl %al,%eax
4a1: 83 ec 08 sub $0x8,%esp
4a4: 50 push %eax
4a5: ff 75 08 pushl 0x8(%ebp)
4a8: e8 c7 fe ff ff call 374 <putc>
4ad: 83 c4 10 add $0x10,%esp
4b0: e9 0d 01 00 00 jmp 5c2 <printf+0x177>
}
} else if(state == '%'){
4b5: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
4b9: 0f 85 03 01 00 00 jne 5c2 <printf+0x177>
if(c == 'd'){
4bf: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
4c3: 75 1e jne 4e3 <printf+0x98>
printint(fd, *ap, 10, 1);
4c5: 8b 45 e8 mov -0x18(%ebp),%eax
4c8: 8b 00 mov (%eax),%eax
4ca: 6a 01 push $0x1
4cc: 6a 0a push $0xa
4ce: 50 push %eax
4cf: ff 75 08 pushl 0x8(%ebp)
4d2: e8 c0 fe ff ff call 397 <printint>
4d7: 83 c4 10 add $0x10,%esp
ap++;
4da: 83 45 e8 04 addl $0x4,-0x18(%ebp)
4de: e9 d8 00 00 00 jmp 5bb <printf+0x170>
} else if(c == 'x' || c == 'p'){
4e3: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
4e7: 74 06 je 4ef <printf+0xa4>
4e9: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
4ed: 75 1e jne 50d <printf+0xc2>
printint(fd, *ap, 16, 0);
4ef: 8b 45 e8 mov -0x18(%ebp),%eax
4f2: 8b 00 mov (%eax),%eax
4f4: 6a 00 push $0x0
4f6: 6a 10 push $0x10
4f8: 50 push %eax
4f9: ff 75 08 pushl 0x8(%ebp)
4fc: e8 96 fe ff ff call 397 <printint>
501: 83 c4 10 add $0x10,%esp
ap++;
504: 83 45 e8 04 addl $0x4,-0x18(%ebp)
508: e9 ae 00 00 00 jmp 5bb <printf+0x170>
} else if(c == 's'){
50d: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
511: 75 43 jne 556 <printf+0x10b>
s = (char*)*ap;
513: 8b 45 e8 mov -0x18(%ebp),%eax
516: 8b 00 mov (%eax),%eax
518: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
51b: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
51f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
523: 75 25 jne 54a <printf+0xff>
s = "(null)";
525: c7 45 f4 0a 08 00 00 movl $0x80a,-0xc(%ebp)
while(*s != 0){
52c: eb 1c jmp 54a <printf+0xff>
putc(fd, *s);
52e: 8b 45 f4 mov -0xc(%ebp),%eax
531: 0f b6 00 movzbl (%eax),%eax
534: 0f be c0 movsbl %al,%eax
537: 83 ec 08 sub $0x8,%esp
53a: 50 push %eax
53b: ff 75 08 pushl 0x8(%ebp)
53e: e8 31 fe ff ff call 374 <putc>
543: 83 c4 10 add $0x10,%esp
s++;
546: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
54a: 8b 45 f4 mov -0xc(%ebp),%eax
54d: 0f b6 00 movzbl (%eax),%eax
550: 84 c0 test %al,%al
552: 75 da jne 52e <printf+0xe3>
554: eb 65 jmp 5bb <printf+0x170>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
556: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
55a: 75 1d jne 579 <printf+0x12e>
putc(fd, *ap);
55c: 8b 45 e8 mov -0x18(%ebp),%eax
55f: 8b 00 mov (%eax),%eax
561: 0f be c0 movsbl %al,%eax
564: 83 ec 08 sub $0x8,%esp
567: 50 push %eax
568: ff 75 08 pushl 0x8(%ebp)
56b: e8 04 fe ff ff call 374 <putc>
570: 83 c4 10 add $0x10,%esp
ap++;
573: 83 45 e8 04 addl $0x4,-0x18(%ebp)
577: eb 42 jmp 5bb <printf+0x170>
} else if(c == '%'){
579: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
57d: 75 17 jne 596 <printf+0x14b>
putc(fd, c);
57f: 8b 45 e4 mov -0x1c(%ebp),%eax
582: 0f be c0 movsbl %al,%eax
585: 83 ec 08 sub $0x8,%esp
588: 50 push %eax
589: ff 75 08 pushl 0x8(%ebp)
58c: e8 e3 fd ff ff call 374 <putc>
591: 83 c4 10 add $0x10,%esp
594: eb 25 jmp 5bb <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
596: 83 ec 08 sub $0x8,%esp
599: 6a 25 push $0x25
59b: ff 75 08 pushl 0x8(%ebp)
59e: e8 d1 fd ff ff call 374 <putc>
5a3: 83 c4 10 add $0x10,%esp
putc(fd, c);
5a6: 8b 45 e4 mov -0x1c(%ebp),%eax
5a9: 0f be c0 movsbl %al,%eax
5ac: 83 ec 08 sub $0x8,%esp
5af: 50 push %eax
5b0: ff 75 08 pushl 0x8(%ebp)
5b3: e8 bc fd ff ff call 374 <putc>
5b8: 83 c4 10 add $0x10,%esp
}
state = 0;
5bb: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
5c2: 83 45 f0 01 addl $0x1,-0x10(%ebp)
5c6: 8b 55 0c mov 0xc(%ebp),%edx
5c9: 8b 45 f0 mov -0x10(%ebp),%eax
5cc: 01 d0 add %edx,%eax
5ce: 0f b6 00 movzbl (%eax),%eax
5d1: 84 c0 test %al,%al
5d3: 0f 85 94 fe ff ff jne 46d <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
5d9: 90 nop
5da: c9 leave
5db: c3 ret
000005dc <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
5dc: 55 push %ebp
5dd: 89 e5 mov %esp,%ebp
5df: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
5e2: 8b 45 08 mov 0x8(%ebp),%eax
5e5: 83 e8 08 sub $0x8,%eax
5e8: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5eb: a1 7c 0a 00 00 mov 0xa7c,%eax
5f0: 89 45 fc mov %eax,-0x4(%ebp)
5f3: eb 24 jmp 619 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5f5: 8b 45 fc mov -0x4(%ebp),%eax
5f8: 8b 00 mov (%eax),%eax
5fa: 3b 45 fc cmp -0x4(%ebp),%eax
5fd: 77 12 ja 611 <free+0x35>
5ff: 8b 45 f8 mov -0x8(%ebp),%eax
602: 3b 45 fc cmp -0x4(%ebp),%eax
605: 77 24 ja 62b <free+0x4f>
607: 8b 45 fc mov -0x4(%ebp),%eax
60a: 8b 00 mov (%eax),%eax
60c: 3b 45 f8 cmp -0x8(%ebp),%eax
60f: 77 1a ja 62b <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
611: 8b 45 fc mov -0x4(%ebp),%eax
614: 8b 00 mov (%eax),%eax
616: 89 45 fc mov %eax,-0x4(%ebp)
619: 8b 45 f8 mov -0x8(%ebp),%eax
61c: 3b 45 fc cmp -0x4(%ebp),%eax
61f: 76 d4 jbe 5f5 <free+0x19>
621: 8b 45 fc mov -0x4(%ebp),%eax
624: 8b 00 mov (%eax),%eax
626: 3b 45 f8 cmp -0x8(%ebp),%eax
629: 76 ca jbe 5f5 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
62b: 8b 45 f8 mov -0x8(%ebp),%eax
62e: 8b 40 04 mov 0x4(%eax),%eax
631: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
638: 8b 45 f8 mov -0x8(%ebp),%eax
63b: 01 c2 add %eax,%edx
63d: 8b 45 fc mov -0x4(%ebp),%eax
640: 8b 00 mov (%eax),%eax
642: 39 c2 cmp %eax,%edx
644: 75 24 jne 66a <free+0x8e>
bp->s.size += p->s.ptr->s.size;
646: 8b 45 f8 mov -0x8(%ebp),%eax
649: 8b 50 04 mov 0x4(%eax),%edx
64c: 8b 45 fc mov -0x4(%ebp),%eax
64f: 8b 00 mov (%eax),%eax
651: 8b 40 04 mov 0x4(%eax),%eax
654: 01 c2 add %eax,%edx
656: 8b 45 f8 mov -0x8(%ebp),%eax
659: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
65c: 8b 45 fc mov -0x4(%ebp),%eax
65f: 8b 00 mov (%eax),%eax
661: 8b 10 mov (%eax),%edx
663: 8b 45 f8 mov -0x8(%ebp),%eax
666: 89 10 mov %edx,(%eax)
668: eb 0a jmp 674 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
66a: 8b 45 fc mov -0x4(%ebp),%eax
66d: 8b 10 mov (%eax),%edx
66f: 8b 45 f8 mov -0x8(%ebp),%eax
672: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
674: 8b 45 fc mov -0x4(%ebp),%eax
677: 8b 40 04 mov 0x4(%eax),%eax
67a: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
681: 8b 45 fc mov -0x4(%ebp),%eax
684: 01 d0 add %edx,%eax
686: 3b 45 f8 cmp -0x8(%ebp),%eax
689: 75 20 jne 6ab <free+0xcf>
p->s.size += bp->s.size;
68b: 8b 45 fc mov -0x4(%ebp),%eax
68e: 8b 50 04 mov 0x4(%eax),%edx
691: 8b 45 f8 mov -0x8(%ebp),%eax
694: 8b 40 04 mov 0x4(%eax),%eax
697: 01 c2 add %eax,%edx
699: 8b 45 fc mov -0x4(%ebp),%eax
69c: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
69f: 8b 45 f8 mov -0x8(%ebp),%eax
6a2: 8b 10 mov (%eax),%edx
6a4: 8b 45 fc mov -0x4(%ebp),%eax
6a7: 89 10 mov %edx,(%eax)
6a9: eb 08 jmp 6b3 <free+0xd7>
} else
p->s.ptr = bp;
6ab: 8b 45 fc mov -0x4(%ebp),%eax
6ae: 8b 55 f8 mov -0x8(%ebp),%edx
6b1: 89 10 mov %edx,(%eax)
freep = p;
6b3: 8b 45 fc mov -0x4(%ebp),%eax
6b6: a3 7c 0a 00 00 mov %eax,0xa7c
}
6bb: 90 nop
6bc: c9 leave
6bd: c3 ret
000006be <morecore>:
static Header*
morecore(uint nu)
{
6be: 55 push %ebp
6bf: 89 e5 mov %esp,%ebp
6c1: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
6c4: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
6cb: 77 07 ja 6d4 <morecore+0x16>
nu = 4096;
6cd: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
6d4: 8b 45 08 mov 0x8(%ebp),%eax
6d7: c1 e0 03 shl $0x3,%eax
6da: 83 ec 0c sub $0xc,%esp
6dd: 50 push %eax
6de: e8 61 fc ff ff call 344 <sbrk>
6e3: 83 c4 10 add $0x10,%esp
6e6: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
6e9: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
6ed: 75 07 jne 6f6 <morecore+0x38>
return 0;
6ef: b8 00 00 00 00 mov $0x0,%eax
6f4: eb 26 jmp 71c <morecore+0x5e>
hp = (Header*)p;
6f6: 8b 45 f4 mov -0xc(%ebp),%eax
6f9: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
6fc: 8b 45 f0 mov -0x10(%ebp),%eax
6ff: 8b 55 08 mov 0x8(%ebp),%edx
702: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
705: 8b 45 f0 mov -0x10(%ebp),%eax
708: 83 c0 08 add $0x8,%eax
70b: 83 ec 0c sub $0xc,%esp
70e: 50 push %eax
70f: e8 c8 fe ff ff call 5dc <free>
714: 83 c4 10 add $0x10,%esp
return freep;
717: a1 7c 0a 00 00 mov 0xa7c,%eax
}
71c: c9 leave
71d: c3 ret
0000071e <malloc>:
void*
malloc(uint nbytes)
{
71e: 55 push %ebp
71f: 89 e5 mov %esp,%ebp
721: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
724: 8b 45 08 mov 0x8(%ebp),%eax
727: 83 c0 07 add $0x7,%eax
72a: c1 e8 03 shr $0x3,%eax
72d: 83 c0 01 add $0x1,%eax
730: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
733: a1 7c 0a 00 00 mov 0xa7c,%eax
738: 89 45 f0 mov %eax,-0x10(%ebp)
73b: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
73f: 75 23 jne 764 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
741: c7 45 f0 74 0a 00 00 movl $0xa74,-0x10(%ebp)
748: 8b 45 f0 mov -0x10(%ebp),%eax
74b: a3 7c 0a 00 00 mov %eax,0xa7c
750: a1 7c 0a 00 00 mov 0xa7c,%eax
755: a3 74 0a 00 00 mov %eax,0xa74
base.s.size = 0;
75a: c7 05 78 0a 00 00 00 movl $0x0,0xa78
761: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
764: 8b 45 f0 mov -0x10(%ebp),%eax
767: 8b 00 mov (%eax),%eax
769: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
76c: 8b 45 f4 mov -0xc(%ebp),%eax
76f: 8b 40 04 mov 0x4(%eax),%eax
772: 3b 45 ec cmp -0x14(%ebp),%eax
775: 72 4d jb 7c4 <malloc+0xa6>
if(p->s.size == nunits)
777: 8b 45 f4 mov -0xc(%ebp),%eax
77a: 8b 40 04 mov 0x4(%eax),%eax
77d: 3b 45 ec cmp -0x14(%ebp),%eax
780: 75 0c jne 78e <malloc+0x70>
prevp->s.ptr = p->s.ptr;
782: 8b 45 f4 mov -0xc(%ebp),%eax
785: 8b 10 mov (%eax),%edx
787: 8b 45 f0 mov -0x10(%ebp),%eax
78a: 89 10 mov %edx,(%eax)
78c: eb 26 jmp 7b4 <malloc+0x96>
else {
p->s.size -= nunits;
78e: 8b 45 f4 mov -0xc(%ebp),%eax
791: 8b 40 04 mov 0x4(%eax),%eax
794: 2b 45 ec sub -0x14(%ebp),%eax
797: 89 c2 mov %eax,%edx
799: 8b 45 f4 mov -0xc(%ebp),%eax
79c: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
79f: 8b 45 f4 mov -0xc(%ebp),%eax
7a2: 8b 40 04 mov 0x4(%eax),%eax
7a5: c1 e0 03 shl $0x3,%eax
7a8: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
7ab: 8b 45 f4 mov -0xc(%ebp),%eax
7ae: 8b 55 ec mov -0x14(%ebp),%edx
7b1: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
7b4: 8b 45 f0 mov -0x10(%ebp),%eax
7b7: a3 7c 0a 00 00 mov %eax,0xa7c
return (void*)(p + 1);
7bc: 8b 45 f4 mov -0xc(%ebp),%eax
7bf: 83 c0 08 add $0x8,%eax
7c2: eb 3b jmp 7ff <malloc+0xe1>
}
if(p == freep)
7c4: a1 7c 0a 00 00 mov 0xa7c,%eax
7c9: 39 45 f4 cmp %eax,-0xc(%ebp)
7cc: 75 1e jne 7ec <malloc+0xce>
if((p = morecore(nunits)) == 0)
7ce: 83 ec 0c sub $0xc,%esp
7d1: ff 75 ec pushl -0x14(%ebp)
7d4: e8 e5 fe ff ff call 6be <morecore>
7d9: 83 c4 10 add $0x10,%esp
7dc: 89 45 f4 mov %eax,-0xc(%ebp)
7df: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
7e3: 75 07 jne 7ec <malloc+0xce>
return 0;
7e5: b8 00 00 00 00 mov $0x0,%eax
7ea: eb 13 jmp 7ff <malloc+0xe1>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
7ec: 8b 45 f4 mov -0xc(%ebp),%eax
7ef: 89 45 f0 mov %eax,-0x10(%ebp)
7f2: 8b 45 f4 mov -0xc(%ebp),%eax
7f5: 8b 00 mov (%eax),%eax
7f7: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
7fa: e9 6d ff ff ff jmp 76c <malloc+0x4e>
}
7ff: c9 leave
800: c3 ret
|
source/oasis/program-elements-derived_types.ads | reznikmm/gela | 0 | 16534 | -- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Type_Definitions;
with Program.Lexical_Elements;
with Program.Elements.Subtype_Indications;
package Program.Elements.Derived_Types is
pragma Pure (Program.Elements.Derived_Types);
type Derived_Type is
limited interface and Program.Elements.Type_Definitions.Type_Definition;
type Derived_Type_Access is access all Derived_Type'Class
with Storage_Size => 0;
not overriding function Parent
(Self : Derived_Type)
return not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access is abstract;
not overriding function Has_Abstract (Self : Derived_Type) return Boolean
is abstract;
not overriding function Has_Limited (Self : Derived_Type) return Boolean
is abstract;
type Derived_Type_Text is limited interface;
type Derived_Type_Text_Access is access all Derived_Type_Text'Class
with Storage_Size => 0;
not overriding function To_Derived_Type_Text
(Self : in out Derived_Type)
return Derived_Type_Text_Access is abstract;
not overriding function Abstract_Token
(Self : Derived_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Limited_Token
(Self : Derived_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function New_Token
(Self : Derived_Type_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Derived_Types;
|
software/minol/minol.asm | paulscottrobson/retrochallenge-jan-2016 | 0 | 94818 | ; ****************************************************************************************************************
; ****************************************************************************************************************
;
; Minol ROM Image
;
; ****************************************************************************************************************
; ****************************************************************************************************************
cpu sc/mp
include source\memorymacros.asm ; Memory allocation and Macro definition.
include source\errors.asm ; Error codes
; ****************************************************************************************************************
; Main Program
; ****************************************************************************************************************
org 0x9000 ; the ROM starts here
db 0x68 ; this makes it boot straight into this ROM.
lpi p2,0xFFF ; set up top stack value
FindTOS:
ldi 0x75 ; can we write there, if so, found TOS.
st (p2)
xor (p2)
jz StackFound
ld -64(p2) ; wind backwards 64 bytes
jmp FindTOS
StackFound:
; include democode.asm
StartUp:
lpi p3,Print-1 ; Print Boot Message
lpi p1,BootMessage
ldi 0
xppc p3
lpi p3,ProgramBase ; check to see if MINOL code resident.
ld -4(p3) ; which requires the 4 byte markers to be loaded.
xri Marker1
jnz RunNew
ld -3(p3)
xri Marker2
jnz RunNew
ld -2(p3)
xri Marker3
jnz RunNew
ld -1(p3)
xri Marker4
jnz RunNew
lpi p3,ConsoleStart-1 ; run the console if code present
scl ; non-error (so it prints ok)
xppc p3
RunNew: ; otherwise execute NEW.
lpi p3,CMD_New-1
xppc p3
BootMessage:
db 12,"** MINOL **",13,"V0.94 PSR 2016",13,0
; ****************************************************************************************************************
; Source Files
; ****************************************************************************************************************
include source\itoa.asm ; print integer routine.
include source\atoi.asm ; decode integer routine.
include source\execute.asm ; statement exec main loop
include source\manager.asm ; manage program lines.
include source\console.asm ; console type in etc.
|
src/sprites/ball11.asm | bitshifters/teletextr | 8 | 95854 | <gh_stars>1-10
\\ Input file 'ball11.png'
\\ Image size=12x15 pixels=12x15
.ball11
EQUB 6, 5 ;char width, char height
.ball11_data
.ball11_data_00 ; x_offset=0, y_offset=0
EQUB 32,120,124,124,48,32
EQUB 106,127,127,116,123,32
EQUB 42,127,127,127,63,32
EQUB 32,34,35,35,32,32
EQUB 32,32,32,32,32,32
.ball11_data_10 ; x_offset=1, y_offset=0
EQUB 32,96,124,124,116,32
EQUB 32,127,127,125,114,53
EQUB 32,111,127,127,127,37
EQUB 32,32,35,35,33,32
EQUB 32,32,32,32,32,32
.ball11_data_01 ; x_offset=0, y_offset=1
EQUB 32,96,112,112,32,32
EQUB 104,127,127,51,109,32
EQUB 106,127,127,127,127,32
EQUB 32,43,47,47,33,32
EQUB 32,32,32,32,32,32
.ball11_data_11 ; x_offset=1, y_offset=1
EQUB 32,32,112,112,48,32
EQUB 32,126,127,119,43,52
EQUB 32,127,127,127,127,53
EQUB 32,34,47,47,39,32
EQUB 32,32,32,32,32,32
.ball11_data_02 ; x_offset=0, y_offset=2
EQUB 32,32,32,32,32,32
EQUB 96,126,127,47,116,32
EQUB 106,127,127,125,126,32
EQUB 34,111,127,127,39,32
EQUB 32,32,32,32,32,32
.ball11_data_12 ; x_offset=1, y_offset=2
EQUB 32,32,32,32,32,32
EQUB 32,120,127,63,109,48
EQUB 32,127,127,127,124,53
EQUB 32,43,127,127,63,33
EQUB 32,32,32,32,32,32
.ball11_mask
.ball11_mask_00 ; x_offset=0, y_offset=0
EQUB 191,161,160,160,171,255
EQUB 160,160,160,160,160,234
EQUB 176,160,160,160,160,250
EQUB 255,244,240,240,254,255
EQUB 255,255,255,255,255,255
.ball11_mask_10 ; x_offset=1, y_offset=0
EQUB 255,167,160,160,162,239
EQUB 181,160,160,160,160,160
EQUB 245,160,160,160,160,224
EQUB 255,253,240,240,248,255
EQUB 255,255,255,255,255,255
.ball11_mask_01 ; x_offset=0, y_offset=1
EQUB 255,167,163,163,239,255
EQUB 161,160,160,160,160,235
EQUB 160,160,160,160,160,234
EQUB 253,176,160,160,248,255
EQUB 255,255,255,255,255,255
.ball11_mask_11 ; x_offset=1, y_offset=1
EQUB 255,191,163,163,171,255
EQUB 183,160,160,160,160,162
EQUB 181,160,160,160,160,160
EQUB 255,244,160,160,224,254
EQUB 255,255,255,255,255,255
.ball11_mask_02 ; x_offset=0, y_offset=2
EQUB 255,191,175,175,255,255
EQUB 167,160,160,160,162,239
EQUB 160,160,160,160,160,234
EQUB 244,160,160,160,224,254
EQUB 255,253,252,252,255,255
.ball11_mask_12 ; x_offset=1, y_offset=2
EQUB 255,255,175,175,239,255
EQUB 191,161,160,160,160,171
EQUB 181,160,160,160,160,160
EQUB 253,176,160,160,160,248
EQUB 255,255,252,252,254,255
|
archive/agda-1/UnifyWith.agda | m0davis/oscar | 0 | 16848 | <filename>archive/agda-1/UnifyWith.agda
open import Relation.Binary using (IsDecEquivalence)
open import Agda.Builtin.Equality
module UnifyWith (FunctionName : Set) ⦃ isDecEquivalenceA : IsDecEquivalence (_≡_ {A = FunctionName}) ⦄ where
open import UnifyTermF FunctionName
open import UnifyMguF FunctionName
open import UnifyMguCorrectF FunctionName
open import Data.Fin using (Fin; suc; zero)
open import Data.Nat hiding (_≤_)
open import Relation.Binary.PropositionalEquality renaming ([_] to [[_]])
open import Function using (_∘_; id; case_of_; _$_; flip)
open import Relation.Nullary
open import Data.Product renaming (map to _***_)
open import Data.Empty
open import Data.Maybe
open import Category.Functor
open import Category.Monad
import Level
open RawMonad (Data.Maybe.monad {Level.zero})
open import Data.Sum
open import Data.Maybe using (maybe; maybe′; nothing; just; monad; Maybe)
open import Data.List renaming (_++_ to _++L_)
open ≡-Reasoning
open import Data.Vec using (Vec; []; _∷_) renaming (_++_ to _++V_; map to mapV)
open import Data.Unit
-- moved to UnifyMguCorrectF
|
src/frontend/Experimental_Ada_ROSE_Connection/dot_asis/research/ada_main.adb | sourceryinstitute/rose-sourcery-institute | 0 | 30518 | <reponame>sourceryinstitute/rose-sourcery-institute<filename>src/frontend/Experimental_Ada_ROSE_Connection/dot_asis/research/ada_main.adb
with Ada.Text_IO;
procedure Ada_Main is
procedure C_Func;
pragma Import (C, C_Func);
package ATI renames Ada.Text_Io;
begin
ATI.Put_Line ("Ada_Main: Calling C_Func");
C_Func;
ATI.Put_Line ("Ada_Main: Returned from C_Func");
end Ada_Main;
|
oeis/280/A280344.asm | neoneye/loda-programs | 11 | 167938 | ; A280344: Number of 2 X 2 matrices with all elements in {0,...,n} with determinant = permanent^n.
; 0,12,30,56,90,132,182,240,306,380,462,552,650,756,870,992,1122,1260,1406,1560,1722,1892,2070,2256,2450,2652,2862,3080,3306,3540,3782,4032,4290,4556,4830,5112,5402,5700,6006,6320,6642,6972,7310,7656,8010,8372,8742,9120,9506,9900,10302,10712,11130,11556,11990,12432,12882,13340,13806,14280,14762,15252,15750,16256,16770,17292,17822,18360,18906,19460,20022,20592,21170,21756,22350,22952,23562,24180,24806,25440,26082,26732,27390,28056,28730,29412,30102,30800,31506,32220,32942,33672,34410,35156,35910
add $0,1
mul $0,2
lpb $0
bin $0,2
lpe
bin $0,2
mul $0,2
|
3-mid/impact/source/2d/dynamics/joints/impact-d2-joint-mouse.adb | charlie5/lace | 20 | 21042 | package body impact.d2.Joint.mouse
is
procedure dummy is begin null; end dummy;
-- #include <Box2D/Dynamics/Joints/b2MouseJoint.h>
-- #include <Box2D/Dynamics/b2Body.h>
-- #include <Box2D/Dynamics/b2TimeStep.h>
--
-- // p = attached point, m = mouse point
-- // C = p - m
-- // Cdot = v
-- // = v + cross(w, r)
-- // J = [I r_skew]
-- // Identity used:
-- // w k % (rx i + ry j) = w * (-ry i + rx j)
--
-- b2MouseJoint::b2MouseJoint(const b2MouseJointDef* def)
-- : b2Joint(def)
-- {
-- b2Assert(def->target.IsValid());
-- b2Assert(b2IsValid(def->maxForce) && def->maxForce >= 0.0f);
-- b2Assert(b2IsValid(def->frequencyHz) && def->frequencyHz >= 0.0f);
-- b2Assert(b2IsValid(def->dampingRatio) && def->dampingRatio >= 0.0f);
--
-- m_target = def->target;
-- m_localAnchor = b2MulT(m_bodyB->GetTransform(), m_target);
--
-- m_maxForce = def->maxForce;
-- m_impulse.SetZero();
--
-- m_frequencyHz = def->frequencyHz;
-- m_dampingRatio = def->dampingRatio;
--
-- m_beta = 0.0f;
-- m_gamma = 0.0f;
-- }
--
-- void b2MouseJoint::SetTarget(const b2Vec2& target)
-- {
-- if (m_bodyB->IsAwake() == false)
-- {
-- m_bodyB->SetAwake(true);
-- }
-- m_target = target;
-- }
--
-- const b2Vec2& b2MouseJoint::GetTarget() const
-- {
-- return m_target;
-- }
--
-- void b2MouseJoint::SetMaxForce(float32 force)
-- {
-- m_maxForce = force;
-- }
--
-- float32 b2MouseJoint::GetMaxForce() const
-- {
-- return m_maxForce;
-- }
--
-- void b2MouseJoint::SetFrequency(float32 hz)
-- {
-- m_frequencyHz = hz;
-- }
--
-- float32 b2MouseJoint::GetFrequency() const
-- {
-- return m_frequencyHz;
-- }
--
-- void b2MouseJoint::SetDampingRatio(float32 ratio)
-- {
-- m_dampingRatio = ratio;
-- }
--
-- float32 b2MouseJoint::GetDampingRatio() const
-- {
-- return m_dampingRatio;
-- }
--
-- void b2MouseJoint::InitVelocityConstraints(const b2TimeStep& step)
-- {
-- b2Body* b = m_bodyB;
--
-- float32 mass = b->GetMass();
--
-- // Frequency
-- float32 omega = 2.0f * b2_pi * m_frequencyHz;
--
-- // Damping coefficient
-- float32 d = 2.0f * mass * m_dampingRatio * omega;
--
-- // Spring stiffness
-- float32 k = mass * (omega * omega);
--
-- // magic formulas
-- // gamma has units of inverse mass.
-- // beta has units of inverse time.
-- b2Assert(d + step.dt * k > b2_epsilon);
-- m_gamma = step.dt * (d + step.dt * k);
-- if (m_gamma != 0.0f)
-- {
-- m_gamma = 1.0f / m_gamma;
-- }
-- m_beta = step.dt * k * m_gamma;
--
-- // Compute the effective mass matrix.
-- b2Vec2 r = b2Mul(b->GetTransform().R, m_localAnchor - b->GetLocalCenter());
--
-- // K = [(1/m1 + 1/m2) * eye(2) - skew(r1) * invI1 * skew(r1) - skew(r2) * invI2 * skew(r2)]
-- // = [1/m1+1/m2 0 ] + invI1 * [r1.y*r1.y -r1.x*r1.y] + invI2 * [r1.y*r1.y -r1.x*r1.y]
-- // [ 0 1/m1+1/m2] [-r1.x*r1.y r1.x*r1.x] [-r1.x*r1.y r1.x*r1.x]
-- float32 invMass = b->m_invMass;
-- float32 invI = b->m_invI;
--
-- b2Mat22 K1;
-- K1.col1.x = invMass; K1.col2.x = 0.0f;
-- K1.col1.y = 0.0f; K1.col2.y = invMass;
--
-- b2Mat22 K2;
-- K2.col1.x = invI * r.y * r.y; K2.col2.x = -invI * r.x * r.y;
-- K2.col1.y = -invI * r.x * r.y; K2.col2.y = invI * r.x * r.x;
--
-- b2Mat22 K = K1 + K2;
-- K.col1.x += m_gamma;
-- K.col2.y += m_gamma;
--
-- m_mass = K.GetInverse();
--
-- m_C = b->m_sweep.c + r - m_target;
--
-- // Cheat with some damping
-- b->m_angularVelocity *= 0.98f;
--
-- // Warm starting.
-- m_impulse *= step.dtRatio;
-- b->m_linearVelocity += invMass * m_impulse;
-- b->m_angularVelocity += invI * b2Cross(r, m_impulse);
-- }
--
-- void b2MouseJoint::SolveVelocityConstraints(const b2TimeStep& step)
-- {
-- b2Body* b = m_bodyB;
--
-- b2Vec2 r = b2Mul(b->GetTransform().R, m_localAnchor - b->GetLocalCenter());
--
-- // Cdot = v + cross(w, r)
-- b2Vec2 Cdot = b->m_linearVelocity + b2Cross(b->m_angularVelocity, r);
-- b2Vec2 impulse = b2Mul(m_mass, -(Cdot + m_beta * m_C + m_gamma * m_impulse));
--
-- b2Vec2 oldImpulse = m_impulse;
-- m_impulse += impulse;
-- float32 maxImpulse = step.dt * m_maxForce;
-- if (m_impulse.LengthSquared() > maxImpulse * maxImpulse)
-- {
-- m_impulse *= maxImpulse / m_impulse.Length();
-- }
-- impulse = m_impulse - oldImpulse;
--
-- b->m_linearVelocity += b->m_invMass * impulse;
-- b->m_angularVelocity += b->m_invI * b2Cross(r, impulse);
-- }
--
-- b2Vec2 b2MouseJoint::GetAnchorA() const
-- {
-- return m_target;
-- }
--
-- b2Vec2 b2MouseJoint::GetAnchorB() const
-- {
-- return m_bodyB->GetWorldPoint(m_localAnchor);
-- }
--
-- b2Vec2 b2MouseJoint::GetReactionForce(float32 inv_dt) const
-- {
-- return inv_dt * m_impulse;
-- }
--
-- float32 b2MouseJoint::GetReactionTorque(float32 inv_dt) const
-- {
-- return inv_dt * 0.0f;
-- }
end impact.d2.Joint.mouse;
|
Application Support/BBEdit/Packages/dStyle.bbpackage/Contents/Scripts/Editor action/New Line Below Current Line.applescript | bhdicaire/bbeditSetup | 0 | 2563 | <filename>Application Support/BBEdit/Packages/dStyle.bbpackage/Contents/Scripts/Editor action/New Line Below Current Line.applescript
-- <NAME> (@olivertaylor, http://olivertaylor.net) - June 2012
tell application "BBEdit"
tell text of front text window
set lineOfInsertionPoint to line (startLine of selection)
set end of lineOfInsertionPoint to "" & return
select insertion point after selection
end tell
end tell |
Type/Properties/Singleton/Proofs.agda | Lolirofle/stuff-in-agda | 6 | 13230 | <gh_stars>1-10
module Type.Properties.Singleton.Proofs where
import Data.Tuple as Tuple
open import Data.Proofs
open import Function.Axioms
open import Logic.Classical
open import Logic
import Lvl
open import Type.Properties.Empty
open import Type.Properties.Inhabited
open import Type.Properties.MereProposition
open import Type.Properties.Singleton
open import Logic.Propositional
open import Logic.Predicate
open import Structure.Setoid
open import Structure.Function
open import Structure.Operator
open import Structure.Relator.Equivalence
open import Structure.Relator.Properties
open import Structure.Type.Identity
open import Syntax.Function
open import Type.Dependent
open import Type
private variable ℓ ℓₑ ℓₑ₁ ℓₑ₂ ℓₑ₃ ℓₑ₄ ℓₑ₅ : Lvl.Level
private variable A B T U P : Type{ℓ}
module _ ⦃ equiv : Equiv{ℓₑ}(U) ⦄ where
unit-is-pos : ⦃ proof : IsUnit(U) ⦄ → ◊(U)
unit-is-pos ⦃ intro unit uniqueness ⦄ = intro ⦃ unit ⦄
unit-is-prop : ⦃ proof : IsUnit(U) ⦄ → MereProposition(U)
unit-is-prop ⦃ intro unit uniqueness ⦄ = intro (\{x}{y} → transitivity(_≡_) (uniqueness{x}) (symmetry(_≡_)(uniqueness{y})))
pos-prop-is-unit : ⦃ _ : (◊ U) ⦄ → ⦃ _ : MereProposition(U) ⦄ → IsUnit(U)
pos-prop-is-unit ⦃ intro ⦃ unit ⦄ ⦄ ⦃ intro uniqueness ⦄ = intro unit (\{x} → uniqueness{x}{unit})
module _ ⦃ equiv-p : Equiv{ℓₑ}(P) ⦄ ⦃ prop-p : MereProposition(P) ⦄ ⦃ equiv-a : Equiv{ℓₑ₁}(A) ⦄ where
prop-fn-unique-value : ∀{f : P → A} → ⦃ _ : Function(f) ⦄ → (∀{x y} → (f(x) ≡ f(y)))
prop-fn-unique-value {f = f}{x}{y} = congruence₁(f) (MereProposition.uniqueness(prop-p){x}{y})
module _ ⦃ equiv-u : Equiv{ℓₑ}(U) ⦄ ⦃ unit-u : IsUnit(U) ⦄ ⦃ equiv-a : Equiv{ℓₑ₁}(A) ⦄ where
unit-fn-unique-value : ∀{f : U → A} → ⦃ _ : Function(f) ⦄ → (∀{x y} → (f(x) ≡ f(y)))
unit-fn-unique-value = prop-fn-unique-value ⦃ prop-p = unit-is-prop ⦃ proof = unit-u ⦄ ⦄
module _
⦃ equiv-a : Equiv{ℓₑ₁}(A) ⦄
⦃ equiv-b : Equiv{ℓₑ₂}(B) ⦄
⦃ equiv-ab : Equiv{ℓₑ₃}(A ∧ B) ⦄
⦃ op : BinaryOperator([∧]-intro) ⦄ where
instance
prop-conjunction : ⦃ prop-a : MereProposition(A) ⦄ ⦃ prop-b : MereProposition(B) ⦄ → MereProposition(A ∧ B)
MereProposition.uniqueness prop-conjunction {[∧]-intro a₁ b₁} {[∧]-intro a₂ b₂} = congruence₂([∧]-intro) (uniqueness(A)) (uniqueness(B))
module _
⦃ equiv-b : Equiv{ℓₑ₁}(B) ⦄
⦃ equiv-ab : Equiv{ℓₑ₂}(A → B) ⦄
⦃ funcExt : FunctionExtensionality(A)(B) ⦄
where
prop-implication : ⦃ prop-b : MereProposition(B) ⦄ → MereProposition(A → B)
MereProposition.uniqueness prop-implication = functionExtensionality(A)(B) (uniqueness(B))
module _
{B : A → Type{ℓ}}
⦃ equiv-b : ∀{a} → Equiv{ℓₑ₁}(B(a)) ⦄
⦃ equiv-ab : Equiv{ℓₑ₂}((a : A) → B(a)) ⦄
⦃ funcExt : DependentFunctionExtensionality(A)(B) ⦄
where
prop-dependent-implication : ⦃ prop-b : ∀{a} → MereProposition(B(a)) ⦄ → MereProposition((a : A) → B(a))
MereProposition.uniqueness prop-dependent-implication = dependentFunctionExtensionality(A)(B)(\{a} → uniqueness(B(a)))
module _ ⦃ equiv-top : Equiv{ℓₑ}(⊤) ⦄ where
instance
prop-top : MereProposition(⊤) ⦃ equiv-top ⦄
prop-top = unit-is-prop
module _ ⦃ equiv-bottom : Equiv{ℓₑ}(⊥) ⦄ where
instance
prop-bottom : MereProposition(⊥) ⦃ equiv-bottom ⦄
MereProposition.uniqueness prop-bottom {}
module _
{P : A → Type{ℓ}} ⦃ equiv-p : ∀{x} → Equiv{ℓₑ₁}(P(x)) ⦄
⦃ equiv-ap : Equiv{ℓₑ₂}(∀ₗ P) ⦄
⦃ funcExt : DependentImplicitFunctionExtensionality(A)(P) ⦄
where
prop-universal : ⦃ prop-p : ∀{x} → MereProposition(P(x)) ⦄ → MereProposition(∀ₗ P)
MereProposition.uniqueness prop-universal = dependentImplicitFunctionExtensionality(A)(P) (\{x} → uniqueness(P(x)))
module _
⦃ equiv-a : Equiv{ℓₑ₁}(A) ⦄
⦃ equiv-b : Equiv{ℓₑ₂}(B) ⦄
⦃ equiv-ba : Equiv{ℓₑ₃}(A ← B) ⦄
⦃ equiv-ab : Equiv{ℓₑ₄}(A → B) ⦄
⦃ equiv-eq : Equiv{ℓₑ₅}(A ↔ B) ⦄
⦃ op : BinaryOperator([↔]-intro) ⦄
⦃ funcExtₗ : FunctionExtensionality(B)(A) ⦄
⦃ funcExtᵣ : FunctionExtensionality(A)(B) ⦄
where
prop-equivalence : ⦃ prop-a : MereProposition(A) ⦄ → ⦃ prop-b : MereProposition(B) ⦄ → MereProposition(A ↔ B)
prop-equivalence = prop-conjunction ⦃ prop-a = prop-implication ⦄ ⦃ prop-b = prop-implication ⦄
module _
⦃ equiv-a : Equiv{ℓₑ₁}(A) ⦄
⦃ equiv-bottom : Equiv{ℓₑ₂}(⊥) ⦄
⦃ equiv-na : Equiv{ℓₑ₃}(¬ A) ⦄
⦃ funcExt : FunctionExtensionality (A)(⊥) ⦃ equiv-bottom ⦄ ⦄
where
prop-negation : MereProposition(¬ A)
prop-negation = prop-implication
module _
⦃ equiv-a : Equiv{ℓₑ₁}(A) ⦄
⦃ equiv-b : Equiv{ℓₑ₂}(B) ⦄
⦃ equiv-ab : Equiv{ℓₑ₃}(A ∨ B) ⦄
(left-right-neq : ∀{a : A}{b : B} → ([∨]-introₗ a ≢ [∨]-introᵣ b))
where
not-prop-disjunction : MereProposition(A ∨ B) → IsEmpty(A ∧ B)
IsEmpty.empty (not-prop-disjunction (intro uniqueness)) ([∧]-intro a b) with () ← left-right-neq(uniqueness{[∨]-introₗ a}{[∨]-introᵣ b})
{-
module _ {B : A → Type{ℓ}} where
open import Type.Identity
open import Relator.Equals.Proofs.Equiv
open import Structure.Relator
open import Structure.Setoid.Uniqueness
open import Syntax.Transitivity
congruence₁-dependent : ∀{ℓ₁ ℓ₂}{A : Type{ℓ₁}}{B : A → Type{ℓ₂}}{a₁ a₂ : A} → (f : (a : A) → B(a)) → (pa : a₁ ≡ a₂) → (substitute₁(B) pa (f a₁) ≡ f a₂)
congruence₁-dependent _ intro = intro
-- congruence₂-dependent : ∀{C : (a : A) → B(a) → Type{ℓ}}{a₁ a₂ : A}{b₁ : B(a₁)}{b₂ : B(a₂)}{f : (a : A) → (b : B(a)) → C a b} → (pa : a₁ ≡ a₂) → (f a₁ b₁ ≡ f a₂ b₂)
-- (substitute₁(B) ? b₁)
prop-sigma : Unique(B) → (∀{a} → MereProposition(B(a))) → MereProposition(Σ A B)
MereProposition.uniqueness (prop-sigma unique-B prop-B) {intro xa xb} {intro ya yb} =
intro xa xb 🝖[ _≡_ ]-[ {!(congruence₁-dependent(intro) (unique-B xb yb))!} ]
intro ya (substitute₁(B) (unique-B xb yb) xb) 🝖[ _≡_ ]-[ {!intro xa xb!} ]
intro ya yb 🝖-end
-}
{- TODO
module _
⦃ equiv-a : Equiv(A) ⦄
{B : A → Type{ℓ}} ⦃ equiv-b : ∀{x} → Equiv(B(x)) ⦄
⦃ equiv-sigma : Equiv(Σ A B) ⦄ -- TODO: Not an arbitrary one
where
prop-sigma : MereProposition(Σ A B) → ? -- TODO: Maybe MereProposition(B) → MereProposition(A)
prop-sigma (intro uniqueness₁) = {!!}
-}
{- TODO: Maybe generalize and move the stuff from Data.Proofs to here
-- Any binary relation on Unit is an equivalence given that it is reflexive.
module _ ⦃ equiv-u : Equiv(U) ⦄ ⦃ is-unit : IsUnit(U) ⦄ {_▫_ : U → U → Stmt} where
unit-equiv : Equiv(U)
Equiv._≡_ unit-equiv = (_▫_)
Reflexivity.proof (Equivalence.reflexivity (Equiv.equivalence unit-equiv)) = {!!}
Symmetry.proof (Equivalence.symmetry (Equiv.equivalence unit-equiv)) _ = {!!}
Transitivity.proof (Equivalence.transitivity (Equiv.equivalence unit-equiv)) _ _ = {!!}
-}
|
demo/adainclude/memory_move.ads | e3l6/SSMDev | 0 | 23231 | <filename>demo/adainclude/memory_move.ads
--
-- Copyright (C) 2006-2013, AdaCore
--
-- This package provides a general block copy mechanism analogous to that
-- provided by the C routine memmove allowing for copies with overlap.
with System; use System;
with Interfaces.C; use Interfaces.C;
package Memory_Move is
pragma Preelaborate;
procedure memmove (Dest : Address; Src : Address; N : size_t);
pragma Export (C, memmove, "memmove");
-- Copies N storage units from area starting at S2 to area starting
-- at S1 without any check for buffer overflow. The difference between
-- this memmove and memcpy is that with memmove, the storage areas may
-- overlap (forwards or backwards) and the result is correct (i.e. it
-- is as if S2 is first moved to a temporary area, and then this area
-- is copied to S1 in a separate step).
end Memory_Move;
|
KRLangGrammar.g4 | sharkich/kr-editor | 0 | 1389 | grammar KRLangGrammar;
todoExpressions : (addExpression)* (completeExpression)*;
addExpression : ADD TODO STRING;
completeExpression : COMPLETE TODO STRING;
ADD : 'ADD';
TODO : 'TODO';
COMPLETE: 'COMPLETE';
STRING: '"' ~ ["]* '"';
EOL: [\r\n] + -> skip;
WS: [ \t] -> skip;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1247.asm | ljhsiun2/medusa | 9 | 28179 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %rdi
push %rsi
lea addresses_A_ht+0x83, %r8
nop
nop
add $56075, %rdi
movb (%r8), %r14b
nop
nop
inc %rsi
pop %rsi
pop %rdi
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r8
push %r9
push %rax
push %rdx
push %rsi
// Store
lea addresses_UC+0xd1f3, %rsi
clflush (%rsi)
nop
nop
sub %r9, %r9
movw $0x5152, (%rsi)
nop
add $48512, %r9
// Load
lea addresses_PSE+0x14be2, %rax
nop
and %r11, %r11
mov (%rax), %r8d
nop
nop
nop
nop
nop
add $62092, %rax
// Faulty Load
lea addresses_UC+0x1ce83, %rax
nop
add %rdx, %rdx
mov (%rax), %rsi
lea oracles, %rax
and $0xff, %rsi
shlq $12, %rsi
mov (%rax,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rax
pop %r9
pop %r8
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC', 'congruent': 4}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 4, 'type': 'addresses_PSE', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A_ht', 'congruent': 8}}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
python-ada/unit.ads | octonion/recursion | 8 | 1877 | <reponame>octonion/recursion
with Interfaces.C; use Interfaces;
package unit is
type stack is array (0..9) of integer;
function partitions (cards: out stack; subtotal: integer) return integer;
pragma export (C, partitions, "partitions");
end unit;
|
_anim/Buzz Bomber Missile.asm | kodishmediacenter/msu-md-sonic | 9 | 171958 | ; ---------------------------------------------------------------------------
; Animation script - missile that Buzz Bomber throws
; ---------------------------------------------------------------------------
Ani_Missile: dc.w @flare-Ani_Missile
dc.w @missile-Ani_Missile
@flare: dc.b 7, 0, 1, afRoutine
@missile: dc.b 1, 2, 3, afEnd
even |
Task/Exceptions/AppleScript/exceptions-2.applescript | LaudateCorpus1/RosettaCodeData | 1 | 687 | try
set num to 1 / 0
--do something that might throw an error
on error errMess number errNum
--errMess and number errNum are optional
display alert "Error # " & errNum & return & errMess
end try
|
src/keystore-containers.adb | thierr26/ada-keystore | 0 | 20004 | -----------------------------------------------------------------------
-- keystore-containers -- Container protected keystore
-- Copyright (C) 2019 <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 Keystore.IO;
package body Keystore.Containers is
use type Keystore.Passwords.Keys.Key_Provider_Access;
protected Default_Key_Provider is
procedure Set_Default_Keys (Into : in out Keystore.Keys.Key_Manager);
private
Key_Provider : Keystore.Passwords.Keys.Key_Provider_Access;
end Default_Key_Provider;
protected body Default_Key_Provider is
procedure Set_Default_Keys (Into : in out Keystore.Keys.Key_Manager) is
begin
if Key_Provider = null then
Key_Provider := Keystore.Passwords.Keys.Create (DEFAULT_WALLET_KEY);
end if;
Keys.Set_Master_Key (Into, Key_Provider.all);
end Set_Default_Keys;
end Default_Key_Provider;
protected body Wallet_Container is
procedure Initialize is
begin
Default_Key_Provider.Set_Default_Keys (Master);
end Initialize;
procedure Open (Config : in Wallet_Config;
Ident : in Wallet_Identifier;
Block : in Keystore.IO.Storage_Block;
Wallet_Stream : in out Keystore.IO.Refs.Stream_Ref) is
begin
Stream := Wallet_Stream;
Master_Block := Block;
Master_Ident := Ident;
Keystore.Repository.Open (Repository, Config, Ident, Stream.Value);
State := S_PROTECTED;
end Open;
procedure Create (Password : in out Keystore.Passwords.Provider'Class;
Config : in Wallet_Config;
Block : in IO.Storage_Block;
Ident : in Wallet_Identifier;
Wallet_Stream : in out IO.Refs.Stream_Ref) is
begin
Stream := Wallet_Stream;
Master_Block := Block;
Master_Ident := Ident;
Keystore.Repository.Create (Repository, Password, Config, Block, Ident,
Master, Stream.Value);
State := S_OPEN;
end Create;
procedure Set_Master_Key (Password : in out Keystore.Passwords.Keys.Key_Provider'Class) is
begin
Keys.Set_Master_Key (Master, Password);
end Set_Master_Key;
procedure Set_Header_Data (Index : in Header_Slot_Index_Type;
Kind : in Header_Slot_Type;
Data : in Ada.Streams.Stream_Element_Array) is
begin
Stream.Value.Set_Header_Data (Index, Kind, Data);
end Set_Header_Data;
procedure Get_Header_Data (Index : in Header_Slot_Index_Type;
Kind : out Header_Slot_Type;
Data : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset) is
begin
Stream.Value.Get_Header_Data (Index, Kind, Data, Last);
end Get_Header_Data;
procedure Unlock (Password : in out Keystore.Passwords.Provider'Class;
Slot : out Key_Slot) is
begin
Keystore.Repository.Unlock (Repository, Password, Master_Block, Master);
Slot := Repository.Get_Key_Slot;
State := S_OPEN;
end Unlock;
procedure Set_Key (Password : in out Keystore.Passwords.Provider'Class;
New_Password : in out Keystore.Passwords.Provider'Class;
Config : in Wallet_Config;
Mode : in Mode_Type) is
begin
Keystore.Keys.Set_Key (Master, Password, New_Password, Config, Mode,
Repository.Get_Identifier, Master_Block, Stream.Value.all);
end Set_Key;
procedure Remove_Key (Password : in out Keystore.Passwords.Provider'Class;
Slot : in Key_Slot;
Force : in Boolean) is
begin
Keystore.Keys.Remove_Key (Master, Password, Slot, Force,
Repository.Get_Identifier, Master_Block, Stream.Value.all);
end Remove_Key;
function Get_State return State_Type is
begin
return State;
end Get_State;
function Contains (Name : in String) return Boolean is
begin
return Keystore.Repository.Contains (Repository, Name);
end Contains;
procedure Add (Name : in String;
Kind : in Entry_Type;
Content : in Ada.Streams.Stream_Element_Array) is
begin
Keystore.Repository.Add (Repository, Name, Kind, Content);
end Add;
procedure Add (Name : in String;
Kind : in Entry_Type;
Input : in out Util.Streams.Input_Stream'Class) is
begin
Keystore.Repository.Add (Repository, Name, Kind, Input);
end Add;
procedure Create (Name : in String;
Password : in out Keystore.Passwords.Provider'Class;
From_Repo : in out Keystore.Repository.Wallet_Repository;
From_Stream : in out IO.Refs.Stream_Ref) is
begin
Keystore.Repository.Add_Wallet (From_Repo, Name, Password, Master,
Master_Block, Master_Ident, Repository);
Stream := From_Stream;
State := S_OPEN;
end Create;
procedure Open (Name : in String;
Password : in out Keystore.Passwords.Provider'Class;
From_Repo : in out Keystore.Repository.Wallet_Repository;
From_Stream : in out IO.Refs.Stream_Ref) is
begin
Keystore.Repository.Open (From_Repo, Name, Password, Master,
Master_Block, Master_Ident, Repository);
Stream := From_Stream;
State := S_OPEN;
end Open;
procedure Do_Repository (Process : not null access
procedure (Repo : in out Keystore.Repository.Wallet_Repository;
Stream : in out IO.Refs.Stream_Ref)) is
begin
Process (Repository, Stream);
end Do_Repository;
procedure Set (Name : in String;
Kind : in Entry_Type;
Content : in Ada.Streams.Stream_Element_Array) is
begin
Keystore.Repository.Set (Repository, Name, Kind, Content);
end Set;
procedure Set (Name : in String;
Kind : in Entry_Type;
Input : in out Util.Streams.Input_Stream'Class) is
begin
Keystore.Repository.Set (Repository, Name, Kind, Input);
end Set;
procedure Update (Name : in String;
Kind : in Entry_Type;
Content : in Ada.Streams.Stream_Element_Array) is
begin
Keystore.Repository.Update (Repository, Name, Kind, Content);
end Update;
procedure Delete (Name : in String) is
begin
Keystore.Repository.Delete (Repository, Name);
end Delete;
procedure Find (Name : in String;
Result : out Entry_Info) is
begin
Keystore.Repository.Find (Repository, Name, Result);
end Find;
procedure Get_Data (Name : in String;
Result : out Entry_Info;
Output : out Ada.Streams.Stream_Element_Array) is
begin
Keystore.Repository.Get_Data (Repository, Name, Result, Output);
end Get_Data;
procedure Get_Data (Name : in String;
Output : in out Util.Streams.Output_Stream'Class) is
begin
Keystore.Repository.Get_Data (Repository, Name, Output);
end Get_Data;
procedure List (Filter : in Filter_Type;
Content : out Entry_Map) is
begin
Keystore.Repository.List (Repository, Filter, Content);
end List;
procedure List (Pattern : in GNAT.Regpat.Pattern_Matcher;
Filter : in Filter_Type;
Content : out Entry_Map) is
begin
Keystore.Repository.List (Repository, Pattern, Filter, Content);
end List;
procedure Get_Stats (Stats : out Wallet_Stats) is
begin
Repository.Fill_Stats (Stats);
end Get_Stats;
procedure Close is
begin
Keystore.Repository.Close (Repository);
Stream := IO.Refs.Null_Ref;
State := S_CLOSED;
end Close;
procedure Set_Work_Manager (Workers : in Keystore.Task_Manager_Access) is
begin
Keystore.Repository.Set_Work_Manager (Repository, Workers);
end Set_Work_Manager;
end Wallet_Container;
procedure Open_Wallet (Container : in out Wallet_Container;
Name : in String;
Password : in out Keystore.Passwords.Provider'Class;
Wallet : in out Wallet_Container) is
procedure Add (Repo : in out Keystore.Repository.Wallet_Repository;
Stream : in out IO.Refs.Stream_Ref);
procedure Add (Repo : in out Keystore.Repository.Wallet_Repository;
Stream : in out IO.Refs.Stream_Ref) is
begin
Wallet.Open (Name, Password, Repo, Stream);
end Add;
begin
Container.Do_Repository (Add'Access);
end Open_Wallet;
procedure Add_Wallet (Container : in out Wallet_Container;
Name : in String;
Password : in out Keystore.Passwords.Provider'Class;
Wallet : in out Wallet_Container) is
procedure Add (Repo : in out Keystore.Repository.Wallet_Repository;
Stream : in out IO.Refs.Stream_Ref);
procedure Add (Repo : in out Keystore.Repository.Wallet_Repository;
Stream : in out IO.Refs.Stream_Ref) is
begin
Wallet.Create (Name, Password, Repo, Stream);
end Add;
begin
Container.Do_Repository (Add'Access);
end Add_Wallet;
end Keystore.Containers;
|
programs/oeis/131/A131762.asm | jmorken/loda | 1 | 175725 | ; A131762: Number of 1s in the 1's complement of the 32-bit binary representation of n.
; 32,31,31,30,31,30,30,29,31,30,30,29,30,29,29,28,31,30,30,29,30,29,29,28,30,29,29,28,29,28,28,27,31,30,30,29,30,29,29,28,30,29,29,28,29,28,28,27,30,29,29,28,29,28,28,27,29,28,28,27,28,27,27,26,31,30,30,29,30,29,29,28,30,29,29,28,29,28,28,27,30,29,29,28,29,28,28,27,29,28,28,27,28,27,27,26,30,29,29,28,29,28,28,27,29,28,28,27,28,27,27,26,29,28,28,27,28,27,27,26,28,27,27,26,27,26,26,25,31,30,30,29,30,29,29,28,30,29,29,28,29,28,28,27,30,29,29,28,29,28,28,27,29,28,28,27,28,27,27,26,30,29,29,28,29,28,28,27,29,28,28,27,28,27,27,26,29,28,28,27,28,27,27,26,28,27,27,26,27,26,26,25,30,29,29,28,29,28,28,27,29,28,28,27,28,27,27,26,29,28,28,27,28,27,27,26,28,27,27,26,27,26,26,25,29,28,28,27,28,27,27,26,28,27,27,26,27,26,26,25,28,27,27,26,27,26,26,25,27,26
mov $1,4
mov $2,$0
mov $4,1
mov $6,40320
sub $6,$0
bin $0,0
add $4,$0
mov $0,$6
mov $3,4
sub $3,$4
add $3,1
mov $5,$6
lpb $0
sub $0,1
div $2,2
add $1,$2
lpe
sub $3,2
add $3,$1
mov $1,4
sub $5,49
add $3,$5
mul $1,$3
mul $1,3
div $1,12
sub $1,40244
|
awa/plugins/awa-changelogs/src/awa-changelogs-modules.ads | fuzzysloth/ada-awa | 81 | 8246 | <reponame>fuzzysloth/ada-awa
-----------------------------------------------------------------------
-- awa-changelogs-modules -- Module changelogs
-- Copyright (C) 2014 <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 ASF.Applications;
with ADO;
with AWA.Modules;
package AWA.Changelogs.Modules is
-- The name under which the module is registered.
NAME : constant String := "changelogs";
-- ------------------------------
-- Module changelogs
-- ------------------------------
type Changelog_Module is new AWA.Modules.Module with private;
type Changelog_Module_Access is access all Changelog_Module'Class;
-- Initialize the changelogs module.
overriding
procedure Initialize (Plugin : in out Changelog_Module;
App : in AWA.Modules.Application_Access;
Props : in ASF.Applications.Config);
-- Get the changelogs module.
function Get_Changelog_Module return Changelog_Module_Access;
-- Add the log message and associate it with the database entity identified by
-- the given id and the entity type. The log message is associated with the current user.
procedure Add_Log (Model : in Changelog_Module;
Id : in ADO.Identifier;
Entity_Type : in String;
Message : in String);
private
type Changelog_Module is new AWA.Modules.Module with null record;
end AWA.Changelogs.Modules;
|
src/mappers/MMC1.asm | freem/nes_corelib | 16 | 25445 | ; File: mappers/MMC1.asm
; MMC1 mapper code and defines.
;==============================================================================;
; Variables: MMC1 zero page variables ($E0-$EF)
;
; mmc1Data - Data to write to MMC1 register.
; int_mmc1Ctrl - Last full value written to MMC1 control register.
; curPrgBank - Current swappable program bank.
; curBankCHR0 - (Optional) Current CHR-ROM Bank (0).
; curBankCHR1 - (Optional) Current CHR-ROM Bank (1).
.enum $00E0
mmc1Data .dsb 1, $00
int_mmc1Ctrl .dsb 1, $00
curPrgBank .dsb 1, $00
;curBankCHR0 .dsb 1, $00
;curBankCHR1 .dsb 1, $00
.ende
;==[MMC1 Register defines]=====================================================;
; Constant: MMC1_Load
; Load register ($8000-$FFFF)
;
; (start code)
; 7654 3210
; ---------
; Rxxx xxxD
; | |
; | +- Data bit to be shifted into shift register, LSB first
; +--------- 1: Reset shift register and write Control with (Control OR $0C),
; locking PRG ROM at $C000-$FFFF to the last bank.
; (end code)
MMC1_Load = $8000
;------------------------------------------------------------------------------;
; Constant: MMC1_Ctrl
; Control register (internal; $8000-$9FFF)
;
; (start code)
; 43210
; -----
; CPPMM
; |||||
; |||++---- Mirroring (0: one-screen, lower bank; 1: one-screen, upper bank;
; ||| 2: vertical; 3: horizontal)
; |++------ PRG ROM bank mode (0, 1: switch 32 KB at $8000, ignoring low bit of bank number;
; | 2: fix first bank at $8000 and switch 16 KB bank at $C000;
; | 3: fix last bank at $C000 and switch 16 KB bank at $8000)
; +-------- CHR ROM bank mode (0: switch 8 KB; 1: switch two separate 4 KB banks)
; (end code)
MMC1_Ctrl = $8000
;------------------------------------------------------------------------------;
; Constant: MMC1_Chr0
; CHR bank 0 (internal; $A000-$BFFF)
;
; (start code)
; 43210
; -----
; CCCCC
; |||||
; +++++---- Select 4KB or 8KB CHR bank at PPU $0000
;
; on SNROM:
; 43210
; -----
; ExxxC
; | |
; | +---- Select 4KB CHR-RAM bank at PPU $0000 (ignored in 8KB mode)
; +-------- PRG-RAM disable (0: enable, 1: open bus)
; (end code)
MMC1_Chr0 = $A000
;------------------------------------------------------------------------------;
; Constant: MMC1_Chr1
; CHR bank 1 (internal; $C000-$DFFF)
;
; (start code)
; 43210
; -----
; CCCCC
; |||||
; +++++---- Select 4KB or 8KB CHR bank at PPU $1000
;
; on SNROM:
; 43210
; -----
; ExxxC
; | |
; | +---- Select 4KB CHR-RAM bank at PPU $1000 (ignored in 8KB mode)
; +-------- PRG-RAM disable (0: enable, 1: open bus) (ignored in 8 KB mode)
; (end code)
MMC1_Chr1 = $C000
;------------------------------------------------------------------------------;
; Constant: MMC1_Prg
; PRG bank (internal; $E000-$FFFF)
;
; (start code)
; 43210
; -----
; RPPPP
; |||||
; |++++---- Select 16 KB PRG ROM bank (low bit ignored in 32 KB mode)
; +-------- PRG RAM chip enable (0: enabled; 1: disabled; ignored on MMC1A)
; (end code)
MMC1_Prg = $E000
;==[MMC1 Routines]=============================================================;
; I'm not sure how many of these are good, so be careful when using them.
; Routine: MMC1_WriteControl
; Writes data to the MMC1 Control Register ($8000-$9FFF).
;
; Parameters:
; - *A* - Value to write
MMC1_WriteControl:
sta mmc1Data ; store full value
sta int_mmc1Ctrl ; store our internal value
; disable interrupts and save current PPU control
sei
lda int_ppuCtrl
pha
jsr ppu_disableNMI
; write data
lda mmc1Data
sta MMC1_Ctrl
lsr a
sta MMC1_Ctrl
lsr a
sta MMC1_Ctrl
lsr a
sta MMC1_Ctrl
lsr a
sta MMC1_Ctrl
; restore current PPU control and re-enable interrupts
pla
sta int_ppuCtrl
sta PPU_CTRL
cli
rts
;------------------------------------------------------------------------------;
; Routine: MMC1_SetCHRBank0
; Writes data to the MMC1 CHR Bank 0 Register ($A000-$BFFF).
; (Low bit is ignored in 8K mode.)
;
; Parameters:
; - *A* - Value of CHR bank 0.
; (Note: in SNROM, the value includes the PRG-RAM disable toggle in bit 4.)
MMC1_SetCHRBank0:
sta mmc1Data ; store full value
; disable interrupts and save current PPU control
sei
lda int_ppuCtrl
pha
jsr ppu_disableNMI
; write data
lda mmc1Data
sta MMC1_Chr0
lsr a
sta MMC1_Chr0
lsr a
sta MMC1_Chr0
lsr a
sta MMC1_Chr0
lsr a
sta MMC1_Chr0
; restore current PPU control and re-enable interrupts
pla
sta int_ppuCtrl
sta PPU_CTRL
cli
rts
;------------------------------------------------------------------------------;
; Routine: MMC1_SetCHRBank1
; Writes data to the MMC1 CHR Bank 1 Register ($C000-$DFFF).
; This is ignored in 8K mode.
;
; Parameters:
; - *A* - Value of CHR bank 1.
; (Note: in SNROM, the value includes the PRG-RAM disable toggle in bit 4.
; However, this one is ignored in 8K mode.)
MMC1_SetCHRBank1:
sta mmc1Data ; store full value
; disable interrupts and save current PPU control
sei
lda int_ppuCtrl
pha
jsr ppu_disableNMI
; write data
lda mmc1Data
sta MMC1_Chr1
lsr a
sta MMC1_Chr1
lsr a
sta MMC1_Chr1
lsr a
sta MMC1_Chr1
lsr a
sta MMC1_Chr1
; restore current PPU control and re-enable interrupts
pla
sta int_ppuCtrl
sta PPU_CTRL
cli
rts
;------------------------------------------------------------------------------;
; MMC1_SetPRGBank
; Writes data to the MMC1 PRG Bank Register ($E000-$FFFF)
; Parameters:
; A PRG bank to switch to.
; Note: the value includes the PRG-RAM disable toggle in bit 4.
MMC1_SetPRGBank:
sta mmc1Data
; check if the bank is already loaded
cmp curPrgBank
beq @exit
; disable interrupts and save current PPU control
sei
lda int_ppuCtrl
pha
jsr ppu_disableNMI
; write PRG bank
lda mmc1Data
sta curPrgBank
sta MMC1_Prg
lsr a
sta MMC1_Prg
lsr a
sta MMC1_Prg
lsr a
sta MMC1_Prg
lsr a
sta MMC1_Prg
; restore current PPU control and re-enable interrupts
pla
sta int_ppuCtrl
sta PPU_CTRL
cli
@exit:
rts
|
src/Data/QuadTree/LensProofs/Valid-LensLeaf.agda | JonathanBrouwer/research-project | 1 | 4432 | module Data.QuadTree.LensProofs.Valid-LensLeaf where
open import Haskell.Prelude renaming (zero to Z; suc to S)
open import Data.Lens.Lens
open import Data.Logic
open import Agda.Primitive
open import Data.Lens.Proofs.LensLaws
open import Data.Lens.Proofs.LensPostulates
open import Data.Lens.Proofs.LensComposition
open import Data.QuadTree.InternalAgda
open import Data.QuadTree.Implementation.QuadrantLenses
open import Data.QuadTree.Implementation.Definition
open import Data.QuadTree.Implementation.ValidTypes
--- Lens laws for lensLeaf
ValidLens-Leaf-ViewSet : {t : Set} {{eqT : Eq t}} -> ViewSet (lensLeaf {t})
ValidLens-Leaf-ViewSet v (CVQuadrant (Leaf x)) = refl
ValidLens-Leaf-SetView :
{t : Set} {{eqT : Eq t}}
-> SetView (lensLeaf {t})
ValidLens-Leaf-SetView (CVQuadrant (Leaf x)) = refl
ValidLens-Leaf-SetSet :
{t : Set} {{eqT : Eq t}}
-> SetSet (lensLeaf {t})
ValidLens-Leaf-SetSet v1 v2 (CVQuadrant (Leaf x)) = refl
ValidLens-Leaf :
{t : Set} {{eqT : Eq t}}
-> ValidLens (VQuadrant t {0}) t
ValidLens-Leaf = CValidLens lensLeaf ValidLens-Leaf-ViewSet ValidLens-Leaf-SetView ValidLens-Leaf-SetSet |
HoTT/NaturalNumber.agda | michaelforney/hott | 0 | 7311 | <filename>HoTT/NaturalNumber.agda
{-# OPTIONS --without-K #-}
module HoTT.NaturalNumber where
open import HoTT.Base renaming (_+_ to _⊎_)
open import HoTT.Identity
private variable n m : ℕ
_+_ : ℕ → ℕ → ℕ
0 + m = m
succ n + m = succ (n + m)
+-comm : (n m : ℕ) → n + m == m + n
+-comm zero zero = refl
+-comm zero (succ m) = ap succ (+-comm zero m)
+-comm (succ n) zero = ap succ (+-comm n zero)
+-comm (succ n) (succ m) = ap succ $
n + succ m =⟨ +-comm n (succ m) ⟩
succ m + n =⟨ ap (succ) (+-comm m n) ⟩
succ (n + m) =⟨ +-comm (succ n) m ⟩
m + succ n ∎
where open =-Reasoning
_≤_ : ℕ → ℕ → 𝒰₀
n ≤ m = Σ ℕ λ k → n + k == m
≤succ : n ≤ m → n ≤ succ m
≤succ {n} (k , p) = succ k , +-comm n (succ k) ∙ ap succ (+-comm k n ∙ p)
_<_ : ℕ → ℕ → 𝒰₀
n < m = succ n ≤ m
_<=>_ : (n m : ℕ) → (n == m) ⊎ (n < m) ⊎ (m < n)
zero <=> zero = inl refl
zero <=> succ m = inr (inl (m , refl))
succ n <=> zero = inr (inr (n , refl))
succ n <=> succ m with n <=> m
... | inl p = inl (ap succ p)
... | inr (inl (k , p)) = inr (inl (k , ap succ p))
... | inr (inr (k , p)) = inr (inr (k , ap succ p))
|
MEMZ/NyanMBR/Source/Stage2/Animation/countNyan.asm | johnmelodyme/viruses | 4 | 18691 | nyanTimeString: db "You've Nyaned for 00000.0 seconds!"
nyanTimeStringLen: equ $-nyanTimeString
nyanTimeVideoStart: equ 3840
nyanTimeBin dw 0
countNyan:
; Set the extra segment to video memory
push es
push 0xb800
pop es
mov di, 0
inc word [nyanTimeBin]
mov bx, nyanTimeStringLen*2
.loop:
sub bx, 2
mov al, [es:nyanTimeVideoStart+bx]
cmp al, '0'
jb .next
cmp al, '9'
ja .next
inc al
mov [es:nyanTimeVideoStart+bx], al
cmp al, '9'+1
jne .end
mov al, '0'
mov [es:nyanTimeVideoStart+bx], al
.next:
cmp bx, 0
jne .loop
.end:
pop es
ret
|
libsrc/_DEVELOPMENT/fcntl/c/sccz80/dup2.asm | jpoikela/z88dk | 640 | 164989 |
; int dup2(int fd, int fd2)
SECTION code_clib
SECTION code_fcntl
PUBLIC dup2
EXTERN asm_dup2
dup2:
pop af
pop de
pop hl
push hl
push de
push af
jp asm_dup2
|
crt/bigshr.asm | malxau/minicrt | 27 | 166792 | <gh_stars>10-100
;
; BIGSHR.ASM
;
; Implementation for for signed and unsigned right shift of a 64 bit integer.
;
; Copyright (c) 2017 <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.
;
.386
.MODEL FLAT, C
.CODE
; ULARGE_INTEGER [High EDX, Low EAX]
; _aullshr(
; ULARGE_INTEGER Value, [High EDX, Low EAX]
; UCHAR Shift [CL]
; );
public _aullshr
_aullshr proc
; If the shift is for more than 64 bits, all the data would be gone, so
; return zero. If the shift is for more than 32 bits, the high 32 bits
; of the result must be zero, and the low 32 bits contains the high 32
; bits of input after shifting. If the shift is less than 32 bits, then
; both components must be shifted with bits carried between the two.
cmp cl,64
jae aullshr_no_shift
cmp cl,32
jae aullshr_long_shift
jmp aullshr_short_shift
aullshr_short_shift:
shrd eax, edx, cl
shr edx, cl
ret
aullshr_long_shift:
sub cl, 32
shr edx, cl
mov eax, edx
xor edx, edx
ret
aullshr_no_shift:
xor eax, eax
xor edx, edx
ret
_aullshr endp
; LARGE_INTEGER [High EDX, Low EAX]
; _allshr(
; LARGE_INTEGER Value, [High EDX, Low EAX]
; UCHAR Shift [CL]
; );
; It's not clear to me what the meaning of a signed bitshift is, but for now
; give it to the unsigned implementation.
public _allshr
_allshr proc
jmp _aullshr
_allshr endp
END
|
Task2/Task2_PF_GCD_LCM.asm | raniaelhagin/Microprocessor-Tasks | 0 | 172835 |
;This code is used to get the prime factors of 2 unsigned numbers and then calculating their gcd and lcm
; It's devided into 4 parts, the first part is to take the inputs from the user
; the second part is to calculate the prime factors for each number
; the third part is to calculate the gcd for each number
; the last part is to calculate the lcm for each number
INCLUDE "EMU8086.INC"
name "Prime Factors - GCD - LCM"
org 100h
;---------------PRINT A WELCOMING MESSAGE -----------------------
; first let's print it:
mov ah, 9
mov dx, offset msg1
int 21h
;PRINT A NEW LINE
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
; first let's print it:
mov ah, 9
mov dx, offset msg2
int 21h
;PRINT A NEW LINE
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
;-------------- TAKE THE FIRST INPUT FROM THE USER ----------------------------
INPUT:
CALL TAKEINPUT
CMP BX, 1 ;CHECK IF THE INPUT IS GREATER THAN 1
JG CHECK1 ;IF YES, GO TO CHECK IF IT'S LESS THAN OR EQUAL 255
JLE CALLAGAIN1
CHECK1:
CMP BX, 255 ;CHECK IF IT'S LESS THAN 255
JLE DOIT1
JG CALLAGAIN1
RET
DOIT1:
MOV NUM1, BL ; STORE AL IN NUM1
JMP ENDLOOP1
RET
CALLAGAIN1:
CALL TAKEINPUTAGAIN
CMP BX,1
JLE CALLAGAIN1
JG CHECK1
RET
LOOP INPUT
ENDLOOP1:
;---------------------------------------------------------------------
;-------------- TAKE THE SECOND INPUT ----------------------------
CALL TAKEINPUT ;ASK THE USER FOR THE SECOND NUMBER
CMP BX, 1 ;CHECK IF THE INPUT IS GREATER THAN 1
JG CHECK2 ;IF YES, GO TO CHECK IF IT'S LESS THAN OR EQUAL 255
JLE CALLAGAIN2
CHECK2:
CMP BX, 255 ; CHECK IF IT'S LESS THAN 255
JLE DOIT2
JG CALLAGAIN2
RET
DOIT2:
MOV NUM2, BL ; STORE AL IN NUM2
JMP ENDLOOP2
RET
CALLAGAIN2:
CALL TAKEINPUTAGAIN
CMP BX,1
JLE CALLAGAIN2
JG CHECK2
RET
ENDLOOP2:
;-----------------------------------------------------------------------------------
;------------------ CODE FOR GETTING THE PRIME FACTORS OF THE FIRST NUMBER ---------
;PRINT A NEW LINE
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
; PRINT MSG5
MOV AH, 9
MOV DX, OFFSET MSG5
INT 21H
MOV AH, 0
MOV AL, NUM1
CALL PRINT_NUM ;print the first number
MOV AH, 9
MOV DX, OFFSET MSG6
INT 21H
;-----------------------------------------
MOV AX, 0000H ;INITIALIZE AX
MOV AL, NUM1 ;COPY THE FIRST NUMER
MOV BL, 2 ;TO EVEN OR ODD CHECK
JMP CLOOP1
CLOOP1:
MOV DL, AL ;COPY AL TO USE AGAIN
DIV BL ;DIVIDE BY 2
CMP AH, 0 ;even
JE L1 ;GO TO L1
CMP AH, 1 ;odd
MOV AL, DL
MOV CL, 1 ;START LOOP FROM 3
MUL AL
MOV BX, AX
MOV AL, DL
MOV DX, BX
JE L2
LOOP CLOOP1
L1:
MOV VAR3, AL
;PRINT A NEW LINE
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
PRINT '2' ;PRINT 2
PUSH 2 ; TO STORE IN STACK
MOV AX, 0000H
MOV AL, VAR3
CMP AL, 1 ;CHECK AL VALUE
JE LOOPEND ;IF IT'S EQUAL 1
JNE CLOOP1 ;
RET
L2:
MOV AH, 0
MOV VAR2, AL
ADD CL, 2
DIV CL
CMP AH, 0
JE L3
CMP AH, 1
JGE L6
RET
L3:
MOV VAR5, AL
MOV VAR4, CL
;PRINT A NEW LINE
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
MOV AX, 0000H
MOV CX, 0000H
MOV CL, VAR4
MOV AL, CL
CALL PRINT_NUM
PUSH AX ; STORE IT IN STACK
MOV AX, 0000H
MOV AL, VAR5
CMP AL, 1
JE LOOPEND
JG L4
RET
L4:
DIV CL
CMP AH, 0
JE L3
JNE L5
RET
L5:
MOV AL, VAR5
JMP L2
RET
L6:
MOV AL, VAR2
JMP L2
RET
LOOPEND:
;------------------ CODE FOR GETTING THE PRIME FACTORS OF THE SECOND NUMBER ---------
PUSH 0
;PRINT A NEW LINE
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
; PRINT MSG5
MOV AH, 9
MOV DX, OFFSET MSG5
INT 21H
MOV AH, 0
MOV AL, NUM2
CALL PRINT_NUM ;print the first number
MOV AH, 9
MOV DX, OFFSET MSG6
INT 21H
;-----------------------------------------
MOV AX, 0000H ;INITIALIZE AX
MOV AL, NUM2 ;COPY THE FIRST NUMER
MOV BL, 2 ;TO EVEN OR ODD CHECK
JMP CLOOP2
CLOOP2:
MOV DL, AL ;COPY AL TO USE AGAIN
DIV BL ;DIVIDE BY 2
CMP AH, 0 ;even
JE L1_1 ;GO TO L1
CMP AH, 1 ;odd
MOV AL, DL
MOV CL, 1 ;START LOOP FROM 3
MUL AL
MOV BX, AX
MOV AL, DL
MOV DX, BX
JE L2_1
LOOP CLOOP2
L1_1:
MOV VAR3, AL
;PRINT A NEW LINE
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
PRINT '2' ;PRINT 2
PUSH 2 ; STORE IT IN STACK
MOV AX, 0000H
MOV AL, VAR3
CMP AL, 1 ;CHECK AL VALUE
JE LOOPEND_1 ;IF IT'S EQUAL 1
JNE CLOOP2 ;
RET
L2_1:
MOV AH, 0
MOV VAR2, AL
ADD CL, 2
DIV CL
CMP AH, 0
JE L3_1
CMP AH, 1
JGE L6_1
RET
L3_1:
MOV VAR5, AL
MOV VAR4, CL
;PRINT A NEW LINE
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
MOV AX, 0000H
MOV CX, 0000H
MOV CL, VAR4
MOV AL, CL
CALL PRINT_NUM
PUSH AX ; STORE IT IN STACK
MOV AX, 0000H
MOV AL, VAR5
CMP AL, 1
JE LOOPEND_1
JG L4_1
RET
L4_1:
DIV CL
CMP AH, 0
JE L3_1
JNE L5_1
RET
L5_1:
MOV AL, VAR5
JMP L2_1
RET
L6_1:
MOV AL, VAR2
JMP L2_1
RET
LOOPEND_1:
;---------------------------------------------------------------------------------------
;------------------------- GET COMMON FACTORS -----------------------------------------
MOV AX, 00H
MOV BX, 00H
MOV CX, 00H
MOV DX, 00H
MOV SI, 00H
FACTORS2:
MOV AX, SP
POP AX
MOV BX, AX
CMP BX, 0
JNE STORE2
MOV SI, 0
JE FACTORS1
STORE2:
INC PRIMESLEN2
MOV PRIMES2[SI], BL
INC SI
JMP FACTORS2
RET
FACTORS1:
MOV AX, SP
POP AX
MOV BX, AX
CMP BX, 0
JE ENDFACTORS
JNE STORE1
STORE1:
INC PRIMESLEN1
MOV PRIMES1[SI], BL
INC SI
JMP FACTORS1
RET
ENDFACTORS:
;CMP PRIMESLEN1, PRIMESLEN2
;JGE SETCXG
;JL SETCXL
;
;SETCXG:
;MOV CX, PRIMESLEN1
;RET
;
;SETCXL:
;MOV CX, PRIMESLEN2
;RET
MOV SI, OFFSET PRIMES1
MOV DI, OFFSET PRIMES2
MOV DIHELP, DI
MOV CX, 0
CMPLOOP1:
MOV DX, CX
MOV AL, [SI] ;[SI] ELEMENT IN AL
CMPLOOP2:
MOV BL, [DI]
INC DI
CMP AL, BL
JNE NOTSAME
JE STORECOMMON ;STORE IN COMMON FACTOR ARRAY
LOOP CMPLOOP2
LOOP CMPLOOP1
STORECOMMON:
MOV SIPRIMES, SI ;SI OF PRIMES1 ARRAY
MOV SI, SIFACTORS
MOV COMMONFACTORS[SI], AL
INC SI
MOV SIFACTORS, SI
MOV [DI-1], 0
INC DL
CMP DL, PRIMESLEN1
JGE ENDCMP
JL RESETL1AGAIN
RET
RESETL1AGAIN:
MOV CX, DX
INC SIPRIMES
MOV SI, SIPRIMES
MOV DI, DIHELP
JMP CMPLOOP1
RET
NOTSAME:
INC CL
CMP CL, PRIMESLEN2
JG RESETL1 ; RESET CMPLOOP2
JLE CMPLOOP2
RET
RESETL1:
INC DX
CMP DL, PRIMESLEN1
JG ENDCMP
MOV CX, DX
;INC SI
;MOV DI, DIHELP
JMP CMPLOOP1
RET
ENDCMP:
;----------------------- GET GCD FROM COMMON FACTORS ARRAY -----------------------------
MOV SI, 0
MOV AL, 1
GCDLOOP:
CMP COMMONFACTORS[SI], 0
JE ENDGCD
JNE CALCGCD ;CALCULATE GCD
LOOP GCDLOOP
CALCGCD:
MUL COMMONFACTORS[SI]
MOV GCD, AX
INC SI
JMP GCDLOOP
RET
ENDGCD:
;PRINT A NEW LINE
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
; PRINT GCD
MOV AH, 9
MOV DX, OFFSET MSG7
INT 21H
MOV AX, GCD
CALL PRINT_NUM ;print gcd
;---------------------------- CALCULATE LCM ----------------------------------------
MOV AX, 00H
MOV BX, 00H
MOV AL, NUM1
MOV BL, NUM2
MUL BL
MOV DX, GCD
DIV DL
MOV LCM,AX
;PRINT A NEW LINE
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
; PRINT GCD
MOV AH, 9
MOV DX, OFFSET MSG8
INT 21H
MOV AX, LCM
CALL PRINT_NUM
; wait for any key press:
mov ah, 0
int 16h
ret
primes1 db 100 dup(?)
primes2 db 100 dup(?)
commonfactors db 100 dup(?)
primeslen1 db 0
primeslen2 db 0
SIPRIMES DW ?
SIFACTORS DW 0
DIHELP DW ?
GCD DW 1
LCM DW ?
msg1 db 'Welcome to our program for calculating prime factors$'
msg2 db 'This program takes two numbers and then prints the prime factors for each one$'
msg3 db 'Please, Enter a number between 2 and 255: $'
msg4 db 'Please, Enter a VALID number between 2 and 255: $'
msg5 db 'Prime factors of $'
msg6 db ' are: $'
msg7 db 'GCD = $'
msg8 db 'LCM = $'
NUM1 DB ?
NUM2 DB ?
VAR1 DB ?
VAR2 DB ?
VAR3 DB ?
VAR4 DB ?
VAR5 DB ?
; PROC TO TAKE INPUT FROM THE USER
TAKEINPUT PROC
;PRINT A NEW LINE
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
mov ah, 9
mov dx, offset msg3
int 21h
CALL SCAN_NUM ; GET NUMBER IN CX
MOV AX, CX ; COPY THE NUMBER TO AX
MOV BX, AX
RET ; RETURN TO CALLER
TAKEINPUT ENDP
; PROC TO TAKE INPUT AGAIN FROM THE USER
TAKEINPUTAGAIN PROC
;PRINT A NEW LINE
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
mov ah, 9
mov dx, offset msg4
int 21h
CALL SCAN_NUM ; GET NUMBER IN CX
MOV AX, CX ; COPY THE NUMBER TO AX
MOV BX, AX
RET
TAKEINPUTAGAIN ENDP
; MACROS TO DEFINE PROCS
DEFINE_SCAN_NUM
;DEFINE_PRINT_STRING
DEFINE_PRINT_NUM
DEFINE_PRINT_NUM_UNS ;REQUIRED FOR PRINT_NUM
;DEFINE_PTHIS |
test/asset/agda-stdlib-1.0/Data/Product/Categorical/Examples.agda | omega12345/agda-mode | 5 | 11157 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Universe-sensitive functor and monad instances for the Product type.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Algebra
module Data.Product.Categorical.Examples
{a e b} {A : Monoid a e} {B : Set b} where
open import Level using (Lift; lift; _⊔_)
open import Category.Functor using (RawFunctor)
open import Category.Monad using (RawMonad)
open import Data.Product
open import Data.Product.Relation.Binary.Pointwise.NonDependent
open import Function
import Function.Identity.Categorical as Id
open import Relation.Binary using (Rel)
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
------------------------------------------------------------------------
-- Examples
-- Note that these examples are simple unit tests, because the type
-- checker verifies them.
private
module A = Monoid A
open import Data.Product.Categorical.Left A.rawMonoid b
_≈_ : Rel (A.Carrier × Lift a B) (e ⊔ a ⊔ b)
_≈_ = Pointwise A._≈_ _≡_
open RawFunctor functor
-- This type to the right of × needs to be a "lifted" version of (B : Set b)
-- that lives in the universe (Set (a ⊔ b)).
fmapIdₗ : (x : A.Carrier × Lift a B) → (id <$> x) ≈ x
fmapIdₗ x = A.refl , refl
open RawMonad monad
-- Now, let's show that "return" is a unit for >>=. We use Lift in exactly
-- the same way as above. The data (x : B) then needs to be "lifted" to
-- this new type (Lift B).
returnUnitL : ∀ {x : B} {f : Lift a B → A.Carrier × Lift a B} →
((return (lift x)) >>= f) ≈ f (lift x)
returnUnitL = A.identityˡ _ , refl
returnUnitR : {x : A.Carrier × Lift a B} → (x >>= return) ≈ x
returnUnitR = A.identityʳ _ , refl
-- And another (limited version of a) monad law...
bindCompose : ∀ {f g : Lift a B → A.Carrier × Lift a B} →
{x : A.Carrier × Lift a B} →
((x >>= f) >>= g) ≈ (x >>= (λ y → (f y >>= g)))
bindCompose = A.assoc _ _ _ , refl
|
programs/oeis/099/A099761.asm | karttu/loda | 0 | 179780 | <reponame>karttu/loda
; A099761: a(n) = ( n*(n+2) )^2.
; 0,9,64,225,576,1225,2304,3969,6400,9801,14400,20449,28224,38025,50176,65025,82944,104329,129600,159201,193600,233289,278784,330625,389376,455625,529984,613089,705600,808201,921600,1046529,1183744,1334025
mov $1,2
add $1,$0
mul $1,$0
pow $1,2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.