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
|
---|---|---|---|---|
examples/lwsw.asm
|
tylerweston/mips2c
| 0 |
97458
|
.data
str1: .asciiz "Writing some values\n"
str2: .asciiz "Reading & Showing some values\n"
comma: .asciiz ", "
nl: .asciiz "\n"
.text
la $a0, str1
li $v0, 4
syscall
# store some ints
li $t0, 64 # starting at address 64
li $t1, 420
sw $t1, 0($t0)
li $t1, 69
sw $t1, 4($t0)
li $t1, 13
sw $t1, 8($t0)
li $t1, 42
sw $t1, 12($t0)
li $t1, 8
sw $t1, 16($t0)
# okay next we want to grab those values and
# display them
la $a0, str2
li $v0, 4
syscall
# print num 1
lw $a0, 0($t0)
li $v0, 1
syscall
la $a0, comma
li $v0, 4
syscall
# print num 2
lw $a0, 4($t0)
li $v0, 1
syscall
la $a0, comma
li $v0, 4
syscall
# print num 3
lw $a0, 8($t0)
li $v0, 1
syscall
la $a0, comma
li $v0, 4
syscall
# print num 4
lw $a0, 12($t0)
li $v0, 1
syscall
la $a0, comma
li $v0, 4
syscall
# print num 5
lw $a0, 16($t0)
li $v0, 1
syscall
la $a0, nl
li $v0, 4
syscall
# exit
li $v0, 10
syscall
|
programs/oeis/251/A251420.asm
|
neoneye/loda
| 22 |
172240
|
; A251420: Decimal expansion of Fisher's percolation exponent in two dimensions, 187/91.
; 2,0,5,4,9,4,5,0,5,4,9,4,5,0,5,4,9,4,5,0,5,4,9,4,5,0,5,4,9,4,5,0,5,4,9,4,5,0,5,4,9,4,5,0,5,4,9,4,5,0,5,4,9,4,5,0,5,4,9,4,5,0,5,4,9,4,5,0,5,4,9,4,5,0,5,4,9,4,5,0,5,4,9,4,5
lpb $0
mov $1,$0
trn $0,6
seq $1,160827 ; a(n) = 3*n^4 + 12*n^3 + 30*n^2 + 36*n + 17.
lpe
add $1,2
mod $1,10
mov $0,$1
|
libsrc/osca/set_bank.asm
|
andydansby/z88dk-mk2
| 1 |
18734
|
<reponame>andydansby/z88dk-mk2<gh_stars>1-10
;
; Get the OSCA Architecture current bank
; by <NAME>, 2011
;
; void set_bank(int bank);
;
; Sets which of the 32KB banks is mapped into address space $8000-$ffff
; bank = required bank (range: 0 - max_bank)
;
; $Id: set_bank.asm,v 1.3 2012/03/08 07:16:46 stefano Exp $
;
INCLUDE "flos.def"
XLIB set_bank
set_bank:
; __FASTCALL__
ld a,l
jp kjt_forcebank
|
programs/oeis/047/A047333.asm
|
karttu/loda
| 1 |
96582
|
<gh_stars>1-10
; A047333: Duplicate of A032796.
; 1,2,3,5,6,8,9,10,12,13,15,16,17,19,20,22,23,24,26,27,29,30,31,33,34
mov $1,$0
mul $1,7
div $1,5
add $1,1
|
stack.asm
|
siraben/awk-vm
| 8 |
240073
|
;; Simulating a stack and subroutine calls
j say_msg1
j say_msg2
lda 1
j push
lda 2
j push
lda 3
j push
j pop
put
j pop
put
j pop
put
halt
say_msg1
lda msg1
putn
ret
say_msg2
lda msg2
putn
ret
;; Push a value into the stack from the accumulator
push
sti sp
ld sp
inc
st sp
ret
;; Pop a value into the accumulator
pop
ld sp
dec
st sp
ldi sp
ret
sp const stack_start
stack_start blk 10
msg1 string "message 1"
msg2 string "message 2"
|
8086/8array/larinarr.asm
|
iamvk1437k/mpmc
| 1 |
247060
|
;mov si,1100h
;mov di,1200h
;mov cl,[si]
;inc si
;mov al,[si]
;dec cl
;again:
;inc si
;mov bl,[si]
;cmp al,bl
;ahead:
;dec cl
;jnz again
;mov [di],al
;hlt
org 100h
MOV SI,1100H ;Set SI register as point.
MOV CL,[SI] ;Set CL as count for element.
INC SI ;Increment address point
MOV AL,[SI] ;Get first data
DEC CL ;Decrement count
L2: INC SI ;Increment SI
CMP AL,[SI] ;Compare current smallest and next
JNB L1 ;If carry is not set,AL is largest and go to ahead
MOV AL,[SI] ;MOV BL to AL
L1: DEC CL ;Decrement count register
JNZ L2 ; If ZF=0,repeat comparison
MOV DI,1200H ; Store largest data in memory
MOV [DI],AL ; Initialize DI with1200h
HLT ;Halt the program.
|
programs/oeis/036/A036498.asm
|
neoneye/loda
| 22 |
17767
|
<reponame>neoneye/loda
; A036498: Numbers of the form m*(6*m-1) and m*(6*m+1), where m is an integer.
; 0,5,7,22,26,51,57,92,100,145,155,210,222,287,301,376,392,477,495,590,610,715,737,852,876,1001,1027,1162,1190,1335,1365,1520,1552,1717,1751,1926,1962,2147,2185,2380,2420,2625,2667,2882,2926,3151,3197,3432,3480,3725,3775,4030,4082,4347,4401,4676,4732,5017,5075,5370,5430,5735,5797,6112,6176,6501,6567,6902,6970,7315,7385,7740,7812,8177,8251,8626,8702,9087,9165,9560,9640,10045,10127,10542,10626,11051,11137,11572,11660,12105,12195,12650,12742,13207,13301,13776,13872,14357,14455,14950
mul $0,2
mov $2,$0
lpb $2
add $1,$0
add $0,4
add $1,3
trn $2,4
lpe
mov $0,$1
|
programs/oeis/124/A124174.asm
|
karttu/loda
| 1 |
9024
|
<reponame>karttu/loda
; A124174: Sophie Germain triangular numbers tr: 2*tr+1 is also a triangular number.
; 0,1,10,45,351,1540,11935,52326,405450,1777555,13773376,60384555,467889345,2051297326,15894464365,69683724540,539943899076,2367195337045,18342198104230,80414957735001,623094791644755,2731741367653000,21166880717817451
cal $0,77442 ; 2*a(n)^2 + 7 is a square.
pow $0,2
mov $1,$0
div $1,8
|
source/nodes/program-nodes-range_attribute_references.ads
|
reznikmm/gela
| 0 |
1134
|
<gh_stars>0
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Attribute_References;
with Program.Elements.Range_Attribute_References;
with Program.Element_Visitors;
package Program.Nodes.Range_Attribute_References is
pragma Preelaborate;
type Range_Attribute_Reference is
new Program.Nodes.Node
and Program.Elements.Range_Attribute_References
.Range_Attribute_Reference
and Program.Elements.Range_Attribute_References
.Range_Attribute_Reference_Text
with private;
function Create
(Range_Attribute : not null Program.Elements.Attribute_References
.Attribute_Reference_Access)
return Range_Attribute_Reference;
type Implicit_Range_Attribute_Reference is
new Program.Nodes.Node
and Program.Elements.Range_Attribute_References
.Range_Attribute_Reference
with private;
function Create
(Range_Attribute : not null Program.Elements.Attribute_References
.Attribute_Reference_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Range_Attribute_Reference
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Range_Attribute_Reference is
abstract new Program.Nodes.Node
and Program.Elements.Range_Attribute_References
.Range_Attribute_Reference
with record
Range_Attribute : not null Program.Elements.Attribute_References
.Attribute_Reference_Access;
end record;
procedure Initialize (Self : in out Base_Range_Attribute_Reference'Class);
overriding procedure Visit
(Self : not null access Base_Range_Attribute_Reference;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Range_Attribute
(Self : Base_Range_Attribute_Reference)
return not null Program.Elements.Attribute_References
.Attribute_Reference_Access;
overriding function Is_Range_Attribute_Reference
(Self : Base_Range_Attribute_Reference)
return Boolean;
overriding function Is_Constraint
(Self : Base_Range_Attribute_Reference)
return Boolean;
overriding function Is_Definition
(Self : Base_Range_Attribute_Reference)
return Boolean;
type Range_Attribute_Reference is
new Base_Range_Attribute_Reference
and Program.Elements.Range_Attribute_References
.Range_Attribute_Reference_Text
with null record;
overriding function To_Range_Attribute_Reference_Text
(Self : in out Range_Attribute_Reference)
return Program.Elements.Range_Attribute_References
.Range_Attribute_Reference_Text_Access;
type Implicit_Range_Attribute_Reference is
new Base_Range_Attribute_Reference
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Range_Attribute_Reference_Text
(Self : in out Implicit_Range_Attribute_Reference)
return Program.Elements.Range_Attribute_References
.Range_Attribute_Reference_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Range_Attribute_Reference)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Range_Attribute_Reference)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Range_Attribute_Reference)
return Boolean;
end Program.Nodes.Range_Attribute_References;
|
Samples/Kaleidoscope/Kaleidoscope.Parser/ANTLR/Kaleidoscope.g4
|
UbiquityDotNET/Llvm.NET
| 70 |
4725
|
// ANTLR4 Grammar for the LLVM Tutorial Sample Kaleidoscope language
// To support a progression through the chapters the language features are
// selectable and dynamically adjust the parsing accordingly. This allows a
// single parser implementation for all chapters, which allows the tutorial
// to focus on the actual use of Llvm.NET itself rather than on parsing.
//
grammar Kaleidoscope;
// Lexer Rules -------
fragment NonZeroDecimalDigit_: [1-9];
fragment DecimalDigit_: [0-9];
fragment Digits_: '0' | [1-9][0-9]*;
fragment EndOfFile_: '\u0000' | '\u001A';
fragment EndOfLine_
: ('\r' '\n')
| ('\r' |'\n' | '\u2028' | '\u2029')
| EndOfFile_
;
LPAREN: '(';
RPAREN: ')';
COMMA: ',';
SEMICOLON: ';';
DEF: 'def';
EXTERN: 'extern';
ASSIGN:'=';
ASTERISK: '*';
PLUS: '+';
MINUS:'-';
LEFTANGLE: '<';
SLASH: '/';
EXCLAMATION: '!';
PERCENT: '%';
AMPERSAND:'&';
PERIOD:'.';
COLON: ':';
RIGHTANGLE: '>';
QMARK: '?';
ATSIGN: '@';
BACKSLASH: '\\';
CARET: '^';
UNDERSCORE: '_';
VBAR: '|';
EQUALEQUAL: '==';
NOTEQUAL: '!=';
PLUSPLUS: '++';
MINUSMINUS: '--';
IF: {FeatureControlFlow}? 'if';
THEN: {FeatureControlFlow}? 'then';
ELSE: {FeatureControlFlow}? 'else';
FOR: {FeatureControlFlow}? 'for';
IN: {FeatureControlFlow}? 'in';
VAR: {FeatureMutableVars}? 'var';
UNARY: {FeatureUserOperators}? 'unary';
BINARY: {FeatureUserOperators}? 'binary';
LineComment: '#' ~[\r\n]* EndOfLine_ -> skip;
WhiteSpace: [ \t\r\n\f]+ -> skip;
Identifier: [a-zA-Z][a-zA-Z0-9]*;
Number: Digits_ ('.' DecimalDigit_+)?;
// Parser rules ------
// built-in operator symbols
builtinop
: ASSIGN
| ASTERISK
| PLUS
| MINUS
| SLASH
| LEFTANGLE
| CARET
;
// Allowed user defined binary symbols
userdefinedop
: EXCLAMATION
| PERCENT
| AMPERSAND
| PERIOD
| COLON
| RIGHTANGLE
| QMARK
| ATSIGN
| BACKSLASH
| UNDERSCORE
| VBAR
| EQUALEQUAL
| NOTEQUAL
| PLUSPLUS
| MINUSMINUS
;
// unary ops can re-use built-in binop symbols (Except ASSIGN)
unaryop
: ASTERISK
| PLUS
| MINUS
| SLASH
| LEFTANGLE
| CARET
| EXCLAMATION
| PERCENT
| AMPERSAND
| PERIOD
| COLON
| RIGHTANGLE
| QMARK
| ATSIGN
| BACKSLASH
| UNDERSCORE
| VBAR
| EQUALEQUAL
| NOTEQUAL
| PLUSPLUS
| MINUSMINUS
;
// All binary operators
binaryop
: ASSIGN
| ASTERISK
| PLUS
| MINUS
| SLASH
| LEFTANGLE
| CARET
| EXCLAMATION
| PERCENT
| AMPERSAND
| PERIOD
| COLON
| RIGHTANGLE
| QMARK
| ATSIGN
| BACKSLASH
| UNDERSCORE
| VBAR
| EQUALEQUAL
| NOTEQUAL
| PLUSPLUS
| MINUSMINUS
;
// pull the initializer out to a distinct rule so it is easier to get at
// the list of initializers when walking the parse tree
initializer
: Identifier (ASSIGN expression[0])?
;
// Non Left recursive expressions (a.k.a. atoms)
primaryExpression
: LPAREN expression[0] RPAREN # ParenExpression
| Identifier LPAREN (expression[0] (COMMA expression[0])*)? RPAREN # FunctionCallExpression
| VAR initializer (COMMA initializer)* IN expression[0] # VarInExpression
| IF expression[0] THEN expression[0] ELSE expression[0] # ConditionalExpression
| FOR initializer COMMA expression[0] (COMMA expression[0])? IN expression[0] # ForExpression
| {IsPrefixOp()}? unaryop expression[0] # UnaryOpExpression
| Identifier # VariableExpression
| Number # ConstExpression
;
// Need to make precedence handling explicit in the code behind
// since precedence is potentially user defined at runtime.
expression[int _p]
: primaryExpression
( {GetPrecedence() >= $_p}? binaryop expression[GetNextPrecedence()]
)*
;
prototype
: Identifier LPAREN (Identifier)* RPAREN # FunctionPrototype
| UNARY unaryop Number? LPAREN Identifier RPAREN # UnaryPrototype
| BINARY userdefinedop Number? LPAREN Identifier Identifier RPAREN # BinaryPrototype
;
repl
: DEF prototype expression[0] # FunctionDefinition
| EXTERN prototype # ExternalDeclaration
| expression[0] # TopLevelExpression
| SEMICOLON # TopLevelSemicolon
;
// Full source parse accepts a series of definitions or prototypes, all top level expressions
// are generated into a single function called Main()
fullsrc
: repl*;
|
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca_notsx.log_39_353.asm
|
ljhsiun2/medusa
| 9 |
245762
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xe3a1, %rax
nop
nop
nop
nop
add %r12, %r12
movb (%rax), %r15b
nop
nop
nop
nop
dec %rsi
lea addresses_A_ht+0x4c65, %rsi
lea addresses_normal_ht+0x19825, %rdi
clflush (%rdi)
nop
nop
and $3928, %r8
mov $114, %rcx
rep movsb
xor $39534, %rcx
lea addresses_WT_ht+0x1e455, %rax
sub %r15, %r15
mov $0x6162636465666768, %rcx
movq %rcx, %xmm2
vmovups %ymm2, (%rax)
nop
add $17322, %r8
lea addresses_WT_ht+0x1ba4b, %r8
nop
nop
nop
nop
cmp %rsi, %rsi
movl $0x61626364, (%r8)
nop
nop
xor $61773, %rsi
lea addresses_A_ht+0xc7e5, %r12
clflush (%r12)
nop
nop
nop
nop
xor %rax, %rax
mov $0x6162636465666768, %rcx
movq %rcx, %xmm1
vmovups %ymm1, (%r12)
and $50849, %r8
lea addresses_D_ht+0xa0e5, %r15
nop
nop
nop
and %rcx, %rcx
mov $0x6162636465666768, %rax
movq %rax, (%r15)
nop
nop
nop
nop
nop
inc %r15
lea addresses_D_ht+0x75e5, %rax
nop
and $35315, %rcx
mov $0x6162636465666768, %r15
movq %r15, (%rax)
nop
nop
nop
cmp $20519, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r8
push %r9
push %rcx
push %rdi
// Store
mov $0x460ab900000003c9, %r12
nop
add %rdi, %rdi
mov $0x5152535455565758, %rcx
movq %rcx, %xmm2
movaps %xmm2, (%r12)
nop
inc %r8
// Store
lea addresses_US+0x6f65, %r14
nop
nop
nop
nop
sub %r11, %r11
movl $0x51525354, (%r14)
nop
nop
and %r8, %r8
// Faulty Load
lea addresses_A+0x14fe5, %rdi
nop
xor $1113, %r8
mov (%rdi), %r11d
lea oracles, %rdi
and $0xff, %r11
shlq $12, %r11
mov (%rdi,%r11,1), %r11
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 9}}
{'00': 39}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
dec_to_bin_converter.asm
|
PrajeenRG/intel-8085-programs
| 0 |
178793
|
<gh_stars>0
; Decimal to Binary Converter
;
; input is taken at 0x7800H
; output is stored at the next 8 bits following input
MVI C, 08H ; counter for 8 bits
LXI H, 7800H ; loads input
MOV A, M ; move input to accumulator
Loop: INX H ; move to next address
RLC ; rotate accumulator left
MVI M, 00H ; sets memory to 0 by default
JNC Skip ; check if bit is 0
MVI M, 01H ; sets the bit to 1
Skip: DCR C ; decrement counter
JNZ Loop ; check for end
HLT ; HALT Program
|
oeis/349/A349487.asm
|
neoneye/loda-programs
| 11 |
14822
|
<filename>oeis/349/A349487.asm
; A349487: a(n) = A132739((n-5)*(n+5)).
; Submitted by <NAME>
; 11,24,39,56,3,96,119,144,171,8,231,264,299,336,3,416,459,504,551,24,651,704,759,816,7,936,999,1064,1131,48,1271,1344,1419,1496,63,1656,1739,1824,1911,16,2091,2184,2279,2376,99,2576,2679,2784,2891,24,3111
add $0,1
mov $1,$0
add $0,10
mul $0,$1
lpb $0
dif $0,5
lpe
|
Library/AccPnt/accpntList.asm
|
steakknife/pcgeos
| 504 |
99208
|
<gh_stars>100-1000
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Geoworks 1995 -- All Rights Reserved
PROJECT: socket
MODULE: access point database
FILE: accpntList.asm
AUTHOR: <NAME>, May 18, 1995
ROUTINES:
Name Description
---- -----------
AccessPointSelectorQueryItemMoniker
INT SelectorCreateCompoundMoniker
APSSetSingleSelection Set single selection & update triggers
AccessPointSelectorDelete
AccessPointSelectorDeleteOne
AccessPointSelectorDeleteMulti
AccessPointSelectorCreate
AccessPointSelectorEdit
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 5/18/95 Initial revision
DESCRIPTION:
AccessPointSelectorClass
$Id: accpntList.asm,v 1.20 98/05/29 19:01:39 jwu Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ControlCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AccessPointSelectorQueryItemMoniker
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the name of an access point
CALLED BY: MSG_GEN_DYNAMIC_LIST_QUERY_ITEM_MONIKER
PASS: *ds:si = AccessPointSelectorClass object
ds:di = AccessPointSelectorClass instance data
bp = position of item requested
RETURN: nothing
DESTROYED: ax,cx,dx,bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 4/27/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AccessPointSelectorQueryItemMoniker method dynamic AccessPointSelectorClass,
MSG_GEN_DYNAMIC_LIST_QUERY_ITEM_MONIKER
.enter
;
; if there are no real entries, this must be for the dummy item
;
mov dx, si
mov si, offset AccessPointIDMap
call ChunkArrayGetCount ; cx = count
jcxz placeholder
;
; fetch the access point ID
;
mov ax, bp
call ChunkArrayElementToPtr ; ds:di = elt
EC < ERROR_C CORRUPT_ACCESS_ID_MAP >
mov ax, ds:[di]
mov si, dx ; *ds:si = obj
;
; read the access point name
;
push bp
clr cx
mov dx, APSP_NAME
clr bp
call AccessPointGetStringProperty ; ^hbx = name
pop bp
jcxz nullName
;
; add a bitmap, if needed
;
push bx
call AccessPointGetType
mov ax,bx
pop bx
mov di, offset TelnetItemMoniker
cmp ax, APT_TELNET
je bitmapMoniker
mov di, offset TerminalItemMoniker
cmp ax, APT_TERMINAL
je bitmapMoniker
;
; set the list moniker to a simple string
;
textMoniker::
call MemLock
mov cx, ax
clr dx ; cx:dx = name
mov ax, MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_TEXT
call ObjCallInstanceNoLock
call MemFree
jmp done
;
; this is a dummy entry
;
placeholder:
call GetPlaceholderString ; *es:di = str
jmp common
nullName:
mov di, offset NullNameString
jc common ; no tmp blk
call MemFree ; free tmp blk
common:
mov bx, handle AccessPointStrings
call MemLock
mov es, ax
mov cx, ax
mov dx, es:[di] ; cx:dx = str
mov ax, MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_TEXT
mov si, offset AccessList
call ObjCallInstanceNoLock
call MemUnlock
jmp done
;
; set the list moniker to a VisMoniker
;
bitmapMoniker:
call SelectorCreateCompoundMoniker
mov ax,bp
sub sp, size ReplaceItemMonikerFrame
mov bp,sp
mov ss:[bp].RIMF_source.handle, bx
clr ss:[bp].RIMF_source.offset
mov ss:[bp].RIMF_sourceType, VMST_HPTR
mov ss:[bp].RIMF_dataType, VMDT_GSTRING
mov ss:[bp].RIMF_length, cx
clr ss:[bp].RIMF_width
clr ss:[bp].RIMF_height
clr ss:[bp].RIMF_itemFlags
mov ss:[bp].RIMF_item, ax
mov ax, MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_MONIKER
mov si, offset AccessList
call ObjCallInstanceNoLock
add sp, size ReplaceItemMonikerFrame
call MemFree
done:
.leave
ret
AccessPointSelectorQueryItemMoniker endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetPlaceholderString
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine what moniker to use for an empty list
CALLED BY: (INTERNAL) AccessPointSelectorQueryItemMoniker
PASS: ds - segment of list object
RETURN: di - offset of string in string segment
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
weber 5/16/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetPlaceholderString proc near
uses ax,bx,cx,dx,si,bp
.enter
;
; ask the controller what type it is
;
mov ax, MSG_ACCESS_POINT_CONTROL_GET_TYPE
call ObjBlockGetOutput
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
;
; is it a calling card controller?
;
cmp ax, APT_CALLING_CARD
jne normal
mov di, offset PhonePlaceholderString
jmp done
;
; all other types get the generic string
;
normal:
mov di, offset PlaceholderString
done:
.leave
ret
GetPlaceholderString endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SelectorCreateCompoundMoniker
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a compound moniker
CALLED BY: AccessPointSelectorQueryItemMoniker
PASS: ^hbx - item name
cx - item name length
di - offset of bitmap
RETURN: cx - size of gstring
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 7/28/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SelectorCreateCompoundMoniker proc near
uses ax,bx,dx,si,di,bp,ds,es
.enter
;
; make room in the block containing the name
;
mra::
DBCS < shl cx >
push cx
mov ax, cx
add ax, size OpDrawBitmapOptr + size OpDrawText + size OpEndGString + size TCHAR
mov ch, mask HAF_LOCK
call MemReAlloc ; ax = segment
pop cx
;
; now shift the string down to make room for the bitmap and the
; text headers
;
sdown::
push cx,di
mov ds,ax
mov es,ax
mov si, cx
mov di, si
add di, size OpDrawBitmapOptr + size OpDrawText
inc cx ; include null
DBCS < inc cx >
std
rep movsb
cld
pop cx,di
;
; put an OpDrawBitmapOptr at the top of the block
;
odbop::
mov ds:[ODBOP_opcode], GR_DRAW_BITMAP_OPTR
clr ds:[ODBOP_x]
clr ds:[ODBOP_y]
mov ds:[ODBOP_optr].handle, handle AccessPointStrings
mov ds:[ODBOP_optr].offset, di
;
; get the width of the bitmap
;
gwidth::
push bx
mov bx, handle AccessPointStrings
call MemLock
mov es,ax
mov di, es:[di]
mov ax, es:[di].B_width
call MemUnlock
pop bx
add ax, ITEM_BITMAP_SPACING
;
; now put in the text opcode
;
odt::
mov ds:[size OpDrawBitmapOptr][ODT_opcode], GR_DRAW_TEXT
mov ds:[size OpDrawBitmapOptr][ODT_x1], ax
mov ds:[size OpDrawBitmapOptr][ODT_y1], 0
DBCS < shr cx >
mov ds:[size OpDrawBitmapOptr][ODT_len], cx
DBCS < shl cx >
;
; add an END marker
;
oegs::
add cx, size OpDrawBitmapOptr + size OpDrawText + size TCHAR
mov si, cx
mov {byte}ds:[si], GR_END_GSTRING
;
; return size of string
;
rval::
add cx, size OpEndGString
.leave
ret
SelectorCreateCompoundMoniker endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
APSSetSingleSelection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set a single selection in the list. Intercepted to
enable/disable triggers as may be affected by selection
and number of entries in list.
CALLED BY: MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
PASS: *ds:si = AccessPointSelectorClass object
es = segment of AccessPointSelectorClass
ax = message #
cx = identifier of the item to select
dx = non-zero if indeterminate
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
Let superclass make selection.
If no triggers, don't do anything.
Get selection ID if any and update triggers.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 12/20/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
APSSetSingleSelection method dynamic AccessPointSelectorClass,
MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
;
; Let superclass make the selection first.
;
push cx
mov di, offset AccessPointSelectorClass
call ObjCallSuperNoLock
pop cx
if _EDIT_ENABLE
;
; Do nothing if there are no triggers.
;
push cx
call ObjBlockGetOutput
mov ax, MSG_GEN_CONTROL_GET_NORMAL_FEATURES
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax = features mask
pop cx
Assert record, ax, AccessPointControlFeatures
test ax, mask APCF_EDIT
jz done
;
; If no access points, the selection is a dummy.
;
mov ax, cx ; save index
mov si, offset AccessPointIDMap
call ChunkArrayGetCount ; cx = count
jcxz noEntries
;
; Map selection to ID & update triggers.
;
mov si, offset AccessPointIDMap
call ChunkArrayElementToPtr
mov ax, ds:[di] ; ax = accpnt ID
noEntries:
call UpdateTriggersForSelection
done:
endif ; _EDIT_ENABLE
ret
APSSetSingleSelection endm
if _EDIT_ENABLE
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UpdateTriggersForSelection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Enable/disable triggers based on selection(s).
CALLED BY: APSSetSingleSelection
LockAccessPointHandler
PASS: ds = segment of object block
ax = accpnt ID of selection, if any
cx = number of accpnts total
RETURN: nothing
DESTROYED: ax, bx,cx, dx, bp, di, si, es
PSEUDO CODE/STRATEGY:
If no access points or accpnt in use, disable edit
else enable edit
if more than 1 access point, update delete same as edit
else disable delete
if list is not empty, enable app's object
else disable app's object
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 1/18/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UpdateTriggersForSelection proc near
.enter
;
; If access point is in use by a connection, disable edit
; trigger. Else enable it.
;
mov dx, cx ; save count
jcxz noEntries
mov cx, MSG_GEN_SET_ENABLED
call AccessPointInUse
jnc update
noEntries:
mov cx, MSG_GEN_SET_NOT_ENABLED
update:
push cx, dx ; save count & msg
mov_tr ax, cx
mov dl, VUM_NOW
mov si, offset AccessEditTrigger
call ObjCallInstanceNoLock
pop ax, dx ; ax = msg, dx = count
;
; Treat the delete trigger the same as edit.
;
push dx ; save count for later
mov dl, VUM_NOW
mov si, offset AccessDeleteTrigger
call ObjCallInstanceNoLock
;
; Get enableDisable object and enable it if it exists.
; If there are no entries, then we disable it.
;
mov ax, MSG_ACCESS_POINT_CONTROL_GET_ENABLE_DISABLE
call ObjBlockGetOutput ; ^lbx:si = output
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
movdw bxsi, cxdx ; ^lbx:si = object to enable
pop dx ; dx = count
tst bx
jz done
mov ax, MSG_GEN_SET_ENABLED
tst dx
jnz updateEnableDisable
mov ax, MSG_GEN_SET_NOT_ENABLED
updateEnableDisable:
mov dl, VUM_NOW
mov di, mask MF_FORCE_QUEUE or mask MF_FIXUP_DS
call ObjMessage
done:
.leave
ret
UpdateTriggersForSelection endp
endif ; _EDIT_ENABLE
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AccessPointSelectorDelete
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Delete an access point
CALLED BY: MSG_ACCESS_POINT_SELECTOR_DELETE
PASS: *ds:si = AccessPointSelectorClass object
ds:di = AccessPointSelectorClass instance data
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 4/27/95 Initial version
jwu 1/01/97 multiple deletions supported
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AccessPointSelectorDelete method dynamic AccessPointSelectorClass,
MSG_ACCESS_POINT_SELECTOR_DELETE
.enter
;
; make sure there are at least two items
;
mov si, offset AccessPointIDMap
call ChunkArrayGetCount ; cx=count
cmp cx,1
EC < WARNING_BE IGNORING_DELETE_REQUEST >
jbe done
;
; suspend input
;
clr bx
call GeodeGetAppObject
mov ax, MSG_GEN_APPLICATION_IGNORE_INPUT
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
;
; Figure out how many items we're deleting. Single &
; multiple deletes require different processing & error msgs.
;
call ObjBlockGetOutput
mov ax, MSG_ACCESS_POINT_CONTROL_GET_NUM_SELECTIONS
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax = count
cmp ax, 1
jb resume
ja multi
call AccessPointSelectorDeleteOne
jmp resume
multi:
call AccessPointSelectorDeleteMulti ; dx = type
resume:
;
; record a resume-input event
;
clr bx
call GeodeGetAppObject
mov ax, MSG_GEN_APPLICATION_ACCEPT_INPUT
mov di, mask MF_RECORD
call ObjMessage ; di = event
;
; after the controller has handled the deletion notification
; it will dispatch the resume-input event on to the application
;
call ObjBlockGetOutput ; ^lbx:si = controller
mov ax, MSG_META_DISPATCH_EVENT
mov cx, di ; event to send
mov dx, mask MF_FORCE_QUEUE ; flags for sending it
mov di, mask MF_FORCE_QUEUE
call ObjMessage
done:
.leave
ret
AccessPointSelectorDelete endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AccessPointSelectorDeleteOne
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Delete one access point.
CALLED BY: AccessPointSelectorDelete
PASS: ^lbx:si = controller
ds = segment of AccessPointSelectorClass object
RETURN: carry set if deletion failed
DESTROYED: ax, cx, dx, di, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 1/ 1/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AccessPointSelectorDeleteOne proc near
;
; Figure out which access point to delete & delete it
; from the database.
;
mov ax, MSG_ACCESS_POINT_CONTROL_GET_SELECTION
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax = selection
call AccessPointDestroyEntry ; carry set if error
ret
AccessPointSelectorDeleteOne endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AccessPointSelectorDeleteMulti
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Delete more than one access point.
CALLED BY: AccessPointSelectorDelete
PASS: ^lbx:si = controller
ds = segment of AccessPointSelectorClass object
ax = number of selections
RETURN: carry set if one or more couldn't be deleted
dx = entry type
DESTROYED: ax, bx, cx, di, si, bp, es
PSEUDO CODE/STRATEGY:
Alloc block (size = num selections + 1 for count and
get selected IDs.
Delete selected IDs without notification, allowing
list to become empty.
When done, generate batched notification.
NOTES:
Do NOT free block. Needed for notification.
Letting the list become empty isn't very nice,
but it's too hard to figure out which one not to
delete.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 1/ 1/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AccessPointSelectorDeleteMulti proc near
;
; Allocate block for IDs of selections.
;
push ax, bx
inc ax ; add 1 for ocunt
shl ax ; word sized IDs
mov cx, (HAF_STANDARD_LOCK shl 8) or \
(mask HF_SHARABLE or mask HF_SWAPABLE)
call MemAlloc
mov es, ax
clr di
mov bp, bx ; save block handle
pop ax, bx ; ax = count
;
; Store count & get selection IDs.
;
push bp
stosw ; es:di adjusted
movdw cxdx, esdi
mov_tr bp, ax ; bp = count
mov ax, MSG_ACCESS_POINT_CONTROL_GET_MULTIPLE_SELECTIONS
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax = count
;
; Delete each of the selections. Batch notifications
; until the end.
;
push ds
movdw dssi, cxdx ; ds:si = IDs
mov_tr cx, ax ; cx = count
clr bp
deleteLoop:
lodsw ; ax = selection
call AccessPointDestroyEntryNoNotify ; dx = type
adc bp, 0 ; track errors
loop deleteLoop
pop ds
;
; Unlock block of IDs and send notification.
;
pop bx
call MemUnlock
call AccessPointMultiDestroyDone
;
; Report if there were any errors.
;
tst_clc bp
jz done
stc ; return error
done:
ret
AccessPointSelectorDeleteMulti endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AccessPointSelectorCreate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create an access point
CALLED BY: MSG_ACCESS_POINT_SELECTOR_CREATE
PASS: *ds:si = AccessPointSelectorClass object
ds:di = AccessPointSelectorClass instance data
RETURN: nothing
DESTROYED: ax,cx,dx,bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
We do not directly add the new access point to ourselves, but let
the controller do that in response to a notification from
AccessPointCreateEntry. Since that notification is queued, we must
also queue our requests to select and edit the new item, since
it won't be valid until the notification is received. Hence we
have to do some fancy footwork to keep input suspended until the
output has had a chance to see the edit message.
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 4/27/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AccessPointSelectorCreate method dynamic AccessPointSelectorClass,
MSG_ACCESS_POINT_SELECTOR_CREATE
.enter
;
; check disk space
;
;
; suspend input
;
clr bx
call GeodeGetAppObject
mov ax, MSG_GEN_APPLICATION_IGNORE_INPUT
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
;
; ask the controller what type we are
;
mov ax, MSG_ACCESS_POINT_CONTROL_GET_TYPE
call ObjBlockGetOutput ; ^lbx:si = controller
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax = type
;
; get current selection
;
push ax
mov ax, MSG_ACCESS_POINT_CONTROL_GET_SELECTION
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax = selection
;
; create an entry in the database before the current selection
; if no current selection (cx=0), it goes at the end
;
mov bx, ax ; bx = selection
pop ax ; ax = type
call AccessPointCreateEntry ; ax = entry ID
;
; select it
;
mov cx, ax
call ObjBlockGetOutput ; ^lbx:si = controller
mov ax, MSG_ACCESS_POINT_CONTROL_SET_SELECTION
mov di, mask MF_FORCE_QUEUE
call ObjMessage
;
; edit it
;
mov ax, MSG_ACCESS_POINT_CONTROL_SEND_EDIT_MSG
mov di, mask MF_FORCE_QUEUE
call ObjMessage
;
; resume input, in a roundabout sorta way
;
; 1. list queues message to controller
; 2. controller queues message to its output
; 3. output object queues message back to application
;
resume::
;
; step 3: tell application to resume input
;
clr bx
call GeodeGetAppObject
mov ax, MSG_GEN_APPLICATION_ACCEPT_INPUT
mov di, mask MF_RECORD
call ObjMessage ; di = event
;
; step 2: tell something to do step 3
;
clrdw bxsi
mov ax, MSG_META_DISPATCH_EVENT
mov cx, di
mov dx, mask MF_FORCE_QUEUE
mov di, mask MF_RECORD
call ObjMessage
;
; step 1: tell controller to tell output about step 2
;
call ObjBlockGetOutput
mov ax, MSG_GEN_CONTROL_OUTPUT_ACTION
mov bp, di
mov di, mask MF_FORCE_QUEUE
call ObjMessage
done::
.leave
ret
AccessPointSelectorCreate endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AccessPointSelectorEdit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Edit the current selection
CALLED BY: MSG_ACCESS_POINT_SELECTOR_EDIT
PASS: *ds:si = AccessPointSelectorClass object
ds:di = AccessPointSelectorClass instance data
RETURN: nothing
DESTROYED: everything
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 4/27/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AccessPointSelectorEdit method dynamic AccessPointSelectorClass,
MSG_ACCESS_POINT_SELECTOR_EDIT
.enter
;
; check disk space
;
;
; get the current selection
;
call ObjBlockGetOutput ; ^lbx:si = controller
mov ax, MSG_ACCESS_POINT_CONTROL_GET_SELECTION
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax = selection
jc done
;
; otherwise make it the current value
;
mov cx, ax ; cx = selection
mov ax, MSG_ACCESS_POINT_CONTROL_SEND_EDIT_MSG
mov di, mask MF_CALL
call ObjMessage
done:
.leave
ret
AccessPointSelectorEdit endm
ControlCode ends
|
AlgorithmsFromTheBook/multiplication.asm
|
MateoParrado/AlgorithmsFromTheBook
| 0 |
240004
|
PUBLIC asm_multiply
.386
.model flat, c
.code
asm_multiply PROC
;get the two parameters, put one in ebc and the other in edx
push ebp
mov ebp, esp
mov ebx, [ebp + 8]
mov edx, [ebp + TYPE DWORD + 8]
mov eax, 0
mov cl, 31
Redo:
;if ecx is zero, youre done
cmp edx, 0
jne notZero
pop ebp
ret
notZero:
test edx, 80000000h
jz shift
mov esi, [ebp + 8]
shl esi, cl
add eax, esi
shift:
shl edx, 1
dec cl
jmp redo
asm_multiply ENDP
end
|
libsrc/_DEVELOPMENT/stdio/c/sdcc_iy/getdelim_unlocked.asm
|
meesokim/z88dk
| 0 |
85843
|
<filename>libsrc/_DEVELOPMENT/stdio/c/sdcc_iy/getdelim_unlocked.asm
; size_t getdelim_unlocked(char **lineptr, size_t *n, int delimiter, FILE *stream)
SECTION code_stdio
PUBLIC _getdelim_unlocked
EXTERN asm_getdelim_unlocked
_getdelim_unlocked:
pop af
pop hl
pop de
pop bc
pop ix
push hl
push bc
push de
push hl
push af
jp asm_getdelim_unlocked
|
lib/am335x_sdk/ti/drv/i2c/firmware/icss_i2c/src/I2C_protocol.asm
|
brandonbraun653/Apollo
| 2 |
165151
|
;
; TEXAS INSTRUMENTS TEXT FILE LICENSE
;
; Copyright (c) 2017-2018 Texas Instruments Incorporated
;
; All rights reserved not granted herein.
;
; Limited License.
;
; Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
; license under copyrights and patents it now or hereafter owns or controls to
; make, have made, use, import, offer to sell and sell ("Utilize") this software
; subject to the terms herein. With respect to the foregoing patent license,
; such license is granted solely to the extent that any such patent is necessary
; to Utilize the software alone. The patent license shall not apply to any
; combinations which include this software, other than combinations with devices
; manufactured by or for TI (“TI Devices”). No hardware patent is licensed hereunder.
;
; Redistributions must preserve existing copyright notices and reproduce this license
; (including the above copyright notice and the disclaimer and (if applicable) source
; code license limitations below) in the documentation and/or other materials provided
; with the distribution.
;
; Redistribution and use in binary form, without modification, are permitted provided
; that the following conditions are met:
; No reverse engineering, decompilation, or disassembly of this software is
; permitted with respect to any software provided in binary form.
; Any redistribution and use are licensed by TI for use only with TI Devices.
; Nothing shall obligate TI to provide you with source code for the software
; licensed and provided to you in object code.
;
; If software source code is provided to you, modification and redistribution of the
; source code are permitted provided that the following conditions are met:
; Any redistribution and use of the source code, including any resulting derivative
; works, are licensed by TI for use only with TI Devices.
; Any redistribution and use of any object code compiled from the source code
; and any resulting derivative works, are licensed by TI for use only with TI Devices.
;
; Neither the name of Texas Instruments Incorporated nor the names of its suppliers
; may be used to endorse or promote products derived from this software without
; specific prior written permission.
;
; DISCLAIMER.
;
; THIS SOFTWARE IS PROVIDED BY TI AND TI’S LICENSORS "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 TI AND TI’S
; LICENSORS 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.
;
; file: I2C_protocol.asm
;
; brief: This files contains all state table transition function.
;
;
; (C) Copyright 2017-2018, Texas Instruments, Inc
;
;
;.fcnolist ; suppress listing of false conditional blocks in lister output
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; In all state, the processing is broken into multiple state we have a tight budget of
; 20 cycles per state.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Includes Section
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.include "I2C_function.h"
.def RESET_MODE
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
;
; SMBUS not supported on AM437x ICSS0.
; AM437x IMEM size 4 kB.
; This is too small for current program size w/ SMBUS support.
;
; These functions are exported for SMBSUS functionality.
; Otherwise used locally in this file.
.def STOP_CONDITION_SCL_HIGH
.def RAISE_HOST_INTERRUPT_MEM_FOR_READY
.def RX_DATA_SDA_BEGIN
.def START_CONDITION_SDA_LOW
.def TX_DATA_SDA_BEGIN
.def DATA_PROCESSING_COMPLETE
.def CMD_CODE_SDA_BEGIN ; SMBUS
.ref QUICK_CMD_MODE ; SMBUS
.ref SEND_BYTE_MODE ; SMBUS
.ref RECEIVE_BYTE_MODE ; SMBUS
.ref WRITE_BYTE_MODE ; SMBUS
.ref READ_BYTE_MODE ; SMBUS
.ref WRITE_WORD_MODE ; SMBUS
.ref READ_WORD_MODE ; SMBUS
.ref BLOCK_WRITE_MODE ; SMBUS
.ref BLOCK_READ_MODE ; SMBUS
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This is the initial mode in which comes out of reset
; It checks if the enabled bit is set or not.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RESET_MODE:
LBBO &WORK_REG_4, R10, ICSS_I2C_CON_OFFSET, 4
QBBC RESET_MODE_RETURN, WORK_REG_4, ICSS_I2C_MODULE_ENABLE_BIT
UPDATE_NEXT_LOCAL_STATE CHECK_SETUP_COMMAND
RESET_MODE_RETURN:
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; In this state, firmware is only out of reset
; The only command it can accept in the state is setup command.
; if any other command is passed it will send invalid command response back
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CHECK_SETUP_COMMAND:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBEQ CHECK_SETUP_COMMAND_RETURN, WORK_REG_4.w2, 0x00
QBNE CHECK_SETUP_COMMAND_ERROR, WORK_REG_4.w2, ICSS_I2C_SETUP_CMD
UPDATE_NEXT_LOCAL_STATE SETUP_I2C_PRU_PIN_NUM
STATE_TASK_OVER
CHECK_SETUP_COMMAND_ERROR:
UPDATE_NEXT_LOCAL_STATE RAISE_HOST_INTERRUPT_MEM_FOR_ERROR
LDI WORK_REG_4.w0, INVALID_COMMAND
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
STATE_TASK_OVER
CHECK_SETUP_COMMAND_RETURN:
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This state load the PRU pins no. for the instance.
; It load SDA -> IEP DIGIO, SCL -> PRU GPO and SDA -> PRU GPI pins numbers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETUP_I2C_PRU_PIN_NUM:
LBBO &R14, R10, ICSS_I2C_PRU_PIN_OFFSET, 4
LDI R14.b3, 0x00
UPDATE_NEXT_LOCAL_STATE SETUP_I2C_INST_ID
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This instance id of the FW is being loaded into the register.
; This id helps the FW to decide which bit to raise high when raising an interrupt.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETUP_I2C_INST_ID:
LBBO &R14.b3, R10, ICSS_I2C_PRU_INST_ID_OFFSET, 1
UPDATE_NEXT_LOCAL_STATE SETUP_I2C_SCL_SDA_HIGH
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This set the SCL clk line and SDA data line high.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETUP_I2C_SCL_SDA_HIGH:
SET_SCL_PIN_HIGH
SET_SDA_PIN_HIGH
UPDATE_NEXT_LOCAL_STATE SETUP_I2C_TX_FIFO_SIZE
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This configures the Tx fifo size of the firmware
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETUP_I2C_TX_FIFO_SIZE:
LBBO &R16.b2, R10, ICSS_I2C_BUF_OFFSET, 1
UPDATE_NEXT_LOCAL_STATE SETUP_I2C_RX_FIFO_SIZE
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This configures the Rx fifo size of the firmware
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETUP_I2C_RX_FIFO_SIZE:
LBBO &R16.b3, R10, ICSS_I2C_BUF_OFFSET+1, 1
UPDATE_NEXT_LOCAL_STATE SETUP_I2C_MASTER_SLAVE_MODE
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This configures the firmware into master or slave mode
; currently only master mode is supported.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETUP_I2C_MASTER_SLAVE_MODE:
LBBO &WORK_REG_4, R10, ICSS_I2C_CON_OFFSET, 4
QBBC SETUP_I2C_MASTER_SLAVE_ERROR, WORK_REG_4, ICSS_I2C_MASTER_SLAVE_MODE_BIT
UPDATE_NEXT_LOCAL_STATE SETUP_I2C_ADDRESSING_MODE
STATE_TASK_OVER
SETUP_I2C_MASTER_SLAVE_ERROR:
UPDATE_NEXT_LOCAL_STATE RAISE_HOST_INTERRUPT_MEM_FOR_ERROR
LDI WORK_REG_4.w0, MASTER_SLAVE_MODE_FAILED
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This configures the firmware for 10 bits or 8 bits addressing mode
; currently only 7 bits mode is supported.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETUP_I2C_ADDRESSING_MODE:
LBBO &WORK_REG_4, R10, ICSS_I2C_CON_OFFSET, 4
QBBS SETUP_I2C_ADDRESSING_10BIT, WORK_REG_4, ICSS_I2C_ADDRESSING_MODE_BIT
CLR R16, R16, ICSS_I2C_ADDRESSING_MODE_BIT
JMP SETUP_I2C_ADDRESSING_DONE
SETUP_I2C_ADDRESSING_10BIT:
SET R16, R16, ICSS_I2C_ADDRESSING_MODE_BIT
SETUP_I2C_ADDRESSING_DONE:
UPDATE_NEXT_LOCAL_STATE SETUP_I2C_START_CTRL
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This configures the firmware for sending start bit at beginning or not
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETUP_I2C_START_CTRL:
LBBO &WORK_REG_4, R10, ICSS_I2C_CON_OFFSET, 4
QBBC SETUP_I2C_NO_START_CTRL, WORK_REG_4, ICSS_I2C_START_BIT
SET R16, R16, ICSS_I2C_START_BIT
JMP SETUP_I2C_START_DONE
SETUP_I2C_NO_START_CTRL:
CLR R16, R16, ICSS_I2C_START_BIT
SETUP_I2C_START_DONE:
UPDATE_NEXT_LOCAL_STATE SETUP_I2C_STOP_CTRL
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This configures the firmware for sending stop bit at end of data transfer
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETUP_I2C_STOP_CTRL:
LBBO &WORK_REG_4, R10, ICSS_I2C_CON_OFFSET, 4
QBBC SETUP_I2C_NO_STOP_CTRL, WORK_REG_4, ICSS_I2C_STOP_BIT
SET R16, R16, ICSS_I2C_STOP_BIT
JMP SETUP_I2C_STOP_DONE
SETUP_I2C_NO_STOP_CTRL:
CLR R16, R16, ICSS_I2C_STOP_BIT
SETUP_I2C_STOP_DONE:
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
UPDATE_NEXT_LOCAL_STATE SETUP_I2C_SMBUS_BURST_CTRL
.else ; remove SMBUS, bypass SMBUS Burst mode set up
UPDATE_NEXT_LOCAL_STATE SETUP_I2C_NACK_CTRL
.endif
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This configures the firmware for sending start bit at beginning or not
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
SETUP_I2C_SMBUS_BURST_CTRL:
LBBO &WORK_REG_4, R10, ICSS_I2C_CON_OFFSET, 4
QBBC SETUP_I2C_NO_SMBUS_BURST_CTRL, WORK_REG_4, ICSS_I2C_SMBUS_BURST_BIT
SET R16, R16, ICSS_I2C_SMBUS_BURST_BIT
JMP SETUP_I2C_SMBUS_BURST_DONE
SETUP_I2C_NO_SMBUS_BURST_CTRL:
CLR R16, R16, ICSS_I2C_SMBUS_BURST_BIT
SETUP_I2C_SMBUS_BURST_DONE:
UPDATE_NEXT_LOCAL_STATE SETUP_I2C_NACK_CTRL
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This configures the firmware for ending the read operation with NACK or not
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETUP_I2C_NACK_CTRL:
LBBO &WORK_REG_4, R10, ICSS_I2C_CON_OFFSET, 4
QBBC SETUP_I2C_NO_NACK_CTRL, WORK_REG_4, ICSS_I2C_RECIEVE_NACK_BIT
SET R16, R16, ICSS_I2C_RECIEVE_NACK_BIT
JMP SETUP_I2C_NACK_DONE
SETUP_I2C_NO_NACK_CTRL:
CLR R16, R16, ICSS_I2C_RECIEVE_NACK_BIT
SETUP_I2C_NACK_DONE:
UPDATE_NEXT_LOCAL_STATE RAISE_HOST_INTERRUPT_MEM_FOR_READY
LDI WORK_REG_4.w0, COMMAND_SUCCESS
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Set the MMap for host to find out which instance raised the interrupt.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RAISE_HOST_INTERRUPT_MEM_FOR_ERROR:
RAISE_INTERRUPT_MEM_FOR_HOST RAISE_HOST_INTERRUPT_FOR_ERROR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Raise interrupt for Host while the firmware was trying to configure
; setup procedures.
; after raising the interrupt wait for host to respond.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RAISE_HOST_INTERRUPT_FOR_ERROR:
RAISE_INTERRUPT_FOR_HOST CHECK_HOST_INTERRUPT_ERROR_RECEIVED
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; check for host to receive the command response
; then jump to "reset" mode again for reconfiguration
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CHECK_HOST_INTERRUPT_ERROR_RECEIVED:
CHECK_INTERRUPT_RECEIVED RESET_MODE, RAISE_HOST_INTERRUPT_FOR_ERROR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Set the MMap for host to find out which instance raised the interrupt.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RAISE_HOST_INTERRUPT_MEM_FOR_READY:
RAISE_INTERRUPT_MEM_FOR_HOST RAISE_HOST_INTERRUPT_FOR_READY
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Raise interrupt for Host while the firmware succesfully does setup configuration
; but fails to any transaction i.e. read or write.
; after raising the interrupt wait for host to respond.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RAISE_HOST_INTERRUPT_FOR_READY:
RAISE_INTERRUPT_FOR_HOST CHECK_HOST_INTERRUPT_READY_RECEIVED
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; check for host to receive the command response
; then jump to "firmware ready" mode again to do a transaction again
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CHECK_HOST_INTERRUPT_READY_RECEIVED:
CHECK_INTERRUPT_RECEIVED FIRMWARE_READY, RAISE_HOST_INTERRUPT_FOR_READY
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; In this state, firmware is out of reset succesfully
; firmware is ready to accept any command and check if the command word is not "0x0000"
; then start to check which command is passed.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FIRMWARE_READY:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBEQ FIRMWARE_READY_RETURN, WORK_REG_4.w2, 0x00
UPDATE_NEXT_LOCAL_STATE ICSS_I2C_RESET_CMD_CHECK
FIRMWARE_READY_RETURN:
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the reset command has been passed.
; if reset command is passed then resets the firmware else check for another command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ICSS_I2C_RESET_CMD_CHECK:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_I2C_RESET_CMD_CHECK_RETURN, WORK_REG_4.w2, ICSS_I2C_RESET_CMD
UPDATE_NEXT_LOCAL_STATE RESET_SCL_SDA_HIGH
LDI WORK_REG_4.w0, COMMAND_SUCCESS
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
STATE_TASK_OVER
ICSS_I2C_RESET_CMD_CHECK_RETURN:
UPDATE_NEXT_LOCAL_STATE ICSS_I2C_SETUP_CMD_CHECK
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; set the value on iep gpo enable register to high value
; this will pull the line to high impedence and open drain will keep the line high
; set the value on iep gpo to low value for pulling the line
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RESET_SCL_SDA_HIGH:
SET_OUTPUT_PIN_VALUE_HIGH RAISE_HOST_INTERRUPT_MEM_FOR_ERROR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the setup command has been passed.
; if setup command is passed then redo the firmware setup procedure
; else check for another command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ICSS_I2C_SETUP_CMD_CHECK:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_I2C_SETUP_CMD_CHECK_RETURN, WORK_REG_4.w2, ICSS_I2C_SETUP_CMD
UPDATE_NEXT_LOCAL_STATE RESET_MODE
STATE_TASK_OVER
ICSS_I2C_SETUP_CMD_CHECK_RETURN:
UPDATE_NEXT_LOCAL_STATE ICSS_I2C_RX_CMD_CHECK
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the Rx command has been passed.
; if Rx command is passed then start receive data procedure
; else check for another command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ICSS_I2C_RX_CMD_CHECK:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_I2C_RX_CMD_CHECK_RETURN, WORK_REG_4.w2, ICSS_I2C_RX_CMD
UPDATE_NEXT_LOCAL_STATE RX_MODE
STATE_TASK_OVER
ICSS_I2C_RX_CMD_CHECK_RETURN:
UPDATE_NEXT_LOCAL_STATE ICSS_I2C_TX_CMD_CHECK
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the Tx command has been passed.
; if Tx command is passed then start transmit data procedure
; else check for another command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ICSS_I2C_TX_CMD_CHECK:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_I2C_TX_CMD_CHECK_RETURN, WORK_REG_4.w2, ICSS_I2C_TX_CMD
UPDATE_NEXT_LOCAL_STATE TX_MODE
STATE_TASK_OVER
ICSS_I2C_TX_CMD_CHECK_RETURN:
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
UPDATE_NEXT_LOCAL_STATE ICSS_SMBUS_QUICK_CHECK
.else ; remove SMBUS, bypass all SMBUS command checks
UPDATE_NEXT_LOCAL_STATE ICSS_I2C_READ_SCL_CMD_CHECK
.endif
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the smbus Quick command has been passed.
; if Quick command is passed then start Quick data procedure
; else check for another command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
ICSS_SMBUS_QUICK_CHECK:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_SMBUS_QUICK_CMD_CHECK_NEXT, WORK_REG_4.w2, ICSS_SMBUS_QUICK_CMD
UPDATE_NEXT_LOCAL_STATE QUICK_CMD_MODE
STATE_TASK_OVER
ICSS_SMBUS_QUICK_CMD_CHECK_NEXT:
UPDATE_NEXT_LOCAL_STATE ICSS_SMBUS_SEND_BYTE
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the smbus send byte command has been passed.
; if send byte command is passed then start send byte data procedure
; else check for another command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
ICSS_SMBUS_SEND_BYTE:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_SMBUS_SEND_BYTE_CHECK_NEXT, WORK_REG_4.w2, ICSS_SMBUS_SEND_BYTE_CMD
UPDATE_NEXT_LOCAL_STATE SEND_BYTE_MODE
STATE_TASK_OVER
ICSS_SMBUS_SEND_BYTE_CHECK_NEXT:
UPDATE_NEXT_LOCAL_STATE ICSS_SMBUS_RECEIVE_BYTE
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the smbus receive byte command has been passed.
; if receive byte command is passed then start receive byte data procedure
; else check for another command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
ICSS_SMBUS_RECEIVE_BYTE:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_SMBUS_RECEIVE_BYTE_CHECK_NEXT, WORK_REG_4.w2, ICSS_SMBUS_RECEIVE_BYTE_CMD
UPDATE_NEXT_LOCAL_STATE RECEIVE_BYTE_MODE
STATE_TASK_OVER
ICSS_SMBUS_RECEIVE_BYTE_CHECK_NEXT:
UPDATE_NEXT_LOCAL_STATE ICSS_SMBUS_WRITE_BYTE
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the smbus write byte command has been passed.
; if write byte command is passed then start write byte data procedure
; else check for another command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
ICSS_SMBUS_WRITE_BYTE:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_SMBUS_WRITE_BYTE_CHECK_NEXT, WORK_REG_4.w2, ICSS_SMBUS_WRITE_BYTE_CMD
UPDATE_NEXT_LOCAL_STATE WRITE_BYTE_MODE
STATE_TASK_OVER
ICSS_SMBUS_WRITE_BYTE_CHECK_NEXT:
UPDATE_NEXT_LOCAL_STATE ICSS_SMBUS_READ_BYTE
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the smbus read byte command has been passed.
; if read byte command is passed then start read byte data procedure
; else check for another command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
ICSS_SMBUS_READ_BYTE:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_SMBUS_READ_BYTE_CHECK_NEXT, WORK_REG_4.w2, ICSS_SMBUS_READ_BYTE_CMD
UPDATE_NEXT_LOCAL_STATE READ_BYTE_MODE
STATE_TASK_OVER
ICSS_SMBUS_READ_BYTE_CHECK_NEXT:
UPDATE_NEXT_LOCAL_STATE ICSS_SMBUS_WRITE_WORD
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the smbus write word command has been passed.
; if write word command is passed then start write word data procedure
; else check for another command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
ICSS_SMBUS_WRITE_WORD:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_SMBUS_WRITE_WORD_CHECK_NEXT, WORK_REG_4.w2, ICSS_SMBUS_WRITE_WORD_CMD
UPDATE_NEXT_LOCAL_STATE WRITE_WORD_MODE
STATE_TASK_OVER
ICSS_SMBUS_WRITE_WORD_CHECK_NEXT:
UPDATE_NEXT_LOCAL_STATE ICSS_SMBUS_READ_WORD
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the smbus read word command has been passed.
; if read word command is passed then start read word data procedure
; else check for another command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
ICSS_SMBUS_READ_WORD:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_SMBUS_READ_WORD_CHECK_NEXT, WORK_REG_4.w2, ICSS_SMBUS_READ_WORD_CMD
UPDATE_NEXT_LOCAL_STATE READ_WORD_MODE
STATE_TASK_OVER
ICSS_SMBUS_READ_WORD_CHECK_NEXT:
UPDATE_NEXT_LOCAL_STATE ICSS_SMBUS_BLOCK_WRITE
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the smbus block write command has been passed.
; if block write command is passed then start block write data procedure
; else check for another command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
ICSS_SMBUS_BLOCK_WRITE:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_SMBUS_BLOCK_WRITE_CHECK_NEXT, WORK_REG_4.w2, ICSS_SMBUS_BLOCK_WRITE_CMD
UPDATE_NEXT_LOCAL_STATE BLOCK_WRITE_MODE
STATE_TASK_OVER
ICSS_SMBUS_BLOCK_WRITE_CHECK_NEXT:
UPDATE_NEXT_LOCAL_STATE ICSS_SMBUS_BLOCK_READ
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the smbus block read command has been passed.
; if block read command is passed then start block read data procedure
; else no matching command has been found
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
ICSS_SMBUS_BLOCK_READ:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_SMBUS_BLOCK_READ_CHECK_NEXT, WORK_REG_4.w2, ICSS_SMBUS_BLOCK_READ_CMD
UPDATE_NEXT_LOCAL_STATE BLOCK_READ_MODE
STATE_TASK_OVER
ICSS_SMBUS_BLOCK_READ_CHECK_NEXT:
UPDATE_NEXT_LOCAL_STATE ICSS_I2C_READ_SCL_CMD_CHECK
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the I2C read SCL command has been passed.
; if this command requires the host to change the pinmux to input for SCL pin
; else no matching command has been found
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ICSS_I2C_READ_SCL_CMD_CHECK:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_I2C_READ_SCL_CMD_CHECK_NEXT, WORK_REG_4.w2, ICSS_I2C_READ_SCL_CMD
UPDATE_NEXT_LOCAL_STATE READ_SCL_PIN_SETUP
STATE_TASK_OVER
ICSS_I2C_READ_SCL_CMD_CHECK_NEXT:
UPDATE_NEXT_LOCAL_STATE ICSS_I2C_RESET_SLAVE_CMD_CHECK
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the I2C reset slave command has been passed.
; if this command will send 9 clock pulse to device for reseting it.
; else no matching command has been found
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ICSS_I2C_RESET_SLAVE_CMD_CHECK:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_I2C_RESET_SLAVE_CMD_CHECK_NEXT, WORK_REG_4.w2, ICSS_I2C_RESET_SLAVE_CMD
UPDATE_NEXT_LOCAL_STATE RESET_SLAVE_SCL_BEGIN
STATE_TASK_OVER
ICSS_I2C_RESET_SLAVE_CMD_CHECK_NEXT:
UPDATE_NEXT_LOCAL_STATE ICSS_I2C_LOOPBACK_CMD_CHECK
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; checks if the I2C reset slave command has been passed.
; if this command will send 9 clock pulse to device for reseting it.
; else no matching command has been found
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ICSS_I2C_LOOPBACK_CMD_CHECK:
LBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 4
QBNE ICSS_I2C_LOOPBACK_CMD_CHECK_NEXT, WORK_REG_4.w2, ICSS_I2C_LOOPBACK_CMD
UPDATE_NEXT_LOCAL_STATE LOOPBACK_DATA_COUNT
STATE_TASK_OVER
ICSS_I2C_LOOPBACK_CMD_CHECK_NEXT:
UPDATE_NEXT_LOCAL_STATE FIRMWARE_READY_COMMAND_ERROR
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; no known command has been matched with passed cmd
; raise an interrupt and respond with error reponse word
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FIRMWARE_READY_COMMAND_ERROR:
UPDATE_NEXT_LOCAL_STATE RAISE_HOST_INTERRUPT_MEM_FOR_READY
LDI WORK_REG_4.w0, INVALID_COMMAND
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; set the local register to indicate tx mode
; set the value on iep gpo to low value for pulling the line
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TX_MODE:
CLR R16, R16, ICSS_I2C_READ_WRITE_BIT
UPDATE_NEXT_GLOBAL_STATE TX_DATA_SDA_BEGIN
UPDATE_NEXT_LOCAL_STATE SET_SCL_SDA_HIGH
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; set the local register to indicate rx mode
; set the value on iep gpo to low value for pulling the line
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RX_MODE:
SET R16, R16, ICSS_I2C_READ_WRITE_BIT
UPDATE_NEXT_GLOBAL_STATE RX_DATA_SDA_BEGIN
UPDATE_NEXT_LOCAL_STATE SET_SCL_SDA_HIGH
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; set the value on iep gpo enable register to high value
; this will pull the line to high impedence and open drain will keep the line high
; set the value on iep gpo to low value for pulling the line
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SET_SCL_SDA_HIGH:
SET_OUTPUT_PIN_VALUE_HIGH SLAVE_ADDRESS_SETUP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; read the slave address from configuration registers.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SLAVE_ADDRESS_SETUP:
READ_ADDRESS_REGISTER SLAVE_ADDRESS_RW_SETUP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; configure the read/write bit in the slave address register for transmission
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SLAVE_ADDRESS_RW_SETUP:
READ_RW_REGISTER_BIT DATA_COUNT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Read the number of 8 bits data need to be read or writen
; also initialize the data count and bit count register to 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DATA_COUNT:
LBBO &WORK_REG_4.w0, R10, ICSS_I2C_CNT_OFFSET, 2
QBLT DATA_COUNT_ERROR, WORK_REG_4.w0, 0xFF
QBGT DATA_COUNT_ERROR, WORK_REG_4.w0, 0x01
AND R15.b3, WORK_REG_4.b0, 0xFF
AND R15.b2, R15.b2, 0x00
LBBO &R15.b1, R11, R15.b2, 1
UPDATE_NEXT_LOCAL_STATE START_CONDITION_SDA_LOW
STATE_TASK_OVER
DATA_COUNT_ERROR:
LDI WORK_REG_4.w0, INVALID_DATA_COUNT
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
UPDATE_NEXT_LOCAL_STATE RAISE_HOST_INTERRUPT_MEM_FOR_READY
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SDA low for start condition
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
START_CONDITION_SDA_LOW:
QBBC START_CONDITION_SDA_LOW_RETURN, R16, ICSS_I2C_START_BIT
SET_SDA_PIN_LOW
START_CONDITION_SDA_LOW_RETURN:
UPDATE_NEXT_LOCAL_STATE START_CONDITION_SCL_LOW
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SCL low for start condition
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
START_CONDITION_SCL_LOW:
QBBC START_CONDITION_SCL_LOW_RETURN, R16, ICSS_I2C_START_BIT
SET_SCL_PIN_LOW
START_CONDITION_SCL_LOW_RETURN:
UPDATE_NEXT_LOCAL_STATE ADDRESS_SDA_BEGIN
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; modify the SDA pin value based on the most significant bit of Address register
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ADDRESS_SDA_BEGIN:
RSB WORK_REG_5.b0, R15.b0, 15
QBBC ADDRESS_SDA_LOW, R13.w2, WORK_REG_5.b0
SET_SDA_PIN_HIGH
JMP ADDRESS_SDA_CONTINUE
ADDRESS_SDA_LOW:
SET_SDA_PIN_LOW
ADDRESS_SDA_CONTINUE:
ADD R15.b0, R15.b0, 0x01
UPDATE_NEXT_LOCAL_STATE ADDRESS_SCL_BEGIN
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SCL high for sending SDA bit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ADDRESS_SCL_BEGIN:
SET_SCL_PIN_HIGH
UPDATE_NEXT_LOCAL_STATE ADDRESS_SDA_READ
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; nothing to be read in address tx mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ADDRESS_SDA_READ:
UPDATE_NEXT_LOCAL_STATE ADDRESS_SCL_END
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SCL low for ending the transmission of bit
; also decide the next state based on all the bits have been sent or not.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ADDRESS_SCL_END:
SET_SCL_PIN_LOW
QBGT SDA_NEXT_BIT, R15.b0, 0x08
UPDATE_NEXT_LOCAL_STATE ADDRESS_ACK_BEGIN
STATE_TASK_OVER
SDA_NEXT_BIT:
UPDATE_NEXT_LOCAL_STATE ADDRESS_SDA_BEGIN
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; release SDA line so slave can drive it.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ADDRESS_ACK_BEGIN:
SET_SDA_PIN_HIGH
UPDATE_NEXT_LOCAL_STATE ADDRESS_ACK_SCL_BEGIN
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SCL high for reading ACK bit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ADDRESS_ACK_SCL_BEGIN:
SET_SCL_PIN_HIGH
AND R15.b0, R15.b0, 0x00
UPDATE_NEXT_LOCAL_STATE ADDRESS_ACK_READ
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SDA line for reading ACK bit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ADDRESS_ACK_READ:
READ_SDA_PIN_ACK
UPDATE_NEXT_LOCAL_STATE ADDRESS_ACK_SCL_END
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SCL low
; read if ACK bit is set then start sending or receiving data else indicate no ack
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ADDRESS_ACK_SCL_END:
SET_SCL_PIN_LOW
QBBS ADDRESS_ACK_NOT_RECIEVED, R16, ICSS_I2C_ACK_RECIEVED_BIT
QBBC ADDRESS_ACK_SCL_END_DONE, R16, ICSS_I2C_ADDRESSING_MODE_BIT
QBEQ ADDRESS_ACK_SCL_END_DONE, R15.b2, 0x01
ADD R15.b2, R15.b2, 0x01
UPDATE_NEXT_LOCAL_STATE ADDRESS_SDA_BEGIN
STATE_TASK_OVER
ADDRESS_ACK_SCL_END_DONE:
AND R15.b2, R15.b2, 0x00
COPY_LOCAL_TO_GLOBAL_STATE
STATE_TASK_OVER
ADDRESS_ACK_NOT_RECIEVED:
UPDATE_NEXT_LOCAL_STATE NO_ADDRESS_ACK_RECIEVED
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; if no address ack is recieved, response with no ack in response command
; raise an interrupt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NO_ADDRESS_ACK_RECIEVED:
SET_SCL_PIN_HIGH
LDI WORK_REG_4.w0, ADDRESS_ACKNOWLDEGE_FAILED
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
UPDATE_NEXT_LOCAL_STATE RAISE_HOST_INTERRUPT_MEM_FOR_READY
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; start sending TX data and wait for ACK receive
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TX_DATA_SDA_BEGIN:
SEND_TX_DATA_CHECK_FOR_ACK R15.b1, DATA_PROCESSING_COMPLETE, RAISE_HOST_INTERRUPT_MEM_FOR_READY
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; start sending RX data and send ACK to device
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RX_DATA_SDA_BEGIN:
READ_RX_DATA_AND_SEND_ACK R15.b1, DATA_PROCESSING_COMPLETE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; start sending TX data and wait for ACK receive for smbus Burst Mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
TX_DATA_SDA_BEGIN_BURST:
SEND_TX_DATA_CHECK_FOR_ACK R17.b2, TX_DATA_SDA_BEGIN, RAISE_HOST_INTERRUPT_MEM_FOR_READY
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; start sending RX data and send ACK to device for smbus Burst Mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
RX_DATA_SDA_BEGIN_BURST:
READ_RX_DATA_AND_SEND_ACK R15.b3, RX_DATA_SDA_BEGIN
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; modify the SDA pin value based on the most significant bit of DATA value
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
CMD_CODE_SDA_BEGIN:
QBBC CMD_CODE_SDA_LOW, R15.b1, 7
SET_SDA_PIN_HIGH
JMP CMD_CODE_SDA_CONTINUE
CMD_CODE_SDA_LOW:
SET_SDA_PIN_LOW
CMD_CODE_SDA_CONTINUE:
LSL R15.b1, R15.b1, 1
ADD R15.b0, R15.b0, 0x01
UPDATE_NEXT_LOCAL_STATE CMD_CODE_SCL_BEGIN
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SCL high for sending SDA bit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
CMD_CODE_SCL_BEGIN:
SET_SCL_PIN_HIGH
UPDATE_NEXT_LOCAL_STATE CMD_CODE_SDA_READ
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Jump to next state as this is tx mode, done for matching timing parameter.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
CMD_CODE_SDA_READ:
UPDATE_NEXT_LOCAL_STATE CMD_CODE_SCL_END
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SCL low for stop sending SDA bit
; make decision for sending next data bit or check for ACK
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
CMD_CODE_SCL_END:
SET_SCL_PIN_LOW
QBGT CMD_CODE_SDA_NEXT_BIT, R15.b0, 0x08
UPDATE_NEXT_LOCAL_STATE CMD_CODE_ACK_BEGIN
STATE_TASK_OVER
CMD_CODE_SDA_NEXT_BIT:
UPDATE_NEXT_LOCAL_STATE CMD_CODE_SDA_BEGIN
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; release SDA line so slave can drive it.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
CMD_CODE_ACK_BEGIN:
SET_SDA_PIN_HIGH
SET R13.w2, R13.w2, 0
UPDATE_NEXT_LOCAL_STATE CMD_CODE_ACK_SCL_BEGIN
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SCL high for reading ACK bit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
CMD_CODE_ACK_SCL_BEGIN:
SET_SCL_PIN_HIGH
UPDATE_NEXT_LOCAL_STATE CMD_CODE_ACK_READ
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SDA line for reading ACK bit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
CMD_CODE_ACK_READ:
READ_SDA_PIN_ACK
QBBS CMD_CODE_ACK_READ_NEXT_STATE, R16, ICSS_I2C_SMBUS_BURST_BIT
UPDATE_NEXT_LOCAL_STATE CMD_CODE_ACK_SCL_END
STATE_TASK_OVER
CMD_CODE_ACK_READ_NEXT_STATE:
UPDATE_NEXT_LOCAL_STATE CMD_CODE_ACK_SCL_END_V2
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SCL low
; read if ACK bit is set then check if data is still left to be sent
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
CMD_CODE_ACK_SCL_END:
SET_SCL_PIN_LOW
QBBS CMD_CODE_ACK_NOT_RECIEVED, R16, ICSS_I2C_ACK_RECIEVED_BIT
AND R15.b2, R15.b2, 0x00
AND R15.b0, R15.b0, 0x00
QBBS CMD_CODE_RX, R16, ICSS_I2C_READ_WRITE_BIT
LBBO &R15.b1, R11, R15.b2, 1
UPDATE_NEXT_LOCAL_STATE TX_DATA_SDA_BEGIN
STATE_TASK_OVER
CMD_CODE_RX:
UPDATE_NEXT_LOCAL_STATE START_CONDITION_SDA_LOW
SET R13.w2, R13.w2, 8
UPDATE_NEXT_GLOBAL_STATE RX_DATA_SDA_BEGIN
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SCL low
; read if ACK bit is set then check if data is still left to be sent
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
CMD_CODE_ACK_SCL_END_V2:
SET_SCL_PIN_LOW
QBBS CMD_CODE_ACK_NOT_RECIEVED, R16, ICSS_I2C_ACK_RECIEVED_BIT
AND R15.b2, R15.b2, 0x00
AND R15.b0, R15.b0, 0x00
QBBS CMD_CODE_RX_V2, R16, ICSS_I2C_READ_WRITE_BIT
LBBO &R15.b1, R11, R15.b2, 1
UPDATE_NEXT_LOCAL_STATE TX_DATA_SDA_BEGIN_BURST
STATE_TASK_OVER
CMD_CODE_RX_V2:
UPDATE_NEXT_LOCAL_STATE START_CONDITION_SDA_LOW
SET R13.w2, R13.w2, 8
UPDATE_NEXT_GLOBAL_STATE RX_DATA_SDA_BEGIN_BURST
STATE_TASK_OVER
.endif
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
CMD_CODE_ACK_NOT_RECIEVED:
UPDATE_NEXT_LOCAL_STATE NO_CMD_CODE_ACK_RECIEVED
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; if no data ack is received, response with no ack in response command
; raise an interrupt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.if !$defined(AM437X_ICSS0) ; remove SMBUS for AM437x ICSS0
NO_CMD_CODE_ACK_RECIEVED:
LDI WORK_REG_4.w0, DATA_ACKNOWLDEGE_FAILED
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
UPDATE_NEXT_LOCAL_STATE RAISE_HOST_INTERRUPT_MEM_FOR_READY
STATE_TASK_OVER
.endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; data transmit or receive is over
; check whether to sent stop bit or not
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DATA_PROCESSING_COMPLETE:
SET_SDA_PIN_LOW
QBBC COMPLETE_WITH_NO_STOP, R16, ICSS_I2C_STOP_BIT
UPDATE_NEXT_LOCAL_STATE STOP_CONDITION_SCL_HIGH
STATE_TASK_OVER
COMPLETE_WITH_NO_STOP:
UPDATE_NEXT_LOCAL_STATE NO_STOP_CONDITION_SDA_HIGH
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; send stop condition by making SCL high first
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
STOP_CONDITION_SCL_HIGH:
SET_SCL_PIN_HIGH
UPDATE_NEXT_LOCAL_STATE STOP_CONDITION_SDA_HIGH
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; send stop condition by making SDA high next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
STOP_CONDITION_SDA_HIGH:
SET_SDA_PIN_HIGH
LDI WORK_REG_4.w0, COMMAND_SUCCESS
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
UPDATE_NEXT_LOCAL_STATE RAISE_HOST_INTERRUPT_MEM_FOR_READY
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; do not send stop condition by making SDA high first
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NO_STOP_CONDITION_SDA_HIGH:
SET_SDA_PIN_HIGH
UPDATE_NEXT_LOCAL_STATE NO_STOP_CONDITION_SCL_HIGH
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; do not send stop condition by making SCL high next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NO_STOP_CONDITION_SCL_HIGH:
SET_SCL_PIN_HIGH
LDI WORK_REG_4.w0, COMMAND_SUCCESS
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
UPDATE_NEXT_LOCAL_STATE RAISE_HOST_INTERRUPT_MEM_FOR_READY
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; prepare to read clk value for 10 clk cycles
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
READ_SCL_PIN_SETUP:
LDI R15.w0, 0x0000
LDI R15.w2, 0x0A00
UPDATE_NEXT_LOCAL_STATE READ_SCL_PIN_VALUE
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; read the scl clk value for 10 clk cycles
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
READ_SCL_PIN_VALUE:
ADD R15.b0, R15.b0, 0x01
QBBS SCL_PIN_VALUE_HIGH, R31, R14.b0
ADD R15.b2, R15.b2, 0x01
SCL_PIN_VALUE_HIGH:
QBGT READ_SCL_PIN_VALUE_REPEAT, R15.b0, R15.b3
UPDATE_NEXT_LOCAL_STATE READ_SCL_PIN_DONE
READ_SCL_PIN_VALUE_REPEAT:
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; read scl pins for 10 cycles is done.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
READ_SCL_PIN_DONE:
UPDATE_NEXT_LOCAL_STATE RAISE_HOST_INTERRUPT_MEM_FOR_READY
QBEQ SCL_PIN_READ_VALUE_LOW, R15.b0, R15.b2
LDI WORK_REG_4.w0, SCL_VALUE_HIGH
JMP READ_SCL_PIN_DONE_RETURN
SCL_PIN_READ_VALUE_LOW:
LDI WORK_REG_4.w0, SCL_VALUE_LOW
READ_SCL_PIN_DONE_RETURN:
LDI R15.w0, 0x0000
LDI R15.w2, 0x0000
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; setup for reseting the slave
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RESET_SLAVE_SCL_BEGIN:
LDI R15.w0, 0x0000
LDI R15.w2, 0x0900
UPDATE_NEXT_LOCAL_STATE RESET_SLAVE_SCL_HIGH
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SCL high
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RESET_SLAVE_SCL_HIGH:
SET_SCL_PIN_HIGH
UPDATE_NEXT_LOCAL_STATE RESET_SLAVE_SCL_WAIT1
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; wait to match the timing parameters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RESET_SLAVE_SCL_WAIT1:
UPDATE_NEXT_LOCAL_STATE RESET_SLAVE_SCL_LOW
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make SCL low
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RESET_SLAVE_SCL_LOW:
SET_SCL_PIN_LOW
ADD R15.b0, R15.b0, 0x01
UPDATE_NEXT_LOCAL_STATE RESET_SLAVE_SCL_WAIT2
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; wait to match the timing parameters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RESET_SLAVE_SCL_WAIT2:
QBGT RESET_SLAVE_SCL_RETURN, R15.b0, R15.b3
UPDATE_NEXT_LOCAL_STATE RESET_SLAVE_RETURN
STATE_TASK_OVER
RESET_SLAVE_SCL_RETURN:
UPDATE_NEXT_LOCAL_STATE RESET_SLAVE_SCL_HIGH
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Finish reseting slave
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RESET_SLAVE_RETURN:
UPDATE_NEXT_LOCAL_STATE RAISE_HOST_INTERRUPT_MEM_FOR_READY
LDI WORK_REG_4.w0, RESET_SLAVE_DONE
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Read the number of 8 bits data need to be copied over
; also initialize the data count and bit count register to 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LOOPBACK_DATA_COUNT:
LBBO &WORK_REG_4.w0, R10, ICSS_I2C_CNT_OFFSET, 2
QBLT LOOPBACK_DATA_COUNT_ERROR, WORK_REG_4.w0, 0xFF
QBGT LOOPBACK_DATA_COUNT_ERROR, WORK_REG_4.w0, 0x01
AND R15.b3, WORK_REG_4.b0, 0xFF
AND R15.b2, R15.b2, 0x00
UPDATE_NEXT_LOCAL_STATE LOOPBACK_COPY_DATA
STATE_TASK_OVER
LOOPBACK_DATA_COUNT_ERROR:
LDI WORK_REG_4.w0, INVALID_DATA_COUNT
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
UPDATE_NEXT_LOCAL_STATE RAISE_HOST_INTERRUPT_MEM_FOR_READY
STATE_TASK_OVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; copy data from Tx to Rx buffer.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LOOPBACK_COPY_DATA:
LBBO &R15.b1, R11, R15.b2, 1
SBBO &R15.b1, R12, R15.b2, 1
ADD R15.b2, R15.b2, 1
QBGE LOOPBACK_COPY_DATA_RETURN, R15.b3, R15.b2
STATE_TASK_OVER
LOOPBACK_COPY_DATA_RETURN:
UPDATE_NEXT_LOCAL_STATE RAISE_HOST_INTERRUPT_MEM_FOR_READY
LDI WORK_REG_4.w0, COMMAND_SUCCESS
SBBO &WORK_REG_4, R10, ICSS_I2C_COMMAND_OFFSET, 2
STATE_TASK_OVER
|
4.0.x/NumberSplitting/SplitNumber.asm
|
chronosv2/NESMaker_Public_Code_Repository
| 6 |
104193
|
<filename>4.0.x/NumberSplitting/SplitNumber.asm<gh_stars>1-10
;; As a warning, this code is probably VERY VERY VERY SLOW.
;; I couldn't think of a better way to do this. If someone
;; finds a better way and changes this script could you
;; please make a Pull Request out of it?
MACRO SplitNumber arg0, arg1
;;arg0: The variable to store the number into
;;arg1: The number to split
LDA #$00 ;Load 0 into accumulator
TAX ;Transfer accumulator to X
STA arg0,x ;Store the accumulator (0) into number 1
INX ;Increase X
STA arg0,x ;Store the accumulator (0) into number 2
INX ;Increase X
STA arg0,x ;Store the accumulator (0) into number 3
LDA arg1 ;Load the number we want to split into the accumulator
TestNumbers:
CLC
CMP #$64 ;Decimal 100
BCS Deduct100
CMP #$0A ;Decimal 10
BCS Deduct10
CMP #$01 ;...
BCS Store1s
JMP EndSplit
Deduct100:
SBC #$64 ;Subtract 100
LDX #$02 ;We need the 3rd number
INC arg0,x ;Add 1 to the 3rd number.
JMP TestNumbers
Deduct10:
SBC #$0A ;Subtract 10
LDX #$01 ;We need the 2nd number
INC arg0,x ;Add 1 to the 2nd number
JMP TestNumbers
Store1s:
LDX #$00 ;We need the 1st number
STA arg0,x ;Store the ones digit in the base number.
EndSplit:
ENDM
|
test/Fail/Issue3136a.agda
|
cruhland/agda
| 1,989 |
4385
|
-- Andreas, 2018-06-18, problem surfaced with issue #3136
-- Correct printing of a pattern lambda that has no patterns.
-- {-# OPTIONS -v extendedlambda:50 #-}
open import Agda.Builtin.Bool
open import Agda.Builtin.Equality
record R : Set where
no-eta-equality
field w : Bool
f : R
f = λ where
.R.w → λ where
→ false
triggerError : ∀ x → x ≡ f
triggerError x = refl
-- Error prints extended lambda name in error:
-- x != λ { .R.w → λ { .extendedlambda1 → false } } of type R
-- when checking that the expression refl has type x ≡ f
-- Expected:
-- x != λ { .R.w → λ { → false } } of type R
-- when checking that the expression refl has type x ≡ f
|
Ficheiros assembly (TP's e Testes)/ex1a-folhasimd.asm
|
pemesteves/mpcp-1718
| 0 |
9675
|
include mpcp.inc
.xmm
;; declaracoes de dados (variaveis globais)
.data
msg BYTE "%f", 13, 10, 0
b REAL8 7.8
m REAL8 3.6
n REAL8 7.1
p REAL8 ?
;; seccao de codigo principal
.code
main PROC C
movsd xmm0, b ;B
movsd xmm1, m ;M
movsd xmm2, n ;N
xorpd xmm3, xmm3 ;P=0
subsd xmm3, xmm1 ;P=-M
addsd xmm2, xmm0 ; M = N+B
mulsd xmm3, xmm2
movsd p, xmm3
invoke printf, offset msg, p
invoke _getch
invoke ExitProcess, 0
main ENDP
;; -----------------------------
;; codigo de outras rotinas
end
|
astro_ship_death_code.asm
|
nealvis/astroblast
| 0 |
179969
|
//////////////////////////////////////////////////////////////////////////////
// astro_ship_death_code.asm
// Copyright(c) 2021 <NAME>.
// License: MIT. See LICENSE file in root directory.
//////////////////////////////////////////////////////////////////////////////
// The following subroutines should be called from the main engine
// as follows
// ShipDeathInit: Call once before main loop
// ShipDeathStep: Call once every raster frame through the main loop
// ShipDeathStart: Call to start the effect
// ShipDeathForceStop: Call to force effect to stop if it is active
// ShipDeathCleanup: Call at end of program after main loop to clean up
//////////////////////////////////////////////////////////////////////////////
#importonce
#import "astro_ship_death_data.asm"
#import "astro_ships_code.asm"
//////////////////////////////////////////////////////////////////////////////
// Call once before main loop
ShipDeathInit:
lda #$00
sta ship_1_death_count
sta ship_1_death_pushed_left_min
sta ship_2_death_count
sta ship_2_death_pushed_left_min
rts
// ShipDeathInit end
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Call once every raster frame through the main loop.
// will step each ship that is dead
ShipDeathStep:
{
ShipDeathStepTryShip1:
lda ship_1_death_count
beq ShipDeathStepTryShip2
jsr Ship1DeathStep
ShipDeathStepTryShip2:
lda ship_2_death_count
beq ShipDeathStepDone
jsr Ship2DeathStep
ShipDeathStepDone:
rts
}
// end - ShipDeathStep
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
Ship1DeathStep:
{
lda ship_1_death_count
bne ShipDeathFramesStart
rts
ShipDeathFramesStart:
// if pushing ship off left of screen, then just set its x velocity to 1
nv_bgt16_immed(ship_1.x_loc, SHIP_DEATH_MIN_LEFT, ShipDeathTrySetRetreatVel)
lda #$00
sta ship_1.x_vel
lda #$01
sta ship_1_death_pushed_left_min
lda #$FF
sta ship_1.y_vel
ShipDeathTrySetRetreatVel:
lda ship_1_death_pushed_left_min
bne ShipDeathDecCount // if already pushed max, don't control vel
// set ship velocity to -1
lda #$FF
sta ship_1.x_vel
// y vel to 0
lda #0
sta ship_1.y_vel
ShipDeathDecCount:
dec ship_1_death_count
bne ShipDeathCountContinues
jsr ship_1.SetColorAlive
lda #1
sta ship_1.y_vel
ShipDeathCountContinues:
rts
}
// Ship1DeathStep end
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
Ship2DeathStep:
{
lda ship_2_death_count
bne Ship2DeathFramesStart
rts
Ship2DeathFramesStart:
// if pushing ship off left of screen, then just set its velocity to 1
nv_bgt16_immed(ship_2.x_loc, SHIP_DEATH_MIN_LEFT, Ship2DeathTrySetRetreatVel)
lda #$00
sta ship_2.x_vel
lda #$01
sta ship_2_death_pushed_left_min
sta ship_2.y_vel
Ship2DeathTrySetRetreatVel:
lda ship_2_death_pushed_left_min
bne Ship2DeathDecCount // if already pushed max, don't control vel
// set ship velocity to -1
lda #$FF
sta ship_2.x_vel
// y vel to 0
lda #0
sta ship_2.y_vel
Ship2DeathDecCount:
dec ship_2_death_count
bne Ship2DeathCountContinues
jsr ship_2.SetColorAlive
lda #1
sta ship_2.y_vel
Ship2DeathCountContinues:
rts
}
// Ship2DeathStep end
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Call to start the effect
// params:
// accum: set to 1 or 2 for ship 1 or ship 2
ShipDeathStart:
{
ShipDeathStartTryShip1:
cmp #1
bne ShipDeathStartTryShip2
lda #SHIP_DEATH_FRAMES
sta ship_1_death_count
lda #$00
sta ship_1_death_pushed_left_min
jsr ship_1.SetColorDead
rts
ShipDeathStartTryShip2:
cmp #2
bne ShipDeathStartDone
lda #SHIP_DEATH_FRAMES
sta ship_2_death_count
lda #$00
sta ship_2_death_pushed_left_min
jsr ship_2.SetColorDead
ShipDeathStartDone:
rts
}
// ShipDeathStart end subroutine
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Call to force effect to stop if it is active
ShipDeathForceStop:
lda #$00
sta ship_1_death_count
sta ship_2_death_count
rts
// ShipDeathForceStop end
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Call at end of program after main loop to clean up
ShipDeathCleanup:
rts
// ShipDeathCleanup end
//////////////////////////////////////////////////////////////////////////////
|
alloy4fun_models/trashltl/models/5/cKu5tjFhYko5BEp6f.als
|
Kaixi26/org.alloytools.alloy
| 0 |
4880
|
open main
pred idcKu5tjFhYko5BEp6f_prop6 {
eventually all f : File | f in Trash implies always f in Trash
}
pred __repair { idcKu5tjFhYko5BEp6f_prop6 }
check __repair { idcKu5tjFhYko5BEp6f_prop6 <=> prop6o }
|
lib/avx/sha256_one_block_avx.asm
|
ipuustin/intel-ipsec-mb
| 0 |
100236
|
;;
;; Copyright (c) 2012-2020, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
; This code schedules 1 blocks at a time, with 4 lanes per block
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%include "include/os.asm"
%include "include/clear_regs.asm"
section .data
default rel
align 64
K256:
dd 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
dd 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
dd 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
dd 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
dd 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
dd 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
dd 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
dd 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
dd 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
dd 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
dd 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
dd 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
dd 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
dd 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
dd 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
dd 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
PSHUFFLE_BYTE_FLIP_MASK: ;ddq 0x0c0d0e0f08090a0b0405060700010203
dq 0x0405060700010203, 0x0c0d0e0f08090a0b
; shuffle xBxA -> 00BA
_SHUF_00BA: ;ddq 0xFFFFFFFFFFFFFFFF0b0a090803020100
dq 0x0b0a090803020100, 0xFFFFFFFFFFFFFFFF
; shuffle xDxC -> DC00
_SHUF_DC00: ;ddq 0x0b0a090803020100FFFFFFFFFFFFFFFF
dq 0xFFFFFFFFFFFFFFFF, 0x0b0a090803020100
section .text
%define VMOVDQ vmovdqu ;; assume buffers not aligned
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Define Macros
%macro MY_ROR 2
shld %1,%1,(32-(%2))
%endm
; COPY_XMM_AND_BSWAP xmm, [mem], byte_flip_mask
; Load xmm with mem and byte swap each dword
%macro COPY_XMM_AND_BSWAP 3
VMOVDQ %1, %2
vpshufb %1, %1, %3
%endmacro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%define X0 xmm4
%define X1 xmm5
%define X2 xmm6
%define X3 xmm7
%define XTMP0 xmm0
%define XTMP1 xmm1
%define XTMP2 xmm2
%define XTMP3 xmm3
%define XTMP4 xmm8
%define XFER xmm9
%define XTMP5 xmm11
%define SHUF_00BA xmm10 ; shuffle xBxA -> 00BA
%define SHUF_DC00 xmm12 ; shuffle xDxC -> DC00
%define BYTE_FLIP_MASK xmm13
%ifdef LINUX
%define CTX rsi ; 2nd arg
%define INP rdi ; 1st arg
%define SRND rdi ; clobbers INP
%define c ecx
%define d r8d
%define e edx
%else
%define CTX rdx ; 2nd arg
%define INP rcx ; 1st arg
%define SRND rcx ; clobbers INP
%define c edi
%define d esi
%define e r8d
%endif
%define TBL rbp
%define a eax
%define b ebx
%define f r9d
%define g r10d
%define h r11d
%define y0 r13d
%define y1 r14d
%define y2 r15d
struc STACK
%ifndef LINUX
_XMM_SAVE: reso 7
%endif
_XFER: reso 1
endstruc
%ifndef FUNC
%define FUNC sha256_block_avx
%endif
; rotate_Xs
; Rotate values of symbols X0...X3
%macro rotate_Xs 0
%xdefine X_ X0
%xdefine X0 X1
%xdefine X1 X2
%xdefine X2 X3
%xdefine X3 X_
%endm
; ROTATE_ARGS
; Rotate values of symbols a...h
%macro ROTATE_ARGS 0
%xdefine TMP_ h
%xdefine h g
%xdefine g f
%xdefine f e
%xdefine e d
%xdefine d c
%xdefine c b
%xdefine b a
%xdefine a TMP_
%endm
%macro FOUR_ROUNDS_AND_SCHED 0
;; compute s0 four at a time and s1 two at a time
;; compute W[-16] + W[-7] 4 at a time
;vmovdqa XTMP0, X3
mov y0, e ; y0 = e
MY_ROR y0, (25-11) ; y0 = e >> (25-11)
mov y1, a ; y1 = a
vpalignr XTMP0, X3, X2, 4 ; XTMP0 = W[-7]
MY_ROR y1, (22-13) ; y1 = a >> (22-13)
xor y0, e ; y0 = e ^ (e >> (25-11))
mov y2, f ; y2 = f
MY_ROR y0, (11-6) ; y0 = (e >> (11-6)) ^ (e >> (25-6))
;vmovdqa XTMP1, X1
xor y1, a ; y1 = a ^ (a >> (22-13)
xor y2, g ; y2 = f^g
vpaddd XTMP0, XTMP0, X0 ; XTMP0 = W[-7] + W[-16]
xor y0, e ; y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
and y2, e ; y2 = (f^g)&e
MY_ROR y1, (13-2) ; y1 = (a >> (13-2)) ^ (a >> (22-2))
;; compute s0
vpalignr XTMP1, X1, X0, 4 ; XTMP1 = W[-15]
xor y1, a ; y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
MY_ROR y0, 6 ; y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
xor y2, g ; y2 = CH = ((f^g)&e)^g
MY_ROR y1, 2 ; y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
add y2, y0 ; y2 = S1 + CH
add y2, [rsp + _XFER + 0*4] ; y2 = k + w + S1 + CH
mov y0, a ; y0 = a
add h, y2 ; h = h + S1 + CH + k + w
mov y2, a ; y2 = a
vpsrld XTMP2, XTMP1, 7
or y0, c ; y0 = a|c
add d, h ; d = d + h + S1 + CH + k + w
and y2, c ; y2 = a&c
vpslld XTMP3, XTMP1, (32-7)
and y0, b ; y0 = (a|c)&b
add h, y1 ; h = h + S1 + CH + k + w + S0
vpor XTMP3, XTMP3, XTMP2 ; XTMP1 = W[-15] MY_ROR 7
or y0, y2 ; y0 = MAJ = (a|c)&b)|(a&c)
add h, y0 ; h = h + S1 + CH + k + w + S0 + MAJ
ROTATE_ARGS
mov y0, e ; y0 = e
mov y1, a ; y1 = a
MY_ROR y0, (25-11) ; y0 = e >> (25-11)
xor y0, e ; y0 = e ^ (e >> (25-11))
mov y2, f ; y2 = f
MY_ROR y1, (22-13) ; y1 = a >> (22-13)
vpsrld XTMP2, XTMP1,18
xor y1, a ; y1 = a ^ (a >> (22-13)
MY_ROR y0, (11-6) ; y0 = (e >> (11-6)) ^ (e >> (25-6))
xor y2, g ; y2 = f^g
vpsrld XTMP4, XTMP1, 3 ; XTMP4 = W[-15] >> 3
MY_ROR y1, (13-2) ; y1 = (a >> (13-2)) ^ (a >> (22-2))
xor y0, e ; y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
and y2, e ; y2 = (f^g)&e
MY_ROR y0, 6 ; y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
vpslld XTMP1, XTMP1, (32-18)
xor y1, a ; y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
xor y2, g ; y2 = CH = ((f^g)&e)^g
vpxor XTMP3, XTMP3, XTMP1
add y2, y0 ; y2 = S1 + CH
add y2, [rsp + _XFER + 1*4] ; y2 = k + w + S1 + CH
MY_ROR y1, 2 ; y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
vpxor XTMP3, XTMP3, XTMP2 ; XTMP1 = W[-15] MY_ROR 7 ^ W[-15] MY_ROR 18
mov y0, a ; y0 = a
add h, y2 ; h = h + S1 + CH + k + w
mov y2, a ; y2 = a
vpxor XTMP1, XTMP3, XTMP4 ; XTMP1 = s0
or y0, c ; y0 = a|c
add d, h ; d = d + h + S1 + CH + k + w
and y2, c ; y2 = a&c
;; compute low s1
vpshufd XTMP2, X3, 11111010b ; XTMP2 = W[-2] {BBAA}
and y0, b ; y0 = (a|c)&b
add h, y1 ; h = h + S1 + CH + k + w + S0
vpaddd XTMP0, XTMP0, XTMP1 ; XTMP0 = W[-16] + W[-7] + s0
or y0, y2 ; y0 = MAJ = (a|c)&b)|(a&c)
add h, y0 ; h = h + S1 + CH + k + w + S0 + MAJ
ROTATE_ARGS
;vmovdqa XTMP3, XTMP2 ; XTMP3 = W[-2] {BBAA}
mov y0, e ; y0 = e
mov y1, a ; y1 = a
MY_ROR y0, (25-11) ; y0 = e >> (25-11)
;vmovdqa XTMP4, XTMP2 ; XTMP4 = W[-2] {BBAA}
xor y0, e ; y0 = e ^ (e >> (25-11))
MY_ROR y1, (22-13) ; y1 = a >> (22-13)
mov y2, f ; y2 = f
xor y1, a ; y1 = a ^ (a >> (22-13)
MY_ROR y0, (11-6) ; y0 = (e >> (11-6)) ^ (e >> (25-6))
vpsrld XTMP4, XTMP2, 10 ; XTMP4 = W[-2] >> 10 {BBAA}
xor y2, g ; y2 = f^g
vpsrlq XTMP3, XTMP2, 19 ; XTMP3 = W[-2] MY_ROR 19 {xBxA}
xor y0, e ; y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
and y2, e ; y2 = (f^g)&e
vpsrlq XTMP2, XTMP2, 17 ; XTMP2 = W[-2] MY_ROR 17 {xBxA}
MY_ROR y1, (13-2) ; y1 = (a >> (13-2)) ^ (a >> (22-2))
xor y1, a ; y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
xor y2, g ; y2 = CH = ((f^g)&e)^g
MY_ROR y0, 6 ; y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
vpxor XTMP2, XTMP2, XTMP3
add y2, y0 ; y2 = S1 + CH
MY_ROR y1, 2 ; y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
add y2, [rsp + _XFER + 2*4] ; y2 = k + w + S1 + CH
vpxor XTMP4, XTMP4, XTMP2 ; XTMP4 = s1 {xBxA}
mov y0, a ; y0 = a
add h, y2 ; h = h + S1 + CH + k + w
mov y2, a ; y2 = a
vpshufb XTMP4, XTMP4, SHUF_00BA ; XTMP4 = s1 {00BA}
or y0, c ; y0 = a|c
add d, h ; d = d + h + S1 + CH + k + w
and y2, c ; y2 = a&c
vpaddd XTMP0, XTMP0, XTMP4 ; XTMP0 = {..., ..., W[1], W[0]}
and y0, b ; y0 = (a|c)&b
add h, y1 ; h = h + S1 + CH + k + w + S0
;; compute high s1
vpshufd XTMP2, XTMP0, 01010000b ; XTMP2 = W[-2] {DDCC}
or y0, y2 ; y0 = MAJ = (a|c)&b)|(a&c)
add h, y0 ; h = h + S1 + CH + k + w + S0 + MAJ
ROTATE_ARGS
;vmovdqa XTMP3, XTMP2 ; XTMP3 = W[-2] {DDCC}
mov y0, e ; y0 = e
MY_ROR y0, (25-11) ; y0 = e >> (25-11)
mov y1, a ; y1 = a
;vmovdqa XTMP5, XTMP2 ; XTMP5 = W[-2] {DDCC}
MY_ROR y1, (22-13) ; y1 = a >> (22-13)
xor y0, e ; y0 = e ^ (e >> (25-11))
mov y2, f ; y2 = f
MY_ROR y0, (11-6) ; y0 = (e >> (11-6)) ^ (e >> (25-6))
vpsrld XTMP5, XTMP2, 10 ; XTMP5 = W[-2] >> 10 {DDCC}
xor y1, a ; y1 = a ^ (a >> (22-13)
xor y2, g ; y2 = f^g
vpsrlq XTMP3, XTMP2, 19 ; XTMP3 = W[-2] MY_ROR 19 {xDxC}
xor y0, e ; y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
and y2, e ; y2 = (f^g)&e
MY_ROR y1, (13-2) ; y1 = (a >> (13-2)) ^ (a >> (22-2))
vpsrlq XTMP2, XTMP2, 17 ; XTMP2 = W[-2] MY_ROR 17 {xDxC}
xor y1, a ; y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
MY_ROR y0, 6 ; y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
xor y2, g ; y2 = CH = ((f^g)&e)^g
vpxor XTMP2, XTMP2, XTMP3
MY_ROR y1, 2 ; y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
add y2, y0 ; y2 = S1 + CH
add y2, [rsp + _XFER + 3*4] ; y2 = k + w + S1 + CH
vpxor XTMP5, XTMP5, XTMP2 ; XTMP5 = s1 {xDxC}
mov y0, a ; y0 = a
add h, y2 ; h = h + S1 + CH + k + w
mov y2, a ; y2 = a
vpshufb XTMP5, XTMP5, SHUF_DC00 ; XTMP5 = s1 {DC00}
or y0, c ; y0 = a|c
add d, h ; d = d + h + S1 + CH + k + w
and y2, c ; y2 = a&c
vpaddd X0, XTMP5, XTMP0 ; X0 = {W[3], W[2], W[1], W[0]}
and y0, b ; y0 = (a|c)&b
add h, y1 ; h = h + S1 + CH + k + w + S0
or y0, y2 ; y0 = MAJ = (a|c)&b)|(a&c)
add h, y0 ; h = h + S1 + CH + k + w + S0 + MAJ
ROTATE_ARGS
rotate_Xs
%endm
;; input is [rsp + _XFER + %1 * 4]
%macro DO_ROUND 1
mov y0, e ; y0 = e
MY_ROR y0, (25-11) ; y0 = e >> (25-11)
mov y1, a ; y1 = a
xor y0, e ; y0 = e ^ (e >> (25-11))
MY_ROR y1, (22-13) ; y1 = a >> (22-13)
mov y2, f ; y2 = f
xor y1, a ; y1 = a ^ (a >> (22-13)
MY_ROR y0, (11-6) ; y0 = (e >> (11-6)) ^ (e >> (25-6))
xor y2, g ; y2 = f^g
xor y0, e ; y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
MY_ROR y1, (13-2) ; y1 = (a >> (13-2)) ^ (a >> (22-2))
and y2, e ; y2 = (f^g)&e
xor y1, a ; y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
MY_ROR y0, 6 ; y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
xor y2, g ; y2 = CH = ((f^g)&e)^g
add y2, y0 ; y2 = S1 + CH
MY_ROR y1, 2 ; y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
add y2, [rsp + _XFER + %1 * 4] ; y2 = k + w + S1 + CH
mov y0, a ; y0 = a
add h, y2 ; h = h + S1 + CH + k + w
mov y2, a ; y2 = a
or y0, c ; y0 = a|c
add d, h ; d = d + h + S1 + CH + k + w
and y2, c ; y2 = a&c
and y0, b ; y0 = (a|c)&b
add h, y1 ; h = h + S1 + CH + k + w + S0
or y0, y2 ; y0 = MAJ = (a|c)&b)|(a&c)
add h, y0 ; h = h + S1 + CH + k + w + S0 + MAJ
ROTATE_ARGS
%endm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; void FUNC(void *input_data, UINT32 digest[8], UINT64 num_blks)
;; arg 1 : pointer to input data
;; arg 2 : pointer to digest
section .text
MKGLOBAL(FUNC,function,internal)
align 32
FUNC:
push rbx
%ifndef LINUX
push rsi
push rdi
%endif
push rbp
push r13
push r14
push r15
sub rsp,STACK_size
%ifndef LINUX
vmovdqa [rsp + _XMM_SAVE + 0*16],xmm6
vmovdqa [rsp + _XMM_SAVE + 1*16],xmm7
vmovdqa [rsp + _XMM_SAVE + 2*16],xmm8
vmovdqa [rsp + _XMM_SAVE + 3*16],xmm9
vmovdqa [rsp + _XMM_SAVE + 4*16],xmm10
vmovdqa [rsp + _XMM_SAVE + 5*16],xmm11
vmovdqa [rsp + _XMM_SAVE + 6*16],xmm12
vmovdqa [rsp + _XMM_SAVE + 7*16],xmm13
%endif
;; load initial digest
mov a, [4*0 + CTX]
mov b, [4*1 + CTX]
mov c, [4*2 + CTX]
mov d, [4*3 + CTX]
mov e, [4*4 + CTX]
mov f, [4*5 + CTX]
mov g, [4*6 + CTX]
mov h, [4*7 + CTX]
vmovdqa BYTE_FLIP_MASK, [rel PSHUFFLE_BYTE_FLIP_MASK]
vmovdqa SHUF_00BA, [rel _SHUF_00BA]
vmovdqa SHUF_DC00, [rel _SHUF_DC00]
lea TBL,[rel K256]
;; byte swap first 16 dwords
COPY_XMM_AND_BSWAP X0, [INP + 0*16], BYTE_FLIP_MASK
COPY_XMM_AND_BSWAP X1, [INP + 1*16], BYTE_FLIP_MASK
COPY_XMM_AND_BSWAP X2, [INP + 2*16], BYTE_FLIP_MASK
COPY_XMM_AND_BSWAP X3, [INP + 3*16], BYTE_FLIP_MASK
;; schedule 48 input dwords, by doing 3 rounds of 16 each
mov SRND, 3
align 16
loop1:
vpaddd XFER, X0, [TBL + 0*16]
vmovdqa [rsp + _XFER], XFER
FOUR_ROUNDS_AND_SCHED
vpaddd XFER, X0, [TBL + 1*16]
vmovdqa [rsp + _XFER], XFER
FOUR_ROUNDS_AND_SCHED
vpaddd XFER, X0, [TBL + 2*16]
vmovdqa [rsp + _XFER], XFER
FOUR_ROUNDS_AND_SCHED
vpaddd XFER, X0, [TBL + 3*16]
vmovdqa [rsp + _XFER], XFER
add TBL, 4*16
FOUR_ROUNDS_AND_SCHED
sub SRND, 1
jne loop1
mov SRND, 2
loop2:
vpaddd XFER, X0, [TBL + 0*16]
vmovdqa [rsp + _XFER], XFER
DO_ROUND 0
DO_ROUND 1
DO_ROUND 2
DO_ROUND 3
vpaddd XFER, X1, [TBL + 1*16]
vmovdqa [rsp + _XFER], XFER
add TBL, 2*16
DO_ROUND 0
DO_ROUND 1
DO_ROUND 2
DO_ROUND 3
vmovdqa X0, X2
vmovdqa X1, X3
sub SRND, 1
jne loop2
add [4*0 + CTX], a
add [4*1 + CTX], b
add [4*2 + CTX], c
add [4*3 + CTX], d
add [4*4 + CTX], e
add [4*5 + CTX], f
add [4*6 + CTX], g
add [4*7 + CTX], h
done_hash:
%ifndef LINUX
vmovdqa xmm6,[rsp + _XMM_SAVE + 0*16]
vmovdqa xmm7,[rsp + _XMM_SAVE + 1*16]
vmovdqa xmm8,[rsp + _XMM_SAVE + 2*16]
vmovdqa xmm9,[rsp + _XMM_SAVE + 3*16]
vmovdqa xmm10,[rsp + _XMM_SAVE + 4*16]
vmovdqa xmm11,[rsp + _XMM_SAVE + 5*16]
vmovdqa xmm12,[rsp + _XMM_SAVE + 6*16]
vmovdqa xmm13,[rsp + _XMM_SAVE + 7*16]
%ifdef SAFE_DATA
;; Clear potential sensitive data stored in stack
clear_xmms_avx xmm0, xmm1, xmm2, xmm3, xmm4, xmm5
vmovdqa [rsp + _XMM_SAVE + 0 * 16], xmm0
vmovdqa [rsp + _XMM_SAVE + 1 * 16], xmm0
vmovdqa [rsp + _XMM_SAVE + 2 * 16], xmm0
vmovdqa [rsp + _XMM_SAVE + 3 * 16], xmm0
vmovdqa [rsp + _XMM_SAVE + 4 * 16], xmm0
vmovdqa [rsp + _XMM_SAVE + 5 * 16], xmm0
vmovdqa [rsp + _XMM_SAVE + 6 * 16], xmm0
vmovdqa [rsp + _XMM_SAVE + 7 * 16], xmm0
%endif
%else ;; LINUX
%ifdef SAFE_DATA
clear_all_xmms_avx_asm
%endif
%endif ;; LINUX
add rsp, STACK_size
pop r15
pop r14
pop r13
pop rbp
%ifndef LINUX
pop rdi
pop rsi
%endif
pop rbx
ret
%ifdef LINUX
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
|
source/oasis/program-elements-enumeration_literal_specifications.ads
|
optikos/oasis
| 0 |
12860
|
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Element_Vectors;
with Program.Elements.Declarations;
with Program.Elements.Defining_Names;
package Program.Elements.Enumeration_Literal_Specifications is
pragma Pure (Program.Elements.Enumeration_Literal_Specifications);
type Enumeration_Literal_Specification is
limited interface and Program.Elements.Declarations.Declaration;
type Enumeration_Literal_Specification_Access is
access all Enumeration_Literal_Specification'Class with Storage_Size => 0;
not overriding function Name
(Self : Enumeration_Literal_Specification)
return not null Program.Elements.Defining_Names.Defining_Name_Access
is abstract;
type Enumeration_Literal_Specification_Text is limited interface;
type Enumeration_Literal_Specification_Text_Access is
access all Enumeration_Literal_Specification_Text'Class
with Storage_Size => 0;
not overriding function To_Enumeration_Literal_Specification_Text
(Self : aliased in out Enumeration_Literal_Specification)
return Enumeration_Literal_Specification_Text_Access is abstract;
type Enumeration_Literal_Specification_Vector is
limited interface and Program.Element_Vectors.Element_Vector;
type Enumeration_Literal_Specification_Vector_Access is
access all Enumeration_Literal_Specification_Vector'Class
with Storage_Size => 0;
overriding function Element
(Self : Enumeration_Literal_Specification_Vector;
Index : Positive)
return not null Program.Elements.Element_Access is abstract
with Post'Class => Element'Result.Is_Enumeration_Literal_Specification;
function To_Enumeration_Literal_Specification
(Self : Enumeration_Literal_Specification_Vector'Class;
Index : Positive)
return not null Enumeration_Literal_Specification_Access
is (Self.Element (Index).To_Enumeration_Literal_Specification);
end Program.Elements.Enumeration_Literal_Specifications;
|
tools/scitools/conf/understand/ada/ada12/s-imgllb.ads
|
brucegua/moocos
| 1 |
10178
|
<reponame>brucegua/moocos
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . I M G _ L L B --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2009 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Contains the routine for computing the image in based format of signed and
-- unsigned integers whose size > Integer'Size for use by Text_IO.Integer_IO
-- and Text_IO.Modular_IO.
with System.Unsigned_Types;
package System.Img_LLB is
pragma Preelaborate;
procedure Set_Image_Based_Long_Long_Integer
(V : Long_Long_Integer;
B : Natural;
W : Integer;
S : out String;
P : in out Natural);
-- Sets the signed image of V in based format, using base value B (2..16)
-- starting at S (P + 1), updating P to point to the last character stored.
-- The image includes a leading minus sign if necessary, but no leading
-- spaces unless W is positive, in which case leading spaces are output if
-- necessary to ensure that the output string is no less than W characters
-- long. The caller promises that the buffer is large enough and no check
-- is made for this. Constraint_Error will not necessarily be raised if
-- this is violated, since it is perfectly valid to compile this unit with
-- checks off.
procedure Set_Image_Based_Long_Long_Unsigned
(V : System.Unsigned_Types.Long_Long_Unsigned;
B : Natural;
W : Integer;
S : out String;
P : in out Natural);
-- Sets the unsigned image of V in based format, using base value B (2..16)
-- starting at S (P + 1), updating P to point to the last character stored.
-- The image includes no leading spaces unless W is positive, in which case
-- leading spaces are output if necessary to ensure that the output string
-- is no less than W characters long. The caller promises that the buffer
-- is large enough and no check is made for this. Constraint_Error will not
-- necessarily be raised if this is violated, since it is perfectly valid
-- to compile this unit with checks off).
end System.Img_LLB;
|
cards/bn5/ModCards/136-A036 SnakeMan.asm
|
RockmanEXEZone/MMBN-Mod-Card-Kit
| 10 |
179433
|
.include "defaults_mod.asm"
table_file_jp equ "exe5-utf8.tbl"
table_file_en equ "bn5-utf8.tbl"
game_code_len equ 3
game_code equ 0x4252424A // BRBJ
game_code_2 equ 0x42524245 // BRBE
game_code_3 equ 0x42524250 // BRBP
card_type equ 1
card_id equ 36
card_no equ "036"
card_sub equ "Mod Card 036"
card_sub_x equ 64
card_desc_len equ 2
card_desc_1 equ "SnakeMan"
card_desc_2 equ "40MB"
card_desc_3 equ ""
card_name_jp_full equ "スネークマン"
card_name_jp_game equ "スネークマン"
card_name_en_full equ "SnakeMan"
card_name_en_game equ "SnakeMan"
card_address equ ""
card_address_id equ 0
card_bug equ 0
card_wrote_en equ ""
card_wrote_jp equ ""
|
orka/src/orka/interface/orka-containers-ring_buffers.ads
|
onox/orka
| 52 |
19191
|
<gh_stars>10-100
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <<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.
generic
type Element_Type is private;
package Orka.Containers.Ring_Buffers is
pragma Pure;
type Buffer (Capacity : Positive) is tagged private;
pragma Preelaborable_Initialization (Buffer);
procedure Add_Last (Container : in out Buffer; Element : Element_Type)
with Pre => Container.Length < Container.Capacity,
Post => Container.Length = Container'Old.Length + 1;
-- Add the element to the end of the buffer (at index k + 1)
function Remove_First (Container : in out Buffer) return Element_Type
with Pre => Container.Length > 0,
Post => Container.Length = Container'Old.Length - 1;
-- Remove and return the first element in the buffer (at index 1)
function Length (Container : Buffer) return Natural
with Inline;
function Is_Empty (Container : Buffer) return Boolean
with Inline;
function Is_Full (Container : Buffer) return Boolean
with Inline;
private
type Element_Array is array (Positive range <>) of Element_Type;
type Buffer (Capacity : Positive) is tagged record
Elements : Element_Array (1 .. Capacity) := (others => <>);
Head, Tail : Positive := 1;
Count : Natural := 0;
end record;
pragma Preelaborable_Initialization (Buffer);
end Orka.Containers.Ring_Buffers;
|
firmware/coreboot/3rdparty/libgfxinit/common/hw-gfx-gma-config_helpers.adb
|
fabiojna02/OpenCellular
| 1 |
4788
|
<reponame>fabiojna02/OpenCellular
--
-- Copyright (C) 2015-2016 secunet Security Networks AG
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This 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.
--
with HW.GFX.GMA.Config;
with HW.GFX.GMA.Connector_Info;
with HW.GFX.GMA.DP_Info;
with HW.GFX.GMA.Registers;
with HW.Debug;
package body HW.GFX.GMA.Config_Helpers
is
function To_GPU_Port
(Pipe : Pipe_Index;
Port : Active_Port_Type)
return GPU_Port
is
begin
return
(case Config.CPU is
when G45 =>
(case Port is
when Internal => LVDS,
when HDMI1 | DP1 => DIGI_B,
when HDMI2 | DP2 => DIGI_C,
when HDMI3 | DP3 => DIGI_D,
when Analog => VGA),
when Ironlake .. Ivybridge => -- everything but eDP through FDI/PCH
(if Config.Internal_Is_EDP and then Port = Internal then
DIGI_A
else
(case Pipe is
-- FDIs are fixed to the CPU pipe
when Primary => DIGI_B,
when Secondary => DIGI_C,
when Tertiary => DIGI_D)),
when Haswell .. Skylake => -- everything but VGA directly on CPU
(case Port is
when Internal => DIGI_A, -- LVDS not available
when HDMI1 | DP1 => DIGI_B,
when HDMI2 | DP2 => DIGI_C,
when HDMI3 | DP3 => DIGI_D,
when Analog => DIGI_E));
end To_GPU_Port;
function To_PCH_Port (Port : Active_Port_Type) return PCH_Port
is
begin
return
(case Port is
when Internal => PCH_LVDS, -- will be ignored if Internal is DP
when Analog => PCH_DAC,
when HDMI1 => PCH_HDMI_B,
when HDMI2 => PCH_HDMI_C,
when HDMI3 => PCH_HDMI_D,
when DP1 => PCH_DP_B,
when DP2 => PCH_DP_C,
when DP3 => PCH_DP_D);
end To_PCH_Port;
function To_Display_Type (Port : Active_Port_Type) return Display_Type
is
begin
return Display_Type'
(case Port is
when Internal => Config.Internal_Display,
when Analog => VGA,
when HDMI1 .. HDMI3 => HDMI,
when DP1 .. DP3 => DP);
end To_Display_Type;
----------------------------------------------------------------------------
-- Prepares link rate and lane count settings for an FDI connection.
procedure Configure_FDI_Link
(Port_Cfg : in out Port_Config;
Success : out Boolean)
with Pre => True
is
procedure Limit_Lane_Count
is
FDI_TX_CTL_FDI_TX_ENABLE : constant := 1 * 2 ** 31;
Enabled : Boolean;
begin
-- if DIGI_D enabled: (FDI names are off by one)
Registers.Is_Set_Mask
(Register => Registers.FDI_TX_CTL_C,
Mask => FDI_TX_CTL_FDI_TX_ENABLE,
Result => Enabled);
if Enabled then
Port_Cfg.FDI.Receiver_Caps.Max_Lane_Count := DP_Lane_Count_2;
end if;
end Limit_Lane_Count;
begin
Port_Cfg.FDI.Receiver_Caps.Max_Link_Rate := DP_Bandwidth_2_7;
Port_Cfg.FDI.Receiver_Caps.Max_Lane_Count :=
Config.FDI_Lane_Count (Port_Cfg.Port);
Port_Cfg.FDI.Receiver_Caps.Enhanced_Framing := True;
if Config.Has_FDI_C and then Port_Cfg.Port = DIGI_C then
Limit_Lane_Count;
end if;
DP_Info.Preferred_Link_Setting (Port_Cfg.FDI, Port_Cfg.Mode, Success);
end Configure_FDI_Link;
-- Derives an internal port config.
--
-- This is where the magic happens that hides the hardware details
-- from libgfxinit's users. We have to map the pipe (Pipe_Index),
-- the user visible port (Port_Type) and the modeline (Mode_Type)
-- that we are supposed to output to an internal representation
-- (Port_Config) that applies to the selected hardware generation
-- (in GMA.Config).
procedure Fill_Port_Config
(Port_Cfg : out Port_Config;
Pipe : in Pipe_Index;
Port : in Port_Type;
Mode : in Mode_Type;
Success : out Boolean)
is
begin
Success :=
Config.Supported_Pipe (Pipe) and then
Config.Valid_Port (Port) and then
Port /= Disabled; -- Valid_Port should already cover this, but the
-- array is writeable, so it's hard to prove this.
if Success then
Port_Cfg := Port_Config'
(Port => To_GPU_Port (Pipe, Port),
PCH_Port => To_PCH_Port (Port),
Display => To_Display_Type (Port),
Mode => Mode,
Is_FDI => Config.Is_FDI_Port (Port),
FDI => Default_DP,
DP => Default_DP);
if Port_Cfg.Mode.BPC = Auto_BPC then
Port_Cfg.Mode.BPC := Connector_Info.Default_BPC (Port_Cfg);
end if;
if Port_Cfg.Display = HDMI then
declare
pragma Assert (Config.HDMI_Max_Clock_24bpp * 8
/ Port_Cfg.Mode.BPC >= Frequency_Type'First);
Max_Dotclock : constant Frequency_Type :=
Config.HDMI_Max_Clock_24bpp * 8 / Port_Cfg.Mode.BPC;
begin
if Port_Cfg.Mode.Dotclock > Max_Dotclock then
pragma Debug (Debug.Put ("Dotclock "));
pragma Debug (Debug.Put_Int64 (Port_Cfg.Mode.Dotclock));
pragma Debug (Debug.Put (" too high, limiting to "));
pragma Debug (Debug.Put_Int64 (Max_Dotclock));
pragma Debug (Debug.Put_Line ("."));
Port_Cfg.Mode.Dotclock := Max_Dotclock;
end if;
end;
end if;
if Port_Cfg.Is_FDI then
Configure_FDI_Link (Port_Cfg, Success);
end if;
else
Port_Cfg := Port_Config'
(Port => GPU_Port'First,
PCH_Port => PCH_Port'First,
Display => Display_Type'First,
Mode => Invalid_Mode,
Is_FDI => False,
FDI => Default_DP,
DP => Default_DP);
end if;
end Fill_Port_Config;
----------------------------------------------------------------------------
-- Validates that a given configuration should work with
-- a given framebuffer.
function Validate_Config
(FB : Framebuffer_Type;
Mode : Mode_Type;
Pipe : Pipe_Index;
Scaler_Available : Boolean)
return Boolean
is
begin
-- No downscaling
-- Respect maximum scalable width
-- VGA plane is only allowed on the primary pipe
-- Only 32bpp RGB (ignored for VGA plane)
-- Stride must be big enough and a multiple of 64 bytes or the tile size
-- (ignored for VGA plane)
-- Y-Tiling and rotation are only supported on newer generations (with
-- Plane_Control)
-- 90 degree rotations are only supported with Y-tiling
return
((Rotated_Width (FB) = Mode.H_Visible and
Rotated_Height (FB) = Mode.V_Visible) or
(Scaler_Available and
Rotated_Width (FB) <= Config.Maximum_Scalable_Width (Pipe) and
Rotated_Width (FB) <= Mode.H_Visible and
Rotated_Height (FB) <= Mode.V_Visible)) and
(FB.Offset /= VGA_PLANE_FRAMEBUFFER_OFFSET or Pipe = Primary) and
(FB.Offset = VGA_PLANE_FRAMEBUFFER_OFFSET or
(FB.BPC = 8 and Valid_Stride (FB) and
(Config.Has_Plane_Control or
(FB.Tiling /= Y_Tiled and FB.Rotation = No_Rotation)) and
(FB.Tiling = Y_Tiled or not Rotation_90 (FB))));
end Validate_Config;
end HW.GFX.GMA.Config_Helpers;
|
msp430x2/mspgd-gpio-pin.ads
|
ekoeppen/MSP430_Generic_Ada_Drivers
| 0 |
12585
|
with MSPGD.GPIO; use MSPGD.GPIO;
generic
Pin : Pin_Type;
Port : Port_Type;
Alt_Func : Alt_Func_Type := IO;
Direction : Direction_Type := Input;
Pull_Resistor : Resistor_Type := None;
package MSPGD.GPIO.Pin is
pragma Preelaborate;
procedure Init
with Inline_Always;
procedure Set
with Inline_Always;
procedure Clear
with Inline_Always;
function Is_Set return Boolean
with Inline_Always;
end MSPGD.GPIO.Pin;
|
counter.asm
|
Nat-As/LED-Counter
| 0 |
93563
|
;INIT STACK
LDI R16, LOW(RAMEND)
OUT SPL, R16
LDI R16, HIGH(RAMEND)
OUT SPL, R16
LDI R16, 0x00
;INIT PINS
LDI R17, 0xFF
OUT DDRB, R17;WRITE
OUT DDRD, R17;WRITE
OUT DDRC, R16;READ
COUNTER:
LDI R16, 0X00;INC
LDI R17, 0X09
CALL ZERO
CALL DELAY
INC R16
CALL ONE
CALL DELAY
INC R16
CALL TWO
CALL DELAY
INC R16
CALL THREE
CALL DELAY
INC R16
CALL FOUR
CALL DELAY
INC R16
CALL FIVE
CALL DELAY
INC R16
CALL SIX
CALL DELAY
INC R16
CALL SEVEN
CALL DELAY
INC R16
CALL EIGHT
CALL DELAY
INC R16
CALL NINE
CALL DELAY
RJMP COUNTER
;END COUNTER COMPONENT
;DEFINE ZERO - NINE
NINE:
LDI R20, 0X00
OUT PORTB, R20
OUT PORTD, R20;CLEAR OUTPUT
SBI PORTB, 5;A
SBI PORTB, 4;B
SBI PORTB, 3;C
SBI PORTB, 0;F
SBI PORTD, 7;G
RET
EIGHT:
LDI R20, 0X00
OUT PORTB, R20
OUT PORTD, R20;CLEAR OUTPUT
SBI PORTB, 5;A
SBI PORTB, 4;B
SBI PORTB, 3;C
SBI PORTB, 2;D
SBI PORTB, 1;E
SBI PORTB, 0;F
SBI PORTD, 7;G
RET
SEVEN:
LDI R20, 0X00
OUT PORTB, R20
OUT PORTD, R20;CLEAR OUTPUT
SBI PORTB, 5;A
SBI PORTB, 4;B
SBI PORTB, 3;C
RET
SIX:
LDI R20, 0X00
OUT PORTB, R20
OUT PORTD, R20;CLEAR OUTPUT
SBI PORTB, 5;A
SBI PORTB, 3;C
SBI PORTB, 2;D
SBI PORTB, 1;E
SBI PORTB, 0;F
SBI PORTD, 7;G
RET
FIVE:
LDI R20, 0X00
OUT PORTB, R20
OUT PORTD, R20;CLEAR OUTPUT
SBI PORTB, 5;A
SBI PORTB, 3;C
SBI PORTB, 2;D
SBI PORTB, 0;F
SBI PORTD, 7;G
RET
FOUR:
LDI R20, 0X00
OUT PORTB, R20
OUT PORTD, R20;CLEAR OUTPUT
SBI PORTB, 4;B
SBI PORTB, 3;C
SBI PORTB, 0;F
SBI PORTD, 7;G
RET
THREE:
LDI R20, 0X00
OUT PORTB, R20
OUT PORTD, R20;CLEAR OUTPUT
SBI PORTB, 5;A
SBI PORTB, 4;B
SBI PORTB, 3;C
SBI PORTB, 2;D
SBI PORTD, 7;G
RET
TWO:
LDI R20, 0X00
OUT PORTB, R20
OUT PORTD, R20;CLEAR OUTPUT
SBI PORTB, 5;A
SBI PORTB, 4;B
SBI PORTB, 2;D
SBI PORTB, 1;E
SBI PORTD, 7;G
RET
ONE:
LDI R20, 0X00
OUT PORTB, R20
OUT PORTD, R20;CLEAR OUTPUT
SBI PORTB, 4;B
SBI PORTB, 3;C
RET
ZERO:
LDI R20, 0X00
OUT PORTB, R20
OUT PORTD, R20;CLEAR OUTPUT
SBI PORTB, 5;A
SBI PORTB, 4;B
SBI PORTB, 3;C
SBI PORTB, 2;D
SBI PORTB, 1;E
SBI PORTB, 0;F
RET
DELAY:
LDI R21, 0xFF
LDI R22, 0xFF
LDI R23, 0X77
T1:
NOP
NOP
NOP
DEC R21
BRNE T1
NOP
NOP
NOP
DEC R22
BRNE T1
NOP
NOP
NOP
DEC R23
BRNE T1
RET
|
pkg/policy/parser/QueryLexer.g4
|
cthulhu-rider/neofs-sdk-go
| 4 |
7746
|
<reponame>cthulhu-rider/neofs-sdk-go
lexer grammar QueryLexer;
AND_OP : 'AND';
OR_OP : 'OR';
SIMPLE_OP : 'EQ' | 'NE' | 'GE' | 'GT' | 'LT' | 'LE';
REP : 'REP';
IN : 'IN';
AS : 'AS';
CBF : 'CBF';
SELECT : 'SELECT';
FROM : 'FROM';
FILTER : 'FILTER';
WILDCARD : '*';
CLAUSE_SAME : 'SAME';
CLAUSE_DISTINCT : 'DISTINCT';
L_PAREN : '(';
R_PAREN : ')';
AT : '@';
IDENT : Nondigit (Digit | Nondigit)* ;
fragment Digit : [0-9] ;
fragment Nondigit : [a-zA-Z_] ;
NUMBER1 : [1-9] Digit* ;
ZERO : '0' ;
// Taken from antlr4 json grammar with minor corrections.
// https://github.com/antlr/grammars-v4/blob/master/json/JSON.g4
STRING : '"' (ESC | SAFECODEPOINTDOUBLE)* '"'
| '\'' (ESC | SAFECODEPOINTSINGLE)* '\'' ;
fragment ESC : '\\' (['"\\/bfnrt] | UNICODE) ;
fragment UNICODE : 'u' HEX HEX HEX HEX ;
fragment HEX : [0-9a-fA-F] ;
fragment SAFECODEPOINTSINGLE : ~ ['\\\u0000-\u001F] ;
fragment SAFECODEPOINTDOUBLE : ~ ["\\\u0000-\u001F] ;
WS : [ \t\n\r] + -> skip ;
|
src/main/antlr4/de/hauschild/gmltracer/gml/GML.g4
|
klaushauschild1984/gml-tracer
| 0 |
3016
|
grammar GML;
LINE_COMMENT: '%' ~[\n]* '\n' -> skip;
WITHESPACE : [ \r\n\t]+ -> skip;
fragment LETTER: [a-zA-Z];
fragment DIGIT: [0-9];
TRUE: 'true';
FALSE: 'false';
// control operators
IF: 'if';
APPLY: 'apply';
// number operators
ADDI: 'addi';
ADDF: 'addf';
ACOS: 'acos';
ASIN: 'asin';
CLAMPF: 'clampf';
COS: 'cos';
DIVI: 'divi';
DIVF: 'divf';
EQI: 'eqi';
EQF: 'eqf';
FLOOR: 'floor';
FRAC: 'frac';
LESSI: 'lessi';
LESSF: 'lessf';
MODI: 'modi';
MULI: 'muli';
MULF: 'mulf';
NEGI: 'negi';
NEGF: 'negf';
REAL: 'real';
SIN: 'sin';
SQRT: 'sqrt';
SUBI: 'subi';
SUBF: 'subf';
// point operators
GETX: 'getx';
GETY: 'gety';
GETZ: 'getZ';
POINT: 'point';
// array operators
GET: 'get';
LENGTH: 'length';
// geometric primitive operators
SHPERE: 'sphere';
CUBE: 'cube';
CYLINDER: 'cylinder';
CONE: 'cone';
PLANE: 'plane';
// transformation operators
TRANSLATE: 'translate';
SCALE: 'scale';
USCALE: 'uscale';
ROTATEX: 'rotatex';
ROTATEY: 'rotatey';
ROTATEZ: 'rotatez';
// light operators
LIGHT: 'light';
POINTLIGHT: 'pointlight';
SPOTLIGHT: 'spotlight';
// constructive solid geometry operators
UNION: 'union';
INTERSECT: 'intersect';
DIFFERENCE: 'difference';
// rendering operator
RENDER: 'render';
IDENTIFIER: LETTER (LETTER | DIGIT | '-' | '_')*;
BINDER: '/' IDENTIFIER;
STRING : '"' ~('\r' | '\n' | '"')* '"';
NUMBER: '-'? DIGIT+ ('.' DIGIT+)?;
operator: IF
| APPLY
| ADDI
| ADDF
| ACOS
| ASIN
| CLAMPF
| COS
| DIVI
| DIVF
| EQI
| EQF
| FLOOR
| FRAC
| LESSI
| LESSF
| MODI
| MULI
| MULF
| NEGI
| NEGF
| REAL
| SIN
| SQRT
| SUBI
| SUBF
| GETX
| GETY
| GETZ
| POINT
| GET
| LENGTH
| SHPERE
| CUBE
| CYLINDER
| CONE
| PLANE
| TRANSLATE
| SCALE
| USCALE
| ROTATEX
| ROTATEY
| ROTATEZ
| LIGHT
| POINTLIGHT
| SPOTLIGHT
| UNION
| INTERSECT
| DIFFERENCE
| RENDER
;
bool: TRUE | FALSE;
identifier: IDENTIFIER;
binder: BINDER;
number: NUMBER;
string: STRING;
function: '{' tokenList '}';
array: '[' tokenList ']';
token: operator
| binder
| bool
| identifier
| number
| string
;
tokenGroup: token
| function
| array
;
tokenList: tokenGroup*;
|
Sim/tests/13_test_indirect.asm
|
ericsims/16B
| 0 |
82728
|
<reponame>ericsims/16B
#include "../CPU.asm"
#bank rom
store #0x12, location1
storew #location1, pointer1
load a, (pointer1)
load b, (pointer1)
assert a, #0x12
assert b, #0x12
load a, #0x23
store a, (pointer1)
halt
#bank ram
location1:
#res 1
pointer1:
#res 2
|
opcodes1.asm
|
tonypdmtr/emu6809
| 1 |
15968
|
<reponame>tonypdmtr/emu6809
;*******************************************************************************
; Include: OPCODES1
; Version: 1.20
; Written: July 15, 1990
; Updated: Friday, August 12, 1994 7:52 pm
; Author : <NAME>
; Purpose: This is an include file with half the opcode routines used by
; the MC6809E.ASM program, an enhanced version of the MC6809E
; emulator program originally written in Turbo Pascal. Because
; it is completely written in Assembly language there should be
; a dramatic speed improvement over the Pascal version.
; Note: SYNC instruction is currently not implemented
; 220129 : Removed redundant JMP instruction by reversing previous conditional jump
;*******************************************************************************
proc mcERROR ; special routine to handle invalid ops
mov ax,130 ; invalid opcode error
call Errors
ret
endp mcERROR
;*******************************************************************************
proc mcNEG
mov al,[OpCode]
shr al,4 ; MSN -> LSN
cmp al,4 ; check it for accumulators
je @@AccA
cmp al,5
je @@AccB
jmp short @@Next
@@AccA: neg [A]
jmp short @@flags
@@AccB: neg [B]
jmp short @@flags
@@Next: call GetEffAddr
neg [byte es:si]
@@flags: pushf ; first clear affected flags
and [CC],11110000b
popf
jno @@1 ; is it the overflow case?
SOverflow
@@1: jnz @@2 ; is it the zero case?
SZero
@@2: jnc @@3 ; is it the carry case?
SCarry
@@3: jns @@exit ; is it the negative case?
SNegative
@@exit: ret
endp mcNEG
;*******************************************************************************
proc mcCOM
mov al,[OpCode]
shr al,4 ; MSN -> LSN
cmp al,4 ; check it for accumulators
je @@AccA
cmp al,5
je @@AccB
jmp short @@Next
@@AccA: not [A]
jmp short @@flags
@@AccB: not [B]
jmp short @@flags
@@Next: call GetEffAddr
not [byte es:si]
@@flags: pushf ; first clear affected flags
and [CC],11110000b
popf
jnz @@1 ; is it the zero case?
SZero
@@1: jns @@exit ; is it the negative case?
SNegative
@@exit: ret
endp mcCOM
;*******************************************************************************
proc mcLSR
mov al,[OpCode]
shr al,4 ; MSN -> LSN
cmp al,4 ; check it for accumulators
je @@AccA
cmp al,5
je @@AccB
jmp short @@Next
@@AccA: shr [A],1
jmp short @@flags
@@AccB: shr [B],1
jmp short @@flags
@@Next: call GetEffAddr
shr [byte es:si],1
@@flags: pushf ; first clear affected flags
and [CC],11110010b
popf
jnz @@1 ; is it the zero case?
SZero
@@1: jnc @@exit ; is it the Carry case?
SCarry
@@exit: ret
endp mcLSR
;*******************************************************************************
proc mcROR
mov al,[OpCode]
shr al,4 ; MSN -> LSN
cmp al,4 ; check it for accumulators
je @@AccA
cmp al,5
je @@AccB
jmp short @@Next
@@AccA: ror [A],1
jmp short @@flags
@@AccB: ror [B],1
jmp short @@flags
@@Next: call GetEffAddr
ror [byte es:si],1
@@flags: pushf ; first clear affected flags
and [CC],11110010b
popf
jnz @@1 ; is it the zero case?
SZero
@@1: jns @@2 ; is it the negative case?
SNegative
@@2: jnc @@exit ; is it the Carry case?
SCarry
@@exit: ret
endp mcROR
;*******************************************************************************
proc mcASR
mov al,[OpCode]
shr al,4 ; MSN -> LSN
cmp al,4 ; check it for accumulators
je @@AccA
cmp al,5
je @@AccB
jmp short @@Next
@@AccA: sar [A],1
jmp short @@flags
@@AccB: sar [B],1
jmp short @@flags
@@Next: call GetEffAddr
sar [byte es:si],1
@@flags: pushf ; first clear affected flags
and [CC],11110010b
popf
jnz @@1 ; is it the zero case?
SZero
@@1: jns @@2 ; is it the negative case?
SNegative
@@2: jnc @@exit ; is it the Carry case?
SCarry
@@exit: ret
endp mcASR
;*******************************************************************************
proc mcASL
mov al,[OpCode]
shr al,4 ; MSN -> LSN
cmp al,4 ; check it for accumulators
je @@AccA
cmp al,5
je @@AccB
jmp short @@Next
@@AccA: sal [A],1
jmp short @@flags
@@AccB: sal [B],1
jmp short @@flags
@@Next: call GetEffAddr
sal [byte es:si],1
@@flags: pushf ; first clear affected flags
and [CC],11110000b
popf
jnz @@1 ; is it the zero case?
SZero
@@1: jns @@2 ; is it the negative case?
SNegative
@@2: jno @@3 ; is it the overflow case?
SOverflow
@@3: jnc @@exit ; is it the Carry case?
SCarry
@@exit: ret
endp mcASL
;*******************************************************************************
proc mcROL
mov al,[OpCode]
shr al,4 ; MSN -> LSN
cmp al,4 ; check it for accumulators
je @@AccA
cmp al,5
je @@AccB
jmp short @@Next
@@AccA: rol [A],1
jmp short @@flags
@@AccB: rol [B],1
jmp short @@flags
@@Next: call GetEffAddr
rol [byte es:si],1
@@flags: pushf ; first clear affected flags
and [CC],11110000b
popf
jnz @@1 ; is it the zero case?
SZero
@@1: jns @@2 ; is it the negative case?
SNegative
@@2: jno @@3 ; is it the overflow case?
SOverflow
@@3: jnc @@exit ; is it the Carry case?
SCarry
@@exit: ret
endp mcROL
;*******************************************************************************
proc mcDEC
mov al,[OpCode]
shr al,4 ; MSN -> LSN
cmp al,4 ; check it for accumulators
je @@AccA
cmp al,5
je @@AccB
jmp short @@Next
@@AccA: dec [A]
jmp short @@flags
@@AccB: dec [B]
jmp short @@flags
@@Next: call GetEffAddr
dec [byte es:si]
@@flags: pushf ; first clear affected flags
and [CC],11110001b
popf
jnz @@1 ; is it the zero case?
SZero
@@1: jns @@2 ; is it the negative case?
SNegative
@@2: jno @@exit ; is it the overflow case?
SOverflow
@@exit: ret
endp mcDEC
;*******************************************************************************
proc mcINC
mov al,[OpCode]
shr al,4 ; MSN -> LSN
cmp al,4 ; check it for accumulators
je @@AccA
cmp al,5
je @@AccB
jmp short @@Next
@@AccA: inc [A]
jmp short @@flags
@@AccB: inc [B]
jmp short @@flags
@@Next: call GetEffAddr
inc [byte es:si]
@@flags: pushf ; first clear affected flags
and [CC],11110001b
popf
jnz @@1 ; is it the zero case?
SZero
@@1: jns @@2 ; is it the negative case?
SNegative
@@2: jno @@exit ; is it the overflow case?
SOverflow
@@exit: ret
endp mcINC
;*******************************************************************************
proc mcTST
mov al,[OpCode]
shr al,4 ; MSN -> LSN
cmp al,4 ; check it for accumulators
je @@AccA
cmp al,5
je @@AccB
jmp short @@Next
@@AccA: test [A],0FFh
jmp short @@flags
@@AccB: test [B],0FFh
jmp short @@flags
@@Next: call GetEffAddr
test [byte es:si],0FFh
@@flags: pushf ; first clear affected flags
and [CC],11110001b
popf
jnz @@1 ; is it the zero case?
SZero
@@1: jns @@exit ; is it the negative case?
SNegative
@@exit: ret
endp mcTST
;*******************************************************************************
proc mcJMP
call GetEffAddr
mov [PC],si
ret
endp mcJMP
;*******************************************************************************
proc mcCLR
mov al,[OpCode]
shr al,4 ; MSN -> LSN
cmp al,4 ; check it for accumulators
je @@AccA
cmp al,5
je @@AccB
jmp short @@Next
@@AccA: mov [A],0
jmp short @@flags
@@AccB: mov [B],0
jmp short @@flags
@@Next: call GetEffAddr
mov [byte es:si],0
@@flags: pushf ; first clear affected flags
and [CC],11110000b
popf
@@exit: ret
endp mcCLR
;*******************************************************************************
proc mcNOP
ret
endp mcNOP
;*******************************************************************************
proc mcSYNC ; not implemented at this time
ret
endp mcSYNC
;*******************************************************************************
proc mcDAA
mov al,[A]
daa
mov [A],al
pushf
and [CC],11110010b
popf
jns @@1
SNegative
@@1: jnz @@2
SZero
@@2: jnc @@exit
SCarry
@@exit: ret
endp mcDAA
;*******************************************************************************
proc mcORCC
mov si,[PC]
GetByte
inc [PC]
or [CC],al
ret
endp mcORCC
;*******************************************************************************
proc mcANDCC
mov si,[PC]
GetByte
inc [PC]
and [CC],al
ret
endp mcANDCC
;*******************************************************************************
proc mcSEX
mov al,[B]
cbw
mov [D],ax
CNegative
CZero
jns @@1
SNegative
@@1: jnz @@exit
SZero
@@exit: ret
endp mcSEX
;*******************************************************************************
; General purpose procedure (see EXG and TFR instructions)
proc GetRegister ; get the value of the register in AL/AX
cmp al,0 ; is it D?
je @@D
cmp al,1 ; is it X?
je @@X
cmp al,2 ; is it Y?
je @@Y
cmp al,3 ; is it U?
je @@U
cmp al,4 ; is it S?
je @@S
cmp al,5 ; is it PC?
je @@PC
cmp al,8 ; is it A?
je @@A
cmp al,9 ; is it B?
je @@B
cmp al,0Ah ; is it CC?
je @@CC
cmp al,0Bh ; is it DP?
je @@DP
jmp short @@exit ; otherwise, undefined register, exit
; 16-bit registers
@@D: mov ax,[D]
jmp short @@exit
@@X: mov ax,[X]
jmp short @@exit
@@Y: mov ax,[Y]
jmp short @@exit
@@U: mov ax,[U]
jmp short @@exit
@@S: mov ax,[S]
jmp short @@exit
@@PC: mov ax,[PC]
jmp short @@exit
; 8-bit registers
@@A: mov al,[A]
jmp short @@exit
@@B: mov al,[B]
jmp short @@exit
@@CC: mov al,[CC]
jmp short @@exit
@@DP: mov al,[DPR]
@@exit: ret
endp GetRegister
;*******************************************************************************
; Purpose: General purpose procedure (see EXG and TFR instructions)
proc PutRegister ; save the value of BL/BX in the register
cmp al,0 ; is it D?
je @@D
cmp al,1 ; is it X?
je @@X
cmp al,2 ; is it Y?
je @@Y
cmp al,3 ; is it U?
je @@U
cmp al,4 ; is it S?
je @@S
cmp al,5 ; is it PC?
je @@PC
cmp al,8 ; is it A?
je @@A
cmp al,9 ; is it B?
je @@B
cmp al,0Ah ; is it CC?
je @@CC
cmp al,0Bh ; is it DP?
je @@DP
jmp short @@exit ; otherwise, undefined register, exit
; 16-bit registers
@@D: mov [D],bx
jmp short @@exit
@@X: mov [X],bx
jmp short @@exit
@@Y: mov [Y],bx
jmp short @@exit
@@U: mov [U],bx
jmp short @@exit
@@S: mov [S],bx
jmp short @@exit
@@PC: mov [PC],bx
jmp short @@exit
; 8-bit registers
@@A: mov [A],bl
jmp short @@exit
@@B: mov [B],bl
jmp short @@exit
@@CC: mov [CC],bl
jmp short @@exit
@@DP: mov [DPR],bl
@@exit: ret
endp PutRegister
;*******************************************************************************
proc mcEXG
mov si,[PC]
GetByte
and al,10001000b ; are they both the same size?
cmp al,10001000b
je @@8bit
cmp al,00000000b
jne @@exit ; cannot transfer different sizes
GetByte ; 16bit case
shr al,4 ; figure out the first register
call GetRegister ; in AX
mov bx,ax ; and save it in BX
GetByte
and al,0Fh ; figure out the second register
call GetRegister ; in AX
xchg ax,bx ; swap the two registers
mov dx,ax ; save AX in DX
GetByte
shr al,4 ; figure out the first register
call PutRegister ; BX
GetByte ; figure out the second register
and al,0Fh
mov bx,dx ; get saved AX
call PutRegister ; BX
jmp short @@exit
@@8bit: GetByte
shr al,4 ; figure out the first register
call GetRegister ; in AL
mov bl,al ; and save it in BL
GetByte
and al,0Fh ; figure out the second register
call GetRegister ; in AL
xchg al,bl ; swap the two registers
mov dl,al ; save AL in DL
GetByte
shr al,4 ; figure out the first register
call PutRegister ; BL
GetByte ; figure out the second register
and al,0Fh
mov bl,dl ; get saved AL
call PutRegister ; BL
@@exit: inc [PC]
ret
endp mcEXG
;*******************************************************************************
proc mcTFR
mov si,[PC]
GetByte
and al,10001000b ; are they both the same size?
cmp al,10001000b
je @@8bit
cmp al,00000000b
jne @@exit ; cannot transfer different sizes
GetByte ; 16bit case
shr al,4 ; figure out the first register
call GetRegister ; in AX
mov bx,ax ; move it to BX
GetByte ; figure out the second register
and al,0Fh
call PutRegister ; BX
jmp short @@exit
@@8bit: GetByte
shr al,4 ; figure out the first register
call GetRegister ; in AL
mov bl,al ; move it to BL
GetByte ; figure out the second register
and al,0Fh
call PutRegister ; BL
@@exit: inc [PC]
ret
endp mcTFR
;*******************************************************************************
proc mcBRA
call GetEffAddr
cmp [OpCode],16h ; is it a long or short branch?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@exit
@@16bit: GetWord
inc [PC]
inc [PC]
@@exit: add [PC],ax
ret
endp mcBRA
;*******************************************************************************
proc mcBRN
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
inc [PC]
jmp short @@exit
@@16bit: inc [PC]
inc [PC]
@@exit: ret
endp mcBRN
;*******************************************************************************
proc mcBHI
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: mov bl,[CC]
and bl,CarryMask+ZeroMask
jnz @@exit
add [PC],ax
@@exit: ret
endp mcBHI
;*******************************************************************************
proc mcBLS
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: mov bl,[CC]
and bl,CarryMask+ZeroMask
jz @@exit
add [PC],ax
@@exit: ret
endp mcBLS
;*******************************************************************************
proc mcBHS
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: test [CC],CarryMask
jnz @@exit
add [PC],ax
@@exit: ret
endp mcBHS
;*******************************************************************************
proc mcBLO
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: test [CC],CarryMask
jz @@exit
add [PC],ax
@@exit: ret
endp mcBLO
;*******************************************************************************
proc mcBNE
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: test [CC],ZeroMask
jnz @@exit
add [PC],ax
@@exit: ret
endp mcBNE
;*******************************************************************************
proc mcBEQ
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: test [CC],ZeroMask
jz @@exit
add [PC],ax
@@exit: ret
endp mcBEQ
;*******************************************************************************
proc mcBVC
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: test [CC],OverflowMask
jnz @@exit
add [PC],ax
@@exit: ret
endp mcBVC
;*******************************************************************************
proc mcBVS
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: test [CC],OverflowMask
jz @@exit
add [PC],ax
@@exit: ret
endp mcBVS
;*******************************************************************************
proc mcBPL
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: test [CC],NegativeMask
jnz @@exit
add [PC],ax
@@exit: ret
endp mcBPL
;*******************************************************************************
proc mcBMI
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: test [CC],NegativeMask
jz @@exit
add [PC],ax
@@exit: ret
endp mcBMI
;*******************************************************************************
proc mcBGE
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: mov bl,[CC]
and bl,NegativeMask+OverflowMask
jz @@ok
cmp bl,NegativeMask+OverflowMask
je @@ok
jmp short @@exit
@@ok: add [PC],ax
@@exit: ret
endp mcBGE
;*******************************************************************************
proc mcBLT
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: mov bl,[CC]
and bl,NegativeMask+OverflowMask
jz @@exit
cmp bl,NegativeMask+OverflowMask
je @@exit
add [PC],ax
@@exit: ret
endp mcBLT
;*******************************************************************************
proc mcBGT
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: mov bl,[CC]
test bl,ZeroMask
jnz @@exit
and bl,NegativeMask+OverflowMask
jz @@ok
cmp bl,NegativeMask+OverflowMask
je @@ok
jmp short @@exit
@@ok: add [PC],ax
@@exit: ret
endp mcBGT
;*******************************************************************************
proc mcBLE
call GetEffAddr
mov al,[Paged] ; is it a long or short branch?
cmp al,10h ; PAGE2?
je @@16bit
GetByte
inc [PC]
cbw
jmp short @@done
@@16bit: GetWord
inc [PC]
inc [PC]
@@done: mov bl,[CC]
test bl,ZeroMask
jnz @@ok
and bl,NegativeMask+OverflowMask
jz @@exit
cmp bl,NegativeMask+OverflowMask
je @@exit
@@ok: add [PC],ax
@@exit: ret
endp mcBLE
;*******************************************************************************
proc mcLEAX
call GetEffAddr
mov [X],si
and [CC],11111011b
cmp si,0
jnz @@exit
or [CC],00000100b
@@exit: ret
endp mcLEAX
;*******************************************************************************
proc mcLEAY
call GetEffAddr
mov [Y],si
and [CC],11111011b
cmp si,0
jnz @@exit
or [CC],00000100b
@@exit: ret
endp mcLEAY
;*******************************************************************************
proc mcLEAS
call GetEffAddr
mov [S],si
ret
endp mcLEAS
;*******************************************************************************
proc mcLEAU
call GetEffAddr
mov [U],si
ret
endp mcLEAU
;*******************************************************************************
proc mcPSHS
mov si,[PC]
GetByte
inc [PC]
test al,10000000b ; PC?
jz @@1
dec [S]
dec [S]
mov bx,[PC]
xchg bh,bl
mov si,[S]
mov [es:si],bx
@@1: test al,01000000b ; U?
jz @@2
dec [S]
dec [S]
mov bx,[U]
xchg bh,bl
mov si,[S]
mov [es:si],bx
@@2: test al,00100000b ; Y?
jz @@3
dec [S]
dec [S]
mov bx,[Y]
xchg bh,bl
mov si,[S]
mov [es:si],bx
@@3: test al,00010000b ; X?
jz @@4
dec [S]
dec [S]
mov bx,[X]
xchg bh,bl
mov si,[S]
mov [es:si],bx
@@4: test al,00001000b ; DP?
jz @@5
dec [S]
mov bl,[DPR]
mov si,[S]
mov [es:si],bl
@@5: test al,00000100b ; B?
jz @@6
dec [S]
mov bl,[B]
mov si,[S]
mov [es:si],bl
@@6: test al,00000010b ; A?
jz @@7
dec [S]
mov bl,[A]
mov si,[S]
mov [es:si],bl
@@7: test al,00000001b ; CC?
jz @@exit
dec [S]
mov bl,[CC]
mov si,[S]
mov [es:si],bl
@@exit: ret
endp mcPSHS
;*******************************************************************************
proc mcPULS
mov si,[PC]
GetByte
inc [PC]
test al,00000001b ; CC?
jz @@1
mov si,[S]
mov bl,[es:si]
inc [S]
mov [CC],bl
@@1: test al,00000010b ; A?
jz @@2
mov si,[S]
mov bl,[es:si]
inc [S]
mov [A],bl
@@2: test al,00000100b ; B?
jz @@3
mov si,[S]
mov bl,[es:si]
inc [S]
mov [B],bl
@@3: test al,00001000b ; DP?
jz @@4
mov si,[S]
mov bl,[es:si]
inc [S]
mov [DPR],bl
@@4: test al,00010000b ; X?
jz @@5
mov si,[S]
mov bx,[es:si]
inc [S]
inc [S]
xchg bh,bl
mov [X],bx
@@5: test al,00100000b ; Y?
jz @@6
mov si,[S]
mov bx,[es:si]
inc [S]
inc [S]
xchg bh,bl
mov [Y],bx
@@6: test al,01000000b ; U?
jz @@7
mov si,[S]
mov bx,[es:si]
inc [S]
inc [S]
xchg bh,bl
mov [U],bx
@@7: test al,10000000b ; PC?
jz @@exit
mov si,[S]
mov bx,[es:si]
inc [S]
inc [S]
xchg bh,bl
mov [PC],bx
@@exit: ret
endp mcPULS
;*******************************************************************************
proc mcPSHU
mov si,[PC]
GetByte
inc [PC]
test al,10000000b ; PC?
jz @@1
dec [U]
dec [U]
mov bx,[PC]
xchg bh,bl
mov si,[U]
mov [es:si],bx
@@1: test al,01000000b ; S?
jz @@2
dec [U]
dec [U]
mov bx,[S]
xchg bh,bl
mov si,[U]
mov [es:si],bx
@@2: test al,00100000b ; Y?
jz @@3
dec [U]
dec [U]
mov bx,[Y]
xchg bh,bl
mov si,[U]
mov [es:si],bx
@@3: test al,00010000b ; X?
jz @@4
dec [U]
dec [U]
mov bx,[X]
xchg bh,bl
mov si,[U]
mov [es:si],bx
@@4: test al,00001000b ; DP?
jz @@5
dec [U]
mov bl,[DPR]
mov si,[U]
mov [es:si],bl
@@5: test al,00000100b ; B?
jz @@6
dec [U]
mov bl,[B]
mov si,[U]
mov [es:si],bl
@@6: test al,00000010b ; A?
jz @@7
dec [U]
mov bl,[A]
mov si,[U]
mov [es:si],bl
@@7: test al,00000001b ; CC?
jz @@exit
dec [U]
mov bl,[CC]
mov si,[U]
mov [es:si],bl
@@exit: ret
endp mcPSHU
;*******************************************************************************
proc mcPULU
mov si,[PC]
GetByte
inc [PC]
test al,00000001b ; CC?
jz @@1
mov si,[U]
mov bl,[es:si]
inc [U]
mov [CC],bl
@@1: test al,00000010b ; A?
jz @@2
mov si,[U]
mov bl,[es:si]
inc [U]
mov [A],bl
@@2: test al,00000100b ; B?
jz @@3
mov si,[U]
mov bl,[es:si]
inc [U]
mov [B],bl
@@3: test al,00001000b ; DP?
jz @@4
mov si,[U]
mov bl,[es:si]
inc [U]
mov [DPR],bl
@@4: test al,00010000b ; X?
jz @@5
mov si,[U]
mov bx,[es:si]
inc [U]
inc [U]
xchg bh,bl
mov [X],bx
@@5: test al,00100000b ; Y?
jz @@6
mov si,[U]
mov bx,[es:si]
inc [U]
inc [U]
xchg bh,bl
mov [Y],bx
@@6: test al,01000000b ; S?
jz @@7
mov si,[U]
mov bx,[es:si]
inc [U]
inc [U]
xchg bh,bl
mov [S],bx
@@7: test al,10000000b ; PC?
jz @@exit
mov si,[U]
mov bx,[es:si]
inc [U]
inc [U]
xchg bh,bl
mov [PC],bx
@@exit: ret
endp mcPULU
;*******************************************************************************
proc mcRTS
mov si,[S]
inc [S]
inc [S]
GetWord
mov [PC],ax
ret
endp mcRTS
;*******************************************************************************
proc mcABX
xor ax,ax
mov al,[B]
add [X],ax
ret
endp mcABX
;*******************************************************************************
proc mcRTI
test [CC],EntireFlagMask
jz @@short ; entire state flag clear
mov si,[S] ; get stack pointer
GetWord
mov [D],ax
inc [S]
inc [S]
mov si,[S] ; get stack pointer
GetByte
mov [DPR],al
inc [S]
mov si,[S] ; get stack pointer
GetWord
mov [X],ax
inc [S]
inc [S]
mov si,[S] ; get stack pointer
GetWord
mov [Y],ax
inc [S]
inc [S]
mov si,[S] ; get stack pointer
GetWord
mov [U],ax
inc [S]
inc [S]
@@short: mov si,[S] ; get stack pointer
GetWord
mov [PC],ax
inc [S]
inc [S]
ret
endp mcRTI
;*******************************************************************************
proc mcCWAI
mov si,[PC]
GetByte
inc [PC]
and al,[CC]
mov [CC],al
SEntireFlag
dec [S]
dec [S]
mov si,[S]
mov ax,[PC]
PutWord
dec [S]
dec [S]
mov si,[S]
mov ax,[U]
PutWord
dec [S]
dec [S]
mov si,[S]
mov ax,[Y]
PutWord
dec [S]
dec [S]
mov si,[S]
mov ax,[X]
PutWord
dec [S]
mov si,[S]
mov al,[DPR]
PutByte
dec [S]
dec [S]
mov si,[S]
mov ax,[D]
PutWord
dec [S]
mov si,[S]
mov al,[CC]
PutByte
ret
endp mcCWAI
;*******************************************************************************
proc mcMUL
mov al,[A] ; get first operand
mul [B] ; multiply with second operand
mov [D],ax ; save result in accumulator D
pushf ; reset affected flags
and [CC],11111010b
popf
jnz @@1
or [CC],00000100b
@@1: test [B],10000000b ; is bit 7 of B set?
jz @@exit ; no, exit
or [CC],00000001b
@@exit: ret
endp mcMUL
;*******************************************************************************
proc mcSWI
SEntireFlag
dec [S]
dec [S]
mov si,[S]
mov ax,[PC]
PutWord
dec [S]
dec [S]
mov si,[S]
mov ax,[U]
PutWord
dec [S]
dec [S]
mov si,[S]
mov ax,[Y]
PutWord
dec [S]
dec [S]
mov si,[S]
mov ax,[X]
PutWord
dec [S]
mov si,[S]
mov al,[DPR]
PutByte
dec [S]
dec [S]
mov si,[S]
mov ax,[D]
PutWord
dec [S]
mov si,[S]
mov al,[CC]
PutByte
SIRQ
SFIRQ
mov si,0FFFAh ; point to 6809 interrupt vector
GetWord ; get vector
mov [PC],ax ; and put it in PC
ret
endp mcSWI
|
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_audio_gstaudioiec61937_h.ads
|
persan/A-gst
| 1 |
9647
|
pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstringbuffer_h;
with glib;
with glib.Values;
with System;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstaudioiec61937_h is
-- GStreamer audio helper functions for IEC 61937 payloading
-- * (c) 2011 Intel Corporation
-- * 2011 Collabora Multimedia
-- * 2011 <NAME> <<EMAIL>>
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
function gst_audio_iec61937_frame_size (spec : access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstringbuffer_h.GstRingBufferSpec) return GLIB.guint; -- gst/audio/gstaudioiec61937.h:27
pragma Import (C, gst_audio_iec61937_frame_size, "gst_audio_iec61937_frame_size");
function gst_audio_iec61937_payload
(src : access GLIB.guint8;
src_n : GLIB.guint;
dst : access GLIB.guint8;
dst_n : GLIB.guint;
spec : access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstringbuffer_h.GstRingBufferSpec) return GLIB.gboolean; -- gst/audio/gstaudioiec61937.h:28
pragma Import (C, gst_audio_iec61937_payload, "gst_audio_iec61937_payload");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstaudioiec61937_h;
|
alloy4fun_models/trashltl/models/11/3Jp9goR4zPyvgfqb5.als
|
Kaixi26/org.alloytools.alloy
| 0 |
3073
|
<reponame>Kaixi26/org.alloytools.alloy
open main
pred id3Jp9goR4zPyvgfqb5_prop12 {
always some f : File | eventually f in Trash implies f in Trash
}
pred __repair { id3Jp9goR4zPyvgfqb5_prop12 }
check __repair { id3Jp9goR4zPyvgfqb5_prop12 <=> prop12o }
|
scc_perturbed_scflip.als
|
NVlabs/litmustestgen
| 6 |
3
|
<filename>scc_perturbed_scflip.als
// Automated Synthesis of Comprehensive Memory Model Litmus Test Suites
// <NAME>, <NAME>, <NAME>, <NAME>
// ASPLOS 2017
//
// Copyright (c) 2017, NVIDIA Corporation. All rights reserved.
//
// This file is licensed under the BSD-3 license. See LICENSE for details.
// Streamlined Causal Consistency (SCC) Model
////////////////////////////////////////////////////////////////////////////////
// =Perturbations=
abstract sig PTag {}
one sig RE extends PTag {} // Remove Event
one sig DRA extends PTag {} // Demote Release Acquire
one sig DFSC extends PTag {} // Demote FenceSC
one sig RD extends PTag {} // Remove Dependency
fun no_p : PTag->univ { // no_p - constant for no perturbation
(PTag->univ) - (PTag->univ)
}
////////////////////////////////////////////////////////////////////////////////
// =SCC memory model=
pred scc_p[p: PTag->univ] {
sc_per_loc_p[p]
no_thin_air_p[p]
rmw_atomicity_p[p]
causality_p[p]
}
// HACK!!! see the paper
fact { lone sc }
pred scc_scflip[p: PTag->univ] {
sc_per_loc_p[p]
no_thin_air_p[p]
rmw_atomicity_p[p]
causality_scflip_p[p]
}
pred sc_per_loc_p[p: PTag->univ] {
acyclic[com_p[p] + po_loc_p[p]]
}
pred no_thin_air_p[p: PTag->univ] {
acyclic[rf_p[p] + dep_p[p]]
}
pred rmw_atomicity_p[p: PTag->univ] {
no (fr_p[p]).(co_p[p]) & rmw_p[p]
}
pred causality_p[p: PTag->univ] {
irreflexive[*(com_p[p]).^(cause_p[p])]
}
// HACK!!! see the paper
pred causality_scflip_p[p: PTag->univ] {
irreflexive[*(com_p[p]).^(cause_p[p])]
or
irreflexive[*(com_p[p]).^(cause_scflip_p[p])]
}
fun prefix_p[p: PTag->univ] : Event->Event {
iden + ((Fence - p[RE]) <: po_p[p]) + ((Release - p[RE] - p[DRA]) <: po_loc_p[p])
}
fun suffix_p[p: PTag->univ] : Event->Event {
iden + (po_p[p] :> (Fence - p[RE])) + (po_loc_p[p] :> (Acquire - p[RE] - p[DRA]))
}
fun observation_p[p: PTag->univ] : Event->Event {
rf_p[p] + rmw_p[p]
}
fun Releasers_p[p: PTag->univ] : Event {
(Release - p[RE] - p[DRA]) + (Fence - p[RE])
}
fun Acquirers_p[p: PTag->univ] : Event {
(Acquire - p[RE] - p[DRA]) + (Fence - p[RE])
}
fun sync_p[p: PTag->univ] : Event->Event {
Releasers_p[p] <: (prefix_p[p]).^(observation_p[p]).(suffix_p[p]) :> Acquirers_p[p]
}
fun cause_p[p: PTag->univ] : MemoryEvent->MemoryEvent {
*(po_p[p]).(sc_p[p] + sync_p[p]).*(po_p[p])
}
fun cause_scflip_p[p: PTag->univ] : MemoryEvent->MemoryEvent {
*(po_p[p]).(~(sc_p[p]) + sync_p[p]).*(po_p[p])
}
////////////////////////////////////////////////////////////////////////////////
// =Basic model of memory=
sig Address { }
sig Thread { start: one Event }
abstract sig Event { po: lone Event }
abstract sig MemoryEvent extends Event {
address: one Address,
dep: set MemoryEvent,
}
sig Read extends MemoryEvent { rmw: lone Write }
sig Acquire extends Read { }
sig Write extends MemoryEvent { rf: set Read, co: set Write }
sig Release extends Write { }
abstract sig Fence extends Event {}
sig FenceAll extends Fence { }
sig FenceSC extends FenceAll {
sc: set FenceSC
}
////////////////////////////////////////////////////////////////////////////////
// =Constraints on basic model of memory=
// All communication is via accesses to the same address
fact { com in address.~address }
// Program order is sane
fact { acyclic[po] }
fact { all e: Event | one t: Thread | t->e in start.*po }
fun po_loc : Event->Event { ^po & address.~address }
// Dependencies go from Reads to Reads or Writes
fact { dep in Read <: ^po }
// co is a per-address total order
fact { all a: Address | total[co, a.~address :> Write] }
// Each read sources from at most one write
// (could be zero if sourcing from the initial condition)
fact { rf.~rf in iden }
// fr is defined in the standard way
fun fr : Read->Write {
~rf.co
+
// also include reads that read from the initial state
((Read - (Write.rf)) <: (address.~address) :> Write)
}
// RMW pairs are sane and overlap with dep
fact { rmw in po & dep & address.~address }
// sc is a total order on FenceSCs
fact { total[sc, FenceSC] }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// =Model of memory, under perturbation=
// po is not transitive
fun po_t[p: PTag->univ] : Event->Event { (Event - p[RE]) <: ^po :> (Event - p[RE]) }
fun po_p[p: PTag->univ] : Event->Event { po_t[p] - (po_t[p]).(po_t[p]) }
// po_loc is already transitive
fun po_loc_p[p: PTag->univ] : MemoryEvent->MemoryEvent { (MemoryEvent - p[RE]) <: ^po_loc :> (MemoryEvent - p[RE]) }
// dep is not transitive
fun dep_p[p: PTag->univ] : MemoryEvent->MemoryEvent {
(Read - p[RE] - p[RD]) <: *(dep :> p[RE]).dep :> (MemoryEvent - p[RE])
}
fun rf_p[p: PTag->univ] : Write->Read { (Write - p[RE]) <: rf :> (Read - p[RE]) }
fun co_p[p: PTag->univ] : Write->Write { (Write - p[RE]) <: co :> (Write - p[RE]) }
fun fr_p[p: PTag->univ] : Read->Write { (Read - p[RE]) <: fr :> (Write - p[RE]) }
//fun fr_p[p: PTag->univ] : Read->Write {
// ( ~(rf_p[p]).^(co_p[p]) )
// +
// ( (Read-(Write.rf)-p[RE]) <: address.~address :> (Write - p[RE]) )
// //((Read - p[RE])->(Write - p[RE]) & address.~address) - (~(rf_p[p]).*(co_p[p]))
//}
fun rmw_p[p: PTag->univ] : Read->Write { (Read - p[RE] - p[RD]) <: rmw :> (Write - p[RE]) }
// sc is not transitive
fun sc_t[p: PTag->univ] : Event->Event { (Event - p[RE] - p[DFSC]) <: ^sc :> (Event - p[RE] - p[DFSC]) }
fun sc_p[p: PTag->univ] : Event->Event { sc_t[p] - (sc_t[p]).(sc_t[p]) }
////////////////////////////////////////////////////////////////////////////////
// =Shortcuts=
fun same_thread [rel: Event->Event] : Event->Event {
rel & ( iden + ^po + ~^po )
}
fun com : MemoryEvent->MemoryEvent { rf + fr + co }
fun rfi : MemoryEvent->MemoryEvent { same_thread[rf] }
fun rfe : MemoryEvent->MemoryEvent { rf - rfi[] }
fun fri : MemoryEvent->MemoryEvent { same_thread[fr] }
fun fre : MemoryEvent->MemoryEvent { fr - fri }
fun coi : MemoryEvent->MemoryEvent { same_thread[co] }
fun coe : MemoryEvent->MemoryEvent { co - coi }
fun com_p[p: PTag->univ] : MemoryEvent->MemoryEvent { rf_p[p] + fr_p[p] + co_p[p] }
fun rfi_p[p: PTag->univ] : MemoryEvent->MemoryEvent { same_thread[rf_p[p]] }
fun rfe_p[p: PTag->univ] : MemoryEvent->MemoryEvent { rf_p[p] - rfi_p[p] }
fun fri_p[p: PTag->univ] : MemoryEvent->MemoryEvent { same_thread[fr_p[p]] }
fun fre_p[p: PTag->univ] : MemoryEvent->MemoryEvent { fr_p[p] - fri_p[p] }
fun coi_p[p: PTag->univ] : MemoryEvent->MemoryEvent { same_thread[co_p[p]] }
fun coe_p[p: PTag->univ] : MemoryEvent->MemoryEvent { co_p[p] - coi_p[p] }
////////////////////////////////////////////////////////////////////////////////
// =Alloy helpers=
pred irreflexive[rel: Event->Event] { no iden & rel }
pred acyclic[rel: Event->Event] { irreflexive[^rel] }
pred total[rel: Event->Event, bag: Event] {
all disj e, e': bag | e->e' in rel + ~rel
acyclic[rel]
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// =Perturbation auxiliaries=
let interesting_not_axiom[axiom] {
not axiom[no_p]
// All events must be relevant and minimal
all e: Event | scc_p[RE->(e + e.rmw + e.~rmw)]
all e: Release+Acquire | scc_p[DRA->e]
all f: FenceSC | scc_p[DFSC->f]
all r: Read | scc_p[RD->r] or no r.dep
}
let interesting_not_axiom_scflip[axiom] {
not axiom[no_p]
// All events must be relevant and minimal
all e: Event | scc_scflip[RE->(e + e.rmw + e.~rmw)]
all e: Release+Acquire | scc_scflip[DRA->e]
all f: FenceSC | scc_scflip[DFSC->f]
all r: Read | scc_scflip[RD->r] or no r.dep
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// =Constraints on the search space=
fact {
all a: Address | some (a.~address) :> Write
}
fact {
irreflexive[^po.sc]
}
////////////////////////////////////////////////////////////////////////////////
run sc_per_loc {
interesting_not_axiom[sc_per_loc_p]
} for 3
run no_thin_air {
interesting_not_axiom[no_thin_air_p]
} for 3
run rmw_atomicity {
interesting_not_axiom[rmw_atomicity_p]
} for 3
run causality {
interesting_not_axiom[causality_p]
} for 3
run causality_scflip {
interesting_not_axiom_scflip[causality_scflip_p]
} for 3 but 2 FenceSC
run union {
interesting_not_axiom[sc_per_loc_p]
or
interesting_not_axiom[no_thin_air_p]
or
interesting_not_axiom[rmw_atomicity_p]
or
interesting_not_axiom[causality_p]
} for 3
run union_scflip {
interesting_not_axiom[sc_per_loc_p]
or
interesting_not_axiom[no_thin_air_p]
or
interesting_not_axiom[rmw_atomicity_p]
or
interesting_not_axiom_scflip[causality_scflip_p]
} for 3 but 2 FenceSC
|
oeis/253/A253715.asm
|
neoneye/loda-programs
| 11 |
11031
|
<reponame>neoneye/loda-programs
; A253715: Indices of centered heptagonal numbers (A069099) which are also hexagonal numbers (A000384).
; Submitted by <NAME>
; 1,2160,34417,139317984,2220346081,8987960385360,143243407002961,579849276161764800,9241205157168647617,37408396193312133889584,596187109366334725327921,2413365271435489729590825120,38462415164418513312636815521,155695847083980788221510357869840,2481364251321108858485116791161617,10044561876362571299887029498024000384,160082733271267601731890311352363711361,648014864735959077756931032814010002871280,10327577451781193806810062688101275683549681,41806030973531102066048077351076011827213725280
mov $2,$0
mul $0,2
mod $2,2
add $0,$2
seq $0,253879 ; Indices of centered heptagonal numbers (A069099) which are also triangular numbers (A000217).
|
programs/oeis/257/A257170.asm
|
jmorken/loda
| 1 |
3789
|
; A257170: Expansion of (1 + x) * (1 + x^3) / (1 + x^4) in powers of x.
; 1,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1
lpb $0
mov $2,1
lpb $0
sub $0,8
lpe
mod $0,2
lpe
pow $0,$2
mov $1,$0
|
programs/oeis/001/A001701.asm
|
neoneye/loda
| 22 |
162554
|
; A001701: Generalized Stirling numbers.
; 1,6,26,71,155,295,511,826,1266,1860,2640,3641,4901,6461,8365,10660,13396,16626,20406,24795,29855,35651,42251,49726,58150,67600,78156,89901,102921,117305,133145,150536,169576,190366,213010,237615,264291,293151,324311,357890,394010,432796,474376,518881,566445,617205,671301,728876,790076,855050,923950,996931,1074151,1155771,1241955,1332870,1428686,1529576,1635716,1747285,1864465,1987441,2116401,2251536,2393040,2541110,2695946,2857751,3026731,3203095,3387055,3578826,3778626,3986676,4203200,4428425,4662581,4905901,5158621,5420980,5693220,5975586,6268326,6571691,6885935,7211315,7548091,7896526,8256886,8629440,9014460,9412221,9823001,10247081,10684745,11136280,11601976,12082126,12577026,13086975
mov $1,1
trn $1,$0
lpb $0
add $3,$0
sub $0,1
add $2,$3
add $2,5
add $1,$2
add $3,4
lpe
mov $0,$1
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c41205a.ada
|
best08618/asylo
| 7 |
13551
|
-- C41205A.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 CONSTRAINT_ERROR IS RAISED IF THE NAME PART OF A
-- SLICE DENOTES AN ACCESS OBJECT WHOSE VALUE IS NULL, AND
-- ALSO IF THE NAME IS A FUNCTION CALL DELIVERING NULL.
-- WKB 8/6/81
-- SPS 10/26/82
-- EDS 07/14/98 AVOID OPTIMIZATION
WITH REPORT;
USE REPORT;
PROCEDURE C41205A IS
BEGIN
TEST ("C41205A", "CONSTRAINT_ERROR WHEN THE NAME PART OF A " &
"SLICE DENOTES A NULL ACCESS OBJECT OR A " &
"FUNCTION CALL DELIVERING NULL");
DECLARE
TYPE T IS ARRAY (INTEGER RANGE <> ) OF INTEGER;
SUBTYPE T1 IS T (1..5);
TYPE A1 IS ACCESS T1;
B : A1 := NEW T1' (1,2,3,4,5);
I : T (2..3);
BEGIN
IF EQUAL (3,3) THEN
B := NULL;
END IF;
I := B(2..3);
FAILED ("CONSTRAINT_ERROR NOT RAISED - 1 " & INTEGER'IMAGE(I(2)));
EXCEPTION
WHEN CONSTRAINT_ERROR => NULL;
WHEN OTHERS => FAILED ("WRONG EXCEPTION - 1");
END;
DECLARE
TYPE T IS ARRAY (INTEGER RANGE <> ) OF INTEGER;
SUBTYPE T2 IS T (1..5);
TYPE A2 IS ACCESS T2;
I : T (2..5);
FUNCTION F RETURN A2 IS
BEGIN
IF EQUAL (3,3) THEN
RETURN NULL;
END IF;
RETURN NEW T2' (1,2,3,4,5);
END F;
BEGIN
I := F(2..5);
FAILED ("CONSTRAINT_ERROR NOT RAISED - 2 " & INTEGER'IMAGE(I(2)));
EXCEPTION
WHEN CONSTRAINT_ERROR => NULL;
WHEN OTHERS => FAILED ("WRONG EXCEPTION - 2");
END;
RESULT;
END C41205A;
|
oeis/017/A017050.asm
|
neoneye/loda-programs
| 11 |
89727
|
<reponame>neoneye/loda-programs
; A017050: a(n) = (7*n + 5)^10.
; 9765625,61917364224,6131066257801,141167095653376,1531578985264449,10485760000000000,52599132235830049,210832519264920576,713342911662882601,2113922820157210624,5631351470947265625,13744803133596058624,31181719929966183601,66483263599150104576,134391637934412192049,259374246010000000000,480682838924478847449,859442550649180389376,1488377021731616101801,2504902718110474036224,4108469075197275390625,6583182266716099969024,10326930237613180030401,15888426175698793931776,24013807852610947920649
mul $0,7
add $0,5
pow $0,10
|
maps/RedsHouse2F.asm
|
Trap-Master/spacworld97-thingy
| 0 |
173553
|
RedsHouse2F_MapScripts:
db 0 ; scene scripts
;scene_script .PlayersHouseCheckGender ; SCENE_DEFAULT
db 0 ; callbacks
;.SetGender:
;prioritysjump .SettingGender
;end
;.SettingGender:
;opentext
;writetext Text_Gender
;waitbutton
;yesorno
;iffalse .Setfemale
;closetext
;setmapscene REDS_HOUSE_2F, SCENE_FINISHED
;end
;.Setfemale:
;setevent EVENT_FEMALE
;opentext
;writetext Text_Thanks
;waitbutton
;closetext
;setmapscene REDS_HOUSE_2F, SCENE_FINISHED
;end
;Text_Gender:
;text "For some reason"
; line "the gender flag"
;para "does not set when"
;line "you click it so I"
;para "had to add this"
;line "fix. Sorry about"
;para "that. Simply hit"
;line "yes for male or no"
;para "for female. Only"
;line "thing this does is"
;para "change pronouns"
;line "and also certain"
;para "NPCs that react"
;line "differently to"
;para "males or females."
;done
Text_Thanks:
text "Thanks."
done
RedsHouse2FN64Script:
jumptext RedsHouse2FN64Text
;RedsHouse2FPCScript:
; jumptext RedsHouse2FPCText
PlayersHousePCScript:
opentext
special PlayersHousePC
iftrue .Warp
closetext
end
.Warp:
warp NONE, 0, 0
end
RedsHouse2FN64Text:
text "<PLAYER> played the"
line "N64."
para "Better get going--"
line "no time to lose!"
done
;RedsHouse2FPCText:
; text "It looks like it"
; line "hasn't been used"
; cont "in a long time…"
; done
RedsHouse2F_MapEvents:
db 0, 0 ; filler
db 1 ; warp events
warp_event 7, 1, REDS_HOUSE_1F, 3
db 0 ; coord events
db 2 ; bg events
bg_event 3, 5, BGEVENT_READ, RedsHouse2FN64Script
bg_event 0, 1, BGEVENT_UP, PlayersHousePCScript
;bg_event 0, 1, BGEVENT_READ, RedsHouse2FPCScript
db 0 ; object events
|
VirtualMachine/Win32/UnitTests/Conditionals/test23_islte_Boolean.asm
|
ObjectPascalInterpreter/BookPart_3
| 8 |
13678
|
<reponame>ObjectPascalInterpreter/BookPart_3
# Test23 - Islte Test
pushi 2
pushi 3
isLte
halt
|
reference/antlr4/tool/test/org/antlr/v4/test/tool/PositionAdjustingLexer.g4
|
kaby76/antlr4cs
| 321 |
6976
|
/*
* Copyright (c) 2012 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD-3-Clause license that
* can be found in the LICENSE.txt file in the project root.
*/
lexer grammar PositionAdjustingLexer;
@members {
@Override
public Token nextToken() {
if (!(_interp instanceof PositionAdjustingLexerATNSimulator)) {
_interp = new PositionAdjustingLexerATNSimulator(this, _ATN);
}
return super.nextToken();
}
@Override
public Token emit() {
switch (_type) {
case TOKENS:
handleAcceptPositionForKeyword("tokens");
break;
case LABEL:
handleAcceptPositionForIdentifier();
break;
default:
break;
}
return super.emit();
}
private boolean handleAcceptPositionForIdentifier() {
String tokenText = getText();
int identifierLength = 0;
while (identifierLength < tokenText.length() && isIdentifierChar(tokenText.charAt(identifierLength))) {
identifierLength++;
}
if (getInputStream().index() > _tokenStartCharIndex + identifierLength) {
int offset = identifierLength - 1;
getInterpreter().resetAcceptPosition(getInputStream(), _tokenStartCharIndex + offset, _tokenStartLine, _tokenStartCharPositionInLine + offset);
return true;
}
return false;
}
private boolean handleAcceptPositionForKeyword(String keyword) {
if (getInputStream().index() > _tokenStartCharIndex + keyword.length()) {
int offset = keyword.length() - 1;
getInterpreter().resetAcceptPosition(getInputStream(), _tokenStartCharIndex + offset, _tokenStartLine, _tokenStartCharPositionInLine + offset);
return true;
}
return false;
}
@Override
public PositionAdjustingLexerATNSimulator getInterpreter() {
return (PositionAdjustingLexerATNSimulator)super.getInterpreter();
}
private static boolean isIdentifierChar(char c) {
return Character.isLetterOrDigit(c) || c == '_';
}
protected static class PositionAdjustingLexerATNSimulator extends LexerATNSimulator {
public PositionAdjustingLexerATNSimulator(Lexer recog, ATN atn) {
super(recog, atn);
}
protected void resetAcceptPosition(CharStream input, int index, int line, int charPositionInLine) {
input.seek(index);
this.line = line;
this.charPositionInLine = charPositionInLine;
consume(input);
}
}
}
ASSIGN : '=' ;
PLUS_ASSIGN : '+=' ;
LCURLY: '{';
// 'tokens' followed by '{'
TOKENS : 'tokens' IGNORED '{';
// IDENTIFIER followed by '+=' or '='
LABEL
: IDENTIFIER IGNORED '+'? '='
;
IDENTIFIER
: [a-zA-Z_] [a-zA-Z0-9_]*
;
fragment
IGNORED
: [ \t\r\n]*
;
NEWLINE
: [\r\n]+ -> skip
;
WS
: [ \t]+ -> skip
;
|
T5P2/testestraps.asm
|
cggewehr/Projeto-De-Processadores
| 0 |
175868
|
; PROJETO DE PROCESSADORES - ELC 1094 - PROF. CARARA
; PROCESSADOR R8
; <NAME> E <NAME>
; DESCRIÇÃO:
; PROCESSADOR R8 COM SUPORTE A INTERRUPÇÕES DE I/O VIA PIC E TRAPS
; APLICAÇÃO ATUAL:
; TESTE DE TRAPS
; CHANGELOG:
;
; TODO:
;
; OBSERVAÇÕES:
; - O parametro ISR_ADDR deve ser setado para 0x"0001" na instanciação do processador na entity top level
; - Respeitar o padrão de registradores estabelecidos
; - Novas adições ao código deve ser o mais modular possível
; - Subrotinas importantes devem começar com letra maiuscula
; - Subrotinas auxiliares devem começar com letra minuscula e serem identadas com 2 espaços
; - Instruções devem ser identadas com 4 espaços
; REGISTRADORES:
; --------------------- r0 = 0
; --------------------- r1 = SYSCALL ID
; --------------------- r2 = PARAMETRO para subrotina
; --------------------- r3 = PARAMETRO para subrotina
; --------------------- r14 = Retorno de subrotina
; --------------------- r15 = Retorno de subrotina
;////////////////////////////////////////////////////////////////////////////////////////////////////////////
; port_io[15] = OPEN
; port_io[14] = OPEN
; port_io[13] = OPEN
; port_io[12] = OPEN
; port_io[11] = OPEN
; port_io[10] = OPEN
; port_io[9] = OPEN
; port_io[8] = OPEN
; port_io[7] = OPEN
; port_io[6] = OPEN
; port_io[5] = OPEN
; port_io[4] = OPEN
; port_io[3] = OPEN
; port_io[2] = OPEN
; port_io[1] = OPEN
; port_io[0] = OPEN
.org #0000h
.code
;-----------------------------------------------------BOOT---------------------------------------------------
; Inicializa ponteiro da pilha para 0x"7FFF" (ultimo endereço no espaço de endereçamento da memoria)
ldh r0, #7Fh
ldl r0, #FFh
ldsp r0
; Inicializa ponteiro da pilha para 0x"03E6" (ultimo endereço no espaço de endereçamento da memoria)
; ldh r0, #03h
; ldl r0, #E6h
; ldsp r0
; Seta endereço do tratador de interrupção
ldh r0, #InterruptionServiceRoutine
ldl r0, #InterruptionServiceRoutine
ldisra r0
; Seta endereço do tratador de traps
ldh r0, #TrapsServiceRoutine
ldl r0, #TrapsServiceRoutine
ldtsra r0
xor r0, r0, r0
; Seta a Mascara do vetor de interrupções (Desabilita todas)
ldl r4, #02h ; Atualiza o indexador para carregar a mascara em arrayPIC
ldh r7, #arrayPIC ; Carrega o endereço para o vetor de interrupções
ldl r7, #arrayPIC ; Carrega o endereço do vetor de interrupções
ld r7, r4, r7 ; &mask
ldh r8, #00h
ldl r8, #00h ; Carrega a Mascara para o PIC [ r8 <= "0000_0000_0000_0000"]
st r8, r0, r7 ; arrayPIC [MASK] <= "xxxx_xxxx_0000_0000"
; Array de registradores do controlador de interrupções
; arrayPIC [ IrqID(0x80F0) | IntACK(0x80F1) | Mask(0x80F2) ]
;arrayPIC: db #80F0h, #80F1h, #80F2h
; r1 <= &arrayPorta
ldh r1, #arrayPorta ; Carrega &Porta
ldl r1, #arrayPorta ; Carrega &Porta
ld r1, r0, r1
xor r4, r4, r4
; Seta todos os bits de PortConfig como entrada
ldl r4, #01h ; Atualiza indexador de arrayPorta [ arrayPorta[r4] -> &PortConfig ]
ldh r5, #FFh ; r5 <= "11111111_11111111"
ldl r5, #FFh ; bits 7 a 0 inicialmente são entrada, espera interrupção
st r5, r1, r4 ; PortConfig <= "11111111_11111111"
; Desabilita interrupções
ldl r4, #03h ; Atualiza indexador de arrayPorta [ arrayPorta[r4] -> &irqtEnable ]
ldh r5, #00h ; r5 <= "00000000_00000000"
ldl r5, #00h ; Habilita a interrupção nos bits 12 a 15
st r5, r1, r4 ; irqtEnable <= "00000000_00000000"
; Desabilita portas
ldl r4, #02h ; Atualiza indexador de arrayPorta [ arrayPorta[r4] -> &PortEnable ]
ldh r5, #00h ; r5 <= "00000000_00000000"
ldl r5, #00h ; Desabilita acesso a todos os bits da porta de I/O
st r5, r1, r4 ; PortEnable <= "00000000_00000000"
; Inicialização dos registradores
xor r0, r0, r0
xor r1, r1, r1
xor r2, r2, r2
xor r3, r3, r3
xor r4, r4, r4
xor r5, r5, r5
xor r6, r6, r6
xor r7, r7, r7
xor r8, r8, r8
xor r9, r9, r9
xor r10, r10, r10
xor r11, r11, r11
xor r12, r12, r12
xor r13, r13, r13
xor r13, r13, r13
xor r14, r14, r14
xor r15, r15, r15
jmpd #main
; END SETUP
;____________________________________________________________________________________________________________
;-----------------------------------------TRATAMENTO DE INTERRUPÇÃO------------------------------------------
InterruptionServiceRoutine:
; 1. Salvamento de contexto
; 2. Ler do PIC o número da IRQ
; 3. Indexar irq_handlers e gravar em algum registrador o endereço do handler
; 4. jsr reg (chama handler)
; 5. Notificar PIC sobre a IRQ tratada
; 6. Recuperação de contexto
; 7. Retorno
;////////////////////////////////////////////////////////////////////////////////////////////////////////////
; port_io[15] = OPEN
; port_io[14] = OPEN
; port_io[13] = OPEN
; port_io[12] = OPEN
; port_io[11] = OPEN
; port_io[10] = OPEN
; port_io[9] = OPEN
; port_io[8] = OPEN
; port_io[7] = OPEN
; port_io[6] = OPEN
; port_io[5] = OPEN
; port_io[4] = OPEN
; port_io[3] = OPEN
; port_io[2] = OPEN
; port_io[1] = OPEN
; port_io[0] = OPEN
;////////////////////////////////////////////////////////////////////////////////////////////////////////////
; Salva Contexto
push r0
push r1
push r2
push r3
push r4
push r5
push r6
push r7
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
pushf
xor r0, r0, r0
xor r4, r4, r4
xor r5, r5, r5
xor r6, r6, r6
; Le ID da interrupção do PIC
; r4 <= IrqID
ldh r4, #arrayPIC
ldl r4, #arrayPIC
ld r4, r0, r4 ; r4 <= &IrqID
ld r4, r0, r4 ; r4 <= IrqID
; r1 <= &interruptVector
ldh r1, #interruptVector
ldl r1, #interruptVector
; r1 <= interruptVector[IrqID]
ld r1, r4, r1
; Jump para handler
jsr r1
; Recupera contexto
popf
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop r7
pop r6
pop r5
pop r4
pop r3
pop r2
pop r1
pop r0
rti
;--------------------------------------------TRATAMENTO DE TRAPS---------------------------------------------
TrapsServiceRoutine:
; 1. Salvamento de contexto
; 2. Ler do reg CAUSE o número da exceção
; 3. Indexar jump table e gravar em algum registrador o endereço do handler
; 4. jsr reg (chama handler)
; 5. Recuperação de contexto
; 6. Retorno
; Salva Contexto
push r0
push r1
push r2
push r3
push r4
push r5
push r6
push r7
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
pushf
; Le ID da trap
; r4 <= registrador de causa
mfc r4
; r5 <= &trapVector
ldh r5, #trapVector
ldl r5, #trapVector
; r5 <= trapVector[trapID]
ld r5, r4, r5
; Jump para handler
jsr r5
; Recupera contexto
popf
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop r7
pop r6
pop r5
pop r4
pop r3
pop r2
pop r1
pop r0
rti
;-------------------------------------------------HANDLERS---------------------------------------------------
irq0Handler: ; OPEN
halt
irq1Handler: ; OPEN
halt
irq2Handler: ; OPEN
halt
irq3Handler: ; OPEN
halt
irq4Handler: ; OPEN
halt
irq5Handler: ; OPEN
halt
irq6Handler: ; OPEN
halt
irq7Handler: ; OPEN
halt
trap0Handler: ; NULL POINTER EXCEPTION
jsrd #NullPointerExceptionDriver
rts
trap1Handler: ; INVALID INSTRUCTION
jsrd #InvalidInstructionDriver
rts
trap2Handler: ; OPEN
halt
trap3Handler: ; OPEN
halt
trap4Handler: ; OPEN
halt
trap5Handler: ; OPEN
halt
trap6Handler: ; OPEN
halt
trap7Handler: ; OPEN
halt
trap8Handler: ; SYSCALL
jsrd #SyscallDriver
rts
trap9Handler: ; OPEN
halt
trap10Handler: ; OPEN
halt
trap11Handler: ; OPEN
halt
trap12Handler: ; OVERFLOW
jsrd #OverflowDriver
rts
trap13Handler: ; OPEN
halt
trap14Handler: ; OPEN
halt
trap15Handler: ; DIVISION BY ZERO
jsrd #DivisionByZeroDriver
rts
syscall0Handler: ; PrintString (Transmits a string through UART TX)
jsrd #PrintString
rts
syscall1Handler: ; IntegerToString (Converts a given decimal value to a ASCII character)
jsrd #IntegerToString
rts
syscall2Handler: ; IntegerToHexString (Converts a given hexadecimal value to a ASCII character)
jsrd #IntegerToHexString
rts
syscall3Handler: ; Delay1ms (Waits for "r2" milliseconds, assumes a clock of 50MHz)
jsrd #Delay1ms
rts
syscall4Handler: ; IntegerToSSD (Converts a given integer (on r2) to Seven Segment Display encoding : abcdefg.)
jsrd #IntegerToSSD
rts
;-------------------------------------------------DRIVERS----------------------------------------------------
NullPointerExceptionDriver:
; Calls PrintError with TrapID = 0
mfc r2
mft r3
jsrd #PrintError
rts
InvalidInstructionDriver:
; Calls PrintError with TrapID = 1
mfc r2
mft r3
jsrd #PrintError
rts
SyscallDriver:
; 1. Ler do reg r1 o número da função solicitada
; 2. Indexar jump table e gravar em algum registrador o endereço da função
; 3. jsr reg (chama função)
; 4. rts
push r0
; r0 <= Jump Table
ldh r0, #syscallJumpTable
ldl r0, #syscallJumpTable
; r0 <= Endereço da função solicitada
ld r0, r1, r0
; PC <= Função Solicitada
jsr r0
pop r0
rts
OverflowDriver:
; Calls PrintErro with TrapID = 12
mfc r2
mft r3
jsrd #PrintError
rts
DivisionByZeroDriver:
; Calls PrintErro with TrapID = 15
mfc r2
mft r3
jsrd #PrintError
rts
;---------------------------------------------FUNÇÕES DO KERNEL----------------------------------------------
PrintError: ; Prints a given error code (on r2) on a given insruction (r3)
; Register Table:
; r2 = ID of trap
; r3 = ADDR of trap causing instruction
; r4 = constant 4
; r5 = Temporary for load/store
; r6 = Indexer for error code string and converted string (intToHex)
; r7 = constant 7
; r8 = constant 8
; Saves context
push r2
push r3
push r4
push r5
push r6
push r7
push r8
; Initializes registers
xor r0, r0, r0
xor r4, r4, r4
xor r5, r5, r5
xor r6, r6, r6
xor r7, r7, r7
xor r8, r8, r8
ldl r4, #4
ldl r7, #7
ldl r8, #8
; r5 <= trap ID in HEXADECIMAL (1 ASCII character)
jsrd #IntegerToHexString
add r5, r0, r14
ld r5, r0, r5
; r2 <= ADDR of trap causing instruction
add r2, r0, r3
; r14 <= ADDR of trap causing instruction in HEXADECIMAL (4 ASCII characters)
jsrd #IntegerToHexString
; Initializes ErrorCode String
ldh r2, #ErrorCode
ldl r2, #ErrorCode
; ErrorCode[7] <= ID of trap
st r5, r2, r7
PrintErrorLoop: ; Copies converted HEX string to ErrorCode string (offsets ConvertedString into ErrorCode by 4)
; If string index = 4, returns, else, inserts another character (r4 is always = 4)
sub r5, r6, r4 ; r5 is treated as temporary, will be used to read values from converted string and storing them into the final string (to be printed)
jmpzd #PrintErrorReturn
; r5 <= Char of ADDR of trap causing instruction[r6]
ld r5, r6, r14
; ErrorCode[r6] <= r5
st r5, r6, r2
; Increments Indexer
addi r6, #1
jmpd #PrintErrorReturn
PrintErrorReturn:
; Transmits Error Code | 7 | 6 5 4 | 3210 |
jsrd #PrintString ; Final string will be: (TrapID) 0 0 0 (ADDR of instruction)
; Return to normal execution flow
pop r8
pop r7
pop r6
pop r5
pop r4
pop r3
pop r2
rts
PrintString: ; Transmite por UART uma string. Espera endereço da string a ser enviada em r2
; Tabela de registradores:
; r1 = Endereço do transmissor serial
; r2 = Endereço da string a ser enviada
; r3 = Indexador da string do inteiro convertido (buffer)
; r5 = Dado a ser transmitido
push r1
push r3
push r5
ldh r1, #UART_TX
ldl r1, #UART_TX
ld r1, r0, r1
xor r0, r0, r0
xor r3, r3, r3
xor r5, r5, r5
tx_loop:
; r5 <= status do tx
ld r5, r0, r1
add r5, r0, r5 ; Gera flag
jmpzd #tx_loop ; Espera transmissor estar disponivel
;jmpzd #tx_disp ; Espera transmissor estar disponivel
;jmpd #tx_loop ; Transmissor indisponivel
tx_disp:
; r5 <= string[r3]
ld r5, r3, r2
add r5, r0, r5 ; Gera flag
; Se string[r3] = 0 (terminador de string), volta para caller
jmpzd #PrintStringReturn
; UART TX <= r5
st r5, r0, r1
; Incrementa indice
addi r3, #1
; Transmite proximo caracter
jmpd #tx_loop
;jmpd #tx_disp
PrintStringReturn:
pop r5
pop r3
pop r1
rts
IntegerToString: ; Espera inteiro a ser convertido em r2, retorna ponteiro para string em r14
; https://stackoverflow.com/questions/7123490/how-compiler-is-converting-integer-to-string-and-vice-versa
; Tabela de registradores:
; r2 = Inteiro a ser convertido
; r3 = Contador de pushes
; r4 = Contador de pops
; r5 = Dado a ser gravado na memoria
; r10 = Constante 10
; r11 = Resto da divisao por 10
push r2
push r3
push r4
push r5
push r10
push r11
xor r0, r0, r0
;xor r2, r2, r2
xor r3, r3, r3
xor r4, r4, r4
xor r10, r10, r10
xor r11, r11, r11
ldl r10, #10
ldh r14, #IntegerToStringBuffer
ldl r14, #IntegerToStringBuffer
addi r3, #07h
; Limpa o buffer
limpaBufferLoop:
; buffer[r3] <= 0
st r0, r3, r14
; Decrementa indice do buffer
subi r3, #01h
; Limpa proxima posição do buffer
jmpnd #IntegerToStringStart
jmpd #limpaBufferLoop
IntegerToStringStart:
xor r3, r3, r3
add r2, r0, r2 ; Gera flag
jmpnd #IntegerToStringNegativo
jmpzd #IntegerToStringZero
jmpd #IntegerToStringPositivo
ConversionLoop:
; r2 <= r2 / 10, r11 <= r2 % 10
div r2, r10
mfh r11
mfl r2
; r11 <= char[r11]
addi r11, #48
; Salva r11 na pilha (string será reordenada)
push r11
; Incrementa contador de pushes
addi r3, #1
; Gera Flag
add r2, r0, r2
jmpzd #ReverseLoop
jmpd #ConversionLoop
ReverseLoop:
pop r5
st r5, r4, r14
addi r4, #1
sub r5, r3, r4
jmpzd #IntegerToStringReturn
jmpd #ReverseLoop
IntegerToStringReturn:
subi r1, #1
pop r11
pop r10
pop r5
pop r4
pop r3
pop r2
rts
IntegerToStringZero:
; r5 <= '0'
ldh r5, #0
ldl r5, #48
; Buffer[0] <= '0'
st r5, r3, r14
; Retorna para caller
pop r11
pop r10
pop r5
pop r4
pop r3
pop r2
;pop r1
rts
IntegerToStringNegativo:
; r2 <= Inteiro a ser convertido passa a ser positivo
not r2, r2
addi r2, #1
; r5 <= '-'
ldh r5, #0
ldl r5, #45
; Grava sinal negativo na primeira posição do buffer
st r5, r0, r14
; Incrementa ponteiro da string
addi r14, #1
; Retorna para codigo de conversão
jmpd #ConversionLoop
IntegerToStringPositivo:
; r5 <= '+'
ldh r5, #0
ldl r5, #43
; Grava sinal positivo na primeira posição do buffer
st r5, r0, r14
; Incrementa ponteiro do buffer
addi r14, #1
; Retorna para codigo de conversão
jmpd #ConversionLoop
IntegerToHexString: ; Espera valor a ser convertido em r2, retorna ponteiro para string em r14
; Tabela de registradores:
; r2 = Inteiro a ser convertido ( 16 bits)
; r3 = Constante 16
; r4 = Numeros a ser Convertidos / Temporário para comparacao
; r5 = Indexador do Buffer
; r6 = Endereço da LUT
; r14 = Endereço do Buffer ( Ponteiro para String)
push r2
push r3
push r4
push r5
push r6
ldh r3, #00h
ldl r3, #10h ; r3 <= (constante)16
xor r5, r5, r5 ; Zera o indexador do Buffer
ldh r6, #IntegerToHexStringLUT
ldl r6, #IntegerToHexStringLUT ; r6 <= & IntegerToHexStringLUT
ldh r14, #IntegerToHexBuffer
ldl r14, #IntegerToHexBuffer ; r11 <= & IntergerToHexBufer
FourBitsConverter:
add r4, r0, r5 ; r4 <= Indexador
subi r4, #04h ; Comparação é verdadeira quando o indexaro for igual a 4
jmpzd #ReturnIntegerToHexString
div r2, r3 ; r2 / 16 ( Divisao por 16 equivale a 4 shifts)
mfl r2 ; r2 <= parte inteira da divisao r2/16
mfh r4 ; r4 <= Resto da divisao r2/16 ( 4 bits)
; Salva em r4 o valor da LUT indexada por r4
ld r4, r4, r6 ; r4 <= IntegerToHexStringLUT[ ( r4 = resto da divisao)]
st r4, r5, r14 ; IntegerToHexBuffer [r5] = r4 ( Numero convertido)
addi r5, #01h ; Incrementa o Indexador
jmpd #FourBitsConverter ; Retoma o Loop
ReturnIntegerToHexString:
pop r6
pop r5
pop r4
pop r3
pop r2
rts
Delay1ms: ; Assumes clk = 50MHz (MIGHT CAUSE PROBELMS IF GIVEN NUMBER IS GREATER THAN 2¹⁵, WHICH IS INTERPRETED AS A NEGATIVE NUMBER)
; Register table
; r2 = Number of milliseconds to hold in this function
; r4 = Loop iterator
push r2
push r4
; Iterador do loop de 1ms <= 2500
ldh r4, #09h
ldl r4, #C4h
Delay1msloop: ; Repete 2500 vezes, 20 ciclos
subi r4, #1 ; 4 ciclos
nop ; 7 ciclos
nop ; 10 ciclos
nop ; 13 ciclos
jmpzd #Delay1msloopExit ; 16 ciclos
jmpd #Delay1msloop ; 20 ciclos
Delay1msloopExit:
subi r2, #1
jmpzd #Delay1msReturn
jmpd #Delay1msloop
Delay1msReturn:
pop r4
pop r2
rts
IntegerToSSD: ; Returns on r14 given integer (on r2) encoded for 7 Segment Display (abcdefg.)
; Register table
; r1 = Address of Look Up Table for conversion
; r2 = Integer to be encoded
; r14 = Encoded integer
push r1
xor r1, r1, r1
xor r14, r14, r14
; r1 <= &arraySSD
ldh r1, #arraySSD
ldl r1, #arraySSD
; r14 <= arraySSD[r2]
ld r14, r1, r2
pop r1
rts
;------------------------------------------- PROGRAMA PRINCIPAL ---------------------------------------------
main:
ForçaExceçaoAdd:
ldh r5, #7Fh
ldl r5, #FFh
add r5, r5, r5
; Delays for 100 ms
ldh r1, #0
ldl r1, #3
push r2
ldh r2, #0
ldl r2, #100
syscall
pop r2
ForçaExceçaoAddi:
ldh r5, #7Fh
ldl r5, #FFh
addi r5, #1
; Delays for 100 ms
ldh r1, #0
ldl r1, #3
push r2
ldh r2, #0
ldl r2, #100
syscall
pop r2
ForçaExceçaoSub:
ldh r4, #FFh
ldl r4, #FFh
ldh r5, #FFh
ldl r5, #FFh
sub r5, r4, r5
; Delays for 100 ms
ldh r1, #0
ldl r1, #3
push r2
ldh r2, #0
ldl r2, #100
syscall
pop r2
ForçaExceçaoSubi:
ldh r5, #FFh
ldl r5, #FFh
subi r5, #1
; Delays for 100 ms
ldh r1, #0
ldl r1, #3
push r2
ldh r2, #0
ldl r2, #100
syscall
pop r2
halt
.endcode
;=============================================================================================================
;=============================================================================================================
;=============================================================================================================
;=============================================================================================================
;=============================================================================================================
.org #0258h
.data
;--------------------------------------------VARIAVEIS DO KERNEL---------------------------------------------
; Array de registradores da Porta Bidirecional
; arrayPorta [ PortData(0x8000) | PortConfig(0x8001) | PortEnable(0x8002) | irqtEnable(0x8003) ]
arrayPorta: db #8000h, #8001h, #8002h, #8003h
; Array de registradores do controlador de interrupções
; arrayPIC [ IrqID(0x80F0) | IntACK(0x80F1) | Mask(0x80F2) ]
arrayPIC: db #80F0h, #80F1h, #80F2h
; Endereço do transmissor serial
UART_TX: db #8080h
; Vetor com tratadores de interrupção
interruptVector: db #irq0Handler, #irq1Handler, #irq2Handler, #irq3Handler, #irq4Handler, #irq5Handler, #irq6Handler, #irq7Handler
; Vetor com tratadores de traps
trapVector: db #trap0Handler, #trap1Handler, #trap2Handler, #trap3Handler, #trap4Handler, #trap5Handler, #trap6Handler, #trap7Handler, #trap8Handler, #trap9Handler, #trap10Handler, #trap11Handler, #trap12Handler, #trap13Handler, #trap14Handler, #trap15Handler,
; Vetor com endereços das chamadas de sistema
syscallJumpTable: db #syscall0Handler, #syscall1Handler, #syscall2Handler, #syscall3Handler, #syscall4Handler
; IntegerToString
IntegerToStringBuffer: db #0, #0, #0, #0, #0, #0, #0, #0
; IntegerToHexString Look Up Table (returns indexer value in HEXADECIMAL IN UPPERCASE)
; 0 1 2 3 4 5 6 7 8 9 A B C D E F
IntegerToHexStringLUT: db #48, #49, #50, #51, #52, #53, #54, #55, #56, #57, #65, #66, #67, #68, #69, #70
IntegerToHexBuffer: db #0, #0, #0, #0
; Buffer para transmissao de codigo de erro (8 chars + string trailer)
ErrorCode: db #0, #0, #0, #0, #0, #0, #0, #0, #0
; Primeira posição deve ser o caracter a ser enviado, segunda posição deve ser o terminador de string
CharString: db #0, #0
; array SSD representa o array de valores a serem postos nos displays de sete seg
;| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
arraySSD: db #03h, #9fh, #25h, #0dh, #99h, #49h, #41h, #1fh, #01h, #09h
; | D | E | L | A | Y | /0 |
stringDelay: db #68, #69, #76, #65, #89, #0
; String contendo caracteres de nova linha e carriage return
stringNovaLinha: db #10, #13, #0
;-------------------------------------------VARIAVEIS DE APLICAÇÃO-------------------------------------------
; Array para aplicação principal (Bubble Sort) de 50 elementos
arraySort: db #0050h, #0049h, #0048h, #0047h, #0046h, #0045h, #0044h, #0043h, #0042h, #0041h, #0040h, #0039h, #0038h, #0037h, #0036h, #0035h, #0034h, #0033h, #0032h, #0031h, #0030h, #0029h, #0028h, #0027h, #0026h, #0025h, #0024h, #0023h, #0022h, #0021h, #0020h, #0019h, #0018h, #0017h, #0016h, #0015h, #0014h, #0013h, #0012h, #0011h, #0010h, #0009h, #0008h, #0007h, #0006h, #0005h, #0004h, #0003h, #0002h, #0001h
; Tamanho do array p/ bubble sort (50 elementos)
arraySortSize: db #50
.enddata
|
programs/oeis/063/A063492.asm
|
neoneye/loda
| 22 |
12015
|
; A063492: a(n) = (2*n - 1)*(11*n^2 - 11*n + 6)/6.
; 1,14,60,161,339,616,1014,1555,2261,3154,4256,5589,7175,9036,11194,13671,16489,19670,23236,27209,31611,36464,41790,47611,53949,60826,68264,76285,84911,94164,104066,114639,125905,137886,150604,164081,178339,193400,209286,226019,243621,262114,281520,301861,323159,345436,368714,393015,418361,444774,472276,500889,530635,561536,593614,626891,661389,697130,734136,772429,812031,852964,895250,938911,983969,1030446,1078364,1127745,1178611,1230984,1284886,1340339,1397365,1455986,1516224,1578101,1641639,1706860,1773786,1842439,1912841,1985014,2058980,2134761,2212379,2291856,2373214,2456475,2541661,2628794,2717896,2808989,2902095,2997236,3094434,3193711,3295089,3398590,3504236,3612049
lpb $0
mov $2,$0
sub $0,1
add $1,10
seq $2,158689 ; a(n) = 66*n^2 + 1.
add $1,$2
add $1,1
lpe
div $1,6
add $1,1
mov $0,$1
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_1469.asm
|
ljhsiun2/medusa
| 9 |
84515
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r13
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x13688, %r13
nop
nop
nop
mfence
mov $0x6162636465666768, %rbp
movq %rbp, (%r13)
nop
nop
nop
nop
nop
xor $27018, %rsi
lea addresses_A_ht+0xe048, %r10
add $45634, %rdi
movw $0x6162, (%r10)
nop
nop
and $40759, %r13
lea addresses_D_ht+0x1d830, %r12
nop
and $56496, %r11
mov $0x6162636465666768, %rdi
movq %rdi, %xmm5
movups %xmm5, (%r12)
nop
nop
nop
nop
xor $33246, %r12
lea addresses_normal_ht+0x11a08, %rsi
lea addresses_A_ht+0x62c2, %rdi
nop
nop
nop
inc %r12
mov $83, %rcx
rep movsw
nop
nop
nop
and $47652, %rcx
lea addresses_A_ht+0x19dc8, %rsi
lea addresses_D_ht+0xcec8, %rdi
nop
nop
cmp $48324, %rbp
mov $108, %rcx
rep movsb
nop
nop
and $40398, %r12
lea addresses_UC_ht+0x16c73, %rbp
nop
nop
nop
nop
nop
inc %r13
mov (%rbp), %r11
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_WT_ht+0x17d88, %rsi
inc %rbp
movw $0x6162, (%rsi)
nop
inc %rbp
lea addresses_A_ht+0x10438, %r13
nop
add %rsi, %rsi
mov $0x6162636465666768, %rbp
movq %rbp, %xmm5
movups %xmm5, (%r13)
nop
nop
nop
nop
nop
and $7576, %r10
lea addresses_UC_ht+0x4688, %r11
nop
nop
nop
nop
add $47912, %rcx
movl $0x61626364, (%r11)
nop
nop
nop
nop
and $40871, %rcx
lea addresses_D_ht+0xc250, %r10
nop
nop
nop
nop
sub %r13, %r13
mov (%r10), %edi
sub $13637, %rbp
lea addresses_D_ht+0x1c7c8, %rsi
lea addresses_D_ht+0x18da, %rdi
cmp $55869, %r11
mov $72, %rcx
rep movsl
nop
nop
nop
cmp $50168, %rsi
lea addresses_UC_ht+0x15708, %rbp
nop
nop
nop
xor %rdi, %rdi
movl $0x61626364, (%rbp)
add $40937, %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r13
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %rax
push %rdi
// Faulty Load
lea addresses_WC+0xd408, %r11
cmp %r14, %r14
movaps (%r11), %xmm5
vpextrq $0, %xmm5, %rax
lea oracles, %r13
and $0xff, %rax
shlq $12, %rax
mov (%r13,%rax,1), %rax
pop %rdi
pop %rax
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_UC_ht'}}
{'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
*/
|
contrib/opensigcomp/src/Deflate.asm
|
dulton/reSipServer
| 1 |
104737
|
<gh_stars>1-10
; ***********************************************************************
; Open SigComp -- Implementation of RFC 3320 Signaling Compression
;
; Copyright 2005 Estacado Systems, LLC
;
; Your use of this code is governed by the license under which it
; has been provided to you. Unless you have a written and signed
; document from Estacado Systems, LLC stating otherwise, your license
; is as provided by the GNU General Public License version 2, a copy
; of which is available in this project in the file named "LICENSE."
; Alternately, a copy of the licence is available by writing to
; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
; Boston, MA 02110-1307 USA
;
; Unless your use of this code is goverened by a written and signed
; contract containing provisions to the contrary, this program is
; distributed WITHOUT ANY WARRANTY; without even the implied warranty
; of MERCHANTABILITY of FITNESS FOR A PARTICULAR PURPOSE. See the
; license for additional details.
;
; To discuss alternate licensing terms, contact <EMAIL>
; ***********************************************************************
; Useful values
:uv_memory_size pad (2)
:uv_cycles_per_bit pad (2)
:uv_sigcomp_version pad (2)
:uv_parial_state_id_len pad (2)
:uv_state_length pad (2)
at (32)
:index pad (2)
:extra_length_bits pad (2)
:length_value pad (2)
:extra_distance_bits pad (2)
:distance_value pad (2)
:temp pad (2)
:state_length pad (2)
at (64)
set(state_address, byte_copy_left)
:byte_copy_left pad (2)
:byte_copy_right pad (2)
:input_bit_order pad (2)
:decompressed_pointer pad (2)
:length_table pad (116)
:distance_table pad (120)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Requested feedback
; The requested feedback conveys information back about
; which messages have been sucessfully decompressed.
:requested_feedback_location pad (2)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Returned feedback
; The returned parameters tell what our capabilities are
set (returned_parameters_location, cpb_dms_sms)
:cpb_dms_sms pad (1)
:sigcomp_version pad (1)
:sip_state_id_length pad (1)
:sip_state_id pad (6)
align (64)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Set up initial values
:initialize_memory
set (length_table_start, (((length_table - 4) / 4) + 16384))
set (length_table_mid, (length_table_start + 24))
set (distance_table_start, (distance_table / 4))
MULTILOAD (64, 124, circular_buffer, 0, 0,
circular_buffer,
; Length Table
0, 3, 0, 4, 0, 5,
0, 6, 0, 7, 0, 8,
0, 9, 0, 10, 1, 11,
1, 13, 1, 15, 1, 17,
2, 19, 2, 23, 2, 27,
2, 31, 3, 35, 3, 43,
3, 51, 3, 59, 4, 67,
4, 83, 4, 99, 4, 115,
5, 131, 5, 163, 5, 195,
5, 227, 0, 258,
; Distance Table
0, 1, 0, 2, 0, 3,
0, 4, 1, 5, 1, 7,
2, 9, 2, 13, 3, 17,
3, 25, 4, 33, 4, 49,
5, 65, 5, 97, 6, 129,
6, 193, 7, 257, 7, 385,
8, 513, 8, 769, 9, 1025,
9, 1537, 10, 2049, 10, 3073,
11, 4097, 11, 6145, 12, 8193,
12, 12289, 13, 16385, 13, 24577,
; Requested Feedback
0x0400,
; Sigcomp Version
2
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Load in capabilities from input stream
INPUT-BYTES(1, cpb_dms_sms, !)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Read flag: is SIP SigComp dictionary being advertized?
:decompress_sigcomp_message
INPUT-BITS(1, sip_state_id_length, !)
COMPARE($sip_state_id_length, 0, !, set_buffer_size, load_sip_dict_id)
:load_sip_dict_id
MULTILOAD(sip_state_id_length, 4, 0x06FB, 0xE507, 0xDFE5, 0xE600)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Read in buffer size and set up circular buffer
:set_buffer_size
LOAD(byte_copy_right, 512)
INPUT-BITS(3, temp, !)
LSHIFT($byte_copy_right, $temp)
ADD($byte_copy_right, circular_buffer)
LOAD(state_length, $byte_copy_right)
SUBTRACT($state_length, state_address)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Read in serial number
INPUT-BITS (4, requested_feedback_location, !)
OR ($requested_feedback_location, 0x0400)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Here starts the loop to read in deflated data
:next_character
INPUT-HUFFMAN (index, end_of_message, 4,
7, 0, 23, length_table_start,
1, 48, 191, 0,
0, 192, 199, length_table_mid,
1, 400, 511, 144)
COMPARE ($index, length_table_start, literal, end_of_message,
length_distance)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Output a literal byte value
:literal
set (index_lsb, (index + 1))
OUTPUT (index_lsb, 1)
COPY-LITERAL (index_lsb, 1, $decompressed_pointer)
JUMP (next_character)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Output the result of a length/value pair
:length_distance
; this is the length part
MULTIPLY ($index, 4)
COPY ($index, 4, extra_length_bits)
INPUT-BITS ($extra_length_bits, extra_length_bits, !)
ADD ($length_value, $extra_length_bits)
; this is the distance part
INPUT-BITS(5, index, !)
ADD($index, distance_table_start)
MULTIPLY ($index, 4)
COPY ($index, 4, extra_distance_bits)
INPUT-BITS ($extra_distance_bits, extra_distance_bits, !)
ADD ($distance_value, $extra_distance_bits)
LOAD (index, $decompressed_pointer)
COPY-OFFSET ($distance_value, $length_value, $decompressed_pointer)
OUTPUT ($index, $length_value)
JUMP (next_character)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Indicate that message is complete
:end_of_message
END-MESSAGE (requested_feedback_location,
returned_parameters_location,
$state_length,
state_address,
decompress_sigcomp_message,
6,
0)
:circular_buffer
|
programs/oeis/175/A175630.asm
|
neoneye/loda
| 22 |
177145
|
<reponame>neoneye/loda<filename>programs/oeis/175/A175630.asm
; A175630: a(n) = n-th pentagonal number mod (n+2).
; 0,1,1,2,4,0,3,7,2,7,1,7,0,7,15,7,16,7,17,7,18,7,19,7,20,7,21,7,22,7,23,7,24,7,25,7,26,7,27,7,28,7,29,7,30,7,31,7,32,7,33,7,34,7,35,7,36,7,37,7,38,7,39,7,40,7,41,7,42,7,43,7,44,7,45,7,46,7,47,7,48,7,49,7,50,7,51,7,52,7,53,7,54,7,55,7,56,7,57,7
mov $1,$0
add $0,2
sub $1,1
bin $1,2
add $1,1
mod $1,$0
mov $0,$1
|
oeis/021/A021997.asm
|
neoneye/loda-programs
| 11 |
86162
|
; A021997: Decimal expansion of 1/993.
; Submitted by <NAME>
; 0,0,1,0,0,7,0,4,9,3,4,5,4,1,7,9,2,5,4,7,8,3,4,8,4,3,9,0,7,3,5,1,4,6,0,2,2,1,5,5,0,8,5,5,9,9,1,9,4,3,6,0,5,2,3,6,6,5,6,5,9,6,1,7,3,2,1,2,4,8,7,4,1,1,8,8,3,1,8,2,2,7,5,9,3,1,5,2,0,6,4,4,5,1,1,5,8,1,0
add $0,1
mov $2,10
pow $2,$0
div $2,993
mov $0,$2
mod $0,10
|
qrogue/game/world/dungeon_generator/QrogueDungeon.g4
|
7Magic7Mike7/Qrogue
| 4 |
2937
|
grammar QrogueDungeon;
// RULES
start : HEADER (NAME '=' TEXT)?
robot layout rooms hallways stv_pools reward_pools messages
ENDER;
integer : DIGIT | HALLWAY_ID | INTEGER ;
complex_number : SIGN? (IMAG_NUMBER | (integer | FLOAT) (SIGN IMAG_NUMBER)?) ;
robot: ROBOT DIGIT 'qubits' '[' REFERENCE (LIST_SEPARATOR REFERENCE)* ']' ;
// building the layout of the dungeon
layout : LAYOUT HORIZONTAL_SEPARATOR* l_room_row (l_hallway_row l_room_row)* HORIZONTAL_SEPARATOR* ;
l_room_row : VERTICAL_SEPARATOR
(ROOM_ID | EMPTY_ROOM) ((HALLWAY_ID | EMPTY_HALLWAY) (ROOM_ID | EMPTY_ROOM))*
VERTICAL_SEPARATOR ;
l_hallway_row : VERTICAL_SEPARATOR
(HALLWAY_ID | EMPTY_HALLWAY)+
VERTICAL_SEPARATOR ;
// building the non-template rooms used in the layout (note: template rooms are pre-defined rooms)
rooms : ROOMS room* ;
room : ROOM_ID r_attributes ':' WALL* r_row+ WALL* tile_descriptor* ;
r_attributes : '(' r_visibility r_type ')' ; // visibile/in sight, type
r_visibility : (VISIBLE_LITERAL | FOGGY_LITERAL)? ;
r_type : (SPAWN_LITERAL | BOSS_LITERAL | WILD_LITERAL | SHOP_LITERAL | RIDDLE_LITERAL | GATE_ROOM_LITERAL |
TREASURE_LITERAL) ;
r_row : WALL tile+ WALL ;
tile : 'o' | 't' | 'm' | DIGIT | 'c' | 'e' | 'r' | '$' | '_' ; // obstacle, trigger, message, enemy, collectible,
// energy, riddle, shop, floor
// further describing the tiles used in the room
tile_descriptor : (trigger_descriptor | message_descriptor |
enemy_descriptor | collectible_descriptor | energy_descriptor | riddle_descriptor | shop_descriptor)
(TUTORIAL_LITERAL REFERENCE)? (TRIGGER_LITERAL REFERENCE)? ; // winning a fight or picking up a collectible can also trigger an event
trigger_descriptor : 't' REFERENCE ; // reference to the event to trigger
message_descriptor : 'm' integer? REFERENCE ; // #times displayed, reference to the text that should be shown
enemy_descriptor : DIGIT REFERENCE REFERENCE?; // enemy, id of statevector pool, id of reward pool
collectible_descriptor : 'c' REFERENCE integer? ; // id of reward pool to draw from, number of rewards to draw (note: template pools like *key provide "normal" collectibles)
energy_descriptor : 'e' integer ; // amount
riddle_descriptor : 'r' (REFERENCE | stv) (REFERENCE | collectible) integer; // stv pool id, reward pool id, attempts
shop_descriptor : '$' (REFERENCE | collectibles) integer ; // reward pool id or collectible list, num of items to draw
// describing the hallways used in the layout (except for the default one '==')
hallways : HALLWAYS hallway*;
hallway : HALLWAY_ID h_attributes ;
h_attributes : '(' (OPEN_LITERAL | CLOSED_LITERAL | LOCKED_LITERAL | EVENT_LITERAL REFERENCE)
('one way' DIRECTION PERMANENT_LITERAL?)?
('entangled' '[' HALLWAY_ID (LIST_SEPARATOR HALLWAY_ID)* ']')? ')'
(TUTORIAL_LITERAL REFERENCE)? (TRIGGER_LITERAL REFERENCE)? ;
// how to draw an element from a pool
draw_strategy : RANDOM_DRAW | ORDERED_DRAW ; // default is random draw, because mostly we don't want to have to explicitely define it
stv_pools : STV_POOLS ('custom' stv_pool+)? 'default' default_stv_pool ; // default pools are for enemies without defined pools
default_stv_pool : REFERENCE | draw_strategy? stvs ;
stv_pool : REFERENCE draw_strategy? stvs ('default' 'rewards' ':' REFERENCE)?; // id of pool, list of statevectors, id of default reward pool
stvs : '[' stv (LIST_SEPARATOR stv)* ']' ;
stv : '[' complex_number (LIST_SEPARATOR complex_number)* ']';
reward_pools : REWARD_POOLS ('custom' reward_pool+)? 'default' default_reward_pool ; // default pools are for enemies without defined pools
default_reward_pool : REFERENCE | draw_strategy? collectibles ; // the default pool can either be an ID or a list of collectibles
reward_pool : REFERENCE draw_strategy? collectibles ; // id, pool of collectibles
collectibles : '[' collectible (LIST_SEPARATOR collectible)* ']' ;
collectible : (KEY_LITERAL integer | COIN_LITERAL integer | ENERGY_LITERAL integer | GATE_LITERAL REFERENCE |
QUBIT_LITERAL integer?) ;
messages : MESSAGES message* ;
message : REFERENCE TEXT+ (EVENT_LITERAL REFERENCE ALTERNATIVE_LITERAL REFERENCE)? ; // alternative message if a certain event already happened
// TOKEN
// Characters implicitely used for special purposes:
// [ ] for highlighting headlines and grouping lists
// < > to mark the beginning and the end of the dungeon
// _ single: Floor-tile | double: to mark the use of predefined template rooms or hallways
// . double: is used for an empty field in the map layout, in combination with digits or characters as comma for floats or tile descriptor
// = double: is used for the non-existing hallway
// ~ | # separators for Layout and Rooms for visual indications
// : to mark the beginning of a room's content
// + - signs for numbers
// ; optical separation, e.g. can be use to separate things without a new line
// * marks the beginning of a pool id (inspired by pointers)
// general token
DIGIT : [0-9] ;
INTEGER : DIGIT DIGIT DIGIT+ ;
FLOAT : DIGIT? '.' DIGIT+ ;
IMAG_NUMBER : (DIGIT* | FLOAT) 'j' ;
SIGN : PLUS_SIGN | MINUS_SIGN ;
CHARACTER_LOW : [a-z] ;
CHARACTER_UP : [A-Z] ;
CHARACTER : CHARACTER_LOW | CHARACTER_UP ;
TEXT : '"' .*? '"' ;
// literals
VISIBLE_LITERAL : 'visible' ;
FOGGY_LITERAL : 'foggy' ;
OPEN_LITERAL : 'open' ;
CLOSED_LITERAL : 'closed' ;
LOCKED_LITERAL : 'locked' ;
EVENT_LITERAL : 'event' ;
PERMANENT_LITERAL: 'permanent' ;
SPAWN_LITERAL : 'Spawn' ;
WILD_LITERAL : 'Wild' ;
SHOP_LITERAL : 'Shop' ;
RIDDLE_LITERAL : 'Riddle' ;
BOSS_LITERAL : 'Boss' ;
GATE_ROOM_LITERAL : 'Gate' ;
TREASURE_LITERAL : 'Treasure' ;
TUTORIAL_LITERAL : 'tutorial' ;
TRIGGER_LITERAL : 'trigger' ;
KEY_LITERAL : 'key' ;
COIN_LITERAL : 'coin' ;
ENERGY_LITERAL : 'energy' ;
GATE_LITERAL : 'gate' ;
QUBIT_LITERAL : 'qubit' ;
ALTERNATIVE_LITERAL : 'alternative' ;
PLUS_SIGN : '+' ;
MINUS_SIGN : '-' ;
// headline token
HEADER : 'Qrogue<' ;
ENDER : '>Qrogue' ;
NAME : 'Name' ;
ROBOT : '[Robot]' ;
LAYOUT : '[Layout]' ;
ROOMS : '[Custom Rooms]' ;
HALLWAYS : '[Hallways]' ;
STV_POOLS : '[StateVector Pools]' ;
REWARD_POOLS : '[Reward Pools]' ;
MESSAGES : '[Messages]' ;
// optical separators
HORIZONTAL_SEPARATOR : '~' ;
VERTICAL_SEPARATOR : '|' ;
LIST_SEPARATOR : ',' ;
WALL : '#' ;
EMPTY_HALLWAY : '..' ;
EMPTY_ROOM : '__' ;
// keywords
DIRECTION : 'North' | 'East' | 'South' | 'West' ;
ORDERED_DRAW : 'ordered' ;
RANDOM_DRAW : 'random' ;
// ids
ROOM_ID : ('_' | CHARACTER) CHARACTER ;
HALLWAY_ID : '==' | ('_' | DIGIT) DIGIT ; // '==' default (closed, no entanglement), same as _1 but with better visuals
REFERENCE : '*' (CHARACTER | DIGIT)+ ;
// ignored characters (whitespace and comments)
WS : [ \t\r\n]+ -> skip ;
UNIVERSAL_SEPARATOR : ';'+ -> skip ;
COMMENT : '/*' .*? '*/' -> skip ;
LINE_COMMENT : '//' ~[\r\n]* -> skip ;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1493.asm
|
ljhsiun2/medusa
| 9 |
99709
|
<reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1cec6, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
and $64412, %r8
mov (%rdi), %r14w
cmp $23606, %r10
lea addresses_WT_ht+0x47c6, %rsi
lea addresses_normal_ht+0x1b41e, %rdi
nop
sub %rbp, %rbp
mov $56, %rcx
rep movsb
nop
nop
inc %rcx
lea addresses_WC_ht+0x1c7c6, %r8
nop
nop
nop
nop
cmp %r10, %r10
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
and $0xffffffffffffffc0, %r8
movaps %xmm3, (%r8)
dec %rsi
lea addresses_UC_ht+0x14076, %rbp
nop
and %rsi, %rsi
movups (%rbp), %xmm3
vpextrq $1, %xmm3, %r8
nop
nop
and %r14, %r14
lea addresses_UC_ht+0x544e, %rsi
lea addresses_WC_ht+0x101c6, %rdi
clflush (%rdi)
nop
nop
nop
cmp %rbx, %rbx
mov $81, %rcx
rep movsl
nop
nop
nop
nop
nop
xor %rbx, %rbx
lea addresses_WC_ht+0x1e5c6, %rdi
nop
nop
nop
sub $30072, %rbx
mov $0x6162636465666768, %r14
movq %r14, %xmm1
movups %xmm1, (%rdi)
add $28218, %rdi
lea addresses_WC_ht+0xed0e, %rsi
clflush (%rsi)
nop
nop
nop
nop
nop
cmp $17028, %rdi
movb $0x61, (%rsi)
nop
nop
nop
nop
and %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r8
push %rbx
push %rcx
push %rdi
// Store
lea addresses_WC+0x7846, %rbx
nop
nop
nop
nop
inc %r11
movw $0x5152, (%rbx)
nop
nop
inc %r8
// Store
lea addresses_WT+0xa1c6, %r11
nop
nop
nop
nop
inc %rcx
movl $0x51525354, (%r11)
nop
cmp $37767, %rdi
// Store
lea addresses_D+0x1ebc6, %rcx
nop
nop
nop
nop
nop
cmp $55880, %r15
mov $0x5152535455565758, %r11
movq %r11, %xmm0
movups %xmm0, (%rcx)
sub $37726, %r14
// Faulty Load
lea addresses_normal+0x1e7c6, %r15
clflush (%r15)
nop
xor $51242, %rcx
mov (%r15), %r11d
lea oracles, %rdi
and $0xff, %r11
shlq $12, %r11
mov (%rdi,%r11,1), %r11
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': True, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 9}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_normal', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 11}, 'dst': {'same': True, 'type': 'addresses_normal_ht', 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': True, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'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
*/
|
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_20597_1656.asm
|
ljhsiun2/medusa
| 9 |
9234
|
<reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %rbp
push %rdi
lea addresses_D_ht+0x18c9b, %rbp
clflush (%rbp)
nop
nop
xor $50054, %r14
movups (%rbp), %xmm4
vpextrq $0, %xmm4, %rdi
nop
nop
nop
nop
dec %r10
pop %rdi
pop %rbp
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r8
push %r9
push %rbx
push %rcx
push %rdx
// Load
lea addresses_UC+0xbcdb, %r9
nop
nop
nop
xor %r14, %r14
movups (%r9), %xmm1
vpextrq $1, %xmm1, %rdx
add %r8, %r8
// Load
lea addresses_WC+0x525b, %r11
nop
nop
nop
and $17738, %rcx
mov (%r11), %dx
nop
nop
cmp $36677, %r9
// Store
lea addresses_WT+0xb35b, %r8
and $43834, %rcx
movb $0x51, (%r8)
nop
nop
nop
sub %rcx, %rcx
// Store
mov $0x8db, %r8
nop
nop
nop
add $44295, %r11
mov $0x5152535455565758, %r9
movq %r9, %xmm4
movups %xmm4, (%r8)
sub $33376, %rbx
// Store
lea addresses_UC+0x1e7db, %r9
nop
and $44777, %r14
mov $0x5152535455565758, %rbx
movq %rbx, (%r9)
nop
nop
nop
cmp $5996, %r11
// Load
lea addresses_UC+0x1ce4b, %r9
nop
nop
nop
and %rdx, %rdx
movups (%r9), %xmm5
vpextrq $1, %xmm5, %rbx
nop
and $10792, %rbx
// Faulty Load
lea addresses_UC+0x10cdb, %r9
nop
nop
xor $61605, %rbx
mov (%r9), %rcx
lea oracles, %r14
and $0xff, %rcx
shlq $12, %rcx
mov (%r14,%rcx,1), %rcx
pop %rdx
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'00': 20597}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
oeis/122/A122112.asm
|
neoneye/loda-programs
| 11 |
160498
|
<filename>oeis/122/A122112.asm
; A122112: a(n) = 4*a(n-2) - a(n-1), with a(0)=1, a(1)=-2.
; Submitted by <NAME>(s2)
; 1,-2,6,-14,38,-94,246,-622,1606,-4094,10518,-26894,68966,-176542,452406,-1158574,2968198,-7602494,19475286,-49885262,127786406,-327327454,838473078,-2147782894,5501675206,-14092806782,36099507606,-92470734734,236868765158,-606751704094,1554226764726,-3981233581102,10198140640006,-26123074964414,66915637524438,-171407937382094,439070487479846,-1124702237008222,2880984186927606,-7379793134960494,18903729882670918,-48422902422512894,124037821953196566,-317729431643248142,813880719456034406
mov $3,1
lpb $0
sub $0,1
mul $3,2
mov $2,$3
mov $3,$1
add $1,$2
sub $3,$2
lpe
mov $0,$3
|
programs/oeis/093/A093380.asm
|
neoneye/loda
| 22 |
160394
|
<gh_stars>10-100
; A093380: Expansion of (1+4x+x^2-10x^3)/((1-x)(1-x-2x^2)).
; 1,6,14,22,46,86,174,342,686,1366,2734,5462,10926,21846,43694,87382,174766,349526,699054,1398102,2796206,5592406,11184814,22369622,44739246,89478486,178956974,357913942,715827886,1431655766,2863311534
mov $1,2
pow $1,$0
div $1,3
mul $1,4
add $1,5
lpb $0
trn $0,$1
mul $1,2
lpe
sub $1,4
mov $0,$1
|
kernel3.asm
|
paule32/selfmade_os
| 0 |
1723
|
; ------------------------------------------------------------------------------
; Copyright (c) 2020 <NAME> - paule32 - non-profit
; all rights reserved.
; for non-commercial use only!
;
; Function: kernel boot
; Filename: kernel3.asm
; ------------------------------------------------------------------------------
[BITS 16]
org 0x8000 ; code start address
RealMode:
xor ax, ax ; setup segments
mov es, ax
mov ds, ax
mov ss, ax
mov sp, ax
add sp, -0x40 ; make room for input buffer (64 chars)
loop_start:
mov si, prompt ; show prompt
call print_string
mov di, sp ; get input
call get_string
jcxz loop_start ; blank line? -> yes, ignore it
mov si, sp
mov di, cmd_hi ; "hi" command"
call strcmp
je .helloworld
mov si, sp
mov di, cmd_help ; "help" command
call strcmp
je .help
mov si, sp
mov di, cmd_exit ; "exit" command
call strcmp
je .exit
mov si, sp
mov di, cmd_pm ; "pm" (protected mode) command
call strcmp
je .pm
mov si, msg_badcommand ; unknow command
call print_string
jmp loop_start
.helloworld:
mov si, msg_helloworld
call print_string
jmp loop_start
.help:
mov si, msg_help
call print_string
jmp loop_start
.exit:
mov si, msg_exit
call print_string
xor ax, ax
int 0x16 ; wait for keystroke
jmp 0xffff:0x0000 ; reboot
.pm:
call clrscr
mov si, msg_pm
call print_string
call Waitingloop
cli ; clear interrupts
lgdt [gdtr] ; load gdt via gdtr (see file: gtd.asm)
; we actually only need to do this ONCE, but for now it doesn't hurt to do this more often when
; switching between RM and PM
in al, 0x92 ; switch A20 gate via fast A20 port 92
cmp al, 0xff ; if it reads 0xff, nothing's implemented on this port
je .no_fast_A20
or al, 2 ; set A20 gate bit (bit: 1)
and al, -1 ; clear init_now bit (don't reset pc ,,,)
out 0x92, al
jmp .A20_done
.no_fast_A20: ; no fast shortcut -> use the slow kbc ...
call empty_8042
mov al, 0xd1 ; kbc command: write to output port
out 0x64, al
call empty_8042
mov al, 0xdf ; writing this to kbc output port enables A20
out 0x60, al
call empty_8042
.A20_done:
mov eax, cr0 ; switch over to protected mode
or eax, 1 ; set bit 0 of cr0 register
mov cr0, eax ;
jmp 0x8:ProtectedMode ; http://www.nasm.us/doc/nasmdo10.html#section-10.1
empty_8042:
call Waitingloop
in al, 0x64
cmp al, 0xff ; .. no real kbc at all?
je .done
test al, 1 ; something in input buffer
jz .no_output
call Waitingloop
in al, 0x60 ; yes, read buffer
jmp empty_8042 ; and try again
.no_output:
test al, 2 ; command buffer empty?
jnz empty_8042 ; no, we can't send anything new till it's empty
.done:
ret
print_string:
mov ah, 0x0e
.loop_start:
lodsb ; grab a byte from si
test al, al ; test al
jz .done ; if the result is zero, get out
int 0x10
jmp .loop_start
.done:
ret
get_string:
xor cx, cx
.loop_start:
xor ax, ax
int 0x16 ; wait for keypress
cmp al, 8 ; backspace pressed?
je .backspace ; yes, handle it
cmp al, 13 ; enter pressed?
je .done ; yes, we are done
cmp cl, 63 ; 63 chars inputted?
je .loop_start ; yes, only let in backspace and enter
mov ah, 0x0e ;
int 0x10 ; print character
stosb ; put char in buffer
inc cx
jmp .loop_start
.backspace:
jcxz .loop_start ; zero? (start of the string) if yes, ignore the key
dec di
mov byte [di], 0 ; delete char
dec cx ; decrement counter as well
mov ah, 0x0e
int 0x10 ; backspace on the screen
mov al, ' ' ;
int 0x10 ; blank char out
mov al, 8
int 0x10 ; backspace again
jmp .loop_start ; go to the main loop
.done:
mov byte [di], 0 ; null terminate
mov ax, 0x0e0d
int 0x10
mov al, 0x0a
int 0x10 ; new line
ret
strcmp:
.loop_start:
mov al, [si] ; grab a byte from si register
cmp al, [di] ; are si and di equal?
jne .done ; no, we are done
test al, al ; zero?
jz .done ; yes, we are done
inc di ; increment di
inc si ; increment si
jmp .loop_start ; loop!
.done:
ret
clrscr:
mov ax, 0x0600
xor cx, cx
mov dx, 0x174f
mov bh, 0x07
int 0x10
ret
; --------------------------------------------
; protected mode ...
; --------------------------------------------
[bits 32]
ProtectedMode:
mov ax, 0x10
mov ds, ax ; data descriptor
mov ss, ax
mov es, ax
xor eax, eax
mov fs, ax
mov gs, ax
mov esp, 0x200000 ; set stack below 2 MB limit
call clrscr_32
mov ah, 0x01
.endlessloop:
call Waitingloop
inc ah
and ah, 0x0f
mov esi, msg_pm2
call PutStr_32
cmp dword [PutStr_Ptr], 25 * 80 * 2 + 0xb8000
jb .endlessloop
mov dword [PutStr_Ptr], 0xb8000 ; text pointer wrap around
jmp .endlessloop
Waitingloop:
mov ebx, 0x9ffff
.loop_start:
dec ebx
jnz .loop_start
ret
PutStr_32:
mov edi, [PutStr_Ptr]
.nextchar:
lodsb
test al, al
jz .end
stosw
jmp .nextchar
.end:
mov [PutStr_Ptr], edi
ret
clrscr_32:
mov edi, 0xb8000
mov [PutStr_Ptr], edi
mov ecx, 40 * 25
mov eax, 0x07200720 ; two times: 0x07 => white text & black background 0x20 => space
rep stosd
ret
PutStr_Ptr: dd 0xb8000
%include "gdt.inc"
msg_helloworld: db "Hello from PC!", 0x0d, 0x0a, 0
msg_badcommand: db "Bad command entered.", 0x0d, 0x0a, 0
prompt: db "ram://", 0
cmd_help: db "help", 0
cmd_hi: db "hi", 0
cmd_exit: db "exit", 0
cmd_pm: db "pm", 0
msg_help: db "Commands: hi, help, pm, exit", 13, 10, 0
msg_exit: db "Reboot starts now. Enter keystroke, please.", 13, 10, 0
msg_pm: db "Switch-over to Protected Mode.", 13, 10, 0
msg_pm2: db "OS currently uses Protected Mode.", 0
times 1024 - ($ - $$) hlt
|
computer architecture/ProjOrgArq/in/mips1.asm
|
MarceloHeredia/College
| 0 |
172824
|
<reponame>MarceloHeredia/College<gh_stars>0
.text
.globl main
main:addu $zero,$zero,$zero
L_1:and $t2,$t2,$t2
L_2:and $t1,$t1,$t1
j L_2
j L_1
|
oeis/159/A159562.asm
|
neoneye/loda-programs
| 11 |
82186
|
; A159562: Numerator of Hermite(n, 13/18).
; Submitted by <NAME>
; 1,13,7,-4121,-56975,1929733,71236279,-949628849,-93127115423,20066487805,136040198628199,1736014871922487,-219855440620458287,-6232933639083272459,381987420638602610455,19102129961742695872927,-679901742649149297057599,-58351443515276008564375571,1113880633557169052759745223,184633257526788038659595852935,-1028292242240721841819749708239,-611579553535922629200747309716507,-4452283987864058473738926518885513,2121789836959795490312857367084119279,44172478019258823247218385981460972065
mov $1,1
lpb $0
sub $0,1
mul $2,9
add $2,$1
add $1,$2
sub $2,$1
mul $1,2
mul $2,9
sub $1,$2
mul $2,$0
lpe
mov $0,$1
|
oeis/100/A100550.asm
|
neoneye/loda-programs
| 11 |
176994
|
<reponame>neoneye/loda-programs
; A100550: If n>3 a(n)=a(n-1)+2*a(n-2)+3*a(n-3) else a(n)=n
; Submitted by <NAME>(s1)
; 0,1,2,4,11,25,59,142,335,796,1892,4489,10661,25315,60104,142717,338870,804616,1910507,4536349,10771211,25575430,60726899,144191392,342371480,812934961,1930252097,4583236459,10882545536,25839774745,61354575194
mov $3,1
mov $4,1
lpb $0
sub $0,1
mov $2,$1
add $1,$4
mov $4,$3
mul $4,2
add $1,$4
add $4,$3
mov $3,$2
lpe
mov $0,$1
div $0,3
|
3-mid/impact/source/2d/orbs/collision/impact-d2-orbs-colliders.adb
|
charlie5/lace
| 20 |
18399
|
<reponame>charlie5/lace<gh_stars>10-100
with impact.d2.orbs.Distance;
package body impact.d2.orbs.Colliders
is
use type int32;
-- Determine if two generic shapes overlap.
--
function b2TestOverlap (shapeA, shapeB : in impact.d2.orbs.Shape.view;
xfA, xfB : in b2Transform ) return Boolean
is
use impact.d2.orbs.Distance;
input : b2DistanceInput;
cache : aliased b2SimplexCache;
output : aliased b2DistanceOutput;
begin
set (input.proxyA, shapeA);
set (input.proxyB, shapeB);
input.transformA := xfA;
input.transformB := xfB;
input.useRadii := True;
cache.count := 0;
b2Distance (output'Access, cache'Access, input);
return output.distance < 10.0 * b2_epsilon;
end b2TestOverlap;
-- Compute the collision manifold between two circles.
--
procedure b2CollideCircles (manifold : access collision.b2Manifold; circleA : access constant Shape.Item'Class; xfA : in b2Transform;
circleB : access constant Shape.Item'Class; xfB : in b2Transform)
is
pA : constant b2Vec2 := b2Mul (xfA, (0.0, 0.0));
pB : constant b2Vec2 := b2Mul (xfB, (0.0, 0.0));
d : constant b2Vec2 := pB - pA;
distSqr : constant float32 := b2Dot (d, d);
rA : constant float32 := circleA.m_radius;
rB : constant float32 := circleB.m_radius;
radius : constant float32 := rA + rB;
begin
manifold.pointCount := 0;
if distSqr > radius * radius then
return;
end if;
manifold.Kind := collision.e_circles;
manifold.localPoint := (0.0, 0.0);
manifold.localNormal := (0.0, 0.0);
manifold.pointCount := 1;
manifold.points (1).localPoint := (0.0, 0.0);
manifold.points (1).id.key := 0;
end b2CollideCircles;
end impact.d2.orbs.Colliders;
|
oeis/113/A113407.asm
|
neoneye/loda-programs
| 11 |
172717
|
; A113407: Expansion of psi(x) * phi(x^2) in powers of x where psi(), phi() are Ramanujan theta functions.
; 1,1,2,3,0,2,1,0,4,2,1,2,2,0,2,1,0,2,4,2,0,3,0,4,2,0,0,0,3,2,2,0,2,4,0,2,3,0,4,2,0,0,2,0,2,1,2,4,0,0,2,2,0,6,2,1,2,2,0,0,4,0,0,4,0,2,1,0,4,0,0,2,2,4,2,2,0,2,5,0,2,0,2,0,2,0,4,4,0,0,0,1,0,4,0,2,2,0,4,4
mul $0,8
seq $0,34730 ; Dirichlet convolution of b_n=1 with c_n=3^(n-1).
mod $0,10
|
Task/Trabb-Pardo-Knuth-algorithm/Ada/trabb-pardo-knuth-algorithm.ada
|
LaudateCorpus1/RosettaCodeData
| 1 |
19410
|
with Ada.Text_IO, Ada.Numerics.Generic_Elementary_Functions;
procedure Trabb_Pardo_Knuth is
type Real is digits 6 range -400.0 .. 400.0;
package TIO renames Ada.Text_IO;
package FIO is new TIO.Float_IO(Real);
package Math is new Ada.Numerics.Generic_Elementary_Functions(Real);
function F(X: Real) return Real is
begin
return (Math.Sqrt(abs(X)) + 5.0 * X**3);
end F;
Values: array(1 .. 11) of Real;
begin
TIO.Put("Please enter 11 Numbers:");
for I in Values'Range loop
FIO.Get(Values(I));
end loop;
for I in reverse Values'Range loop
TIO.Put("f(");
FIO.Put(Values(I), Fore => 2, Aft => 3, Exp => 0);
TIO.Put(")=");
begin
FIO.Put(F(Values(I)), Fore=> 4, Aft => 3, Exp => 0);
exception
when Constraint_Error => TIO.Put("-->too large<--");
end;
TIO.New_Line;
end loop;
end Trabb_Pardo_Knuth;
|
testcases/driver_connections/mysql/connect.ads
|
jrmarino/AdaBase
| 30 |
30731
|
-- Used for all testcases for MySQL driver
with AdaBase.Driver.Base.MySQL;
with AdaBase.Statement.Base.MySQL;
package Connect is
-- All specific drivers renamed to "Database_Driver"
subtype Database_Driver is AdaBase.Driver.Base.MySQL.MySQL_Driver;
subtype Stmt_Type is AdaBase.Statement.Base.MySQL.MySQL_statement;
subtype Stmt_Type_access is
AdaBase.Statement.Base.MySQL.MySQL_statement_access;
DR : Database_Driver;
procedure connect_database;
end Connect;
|
programs/oeis/222/A222260.asm
|
neoneye/loda
| 22 |
178020
|
<reponame>neoneye/loda<filename>programs/oeis/222/A222260.asm
; A222260: Lexicographically earliest injective sequence of nonnegative integers such that the sum of 10 consecutive terms is always divisible by 10.
; 0,1,2,3,4,5,6,7,8,14,10,11,12,13,24,15,16,17,18,34,20,21,22,23,44,25,26,27,28,54,30,31,32,33,64,35,36,37,38,74,40,41,42,43,84,45,46,47,48,94,50,51,52,53,104,55,56,57,58,114,60,61,62,63,124,65,66,67,68,134,70,71,72,73,144,75,76,77,78,154,80,81,82,83,164,85,86,87,88,174
mov $2,$0
sub $0,3
lpb $0
sub $0,1
mov $1,$0
mod $0,5
lpe
add $1,$2
mov $0,$1
|
src/libYARP_dev/56f807/cotroller_dc/Support/Fp568d.asm
|
robotology-legacy/yarp1
| 0 |
14492
|
<gh_stars>0
;=============================================================
;=== FILE: Fp568d.asm
;===
;=== Copyright (c)1998 Metrowerks, Inc. All rights reserved.
;=============================================================
; Recommended tab stop = 8.
;===============================================================================
; GLOBAL DATA: fpe_state -- one word of state per process, indicating the
; prevailing rouding mode and holding the sticky exception flags.
;
SECTION fp_state GLOBAL
GLOBAL FPE_state
ORG X:
FPE_state:
DC $0000
ENDSEC
|
src/Experiments/STLCRefPointfree.agda
|
metaborg/mj.agda
| 10 |
840
|
<reponame>metaborg/mj.agda
open import Relation.Binary.PropositionalEquality
module Experiments.STLCRefPointfree (funext : ∀ {a b} → Extensionality a b) where
open import Level
open import Data.Nat hiding (_^_)
import Data.Unit as Unit
open import Data.List
open import Data.List.Prefix
open import Data.List.Properties.Extra
open import Data.List.All.Properties.Extra
open import Data.List.Membership.Propositional
open import Data.List.Relation.Unary.Any
open import Data.List.Relation.Unary.All as All
open import Data.Product hiding (curry; swap)
open import Function as Fun using (case_of_)
import Relation.Binary.PropositionalEquality as PEq
import Relation.Binary.HeterogeneousEquality as H
open import Relation.Binary.PropositionalEquality.Extensionality funext
open PEq.≡-Reasoning
-- STLCRef typed syntax
------------------------------------------------------------------------
data Ty : Set where
unit : Ty
_⟶_ : (a b : Ty) → Ty
ref : Ty → Ty
open import Experiments.Category (⊑-preorder {A = Ty})
open Product
open Exists
Ctx = List Ty
StoreTy = List Ty
data Expr (Γ : List Ty) : Ty → Set where
var : ∀ {t} → t ∈ Γ → Expr Γ t
ƛ : ∀ {a b} → Expr (a ∷ Γ) b → Expr Γ (a ⟶ b)
app : ∀ {a b} → Expr Γ (a ⟶ b) → Expr Γ a → Expr Γ b
unit : Expr Γ unit
ref : ∀ {t} → Expr Γ t → Expr Γ (ref t)
!_ : ∀ {t} → Expr Γ (ref t) → Expr Γ t
_≔_ : ∀ {t} → Expr Γ (ref t) → Expr Γ t → Expr Γ unit
module Values where
mutual
Env' : (Γ : Ctx)(Σ : StoreTy) → Set
Env' Γ Σ = All (λ t → Val' t Σ) Γ
data Val' : Ty → List Ty → Set where
unit : ∀ {Σ} → Val' unit Σ
clos : ∀ {Σ Γ a b} → Expr (a ∷ Γ) b → Env' Γ Σ → Val' (a ⟶ b) Σ
ref : ∀ {Σ t} → t ∈ Σ → Val' (ref t) Σ
mutual
val-mono : ∀ {a Σ Σ'} → Σ ⊑ Σ' → Val' a Σ → Val' a Σ'
val-mono ext unit = unit
val-mono ext (clos e E) = clos e (env-mono ext E)
val-mono ext (ref x) = ref (∈-⊒ x ext)
val-mono-refl : ∀ {Σ a}(v : Val' a Σ) → val-mono ⊑-refl v ≡ v
val-mono-refl unit = refl
val-mono-refl (clos e E) = cong (clos e) (env-mono-refl E)
val-mono-refl (ref x) = cong ref ∈-⊒-refl
val-mono-trans : ∀ {a Σ Σ' Σ''}(v : Val' a Σ)(p : Σ' ⊒ Σ)(q : Σ'' ⊒ Σ') → val-mono (⊑-trans p q) v ≡ (val-mono q (val-mono p v))
val-mono-trans unit p q = refl
val-mono-trans (clos x E) p q = cong (clos x) (env-mono-trans E p q)
val-mono-trans (ref x) p q = cong ref (∈-⊒-trans p q)
env-mono : ∀ {Γ Σ Σ'} → Σ ⊑ Σ' → Env' Γ Σ → Env' Γ Σ'
env-mono ext [] = []
env-mono ext (px ∷ E) = (val-mono ext px) ∷ (env-mono ext E)
env-mono-refl : ∀ {Γ Σ}(E : Env' Γ Σ) → env-mono ⊑-refl E ≡ E
env-mono-refl [] = refl
env-mono-refl (px ∷ E) = cong₂ _∷_ (val-mono-refl px) (env-mono-refl E)
env-mono-trans : ∀ {Γ Σ Σ' Σ''}(E : Env' Γ Σ)(p : Σ' ⊒ Σ)(q : Σ'' ⊒ Σ') → env-mono (⊑-trans p q) E ≡ (env-mono q (env-mono p E))
env-mono-trans [] p q = refl
env-mono-trans (px ∷ E) p q = cong₂ _∷_ (val-mono-trans px p q) (env-mono-trans E p q)
Env : Ctx → MP _
Env Γ = mp (Env' Γ) (record {
monotone = env-mono ;
monotone-refl = env-mono-refl ;
monotone-trans = env-mono-trans })
Val : Ty → MP _
Val a = mp (Val' a) (record {
monotone = val-mono ;
monotone-refl = val-mono-refl ;
monotone-trans = val-mono-trans })
open Values
open import Experiments.StrongMonad Ty Val funext
-- Val constructors
------------------------------------------------------------------------
mkclos : ∀ {Γ a b} → Const (Expr (a ∷ Γ) b) ⊗ Env Γ ⇒ Val (a ⟶ b)
mkclos = mk⇒ (λ{ (e , E) → clos e E}) λ c~c' → refl
mkunit : ⊤ ⇒ Val unit
mkunit = mk⇒ (λ _ → Values.unit) λ c~c' → refl
-- destructors
------------------------------------------------------------------------
destructfun : ∀ {a b} → Val (a ⟶ b) ⇒ (Exists (λ Γ → Const (Expr (a ∷ Γ) b) ⊗ Env Γ))
destructfun = mk⇒ (λ{ (clos x E) → _ , x , E}) λ{ c~c' {clos x E} → refl }
-- state manipulation
------------------------------------------------------------------------
alloc : ∀ {a} → Val a ⇒ M (Val (ref a))
alloc {a} = mk⇒
(λ v Σ₁ ext μ₁ →
let ext' = ∷ʳ-⊒ a Σ₁ in
(Σ₁ ∷ʳ a) ,
ext' ,
((All.map (MP.monotone (Val _) ext') μ₁) all-∷ʳ MP.monotone (Val _) (⊑-trans ext ext') v) ,
ref (∈-∷ʳ Σ₁ a))
(λ c~c' {p} → funext³ λ q ext μ →
mcong {P = (Val (ref a))} refl H.refl
(H.≡-to-≅ (
cong (λ u → All.map _ μ all-∷ʳ u)
(trans
(sym (MP.monotone-trans (Val a) p c~c' _))
(cong (λ u → (MP.monotone (Val a) u p)) ⊑-trans-assoc)
)
)) H.refl)
load : ∀ {a} → Val (ref a) ⇒ M (Val a)
load {a} = mk⇒
(λ v Σ₁ ext μ₁ → case v of λ{
(ref x) → Σ₁ , ⊑-refl , μ₁ , (∈-all (∈-⊒ x ext) μ₁)
})
(λ{ c~c' {ref x} →
funext³ λ p₁ q r →
mcong {P = Val _} refl H.refl H.refl
((H.cong (λ u → ∈-all u r) (H.≡-to-≅ (sym (∈-⊒-trans c~c' q)))))
})
store : ∀ {a} → (Val (ref a) ⊗ Val a) ⇒ M ⊤
store = mk⇒
(λ x Σ₁ ext μ₁ → case x of λ{
(ref l , v) → Σ₁ , ⊑-refl , (μ₁ All.[ ∈-⊒ l ext ]≔ MP.monotone (Val _) ext v) , Unit.tt
})
(λ{ c~c' {ref x , v} →
funext³ λ p q r →
mcong {P = ⊤} refl H.refl
(H.cong₂ (λ u v → r All.[ u ]≔ v)
(H.≡-to-≅ (sym (∈-⊒-trans c~c' q)))
(H.≡-to-≅ (sym (MP.monotone-trans (Val _) v _ _))))
H.refl
})
-- environment manipulation
------------------------------------------------------------------------
envlookup : ∀ {a Γ} → a ∈ Γ → Env Γ ⇒ Val a
envlookup x = mk⇒ (λ E → All.lookup E x) λ{ c~c' {E} → sym (lem c~c' E x)}
where
lem : ∀ {Γ Σ Σ' a} → (p : Σ ⊑ Σ') → (E : Env' Γ Σ) → (e : a ∈ Γ)
→ val-mono p (All.lookup E e) ≡ All.lookup (env-mono p E) e
lem p (px ∷ E) (here refl) = refl
lem p (px ∷ E) (there e) = lem p E e
envcons : ∀ {a Γ} → Val a ⊗ Env Γ ⇒ Env (a ∷ Γ)
envcons = mk⇒ (uncurry _∷_) λ c~c' → refl
-- STLCRef interpreter; pointfree style
------------------------------------------------------------------------
open Exponential (sym ⊑-trans-assoc) ⊑-trans-refl ⊑-trans-refl'
open Strong
mutual
interpclos : ∀ {a b} → Val (a ⟶ b) ⇒ M (Val b) ^ (Val a)
interpclos = curry (
elim (
uncurry₁ eval
∘ (xmap (id (Const _)) (envcons ∘ Product.swap (Env _)(Val _)))
∘ Product.comm (Const _)(Env _)(Val _)
)
∘ ∃-⊗-comm (λ Γ → Const _ ⊗ Env Γ)(Val _)
∘ xmap destructfun (id (Val _)))
{-# TERMINATING #-}
eval : ∀ {Γ a} → Expr Γ a → Env Γ ⇒ M (Val a)
eval (var x) = η (Val _) ∘ envlookup x
eval (ƛ e) = η (Val _) ∘ mkclos ∘ ⟨ terminal e , id (Env _) ⟩
eval (app f e) =
μ (Val _)
∘ fmap (ε ∘ xmap interpclos (id (Val _)))
∘ μ (Val _ ⊗ Val _)
∘ fmap (ts (Val _) (Val _))
∘ ts' (Val _) (M (Val _))
∘ ⟨ eval f , eval e ⟩
eval unit = η (Val _) ∘ mkunit ∘ terminal Unit.tt
eval (ref e) = bind (Val _) alloc ∘ eval e
eval (! e) = bind (Val _) load ∘ eval e
eval (e₁ ≔ e₂) =
fmap mkunit
∘ μ ⊤
∘ fmap store
∘ μ ((Val _) ⊗ (Val _))
∘ fmap (ts' (Val _)(Val _))
∘ ts (M (Val _))(Val _)
∘ ⟨ eval e₁ , eval e₂ ⟩
module Examples where
test : Expr [] unit
test = let id = ƛ (var (here refl)) in app (ƛ (app id (var (here refl)))) unit
test! : apply (eval test) [] [] ⊑-refl [] ≡ ([] , [] , [] , unit)
test! = refl
|
source/nodes/program-nodes-known_discriminant_parts.ads
|
optikos/oasis
| 0 |
28062
|
<filename>source/nodes/program-nodes-known_discriminant_parts.ads
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Discriminant_Specifications;
with Program.Elements.Known_Discriminant_Parts;
with Program.Element_Visitors;
package Program.Nodes.Known_Discriminant_Parts is
pragma Preelaborate;
type Known_Discriminant_Part is
new Program.Nodes.Node
and Program.Elements.Known_Discriminant_Parts.Known_Discriminant_Part
and Program.Elements.Known_Discriminant_Parts
.Known_Discriminant_Part_Text
with private;
function Create
(Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Discriminants : Program.Elements.Discriminant_Specifications
.Discriminant_Specification_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Known_Discriminant_Part;
type Implicit_Known_Discriminant_Part is
new Program.Nodes.Node
and Program.Elements.Known_Discriminant_Parts.Known_Discriminant_Part
with private;
function Create
(Discriminants : Program.Elements.Discriminant_Specifications
.Discriminant_Specification_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Known_Discriminant_Part
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Known_Discriminant_Part is
abstract new Program.Nodes.Node
and Program.Elements.Known_Discriminant_Parts.Known_Discriminant_Part
with record
Discriminants : Program.Elements.Discriminant_Specifications
.Discriminant_Specification_Vector_Access;
end record;
procedure Initialize
(Self : aliased in out Base_Known_Discriminant_Part'Class);
overriding procedure Visit
(Self : not null access Base_Known_Discriminant_Part;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Discriminants
(Self : Base_Known_Discriminant_Part)
return Program.Elements.Discriminant_Specifications
.Discriminant_Specification_Vector_Access;
overriding function Is_Known_Discriminant_Part_Element
(Self : Base_Known_Discriminant_Part)
return Boolean;
overriding function Is_Definition_Element
(Self : Base_Known_Discriminant_Part)
return Boolean;
type Known_Discriminant_Part is
new Base_Known_Discriminant_Part
and Program.Elements.Known_Discriminant_Parts
.Known_Discriminant_Part_Text
with record
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Known_Discriminant_Part_Text
(Self : aliased in out Known_Discriminant_Part)
return Program.Elements.Known_Discriminant_Parts
.Known_Discriminant_Part_Text_Access;
overriding function Left_Bracket_Token
(Self : Known_Discriminant_Part)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Right_Bracket_Token
(Self : Known_Discriminant_Part)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Known_Discriminant_Part is
new Base_Known_Discriminant_Part
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Known_Discriminant_Part_Text
(Self : aliased in out Implicit_Known_Discriminant_Part)
return Program.Elements.Known_Discriminant_Parts
.Known_Discriminant_Part_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Known_Discriminant_Part)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Known_Discriminant_Part)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Known_Discriminant_Part)
return Boolean;
end Program.Nodes.Known_Discriminant_Parts;
|
1A/S5/PIM/tps/tp6/afficher_un_entier.ads
|
MOUDDENEHamza/ENSEEIHT
| 4 |
9894
|
<reponame>MOUDDENEHamza/ENSEEIHT
package Afficher_Un_Entier is
-- Afficher l'entier N sur la sortie standard.
-- Cette procédure s'appuie sur Ada.Integer_Text_IO.Put mais permet d'avoir
-- une procédure avec un seul paramètre.
procedure Afficher (N: in Integer);
end Afficher_Un_Entier;
|
Ravel.g4
|
Northshoot/RavelLang
| 0 |
3595
|
grammar Ravel;
@header{
import ai.harmony.ravel.compiler.scope.*;
import ai.harmony.ravel.compiler.symbol.*;
import ai.harmony.ravel.compiler.types.Type;
}
tokens { INDENT, DEDENT }
@lexer::members {
// A queue where extra tokens are pushed on (see the NEWLINE lexer rule).
private java.util.LinkedList<Token> tokens = new java.util.LinkedList<>();
// The stack that keeps track of the indentation level.
private java.util.Stack<Integer> indents = new java.util.Stack<>();
// The amount of opened braces, brackets and parenthesis.
private int opened = 0;
// The most recently produced token.
private Token lastToken = null;
@Override
public void emit(Token t) {
super.setToken(t);
tokens.offer(t);
}
@Override
public Token nextToken() {
// Check if the end-of-file is ahead and there are still some DEDENTS expected.
if (_input.LA(1) == EOF && !this.indents.isEmpty()) {
// Remove any trailing EOF tokens from our buffer.
for (int i = tokens.size() - 1; i >= 0; i--) {
if (tokens.get(i).getType() == EOF) {
tokens.remove(i);
}
}
// First emit an extra line break that serves as the end of the statement.
this.emit(commonToken(RavelParser.NEWLINE, "\n"));
// Now emit as much DEDENT tokens as needed.
while (!indents.isEmpty()) {
this.emit(createDedent());
indents.pop();
}
// Put the EOF back on the token stream.
this.emit(commonToken(RavelParser.EOF, "<EOF>"));
}
Token next = super.nextToken();
if (next.getChannel() == Token.DEFAULT_CHANNEL) {
// Keep track of the last token on the default channel.
this.lastToken = next;
}
return tokens.isEmpty() ? next : tokens.poll();
}
private Token createDedent() {
CommonToken dedent = commonToken(RavelParser.DEDENT, "");
dedent.setLine(this.lastToken.getLine());
return dedent;
}
private CommonToken commonToken(int type, String text) {
int stop = this.getCharIndex() - 1;
int start = text.isEmpty() ? stop : stop - text.length() + 1;
return new CommonToken(this._tokenFactorySourcePair, type, DEFAULT_TOKEN_CHANNEL, start, stop);
}
// Calculates the indentation of the provided spaces, taking the
// following rules into account:
//
// "Tabs are replaced (from left to right) by one to eight spaces
// such that the total number of characters up to and including
// the replacement is a multiple of eight [...]"
//
// -- https://docs.python.org/3.1/reference/lexical_analysis.html#indentation
static int getIndentationCount(String spaces) {
int count = 0;
for (char ch : spaces.toCharArray()) {
switch (ch) {
case '\t':
count += 8 - (count % 8);
break;
default:
// A normal space char.
count++;
}
}
return count;
}
boolean atStartOfInput() {
return super.getCharPositionInLine() == 0 && super.getLine() == 1;
}
}
/*
* parser rules
*/
//only file inputs are accepted
//the file can be newlines or components definitions
//TODO: add imports
file_input returns [Scope scope]
: ( NEWLINE | import_stmt | comp_def )* EOF
;
import_stmt
: import_name #importName
| import_from #importFrom
;
/// import_name: 'import' dotted_as_names
import_name
: IMPORT dotted_as_names
;
/// # note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS
/// import_from: ('from' (('.' | '...')* dotted_name | ('.' | '...')+)
/// 'import' ('*' | '(' import_as_names ')' | import_as_names))
import_from
: FROM ( ( '.' | '...' )* dotted_name
| ('.' | '...')+
)
IMPORT ( '*'
| '(' import_as_names ')'
| import_as_names
)
;
/// import_as_name: NAME ['as' NAME]
import_as_name
: Identifier ( AS Identifier )?
;
/// dotted_as_name: dotted_name ['as' NAME]
dotted_as_name
: dotted_name ( AS Identifier )?
;
/// import_as_names: import_as_name (',' import_as_name)* [',']
import_as_names
: import_as_name ( ',' import_as_name )* ','?
;
/// dotted_as_names: dotted_as_name (',' dotted_as_name)*
dotted_as_names
: dotted_as_name ( ',' dotted_as_name )*
;
/// dotted_name: NAME ('.' NAME)*
dotted_name
: Identifier ( '.' Identifier )*
;
/**
*
* Ravel application consists of componets
*/
//we have models, views, controllers, spaces, interfaces
comp_def
: model_comp
| controller_comp
| iface_comp
| view_comp
| space_comp
;
/**
*
* Space parser rules
*/
space_comp returns [Scope scope]
: SPACE Identifier ':' space_body #SpaceScope
;
space_body
: NEWLINE INDENT space_block+ DEDENT
;
space_block
: platform_scope
| models_scope
| controllers_scope
| interface_scope
| views_scope
| NEWLINE
;
platform_scope returns [Scope scope]
: 'platform:' space_assignments #PlatformScope
;
space_assignments returns [Symbol symbol]
: NEWLINE INDENT space_assigment+ DEDENT
;
space_assigment
: ref_assign
| NEWLINE
;
// a simplified version of an assignment, to use in constant expression contexts
// (eg. in model and space declarations)
ref_assign
: qualified_name '=' simple_expression
;
simple_expression
: literal
| qualified_name
;
models_scope returns [Scope scope]
: 'models:' instantiations #ModelInstantiation
;
instantiations
: NEWLINE INDENT instance_line+ DEDENT
;
instance_line
: instance_def
| NEWLINE
;
instance_def returns [InstanceSymbol symbol]
: Identifier '=' instance_name '(' param_assig_list? ')' NEWLINE? #Instance
;
param_assig_list
: param_assig (',' param_assig)* #ParameterAssignments
;
param_assig
: Identifier '=' param_val
;
param_val : simple_expression;
instance_name
: Identifier
;
controllers_scope returns [Scope scope]
: 'controllers:' instantiations #ControllerInstantiation
;
interface_scope returns [Scope scope]
: 'interfaces:' instantiations #InterfaceInstantiation
;
views_scope returns [Scope scope]
: 'views:' instantiations #ViewInstantiation
;
/**
*
* Interface parser rules
*/
iface_comp returns [Scope scope]
: INTERFACE Identifier function_args ':' iface_body #InterfaceScope
;
iface_body
: NEWLINE INDENT config_scope? uses_scope? impl_scope iface_members* DEDENT
;
impl_scope returns [Scope scope]
: 'implementation:' space_assignments* #ImplementationScope
;
config_scope returns [Scope scope]
: 'configuration:' space_assignments* #ConfigurationScope
;
uses_scope returns [Scope scope]
: 'use:' space_assignments* #UsesScope
;
iface_members
: iface_def
| iface_event
| NEWLINE
;
iface_def returns [MethodDeclarationSymbol symbol]
: DEF Identifier '(' typed_identifier_list? ')' (':' type)? #InterfaceDef
;
iface_event returns [MethodDeclarationSymbol symbol]
: EVENT Identifier '(' typed_identifier_list? ')' #InterfaceEvent
;
/**
*
* View parser rules
*/
view_comp returns [Scope scope]
: VIEW Identifier '(' ')' ':' view_body #ViewScope
;
view_body
: NEWLINE INDENT uses_scope? iface_members* DEDENT
;
/**
*
* Model parser rules
*/
model_comp returns [Scope scope]
: modelType MODEL Identifier function_args ':' model_body # ModelScope
;
modelType
: LOCAL
| STREAMING
| REPLICATED
;
model_body
: NEWLINE INDENT model_block+ DEDENT
;
model_block
: properties_block
| schema_block
| NEWLINE
;
properties_block returns [Scope scope]
: 'properties:' properties #PropertiesScope
;
properties
: NEWLINE INDENT property_line+ DEDENT
;
property_line
: ref_assign
| flow_assign
| NEWLINE
;
// TODO: add flow lists, star, and flow as parameter
flow_assign
: FLOW '=' Identifier ('->' Identifier)+ #DirectedFlow
| FLOW '=' Identifier (',' Identifier)+ #UndirectedFlow
;
schema_block returns [Scope scope]
:'schema:' fields #SchemaScope
;
fields
: NEWLINE INDENT field_line+ DEDENT
;
field_line
: field
| NEWLINE
;
field
: Identifier ':' type #FieldDeclaration
;
/**
* Controller stuff
*/
controller_comp returns [Scope scope]
: CONTROLLER Identifier function_args ':' controller_scope # ControllerScope
;
controller_scope
: NEWLINE INDENT controller_entry* DEDENT
;
controller_entry
: eventdef #EventDefinition
| Identifier (':' type)? '=' simple_expression #ControllerVariableDefinition
| Identifier ':' type '=' '[' (literal (',' literal)+)? ']' #ControllerArrayConstant
| NEWLINE #ControllerNewline
;
/**
*All here for handling normal language statements and expressions
*
*/
eventdef returns [Scope scope]
: EVENT Identifier '.' Identifier function_args ':' block_stmt #EventScope
;
block_stmt returns [Scope scope]
: NEWLINE INDENT statement+ DEDENT #Block
;
statement
: var_decl
| assignment
| expression // expression statement (eg function call)
| del_stmt
| while_stmt
| if_stmt
| for_stmt
| break_stmt
| continue_stmt
| return_stmt
| PASS
| NEWLINE
;
del_stmt
: DELETE lvalue_expression #DeleteStmt
;
break_stmt
: BREAK
;
continue_stmt
: CONTINUE
;
return_stmt
: RETURN expression?
;
lvalue
: lvalue_expression (',' lvalue_expression)*
;
assign_op
: '=' | '+=' | '-=' | '*=' | '/=' | '//=' | '^=' | '<<=' | '>>=' ;
ident_decl
: Identifier (':' type)?
;
identifier_list
: ident_decl (',' ident_decl )*
;
typed_ident_decl
: Identifier ':' type #TypedIdentDecl
;
typed_identifier_list
: typed_ident_decl (',' typed_ident_decl )*
;
var_decl
: identifier_list ('=' expressionList)?
;
type
: Identifier ('.' Identifier)* array_marker*;
array_marker: '[' DECIMAL_INTEGER? ']' ;
assignment
: lvalue assign_op expressionList
;
// an expression that evaluates to an lvalue:
// could be an identifier, an expression followed by member access,
// or an expression followed by array access
lvalue_expression
: Identifier
| primary '.' Identifier
| primary '[' expression ']'
;
expressionList
: expression (',' expression)*
;
atom
: '(' expression ')'
| Identifier
| literal
| array_literal
;
array_literal
: '[' (expressionList (',')?)? ']'
;
method_call
: '.' Identifier '(' expressionList? ')' ;
primary
: cast_op? atom access_op*
;
cast_op returns [Type computedType]
: '(' type ')'
;
access_op
: array_access
| method_call
| member_access
;
member_access
: '.' Identifier ;
array_access
: '[' expression ']' ;
power_exp
: primary ('**' unary_exp)? ;
unary_op : '-' | '+' | '~' ;
unary_exp
: power_exp
| unary_op unary_exp
;
mult_op : '*' | '/' | '//' | '%' ;
mult_exp
: unary_exp
| mult_exp mult_op unary_exp
;
add_op : '+' | '-' ;
add_exp
: mult_exp
| add_exp add_op mult_exp
;
shift_op : '<<' | '>>' ;
shift_exp
: add_exp
| shift_exp shift_op add_exp
;
bin_and_exp
: shift_exp
| bin_and_exp '&' shift_exp
;
bin_xor_exp
: bin_and_exp
| bin_xor_exp '^' bin_and_exp
;
bin_or_exp
: bin_xor_exp
| bin_or_exp '|' bin_xor_exp
;
comp_op
: GT
| LT
| EQUAL
| LE
| GE
| NOTEQUAL
//| IN
//| NOT IN
//| IS
//| IS NOT
;
comp_exp
: bin_or_exp (comp_op bin_or_exp)*
;
not_exp
: comp_exp
| NOT not_exp
;
and_exp
: not_exp
| and_exp AND not_exp
;
or_exp
: and_exp
| or_exp OR and_exp
;
expression
: or_exp
;
/// while_stmt: 'while' test ':' suite ['else' ':' suite]
while_stmt
: WHILE expression ':' block_stmt #WhileStatement
;
/// for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
for_stmt returns [Scope scope]
: FOR forControl ':' block_stmt #ForStatement
| FOR ident_decl '=' expression 'to' expression ('step' expression)? ':' block_stmt #CLikeForStatement
;
forControl
: ident_decl IN expression
;
if_stmt returns [Scope scope]
: IF expression ':' block_stmt ( ELIF expression ':' block_stmt )* ( ELSE ':' block_stmt )? #IfStatement
;
qualified_name
: Identifier ('.' Identifier)*
;
function_args
: '(' typed_identifier_list? ')'
;
/*
* lexer rules
*/
// Keywords
MODEL : 'model' ;
SPACE : 'space' ;
CONTROLLER : 'controller' ;
VIEW : 'view';
FLOW : 'flow' ;
LOCAL : 'local' ;
STREAMING : 'streaming' ;
REPLICATED : 'replicated' ;
// interface
INTERFACE : 'interface' ;
DEF : 'def' ;
//controller
EVENT : 'event' ;
COMMAND : 'command' ;
//import python style
FROM : 'from';
IMPORT : 'import';
AS : 'as';
//expression operators
ASSERT : 'assert' ;
RETURN : 'return' ;
TRUE : 'True' ;
FALSE : 'False' ;
IF : 'if' ;
ELIF : 'elif' ;
ELSE : 'else';
FOR : 'for' ;
WHILE : 'while' ;
AND : 'and' ;
NOT : 'not';
OR : 'or' ;
IN : 'in' ;
IS : 'is' ;
DELETE : 'del' ;
PASS : 'pass';
CONTINUE : 'continue';
BREAK : 'break' ;
NONE : 'None' ;
NEWLINE
: ( {atStartOfInput()}? SPACES
| ( '\r'? '\n' | '\r' ) SPACES?
)
{
String newLine = getText().replaceAll("[^\r\n]+", "");
String spaces = getText().replaceAll("[\r\n]+", "");
int next = _input.LA(1);
if (opened > 0 || next == '\r' || next == '\n' || next == '/') {
// If we're inside a list or on a blank line, ignore all indents,
// dedents and line breaks.
skip();
}
else {
emit(commonToken(NEWLINE, newLine));
int indent = getIndentationCount(spaces);
int previous = indents.isEmpty() ? 0 : indents.peek();
if (indent == previous) {
// skip indents of the same size as the present indent-size
skip();
}
else if (indent > previous) {
indents.push(indent);
emit(commonToken(RavelParser.INDENT, spaces));
}
else {
// Possibly emit more than 1 DEDENT token.
while(!indents.isEmpty() && indents.peek() > indent) {
this.emit(createDedent());
indents.pop();
}
}
}
}
;
literal
: number
| boolean_rule
| STRING_LITERAL
| NONE
;
/// string ::= "'" stringitem* "'" | '"' stringitem* '"'
STRING_LITERAL
: '\'' ( STRING_ESCAPE_SEQ | ~[\\\r\n'] )* '\''
| '"' ( STRING_ESCAPE_SEQ | ~[\\\r\n"] )* '"'
;
/// stringescapeseq ::= "\" <any source character>
fragment STRING_ESCAPE_SEQ
: '\\' .
;
number
: integer
| float_point
;
/// integer ::= decimalinteger | octinteger | hexinteger | bininteger
integer
: DECIMAL_INTEGER | OCT_INTEGER | HEX_INTEGER | BIN_INTEGER
;
/// decimalinteger ::= nonzerodigit digit* | "0"+
DECIMAL_INTEGER
: NON_ZERO_DIGIT DIGIT*
| '0'+
;
/// octinteger ::= "0" ("o" | "O") octdigit+
OCT_INTEGER
: '0' [oO] OCT_DIGIT+
;
/// hexinteger ::= "0" ("x" | "X") hexdigit+
HEX_INTEGER
: '0' [xX] HEX_DIGIT+
;
/// bininteger ::= "0" ("b" | "B") bindigit+
BIN_INTEGER
: '0' [bB] BIN_DIGIT+
;
/// nonzerodigit ::= "1"..."9"
fragment NON_ZERO_DIGIT
: [1-9]
;
/// digit ::= "0"..."9"
fragment DIGIT
: [0-9]
;
/// octdigit ::= "0"..."7"
fragment OCT_DIGIT
: [0-7]
;
/// hexdigit ::= digit | "a"..."f" | "A"..."F"
fragment HEX_DIGIT
: [0-9a-fA-F]
;
/// bindigit ::= "0" | "1"
fragment BIN_DIGIT
: [01]
;
/// floatnumber ::= pointfloat | exponentfloat
float_point
: FLOAT_NUMBER
;
FLOAT_NUMBER
: POINT_FLOAT | EXPONENT_FLOAT
;
/// pointfloat ::= [intpart] fraction | intpart "."
fragment POINT_FLOAT
: INT_PART? FRACTION
| INT_PART '.'
;
/// exponentfloat ::= (intpart | pointfloat) exponent
fragment EXPONENT_FLOAT
: ( INT_PART | POINT_FLOAT ) EXPONENT
;
/// intpart ::= digit+
fragment INT_PART
: DIGIT+
;
/// fraction ::= "." digit+
fragment FRACTION
: '.' DIGIT+
;
/// exponent ::= ("e" | "E") ["+" | "-"] digit+
fragment EXPONENT
: [eE] [+-]? DIGIT+
;
boolean_rule
: TRUE
| FALSE
;
NullLiteral
: 'null'
;
// §3.12 Operators
DOT : '.';
ELLIPSIS : '...';
STAR : '*';
OPEN_PAREN : '(' {opened++;};
CLOSE_PAREN : ')' {opened--;};
COMMA : ',';
COLON : ':';
SEMI_COLON : ';';
POWER : '**';
ASSIGN : '=';
OPEN_BRACK : '[' {opened++;};
CLOSE_BRACK : ']' {opened--;};
OR_OP : '|';
XOR : '^';
AND_OP : '&';
LEFT_SHIFT : '<<';
RIGHT_SHIFT : '>>';
ADD : '+';
MINUS : '-';
DIV : '/';
MOD : '%';
IDIV : '//';
NOT_OP : '~';
OPEN_BRACE : '{' {opened++;};
CLOSE_BRACE : '}' {opened--;};
LT : '<';
GT : '>';
EQUAL : '==';
GE : '>=';
LE : '<=';
NOTEQUAL : '<>' | '!=';
AT : '@';
ARROW : '->';
ADD_ASSIGN : '+=';
SUB_ASSIGN : '-=';
MULT_ASSIGN : '*=';
AT_ASSIGN : '@=';
DIV_ASSIGN : '/=';
MOD_ASSIGN : '%=';
AND_ASSIGN : '&=';
OR_ASSIGN : '|=';
XOR_ASSIGN : '^=';
LEFT_SHIFT_ASSIGN : '<<=';
RIGHT_SHIFT_ASSIGN : '>>=';
POWER_ASSIGN : '**=';
IDIV_ASSIGN : '//=';
Identifier
: ID_START ID_CONTINUE*
;
fragment ID_START
: '_'
| [A-Z]
| [a-z]
;
fragment ID_CONTINUE
: ID_START
| [0-9]
;
SKIP_
: ( SPACES | COMMENT | LINE_JOINING ) -> skip
;
UNKNOWN_CHAR
: .
;
/*
* fragments
*/
fragment SPACES
: [ \t]+
;
fragment COMMENT
: '#' ~[\r\n]*
;
fragment LINE_JOINING
: '\\' SPACES? ( '\r'? '\n' | '\r' )
;
|
src/string_sets_utils.ads
|
TNO/Rejuvenation-Ada
| 1 |
451
|
<reponame>TNO/Rejuvenation-Ada
with String_Sets; use String_Sets;
with String_Vectors; use String_Vectors;
package String_Sets_Utils is
function From_Vector (V : Vector) return Set;
function To_String (S : Set) return String;
end String_Sets_Utils;
|
src/q_bingada.ads
|
jfuica/bingada
| 4 |
15826
|
<filename>src/q_bingada.ads
--*****************************************************************************
--*
--* PROJECT: BINGADA
--*
--* FILE: q_bingada.ads
--*
--* AUTHOR: <NAME>
--*
--*****************************************************************************
package Q_Bingada is
procedure P_Create_Widgets;
end Q_Bingada;
|
src/main/java/com/grammar/Logo.g4
|
pawlo555/LynxTranslator
| 0 |
709
|
grammar Logo; // Define a grammar called Logo
// PARSER
program
: line+ endFileArg
;
line
: brakeArg? (spaceArg? cmd spaceArg?)+ brakeArg?
;
cmd:
repeat
| while1
| procedure
| procedureCall
| forward
| back
| left
| right
| home
//variables cmd
| let
| assign
//logic cmd
| ifc
| ifElse
//draw cmd
| pd
| pu
| setcolor
| setpensize
//turtle
| newTurtle
| rename
| changeTurtle
| removeTurtle
| comment
| clean
;
// math statements
mathStatement:
mathSentence;
mathSentence:
('(' brakeArg? mathSentence brakeArg?')') # brakets
| mathSentence brakeArg? doubleArgMathOperator brakeArg? mathSentence # doubleArgs
| singleArgMathOperator brakeArg? mathSentence # singleArgs
| mathValue # value;
mathValue:
FLOATNUMBER
| NATURALNUMBER
| BOOLEAN
| variableName;
singleArgMathOperator:
ABS # abs
| ARCTAN # arctan
| COS # cos
| INT # int1
| LN # ln
| MINUS # minusSingle
| RANDOM # random
| ROUND # round
| SIN # sin
| SQRT # sqrt
| TAN # tan
| NOT # not
;
doubleArgMathOperator:
DIFFERENCE # difference
| POWER # power
| QUOTIENT # quotient
| REMAINDER # remainder
| SUM # sum
| MINUS # minus
| PRODUCT #product
| DIVISION # division
| COMPARISONEQUALS # comparisonEquals
| COMPARISONBIGGER # comparisonBigger
| COMPARISONSMALLER # comparisonSmaller
| COMPARISONBIGGEREQUALS # comparisonBiggerEquals
| COMPARISONSMALLEREQUALS # comparisonSmallerEquals
| EXP # exp
| LOG # log
| OR # or
| AND # and
;
comment:
COMMENTBRACKET
(acction)+
COMMENTBRACKET
;
acction:
brakeArg
| program
| cmd
| mathStatement
| OTHERWORD
;
stringArg:
OTHERWORD
;
//arguments
variableName:
':'+ OTHERWORD
| SPECIAL_WORD;
procedure:
PROCEDURE brakeArg stringArg brakeArg (variableName brakeArg)* commandsList
;
procedureCall:
CALL brakeArg stringArg (brakeArg mathStatement)* brakeArg?;
//operation commands
repeat:
REPEAT brakeArg mathStatement brakeArg commandsList ;
while1:
WHILE brakeArg mathStatement brakeArg commandsList ;
//number commands
back:
BACK brakeArg mathStatement
;
forward:
FORWARD brakeArg mathStatement
;
left:
LEFT brakeArg mathStatement
;
right:
RIGHT brakeArg mathStatement
;
setcolor:
SETCOLOR brakeArg mathStatement
;
setpensize:
SETPENSIZE brakeArg mathStatement
;
//word commands
newTurtle:
NEWTURTLE brakeArg stringArg
;
rename:
RENAME brakeArg stringArg
;
changeTurtle:
CHANGETURTLE brakeArg stringArg
;
removeTurtle:
REMOVE brakeArg stringArg
;
ifc:
IF brakeArg mathStatement brakeArg commandsList
;
ifElse:
IFELSE brakeArg mathStatement brakeArg commandsList brakeArg commandsList
;
//just commands
home:
HOME
;
clean:
CLEAN
;
pd:
PD
;
pu:
PU
;
//list commands
let:
LET brakeArg variableName brakeArg mathStatement brakeArg?
;
assign:
ASSIGN brakeArg variableName brakeArg mathStatement brakeArg?
;
//word list commands
spaceArg:
(WHITESPACE)+
;
newLineArg:
NEWLINE+
;
brakeArg:
(spaceArg | newLineArg)+
;
endFileArg:
EOF
;
commandsList:
cmd
| '['brakeArg? line+ brakeArg?']'
| '{'brakeArg? line+ brakeArg?'}'
;
//LEXER
//ALL LETERS
fragment LOWERCASE:
[a-z]
;
fragment UPPERCASE:
[A-Z]
;
//Digit fragment
fragment DIGIT:
[0-9]
;
SPECIAL_WORD:
'GETX' | 'getx'
| 'GETY' | 'gety'
;
//COMMANDS MOVING xx1xx DONE
BACK:
'BACK'
|'back'
|'BK'
|'bk'
;
FORWARD:
'FORWARD'
| 'FD'
| 'forward'
| 'fd'
;
HOME:
'HOME'
| 'home'
;
LEFT:
'LEFT'
| 'left'
| 'LT'
| 'lt'
;
RIGHT:
'RIGHT'
| 'RT'
| 'right'
| 'rt'
;
CLEAN:
'CLEAN'
| 'clean'
;
PD:
'PD'
| 'pd'
;
PU:
'PU'
| 'pu'
;
SETPENSIZE:
'SETPENSIZE'
| 'setpensize'
;
SETCOLOR:
'SETCOLOR'
| 'setcolor'
;
//commands number and maths xx6xx DONE
ABS:
'ABS'
| 'abs'
;
ARCTAN:
'ARCTAN'
| 'arctan'
;
COS:
'COS'
| 'cos'
;
DIFFERENCE:
'!='
;
EXP:
'EXP'
| 'exp'
;
INT:
'INT'
| 'int'
;
LN:
'LN'
| 'ln'
;
LOG:
'LOG'
| 'log'
;
MINUS:
'-'
;
PI:
'PI'
| 'pi'
;
POWER:
'POW'
| 'pow'
| '^'
;
PRODUCT:
'*'
;
QUOTIENT:
'QUOTIENT'
| 'quotient'
;
RANDOM:
'RANDOM'
| 'random'
;
REMAINDER:
'REMAINDER'
| 'remainder'
| '%'
;
ROUND:
'ROUND'
| 'round'
;
SIN:
'SIN'
| 'sin'
;
SQRT:
'SQRT'
| 'sqrt'
;
SUM:
'+'
;
TAN:
'TAN'
| 'tan'
;
COMPARISONEQUALS:
'=='
;
COMPARISONBIGGER:
'>'
;
COMPARISONSMALLER:
'<'
;
COMPARISONSMALLEREQUALS:
'<='
| '=<'
;
COMPARISONBIGGEREQUALS:
'>='
| '=>'
;
NEWTURTLE:
'NEWTURTLE'
| 'newturtle'
;
RENAME:
'RENAME'
| 'rename'
;
REMOVE:
'REMOVETURTLE'
| 'removeturtle'
;
CHANGETURTLE:
'changeturtle'
| 'CHANGETURTLE'
;
SET:
'SET'
| 'set'
;
//commands Variables xx9xx DONE
LET:
'LET'
| 'let'
;
ASSIGN:
'ASSIGN'
| 'assign'
;
//commands logic xxx11xx DONE
AND:
'AND'
| 'and'
| '&&'
;
IF:
'IF'
| 'if'
;
IFELSE:
'IFELSE'
| 'ifelse'
;
NOT:
'NOT'
|'not'
| '!'
;
OR:
'OR'
| 'or'
| '||'
;
//commands interaction xxx12xx
//commands Control and events xxx13xx
REPEAT:
'REPEAT'
| 'repeat'
;
WHILE:
'WHILE'
| 'while'
;
PROCEDURE:
'PROCEDURE'
| 'procedure'
| 'PRD'
| 'prd'
;
CALL :
'CALL'
| 'call';
DIVISION:
'/'
;
COMMENTBRACKET:
'#'
;
NATURALNUMBER:
DIGIT+;
FLOATNUMBER:
DIGIT+ ([.,] DIGIT+)?;
BOOLEAN:
'true'
| 'True'
| 'false'
| 'False';
//ADDITIONS
OTHERWORD:
(LOWERCASE | UPPERCASE |'_')+
;
WHITESPACE:
' '
| '\t'
;
NEWLINE:
'\r'? '\n'
| '\r';
|
source/s-syncon.ads
|
ytomino/drake
| 33 |
24402
|
pragma License (Unrestricted);
-- runtime unit
package System.Synchronous_Control is
pragma Preelaborate;
-- no-operation
procedure Nop is null;
-- yield
type Yield_Handler is access procedure;
pragma Favor_Top_Level (Yield_Handler);
Yield_Hook : not null Yield_Handler := Nop'Access;
procedure Yield;
-- abortable region control
type Unlock_Abort_Handler is access procedure;
pragma Favor_Top_Level (Unlock_Abort_Handler);
Unlock_Abort_Hook : not null Unlock_Abort_Handler := Nop'Access;
-- enter abortable region (default is unabortable)
-- also, implementation of System.Standard_Library.Abort_Undefer_Direct
procedure Unlock_Abort
with Export,
Convention => Ada,
External_Name => "system__standard_library__abort_undefer_direct";
type Lock_Abort_Handler is access procedure;
pragma Favor_Top_Level (Lock_Abort_Handler);
Lock_Abort_Hook : not null Lock_Abort_Handler := Nop'Access;
-- leave abortable region
procedure Lock_Abort;
end System.Synchronous_Control;
|
calculator/src/main/antlr/org/example/gka/math/Math.g4
|
rm3dom/Calculator
| 0 |
3355
|
<reponame>rm3dom/Calculator<filename>calculator/src/main/antlr/org/example/gka/math/Math.g4
/*
* Math Rules
*/
grammar Math;
@header {
package org.example.gka.math;
}
math: scalar | linear | EOF;
linear: (scalar | term) sumop (scalar | term | linear) ;
scalar: term scaleop (term | scalar);
term : number | '(' math ')';
sumop
: PLUS
| MINUS
;
scaleop
: MULTIPLY
| DIVIDE
;
number: NUMBER;
PLUS : '+' ;
MINUS : '-' ;
MULTIPLY : '*' ;
DIVIDE : '/' ;
NUMBER : [0-9\\.]+ ;
WS : [ \r\n\t]+ -> skip ;
|
CloverEFI/BootSector/efi32.nasm
|
crazyinsanejames/CloverBootloader
| 3,861 |
246575
|
<filename>CloverEFI/BootSector/efi32.nasm
DEFAULT_HANDLER_SIZE: equ 9 ; size of exception/interrupt stub
SYS_CODE_SEL: equ 0x20 ; 32-bit code selector in GDT
PE_OFFSET_IN_MZ_STUB: equ 0x3c ; place in MsDos stub for offset to PE Header
VGA_FB: equ 0x000b8000 ; VGA framebuffer for 80x25 mono mode
VGA_LINE: equ 80 * 2 ; # bytes in one line
BASE_ADDR_32: equ 0x00021000
STACK_TOP: equ 0x001ffff0
SIZE: equ 0x1000
struc EFILDR_IMAGE
.CheckSum: resd 1
.Offset: resd 1
.Length: resd 1
.FileName: resb 52
endstruc
struc EFILDR_HEADER
.Signature: resd 1
.HeaderCheckSum: resd 1
.FileLength: resd 1
.NumberOfImages: resd 1
endstruc
struc PE_HEADER
resb 6
.NumberOfSections: resw 1
resb 12
.SizeOfOptionalHeader: resw 1
resb 2
.Magic: resb 16
.AddressOfEntryPoint: resd 1
resb 8
.ImageBase32: resd 1
endstruc
struc PE_SECTION_HEADER
resb 12
.VirtualAddress: resd 1
.SizeOfRawData: resd 1
.PointerToRawData: resd 1
resb 16
endstruc
%macro StubWithNoCode 1
push 0 ; push error code place holder on the stack
push %1
jmp strict dword commonIdtEntry
%endmacro
%macro StubWithACode 1
times 2 nop
push %1
jmp strict dword commonIdtEntry
%endmacro
%macro PrintReg 2
mov esi, %1
call PrintString
mov eax, [ebp + %2]
call PrintDword
%endmacro
bits 32
org BASE_ADDR_32
global _start
_start:
mov ax, bx
mov ds, eax
mov es, eax
mov fs, eax
mov gs, eax
mov ss, eax
mov esp, STACK_TOP
;
; Populate IDT with meaningful offsets for exception handlers...
;
sidt [Idtr]
mov eax, StubTable
mov ebx, eax ; use bx to copy 15..0 to descriptors
shr eax, 16 ; use ax to copy 31..16 to descriptors
mov ecx, 0x78 ; 78h IDT entries to initialize with unique entry points
mov edi, [Idtr + 2]
.StubLoop: ; loop through all IDT entries exception handlers and initialize to default handler
mov [edi], bx ; write bits 15..0 of offset
mov word [edi + 2], SYS_CODE_SEL ; SYS_CODE_SEL from GDT
mov word [edi + 4], 0x8e00 ; type = 386 interrupt gate, present
mov [edi + 6], ax ; write bits 31..16 of offset
add edi, 8 ; move up to next descriptor
add ebx, DEFAULT_HANDLER_SIZE ; move to next entry point
loop .StubLoop ; loop back through again until all descriptors are initialized
;
; Load EFILDR
;
mov esi, BlockSignature + 2
add esi, [esi + EFILDR_HEADER_size + EFILDR_IMAGE.Offset] ; esi = Base of EFILDR.C
mov ebp, [esi + PE_OFFSET_IN_MZ_STUB]
add ebp, esi ; ebp = PE Image Header for EFILDR.C
mov edi, [ebp + PE_HEADER.ImageBase32] ; edi = ImageBase
mov eax, [ebp + PE_HEADER.AddressOfEntryPoint] ; eax = EntryPoint
add eax, edi ; eax = ImageBase + EntryPoint
mov [.EfiLdrOffset], eax ; Modify jump instruction for correct entry point
movzx ebx, word [ebp + PE_HEADER.NumberOfSections] ; bx = Number of sections
movzx eax, word [ebp + PE_HEADER.SizeOfOptionalHeader]; ax = Optional Header Size
add ebp, eax
add ebp, PE_HEADER.Magic ; ebp = Start of 1st Section
.SectionLoop:
push esi ; Save Base of EFILDR.C
push edi ; Save ImageBase
add esi, [ebp + PE_SECTION_HEADER.PointerToRawData] ; esi = Base of EFILDR.C + PointerToRawData
add edi, [ebp + PE_SECTION_HEADER.VirtualAddress] ; edi = ImageBase + VirtualAddress
mov ecx, [ebp + PE_SECTION_HEADER.SizeOfRawData] ; ecx = SizeOfRawData
cld
shr ecx, 2
rep movsd
pop edi ; Restore ImageBase
pop esi ; Restore Base of EFILDR.C
add ebp, PE_SECTION_HEADER_size ; ebp = Pointer to next section record
dec ebx
jnz .SectionLoop
movzx eax, word [Idtr] ; get size of IDT
inc eax
add eax, [Idtr + 2] ; add to base of IDT to get location of memory map...
push eax ; push memory map location on stack for call to EFILDR...
push eax ; push return address (useless, just for stack balance)
.EfiLdrOffset: equ $ + 1
mov eax, 0x00401000
jmp eax ; jump to entry point
StubTable:
%assign i 0
%rep 8
StubWithNoCode i
%assign i i+1
%endrep
StubWithACode 8 ; Double Fault
StubWithNoCode 9
StubWithACode 10 ; Invalid TSS
StubWithACode 11 ; Segment Not Present
StubWithACode 12 ; Stack Fault
StubWithACode 13 ; GP Fault
StubWithACode 14 ; Page Fault
StubWithNoCode 15
StubWithNoCode 16
StubWithACode 17 ; Alignment Check
%assign i 18
%rep 102
StubWithNoCode i
%assign i i+1
%endrep
commonIdtEntry:
pushad
mov ebp, esp
;
; At this point the stack looks like this:
;
; eflags
; Calling CS
; Calling EIP
; Error code or 0
; Int num or 0ffh for unknown int num
; eax
; ecx
; edx
; ebx
; esp
; ebp
; esi
; edi <------- ESP, EBP
;
; call ClearScreen
mov edi, VGA_FB
mov esi, String1
call PrintString
mov eax, [ebp + 8 * 4] ; move Int number into EAX
cmp eax, 19
ja .PrintDefaultString
mov esi, [eax * 4 + StringTable] ; get offset from StringTable to actual string address
jmp .PrintTheString
.PrintDefaultString:
mov esi, IntUnknownString
; patch Int number
mov edx, eax
call A2C
mov [esi + 1], al
mov eax, edx
shr eax, 4
call A2C
mov [esi], al
.PrintTheString:
call PrintString
PrintReg String2, 11 * 4 ; CS
mov byte [edi], ':'
add edi, 2
mov eax, [ebp + 10 * 4] ; EIP
call PrintDword
mov esi, String3
call PrintString
mov edi, VGA_FB + 2 * VGA_LINE
PrintReg StringEax, 7 * 4
PrintReg StringEbx, 4 * 4
PrintReg StringEcx, 6 * 4
PrintReg StringEdx, 5 * 4
PrintReg StringEcode, 9 * 4
mov edi, VGA_FB + 3 * VGA_LINE
PrintReg StringEsp, 3 * 4
PrintReg StringEbp, 2 * 4
PrintReg StringEsi, 4
PrintReg StringEdi, 0
PrintReg StringEflags, 12 * 4
mov edi, VGA_FB + 5 * VGA_LINE
mov esi, ebp
add esi, 13 * 4 ; stack beyond eflags
mov ecx, 8
.OuterLoop:
push ecx
mov ecx, 8
mov edx, edi
.InnerLoop:
mov eax, [esi]
call PrintDword
add esi, 4
mov byte [edi], ' '
add edi, 2
loop .InnerLoop
pop ecx
add edx, VGA_LINE
mov edi, edx
loop .OuterLoop
mov edi, VGA_FB + 15 * VGA_LINE
mov esi, [ebp + 10 * 4] ; EIP
sub esi, 32 * 4 ; code preceding EIP
mov ecx, 8
.OuterLoop1:
push ecx
mov ecx, 8
mov edx, edi
.InnerLoop1:
mov eax, [esi]
call PrintDword
add esi, 4
mov byte [edi], ' '
add edi, 2
loop .InnerLoop1
pop ecx
add edx, VGA_LINE
mov edi, edx
loop .OuterLoop1
.Halt:
hlt
jmp .Halt
;
; Return
;
mov esp, ebp
popad
add esp, 8 ; error code and INT number
iretd
PrintString:
push eax
.loop:
mov al, [esi]
test al, al
jz .done
mov [edi], al
inc esi
add edi, 2
jmp .loop
.done:
pop eax
ret
; EAX contains dword to print
; EDI contains memory location (screen location) to print it to
PrintDword:
push ecx
push ebx
push eax
mov ecx, 8
.looptop:
rol eax, 4
mov bl, al
and bl, 15
add bl, '0'
cmp bl, '9'
jbe .is_digit
add bl, 7
.is_digit:
mov [edi], bl
add edi, 2
loop .looptop
pop eax
pop ebx
pop ecx
ret
ClearScreen:
push eax
push ecx
mov ax, 0x0c20
mov edi, VGA_FB
mov ecx, 80 * 25
rep stosw
mov edi, VGA_FB
pop ecx
pop eax
ret
A2C:
and al, 15
add al, '0'
cmp al, '9'
jbe .is_digit
add al, 7
.is_digit:
ret
String1: db '*** INT ', 0
Int0String: db '00h Divide by 0 -', 0
Int1String: db '01h Debug exception -', 0
Int2String: db '02h NMI -', 0
Int3String: db '03h Breakpoint -', 0
Int4String: db '04h Overflow -', 0
Int5String: db '05h Bound -', 0
Int6String: db '06h Invalid opcode -', 0
Int7String: db '07h Device not available -', 0
Int8String: db '08h Double fault -', 0
Int9String: db '09h Coprocessor seg overrun (reserved) -', 0
Int10String: db '0Ah Invalid TSS -', 0
Int11String: db '0Bh Segment not present -', 0
Int12String: db '0Ch Stack fault -', 0
Int13String: db '0Dh General protection fault -', 0
Int14String: db '0Eh Page fault -', 0
Int15String: db '0Fh (Intel reserved) -', 0
Int16String: db '10h Floating point error -', 0
Int17String: db '11h Alignment check -', 0
Int18String: db '12h Machine check -', 0
Int19String: db '13h SIMD Floating-Point Exception -', 0
IntUnknownString: db '??h Unknown interrupt -', 0
align 4, db 0
StringTable:
%assign i 0
%rep 20
dd Int%[i]String
%assign i i+1
%endrep
String2: db ' HALT!! *** (', 0
String3: db ')', 0
StringEax: db 'EAX=', 0
StringEbx: db ' EBX=', 0
StringEcx: db ' ECX=', 0
StringEdx: db ' EDX=', 0
StringEcode: db ' ECODE=', 0
StringEsp: db 'ESP=', 0
StringEbp: db ' EBP=', 0
StringEsi: db ' ESI=', 0
StringEdi: db ' EDI=', 0
StringEflags: db ' EFLAGS=', 0
align 2, db 0
Idtr:
times SIZE - 2 - $ + $$ db 0
BlockSignature:
dw 0xaa55
|
sorter.adb
|
ddugovic/words
| 4 |
507
|
with TEXT_IO;
with DIRECT_IO;
with STRINGS_PACKAGE; use STRINGS_PACKAGE;
with INFLECTIONS_PACKAGE; use INFLECTIONS_PACKAGE;
with DICTIONARY_PACKAGE; use DICTIONARY_PACKAGE;
procedure SORTER is
-- This program sorts a file of lines (strings) on 5 substrings Mx..Nx
-- Sort by stringwise (different cases), numeric, or POS enumeration
package BOOLEAN_IO is new TEXT_IO.ENUMERATION_IO(BOOLEAN);
use BOOLEAN_IO;
package INTEGER_IO is new TEXT_IO.INTEGER_IO(INTEGER);
use INTEGER_IO;
package FLOAT_IO is new TEXT_IO.FLOAT_IO(FLOAT);
use FLOAT_IO;
use TEXT_IO;
NAME_LENGTH : constant := 80;
ST, ENTER_LINE : STRING(1..NAME_LENGTH) := (others => ' ');
LS, LAST : INTEGER := 0;
INPUT_NAME : STRING(1..80) := (others => ' ');
LINE_LENGTH : constant := 300; -- ##################################
-- Max line length on input file
-- Shorter => less disk space to sort
CURRENT_LENGTH : INTEGER := 0;
subtype TEXT_TYPE is STRING(1..LINE_LENGTH);
--type LINE_TYPE is
-- record
-- CURRENT_LENGTH : CURRENT_LINE_LENGTH_TYPE := 0;
-- TEXT : TEXT_TYPE;
-- end record;
package LINE_IO is new DIRECT_IO(TEXT_TYPE);
use LINE_IO;
BLANK_TEXT : TEXT_TYPE := (others => ' ');
LINE_TEXT : TEXT_TYPE := BLANK_TEXT;
OLD_LINE : TEXT_TYPE := BLANK_TEXT;
P_LINE : TEXT_TYPE := BLANK_TEXT;
type SORT_TYPE is (A, C, G, U, N, F, P, R, S);
package SORT_TYPE_IO is new TEXT_IO.ENUMERATION_IO(SORT_TYPE);
use SORT_TYPE_IO;
type WAY_TYPE is (I, D);
package WAY_TYPE_IO is new TEXT_IO.ENUMERATION_IO(WAY_TYPE);
use WAY_TYPE_IO;
INPUT : TEXT_IO.FILE_TYPE;
OUTPUT : TEXT_IO.FILE_TYPE;
WORK : LINE_IO.FILE_TYPE;
M1, M2, M3, M4, M5 : NATURAL := 1;
N1, N2, N3, N4, N5 : NATURAL := LINE_LENGTH;
Z1, Z2, Z3, Z4, Z5 : NATURAL := 0;
S1, S2, S3, S4, S5 : SORT_TYPE := A;
W1, W2, W3, W4, W5 : WAY_TYPE := I;
ENTRY_FINISHED : exception;
-- For section numbering of large documents and standards
type SECTION_TYPE is
record
FIRST_LEVEL : INTEGER := 0;
SECOND_LEVEL : INTEGER := 0;
THIRD_LEVEL : INTEGER := 0;
FOURTH_LEVEL : INTEGER := 0;
FIFTH_LEVEL : INTEGER := 0;
end record;
NO_SECTION : constant SECTION_TYPE := (0, 0, 0, 0, 0);
type APPENDIX_TYPE is (NONE, A, B, C, D, E, F, G, H, I, J, K, L, M,
N, O, P, Q, R, S, T, U, V, W, X, Y, Z);
package APPENDIX_IO is new TEXT_IO.ENUMERATION_IO(APPENDIX_TYPE);
type APPENDIX_SECTION_TYPE is record
APPENDIX : APPENDIX_TYPE := NONE;
SECTION : SECTION_TYPE := NO_SECTION;
end record;
NO_APPENDIX_SECTION : constant APPENDIX_SECTION_TYPE :=
(NONE, (0, 0, 0, 0, 0));
-- procedure PUT(OUTPUT : TEXT_IO.FILE_TYPE; S : SECTION_TYPE);
-- procedure PUT(S : SECTION_TYPE);
-- procedure GET(FROM : in STRING;
-- S : out SECTION_TYPE; LAST : out POSITIVE);
-- function "<"(A, B : SECTION_TYPE) return BOOLEAN;
--
-- procedure PUT(OUTPUT : TEXT_IO.FILE_TYPE; S : APPENDIX_SECTION_TYPE);
-- procedure PUT(S : APPENDIX_SECTION_TYPE);
-- procedure GET(FROM : in STRING;
-- S : out APPENDIX_SECTION_TYPE; LAST : out POSITIVE);
-- function "<"(A, B : APPENDIX_SECTION_TYPE) return BOOLEAN;
--
procedure PUT(OUTPUT : TEXT_IO.FILE_TYPE; S : SECTION_TYPE) is
LEVEL : INTEGER := 0;
procedure PUT_LEVEL(OUTPUT : TEXT_IO.FILE_TYPE; L : INTEGER) is
begin
if L > 9999 then
PUT(OUTPUT, "****");
elsif L > 999 then
PUT(OUTPUT, L, 4);
elsif L > 99 then
PUT(OUTPUT, L, 3);
elsif L > 9 then
PUT(OUTPUT, L, 2);
elsif L >= 0 then
PUT(OUTPUT, L, 1);
else
PUT(OUTPUT, "**");
end if;
end PUT_LEVEL;
begin
if S.FIFTH_LEVEL <= 0 then
if S.FOURTH_LEVEL <= 0 then
if S.THIRD_LEVEL <= 0 then
if S.SECOND_LEVEL <= 0 then
LEVEL := 1;
else
LEVEL := 2;
end if;
else
LEVEL := 3;
end if;
else
LEVEL := 4;
end if;
else
LEVEL := 5;
end if;
if S.FIRST_LEVEL <= 9 then
PUT(OUTPUT, ' ');
end if;
PUT_LEVEL(OUTPUT, S.FIRST_LEVEL);
if LEVEL = 1 then
PUT(OUTPUT, '.');
PUT(OUTPUT, '0'); -- To match the ATLAS index convention
end if;
if LEVEL >= 2 then
PUT(OUTPUT, '.');
PUT_LEVEL(OUTPUT, S.SECOND_LEVEL);
end if;
if LEVEL >= 3 then
PUT(OUTPUT, '.');
PUT_LEVEL(OUTPUT, S.THIRD_LEVEL);
end if;
if LEVEL >= 4 then
PUT(OUTPUT, '.');
PUT_LEVEL(OUTPUT, S.FOURTH_LEVEL);
end if;
if LEVEL >= 5 then
PUT(OUTPUT, '.');
PUT_LEVEL(OUTPUT, S.FIFTH_LEVEL);
end if;
end PUT;
procedure PUT(S : SECTION_TYPE) is
LEVEL : INTEGER := 0;
procedure PUT_LEVEL(L : INTEGER) is
begin
if L > 9999 then
PUT("****");
elsif L > 999 then
PUT(L, 4);
elsif L > 99 then
PUT(L, 3);
elsif L > 9 then
PUT(L, 2);
elsif L >= 0 then
PUT(L, 1);
else
PUT("**");
end if;
end PUT_LEVEL;
begin
if S.FIFTH_LEVEL = 0 then
if S.FOURTH_LEVEL = 0 then
if S.THIRD_LEVEL = 0 then
if S.SECOND_LEVEL = 0 then
LEVEL := 1;
else
LEVEL := 2;
end if;
else
LEVEL := 3;
end if;
else
LEVEL := 4;
end if;
else
LEVEL := 5;
end if;
if S.FIRST_LEVEL <= 9 then
PUT(' ');
end if;
PUT_LEVEL(S.FIRST_LEVEL);
PUT('.');
if LEVEL = 1 then
PUT('0'); -- To match the ATLAS index convention
end if;
if LEVEL >= 2 then
PUT_LEVEL(S.SECOND_LEVEL);
end if;
if LEVEL >= 3 then
PUT('.');
PUT_LEVEL(S.THIRD_LEVEL);
end if;
if LEVEL >= 4 then
PUT('.');
PUT_LEVEL(S.FOURTH_LEVEL);
end if;
if LEVEL >= 5 then
PUT('.');
PUT_LEVEL(S.FIFTH_LEVEL);
end if;
end PUT;
procedure GET(FROM : in STRING;
S : out SECTION_TYPE; LAST : out INTEGER) is
L : INTEGER := 0;
FT : INTEGER := FROM'FIRST;
LT : INTEGER := FROM'LAST;
begin
S := NO_SECTION;
if TRIM(FROM)'LAST < FROM'FIRST then
return; -- Empty string, no data -- Return default
end if;
GET(FROM, S.FIRST_LEVEL, L);
if L+1 >= LT then
LAST := L;
return;
end if;
GET(FROM(L+2..LT), S.SECOND_LEVEL, L);
if L+1 >= LT then
LAST := L;
return;
end if;
GET(FROM(L+2..LT), S.THIRD_LEVEL, L);
if L+1 >= LT then
LAST := L;
return;
end if;
GET(FROM(L+2..LT), S.FOURTH_LEVEL, L);
if L+1 >= LT then
LAST := L;
return;
end if;
GET(FROM(L+2..LT), S.FIFTH_LEVEL, L);
LAST := L;
return;
exception
when TEXT_IO.END_ERROR =>
LAST := L;
return;
when TEXT_IO.DATA_ERROR =>
LAST := L;
return;
when others =>
PUT(" Unexpected exception in GET(FROM; SECTION_TYPE) with input =>");
PUT(FROM);
NEW_LINE;
LAST := L;
raise;
end GET;
function "<"(A, B : SECTION_TYPE) return BOOLEAN is
begin
if A.FIRST_LEVEL > B.FIRST_LEVEL then
return FALSE;
elsif A.FIRST_LEVEL < B.FIRST_LEVEL then
return TRUE;
else
if A.SECOND_LEVEL > B.SECOND_LEVEL then
return FALSE;
elsif A.SECOND_LEVEL < B.SECOND_LEVEL then
return TRUE;
else
if A.THIRD_LEVEL > B.THIRD_LEVEL then
return FALSE;
elsif A.THIRD_LEVEL < B.THIRD_LEVEL then
return TRUE;
else
if A.FOURTH_LEVEL > B.FOURTH_LEVEL then
return FALSE;
elsif A.FOURTH_LEVEL < B.FOURTH_LEVEL then
return TRUE;
else
if A.FIFTH_LEVEL > B.FIFTH_LEVEL then
return FALSE;
elsif A.FIFTH_LEVEL < B.FIFTH_LEVEL then
return TRUE;
else
return FALSE;
end if;
end if;
end if;
end if;
end if;
return FALSE;
end "<";
procedure PUT(OUTPUT : TEXT_IO.FILE_TYPE; S : APPENDIX_SECTION_TYPE) is
use APPENDIX_IO;
begin
PUT(OUTPUT, S.APPENDIX);
PUT(OUTPUT, ' ');
PUT(OUTPUT, S.SECTION);
end PUT;
procedure PUT(S : APPENDIX_SECTION_TYPE) is
use APPENDIX_IO;
begin
PUT(S.APPENDIX);
PUT(' ');
PUT(S.SECTION);
end PUT;
procedure GET(FROM : in STRING;
S : out APPENDIX_SECTION_TYPE; LAST : out INTEGER) is
use APPENDIX_IO;
L : INTEGER := 0;
FT : INTEGER := FROM'FIRST;
LT : INTEGER := FROM'LAST;
begin
S := NO_APPENDIX_SECTION;
if (FT = LT) or else
(TRIM(FROM)'LENGTH = 0) then -- Empty/blank string, no data
PUT("@");
return; -- Return default
end if;
--PUT_LINE("In GET =>" & FROM & '|');
begin
GET(FROM, S.APPENDIX, L);
--PUT("A");
if L+1 >= LT then
LAST := L;
return;
end if;
exception
when others =>
S.APPENDIX := NONE;
L := FT - 2;
end;
-- PUT("B");
-- GET(FROM(L+2..LT), S.SECTION.FIRST_LEVEL, L);
-- if L+1 >= LT then
-- LAST := L;
-- return;
-- end if;
--PUT("C");
-- GET(FROM(L+2..LT), S.SECTION.SECOND_LEVEL, L);
-- if L+1 >= LT then
-- LAST := L;
-- return;
-- end if;
--PUT("D");
-- GET(FROM(L+2..LT), S.SECTION.THIRD_LEVEL, L);
-- if L+1 >= LT then
-- LAST := L;
-- return;
-- end if;
--PUT("E");
-- GET(FROM(L+2..LT), S.SECTION.FOURTH_LEVEL, L);
-- if L+1 >= LT then
-- LAST := L;
-- return;
-- end if;
--PUT("F");
-- GET(FROM(L+2..LT), S.SECTION.FIFTH_LEVEL, L);
-- LAST := L;
--PUT("G");
GET(FROM(L+2..LT), S.SECTION, L);
--PUT("F");
return;
exception
when TEXT_IO.END_ERROR =>
LAST := L;
return;
when TEXT_IO.DATA_ERROR =>
LAST := L;
return;
when others =>
PUT
(" Unexpected exception in GET(FROM; APPENDIX_SECTION_TYPE) with input =>");
PUT(FROM);
NEW_LINE;
LAST := L;
return;
end GET;
function "<"(A, B : APPENDIX_SECTION_TYPE) return BOOLEAN is
begin
if A.APPENDIX > B.APPENDIX then
return FALSE;
elsif A.APPENDIX < B.APPENDIX then
return TRUE;
else
if A.SECTION.FIRST_LEVEL > B.SECTION.FIRST_LEVEL then
return FALSE;
elsif A.SECTION.FIRST_LEVEL < B.SECTION.FIRST_LEVEL then
return TRUE;
else
if A.SECTION.SECOND_LEVEL > B.SECTION.SECOND_LEVEL then
return FALSE;
elsif A.SECTION.SECOND_LEVEL < B.SECTION.SECOND_LEVEL then
return TRUE;
else
if A.SECTION.THIRD_LEVEL > B.SECTION.THIRD_LEVEL then
return FALSE;
elsif A.SECTION.THIRD_LEVEL < B.SECTION.THIRD_LEVEL then
return TRUE;
else
if A.SECTION.FOURTH_LEVEL > B.SECTION.FOURTH_LEVEL then
return FALSE;
elsif A.SECTION.FOURTH_LEVEL < B.SECTION.FOURTH_LEVEL then
return TRUE;
else
if A.SECTION.FIFTH_LEVEL > B.SECTION.FIFTH_LEVEL then
return FALSE;
elsif A.SECTION.FIFTH_LEVEL < B.SECTION.FIFTH_LEVEL then
return TRUE;
else
return FALSE;
end if;
end if;
end if;
end if;
end if;
end if;
end "<";
procedure PROMPT_FOR_ENTRY(ENTRY_NUMBER : STRING) is
begin
PUT("Give starting column and size of ");
PUT(ENTRY_NUMBER);
PUT_LINE(" significant sort field ");
PUT(" with optional sort type and way => ");
end PROMPT_FOR_ENTRY;
procedure GET_ENTRY (MX, NX : out NATURAL;
SX : out SORT_TYPE;
WX : out WAY_TYPE ) is
M : NATURAL := 1;
N : NATURAL := LINE_LENGTH;
S : SORT_TYPE := A;
W : WAY_TYPE := I;
Z : NATURAL := 0;
procedure ECHO_ENTRY is
begin
PUT(" Sorting on LINE("); PUT(M,3);
PUT(".."); PUT(N, 3); PUT(")");
PUT(" with S = "); PUT(S); PUT(" and W = "); PUT(W);
NEW_LINE(2);
end ECHO_ENTRY;
begin
M := 0;
N := LINE_LENGTH;
S := A;
W := I;
GET_LINE(ENTER_LINE, LS);
if LS = 0 then
raise ENTRY_FINISHED;
end if;
INTEGER_IO.GET(ENTER_LINE(1..LS), M, LAST);
begin
INTEGER_IO.GET(ENTER_LINE(LAST+1..LS), Z, LAST);
if M = 0 or Z = 0 then
PUT_LINE("Start or size of zero, you must be kidding, aborting");
raise PROGRAM_ERROR;
elsif M + Z > LINE_LENGTH then
PUT_LINE("Size too large, going to end of line");
N := LINE_LENGTH;
else
N := M + Z - 1;
end if;
SORT_TYPE_IO.GET(ENTER_LINE(LAST+1..LS), S, LAST);
WAY_TYPE_IO.GET(ENTER_LINE(LAST+1..LS), W, LAST);
MX := M; NX := N; SX := S; WX := W;
ECHO_ENTRY;
return;
exception
when PROGRAM_ERROR =>
PUT_LINE("PROGRAM_ERROR raised in GET_ENTRY");
raise;
when others =>
MX := M; NX := N; SX := S; WX := W;
ECHO_ENTRY;
return;
end;
end GET_ENTRY;
function IGNORE_SEPARATORS(S : STRING) return STRING is
T : STRING(S'FIRST..S'LAST) := LOWER_CASE(S);
begin
for I in S'FIRST+1..S'LAST-1 loop
if (S(I-1) /= '-' and then S(I-1) /= '_') and then
(S(I) = '-' or else S(I) = '_') and then
(S(I+1) /= '-' and then S(I+1) /= '_') then
T(I) := ' ';
end if;
end loop;
return T;
end IGNORE_SEPARATORS;
function LTU(C, D : CHARACTER) return BOOLEAN is
begin
if (D = 'v') then
if (C < 'u') then
return TRUE;
else
return FALSE;
end if;
elsif (D = 'j') then
if (C < 'i') then
return TRUE;
else
return FALSE;
end if;
elsif (D = 'V') then
if (C < 'U') then
return TRUE;
else
return FALSE;
end if;
elsif (D = 'J') then
if (C < 'I') then
return TRUE;
else
return FALSE;
end if;
else
return C < D;
end if;
end LTU;
function EQU(C, D : CHARACTER) return BOOLEAN is
begin
if (D = 'u') or (D = 'v') then
if (C = 'u') or (C = 'v') then
return TRUE;
else
return FALSE;
end if;
elsif (D = 'i') or (D = 'j') then
if (C = 'i') or (C = 'j') then
return TRUE;
else
return FALSE;
end if;
elsif (D = 'U') or (D = 'V') then
if (C = 'U') or (C = 'V') then
return TRUE;
else
return FALSE;
end if;
elsif (D = 'I') or (D = 'J') then
if (C = 'I') or (C = 'J') then
return TRUE;
else
return FALSE;
end if;
else
return C = D;
end if;
end EQU;
function GTU(C, D : CHARACTER) return BOOLEAN is
begin
if D = 'u' then
if (C > 'v') then
return TRUE;
else
return FALSE;
end if;
elsif D = 'i' then
if (C > 'j') then
return TRUE;
else
return FALSE;
end if;
elsif D = 'U' then
if (C > 'V') then
return TRUE;
else
return FALSE;
end if;
elsif D = 'I' then
if (C > 'J') then
return TRUE;
else
return FALSE;
end if;
else
return C > D;
end if;
end GTU;
function LTU(S, T : STRING) return BOOLEAN is
begin
for I in 1..S'LENGTH loop -- Not TRIMed, so same length
if EQU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then
null;
elsif GTU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then
return FALSE;
elsif LTU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then
return TRUE;
end if;
end loop;
return FALSE;
end LTU;
function GTU(S, T : STRING) return BOOLEAN is
begin
for I in 1..S'LENGTH loop
if EQU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then
null;
elsif LTU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then
return FALSE;
elsif GTU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then
return TRUE;
end if;
end loop;
return FALSE;
end GTU;
function EQU(S, T : STRING) return BOOLEAN is
begin
if S'LENGTH /= T'LENGTH then
return FALSE;
end if;
for I in 1..S'LENGTH loop
if not EQU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then
return FALSE;
end if;
end loop;
return TRUE;
end EQU;
function SLT (X, Y : STRING; -- Make LEFT and RIGHT
ST : SORT_TYPE := A;
WT : WAY_TYPE := I) return BOOLEAN is
AS : STRING(X'RANGE) := X;
BS : STRING(Y'RANGE) := Y;
MN, NN : INTEGER := 0;
FN, GN : FLOAT := 0.0;
--FS, GS : SECTION_TYPE := NO_SECTION;
FS, GS : APPENDIX_SECTION_TYPE := NO_APPENDIX_SECTION;
PX, PY : PART_ENTRY; -- So I can X here
RX, RY : PART_OF_SPEECH_TYPE; -- So I can X here
begin
if ST = A then
AS := LOWER_CASE(AS);
BS := LOWER_CASE(BS);
if WT = I then
return AS < BS;
else
return AS > BS;
end if;
elsif ST = C then
if WT = I then
return AS < BS;
else
return AS > BS;
end if;
elsif ST = G then
AS := IGNORE_SEPARATORS(AS);
BS := IGNORE_SEPARATORS(BS);
if WT = I then
return AS < BS;
else
return AS > BS;
end if;
elsif ST = U then
AS := LOWER_CASE(AS);
BS := LOWER_CASE(BS);
if WT = I then
return LTU(AS, BS);
else
return GTU(AS, BS);
end if;
elsif ST = N then
INTEGER_IO.GET(AS, MN, LAST);
INTEGER_IO.GET(BS, NN, LAST);
if WT = I then
return MN < NN;
else
return MN > NN;
end if;
elsif ST = F then
FLOAT_IO.GET(AS, FN, LAST);
FLOAT_IO.GET(BS, GN, LAST);
if WT = I then
return FN < GN;
else
return FN > GN;
end if;
elsif ST = P then
PART_ENTRY_IO.GET(AS, PX, LAST);
PART_ENTRY_IO.GET(BS, PY, LAST);
if WT = I then
return PX < PY;
else
return (not (PX < PY)) and (not (PX = PY));
end if;
elsif ST = R then
PART_OF_SPEECH_TYPE_IO.GET(AS, RX, LAST);
PART_OF_SPEECH_TYPE_IO.GET(BS, RY, LAST);
if WT = I then
return RX < RY;
else
return (not (RX < RY)) and (not (RX = RY));
end if;
elsif ST = S then
--PUT_LINE("AS =>" & AS & '|');
GET(AS, FS, LAST);
--PUT_LINE("BS =>" & BS & '|');
GET(BS, GS, LAST);
--PUT_LINE("GOT AS & BS");
if WT = I then
return FS < GS;
else
return (not (FS < GS)) and (not (FS = GS));
end if;
else
return FALSE;
end if;
exception
when others =>
TEXT_IO.PUT_LINE("exception in SLT showing LEFT and RIGHT");
TEXT_IO.PUT_LINE(X & "&");
TEXT_IO.PUT_LINE(Y & "|");
raise;
end SLT;
function SORT_EQUAL (X, Y : STRING;
ST : SORT_TYPE := A;
WT : WAY_TYPE := I) return BOOLEAN is
AS : STRING(X'RANGE) := X;
BS : STRING(Y'RANGE) := Y;
MN, NN : INTEGER := 0;
FN, GN : FLOAT := 0.0;
FS, GS : APPENDIX_SECTION_TYPE := NO_APPENDIX_SECTION;
PX, PY : PART_ENTRY;
RX, RY : PART_OF_SPEECH_TYPE;
begin
if ST = A then
AS := LOWER_CASE(AS);
BS := LOWER_CASE(BS);
return AS = BS;
elsif ST = C then
return AS = BS;
elsif ST = G then
AS := IGNORE_SEPARATORS(AS);
BS := IGNORE_SEPARATORS(BS);
return AS = BS;
elsif ST = U then
AS := LOWER_CASE(AS);
BS := LOWER_CASE(BS);
return EQU(AS, BS);
elsif ST = N then
INTEGER_IO.GET(AS, MN, LAST);
INTEGER_IO.GET(BS, NN, LAST);
return MN = NN;
elsif ST = F then
FLOAT_IO.GET(AS, FN, LAST);
FLOAT_IO.GET(BS, GN, LAST);
return FN = GN;
elsif ST = P then
PART_ENTRY_IO.GET(AS, PX, LAST);
PART_ENTRY_IO.GET(BS, PY, LAST);
return PX = PY;
elsif ST = R then
PART_OF_SPEECH_TYPE_IO.GET(AS, RX, LAST);
PART_OF_SPEECH_TYPE_IO.GET(BS, RY, LAST);
return RX = RY;
elsif ST = S then
GET(AS, FS, LAST);
GET(BS, GS, LAST);
return FS = GS;
else
return FALSE;
end if;
exception
when others =>
TEXT_IO.PUT_LINE("exception in LT showing LEFT and RIGHT");
TEXT_IO.PUT_LINE(X & "|");
TEXT_IO.PUT_LINE(Y & "|");
raise;
end SORT_EQUAL;
function LT (LEFT, RIGHT : TEXT_TYPE) return BOOLEAN is
begin
if SLT(LEFT(M1..N1), RIGHT(M1..N1), S1, W1) then
return TRUE;
elsif SORT_EQUAL(LEFT(M1..N1), RIGHT(M1..N1), S1, W1) then
if ((N2 > 0) and then
SLT(LEFT(M2..N2), RIGHT(M2..N2), S2, W2) ) then
return TRUE;
elsif ((N2 > 0) and then
SORT_EQUAL(LEFT(M2..N2), RIGHT(M2..N2), S2, W2)) then
if ((N3 > 0) and then
SLT(LEFT(M3..N3), RIGHT(M3..N3), S3, W3 )) then
return TRUE;
elsif ((N3 > 0) and then
SORT_EQUAL(LEFT(M3..N3), RIGHT(M3..N3), S3, W3)) then
if ((N4 > 0) and then
SLT(LEFT(M4..N4), RIGHT(M4..N4), S4, W4) ) then
return TRUE;
elsif ((N4 > 0) and then
SORT_EQUAL(LEFT(M4..N4), RIGHT(M4..N4), S4, W4)) then
if ((N5 > 0) and then
SLT(LEFT(M5..N5), RIGHT(M5..N5), S5, W5) ) then
return TRUE;
end if;
end if;
end if;
end if;
end if;
return FALSE;
exception
when others =>
TEXT_IO.PUT_LINE("exception in LT showing LEFT and RIGHT");
TEXT_IO.PUT_LINE(LEFT & "|");
TEXT_IO.PUT_LINE(RIGHT & "|");
raise;
end LT;
procedure OPEN_FILE_FOR_INPUT(INPUT : in out TEXT_IO.FILE_TYPE;
PROMPT : STRING := "File for input => ") is
LAST : NATURAL := 0;
begin
GET_INPUT_FILE:
loop
CHECK_INPUT:
begin
NEW_LINE;
PUT(PROMPT);
GET_LINE(INPUT_NAME, LAST);
OPEN(INPUT, IN_FILE, INPUT_NAME(1..LAST));
exit;
exception
when others =>
PUT_LINE(" !!!!!!!!! Try Again !!!!!!!!");
end CHECK_INPUT;
end loop GET_INPUT_FILE;
end OPEN_FILE_FOR_INPUT;
procedure CREATE_FILE_FOR_OUTPUT(OUTPUT : in out TEXT_IO.FILE_TYPE;
PROMPT : STRING := "File for output => ") is
NAME : STRING(1..80) := (others => ' ');
LAST : NATURAL := 0;
begin
GET_OUTPUT_FILE:
loop
CHECK_OUTPUT:
begin
NEW_LINE;
PUT(PROMPT);
GET_LINE(NAME, LAST);
if TRIM(NAME(1..LAST))'LENGTH /= 0 then
CREATE(OUTPUT, OUT_FILE, NAME(1..LAST));
else
CREATE(OUTPUT, OUT_FILE, TRIM(INPUT_NAME));
end if;
exit;
exception
when others =>
PUT_LINE(" !!!!!!!!! Try Again !!!!!!!!");
end CHECK_OUTPUT;
end loop GET_OUTPUT_FILE;
end CREATE_FILE_FOR_OUTPUT;
function GRAPHIC(S : STRING) return STRING is
T : STRING(1..S'LENGTH) := S;
begin
for I in S'RANGE loop
if CHARACTER'POS(S(I)) < 32 then
T(I) := ' ';
end if;
end loop;
return T;
end GRAPHIC;
begin
NEW_LINE;
PUT_LINE("Sorts a text file of lines four times on substrings M..N");
PUT_LINE("A)lphabetic (all case) C)ase sensitive, iG)nore seperators, U)i_is_vj,");
PUT_LINE(" iN)teger, F)loating point, S)ection, P)art entry, or paR)t of speech");
PUT_LINE(" I)ncreasing or D)ecreasing");
NEW_LINE;
OPEN_FILE_FOR_INPUT(INPUT, "What file to sort from => ");
NEW_LINE;
PROMPT_FOR_ENTRY("first");
begin
GET_ENTRY(M1, N1, S1, W1);
exception
when PROGRAM_ERROR =>
raise;
when others =>
null;
end;
begin
PROMPT_FOR_ENTRY("second");
GET_ENTRY(M2, N2, S2, W2);
PROMPT_FOR_ENTRY("third");
GET_ENTRY(M3, N3, S3, W3);
PROMPT_FOR_ENTRY("fourth");
GET_ENTRY(M4, N4, S4, W4);
PROMPT_FOR_ENTRY("fifth");
GET_ENTRY(M5, N5, S5, W5);
exception
when PROGRAM_ERROR =>
raise;
when ENTRY_FINISHED =>
null;
when TEXT_IO.DATA_ERROR | TEXT_IO.END_ERROR =>
null;
end;
--PUT_LINE("CREATING WORK FILE");
NEW_LINE;
CREATE (WORK, INOUT_FILE, "WORK.");
PUT_LINE("CREATED WORK FILE");
while not END_OF_FILE(INPUT) loop
--begin
GET_LINE(INPUT, LINE_TEXT, CURRENT_LENGTH);
--exception when others =>
--TEXT_IO.PUT_LINE("INPUT GET exception");
--TEXT_IO.PUT_LINE(LINE_TEXT(1..CURRENT_LENGTH) & "|");
--end;
--PUT_LINE(LINE_TEXT(1..CURRENT_LENGTH));
--PUT_LINE("=>" & HEAD(LINE_TEXT(1..CURRENT_LENGTH), LINE_LENGTH) & "|");
if TRIM(LINE_TEXT(1..CURRENT_LENGTH)) /= "" then
--begin
WRITE(WORK, HEAD(LINE_TEXT(1..CURRENT_LENGTH), LINE_LENGTH) );
--exception when others =>
--TEXT_IO.PUT_LINE("WORK WRITE exception");
--TEXT_IO.PUT_LINE(LINE_TEXT(1..CURRENT_LENGTH) & "|");
--end;
end if;
end loop;
CLOSE(INPUT);
PUT_LINE("Begin sorting");
LINE_HEAPSORT:
declare
L : LINE_IO.POSITIVE_COUNT := SIZE(WORK) / 2 + 1;
IR : LINE_IO.POSITIVE_COUNT := SIZE(WORK);
I, J : LINE_IO.POSITIVE_COUNT;
begin
TEXT_IO.PUT_LINE("SIZE OF WORK = " & INTEGER'IMAGE(INTEGER(SIZE(WORK))));
MAIN:
loop
if L > 1 then
L := L - 1;
READ(WORK, LINE_TEXT, L);
OLD_LINE := LINE_TEXT;
else
READ(WORK, LINE_TEXT, IR);
OLD_LINE := LINE_TEXT;
READ(WORK, LINE_TEXT, 1);
WRITE(WORK, LINE_TEXT, IR);
IR := IR - 1;
if IR = 1 THEN
WRITE(WORK, OLD_LINE, 1);
exit MAIN;
end if;
end if;
I := L;
J := L + L;
while J <= IR loop
if J < IR then
READ(WORK, LINE_TEXT, J);
READ(WORK, P_LINE, J+1);
--if LT (LINE.TEXT, P_LINE.TEXT) then
if LT (LINE_TEXT, P_LINE) then
J := J + 1;
end if;
end if;
READ(WORK, LINE_TEXT, J);
--if OLD_LINE.TEXT < LINE.TEXT then
if LT (OLD_LINE , LINE_TEXT) then
WRITE(WORK, LINE_TEXT, I);
I := J;
J := J + J;
else
J := IR + 1;
end if;
end loop;
WRITE(WORK, OLD_LINE, I);
end loop MAIN;
exception
when CONSTRAINT_ERROR => PUT_LINE("HEAP CONSTRAINT_ERROR");
when others => PUT_LINE("HEAP other_ERROR");
end LINE_HEAPSORT;
PUT_LINE("Finished sorting in WORK");
CREATE_FILE_FOR_OUTPUT(OUTPUT, "Where to put the output => ");
--RESET(WORK);
Set_Index(WORK, 1);
while not END_OF_FILE(WORK) loop
READ(WORK, LINE_TEXT);
if TRIM(GRAPHIC(LINE_TEXT))'LENGTH > 0 then
--PUT_LINE(TRIM(LINE_TEXT, RIGHT));
PUT_LINE(OUTPUT, TRIM(LINE_TEXT, RIGHT));
end if;
end loop;
CLOSE(WORK);
CLOSE(OUTPUT);
PUT_LINE("Done!");
NEW_LINE;
exception
when PROGRAM_ERROR =>
PUT_LINE("SORT terminated on a PROGRAM_ERROR");
CLOSE(OUTPUT);
when TEXT_IO.DATA_ERROR => --Terminate on primary start or size = 0
PUT_LINE("SORT terminated on a DATA_ERROR");
PUT_LINE(LINE_TEXT);
CLOSE(OUTPUT);
when CONSTRAINT_ERROR => --Terminate on blank line for file name
PUT_LINE("SORT terminated on a CONSTRAINT_ERROR");
CLOSE(OUTPUT);
when TEXT_IO.DEVICE_ERROR => --Ran out of space to write output file
PUT_LINE("SORT terminated on a DEVICE_ERROR");
DELETE(OUTPUT);
CREATE_FILE_FOR_OUTPUT(OUTPUT, "Wherelse to put the output => ");
RESET(WORK);
while not END_OF_FILE(WORK) loop
READ(WORK, LINE_TEXT);
PUT_LINE(OUTPUT, LINE_TEXT); --(1..LINE.CURRENT_LENGTH));
end loop;
CLOSE(OUTPUT);
end SORTER;
|
PRG/objects/CoinBoss.asm
|
narfman0/smb3_pp1
| 0 |
28944
|
<gh_stars>0
.byte $01 ; Unknown purpose
.byte OBJ_BOOMERANGBRO, $03, $17
.byte OBJ_BOOMERANGBRO, $0C, $17
.byte OBJ_TREASUREBOXAPPEAR, $0F, $11
.byte $FF ; Terminator
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48.log_21829_2554.asm
|
ljhsiun2/medusa
| 9 |
15879
|
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r15
push %rax
push %rcx
push %rdx
push %rsi
// Faulty Load
mov $0x3bca400000000a5b, %r15
nop
nop
cmp $42386, %rcx
mov (%r15), %esi
lea oracles, %rdx
and $0xff, %rsi
shlq $12, %rsi
mov (%rdx,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rcx
pop %rax
pop %r15
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
<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
*/
|
libsrc/_DEVELOPMENT/math/float/am9511/lam32/c/sccz80/log10_fastcall.asm
|
ahjelm/z88dk
| 640 |
90301
|
<reponame>ahjelm/z88dk
SECTION code_fp_am9511
PUBLIC log10_fastcall
EXTERN asm_am9511_log10_fastcall
defc log10_fastcall = asm_am9511_log10_fastcall
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _log10_fastcall
defc _log10_fastcall = asm_am9511_log10_fastcall
ENDIF
|
workflow/get_finders_path.scpt
|
ramiroaraujo/alfred-tmux-workflow
| 6 |
2426
|
if application "Path Finder" is running then
tell application "Path Finder"
set target_path to "\"" & (the POSIX path of the target of the front finder window) & "\""
return target_path
end tell
else
tell application "Finder"
try
set target_path to (quoted form of POSIX path of (folder of the front window as alias))
on error line number num
set target_path to (path to home folder)
end try
return target_path
end tell
end if
|
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xca_notsx.log_21829_1055.asm
|
ljhsiun2/medusa
| 9 |
175040
|
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
// REPMOV
lea addresses_normal+0x4be, %rsi
lea addresses_normal+0x15dbe, %rdi
nop
nop
nop
xor $63580, %rdx
mov $79, %rcx
rep movsl
nop
add $32585, %rsi
// Store
lea addresses_UC+0x100fe, %rdi
nop
nop
nop
dec %r9
movb $0x51, (%rdi)
nop
xor %rdx, %rdx
// Faulty Load
mov $0x52569600000005be, %rdx
nop
nop
sub %r10, %r10
movups (%rdx), %xmm2
vpextrq $0, %xmm2, %rdi
lea oracles, %r14
and $0xff, %rdi
shlq $12, %rdi
mov (%r14,%rdi,1), %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_normal'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 16, '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
*/
|
programs/oeis/278/A278130.asm
|
neoneye/loda
| 22 |
161648
|
; A278130: a(n) = 492*2^n - 222.
; 270,762,1746,3714,7650,15522,31266,62754,125730,251682,503586,1007394,2015010,4030242,8060706,16121634,32243490,64487202,128974626,257949474,515899170,1031798562,2063597346,4127194914,8254390050,16508780322,33017560866,66035121954,132070244130
mov $1,2
pow $1,$0
sub $1,1
mul $1,492
add $1,270
mov $0,$1
|
RAM.asm
|
romhack/BC-BackFromSource
| 4 |
173955
|
;.segment RAM
;Здесь описаны все переменные, используемые в игре
Enum 0
Temp: .BYTE 0 ; (uninited) ; DATA XREF: SetUp_LevelVARs+6Fw
; SetUp_LevelVARs+74r
; Draw_RespawnPic:+w
; Draw_RespawnPic+18r
; Draw_Player_Lives+50w
; Draw_Player_Lives+54r
; Get_Random_A+11r
; CoordTo_PPUaddress+2w
; CoordTo_PPUaddress+6w
; CoordTo_PPUaddress+9w
; CoordTo_PPUaddress+Cw
; CoordTo_PPUaddress+10r
; TSA_Pal_Ops+33w TSA_Pal_Ops+39r
; Read_Joypads:--w Read_Joypads+15w
; Read_Joypads+1Er Read_Joypads+22r
; Temp_Coord_shl+2w Temp_Coord_shl+Aw
; Temp_Coord_shl+Cw Temp_Coord_shl+14w
; Check_Objectr Draw_Destroyed_Brickr
; NT_Buffer_Process_XOR+6r ROM:D75Cr
; NT_Buffer_Process_OR+6r
; Draw_TSABlock+1w Draw_TSABlock+Ar
; Num_To_NumStringw
; Num_To_NumString+7r
; Num_To_NumString+Fr
; ByteTo_Num_Stringw
; ByteTo_Num_String+7r Ice_Move+2Dw
; Ice_Move+56r Ice_Move+5Cr
; Ice_Move:+++r Set_SprIndex+7w
; Set_SprIndex+13r
; Rise_TankStatus_Bitw
; Rise_TankStatus_Bit+6r
; Multiply_Bonus_Coordw
; Multiply_Bonus_Coord+4r
; BulletToBullet_Impact_Handle+1Dw
; BulletToBullet_Impact_Handle+23r
; Load_Level:Beginw Load_Level:-w
byte_1: .BYTE 0 ; (uninited)
CHR_Byte: .BYTE 0 ; (uninited)
Mask_CHR_Byte: .BYTE 0 ; (uninited)
TSA_Pal: .BYTE 0 ; (uninited)
PPU_Addr_Ptr: .BYTE 0 ; (uninited)
Joypad1_Buttons:.BYTE 0 ; (uninited) ; DATA XREF: ROM:Skip_Status_Handler
; ROM:loc_C13Er ROM:C185r ROM:C1AAr
; FreezePlayer_OnHQDestroy+8w
; Demo_AI+6Bw Move_Tankr
; Move_Tank+2Dr Title_Screen_Loop:++r
; Title_Screen_Loop:+++r
; Read_Joypads+1Ar Read_Joypads+24w
; Detect_Motionr Ice_Move:++++r
Joypad2_Buttons:.BYTE 0 ; (uninited)
Joypad1_Differ: .BYTE 0 ; (uninited) ; DATA XREF: ROM:C102r ROM:loc_C120r
; ROM:Construct_StartCheckr ROM:C179r
; ROM:C17Fr ROM:Check_Br ROM:C20Cr
; FreezePlayer_OnHQDestroy+Cw
; BonusLevel_ButtonCheck+3r
; Draw_Brick_GameOver+4Er Demo_AI+6Dw
; Demo_AI+75r Demo_AI+79w
; Move_Tank+19r Move_Tank+1Fr
; ROM:C789r ROM:loc_C792r
; ROM:loc_C79Br Scroll_TitleScrn+Br
; Title_Screen_Loop+38r
; Title_Screen_Loop:Start_Checkr
; Read_Joypads+20w Make_Player_Shot+Er
Joypad2_Differ: .BYTE 0 ; (uninited)
;1 = A
;2 = B
;4 = SELECT
;8 = START
;10 = UP
;20 = DOWN
;40 = LEFT
;80 = RIGHT
;
Seconds_Counter:.BYTE 0 ; (uninited)
Frame_Counter: .BYTE 0 ; (uninited)
ScrBuffer_Pos: .BYTE 0 ; (uninited)
SprBuffer_Position:.BYTE 0 ; (uninited)
Gap: .BYTE 0 ; (uninited)
Random_Lo: .BYTE 0 ; (uninited)
Random_Hi: .BYTE 0 ; (uninited)
LowPtr_Byte: .BYTE 0 ; (uninited) ; DATA XREF: Show_Secret_Msg+22w
; Show_Secret_Msg+34w
; Show_Secret_Msg+46w
; Show_Secret_Msg+58w
; Show_Secret_Msg+6Aw
; Show_Secret_Msg+7Cw
; Show_Secret_Msg+8Ew
; Show_Secret_Msg+A0w
; Show_Secret_Msg+B2w ROM:C765w
; ROM:C77Cw Draw_Player_Lives+10w
; Draw_Player_Lives+30w Draw_IP+6w
; Draw_IP+1Fw Draw_LevelFlag+9w
; Draw_LevelFlag+18w ReinforceToRAM+9w
; Draw_EmptyTile+9w
; Title_Screen_Loop+9Fw
; Title_Screen_Loop+A6r
; DraW_Normal_HQ+6w DraW_Normal_HQ+15w
; DraW_Normal_HQ+24w
; DraW_Normal_HQ+33w Draw_Naked_HQ+6w
; Draw_Naked_HQ+15w Draw_ArmourHQ+6w
; Draw_ArmourHQ+15w Draw_ArmourHQ+24w
; Draw_ArmourHQ+33w
; Draw_Destroyed_HQ+6w
; Draw_Destroyed_HQ+15w
; Copy_AttribToScrnBuff+8w
; Copy_AttribToScrnBuff+15r
; FillScr_Single_Row+7w
; FillScr_Single_Row+14r
; FillScr_Single_Row+20r
; Draw_Pts_Screen+190w
; Draw_Pts_Screen+19Fw
; Draw_Pts_Screen+1EBw
; Draw_Pts_Screen+1FAw
; Draw_Pts_Screen_Template+30w
; Draw_Pts_Screen_Template+4Bw
; Draw_Pts_Screen_Template+6Ew
; Draw_Pts_Screen_Template+89w
; Draw_Pts_Screen_Template+98w
; Draw_Pts_Screen_Template+A7w
; Draw_Pts_Screen_Template+B6w
; Draw_Pts_Screen_Template+CCw
; Draw_Pts_Screen_Template+E7w
; Draw_Pts_Screen_Template+F6w
; Draw_Pts_Screen_Template+105w
; Draw_Pts_Screen_Template+114w
; Draw_Pts_Screen_Template+126w
; Draw_Pts_Screen_Template+135w
; Draw_Pts_Screen_Template+144w
; Draw_Pts_Screen_Template+153w
; Draw_Pts_Screen_Template+169w
; Draw_Pts_Screen_Template+178w
; Draw_Pts_Screen_Template+187w
; Draw_Pts_Screen_Template+196w
; Draw_Pts_Screen_Template+1A8w
; Draw_Pts_Screen_Template+1B7w
; Draw_TitleScreen+40w
; Draw_TitleScreen+5Bw
; Draw_TitleScreen+7Aw
; Draw_TitleScreen+9Cw
; Draw_TitleScreen+ABw
; Draw_TitleScreen+BAw
; Draw_TitleScreen+CCw
; Draw_TitleScreen+DBw
; Draw_TitleScreen+EDw
; String_to_Screen_Buffer:-r
; Save_Str_To_ScrBuffer:-r
; CoordsToRAMPos+5w Check_Object+4r
; Draw_Destroyed_Brick+4r
; NT_Buffer_Process_XORr
; NT_Buffer_Process_XOR+Ar
; NT_Buffer_Process_XOR+Cw
; NT_Buffer_Process_ORr
; NT_Buffer_Process_OR+8r
; NT_Buffer_Process_OR+Aw
; Save_to_VRAM+8r Save_to_VRAM+Dr
; Draw_Tilew Draw_Tile+Fr
; Draw_Tile+15r Inc_Ptr_on_A+1r
; Inc_Ptr_on_A+3w
; Store_NT_Buffer_InVRAM+2w
; Draw_GrayFrame+26w
; Draw_GrayFrame+2Dw Draw_Char+Bw
; Draw_Char+21r
; PtrToNonzeroStrElem+1Aw
; SaveSprTo_SprBuffer+10r
; Status_Core+Bw ...
HighPtr_Byte: .BYTE 0 ; (uninited) ; DATA XREF: Show_Secret_Msg+1Ew
; Show_Secret_Msg+30w
; Show_Secret_Msg+42w
; Show_Secret_Msg+54w
; Show_Secret_Msg+66w
; Show_Secret_Msg+78w
; Show_Secret_Msg+8Aw
; Show_Secret_Msg+9Cw
; Show_Secret_Msg+AEw ROM:C761w
; ROM:C778w Draw_Player_Lives+Cw
; Draw_Player_Lives+2Cw Draw_IP+2w
; Draw_IP+1Bw Draw_LevelFlag+5w
; Draw_LevelFlag+14w ReinforceToRAM+5w
; Draw_EmptyTile+5w
; Title_Screen_Loop+A4w
; DraW_Normal_HQ+2w DraW_Normal_HQ+11w
; DraW_Normal_HQ+20w
; DraW_Normal_HQ+2Fw Draw_Naked_HQ+2w
; Draw_Naked_HQ+11w Draw_ArmourHQ+2w
; Draw_ArmourHQ+11w Draw_ArmourHQ+20w
; Draw_ArmourHQ+2Fw
; Draw_Destroyed_HQ+2w
; Draw_Destroyed_HQ+11w
; Copy_AttribToScrnBuff+4w
; Copy_AttribToScrnBuff+Fr
; FillScr_Single_Row+5w
; FillScr_Single_Row+Br
; Draw_Pts_Screen+18Cw
; Draw_Pts_Screen+19Bw
; Draw_Pts_Screen+1E7w
; Draw_Pts_Screen+1F6w
; Draw_Pts_Screen_Template+2Cw
; Draw_Pts_Screen_Template+47w
; Draw_Pts_Screen_Template+6Aw
; Draw_Pts_Screen_Template+85w
; Draw_Pts_Screen_Template+94w
; Draw_Pts_Screen_Template+A3w
; Draw_Pts_Screen_Template+B2w
; Draw_Pts_Screen_Template+C8w
; Draw_Pts_Screen_Template+E3w
; Draw_Pts_Screen_Template+F2w
; Draw_Pts_Screen_Template+101w
; Draw_Pts_Screen_Template+110w
; Draw_Pts_Screen_Template+122w
; Draw_Pts_Screen_Template+131w
; Draw_Pts_Screen_Template+140w
; Draw_Pts_Screen_Template+14Fw
; Draw_Pts_Screen_Template+165w
; Draw_Pts_Screen_Template+174w
; Draw_Pts_Screen_Template+183w
; Draw_Pts_Screen_Template+192w
; Draw_Pts_Screen_Template+1A4w
; Draw_Pts_Screen_Template+1B3w
; Draw_TitleScreen+3Cw
; Draw_TitleScreen+57w
; Draw_TitleScreen+76w
; Draw_TitleScreen+98w
; Draw_TitleScreen+A7w
; Draw_TitleScreen+B6w
; Draw_TitleScreen+C8w
; Draw_TitleScreen+D7w
; Draw_TitleScreen+E9w
; CoordsToRAMPos+3w Save_to_VRAMr
; Draw_Tile+6r Inc_Ptr_on_A+7w
; Store_NT_Buffer_InVRAM+7w
; Store_NT_Buffer_InVRAM+11r
; Draw_GrayFrame+24w Draw_Char+Fw
; Draw_Char:+r PtrToNonzeroStrElem+18w
; Status_Core+10w
; SingleTankStatus_Handle+10w
; BulletStatus_Handle+10w
; Draw_BulletGFX+10w Ice_Detect+23r
; HideHiBit_Under_Tank+18w
; HQ_Handle+57w Bonus_Handle+64w
; Load_Level+14w Load_Level+2Er
LowStrPtr_Byte: .BYTE 0 ; (uninited) ; DATA XREF: Load_DemoLevel+3Cw
; Load_DemoLevel+4Fw
; Draw_Record_HiScore+1Ew
; Draw_Brick_GameOver+1Ew
; Draw_Brick_GameOver+31w
; Draw_TitleScreen+18w
; Draw_TitleScreen+2Bw
; String_to_Screen_Buffer+13w
; String_to_Screen_Buffer+21w
; Draw_BrickStr:New_Charr
; Draw_RecordDigit+22w Load_Level+2Cw
; Load_Level+47r Load_Level:++r
HighStrPtr_Byte:.BYTE 0 ; (uninited)
HiScore_1P_String:.BYTE 0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: Null_both_HiScoreo
; Reset_ScreenStuff+21o
; Update_HiScore:loc_D981r
; Update_HiScore:loc_D993r
; Add_Score+Er Add_Score:++w
; Draw_Pts_Screen:+++o
; Draw_Pts_Screen+172o
; Draw_Pts_Screen_Template+77o
HiScore_2P_String:.BYTE 0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: Null_both_HiScore+5o
; Reset_ScreenStuff+26o
; Update_HiScore:loc_D9A0r
; Update_HiScore:loc_D9B2r
; Draw_Pts_Screen+C9o
; Draw_Pts_Screen+1CDo
; Draw_Pts_Screen_Template+D5o
;В формате строки Scr_Buffer: на конце $FF
;
Temp_1PPts_String:.BYTE 0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: Draw_Pts_Screen+2Co
; Draw_Pts_Screen+98o
; Строка при подсчете очков за текущий вид танка
Temp_2PPts_String:.BYTE 0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: Draw_Pts_Screen+31o
; Draw_Pts_Screen+D7o
Num_String: .BYTE 0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: Add_Score:-r
; Num_To_NumString+2o
; ByteTo_Num_String+2o
; Draw_StageNumString+53o
; Draw_Pts_Screen+B3o
; Draw_Pts_Screen+F2o
; Draw_Pts_Screen+12Ao
; Draw_Pts_Screen+13Fo
; Draw_Pts_Screen+17Eo
; Draw_Pts_Screen+1D9o
; Draw_Pts_Screen_Template+59o
;Числовая строка. Используется для вывода на экран чисел в формате строки (на конце $FF): номера уровней, жизни и т.п.
;Число хранится в Little Endian формате
;
HiScore_String: .BYTE 0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: Reset_ScreenStuff+30o
; Draw_RecordDigit+Co
; Update_HiScore+6r Update_HiScore+18w
; Update_HiScore+25r
; Update_HiScore+37w
; Draw_Pts_Screen_Template+39o
;В формате строки Scr_Buffer: на конце $FF
;
HQArmour_Timer: .BYTE 0 ; (uninited) ; Таймер брони вокруг штаба
Level_Mode: .BYTE 0 ; (uninited)
;0 = обычный режим
;1 = усложнённый режим - выставляется, если уровни
;начинают проходиться по 2-му кругу (после 35-го).
;(если по третьему, то режим снова становится обычным (выставляется в ноль))
;2 = режим демо уровня - надпись
;Game Over не отображается, не обрабатывается
;положение 1 или 2 игрока - в демо уровне их
;всегда два, не прибавляются очки.
;Нет мигания от Friendly Fire
Spr_X: .BYTE 0 ; (uninited)
Spr_Y: .BYTE 0 ; (uninited)
Tank_Num: .BYTE 0 ; (uninited) ; Номер танка игрока, при обработке взятия бонуса
Joy_Counter: .BYTE 0 ; (uninited)
Construction_Flag:.BYTE 0 ; (uninited) ; Выставляется, если зашли в Construction
;Если <>0, то:
;-Демо-ролик не будет показываться
;-Данные уровня загружаться не будут (только танки и голый штаб)
;А в Construction вообще ничего не будет загружаться
;Может использоваться как счетчик (при выводе секретного сообщения)
EnterGame_Flag: .BYTE 0 ; (uninited) ; Если 0, то можно выбрать уровень
;Если <>0, то после предыдущего сразу начинается следующий уровень
;
BkgPal_Number: .BYTE 0 ; (uninited)
;0= PaletteFrame2
;1= LevelPalette
;2= PaletteFrame1
;3= TitleScrPalette
;4= LevelSelPalette
;5= PaletteMisc1
;6= PaletteMisc2
;Если больше $80,то палитры не перезагружаются при NMI
.BYTE 0 ; (uninited)
Scroll_Byte: .BYTE 0 ; (uninited)
PPU_REG1_Stts: .BYTE 0 ; (uninited)
Player1_Lives: .BYTE 0 ; (uninited) ; DATA XREF: ROM:Check_GameOverr
; Init_Level_VARs+12w
; SetUp_LevelVARs+10r
; LevelEnd_Check+8r
; Draw_Player_Lives+3Br
; Draw_Pts_Screen+164r Add_Life+10w
; ROM:DE0Dw
; ROM:Check1pLives_Explode_Handler
; ROM:Bonus_Lifew
Player2_Lives: .BYTE 0 ; (uninited)
Spr_TileIndex: .BYTE 0 ; (uninited)
Temp_X: .BYTE 0 ; (uninited)
Temp_Y: .BYTE 0 ; (uninited)
Block_X: .BYTE 0 ; (uninited)
Block_Y: .BYTE 0 ; (uninited)
byte_58: .BYTE 0 ; (uninited)
byte_59: .BYTE 0 ; (uninited)
Counter: .BYTE 0 ; (uninited)
Counter2: .BYTE 0 ; (uninited)
TSA_BlockNumber:.BYTE 0 ; (uninited)
;16 возможных TSA блоков.Три последних TSA блока пустые (по счёту $0D-$0F)
BrickChar_X: .BYTE 0 ; (uninited)
BrickChar_Y: .BYTE 0 ; (uninited)
String_Position:.BYTE 0 ; (uninited)
Char_Index_Base:.BYTE 0 ; (uninited) ; DATA XREF: ROM:C75Dw ROM:C787w
; Draw_Player_Lives+8w
; Draw_Player_Lives+63w
; Draw_LevelFlag+23w
; Draw_LevelFlag+38w
; Draw_StageNumString+4Cw
; Draw_StageNumString+61w
; Draw_Pts_Screen+21Aw
; Draw_Pts_Screen_Template+15w
; Draw_TitleScreen+38w
; Draw_TitleScreen+91w
; Reset_ScreenStuff+2w
; Save_Str_To_ScrBuffer+18r
; Draw_BrickStr+12r
; Draw_RecordDigit+Aw
; Draw_RecordDigit+29w
.BYTE 0 ; (uninited)
BonusPts_TimeCounter:.BYTE 0 ; (uninited)
;Таймер отображения очков после взятия (0 = отображение очков закончено)
Iterative_Byte: .BYTE 0 ; (uninited) ; Байт, заполняющий большие массивы данных
AI_X_DifferFlag:.BYTE 0 ; (uninited)
AI_Y_DifferFlag:.BYTE 0 ; (uninited)
;1 - координаты танка и цели равны - цель достигнута
;0 - координата танка больше координаты цели
;2 - координата танка меньше координаты цели
AddLife_Flag: .BYTE 0,0 ; (uninited) ; <>0 - игрок получал дополнительную жизнь
;Жизнь может быть получена только один раз за игру, если игрок заработал 200 000 очков
HQ_Status: .BYTE 0 ; (uninited) ; 80=штаб цел, если ноль то уничтожен
HQExplode_SprBase:.BYTE 0 ; (uninited) ; DATA XREF: Add_ExplodeSprBase+1r
; ROM:E330w ROM:E338w
EnemyRespawn_PlaceIndex:.BYTE 0 ; (uninited)
;(0..2) - три возможных места следующего респауна
;лево-центр-право
;
byte_6B: .BYTE 0 ; (uninited)
TanksOnScreen: .BYTE 0 ; (uninited) ; Максимальное количество всех танков на экране
Pause_Flag: .BYTE 0 ; (uninited) ; <>0, значит режим паузы
Spr_Attrib: .BYTE 0 ; (uninited)
;vhp00000 Attributes:
;v = Vertical Flip (1=Flip)
;h = Horizontal Flip (1=Flip)
;p = Background Priority
;0 = In front
;1 = Behind
;
Player_Blink_Timer:.BYTE 0,0 ; (uninited) ; DATA XREF: ROM:C0DFw
; SetUp_LevelVARs+32w
; Title_Screen_Loop+1Aw Ice_Move+16r
; Ice_Move+1Aw ROM:OperTank_Playerr
; Make_Respawn+14w
; BulletToTank_Impact_Handle:CheckBlink_TankImpactr
; BulletToTank_Impact_Handle+1A0w
; Таймер мигания friendly fire
AI_X_Aim: .BYTE 0 ; (uninited) ; DATA XREF: Demo_AI+10w Demo_AI+26w
; Demo_AI+3Cw Demo_AI+52w ROM:DD80w
; ROM:DD8Bw ROM:DD96w Load_AI_Statusr
AI_Y_Aim: .BYTE 0 ; (uninited) ; DATA XREF: Demo_AI+14w Demo_AI+2Aw
; Demo_AI+40w Demo_AI+56w ROM:DD84w
; ROM:DD8Fw ROM:DD9Aw
; Load_AI_Status+Dr
;Координаты, к которым стремятся игроки во время демо-уровня
Enmy_KlledBy1P_Count:.BYTE 0,0,0,0 ; (uninited) ; DATA XREF: Null_KilledEnms_Count:-w
; Draw_Pts_Screen+8r
; Draw_Pts_Screen+50r
; Draw_Pts_Screen+5Cw
; BulletToTank_Impact_Handle+102w
Enmy_KlledBy2P_Count:.BYTE 0,0,0,0 ; (uninited) ; DATA XREF: Draw_Pts_Screen+15r
; Draw_Pts_Screen+6Er
; Draw_Pts_Screen+7Aw
; BulletToTank_Impact_Handle:ScndPlayerKll_Tank_Impactw
; Draw_Pts_Screen+18r
; Draw_Pts_Screen:End_Draw_Pts_Screeno
;количество врагов, убитых каждым игроком (4 возможных типа)
;
byte_7B: .BYTE 0 ; (uninited)
EndCount_Flag: .BYTE 0 ; (uninited) ; Если 0, завершить подсчет очков для текущего врага
TotalEnmy_KilledBy1P:.BYTE 0 ; (uninited)
TotalEnmy_KilledBy2P:.BYTE 0 ; (uninited)
Enemy_Reinforce_Count:.BYTE 0 ; (uninited) ; Количество врагов в запасе
Enemy_Counter: .BYTE 0 ; (uninited) ; Количество врагов на экране и в запасе
BkgOccurence_Flag:.BYTE 0 ; (uninited) ; DATA XREF: ROM:C0D5w ROM:C108r
; ROM:C10Cw ROM:C126r ROM:C12Aw
; Move_Tank+Aw
Respawn_Timer: .BYTE 0 ; (uninited) ; Время до следующего респауна
CursorPos: .BYTE 0 ; (uninited)
Respawn_Delay: .BYTE 0 ; (uninited) ; Задержка между респаунами врагов
Level_Number: .BYTE 0 ; (uninited)
;FF=бонус уровень
;
Bonus_X: .BYTE 0 ; (uninited)
Bonus_Y: .BYTE 0 ; (uninited)
Bonus_Number: .BYTE 0 ; (uninited) ; Определяет тип бонуса
Invisible_Timer:.BYTE 0 ; (uninited) ; DATA XREF: SetUp_LevelVARs+36w
; Invisible_Timer_Handle+6r
; Invisible_Timer_Handle+10w
; Load_New_Tank+Bw
; BulletToTank_Impact_Handle+47r
; BulletToTank_Impact_Handle+188r
; ROM:E9F2w
; Силовое поле вокруг игрока после рождения
byte_8A: .BYTE 0 ; (uninited)
Enemy_Count: .BYTE 0,0,0,0 ; (uninited) ; DATA XREF: Load_New_Tank+15r
; Load_New_Tank+22w
; Load_Enemy_Count+14w
;Счётчики типов врагов на уровне (4 возможных типа)
Enemy_TypeNumber:.BYTE 0 ; (uninited)
;Текущий тип врага (из 4-х возможных на уровне). Кончается
;первый тип, начинает респауниться второй.
;Далее идут атрибуты танков (координаты, статус и тип). Каждый атрибут - массив байт, имеющий следующую структуру:
;1 байт - атрибут первого игрока
;2 байт - атрибут второго игрока
;3-8 байты - атрибуты танков врагов в порядке, обратном их появлению на экране, т.е. 8 - атрибут первого появившегося
;танка и т.п. 6 врагов появляется только в случае двух игроков
Tank_X: .BYTE 0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: ROM:C0C3w
; Draw_TSA_On_Tank+4r Move_Tank+3Br
; Move_Tank+3Dw Check_BorderReachr
; Check_BorderReach+8w
; Check_BorderReach:+r
; Check_BorderReach+12w
; Title_Screen_Loop+9w Ice_Move+60r
; Ice_Move+67w ROM:DC80r ROM:DCB8r
; ROM:DD08w ROM:CheckTile_Check_Objr
; ROM:Aim_FirstPlayerr
; Load_AI_Status+3r ROM:DED6r
; ROM:DF1Ar ROM:DF26r ROM:DF39r
; Set_SprIndex+19r ROM:DFFBr
; ROM:E027r Make_Shot+1Dr
; Ice_Detect+14r Ice_Detect+4Br
; Invisible_Timer_Handle+18r
; Make_Respawn+Bw Make_Respawn+29w
; Make_Respawn+4Cr
; BulletToTank_Impact_Handle+24r
; BulletToTank_Impact_Handle+A2r
; BulletToTank_Impact_Handle+165r
; Bonus_Handle+16r ROM:Aim_ScndPlayerr
; Demo_AI+24r Demo_AI+50r Demo_AI+3Ar
Tank_Y: .BYTE 0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: ROM:C0C7w
; Demo_AI+6Fr Draw_TSA_On_Tank+6r
; Move_Tank+47r Move_Tank+49w
; Check_BorderReach:++r
; Check_BorderReach+1Cw
; Check_BorderReach:+++r
; Check_BorderReach+26w
; CurPos_To_PixelCoord+9w Ice_Move+69r
; Ice_Move+70w ROM:DC86r ROM:DCA8r
; ROM:DD0Cw ROM:DD36r ROM:DD82r
; Load_AI_Status+10r ROM:DED4r
; ROM:DF18r ROM:Draw_PlayerKillr
; ROM:DF37r Set_SprIndex+17r
; ROM:DFF9r ROM:E025r Make_Shot+28r
; Ice_Detect+Er Ice_Detect:loc_E1DDr
; Invisible_Timer_Handle+16r
; Make_Respawn+10w Make_Respawn+2Ew
; Make_Respawn+4Ar
; BulletToTank_Impact_Handle+35r
; BulletToTank_Impact_Handle+B3r
; BulletToTank_Impact_Handle+176r
; Bonus_Handle+26r ROM:DD8Dr
; Demo_AI+28r Demo_AI+54r Demo_AI+3Er
Tank_Status: .BYTE 0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: ROM:C0CBw
; Title_Screen_Loop+10w
; Detect_Motion+6r Respawn_Handle+11r
; Ice_Move:-r Ice_Move+38r
; Ice_Move+3Aw Ice_Move:++r
; Ice_Move+76w Motion_Handle+2Cr
; Status_Corer
; ROM:LoadStts_Misc_Status_Handler
; ROM:DC70w ROM:DC76o ROM:Check_Objr
; ROM:DD25r ROM:DD27w
; ROM:Change_Direction_Check_Objr
; ROM:DD45w ROM:DD56r
; ROM:Sbc_Get_RandomStatusr ROM:DD65o
; ROM:DD67w ROM:DD9Fw
; ROM:Explode_Handlew ROM:DDECr
; ROM:DDF2r
; ROM:SaveStts_Explode_Handlew
; ROM:Skip_Explode_Handlew
; ROM:Set_Respawnw ROM:DE57r
; ROM:DE61w ROM:Load_Tankw ROM:DE66r
; Get_RandomDirection+19w
; Get_RandomDirection:loc_DE8Er
; SingleTankStatus_Handler ROM:DED1r
; Set_SprIndex+9r ROM:DFEBr
; ROM:Respawnr Make_Shot:+r
; Make_Player_Shot+6r
; Make_Enemy_Shot:loc_E169r
; Ice_Detect+6r
; HideHiBit_Under_Tank+6r
; Make_Respawn+48w Load_New_Tank+3w
; Null_Status:-w
; Rise_TankStatus_Bit+2r
; Rise_TankStatus_Bit+8w
; BulletToTank_Impact_Handle+6r
; BulletToTank_Impact_Handle+55w
; BulletToTank_Impact_Handle+78r
; BulletToTank_Impact_Handle+E8w
; BulletToTank_Impact_Handle+139r
; Bonus_Handle+Er ROM:EA22r ROM:EA2Dw
; Demo_AI:NoBonusr Demo_AI:++r
; Demo_AI:+r
;Статусы танков:
;
;Формат байта:
;Четыре старших бита образуют индекс команды, который в дальшейшем грузится из TankStts_JumpTable
;(16 возможных команд):
;0 - танка нет
;1-7 - 8 кадров анимации взрыва (если нужно взорвать танк в Status вписывают $73)
;8-D - обычный танк, при этом обрабатываются атрибуты направления (2 младших бита):
; биты 0,1 - образуют атрибут направления:
; 0 - вверх
; 1 - влево
; 2 - вниз
; 3 - вправо
;E-F - Респаун, при этом:
; биты 1,2 - образуют номер кадра анимации респауна (младший бит не используется): всего 4 кадра
Tank_Type: .BYTE 0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: ROM:C0CFw
; Title_Screen_Loop+16w
; Motion_Handle:+r ROM:DF01r
; ROM:DF05r ROM:DFBAr ROM:DFD2r
; ROM:DFF0r Make_Shot+30r
; Make_Player_Shot+14r Make_Respawn+2w
; Make_Respawn+40w Load_New_Tank:++r
; Load_New_Tank:End_Load_New_Tankw
; BulletToTank_Impact_Handle+61w
; BulletToTank_Impact_Handle+C5r
; BulletToTank_Impact_Handle+CEr
; BulletToTank_Impact_Handle+D4w
; BulletToTank_Impact_Handle:Skip_BonusHandle_TankImpactr
; BulletToTank_Impact_Handle+DCw
; BulletToTank_Impact_Handle+EFr
; ROM:EA14w ROM:EA32w
;Типы танков:
;
;На одном уровне может встретиться 4 типа танков,
;однако всего типов танков 8.
;
;Формат байта:
;Биты:
;0,1 - уровень брони
;2 - флаг бонусного танка
;3,4 - не используются
;5,6,7 - тип танка (возможно 8 типов)
Track_Pos: .BYTE 0 ; (uninited) ; DATA XREF: ROM:C0D3w
; Title_Screen_Loop+18w
; Title_Screen_Loop+2Fr
; Title_Screen_Loop+33w ROM:DC62r
; ROM:DC66w ROM:TrackHandle_CheckObjr
; ROM:DD2Dw ROM:DFF5r
; Load_New_Tank+4Ew
;Расположение гусеничного трака (если меняется, то танк едет)
;Возможно 2 положения = 0 или 4 (каждый танк 4 тайла (16х16))
byte_B1: .BYTE 0 ; (uninited)
.BYTE 0 ; (uninited)
byte_B3: .BYTE 0 ; (uninited)
.BYTE 0 ; (uninited)
byte_B5: .BYTE 0 ; (uninited)
.BYTE 0 ; (uninited)
.BYTE 0 ; (uninited)
;Далее следуют массивы, относящиеся к свойствам пуль (10 возможных на экране):
;первые два элемента соответствуют игрокам, далее 6 элементов
;для врагов и оставшиеся два элемента - для дополнительной пули
;каждого из игроков (в случае, если игрок является 2-м бонусным танком)
Bullet_X: .BYTE 0,0,0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: Change_BulletCoord+5r
; Change_BulletCoord+7w Make_Shot+1Fw
; ROM:E102r ROM:E117r
; Make_Player_Shot+28r
; Bullet_Fly_Handle+40r
; Bullet_Fly_Handle+51r
; Bullet_Fly_Handle+63r
; Bullet_Fly_Handle+7Ar
; BulletToTank_Impact_Handle+20r
; BulletToTank_Impact_Handle:Load_X_TankImpactr
; BulletToTank_Impact_Handle+161r
; BulletToBullet_Impact_Handle+30r
; BulletToBullet_Impact_Handle+34r
; Make_Player_Shot+2Aw
Bullet_Y: .BYTE 0,0,0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: Change_BulletCoord+Er
; Change_BulletCoord+10w Make_Shot+2Aw
; ROM:E100r ROM:E115r
; Make_Player_Shot+2Cr
; Bullet_Fly_Handle+3Er
; Bullet_Fly_Handle+4Ar
; Bullet_Fly_Handle+5Dr
; Bullet_Fly_Handle+70r
; BulletToTank_Impact_Handle+31r
; BulletToTank_Impact_Handle+AFr
; BulletToTank_Impact_Handle+172r
; BulletToBullet_Impact_Handle+41r
; BulletToBullet_Impact_Handle+45r
; Make_Player_Shot+2Ew
Bullet_Status: .BYTE 0,0,0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: BulletStatus_Handler
; ROM:Bullet_Mover ROM:Make_Ricochetw
; ROM:E078r ROM:E07Er
; ROM:Skip_Animate_Ricochetw
; Make_Shotr Make_Shot+14w
; Draw_BulletGFXr ROM:Draw_Bulletr
; ROM:Update_Ricochetr
; Make_Player_Shot+1Cr
; Make_Player_Shot+24r
; Make_Player_Shot+36w
; Hide_All_Bullets:-w
; Bullet_Fly_Handle+6r
; Bullet_Fly_Handle:+r
; BulletToObject_Impact_Handle+27w
; BulletToObject_Impact_Handle+36w
; BulletToTank_Impact_Handle+17r
; BulletToTank_Impact_Handle+44w
; BulletToTank_Impact_Handle+4Dw
; BulletToTank_Impact_Handle+92r
; BulletToTank_Impact_Handle+C2w
; BulletToTank_Impact_Handle+150r
; BulletToTank_Impact_Handle+185w
; BulletToTank_Impact_Handle+18Ew
; BulletToBullet_Impact_Handle+Cr
; BulletToBullet_Impact_Handle+27r
; BulletToBullet_Impact_Handle+54w
; BulletToBullet_Impact_Handle+56w
; Make_Player_Shot+20r
; Make_Player_Shot+26w
;Статус пули. Формат:
;2 младших бита (№0,1):
; счётчик фреймов на один кадр (до 3)
;Бит№4,5:
; счётчик кадров анимации рикошета (до 3)
;Бит№6
; выставлен = пуля в полете, при этом обрабатываются атрибуты направления (два младших бита):
; 0 = вверх
; 1 = влево
; 2 = вниз
; 3 = вправо
Bullet_Property:.BYTE 0,0,0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: ROM:E059r
; Make_Shot+2Ew Make_Shot+44w
; Make_Shot+49w Make_Player_Shot+30r
; Bullet_Fly_Handle+Er
; BulletToObject_Impact_Handle+3Er
; Make_Player_Shot+32w
;Свойство пули. Формат: ; Скорость и бронебойность
;Бит 0: выставлен = скорость пули в 2 раза выше
; 1: выставлен = пуля бронебойная
NTAddr_Coord_Lo:.BYTE 0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: Ice_Detect+21w
; HideHiBit_Under_Tank+Er
NTAddr_Coord_Hi:.BYTE 0,0,0,0,0,0,0,0 ; (uninited) ; DATA XREF: Ice_Detect+27w
; Ice_Detect+51r Ice_Detect+55w
; Ice_Detect+62r Ice_Detect+66w
; HideHiBit_Under_Tank+12r
; HideHiBit_Under_Tank+1Fr
; HideHiBit_Under_Tank:+r
;Координаты танков переведенные в адреса Name Table (младший и старший байты):
;Старший байт хранит только два младших байта реального старшего адреса NT
;2 первых байта: 1 и 2 игрок
;6 последующих байт - враги
Low_Ptr_byte2: .BYTE 0 ; (uninited) ; DATA XREF: Sound_Stop+Cw
; Sound_Stop+17w Sound_Stop+1Dr
; Sound_Stop+21w Play_Sound+1Dw
; Play_Sound+2Cr Play_Sound+50w
; Play_Sound+5Br Play_Sound+66r
; Play_Sound+6Aw Play_Sound+99w
; Play_Sound+B1r Play_Sound+B5w
; Play_Sound+C6r Play_Sound+CBw
; Play_Sound+D5w Play_Sound+DFw
; Play_Sound+E6w Play_Sound+EDw
; Play_Sound+F4w Play_Sound+F8r
; Play_Sound+103w Play_Sound+11Bw
; Play_Sound+13Fr Play_Sound+145w
; Play_Sound+14Aw Play_Sound+14Er
; Play_Sound+157w Play_Sound+15Br
; Play_Sound+15Ew Play_Sound+195w
; Play_Sound+199r Play_Sound+19Ew
; ROM:EC28r ROM:EC2Ew ROM:EC3Ar
; ROM:EC40w ROM:EC4Cr ROM:EC4Eo
; ROM:EC52w ROM:EC5Cw ROM:EC66w
; ROM:EC70w ROM:EC9Br ROM:ECA0w
; ROM:ECAAw sub_ECBE+4r sub_ECBE+Ew
High_Ptr_byte2: .BYTE 0 ; (uninited) ; DATA XREF: Sound_Stop+10w
; Sound_Stop+25w Play_Sound+21w
; Play_Sound+6Ew Play_Sound+9Dw
; Play_Sound+B9w
Low_SndPtr: .BYTE 0 ; (uninited) ; DATA XREF: Load_Snd_Ptr+7w
; sub_ECBE+7r
High_SndPtr: .BYTE 0 ; (uninited)
Sound_Number: .BYTE 0 ; (uninited)
byte_F5: .BYTE 0 ; (uninited)
byte_F6: .BYTE 0 ; (uninited)
.BYTE 0 ; (uninited)
byte_F8: .BYTE 0 ; (uninited)
byte_F9: .BYTE 0 ; (uninited)
.BYTE 0 ; (uninited)
.BYTE 0 ; (uninited)
.BYTE 0 ; (uninited)
byte_FD: .BYTE 0 ; (uninited)
byte_FE: .BYTE 0 ; (uninited)
byte_FF: .BYTE 0 ; (uninited)
EnemyFreeze_Timer:.BYTE 0 ; (uninited)
Player_Type: .BYTE 0,0 ; (uninited) ; DATA XREF: Init_Level_VARs+2w
; Load_New_Tank+Dr
; BulletToTank_Impact_Handle+5Ew
; ROM:Bonus_Starr ROM:EA11w
;(8 видов). 0=простой (Формат см. Tank_Type) ; Вид танка игрока
Player_Ice_Status:.BYTE 0,0 ; (uninited) ; DATA XREF: Ice_Move:+++++r
; Ice_Move:loc_DBB4r Ice_Move+4Aw
; ROM:DC56r ROM:DC5Fw Ice_Detect+37r
; Ice_Detect+3Aw Ice_Detect:+r
; Ice_Detect+45w
;Старший бит - флаг наличия под танком льда
;5 младших бит - таймер скольжения по льду (0=не скользит)
GameOverStr_X: .BYTE 0 ; (uninited)
GameOverStr_Y: .BYTE 0 ; (uninited)
GameOverScroll_Type:.BYTE 0 ; (uninited) ; Определяет вид перемещения надписи(0..3)
GameOverStr_Timer:.BYTE 0 ; (uninited)
byte_109: .BYTE 0 ; (uninited) ; DATA XREF: ROM:C755r ROM:C76Er
; ROM:C78Fw ROM:C798w ROM:C7A1r
; ROM:C7A7w
.BYTE 0 ; (uninited)
.BYTE 0 ; (uninited)
.BYTE 0 ; (uninited)
.BYTE 0 ; (uninited)
.BYTE 0 ; (uninited)
.BYTE 0 ; (uninited)
StaffString_RAM: DSB $10,0 ; (uninited)
;!Мои переменные
Random_Level_Flag .BYTE 0; Если нужен случайный уровень, то выставлен младший бит.
Line_TSA_Count .BYTE 0; считает количество тса в одной линии случайного уровня
Old_Coord .BYTE 0;запоминает последнюю удачную координату
Map_Mode_Pos .BYTE 0;Запоминает положение режима уровней 0=orig,1=rand,2=mixd
Boss_Mode .BYTE 0;Если щас будет битва с боссом, то 1
Boss_Armour .BYTE 0;Запоминает сколько hp*4 у босса
ENDE
ENUM $180 ; StaffStr_Check:-r
Screen_Buffer: DSB $80,0 ; (uninited)
; DATA XREF: Draw_StageNumString+Fw
; Draw_StageNumString+14w
; Draw_StageNumString+1Aw
; Draw_StageNumString+20w
; Draw_StageNumString+26w
; Draw_StageNumString+2Cw
; Draw_StageNumString+32w
; Draw_StageNumString+38w
; Draw_StageNumString+3Ew
; Draw_StageNumString+44w
; DraW_Normal_HQ+40w
; DraW_Normal_HQ+46w
; DraW_Normal_HQ+4Fw
; DraW_Normal_HQ+5Bw
; DraW_Normal_HQ+61w Draw_Naked_HQ+22w
; Draw_Naked_HQ+28w Draw_Naked_HQ+34w
; Draw_Naked_HQ+3Aw Draw_ArmourHQ+40w
; Draw_ArmourHQ+46w Draw_ArmourHQ+4Fw
; Draw_ArmourHQ+5Dw Draw_ArmourHQ+63w
; Copy_AttribToScrnBuff+11w
; Copy_AttribToScrnBuff+17w
; Copy_AttribToScrnBuff+1Fw
; Copy_AttribToScrnBuff+25w
; FillScr_Single_Row+10w
; FillScr_Single_Row+16w
; FillScr_Single_Row:+w
; FillScr_Single_Row+2Dw
; AttribToScrBuffer+7w
; AttribToScrBuffer+Fw
; AttribToScrBuffer+16w
; AttribToScrBuffer+1Cw
; String_to_Screen_Buffer+Aw
; String_to_Screen_Buffer+Fw
; String_to_Screen_Buffer+19w
; Save_Str_To_ScrBuffer+8w
; Save_Str_To_ScrBuffer+Dw
; Save_Str_To_ScrBuffer:+w
; Draw_Tile+Bw Draw_Tile+11w
; Draw_Tile+17w Draw_Tile+1Dw
; Update_Screen+4w Update_Screen+Cr
; Update_Screen+13r Update_Screen:--r
; Update_Screen+22r
;Буффер строковых данных, в дальнейшем выводимый на экран:
;Буффер размером 128 байт, однако он активно используется в игре,
;т.к. выводится на экран каждое NMI.
;Перед строкой стоит адрес в PPU (hi/lo), куда будет записана строка
;Конец вывода строки обозначается байтом $FF
SprBuffer: DSB $100,0 ; (uninited)
; DATA XREF: SaveSprTo_SprBuffer+20w
; Spr_Invisible+12w
; SaveSprTo_SprBuffer+25w
; SaveSprTo_SprBuffer+2Aw
; SaveSprTo_SprBuffer+2Fw
; +-----------+-----------+-----+------------+
; | Sprite #0 | Sprite #1 | ... | Sprite #63 |
; +-+------+--+-----------+-----+------------+
; | |
; +------+----------+--------------------------------------+
; + Byte | Bits | Description |
; +------+----------+--------------------------------------+
; | 0 | YYYYYYYY | Y Coordinate - 1. Consider the coor- |
; | | | dinate the upper-left corner of the |
; | | | sprite itself. |
; | 1 | IIIIIIII | Tile Index # |
; | 2 | vhp000cc | Attributes |
; | | | v = Vertical Flip (1=Flip) |
; | | | h = Horizontal Flip (1=Flip) |
; | | | p = Background Priority |
; | | | 0 = In front |
; | | | 1 = Behind |
; | | | c = Upper two (2) bits of colour |
; | 3 | XXXXXXXX | X Coordinate (upper-left corner) |
; +------+----------+--------------------------------------+
;Далее идет массив проигрывания звуков (28 штук): чтобы воспроизвести
;определенный звук, игра записывает $01 в одну из ячеек. Если воспроизводимый
;звук использует несколько каналов, то каждому каналу отводится своя ячейка
;(обозначено индексами после названия звука)
Snd_Pause: .BYTE 0 ; (uninited) ; DATA XREF: ROM:C218w Sound_Stop+19w
; Play_Sound+25r Play_Sound+A1r
; Play_Sound+AAw Play_Sound+190w
Snd_Battle1: .BYTE 0 ; (uninited)
Snd_Battle2: .BYTE 0 ; (uninited)
Snd_Battle3: .BYTE 0 ; (uninited)
Snd_Ancillary_Life1:.BYTE 0 ; (uninited)
Snd_Ancillary_Life2:.BYTE 0 ; (uninited)
Snd_BonusTaken: .BYTE 0 ; (uninited)
Snd_PlayerExplode:.BYTE 0 ; (uninited)
Snd_Unknown1: .BYTE 0 ; (uninited)
Snd_BonusAppears:.BYTE 0 ; (uninited)
Snd_EnemyExplode:.BYTE 0 ; (uninited)
Sns_HQExplode: .BYTE 0 ; (uninited)
Snd_Brick_Ricochet:.BYTE 0 ; (uninited)
Snd_ArmorRicochetWall:.BYTE 0 ; (uninited)
Snd_ArmorRicochetTank:.BYTE 0 ; (uninited)
Snd_Shoot: .BYTE 0 ; (uninited)
Snd_Ice: .BYTE 0 ; (uninited)
Snd_Move: .BYTE 0 ; (uninited)
Snd_Engine: .BYTE 0 ; (uninited)
Snd_PtsCount1: .BYTE 0 ; (uninited)
Snd_PtsCount2: .BYTE 0 ; (uninited)
Snd_RecordPts1: .BYTE 0 ; (uninited)
Snd_RecordPts2: .BYTE 0 ; (uninited)
Snd_RecordPts3: .BYTE 0 ; (uninited)
Snd_GameOver1: .BYTE 0 ; (uninited)
Snd_GameOver2: .BYTE 0 ; (uninited)
Snd_GameOver3: .BYTE 0 ; (uninited)
Snd_BonusPts: .BYTE 0 ; (uninited)
byte_31C: .BYTE 0 ; (uninited)
byte_31D: .BYTE 0 ; (uninited)
ENDE
ENUM $400
NT_Buffer: DSB $400,0 ; (uninited)
; DATA XREF: Null_NT_Buffer:-w
; Draw_GrayFrame:Fill_NTBufferw
ENDE
; end of 'RAM'
|
hanoi.als
|
experimental-dustbin/alloy-models
| 9 |
1997
|
// https://dev.to/davidk01/solving-tower-of-hanoi-with-alloy-5gn9
// Tower of Hanoi: https://en.wikipedia.org/wiki/Tower_of_Hanoi
open util/ordering[Ring]
open util/ordering[TowerPosition]
open util/ordering[State]
// We are going to work with rings. Rings are ordered by size that is
// why we opened ordering for Ring
sig Ring { }
// Rings appear on towers at specific tower positions so we need the positions
// and the positions must respect the size ordering of the rings so that's why
// we also opened ordering for TowerPosition
sig TowerPosition { }
// Tower maps positions to rings and must preserve ordering and have no gaps
sig Tower {
rings: set (TowerPosition -> lone Ring)
} {
let currentPositions = rings.Ring {
// Verify that there are no gaps because rings don't float on air
all position: currentPositions | position.prev in currentPositions
// Verify that rings are in ascending order
all position: currentPositions, positions': position.nexts {
positions'.rings in position.rings.nexts
}
}
}
// A state consists of (l)eft, (m)iddle, (r)ight tower
sig State {
l, m, r: one Tower
} {
// Valid states must include all the rings/disks
Ring in (l + m + r).rings[TowerPosition]
// Towers must be disjoint
let lRings = l.rings[TowerPosition], mRings = m.rings[TowerPosition],
rRings = r.rings[TowerPosition] {
no lRings & (mRings + rRings) + mRings & rRings
}
}
// True only if `r` is a top ring in `t`. Verified in the evaluator as valid
pred topRingInTower(t: Tower, r: Ring) {
let ringPosition = t.rings.r, nextPosition = ringPosition.next {
// There is a ring position and there is nothing higher
(one ringPosition && (no nextPosition || no t.rings[nextPosition]))
}
}
// All the conditions are required for sensible results. Try removing
// some of the conditions and seeing what happens.
// Two towers `t1`, `t2` are compatible if we can put `r` on top of `t1` and get `t2`
pred ringTowerCompatibility(r: Ring, t1, t2: Tower) {
// The base case is that `t1` is the empty tower
no t1.rings => {
// Then `r` must be the only ring in `t2`
one t2.rings && one t2.rings.r
} else { // Otherwise `t1` is not empty
// `r` must be a new ring
no t1.rings.r
// `r` must be a top ring in `t2`
topRingInTower[t2, r]
// The ring ordering for `t1` must be in `t2`
t1.rings in t2.rings
// `t2` must differ from `t1` by only 1 ring
t2.rings[TowerPosition] - t1.rings[TowerPosition] = r
}
}
// Two towers are compatible if they're equal or they are ring compatible
pred towerCompatibility(t1, t2: Tower) {
t1 = t2 ||
one r: Ring {
ringTowerCompatibility[r, t1, t2] ||
ringTowerCompatibility[r, t2, t1]
}
}
// True only if `ring` is a top ring in one of the "pegs" of `s`
pred topRing(s: State, ring: Ring) {
topRingInTower[s.l, ring] ||
topRingInTower[s.m, ring] ||
topRingInTower[s.r, ring]
}
// The transition relation basically says two consecutive states
// `s` and `s'` are related if their corresponding towers are compatible.
// It turns out that when all the towers in both states are compatible they
// differ by a single ring/disk move.
pred transition(s, s': State) {
s' = s.next
// We can only move 1 ring at a time
// The transition must preserve compatibility
towerCompatibility[s.l, s'.l]
towerCompatibility[s.m, s'.m]
towerCompatibility[s.r, s'.r]
}
// We will want unequal states to see what is going on
pred equalState(s, s': State) {
s.l = s'.l && s.m = s'.m && s.r = s'.r
}
// Different towers must have different orderings
fact { all disj t, t': Tower | t.rings != t'.rings }
// Starting state must have everything on the left tower
fact {
let firstState = first & State {
Ring in firstState.l.rings[TowerPosition]
}
}
// Last state must have everything on the right tower
fact {
let lastState = last & State {
Ring in lastState.r.rings[TowerPosition]
}
}
run {
// Relate the states by transition
all s: State, s': s.next | transition[s, s']
// Make sure the states are different
all disj s, s': State | !equalState[s, s']
} for exactly 3 Ring, exactly 3 TowerPosition,
exactly 8 Tower, exactly 8 State
|
28_Per-Pixel_Collision_Detection/Dot.asm
|
DebugBSD/SDLExamples
| 3 |
102187
|
<reponame>DebugBSD/SDLExamples
include Dot.inc
Dot_shiftColliders proto :PTR Dot
.code
Dot_Init proc pDot:PTR Dot, x:DWORD, y:DWORD ; Constructor
mov r10d, x
mov r11d, y
mov rdi, pDot
mov (Dot PTR [rdi]).m_PosX, r10d
mov (Dot PTR [rdi]).m_PosY, r11d
mov (Dot PTR [rdi]).m_VelX, 0
mov (Dot PTR [rdi]).m_VelY, 0
mov (Dot PTR [rdi]).m_Colliders[0 * SIZEOF SDL_Rect].w, 6
mov (Dot PTR [rdi]).m_Colliders[0 * SIZEOF SDL_Rect].h, 1
mov (Dot PTR [rdi]).m_Colliders[1 * SIZEOF SDL_Rect].w, 10
mov (Dot PTR [rdi]).m_Colliders[1 * SIZEOF SDL_Rect].h, 1
mov (Dot PTR [rdi]).m_Colliders[2 * SIZEOF SDL_Rect].w, 14
mov (Dot PTR [rdi]).m_Colliders[2 * SIZEOF SDL_Rect].h, 1
mov (Dot PTR [rdi]).m_Colliders[3 * SIZEOF SDL_Rect].w, 16
mov (Dot PTR [rdi]).m_Colliders[3 * SIZEOF SDL_Rect].h, 2
mov (Dot PTR [rdi]).m_Colliders[4 * SIZEOF SDL_Rect].w, 18
mov (Dot PTR [rdi]).m_Colliders[4 * SIZEOF SDL_Rect].h, 2
mov (Dot PTR [rdi]).m_Colliders[5 * SIZEOF SDL_Rect].w, 20
mov (Dot PTR [rdi]).m_Colliders[5 * SIZEOF SDL_Rect].h, 6
mov (Dot PTR [rdi]).m_Colliders[6 * SIZEOF SDL_Rect].w, 18
mov (Dot PTR [rdi]).m_Colliders[6 * SIZEOF SDL_Rect].h, 2
mov (Dot PTR [rdi]).m_Colliders[7 * SIZEOF SDL_Rect].w, 16
mov (Dot PTR [rdi]).m_Colliders[7 * SIZEOF SDL_Rect].h, 2
mov (Dot PTR [rdi]).m_Colliders[8 * SIZEOF SDL_Rect].w, 14
mov (Dot PTR [rdi]).m_Colliders[8 * SIZEOF SDL_Rect].h, 1
mov (Dot PTR [rdi]).m_Colliders[9 * SIZEOF SDL_Rect].w, 10
mov (Dot PTR [rdi]).m_Colliders[9 * SIZEOF SDL_Rect].h, 1
mov (Dot PTR [rdi]).m_Colliders[10 * SIZEOF SDL_Rect].w, 6
mov (Dot PTR [rdi]).m_Colliders[10 * SIZEOF SDL_Rect].h, 1
; Initialize colliders relative to position
invoke Dot_shiftColliders, pDot
ret
Dot_Init endp
Dot_handleEvent proc uses rax rbx rcx rdx rsi, pDot:ptr Dot, e:ptr SDL_Event
mov rsi, e
mov rdi, pDot
.if (SDL_Event PTR[rsi]).type_ == SDL_KEYDOWN && (SDL_Event PTR[rsi]).key.repeat_==0
.if (SDL_Event PTR[rsi]).key.keysym.sym==SDLK_UP
sub (Dot PTR [rdi]).m_VelY, DOT_VEL
.elseif (SDL_Event PTR[rsi]).key.keysym.sym==SDLK_DOWN
add (Dot PTR [rdi]).m_VelY, DOT_VEL
.elseif (SDL_Event PTR[rsi]).key.keysym.sym==SDLK_LEFT
sub (Dot PTR [rdi]).m_VelX, DOT_VEL
.elseif (SDL_Event PTR[rsi]).key.keysym.sym==SDLK_RIGHT
add (Dot PTR [rdi]).m_VelX, DOT_VEL
.endif
.elseif (SDL_Event PTR[rsi]).type_ == SDL_KEYUP && (SDL_Event PTR[rsi]).key.repeat_==0
.if (SDL_Event PTR[rsi]).key.keysym.sym==SDLK_UP
add (Dot PTR [rdi]).m_VelY, DOT_VEL
.elseif (SDL_Event PTR[rsi]).key.keysym.sym==SDLK_DOWN
sub (Dot PTR [rdi]).m_VelY, DOT_VEL
.elseif (SDL_Event PTR[rsi]).key.keysym.sym==SDLK_LEFT
add (Dot PTR [rdi]).m_VelX, DOT_VEL
.elseif (SDL_Event PTR[rsi]).key.keysym.sym==SDLK_RIGHT
sub (Dot PTR [rdi]).m_VelX, DOT_VEL
.endif
.endif
ret
Dot_handleEvent endp
Dot_move proc uses rax rbx rcx rsi, pDot:PTR Dot, pOtherColliders:PTR SDL_Rect
LOCAL t1:DWORD
LOCAL t2:QWORD
mov rsi, pDot
; Move the dot left or right
mov r10d, (Dot PTR[rsi]).m_PosX
add r10d, (Dot PTR[rsi]).m_VelX
mov (Dot PTR[rsi]).m_PosX, r10d
invoke Dot_shiftColliders, pDot ; Update collision info
mov rbx, r10
add rbx, DOT_WIDTH
; If the dot went too far to the left or right
mov t1, r10d
mov t2, rsi
invoke CheckCollision, addr (Dot PTR[rsi]).m_Colliders, pOtherColliders ; Check collision
mov rsi, t2
mov r10d, t1
.if r10<0 || rbx > SCREEN_WIDTH || rax
sub r10d, (Dot PTR[rsi]).m_VelX
mov (Dot PTR[rsi]).m_PosX, r10d
invoke Dot_shiftColliders, pDot ; Update collision info
.endif
; Move the dot up or down
mov r10d, (Dot PTR[rsi]).m_PosY
add r10d, (Dot PTR[rsi]).m_VelY
mov (Dot PTR[rsi]).m_PosY, r10d
invoke Dot_shiftColliders, pDot ; Update collision info
mov rbx, r10
; If the dot went too far up or down
add rbx, DOT_HEIGHT
mov t1, r10d
mov t2, rsi
invoke CheckCollision, addr (Dot PTR[rsi]).m_Colliders, pOtherColliders ; Check collision
mov rsi, t2
mov r10d, t1
.if r10d<0 || rbx > SCREEN_HEIGHT || rax
sub r10d, (Dot PTR[rsi]).m_VelY
mov (Dot PTR[rsi]).m_PosY, r10d
invoke Dot_shiftColliders, pDot ; Update collision info
.endif
ret
Dot_move endp
Dot_render proc uses rax rcx rsi, pDot:ptr Dot, pTexture:ptr LTexture
mov rsi, pDot
invoke renderTexture, gRenderer, pTexture, (Dot PTR [rsi]).m_PosX, (Dot PTR [rsi]).m_PosY, 0, 0, 0, 0
ret
Dot_render endp
Dot_shiftColliders proc uses rsi rdi r8 r9, pDot:PTR Dot
LOCAL r:DWORD
mov rsi, pDot
lea rdi, (Dot PTR[rsi]).m_Colliders
xor r11, r11
xor r12, r12
mov r, 0
.while r12 < 11
; Center the collision box
mov r8d, DOT_WIDTH
sub r8d, (SDL_Rect PTR[rdi]).w ; (DOT_WIDTH - m_Colliders[set].w)
shr r8d, 1 ; ((DOT_WIDTH - m_Colliders[set].w) / 2)
add r8d, (Dot PTR[rsi]).m_PosX ; (m_PosX + ((DOT_WIDTH - m_Colliders[set].w) / 2))
mov (SDL_Rect PTR[rdi]).x, r8d ; mColliders[ set ].x = (m_PosX + ((DOT_WIDTH - m_Colliders[set].w) / 2))
; Set the collision box at its row offset
mov r9d, (Dot PTR[rsi]).m_PosY
add r9d, r
mov (SDL_Rect PTR[rdi]).y, r9d
; Move the row offset down the height of the collision box
mov r8d, r
add r8d, (SDL_Rect PTR[rdi]).h
mov r, r8d
; Increment the pointer
add rdi, SIZEOF SDL_Rect
inc r12
.endw
ret
Dot_shiftColliders endp
|
Cubical/Algebra/Group/GroupPath.agda
|
guilhermehas/cubical
| 1 |
6800
|
<gh_stars>1-10
-- The SIP applied to groups
{-# OPTIONS --safe #-}
module Cubical.Algebra.Group.GroupPath where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Equiv.HalfAdjoint
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Transport
open import Cubical.Foundations.Univalence
open import Cubical.Foundations.SIP
open import Cubical.Foundations.Function using (_∘_)
open import Cubical.Foundations.GroupoidLaws hiding (assoc)
open import Cubical.Data.Sigma
open import Cubical.Displayed.Base
open import Cubical.Displayed.Auto
open import Cubical.Displayed.Record
open import Cubical.Displayed.Universe
open import Cubical.Algebra.Semigroup
open import Cubical.Algebra.Monoid
open import Cubical.Algebra.Group.Base
open import Cubical.Algebra.Group.Properties
open import Cubical.Algebra.Group.Morphisms
open import Cubical.Algebra.Group.MorphismProperties
private
variable
ℓ ℓ' ℓ'' : Level
open Iso
open GroupStr
open IsGroupHom
𝒮ᴰ-Group : DUARel (𝒮-Univ ℓ) GroupStr ℓ
𝒮ᴰ-Group =
𝒮ᴰ-Record (𝒮-Univ _) IsGroupEquiv
(fields:
data[ _·_ ∣ autoDUARel _ _ ∣ pres· ]
data[ 1g ∣ autoDUARel _ _ ∣ pres1 ]
data[ inv ∣ autoDUARel _ _ ∣ presinv ]
prop[ isGroup ∣ (λ _ _ → isPropIsGroup _ _ _) ])
where
open GroupStr
open IsGroupHom
GroupPath : (M N : Group ℓ) → GroupEquiv M N ≃ (M ≡ N)
GroupPath = ∫ 𝒮ᴰ-Group .UARel.ua
-- TODO: Induced structure results are temporarily inconvenient while we transition between algebra
-- representations
module _ (G : Group ℓ) {A : Type ℓ} (m : A → A → A)
(e : ⟨ G ⟩ ≃ A)
(p· : ∀ x y → e .fst (G .snd ._·_ x y) ≡ m (e .fst x) (e .fst y))
where
private
module G = GroupStr (G .snd)
FamilyΣ : Σ[ B ∈ Type ℓ ] (B → B → B) → Type ℓ
FamilyΣ (B , n) =
Σ[ e ∈ B ]
Σ[ i ∈ (B → B) ]
IsGroup e n i
inducedΣ : FamilyΣ (A , m)
inducedΣ =
subst FamilyΣ
(UARel.≅→≡ (autoUARel (Σ[ B ∈ Type ℓ ] (B → B → B))) (e , p·))
(G.1g , G.inv , G.isGroup)
InducedGroup : Group ℓ
InducedGroup .fst = A
InducedGroup .snd ._·_ = m
InducedGroup .snd .1g = inducedΣ .fst
InducedGroup .snd .inv = inducedΣ .snd .fst
InducedGroup .snd .isGroup = inducedΣ .snd .snd
InducedGroupEquiv : GroupEquiv G InducedGroup
fst InducedGroupEquiv = e
snd InducedGroupEquiv = makeIsGroupHom p·
InducedGroupPath : G ≡ InducedGroup
InducedGroupPath = GroupPath _ _ .fst InducedGroupEquiv
uaGroup : {G H : Group ℓ} → GroupEquiv G H → G ≡ H
uaGroup {G = G} {H = H} = equivFun (GroupPath G H)
-- Group-ua functoriality
Group≡ : (G H : Group ℓ) → (
Σ[ p ∈ ⟨ G ⟩ ≡ ⟨ H ⟩ ]
Σ[ q ∈ PathP (λ i → p i) (1g (snd G)) (1g (snd H)) ]
Σ[ r ∈ PathP (λ i → p i → p i → p i) (_·_ (snd G)) (_·_ (snd H)) ]
Σ[ s ∈ PathP (λ i → p i → p i) (inv (snd G)) (inv (snd H)) ]
PathP (λ i → IsGroup (q i) (r i) (s i)) (isGroup (snd G)) (isGroup (snd H)))
≃ (G ≡ H)
Group≡ G H = isoToEquiv theIso
where
theIso : Iso _ _
fun theIso (p , q , r , s , t) i = p i , groupstr (q i) (r i) (s i) (t i)
inv theIso x = cong ⟨_⟩ x , cong (1g ∘ snd) x , cong (_·_ ∘ snd) x , cong (inv ∘ snd) x , cong (isGroup ∘ snd) x
rightInv theIso _ = refl
leftInv theIso _ = refl
caracGroup≡ : {G H : Group ℓ} (p q : G ≡ H) → cong ⟨_⟩ p ≡ cong ⟨_⟩ q → p ≡ q
caracGroup≡ {G = G} {H = H} p q P =
sym (transportTransport⁻ (ua (Group≡ G H)) p)
∙∙ cong (transport (ua (Group≡ G H))) helper
∙∙ transportTransport⁻ (ua (Group≡ G H)) q
where
helper : transport (sym (ua (Group≡ G H))) p ≡ transport (sym (ua (Group≡ G H))) q
helper = Σ≡Prop
(λ _ → isPropΣ
(isOfHLevelPathP' 1 (is-set (snd H)) _ _)
λ _ → isPropΣ (isOfHLevelPathP' 1 (isSetΠ2 λ _ _ → is-set (snd H)) _ _)
λ _ → isPropΣ (isOfHLevelPathP' 1 (isSetΠ λ _ → is-set (snd H)) _ _)
λ _ → isOfHLevelPathP 1 (isPropIsGroup _ _ _) _ _)
(transportRefl (cong ⟨_⟩ p) ∙ P ∙ sym (transportRefl (cong ⟨_⟩ q)))
uaGroupId : (G : Group ℓ) → uaGroup (idGroupEquiv {G = G}) ≡ refl
uaGroupId G = caracGroup≡ _ _ uaIdEquiv
uaCompGroupEquiv : {F G H : Group ℓ} (f : GroupEquiv F G) (g : GroupEquiv G H)
→ uaGroup (compGroupEquiv f g) ≡ uaGroup f ∙ uaGroup g
uaCompGroupEquiv f g = caracGroup≡ _ _ (
cong ⟨_⟩ (uaGroup (compGroupEquiv f g))
≡⟨ uaCompEquiv _ _ ⟩
cong ⟨_⟩ (uaGroup f) ∙ cong ⟨_⟩ (uaGroup g)
≡⟨ sym (cong-∙ ⟨_⟩ (uaGroup f) (uaGroup g)) ⟩
cong ⟨_⟩ (uaGroup f ∙ uaGroup g) ∎)
-- J-rule for GroupEquivs
GroupEquivJ : {G : Group ℓ} (P : (H : Group ℓ) → GroupEquiv G H → Type ℓ')
→ P G idGroupEquiv
→ ∀ {H} e → P H e
GroupEquivJ {G = G} P p {H} e =
transport (λ i → P (GroupPath G H .fst e i)
(transp (λ j → GroupEquiv G (GroupPath G H .fst e (i ∨ ~ j))) i e))
(subst (P G) (sym lem) p)
where
lem : transport (λ j → GroupEquiv G (GroupPath G H .fst e (~ j))) e
≡ idGroupEquiv
lem = Σ≡Prop (λ _ → isPropIsGroupHom _ _)
(Σ≡Prop (λ _ → isPropIsEquiv _)
(funExt λ x → (λ i → fst (fst (fst e .snd .equiv-proof
(transportRefl (fst (fst e) (transportRefl x i)) i))))
∙ retEq (fst e) x))
|
src/frontend/Experimental_Ada_ROSE_Connection/dot_asis/dot_asis_library/source/tool_2_wrapper_h.adb
|
sourceryinstitute/rose-sourcery-institute
| 0 |
6000
|
<gh_stars>0
with Ada.Text_IO;
with Interfaces.C;
with Asis_Tool_2.Tool;
with a_nodes_h.Support;
package body tool_2_wrapper_h is
package anhS renames a_nodes_h.Support;
function tool_2_wrapper
(target_file_in : in Interfaces.C.Strings.chars_ptr;
gnat_home : in Interfaces.C.Strings.chars_ptr;
output_dir : in Interfaces.C.Strings.chars_ptr)
return a_nodes_h.Nodes_Struct
is
Target_File_In_String_Access : access String :=
new String'(Interfaces.C.To_Ada
(Interfaces.C.Strings.Value (target_file_in)));
GNAT_Home_String_Access : access String :=
new String'(Interfaces.C.To_Ada
(Interfaces.C.Strings.Value (gnat_home)));
Output_Dir_String_Access : access String :=
new String'(Interfaces.C.To_Ada
(Interfaces.C.Strings.Value (output_dir)));
Compile_Succeeded : Boolean := False;
Tool : Asis_Tool_2.Tool.Class; -- Initialized
Result : a_nodes_h.Nodes_Struct :=
anhs.Default_Nodes_Struct;
procedure Log (Message : in String) is
begin
Ada.Text_Io.Put_Line ("tool_2_wrapper_h.tool_2_wrapper: " & Message);
end;
begin
Log ("BEGIN");
Tool.Process
(File_Name => Target_File_In_String_Access.all,
GNAT_Home => GNAT_Home_String_Access.all,
Output_Dir => Output_Dir_String_Access.all,
Debug => False);
Result := Tool.Get_Nodes;
-- Can't take 'Image of an expression, so " + 1" below:
Log ("Returning " & Result.Units.Next_Count'Image & " + 1 Units.");
Log ("Returning " & Result.Elements.Next_Count'Image & " + 1 Elements.");
Log ("END");
return Result;
end tool_2_wrapper;
end tool_2_wrapper_h;
|
programs/oeis/189/A189007.asm
|
neoneye/loda
| 22 |
179474
|
<reponame>neoneye/loda
; A189007: Number of ON cells after n generations of the 2D cellular automaton described in the comments.
; 1,4,8,16,16,32,32,64,32,64,64,128,64,128,128,256,64,128,128,256,128,256,256,512,128,256,256,512,256,512,512,1024,128,256,256,512,256,512,512,1024,256,512,512,1024,512,1024,1024,2048,256,512,512,1024,512,1024,1024,2048,512,1024,1024,2048,1024,2048,2048,4096,256,512,512,1024,512
mul $0,2
mov $1,1
mov $2,$0
lpb $2
mul $1,2
sub $2,1
dif $2,2
lpe
mov $0,$1
|
source/league/ucd/matreshka-internals-unicode-ucd-core_0111.ads
|
svn2github/matreshka
| 24 |
7830
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_0111 is
pragma Preelaborate;
Group_0111 : aliased constant Core_Second_Stage
:= (16#00# .. 16#02# => -- 011100 .. 011102
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#27# .. 16#2B# => -- 011127 .. 01112B
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#2C# => -- 01112C
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#2D# .. 16#32# => -- 01112D .. 011132
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#33# .. 16#34# => -- 011133 .. 011134
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| Grapheme_Link
| ID_Continue
| XID_Continue => True,
others => False)),
16#35# => -- 011135
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#36# .. 16#3F# => -- 011136 .. 01113F
(Decimal_Number, Neutral,
Other, Numeric, Numeric, Numeric,
(Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#40# => -- 011140
(Other_Punctuation, Neutral,
Other, Other, Other, Break_After,
(Grapheme_Base => True,
others => False)),
16#41# .. 16#43# => -- 011141 .. 011143
(Other_Punctuation, Neutral,
Other, Other, S_Term, Break_After,
(STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#44# .. 16#4F# => -- 011144 .. 01114F
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#73# => -- 011173
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#74# => -- 011174
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#75# => -- 011175
(Other_Punctuation, Neutral,
Other, Other, Other, Break_Before,
(Grapheme_Base => True,
others => False)),
16#77# .. 16#7F# => -- 011177 .. 01117F
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#80# .. 16#81# => -- 011180 .. 011181
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#82# => -- 011182
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#B3# .. 16#B5# => -- 0111B3 .. 0111B5
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#B6# .. 16#BE# => -- 0111B6 .. 0111BE
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#BF# => -- 0111BF
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#C0# => -- 0111C0
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Diacritic
| Grapheme_Base
| Grapheme_Link
| ID_Continue
| XID_Continue => True,
others => False)),
16#C5# .. 16#C6# => -- 0111C5 .. 0111C6
(Other_Punctuation, Neutral,
Other, Other, S_Term, Break_After,
(STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#C7# => -- 0111C7
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#C8# => -- 0111C8
(Other_Punctuation, Neutral,
Other, Other, Other, Break_After,
(Grapheme_Base => True,
others => False)),
16#C9# .. 16#CC# => -- 0111C9 .. 0111CC
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#CD# => -- 0111CD
(Other_Punctuation, Neutral,
Other, Other, S_Term, Alphabetic,
(STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#CE# .. 16#CF# => -- 0111CE .. 0111CF
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#D0# .. 16#D9# => -- 0111D0 .. 0111D9
(Decimal_Number, Neutral,
Other, Numeric, Numeric, Numeric,
(Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#DB# .. 16#E0# => -- 0111DB .. 0111E0
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#E1# .. 16#F4# => -- 0111E1 .. 0111F4
(Other_Number, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#F5# .. 16#FF# => -- 0111F5 .. 0111FF
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
others =>
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_0111;
|
lark/lib/parser.ads
|
cocolab8/cocktail
| 0 |
22644
|
-- $Id: parser.ads,v 1.0 1994/09/13 12:55:32 grosch rel $
$- -- IMPORT section is inserted here
$@ package @ is
$E -- EXPORT section is inserted here
-- named constants for start symbols
$I -- start symbol constants are inserted here
-- named constants for nonterminals
$U -- nonterminal constants are inserted here
yyDebug : Boolean := False;
$@ procedure Begin@;
$@ function @ return Integer;
$@ function @2 (yyStartSymbol: Integer) return Integer;
$@ procedure Close@;
function TokenName (Token: Integer) return String;
$@ end @;
|
stm32f3/stm32f303xe/svd/stm32_svd-interrupts.ads
|
ekoeppen/STM32_Generic_Ada_Drivers
| 1 |
27008
|
<reponame>ekoeppen/STM32_Generic_Ada_Drivers<gh_stars>1-10
-- This spec has been automatically generated from STM32F303xE.svd
-- Definition of the device's interrupts
package STM32_SVD.Interrupts is
----------------
-- Interrupts --
----------------
-- Window Watchdog interrupt
WWDG : constant := 0;
-- PVD through EXTI line detection interrupt
PVD : constant := 1;
-- Tamper and TimeStamp interrupts
TAMP_STAMP : constant := 2;
-- RTC Wakeup interrupt through the EXTI line
RTC_WKUP : constant := 3;
-- Flash global interrupt
FLASH : constant := 4;
-- RCC global interrupt
RCC : constant := 5;
-- EXTI Line0 interrupt
EXTI0 : constant := 6;
-- EXTI Line3 interrupt
EXTI1 : constant := 7;
-- EXTI Line2 and Touch sensing interrupts
EXTI2_TSC : constant := 8;
-- EXTI Line3 interrupt
EXTI3 : constant := 9;
-- EXTI Line4 interrupt
EXTI4 : constant := 10;
-- DMA1 channel 1 interrupt
DMA1_CH1 : constant := 11;
-- DMA1 channel 2 interrupt
DMA1_CH2 : constant := 12;
-- DMA1 channel 3 interrupt
DMA1_CH3 : constant := 13;
-- DMA1 channel 4 interrupt
DMA1_CH4 : constant := 14;
-- DMA1 channel 5 interrupt
DMA1_CH5 : constant := 15;
-- DMA1 channel 6 interrupt
DMA1_CH6 : constant := 16;
-- DMA1 channel 7interrupt
DMA1_CH7 : constant := 17;
-- ADC1 and ADC2 global interrupt
ADC1_2 : constant := 18;
-- USB High Priority/CAN_TX interrupts
USB_HP_CAN_TX : constant := 19;
-- USB Low Priority/CAN_RX0 interrupts
USB_LP_CAN_RX0 : constant := 20;
-- CAN_RX1 interrupt
CAN_RX1 : constant := 21;
-- CAN_SCE interrupt
CAN_SCE : constant := 22;
-- EXTI Line5 to Line9 interrupts
EXTI9_5 : constant := 23;
-- TIM1 Break/TIM15 global interruts
TIM1_BRK_TIM15 : constant := 24;
-- TIM1 Update/TIM16 global interrupts
TIM1_UP_TIM16 : constant := 25;
-- TIM1 trigger and commutation/TIM17 interrupts
TIM1_TRG_COM_TIM17 : constant := 26;
-- TIM1 capture compare interrupt
TIM1_CC : constant := 27;
-- TIM2 global interrupt
TIM2 : constant := 28;
-- TIM3 global interrupt
TIM3 : constant := 29;
-- TIM4 global interrupt
TIM4 : constant := 30;
-- I2C1 event interrupt and EXTI Line23 interrupt
I2C1_EV_EXTI23 : constant := 31;
-- I2C1 error interrupt
I2C1_ER : constant := 32;
-- I2C2 event interrupt & EXTI Line24 interrupt
I2C2_EV_EXTI24 : constant := 33;
-- I2C2 error interrupt
I2C2_ER : constant := 34;
-- SPI1 global interrupt
SPI1 : constant := 35;
-- SPI2 global interrupt
SPI2 : constant := 36;
-- USART1 global interrupt and EXTI Line 25 interrupt
USART1_EXTI25 : constant := 37;
-- USART2 global interrupt and EXTI Line 26 interrupt
USART2_EXTI26 : constant := 38;
-- USART3 global interrupt and EXTI Line 28 interrupt
USART3_EXTI28 : constant := 39;
-- EXTI Line15 to Line10 interrupts
EXTI15_10 : constant := 40;
-- RTC alarm interrupt
RTCAlarm : constant := 41;
-- USB wakeup from Suspend
USB_WKUP : constant := 42;
-- TIM8 break interrupt
TIM8_BRK : constant := 43;
-- TIM8 update interrupt
TIM8_UP : constant := 44;
-- TIM8 Trigger and commutation interrupts
TIM8_TRG_COM : constant := 45;
-- TIM8 capture compare interrupt
TIM8_CC : constant := 46;
-- ADC3 global interrupt
ADC3 : constant := 47;
-- SPI3 global interrupt
SPI3 : constant := 51;
-- UART4 global and EXTI Line 34 interrupts
UART4_EXTI34 : constant := 52;
-- UART5 global and EXTI Line 35 interrupts
UART5_EXTI35 : constant := 53;
-- TIM6 global and DAC12 underrun interrupts
TIM6_DACUNDER : constant := 54;
-- TIM7 global interrupt
TIM7 : constant := 55;
-- DMA2 channel1 global interrupt
DMA2_CH1 : constant := 56;
-- DMA2 channel2 global interrupt
DMA2_CH2 : constant := 57;
-- DMA2 channel3 global interrupt
DMA2_CH3 : constant := 58;
-- DMA2 channel4 global interrupt
DMA2_CH4 : constant := 59;
-- DMA2 channel5 global interrupt
DMA2_CH5 : constant := 60;
-- ADC4 global interrupt
ADC4 : constant := 61;
-- COMP1 & COMP2 & COMP3 interrupts combined with EXTI Lines 21, 22 and 29
-- interrupts
COMP123 : constant := 64;
-- COMP4 & COMP5 & COMP6 interrupts combined with EXTI Lines 30, 31 and 32
-- interrupts
COMP456 : constant := 65;
-- COMP7 interrupt combined with EXTI Line 33 interrupt
COMP7 : constant := 66;
-- USB High priority interrupt
USB_HP : constant := 74;
-- USB Low priority interrupt
USB_LP : constant := 75;
-- USB wakeup from Suspend and EXTI Line 18
USB_WKUP_EXTI : constant := 76;
-- Floating point interrupt
FPU : constant := 81;
end STM32_SVD.Interrupts;
|
helloworld.asm
|
carpetmaker3162/hello-world
| 0 |
92343
|
.text
.globl _main
_main:
push %rbp
sub $16, %rsp
lea msg(%rip), %rdi
call _printf
add $16, %rsp
pop %rbx
ret
.data
msg: .ascii "Hello World!\n"
|
experiments/test-suite/mutation-based/10/10/binaryTree.als
|
kaiyuanw/AlloyFLCore
| 1 |
5017
|
pred test15 {
some disj Node0, Node1: Node {
Node = Node0 + Node1
no left
right = Node0->Node1 + Node1->Node0
Acyclic[]
}
}
run test15 for 3 expect 0
pred test3 {
no Node
no left
no right
}
run test3 for 3 expect 1
pred test14 {
some disj Node0: Node {
Node = Node0
no left
no right
Acyclic[]
}
}
run test14 for 3 expect 1
|
core/old/system.asm
|
paulscottrobson/nextForth
| 2 |
176758
|
; **********************************************************************************************************
;
; Name: system.asm
; Purpose System Primitive Words for Z80 CMForth Core
; Author: <NAME> (<EMAIL>)
; Date: 28th January 2018
;
; **********************************************************************************************************
; **********************************************************************************************************
; debug : Enter CSpect Debugger
; **********************************************************************************************************
WD_Debug: ; ==== debug ====
db $DD,$01
jp (ix)
; **********************************************************************************************************
; screen! : write to screen
; **********************************************************************************************************
WD_ScreenWrite8: ; ==== screen! ====
jp WXScreenWrite8
db 0
; **********************************************************************************************************
; colour! : set write colour
; **********************************************************************************************************
WD_SetColour: ; ==== colour! ====
jp WXSetColour
db 0
; **********************************************************************************************************
; cls : Clear Screen
; **********************************************************************************************************
WD_ClearScreen: ; ==== cls ====
jp WXClearScreen
db 0
; **********************************************************************************************************
; cursor! : Set Cursor position
; **********************************************************************************************************
WD_SetCursor: ; ==== cursor! ====
jp WXSetCursor
db 0
; **********************************************************************************************************
; port@ : Read I/O port
; **********************************************************************************************************
WD_ReadPort: ; ==== port@ ====
jp WXReadPort
db 0
; **********************************************************************************************************
; port! : Write I/O port
; **********************************************************************************************************
WD_WritePort: ; ==== port! ====
jp WXWritePort
db 0
; **********************************************************************************************************
; keyboard@ : read key pressed or 0
; **********************************************************************************************************
WD_ReadKeyboard: ; ==== keyboard@ ====
jp WXReadKeyboard
db 0
WD_DumpStack: ; ==== dump.stack ====
jp WXDumpStack
db 0
WD_I: ; ==== i ====
jp WXGetIndex
db 0
; **********************************************************************************************************
; [next] : next handler
; **********************************************************************************************************
WD_Next: ; ==== [next] ====
ld l,c ; return stack pointer in HL
ld h,b
ld a,(hl) ; if LSB is zero
or a
jr nz,__NextNoDec
inc hl ; decrement the MSB of the counter
dec (hl)
dec hl
__NextNoDec:
dec (hl) ; decrement the LSB of the count
ld a,(hl) ; check if count is zero.
inc hl
or (hl)
jr nz,__NextLoop ; if not, do the loop
inc de ; set over the branch offset.
inc c ; throw the counter.
inc c
jp (ix) ; and exit
;
__NextLoop:
ld a,(de) ; get offset back
inc de
ld l,a ; put as a negative offset in HL
ld h,$FF
add hl,de ; calculate return address
ex de,hl ; put in DE
jp (ix) ; and exit.
ScreenCopy:
exx
pop bc ; size
pop hl ; start pos on screen
pop de ; source of data.
__SCLoop:
ld a,(de) ; read character
call IO_WriteCharacter ; write to screen at HL
inc hl ; bump pos and pointer
inc de
dec bc ; dec count
ld a,b
or c
jr nz,__SCLoop
exx
jp (ix)
db 0,0
WXReadKeyboard:
call IO_ScanKeyboard
ld l,a
ld h,0
push hl
jp (ix)
;
WXSetCursor:
exx
pop hl
call IO_SetCursor
exx
jp (ix)
;
WXClearScreen:
exx
call IO_ClearScreen
ld hl,0
call IO_SetCursor
exx
jp (ix)
;
WXSetColour:
pop hl
ld a,l
ld (IOWC_Colour),a
jp (ix)
;
WXScreenWrite8:
exx
pop hl
pop de
ld a,e
call IO_WriteCharacter
exx
jp (ix)
;
WXReadPort:
exx
pop bc ; address in BC
in l,(c) ; read into L
ld h,0
push hl
exx
jp (ix)
db 0,0
WXWritePort:
exx
pop bc ; address in BC
pop hl ; data in L
out (c),l ; write it.
exx
jp (ix)
;
WXDumpStack:
call IO_DumpStack
jp (ix)
;
WXGetIndex:
ld a,(bc)
ld l,a
inc c
ld a,(bc)
ld h,a
dec c
push hl
jp (ix)
db 0,0,0
|
oeis/049/A049684.asm
|
neoneye/loda-programs
| 11 |
102992
|
; A049684: a(n) = Fibonacci(2n)^2.
; Submitted by <NAME>
; 0,1,9,64,441,3025,20736,142129,974169,6677056,45765225,313679521,2149991424,14736260449,101003831721,692290561600,4745030099481,32522920134769,222915410843904,1527884955772561,10472279279564025,71778070001175616,491974210728665289,3372041405099481409,23112315624967704576,158414167969674450625,1085786860162753449801,7442093853169599697984,51008870112024444436089,349619996931001511354641,2396331108404986135046400,16424697761903901433970161,112576553224922323902744729,771611174812552365885242944
mov $2,1
lpb $0
sub $0,1
add $2,$1
add $1,$2
lpe
pow $1,2
mov $0,$1
|
src/08-events/canon-to-canoe.asm
|
chaoshades/snes-ffci
| 0 |
23677
|
org $00A9FE ; Routine to hack
LDA $1281
AND #$04 ; check if "Yang Destroyed Cannon" flag is set
BEQ $23 ; If equal, skip to next check
LDA $1704 ; Load the current vehicle
; Is in no vehicle (00)
BNE $0B ; If not equal, skip to next check
LDA $A1,x ; Load traversability value of the target tile
AND #$02 ; check that it is traversable with chocobo
BEQ $18 ; If not equal, skip to next check
LDA #$01
JMP $AA21 ; Jump back to the rest of the normal routine
CMP #$01 ; Is in canoe (01)
BNE $0F ; If not equal, skip to next check
LDA $A1,x ; Load traversability value of the target tile
AND #$41 ; check that it is traversable with no vehicle
BEQ $09 ; If not equal, skip to next check
LDA #$00
STA $1704 ; Store canoe or clear vehicle
JMP $AA2D ; Jump back to the rest of the normal routine
nop ; Delete code until $00AA28
|
src/spread/main/index.asm
|
olifink/qspread
| 0 |
243536
|
<filename>src/spread/main/index.asm
* Spreadsheet 05/12-91
* - index control
*
include win1_keys_wman
include win1_keys_wwork
include win1_keys_wstatus
include win1_keys_qdos_io
include win1_keys_qdos_pt
include win1_keys_colour
include win1_mac_oli
include win1_spread_keys
xdef idx_ownx,idx_owny
xdef idx_work
xref.s mcx_grid,mcy_grid
section prog
*
* change working defintion for index items
r_work reg a3/d0/d1/d2
idx_work
movem.l r_work,-(sp)
move.l ww_pappl(a4),a3 ; ptr to appl. list
move.l (a3),a3 ; first appl. window
move.w da_ixspx(a6),d0 ; maximum index space
mulu #6,d0 ; in pixels
addq.w #2,d0 ; looks more nice
moveq #11,d1 ; y size
move.w d1,wwa_insp(a3) ; x index spacing
move.w d1,wwa_insz(a3) ; x index size
move.w d0,wwa_insp+wwa.clen(a3) ; y index spacing
move.w d0,wwa_insz+wwa.clen(a3) ; y index size
move.w wwa_watt+wwa_borw(a3),d2 ; add border width to distance
add.w d2,d1 ; single for y
lsl.w #1,d2 ; double for..
add.w d2,d0 ; ..you guess, yeah x
sub.w d0,wwa_xsiz(a3) ; make window smaller
sub.w d1,wwa_ysiz(a3)
add.w d0,wwa_xorg(a3) ; move origin right down
add.w d1,wwa_yorg(a3)
movem.l (sp)+,r_work
rts
*
* Draw myown index list for rows
r_idy reg d0/d4
idx_owny
movem.l r_idy,-(sp)
bsr idx_wind ; set window for index
move.w mcy_grid+wss_nsec(a6),d0 ; number of y sections
moveq #0,d4 ; section offset in status area
owny_lp
bsr.s idx_ydrw
addi.w #wss.ssln,d4 ; next section entry
subq.w #1,d0 ; for all sections
bne.s owny_lp
movem.l (sp)+,r_idy
rts
r_ydrw reg a1/a5/d0/d1/d2/d3
idx_ydrw
movem.l r_ydrw,-(sp)
move.l da_mridx(a6),a5 ; row index objects
move.w mcy_grid+wss_sstt+2(a6,d4.w),d1 ; start row number
mulu #wwm.olen,d1 ; index list entry length
adda.l d1,a5 ; address of first object
move.w mcy_grid+wss_ssiz+2(a6,d4.w),d2 ; number of rows displayed
move.l wwa_yspc(a3),d3 ; y spacing
neg.w d3 ; get actual value
moveq #1,d1 ; first pixel position
add.w mcy_grid+wss_spos+2(a6,d4.w),d1 ; section offset y
add.w wwa_yoff(a3),d1 ; add y offset
add.w wwa_insp(a3),d1 ; add index space of other list
bsr.s idx_yclr ; clear y(row) index
addq.w #1,d1 ; current item border
ydrw_prt
bsr pxpos ; position cursor
move.l wwm_pobj(a5),a1 ; object string
xjsr ut_prstr ; print it
add.w d3,d1 ; next y position
adda.l #wwm.olen,a5 ; next object
subq.w #1,d2 ; count down the rows
bne.s ydrw_prt
movem.l (sp)+,r_ydrw
rts
*
* clear row index
r_yclr reg d1/a1
idx_yclr
movem.l r_yclr,-(sp)
suba.l #8,sp ; we need space for 4 words
move.l sp,a1
move.w wwa_insp+wwa.clen(a3),(a1) ; index space becomes block width
moveq #0,d0 ; and now the rows
move.w wwa_ysiz(a3),d0 ; window height
sub.w wwa_yoff(a3),d0 ; less the offset
sub.w mcy_grid+wss_spos+2(a6),d0 ; less the section offset
subi.w #2*1+ww.scarr,d0 ; less the bottom scroll arrows
move.w d0,2(a1) ; becomes height
move.l d1,4(a1) ; x|y as defined
move.w wwa_iiat+wwa_back+wwa.clen(a3),d1 ; colour
moveq #iow.blok,d0 ; fill block
jsr wm.trap3(a2)
;;; move.l d3,-(sp)
;;; moveq #forever,d3
;;; trap #do.io
;;; move.l (sp)+,d3
adda.l #8,sp ; reframe stack
movem.l (sp)+,r_yclr
rts
*
* clear column index
idx_xclr
movem.l r_yclr,-(sp)
suba.l #8,sp ; we need space for 4 words
move.l sp,a1
moveq #0,d0 ; and now the columns
move.w wwa_xsiz(a3),d0 ; window width
sub.w wwa_xoff(a3),d0 ; less the offset
sub.w mcx_grid+wss_spos+2(a6),d0 ; less the section offset
subi.w #2*2+ww.pnarr,d0 ; less the right pan arrows
move.w d0,(a1) ; becomes block width
move.w wwa_insp(a3),2(a1) ; height is the index space
move.l d1,4(a1) ; x|y as defined
move.w wwa_iiat+wwa_back(a3),d1 ; colour
moveq #iow.blok,d0 ; fill block
jsr wm.trap3(a2)
;;; move.l d3,-(sp)
;;; moveq #forever,d3
;;; trap #do.io
;;; move.l (sp)+,d3
adda.l #8,sp ; reframe stack
movem.l (sp)+,r_yclr
rts
*
* Draw myown index list for columns
r_idx reg d0/d5
idx_ownx
movem.l r_idx,-(sp)
bsr idx_wind ; set window for index
move.w mcx_grid+wss_nsec(a6),d0 ; number for x sections
moveq #0,d5 ; section offset in status area
ownx_lp
bsr.s idx_xdrw ; draw index for current section
addi.w #wss.ssln,d5 ; next section entry
subq.w #1,d0 ; for all sections
bne.s ownx_lp
movem.l (sp)+,r_idx
rts
r_xdrw reg a1/a4/a5/d0-d5
idx_xdrw
movem.l r_xdrw,-(sp)
move.l da_mcidx(a6),a5 ; column index objects
move.w mcx_grid+wss_sstt+2(a6,d5.w),d1 ; start column number
move.w d1,d2
mulu #wwm.olen,d1 ; index list entry length
adda.l d1,a5 ; address of first object
move.l wwa_xspc(a3),a4 ; column spacing list
mulu #wwm.slen,d2 ; get offset for first entry
adda.l d2,a4 ; first spacing entry
moveq #0,d1 ; first pixel position
add.w mcx_grid+wss_spos+2(a6,d5.w),d1 ; section offset x
add.w wwa_xoff(a3),d1 ; add x offset
add.w wwa_insp+wwa.clen(a3),d1 ; add index space of other list
swap d1 ; x is in high word
bsr idx_xclr ; clear y(column) index
move.w #1,d1 ; y = 1 looks better
move.w mcx_grid+wss_ssiz+2(a6,d5.w),d4 ; number of columns displayed
xdrw_prt
move.l d1,d3 ; preserve old position
move.w wwm_spce(a4),d0 ; spacing of current column
move.l wwm_pobj(a5),a1 ; index string
move.w (a1),d2 ; length of string
mulu #6,d2 ; ..in pixels
sub.w d2,d0 ; get difference
bmi.s xdrw_nfit ; it wouldn't fit into it
lsr.w #1,d0 ; centre it
swap d0 ; put it in upper word (x)
clr.w d0 ; clear lower word
add.l d0,d1 ; new position
bsr.s pxpos ; position cursor
xjsr ut_prstr ; write index string
xdrw_nfit
move.l d3,d1 ; get old position
swap d1
add.w wwm_spce(a4),d1 ; next column starting x posn
swap d1
adda.l #wwm.olen,a5 ; next object
adda.l #wwm.slen,a4 ; next spacing entry
subq.w #1,d4 ; all columns displayed
bne.s xdrw_prt
movem.l (sp)+,r_xdrw
rts
*+++
* pixel position cursor
*
* Entry Exit
* A0 channel ID preserved
* D1.l x|y position preserved
*---
pxpos
movem.l d1-d3/a1,-(sp)
move.w d1,d2 ; y position
swap d1 ; x position
moveq #iow.spix,d0 ; set cursor to pixel position
moveq #forever,d3
trap #do.io
tst.l d0
movem.l (sp)+,d1-d3/a1
rts
*+++
* set window for index item drawing
*
* Entry Exit
* A0 channel ID preserved
*---
r_wind reg d1-d3
idx_wind
movem.l r_wind,-(sp)
move.w wwa_iiat+wwa_back+wwa.clen(a3),d1
moveq #iow.sstr,d0
;;; moveq #forever,d3
jsr wm.trap3(a2)
;;; trap #do.io
move.w wwa_iiat+wwa_ink+wwa.clen(a3),d1
moveq #iow.sink,d0
;;; moveq #forever,d3
jsr wm.trap3(a2)
;;; trap #do.io
moveq #0,d1
moveq #iow.sova,d0
;;; moveq #forever,d3
jsr wm.trap3(a2)
;;; trap #do.io
moveq #6,d1 ; info window #6
moveq #-1,d2 ; only area set
jsr wm.swinf(a2) ; set area to cover info window
movem.l (sp)+,r_wind
rts
end
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c41304b.ada
|
best08618/asylo
| 7 |
19681
|
-- C41304B.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT L.R RAISES CONSTRAINT_ERROR WHEN:
-- L DENOTES A RECORD OBJECT SUCH THAT, FOR THE EXISTING
-- DISCRIMINANT VALUES, THE COMPONENT DENOTED BY R DOES
-- NOT EXIST.
-- L IS A FUNCTION CALL DELIVERING A RECORD VALUE SUCH THAT,
-- FOR THE EXISTING DISCRIMINANT VALUES, THE COMPONENT
-- DENOTED BY R DOES NOT EXIST.
-- L IS AN ACCESS OBJECT AND THE OBJECT DESIGNATED BY THE ACCESS
-- VALUE IS SUCH THAT COMPONENT R DOES NOT EXIST FOR THE
-- OBJECT'S CURRENT DISCRIMINANT VALUES.
-- L IS A FUNCTION CALL RETURNING AN ACCESS VALUE AND THE OBJECT
-- DESIGNATED BY THE ACCESS VALUE IS SUCH THAT COMPONENT R
-- DOES NOT EXIST FOR THE OBJECT'S CURRENT DISCRIMINANT
-- VALUES.
-- HISTORY:
-- TBN 05/23/86 CREATED ORIGINAL TEST.
-- JET 01/08/88 MODIFIED HEADER FORMAT AND ADDED CODE TO
-- PREVENT OPTIMIZATION.
WITH REPORT; USE REPORT;
PROCEDURE C41304B IS
TYPE V (DISC : INTEGER := 0) IS
RECORD
CASE DISC IS
WHEN 1 =>
X : INTEGER;
WHEN OTHERS =>
Y : INTEGER;
END CASE;
END RECORD;
TYPE T IS ACCESS V;
BEGIN
TEST ("C41304B", "CHECK THAT L.R RAISES CONSTRAINT_ERROR WHEN " &
"THE COMPONENT DENOTED BY R DOES NOT EXIST");
DECLARE
VR : V := (DISC => 0, Y => 4);
J : INTEGER;
BEGIN
IF EQUAL (4, 4) THEN
VR := (DISC => 1, X => 3);
END IF;
J := VR.Y;
FAILED ("CONSTRAINT_ERROR NOT RAISED FOR A RECORD OBJECT");
-- IF STATEMENT PREVENTS OPTIMIZING OF VARIABLE J.
IF EQUAL (J,3) THEN
FAILED ("CONSTRAINT_ERROR NOT RAISED - 1");
END IF;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED FOR A RECORD OBJECT");
END;
--------------------------------------------------
DECLARE
J : INTEGER;
FUNCTION F RETURN V IS
BEGIN
IF EQUAL (4, 4) THEN
RETURN (DISC => 2, Y => 3);
END IF;
RETURN (DISC => 1, X => 4);
END F;
BEGIN
J := F.X;
FAILED ("CONSTRAINT_ERROR NOT RAISED FOR A FUNCTION CALL " &
"DELIVERING A RECORD VALUE");
-- IF STATEMENT PREVENTS OPTIMIZING OF VARIABLE J.
IF EQUAL (J,3) THEN
FAILED ("CONSTRAINT_ERROR NOT RAISED - 2");
END IF;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED FOR A FUNCTION CALL " &
"DELIVERING A RECORD VALUE");
END;
--------------------------------------------------
DECLARE
A : T := NEW V' (DISC => 0, Y => 4);
J : INTEGER;
BEGIN
IF EQUAL (4, 4) THEN
A := NEW V' (DISC => 1, X => 3);
END IF;
J := A.Y;
FAILED ("CONSTRAINT_ERROR NOT RAISED FOR AN ACCESS OBJECT");
-- IF STATEMENT PREVENTS OPTIMIZING OF VARIABLE J.
IF EQUAL (J,3) THEN
FAILED ("CONSTRAINT_ERROR NOT RAISED - 3");
END IF;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED FOR AN ACCESS OBJECT");
END;
--------------------------------------------------
DECLARE
J : INTEGER;
FUNCTION F RETURN T IS
BEGIN
IF EQUAL (4, 4) THEN
RETURN NEW V' (DISC => 2, Y => 3);
END IF;
RETURN NEW V' (DISC => 1, X => 4);
END F;
BEGIN
J := F.X;
FAILED ("CONSTRAINT_ERROR NOT RAISED FOR A FUNCTION CALL " &
"DELIVERING AN ACCESS VALUE");
-- IF STATEMENT PREVENTS OPTIMIZING OF VARIABLE J.
IF EQUAL (J,3) THEN
FAILED ("CONSTRAINT_ERROR NOT RAISED - 4");
END IF;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED FOR A FUNCTION CALL " &
"DELIVERING AN ACCESS VALUE");
END;
RESULT;
END C41304B;
|
libsrc/_DEVELOPMENT/z180/z180/asm_z180_delay_ms.asm
|
jpoikela/z88dk
| 640 |
103343
|
; ===============================================================
; Mar 2014
; ===============================================================
;
; void z180_delay_ms(uint ms)
;
; Busy wait exactly the number of milliseconds, which includes the
; time needed for an unconditional call and the ret.
;
; ===============================================================
INCLUDE "config_private.inc"
SECTION code_clib
SECTION code_z180
PUBLIC asm_z180_delay_ms
PUBLIC asm_cpu_delay_ms
EXTERN asm_z180_delay_tstate
asm_z180_delay_ms:
asm_cpu_delay_ms:
; enter : hl = milliseconds (0 = 65536)
;
; uses : af, bc, de, hl
ld e,l
ld d,h
ms_loop:
dec de
ld a,d
or e
jr z, last_ms
ld hl,+(__CPU_CLOCK / 1000) - 43
call asm_z180_delay_tstate
jr ms_loop
last_ms:
; we will be exact
ld hl,+(__CPU_CLOCK / 1000) - 54
jp asm_z180_delay_tstate
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.