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
|
---|---|---|---|---|
programs/oeis/276/A276878.asm | karttu/loda | 1 | 241205 | <filename>programs/oeis/276/A276878.asm<gh_stars>1-10
; A276878: Sums-complement of the Beatty sequence for 2*Pi.
; 1,2,3,4,5,8,9,10,11,14,15,16,17,20,21,22,23,24,27,28,29,30,33,34,35,36,39,40,41,42,45,46,47,48,49,52,53,54,55,58,59,60,61,64,65,66,67,68,71,72,73,74,77,78,79,80,83,84,85,86,89,90,91,92,93,96
mov $1,2
mov $2,$0
mul $2,7
div $2,5
mov $3,$2
div $3,6
mul $1,$3
add $1,1
add $1,$0
|
oeis/302/A302999.asm | neoneye/loda-programs | 11 | 243793 | ; A302999: a(n) = Product_{k=1..n} (Fibonacci(k+2) - 1).
; Submitted by <NAME>(s2)
; 1,1,2,8,56,672,13440,443520,23950080,2107607040,301387806720,69921971159040,26290661155799040,16011012643881615360,15786858466867272744960,25195826113120167300956160,65080818850189392138369761280,272037822793791659138385602150400,1840063833377206782412040212945305600,20139498656313528233499780130686369792000,356670521203312585015281106114455609016320000,10220750455602125436197895376815839931971665920000,473905536374903750100187814936820050125730233712640000
mov $1,1
lpb $0
sub $0,1
add $4,$3
add $4,1
mul $1,$4
mov $3,$2
mov $2,$4
lpe
mov $0,$1
|
programs/oeis/213/A213397.asm | karttu/loda | 0 | 15810 | <reponame>karttu/loda
; A213397: Number of (w,x,y) with all terms in {0,...,n} and 2*w >= |x+y-z|.
; 1,5,18,43,83,144,229,341,486,667,887,1152,1465,1829,2250,2731,3275,3888,4573,5333,6174,7099,8111,9216,10417,11717,13122,14635,16259,18000,19861,21845,23958,26203,28583,31104,33769,36581,39546,42667,45947,49392,53005,56789,60750
add $0,1
pow $0,3
mov $1,2
add $1,$0
mul $1,2
lpb $0,1
mod $0,1
div $1,3
lpe
sub $1,1
|
Source/Levels/L0005.asm | AbePralle/FGB | 0 | 176765 | <filename>Source/Levels/L0005.asm
; L0005.asm trakktor clearing
; Generated 08.24.2000 by mlevel
; Modified 08.24.2000 by <NAME>
INCLUDE "Source/Defs.inc"
INCLUDE "Source/Levels.inc"
;---------------------------------------------------------------------
SECTION "Level0005Section",ROMX
;---------------------------------------------------------------------
L0005_Contents::
DW L0005_Load
DW L0005_Init
DW L0005_Check
DW L0005_Map
;---------------------------------------------------------------------
; Load
;---------------------------------------------------------------------
L0005_Load:
DW ((L0005_LoadFinished - L0005_Load2)) ;size
L0005_Load2:
call ParseMap
ret
L0005_LoadFinished:
;---------------------------------------------------------------------
; Map
;---------------------------------------------------------------------
L0005_Map:
INCBIN "Data/Levels/L0005_path.lvl"
;---------------------------------------------------------------------
; Init
;---------------------------------------------------------------------
L0005_Init:
DW ((L0005_InitFinished - L0005_Init2)) ;size
L0005_Init2:
ld a,ENV_RAIN
call SetEnvEffect
ld a,BANK(main_in_game_gbm)
ld hl,main_in_game_gbm
call InitMusic
ld hl,$1300
call SetRespawnMap
ret
L0005_InitFinished:
;---------------------------------------------------------------------
; Check
;---------------------------------------------------------------------
L0005_Check:
DW ((L0005_CheckFinished - L0005_Check2)) ;size
L0005_Check2:
ret
L0005_CheckFinished:
PRINT "0005 Script Sizes (Load/Init/Check) (of $500): "
PRINT (L0005_LoadFinished - L0005_Load2)
PRINT " / "
PRINT (L0005_InitFinished - L0005_Init2)
PRINT " / "
PRINT (L0005_CheckFinished - L0005_Check2)
PRINT "\n"
|
src/main/fragment/mos6502-common/pbuz1_derefidx_vbuyy=_byte_vwum2.asm | jbrandwood/kickc | 2 | 175704 | <filename>src/main/fragment/mos6502-common/pbuz1_derefidx_vbuyy=_byte_vwum2.asm
lda {m2}
sta ({z1}),y |
externals/mpir-3.0.0/mpn/x86_64/k8/double.asm | JaminChan/eos_win | 12 | 86748 | dnl mpn_double
dnl Copyright 2011 The <NAME>
dnl This file is part of the MPIR Library.
dnl The MPIR Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 2.1 of the License, or (at
dnl your option) any later version.
dnl The MPIR Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the MPIR Library; see the file COPYING.LIB. If not, write
dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl Boston, MA 02110-1301, USA.
include(`../config.m4')
ASM_START()
PROLOGUE(mpn_double)
mov %rsi,%rax
shr $2,%rsi
and $3,%eax
jz t1
shlq $1,(%rdi)
lea 8(%rdi),%rdi
dec %rax
jz t1
rclq $1,(%rdi)
lea 8(%rdi),%rdi
dec %rax
jz t1
rclq $1,(%rdi)
lea 8(%rdi),%rdi
dec %rax
t1:
sbb %rdx,%rdx
cmp $0,%rsi
jz skiplp
add %rdx,%rdx
.align 16
lp:
rclq $1,(%rdi)
nop
rclq $1,8(%rdi)
rclq $1,16(%rdi)
rclq $1,24(%rdi)
nop
dec %rsi
lea 32(%rdi),%rdi
jnz lp
sbb %rdx,%rdx
skiplp:
sub %rdx,%rax
ret
EPILOGUE()
|
oeis/344/A344791.asm | neoneye/loda-programs | 11 | 163669 | <filename>oeis/344/A344791.asm
; A344791: a(n) is the number of 2-point antichains in the poset D_{2n+1} of type D, whose elements are compositions of 2n+1.
; Submitted by <NAME>(s1)
; 2,10,29,66,129,228,374,580,860,1230,1707,2310,3059,3976,5084,6408,7974,9810,11945,14410,17237,20460,24114,28236,32864,38038,43799,50190,57255,65040,73592,82960,93194,104346,116469,129618,143849,159220,175790,193620
add $0,1
mov $1,$0
pow $0,2
add $1,4
mul $0,$1
add $0,8
mul $0,$1
div $0,4
sub $0,16
div $0,4
add $0,2
|
sharding-core/src/main/antlr4/imports/PostgreSQLTCLStatement.g4 | chuanandongxu/sharding-sphere | 0 | 1478 | grammar PostgreSQLTCLStatement;
import PostgreSQLKeyword, Keyword, BaseRule, DataType, Symbol;
/**
* each statement has a url,
* each base url : https://www.postgresql.org/docs/current/static/.
* current version is 11
*/
//sql-set-transaction.html
setTransaction
: SET TRANSACTION (transactionMode (COMMA transactionMode)* | SNAPSHOT ID)
| SET SESSION CHARACTERISTICS AS TRANSACTION transactionMode (COMMA transactionMode)*
;
transactionMode
: ISOLATION LEVEL (SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED)
| READ (WRITE | ONLY)
| NOT? DEFERRABLE
;
//sql-commit.html,sql-commit-prepared.html
commit
: COMMIT workOrTransaction?
| COMMIT PREPARED ID
;
//sql-rollback.html,sql-rollback-prepared.html,sql-rollback-to.html
rollback
: ROLLBACK workOrTransaction?
| ROLLBACK PREPARED ID
| ROLLBACK workOrTransaction? TO SAVEPOINT? ID
;
//sql-savepoint.html
savepoint
: SAVEPOINT ID
;
//sql-begin.html
beginWork
: BEGIN workOrTransaction? (transactionMode (COMMA transactionMode)*)?
;
//sql-start-transaction.html
startTransaction
: START TRANSACTION workOrTransaction? (transactionMode (COMMA transactionMode)*)?
;
workOrTransaction
: WORK
| TRANSACTION
; |
Task/Averages-Median/AppleScript/averages-median-2.applescript | LaudateCorpus1/RosettaCodeData | 1 | 3292 | <reponame>LaudateCorpus1/RosettaCodeData<filename>Task/Averages-Median/AppleScript/averages-median-2.applescript
-- MEDIAN ---------------------------------------------------------------------
-- median :: [Num] -> Num
on median(xs)
-- nth :: [Num] -> Int -> Maybe Num
script nth
on |λ|(xxs, n)
if length of xxs > 0 then
set {x, xs} to uncons(xxs)
script belowX
on |λ|(y)
y < x
end |λ|
end script
set {ys, zs} to partition(belowX, xs)
set k to length of ys
if k = n then
x
else
if k > n then
|λ|(ys, n)
else
|λ|(zs, n - k - 1)
end if
end if
else
missing value
end if
end |λ|
end script
set n to length of xs
if n > 0 then
tell nth
if n mod 2 = 0 then
(|λ|(xs, n div 2) + |λ|(xs, (n div 2) - 1)) / 2
else
|λ|(xs, n div 2)
end if
end tell
else
missing value
end if
end median
-- TEST -----------------------------------------------------------------------
on run
map(median, [¬
[], ¬
[5, 3, 4], ¬
[5, 4, 2, 3], ¬
[3, 4, 1, -8.4, 7.2, 4, 1, 1.2]])
--> {missing value, 4, 3.5, 2.1}
end run
-- GENERIC FUNCTIONS ----------------------------------------------------------
-- map :: (a -> b) -> [a] -> [b]
on map(f, xs)
tell mReturn(f)
set lng to length of xs
set lst to {}
repeat with i from 1 to lng
set end of lst to |λ|(item i of xs, i, xs)
end repeat
return lst
end tell
end map
-- Lift 2nd class handler function into 1st class script wrapper
-- mReturn :: Handler -> Script
on mReturn(f)
if class of f is script then
f
else
script
property |λ| : f
end script
end if
end mReturn
-- partition :: predicate -> List -> (Matches, nonMatches)
-- partition :: (a -> Bool) -> [a] -> ([a], [a])
on partition(f, xs)
tell mReturn(f)
set lst to {{}, {}}
repeat with x in xs
set v to contents of x
set end of item ((|λ|(v) as integer) + 1) of lst to v
end repeat
end tell
{item 2 of lst, item 1 of lst}
end partition
-- uncons :: [a] -> Maybe (a, [a])
on uncons(xs)
if length of xs > 0 then
{item 1 of xs, rest of xs}
else
missing value
end if
end uncons
|
libsrc/_DEVELOPMENT/stdio/z80/asm_funlockfile.asm | jpoikela/z88dk | 640 | 21061 |
; ===============================================================
; Jan 2014
; ===============================================================
;
; void funlockfile(FILE *file)
;
; Reduce lock count of file by one.
;
; ===============================================================
SECTION code_clib
SECTION code_stdio
PUBLIC asm_funlockfile
EXTERN __stdio_lock_release
asm_funlockfile:
; Release the FILE lock
;
; enter : ix = FILE *
;
; exit : ix = FILE *
;
; uses : f, hl
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_STDIO & $01
EXTERN __stdio_verify_valid
call __stdio_verify_valid
ret c
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
jp __stdio_lock_release
|
test/Succeed/Options-in-right-order.agda | redfish64/autonomic-agda | 1 | 7907 | <filename>test/Succeed/Options-in-right-order.agda
module Options-in-right-order where
data Unit : Set where
unit : Unit
postulate
IO : Set → Set
{-# COMPILED_TYPE IO IO #-}
{-# BUILTIN IO IO #-}
postulate
return : {A : Set} → A → IO A
{-# COMPILED return (\_ -> return) #-}
main = return unit
|
atlatl/std.asm | richRemer/atlatl | 0 | 170963 | <reponame>richRemer/atlatl
global std.out
global std.outln
global std.outs
global std.outsln
global std.outb
global std.outbln
global std.outd
global std.outdln
global std.outq
global std.outqln
global std.endln
extern zstr.len
%include "util.inc"
%include "String.inc"
section .text
; std.out(RAX)
; print null-terminated string to stdout
std.out: ; std.out(zstr)
prsv rcx, rdx, rsi, rdi, rsp ; preserve for syscall
prsv r8, r9, r10, r11 ; preserve for syscall
mov rsi, rax ; message
call zstr.len ; measure string
mov rdx, rax ; message length
mov rax, 1 ; sys_write
mov rdi, 1 ; stdout
syscall
rstr r8, r9, r10, r11 ; restore
rstr rcx, rdx, rsi, rdi, rsp ; restore
ret
; std.outln(RAX)
; print null-terminated string to stdout, followed by newline
std.outln: ; std.outln(zstr)
call std.out ; echo string
prsv rcx, rdx, rsi, rdi, rsp ; preserve for syscall
prsv r8, r9, r10, r11 ; preserve for syscall
mov rax, 1 ; sys_write
mov rdi, 1 ; stdout
mov rsi, std.endln ; message
mov rdx, 1 ; length
syscall
rstr r8, r9, r10, r11 ; restore
rstr rcx, rdx, rsi, rdi, rsp ; restore
ret
; std.outs(RAX)
; print String to stdout
std.outs: ; std.outs(String)
prsv rcx, rdx, rsi, rdi, rsp ; preserve for syscall
prsv r8, r9, r10, r11 ; preserve for syscall
mov rsi, [rax+String.pdata] ; message
mov rdx, [rax+String.length]; length
mov rdi, 1 ; stdout
mov rax, 1 ; sys_write
syscall
rstr r8, r9, r10, r11 ; restore
rstr rcx, rdx, rsi, rdi, rsp ; restore
ret
; std.outsln(RAX)
; print String to stdout, followed by newline
std.outsln: ; std.outsln(String)
call std.outs ; print message
prsv rcx, rdx, rsi, rdi, rsp ; preserve for syscall
prsv r8, r9, r10, r11 ; preserve for syscall
mov rax, 1 ; sys_write
mov rdi, 1 ; stdout
mov rsi, std.endln ; message
mov rdx, 1 ; length
syscall
rstr r8, r9, r10, r11 ; restore
rstr rcx, rdx, rsi, rdi, rsp ; restore
ret
; std.outb(RAX)
; print Byte in hex to stdout
std.outb:
prsv rcx, rdx, rsi, rdi, rsp ; preserve for syscall
prsv r8, r9, r10, r11 ; preserve for syscall
mov rcx, 2 ; number of characters
.char:
mov rdx, rax ; make copy
and rdx, 0xf ; mask low bits
mov rsi, hexits ; read buffer
lea rdi, [rsp-2] ; write buffer
mov dl, [rsi+rdx] ; lookupo hexit
mov [rdi+rcx-1], dl ; move hexit into buffer
shr rax, 4 ; consume bits
dec rcx ; decrement character counter
jnz .char ; loop to next character
mov rax, 1 ; sys_write
mov rdi, 1 ; stdout
lea rsi, [rsp-2] ; message
mov rdx, 2 ; number of characters
syscall
rstr r8, r9, r10, r11 ; restore
rstr rcx, rdx, rsi, rdi, rsp ; restore
ret
; std.outbln(RAX)
; print Byte in hex to stdout, followed by newline
std.outbln:
call std.outb ; echo value
prsv rcx, rdx, rsi, rdi, rsp ; preserve for syscall
prsv r8, r9, r10, r11 ; preserve for syscall
mov rax, 1 ; sys_write
mov rdi, 1 ; stdout
mov rsi, std.endln ; message
mov rdx, 1 ; number of characters
syscall
rstr r8, r9, r10, r11 ; restore
rstr rcx, rdx, rsi, rdi, rsp ; restore
ret
; std.outd(RAX)
; print DWord in hex to stdout
std.outd:
prsv rcx, rdx, rsi, rdi, rsp ; preserve for syscall
prsv r8, r9, r10, r11 ; preserve for syscall
mov rcx, 8 ; number of characters
.char:
mov rdx, rax ; make copy
and rdx, 0xf ; mask low bits
mov rsi, hexits ; read buffer
lea rdi, [rsp-8] ; write buffer
mov dl, [rsi+rdx] ; lookup hexit
mov [rdi+rcx-1], dl ; move hexit into buffer
shr rax, 4 ; consume bits
dec rcx ; decrement character counter
jnz .char ; loop to next character
mov rax, 1 ; sys_write
mov rdi, 1 ; stdout
lea rsi, [rsp-8] ; message
mov rdx, 8 ; number of characters
syscall
rstr r8, r9, r10, r11 ; restore
rstr rcx, rdx, rsi, rdi, rsp ; restore
ret
; std.outdln(RAX)
; print DWord in hex to stdout, followed by newline
std.outdln:
call std.outd ; echo value
prsv rcx, rdx, rsi, rdi, rsp ; preserve for syscall
prsv r8, r9, r10, r11 ; preserve for syscall
mov rax, 1 ; sys_write
mov rdi, 1 ; stdout
mov rsi, std.endln ; message
mov rdx, 1 ; number of characters
syscall
rstr r8, r9, r10, r11 ; restore
rstr rcx, rdx, rsi, rdi, rsp ; restore
ret
; std.outq(RAX)
; print QWord in hex to stdout
std.outq:
prsv rcx, rdx, rsi, rdi, rsp ; preserve for syscall
prsv r8, r9, r10, r11 ; preserve for syscall
mov rcx, 16 ; number of characters
.char:
mov rdx, rax ; make copy
and rdx, 0xf ; mask low bits
mov rsi, hexits ; read buffer
lea rdi, [rsp-16] ; write buffer
mov dl, [rsi+rdx] ; lookup hexit
mov [rdi+rcx-1], dl ; move hexit into buffer
shr rax, 4 ; consume bits
dec rcx ; decrement character counter
jnz .char ; loop to next character
mov rax, 1 ; sys_write
mov rdi, 1 ; stdout
lea rsi, [rsp-16] ; message
mov rdx, 16 ; number of characters
syscall
rstr r8, r9, r10, r11 ; restore
rstr rcx, rdx, rsi, rdi, rsp ; restore
ret
; std.outqln(RAX)
; print QWord in hex to stdout, followed by newline
std.outqln:
call std.outq ; echo value
prsv rcx, rdx, rsi, rdi, rsp ; preserve for syscall
prsv r8, r9, r10, r11 ; preserve for syscall
mov rax, 1 ; sys_write
mov rdi, 1 ; stdout
mov rsi, std.endln ; message
mov rdx, 1 ; number of characters
syscall
rstr r8, r9, r10, r11 ; restore
rstr rcx, rdx, rsi, rdi, rsp ; restore
ret
section .data
hexits: db "0123456789ABCDEF"
std.endln: db 0xa, 0x0
|
deps/openssl/asm/x64-win32-masm/x86_64cpuid.asm | sgallagher/node | 2 | 103792 | <filename>deps/openssl/asm/x64-win32-masm/x86_64cpuid.asm<gh_stars>1-10
OPTION DOTNAME
EXTERN OPENSSL_cpuid_setup:NEAR
.CRT$XCU SEGMENT READONLY DWORD
DQ OPENSSL_cpuid_setup
.CRT$XCU ENDS
.text$ SEGMENT ALIGN(64) 'CODE'
PUBLIC OPENSSL_atomic_add
ALIGN 16
OPENSSL_atomic_add PROC PUBLIC
mov eax,DWORD PTR[rcx]
$L$spin:: lea r8,QWORD PTR[rax*1+rdx]
DB 0f0h
cmpxchg DWORD PTR[rcx],r8d
jne $L$spin
mov eax,r8d
DB 048h,098h
DB 0F3h,0C3h ;repret
OPENSSL_atomic_add ENDP
PUBLIC OPENSSL_rdtsc
ALIGN 16
OPENSSL_rdtsc PROC PUBLIC
rdtsc
shl rdx,32
or rax,rdx
DB 0F3h,0C3h ;repret
OPENSSL_rdtsc ENDP
PUBLIC OPENSSL_ia32_cpuid
ALIGN 16
OPENSSL_ia32_cpuid PROC PUBLIC
mov r8,rbx
xor eax,eax
cpuid
mov r11d,eax
xor eax,eax
cmp ebx,0756e6547h
setne al
mov r9d,eax
cmp edx,049656e69h
setne al
or r9d,eax
cmp ecx,06c65746eh
setne al
or r9d,eax
jz $L$intel
cmp ebx,068747541h
setne al
mov r10d,eax
cmp edx,069746E65h
setne al
or r10d,eax
cmp ecx,0444D4163h
setne al
or r10d,eax
jnz $L$intel
mov eax,080000000h
cpuid
cmp eax,080000008h
jb $L$intel
mov eax,080000008h
cpuid
movzx r10,cl
inc r10
mov eax,1
cpuid
bt edx,28
jnc $L$done
shr ebx,16
cmp bl,r10b
ja $L$done
and edx,0efffffffh
jmp $L$done
$L$intel::
cmp r11d,4
mov r10d,-1
jb $L$nocacheinfo
mov eax,4
mov ecx,0
cpuid
mov r10d,eax
shr r10d,14
and r10d,0fffh
$L$nocacheinfo::
mov eax,1
cpuid
cmp r9d,0
jne $L$notintel
or edx,000100000h
and ah,15
cmp ah,15
je $L$notintel
or edx,040000000h
$L$notintel::
bt edx,28
jnc $L$done
and edx,0efffffffh
cmp r10d,0
je $L$done
or edx,010000000h
shr ebx,16
cmp bl,1
ja $L$done
and edx,0efffffffh
$L$done::
shl rcx,32
mov eax,edx
mov rbx,r8
or rax,rcx
DB 0F3h,0C3h ;repret
OPENSSL_ia32_cpuid ENDP
PUBLIC OPENSSL_cleanse
ALIGN 16
OPENSSL_cleanse PROC PUBLIC
xor rax,rax
cmp rdx,15
jae $L$ot
cmp rdx,0
je $L$ret
$L$ittle::
mov BYTE PTR[rcx],al
sub rdx,1
lea rcx,QWORD PTR[1+rcx]
jnz $L$ittle
$L$ret::
DB 0F3h,0C3h ;repret
ALIGN 16
$L$ot::
test rcx,7
jz $L$aligned
mov BYTE PTR[rcx],al
lea rdx,QWORD PTR[((-1))+rdx]
lea rcx,QWORD PTR[1+rcx]
jmp $L$ot
$L$aligned::
mov QWORD PTR[rcx],rax
lea rdx,QWORD PTR[((-8))+rdx]
test rdx,-8
lea rcx,QWORD PTR[8+rcx]
jnz $L$aligned
cmp rdx,0
jne $L$ittle
DB 0F3h,0C3h ;repret
OPENSSL_cleanse ENDP
PUBLIC OPENSSL_wipe_cpu
ALIGN 16
OPENSSL_wipe_cpu PROC PUBLIC
pxor xmm0,xmm0
pxor xmm1,xmm1
pxor xmm2,xmm2
pxor xmm3,xmm3
pxor xmm4,xmm4
pxor xmm5,xmm5
xor rcx,rcx
xor rdx,rdx
xor r8,r8
xor r9,r9
xor r10,r10
xor r11,r11
lea rax,QWORD PTR[8+rsp]
DB 0F3h,0C3h ;repret
OPENSSL_wipe_cpu ENDP
.text$ ENDS
END
|
aux/2600/resx_during_draw/missile_late_hblank_66.asm | 6502ts/6502.ts | 49 | 105022 | <filename>aux/2600/resx_during_draw/missile_late_hblank_66.asm
DELAY_CYCLES = 16
INCLUDE missile_late_hblank.inc |
src/Automata/Nondeterministic.agda | armkeh/agda-computability | 0 | 15886 | <reponame>armkeh/agda-computability
module Automata.Nondeterministic where
-- Standard libraries imports ----------------------------------------
open import Level using ()
renaming (zero to ℓ₀)
open import Data.Nat using (ℕ)
open import Data.Product using (_×_)
open import Data.Vec using (Vec ; [] ; _∷_)
open import Relation.Unary using (Pred)
open import Relation.Binary.PropositionalEquality using (_≡_)
----------------------------------------------------------------------
-- Thesis imports ----------------------------------------------------
open import Utilities.ExistsSyntax using (∃-syntax)
----------------------------------------------------------------------
record NDA (Σ : Set) : Set₁ where
constructor ⟨_,_,_,_⟩
field
Q : Set
S : Pred Q ℓ₀
F : Pred Q ℓ₀
Δ : Q → Σ → Pred Q ℓ₀
Δ* : Q → {n : ℕ} → Vec Σ n → Pred Q ℓ₀
Δ* q [] = q ≡_
Δ* q (x ∷ xs) q′ = ∃ q₀ ∶ Q • ((Δ q x q₀) × (Δ* q₀ xs q′))
Accepts : {n : ℕ} → Pred (Vec Σ n) ℓ₀
Accepts xs = ∃ q ∶ Q • (S q
× ∃ q′ ∶ Q • ((F q′)
× (Δ* q xs q′)))
-- :TODO: are these useful?
_-Reachable : ℕ → Q → Pred Q ℓ₀
_-Reachable n q q′ = ∃ xs ∶ Vec Σ n • (Δ* q xs q′)
Reachable : Q → Pred Q ℓ₀
Reachable q q′ = ∃ n ∶ ℕ • (n -Reachable) q q′
|
FormalAnalyzer/models/apps/SmartNightlightPlus.als | Mohannadcse/IoTCOM_BehavioralRuleExtractor | 0 | 2055 | module app_SmartNightlightPlus
open IoTBottomUp as base
open cap_motionSensor
open cap_switch
open cap_illuminanceMeasurement
one sig app_SmartNightlightPlus extends IoTApp {
lightSensor : one cap_illuminanceMeasurement,
state : one cap_state,
motionSensor : one cap_motionSensor,
lights : some cap_switch,
} {
rules = r
}
one sig cap_state extends Capability {} {
attributes = cap_state_attr
}
abstract sig cap_state_attr extends Attribute {}
one sig cap_state_attr_pushed extends cap_state_attr {} {
values = cap_state_attr_pushed_val
}
abstract sig cap_state_attr_pushed_val extends AttrValue {}
one sig cap_state_attr_pushed_val_ extends cap_state_attr_pushed_val {}
one sig cap_state_attr_pushed_val_pushed extends cap_state_attr_pushed_val {}
one sig cap_state_attr_runIn extends cap_state_attr {} {
values = cap_state_attr_runIn_val
}
abstract sig cap_state_attr_runIn_val extends AttrValue {}
one sig cap_state_attr_runIn_val_on extends cap_state_attr_runIn_val {}
one sig cap_state_attr_runIn_val_off extends cap_state_attr_runIn_val {}
one sig cap_state_attr_lastStatus extends cap_state_attr {} {
values = cap_state_attr_lastStatus_val
}
abstract sig cap_state_attr_lastStatus_val extends AttrValue {}
one sig cap_state_attr_lastStatus_val_on extends cap_state_attr_lastStatus_val {}
one sig cap_state_attr_lastStatus_val_off extends cap_state_attr_lastStatus_val {}
one sig cap_state_attr_motionStopTime extends cap_state_attr {} {
values = cap_state_attr_motionStopTime_val
}
abstract sig cap_state_attr_motionStopTime_val extends AttrValue {}
one sig cap_state_attr_motionStopTime_val_not_null extends cap_state_attr_motionStopTime_val {}
one sig cap_state_attr_motionStopTime_val_null extends cap_state_attr_motionStopTime_val {}
one sig range_0,range_1,range_2 extends cap_illuminanceMeasurement_attr_illuminance_val {}
one sig cap_state_attr_riseTime extends cap_state_attr {} {
values = cap_state_attr_riseTime_val
}
abstract sig cap_state_attr_riseTime_val extends AttrValue {}
one sig cap_state_attr_setTime extends cap_state_attr {} {
values = cap_state_attr_setTime_val
}
abstract sig cap_state_attr_setTime_val extends AttrValue {}
// application rules base class
abstract sig r extends Rule {}
one sig r11 extends r {}{
no triggers
conditions = r11_cond
commands = r11_comm
}
abstract sig r11_cond extends Condition {}
abstract sig r11_comm extends Command {}
one sig r11_comm0 extends r11_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_riseTime
value = cap_state_attr_riseTime_val
}
one sig r11_comm1 extends r11_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_setTime
value = cap_state_attr_setTime_val
}
one sig r12 extends r {}{
triggers = r12_trig
conditions = r12_cond
commands = r12_comm
}
abstract sig r12_trig extends Trigger {}
one sig r12_trig0 extends r12_trig {} {
capabilities = app_SmartNightlightPlus.lightSensor
attribute = cap_illuminanceMeasurement_attr_illuminance
no value
}
abstract sig r12_cond extends Condition {}
one sig r12_cond0 extends r12_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val_off
}
one sig r12_cond1 extends r12_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_motionStopTime
value = cap_state_attr_motionStopTime_val
}
one sig r12_cond2 extends r12_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val - cap_state_attr_lastStatus_val_off
}
one sig r12_cond3 extends r12_cond {} {
capabilities = app_SmartNightlightPlus.lightSensor
attribute = cap_illuminanceMeasurement_attr_illuminance
value = range_1//cap_illuminanceMeasurement_attr_illuminance_val_Range1
}
one sig r12_cond4 extends r12_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_motionStopTime
value = cap_state_attr_motionStopTime_val
}
abstract sig r12_comm extends Command {}
one sig r12_comm0 extends r12_comm {} {
capability = app_SmartNightlightPlus.lights
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
one sig r12_comm1 extends r12_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val_off
}
one sig r0 extends r {}{
triggers = r0_trig
conditions = r0_cond
commands = r0_comm
}
abstract sig r0_trig extends Trigger {}
one sig r0_trig0 extends r0_trig {} {
capabilities = app_SmartNightlightPlus.lightSensor
attribute = cap_illuminanceMeasurement_attr_illuminance
no value
}
abstract sig r0_cond extends Condition {}
one sig r0_cond0 extends r0_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val - cap_state_attr_lastStatus_val_off
}
one sig r0_cond1 extends r0_cond {} {
capabilities = app_SmartNightlightPlus.lightSensor
attribute = cap_illuminanceMeasurement_attr_illuminance
value = range_2//cap_illuminanceMeasurement_attr_illuminance_val_Range2
}
abstract sig r0_comm extends Command {}
one sig r0_comm0 extends r0_comm {} {
capability = app_SmartNightlightPlus.lights
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
one sig r0_comm1 extends r0_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val_off
}
one sig r1 extends r {}{
triggers = r1_trig
conditions = r1_cond
commands = r1_comm
}
abstract sig r1_trig extends Trigger {}
one sig r1_trig0 extends r1_trig {} {
capabilities = app_SmartNightlightPlus.motionSensor
attribute = cap_motionSensor_attr_motion
no value
}
abstract sig r1_cond extends Condition {}
one sig r1_cond0 extends r1_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_pushed
value = cap_state_attr_pushed_val - cap_state_attr_pushed_val_pushed
}
/*
one sig r1_cond1 extends r1_cond {} {
capabilities = app_SmartNightlightPlus.user
attribute = cap_user_attr_delayMinutes
value = cap_user_attr_delayMinutes_val - cap_user_attr_delayMinutes_val_no_value
}
*/
one sig r1_cond2 extends r1_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val - cap_state_attr_lastStatus_val_off
}
one sig r1_cond3 extends r1_cond {} {
capabilities = app_SmartNightlightPlus.motionSensor
attribute = cap_motionSensor_attr_motion
value = cap_motionSensor_attr_motion_val - cap_motionSensor_attr_motion_val_active
}
one sig r1_cond4 extends r1_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_motionStopTime
value = cap_state_attr_motionStopTime_val
}
abstract sig r1_comm extends Command {}
one sig r1_comm0 extends r1_comm {} {
capability = app_SmartNightlightPlus.lights
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
one sig r1_comm1 extends r1_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val_off
}
one sig r2 extends r {}{
triggers = r2_trig
conditions = r2_cond
commands = r2_comm
}
abstract sig r2_trig extends Trigger {}
one sig r2_trig0 extends r2_trig {} {
capabilities = app_SmartNightlightPlus.lightSensor
attribute = cap_illuminanceMeasurement_attr_illuminance
no value
}
abstract sig r2_cond extends Condition {}
one sig r2_cond0 extends r2_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val_off
}
one sig r2_cond1 extends r2_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_motionStopTime
value = cap_state_attr_motionStopTime_val
}
one sig r2_cond2 extends r2_cond {} {
capabilities = app_SmartNightlightPlus.lightSensor
attribute = cap_illuminanceMeasurement_attr_illuminance
value = range_1//cap_illuminanceMeasurement_attr_illuminance_val_Range1
}
one sig r2_cond3 extends r2_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val - cap_state_attr_lastStatus_val_on
}
one sig r2_cond4 extends r2_cond {} {
capabilities = app_SmartNightlightPlus.lightSensor
attribute = cap_illuminanceMeasurement_attr_illuminance
value = range_0//cap_illuminanceMeasurement_attr_illuminance_val_Range0
}
abstract sig r2_comm extends Command {}
one sig r2_comm0 extends r2_comm {} {
capability = app_SmartNightlightPlus.lights
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
one sig r2_comm1 extends r2_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val_on
}
one sig r3 extends r {}{
triggers = r3_trig
conditions = r3_cond
commands = r3_comm
}
abstract sig r3_trig extends Trigger {}
one sig r3_trig0 extends r3_trig {} {
capabilities = app_SmartNightlightPlus.motionSensor
attribute = cap_motionSensor_attr_motion
no value
}
abstract sig r3_cond extends Condition {}
one sig r3_cond0 extends r3_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_pushed
value = cap_state_attr_pushed_val - cap_state_attr_pushed_val_pushed
}
/*
one sig r3_cond1 extends r3_cond {} {
capabilities = app_SmartNightlightPlus.user
attribute = cap_user_attr_delayMinutes
value = cap_user_attr_delayMinutes_val
}
*/
one sig r3_cond2 extends r3_cond {} {
capabilities = app_SmartNightlightPlus.motionSensor
attribute = cap_motionSensor_attr_motion
value = cap_motionSensor_attr_motion_val - cap_motionSensor_attr_motion_val_active
}
abstract sig r3_comm extends Command {}
one sig r3_comm0 extends r3_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_runIn
value = cap_state_attr_runIn_val_on
}
one sig r4 extends r {}{
triggers = r4_trig
conditions = r4_cond
commands = r4_comm
}
abstract sig r4_trig extends Trigger {}
one sig r4_trig0 extends r4_trig {} {
capabilities = app_SmartNightlightPlus.motionSensor
attribute = cap_motionSensor_attr_motion
no value
}
abstract sig r4_cond extends Condition {}
one sig r4_cond0 extends r4_cond {} {
capabilities = app_SmartNightlightPlus.motionSensor
attribute = cap_motionSensor_attr_motion
value = cap_motionSensor_attr_motion_val_active
}
abstract sig r4_comm extends Command {}
one sig r4_comm0 extends r4_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_motionStopTime
value = cap_state_attr_motionStopTime_val_null
}
one sig r5 extends r {}{
triggers = r5_trig
conditions = r5_cond
commands = r5_comm
}
abstract sig r5_trig extends Trigger {}
one sig r5_trig0 extends r5_trig {} {
capabilities = app_SmartNightlightPlus.motionSensor
attribute = cap_motionSensor_attr_motion
no value
}
abstract sig r5_cond extends Condition {}
one sig r5_cond0 extends r5_cond {} {
capabilities = app_SmartNightlightPlus.motionSensor
attribute = cap_motionSensor_attr_motion
value = cap_motionSensor_attr_motion_val - cap_motionSensor_attr_motion_val_active
}
abstract sig r5_comm extends Command {}
one sig r5_comm0 extends r5_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_motionStopTime
value = cap_state_attr_motionStopTime_val
}
one sig r6 extends r {}{
triggers = r6_trig
conditions = r6_cond
commands = r6_comm
}
abstract sig r6_trig extends Trigger {}
one sig r6_trig0 extends r6_trig {} {
capabilities = app_SmartNightlightPlus.lights
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
abstract sig r6_cond extends Condition {}
abstract sig r6_comm extends Command {}
one sig r6_comm0 extends r6_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_pushed
value = cap_state_attr_pushed_val_
}
one sig r7 extends r {}{
triggers = r7_trig
conditions = r7_cond
commands = r7_comm
}
abstract sig r7_trig extends Trigger {}
one sig r7_trig0 extends r7_trig {} {
capabilities = app_SmartNightlightPlus.motionSensor
attribute = cap_motionSensor_attr_motion
no value
}
abstract sig r7_cond extends Condition {}
one sig r7_cond0 extends r7_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_pushed
value = cap_state_attr_pushed_val_pushed
}
one sig r7_cond1 extends r7_cond {} {
capabilities = app_SmartNightlightPlus.motionSensor
attribute = cap_motionSensor_attr_motion
value = cap_motionSensor_attr_motion_val - cap_motionSensor_attr_motion_val_active
}
/*
one sig r7_cond2 extends r7_cond {} {
capabilities = app_SmartNightlightPlus.user
attribute = cap_user_attr_bigDelayMinutes
value = cap_user_attr_bigDelayMinutes_val
}
*/
abstract sig r7_comm extends Command {}
one sig r7_comm0 extends r7_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_runIn
value = cap_state_attr_runIn_val_on
}
one sig r8 extends r {}{
triggers = r8_trig
conditions = r8_cond
commands = r8_comm
}
abstract sig r8_trig extends Trigger {}
one sig r8_trig0 extends r8_trig {} {
capabilities = app_SmartNightlightPlus.lights
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
abstract sig r8_cond extends Condition {}
one sig r8_cond0 extends r8_cond {} {
capabilities = app_SmartNightlightPlus.lights
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
abstract sig r8_comm extends Command {}
one sig r8_comm0 extends r8_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_pushed
value = cap_state_attr_pushed_val_pushed
}
one sig r9 extends r {}{
no triggers
conditions = r9_cond
commands = r9_comm
}
abstract sig r9_cond extends Condition {}
one sig r9_cond0 extends r9_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val - cap_state_attr_lastStatus_val_off
}
one sig r9_cond1 extends r9_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_runIn
value = cap_state_attr_runIn_val_on
}
one sig r9_cond2 extends r9_cond {} {
capabilities = app_SmartNightlightPlus.state
attribute = cap_state_attr_motionStopTime
value = cap_state_attr_motionStopTime_val
}
abstract sig r9_comm extends Command {}
one sig r9_comm0 extends r9_comm {} {
capability = app_SmartNightlightPlus.lights
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
one sig r9_comm1 extends r9_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val_off
}
one sig r10 extends r {}{
triggers = r10_trig
conditions = r10_cond
commands = r10_comm
}
abstract sig r10_trig extends Trigger {}
one sig r10_trig0 extends r10_trig {} {
capabilities = app_SmartNightlightPlus.motionSensor
attribute = cap_motionSensor_attr_motion
no value
}
abstract sig r10_cond extends Condition {}
one sig r10_cond0 extends r10_cond {} {
capabilities = app_SmartNightlightPlus.motionSensor
attribute = cap_motionSensor_attr_motion
value = cap_motionSensor_attr_motion_val_active
}
abstract sig r10_comm extends Command {}
one sig r10_comm0 extends r10_comm {} {
capability = app_SmartNightlightPlus.lights
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
one sig r10_comm1 extends r10_comm {} {
capability = app_SmartNightlightPlus.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val_on
}
|
oeis/193/A193651.asm | neoneye/loda-programs | 11 | 162809 | ; A193651: a(n) = ((2*n + 1)!! + 1)/2.
; 1,2,8,53,473,5198,67568,1013513,17229713,327364538,6874655288,158117071613,3952926790313,106729023338438,3095141676814688,95949391981255313,3166329935381425313,110821547738349885938,4100397266318945779688,159915493386438885407813,6556535228843994301720313,281931014840291754973973438,12686895667813128973828804688,596284096387217061769953820313,29217920722973636026727737195313,1490113956871655437363114596960938,78976039714197738180245073638929688,4343682184280875599913479050141132813
mov $2,$0
mov $0,30
mul $2,2
add $2,1
lpb $2
mul $0,$2
sub $2,2
lpe
div $0,60
add $0,1
|
programs/oeis/255/A255187.asm | karttu/loda | 1 | 28827 | ; A255187: 29-gonal numbers: a(n) = n*(27*n-25)/2.
; 0,1,29,84,166,275,411,574,764,981,1225,1496,1794,2119,2471,2850,3256,3689,4149,4636,5150,5691,6259,6854,7476,8125,8801,9504,10234,10991,11775,12586,13424,14289,15181,16100,17046,18019,19019,20046,21100,22181,23289,24424,25586,26775,27991,29234,30504,31801,33125,34476,35854,37259,38691,40150,41636,43149,44689,46256,47850,49471,51119,52794,54496,56225,57981,59764,61574,63411,65275,67166,69084,71029,73001,75000,77026,79079,81159,83266,85400,87561,89749,91964,94206,96475,98771,101094,103444,105821,108225,110656,113114,115599,118111,120650,123216,125809,128429,131076,133750,136451,139179,141934,144716,147525,150361,153224,156114,159031,161975,164946,167944,170969,174021,177100,180206,183339,186499,189686,192900,196141,199409,202704,206026,209375,212751,216154,219584,223041,226525,230036,233574,237139,240731,244350,247996,251669,255369,259096,262850,266631,270439,274274,278136,282025,285941,289884,293854,297851,301875,305926,310004,314109,318241,322400,326586,330799,335039,339306,343600,347921,352269,356644,361046,365475,369931,374414,378924,383461,388025,392616,397234,401879,406551,411250,415976,420729,425509,430316,435150,440011,444899,449814,454756,459725,464721,469744,474794,479871,484975,490106,495264,500449,505661,510900,516166,521459,526779,532126,537500,542901,548329,553784,559266,564775,570311,575874,581464,587081,592725,598396,604094,609819,615571,621350,627156,632989,638849,644736,650650,656591,662559,668554,674576,680625,686701,692804,698934,705091,711275,717486,723724,729989,736281,742600,748946,755319,761719,768146,774600,781081,787589,794124,800686,807275,813891,820534,827204,833901
mov $1,$0
bin $0,2
mul $0,27
add $1,$0
|
print_functions.asm | Highwind360/NimbOS | 0 | 245296 | <filename>print_functions.asm
;
; Print function
; Expects bx to point to a null-terminated string
; Prints the string to the console
;
print:
push ax
push bx
push cx
mov ah, 0x0e ; scrolling teletype routine
.print_char:
mov cx, [bx]
test cl, cl
je .exit
add bx, 1
mov al, cl
int 0x10
jmp .print_char
.exit:
pop cx
pop bx
pop ax
ret
;
; Calls print, appends newline
;
println:
call print
push bx
mov bx, NWLN
call print
pop bx
ret
NWLN:
db 0xa,0xd,0
|
src/lumen-binary.ads | darkestkhan/lumen | 8 | 8963 | <filename>src/lumen-binary.ads
-- <NAME>, Phoenix AZ, April 2007
-- Lumen would not be possible without the support and contributions of a cast
-- of thousands, including and primarily <NAME>.
-- This code is covered by the ISC License:
--
-- Copyright © 2010, NiEstu
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- The software is provided "as is" and the author disclaims all warranties
-- with regard to this software including all implied warranties of
-- merchantability and fitness. In no event shall the author be liable for any
-- special, direct, indirect, or consequential damages or any damages
-- whatsoever resulting from loss of use, data or profits, whether in an
-- action of contract, negligence or other tortious action, arising out of or
-- in connection with the use or performance of this software.
-- For purposes of this package:
--
-- byte -- 8 bits (octet, C char, GNAT Character/Short_Short_Integer)
-- short -- 16 bits (C short, GNAT Short_Integer)
-- word -- 32 bits (C int/long(32), GNAT Integer/Long_Integer)
-- long -- 64 bits (C long(64), GNAT Long_Long_Integer)
--
-- Note that these are not identical to the names/definitions used on pretty
-- much any extant 32- or 64-bit platform, though they are somewhat biased to
-- early 21st-century 32-bit platforms.
package Lumen.Binary is
---------------------------------------------------------------------------
--
-- Public constants
--
---------------------------------------------------------------------------
-- Basic structure (sizes) of fundamental binary data types
Byte_Bits : constant := 8;
Short_Bits : constant := 16;
Word_Bits : constant := 32;
Long_Bits : constant := 64;
-- Derived sizes
Short_Bytes : constant := Short_Bits / Byte_Bits;
Word_Bytes : constant := Word_Bits / Byte_Bits;
Long_Bytes : constant := Long_Bits / Byte_Bits;
-- "Last-bit" values for use in rep clauses
Byte_LB : constant := Byte_Bits - 1;
Short_LB : constant := Short_Bits - 1;
Word_LB : constant := Word_Bits - 1;
Long_LB : constant := Long_Bits - 1;
---------------------------------------------------------------------------
--
-- Public types
--
---------------------------------------------------------------------------
-- Unsigned types
type Byte is mod 2 ** Byte_Bits;
type Short is mod 2 ** Short_Bits;
type Word is mod 2 ** Word_Bits;
type Long is mod 2 ** Long_Bits;
for Byte'Size use Byte_Bits;
for Short'Size use Short_Bits;
for Word'Size use Word_Bits;
for Long'Size use Long_Bits;
-- Signed types
Byte_Exp : constant := Byte_Bits - 1;
Short_Exp : constant := Short_Bits - 1;
Word_Exp : constant := Word_Bits - 1;
Long_Exp : constant := Long_Bits - 1;
type S_Byte is new Integer range -(2 ** Byte_Exp) .. (2 ** Byte_Exp) - 1;
type S_Short is new Integer range -(2 ** Short_Exp) .. (2 ** Short_Exp) - 1;
type S_Word is new Integer range -(2 ** Word_Exp) .. (2 ** Word_Exp) - 1;
type S_Long is new Long_Long_Integer; -- must use this for now; fixme later
for S_Byte'Size use Byte_Bits;
for S_Short'Size use Short_Bits;
for S_Word'Size use Word_Bits;
for S_Long'Size use Long_Bits;
-- Array types built from the above basic types
type Byte_String is array (Natural range <>) of Byte;
type Short_String is array (Natural range <>) of Short;
type Word_String is array (Natural range <>) of Word;
type Long_String is array (Natural range <>) of Long;
type S_Byte_String is array (Natural range <>) of S_Byte;
type S_Short_String is array (Natural range <>) of S_Short;
type S_Word_String is array (Natural range <>) of S_Word;
type S_Long_String is array (Natural range <>) of S_Long;
-- Useful byte-string types for data conversion
subtype Short_Byte_String is Byte_String (1 .. Short_Bytes);
subtype Word_Byte_String is Byte_String (1 .. Word_Bytes);
subtype Long_Byte_String is Byte_String (1 .. Long_Bytes);
---------------------------------------------------------------------------
end Lumen.Binary;
|
src/NewSuperMarioBrosU/Workarounds/CrashFix/patch_CrashFix.asm | lilystudent2016/cemu_graphic_packs | 1,002 | 21433 | [NSMBU+LU_CrashFix_V0]
moduleMatches = 0x1049CED8, 0x777D7B44
; remove check for mii data
0x024D7394 = b .+0xE8
[NSMBU_CrashFix_V64USV80EU]
moduleMatches = 0x6CAEA914, 0xFA29C89F
0x024D71C4 = b .+0xE8
[NSMBU_CrashFix_V0USV0EU]
moduleMatches = 0xA7A5ECF1, 0xC7B938AD
0x024BDE70 = b .+0xE8
[NSLU_CrashFix_V0EUv0US]
moduleMatches = 0xA3705C0B, 0xE71A8748
0x024D7158 = b .+0xE8
; Note: for future versions take the crash log and get the module checksum from the user. Subtract 0x7c from the link register in the crash log to be the address we patch.
|
SystemsProgramming/p13.asm | aaiijmrtt/JUCSE | 6 | 86932 | <filename>SystemsProgramming/p13.asm<gh_stars>1-10
%include "util.mac"
extern buffer, array, inprompt, newline, arraysize, inpromptsize, newlinesize, outprompt, outpromptsize, inputarray, printarray
section .text
global _start
_start:
call inputarray
write inprompt, inpromptsize
write newline, newlinesize
call printarray
write newline, newlinesize
mov bh, [arraysize]
call insert
write outprompt, outpromptsize
write newline, newlinesize
call printarray
write newline, newlinesize
exit
insert:
pusha
mov edx, 1
outer:
mov al, [array + edx]
mov ecx, edx
inner:
cmp [array + ecx - 1], al
jbe skip
mov ah, [array + ecx -1 ]
mov [array + ecx], ah
loop inner
skip:
mov [array + ecx], al
call printarray
write newline, newlinesize
inc dl
cmp dl, [arraysize]
jnz outer
popa
ret
|
programs/oeis/138/A138452.asm | neoneye/loda | 22 | 28995 | ; A138452: a(n) = ((n-th prime)^6-(n-th prime)^3))/2.
; 28,351,7750,58653,885115,2412306,12066328,23519511,74011861,297399466,443736945,1282837878,2375017660,3160641771,5389555753,11082106126,21090164131,25760073690,45229040703,64049963005,75666918636,121543481241,163469900791,248490292996,416485546128,530759560150,597025601901,750364563403,838549407906,1040975154856,2097935433153,2526955448095,3305926839628,3606273363771,5471261639326,5926954072725,7488033980778,9377682623631,10845978469453,13404374077186,16447053854791,17580911198670,24275609652385,25841266680096,29225860331878,31051916359101,44122965119415,61489242578961,68410869505903,72107902396566,80002856945116,93187439365321,97965290073960,125029445687875,144068395270528,165464362881181,189445224458386,198054962101305,225864823357278,246154570614820,256855339539891,316355733030646,418600981392903,452410133466565,470149539919956,507370910687578,657563888530395,732401791963128,872864523898003,903488347788426,967427050805776,1070376797676781,1221705083746953,1346551558274286,1481853451941891,1578202185349441,1732477507392646,1957550785623378,2078912608960600,2340506470115556,2705541103261711,2783957323695030,3205041223901545,3295318352814216,3578962275308421,3779134568543971,4096830966882976,4554777852170028,4799274075962290,4925563769176281,5186462993595703,6039251013655441,6670275439598253,7005819654381835,7719217439747751,8098002588608101,8695142324778106,9999915750199180,10232461858879611,12535844382058410
seq $0,40 ; The prime numbers.
pow $0,3
bin $0,2
|
oeis/087/A087584.asm | neoneye/loda-programs | 11 | 6001 | <reponame>neoneye/loda-programs<filename>oeis/087/A087584.asm
; A087584: a(n)=(1/7)*sum(k=0,n,binomial(n,k)*Fibonacci(k)*7^k).
; Submitted by <NAME>
; 1,9,122,1467,18205,223992,2762333,34044669,419657674,5172750495,63760719089,785929242096,9687552661513,119411072879553,1471889315038010,18142857823403763,223633182327192277,2756555811704284776,33977962780753446341,418820453306656692885
mov $1,1
mov $3,1
lpb $0
sub $0,1
mov $2,$3
mul $2,49
mul $3,8
add $3,$1
add $1,$2
lpe
mov $0,$3
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/hyper_flat.adb | best08618/asylo | 7 | 3541 | -- { dg-do run }
-- { dg-options "-gnatp" }
procedure Hyper_Flat is
type Unsigned is mod 2 ** 32;
x : Integer := 0;
pragma Volatile (X);
S : constant String := (1 .. X - 3 => 'A');
-- Hyper-flat null string
begin
if Unsigned'(S'Length) /= 0 then
raise Program_Error;
end if;
end;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr42_pkg.ads | best08618/asylo | 7 | 18816 | package Discr42_Pkg is
type Rec (D : Boolean := False) is record
case D is
when True => N : Natural;
when False => null;
end case;
end record;
function F (Pos : in out Natural) return Rec;
end Discr42_Pkg;
|
SMP9_4.X/SMP9_4.asm | tabinohito/I4_PIC | 0 | 95885 | <filename>SMP9_4.X/SMP9_4.asm
LIST P=PIC16F84A
#INCLUDE<P16F84A.INC>
__CONFIG _HS_OSC&_CP_OFF&_WDT_OFF&_PWRTE_ON
W_TEMP EQU 0CH
STATUS_TEMP EQU 0DH
CNT1 EQU 0EH
CNTB EQU 0FH
TMPA EQU 010H
OUT EQU 011H
REG1 EQU 012H
ORG 0H
GOTO MAIN
ORG 04H
;PUSH
MOVWF W_TEMP
MOVF STATUS,W
MOVWF STATUS_TEMP
CALL CRECV
MOVWF OUT
;POP
MOVF STATUS_TEMP,W
MOVWF STATUS
SWAPF W_TEMP,F
SWAPF W_TEMP,W
BCF INTCON,INTF
RETFIE
;REMAINING CODE GOES HERE
MAIN
BSF STATUS,RP0
BCF INTCON,GIE
CLRF TRISA
MOVLW 0FH
MOVWF TRISB
BCF OPTION_REG,INTEDG
BCF STATUS,RP0
BSF INTCON,GIE
BSF INTCON,INTE
MAINLP
MOVF OUT,W
MOVWF REG1
MOVLW 030H
SUBWF REG1,F
BTFSC STATUS,Z
GOTO L0
MOVLW 001H
SUBWF REG1,F
BTFSC STATUS,Z
GOTO L1
MOVLW 001H
SUBWF REG1,F
BTFSC STATUS,Z
GOTO L2
GOTO L3
L0
MOVLW 01H
MOVWF PORTA
GOTO MAINLP
L1
MOVLW 02H
MOVWF PORTA
GOTO MAINLP
L2
MOVLW 04H
MOVWF PORTA
GOTO MAINLP
L3
MOVLW 08H
MOVWF PORTA
GOTO MAINLP
CRECV
CLRF TMPA
MOVLW 08H
MOVWF CNTB
CALL TIME156
CRECVLP
BTFSC PORTB,0
BSF STATUS,C
BTFSS PORTB,0
BCF STATUS,C
RRF TMPA,F
CALL TIME104
DECFSZ CNTB,F
GOTO CRECVLP
MOVF TMPA,W
RETURN
TIME156
MOVLW 0C3H
MOVWF CNT1
LOOP1
NOP
DECFSZ CNT1,F
GOTO LOOP1
RETURN
TIME104
MOVLW 082H
MOVWF CNT1
LOOP2
NOP
DECFSZ CNT1,F
GOTO LOOP2
RETURN
END |
test/Succeed/Issue162.agda | cruhland/agda | 1,989 | 15864 | -- Now you don't need a mutual keyword anymore!
module Issue162 where
data Odd : Set
data Even : Set where
zero : Even
suc : Odd → Even
data Odd where
suc : Even → Odd
-- This means you can have all kinds of things in
-- mutual blocks.
-- Like postulates
_o+e_ : Odd → Even → Odd
_e+e_ : Even → Even → Even
zero e+e m = m
suc n e+e m = suc (n o+e m)
postulate todo : Even
suc n o+e m = suc todo
-- Or modules
_e+o_ : Even → Odd → Odd
_o+o_ : Odd → Odd → Even
suc n o+o m = suc (n e+o m)
module Helper where
f : Even → Odd → Odd
f zero m = m
f (suc n) m = suc (n o+o m)
n e+o m = Helper.f n m
-- Multiplication just for the sake of it
_o*o_ : Odd → Odd → Odd
_e*o_ : Even → Odd → Even
zero e*o m = zero
suc n e*o m = m o+o (n o*o m)
suc n o*o m = m o+e (n e*o m)
|
src/Progress.agda | boystrange/FairSubtypingAgda | 4 | 3303 | <reponame>boystrange/FairSubtypingAgda
-- MIT License
-- Copyright (c) 2021 <NAME> and <NAME>
-- Permission is hereby granted, free of charge, to any person
-- obtaining a copy of this software and associated documentation
-- files (the "Software"), to deal in the Software without
-- restriction, including without limitation the rights to use,
-- copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following
-- conditions:
-- The above copyright notice and this permission notice shall be
-- included in all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-- OTHER DEALINGS IN THE SOFTWARE.
{-# OPTIONS --guardedness #-}
open import Data.Product
open import Data.Sum
open import Common
module Progress {ℙ : Set} (message : Message ℙ)
where
open import SessionType message
open import Transitions message
open import Session message
data Progress : Session -> Set where
win#def : ∀{T S} (w : Win T) (def : Defined S) -> Progress (T # S)
inp#out : ∀{f g} (W : Witness g) -> Progress (inp f # out g)
out#inp : ∀{f g} (W : Witness f) -> Progress (out f # inp g)
progress-sound : ∀{S} -> Progress S -> ProgressS S
progress-sound (win#def e def) = inj₁ (win#def e def)
progress-sound (inp#out (_ , !x)) = inj₂ (_ , sync inp (out !x))
progress-sound (out#inp (_ , !x)) = inj₂ (_ , sync (out !x) inp)
progress-complete : ∀{S} -> ProgressS S -> Progress S
progress-complete (inj₁ (win#def e def)) = win#def e def
progress-complete (inj₂ (_ , sync inp (out !x))) = inp#out (_ , !x)
progress-complete (inj₂ (_ , sync (out !x) inp)) = out#inp (_ , !x)
|
QuantitativeAlloy/models/alloy/league/league_history_quantitative.als | pf7/QAlloy | 0 | 4040 | sig Team{ History : set Result }
sig Date{}
sig Game{
home : one Team,
away : one Team,
date : one Date,
s : one Game
}
abstract sig Result{}
one sig Win, Lose extends Result{}
fact{
--(a) No team can play two games on the same date;
--(away + home) . ~(away + home) & date . ~date in iden
~(away + home) . date <= Team -> Date
--(b) All teams play against each other but not against themselves
~home . away = (Team -> Team) - iden
--(c) For each home game there is another game away involving the same two teams
away . ~away & home . ~home in iden
-- Game isomorphism
s = away . ~home & home . ~away
-- There is a winner for every loser
#History.Win = #History.Lose
-- Every team either wins or loses each game in which they take part
all t : Team | #(home + away).t = #t.History
}
run{} for exactly
3 Team,
6 Game,
6 Date
run{} for exactly
4 Team,
12 Game,
6 Date
|
programs/oeis/157/A157657.asm | neoneye/loda | 22 | 10396 | <filename>programs/oeis/157/A157657.asm
; A157657: a(1) = 1, a(n) = -mu(n) for n >= 2.
; 1,1,1,0,1,-1,1,0,0,-1,1,0,1,-1,-1,0,1,0,1,0,-1,-1,1,0,0,-1,0,0,1,1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,0,-1,1,0,0,0,-1,0,1,0,-1,0,-1,-1,1,0,1,-1,0,0,-1,1,1,0,-1,1,1,0,1,-1,0,0,-1,1,1,0,0,-1,1,0,-1,-1,-1,0,1,0,-1,0,-1,-1,-1,0,1,0,0,0
max $0,2
seq $0,8683 ; Möbius (or Moebius) function mu(n). mu(1) = 1; mu(n) = (-1)^k if n is the product of k different primes; otherwise mu(n) = 0.
sub $1,$0
mov $0,$1
|
src/loga.adb | mangl-auf/loga | 1 | 5515 | <filename>src/loga.adb
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO;
with Ada.Environment_Variables;
with GNAT.String_Split;
package body Loga is
----------------
-- New_Logger --
----------------
Current_Color : Natural range Colors_As_Integer (Colors'Val (1)) ..
Colors_As_Integer (Colors'Last) := Colors_As_Integer (Red);
function New_Logger (Name : String;
Color : Colors := Normal) return Logger
is
Result : Logger;
package Env renames Ada.Environment_Variables;
Debug_Env_Var : Unbounded_String;
Vars_In_Debug_Env_Var : GNAT.String_Split.Slice_Set;
function Contains_Wildcard (Var : String; Index : out Positive)
return Boolean;
function Contains_Wildcard (Var : String; Index : out Positive)
return Boolean is
begin
for I in Var'Range loop
if Var (I) = '*' then
Index := I;
return True;
end if;
end loop;
return False;
end Contains_Wildcard;
begin
begin
Debug_Env_Var := To_Unbounded_String (Env.Value ("DEBUG"));
exception
when Constraint_Error =>
Result.Disabled := True;
return Result;
end;
GNAT.String_Split.Create (S => Vars_In_Debug_Env_Var,
From => To_String (Debug_Env_Var),
Separators => ",",
Mode => GNAT.String_Split.Multiple);
for I in 1 .. GNAT.String_Split.Slice_Count (Vars_In_Debug_Env_Var) loop
declare
Var : constant String :=
GNAT.String_Split.Slice (Vars_In_Debug_Env_Var, I);
Index_Of_Wildcard : Positive;
begin
if Name'Length >= Var'Length - 1
and then Contains_Wildcard (Var, Index_Of_Wildcard)
then
if Index_Of_Wildcard = 1
and then Var (2 .. Var'Length) =
Name (Name'Last - Var'Length + 2 .. Name'Last)
then
Result.Disabled := False;
elsif Index_Of_Wildcard = Var'Last
and then Var (Var'First .. Var'Last - 1) =
Name (Name'First .. Var'Length - 1)
then
Result.Disabled := False;
end if;
elsif Var = Name then
Result.Disabled := False;
exit;
end if;
end;
end loop;
if Result.Disabled then
return Result;
end if;
Result.Name := To_Unbounded_String (Name);
if Current_Color > Colors_As_Integer (Colors'Last) then
Current_Color := Colors_As_Integer (Colors'Val (1));
end if;
if Color /= Normal then
Result.Color := Color;
else
Result.Color := Colors'Val (Current_Color - 30);
end if;
Current_Color := Current_Color + 1;
return Result;
end New_Logger;
---------
-- Log --
---------
procedure Log (Self : Logger; Message : String) is
procedure Colorize_Output (Color : Colors);
function Start_Bold return String;
function End_Bold return String;
procedure Colorize_Output (Color : Colors) is
use Ada.Integer_Text_IO;
begin
Put (Character'Val (27) & "[");
Put (Colors_As_Integer (Color), Width => 0);
Put ("m");
end Colorize_Output;
function Start_Bold return String is
begin
return Character'Val (27) & "[1m";
end Start_Bold;
function End_Bold return String is
begin
return Character'Val (27) & "[0m";
end End_Bold;
begin
if not Self.Disabled then
Colorize_Output (Self.Color);
Put (Start_Bold & " " & To_String (Self.Name) & End_Bold & " ");
Colorize_Output (Normal);
Put_Line (Message);
end if;
end Log;
---------------
-- Get_Color --
---------------
function Get_Color (Self : Logger) return Colors is
begin
return Self.Color;
end Get_Color;
end Loga;
|
3-mid/opengl/source/lean/model/opengl-model-segment_line.adb | charlie5/lace-alire | 1 | 3762 | <reponame>charlie5/lace-alire<filename>3-mid/opengl/source/lean/model/opengl-model-segment_line.adb<gh_stars>1-10
with
openGL.Primitive.indexed,
openGL.Primitive,
ada.unchecked_Deallocation;
package body openGL.Model.segment_line
is
function to_segment_line_Model (Color : in openGL.Color) return Item
is
Self : constant Item := (Model.item with
+Color,
site_Vectors.empty_Vector,
others => <>);
begin
return Self;
end to_segment_line_Model;
function new_segment_line_Model (Color : in openGL.Color) return View
is
begin
return new Item' (to_segment_line_Model (Color));
end new_segment_line_Model;
overriding
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
Fonts : in Font.font_id_Map_of_font) return Geometry.views
is
pragma unreferenced (Textures, Fonts);
use Geometry.colored,
Primitive,
Primitive.indexed,
ada.Containers;
vertex_Count : constant Index_t := Index_t (Self.Points.Length);
indices_Count : constant long_Index_t := long_Index_t (vertex_Count);
the_Indices : aliased Indices := (1 .. indices_Count => <>);
begin
if Self.Points.Length <= 2
then
return (1..0 => <>);
end if;
for i in the_Indices'Range
loop
the_Indices (i) := Index_t (i);
end loop;
Self.Geometry := Geometry.colored.new_Geometry;
Self.Geometry.is_Transparent (False);
Self.Geometry.Vertices_are (Self.Vertices (1 .. Index_t (Self.vertex_Count)));
Self.Geometry.add (Primitive.view (new_Primitive (Line_Strip,
the_Indices)));
return (1 => Self.Geometry.all'Access);
end to_GL_Geometries;
function Site (Self : in Item; for_End : in Integer) return Vector_3
is
begin
return Self.Vertices (Index_t (for_End)).Site;
end Site;
function segment_Count (Self : in Item) return Natural
is
begin
return Natural (Self.Points.Length) - 1;
end segment_Count;
procedure add_1st_Segment (Self : in out Item; start_Site : in Vector_3;
end_Site : in Vector_3)
is
use site_Vectors;
begin
pragma assert (Self.Points.Is_Empty);
Self.Points.append (start_Site);
Self.Points.append (end_Site);
Self.vertex_Count := Self.vertex_Count + 1;
Self.Vertices (Index_t (Self.vertex_Count)).Site := start_Site;
Self.Vertices (Index_t (Self.vertex_Count)).Color := (Self.Color, opaque_Value);
Self.vertex_Count := Self.vertex_Count + 1;
Self.Vertices (Index_t (Self.vertex_Count)).Site := end_Site;
Self.Vertices (Index_t (Self.vertex_Count)).Color := (Self.Color, opaque_Value);
Self.needs_Rebuild := True;
end add_1st_Segment;
procedure add_Segment (Self : in out Item; end_Site : in Vector_3)
is
use type ada.Containers.Count_type;
procedure deallocate is new ada.unchecked_Deallocation (Geometry.colored.Vertex_array,
vertex_Array_view);
begin
pragma assert (not Self.Points.is_Empty);
Self.Points.append (end_Site);
if Self.Points.Length > Self.Vertices'Length
then
declare
new_Vertices : constant vertex_Array_view
:= new Geometry.colored.Vertex_array (1 .. 2 * Self.Vertices'Length);
begin
new_Vertices (1 .. Self.Vertices'Length) := Self.Vertices.all;
deallocate (Self.Vertices);
Self.Vertices := new_Vertices;
end;
end if;
Self.vertex_Count := Self.vertex_Count + 1;
Self.Vertices (Index_t (Self.vertex_Count)).Site := end_Site;
Self.Vertices (Index_t (Self.vertex_Count)).Color := (Self.Color, opaque_Value);
Self.needs_Rebuild := True;
end add_Segment;
procedure Site_is (Self : in out Item; Now : in Vector_3;
for_End : in Integer)
is
begin
Self.Vertices (Index_t (for_End)).Site := Now;
Self.Points.replace_Element (for_End, Now);
set_Bounds (Self);
Self.needs_Rebuild := True;
end Site_is;
procedure Color_is (Self : in out Item; Now : in Color;
for_End : in Integer)
is
begin
Self.Vertices (Index_t (for_End)).Color := (+Now, opaque_Value);
Self.needs_Rebuild := True;
end Color_is;
function Segments (Self : in Item) return Segments_t
is
the_Segments : Segments_t (1 .. Integer (Self.Points.Length) - 1);
begin
for Each in the_Segments'Range
loop
the_Segments (Each) := (First => Self.Points.Element (Each),
Last => Self.Points.Element (Each + 1));
end loop;
return the_Segments;
end Segments;
function Angle_in_xz_plane (the_Segment : in Segment) return Radians
is
use real_Functions;
the_Vector : constant Vector_3 := the_Segment.Last - the_Segment.First;
begin
return arcTan (the_Vector (3) / the_Vector (1));
end Angle_in_xz_plane;
end openGL.Model.segment_line;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/requeue1.adb | best08618/asylo | 7 | 14027 | <gh_stars>1-10
-- { dg-do run }
with Ada.Text_Io; use Ada.Text_Io;
procedure requeue1 is
protected P is
entry Requeue_Without_Abort;
entry Queue_Without;
procedure Open;
private
Opened: Boolean := False;
end P;
protected body P is
entry Requeue_Without_Abort when True is
begin
-- BUG: after this requeue no time out of the call should be possible
requeue Queue_Without;
end Requeue_Without_Abort;
entry Queue_Without when Opened is
begin
Opened := False;
end Queue_Without;
procedure Open is
begin
Opened := True;
end Open;
end P;
-- Test of timed entry call to an entry with requeue without abort
task T_Without;
task body T_Without is
begin
select
P.Requeue_Without_Abort;
or
delay 1.0;
Put_Line("failed");
end select;
exception
when others => Put_Line ("failed");
end T_Without;
begin
delay 3.0;
P.Open;
end;
|
main/src/parser/SVM.g4 | kode-git/project-compiler-antlr4 | 1 | 980 | grammar SVM;
@header {
import java.util.HashMap;
}
@lexer::members {
public int lexicalErrors=0;
}
/*------------------------------------------------------------------
* PARSER RULES
*------------------------------------------------------------------*/
assembly: (instruction)* ;
instruction:
( PUSH n=NUMBER
| PUSH l=LABEL
| POP
| ADD
| SUB
| MULT
| DIV
| AND
| OR
| NOT
| STOREW offset=NUMBER
| LOADW offset=NUMBER
| LWR1 offset=NUMBER
| SWR1 offset=NUMBER
| LWFP offset=NUMBER
| SWFP offset=NUMBER
| LWHP offset=NUMBER
| SWHP offset=NUMBER
| SWHR2 offset=NUMBER
| l=LABEL COL
| BRANCH l=LABEL
| BRANCHEQ l=LABEL
| BRANCHLESSEQ l=LABEL
| BRANCHLESS l=LABEL
| JR
| LOADRA
| STORERA
| LOADRV
| STORERV
| LOADFP
| STOREFP
| COPYFP
| MOVEFP offset=NUMBER
| COPYAL
| LOADHP
| STOREHP
| PRINT
| PRINTHP
| HALT
| CRA
| STORER1
| LOADR1
| STORER2
| LOADR2
| STOREAL
| LOADAL
| LWAFP n=NUMBER
| LIR1 n=NUMBER
| LIR2 n=NUMBER
| NEW
) ;
/*------------------------------------------------------------------
* LEXER RULES
*------------------------------------------------------------------*/
// -------------- PUSH AND POP ON STACK --------------
PUSH : 'push' ; // pushes constant in the stack
POP : 'pop' ; // pops from stack
// -------------- ARITMETIC OPERATIONS --------------
ADD : 'add' ; // r1 <- r1 + r2
SUB : 'sub' ; // r1 <- r1 - r2
MULT : 'mult' ; // r1 <- r1 * r2
DIV : 'div' ; // r1 <- r1 / r2
// -------------- BOOLEAN OPERATIONS --------------
BRANCHEQ : 'beq' ; // jump to label if r1 == r2
BRANCHLESSEQ:'bleq' ; // jump to label if r1 <= r2
BRANCHLESS : 'bless' ; // jump to label if r1 < r2
AND : 'and'; // r1 = 1 if r1 && r2 is true else r1 = 0
OR : 'or'; // r1 = 0 if r1 || r2 is false else r1 = 1
NOT : 'not'; // if r1 = 1 then r1 = 0 else r1 = 1
// -------------- LOAD WORD AND STORE WORD -------------
STOREW : 'sw' ; // store the value of al in the MEMORY[offset + al] :: MEMORY[al + offset] = al
LOADW : 'lw' ; // set the value of al at MEMORY[al + offset] :: al = MEMORY[fp + offset]
SWR1 : 'sw1' ; // store the value of r1 in the MEMORY[offset + al] :: MEMORY[al + offset] = r1
LWR1 : 'lw1' ; // set the value of r1 at MEMORY[al + offset] :: r1 = MEMORY[al + offset]
SWHR2 : 'swhr2' ; // set the value of r2 into the MEMORY[r1 + offset] :: MEMORY[r1 + offset] = r2
SWFP : 'swfp' ; // set the value of r1 in the memory[offset + rsp] :: MEMORY[sp + offset] = r1
LWFP : 'lwfp' ; // set the value of r1 at MEMORY[sp + offset] :: r1 = MEMORY[sp + offset]
LWAFP : 'lwafp'; // set the value of al at MEMORY[sp + offset] :: al = MEMORY[sp + offset]
// -------------- HEAP INSTRUCTIONS -------------
SWHP : 'swhp' ; // set the value of r1 in the memory[offset + hp] :: MEMORY[hp + offset] = r1
LWHP : 'lwhp' ; // set the value of r1 at MEMORY[hp + offset] :: r1 = MEMORY[r1 + offset]
NEW : 'new'; // new pointer
// -------------- JUMPING INSTRUCTIONS -------------
CRA : 'cra' ; // set ra to the address of caller
JR : 'jr' ; // jump to the instruction pointed by ra
BRANCH : 'b' ; // jump to label
// -------------- LOAD/STORE REGISTERS ON/FROM STACK -------------
LOADRA : 'lra' ; // load ra in the top of stack
STORERA : 'sra' ; // store top of stack into ra
LOADRV : 'lrv' ; // load rv in the top of stack
STORERV : 'srv' ; // store top of stack into rv
LOADFP : 'lfp' ; // load fp in the top of stack
STOREFP : 'sfp' ; // store top of stack in fp
LOADHP : 'lhp' ; // load hp in the top of stack
STOREHP : 'shp' ; // store top into $hp
STORER1 : 'sr1' ; // store top of stack into r1
LOADR1 : 'lr1' ; // load r1 into the top of stack
STORER2 : 'sr2' ; // store top into r2
LOADR2 : 'lr2' ; // load r2 into the top of stack
STOREAL : 'sal' ; // store top into al
LOADAL : 'lal' ; // load al into the top of stack
// -------------- LI ISTRUCTIONS -------------
LIR1 : 'lir1' ; //set r1 with the value number n
LIR2 : 'lir2' ; //set r2 with the value number n
// -------------- PRINT -------------
PRINT : 'print' ; // print top of stack
PRINTHP : 'printhp'; // print hp value
// -------------- REGISTER COPYING -------------
COPYFP : 'cfp' ; // copy sp in fp :: fp <- sp
COPYAL : 'cal' ; // copy sp in al :: al <- sp
// ----------- MOVE -----------------
MOVEFP : 'mfp'; // fp <- sp - offset
// -------------- HALT -------------
HALT : 'halt' ; // stop execution
COL : ':' ;
LABEL : ('a'..'z'|'A'..'Z')('a'..'z' | 'A'..'Z' | '0'..'9')* ;
NUMBER : '0' | ('-')?(('1'..'9')('0'..'9')*);
WHITESP : ( '\t' | ' ' | '\r' | '\n' )+ -> channel(HIDDEN);
// Code is autogenerated, so we don't need to manage lexer like SimpLanPlus.g4
ERR : . { System.err.println("Invalid char: "+ getText()); lexicalErrors++; } -> channel(HIDDEN);
|
src/el-contexts-default.adb | My-Colaborations/ada-el | 0 | 28538 | -----------------------------------------------------------------------
-- EL.Contexts -- Default contexts for evaluating an expression
-- Copyright (C) 2009, 2010, 2011, 2012, 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.Unchecked_Deallocation;
with EL.Variables.Default;
package body EL.Contexts.Default is
use EL.Objects;
procedure Free is
new Ada.Unchecked_Deallocation (Object => EL.Variables.Variable_Mapper'Class,
Name => EL.Variables.Variable_Mapper_Access);
-- ------------------------------
-- Retrieves the ELResolver associated with this ELcontext.
-- ------------------------------
overriding
function Get_Resolver (Context : Default_Context) return ELResolver_Access is
begin
return Context.Resolver;
end Get_Resolver;
-- ------------------------------
-- Set the ELResolver associated with this ELcontext.
-- ------------------------------
procedure Set_Resolver (Context : in out Default_Context;
Resolver : in ELResolver_Access) is
begin
Context.Resolver := Resolver;
end Set_Resolver;
-- ------------------------------
-- Retrieves the Variable_Mapper associated with this ELContext.
-- ------------------------------
overriding
function Get_Variable_Mapper (Context : Default_Context)
return access EL.Variables.Variable_Mapper'Class is
begin
return Context.Var_Mapper;
end Get_Variable_Mapper;
-- ------------------------------
-- Retrieves the Function_Mapper associated with this ELContext.
-- The Function_Mapper is only used when parsing an expression.
-- ------------------------------
overriding
function Get_Function_Mapper (Context : Default_Context)
return EL.Functions.Function_Mapper_Access is
begin
return Context.Function_Mapper;
end Get_Function_Mapper;
-- ------------------------------
-- Set the function mapper to be used when parsing an expression.
-- ------------------------------
overriding
procedure Set_Function_Mapper (Context : in out Default_Context;
Mapper : access EL.Functions.Function_Mapper'Class) is
begin
if Mapper = null then
Context.Function_Mapper := null;
else
Context.Function_Mapper := Mapper.all'Unchecked_Access;
end if;
end Set_Function_Mapper;
-- ------------------------------
-- Set the Variable_Mapper associated with this ELContext.
-- ------------------------------
overriding
procedure Set_Variable_Mapper (Context : in out Default_Context;
Mapper : access EL.Variables.Variable_Mapper'Class) is
use EL.Variables;
begin
if Context.Var_Mapper_Created then
Free (Context.Var_Mapper);
end if;
if Mapper = null then
Context.Var_Mapper := null;
else
Context.Var_Mapper := Mapper.all'Unchecked_Access;
end if;
end Set_Variable_Mapper;
procedure Set_Variable (Context : in out Default_Context;
Name : in String;
Value : access Util.Beans.Basic.Readonly_Bean'Class) is
use EL.Variables;
begin
if Context.Var_Mapper = null then
Context.Var_Mapper := new EL.Variables.Default.Default_Variable_Mapper;
Context.Var_Mapper_Created := True;
end if;
Context.Var_Mapper.Bind (Name, EL.Objects.To_Object (Value, EL.Objects.STATIC));
end Set_Variable;
-- Handle the exception during expression evaluation.
overriding
procedure Handle_Exception (Context : in Default_Context;
Ex : in Ada.Exceptions.Exception_Occurrence) is
begin
null;
end Handle_Exception;
-- ------------------------------
-- Guarded Context
-- ------------------------------
-- ------------------------------
-- Retrieves the ELResolver associated with this ELcontext.
-- ------------------------------
overriding
function Get_Resolver (Context : in Guarded_Context) return ELResolver_Access is
begin
return Context.Context.Get_Resolver;
end Get_Resolver;
-- ------------------------------
-- Retrieves the Variable_Mapper associated with this ELContext.
-- ------------------------------
overriding
function Get_Variable_Mapper (Context : in Guarded_Context)
return access EL.Variables.Variable_Mapper'Class is
begin
return Context.Context.Get_Variable_Mapper;
end Get_Variable_Mapper;
-- ------------------------------
-- Retrieves the Function_Mapper associated with this ELContext.
-- The Function_Mapper is only used when parsing an expression.
-- ------------------------------
overriding
function Get_Function_Mapper (Context : in Guarded_Context)
return EL.Functions.Function_Mapper_Access is
begin
return Context.Context.Get_Function_Mapper;
end Get_Function_Mapper;
-- ------------------------------
-- Set the function mapper to be used when parsing an expression.
-- ------------------------------
overriding
procedure Set_Function_Mapper (Context : in out Guarded_Context;
Mapper : access EL.Functions.Function_Mapper'Class) is
begin
Context.Context.Set_Function_Mapper (Mapper);
end Set_Function_Mapper;
-- ------------------------------
-- Set the Variable_Mapper associated with this ELContext.
-- ------------------------------
overriding
procedure Set_Variable_Mapper (Context : in out Guarded_Context;
Mapper : access EL.Variables.Variable_Mapper'Class) is
begin
Context.Context.Set_Variable_Mapper (Mapper);
end Set_Variable_Mapper;
-- ------------------------------
-- Handle the exception during expression evaluation.
-- ------------------------------
overriding
procedure Handle_Exception (Context : in Guarded_Context;
Ex : in Ada.Exceptions.Exception_Occurrence) is
begin
Context.Handler.all (Ex);
end Handle_Exception;
-- ------------------------------
-- Get the value associated with a base object and a given property.
-- ------------------------------
overriding
function Get_Value (Resolver : Default_ELResolver;
Context : ELContext'Class;
Base : access Util.Beans.Basic.Readonly_Bean'Class;
Name : Unbounded_String) return Object is
pragma Unreferenced (Context);
Key : constant String := To_String (Name);
begin
if Base /= null then
return Base.Get_Value (Key);
end if;
declare
Pos : constant Objects.Maps.Cursor := Resolver.Map.Find (Key);
begin
if Objects.Maps.Has_Element (Pos) then
return Objects.Maps.Element (Pos);
end if;
end;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Set the value associated with a base object and a given property.
-- ------------------------------
overriding
procedure Set_Value (Resolver : in out Default_ELResolver;
Context : in ELContext'Class;
Base : access Util.Beans.Basic.Bean'Class;
Name : in Unbounded_String;
Value : in Object) is
begin
null;
end Set_Value;
-- ------------------------------
-- Register the value under the given name.
-- ------------------------------
procedure Register (Resolver : in out Default_ELResolver;
Name : in Unbounded_String;
Value : in Util.Beans.Basic.Readonly_Bean_Access) is
begin
Resolver.Register (Name, To_Object (Value));
end Register;
-- ------------------------------
-- Register the value under the given name.
-- ------------------------------
procedure Register (Resolver : in out Default_ELResolver;
Name : in Unbounded_String;
Value : in EL.Objects.Object) is
Key : constant String := To_String (Name);
begin
Objects.Maps.Include (Resolver.Map, Key, Value);
end Register;
overriding
procedure Finalize (Obj : in out Default_Context) is
begin
if Obj.Var_Mapper_Created then
Free (Obj.Var_Mapper);
end if;
end Finalize;
end EL.Contexts.Default;
|
programs/vesachk2.asm | informer2016/MichalOS | 0 | 16890 | ; ------------------------------------------------------------------
; MichalOS VESA mode checker
; ------------------------------------------------------------------
BITS 16
%INCLUDE "michalos.inc"
ORG 100h
start:
mov di, 800h ; 2kB after the program loads
call os_vesa_scan
mov bx, 4000h
mov ax, [di + 2] ; Get the screen width...
call os_int_to_string
call copy_string
call put_space
mov ax, [di + 4] ; ...then the height...
call os_int_to_string
call copy_string
call put_space
mov ah, 0
mov al, [di + 6] ; ...and finally the color depth
call os_int_to_string
call copy_string
call put_space
call put_comma
ret
.loadsgmt dw 2000h
put_comma:
mov byte [bx], ','
inc bx
ret
put_space:
mov byte [bx], ' '
inc bx
ret
copy_string: ; AX/BX = source/destination
pusha
mov si, ax
mov di, bx
.loop:
lodsb
cmp al, 0
je .exit
stosb ; Don't terminate the destination string with a 0!
jmp .loop
.exit:
mov [.tmp_word], di
popa
mov bx, [.tmp_word]
ret
.tmp_word dw 0 |
_tests/trrup/Gold/t4.g4 | SKalt/Domemtech.Trash | 16 | 939 | grammar t4;
p : '+=' | '?=' ;
p : '+=' | '?=' ;
p : '+=' | '?=' ;
p : a ( '+=' | '?=' ) ;
p : a ( '+=' | '?=' ) ;
p : a ( '+=' | '?=' ) ;
a : a 'a' a;
a : a 'a'? a;
a : 'a' b;
a : ('a' b)?;
a : c 'a' b d;
a : e ( 'a' | b) f;
a : ( '=>' | '->' )?;
d : a b | c;
d : (a b | c)?;
d : x (a b | c) y;
assignment : ( '=>' | '->' ) ? validID ( '+=' | '=' | '?=' ) assignableTerminal ;
foo: bar baz?;
bar: 'bar';
baz: 'baz';
|
bezout/main.adb | Stykk-Gruppen/math-tools | 1 | 734 | with Ada.Text_IO; use ADA.Text_IO;
with Ada.Command_Line; use Ada.Command_Line;
procedure main is
procedure extended_gcd(a : Integer; b : Integer) is
old_r : Integer := a;
r : Integer := b;
old_s : Integer := 1;
s : Integer := 0;
old_t : Integer := 0;
t : Integer := 1;
quotient : Integer;
temp : Integer;
begin
while r /= 0 loop
quotient := old_r / r;
temp := r;
r := old_r - quotient * temp;
old_r := temp;
temp := s;
s := old_s - quotient * temp;
old_s := temp;
temp := t;
t := old_t - quotient * temp;
old_t := temp;
end loop;
Put_Line("GCD: " & Integer'Image(old_r));
Put_Line("Bezuouts Coefficients: " & Integer'Image(old_s) & ", " &Integer'Image(old_t));
end extended_gcd;
num1 : Integer;
num2 : Integer;
begin
if Argument_Count /= 2 then
Put_Line("Wrong arguments, should be to non-negative integers");
end if;
num1 := Integer'Value(Argument(1));
num2 := Integer'Value(Argument(2));
extended_gcd(num1, num2);
end main;
|
source/debugs.adb | jquorning/CELLE | 0 | 12111 | --
--
--
with Ada.Text_IO;
with Rules;
with Types;
with Symbols.IO;
package body Debugs is
procedure JQ_Dump_Rules (Session : in Sessions.Session_Type;
Mode : in Integer)
is
use Ada.Text_IO;
use type Rules.Rule_Symbol_Access;
subtype Index_Number is Rules.Index_Number;
subtype Rule_Number is Rules.Rule_Number;
subtype Line_Number is Types.Line_Number;
begin
for Rule of Session.Rule loop
Put ("RULE INDEX"); Put (Index_Number'Image (Rule.Index));
Put (" RULE"); Put (Rule_Number'Image (Rule.Number));
Put (" LINE"); Put (Line_Number'Image (Rule.Line));
Put (" RULELINE"); Put (Line_Number'Image (Rule.Rule_Line));
if Mode = 1 then
Put (" PREC");
if Rule.Prec_Symbol = null then
Put (" <null>");
else
Put (Types.Symbol_Index'Image (Rule.Prec_Symbol.Index));
end if;
end if;
New_Line;
end loop;
end JQ_Dump_Rules;
procedure Put_States (Session : in Sessions.Session_Type;
Mode : in Integer)
is
begin
for State of Session.Sorted loop
Put_State (State);
Ada.Text_IO.New_Line;
if Mode = 1 then
Put_Configs (Session, Config_List => State.Config);
end if;
end loop;
end Put_States;
procedure Put_State (State : in States.State_Access)
is
use Ada.Text_IO;
use States;
begin
Put ("NUM");
Put (State.Number'Image);
Put (" AC.LEN");
Put (" 999");
-- Put (State.Action.Length'Image);
end Put_State;
procedure Put_Configs (Session : in Sessions.Session_Type;
Config_List : in Configs.Config_Access)
is
use Configs;
Config : Config_Access := Config_List;
begin
while Config /= null loop
Put_Config (Session, Config);
Ada.Text_IO.New_Line;
Config := Config.Next;
end loop;
end Put_Configs;
procedure Put_Config (Session : in Sessions.Session_Type;
Config : in Configs.Config_Access)
is
use Ada.Text_IO;
use Configs;
begin
Put (" ");
Put ("RULE");
Put (Config.Rule.Index'Image);
Put (" DOT");
Put (Config.Dot'Image);
-- Put ("STATE");
Put (" STATUS ");
Put (Config.Status'Image);
Put (" FS ");
Symbols.IO.Put_Named (Session, Set => Config.Follow_Set);
end Put_Config;
procedure Debug (On : in Boolean;
Message : in String)
is
begin
if On then
Ada.Text_IO.Put_Line (Message);
end if;
end Debug;
end Debugs;
|
library/fmGUI_ManageDatabase/fmGUI_ManageDb_FieldListFocus.applescript | NYHTC/applescript-fm-helper | 1 | 1517 | -- fmGUI_ManageDb_FieldListFocus({})
-- <NAME>, NYHTC
-- Focus in the list of fields in the "Fields" tab of Manage Database
(*
HISTORY:
1.1 -
1.0 - created
REQUIRES:
fmGUI_AppFrontMost
fmGUI_ManageDb_GoToTab_Fields
*)
on run
fmGUI_ManageDb_FieldListFocus({})
end run
--------------------
-- START OF CODE
--------------------
on fmGUI_ManageDb_FieldListFocus(prefs)
-- version 1.1
try
fmGUI_ManageDb_GoToTab_Fields({})
fmGUI_AppFrontMost()
tell application "System Events"
tell application process "FileMaker Pro Advanced"
set focused of (table 1 of scroll area 1 of tab group 1 of window 1) to true
return true
end tell
end tell
on error errMsg number errNum
error "Couldn't focus on Field list - " & errMsg number errNum
end try
end fmGUI_ManageDb_FieldListFocus
--------------------
-- END OF CODE
--------------------
on fmGUI_AppFrontMost()
tell application "htcLib" to fmGUI_AppFrontMost()
end fmGUI_AppFrontMost
on fmGUI_ManageDb_GoToTab_Fields(prefs)
tell application "htcLib" to fmGUI_ManageDb_GoToTab_Fields(prefs)
end fmGUI_ManageDb_GoToTab_Fields
|
extern/gnat_sdl/gnat_sdl2/src/sdl_sensor_h.ads | AdaCore/training_material | 15 | 29265 | <gh_stars>10-100
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with SDL_stdinc_h;
with Interfaces.C.Strings;
package SDL_sensor_h is
SDL_STANDARD_GRAVITY : constant := 9.80665; -- ..\SDL2_tmp\SDL_sensor.h:97
-- Simple DirectMedia Layer
-- Copyright (C) 1997-2018 <NAME> <<EMAIL>>
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
-- 3. This notice may not be removed or altered from any source distribution.
--
--*
-- * \file SDL_sensor.h
-- *
-- * Include file for SDL sensor event handling
-- *
--
-- Set up for C function definitions, even when using C++
-- *INDENT-OFF*
-- *INDENT-ON*
--*
-- * \brief SDL_sensor.h
-- *
-- * In order to use these functions, SDL_Init() must have been called
-- * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system
-- * for sensors, and load appropriate drivers.
--
type u_SDL_Sensor is null record; -- incomplete struct
subtype SDL_Sensor is u_SDL_Sensor; -- ..\SDL2_tmp\SDL_sensor.h:52
--*
-- * This is a unique ID for a sensor for the time it is connected to the system,
-- * and is never reused for the lifetime of the application.
-- *
-- * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
--
subtype SDL_SensorID is SDL_stdinc_h.Sint32; -- ..\SDL2_tmp\SDL_sensor.h:60
-- The different sensors defined by SDL
-- *
-- * Additional sensors may be available, using platform dependent semantics.
-- *
-- * Hare are the additional Android sensors:
-- * https://developer.android.com/reference/android/hardware/SensorEvent.html#values
--
--*< Returned for an invalid sensor
--*< Unknown sensor type
--*< Accelerometer
--*< Gyroscope
subtype SDL_SensorType is int;
SDL_SENSOR_INVALID : constant int := -1;
SDL_SENSOR_UNKNOWN : constant int := 0;
SDL_SENSOR_ACCEL : constant int := 1;
SDL_SENSOR_GYRO : constant int := 2; -- ..\SDL2_tmp\SDL_sensor.h:75
--*
-- * Accelerometer sensor
-- *
-- * The accelerometer returns the current acceleration in SI meters per
-- * second squared. This includes gravity, so a device at rest will have
-- * an acceleration of SDL_STANDARD_GRAVITY straight down.
-- *
-- * values[0]: Acceleration on the x axis
-- * values[1]: Acceleration on the y axis
-- * values[2]: Acceleration on the z axis
-- *
-- * For phones held in portrait mode, the axes are defined as follows:
-- * -X ... +X : left ... right
-- * -Y ... +Y : bottom ... top
-- * -Z ... +Z : farther ... closer
-- *
-- * The axis data is not changed when the phone is rotated.
-- *
-- * \sa SDL_GetDisplayOrientation()
--
--*
-- * Gyroscope sensor
-- *
-- * The gyroscope returns the current rate of rotation in radians per second.
-- * The rotation is positive in the counter-clockwise direction. That is,
-- * an observer looking from a positive location on one of the axes would
-- * see positive rotation on that axis when it appeared to be rotating
-- * counter-clockwise.
-- *
-- * values[0]: Angular speed around the x axis
-- * values[1]: Angular speed around the y axis
-- * values[2]: Angular speed around the z axis
-- *
-- * For phones held in portrait mode, the axes are defined as follows:
-- * -X ... +X : left ... right
-- * -Y ... +Y : bottom ... top
-- * -Z ... +Z : farther ... closer
-- *
-- * The axis data is not changed when the phone is rotated.
-- *
-- * \sa SDL_GetDisplayOrientation()
--
-- Function prototypes
--*
-- * \brief Count the number of sensors attached to the system right now
--
function SDL_NumSensors return int; -- ..\SDL2_tmp\SDL_sensor.h:127
pragma Import (C, SDL_NumSensors, "SDL_NumSensors");
--*
-- * \brief Get the implementation dependent name of a sensor.
-- *
-- * This can be called before any sensors are opened.
-- *
-- * \return The sensor name, or NULL if device_index is out of range.
--
function SDL_SensorGetDeviceName (device_index : int) return Interfaces.C.Strings.chars_ptr; -- ..\SDL2_tmp\SDL_sensor.h:136
pragma Import (C, SDL_SensorGetDeviceName, "SDL_SensorGetDeviceName");
--*
-- * \brief Get the type of a sensor.
-- *
-- * This can be called before any sensors are opened.
-- *
-- * \return The sensor type, or SDL_SENSOR_INVALID if device_index is out of range.
--
function SDL_SensorGetDeviceType (device_index : int) return SDL_SensorType; -- ..\SDL2_tmp\SDL_sensor.h:145
pragma Import (C, SDL_SensorGetDeviceType, "SDL_SensorGetDeviceType");
--*
-- * \brief Get the platform dependent type of a sensor.
-- *
-- * This can be called before any sensors are opened.
-- *
-- * \return The sensor platform dependent type, or -1 if device_index is out of range.
--
function SDL_SensorGetDeviceNonPortableType (device_index : int) return int; -- ..\SDL2_tmp\SDL_sensor.h:154
pragma Import (C, SDL_SensorGetDeviceNonPortableType, "SDL_SensorGetDeviceNonPortableType");
--*
-- * \brief Get the instance ID of a sensor.
-- *
-- * This can be called before any sensors are opened.
-- *
-- * \return The sensor instance ID, or -1 if device_index is out of range.
--
function SDL_SensorGetDeviceInstanceID (device_index : int) return SDL_SensorID; -- ..\SDL2_tmp\SDL_sensor.h:163
pragma Import (C, SDL_SensorGetDeviceInstanceID, "SDL_SensorGetDeviceInstanceID");
--*
-- * \brief Open a sensor for use.
-- *
-- * The index passed as an argument refers to the N'th sensor on the system.
-- *
-- * \return A sensor identifier, or NULL if an error occurred.
--
function SDL_SensorOpen (device_index : int) return access SDL_Sensor; -- ..\SDL2_tmp\SDL_sensor.h:172
pragma Import (C, SDL_SensorOpen, "SDL_SensorOpen");
--*
-- * Return the SDL_Sensor associated with an instance id.
--
function SDL_SensorFromInstanceID (instance_id : SDL_SensorID) return access SDL_Sensor; -- ..\SDL2_tmp\SDL_sensor.h:177
pragma Import (C, SDL_SensorFromInstanceID, "SDL_SensorFromInstanceID");
--*
-- * \brief Get the implementation dependent name of a sensor.
-- *
-- * \return The sensor name, or NULL if the sensor is NULL.
--
function SDL_SensorGetName (sensor : access SDL_Sensor) return Interfaces.C.Strings.chars_ptr; -- ..\SDL2_tmp\SDL_sensor.h:184
pragma Import (C, SDL_SensorGetName, "SDL_SensorGetName");
--*
-- * \brief Get the type of a sensor.
-- *
-- * This can be called before any sensors are opened.
-- *
-- * \return The sensor type, or SDL_SENSOR_INVALID if the sensor is NULL.
--
function SDL_SensorGetType (sensor : access SDL_Sensor) return SDL_SensorType; -- ..\SDL2_tmp\SDL_sensor.h:193
pragma Import (C, SDL_SensorGetType, "SDL_SensorGetType");
--*
-- * \brief Get the platform dependent type of a sensor.
-- *
-- * This can be called before any sensors are opened.
-- *
-- * \return The sensor platform dependent type, or -1 if the sensor is NULL.
--
function SDL_SensorGetNonPortableType (sensor : access SDL_Sensor) return int; -- ..\SDL2_tmp\SDL_sensor.h:202
pragma Import (C, SDL_SensorGetNonPortableType, "SDL_SensorGetNonPortableType");
--*
-- * \brief Get the instance ID of a sensor.
-- *
-- * This can be called before any sensors are opened.
-- *
-- * \return The sensor instance ID, or -1 if the sensor is NULL.
--
function SDL_SensorGetInstanceID (sensor : access SDL_Sensor) return SDL_SensorID; -- ..\SDL2_tmp\SDL_sensor.h:211
pragma Import (C, SDL_SensorGetInstanceID, "SDL_SensorGetInstanceID");
--*
-- * Get the current state of an opened sensor.
-- *
-- * The number of values and interpretation of the data is sensor dependent.
-- *
-- * \param sensor The sensor to query
-- * \param data A pointer filled with the current sensor state
-- * \param num_values The number of values to write to data
-- *
-- * \return 0 or -1 if an error occurred.
--
function SDL_SensorGetData
(sensor : access SDL_Sensor;
data : access float;
num_values : int) return int; -- ..\SDL2_tmp\SDL_sensor.h:224
pragma Import (C, SDL_SensorGetData, "SDL_SensorGetData");
--*
-- * Close a sensor previously opened with SDL_SensorOpen()
--
procedure SDL_SensorClose (sensor : access SDL_Sensor); -- ..\SDL2_tmp\SDL_sensor.h:229
pragma Import (C, SDL_SensorClose, "SDL_SensorClose");
--*
-- * Update the current state of the open sensors.
-- *
-- * This is called automatically by the event loop if sensor events are enabled.
-- *
-- * This needs to be called from the thread that initialized the sensor subsystem.
--
procedure SDL_SensorUpdate; -- ..\SDL2_tmp\SDL_sensor.h:238
pragma Import (C, SDL_SensorUpdate, "SDL_SensorUpdate");
-- Ends C function definitions when using C++
-- *INDENT-OFF*
-- *INDENT-ON*
-- vi: set ts=4 sw=4 expandtab:
end SDL_sensor_h;
|
libsrc/_DEVELOPMENT/target/rc2014/device/acia/acia_init.asm | witchcraft2001/z88dk | 2 | 23161 | <filename>libsrc/_DEVELOPMENT/target/rc2014/device/acia/acia_init.asm
INCLUDE "config_private.inc"
SECTION code_driver
EXTERN _acia_reset, aciaControl
PUBLIC _acia_init
_acia_init:
; initialise the ACIA
ld a,__IO_ACIA_CR_RESET ; Master Reset the ACIA
out (__IO_ACIA_CONTROL_REGISTER),a
ld a,__IO_ACIA_CR_REI|__IO_ACIA_CR_TDI_RTS0|__IO_ACIA_CR_8N1|__IO_ACIA_CR_CLK_DIV_64
; load the default ACIA configuration
; 8n1 at 115200 baud
; receive interrupt enabled
; transmit interrupt disabled
ld (aciaControl),a ; write the ACIA control byte echo
out (__IO_ACIA_CONTROL_REGISTER),a ; output to the ACIA control
jp _acia_reset ; reset empties the Tx & Rx buffers
|
SOAS/Variable.agda | JoeyEremondi/agda-soas | 0 | 11039 |
-- Concrete definition of variables, context maps, and map operations
module SOAS.Variable {T : Set} where
open import SOAS.Common
open import SOAS.Context
open import SOAS.Sorting
open import SOAS.Families.Core {T}
-- Sorted family of variables, as typed, scoped de Bruijn indices
data ℐ : Familyₛ where
new : {α : T}{Γ : Ctx} → ℐ α (α ∙ Γ)
old : {α β : T}{Γ : Ctx} → ℐ β Γ → ℐ β (α ∙ Γ)
-- Explicitly specify the extra variable type
oldₑ : (α {β} : T)(Γ : Ctx) → ℐ β Γ → ℐ β (α ∙ Γ)
oldₑ α Γ = old {α}{_}{Γ}
open import Relation.Nullary
decEqℐ : ∀ {a b} (x y : ℐ a b) → Dec (x ≡ y)
decEqℐ new new = yes refl
decEqℐ new (old y) = no (λ ())
decEqℐ (old x) new = no (λ ())
decEqℐ (old x) (old y) with decEqℐ x y
... | yes refl = yes refl
... | no npf = no (λ { refl → npf refl })
-- | Context-family maps
-- Generalised transformations between 𝒳-terms in one context and 𝒴-terms in
-- another context. The special case of 𝒳 being the family of variables
-- gives the usual notion of an environment (Allais et al.) or "type preserving
-- map from variables over Γ to stuff over Δ" (McBride 2005), where "stuff" is a
-- sorted family.
-- Context-family map between two sorted families in different contexts.
-- The type is implicitly quantified over.
_~[_➔_]↝_ : Ctx → Familyₛ → Familyₛ → Ctx → Set
Γ ~[ 𝒳 ➔ 𝒴 ]↝ Δ = {τ : T} → 𝒳 τ Γ → 𝒴 τ Δ
-- 𝒳-valued context map, associating variables in context Γ with 𝒳-terms
-- in context Δ.
_~[_]↝_ : Ctx → Familyₛ → Ctx → Set
Γ ~[ 𝒳 ]↝ Δ = Γ ~[ ℐ ➔ 𝒳 ]↝ Δ
infix 10 _~[_]↝_
-- Renaming map, mapping variables to variables
_↝_ : Ctx → Ctx → Set
Γ ↝ Δ = Γ ~[ ℐ ]↝ Δ
infix 4 _↝_
|
03_UTIL_timestamp/win64/timestamp64.asm | jacwil/nasm-on-windows | 13 | 14334 | [BITS 64]
DEFAULT REL
GLOBAL _main
EXTERN ExitProcess
EXTERN GetStdHandle
EXTERN WriteFile
SECTION .bss
sHexstring: resb 16
lHexstring equ $-sHexstring
sHexstring_end equ sHexstring+lHexstring-1
SECTION .text
_main:
;align stack to 16 bytes for Win64 calls
and rsp, -10h
;give room to Win64 API calls that don't take stack params
sub rsp, 020h
rdtsc
mov rdi, sHexstring_end
mov rsi, rax
call hex32tostr
mov rsi, rdx
call hex32tostr
mov rcx, -0Bh ;STD_OUTPUT_HANDLE
call GetStdHandle
mov rcx, rax
mov rdx, sHexstring
mov r8, lHexstring
xor r9, r9
push r9
sub rsp, 20h ;Give Win64 API calls room
call WriteFile
add rsp, 28h ;Restore Stack Pointer
mov rcx, 0
call ExitProcess
xor rax, rax
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; hex32tostr ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Description: ;
; Takes a 32bit value and converts it to ;
; an ASCII string. ;
; Usage and Effects: ;
; RAX: DESTROYED upon return. ;
; RCX: DESTROYED upon return. ;
; ESI: 32bit input value. DESTROYED upon return. ;
; RDI: On function call, must be set to point to ;
; the last character in the output buffer. ;
; Function will decrement EDI for each char ;
; written, totalling 8 times. EDI will be ;
; pointing to the character preceding the ;
; start of the output buffer upon return. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
hex32tostr:
xor rcx, rcx
.loop:
mov rax, rsi
and rax, qword 0fh
add rax, 030h
cmp rax, 039h
jle .nonalpha
add rax, 7
.nonalpha:
mov byte [rdi], al
add rcx, 4
dec rdi
shr rsi, 4
cmp rcx, 32
jl .loop
ret
|
Task/Multiple-distinct-objects/Ada/multiple-distinct-objects-1.ada | LaudateCorpus1/RosettaCodeData | 1 | 24656 | <reponame>LaudateCorpus1/RosettaCodeData
A : array (1..N) of T;
|
src/Dodo/Binary/Disjoint.agda | sourcedennis/agda-dodo | 0 | 11860 | {-# OPTIONS --without-K --safe #-}
module Dodo.Binary.Disjoint where
-- Stdlib imports
open import Level using (Level; _⊔_) renaming (suc to ℓsuc)
open import Data.Empty using (⊥)
open import Data.Product using (_,_)
open import Relation.Unary using (Pred)
open import Relation.Binary using (REL)
open import Data.List using (List; _∷_; []; all; map)
open import Data.List.Relation.Unary.Any using (Any; here; there)
open import Relation.Nullary using (¬_)
-- Local imports
open import Dodo.Binary.Empty
open import Dodo.Binary.Equality
open import Dodo.Binary.Intersection
-- # Definitions
-- | Predicate stating two binary relations are never inhabited for the same elements.
Disjoint₂ : ∀ {a b ℓ₁ ℓ₂ : Level} {A : Set a} {B : Set b}
→ REL A B ℓ₁ → REL A B ℓ₂ → Set _
Disjoint₂ P Q = Empty₂ (P ∩₂ Q)
-- | Given a predicate `P`, `Any₂ P xs` states that /at least two/ elements in
-- `xs` satisfy `P`.
data Any₂ {a ℓ : Level} {A : Set a} (P : Pred A ℓ) : Pred (List A) (a ⊔ ℓ) where
here : ∀ {x xs} (px : P x) → Any P xs → Any₂ P (x ∷ xs)
there : ∀ {x xs} (pxs : Any₂ P xs) → Any₂ P (x ∷ xs)
-- | A predicate stating any two predicates in the list cannot be inhabitated for the same elements.
PairwiseDisjoint₁ : {a ℓ : Level} {A : Set a} → List (Pred A ℓ) → Set (a ⊔ ℓsuc ℓ)
PairwiseDisjoint₁ Ps = ∀ {x} → Any₂ (λ{P → P x}) Ps → ⊥
-- | A predicate stating any two binary relations in the list cannot be inhabitated for the same elements.
PairwiseDisjoint₂ : {a b ℓ : Level} {A : Set a} {B : Set b} → List (REL A B ℓ) → Set (a ⊔ b ⊔ ℓsuc ℓ)
PairwiseDisjoint₂ Rs = ∀ {x y} → Any₂ (λ{R → R x y}) Rs → ⊥
-- # Properties
module _ {a b ℓ₁ ℓ₂ : Level} {A : Set a} {B : Set b} {P : REL A B ℓ₁} {Q : REL A B ℓ₂} where
-- | If P is disjoint with Q, then Q is surely also disjoint with P.
disjoint₂-sym : Disjoint₂ P Q → Disjoint₂ Q P
disjoint₂-sym disjointPQ x y [Q∩P]xy =
let [P∩Q]xy = ⇔₂-apply-⊆₂ (∩₂-comm {P = Q} {Q = P}) [Q∩P]xy
in disjointPQ x y [P∩Q]xy
module _ {a b ℓ : Level} {A : Set a} {B : Set b} {P : REL A B ℓ} where
-- | Every relation is disjoint with its negation.
disjoint₂-neg : Disjoint₂ P (¬₂ P)
disjoint₂-neg x y (Pxy , ¬Pxy) = ¬Pxy Pxy
module _ {a b ℓ₁ ℓ₂ ℓ₃ : Level} {A : Set a} {B : Set b} {P : REL A B ℓ₁} {Q : REL A B ℓ₂} {R : REL A B ℓ₃} where
-- | If two relations P and Q are disjoint, then any subset R of P is also disjoint with Q.
disjoint₂-⊆ˡ : R ⊆₂ P → Disjoint₂ P Q → Disjoint₂ R Q
disjoint₂-⊆ˡ R⊆P disjointPQ x y [R∩Q]xy = disjointPQ x y (⊆₂-apply (∩₂-substˡ-⊆₂ {R = Q} R⊆P) [R∩Q]xy)
-- | If two relations P and Q are disjoint, then any subset R of Q is also disjoint with P.
disjoint₂-⊆ʳ : R ⊆₂ Q → Disjoint₂ P Q → Disjoint₂ P R
disjoint₂-⊆ʳ R⊆Q disjointPQ x y [P∩R]xy = disjointPQ x y (⊆₂-apply (∩₂-substʳ-⊆₂ {R = P} R⊆Q) [P∩R]xy)
|
oeis/026/A026008.asm | neoneye/loda-programs | 11 | 28726 | <filename>oeis/026/A026008.asm
; A026008: a(n) = T(n, floor(n/2)), where T = Catalan triangle (A008315).
; Submitted by <NAME>
; 1,1,2,3,5,9,14,28,42,90,132,297,429,1001,1430,3432,4862,11934,16796,41990,58786,149226,208012,534888,742900,1931540,2674440,7020405,9694845,25662825,35357670,94287120,129644790,347993910,477638700,1289624490,1767263190
mov $1,$0
mov $2,$0
div $2,2
bin $0,$2
sub $2,2
bin $1,$2
sub $0,$1
|
HydroModels2/src/interpreter/HydroModels.g4 | marcusbfs/HydroModel | 0 | 110 | <reponame>marcusbfs/HydroModel
grammar HydroModels;
// grammar
program : variablesStmt inputStmt outputStmt? modelStmt + END EOF ;
inputStmt : INPUT LEFT_BRACE varDecl+ RIGHT_BRACE ;
varDecl : IDENTIFIER EQUAL expression SEMICOLON ;
variablesStmt : VARIABLES LEFT_BRACE ( varassignments SEMICOLON ) + RIGHT_BRACE ;
modelStmt : MODEL STRING LEFT_BRACE parametersStmt? equationsStmt outputStmt? RIGHT_BRACE ;
parametersStmt : PARAMETERS LEFT_BRACE varDecl* RIGHT_BRACE;
varassignments : IDENTIFIER EQUAL expression # idEqualsExpr
| IDENTIFIER LEFT_PAREN DEFAULT EQUAL expression COMMA LOWER EQUAL expression COMMA UPPER EQUAL expression RIGHT_PAREN #idWithDefault
| IDENTIFIER LEFT_PAREN expression COMMA expression COMMA expression RIGHT_PAREN #idWithDefault
| IDENTIFIER LEFT_PAREN LOWER EQUAL expression COMMA UPPER EQUAL expression RIGHT_PAREN #idWithouDefault
| IDENTIFIER LEFT_PAREN expression COMMA expression RIGHT_PAREN #idWithouDefault
;
equationsStmt : EQUATIONS LEFT_BRACE ( equationassign SEMICOLON)+ RIGHT_BRACE;
equationassign : expression EQUAL expression #equationAssignEqual
| expression # equationAssignOneExpression
;
outputStmt : OUTPUT LEFT_BRACE outputDecl+ RIGHT_BRACE;
outputDecl : STRING COMMA IDENTIFIER SEMICOLON # outputDeclWithoutMul
| STRING COMMA IDENTIFIER COMMA expression SEMICOLON # outputDeclWithMul
;
expression : term op=( PLUS | MINUS) expression #exprRecursive
| term #exprTerm
;
term : factor op=(STAR | SLASH ) term #termFactorSTARSLASHterm
| factor #termFactor
;
factor : (op=( PLUS | MINUS) factor) #unaryFactor
| power #factorEqualsPower
;
power : atom POWER_OP factor #powerAtomPowerFactor
| atom #powerAtom
;
atom : IDENTIFIER #atomID
| NUMBER #atomNumber
| COS LEFT_PAREN expression RIGHT_PAREN #atomCos
| SIN LEFT_PAREN expression RIGHT_PAREN #atomSin
| EXP LEFT_PAREN expression RIGHT_PAREN #atomExp
| LN LEFT_PAREN expression RIGHT_PAREN #atomLn
| LOG10 LEFT_PAREN expression RIGHT_PAREN #atomLog10
| POWERFUNC LEFT_PAREN expression COMMA expression RIGHT_PAREN #atomPowerFunc
| LEFT_PAREN expression RIGHT_PAREN #atomParenthesis
;
// keywords
MODEL : 'MODEL';
VARIABLES : 'VARIABLES';
PARAMETERS : 'PARAMETERS';
EQUATIONS:'EQUATIONS';
DEFAULT : 'DEFAULT';
LOWER : 'LOWER';
UPPER : 'UPPER';
INPUT : 'INPUT';
OUTPUT : 'OUTPUT';
END : 'END';
// math
LN : 'ln' | 'log';
LOG10 : 'log10';
POWERFUNC : 'pow';
EXP : 'exp';
COS : 'cos';
SIN : 'sin';
LEFT_PAREN : '(' ;
RIGHT_PAREN : ')' ;
LEFT_BRACE : '{' ;
RIGHT_BRACE : '}' ;
COMMA : ',';
MINUS : '-';
PLUS : '+';
SEMICOLON : ';';
SLASH : '/';
STAR : '*' ;
EQUAL : '=';
POWER_OP : '^';
IDENTIFIER : (ID_LETTER|'_')('_'|ID_LETTER|DIGIT)*; //FromClanguage
fragment ID_LETTER :'a'..'z'|'A'..'Z'|'_';
fragment DIGIT :'0'..'9';
STRING : '"' .*? '"';
NUMBER
: Fractionalconstant Exponentpart?
;
fragment Fractionalconstant
: Digitsequence? '.' Digitsequence
| Digitsequence '.'
| Digitsequence
;
fragment Exponentpart
: 'e' SIGN? Digitsequence
| 'E' SIGN? Digitsequence
;
fragment SIGN
: [+-]
;
fragment Digitsequence
: DIGIT ('\''? DIGIT)*
;
COMMENTS : '#' .*? '\r'? '\n' -> skip;
BLOCKCOMMENT
: '/*' .*? '*/' -> skip
;
WS : [ \t\r\n]+ -> skip ;
|
src/Util/HoTT/Equiv/Induction.agda | JLimperg/msc-thesis-code | 5 | 2587 | -- This module closely follows a section of <NAME>'s HoTT lecture notes:
-- https://www.cs.bham.ac.uk/~mhe/HoTT-UF-in-Agda-Lecture-Notes/HoTT-UF-Agda.html#equivalenceinduction
{-# OPTIONS --without-K #-}
module Util.HoTT.Equiv.Induction where
open import Util.HoTT.HLevel.Core
open import Util.HoTT.Equiv
open import Util.HoTT.Univalence.ContrFormulation
open import Util.Prelude
private
variable
α β γ : Level
G-≃ : {A : Set α} (P : Σ[ B ∈ Set α ] (A ≃ B) → Set β)
→ P (A , ≃-refl)
→ ∀ {B} (A≃B : A ≃ B)
→ P (B , A≃B)
G-≃ {A = A} P p {B} A≃B = subst P (univalenceProp A (A , ≃-refl) (B , A≃B)) p
abstract
G-≃-β : {A : Set α} (P : Σ[ B ∈ Set α ] (A ≃ B) → Set β)
→ (p : P (A , ≃-refl))
→ G-≃ P p ≃-refl ≡ p
G-≃-β {A = A} P p = subst (λ q → subst P q p ≡ p) (sym go) refl
where
go : univalenceProp A (A , ≃-refl) (A , ≃-refl) ≡ refl
go = IsContr→IsSet (univalenceContr A) _ _
H-≃ : {A : Set α} (P : (B : Set α) → A ≃ B → Set β)
→ P A ≃-refl
→ ∀ {B} (A≃B : A ≃ B)
→ P B A≃B
H-≃ P p A≃B = G-≃ (λ { (B , A≃B) → P B A≃B }) p A≃B
abstract
H-≃-β : {A : Set α} (P : (B : Set α) → A ≃ B → Set β)
→ (p : P A ≃-refl)
→ H-≃ P p ≃-refl ≡ p
H-≃-β P p = G-≃-β (λ { (B , A≃B) → P B A≃B }) p
J-≃ : (P : (A B : Set α) → A ≃ B → Set β)
→ (∀ A → P A A ≃-refl)
→ ∀ {A B} (A≃B : A ≃ B)
→ P A B A≃B
J-≃ P p {A} {B} A≃B = H-≃ (λ B A≃B → P A B A≃B) (p A) A≃B
abstract
J-≃-β : (P : (A B : Set α) → A ≃ B → Set β)
→ (p : ∀ A → P A A ≃-refl)
→ ∀ {A}
→ J-≃ P p ≃-refl ≡ p A
J-≃-β P p {A} = H-≃-β (λ B A≃B → P A B A≃B) (p A)
H-IsEquiv : {A : Set α} (P : (B : Set α) → (A → B) → Set β)
→ P A id
→ ∀ {B} (f : A → B)
→ IsEquiv f
→ P B f
H-IsEquiv P p f f-equiv
= H-≃ (λ B A≃B → P B (A≃B .forth)) p
(record { forth = f ; isEquiv = f-equiv })
J-IsEquiv : (P : (A B : Set α) → (A → B) → Set β)
→ (∀ A → P A A id)
→ ∀ {A B} (f : A → B)
→ IsEquiv f
→ P A B f
J-IsEquiv P p f f-equiv
= J-≃ (λ A B A≃B → P A B (A≃B .forth)) p
(record { forth = f ; isEquiv = f-equiv })
|
reference/lab1/assembly/examples/linux/array1.asm | Leser2020/6.828 | 2 | 15384 |
;
; file: array1.asm
; This program demonstrates arrays in assembly
;
; To create executable:
; nasm -f coff array1.asm
; gcc -o array1 array1.o array1c.c
;
%define ARRAY_SIZE 100
%define NEW_LINE 10
segment .data
FirstMsg db "First 10 elements of array", 0
Prompt db "Enter index of element to display: ", 0
SecondMsg db "Element %d is %d", NEW_LINE, 0
ThirdMsg db "Elements 20 through 29 of array", 0
InputFormat db "%d", 0
segment .bss
array resd ARRAY_SIZE
segment .text
extern puts, printf, scanf, dump_line
global asm_main
asm_main:
enter 4,0 ; local dword variable at EBP - 4
push ebx
push esi
; initialize array to 100, 99, 98, 97, ...
mov ecx, ARRAY_SIZE
mov ebx, array
init_loop:
mov [ebx], ecx
add ebx, 4
loop init_loop
push dword FirstMsg ; print out elements 20-29
call puts ; print out FirstMsg
pop ecx
push dword 10
push dword array
call print_array ; print first 10 elements of array
add esp, 8
; prompt user for element index
Prompt_loop:
push dword Prompt
call printf
pop ecx
lea eax, [ebp-4] ; eax = address of local dword
push eax
push dword InputFormat
call scanf
add esp, 8
cmp eax, 1 ; eax = return value of scanf
je InputOK
call dump_line ; dump rest of line and start over
jmp Prompt_loop ; if input invalid
InputOK:
mov esi, [ebp-4]
push dword [array + 4*esi]
push esi
push dword SecondMsg ; print out value of element
call printf
add esp, 12
push dword ThirdMsg ; print out elements 20-29
call puts
pop ecx
push dword 10
push dword array + 20*4 ; address of array[20]
call print_array
add esp, 8
pop esi
pop ebx
mov eax, 0 ; return back to C
leave
ret
;
; routine print_array
; C-callable routine that prints out elements of a double word array as
; signed integers.
; C prototype:
; void print_array( const int * a, int n);
; Parameters:
; a - pointer to array to print out (at ebp+8 on stack)
; n - number of integers to print out (at ebp+12 on stack)
segment .data
OutputFormat db "%-5d %5d", NEW_LINE, 0
segment .text
global print_array
print_array:
enter 0,0
push esi
push ebx
xor esi, esi ; esi = 0
mov ecx, [ebp+12] ; ecx = n
mov ebx, [ebp+8] ; ebx = address of array
print_loop:
push ecx ; printf might change ecx!
push dword [ebx + 4*esi] ; push array[esi]
push esi
push dword OutputFormat
call printf
add esp, 12 ; remove parameters (leave ecx!)
inc esi
pop ecx
loop print_loop
pop ebx
pop esi
leave
ret
|
projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.asm | WuShaoa/Nand2Tetris | 0 | 161703 | @ARG
D=M
@1
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
@4
D=A
@R15
M=D
@SP
M=M-1
A=M
D=M
@R15
A=M
M=D
@0
D=A
@SP
A=M
M=D
@SP
M=M+1
@THAT
D=M
@0
D=D+A
@R15
M=D
@SP
M=M-1
A=M
D=M
@R15
A=M
M=D
@1
D=A
@SP
A=M
M=D
@SP
M=M+1
@THAT
D=M
@1
D=D+A
@R15
M=D
@SP
M=M-1
A=M
D=M
@R15
A=M
M=D
@ARG
D=M
@0
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
@2
D=A
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@SP
M=M-1
A=M
D=M-D
@SP
A=M
M=D
@SP
M=M+1
@ARG
D=M
@0
D=D+A
@R15
M=D
@SP
M=M-1
A=M
D=M
@R15
A=M
M=D
($MAIN_LOOP_START)
@ARG
D=M
@0
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@$COMPUTE_ELEMENT
D;JNE
@$END_PROGRAM
0;JMP
($COMPUTE_ELEMENT)
@THAT
D=M
@0
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
@THAT
D=M
@1
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@SP
M=M-1
A=M
D=D+M
@SP
A=M
M=D
@SP
M=M+1
@THAT
D=M
@2
D=D+A
@R15
M=D
@SP
M=M-1
A=M
D=M
@R15
A=M
M=D
@4
D=M
@SP
A=M
M=D
@SP
M=M+1
@1
D=A
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@SP
M=M-1
A=M
D=D+M
@SP
A=M
M=D
@SP
M=M+1
@4
D=A
@R15
M=D
@SP
M=M-1
A=M
D=M
@R15
A=M
M=D
@ARG
D=M
@0
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
@1
D=A
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@SP
M=M-1
A=M
D=M-D
@SP
A=M
M=D
@SP
M=M+1
@ARG
D=M
@0
D=D+A
@R15
M=D
@SP
M=M-1
A=M
D=M
@R15
A=M
M=D
@$MAIN_LOOP_START
0;JMP
($END_PROGRAM)
|
llvm-gcc-4.2-2.9/gcc/ada/s-osprim-vms.ads | vidkidz/crossbridge | 1 | 8292 | <reponame>vidkidz/crossbridge
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . O S _ P R I M I T I V E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1998-2005 Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNARL; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides low level primitives used to implement clock and
-- delays in non tasking applications on Alpha/VMS
-- The choice of the real clock/delay implementation (depending on whether
-- tasking is involved or not) is done via soft links (see s-soflin.ads)
-- NEVER add any dependency to tasking packages here
package System.OS_Primitives is
pragma Preelaborate;
subtype OS_Time is Long_Integer;
-- System time on VMS is used for performance reasons.
-- Note that OS_Time is *not* the same as Ada.Calendar.Time, the
-- difference being that relative OS_Time is negative, but relative
-- Calendar.Time is positive.
-- See Ada.Calendar.Delays for more information on VMS Time.
Max_Sensible_Delay : constant Duration :=
Duration'Min (183 * 24 * 60 * 60.0,
Duration'Last);
-- Max of half a year delay, needed to prevent exceptions for large
-- delay values. It seems unlikely that any test will notice this
-- restriction, except in the case of applications setting the clock at
-- at run time (see s-tastim.adb). Also note that a larger value might
-- cause problems (e.g overflow, or more likely OS limitation in the
-- primitives used). In the case where half a year is too long (which
-- occurs in high integrity mode with 32-bit words, and possibly on
-- some specific ports of GNAT), Duration'Last is used instead.
function OS_Clock return OS_Time;
-- Returns "absolute" time, represented as an offset
-- relative to "the Epoch", which is Nov 17, 1858 on VMS.
function Clock return Duration;
pragma Inline (Clock);
-- Returns "absolute" time, represented as an offset
-- relative to "the Epoch", which is Jan 1, 1970 on unixes.
-- This implementation is affected by system's clock changes.
function Monotonic_Clock return Duration;
pragma Inline (Monotonic_Clock);
-- Returns "absolute" time, represented as an offset
-- relative to "the Epoch", which is Jan 1, 1970.
-- This clock implementation is immune to the system's clock changes.
Relative : constant := 0;
Absolute_Calendar : constant := 1;
Absolute_RT : constant := 2;
-- Values for Mode call below. Note that the compiler (exp_ch9.adb)
-- relies on these values. So any change here must be reflected in
-- corresponding changes in the compiler.
procedure Timed_Delay (Time : Duration; Mode : Integer);
-- Implements the semantics of the delay statement when no tasking is
-- used in the application.
--
-- Mode is one of the three values above
--
-- Time is a relative or absolute duration value, depending on Mode.
--
-- Note that currently Ada.Real_Time always uses the tasking run time, so
-- this procedure should never be called with Mode set to Absolute_RT.
-- This may change in future or bare board implementations.
function To_Duration (T : OS_Time; Mode : Integer) return Duration;
-- Convert VMS system time to Duration
-- Mode is one of the three values above
function To_OS_Time (D : Duration; Mode : Integer) return OS_Time;
-- Convert Duration to VMS system time
-- Mode is one of the three values above
end System.OS_Primitives;
|
Lab5/ask3.asm | mikaelaksil/NTUA-Microprocessors | 0 | 7631 | INCLUDE macros.asm
CODE SEGMENT
ASSUME CS:CODE
MAIN PROC FAR
START:
CALL HEX_KEYB ;Εισαγωγή 1ου ψηφίου
CMP AL,'T' ;Ψηφίο = T ?
JE FINISH ;Έλεγχος για τερματισμό
MOV BL,AL ;Αποθήκευση 1ου ψηφίου
ROL BL,4 ;
CALL HEX_KEYB ;Εισαγωγή 2ου ψηφίου
CMP AL,'T'
JE FINISH
MOV DL,AL ;Αποθήκευση 2ου ψηφίου
ROL DL,4 ;
CALL HEX_KEYB ;Εισαγωγή 3ου ψηφίου
CMP AL,'T'
JE FINISH
OR BL,AL
OR DL,AL ;Ένωση ψηφίων
PRINTCH '='
CALL PRINT__DEC ;Εμφάνιση δεκαδικού
PRINTCH '='
CALL PRINT_OCT ;Εμφάνιση οκταδικού
PRINTCH '='
CALL PRINT_BIN ;Εμφάνιση δυαδικού
PRINTLN
JMP START
FINISH:
EXIT
MAIN ENDP
;Εισαγωγή δεκαεξαδικού ψηφίου (στον AL)
HEX_KEYB PROC NEAR
READ:
READCH
CMP AL,'T' ;=Τ ?
JE RETURN
CMP AL,48 ;<0 ?
JL READ
CMP AL,57 ;>9 ?
JG LETTER
PRINTCH AL
SUB AL,48 ;Κωδικός ASCII
JMP RETURN
LETTER: ;A...F
CMP AL,'A' ;<A ?
JL READ
CMP AL,'F' ;>F ?
JG READ
PRINTCH AL
SUB AL,55 ;Κωδικός ASCII
RETURN:
RET
HEX_KEYB ENDP
;Εμφάνιση δεκαδικού αριθμού (από τον BL)
PRINT__DEC PROC NEAR;βλ. mP11_80x86_programs.pdf σελ. 26-27
PUSH BX
MOV AL,BL
MOV BL,10 ;Δεκαδικός => διαιρέσεις με 10
MOV CX,0 ;Μετρητής ψηφίων
GETDEC: ;Εξαγωγή ψηφίων
MOV AH,0 ;Αριθμός mod 10 (υπόλοιπο)
DIV BL ;Διαίρεση με 10
PUSH AX ;Προσωρινή αποθήκευση
INC CL
CMP AL,0 ;Αριθμός div 10 = 0 ? (πηλίκο)
JNE GETDEC
PRINTDEC: ;Εμφάνιση ψηφίων
POP AX
ADD AH,48 ;Κωδικός ASCII
PRINTCH AH
LOOP PRINTDEC
POP BX
RET
PRINT__DEC ENDP
;Εμφάνιση οκταδικού αριθμού (από τον BL)
PRINT_OCT PROC NEAR
PUSH BX
MOV AL,BL
MOV BL,8 ;Οκταδικός => διαιρέσεις με 8
MOV CX,0
GETOCT:
MOV AH,0
DIV BL
PUSH AX
INC CL
CMP AL,0
JNE GETOCT
PRINTOCT:
POP AX
ADD AH,48
PRINTCH AH
LOOP PRINTOCT
POP BX
RET
PRINT_OCT ENDP
;Εμφάνιση δυαδικού αριθμού (από τον BL)
PRINT_BIN PROC NEAR
MOV AL,BL
MOV BL,2 ;Δυαδικός => διαιρέσεις με 2
MOV CX,0
GETBIN:
MOV AH,0
DIV BL
PUSH AX
INC CL
CMP AL,0
JNE GETBIN
PRINTBIN:
POP AX
ADD AH,48
PRINTCH AH
LOOP PRINTBIN
RET
PRINT_BIN ENDP
CODE ENDS
END MAIN |
alloy4fun_models/trashltl/models/18/QS6cySANCTJXecpK9.als | Kaixi26/org.alloytools.alloy | 0 | 3310 | <filename>alloy4fun_models/trashltl/models/18/QS6cySANCTJXecpK9.als<gh_stars>0
open main
pred idQS6cySANCTJXecpK9_prop19 {
all f : Protected | f in Protected until f in Trash
}
pred __repair { idQS6cySANCTJXecpK9_prop19 }
check __repair { idQS6cySANCTJXecpK9_prop19 <=> prop19o } |
src/case/jmp.asm | dberkerdem/Assebmler | 0 | 160185 | NOP
JMP LABEL2
LABEL1:
PRINT 'A'
LABEL2:
PRINT 'B'
HALT |
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/a-stzhas.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 23153 | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . S T R I N G S . W I D E _ W I D E _ H A S H --
-- --
-- B o d y --
-- --
-- Copyright (C) 2009-2021, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.String_Hash;
function Ada.Strings.Wide_Wide_Hash
(Key : Wide_Wide_String) return Containers.Hash_Type
is
use Ada.Containers;
function Hash_Fun is new System.String_Hash.Hash
(Wide_Wide_Character, Wide_Wide_String, Hash_Type);
begin
return Hash_Fun (Key);
end Ada.Strings.Wide_Wide_Hash;
|
libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sdcc/___schar2h_callee.asm | ahjelm/z88dk | 640 | 169587 |
SECTION code_fp_math16
PUBLIC ___schar2h_callee
PUBLIC _f16_i8_fastcall
EXTERN cm16_sdcc___schar2h_callee
EXTERN cm16_sdcc___schar2h_fastcall
defc ___schar2h_callee = cm16_sdcc___schar2h_callee
defc _f16_i8_fastcall = cm16_sdcc___schar2h_fastcall
|
Transitions/launch_ship.asm | ped7g/EliteNext | 9 | 6290 | <reponame>ped7g/EliteNext
launchship_page_marker DB "LaunchShipPG65"
launchdraw_table DB $7E,$3F, $04,$02, $66 ; purple blue
launchdraw_rowsize equ $-launchdraw_table
DB $7C,$3E, $08,$04, $66
DB $7A,$3D, $0C,$06, $66
DB $78,$3C, $10,$08, $66
DB $76,$3B, $14,$0A, $66
DB $74,$3A, $18,$0C, $66
DB $70,$38, $20,$10, $66
DB $6C,$36, $28,$14, $05 ; Black Blue
DB $68,$34, $30,$18, $05
DB $64,$32, $38,$1C, $05
DB $60,$30, $40,$20, $05
DB $5C,$2E, $48,$24, $05 ; Dark Blue
DB $58,$2C, $50,$28, $02
DB $54,$2A, $58,$2C, $02
DB $50,$28, $60,$30, $02
DB $4C,$26, $68,$34, $02
DB $46,$23, $74,$3A, $02
DB $40,$20, $80,$40, $02
DB $38,$1C, $90,$48, $01 ;Very Dark Blue
DB $30,$18, $A0,$50, $01
DB $26,$13, $B4,$5A, $01
DB $1C,$0E, $C8,$64, $01
DB $10,$08, $E0,$70, $00 ;Black
DB $02,$01, $FC,$7E, $00
DB $FF
launchtablesize EQU ($ - launchdraw_table)/launchdraw_rowsize
dockingdraw_table DB $7E,$3F, $04,$02, $00 ; purple blue
dockingdraw_rowsize equ $-dockingdraw_table
DB $7C,$3E, $08,$04, $00
DB $7A,$3D, $0C,$06, $00
DB $78,$3C, $10,$08, $04
DB $76,$3B, $14,$0A, $04
DB $74,$3A, $18,$0C, $04
DB $70,$38, $20,$10, $21
DB $6C,$36, $28,$14, $21 ; Black Blue
DB $68,$34, $30,$18, $21
DB $64,$32, $38,$1C, $25
DB $60,$30, $40,$20, $25
DB $5C,$2E, $48,$24, $25 ; Dark Blue
DB $58,$2C, $50,$28, $25
DB $54,$2A, $58,$2C, $25
DB $50,$28, $60,$30, $4C
DB $4C,$26, $68,$34, $4C
DB $46,$23, $74,$3A, $4C
DB $40,$20, $80,$40, $4C
DB $38,$1C, $90,$48, $6D ;Very Dark Blue
DB $30,$18, $A0,$50, $6D
DB $26,$13, $B4,$5A, $6D
DB $1C,$0E, $C8,$64, $6D
DB $10,$08, $E0,$70, $92 ;Black
DB $02,$01, $FC,$7E, $92
DB $FF
dockingtablesize EQU ($ - dockingdraw_table)/dockingdraw_rowsize
init_countdown EQU $FF
launch_countdown DB $0000
launch_table_idx DW launchdraw_table
docking_table_idx DW dockingdraw_table
current_offsetX db 0
current_offsetY db 0
LaunchTubeEdges MMUSelectLayer2
ld bc,$0000
ld de,$0192
.drawLoop1 ld a,b
cp 128
jr z,.DoneEdge
push af
push bc,,de,,bc,,de
call l2_draw_horz_dma_bank ;"bc = left side row,col, d = length, e = color"
pop bc,,de
ld a,$FF
sub d
ld c,a
inc c
call l2_draw_horz_dma_bank
pop bc,,de
ld a,b
cp 64
jr nc,.ReduceLoop
inc d
inc d
pop af
inc b
jr .drawLoop1
.ReduceLoop: dec d
dec d
pop af
inc b
jr .drawLoop1
.DoneEdge: ld a,$80
ld bc,$0000 ; Top Left
ld de,$80FF ; Bottom Right
call l2_draw_diagonal
ld a,$80
ld bc,$8000 ; Botom Left
ld de,$00FF ; Top Right
call l2_draw_diagonal
ld bc,$0000
ld DE,$0080
ld h,$60
ld l,$55
ret
LaunchConsole: MMUSelectConsoleBank ; Draw Console
ld hl,ScreenL1Bottom
ld de,ConsoleImageData
ld bc, ScreenL1BottomLen
call memcopy_dma
ld hl,ScreenL1AttrBtm ; now the pointers are in Ubnk its easy to read
ld de,ConsoleAttributes
ld bc, ScreenL1AttrBtmLen
call memcopy_dma
ret
CoriloisStation equ 13
draw_launch_ship: MMUSelectLayer1
call l1_cls
call l1_attr_cls
MMUSelectSpriteBank
call sprite_cls_cursors
MMUSelectLayer2
call asm_l2_double_buffer_on
.CurrentBuffer: ld a,$FF ; Clear upper 2 thirds to white
ld (l2_cls_byte),a
call l2_set_color_upper2
ld a,COLOUR_TRANSPARENT ; Lower third transparent
ld (l2_cls_byte),a
call l2_cls_lower_third
call LaunchTubeEdges
call LaunchConsole
.NextBuffer: MMUSelectLayer2
call l2_flip_buffers
ld a,$FF ; Clear upper 2 thirds to white
ld (l2_cls_byte),a
call l2_set_color_upper2
ld a,COLOUR_TRANSPARENT ; Lower third transparent
ld (l2_cls_byte),a
call l2_cls_lower_third
call LaunchTubeEdges
call LaunchConsole
.SetUpTimers: ld a,init_countdown
ld (launch_countdown),a
ld hl,launchdraw_table
ld (launch_table_idx),hl
xor a
ld (current_offsetX),a
ld (current_offsetY),a
.SetupGalaxy: MaxThrottle
ZeroThrottle; DEBUG
; To launch we need to set docked flag to transition FE and at teh end of the transition set to FD to rebuild universe
ld a,$FE
ld (DockedFlag),a
ret
draw_docking_ship: MMUSelectLayer1
call l1_cls
call l1_attr_cls
MMUSelectSpriteBank
call sprite_cls_cursors
MMUSelectLayer2
call asm_l2_double_buffer_on
.CurrentBuffer: ld a,$FF ; Clear upper 2 thirds to white
ld (l2_cls_byte),a
call l2_set_color_upper2
ld a,COLOUR_TRANSPARENT ; Lower third transparent
ld (l2_cls_byte),a
call l2_cls_lower_third
call LaunchTubeEdges
call LaunchConsole
.NextBuffer: MMUSelectLayer2
call l2_flip_buffers
ld a,$FF ; Clear upper 2 thirds to white
ld (l2_cls_byte),a
call l2_set_color_upper2
ld a,COLOUR_TRANSPARENT ; Lower third transparent
ld (l2_cls_byte),a
call l2_cls_lower_third
call LaunchTubeEdges
call LaunchConsole
.SetUpTimers: ld a,init_countdown
ld (launch_countdown),a
ld hl,dockingdraw_table
ld (docking_table_idx),hl
xor a
ld (current_offsetX),a
ld (current_offsetY),a
.SetupGalaxy: xor a ; palcehodler as it would cause next macro to fail re initialise all universe banks
ZeroThrottle
ld a,$FF
ld (DockedFlag),a ; we don't kill off shipts as we kill them on launch
ret
loop_launch_ship: call LaunchTubeEdges
ld a,init_countdown
ld (launch_countdown),a
ld hl,(launch_table_idx)
ld c,(hl)
ld a,c
cp $FF
jr z,.FinishedLaunch
inc hl
ld b,(hl) ; bc = top left
inc hl
ld e,(hl)
inc hl
ld d,(hl) ;de = width and height
inc hl
ld a,(hl) ; a = colour
inc hl
ld (launch_table_idx),hl
ld h,a
push bc,,de
MMUSelectLayer2
call l2_draw_fill_box ; ; "l2_draw_fill_box bc=rowcol, de=heightwidth h=color"
pop bc,,de
ld a,$80
call l2_draw_box ; "l2_draw_box bc=rowcol, de=heightwidth a=color"
ret
.FinishedLaunch: ld a,$FD ; now seed that we need a universe rebuild post launch
ld (DockedFlag),a
ret
loop_docking_ship: call LaunchTubeEdges
ld a,init_countdown
ld (launch_countdown),a
ld hl,(docking_table_idx)
ld c,(hl)
ld a,c
cp $FF
jr z,.FinishedDocking
inc hl
ld b,(hl) ; bc = top left
inc hl
ld e,(hl)
inc hl
ld d,(hl) ;de = width and height
inc hl
ld a,(hl)
inc hl
ld (docking_table_idx),hl
ld h,a
push bc,,de
MMUSelectLayer2
call l2_draw_fill_box
pop bc,,de
ld a,$80
call l2_draw_box
ret
.FinishedDocking ForceTransition ScreenStatus ; Force move to status screen
ret
|
libsrc/math/genmath/dne.asm | andydansby/z88dk-mk2 | 1 | 534 | <gh_stars>1-10
;
; Z88dk Generic Floating Point Math Library
;
; TOS >= FA
;
; $Id: dne.asm,v 1.1 2008/07/27 21:44:57 aralbrec Exp $:
XLIB dne
LIB dcompar
LIB f_yes
LIB f_no
.dne call dcompar
jp nz,f_yes
jp f_no
|
oeis/137/A137370.asm | neoneye/loda-programs | 11 | 4622 | <filename>oeis/137/A137370.asm<gh_stars>10-100
; A137370: Brahmagupta matrix in a Markov matrix recursion produces a set of polynomials: the special values of x->Sqrt[z];y->1;t->n gives a set of polynomials as determinants. The triangular sequence of the Coefficients of these polynomials are except for signs A055134.
; Submitted by <NAME>
; 1,0,1,1,-2,1,-8,12,-6,1,81,-108,54,-12,1,-1024,1280,-640,160,-20,1,15625,-18750,9375,-2500,375,-30,1,-279936,326592,-163296,45360,-7560,756,-42,1,5764801,-6588344,3294172,-941192,168070,-19208,1372,-56,1,-134217728,150994944,-75497472,22020096,-4128768
lpb $0
add $1,1
sub $0,$1
mov $2,$1
sub $2,$0
lpe
bin $1,$0
sub $0,1
add $0,$2
dif $0,-1
pow $0,$2
mul $1,$0
mov $0,$1
|
libsrc/stdio/_fscanf.asm | jpoikela/z88dk | 640 | 168002 | <filename>libsrc/stdio/_fscanf.asm<gh_stars>100-1000
MODULE fscanf
SECTION code_clib
PUBLIC _fscanf
EXTERN asm_scanf
; sdcc version
;void fscanf(FILE *fp, char *fmt,...)
;{
; asm_scanf(fp, sccz80_delta, *ct,ct-1);
;}
_fscanf:
ld hl,2
add hl,sp ;points to buf
push ix ;save callers
ld c,(hl) ;fp
inc hl
ld b,(hl)
inc hl ;&fmt
ld bc,0 ;sdcc
ld c,(hl) ;fmt
inc hl
ld b,(hl)
inc hl
push bc
push hl ;&ap
call asm_scanf
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
pop ix
ret
|
src/asf-lifecycles-validation.adb | jquorning/ada-asf | 12 | 9260 | <reponame>jquorning/ada-asf<gh_stars>10-100
-----------------------------------------------------------------------
-- asf-lifecycles-validation -- Validation phase
-- Copyright (C) 2010, 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Exceptions;
with ASF.Components.Root;
with ASF.Components.Base;
with Util.Log.Loggers;
-- The <b>ASF.Lifecycles.Validation</b> package defines the behavior
-- of the validation phase.
package body ASF.Lifecycles.Validation is
use Ada.Exceptions;
use Util.Log;
-- The logger
Log : constant Loggers.Logger := Loggers.Create ("ASF.Lifecycles.Validation");
-- ------------------------------
-- Execute the validation phase.
-- ------------------------------
overriding
procedure Execute (Controller : in Validation_Controller;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
pragma Unreferenced (Controller);
View : constant Components.Root.UIViewRoot := Context.Get_View_Root;
Root : constant access Components.Base.UIComponent'Class := Components.Root.Get_Root (View);
begin
Root.Process_Validators (Context);
exception
when E : others =>
Log.Error ("Error when running the validation phase {0}: {1}: {2}", "?",
Exception_Name (E), Exception_Message (E));
raise;
end Execute;
end ASF.Lifecycles.Validation;
|
Transynther/x86/_processed/US/_zr_/i3-7100_9_0x84_notsx.log_292_422.asm | ljhsiun2/medusa | 9 | 166929 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r14
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0xbb8f, %rbp
nop
nop
xor $44563, %rbx
movl $0x61626364, (%rbp)
nop
nop
nop
and %r14, %r14
lea addresses_A_ht+0x918f, %rsi
lea addresses_normal_ht+0x1b58f, %rdi
xor $23615, %r13
mov $67, %rcx
rep movsw
nop
nop
nop
nop
nop
sub $38547, %r14
lea addresses_WC_ht+0xac37, %rsi
lea addresses_UC_ht+0x339f, %rdi
cmp $18568, %r12
mov $96, %rcx
rep movsw
nop
and %rcx, %rcx
lea addresses_WT_ht+0x278f, %rsi
lea addresses_D_ht+0x478f, %rdi
cmp %r12, %r12
mov $116, %rcx
rep movsq
dec %rbp
lea addresses_WC_ht+0xec9f, %rsi
xor $30471, %r14
mov (%rsi), %r13
nop
nop
lfence
lea addresses_WC_ht+0xdb2f, %r14
clflush (%r14)
nop
nop
cmp $33350, %rsi
vmovups (%r14), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %rbp
nop
nop
cmp %r12, %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r14
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r15
push %r8
push %rbp
push %rcx
push %rdi
// Store
mov $0x65c7b7000000088f, %r15
cmp %r14, %r14
mov $0x5152535455565758, %rcx
movq %rcx, %xmm5
movups %xmm5, (%r15)
sub $57319, %r8
// Store
lea addresses_normal+0x1500f, %rdi
nop
nop
nop
cmp %rcx, %rcx
movl $0x51525354, (%rdi)
nop
cmp $741, %rbp
// Faulty Load
lea addresses_US+0xfb8f, %r15
nop
nop
nop
nop
nop
and $42563, %r12
mov (%r15), %r14w
lea oracles, %r12
and $0xff, %r14
shlq $12, %r14
mov (%r12,%r14,1), %r14
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_US', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 16, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_US', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'00': 292}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Cubical/Homotopy/Loopspace.agda | cmester0/cubical | 1 | 2055 | <gh_stars>1-10
{-# OPTIONS --cubical --safe #-}
module Cubical.Homotopy.Loopspace where
open import Cubical.Core.Everything
open import Cubical.Data.Nat
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Pointed
open import Cubical.Foundations.GroupoidLaws
{- loop space of a pointed type -}
Ω : {ℓ : Level} → Pointed ℓ → Pointed ℓ
Ω (_ , a) = ((a ≡ a) , refl)
{- n-fold loop space of a pointed type -}
Ω^_ : ∀ {ℓ} → ℕ → Pointed ℓ → Pointed ℓ
(Ω^ 0) p = p
(Ω^ (suc n)) p = Ω ((Ω^ n) p)
{- loop space map -}
Ω→ : ∀ {ℓA ℓB} {A : Pointed ℓA} {B : Pointed ℓB} (f : A →∙ B) → (Ω A →∙ Ω B)
Ω→ (f , f∙) = (λ p → (sym f∙ ∙ cong f p) ∙ f∙) , cong (λ q → q ∙ f∙) (sym (rUnit (sym f∙))) ∙ lCancel f∙
|
assembly_code/timer.asm | harismuneer/Stop-Watch-Timer-_x86-Assembly | 124 | 84509 | [org 0x0100]
jmp start
;Orignal Time
hrs: dw 0
min: dw 0
s: dw 0
ms: dw 0
;Lap Time
lhrs: dw 0
lmin: dw 0
ls: dw 0
lms: dw 0
oldkb: dd 0 ;For the purpose of saving the old keyboard ISR
;Flags for Modes
sMode: db 0
lMode: db 0
;Flags for other functions
startTimer: db 0
snapshot: db 0
lapTime: db 0
location: db 6
;------------------------------------------------------------------------------------------------------------------
;Clear Screen Sub Routine
clrscr: pusha
push es
mov ax, 0xb800
mov es, ax
xor di, di
mov ax, 0x720
mov cx, 2000
cld
rep stosw
pop es
popa
ret
;-------------------------------------------------------------------------------------------------------------------
;Print the Main Layout
printLayout: pusha
push es
mov ax, 0xB800
mov es, ax
mov di, 160
mov byte[es:di+0], 'H'
mov byte[es:di+2], 'R'
mov byte[es:di+4], 'S'
mov byte[es:di+8], ':'
mov byte[es:di+12], 'M'
mov byte[es:di+14], 'I'
mov byte[es:di+16], 'N'
mov byte[es:di+20], ':'
mov byte[es:di+24], 'S'
mov byte[es:di+28], ':'
mov byte[es:di+34], 'M'
mov byte[es:di+36], 'S'
pop es
popa
ret
;-------------------------------------------------------------------------------------------------------------------
;-------------------------------------------------------------------------------------------------------------------
;Keyboard ISR
kbisr: push ax
in al, 0x60
;Checking release code only
cmp al, 147 ;checking for 'R'
jz reset
jnz modChanger
reset: ;Resetting the orginal time
mov word [cs:hrs], 0
mov word [cs:min], 0
mov word [cs:s], 0
mov word [cs:ms], 0
;Resetting the lap time
mov word [cs:lhrs], 0
mov word [cs:lmin], 0
mov word [cs:ls], 0
mov word [cs:lms], 0
call clrscr
mov byte [cs:location], 6
jmp EOI1
modChanger: cmp al, 170 ;Release code of Shift Left
jnz checkLMode1
mov byte [cs:lMode], 0 ;Disable the lap mode
cmp byte [cs:sMode], 1 ;If sMode was already enabled then do nothing
jz EOI1
mov byte [cs:sMode], 1 ;Else enable the sMode
jmp EOI1
checkLMode1: cmp al, 182 ;Release code of Shift Right
jnz startTime
mov byte [cs:sMode], 0 ;Disable the split Mode
cmp byte [cs:lMode], 1 ;If lMode was aleady enabled then do nothing
jz EOI1
mov byte [cs:lMode], 1 ;Else enable the lMode
jmp EOI1
;Scenarios when space key is released
startTime: cmp al, 185
jnz oldKbHandler
cmp byte [cs:startTimer], 1 ;If Timer is already started then do nothing
jz check0
mov byte [cs:startTimer], 1 ;Else start the timer
check0: cmp byte [cs:sMode], 1 ;If split mode is enabled
jnz check1
mov byte [cs:snapshot], 1
jmp EOI1
check1: cmp byte [cs:lMode], 1 ;Else if the lap mode is enabled
jnz EOI1
mov byte [cs:lapTime], 1
jmp EOI1
EOI1: mov al, 0x20 ;End of Interrupt Signal
out 0x20,al
pop ax
iret
;Rest of the Keyboard keys are handled by the old keyboard ISR
oldKbHandler: pop ax
jmp far [cs:oldkb]
;-------------------------------------------------------------------------------------------------------------------
;-------------------------------------------------------------------------------------------------------------------
;To print the number on screen
printstr: push bp
mov bp, sp
pusha
push es
mov ax, 0xb800
mov es, ax
mov di, [bp+4] ;Location
mov ax, [bp+6] ;Number
mov bx, 10
mov cx, 0
nextdigit: mov dx, 0
div bx
add dl, 0x30
push dx
inc cx
cmp ax, 0
jnz nextdigit
cmp cx, 1
jnz nextpos
mov byte [es:di], '0'
add di, 2
nextpos: pop dx
mov dh, 0x07
mov [es:di], dx
add di, 2
loop nextpos
pop es
popa
pop bp
ret 4
;-------------------------------------------------------------------------------------------------------------------
;Function which prints the time on screen
printTime: push bp
mov bp,sp
pusha
push es
mov ax, 0xB800
mov es, ax
mov di, [bp+4] ;Location where the time is to be printed
;Printing hours
push word [bp+6]
add di, 2
push di
call printstr
;Printing Colon
add di, 6
mov byte [es:di], ':'
;Printing minutes
push word [bp+8]
add di, 6
push di
call printstr
;Printing Colon
add di, 6
mov byte [es:di], ':'
;Printing seconds
push word [bp+10]
add di, 2
push di
call printstr
;Printing Colon
add di, 6
mov byte [es:di], ':'
;Printing milli seconds
push word [bp+12]
add di, 2
push di
call printstr
pop es
popa
pop bp
ret 10
;-------------------------------------------------------------------------------------------------------------------
;Shift Left for Split Mode
;Shift Right for Lap Mode
stopWatch: pusha
push es
call printLayout
push word [cs:ms]
push word [cs:s]
push word [cs:min]
push word [cs:hrs]
push 480
call printTime
cmp byte [cs:startTimer], 1
jnz dEOI ;Using two jumps because of the short range of near jump
changeTime: add word [cs:ms], 55
cmp word[cs:ms], 1000
jle modCheck
mov word [cs:ms], 0
inc word[cs:s]
cmp word [cs:s], 60
jnz modCheck
mov word [cs:s], 0
inc word[cs:min]
cmp word [cs:min], 60
jnz modCheck
mov word [cs:min], 0
inc word[cs:hrs]
jmp modCheck
modCheck: cmp byte [cs:sMode], 1
jz splitMode
cmp byte [cs:lMode], 1
jz lapMode
jmp EOI
dEOI: jmp EOI ;Using dEOI as an intermediate jump because of the short range of near jump
splitMode: cmp byte [cs:snapshot], 1
jnz eEOI ;Going to use two jumps because of the short range of near jump
mov byte [cs:snapshot], 0
push word [cs:ms]
push word [cs:s]
push word [cs:min]
push word [cs:hrs]
;Position Calculation
mov al, 80
mul byte [cs:location]
shl ax, 1
add byte [cs:location], 2
push ax
call printTime
jmp EOI
eEOI: jmp EOI ;An intermediate jump to EOI
lapMode: cmp byte [cs:lapTime], 1
jnz xEOI ;Using two intermediate jumps because of the short range of near jumps
mov byte [cs:lapTime], 0
;Deducting the previos Lap Time from the original time to get the new Lap Time
;Making copy of the original Time
mov ax, [cs:ms]
mov bx, [cs:s]
mov cx, [cs:min]
mov dx, [cs:hrs]
;Subtracting the MilliSeconds
l1: sub ax, [cs:lms]
cmp ax, 0
jge l2
add ax, 1000
dec bx
l2: mov [cs:lms],ax
;Subtracting the Seconds
sub bx, [cs:ls]
cmp bx, 0
jge l3
add bx, 60
dec cx
l3: mov [cs:ls],bx
jmp l4 ;For skipping the xEOI given below
xEOI: jmp EOI ;An intermediate jump to EOI
;Subtracting the Minutes
l4: sub cx, [cs:lmin]
cmp cx, 0
jge l5
add cx, 60
dec dx
l5: mov [cs:lmin],cx
;Subtracting the Hours
sub dx, [cs:lhrs]
mov [cs:lhrs],dx
;After the subtraction is done, print the new lapTime
push word [cs:lms]
push word [cs:ls]
push word [cs:lmin]
push word [cs:lhrs]
;Position Calculation
mov al, 80
mul byte [cs:location]
shl ax, 1
add byte [cs:location], 2
push ax
call printTime
jmp EOI
EOI: mov al, 0x20
out 0x20, al
return: pop es
popa
iret
;-------------------------------------------------------------------------------------------------------------------
;Driver Function
start: mov ax, 0
mov es, ax
;Saving the previous keyboard handler routine
mov ax, [es:9*4]
mov [oldkb],ax
mov ax, [es:9*4+2]
mov [oldkb+2], ax
call clrscr
;Hooking the interrupts
cli
;Keyboard Interrupt
mov word [es:9*4], kbisr
mov [es:9*4+2], cs
;Timer Interrupt
mov word [es:8*4], stopWatch
mov [es:8*4+2], cs
sti
;Making it TSR
mov dx, start
add dx, 15
mov cl, 4
shr dx, cl
mov ax, 0x3100
int 21h
;------------------------------------------------------------------------------------------------------------------- |
tests_resultats/test_geometry.adb | zyron92/banana_tree_generator | 0 | 24528 | with Parseur_Temp, Geometry_Helpers, Ada.Text_Io, Ada.Integer_Text_Io;
use Parseur_Temp, Geometry_Helpers, Ada.Text_Io, Ada.Integer_Text_Io;
procedure Test_Geometry is
P1,P2,P3,P4,P5 : Coord_Point;
begin
P1 := (0.0,0.0);
P4 := (-1.0,-1.0);
P2 := (0.0,2.0);
P3:= (1.0,-1.0);
P5 := (1.0,-1.0);
Put_Line("1-2,1-3 : "&Float'Image(Angle_Intersection_Arrete(Vecteur(P1,P2),Vecteur(P1,P3),P1,P2,P3,true)));
--Put_Line("1-2,1-4 : "&Float'Image(Angle_Intersection_Arrete(Vecteur(P1,P2),Vecteur(P1,P4),P1,P2,P4)));
--Put_Line("1-2,1-5 : "&Float'Image(Angle_Intersection_Arrete(Vecteur(P1,P2),Vecteur(P1,P5),P1,P2,P5)));
--Res:=Projection(P4,P5,P5);
--Put_Line("Voila : "&Float'Image(Res.X)&" "&Float'Image(Res.Y));
end Test_Geometry;
|
src/in_game.asm | Gegel85/RemiFlap | 0 | 24047 | <gh_stars>0
game::
di
call waitVBLANK
reset lcdCtrl
ld hl, gameOverText
ld de, $9A40
ld bc, 20
call copyMemory
ld de, $9A60
ld bc, 20
call copyMemory
ld de, $9A80
ld bc, 20
call copyMemory
reg bossHpDrainCounterMax, 2
reg VRAMBankSelect, 1
inc a
ld [ROMBankSelect], a
startGPDMA background, VRAMStart + $1000, $800
startGPDMA background + $800, VRAMStart + $800, $800
ld a, 4
ld de, $9A40
ld bc, $60
call fillMemory
reset VRAMBankSelect
startGPDMA background + $1000, VRAMStart + $1000, mainMenuBg - background - $1000
reset ROMBankSelect
startGPDMA remiliaSprite, VRAMStart, $200
reset currentStage
ld a, [fireColumnHoleSize]
dec a
ld [bossHpDrainCounterMax], a
ld de, VRAMStart + "A" * $10
ld hl, font
ld a, 3
ld bc, 8 * 26
call uncompress
ld de, VRAMStart + "0" * $10
ld bc, 8 * 10
call uncompress
ld de, VRAMStart + "a" * $10
ld bc, 8 * 30
call uncompress
xor a
ld de, VRAMStart + "A" * $10 + $800
ld hl, font
ld bc, 8 * 26
call uncompress
ld de, VRAMStart + "0" * $10 + $800
ld bc, 8 * 10
call uncompress
ld de, VRAMStart + "a" * $10 + $800
ld bc, 8 * 30
call uncompress
ld hl, cgbBgPalIndex
ld a, $80
ld [hli], a
ld de, backgroundPal
ld b, $8
.bgPalLoop::
ld a, [de]
inc de
ld [hl], a
dec b
jr nz, .bgPalLoop
ld hl, cgbBgPalIndex
ld a, $A0
ld [hli], a
ld de, monochromePal
ld b, $8
.bgPalLoop2::
ld a, [de]
inc de
ld [hl], a
dec b
jr nz, .bgPalLoop2
ld hl, cgbObjPalIndex
ld a, $80
ld [hli], a
ld de, remiliaPal
ld b, $18
.objPalLoop::
ld a, [de]
inc de
ld [hl], a
dec b
jr nz, .objPalLoop
initGame::
di
call waitVBLANK
reset lcdCtrl
ld [playerSpeed], a
ld [bgScrollX], a
ld [nbOfProjectiles], a
reg playerPos, $55
ld c, 0
ld a, [currentStage]
inc a
ld d, a
ld b, 5
.makeScoreLoop::
ld a, b
add 5
daa
ld b, a
ld a, c
adc 0
daa
ld c, a
dec d
jr nz, .makeScoreLoop
ld a, b
ld [score], a
ld a, c
ld [score + 1], a
call copyBgTilemap
ld hl, fireColumnNextColumnAddr
ld a, VRAMBgMirror >> 8
ld [hli], a
xor a
ld [hli], a
ld a, 6 * 8
ld [hl], a
ld de, fireColumnsIndex
ld bc, 9
xor a
call fillMemory
ld de, oamSrc + 4 * 8
ld bc, 4 * 4
call fillMemory
ld b, $30
push bc
reset VBLANKRegister
reg VRAMBankSelect, 1
ld b, $10
ld de, $20
ld hl, VRAMWinStart
ld a, 5
.makeLifeBarGreen::
ld [hl], a
add hl, de
dec b
jr nz, .makeLifeBarGreen
reset VRAMBankSelect
ld b, $10
ld de, $20
ld hl, VRAMWinStart
ld a, $90
.makeLifeBar::
ld [hl], a
add hl, de
dec b
jr nz, .makeLifeBar
ld hl, cgbBgPalIndex
ld a, $A8
ld [hli], a
ld [hl], $E0
ld [hl], $03
include "src/stageStartAnimation.asm"
reg VBLANKRegister, 1
; jp bossFight
gameLoop::
reset interruptFlag
ld hl, VBLANKRegister
.loop::
halt
bit 7, [hl]
jr z, .loop
res 7, [hl]
.updateScroll::
ld hl, bgScrollX
inc [hl]
.updatePlayer::
ld hl, playerSpeed
ld a, [hl]
pop bc
dec b
push bc
jr nz, .noInc
pop bc
ld b, GRAVITY_COUNTER
push bc
inc [hl]
.noInc::
dec l
add [hl]
ld [hl], a
.playerControl::
call getKeysFiltered
bit A_BIT, a
jr z, .jump
bit UP_BIT, a
jr nz, .noJump
.jump::
call random
ld a, [playerSpeed]
ld b, a
srl a
sub SPEED_FORCE
bit 7, b
jr z, .ok
set 7, a
.ok::
ld [playerSpeed], a
pop bc
ld b, GRAVITY_COUNTER
push bc
.noJump::
call showPlayer
ld hl, fireGenerationCounter
ld a, [hl]
dec a
ld [hl], a
jr nz, .noFireGeneration
ld a, TIME_SPAWN_TIMING * 8
ld [hld], a
ld a, [hl]
ld d, a
and $E0
ld e, a
ld a, d
add a, TIME_SPAWN_TIMING
and $1F
ld [hld], a
ld h, [hl]
ld l, d
ld a, [fireColumnHoleSize]
ld c, a
.randGen::
call random
and $F
sub c
cp 18
jr nc, .randGen
ld c, a
ld de, fireColumns
ld a, [fireColumnsIndex]
inc a
and 3
ld [fireColumnsIndex], a
sla a
add e
ld e, a
ld a, d
adc 0
ld d, a
ld a, $C0
ld [de], a
inc de
ld a, c
sla a
sla a
sla a
ld [de], a
call drawFireColumn
.noFireGeneration::
ld a, [playerPos]
cp 144
jp nc, gameOver
ld c, a
ld b, 4
ld hl, fireColumns
.fireColumnUpdateLoop::
dec [hl]
jr nz, .noScoreUpdate
push hl
ld hl, score
ld a, [hl]
sub 1
daa
ld d, a
ld [hli], a
ld a, [hl]
sbc 0
daa
ld [hl], a
pop hl
or d
jp z, bossFight
.noScoreUpdate::
ld a, $F
cp [hl]
inc hl
jr c, .noCollision
ld a, [hl]
cp c
jp nc, gameOver
push bc
ld b, a
ld a, [fireColumnHoleSize]
sla a
sla a
sla a
add b
pop bc
cp c
jp c, gameOver
.noCollision::
inc hl
dec b
jr nz, .fireColumnUpdateLoop
call drawScore
jp gameLoop
endBossAnimation::
xor a
ld [bossAnimationRegisters], a
ld hl, bossAttackAnimCounter
nextBossAnimation::
inc [hl]
ret
include "src/boss_fights/rumia.asm"
include "src/boss_fights/flandre.asm"
bossFightCallbacks::
dw bossFightRumia
dw bossFightFlandre
bossFight::
ld de, bossAttackCounter
xor a
ld bc, endBossRegisters - bossAttackCounter
call fillMemory
ld [VBLANKRegister], a
ld [bossAnimationRegisters], a
ld [bossAnimationRegisters + 1], a
reg bossPos, 70
reg bossPos + 1, 160
reg bossAttack, -1
reg bossAttackCounter, 1
reg bossHp, $FF
call displayBoss
ld hl, bossHpDrainCounterMax
ld a, [hl]
inc a
ld [hld], a
ld [hl], a
call copyBgTilemap
ld hl, bossFightCallbacks
ld a, [currentStage]
and 1
sla a
ld e, a
ld d, 0
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
push hl
ld hl, lcdCtrl
set 5, [hl]
reg winPosXMinus7, 163
reg winPosY, 16
reset interruptFlag
ld hl, VBLANKRegister
.loop::
halt
bit 7, [hl]
jr z, .loop
res 7, [hl]
ld a, 1
ld [VRAMBankSelect], a
startGPDMA VRAMBg1Mirror, VRAMBgStart, $240
xor a
ld [VRAMBankSelect], a
startGPDMA VRAMBgMirror, VRAMBgStart, $240
bossFightLoop::
reset interruptFlag
ld hl, VBLANKRegister
.loop::
halt
bit 7, [hl]
jr z, .loop
res 7, [hl]
ld hl, bgScrollX
inc [hl]
ld a, [bossHp]
ld b, a
ld a, 144
srl b
sub b
ld [winPosY], a
ld a, b
and %01111000
jr nz, .notRed
ld a, $A8
ld hl, cgbBgPalIndex
ld [hli], a
ld [hl], $1F
ld [hl], $00
jr .next
.notRed::
bit 6, b
jr nz, .next
ld a, $A8
ld hl, cgbBgPalIndex
ld [hli], a
ld [hl], $FF
ld [hl], $03
.next::
ld hl, playerSpeed
ld a, [hl]
pop de
pop bc
dec b
push bc
push de
jr nz, .noInc
pop de
pop bc
ld b, GRAVITY_COUNTER
push bc
push de
inc [hl]
.noInc::
dec l
add [hl]
ld [hl], a
ld a, [playerPos]
cp 144
jp nc, gameOver
.playerControl::
call getKeysFiltered
bit A_BIT, a
jr z, .jump
bit UP_BIT, a
jr nz, .noJump
.jump::
call random
ld a, [playerSpeed]
ld b, a
srl a
sub SPEED_FORCE
bit 7, b
jr z, .ok
set 7, a
.ok::
ld [playerSpeed], a
pop de
pop bc
ld b, GRAVITY_COUNTER
push bc
push de
.noJump::
call showPlayer
ld hl, bossHpDrainCounter
dec [hl]
jr nz, .noDec
inc hl
ld a, [hld]
ld [hld], a
dec [hl]
jr z, .finish
.noDec::
pop hl
push hl
ld de, bossFightLoop
push de
jp hl
.finish::
pop hl
ld hl, currentStage
ld a, [hl]
add 1
daa
ld [hl], a
jp initGame
|
src/Implicits/Substitutions/LNMetaType.agda | metaborg/ts.agda | 4 | 5460 | <gh_stars>1-10
open import Prelude hiding (lift; Fin′; subst; id)
module Implicits.Substitutions.LNMetaType where
open import Implicits.Syntax.LNMetaType
open import Data.Fin.Substitution
open import Data.Star as Star hiding (map)
open import Data.Star.Properties
module MetaTypeApp {T} (l : Lift T MetaType) where
open Lift l hiding (var)
infixl 8 _/_
mutual
_simple/_ : ∀ {m n} → MetaSType m → Sub T m n → MetaType n
tc c simple/ σ = simpl (tc c)
tvar x simple/ σ = simpl (tvar x)
mvar x simple/ σ = lift $ lookup x σ
(a →' b) simple/ σ = simpl ((a / σ) →' (b / σ))
_/_ : ∀ {m n} → MetaType m → Sub T m n → MetaType n
(simpl c) / σ = (c simple/ σ)
(a ⇒ b) / σ = (a / σ) ⇒ (b / σ)
(∀' a) / σ = ∀' (a / σ)
open Application (record { _/_ = _/_ }) using (_/✶_)
→'-/✶-↑✶ : ∀ k {m n a b} (ρs : Subs T m n) →
(simpl (a →' b)) /✶ ρs ↑✶ k ≡ simpl ((a /✶ ρs ↑✶ k) →' (b /✶ ρs ↑✶ k))
→'-/✶-↑✶ k ε = refl
→'-/✶-↑✶ k (r ◅ ρs) = cong₂ _/_ (→'-/✶-↑✶ k ρs) refl
⇒-/✶-↑✶ : ∀ k {m n a b} (ρs : Subs T m n) →
(a ⇒ b) /✶ ρs ↑✶ k ≡ (a /✶ ρs ↑✶ k) ⇒ (b /✶ ρs ↑✶ k)
⇒-/✶-↑✶ k ε = refl
⇒-/✶-↑✶ k (r ◅ ρs) = cong₂ _/_ (⇒-/✶-↑✶ k ρs) refl
tc-/✶-↑✶ : ∀ k {c m n} (ρs : Subs T m n) →
(simpl (tc c)) /✶ ρs ↑✶ k ≡ simpl (tc c)
tc-/✶-↑✶ k ε = refl
tc-/✶-↑✶ k (r ◅ ρs) = cong₂ _/_ (tc-/✶-↑✶ k ρs) refl
tvar-/✶-↑✶ : ∀ k {c m n} (ρs : Subs T m n) →
(simpl (tvar c)) /✶ ρs ↑✶ k ≡ simpl (tvar c)
tvar-/✶-↑✶ k ε = refl
tvar-/✶-↑✶ k (r ◅ ρs) = cong₂ _/_ (tvar-/✶-↑✶ k ρs) refl
∀'-/✶-↑✶ : ∀ k {m n a} (ρs : Subs T m n) →
(∀' a) /✶ ρs ↑✶ k ≡ ∀' (a /✶ ρs ↑✶ k)
∀'-/✶-↑✶ k ε = refl
∀'-/✶-↑✶ k (x ◅ ρs) = cong₂ _/_ (∀'-/✶-↑✶ k ρs) refl
typeSubst : TermSubst MetaType
typeSubst = record { var = (λ n → simpl (mvar n)); app = MetaTypeApp._/_ }
open TermSubst typeSubst public hiding (var)
open MetaTypeApp termLift public using (_simple/_)
open MetaTypeApp varLift public using () renaming (_simple/_ to _simple/Var_)
infix 8 _[/_]
-- Shorthand for single-variable type substitutions
_[/_] : ∀ {n} → MetaType (suc n) → MetaType n → MetaType n
a [/ b ] = a / sub b
_◁m₁ : ∀ {m} (r : MetaType m) → ℕ
_◁m₁ (a ⇒ b) = b ◁m₁
_◁m₁ (∀' r) = 1 N+ r ◁m₁
_◁m₁ (simpl x) = zero
-- heads of metatypes
_◁m : ∀ {m} (r : MetaType m) → (MetaType ((r ◁m₁) N+ m))
(a ⇒ b) ◁m = b ◁m
∀' r ◁m = open-meta zero (r ◁m)
simpl x ◁m = simpl x
|
Examples/ch11/WriteColors.asm | satadriver/LiunuxOS_t | 0 | 81050 | TITLE Writing Text Colors (WriteColors.asm)
; Demonstration of WriteConsoleOutputCharacter,
; and WriteConsoleOutputAttribute functions.
; Last update: 9/28/01
INCLUDE Irvine32.inc
.data
outHandle DWORD ?
cellsWritten DWORD ?
xyPos COORD <10,2>
; Array of character codes:
buffer BYTE 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
BYTE 16,17,18,19.20
BufSize = ($ - buffer)
; Array of attributes:
attributes WORD 0Fh,0Eh,0Dh,0Ch,0Bh,0Ah,9,8,7,6
WORD 5,4,3,2,1,0F0h,0E0h,0D0h,0C0h,0B0h
.code
main PROC
; Get the Console standard output handle:
INVOKE GetStdHandle,STD_OUTPUT_HANDLE
mov outHandle,eax
; Set the colors from (10,2) to (30,2):
INVOKE WriteConsoleOutputAttribute,
outHandle, ADDR attributes,
BufSize, xyPos,
ADDR cellsWritten
; Write character codes 1 to 20:
INVOKE WriteConsoleOutputCharacter,
outHandle, ADDR buffer, BufSize,
xyPos, ADDR cellsWritten
call ReadChar
exit
main ENDP
END main |
puzzle_25/src/puzzle_25.adb | AdaForge/Advent_of_Code_2020 | 0 | 29819 | <filename>puzzle_25/src/puzzle_25.adb
procedure Puzzle_25 is
begin
null;
end Puzzle_25;
|
day01/tests/day1-test.adb | jwarwick/aoc_2019_ada | 0 | 24213 | with AUnit.Assertions; use AUnit.Assertions;
package body Day1.Test is
procedure Test_Part1 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
begin
Assert (fuel_required(12) = 2, "Wrong fuel 12 => 2");
Assert (fuel_required(14) = 2, "Wrong fuel 14 => 2");
Assert (fuel_required(1969) = 654, "Wrong fuel 1969 => 654");
Assert (fuel_required(100756) = 33583, "Wrong fuel 100756 => 33583");
end Test_Part1;
procedure Test_Part2 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
begin
Assert (recursive_fuel_required(14) = 14 + 2, "Wrong total fuel 14 => 2");
Assert (recursive_fuel_required(1969) = 1969 + 966, "Wrong total fuel 1969 => 966");
Assert (recursive_fuel_required(100756) = 100756 + 50346, "Wrong total fuel 100756 => 50346");
end Test_Part2;
function Name (T : Test) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("Test Day1 package");
end Name;
procedure Register_Tests (T : in out Test) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Test_Part1'Access, "Test Part 1");
Register_Routine (T, Test_Part2'Access, "Test Part 2");
end Register_Tests;
end Day1.Test;
|
examples/ez-dap/desc.asm | elfmimi/libfx2 | 0 | 171004 | <reponame>elfmimi/libfx2
.globl _bos_desc, _msos20_desc
.area DESC (CODE)
VENDOR_MS_OS_20_REQUEST = 0xCC
.even
_bos_desc:
.db 0x05
.db 0x0F
_BOS_DESC_SIZE::
.db <(bos_desc_end - _bos_desc)
.db >(bos_desc_end - _bos_desc)
.db 0x01
.db 0x1C
.db 0x10
.db 0x05
.db 0x00
.db 0xDF
.db 0x60
.db 0xDD
.db 0xD8
.db 0x89
.db 0x45
.db 0xC7
.db 0x4C
.db 0x9C
.db 0xD2
.db 0x65
.db 0x9D
.db 0x9E
.db 0x64
.db 0x8A
.db 0x9F
.db 0x00
.db 0x00
.db 0x03
.db 0x06
.db <(msos20_desc_end - _msos20_desc)
.db >(msos20_desc_end - _msos20_desc)
_VENDOR_MS_OS_20_REQUEST::
.db VENDOR_MS_OS_20_REQUEST
.db 0x00
bos_desc_end:
; -----------------------------------------------------------------------------
; MS OS 2.0 ( Microsoft OS 2.0 Descriptors )
; -----------------------------------------------------------------------------
.even
_msos20_desc:
.db 0x0A, 0x00, 0x00, 0x00
.db 0x00, 0x00, 0x03, 0x06
_MSOS20_DESC_SIZE::
.db <(msos20_desc_end - _msos20_desc)
.db >(msos20_desc_end - _msos20_desc)
.db 0x14, 0x00, 0x03, 0x00
.db 'W, 'I, 'N, 'U, 'S, 'B, 0, 0
.db 0, 0, 0, 0, 0, 0, 0, 0
msos20_desc_end:
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_1178.asm | ljhsiun2/medusa | 9 | 90672 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x1d8c5, %rsi
lea addresses_WT_ht+0x24b9, %rdi
nop
and %r9, %r9
mov $107, %rcx
rep movsq
nop
nop
nop
nop
nop
xor %rax, %rax
lea addresses_D_ht+0xb8c5, %rbp
nop
nop
nop
nop
dec %rax
movl $0x61626364, (%rbp)
nop
nop
nop
sub %rsi, %rsi
lea addresses_WC_ht+0x7285, %rsi
nop
xor $32027, %rax
movups (%rsi), %xmm1
vpextrq $0, %xmm1, %rdi
nop
nop
nop
nop
add $10848, %r9
lea addresses_WC_ht+0xb2c5, %rbp
cmp %rcx, %rcx
movb $0x61, (%rbp)
nop
nop
nop
nop
and %rax, %rax
lea addresses_WC_ht+0xb415, %rsi
nop
sub $20211, %rdx
mov (%rsi), %rbp
nop
nop
nop
nop
xor $7066, %rsi
lea addresses_WC_ht+0x1cec5, %rsi
lea addresses_A_ht+0x1a1c5, %rdi
nop
nop
xor $50921, %rbp
mov $33, %rcx
rep movsl
nop
nop
and $44752, %rdi
lea addresses_D_ht+0x182c5, %rsi
lea addresses_UC_ht+0x9fc5, %rdi
clflush (%rdi)
cmp $48117, %r12
mov $31, %rcx
rep movsb
nop
nop
nop
xor %rbp, %rbp
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %rbp
push %rbx
push %rcx
push %rdi
// Load
lea addresses_US+0xfe9d, %rdi
xor $47482, %rcx
mov (%rdi), %r11
nop
nop
nop
nop
and %rbx, %rbx
// Faulty Load
lea addresses_WT+0x8ac5, %r10
nop
nop
nop
nop
cmp $51749, %rbp
vmovups (%r10), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $0, %xmm3, %rbx
lea oracles, %rcx
and $0xff, %rbx
shlq $12, %rbx
mov (%rcx,%rbx,1), %rbx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
tier-1/xcb/source/thin/xcb-xcb_alloc_named_color_reply_t.ads | charlie5/cBound | 2 | 14066 | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_alloc_named_color_reply_t is
-- Item
--
type Item is record
response_type : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
sequence : aliased Interfaces.Unsigned_16;
length : aliased Interfaces.Unsigned_32;
pixel : aliased Interfaces.Unsigned_32;
exact_red : aliased Interfaces.Unsigned_16;
exact_green : aliased Interfaces.Unsigned_16;
exact_blue : aliased Interfaces.Unsigned_16;
visual_red : aliased Interfaces.Unsigned_16;
visual_green : aliased Interfaces.Unsigned_16;
visual_blue : aliased Interfaces.Unsigned_16;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_alloc_named_color_reply_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_alloc_named_color_reply_t.Item,
Element_Array => xcb.xcb_alloc_named_color_reply_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_alloc_named_color_reply_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_alloc_named_color_reply_t.Pointer,
Element_Array => xcb.xcb_alloc_named_color_reply_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_alloc_named_color_reply_t;
|
_build/dispatcher/jmp_ippsECCPSetStd128r2_07ee26b6.asm | zyktrcn/ippcp | 1 | 99 | <gh_stars>1-10
extern m7_ippsECCPSetStd128r2:function
extern n8_ippsECCPSetStd128r2:function
extern y8_ippsECCPSetStd128r2:function
extern e9_ippsECCPSetStd128r2:function
extern l9_ippsECCPSetStd128r2:function
extern n0_ippsECCPSetStd128r2:function
extern k0_ippsECCPSetStd128r2:function
extern ippcpJumpIndexForMergedLibs
extern ippcpSafeInit:function
segment .data
align 8
dq .Lin_ippsECCPSetStd128r2
.Larraddr_ippsECCPSetStd128r2:
dq m7_ippsECCPSetStd128r2
dq n8_ippsECCPSetStd128r2
dq y8_ippsECCPSetStd128r2
dq e9_ippsECCPSetStd128r2
dq l9_ippsECCPSetStd128r2
dq n0_ippsECCPSetStd128r2
dq k0_ippsECCPSetStd128r2
segment .text
global ippsECCPSetStd128r2:function (ippsECCPSetStd128r2.LEndippsECCPSetStd128r2 - ippsECCPSetStd128r2)
.Lin_ippsECCPSetStd128r2:
db 0xf3, 0x0f, 0x1e, 0xfa
call ippcpSafeInit wrt ..plt
align 16
ippsECCPSetStd128r2:
db 0xf3, 0x0f, 0x1e, 0xfa
mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc]
movsxd rax, dword [rax]
lea r11, [rel .Larraddr_ippsECCPSetStd128r2]
mov r11, qword [r11+rax*8]
jmp r11
.LEndippsECCPSetStd128r2:
|
src/sys/http/util-http-rest.adb | RREE/ada-util | 60 | 14204 | <reponame>RREE/ada-util
-----------------------------------------------------------------------
-- util-http-rest -- REST API support
-- Copyright (C) 2012, 2013, 2015 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Serialize.IO.JSON;
with Util.Serialize.Mappers;
package body Util.Http.Rest is
-- -----------------------
-- Execute an HTTP GET operation using the <b>Http</b> client on the given <b>URI</b>.
-- Upon successful reception of the response, parse the JSON result and populate the
-- serialization context associated with the parser.
-- -----------------------
procedure Get (Http : in out Client;
URI : in String;
Parser : in out Util.Serialize.IO.Parser'Class;
Sink : in out Util.Serialize.IO.Reader'Class) is
Response : Util.Http.Clients.Response;
begin
Http.Get (URI, Response);
Http.Status := Response.Get_Status;
declare
Content : constant String := Response.Get_Body;
begin
Parser.Parse_String (Content, Sink);
end;
end Get;
-- -----------------------
-- Execute an HTTP GET operation on the given <b>URI</b> and parse the JSON response
-- into the target object refered to by <b>Into</b> by using the mapping described
-- in <b>Mapping</b>.
-- -----------------------
procedure Rest_Get (URI : in String;
Mapping : in Util.Serialize.Mappers.Mapper_Access;
Path : in String := "";
Into : in Element_Mapper.Element_Type_Access) is
Http : Util.Http.Rest.Client;
Reader : Util.Serialize.IO.JSON.Parser;
Mapper : Util.Serialize.Mappers.Processing;
begin
Mapper.Add_Mapping (Path, Mapping.all'Access);
Element_Mapper.Set_Context (Mapper, Into);
Http.Get (URI, Reader, Mapper);
end Rest_Get;
end Util.Http.Rest;
|
LaunchBar/Actions/Open In Chrome.scpt | Muffo/dotfiles-1 | 159 | 4003 | --
-- open currently open URL in Safari in Chrome
-- forked from https://gist.github.com/3151932
--
property theURL : ""
tell application "Safari"
set theURL to URL of current tab of window 1
end tell
if appIsRunning("Google Chrome") then
tell application "Google Chrome"
if (count of (every window where visible is true)) is greater than 0 then
-- running with a visible window, ready for new tab
else
-- running but no visible window, so create one
make new window
end if
end tell
else
tell application "Google Chrome"
-- chrome app not running, so start it
do shell script "open -a \"Google Chrome\""
end tell
end if
-- now that we have made sure chrome is running and has a visible
-- window create a new tab in that window
-- and activate it to bring to the front
tell application "Google Chrome"
tell front window
make new tab with properties {URL:theURL}
end tell
activate
end tell
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
|
programs/oeis/026/A026613.asm | jmorken/loda | 1 | 23381 | ; A026613: Number of 2's between n-th 3 and (n+1)st 3 in A026600.
; 1,0,2,0,2,0,2,1,1,0,2,0,2,1,1,1,0,1,2,1,1,1,0,2,0,2,1,0,2,0,2,1,1,1,0,1,2,1,1,1,0,2,0,2,1,1,0,2,0,2,0,2,1,0,2,1,1,1,0,2,0,2,1,1,0,2,0,2,0,2,1,1,0,2,0,2,1,1,1,0,2,0,2,0,2,1,1,1,0,1,2,1,1,1,0,2,0,2,1,1,0,2,0,2,0,2,1,0,2,1,1,1,0,2,0,2,1,1,0,2,0,2,0,2,1,1,0,2,0,2,1,1,1,0,2,1,0,2,0,2,0,2,1,1,0,2,0,2,1,1,1,0,1,2,1,1,1,0,2,0,2,0,2,1,1,1,0,2,0,2,1,1,0,2,0,2,0,2,1,1,0,2,0,2,1,1,1,0,2,1,0,2,0,2,0,2,1,1,0,2,0,2,1,1,1,0,1,2,1,1,1,0,2,0,2,1,0,2,0,2,1,1,1,0,1,2,1,1,1,0,2,0,2,1,1,0,2,0,2,0,2,1,1,0,2,0,2,1,1,1
cal $0,26611 ; Number of 3's between n-th 2 and (n+1)st 2 in A026600.
sub $0,2
sub $1,$0
|
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/ドイツ_PAL/Ger_asm/zel_char0.asm | prismotizm/gigaleak | 0 | 169175 | Name: zel_char0.asm
Type: file
Size: 110186
Last-Modified: '2016-05-13T04:23:03Z'
SHA-1: 445B148012A305544DDB6C03E097A352239356A0
Description: null
|
oeis/247/A247473.asm | neoneye/loda-programs | 11 | 4902 | ; A247473: Numbers of the form 2^k (k>=0) that are a sum of divisors of n for some n.
; Submitted by <NAME>
; 1,4,8,32,128,256,512,1024,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,4294967296,8589934592,17179869184,34359738368
mov $1,$0
trn $0,1
seq $0,180221 ; Numbers that can be written as sum of one or more distinct elements of A000043. Numbers k for which sigma(A180162(k))=2^k, k>=2.
cmp $1,0
cmp $1,0
mul $0,$1
mov $2,2
pow $2,$0
mov $0,$2
|
source/tabula-calendar-time_io.adb | ytomino/vampire | 1 | 13413 | -- The Village of Vampire by YT, このソースコードはNYSLです
with Ada.Calendar.Formatting;
package body Tabula.Calendar.Time_IO is
function Image (Date : Ada.Calendar.Time) return String is
begin
return Ada.Calendar.Formatting.Image (Date, Time_Zone => Time_Offset);
end Image;
function Value (Image : String) return Ada.Calendar.Time is
begin
return Ada.Calendar.Formatting.Value (Image, Time_Zone => Time_Offset);
end Value;
package Time_IO is
new Serialization.IO_Custom (
Ada.Calendar.Time,
Image,
Value,
Triming => False);
procedure IO (
Serializer : not null access Serialization.Serializer;
Name : in String;
Value : in out Ada.Calendar.Time)
renames Time_IO.IO;
package Duration_IO is
new Serialization.IO_Custom (
Duration,
Duration'Image,
Duration'Value,
Triming => True);
procedure IO (
Serializer : not null access Serialization.Serializer;
Name : in String;
Value : in out Duration)
renames Duration_IO.IO;
end Tabula.Calendar.Time_IO;
|
oeis/174/A174679.asm | neoneye/loda-programs | 11 | 105555 | ; A174679: a(4n) = n^2. a(4n+1) = (4n-1)^2. a(4n+2) = (2n)^2. a(4n+3) = (4n+1)^2.
; Submitted by <NAME>(s1)
; 0,1,0,1,1,9,4,25,4,49,16,81,9,121,36,169,16,225,64,289,25,361,100,441,36,529,144,625,49,729,196,841,64,961,256,1089,81,1225,324,1369,100,1521,400,1681,121,1849,484,2025,144,2209,576
mov $1,$0
sub $0,3
gcd $1,4
add $0,$1
div $0,$1
pow $0,2
|
Student/examples/Correct/Subprograms/Reverse.asm | SoftMoore/CPRL-Kt | 6 | 11078 | <reponame>SoftMoore/CPRL-Kt
BR L5
L0:
PROC 2
LDLADDR 8
GETCH
STORE2B
LDCB 0
LDCB 0
LDLADDR 8
LOAD2B
LDCB 0
LDCB 0
LDCCH 'E'
CMP
BZ L3
CALL L0
L3:
L4:
LDLADDR 8
LOAD2B
PUTCH
RET 0
L5:
CALL L0
HALT
|
programs/oeis/100/A100672.asm | jmorken/loda | 1 | 14097 | <reponame>jmorken/loda
; A100672: Second least-significant bit in the binary expansion of the n-th prime.
; 1,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,1,0,1,1,0,1,1,0,0,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,0,1,1,1,1,0,0,1,0,1,0,1,0,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,1,0,1,1,0,0,0,1,1,1,1,1,1,1,0,0,1,0,1,0,1,0,1
cal $0,40 ; The prime numbers.
div $0,2
mod $0,2
mov $1,$0
|
Hello-Agda.agda | adithyaselv/Learn-Agda | 0 | 6030 | <filename>Hello-Agda.agda
{-
My first Proof in Agda
-}
-- define Natural numbers
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
-- Simply defining 1
one : ℕ
one = suc(zero)
two : ℕ
two = suc(suc(zero))
-- define addition of natural numbers
_+_ : ℕ → ℕ → ℕ
zero + n = n
(suc m) + n = suc (m + n)
-- Define equality
data _≡_ {A : Set} (a : A) : A → Set where
refl : a ≡ a
-- small test for equality
-- oneplusoneistwo : one + one ≡ two
-- oneplusoneistwo = refl
-- Prove n+0 = n
|
src/05.protection_kernel.asm | myyrakle/os | 0 | 18264 | <gh_stars>0
org 0x8000
; 밑의 :gdtr 레이블을 GDT로 등록
xor ax, ax
lgdt [gdtr] ; gdt 로드 명령
cli ; 인터럽트 막음. 전환중에 인터럽트가 걸리면 죽을수도 있음.
; 32비트 보호모드 스위치
mov eax, cr0
or eax, 1
mov cr0, eax
; 파이프라이닝으로 남아있을 수 있는 16비트 크기의 명령어 정리
jmp $+2
nop
nop
; 실질적인 로직인 Entry32 부분으로 점프
jmp codeDescriptor:Entry32
; 32비트 엔트리
[bits 32]
Entry32:
; 세그먼트 레지스터 초기화
mov bx, dataDescriptor
mov ds, bx
mov es, bx
mov fs, bx
mov gs, bx
mov ss, bx
xor esp, esp
mov esp, 0x9FFFF
; es 레지스터에 비디오 디스크립터 저장
mov ax, videoDescriptor
mov es, ax
; 문자 출력
mov ah, 0x09; 색깔
mov al, 'P'
mov [es:0x0000], ax
mov al, 'R'
mov [es:0x0002], ax
mov al, 'O'
mov [es:0x0004], ax
mov al, 'T'
mov [es:0x0006], ax
mov al, 'E'
mov [es:0x0008], ax
mov al, 'C'
mov [es:0x000A], ax
mov al, 'T'
mov [es:0x000C], ax
jmp $
; GDT 정의
gdtr:
dw gdt_end - gdt - 1 ; GDT의 limit
dd gdt ; GDT의 베이스 어드레스
gdt:
; NULL 디스크립터
nullDescriptor equ 0x00
dw 0
dw 0
db 0
db 0
db 0
db 0
; 코드 디스크립터
codeDescriptor equ 0x08
dw 0xFFFF ; limit:0xFFFF
dw 0x0000 ; base 0~15 : 0
db 0x00 ; base 16~23: 0
db 0x9A ; P:1, DPL:0, Code, non-conforming, readable
db 0xCF ; G:1, D:1, limit:0xF
db 0x00 ; base 24~32: 0
; 데이터 디스크립터
dataDescriptor equ 0x10
dw 0xFFFF ; limit 0xFFFF
dw 0x0000 ; base 0~15 : 0
db 0x00 ; base 16~23: 0
db 0x92 ; P:1, DPL:0, data, readable, writable
db 0xCF ; G:1, D:1, limit:0xF
db 0x00 ; base 24~32: 0
; 비디오 디스크립터
videoDescriptor equ 0x18
dw 0xFFFF ; limit 0xFFFF
dw 0x8000 ; base 0~15 : 0x8000
db 0x0B ; base 16~23: 0x0B
db 0x92 ; P:1, DPL:0, data, readable, writable
db 0xCF ; G:1, D:1, limit:0xF
db 0x00 ; base 24~32: 0
gdt_end:
times 512-($-$$) db 0x00
|
problems/UniverseCollapse/UniverseCollapse.agda | danr/agder | 1 | 11886 | <filename>problems/UniverseCollapse/UniverseCollapse.agda
module UniverseCollapse
(down : Set₁ -> Set)
(up : Set → Set₁)
(iso : ∀ {A} → down (up A) → A)
(osi : ∀ {A} → up (down A) → A) where
anything : (A : Set) → A
anything = {!!}
|
build/DotnetValidationSingleTarget/Grammar.g4 | kaby76/antlr4cs | 321 | 5256 | grammar Grammar;
compilationUnit
: 'text' EOF
;
keys : 'keys';
values : 'values';
WS
: [ \t\r\n]+ -> skip
;
|
duel-chat.asm | LeifBloomquist/ArtilleryDuel | 1 | 17750 | ; duel-chat.asm
; Weather War III Packet Chat routines
; ==============================================================
; Display contents of a chat packet.
; Moved to main game thread. No longer in IRQ.
; ==============================================================
SHOWCHATMSG
;First, check for a zero-length chat message. Ignore if it is.
lda INPACKET+$2D ;First byte of message text
bne CHATOK
jmp SHOWCHATMSG_x
CHATOK
;Clear the bottom of the screen.
PLOT 0,24
PRINT " "
;Force a zero-termination, no matter what
lda #$00
sta INPACKET+$2D+$27 ;39 decimal
;Print the message
PLOT 0,24
PRINT CG_YEL
PRINTSTRING (INPACKET+$2D)
; Ping sound
jsr SOUND_CHAT
SHOWCHATMSG_x
; Clear the packet flags.
lda #$00
sta PACKET_RECEIVED
sta CHAT_RECEIVED
rts
; ==============================================================
; Chat Input - in main game thread.
; ==============================================================
CHATINPUT
PLOT 0,24
PRINT " "
PLOT 0,24
PRINT 158 ; Yellow
;Clear chat text buffer
lda #$00
ldx #$27
clearchat1
sta CHATTEXT,x
dex
bne clearchat1
lda #$00
sta $cc ; Force cursor to flash
sta JOYOK ; Turn off joystick input
jsr FILTERED_TEXT
; Could check carry for run-stop
sty CHATPACKET+2 ; Length returned in y
lda #$01
sta $cc ; Turn off cursor flashing
jsr SENDCHAT ;Send the message and wait for ack
; Ping sound
jsr SOUND_CHAT
PLOT 0,24
PRINT " "
rts
|
agda/Quicksort/Correctness/Order.agda | bgbianchi/sorting | 6 | 15380 | <filename>agda/Quicksort/Correctness/Order.agda
{-# OPTIONS --sized-types #-}
open import Relation.Binary.Core
module Quicksort.Correctness.Order {A : Set}
(_≤_ : A → A → Set)
(tot≤ : Total _≤_)
(trans≤ : Transitive _≤_) where
open import Data.List
open import Function using (_∘_)
open import List.Sorted _≤_
open import Quicksort _≤_ tot≤
open import SBList _≤_
open import Size
open import SOList.Total _≤_
open import SOList.Total.Properties _≤_ trans≤
theorem-quickSort-sorted : (xs : List A) → Sorted (forget (quickSort (bound xs)))
theorem-quickSort-sorted = lemma-solist-sorted ∘ quickSort ∘ bound
|
day01/tests/day1_suite.ads | jwarwick/aoc_2019_ada | 0 | 22540 | with AUnit.Test_Suites; use AUnit.Test_Suites;
package Day1_Suite is
function Suite return Access_Test_Suite;
end Day1_Suite;
|
source/asis/asis-gela-inheritance.adb | faelys/gela-asis | 4 | 26731 | <gh_stars>1-10
------------------------------------------------------------------------------
-- G E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $:
with XASIS.Types;
with XASIS.Utils;
with Asis.Elements;
with Asis.Statements;
with Asis.Definitions;
with Asis.Declarations;
with Asis.Gela.Classes;
with Asis.Gela.Element_Utils;
with Asis.Gela.Inheritance.Utils;
package body Asis.Gela.Inheritance is
function Operate_On_Type
(Oper : Asis.Declaration;
Tipe : Classes.Type_Info) return Boolean;
function Get_Declarative_Items
(Item : Asis.Element) return Asis.Declaration_List;
function Override (Decl : Asis.Declaration) return Boolean;
function Is_Ext_Equal_Operator
(Decl : Asis.Declaration;
Tipe : Classes.Type_Info) return Boolean;
procedure Make_Inherited_Subprogram
(Oper : Asis.Declaration;
Point : in out Visibility.Point;
Tipe : Classes.Type_Info;
Parent : Classes.Type_Info;
Visible : Boolean);
function Get_Parents (Decl : Asis.Declaration) return Asis.Name_List
renames XASIS.Utils.Get_Ancestors;
type Cloner is new Asis.Cloner with record
Tipe : Classes.Type_Info;
Parent : Classes.Type_Info;
Subprogram : Asis.Declaration;
Result_Subtype : Asis.Definition;
end record;
function Clone
(Object : Cloner;
Item : Element;
Parent : Element) return Element;
function Get_Inherited (Def : Asis.Definition)
return Asis.Declaration_List;
---------------------------------
-- Check_Inherited_Subprograms --
---------------------------------
procedure Check_Inherited_Subprograms
(Decl : in Asis.Declaration;
From : in Asis.Element;
Point : in out Visibility.Point)
is
View : constant Asis.Definition :=
Asis.Declarations.Type_Declaration_View (Decl);
List : constant Asis.Declaration_List := Get_Inherited (View);
Name : Asis.Defining_Name;
Parent : Asis.Declaration;
Parent_Name : Asis.Defining_Name;
Overriden : Boolean;
begin
for J in List'Range loop
Name := XASIS.Utils.Declaration_Name (List (J));
Parent := Declarations.Corresponding_Subprogram_Derivation (List (J));
Parent_Name := XASIS.Utils.Declaration_Name (Parent);
if not Visibility.Is_Declared (Name) and
Visibility.Visible_From (Parent_Name, From)
then
Visibility.New_Implicit_Declaration
(List (J), Point, Decl, Overriden);
end if;
end loop;
end Check_Inherited_Subprograms;
-----------
-- Clone --
-----------
function Clone
(Object : Cloner;
Item : Element;
Parent : Element) return Element
is
use Asis.Elements;
use Asis.Gela.Classes;
--------
-- Up --
--------
function Up
(Child : Asis.Element;
Declaration : Asis.Declaration_Kinds := Not_A_Declaration)
return Asis.Element is
begin
if Is_Nil (Child) then
return Asis.Nil_Element;
elsif (Declaration = Not_A_Declaration) or else
Declaration_Kind (Child) = Declaration
then
return Enclosing_Element (Child);
else
return Asis.Nil_Element;
end if;
end Up;
Upper : Asis.Element := Enclosing_Element (Item.all);
Result : Asis.Element;
Place : Asis.Element := Get_Place (Object.Tipe);
Tipe : Type_Info;
begin
if Is_Equal (Upper, Object.Result_Subtype) then
Tipe := Type_From_Subtype_Mark (Item, Place);
if Is_Equal (Tipe, Object.Parent) then
return Utils.Clone_Type (Parent, Object.Tipe);
end if;
else
case Definition_Kind (Upper) is
when A_Subtype_Indication | An_Access_Definition =>
declare
Up_2 : constant Asis.Element := Up (Upper);
Up_3 : constant Asis.Element :=
Up (Up_2, Declaration => A_Parameter_Specification);
begin
if Is_Equal (Up_3, Object.Subprogram) then
Tipe := Type_From_Subtype_Mark (Item, Place);
if Is_Equal (Tipe, Object.Parent) then
return Utils.Clone_Type (Parent, Object.Tipe);
end if;
end if;
end;
when others =>
null;
end case;
end if;
case Element_Kind (Item) is
when A_Declaration =>
case Declaration_Kind (Item) is
when A_Function_Declaration
| A_Function_Body_Declaration
| A_Function_Body_Stub
| A_Function_Renaming_Declaration
| A_Generic_Function_Declaration
| A_Formal_Function_Declaration
| An_Enumeration_Literal_Specification =>
return Utils.Clone_Function (Item, Parent);
when A_Procedure_Declaration
| A_Procedure_Body_Declaration
| A_Procedure_Body_Stub
| A_Procedure_Renaming_Declaration
| A_Generic_Procedure_Declaration
| A_Formal_Procedure_Declaration =>
return Utils.Clone_Procedure (Item, Parent);
when others =>
null;
end case;
when others =>
null;
end case;
Result := Clone (Item.all, Parent);
Utils.Set_Inherited (Result);
return Result;
end Clone;
---------------------------
-- Get_Declarative_Items --
---------------------------
function Get_Declarative_Items
(Item : Asis.Element) return Asis.Declaration_List
is
use Asis.Elements;
begin
case Element_Kind (Item) is
when A_Statement =>
case Statement_Kind (Item) is
when A_Block_Statement =>
return Asis.Statements.Block_Declarative_Items (Item);
when others =>
null;
end case;
when A_Declaration =>
case Declaration_Kind (Item) is
when A_Function_Body_Declaration |
A_Procedure_Body_Declaration |
A_Package_Body_Declaration |
A_Task_Body_Declaration |
An_Entry_Body_Declaration =>
return Asis.Declarations.Body_Declarative_Items (Item);
when others =>
null;
end case;
when others =>
null;
end case;
return Nil_Element_List;
end Get_Declarative_Items;
-------------------
-- Get_Inherited --
-------------------
function Get_Inherited (Def : Asis.Definition)
return Asis.Declaration_List
is
use Asis.Elements;
Def_Kind : constant Asis.Definition_Kinds := Definition_Kind (Def);
begin
if Def_Kind = A_Private_Extension_Definition
or else
(Def_Kind = A_Type_Definition and then
(Type_Kind (Def) in A_Derived_Type_Definition ..
A_Derived_Record_Extension_Definition
or Type_Kind (Def) = An_Interface_Type_Definition))
or else
(Def_Kind = A_Formal_Type_Definition and then
(Formal_Type_Kind (Def) = A_Formal_Derived_Type_Definition or
Formal_Type_Kind (Def) = A_Formal_Interface_Type_Definition))
then
declare
Index : Asis.ASIS_Natural := 0;
List : Asis.Declaration_List :=
Asis.Definitions.Implicit_Inherited_Subprograms (Def);
begin
for I in List'Range loop
if XASIS.Utils.Overloadable_Declaration (List (I)) then
Index := Index + 1;
List (Index) := List (I);
end if;
end loop;
return List (1 .. Index);
end;
else
return Nil_Element_List;
end if;
end Get_Inherited;
---------------------------
-- Is_Ext_Equal_Operator --
---------------------------
function Is_Ext_Equal_Operator
(Decl : Asis.Declaration;
Tipe : Classes.Type_Info) return Boolean
is
use Asis.Elements;
use Asis.Gela.Classes;
Name : Asis.Element_List :=
Asis.Declarations.Names (Decl);
Kind : Asis.Operator_Kinds :=
Operator_Kind (Name (1));
Expr : Asis.Expression;
Info : Type_Info;
Base : Asis.Declaration;
Def : Asis.Definition := Get_Type_Def (Tipe);
begin
if Type_Kind (Def) /= A_Derived_Record_Extension_Definition
then
return False;
end if;
if Kind /= An_Equal_Operator then
return False;
end if;
Expr := XASIS.Utils.Get_Result_Profile (Decl);
Info := Type_From_Subtype_Mark (Expr, Get_Place (Tipe));
Base := Classes.Get_Declaration (Info);
if not Is_Equal (Base, XASIS.Types.Boolean) then
return False;
end if;
declare
List : Asis.Parameter_Specification_List
:= XASIS.Utils.Get_Profile (Decl);
begin
if List'Length = 2 and then
not Is_Equal (Type_Of_Declaration (List (1), Get_Place (Tipe)),
Type_Of_Declaration (List (2), Get_Place (Tipe)))
then
return False;
end if;
end;
return True;
end Is_Ext_Equal_Operator;
-------------------------------
-- Make_Inherited_Subprogram --
-------------------------------
procedure Make_Inherited_Subprogram
(Oper : Asis.Declaration;
Point : in out Visibility.Point;
Tipe : Classes.Type_Info;
Parent : Classes.Type_Info;
Visible : Boolean)
is
use Asis.Elements;
The_Cloner : Cloner;
Name : Asis.Defining_Name;
Def : Asis.Definition := Classes.Get_Type_Def (Tipe);
Decl : Asis.Declaration := Classes.Get_Declaration (Tipe);
Overriden : Boolean;
Result : Asis.Declaration;
begin
The_Cloner.Tipe := Tipe;
The_Cloner.Parent := Parent;
The_Cloner.Subprogram := Oper;
The_Cloner.Result_Subtype := XASIS.Utils.Get_Result_Subtype (Oper);
Result := Deep_Copy (The_Cloner, Oper, Def);
if Declaration_Kind (Oper) = An_Enumeration_Literal_Specification then
Utils.Set_Result_Profile (Result, Tipe);
end if;
Name := XASIS.Utils.Declaration_Name (Result);
if Visible then
Visibility.New_Implicit_Declaration (Result, Point, Decl, Overriden);
else
Visibility.Set_Not_Declared (Name);
end if;
-- if not Overriden then
Element_Utils.Add_Inherited_Subprogram (Def, Result);
-- end if;
if Defining_Name_Kind (Name) = A_Defining_Operator_Symbol then
Element_Utils.Add_Type_Operator (Def, Result);
end if;
end Make_Inherited_Subprogram;
--------------------------------
-- Make_Inherited_Subprograms --
--------------------------------
procedure Make_Inherited_Subprograms
(Decl : Asis.Declaration;
Point : in out Visibility.Point)
is
Tipe : Classes.Type_Info := Classes.Type_From_Declaration (Decl, Decl);
List : Asis.Name_List := Get_Parents (Decl);
begin
for J in List'Range loop
declare
Parent : constant Classes.Type_Info :=
Classes.Type_From_Subtype_Mark (List (J), Decl);
Proc : Asis.Declaration_List :=
User_Primitive_Subprograms (Parent);
Name : Asis.Defining_Name;
begin
for I in Proc'Range loop
Name := XASIS.Utils.Declaration_Name (Proc (I));
if not Is_Ext_Equal_Operator (Proc (I), Tipe) then
Make_Inherited_Subprogram
(Proc (I), Point, Tipe, Parent,
Visible => Visibility.Visible_From (Name, Decl));
end if;
end loop;
end;
end loop;
end Make_Inherited_Subprograms;
---------------------
-- Operate_On_Type --
---------------------
function Operate_On_Type
(Oper : Asis.Declaration;
Tipe : Classes.Type_Info) return Boolean
is
use XASIS.Utils;
Def : Asis.Definition;
Info : Classes.Type_Info;
Place : Asis.Element := Classes.Get_Place (Tipe);
begin
case Asis.Elements.Declaration_Kind (Oper) is
when A_Generic_Function_Declaration =>
return False;
when A_Function_Declaration
| A_Function_Body_Declaration
| A_Function_Body_Stub
| A_Function_Renaming_Declaration
| A_Formal_Function_Declaration =>
Def := Get_Result_Subtype (Oper);
Info := Classes.Type_From_Indication (Def, Place);
if Classes.Is_Equal (Info, Tipe) then
return True;
end if;
when A_Procedure_Declaration
| A_Procedure_Body_Declaration
| A_Procedure_Body_Stub
| A_Procedure_Renaming_Declaration
| A_Generic_Procedure_Declaration
| A_Formal_Procedure_Declaration =>
null;
when others =>
return False;
end case;
declare
List : constant Asis.Parameter_Specification_List :=
Get_Profile (Oper);
begin
for I in List'Range loop
Info := Classes.Type_Of_Declaration (List (I), Place);
if Classes.Is_Expected_Type (Info, Tipe) then
return True;
end if;
end loop;
end;
return False;
end Operate_On_Type;
--------------
-- Override --
--------------
function Override (Decl : Asis.Declaration) return Boolean is
package U renames Asis.Gela.Element_Utils;
List : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (Decl);
begin
return Assigned (U.Override (List (1)));
end Override;
--------------------------------
-- User_Primitive_Subprograms --
--------------------------------
function User_Primitive_Subprograms
(Info : Classes.Type_Info)
return Asis.Declaration_List
is
function Get_Enum_Literals (Def : Asis.Definition)
return Asis.Declaration_List;
function Get_Package_Operations (Info : Classes.Type_Info)
return Asis.Declaration_List;
function Get_Other_Operations (Info : Classes.Type_Info)
return Asis.Declaration_List;
-----------------------
-- Get_Enum_Literals --
-----------------------
function Get_Enum_Literals (Def : Asis.Definition)
return Asis.Declaration_List
is
Def_Kind : Asis.Type_Kinds := Asis.Elements.Type_Kind (Def);
begin
if Def_Kind = An_Enumeration_Type_Definition then
return Asis.Definitions.Enumeration_Literal_Declarations (Def);
else
return Nil_Element_List;
end if;
end Get_Enum_Literals;
----------------------------
-- Get_Package_Operations --
----------------------------
function Get_Package_Operations (Info : Classes.Type_Info)
return Asis.Declaration_List
is
Decl : constant Asis.Declaration :=
Classes.Get_Declaration (Info);
Pkg : constant Asis.Declaration :=
Asis.Elements.Enclosing_Element (Decl);
begin
if Asis.Elements.Declaration_Kind (Pkg) /= A_Package_Declaration then
return Nil_Element_List;
end if;
declare
Index : Asis.ASIS_Natural := 0;
List : Asis.Declaration_List :=
Asis.Declarations.Visible_Part_Declarative_Items (Pkg) &
Asis.Declarations.Private_Part_Declarative_Items (Pkg);
begin
for I in List'Range loop
if Operate_On_Type (List (I), Info) then
Index := Index + 1;
List (Index) := List (I);
end if;
end loop;
return List (1 .. Index);
end;
end Get_Package_Operations;
--------------------------
-- Get_Other_Operations --
--------------------------
function Get_Other_Operations (Info : Classes.Type_Info)
return Asis.Declaration_List
is
Decl : constant Asis.Declaration :=
Classes.Get_Declaration (Info);
Parent : constant Asis.Element :=
Asis.Elements.Enclosing_Element (Decl);
begin
if Asis.Elements.Declaration_Kind (Parent) = A_Package_Declaration
then
return Nil_Element_List;
end if;
declare
Index : Asis.ASIS_Natural := 0;
List : Asis.Declaration_List :=
Get_Declarative_Items (Parent);
begin
for I in List'Range loop
if Operate_On_Type (List (I), Info)
and then Override (List (I))
and then not XASIS.Utils.Is_Completion (List (I))
then
Index := Index + 1;
List (Index) := List (I);
end if;
end loop;
return List (1 .. Index);
end;
end Get_Other_Operations;
Def : constant Asis.Definition := Classes.Get_Type_Def (Info);
Result : constant Asis.Declaration_List :=
Get_Inherited (Def) &
Get_Enum_Literals (Def) &
Get_Package_Operations (Info) &
Get_Other_Operations (Info);
begin
return Result;
end User_Primitive_Subprograms;
end Asis.Gela.Inheritance;
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, <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:
--
-- * 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 <NAME>, 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 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.
------------------------------------------------------------------------------
|
programs/oeis/259/A259184.asm | karttu/loda | 1 | 87447 | <reponame>karttu/loda
; A259184: a(n) = 1 - sigma(n) + sigma(n)^2.
; 1,7,13,43,31,133,57,211,157,307,133,757,183,553,553,931,307,1483,381,1723,993,1261,553,3541,931,1723,1561,3081,871,5113,993,3907,2257,2863,2257,8191,1407,3541,3081,8011,1723,9121,1893,6973,6007,5113,2257,15253,3193,8557,5113,9507,2863,14281,5113,14281,6321,8011,3541,28057,3783,9121,10713,16003,6973,20593,4557,15751,9121,20593,5113,37831,5403,12883,15253,19461,9121,28057,6321,34411,14521,15751,6973,49953,11557,17293,14281,32221,8011,54523,12433,28057,16257,20593,14281,63253,9507,29071,24181,46873,10303,46441,10713,43891,36673,26083,11557,78121,11991,46441,22953,61257,12883,57361,20593,43891,32943,32221,20593,129241,17557,34411,28057,49953,24181,97033,16257,64771,30801,63253,17293,112561,25441,41413,57361,72631,18907,82657,19461,112561,36673,46441,28057,162007,32221,49063,51757,70491,22351,138013,22953,89701,54523,82657,36673,153273,24807,57361,46441,142507,36673,131407,26733,86143,82657,63253,28057,229921,33307,104653,67341,94557,30103,129241,61257,138013,57361,72631,32221,297571,32943,112561,61257,129241,51757,147073,46441,112561,102081,129241,36673,257557,37443,86143,112561,158803,39007,218557,39801,215761,73713,93331,57361,253513,63253,97033,97033,187923,57361,331201,44733,142507,82657,104653,69433,359401,65281,108571,87321,253513,63253,207481,49953,253513,162007,116623,51757,313041,52671,186193,147073,202051,54523,297571,82657,175981,102081,186193,57361,552793,58323,158803,132133,187923,116623,253513,78121,229921,112561,218557
cal $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
bin $0,2
mov $1,$0
mul $1,2
add $1,1
|
devices/devices-disk6061.adb | SMerrony/dgemua | 2 | 23387 | <reponame>SMerrony/dgemua<gh_stars>1-10
-- MIT License
-- Copyright (c) 2021 <NAME>
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Text_IO;
with Debug_Logs; use Debug_Logs;
with Devices;
with Devices.Bus;
with Memory; use Memory;
with Memory_Channels; use Memory_Channels;
with Status_Monitor;
package body Devices.Disk6061 is
protected body Drives is
procedure Init (Debug_Logging : in Boolean) is
begin
State.Debug_Logging := Debug_Logging;
Devices.Bus.Actions.Set_Reset_Proc (Devices.DPF, Reset'Access);
Devices.Bus.Actions.Set_Data_In_Proc (Devices.DPF, Data_In'Access);
Devices.Bus.Actions.Set_Data_Out_Proc (Devices.DPF, Data_Out'Access);
State.Image_Attached := False;
State.Map_Enabled := False;
Reset;
Status_Sender.Start;
end Init;
procedure Set_Logging (Log : in Boolean) is
begin
State.Debug_Logging := Log;
end Set_Logging;
function Printable_Addr return String is
begin
return "DRV: " & State.Drive'Image &
", CYL:" & State.Cylinder'Image &
", SURF:" & State.Surface'Image &
", SECT:" & State.Sector'Image &
", SECCNT:" & State.Sector_Cnt'Image &
", Mem Addr: " & Dword_To_String (Dword_T(State.Mem_Addr), Octal, 9, true);
end Printable_Addr;
procedure Reset is
begin
State.RW_Status := 0;
State.Instruction_Mode := Normal;
State.Command := 0;
State.Cylinder := 0;
State.Surface := 0;
State.Sector := 0;
State.Sector_Cnt := 0;
State.Drive_Status := Drive_Stat_Ready;
Loggers.Debug_Print (Dpf_Log, "INFO: RESET (IORST) done " & Printable_Addr);
Ada.Text_IO.Put_Line("INFO: DPF Reset");
end Reset;
procedure Attach
(Unit : in Natural; Image_Name : in String; OK : out Boolean)
is
begin
if Unit /= 0 then
raise Not_Yet_Implemented
with "DPF - Multiple disks not yet supported";
end if;
Sector_IO.Open (State.Image_File, Inout_File, Image_Name);
State.Image_Filename := To_Unbounded_String (Image_Name);
State.Image_Attached := True;
Devices.Bus.Actions.Set_Image_Attached (Devices.DPF, Image_Name);
OK := True;
exception
when Error : others =>
Loggers.Debug_Print
(Debug_Log,
"WARNING: Could not open disk image due to " &
Exception_Information (Error));
OK := False;
end Attach;
function Get_Status return Status_Rec is
Stat : Status_Rec;
begin
Stat.Image_Attached := State.Image_Attached;
Stat.Image_Filename := State.Image_Filename;
Stat.Cylinder := State.Cylinder;
Stat.Surface := State.Surface;
Stat.Sector := State.Sector;
Stat.Reads := State.Reads;
Stat.Writes := State.Writes;
return Stat;
end Get_Status;
procedure Position_Image is
Offset : Integer;
begin
Offset := ((Integer(State.Cylinder) * Surfaces_Per_Disk) +
(Integer(State.Surface) * Sectors_Per_Track) +
Integer(State.Sector))
+ 1;
Sector_IO.Set_Index (State.Image_File, Sector_IO.Count(Offset));
end Position_Image;
procedure Do_Command is
begin
State.Instruction_Mode := Normal; -- ??? is this right ???
case State.Command is
when Cmd_T'Pos(Recal) =>
State.Cylinder := 0;
State.Surface := 0;
State.Sector := 0;
Position_Image;
State.Drive_Status := Drive_Stat_Ready;
State.RW_Status := RW_Stat_RW_Done or RW_Stat_Drive_0_Done;
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "... RECAL done " & Printable_Addr);
end if;
when Cmd_T'Pos(Seek) =>
Position_Image;
State.RW_Status := RW_Stat_RW_Done or RW_Stat_Drive_0_Done;
State.Drive_Status := Drive_Stat_Ready;
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "... SEEK done " & Printable_Addr);
end if;
when Cmd_T'Pos(Read) =>
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "... READ called " & Printable_Addr);
end if;
State.RW_Status := 0;
while State.Sector_Cnt /= 0 loop
if State.Cylinder >= Word_T(Cylinders_Per_Disk) then
State.Drive_Status := Drive_Stat_Ready;
State.RW_Status := RW_Stat_RW_Done or RW_Stat_RW_Fault or RW_Stat_Cylinder;
return;
end if;
if State.Sector >= Word_T(Sectors_Per_Track) then
State.Sector := 0;
State.Surface := State.Surface + 1;
end if;
if State.Surface >= Word_T(Surfaces_Per_Disk) then
State.Drive_Status := Drive_Stat_Ready;
State.RW_Status := RW_Stat_RW_Done or RW_Stat_RW_Fault or RW_Stat_Illegal_Sector;
return;
end if;
Position_Image;
Sector_IO.Read(State.Image_File, State.Read_Buff);
for W_Ix in 0 .. Words_Per_Sector - 1 loop
BMC_DCH.Write_Word_BMC_16(State.Mem_Addr, State.Read_Buff(W_Ix));
end loop;
State.Sector := State.Sector + 1;
State.Sector_Cnt := State.Sector_Cnt + 1;
State.Reads := State.Reads + 1;
end loop;
State.RW_Status := RW_Stat_RW_Done or RW_Stat_Drive_0_Done;
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "... READ done " & Printable_Addr);
end if;
when Cmd_T'Pos(Release) =>
-- I think this is a No-Op on a single CPU machine
null;
when Cmd_T'Pos(Write) =>
declare
Datum : Word_T;
begin
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "... WRITE called " & Printable_Addr);
end if;
State.RW_Status := 0;
while State.Sector_Cnt /= 0 loop
if State.Cylinder >= Word_T(Cylinders_Per_Disk) then
State.Drive_Status := Drive_Stat_Ready;
State.RW_Status := RW_Stat_RW_Done or RW_Stat_RW_Fault or RW_Stat_Cylinder;
return;
end if;
if State.Sector >= Word_T(Sectors_Per_Track) then
State.Sector := 0;
State.Surface := State.Surface + 1;
end if;
if State.Surface >= Word_T(Surfaces_Per_Disk) then
State.Drive_Status := Drive_Stat_Ready;
State.RW_Status := RW_Stat_RW_Done or RW_Stat_RW_Fault or RW_Stat_Illegal_Sector;
return;
end if;
Position_Image;
for W_Ix in 0 .. Words_Per_Sector - 1 loop
BMC_DCH.Read_Word_BMC_16 (State.Mem_Addr, Datum);
State.Write_Buff(W_Ix) := Datum;
end loop;
Sector_IO.Write(State.Image_File, State.Write_Buff);
State.Sector := State.Sector + 1;
State.Sector_Cnt := State.Sector_Cnt + 1;
State.Writes := State.Writes + 1;
end loop;
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "... WRITE done " & Printable_Addr);
end if;
State.Drive_Status := Drive_Stat_Ready;
State.RW_Status := RW_Stat_RW_Done; -- or RW_Stat_Drive_0_Done;
end;
when others =>
raise Not_Yet_Implemented with State.Command'Image;
end case;
end Do_Command;
procedure Handle_Flag (IO_Flag : in IO_Flag_T) is
begin
case IO_Flag is
when S =>
Devices.Bus.States.Set_Busy (Devices.DPF, true);
Devices.Bus.States.Set_Done (Devices.DPF, false);
-- TODO stop any I/O
State.RW_Status := 0;
-- TODO start I/O timeout
Do_Command;
Devices.Bus.States.Set_Busy (Devices.DPF, false);
Devices.Bus.States.Set_Done (Devices.DPF, true);
Devices.Bus.States.Send_Interrupt (Devices.DPF);
when C =>
Devices.Bus.States.Set_Busy (Devices.DPF, false);
Devices.Bus.States.Set_Done (Devices.DPF, false);
State.RW_Status := 0;
when P => -- 'Reserved...'
Devices.Bus.States.Set_Busy (Devices.DPF, false);
State.RW_Status := 0;
Do_Command;
Devices.Bus.States.Send_Interrupt (Devices.DPF);
when None =>
null;
end case;
end Handle_Flag;
-- Data_In services the DIA/B/C I/O instructions
procedure Data_In
(ABC : in IO_Reg_T; IO_Flag : in IO_Flag_T; Datum : out Word_T)
is
begin
case ABC is
when A =>
case State.Instruction_Mode is
when Normal =>
Datum := State.RW_Status;
when Alt_1 =>
Datum := State.Mem_Addr;
when Alt_2 =>
Datum := 0; -- return 0 for ECC
end case;
when B =>
case State.Instruction_Mode is
when Normal =>
Datum := State.Drive_Status and 16#feff#;
when Alt_1 =>
Datum := 16#8000# or (State.EMA and 16#001f#);
when Alt_2 =>
Datum := 0; -- return 0 for ECC
end case;
when C =>
Datum := 0;
if State.Map_Enabled then
Datum := 16#8000#;
end if;
Datum := Datum or Shift_Left(State.Surface and 16#001f#,10);
Datum := Datum or Shift_Left(State.Sector and 16#001f#,5);
Datum := Datum or (Word_T(State.Sector_Cnt) and 16#001f#);
when N =>
raise Not_Yet_Implemented with "N flag on data in to DPF";
end case;
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "DI" & ABC'Image & " [" & State.Instruction_Mode'Image &
"] Returning: " & Dword_To_String(Dword_T(Datum), Binary, 16, true));
end if;
Handle_Flag (IO_Flag);
end Data_In;
-- Data_Out implements the DOA/B/C instructions
-- NIO is also routed here with a dummy abc flag value of N
procedure Data_Out (Datum : in Word_T; ABC : in IO_Reg_T; IO_Flag : in IO_Flag_T) is
begin
case ABC is
when A =>
State.Command := Shift_Right (Datum and 16#0780#, 7);
State.Drive := Shift_Right (Datum and 16#0060#, 5);
State.EMA := Shift_Right (Datum and 16#0060#, 5);
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "DOA [Specify Cmd,Drv,EMA] to DRV:" & State.Drive'Image &
" with data: " & Dword_To_String(Dword_T(Datum), Binary, 16, true));
end if;
if Test_W_Bit(Datum, 0) then
State.RW_Status := State.RW_Status and 2#1011_1100_0000_0100#; -- clear R/W status
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "... Clear R/W Done etc.");
end if;
end if;
if Test_W_Bit(Datum, 1) then
State.RW_Status := State.RW_Status and not RW_Stat_Drive_0_Done;
end if;
if Test_W_Bit(Datum, 2) then
State.RW_Status := State.RW_Status and not RW_Stat_Drive_1_Done;
end if;
if Test_W_Bit(Datum, 3) then
State.RW_Status := State.RW_Status and not RW_Stat_Drive_2_Done;
end if;
if Test_W_Bit(Datum, 4) then
State.RW_Status := State.RW_Status and not RW_Stat_Drive_3_Done;
end if;
State.Instruction_Mode := Normal;
if State.Command = Cmd_T'Pos (Set_Alt_Mode_1) then
State.Instruction_Mode := Alt_1;
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "... Alt Mode 1 set");
end if;
elsif State.Command = Cmd_T'Pos (Set_Alt_Mode_2) then
State.Instruction_Mode := Alt_2;
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "... Alt Mode 2 set");
end if;
end if;
if State.Command = Cmd_T'Pos (No_Op) then
State.Instruction_Mode := Normal;
State.RW_Status := 0;
State.Drive_Status := Drive_Stat_Ready;
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "... NO OP command done");
end if;
end if;
State.Last_DOA_Was_Seek := State.Command = Cmd_T'Pos (Seek);
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "... CMD: " & Cmd_T'Val(State.Command)'Image &
", DRV:" & State.Drive'Image &
", EMA: " & Dword_To_String(Dword_T(State.EMA), Octal, 10, false));
end if;
when B =>
if Test_W_Bit (Datum, 0) then
State.EMA := State.EMA or 16#01#;
else
State.EMA := State.EMA and 16#fe#;
end if;
State.Mem_Addr := Datum and 16#7fff#;
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "DOB [Specify Memory Addr] with data " &
Dword_To_String(Dword_T(Datum), Binary, 16, true) & Dasher_NL &
"... MEM Addr: " & Dword_To_String(Dword_T(State.Mem_Addr), Octal, 10) & Dasher_NL &
"... EMA: " & Dword_To_String(Dword_T(State.EMA), Octal, 10));
end if;
when C =>
if State.Last_DOA_Was_Seek then
State.Cylinder := Datum and 16#03ff#; -- mask off lower 10 bits
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "DOC [Specify Cylinder] after SEEK with data " &
Dword_To_String(Dword_T(Datum), Binary, 16, true) & Dasher_NL &
"... CYL:" & State.Cylinder'Image);
end if;
else
declare
Tmp_Byte : Byte_T;
begin
State.Map_Enabled := Test_W_Bit (Datum, 0);
State.Surface := Shift_Right(Datum and 16#7c00#, 10);
State.Sector := Shift_Right(Datum and 16#03e0#, 5);
Tmp_Byte := Byte_T(Datum and 16#001f#);
if Tmp_Byte /= 0 then
Tmp_Byte := Tmp_Byte or 16#e0#; -- sign extend
end if;
State.Sector_Cnt := Byte_To_Integer_8(Tmp_Byte);
if State.Debug_Logging then
Loggers.Debug_Print (Dpf_Log, "DOC [Specify Surf,Sect,Cnt] with data " &
Dword_To_String(Dword_T(Datum), Binary, 16, true) & Dasher_NL &
"... MAP: " & Boolean_To_YN (State.Map_Enabled) &
", SURF:" & State.Surface'Image &
"., SECT:" & State.Sector'Image &
"., SECCNT:" & State.Sector_Cnt'Image);
end if;
end;
end if;
when N => -- dummy value for NIO - we just handle the flag below
null;
end case;
Handle_Flag (IO_Flag);
end Data_Out;
procedure Load_DKBT is
-- Load_DKBT - This proc mimics a system ROM routine to boot from disk.
-- Rather than copying a ROM routine (!) we simply mimic its basic actions...
-- Load 1st block from disk into location 0
begin
Ada.Text_IO.Put_Line ("INFO: Load_DKBT called");
State.Command := Cmd_T'Pos(Recal);
Do_Command;
State.Mem_Addr := 0;
State.Sector_Cnt := -1;
State.Command := Cmd_T'Pos(Read);
Do_Command;
Loggers.Debug_Print (Dpf_Log, "INFO: Load_DKBT complete - " & Printable_Addr);
Ada.Text_IO.Put_Line ("INFO: Load_DKBT completed");
end Load_DKBT;
end Drives;
-- Create_Blank creates an empty disk file of the correct size for the disk6061 emulator to use
procedure Create_Blank (Image_Name : in String; OK : out Boolean) is
Tmp_File : Sector_IO.File_Type;
Empty_Sector : constant Sector := (others => 0);
begin
Sector_IO.Create (Tmp_File, Out_File, Image_Name);
for S in 1 .. Sectors_Per_Disk loop
Sector_IO.Write (Tmp_File, Empty_Sector);
end loop;
Sector_IO.Close (Tmp_File);
OK := True;
exception
when Error : others =>
Loggers.Debug_Print
(Debug_Log,
"WARNING: Could not create disk image due to " &
Exception_Information (Error));
OK := False;
end Create_Blank;
task body Status_Sender is
Status : Status_Rec;
begin
accept Start do
Ada.Text_IO.Put_Line ("INFO: DPF Status Sender started");
end Start;
loop
Status := Drives.Get_Status;
Status_Monitor.Monitor.DPF_Update (Status);
delay 0.5;
end loop;
end Status_Sender;
end Devices.Disk6061;
|
Task/Binary-digits/AppleScript/binary-digits-1.applescript | LaudateCorpus1/RosettaCodeData | 1 | 983 | -- showBin :: Int -> String
on showBin(n)
script binaryChar
on |λ|(n)
text item (n + 1) of "01"
end |λ|
end script
showIntAtBase(2, binaryChar, n, "")
end showBin
-- GENERIC FUNCTIONS ----------------------------------------------------------
-- showIntAtBase :: Int -> (Int -> Char) -> Int -> String -> String
on showIntAtBase(base, toChr, n, rs)
script showIt
on |λ|(nd_, r)
set {n, d} to nd_
set r_ to toChr's |λ|(d) & r
if n > 0 then
|λ|(quotRem(n, base), r_)
else
r_
end if
end |λ|
end script
if base ≤ 1 then
"error: showIntAtBase applied to unsupported base: " & base as string
else if n < 0 then
"error: showIntAtBase applied to negative number: " & base as string
else
showIt's |λ|(quotRem(n, base), rs)
end if
end showIntAtBase
-- quotRem :: Integral a => a -> a -> (a, a)
on quotRem(m, n)
{m div n, m mod n}
end quotRem
-- TEST -----------------------------------------------------------------------
on run
script
on |λ|(n)
intercalate(" -> ", {n as string, showBin(n)})
end |λ|
end script
return unlines(map(result, {5, 50, 9000}))
end run
-- GENERIC FUNCTIONS FOR TEST -------------------------------------------------
-- intercalate :: Text -> [Text] -> Text
on intercalate(strText, lstText)
set {dlm, my text item delimiters} to {my text item delimiters, strText}
set strJoined to lstText as text
set my text item delimiters to dlm
return strJoined
end intercalate
-- map :: (a -> b) -> [a] -> [b]
on map(f, xs)
tell mReturn(f)
set lng to length of xs
set lst to {}
repeat with i from 1 to lng
set end of lst to |λ|(item i of xs, i, xs)
end repeat
return lst
end tell
end map
-- Lift 2nd class handler function into 1st class script wrapper
-- mReturn :: Handler -> Script
on mReturn(f)
if class of f is script then
f
else
script
property |λ| : f
end script
end if
end mReturn
-- unlines :: [String] -> String
on unlines(xs)
intercalate(linefeed, xs)
end unlines
|
test/Succeed/Issue2487-1.agda | KDr2/agda | 0 | 11834 | <filename>test/Succeed/Issue2487-1.agda
{-# OPTIONS --safe --cubical-compatible --no-universe-polymorphism --no-sized-types --no-guardedness #-}
module Issue2487-1 where
import Issue2487.Coinfective
|
oeis/260/A260484.asm | neoneye/loda-programs | 11 | 93486 | <reponame>neoneye/loda-programs
; A260484: Complement of the Beatty sequence for e^(1/Pi) = A179706.
; Submitted by <NAME>
; 3,7,11,14,18,22,25,29,33,36,40,44,47,51,55,58,62,66,69,73,77,80,84,88,91,95,99,102,106,110,113,117,121,124,128,132,135,139,143,146,150,154,157,161,165,168,172,176,179,183,187,190,194,198,201,205,209,212,216,220,223,227,231,234,238,242,245,249,253,256,260,264,267,271,275,278,282,286,289,293,297,300,304,308,311,315,319,322,326,330,333,337,341,344,348,352,355,359,363,366
mov $4,$0
add $4,1
lpb $4
mov $0,$2
sub $4,1
sub $0,$4
pow $0,2
add $0,1
lpb $0
mov $1,$0
trn $0,3
mul $1,2
lpe
mov $0,$1
sub $0,2
div $0,2
add $0,3
add $3,$0
lpe
mov $0,$3
|
src/samples.asm | headkaze/zxnext_dma_sample | 0 | 15138 | <filename>src/samples.asm
PUBLIC _mothership_start
PUBLIC _mothership_end
PUBLIC _steam_start
PUBLIC _steam_end
PUBLIC _explode_start
PUBLIC _explode_end
PUBLIC _zapzapdii_start
PUBLIC _zapzapdii_end
PUBLIC _dub1_start
PUBLIC _dub1_end
PUBLIC _dub2_start
PUBLIC _dub2_end
PUBLIC _dub3_start
PUBLIC _dub3_end
PUBLIC _dub4_start
PUBLIC _dub4_end
PUBLIC _wawawawa_start
PUBLIC _wawawawa_end
PUBLIC _zzzzrrrttt_start
PUBLIC _zzzzrrrttt_end
SECTION BANK_15
_mothership_start:
BINARY "binary/mothership.pcm"
_mothership_end:
_steam_start:
BINARY "binary/steam.pcm"
_steam_end:
SECTION BANK_16
_explode_start:
BINARY "binary/explode.pcm"
_explode_end:
SECTION BANK_17
_zapzapdii_start:
BINARY "binary/zapzapdii.pcm"
_zapzapdii_end:
_dub1_start:
BINARY "binary/dub1.pcm"
_dub1_end:
_dub2_start:
BINARY "binary/dub2.pcm"
_dub2_end:
_dub3_start:
BINARY "binary/dub3.pcm"
_dub3_end:
_dub4_start:
BINARY "binary/dub4.pcm"
_dub4_end:
_wawawawa_start:
BINARY "binary/wawawawa.pcm"
_wawawawa_end:
SECTION BANK_18
_zzzzrrrttt_start:
BINARY "binary/zzzzrrrttt.pcm"
_zzzzrrrttt_end:
|
tests/src/tests.adb | Fabien-Chouteau/COBS | 0 | 1356 | <filename>tests/src/tests.adb
with AUnit; use AUnit;
with AUnit.Test_Suites;
with AUnit.Run;
with AUnit.Reporter.Text;
with GNAT.OS_Lib;
with Ada.Text_IO;
with Testsuite.Encode;
with Testsuite.Decode;
with Testsuite.Encode_Decode;
procedure Tests is
Failures : Natural := 0;
begin
for Kind in Testsuite.Encode.Encoder_Kind
loop
declare
Suite : aliased AUnit.Test_Suites.Test_Suite;
function Get_Suite return AUnit.Test_Suites.Access_Test_Suite
is (Suite'Unchecked_Access);
function Runner is new AUnit.Run.Test_Runner_With_Status (Get_Suite);
Reporter : AUnit.Reporter.Text.Text_Reporter;
begin
Ada.Text_IO.New_Line;
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("Testing " & Kind'Img & " encoder:");
Testsuite.Encode.Set_Encoder_Kind (Kind);
Testsuite.Encode.Add_Tests (Suite);
Reporter.Set_Use_ANSI_Colors (True);
if Runner (Reporter,
(Global_Timer => True,
Test_Case_Timer => True,
Report_Successes => True,
others => <>))
/= AUnit.Success
then
Failures := Failures + 1;
end if;
end;
end loop;
for Kind in Testsuite.Decode.Decoder_Kind
loop
declare
Suite : aliased AUnit.Test_Suites.Test_Suite;
function Get_Suite return AUnit.Test_Suites.Access_Test_Suite
is (Suite'Unchecked_Access);
function Runner is new AUnit.Run.Test_Runner_With_Status (Get_Suite);
Reporter : AUnit.Reporter.Text.Text_Reporter;
begin
Ada.Text_IO.New_Line;
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("Testing " & Kind'Img & " decoder:");
Testsuite.Decode.Set_Decoder_Kind (Kind);
Testsuite.Decode.Add_Tests (Suite);
Reporter.Set_Use_ANSI_Colors (True);
if Runner (Reporter,
(Global_Timer => True,
Test_Case_Timer => True,
Report_Successes => True,
others => <>))
/= AUnit.Success
then
Failures := Failures + 1;
end if;
end;
end loop;
for D_Kind in Testsuite.Decode.Decoder_Kind loop
for E_Kind in Testsuite.Encode.Encoder_Kind loop
declare
Suite : aliased AUnit.Test_Suites.Test_Suite;
function Get_Suite return AUnit.Test_Suites.Access_Test_Suite
is (Suite'Unchecked_Access);
function Runner is new AUnit.Run.Test_Runner_With_Status
(Get_Suite);
Reporter : AUnit.Reporter.Text.Text_Reporter;
begin
Ada.Text_IO.New_Line;
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("Testing " & E_Kind'Img & " encoder" &
" with " & D_Kind'Img & " decoder");
Testsuite.Encode_Decode.Set_Kinds (E_Kind, D_Kind);
Testsuite.Encode_Decode.Add_Tests (Suite);
Reporter.Set_Use_ANSI_Colors (True);
if Runner (Reporter,
(Global_Timer => True,
Test_Case_Timer => True,
Report_Successes => True,
others => <>))
/= AUnit.Success
then
Failures := Failures + 1;
end if;
end;
end loop;
end loop;
if Failures /= 0 then
GNAT.OS_Lib.OS_Exit (1);
end if;
end Tests;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.