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
|
---|---|---|---|---|
x86/Tetrahedron/tetra.asm | WorkingFen/ExamplesARKO | 1 | 97651 | ;############## Comments ##########################################################
;; Registers for integers and pointers while passing arguments
;%rdi - canvas->line [first element of bitmap, upper-left corner]
;%rsi - canvas->w [width]
;%rdx - canvas->h [height]
;%rcx - zBuffer->line [first element of buffer with depth]
;%r8 - first [pointer to first vertex]
;%r9 - second [pointer to second vertex]
;; Registers for doubles
;%xmm0 -
;%xmm1 -
;%xmm2 -
;%xmm3 -
;%xmm4 -
;%xmm5 -
;%xmm6 -
;%xmm7 -
;; Other arguments are stored in [rbp + 16], [rbp + 24], [rbp + 32] and so on...
;; How to get int from structure
;mov rY1d, [rX] ; x
;mov rY2d, [rX + 4] ; y
;mov rY3d, [rX + 8] ; z
;First choose row, then column
;; How macros should look
; %macro write_string 2
; mov eax, 4
; mov ebx, 1
; mov ecx, %1
; mov edx, %2
; int 80h
; %endmacro
;##################################################################################
;############## Macros ############################################################
%macro start_reg 0
mov r10, [rbp + 16] ; Third vertex
mov r11, [rbp + 24] ; Fourth vertex
mov [rsp - 8], rdi ; canvas->line
mov [rsp - 16], rcx ; zBuffer->line
mov [rsp - 24], rsi ; canvas->w [width]
mov [rsp - 32], rdx ; canvas->h [height]
mov [rsp - 40], r8 ; Pointer to first vertex
mov [rsp - 48], r9 ; Pointer to second vertex
mov [rsp - 56], r10 ; Pointer to third vertex
mov [rsp - 64], r11 ; Pointer to fourth vertex
mov ax, 0x1
mov [rsp - 114], ax ; Actual number of triangles
%endmacro
;%macro prepare_pixel 4
;%endmacro
%macro create_z_coor 4
mov ecx, %2 ; Get y from vertex
mov %4, [rsp - 16] ; Get pointer to zBuffer->line
mov rdi, [rsp - 32] ; Get height
add rcx, 0x1 ; Add one to y
sub rdi, rcx ; H-(y+1)
shl rdi, 0x3 ; Every line is represented as 64 bits address
add %4, rdi ; Move to proper line
mov eax, %1 ; Get x from vertex
mov rcx, [%4] ; Get line
mov rdi, 0x2 ; Get 16 bytes
mul rdi ; for each pixel
add rcx, rax ; Go to proper pixel
mov eax, %3 ; Get z from vertex
cmp [rcx], eax ; Compare if actual z coordinate is lesser
jb $+69 ; Jump if there is lesser z value to label ;not:
mov [rcx], eax ; Z pixel
%endmacro
%macro draw_pixel 4
create_z_coor %1, %2, %3, %4
mov ecx, %2 ; Get y from vertex
mov %4, [rsp - 8] ; Get pointer to canvas->line
mov rdi, [rsp - 32] ; Get height
add rcx, 0x1 ; Add one to y
sub rdi, rcx ; H-(y+1)
shl rdi, 0x3 ; Every line is represented as 64 bits address
add %4, rdi ; Move to proper line
mov eax, %1 ; Get x from vertex
mov rcx, [%4] ; Get line
mov rdi, 0x3 ; Get 24 bytes
mul rdi ; for each pixel
add rcx, rax ; Go to proper pixel
mov al, 0x0
;mov al, [rsp - 84] ;
mov [rcx], al ; R = 0x00
;mov al, [rsp - 85] ;
mov [rcx + 1], al ; G = 0x00
;mov al, [rsp - 86] ;
mov [rcx + 2], al ; B = 0x00
%endmacro
%macro prepare_factor 7
mov r11d, %1 ; [A1]
sub r11d, %3 ; (A1-A2)
mov r10d, %2 ; [B1]
sub r10d, %4 ; (B1-B2)
mov r9d, %3 ; [A2]
sub r9d, %5 ; (A2-A3)
mov r12d, %4 ; [B2]
sub r12d, %6 ; (B2-B3)
mov eax, r11d
mul r12d
mov r11d, eax ; (A1-A2)(B2-B3)
mov eax, r10d
mul r9d
mov r10d, eax ; (B1-B2)(A2-A3)
sub r11d, r10d ; (A1-A2)(B2-B3)-(B1-B2)(A2-A3) => factor
mov [rsp - %7], r11d ; Save to proper address
%endmacro
%macro find_maxmin 6
mov r12d, %1
mov r11d, %2
mov r10d, %3
cmp r12d, r11d ; If A1 > A2
ja $+26 ; Go to label ;cOgTw:
cmp r10d, r11d ; If A3 > A2
ja $+73 ; Go to label ;cThgTw:
cmp r10d, r12d ; If A3 > A1
ja $+82 ; Go to label ;cThgO:
mov [rsp - %4], r11w ; Max
mov [rsp - %5], r10w ; Min
jmp %6
;cOgTw:
cmp r11d, r10d ; If A2 > A3
ja $+21 ; Go to label ;cTwgTh:
cmp r12d, r10d ; If A1 > A3
ja $+30 ; Go to label ;cOgTh:
mov [rsp - %4], r10w ; Max
mov [rsp - %5], r11w ; Min
jmp %6
;cTwgTh:
mov [rsp - %4], r12w ; Max
mov [rsp - %5], r10w ; Min
jmp %6
;cOgTh:
mov [rsp - %4], r12w ; Max
mov [rsp - %5], r11w ; Min
jmp %6
;cThgTw:
mov [rsp - %4], r10w ; Max
mov [rsp - %5], r12w ; Min
jmp %6
;cThgO:
mov [rsp - %4], r11w ; Max
mov [rsp - %5], r12w ; Min
%endmacro
%macro prepare_denominator 7
mov eax, %1
mov r8d, %4
mul r8d
mov r12d, eax ; A1*B2
mov eax, %2
mov r8d, %3
mul r8d
mov r11d, eax ; A2*B1
mov r10d, %2
sub r10d, %4 ; [A2-B2]
mov r9d, %3
sub r9d, %1 ; [B1-A1]
mov eax, %5
mul r10d
mov r10d, eax ; C1[A2-B2]
mov eax, %6
mul r9d
mov r9d, eax ; C2[B1-A1]
add r10d, r9d ; C1[A2-B2] + C2[B1-A1]
add r10d, r12d ; C1[A2-B2] + C2[B1-A1] + A1*B2
sub r10d, r11d ; C1[A2-B2] + C2[B1-A1] + A1*B2 - A2*B1
mov [rsp - %7], r10d
%endmacro
%macro prepare_vertices 7
mov r12d, %1 ; Get first X
mov r11d, %2 ; Get first Y
mov r10d, %3 ; Get first Z
mov r9d, %4 ; Get second X
mov r8d, %5 ; Get second Y
mov ebx, %6 ; Get second Z
mov ax, %7
mov [rsp - 112], ax ; Number of line
cmp r12d, r9d ; If X1 > X2
ja swap ; Swap coordinates
%endmacro
%macro swap_coor 2
mov eax, %1
mov %1, %2
mov %2, eax
%endmacro
%macro exloop 5
mov eax, %1
mov %5, %2
cmp eax, %5
jle %3
mov eax, [rsp - 112]
mov %5, 0x3
cmp eax, %5
je %4
jmp nextl
%endmacro
;##################################################################################
;############## Code ##############################################################
section .text
global tetra
tetra:
;---------------------Prepare registers ----------------------
push rbp
mov rbp, rsp
start_reg
mov r15, [rsp - 40] ; First vertex
mov r14, [rsp - 48] ; Third vertex
mov r13, [rsp - 56] ; Fourth vertex
mov r12, [rsp - 64] ; Fourth vertex
draw_pixel [r15], [r15 + 4], [r15 + 8], r8
draw_pixel [r14], [r14 + 4], [r14 + 8], r8
draw_pixel [r13], [r13 + 4], [r13 + 8], r8
draw_pixel [r12], [r12 + 4], [r12 + 8], r8
;---------------------Prepare planes -------------------------
;; Plane equation := [a(x-x0) + b(y-y0) + c(z-z0) = 0]
ntr:
mov r15w, [rsp - 114]
cmp r15w, 0x2
jb trfi
cmp r15w, 0x3
jb trs
cmp r15w, 0x4
jb trt
trfo:
mov r15, [rsp - 40] ; First vertex
mov r14, [rsp - 56] ; Third vertex
mov r13, [rsp - 64] ; Fourth vertex
mov r12d, 0xFF0000 ; Color of triangle
mov [rsp - 84], r12d
jmp pplane
trt:
mov r15, [rsp - 48] ; Second vertex
mov r14, [rsp - 56] ; Third vertex
mov r13, [rsp - 64] ; Fourth vertex
mov r12d, 0xFF00 ; Color of triangle
mov [rsp - 84], r12d
jmp pplane
trs:
mov r15, [rsp - 40] ; First vertex
mov r14, [rsp - 48] ; Second vertex
mov r13, [rsp - 64] ; Fourth vertex
mov r12d, 0xFF ; Color of triangle
mov [rsp - 84], r12d
jmp pplane
trfi:
mov r15, [rsp - 40] ; First vertex
mov r14, [rsp - 48] ; Second vertex
mov r13, [rsp - 56] ; Third vertex
mov r12d, 0xC8FF ; Color of triangle
mov [rsp - 84], r12d
pplane:
prepare_factor [r15 + 4], [r15 + 8], [r14 + 4], [r14 + 8], [r13 + 4], [r13 + 8], 0x48 ; Factor A
prepare_factor [r15 + 8], [r15], [r14 + 8], [r14], [r13 + 8], [r13], 0x4C ; Factor B
prepare_factor [r15], [r15 + 4], [r14], [r14 + 4], [r13], [r13 + 4], 0x50 ; Factor C
;---------------------Find MAX and MIN Coordinates -----------
mimaX:
find_maxmin [r15], [r14], [r13], 0x58, 0x5A, mimaY ; Find max and min of X
mimaY:
find_maxmin [r15 + 4], [r14 + 4], [r13 + 4], 0x5C, 0x5E, denomi ; Find max and min of Y
;---------------------Prepare denominator --------------------
denomi:
prepare_denominator [r15], [r15 + 4], [r14], [r14 + 4], [r13], [r13 + 4], 0x6C ; Denominator for filling triangles
;---------------------Prepare vertices -----------------------
;; Frist and Second vertices
first:
prepare_vertices [r15], [r15 + 4], [r15 + 8], [r14], [r14 + 4], [r14 + 8], 0x1
jmp lines
;; Second and Third vertices
second:
prepare_vertices [r14], [r14 + 4], [r14 + 8], [r13], [r13 + 4], [r13 + 8], 0x2
jmp lines
;; Third and First vertices
third:
prepare_vertices [r13], [r13 + 4], [r13 + 8], [r15], [r15 + 4], [r15 + 8], 0x3
;---------------------Types of lines -------------------------
lines:
mov ecx, r9d
sub ecx, r12d ; ecx := deltaX
mov eax, 0x2
mul ecx
mov edi, eax ; edi := 2*deltaX
cmp r11d, r8d ; If Y1 > Y2
ja decl
;; Ascending [less than 45 and more than 0 degrees] and horizontal lines
ascen:
mov ecx, r8d
sub ecx, r11d
mov eax, 0x2
mul ecx
mov [rsp - 96], eax ; [rsp - 96]: a := 2*deltaY
sub eax, edi
mov [rsp - 100], eax ; [rsp - 100]: b := 2*deltaY - 2*deltaX
mov ecx, 0x0
cmp eax, ecx
jg ascen45
mov ecx, r9d
sub ecx, r12d ; ecx := deltaX
mov eax, [rsp - 96]
sub eax, ecx
mov [rsp - 104], eax ; [rsp - 104]: Pk := 2*deltaY - deltaX
loopas:
draw_pixel r12d, r11d, r10d, r8
nextas:
mov eax, 0x0
mov ecx, [rsp - 104]
cmp ecx, eax ; If Pk > 0
jg upas ; Go to up ascending
mov eax, [rsp - 96]
add ecx, eax
mov [rsp - 104], ecx ; Pk := Pk-1 + a
add r12d, 0x1 ; Xk := Xk-1 + 1
;; Changing z
mov ecx, [rsp - 72] ; Plane a
mov r8d, [rsp - 80] ; Plane c
mov eax, r8d
mul r10d ; Pc*Zk-1
sub eax, ecx ; Pc*Zk := Pc*Zk-1 - Pa
div r8d
mov r10d, eax ; Zk := Zk-1 - Pa/Pc
;; ############################
exloop r12d, r9d, loopas, fill, r8d
upas:
mov ecx, [rsp - 104]
mov eax, [rsp - 100]
add ecx, eax
mov [rsp - 104], ecx ; Pk := Pk-1 + b
add r12d, 0x1 ; Xk := Xk-1 + 1
add r11d, 0x1 ; Yk := Yk-1 + 1
;; Changing z
mov ecx, [rsp - 72] ; Plane a
mov r8d, [rsp - 76] ; Plane b
add ecx, r8d ; Pa+Pb
mov r8d, [rsp - 80] ; Plane c
mov eax, r8d
mul r10d ; Pc*Zk-1
sub eax, ecx ; Pc*Zk := Pc*Zk-1 - [Pa+Pb]
div r8d
mov r10d, eax ; Zk := Zk-1 - [Pa+Pb]/Pc
;; ############################
exloop r12d, r9d, loopas, fill, r8d
;; Ascending [less than 90 and more than 45 degrees]
ascen45:
mov ecx, r8d
sub ecx, r11d ; ecx := deltaY
mov eax, 0x2
mul ecx
mov edi, eax ; edi := 2*deltaY
mov ecx, r9d
sub ecx, r12d ; ecx := deltaX
mov eax, 0x2
mul ecx
mov [rsp - 96], eax ; [rsp - 96]: a := 2*deltaX
sub eax, edi
mov [rsp - 100], eax ; [rsp - 100]: b := 2*deltaX - 2*deltaY
mov ecx, r8d
sub ecx, r11d ; ecx := deltaY
mov eax, [rsp - 96]
sub eax, ecx
mov [rsp - 104], eax ; [rsp - 104]: Pk := 2*deltaX - deltaY
loopas45:
draw_pixel r12d, r11d, r10d, r9
onas45:
mov eax, 0x0
mov ecx, [rsp - 104]
cmp ecx, eax ; If Pk > 0
jg upas45 ; Go to up ascending
mov eax, [rsp - 96]
add ecx, eax
mov [rsp - 104], ecx ; Pk := Pk-1 + a
add r11d, 0x1 ; Yk := Yk-1 + 1
;; Changing z
mov ecx, [rsp - 76] ; Plane b
mov r9d, [rsp - 80] ; Plane c
mov eax, r9d
mul r10d ; Pc*Zk-1
sub eax, ecx ; Pc*Zk := Pc*Zk-1 - Pb
div r9d
mov r10d, eax ; Zk := Zk-1 - Pb/Pc
;; ############################
exloop r11d, r8d, loopas45, fill, r9d
upas45:
mov ecx, [rsp - 104]
mov eax, [rsp - 100]
add ecx, eax
mov [rsp - 104], ecx ; Pk := Pk-1 + b
add r12d, 0x1 ; Xk := Xk-1 + 1
add r11d, 0x1 ; Yk := Yk-1 + 1
;; Changing z
mov ecx, [rsp - 72] ; Plane a
mov r9d, [rsp - 76] ; Plane b
add ecx, r9d ; Pa+Pb
mov r9d, [rsp - 80] ; Plane c
mov eax, r9d
mul r10d ; Pc*Zk-1
sub eax, ecx ; Pc*Zk := Pc*Zk-1 - [Pa+Pb]
div r9d
mov r10d, eax ; Zk := Zk-1 - [Pa+Pb]/Pc
;; ############################
exloop r11d, r8d, loopas45, fill, r9d
;; Declining lines [less than 0 and more than -45 degrees]
decl:
mov ecx, r11d
sub ecx, r8d
mov eax, 0x2
mul ecx
mov [rsp - 96], eax ; [rsp - 96]: a := 2*deltaY
sub eax, edi
mov [rsp - 100], eax ; [rsp - 100]: b := 2*deltaY - 2*deltaX
mov ecx, 0x0
cmp eax, ecx
jg decl45
mov ecx, r9d
sub ecx, r12d ; ecx := deltaX
mov eax, [rsp - 96]
sub eax, ecx
mov [rsp - 104], eax ; [rsp - 104]: Pk := 2*deltaY - deltaX
loopde:
draw_pixel r12d, r11d, r10d, r8
nextde:
mov eax, 0x0
mov ecx, [rsp - 104]
cmp ecx, eax ; If Pk > 0
jg downde ; Go to down descending
mov eax, [rsp - 96]
add ecx, eax
mov [rsp - 104], ecx ; Pk := Pk-1 + a
add r12d, 0x1 ; Xk := Xk-1 + 1
;; Changing z
mov ecx, [rsp - 72] ; Plane a
mov r8d, [rsp - 80] ; Plane c
mov eax, r8d
mul r10d ; Pc*Zk-1
sub eax, ecx ; Pc*Zk := Pc*Zk-1 - Pa
div r8d
mov r10d, eax ; Zk := Zk-1 - Pa/Pc
;; ############################
exloop r12d, r9d, loopde, fill, r8d
downde:
mov ecx, [rsp - 104]
mov eax, [rsp - 100]
add ecx, eax
mov [rsp - 104], ecx ; Pk := Pk-1 + b
add r12d, 0x1 ; Xk := Xk-1 + 1
sub r11d, 0x1 ; Yk := Yk-1 - 1
;; Changing z
mov ecx, [rsp - 72] ; Plane a
mov r8d, [rsp - 76] ; Plane b
sub ecx, r8d ; Pa-Pb
mov r8d, [rsp - 80] ; Plane c
mov eax, r8d
mul r10d ; Pc*Zk-1
sub eax, ecx ; Pc*Zk := Pc*Zk-1 - [Pa-Pb]
div r8d
mov r10d, eax ; Zk := Zk-1 - [Pa-Pb]/Pc
;; ############################
exloop r12d, r9d, loopde, fill, r8d
;; Declining lines [less than -45 and more than -90 degrees]
decl45:
mov ecx, r11d
sub ecx, r8d ; ecx := deltaY
mov eax, 0x2
mul ecx
mov edi, eax ; edi := 2*deltaY
mov ecx, r9d
sub ecx, r12d ; ecx := deltaX
mov eax, 0x2
mul ecx
mov [rsp - 96], eax ; [rsp - 96]: a := 2*deltaX
sub eax, edi
mov [rsp - 100], eax ; [rsp - 100]: b := 2*deltaX - 2*deltaY
mov ecx, r8d
sub ecx, r11d ; ecx := deltaY
mov eax, [rsp - 96]
sub eax, ecx
mov [rsp - 104], eax ; [rsp - 104]: Pk := 2*deltaX - deltaY
loopde45:
draw_pixel r12d, r11d, r10d, r9
underde45:
mov eax, 0x0
mov ecx, [rsp - 104]
cmp ecx, eax ; If Pk > 0
jg downde45 ; Go to up ascending
mov eax, [rsp - 96]
add ecx, eax
mov [rsp - 104], ecx ; Pk := Pk-1 + a
sub r11d, 0x1 ; Yk := Yk-1 - 1
;; Changing z
mov ecx, [rsp - 76] ; Plane b
mov r9d, [rsp - 80] ; Plane c
mov eax, r9d
mul r10d ; Pc*Zk-1
add eax, ecx ; Pc*Zk := Pc*Zk-1 + Pb
div r9d
mov r10d, eax ; Zk := Zk-1 + Pb/Pc
;; ############################
exloop r8d, r11d, loopde45, fill, r9d
downde45:
mov ecx, [rsp - 104]
mov eax, [rsp - 100]
add ecx, eax
mov [rsp - 104], ecx ; Pk := Pk-1 + b
add r12d, 0x1 ; Xk := Xk-1 + 1
sub r11d, 0x1 ; Yk := Yk-1 + 1
;; Changing z
mov ecx, [rsp - 72] ; Plane a
mov r9d, [rsp - 76] ; Plane b
sub ecx, r9d ; Pa-Pb
mov r9d, [rsp - 80] ; Plane c
mov eax, r9d
mul r10d ; Pc*Zk-1
sub eax, ecx ; Pc*Zk := Pc*Zk-1 - [Pa-Pb]
div r9d
mov r10d, eax ; Zk := Zk-1 - [Pa-Pb]/Pc
;; ############################
exloop r8d, r11d, loopde45, fill, r9d
;---------------------Filling triangle -----------------------
fill:
;lfillr:
;lfillc:
;wrong:
;baric:
;chckbr:
;nexY:
jmp end
;---------------------Vertices modifying ---------------------
swap:
swap_coor r12d, r9d ; Swap X coordinates
swap_coor r11d, r8d ; Swap Y coordinates
swap_coor r10d, ebx ; Swap Z coordinates
jmp lines
;; Which line should be drawn next?
nextl:
mov ax, [rsp - 112]
mov dx, 0x1
cmp ax, dx
je second
mov dx, 0x2
cmp ax, dx
je third
;---------------------Next triangle --------------------------
nxtrn:
mov ax, [rsp - 114]
add ax, 0x1
mov [rsp - 114], ax
cmp ax, 0x4
jb ntr
;---------------------End of function ------------------------
end:
mov rsp, rbp
pop rbp
ret
;################################################################################## |
2-division_multiplicacion.asm | mario21ic/nasm-demos | 0 | 83756 | <filename>2-division_multiplicacion.asm
;section .data
;resultado db '0'
section .bss
div_rpta resb 1
div_residuo resb 1
mul_rpta resb 1
section .text
global _start
_start:
; Dividir
mov bx, 2
mov dx, 0
mov ax, 7
div bx ; realiza la division (dx:ax / bx)
; convertir a ascii
add ax, 48
mov [div_rpta], ax
add dx, 48 ; ascii
mov [div_residuo], dx
; Imprimir rpta
mov eax, 4
mov ebx, 1
mov ecx, div_rpta
mov edx, 1 ; numero de bytes a imprimir
int 0x80
; Imprimir residuo
mov eax, 4
mov ebx, 1
mov ecx, div_residuo
mov edx, 1 ; numero de bytes a imprimir
int 0x80
; Multiplicar
mov ax, 3
mov cx, 2
mul cx ; realiza la multiplicacion (ax * cx)
add ax, 48 ; ascii
mov [mul_rpta], ax
; Imprimir rpta
mov eax, 4
mov ebx, 1
mov ecx, mul_rpta
mov edx, 1 ; numero de bytes a imprimir
int 0x80
mov eax, 1
mov ebx, 0
int 0x80
|
src/fot/FOTC/Data/Conat/Equality/PropertiesATP.agda | asr/fotc | 11 | 5719 | ------------------------------------------------------------------------------
-- Properties for the equality on Conat
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Data.Conat.Equality.PropertiesATP where
open import FOTC.Base
open import FOTC.Data.Conat
open import FOTC.Data.Conat.Equality.Type
------------------------------------------------------------------------------
-- Because a greatest post-fixed point is a fixed-point, then the
-- relation _≈N_ is also a pre-fixed point of the functional ≈-F, i.e.
--
-- ≈-F _≈_ ≤ _≈_ (see FOTC.Data.Conat.Equality.Type).
-- See Issue https://github.com/asr/apia/issues/81 .
≈-inR : D → D → Set
≈-inR m n = m ≡ zero ∧ n ≡ zero
∨ (∃[ m' ] ∃[ n' ] m ≡ succ₁ m' ∧ n ≡ succ₁ n' ∧ m' ≈ n')
{-# ATP definition ≈-inR #-}
≈-in :
∀ {m n} →
m ≡ zero ∧ n ≡ zero
∨ (∃[ m' ] ∃[ n' ] m ≡ succ₁ m' ∧ n ≡ succ₁ n' ∧ m' ≈ n') →
m ≈ n
≈-in h = ≈-coind ≈-inR h' h
where
postulate
h' : ∀ {m n} → ≈-inR m n →
m ≡ zero ∧ n ≡ zero
∨ (∃[ m' ] ∃[ n' ] m ≡ succ₁ m' ∧ n ≡ succ₁ n' ∧ ≈-inR m' n')
{-# ATP prove h' #-}
-- See Issue https://github.com/asr/apia/issues/81 .
≈-reflR : D → D → Set
≈-reflR a b = Conat a ∧ Conat b ∧ a ≡ b
{-# ATP definition ≈-reflR #-}
≈-refl : ∀ {n} → Conat n → n ≈ n
≈-refl {n} Cn = ≈-coind ≈-reflR h₁ h₂
where
postulate
h₁ : ∀ {a b} → ≈-reflR a b →
a ≡ zero ∧ b ≡ zero
∨ (∃[ a' ] ∃[ b' ] a ≡ succ₁ a' ∧ b ≡ succ₁ b' ∧ ≈-reflR a' b')
{-# ATP prove h₁ #-}
postulate h₂ : ≈-reflR n n
{-# ATP prove h₂ #-}
postulate ≡→≈ : ∀ {m n} → Conat m → Conat n → m ≡ n → m ≈ n
{-# ATP prove ≡→≈ ≈-refl #-}
|
test/fail/Issue183.agda | asr/agda-kanso | 0 | 7632 | <reponame>asr/agda-kanso
-- Here is a smaller test case. The error message is produced using
-- the latest (at the time of writing) development version of Agda.
module Issue183 where
postulate A : Set
T : Set
T = A → A
data L (A : Set) : Set where
data E (x : T) : T → Set where
e : E x x
foo : (f : A → A) → L (E f (λ x → f x))
foo = λ _ → e
-- Previously:
-- An internal error has occurred. Please report this as a bug.
-- Location of the error: src/full/Agda/Syntax/Translation/AbstractToConcrete.hs:705
-- Should now give a proper error message. |
programs/oeis/131/A131808.asm | neoneye/loda | 22 | 94632 | ; A131808: Partial sums of A131378.
; 0,0,1,1,1,2,3,3,3,3,3,4,5,5,5,5,5,6,7,7,7,7,7,8,9,10,11,12,13,13,13,14,15,16,17,18,19,19,19,19,19,20,21,21,21,21,21,22,23,24,25,26,27,27,27,27,27,27,27,28,29,29,29,29,29,29,29,30,31,32,33,33,33,34,35,36,37,38
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
sub $0,1
seq $0,71986 ; Parity of the prime-counting function pi(n).
add $1,$0
lpe
mov $0,$1
|
source/amf/uml/amf-uml-structured_activity_nodes.ads | svn2github/matreshka | 24 | 9931 | <filename>source/amf/uml/amf-uml-structured_activity_nodes.ads<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <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$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- Because of the concurrent nature of the execution of actions within and
-- across activities, it can be difficult to guarantee the consistent access
-- and modification of object memory. In order to avoid race conditions or
-- other concurrency-related problems, it is sometimes necessary to isolate
-- the effects of a group of actions from the effects of actions outside the
-- group. This may be indicated by setting the mustIsolate attribute to true
-- on a structured activity node. If a structured activity node is
-- 'isolated,' then any object used by an action within the node cannot be
-- accessed by any action outside the node until the structured activity node
-- as a whole completes. Any concurrent actions that would result in
-- accessing such objects are required to have their execution deferred until
-- the completion of the node.
--
-- A structured activity node is an executable activity node that may have an
-- expansion into subordinate nodes as an activity group. The subordinate
-- nodes must belong to only one structured activity node, although they may
-- be nested.
------------------------------------------------------------------------------
with AMF.UML.Actions;
limited with AMF.UML.Activities;
limited with AMF.UML.Activity_Edges.Collections;
with AMF.UML.Activity_Groups;
limited with AMF.UML.Activity_Nodes.Collections;
limited with AMF.UML.Input_Pins.Collections;
with AMF.UML.Namespaces;
limited with AMF.UML.Output_Pins.Collections;
limited with AMF.UML.Variables.Collections;
package AMF.UML.Structured_Activity_Nodes is
pragma Preelaborate;
type UML_Structured_Activity_Node is limited interface
and AMF.UML.Namespaces.UML_Namespace
and AMF.UML.Activity_Groups.UML_Activity_Group
and AMF.UML.Actions.UML_Action;
type UML_Structured_Activity_Node_Access is
access all UML_Structured_Activity_Node'Class;
for UML_Structured_Activity_Node_Access'Storage_Size use 0;
overriding function Get_Activity
(Self : not null access constant UML_Structured_Activity_Node)
return AMF.UML.Activities.UML_Activity_Access is abstract;
-- Getter of StructuredActivityNode::activity.
--
-- Activity immediately containing the node.
overriding procedure Set_Activity
(Self : not null access UML_Structured_Activity_Node;
To : AMF.UML.Activities.UML_Activity_Access) is abstract;
-- Setter of StructuredActivityNode::activity.
--
-- Activity immediately containing the node.
not overriding function Get_Edge
(Self : not null access constant UML_Structured_Activity_Node)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is abstract;
-- Getter of StructuredActivityNode::edge.
--
-- Edges immediately contained in the structured node.
not overriding function Get_Must_Isolate
(Self : not null access constant UML_Structured_Activity_Node)
return Boolean is abstract;
-- Getter of StructuredActivityNode::mustIsolate.
--
-- If true, then the actions in the node execute in isolation from actions
-- outside the node.
not overriding procedure Set_Must_Isolate
(Self : not null access UML_Structured_Activity_Node;
To : Boolean) is abstract;
-- Setter of StructuredActivityNode::mustIsolate.
--
-- If true, then the actions in the node execute in isolation from actions
-- outside the node.
not overriding function Get_Node
(Self : not null access constant UML_Structured_Activity_Node)
return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is abstract;
-- Getter of StructuredActivityNode::node.
--
-- Nodes immediately contained in the group.
not overriding function Get_Structured_Node_Input
(Self : not null access constant UML_Structured_Activity_Node)
return AMF.UML.Input_Pins.Collections.Set_Of_UML_Input_Pin is abstract;
-- Getter of StructuredActivityNode::structuredNodeInput.
--
not overriding function Get_Structured_Node_Output
(Self : not null access constant UML_Structured_Activity_Node)
return AMF.UML.Output_Pins.Collections.Set_Of_UML_Output_Pin is abstract;
-- Getter of StructuredActivityNode::structuredNodeOutput.
--
not overriding function Get_Variable
(Self : not null access constant UML_Structured_Activity_Node)
return AMF.UML.Variables.Collections.Set_Of_UML_Variable is abstract;
-- Getter of StructuredActivityNode::variable.
--
-- A variable defined in the scope of the structured activity node. It has
-- no value and may not be accessed
end AMF.UML.Structured_Activity_Nodes;
|
parsing.ads | Lucretia/pc_tut | 1 | 12464 | <gh_stars>1-10
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Containers.Indefinite_Doubly_Linked_Lists;
with Ada.Containers.Indefinite_Holders;
package Parsing is
package Char_List is new Ada.Containers.Indefinite_Doubly_Linked_Lists (Element_Type => Character);
package List_Of_Char_Lists is new Ada.Containers.Doubly_Linked_Lists (Element_Type => Char_List.List, "=" => Char_List."=");
type Result is interface;
type Failure is new Result with record
Message : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Success is new Result with record
Matched : List_Of_Char_Lists.List;
Remaining : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Root_Parser is interface;
function Parse (Parser : in Root_Parser; Input : in String) return Result'Class is abstract;
package PH is new Ada.Containers.Indefinite_Holders (Element_Type => Root_Parser'Class);
type Holder is new PH.Holder with null record;
type Parse_Character (Match : Character) is new Root_Parser with null record;
function Parse (Parser : in Parse_Character; Input : in String) return Result'Class;
type Parse_Character_Range (Match_From, Match_To : Character) is new Root_Parser with null record;
function Parse (Parser : in Parse_Character_Range; Input : in String) return Result'Class;
type Parse_And_Then is new Root_Parser with record
Parser_A, Parser_B : Holder;
end record;
function Parse (Parser : in Parse_And_Then; Input : in String) return Result'Class;
type Parse_Or_Else is new Root_Parser with record
Parser_A, Parser_B : Holder;
end record;
function Parse (Parser : in Parse_Or_Else; Input : in String) return Result'Class;
-- Creators
function Character_Parser (Match : Character) return Holder is (To_Holder (Parse_Character'(Match => Match)));
function Character_Parser (Match_From, Match_To : Character) return Holder is
(To_Holder (Parse_Character_Range'(Match_From => Match_From, Match_To => Match_To)));
-- These have to go into a child packae as we cannot dispatch on multiple tagged types.
package Operators is
function "or" (Parser_A, Parser_B : Holder) return Parse_Or_Else is (Parse_Or_Else'(Parser_A, Parser_B));
function "and" (Parser_A, Parser_B : Holder) return Parse_And_Then is (Parse_And_Then'(Parser_A, Parser_B));
end Operators;
end Parsing;
|
oeis/179/A179403.asm | neoneye/loda-programs | 11 | 18710 | ; A179403: Number of ways to place 2 nonattacking kings on an n X n toroidal board.
; Submitted by <NAME>
; 0,0,0,56,200,486,980,1760,2916,4550,6776,9720,13520,18326,24300,31616,40460,51030,63536,78200,95256,114950,137540,163296,192500,225446,262440,303800,349856,400950,457436,519680,588060,662966,744800,833976,930920,1036070,1149876,1272800,1405316,1547910,1701080,1865336,2041200,2229206,2429900,2643840,2871596,3113750,3370896,3643640,3932600,4238406,4561700,4903136,5263380,5643110,6043016,6463800,6906176,7370870,7858620,8370176,8906300,9467766,10055360,10669880,11312136,11982950,12683156,13413600
add $0,1
mov $1,$0
pow $0,2
trn $0,9
mul $0,$1
mul $1,$0
mov $0,$1
div $0,2
|
Algebra/Lifting.agda | Rotsor/BinDivMod | 1 | 2050 | <gh_stars>1-10
import Algebra
import Algebra.Structures
import Function.Equality
import Function.Equivalence
import Function.Bijection
import Level
import Relation.Binary
import Algebra.FunctionProperties
import Relation.Binary.EqReasoning
open Level renaming (zero to ₀)
open Relation.Binary using (Setoid; module Setoid)
open Function.Bijection
module Algebra.Lifting
(S₁ S₂ : Setoid ₀ ₀)
(f : Bijection S₁ S₂) where
open Algebra.FunctionProperties using (Op₂; LeftIdentity)
open Algebra.Structures
open Setoid S₁ using () renaming (Carrier to A₁; _≈_ to _≈₁_; sym to sym₁; refl to refl₁; trans to trans₁)
open Setoid S₂ using (sym; trans) renaming (Carrier to A₂; _≈_ to _≈₂_; isEquivalence to isEquivalence₂)
open Bijection f
open Function.Equality using (_⟨$⟩_; cong)
module WithOp₂
(_+₁_ : Op₂ A₁)
(_+₂_ : Op₂ A₂)
(+-same : ∀ x y → from ⟨$⟩ (x +₂ y) ≈₁ (from ⟨$⟩ x) +₁ (from ⟨$⟩ y)) where
open Relation.Binary.EqReasoning S₁ renaming (begin_ to begin₁_; _∎ to _∎₁; _≈⟨_⟩_ to _≈₁⟨_⟩_)
open Relation.Binary.EqReasoning S₂ renaming (begin_ to begin₂_; _∎ to _∎₂; _≈⟨_⟩_ to _≈₂⟨_⟩_)
open import Function using (_⟨_⟩_)
from-inj : ∀ {x y} → from ⟨$⟩ x ≈₁ from ⟨$⟩ y → x ≈₂ y
from-inj {x} {y} eq = (sym (right-inverse-of x)) ⟨ trans ⟩ cong to eq ⟨ trans ⟩ (right-inverse-of y)
lift-comm : (∀ x y → (x +₁ y) ≈₁ (y +₁ x)) → (∀ x y → (x +₂ y) ≈₂ (y +₂ x))
lift-comm comm₁ x y = from-inj (
begin₁
from ⟨$⟩ x +₂ y
≈₁⟨ +-same x y ⟩
(from ⟨$⟩ x) +₁ (from ⟨$⟩ y)
≈₁⟨ comm₁ (from ⟨$⟩ x) (from ⟨$⟩ y) ⟩
(from ⟨$⟩ y) +₁ (from ⟨$⟩ x)
≈₁⟨ sym₁ (+-same y x) ⟩
from ⟨$⟩ y +₂ x
∎₁
)
using-+-same : ∀ {a b c d}
→ (from ⟨$⟩ a) +₁ (from ⟨$⟩ b) ≈₁ (from ⟨$⟩ c) +₁ (from ⟨$⟩ d)
→ from ⟨$⟩ a +₂ b ≈₁ from ⟨$⟩ c +₂ d
using-+-same {a} {b} {c} {d} eq =
begin₁
from ⟨$⟩ a +₂ b
≈₁⟨ +-same a b ⟩
(from ⟨$⟩ a) +₁ (from ⟨$⟩ b)
≈₁⟨ eq ⟩
(from ⟨$⟩ c) +₁ (from ⟨$⟩ d)
≈₁⟨ sym₁ (+-same c d) ⟩
from ⟨$⟩ c +₂ d
∎₁
lift-comm' : (∀ x y → (x +₁ y) ≈₁ (y +₁ x)) → (∀ x y → (x +₂ y) ≈₂ (y +₂ x))
lift-comm' comm₁ x y = from-inj (using-+-same (comm₁ (from ⟨$⟩ x) (from ⟨$⟩ y)))
lift-assoc : (∀ x y z → (x +₁ y) +₁ z ≈₁ x +₁ (y +₁ z))
→ (∀ {a b c d} → a ≈₁ b → c ≈₁ d → a +₁ c ≈₁ b +₁ d)
→ (∀ x y z → (x +₂ y) +₂ z ≈₂ x +₂ (y +₂ z))
lift-assoc assoc₁ +₁-cong x y z = from-inj (using-+-same (
begin₁
(from ⟨$⟩ x +₂ y) +₁ fz
≈₁⟨ +₁-cong (+-same x y) refl₁ ⟩
(fx +₁ fy) +₁ fz
≈₁⟨ assoc₁ fx fy fz ⟩
fx +₁ (fy +₁ fz)
≈₁⟨ +₁-cong refl₁ (sym₁ (+-same y z)) ⟩
fx +₁ (from ⟨$⟩ y +₂ z)
∎₁)) where
fx = from ⟨$⟩ x
fy = from ⟨$⟩ y
fz = from ⟨$⟩ z
+Cong₁ = (∀ {a b c d} → a ≈₁ b → c ≈₁ d → a +₁ c ≈₁ b +₁ d)
+Cong₂ = (∀ {a b c d} → a ≈₂ b → c ≈₂ d → a +₂ c ≈₂ b +₂ d)
lift-cong : +Cong₁ → +Cong₂
lift-cong cong₁ a≈₂b c≈₂d = from-inj (using-+-same (cong₁ (cong from a≈₂b) (cong from c≈₂d)))
lift-isSemigroup : IsSemigroup _≈₁_ _+₁_ → IsSemigroup _≈₂_ _+₂_
lift-isSemigroup isSemigroup = record
{ isEquivalence = isEquivalence₂
; assoc = lift-assoc assoc ∙-cong
; ∙-cong = lift-cong ∙-cong
} where
open IsSemigroup isSemigroup
lift-LeftIdentity : ∀ ε → +Cong₁ → LeftIdentity _≈₁_ ε _+₁_ → LeftIdentity _≈₂_ (to ⟨$⟩ ε) _+₂_
lift-LeftIdentity ε +-cong₁ identityˡ x = from-inj (
begin₁
from ⟨$⟩ (to ⟨$⟩ ε) +₂ x
≈₁⟨ +-same (to ⟨$⟩ ε) x ⟩
(from ⟨$⟩ (to ⟨$⟩ ε)) +₁ (from ⟨$⟩ x)
≈₁⟨ +-cong₁ (left-inverse-of ε) refl₁ ⟩
ε +₁ (from ⟨$⟩ x)
≈₁⟨ identityˡ (from ⟨$⟩ x) ⟩
from ⟨$⟩ x
∎₁)
lift-isCommutativeMonoid : ∀ ε → IsCommutativeMonoid _≈₁_ _+₁_ ε → IsCommutativeMonoid _≈₂_ _+₂_ (to ⟨$⟩ ε)
lift-isCommutativeMonoid ε isCommMonoid = record
{ isSemigroup = lift-isSemigroup isSemigroup
; identityˡ = lift-LeftIdentity ε ∙-cong identityˡ
; comm = lift-comm comm
} where
open IsCommutativeMonoid isCommMonoid
|
compiler/parser/src/commonAntlr/antlr/PlankLexer.g4 | gabrielleeg1/plank | 1 | 7345 | <reponame>gabrielleeg1/plank<gh_stars>1-10
lexer grammar PlankLexer;
@header {
/* ktlint-disable no-wildcard-imports */
@file:Suppress(
"UNNECESSARY_NOT_NULL_ASSERTION",
"UNUSED_PARAMETER", "USELESS_CAST", "UNUSED_VALUE", "VARIABLE_WITH_REDUNDANT_INITIALIZER",
"PARAMETER_NAME_CHANGED_ON_OVERRIDE", "SENSELESS_COMPARISON", "UNCHECKED_CAST",
"RemoveRedundantQualifierName", "RedundantCompanionReference", "RedundantVisibilityModifier", "FunctionName",
"SpellCheckingInspection", "RedundantExplicitType", "ConvertSecondaryConstructorToPrimary", "ConstantConditionIf",
"CanBeVal", "LocalVariableName", "RemoveEmptySecondaryConstructorBody", "LiftReturnOrAssignment",
"MemberVisibilityCanBePrivate", "RedundantNullableReturnType", "OverridingDeprecatedMember", "EnumEntryName",
"RemoveExplicitTypeArguments", "PrivatePropertyName", "ProtectedInFinal", "MoveLambdaOutsideParentheses", "ClassName",
"CanBeParameter", "unused",
"Detekt.MaximumLineLength", "Detekt.MaxLineLength", "Detekt.FinalNewline", "EmptyFunctionBlock",
)
package org.plank.parser
}
WS: (' ' | '\t' | NEWLINE)+ -> channel(HIDDEN);
NEWLINE: ([\r\n] | [\n])+;
// symbols
AT: '@';
SEMICOLON : ';' ;
COMMA: ',';
COLON: ':';
BAR: '|';
LPAREN: '(';
RPAREN: ')';
LBRACE: '{';
RBRACE: '}';
LBRACKET: '[' ;
RBRACKET: ']' ;
APOSTROPHE: '\'';
DOT: '.';
AMPERSTAND: '&';
ADD: '+';
SUB: '-';
DIV: '/';
TIMES: '*';
CONCAT: ADD ADD;
BANG: '!';
EQUAL: '=';
ASSIGN: COLON EQUAL;
GT: '>';
LT: '<';
GTE: GT EQUAL;
LTE: LT EQUAL;
EQ: EQUAL EQUAL;
NEQ: BANG EQUAL;
DOUBLE_ARROW_LEFT: EQUAL GT;
ARROW_LEFT: SUB GT;
// keywords
RETURN: 'return';
FUN: 'fun';
TYPE: 'type';
LET: 'let';
IF: 'if';
ELSE: 'else';
MUTABLE: 'mutable';
TRUE: 'true';
FALSE: 'false';
USE: 'use';
SIZEOF: 'sizeof';
MODULE: 'module';
MATCH: 'match';
ENUM: 'enum';
THEN: 'then';
// identifiers
IDENTIFIER: [a-zA-Z_][a-zA-Z0-9_]*;
STRING: '"' (~["\r\n\\] | '\\' ~[\r\n])* '"'
| '\'' (~["\r\n\\] | '\\' ~[\r\n])* '\''
;
INT: [0-9]+ ;
DECIMAL: INT '.' INT;
|
boot/boot-sector.asm | Soptq/sim-osv2 | 0 | 171977 | ; Generally, in our system
; KERNEL starts at 0x1000
; Stack starts at 0x90000 and it grows downward
; Heap is set to 0x1000000 and it grows upward.
[org 0x7c00]
KERNEL_OFFSET equ 0x1000
mov [BOOT_DRIVE], dl ; BOOT_DRIVE is set to 0
mov bp, 0x9000 ; stack starts at 0x9000
mov sp, bp
mov bx, MSG_REAL_MODE ; print msg
call print
call print_nl
call load_kernel ; load kernel to KERNEL_OFFSET
call switch_to_pm
jmp $
%include "./boot/16bit-print.asm"
%include "./boot/16bit-print_hex.asm"
%include "./boot/16bit-disk.asm"
%include "./boot/32bit-gdt.asm"
%include "./boot/32bit-print.asm"
%include "./boot/32bit-switch.asm"
[bits 16]
load_kernel:
mov bx, MSG_LOAD_KERNEL ; print msg
call print
call print_nl
; IMPORTANT: Addresing of buffer should guarantee that
; the *complete buffer* is _*inside*_ the given segment,
; i.e. (BX + size_of_buffer) <= 10000h
mov bx, KERNEL_OFFSET ; our kernel is located at 0x1000
; so before calling int 13, we set bx to our kernel offset
; so that int 13 will read our kernel to bx
mov dh, 54 ; read 31 sectors, each sector contains 512 bytes / 0.5 Kb
; plus the boot sector, we read in total 32 sectors
mov dl, [BOOT_DRIVE] ; designate boot drive 0
call disk_load ; load disk, read data to the memory
mov bx, MSG_LOADED_KERNEL ; print msg
call print
call print_nl
ret
[bits 32]
BEGIN_PM:
mov ebx, MSG_PROT_MODE ; print msg
call print_string_pm
call KERNEL_OFFSET ; call our c_entry code
mov ebx, MSG_RETURNED_KERNEL ; this line code should never be run
call print_string_pm
jmp $
BOOT_DRIVE db 0
MSG_REAL_MODE db "Started in RM", 0
MSG_SW_PROT_MODE db "Switching to PM", 0
MSG_PROT_MODE db "Landed in 32-bit PM", 0
MSG_LOAD_KERNEL db "Loading kernel", 0
MSG_LOADED_KERNEL db "Loading kernel completed", 0
MSG_RETURNED_KERNEL db "Returned from kernel. Error?", 0
times 510-($-$$) db 0
dw 0xaa55 |
resources/pref/prefs.scpt | pine/dotfiles | 18 | 4166 | tell application "System Events" to tell appearance preferences to set dark mode to true
|
src/org-protocol-client.scpt | mxco86/org-protocol-client | 0 | 975 | <reponame>mxco86/org-protocol-client<filename>src/org-protocol-client.scpt
on open location this_URL
set EC to "/run/current-system/sw/bin/emacsclient --no-wait "
set filePath to quoted form of this_URL
do shell script EC & filePath
tell application "/run/current-system/Applications/Emacs.app" to activate
end open location |
lib/avx512/zuc_avx512.asm | dalekzhangdong/intel-ipsec-mb | 1 | 104312 | ;;
;; Copyright (c) 2020, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
%include "include/os.asm"
%include "include/reg_sizes.asm"
%include "include/zuc_sbox.inc"
%include "include/transpose_avx512.asm"
%include "include/const.inc"
%include "include/mb_mgr_datastruct.asm"
%include "include/cet.inc"
%define APPEND(a,b) a %+ b
%define APPEND3(a,b,c) a %+ b %+ c
section .data
default rel
align 64
EK_d64:
dd 0x0044D700, 0x0026BC00, 0x00626B00, 0x00135E00, 0x00578900, 0x0035E200, 0x00713500, 0x0009AF00
dd 0x004D7800, 0x002F1300, 0x006BC400, 0x001AF100, 0x005E2600, 0x003C4D00, 0x00789A00, 0x0047AC00
align 64
EK256_d64:
dd 0x00220000, 0x002F0000, 0x00240000, 0x002A0000, 0x006D0000, 0x00400000, 0x00400000, 0x00400000
dd 0x00400000, 0x00400000, 0x00400000, 0x00400000, 0x00400000, 0x00520000, 0x00100000, 0x00300000
align 64
EK256_EIA3_4:
dd 0x00220000, 0x002F0000, 0x00250000, 0x002A0000,
dd 0x006D0000, 0x00400000, 0x00400000, 0x00400000,
dd 0x00400000, 0x00400000, 0x00400000, 0x00400000,
dd 0x00400000, 0x00520000, 0x00100000, 0x00300000
align 64
EK256_EIA3_8:
dd 0x00230000, 0x002F0000, 0x00240000, 0x002A0000,
dd 0x006D0000, 0x00400000, 0x00400000, 0x00400000,
dd 0x00400000, 0x00400000, 0x00400000, 0x00400000,
dd 0x00400000, 0x00520000, 0x00100000, 0x00300000
align 64
EK256_EIA3_16:
dd 0x00230000, 0x002F0000, 0x00250000, 0x002A0000,
dd 0x006D0000, 0x00400000, 0x00400000, 0x00400000,
dd 0x00400000, 0x00400000, 0x00400000, 0x00400000,
dd 0x00400000, 0x00520000, 0x00100000, 0x00300000
align 64
shuf_mask_key:
dd 0x00FFFFFF, 0x01FFFFFF, 0x02FFFFFF, 0x03FFFFFF, 0x04FFFFFF, 0x05FFFFFF, 0x06FFFFFF, 0x07FFFFFF,
dd 0x08FFFFFF, 0x09FFFFFF, 0x0AFFFFFF, 0x0BFFFFFF, 0x0CFFFFFF, 0x0DFFFFFF, 0x0EFFFFFF, 0x0FFFFFFF,
align 64
shuf_mask_iv:
dd 0xFFFFFF00, 0xFFFFFF01, 0xFFFFFF02, 0xFFFFFF03, 0xFFFFFF04, 0xFFFFFF05, 0xFFFFFF06, 0xFFFFFF07,
dd 0xFFFFFF08, 0xFFFFFF09, 0xFFFFFF0A, 0xFFFFFF0B, 0xFFFFFF0C, 0xFFFFFF0D, 0xFFFFFF0E, 0xFFFFFF0F,
align 16
shuf_mask_iv_17_19:
db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x01, 0xFF, 0xFF, 0xFF, 0x02, 0xFF
align 16
clear_iv_mask:
db 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00
align 16
shuf_mask_iv_20_23:
db 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x01, 0xFF, 0xFF, 0xFF, 0x02, 0xFF, 0xFF, 0xFF, 0x03, 0xFF
align 64
mask31:
dd 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF,
dd 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF,
dd 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF,
dd 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF,
align 64
swap_mask:
db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04
db 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c
db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04
db 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c
db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04
db 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c
db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04
db 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c
align 64
S1_S0_shuf:
db 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F
db 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F
db 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F
db 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F
align 64
S0_S1_shuf:
db 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
db 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
db 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
db 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
align 64
rev_S1_S0_shuf:
db 0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B, 0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F
db 0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B, 0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F
db 0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B, 0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F
db 0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B, 0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F
align 64
rev_S0_S1_shuf:
db 0x08, 0x00, 0x09, 0x01, 0x0A, 0x02, 0x0B, 0x03, 0x0C, 0x04, 0x0D, 0x05, 0x0E, 0x06, 0x0F, 0x07
db 0x08, 0x00, 0x09, 0x01, 0x0A, 0x02, 0x0B, 0x03, 0x0C, 0x04, 0x0D, 0x05, 0x0E, 0x06, 0x0F, 0x07
db 0x08, 0x00, 0x09, 0x01, 0x0A, 0x02, 0x0B, 0x03, 0x0C, 0x04, 0x0D, 0x05, 0x0E, 0x06, 0x0F, 0x07
db 0x08, 0x00, 0x09, 0x01, 0x0A, 0x02, 0x0B, 0x03, 0x0C, 0x04, 0x0D, 0x05, 0x0E, 0x06, 0x0F, 0x07
align 64
bit_reverse_table_l:
db 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e, 0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b, 0x07, 0x0f
db 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e, 0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b, 0x07, 0x0f
db 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e, 0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b, 0x07, 0x0f
db 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e, 0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b, 0x07, 0x0f
align 64
bit_reverse_table_h:
db 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0
db 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0
db 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0
db 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0
align 64
bit_reverse_and_table:
db 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f
db 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f
db 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f
db 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f
align 64
data_mask_64bits:
dd 0xffffffff, 0xffffffff, 0x00000000, 0x00000000
dd 0xffffffff, 0xffffffff, 0x00000000, 0x00000000
dd 0xffffffff, 0xffffffff, 0x00000000, 0x00000000
dd 0xffffffff, 0xffffffff, 0x00000000, 0x00000000
align 64
shuf_mask_tags:
dd 0x01, 0x05, 0x09, 0x0D, 0x11, 0x15, 0x19, 0x1D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
dd 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x05, 0x09, 0x0D, 0x11, 0x15, 0x19, 0x1D
align 64
all_ffs:
dw 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
dw 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
align 64
all_threes:
dw 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003
dw 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003
align 64
all_fffcs:
dw 0xfffc, 0xfffc, 0xfffc, 0xfffc, 0xfffc, 0xfffc, 0xfffc, 0xfffc
dw 0xfffc, 0xfffc, 0xfffc, 0xfffc, 0xfffc, 0xfffc, 0xfffc, 0xfffc
align 64
all_3fs:
dw 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f
dw 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f
align 16
bit_mask_table:
db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80
db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0
db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0
db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0
db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8
db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc
db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe
byte64_len_to_mask_table:
dq 0xffffffffffffffff, 0x0000000000000001
dq 0x0000000000000003, 0x0000000000000007
dq 0x000000000000000f, 0x000000000000001f
dq 0x000000000000003f, 0x000000000000007f
dq 0x00000000000000ff, 0x00000000000001ff
dq 0x00000000000003ff, 0x00000000000007ff
dq 0x0000000000000fff, 0x0000000000001fff
dq 0x0000000000003fff, 0x0000000000007fff
dq 0x000000000000ffff, 0x000000000001ffff
dq 0x000000000003ffff, 0x000000000007ffff
dq 0x00000000000fffff, 0x00000000001fffff
dq 0x00000000003fffff, 0x00000000007fffff
dq 0x0000000000ffffff, 0x0000000001ffffff
dq 0x0000000003ffffff, 0x0000000007ffffff
dq 0x000000000fffffff, 0x000000001fffffff
dq 0x000000003fffffff, 0x000000007fffffff
dq 0x00000000ffffffff, 0x00000001ffffffff
dq 0x00000003ffffffff, 0x00000007ffffffff
dq 0x0000000fffffffff, 0x0000001fffffffff
dq 0x0000003fffffffff, 0x0000007fffffffff
dq 0x000000ffffffffff, 0x000001ffffffffff
dq 0x000003ffffffffff, 0x000007ffffffffff
dq 0x00000fffffffffff, 0x00001fffffffffff
dq 0x00003fffffffffff, 0x00007fffffffffff
dq 0x0000ffffffffffff, 0x0001ffffffffffff
dq 0x0003ffffffffffff, 0x0007ffffffffffff
dq 0x000fffffffffffff, 0x001fffffffffffff
dq 0x003fffffffffffff, 0x007fffffffffffff
dq 0x00ffffffffffffff, 0x01ffffffffffffff
dq 0x03ffffffffffffff, 0x07ffffffffffffff
dq 0x0fffffffffffffff, 0x1fffffffffffffff
dq 0x3fffffffffffffff, 0x7fffffffffffffff
dq 0xffffffffffffffff
align 64
add_64:
dq 64, 64, 64, 64, 64, 64, 64, 64
align 32
all_512w:
dw 512, 512, 512, 512, 512, 512, 512, 512
dw 512, 512, 512, 512, 512, 512, 512, 512
align 64
bswap_mask:
db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04
db 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c
db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04
db 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c
db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04
db 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c
db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04
db 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c
align 64
all_31w:
dw 31, 31, 31, 31, 31, 31, 31, 31
dw 31, 31, 31, 31, 31, 31, 31, 31
align 64
all_ffe0w:
dw 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0
dw 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0
section .text
align 64
%ifdef LINUX
%define arg1 rdi
%define arg2 rsi
%define arg3 rdx
%else
%define arg1 rcx
%define arg2 rdx
%define arg3 r8
%endif
%define MASK31 zmm12
%define OFS_R1 (16*(4*16))
%define OFS_R2 (OFS_R1 + (4*16))
%define OFS_X0 (OFS_R2 + (4*16))
%define OFS_X1 (OFS_X0 + (4*16))
%define OFS_X2 (OFS_X1 + (4*16))
%ifidn __OUTPUT_FORMAT__, win64
%define XMM_STORAGE 16*10
%define GP_STORAGE 8*8
%else
%define XMM_STORAGE 0
%define GP_STORAGE 6*8
%endif
%define VARIABLE_OFFSET XMM_STORAGE + GP_STORAGE
%define GP_OFFSET XMM_STORAGE
%macro FUNC_SAVE 0
mov r11, rsp
sub rsp, VARIABLE_OFFSET
and rsp, ~15
%ifidn __OUTPUT_FORMAT__, win64
; xmm6:xmm15 need to be maintained for Windows
vmovdqa [rsp + 0*16], xmm6
vmovdqa [rsp + 1*16], xmm7
vmovdqa [rsp + 2*16], xmm8
vmovdqa [rsp + 3*16], xmm9
vmovdqa [rsp + 4*16], xmm10
vmovdqa [rsp + 5*16], xmm11
vmovdqa [rsp + 6*16], xmm12
vmovdqa [rsp + 7*16], xmm13
vmovdqa [rsp + 8*16], xmm14
vmovdqa [rsp + 9*16], xmm15
mov [rsp + GP_OFFSET + 48], rdi
mov [rsp + GP_OFFSET + 56], rsi
%endif
mov [rsp + GP_OFFSET], r12
mov [rsp + GP_OFFSET + 8], r13
mov [rsp + GP_OFFSET + 16], r14
mov [rsp + GP_OFFSET + 24], r15
mov [rsp + GP_OFFSET + 32], rbx
mov [rsp + GP_OFFSET + 40], r11 ;; rsp pointer
%endmacro
%macro FUNC_RESTORE 0
%ifidn __OUTPUT_FORMAT__, win64
vmovdqa xmm6, [rsp + 0*16]
vmovdqa xmm7, [rsp + 1*16]
vmovdqa xmm8, [rsp + 2*16]
vmovdqa xmm9, [rsp + 3*16]
vmovdqa xmm10, [rsp + 4*16]
vmovdqa xmm11, [rsp + 5*16]
vmovdqa xmm12, [rsp + 6*16]
vmovdqa xmm13, [rsp + 7*16]
vmovdqa xmm14, [rsp + 8*16]
vmovdqa xmm15, [rsp + 9*16]
mov rdi, [rsp + GP_OFFSET + 48]
mov rsi, [rsp + GP_OFFSET + 56]
%endif
mov r12, [rsp + GP_OFFSET]
mov r13, [rsp + GP_OFFSET + 8]
mov r14, [rsp + GP_OFFSET + 16]
mov r15, [rsp + GP_OFFSET + 24]
mov rbx, [rsp + GP_OFFSET + 32]
mov rsp, [rsp + GP_OFFSET + 40]
%endmacro
; This macro reorder the LFSR registers
; after N rounds (1 <= N <= 15), since the registers
; are shifted every round
;
; The macro clobbers ZMM0-15
;
%macro REORDER_LFSR 3
%define %%STATE %1
%define %%NUM_ROUNDS %2
%define %%LANE_MASK %3
%if %%NUM_ROUNDS != 16
%assign i 0
%rep 16
vmovdqa32 APPEND(zmm,i){%%LANE_MASK}, [%%STATE + 64*i]
%assign i (i+1)
%endrep
%assign i 0
%assign j %%NUM_ROUNDS
%rep 16
vmovdqa32 [%%STATE + 64*i]{%%LANE_MASK}, APPEND(zmm,j)
%assign i (i+1)
%assign j ((j+1) % 16)
%endrep
%endif ;; %%NUM_ROUNDS != 16
%endmacro
;
; bits_reorg16()
;
%macro bits_reorg16 7-8
%define %%STATE %1 ; [in] ZUC state
%define %%ROUND_NUM %2 ; [in] Round number
%define %%LANE_MASK %3 ; [in] Mask register with lanes to update
%define %%MODE %4 ; [in] Mode = init or working
%define %%X0 %5 ; [out] X0
%define %%X1 %6 ; [out] X1
%define %%X2 %7 ; [out] X2
%define %%X3 %8 ; [out] ZMM register containing X3 of all lanes
;
; zmm15 = LFSR_S15
; zmm14 = LFSR_S14
; zmm11 = LFSR_S11
; zmm9 = LFSR_S9
; zmm7 = LFSR_S7
; zmm5 = LFSR_S5
; zmm2 = LFSR_S2
; zmm0 = LFSR_S0
;
vmovdqa64 zmm15, [%%STATE + ((15 + %%ROUND_NUM) % 16)*64]
vmovdqa64 zmm14, [%%STATE + ((14 + %%ROUND_NUM) % 16)*64]
vmovdqa64 zmm11, [%%STATE + ((11 + %%ROUND_NUM) % 16)*64]
vmovdqa64 zmm9, [%%STATE + (( 9 + %%ROUND_NUM) % 16)*64]
vmovdqa64 zmm7, [%%STATE + (( 7 + %%ROUND_NUM) % 16)*64]
vmovdqa64 zmm5, [%%STATE + (( 5 + %%ROUND_NUM) % 16)*64]
vmovdqa64 zmm2, [%%STATE + (( 2 + %%ROUND_NUM) % 16)*64]
vmovdqa64 zmm0, [%%STATE + (( 0 + %%ROUND_NUM) % 16)*64]
%ifidn %%MODE, init
vpxorq zmm1, zmm1
vpslld zmm15, 1
vpblendmw zmm3{k1}, zmm14, zmm1
vpblendmw %%X0{k1}, zmm3, zmm15
vpslld zmm11, 16
vpsrld zmm9, 15
vporq %%X1, zmm11, zmm9
vpslld zmm7, 16
vpsrld zmm5, 15
vporq %%X2, zmm7, zmm5
%else
vpxorq zmm1, zmm1
vpslld zmm15, 1
vpblendmw zmm3{k1}, zmm14, zmm1
vpblendmw zmm15{k1}, zmm3, zmm15
vmovdqa32 [%%STATE + OFS_X0]{%%LANE_MASK}, zmm15 ; BRC_X0
vpslld zmm11, 16
vpsrld zmm9, 15
vporq zmm11, zmm9
vmovdqa32 [%%STATE + OFS_X1]{%%LANE_MASK}, zmm11 ; BRC_X1
vpslld zmm7, 16
vpsrld zmm5, 15
vporq zmm7, zmm5
vmovdqa32 [%%STATE + OFS_X2]{%%LANE_MASK}, zmm7 ; BRC_X2
%endif
%if (%0 == 8)
vpslld zmm2, 16
vpsrld zmm0, 15
vporq %%X3, zmm2, zmm0 ; Store BRC_X3 in ZMM register
%endif
%endmacro
;
; nonlin_fun16()
;
; return
; W value, updates F_R1[] / F_R2[]
;
%macro nonlin_fun16 9-10
%define %%STATE %1 ; [in] ZUC state
%define %%LANE_MASK %2 ; [in] Mask register with lanes to update
%define %%USE_GFNI %3 ; [in] Use GFNI instructions
%define %%MODE %4 ; [in] Mode = init or working
%define %%X0 %5 ; [out] X0
%define %%X1 %6 ; [out] X1
%define %%X2 %7 ; [out] X2
%define %%R1 %8 ; [out] R1
%define %%R2 %9 ; [out] R2
%define %%W %10 ; [out] ZMM register to contain W for all lanes
%ifidn %%MODE, init
%if (%0 == 10)
vpxorq %%W, %%X0, %%R1
vpaddd %%W, %%R2 ; W = (BRC_X0 ^ F_R1) + F_R2
%endif
vpaddd zmm1, %%R1, %%X1 ; W1 = F_R1 + BRC_X1
vpxorq zmm2, %%R2, %%X2 ; W2 = F_R2 ^ BRC_X2
%else
%if (%0 == 10)
vmovdqa64 %%W, [%%STATE + OFS_X0]
vpxorq %%W, [%%STATE + OFS_R1]
vpaddd %%W, [%%STATE + OFS_R2] ; W = (BRC_X0 ^ F_R1) + F_R2
%endif
vmovdqa64 zmm1, [%%STATE + OFS_R1]
vmovdqa64 zmm2, [%%STATE + OFS_R2]
vpaddd zmm1, [%%STATE + OFS_X1] ; W1 = F_R1 + BRC_X1
vpxorq zmm2, [%%STATE + OFS_X2] ; W2 = F_R2 ^ BRC_X2
%endif
vpslld zmm3, zmm1, 16
vpsrld zmm4, zmm1, 16
vpslld zmm5, zmm2, 16
vpsrld zmm6, zmm2, 16
vporq zmm1, zmm3, zmm6
vporq zmm2, zmm4, zmm5
vprold zmm3, zmm1, 2
vprold zmm4, zmm1, 10
vprold zmm5, zmm1, 18
vprold zmm6, zmm1, 24
; ZMM1 = U = L1(P)
vpternlogq zmm1, zmm3, zmm4, 0x96 ; (A ^ B) ^ C
vpternlogq zmm1, zmm5, zmm6, 0x96 ; (A ^ B) ^ C
vprold zmm3, zmm2, 8
vprold zmm4, zmm2, 14
vprold zmm5, zmm2, 22
vprold zmm6, zmm2, 30
; ZMM2 = V = L2(Q)
vpternlogq zmm2, zmm3, zmm4, 0x96 ; (A ^ B) ^ C
vpternlogq zmm2, zmm5, zmm6, 0x96 ; (A ^ B) ^ C
; Shuffle U and V to have all S0 lookups in XMM1 and all S1 lookups in XMM2
; Compress all S0 and S1 input values in each register
; S0: Bytes 0-7,16-23,32-39,48-55 S1: Bytes 8-15,24-31,40-47,56-63
vpshufb zmm1, [rel S0_S1_shuf]
; S1: Bytes 0-7,16-23,32-39,48-55 S0: Bytes 8-15,24-31,40-47,56-63
vpshufb zmm2, [rel S1_S0_shuf]
vshufpd zmm3, zmm1, zmm2, 0xAA ; All S0 input values
vshufpd zmm4, zmm2, zmm1, 0xAA ; All S1 input values
; Compute S0 and S1 values
S0_comput_AVX512 zmm3, zmm1, zmm2, %%USE_GFNI
S1_comput_AVX512 zmm4, zmm1, zmm2, zmm5, zmm6, %%USE_GFNI
; Need to shuffle back zmm1 & zmm2 before storing output
; (revert what was done before S0 and S1 computations)
vshufpd zmm1, zmm3, zmm4, 0xAA
vshufpd zmm2, zmm4, zmm3, 0xAA
%ifidn %%MODE, init
vpshufb %%R1, zmm1, [rel rev_S0_S1_shuf]
vpshufb %%R2, zmm2, [rel rev_S1_S0_shuf]
%else
vpshufb zmm1, [rel rev_S0_S1_shuf]
vpshufb zmm2, [rel rev_S1_S0_shuf]
vmovdqa32 [%%STATE + OFS_R1]{%%LANE_MASK}, zmm1
vmovdqa32 [%%STATE + OFS_R2]{%%LANE_MASK}, zmm2
%endif
%endmacro
;
; store_kstr16()
;
%macro store_kstr16 21
%define %%DATA64B_L0 %1 ; [in] 64 bytes of keystream for lane 0
%define %%DATA64B_L1 %2 ; [in] 64 bytes of keystream for lane 1
%define %%DATA64B_L2 %3 ; [in] 64 bytes of keystream for lane 2
%define %%DATA64B_L3 %4 ; [in] 64 bytes of keystream for lane 3
%define %%DATA64B_L4 %5 ; [in] 64 bytes of keystream for lane 4
%define %%DATA64B_L5 %6 ; [in] 64 bytes of keystream for lane 5
%define %%DATA64B_L6 %7 ; [in] 64 bytes of keystream for lane 6
%define %%DATA64B_L7 %8 ; [in] 64 bytes of keystream for lane 7
%define %%DATA64B_L8 %9 ; [in] 64 bytes of keystream for lane 8
%define %%DATA64B_L9 %10 ; [in] 64 bytes of keystream for lane 9
%define %%DATA64B_L10 %11 ; [in] 64 bytes of keystream for lane 10
%define %%DATA64B_L11 %12 ; [in] 64 bytes of keystream for lane 11
%define %%DATA64B_L12 %13 ; [in] 64 bytes of keystream for lane 12
%define %%DATA64B_L13 %14 ; [in] 64 bytes of keystream for lane 13
%define %%DATA64B_L14 %15 ; [in] 64 bytes of keystream for lane 14
%define %%DATA64B_L15 %16 ; [in] 64 bytes of keystream for lane 15
%define %%TMP0 %17 ; [clobbered] Temporary GP register
%define %%TMP1 %18 ; [clobbered] Temporary GP register
%define %%TMP2 %19 ; [clobbered] Temporary GP register
%define %%TMP3 %20 ; [clobbered] Temporary GP register
%define %%KMASK %21 ; [in] K mask containing which dwords will be stored
mov %%TMP0, [pKS]
mov %%TMP1, [pKS + 8]
mov %%TMP2, [pKS + 16]
mov %%TMP3, [pKS + 24]
vmovdqu32 [%%TMP0]{%%KMASK}, %%DATA64B_L0
vmovdqu32 [%%TMP1]{%%KMASK}, %%DATA64B_L1
vmovdqu32 [%%TMP2]{%%KMASK}, %%DATA64B_L2
vmovdqu32 [%%TMP3]{%%KMASK}, %%DATA64B_L3
mov %%TMP0, [pKS + 32]
mov %%TMP1, [pKS + 40]
mov %%TMP2, [pKS + 48]
mov %%TMP3, [pKS + 56]
vmovdqu32 [%%TMP0]{%%KMASK}, %%DATA64B_L4
vmovdqu32 [%%TMP1]{%%KMASK}, %%DATA64B_L5
vmovdqu32 [%%TMP2]{%%KMASK}, %%DATA64B_L6
vmovdqu32 [%%TMP3]{%%KMASK}, %%DATA64B_L7
mov %%TMP0, [pKS + 64]
mov %%TMP1, [pKS + 72]
mov %%TMP2, [pKS + 80]
mov %%TMP3, [pKS + 88]
vmovdqu32 [%%TMP0]{%%KMASK}, %%DATA64B_L8
vmovdqu32 [%%TMP1]{%%KMASK}, %%DATA64B_L9
vmovdqu32 [%%TMP2]{%%KMASK}, %%DATA64B_L10
vmovdqu32 [%%TMP3]{%%KMASK}, %%DATA64B_L11
mov %%TMP0, [pKS + 96]
mov %%TMP1, [pKS + 104]
mov %%TMP2, [pKS + 112]
mov %%TMP3, [pKS + 120]
vmovdqu32 [%%TMP0]{%%KMASK}, %%DATA64B_L12
vmovdqu32 [%%TMP1]{%%KMASK}, %%DATA64B_L13
vmovdqu32 [%%TMP2]{%%KMASK}, %%DATA64B_L14
vmovdqu32 [%%TMP3]{%%KMASK}, %%DATA64B_L15
%endmacro
;
; add_mod31()
; add two 32-bit args and reduce mod (2^31-1)
; params
; %1 - arg1/res
; %2 - arg2
; uses
; zmm2
; return
; %1
%macro add_mod31 2
vpaddd %1, %2
vpsrld zmm2, %1, 31
vpandq %1, MASK31
vpaddd %1, zmm2
%endmacro
;
; rot_mod31()
; rotate (mult by pow of 2) 32-bit arg and reduce mod (2^31-1)
; params
; %1 - arg
; %2 - # of bits
; uses
; zmm2
; return
; %1
%macro rot_mod31 2
vpslld zmm2, %1, %2
vpsrld %1, %1, (31 - %2)
vpternlogq %1, zmm2, MASK31, 0xA8 ; (A | B) & C
%endmacro
;
; lfsr_updt16()
;
%macro lfsr_updt16 4
%define %%STATE %1 ; [in] ZUC state
%define %%ROUND_NUM %2 ; [in] Round number
%define %%LANE_MASK %3 ; [in] Mask register with lanes to update
%define %%W %4 ; [out] ZMM register to contain W for all lanes
;
; zmm1 = LFSR_S0
; zmm4 = LFSR_S4
; zmm10 = LFSR_S10
; zmm13 = LFSR_S13
; zmm15 = LFSR_S15
;
vmovdqa64 zmm1, [%%STATE + (( 0 + %%ROUND_NUM) % 16)*64]
vmovdqa64 zmm4, [%%STATE + (( 4 + %%ROUND_NUM) % 16)*64]
vmovdqa64 zmm10, [%%STATE + ((10 + %%ROUND_NUM) % 16)*64]
vmovdqa64 zmm13, [%%STATE + ((13 + %%ROUND_NUM) % 16)*64]
vmovdqa64 zmm15, [%%STATE + ((15 + %%ROUND_NUM) % 16)*64]
; Calculate LFSR feedback
add_mod31 %%W, zmm1
rot_mod31 zmm1, 8
add_mod31 %%W, zmm1
rot_mod31 zmm4, 20
add_mod31 %%W, zmm4
rot_mod31 zmm10, 21
add_mod31 %%W, zmm10
rot_mod31 zmm13, 17
add_mod31 %%W, zmm13
rot_mod31 zmm15, 15
add_mod31 %%W, zmm15
vmovdqa32 [%%STATE + (( 0 + %%ROUND_NUM) % 16)*64]{%%LANE_MASK}, %%W
; LFSR_S16 = (LFSR_S15++) = eax
%endmacro
;
; Initialize LFSR registers for a single lane, for ZUC-128
;
; From spec, s_i (LFSR) registers need to be loaded as follows:
;
; For 0 <= i <= 15, let s_i= k_i || d_i || iv_i.
; Where k_i is each byte of the key, d_i is a 15-bit constant
; and iv_i is each byte of the IV.
;
%macro INIT_LFSR_128 4
%define %%KEY %1 ;; [in] Key pointer
%define %%IV %2 ;; [in] IV pointer
%define %%LFSR %3 ;; [out] ZMM register to contain initialized LFSR regs
%define %%ZTMP %4 ;; [clobbered] ZMM temporary register
vbroadcasti64x2 %%LFSR, [%%KEY]
vbroadcasti64x2 %%ZTMP, [%%IV]
vpshufb %%LFSR, [rel shuf_mask_key]
vpsrld %%LFSR, 1
vpshufb %%ZTMP, [rel shuf_mask_iv]
vpternlogq %%LFSR, %%ZTMP, [rel EK_d64], 0xFE ; A OR B OR C
%endmacro
;
; Initialize LFSR registers for a single lane, for ZUC-256
;
%macro INIT_LFSR_256 7
%define %%KEY %1 ;; [in] Key pointer
%define %%IV %2 ;; [in] IV pointer
%define %%LFSR %3 ;; [out] ZMM register to contain initialized LFSR regs
%define %%XTMP %4 ;; [clobbered] XMM temporary register
%define %%XTMP2 %5 ;; [clobbered] XMM temporary register
%define %%TMP %6 ;; [clobbered] GP temporary register
%define %%CONSTANTS %7 ;; [in] Address to constants
; s0 - s3
vpxorq %%XTMP, %%XTMP
vpinsrb %%XTMP, %%XTMP, [%%KEY], 3 ; s0
vpinsrb %%XTMP, %%XTMP, [%%KEY + 1], 7 ; s1
vpinsrb %%XTMP, %%XTMP, [%%KEY + 2], 11 ; s2
vpinsrb %%XTMP, %%XTMP, [%%KEY + 3], 15 ; s3
vpsrld %%XTMP, 1
vporq %%XTMP, [%%CONSTANTS] ; s0 - s3
vpinsrb %%XTMP, %%XTMP, [%%KEY + 21], 1 ; s0
vpinsrb %%XTMP, %%XTMP, [%%KEY + 16], 0 ; s0
vpinsrb %%XTMP, %%XTMP, [%%KEY + 22], 5 ; s1
vpinsrb %%XTMP, %%XTMP, [%%KEY + 17], 4 ; s1
vpinsrb %%XTMP, %%XTMP, [%%KEY + 23], 9 ; s2
vpinsrb %%XTMP, %%XTMP, [%%KEY + 18], 8 ; s2
vpinsrb %%XTMP, %%XTMP, [%%KEY + 24], 13 ; s3
vpinsrb %%XTMP, %%XTMP, [%%KEY + 19], 12 ; s3
vinserti32x4 %%LFSR, %%XTMP, 0
; s4 - s7
vpxorq %%XTMP, %%XTMP
vpinsrb %%XTMP, %%XTMP, [%%KEY + 4], 3 ; s4
vpinsrb %%XTMP, %%XTMP, [%%IV], 7 ; s5
vpinsrb %%XTMP, %%XTMP, [%%IV + 1], 11 ; s6
vpinsrb %%XTMP, %%XTMP, [%%IV + 10], 15 ; s7
vpsrld %%XTMP, 1
vpinsrb %%XTMP, %%XTMP, [%%KEY + 25], 1 ; s4
vpinsrb %%XTMP, %%XTMP, [%%KEY + 20], 0 ; s4
vpinsrb %%XTMP, %%XTMP, [%%KEY + 5], 5 ; s5
vpinsrb %%XTMP, %%XTMP, [%%KEY + 26], 4 ; s5
vpinsrb %%XTMP, %%XTMP, [%%KEY + 6], 9 ; s6
vpinsrb %%XTMP, %%XTMP, [%%KEY + 27], 8 ; s6
vpinsrb %%XTMP, %%XTMP, [%%KEY + 7], 13 ; s7
vpinsrb %%XTMP, %%XTMP, [%%IV + 2], 12 ; s7
vporq %%XTMP, [%%CONSTANTS + 16] ; s4 - s7
vmovd %%XTMP2, [%%IV + 17]
vpshufb %%XTMP2, [rel shuf_mask_iv_17_19]
vpandq %%XTMP2, [rel clear_iv_mask]
vporq %%XTMP, %%XTMP2
vinserti32x4 %%LFSR, %%XTMP, 1
; s8 - s11
vpxorq %%XTMP, %%XTMP
vpinsrb %%XTMP, %%XTMP, [%%KEY + 8], 3 ; s8
vpinsrb %%XTMP, %%XTMP, [%%KEY + 9], 7 ; s9
vpinsrb %%XTMP, %%XTMP, [%%IV + 5], 11 ; s10
vpinsrb %%XTMP, %%XTMP, [%%KEY + 11], 15 ; s11
vpsrld %%XTMP, 1
vpinsrb %%XTMP, %%XTMP, [%%IV + 3], 1 ; s8
vpinsrb %%XTMP, %%XTMP, [%%IV + 11], 0 ; s8
vpinsrb %%XTMP, %%XTMP, [%%IV + 12], 5 ; s9
vpinsrb %%XTMP, %%XTMP, [%%IV + 4], 4 ; s9
vpinsrb %%XTMP, %%XTMP, [%%KEY + 10], 9 ; s10
vpinsrb %%XTMP, %%XTMP, [%%KEY + 28], 8 ; s10
vpinsrb %%XTMP, %%XTMP, [%%IV + 6], 13 ; s11
vpinsrb %%XTMP, %%XTMP, [%%IV + 13], 12 ; s11
vporq %%XTMP, [%%CONSTANTS + 32] ; s8 - s11
vmovd %%XTMP2, [%%IV + 20]
vpshufb %%XTMP2, [rel shuf_mask_iv_20_23]
vpandq %%XTMP2, [rel clear_iv_mask]
vporq %%XTMP, %%XTMP2
vinserti32x4 %%LFSR, %%XTMP, 2
; s12 - s15
vpxorq %%XTMP, %%XTMP
vpinsrb %%XTMP, %%XTMP, [%%KEY + 12], 3 ; s12
vpinsrb %%XTMP, %%XTMP, [%%KEY + 13], 7 ; s13
vpinsrb %%XTMP, %%XTMP, [%%KEY + 14], 11 ; s14
vpinsrb %%XTMP, %%XTMP, [%%KEY + 15], 15 ; s15
vpsrld %%XTMP, 1
vpinsrb %%XTMP, %%XTMP, [%%IV + 7], 1 ; s12
vpinsrb %%XTMP, %%XTMP, [%%IV + 14], 0 ; s12
vpinsrb %%XTMP, %%XTMP, [%%IV + 15], 5 ; s13
vpinsrb %%XTMP, %%XTMP, [%%IV + 8], 4 ; s13
vpinsrb %%XTMP, %%XTMP, [%%IV + 16], 9 ; s14
vpinsrb %%XTMP, %%XTMP, [%%IV + 9], 8 ; s14
vpinsrb %%XTMP, %%XTMP, [%%KEY + 30], 13 ; s15
vpinsrb %%XTMP, %%XTMP, [%%KEY + 29], 12 ; s15
vporq %%XTMP, [%%CONSTANTS + 48] ; s12 - s15
movzx DWORD(%%TMP), byte [%%IV + 24]
and DWORD(%%TMP), 0x0000003f
shl DWORD(%%TMP), 16
vmovd %%XTMP2, DWORD(%%TMP)
movzx DWORD(%%TMP), byte [%%KEY + 31]
shl DWORD(%%TMP), 12
and DWORD(%%TMP), 0x000f0000 ; high nibble of K_31
vpinsrd %%XTMP2, DWORD(%%TMP), 2
movzx DWORD(%%TMP), byte [%%KEY + 31]
shl DWORD(%%TMP), 16
and DWORD(%%TMP), 0x000f0000 ; low nibble of K_31
vpinsrd %%XTMP2, DWORD(%%TMP), 3
vporq %%XTMP, %%XTMP2
vinserti32x4 %%LFSR, %%XTMP, 3
%endmacro
%macro INIT_16_AVX512 2
%define %%USE_GFNI %1 ; [in] If 1, then GFNI instructions may be used
%define %%KEY_SIZE %2 ; [in] Key size (128 or 256)
%ifdef LINUX
%define pKe rdi
%define pIv rsi
%define pState rdx
%define lane_mask ecx
%define arg5 r8 ; Only used in ZUC-256
%else
%define pKe rcx
%define pIv rdx
%define pState r8
%define lane_mask r9d
%define arg5 [rsp + 40] ; Only used in ZUC-256
%endif
%define %%X0 zmm16
%define %%X1 zmm17
%define %%X2 zmm18
%define %%W zmm19
%define %%R1 zmm20
%define %%R2 zmm21
%define tag_sz r10
%if %%KEY_SIZE == 256
mov tag_sz, arg5
%endif
FUNC_SAVE
mov rax, pState
kmovw k2, lane_mask
%if %%KEY_SIZE == 256
; Get pointer to constants (depending on tag size, this will point at
; constants for encryption, authentication with 4-byte, 8-byte or 16-byte tags)
lea r13, [rel EK256_d64]
bsf DWORD(tag_sz), DWORD(tag_sz)
dec DWORD(tag_sz)
shl DWORD(tag_sz), 6
add r13, tag_sz
%endif
; Set LFSR registers for Packet 1
mov r9, [pKe] ; Load Key 1 pointer
mov r10, [pIv] ; Load IV 1 pointer
%if %%KEY_SIZE == 128
INIT_LFSR_128 r9, r10, zmm0, zmm1
%else
INIT_LFSR_256 r9, r10, zmm0, xmm3, xmm5, r11, r13
%endif
; Set LFSR registers for Packets 2-15
%assign idx 1
%assign reg_lfsr 2
%assign reg_tmp 3
%rep 14
mov r9, [pKe+8*idx] ; Load Key N pointer
mov r10, [pIv+8*idx] ; Load IV N pointer
%if %%KEY_SIZE == 128
INIT_LFSR_128 r9, r10, APPEND(zmm, reg_lfsr), APPEND(zmm, reg_tmp)
%else
INIT_LFSR_256 r9, r10, APPEND(zmm, reg_lfsr), xmm3, xmm5, r11, r13
%endif
%assign idx (idx + 1)
%assign reg_lfsr (reg_lfsr + 2)
%assign reg_tmp (reg_tmp + 2)
%endrep
; Set LFSR registers for Packet 16
mov r9, [pKe+8*15] ; Load Key 16 pointer
mov r10, [pIv+8*15] ; Load IV 16 pointer
%if %%KEY_SIZE == 128
INIT_LFSR_128 r9, r10, zmm30, zmm31
%else
INIT_LFSR_256 r9, r10, zmm30, xmm3, xmm5, r11, r13
%endif
; Store LFSR registers in memory (reordering first, so all S0 regs
; are together, then all S1 regs... until S15)
TRANSPOSE16_U32 zmm0, zmm2, zmm4, zmm6, zmm8, zmm10, zmm12, zmm14, \
zmm16, zmm18, zmm20, zmm22, zmm24, zmm26, zmm28, zmm30, \
zmm1, zmm3, zmm5, zmm7, zmm9, zmm11, zmm13, zmm15, \
zmm17, zmm19, zmm21, zmm23, zmm25, zmm27
%assign i 0
%assign j 0
%rep 16
vmovdqa32 [pState + 64*i]{k2}, APPEND(zmm, j)
%assign i (i+1)
%assign j (j+2)
%endrep
; Load read-only registers
vmovdqa64 zmm12, [rel mask31]
mov edx, 0xAAAAAAAA
kmovd k1, edx
; Zero out R1, R2
vpxorq %%R1, %%R1
vpxorq %%R2, %%R2
; Shift LFSR 32-times, update state variables
%assign N 0
%rep 32
bits_reorg16 rax, N, k2, init, %%X0, %%X1, %%X2
nonlin_fun16 rax, k2, %%USE_GFNI, init, %%X0, %%X1, %%X2, %%R1, %%R2, %%W
vpsrld %%W,1 ; Shift out LSB of W
lfsr_updt16 rax, N, k2, %%W ; W used in LFSR update - not set to zero
%assign N N+1
%endrep
; And once more, initial round from keygen phase = 33 times
bits_reorg16 rax, 0, k2, init, %%X0, %%X1, %%X2
nonlin_fun16 rax, k2, %%USE_GFNI, init, %%X0, %%X1, %%X2, %%R1, %%R2
vpxorq %%W, %%W
lfsr_updt16 rax, 0, k2, %%W ; W used in LFSR update - set to zero
; Update R1, R2
vmovdqa32 [rax + OFS_R1]{k2}, %%R1
vmovdqa32 [rax + OFS_R2]{k2}, %%R2
FUNC_RESTORE
%endmacro
;;
;; void asm_ZucInitialization_16_avx512(ZucKey16_t *pKeys, ZucIv16_t *pIvs,
;; ZucState16_t *pState)
;;
MKGLOBAL(asm_ZucInitialization_16_avx512,function,internal)
asm_ZucInitialization_16_avx512:
endbranch64
INIT_16_AVX512 0, 128
ret
;;
;; void asm_ZucInitialization_16_gfni_avx512(ZucKey16_t *pKeys, ZucIv16_t *pIvs,
;; ZucState16_t *pState)
;;
MKGLOBAL(asm_ZucInitialization_16_gfni_avx512,function,internal)
asm_ZucInitialization_16_gfni_avx512:
endbranch64
INIT_16_AVX512 1, 128
ret
;;
;; void asm_Zuc256Initialization_16_avx512(ZucKey16_t *pKeys, ZucIv16_t *pIvs,
;; ZucState16_t *pState)
;;
MKGLOBAL(asm_Zuc256Initialization_16_avx512,function,internal)
asm_Zuc256Initialization_16_avx512:
endbranch64
INIT_16_AVX512 0, 256
ret
;;
;; void asm_Zuc256Initialization_16_gfni_avx512(ZucKey16_t *pKeys, ZucIv16_t *pIvs,
;; ZucState16_t *pState)
;;
MKGLOBAL(asm_Zuc256Initialization_16_gfni_avx512,function,internal)
asm_Zuc256Initialization_16_gfni_avx512:
endbranch64
INIT_16_AVX512 1, 256
ret
;
; Generate N*4 bytes of keystream
; for 16 buffers (where N is number of rounds)
;
%macro KEYGEN_16_AVX512 2-3
%define %%NUM_ROUNDS %1 ; [in] Number of 4-byte rounds
%define %%USE_GFNI %2 ; [in] If 1, then GFNI instructions may be used
%define %%LANE_MASK %3 ; [in] Lane mask with lanes to generate keystream
%define pState arg1
%define pKS arg2
%define numRounds arg3
%ifnum %%NUM_ROUNDS
%define %%MAX_ROUNDS %%NUM_ROUNDS
%else
%define %%MAX_ROUNDS 16
%endif
FUNC_SAVE
; Load state pointer in RAX
mov rax, pState
; Load read-only registers
vmovdqa64 zmm12, [rel mask31]
mov r10d, 0xAAAAAAAA
kmovd k1, r10d
%if (%0 == 3)
kmovd k2, DWORD(%%LANE_MASK)
%else
mov r10d, 0x0000FFFF
kmovd k2, r10d
%endif
; Generate N*4B of keystream in N rounds
%ifnnum %%NUM_ROUNDS
mov r10, numRounds
%endif
%assign N 1
%assign idx 16
%rep %%MAX_ROUNDS
bits_reorg16 rax, N, k2, working, none, none, none, APPEND(zmm, idx)
nonlin_fun16 rax, k2, %%USE_GFNI, working, none, none, none, none, none, zmm0
; OFS_X3 XOR W (zmm0)
vpxorq APPEND(zmm, idx), zmm0
vpxorq zmm0, zmm0
lfsr_updt16 rax, N, k2, zmm0 ; W (zmm0) used in LFSR update - not set to zero
%ifnnum %%NUM_ROUNDS
dec r10
jz %%exit_loop
%endif
%assign N N+1
%assign idx (idx + 1)
%endrep
%%exit_loop:
%ifnum %%NUM_ROUNDS
mov r12d, ((1 << %%NUM_ROUNDS) - 1)
%else
lea r13, [rel byte64_len_to_mask_table]
mov r12, [r13 + numRounds*8]
%endif
kmovd k1, r12d
; Store all 4 bytes of keystream in a single 64-byte buffer
%if %%NUM_ROUNDS == 1
vmovdqa32 [pKS]{k2}, zmm16
%else
; ZMM16-31 contain the keystreams for each round
; Perform a 32-bit 16x16 transpose to have up to 64 bytes
; (NUM_ROUNDS * 4B) of each lane in a different register
TRANSPOSE16_U32 zmm16, zmm17, zmm18, zmm19, zmm20, zmm21, zmm22, zmm23, \
zmm24, zmm25, zmm26, zmm27, zmm28, zmm29, zmm30, zmm31, \
zmm0, zmm1, zmm2, zmm3, zmm4, zmm5, zmm6, zmm7, \
zmm8, zmm9, zmm10, zmm11, zmm12, zmm13
store_kstr16 zmm16, zmm17, zmm18, zmm19, zmm20, zmm21, zmm22, zmm23, \
zmm24, zmm25, zmm26, zmm27, zmm28, zmm29, zmm30, zmm31, \
rbx, r9, r10, r11, k1
%endif
; Reorder LFSR registers
%ifnum %%NUM_ROUNDS
REORDER_LFSR rax, %%NUM_ROUNDS, k2
%else
cmp numRounds, 16
je %%_skip_reorder
cmp numRounds, 8
je %%_num_rounds_is_8
jb %%_rounds_is_1_7
; Final blocks 9-16
cmp numRounds, 12
je %%_num_rounds_is_12
jb %%_rounds_is_9_11
; Final blocks 13-15
cmp numRounds, 14
je %%_num_rounds_is_14
ja %%_num_rounds_is_15
jb %%_num_rounds_is_13
%%_rounds_is_9_11:
cmp numRounds, 10
je %%_num_rounds_is_10
ja %%_num_rounds_is_11
jb %%_num_rounds_is_9
%%_rounds_is_1_7:
cmp numRounds, 4
je %%_num_rounds_is_4
jb %%_rounds_is_1_3
; Final blocks 5-7
cmp numRounds, 6
je %%_num_rounds_is_6
ja %%_num_rounds_is_7
jb %%_num_rounds_is_5
%%_rounds_is_1_3:
cmp numRounds, 2
je %%_num_rounds_is_2
ja %%_num_rounds_is_3
; Rounds = 1 if fall-through
%assign I 1
%rep 15
APPEND(%%_num_rounds_is_,I):
REORDER_LFSR rax, I, k2
jmp %%_skip_reorder
%assign I (I + 1)
%endrep
%%_skip_reorder:
%endif
FUNC_RESTORE
%endmacro
;;
;; void asm_ZucGenKeystream64B_16_avx512(state16_t *pSta, u32* pKeyStr[16])
;;
MKGLOBAL(asm_ZucGenKeystream64B_16_avx512,function,internal)
asm_ZucGenKeystream64B_16_avx512:
endbranch64
KEYGEN_16_AVX512 16, 0
ret
;;
;; void asm_ZucGenKeystream8B_16_avx512(state16_t *pSta, u32* pKeyStr[16],
;; const u32 lane_mask)
;;
MKGLOBAL(asm_ZucGenKeystream8B_16_avx512,function,internal)
asm_ZucGenKeystream8B_16_avx512:
endbranch64
KEYGEN_16_AVX512 2, 0, arg3
ret
;;
;; void asm_ZucGenKeystream4B_16_avx512(state16_t *pSta, u32 pKeyStr[16],
;; const u32 lane_mask)
;;
MKGLOBAL(asm_ZucGenKeystream4B_16_avx512,function,internal)
asm_ZucGenKeystream4B_16_avx512:
endbranch64
KEYGEN_16_AVX512 1, 0, arg3
ret
;;
;; void asm_ZucGenKeystream64B_16_gfni_avx512(state16_t *pSta, u32* pKeyStr[16])
;;
MKGLOBAL(asm_ZucGenKeystream64B_16_gfni_avx512,function,internal)
asm_ZucGenKeystream64B_16_gfni_avx512:
endbranch64
KEYGEN_16_AVX512 16, 1
ret
;;
;; void asm_ZucGenKeystream8B_16_gfni_avx512(state16_t *pSta, u32* pKeyStr[16],
;; const u32 lane_mask)
;;
MKGLOBAL(asm_ZucGenKeystream8B_16_gfni_avx512,function,internal)
asm_ZucGenKeystream8B_16_gfni_avx512:
endbranch64
KEYGEN_16_AVX512 2, 1, arg3
ret
;;
;; void asm_ZucGenKeystream4B_16_gfni_avx512(state16_t *pSta, u32 pKeyStr[16],
;; const u32 lane_mask)
;;
MKGLOBAL(asm_ZucGenKeystream4B_16_gfni_avx512,function,internal)
asm_ZucGenKeystream4B_16_gfni_avx512:
endbranch64
KEYGEN_16_AVX512 1, 1, arg3
ret
;;
;; void asm_ZucGenKeystream_16_avx512(state16_t *pSta, u32* pKeyStr[16], u64 numRounds)
;;
MKGLOBAL(asm_ZucGenKeystream_16_avx512,function,internal)
asm_ZucGenKeystream_16_avx512:
endbranch64
KEYGEN_16_AVX512 arg3, 0
ret
;;
;; void asm_ZucGenKeystream_16_gfni_avx512(state16_t *pSta, u32* pKeyStr[16], u64 numRounds)
;;
MKGLOBAL(asm_ZucGenKeystream_16_gfni_avx512,function,internal)
asm_ZucGenKeystream_16_gfni_avx512:
endbranch64
KEYGEN_16_AVX512 arg3, 1
ret
%macro CIPHER64B 6
%define %%NROUNDS %1
%define %%BYTE_MASK %2
%define %%LANE_MASK %3
%define %%USE_GFNI %4
%define %%OFFSET %5
%define %%LAST_ROUND %6
; Generate N*4B of keystream in N rounds
%assign N 1
%assign idx 16
%rep %%NROUNDS
bits_reorg16 rax, N, %%LANE_MASK, working, none, none, none, APPEND(zmm, idx)
nonlin_fun16 rax, %%LANE_MASK, %%USE_GFNI, working, none, none, none, none, none, zmm0
; OFS_X3 XOR W (zmm0)
vpxorq APPEND(zmm, idx), zmm0
vpxorq zmm0, zmm0
lfsr_updt16 rax, N, %%LANE_MASK, zmm0 ; W (zmm0) used in LFSR update - not set to zero
%assign N (N + 1)
%assign idx (idx + 1)
%endrep
;; Shuffle all 16 keystreams in registers zmm16-31
%assign i 16
%rep %%NROUNDS
vpshufb zmm %+i, [rel swap_mask]
%assign i (i+1)
%endrep
; ZMM16-31 contain the keystreams for each round
; Perform a 32-bit 16x16 transpose to have the 64 bytes
; of each lane in a different register
TRANSPOSE16_U32 zmm16, zmm17, zmm18, zmm19, zmm20, zmm21, zmm22, zmm23, \
zmm24, zmm25, zmm26, zmm27, zmm28, zmm29, zmm30, zmm31, \
zmm0, zmm1, zmm2, zmm3, zmm4, zmm5, zmm6, zmm7, \
zmm8, zmm9, zmm10, zmm11, zmm12, zmm13
;; XOR Input buffer with keystream
%if %%LAST_ROUND == 1
lea rbx, [rel byte64_len_to_mask_table]
%endif
;; Read all 16 streams using registers r12-15 into registers zmm0-15
%assign i 0
%assign j 0
%assign k 12
%rep 16
%if %%LAST_ROUND == 1
;; Read number of bytes left to encrypt for the lane stored in stack
;; and construct byte mask to read from input pointer
movzx r12d, word [rsp + j*2]
kmovq %%BYTE_MASK, [rbx + r12*8]
%endif
mov APPEND(r, k), [pIn + i]
vmovdqu8 APPEND(zmm, j){%%BYTE_MASK}{z}, [APPEND(r, k) + %%OFFSET]
%assign k 12 + ((j + 1) % 4)
%assign j (j + 1)
%assign i (i + 8)
%endrep
;; XOR Input (zmm0-15) with Keystreams (zmm16-31)
%assign i 0
%assign j 16
%rep 16
vpxorq zmm %+j, zmm %+i
%assign i (i + 1)
%assign j (j + 1)
%endrep
;; Write output for all 16 buffers (zmm16-31) using registers r12-15
%assign i 0
%assign j 16
%assign k 12
%rep 16
%if %%LAST_ROUND == 1
;; Read length to encrypt for the lane stored in stack
;; and construct byte mask to write to output pointer
movzx r12d, word [rsp + (j-16)*2]
kmovq %%BYTE_MASK, [rbx + r12*8]
%endif
mov APPEND(r, k), [pOut + i]
vmovdqu8 [APPEND(r, k) + %%OFFSET]{%%BYTE_MASK}, APPEND(zmm, j)
%assign k 12 + ((j + 1) % 4)
%assign j (j + 1)
%assign i (i + 8)
%endrep
%endmacro
%macro CIPHER_16_AVX512 1
%define %%USE_GFNI %1 ; [in] If 1, then GFNI instructions may be used
%ifdef LINUX
%define pState rdi
%define pIn rsi
%define pOut rdx
%define lengths rcx
%define arg5 r8
%else
%define pState rcx
%define pIn rdx
%define pOut r8
%define lengths r9
%define arg5 [rsp + 40]
%endif
%define min_length r10
%define buf_idx r11
mov min_length, arg5
FUNC_SAVE
; Convert all lengths set to UINT16_MAX (indicating that lane is not valid) to min length
vpbroadcastw ymm0, min_length
vmovdqa ymm1, [lengths]
vpcmpw k1, ymm1, [rel all_ffs], 0
vmovdqu16 ymm1{k1}, ymm0 ; YMM1 contain updated lengths
; Round up to nearest multiple of 4 bytes
vpaddw ymm0, [rel all_threes]
vpandq ymm0, [rel all_fffcs]
; Calculate remaining bytes to encrypt after function call
vpsubw ymm2, ymm1, ymm0
vpxorq ymm3, ymm3
vpcmpw k1, ymm2, ymm3, 1 ; Get mask of lengths < 0
; Set to zero the lengths of the lanes which are going to be completed
vmovdqu16 ymm2{k1}, ymm3 ; YMM2 contain final lengths
vmovdqa [lengths], ymm2 ; Update in memory the final updated lengths
; Calculate number of bytes to encrypt after round of 64 bytes (up to 63 bytes),
; for each lane, and store it in stack to be used in the last round
vpsubw ymm1, ymm2 ; Bytes to encrypt in all lanes
vpandq ymm1, [rel all_3fs] ; Number of final bytes (up to 63 bytes) for each lane
sub rsp, 32
vmovdqu [rsp], ymm1
; Load state pointer in RAX
mov rax, pState
; Load read-only registers
mov r12d, 0xAAAAAAAA
kmovd k1, r12d
mov r12, 0xFFFFFFFFFFFFFFFF
kmovq k2, r12
mov r12d, 0x0000FFFF
kmovd k3, r12d
xor buf_idx, buf_idx
;; Perform rounds of 64 bytes, where LFSR reordering is not needed
%%loop:
cmp min_length, 64
jl %%exit_loop
vmovdqa64 zmm12, [rel mask31]
CIPHER64B 16, k2, k3, %%USE_GFNI, buf_idx, 0
sub min_length, 64
add buf_idx, 64
jmp %%loop
%%exit_loop:
mov r15, min_length
add r15, 3
shr r15, 2 ;; numbers of rounds left (round up length to nearest multiple of 4B)
jz %%_no_final_rounds
vmovdqa64 zmm12, [rel mask31]
cmp r15, 8
je %%_num_final_rounds_is_8
jl %%_final_rounds_is_1_7
; Final blocks 9-16
cmp r15, 12
je %%_num_final_rounds_is_12
jl %%_final_rounds_is_9_11
; Final blocks 13-16
cmp r15, 16
je %%_num_final_rounds_is_16
cmp r15, 15
je %%_num_final_rounds_is_15
cmp r15, 14
je %%_num_final_rounds_is_14
cmp r15, 13
je %%_num_final_rounds_is_13
%%_final_rounds_is_9_11:
cmp r15, 11
je %%_num_final_rounds_is_11
cmp r15, 10
je %%_num_final_rounds_is_10
cmp r15, 9
je %%_num_final_rounds_is_9
%%_final_rounds_is_1_7:
cmp r15, 4
je %%_num_final_rounds_is_4
jl %%_final_rounds_is_1_3
; Final blocks 5-7
cmp r15, 7
je %%_num_final_rounds_is_7
cmp r15, 6
je %%_num_final_rounds_is_6
cmp r15, 5
je %%_num_final_rounds_is_5
%%_final_rounds_is_1_3:
cmp r15, 3
je %%_num_final_rounds_is_3
cmp r15, 2
je %%_num_final_rounds_is_2
jmp %%_num_final_rounds_is_1
; Perform encryption of last bytes (<= 64 bytes) and reorder LFSR registers
; if needed (if not all 16 rounds of 4 bytes are done)
%assign I 1
%rep 16
APPEND(%%_num_final_rounds_is_,I):
CIPHER64B I, k2, k3, %%USE_GFNI, buf_idx, 1
REORDER_LFSR rax, I, k3
add buf_idx, min_length
jmp %%_no_final_rounds
%assign I (I + 1)
%endrep
%%_no_final_rounds:
add rsp, 32
;; update in/out pointers
add buf_idx, 3
and buf_idx, 0xfffffffffffffffc
vpbroadcastq zmm0, buf_idx
vpaddq zmm1, zmm0, [pIn]
vpaddq zmm2, zmm0, [pIn + 64]
vmovdqa64 [pIn], zmm1
vmovdqa64 [pIn + 64], zmm2
vpaddq zmm1, zmm0, [pOut]
vpaddq zmm2, zmm0, [pOut + 64]
vmovdqa64 [pOut], zmm1
vmovdqa64 [pOut + 64], zmm2
FUNC_RESTORE
%endmacro
;;
;; void asm_ZucCipher_16_avx512(state16_t *pSta, u64 *pIn[16],
;; u64 *pOut[16], u16 lengths[16],
;; u64 min_length);
MKGLOBAL(asm_ZucCipher_16_avx512,function,internal)
asm_ZucCipher_16_avx512:
endbranch64
CIPHER_16_AVX512 0
ret
;;
;; void asm_ZucCipher_16_gfni_avx512(state16_t *pSta, u64 *pIn[16],
;; u64 *pOut[16], u16 lengths[16],
;; u64 min_length);
MKGLOBAL(asm_ZucCipher_16_gfni_avx512,function,internal)
asm_ZucCipher_16_gfni_avx512:
endbranch64
CIPHER_16_AVX512 1
ret
;;
;;extern void asm_Eia3Round64B_16_VPCLMUL(uint32_t *T, const void **KS, const void **DATA,
;; uint16_t *LEN)
;;
;; Updates authentication tag T of 16 buffers based on keystream KS and DATA.
;; - it processes 64 bytes of DATA
;; - reads data in 16 byte chunks and bit reverses them
;; - reads and re-arranges KS
;; - employs clmul for the XOR & ROL part
;; - copies top 64 bytes of KS to bottom (for the next round)
;; - Updates Data pointers for next rounds
;; - Updates array of lengths
;;
;; WIN64
;; RCX - T: Array of digests for all 16 buffers
;; RDX - KS: Array of pointers to key stream (2 x 64 bytes) for all 16 buffers
;; R8 - DATA: Array of pointers to data for all 16 buffers
;; R9 - LEN: Array of lengths for all 16 buffers
;; LIN64
;; RDI - T: Array of digests for all 16 buffers
;; RSI - KS: Array of pointers to key stream (2 x 64 bytes) for all 16 buffers
;; RDX - DATA: Array of pointers to data for all 16 buffers
;; RCX - LEN: Array of lengths for all 16 buffers
;;
align 64
MKGLOBAL(asm_Eia3Round64B_16_VPCLMUL,function,internal)
asm_Eia3Round64B_16_VPCLMUL:
endbranch64
%ifdef LINUX
%define T rdi
%define KS rsi
%define DATA rdx
%define LEN rcx
%else
%define T rcx
%define KS rdx
%define DATA r8
%define LEN r9
%endif
%define DATA_ADDR0 rbx
%define DATA_ADDR1 r10
%define DATA_ADDR2 r11
%define DATA_ADDR3 r12
%define KS_ADDR0 r13
%define KS_ADDR1 r14
%define KS_ADDR2 r15
%define KS_ADDR3 rax
%define DATA_TRANS0 zmm16
%define DATA_TRANS1 zmm17
%define DATA_TRANS2 zmm18
%define DATA_TRANS3 zmm19
%define KS_TRANS0 zmm20
%define KS_TRANS1 zmm21
%define KS_TRANS2 zmm22
%define KS_TRANS3 zmm23
%define DIGEST_0 zmm28
%define DIGEST_1 zmm29
%define DIGEST_2 zmm30
%define DIGEST_3 zmm31
FUNC_SAVE
vmovdqa64 zmm5, [rel bit_reverse_table_l]
vmovdqa64 zmm6, [rel bit_reverse_table_h]
vmovdqa64 zmm7, [rel bit_reverse_and_table]
vmovdqa64 zmm10, [rel data_mask_64bits]
%assign IDX 0
%rep 4
vpxorq APPEND(DIGEST_, IDX), APPEND(DIGEST_, IDX)
mov DATA_ADDR0, [DATA + IDX*32 + 0*8]
mov DATA_ADDR1, [DATA + IDX*32 + 1*8]
mov DATA_ADDR2, [DATA + IDX*32 + 2*8]
mov DATA_ADDR3, [DATA + IDX*32 + 3*8]
TRANSPOSE4_U128 DATA_ADDR0, DATA_ADDR1, DATA_ADDR2, DATA_ADDR3, \
DATA_TRANS0, DATA_TRANS1, DATA_TRANS2, DATA_TRANS3, \
zmm24, zmm25, zmm26, zmm27
mov KS_ADDR0, [KS + IDX*32 + 0*8]
mov KS_ADDR1, [KS + IDX*32 + 1*8]
mov KS_ADDR2, [KS + IDX*32 + 2*8]
mov KS_ADDR3, [KS + IDX*32 + 3*8]
TRANSPOSE4_U128 KS_ADDR0, KS_ADDR1, KS_ADDR2, KS_ADDR3, \
KS_TRANS0, KS_TRANS1, KS_TRANS2, KS_TRANS3, \
zmm24, zmm25, zmm26, zmm27
%assign I 0
%assign J 1
%rep 4
;; Reverse bits of next 16 bytes from all 4 buffers
vpandq zmm1, APPEND(DATA_TRANS,I), zmm7
vpandnq zmm2, zmm7, APPEND(DATA_TRANS, I)
vpsrld zmm2, 4
vpshufb zmm8, zmm6, zmm1 ; bit reverse low nibbles (use high table)
vpshufb zmm4, zmm5, zmm2 ; bit reverse high nibbles (use low table)
vporq zmm8, zmm4
; zmm8 - bit reversed data bytes
;; ZUC authentication part
;; - 4x32 data bits
;; - set up KS
vmovdqa64 zmm11, APPEND(KS_TRANS, I)
%if I != 3
vmovdqa64 zmm12, APPEND(KS_TRANS, J)
%else
; Bytes 64-79 from the keystreams that were not loaded yet
vmovdqu xmm12, [KS_ADDR0 + 64]
vinserti32x4 zmm12, [KS_ADDR1 + 64], 1
vinserti32x4 zmm12, [KS_ADDR2 + 64], 2
vinserti32x4 zmm12, [KS_ADDR3 + 64], 3
%endif
vpalignr zmm13, zmm12, zmm11, 8
vpshufd zmm2, zmm11, 0x61
vpshufd zmm3, zmm13, 0x61
;; - set up DATA
vpandq zmm13, zmm10, zmm8
vpshufd APPEND(DATA_TRANS, I), zmm13, 0xdc
vpsrldq zmm8, 8
vpshufd zmm1, zmm8, 0xdc
;; - clmul
;; - xor the results from 4 32-bit words together
vpclmulqdq zmm13, APPEND(DATA_TRANS, I), zmm2, 0x00
vpclmulqdq zmm14, APPEND(DATA_TRANS, I), zmm2, 0x11
vpclmulqdq zmm15, zmm1, zmm3, 0x00
vpclmulqdq zmm8, zmm1, zmm3, 0x11
vpternlogq zmm13, zmm14, zmm8, 0x96
vpternlogq APPEND(DIGEST_, IDX), zmm13, zmm15, 0x96
%assign J (J + 1)
%assign I (I + 1)
%endrep
; Memcpy KS 64-127 bytes to 0-63 bytes
vmovdqu64 zmm0, [KS_ADDR0 + 64]
vmovdqu64 zmm1, [KS_ADDR1 + 64]
vmovdqu64 zmm2, [KS_ADDR2 + 64]
vmovdqu64 zmm3, [KS_ADDR3 + 64]
vmovdqu64 [KS_ADDR0], zmm0
vmovdqu64 [KS_ADDR1], zmm1
vmovdqu64 [KS_ADDR2], zmm2
vmovdqu64 [KS_ADDR3], zmm3
%assign IDX (IDX + 1)
%endrep
;; - update tags
mov r12, 0x00FF
mov r13, 0xFF00
kmovq k1, r12
kmovq k2, r13
vmovdqu64 zmm4, [T] ; Input tags
vmovdqa64 zmm0, [rel shuf_mask_tags]
vmovdqa64 zmm1, [rel shuf_mask_tags + 64]
; Get result tags for 16 buffers in different position in each lane
; and blend these tags into an ZMM register.
; Then, XOR the results with the previous tags and write out the result.
vpermt2d DIGEST_0{k1}{z}, zmm0, DIGEST_1
vpermt2d DIGEST_2{k2}{z}, zmm1, DIGEST_3
vpternlogq zmm4, DIGEST_0, DIGEST_2, 0x96 ; A XOR B XOR C
vmovdqu64 [T], zmm4
; Update data pointers
vmovdqu64 zmm0, [DATA]
vmovdqu64 zmm1, [DATA + 64]
vpaddq zmm0, [rel add_64]
vpaddq zmm1, [rel add_64]
vmovdqu64 [DATA], zmm0
vmovdqu64 [DATA + 64], zmm1
; Update array of lengths (subtract 512 bits from all lengths if valid lane)
vmovdqa ymm2, [LEN]
vpcmpw k1, ymm2, [rel all_ffs], 4
vpsubw ymm2{k1}, [rel all_512w]
vmovdqa [LEN], ymm2
FUNC_RESTORE
ret
;;
;; extern void asm_Eia3RemainderAVX512(uint32_t *T, const void *ks,
;; const void *data, uint64_t n_bits)
;;
;; Returns authentication update value to be XOR'ed with current authentication tag
;;
;; WIN64
;; RCX - T (digest pointer)
;; RDX - KS (key stream pointer)
;; R8 - DATA (data pointer)
;; R9 - N_BITS (number data bits to process)
;; LIN64
;; RDI - T (digest pointer)
;; RSI - KS (key stream pointer)
;; RDX - DATA (data pointer)
;; RCX - N_BITS (number data bits to process)
;;
align 64
MKGLOBAL(asm_Eia3RemainderAVX512,function,internal)
asm_Eia3RemainderAVX512:
endbranch64
%ifdef LINUX
%define T rdi
%define KS rsi
%define DATA rdx
%define N_BITS rcx
%else
%define T rcx
%define KS rdx
%define DATA r8
%define N_BITS r9
%endif
%define N_BYTES rbx
%define OFFSET r15
FUNC_SAVE
vmovdqa xmm5, [bit_reverse_table_l]
vmovdqa xmm6, [bit_reverse_table_h]
vmovdqa xmm7, [bit_reverse_and_table]
vmovdqa xmm10, [data_mask_64bits]
vpxor xmm9, xmm9
xor OFFSET, OFFSET
%assign I 0
%rep 3
cmp N_BITS, 128
jb Eia3RoundsAVX512_dq_end
;; read 16 bytes and reverse bits
vmovdqu xmm0, [DATA + OFFSET]
vpand xmm1, xmm0, xmm7
vpandn xmm2, xmm7, xmm0
vpsrld xmm2, 4
vpshufb xmm8, xmm6, xmm1 ; bit reverse low nibbles (use high table)
vpshufb xmm4, xmm5, xmm2 ; bit reverse high nibbles (use low table)
vpor xmm8, xmm4
; xmm8 - bit reversed data bytes
;; ZUC authentication part
;; - 4x32 data bits
;; - set up KS
%if I != 0
vmovdqa xmm11, xmm12
vmovdqu xmm12, [KS + OFFSET + (4*4)]
%else
vmovdqu xmm11, [KS + (0*4)]
vmovdqu xmm12, [KS + (4*4)]
%endif
vpalignr xmm13, xmm12, xmm11, 8
vpshufd xmm2, xmm11, 0x61
vpshufd xmm3, xmm13, 0x61
;; - set up DATA
vpand xmm13, xmm10, xmm8
vpshufd xmm0, xmm13, 0xdc
vpsrldq xmm8, 8
vpshufd xmm1, xmm8, 0xdc
;; - clmul
;; - xor the results from 4 32-bit words together
vpclmulqdq xmm13, xmm0, xmm2, 0x00
vpclmulqdq xmm14, xmm0, xmm2, 0x11
vpclmulqdq xmm15, xmm1, xmm3, 0x00
vpclmulqdq xmm8, xmm1, xmm3, 0x11
vpternlogq xmm13, xmm14, xmm8, 0x96
vpternlogq xmm9, xmm13, xmm15, 0x96
add OFFSET, 16
sub N_BITS, 128
%assign I (I + 1)
%endrep
Eia3RoundsAVX512_dq_end:
or N_BITS, N_BITS
jz Eia3RoundsAVX_end
; Get number of bytes
mov N_BYTES, N_BITS
add N_BYTES, 7
shr N_BYTES, 3
lea r10, [rel byte64_len_to_mask_table]
kmovq k1, [r10 + N_BYTES*8]
;; Set up KS
vmovdqu xmm1, [KS + OFFSET]
vmovdqu xmm2, [KS + OFFSET + 16]
vpalignr xmm13, xmm2, xmm1, 8
vpshufd xmm11, xmm1, 0x61
vpshufd xmm12, xmm13, 0x61
;; read up to 16 bytes of data, zero bits not needed if partial byte and bit-reverse
vmovdqu8 xmm0{k1}{z}, [DATA + OFFSET]
; check if there is a partial byte (less than 8 bits in last byte)
mov rax, N_BITS
and rax, 0x7
shl rax, 4
lea r10, [rel bit_mask_table]
add r10, rax
; Get mask to clear last bits
vmovdqa xmm3, [r10]
; Shift left 16-N bytes to have the last byte always at the end of the XMM register
; to apply mask, then restore by shifting right same amount of bytes
mov r10, 16
sub r10, N_BYTES
XVPSLLB xmm0, r10, xmm4, r11
vpandq xmm0, xmm3
XVPSRLB xmm0, r10, xmm4, r11
; Bit reverse input data
vpand xmm1, xmm0, xmm7
vpandn xmm2, xmm7, xmm0
vpsrld xmm2, 4
vpshufb xmm8, xmm6, xmm1 ; bit reverse low nibbles (use high table)
vpshufb xmm3, xmm5, xmm2 ; bit reverse high nibbles (use low table)
vpor xmm8, xmm3
;; Set up DATA
vpand xmm13, xmm10, xmm8
vpshufd xmm0, xmm13, 0xdc ; D 0-3 || Os || D 4-7 || 0s
vpsrldq xmm8, 8
vpshufd xmm1, xmm8, 0xdc ; D 8-11 || 0s || D 12-15 || 0s
;; - clmul
;; - xor the results from 4 32-bit words together
vpclmulqdq xmm13, xmm0, xmm11, 0x00
vpclmulqdq xmm14, xmm0, xmm11, 0x11
vpclmulqdq xmm15, xmm1, xmm12, 0x00
vpclmulqdq xmm8, xmm1, xmm12, 0x11
vpternlogq xmm9, xmm14, xmm13, 0x96
vpternlogq xmm9, xmm15, xmm8, 0x96
Eia3RoundsAVX_end:
mov r11d, [T]
vmovq rax, xmm9
shr rax, 32
xor eax, r11d
; Read keyStr[N_BITS / 32]
lea r10, [N_BITS + OFFSET*8] ; Restore original N_BITS
shr r10, 5
mov r11, [KS + r10*4]
; Rotate left by N_BITS % 32
mov r12, rcx ; Save RCX
mov rcx, N_BITS
and rcx, 0x1F
rol r11, cl
mov rcx, r12 ; Restore RCX
; XOR with previous digest calculation
xor eax, r11d
; Read keyStr[L - 1] (last double word of keyStr)
lea r10, [N_BITS + OFFSET*8] ; Restore original N_BITS
add r10, (31 + 64)
shr r10, 5 ; L
dec r10
mov r11d, [KS + r10 * 4]
; XOR with previous digest calculation and bswap it
xor eax, r11d
bswap eax
mov [T], eax
FUNC_RESTORE
ret
%macro REMAINDER_16 1
%define %%KEY_SIZE %1 ; [constant] Key size (128 or 256)
%ifdef LINUX
%define T rdi
%define KS rsi
%define DATA rdx
%define LEN rcx
%define arg5 r8
%else
%define T rcx
%define KS rdx
%define DATA r8
%define LEN r9
%define arg5 [rsp + 40]
%endif
%define DIGEST_0 zmm28
%define DIGEST_1 zmm29
%define DIGEST_2 zmm30
%define DIGEST_3 zmm31
%define DATA_ADDR r12
%define KS_ADDR r13
%define N_BYTES r14
%define OFFSET r15
%define MIN_LEN r10
%define IDX rax
mov MIN_LEN, arg5
FUNC_SAVE
vpbroadcastw ymm0, MIN_LEN
; Get mask of non-NULL lanes (lengths not set to UINT16_MAX, indicating that lane is not valid)
vmovdqa ymm1, [LEN]
vpcmpw k1, ymm1, [rel all_ffs], 4
; Round up to nearest multiple of 32 bits
vpaddw ymm0{k1}, [rel all_31w]
vpandq ymm0, [rel all_ffe0w]
; Calculate remaining bits to authenticate after function call
vpsubw ymm2{k1}, ymm1, ymm0
vpxorq ymm3, ymm3
vpcmpw k2, ymm2, ymm3, 1 ; Get mask of lengths < 0
; Set to zero the lengths of the lanes which are going to be completed
vmovdqu16 ymm2{k2}, ymm3 ; YMM2 contain final lengths
vmovdqu16 [LEN]{k1}, ymm2 ; Update in memory the final updated lengths
; Calculate number of bits to authenticate (up to 511 bits),
; for each lane, and store it in stack to be used later
vpsubw ymm1{k1}{z}, ymm2 ; Bits to authenticate in all lanes (zero out length of NULL lanes)
sub rsp, 32
vmovdqu [rsp], ymm1
xor OFFSET, OFFSET
vmovdqa xmm5, [bit_reverse_table_l]
vmovdqa xmm6, [bit_reverse_table_h]
vmovdqa xmm7, [bit_reverse_and_table]
vmovdqa xmm10, [data_mask_64bits]
%assign I 0
%rep 4
%assign J 0
%rep 4
; Read length to authenticate for each buffer
movzx MIN_LEN, word [rsp + 2*(I*4 + J)]
vpxor xmm9, xmm9
xor OFFSET, OFFSET
mov DATA_ADDR, [DATA + 8*(I*4 + J)]
mov KS_ADDR, [KS + 8*(I*4 + J)]
%assign K 0
%rep 4
cmp MIN_LEN, 128
jb APPEND3(%%Eia3RoundsAVX512_dq_end,I,J)
;; read 16 bytes and reverse bits
vmovdqu xmm0, [DATA_ADDR + OFFSET]
vpand xmm1, xmm0, xmm7
vpandn xmm2, xmm7, xmm0
vpsrld xmm2, 4
vpshufb xmm8, xmm6, xmm1 ; bit reverse low nibbles (use high table)
vpshufb xmm4, xmm5, xmm2 ; bit reverse high nibbles (use low table)
vpor xmm8, xmm4
; xmm8 - bit reversed data bytes
;; ZUC authentication part
;; - 4x32 data bits
;; - set up KS
%if K != 0
vmovdqa xmm11, xmm12
vmovdqu xmm12, [KS_ADDR + OFFSET + (4*4)]
%else
vmovdqu xmm11, [KS_ADDR + (0*4)]
vmovdqu xmm12, [KS_ADDR + (4*4)]
%endif
vpalignr xmm13, xmm12, xmm11, 8
vpshufd xmm2, xmm11, 0x61
vpshufd xmm3, xmm13, 0x61
;; - set up DATA
vpand xmm13, xmm10, xmm8
vpshufd xmm0, xmm13, 0xdc
vpsrldq xmm8, 8
vpshufd xmm1, xmm8, 0xdc
;; - clmul
;; - xor the results from 4 32-bit words together
vpclmulqdq xmm13, xmm0, xmm2, 0x00
vpclmulqdq xmm14, xmm0, xmm2, 0x11
vpclmulqdq xmm15, xmm1, xmm3, 0x00
vpclmulqdq xmm8, xmm1, xmm3, 0x11
vpternlogq xmm13, xmm14, xmm8, 0x96
vpternlogq xmm9, xmm13, xmm15, 0x96
add OFFSET, 16
sub MIN_LEN, 128
%assign K (K + 1)
%endrep
APPEND3(%%Eia3RoundsAVX512_dq_end,I,J):
or MIN_LEN, MIN_LEN
jz APPEND3(%%Eia3RoundsAVX_end,I,J)
; Get number of bytes
mov N_BYTES, MIN_LEN
add N_BYTES, 7
shr N_BYTES, 3
lea r11, [rel byte64_len_to_mask_table]
kmovq k1, [r11 + N_BYTES*8]
;; Set up KS
vmovdqu xmm1, [KS_ADDR + OFFSET]
vmovdqu xmm2, [KS_ADDR + OFFSET + 16]
vpalignr xmm13, xmm2, xmm1, 8
vpshufd xmm11, xmm1, 0x61
vpshufd xmm12, xmm13, 0x61
;; read up to 16 bytes of data, zero bits not needed if partial byte and bit-reverse
vmovdqu8 xmm0{k1}{z}, [DATA_ADDR + OFFSET]
; check if there is a partial byte (less than 8 bits in last byte)
mov rax, MIN_LEN
and rax, 0x7
shl rax, 4
lea r11, [rel bit_mask_table]
add r11, rax
; Get mask to clear last bits
vmovdqa xmm3, [r11]
; Shift left 16-N bytes to have the last byte always at the end of the XMM register
; to apply mask, then restore by shifting right same amount of bytes
mov r11, 16
sub r11, N_BYTES
; r13 = DATA_ADDR can be used at this stage
XVPSLLB xmm0, r11, xmm4, r13
vpandq xmm0, xmm3
XVPSRLB xmm0, r11, xmm4, r13
; Bit reverse input data
vpand xmm1, xmm0, xmm7
vpandn xmm2, xmm7, xmm0
vpsrld xmm2, 4
vpshufb xmm8, xmm6, xmm1 ; bit reverse low nibbles (use high table)
vpshufb xmm3, xmm5, xmm2 ; bit reverse high nibbles (use low table)
vpor xmm8, xmm3
;; Set up DATA
vpand xmm13, xmm10, xmm8
vpshufd xmm0, xmm13, 0xdc ; D 0-3 || Os || D 4-7 || 0s
vpsrldq xmm8, 8
vpshufd xmm1, xmm8, 0xdc ; D 8-11 || 0s || D 12-15 || 0s
;; - clmul
;; - xor the results from 4 32-bit words together
vpclmulqdq xmm13, xmm0, xmm11, 0x00
vpclmulqdq xmm14, xmm0, xmm11, 0x11
vpclmulqdq xmm15, xmm1, xmm12, 0x00
vpclmulqdq xmm8, xmm1, xmm12, 0x11
vpternlogq xmm9, xmm14, xmm13, 0x96
vpternlogq xmm9, xmm15, xmm8, 0x96
APPEND3(%%Eia3RoundsAVX_end,I,J):
vinserti32x4 APPEND(DIGEST_, I), xmm9, J
%assign J (J + 1)
%endrep
%assign I (I + 1)
%endrep
;; - update tags
mov rbx, 0x00FF
mov r10, 0xFF00
kmovq k1, rbx
kmovq k2, r10
vmovdqu64 zmm4, [T] ; Input tags
vmovdqa64 zmm0, [rel shuf_mask_tags]
vmovdqa64 zmm1, [rel shuf_mask_tags + 64]
; Get result tags for 16 buffers in different position in each lane
; and blend these tags into an ZMM register.
; Then, XOR the results with the previous tags and write out the result.
vpermt2d DIGEST_0{k1}{z}, zmm0, DIGEST_1
vpermt2d DIGEST_2{k2}{z}, zmm1, DIGEST_3
vpternlogq zmm4, DIGEST_0, DIGEST_2, 0x96 ; A XOR B XOR C
vmovdqa64 [T], zmm4 ; Store temporary digests
; These last steps should be done only for the buffers that
; have no more data to authenticate
xor IDX, IDX
%%start_loop:
; Update data pointer
movzx ebx, word [rsp + IDX*2]
shr ebx, 3 ; length authenticated in bytes
add [DATA + IDX*8], rbx
cmp word [LEN + 2*IDX], 0
jnz %%skip_comput
; Read digest
mov ebx, [T + 4*IDX]
mov KS_ADDR, [KS + IDX*8]
; Read keyStr[MIN_LEN / 32]
movzx MIN_LEN, word [rsp + 2*IDX]
mov r15, MIN_LEN
shr r15, 5
mov r11, [KS_ADDR +r15*4]
; Rotate left by MIN_LEN % 32
mov r15, rcx
mov rcx, MIN_LEN
and rcx, 0x1F
rol r11, cl
mov rcx, r15
; XOR with current digest
xor ebx, r11d
%if %%KEY_SIZE == 128
; Read keystr[L - 1] (last dword of keyStr)
add MIN_LEN, (31 + 64)
shr MIN_LEN, 5 ; L
dec MIN_LEN
mov r11d, [KS_ADDR + MIN_LEN * 4]
; XOR with current digest
xor ebx, r11d
%endif
; byte swap and write digest out
bswap ebx
mov [T + 4*IDX], ebx
%%skip_comput:
inc IDX
cmp IDX, 16
jne %%start_loop
add rsp, 32
vzeroupper
FUNC_RESTORE
ret
%endmacro
;;
;; extern void asm_Eia3RemainderAVX512_16(uint32_t *T, const void **ks, const void **data, uint64_t n_bits)
;;
;; WIN64
;; RCX - T: Array of digests for all 16 buffers
;; RDX - KS : Array of pointers to key stream for all 16 buffers
;; R8 - DATA : Array of pointers to data for all 16 buffers
;; R9 - N_BITS (number data bits to process)
;; LIN64
;; RDI - T: Array of digests for all 16 buffers
;; RSI - KS : Array of pointers to key stream for all 16 buffers
;; RDX - DATA : Array of pointers to data for all 16 buffers
;; RCX - N_BITS (number data bits to process)
;;
align 64
MKGLOBAL(asm_Eia3RemainderAVX512_16,function,internal)
asm_Eia3RemainderAVX512_16:
endbranch64
REMAINDER_16 128
;;
;; extern void asm_Eia3_256_RemainderAVX512_16(uint32_t *T, const void **ks, const void **data, uint64_t n_bits)
;;
;; WIN64
;; RCX - T: Array of digests for all 16 buffers
;; RDX - KS : Array of pointers to key stream for all 16 buffers
;; R8 - DATA : Array of pointers to data for all 16 buffers
;; R9 - N_BITS (number data bits to process)
;; LIN64
;; RDI - T: Array of digests for all 16 buffers
;; RSI - KS : Array of pointers to key stream for all 16 buffers
;; RDX - DATA : Array of pointers to data for all 16 buffers
;; RCX - N_BITS (number data bits to process)
;;
align 64
MKGLOBAL(asm_Eia3_256_RemainderAVX512_16,function,internal)
asm_Eia3_256_RemainderAVX512_16:
endbranch64
REMAINDER_16 256
;;
;;extern void asm_Eia3Round64BAVX512(uint32_t *T, const void *KS, const void *DATA)
;;
;; Updates authentication tag T based on keystream KS and DATA.
;; - it processes 64 bytes of DATA
;; - reads data in 16 byte chunks and bit reverses them
;; - reads and re-arranges KS
;; - employs clmul for the XOR & ROL part
;;
;; WIN64
;; RCX - T pointer to digest
;; RDX - KS pointer to key stream (2 x 64 bytes)
;;; R8 - DATA pointer to data
;; LIN64
;; RDI - T pointer to digest
;; RSI - KS pointer to key stream (2 x 64 bytes)
;; RDX - DATA pointer to data
;;
align 64
MKGLOBAL(asm_Eia3Round64BAVX512,function,internal)
asm_Eia3Round64BAVX512:
endbranch64
%ifdef LINUX
%define T rdi
%define KS rsi
%define DATA rdx
%else
%define T rcx
%define KS rdx
%define DATA r8
%endif
FUNC_SAVE
vmovdqa xmm5, [bit_reverse_table_l]
vmovdqa xmm6, [bit_reverse_table_h]
vmovdqa xmm7, [bit_reverse_and_table]
vmovdqa xmm10, [data_mask_64bits]
vpxor xmm9, xmm9
%assign I 0
%rep 4
;; read 16 bytes and reverse bits
vmovdqu xmm0, [DATA + 16*I]
vpand xmm1, xmm0, xmm7
vpandn xmm2, xmm7, xmm0
vpsrld xmm2, 4
vpshufb xmm8, xmm6, xmm1 ; bit reverse low nibbles (use high table)
vpshufb xmm4, xmm5, xmm2 ; bit reverse high nibbles (use low table)
vpor xmm8, xmm4
; xmm8 - bit reversed data bytes
;; ZUC authentication part
;; - 4x32 data bits
;; - set up KS
%if I != 0
vmovdqa xmm11, xmm12
vmovdqu xmm12, [KS + (I*16) + (4*4)]
%else
vmovdqu xmm11, [KS + (I*16) + (0*4)]
vmovdqu xmm12, [KS + (I*16) + (4*4)]
%endif
vpalignr xmm13, xmm12, xmm11, 8
vpshufd xmm2, xmm11, 0x61
vpshufd xmm3, xmm13, 0x61
;; - set up DATA
vpand xmm13, xmm10, xmm8
vpshufd xmm0, xmm13, 0xdc
vpsrldq xmm8, 8
vpshufd xmm1, xmm8, 0xdc
;; - clmul
;; - xor the results from 4 32-bit words together
vpclmulqdq xmm13, xmm0, xmm2, 0x00
vpclmulqdq xmm14, xmm0, xmm2, 0x11
vpclmulqdq xmm15, xmm1, xmm3, 0x00
vpclmulqdq xmm8, xmm1, xmm3, 0x11
vpternlogq xmm13, xmm14, xmm8, 0x96
vpternlogq xmm9, xmm13, xmm15, 0x96
%assign I (I + 1)
%endrep
;; - update T
vmovq rax, xmm9
shr rax, 32
mov r10d, [T]
xor eax, r10d
mov [T], eax
FUNC_RESTORE
ret
align 64
MKGLOBAL(asm_Eia3Round64BAVX512_16,function,internal)
asm_Eia3Round64BAVX512_16:
endbranch64
%ifdef LINUX
%define T rdi
%define KS rsi
%define DATA rdx
%define LEN rcx
%else
%define T rcx
%define KS rdx
%define DATA r8
%define LEN r9
%endif
%define DIGEST_0 zmm28
%define DIGEST_1 zmm29
%define DIGEST_2 zmm30
%define DIGEST_3 zmm31
%define DATA_ADDR r10
%define KS_ADDR r11
FUNC_SAVE
vmovdqa xmm5, [bit_reverse_table_l]
vmovdqa xmm6, [bit_reverse_table_h]
vmovdqa xmm7, [bit_reverse_and_table]
vmovdqa xmm10, [data_mask_64bits]
%assign I 0
%rep 4
%assign J 0
%rep 4
vpxor xmm9, xmm9
mov DATA_ADDR, [DATA + 8*(I*4 + J)]
mov KS_ADDR, [KS + 8*(I*4 + J)]
%assign K 0
%rep 4
;; read 16 bytes and reverse bits
vmovdqu xmm0, [DATA_ADDR + 16*K]
vpand xmm1, xmm0, xmm7
vpandn xmm2, xmm7, xmm0
vpsrld xmm2, 4
vpshufb xmm8, xmm6, xmm1 ; bit reverse low nibbles (use high table)
vpshufb xmm4, xmm5, xmm2 ; bit reverse high nibbles (use low table)
vpor xmm8, xmm4
; xmm8 - bit reversed data bytes
;; ZUC authentication part
;; - 4x32 data bits
;; - set up KS
%if K != 0
vmovdqa xmm11, xmm12
vmovdqu xmm12, [KS_ADDR + (K*16) + (4*4)]
%else
vmovdqu xmm11, [KS_ADDR + (K*16) + (0*4)]
vmovdqu xmm12, [KS_ADDR + (K*16) + (4*4)]
%endif
vpalignr xmm13, xmm12, xmm11, 8
vpshufd xmm2, xmm11, 0x61
vpshufd xmm3, xmm13, 0x61
;; - set up DATA
vpand xmm13, xmm10, xmm8
vpshufd xmm0, xmm13, 0xdc
vpsrldq xmm8, 8
vpshufd xmm1, xmm8, 0xdc
;; - clmul
;; - xor the results from 4 32-bit words together
vpclmulqdq xmm13, xmm0, xmm2, 0x00
vpclmulqdq xmm14, xmm0, xmm2, 0x11
vpclmulqdq xmm15, xmm1, xmm3, 0x00
vpclmulqdq xmm8, xmm1, xmm3, 0x11
vpternlogq xmm13, xmm14, xmm8, 0x96
vpternlogq xmm9, xmm13, xmm15, 0x96
%assign K (K + 1)
%endrep
vinserti32x4 APPEND(DIGEST_, I), xmm9, J
; Memcpy KS 64-127 bytes to 0-63 bytes
vmovdqu64 zmm0, [KS_ADDR + 64]
vmovdqu64 [KS_ADDR], zmm0
%assign J (J + 1)
%endrep
%assign I (I + 1)
%endrep
;; - update tags
mov r12, 0x00FF
mov r13, 0xFF00
kmovq k1, r12
kmovq k2, r13
vmovdqu64 zmm4, [T] ; Input tags
vmovdqa64 zmm0, [rel shuf_mask_tags]
vmovdqa64 zmm1, [rel shuf_mask_tags + 64]
; Get result tags for 16 buffers in different position in each lane
; and blend these tags into an ZMM register.
; Then, XOR the results with the previous tags and write out the result.
vpermt2d DIGEST_0{k1}{z}, zmm0, DIGEST_1
vpermt2d DIGEST_2{k2}{z}, zmm1, DIGEST_3
vpternlogq zmm4, DIGEST_0, DIGEST_2, 0x96 ; A XOR B XOR C
vmovdqu64 [T], zmm4
; Update data pointers
vmovdqu64 zmm0, [DATA]
vmovdqu64 zmm1, [DATA + 64]
vpaddq zmm0, [rel add_64]
vpaddq zmm1, [rel add_64]
vmovdqu64 [DATA], zmm0
vmovdqu64 [DATA + 64], zmm1
; Update array of lengths (if lane is valid, so length < UINT16_MAX)
vmovdqa ymm2, [LEN]
vpcmpw k1, ymm2, [rel all_ffs], 4 ; k1 -> valid lanes
vpsubw ymm2{k1}, [rel all_512w]
vmovdqa [LEN], ymm2
FUNC_RESTORE
ret
;----------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------
%ifdef LINUX
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
|
src/kernel/write.asm | johnnystarr/xtnix | 0 | 9694 | ;------------------------------------------------------------------------------
; kernel_write 0.1.0
; input: SI = 16-bit address of string
; input: DH: TODO: implement DH = file descriptor (see kernel.inc)
; input: DL:d0 = No carriage return if set
;------------------------------------------------------------------------------
kernel_write:
.do: lodsb ; loads next byte to al, (inc si)
cmp al, 0 ; at the end of our string?
je .done ; if so, leave
mov ah, 0eh ; bios (output char) int
int 10h ; call bios int
jmp .do ; loop
.done: test dl, 00000001b ; check no carriage return flag
jne .nc ; if checked, goto nc (no carriage)
mov ah, 0eh ; setup ah for bios output char
mov al, 0dh ; carriage return
int 10h ; output carriage return
mov al, 0ah ; new line
int 10h ; output new line
.nc: ret ; return
|
oeis/021/A021735.asm | neoneye/loda-programs | 11 | 245987 | <gh_stars>10-100
; A021735: Decimal expansion of 1/731.
; Submitted by <NAME>(s1.)
; 0,0,1,3,6,7,9,8,9,0,5,6,0,8,7,5,5,1,2,9,9,5,8,9,6,0,3,2,8,3,1,7,3,7,3,4,6,1,0,1,2,3,1,1,9,0,1,5,0,4,7,8,7,9,6,1,6,9,6,3,0,6,4,2,9,5,4,8,5,6,3,6,1,1,4,9,1,1,0,8,0,7,1,1,3,5,4,3,0,9,1,6,5,5,2,6,6,7,5
add $0,1
mov $2,10
pow $2,$0
div $2,731
mov $0,$2
mod $0,10
|
Data/Binary/PerformanceTests/Multiplication.agda | oisdk/agda-playground | 6 | 14288 | <reponame>oisdk/agda-playground
{-# OPTIONS --cubical --safe #-}
module Data.Binary.PerformanceTests.Multiplication where
open import Prelude
open import Data.Binary.Definition
open import Data.Binary.Addition using (_+_)
open import Data.Binary.Multiplication using (_*_)
open import Data.Binary.Increment using (inc)
one-thousand : 𝔹
one-thousand = 2ᵇ 1ᵇ 1ᵇ 2ᵇ 1ᵇ 2ᵇ 2ᵇ 2ᵇ 2ᵇ 0ᵇ
pow-r : 𝔹 → ℕ → 𝔹
pow-r x zero = 1ᵇ 0ᵇ
pow-r x (suc n) = x * pow-r (inc x) n
pow-l : 𝔹 → ℕ → 𝔹
pow-l x zero = 1ᵇ 0ᵇ
pow-l x (suc n) = pow-l (inc x) n * x
n : ℕ
n = 6
f : 𝔹
f = one-thousand
-- The actual performance test (uncomment and time how long it takes to type-check)
-- _ : pow-r f n ≡ pow-l f n
-- _ = refl
|
test/asset/agda-stdlib-1.0/Data/AVL.agda | omega12345/agda-mode | 0 | 13905 | <reponame>omega12345/agda-mode<filename>test/asset/agda-stdlib-1.0/Data/AVL.agda
------------------------------------------------------------------------
-- The Agda standard library
--
-- AVL trees
------------------------------------------------------------------------
-- AVL trees are balanced binary search trees.
-- The search tree invariant is specified using the technique
-- described by <NAME> in his talk "Pivotal pragmatism".
{-# OPTIONS --without-K --safe #-}
open import Relation.Binary using (StrictTotalOrder)
module Data.AVL
{a ℓ₁ ℓ₂} (strictTotalOrder : StrictTotalOrder a ℓ₁ ℓ₂)
where
open import Data.Bool.Base using (Bool)
import Data.DifferenceList as DiffList
open import Data.List.Base as List using (List)
open import Data.Maybe using (Maybe; nothing; just; is-just)
open import Data.Nat.Base using (suc)
open import Data.Product hiding (map)
open import Function as F
open import Level using (_⊔_)
open import Relation.Unary
open StrictTotalOrder strictTotalOrder renaming (Carrier to Key)
import Data.AVL.Indexed strictTotalOrder as Indexed
open Indexed using (K&_ ; ⊥⁺ ; ⊤⁺; ⊥⁺<⊤⁺; ⊥⁺<[_]<⊤⁺; ⊥⁺<[_]; [_]<⊤⁺)
------------------------------------------------------------------------
-- Re-export some core definitions publically
open Indexed using (Value; MkValue; const) public
------------------------------------------------------------------------
-- Types and functions with hidden indices
data Tree {v} (V : Value v) : Set (a ⊔ v ⊔ ℓ₂) where
tree : ∀ {h} → Indexed.Tree V ⊥⁺ ⊤⁺ h → Tree V
module _ {v} {V : Value v} where
private
Val = Value.family V
empty : Tree V
empty = tree $′ Indexed.empty ⊥⁺<⊤⁺
singleton : (k : Key) → Val k → Tree V
singleton k v = tree (Indexed.singleton k v ⊥⁺<[ k ]<⊤⁺)
insert : (k : Key) → Val k → Tree V → Tree V
insert k v (tree t) = tree $′ proj₂ $ Indexed.insert k v t ⊥⁺<[ k ]<⊤⁺
insertWith : (k : Key) → (Maybe (Val k) → Val k) →
Tree V → Tree V
insertWith k f (tree t) = tree $′ proj₂ $ Indexed.insertWith k f t ⊥⁺<[ k ]<⊤⁺
delete : Key → Tree V → Tree V
delete k (tree t) = tree $′ proj₂ $ Indexed.delete k t ⊥⁺<[ k ]<⊤⁺
lookup : (k : Key) → Tree V → Maybe (Val k)
lookup k (tree t) = Indexed.lookup k t ⊥⁺<[ k ]<⊤⁺
module _ {v w} {V : Value v} {W : Value w} where
private
Val = Value.family V
Wal = Value.family W
map : ∀[ Val ⇒ Wal ] → Tree V → Tree W
map f (tree t) = tree $ Indexed.map f t
module _ {v} {V : Value v} where
private
Val = Value.family V
infix 4 _∈?_
_∈?_ : Key → Tree V → Bool
k ∈? t = is-just (lookup k t)
headTail : Tree V → Maybe ((K& V) × Tree V)
headTail (tree (Indexed.leaf _)) = nothing
headTail (tree {h = suc _} t) with Indexed.headTail t
... | (k , _ , _ , t′) = just (k , tree (Indexed.castˡ ⊥⁺<[ _ ] t′))
initLast : Tree V → Maybe (Tree V × (K& V))
initLast (tree (Indexed.leaf _)) = nothing
initLast (tree {h = suc _} t) with Indexed.initLast t
... | (k , _ , _ , t′) = just (tree (Indexed.castʳ t′ [ _ ]<⊤⁺) , k)
-- The input does not need to be ordered.
fromList : List (K& V) → Tree V
fromList = List.foldr (uncurry insert) empty
-- Returns an ordered list.
toList : Tree V → List (K& V)
toList (tree t) = DiffList.toList (Indexed.toDiffList t)
-- Naive implementations of union.
module _ {v w} {V : Value v} {W : Value w} where
private
Val = Value.family V
Wal = Value.family W
unionWith : (∀ {k} → Val k → Maybe (Wal k) → Wal k) →
-- Left → right → result.
Tree V → Tree W → Tree W
unionWith f t₁ t₂ =
List.foldr (uncurry $ λ k v → insertWith k (f v)) t₂ (toList t₁)
-- Left-biased.
module _ {v} {V : Value v} where
private Val = Value.family V
union : Tree V → Tree V → Tree V
union = unionWith F.const
unionsWith : (∀ {k} → Val k → Maybe (Val k) → Val k) → List (Tree V) → Tree V
unionsWith f ts = List.foldr (unionWith f) empty ts
-- Left-biased.
unions : List (Tree V) → Tree V
unions = unionsWith F.const
|
river-crossing.als | experimental-dustbin/alloy-models | 9 | 3755 | <filename>river-crossing.als
// https://dev.to/davidk01/river-crossing-puzzle-with-alloy-415o
// The states are ordered so that we can talk about transitions
open util/ordering[State]
// The farmer, cabbage, goat, and wolf
abstract sig Entity { }
one sig Farmer, Cabbage, Goat, Wolf extends Entity { }
// If the farmer is not around then X - eats -> Y
let eats = (Goat -> Cabbage) + (Wolf -> Goat)
// State consists of a left and right entity sets modeling
// the banks of the river. The banks are disjoint and together
// they include all the entities
sig State {
left, right: set Entity
} {
// The combination of left and right must include all entities
Entity = left + right
// The left and right banks must be disjoint
no left & right
// NOTE: Try removing one of the conditions and running the model to see what
// happens. It's actually interesting
}
// The entities on the bank are valid if the farmer is there or
// there are no eating combinations
pred validSubState(s: set Entity) {
Farmer in s || no (s & s.eats)
}
// Valid state means both banks are valid
pred validState(s: State) {
validSubState[s.left] && validSubState[s.right]
}
// Now we specify a valid transition from s to s' = s.next
pred transition(s: State, s': State) {
// This is redundant but doesn't hurt to have it
s' = s.next
// The transition can move at most one item along with the Farmer. Since
// we don't exclude e from being the Farmer it could be that the Farmer
// is the only thing that moves from one bank to the next when e = Farmer
one e: Entity {
Farmer in s.left => {
e in s.left && s'.right = s.right + Farmer + e
} else {
e in s.right && s'.left = s.left + Farmer + e
}
}
// The pre and post states must be valid. Although technically if we start
// with a valid state then we can never end up in an invalid state so checking
// that the initial state is valid is redundant
validState[s] && validState[s']
}
// We are done when everything is on the right bank
pred done(s: State) { Entity = s.right }
// We start with everything on the left bank
pred init(s: State) { Entity = s.left }
// Make sure the first and last state are what we want and that we can transition
// from the first state to the last state
run {
init[first]
all s: State, s': s.next | transition[s, s']
done[last]
} for 8 State
|
llvm-gcc-4.2-2.9/gcc/ada/a-coinve.adb | vidkidz/crossbridge | 1 | 6893 | <filename>llvm-gcc-4.2-2.9/gcc/ada/a-coinve.adb
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . I N D E F I N I T E _ V E C T O R S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2006, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- This unit has originally being developed by <NAME>. --
------------------------------------------------------------------------------
with Ada.Containers.Generic_Array_Sort;
with Ada.Unchecked_Deallocation;
with System; use type System.Address;
package body Ada.Containers.Indefinite_Vectors is
type Int is range System.Min_Int .. System.Max_Int;
type UInt is mod System.Max_Binary_Modulus;
procedure Free is
new Ada.Unchecked_Deallocation (Elements_Type, Elements_Access);
procedure Free is
new Ada.Unchecked_Deallocation (Element_Type, Element_Access);
---------
-- "&" --
---------
function "&" (Left, Right : Vector) return Vector is
LN : constant Count_Type := Length (Left);
RN : constant Count_Type := Length (Right);
begin
if LN = 0 then
if RN = 0 then
return Empty_Vector;
end if;
declare
RE : Elements_Type renames
Right.Elements (Index_Type'First .. Right.Last);
Elements : Elements_Access :=
new Elements_Type (RE'Range);
begin
for I in Elements'Range loop
begin
if RE (I) /= null then
Elements (I) := new Element_Type'(RE (I).all);
end if;
exception
when others =>
for J in Index_Type'First .. I - 1 loop
Free (Elements (J));
end loop;
Free (Elements);
raise;
end;
end loop;
return (Controlled with Elements, Right.Last, 0, 0);
end;
end if;
if RN = 0 then
declare
LE : Elements_Type renames
Left.Elements (Index_Type'First .. Left.Last);
Elements : Elements_Access :=
new Elements_Type (LE'Range);
begin
for I in Elements'Range loop
begin
if LE (I) /= null then
Elements (I) := new Element_Type'(LE (I).all);
end if;
exception
when others =>
for J in Index_Type'First .. I - 1 loop
Free (Elements (J));
end loop;
Free (Elements);
raise;
end;
end loop;
return (Controlled with Elements, Left.Last, 0, 0);
end;
end if;
declare
N : constant Int'Base := Int (LN) + Int (RN);
Last_As_Int : Int'Base;
begin
if Int (No_Index) > Int'Last - N then
raise Constraint_Error with "new length is out of range";
end if;
Last_As_Int := Int (No_Index) + N;
if Last_As_Int > Int (Index_Type'Last) then
raise Constraint_Error with "new length is out of range";
end if;
declare
Last : constant Index_Type := Index_Type (Last_As_Int);
LE : Elements_Type renames
Left.Elements (Index_Type'First .. Left.Last);
RE : Elements_Type renames
Right.Elements (Index_Type'First .. Right.Last);
Elements : Elements_Access :=
new Elements_Type (Index_Type'First .. Last);
I : Index_Type'Base := No_Index;
begin
for LI in LE'Range loop
I := I + 1;
begin
if LE (LI) /= null then
Elements (I) := new Element_Type'(LE (LI).all);
end if;
exception
when others =>
for J in Index_Type'First .. I - 1 loop
Free (Elements (J));
end loop;
Free (Elements);
raise;
end;
end loop;
for RI in RE'Range loop
I := I + 1;
begin
if RE (RI) /= null then
Elements (I) := new Element_Type'(RE (RI).all);
end if;
exception
when others =>
for J in Index_Type'First .. I - 1 loop
Free (Elements (J));
end loop;
Free (Elements);
raise;
end;
end loop;
return (Controlled with Elements, Last, 0, 0);
end;
end;
end "&";
function "&" (Left : Vector; Right : Element_Type) return Vector is
LN : constant Count_Type := Length (Left);
begin
if LN = 0 then
declare
subtype Elements_Subtype is
Elements_Type (Index_Type'First .. Index_Type'First);
Elements : Elements_Access := new Elements_Subtype;
begin
begin
Elements (Elements'First) := new Element_Type'(Right);
exception
when others =>
Free (Elements);
raise;
end;
return (Controlled with Elements, Index_Type'First, 0, 0);
end;
end if;
declare
Last_As_Int : Int'Base;
begin
if Int (Index_Type'First) > Int'Last - Int (LN) then
raise Constraint_Error with "new length is out of range";
end if;
Last_As_Int := Int (Index_Type'First) + Int (LN);
if Last_As_Int > Int (Index_Type'Last) then
raise Constraint_Error with "new length is out of range";
end if;
declare
Last : constant Index_Type := Index_Type (Last_As_Int);
LE : Elements_Type renames
Left.Elements (Index_Type'First .. Left.Last);
Elements : Elements_Access :=
new Elements_Type (Index_Type'First .. Last);
begin
for I in LE'Range loop
begin
if LE (I) /= null then
Elements (I) := new Element_Type'(LE (I).all);
end if;
exception
when others =>
for J in Index_Type'First .. I - 1 loop
Free (Elements (J));
end loop;
Free (Elements);
raise;
end;
end loop;
begin
Elements (Elements'Last) := new Element_Type'(Right);
exception
when others =>
for J in Index_Type'First .. Elements'Last - 1 loop
Free (Elements (J));
end loop;
Free (Elements);
raise;
end;
return (Controlled with Elements, Last, 0, 0);
end;
end;
end "&";
function "&" (Left : Element_Type; Right : Vector) return Vector is
RN : constant Count_Type := Length (Right);
begin
if RN = 0 then
declare
subtype Elements_Subtype is
Elements_Type (Index_Type'First .. Index_Type'First);
Elements : Elements_Access := new Elements_Subtype;
begin
begin
Elements (Elements'First) := new Element_Type'(Left);
exception
when others =>
Free (Elements);
raise;
end;
return (Controlled with Elements, Index_Type'First, 0, 0);
end;
end if;
declare
Last_As_Int : Int'Base;
begin
if Int (Index_Type'First) > Int'Last - Int (RN) then
raise Constraint_Error with "new length is out of range";
end if;
Last_As_Int := Int (Index_Type'First) + Int (RN);
if Last_As_Int > Int (Index_Type'Last) then
raise Constraint_Error with "new length is out of range";
end if;
declare
Last : constant Index_Type := Index_Type (Last_As_Int);
RE : Elements_Type renames
Right.Elements (Index_Type'First .. Right.Last);
Elements : Elements_Access :=
new Elements_Type (Index_Type'First .. Last);
I : Index_Type'Base := Index_Type'First;
begin
begin
Elements (I) := new Element_Type'(Left);
exception
when others =>
Free (Elements);
raise;
end;
for RI in RE'Range loop
I := I + 1;
begin
if RE (RI) /= null then
Elements (I) := new Element_Type'(RE (RI).all);
end if;
exception
when others =>
for J in Index_Type'First .. I - 1 loop
Free (Elements (J));
end loop;
Free (Elements);
raise;
end;
end loop;
return (Controlled with Elements, Last, 0, 0);
end;
end;
end "&";
function "&" (Left, Right : Element_Type) return Vector is
begin
if Index_Type'First >= Index_Type'Last then
raise Constraint_Error with "new length is out of range";
end if;
declare
Last : constant Index_Type := Index_Type'First + 1;
subtype ET is Elements_Type (Index_Type'First .. Last);
Elements : Elements_Access := new ET;
begin
begin
Elements (Elements'First) := new Element_Type'(Left);
exception
when others =>
Free (Elements);
raise;
end;
begin
Elements (Elements'Last) := new Element_Type'(Right);
exception
when others =>
Free (Elements (Elements'First));
Free (Elements);
raise;
end;
return (Controlled with Elements, Elements'Last, 0, 0);
end;
end "&";
---------
-- "=" --
---------
function "=" (Left, Right : Vector) return Boolean is
begin
if Left'Address = Right'Address then
return True;
end if;
if Left.Last /= Right.Last then
return False;
end if;
for J in Index_Type'First .. Left.Last loop
if Left.Elements (J) = null then
if Right.Elements (J) /= null then
return False;
end if;
elsif Right.Elements (J) = null then
return False;
elsif Left.Elements (J).all /= Right.Elements (J).all then
return False;
end if;
end loop;
return True;
end "=";
------------
-- Adjust --
------------
procedure Adjust (Container : in out Vector) is
begin
if Container.Last = No_Index then
Container.Elements := null;
return;
end if;
declare
E : Elements_Type renames Container.Elements.all;
L : constant Index_Type := Container.Last;
begin
Container.Elements := null;
Container.Last := No_Index;
Container.Busy := 0;
Container.Lock := 0;
Container.Elements := new Elements_Type (Index_Type'First .. L);
for I in Container.Elements'Range loop
if E (I) /= null then
Container.Elements (I) := new Element_Type'(E (I).all);
end if;
Container.Last := I;
end loop;
end;
end Adjust;
------------
-- Append --
------------
procedure Append (Container : in out Vector; New_Item : Vector) is
begin
if Is_Empty (New_Item) then
return;
end if;
if Container.Last = Index_Type'Last then
raise Constraint_Error with "vector is already at its maximum length";
end if;
Insert
(Container,
Container.Last + 1,
New_Item);
end Append;
procedure Append
(Container : in out Vector;
New_Item : Element_Type;
Count : Count_Type := 1)
is
begin
if Count = 0 then
return;
end if;
if Container.Last = Index_Type'Last then
raise Constraint_Error with "vector is already at its maximum length";
end if;
Insert
(Container,
Container.Last + 1,
New_Item,
Count);
end Append;
--------------
-- Capacity --
--------------
function Capacity (Container : Vector) return Count_Type is
begin
if Container.Elements = null then
return 0;
end if;
return Container.Elements'Length;
end Capacity;
-----------
-- Clear --
-----------
procedure Clear (Container : in out Vector) is
begin
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
while Container.Last >= Index_Type'First loop
declare
X : Element_Access := Container.Elements (Container.Last);
begin
Container.Elements (Container.Last) := null;
Container.Last := Container.Last - 1;
Free (X);
end;
end loop;
end Clear;
--------------
-- Contains --
--------------
function Contains
(Container : Vector;
Item : Element_Type) return Boolean
is
begin
return Find_Index (Container, Item) /= No_Index;
end Contains;
------------
-- Delete --
------------
procedure Delete
(Container : in out Vector;
Index : Extended_Index;
Count : Count_Type := 1)
is
begin
if Index < Index_Type'First then
raise Constraint_Error with "Index is out of range (too small)";
end if;
if Index > Container.Last then
if Index > Container.Last + 1 then
raise Constraint_Error with "Index is out of range (too large)";
end if;
return;
end if;
if Count = 0 then
return;
end if;
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
declare
Index_As_Int : constant Int := Int (Index);
Old_Last_As_Int : constant Int := Int (Container.Last);
Count1 : constant Int'Base := Int (Count);
Count2 : constant Int'Base := Old_Last_As_Int - Index_As_Int + 1;
N : constant Int'Base := Int'Min (Count1, Count2);
J_As_Int : constant Int'Base := Index_As_Int + N;
E : Elements_Type renames Container.Elements.all;
begin
if J_As_Int > Old_Last_As_Int then
while Container.Last >= Index loop
declare
K : constant Index_Type := Container.Last;
X : Element_Access := E (K);
begin
E (K) := null;
Container.Last := K - 1;
Free (X);
end;
end loop;
else
declare
J : constant Index_Type := Index_Type (J_As_Int);
New_Last_As_Int : constant Int'Base := Old_Last_As_Int - N;
New_Last : constant Index_Type :=
Index_Type (New_Last_As_Int);
begin
for K in Index .. J - 1 loop
declare
X : Element_Access := E (K);
begin
E (K) := null;
Free (X);
end;
end loop;
E (Index .. New_Last) := E (J .. Container.Last);
Container.Last := New_Last;
end;
end if;
end;
end Delete;
procedure Delete
(Container : in out Vector;
Position : in out Cursor;
Count : Count_Type := 1)
is
begin
if Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error with "Position cursor denotes wrong container";
end if;
if Position.Index > Container.Last then
raise Program_Error with "Position index is out of range";
end if;
Delete (Container, Position.Index, Count);
Position := No_Element; -- See comment in a-convec.adb
end Delete;
------------------
-- Delete_First --
------------------
procedure Delete_First
(Container : in out Vector;
Count : Count_Type := 1)
is
begin
if Count = 0 then
return;
end if;
if Count >= Length (Container) then
Clear (Container);
return;
end if;
Delete (Container, Index_Type'First, Count);
end Delete_First;
-----------------
-- Delete_Last --
-----------------
procedure Delete_Last
(Container : in out Vector;
Count : Count_Type := 1)
is
N : constant Count_Type := Length (Container);
begin
if Count = 0
or else N = 0
then
return;
end if;
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
declare
E : Elements_Type renames Container.Elements.all;
begin
for Indx in 1 .. Count_Type'Min (Count, N) loop
declare
J : constant Index_Type := Container.Last;
X : Element_Access := E (J);
begin
E (J) := null;
Container.Last := J - 1;
Free (X);
end;
end loop;
end;
end Delete_Last;
-------------
-- Element --
-------------
function Element
(Container : Vector;
Index : Index_Type) return Element_Type
is
begin
if Index > Container.Last then
raise Constraint_Error with "Index is out of range";
end if;
declare
EA : constant Element_Access := Container.Elements (Index);
begin
if EA = null then
raise Constraint_Error with "element is empty";
end if;
return EA.all;
end;
end Element;
function Element (Position : Cursor) return Element_Type is
begin
if Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
return Element (Position.Container.all, Position.Index);
end Element;
--------------
-- Finalize --
--------------
procedure Finalize (Container : in out Vector) is
begin
Clear (Container); -- Checks busy-bit
declare
X : Elements_Access := Container.Elements;
begin
Container.Elements := null;
Free (X);
end;
end Finalize;
----------
-- Find --
----------
function Find
(Container : Vector;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor
is
begin
if Position.Container /= null then
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error with "Position cursor denotes wrong container";
end if;
if Position.Index > Container.Last then
raise Program_Error with "Position index is out of range";
end if;
end if;
for J in Position.Index .. Container.Last loop
if Container.Elements (J) /= null
and then Container.Elements (J).all = Item
then
return (Container'Unchecked_Access, J);
end if;
end loop;
return No_Element;
end Find;
----------------
-- Find_Index --
----------------
function Find_Index
(Container : Vector;
Item : Element_Type;
Index : Index_Type := Index_Type'First) return Extended_Index
is
begin
for Indx in Index .. Container.Last loop
if Container.Elements (Indx) /= null
and then Container.Elements (Indx).all = Item
then
return Indx;
end if;
end loop;
return No_Index;
end Find_Index;
-----------
-- First --
-----------
function First (Container : Vector) return Cursor is
begin
if Is_Empty (Container) then
return No_Element;
end if;
return (Container'Unchecked_Access, Index_Type'First);
end First;
-------------------
-- First_Element --
-------------------
function First_Element (Container : Vector) return Element_Type is
begin
return Element (Container, Index_Type'First);
end First_Element;
-----------------
-- First_Index --
-----------------
function First_Index (Container : Vector) return Index_Type is
pragma Unreferenced (Container);
begin
return Index_Type'First;
end First_Index;
---------------------
-- Generic_Sorting --
---------------------
package body Generic_Sorting is
-----------------------
-- Local Subprograms --
-----------------------
function Is_Less (L, R : Element_Access) return Boolean;
pragma Inline (Is_Less);
-------------
-- Is_Less --
-------------
function Is_Less (L, R : Element_Access) return Boolean is
begin
if L = null then
return R /= null;
elsif R = null then
return False;
else
return L.all < R.all;
end if;
end Is_Less;
---------------
-- Is_Sorted --
---------------
function Is_Sorted (Container : Vector) return Boolean is
begin
if Container.Last <= Index_Type'First then
return True;
end if;
declare
E : Elements_Type renames Container.Elements.all;
begin
for I in Index_Type'First .. Container.Last - 1 loop
if Is_Less (E (I + 1), E (I)) then
return False;
end if;
end loop;
end;
return True;
end Is_Sorted;
-----------
-- Merge --
-----------
procedure Merge (Target, Source : in out Vector) is
I : Index_Type'Base := Target.Last;
J : Index_Type'Base;
begin
if Target.Last < Index_Type'First then
Move (Target => Target, Source => Source);
return;
end if;
if Target'Address = Source'Address then
return;
end if;
if Source.Last < Index_Type'First then
return;
end if;
if Source.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
Target.Set_Length (Length (Target) + Length (Source));
J := Target.Last;
while Source.Last >= Index_Type'First loop
pragma Assert
(Source.Last <= Index_Type'First
or else not (Is_Less
(Source.Elements (Source.Last),
Source.Elements (Source.Last - 1))));
if I < Index_Type'First then
declare
Src : Elements_Type renames
Source.Elements (Index_Type'First .. Source.Last);
begin
Target.Elements (Index_Type'First .. J) := Src;
Src := (others => null);
end;
Source.Last := No_Index;
return;
end if;
pragma Assert
(I <= Index_Type'First
or else not (Is_Less
(Target.Elements (I),
Target.Elements (I - 1))));
declare
Src : Element_Access renames Source.Elements (Source.Last);
Tgt : Element_Access renames Target.Elements (I);
begin
if Is_Less (Src, Tgt) then
Target.Elements (J) := Tgt;
Tgt := null;
I := I - 1;
else
Target.Elements (J) := Src;
Src := null;
Source.Last := Source.Last - 1;
end if;
end;
J := J - 1;
end loop;
end Merge;
----------
-- Sort --
----------
procedure Sort (Container : in out Vector)
is
procedure Sort is
new Generic_Array_Sort
(Index_Type => Index_Type,
Element_Type => Element_Access,
Array_Type => Elements_Type,
"<" => Is_Less);
-- Start of processing for Sort
begin
if Container.Last <= Index_Type'First then
return;
end if;
if Container.Lock > 0 then
raise Program_Error with
"attempt to tamper with cursors (vector is locked)";
end if;
Sort (Container.Elements (Index_Type'First .. Container.Last));
end Sort;
end Generic_Sorting;
-----------------
-- Has_Element --
-----------------
function Has_Element (Position : Cursor) return Boolean is
begin
if Position.Container = null then
return False;
end if;
return Position.Index <= Position.Container.Last;
end Has_Element;
------------
-- Insert --
------------
procedure Insert
(Container : in out Vector;
Before : Extended_Index;
New_Item : Element_Type;
Count : Count_Type := 1)
is
N : constant Int := Int (Count);
First : constant Int := Int (Index_Type'First);
New_Last_As_Int : Int'Base;
New_Last : Index_Type;
New_Length : UInt;
Max_Length : constant UInt := UInt (Count_Type'Last);
Dst : Elements_Access;
begin
if Before < Index_Type'First then
raise Constraint_Error with
"Before index is out of range (too small)";
end if;
if Before > Container.Last
and then Before > Container.Last + 1
then
raise Constraint_Error with
"Before index is out of range (too large)";
end if;
if Count = 0 then
return;
end if;
declare
Old_Last_As_Int : constant Int := Int (Container.Last);
begin
if Old_Last_As_Int > Int'Last - N then -- see a-convec.adb ???
raise Constraint_Error with "new length is out of range";
end if;
New_Last_As_Int := Old_Last_As_Int + N;
if New_Last_As_Int > Int (Index_Type'Last) then
raise Constraint_Error with "new length is out of range";
end if;
New_Length := UInt (New_Last_As_Int - First + 1);
if New_Length > Max_Length then
raise Constraint_Error with "new length is out of range";
end if;
New_Last := Index_Type (New_Last_As_Int);
end;
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
if Container.Elements = null then
Container.Elements :=
new Elements_Type (Index_Type'First .. New_Last);
Container.Last := No_Index;
for J in Container.Elements'Range loop
Container.Elements (J) := new Element_Type'(New_Item);
Container.Last := J;
end loop;
return;
end if;
if New_Last <= Container.Elements'Last then
declare
E : Elements_Type renames Container.Elements.all;
begin
if Before <= Container.Last then
declare
Index_As_Int : constant Int'Base :=
Index_Type'Pos (Before) + N;
Index : constant Index_Type := Index_Type (Index_As_Int);
J : Index_Type'Base;
begin
E (Index .. New_Last) := E (Before .. Container.Last);
Container.Last := New_Last;
J := Before;
while J < Index loop
E (J) := new Element_Type'(New_Item);
J := J + 1;
end loop;
exception
when others =>
E (J .. Index - 1) := (others => null);
raise;
end;
else
for J in Before .. New_Last loop
E (J) := new Element_Type'(New_Item);
Container.Last := J;
end loop;
end if;
end;
return;
end if;
declare
C, CC : UInt;
begin
C := UInt'Max (1, Container.Elements'Length);
while C < New_Length loop
if C > UInt'Last / 2 then
C := UInt'Last;
exit;
end if;
C := 2 * C;
end loop;
if C > Max_Length then
C := Max_Length;
end if;
if Index_Type'First <= 0
and then Index_Type'Last >= 0
then
CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1;
else
CC := UInt (Int (Index_Type'Last) - First + 1);
end if;
if C > CC then
C := CC;
end if;
declare
Dst_Last : constant Index_Type :=
Index_Type (First + UInt'Pos (C) - Int'(1));
begin
Dst := new Elements_Type (Index_Type'First .. Dst_Last);
end;
end;
if Before <= Container.Last then
declare
Index_As_Int : constant Int'Base :=
Index_Type'Pos (Before) + N;
Index : constant Index_Type := Index_Type (Index_As_Int);
Src : Elements_Access := Container.Elements;
begin
Dst (Index_Type'First .. Before - 1) :=
Src (Index_Type'First .. Before - 1);
Dst (Index .. New_Last) := Src (Before .. Container.Last);
Container.Elements := Dst;
Container.Last := New_Last;
Free (Src);
for J in Before .. Index - 1 loop
Dst (J) := new Element_Type'(New_Item);
end loop;
end;
else
declare
Src : Elements_Access := Container.Elements;
begin
Dst (Index_Type'First .. Container.Last) :=
Src (Index_Type'First .. Container.Last);
Container.Elements := Dst;
Free (Src);
for J in Before .. New_Last loop
Dst (J) := new Element_Type'(New_Item);
Container.Last := J;
end loop;
end;
end if;
end Insert;
procedure Insert
(Container : in out Vector;
Before : Extended_Index;
New_Item : Vector)
is
N : constant Count_Type := Length (New_Item);
begin
if Before < Index_Type'First then
raise Constraint_Error with
"Before index is out of range (too small)";
end if;
if Before > Container.Last
and then Before > Container.Last + 1
then
raise Constraint_Error with
"Before index is out of range (too large)";
end if;
if N = 0 then
return;
end if;
Insert_Space (Container, Before, Count => N);
declare
Dst_Last_As_Int : constant Int'Base :=
Int'Base (Before) + Int'Base (N) - 1;
Dst_Last : constant Index_Type := Index_Type (Dst_Last_As_Int);
Dst : Elements_Type renames
Container.Elements (Before .. Dst_Last);
Dst_Index : Index_Type'Base := Before - 1;
begin
if Container'Address /= New_Item'Address then
declare
Src : Elements_Type renames
New_Item.Elements (Index_Type'First .. New_Item.Last);
begin
for Src_Index in Src'Range loop
Dst_Index := Dst_Index + 1;
if Src (Src_Index) /= null then
Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all);
end if;
end loop;
end;
return;
end if;
declare
subtype Src_Index_Subtype is Index_Type'Base range
Index_Type'First .. Before - 1;
Src : Elements_Type renames
Container.Elements (Src_Index_Subtype);
begin
for Src_Index in Src'Range loop
Dst_Index := Dst_Index + 1;
if Src (Src_Index) /= null then
Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all);
end if;
end loop;
end;
if Dst_Last = Container.Last then
return;
end if;
declare
subtype Src_Index_Subtype is Index_Type'Base range
Dst_Last + 1 .. Container.Last;
Src : Elements_Type renames
Container.Elements (Src_Index_Subtype);
begin
for Src_Index in Src'Range loop
Dst_Index := Dst_Index + 1;
if Src (Src_Index) /= null then
Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all);
end if;
end loop;
end;
end;
end Insert;
procedure Insert
(Container : in out Vector;
Before : Cursor;
New_Item : Vector)
is
Index : Index_Type'Base;
begin
if Before.Container /= null
and then Before.Container /= Container'Unchecked_Access
then
raise Program_Error with "Before cursor denotes wrong container";
end if;
if Is_Empty (New_Item) then
return;
end if;
if Before.Container = null
or else Before.Index > Container.Last
then
if Container.Last = Index_Type'Last then
raise Constraint_Error with
"vector is already at its maximum length";
end if;
Index := Container.Last + 1;
else
Index := Before.Index;
end if;
Insert (Container, Index, New_Item);
end Insert;
procedure Insert
(Container : in out Vector;
Before : Cursor;
New_Item : Vector;
Position : out Cursor)
is
Index : Index_Type'Base;
begin
if Before.Container /= null
and then Before.Container /= Vector_Access'(Container'Unchecked_Access)
then
raise Program_Error with "Before cursor denotes wrong container";
end if;
if Is_Empty (New_Item) then
if Before.Container = null
or else Before.Index > Container.Last
then
Position := No_Element;
else
Position := (Container'Unchecked_Access, Before.Index);
end if;
return;
end if;
if Before.Container = null
or else Before.Index > Container.Last
then
if Container.Last = Index_Type'Last then
raise Constraint_Error with
"vector is already at its maximum length";
end if;
Index := Container.Last + 1;
else
Index := Before.Index;
end if;
Insert (Container, Index, New_Item);
Position := Cursor'(Container'Unchecked_Access, Index);
end Insert;
procedure Insert
(Container : in out Vector;
Before : Cursor;
New_Item : Element_Type;
Count : Count_Type := 1)
is
Index : Index_Type'Base;
begin
if Before.Container /= null
and then Before.Container /= Container'Unchecked_Access
then
raise Program_Error with "Before cursor denotes wrong container";
end if;
if Count = 0 then
return;
end if;
if Before.Container = null
or else Before.Index > Container.Last
then
if Container.Last = Index_Type'Last then
raise Constraint_Error with
"vector is already at its maximum length";
end if;
Index := Container.Last + 1;
else
Index := Before.Index;
end if;
Insert (Container, Index, New_Item, Count);
end Insert;
procedure Insert
(Container : in out Vector;
Before : Cursor;
New_Item : Element_Type;
Position : out Cursor;
Count : Count_Type := 1)
is
Index : Index_Type'Base;
begin
if Before.Container /= null
and then Before.Container /= Container'Unchecked_Access
then
raise Program_Error with "Before cursor denotes wrong container";
end if;
if Count = 0 then
if Before.Container = null
or else Before.Index > Container.Last
then
Position := No_Element;
else
Position := (Container'Unchecked_Access, Before.Index);
end if;
return;
end if;
if Before.Container = null
or else Before.Index > Container.Last
then
if Container.Last = Index_Type'Last then
raise Constraint_Error with
"vector is already at its maximum length";
end if;
Index := Container.Last + 1;
else
Index := Before.Index;
end if;
Insert (Container, Index, New_Item, Count);
Position := (Container'Unchecked_Access, Index);
end Insert;
------------------
-- Insert_Space --
------------------
procedure Insert_Space
(Container : in out Vector;
Before : Extended_Index;
Count : Count_Type := 1)
is
N : constant Int := Int (Count);
First : constant Int := Int (Index_Type'First);
New_Last_As_Int : Int'Base;
New_Last : Index_Type;
New_Length : UInt;
Max_Length : constant UInt := UInt (Count_Type'Last);
Dst : Elements_Access;
begin
if Before < Index_Type'First then
raise Constraint_Error with
"Before index is out of range (too small)";
end if;
if Before > Container.Last
and then Before > Container.Last + 1
then
raise Constraint_Error with
"Before index is out of range (too large)";
end if;
if Count = 0 then
return;
end if;
declare
Old_Last_As_Int : constant Int := Int (Container.Last);
begin
if Old_Last_As_Int > Int'Last - N then -- see a-convec.adb ???
raise Constraint_Error with "new length is out of range";
end if;
New_Last_As_Int := Old_Last_As_Int + N;
if New_Last_As_Int > Int (Index_Type'Last) then
raise Constraint_Error with "new length is out of range";
end if;
New_Length := UInt (New_Last_As_Int - First + 1);
if New_Length > Max_Length then
raise Constraint_Error with "new length is out of range";
end if;
New_Last := Index_Type (New_Last_As_Int);
end;
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
if Container.Elements = null then
Container.Elements :=
new Elements_Type (Index_Type'First .. New_Last);
Container.Last := New_Last;
return;
end if;
if New_Last <= Container.Elements'Last then
declare
E : Elements_Type renames Container.Elements.all;
begin
if Before <= Container.Last then
declare
Index_As_Int : constant Int'Base :=
Index_Type'Pos (Before) + N;
Index : constant Index_Type := Index_Type (Index_As_Int);
begin
E (Index .. New_Last) := E (Before .. Container.Last);
E (Before .. Index - 1) := (others => null);
end;
end if;
end;
Container.Last := New_Last;
return;
end if;
declare
C, CC : UInt;
begin
C := UInt'Max (1, Container.Elements'Length);
while C < New_Length loop
if C > UInt'Last / 2 then
C := UInt'Last;
exit;
end if;
C := 2 * C;
end loop;
if C > Max_Length then
C := Max_Length;
end if;
if Index_Type'First <= 0
and then Index_Type'Last >= 0
then
CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1;
else
CC := UInt (Int (Index_Type'Last) - First + 1);
end if;
if C > CC then
C := CC;
end if;
declare
Dst_Last : constant Index_Type :=
Index_Type (First + UInt'Pos (C) - 1);
begin
Dst := new Elements_Type (Index_Type'First .. Dst_Last);
end;
end;
declare
Src : Elements_Access := Container.Elements;
begin
if Before <= Container.Last then
declare
Index_As_Int : constant Int'Base :=
Index_Type'Pos (Before) + N;
Index : constant Index_Type := Index_Type (Index_As_Int);
begin
Dst (Index_Type'First .. Before - 1) :=
Src (Index_Type'First .. Before - 1);
Dst (Index .. New_Last) := Src (Before .. Container.Last);
end;
else
Dst (Index_Type'First .. Container.Last) :=
Src (Index_Type'First .. Container.Last);
end if;
Container.Elements := Dst;
Container.Last := New_Last;
Free (Src);
end;
end Insert_Space;
procedure Insert_Space
(Container : in out Vector;
Before : Cursor;
Position : out Cursor;
Count : Count_Type := 1)
is
Index : Index_Type'Base;
begin
if Before.Container /= null
and then Before.Container /= Container'Unchecked_Access
then
raise Program_Error with "Before cursor denotes wrong container";
end if;
if Count = 0 then
if Before.Container = null
or else Before.Index > Container.Last
then
Position := No_Element;
else
Position := (Container'Unchecked_Access, Before.Index);
end if;
return;
end if;
if Before.Container = null
or else Before.Index > Container.Last
then
if Container.Last = Index_Type'Last then
raise Constraint_Error with
"vector is already at its maximum length";
end if;
Index := Container.Last + 1;
else
Index := Before.Index;
end if;
Insert_Space (Container, Index, Count);
Position := Cursor'(Container'Unchecked_Access, Index);
end Insert_Space;
--------------
-- Is_Empty --
--------------
function Is_Empty (Container : Vector) return Boolean is
begin
return Container.Last < Index_Type'First;
end Is_Empty;
-------------
-- Iterate --
-------------
procedure Iterate
(Container : Vector;
Process : not null access procedure (Position : Cursor))
is
V : Vector renames Container'Unrestricted_Access.all;
B : Natural renames V.Busy;
begin
B := B + 1;
begin
for Indx in Index_Type'First .. Container.Last loop
Process (Cursor'(Container'Unchecked_Access, Indx));
end loop;
exception
when others =>
B := B - 1;
raise;
end;
B := B - 1;
end Iterate;
----------
-- Last --
----------
function Last (Container : Vector) return Cursor is
begin
if Is_Empty (Container) then
return No_Element;
end if;
return (Container'Unchecked_Access, Container.Last);
end Last;
------------------
-- Last_Element --
------------------
function Last_Element (Container : Vector) return Element_Type is
begin
return Element (Container, Container.Last);
end Last_Element;
----------------
-- Last_Index --
----------------
function Last_Index (Container : Vector) return Extended_Index is
begin
return Container.Last;
end Last_Index;
------------
-- Length --
------------
function Length (Container : Vector) return Count_Type is
L : constant Int := Int (Container.Last);
F : constant Int := Int (Index_Type'First);
N : constant Int'Base := L - F + 1;
begin
return Count_Type (N);
end Length;
----------
-- Move --
----------
procedure Move
(Target : in out Vector;
Source : in out Vector)
is
begin
if Target'Address = Source'Address then
return;
end if;
if Source.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (Source is busy)";
end if;
Clear (Target); -- Checks busy-bit
declare
Target_Elements : constant Elements_Access := Target.Elements;
begin
Target.Elements := Source.Elements;
Source.Elements := Target_Elements;
end;
Target.Last := Source.Last;
Source.Last := No_Index;
end Move;
----------
-- Next --
----------
function Next (Position : Cursor) return Cursor is
begin
if Position.Container = null then
return No_Element;
end if;
if Position.Index < Position.Container.Last then
return (Position.Container, Position.Index + 1);
end if;
return No_Element;
end Next;
----------
-- Next --
----------
procedure Next (Position : in out Cursor) is
begin
if Position.Container = null then
return;
end if;
if Position.Index < Position.Container.Last then
Position.Index := Position.Index + 1;
else
Position := No_Element;
end if;
end Next;
-------------
-- Prepend --
-------------
procedure Prepend (Container : in out Vector; New_Item : Vector) is
begin
Insert (Container, Index_Type'First, New_Item);
end Prepend;
procedure Prepend
(Container : in out Vector;
New_Item : Element_Type;
Count : Count_Type := 1)
is
begin
Insert (Container,
Index_Type'First,
New_Item,
Count);
end Prepend;
--------------
-- Previous --
--------------
procedure Previous (Position : in out Cursor) is
begin
if Position.Container = null then
return;
end if;
if Position.Index > Index_Type'First then
Position.Index := Position.Index - 1;
else
Position := No_Element;
end if;
end Previous;
function Previous (Position : Cursor) return Cursor is
begin
if Position.Container = null then
return No_Element;
end if;
if Position.Index > Index_Type'First then
return (Position.Container, Position.Index - 1);
end if;
return No_Element;
end Previous;
-------------------
-- Query_Element --
-------------------
procedure Query_Element
(Container : Vector;
Index : Index_Type;
Process : not null access procedure (Element : Element_Type))
is
V : Vector renames Container'Unrestricted_Access.all;
B : Natural renames V.Busy;
L : Natural renames V.Lock;
begin
if Index > Container.Last then
raise Constraint_Error with "Index is out of range";
end if;
if V.Elements (Index) = null then
raise Constraint_Error with "element is null";
end if;
B := B + 1;
L := L + 1;
begin
Process (V.Elements (Index).all);
exception
when others =>
L := L - 1;
B := B - 1;
raise;
end;
L := L - 1;
B := B - 1;
end Query_Element;
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Element : Element_Type))
is
begin
if Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
Query_Element (Position.Container.all, Position.Index, Process);
end Query_Element;
----------
-- Read --
----------
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Container : out Vector)
is
Length : Count_Type'Base;
Last : Index_Type'Base := Index_Type'Pred (Index_Type'First);
B : Boolean;
begin
Clear (Container);
Count_Type'Base'Read (Stream, Length);
if Length > Capacity (Container) then
Reserve_Capacity (Container, Capacity => Length);
end if;
for J in Count_Type range 1 .. Length loop
Last := Last + 1;
Boolean'Read (Stream, B);
if B then
Container.Elements (Last) :=
new Element_Type'(Element_Type'Input (Stream));
end if;
Container.Last := Last;
end loop;
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Position : out Cursor)
is
begin
raise Program_Error with "attempt to stream vector cursor";
end Read;
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
(Container : in out Vector;
Index : Index_Type;
New_Item : Element_Type)
is
begin
if Index > Container.Last then
raise Constraint_Error with "Index is out of range";
end if;
if Container.Lock > 0 then
raise Program_Error with
"attempt to tamper with cursors (vector is locked)";
end if;
declare
X : Element_Access := Container.Elements (Index);
begin
Container.Elements (Index) := new Element_Type'(New_Item);
Free (X);
end;
end Replace_Element;
procedure Replace_Element
(Container : in out Vector;
Position : Cursor;
New_Item : Element_Type)
is
begin
if Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error with "Position cursor denotes wrong container";
end if;
Replace_Element (Container, Position.Index, New_Item);
end Replace_Element;
----------------------
-- Reserve_Capacity --
----------------------
procedure Reserve_Capacity
(Container : in out Vector;
Capacity : Count_Type)
is
N : constant Count_Type := Length (Container);
begin
if Capacity = 0 then
if N = 0 then
declare
X : Elements_Access := Container.Elements;
begin
Container.Elements := null;
Free (X);
end;
elsif N < Container.Elements'Length then
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
declare
subtype Array_Index_Subtype is Index_Type'Base range
Index_Type'First .. Container.Last;
Src : Elements_Type renames
Container.Elements (Array_Index_Subtype);
subtype Array_Subtype is
Elements_Type (Array_Index_Subtype);
X : Elements_Access := Container.Elements;
begin
Container.Elements := new Array_Subtype'(Src);
Free (X);
end;
end if;
return;
end if;
if Container.Elements = null then
declare
Last_As_Int : constant Int'Base :=
Int (Index_Type'First) + Int (Capacity) - 1;
begin
if Last_As_Int > Index_Type'Pos (Index_Type'Last) then
raise Constraint_Error with "new length is out of range";
end if;
declare
Last : constant Index_Type := Index_Type (Last_As_Int);
subtype Array_Subtype is
Elements_Type (Index_Type'First .. Last);
begin
Container.Elements := new Array_Subtype;
end;
end;
return;
end if;
if Capacity <= N then
if N < Container.Elements'Length then
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
declare
subtype Array_Index_Subtype is Index_Type'Base range
Index_Type'First .. Container.Last;
Src : Elements_Type renames
Container.Elements (Array_Index_Subtype);
subtype Array_Subtype is
Elements_Type (Array_Index_Subtype);
X : Elements_Access := Container.Elements;
begin
Container.Elements := new Array_Subtype'(Src);
Free (X);
end;
end if;
return;
end if;
if Capacity = Container.Elements'Length then
return;
end if;
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
declare
Last_As_Int : constant Int'Base :=
Int (Index_Type'First) + Int (Capacity) - 1;
begin
if Last_As_Int > Index_Type'Pos (Index_Type'Last) then
raise Constraint_Error with "new length is out of range";
end if;
declare
Last : constant Index_Type := Index_Type (Last_As_Int);
subtype Array_Subtype is
Elements_Type (Index_Type'First .. Last);
X : Elements_Access := Container.Elements;
begin
Container.Elements := new Array_Subtype;
declare
Src : Elements_Type renames
X (Index_Type'First .. Container.Last);
Tgt : Elements_Type renames
Container.Elements (Index_Type'First .. Container.Last);
begin
Tgt := Src;
end;
Free (X);
end;
end;
end Reserve_Capacity;
----------------------
-- Reverse_Elements --
----------------------
procedure Reverse_Elements (Container : in out Vector) is
begin
if Container.Length <= 1 then
return;
end if;
if Container.Lock > 0 then
raise Program_Error with
"attempt to tamper with cursors (vector is locked)";
end if;
declare
I : Index_Type;
J : Index_Type;
E : Elements_Type renames Container.Elements.all;
begin
I := Index_Type'First;
J := Container.Last;
while I < J loop
declare
EI : constant Element_Access := E (I);
begin
E (I) := E (J);
E (J) := EI;
end;
I := I + 1;
J := J - 1;
end loop;
end;
end Reverse_Elements;
------------------
-- Reverse_Find --
------------------
function Reverse_Find
(Container : Vector;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor
is
Last : Index_Type'Base;
begin
if Position.Container /= null
and then Position.Container /= Container'Unchecked_Access
then
raise Program_Error with "Position cursor denotes wrong container";
end if;
if Position.Container = null
or else Position.Index > Container.Last
then
Last := Container.Last;
else
Last := Position.Index;
end if;
for Indx in reverse Index_Type'First .. Last loop
if Container.Elements (Indx) /= null
and then Container.Elements (Indx).all = Item
then
return (Container'Unchecked_Access, Indx);
end if;
end loop;
return No_Element;
end Reverse_Find;
------------------------
-- Reverse_Find_Index --
------------------------
function Reverse_Find_Index
(Container : Vector;
Item : Element_Type;
Index : Index_Type := Index_Type'Last) return Extended_Index
is
Last : Index_Type'Base;
begin
if Index > Container.Last then
Last := Container.Last;
else
Last := Index;
end if;
for Indx in reverse Index_Type'First .. Last loop
if Container.Elements (Indx) /= null
and then Container.Elements (Indx).all = Item
then
return Indx;
end if;
end loop;
return No_Index;
end Reverse_Find_Index;
---------------------
-- Reverse_Iterate --
---------------------
procedure Reverse_Iterate
(Container : Vector;
Process : not null access procedure (Position : Cursor))
is
V : Vector renames Container'Unrestricted_Access.all;
B : Natural renames V.Busy;
begin
B := B + 1;
begin
for Indx in reverse Index_Type'First .. Container.Last loop
Process (Cursor'(Container'Unchecked_Access, Indx));
end loop;
exception
when others =>
B := B - 1;
raise;
end;
B := B - 1;
end Reverse_Iterate;
----------------
-- Set_Length --
----------------
procedure Set_Length
(Container : in out Vector;
Length : Count_Type)
is
N : constant Count_Type := Indefinite_Vectors.Length (Container);
begin
if Length = N then
return;
end if;
if Container.Busy > 0 then
raise Program_Error with
"attempt to tamper with elements (vector is busy)";
end if;
if Length < N then
for Index in 1 .. N - Length loop
declare
J : constant Index_Type := Container.Last;
X : Element_Access := Container.Elements (J);
begin
Container.Elements (J) := null;
Container.Last := J - 1;
Free (X);
end;
end loop;
return;
end if;
if Length > Capacity (Container) then
Reserve_Capacity (Container, Capacity => Length);
end if;
declare
Last_As_Int : constant Int'Base :=
Int (Index_Type'First) + Int (Length) - 1;
begin
Container.Last := Index_Type (Last_As_Int);
end;
end Set_Length;
----------
-- Swap --
----------
procedure Swap
(Container : in out Vector;
I, J : Index_Type)
is
begin
if I > Container.Last then
raise Constraint_Error with "I index is out of range";
end if;
if J > Container.Last then
raise Constraint_Error with "J index is out of range";
end if;
if I = J then
return;
end if;
if Container.Lock > 0 then
raise Program_Error with
"attempt to tamper with cursors (vector is locked)";
end if;
declare
EI : Element_Access renames Container.Elements (I);
EJ : Element_Access renames Container.Elements (J);
EI_Copy : constant Element_Access := EI;
begin
EI := EJ;
EJ := EI_Copy;
end;
end Swap;
procedure Swap
(Container : in out Vector;
I, J : Cursor)
is
begin
if I.Container = null then
raise Constraint_Error with "I cursor has no element";
end if;
if J.Container = null then
raise Constraint_Error with "J cursor has no element";
end if;
if I.Container /= Container'Unrestricted_Access then
raise Program_Error with "I cursor denotes wrong container";
end if;
if J.Container /= Container'Unrestricted_Access then
raise Program_Error with "J cursor denotes wrong container";
end if;
Swap (Container, I.Index, J.Index);
end Swap;
---------------
-- To_Cursor --
---------------
function To_Cursor
(Container : Vector;
Index : Extended_Index) return Cursor
is
begin
if Index not in Index_Type'First .. Container.Last then
return No_Element;
end if;
return Cursor'(Container'Unchecked_Access, Index);
end To_Cursor;
--------------
-- To_Index --
--------------
function To_Index (Position : Cursor) return Extended_Index is
begin
if Position.Container = null then
return No_Index;
end if;
if Position.Index <= Position.Container.Last then
return Position.Index;
end if;
return No_Index;
end To_Index;
---------------
-- To_Vector --
---------------
function To_Vector (Length : Count_Type) return Vector is
begin
if Length = 0 then
return Empty_Vector;
end if;
declare
First : constant Int := Int (Index_Type'First);
Last_As_Int : constant Int'Base := First + Int (Length) - 1;
Last : Index_Type;
Elements : Elements_Access;
begin
if Last_As_Int > Index_Type'Pos (Index_Type'Last) then
raise Constraint_Error with "Length is out of range";
end if;
Last := Index_Type (Last_As_Int);
Elements := new Elements_Type (Index_Type'First .. Last);
return (Controlled with Elements, Last, 0, 0);
end;
end To_Vector;
function To_Vector
(New_Item : Element_Type;
Length : Count_Type) return Vector
is
begin
if Length = 0 then
return Empty_Vector;
end if;
declare
First : constant Int := Int (Index_Type'First);
Last_As_Int : constant Int'Base := First + Int (Length) - 1;
Last : Index_Type'Base;
Elements : Elements_Access;
begin
if Last_As_Int > Index_Type'Pos (Index_Type'Last) then
raise Constraint_Error with "Length is out of range";
end if;
Last := Index_Type (Last_As_Int);
Elements := new Elements_Type (Index_Type'First .. Last);
Last := Index_Type'First;
begin
loop
Elements (Last) := new Element_Type'(New_Item);
exit when Last = Elements'Last;
Last := Last + 1;
end loop;
exception
when others =>
for J in Index_Type'First .. Last - 1 loop
Free (Elements (J));
end loop;
Free (Elements);
raise;
end;
return (Controlled with Elements, Last, 0, 0);
end;
end To_Vector;
--------------------
-- Update_Element --
--------------------
procedure Update_Element
(Container : in out Vector;
Index : Index_Type;
Process : not null access procedure (Element : in out Element_Type))
is
B : Natural renames Container.Busy;
L : Natural renames Container.Lock;
begin
if Index > Container.Last then
raise Constraint_Error with "Index is out of range";
end if;
if Container.Elements (Index) = null then
raise Constraint_Error with "element is null";
end if;
B := B + 1;
L := L + 1;
begin
Process (Container.Elements (Index).all);
exception
when others =>
L := L - 1;
B := B - 1;
raise;
end;
L := L - 1;
B := B - 1;
end Update_Element;
procedure Update_Element
(Container : in out Vector;
Position : Cursor;
Process : not null access procedure (Element : in out Element_Type))
is
begin
if Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error with "Position cursor denotes wrong container";
end if;
Update_Element (Container, Position.Index, Process);
end Update_Element;
-----------
-- Write --
-----------
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Container : Vector)
is
N : constant Count_Type := Length (Container);
begin
Count_Type'Base'Write (Stream, N);
if N = 0 then
return;
end if;
declare
E : Elements_Type renames Container.Elements.all;
begin
for Indx in Index_Type'First .. Container.Last loop
-- There's another way to do this. Instead a separate
-- Boolean for each element, you could write a Boolean
-- followed by a count of how many nulls or non-nulls
-- follow in the array. ???
if E (Indx) = null then
Boolean'Write (Stream, False);
else
Boolean'Write (Stream, True);
Element_Type'Output (Stream, E (Indx).all);
end if;
end loop;
end;
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Position : Cursor)
is
begin
raise Program_Error with "attempt to stream vector cursor";
end Write;
end Ada.Containers.Indefinite_Vectors;
|
oeis/091/A091722.asm | neoneye/loda-programs | 11 | 84516 | ; A091722: Babylonian sexagesimal (base 60) expansion of 1/13.
; Submitted by <NAME>
; 4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55,23,4,36,55
mov $1,2
mov $2,1
lpb $0
sub $0,1
sub $2,1
add $2,$1
sub $1,$2
add $1,21
add $2,10
add $2,$1
lpe
mov $0,$2
add $0,3
|
src/game_level/game_level_ui.asm | TypeDefinition/NautiBuoy | 2 | 167074 | INCLUDE "./src/include/hardware.inc"
INCLUDE "./src/include/util.inc"
INCLUDE "./src/definitions/definitions.inc"
; UI Tile Index
DEF UTI_PLAYER_HP EQU $07
DEF UTI_NUM_ENEMIES EQU $0A
DEF UTI_GAME_TIMER EQU $01
DEF UTI_SPEED_POWERUP EQU $0F
DEF UTI_TORPEDO_POWERUP EQU $10
DEF UTI_INVINCIBILITY_POWERUP EQU $11
SECTION "Game Level UI", ROM0
LCDOn:
ld a, LCDCF_ON | LCDCF_WIN9C00 | LCDCF_WINON | LCDCF_BG9800 | LCDCF_OBJ16 | LCDCF_OBJON | LCDCF_BGON
ld [hLCDC], a ; Store a copy of the flags in HRAM.
ld [rLCDC], a
ret
LoadGameLevelUI::
set_romx_bank BANK(GameLevelUITileMap)
mem_copy GameLevelUITileMap, _SCRN1, GameLevelUITileMap.end-GameLevelUITileMap
ld a, 7
ld [rWX], a
ld a, VIEWPORT_SIZE_Y
ld [rWY], a
ret
PauseUI::
ld a, 7
ld [rWX], a
ld a, PAUSE_VIEWPORT_SIZE_Y
ld [rWY], a
ret
ResumeUI::
ld a, 7
ld [rWX], a
ld a, VIEWPORT_SIZE_Y
ld [rWY], a
ret
UpdateGameTimerUI::
push af
push bc
; Thousands Place
ld a, [wGameTimer]
swap a
and a, $0F
add a, "0"
ld bc, UTI_GAME_TIMER
call QueueWindowTile
; Hundreds Place
ld a, [wGameTimer]
and a, $0F
add a, "0"
ld bc, UTI_GAME_TIMER + 1
call QueueWindowTile
; Tens Place
ld a, [wGameTimer+1]
swap a
and a, $0F
add a, "0"
ld bc, UTI_GAME_TIMER + 2
call QueueWindowTile
; Ones Place
ld a, [wGameTimer+1]
and a, $0F
add a, "0"
ld bc, UTI_GAME_TIMER + 3
call QueueWindowTile
pop bc
pop af
ret
UpdatePlayerHPUI::
push af ; Do not remove this. Will break stuff.
push bc ; Do not remove this. Will break stuff.
ld a, [wPlayer_HP]
add a, "0"
ld bc, UTI_PLAYER_HP
call QueueWindowTile
pop bc
pop af
ret
UpdateEnemyCounterUI::
push af ; Do not remove this. Will break stuff.
push bc ; Do not remove this. Will break stuff.
ld a, [wCurrLevelEnemiesNo]
add a, "0"
ld bc, UTI_NUM_ENEMIES
call QueueWindowTile
pop bc
pop af
ret
EnableSpeedPowerUpUI::
push af ; Do not remove this. Will break stuff.
push bc ; Do not remove this. Will break stuff.
ld a, SPEED_POWERUP_TILE_VALUE
ld bc, UTI_SPEED_POWERUP
call QueueWindowTile
pop bc
pop af
ret
DisableSpeedPowerUpUI::
push af ; Do not remove this. Will break stuff.
push bc ; Do not remove this. Will break stuff.
ld a, EMPTY_TILE_VALUE
ld bc, UTI_SPEED_POWERUP
call QueueWindowTile
pop bc
pop af
ret
EnableTorpedoPowerUpUI::
push af ; Do not remove this. Will break stuff.
push bc ; Do not remove this. Will break stuff.
ld a, TORPEDO_POWERUP_TILE_VALUE
ld bc, UTI_TORPEDO_POWERUP
call QueueWindowTile
pop bc
pop af
ret
DisableTorpedoPowerUpUI::
push af ; Do not remove this. Will break stuff.
push bc ; Do not remove this. Will break stuff.
ld a, EMPTY_TILE_VALUE
ld bc, UTI_TORPEDO_POWERUP
call QueueWindowTile
pop bc
pop af
ret
EnableInvincibilityPowerUpUI::
push af ; Do not remove this. Will break stuff.
push bc ; Do not remove this. Will break stuff.
ld a, INVINCIBILITY_POWERUP_TILE_VALUE
ld bc, UTI_INVINCIBILITY_POWERUP
call QueueWindowTile
pop bc
pop af
ret
DisableInvincibilityPowerUpUI::
push af ; Do not remove this. Will break stuff.
push bc ; Do not remove this. Will break stuff.
ld a, EMPTY_TILE_VALUE
ld bc, UTI_INVINCIBILITY_POWERUP
call QueueWindowTile
pop bc
pop af
ret |
lib/resources/graphqloperation.g4 | guypeled76/petitparser_extras | 0 | 2407 | grammar GraphqlOperation;
import GraphqlCommon;
operationDefinition:
selectionSet |
operationType name? variableDefinitions? directives? selectionSet;
variableDefinitions : '(' variableDefinition+ ')';
variableDefinition : variable ':' type defaultValue?;
selectionSet : '{' selection+ '}';
selection :
field |
fragmentSpread |
inlineFragment;
field : alias? name arguments? directives? selectionSet?;
alias : name ':';
fragmentSpread : '...' fragmentName directives?;
inlineFragment : '...' typeCondition? directives? selectionSet;
fragmentDefinition : FRAGMENT fragmentName typeCondition directives? selectionSet;
typeCondition : ON_KEYWORD typeName; |
1571/64tass/lccseek.asm | silverdr/assembly | 23 | 175450 | ;
;
;
seak ldx #90 ; search 90 headers
stx tmp
;
ldx #0 ; read in 8 gcr bytes
;
lda #$52 ; header block id
sta stab
;
seek10 jsr sync ; find sync char
;
bvc * ; wait for block id
clv
;
lda data2
cmp stab ; test if header block
bne seek20 ; not header
;
seek15 bvc *
clv ; read in gcr header
;
lda data2
sta stab+1,x
;
inx
cpx #7
bne seek15
;
jsr cnvbin ; convert header in stab to binary in header
;
ldy #4 ; compute checksum
lda #0
;
seek30 eor header,y
dey
bpl seek30
;
cmp #0 ; test if ok
bne cserr ; nope, checksum error in header
;
ldx cdrive ; update drive track#
lda header+2
sta drvtrk,x
;
lda job ; test if a seek job
cmp #$30
beq eseek
;
lda cdrive
asl a ; test if correct id
tay
lda dskid,y
cmp header
bne badid
lda dskid+1,y
cmp header+1
bne badid
;
jmp wsect ; find best sector to service
;
;
seek20 dec tmp ; search more?
bne seek10 ; yes
;
lda #2 ; cant find a sector
jsr errr
;
;
eseek lda header ; harris fix....
sta dskid ; ....
lda header+1 ; ....
sta dskid+1 ; ....
;
done lda #1 ; return ok code
.byte skip2
;
badid lda #11 ; disk id mismatch
.byte skip2
;
cserr lda #9 ; checksum error in header
jmp errr
;
;
;
wsect lda #$7f ; find best job
sta csect
;
lda header+3 ; get upcoming sector #
clc
adc #2
cmp sectr
bcc l460
;
sbc sectr ; wrap around
;
l460 sta nexts ; next sector
;
ldx #numjob-1
stx jobn
;
ldx #$ff
;
l480 jsr setjb
bpl l470
;
sta work
and #1
cmp cdrive ; test if same drive
bne l470 ; nope
;
ldy #0 ; test if same track
lda (hdrpnt),y
cmp tracc
bne l470
;
lda job ; test if execute job
cmp #execd
beq l465
;
ldy #1
sec
lda (hdrpnt),y
sbc nexts
bpl l465
;
clc
adc sectr
;
l465 cmp csect
bcs l470
;
pha ; save it
lda job
beq tstrdj ; must be a read
;
pla
cmp #wrtmin ; +if(csect<4)return;
bcc l470 ; +if(csect>8)return;
;
cmp #wrtmax
bcs l470
;
doitt sta csect ; its better
lda jobn
tax
adc #>bufs
sta bufpnt+1
;
bne l470
;
tstrdj pla
cmp #rdmax ; if(csect>6)return;
bcc doitt
;
;
l470 dec jobn
bpl l480
;
txa ; test if a job to do
bpl l490
;
jmp end ; no job found
;
l490 stx jobn
jsr setjb
lda job
jmp reed
;
;
;
;
cnvbin lda bufpnt
pha
lda bufpnt+1
pha ; save buffer pntr
;
lda #<stab
sta bufpnt ; point at gcr code
lda #>stab
sta bufpnt+1
;
lda #0
sta gcrpnt
;
jsr get4gb ; convert 4 bytes
;
lda btab+3
sta header+2
;
lda btab+2
sta header+3
;
lda btab+1
sta header+4
;
;
jsr get4gb ; get 2 more
;
lda btab ; get id
sta header+1
lda btab+1
sta header
;
pla
sta bufpnt+1 ; restore pointer
pla
sta bufpnt
;
rts
;
;
;
;
;
;
;
;.end
|
test/Succeed/Issue709.agda | shlevy/agda | 3 | 14870 | <filename>test/Succeed/Issue709.agda
-- {-# OPTIONS --sized-types #-} -- no longer necessary
-- {-# OPTIONS --termination-depth=2 #-} -- not necessary!
-- {-# OPTIONS -v tc.size.solve:60 --show-implicit #-}
-- {-# OPTIONS -v term:5 #-}
module Issue709 where
open import Common.Size
data Bool : Set where true false : Bool
postulate
A : Set
_<=_ : A → A → Bool
data List {i : Size} : Set where
[] : List
cons : (j : Size< i) → A → List {j} → List {i}
module If where
if_then_else_ : {A : Set} → Bool → A → A → A
if true then t else e = t
if false then t else e = e
merge : ∀ {i j} → List {i} → List {j} → List -- {∞}
merge {i} {j} [] ys = ys
merge {i} {j} (cons i' x xs) [] = cons _ x xs
merge {i} {j} (cons i' x xs) (cons j' y ys) =
if x <= y
then cons _ x (merge xs (cons _ y ys))
else cons _ y (merge (cons _ x xs) ys)
module Succeeds where
merge : ∀ {i j} → List {i} → List {j} → List
merge [] ys = ys
merge (cons i' x xs) [] = cons _ x xs
merge {i} {j} (cons i' x xs) (cons j' y ys) with x <= y
... | true = cons _ x (merge {i'} {j} -- removing this implicit application makes it not termination check
xs (cons _ y ys))
... | false = cons _ y (merge (cons _ x xs) ys)
module NeedsTerminationDepthTwo where
merge : ∀ {i j} → List {i} → List {j} → List
merge [] ys = ys
merge (cons j x xs) [] = cons _ x xs
merge {i} {i'} (cons j x xs) (cons j' y ys) with x <= y
... | true = cons _ x (merge xs (cons _ y ys))
... | false = cons _ y (merge (cons _ x xs) ys)
|
examples/STM32F4_DISCO/accelerometer/src/main.adb | morbos/Ada_Drivers_Library | 2 | 17455 | <filename>examples/STM32F4_DISCO/accelerometer/src/main.adb
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- This is a demo of the features available on the STM32F4-DISCOVERY board.
--
-- Tilt the board and the LED closer to the ground will light up. Press the
-- blue button to enter sound mode where a two tone audio is played in the
-- headphone jack. Press the black button to reset.
with Ada.Real_Time; use Ada.Real_Time;
with HAL; use HAL;
with STM32.Board; use STM32.Board;
with STM32.User_Button;
with LIS3DSH; use LIS3DSH;
with HAL.Audio; use HAL.Audio;
with Simple_Synthesizer;
with CS43L22;
procedure Main is
Values : LIS3DSH.Axes_Accelerations;
Threshold_High : constant LIS3DSH.Axis_Acceleration := 200;
Threshold_Low : constant LIS3DSH.Axis_Acceleration := -200;
procedure My_Delay (Milli : Natural);
procedure My_Delay (Milli : Natural) is
begin
delay until Clock + Milliseconds (Milli);
end My_Delay;
Synth : Simple_Synthesizer.Synthesizer;
Audio_Data : Audio_Buffer (1 .. 128);
begin
Initialize_LEDs;
STM32.User_Button.Initialize;
Initialize_Audio;
Synth.Set_Frequency (STM32.Board.Audio_Rate);
STM32.Board.Audio_DAC.Set_Volume (60);
Initialize_Accelerometer;
Accelerometer.Configure
(Output_DataRate => Data_Rate_100Hz,
Axes_Enable => XYZ_Enabled,
SPI_Wire => Serial_Interface_4Wire,
Self_Test => Self_Test_Normal,
Full_Scale => Fullscale_2g,
Filter_BW => Filter_800Hz);
if Accelerometer.Device_Id /= I_Am_LIS3DSH then
All_LEDs_On;
My_Delay (100);
All_LEDs_Off;
My_Delay (100);
else
loop
Accelerometer.Get_Accelerations (Values);
if abs Values.X > abs Values.Y then
if Values.X > Threshold_High then
STM32.Board.Red_LED.Set;
elsif Values.X < Threshold_Low then
STM32.Board.Green_LED.Set;
end if;
My_Delay (10);
else
if Values.Y > Threshold_High then
STM32.Board.Orange_LED.Set;
elsif Values.Y < Threshold_Low then
STM32.Board.Blue_LED.Set;
end if;
My_Delay (10);
end if;
if STM32.User_Button.Has_Been_Pressed then
-- Go to the sound loop
exit;
end if;
All_LEDs_Off;
end loop;
end if;
STM32.Board.Audio_DAC.Play;
loop
for Cnt in 1 .. 1_000 loop
if Cnt < 500 then
Synth.Set_Note_Frequency (440.0);
All_LEDs_On;
else
Synth.Set_Note_Frequency (880.0);
All_LEDs_Off;
end if;
Synth.Receive (Audio_Data);
STM32.Board.Audio_I2S.Transmit (Audio_Data);
end loop;
end loop;
end Main;
|
programs/oeis/100/A100160.asm | neoneye/loda | 22 | 12412 | ; A100160: Structured disdyakis triacontahedral numbers (vertex structure 5).
; 1,62,299,828,1765,3226,5327,8184,11913,16630,22451,29492,37869,47698,59095,72176,87057,103854,122683,143660,166901,192522,220639,251368,284825,321126,360387,402724,448253,497090,549351,605152,664609,727838,794955,866076,941317,1020794,1104623,1192920,1285801,1383382,1485779,1593108,1705485,1823026,1945847,2074064,2207793,2347150,2492251,2643212,2800149,2963178,3132415,3307976,3489977,3678534,3873763,4075780,4284701,4500642,4723719,4954048,5191745,5436926,5689707,5950204,6218533,6494810,6779151,7071672,7372489,7681718,7999475,8325876,8661037,9005074,9358103,9720240,10091601,10472302,10862459,11262188,11671605,12090826,12519967,12959144,13408473,13868070,14338051,14818532,15309629,15811458,16324135,16847776,17382497,17928414,18485643,19054300
mov $1,$0
mov $2,$0
mov $7,$0
lpb $2
add $0,11
add $0,$1
add $1,$2
sub $2,1
lpe
add $0,1
mov $3,$7
mov $5,$7
lpb $5
sub $5,1
add $6,$3
lpe
mov $3,$6
mov $4,29
lpb $4
add $0,$3
sub $4,1
lpe
mov $5,$7
mov $6,0
lpb $5
sub $5,1
add $6,$3
lpe
mov $3,$6
mov $4,19
lpb $4
add $0,$3
sub $4,1
lpe
|
examples/antlr4/Cpp/src/antlr4/TParser.g4 | movelazar/rules_antlr | 25 | 3774 | parser grammar TParser;
options {
tokenVocab = TLexer;
}
// These are all supported parser sections:
// Parser file header. Appears at the top in all parser related files. Use e.g. for copyrights.
@parser::header {/* parser/listener/visitor header section */}
// Appears before any #include in h + cpp files.
@parser::preinclude {/* parser precinclude section */}
// Follows directly after the standard #includes in h + cpp files.
@parser::postinclude {
/* parser postinclude section */
#ifndef _WIN32
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
}
// Directly preceeds the parser class declaration in the h file (e.g. for additional types etc.).
@parser::context {/* parser context section */}
// Appears in the private part of the parser in the h file.
// The function bodies could also appear in the definitions section, but I want to maximize
// Java compatibility, so we can also create a Java parser from this grammar.
// Still, some tweaking is necessary after the Java file generation (e.g. bool -> boolean).
@parser::members {
/* public parser declarations/members section */
bool myAction() { return true; }
bool doesItBlend() { return true; }
void cleanUp() {}
void doInit() {}
void doAfter() {}
}
// Appears in the public part of the parser in the h file.
@parser::declarations {/* private parser declarations section */}
// Appears in line with the other class member definitions in the cpp file.
@parser::definitions {/* parser definitions section */}
// Additionally there are similar sections for (base)listener and (base)visitor files.
@parser::listenerpreinclude {/* listener preinclude section */}
@parser::listenerpostinclude {/* listener postinclude section */}
@parser::listenerdeclarations {/* listener public declarations/members section */}
@parser::listenermembers {/* listener private declarations/members section */}
@parser::listenerdefinitions {/* listener definitions section */}
@parser::baselistenerpreinclude {/* base listener preinclude section */}
@parser::baselistenerpostinclude {/* base listener postinclude section */}
@parser::baselistenerdeclarations {/* base listener public declarations/members section */}
@parser::baselistenermembers {/* base listener private declarations/members section */}
@parser::baselistenerdefinitions {/* base listener definitions section */}
@parser::visitorpreinclude {/* visitor preinclude section */}
@parser::visitorpostinclude {/* visitor postinclude section */}
@parser::visitordeclarations {/* visitor public declarations/members section */}
@parser::visitormembers {/* visitor private declarations/members section */}
@parser::visitordefinitions {/* visitor definitions section */}
@parser::basevisitorpreinclude {/* base visitor preinclude section */}
@parser::basevisitorpostinclude {/* base visitor postinclude section */}
@parser::basevisitordeclarations {/* base visitor public declarations/members section */}
@parser::basevisitormembers {/* base visitor private declarations/members section */}
@parser::basevisitordefinitions {/* base visitor definitions section */}
// Actual grammar start.
main: stat+ EOF;
divide : ID (and_ GreaterThan)? {doesItBlend()}?;
and_ @init{ doInit(); } @after { doAfter(); } : And ;
conquer:
divide+
| {doesItBlend()}? and_ { myAction(); }
| ID (LessThan* divide)?? { $ID.text; }
;
// Unused rule to demonstrate some of the special features.
unused[double input = 111] returns [double calculated] locals [int _a, double _b, int _c] @init{ doInit(); } @after { doAfter(); } :
stat
;
catch [...] {
// Replaces the standard exception handling.
}
finally {
cleanUp();
}
unused2:
(unused[1] .)+ (Colon | Semicolon | Plus)? ~Semicolon
;
stat: expr Equal expr Semicolon
| expr Semicolon
;
expr: expr Star expr
| expr Plus expr
| OpenPar expr ClosePar
| <assoc = right> expr QuestionMark expr Colon expr
| <assoc = right> expr Equal expr
| identifier = id
| flowControl
| INT
| String
;
flowControl:
Return expr # Return
| Continue # Continue
;
id: ID;
array : OpenCurly el += INT (Comma el += INT)* CloseCurly;
idarray : OpenCurly element += id (Comma element += id)* CloseCurly;
any: t = .;
|
code/5/move3.asm | GeekHades1/AssemblyCode | 1 | 96601 | <filename>code/5/move3.asm
; move2 的增强
; 使用段超越的方式来减少代码量
assume cs:code
code segment
mov bx, 0
mov cx, 6
mov ax, 0ffffh
mov ds, ax
mov ax, 0020h
mov es, ax ; 段超越
s: mov dx, [bx]
mov es:[bx], dx
inc bx
inc bx
loop s
mov ax, 4c00h
int 21h
code ends
end
|
TEST2/test2.asm | CodyKelly-UCD/CSCI-2525 | 0 | 93860 | TITLE: test2.asm
INCLUDE Irvine32.inc
ClearEAX textequ <mov eax, 0>
ClearEBX textequ <mov ebx, 0>
ClearECX textequ <mov ecx, 0>
ClearEDX textequ <mov edx, 0>
ClearESI textequ <mov esi, 0>
ClearEDI textequ <mov edi, 0>
.data
userChoice byte 0
mainMenuPrompt byte 'MAIN MENU', 0Ah, 0Dh,
'1. Play new game', 0Ah, 0Dh,
'2. Show stats',0Ah, 0Dh,
'3. Exit',0Ah, 0Dh, 0
guessWord byte 14 dup(0)
displayWord byte 28 dup(0)
lettersGuessed byte 11 dup(0)
remainingWordGuesses byte 0
remainingLetterGuesses byte 0
gamesWon byte 0
gamesLost byte 0
.code
main PROC
call ClearRegisters
call Randomize
;call DisplayDirections
startHere:
mov edx, offset mainMenuPrompt
mov ebx, 3
call MenuPrompt
opt1:
; Play new game
cmp al, 1
jne opt2
call clrscr
; Reset game variables
mov ecx, 14
mov edx, offset guessWord
call ClearString
mov edx, offset displayWord
call ClearString
mov ecx, 10
mov edx, offset lettersGuessed
call ClearString
mov remainingWordGuesses, 3
mov remainingLetterGuesses, 10
; Get random word
mov edx, offset guessWord
call GetRandomString
; Update display string
mov edx, offset displayWord
mov eax, offset lettersGuessed
mov ebx, offset guessWord
call UpdateDisplayString
call writeString
jmp starthere
opt2:
; Show stats
cmp al, 2
jne quit
call clrscr
; opt2 stuff here
jmp starthere
quit:
exit
main ENDP
UpdateDisplayString proc
; Description:
; Updates the string that is displayed to the user during gameplay
; Displays an underscore for letters that the user has not guessed yet,
; and displays letters that the user has already correctly guessed.
; Seperates each character with a space
;
; Receives:
; EDX: Offset of display string (displayWord)
; EAX: Offset of string of characters the user has guessed already (lettersGuessed)
; EBX: Offset of string the user is trying to guess (guessWord)
;
; Returns:
; EDX: Offset of updated display string
;
; Requires:
; guessWord must be length of 14 characters, displayWord twice that
.data
currentLetter byte 0
currentGuessedLetter byte 0
displayStringStart byte 'Word: ',0
.code
push ecx
push esi
mov ecx, 14
mov esi, 0
; Display "Word: " before displaying displayWord
push edx
mov edx, offset displayStringStart
call WriteString
pop edx
; Now we find out what to display to the user
loop1Start:
push eax
mov al, byte ptr [ebx + esi]
mov currentLetter, al
pop eax
; If the current character is null, return
cmp currentLetter, 0
jz loop1End
; Now if the current letter is in lettersGuessed, we put that letter in displayWord
push esi
mov esi, -1
loop2Start:
inc esi
push ebx
mov bl, byte ptr [eax + esi]
mov currentGuessedLetter, bl
pop ebx
; If the current character is null, the user hasn't guess this one yet: add an underscore
cmp currentGuessedLetter, 0
jnz loop2Continue
mov currentLetter, '_'
jmp loop2end
loop2Continue:
push eax
mov al, currentGuessedLetter
cmp al, currentLetter
pop eax
jne loop2Start ; If the current letter in lettersGuessed does not equal the one
; in the word the user is trying to guess, move on to the next one
loop2end:
pop esi
push eax
; Add new character to displayWord
push esi
push ebx
; We need to reference displayWord every other character,
; so we multiply esi by 2 temporarily
mov eax, esi
mov bl, 2
mul bl
mov esi, eax
mov al, currentLetter
mov [edx + esi], al
inc esi
; Add a space before next character
mov currentLetter, ' '
mov ah, currentLetter
mov [edx + esi], ah
pop ebx
pop esi
pop eax
inc esi
loop loop1Start
loop1End:
pop esi
pop ecx
ret
UpdateDisplayString endp
GetRandomString proc
; Description:
; Chooses a string for the user to guess
;
; Receives:
; EDX: Offset of string to store result in
;
; Returns:
; EDX: Offset of string
;
; Requires:
; Length of string must be at least 14 characters long
.data
String0 BYTE "kiwi", 0h
String1 BYTE "canoe", 0h
String2 BYTE "doberman", 0h
String3 BYTE "puppy", 0h
String4 BYTE "banana", 0h
String5 BYTE "orange", 0h
String6 BYTE "frigate", 0h
String7 BYTE "ketchup", 0h
String8 BYTE "postal", 0h
String9 BYTE "basket", 0h
String10 BYTE "cabinet", 0h
String11 BYTE "mutt", 0h
String12 BYTE "machine", 0h
String13 BYTE "mississippian", 0h
String14 BYTE "destroyer", 0h
String15 BYTE "zoomies", 0h
String16 BYTE "body", 0h
String17 BYTE "my", 0h
String18 BYTE "three", 0h
String19 BYTE "words", 0h
wordNumber DWORD 0
.code
push eax
; First we're going to choose a random number from 0 - 19
mov eax, 20
call RandomRange
mov wordNumber, eax
mov eax, 0 ; Our word counter
; Now we're going to loop through every letter of every String defined in the
; .data section, incrementing eax each time we come across a null character
; Once wordNumber is equal to eax, we know we're on the first character of
; the word we need.
push esi
mov esi, 0
continue:
; If the word we're on is the one we want, we're done
cmp eax, wordNumber
je done
; See if current character is a null character
cmp String0[esi], 0
jnz continue2 ; If not, continue to next character
; If we've come across a null character, increment eax. We're on the next word.
inc eax
inc esi
jmp continue
continue2:
inc esi
jmp continue
done:
; Now that we've found the start of the word we're looking for, we store the
; word itself into the string at the offset in edx
mov eax, offset String0
add eax, esi
mov esi, 0
push ebx
continue3:
mov bl, byte ptr [eax + esi]
mov [edx + esi], bl
inc esi
cmp bl, 0
jne continue3 ; If we haven't hit a null character, continue moving letters
done2:
pop ebx
pop esi
pop eax
ret
GetRandomString endp
ChangeCase proc
; Description: Converts all lowercase letters in string to uppercase
;
; Receives:
; EDX: Offset of string array
; EBX: Length of string array
;
; Returns:
; EDX: String array with converted letters, if any
push esi
push eax
push ecx
clearESI
movzx ecx, byte ptr [ebx]
letterLoop:
mov al, byte ptr [edx+esi]
cmp al, 'a'
jb keepgoing
cmp al, 'z'
ja keepgoing
sub al, 20h
mov byte ptr [edx+esi], al
keepgoing:
inc esi
loop letterLoop
pop ecx
pop eax
pop esi
ret
ChangeCase endp
ClearRegisters Proc
; Description:
; Clears the registers EAX, EBX, ECX, EDX, ESI, EDI
;
; Requires:
; Nothing
;
; Returns:
; Nothing, but all registers will be cleared.
cleareax
clearebx
clearecx
clearedx
clearesi
clearedi
ret
ClearRegisters ENDP
DisplayDirections proc
.data
ddstring1 byte " __ __ _______ __ _ _______ __ __ _______ __ _ ",0Ah, 0Dh,
"| | | || _ || | | || || |_| || _ || | | |", 0Ah, 0Dh,
"| |_| || |_| || |_| || ___|| || |_| || |_| |", 0Ah, 0Dh,
"| || || || | __ | || || |", 0Ah, 0Dh,
"| || || _ || || || || || _ |", 0Ah, 0Dh,
"| _ || _ || | | || |_| || ||_|| || _ || | | |", 0Ah, 0Dh, 0
ddstring2 byte "|__| |__||__| |__||_| |__||_______||_| |_||__| |__||_| |__|", 0Ah, 0Dh, 0Ah, 0Dh,
"By <NAME>", 0Ah, 0Dh, 0Ah, 0Dh,
"You're somewhere in the western United States, circa 1885. Dust blows around ", 0Ah, 0Dh,
"your feet and the blinding sun beams down onto your head as the ", 0Ah, 0Dh, 0Ah, 0Dh,
"INSTRUCTIONS:", 0Ah, 0Dh,
"You must correctly guess a random mystery word given to you. You may choose ", 0Ah, 0Dh, 0
ddstring3 byte "to either guess letters contained in the word, or, at any time, guess the ", 0Ah, 0Dh,
"whole word at once. BUT! You only have TEN chances to correctly guess a ", 0Ah, 0Dh,
"letter in the word, and you only have THREE chances to correctly guess the ", 0Ah, 0Dh,
"whole word at once. If you run out of letters to guess, you may try and ", 0Ah, 0Dh, 0
ddstring4 byte "guess the word, and vice versa. If you correctly guess every letter in the ", 0Ah, 0Dh,
"word or correctly guess the whole word, you win!! ", 0Ah, 0Dh,
"But if you run out of all your guesses, ", 0Ah, 0Dh, 0Ah, 0Dh,
"well...", 0Ah, 0Dh, 0
.code
push edx
mov edx, offset ddstring1
call writestring
mov edx, offset ddstring2
call writestring
mov edx, offset ddstring3
call writestring
mov edx, offset ddstring4
call writestring
call crlf
call waitmsg
pop edx
ret
DisplayDirections endp
MenuPrompt proc
; Description:
; Displays a menu prompt and receives a choice from 1 to n number of choices
;
; Receives:
; EDX: Offset of prompt
; EBX: Maximum user choice (n)
;
; Returns:
; EAX: User choice
.data
errorMessage byte 'You have entered an invalid option. Please try again.', 0Ah, 0Dh, 0h
.code
call clrscr
push ebx
mov eax, ebx
start:
; Display menu
call WriteString
; Get choice
call ReadHex
; Check if choice is valid
cmp al, bl
ja error
cmp al, 1
jb error
jmp done
error:
call clrscr
push edx
mov edx, offset errormessage
call writestring
call waitmsg
pop edx
call clrscr
jmp start
done:
pop ebx
ret
MenuPrompt endp
ClearString proc
; Description:
; Clears a string
;
; Receives:
; EDX: Offset of string
; ECX: Length of string
push ecx
push esi
mov esi, 0
clearLoop:
mov byte ptr [edx + esi], 0
inc esi
loop clearLoop
pop esi
pop ecx
ret
ClearString endp
END main |
oeis/160/A160220.asm | neoneye/loda-programs | 11 | 88306 | <gh_stars>10-100
; A160220: Numerator of Hermite(n, 19/28).
; Submitted by <NAME>
; 1,19,-31,-15485,-257759,19383059,873485761,-28992725309,-2947706709055,34914759096979,11062889692388641,73329048495226499,-46309928432170516511,-1224828484332785265005,212723654088018032104961,10763608149690668144341699,-1046306531193423334034678399,-87389174407534913947970025709,5312192410129809732995666362465,717549670412032737743794162289539,-25931765332818200874219633984138079,-6118292957353882480521519278048609261,97222726030035662466667160674501090369
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
mul $2,19
mul $3,-196
mul $3,$0
mul $3,2
lpe
mov $0,$1
|
programs/oeis/135/A135072.asm | karttu/loda | 0 | 26991 | <reponame>karttu/loda
; A135072: Minimal values of m associated with A135061.
; 1,3,4,6,9,13,15,19,23,28,36,37,44,50,52,57,63,73,78,87,90,96,104,109,115,123,133,139,147,157,162,169,178,189,195,202,212,224,230,251,248,260,278,284,294,310,309,316,325,337,351,371,376,385,399,401,419,427,437,451,469,472,480,490,503,519,540,545,554,567,582,603,606,614,626,639,655,677,681,691,703,717,735,757,761,771,807,798,815,837,842,872,882,896,916,914,938,945,956,969,985,1004,1027,1032,1064,1073,1087,1106,1135,1128,1160,1164,1175,1190,1209,1231,1233,1260,1268,1281,1296,1313,1333,1358,1363,1394,1404,1417,1434,1455,1480,1481,1512,1520,1532,1548,1566,1588,1613,1617,1648,1657,1671,1687,1707,1729,1755,1798,1791,1801,1814,1866,1850,1872,1898,1934,1934,1944,1987,2001,2020,2045,2038,2067,2108,2107,2118,2133,2151,2172,2196,2224,2262,2260,2269,2314,2327,2346,2369,2401,2392,2426,2431,2474,2483,2499,2518,2541,2568,2607,2599,2642,2645,2657,2673,2693,2715,2740,2770,2809,2807,2856,2859,2873,2891,2912,2938,2968,3010,3001,3048,3050,3062,3078,3098,3121,3148,3178,3217,3215,3261,3266,3279,3297,3318,3342,3369,3400,3440,3438,3484,3490,3504,3521,3592,3566,3593,3624,3662,3662,3706,3713,3782,3785,3802,3826,3856,3845,3878,3919
add $0,1
pow $0,3
mov $1,$0
mul $0,3
mov $2,1
lpb $0,1
mov $0,$1
div $0,$2
add $2,1
lpe
div $1,$2
add $1,1
|
Transynther/x86/_processed/P/_zr_/i3-7100_9_0xca_notsx.log_5_1832.asm | ljhsiun2/medusa | 9 | 175541 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1d482, %rax
nop
nop
nop
nop
nop
cmp %r12, %r12
mov (%rax), %r8w
inc %rsi
lea addresses_normal_ht+0x1d902, %r12
nop
nop
nop
nop
cmp $26397, %r8
movl $0x61626364, (%r12)
xor %rsi, %rsi
lea addresses_WC_ht+0xd882, %rsi
lea addresses_UC_ht+0x65e8, %rdi
clflush (%rdi)
nop
inc %r12
mov $27, %rcx
rep movsb
nop
nop
nop
sub $48375, %rax
lea addresses_A_ht+0x1baf2, %rsi
nop
nop
nop
nop
nop
add $16888, %r12
and $0xffffffffffffffc0, %rsi
movntdqa (%rsi), %xmm0
vpextrq $0, %xmm0, %r8
sub $32143, %r15
lea addresses_WC_ht+0x1e982, %rdi
nop
nop
xor %rcx, %rcx
mov (%rdi), %r12
nop
add %r15, %r15
lea addresses_WC_ht+0x1cd8e, %rsi
lea addresses_D_ht+0x2582, %rdi
nop
nop
nop
dec %r13
mov $123, %rcx
rep movsb
dec %r8
lea addresses_WC_ht+0x15102, %r8
nop
nop
add $40122, %rcx
movw $0x6162, (%r8)
nop
nop
nop
nop
and $6836, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %r9
push %rbx
push %rdi
// Faulty Load
mov $0x582, %r10
nop
nop
nop
sub $6994, %r13
movups (%r10), %xmm2
vpextrq $1, %xmm2, %rdi
lea oracles, %r15
and $0xff, %rdi
shlq $12, %rdi
mov (%r15,%rdi,1), %rdi
pop %rdi
pop %rbx
pop %r9
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_P', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_P', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'src': {'same': False, 'congruent': 1, 'NT': True, 'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': True, 'congruent': 10, 'NT': False, 'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 6, 'NT': False, 'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False}}
{'00': 5}
00 00 00 00 00
*/
|
libsrc/_DEVELOPMENT/math/float/math48/lm/z80/asm_dsub_s.asm | meesokim/z88dk | 0 | 21026 |
SECTION code_fp_math48
PUBLIC asm_dsub_s
EXTERN am48_dsub_s
defc asm_dsub_s = am48_dsub_s
|
alloy4fun_models/trashltl/models/5/QWzjoT2LF8kgtLjC8.als | Kaixi26/org.alloytools.alloy | 0 | 3091 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idQWzjoT2LF8kgtLjC8_prop6 {
all f:File | f in Trash implies (always f in Trash)
}
pred __repair { idQWzjoT2LF8kgtLjC8_prop6 }
check __repair { idQWzjoT2LF8kgtLjC8_prop6 <=> prop6o } |
ch06/6_2.asm | zzb610/asm-learn | 0 | 20520 | assume cs:code
code segment
dw 0123h, 0456h, 0789h, 0abch, 0defh, 0fedh, 0cbah, 0987h
start:
mov bx, 0
mov ax, 0
s:
add ax, cs:[bx]
add bx, 2
loop s
mov ax, 4c00h
int 21
code ends
end start |
file_crypter.ads | python36/vibecrypt | 0 | 30632 | with byte_package; use byte_package;
with raiden;
package file_crypter is
subtype key_s is raiden.key_s;
type mode is (encrypt, decrypt);
procedure init_key(key : raiden.key_s);
procedure file_crypt(in_file : byte_io.File_Type; out_file : out byte_io.File_Type; mode_crypt : mode);
end file_crypter;
|
flame32-libs/unit-tests/test-mov-1.asm | drako0812/flame32 | 2 | 240254 | <gh_stars>1-10
#include "../../flame32.asm"
; Tests MOV
lod 0x12345678
mov B, A
|
programs/oeis/031/A031378.asm | neoneye/loda | 22 | 165055 | <reponame>neoneye/loda
; A031378: a(n) = prime(4*n - 2).
; 3,13,29,43,61,79,101,113,139,163,181,199,229,251,271,293,317,349,373,397,421,443,463,491,521,557,577,601,619,647,673,701,733,757,787,821,839,863,887,929,953,983,1013,1033,1061,1091,1109,1151,1181,1213,1231,1277,1291,1307,1361,1399,1429,1451,1481,1493,1531,1559,1583,1609,1627,1667,1699,1733,1759,1789,1831,1871,1889,1931,1973,1997,2017,2053,2083,2111,2137,2161,2213,2243,2273,2297,2339,2357,2383,2411,2441,2473,2531,2551,2593,2633,2663,2687,2707,2729
mul $0,4
seq $0,98090 ; Numbers k such that 2k-3 is prime.
mul $0,2
sub $0,3
|
programs/oeis/094/A094012.asm | neoneye/loda | 22 | 167092 | <gh_stars>10-100
; A094012: Expansion of x(1-6x+10x^2)/(1-4x+2x^2)^2.
; 0,1,2,6,24,100,408,1624,6336,24336,92320,346720,1291392,4776512,17562496,64245120,233969664,848748800,3068269056,11057710592,39740405760,142466343936,509572929536,1818872207360,6480018948096,23046008934400,81831356112896,290135484555264,1027272821342208,3632590541701120,12830110235197440,45264894250811392,159529306684391424,561687970055258112,1975835493826428928,6944333879453286400,24386851453244276736,85574750057890316288,300066971494183862272,1051453058529759854592,3681933633467669544960,12885180440821539799040,45065751907718349717504,157527532346679675060224,550340373138344364736512,1921683646933368852971520,6706839222616064931135488,23396376683087933525196800,81579805870762693767462912,284333606278466443122049024,990587402851420346305740800,3449718484441885274183565312,12009018295479087582236639232,41789840695503854942625464320,145371505794113570897985011712,505520651232729328550422773760,1757336471925708539196742828032,6107063480674883457162745479168,21216622803432111846581931606016,73687013759839644942346737418240,255847323813170223764952223580160,888076026240783146989342964056064,3081787462606566572306919313113088,10691588302008234639138343851393024,37082784288534395123738043079458816,128586803564852400776090804761395200,445777005729836791670951400871821312
mov $1,$0
sub $1,1
lpb $1
add $0,$2
sub $1,1
mul $2,2
add $2,$0
lpe
|
oeis/195/A195062.asm | neoneye/loda-programs | 11 | 2797 | ; A195062: Period 7: repeat [1, 0, 1, 0, 1, 0, 1].
; Submitted by <NAME>
; 1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0
mod $0,7
add $0,1
mod $0,2
|
oeis/079/A079935.asm | neoneye/loda-programs | 11 | 3953 | <filename>oeis/079/A079935.asm
; A079935: a(n) = 4*a(n-1) - a(n-2) with a(1) = 1, a(2) = 3.
; 1,3,11,41,153,571,2131,7953,29681,110771,413403,1542841,5757961,21489003,80198051,299303201,1117014753,4168755811,15558008491,58063278153,216695104121,808717138331,3018173449203,11263976658481,42037733184721,156886956080403,585510091136891,2185153408467161,8155103542731753,30435260762459851,113585939507107651,423908497265970753,1582048049556775361,5904283700961130691,22035086754287747403,82236063316189858921,306909166510471688281,1145400602725696894203,4274693244392315888531
mov $1,1
lpb $0
sub $0,1
add $2,$1
add $1,$2
add $1,$2
lpe
mov $0,$1
|
src/test/resources/testData/parse/handlers/left_associate.scpt | stigger/AppleScript-IDEA | 18 | 1817 | <reponame>stigger/AppleScript-IDEA
tell application "App Store"
character "" exists
character exists
"" exists
ddjdjdj exists
end tell |
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/mak.lzh/mak/kart-apu-j.asm | prismotizm/gigaleak | 0 | 15704 | Name: kart-apu-j.asm
Type: file
Size: 33825
Last-Modified: '1993-04-13T08:06:59Z'
SHA-1: 51BE152C871C014D36AD708242749C815DC0E02C
Description: null
|
oeis/185/A185009.asm | neoneye/loda-programs | 11 | 100914 | <filename>oeis/185/A185009.asm
; A185009: Row sums of A051949 (differences of factorial numbers), seen as a triangle.
; 0,5,45,351,2847,25047,241047,2534247,28984167,358842087,4785978087,68453274087,1045616538087,16993016806887,292825130163687,5333909818803687,102415654899123687,2067588695129523687,43785455761653171687,970599475776544179687,22477453228058041779687,542838699246918688179687,13648687185133824236979687,356730801326876349226419687,9678347588967065686171059687,272205577572344003465371059687,7926677509755318966849691059687,238716265511372293014327451059687,7426763878077138268197785755059687
add $0,1
mov $1,$0
mov $2,$0
lpb $1
mul $0,$2
sub $0,1
mov $2,$1
sub $1,1
lpe
|
examples/outdated-and-incorrect/NBE.agda | asr/agda-kanso | 1 | 12824 | <reponame>asr/agda-kanso
-- NBE for Gödel System T
module NBE where
module Prelude where
-- Zero and One -----------------------------------------------------------
data Zero : Set where
data One : Set where
unit : One
-- Natural numbers --------------------------------------------------------
data Nat : Set where
zero : Nat
suc : Nat -> Nat
(+) : Nat -> Nat -> Nat
zero + m = m
suc n + m = suc (n + m)
-- Props ------------------------------------------------------------------
data True : Prop where
tt : True
data False : Prop where
postulate
falseE : (A:Set) -> False -> A
infix 3 /\
data (/\)(P Q:Prop) : Prop where
andI : P -> Q -> P /\ Q
module Fin where
open Prelude
-- Finite sets ------------------------------------------------------------
data Suc (A:Set) : Set where
fzero_ : Suc A
fsuc_ : A -> Suc A
mutual
data Fin (n:Nat) : Set where
finI : Fin_ n -> Fin n
Fin_ : Nat -> Set
Fin_ zero = Zero
Fin_ (suc n) = Suc (Fin n)
fzero : {n:Nat} -> Fin (suc n)
fzero = finI fzero_
fsuc : {n:Nat} -> Fin n -> Fin (suc n)
fsuc i = finI (fsuc_ i)
finE : {n:Nat} -> Fin n -> Fin_ n
finE (finI i) = i
module Vec where
open Prelude
open Fin
infixr 15 ::
-- Vectors ----------------------------------------------------------------
data Nil : Set where
nil_ : Nil
data Cons (A As:Set) : Set where
cons_ : A -> As -> Cons A As
mutual
data Vec (A:Set)(n:Nat) : Set where
vecI : Vec_ A n -> Vec A n
Vec_ : Set -> Nat -> Set
Vec_ A zero = Nil
Vec_ A (suc n) = Cons A (Vec A n)
nil : {A:Set} -> Vec A zero
nil = vecI nil_
(::) : {A:Set} -> {n:Nat} -> A -> Vec A n -> Vec A (suc n)
x :: xs = vecI (cons_ x xs)
vecE : {A:Set} -> {n:Nat} -> Vec A n -> Vec_ A n
vecE (vecI xs) = xs
vec : {A:Set} -> (n:Nat) -> A -> Vec A n
vec zero _ = nil
vec (suc n) x = x :: vec n x
map : {n:Nat} -> {A B:Set} -> (A -> B) -> Vec A n -> Vec B n
map {zero} f (vecI nil_) = nil
map {suc n} f (vecI (cons_ x xs)) = f x :: map f xs
(!) : {n:Nat} -> {A:Set} -> Vec A n -> Fin n -> A
(!) {suc n} (vecI (cons_ x _ )) (finI fzero_) = x
(!) {suc n} (vecI (cons_ _ xs)) (finI (fsuc_ i)) = xs ! i
tabulate : {n:Nat} -> {A:Set} -> (Fin n -> A) -> Vec A n
tabulate {zero} f = nil
tabulate {suc n} f = f fzero :: tabulate (\x -> f (fsuc x))
module Syntax where
open Prelude
open Fin
-- Types ------------------------------------------------------------------
infixr 8 =>
data Type : Set where
nat : Type
(=>) : Type -> Type -> Type
-- Terms ------------------------------------------------------------------
data Term (n:Nat) : Set where
eZero : Term n
eSuc : Term n
eApp : Term n -> Term n -> Term n
eLam : Term (suc n) -> Term n
eVar : Fin n -> Term n
module NormalForms where
open Prelude
open Syntax
open Fin
mutual
-- Normal terms -----------------------------------------------------------
data Normal (n:Nat) : Set where
nZero : Normal n
nSuc : Normal n -> Normal n
nLam : Normal (suc n) -> Normal n
nNeutral : Neutral n -> Normal n
nStuck : Normal n -- type error
-- Neutral terms ----------------------------------------------------------
data Neutral (n:Nat) : Set where
uVar : Fin n -> Neutral n
uApp : Neutral n -> Normal n -> Neutral n
nVar : {n:Nat} -> Fin n -> Normal n
nVar i = nNeutral (uVar i)
nApp : {n:Nat} -> Neutral n -> Normal n -> Normal n
nApp u n = nNeutral (uApp u n)
module Rename where
open Prelude
open Fin
open Vec
open NormalForms
-- Renamings --------------------------------------------------------------
Ren : Nat -> Nat -> Set
Ren m n = Vec (Fin n) m
id : {n:Nat} -> Ren n n
id = tabulate (\i -> i)
compose : {l m n:Nat} -> Ren m n -> Ren l m -> Ren l n
compose {l}{m}{n} ρ γ = map (\i -> ρ ! i) γ
lift : {m n:Nat} -> Ren m n -> Ren (suc m) (suc n)
lift ρ = fzero :: map fsuc ρ
mutual
rename : {m n:Nat} -> Ren m n -> Normal m -> Normal n
rename ρ nZero = nZero
rename ρ (nSuc n) = nSuc (rename ρ n)
rename ρ (nLam n) = nLam (rename (lift ρ) n)
rename ρ (nNeutral u) = nNeutral (renameNe ρ u)
rename ρ nStuck = nStuck
renameNe : {m n:Nat} -> Ren m n -> Neutral m -> Neutral n
renameNe ρ (uVar i) = uVar (ρ ! i)
renameNe ρ (uApp u n) = uApp (renameNe ρ u) (rename ρ n)
up : {n:Nat} -> Ren n (suc n)
up = map fsuc id
module Subst where
open Prelude
open Fin
open Vec
open NormalForms
open Rename using (Ren; rename; up)
-- Substitutions ----------------------------------------------------------
Sub : Nat -> Nat -> Set
Sub m n = Vec (Normal n) m
id : {n:Nat} -> Sub n n
id = tabulate nVar
ren2sub : {m n:Nat} -> Ren m n -> Sub m n
ren2sub ρ = map nVar ρ
lift : {m n:Nat} -> Sub m n -> Sub (suc m) (suc n)
lift σ = nVar fzero :: map (rename up) σ
mutual
app : {n:Nat} -> Normal n -> Normal n -> Normal n
app nZero _ = nStuck
app (nSuc _) _ = nStuck
app nStuck _ = nStuck
app (nLam u) v = subst (v :: id) u
app (nNeutral n) v = nApp n v
subst : {m n:Nat} -> Sub m n -> Normal m -> Normal n
subst σ nZero = nZero
subst σ (nSuc v) = nSuc (subst σ v)
subst σ (nLam v) = nLam (subst (lift σ) v)
subst σ (nNeutral n) = substNe σ n
subst σ nStuck = nStuck
substNe : {m n:Nat} -> Sub m n -> Neutral m -> Normal n
substNe σ (uVar i) = σ ! i
substNe σ (uApp n v) = substNe σ n `app` subst σ v
compose : {l m n:Nat} -> Sub m n -> Sub l m -> Sub l n
compose σ δ = map (subst σ) δ
module TypeSystem where
open Prelude
open Fin
open Vec
open Syntax
mutual
EqType : Type -> Type -> Prop
EqType nat nat = True
EqType (τ => τ') (σ => σ') = τ == σ /\ τ' == σ'
EqType _ _ = False
infix 5 ==
data (==) (τ0 τ1:Type) : Prop where
eqTypeI : EqType τ0 τ1 -> τ0 == τ1
eqSubst : {σ τ:Type} -> (C:Type -> Set) -> σ == τ -> C τ -> C σ
eqSubst {nat}{nat} C _ x = x
eqSubst {σ => τ}{σ' => τ'} C (eqTypeI (andI eqσ eqτ)) x =
eqSubst (\μ -> C (μ => τ)) eqσ (
eqSubst (\η -> C (σ' => η)) eqτ x
)
Context : Nat -> Set
Context n = Vec Type n
mutual
HasType : {n:Nat} -> Context n -> Term n -> Type -> Set
HasType Γ eZero τ = ZeroType Γ τ
HasType Γ eSuc τ = SucType Γ τ
HasType Γ (eVar i) τ = VarType Γ i τ
HasType Γ (eApp e1 e2) τ = AppType Γ e1 e2 τ
HasType Γ (eLam e) τ = LamType Γ e τ
data ZeroType {n:Nat}(Γ:Context n)(τ:Type) : Set where
zeroType : τ == nat -> HasType Γ eZero τ
data SucType {n:Nat}(Γ:Context n)(τ:Type) : Set where
sucType : τ == (nat => nat) -> HasType Γ eSuc τ
data VarType {n:Nat}(Γ:Context n)(i:Fin n)(τ:Type) : Set where
varType : τ == (Γ ! i) -> HasType Γ (eVar i) τ
data AppType {n:Nat}(Γ:Context n)(e1 e2:Term n)(τ:Type) : Set where
appType : (σ:Type) -> HasType Γ e1 (σ => τ) -> HasType Γ e2 σ -> HasType Γ (eApp e1 e2) τ
data LamType {n:Nat}(Γ:Context n)(e:Term (suc n))(τ:Type) : Set where
lamType : (τ0 τ1:Type) -> τ == (τ0 => τ1) -> HasType (τ0 :: Γ) e τ1 -> HasType Γ (eLam e) τ
module NBE where
open Prelude
open Syntax
open Fin
open Vec
open TypeSystem
mutual
D_ : Nat -> Type -> Set
D_ n nat = NatD n
D_ n (σ => τ) = FunD n σ τ
data D (n:Nat)(τ:Type) : Set where
dI : D_ n τ -> D n τ
data NatD (n:Nat) : Set where
zeroD_ : D_ n nat
sucD_ : D n nat -> D_ n nat
neD_ : Term n -> D_ n nat
-- Will this pass the positivity check?
data FunD (n:Nat)(σ τ:Type) : Set where
lamD_ : (D n σ -> D n τ) -> D_ n (σ => τ)
zeroD : {n:Nat} -> D n nat
zeroD = dI zeroD_
sucD : {n:Nat} -> D n nat -> D n nat
sucD d = dI (sucD_ d)
neD : {n:Nat} -> Term n -> D n nat
neD t = dI (neD_ t)
lamD : {n:Nat} -> {σ τ:Type} -> (D n σ -> D n τ) -> D n (σ => τ)
lamD f = dI (lamD_ f)
coerce : {n:Nat} -> {τ0 τ1:Type} -> τ0 == τ1 -> D n τ1 -> D n τ0
coerce {n} = eqSubst (D n)
mutual
down : {τ:Type} -> {n:Nat} -> D n τ -> Term n
down {σ => τ} (dI (lamD_ f)) = eLam (down {τ} ?) -- doesn't work!
down {nat} (dI zeroD_) = eZero
down {nat} (dI (sucD_ d)) = eSuc `eApp` down d
down {nat} (dI (neD_ t)) = t
up : {n:Nat} -> (τ:Type) -> Term n -> D n τ
up (σ => τ) t = lamD (\d -> up τ (t `eApp` down d))
up nat t = neD t
Valuation : {m:Nat} -> Nat -> Context m -> Set
Valuation {zero} n _ = Nil
Valuation {suc m} n (vecI (cons_ τ Γ)) = Cons (D n τ) (Valuation n Γ)
(!!) : {m n:Nat} -> {Γ:Context m} -> Valuation n Γ -> (i:Fin m) -> D n (Γ ! i)
(!!) {suc _} {_} {vecI (cons_ _ _)} (cons_ v ξ) (finI fzero_) = v
(!!) {suc _} {_} {vecI (cons_ _ _)} (cons_ v ξ) (finI (fsuc_ i)) = ξ !! i
ext : {m n:Nat} -> {τ:Type} -> {Γ:Context m} -> Valuation n Γ -> D n τ -> Valuation n (τ :: Γ)
ext ξ v = cons_ v ξ
app : {σ τ:Type} -> {n:Nat} -> D n (σ => τ) -> D n σ -> D n τ
--app (dI (lamD_ f)) d = f d
app (lamD f) d = f d
eval : {n:Nat} -> {Γ:Context n} -> (e:Term n) -> (τ:Type) -> HasType Γ e τ -> Valuation n Γ -> D n τ
eval (eVar i) τ (varType eq) ξ = coerce eq (ξ !! i)
eval (eApp r s) τ (appType σ dr ds) ξ = eval r (σ => τ) dr ξ `app` eval s σ ds ξ
eval (eLam r) τ (lamType τ0 τ1 eq dr) ξ = coerce eq (lamD (\d -> ?)) -- doesn't work either
eval eZero τ (zeroType eq) ξ = coerce eq zeroD
eval eSuc τ (sucType eq) ξ = coerce eq (lamD sucD)
module Eval where
open Prelude
open Fin
open Vec
open Syntax
open NormalForms
open Rename using (up; rename)
open Subst
open TypeSystem
eval : {n:Nat} -> (Γ:Context n) -> (e:Term n) -> (τ:Type) -> HasType Γ e τ -> Normal n
eval Γ eZero τ _ = nZero
eval Γ eSuc τ _ = nLam (nSuc (nVar fzero))
eval Γ (eVar i) τ _ = nVar i
eval Γ (eApp e1 e2) τ (appType σ d1 d2) = eval Γ e1 (σ => τ) d1 `app` eval Γ e2 σ d2
eval Γ (eLam e) τ (lamType τ0 τ1 _ d) = nLam (eval (τ0 :: Γ) e τ1 d)
open Prelude
open Fin
open Vec
open Syntax
|
out/GroupAction/Signature.agda | JoeyEremondi/agda-soas | 39 | 12613 | <reponame>JoeyEremondi/agda-soas<filename>out/GroupAction/Signature.agda
{-
This second-order signature was created from the following second-order syntax description:
syntax GroupAction | GA
type
* : 0-ary
X : 0-ary
term
unit : * | ε
add : * * -> * | _⊕_ l20
neg : * -> * | ⊖_ r40
act : * X -> X | _⊙_ r30
theory
(εU⊕ᴸ) a |> add (unit, a) = a
(εU⊕ᴿ) a |> add (a, unit) = a
(⊕A) a b c |> add (add(a, b), c) = add (a, add(b, c))
(⊖N⊕ᴸ) a |> add (neg (a), a) = unit
(⊖N⊕ᴿ) a |> add (a, neg (a)) = unit
(εU⊙) x : X |> act (unit, x) = x
(⊕A⊙) g h x : X |> act (add(g, h), x) = act (g, act(h, x))
-}
module GroupAction.Signature where
open import SOAS.Context
-- Type declaration
data GAT : Set where
* : GAT
X : GAT
open import SOAS.Syntax.Signature GAT public
open import SOAS.Syntax.Build GAT public
-- Operator symbols
data GAₒ : Set where
unitₒ addₒ negₒ actₒ : GAₒ
-- Term signature
GA:Sig : Signature GAₒ
GA:Sig = sig λ
{ unitₒ → ⟼₀ *
; addₒ → (⊢₀ *) , (⊢₀ *) ⟼₂ *
; negₒ → (⊢₀ *) ⟼₁ *
; actₒ → (⊢₀ *) , (⊢₀ X) ⟼₂ X
}
open Signature GA:Sig public
|
Task/Bitmap-Write-a-PPM-file/Ada/bitmap-write-a-ppm-file.ada | LaudateCorpus1/RosettaCodeData | 1 | 8093 | <gh_stars>1-10
with Ada.Characters.Latin_1;
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
procedure Put_PPM (File : File_Type; Picture : Image) is
use Ada.Characters.Latin_1;
Size : constant String := Integer'Image (Picture'Length (2)) & Integer'Image (Picture'Length (1));
Buffer : String (1..Picture'Length (2) * 3);
Color : Pixel;
Index : Positive;
begin
String'Write (Stream (File), "P6" & LF);
String'Write (Stream (File), Size (2..Size'Last) & LF);
String'Write (Stream (File), "255" & LF);
for I in Picture'Range (1) loop
Index := Buffer'First;
for J in Picture'Range (2) loop
Color := Picture (I, J);
Buffer (Index) := Character'Val (Color.R);
Buffer (Index + 1) := Character'Val (Color.G);
Buffer (Index + 2) := Character'Val (Color.B);
Index := Index + 3;
end loop;
String'Write (Stream (File), Buffer);
end loop;
Character'Write (Stream (File), LF);
end Put_PPM;
|
Ada/DataStructures/BinTree/generic_binary_tree.ads | egustafson/sandbox | 2 | 13326 | with Ada.Text_IO;
use Ada.Text_IO;
generic
type Element_Type is private;
with function Less_Than( Left, Right : in Element_Type ) return Boolean;
with function Greater_Than( Left, Right : in Element_Type ) return Boolean;
with procedure Put( Item: in Element_Type );
package Generic_Binary_Tree is
type T is limited private;
function Is_In_Tree( Tree: in T; Element: in Element_Type ) return Boolean;
procedure Insert( Tree: in out T; Element: in Element_Type );
procedure Remove( Tree: in out T; Element: in Element_Type );
procedure Print( Tree: in T );
procedure Debug_Print( Tree: in T );
private
type Tree_Node;
type Tree_Node_Ptr is access Tree_Node;
type Tree_Node is
record
Data : Element_Type;
Left : Tree_Node_Ptr;
Right : Tree_Node_Ptr;
end record;
type T is
record
Root : Tree_Node_Ptr;
end record;
end Generic_Binary_Tree;
|
bootdict/tc/sig-handler.asm | ikysil/ikforth | 8 | 20933 | ; SIG-HANDLER
; D: signal-id -- signal-id
$DEFER 'SIG-HANDLER',$SIG_HANDLER,$PSIG_HANDLER
; (SIG-HANDLER)
; D: signal-id -- signal-id
$COLON '(SIG-HANDLER)',$PSIG_HANDLER,VEF_USUAL
$END_COLON
|
programs/oeis/070/A070435.asm | neoneye/loda | 22 | 3163 | <gh_stars>10-100
; A070435: a(n) = n^2 mod 12, or alternately n^4 mod 12.
; 0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9,4,1,0,1,4,9
pow $0,2
mod $0,12
|
src/tom/engine/parser/tomjava/TomJavaParser.g4 | rewriting/tom | 36 | 6534 | /*
[The "BSD licence"]
Copyright (c) 2013 <NAME>, <NAME>
Copyright (c) 2017 <NAME> (upgrade to Java 8)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
parser grammar TomJavaParser;
options { tokenVocab=TomJavaLexer; }
compilationUnit
: packageDeclaration? importDeclaration* typeDeclaration* EOF
;
declarationsUnit
: classBodyDeclaration* EOF
;
expressionUnit
: expression EOF
;
gomUnit
: module EOF
;
packageDeclaration
: annotation* PACKAGE qualifiedName ';'
;
importDeclaration
: IMPORT STATIC? qualifiedName (DOT STAR)? ';'
;
typeDeclaration
: classOrInterfaceModifier*
(classDeclaration | enumDeclaration | interfaceDeclaration | annotationTypeDeclaration)
| ';'
;
modifier
: classOrInterfaceModifier
| NATIVE
| SYNCHRONIZED
| TRANSIENT
| VOLATILE
;
classOrInterfaceModifier
: annotation
| PUBLIC
| PROTECTED
| PRIVATE
| STATIC
| ABSTRACT
| FINAL // FINAL for class only -- does not apply to interfaces
| STRICTFP
;
variableModifier
: FINAL
| annotation
;
classDeclaration
: CLASS javaIdentifier typeParameters?
(EXTENDS typeType)?
(IMPLEMENTS typeList)?
classBody
;
typeParameters
: LT typeParameter (COMMA typeParameter)* GT
;
typeParameter
: annotation* javaIdentifier (EXTENDS typeBound)?
;
typeBound
: typeType (BITAND typeType)*
;
enumDeclaration
: ENUM javaIdentifier (IMPLEMENTS typeList)? LBRACE enumConstants? COMMA? enumBodyDeclarations? RBRACE
;
enumConstants
: enumConstant (COMMA enumConstant)*
;
enumConstant
: annotation* javaIdentifier arguments? classBody?
;
enumBodyDeclarations
: ';' classBodyDeclaration*
;
interfaceDeclaration
: INTERFACE javaIdentifier typeParameters? (EXTENDS typeList)? interfaceBody
;
classBody
: LBRACE classBodyDeclaration* RBRACE
;
interfaceBody
: LBRACE interfaceBodyDeclaration* RBRACE
;
classBodyDeclaration
: ';'
| STATIC? block
| modifier* memberDeclaration
| tomDeclaration
;
memberDeclaration
: methodDeclaration
| genericMethodDeclaration
| fieldDeclaration
| constructorDeclaration
| genericConstructorDeclaration
| interfaceDeclaration
| annotationTypeDeclaration
| classDeclaration
| enumDeclaration
;
/* We use rule this even for void methods which cannot have [] after parameters.
This simplifies grammar and we can consider void to be a type, which
renders the [] matching as a context-sensitive issue or a semantic check
for invalid return type after parsing.
*/
methodDeclaration
: typeTypeOrVoid javaIdentifier formalParameters ('[' ']')*
(THROWS qualifiedNameList)?
methodBody
;
methodBody
: block
| ';'
;
typeTypeOrVoid
: typeType
| VOID
;
genericMethodDeclaration
: typeParameters methodDeclaration
;
genericConstructorDeclaration
: typeParameters constructorDeclaration
;
constructorDeclaration
: javaIdentifier formalParameters (THROWS qualifiedNameList)? constructorBody=block
;
fieldDeclaration
: typeType variableDeclarators ';'
;
interfaceBodyDeclaration
: modifier* interfaceMemberDeclaration
| tomDeclaration
| ';'
;
interfaceMemberDeclaration
: constDeclaration
| interfaceMethodDeclaration
| genericInterfaceMethodDeclaration
| interfaceDeclaration
| annotationTypeDeclaration
| classDeclaration
| enumDeclaration
;
constDeclaration
: typeType constantDeclarator (COMMA constantDeclarator)* ';'
;
constantDeclarator
: javaIdentifier ('[' ']')* ASSIGN variableInitializer
;
// see matching of [] comment in methodDeclaratorRest
// methodBody from Java8
interfaceMethodDeclaration
: interfaceMethodModifier* (typeTypeOrVoid | typeParameters annotation* typeTypeOrVoid)
javaIdentifier formalParameters ('[' ']')* (THROWS qualifiedNameList)? methodBody
;
// Java8
interfaceMethodModifier
: annotation
| PUBLIC
| ABSTRACT
| DEFAULT
| STATIC
| STRICTFP
;
genericInterfaceMethodDeclaration
: typeParameters interfaceMethodDeclaration
;
variableDeclarators
: variableDeclarator (COMMA variableDeclarator)*
;
variableDeclarator
: variableDeclaratorId (ASSIGN variableInitializer)?
;
variableDeclaratorId
: javaIdentifier ('[' ']')*
;
variableInitializer
: arrayInitializer
| expression
;
arrayInitializer
: LBRACE (variableInitializer (COMMA variableInitializer)* (COMMA)? )? RBRACE
;
classOrInterfaceType
: javaIdentifier typeArguments? (DOT javaIdentifier typeArguments?)*
;
typeArgument
: typeType
| '?' ((EXTENDS | SUPER) typeType)?
;
qualifiedNameList
: qualifiedName (COMMA qualifiedName)*
;
formalParameters
: LPAREN formalParameterList? RPAREN
;
formalParameterList
: formalParameter (COMMA formalParameter)* (COMMA lastFormalParameter)?
| lastFormalParameter
;
formalParameter
: variableModifier* typeType variableDeclaratorId
;
lastFormalParameter
: variableModifier* typeType '...' variableDeclaratorId
;
qualifiedName
: javaIdentifier (DOT javaIdentifier)*
;
literal
: integerLiteral
| floatLiteral
| CHAR_LITERAL
| STRING_LITERAL
| BOOL_LITERAL
| NULL_LITERAL
;
integerLiteral
: DECIMAL_LITERAL
| HEX_LITERAL
| OCT_LITERAL
| BINARY_LITERAL
;
floatLiteral
: FLOAT_LITERAL
| HEX_FLOAT_LITERAL
;
// ANNOTATIONS
annotation
: AT qualifiedName (LPAREN ( elementValuePairs | elementValue )? RPAREN)?
;
elementValuePairs
: elementValuePair (COMMA elementValuePair)*
;
elementValuePair
: javaIdentifier ASSIGN elementValue
;
elementValue
: expression
| annotation
| elementValueArrayInitializer
;
elementValueArrayInitializer
: LBRACE (elementValue (COMMA elementValue)*)? (COMMA)? RBRACE
;
annotationTypeDeclaration
: AT INTERFACE javaIdentifier annotationTypeBody
;
annotationTypeBody
: LBRACE (annotationTypeElementDeclaration)* RBRACE
;
annotationTypeElementDeclaration
: modifier* annotationTypeElementRest
| tomDeclaration
| ';' // this is not allowed by the grammar, but apparently allowed by the actual compiler
;
annotationTypeElementRest
: typeType annotationMethodOrConstantRest ';'
| classDeclaration ';'?
| interfaceDeclaration ';'?
| enumDeclaration ';'?
| annotationTypeDeclaration ';'?
;
annotationMethodOrConstantRest
: annotationMethodRest
| annotationConstantRest
;
annotationMethodRest
: javaIdentifier LPAREN RPAREN defaultValue?
;
annotationConstantRest
: variableDeclarators
;
defaultValue
: DEFAULT elementValue
;
// STATEMENTS / BLOCKS
block
: LBRACE blockStatement* RBRACE
;
blockStatement
: localVariableDeclaration ';'
| statement
| localTypeDeclaration
| tomDeclaration
;
localVariableDeclaration
: variableModifier* typeType variableDeclarators
;
localTypeDeclaration
: classOrInterfaceModifier*
(classDeclaration | interfaceDeclaration)
| ';'
;
statement
: blockLabel=block
| ASSERT expression (COLON expression)? ';'
| IF parExpression statement (ELSE statement)?
| FOR LPAREN forControl RPAREN statement
| WHILE parExpression statement
| DO statement WHILE parExpression ';'
| TRY block (catchClause+ finallyBlock? | finallyBlock)
| TRY resourceSpecification block catchClause* finallyBlock?
| SWITCH parExpression LBRACE switchBlockStatementGroup* switchLabel* RBRACE
| SYNCHRONIZED parExpression block
| RETURN expression? ';'
| THROW expression ';'
| BREAK javaIdentifier? ';'
| CONTINUE javaIdentifier? ';'
| SEMI
| statementExpression=expression ';'
| identifierLabel=javaIdentifier COLON statement
| tomStatement
;
catchClause
: CATCH LPAREN variableModifier* catchType javaIdentifier RPAREN block
;
catchType
: qualifiedName (PIPE qualifiedName)*
;
finallyBlock
: FINALLY block
;
resourceSpecification
: LPAREN resources ';'? RPAREN
;
resources
: resource (';' resource)*
;
resource
: variableModifier* classOrInterfaceType variableDeclaratorId ASSIGN expression
;
/** Matches cases then statements, both of which are mandatory.
* To handle empty cases at the end, we add switchLabel* to statement.
*/
switchBlockStatementGroup
: switchLabel+ blockStatement+
;
switchLabel
: CASE (constantExpression=expression | enumConstantName=javaIdentifier) COLON
| DEFAULT COLON
;
forControl
: enhancedForControl
| forInit? ';' expression? ';' forUpdate=expressionList?
;
forInit
: localVariableDeclaration
| expressionList
;
enhancedForControl
: variableModifier* typeType variableDeclaratorId COLON expression
;
// EXPRESSIONS
parExpression
: LPAREN expression RPAREN
;
expressionList
: expression (COMMA expression)*
;
expression
: primary
| expression bop=DOT
(javaIdentifier
| THIS
| NEW nonWildcardTypeArguments? innerCreator
| SUPER superSuffix
| explicitGenericInvocation
| funTerm LPAREN expressionList? RPAREN
)
| expression '[' expression ']'
| funTerm LPAREN expressionList? RPAREN
| NEW creator
| LPAREN typeType RPAREN expression
| expression postfix=('++' | '--')
| prefix=('+'|'-'|'++'|'--') expression
| prefix=('~'|ANTI) expression
| expression bop=(STAR|'/'|'%') expression
| expression bop=('+'|'-') expression
| expression (LSHIFT | GT GT GT | GT GT) expression
| expression bop=(LE | GE | GT | LT) expression
| expression bop=INSTANCEOF typeType
| expression bop=(EQUAL | NOTEQUAL) expression
| expression bop=BITAND expression
| expression bop='^' expression
| expression bop=PIPE expression
| expression bop=AND expression
| expression bop=OR expression
| expression bop='?' expression COLON expression
| <assoc=right> expression
bop=(ASSIGN | '+=' | '-=' | '*=' | '/=' | '&=' | '|=' | '^=' | '>>=' | '>>>=' | '<<=' | '%=')
expression
| lambdaExpression // Java8
// Java 8 methodReference
| expression '::' typeArguments? javaIdentifier ( LPAREN expressionList? RPAREN )?
| typeType '::' (typeArguments? javaIdentifier | NEW)
| classType '::' typeArguments? NEW
| tomTerm
;
funTerm
: THIS
| SUPER
| javaIdentifier
| nonWildcardTypeArguments (explicitGenericInvocationSuffix | THIS arguments)
| funTerm '[' expression ']'
| funTerm LPAREN expressionList? RPAREN
| funTerm postfix=('++' | '--')
| NEW creator
| lambdaExpression // Java8
// Java 8 methodReference
| typeType '::' (typeArguments? javaIdentifier | NEW)
| classType '::' typeArguments? NEW
;
// Java8
lambdaExpression
: lambdaParameters ARROW lambdaBody
;
// Java8
lambdaParameters
: javaIdentifier
| LPAREN formalParameterList? RPAREN
| LPAREN javaIdentifier (COMMA javaIdentifier)* RPAREN
;
// Java8
lambdaBody
: expression
| block
;
primary
: LPAREN expression RPAREN
| THIS
| SUPER
| literal
| javaIdentifier
| typeTypeOrVoid DOT CLASS
| nonWildcardTypeArguments (explicitGenericInvocationSuffix | THIS arguments)
;
classType
: (classOrInterfaceType DOT)? annotation* javaIdentifier typeArguments?
;
creator
: nonWildcardTypeArguments createdName classCreatorRest
| createdName (arrayCreatorRest | classCreatorRest)
;
createdName
: javaIdentifier typeArgumentsOrDiamond? (DOT javaIdentifier typeArgumentsOrDiamond?)*
| primitiveType
;
innerCreator
: javaIdentifier nonWildcardTypeArgumentsOrDiamond? classCreatorRest
;
arrayCreatorRest
: '[' (']' ('[' ']')* arrayInitializer | expression ']' ('[' expression ']')* ('[' ']')*)
;
classCreatorRest
: arguments classBody?
;
explicitGenericInvocation
: nonWildcardTypeArguments explicitGenericInvocationSuffix
;
typeArgumentsOrDiamond
: LT GT
| typeArguments
;
nonWildcardTypeArgumentsOrDiamond
: LT GT
| nonWildcardTypeArguments
;
nonWildcardTypeArguments
: LT typeList GT
;
typeList
: typeType (COMMA typeType)*
;
typeType
: annotation? (classOrInterfaceType | primitiveType) ('[' ']')*
;
primitiveType
: BOOLEAN
| CHAR
| BYTE
| SHORT
| INT
| LONG
| FLOAT
| DOUBLE
;
typeArguments
: LT typeArgument (COMMA typeArgument)* GT
;
superSuffix
: arguments
| DOT javaIdentifier arguments?
;
explicitGenericInvocationSuffix
: SUPER superSuffix
| javaIdentifier arguments
;
arguments
: LPAREN expressionList? RPAREN
;
//IDENTIFIER or a Tom Keyword
javaIdentifier
: IS_FSYM
| IS_SORT
| MAKE
| MAKE_EMPTY
| MAKE_APPEND
| MAKE_INSERT
| GET_SLOT
| GET_DEFAULT
| GET_ELEMENT
| GET_HEAD
| GET_TAIL
| GET_SIZE
| IS_EMPTY
| IMPLEMENT
| EQUALS
| VISIT
| WHEN
| IDENTIFIER
;
/*
*
* TOM - To One Matching Compiler
*
* Copyright (c) 2016-2017, Universite de Lorraine
* Nancy, France.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* <NAME> e-mail: <EMAIL>
*
**/
tomDeclaration
: strategyStatement
| includeStatement
| gomStatement
| ruleStatement
| typeterm
| operator
| oplist
| oparray
;
tomStatement
: matchStatement
;
tomTerm
: bqcomposite
| metaquote
;
metaquote
: METAQUOTE
;
matchStatement
: MATCH (LPAREN (bqterm (COMMA bqterm)*)? RPAREN)? LBRACE actionRule* RBRACE
;
strategyStatement
: STRATEGY tomIdentifier LPAREN slotList? RPAREN EXTENDS bqterm LBRACE visit* RBRACE
;
includeStatement
: INCLUDE LBRACE (DOT* SLASH)* tomIdentifier ((DOT|SLASH|BACKSLASH) tomIdentifier)* RBRACE
;
gomStatement
: GOM gomOptions? unknownBlock
;
gomOptions
: OPTIONSTART DMINUSID (COMMA DMINUSID)* OPTIONEND
;
gomBlock
: GOMSTART module GOMEND
;
//TODO %rule
ruleStatement
: RULE unknownBlock
;
unknownBlock
: BLOCKSTART (unknownBlock | ANY )*? BLOCKEND
| (SUBBLOCKSTART | SUBSUBBLOCKSTART) (unknownBlock | SUB_ANY)*? SUBBLOCKEND
;
visit
: VISIT tomIdentifier LBRACE actionRule* RBRACE
;
actionRule
: patternlist ((AND | OR) constraint)? ARROW tomBlock
| patternlist ((AND | OR) constraint)? ARROW bqterm
| c=constraint ARROW tomBlock
| c=constraint ARROW bqterm
;
tomBlock
: LBRACE (tomBlock | blockStatement)*? RBRACE
;
slotList
: slot (COMMA slot)*
;
slot
: id1=tomIdentifier COLON? id2=tomIdentifier
;
//TODO FIX when?
patternlist
: pattern (COMMA pattern)* (WHEN term (COMMA term)*)?
| LPAREN pattern (COMMA pattern)* RPAREN (WHEN LPAREN term (COMMA term)* RPAREN)?
;
constraint
: constraint AND constraint
| constraint OR constraint
| pattern match_symbol=LSHIFT bqterm
| term GT term
| term GE term
| term LT term
| term LE term
| term EQUAL term
| term NOTEQUAL term
| LPAREN c=constraint RPAREN
;
//used in constraints
term
: var=tomIdentifier STAR?
| fsym=tomIdentifier LPAREN (term (COMMA term)*)? RPAREN
| constant
;
// may be change this syntax: `term:sort
// retricted form of bqterm
// used in rhs, match, strategy
bqterm
: codomain=tomIdentifier? BQUOTE? fsym=tomIdentifier LPAREN (bqterm (COMMA bqterm)*)? RPAREN
| codomain=tomIdentifier? BQUOTE? fsym=tomIdentifier LBRACK (pairSlotBqterm (COMMA pairSlotBqterm)*)? RBRACK
| codomain=tomIdentifier? BQUOTE? var=tomIdentifier STAR?
| codomain=tomIdentifier? constant
| UNDERSCORE
;
pairSlotBqterm
: tomIdentifier ASSIGN bqterm
;
// general form of bqterm
// used as island nd in metaquote
bqcomposite
: BQUOTE fsym=tomIdentifier LBRACK (pairSlotBqterm (COMMA pairSlotBqterm)*)? RBRACK
| BQUOTE fsym=tomIdentifier LPAREN (composite (COMMA composite)*)? RPAREN
| BQUOTE LPAREN sub=composite RPAREN
| BQUOTE var=tomIdentifier STAR?
;
composite
: fsym=tomIdentifier LPAREN (composite (COMMA composite)*)? RPAREN
| LPAREN sub=composite RPAREN
| var=tomIdentifier STAR?
| constant
| UNDERSCORE
| javaIdentifier
| composite LPAREN (composite (COMMA composite)*)? RPAREN
| composite bop=DOT
(javaIdentifier
| THIS
| NEW nonWildcardTypeArguments? innerCreator
| SUPER superSuffix
| explicitGenericInvocation
)
| composite '[' composite ']'
| NEW creator
| LPAREN typeType RPAREN composite
| composite postfix=('++' | '--')
| prefix=('+'|'-'|'++'|'--') composite
| prefix=('~'|ANTI) composite
| composite bop=(STAR|'/'|'%') composite
| composite bop=('+'|'-') composite
| composite (LSHIFT | GT GT GT | GT GT) composite
| composite bop=(LE | GE | GT | LT) composite
| composite bop=INSTANCEOF typeType
| composite bop=(EQUAL | NOTEQUAL) composite
| composite bop=BITAND composite
| composite bop='^' composite
| composite bop=PIPE composite
| composite bop=AND composite
| composite bop=OR composite
| composite bop='?' composite COLON composite
| <assoc=right> composite
bop=(ASSIGN | '+=' | '-=' | '*=' | '/=' | '&=' | '|=' | '^=' | '>>=' | '>>>=' | '<<=' | '%=')
composite
| lambdaExpression // Java8 TODO: lambdaComposite?
// Java 8 methodReference
| composite '::' typeArguments? javaIdentifier
| typeType '::' (typeArguments? javaIdentifier | NEW)
| classType '::' typeArguments? NEW
;
pattern
: tomIdentifier AT pattern
| ANTI pattern
| fsymbol explicitArgs
| fsymbol implicitArgs
| var=tomIdentifier STAR?
| UNDERSCORE STAR?
| constant (PIPE constant)*
;
fsymbol
: headSymbol
| LPAREN headSymbol (PIPE headSymbol)+ RPAREN
;
headSymbol
: tomIdentifier QMARK?
| tomIdentifier DQMARK?
| constant
;
constant
: SUB? DECIMAL_LITERAL
| SUB? FLOAT_LITERAL
| CHAR_LITERAL
| EXTENDED_CHAR_LITERAL
| STRING_LITERAL
;
explicitArgs
: LPAREN (pattern (COMMA pattern)*)? RPAREN
;
implicitArgs
: LBRACK (tomIdentifier ASSIGN pattern (COMMA tomIdentifier ASSIGN pattern)*)? RBRACK
;
/*
* signature
*/
typeterm
: TYPETERM type=tomIdentifier (EXTENDS supertype=tomIdentifier)? LBRACE
implement isSort? equalsTerm?
RBRACE
;
operator
: OP codomain=tomIdentifier opname=tomIdentifier LPAREN slotList? RPAREN LBRACE
(isFsym | make | getSlot | getDefault)*
RBRACE
;
oplist
: OPLIST codomain=tomIdentifier opname=tomIdentifier LPAREN domain=tomIdentifier STAR RPAREN LBRACE
(isFsym | makeEmptyList | makeInsertList | getHead | getTail | isEmptyList)*
RBRACE
;
oparray
: OPARRAY codomain=tomIdentifier opname=tomIdentifier LPAREN domain=tomIdentifier STAR RPAREN LBRACE
(isFsym | makeEmptyArray | makeAppendArray | getElement | getSize)*
RBRACE
;
termBlock
: LBRACE expression RBRACE
;
implement
: IMPLEMENT LBRACE typeType RBRACE
;
equalsTerm
: EQUALS LPAREN id1=tomIdentifier COMMA id2=tomIdentifier RPAREN termBlock
;
isSort
: IS_SORT LPAREN tomIdentifier RPAREN termBlock
;
isFsym
: IS_FSYM LPAREN tomIdentifier RPAREN termBlock
;
make
: MAKE LPAREN (tomIdentifier (COMMA tomIdentifier)*)? RPAREN termBlock
;
makeEmptyList
: MAKE_EMPTY LPAREN RPAREN termBlock
;
makeEmptyArray
: MAKE_EMPTY LPAREN tomIdentifier RPAREN termBlock
;
makeAppendArray
: MAKE_APPEND LPAREN id1=tomIdentifier COMMA id2=tomIdentifier RPAREN termBlock
;
makeInsertList
: MAKE_INSERT LPAREN id1=tomIdentifier COMMA id2=tomIdentifier RPAREN termBlock
;
getSlot
: GET_SLOT LPAREN id1=tomIdentifier COMMA id2=tomIdentifier RPAREN termBlock
;
getHead
: GET_HEAD LPAREN tomIdentifier RPAREN termBlock
;
getTail
: GET_TAIL LPAREN tomIdentifier RPAREN termBlock
;
getElement
: GET_ELEMENT LPAREN id1=tomIdentifier COMMA id2=tomIdentifier RPAREN termBlock
;
isEmptyList
: IS_EMPTY LPAREN tomIdentifier RPAREN termBlock
;
getSize
: GET_SIZE LPAREN tomIdentifier RPAREN termBlock
;
getDefault
: GET_DEFAULT LPAREN tomIdentifier RPAREN termBlock
;
//IDENTIFIER or a Java Keyword
tomIdentifier
: ABSTRACT
| ASSERT
| BOOLEAN
| BREAK
| BYTE
| CASE
| CATCH
| CHAR
| CLASS
| CONST
| CONTINUE
| DEFAULT
| DO
| DOUBLE
| ELSE
| ENUM
| FINAL
| FINALLY
| FLOAT
| FOR
| IF
| GOTO
| IMPLEMENTS
| IMPORT
| INSTANCEOF
| INT
| INTERFACE
| LONG
| NATIVE
| NEW
| PACKAGE
| PRIVATE
| PROTECTED
| PUBLIC
| RETURN
| SHORT
| STATIC
| STRICTFP
| SUPER
| SWITCH
| SYNCHRONIZED
| THIS
| THROW
| THROWS
| TRANSIENT
| TRY
| VOID
| VOLATILE
| WHILE
| BOOL_LITERAL
| NULL_LITERAL
| IDENTIFIER
;
/***********************************GOM**************************************/
module:
MODULE modulename (imports)? section
;
modulename:
(prefixes+=gomIdentifier GOM_DOT)* moduleName=gomIdentifier
;
imports :
IMPORTS gomIdentifier*
;
section :
(GOM_PUBLIC)? adtgrammar
;
adtgrammar :
syntax*
;
syntax :
(GOM_ABSTRACT SYNTAX) (hookConstruct | typedecl | atomdecl)*
;
atomdecl :
ATOM gomIdentifier
;
typedecl :
typename=gomIdentifier GOM_EQUAL alternatives
| ptypename=gomIdentifier BINDS (atoms+=gomIdentifier) GOM_EQUAL pattern_alternatives
;
alternatives :
((jd+=JAVADOC ALT) | (ALT jd+=JAVADOC) | jd+=JAVADOC | {$jd.add(null);} (ALT)?) opdecl
(
((jd+=JAVADOC ALT) | (ALT jd+=JAVADOC) | {$jd.add(null);} ALT) opdecl
)* (GOM_SEMI)?
;
/* Used by Freshgom, as all rules beginning by "pattern" */
pattern_alternatives :
(ALT)? pattern_opdecl (ALT pattern_opdecl)* (GOM_SEMI)?
;
opdecl :
gomIdentifier fieldlist
;
/* Used by Freshgom, as all rules beginning by "pattern" */
pattern_opdecl :
gomIdentifier pattern_fieldlist
;
fieldlist :
GOM_LPAREN (field (GOM_COMMA field)* )? GOM_RPAREN
;
/* Used by Freshgom, as all rules beginning by "pattern" */
pattern_fieldlist :
GOM_LPAREN (pattern_field (GOM_COMMA pattern_field)* )? GOM_RPAREN
;
field:
type=gomIdentifier GOM_STAR
| LDIPLE type=gomIdentifier RDIPLE GOM_STAR
| name=gomIdentifier GOM_COLON type=gomIdentifier
| name=gomIdentifier GOM_COLON LDIPLE type=gomIdentifier RDIPLE
;
/* Used by Freshgom, as all rules beginning by "pattern" */
pattern_field:
type=gomIdentifier GOM_STAR
| INNER name=gomIdentifier GOM_COLON type=gomIdentifier
| OUTER name=gomIdentifier GOM_COLON type=gomIdentifier
| NEUTRAL name=gomIdentifier GOM_COLON type=gomIdentifier
| name=gomIdentifier GOM_COLON type=gomIdentifier
;
arglist:
(GOM_LPAREN (gomIdentifier (GOM_COMMA gomIdentifier)* )? GOM_RPAREN)?
;
hookConstruct :
(hookScope)? pointCut=gomIdentifier GOM_COLON
( hookType=RULES (RULE_LPAREN RULE_RPAREN)?
RULESTART ruleset RULEEND
| hookType=GRAPHRULES RULE_LPAREN RULE_ARG ARG_COMMA (IDENTITY | FAIL) RULE_RPAREN
RULESTART graphruleset RULEEND
| hookType=(AC | FL | FREE) (GOM_LPAREN GOM_RPAREN)? hookBlock
| hookType=(ACU | AU) (GOM_LPAREN GOM_RPAREN)? hookBlock
| hookType=(HOOK_MAKE | HOOK_MAKE_INSERT | HOOK_MAKE_EMPTY) arglist hookBlock
| hookType=HOOK_IMPORT (GOM_LPAREN GOM_RPAREN)? hookBlock
| hookType=HOOK_INTERFACE (GOM_LPAREN GOM_RPAREN)? hookBlock
| hookType=(BLOCK | MAPPING) (GOM_LPAREN GOM_RPAREN)? hookBlock
)
;
//TODO define proper hookblock based on hookType?
hookBlock
: HOOKSTART (unknownBlock | SUB_ANY )*? SUBBLOCKEND
;
ruleBlock
:
;
hookScope :
SORT
| MODULE
| OPERATOR
;
gomIdentifier
: ID
| AC
| FL
| FREE
| ACU
| AU
| HOOK_MAKE
| HOOK_MAKE_INSERT
| HOOK_MAKE_EMPTY
| HOOK_IMPORT
| HOOK_INTERFACE
| BLOCK
| MAPPING
;
/***********************************RULE*************************************/
ruleset:
(termrule)*
;
termrule:
rule_pattern RULE_ARROW rule_term (RULE_IF condition)?
;
graphruleset:
(graphrule)*
;
graphrule:
lhs=labelledpattern RULE_ARROW rhs=labelledpattern (RULE_IF condition)?
;
condition:
cond=andcondition (RULE_OR andcondition)*
;
andcondition:
cond=simplecondition (RULE_AND simplecondition)*
;
simplecondition:
lterm=rule_term (
RULE_EQUALS
| NOTEQUALS
| LEQ
| RULE_LT
| GEQ
| RULE_GT
| MATCH_SYMBOL
) rterm=rule_term
| LPAR condition RPAR
;
rule_pattern:
funname=RULE_ID LPAR (rule_term (RULE_COMMA rule_term)*)? RPAR
| (varname=RULE_ID) RULE_AT (funname=RULE_ID) LPAR (rule_term (RULE_COMMA rule_term)*)? RPAR
| RULE_UNDERSCORE RULE_STAR?
| NOT rule_pattern
;
rule_term:
rule_pattern
| variable
| builtin
;
builtin:
INTEGER
| STRING
;
labelledpattern:
(RULE_ID RULE_COLON)? graphpattern
;
graphpattern:
constructor
| variable
| builtin
| ref
;
variable:
RULE_ID (RULE_STAR)?
;
ref:
AMPERSAND RULE_ID
;
constructor:
RULE_ID LPAR (labelledpattern (RULE_COMMA labelledpattern)*)? RPAR
;
|
cat.asm | vdthatte/Operating-Systems-Class-CS-UY-3224 | 1 | 100349 |
_cat: file format elf32-i386
Disassembly of section .text:
00000000 <cat>:
char buf[512];
void
cat(int fd)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
int n;
while((n = read(fd, buf, sizeof(buf))) > 0)
6: eb 15 jmp 1d <cat+0x1d>
write(1, buf, n);
8: 83 ec 04 sub $0x4,%esp
b: ff 75 f4 pushl -0xc(%ebp)
e: 68 40 0b 00 00 push $0xb40
13: 6a 01 push $0x1
15: e8 51 03 00 00 call 36b <write>
1a: 83 c4 10 add $0x10,%esp
void
cat(int fd)
{
int n;
while((n = read(fd, buf, sizeof(buf))) > 0)
1d: 83 ec 04 sub $0x4,%esp
20: 68 00 02 00 00 push $0x200
25: 68 40 0b 00 00 push $0xb40
2a: ff 75 08 pushl 0x8(%ebp)
2d: e8 31 03 00 00 call 363 <read>
32: 83 c4 10 add $0x10,%esp
35: 89 45 f4 mov %eax,-0xc(%ebp)
38: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
3c: 7f ca jg 8 <cat+0x8>
write(1, buf, n);
if(n < 0){
3e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
42: 79 17 jns 5b <cat+0x5b>
printf(1, "cat: read error\n");
44: 83 ec 08 sub $0x8,%esp
47: 68 69 08 00 00 push $0x869
4c: 6a 01 push $0x1
4e: e8 6a 04 00 00 call 4bd <printf>
53: 83 c4 10 add $0x10,%esp
exit();
56: e8 f0 02 00 00 call 34b <exit>
}
}
5b: c9 leave
5c: c3 ret
0000005d <main>:
int
main(int argc, char *argv[])
{
5d: 8d 4c 24 04 lea 0x4(%esp),%ecx
61: 83 e4 f0 and $0xfffffff0,%esp
64: ff 71 fc pushl -0x4(%ecx)
67: 55 push %ebp
68: 89 e5 mov %esp,%ebp
6a: 53 push %ebx
6b: 51 push %ecx
6c: 83 ec 10 sub $0x10,%esp
6f: 89 cb mov %ecx,%ebx
int fd, i;
if(argc <= 1){
71: 83 3b 01 cmpl $0x1,(%ebx)
74: 7f 12 jg 88 <main+0x2b>
cat(0);
76: 83 ec 0c sub $0xc,%esp
79: 6a 00 push $0x0
7b: e8 80 ff ff ff call 0 <cat>
80: 83 c4 10 add $0x10,%esp
exit();
83: e8 c3 02 00 00 call 34b <exit>
}
for(i = 1; i < argc; i++){
88: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
8f: eb 70 jmp 101 <main+0xa4>
if((fd = open(argv[i], 0)) < 0){
91: 8b 45 f4 mov -0xc(%ebp),%eax
94: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
9b: 8b 43 04 mov 0x4(%ebx),%eax
9e: 01 d0 add %edx,%eax
a0: 8b 00 mov (%eax),%eax
a2: 83 ec 08 sub $0x8,%esp
a5: 6a 00 push $0x0
a7: 50 push %eax
a8: e8 de 02 00 00 call 38b <open>
ad: 83 c4 10 add $0x10,%esp
b0: 89 45 f0 mov %eax,-0x10(%ebp)
b3: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
b7: 79 29 jns e2 <main+0x85>
printf(1, "cat: cannot open %s\n", argv[i]);
b9: 8b 45 f4 mov -0xc(%ebp),%eax
bc: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
c3: 8b 43 04 mov 0x4(%ebx),%eax
c6: 01 d0 add %edx,%eax
c8: 8b 00 mov (%eax),%eax
ca: 83 ec 04 sub $0x4,%esp
cd: 50 push %eax
ce: 68 7a 08 00 00 push $0x87a
d3: 6a 01 push $0x1
d5: e8 e3 03 00 00 call 4bd <printf>
da: 83 c4 10 add $0x10,%esp
exit();
dd: e8 69 02 00 00 call 34b <exit>
}
cat(fd);
e2: 83 ec 0c sub $0xc,%esp
e5: ff 75 f0 pushl -0x10(%ebp)
e8: e8 13 ff ff ff call 0 <cat>
ed: 83 c4 10 add $0x10,%esp
close(fd);
f0: 83 ec 0c sub $0xc,%esp
f3: ff 75 f0 pushl -0x10(%ebp)
f6: e8 78 02 00 00 call 373 <close>
fb: 83 c4 10 add $0x10,%esp
if(argc <= 1){
cat(0);
exit();
}
for(i = 1; i < argc; i++){
fe: ff 45 f4 incl -0xc(%ebp)
101: 8b 45 f4 mov -0xc(%ebp),%eax
104: 3b 03 cmp (%ebx),%eax
106: 7c 89 jl 91 <main+0x34>
exit();
}
cat(fd);
close(fd);
}
exit();
108: e8 3e 02 00 00 call 34b <exit>
0000010d <stosb>:
10d: 55 push %ebp
10e: 89 e5 mov %esp,%ebp
110: 57 push %edi
111: 53 push %ebx
112: 8b 4d 08 mov 0x8(%ebp),%ecx
115: 8b 55 10 mov 0x10(%ebp),%edx
118: 8b 45 0c mov 0xc(%ebp),%eax
11b: 89 cb mov %ecx,%ebx
11d: 89 df mov %ebx,%edi
11f: 89 d1 mov %edx,%ecx
121: fc cld
122: f3 aa rep stos %al,%es:(%edi)
124: 89 ca mov %ecx,%edx
126: 89 fb mov %edi,%ebx
128: 89 5d 08 mov %ebx,0x8(%ebp)
12b: 89 55 10 mov %edx,0x10(%ebp)
12e: 5b pop %ebx
12f: 5f pop %edi
130: 5d pop %ebp
131: c3 ret
00000132 <strcpy>:
132: 55 push %ebp
133: 89 e5 mov %esp,%ebp
135: 83 ec 10 sub $0x10,%esp
138: 8b 45 08 mov 0x8(%ebp),%eax
13b: 89 45 fc mov %eax,-0x4(%ebp)
13e: 90 nop
13f: 8b 45 08 mov 0x8(%ebp),%eax
142: 8d 50 01 lea 0x1(%eax),%edx
145: 89 55 08 mov %edx,0x8(%ebp)
148: 8b 55 0c mov 0xc(%ebp),%edx
14b: 8d 4a 01 lea 0x1(%edx),%ecx
14e: 89 4d 0c mov %ecx,0xc(%ebp)
151: 8a 12 mov (%edx),%dl
153: 88 10 mov %dl,(%eax)
155: 8a 00 mov (%eax),%al
157: 84 c0 test %al,%al
159: 75 e4 jne 13f <strcpy+0xd>
15b: 8b 45 fc mov -0x4(%ebp),%eax
15e: c9 leave
15f: c3 ret
00000160 <strcmp>:
160: 55 push %ebp
161: 89 e5 mov %esp,%ebp
163: eb 06 jmp 16b <strcmp+0xb>
165: ff 45 08 incl 0x8(%ebp)
168: ff 45 0c incl 0xc(%ebp)
16b: 8b 45 08 mov 0x8(%ebp),%eax
16e: 8a 00 mov (%eax),%al
170: 84 c0 test %al,%al
172: 74 0e je 182 <strcmp+0x22>
174: 8b 45 08 mov 0x8(%ebp),%eax
177: 8a 10 mov (%eax),%dl
179: 8b 45 0c mov 0xc(%ebp),%eax
17c: 8a 00 mov (%eax),%al
17e: 38 c2 cmp %al,%dl
180: 74 e3 je 165 <strcmp+0x5>
182: 8b 45 08 mov 0x8(%ebp),%eax
185: 8a 00 mov (%eax),%al
187: 0f b6 d0 movzbl %al,%edx
18a: 8b 45 0c mov 0xc(%ebp),%eax
18d: 8a 00 mov (%eax),%al
18f: 0f b6 c0 movzbl %al,%eax
192: 29 c2 sub %eax,%edx
194: 89 d0 mov %edx,%eax
196: 5d pop %ebp
197: c3 ret
00000198 <strlen>:
198: 55 push %ebp
199: 89 e5 mov %esp,%ebp
19b: 83 ec 10 sub $0x10,%esp
19e: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
1a5: eb 03 jmp 1aa <strlen+0x12>
1a7: ff 45 fc incl -0x4(%ebp)
1aa: 8b 55 fc mov -0x4(%ebp),%edx
1ad: 8b 45 08 mov 0x8(%ebp),%eax
1b0: 01 d0 add %edx,%eax
1b2: 8a 00 mov (%eax),%al
1b4: 84 c0 test %al,%al
1b6: 75 ef jne 1a7 <strlen+0xf>
1b8: 8b 45 fc mov -0x4(%ebp),%eax
1bb: c9 leave
1bc: c3 ret
000001bd <memset>:
1bd: 55 push %ebp
1be: 89 e5 mov %esp,%ebp
1c0: 8b 45 10 mov 0x10(%ebp),%eax
1c3: 50 push %eax
1c4: ff 75 0c pushl 0xc(%ebp)
1c7: ff 75 08 pushl 0x8(%ebp)
1ca: e8 3e ff ff ff call 10d <stosb>
1cf: 83 c4 0c add $0xc,%esp
1d2: 8b 45 08 mov 0x8(%ebp),%eax
1d5: c9 leave
1d6: c3 ret
000001d7 <strchr>:
1d7: 55 push %ebp
1d8: 89 e5 mov %esp,%ebp
1da: 83 ec 04 sub $0x4,%esp
1dd: 8b 45 0c mov 0xc(%ebp),%eax
1e0: 88 45 fc mov %al,-0x4(%ebp)
1e3: eb 12 jmp 1f7 <strchr+0x20>
1e5: 8b 45 08 mov 0x8(%ebp),%eax
1e8: 8a 00 mov (%eax),%al
1ea: 3a 45 fc cmp -0x4(%ebp),%al
1ed: 75 05 jne 1f4 <strchr+0x1d>
1ef: 8b 45 08 mov 0x8(%ebp),%eax
1f2: eb 11 jmp 205 <strchr+0x2e>
1f4: ff 45 08 incl 0x8(%ebp)
1f7: 8b 45 08 mov 0x8(%ebp),%eax
1fa: 8a 00 mov (%eax),%al
1fc: 84 c0 test %al,%al
1fe: 75 e5 jne 1e5 <strchr+0xe>
200: b8 00 00 00 00 mov $0x0,%eax
205: c9 leave
206: c3 ret
00000207 <gets>:
207: 55 push %ebp
208: 89 e5 mov %esp,%ebp
20a: 83 ec 18 sub $0x18,%esp
20d: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
214: eb 41 jmp 257 <gets+0x50>
216: 83 ec 04 sub $0x4,%esp
219: 6a 01 push $0x1
21b: 8d 45 ef lea -0x11(%ebp),%eax
21e: 50 push %eax
21f: 6a 00 push $0x0
221: e8 3d 01 00 00 call 363 <read>
226: 83 c4 10 add $0x10,%esp
229: 89 45 f0 mov %eax,-0x10(%ebp)
22c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
230: 7f 02 jg 234 <gets+0x2d>
232: eb 2c jmp 260 <gets+0x59>
234: 8b 45 f4 mov -0xc(%ebp),%eax
237: 8d 50 01 lea 0x1(%eax),%edx
23a: 89 55 f4 mov %edx,-0xc(%ebp)
23d: 89 c2 mov %eax,%edx
23f: 8b 45 08 mov 0x8(%ebp),%eax
242: 01 c2 add %eax,%edx
244: 8a 45 ef mov -0x11(%ebp),%al
247: 88 02 mov %al,(%edx)
249: 8a 45 ef mov -0x11(%ebp),%al
24c: 3c 0a cmp $0xa,%al
24e: 74 10 je 260 <gets+0x59>
250: 8a 45 ef mov -0x11(%ebp),%al
253: 3c 0d cmp $0xd,%al
255: 74 09 je 260 <gets+0x59>
257: 8b 45 f4 mov -0xc(%ebp),%eax
25a: 40 inc %eax
25b: 3b 45 0c cmp 0xc(%ebp),%eax
25e: 7c b6 jl 216 <gets+0xf>
260: 8b 55 f4 mov -0xc(%ebp),%edx
263: 8b 45 08 mov 0x8(%ebp),%eax
266: 01 d0 add %edx,%eax
268: c6 00 00 movb $0x0,(%eax)
26b: 8b 45 08 mov 0x8(%ebp),%eax
26e: c9 leave
26f: c3 ret
00000270 <stat>:
270: 55 push %ebp
271: 89 e5 mov %esp,%ebp
273: 83 ec 18 sub $0x18,%esp
276: 83 ec 08 sub $0x8,%esp
279: 6a 00 push $0x0
27b: ff 75 08 pushl 0x8(%ebp)
27e: e8 08 01 00 00 call 38b <open>
283: 83 c4 10 add $0x10,%esp
286: 89 45 f4 mov %eax,-0xc(%ebp)
289: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
28d: 79 07 jns 296 <stat+0x26>
28f: b8 ff ff ff ff mov $0xffffffff,%eax
294: eb 25 jmp 2bb <stat+0x4b>
296: 83 ec 08 sub $0x8,%esp
299: ff 75 0c pushl 0xc(%ebp)
29c: ff 75 f4 pushl -0xc(%ebp)
29f: e8 ff 00 00 00 call 3a3 <fstat>
2a4: 83 c4 10 add $0x10,%esp
2a7: 89 45 f0 mov %eax,-0x10(%ebp)
2aa: 83 ec 0c sub $0xc,%esp
2ad: ff 75 f4 pushl -0xc(%ebp)
2b0: e8 be 00 00 00 call 373 <close>
2b5: 83 c4 10 add $0x10,%esp
2b8: 8b 45 f0 mov -0x10(%ebp),%eax
2bb: c9 leave
2bc: c3 ret
000002bd <atoi>:
2bd: 55 push %ebp
2be: 89 e5 mov %esp,%ebp
2c0: 83 ec 10 sub $0x10,%esp
2c3: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
2ca: eb 24 jmp 2f0 <atoi+0x33>
2cc: 8b 55 fc mov -0x4(%ebp),%edx
2cf: 89 d0 mov %edx,%eax
2d1: c1 e0 02 shl $0x2,%eax
2d4: 01 d0 add %edx,%eax
2d6: 01 c0 add %eax,%eax
2d8: 89 c1 mov %eax,%ecx
2da: 8b 45 08 mov 0x8(%ebp),%eax
2dd: 8d 50 01 lea 0x1(%eax),%edx
2e0: 89 55 08 mov %edx,0x8(%ebp)
2e3: 8a 00 mov (%eax),%al
2e5: 0f be c0 movsbl %al,%eax
2e8: 01 c8 add %ecx,%eax
2ea: 83 e8 30 sub $0x30,%eax
2ed: 89 45 fc mov %eax,-0x4(%ebp)
2f0: 8b 45 08 mov 0x8(%ebp),%eax
2f3: 8a 00 mov (%eax),%al
2f5: 3c 2f cmp $0x2f,%al
2f7: 7e 09 jle 302 <atoi+0x45>
2f9: 8b 45 08 mov 0x8(%ebp),%eax
2fc: 8a 00 mov (%eax),%al
2fe: 3c 39 cmp $0x39,%al
300: 7e ca jle 2cc <atoi+0xf>
302: 8b 45 fc mov -0x4(%ebp),%eax
305: c9 leave
306: c3 ret
00000307 <memmove>:
307: 55 push %ebp
308: 89 e5 mov %esp,%ebp
30a: 83 ec 10 sub $0x10,%esp
30d: 8b 45 08 mov 0x8(%ebp),%eax
310: 89 45 fc mov %eax,-0x4(%ebp)
313: 8b 45 0c mov 0xc(%ebp),%eax
316: 89 45 f8 mov %eax,-0x8(%ebp)
319: eb 16 jmp 331 <memmove+0x2a>
31b: 8b 45 fc mov -0x4(%ebp),%eax
31e: 8d 50 01 lea 0x1(%eax),%edx
321: 89 55 fc mov %edx,-0x4(%ebp)
324: 8b 55 f8 mov -0x8(%ebp),%edx
327: 8d 4a 01 lea 0x1(%edx),%ecx
32a: 89 4d f8 mov %ecx,-0x8(%ebp)
32d: 8a 12 mov (%edx),%dl
32f: 88 10 mov %dl,(%eax)
331: 8b 45 10 mov 0x10(%ebp),%eax
334: 8d 50 ff lea -0x1(%eax),%edx
337: 89 55 10 mov %edx,0x10(%ebp)
33a: 85 c0 test %eax,%eax
33c: 7f dd jg 31b <memmove+0x14>
33e: 8b 45 08 mov 0x8(%ebp),%eax
341: c9 leave
342: c3 ret
00000343 <fork>:
343: b8 01 00 00 00 mov $0x1,%eax
348: cd 40 int $0x40
34a: c3 ret
0000034b <exit>:
34b: b8 02 00 00 00 mov $0x2,%eax
350: cd 40 int $0x40
352: c3 ret
00000353 <wait>:
353: b8 03 00 00 00 mov $0x3,%eax
358: cd 40 int $0x40
35a: c3 ret
0000035b <pipe>:
35b: b8 04 00 00 00 mov $0x4,%eax
360: cd 40 int $0x40
362: c3 ret
00000363 <read>:
363: b8 05 00 00 00 mov $0x5,%eax
368: cd 40 int $0x40
36a: c3 ret
0000036b <write>:
36b: b8 10 00 00 00 mov $0x10,%eax
370: cd 40 int $0x40
372: c3 ret
00000373 <close>:
373: b8 15 00 00 00 mov $0x15,%eax
378: cd 40 int $0x40
37a: c3 ret
0000037b <kill>:
37b: b8 06 00 00 00 mov $0x6,%eax
380: cd 40 int $0x40
382: c3 ret
00000383 <exec>:
383: b8 07 00 00 00 mov $0x7,%eax
388: cd 40 int $0x40
38a: c3 ret
0000038b <open>:
38b: b8 0f 00 00 00 mov $0xf,%eax
390: cd 40 int $0x40
392: c3 ret
00000393 <mknod>:
393: b8 11 00 00 00 mov $0x11,%eax
398: cd 40 int $0x40
39a: c3 ret
0000039b <unlink>:
39b: b8 12 00 00 00 mov $0x12,%eax
3a0: cd 40 int $0x40
3a2: c3 ret
000003a3 <fstat>:
3a3: b8 08 00 00 00 mov $0x8,%eax
3a8: cd 40 int $0x40
3aa: c3 ret
000003ab <link>:
3ab: b8 13 00 00 00 mov $0x13,%eax
3b0: cd 40 int $0x40
3b2: c3 ret
000003b3 <mkdir>:
3b3: b8 14 00 00 00 mov $0x14,%eax
3b8: cd 40 int $0x40
3ba: c3 ret
000003bb <chdir>:
3bb: b8 09 00 00 00 mov $0x9,%eax
3c0: cd 40 int $0x40
3c2: c3 ret
000003c3 <dup>:
3c3: b8 0a 00 00 00 mov $0xa,%eax
3c8: cd 40 int $0x40
3ca: c3 ret
000003cb <getpid>:
3cb: b8 0b 00 00 00 mov $0xb,%eax
3d0: cd 40 int $0x40
3d2: c3 ret
000003d3 <sbrk>:
3d3: b8 0c 00 00 00 mov $0xc,%eax
3d8: cd 40 int $0x40
3da: c3 ret
000003db <sleep>:
3db: b8 0d 00 00 00 mov $0xd,%eax
3e0: cd 40 int $0x40
3e2: c3 ret
000003e3 <uptime>:
3e3: b8 0e 00 00 00 mov $0xe,%eax
3e8: cd 40 int $0x40
3ea: c3 ret
000003eb <putc>:
3eb: 55 push %ebp
3ec: 89 e5 mov %esp,%ebp
3ee: 83 ec 18 sub $0x18,%esp
3f1: 8b 45 0c mov 0xc(%ebp),%eax
3f4: 88 45 f4 mov %al,-0xc(%ebp)
3f7: 83 ec 04 sub $0x4,%esp
3fa: 6a 01 push $0x1
3fc: 8d 45 f4 lea -0xc(%ebp),%eax
3ff: 50 push %eax
400: ff 75 08 pushl 0x8(%ebp)
403: e8 63 ff ff ff call 36b <write>
408: 83 c4 10 add $0x10,%esp
40b: c9 leave
40c: c3 ret
0000040d <printint>:
40d: 55 push %ebp
40e: 89 e5 mov %esp,%ebp
410: 53 push %ebx
411: 83 ec 24 sub $0x24,%esp
414: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
41b: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
41f: 74 17 je 438 <printint+0x2b>
421: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
425: 79 11 jns 438 <printint+0x2b>
427: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
42e: 8b 45 0c mov 0xc(%ebp),%eax
431: f7 d8 neg %eax
433: 89 45 ec mov %eax,-0x14(%ebp)
436: eb 06 jmp 43e <printint+0x31>
438: 8b 45 0c mov 0xc(%ebp),%eax
43b: 89 45 ec mov %eax,-0x14(%ebp)
43e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
445: 8b 4d f4 mov -0xc(%ebp),%ecx
448: 8d 41 01 lea 0x1(%ecx),%eax
44b: 89 45 f4 mov %eax,-0xc(%ebp)
44e: 8b 5d 10 mov 0x10(%ebp),%ebx
451: 8b 45 ec mov -0x14(%ebp),%eax
454: ba 00 00 00 00 mov $0x0,%edx
459: f7 f3 div %ebx
45b: 89 d0 mov %edx,%eax
45d: 8a 80 04 0b 00 00 mov 0xb04(%eax),%al
463: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
467: 8b 5d 10 mov 0x10(%ebp),%ebx
46a: 8b 45 ec mov -0x14(%ebp),%eax
46d: ba 00 00 00 00 mov $0x0,%edx
472: f7 f3 div %ebx
474: 89 45 ec mov %eax,-0x14(%ebp)
477: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
47b: 75 c8 jne 445 <printint+0x38>
47d: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
481: 74 0e je 491 <printint+0x84>
483: 8b 45 f4 mov -0xc(%ebp),%eax
486: 8d 50 01 lea 0x1(%eax),%edx
489: 89 55 f4 mov %edx,-0xc(%ebp)
48c: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
491: eb 1c jmp 4af <printint+0xa2>
493: 8d 55 dc lea -0x24(%ebp),%edx
496: 8b 45 f4 mov -0xc(%ebp),%eax
499: 01 d0 add %edx,%eax
49b: 8a 00 mov (%eax),%al
49d: 0f be c0 movsbl %al,%eax
4a0: 83 ec 08 sub $0x8,%esp
4a3: 50 push %eax
4a4: ff 75 08 pushl 0x8(%ebp)
4a7: e8 3f ff ff ff call 3eb <putc>
4ac: 83 c4 10 add $0x10,%esp
4af: ff 4d f4 decl -0xc(%ebp)
4b2: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
4b6: 79 db jns 493 <printint+0x86>
4b8: 8b 5d fc mov -0x4(%ebp),%ebx
4bb: c9 leave
4bc: c3 ret
000004bd <printf>:
4bd: 55 push %ebp
4be: 89 e5 mov %esp,%ebp
4c0: 83 ec 28 sub $0x28,%esp
4c3: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
4ca: 8d 45 0c lea 0xc(%ebp),%eax
4cd: 83 c0 04 add $0x4,%eax
4d0: 89 45 e8 mov %eax,-0x18(%ebp)
4d3: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
4da: e9 54 01 00 00 jmp 633 <printf+0x176>
4df: 8b 55 0c mov 0xc(%ebp),%edx
4e2: 8b 45 f0 mov -0x10(%ebp),%eax
4e5: 01 d0 add %edx,%eax
4e7: 8a 00 mov (%eax),%al
4e9: 0f be c0 movsbl %al,%eax
4ec: 25 ff 00 00 00 and $0xff,%eax
4f1: 89 45 e4 mov %eax,-0x1c(%ebp)
4f4: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
4f8: 75 2c jne 526 <printf+0x69>
4fa: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
4fe: 75 0c jne 50c <printf+0x4f>
500: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
507: e9 24 01 00 00 jmp 630 <printf+0x173>
50c: 8b 45 e4 mov -0x1c(%ebp),%eax
50f: 0f be c0 movsbl %al,%eax
512: 83 ec 08 sub $0x8,%esp
515: 50 push %eax
516: ff 75 08 pushl 0x8(%ebp)
519: e8 cd fe ff ff call 3eb <putc>
51e: 83 c4 10 add $0x10,%esp
521: e9 0a 01 00 00 jmp 630 <printf+0x173>
526: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
52a: 0f 85 00 01 00 00 jne 630 <printf+0x173>
530: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
534: 75 1e jne 554 <printf+0x97>
536: 8b 45 e8 mov -0x18(%ebp),%eax
539: 8b 00 mov (%eax),%eax
53b: 6a 01 push $0x1
53d: 6a 0a push $0xa
53f: 50 push %eax
540: ff 75 08 pushl 0x8(%ebp)
543: e8 c5 fe ff ff call 40d <printint>
548: 83 c4 10 add $0x10,%esp
54b: 83 45 e8 04 addl $0x4,-0x18(%ebp)
54f: e9 d5 00 00 00 jmp 629 <printf+0x16c>
554: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
558: 74 06 je 560 <printf+0xa3>
55a: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
55e: 75 1e jne 57e <printf+0xc1>
560: 8b 45 e8 mov -0x18(%ebp),%eax
563: 8b 00 mov (%eax),%eax
565: 6a 00 push $0x0
567: 6a 10 push $0x10
569: 50 push %eax
56a: ff 75 08 pushl 0x8(%ebp)
56d: e8 9b fe ff ff call 40d <printint>
572: 83 c4 10 add $0x10,%esp
575: 83 45 e8 04 addl $0x4,-0x18(%ebp)
579: e9 ab 00 00 00 jmp 629 <printf+0x16c>
57e: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
582: 75 40 jne 5c4 <printf+0x107>
584: 8b 45 e8 mov -0x18(%ebp),%eax
587: 8b 00 mov (%eax),%eax
589: 89 45 f4 mov %eax,-0xc(%ebp)
58c: 83 45 e8 04 addl $0x4,-0x18(%ebp)
590: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
594: 75 07 jne 59d <printf+0xe0>
596: c7 45 f4 8f 08 00 00 movl $0x88f,-0xc(%ebp)
59d: eb 1a jmp 5b9 <printf+0xfc>
59f: 8b 45 f4 mov -0xc(%ebp),%eax
5a2: 8a 00 mov (%eax),%al
5a4: 0f be c0 movsbl %al,%eax
5a7: 83 ec 08 sub $0x8,%esp
5aa: 50 push %eax
5ab: ff 75 08 pushl 0x8(%ebp)
5ae: e8 38 fe ff ff call 3eb <putc>
5b3: 83 c4 10 add $0x10,%esp
5b6: ff 45 f4 incl -0xc(%ebp)
5b9: 8b 45 f4 mov -0xc(%ebp),%eax
5bc: 8a 00 mov (%eax),%al
5be: 84 c0 test %al,%al
5c0: 75 dd jne 59f <printf+0xe2>
5c2: eb 65 jmp 629 <printf+0x16c>
5c4: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
5c8: 75 1d jne 5e7 <printf+0x12a>
5ca: 8b 45 e8 mov -0x18(%ebp),%eax
5cd: 8b 00 mov (%eax),%eax
5cf: 0f be c0 movsbl %al,%eax
5d2: 83 ec 08 sub $0x8,%esp
5d5: 50 push %eax
5d6: ff 75 08 pushl 0x8(%ebp)
5d9: e8 0d fe ff ff call 3eb <putc>
5de: 83 c4 10 add $0x10,%esp
5e1: 83 45 e8 04 addl $0x4,-0x18(%ebp)
5e5: eb 42 jmp 629 <printf+0x16c>
5e7: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
5eb: 75 17 jne 604 <printf+0x147>
5ed: 8b 45 e4 mov -0x1c(%ebp),%eax
5f0: 0f be c0 movsbl %al,%eax
5f3: 83 ec 08 sub $0x8,%esp
5f6: 50 push %eax
5f7: ff 75 08 pushl 0x8(%ebp)
5fa: e8 ec fd ff ff call 3eb <putc>
5ff: 83 c4 10 add $0x10,%esp
602: eb 25 jmp 629 <printf+0x16c>
604: 83 ec 08 sub $0x8,%esp
607: 6a 25 push $0x25
609: ff 75 08 pushl 0x8(%ebp)
60c: e8 da fd ff ff call 3eb <putc>
611: 83 c4 10 add $0x10,%esp
614: 8b 45 e4 mov -0x1c(%ebp),%eax
617: 0f be c0 movsbl %al,%eax
61a: 83 ec 08 sub $0x8,%esp
61d: 50 push %eax
61e: ff 75 08 pushl 0x8(%ebp)
621: e8 c5 fd ff ff call 3eb <putc>
626: 83 c4 10 add $0x10,%esp
629: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
630: ff 45 f0 incl -0x10(%ebp)
633: 8b 55 0c mov 0xc(%ebp),%edx
636: 8b 45 f0 mov -0x10(%ebp),%eax
639: 01 d0 add %edx,%eax
63b: 8a 00 mov (%eax),%al
63d: 84 c0 test %al,%al
63f: 0f 85 9a fe ff ff jne 4df <printf+0x22>
645: c9 leave
646: c3 ret
00000647 <free>:
647: 55 push %ebp
648: 89 e5 mov %esp,%ebp
64a: 83 ec 10 sub $0x10,%esp
64d: 8b 45 08 mov 0x8(%ebp),%eax
650: 83 e8 08 sub $0x8,%eax
653: 89 45 f8 mov %eax,-0x8(%ebp)
656: a1 28 0b 00 00 mov 0xb28,%eax
65b: 89 45 fc mov %eax,-0x4(%ebp)
65e: eb 24 jmp 684 <free+0x3d>
660: 8b 45 fc mov -0x4(%ebp),%eax
663: 8b 00 mov (%eax),%eax
665: 3b 45 fc cmp -0x4(%ebp),%eax
668: 77 12 ja 67c <free+0x35>
66a: 8b 45 f8 mov -0x8(%ebp),%eax
66d: 3b 45 fc cmp -0x4(%ebp),%eax
670: 77 24 ja 696 <free+0x4f>
672: 8b 45 fc mov -0x4(%ebp),%eax
675: 8b 00 mov (%eax),%eax
677: 3b 45 f8 cmp -0x8(%ebp),%eax
67a: 77 1a ja 696 <free+0x4f>
67c: 8b 45 fc mov -0x4(%ebp),%eax
67f: 8b 00 mov (%eax),%eax
681: 89 45 fc mov %eax,-0x4(%ebp)
684: 8b 45 f8 mov -0x8(%ebp),%eax
687: 3b 45 fc cmp -0x4(%ebp),%eax
68a: 76 d4 jbe 660 <free+0x19>
68c: 8b 45 fc mov -0x4(%ebp),%eax
68f: 8b 00 mov (%eax),%eax
691: 3b 45 f8 cmp -0x8(%ebp),%eax
694: 76 ca jbe 660 <free+0x19>
696: 8b 45 f8 mov -0x8(%ebp),%eax
699: 8b 40 04 mov 0x4(%eax),%eax
69c: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
6a3: 8b 45 f8 mov -0x8(%ebp),%eax
6a6: 01 c2 add %eax,%edx
6a8: 8b 45 fc mov -0x4(%ebp),%eax
6ab: 8b 00 mov (%eax),%eax
6ad: 39 c2 cmp %eax,%edx
6af: 75 24 jne 6d5 <free+0x8e>
6b1: 8b 45 f8 mov -0x8(%ebp),%eax
6b4: 8b 50 04 mov 0x4(%eax),%edx
6b7: 8b 45 fc mov -0x4(%ebp),%eax
6ba: 8b 00 mov (%eax),%eax
6bc: 8b 40 04 mov 0x4(%eax),%eax
6bf: 01 c2 add %eax,%edx
6c1: 8b 45 f8 mov -0x8(%ebp),%eax
6c4: 89 50 04 mov %edx,0x4(%eax)
6c7: 8b 45 fc mov -0x4(%ebp),%eax
6ca: 8b 00 mov (%eax),%eax
6cc: 8b 10 mov (%eax),%edx
6ce: 8b 45 f8 mov -0x8(%ebp),%eax
6d1: 89 10 mov %edx,(%eax)
6d3: eb 0a jmp 6df <free+0x98>
6d5: 8b 45 fc mov -0x4(%ebp),%eax
6d8: 8b 10 mov (%eax),%edx
6da: 8b 45 f8 mov -0x8(%ebp),%eax
6dd: 89 10 mov %edx,(%eax)
6df: 8b 45 fc mov -0x4(%ebp),%eax
6e2: 8b 40 04 mov 0x4(%eax),%eax
6e5: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
6ec: 8b 45 fc mov -0x4(%ebp),%eax
6ef: 01 d0 add %edx,%eax
6f1: 3b 45 f8 cmp -0x8(%ebp),%eax
6f4: 75 20 jne 716 <free+0xcf>
6f6: 8b 45 fc mov -0x4(%ebp),%eax
6f9: 8b 50 04 mov 0x4(%eax),%edx
6fc: 8b 45 f8 mov -0x8(%ebp),%eax
6ff: 8b 40 04 mov 0x4(%eax),%eax
702: 01 c2 add %eax,%edx
704: 8b 45 fc mov -0x4(%ebp),%eax
707: 89 50 04 mov %edx,0x4(%eax)
70a: 8b 45 f8 mov -0x8(%ebp),%eax
70d: 8b 10 mov (%eax),%edx
70f: 8b 45 fc mov -0x4(%ebp),%eax
712: 89 10 mov %edx,(%eax)
714: eb 08 jmp 71e <free+0xd7>
716: 8b 45 fc mov -0x4(%ebp),%eax
719: 8b 55 f8 mov -0x8(%ebp),%edx
71c: 89 10 mov %edx,(%eax)
71e: 8b 45 fc mov -0x4(%ebp),%eax
721: a3 28 0b 00 00 mov %eax,0xb28
726: c9 leave
727: c3 ret
00000728 <morecore>:
728: 55 push %ebp
729: 89 e5 mov %esp,%ebp
72b: 83 ec 18 sub $0x18,%esp
72e: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
735: 77 07 ja 73e <morecore+0x16>
737: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
73e: 8b 45 08 mov 0x8(%ebp),%eax
741: c1 e0 03 shl $0x3,%eax
744: 83 ec 0c sub $0xc,%esp
747: 50 push %eax
748: e8 86 fc ff ff call 3d3 <sbrk>
74d: 83 c4 10 add $0x10,%esp
750: 89 45 f4 mov %eax,-0xc(%ebp)
753: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
757: 75 07 jne 760 <morecore+0x38>
759: b8 00 00 00 00 mov $0x0,%eax
75e: eb 26 jmp 786 <morecore+0x5e>
760: 8b 45 f4 mov -0xc(%ebp),%eax
763: 89 45 f0 mov %eax,-0x10(%ebp)
766: 8b 45 f0 mov -0x10(%ebp),%eax
769: 8b 55 08 mov 0x8(%ebp),%edx
76c: 89 50 04 mov %edx,0x4(%eax)
76f: 8b 45 f0 mov -0x10(%ebp),%eax
772: 83 c0 08 add $0x8,%eax
775: 83 ec 0c sub $0xc,%esp
778: 50 push %eax
779: e8 c9 fe ff ff call 647 <free>
77e: 83 c4 10 add $0x10,%esp
781: a1 28 0b 00 00 mov 0xb28,%eax
786: c9 leave
787: c3 ret
00000788 <malloc>:
788: 55 push %ebp
789: 89 e5 mov %esp,%ebp
78b: 83 ec 18 sub $0x18,%esp
78e: 8b 45 08 mov 0x8(%ebp),%eax
791: 83 c0 07 add $0x7,%eax
794: c1 e8 03 shr $0x3,%eax
797: 40 inc %eax
798: 89 45 ec mov %eax,-0x14(%ebp)
79b: a1 28 0b 00 00 mov 0xb28,%eax
7a0: 89 45 f0 mov %eax,-0x10(%ebp)
7a3: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
7a7: 75 23 jne 7cc <malloc+0x44>
7a9: c7 45 f0 20 0b 00 00 movl $0xb20,-0x10(%ebp)
7b0: 8b 45 f0 mov -0x10(%ebp),%eax
7b3: a3 28 0b 00 00 mov %eax,0xb28
7b8: a1 28 0b 00 00 mov 0xb28,%eax
7bd: a3 20 0b 00 00 mov %eax,0xb20
7c2: c7 05 24 0b 00 00 00 movl $0x0,0xb24
7c9: 00 00 00
7cc: 8b 45 f0 mov -0x10(%ebp),%eax
7cf: 8b 00 mov (%eax),%eax
7d1: 89 45 f4 mov %eax,-0xc(%ebp)
7d4: 8b 45 f4 mov -0xc(%ebp),%eax
7d7: 8b 40 04 mov 0x4(%eax),%eax
7da: 3b 45 ec cmp -0x14(%ebp),%eax
7dd: 72 4d jb 82c <malloc+0xa4>
7df: 8b 45 f4 mov -0xc(%ebp),%eax
7e2: 8b 40 04 mov 0x4(%eax),%eax
7e5: 3b 45 ec cmp -0x14(%ebp),%eax
7e8: 75 0c jne 7f6 <malloc+0x6e>
7ea: 8b 45 f4 mov -0xc(%ebp),%eax
7ed: 8b 10 mov (%eax),%edx
7ef: 8b 45 f0 mov -0x10(%ebp),%eax
7f2: 89 10 mov %edx,(%eax)
7f4: eb 26 jmp 81c <malloc+0x94>
7f6: 8b 45 f4 mov -0xc(%ebp),%eax
7f9: 8b 40 04 mov 0x4(%eax),%eax
7fc: 2b 45 ec sub -0x14(%ebp),%eax
7ff: 89 c2 mov %eax,%edx
801: 8b 45 f4 mov -0xc(%ebp),%eax
804: 89 50 04 mov %edx,0x4(%eax)
807: 8b 45 f4 mov -0xc(%ebp),%eax
80a: 8b 40 04 mov 0x4(%eax),%eax
80d: c1 e0 03 shl $0x3,%eax
810: 01 45 f4 add %eax,-0xc(%ebp)
813: 8b 45 f4 mov -0xc(%ebp),%eax
816: 8b 55 ec mov -0x14(%ebp),%edx
819: 89 50 04 mov %edx,0x4(%eax)
81c: 8b 45 f0 mov -0x10(%ebp),%eax
81f: a3 28 0b 00 00 mov %eax,0xb28
824: 8b 45 f4 mov -0xc(%ebp),%eax
827: 83 c0 08 add $0x8,%eax
82a: eb 3b jmp 867 <malloc+0xdf>
82c: a1 28 0b 00 00 mov 0xb28,%eax
831: 39 45 f4 cmp %eax,-0xc(%ebp)
834: 75 1e jne 854 <malloc+0xcc>
836: 83 ec 0c sub $0xc,%esp
839: ff 75 ec pushl -0x14(%ebp)
83c: e8 e7 fe ff ff call 728 <morecore>
841: 83 c4 10 add $0x10,%esp
844: 89 45 f4 mov %eax,-0xc(%ebp)
847: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
84b: 75 07 jne 854 <malloc+0xcc>
84d: b8 00 00 00 00 mov $0x0,%eax
852: eb 13 jmp 867 <malloc+0xdf>
854: 8b 45 f4 mov -0xc(%ebp),%eax
857: 89 45 f0 mov %eax,-0x10(%ebp)
85a: 8b 45 f4 mov -0xc(%ebp),%eax
85d: 8b 00 mov (%eax),%eax
85f: 89 45 f4 mov %eax,-0xc(%ebp)
862: e9 6d ff ff ff jmp 7d4 <malloc+0x4c>
867: c9 leave
868: c3 ret
|
programs/oeis/173/A173209.asm | neoneye/loda | 22 | 178910 | <reponame>neoneye/loda
; A173209: Partial sums of A000069.
; 1,3,7,14,22,33,46,60,76,95,116,138,163,189,217,248,280,315,352,390,431,473,517,564,613,663,715,770,826,885,946,1008,1072,1139,1208,1278,1351,1425,1501,1580,1661,1743,1827,1914,2002,2093,2186,2280,2377,2475,2575
lpb $0
mov $2,$0
sub $0,1
seq $2,128309 ; 2*A000069(n).
add $1,$2
lpe
div $1,2
add $1,1
mov $0,$1
|
src/asis/asis-declarations.ads | My-Colaborations/dynamo | 15 | 1511 | <filename>src/asis/asis-declarations.ads
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT INTERFACE COMPONENTS --
-- --
-- A S I S . D E C L A R A T I O N S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2006-2012, Free Software Foundation, Inc. --
-- --
-- This specification is adapted from the Ada Semantic Interface --
-- Specification Standard (ISO/IEC 15291) for use with GNAT. In accordance --
-- with the copyright of that document, you can freely copy and modify this --
-- specification, provided that if you redistribute a modified version, any --
-- changes that you have made are clearly indicated. --
-- --
-- This specification also contains suggestions and discussion items --
-- related to revising the ASIS Standard according to the changes proposed --
-- for the new revision of the Ada standard. The copyright notice above, --
-- and the license provisions that follow apply solely to these suggestions --
-- and discussion items that are separated by the corresponding comment --
-- sentinels --
-- --
-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- 15 package Asis.Declarations
-- Suggestions related to changing this specification to accept new Ada
-- features as defined in incoming revision of the Ada Standard (ISO 8652)
-- are marked by following comment sentinels:
--
-- --|A2005 start
-- ... the suggestion goes here ...
-- --|A2005 end
--
-- and the discussion items are marked by the comment sentinels of teh form:
--
-- --|D2005 start
-- ... the discussion item goes here ...
-- --|D2005 end
------------------------------------------------------------------------------
------------------------------------------------------------------------------
package Asis.Declarations is
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Asis.Declarations encapsulates a set of queries that operate on
-- A_Defining_Name and A_Declaration elements.
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- --|ER A_Declaration - 3.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- 15.1 function Names
------------------------------------------------------------------------------
function Names
(Declaration : Asis.Declaration)
return Asis.Defining_Name_List;
------------------------------------------------------------------------------
-- Declaration - Specifies the element to query
--
-- Returns a list of names defined by the declaration, in their order of
-- appearance. Declarations that define a single name will return a list of
-- length one.
--
-- Returns Nil_Element_List for A_Declaration Elements representing the
-- (implicit) declarations of universal and root numeric type (that is, if
-- Type_Kind (Type_Declaration_View (Declaration) = A_Root_Type_Definition.
--
-- Examples:
-- type Foo is (Pooh, Baah);
-- -- Returns a list containing one A_Defining_Name: Foo.
--
-- One, Uno : constant Integer := 1;
-- -- Returns a list of two A_Defining_Name elements: One and Uno.
--
-- Function designators that define operators are A_Defining_Operator_Symbol.
--
-- Results of this query may vary across ASIS implementations. Some
-- implementations may normalize all multi-name declarations into an
-- equivalent series of corresponding single name declarations. For those
-- implementations, this query will always return a list containing a single
-- name. See Reference Manual 3.3.1(7).
--
-- Appropriate Element_Kinds:
-- A_Declaration
--
-- Returns Element_Kinds:
-- A_Defining_Name
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Defining_Name - 3.1
-- --|ER---------------------------------------------------------------------
-- --|ER A_Defining_Identifier - 3.1 - no child elements
-- --|ER A_Defining_Operator_Symbol - 6.1 - no child elements
-- --|ER
-- --|ER A string image returned by:
-- --|ER function Defining_Name_Image
------------------------------------------------------------------------------
-- 15.2 function Defining_Name_Image
------------------------------------------------------------------------------
function Defining_Name_Image
(Defining_Name : Asis.Defining_Name)
return Program_Text;
------------------------------------------------------------------------------
-- Defining_Name - Specifies the element to query
--
-- Returns the program text image of the name. Embedded quotes (for operator
-- designator strings) are doubled.
--
-- A_Defining_Identifier elements are simple identifier names "Abc"
-- (name Abc).
--
-- A_Defining_Operator_Symbol elements have names with embedded quotes
-- """abs""" (function "abs").
--
-- A_Defining_Character_Literal elements have names with embedded apostrophes
-- "'x'" (literal 'x').
--
-- A_Defining_Enumeration_Literal elements have simple identifier names
-- "Blue" (literal Blue). If A_Defining_Enumeration_Literal element is of type
-- Character or Wide_Character but does not have a graphical presentation,
-- then the result is implementation-dependent.
--
-- A_Defining_Expanded_Name elements are prefix.selector names "A.B.C"
-- (name A.B.C).
--
-- The case of names returned by this query may vary between implementors.
-- Implementors are encouraged, but not required, to return names in the
-- same case as was used in the original compilation text.
--
-- The Defining_Name_Image of a label_statement_identifier does not include
-- the enclosing "<<" and ">>" that form the label syntax. Similarly, the
-- Defining_Name_Image of an identifier for a loop_statement or
-- block_statement does not include the trailing colon that forms the loop
-- name syntax. Use Asis.Text.Element_Image or Asis.Text.Lines queries to
-- obtain these syntactic constructs and any comments associated with them.
--
-- Appropriate Element_Kinds:
-- A_Defining_Name
-- --|ER---------------------------------------------------------------------
-- --|ER A_Defining_Character_Literal - 3.5.1 - no child elements
-- --|ER A_Defining_Enumeration_Literal - 3.5.1 - no child elements
-- --|ER
-- --|ER A program text image returned by:
-- --|ER function Defining_Name_Image
-- --|ER
-- --|ER A program text image of the enumeration literal value returned by:
-- --|ER function Position_Number_Image
-- --|ER function Representation_Value_Image
-- --
------------------------------------------------------------------------------
-- 15.3 function Position_Number_Image
------------------------------------------------------------------------------
function Position_Number_Image
(Defining_Name : Asis.Defining_Name)
return Wide_String;
------------------------------------------------------------------------------
-- Expression - Specifies the literal expression to query
--
-- Returns the program text image of the position number of the value of the
-- enumeration literal.
--
-- The program text returned is the image of the universal_integer value that
-- is returned by the attribute 'Pos if it were applied to the value.
-- For example: Integer'Image(Color'Pos(Blue)).
--
-- Appropriate Defining_Name_Kinds:
-- A_Defining_Character_Literal
-- A_Defining_Enumeration_Literal
--
------------------------------------------------------------------------------
-- 15.4 function Representation_Value_Image
------------------------------------------------------------------------------
function Representation_Value_Image
(Defining_Name : Asis.Defining_Name)
return Wide_String;
------------------------------------------------------------------------------
-- Expression - Specifies the literal expression to query
--
-- Returns the string image of the internal code for the enumeration literal.
--
-- If a representation_clause is defined for the enumeration type then the
-- string returned is the Integer'Wide_Image of the corresponding value given
-- in the enumeration_aggregate. Otherwise, the string returned is the same
-- as the Position_Number_Image.
--
-- Appropriate Defining_Name_Kinds:
-- A_Defining_Character_Literal
-- A_Defining_Enumeration_Literal
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Defining_Expanded_Name - 6.1
-- --|ER
-- --|ER A string image returned by:
-- --|ER function Defining_Name_Image
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Defining_Prefix
-- --|CR function Defining_Selector
------------------------------------------------------------------------------
-- 15.5 function Defining_Prefix
------------------------------------------------------------------------------
function Defining_Prefix
(Defining_Name : Asis.Defining_Name)
return Asis.Name;
------------------------------------------------------------------------------
-- Defining_Name - Specifies the element to query
--
-- Returns the element that forms the prefix of the name. The prefix is the
-- name to the left of the rightmost 'dot' in the expanded name.
-- The Defining_Prefix of A.B is A, and of A.B.C is A.B.
--
-- Appropriate Defining_Name_Kinds:
-- A_Defining_Expanded_Name
--
-- Returns Expression_Kinds:
-- An_Identifier
-- A_Selected_Component
--
------------------------------------------------------------------------------
-- 15.6 function Defining_Selector
------------------------------------------------------------------------------
function Defining_Selector
(Defining_Name : Asis.Defining_Name)
return Asis.Defining_Name;
------------------------------------------------------------------------------
-- Defining_Name - Specifies the element to query
--
-- Returns the element that forms the selector of the name. The selector is
-- the name to the right of the rightmost 'dot' in the expanded name.
-- The Defining_Selector of A.B is B, and of A.B.C is C.
--
-- Appropriate Defining_Name_Kinds:
-- A_Defining_Expanded_Name
--
-- Returns Defining_Name_Kinds:
-- A_Defining_Identifier
--
-- --|ER---------------------------------------------------------------------
-- --|ER An_Ordinary_Type_Declaration - 3.2.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Discriminant_Part
-- --|CR function Type_Declaration_View
------------------------------------------------------------------------------
-- 15.7 function Discriminant_Part
------------------------------------------------------------------------------
function Discriminant_Part
(Declaration : Asis.Declaration)
return Asis.Definition;
------------------------------------------------------------------------------
-- Declaration - Specifies the type declaration to query
--
-- Returns the discriminant_part, if any, from the type_declaration or
-- formal_type_declaration.
--
-- Returns a Nil_Element if the Declaration has no explicit discriminant_part.
--
-- Appropriate Declaration_Kinds:
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- An_Incomplete_Type_Declaration
-- |A2005 start
-- A_Tagged_Incomplete_Type_Declaration (implemented)
-- |A2005 end
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
-- A_Formal_Type_Declaration
--
-- Returns Definition_Kinds:
-- Not_A_Definition
-- An_Unknown_Discriminant_Part
-- A_Known_Discriminant_Part
--
------------------------------------------------------------------------------
-- 15.8 function Type_Declaration_View
------------------------------------------------------------------------------
function Type_Declaration_View
(Declaration : Asis.Declaration)
return Asis.Definition;
------------------------------------------------------------------------------
-- Declaration - Specifies the declaration element to query
--
-- Returns the definition characteristics that form the view of the
-- type_declaration. The view is the remainder of the declaration following
-- the reserved word "is".
--
-- For a full_type_declaration, returns the type_definition, task_definition,
-- or protected_definition following the reserved word "is" in the
-- declaration.
--
-- Returns a Nil_Element for a task_type_declaration that has no explicit
-- task_definition.
--
-- For a private_type_declaration or private_extension_declaration, returns
-- the definition element representing the private declaration view.
--
-- For a subtype_declaration, returns the subtype_indication.
--
-- For a formal_type_declaration, returns the formal_type_definition.
--
-- Appropriate Declaration_Kinds:
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
-- A_Subtype_Declaration
-- A_Formal_Type_Declaration
--
-- Returns Definition_Kinds:
-- Not_A_Definition
-- A_Type_Definition
-- A_Subtype_Indication
-- A_Private_Type_Definition
-- A_Tagged_Private_Type_Definition
-- A_Private_Extension_Definition
-- A_Task_Definition
-- A_Protected_Definition
-- A_Formal_Type_Definition
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Subtype_Declaration - 3.2.2
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Type_Declaration_View
-- --|ER---------------------------------------------------------------------
-- --|ER A_Variable_Declaration - 3.3.1
-- --|CR
-- --|CR Child elements:
-- --|CR function Names
-- --|CR function Object_Declaration_View
-- --|CR function Initialization_Expression
--
------------------------------------------------------------------------------
-- 15.9 function Object_Declaration_View
------------------------------------------------------------------------------
function Object_Declaration_View
(Declaration : Asis.Declaration)
return Asis.Definition;
------------------------------------------------------------------------------
-- Declaration - Specifies the declaration element to query
--
-- Returns the definition characteristics that form the view of the
-- object_declaration.
-- --|A2005 start
-- The view is the subtype_indication, a full type
-- definition of the object_declaration, a subtype mark or an access
-- definition. An initial value, if any, is not
-- part of this view.
-- --|A2005 end
--
-- For a single_task_declaration or single_protected_declaration, returns
-- the task_definition or protected_definition following the reserved word
-- "is".
--
-- Returns a Nil_Element for a single_task_declaration that has no explicit
-- task_definition.
--
-- --D2005 start
-- For a declaration containing a colon, returns the definition element
-- representing the part of the declaration following the colon.
-- --|D2005 end
--
-- Appropriate Declaration_Kinds:
-- A_Variable_Declaration
-- A_Constant_Declaration
-- A_Deferred_Constant_Declaration
-- A_Single_Protected_Declaration
-- A_Single_Task_Declaration
-- A_Component_Declaration
-- --|A2005 start
-- A_Discriminant_Specification (implemented)
-- A_Parameter_Specification (implemented)
-- A_Return_Object_Declaration
-- A_Formal_Object_Declaration
-- An_Object_Renaming_Declaration
-- --|A2005 end
--
-- Returns Definition_Kinds:
-- Not_A_Definition
-- A_Type_Definition
-- Returns Type_Kinds:
-- A_Constrained_Array_Definition
-- A_Subtype_Indication
-- A_Task_Definition
-- A_Protected_Definition
-- A_Component_Definition
-- --|A2005 start
-- An_Access_Definition
--
-- Returns Expression_Kinds:
-- An_Identifier
-- A_Selected_Component
-- An_Attribute_Reference
-- --D2005 start
-- The wording of the query definition needs some more revising
--
-- Probably we need a kind of an Application Note here that would say that
-- in ASIS this query is the only proper way to get a definition of any
-- object, and that Declaration_Subtype_Mark query should not be used in ASIS
-- applications that are supposed to analyze Ada 2005 code.
-- --|D2005 end
-- --|A2005 end
-- --|A2010 start
function Aspect_Specifications
(Declaration : Asis.Element)
return Asis.Element_List;
------------------------------------------------------------------------------
-- Returns a list of aspect specifications given for the declaration, in
-- their order of appearance. Returns Nil_Element_List if no aspect
-- specification is given for the declaration. Returns Nil_Element_List
-- if Is_Part_Of_Inherited (Declaration)
--
-- Appropriate Declaration_Kinds:
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Single_Task_Declaration
-- A_Single_Protected_Declaration
-- A_Variable_Declaration
-- A_Constant_Declaration
-- A_Component_Declaration
-- A_Procedure_Declaration
-- A_Null_Procedure_Declaration
-- A_Function_Declaration
-- An_Expression_Function_Declaration
-- A_Package_Declaration
-- A_Package_Body_Declaration
-- An_Object_Renaming_Declaration
-- An_Exception_Renaming_Declaration
-- A_Package_Renaming_Declaration
-- A_Procedure_Renaming_Declaration
-- A_Function_Renaming_Declaration
-- A_Generic_Package_Renaming_Declaration
-- A_Generic_Procedure_Renaming_Declaration
-- A_Generic_Function_Renaming_Declaration
-- A_Task_Body_Declaration
-- A_Protected_Body_Declaration
-- An_Exception_Declaration
-- A_Generic_Package_Declaration
-- A_Package_Instantiation
-- A_Procedure_Instantiation
-- A_Function_Instantiation
-- A_Formal_Object_Declaration
-- A_Formal_Type_Declaration
-- A_Formal_Procedure_Declaration
-- A_Formal_Function_Declaration
-- A_Formal_Package_Declaration
-- A_Formal_Package_Declaration_With_Box)
--
-- Returns Definition_Kinds:
-- An_Aspect_Specification
-- --|A2010 end
------------------------------------------------------------------------------
-- 15.10 function Initialization_Expression
------------------------------------------------------------------------------
function Initialization_Expression
(Declaration : Asis.Declaration)
return Asis.Expression;
------------------------------------------------------------------------------
-- Declaration - Specifies the object declaration to query
--
-- Returns the initialization expression [:= expression] of the declaration.
--
-- Returns a Nil_Element if the declaration does not include an explicit
-- initialization.
--
-- Appropriate Declaration_Kinds:
-- A_Variable_Declaration
-- A_Constant_Declaration
-- An_Integer_Number_Declaration
-- A_Real_Number_Declaration
-- A_Discriminant_Specification
-- A_Component_Declaration
-- A_Parameter_Specification
-- |A2005 start
-- A_Return_Object_Declaration
-- |A2005 end
-- A_Formal_Object_Declaration
--
-- Returns Element_Kinds:
-- Not_An_Element
-- An_Expression
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Constant_Declaration - 3.3.1
-- --|CR
-- --|CR Child elements:
-- --|CR function Names
-- --|CR function Object_Declaration_View
-- --|CR function Initialization_Expression
-- --|CR
-- --|CR Element queries that provide semantically related elements:
-- --|CR function Corresponding_Constant_Declaration
--
------------------------------------------------------------------------------
-- 15.11 function Corresponding_Constant_Declaration
------------------------------------------------------------------------------
function Corresponding_Constant_Declaration
(Name : Asis.Defining_Name)
return Asis.Declaration;
------------------------------------------------------------------------------
-- Name - Specifies the name of a constant declaration to query
--
-- Returns the corresponding full constant declaration when given the name
-- from a deferred constant declaration.
--
-- Returns the corresponding deferred constant declaration when given the name
-- from a full constant declaration.
--
-- Returns a Nil_Element if the deferred constant declaration is completed
-- by a pragma Import.
--
-- Returns a Nil_Element if the full constant declaration has no corresponding
-- deferred constant declaration.
--
-- Raises ASIS_Inappropriate_Element with a Status of Value_Error if the
-- argument is not the name of a constant or a deferred constant.
--
-- The name of a constant declaration is available from both the Names and the
-- Corresponding_Name_Definition queries.
--
-- Appropriate Element_Kinds:
-- A_Defining_Name
--
-- Returns Declaration_Kinds:
-- Not_A_Declaration
-- A_Constant_Declaration
-- A_Deferred_Constant_Declaration
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Deferred_Constant_Declaration - 3.3.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Object_Declaration_View
-- --|ER---------------------------------------------------------------------
-- --|ER An_Integer_Number_Declaration - 3.3.2
-- --|ER A_Real_Number_Declaration - 3.3.2
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Initialization_Expression
-- --|ER---------------------------------------------------------------------
-- --|ER An_Enumeration_Literal_Specification - 3.5.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|ER---------------------------------------------------------------------
-- --|ER A_Discriminant_Specification - 3.7
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Declaration_Subtype_Mark
-- --|CR function Initialization_Expression
--
------------------------------------------------------------------------------
-- 15.12 function Declaration_Subtype_Mark
------------------------------------------------------------------------------
function Declaration_Subtype_Mark
(Declaration : Asis.Declaration)
return Asis.Expression;
------------------------------------------------------------------------------
-- Declaration - Specifies the declaration element to query
--
-- Returns the expression element that names the subtype_mark of the
-- declaration.
--
-- --|A2005 start
-- --|D2005 start
-- In ASIS 2005 this query is an obsolescent feature, it should not be used
-- for analyzing Ada 2005 code. We need a proper warning note in the ASIS
-- Standard. See also Object_Declaration_View
-- --|D2005 end
-- --|A2005 end
-- Appropriate Declaration_Kinds:
-- A_Discriminant_Specification
-- A_Parameter_Specification
-- A_Formal_Object_Declaration
-- An_Object_Renaming_Declaration
--
-- Returns Expression_Kinds:
-- An_Identifier
-- A_Selected_Component
-- An_Attribute_Reference
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Component_Declaration - 3.8
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Object_Declaration_View
-- --|CR function Initialization_Expression
-- --|ER---------------------------------------------------------------------
-- --|ER An_Incomplete_Type_Declaration - 3.10.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Discriminant_Part
--
------------------------------------------------------------------------------
-- 15.13 function Corresponding_Type_Declaration
------------------------------------------------------------------------------
function Corresponding_Type_Declaration
(Declaration : Asis.Declaration)
return Asis.Declaration;
function Corresponding_Type_Declaration
(Declaration : Asis.Declaration;
The_Context : Asis.Context)
return Asis.Declaration;
------------------------------------------------------------------------------
-- Declaration - Specifies the type declaration to query
-- The_Context - Specifies the program Context to use for obtaining package
-- body information
--
-- Returns the corresponding full type declaration when given a private or
-- incomplete type declaration. Returns the corresponding private or
-- incomplete type declaration when given a full type declaration.
--
-- These two function calls will always produce identical results:
--
-- Decl2 := Corresponding_Type_Declaration ( Decl1 );
-- Decl2 := Corresponding_Type_Declaration
-- ( Decl1,
-- Enclosing_Context ( Enclosing_Compilation_Unit ( Decl1 )));
--
-- Returns a Nil_Element when a full type declaration is given that has no
-- corresponding private or incomplete type declaration, or when a
-- corresponding type declaration does not exist within The_Context.
--
-- The parameter The_Context is used whenever the corresponding full type of
-- an incomplete type is in a corresponding package body. See Reference Manual
-- 3.10.1(3). Any non-Nil result will always have the given Context as its
-- Enclosing_Context.
--
-- Appropriate Declaration_Kinds:
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- An_Incomplete_Type_Declaration
-- |A2005 start
-- A_Tagged_Incomplete_Type_Declaration (implemented)
-- |A2005 end
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
--
-- Returns Declaration_Kinds:
-- Not_A_Declaration
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- An_Incomplete_Type_Declaration
-- |A2005 start
-- A_Tagged_Incomplete_Type_Declaration (implemented)
-- |A2005 end
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
--
-- --|AN Application Note:
-- --|AN
-- --|AN This function is an obsolescent feature for Ada/ASIS 2012, because
-- --|AN in Ada 2012 an incomplete type can be completed by a private type
-- --|AN and then the private type is completed by a full type declaration.
-- --|AN In this case when allied to the private type declaration, the query
-- --|AN has no way to know which corresponding type declaration (incomplete
-- --|AN or full) should be returned as the result. In this case the query
-- --|AN raises ASIS_Inappropriate_Element
-- --|AN
-- --|AN If an application is supposed to be able to process Ada 2012,
-- --|AN do not use this query and use two new queries:
-- --|AN
-- --|AN Corresponding_Type_Completion
-- --|AN and
-- --|AN Corresponding_Type_Partial_View
-- --|A2010 start
------------------------------------------------------------------------------
-- 15.??? function Corresponding_Type_Completion
------------------------------------------------------------------------------
function Corresponding_Type_Completion
(Declaration : Asis.Declaration)
return Asis.Declaration;
-- Declaration - Specifies the type declaration to query
--
-- Returns the type declaration that is a completion of an argument private or
-- incomplete type declaration. In case when the argument is an incomplete
-- type declaration that is completed by a private type declaration and this
-- private type declaration is in turn completed by a full type declaration,
-- the result is the private type declaration but not the full type
-- declaration.
--
-- Returns a Nil_Element when an incomplete type declaration is given but
-- the corresponding completion does not exist within the enclosing Context.
--
-- Appropriate Declaration_Kinds:
-- An_Incomplete_Type_Declaration
-- A_Tagged_Incomplete_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
--
-- Returns Declaration_Kinds:
-- Not_A_Declaration
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
------------------------------------------------------------------------------
-- 15.??? function Corresponding_Type_Partial_View
------------------------------------------------------------------------------
function Corresponding_Type_Partial_View
(Declaration : Asis.Declaration)
return Asis.Declaration;
-- Declaration - Specifies the type declaration to query
--
-- Returns the type declaration the argument declaration is a completion for.
-- In case when the argument is a full type declaration that is a completion
-- of a private type (or private extension) declaration that is in turn the
-- completion of an incomplete type declaration, the result is the private
-- type (private extension) declaration but not the incomplete type
-- declaration.
--
-- Returns a Nil_Element when an argument declaration is not a completion of
-- any incomplete/private type declaration.
--
-- Appropriate Declaration_Kinds:
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
--
-- Returns Declaration_Kinds:
-- Not_A_Declaration
-- An_Incomplete_Type_Declaration
-- A_Tagged_Incomplete_Type_Declaration (implemented)
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
-- --|A2010 end
------------------------------------------------------------------------------
-- 15.14 function Corresponding_First_Subtype
------------------------------------------------------------------------------
function Corresponding_First_Subtype
(Declaration : Asis.Declaration)
return Asis.Declaration;
------------------------------------------------------------------------------
-- Declaration - Specifies the subtype_declaration to query
--
-- This function recursively unwinds subtyping to return at a type_declaration
-- that defines the first subtype of the argument.
--
-- Returns a declaration that Is_Identical to the argument if the argument is
-- already the first subtype.
--
-- --|D2005 start
-- We need to define the effect of this function in case if the argument
-- represents a subtype declaration of the form:
--
-- subtype St is T'Class;
-- or
-- subtype St_1 is St;
--
-- I would add the following paragraph:
--
-- If the argument is a subtype of a class-wide type, returns the
-- declaration of the specific type that is a root type of the class.
--
-- Probably, we need also to add to the core ASIS the following query:
--
-- function Is_Class_Wide
-- (Declaration : Asis.Declaration)
-- return Boolean;
--
------------------------------------------------------------------------------
-- Declaration - Specifies the subtype_declaration to query
--
-- This function checks if the argument subtype is a subtype of some
-- class-wide type.
--
-- Returns False for any unexpected Element
--
-- Expected Declaration_Kinds:
-- A_Subtype_Declaration
--
-- |D2005 end
--
-- Appropriate Declaration_Kinds:
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
-- A_Subtype_Declaration
-- A_Formal_Type_Declaration
--
-- Returns Declaration_Kinds:
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
-- A_Formal_Type_Declaration
--
------------------------------------------------------------------------------
-- 15.15 function Corresponding_Last_Constraint
------------------------------------------------------------------------------
function Corresponding_Last_Constraint
(Declaration : Asis.Declaration)
return Asis.Declaration;
------------------------------------------------------------------------------
-- Declaration - Specifies the subtype_declaration or type_declaration to
-- query.
--
-- This function recursively unwinds subtyping to return at a declaration
-- that is either a type_declaration or subtype_declaration that imposes
-- an explicit constraint on the argument.
--
-- Unwinds a minimum of one level of subtyping even if an argument declaration
-- itself has a constraint.
--
-- Returns a declaration that Is_Identical to the argument if the argument is
-- a type_declaration, i.e. the first subtype.
--
-- Appropriate Declaration_Kinds:
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
-- A_Subtype_Declaration
-- A_Formal_Type_Declaration
--
-- Returns Declaration_Kinds:
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
-- A_Subtype_Declaration
-- A_Formal_Type_Declaration
--
------------------------------------------------------------------------------
-- 15.16 function Corresponding_Last_Subtype
------------------------------------------------------------------------------
function Corresponding_Last_Subtype
(Declaration : Asis.Declaration)
return Asis.Declaration;
------------------------------------------------------------------------------
-- Declaration - Specifies the subtype_declaration or type_declaration
-- to query.
--
-- This function unwinds subtyping a single level to arrive at a declaration
-- that is either a type_declaration or subtype_declaration.
--
-- Returns a declaration that Is_Identical to the argument if the argument is
-- a type_declaration (i.e., the first subtype).
--
-- --|D2005 start
-- The existing definition of this query does not work in case if the argument
-- A_Subtype_Declaration Element contains an attribute reference as
-- subtype_mark in subtype_indication part. Consider:
--
-- subtype A is B'Class;
-- or
-- subtype C is D'Base;
--
-- The proper solution here seems to be returning the declaration of B and D
-- respectively. We need a paragraph in the query definition describing this.
--
-- --|D2005 end
--
-- Appropriate Declaration_Kinds:
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
-- A_Subtype_Declaration
-- A_Formal_Type_Declaration
--
-- Returns Declaration_Kinds:
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
-- A_Subtype_Declaration
-- A_Formal_Type_Declaration
--
------------------------------------------------------------------------------
-- 15.17 function Corresponding_Representation_Clauses
------------------------------------------------------------------------------
function Corresponding_Representation_Clauses
(Declaration : Asis.Declaration)
return Asis.Representation_Clause_List;
------------------------------------------------------------------------------
-- Declaration - Specifies the declaration to query
--
-- Returns all representation_clause elements that apply to the declaration.
--
-- Returns a Nil_Element_List if no clauses apply to the declaration.
--
-- The clauses returned may be the clauses applying to a parent type if the
-- type is a derived type with no explicit representation. These clauses
-- are not Is_Part_Of_Implicit, they are the representation_clause elements
-- specified in conjunction with the declaration of the parent type.
--
-- All Declaration_Kinds are appropriate except Not_A_Declaration.
--
-- Returns Clause_Kinds:
-- A_Representation_Clause
--
-- --|D2005 start
-- This query works on declarations, but representation clauses are applied
-- to entities, but not declarations. The problem here is that one declaration
-- may declare several entities, and each of these entities may have its
-- own collection of representation clauses applied to the entity. It seems
-- that what is of areal interest for an ASIS application is a set of queries
-- applied to a particular entity, but not a union of representation clauses
-- applied to all the entities declared in the given declaration.
--
-- So it would be nice to have Corresponding_Representation_Clauses working on
-- entities (A_Defining_Name Elements), but not declarations. We can not
-- change the semantic of this query because of upward compatibility reasons,
-- so we can consider adding a new query -
-- Corresponding_Entity_Representation_Clauses, that will work on entities
-- (A_Defining_Name Elements)
-- --|D2005 end
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Loop_Parameter_Specification - 5.5
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Specification_Subtype_Definition
--
------------------------------------------------------------------------------
-- 15.18 function Specification_Subtype_Definition
------------------------------------------------------------------------------
function Specification_Subtype_Definition
(Specification : Asis.Declaration)
return Asis.Discrete_Subtype_Definition;
------------------------------------------------------------------------------
-- Specification - Specifies the loop_parameter_specification or
-- Entry_Index_Specification to query
--
-- Returns the Discrete_Subtype_Definition of the specification.
--
-- Appropriate Declaration_Kinds:
-- A_Loop_Parameter_Specification
-- An_Entry_Index_Specification
--
-- Returns Definition_Kinds:
-- A_Discrete_Subtype_Definition
--
-- --|A2012 start
--
-- Below is the draft proposal for new iterator syntax in Ada 2012. This
-- proposal has not been discussed with ARG yet, so it has enough chances
-- to be changed
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Generalized_Iterator_Specification - 5.5.2
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Iteration_Scheme_Name
--
-- --|ER---------------------------------------------------------------------
-- --|ER An_Element_Iterator_Specification - 5.5.2
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Subtype_Indication
-- --|CR function Name
--
-- --|A2012 end
function Iteration_Scheme_Name
(Iterator_Specification : Asis.Element)
return Asis.Element;
-- Specification - Specifies the iterator specification to query
--
-- Returns the name of the iterator routine or array/iterable name that
-- follows the keywird IN/OF [RESERVE]
--
-- Appropriate Declaration_Kinds:
-- A_Generalized_Iterator_Specification
-- An_Element_Iterator_Specification
--
-- Returns Element_Kind
-- An_Expression
--
function Subtype_Indication
(Iterator_Specification : Asis.Element)
return Asis.Element;
-- Specification - Specifies the iterator specification to query
--
-- Returns the subtype indication that is used in the specification of
-- iterator parameter. Returns Nil_Element if there is no subtype indication.
--
-- Appropriate Declaration_Kinds:
-- An_Element_Iterator_Specification
--
-- Returns Definition_Kinds:
-- A_Subtype_Indication
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Procedure_Declaration - 6.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Parameter_Profile
--
------------------------------------------------------------------------------
-- 15.19 function Parameter_Profile
------------------------------------------------------------------------------
function Parameter_Profile
(Declaration : Asis.Declaration)
return Asis.Parameter_Specification_List;
------------------------------------------------------------------------------
-- Declaration - Specifies the subprogram or entry declaration to query
--
-- Returns a list of parameter specifications in the formal part of the
-- subprogram or entry declaration, in their order of appearance.
--
-- Returns a Nil_Element_List if the subprogram or entry has no
-- parameters.
--
-- Results of this query may vary across ASIS implementations. Some
-- implementations normalize all multiple name parameter specifications into
-- an equivalent sequence of corresponding single name parameter
-- specifications. See Reference Manual 3.3.1(7).
--
-- Appropriate Declaration_Kinds:
-- A_Procedure_Declaration
-- A_Function_Declaration
-- A_Procedure_Body_Declaration
-- A_Function_Body_Declaration
-- |A2005 start
-- A_Null_Procedure_Declaration (implemented)
-- |A2005 end
-- A_Procedure_Renaming_Declaration
-- A_Function_Renaming_Declaration
-- An_Entry_Declaration
-- An_Entry_Body_Declaration
-- A_Procedure_Body_Stub
-- A_Function_Body_Stub
-- A_Generic_Function_Declaration
-- A_Generic_Procedure_Declaration
-- A_Formal_Function_Declaration
-- A_Formal_Procedure_Declaration
-- An_Expression_Function_Declaration
--
-- Returns Declaration_Kinds:
-- A_Parameter_Specification
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Function_Declaration - 6.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Parameter_Profile
-- --|CR function Result_Profile
--
------------------------------------------------------------------------------
-- 15.20 function Result_Profile
------------------------------------------------------------------------------
function Result_Profile
(Declaration : Asis.Declaration)
-- |A2005 start
return Asis.Element;
-- |A2005 end
------------------------------------------------------------------------------
-- Declaration - Specifies the function declaration to query
--
-- |A2005 start
-- Returns the definition for the return type for the function. It may
-- be subtype_mark expression or anonymous access_definition
-- |A2005 end
--
-- Appropriate Declaration_Kinds:
-- A_Function_Declaration
-- A_Function_Body_Declaration
-- A_Function_Body_Stub
-- A_Function_Renaming_Declaration
-- A_Generic_Function_Declaration
-- A_Formal_Function_Declaration
--
-- Returns Expression_Kinds:
-- An_Identifier
-- A_Selected_Component
-- An_Attribute_Reference
--
-- |A2005 start
-- Returns Definition_Kinds:
-- An_Access_Definition
-- |A2005 end
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Parameter_Specification - 6.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Declaration_Subtype_Mark
-- --|CR function Initialization_Expression
-- --|ER---------------------------------------------------------------------
-- --|ER A_Procedure_Body_Declaration - 6.3
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Parameter_Profile
-- --|CR function Body_Declarative_Items
-- --|CR function Body_Statements
-- --|CR function Body_Exception_Handlers
-- --|CR function Body_Block_Statement - obsolescent, not recommended
--
-- |A2012 start
------------------------------------------------------------------------------
-- 15.#??? function Result_Expression
------------------------------------------------------------------------------
function Result_Expression
(Declaration : Asis.Declaration)
return Asis.Expression;
------------------------------------------------------------------------------
-- Declaration specifies the expression function declaration to query.
-- Returns an expression that defines the result of an expression function.
-- The parentheses that syntactically surround the expression are considered
-- as the part of the result. Thus, the Expression_Kind of the result is
-- always A_Parenthesized_Expression
--
-- Appropriate Declaration_Kinds:
-- An_Expression_Function_Declaration
--
-- Returns Expression_Kinds:
-- A_Parenthesized_Expression
--
-- |A2012 end
-- |A2005 start
------------------------------------------------------------------------------
-- 15.#??? function Is_Overriding_Declaration
------------------------------------------------------------------------------
function Is_Overriding_Declaration
(Declaration : Asis.Declaration)
return Boolean;
------------------------------------------------------------------------------
-- Declaration - Specifies the subprogram declaration to query
--
-- Returns True if the declaration contains the overriding indicator of the
-- form "overriding"
--
-- Returns False for any unexpected Element.
--
-- Expected Declaration_Kinds:
-- A_Procedure_Declaration
-- A_Function_Declaration
-- A_Procedure_Body_Declaration
-- A_Function_Body_Declaration
-- A_Null_Procedure_Declaration
-- A_Procedure_Renaming_Declaration
-- A_Function_Renaming_Declaration
-- An_Entry_Declaration
-- A_Procedure_Body_Stub
-- A_Function_Body_Stub
-- A_Procedure_Instantiation
-- A_Function_Instantiation
--
--
------------------------------------------------------------------------------
-- 15.#??? function Is_Not_Overriding_Declaration
------------------------------------------------------------------------------
function Is_Not_Overriding_Declaration
(Declaration : Asis.Declaration)
return Boolean;
------------------------------------------------------------------------------
-- Declaration - Specifies the subprogram declaration to query
--
-- Returns True if the declaration contains the overriding indicator of the
-- form "not overriding"
--
-- Returns False for any unexpected Element.
--
-- Expected Declaration_Kinds:
-- A_Procedure_Declaration
-- A_Function_Declaration
-- A_Procedure_Body_Declaration
-- A_Function_Body_Declaration
-- A_Null_Procedure_Declaration
-- A_Procedure_Renaming_Declaration
-- A_Function_Renaming_Declaration
-- An_Entry_Declaration
-- A_Procedure_Body_Stub
-- A_Function_Body_Stub
-- A_Procedure_Instantiation
-- A_Function_Instantiation
--
--
-- |A2005 end
------------------------------------------------------------------------------
-- 15.21 function Body_Declarative_Items
------------------------------------------------------------------------------
function Body_Declarative_Items
(Declaration : Asis.Declaration;
Include_Pragmas : Boolean := False)
return Asis.Element_List;
------------------------------------------------------------------------------
-- Declaration - Specifies the body declaration to query
-- Include_Pragmas - Specifies whether pragmas are to be returned
--
-- Returns a list of all basic declarations, representation specifications,
-- use clauses, and pragmas in the declarative part of the body, in their
-- order of appearance.
--
-- Returns a Nil_Element_List if there are no declarative_item or pragma
-- elements.
--
-- Results of this query may vary across ASIS implementations. Some
-- implementations normalize all multi-name declarations into an
-- equivalent sequence of corresponding single name object declarations.
-- See Reference Manual 3.3.1(7).
--
-- Appropriate Declaration_Kinds:
-- A_Function_Body_Declaration
-- A_Procedure_Body_Declaration
-- A_Package_Body_Declaration
-- A_Task_Body_Declaration
-- An_Entry_Body_Declaration
--
-- Returns Element_Kinds:
-- A_Pragma
-- A_Declaration
-- A_Clause
--
------------------------------------------------------------------------------
-- 15.22 function Body_Statements
------------------------------------------------------------------------------
function Body_Statements
(Declaration : Asis.Declaration;
Include_Pragmas : Boolean := False)
return Asis.Statement_List;
------------------------------------------------------------------------------
-- Declaration - Specifies the body declaration to query
-- Include_Pragmas - Specifies whether pragmas are to be returned
--
-- Returns a list of the statements and pragmas for the body, in
-- their order of appearance.
--
-- --|A2012 start
-- In case if a sequence_of_Statements in the argument Element contains
-- 'floating' labels (labels that completes sequence_of_statements and that
-- are not attached to any statement in the source code), the result list
-- contains as its last element an implicit A_Null_Statement element these
-- 'floating' labels are attached to. The Enclosing_Element of this implicit
-- A_Null_Statement element is the argument Element.
-- --|A2012 start
--
-- Returns a Nil_Element_List if there are no statements or pragmas.
--
-- Appropriate Declaration_Kinds:
-- A_Function_Body_Declaration
-- A_Procedure_Body_Declaration
-- A_Package_Body_Declaration
-- A_Task_Body_Declaration
-- An_Entry_Body_Declaration
--
-- Returns Element_Kinds:
-- A_Pragma
-- A_Statement
--
------------------------------------------------------------------------------
-- 15.23 function Body_Exception_Handlers
------------------------------------------------------------------------------
function Body_Exception_Handlers
(Declaration : Asis.Declaration;
Include_Pragmas : Boolean := False)
return Asis.Exception_Handler_List;
------------------------------------------------------------------------------
-- Declaration - Specifies the body declaration to query
-- Include_Pragmas - Specifies whether pragmas are to be returned
--
-- Returns a list of the exception_handler elements of the body, in their
-- order of appearance.
--
-- The only pragmas returned are those following the reserved word "exception"
-- and preceding the reserved word "when" of first exception handler.
--
-- Returns a Nil_Element_List if there are no exception_handler or pragma
-- elements.
--
-- Appropriate Declaration_Kinds:
-- A_Function_Body_Declaration
-- A_Procedure_Body_Declaration
-- A_Package_Body_Declaration
-- A_Task_Body_Declaration
-- An_Entry_Body_Declaration
--
-- Returns Element_Kinds:
-- An_Exception_Handler
-- A_Pragma
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Function_Body_Declaration - 6.3
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Parameter_Profile
-- --|CR function Result_Profile
-- --|CR function Body_Declarative_Items
-- --|CR function Body_Statements
-- --|CR function Body_Exception_Handlers
-- --|CR function Body_Block_Statement - obsolescent, not recommended
--
------------------------------------------------------------------------------
-- 15.24 function Body_Block_Statement
------------------------------------------------------------------------------
-- Function Body_Block_Statement is a new query that supplies the
-- equivalent combined functionality of the replaced queries:
-- Subprogram_Body_Block, Package_Body_Block, and Task_Body_Block.
-- Use of the query Body_Block_Statement is not recommended in new programs.
-- This functionality is redundant with the queries Body_Declarative_Items,
-- Body_Statements, and Body_Exception_Handlers.
-------------------------------------------------------------------------------
function Body_Block_Statement
(Declaration : Asis.Declaration)
return Asis.Statement;
-------------------------------------------------------------------------------
-- Declaration - Specifies the program unit body to query
--
-- Returns a block statement that is the structural equivalent of the body.
-- The block statement is not Is_Part_Of_Implicit. The block includes
-- the declarative part, the sequence of statements, and any exception
-- handlers.
--
-- Appropriate Declaration_Kinds:
-- A_Function_Body_Declaration
-- A_Procedure_Body_Declaration
-- A_Package_Body_Declaration
-- A_Task_Body_Declaration
-- An_Entry_Body_Declaration
--
-- Returns Statement_Kinds:
-- A_Block_Statement
--
-- --|AN Application Note:
-- --|AN
-- --|AN This function is an obsolescent feature retained for compatibility
-- --|AN with ASIS 83. It is never called by Traverse_Element. Use of this
-- --|AN query is not recommended in new programs.
--
------------------------------------------------------------------------------
-- 15.25 function Is_Name_Repeated
------------------------------------------------------------------------------
function Is_Name_Repeated
(Declaration : Asis.Declaration)
return Boolean;
------------------------------------------------------------------------------
-- Declaration - Specifies the declaration to query
--
-- Returns True if the name of the declaration is repeated after the "end"
-- which terminates the declaration.
--
-- Returns False for any unexpected Element.
--
-- Expected Declaration_Kinds:
-- A_Package_Declaration
-- A_Package_Body_Declaration
-- A_Procedure_Body_Declaration
-- A_Function_Body_Declaration
-- A_Generic_Package_Declaration
-- A_Task_Type_Declaration
-- A_Single_Task_Declaration
-- A_Task_Body_Declaration
-- A_Protected_Type_Declaration
-- A_Single_Protected_Declaration
-- A_Protected_Body_Declaration
-- An_Entry_Body_Declaration
--
------------------------------------------------------------------------------
-- 15.26 function Corresponding_Declaration
------------------------------------------------------------------------------
function Corresponding_Declaration
(Declaration : Asis.Declaration)
return Asis.Declaration;
function Corresponding_Declaration
(Declaration : Asis.Declaration;
The_Context : Asis.Context)
return Asis.Declaration;
------------------------------------------------------------------------------
-- Declaration - Specifies the specification to query
-- The_Context - Specifies a Context to use
--
-- Returns the corresponding specification of a subprogram, package, or task
-- body declaration or an expression function declaration. Returns the
-- expanded generic specification template for generic instantiations. The
-- argument can be a Unit_Declaration from a Compilation_Unit, or, it can be
-- any appropriate body declaration from any declarative context.
--
-- These two function calls will always produce identical results:
--
-- Decl2 := Corresponding_Declaration (Decl1);
-- Decl2 := Corresponding_Declaration
-- (Decl1,
-- Enclosing_Context ( Enclosing_Compilation_Unit ( Decl1 )));
--
-- If a specification declaration is given, the same element is returned,
-- unless it is a generic instantiation or an inherited subprogram declaration
-- (see below).
--
-- If a subprogram renaming declaration is given:
--
-- a) in case of renaming-as-declaration, the same element is returned;
-- b) in case of renaming-as-body, the subprogram declaration completed
-- by this subprogram renaming declaration is returned.
-- (Reference Manual, 8.5.4(1))
--
-- Returns a Nil_Element if no explicit specification exists, or the
-- declaration is the proper body of a subunit.
--
-- The parameter The_Context is used to locate the corresponding specification
-- within a particular Context. The_Context need not be the Enclosing_Context
-- of the Declaration. Any non-Nil result will always have The_Context
-- as its Enclosing_Context. This implies that while a non-Nil result may be
-- Is_Equal with the argument, it will only be Is_Identical if the
-- Enclosing_Context of the Declaration is the same as the parameter
-- The_Context.
--
-- If a generic instantiation is given, the expanded generic specification
-- template representing the instance is returned and Is_Part_Of_Instance.
-- For example, an argument that is A_Package_Instantiation, results in a
-- value that is A_Package_Declaration that can be analyzed with all
-- appropriate queries.
--
-- The Enclosing_Element of the expanded specification is the generic
-- instantiation. The Enclosing_Compilation_Unit of the expanded template is
-- that of the instantiation.
--
-- If an inherited subprogram declaration is given, the specification
-- returned is the one for the user-defined subprogram from which the
-- argument was ultimately inherited.
--
-- Appropriate Declaration_Kinds returning a specification:
-- A_Function_Body_Declaration
-- |A2012 start
-- An_Expression_Function_Declaration -- not implemented yet!!!
-- |A2012 end
-- A_Function_Renaming_Declaration (renaming-as-body)
-- A_Function_Body_Stub
-- A_Function_Instantiation
-- A_Package_Body_Declaration
-- A_Package_Body_Stub
-- A_Package_Instantiation
-- A_Procedure_Body_Declaration
-- A_Procedure_Renaming_Declaration (renaming-as-body)
-- A_Procedure_Body_Stub
-- A_Procedure_Instantiation
-- A_Task_Body_Declaration
-- A_Task_Body_Stub
-- A_Protected_Body_Declaration
-- A_Protected_Body_Stub
-- A_Formal_Package_Declaration
-- A_Formal_Package_Declaration_With_Box
-- A_Generic_Package_Renaming_Declaration
-- A_Generic_Procedure_Renaming_Declaration
-- A_Generic_Function_Renaming_Declaration
-- An_Entry_Body_Declaration
--
-- Appropriate Declaration_Kinds returning the argument Declaration:
-- A_Function_Declaration
-- A_Function_Renaming_Declaration (renaming-as-declaration)
-- A_Generic_Function_Declaration
-- A_Generic_Package_Declaration
-- A_Generic_Procedure_Declaration
-- A_Package_Declaration
-- A_Package_Renaming_Declaration
-- A_Procedure_Declaration
-- A_Null_Procedure_Declaration -- Ada 2005
-- A_Procedure_Renaming_Declaration (renaming-as-declaration)
-- A_Single_Task_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Single_Protected_Declaration
-- A_Generic_Package_Renaming_Declaration
-- A_Generic_Procedure_Renaming_Declaration
-- A_Generic_Function_Renaming_Declaration
--
-- Returns Declaration_Kinds:
-- Not_A_Declaration
-- A_Function_Declaration
-- A_Function_Renaming_Declaration
-- A_Generic_Function_Declaration
-- A_Generic_Package_Declaration
-- A_Generic_Procedure_Declaration
-- A_Package_Declaration
-- A_Package_Renaming_Declaration
-- A_Procedure_Declaration
-- A_Procedure_Renaming_Declaration
-- A_Single_Task_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Single_Protected_Declaration
-- An_Entry_Declaration
--
-- --|D2005 start
--
-- This function is defined for A_Formal_Package_Declaration_With_Box, and it
-- is supposed to return "the expanded generic specification template" for it.
-- But this form of a formal package denotes any possible instantiation of
-- some generic package, so we do not know anything about the actual
-- parameters to create an expanded instantiation. Moreover, RM95 12.7(10)
-- says:
--
-- The visible part of a formal package includes the first list of
-- basic_declarative_items of the package_specification. In addition, if
-- the formal_package_actual_part is (<>), it also includes the
-- generic_formal_part of the template for the formal package.
--
-- It seems that it would be more reasonable if this query would return the
-- argument declaration for the for A_Formal_Package_Declaration_With_Box
-- argument.
--
-- And for Ada/ASIS 2005 a similar problem arises for
-- A_Formal_Package_Declaration argument: what should be returned if
-- formal_package_actual_part contains formal_package_associations only for
-- some part of the formal parameters of the generic formal package?
--
-- --|D2005 end
------------------------------------------------------------------------------
-- 15.27 function Corresponding_Body
------------------------------------------------------------------------------
function Corresponding_Body
(Declaration : Asis.Declaration)
return Asis.Declaration;
function Corresponding_Body
(Declaration : Asis.Declaration;
The_Context : Asis.Context)
return Asis.Declaration;
------------------------------------------------------------------------------
-- Declaration - Specifies the specification to query
-- The_Context - Specifies a Context to use
--
-- Returns the corresponding body for a given subprogram, package, or task
-- specification declaration. Returns the expanded generic body template for
-- generic instantiations. The argument can be a Unit_Declaration from a
-- Compilation_Unit, or, it can be any appropriate specification declaration
-- from any declarative context.
--
-- These two function calls will always produce identical results:
--
-- Decl2 := Corresponding_Body (Decl1);
-- Decl2 := Corresponding_Body
-- (Decl1,
-- Enclosing_Context ( Enclosing_Compilation_Unit( Decl1 )));
--
-- If a body declaration is given, the same element is returned.
--
-- Returns a Nil_Element if no body exists in The_Context.
--
-- The parameter The_Context is used to locate the corresponding specification
-- within a particular Context. The_Context need not be the Enclosing_Context
-- of the Declaration. Any non-Nil result will always have The_Context
-- as its Enclosing_Context. This implies that while a non-Nil result may be
-- Is_Equal with the argument, it will only be Is_Identical if the
-- Enclosing_Context of the Declaration is the same as the parameter
-- The_Context.
--
-- Implicit predefined operations (e.g., "+", "=", etc.) will not typically
-- have unit bodies. (Corresponding_Body returns a Nil_Element.)
-- User-defined overloads of the predefined operations will have
-- Corresponding_Body values once the bodies have inserted into the
-- environment. The Corresponding_Body of an inherited subprogram is that
-- of the original user-defined subprogram.
--
-- If a generic instantiation is given, the body representing the expanded
-- generic body template is returned. (i.e., an argument that is
-- A_Package_Instantiation, results in a value that is
-- A_Package_Body_Declaration that can be analyzed with all appropriate ASIS
-- queries).
--
-- Returns a Nil_Element if the body of the generic has not yet been compiled
-- or inserted into the Ada Environment Context.
--
-- The Enclosing_Element of the expanded body is the generic instantiation.
-- The Enclosing_Compilation_Unit of the expanded template is that of the
-- instantiation.
--
-- Returns Nil_Element for an implicit generic child unit specification.
-- Reference Manual 10.1.1(19).
--
-- Returns A_Pragma if the Declaration is completed by pragma Import.
--
-- Appropriate Declaration_Kinds returning a body:
-- A_Function_Declaration
-- A_Function_Instantiation
-- A_Generic_Package_Declaration
-- A_Generic_Procedure_Declaration
-- A_Generic_Function_Declaration
-- A_Package_Declaration
-- A_Package_Instantiation
-- A_Procedure_Declaration
-- A_Procedure_Instantiation
-- A_Single_Task_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Single_Protected_Declaration
-- A_Formal_Package_Declaration
-- A_Formal_Package_Declaration_With_Box
-- An_Entry_Declaration (restricted to protected entry)
--
-- Appropriate Declaration_Kinds returning the argument Declaration:
-- A_Function_Body_Declaration
-- A_Function_Body_Stub
-- |A2012 start
-- An_Expression_Function_Declaration -- not implemented yet!!!
-- |A2012 end
-- A_Function_Renaming_Declaration
-- A_Package_Body_Declaration
-- A_Package_Body_Stub
-- A_Package_Renaming_Declaration
-- A_Procedure_Body_Declaration
-- A_Procedure_Renaming_Declaration
-- A_Procedure_Body_Stub
-- A_Task_Body_Declaration
-- A_Task_Body_Stub
-- A_Protected_Body_Declaration
-- A_Protected_Body_Stub
-- A_Generic_Package_Renaming_Declaration
-- A_Generic_Procedure_Renaming_Declaration
-- A_Generic_Function_Renaming_Declaration
-- An_Entry_Body_Declaration
--
-- Returns Declaration_Kinds:
-- Not_A_Declaration
-- A_Function_Body_Declaration
-- A_Function_Body_Stub
-- A_Function_Renaming_Declaration
-- A_Package_Body_Declaration
-- A_Package_Body_Stub
-- A_Procedure_Body_Declaration
-- A_Procedure_Renaming_Declaration
-- A_Procedure_Body_Stub
-- A_Task_Body_Declaration
-- A_Task_Body_Stub
-- A_Protected_Body_Declaration
-- A_Protected_Body_Stub
-- An_Entry_Body_Declaration
--
-- Returns Element_Kinds:
-- Not_An_Element
-- A_Declaration
-- A_Pragma
--
------------------------------------------------------------------------------
-- 15.28 function Corresponding_Subprogram_Derivation
------------------------------------------------------------------------------
function Corresponding_Subprogram_Derivation
(Declaration : Asis.Declaration)
return Asis.Declaration;
------------------------------------------------------------------------------
-- Declaration - Specifies an implicit inherited subprogram declaration
--
-- Returns the subprogram declaration from which the given implicit inherited
-- subprogram argument was inherited. The result can itself be an implicitly
-- inherited subprogram.
--
-- Appropriate Element_Kinds:
-- A_Declaration
--
-- Appropriate Declaration_Kinds:
-- A_Function_Declaration
-- A_Procedure_Declaration
--
-- Returns Element_Kinds:
-- A_Declaration
--
-- Returns Declaration_Kinds:
-- A_Function_Body_Declaration
-- A_Function_Declaration
-- A_Function_Renaming_Declaration
-- A_Procedure_Body_Declaration
-- A_Procedure_Declaration
-- A_Procedure_Renaming_Declaration
--
-- Raises ASIS_Inappropriate_Element for a subprogram declaration that is not
-- Is_Part_Of_Inherited.
--
------------------------------------------------------------------------------
-- 15.29 function Corresponding_Type
------------------------------------------------------------------------------
function Corresponding_Type
(Declaration : Asis.Declaration)
return Asis.Type_Definition;
------------------------------------------------------------------------------
-- Declaration - Specifies the subprogram_declaration to query
--
-- Returns the type definition for which this entity is an implicit
-- declaration. The result will often be a derived type. However, this query
-- also works for declarations of predefined operators such as "+" and "=".
-- Raises ASIS_Inappropriate_Element if the argument is not an implicit
-- declaration resulting from the declaration of a type.
--
-- Appropriate Element_Kinds:
-- A_Declaration
--
-- Appropriate Declaration_Kinds:
-- A_Function_Declaration
-- A_Procedure_Declaration
--
-- Returns Definition_Kinds:
-- A_Type_Definition
--
------------------------------------------------------------------------------
-- 15.30 function Corresponding_Equality_Operator
------------------------------------------------------------------------------
function Corresponding_Equality_Operator
(Declaration : Asis.Declaration)
return Asis.Declaration;
------------------------------------------------------------------------------
-- Declaration - Specifies an equality or an inequality operator declaration
--
-- If given an explicit Declaration of "=" whose result type is Boolean:
--
-- - Returns the complimentary implicit "/=" operator declaration.
--
-- - Returns a Nil_Element if the Ada implementation has not defined an
-- implicit "/=" for the "=". Implementations of this sort will transform
-- a A/=B expression into a NOT(A=B) expression. The function call
-- representing the NOT operation is Is_Part_Of_Implicit in this case.
--
-- If given an implicit Declaration of "/=" whose result type is Boolean:
--
-- - Returns the complimentary explicit "=" operator declaration.
--
-- Returns a Nil_Element for any other function declaration.
--
-- Appropriate Declaration_Kinds:
-- A_Function_Declaration
--
-- --|D2005 start
--
-- There are two problems with this query:
--
-- First, according to RM95 6.6, this query should also return the implicit
-- "/=" declaration also for the following Declaraion_Kinds
--
-- A_Function_Body_Declaration (in case if it acts as declaration,
-- otherwise the result should be
-- Nil_Element)
-- A_Function_Renaming_Declaration
--
-- The case of a function instantiation is covered by applying this query to
-- the result of Corresponding_Declaration
--
-- Second, what should be the result of the following queries applied to the
-- Element representing the implicit declaration of "/=":
-- Enclosing_Element
-- Corresponding_Declaration
-- Corresponding_Body?
--
-- For the moment, the following decision is made in the GNAT ASIS
-- implementation. If Decl is an Element representing this implicit
-- declaration of "/=", then:
--
--
-- - Is_Equal
-- (Enclosing_Element (Decl),
-- Enclosing_Element (Corresponding_Equality_Operator (Decl)))
--
-- - Is_Equal (Decl, Corresponding_Declaration (Decl))
--
-- - Is_Nil (Corresponding_Body (Decl)
--
-- --|D2005 end
--
-- Returns Declaration_Kinds:
-- A_Function_Declaration
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Package_Declaration - 7.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Visible_Part_Declarative_Items
-- --|CR function Private_Part_Declarative_Items
--
------------------------------------------------------------------------------
-- 15.31 function Visible_Part_Declarative_Items
------------------------------------------------------------------------------
function Visible_Part_Declarative_Items
(Declaration : Asis.Declaration;
Include_Pragmas : Boolean := False)
return Asis.Declarative_Item_List;
------------------------------------------------------------------------------
-- Declaration - Specifies the package to query
-- Include_Pragmas - Specifies whether pragmas are to be returned
--
-- Returns a list of all basic declarations, representation specifications,
-- use clauses, and pragmas in the visible part of a package, in their order
-- of appearance.
--
-- Results of this query may vary across ASIS implementations. Some
-- implementations normalize all multi-name object declarations into an
-- equivalent sequence of corresponding single name object declarations.
-- See Reference Manual 3.3.1(7).
--
-- Appropriate Declaration_Kinds:
-- A_Generic_Package_Declaration
-- A_Package_Declaration
--
-- Returns Element_Kinds:
-- A_Declaration
-- A_Pragma
-- A_Clause
--
------------------------------------------------------------------------------
-- 15.32 function Is_Private_Present
------------------------------------------------------------------------------
function Is_Private_Present
(Declaration : Asis.Declaration)
return Boolean;
------------------------------------------------------------------------------
-- Declaration - Specifies the declaration to query
--
-- Returns True if the argument is a package specification which has a
-- reserved word "private" which marks the beginning of a (possibly empty)
-- private part.
--
-- Returns False for any package specification without a private part.
-- Returns False for any unexpected Element.
--
-- Expected Element_Kinds:
-- A_Declaration
--
-- Expected Declaration_Kinds:
-- A_Generic_Package_Declaration
-- A_Package_Declaration
--
------------------------------------------------------------------------------
-- 15.33 function Private_Part_Declarative_Items
------------------------------------------------------------------------------
function Private_Part_Declarative_Items
(Declaration : Asis.Declaration;
Include_Pragmas : Boolean := False)
return Asis.Declarative_Item_List;
------------------------------------------------------------------------------
-- Declaration - Specifies the package to query
-- Include_Pragmas - Specifies whether pragmas are to be returned
--
-- Returns a list of all basic declarations, representation specifications,
-- use clauses, and pragmas in the private part of a package in their order of
-- appearance.
--
-- Results of this query may vary across ASIS implementations. Some
-- implementations normalize all multi-name object declarations into an
-- equivalent sequence of corresponding single name object declarations.
-- See Reference Manual 3.3.1(7).
--
-- Appropriate Declaration_Kinds:
-- A_Generic_Package_Declaration
-- A_Package_Declaration
--
-- Returns Element_Kinds:
-- A_Declaration
-- A_Pragma
-- A_Clause
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Package_Body_Declaration - 7.2
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Body_Declarative_Items
-- --|CR function Body_Statements
-- --|CR function Body_Exception_Handlers
-- --|CR function Body_Block_Statement - obsolescent, not recommended
-- --|ER---------------------------------------------------------------------
-- --|ER A_Private_Type_Declaration - 7.3
-- --|ER A_Private_Extension_Declaration - 7.3
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Discriminant_Part
-- --|CR function Type_Declaration_View
------------------------------------------------------------------------------
-- --|A2005 start (implemented)
-- 15.#??? function Declaration_Interface_List
------------------------------------------------------------------------------
function Declaration_Interface_List
(Declaration : Asis.Definition)
return Asis.Expression_List;
------------------------------------------------------------------------------
-- Declaration - Specifies the declaration to query
--
-- Returns a list of subtype mark names making up the interface_list in the
-- argument declaration, in their order of appearance.
--
-- Appropriate Declaration_Kinds:
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- A_Single_Task_Declaration
-- A_Single_Protected_Declaration
--
-- Returns Expression_Kinds:
-- An_Identifier
-- A_Selected_Component
--
-- --|D2005 start
-- Note, that this function does NOT return an interface list for
-- A_Private_Extension_Declaration. Instead, an application should get to
-- the corresponding A_Private_Extension_Definition Element and get the
-- interface list by Asis.Definitions.Definition_Interface_List query. This
-- does not correspond to the Ada syntax, but ASIS 95 has already introduced
-- A_Private_Extension_Definition position in the Element classification
-- hierarchy, so we have to use it.
-- --|D2005 end
--
-- --|A2005 end
------------------------------------------------------------------------------
-- --|ER---------------------------------------------------------------------
-- --|ER An_Object_Renaming_Declaration - 8.5.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Declaration_Subtype_Mark
-- --|CR function Renamed_Entity
--
------------------------------------------------------------------------------
-- 15.34 function Renamed_Entity
------------------------------------------------------------------------------
function Renamed_Entity
(Declaration : Asis.Declaration)
return Asis.Expression;
------------------------------------------------------------------------------
-- Declaration - Specifies the rename declaration to query
--
-- Returns the name expression that follows the reserved word "renames" in the
-- renaming declaration.
--
-- Appropriate Declaration_Kinds:
-- An_Exception_Renaming_Declaration
-- A_Function_Renaming_Declaration
-- An_Object_Renaming_Declaration
-- A_Package_Renaming_Declaration
-- A_Procedure_Renaming_Declaration
-- A_Generic_Package_Renaming_Declaration
-- A_Generic_Procedure_Renaming_Declaration
-- A_Generic_Function_Renaming_Declaration
--
-- Returns Element_Kinds:
-- An_Expression
--
-- --|ER---------------------------------------------------------------------
-- --|ER An_Exception_Renaming_Declaration - 8.5.2
-- --|ER A_Package_Renaming_Declaration - 8.5.3
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Renamed_Entity
-- --|ER---------------------------------------------------------------------
-- --|ER A_Procedure_Renaming_Declaration - 8.5.4
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Parameter_Profile
-- --|CR function Renamed_Entity
-- --|ER---------------------------------------------------------------------
-- --|ER A_Function_Renaming_Declaration - 8.5.4
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Parameter_Profile
-- --|CR function Result_Profile
-- --|CR function Renamed_Entity
-- --|ER---------------------------------------------------------------------
-- --|ER A_Generic_Package_Renaming_Declaration - 8.5.5
-- --|ER A_Generic_Procedure_Renaming_Declaration - 8.5.5
-- --|ER A_Generic_Function_Renaming_Declaration - 8.5.5
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Renamed_Entity
--
------------------------------------------------------------------------------
-- 15.35 function Corresponding_Base_Entity
------------------------------------------------------------------------------
function Corresponding_Base_Entity
(Declaration : Asis.Declaration)
return Asis.Expression;
-----------------------------------------------------------------------------
-- Declaration - Specifies the rename declaration to query
--
-- The base entity is defined to be the renamed entity that is not itself
-- defined by another renaming declaration.
--
-- If the name following the reserved word "renames" is itself declared
-- by a previous renaming_declaration, then this query unwinds the renamings
-- by recursively operating on the previous renaming_declaration.
--
-- Otherwise, the name following the reserved word "renames" is returned.
--
-- Appropriate Declaration_Kinds:
-- An_Object_Renaming_Declaration
-- An_Exception_Renaming_Declaration
-- A_Procedure_Renaming_Declaration
-- A_Function_Renaming_Declaration
-- A_Package_Renaming_Declaration
-- A_Generic_Package_Renaming_Declaration
-- A_Generic_Procedure_Renaming_Declaration
-- A_Generic_Function_Renaming_Declaration
--
-- Returns Element_Kinds:
-- An_Expression
--
-- --|ER--------------------------------------------------------------------
-- --|ER A_Task_Type_Declaration - 9.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Discriminant_Part
-- --|CR function Type_Declaration_View
-- --|ER--------------------------------------------------------------------
-- --|ER A_Single_Task_Declaration - 9.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Object_Declaration_View
-- --|ER--------------------------------------------------------------------
-- --|ER A_Task_Body_Declaration - 9.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Body_Declarative_Items
-- --|CR function Body_Statements
-- --|CR function Body_Exception_Handlers
-- --|CR function Body_Block_Statement - obsolescent, not recommended
-- --|ER--------------------------------------------------------------------
-- --|ER A_Protected_Type_Declaration - 9.4
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Discriminant_Part
-- --|CR function Type_Declaration_View
-- --|ER--------------------------------------------------------------------
-- --|ER A_Single_Protected_Declaration - 9.4
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Object_Declaration_View
-- --|ER--------------------------------------------------------------------
-- --|ER A_Protected_Body_Declaration - 9.4
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Protected_Operation_Items
--
------------------------------------------------------------------------------
-- 15.36 function Protected_Operation_Items
------------------------------------------------------------------------------
function Protected_Operation_Items
(Declaration : Asis.Declaration;
Include_Pragmas : Boolean := False)
return Asis.Declaration_List;
------------------------------------------------------------------------------
-- Declaration - Specifies the protected_body declaration to query
-- Include_Pragmas - Specifies whether pragmas are to be returned
--
-- Returns a list of protected_operation_item and pragma elements of the
-- protected_body, in order of appearance.
--
-- Returns a Nil_Element_List if there are no items or pragmas.
--
-- Appropriate Declaration_Kinds:
-- A_Protected_Body_Declaration
--
-- Returns Element_Kinds:
-- A_Pragma
-- A_Declaration
-- A_Clause
--
-- Returns Declaration_Kinds:
-- A_Procedure_Declaration
-- A_Function_Declaration
-- A_Procedure_Body_Declaration
-- A_Function_Body_Declaration
-- An_Entry_Body_Declaration
--
-- Returns Clause_Kinds:
-- A_Representation_Clause
--
-- --|ER---------------------------------------------------------------------
-- --|ER An_Entry_Declaration - 9.5.2
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Entry_Family_Definition
-- --|CR function Parameter_Profile
--
------------------------------------------------------------------------------
-- 15.37 function Entry_Family_Definition
------------------------------------------------------------------------------
function Entry_Family_Definition
(Declaration : Asis.Declaration)
return Asis.Discrete_Subtype_Definition;
------------------------------------------------------------------------------
-- Declaration - Specifies the entry declaration to query
--
-- Returns the Discrete_Subtype_Definition element for the entry family of
-- an entry_declaration.
--
-- Returns a Nil_Element if the entry_declaration does not define a family
-- of entries.
--
-- Appropriate Declaration_Kinds:
-- An_Entry_Declaration
--
-- Returns Definition_Kinds:
-- Not_A_Definition
-- A_Discrete_Subtype_Definition
--
-- --|ER---------------------------------------------------------------------
-- --|ER An_Entry_Body_Declaration - 9.5.2
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Entry_Index_Specification
-- --|CR function Parameter_Profile
-- --|CR function Entry_Barrier
-- --|CR function Body_Declarative_Items
-- --|CR function Body_Statements
-- --|CR function Body_Exception_Handlers
-- --|CR function Body_Block_Statement - obsolescent, not recommended
--
------------------------------------------------------------------------------
-- 15.38 function Entry_Index_Specification
------------------------------------------------------------------------------
function Entry_Index_Specification
(Declaration : Asis.Declaration)
return Asis.Declaration;
------------------------------------------------------------------------------
-- Declaration - Specifies the entry body declaration to query
--
-- Returns the An_Entry_Index_Specification element of an entry body
-- declaration.
--
-- Returns a Nil_Element if the entry does not declare any
-- An_Entry_Index_Specification element.
--
-- Appropriate Declaration_Kinds:
-- An_Entry_Body_Declaration
--
-- Returns Declaration_Kinds:
-- Not_A_Declaration
-- An_Entry_Index_Specification
--
------------------------------------------------------------------------------
-- 15.39 function Entry_Barrier
------------------------------------------------------------------------------
function Entry_Barrier
(Declaration : Asis.Declaration)
return Asis.Expression;
------------------------------------------------------------------------------
-- Declaration - Specifies the entry body declaration to query
--
-- Returns the expression following the reserved word "when" in an entry body
-- declaration.
--
-- Appropriate Declaration_Kinds:
-- An_Entry_Body_Declaration
--
-- Returns Element_Kinds:
-- An_Expression
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Procedure_Body_Stub - 10.1.3
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Parameter_Profile
-- --|ER---------------------------------------------------------------------
-- --|ER A_Function_Body_Stub - 10.1.3
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Parameter_Profile
-- --|CR function Result_Profile
-- --|ER---------------------------------------------------------------------
-- --|ER A_Package_Body_Stub - 10.1.3
-- --|ER A_Task_Body_Stub - 10.1.3
-- --|ER A_Protected_Body_Stub - 10.1.3
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
--
------------------------------------------------------------------------------
-- 15.40 function Corresponding_Subunit
------------------------------------------------------------------------------
function Corresponding_Subunit
(Body_Stub : Asis.Declaration)
return Asis.Declaration;
function Corresponding_Subunit
(Body_Stub : Asis.Declaration;
The_Context : Asis.Context)
return Asis.Declaration;
------------------------------------------------------------------------------
-- Body_Stub - Specifies the stub to query
-- The_Context - Specifies a Context to use to locate the subunit
--
-- Returns the Unit_Declaration of the subunit compilation unit corresponding
-- to the body stub.
--
-- Returns a Nil_Element if the subunit does not exist in The_Context.
--
-- These two function calls will always produce identical results:
--
-- Decl2 := Corresponding_Subunit (Decl1);
-- Decl2 := Corresponding_Subunit
-- (Decl1,
-- Enclosing_Context ( Enclosing_Compilation_Unit( Decl1 )));
--
-- The parameter The_Context is used to locate the corresponding subunit body.
-- Any non-Nil result will always have The_Context as its Enclosing_Context.
--
-- Appropriate Declaration_Kinds:
-- A_Function_Body_Stub
-- A_Package_Body_Stub
-- A_Procedure_Body_Stub
-- A_Task_Body_Stub
-- A_Protected_Body_Stub
--
-- Returns Declaration_Kinds:
-- Not_A_Declaration
-- A_Function_Body_Declaration
-- A_Package_Body_Declaration
-- A_Procedure_Body_Declaration
-- A_Task_Body_Declaration
-- A_Protected_Body_Declaration
--
------------------------------------------------------------------------------
-- 15.41 function Is_Subunit
------------------------------------------------------------------------------
function Is_Subunit (Declaration : Asis.Declaration) return Boolean;
------------------------------------------------------------------------------
-- Declaration - Specifies the declaration to query
--
-- Returns True if the declaration is the proper_body of a subunit.
--
-- Returns False for any unexpected Element.
--
-- --|AN
-- Equivalent to:
-- Declaration = Unit_Declaration(Enclosing_Compilation_Unit (Declaration))
-- and Unit_Kind(Enclosing_Compilation_Unit (Declaration)) in A_Subunit.
--
-- Expected Declaration_Kinds:
-- A_Procedure_Body_Declaration
-- A_Function_Body_Declaration
-- A_Package_Body_Declaration
-- A_Task_Body_Declaration
-- A_Protected_Body_Declaration
--
------------------------------------------------------------------------------
-- 15.42 function Corresponding_Body_Stub
------------------------------------------------------------------------------
function Corresponding_Body_Stub
(Subunit : Asis.Declaration)
return Asis.Declaration;
function Corresponding_Body_Stub
(Subunit : Asis.Declaration;
The_Context : Asis.Context)
return Asis.Declaration;
------------------------------------------------------------------------------
-- Subunit - Specifies the Is_Subunit declaration to query
-- The_Context - Specifies a Context to use to locate the parent unit
--
-- Returns the body stub declaration located in the subunit's parent unit.
--
-- Returns a Nil_Element if the parent unit does not exist in The_Context.
--
-- These two function calls will always produce identical results:
--
-- Decl2 := Corresponding_Body_Stub (Decl1);
-- Decl2 := Corresponding_Body_Stub
-- (Decl1,
-- Enclosing_Context ( Enclosing_Compilation_Unit( Decl1 )));
--
-- The parameter The_Context is used to locate the corresponding parent body.
-- Any non-Nil result will always have The_Context as its Enclosing_Context.
--
-- Appropriate Declaration Kinds:
-- (Is_Subunit(Declaration) shall also be True)
-- A_Function_Body_Declaration
-- A_Package_Body_Declaration
-- A_Procedure_Body_Declaration
-- A_Task_Body_Declaration
-- A_Protected_Body_Declaration
--
-- Returns Declaration_Kinds:
-- Not_A_Declaration
-- A_Function_Body_Stub
-- A_Package_Body_Stub
-- A_Procedure_Body_Stub
-- A_Task_Body_Stub
-- A_Protected_Body_Stub
--
-- --|ER---------------------------------------------------------------------
-- --|ER An_Exception_Declaration - 11.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|ER---------------------------------------------------------------------
-- --|ER A_Choice_Parameter_Specification - 11.2
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|ER---------------------------------------------------------------------
-- --|ER A_Generic_Procedure_Declaration - 12.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Generic_Formal_Part
-- --|CR function Names
-- --|CR function Parameter_Profile
--
------------------------------------------------------------------------------
-- 15.43 function Generic_Formal_Part
------------------------------------------------------------------------------
function Generic_Formal_Part
(Declaration : Asis.Declaration;
Include_Pragmas : Boolean := False)
return Asis.Element_List;
------------------------------------------------------------------------------
-- Declaration - Specifies the generic declaration to query
-- Include_Pragmas - Specifies whether pragmas are to be returned
--
-- Returns a list of generic formal parameter declarations, use clauses,
-- and pragmas, in their order of appearance.
--
-- Results of this query may vary across ASIS implementations. Some
-- implementations normalize all multi-name object declarations into an
-- equivalent sequence of corresponding single name object declarations.
-- See Reference Manual 3.3.1(7).
--
-- Appropriate Declaration_Kinds:
-- A_Generic_Package_Declaration
-- A_Generic_Procedure_Declaration
-- A_Generic_Function_Declaration
--
-- Returns Element_Kinds:
-- A_Pragma
-- A_Declaration
-- A_Clause
--
-- Returns Declaration_Kinds:
-- A_Formal_Object_Declaration
-- A_Formal_Type_Declaration
-- A_Formal_Procedure_Declaration
-- A_Formal_Function_Declaration
-- A_Formal_Package_Declaration
-- A_Formal_Package_Declaration_With_Box
--
-- Returns Clause_Kinds:
-- A_Use_Package_Clause
-- A_Use_Type_Clause
-- A_Use_All_Type_Clause -- Ada 2012
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Generic_Function_Declaration - 12.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Generic_Formal_Part
-- --|CR function Names
-- --|CR function Parameter_Profile
-- --|CR function Result_Profile
-- --|ER---------------------------------------------------------------------
-- --|ER A_Generic_Package_Declaration - 12.1
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Generic_Formal_Part
-- --|CR function Names
-- --|CR function Visible_Part_Declarative_Items
-- --|CR function Private_Part_Declarative_Items
-- --|ER---------------------------------------------------------------------
-- --|ER A_Package_Instantiation - 12.3
-- --|ER A_Procedure_Instantiation - 12.3
-- --|ER A_Function_Instantiation - 12.3
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Generic_Unit_Name
-- --|CR function Generic_Actual_Part
------------------------------------------------------------------------------
--
-- Instantiations can always be analyzed in terms of the generic actual
-- parameters supplied with the instantiation. A generic instance is a copy
-- of the generic unit, and while there is no explicit (textual) specification
-- in the program text, an implicit specification and body, if there is one,
-- with the generic actual parameters is implied.
--
-- To analyze the implicit instance specification or body of a generic
-- instantiation:
-- - Use Corresponding_Declaration to return the implicit expanded
-- specification of an instantiation.
-- - Use Corresponding_Body to return the implicit body of an
-- instantiation.
-- - Then analyze the specification or body with any appropriate
-- queries.
--
-- To analyze the explicit generic specification or body referenced by a
-- generic instantiation:
-- - Use Generic_Unit_Name to obtain the name of the generic unit.
-- - Then use Corresponding_Name_Declaration to get to the generic
-- declaration.
-- - Then use Corresponding_Body to get to the body of the generic
-- declaration.
--
------------------------------------------------------------------------------
-- 15.44 function Generic_Unit_Name
------------------------------------------------------------------------------
function Generic_Unit_Name
(Declaration : Asis.Declaration)
return Asis.Expression;
------------------------------------------------------------------------------
-- Declaration - Specifies the generic instantiation to query
--
-- Returns the name following the reserved word "new" in the generic
-- instantiation. The name denotes the generic package, generic procedure, or
-- generic function that is the template for this generic instance.
--
-- Appropriate Declaration_Kinds:
-- A_Function_Instantiation
-- A_Package_Instantiation
-- A_Procedure_Instantiation
-- A_Formal_Package_Declaration
-- A_Formal_Package_Declaration_With_Box
--
-- Returns Expression_Kinds:
-- An_Identifier
-- An_Operator_Symbol
-- A_Selected_Component
--
------------------------------------------------------------------------------
-- 15.45 function Generic_Actual_Part
------------------------------------------------------------------------------
function Generic_Actual_Part
(Declaration : Asis.Declaration;
Normalized : Boolean := False)
return Asis.Association_List;
------------------------------------------------------------------------------
-- Declaration - Specifies the generic_instantiation to query
-- Normalized - Specifies whether the normalized form is desired
--
-- Returns a list of the generic_association elements of the instantiation.
--
-- Returns a Nil_Element_List if there are no generic_association elements.
--
-- An unnormalized list contains only explicit associations ordered as they
-- appear in the program text. Each unnormalized association has an optional
-- generic_formal_parameter_selector_name and an
-- explicit_generic_actual_parameter component.
--
-- A normalized list contains artificial associations representing all
-- explicit and default associations. It has a length equal to the number of
-- generic_formal_parameter_declaration elements of the generic_formal_part
-- of the template. The order of normalized associations matches the order of
-- the generic_formal_parameter_declaration elements.
--
-- Each normalized association represents a one-on-one mapping of a
-- generic_formal_parameter_declaration to the explicit or default expression
-- or name. A normalized association has:
-- - one A_Defining_Name component that denotes the
-- generic_formal_parameter_declaration, and
-- - one An_Expression component that is either:
-- o the explicit_generic_actual_parameter,
-- o a default_expression, or
-- o a default_name from the generic_formal_parameter_declaration or
-- an implicit naming expression which denotes the actual subprogram
-- selected at the place of instantiation for a formal subprogram
-- having A_Box_Default.
--
-- |D2006 start
--
-- In Ada 2005 we have a new notion - formal_package_association. It differs
-- from generic_association in having a box instead of an actual parameter.
-- There are two ways to represent in ASIS this new construct:
--
-- 1. Use the existing notion of A_Generic_Association
--
-- - if Normalized is OFF, then a corresponding A_Generic_Association has
-- Nil_Element as its Actual_Parameter part, and its Formal_Parameter
-- part can have the same kinds as for a generic_association plus
-- An_Others_Choice. For A_Formal_Package_Declaration_With_Box the
-- result list contains a singe A_Generic_Association that has
-- Nil_Element for its both Actual_Parameter and Formal_Parameter parts.
--
-- - if Normalized is ON, if an association from the result list
-- corresponds to formal_package_association, then as its
-- Actual_Parameter part it contains either the corresponding default
-- parameter or Nil_Element if there is no such default;
--
-- 2. Add a new value to Association_Kinds - A_Formal_Package_Association. Add
-- this value to the list of returned kinds of this query and to the lists
-- of appropriate kinds for Asis.Expressions.Formal_Parameter and
-- Asis.Expressions.Actual_Parameter. Return this
-- A_Formal_Package_Association element for any association containing a
-- box and as a single association in the result list, with the structure
-- described in paragraph 1 above.
--
-- For the current proposal, the first approach is taken.
--
-- |D2006 end
--
-- Appropriate Declaration_Kinds:
-- A_Function_Instantiation
-- A_Package_Instantiation
-- A_Procedure_Instantiation
-- A_Formal_Package_Declaration
-- |A2005 start
-- A_Formal_Package_Declaration_With_Box
-- |A2005 end
--
-- Returns Association_Kinds:
-- A_Generic_Association
--
-- --|IR Implementation Requirements:
-- --|IR
-- --|IR Normalized associations are Is_Normalized and Is_Part_Of_Implicit.
-- --|IR Normalized associations provided by default are
-- --|IR Is_Defaulted_Association. Normalized associations are never Is_Equal
-- --|IR to unnormalized associations.
-- --|IR
-- --|IP Implementation Permissions:
-- --|IP
-- --|IP An implementation may choose to always include default parameters in
-- --|IP its internal representation.
-- --|IP
-- --|IP An implementation may also choose to normalize its representation
-- --|IP to use the defining_identifier element rather than the
-- --|IP generic_formal_parameter_selector_name elements.
-- --|IP
-- --|IP In either case, this query will return Is_Normalized associations
-- --|IP even if Normalized is False, and the query
-- --|IP Generic_Actual_Part_Normalized will return True.
-- --|IP
-- --|ER---------------------------------------------------------------------
-- --|ER A_Formal_Object_Declaration - 12.4
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Declaration_Subtype_Mark
-- --|CR function Initialization_Expression
-- --|ER---------------------------------------------------------------------
-- --|ER A_Formal_Type_Declaration - 12.5
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Discriminant_Part
-- --|CR function Type_Declaration_View
-- --|ER---------------------------------------------------------------------
-- --|ER A_Formal_Procedure_Declaration - 12.6
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Parameter_Profile
-- --|CR function Formal_Subprogram_Default
--
------------------------------------------------------------------------------
-- 15.46 function Formal_Subprogram_Default
------------------------------------------------------------------------------
function Formal_Subprogram_Default
(Declaration : Asis.Generic_Formal_Parameter)
return Asis.Expression;
------------------------------------------------------------------------------
-- Declaration - Specifies the generic formal subprogram declaration to query
--
-- Returns the name appearing after the reserved word "is" in the given
-- generic formal subprogram declaration.
--
-- Appropriate Declaration_Kinds:
-- A_Formal_Function_Declaration
-- A_Formal_Procedure_Declaration
--
-- Appropriate Subprogram_Default_Kinds:
-- A_Name_Default
--
-- Returns Element_Kinds:
-- An_Expression
--
-- --|ER---------------------------------------------------------------------
-- --|ER A_Formal_Function_Declaration - 12.6
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Parameter_Profile
-- --|CR function Result_Profile
-- --|CR function Formal_Subprogram_Default
-- --|ER---------------------------------------------------------------------
-- --|ER A_Formal_Package_Declaration - 12.7
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Generic_Unit_Name
-- --|CR function Generic_Actual_Part
-- --|ER---------------------------------------------------------------------
-- --|ER A_Formal_Package_Declaration_With_Box - 12.7
-- --|CR
-- --|CR Child elements returned by:
-- --|CR function Names
-- --|CR function Generic_Unit_Name
--
------------------------------------------------------------------------------
-- 15.47 function Corresponding_Generic_Element
------------------------------------------------------------------------------
function Corresponding_Generic_Element
(Reference : Asis.Element)
return Asis.Defining_Name;
------------------------------------------------------------------------------
-- Reference - Specifies an expression that references an entity declared
-- within the implicit specification of a generic instantiation,
-- or, specifies the defining name of such an entity.
--
-- Given a reference to some implicit entity, whose declaration occurs within
-- an implicit generic instance, returns the corresponding entity name
-- definition from the generic template used to create the generic instance.
-- (Reference Manual 12.3 (16))
--
-- Returns the first A_Defining_Name, from the generic template, that
-- corresponds to the entity referenced.
--
-- Returns a Nil_Element if the argument does not refer to an entity declared
-- as a component of a generic package instantiation. The entity name can
-- refer to an ordinary declaration, an inherited subprogram declaration, or a
-- predefined operator declaration.
--
-- Appropriate Element_Kinds:
-- A_Defining_Name
-- An_Expression
--
-- Appropriate Expression_Kinds:
-- An_Identifier
-- An_Operator_Symbol
-- A_Character_Literal
-- An_Enumeration_Literal
--
-- Returns Element_Kinds:
-- Not_An_Element
-- A_Defining_Name
--
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- 15.48 function Is_Dispatching_Operation
------------------------------------------------------------------------------
function Is_Dispatching_Operation
(Declaration : Asis.Element)
return Boolean;
------------------------------------------------------------------------------
-- Declaration - Specifies the declaration to query.
--
-- Returns True if the declaration is a primitive subprogram of a tagged type.
--
-- Returns False for any unexpected argument.
--
-- Expected Element_Kinds:
-- A_Procedure_Declaration
-- A_Function_Declaration
-- A_Procedure_Renaming_Declaration
-- A_Function_Renaming_Declaration
--
-- (values not included in the official ASIS 2005 Standard)
-- A_Null_Procedure_Declaration
-- A_Procedure_Body_Declaration
-- A_Function_Body_Declaration
-- A_Procedure_Body_Stub
-- A_Function_Body_Stub
--
------------------------------------------------------------------------------
-- New ASIS 2012 queries --
------------------------------------------------------------------------------
end Asis.Declarations;
|
Antlr2BGF/AntlrParser/ANTLRv4Parser.g4 | EwoutWal/ANTLR-Extractor | 0 | 7524 | /*
* [The "BSD license"]
* Copyright (c) 2012-2014 <NAME>
* Copyright (c) 2012-2014 <NAME>
* Copyright (c) 2015 <NAME>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* A grammar for ANTLR v4 written in ANTLR v4.
*
* Modified 2015.06.16 gbr
* -- update for compatibility with Antlr v4.5
* -- add mode for channels
* -- moved members to LexerAdaptor
* -- move fragments to imports
*/
parser grammar ANTLRv4Parser;
options { tokenVocab = ANTLRv4Lexer; }
// The main entry point for parsing a v4 grammar.
grammarSpec
: grammarDecl prequelConstruct* rules modeSpec* EOF
;
grammarDecl
: grammarType identifier SEMI
;
grammarType
: (LEXER GRAMMAR | PARSER GRAMMAR | GRAMMAR)
;
// This is the list of all constructs that can be declared before
// the set of rules that compose the grammar, and is invoked 0..n
// times by the grammarPrequel rule.
prequelConstruct
: optionsSpec
| delegateGrammars
| tokensSpec
| channelsSpec
| action_
;
// ------------
// Options - things that affect analysis and/or code generation
optionsSpec
: OPTIONS LBRACE (option SEMI)* RBRACE
;
option
: identifier ASSIGN optionValue
;
optionValue
: identifier (DOT identifier)*
| STRING_LITERAL
| actionBlock
| INT
;
// ------------
// Delegates
delegateGrammars
: IMPORT delegateGrammar (COMMA delegateGrammar)* SEMI
;
delegateGrammar
: identifier ASSIGN identifier
| identifier
;
// ------------
// Tokens & Channels
tokensSpec
: TOKENS LBRACE idList? RBRACE
;
channelsSpec
: CHANNELS LBRACE idList? RBRACE
;
idList
: identifier (COMMA identifier)* COMMA?
;
// Match stuff like @parser::members {int i;}
action_
: AT (actionScopeName COLONCOLON)? identifier actionBlock
;
// Scope names could collide with keywords; allow them as ids for action scopes
actionScopeName
: identifier
| LEXER
| PARSER
;
actionBlock
: BEGIN_ACTION ACTION_CONTENT* END_ACTION
;
argActionBlock
: BEGIN_ARGUMENT ARGUMENT_CONTENT* END_ARGUMENT
;
modeSpec
: MODE identifier SEMI lexerRuleSpec*
;
rules
: ruleSpec*
;
ruleSpec
: parserRuleSpec
| lexerRuleSpec
;
parserRuleSpec
: ruleModifiers? RULE_REF argActionBlock? ruleReturns? throwsSpec? localsSpec? rulePrequel* COLON ruleBlock SEMI exceptionGroup
;
exceptionGroup
: exceptionHandler* finallyClause?
;
exceptionHandler
: CATCH argActionBlock actionBlock
;
finallyClause
: FINALLY actionBlock
;
rulePrequel
: optionsSpec
| ruleAction
;
ruleReturns
: RETURNS argActionBlock
;
// --------------
// Exception spec
throwsSpec
: THROWS identifier (COMMA identifier)*
;
localsSpec
: LOCALS argActionBlock
;
/** Match stuff like @init {int i;} */
ruleAction
: AT identifier actionBlock
;
ruleModifiers
: ruleModifier+
;
// An individual access modifier for a rule. The 'fragment' modifier
// is an internal indication for lexer rules that they do not match
// from the input but are like subroutines for other lexer rules to
// reuse for certain lexical patterns. The other modifiers are passed
// to the code generation templates and may be ignored by the template
// if they are of no use in that language.
ruleModifier
: PUBLIC
| PRIVATE
| PROTECTED
| FRAGMENT
;
ruleBlock
: ruleAltList
;
ruleAltList
: labeledAlt (OR labeledAlt)*
;
labeledAlt
: alternative (POUND identifier)?
;
// --------------------
// Lexer rules
lexerRuleSpec
: FRAGMENT? TOKEN_REF COLON lexerRuleBlock SEMI
;
lexerRuleBlock
: lexerAltList
;
lexerAltList
: lexerAlt (OR lexerAlt)*
;
lexerAlt
: lexerElements lexerCommands?
|
// explicitly allow empty alts
;
lexerElements
: lexerElement+
|
;
lexerElement
: labeledLexerElement ebnfSuffix?
| lexerAtom ebnfSuffix?
| lexerBlock ebnfSuffix?
| actionBlock QUESTION?
;
// but preds can be anywhere
labeledLexerElement
: identifier (ASSIGN | PLUS_ASSIGN) (lexerAtom | lexerBlock)
;
lexerBlock
: LPAREN lexerAltList RPAREN
;
// E.g., channel(HIDDEN), skip, more, mode(INSIDE), push(INSIDE), pop
lexerCommands
: RARROW lexerCommand (COMMA lexerCommand)*
;
lexerCommand
: lexerCommandName LPAREN lexerCommandExpr RPAREN
| lexerCommandName
;
lexerCommandName
: identifier
| MODE
;
lexerCommandExpr
: identifier
| INT
;
// --------------------
// Rule Alts
altList
: alternative (OR alternative)*
;
alternative
: elementOptions? element+
|
// explicitly allow empty alts
;
element
: labeledElement (ebnfSuffix |)
| atom (ebnfSuffix |)
| ebnf
| actionBlock QUESTION?
;
labeledElement
: identifier (ASSIGN | PLUS_ASSIGN) (atom | block)
;
// --------------------
// EBNF and blocks
ebnf
: block blockSuffix?
;
blockSuffix
: ebnfSuffix
;
ebnfSuffix
: QUESTION QUESTION?
| STAR QUESTION?
| PLUS QUESTION?
;
lexerAtom
: characterRange
| terminal
| notSet
| LEXER_CHAR_SET
| DOT elementOptions?
;
atom
: terminal
| ruleref
| notSet
| DOT elementOptions?
;
// --------------------
// Inverted element set
notSet
: NOT setElement
| NOT blockSet
;
blockSet
: LPAREN setElement (OR setElement)* RPAREN
;
setElement
: TOKEN_REF elementOptions?
| STRING_LITERAL elementOptions?
| characterRange
| LEXER_CHAR_SET
;
// -------------
// Grammar Block
block
: LPAREN (optionsSpec? ruleAction* COLON)? altList RPAREN
;
// ----------------
// Parser rule ref
ruleref
: RULE_REF argActionBlock? elementOptions?
;
// ---------------
// Character Range
characterRange
: STRING_LITERAL RANGE STRING_LITERAL
;
terminal
: TOKEN_REF elementOptions?
| STRING_LITERAL elementOptions?
;
// Terminals may be adorned with certain options when
// reference in the grammar: TOK<,,,>
elementOptions
: LT elementOption (COMMA elementOption)* GT
;
elementOption
: identifier
| identifier ASSIGN (identifier | STRING_LITERAL)
;
identifier
: RULE_REF
| TOKEN_REF
;
|
FoldingTextInbox.lbaction/Contents/Scripts/Inbox.scpt | raguay/MyLaunchBarActions | 29 | 1858 | <gh_stars>10-100
property pTitle : "Add Message to @inbox tag"
property pVer : "0.1"
property pAuthor : "<NAME>"
property pDescription : "
1. Looks for a node with the @inbox tag,
2. add the message given to that point
"
property addMessage : "
function(editor, options) {
var tree=editor.tree(), q = options.toString(), result='';
var tnode=editor.tree().evaluateNodePath('//@inbox')[0];
if(tnode) {
var message = tree.createNode(q);
tnode.appendChild(message);
} else {
result = 'No Inbox Found.';
}
return(result);
}
"
on run argv
tell application "FoldingText"
set lstDocs to documents
if lstDocs ≠ {} then
tell item 1 of lstDocs
return evaluate script addMessage with options { item 1 of argv }
end tell
end if
end tell
end
|
oeis/182/A182541.asm | neoneye/loda-programs | 11 | 6055 | <gh_stars>10-100
; A182541: Coefficients in g.f. for certain marked mesh patterns.
; Submitted by <NAME>
; 1,4,19,107,702,5274,44712,422568,4407120,50292720,623471040,8344624320,119938250880,1842662908800,30136443724800,522780938265600,9587900602828800,185371298306611200,3768248516336640000,80349669847157760000,1793238207723325440000,41806479141525288960000,1016281507766049423360000,25717261895017855303680000,676404414292129730887680000,18464564916450805551759360000,522452252385831731529646080000,15303559491494977144610488320000,463527665741719165315586457600000,14501984067899389654101334425600000
mov $1,3
mov $3,3
lpb $0
mov $2,$0
sub $0,1
add $2,2
mul $3,$2
add $3,$1
mul $1,$2
lpe
mov $0,$3
div $0,3
|
05/3/3-b even odd.asm | AbstractXan/ComputerSystemDesignLab | 0 | 173400 | <gh_stars>0
// Infinite program
//Store address at 2
@3
D=A
@2
M=D
//Begin at 3
@3
D=A
(LOOP)
//and at unit's place
A=D
D=1
D=M&D
//update evens and odds
A=D
M=M+1
//retrieve address
@2
M=M+1
D=M
@LOOP
0;JMP
|
Delfino/SingleCore/SmartWinch/DCL/source/DCL_PID.asm | vlad314/FYP_SmartWinch | 0 | 86437 | <reponame>vlad314/FYP_SmartWinch<filename>Delfino/SingleCore/SmartWinch/DCL/source/DCL_PID.asm
; DCL_PID.asm - PID controller
; version 1.0, August 2015
; C prototype:
; float DCL_runPID(PID *p, float rk, float yk, float lk)
; argument 1 = *p : 32-bit PID structure address [XAR4]
; argument 2 = rk : 32-bit floating-point reference [R0H]
; argument 3 = yk : 32-bit floating-point feedback [R1H]
; argument 4 = lk : 32-bit floating-point saturation input [R2H]
; return = uk : 32-bit floating-point [R0H]
.def _DCL_runPID ; define C callable label
;
; C type definition:
; typedef volatile struct {
; float Kp; // [0] proportional gain
; float Ki; // [2] integral gain
; float Kd; // [4] derivative gain
; float Kr; // [6] set-point weight
; float c1; // [8] D filter coefficient 1
; float c2; // [A] D filter coefficient 2
; float d2; // [C] D filter storage 1
; float d3; // [E] D filter storage 2
; float i10; // [10] I storage
; float i14; // [12] sat storage
; float Umax; // [14] sat+
; float Umin; // [16] sat-
; } PID;
; example of section allocation in linker command file:
; dclfuncs : > RAML4, PAGE = 0
.sect "dclfuncs"
_DCL_runPID:
; context save
PUSH AR1H:AR0H
MOV32 *SP++, R3H
MOV32 *SP++, R4H
MOV32 *SP++, R5H
MOV32 *SP++, R6H
MOV32 *SP++, R7H
;*** derivative path ***
MOV32 R3H, *+XAR4[4] ; R3H = Kd
MOV AR0, #8 ; AR0 = 8
MPYF32 R5H, R1H, R3H ; R5H = Kd * yk
|| MOV32 R4H, *+XAR4[AR0] ; R4H = c1
MOV AR0, #0xC ; AR0 = 12
MPYF32 R3H, R4H, R5H ; R3H = v1 = Kd * yk * c1
|| MOV32 R6H, *+XAR4[AR0] ; R6H = d2
MOV AR1, #0xE ; AR1 = 14
SUBF32 R4H, R3H, R6H ; R4H = v1 - d2
|| MOV32 R5H, *+XAR4[AR1] ; R5H = d3
NOP
SUBF32 R4H, R4H, R5H ; R4H = v4 = v1 - d2 - d3
|| MOV32 *+XAR4[AR0], R3H ; save d2
MOV AR0, #0xA ; AR0 = 10
MOV32 R6H, *+XAR4[AR0] ; R6H = c2
MPYF32 R5H, R6H, R4H ; R5H = d3 = c2 * v4
NOP
MOV32 *+XAR4[AR1], R5H ; save d3
;*** proportional path ***
MOV32 R5H, *+XAR4[6] ; R5H = Kr
MPYF32 R6H, R5H, R0H ; R6H = Kr * rk
NOP
SUBF32 R3H, R6H, R1H ; R3H = v5 = (Kr * rk) - yk
NOP
SUBF32 R5H, R3H, R4H ; R5H = v5 - v4
|| MOV32 R6H, *+XAR4[0] ; R6H = Kp
MOV AR0, #0x12 ; AR0 = 18
MPYF32 R7H, R5H, R6H ; R7H = v6
|| MOV32 R4H, *+XAR4[2] ; R4H = Ki
;*** integral path ***
MPYF32 R5H, R4H, R6H ; R5H = Kp * Ki
|| SUBF32 R3H, R0H, R1H ; R3H = rk - yk
MOV32 R6H, *+XAR4[AR0] ; R6H = i14
MPYF32 R4H, R3H, R5H ; R4H = v7
MOV AR0, #0x10 ; AR0 = 16
MPYF32 R4H, R4H, R6H ; R4H = v7 * i14
|| MOV32 R6H, *+XAR4[AR0] ; R6H = i10
NOP
ADDF32 R3H, R4H, R6H ; R3H = v8
;*** output saturation ***
ZERO R0H ; R0H = 0.0f
MOV32 *+XAR4[AR0], R3H ; save i10
ADDF32 R1H, R7H, R3H ; R1H = v9
ADDF32 R6H, R0H, #1.0 ; R6H = 1.0f
MOV AR1, #0x14 ; AR1 = 20
MOV32 R3H, *+XAR4[AR1] ; R3H = Umax
MINF32 R1H, R3H ; sat v9
|| MOV32 R6H, R0H ; R6H = 0.0f if sat
MOV AR1, #0x16 ; AR1 = 22
MOV32 R3H, *+XAR4[AR1] ; R3H = Umin
MAXF32 R1H, R3H ; sat v9
|| MOV32 R6H, R0H ; R6H = 0.0f if sat
;*** return ***
MPYF32 R3H, R2H, R6H ; R3H = i14
MOV32 R0H, R1H ; return uk
MOV AR0, #0x12 ; AR0 = 18
MOV32 *+XAR4[AR0], R3H ; save i14
; context restore
MOV32 R7H, *--SP, UNCF
MOV32 R6H, *--SP, UNCF
MOV32 R5H, *--SP, UNCF
MOV32 R4H, *--SP, UNCF
MOV32 R3H, *--SP, UNCF
POP AR1H:AR0H
LRETR ; return from function
.end
; end of file
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/rep_clause3.adb | best08618/asylo | 7 | 26780 | -- { dg-do compile }
-- { dg-options "-gnatws" }
procedure Rep_Clause3 is
subtype U_16 is integer range 0..2**16-1;
type TYPE1 is range 0 .. 135;
for TYPE1'size use 14;
type TYPE2 is range 0 .. 262_143;
for TYPE2'size use 18;
subtype TYPE3 is integer range 1 .. 21*6;
type ARR is array (TYPE3 range <>) of boolean;
pragma Pack(ARR);
subtype SUB_ARR is ARR(1 .. 5*6);
OBJ : SUB_ARR;
type R is
record
N : TYPE1;
L : TYPE2;
I : SUB_ARR;
CRC : U_16;
end record;
for R use
record at mod 4;
N at 0 range 0 .. 13;
L at 0 range 14 .. 31;
I at 4 range 2 .. 37;
CRC at 8 range 16 .. 31;
end record;
for R'size use 12*8;
type SUB_R is array (1..4) of R;
T : SUB_R;
begin
if OBJ = T(1).I then
raise Program_Error;
end if;
end;
|
Universe/Sun/TransposeSunXX12BySunToSunXX15.asm | ped7g/EliteNext | 9 | 172342 | <filename>Universe/Sun/TransposeSunXX12BySunToSunXX15.asm<gh_stars>1-10
TransposeSXX12BySunToSXX15:
ld hl,(SBnKXX12xLo) ; get X into HL
ld a,h ; get XX12 Sign
and $80 ; check sign bit on high byte
ld b,a ; and put it in of 12xlo in b
;110921 debugld h,0
ld a,h
and $7F
ld h,a
;110921 debugld h,0
ld de,(SBnKxlo) ;
ld a,(SBnKxsgn) ; get Ship Pos (low,high,sign)
and $80 ; make sure we only have bit 7
ld c,a ; and put sign of unkxsgn c
call ADDHLDESignBC; XX12ProcessCalcHLPlusDESignBC ; this will result in HL = result and A = sign
or h ; combine sign in A with H to give 15 bit signed (*NOT* 2's c)
ld h,a
ld (SBnKXScaled),hl ; now write it out to XX15 X pos
; ..................................
ld hl,(SBnKXX12yLo) ; Repeat above for Y coordinate
ld a,h
and $80
ld b,a
;110921 debugld h,0
ld a,h
and $7F
ld h,a
;110921 debugld h,0
ld de,(SBnKylo)
ld a,(SBnKysgn)
and $80 ; make sure we only have bit 7
ld c,a
call ADDHLDESignBC; XX12ProcessCalcHLPlusDESignBC
or h ; combine sign in A with H
ld h,a
ld (SBnKYScaled),hl
; ..................................
ld hl,(SBnKXX12zLo) ; and now repeat for Z cooord
ld a,h
and $80
ld b,a
;110921 debugld h,0
ld a,h
and $7F
ld h,a
;110921 debugld h,0
ld de,(SBnKzlo)
ld a,(SBnKzsgn)
and $80 ; make sure we only have bit 7
ld c,a
call ADDHLDESignBC; XX12ProcessCalcHLPlusDESignBC
or h ; combine sign in A with H
ld h,a
bit 7,h ; if sign if positive then we don't need to do the clamp so we ony jump
jr nz,.ClampZto4 ; result was negative so we need to clamp to 4
and $7F ; a = value unsigned
jr nz,.NoClampZto4 ; if high byte was 0 then we could need to clamp still by this stage its +v but and will set z flag if high byte is zero
ld a,l ; get low byte now
JumpIfALTNusng 4,.ClampZto4 ; if its < 4 then fix at 4
.NoClampZto4: ld (SBnKZScaled),hl ; hl = signed calculation and > 4
ld a,l ; in addition write out the z cooord to UT for now for backwards compat (DEBUG TODO remove later)
ld (varT),a
ld a,h
ld (varU),a
ret
; This is where we limit 4 to a minimum of 4
.ClampZto4: ld hl,4
ld (SBnKZScaled),hl; BODGE FOR NOW
ld a,l
ld (varT),a ; ;;;
ld a,h
ld (varU),a ; compatibility for now
ret
|
mat/src/mat-readers.ads | stcarrez/mat | 7 | 19198 | <reponame>stcarrez/mat<filename>mat/src/mat-readers.ads
-----------------------------------------------------------------------
-- mat-readers -- Reader
-- Copyright (C) 2014, 2015 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with System;
with Util.Streams.Buffered;
with MAT.Events;
package MAT.Readers is
type Buffer_Type is private;
type Buffer_Ptr is access all Buffer_Type;
type Message_Type is record
Kind : MAT.Events.Event_Type;
Size : Natural;
Buffer : Buffer_Ptr;
end record;
subtype Message is Message_Type;
type Endian_Type is (BIG_ENDIAN, LITTLE_ENDIAN);
-- Get the buffer endian format.
function Get_Endian (Msg : in Message_Type) return Endian_Type;
private
type Buffer_Type is record
Current : System.Address;
Start : System.Address;
Last : System.Address;
Buffer : Util.Streams.Buffered.Buffer_Access;
Size : Natural;
Total : Natural;
Endian : Endian_Type := LITTLE_ENDIAN;
end record;
end MAT.Readers;
|
source/asis/spec/ada-numerics-generic_elementary_functions.ads | faelys/gela-asis | 4 | 21878 | <reponame>faelys/gela-asis
------------------------------------------------------------------------------
-- A d a r u n - t i m e s p e c i f i c a t i o n --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of ada.ads file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
generic
type Float_Type is digits <>;
package Ada.Numerics.Generic_Elementary_Functions is
pragma Pure (Generic_Elementary_Functions);
function Sqrt
(X : Float_Type'Base) return Float_Type'Base;
function Log
(X : Float_Type'Base) return Float_Type'Base;
function Log
(X, Base : Float_Type'Base) return Float_Type'Base;
function Exp
(X : Float_Type'Base) return Float_Type'Base;
function "**" (Left, Right : Float_Type'Base) return Float_Type'Base;
function Sin
(X : Float_Type'Base) return Float_Type'Base;
function Sin
(X, Cycle : Float_Type'Base) return Float_Type'Base;
function Cos
(X : Float_Type'Base) return Float_Type'Base;
function Cos
(X, Cycle : Float_Type'Base) return Float_Type'Base;
function Tan
(X : Float_Type'Base) return Float_Type'Base;
function Tan
(X, Cycle : Float_Type'Base) return Float_Type'Base;
function Cot
(X : Float_Type'Base) return Float_Type'Base;
function Cot
(X, Cycle : Float_Type'Base) return Float_Type'Base;
function Arcsin
(X : Float_Type'Base) return Float_Type'Base;
function Arcsin
(X, Cycle : Float_Type'Base) return Float_Type'Base;
function Arccos
(X : Float_Type'Base) return Float_Type'Base;
function Arccos
(X, Cycle : Float_Type'Base) return Float_Type'Base;
function Arctan (Y : Float_Type'Base;
X : Float_Type'Base := 1.0)
return Float_Type'Base;
function Arctan (Y : Float_Type'Base;
X : Float_Type'Base := 1.0;
Cycle : Float_Type'Base) return Float_Type'Base;
function Arccot (X : Float_Type'Base;
Y : Float_Type'Base := 1.0)
return Float_Type'Base;
function Arccot (X : Float_Type'Base;
Y : Float_Type'Base := 1.0;
Cycle : Float_Type'Base) return Float_Type'Base;
function Sinh
(X : Float_Type'Base) return Float_Type'Base;
function Cosh
(X : Float_Type'Base) return Float_Type'Base;
function Tanh
(X : Float_Type'Base) return Float_Type'Base;
function Coth
(X : Float_Type'Base) return Float_Type'Base;
function Arcsinh
(X : Float_Type'Base) return Float_Type'Base;
function Arccosh
(X : Float_Type'Base) return Float_Type'Base;
function Arctanh
(X : Float_Type'Base) return Float_Type'Base;
function Arccoth
(X : Float_Type'Base) return Float_Type'Base;
end Ada.Numerics.Generic_Elementary_Functions;
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2051.asm | ljhsiun2/medusa | 9 | 172292 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x8633, %rdx
clflush (%rdx)
nop
nop
nop
nop
xor %rdi, %rdi
vmovups (%rdx), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %r13
nop
nop
nop
nop
nop
xor %r9, %r9
lea addresses_A_ht+0x6cb5, %rsi
lea addresses_normal_ht+0xf337, %rdi
nop
nop
nop
nop
xor %rbp, %rbp
mov $11, %rcx
rep movsq
nop
nop
nop
dec %rcx
lea addresses_WC_ht+0x10fb7, %rsi
lea addresses_D_ht+0x2df7, %rdi
clflush (%rdi)
sub %r8, %r8
mov $86, %rcx
rep movsb
nop
nop
nop
and $28150, %rsi
lea addresses_A_ht+0x2cb7, %rsi
lea addresses_WT_ht+0x18737, %rdi
sub %r9, %r9
mov $32, %rcx
rep movsq
nop
nop
nop
nop
nop
xor $19701, %r9
lea addresses_D_ht+0xb8b9, %rdi
nop
nop
nop
and %r8, %r8
movw $0x6162, (%rdi)
nop
nop
nop
add $18706, %r9
lea addresses_A_ht+0x1a2c3, %r8
nop
nop
nop
xor %rsi, %rsi
mov $0x6162636465666768, %r9
movq %r9, (%r8)
nop
nop
nop
sub $62217, %r8
lea addresses_WT_ht+0xa637, %r8
and %r13, %r13
mov (%r8), %esi
nop
nop
dec %rcx
lea addresses_D_ht+0xf557, %r9
nop
nop
nop
nop
dec %r13
mov $0x6162636465666768, %rbp
movq %rbp, %xmm3
and $0xffffffffffffffc0, %r9
vmovntdq %ymm3, (%r9)
nop
nop
nop
cmp $49667, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %rax
push %rbp
push %rbx
push %rdi
push %rsi
// Store
lea addresses_PSE+0x2137, %rax
nop
sub $53101, %r12
movl $0x51525354, (%rax)
sub %rax, %rax
// Load
lea addresses_A+0xf0b7, %rbp
nop
nop
nop
nop
add %r12, %r12
vmovups (%rbp), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %rdi
nop
dec %r12
// Store
lea addresses_WT+0x1f1f8, %rdi
nop
nop
nop
nop
add %r10, %r10
movb $0x51, (%rdi)
nop
nop
nop
nop
nop
cmp $60594, %rdi
// Store
lea addresses_WT+0x1edd7, %rdi
nop
nop
nop
nop
xor %rbx, %rbx
mov $0x5152535455565758, %rsi
movq %rsi, (%rdi)
nop
and $12272, %rsi
// Store
lea addresses_WT+0x3ac9, %rbp
nop
nop
dec %rbx
movl $0x51525354, (%rbp)
nop
nop
nop
nop
add $15979, %r12
// Store
lea addresses_WC+0x15037, %rsi
nop
nop
nop
nop
cmp %r10, %r10
movl $0x51525354, (%rsi)
nop
nop
nop
nop
nop
inc %rbx
// Faulty Load
lea addresses_PSE+0xf737, %rsi
nop
nop
add %rax, %rax
mov (%rsi), %r10w
lea oracles, %rax
and $0xff, %r10
shlq $12, %r10
mov (%rax,%r10,1), %r10
pop %rsi
pop %rdi
pop %rbx
pop %rbp
pop %rax
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
programs/oeis/036/A036216.asm | jmorken/loda | 1 | 1082 | ; A036216: Expansion of 1/(1 - 3*x)^4; 4-fold convolution of A000244 (powers of 3).
; 1,12,90,540,2835,13608,61236,262440,1082565,4330260,16888014,64481508,241805655,892820880,3252418920,11708708112,41712272649,147219785820,515269250370,1789882659180,6175095174171,21171754882872,72176437100700,244772264950200,826106394206925,2775717484535268
add $0,3
mov $3,3
pow $3,$0
bin $0,3
mov $2,$3
lpb $2
mul $0,$2
mod $2,5
lpe
mov $1,$0
div $1,27
|
programs/oeis/143/A143689.asm | neoneye/loda | 22 | 19124 | ; A143689: a(n) = (3*n^2 - n + 2)/2.
; 1,2,6,13,23,36,52,71,93,118,146,177,211,248,288,331,377,426,478,533,591,652,716,783,853,926,1002,1081,1163,1248,1336,1427,1521,1618,1718,1821,1927,2036,2148,2263,2381,2502,2626,2753,2883,3016,3152,3291,3433,3578,3726,3877,4031,4188,4348,4511,4677,4846,5018,5193,5371,5552,5736,5923,6113,6306,6502,6701,6903,7108,7316,7527,7741,7958,8178,8401,8627,8856,9088,9323,9561,9802,10046,10293,10543,10796,11052,11311,11573,11838,12106,12377,12651,12928,13208,13491,13777,14066,14358,14653
mul $0,3
bin $0,2
div $0,3
add $0,1
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_15590_350.asm | ljhsiun2/medusa | 9 | 81238 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x187d1, %rsi
nop
nop
cmp %r8, %r8
mov $0x6162636465666768, %r9
movq %r9, (%rsi)
nop
nop
xor $9354, %rcx
lea addresses_UC_ht+0x1c982, %r10
nop
nop
nop
nop
sub %r8, %r8
mov $0x6162636465666768, %r11
movq %r11, (%r10)
nop
nop
nop
nop
nop
cmp $28227, %r11
lea addresses_A_ht+0x1ee02, %rsi
lea addresses_normal_ht+0x8a02, %rdi
nop
nop
nop
nop
nop
add $60923, %r15
mov $64, %rcx
rep movsl
nop
inc %r9
lea addresses_WT_ht+0xc042, %r10
nop
sub %r15, %r15
movl $0x61626364, (%r10)
nop
dec %rdi
lea addresses_WC_ht+0x1747c, %rsi
lea addresses_UC_ht+0x456e, %rdi
nop
nop
nop
add $41795, %r8
mov $31, %rcx
rep movsq
nop
inc %r11
lea addresses_A_ht+0x8e62, %rsi
lea addresses_UC_ht+0xfda2, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
nop
nop
cmp %r11, %r11
mov $68, %rcx
rep movsl
nop
cmp %r9, %r9
lea addresses_D_ht+0x11202, %rcx
nop
nop
and %r11, %r11
mov $0x6162636465666768, %r10
movq %r10, %xmm6
vmovups %ymm6, (%rcx)
nop
nop
add %r10, %r10
lea addresses_WC_ht+0x1b252, %r15
nop
nop
nop
nop
nop
add $33925, %rdi
movb $0x61, (%r15)
nop
nop
nop
nop
sub %r11, %r11
lea addresses_A_ht+0x14e02, %r10
nop
cmp $39760, %rcx
movw $0x6162, (%r10)
nop
xor $61614, %r8
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r8
push %r9
push %rax
push %rcx
push %rsi
// Store
lea addresses_D+0xa542, %r8
nop
nop
nop
sub %r9, %r9
mov $0x5152535455565758, %r11
movq %r11, %xmm2
movups %xmm2, (%r8)
cmp %r9, %r9
// Load
lea addresses_normal+0x16602, %rax
nop
xor %r12, %r12
movaps (%rax), %xmm1
vpextrq $0, %xmm1, %r8
nop
nop
add %rsi, %rsi
// Faulty Load
lea addresses_D+0x1fa02, %rax
nop
nop
xor $31441, %r12
mov (%rax), %ecx
lea oracles, %rax
and $0xff, %rcx
shlq $12, %rcx
mov (%rax,%rcx,1), %rcx
pop %rsi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'36': 15590}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
tools/src/tool-data.ads | fjudith/sql-benchmark | 24 | 22970 | -----------------------------------------------------------------------
-- tool-data -- Perf data representation
-- Copyright (C) 2018 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Containers.Vectors;
with Ada.Containers.Ordered_Maps;
with Ada.Containers.Indefinite_Ordered_Maps;
private with Ada.Containers.Indefinite_Vectors;
private with Util.Beans.Objects;
private with Util.Serialize.Mappers.Record_Mapper;
pragma No_Recursion;
package Tool.Data is
-- Type representing a number of times a benchmark test is executed.
type Count_Type is new Natural;
-- Type representing the number of rows associated with the benchmark.
type Row_Count_Type is new Natural;
-- Type representing a driver index.
type Driver_Type is new Positive;
-- Type representing a language index.
type Language_Type is new Positive;
-- Type representing a database index.
type Database_Type is new Positive;
type Driver_Result is record
Index : Driver_Type := Driver_Type'First;
Language : Language_Type := Language_Type'First;
Database : Database_Type := Database_Type'First;
Count : Count_Type := 0;
Thread_Count : Natural := 0;
Rss_Size : Natural := 0;
Peek_Rss : Natural := 0;
User_Time : Natural := 0;
Sys_Time : Natural := 0;
end record;
type Result_Type is record
Count : Count_Type;
Time : Duration;
end record;
package Result_Vectors is
new Ada.Containers.Vectors (Index_Type => Driver_Type,
Element_Type => Result_Type,
"=" => "=");
type Perf_Result is record
Value : Row_Count_Type := 0;
Results : Result_Vectors.Vector;
end record;
package Perf_Result_Maps is
new Ada.Containers.Ordered_Maps (Key_Type => Row_Count_Type,
Element_Type => Perf_Result,
"<" => "<",
"=" => "=");
subtype Perf_Map is Perf_Result_Maps.Map;
subtype Perf_Cursor is Perf_Result_Maps.Cursor;
package Benchmark_Maps is
new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => String,
Element_Type => Perf_Map,
"<" => "<",
"=" => Perf_Result_Maps."=");
subtype Benchmark_Map is Benchmark_Maps.Map;
subtype Benchmark_Cursor is Benchmark_Maps.Cursor;
procedure Read (Path : in String);
procedure Save (Path : in String;
Databases : in String;
Languages : in String) with
Pre => Databases'Length > 0 and Languages'Length > 0;
procedure Save_Memory (Path : in String;
Languages : in String) with
Pre => Languages'Length > 0;
procedure Save_Excel (Path : in String);
private
package UBO renames Util.Beans.Objects;
package Driver_Maps is
new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => String,
Element_Type => Driver_Result,
"<" => "<");
subtype Driver_Map is Driver_Maps.Map;
subtype Driver_Cursor is Driver_Maps.Cursor;
package Language_Vectors is
new Ada.Containers.Indefinite_Vectors (Index_Type => Language_Type,
Element_Type => String);
subtype Language_Vector is Language_Vectors.Vector;
subtype Language_Cursor is Language_Vectors.Cursor;
package Database_Vectors is
new Ada.Containers.Indefinite_Vectors (Index_Type => Database_Type,
Element_Type => String);
subtype Database_Vector is Database_Vectors.Vector;
subtype Database_Cursor is Database_Vectors.Cursor;
-- Array of database index.
type Database_Array_Index is array (Positive range <>) of Database_Type;
-- Array of language index.
type Language_Array_Index is array (Positive range <>) of Language_Type;
type Benchmark_Fields is (FIELD_DRIVER,
FIELD_LANGUAGE,
FIELD_THREADS,
FIELD_RSS_SIZE,
FIELD_PEEK_RSS_SIZE,
FIELD_USER_TIME,
FIELD_SYS_TIME,
FIELD_COUNT,
FIELD_TIME,
FIELD_TITLE,
FIELD_MEASURES,
FIELD_TOTAL);
type Benchmark_Info is record
Drivers : Driver_Map;
Databases : Database_Vector;
Languages : Language_Vector;
Benchmarks : Benchmark_Map;
Thread_Count : Natural := 0;
Rss_Size : Natural := 0;
Peek_Rss_Size : Natural := 0;
User_Time : Natural := 0;
Sys_Time : Natural := 0;
Count : Count_Type := 0;
Driver : UBO.Object;
Language : UBO.Object;
Title : UBO.Object;
Time : Duration := 0.0;
Driver_Index : Driver_Type := Driver_Type'First;
Language_Index : Language_Type;
Database_Index : Database_Type;
end record;
type Benchmark_Info_Access is access all Benchmark_Info;
procedure Set_Member (Benchmark : in out Benchmark_Info;
Field : in Benchmark_Fields;
Value : in UBO.Object);
package Benchmark_Mapper is
new Util.Serialize.Mappers.Record_Mapper (Element_Type => Benchmark_Info,
Element_Type_Access => Benchmark_Info_Access,
Fields => Benchmark_Fields,
Set_Member => Set_Member);
end Tool.Data;
|
assignment/assignment1/main/mc/parser/MC.g4 | khoidohpc/ppl-course | 2 | 2705 | <reponame>khoidohpc/ppl-course<filename>assignment/assignment1/main/mc/parser/MC.g4<gh_stars>1-10
grammar MC;
@lexer::header {
from lexererr import *
}
@lexer::members {
def emit(self):
tk = self.type
if tk == self.UNCLOSE_STRING:
result = super().emit();
raise UncloseString(result.text);
elif tk == self.ILLEGAL_ESCAPE:
result = super().emit();
raise IllegalEscape(result.text);
elif tk == self.ERROR_CHAR:
result = super().emit();
raise ErrorToken(result.text);
else:
return super().emit();
}
options {
language = Python3;
}
//------------------------------ Fragment ------------------------------//
fragment Digit: [0-9];
fragment Lowcase: [a-z];
fragment Uppercase: [A-Z];
fragment Letter: Lowcase | Uppercase;
fragment Character: ~[\b\f\r\n\t"\\] | Escape;
fragment Escape: '\\' [bfrnt"\\];
fragment IllegalEscape: '\\' ~[bfrnt"\\] ;
fragment Dot: '.';
fragment Underscore: '_';
fragment Exponent: [eE] '-'? Digit+;
//------------------------------ PARSER ------------------------------//
//------------------------------------------------------------------------//
//------------------------------ Program ------------------------------//
program: (var_declare | func_declare)+ EOF;
//------------------------ Variable Declaration ----------------------//
var_declare: prim_type varlist SEMI;
prim_type: BOOLEANTYPE | INTTYPE
| FLOATTYPE | STRINGTYPE;
varlist: var (COMA varlist)*;
var: ID (LSB INTLIT RSB)?;
//------------------------ Function Declaration ----------------------//
func_declare: func_type ID LB paralist? RB blockstmt;
func_type: prim_type | arraytype | VOIDTYPE;
arraytype: prim_type LSB RSB;
paralist: paradcl (COMA paradcl)*;
paradcl: prim_type para;
para: ID (LSB RSB)?;
//------------------------ Block Statement ----------------------//
blockstmt: LP (var_declare | stmt)* RP;
stmt: blockstmt | if_stmt
| while_stmt | for_stmt
| break_stmt | continue_stmt
| return_stmt | expr_stmt
;
if_stmt: IF LB expr0 RB stmt (ELSE stmt)?;
while_stmt: DO stmt+ WHILE expr0 SEMI;
for_stmt: FOR LB expr0 SEMI expr0 SEMI expr0 RB stmt;
break_stmt: BREAK SEMI;
continue_stmt: CONTINUE SEMI;
return_stmt: RETURN (expr0)? SEMI;
expr_stmt: expr0 SEMI;
//-------------------------- Expression ------------------------//
expr0: expr1 ASSIGN expr0 | expr1;
expr1: expr1 OR expr2 | expr2;
expr2: expr2 AND expr3 | expr3;
expr3: expr4 (EQ | NE) expr4 | expr4;
expr4: expr5 (LT | LE | GT | GE) expr5 | expr5;
expr5: expr5 (ADD | SUB) expr6 | expr6;
expr6: expr6 (MUL | DIV | MOD) expr7 | expr7;
expr7: (NOT | SUB) expr7 | expr8;
expr8: expr9 LSB expr0 RSB | expr9;
expr9: LB expr0 RB | operands;
operands: INTLIT | BOOLEANLIT | ID
| FLOATLIT | STRINGLIT | calfunc;
calfunc: ID LB arglist RB;
arglist: (expr0 (COMA expr0)*)?;
//------------------------------ LEXER --------------------------------//
//-------------------------------------------------------------------------//
//-------------------------------- Literal --------------------------------//
INTLIT: Digit+;
FLOATLIT: Digit+ Dot (Digit)* Exponent?
| Digit* Dot (Digit)+ Exponent?
| Digit+ Exponent;
BOOLEANLIT: TRUE | FALSE;
STRINGLIT: '"' Character* '"' {
temp = str(self.text)
self.text = temp[1:-1]
};
//------------------------------ Keyword ------------------------------//
BOOLEANTYPE: 'boolean';
INTTYPE: 'int';
FLOATTYPE: 'float';
STRINGTYPE: 'string';
VOIDTYPE: 'void';
DO: 'do';
WHILE: 'while';
FOR: 'for';
BREAK: 'break';
CONTINUE: 'continue';
IF: 'if';
ELSE: 'else';
RETURN: 'return';
TRUE: 'true';
FALSE: 'false';
//------------------------------ Identifier ------------------------------//
ID: (Letter | Underscore) (Letter | Underscore | Digit)*;
//------------------------------ Operator ------------------------------//
ADD: '+';
SUB: '-';
MUL: '*';
DIV: '/';
MOD: '%';
NOT: '!';
OR: '||';
AND: '&&';
EQ: '==';
NE: '!=';
LT: '<';
GT: '>';
LE: '<=';
GE: '>=';
ASSIGN: '=';
//------------------------------ Separator ------------------------------//
LB: '(';
RB: ')';
LP: '{';
RP: '}';
LSB: '[';
RSB: ']';
COMA: ',';
SEMI: ';';
//------------------------------ Comment ------------------------------//
CMTLINE: '//' ~[\n\r\f]* -> skip;
CMTBLOCK: '/''*' .*? '*''/' -> skip;
WS: [ \f\t\r\n]+ -> skip; // skip spaces, tabs, newlines
//------------------------------ Error token ------------------------------//
UNCLOSE_STRING: '"' Character* ([\b\f\r\n\t\\] | EOF) {
esc = ['\b', '\t', '\n', '\f', '\r', '\\']
temp = str(self.text)
if temp[-1] in esc:
raise UncloseString(temp[1:-1])
else :
raise UncloseString(temp[1:])
};
ILLEGAL_ESCAPE:'"' Character* IllegalEscape {
temp = str(self.text)
raise IllegalEscape(temp[1:])
};
ERROR_CHAR:.
{
raise ErrorToken(self.text)
};
|
tools/ucd_data.ads | svn2github/matreshka | 24 | 19030 | <filename>tools/ucd_data.ads
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2009-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$
------------------------------------------------------------------------------
with Matreshka.Internals.Unicode.Ucd;
package Ucd_Data is
type Core_Values_Array is
array (Matreshka.Internals.Unicode.Code_Point)
of Matreshka.Internals.Unicode.Ucd.Core_Values;
type Core_Values_Array_Access is access Core_Values_Array;
type Code_Point_Sequence_Access is
access Matreshka.Internals.Unicode.Ucd.Code_Point_Sequence;
type Context_Code_Point_Sequence is
array (Matreshka.Internals.Unicode.Ucd.Casing_Context
range Matreshka.Internals.Unicode.Ucd.Final_Sigma
.. Matreshka.Internals.Unicode.Ucd.After_I)
of Code_Point_Sequence_Access;
type Full_Case_Values is record
Default : Code_Point_Sequence_Access;
Positive : Context_Code_Point_Sequence;
Negative : Context_Code_Point_Sequence;
end record;
type Optional_Code_Point (Present : Boolean := False) is record
case Present is
when True =>
C : Matreshka.Internals.Unicode.Code_Point;
when False =>
null;
end case;
end record;
type Case_Values is record
SUM : Optional_Code_Point;
SLM : Optional_Code_Point;
STM : Optional_Code_Point;
SCF : Optional_Code_Point;
FUM : Full_Case_Values;
FLM : Full_Case_Values;
FTM : Full_Case_Values;
FCF : Code_Point_Sequence_Access;
end record;
type Languages is (Default, az, lt, tr);
type Case_Values_Array is
array (Matreshka.Internals.Unicode.Code_Point) of Case_Values;
type Case_Values_Array_Access is access Case_Values_Array;
type Normalization_Kinds is (Canonical_Mapping, Canonical, Compatibility);
type Normalization_Values is
array (Normalization_Kinds) of Code_Point_Sequence_Access;
type Character_Normalization_Information is record
CCC : Matreshka.Internals.Unicode.Ucd.Canonical_Combining_Class
:= Matreshka.Internals.Unicode.Ucd.Not_Reordered; -- see UCD.html
NQC : Matreshka.Internals.Unicode.Ucd.Normalization_Quick_Checks
:= (others => Matreshka.Internals.Unicode.Ucd.Yes);
-- see DerivedNormalizationProps.txt
DT : Matreshka.Internals.Unicode.Ucd.Decomposition_Type
:= Matreshka.Internals.Unicode.Ucd.None; -- see UCD.html
B : Matreshka.Internals.Unicode.Ucd.Non_Overridable_Boolean_Values
:= (others => False);
Values : Normalization_Values;
end record;
type Normalization_Values_Array is
array (Matreshka.Internals.Unicode.Code_Point)
of Character_Normalization_Information;
type Normalization_Values_Array_Access is
access all Normalization_Values_Array;
Core : Core_Values_Array_Access;
Cases : Case_Values_Array_Access;
Norms : Normalization_Values_Array_Access;
procedure Load (Unidata_Directory : String);
end Ucd_Data;
|
dino/lcs/enemy/7D.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 19510 | <gh_stars>1-10
copyright zengfr site:http://github.com/zengfr/romhack
00492A move.b D0, ($7d,A6)
00492E move.b D0, ($87,A6)
011F2C tst.b ($7d,A3) [enemy+6C]
011F30 bpl $11f3a [enemy+7D]
02AC30 tst.b ($7d,A6)
02AC34 bmi $2ac6e
02B0EE tst.b ($7d,A6)
02B0F2 bpl $2b150
03246C move.b ($7d,A1), D0
032470 bmi $324ce [enemy+7D]
03393A move.b D0, ($7d,A6)
03393E move.b D0, ($87,A6)
033982 move.b #$0, ($7d,A6)
033988 rts
033F62 move.b #$0, ($7d,A6) [enemy+7B]
033F68 bsr $35172
033FEE move.b #$0, ($7d,A6) [enemy+ 4, enemy+ 6]
033FF4 move.w #$12c, ($b2,A6)
034102 move.b #$0, ($7d,A6)
034108 bsr $35812
034270 move.b #$1, ($7d,A6) [enemy+ 6]
034276 moveq #$1, D0 [enemy+7D]
034632 move.b #$0, ($7d,A6) [enemy+ 7]
034638 moveq #$6, D0
0353FC move.b #$0, ($7d,A6)
035402 moveq #$4, D5
035A08 move.b D0, ($7d,A6)
035A0C move.b #$c8, ($72,A6)
035A40 move.b #$0, ($7d,A6)
035A46 move.b #$0, ($63,A6)
035D7C move.b #$0, ($7d,A6)
035D82 move.b #$0, ($b8,A6)
03B2BC move.b #$ff, ($7d,A6) [enemy+ 0]
03B2C2 move.b #$10, ($25,A6) [enemy+7D]
03B3EE move.b #$ff, ($7d,A6)
03B3F4 move.b #$1, ($2f,A6) [enemy+7D]
03B88A move.b D0, ($7d,A6)
03B88E move.b D0, ($87,A6)
03B8B0 move.b #$0, ($7d,A6)
03B8B6 bra $3b91a
03BC48 move.b #$0, ($7d,A6)
03BC4E tst.b ($7a,A6)
03BCB8 move.b #$0, ($7d,A6) [enemy+A2]
03BCBE tst.b ($51,A6)
03C002 move.b #$1, ($7d,A6) [enemy+A0]
03C008 jsr $119c.l [enemy+7D]
03CE18 cmpi.b #$1, ($7d,A6)
03CE1E beq $3ce42 [enemy+7D]
03DEAC move.b D0, ($7d,A6)
03DEB0 move.b #$c8, ($72,A6)
03DF0C move.b #$0, ($7d,A6)
03DF12 jsr $32c5e.l
03DF24 move.b #$0, ($7d,A6) [enemy+ 4, enemy+ 6]
03DF2A jsr $32c5e.l
03E436 cmpi.b #$e, ($7d,A6)
03E43C beq $3e446
03E51C move.b #$0, ($7d,A6)
03E522 jsr $32c5e.l
040372 move.b D0, ($7d,A6)
040376 move.b #$c8, ($72,A6)
0403A4 move.b #$0, ($7d,A6)
0403AA move.b #$0, ($63,A6)
0403B8 move.b #$0, ($7d,A6) [enemy+ 4, enemy+ 6]
0403BE jsr $32d90.l
040912 move.b #$0, ($7d,A6)
040918 jsr $32d90.l
041F3C move.b #$ff, ($7d,A6) [enemy+25]
041F42 clr.b ($59,A6) [enemy+7D]
04210C move.b #$ff, ($7d,A6) [enemy+ 4]
042112 move.b #$ff, ($63,A6) [enemy+7D]
0423BE move.b #$ff, ($7d,A6) [enemy+ 0]
0423C4 move.l #$42516, ($40,A6) [enemy+7D]
042646 move.b D0, ($7d,A6)
04264A move.b D0, ($b1,A6)
044EF2 move.b #$ff, ($7d,A6)
044EF8 rts [enemy+7D]
044EFA move.b #$0, ($7d,A6)
044F00 rts
045844 move.b D0, ($7d,A6)
045848 move.b D0, ($87,A6)
045876 move.b #$0, ($7d,A6)
04587C jsr $326f8.l
045D84 move.b #$0, ($7d,A6)
045D8A tst.b ($7a,A6)
045DDA move.b #$0, ($7d,A6) [enemy+A0]
045DE0 tst.b ($51,A6)
04636C move.b #$1, ($7d,A6) [enemy+AC]
046372 move.b ($59,A6), D0 [enemy+7D]
048434 move.b #$ff, ($7d,A6)
04843A moveq #$0, D0 [enemy+7D]
0491BE tst.b ($7d,A1)
0491C2 bmi $491ec
04D952 move.b D0, ($7d,A6)
04D956 move.b D0, ($87,A6)
04D966 move.b #$ff, ($7d,A6)
04D96C addq.b #2, ($4,A6) [enemy+7D]
04DD5C move.b D0, ($7d,A6)
04DD60 move.b D0, ($a4,A6)
04DDB4 move.b #$ff, ($7d,A6)
04DDBA cmpi.b #$4, ($4d9,A5) [enemy+7D]
04FDB8 move.b D0, ($7d,A6)
04FDBC move.b D0, ($87,A6)
04FDD8 move.b #$ff, ($7d,A6)
04FDDE move.b D0, ($bb,A6) [enemy+7D]
050FFC move.b D0, ($7d,A6)
051000 move.b D0, ($87,A6)
051012 move.b #$ff, ($7d,A6)
051018 addq.b #2, ($4,A6) [enemy+7D]
0512DC move.b #$ff, ($7d,A6) [enemy+ 0]
0512E2 moveq #$0, D0 [enemy+7D]
053508 move.b #$ff, ($7d,A6)
05350E moveq #$0, D0 [enemy+7D]
0558BC move.b #$ff, ($7d,A6) [enemy+ 0]
0558C2 move.b #$2, ($4,A6) [enemy+7D]
055B4C move.b #$ff, ($7d,A6)
055B52 bsr $55e9a [enemy+7D]
056586 move.b #$ff, ($7d,A6) [enemy+ 0]
05658C move.b #$0, ($5,A6) [enemy+7D]
056944 move.b #$ff, ($7d,A6)
05694A move.l #$56a56, ($40,A6) [enemy+7D]
056A98 move.b #$ff, ($7d,A6) [enemy+23]
056A9E move.l ($10,A6), ($c,A6) [enemy+7D]
056CA8 move.b #$ff, ($7d,A6) [enemy+23]
056CAE clr.w ($a0,A6) [enemy+7D]
0572D2 move.b #$ff, ($7d,A6)
0572D8 jsr $3140c.l [enemy+7D]
0578EA move.b D0, ($7d,A6)
0578EE move.b D0, ($87,A6)
05793E move.b #$ff, ($7d,A6)
057944 addq.b #2, ($4,A6) [enemy+7D]
057E8A move.b #$ff, ($7d,A6)
057E90 jsr $12cb4.l [enemy+7D]
058000 move.b #$ff, ($7d,A6) [enemy+25]
058006 move.b #$ff, ($63,A6) [enemy+7D]
058104 move.b #$ff, ($7d,A6) [enemy+ 0]
05810A move.b #$ff, ($63,A6) [enemy+7D]
05851C move.b #$ff, ($7d,A6)
058522 move.b #$1e, ($72,A6) [enemy+7D]
0585F8 move.b #$ff, ($7d,A6)
0585FE move.b #$2, ($63,A6) [enemy+7D]
058DC0 move.b #$ff, ($7d,A6)
058DC6 move.w #$14, ($ae,A6) [enemy+7D]
05A496 move.b #$ff, ($7d,A6) [enemy+ 0]
05A49C move.b #$ff, ($63,A6) [enemy+7D]
05AB12 move.b D0, ($7d,A6)
05AB16 move.b #$c8, ($72,A6)
05AB34 move.b #$0, ($7d,A6)
05AB3A move.l #$2000000, ($4,A6)
05AB42 move.b #$0, ($7d,A6) [enemy+ 4, enemy+ 6]
05AB48 move.b #$0, ($63,A6)
05B0D4 move.b D0, ($7d,A6)
05B0D8 move.b D0, ($87,A6)
05B94C move.b #$ff, ($7d,A6)
05B952 move.b D0, ($87,A6) [enemy+7D]
05C3F4 move.b #$0, ($7d,A6)
05C3FA move.b D0, ($87,A6)
05EE30 move.b #$ff, ($7d,A6)
05EE36 move.b #$1, ($a2,A6) [enemy+7D]
05F204 move.b #$ff, ($7d,A6)
05F20A move.b D0, ($87,A6) [enemy+7D]
05F63A move.b D0, ($7d,A6)
05F63E move.b D0, ($87,A6)
05F660 move.b #$0, ($7d,A6)
05F666 bra $5f75c
05F85C move.b #$0, ($7d,A6)
05F862 tst.b ($7a,A6)
05F8A4 move.b #$0, ($7d,A6) [enemy+ 4, enemy+ 6]
05F8AA bsr $5fb18
05FF76 move.b #$ff, ($7d,A6)
05FF7C move.b D0, ($87,A6) [enemy+7D]
06A256 move.b #$ff, ($7d,A6) [enemy+25]
06A25C move.b #$ff, ($63,A6) [enemy+7D]
07BF7A cmpi.b #-$1, ($7d,A0)
07BF80 bne $7bf8a [enemy+7D]
copyright zengfr site:http://github.com/zengfr/romhack
|
oeis/021/A021737.asm | neoneye/loda-programs | 11 | 88951 | <gh_stars>10-100
; A021737: Decimal expansion of 1/733.
; Submitted by <NAME>(s1.)
; 0,0,1,3,6,4,2,5,6,4,8,0,2,1,8,2,8,1,0,3,6,8,3,4,9,2,4,9,6,5,8,9,3,5,8,7,9,9,4,5,4,2,9,7,4,0,7,9,1,2,6,8,7,5,8,5,2,6,6,0,3,0,0,1,3,6,4,2,5,6,4,8,0,2,1,8,2,8,1,0,3,6,8,3,4,9,2,4,9,6,5,8,9,3,5,8,7,9,9
add $0,1
mov $2,10
pow $2,$0
div $2,733
mov $0,$2
mod $0,10
|
src/static/antlr4/grammars/NumericLiteralB1.g4 | jlenoble/ecmascript-parser | 0 | 1320 | <reponame>jlenoble/ecmascript-parser
/* Source: ECMAScript® 2018 Language Specification - Annex B-1 */
lexer grammar NumericLiteralB1;
// B.1.1 Numeric Literals
// The syntax and semantics of 11.8.3 is extended as follows except that this
// extension is not allowed for strict mode code:
// Syntax
// NumericLiteral::
// DecimalLiteral
// BinaryIntegerLiteral
// OctalIntegerLiteral
// HexIntegerLiteral
// LegacyOctalIntegerLiteral
NumericLiteral
: (DecimalLiteral|BinaryIntegerLiteral|OctalIntegerLiteral|HexIntegerLiteral
|LegacyOctalIntegerLiteral)
;
// LegacyOctalIntegerLiteral::
// 0 OctalDigit
// LegacyOctalIntegerLiteral OctalDigit
fragment
LegacyOctalIntegerLiteral
: '0' OctalDigit+
;
// DecimalIntegerLiteral::
// 0
// NonZeroDigit DecimalDigits[opt]
// NonOctalDecimalIntegerLiteral
fragment
DecimalIntegerLiteral
: ('0'|NonZeroDigit DecimalDigits?|NonOctalDecimalIntegerLiteral)
;
// NonOctalDecimalIntegerLiteral::
// 0 NonOctalDigit
// LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit
// NonOctalDecimalIntegerLiteral DecimalDigit
fragment
NonOctalDecimalIntegerLiteral
: ('0' NonOctalDigit DecimalDigit*
|LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit DecimalDigit*)
;
// LegacyOctalLikeDecimalIntegerLiteral::
// 0 OctalDigit
// LegacyOctalLikeDecimalIntegerLiteral OctalDigit
fragment
LegacyOctalLikeDecimalIntegerLiteral
: '0' OctalDigit+
;
// NonOctalDigit::one of
// 8 9
fragment
NonOctalDigit
: [89]
;
/*
B.1.1.1 Static Semantics
The MV of LegacyOctalIntegerLiteral::0OctalDigit is the MV of OctalDigit.
The MV of LegacyOctalIntegerLiteral::LegacyOctalIntegerLiteralOctalDigit is (the MV of LegacyOctalIntegerLiteral times 8) plus the MV of OctalDigit.
The MV of DecimalIntegerLiteral::NonOctalDecimalIntegerLiteral is the MV of NonOctalDecimalIntegerLiteral.
The MV of NonOctalDecimalIntegerLiteral::0NonOctalDigit is the MV of NonOctalDigit.
The MV of NonOctalDecimalIntegerLiteral::LegacyOctalLikeDecimalIntegerLiteralNonOctalDigit is (the MV of LegacyOctalLikeDecimalIntegerLiteral times 10) plus the MV of NonOctalDigit.
The MV of NonOctalDecimalIntegerLiteral::NonOctalDecimalIntegerLiteralDecimalDigit is (the MV of NonOctalDecimalIntegerLiteral times 10) plus the MV of DecimalDigit.
The MV of LegacyOctalLikeDecimalIntegerLiteral::0OctalDigit is the MV of OctalDigit.
The MV of LegacyOctalLikeDecimalIntegerLiteral::LegacyOctalLikeDecimalIntegerLiteralOctalDigit is (the MV of LegacyOctalLikeDecimalIntegerLiteral times 10) plus the MV of OctalDigit.
The MV of NonOctalDigit::8 is 8.
The MV of NonOctalDigit::9 is 9.
*/
|
bank25.asm | alexsteb/zelda_gb_disassembly | 3 | 105065 | ldh a, [$ff00 + $00]
ld c, b
nop
ldh a, [$ff00 + $08]
ld c, b
jr nz, 0.l_4009
nop
ld c, d
nop
nop
ld [$204a], sp
ldh a, [$ff00 + $00]
ld a, b
nop
ldh a, [$ff00 + $08]
ld a, b
jr nz, 0.l_4019
nop
ld a, d
nop
nop
ld [$207a], sp
ld d, $00
ld hl, $c2b0
add hl, bc
ld a, [hl]
and a
jr z, 0.l_404a
ld de, $4020
call func_3cd0
call func_789f
call func_790b
call func_7944
ld hl, $c320
add hl, bc
dec [hl]
dec [hl]
ld hl, $c310
add hl, bc
ld a, [hl]
and $80
jp nz, $79b4
ret
ld hl, $4000
ldh a, [$ff00 + $f7]
cp $01
jr nz, 0.l_4056
ld hl, $4010
ld c, $04
call func_3d26
call func_3d19
call func_789f
call func_08e2
call func_3beb
ldh a, [$ff00 + $f0]
rst 0
ld [hl], b
ld b, b
inc hl
ld b, c
inc hl
ld b, c
call func_3b9e
call func_7804
call func_795e
add a, $10
cp $20
jp nc, .l_411c
call func_796e
add a, $20
cp $30
jp nc, .l_411c
ld a, [$c19b]
and a
jp nz, .l_411c
ld a, [$db00]
cp $03
jr nz, 0.l_40a0
ldh a, [$ff00 + $cb]
and $20
jr nz, 0.l_40ad
jr 0.l_411c
ld a, [$db01]
cp $03
jr nz, 0.l_411c
ldh a, [$ff00 + $cb]
and $10
jr z, 0.l_411c
ld a, [$c3cf]
and a
jr nz, 0.l_411c
ld a, $01
ldh [$ff00 + $a1], a
ld [$c3cf], a
ldh a, [$ff00 + $9e]
ld e, a
ld d, $00
ld hl, $1e63
add hl, de
ld a, [hl]
ldh [$ff00 + $9d], a
ld hl, $1e67
add hl, de
ldh a, [$ff00 + $cb]
and [hl]
jr z, 0.l_411c
ld hl, $1e6b
add hl, de
ld a, [hl]
ld [$c13c], a
ld hl, $1e6f
add hl, de
ld a, [hl]
ld [$c13b], a
ld hl, $ff9d
inc [hl]
ld a, [$db43]
cp $02
jr nz, 0.l_411c
ld e, $08
ld a, [$d47c]
and a
jr z, 0.l_40f4
ld e, $03
ld hl, $c3d0
add hl, bc
inc [hl]
ld a, [hl]
cp e
jr c, 0.l_4122
call func_3b8d
ld [hl], $02
ld hl, $c280
add hl, bc
ld [hl], $07
ld hl, $c490
add hl, bc
ld [hl], b
ldh a, [$ff00 + $9e]
ld [$c15d], a
call func_0891
ld [hl], $02
ld hl, $fff3
ld [hl], $02
ld hl, $c3d0
add hl, bc
ld [hl], b
ret
ret
call func_790b
call func_7944
call func_3b9e
ld hl, $c320
add hl, bc
dec [hl]
dec [hl]
ld hl, $c2a0
add hl, bc
ld a, [hl]
and $0f
jr nz, 0.l_4144
ld hl, $c310
add hl, bc
ld a, [hl]
and $80
jr z, 0.l_4169
call func_4188
ld a, [$c18e]
and $1f
cp $0b
jr nz, 0.l_4169
ld a, [$c50d]
cp $35
jr c, 0.l_415b
cp $3d
jr c, 0.l_4166
ld a, [$c503]
cp $35
jr c, 0.l_4169
cp $3d
jr nc, 0.l_4169
call func_08ec
ret
nop
ld [$0800], sp
nop
ld [$f8f8], sp
nop
nop
ld [$fc08], sp
dec b
ld a, [$fb06]
inc b
<error>
ldhl sp, d
cp $ff
inc bc
ld [bc], a
jr 0.l_4198
inc de
ld d, $12
inc d
ld a, $00
ldh [$ff00 + $e8], a
ld a, $9d
call func_3c01
jr c, 0.l_41e7
ld hl, $c2b0
add hl, de
inc [hl]
ld hl, $c340
add hl, de
ld [hl], $c1
push bc
ldh a, [$ff00 + $e8]
ld c, a
ld hl, $416a
add hl, bc
ldh a, [$ff00 + $d7]
add a, [hl]
ld hl, $c200
add hl, de
ld [hl], a
ld hl, $4170
add hl, bc
ldh a, [$ff00 + $d8]
add a, [hl]
ld hl, $c210
add hl, de
ld [hl], a
ldh a, [$ff00 + $da]
ld hl, $c310
add hl, de
ld [hl], a
ld hl, $4176
add hl, bc
ld a, [hl]
ld hl, $c240
add hl, de
ld [hl], a
ld hl, $417c
add hl, bc
ld a, [hl]
ld hl, $c250
add hl, de
ld [hl], a
ld hl, $4182
add hl, bc
ld a, [hl]
ld hl, $c320
add hl, de
ld [hl], a
pop bc
ldh a, [$ff00 + $e8]
inc a
cp $06
jr nz, 0.l_418a
ld a, $29
ldh [$ff00 + $f4], a
ldh a, [$ff00 + $ee]
ldh [$ff00 + $d7], a
ldh a, [$ff00 + $ec]
ldh [$ff00 + $d8], a
ld a, $02
call func_0953
ldh a, [$ff00 + $ec]
sub a, $10
ldh [$ff00 + $d8], a
ld a, $02
call func_0953
jp $79b4
rl a
ld de, $2836
ld b, l
ld d, d
ld a, d
ld h, h
sub a, e
and c
push bc
call nc, func_0e28
ccf
ld e, l
ld a, [$dba5]
and a
jr nz, 0.l_4276
ldh a, [$ff00 + $f6]
cp $ce
jp nz, .l_4405
call func_789f
ld a, [$c146]
and a
ret nz
ldh a, [$ff00 + $98]
sub a, $50
add a, $03
cp $06
ret nc
ldh a, [$ff00 + $99]
sub a, $46
add a, $04
cp $08
ret nc
ld a, $01
ld [$d401], a
ld a, $1f
ld [$d402], a
ld a, $f8
ld [$d403], a
ld a, $50
ld [$d404], a
ldh [$ff00 + $98], a
ld a, $48
ld [$d405], a
ldh [$ff00 + $99], a
ld a, $45
ld [$d416], a
ld a, $06
ld [$c11c], a
call func_093b
ld [$c198], a
ld a, $51
ld [$dbcb], a
ld a, $0c
ldh [$ff00 + $f3], a
jp $79b4
ld a, $01
ld [$c19d], a
ldh a, [$ff00 + $f7]
ld e, a
ld d, b
ld hl, $db65
add hl, de
ld a, [hl]
and $01
jp z, .l_42de
call func_43a7
ldh a, [$ff00 + $f0]
rst 0
sub a, a
ld b, d
and b
ld b, d
or [hl]
ld b, d
di
ld b, d
call func_3b8d
ld a, $1b
ld [$d368], a
ret
call func_795e
add a, $04
cp $08
jr nc, 0.l_42b2
call func_796e
add a, $04
cp $08
jr c, 0.l_42b5
call func_3b8d
ret
ldh a, [$ff00 + $a2]
and a
jr nz, 0.l_42de
call func_795e
add a, $03
cp $06
jr nc, 0.l_42de
call func_796e
add a, $03
cp $06
jr nc, 0.l_42de
call func_3b8d
ld a, $20
ld [$c1c6], a
call func_0891
ld [hl], $50
ld a, $1c
ldh [$ff00 + $f2], a
ret
<error>
<error>
<error>
<error>
sub a, h
sub a, h
sub a, h
sub a, h
ld d, h
ld d, h
ld d, h
ld d, h
nop
nop
nop
nop
nop
inc bc
ld bc, $cd02
dec sp
add hl, bc
ld [$db94], a
ld [$dbc7], a
ld [$c13e], a
ld [$c137], a
ld [$c16a], a
ld [$c166], a
ld [$c1a9], a
inc a
ld [$c167], a
ldh a, [$ff00 + $ee]
ldh [$ff00 + $98], a
ldh a, [$ff00 + $ec]
ldh [$ff00 + $99], a
call func_0891
jr nz, 0.l_4353
ld hl, $d401
ld a, $01
ldi [hl], a
ldh a, [$ff00 + $f7]
ldi [hl], a
inc hl
ld a, $50
ldi [hl], a
push hl
ldh a, [$ff00 + $f7]
ld e, a
sla e
ld d, $00
ld hl, $4206
add hl, de
ldh a, [$ff00 + $f6]
cp [hl]
jr nz, 0.l_433b
inc hl
ld a, [hl]
ld [$d403], a
pop hl
cp $64
ld a, $48
jr nz, 0.l_4348
ld a, $28
ld [hl], a
xor a
ld [$c167], a
call func_79b4
jp .l_092a
ld hl, $ffa1
ld [hl], $01
push af
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
and $03
ld e, a
ld d, b
ld hl, $42ef
add hl, de
ld a, [hl]
ldh [$ff00 + $9e], a
push bc
call func_087c
pop bc
ld hl, $c440
add hl, bc
pop af
cp $40
jr nc, 0.l_4381
and $03
jr nz, 0.l_4381
ld a, [hl]
cp $0c
jr z, 0.l_4381
inc [hl]
ldh a, [$ff00 + $e7]
and $03
add a, [hl]
ld e, a
ld d, b
ld hl, $42df
add hl, de
ld a, [hl]
ld [$db97], a
ret
ld e, $00
ld e, $60
ld e, $40
ld e, $20
ldhl sp, d
ld a, [$0600]
ld [$0006], sp
ld a, [$faf8]
inc h
nop
inc h
nop
ld hl, $c340
add hl, bc
ld [hl], $c2
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
and $01
ldh [$ff00 + $f1], a
ld de, $4391
call func_3c3b
ld hl, $c340
add hl, bc
ld [hl], $c1
xor a
ldh [$ff00 + $e8], a
ld e, a
call func_43d2
ldh a, [$ff00 + $e8]
add a, $02
and $07
jr nz, 0.l_43c3
ret
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
nop
add a, e
and $07
ld e, a
ld d, b
ld hl, $439b
add hl, de
ldh a, [$ff00 + $ee]
add a, [hl]
ldh [$ff00 + $ee], a
ld hl, $4399
add hl, de
ldh a, [$ff00 + $ec]
add a, [hl]
ldh [$ff00 + $ec], a
ld de, $43a3
call func_3cd0
call func_3dba
ret
ld a, [$00fc]
inc b
ld b, $04
nop
<error>
ld a, [$3efc]
nop
ld hl, $c340
add hl, bc
ld [hl], $c1
ldh a, [$ff00 + $e7]
rl a
rl a
and $10
ldh [$ff00 + $ed], a
ldh a, [$ff00 + $ee]
ldh [$ff00 + $e5], a
ldh a, [$ff00 + $ec]
ldh [$ff00 + $e6], a
xor a
ldh [$ff00 + $e8], a
ld e, a
call func_442b
ldh a, [$ff00 + $e8]
add a, $02
and $07
jr nz, 0.l_441c
ret
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
nop
add a, e
and $07
ld e, a
ld d, b
ld hl, $43fb
add hl, de
ldh a, [$ff00 + $e5]
add a, [hl]
ldh [$ff00 + $ee], a
ld hl, $43f9
add hl, de
ldh a, [$ff00 + $e6]
add a, [hl]
add a, $04
ldh [$ff00 + $ec], a
ld de, $4403
call func_3cd0
ret
jr c, 0.l_4463
jr c, 0.l_4485
and h
stop
rst 38
rst 38
jr c, 0.l_44ab
jr c, 0.l_44cd
rst 38
rst 38
and h
jr nc, 0.l_44a0
ld bc, $4dea
pop bc
ld de, $4451
call func_3c3b
call func_789f
call func_29c5
ldh a, [$ff00 + $e7]
and $03
jr nz, 0.l_4481
ld hl, $c3b0
add hl, bc
ld a, [hl]
inc a
and $03
ld [hl], a
ld a, $08
ld [$c19e], a
call func_3bf6
call func_790b
call func_3ba9
call func_44cf
ldh a, [$ff00 + $f0]
rst 0
sbc a, c
ld b, h
cp e
ld b, h
call func_0891
jr nz, 0.l_44a7
ld a, $08
call func_3c25
call func_3b8d
ret
ld hl, $c2a0
add hl, bc
ld a, [hl]
and a
jr z, 0.l_44ba
call func_0891
ld [hl], b
call func_45a6
ld a, $07
ldh [$ff00 + $f2], a
ret
ldh a, [$ff00 + $e7]
and $03
jr nz, 0.l_44c6
ld a, $20
call func_3c25
call func_3bbf
jr nc, 0.l_44ce
call func_79b4
ret
ld a, [$dba5]
and a
ret nz
ldh a, [$ff00 + $af]
cp $d3
jr z, 0.l_44dd
cp $5c
ret nz
ld hl, $c2a0
add hl, bc
ld [hl], b
ldh a, [$ff00 + $e9]
ld e, a
ld d, b
call func_20a6
ldh a, [$ff00 + $ce]
add a, $08
ldh [$ff00 + $d7], a
ldh a, [$ff00 + $cd]
add a, $10
ldh [$ff00 + $d8], a
ld a, $08
call func_0953
ld a, $13
ldh [$ff00 + $f4], a
ret
nop
nop
ld [$0020], sp
ld [$2006], sp
nop
nop
ld b, $00
nop
ld [$0008], sp
nop
inc b
inc b
ld b, b
rst 38
rst 38
rst 38
rst 38
nop
inc b
inc b
nop
rst 38
rst 38
rst 38
rst 38
nop
nop
<error>
inc b
ld bc, $0001
nop
ld hl, $c14d
inc [hl]
ldh a, [$ff00 + $f0]
and a
jr nz, 0.l_4565
ldh a, [$ff00 + $9e]
ld e, a
ld d, b
ld hl, $451f
add hl, de
ldh a, [$ff00 + $98]
add a, [hl]
ld hl, $c200
add hl, bc
ld [hl], a
ld hl, $4523
add hl, de
ldh a, [$ff00 + $99]
add a, [hl]
ld hl, $c210
add hl, bc
ld [hl], a
ld hl, $c240
add hl, bc
sla [hl]
ld hl, $c250
add hl, bc
sla [hl]
ld hl, $c420
add hl, bc
ld [hl], $ff
ld a, $3b
ldh [$ff00 + $f2], a
jp $3b8d
call func_45b6
call func_789f
ld a, $01
ld [$c19e], a
call func_3bf6
call func_790b
call func_3ba9
ld hl, $c2a0
add hl, bc
ld a, [hl]
and a
jr nz, 0.l_45a3
ldh a, [$ff00 + $e7]
inc a
and $03
jr nz, 0.l_45a2
ldh a, [$ff00 + $ee]
ldh [$ff00 + $d7], a
ldh a, [$ff00 + $ec]
ldh [$ff00 + $d8], a
ld a, $0d
call func_0953
ld hl, $c520
add hl, de
ld [hl], $08
ldh a, [$ff00 + $f1]
ld hl, $c590
add hl, de
ld [hl], a
ret
call func_79b4
ldh a, [$ff00 + $ee]
ldh [$ff00 + $d7], a
ldh a, [$ff00 + $ec]
add a, $03
ldh [$ff00 + $d8], a
ld a, $05
call func_0953
ret
ldh a, [$ff00 + $f1]
rl a
rl a
rl a
and $f8
ld e, a
ld d, b
ld hl, $44ff
add hl, de
ld c, $02
call func_3d26
ret
ld h, b
nop
ld h, d
nop
ld h, d
jr nz, 0.l_4630
jr nz, 0.l_4636
nop
ld h, [hl]
nop
ld h, [hl]
jr nz, 0.l_463c
jr nz, 0.l_4642
nop
ld l, d
nop
ld l, h
nop
ld l, [hl]
nop
ld l, d
jr nz, 0.l_464c
jr nz, 0.l_4654
jr nz, 0.l_4654
jr nz, 0.l_460b
ld b, b
jp .l_cb09
or $cb
cp $fa
ld c, $db
cp $0e
jp nz, $79b4
ld hl, $c200
add hl, bc
ld [hl], $50
ld de, $45c9
call func_3c3b
call func_7836
ldh a, [$ff00 + $e7]
and $3f
jr nz, 0.l_4616
call func_798d
ld hl, $c380
add hl, bc
ld [hl], e
call func_7804
ldh a, [$ff00 + $f0]
rst 0
inc h
ld b, [hl]
ld d, l
ld b, [hl]
dec b
ld b, a
xor c
ld b, [hl]
call func_789f
ld e, b
ldh a, [$ff00 + $99]
ld hl, $ffef
sub a, [hl]
add a, $26
cp $4c
call func_785d
ret nc
ld a, [$db7d]
cp $00
jr z, 0.l_4641
cp $0d
jr nz, 0.l_464a
ld a, $21
call func_218e
call func_3b8d
ret
ld a, $25
call func_218e
call func_3b8d
ld [hl], $03
ret
call func_789f
call func_3b8d
ld a, [$c177]
and a
jr nz, 0.l_469b
ld a, [$db00]
and a
jr z, 0.l_469b
cp $01
jr z, 0.l_46a2
cp $04
jr z, 0.l_46a2
cp $03
jr z, 0.l_46a2
cp $02
jr z, 0.l_46a2
cp $09
jr z, 0.l_46a2
cp $0c
jr z, 0.l_46a2
cp $05
jr z, 0.l_46a2
ld [$db7d], a
ld a, $0d
ld [$db00], a
ld hl, $c2b0
add hl, bc
ld [hl], a
call func_0891
ld [hl], $80
ld a, $10
ld [$d368], a
ret
ld [hl], b
ld a, $23
call func_218e
ret
ld [hl], b
ld a, $27
call func_218e
ret
call func_789f
call func_3b8d
ld [hl], $02
ld a, [$c177]
and a
jr nz, 0.l_46e2
ld hl, $db00
ld de, $0000
ld a, [hl]
cp $0d
jr z, 0.l_46c9
inc hl
inc e
ld a, e
cp $0c
jr nz, 0.l_46bd
ld a, [$db7d]
ld [hl], a
ld hl, $c2b0
add hl, bc
ld [hl], a
ld a, $0d
ld [$db7d], a
call func_0891
ld [hl], $80
ld a, $10
ld [$d368], a
ret
ld [hl], b
ld a, $23
call func_218e
ret
nop
stop
add a, h
stop
add a, b
stop
add a, d
stop
add a, [hl]
stop
adc a, b
stop
adc a, d
stop
adc a, h
stop
sbc a, b
stop
sub a, b
stop
sub a, d
stop
sub a, [hl]
stop
adc a, [hl]
stop
and h
stop
call func_0891
jr nz, 0.l_470f
call func_3b8d
ld [hl], b
ret
cp $08
jr nz, 0.l_4724
dec [hl]
ld hl, $c2b0
add hl, bc
ld a, [hl]
cp $0d
ld a, $24
jr z, 0.l_4721
ld a, $26
call func_218e
ldh a, [$ff00 + $98]
ldh [$ff00 + $ee], a
ldh a, [$ff00 + $99]
sub a, $0c
ldh [$ff00 + $ec], a
ldh a, [$ff00 + $a2]
ld hl, $c310
add hl, bc
ld [hl], a
ld a, $6c
ldh [$ff00 + $9d], a
ld a, $02
ldh [$ff00 + $a1], a
call func_093b
ld hl, $c2b0
add hl, bc
ld a, [hl]
ldh [$ff00 + $f1], a
ld de, $46e9
call func_3cd0
call func_3dba
ret
ld l, d
jr nz, 0.l_47bc
jr nz, 0.l_47c4
jr nz, 0.l_47c4
jr nz, 0.l_47c2
nop
ld l, d
nop
ld l, h
nop
ld l, [hl]
nop
ld h, h
nop
ld h, [hl]
nop
ld h, [hl]
jr nz, 0.l_47cc
jr nz, 0.l_47ca
nop
ld h, d
nop
ld h, d
jr nz, 0.l_47d0
jr nz, 0.l_4772
<error>
inc c
nop
inc c
<error>
ldh a, [$ff00 + $f7]
cp $1f
jp z, .l_45e9
ld de, $4751
call func_3c3b
call func_789f
call func_78c1
ld hl, $c430
add hl, bc
ld [hl], $48
call func_798d
ld hl, $c380
add hl, bc
ld a, [hl]
xor $01
cp e
jr nz, 0.l_47a3
ld hl, $c430
add hl, bc
ld [hl], $08
call func_3bb4
ld a, [$c133]
and a
jr nz, 0.l_47f5
ldh a, [$ff00 + $cb]
and $0f
jr z, 0.l_47f5
and $03
ld e, a
ld d, b
ld hl, $4771
add hl, de
ld a, [hl]
ld hl, $c240
add hl, bc
ld [hl], a
ldh a, [$ff00 + $cb]
rr a
rr a
and $03
ld e, a
ld d, b
ld hl, $4774
add hl, de
ld a, [hl]
ld hl, $c250
add hl, bc
ld [hl], a
call func_790b
call func_3b9e
ldh a, [$ff00 + $9e]
xor $01
ld hl, $c380
add hl, bc
ld [hl], a
rl a
and $06
ld e, a
ld hl, $c3d0
add hl, bc
inc [hl]
ld a, [hl]
rr a
rr a
rr a
rr a
and $01
or e
call func_3b87
ret
ld [bc], a
ld de, $30c0
inc d
ld [bc], a
ld de, $50c1
inc d
ld [bc], a
rrc a
push af
sub a, h
ld d, d
call func_789f
call func_0891
jr z, 0.l_4827
cp $01
jr nz, 0.l_481a
ld a, [$c11c]
ld [$d463], a
call func_484b
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
ld a, $04
ld [$c13b], a
ret
ld a, [$c11c]
cp $01
jr nz, 0.l_484a
ldh a, [$ff00 + $9c]
and a
jr z, 0.l_484a
call func_795e
add a, $0c
cp $18
jr nc, 0.l_484a
call func_796e
add a, $0c
cp $18
jr nc, 0.l_484a
call func_0891
ld [hl], $10
ret
ld de, $4800
ldh a, [$ff00 + $f6]
cp $ea
jr z, 0.l_4860
ld de, $47f6
ldh a, [$ff00 + $98]
cp $30
jr c, 0.l_4860
ld de, $47fb
ld hl, $d401
push bc
ld c, $05
ld a, [de]
inc de
ldi [hl], a
dec c
jr nz, 0.l_4866
pop bc
call func_79b4
ldh a, [$ff00 + $98]
swap a
and $0f
ld e, a
ldh a, [$ff00 + $99]
sub a, $08
and $f0
or e
ld [$d416], a
jp $090f
ld e, b
nop
ld e, d
nop
ld e, b
nop
ld e, h
nop
ld e, d
jr nz, 0.l_48e7
jr nz, 0.l_48ed
jr nz, 0.l_48eb
jr nz, 0.l_48b6
ld h, b
jp .l_3609
ld c, h
ld hl, $c380
add hl, bc
ld a, [hl]
and a
jr nz, 0.l_48a8
ldh a, [$ff00 + $f1]
add a, $02
ldh [$ff00 + $f1], a
ld de, $4884
call func_3c3b
call func_789f
call func_08e2
call func_7944
ld hl, $c320
add hl, bc
dec [hl]
dec [hl]
ld hl, $c310
add hl, bc
ld a, [hl]
and $80
ldh [$ff00 + $e8], a
jr z, 0.l_48ce
ld [hl], b
ld hl, $c320
add hl, bc
ld [hl], b
ld a, [$c3c8]
and a
jr z, 0.l_4901
ld hl, $c340
add hl, bc
set 6, [hl]
ld a, [$c50f]
ld e, a
ld d, b
ld hl, $c200
add hl, de
ldh a, [$ff00 + $ee]
ld e, $00
cp [hl]
jr c, 0.l_48eb
inc e
ld hl, $c380
add hl, bc
ld [hl], e
ldh a, [$ff00 + $e7]
and $3f
jr nz, 0.l_48fc
ld hl, $c320
add hl, bc
ld [hl], $0c
call func_49b7
jr 0.l_4904
call func_3beb
ld hl, $c420
add hl, bc
ld a, [hl]
and a
jr z, 0.l_491d
cp $08
jr nz, 0.l_491d
call func_3b8d
ld a, $02
ld [hl], a
ldh [$ff00 + $f0], a
call func_0891
ld [hl], $10
ldh a, [$ff00 + $f0]
cp $02
jr nc, 0.l_493a
call func_7852
jr nc, 0.l_493a
ld a, [$c3c8]
and a
ld a, $20
jr z, 0.l_4937
ld a, $96
call func_2185
jr 0.l_493a
call func_2197
ld a, [$c3c8]
and a
ret nz
ldh a, [$ff00 + $f0]
rst 0
ld d, d
ld c, c
sub a, l
ld c, c
jp nz, .l_e849
ld c, c
ld [bc], a
ld [$080c], sp
cp $f8
<error>
ldhl sp, d
xor a
call func_3b87
call func_0891
jr nz, 0.l_4992
call func_27ed
and $07
ld e, a
ld d, b
ld hl, $494a
add hl, de
ld a, [hl]
ld hl, $c240
add hl, bc
ld [hl], a
ld a, e
and $04
ld hl, $c380
add hl, bc
ld [hl], a
call func_27ed
and $07
ld e, a
ld hl, $494a
add hl, de
ld a, [hl]
ld hl, $c250
add hl, bc
ld [hl], a
call func_0891
call func_27ed
and $1f
add a, $30
ld [hl], a
call func_3b8d
jp $49b7
call func_790b
call func_3b9e
ldh a, [$ff00 + $e8]
and a
jr z, $649b7
call func_0891
jr nz, 0.l_49ac
ld [hl], $30
call func_3b8d
ld [hl], b
ret
ld hl, $c320
add hl, bc
ld [hl], $08
ld hl, $c310
add hl, bc
inc [hl]
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
and $01
call func_3b87
ret
call func_0891
jr nz, 0.l_49de
call func_3b8d
ld a, $24
call func_3c25
ld hl, $c320
add hl, bc
ld [hl], $18
call func_795e
ld hl, $c380
add hl, bc
ld a, e
ld [hl], a
ldh a, [$ff00 + $e7]
rr a
rr a
and $01
call func_3b87
ret
call func_790b
call func_3b9e
ld hl, $c340
add hl, bc
ld [hl], $52
call func_3bbf
ld hl, $c340
add hl, bc
ld [hl], $92
ldh a, [$ff00 + $e8]
and a
jr z, 0.l_4a0b
call func_3b8d
ld [hl], b
call func_0891
ld [hl], $20
ret
ld h, b
ld a, b
ld a, b
ld h, b
ld b, b
jr z, 0.l_4a3b
ld b, b
jr nz, 0.l_4a4e
ld e, b
ld a, b
ld a, b
ld e, b
jr c, 0.l_4a3c
ld hl, $c2b0
add hl, bc
ld a, [hl]
and a
jp nz, .l_4b22
ld a, c
ld [$d461], a
ldh a, [$ff00 + $f8]
and $10
jp nz, $79b4
ldh a, [$ff00 + $f0]
rst 0
dec a
ld c, d
ld e, a
ld c, d
ld l, a
ld c, d
sub a, e
ld c, d
jp .l_fa4a
ld c, c
<error>
and $04
ret z
ld a, [$db4a]
cp $00
ret nz
ld a, [$c166]
cp $01
ret nz
call func_27d2
call func_0891
ld [hl], $30
xor a
ld [$c5a3], a
call func_3b8d
ret
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
call func_0891
jr nz, 0.l_4a6e
call func_3b8d
ret
ld a, $02
ldh [$ff00 + $a1], a
call func_0891
ret nz
ld hl, $c3d0
add hl, bc
ld a, [hl]
inc [hl]
cp $08
jr nz, 0.l_4a8a
ld [hl], b
call func_0891
ld [hl], $40
jp $3b8d
call func_4ac4
call func_0891
ld [hl], $20
ret
ld a, $02
ldh [$ff00 + $a1], a
call func_0891
jr nz, 0.l_4ac2
ld e, $41
ld hl, $db67
ldi a, [hl]
and $02
jr z, 0.l_4aac
inc e
ld a, e
cp $47
jr nz, 0.l_4aa1
ld a, e
ld [$d368], a
ld [$d465], a
ld a, $ff
ld [$c166], a
xor a
ld [$d210], a
ld [$d211], a
call func_3b8d
ret
ret
ldh [$ff00 + $e8], a
ld e, a
ld d, b
ld hl, $db65
add hl, de
ld a, [hl]
and $02
jr z, 0.l_4b01
ld a, $de
call func_3c01
ret c
ld a, $2b
ldh [$ff00 + $f4], a
push bc
ldh a, [$ff00 + $e8]
ld c, a
ld hl, $4a0c
add hl, bc
ld a, [hl]
ld hl, $c200
add hl, de
add a, $08
ld [hl], a
ld hl, $4a14
add hl, bc
ld a, [hl]
ld hl, $c210
add hl, de
ld [hl], a
ld a, c
ld hl, $c3b0
add hl, de
ld [hl], a
ld hl, $c2b0
add hl, de
inc [hl]
pop bc
ret
ld d, b
nop
ld d, d
nop
ld d, h
nop
ld d, [hl]
nop
ld e, b
nop
ld e, d
nop
ld e, h
nop
ld e, [hl]
nop
ld h, b
nop
ld h, d
nop
ld h, h
nop
ld h, [hl]
nop
ld l, b
nop
ld l, d
nop
ld l, h
nop
ld l, [hl]
nop
cp $02
jp z, .l_4bf8
ldh a, [$ff00 + $f0]
and a
jr nz, 0.l_4b71
ld a, [$c5a3]
cp $03
jr z, 0.l_4b46
ld hl, $fff1
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
xor [hl]
and $03
ret z
ld de, $4b02
call func_3c3b
ret
ldh a, [$ff00 + $f1]
cp $07
jp nz, $79b4
ld e, $08
ld hl, $db65
ldi a, [hl]
and $02
jr z, 0.l_4b6a
dec e
jr nz, 0.l_4b52
ldh a, [$ff00 + $f8]
and $10
jp nz, $79b4
call func_0891
ld [hl], $a0
call func_3b8d
ret
xor a
ld [$c5a3], a
jp $79b4
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
call func_0891
jr nz, 0.l_4be3
ld [$c155], a
ld [$c5a3], a
ld a, $c1
ld [$d736], a
ld a, $cb
ld [$d746], a
ld a, $50
ldh [$ff00 + $ce], a
ld a, $20
ldh [$ff00 + $cd], a
call func_2839
ld hl, $d601
ld a, [$d600]
ld e, a
add a, $07
ld [$d600], a
ld d, $00
add hl, de
ldh a, [$ff00 + $cf]
ldi [hl], a
ldh a, [$ff00 + $d0]
ldi [hl], a
ld a, $83
ldi [hl], a
ld a, $7f
ldi [hl], a
ld a, $0f
ldi [hl], a
ld a, $7e
ldi [hl], a
ld a, $1f
ldi [hl], a
ldh a, [$ff00 + $cf]
ldi [hl], a
ldh a, [$ff00 + $d0]
inc a
ldi [hl], a
ld a, $83
ldi [hl], a
ld a, $7f
ldi [hl], a
ld a, $0f
ldi [hl], a
ld a, $7e
ldi [hl], a
ld a, $1f
ldi [hl], a
ld [hl], b
call func_27d2
ld a, $23
ldh [$ff00 + $f2], a
call func_4c3e
call func_08d7
jp $79b4
ld e, $01
and $04
jr z, 0.l_4beb
ld e, $ff
ld a, e
ld [$c155], a
ret
ld d, $00
ld d, $20
ld d, $60
ld d, $40
ld de, $4bf0
call func_3cd0
call func_790b
ld hl, $c250
add hl, bc
inc [hl]
call func_0891
ld [$c167], a
jr z, 0.l_4c13
ld a, $02
ldh [$ff00 + $a1], a
ret
ld hl, $d806
set 4, [hl]
ld a, [hl]
ldh [$ff00 + $f8], a
jp $79b4
nop
inc b
ld [$0800], sp
nop
inc b
ld [$0000], sp
nop
inc b
inc b
ld [$0808], sp
ldh a, [$ff00 + $fc]
stop
ldh a, [$ff00 + $10]
ldh a, [$ff00 + $04]
stop
ldh a, [$ff00 + $e8]
ldh a, [$ff00 + $f8]
ldhl sp, d
ld [$080c], sp
xor a
ldh [$ff00 + $e8], a
ld a, $de
call func_3c01
ret c
ld hl, $c2b0
add hl, de
ld [hl], $02
call func_27ed
and $1f
add a, $30
ld hl, $c2e0
add hl, de
ld [hl], a
push bc
ldh a, [$ff00 + $e8]
ld c, a
ld hl, $4c1e
add hl, bc
ld a, [hl]
ld hl, $c200
add hl, de
add a, $54
ld [hl], a
ld hl, $4c26
add hl, bc
ld a, [hl]
ld hl, $c210
add hl, de
add a, $3c
ld [hl], a
ld hl, $4c2e
add hl, bc
ld a, [hl]
ld hl, $c240
add hl, de
ld [hl], a
ld hl, $4c36
add hl, bc
ld a, [hl]
ld hl, $c250
add hl, de
sub a, $08
ld [hl], a
pop bc
ldh a, [$ff00 + $e8]
inc a
cp $08
jr nz, 0.l_4c3f
ret
ld e, b
nop
ld e, d
nop
ld e, d
jr nz, 0.l_4c8b
pop af
and a
jr z, 0.l_4ca7
ld de, $4c92
call func_3c3b
jr 0.l_4cad
ld de, $4c94
call func_3cd0
call func_789f
ldh a, [$ff00 + $f0]
rst 0
cp a
ld c, h
ld bc, $024d
inc b
ld b, $00
ld a, [bc]
ld [$0d0c], sp
ld a, [$db95]
cp $07
jr z, 0.l_4cca
xor a
ld [$c5a2], a
xor a
call func_3b87
call func_7852
ret nc
ld e, $00
ldh a, [$ff00 + $ee]
cp $20
jr c, 0.l_4ce5
inc e
cp $40
jr c, 0.l_4ce5
inc e
cp $70
jr c, 0.l_4ce5
inc e
ldh a, [$ff00 + $ef]
cp $40
jr c, 0.l_4cef
ld a, e
add a, $04
ld e, a
ld d, b
ld hl, $4cb7
add hl, de
ld a, [hl]
ld hl, $c2b0
add hl, bc
ld [hl], a
call func_218e
call func_3b8d
ret
ld a, $01
call func_3b87
ld a, [$c19f]
and a
ret nz
call func_3b8d
ld [hl], b
ld a, [$c177]
and a
jr nz, 0.l_4d64
ld hl, $c2b0
add hl, bc
ld a, [hl]
inc a
ld e, a
cp $0e
jr nz, 0.l_4d46
ld a, [$db0e]
cp $0e
jr nz, 0.l_4d46
ldh a, [$ff00 + $f8]
and $20
jr nz, 0.l_4d3b
call func_7a66
call func_27ed
rl a
rl a
rl a
and $18
ld [$db7c], a
ld a, [$db7c]
rr a
rr a
rr a
and $03
add a, $17
ld e, a
ld a, e
cp $0d
jr nz, 0.l_4d60
xor a
ld [$c16b], a
ld [$c16c], a
ld [$db96], a
ld a, $07
ld [$db95], a
ld a, $01
ld [$c5a2], a
ret
call func_218e
ret
xor a
jp $3b87
ldh a, [$ff00 + $f8]
and $20
jp nz, $79b4
ld hl, $c2b0
add hl, bc
ld a, [hl]
and a
jp nz, .l_4f00
ldh a, [$ff00 + $f0]
rst 0
adc a, c
ld c, l
call func_d74d
ld c, l
ld de, $424e
ld c, [hl]
ld h, b
nop
ld h, d
nop
ld a, c
ld [$d201], a
ld hl, $c200
add hl, bc
ld [hl], $50
call func_4dcd
ld a, [$db49]
and $01
ret z
ld a, [$c166]
cp $01
ret nz
ld a, [$db4a]
cp $02
ret nz
ld a, $dc
call func_3c01
ld hl, $c200
add hl, de
ld [hl], $94
ld hl, $c210
add hl, de
ld [hl], $d8
ld hl, $c2b0
add hl, de
inc [hl]
ld hl, $c340
add hl, de
ld [hl], $c1
ld a, $55
ld [$d368], a
jp $3b8d
ret
ld de, $4d85
call func_3c3b
call func_7804
ret
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
call func_4dcd
call func_0891
jr nz, 0.l_4e04
ld [hl], $a0
call func_3b8d
ld a, $02
call func_3c01
ld hl, $c200
add hl, de
ldh a, [$ff00 + $d7]
ld [hl], a
ld hl, $c210
add hl, de
ldh a, [$ff00 + $d8]
ld [hl], a
ld hl, $c2e0
add hl, de
ld [hl], $20
ret
ldh a, [$ff00 + $00]
ld h, h
nop
nop
nop
ld h, [hl]
nop
nop
ld [$0068], sp
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
ld hl, $4e05
ld c, $03
call func_3d26
call func_0891
jp z, .l_4e30
cp $70
jr nz, 0.l_4e2f
ld a, $10
ld [$d368], a
ret
ldh a, [$ff00 + $99]
push af
ld a, $10
ldh [$ff00 + $99], a
ld a, $6d
call func_2185
pop af
ldh [$ff00 + $99], a
jp $3b8d
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
ld hl, $4e05
ld c, $03
call func_3d26
ld a, [$c19f]
and a
jr nz, 0.l_4e79
ld a, $d5
call func_3c01
ldh a, [$ff00 + $d7]
ld hl, $c200
add hl, de
ld [hl], a
ldh a, [$ff00 + $d8]
ld hl, $c210
add hl, de
ld [hl], a
ld a, $01
ld [$db7b], a
xor a
ld [$c167], a
call func_7a66
jp $79b4
ret
ld l, d
nop
ld l, h
nop
ld l, [hl]
nop
ld [bc], a
ld [bc], a
ld bc, $0401
inc b
inc b
inc b
inc b
inc b
inc b
inc b
dec b
ld b, $07
ld [$0607], sp
dec b
inc b
inc b
inc b
inc bc
ld [bc], a
ld bc, $0100
ld [bc], a
inc bc
inc b
dec b
ld b, $07
ld [$0808], sp
add hl, bc
ld a, [bc]
dec bc
inc c
inc c
inc c
dec bc
ld a, [bc]
add hl, bc
ld [$0607], sp
dec b
inc b
dec b
ld b, $07
ld [$0a09], sp
dec bc
dec bc
ld a, [bc]
add hl, bc
ld [$0607], sp
dec b
inc b
inc bc
ld [bc], a
ld bc, $0100
ld [bc], a
inc bc
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
nop
inc bc
ld b, $07
ld [$0607], sp
inc bc
nop
<error>
ld a, [$f8f9]
ld sp, hl
ld a, [$00fd]
inc bc
ld b, $07
ldh a, [$ff00 + $e7]
rl a
rl a
and $10
ldh [$ff00 + $ed], a
ld de, $4e7a
call func_3cd0
call func_789f
call func_0891
jr z, 0.l_4f2a
cp $01
jp z, $79b4
rr a
rr a
rr a
and $03
ld e, a
ld d, b
ld hl, $4e80
add hl, de
ld a, [hl]
jp $3b87
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
ld hl, $c3d0
add hl, bc
ld a, [hl]
inc a
ld [hl], a
and $07
jr nz, 0.l_4f5f
ld hl, $c2c0
add hl, bc
inc [hl]
ld a, [hl]
cp $49
jr nz, 0.l_4f5f
ld a, [$d201]
ld e, a
ld d, b
ld hl, $c290
add hl, de
inc [hl]
ld hl, $c420
add hl, de
ld [hl], $40
ld hl, $c2e0
add hl, de
ld [hl], $80
jp $79b4
ld hl, $c2c0
add hl, bc
ld e, [hl]
ld d, b
ld hl, $4e84
add hl, de
ld e, [hl]
ld hl, $4ef0
add hl, de
ld a, [hl]
ld hl, $c240
add hl, bc
ld [hl], a
ld hl, $4eec
add hl, de
ld a, [hl]
ld hl, $c250
add hl, bc
ld [hl], a
call func_790b
ld hl, $c3d0
add hl, bc
ld a, [hl]
and $07
jr nz, 0.l_4faa
ld a, $dc
call func_3c01
ret c
ldh a, [$ff00 + $d7]
ld hl, $c200
add hl, de
ld [hl], a
ldh a, [$ff00 + $d8]
ld hl, $c210
add hl, de
ld [hl], a
ld hl, $c2b0
add hl, de
ld [hl], $01
ld hl, $c2e0
add hl, de
ld [hl], $1f
ret
ld h, b
nop
ld h, d
nop
ld h, h
nop
ld h, [hl]
nop
ld h, d
jr nz, 0.l_5016
jr nz, 0.l_501e
jr nz, 0.l_501e
jr nz, 0.l_5024
nop
ld l, d
nop
ld l, h
nop
ld l, [hl]
nop
ld l, d
jr nz, 0.l_502e
jr nz, 0.l_5036
jr nz, 0.l_5036
jr nz, 0.l_503c
nop
ld [hl], d
nop
ld [hl], h
nop
halt
nop
ld [hl], d
jr nz, 0.l_5046
jr nz, 0.l_504e
jr nz, 0.l_504e
jr nz, 0.l_4fce
ld c, $21
ld b, b
jp .l_3609
jp nc, .l_ab11
ld c, a
call func_3c3b
ld hl, $c2d0
add hl, bc
ld a, [hl]
and a
jr nz, 0.l_4ff7
inc [hl]
ld a, $57
ld [$d368], a
ld a, [$db6b]
and a
jp nz, .l_5090
call func_789f
call func_7804
ldh a, [$ff00 + $e7]
and $7f
jr nz, 0.l_5014
call func_27ed
and $02
ld hl, $c380
add hl, bc
ld [hl], a
ldh a, [$ff00 + $e7]
ld e, $00
and $30
jr z, 0.l_501d
inc e
ld hl, $c380
add hl, bc
ld a, e
add a, [hl]
call func_3b87
ldh a, [$ff00 + $e7]
and $3f
cp $0f
jr nz, 0.l_505d
ld a, $08
call func_3c01
jr c, 0.l_505c
push bc
ld hl, $c380
add hl, bc
ld c, [hl]
srl c
ld hl, $4fdb
add hl, bc
ldh a, [$ff00 + $d7]
add a, [hl]
ld hl, $c200
add hl, de
ld [hl], a
ldh a, [$ff00 + $d8]
ld hl, $c210
add hl, de
ld [hl], a
ld hl, $c2e0
add hl, de
ld [hl], $17
ld hl, $c440
add hl, de
inc [hl]
pop bc
ret
call func_7852
jr nc, 0.l_506f
ld a, [$db7b]
and a
ld a, $8b
jr z, 0.l_506c
ld a, $8c
call func_2185
ret
stop
ld de, $1312
inc de
ld [de], a
ld de, $0010
add hl, bc
ld [bc], a
add hl, bc
nop
rst 30
cp $f7
inc c
add hl, bc
ld a, [bc]
rst 30
<error>
rst 30
or $09
inc bc
ld bc, $0000
nop
nop
ld bc, $f003
ldh a, [$ff00 + $a7]
jr nz, 0.l_509e
ld hl, $c210
add hl, bc
ld [hl], $50
call func_3b8d
ld e, $00
ld hl, $c240
add hl, bc
ld a, [hl]
and $80
jr nz, 0.l_50ab
ld e, $02
ld hl, $c380
add hl, bc
ld [hl], e
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
and $07
ld e, a
ld d, b
ld hl, $5070
add hl, de
ld a, [hl]
sub a, $03
ld hl, $c310
add hl, bc
ld [hl], a
ld hl, $c380
add hl, bc
ldh a, [$ff00 + $e7]
and $20
ld a, $04
jr nz, 0.l_50d3
ld a, $05
add a, [hl]
call func_3b87
ldh a, [$ff00 + $ec]
sub a, $10
ldh [$ff00 + $ec], a
ld hl, $c380
add hl, bc
ldh a, [$ff00 + $e7]
rr a
rr a
and $01
add a, [hl]
ldh [$ff00 + $f1], a
ld hl, $c340
add hl, bc
res 4, [hl]
ld de, $4fcb
call func_3c3b
call func_3dba
call func_789f
ldh a, [$ff00 + $e7]
and $3f
jr nz, 0.l_5124
call func_27ed
and $01
jr nz, 0.l_5124
call func_27ed
and $07
ld e, a
ld d, b
ld hl, $5080
add hl, de
ld a, [hl]
ld hl, $c240
add hl, bc
ld [hl], a
ld hl, $5078
add hl, de
ld a, [hl]
ld hl, $c250
add hl, bc
ld [hl], a
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
nop
nop
and $07
ld e, a
ld d, b
ld hl, $5088
add hl, de
ldh a, [$ff00 + $e7]
and [hl]
call z, func_790b
call func_3b9e
ld hl, $c2a0
add hl, bc
ld a, [hl]
and $03
jr z, 0.l_514d
ld hl, $c240
add hl, bc
ld a, [hl]
cpl
inc a
ld [hl], a
ld hl, $c2a0
add hl, bc
ld a, [hl]
and $0c
jr z, 0.l_515e
ld hl, $c250
add hl, bc
ld a, [hl]
cpl
inc a
ld [hl], a
call func_795e
add a, $12
cp $24
ret nc
call func_796e
add a, $10
cp $20
ret nc
call func_0891
ret nz
ld [hl], $80
ld a, $8d
call func_2185
ret
ldh a, [$ff00 + $00]
ld a, b
nop
ldh a, [$ff00 + $08]
ld a, d
nop
nop
nop
ld a, h
nop
nop
ld [$007e], sp
ld a, [$dba5]
and a
jr z, 0.l_519f
ldh a, [$ff00 + $f6]
cp $e4
jp z, .l_4d68
cp $f4
jp z, .l_4d68
jp .l_4fdd
ldh a, [$ff00 + $f8]
and $20
jp nz, $79b4
ldh a, [$ff00 + $f0]
rst 0
xor l
ld d, c
ld b, d
ld d, d
call func_789f
ld a, [$db43]
cp $02
ret c
call func_795e
add a, $08
cp $10
jr nc, 0.l_523c
call func_796e
add a, $10
cp $20
jr nc, 0.l_523c
ld a, [$c133]
and a
jr z, 0.l_523c
ldh a, [$ff00 + $9e]
cp $02
jr nz, 0.l_523c
ld hl, $c3d0
add hl, bc
ld a, [hl]
inc a
ld [hl], a
cp $18
ret nz
call func_0891
ld [hl], $40
ld hl, $d746
ld [hl], $0c
ld hl, $d756
ld [hl], $c6
ld a, $50
ldh [$ff00 + $ce], a
ld a, $30
ldh [$ff00 + $cd], a
call func_2839
ld hl, $d601
ld a, [$d600]
ld e, a
add a, $0e
ld [$d600], a
ld d, $00
add hl, de
ldh a, [$ff00 + $cf]
ldi [hl], a
ldh a, [$ff00 + $d0]
ldi [hl], a
ld a, $83
ldi [hl], a
ld a, $0f
ldi [hl], a
ld a, $0f
ldi [hl], a
ld a, $68
ldi [hl], a
ld a, $77
ldi [hl], a
ldh a, [$ff00 + $cf]
ldi [hl], a
ldh a, [$ff00 + $d0]
inc a
ldi [hl], a
ld a, $83
ldi [hl], a
ld a, $0f
ldi [hl], a
ld a, $0f
ldi [hl], a
ld a, $69
ldi [hl], a
ld a, $4b
ldi [hl], a
ld [hl], b
ld a, $11
ldh [$ff00 + $f4], a
call func_3b8d
jr 0.l_5242
ld hl, $c3d0
add hl, bc
ld [hl], b
ret
call func_789f
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
ld hl, $517a
ld c, $04
call func_3d26
call func_0891
jr nz, 0.l_52b6
ld [$c167], a
ld hl, $d736
ld [hl], $91
ld hl, $d746
ld [hl], $5e
ld a, $50
ldh [$ff00 + $ce], a
ld a, $20
ldh [$ff00 + $cd], a
call func_2839
ld hl, $d601
ld a, [$d600]
ld e, a
add a, $0e
ld [$d600], a
ld d, $00
add hl, de
ldh a, [$ff00 + $cf]
ldi [hl], a
ldh a, [$ff00 + $d0]
ldi [hl], a
ld a, $83
ldi [hl], a
ld a, $00
ldi [hl], a
ld a, $10
ldi [hl], a
ld a, $02
ldi [hl], a
ld a, $12
ldi [hl], a
ldh a, [$ff00 + $cf]
ldi [hl], a
ldh a, [$ff00 + $d0]
inc a
ldi [hl], a
ld a, $83
ldi [hl], a
ld a, $6c
ldi [hl], a
ld a, $6d
ldi [hl], a
ld a, $03
ldi [hl], a
ld a, $13
ldi [hl], a
ld [hl], b
ld a, $23
ldh [$ff00 + $f2], a
call func_7a66
jp $79b4
ld hl, $c250
add hl, bc
ld [hl], $fc
call func_790e
ret
ldhl sp, d
ldhl sp, d
ld h, b
nop
ldhl sp, d
nop
ld h, d
nop
ldhl sp, d
ld [$2062], sp
ldhl sp, d
stop
ld h, b
jr nz, 0.l_52d9
ldhl sp, d
ld h, b
ld b, b
ld [$6200], sp
ld b, b
ld [$6208], sp
ld h, b
ld [$6010], sp
ld h, b
nop
inc b
ld [$f004], sp
rst 20
rl a
rl a
and $10
ldh [$ff00 + $ed], a
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
rr a
and $03
ld e, a
ld d, b
ld hl, $52e0
add hl, de
ld a, [hl]
ldh [$ff00 + $f5], a
ld hl, $52c0
ld c, $08
call func_3d26
call func_789f
call func_3bbf
call func_790b
call func_3b9e
ld hl, $c2a0
add hl, bc
ld a, [hl]
and $03
jr z, 0.l_5322
ld hl, $c240
add hl, bc
ld a, [hl]
cpl
inc a
ld [hl], a
ld hl, $c2a0
add hl, bc
ld a, [hl]
and $0c
jr z, 0.l_5333
ld hl, $c250
add hl, bc
ld a, [hl]
cpl
inc a
ld [hl], a
ret
ld a, d
ld b, b
ld a, d
ld h, b
ld a, d
ld d, b
ld a, d
ld [hl], b
ld a, d
nop
ld a, d
jr nz, 0.l_53bb
stop
ld a, d
jr nc, 0.l_5366
or b
jp nz, .l_7e09
and a
jp nz, .l_5451
ldh a, [$ff00 + $f0]
rst 0
ld d, [hl]
ld d, e
ld l, d
ld d, e
jp .l_cd53
sub a, c
ld [$edcd], sp
daa
and $3f
add a, $30
ld [hl], a
jp $3b8d
rst 38
ld bc, $03fd
<error>
<error>
call func_0891
jr nz, 0.l_53c2
ld a, [$c5a1]
cp $02
ret nc
ld hl, $c250
add hl, bc
ld [hl], $d0
call func_3b8d
ld a, $01
ldh [$ff00 + $e9], a
ld a, $da
call func_3c01
ret c
ldh a, [$ff00 + $d8]
ld hl, $c210
add hl, de
ld [hl], a
ld hl, $c2b0
add hl, de
ld [hl], $02
push bc
ldh a, [$ff00 + $e9]
ld c, a
ld hl, $5364
add hl, bc
ldh a, [$ff00 + $d7]
add a, [hl]
ld hl, $c200
add hl, de
ld [hl], a
ld hl, $5366
add hl, bc
ld a, [hl]
ld hl, $c240
add hl, de
ld [hl], a
ld hl, $5368
add hl, bc
ld a, [hl]
ld hl, $c250
add hl, de
ld [hl], a
pop bc
ldh a, [$ff00 + $e9]
dec a
cp $ff
jr nz, 0.l_5380
ret
ret
ld hl, $c5a0
inc [hl]
ld de, $5334
call func_3c3b
call func_789f
call func_3bbf
call func_790e
ld hl, $c250
add hl, bc
inc [hl]
ld e, $00
ld a, [hl]
and $80
jr nz, 0.l_53e4
ld e, $02
ldh a, [$ff00 + $e7]
rr a
rr a
and $01
add a, e
call func_3b87
ld hl, $c210
add hl, bc
ld a, [hl]
cp $70
jr c, 0.l_5400
ld [hl], $70
call func_3b8d
ld [hl], b
call func_537e
ldh a, [$ff00 + $e7]
xor c
and $0f
ret nz
ld a, $da
call func_3c01
ret c
ldh a, [$ff00 + $d7]
ld hl, $c200
add hl, de
ld [hl], a
ldh a, [$ff00 + $d8]
ld hl, $c210
add hl, de
ld [hl], a
ld hl, $c2e0
add hl, de
ld [hl], $18
ld hl, $c2b0
add hl, de
ld [hl], $01
ldh a, [$ff00 + $f1]
rl a
and $04
ld hl, $c3b0
add hl, de
ld [hl], a
ret
ld a, h
ld b, b
ld a, h
ld h, b
ld a, h
ld d, b
ld a, h
ld [hl], b
ld a, [hl]
ld b, b
ld a, [hl]
ld h, b
ld a, [hl]
ld d, b
ld a, [hl]
ld [hl], b
ld a, h
nop
ld a, h
jr nz, 0.l_54c2
stop
ld a, h
jr nc, 0.l_54c8
nop
ld a, [hl]
jr nz, 0.l_54cc
stop
ld a, [hl]
jr nc, 0.l_5450
ld [bc], a
jr z, 0.l_5481
ldh a, [$ff00 + $e7]
xor c
rr a
jr c, 0.l_546d
ldh a, [$ff00 + $e7]
rr a
rr a
and $01
ld e, a
ldh a, [$ff00 + $f1]
add a, e
ldh [$ff00 + $f1], a
ld de, $5431
call func_3c3b
call func_789f
call func_0891
jp z, $79b4
cp $08
jr nz, 0.l_5480
ld hl, $c3b0
add hl, bc
inc [hl]
inc [hl]
ret
ld de, $5449
call func_3c3b
ldh a, [$ff00 + $e7]
rr a
rr a
and $01
call func_3b87
call func_790b
ld hl, $c250
add hl, bc
inc [hl]
ld a, [hl]
cp $10
jr nz, 0.l_54a0
call func_79b4
ret
nop
nop
ld d, b
nop
nop
ld [$0052], sp
nop
stop
ld d, d
jr nz, 0.l_54ae
jr 0.l_5500
jr nz, 0.l_54c2
nop
ld d, h
nop
stop
ld [$0056], sp
stop
stop
ld d, [hl]
jr nz, 0.l_54ce
jr 0.l_5514
jr nz, 0.l_54b2
pop af
and a
ld a, $00
jr z, 0.l_54ca
ld a, $08
ldh [$ff00 + $f5], a
ld hl, $54a1
ld c, $08
call func_3d26
call func_789f
call func_08e2
ldh a, [$ff00 + $f0]
rst 0
<error>
ld d, h
dec bc
ld d, l
ld h, l
ld d, l
call func_7804
ret nc
and a
ret z
call func_093b
ldh a, [$ff00 + $9a]
cpl
inc a
sra a
sra a
ldh [$ff00 + $9a], a
ld a, $e8
ldh [$ff00 + $9b], a
call func_0891
ld [hl], $20
ld a, $01
call func_3b87
ld a, $0b
ldh [$ff00 + $f2], a
jp $3b8d
call func_0891
cp $01
jr nz, 0.l_5517
ld hl, $fff2
ld [hl], $08
and a
ret nz
call func_790e
ld hl, $c250
add hl, bc
ld a, [hl]
cp $70
jr nc, 0.l_5528
add a, $03
ld [hl], a
ld hl, $c210
add hl, bc
ld a, [hl]
add a, $10
ld [hl], a
ldh a, [$ff00 + $ef]
add a, $10
ldh [$ff00 + $ef], a
call func_3b9e
ld hl, $c210
add hl, bc
ld a, [hl]
sub a, $10
ld [hl], a
ldh a, [$ff00 + $ef]
sub a, $10
ldh [$ff00 + $ef], a
ld hl, $c2a0
add hl, bc
ld a, [hl]
and a
jr z, 0.l_5564
call func_08d7
call func_0891
ld [hl], $30
ld a, $30
ld [$c157], a
ld a, $04
ld [$c158], a
call func_3b8d
ret
call func_57dc
ret
nop
nop
ld bc, $0101
ld [bc], a
ld [bc], a
ld [bc], a
nop
nop
rrc a
rrc a
rrc a
ld c, $0e
ld c, $08
ld [$0707], sp
rlc a
ld b, $06
ld b, $08
ld [$0909], sp
add hl, bc
ld a, [bc]
ld a, [bc]
ld a, [bc]
inc b
inc b
inc bc
inc bc
inc bc
ld [bc], a
ld [bc], a
ld [bc], a
inc c
inc c
dec c
dec c
dec c
ld c, $0e
ld c, $04
inc b
dec b
dec b
dec b
ld b, $06
ld b, $0c
inc c
dec bc
dec bc
dec bc
ld a, [bc]
ld a, [bc]
ld a, [bc]
ldh a, [$ff00 + $d7]
rlc a
and $01
ld e, a
ldh a, [$ff00 + $d8]
rlc a
rl a
and $02
or e
rl a
rl a
rl a
and $18
ld h, a
ldh a, [$ff00 + $d8]
bit 7, a
jr z, 0.l_55c4
cpl
inc a
ld d, a
ldh a, [$ff00 + $d7]
bit 7, a
jr z, 0.l_55cd
cpl
inc a
cp d
jr nc, 0.l_55dd
sra a
sra a
add a, h
ld e, a
ld d, b
ld hl, $5569
add hl, de
ld a, [hl]
ret
ld a, d
sra a
sra a
add a, h
ld e, a
ld d, b
ld hl, $5589
add hl, de
ld a, [hl]
ret
ld e, d
nop
ld e, d
jr nz, 0.l_5648
nop
ld e, b
jr nz, 0.l_5605
<error>
ld d, l
call func_3c3b
call func_789f
call func_08e2
call func_3bb4
xor a
call func_3b87
ldh a, [$ff00 + $f0]
rst 0
ld de, $1b56
ld d, [hl]
ld b, c
ld d, [hl]
ld a, e
ld d, [hl]
ldh a, [$ff00 + $ec]
ld hl, $c2b0
add hl, bc
ld [hl], a
call func_3b8d
call func_0891
ret nz
call func_795e
ld e, a
add a, $28
cp $50
jr nc, 0.l_5640
ld a, $01
call func_3b87
ld a, e
add a, $18
cp $30
jr nc, 0.l_5640
call func_3daf
call func_0891
ld [hl], $08
call func_3b8d
ret
ld a, $01
call func_3b87
call func_0891
cp $01
jr nz, 0.l_5652
ld hl, $fff2
ld [hl], $08
and a
ret nz
call func_790e
ld hl, $c250
add hl, bc
ld a, [hl]
cp $70
jr nc, 0.l_5663
add a, $03
ld [hl], a
call func_3b9e
ld hl, $c2a0
add hl, bc
ld a, [hl]
and a
jr z, 0.l_567a
ld a, $09
ldh [$ff00 + $f2], a
call func_0891
ld [hl], $30
call func_3b8d
ret
call func_0891
ret nz
ld hl, $c2b0
add hl, bc
ldh a, [$ff00 + $ec]
cp [hl]
jr nz, 0.l_5692
call func_3b8d
ld [hl], b
call func_0891
ld [hl], $20
ret
ld hl, $c250
add hl, bc
ld [hl], $f8
call func_790e
ret
nop
nop
ld [hl], b
nop
nop
ld [$0072], sp
nop
stop
ld [hl], d
jr nz, 0.l_56a9
jr 0.l_571b
jr nz, 0.l_56bd
nop
ld [hl], h
nop
stop
ld [$0076], sp
stop
stop
halt
jr nz, 0.l_56c9
jr 0.l_572f
jr nz, 0.l_56bc
nop
rst 38
nop
ld l, [hl]
nop
ld a, [hl]
nop
ld a, d
nop
ld a, d
jr nz, 0.l_5747
jr nz, 0.l_5739
jr nz, 0.l_574b
jr nz, 0.l_574b
jr nz, 0.l_574f
jr nz, 0.l_573f
jr nz, 0.l_574d
nop
ld a, b
jr nz, 0.l_5745
nop
ld a, [hl]
nop
ld a, h
nop
ld a, [hl]
nop
inc b
dec b
ld b, $07
ld [$0201], sp
inc bc
ldh a, [$ff00 + $ec]
add a, $08
ldh [$ff00 + $ec], a
ldh a, [$ff00 + $ee]
add a, $08
ldh [$ff00 + $ee], a
ld de, $56bc
call func_3c3b
call func_3dba
ld hl, $569c
ld c, $08
call func_3d26
ld a, $06
call func_3dd0
call func_789f
call func_08e2
call func_3beb
call func_57dc
ldh a, [$ff00 + $f0]
rst 0
ld hl, $2b57
ld d, a
ld l, [hl]
ld d, a
cp d
ld d, a
ldh a, [$ff00 + $ec]
ld hl, $c2b0
add hl, bc
ld [hl], a
call func_3b8d
call func_0891
ret nz
call func_795e
add a, $f8
ld e, a
add a, $28
cp $50
jr nc, 0.l_5752
ld a, e
add a, $18
cp $30
jr nc, 0.l_5752
call func_3daf
ld a, $08
ldh [$ff00 + $f2], a
ld a, $00
call func_3b87
call func_3b8d
ret
ldh a, [$ff00 + $e7]
and $07
jr nz, 0.l_576d
ld a, $1f
call func_3c30
call func_55a9
rr a
and $07
ld e, a
ld d, b
ld hl, $56e0
add hl, de
ld a, [hl]
call func_3b87
ret
call func_790e
ld hl, $c250
add hl, bc
ld a, [hl]
cp $70
jr nc, 0.l_577d
add a, $03
ld [hl], a
ld hl, $c210
add hl, bc
ld a, [hl]
add a, $10
ld [hl], a
ldh a, [$ff00 + $ef]
add a, $10
ldh [$ff00 + $ef], a
call func_3b9e
ld hl, $c210
add hl, bc
ld a, [hl]
sub a, $10
ld [hl], a
ldh a, [$ff00 + $ef]
sub a, $10
ldh [$ff00 + $ef], a
ld hl, $c2a0
add hl, bc
ld a, [hl]
and a
jr z, 0.l_57b9
call func_08d7
call func_0891
ld [hl], $30
ld a, $30
ld [$c157], a
ld a, $04
ld [$c158], a
call func_3b8d
ret
call func_0891
ret nz
ld hl, $c2b0
add hl, bc
ldh a, [$ff00 + $ec]
cp [hl]
jr nz, 0.l_57d2
call func_3b8d
ld [hl], $01
call func_0891
ld [hl], $20
ret
ld hl, $c250
add hl, bc
ld [hl], $f8
call func_790e
ret
call func_3bd5
ret nc
call func_796e
add a, $08
bit 7, a
jr nz, 0.l_57fa
call func_3b93
ld a, $10
call func_3c30
ldh a, [$ff00 + $d7]
ldh [$ff00 + $9b], a
ldh a, [$ff00 + $d8]
ldh [$ff00 + $9a], a
ret
ldh a, [$ff00 + $9b]
and $80
jr nz, 0.l_5812
ld hl, $c210
add hl, bc
ld a, [hl]
sub a, $10
ldh [$ff00 + $99], a
ld a, $02
ldh [$ff00 + $9b], a
ld a, $01
ld [$c147], a
ret
ld e, [hl]
nop
ld e, [hl]
jr nz, 0.l_5829
inc de
ld e, b
call func_3c3b
call func_789f
ldh a, [$ff00 + $f0]
rst 0
add hl, hl
ld e, b
or e
ld e, b
or e
ld e, b
call func_3bd5
jr nc, 0.l_585c
call func_796e
ld e, a
add a, $03
cp $06
jr nc, 0.l_583b
call func_58d7
ldh a, [$ff00 + $9b]
and $80
jr nz, 0.l_585c
call func_796e
add a, $08
bit 7, a
jr z, 0.l_585c
ld hl, $c210
add hl, bc
ld a, [hl]
sub a, $10
ldh [$ff00 + $99], a
ld a, $02
ldh [$ff00 + $9b], a
ld a, $01
ld [$c147], a
call func_795e
add a, $12
cp $24
ret nc
call func_796e
add a, $12
cp $24
ret nc
ld a, [$c19b]
and a
ret nz
ld a, [$db00]
cp $03
jr nz, 0.l_587f
ldh a, [$ff00 + $cc]
and $20
jr nz, 0.l_588a
ret
ld a, [$db01]
cp $03
ret nz
ldh a, [$ff00 + $cc]
and $10
ret z
ld a, [$c3cf]
and a
ret nz
inc a
ld [$c3cf], a
ld hl, $c280
add hl, bc
ld [hl], $07
ld hl, $c490
add hl, bc
ld [hl], b
call func_0891
ld [hl], $02
ld hl, $fff3
ld [hl], $02
call func_3b8d
ld [hl], $02
ldh a, [$ff00 + $9e]
ld [$c15d], a
ret
call func_790b
ld hl, $c250
add hl, bc
ld a, [hl]
bit 7, a
jr nz, 0.l_58c3
cp $40
jr nc, 0.l_58c5
inc [hl]
inc [hl]
call func_3b9e
ld hl, $c2a0
add hl, bc
ld a, [hl]
and a
jr z, 0.l_58d6
call func_3e64
call func_79b4
ret
call func_0942
ld a, [$c146]
and a
jr nz, 0.l_58f3
ld a, $02
ld [$c13e], a
call func_795e
ld a, e
and a
ld a, $10
jr z, 0.l_58f0
ld a, $f0
ldh [$ff00 + $9a], a
ret
ldh a, [$ff00 + $9f]
ldh [$ff00 + $98], a
ret
ld b, d
jr nz, 0.l_593b
jr nz, 0.l_5943
jr nz, 0.l_5943
jr nz, 0.l_5941
nop
ld b, d
nop
ld b, h
nop
ld b, [hl]
nop
ld c, h
nop
ld c, h
jr nz, 0.l_595b
nop
ld c, [hl]
jr nz, 0.l_5959
nop
ld c, b
jr nz, 0.l_595f
nop
ld c, d
jr nz, 0.l_5913
ld a, e
<error>
and a
jp z, $79b4
ldh a, [$ff00 + $f6]
ld hl, $c3e0
add hl, bc
ld [hl], a
ld hl, $c220
add hl, bc
ld [hl], b
ld hl, $c230
add hl, bc
ld [hl], b
ld de, $58f8
call func_3c3b
ldh a, [$ff00 + $ea]
cp $07
jp z, .l_5a78
ld a, [$c11c]
cp $01
jr nz, 0.l_5949
call func_5a3c
jr 0.l_596d
call func_7944
ld hl, $c320
add hl, bc
dec [hl]
ld hl, $c310
add hl, bc
ld a, [hl]
and $80
jr z, 0.l_5971
ld [hl], b
ld hl, $c320
add hl, bc
ld [hl], $10
ld a, [$c146]
ld e, a
ld a, [$c14a]
or e
jr z, 0.l_596d
ld [hl], $20
call func_3b8d
ld [hl], b
call func_789f
ldh a, [$ff00 + $f0]
and a
jr nz, 0.l_59c1
call func_798d
sla e
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
and $01
add a, e
call func_3b87
call func_795e
add a, $12
cp $24
jr nc, 0.l_599b
call func_796e
add a, $12
cp $24
jr c, 0.l_59db
ldh a, [$ff00 + $e7]
and $07
jr nz, 0.l_59bb
ld a, [$c14a]
and a
ld a, $0c
jr z, 0.l_59ab
ld a, $20
ld e, a
ld hl, $c310
add hl, bc
ld a, [hl]
push af
push hl
ld [hl], b
ld a, e
call func_3c25
pop hl
pop af
ld [hl], a
call func_790b
jp $3b9e
ld hl, $c240
add hl, bc
ld a, [hl]
and $80
jr z, 0.l_59cc
inc [hl]
inc [hl]
dec [hl]
ld hl, $c250
add hl, bc
ld a, [hl]
and $80
jr z, 0.l_59d8
inc [hl]
inc [hl]
dec [hl]
jr 0.l_59bb
call func_3daf
call func_3bd5
ret nc
ld a, [$c19b]
and a
ret nz
ld a, [$db00]
cp $03
jr nz, 0.l_59f5
ldh a, [$ff00 + $cc]
and $20
jr nz, 0.l_5a00
ret
ld a, [$db01]
cp $03
ret nz
ldh a, [$ff00 + $cc]
and $10
ret z
ld a, [$c11c]
cp $02
ret nc
ld a, [$c3cf]
and a
ret nz
ld [$c11c], a
inc a
ld [$c3cf], a
ld hl, $c280
add hl, bc
ld [hl], $07
ld hl, $c490
add hl, bc
ld [hl], b
call func_0891
ld [hl], $02
ld hl, $fff3
ld [hl], $02
call func_3b8d
ld [hl], $01
ld a, $02
ldh [$ff00 + $a2], a
ld [$c146], a
ret
ld b, $07
ld [$0909], sp
ld [$0607], sp
ld hl, $c320
add hl, bc
ld [hl], b
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
and $07
ld e, a
ld d, b
ld hl, $5a34
add hl, de
ld e, [hl]
ld hl, $c310
add hl, bc
ld a, [hl]
sub a, e
ret z
ld e, a
ldh a, [$ff00 + $e7]
and $01
ret nz
ld a, e
and $80
jr z, 0.l_5a63
inc [hl]
inc [hl]
dec [hl]
ret
rrc a
nop
ld bc, $020f
rrc a
rrc a
rrc a
inc bc
rrc a
rrc a
inc d
inc d
dec d
ld d, $17
rl a
ld d, $15
ldh a, [$ff00 + $9e]
rl a
and $06
ld e, a
ldh a, [$ff00 + $e7]
rr a
rr a
and $01
add a, e
call func_3b87
ld a, $02
ld [$c146], a
xor a
ldh [$ff00 + $a3], a
ldh a, [$ff00 + $e7]
and $03
jr nz, 0.l_5ab1
ldh a, [$ff00 + $e7]
rr a
rr a
and $07
ld e, a
ld d, b
ld hl, $5a70
add hl, de
ld e, [hl]
ld hl, $ffa2
ld a, [hl]
sub a, e
jr z, 0.l_5ab1
and $80
jr z, 0.l_5ab0
inc [hl]
inc [hl]
dec [hl]
ldh a, [$ff00 + $cb]
and $0f
ld e, a
ld d, b
ld hl, $5a65
add hl, de
ld a, [hl]
cp $0f
jr z, 0.l_5ac5
ldh [$ff00 + $9e], a
ld [$c15d], a
ld a, [$c133]
and $03
jr z, 0.l_5acf
xor a
ldh [$ff00 + $9b], a
ld a, [$c133]
and $0c
jr z, 0.l_5ad9
xor a
ldh [$ff00 + $9a], a
call func_29c5
ret
ld h, h
nop
ld h, h
jr nz, 0.l_5b48
nop
ld h, [hl]
jr nz, 0.l_5b46
nop
ld h, b
jr nz, 0.l_5b4c
nop
ld h, d
jr nz, 0.l_5b56
nop
ld l, d
nop
ld l, h
nop
ld l, [hl]
nop
ld l, d
jr nz, 0.l_5b60
jr nz, 0.l_5b68
jr nz, 0.l_5b68
jr nz, 0.l_5b0f
<error>
ld e, d
call func_3c3b
call func_789f
call func_790b
call func_7944
call func_3b9e
ld hl, $c320
add hl, bc
dec [hl]
dec [hl]
ld hl, $c310
add hl, bc
ld a, [hl]
and $80
ldh [$ff00 + $e8], a
jr z, 0.l_5b26
ld [hl], b
ld hl, $c320
add hl, bc
ld [hl], b
ldh a, [$ff00 + $f0]
rst 0
ld b, l
ld e, e
add a, a
ld e, e
nop
stop
nop
ldh a, [$ff00 + $0c]
inc c
<error>
<error>
ldh a, [$ff00 + $00]
stop
nop
<error>
inc c
inc c
<error>
nop
ld b, $02
inc b
nop
ld b, $02
inc b
call func_0891
jr nz, 0.l_5b7e
call func_3b8d
call func_27ed
and $1f
or $10
ld hl, $c320
add hl, bc
ld [hl], a
call func_27ed
and $07
ld e, a
ld d, b
ld hl, $5b2d
add hl, de
ld a, [hl]
ld hl, $c240
add hl, bc
ld [hl], a
ld hl, $5b35
add hl, de
ld a, [hl]
ld hl, $c250
add hl, bc
ld [hl], a
ld hl, $5b3d
add hl, de
ld a, [hl]
ld hl, $c380
add hl, bc
ld [hl], a
ld hl, $c380
add hl, bc
ld a, [hl]
call func_3b87
ret
ldh a, [$ff00 + $e8]
and a
jr z, 0.l_5b9f
call func_0891
call func_27ed
and $1f
add a, $10
ld [hl], a
call func_3daf
call func_3b8d
ld [hl], b
ret
ld hl, $c380
add hl, bc
ld a, [hl]
inc a
call func_3b87
ret
nop
inc l
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
<error>
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
ld bc, $0000
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
sub a, l
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
ld a, $01
ldh [$ff00 + $a1], a
ld [$c167], a
call func_1495
ldh a, [$ff00 + $9c]
rst 0
cp h
ld e, h
adc a, $5c
<error>
ld e, h
ldh a, [$ff00 + $b7]
and a
jr nz, 0.l_5cc9
ld a, $01
ldh [$ff00 + $9c], a
ld a, $25
ldh [$ff00 + $f2], a
ret
nop
inc bc
ld bc, $f002
or a
and a
jr nz, $65cd8
ld a, $02
ldh [$ff00 + $9c], a
ret
ldh a, [$ff00 + $e7]
rr a
rr a
and $03
ld e, a
ld d, $00
ld hl, $5cca
add hl, de
ld a, [hl]
ldh [$ff00 + $9e], a
call func_087c
ret
call func_5cd8
ldh a, [$ff00 + $a2]
add a, $04
ldh [$ff00 + $a2], a
cp $78
jr c, 0.l_5d37
ld [$dbc8], a
ldh a, [$ff00 + $f6]
ld e, a
ld d, $00
ld hl, $5ba9
add hl, de
ld e, [hl]
ld hl, $d800
add hl, de
ld a, [hl]
and $80
jr z, 0.l_5d01
ld a, e
ld [$d403], a
xor a
ld [$d401], a
ld [$d402], a
ld a, $70
ld [$d405], a
ldh [$ff00 + $99], a
ld a, $68
ld [$d404], a
ldh [$ff00 + $98], a
ld [$d475], a
ld a, $66
ld [$d416], a
call func_090f
xor a
ld [$c167], a
ret
ld b, d
jr nz, 0.l_5d7b
jr nz, 0.l_5d83
jr nz, 0.l_5d83
jr nz, 0.l_5d81
nop
ld b, d
nop
ld b, h
nop
ld b, [hl]
nop
ld c, b
nop
ld c, d
nop
ld c, h
nop
ld c, [hl]
nop
stop
ld de, $1312
inc de
ld [de], a
ld de, $fa10
ld a, c
<error>
cp $01
jp nz, $79b4
ldh a, [$ff00 + $f6]
ld hl, $c3e0
add hl, bc
ld [hl], a
ld hl, $c220
add hl, bc
ld [hl], b
ld hl, $c230
add hl, bc
ld [hl], b
ldh a, [$ff00 + $e7]
xor c
and $01
jr nz, 0.l_5d7e
ld de, $5d38
call func_3c3b
ld hl, $c2c0
add hl, bc
ld a, [hl]
and a
jr nz, 0.l_5d9b
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
and $07
ld e, a
ld d, b
ld hl, $5d50
add hl, de
ld a, [hl]
sub a, $04
ld hl, $c310
add hl, bc
ld [hl], a
ldh a, [$ff00 + $f0]
and a
jr nz, 0.l_5def
call func_798d
ld a, e
cp $02
ld e, $04
jr z, 0.l_5daf
call func_795e
sla e
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
rr a
and $01
add a, e
call func_3b87
call func_795e
add a, $18
cp $30
jr nc, 0.l_5dd9
ldh a, [$ff00 + $99]
push af
add a, $0c
ldh [$ff00 + $99], a
call func_796e
ld e, a
pop af
ldh [$ff00 + $99], a
ld a, e
add a, $18
cp $30
jr c, 0.l_5def
ldh a, [$ff00 + $e7]
and $03
jr nz, 0.l_5dec
ld a, [$c14a]
and a
ld a, $08
jr z, 0.l_5de9
ld a, $18
call func_3c25
call func_790b
ld a, [$dba5]
and a
jp nz, .l_5f02
ld a, [$db7a]
and a
jp z, .l_5ea1
ldh a, [$ff00 + $f6]
cp $64
jp nz, .l_5ec7
ldh a, [$ff00 + $f0]
rst 0
dec c
ld e, [hl]
jr nz, 0.l_5e69
ld a, l
ld e, [hl]
call func_789f
ldh a, [$ff00 + $98]
cp $3c
ret nc
ldh a, [$ff00 + $99]
cp $7a
ret nc
ld [$c167], a
jp $3b8d
ld a, $02
ldh [$ff00 + $a1], a
ldh a, [$ff00 + $99]
push af
ldh a, [$ff00 + $98]
push af
ld hl, $c310
add hl, bc
ld a, $60
sub a, [hl]
ldh [$ff00 + $99], a
ld a, $28
ldh [$ff00 + $98], a
ld a, $08
call func_3c25
call func_795e
push af
ld a, e
sla a
ld hl, $c380
add hl, bc
ld [hl], a
pop af
add a, $03
cp $06
jr nc, 0.l_5e70
call func_796e
add a, $0c
cp $18
jr nc, 0.l_5e70
pop af
ldh [$ff00 + $98], a
pop af
ldh [$ff00 + $99], a
ld a, $16
call func_218e
ld a, $2d
ldh [$ff00 + $f2], a
call func_3b8d
ld hl, $c2c0
add hl, bc
inc [hl]
ret
pop af
ldh [$ff00 + $98], a
pop af
ldh [$ff00 + $99], a
call func_790b
call func_5f96
ret
ld a, $02
ldh [$ff00 + $a1], a
call func_789f
ld hl, $c310
add hl, bc
dec [hl]
jr nz, 0.l_5e9d
xor a
ld [$db79], a
ld [$db7a], a
ld [$c167], a
ld hl, $d9e3
set 6, [hl]
jp $79b4
call func_5f96
ret
call func_789f
ld hl, $c2d0
add hl, bc
ld a, [hl]
and a
ret nz
ldh a, [$ff00 + $f6]
cp $f6
jp nz, .l_5ec7
ldh a, [$ff00 + $99]
cp $40
ret c
ldh a, [$ff00 + $98]
cp $78
ret nc
inc [hl]
ld a, $2d
ldh [$ff00 + $f2], a
ld a, $13
call func_218e
ret
call func_789f
ld hl, $c2d0
add hl, bc
ld a, [hl]
and a
ret nz
ld a, [$c16b]
cp $04
ret nz
ldh a, [$ff00 + $e7]
and $01
ret nz
ld hl, $c440
add hl, bc
dec [hl]
ret nz
call func_27ed
and $03
ld hl, $c3c8
or [hl]
ret nz
ld hl, $c2d0
add hl, bc
inc [hl]
ld a, $2d
ldh [$ff00 + $f2], a
ld a, [$db7a]
and a
ld a, $11
jr z, 0.l_5eff
ld a, $10
jp $218e
call func_789f
ldh a, [$ff00 + $f7]
cp $1e
ret nz
ldh a, [$ff00 + $f6]
cp $e3
ret nz
ldh a, [$ff00 + $f8]
and $20
ret nz
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
ldh a, [$ff00 + $f0]
rst 0
ldi a, [hl]
ld e, a
ld b, d
ld e, a
ld a, d
ld e, a
xor b
ld e, a
call nz, func_ea5f
ld e, a
call func_0891
ld [hl], $40
jp $3b8d
ld h, b
jr z, 0.l_5f5d
ld l, b
nop
ldhl sp, d
<error>
ld [$fcf8], sp
ldhl sp, d
ld [bc], a
inc b
ld [bc], a
inc b
nop
call func_0891
jr nz, 0.l_5f78
ld hl, $c3d0
add hl, bc
ld e, [hl]
ld d, b
ld hl, $5f32
add hl, de
ld a, [hl]
ld hl, $c2e0
add hl, bc
ld [hl], a
ld hl, $5f36
add hl, de
ld a, [hl]
ld hl, $c240
add hl, bc
ld [hl], a
ld hl, $5f3a
add hl, de
ld a, [hl]
ld hl, $c250
add hl, bc
ld [hl], a
ld hl, $5f3e
add hl, de
ld a, [hl]
ld hl, $c380
add hl, bc
ld [hl], a
call func_3b8d
jr $65f96
call func_0891
jr nz, 0.l_5f93
ld [hl], $50
call func_3b8d
ld hl, $c3d0
add hl, bc
ld a, [hl]
inc a
ld [hl], a
cp $04
jr z, 0.l_5f93
call func_3b8d
ld [hl], b
call func_790b
ld hl, $c380
add hl, bc
ld e, [hl]
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
rr a
and $01
add a, e
call func_3b87
ret
call func_0891
jr nz, 0.l_5fc1
ld [hl], $50
ldh a, [$ff00 + $99]
push af
ld a, $10
ldh [$ff00 + $99], a
ld a, $14
call func_218e
pop af
ldh [$ff00 + $99], a
call func_3b8d
jp $5f96
call func_0891
jr nz, 0.l_5fd1
ld a, $15
call func_218e
call func_3b8d
ld hl, $c250
add hl, bc
ld [hl], $0a
ld hl, $c240
add hl, bc
ld [hl], $fc
ld hl, $c380
add hl, bc
ld [hl], $02
call func_790b
jp $5f96
ret
ld a, $01
ld [$db7a], a
call func_7a66
call func_79b4
jp .l_0909
nop
sbc a, b
ld b, $89
nop
inc b
nop
inc b
nop
inc b
nop
inc b
nop
stop
sbc a, b
rlc a
adc a, c
ld bc, $0111
ld de, $1101
ld bc, $0111
ld de, $0898
adc a, c
rlc a
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $98
ld [$0789], sp
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $98
add hl, bc
adc a, c
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $07
sbc a, b
ld a, [bc]
adc a, c
rlc a
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $98
dec bc
adc a, c
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $07
sbc a, b
dec bc
adc a, c
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $07
sbc a, b
inc c
adc a, c
rlc a
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $98
dec c
adc a, c
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $07
sbc a, b
ld c, $89
ld [bc], a
ld [de], a
ld [bc], a
ld [de], a
ld [bc], a
ld [de], a
ld [bc], a
ld [de], a
ld [bc], a
ld [de], a
sbc a, b
rrc a
adc a, c
inc bc
dec b
inc bc
dec b
inc bc
dec b
inc bc
dec b
inc bc
inc de
sbc a, b
ld b, $89
inc b
nop
inc b
nop
inc b
nop
inc b
nop
inc b
inc d
sbc a, b
rlc a
adc a, c
ld de, $1101
ld bc, $0111
ld de, $1101
ld bc, $0898
adc a, c
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $07
sbc a, b
ld [$0689], sp
rlc a
ld b, $07
ld b, $07
ld b, $07
ld b, $07
sbc a, b
add hl, bc
adc a, c
rlc a
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $98
ld a, [bc]
adc a, c
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $07
sbc a, b
dec bc
adc a, c
rlc a
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $98
dec bc
adc a, c
rlc a
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $98
inc c
adc a, c
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $07
sbc a, b
dec c
adc a, c
rlc a
ld b, $07
ld b, $07
ld b, $07
ld b, $07
ld b, $98
ld c, $89
ld [de], a
ld [bc], a
ld [de], a
ld [bc], a
ld [de], a
ld [bc], a
ld [de], a
ld [bc], a
ld [de], a
ld [bc], a
sbc a, b
rrc a
adc a, c
dec b
inc bc
dec b
inc bc
dec b
inc bc
dec b
inc bc
dec b
dec d
sub a, l
ld h, b
ld sp, hl
ld e, a
ret
ld h, b
dec l
ld h, b
<error>
ld h, b
ld h, c
ld h, b
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
call func_63be
ldh a, [$ff00 + $f0]
rst 0
ld e, b
ld h, c
ld h, e
ld h, c
sbc a, c
ld h, c
and e
ld h, c
xor b
ld h, c
<error>
ld h, c
inc b
ld h, d
call func_27d2
call func_0891
ld [hl], $ff
call func_3b8d
call func_0891
jr nz, 0.l_6176
ld [$c155], a
call func_3b87
ld a, $2e
ldh [$ff00 + $f2], a
call func_3b8d
ret
cp $a0
jr nz, 0.l_617e
ld a, $1d
ldh [$ff00 + $f4], a
jr c, 0.l_618c
and $10
ld a, $00
jr z, 0.l_6188
ld a, $ff
call func_3b87
ret
ld e, $01
and $04
jr z, 0.l_6194
ld e, $fe
ld a, e
ld [$c155], a
ret
call func_0891
and a
jr nz, 0.l_61a2
call func_3b8d
ret
ld hl, $6131
jr $661ab
ld hl, $6135
push bc
push hl
ld hl, $c2b0
add hl, bc
ld a, [hl]
rl a
and $02
ld e, a
ld d, b
pop hl
add hl, de
ldi a, [hl]
ld d, [hl]
ld e, a
ld c, $34
ld hl, $d601
dec de
ld a, [de]
inc de
cp $98
ld a, [de]
jr nz, 0.l_61d1
ldh a, [$ff00 + $96]
and a
ld a, [de]
jr z, 0.l_61d1
add a, $0c
inc de
ldi [hl], a
dec c
jr nz, 0.l_61c1
ld [hl], $00
pop bc
call func_3b8d
ret
ld hl, $6139
call func_61ab
call func_0891
ld [hl], $18
ld hl, $c2b0
add hl, bc
inc [hl]
ld hl, $c3d0
add hl, bc
ld a, [hl]
inc a
ld [hl], a
cp $0c
jr nz, 0.l_61fe
ldh a, [$ff00 + $bf]
ld [$d368], a
ret
call func_3b8d
ld [hl], $02
ret
call func_7a66
set 4, [hl]
xor a
ld [$c155], a
ld [$c167], a
ld a, $02
ldh [$ff00 + $f2], a
ld a, $e1
ld [$d736], a
ld a, $77
ld [$d746], a
ld a, $77
ld [$d756], a
call func_6269
jp $79b4
sbc a, b
ld c, d
add a, a
inc c
inc e
ld h, h
ld h, [hl]
rrc a
rrc a
rrc a
rrc a
sbc a, b
ld c, e
add a, a
dec c
dec e
ld h, l
ld h, a
rr a
rr a
rr a
rr a
sbc a, b
ld c, c
add a, c
dec bc
dec de
sbc a, b
ld c, h
add a, c
ld c, $1e
sbc a, b
ld d, [hl]
add a, a
inc c
inc e
ld h, h
ld h, [hl]
rrc a
rrc a
rrc a
rrc a
sbc a, b
ld d, a
add a, a
dec c
dec e
ld h, l
ld h, a
rr a
rr a
rr a
rr a
sbc a, b
ld d, l
add a, c
dec bc
dec de
sbc a, b
ld e, b
add a, c
ld c, $1e
ld a, $20
ld [$d600], a
ld hl, $d601
ld de, $6229
ldh a, [$ff00 + $96]
and a
jr z, 0.l_627c
ld de, $6249
push bc
ld c, $20
ld a, [de]
inc de
ldi [hl], a
dec c
jr nz, 0.l_627f
pop bc
ld [hl], b
ret
ld d, b
ld e, h
ld l, b
ld [hl], b
ld a, d
ld a, [hl]
ld e, b
ldd [hl], a
jr c, 0.l_62ca
ld b, b
ld b, h
ld d, b
jr nz, 0.l_62b7
jr nz, 0.l_62b9
jr nz, 0.l_62ba
ld e, $1f
jr nz, 0.l_62bf
jr nz, 0.l_62c1
jr nz, 0.l_62a6
inc bc
inc b
inc b
dec b
dec b
ld b, $01
ld bc, $0202
inc bc
inc bc
ret nz
ret nz
ret nz
ret nz
ret nz
ret nz
ret nz
jr c, 0.l_62f2
dec sp
ld b, h
ld c, h
ld e, b
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
cpl
jr nc, 0.l_62f6
jr nc, 0.l_62f8
jr nc, 0.l_62ca
nop
nop
nop
nop
nop
nop
nop
ld bc, $0302
inc b
inc b
nop
nop
ld [hl], b
nop
nop
nop
rst 38
nop
nop
nop
rst 38
nop
nop
nop
rst 38
nop
nop
nop
ld [hl], d
nop
nop
ld [$0074], sp
nop
nop
rst 38
nop
nop
nop
rst 38
nop
nop
nop
halt
nop
nop
ld [$0078], sp
nop
stop
ld a, d
nop
nop
nop
rst 38
nop
nop
nop
ld a, h
nop
nop
ld [$007e], sp
nop
stop
ld a, [hl]
jr nz, 0.l_6313
jr 0.l_6391
jr nz, 0.l_6317
nop
ld a, d
jr nz, 0.l_631b
ld [$2078], sp
nop
stop
halt
jr nz, 0.l_6323
nop
rst 38
nop
nop
nop
ld [hl], h
jr nz, 0.l_632b
ld [$2072], sp
nop
nop
rst 38
nop
nop
nop
rst 38
nop
nop
jr nc, 0.l_63a9
jr nz, 0.l_633b
ret c
ld [hl], b
nop
nop
nop
rst 38
nop
nop
nop
rst 38
nop
nop
nop
ld h, b
stop
stop
nop
ld h, d
nop
jr nz, 0.l_6350
ld h, d
nop
nop
nop
rst 38
nop
nop
nop
rst 38
nop
nop
nop
rst 38
nop
nop
nop
ld h, h
stop
stop
nop
ld h, [hl]
nop
jr nz, 0.l_6368
ld h, [hl]
nop
nop
nop
rst 38
nop
nop
nop
rst 38
nop
nop
nop
rst 38
nop
nop
ld [bc], a
ld l, b
stop
stop
ld [bc], a
ld l, d
nop
jr nz, 0.l_6382
ld l, d
nop
nop
dec b
ld l, b
jr nc, 0.l_6397
dec b
ld l, d
jr nz, 0.l_63ab
dec b
ld l, d
jr nz, 0.l_638f
ld bc, $1068
stop
ld bc, $006a
jr nz, 0.l_6399
ld l, d
nop
nop
rlc a
ld l, b
jr nc, 0.l_63af
rlc a
ld l, d
jr nz, 0.l_63c3
rlc a
ld l, d
jr nz, 0.l_63a7
nop
ld l, b
stop
stop
nop
ld l, d
nop
jr nz, 0.l_63b0
ld l, d
nop
nop
ld [$3068], sp
stop
ld [$206a], sp
jr nz, 0.l_63c4
ld l, d
jr nz, 0.l_63e0
ret nc
jp .l_5e09
ld d, b
ld hl, $6288
add hl, de
ld a, [hl]
ldh [$ff00 + $ee], a
ld hl, $6295
add hl, de
ld a, [hl]
ldh [$ff00 + $ec], a
ld hl, $62a2
add hl, de
ld a, [hl]
rl a
rl a
rl a
rl a
and $f0
ld e, a
ld d, b
ld hl, $62d6
add hl, de
ld c, $04
call func_3d26
ld a, $02
call func_3dd0
ld hl, $c3d0
add hl, bc
ld e, [hl]
ld d, b
ld hl, $62af
add hl, de
ld a, [hl]
ldh [$ff00 + $ee], a
ld hl, $62bc
add hl, de
ld a, [hl]
ldh [$ff00 + $ec], a
ld hl, $62c9
add hl, de
ld a, [hl]
rl a
rl a
rl a
and $f8
ld e, a
rl a
and $f0
add a, e
ld e, a
ld d, b
ld hl, $6346
add hl, de
ld c, $06
call func_3d26
ld a, $04
call func_3dd0
ret
sbc a, b
ld [bc], a
add hl, bc
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
sbc a, b
ldi [hl], a
add hl, bc
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
sbc a, b
ld b, d
add hl, bc
inc c
dec c
inc c
dec c
inc c
dec c
inc c
dec c
inc c
dec c
sbc a, b
ld h, d
add hl, bc
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
sbc a, b
ld [bc], a
add hl, bc
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
sbc a, b
ldi [hl], a
add hl, bc
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
sbc a, b
ld b, d
add hl, bc
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
sbc a, b
ld h, d
add hl, bc
rrc a
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $98
ld [bc], a
add hl, bc
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
ld d, l
ld d, [hl]
sbc a, b
ldi [hl], a
add hl, bc
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
sbc a, b
ld b, d
add hl, bc
rrc a
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $98
ld h, d
add hl, bc
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
sbc a, b
ld [bc], a
add hl, bc
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
sbc a, b
ldi [hl], a
add hl, bc
rrc a
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $98
ld b, d
add hl, bc
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
sbc a, b
ld h, d
add hl, bc
rrc a
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $98
add a, d
add hl, bc
rrc a
ld c, $0f
rrc a
rrc a
ld c, $0f
ld c, $0f
ld c, $98
and d
add hl, bc
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
sbc a, b
jp nz, .l_0f09
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $98
ldh [c], a
add hl, bc
ld e, $1e
ld e, $1e
ld e, $1e
ld e, $1e
ld e, $1e
sbc a, b
add a, d
add hl, bc
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
sbc a, b
and d
add hl, bc
rrc a
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $98
jp nz, .l_1e09
ld e, $1e
ld e, $1e
ld e, $1e
ld e, $1e
ld e, $98
ldh [c], a
add hl, bc
add hl, bc
ld [$0918], sp
ld a, [hl]
ld a, [hl]
add hl, bc
ld [$0918], sp
sbc a, b
add a, d
add hl, bc
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
ld c, $0f
sbc a, b
and d
add hl, bc
ld e, $1e
ld e, $1e
ld e, $1e
ld e, $1e
ld e, $1e
sbc a, b
jp nz, .l_0909
ld [$0918], sp
ld a, [hl]
ld a, [hl]
add hl, bc
ld [$0918], sp
sbc a, b
ldh [c], a
add hl, bc
add hl, bc
inc b
dec b
add hl, bc
ld a, [hl]
ld a, [hl]
add hl, bc
inc b
dec b
add hl, bc
sbc a, b
add a, d
add hl, bc
ld e, $1e
ld e, $1e
ld e, $1e
ld e, $1e
ld e, $1e
sbc a, b
and d
add hl, bc
add hl, bc
ld [$0918], sp
ld a, [hl]
ld a, [hl]
add hl, bc
ld [$0918], sp
sbc a, b
jp nz, .l_0909
inc b
dec b
add hl, bc
ld a, [hl]
ld a, [hl]
add hl, bc
inc b
dec b
add hl, bc
sbc a, b
ldh [c], a
add hl, bc
add hl, de
inc d
dec d
add hl, de
rr a
rr a
add hl, de
inc d
dec d
add hl, de
ld hl, $5564
ld h, h
adc a, c
ld h, h
cp l
ld h, h
pop af
ld h, h
dec h
ld h, l
ld e, c
ld h, l
adc a, l
ld h, l
ldh a, [$ff00 + $f6]
cp $0e
jp z, .l_613d
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
ldh a, [$ff00 + $f0]
rst 0
ld [$fb65], a
ld h, l
inc h
ld h, [hl]
ld e, a
ld h, [hl]
ld a, $04
ldh [$ff00 + $f4], a
call func_0891
ld [hl], $ac
call func_088c
ld [hl], $ac
call func_3b8d
call func_0891
cp $a0
jr nz, 0.l_6607
ld hl, $fff4
ld [hl], $2e
and a
jr nz, 0.l_6611
ld a, $2f
ldh [$ff00 + $f2], a
call func_3b8d
ld e, $01
and $04
jr z, 0.l_6619
ld e, $fe
ld a, e
ld [$c155], a
call func_088c
ret nz
jp .l_6705
ld hl, $c2b0
add hl, bc
ld a, [hl]
push af
rl a
and $06
ld e, a
ld d, b
ld hl, $65c1
add hl, de
ldi a, [hl]
ld d, [hl]
ld e, a
push bc
ld c, $34
ld hl, $d601
ld a, [de]
cp $98
jr nz, 0.l_664a
ldh a, [$ff00 + $97]
and a
ld a, $98
jr z, 0.l_664a
ld a, $9a
inc de
ldi [hl], a
dec c
jr nz, 0.l_663c
ld [hl], $00
pop bc
pop af
cp $03
jr nz, 0.l_665c
ldh a, [$ff00 + $bf]
ld [$d368], a
jp $3b8d
push bc
ld hl, $c2b0
add hl, bc
ld a, [hl]
rl a
and $06
ld e, a
ld d, b
ld hl, $65c9
add hl, de
ldi a, [hl]
ld d, [hl]
ld e, a
ld c, $34
ld hl, $d601
ld a, [de]
cp $98
jr nz, 0.l_6684
ldh a, [$ff00 + $97]
and a
ld a, $98
jr z, 0.l_6684
ld a, $9a
inc de
ldi [hl], a
dec c
jr nz, 0.l_6676
ld [hl], $00
pop bc
ld hl, $c2b0
add hl, bc
ld a, [hl]
inc a
ld [hl], a
cp $04
jr nz, 0.l_66f2
ld hl, $d712
ld a, $b3
ldi [hl], a
ld a, $b3
ldi [hl], a
ld a, $b3
ldi [hl], a
ld a, $b3
ldi [hl], a
ld a, $b3
ldi [hl], a
ld hl, $d722
ld a, $b3
ldi [hl], a
ld a, $b3
ldi [hl], a
ld a, $b3
ldi [hl], a
ld a, $b3
ldi [hl], a
ld a, $b3
ldi [hl], a
ld hl, $d732
ld a, $ad
ldi [hl], a
ld a, $b1
ldi [hl], a
ld a, $e7
ldi [hl], a
ld a, $ad
ldi [hl], a
ld a, $b1
ldi [hl], a
ld hl, $d742
ld a, $ae
ldi [hl], a
ld a, $b2
ldi [hl], a
ld a, $e3
ldi [hl], a
ld a, $ae
ldi [hl], a
ld a, $b2
ldi [hl], a
call func_7a66
set 4, [hl]
xor a
ld [$c155], a
ld [$c167], a
ld a, $02
ldh [$ff00 + $f2], a
jp $79b4
call func_3b8d
ld [hl], $01
call func_0891
ld [hl], $30
ret
jr 0.l_6757
jr z, 0.l_6749
jr c, 0.l_6723
ld d, b
ld b, b
ldh a, [$ff00 + $e7]
and $03
jr nz, 0.l_6742
ld a, $a7
call func_3c01
jr c, 0.l_6742
push bc
call func_27ed
and $07
ld c, a
ld hl, $66fd
add hl, bc
ld a, [hl]
ld hl, $c200
add hl, de
ld [hl], a
call func_27ed
and $07
add a, $47
ld hl, $c210
add hl, de
ld [hl], a
pop bc
ld hl, $c340
add hl, de
ld [hl], $c2
ld hl, $c2e0
add hl, de
ld [hl], $10
ld hl, $c2b0
add hl, de
ld [hl], $01
ret
ld h, b
nop
ld h, d
nop
ld h, d
jr nz, 0.l_67aa
jr nz, 0.l_67b0
nop
ld h, [hl]
nop
ld h, [hl]
jr nz, 0.l_67b6
jr nz, 0.l_67bc
nop
ld l, d
nop
ld l, h
nop
ld l, [hl]
nop
ld l, d
jr nz, 0.l_67c6
jr nz, 0.l_67ce
jr nz, 0.l_67ce
jr nz, 0.l_6754
stop
ld hl, $c2c0
add hl, bc
ld a, [hl]
and a
jp nz, .l_65d1
ldh a, [$ff00 + $f7]
cp $0a
jr nz, 0.l_6784
ldh a, [$ff00 + $f6]
cp $97
jr z, 0.l_677e
cp $98
jr nz, 0.l_6784
ld a, [$db7f]
and a
jr nz, 0.l_678a
ld de, $6743
call func_3c3b
call func_789f
call func_78c1
call func_3bb4
call func_790b
call func_3b9e
ld a, [$c133]
and a
jr nz, 0.l_67f7
ldh a, [$ff00 + $cb]
and $03
jr z, 0.l_67c7
ld e, a
ld d, b
ld hl, $6762
add hl, de
ld a, [hl]
ld hl, $c240
add hl, bc
ld [hl], a
ld hl, $c250
add hl, bc
ld [hl], b
ld a, e
and $02
add a, $04
ld e, a
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
and $01
add a, e
jp $3b87
ldh a, [$ff00 + $cb]
and $0f
jr z, 0.l_67f7
rr a
rr a
cpl
and $03
ld e, a
ld d, b
ld hl, $6762
add hl, de
ld a, [hl]
ld hl, $c250
add hl, bc
ld [hl], a
ld hl, $c240
add hl, bc
ld [hl], b
ld a, e
dec a
xor $01
sra a
rl a
rl a
ld e, a
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
and $01
add a, e
jp $3b87
jp $3daf
ld h, b
nop
ld h, d
nop
ld h, h
nop
ld h, [hl]
nop
ld h, d
jr nz, 0.l_6865
jr nz, 0.l_686d
jr nz, 0.l_686d
jr nz, 0.l_681c
ld a, [$cd67]
dec sp
inc a
call func_789f
ld hl, $c240
add hl, bc
ld a, [hl]
rlc a
rlc a
and $02
ld e, a
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
and $01
or e
call func_3b87
call func_3bb4
ldh a, [$ff00 + $f0]
rst 0
inc [hl]
ld l, b
ld d, a
ld l, b
ld h, l
ld l, b
ld hl, $c240
ldh a, [$ff00 + $eb]
cp $aa
jr z, 0.l_6840
ld hl, $c250
add hl, bc
ld [hl], $08
ld e, $80
ldh a, [$ff00 + $eb]
cp $aa
jr z, 0.l_684d
ld e, $60
call func_0891
ld [hl], e
call func_3b8d
ld [hl], $01
ret
call func_0891
jr nz, 0.l_6861
ld [hl], $28
call func_3b8d
call func_790b
ret
call func_0891
jr nz, 0.l_687d
ld hl, $c240
add hl, bc
ld a, [hl]
cpl
inc a
ld [hl], a
ld hl, $c250
add hl, bc
ld a, [hl]
cpl
inc a
ld [hl], a
jp .l_6843
ret
ldh a, [$ff00 + $f0]
cp $05
jr nz, 0.l_688a
ldh a, [$ff00 + $ed]
or $40
ldh [$ff00 + $ed], a
ld de, $67fa
call func_3c3b
call func_789f
ld hl, $c240
add hl, bc
ld a, [hl]
rlc a
rlc a
and $02
ld e, a
call func_78c1
ldh a, [$ff00 + $f0]
cp $05
jr z, $668b8
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
and $01
or e
call func_3b87
call func_68b8
call func_3bb4
ret
ldh a, [$ff00 + $f0]
rst 0
rst 0
ld l, b
rst 10
ld l, b
push af
ld l, b
add hl, hl
ld l, c
ld b, d
ld l, c
ld h, a
ld l, c
ld hl, $c480
add hl, bc
ld [hl], $03
ldh a, [$ff00 + $ef]
ld hl, $c2b0
add hl, bc
ld [hl], a
jp $3b8d
call func_0891
call func_27ed
and $7f
add a, $30
ld [hl], a
call func_27ed
ld e, $f4
and $01
jr z, 0.l_68ed
ld e, $0c
ld hl, $c240
add hl, bc
ld [hl], e
jp $3b8d
call func_0891
jr nz, 0.l_690e
ld hl, $c250
add hl, bc
ld [hl], $d4
ldh a, [$ff00 + $ec]
sub a, $08
call func_6991
ld a, $24
ldh [$ff00 + $f2], a
jp $3b8d
call func_088c
jr nz, 0.l_6923
call func_27ed
and $3f
or $10
ld [hl], a
ld hl, $c240
add hl, bc
ld a, [hl]
cpl
inc a
ld [hl], a
call func_7918
jp $3b9e
call func_0891
jr nz, 0.l_6941
call func_790e
call func_6957
ld hl, $c250
add hl, bc
inc [hl]
ld a, [hl]
cp $18
jr nz, 0.l_6941
call func_3b8d
ret
ld hl, $c2b0
add hl, bc
ld a, [hl]
ld hl, $c210
add hl, bc
cp [hl]
jr nc, 0.l_6954
call func_3b8d
ld [hl], $01
ret
call func_790e
ld hl, $c430
add hl, bc
set 0, [hl]
call func_3b9e
ld hl, $c430
add hl, bc
res 0, [hl]
ret
ld hl, $c340
add hl, bc
set 7, [hl]
set 6, [hl]
ld hl, $c250
add hl, bc
inc [hl]
push hl
ld hl, $c470
add hl, bc
ld a, [hl]
pop hl
and a
jr z, 0.l_6980
ld [hl], $06
call func_790e
ldh a, [$ff00 + $ec]
cp $70
jr c, $66957
cp $88
jp nc, $79b4
ret
ldh a, [$ff00 + $ec]
ldh [$ff00 + $d8], a
ldh a, [$ff00 + $ee]
ldh [$ff00 + $d7], a
ld a, $01
call func_0953
ld a, $0e
ldh [$ff00 + $f2], a
ret
sbc a, d
stop
sbc a, h
stop
ld de, $69a1
call func_3c3b
call func_7944
ld hl, $c320
add hl, bc
dec [hl]
ld hl, $c310
add hl, bc
ld a, [hl]
and $80
jp nz, $79b4
ret
ld hl, $c2b0
add hl, bc
ld a, [hl]
and a
jp nz, .l_69a5
call func_6b4e
call func_7804
ldh a, [$ff00 + $f0]
rst 0
ret c
ld l, c
rrc a
ld l, d
ldi a, [hl]
ld l, d
ld l, b
ld l, d
call func_7852
jr nc, 0.l_6a03
ld e, $cd
ldh a, [$ff00 + $f8]
and $20
jr nz, 0.l_69ff
ld e, $cc
ld a, [$dafe]
and $20
jr nz, 0.l_69ff
ld e, $c6
ld a, [$db0e]
cp $03
jr nz, 0.l_69ff
ld a, $c7
call func_2185
jp $3b8d
ld a, e
call func_2185
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
rr a
and $01
call func_3b87
ret
ld a, [$c19f]
and a
jr nz, 0.l_6a29
call func_3b8d
ld a, [$c177]
and a
jr z, 0.l_6a24
ld [hl], b
ld a, $c9
jp $2185
ld a, $c8
call func_2185
ret
ld a, [$c19f]
and a
jr nz, 0.l_6a63
ld a, $cd
call func_3c01
ldh a, [$ff00 + $d7]
ld hl, $c200
add hl, de
sub a, $02
ld [hl], a
ldh a, [$ff00 + $d8]
ld hl, $c210
add hl, de
ld [hl], a
ld hl, $c2b0
add hl, de
ld [hl], $01
ld hl, $c320
add hl, de
ld [hl], $20
ld hl, $c340
add hl, de
ld [hl], $c2
ld a, $24
ldh [$ff00 + $f2], a
call func_0891
ld [hl], $c0
call func_3b8d
ret
nop
ld bc, $0102
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
call func_0891
jr nz, 0.l_6a89
xor a
ld [$c167], a
ld a, $04
ld [$db0e], a
ld a, $0d
ldh [$ff00 + $a5], a
call func_0898
call func_3b8d
ld [hl], b
ret
cp $80
jr c, 0.l_6a92
ld a, $03
jp $3b87
cp $08
jr nz, 0.l_6a9c
dec [hl]
ld a, $ca
call func_2185
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
and $03
ld e, a
ld d, b
ld hl, $6a64
add hl, de
ld a, [hl]
call func_3b87
ret
nop
nop
ld d, b
nop
nop
ld [$0052], sp
nop
stop
ld d, h
nop
stop
nop
ld d, [hl]
nop
stop
ld [$0058], sp
stop
stop
ld e, d
nop
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
nop
nop
ld d, b
nop
nop
ld [$0052], sp
nop
stop
ld e, h
nop
stop
nop
ld d, [hl]
nop
stop
ld [$0058], sp
stop
stop
ld e, [hl]
nop
stop
jr 0.l_6b49
nop
rst 38
rst 38
rst 38
rst 38
nop
nop
ld h, d
nop
nop
ld [$0064], sp
nop
stop
ld h, [hl]
nop
stop
nop
ld l, b
nop
stop
ld [$0058], sp
stop
stop
ld e, [hl]
nop
stop
stop
ld h, b
nop
rst 38
rst 38
rst 38
rst 38
nop
nop
ld l, d
nop
nop
ld [$006c], sp
nop
stop
ld l, [hl]
nop
stop
nop
ld l, b
nop
stop
ld [$0058], sp
stop
stop
ld e, [hl]
nop
stop
stop
ld h, b
nop
rst 38
rst 38
rst 38
rst 38
stop
nop
ld [hl], h
nop
stop
ld [$0076], sp
stop
stop
ld [hl], h
nop
stop
jr 0.l_6bb3
nop
nop
stop
ld [hl], h
nop
nop
jr 0.l_6bbb
nop
nop
nop
ld [hl], h
nop
nop
ld [$0076], sp
ldh a, [$ff00 + $f1]
rl a
rl a
rl a
rl a
rl a
and $e0
ld e, a
ld d, b
ld hl, $6aae
add hl, de
ldh a, [$ff00 + $ee]
add a, $03
ldh [$ff00 + $ee], a
ld c, $07
call func_3d26
ld a, $02
call func_3dd0
ld a, $78
ldh [$ff00 + $ee], a
ld a, $5c
ldh [$ff00 + $ec], a
ld hl, $6b2e
ld c, $08
ld a, [$db0e]
cp $04
jr nz, 0.l_6b83
dec c
dec c
call func_3d26
ld a, $03
call func_3dd0
call func_3dba
ret
ld [$7004], sp
nop
ld [$720c], sp
nop
ld [$7014], sp
jr nz, 0.l_6b96
and l
<error>
and a
jr nz, 0.l_6baf
ld hl, $c340
add hl, bc
ld [hl], $c3
ld hl, $6b8f
ld c, $03
jp $3d26
ldh a, [$ff00 + $f6]
cp $fe
jp z, .l_69be
ldh a, [$ff00 + $ee]
cp $30
jp c, .l_6d11
ldh a, [$ff00 + $f0]
and a
jr nz, 0.l_6bf0
call func_3b8d
ld hl, $c210
add hl, bc
ld [hl], $48
ld hl, $c200
add hl, bc
ld a, [hl]
sub a, $04
ld [hl], a
ld a, $cd
call func_3c01
ld hl, $c200
add hl, de
ld [hl], $28
ld hl, $c210
add hl, de
ld [hl], $28
ld hl, $c2b0
add hl, de
ld [hl], $01
ld hl, $c2e0
add hl, de
ld [hl], $40
call func_6ca7
call func_7804
ldh a, [$ff00 + $f0]
rst 0
rst 38
ld l, e
nop
ld l, h
ldd [hl], a
ld l, h
ret
call func_0887
ret nz
call func_7852
jr nc, 0.l_6c24
ld a, [$db0e]
cp $0e
jr nz, 0.l_6c17
ld a, $d8
call func_2197
jr 0.l_6c1c
ld a, $9b
call func_2185
ld hl, $c19f
set 7, [hl]
call func_3b8d
ldh a, [$ff00 + $e7]
ld e, $00
and $20
jr z, 0.l_6c2d
inc e
ld a, e
call func_3b87
ret
ld a, [$c19f]
and a
jr nz, 0.l_6c3d
call func_3b8d
ld [hl], $01
call func_795e
ld a, e
add a, $02
call func_3b87
ret
ldhl sp, d
ldhl sp, d
ld e, d
nop
ldhl sp, d
nop
ld e, h
nop
ldhl sp, d
ld [$005e], sp
ld [$6000], sp
nop
ld [$6208], sp
nop
ldhl sp, d
stop
ld e, d
jr nz, 0.l_6c58
nop
ld e, [hl]
jr nz, 0.l_6c5c
ld [$205c], sp
ld [$6200], sp
jr nz, 0.l_6c74
ld [$2060], sp
nop
stop
ld d, b
jr nz, 0.l_6c6c
nop
ld d, h
jr nz, 0.l_6c70
ld [$2052], sp
ld [$5800], sp
jr nz, 0.l_6c88
ld [$2056], sp
nop
ldhl sp, d
ld d, b
nop
ldhl sp, d
nop
ld d, d
nop
ldhl sp, d
ld [$0054], sp
ld [$5600], sp
nop
ld [$5808], sp
nop
ldh a, [$ff00 + $00]
halt
nop
ldh a, [$ff00 + $08]
halt
jr nz, 0.l_6ca0
nop
ld a, b
nop
nop
ld [$2078], sp
ldh a, [$ff00 + $f1]
rl a
rl a
and $fc
ld e, a
rl a
rl a
and $f0
add a, e
ld e, a
ld d, b
ld hl, $6c47
add hl, de
ldh a, [$ff00 + $ee]
add a, $04
ldh [$ff00 + $ee], a
ld c, $05
call func_3d26
ldh a, [$ff00 + $ee]
add a, $10
ldh [$ff00 + $ee], a
ld hl, $6c97
ld c, $04
call func_3d26
call func_7804
ldh a, [$ff00 + $98]
sub a, $68
add a, $04
cp $08
jr nc, 0.l_6d0d
ldh a, [$ff00 + $99]
sub a, $50
add a, $04
cp $08
jr nc, 0.l_6d0d
ldh a, [$ff00 + $9e]
cp $02
jr nz, 0.l_6d0d
call func_7878
jr nc, 0.l_6d0d
call func_0887
jr nz, 0.l_6d0d
ld a, $08
ld [$db95], a
xor a
ld [$c16b], a
ld [$c16c], a
ld [$db96], a
call func_0887
ld [hl], $08
call func_3dba
ret
call func_0891
jr z, 0.l_6d1a
ld a, $00
ldh [$ff00 + $f1], a
call func_6dd6
call func_7804
ld hl, $c380
add hl, bc
ldh a, [$ff00 + $e7]
rr a
rr a
rr a
and $01
inc a
add a, [hl]
call func_3b87
call func_796e
add a, $13
cp $26
jr nc, 0.l_6d4a
call func_795e
add a, $13
cp $26
jr nc, 0.l_6d4a
ld a, e
sla a
ld hl, $c380
add hl, bc
ld [hl], a
call func_7852
jr nc, 0.l_6d71
ld hl, $c3d0
add hl, bc
ld a, [hl]
inc [hl]
and $01
jr z, 0.l_6d6b
ld e, $af
call func_27ed
and $3f
jr z, 0.l_6d6d
ld e, $fb
call func_27ed
and $07
jr z, 0.l_6d6d
ld e, $fa
ld a, e
call func_2197
ret
<error>
nop
ld h, h
nop
<error>
ld [$0066], sp
inc b
nop
ld l, b
nop
inc b
ld [$006a], sp
rst 38
rst 38
rst 38
rst 38
inc b
ldhl sp, d
ld [hl], b
nop
<error>
nop
ld l, h
nop
<error>
ld [$006e], sp
inc b
nop
ld [hl], d
nop
inc b
ld [$0074], sp
inc b
ldhl sp, d
ld a, d
nop
<error>
nop
ld l, h
nop
<error>
ld [$006e], sp
inc b
nop
ld a, h
nop
inc b
ld [$0074], sp
inc b
stop
ld [hl], b
jr nz, 0.l_6da7
nop
ld l, [hl]
jr nz, 0.l_6dab
ld [$206c], sp
inc b
nop
ld [hl], h
jr nz, 0.l_6dc3
ld [$2072], sp
inc b
stop
ld a, d
jr nz, 0.l_6dbb
nop
ld l, [hl]
jr nz, 0.l_6dbf
ld [$206c], sp
inc b
nop
ld [hl], h
jr nz, 0.l_6dd7
ld [$207c], sp
ldh a, [$ff00 + $f1]
rl a
rl a
and $fc
ld e, a
rl a
rl a
and $f0
add a, e
ld e, a
ld d, b
ld hl, $6d72
add hl, de
ld c, $05
call func_3d26
ret
nop
ld b, $0c
inc de
add hl, de
jr nz, 0.l_6e1b
inc l
inc sp
add hl, sp
nop
nop
nop
nop
nop
nop
ld b, b
ld b, e
ld b, [hl]
ld c, c
ld c, h
ld c, a
ld d, d
ld d, l
ld e, b
ld e, h
nop
nop
nop
nop
nop
nop
ld h, b
ld h, b
ld h, b
ld h, b
ld h, b
ld h, b
ld h, b
ld h, b
ld h, b
ld hl, $c2b0
add hl, bc
ld a, [hl]
cp $02
jp z, .l_747b
and a
jp nz, .l_70ce
ldh a, [$ff00 + $98]
cp $38
jr nc, 0.l_6e3d
cp $20
jr c, 0.l_6e3d
ld hl, $c11e
set 7, [hl]
cp $24
jr c, 0.l_6e3d
ld hl, $c11d
set 7, [hl]
ld a, [$db0f]
and a
ret z
ld e, a
ld d, b
ld hl, $6dee
add hl, de
ld a, [hl]
ldh [$ff00 + $e8], a
ldh a, [$ff00 + $f8]
and $10
call func_6fb1
ldh a, [$ff00 + $f0]
rst 0
ld h, l
ld l, [hl]
ld a, d
ld l, [hl]
add a, a
ld l, [hl]
ret nz
ld l, [hl]
daa
ld l, a
ld e, [hl]
ld l, a
ld e, a
ld l, a
sbc a, h
ld l, a
ldh a, [$ff00 + $98]
cp $3c
jr c, 0.l_6e79
call func_1495
call func_093b
call func_3b8d
call func_0891
ld [hl], $58
ret
ld a, $01
ld [$c167], a
ld a, [$c146]
and a
jp z, $3b8d
ret
ld a, $02
ldh [$ff00 + $a1], a
call func_0891
ret nz
ld hl, $c3d0
add hl, bc
ldh a, [$ff00 + $e8]
sub a, [hl]
jr nc, 0.l_6e9f
ldh a, [$ff00 + $e8]
ld [hl], a
call func_3b8d
ret
ld e, a
ldh a, [$ff00 + $e7]
and $03
jr nz, 0.l_6ebf
call func_27ed
and $01
jr nz, 0.l_6ebf
ld a, e
rr a
rr a
rr a
rr a
and $0f
and a
jr nz, 0.l_6eb9
ld a, $01
add a, [hl]
ld [hl], a
ld a, $06
ldh [$ff00 + $f3], a
ret
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
ld a, [$db0f]
cp $20
jr c, 0.l_6eee
call func_0891
ld [hl], $40
call func_3b8d
call func_7520
ld hl, $c2c0
add hl, bc
ld [hl], $01
ld a, $56
ld [$d368], a
xor a
ld [$c167], a
call func_088c
ld [hl], $3f
ret
ld hl, $dae9
cp $05
jr nz, 0.l_6f05
bit 5, [hl]
jr nz, 0.l_6f19
call func_3b8d
ld [hl], $06
ld a, $23
ldh [$ff00 + $f2], a
jp .l_6ee4
cp $10
jr nz, 0.l_6f19
bit 6, [hl]
jr nz, 0.l_6f19
call func_3b8d
ld [hl], $06
ld a, $23
ldh [$ff00 + $f2], a
jp .l_6ee4
ld a, $1d
ldh [$ff00 + $f2], a
call func_3b8d
ld [hl], $05
xor a
ld [$c167], a
ret
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
call func_0891
cp $3e
jr nz, 0.l_6f3a
ld hl, $fff2
ld [hl], $23
and a
jr nz, 0.l_6f5d
ld a, $cf
call func_3c01
ld hl, $c200
add hl, de
ld [hl], $50
ld hl, $c210
add hl, de
ld [hl], $48
ld hl, $c2b0
add hl, de
ld [hl], $01
ld hl, $c2e0
add hl, de
ld [hl], $4f
call func_3b8d
ret
ret
call func_088c
jr nz, 0.l_6f9b
call func_3b8d
ld a, $cf
call func_3c01
ld hl, $c200
add hl, de
ld [hl], $50
ld hl, $c210
add hl, de
ld [hl], $48
ld hl, $c2b0
add hl, de
ld [hl], $02
ld hl, $c2e0
add hl, de
ld [hl], $14
ld a, $02
call func_3c01
ld hl, $c200
add hl, de
ld [hl], $50
ld hl, $c210
add hl, de
ld [hl], $48
ld hl, $c2e0
add hl, de
ld [hl], $20
ret
ret
ld d, b
nop
ld d, b
jr nz, 0.l_6fde
nop
inc a
jr nz, 0.l_6fe0
nop
ldd a, [hl]
jr nz, 0.l_6fc8
nop
ld e, $60
ld e, $10
ld e, $70
ld hl, $c2c0
add hl, bc
ld a, [hl]
and a
jr nz, 0.l_6fe2
ld a, $88
ldh [$ff00 + $ee], a
ld a, $80
ldh [$ff00 + $ec], a
ld de, $6f9d
call func_3c3b
ld hl, $c3d0
add hl, bc
ld a, [hl]
ld e, a
ld a, $80
sub a, e
ldh [$ff00 + $ec], a
ld de, $6f9d
call func_3c3b
ldh a, [$ff00 + $ec]
add a, $10
ldh [$ff00 + $ec], a
cp $80
jr c, 0.l_6fd2
call func_088c
jr z, 0.l_700d
rr a
rr a
rr a
and $03
ldh [$ff00 + $f1], a
ld hl, $c3d0
add hl, bc
ld a, [hl]
ld e, a
ld a, $80
sub a, e
ldh [$ff00 + $ec], a
ld a, $78
ldh [$ff00 + $ee], a
ld de, $6fa1
call func_3c3b
ld a, $98
ldh [$ff00 + $ee], a
ld de, $6fa1
call func_3c3b
ret
ret c
add sp, d
ld a, h
ld b, b
ret c
ldh a, [$ff00 + $7c]
jr nz, 0.l_6fff
add sp, d
ld a, h
nop
add sp, d
ldh a, [$ff00 + $7c]
ld h, b
ldhl sp, d
ldhl sp, d
ld a, h
nop
ldhl sp, d
nop
ld a, h
ld h, b
ld [$7c08], sp
nop
ld [$7c10], sp
ld h, b
jr 0.l_7048
ld a, h
nop
jr 0.l_7054
ld a, h
ld h, b
jr z, 0.l_7050
ld a, h
ld b, b
jr z, 0.l_705c
ld a, h
jr nz, 0.l_7017
ldhl sp, d
ld a, h
nop
ret c
nop
ld a, h
ld h, b
add sp, d
ld [$007c], sp
add sp, d
stop
ld a, h
ld h, b
ldhl sp, d
ld [$407c], sp
ldhl sp, d
stop
ld a, h
jr nz, 0.l_705f
ldhl sp, d
ld a, h
ld b, b
ld [$7c00], sp
jr nz, 0.l_7077
ldhl sp, d
ld a, h
nop
jr 0.l_7064
ld a, h
ld h, b
jr z, 0.l_7070
ld a, h
nop
jr z, 0.l_707c
ld a, h
ld h, b
ret c
ld [$407c], sp
ret c
stop
ld a, h
jr nz, 0.l_705f
ldhl sp, d
ld a, h
ld b, b
add sp, d
nop
ld a, h
jr nz, 0.l_7077
ldhl sp, d
ld a, h
nop
ldhl sp, d
nop
ld a, h
ld h, b
ld [$7c08], sp
nop
ld [$7c10], sp
ld h, b
jr 0.l_7098
ld a, h
ld b, b
jr 0.l_70a4
ld a, h
jr nz, 0.l_70bf
ldhl sp, d
ld a, h
ld b, b
jr z, 0.l_709c
ld a, h
jr nz, 0.l_7077
jr $6711d
nop
ret c
jr nz, 0.l_7121
ld h, b
add sp, d
jr 0.l_7125
ld b, b
add sp, d
jr nz, 0.l_7129
jr nz, 0.l_70a7
ld [$407c], sp
ldhl sp, d
stop
ld a, h
jr nz, 0.l_70bf
ldhl sp, d
ld a, h
ld b, b
ld [$7c00], sp
jr nz, 0.l_70d7
add sp, d
ld a, h
ld b, b
jr 0.l_70b4
ld a, h
jr nz, 0.l_70ef
add sp, d
ld a, h
nop
jr z, 0.l_70bc
ld a, h
ld h, b
ldh a, [$ff00 + $f0]
rst 0
pop hl
ld [hl], b
ld [$6771], sp
ld [hl], c
add hl, sp
ld [hl], d
ld [hl], l
ld [hl], d
xor e
ld [hl], d
push bc
ld [hl], d
ccf
ld [hl], e
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
call func_0891
jr z, 0.l_7100
cp $30
ret c
sub a, $30
rr a
rr a
rr a
and $03
ldh [$ff00 + $f1], a
ld de, $6fa1
call func_3c3b
ret
call func_0891
ld [hl], $a0
jp $3b8d
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
call func_0891
jr nz, $6711d
ld [hl], $ff
ld a, $1e
ldh [$ff00 + $f3], a
call func_3b8d
call func_0891
and $04
ld e, $e4
jr z, 0.l_7128
ld e, $84
ld a, e
ld [$db97], a
ldh a, [$ff00 + $e7]
and $07
jr nz, 0.l_713e
ld a, $33
ldh [$ff00 + $f4], a
call func_27ed
and $03
call func_3b87
ldh a, [$ff00 + $e7]
ld hl, $c420
add hl, bc
ld [hl], a
ldh a, [$ff00 + $f1]
rl a
rl a
rl a
rl a
and $f0
ld e, a
rl a
and $e0
add a, e
ld e, a
ld d, b
ld hl, $700e
add hl, de
ld c, $0c
call func_3d26
ld a, $0a
call func_3dd0
ret
ld a, d
nop
ld a, d
jr nz, 0.l_71a6
ld [bc], a
ldh [$ff00 + $a1], a
ld [$c167], a
call func_711d
call func_0891
jr nz, 0.l_717e
call func_0887
ld [hl], $28
jp $3b8d
cp $50
jr nc, 0.l_718f
ld hl, $7219
ld c, $08
call func_3d26
ld a, $06
jp $3dd0
xor a
ldh [$ff00 + $f1], a
ld de, $7163
call func_3c3b
ret
ldhl sp, d
nop
ld l, [hl]
nop
ldhl sp, d
ld [$206e], sp
ldhl sp, d
nop
ld l, [hl]
nop
ldhl sp, d
ld [$206e], sp
ld [$7000], sp
nop
ld [$7008], sp
jr nz, 0.l_71ba
nop
ld [hl], b
nop
ld [$7008], sp
jr nz, 0.l_71b2
ldhl sp, d
ld l, b
nop
ldhl sp, d
nop
ld l, d
nop
ldhl sp, d
ld [$206a], sp
ldhl sp, d
stop
ld l, b
jr nz, 0.l_71d2
nop
ld l, h
nop
ld [$6c08], sp
jr nz, 0.l_71da
nop
ld l, h
nop
ld [$6c08], sp
jr nz, 0.l_71d2
ldhl sp, d
ld h, d
nop
ldhl sp, d
nop
ld h, h
nop
ldhl sp, d
ld [$2064], sp
ldhl sp, d
stop
ld h, d
jr nz, 0.l_71f2
nop
ld h, [hl]
nop
ld [$6608], sp
jr nz, 0.l_71fa
nop
ld h, [hl]
nop
ld [$6608], sp
jr nz, 0.l_71f2
ldhl sp, d
ld e, d
nop
ldhl sp, d
nop
ld e, h
nop
ldhl sp, d
ld [$205c], sp
ldhl sp, d
stop
ld e, d
jr nz, 0.l_7212
ldhl sp, d
ld e, [hl]
nop
ld [$6000], sp
nop
ld [$6008], sp
jr nz, 0.l_721e
stop
ld e, [hl]
jr nz, 0.l_7212
ldhl sp, d
ld d, [hl]
nop
ldhl sp, d
nop
ld e, b
nop
ldhl sp, d
ld [$2058], sp
ldhl sp, d
stop
ld d, [hl]
jr nz, 0.l_7232
ldhl sp, d
ld d, [hl]
ld b, b
ld [$5800], sp
ld b, b
ld [$5808], sp
ld h, b
ld [$5610], sp
ld h, b
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
ldh a, [$ff00 + $e7]
and $0f
or $20
ld hl, $c420
add hl, bc
ld [hl], a
call func_0887
jr nz, 0.l_7253
jp $3b8d
rr a
rr a
and $0f
cp $04
jr c, 0.l_725d
ld a, $04
rl a
rl a
rl a
rl a
rl a
and $e0
ld e, a
ld d, b
ld hl, $7199
add hl, de
ld c, $08
call func_3d26
ld a, $06
call func_3dd0
ret
ld a, $02
ldh [$ff00 + $a1], a
ld [$c167], a
call func_74ef
call func_790e
ld hl, $c250
add hl, bc
inc [hl]
ld a, [hl]
and $80
jr nz, 0.l_72aa
ld hl, $c210
add hl, bc
ld a, [hl]
cp $70
jr c, 0.l_72aa
ld [hl], $70
ld a, $17
ldh [$ff00 + $f4], a
ld hl, $c250
add hl, bc
ld a, [hl]
cp $04
jp c, $3b8d
cpl
inc a
sra a
ld [hl], a
ret
xor a
ld [$c167], a
call func_74ef
call func_3bd5
jr nc, 0.l_72c4
call func_3b8d
ld a, $0f
ld [$d368], a
call func_0891
ld [hl], $ff
ret
call func_0891
and $08
ld e, $e4
jr z, 0.l_72d0
ld e, $84
ld a, e
ld [$db97], a
call func_0891
jr nz, 0.l_7303
ld [hl], $20
ld a, $10
ld [$d368], a
ld a, $9f
call func_2197
ld a, [$dae9]
or $10
ld [$dae9], a
ldh [$ff00 + $f8], a
ld a, $02
ld [$db4e], a
ld a, $ff
ld [$db93], a
xor a
ld [$db0f], a
ld [$c167], a
call func_3b8d
ldh a, [$ff00 + $98]
ld hl, $c200
add hl, bc
sub a, $04
ld [hl], a
ldh a, [$ff00 + $99]
ld hl, $c210
add hl, bc
sub a, $13
ld [hl], a
call func_3dba
ldh a, [$ff00 + $a2]
ld hl, $c310
add hl, bc
ld [hl], a
ld a, $6b
ldh [$ff00 + $9d], a
ld a, $02
ldh [$ff00 + $a1], a
ld a, $03
ldh [$ff00 + $9e], a
xor a
ld [$c137], a
ld [$c16a], a
ld [$c122], a
ld [$c121], a
call func_744c
call func_74ea
ret
call func_74ea
ld a, [$c19f]
and a
jr nz, 0.l_734b
call func_79b4
ret
nop
inc b
ld [hl], d
nop
ldh [$ff00 + $04], a
ld [hl], d
nop
nop
ldh a, [$ff00 + $78]
jr nz, 0.l_7359
ldhl sp, d
ld a, b
ld b, b
nop
stop
ld a, b
ld h, b
nop
jr 0.l_73db
nop
ldh a, [$ff00 + $e8]
halt
jr nz, 0.l_7359
ldh a, [$ff00 + $76]
ld b, b
ldh a, [$ff00 + $18]
halt
ld h, b
ldh a, [$ff00 + $20]
halt
nop
add sp, d
<error>
ld [hl], h
jr nz, 0.l_7361
inc d
ld [hl], h
nop
ldhl sp, d
inc b
ld [hl], d
nop
ret c
inc b
ld [hl], d
nop
<error>
add sp, d
ld a, b
jr nz, 0.l_7385
ldh a, [$ff00 + $78]
ld b, b
<error>
jr 0.l_7407
ld h, b
<error>
jr nz, 0.l_740b
nop
add sp, d
ldh [$ff00 + $76], a
jr nz, 0.l_7381
add sp, d
halt
ld b, b
add sp, d
jr nz, 0.l_7415
ld h, b
add sp, d
jr z, 0.l_7419
nop
ldh [$ff00 + $f0], a
ld [hl], h
jr nz, 0.l_7389
jr 0.l_741f
nop
nop
nop
ld [hl], h
jr nz, 0.l_73b1
ld [$0074], sp
ldh a, [$ff00 + $04]
ld [hl], d
nop
ret nc
inc b
ld [hl], d
nop
ldhl sp, d
ldh [$ff00 + $78], a
jr nz, 0.l_73b9
add sp, d
ld a, b
ld b, b
ldhl sp, d
jr nz, 0.l_743f
ld h, b
ldhl sp, d
jr z, 0.l_7443
nop
ldh [$ff00 + $d8], a
halt
jr nz, 0.l_73b1
ldh [$ff00 + $76], a
ld b, b
ldh [$ff00 + $28], a
halt
ld h, b
ldh [$ff00 + $30], a
halt
nop
ret c
<error>
ld [hl], h
jr nz, 0.l_73b9
inc e
ld [hl], h
nop
ldhl sp, d
<error>
ld [hl], h
jr nz, 0.l_73e1
inc c
ld [hl], h
nop
nop
ldhl sp, d
halt
jr nz, 0.l_73f1
nop
halt
ld b, b
nop
ld [$6076], sp
nop
stop
halt
nop
<error>
inc b
ld [hl], d
nop
nop
ldhl sp, d
ld a, b
jr nz, 0.l_7405
nop
ld a, b
ld b, b
nop
ld [$6078], sp
nop
stop
ld a, b
nop
<error>
ldh a, [$ff00 + $76]
jr nz, 0.l_7409
ldhl sp, d
halt
ld b, b
<error>
stop
halt
ld h, b
<error>
jr 0.l_7495
nop
<error>
ldhl sp, d
ld [hl], h
jr nz, 0.l_7411
stop
ld [hl], h
nop
ldh a, [$ff00 + $d8]
ld a, b
jr nz, 0.l_741d
ldh [$ff00 + $78], a
ld b, b
ldh a, [$ff00 + $28]
ld a, b
ld h, b
ldh a, [$ff00 + $30]
ld a, b
nop
call z, func_74e8
jr nz, 0.l_7409
jr nz, 0.l_74b3
nop
ld c, h
ld [hl], e
ld a, h
ld [hl], e
or h
ld [hl], e
<error>
ld [hl], e
inc c
ld c, $12
ld de, $ecf0
sub a, $00
ldh [$ff00 + $ec], a
ldh a, [$ff00 + $e7]
rr a
rr a
nop
push af
and $03
ld e, a
ld d, b
ld hl, $7448
add hl, de
ld c, [hl]
pop af
rl a
and $06
ld e, a
ld d, b
ld hl, $7440
add hl, de
ldi a, [hl]
ld h, [hl]
ld l, a
call func_3d26
ld a, $10
call func_3dd0
ret
ld a, [hl]
nop
ld a, [hl]
jr nz, 0.l_7449
sub a, c
ld [$11c0], sp
ld [hl], a
ld [hl], h
call func_3c3b
call func_790e
ld hl, $c250
add hl, bc
inc [hl]
ld a, [hl]
and $80
jr nz, 0.l_74c9
ld hl, $c210
add hl, bc
ld a, [hl]
cp $70
jr c, 0.l_74c9
ld [hl], $70
ld hl, $c250
add hl, bc
ld [hl], b
call func_3bd5
jr nc, 0.l_74c9
ld a, $01
ldh [$ff00 + $f3], a
call func_79b4
ld hl, $dae9
ld a, [$db0f]
cp $05
jr nz, 0.l_74bc
set 5, [hl]
jr 0.l_74be
set 6, [hl]
add a, $01
daa
ld [$db0f], a
ld a, $ef
call func_2197
ret
ldhl sp, d
nop
ld d, d
nop
ldhl sp, d
ld [$2052], sp
ld [$5400], sp
nop
ld [$5408], sp
jr nz, 0.l_74d3
nop
ld d, h
ld b, b
ldhl sp, d
ld [$6054], sp
ld [$5200], sp
ld b, b
ld [$5208], sp
ld h, b
ld hl, $74da
jr 0.l_74f2
ld hl, $74ca
ld c, $04
call func_3d26
ld a, $02
call func_3dd0
ret
sbc a, b
ld d, b
adc a, l
ld l, h
ld l, [hl]
ld l, h
ld l, [hl]
ld l, h
ld l, [hl]
ld l, h
ld l, [hl]
ld l, h
ld l, [hl]
ld l, h
ld l, [hl]
ld l, h
ld l, [hl]
sbc a, b
ld d, c
adc a, l
ld l, l
ld l, a
ld l, l
ld l, a
ld l, l
ld l, a
ld l, l
ld l, a
ld l, l
ld l, a
ld l, l
ld l, a
ld l, l
ld l, a
nop
push bc
ld c, $23
ld a, $22
ld [$d600], a
ld hl, $d601
ld de, $74fd
ld a, [de]
inc de
ldi [hl], a
dec c
jr nz, 0.l_752e
pop bc
ld a, $89
ld [$d729], a
ld [$d739], a
ld [$d749], a
ld [$d759], a
ld [$d769], a
ld [$d779], a
ld [$d789], a
ret
<error>
inc b
nop
nop
rst 38
nop
nop
nop
nop
nop
inc b
<error>
nop
nop
nop
rst 38
inc c
jr 0.l_7584
jr nc, 0.l_759e
ld c, b
ld a, [$c124]
cp $03
jr nc, 0.l_756b
ret
ld a, [$c125]
ld e, a
ld d, $00
ld hl, $754d
add hl, de
ld a, [hl]
ldh [$ff00 + $d7], a
ld hl, $7551
add hl, de
ld a, [hl]
ldh [$ff00 + $d8], a
ld hl, $7555
add hl, de
ld a, [hl]
ldh [$ff00 + $d9], a
ld hl, $7559
add hl, de
ld a, [hl]
ldh [$ff00 + $da], a
ld hl, $c200
add hl, bc
ldh a, [$ff00 + $d7]
add a, [hl]
rl d
ld [hl], a
ld hl, $c220
add hl, bc
ldh a, [$ff00 + $d8]
rr d
adc a, [hl]
ld [hl], a
ld hl, $c210
add hl, bc
ldh a, [$ff00 + $d9]
add a, [hl]
rl d
ld [hl], a
ld hl, $c230
add hl, bc
ldh a, [$ff00 + $da]
rr d
adc a, [hl]
ld [hl], a
ldh a, [$ff00 + $eb]
cp $7f
jr nz, 0.l_75ce
ld hl, $c440
add hl, bc
ldh a, [$ff00 + $d7]
add a, [hl]
ld [hl], a
ld hl, $c2d0
add hl, bc
ldh a, [$ff00 + $d9]
add a, [hl]
ld [hl], a
jp .l_7673
cp $87
jr nz, 0.l_760e
ld hl, $c2d0
add hl, bc
ld a, [hl]
cp $02
jp z, .l_7673
ld hl, $c3d0
add hl, bc
ld a, [hl]
ldh [$ff00 + $e6], a
ld a, $06
ldh [$ff00 + $e8], a
ld e, a
ld d, b
ld hl, $755c
add hl, de
push hl
ldh a, [$ff00 + $e6]
sub a, [hl]
ld e, a
ld d, b
ld hl, $d000
add hl, de
ldh a, [$ff00 + $d7]
add a, [hl]
ld [hl], a
ldh a, [$ff00 + $e6]
pop hl
sub a, [hl]
ld e, a
ld d, b
ld hl, $d100
add hl, de
ldh a, [$ff00 + $d9]
add a, [hl]
ld [hl], a
ldh a, [$ff00 + $e8]
dec a
jr nz, 0.l_75e5
cp $c1
jr nz, 0.l_7632
ld a, [$db73]
and a
jr z, 0.l_7673
ld e, $10
ld hl, $d155
ldh a, [$ff00 + $d7]
add a, [hl]
ldi [hl], a
dec e
jr nz, 0.l_761d
ld e, $10
ld hl, $d175
ldh a, [$ff00 + $d9]
add a, [hl]
ldi [hl], a
dec e
jr nz, 0.l_7629
jr 0.l_7673
cp $69
jr z, 0.l_7663
cp $b0
jr z, 0.l_7663
cp $6d
jr nz, 0.l_7673
ld a, [$db56]
cp $01
jr nz, 0.l_764b
ldh a, [$ff00 + $e7]
and $07
jr z, 0.l_7673
ld e, $06
ld hl, $d100
ldh a, [$ff00 + $d7]
add a, [hl]
ldi [hl], a
dec e
jr nz, 0.l_7650
ld e, $06
ld hl, $d110
ldh a, [$ff00 + $d9]
add a, [hl]
ldi [hl], a
dec e
jr nz, 0.l_765c
ld hl, $c2b0
add hl, bc
ldh a, [$ff00 + $d7]
add a, [hl]
ld [hl], a
ld hl, $c2c0
add hl, bc
ldh a, [$ff00 + $d9]
add a, [hl]
ld [hl], a
ldh a, [$ff00 + $f6]
ld hl, $c3e0
add hl, bc
cp [hl]
jr z, 0.l_769a
ld hl, $c200
add hl, bc
ld a, [hl]
cp $a0
jr nc, 0.l_7690
ld hl, $c210
add hl, bc
ld a, [hl]
sub a, $10
cp $78
jr c, 0.l_769a
ldh a, [$ff00 + $eb]
cp $a7
ret z
ld hl, $c280
add hl, bc
ld [hl], b
ret
ld a, [$c1a5]
and a
jr z, 0.l_76d0
ld a, [$c19f]
and a
jr nz, 0.l_76d0
ldh a, [$ff00 + $e7]
and $03
rst 0
or h
halt
pop de
halt
xor $76
ld a, [$2176]
rst 8
call c, func_cf11
call c, func_f53a
ldd a, [hl]
push af
ld c, $07
ldd a, [hl]
ld [de], a
dec de
ldd a, [hl]
ld [de], a
dec de
dec c
jr nz, 0.l_76c0
pop hl
pop bc
ld a, b
ld [de], a
dec de
ld a, h
ld [de], a
ret
ld hl, $dcd0
ld de, $dcd0
ldi a, [hl]
push af
ldi a, [hl]
push af
ld c, $07
ldi a, [hl]
ld [de], a
inc de
ldi a, [hl]
ld [de], a
inc de
dec c
jr nz, 0.l_76dd
pop hl
pop bc
ld a, b
ld [de], a
inc de
ld a, h
ld [de], a
ret
ld hl, $dce0
ld e, $10
rlc [hl]
inc hl
dec e
jr nz, 0.l_76f3
ret
ld hl, $dcf0
ld e, $10
rrc [hl]
inc hl
dec e
jr nz, 0.l_76ff
ret
<error>
<error>
ld d, $00
<error>
inc c
ld d, $00
ld c, $fb
ld d, $00
inc c
dec c
ld d, $00
ei
<error>
ld d, $00
ld a, [$160b]
nop
dec bc
<error>
ld d, $00
add hl, bc
inc c
ld d, $00
<error>
cp $16
nop
<error>
ld a, [bc]
ld d, $00
dec bc
<error>
ld d, $00
ld [$160a], sp
nop
rst 38
nop
ld d, $00
nop
ld [$0016], sp
ld a, [bc]
rst 38
ld d, $00
ld [$1609], sp
nop
ld [bc], a
<error>
jr z, 0.l_774a
ei
inc b
jr z, 0.l_77ae
dec b
ld b, $28
nop
ld bc, $280a
jr nz, 0.l_7758
rst 38
jr z, 0.l_775a
ld sp, hl
inc b
jr z, 0.l_77be
ld [$2806], sp
nop
ld [bc], a
rlc a
jr z, 0.l_7786
nop
nop
jr z, 0.l_778a
ldhl sp, d
ld [bc], a
jr z, 0.l_77ce
inc b
inc b
jr z, 0.l_7792
ld a, [bc]
rlc a
jr z, 0.l_7796
cp $01
jr z, 0.l_779a
inc b
ld bc, $6028
inc b
dec b
jr z, 0.l_77a2
inc c
rlc a
jr z, 0.l_77a6
<error>
nop
jr z, 0.l_77aa
inc b
cp $28
ld h, b
ld [$2808], sp
jr nz, 0.l_77a1
add hl, bc
jr z, 0.l_77b6
<error>
rst 38
jr z, 0.l_779a
inc b
ld a, [$4028]
ld [$2809], sp
jr nz, 0.l_77b2
ld a, [bc]
jr z, 0.l_77a6
ei
cp $28
nop
inc bc
ld sp, hl
jr z, 0.l_77ee
ld [$280c], sp
nop
ld de, $280b
nop
ld a, [$28fd]
nop
ld bc, $28f7
ld b, b
add hl, bc
dec c
jr z, 0.l_77c2
rrc a
inc c
jr z, 0.l_77c6
ldh a, [$ff00 + $f1]
cp $ff
jr z, 0.l_77e4
cp $01
jr z, 0.l_77e4
ldh a, [$ff00 + $d7]
and $0c
sla a
sla a
ld e, a
ld d, b
ld hl, $7706
add hl, de
ld c, $04
call func_3d26
ret
inc a
jr nz, 0.l_77ee
ldh [$ff00 + $f1], a
ldh a, [$ff00 + $e7]
xor c
rr a
ret c
ldh a, [$ff00 + $d7]
and $1c
xor $1c
sla a
sla a
ld e, a
ld d, b
ld hl, $7746
add hl, de
ld c, $04
call func_3d26
ret
call func_3bd5
jr nc, 0.l_7830
call func_094a
ld a, [$c1a6]
and a
jr z, 0.l_7823
ld e, a
ld d, b
ld hl, $c39f
add hl, de
ld a, [hl]
cp $03
jr nz, 0.l_7823
ld hl, $c28f
add hl, de
ld [hl], $00
ld a, [$c14a]
ld e, a
call func_0942
call func_1495
ld a, e
scf
ret
and a
ret
ld b, $04
ld [bc], a
nop
ld hl, $c380
add hl, bc
ld e, [hl]
ld d, b
ld hl, $7832
add hl, de
push hl
ld hl, $c3d0
add hl, bc
inc [hl]
ld a, [hl]
rr a
rr a
rr a
rr a
pop hl
and $01
or [hl]
jp $3b87
ld e, b
ldh a, [$ff00 + $99]
ld hl, $ffef
sub a, [hl]
add a, $14
cp $28
jr nc, 0.l_789d
ldh a, [$ff00 + $98]
ld hl, $ffee
sub a, [hl]
add a, $10
cp $20
jr nc, 0.l_789d
inc e
push de
call func_798d
ldh a, [$ff00 + $9e]
xor $01
cp e
pop de
jr nz, 0.l_789d
ld hl, $c1ad
ld [hl], $01
ld a, [$c19f]
ld hl, $c14f
or [hl]
ld hl, $c146
or [hl]
ld hl, $c134
or [hl]
jr nz, 0.l_789d
ld a, [$db9a]
cp $80
jr nz, 0.l_789d
ldh a, [$ff00 + $cc]
and $10
jr z, 0.l_789d
scf
ret
and a
ret
ldh a, [$ff00 + $ea]
cp $05
jr nz, 0.l_78bf
ld a, [$db95]
cp $07
jr z, 0.l_78bf
ld hl, $c1a8
ld a, [$c19f]
or [hl]
ld hl, $c14f
or [hl]
jr nz, 0.l_78bf
ld a, [$c124]
and a
jr z, 0.l_78c0
pop af
ret
ld hl, $c410
add hl, bc
ld a, [hl]
and a
jr z, 0.l_790a
dec a
ld [hl], a
call func_3eb8
ld hl, $c240
add hl, bc
ld a, [hl]
push af
ld hl, $c250
add hl, bc
ld a, [hl]
push af
ld hl, $c3f0
add hl, bc
ld a, [hl]
ld hl, $c240
add hl, bc
ld [hl], a
ld hl, $c400
add hl, bc
ld a, [hl]
ld hl, $c250
add hl, bc
ld [hl], a
call func_790b
ld hl, $c430
add hl, bc
ld a, [hl]
and $20
jr nz, 0.l_78fd
call func_3b9e
ld hl, $c250
add hl, bc
pop af
ld [hl], a
ld hl, $c240
add hl, bc
pop af
ld [hl], a
pop af
ret
call func_7918
push bc
ld a, c
add a, $10
ld c, a
call func_7918
pop bc
ret
ld hl, $c240
add hl, bc
ld a, [hl]
and a
jr z, 0.l_7943
push af
swap a
and $f0
ld hl, $c260
add hl, bc
add a, [hl]
ld [hl], a
rl d
ld hl, $c200
add hl, bc
pop af
ld e, $00
bit 7, a
jr z, 0.l_793a
ld e, $f0
swap a
and $0f
or e
rr d
adc a, [hl]
ld [hl], a
ret
ld hl, $c320
add hl, bc
ld a, [hl]
and a
jr z, 0.l_7943
push af
swap a
and $f0
ld hl, $c330
add hl, bc
add a, [hl]
ld [hl], a
rl d
ld hl, $c310
jr 0.l_7930
ld e, $00
ldh a, [$ff00 + $98]
ld hl, $c200
add hl, bc
sub a, [hl]
bit 7, a
jr z, 0.l_796c
inc e
ld d, a
ret
ld e, $02
ldh a, [$ff00 + $99]
ld hl, $c210
add hl, bc
sub a, [hl]
bit 7, a
jr nz, 0.l_797c
inc e
ld d, a
ret
ld e, $02
ldh a, [$ff00 + $99]
ld hl, $ffec
sub a, [hl]
bit 7, a
jr nz, 0.l_798b
inc e
ld d, a
ret
call func_795e
ld a, e
ldh [$ff00 + $d7], a
ld a, d
bit 7, a
jr z, 0.l_799a
cpl
inc a
push af
call func_796e
ld a, e
ldh [$ff00 + $d8], a
ld a, d
bit 7, a
jr z, 0.l_79a8
cpl
inc a
pop de
cp d
jr nc, 0.l_79b0
ldh a, [$ff00 + $d7]
jr 0.l_79b2
ldh a, [$ff00 + $d8]
ld e, a
ret
ld hl, $c280
add hl, bc
ld [hl], b
ret
ld hl, $c2c0
add hl, bc
ld a, [hl]
rst 0
add a, $79
rst 10
ld a, c
add sp, d
ld a, c
call func_0891
ld [hl], $a0
ld hl, $c420
add hl, bc
ld [hl], $ff
ld hl, $c2c0
add hl, bc
inc [hl]
ret
call func_0891
jr nz, 0.l_79e7
ld [hl], $c0
ld hl, $c420
add hl, bc
ld [hl], $ff
call func_79d1
ret
call func_0891
jr nz, 0.l_79f6
call func_08d7
call func_27bd
jp .l_3f7a
call func_79fa
ret
and $07
jr nz, 0.l_7a1b
call func_27ed
and $1f
sub a, $10
ld e, a
ld hl, $ffee
add a, [hl]
ld [hl], a
call func_27ed
and $1f
sub a, $14
ld e, a
ld hl, $ffec
add a, [hl]
ld [hl], a
call func_7a1c
ret
call func_78a5
ldh a, [$ff00 + $ee]
ldh [$ff00 + $d7], a
ldh a, [$ff00 + $ec]
ldh [$ff00 + $d8], a
ld a, $02
call func_0953
ld a, $13
ldh [$ff00 + $f4], a
ret
ld a, $36
call func_3c01
ldh a, [$ff00 + $d7]
ld hl, $c200
add hl, de
ld [hl], a
ldh a, [$ff00 + $d8]
ld hl, $c210
add hl, de
ld [hl], a
ldh a, [$ff00 + $f9]
and a
jr z, 0.l_7a51
ld hl, $c250
add hl, bc
ld [hl], $f0
jr 0.l_7a5d
ld hl, $c320
add hl, de
ld [hl], $10
ld hl, $c310
add hl, de
ld [hl], $08
call func_79b4
ld hl, $fff4
ld [hl], $1a
ret
ld hl, $d800
ldh a, [$ff00 + $f6]
ld e, a
ld a, [$dba5]
ld d, a
ldh a, [$ff00 + $f7]
cp $1a
jr nc, 0.l_7a7b
cp $06
jr c, 0.l_7a7b
inc d
add hl, de
ld a, [hl]
or $20
ld [hl], a
ldh [$ff00 + $f8], a
ret
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
rst 38
|
src/lv-objx-win.ads | Fabien-Chouteau/ada-lvlg | 3 | 25491 | <reponame>Fabien-Chouteau/ada-lvlg
with Lv.Style;
with Lv.Area;
with Lv.Objx.Page;
with Lv.Objx.Btn;
with Lv.Objx.Cont;
with System;
package Lv.Objx.Win is
subtype Instance is Obj_T;
type Style_T is (Style_Bg,
Style_Content_Bg,
Style_Content_Scrl,
Style_Sb,
Style_Header,
Style_Btn_Rel,
Style_Btn_Pr);
-- Create a window objects
-- @param par pointer to an object, it will be the parent of the new window
-- @param copy pointer to a window object, if not NULL then the new object will be copied from it
-- @return pointer to the created window
function Create (Parent : Obj_T; Copy : Instance) return Instance;
-- Delete all children of the scrl object, without deleting scrl child.
-- @param self pointer to an object
procedure Clean (Self : Instance);
-- Add control button to the header of the window
-- @param self pointer to a window object
-- @param img_src an image source ('lv_img_t' variable, path to file or a symbol)
-- @param rel_action a function pointer to call when the button is released
-- @return pointer to the created button object
function Add_Btn
(Self : Instance;
Img_Src : System.Address;
Rel_Action : Action_Func_T) return Btn.Instance;
-- A release action which can be assigned to a window control button to close it
-- @param btn pointer to the released button
-- @return always LV_ACTION_RES_INV because the button is deleted with the window
function Close_Action (Self : Instance) return Res_T;
----------------------
-- Setter functions --
----------------------
-- Set the title of a window
-- @param self pointer to a window object
-- @param title string of the new title
procedure Set_Title
(Self : Instance;
Title : C_String_Ptr);
-- Set the control button size of a window
-- @param self pointer to a window object
-- @return control button size
procedure Set_Btn_Size (Self : Instance; Size : Lv.Area.Coord_T);
-- Set the layout of the window
-- @param self pointer to a window object
-- @param layout the layout from 'lv_layout_t'
procedure Set_Layout (Self : Instance; Layout : Lv.Objx.Cont.Layout_T);
-- Set the scroll bar mode of a window
-- @param self pointer to a window object
-- @param sb_mode the new scroll bar mode from 'lv_sb_mode_t'
procedure Set_Sb_Mode (Self : Instance; Sb_Mode : Lv.Objx.Page.Mode_T);
-- Set a style of a window
-- @param self pointer to a window object
-- @param type which style should be set
-- @param style pointer to a style
procedure Set_Style
(Self : Instance;
Type_P : Style_T;
Style : access Lv.Style.Style);
----------------------
-- Getter functions --
----------------------
-- Get the title of a window
-- @param self pointer to a window object
-- @return title string of the window
function Title (Self : Instance) return C_String_Ptr;
-- Get the content holder object of window (`lv_page`) to allow additional customization
-- @param self pointer to a window object
-- @return the Page object where the window's content is
function Content (Self : Instance) return Page.Instance;
-- Get the control button size of a window
-- @param self pointer to a window object
-- @return control button size
function Btn_Size (Self : Instance) return Lv.Area.Coord_T;
-- Get the pointer of a widow from one of its control button.
-- It is useful in the action of the control buttons where only button is known.
-- @param ctrl_btn pointer to a control button of a window
-- @return pointer to the window of 'ctrl_btn'
function From_Btn (Ctrl_Btn : Btn.Instance) return Instance;
-- Get the layout of a window
-- @param self pointer to a window object
-- @return the layout of the window (from 'lv_layout_t')
function Layout (Self : Instance) return Lv.Objx.Cont.Layout_T;
-- Get the scroll bar mode of a window
-- @param self pointer to a window object
-- @return the scroll bar mode of the window (from 'lv_sb_mode_t')
function Sb_Mode (Self : Instance) return Lv.Objx.Page.Mode_T;
-- Get width of the content area (page scrollable) of the window
-- @param self pointer to a window object
-- @return the width of the content area
function Width (Self : Instance) return Lv.Area.Coord_T;
-- Get a style of a window
-- @param self pointer to a button object
-- @param type which style window be get
-- @return style pointer to a style
function Style
(Self : Instance;
Type_P : Style_T) return access Lv.Style.Style;
---------------------
-- Other functions --
---------------------
-- Focus on an object. It ensures that the object will be visible in the window.
-- @param self pointer to a window object
-- @param obj pointer to an object to focus (must be in the window)
-- @param anim_time scroll animation time in milliseconds (0: no animation)
procedure Focus (Self : Instance; Obj : Obj_T; Anim_Time : Uint16_T);
-- Scroll the window horizontally
-- @param self pointer to a window object
-- @param dist the distance to scroll (< 0: scroll right; > 0 scroll left)
procedure Scroll_Hor (Self : Instance; Dist : Lv.Area.Coord_T);
-- Scroll the window vertically
-- @param self pointer to a window object
-- @param dist the distance to scroll (< 0: scroll down; > 0 scroll up)
procedure Scroll_Ver (Self : Instance; Dist : Lv.Area.Coord_T);
-------------
-- Imports --
-------------
pragma Import (C, Create, "lv_win_create");
pragma Import (C, Clean, "lv_win_clean");
pragma Import (C, Add_Btn, "lv_win_add_btn");
pragma Import (C, Close_Action, "lv_win_close_action");
pragma Import (C, Set_Title, "lv_win_set_title");
pragma Import (C, Set_Btn_Size, "lv_win_set_btn_size");
pragma Import (C, Set_Layout, "lv_win_set_layout");
pragma Import (C, Set_Sb_Mode, "lv_win_set_sb_mode");
pragma Import (C, Set_Style, "lv_win_set_style");
pragma Import (C, Title, "lv_win_get_title");
pragma Import (C, Content, "lv_win_get_content");
pragma Import (C, Btn_Size, "lv_win_get_btn_size");
pragma Import (C, From_Btn, "lv_win_get_from_btn");
pragma Import (C, Layout, "lv_win_get_layout");
pragma Import (C, Sb_Mode, "lv_win_get_sb_mode");
pragma Import (C, Width, "lv_win_get_width");
pragma Import (C, Style, "lv_win_get_style");
pragma Import (C, Focus, "lv_win_focus");
pragma Import (C, Scroll_Hor, "lv_win_scroll_hor_inline");
pragma Import (C, Scroll_Ver, "lv_win_scroll_ver_inline");
for Style_T'Size use 8;
for Style_T use (Style_Bg => 0,
Style_Content_Bg => 1,
Style_Content_Scrl => 2,
Style_Sb => 3,
Style_Header => 4,
Style_Btn_Rel => 5,
Style_Btn_Pr => 6);
end Lv.Objx.Win;
|
programs/oeis/205/A205565.asm | jmorken/loda | 1 | 8741 | ; A205565: Number of ways of writing n = u + v with u <= v, and u,v having in ternary representation no 3.
; 1,1,1,1,2,1,1,1,1,1,2,1,2,4,2,1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,2,4,2,1,2,1,2,4,2,4,8,4,2,4,2,1,2,1,2,4,2,1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,2,4,2,1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,2,4,2,1,2,1,2,4,2,4,8,4,2,4,2,1,2,1,2,4,2,1,2,1,2,4,2,4,8,4,2,4,2,4,8,4,8,16,8,4,8,4,2,4,2,4,8,4,2,4,2,1,2,1,2,4,2,1,2,1,2,4,2,4,8,4,2,4,2,1,2,1,2,4,2,1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,2,4,2,1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,2,4,2,1,2,1,2,4,2,4,8,4,2,4,2,1,2,1,2,4,2,1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,2,4,2,1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,2,4,2,1
cal $0,62756 ; Number of 1's in ternary (base-3) expansion of n.
cal $0,89143 ; a(n) = 9*2^n - 6.
mul $0,11
mov $1,$0
div $1,202
add $1,1
|
alloy4fun_models/trashltl/models/18/47P42hxNm6CZFtaov.als | Kaixi26/org.alloytools.alloy | 0 | 2357 | open main
pred id47P42hxNm6CZFtaov_prop19 {
all f : Protected | f in Trash implies historically f in Protected
}
pred __repair { id47P42hxNm6CZFtaov_prop19 }
check __repair { id47P42hxNm6CZFtaov_prop19 <=> prop19o } |
test/adcx.asm | killvxk/AssemblyLine | 147 | 167810 | <filename>test/adcx.asm
SECTION .text
GLOBAL test
test:
adcx r10, r14
adcx r10, rbp
adcx r11, r14
adcx r11, r9
adcx r12, r11
adcx r12, r9
adcx r12, r9
adcx r12, rax
adcx r12, rbx
adcx r12, [ rsp + 0x20 ]
adcx r13, r9
adcx r13, rbp
adcx r13, rsi
adcx r14, r11
adcx r14, rbp
adcx r14, rcx
adcx r15, r12
adcx r15, r13
adcx r15, r9
adcx r15, rax
adcx r15, rdx
adcx r15, [ rsp + 0x0 ]
adcx r8, r12
adcx r8, r13
adcx r8, r9
adcx r8, rcx
adcx r8, rdi
adcx r8, [ rsp + 0x38 ]
adcx r8, [ rsp + 0x48 ]
adcx r9, r12
adcx r9, r14
adcx rax, r10
adcx rbp, r11
adcx rbp, r13
adcx rbp, r14
adcx rbp, r9
adcx rbp, rbx
adcx rbp, rcx
adcx rbp, rdx
adcx rbx, r11
adcx rbx, r15
adcx rbx, r8
adcx rbx, rcx
adcx rcx, r10
adcx rcx, r12
adcx rcx, r12
adcx rcx, r13
adcx rcx, r14
adcx rcx, r8
adcx rcx, r9
adcx rcx, [ rsp + 0x20 ]
adcx rdi, r15
adcx rdi, r8
adcx rdx, r15
adcx rdx, r9
adcx rsi, rcx
|
src/vocoder_asm.asm | mgp123/PitchShifter | 0 | 100591 | section.text:
global vocoder_asm
extern precalcular_hanning
extern ditfft2_asm
extern iditfft2_asm
vocoder_asm:
;void vocoder_asm(float* modulator, float* carrier, unsigned int window_size, float* buffer, int size)
push r12
push r13
push r14
push r15
push rbx
mov r12, rdi
mov r13, rsi
mov edx, edx
mov r14, rdx
mov r15, rcx
%define MODULATOR r12
%define CARRIER r13
%define OUTPUT r15
%define WINDOW_SIZE r14
shl r8, 32
shr r8, 32
sub r8, WINDOW_SIZE
inc r8
mov rbx, r8
; generando espacio para hamming
mov rdi, WINDOW_SIZE
shl rdi, 2
sub rsp, rdi
; llamado a funcion de C que llena el arreglo con hanning
mov rdi, rsp
mov rsi , WINDOW_SIZE
call precalcular_hanning
mov rsi, rsp
; espacio en el stack para buffers
mov rdi, WINDOW_SIZE
shl rdi, 3
sub rsp, rdi
mov rdx, rsp
sub rsp, rdi
mov rcx, rsp
;ponemos punteros a los arreglos juntos en el stack
push rbx; SIZE
push rsi; hanning
push rdx; F1
push rcx; F2
%define F2 rsp
%define F1 rsp+8
%define hanning rsp+16
%define SIZE rsp+24
xor rbx, rbx
.ciclo:
cmp rbx, [SIZE]; tamaño del modulator - windows size + 1
jae .fin
mov rdi, MODULATOR
mov rsi, WINDOW_SIZE
mov rdx, [F1]
call ditfft2_asm
mov rdi, CARRIER
mov rsi, WINDOW_SIZE
mov rdx, [F2]
call ditfft2_asm
xor rdi, rdi
mov rsi, [F1]
mov rdx, [F2]
.aplicar_modulo:
cmp rdi, WINDOW_SIZE
je .antitransformar
movdqu xmm0, [rsi]
mulps xmm0, xmm0
haddps xmm0, xmm0
sqrtps xmm0, xmm0
pshufd xmm0, xmm0, 01010000b
movdqu xmm1, [rdx]
mulps xmm1, xmm0
movdqu [rdx], xmm1
add rsi, 16; avanzar 2 complejos
add rdx, 16
add rdi, 2
jmp .aplicar_modulo
.antitransformar:
mov rdi, [F2]
mov rsi, WINDOW_SIZE
mov rdx, [F1]
call iditfft2_asm
; problemas por aca
xor rdi,rdi
mov rsi, [F1]
mov rdx, [hanning]
.agregar_output:
cmp rdi, WINDOW_SIZE
je .fin_ciclo
movdqu xmm0, [rsi]
pshufd xmm0, xmm0, 1000b ; reordenamos la parte real abajo
movsd xmm1, [rdx] ; multiplicacion por hannig
mulps xmm0, xmm1
movsd xmm1, [OUTPUT] ; agregar al output
addps xmm1, xmm0
movsd [OUTPUT], xmm1
add OUTPUT, 8; se avanza 2 floats
add rsi, 16; 2 complejos en F1
add rdx, 8 ; 2 floats en hanning
add rdi, 2
jmp .agregar_output
.fin_ciclo:
mov rdi, WINDOW_SIZE
shr rdi, 1; hop = window_size/2
add rbx, rdi
shl rdi, 2; un float son 4 bytes
sub OUTPUT, rdi ; el OUTPUT esta desfazado adelante por el ultimo paso
add MODULATOR, rdi
add CARRIER, rdi
jmp .ciclo
.fin:
mov rdi, WINDOW_SIZE
shl rdi, 2
add rsp, rdi ; el espacio por hanning
shl rdi, 2
add rsp, rdi ; el espacio por F1 y F2
; el espacio por los punteros
pop rdi
pop rdi
pop rdi
pop rdi
pop rbx
pop r15
pop r14
pop r13
pop r12
ret
|
test/Succeed/SubTermAndProjections.agda | cruhland/agda | 1,989 | 10820 | {- Reported by <NAME>, 2011-07-06
From the release notes for Agda 2.2.10:
"Projections now preserve sizes, both in patterns and expressions."
However, the following code is rejected:
-}
module SubTermAndProjections where
record _×_ (A B : Set) : Set where
constructor _,_
field
proj₁ : A
proj₂ : B
open _×_
postulate
i : {A : Set} → A → A
data I : Set where
c1 : I → I
c2 : I → I → I
data D : I → Set where
d : (j : I × I) → D (c1 (proj₁ j)) → D (proj₂ j) → D (c2 (c1 (proj₁ j)) (proj₂ j))
f : ∀ i → D i → Set
f .(c2 (c1 (proj₁ j)) (proj₂ j)) (d j l r) = f (c1 (proj₁ j)) (i l)
{- Is this intentional? I guess the issue here is the subterm relation
rather than the sizes. Should we modify the subterm relation?
-}
-- Andreas, 2011-07-07 this should termination check.
|
oeis/031/A031169.asm | neoneye/loda-programs | 11 | 81763 | <reponame>neoneye/loda-programs
; A031169: a(n) = prime(n+7) - prime(n).
; Submitted by <NAME>(s2)
; 17,20,24,24,26,28,26,28,30,30,30,30,30,30,32,30,30,36,34,32,34,30,30,38,34,36,36,42,42,44,36,36,36,40,32,40,36,34,32,38,44,46,38,40,42,42,40,34,36,40,38,38,40,32,36,44,42,42,40,50,54,54,42,42,46,50,42,42,36,40,44,42,42,46,42,48,44,42,42,40,38,40,32,34,40,44,42,42,42,46,54,44,54,56,58,60,60,50,54,46
mov $1,$0
seq $0,40 ; The prime numbers.
add $1,7
seq $1,40 ; The prime numbers.
sub $1,$0
mov $0,$1
|
agda/paper/2009-Dependent_Types_at_Work-Bove_and_Dybjer/range.agda | haroldcarr/learn-haskell-coq-ml-etc | 36 | 5716 | <reponame>haroldcarr/learn-haskell-coq-ml-etc
-- https://stackoverflow.com/questions/61037572/how-to-define-the-range-function-on-a-relation-in-agda-set-theory
module range where
open import Data.Unit
open import Data.Product renaming (_,_ to ⟨_,_⟩)
open import Data.Sum
open import Function
Subset : Set → Set₁
Subset A = A → Set
_∈_ : ∀ {A} → A → Subset A → Set
a ∈ P = P a
Relation : ∀ A B → Set₁
Relation A B = Subset (A × B)
Range : ∀ {A B} → Relation A B → Subset B
Range R b = ∃ (R ∘ ⟨_, b ⟩) -- equivalent to ∃ \a → R ⟨ a , b ⟩
_⊆_ : ∀ {A} → Subset A → Subset A → Set
A ⊆ B = ∀ x → x ∈ A → x ∈ B
wholeSet : ∀ A → Subset A
wholeSet _ _ = ⊤
∀subset⊆set : ∀ {A sub} → sub ⊆ wholeSet A
∀subset⊆set _ _ = tt
_∩_ : ∀ {A} → Subset A → Subset A → Subset A
(A ∩ B) x = x ∈ A × x ∈ B
open import Data.Nat
x : Set₁
x = Subset ℕ
y : Set₁
y = Relation ℕ ℕ
z : Subset ℕ
z = Range {ℕ} λ { ⟨ n1 , n2 ⟩ → (x₁ : Σ ℕ (λ _ → ℕ)) → {!!} ∈ {!!}}
|
AlphaParser.g4 | Baxi19/Alpha | 4 | 5676 | //--------------------------------------------------------------
parser grammar AlphaParser;
//--------------------------------------------------------------
options {
tokenVocab = AlphaScanner;
}
@header {
import parser.TablaSimbolos;
}
@members {
private parser.TablaSimbolos symbols = new parser.TablaSimbolos();
}
program
: singleCommand #programAST;
command : singleCommand (PyCOMMA singleCommand)* #commandAST;
singleCommand
:
IDENT ASSING expression
{if ( symbols.buscar($IDENT.text) == null ) {
System.err.println("undefined variable: "+$IDENT.text+ " in : ["+$IDENT.line+","+$IDENT.pos + "]");
}} #assignSingleCommandAST
| ident L_PARENT expression R_PARENT #callSingleCommandAST
| IF expression THEN singleCommand ELSE singleCommand #ifSingleCommandAST
| WHILE expression DO singleCommand #whileSingleCommandAST
|
{symbols.openScope();}
LET declaration IN singleCommand
{symbols.imprimir(); symbols.closeScope();} #letSingleCommandAST
| BEGIN command END #blockSingleCommandAST;
declaration : singleDeclaration (PyCOMMA singleDeclaration)* #declarationAST;
singleDeclaration : CONST IDENT VIR expression #constSingleDeclarationAST
| VAR IDENT TWO_P typeDenoter {symbols.insertar($IDENT,0,$ctx);} #varSingleDeclarationAST;
typeDenoter : IDENT #typeDenoterAST;
expression : primaryExpression (operator primaryExpression)* #expressionAST;
primaryExpression : LITERAL #numPrimaryExpressionAST
| IDENT
{if ( symbols.buscar($IDENT.text) == null ) {
System.err.println("undefined variable: "+$IDENT.text+ " in : ["+$IDENT.line+","+$IDENT.pos + "]");
}} #idPrimaryExpressionAST
| L_PARENT expression R_PARENT #groupPrimaryExpressionAST;
operator : SUM | SUB | MUL | DIV #operatorAST;
ident locals [SingleDeclarationContext decl = null]: IDENT #identAST; |
Library/Breadbox/ExtGraph/ASMTOOLS/asmtoolsManager.asm | steakknife/pcgeos | 504 | 86784 | <gh_stars>100-1000
include stdapp.def
include gstring.def
SetGeosConvention ; set calling convention
global PALGSTRINGCOLELEMENT: far
idata segment
global MY_GRPARSEGSTRING:far
;---------------------------------------------------------------------------
_MYPARSEGSTRING_callback proc far
uses si,di,ds,es
.enter
push ds ; push ptr argument for routine
push si
push di ; push gstate argument
push bx ; push memory handle
call PALGSTRINGCOLELEMENT
.leave
ret
_MYPARSEGSTRING_callback endp
;---------------------------------------------------------------------------
MY_GRPARSEGSTRING proc far _gstate:word,
_gstring:word,
_flags:word,
_h:word
uses bx,cx,dx,si,di
.enter
mov di,_gstate ; load arguments
mov si,_gstring
mov dx,_flags
mov bx,segment _MYPARSEGSTRING_callback
mov cx,offset _MYPARSEGSTRING_callback
; pointer to callback thunk
mov bp,_h ; handle passed to callback
call GrParseGString ; do it!
.leave
ret
MY_GRPARSEGSTRING endp
idata ends
|
libsrc/_DEVELOPMENT/l/sdcc/____sdcc_ldi_256.asm | jpoikela/z88dk | 640 | 28100 |
SECTION code_clib
SECTION code_l_sdcc
PUBLIC ____sdcc_ldi_256
EXTERN l_ldi_256
defc ____sdcc_ldi_256 = l_ldi_256
|
src/Basics/Bool.agda | jstolarek/dep-typed-wbl-heaps | 1 | 6506 | ----------------------------------------------------------------------
-- Copyright: 2013, <NAME>, Lodz University of Technology --
-- --
-- License: See LICENSE file in root of the repo --
-- Repo address: https://github.com/jstolarek/dep-typed-wbl-heaps --
-- --
-- Definition of Bool datatype, which represents logical true and --
-- false. --
----------------------------------------------------------------------
module Basics.Bool where
data Bool : Set where
false : Bool
true : Bool
|
os/windows/x86_64/fpu/fpu_cmp_olt_32.asm | hcs64/cen64 | 340 | 84565 | <gh_stars>100-1000
;
; os/windows/x86_64/fpu/fpu_cmp_olt_32.asm
;
; This file is subject to the terms and conditions defined in
; 'LICENSE', which is part of this source code package.
;
.code
fpu_cmp_olt_32 proc
movss xmm0, DWORD PTR [rcx]
movss xmm1, DWORD PTR [rdx]
comiss xmm1, xmm0
seta dl
setnp al
and al, dl
ret
fpu_cmp_olt_32 endp
end
|
programs/oeis/280/A280211.asm | neoneye/loda | 22 | 244690 | ; A280211: a(n) = n*(2^(n^2)).
; 0,2,32,1536,262144,167772160,412316860416,3940649673949184,147573952589676412928,21760664753063325144711168,12676506002282294014967032053760
mov $1,$0
pow $1,2
lpb $1
mul $0,2
sub $1,1
lpe
|
src/ada-core/src/linted-errors.ads | mstewartgallus/linted | 0 | 28194 | <gh_stars>0
-- Copyright 2015,2016 <NAME>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-- implied. See the License for the specific language governing
-- permissions and limitations under the License.
with Interfaces.C;
with Libc.Errno.POSIX_2008;
package Linted.Errors is
pragma Preelaborate;
subtype Valid_Error is
Interfaces.C
.unsigned range
0 ..
Interfaces.C.unsigned (Interfaces.C.int'Last);
type Error is new Valid_Error with
Default_Value => 0;
Success : constant Error;
Permission : constant Error;
Protocol : constant Error;
Unimplemented : constant Error;
Out_Of_Memory : constant Error;
Invalid_Parameter : constant Error;
function To_String (E : Error) return String with
Spark_Mode => Off;
private
Success : constant Error := 0;
Permission : constant Error := Libc.Errno.POSIX_2008.EPERM;
Protocol : constant Error := Libc.Errno.POSIX_2008.EPROTO;
Unimplemented : constant Error := Libc.Errno.POSIX_2008.ENOSYS;
Out_Of_Memory : constant Error := Libc.Errno.POSIX_2008.ENOMEM;
Invalid_Parameter : constant Error := Libc.Errno.POSIX_2008.EINVAL;
end Linted.Errors;
|
oeis/141/A141919.asm | neoneye/loda-programs | 11 | 99510 | ; A141919: Primes congruent to 15 mod 23.
; Submitted by <NAME>
; 61,107,199,337,383,521,613,659,751,797,1303,1487,1579,1901,1993,2039,2131,2269,2591,2683,2729,3373,3511,3557,3833,4201,4339,4523,4799,4937,5167,5351,5443,5581,5857,5903,6133,6271,6317,6547,6823,6869,6961,7237,7283,7559,7789,7927,8111,8387,8663,8893,9491,9629,9721,9767,9859,10181,10273,10457,10687,10733,11239,11423,11699,12113,12251,12343,12527,12619,12757,12941,13033,13171,13217,13309,13723,13907,13999,14321,14551,14827,15149,15241,15287,16069,16253,16529,16759,16943,17449,17863,17909,18047
mov $2,$0
add $2,6
pow $2,2
mov $4,14
lpb $2
mov $3,$4
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $1,$0
max $1,0
cmp $1,$0
mul $2,$1
sub $2,1
add $4,46
lpe
mov $0,$4
add $0,1
|
programs/oeis/238/A238411.asm | karttu/loda | 1 | 88912 | ; A238411: a(n) = 2*n*floor(n/2).
; 0,4,6,16,20,36,42,64,72,100,110,144,156,196,210,256,272,324,342,400,420,484,506,576,600,676,702,784,812,900,930,1024,1056,1156,1190,1296,1332,1444,1482,1600,1640,1764,1806,1936,1980,2116,2162,2304,2352,2500
add $0,1
mov $1,$0
div $0,2
mul $1,$0
mul $1,2
|
eBindings/dl/tests/dl-test_all.adb | persan/zeromq-Ada | 33 | 9528 | with AUnit.Run;
-- with AUnit.Reporter.Text;
with AUnit.Reporter.XML;
with Dl.Test_All_Suit;
-----------------
-- Dl.Test_All --
-----------------
procedure Dl.Test_All is
procedure Run is new AUnit.Run.Test_Runner (Dl.Test_All_Suit.Suite);
-- Reporter : AUnit.Reporter.Text.Text_Reporter;
Reporter : AUnit.Reporter.XML.XML_Reporter;
begin
Run (Reporter);
end Dl.Test_All; |
sum-thms.agda | heades/AUGL | 0 | 692 | module sum-thms where
open import eq
open import sum
open import list
open import product
open import empty
open import negation
inj₁-inj : ∀{ℓ ℓ'}{A : Set ℓ}{B : Set ℓ'}{x : A}{x'} → inj₁{ℓ}{ℓ'}{A}{B} x ≡ inj₁ x' → x ≡ x'
inj₁-inj refl = refl
⊎-assoc-iso₁ : ∀{ℓ}{U V W : Set ℓ}{x : U ⊎ V ⊎ W} → ⊎-assoc-inv (⊎-assoc x) ≡ x
⊎-assoc-iso₁ {x = inj₁ x} = refl
⊎-assoc-iso₁ {x = inj₂ (inj₁ x)} = refl
⊎-assoc-iso₁ {x = inj₂ (inj₂ y)} = refl
⊎-assoc-iso₂ : ∀{ℓ}{U V W : Set ℓ}{x : (U ⊎ V) ⊎ W} → ⊎-assoc (⊎-assoc-inv x) ≡ x
⊎-assoc-iso₂ {x = inj₁ (inj₁ x)} = refl
⊎-assoc-iso₂ {x = inj₁ (inj₂ y)} = refl
⊎-assoc-iso₂ {x = inj₂ y} = refl
⊎-left-ident-iso₁ : ∀{ℓ}{X : Set ℓ}{x} → ⊎-left-ident-inv {_}{X} (⊎-left-ident x) ≡ x
⊎-left-ident-iso₁ {x = inj₁ x} = ⊥-elim x
⊎-left-ident-iso₁ {x = inj₂ y} = refl
⊎-left-ident-iso₂ : ∀{ℓ}{X : Set ℓ}{x} → ⊎-left-ident {_}{X} (⊎-left-ident-inv x) ≡ x
⊎-left-ident-iso₂ = refl
⊎-right-ident-iso₁ : ∀{ℓ}{X : Set ℓ}{x} → ⊎-right-ident-inv {_}{X} (⊎-right-ident x) ≡ x
⊎-right-ident-iso₁ {x = inj₁ x} = refl
⊎-right-ident-iso₁ {x = inj₂ y} = ⊥-elim y
⊎-right-ident-iso₂ : ∀{ℓ}{X : Set ℓ}{x} → ⊎-right-ident {_}{X} (⊎-right-ident-inv x) ≡ x
⊎-right-ident-iso₂ = refl
¬⊎→× : ∀{ℓ}{A B : Set ℓ} → ¬ (_⊎_ {ℓ} A B) → ¬ A × ¬ B
¬⊎→× {ℓ}{A}{B} p = (λ x → p (inj₁ x)) , λ x → p (inj₂ x)
|
programs/oeis/301/A301293.asm | neoneye/loda | 22 | 19563 | <gh_stars>10-100
; A301293: Expansion of (x^2+x+1)^2 / ((x^2+1)*(x-1)^2).
; 1,4,9,14,18,22,27,32,36,40,45,50,54,58,63,68,72,76,81,86,90,94,99,104,108,112,117,122,126,130,135,140,144,148,153,158,162,166,171,176,180,184,189,194,198,202,207,212,216,220,225,230,234,238,243,248,252,256,261,266,270,274,279,284,288,292,297,302,306,310,315,320,324,328,333,338,342,346,351,356,360,364,369,374,378,382,387,392,396,400,405,410,414,418,423,428,432,436,441,446
mul $0,5
sub $0,2
mul $0,27
div $0,6
add $0,2
div $0,2
mul $0,2
div $0,5
add $0,2
|
programs/oeis/266/A266286.asm | neoneye/loda | 22 | 97580 | ; A266286: Number of OFF (white) cells in the n-th iteration of the "Rule 13" elementary cellular automaton starting with a single ON (black) cell.
; 0,2,3,3,6,4,9,5,12,6,15,7,18,8,21,9,24,10,27,11,30,12,33,13,36,14,39,15,42,16,45,17,48,18,51,19,54,20,57,21,60,22,63,23,66,24,69,25,72,26,75,27,78,28,81,29,84,30,87,31,90,32,93,33,96,34,99,35,102,36,105,37,108,38,111,39,114,40,117,41,120,42,123,43,126,44,129,45,132,46,135,47,138,48,141,49,144,50,147,51
mov $3,$0
lpb $3
mov $2,$0
mov $0,3
sub $0,$2
add $1,$0
sub $3,1
lpe
mov $0,$1
|
src/main/antlr/cadl.g4 | nedap/adl-antlr | 0 | 6032 | //
// description: Antlr4 grammar for cADL non-primitves sub-syntax of Archetype Definition Language (ADL2)
// author: <NAME> <<EMAIL>>
// support: openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
// copyright: Copyright (c) 2015 openEHR Foundation
// license: Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
//
grammar cadl;
import adl_rules;
//
// ======================= Top-level Objects ========================
//
c_complex_object: rm_type_id '[' ( ROOT_ID_CODE | ID_CODE ) ']' c_occurrences? ( SYM_MATCHES '{' c_attribute_def+ '}' )? ;
// ======================== Components =======================
c_objects: ( sibling_order? c_non_primitive_object )+ | c_primitive_object ;
sibling_order: ( SYM_AFTER | SYM_BEFORE ) '[' ID_CODE ']' ;
c_non_primitive_object:
c_complex_object
| c_archetype_root
| c_complex_object_proxy
| archetype_slot
;
c_archetype_root: SYM_USE_ARCHETYPE rm_type_id '[' ID_CODE ',' archetype_ref ']' c_occurrences? ;
c_complex_object_proxy: SYM_USE_NODE rm_type_id '[' ID_CODE ']' c_occurrences? adl_path ;
archetype_slot: SYM_ALLOW_ARCHETYPE rm_type_id '[' ID_CODE ']' (( c_occurrences? ( SYM_MATCHES '{' c_includes? c_excludes? '}' )? ) | SYM_CLOSED ) ;
c_attribute_def:
c_attribute
| c_attribute_tuple
;
c_attribute: adl_dir? rm_attribute_id ( c_existence | c_cardinality | c_existence c_cardinality )
| adl_dir? rm_attribute_id c_existence? c_cardinality? SYM_MATCHES '{' c_objects '}'
;
adl_dir : '/' | ( adl_path_segment+ '/' ) ;
c_attribute_tuple : '[' rm_attribute_id ( ',' rm_attribute_id )* ']' SYM_MATCHES '{' c_primitive_tuple ( ',' c_primitive_tuple )* '}' ;
c_primitive_tuple : '[' '{' c_primitive_object '}' ( ',' '{' c_primitive_object '}' )* ']' ;
c_includes : SYM_INCLUDE assertion+ ;
c_excludes : SYM_EXCLUDE assertion+ ;
c_existence: SYM_EXISTENCE SYM_MATCHES '{' existence '}' ;
existence: INTEGER | INTEGER '..' INTEGER ;
c_cardinality : SYM_CARDINALITY SYM_MATCHES '{' cardinality '}' ;
cardinality : multiplicity ( multiplicity_mod multiplicity_mod? )? ; // max of two
ordering_mod : ';' ( SYM_ORDERED | SYM_UNORDERED ) ;
unique_mod : ';' SYM_UNIQUE ;
multiplicity_mod : ordering_mod | unique_mod ;
c_occurrences : SYM_OCCURRENCES SYM_MATCHES '{' multiplicity '}' ;
multiplicity : INTEGER | '*' | INTEGER SYM_INTERVAL_SEP ( INTEGER | '*' ) ;
|
dv3/qpc/hd/wsect.asm | olifink/smsqe | 0 | 98638 | ; DV3 QPC Hard Disk Write Sector 1993 <NAME>
; 2000 <NAME>
section dv3
xdef hd_wdirect ; direct write sector
xdef hd_wsint ; internal write sector
xref hd_hold ; reserve the interface
xref hd_release ; release the interface
include 'dev8_keys_err'
include 'dev8_dv3_keys'
include 'dev8_dv3_hd_keys'
include 'dev8_smsq_qpc_keys'
include 'dev8_mac_assert'
;+++
; This routine writes a sector to a hard disk for direct sector IO
;
; d0 cr cylinder + side + sector / error code
; d2 c p number of sectors (=1)
; d7 c p drive ID / number
; a1 c p address to write into
; a3 c p linkage block
; a4 c p drive definition
;
; status return 0, ERR.NC or ERR.MCHK
;
;---
hd_wdirect
jsr hd_hold ; hold
bne.s hdw_rts
bsr.s hdw_write ; write sector
jmp hd_release ; and release
;+++
; This routine writes a sector to a hard disk for internal operations
;
; d0 cr cylinder + side + sector / error code
; d2 c p number of sectors = 1
; d7 c p drive ID / number
; a1 c p address to write into
; a3 c p linkage block
; a4 c p drive definition
;
; status return 0, ERR.NC or ERR.MCHK
;
;---
hd_wsint
;+++
; write sector (basic operation)
;
; d0 cr sector to write / error code
; d2 cp number of sectors to write
; d7 c p drive ID / number
; a1 c p address to write into
; a3 c p linkage block
; a4 c p drive definition
;
; status return 0 or ERR.MCHK
;
;---
hdw_write
dc.w qpc.hwsec
tst.l d0
hdw_rts
rts
end
|
experiments/test-suite/mutation-based/10/6/fullTree.als | kaiyuanw/AlloyFLCore | 1 | 3847 | pred test2 {
some disj Node0, Node1: Node {
Node = Node0 + Node1
left = Node0->Node1 + Node1->Node1
right = Node0->Node1
}
}
run test2 for 3 expect 1
pred test43 {
some disj Node0, Node1: Node {
Node = Node0 + Node1
left = Node1->Node1
right = Node0->Node1 + Node1->Node1
}
}
run test43 for 3 expect 1
pred test33 {
some disj Node0, Node1: Node {
Node = Node0 + Node1
left = Node1->Node1
right = Node0->Node0 + Node0->Node1
}
}
run test33 for 3 expect 0
pred test32 {
some disj Node0, Node1: Node {
Node = Node0 + Node1
no left
right = Node1->Node0
FullTree[]
}
}
run test32 for 3 expect 0
|
samples/beans/messages.adb | jquorning/ada-asf | 12 | 21733 | <filename>samples/beans/messages.adb<gh_stars>10-100
-----------------------------------------------------------------------
-- messages - A simple memory-based forum
-- Copyright (C) 2012, 2014 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Calendar;
with Util.Beans.Objects.Time;
with ASF.Events.Faces.Actions;
package body Messages is
use Ada.Strings.Unbounded;
Database : aliased Forum;
-- ------------------------------
-- Get the value identified by the name.
-- ------------------------------
function Get_Value (From : in Message_Bean;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "text" then
return Util.Beans.Objects.To_Object (From.Text);
elsif Name = "email" then
return Util.Beans.Objects.To_Object (From.Email);
elsif Name = "id" then
return Util.Beans.Objects.To_Object (Integer (From.Id));
else
return Util.Beans.Objects.Null_Object;
end if;
end Get_Value;
-- ------------------------------
-- Set the value identified by the name.
-- ------------------------------
procedure Set_Value (From : in out Message_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
if Name = "text" then
From.Text := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "email" then
From.Email := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "id" then
From.Id := Message_Id (Util.Beans.Objects.To_Integer (Value));
end if;
end Set_Value;
-- ------------------------------
-- Post the message.
-- ------------------------------
procedure Post (From : in out Message_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is
begin
if Length (From.Text) > 200 then
Ada.Strings.Unbounded.Replace_Slice (From.Text, 200, Length (From.Text), "...");
end if;
Database.Post (From);
Outcome := To_Unbounded_String ("posted");
end Post;
package Post_Binding is
new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Message_Bean,
Method => Post,
Name => "post");
Binding_Array : aliased constant Util.Beans.Methods.Method_Binding_Array
:= (Post_Binding.Proxy'Unchecked_Access, Post_Binding.Proxy'Unchecked_Access);
-- ------------------------------
-- This bean provides some methods that can be used in a Method_Expression
-- ------------------------------
overriding
function Get_Method_Bindings (From : in Message_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access is
pragma Unreferenced (From);
begin
return Binding_Array'Access;
end Get_Method_Bindings;
-- ------------------------------
-- Create a message bean instance.
-- ------------------------------
function Create_Message_Bean return Util.Beans.Basic.Readonly_Bean_Access is
Result : constant Message_Bean_Access := new Message_Bean;
begin
return Result.all'Access;
end Create_Message_Bean;
-- ------------------------------
-- Get the value identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Forum_Bean;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "count" then
return Util.Beans.Objects.To_Object (Integer (From.Get_Count));
elsif Name = "today" then
return Util.Beans.Objects.Time.To_Object (Ada.Calendar.Clock);
else
return Util.Beans.Objects.Null_Object;
end if;
end Get_Value;
-- ------------------------------
-- Get the number of elements in the list.
-- ------------------------------
overriding
function Get_Count (From : in Forum_Bean) return Natural is
pragma Unreferenced (From);
begin
return Database.Get_Message_Count;
end Get_Count;
-- ------------------------------
-- Set the current row index. Valid row indexes start at 1.
-- ------------------------------
overriding
procedure Set_Row_Index (From : in out Forum_Bean;
Index : in Natural) is
begin
From.Pos := Message_Id (Index);
From.Msg := Database.Get_Message (From.Pos);
end Set_Row_Index;
-- ------------------------------
-- Get the element at the current row index.
-- ------------------------------
overriding
function Get_Row (From : in Forum_Bean) return Util.Beans.Objects.Object is
begin
return From.Current;
end Get_Row;
-- ------------------------------
-- Create the list of messages.
-- ------------------------------
function Create_Message_List return Util.Beans.Basic.Readonly_Bean_Access is
F : constant Forum_Bean_Access := new Forum_Bean;
begin
F.Current := Util.Beans.Objects.To_Object (F.Msg'Access, Util.Beans.Objects.STATIC);
return F.all'Access;
end Create_Message_List;
protected body Forum is
-- ------------------------------
-- Post the message in the forum.
-- ------------------------------
procedure Post (Message : in Message_Bean) is
use type Ada.Containers.Count_Type;
begin
if Messages.Length > 100 then
Messages.Delete (Message_Id'First);
end if;
Messages.Append (Message);
end Post;
-- ------------------------------
-- Delete the message identified by <b>Id</b>.
-- ------------------------------
procedure Delete (Id : in Message_Id) is
begin
Messages.Delete (Id);
end Delete;
-- ------------------------------
-- Get the message identified by <b>Id</b>.
-- ------------------------------
function Get_Message (Id : in Message_Id) return Message_Bean is
begin
return Messages.Element (Id);
end Get_Message;
-- ------------------------------
-- Get the number of messages in the forum.
-- ------------------------------
function Get_Message_Count return Natural is
begin
return Natural (Messages.Length);
end Get_Message_Count;
end Forum;
end Messages;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.