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 |
|---|---|---|---|---|
agda/Counterpoint.agda | halfaya/MusicTools | 28 | 11091 | <reponame>halfaya/MusicTools
{-# OPTIONS --cubical --safe #-}
-- First and second species counterpoint
module Counterpoint where
open import Data.Bool using (Bool; true; false; if_then_else_; _∨_; _∧_; not)
open import Data.Fin using (Fin; #_)
open import Data.Integer using (+_)
open import Data.List using (List; []; _∷_; mapMaybe; map; zip; _++_; concatMap)
open import Data.Maybe using (Maybe; just; nothing)
open import Data.Nat using (suc; _+_; _<ᵇ_; compare; _∸_; ℕ; zero) renaming (_≡ᵇ_ to _==_)
open import Data.Product using (_×_; _,_; proj₁; proj₂; uncurry)
open import Data.Vec using ([]; _∷_; Vec; lookup; drop; reverse)
open import Function using (_∘_)
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
open import Music
open import Note
open import Pitch
open import Interval
open import Util using (pairs)
------------------------------------------------
-- First species
-- Beginning must be the 1st, 5th, or 8th
data BeginningError : Set where
not158 : PitchInterval → BeginningError
checkBeginning : PitchInterval → Maybe BeginningError
checkBeginning pi@(_ , i) =
if ((i == per1) ∨ (i == per5) ∨ (i == per8))
then nothing
else just (not158 pi)
------------------------------------------------
-- Intervals in middle bars must be consonant and non-unison
data IntervalError : Set where
dissonant : Upi → IntervalError
unison : Pitch → IntervalError
intervalCheck : PitchInterval → Maybe IntervalError
intervalCheck (p , i) with isConsonant i | isUnison i
intervalCheck (p , i) | false | _ = just (dissonant i)
intervalCheck (p , i) | _ | true = just (unison p)
intervalCheck (p , i) | _ | _ = nothing
checkIntervals : List PitchInterval → List IntervalError
checkIntervals = mapMaybe intervalCheck
------------------------------------------------
-- Perfect intervals must not approached by parallel or similar motion
data Motion : Set where
contrary : Motion
parallel : Motion
similar : Motion
oblique : Motion
motion : PitchInterval → PitchInterval → Motion
motion (p , i) (q , j) =
let p' = p + i; q' = q + j
in if i == j then parallel
else (if (p == q) ∨ (p' == q') then oblique
else (if p <ᵇ q then (if p' <ᵇ q' then similar else contrary)
else (if p' <ᵇ q' then contrary else similar)))
data MotionError : Set where
parallel : PitchInterval → PitchInterval → MotionError
similar : PitchInterval → PitchInterval → MotionError
motionCheck : PitchInterval → PitchInterval → Maybe MotionError
motionCheck i1 i2 with motion i1 i2 | isPerfect (proj₂ i2)
motionCheck i1 i2 | contrary | _ = nothing
motionCheck i1 i2 | oblique | _ = nothing
motionCheck i1 i2 | parallel | false = nothing
motionCheck i1 i2 | parallel | true = just (parallel i1 i2)
motionCheck i1 i2 | similar | false = nothing
motionCheck i1 i2 | similar | true = just (similar i1 i2)
checkMotion : List PitchInterval → List MotionError
checkMotion = mapMaybe (uncurry motionCheck) ∘ pairs
------------------------------------------------
-- Ending must be the 1st or 8th approached by a cadence
data EndingError : Set where
not18 : PitchInterval → EndingError
not27 : PitchInterval → EndingError
tooShort : List PitchInterval → EndingError
endingCheck : PitchInterval → PitchInterval → Maybe EndingError
endingCheck pi1@(p , i) (q , 0) =
if ((p + 1 == q) ∧ (i == min3)) then nothing else just (not27 pi1)
endingCheck pi1@(p , i) (q , 12) =
if ((q + 2 == p) ∧ (i == maj6) ∨ (p + 1 == q) ∧ (i == min10))
then nothing
else just (not27 pi1)
endingCheck pi1 pi2 =
just (not18 pi2)
checkEnding : List PitchInterval → PitchInterval → Maybe EndingError
checkEnding [] _ = just (tooShort [])
checkEnding (p ∷ []) q = endingCheck p q
checkEnding (p ∷ ps) q = checkEnding ps q
------------------------------------------------
-- Correct first species counterpoint
record FirstSpecies : Set where
constructor firstSpecies
field
firstBar : PitchInterval
middleBars : List PitchInterval
lastBar : PitchInterval
beginningOk : checkBeginning firstBar ≡ nothing
intervalsOk : checkIntervals middleBars ≡ []
motionOk : checkMotion (firstBar ∷ middleBars) ≡ []
-- no need to include the last bar,
-- since endingOK guarantees contrary motion in the ending
endingOk : checkEnding middleBars lastBar ≡ nothing
------------------------------------------------
-- Second Species
PitchInterval2 : Set
PitchInterval2 = Pitch × Upi × Upi
strongBeat : PitchInterval2 → PitchInterval
strongBeat (p , i , _) = p , i
weakBeat : PitchInterval2 → PitchInterval
weakBeat (p , _ , i) = p , i
expandPitchInterval2 : PitchInterval2 → List PitchInterval
expandPitchInterval2 (p , i , j) = (p , i) ∷ (p , j) ∷ []
expandPitchIntervals2 : List PitchInterval2 → List PitchInterval
expandPitchIntervals2 = concatMap expandPitchInterval2
------------------------------------------------
-- Beginning must be the 5th or 8th
data BeginningError2 : Set where
not58 : PitchInterval → BeginningError2
checkBeginning2 : PitchInterval → Maybe BeginningError2
checkBeginning2 pi@(_ , i) =
if ((i == per5) ∨ (i == per8))
then nothing
else just (not58 pi)
checkEnding2 : List PitchInterval2 → PitchInterval → Maybe EndingError
checkEnding2 [] _ = just (tooShort [])
checkEnding2 (p ∷ []) q = endingCheck (weakBeat p) q
checkEnding2 (_ ∷ p ∷ ps) q = checkEnding2 (p ∷ ps) q
------------------------------------------------
-- Strong beats must be consonant and non-unison
checkStrongBeats : List PitchInterval2 → List IntervalError
checkStrongBeats = checkIntervals ∘ map strongBeat
------------------------------------------------
-- Weak beats may be dissonant or unison
checkWeakBeat : PitchInterval2 → Pitch → Maybe IntervalError
checkWeakBeat (p , i , j) q with isConsonant j | isUnison j
checkWeakBeat (p , i , j) q | false | _ =
if isPassingTone (secondPitch (p , i)) (secondPitch (p , j)) q
then nothing
else just (dissonant j)
checkWeakBeat (p , i , j) q | _ | true =
if isOppositeStep (secondPitch (p , i)) (secondPitch (p , j)) q
then nothing
else just (unison p)
checkWeakBeat (p , i , j) q | _ | _ =
nothing
checkWeakBeats : List PitchInterval2 → Pitch → List IntervalError
checkWeakBeats [] p = []
checkWeakBeats pis@(_ ∷ qis) p =
mapMaybe (uncurry checkWeakBeat)
(zip pis
(map (λ {(q , i , j) → proj₂ (pitchIntervalToPitchPair (q , i))}) qis ++ (p ∷ [])))
------------------------------------------------
-- Perfect intervals on strong beats must not be approached by parallel or similar motion
checkMotion2 : List PitchInterval → List MotionError
checkMotion2 [] = []
checkMotion2 (_ ∷ []) = []
checkMotion2 (p ∷ q ∷ ps) = checkMotion (p ∷ q ∷ []) ++ checkMotion2 ps
------------------------------------------------
-- Correct second species counterpoint
record SecondSpecies : Set where
constructor secondSpecies
field
firstBar : PitchInterval -- require counterpont to start with a rest, which is preferred
middleBars : List PitchInterval2
lastBar : PitchInterval -- require counterpoint to end with only a single whole note, which is preferred
beginningOk : checkBeginning2 firstBar ≡ nothing
strongBeatsOk : checkStrongBeats middleBars ≡ []
weakBeatsOk : checkWeakBeats middleBars (secondPitch lastBar) ≡ []
motionOk : checkMotion2 (firstBar ∷ (expandPitchIntervals2 middleBars)) ≡ []
endingOk : checkEnding2 middleBars lastBar ≡ nothing
|
work/ff3_30-31.h.asm | ypyp-pprn-mnmn/ff3_hack | 4 | 23919 | <reponame>ypyp-pprn-mnmn/ff3_hack
; ff3_30-31.h
;
;description:
; include file for bank $30,$31
;
;version:
; v0.05 (2007-08-21)
;
;======================================================================================================
;$30-31
b31_getActor2C = $a2b5 ;2c:index & flag
cacheStatus = $a2ba
getRandomTarget = $a300
sumDamage = $a368
addValueAtOffsetToAttack = $a389
isRangedWeapon = $a397
loadPlayerParam = $a482
loadEnemyParam = $a4f6
getActionMode = $a8c8 ;[in] $2c: battleChar* [out] y : #2c, a : $24.+2c
setRandomTargetFromEnemyParty = $a8cd ;[in] BattleChar* $24
getLeastLvInPlayerParty = $a8ec
decideEnemyActionTarget = $a91b
isValidTarget = $a9f7 ;[out] bool zero :valid
recalcPlayerParam = $aa16
calcAction = $af77
battle.specials.invoke_handler = $b15f
segmentate = $b9ab
battle.push_damage_for_2nd_phase = $bb1c
;getRandomSucceededCount = $bb28 ;$24:count, $25:rate, [out] $30:succeededCount
getNumberOfRandomSuccess = $bb28
calcDamage = $bb44 ;[out] $1c,1d : damage
isTargetWeakToHoly = $bbe2 ;[out] $27: 2=weak
b31_getTarget2C = $bc25
battle.action_target.get_2c = $bc25
;applyDamage = $bcd2
damageHp = $bcd2
healHp = $bd24
shiftRightDamageBy2 = $bdaa
set24ToActor = $bdb3 ;setCalcTargetToActor
;checkForEffectTargetDeath
battle.set_actor_as_affected = $bdb3
set24ToTarget = $bdbc ;setCalcTargetPtrToOpponent
battle.set_target_as_affected = $bdbc
;checkForEffectTargetDeath = $bdc5
battle.update_status_cache = $bdc5
checkEnchantedStatus = $be14
b31_updatePlayerOffset = $be90
b31_setYtoOffsetOf = $be98
calcDataAddress = $be9d
b31_getBattleRandom = $beb4
checkSegment = $bf53
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1374.asm | ljhsiun2/medusa | 9 | 242762 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r8
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0xbac, %r8
and $31515, %r11
movups (%r8), %xmm6
vpextrq $1, %xmm6, %rax
nop
nop
nop
nop
and $17186, %rdx
lea addresses_WT_ht+0x1bd2c, %rbx
nop
nop
nop
nop
nop
xor $19613, %r11
mov (%rbx), %ebp
nop
xor %rbp, %rbp
lea addresses_A_ht+0x12c2c, %rsi
lea addresses_WC_ht+0x8eac, %rdi
nop
add $32588, %r8
mov $38, %rcx
rep movsw
xor $3180, %rbx
lea addresses_D_ht+0xaf8e, %rbp
nop
nop
nop
nop
nop
and $53748, %rdi
movups (%rbp), %xmm6
vpextrq $1, %xmm6, %rcx
nop
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_D_ht+0x82ac, %rcx
nop
nop
nop
nop
xor %r11, %r11
mov (%rcx), %rbp
nop
add $59764, %r11
lea addresses_D_ht+0x1d40c, %rdi
nop
xor %rbx, %rbx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm1
movups %xmm1, (%rdi)
nop
nop
nop
nop
nop
xor $17405, %rax
lea addresses_WT_ht+0xabec, %r11
inc %rbp
movups (%r11), %xmm6
vpextrq $0, %xmm6, %rdi
nop
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_A_ht+0x46dc, %rsi
lea addresses_WC_ht+0xccc6, %rdi
nop
nop
nop
nop
and %r11, %r11
mov $61, %rcx
rep movsb
nop
and %r11, %r11
lea addresses_WC_ht+0x1373c, %rcx
nop
and %rsi, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, (%rcx)
add $60067, %rdi
lea addresses_normal_ht+0x1a170, %rsi
lea addresses_WC_ht+0x1cbc8, %rdi
nop
nop
sub $32588, %r8
mov $9, %rcx
rep movsb
nop
nop
nop
nop
nop
sub %rcx, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r8
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r8
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
// Store
lea addresses_WC+0xe980, %rcx
nop
inc %r9
mov $0x5152535455565758, %rbp
movq %rbp, %xmm5
vmovups %ymm5, (%rcx)
xor $35587, %rcx
// Store
lea addresses_WT+0x17eac, %rdi
nop
nop
and %rax, %rax
mov $0x5152535455565758, %rbp
movq %rbp, (%rdi)
nop
nop
nop
nop
nop
xor %r8, %r8
// Store
mov $0xfac, %rsi
nop
sub $8114, %r8
mov $0x5152535455565758, %rbp
movq %rbp, (%rsi)
nop
cmp %rdi, %rdi
// Load
lea addresses_PSE+0x13aac, %rdi
clflush (%rdi)
nop
nop
nop
xor $4290, %rcx
vmovups (%rdi), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $1, %xmm0, %rbp
sub $39713, %rax
// Store
lea addresses_PSE+0x145d4, %rax
nop
nop
nop
and %rsi, %rsi
mov $0x5152535455565758, %r9
movq %r9, %xmm2
movups %xmm2, (%rax)
nop
nop
nop
nop
nop
xor $56052, %rsi
// Load
lea addresses_RW+0x156ac, %rax
xor %rcx, %rcx
mov (%rax), %r8
nop
nop
add $20187, %rsi
// Faulty Load
lea addresses_normal+0x15eac, %rsi
nop
nop
sub %rdi, %rdi
mov (%rsi), %r8d
lea oracles, %rsi
and $0xff, %r8
shlq $12, %r8
mov (%rsi,%r8,1), %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r8
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'size': 8, 'NT': True, 'same': False, 'congruent': 5}}
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 1}}
{'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 2}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
Relator/Equals.agda | Lolirofle/stuff-in-agda | 6 | 11276 | <filename>Relator/Equals.agda
module Relator.Equals where
import Lvl
open import Logic
open import Logic.Propositional
open import Type
infixl 15 _≢_
open import Type.Identity public
using()
renaming(Id to infixl 15 _≡_ ; intro to [≡]-intro)
_≢_ : ∀{ℓ}{T} → T → T → Stmt{ℓ}
a ≢ b = ¬(a ≡ b)
|
third_party/universal-ctags/ctags/Units/parser-ada.r/ada-entry.d/input.adb | f110/wing | 1 | 24357 | with Ada.Text_IO;
-- with Mes_Tasches_P;
with Input_1;
-- procedure Client is
procedure Input is
begin
Ada.Text_IO.Put_Line ("Tasks won't stop, kill it with CTRL-C");
-- Mes_Tasches_P.Ma_Tasche.Accepter (Continuer => True);
Input_1.Ma_Tasche.Accepter (Continuer => True);
end Input;
-- end Client;
|
dist/halt.asm | Mishal-Alajmi/XV6 | 0 | 11958 |
_halt: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
// halt the system.
#include "types.h"
#include "user.h"
int
main(void) {
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 e4 f0 and $0xfffffff0,%esp
halt();
6: e8 96 03 00 00 call 3a1 <halt>
exit();
b: e8 f1 02 00 00 call 301 <exit>
00000010 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
10: 55 push %ebp
char *os;
os = s;
while((*s++ = *t++) != 0)
11: 31 d2 xor %edx,%edx
{
13: 89 e5 mov %esp,%ebp
15: 53 push %ebx
16: 8b 45 08 mov 0x8(%ebp),%eax
19: 8b 5d 0c mov 0xc(%ebp),%ebx
1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while((*s++ = *t++) != 0)
20: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
24: 88 0c 10 mov %cl,(%eax,%edx,1)
27: 83 c2 01 add $0x1,%edx
2a: 84 c9 test %cl,%cl
2c: 75 f2 jne 20 <strcpy+0x10>
;
return os;
}
2e: 5b pop %ebx
2f: 5d pop %ebp
30: c3 ret
31: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
38: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3f: 90 nop
00000040 <strcmp>:
int
strcmp(const char *p, const char *q)
{
40: 55 push %ebp
41: 89 e5 mov %esp,%ebp
43: 56 push %esi
44: 53 push %ebx
45: 8b 5d 08 mov 0x8(%ebp),%ebx
48: 8b 75 0c mov 0xc(%ebp),%esi
while(*p && *p == *q)
4b: 0f b6 13 movzbl (%ebx),%edx
4e: 0f b6 0e movzbl (%esi),%ecx
51: 84 d2 test %dl,%dl
53: 74 1e je 73 <strcmp+0x33>
55: b8 01 00 00 00 mov $0x1,%eax
5a: 38 ca cmp %cl,%dl
5c: 74 09 je 67 <strcmp+0x27>
5e: eb 20 jmp 80 <strcmp+0x40>
60: 83 c0 01 add $0x1,%eax
63: 38 ca cmp %cl,%dl
65: 75 19 jne 80 <strcmp+0x40>
67: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx
6b: 0f b6 0c 06 movzbl (%esi,%eax,1),%ecx
6f: 84 d2 test %dl,%dl
71: 75 ed jne 60 <strcmp+0x20>
73: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
75: 5b pop %ebx
76: 5e pop %esi
return (uchar)*p - (uchar)*q;
77: 29 c8 sub %ecx,%eax
}
79: 5d pop %ebp
7a: c3 ret
7b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
7f: 90 nop
80: 0f b6 c2 movzbl %dl,%eax
83: 5b pop %ebx
84: 5e pop %esi
return (uchar)*p - (uchar)*q;
85: 29 c8 sub %ecx,%eax
}
87: 5d pop %ebp
88: c3 ret
89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000090 <strlen>:
uint
strlen(char *s)
{
90: 55 push %ebp
91: 89 e5 mov %esp,%ebp
93: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
96: 80 39 00 cmpb $0x0,(%ecx)
99: 74 15 je b0 <strlen+0x20>
9b: 31 d2 xor %edx,%edx
9d: 8d 76 00 lea 0x0(%esi),%esi
a0: 83 c2 01 add $0x1,%edx
a3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
a7: 89 d0 mov %edx,%eax
a9: 75 f5 jne a0 <strlen+0x10>
;
return n;
}
ab: 5d pop %ebp
ac: c3 ret
ad: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
b0: 31 c0 xor %eax,%eax
}
b2: 5d pop %ebp
b3: c3 ret
b4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
bb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bf: 90 nop
000000c0 <memset>:
void*
memset(void *dst, int c, uint n)
{
c0: 55 push %ebp
c1: 89 e5 mov %esp,%ebp
c3: 57 push %edi
c4: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
c7: 8b 4d 10 mov 0x10(%ebp),%ecx
ca: 8b 45 0c mov 0xc(%ebp),%eax
cd: 89 d7 mov %edx,%edi
cf: fc cld
d0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
d2: 89 d0 mov %edx,%eax
d4: 5f pop %edi
d5: 5d pop %ebp
d6: c3 ret
d7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
de: 66 90 xchg %ax,%ax
000000e0 <strchr>:
char*
strchr(const char *s, char c)
{
e0: 55 push %ebp
e1: 89 e5 mov %esp,%ebp
e3: 53 push %ebx
e4: 8b 45 08 mov 0x8(%ebp),%eax
e7: 8b 55 0c mov 0xc(%ebp),%edx
for(; *s; s++)
ea: 0f b6 18 movzbl (%eax),%ebx
ed: 84 db test %bl,%bl
ef: 74 1d je 10e <strchr+0x2e>
f1: 89 d1 mov %edx,%ecx
if(*s == c)
f3: 38 d3 cmp %dl,%bl
f5: 75 0d jne 104 <strchr+0x24>
f7: eb 17 jmp 110 <strchr+0x30>
f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
100: 38 ca cmp %cl,%dl
102: 74 0c je 110 <strchr+0x30>
for(; *s; s++)
104: 83 c0 01 add $0x1,%eax
107: 0f b6 10 movzbl (%eax),%edx
10a: 84 d2 test %dl,%dl
10c: 75 f2 jne 100 <strchr+0x20>
return (char*)s;
return 0;
10e: 31 c0 xor %eax,%eax
}
110: 5b pop %ebx
111: 5d pop %ebp
112: c3 ret
113: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
11a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000120 <gets>:
char*
gets(char *buf, int max)
{
120: 55 push %ebp
121: 89 e5 mov %esp,%ebp
123: 57 push %edi
124: 56 push %esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
125: 31 f6 xor %esi,%esi
{
127: 53 push %ebx
128: 89 f3 mov %esi,%ebx
12a: 83 ec 1c sub $0x1c,%esp
12d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
130: eb 2f jmp 161 <gets+0x41>
132: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
138: 83 ec 04 sub $0x4,%esp
13b: 8d 45 e7 lea -0x19(%ebp),%eax
13e: 6a 01 push $0x1
140: 50 push %eax
141: 6a 00 push $0x0
143: e8 d1 01 00 00 call 319 <read>
if(cc < 1)
148: 83 c4 10 add $0x10,%esp
14b: 85 c0 test %eax,%eax
14d: 7e 1c jle 16b <gets+0x4b>
break;
buf[i++] = c;
14f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
153: 83 c7 01 add $0x1,%edi
156: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
159: 3c 0a cmp $0xa,%al
15b: 74 23 je 180 <gets+0x60>
15d: 3c 0d cmp $0xd,%al
15f: 74 1f je 180 <gets+0x60>
for(i=0; i+1 < max; ){
161: 83 c3 01 add $0x1,%ebx
164: 89 fe mov %edi,%esi
166: 3b 5d 0c cmp 0xc(%ebp),%ebx
169: 7c cd jl 138 <gets+0x18>
16b: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
16d: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
170: c6 03 00 movb $0x0,(%ebx)
}
173: 8d 65 f4 lea -0xc(%ebp),%esp
176: 5b pop %ebx
177: 5e pop %esi
178: 5f pop %edi
179: 5d pop %ebp
17a: c3 ret
17b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
17f: 90 nop
180: 8b 75 08 mov 0x8(%ebp),%esi
183: 8b 45 08 mov 0x8(%ebp),%eax
186: 01 de add %ebx,%esi
188: 89 f3 mov %esi,%ebx
buf[i] = '\0';
18a: c6 03 00 movb $0x0,(%ebx)
}
18d: 8d 65 f4 lea -0xc(%ebp),%esp
190: 5b pop %ebx
191: 5e pop %esi
192: 5f pop %edi
193: 5d pop %ebp
194: c3 ret
195: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
19c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000001a0 <stat>:
int
stat(char *n, struct stat *st)
{
1a0: 55 push %ebp
1a1: 89 e5 mov %esp,%ebp
1a3: 56 push %esi
1a4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
1a5: 83 ec 08 sub $0x8,%esp
1a8: 6a 00 push $0x0
1aa: ff 75 08 pushl 0x8(%ebp)
1ad: e8 8f 01 00 00 call 341 <open>
if(fd < 0)
1b2: 83 c4 10 add $0x10,%esp
1b5: 85 c0 test %eax,%eax
1b7: 78 27 js 1e0 <stat+0x40>
return -1;
r = fstat(fd, st);
1b9: 83 ec 08 sub $0x8,%esp
1bc: ff 75 0c pushl 0xc(%ebp)
1bf: 89 c3 mov %eax,%ebx
1c1: 50 push %eax
1c2: e8 92 01 00 00 call 359 <fstat>
close(fd);
1c7: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
1ca: 89 c6 mov %eax,%esi
close(fd);
1cc: e8 58 01 00 00 call 329 <close>
return r;
1d1: 83 c4 10 add $0x10,%esp
}
1d4: 8d 65 f8 lea -0x8(%ebp),%esp
1d7: 89 f0 mov %esi,%eax
1d9: 5b pop %ebx
1da: 5e pop %esi
1db: 5d pop %ebp
1dc: c3 ret
1dd: 8d 76 00 lea 0x0(%esi),%esi
return -1;
1e0: be ff ff ff ff mov $0xffffffff,%esi
1e5: eb ed jmp 1d4 <stat+0x34>
1e7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1ee: 66 90 xchg %ax,%ax
000001f0 <atoi>:
#ifdef PDX_XV6
int
atoi(const char *s)
{
1f0: 55 push %ebp
1f1: 89 e5 mov %esp,%ebp
1f3: 56 push %esi
1f4: 8b 55 08 mov 0x8(%ebp),%edx
1f7: 53 push %ebx
int n, sign;
n = 0;
while (*s == ' ') s++;
1f8: 0f b6 0a movzbl (%edx),%ecx
1fb: 80 f9 20 cmp $0x20,%cl
1fe: 75 0b jne 20b <atoi+0x1b>
200: 83 c2 01 add $0x1,%edx
203: 0f b6 0a movzbl (%edx),%ecx
206: 80 f9 20 cmp $0x20,%cl
209: 74 f5 je 200 <atoi+0x10>
sign = (*s == '-') ? -1 : 1;
20b: 80 f9 2d cmp $0x2d,%cl
20e: 74 40 je 250 <atoi+0x60>
210: be 01 00 00 00 mov $0x1,%esi
if (*s == '+' || *s == '-')
215: 80 f9 2b cmp $0x2b,%cl
218: 74 3b je 255 <atoi+0x65>
s++;
while('0' <= *s && *s <= '9')
21a: 0f be 0a movsbl (%edx),%ecx
21d: 8d 41 d0 lea -0x30(%ecx),%eax
220: 3c 09 cmp $0x9,%al
222: b8 00 00 00 00 mov $0x0,%eax
227: 77 1f ja 248 <atoi+0x58>
229: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
n = n*10 + *s++ - '0';
230: 83 c2 01 add $0x1,%edx
233: 8d 04 80 lea (%eax,%eax,4),%eax
236: 8d 44 41 d0 lea -0x30(%ecx,%eax,2),%eax
while('0' <= *s && *s <= '9')
23a: 0f be 0a movsbl (%edx),%ecx
23d: 8d 59 d0 lea -0x30(%ecx),%ebx
240: 80 fb 09 cmp $0x9,%bl
243: 76 eb jbe 230 <atoi+0x40>
245: 0f af c6 imul %esi,%eax
return sign*n;
}
248: 5b pop %ebx
249: 5e pop %esi
24a: 5d pop %ebp
24b: c3 ret
24c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
sign = (*s == '-') ? -1 : 1;
250: be ff ff ff ff mov $0xffffffff,%esi
s++;
255: 83 c2 01 add $0x1,%edx
258: eb c0 jmp 21a <atoi+0x2a>
25a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000260 <atoo>:
int
atoo(const char *s)
{
260: 55 push %ebp
261: 89 e5 mov %esp,%ebp
263: 56 push %esi
264: 8b 55 08 mov 0x8(%ebp),%edx
267: 53 push %ebx
int n, sign;
n = 0;
while (*s == ' ') s++;
268: 0f b6 0a movzbl (%edx),%ecx
26b: 80 f9 20 cmp $0x20,%cl
26e: 75 0b jne 27b <atoo+0x1b>
270: 83 c2 01 add $0x1,%edx
273: 0f b6 0a movzbl (%edx),%ecx
276: 80 f9 20 cmp $0x20,%cl
279: 74 f5 je 270 <atoo+0x10>
sign = (*s == '-') ? -1 : 1;
27b: 80 f9 2d cmp $0x2d,%cl
27e: 74 40 je 2c0 <atoo+0x60>
280: be 01 00 00 00 mov $0x1,%esi
if (*s == '+' || *s == '-')
285: 80 f9 2b cmp $0x2b,%cl
288: 74 3b je 2c5 <atoo+0x65>
s++;
while('0' <= *s && *s <= '7')
28a: 0f be 0a movsbl (%edx),%ecx
28d: 8d 41 d0 lea -0x30(%ecx),%eax
290: 3c 07 cmp $0x7,%al
292: b8 00 00 00 00 mov $0x0,%eax
297: 77 1c ja 2b5 <atoo+0x55>
299: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
n = n*8 + *s++ - '0';
2a0: 83 c2 01 add $0x1,%edx
2a3: 8d 44 c1 d0 lea -0x30(%ecx,%eax,8),%eax
while('0' <= *s && *s <= '7')
2a7: 0f be 0a movsbl (%edx),%ecx
2aa: 8d 59 d0 lea -0x30(%ecx),%ebx
2ad: 80 fb 07 cmp $0x7,%bl
2b0: 76 ee jbe 2a0 <atoo+0x40>
2b2: 0f af c6 imul %esi,%eax
return sign*n;
}
2b5: 5b pop %ebx
2b6: 5e pop %esi
2b7: 5d pop %ebp
2b8: c3 ret
2b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
sign = (*s == '-') ? -1 : 1;
2c0: be ff ff ff ff mov $0xffffffff,%esi
s++;
2c5: 83 c2 01 add $0x1,%edx
2c8: eb c0 jmp 28a <atoo+0x2a>
2ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
000002d0 <memmove>:
}
#endif // PDX_XV6
void*
memmove(void *vdst, void *vsrc, int n)
{
2d0: 55 push %ebp
2d1: 89 e5 mov %esp,%ebp
2d3: 57 push %edi
2d4: 8b 55 10 mov 0x10(%ebp),%edx
2d7: 8b 45 08 mov 0x8(%ebp),%eax
2da: 56 push %esi
2db: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2de: 85 d2 test %edx,%edx
2e0: 7e 13 jle 2f5 <memmove+0x25>
2e2: 01 c2 add %eax,%edx
dst = vdst;
2e4: 89 c7 mov %eax,%edi
2e6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2ed: 8d 76 00 lea 0x0(%esi),%esi
*dst++ = *src++;
2f0: a4 movsb %ds:(%esi),%es:(%edi)
while(n-- > 0)
2f1: 39 fa cmp %edi,%edx
2f3: 75 fb jne 2f0 <memmove+0x20>
return vdst;
}
2f5: 5e pop %esi
2f6: 5f pop %edi
2f7: 5d pop %ebp
2f8: c3 ret
000002f9 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2f9: b8 01 00 00 00 mov $0x1,%eax
2fe: cd 40 int $0x40
300: c3 ret
00000301 <exit>:
SYSCALL(exit)
301: b8 02 00 00 00 mov $0x2,%eax
306: cd 40 int $0x40
308: c3 ret
00000309 <wait>:
SYSCALL(wait)
309: b8 03 00 00 00 mov $0x3,%eax
30e: cd 40 int $0x40
310: c3 ret
00000311 <pipe>:
SYSCALL(pipe)
311: b8 04 00 00 00 mov $0x4,%eax
316: cd 40 int $0x40
318: c3 ret
00000319 <read>:
SYSCALL(read)
319: b8 05 00 00 00 mov $0x5,%eax
31e: cd 40 int $0x40
320: c3 ret
00000321 <write>:
SYSCALL(write)
321: b8 10 00 00 00 mov $0x10,%eax
326: cd 40 int $0x40
328: c3 ret
00000329 <close>:
SYSCALL(close)
329: b8 15 00 00 00 mov $0x15,%eax
32e: cd 40 int $0x40
330: c3 ret
00000331 <kill>:
SYSCALL(kill)
331: b8 06 00 00 00 mov $0x6,%eax
336: cd 40 int $0x40
338: c3 ret
00000339 <exec>:
SYSCALL(exec)
339: b8 07 00 00 00 mov $0x7,%eax
33e: cd 40 int $0x40
340: c3 ret
00000341 <open>:
SYSCALL(open)
341: b8 0f 00 00 00 mov $0xf,%eax
346: cd 40 int $0x40
348: c3 ret
00000349 <mknod>:
SYSCALL(mknod)
349: b8 11 00 00 00 mov $0x11,%eax
34e: cd 40 int $0x40
350: c3 ret
00000351 <unlink>:
SYSCALL(unlink)
351: b8 12 00 00 00 mov $0x12,%eax
356: cd 40 int $0x40
358: c3 ret
00000359 <fstat>:
SYSCALL(fstat)
359: b8 08 00 00 00 mov $0x8,%eax
35e: cd 40 int $0x40
360: c3 ret
00000361 <link>:
SYSCALL(link)
361: b8 13 00 00 00 mov $0x13,%eax
366: cd 40 int $0x40
368: c3 ret
00000369 <mkdir>:
SYSCALL(mkdir)
369: b8 14 00 00 00 mov $0x14,%eax
36e: cd 40 int $0x40
370: c3 ret
00000371 <chdir>:
SYSCALL(chdir)
371: b8 09 00 00 00 mov $0x9,%eax
376: cd 40 int $0x40
378: c3 ret
00000379 <dup>:
SYSCALL(dup)
379: b8 0a 00 00 00 mov $0xa,%eax
37e: cd 40 int $0x40
380: c3 ret
00000381 <getpid>:
SYSCALL(getpid)
381: b8 0b 00 00 00 mov $0xb,%eax
386: cd 40 int $0x40
388: c3 ret
00000389 <sbrk>:
SYSCALL(sbrk)
389: b8 0c 00 00 00 mov $0xc,%eax
38e: cd 40 int $0x40
390: c3 ret
00000391 <sleep>:
SYSCALL(sleep)
391: b8 0d 00 00 00 mov $0xd,%eax
396: cd 40 int $0x40
398: c3 ret
00000399 <uptime>:
SYSCALL(uptime)
399: b8 0e 00 00 00 mov $0xe,%eax
39e: cd 40 int $0x40
3a0: c3 ret
000003a1 <halt>:
SYSCALL(halt)
3a1: b8 16 00 00 00 mov $0x16,%eax
3a6: cd 40 int $0x40
3a8: c3 ret
000003a9 <date>:
SYSCALL(date)
3a9: b8 17 00 00 00 mov $0x17,%eax
3ae: cd 40 int $0x40
3b0: c3 ret
000003b1 <getgid>:
SYSCALL(getgid)
3b1: b8 18 00 00 00 mov $0x18,%eax
3b6: cd 40 int $0x40
3b8: c3 ret
000003b9 <setgid>:
SYSCALL(setgid)
3b9: b8 19 00 00 00 mov $0x19,%eax
3be: cd 40 int $0x40
3c0: c3 ret
000003c1 <getuid>:
SYSCALL(getuid)
3c1: b8 1a 00 00 00 mov $0x1a,%eax
3c6: cd 40 int $0x40
3c8: c3 ret
000003c9 <setuid>:
SYSCALL(setuid)
3c9: b8 1b 00 00 00 mov $0x1b,%eax
3ce: cd 40 int $0x40
3d0: c3 ret
000003d1 <getppid>:
SYSCALL(getppid)
3d1: b8 1c 00 00 00 mov $0x1c,%eax
3d6: cd 40 int $0x40
3d8: c3 ret
000003d9 <getprocs>:
SYSCALL(getprocs)
3d9: b8 1d 00 00 00 mov $0x1d,%eax
3de: cd 40 int $0x40
3e0: c3 ret
000003e1 <setpriority>:
SYSCALL(setpriority)
3e1: b8 1e 00 00 00 mov $0x1e,%eax
3e6: cd 40 int $0x40
3e8: c3 ret
000003e9 <getpriority>:
SYSCALL(getpriority)
3e9: b8 1f 00 00 00 mov $0x1f,%eax
3ee: cd 40 int $0x40
3f0: c3 ret
000003f1 <chmod>:
SYSCALL(chmod)
3f1: b8 20 00 00 00 mov $0x20,%eax
3f6: cd 40 int $0x40
3f8: c3 ret
000003f9 <chown>:
SYSCALL(chown)
3f9: b8 21 00 00 00 mov $0x21,%eax
3fe: cd 40 int $0x40
400: c3 ret
00000401 <chgrp>:
SYSCALL(chgrp)
401: b8 22 00 00 00 mov $0x22,%eax
406: cd 40 int $0x40
408: c3 ret
409: 66 90 xchg %ax,%ax
40b: 66 90 xchg %ax,%ax
40d: 66 90 xchg %ax,%ax
40f: 90 nop
00000410 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
410: 55 push %ebp
411: 89 e5 mov %esp,%ebp
413: 57 push %edi
414: 56 push %esi
415: 53 push %ebx
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
416: 89 d3 mov %edx,%ebx
{
418: 83 ec 3c sub $0x3c,%esp
41b: 89 45 bc mov %eax,-0x44(%ebp)
if(sgn && xx < 0){
41e: 85 d2 test %edx,%edx
420: 0f 89 92 00 00 00 jns 4b8 <printint+0xa8>
426: f6 45 08 01 testb $0x1,0x8(%ebp)
42a: 0f 84 88 00 00 00 je 4b8 <printint+0xa8>
neg = 1;
430: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp)
x = -xx;
437: f7 db neg %ebx
} else {
x = xx;
}
i = 0;
439: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
440: 8d 75 d7 lea -0x29(%ebp),%esi
443: eb 08 jmp 44d <printint+0x3d>
445: 8d 76 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
448: 89 7d c4 mov %edi,-0x3c(%ebp)
}while((x /= base) != 0);
44b: 89 c3 mov %eax,%ebx
buf[i++] = digits[x % base];
44d: 89 d8 mov %ebx,%eax
44f: 31 d2 xor %edx,%edx
451: 8b 7d c4 mov -0x3c(%ebp),%edi
454: f7 f1 div %ecx
456: 83 c7 01 add $0x1,%edi
459: 0f b6 92 40 08 00 00 movzbl 0x840(%edx),%edx
460: 88 14 3e mov %dl,(%esi,%edi,1)
}while((x /= base) != 0);
463: 39 d9 cmp %ebx,%ecx
465: 76 e1 jbe 448 <printint+0x38>
if(neg)
467: 8b 45 c0 mov -0x40(%ebp),%eax
46a: 85 c0 test %eax,%eax
46c: 74 0d je 47b <printint+0x6b>
buf[i++] = '-';
46e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
473: ba 2d 00 00 00 mov $0x2d,%edx
buf[i++] = digits[x % base];
478: 89 7d c4 mov %edi,-0x3c(%ebp)
47b: 8b 45 c4 mov -0x3c(%ebp),%eax
47e: 8b 7d bc mov -0x44(%ebp),%edi
481: 8d 5c 05 d7 lea -0x29(%ebp,%eax,1),%ebx
485: eb 0f jmp 496 <printint+0x86>
487: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
48e: 66 90 xchg %ax,%ax
490: 0f b6 13 movzbl (%ebx),%edx
493: 83 eb 01 sub $0x1,%ebx
write(fd, &c, 1);
496: 83 ec 04 sub $0x4,%esp
499: 88 55 d7 mov %dl,-0x29(%ebp)
49c: 6a 01 push $0x1
49e: 56 push %esi
49f: 57 push %edi
4a0: e8 7c fe ff ff call 321 <write>
while(--i >= 0)
4a5: 83 c4 10 add $0x10,%esp
4a8: 39 de cmp %ebx,%esi
4aa: 75 e4 jne 490 <printint+0x80>
putc(fd, buf[i]);
}
4ac: 8d 65 f4 lea -0xc(%ebp),%esp
4af: 5b pop %ebx
4b0: 5e pop %esi
4b1: 5f pop %edi
4b2: 5d pop %ebp
4b3: c3 ret
4b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
4b8: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp)
4bf: e9 75 ff ff ff jmp 439 <printint+0x29>
4c4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
4cb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
4cf: 90 nop
000004d0 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
4d0: 55 push %ebp
4d1: 89 e5 mov %esp,%ebp
4d3: 57 push %edi
4d4: 56 push %esi
4d5: 53 push %ebx
4d6: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
4d9: 8b 75 0c mov 0xc(%ebp),%esi
4dc: 0f b6 1e movzbl (%esi),%ebx
4df: 84 db test %bl,%bl
4e1: 0f 84 b9 00 00 00 je 5a0 <printf+0xd0>
ap = (uint*)(void*)&fmt + 1;
4e7: 8d 45 10 lea 0x10(%ebp),%eax
4ea: 83 c6 01 add $0x1,%esi
write(fd, &c, 1);
4ed: 8d 7d e7 lea -0x19(%ebp),%edi
state = 0;
4f0: 31 d2 xor %edx,%edx
ap = (uint*)(void*)&fmt + 1;
4f2: 89 45 d0 mov %eax,-0x30(%ebp)
4f5: eb 38 jmp 52f <printf+0x5f>
4f7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
4fe: 66 90 xchg %ax,%ax
500: 89 55 d4 mov %edx,-0x2c(%ebp)
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
503: ba 25 00 00 00 mov $0x25,%edx
if(c == '%'){
508: 83 f8 25 cmp $0x25,%eax
50b: 74 17 je 524 <printf+0x54>
write(fd, &c, 1);
50d: 83 ec 04 sub $0x4,%esp
510: 88 5d e7 mov %bl,-0x19(%ebp)
513: 6a 01 push $0x1
515: 57 push %edi
516: ff 75 08 pushl 0x8(%ebp)
519: e8 03 fe ff ff call 321 <write>
51e: 8b 55 d4 mov -0x2c(%ebp),%edx
} else {
putc(fd, c);
521: 83 c4 10 add $0x10,%esp
524: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
527: 0f b6 5e ff movzbl -0x1(%esi),%ebx
52b: 84 db test %bl,%bl
52d: 74 71 je 5a0 <printf+0xd0>
c = fmt[i] & 0xff;
52f: 0f be cb movsbl %bl,%ecx
532: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
535: 85 d2 test %edx,%edx
537: 74 c7 je 500 <printf+0x30>
}
} else if(state == '%'){
539: 83 fa 25 cmp $0x25,%edx
53c: 75 e6 jne 524 <printf+0x54>
if(c == 'd'){
53e: 83 f8 64 cmp $0x64,%eax
541: 0f 84 99 00 00 00 je 5e0 <printf+0x110>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
547: 81 e1 f7 00 00 00 and $0xf7,%ecx
54d: 83 f9 70 cmp $0x70,%ecx
550: 74 5e je 5b0 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
552: 83 f8 73 cmp $0x73,%eax
555: 0f 84 d5 00 00 00 je 630 <printf+0x160>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
55b: 83 f8 63 cmp $0x63,%eax
55e: 0f 84 8c 00 00 00 je 5f0 <printf+0x120>
putc(fd, *ap);
ap++;
} else if(c == '%'){
564: 83 f8 25 cmp $0x25,%eax
567: 0f 84 b3 00 00 00 je 620 <printf+0x150>
write(fd, &c, 1);
56d: 83 ec 04 sub $0x4,%esp
570: c6 45 e7 25 movb $0x25,-0x19(%ebp)
574: 6a 01 push $0x1
576: 57 push %edi
577: ff 75 08 pushl 0x8(%ebp)
57a: e8 a2 fd ff ff call 321 <write>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
57f: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
582: 83 c4 0c add $0xc,%esp
585: 6a 01 push $0x1
587: 83 c6 01 add $0x1,%esi
58a: 57 push %edi
58b: ff 75 08 pushl 0x8(%ebp)
58e: e8 8e fd ff ff call 321 <write>
for(i = 0; fmt[i]; i++){
593: 0f b6 5e ff movzbl -0x1(%esi),%ebx
putc(fd, c);
597: 83 c4 10 add $0x10,%esp
}
state = 0;
59a: 31 d2 xor %edx,%edx
for(i = 0; fmt[i]; i++){
59c: 84 db test %bl,%bl
59e: 75 8f jne 52f <printf+0x5f>
}
}
}
5a0: 8d 65 f4 lea -0xc(%ebp),%esp
5a3: 5b pop %ebx
5a4: 5e pop %esi
5a5: 5f pop %edi
5a6: 5d pop %ebp
5a7: c3 ret
5a8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
5af: 90 nop
printint(fd, *ap, 16, 0);
5b0: 83 ec 0c sub $0xc,%esp
5b3: b9 10 00 00 00 mov $0x10,%ecx
5b8: 6a 00 push $0x0
5ba: 8b 5d d0 mov -0x30(%ebp),%ebx
5bd: 8b 45 08 mov 0x8(%ebp),%eax
5c0: 8b 13 mov (%ebx),%edx
5c2: e8 49 fe ff ff call 410 <printint>
ap++;
5c7: 89 d8 mov %ebx,%eax
5c9: 83 c4 10 add $0x10,%esp
state = 0;
5cc: 31 d2 xor %edx,%edx
ap++;
5ce: 83 c0 04 add $0x4,%eax
5d1: 89 45 d0 mov %eax,-0x30(%ebp)
5d4: e9 4b ff ff ff jmp 524 <printf+0x54>
5d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printint(fd, *ap, 10, 1);
5e0: 83 ec 0c sub $0xc,%esp
5e3: b9 0a 00 00 00 mov $0xa,%ecx
5e8: 6a 01 push $0x1
5ea: eb ce jmp 5ba <printf+0xea>
5ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
putc(fd, *ap);
5f0: 8b 5d d0 mov -0x30(%ebp),%ebx
write(fd, &c, 1);
5f3: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
5f6: 8b 03 mov (%ebx),%eax
write(fd, &c, 1);
5f8: 6a 01 push $0x1
ap++;
5fa: 83 c3 04 add $0x4,%ebx
write(fd, &c, 1);
5fd: 57 push %edi
5fe: ff 75 08 pushl 0x8(%ebp)
putc(fd, *ap);
601: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
604: e8 18 fd ff ff call 321 <write>
ap++;
609: 89 5d d0 mov %ebx,-0x30(%ebp)
60c: 83 c4 10 add $0x10,%esp
state = 0;
60f: 31 d2 xor %edx,%edx
611: e9 0e ff ff ff jmp 524 <printf+0x54>
616: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
61d: 8d 76 00 lea 0x0(%esi),%esi
putc(fd, c);
620: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
623: 83 ec 04 sub $0x4,%esp
626: e9 5a ff ff ff jmp 585 <printf+0xb5>
62b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
62f: 90 nop
s = (char*)*ap;
630: 8b 45 d0 mov -0x30(%ebp),%eax
633: 8b 18 mov (%eax),%ebx
ap++;
635: 83 c0 04 add $0x4,%eax
638: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
63b: 85 db test %ebx,%ebx
63d: 74 17 je 656 <printf+0x186>
while(*s != 0){
63f: 0f b6 03 movzbl (%ebx),%eax
state = 0;
642: 31 d2 xor %edx,%edx
while(*s != 0){
644: 84 c0 test %al,%al
646: 0f 84 d8 fe ff ff je 524 <printf+0x54>
64c: 89 75 d4 mov %esi,-0x2c(%ebp)
64f: 89 de mov %ebx,%esi
651: 8b 5d 08 mov 0x8(%ebp),%ebx
654: eb 1a jmp 670 <printf+0x1a0>
s = "(null)";
656: bb 38 08 00 00 mov $0x838,%ebx
while(*s != 0){
65b: 89 75 d4 mov %esi,-0x2c(%ebp)
65e: b8 28 00 00 00 mov $0x28,%eax
663: 89 de mov %ebx,%esi
665: 8b 5d 08 mov 0x8(%ebp),%ebx
668: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
66f: 90 nop
write(fd, &c, 1);
670: 83 ec 04 sub $0x4,%esp
s++;
673: 83 c6 01 add $0x1,%esi
676: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
679: 6a 01 push $0x1
67b: 57 push %edi
67c: 53 push %ebx
67d: e8 9f fc ff ff call 321 <write>
while(*s != 0){
682: 0f b6 06 movzbl (%esi),%eax
685: 83 c4 10 add $0x10,%esp
688: 84 c0 test %al,%al
68a: 75 e4 jne 670 <printf+0x1a0>
68c: 8b 75 d4 mov -0x2c(%ebp),%esi
state = 0;
68f: 31 d2 xor %edx,%edx
691: e9 8e fe ff ff jmp 524 <printf+0x54>
696: 66 90 xchg %ax,%ax
698: 66 90 xchg %ax,%ax
69a: 66 90 xchg %ax,%ax
69c: 66 90 xchg %ax,%ax
69e: 66 90 xchg %ax,%ax
000006a0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
6a0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
6a1: a1 14 0b 00 00 mov 0xb14,%eax
{
6a6: 89 e5 mov %esp,%ebp
6a8: 57 push %edi
6a9: 56 push %esi
6aa: 53 push %ebx
6ab: 8b 5d 08 mov 0x8(%ebp),%ebx
6ae: 8b 10 mov (%eax),%edx
bp = (Header*)ap - 1;
6b0: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
6b3: 39 c8 cmp %ecx,%eax
6b5: 73 19 jae 6d0 <free+0x30>
6b7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
6be: 66 90 xchg %ax,%ax
6c0: 39 d1 cmp %edx,%ecx
6c2: 72 14 jb 6d8 <free+0x38>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
6c4: 39 d0 cmp %edx,%eax
6c6: 73 10 jae 6d8 <free+0x38>
{
6c8: 89 d0 mov %edx,%eax
6ca: 8b 10 mov (%eax),%edx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
6cc: 39 c8 cmp %ecx,%eax
6ce: 72 f0 jb 6c0 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
6d0: 39 d0 cmp %edx,%eax
6d2: 72 f4 jb 6c8 <free+0x28>
6d4: 39 d1 cmp %edx,%ecx
6d6: 73 f0 jae 6c8 <free+0x28>
break;
if(bp + bp->s.size == p->s.ptr){
6d8: 8b 73 fc mov -0x4(%ebx),%esi
6db: 8d 3c f1 lea (%ecx,%esi,8),%edi
6de: 39 fa cmp %edi,%edx
6e0: 74 1e je 700 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
6e2: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
6e5: 8b 50 04 mov 0x4(%eax),%edx
6e8: 8d 34 d0 lea (%eax,%edx,8),%esi
6eb: 39 f1 cmp %esi,%ecx
6ed: 74 28 je 717 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
6ef: 89 08 mov %ecx,(%eax)
freep = p;
}
6f1: 5b pop %ebx
freep = p;
6f2: a3 14 0b 00 00 mov %eax,0xb14
}
6f7: 5e pop %esi
6f8: 5f pop %edi
6f9: 5d pop %ebp
6fa: c3 ret
6fb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
6ff: 90 nop
bp->s.size += p->s.ptr->s.size;
700: 03 72 04 add 0x4(%edx),%esi
703: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
706: 8b 10 mov (%eax),%edx
708: 8b 12 mov (%edx),%edx
70a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
70d: 8b 50 04 mov 0x4(%eax),%edx
710: 8d 34 d0 lea (%eax,%edx,8),%esi
713: 39 f1 cmp %esi,%ecx
715: 75 d8 jne 6ef <free+0x4f>
p->s.size += bp->s.size;
717: 03 53 fc add -0x4(%ebx),%edx
freep = p;
71a: a3 14 0b 00 00 mov %eax,0xb14
p->s.size += bp->s.size;
71f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
722: 8b 53 f8 mov -0x8(%ebx),%edx
725: 89 10 mov %edx,(%eax)
}
727: 5b pop %ebx
728: 5e pop %esi
729: 5f pop %edi
72a: 5d pop %ebp
72b: c3 ret
72c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000730 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
730: 55 push %ebp
731: 89 e5 mov %esp,%ebp
733: 57 push %edi
734: 56 push %esi
735: 53 push %ebx
736: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
739: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
73c: 8b 3d 14 0b 00 00 mov 0xb14,%edi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
742: 8d 70 07 lea 0x7(%eax),%esi
745: c1 ee 03 shr $0x3,%esi
748: 83 c6 01 add $0x1,%esi
if((prevp = freep) == 0){
74b: 85 ff test %edi,%edi
74d: 0f 84 ad 00 00 00 je 800 <malloc+0xd0>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
753: 8b 17 mov (%edi),%edx
if(p->s.size >= nunits){
755: 8b 4a 04 mov 0x4(%edx),%ecx
758: 39 f1 cmp %esi,%ecx
75a: 73 72 jae 7ce <malloc+0x9e>
75c: 81 fe 00 10 00 00 cmp $0x1000,%esi
762: bb 00 10 00 00 mov $0x1000,%ebx
767: 0f 43 de cmovae %esi,%ebx
p = sbrk(nu * sizeof(Header));
76a: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax
771: 89 45 e4 mov %eax,-0x1c(%ebp)
774: eb 1b jmp 791 <malloc+0x61>
776: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
77d: 8d 76 00 lea 0x0(%esi),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
780: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
782: 8b 48 04 mov 0x4(%eax),%ecx
785: 39 f1 cmp %esi,%ecx
787: 73 4f jae 7d8 <malloc+0xa8>
789: 8b 3d 14 0b 00 00 mov 0xb14,%edi
78f: 89 c2 mov %eax,%edx
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
791: 39 d7 cmp %edx,%edi
793: 75 eb jne 780 <malloc+0x50>
p = sbrk(nu * sizeof(Header));
795: 83 ec 0c sub $0xc,%esp
798: ff 75 e4 pushl -0x1c(%ebp)
79b: e8 e9 fb ff ff call 389 <sbrk>
if(p == (char*)-1)
7a0: 83 c4 10 add $0x10,%esp
7a3: 83 f8 ff cmp $0xffffffff,%eax
7a6: 74 1c je 7c4 <malloc+0x94>
hp->s.size = nu;
7a8: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
7ab: 83 ec 0c sub $0xc,%esp
7ae: 83 c0 08 add $0x8,%eax
7b1: 50 push %eax
7b2: e8 e9 fe ff ff call 6a0 <free>
return freep;
7b7: 8b 15 14 0b 00 00 mov 0xb14,%edx
if((p = morecore(nunits)) == 0)
7bd: 83 c4 10 add $0x10,%esp
7c0: 85 d2 test %edx,%edx
7c2: 75 bc jne 780 <malloc+0x50>
return 0;
}
}
7c4: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
7c7: 31 c0 xor %eax,%eax
}
7c9: 5b pop %ebx
7ca: 5e pop %esi
7cb: 5f pop %edi
7cc: 5d pop %ebp
7cd: c3 ret
if(p->s.size >= nunits){
7ce: 89 d0 mov %edx,%eax
7d0: 89 fa mov %edi,%edx
7d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
7d8: 39 ce cmp %ecx,%esi
7da: 74 54 je 830 <malloc+0x100>
p->s.size -= nunits;
7dc: 29 f1 sub %esi,%ecx
7de: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
7e1: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
7e4: 89 70 04 mov %esi,0x4(%eax)
freep = prevp;
7e7: 89 15 14 0b 00 00 mov %edx,0xb14
}
7ed: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
7f0: 83 c0 08 add $0x8,%eax
}
7f3: 5b pop %ebx
7f4: 5e pop %esi
7f5: 5f pop %edi
7f6: 5d pop %ebp
7f7: c3 ret
7f8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
7ff: 90 nop
base.s.ptr = freep = prevp = &base;
800: c7 05 14 0b 00 00 18 movl $0xb18,0xb14
807: 0b 00 00
base.s.size = 0;
80a: bf 18 0b 00 00 mov $0xb18,%edi
base.s.ptr = freep = prevp = &base;
80f: c7 05 18 0b 00 00 18 movl $0xb18,0xb18
816: 0b 00 00
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
819: 89 fa mov %edi,%edx
base.s.size = 0;
81b: c7 05 1c 0b 00 00 00 movl $0x0,0xb1c
822: 00 00 00
if(p->s.size >= nunits){
825: e9 32 ff ff ff jmp 75c <malloc+0x2c>
82a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
prevp->s.ptr = p->s.ptr;
830: 8b 08 mov (%eax),%ecx
832: 89 0a mov %ecx,(%edx)
834: eb b1 jmp 7e7 <malloc+0xb7>
|
oeis/079/A079861.asm | neoneye/loda-programs | 11 | 163551 | ; A079861: a(n) is the number of occurrences of 7's in the palindromic compositions of 2*n-1, or also, the number of occurrences of 8's in the palindromic compositions of 2*n.
; 10,22,48,104,224,480,1024,2176,4608,9728,20480,43008,90112,188416,393216,819200,1703936,3538944,7340032,15204352,31457280,65011712,134217728,276824064,570425344,1174405120,2415919104,4966055936,10200547328,20937965568,42949672960,88046829568,180388626432,369367187456,755914244096,1546188226560,3161095929856,6459630813184,13194139533312,26938034880512,54975581388800,112150186033152,228698418577408,466192930177024,949978046398464,1935140464885760,3940649673949184,8022036836253696
mov $1,2
pow $1,$0
add $0,10
mul $1,$0
mov $0,$1
|
IV Semester/Microprocessor_Lab/6B_8x3_Keypad/6B.asm | ckraju/CSE-Lab-Manual | 2 | 165846 | <filename>IV Semester/Microprocessor_Lab/6B_8x3_Keypad/6B.asm
.MODEL SMALL
.DATA
KEYS DB '<KEY>'
M1 DB 10,13,'Row: $'
M2 DB 10,13,'Column: $'
M3 DB 10,13,'Value: $'
ROW DB ?
COL DB ?
PA EQU 0D800H
PB EQU 0D801H
PC EQU 0D802H
CW EQU 0D803H
.CODE
MOV AX,@DATA
MOV DS,AX
MOV DX,CW
MOV AL,90H ;port A is input
OUT DX,AL
READ:
MOV DX,PC ;trigger port C for row 1
MOV AL,01H
OUT DX,AL
MOV DX,PA ;read input from port A
IN AL,DX
CMP AL,00H
JNZ FR
MOV DX,PC ;trigger port C for row 2
MOV AL,02H
OUT DX,AL
MOV DX,PA ;read input from port A
IN AL,DX
CMP AL,00H
JNZ SR
MOV DX,PC ;trigger port C for row 3
MOV AL,04H
OUT DX,AL
MOV DX,PA ;read input from port A
IN AL,DX
CMP AL,00H
JNZ TR
JMP READ
FR: ;First row
MOV ROW,31H
MOV COL,31H
LEA SI,KEYS
L1:
SHR AL,01H ;shift right until you get column
JC DISPLAY
INC COL
INC SI
JMP L1
SR: ;Second row
MOV ROW,32H
MOV COL,31H
LEA SI,KEYS+8D
L2:
SHR AL,01H ;shift right until you get column
JC DISPLAY
INC COL
INC SI
JMP L2
TR: ;Third row
MOV ROW,33H
MOV COL,31H
LEA SI,KEYS+16D
L3:
SHR AL,01H ;shift right until you get column
JC DISPLAY
INC COL
INC SI
JMP L3
DISPLAY:
LEA DX,M3 ;display value
MOV AH,09H
INT 21H
MOV DL,[SI] ;extract character
MOV AH,02H
INT 21H
LEA DX,M1 ;display row
MOV AH,09H
INT 21H
MOV DL,ROW
MOV AH,02H
INT 21H
LEA DX,M2 ;display column
MOV AH,09H
INT 21H
MOV DL,COL
MOV AH,02H
INT 21H
MOV AH,4CH
INT 21H
END
|
programs/oeis/121/A121892.asm | neoneye/loda | 22 | 84551 | ; A121892: Row sums of triangle in A066094.
; 1,2,4,24,192,1920,23040,322560,5160960,92897280,1857945600,40874803200,980995276800
mul $0,2
mov $1,1
lpb $0
sub $2,$1
mul $1,$0
sub $0,2
gcd $2,$0
lpe
mov $0,$2
add $0,1
|
src/main/java/grammar/Lynx.g4 | Michlww222/LynxTranslator | 0 | 1152 | grammar Lynx; // Define a grammar called Hello
// PARSER
program
: line+ endFileArg
;
line
: brakeArg? (spaceArg? cmd spaceArg?)+ brakeArg?
;
cmd:
repeat
| procedure
| procedureCall
| forward
| back
| left
| right
| setheading
| setx
| sety
| setpos
| distance
| towards
| heading
| home
| pos
| xcor
| ycor
//variables cmd
| clearname
| namex
| thing
| clearnames
| names
| let
| make
//logic cmd
| ifc
| ifelse
//draw cmd
| bg
| cg
| clean
| color
| colorrunder
| fill
| freezebg
| namefromcolor
| pd
| pe
| pensize
| pu
| setbg
| setcolor
| setpensize
| stamp
| unfreezebg
;
// math statements
mathStatement:
mathSentence;
mathSentence:
('(' brakeArg? mathSentence brakeArg?')') # brakets
| mathSentence brakeArg? doubleArgMathOperator brakeArg? mathSentence # doubleArgs
| singleArgMathOperator brakeArg? mathSentence # singleArgs
| mathValue # value;
mathValue:
FLOATNUMBER
| NATURALNUMBER
| BOOLEAN
| variableName;
singleArgMathOperator:
ABS # abs
| ARCTAN # arctan
| COS # cos
| INT # int1
| LN # ln
| MINUS # minusSingle
| RANDOM # random
| ROUND # round
| SIN # sin
| SQRT # sqrt
| TAN # tan
| NOT # not
;
doubleArgMathOperator:
DIFFERENCE # difference
| POWER # power
| QUOTIENT # quotient
| REMAINDER # remainder
| SUM # sum
| MINUS # minus
| PRODUCT #product
| DIVISION # division
| COMPARISON # comparison
| EXP # exp
| LOG # log
| OR # or
| AND # and
;
stringArg:
OTHERWORD
;
//arguments
variableName:
':' OTHERWORD;
procedure:
PROCEDURE brakeArg stringArg brakeArg (variableName brakeArg)* '['brakeArg? line+ brakeArg?']'
;
procedureCall:
CALL brakeArg stringArg (brakeArg mathStatement)* brakeArg?;
//operation commands
repeat:
REPEAT brakeArg mathStatement brakeArg '[' line']' ;
//number commands
back:
BACK brakeArg mathStatement
;
forward:
FORWARD brakeArg mathStatement
;
left:
LEFT brakeArg mathStatement
;
right:
RIGHT brakeArg mathStatement
;
setheading:
SETHEADING brakeArg mathStatement
;
setx:
SETX brakeArg mathStatement
;
sety:
SETY brakeArg mathStatement
;
namefromcolor:
NAMEFROMCOLOUR brakeArg mathStatement
;
setcolor:
SETCOLOR brakeArg mathStatement
;
setpensize:
SETPENSIZE brakeArg mathStatement
;
setbg:
SETBG brakeArg mathStatement
;
//bracket commands
setpos:
SETPOS brakeArg '[' brakeArg mathStatement brakeArg ',' brakeArg mathStatement brakeArg']'
;
//word commands
distance:
DISTANCE brakeArg '\''stringArg'\''
;
towards:
TOWARDS brakeArg '\''stringArg'\''
;
clearname:
CLEARNAME brakeArg '\''stringArg'\''
;
namex:
NAMEX brakeArg '\''stringArg'\''
;
thing:
THING brakeArg '\''stringArg'\''
;
ifc:
IF brakeArg mathStatement brakeArg '[' brakeArg? line brakeArg? ']'
;
ifelse:
IFELSE brakeArg mathStatement brakeArg '[' brakeArg? line brakeArg? ']' brakeArg '[' brakeArg? line brakeArg? ']'
;
//just commands
heading:
HEADING
;
home:
HOME
;
pos:
POS
;
xcor:
XCOR
;
ycor:
YCOR
;
clearnames:
CLEARNAMES
;
names:
NAMES
;
bg:
BG
;
cg:
CG
;
clean:
CLEAN
;
color:
COLOR
;
colorrunder:
COLORUNDER
;
fill:
FILL
;
freezebg:
FREEZEBG
;
pd:
PD
;
pe:
PE
;
pensize:
PENSIZE
;
pu:
PU
;
stamp:
STAMP
;
unfreezebg:
UNFREEZEBG
;
//list commands
let:
LET brakeArg variableName brakeArg mathStatement brakeArg?
;
//word list commands
make:
MAKE brakeArg '\''stringArg'\'' brakeArg (WORD|list)
;
spaceArg:
(WHITESPACE)+
;
newLineArg:
NEWLINE+
;
brakeArg:
(spaceArg | newLineArg)+
;
naturalNumberArg:
NATURALNUMBER | variableName
;
list:
'[' (brakeArg? mathStatement)+ brakeArg? ']'
;
endFileArg:
EOF
;
//LEXER
//ALL LETERS
fragment LOWERCASE:
[a-z]
;
fragment UPPERCASE:
[A-Z]
;
//Digit fragment
fragment DIGIT:
[0-9]
;
//COMMANDS MOVING xx1xx DONE
BACK:
'BACK'
|'back'
|'BK'
|'bk'
;
DISTANCE:
'DISTANCE'
| 'distance'
;
FORWARD:
'FORWARD'
| 'FD'
| 'forward'
| 'fd'
;
HEADING:
'HEADING'
|'heading'
;
HOME:
'HOME'
| 'home'
;
LEFT:
'LEFT'
| 'left'
| 'LT'
| 'lt'
;
POS:
'POS'
| 'pos'
;
RIGHT:
'RIGHT'
| 'RT'
| 'right'
| 'rt'
;
SETHEADING:
'SETHEADING'
| 'setheading'
| 'SETH'
| 'seth'
;
SETPOS:
'SETPOS'
| 'setpos'
;
SETX:
'SETX'
| 'setx'
;
SETY:
'SETY'
| 'sety'
;
TOWARDS:
'TOWARDS'
| 'towards'
;
XCOR:
'XCOR'
| 'xcor'
;
YCOR:
'YCOR'
| 'ycor'
;
//COMMANDS DRAVING xx2xx TODO
BG:
'BG'
| 'bg'
;
CG:
'CG'
| 'cg'
;
CLEAN:
'CLEAN'
| 'clean'
;
COLOR:
'COLOR'
| 'color'
;
COLORUNDER:
'COLORUNDER'
| 'colorunder'
;
FILL:
'FILL'
| 'fill'
;
FREEZEBG:
'FREEZEBG'
| 'freezebg'
;
NAMEFROMCOLOUR:
'NAMEFROMCOLOR'
| 'namefromcolor'
;
PD:
'PD'
| 'pd'
;
PE:
'PE'
| 'pe'
;
PENSIZE:
'PENSIZE'
| 'pensize'
;
PU:
'PU'
| 'pu'
;
SETBG:
'SETBG'
| 'setbg'
;
SETCOLOR:
'SETCOLOR'
| 'setcolor'
| 'SETC'
| 'setc'
;
SETPENSIZE:
'SETPENSIZE'
| 'setpensize'
;
STAMP:
'STAMP'
| 'stamp'
;
UNFREEZEBG:
'UNFREEZEBG'
| 'unfreezebg'
;
//commands turtle state xx3xx TODO
HT:
'HT'
| 'ht'
;
INBACK:
'INBACK'
| 'inback'
;
INFRONT:
'INFRONT'
| 'infront'
;
OPACITY:
'OPACITY'
| 'opacity'
;
SETOPACITY:
'SETOPACITY'
| 'setopacity'
;
SETSHAPE:
'SETSHAPE'
| 'setshape'
;
SETSIZE:
'SETSIZE'
| 'setsize'
;
SHAPE:
'SHAPE'
| 'shape'
;
SIZE:
'SIZE'
| 'size'
;
ST:
'ST'
| 'st'
;
//commands turtle (other) xx4xx TODO
CLICKOFF:
'CLICKOFF'
| 'clickoff'
;
CLICKON:
'CLICKON'
| 'clickon'
;
CLONE:
'CLONE'
| 'clone'
;
TELL:
'TELL'
| 'tell'
;
TOUCHINGX:
'TOUCHING?'
| 'toughing?'
;
WHO:
'WHO'
| 'who'
;
//commands text xx5xx TODO
ANNOUNCE:
'ANNOUNCE'
| 'announce'
;
ASCII:
'ASCII'
| 'ascii'
;
BOTTOM:
'BOTTOM'
| 'bottom'
;
CB:
'CB'
| 'cb'
;
CC:
'CC'
| 'cc'
;
CD:
'CD'
| 'cd'
;
CF:
'CF'
| 'cf'
;
CHAR:
'CHAR'
| 'char'
;
CLEARTEXT:
'CLEARTEXT'
| 'cleartext'
| 'CT'
| 'ct'
;
CU:
'CU'
| 'cu'
;
DELETE:
'DELETE'
| 'delate'
;
EOL:
'EOL'
| 'eol'
;
EOT:
'EOT?'
| 'eot?'
;
HIDETEXT:
'HIDETEXT'
| 'hidetext'
;
INSERT:
'INSERT'
| 'insert'
;
PRINT:
'PRINT'
| 'print'
| 'PR'
| 'pr'
;
SELECT:
'SELECT'
| 'select'
;
SELECTED:
'SELECTED'
| 'selected'
;
SHOW:
'SHOW'
| 'show'
;
SHOWTEXT:
'SHOWTEXT'
| 'showtext'
;
SOL:
'SOL'
| 'sol'
;
TEXTCOUNT:
'TEXTCOUNT'
| 'textcount'
;
TEXTITEM:
'TEXTITEM'
| 'textitem'
;
TEXTPICK:
'TEXTPICK'
| 'textpick'
;
TEXTWHO:
'TEXTWHO'
| 'textwho'
;
TOP:
'TOP'
| 'top'
;
TRANSPARENT:
'TRANSPARENT'
| 'transparent'
;
UNSELECT:
'UNSELECT'
| 'unselect'
;
//commands words and lists xx5xx TODO
BUTFIRST:
'BUTFIRST'
| 'butfirst'
| 'BT'
| 'bt'
;
BUTLAST:
'BUTLAST'
| 'butlast'
| 'BL'
| 'bl'
;
COUNT:
'COUNT'
| 'count'
;
EMPTY:
'EMPTY?'
| 'empty?'
;
EQUALX:
'EQUAL?'
| 'equal?'
;
FIRST:
'FIRST'
| 'first'
;
FPUT:
'FPUT'
| 'eput'
;
IDENTICALX:
'IDENTICAL?'
| 'identical?'
;
ITEM:
'ITEM'
| 'item'
;
LAST:
'LAST'
| 'last'
;
LIST:
'LIST'
| 'list'
;
LISTX:
'LIST?'
| 'list?'
;
LPUT:
'LPUT'
| 'lput'
;
MEMBERX:
'MEMBER?'
| 'member?'
;
NUMBER:
'NUMBER?'
| 'number?'
;
PARSE:
'PARSE'
| 'parse'
;
PICK:
'PICK'
| 'pick'
;
SENTENCE:
'SENTENCE'
| 'sentence'
| 'SE'
| 'se'
;
WORD:
'WORD'
| 'word'
;
WORDX:
'WORD?'
| 'word?'
;
//commands number and maths xx6xx DONE
ABS:
'ABS'
| 'abs'
;
ARCTAN:
'ARCTAN'
| 'arctan'
;
COS:
'COS'
| 'cos'
;
DIFFERENCE:
'!='
;
EXP:
'EXP'
| 'exp'
;
INT:
'INT'
| 'int'
;
LN:
'LN'
| 'ln'
;
LOG:
'LOG'
| 'log'
;
MINUS:
'-'
;
PI:
'PI'
| 'pi'
;
POWER:
'POW'
| 'pow'
;
PRODUCT:
'*'
;
QUOTIENT:
'QUOTIENT'
| 'quotient'
;
RANDOM:
'RANDOM'
| 'random'
;
REMAINDER:
'REMAINDER'
| 'remainder'
;
ROUND:
'ROUND'
| 'round'
;
SIN:
'SIN'
| 'sin'
;
SQRT:
'SQRT'
| 'sqrt'
;
SUM:
'+'
;
TAN:
'TAN'
| 'tan'
;
COMPARISON:
'=='
| '<='
| '>='
| '=<'
| '=>'
| '<'
| '>'
;
//commands Objects xx7xx TODO
ASK:
'ASK'
| 'ask'
;
FREEZE:
'FREEZE'
| 'freeze'
;
GET:
'GET'
| 'get'
;
NEWPAGE:
'NEWPAGE'
| 'newpage'
;
NEWSLIDER:
'NEWSLIDER'
| 'newslider'
;
NEWTEXT:
'NEWTEXT'
| 'newtext'
;
NEWTURTLE:
'NEWTURTLE'
| 'newturtle'
;
REMOVE:
'REMOVE'
| 'remove'
;
RENAME:
'RENAME'
| 'rename'
;
SET:
'SET'
| 'set'
;
TALKTO:
'TALKTO'
| 'talkto'
;
UNFREEZE:
'UNFREEZE'
| 'unfreeze'
;
//commands Timer xx8xx TODO
RESETT:
'RESETT'
| 'restt'
;
TIMER:
'TIMER'
| 'timer'
;
//commands Variables xx9xx DONE
CLEARNAME:
'CLEARNAME'
| 'clearname'
;
CLEARNAMES:
'CLEARNAMES'
| 'clearnames'
;
LET:
'LET'
| 'let'
;
MAKE:
'MAKE'
| 'make'
;
NAMEX:
'NAME?'
| 'name?'
;
NAMES:
'NAMES'
| 'names'
;
THING:
'THING'
| 'thing'
;
//commands Pages and project xx10xx
GETPAGE:
'GETPAGE'
| 'getpage'
;
NAMEPAGE:
'NAMEPAGE'
| 'namepage'
;
NEXTPAGE:
'NEXTPAGE'
| 'nextpage'
;
PAGELIST:
'PAGELIST'
| 'pagelist'
;
PREVPAGE:
'PREVPAGE'
| 'prevpage'
;
PROJECTSIZE:
'PROJECTSIZE'
| 'projectsize'
;
//commands logic xxx11xx DONE
AND:
'AND'
| 'and'
| '&&'
;
IF:
'IF'
| 'if'
;
IFELSE:
'IFELSE'
| 'ifelse'
;
NOT:
'NOT'
|'not'
| '!'
;
OR:
'OR'
| 'or'
| '||'
;
//commands interaction xxx12xx
ANSWER:
'ANSWER'
| 'answer'
;
KEYX:
'KEY?'
| 'key?'
;
MOUSEPOS:
'MOUSEPOS'
| 'mousepos'
;
PEEKCHAR:
'PEEKCHAR'
| 'peekchar'
;
QUESTION:
'QUESTION'
| 'question'
;
READCHAR:
'READCHAR'
| 'readchar'
;
SAY:
'SAY'
| 'say'
;
SAYAS:
'SAYAS'
| 'says'
;
SKIPCHAR:
'SKIPCHAR'
| 'skipchar'
;
VOICES:
'VOICES'
| 'voices'
;
//commands Control and events xxx13xx
BROADCAST:
'BROADCAST'
| 'broadcast'
;
CANCEL:
'CANCEL'
| 'cancel'
;
CAREFULLY:
'CAREFULLY'
| 'carefully'
;
DOLIST:
'DOLIST'
| 'dolist'
;
DOTIMES:
'DOTIMES'
| 'dotimes'
;
ERRORMESSAGE:
'ERRORMESSAGE'
| 'errormessage'
;
EVERYONE:
'EVERYONE'
| 'everyone'
;
FOREVER:
'FOREVER'
| 'forever'
;
LAUNCH:
'LAUNCH'
| 'launch'
;
OUTPUT:
'OUTPUT'
| 'output'
;
REPEAT:
'REPEAT'
| 'repeat'
;
RUN:
'RUN'
| 'run'
;
STOP:
'STOP'
| 'stop'
;
STOPALL: 'STOPALL' | 'stopall';
STOPME:
'STOPME'
| 'stopme'
;
WAIT:
'WAIT'
| 'wait'
;
PROCEDURE:
'PROCEDURE'
| 'procedure'
| 'PRD'
| 'prd'
;
CALL :
'CALL'
| 'call';
DIVISION:
'/'
;
NATURALNUMBER:
DIGIT+;
FLOATNUMBER:
DIGIT+ ([.,] DIGIT+)?;
BOOLEAN:
'true'
| 'True'
| 'false'
| 'False';
//ADDITIONS
OTHERWORD:
(LOWERCASE | UPPERCASE |'_')+
;
WHITESPACE:
' '
| '\t'
;
NEWLINE:
'\r'? '\n'
| '\r'; |
sdk-6.5.16/tools/led/example/testasm.asm | copslock/broadcom_cpri | 0 | 163880 | <reponame>copslock/broadcom_cpri
;
;
; This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
;
; Copyright 2007-2019 Broadcom Inc. All rights reserved.
;
;
; this contains one specimen from each of the opcodes.
; any byte that needs a second byte will use a value equal to the opcode.
ld a,a ; 0x00
ld a,b ; 0x01
ld a,0x02 ; 0x02
; 0x03
ld a,(a) ; 0x04
ld a,(b) ; 0x05
ld a,(6) ; 0x06
clc ; 0x07
tst a,a ; 0x08
tst a,b ; 0x09
tst a,0x0A ; 0x0A
bit a,a ; 0x0C
bit a,b ; 0x0D
bit a,14 ; 0x0E
; 0x0F
ld b,a ; 0x10
ld b,b ; 0x11
ld b,0x12 ; 0x12
; 0x13
ld b,(a) ; 0x14
ld b,(b) ; 0x15
ld b,(22) ; 0x16
stc ; 0x17
tst b,a ; 0x18
tst b,b ; 0x19
tst b,0x1A ; 0x1A
bit b,a ; 0x1C
bit b,b ; 0x1D
bit b,30 ; 0x1E
; 0x1F
push a ; 0x20
push b ; 0x21
push 0x22 ; 0x22
; 0x23
push (a) ; 0x24
push (b) ; 0x25
push (38) ; 0x26
push cy ; 0x27
port a ; 0x28
port b ; 0x29
port 0x2A ; 0x2A
; 0x2B
port (a) ; 0x2C
port (b) ; 0x2D
port (46) ; 0x2E
; 0x2F
pushst a ; 0x30
pushst b ; 0x31
pushst 0x32 ; 0x32
; 0x33
; 0x34
; 0x35
; 0x36
cmc ; 0x37
send a ; 0x38
send b ; 0x39
send 0x3A ; 0x3A
; 0x3B
send (a) ; 0x3C
send (b) ; 0x3D
send (076) ; 0x3E
; 0x3F
ld (a),a ; 0x40
ld (a),b ; 0x41
ld (a),0x42 ; 0x42
; 0x43
ld (a),(a) ; 0x44
ld (a),(b) ; 0x45
ld (a),(70) ; 0x46
; 0x47
tst (a),a ; 0x48
tst (a),b ; 0x49
tst (a),0x4A ; 0x4A
; 0x4B
bit (a),a ; 0x4C
bit (a),b ; 0x4D
bit (a),78 ; 0x4E
; 0x4F
ld (b),a ; 0x50
ld (b),b ; 0x51
ld (b),0x52 ; 0x52
; 0x53
ld (b),(a) ; 0x54
ld (b),(b) ; 0x55
ld (b),(86) ; 0x56
ret ; 0x57
tst (b),a ; 0x58
tst (b),b ; 0x59
tst (b),0x5A ; 0x5A
; 0x5B
bit (b),a ; 0x5C
bit (b),b ; 0x5D
bit (b),94 ; 0x5E
; 0x5F
ld (0x60),a ; 0x60
ld (0x61),b ; 0x61
; ld (0x62),0x62 ; 0x62 -- 3 bytes!
; 0x63
ld (0x64),(a) ; 0x64
ld (0x65),(b) ; 0x65
; ld (0x66),(70) ; 0x66 -- 3 bytes!
call 0x67 ; 0x67
tst (0x68),a ; 0x68
tst (0x69),b ; 0x69
; tst (0x6A),0x4A ; 0x6A -- 3 bytes!
; 0x6B
bit (0x6C),a ; 0x6C
bit (0x6D),b ; 0x6D
; bit (0x6E),78 ; 0x6E -- 3 bytes!
; 0x6F
jz 0x70 ; 0x70
jc 0x71 ; 0x71
jt 0x72 ; 0x72
; 0x73
jnz 0x74 ; 0x74
jnc 0x75 ; 0x75
jnt 0x76 ; 0x76
jmp 0x77 ; 0x77
; 0x77
; 0x78
; 0x79
; 0x7A
; 0x7B
; 0x7C
; 0x7D
; 0x7E
; 0x7F
inc a ; 0x80
inc b ; 0x81
; 0x82
; 0x83
inc (a) ; 0x84
inc (b) ; 0x85
inc (0x86) ; 0x86
pack ; 0x87
rol a ; 0x88
rol b ; 0x89
; 0x8A
; 0x8B
rol (a) ; 0x8C
rol (b) ; 0x8D
rol (0x8E) ; 0x8E
; 0x8F
dec a ; 0x90
dec b ; 0x91
; 0x92
; 0x93
dec (a) ; 0x94
dec (b) ; 0x95
dec (0x96) ; 0x96
pop ; 0x97
ror a ; 0x98
ror b ; 0x99
; 0x9A
; 0x9B
ror (a) ; 0x9C
ror (b) ; 0x9D
ror (0x9E) ; 0x9E
; 0x9F
xor a,a ; 0xA0
xor a,b ; 0xA1
xor a,0xA2 ; 0xA2
; 0xA3
xor a,(a) ; 0xA4
xor a,(b) ; 0xA5
xor a,(0xA6) ; 0xA6
txor ; 0xA7
xor b,a ; 0xA8
xor b,b ; 0xA9
xor b,0xAA ; 0xAA
; 0xAB
xor b,(a) ; 0xAC
xor b,(b) ; 0xAD
xor b,(0xAE) ; 0xAE
; 0xAF
or a,a ; 0xB0
or a,b ; 0xB1
or a,0xB2 ; 0xB2
; 0xB3
or a,(a) ; 0xB4
or a,(b) ; 0xB5
or a,(0xB6) ; 0xB6
tor ; 0xB7
or b,a ; 0xB8
or b,b ; 0xB9
or b,0xBA ; 0xBA
; 0xBB
or b,(a) ; 0xBC
or b,(b) ; 0xBD
or b,(0xBE) ; 0xBE
; 0xBF
and a,a ; 0xC0
and a,b ; 0xC1
and a,0xC2 ; 0xC2
; 0xC3
and a,(a) ; 0xC4
and a,(b) ; 0xC5
and a,(0xC6) ; 0xC6
tand ; 0xC7
and b,a ; 0xC8
and b,b ; 0xC9
and b,0xCA ; 0xCA
; 0xCB
and b,(a) ; 0xCC
and b,(b) ; 0xCD
and b,(0xCE) ; 0xCE
; 0xCF
cmp a,a ; 0xD0
cmp a,b ; 0xD1
cmp a,0xD2 ; 0xD2
; 0xD3
cmp a,(a) ; 0xD4
cmp a,(b) ; 0xD5
cmp a,(0xD6) ; 0xD6
tinv ; 0xD7
cmp b,a ; 0xD8
cmp b,b ; 0xD9
cmp b,0xDA ; 0xDA
; 0xDB
cmp b,(a) ; 0xDC
cmp b,(b) ; 0xDD
cmp b,(0xDE) ; 0xDE
; 0xDF
sub a,a ; 0xE0
sub a,b ; 0xE1
sub a,0xE2 ; 0xE2
; 0xE3
sub a,(a) ; 0xE4
sub a,(b) ; 0xE5
sub a,(0xE6) ; 0xE6
; 0xE7
sub b,a ; 0xE8
sub b,b ; 0xE9
sub b,0xEA ; 0xEA
; 0xEB
sub b,(a) ; 0xEC
sub b,(b) ; 0xED
sub b,(0xEE) ; 0xEE
; 0xEF
add a,a ; 0xF0
add a,b ; 0xF1
add a,0xF2 ; 0xF2
; 0xF3
add a,(a) ; 0xF4
add a,(b) ; 0xF5
add a,(0xF6) ; 0xF6
; 0xF7
add b,a ; 0xF8
add b,b ; 0xF9
add b,0xFA ; 0xFA
; 0xFB
add b,(a) ; 0xFC
add b,(b) ; 0xFD
add b,(0xFE) ; 0xFE
; 0xFF
|
alloy/tp7/animals.als | motapinto/feup-mfes | 0 | 2518 | <filename>alloy/tp7/animals.als
sig Animals{
animalSpecies: one Species, //1. Every animal is of a single species.
animalHabitat: lone Habitats, //2. An animal of the Zoo may be, at most, in a single habitat.
coExist: set Animals
}
fact{
animalHabitat in Animals some->Habitats //3. Each habitat has at least one animal.
{all h:Habitats | #animalHabitat.h =< 7} //4. Each habitat has at most 100 animals.
{all h:Habitats | all a1,a2:animalHabitat.h | a2 in a1.coExist} //5. Each habitat may contain only animals that may coexist.
}
sig Species{}
some sig Habitats{
veterinariesHabitat: set Veterinaries,
coordinatorHabitat: one veterinariesHabitat //7. Each habitat of the Zoo has a single coordinator.
}
//10. The coordinator of an habitat is a veterinary of that habitat.
fact{
coordinatorHabitat in Habitats lone-> Veterinaries //8. Each veterinary can be at most coordinator of a single habitat.
all v:Veterinaries | #veterinariesHabitat.v =<2 //12. Each veterinary is associated with at most 2 habitats.
}
sig Veterinaries{
knowsCure: some Species //6. Each veterinary knows how to cure at least one species of animals.
}
fact{
knowsCure in Veterinaries some-> Species //9. All species in the zoo have a veterinary that knows how to heal them.
all h:Habitats |
all v:h.veterinariesHabitat |
(animalHabitat.h).animalSpecies in v.knowsCure //11. The veterinaries associated with each habitat know how to heal all the species of the habitat.
}
run {}
|
testc/cdrom/repeat.asm | krismuad/TOWNSEMU | 124 | 10172 | <reponame>krismuad/TOWNSEMU
ASSUME CS:CODE,DS:DATA
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CODE SEGMENT
MAIN PROC
MOV AX,00C0H
XOR CX,CX
MOV DL,4
INT 93H
MOV AX,DATA
MOV DS,AX
MOV AX,54C0H ; Get TOC
XOR CX,CX
LEA DI,[TOC_BUF]
INT 93H
CMP AH,AH
JNE EXIT
LEA DI,[TOC_BUF+6]
MOV CL,1
FIND_FIRST_LOOP: CMP CL,BYTE PTR [TOC_BUF+2]
JG EXIT
TEST BYTE PTR [DI],80H
JE FIRST_AUDIO_TRACK
LEA DI,[DI+3]
INC CL
JMP FIND_FIRST_LOOP
FIRST_AUDIO_TRACK:
MOV AX,[DI]
MOV CL,[DI+2]
MOV WORD PTR [CMD_BUF],AX
MOV [CMD_BUF+2],CL
ADD AH,5
CMP AH,60
JL MINUTES_ADJUSTED
SUB AH,60
INC AL
MINUTES_ADJUSTED: MOV WORD PTR [CMD_BUF+3],AX
MOV [CMD_BUF+5],CL
MOV AX, 50C0H ; CDDA Play
MOV CX,0FF01H ; With repeat
LEA DI,[CMD_BUF]
INT 93H
MOV AH,01H
INT 21H
EXIT:
MOV AH,4CH
INT 21H
MAIN ENDP
CODE ENDS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DATA SEGMENT
CMD_BUF DB 256 dup (0)
TOC_BUF DB 4096 dup (0)
DATA ENDS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
END MAIN
|
source/league/regexp/matreshka-internals-regexps-compiler.ads | svn2github/matreshka | 24 | 4242 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package Matreshka.Internals.Regexps.Compiler is
pragma Preelaborate;
type YY_Errors is
(No_Error,
Unexpected_End_Of_Literal,
Unexpected_End_Of_Character_Class,
Unexpected_Character_in_Multiplicity_Specifier,
Unexpected_End_Of_Multiplicity_Specifier,
Unexpected_End_Of_Property_Specification,
Unrecognized_Character_In_Property_Specification,
Unescaped_Pattern_Syntax_Character,
Expression_Syntax_Error);
type YY_Error_Information is record
Error : YY_Errors;
Index : Natural;
end record;
type Property_Specification_Keyword is
(ASCII_Hex_Digit, -- Names of binary properties
Alphabetic,
Bidi_Control,
-- Bidi_Mirrored,
Cased,
Case_Ignorable,
Changes_When_Casefolded,
Changes_When_Casemapped,
Changes_When_NFKC_Casefolded,
Changes_When_Lowercased,
Changes_When_Titlecased,
Changes_When_Uppercased,
Composition_Exclusion,
Full_Composition_Exclusion,
Dash,
Deprecated,
Default_Ignorable_Code_Point,
Diacritic,
Extender,
Grapheme_Base,
Grapheme_Extend,
Grapheme_Link,
Hex_Digit,
Hyphen,
ID_Continue,
Ideographic,
ID_Start,
IDS_Binary_Operator,
IDS_Trinary_Operator,
Join_Control,
Logical_Order_Exception,
Lowercase,
Math,
Noncharacter_Code_Point,
Other_Alphabetic,
Other_Default_Ignorable_Code_Point,
Other_Grapheme_Extend,
Other_ID_Continue,
Other_ID_Start,
Other_Lowercase,
Other_Math,
Other_Uppercase,
Pattern_Syntax,
Pattern_White_Space,
Quotation_Mark,
Radical,
Soft_Dotted,
STerm,
Terminal_Punctuation,
Unified_Ideograph,
Uppercase,
Variation_Selector,
White_Space,
XID_Continue,
XID_Start,
Expands_On_NFC,
Expands_On_NFD,
Expands_On_NFKC,
Expands_On_NFKD,
Other, -- Values of the General Category
Control,
Format,
Unassigned,
Private_Use,
Surrogate,
Letter,
Cased_Letter,
Lowercase_Letter,
Modifier_Letter,
Other_Letter,
Titlecase_Letter,
Uppercase_Letter,
Mark,
Spacing_Mark,
Enclosing_Mark,
Nonspacing_Mark,
Number,
Decimal_Number,
Letter_Number,
Other_Number,
Punctuation,
Connector_Punctuation,
Dash_Punctuation,
Close_Punctuation,
Final_Punctuation,
Initial_Punctuation,
Other_Punctuation,
Open_Punctuation,
Symbol,
Currency_Symbol,
Modifier_Symbol,
Math_Symbol,
Other_Symbol,
Separator,
Line_Separator,
Paragraph_Separator,
Space_Separator);
type Kinds is
(None,
Match_Code_Point,
Number,
Property_Keyword,
AST_Node);
type YYSType (Kind : Kinds := None) is record
case Kind is
when None =>
null;
when Match_Code_Point =>
Code : Wide_Wide_Character;
when Number =>
Value : Natural;
when Property_Keyword =>
Keyword : Property_Specification_Keyword;
when AST_Node =>
Node : Positive;
end case;
end record;
type Token is
(End_Of_Input,
Error,
Token_Code_Point,
Token_Any_Code_Point,
Token_Alternation,
Token_Optional_Greedy,
Token_Optional_Lazy,
Token_Zero_Or_More_Greedy,
Token_Zero_Or_More_Lazy,
Token_One_Or_More_Greedy,
Token_One_Or_More_Lazy,
Token_Character_Class_Begin,
Token_Character_Class_End,
Token_Negate_Character_Class,
Token_Character_Class_Range,
Token_Multiplicity_Begin,
Token_Multiplicity_End_Greedy,
Token_Multiplicity_End_Lazy,
Token_Multiplicity_Comma,
Token_Multiplicity_Number,
Token_Subexpression_Capture_Begin,
Token_Subexpression_Begin,
Token_Subexpression_End,
Token_Property_Begin_Positive,
Token_Property_Begin_Negative,
Token_Property_End,
Token_Property_Keyword,
Token_Start_Of_Line,
Token_End_Of_Line);
-- Here is global state of the compiler. At the first stage of
-- refactoring all global state variables must be moved to here.
-- Later, they will be wrapped by record type to allow to have
-- several compiler in the different threads at the same time.
type Compiler_State is record
Data : Matreshka.Internals.Strings.Shared_String_Access;
YY_Start_State : Integer := 1;
YY_Current_Position : Matreshka.Internals.Utf16.Utf16_String_Index := 0;
YY_Current_Index : Positive := 1;
YY_Error : YY_Error_Information := (No_Error, 0);
YYLVal : YYSType;
YYVal : YYSType;
Character_Class_Mode : Boolean := False;
-- Recognition of the Unicode property specification is done in the
-- separate scanner's mode; this variable is used to switch back to
-- original mode.
end record;
procedure YYError
(Self : not null access Compiler_State;
Error : YY_Errors;
Index : Natural);
-- Report error.
procedure Attach
(Pattern : in out Shared_Pattern; Head : Positive; Node : Positive);
-- Attach Node to the list of nodes, started by Head.
function Compile
(Expression : not null Matreshka.Internals.Strings.Shared_String_Access)
return not null Shared_Pattern_Access;
function Create_Alternative
(Pattern : not null Shared_Pattern_Access;
Prefered : Positive;
Alternative : Positive) return Positive;
pragma Inline (Create_Alternative);
function Create_Anchor_End_Of_Line
(Pattern : not null Shared_Pattern_Access) return Positive;
pragma Inline (Create_Anchor_End_Of_Line);
function Create_Anchor_Start_Of_Line
(Pattern : not null Shared_Pattern_Access) return Positive;
pragma Inline (Create_Anchor_Start_Of_Line);
function Create_Character_Class
(Pattern : not null Shared_Pattern_Access) return Positive;
pragma Inline (Create_Character_Class);
function Create_Match_Any
(Pattern : not null Shared_Pattern_Access) return Positive;
pragma Inline (Create_Match_Any);
function Create_Match_Character
(Pattern : not null Shared_Pattern_Access;
Character : Matreshka.Internals.Unicode.Code_Point) return Positive;
pragma Inline (Create_Match_Character);
function Create_Match_Property
(Pattern : not null Shared_Pattern_Access;
Value : Matreshka.Internals.Unicode.Ucd.Boolean_Properties;
Negative : Boolean) return Positive;
pragma Inline (Create_Match_Property);
function Create_Match_Property
(Pattern : not null Shared_Pattern_Access;
Value : General_Category_Flags;
Negative : Boolean) return Positive;
pragma Inline (Create_Match_Property);
procedure Create_Member_Character
(Pattern : not null Shared_Pattern_Access;
Class : Positive;
Character : Matreshka.Internals.Unicode.Code_Point);
pragma Inline (Create_Member_Character);
procedure Create_Member_Property
(Pattern : not null Shared_Pattern_Access;
Class : Positive;
Value : Matreshka.Internals.Unicode.Ucd.Boolean_Properties;
Negative : Boolean);
pragma Inline (Create_Member_Property);
procedure Create_Member_Property
(Pattern : not null Shared_Pattern_Access;
Class : Positive;
Value : General_Category_Flags;
Negative : Boolean);
pragma Inline (Create_Member_Property);
procedure Create_Member_Range
(Pattern : not null Shared_Pattern_Access;
Class : Positive;
Low : Matreshka.Internals.Unicode.Code_Point;
High : Matreshka.Internals.Unicode.Code_Point);
pragma Inline (Create_Member_Range);
function Create_Repetition
(Pattern : not null Shared_Pattern_Access;
Expression : Positive;
Lower : Natural;
Upper : Natural;
Greedy : Boolean) return Positive;
pragma Inline (Create_Repetition);
function Create_Subexpression
(Pattern : not null Shared_Pattern_Access;
Expression : Positive;
Capture : Boolean) return Positive;
pragma Inline (Create_Subexpression);
function Get_Preferred
(Pattern : not null Shared_Pattern_Access;
Node : Positive) return Natural;
pragma Inline (Get_Preferred);
function Get_Fallback
(Pattern : not null Shared_Pattern_Access;
Node : Positive) return Natural;
pragma Inline (Get_Fallback);
function Get_Members
(Pattern : not null Shared_Pattern_Access;
Node : Positive) return Natural;
pragma Inline (Get_Members);
function Get_Expression
(Pattern : not null Shared_Pattern_Access;
Node : Positive) return Natural;
pragma Inline (Get_Expression);
function Get_Lower_Bound
(Pattern : not null Shared_Pattern_Access;
Node : Positive) return Natural;
pragma Inline (Get_Lower_Bound);
function Get_Upper_Bound
(Pattern : not null Shared_Pattern_Access;
Node : Positive) return Natural;
pragma Inline (Get_Upper_Bound);
function Get_Previous_Sibling
(Pattern : not null Shared_Pattern_Access;
Node : Positive) return Natural;
pragma Inline (Get_Previous_Sibling);
function Get_Next_Sibling
(Pattern : not null Shared_Pattern_Access;
Node : Positive) return Natural;
pragma Inline (Get_Next_Sibling);
end Matreshka.Internals.Regexps.Compiler;
|
build/default/production/rtc.asm | AlphaFelix/PBLE | 0 | 1468 | ;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 3.6.0 #9615 (MINGW64)
;--------------------------------------------------------
; PIC16 port for the Microchip 16-bit core micros
;--------------------------------------------------------
list p=18f4550
radix dec
;--------------------------------------------------------
; public variables in this module
;--------------------------------------------------------
global _rtcInit
global _BCD2UpperCh
global _BCD2LowerCh
global _rtcStore
global _rtcStoreInt
global _rtcRead
global _rtcReadInt
global _rtcStart
global _rtcMin
global _rtcHour
global _rtcDay
global _rtcDate
global _rtcMonth
global _rtcYear
;--------------------------------------------------------
; extern variables in this module
;--------------------------------------------------------
extern _SPPCFGbits
extern _SPPEPSbits
extern _SPPCONbits
extern _UFRMLbits
extern _UFRMHbits
extern _UIRbits
extern _UIEbits
extern _UEIRbits
extern _UEIEbits
extern _USTATbits
extern _UCONbits
extern _UADDRbits
extern _UCFGbits
extern _UEP0bits
extern _UEP1bits
extern _UEP2bits
extern _UEP3bits
extern _UEP4bits
extern _UEP5bits
extern _UEP6bits
extern _UEP7bits
extern _UEP8bits
extern _UEP9bits
extern _UEP10bits
extern _UEP11bits
extern _UEP12bits
extern _UEP13bits
extern _UEP14bits
extern _UEP15bits
extern _PORTAbits
extern _PORTBbits
extern _PORTCbits
extern _PORTDbits
extern _PORTEbits
extern _LATAbits
extern _LATBbits
extern _LATCbits
extern _LATDbits
extern _LATEbits
extern _DDRAbits
extern _TRISAbits
extern _DDRBbits
extern _TRISBbits
extern _DDRCbits
extern _TRISCbits
extern _DDRDbits
extern _TRISDbits
extern _DDREbits
extern _TRISEbits
extern _OSCTUNEbits
extern _PIE1bits
extern _PIR1bits
extern _IPR1bits
extern _PIE2bits
extern _PIR2bits
extern _IPR2bits
extern _EECON1bits
extern _RCSTAbits
extern _TXSTAbits
extern _T3CONbits
extern _CMCONbits
extern _CVRCONbits
extern _CCP1ASbits
extern _ECCP1ASbits
extern _CCP1DELbits
extern _ECCP1DELbits
extern _BAUDCONbits
extern _BAUDCTLbits
extern _CCP2CONbits
extern _CCP1CONbits
extern _ECCP1CONbits
extern _ADCON2bits
extern _ADCON1bits
extern _ADCON0bits
extern _SSPCON2bits
extern _SSPCON1bits
extern _SSPSTATbits
extern _T2CONbits
extern _T1CONbits
extern _RCONbits
extern _WDTCONbits
extern _HLVDCONbits
extern _LVDCONbits
extern _OSCCONbits
extern _T0CONbits
extern _STATUSbits
extern _INTCON3bits
extern _INTCON2bits
extern _INTCONbits
extern _STKPTRbits
extern _SPPDATA
extern _SPPCFG
extern _SPPEPS
extern _SPPCON
extern _UFRM
extern _UFRML
extern _UFRMH
extern _UIR
extern _UIE
extern _UEIR
extern _UEIE
extern _USTAT
extern _UCON
extern _UADDR
extern _UCFG
extern _UEP0
extern _UEP1
extern _UEP2
extern _UEP3
extern _UEP4
extern _UEP5
extern _UEP6
extern _UEP7
extern _UEP8
extern _UEP9
extern _UEP10
extern _UEP11
extern _UEP12
extern _UEP13
extern _UEP14
extern _UEP15
extern _PORTA
extern _PORTB
extern _PORTC
extern _PORTD
extern _PORTE
extern _LATA
extern _LATB
extern _LATC
extern _LATD
extern _LATE
extern _DDRA
extern _TRISA
extern _DDRB
extern _TRISB
extern _DDRC
extern _TRISC
extern _DDRD
extern _TRISD
extern _DDRE
extern _TRISE
extern _OSCTUNE
extern _PIE1
extern _PIR1
extern _IPR1
extern _PIE2
extern _PIR2
extern _IPR2
extern _EECON1
extern _EECON2
extern _EEDATA
extern _EEADR
extern _RCSTA
extern _TXSTA
extern _TXREG
extern _RCREG
extern _SPBRG
extern _SPBRGH
extern _T3CON
extern _TMR3
extern _TMR3L
extern _TMR3H
extern _CMCON
extern _CVRCON
extern _CCP1AS
extern _ECCP1AS
extern _CCP1DEL
extern _ECCP1DEL
extern _BAUDCON
extern _BAUDCTL
extern _CCP2CON
extern _CCPR2
extern _CCPR2L
extern _CCPR2H
extern _CCP1CON
extern _ECCP1CON
extern _CCPR1
extern _CCPR1L
extern _CCPR1H
extern _ADCON2
extern _ADCON1
extern _ADCON0
extern _ADRES
extern _ADRESL
extern _ADRESH
extern _SSPCON2
extern _SSPCON1
extern _SSPSTAT
extern _SSPADD
extern _SSPBUF
extern _T2CON
extern _PR2
extern _TMR2
extern _T1CON
extern _TMR1
extern _TMR1L
extern _TMR1H
extern _RCON
extern _WDTCON
extern _HLVDCON
extern _LVDCON
extern _OSCCON
extern _T0CON
extern _TMR0
extern _TMR0L
extern _TMR0H
extern _STATUS
extern _FSR2L
extern _FSR2H
extern _PLUSW2
extern _PREINC2
extern _POSTDEC2
extern _POSTINC2
extern _INDF2
extern _BSR
extern _FSR1L
extern _FSR1H
extern _PLUSW1
extern _PREINC1
extern _POSTDEC1
extern _POSTINC1
extern _INDF1
extern _WREG
extern _FSR0L
extern _FSR0H
extern _PLUSW0
extern _PREINC0
extern _POSTDEC0
extern _POSTINC0
extern _INDF0
extern _INTCON3
extern _INTCON2
extern _INTCON
extern _PROD
extern _PRODL
extern _PRODH
extern _TABLAT
extern _TBLPTR
extern _TBLPTRL
extern _TBLPTRH
extern _TBLPTRU
extern _PC
extern _PCL
extern _PCLATH
extern _PCLATU
extern _STKPTR
extern _TOS
extern _TOSL
extern _TOSH
extern _TOSU
extern _i2cInit
extern _i2cStart
extern _i2cRestart
extern _i2cStop
extern _i2cSend
extern _i2cRead
extern _lcdCommand
;--------------------------------------------------------
; Equates to used internal registers
;--------------------------------------------------------
WREG equ 0xfe8
FSR1L equ 0xfe1
FSR2L equ 0xfd9
POSTINC1 equ 0xfe6
POSTDEC1 equ 0xfe5
PREINC1 equ 0xfe4
PLUSW2 equ 0xfdb
PRODL equ 0xff3
; Internal registers
.registers udata_ovr 0x0000
r0x00 res 1
r0x01 res 1
r0x02 res 1
r0x03 res 1
r0x04 res 1
r0x05 res 1
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
; I code from now on!
; ; Starting pCode block
S_rtc__rtcYear code
_rtcYear:
; .line 123; rtc.c void rtcYear(unsigned char year){
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
MOVFF r0x00, POSTDEC1
MOVLW 0x02
MOVFF PLUSW2, r0x00
; .line 124; rtc.c i2cStart();
CALL _i2cStart
; .line 125; rtc.c i2cSend(0xD0);
MOVLW 0xd0
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 126; rtc.c i2cSend(0x06);
MOVLW 0x06
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 127; rtc.c i2cSend(year);
MOVF r0x00, W
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 128; rtc.c i2cStop();
CALL _i2cStop
; .line 129; rtc.c lcdCommand(0x01);
MOVLW 0x01
MOVWF POSTDEC1
CALL _lcdCommand
MOVF POSTINC1, F
MOVFF PREINC1, r0x00
MOVFF PREINC1, FSR2L
RETURN
; ; Starting pCode block
S_rtc__rtcMonth code
_rtcMonth:
; .line 114; rtc.c void rtcMonth(unsigned char month){
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
MOVFF r0x00, POSTDEC1
MOVLW 0x02
MOVFF PLUSW2, r0x00
; .line 115; rtc.c i2cStart();
CALL _i2cStart
; .line 116; rtc.c i2cSend(0xD0);
MOVLW 0xd0
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 117; rtc.c i2cSend(0x05);
MOVLW 0x05
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 118; rtc.c i2cSend(month);
MOVF r0x00, W
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 119; rtc.c i2cStop();
CALL _i2cStop
; .line 120; rtc.c lcdCommand(0x01);
MOVLW 0x01
MOVWF POSTDEC1
CALL _lcdCommand
MOVF POSTINC1, F
MOVFF PREINC1, r0x00
MOVFF PREINC1, FSR2L
RETURN
; ; Starting pCode block
S_rtc__rtcDate code
_rtcDate:
; .line 105; rtc.c void rtcDate(unsigned char date){
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
MOVFF r0x00, POSTDEC1
MOVLW 0x02
MOVFF PLUSW2, r0x00
; .line 106; rtc.c i2cStart();
CALL _i2cStart
; .line 107; rtc.c i2cSend(0xD0);
MOVLW 0xd0
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 108; rtc.c i2cSend(0x04);
MOVLW 0x04
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 109; rtc.c i2cSend(date);
MOVF r0x00, W
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 110; rtc.c i2cStop();
CALL _i2cStop
; .line 111; rtc.c lcdCommand(0x01);
MOVLW 0x01
MOVWF POSTDEC1
CALL _lcdCommand
MOVF POSTINC1, F
MOVFF PREINC1, r0x00
MOVFF PREINC1, FSR2L
RETURN
; ; Starting pCode block
S_rtc__rtcDay code
_rtcDay:
; .line 96; rtc.c void rtcDay(unsigned char day){
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
MOVFF r0x00, POSTDEC1
MOVLW 0x02
MOVFF PLUSW2, r0x00
; .line 97; rtc.c i2cStart();
CALL _i2cStart
; .line 98; rtc.c i2cSend(0xD0);
MOVLW 0xd0
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 99; rtc.c i2cSend(0x03);
MOVLW 0x03
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 100; rtc.c i2cSend(day);
MOVF r0x00, W
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 101; rtc.c i2cStop();
CALL _i2cStop
; .line 102; rtc.c lcdCommand(0x01);
MOVLW 0x01
MOVWF POSTDEC1
CALL _lcdCommand
MOVF POSTINC1, F
MOVFF PREINC1, r0x00
MOVFF PREINC1, FSR2L
RETURN
; ; Starting pCode block
S_rtc__rtcHour code
_rtcHour:
; .line 87; rtc.c void rtcHour(unsigned char hour){
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
MOVFF r0x00, POSTDEC1
MOVLW 0x02
MOVFF PLUSW2, r0x00
; .line 88; rtc.c i2cStart();
CALL _i2cStart
; .line 89; rtc.c i2cSend(0xD0);
MOVLW 0xd0
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 90; rtc.c i2cSend(0x02);
MOVLW 0x02
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 91; rtc.c i2cSend(hour);
MOVF r0x00, W
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 92; rtc.c i2cStop();
CALL _i2cStop
; .line 93; rtc.c lcdCommand(0x01);
MOVLW 0x01
MOVWF POSTDEC1
CALL _lcdCommand
MOVF POSTINC1, F
MOVFF PREINC1, r0x00
MOVFF PREINC1, FSR2L
RETURN
; ; Starting pCode block
S_rtc__rtcMin code
_rtcMin:
; .line 78; rtc.c void rtcMin(unsigned char min){
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
MOVFF r0x00, POSTDEC1
MOVLW 0x02
MOVFF PLUSW2, r0x00
; .line 79; rtc.c i2cStart();
CALL _i2cStart
; .line 80; rtc.c i2cSend(0xD0);
MOVLW 0xd0
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 81; rtc.c i2cSend(0x01);
MOVLW 0x01
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 82; rtc.c i2cSend(min);
MOVF r0x00, W
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 83; rtc.c i2cStop();
CALL _i2cStop
; .line 84; rtc.c lcdCommand(0x01);
MOVLW 0x01
MOVWF POSTDEC1
CALL _lcdCommand
MOVF POSTINC1, F
MOVFF PREINC1, r0x00
MOVFF PREINC1, FSR2L
RETURN
; ; Starting pCode block
S_rtc__rtcStart code
_rtcStart:
; .line 68; rtc.c void rtcStart(void){
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
; .line 69; rtc.c i2cStart();
CALL _i2cStart
; .line 70; rtc.c i2cSend(0xD0);
MOVLW 0xd0
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 71; rtc.c i2cSend(0x00);
MOVLW 0x00
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 72; rtc.c i2cSend(0x00);
MOVLW 0x00
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 73; rtc.c i2cStop();
CALL _i2cStop
; .line 74; rtc.c lcdCommand(0x01);
MOVLW 0x01
MOVWF POSTDEC1
CALL _lcdCommand
MOVF POSTINC1, F
MOVFF PREINC1, FSR2L
RETURN
; ; Starting pCode block
S_rtc__rtcReadInt code
_rtcReadInt:
; .line 56; rtc.c int rtcReadInt(unsigned char address){
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
MOVFF r0x00, POSTDEC1
MOVFF r0x01, POSTDEC1
MOVFF r0x02, POSTDEC1
MOVFF r0x03, POSTDEC1
MOVFF r0x04, POSTDEC1
MOVFF r0x05, POSTDEC1
MOVLW 0x02
MOVFF PLUSW2, r0x00
; .line 60; rtc.c valH = rtcRead(address);
MOVF r0x00, W
MOVWF POSTDEC1
CALL _rtcRead
MOVWF r0x01
MOVF POSTINC1, F
; .line 61; rtc.c valL = rtcRead(address+1);
INCF r0x00, F
MOVF r0x00, W
MOVWF POSTDEC1
CALL _rtcRead
MOVWF r0x00
MOVF POSTINC1, F
; .line 62; rtc.c val = (valH << 8);
CLRF r0x02
MOVF r0x01, W
MOVWF r0x04
CLRF r0x03
; .line 63; rtc.c val = val + valL;
CLRF r0x05
MOVF r0x00, W
ADDWF r0x03, F
MOVF r0x05, W
ADDWFC r0x04, F
; .line 65; rtc.c return val;
MOVFF r0x04, PRODL
MOVF r0x03, W
MOVFF PREINC1, r0x05
MOVFF PREINC1, r0x04
MOVFF PREINC1, r0x03
MOVFF PREINC1, r0x02
MOVFF PREINC1, r0x01
MOVFF PREINC1, r0x00
MOVFF PREINC1, FSR2L
RETURN
; ; Starting pCode block
S_rtc__rtcRead code
_rtcRead:
; .line 44; rtc.c char rtcRead(unsigned char address){
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
MOVFF r0x00, POSTDEC1
MOVLW 0x02
MOVFF PLUSW2, r0x00
; .line 46; rtc.c i2cStart();
CALL _i2cStart
; .line 47; rtc.c i2cSend(0xD0);
MOVLW 0xd0
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 48; rtc.c i2cSend(address);
MOVF r0x00, W
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 49; rtc.c i2cRestart();
CALL _i2cRestart
; .line 50; rtc.c i2cSend(0xD1);
MOVLW 0xd1
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 51; rtc.c val = i2cRead();
CALL _i2cRead
MOVWF r0x00
; .line 52; rtc.c i2cStop();
CALL _i2cStop
; .line 53; rtc.c return val;
MOVF r0x00, W
MOVFF PREINC1, r0x00
MOVFF PREINC1, FSR2L
RETURN
; ; Starting pCode block
S_rtc__rtcStoreInt code
_rtcStoreInt:
; .line 34; rtc.c void rtcStoreInt(unsigned char address, int val)
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
MOVFF r0x00, POSTDEC1
MOVFF r0x01, POSTDEC1
MOVFF r0x02, POSTDEC1
MOVFF r0x03, POSTDEC1
MOVLW 0x02
MOVFF PLUSW2, r0x00
MOVLW 0x03
MOVFF PLUSW2, r0x01
MOVLW 0x04
MOVFF PLUSW2, r0x02
; .line 36; rtc.c i2cStart();
CALL _i2cStart
; .line 37; rtc.c i2cSend(0xD0);
MOVLW 0xd0
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 38; rtc.c i2cSend(address);
MOVF r0x00, W
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 39; rtc.c i2cSend(val >> 8);
MOVF r0x02, W
MOVWF r0x00
CLRF r0x03
BTFSC r0x00, 7
SETF r0x03
MOVF r0x00, W
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 40; rtc.c i2cSend(val & 0x00FF);
CLRF r0x02
MOVF r0x01, W
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 41; rtc.c i2cStop();
CALL _i2cStop
MOVFF PREINC1, r0x03
MOVFF PREINC1, r0x02
MOVFF PREINC1, r0x01
MOVFF PREINC1, r0x00
MOVFF PREINC1, FSR2L
RETURN
; ; Starting pCode block
S_rtc__rtcStore code
_rtcStore:
; .line 25; rtc.c void rtcStore(unsigned char address, char val)
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
MOVFF r0x00, POSTDEC1
MOVFF r0x01, POSTDEC1
MOVLW 0x02
MOVFF PLUSW2, r0x00
MOVLW 0x03
MOVFF PLUSW2, r0x01
; .line 27; rtc.c i2cStart();
CALL _i2cStart
; .line 28; rtc.c i2cSend(0xD0);
MOVLW 0xd0
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 29; rtc.c i2cSend(address);
MOVF r0x00, W
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 30; rtc.c i2cSend(val);
MOVF r0x01, W
MOVWF POSTDEC1
CALL _i2cSend
MOVF POSTINC1, F
; .line 31; rtc.c i2cStop();
CALL _i2cStop
MOVFF PREINC1, r0x01
MOVFF PREINC1, r0x00
MOVFF PREINC1, FSR2L
RETURN
; ; Starting pCode block
S_rtc__BCD2LowerCh code
_BCD2LowerCh:
; .line 17; rtc.c unsigned char BCD2LowerCh(unsigned char bcd)
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
MOVFF r0x00, POSTDEC1
MOVLW 0x02
MOVFF PLUSW2, r0x00
; .line 20; rtc.c temp = bcd & 0x0F; //Making the Upper 4-bits
MOVLW 0x0f
ANDWF r0x00, F
; .line 21; rtc.c temp = temp | 0x30;
MOVLW 0x30
IORWF r0x00, F
; .line 22; rtc.c return(temp);
MOVF r0x00, W
MOVFF PREINC1, r0x00
MOVFF PREINC1, FSR2L
RETURN
; ; Starting pCode block
S_rtc__BCD2UpperCh code
_BCD2UpperCh:
; .line 10; rtc.c unsigned char BCD2UpperCh(unsigned char bcd)
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
MOVFF r0x00, POSTDEC1
MOVLW 0x02
MOVFF PLUSW2, r0x00
; .line 13; rtc.c temp = bcd >> 4;
SWAPF r0x00, W
ANDLW 0x0f
MOVWF r0x00
; .line 14; rtc.c temp = temp | 0x30;
MOVLW 0x30
IORWF r0x00, F
; .line 15; rtc.c return(temp);
MOVF r0x00, W
MOVFF PREINC1, r0x00
MOVFF PREINC1, FSR2L
RETURN
; ; Starting pCode block
S_rtc__rtcInit code
_rtcInit:
; .line 6; rtc.c void rtcInit(void) {
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
; .line 7; rtc.c i2cInit();
CALL _i2cInit
MOVFF PREINC1, FSR2L
RETURN
; Statistics:
; code size: 1014 (0x03f6) bytes ( 0.77%)
; 507 (0x01fb) words
; udata size: 0 (0x0000) bytes ( 0.00%)
; access size: 6 (0x0006) bytes
end
|
setoid-cats/Category/Subcategory.agda | heades/AUGL | 0 | 17374 | ---------------------------------------------------------------
-- This file contains the definitions of several versions of --
-- subcategories. --
---------------------------------------------------------------
module Category.Subcategory where
open import Level
open import Data.Product
open import Setoid.Total
open import Relation.Relation
open import Category.Category
open Setoid
open SetoidFun
open Pred
open Subcarrier
open EqRel
open Cat
-- Categorical Predicate: A predicate on objects, and morphisms such
-- that the latter is closed under identities and composition.
record CatPred {l : Level} (ℂ : Cat {l}) : Set (lsuc l) where
field
oinc : Obj ℂ → Set l
minc : ∀{A B} → oinc A → oinc B → Pred {l} (Hom ℂ A B)
cp-idPf : ∀{A} → {p : oinc A} → pf (minc p p) (id ℂ {A})
cp-compPf : ∀{A B C} → (op₁ : (oinc A))
→ (op₂ : (oinc B))
→ (op₃ : (oinc C))
→ {f : el (Hom ℂ A B)}
→ {g : el (Hom ℂ B C)}
→ (pf (minc op₁ op₂) f)
→ (pf (minc op₂ op₃) g)
→ (pf (minc op₁ op₃) (f ○[ comp ℂ ] g))
open CatPred
-- Subcategories:
-- The restriction of a category ℂ to the category determined by the
-- categorical predicate P. Note that the objects of this category
-- are pairs of an object and a proof that the object belongs in the
-- category, and morphisms are similarly defined but using setoid
-- predicates.
subcatPred : {l : Level}{ℂ : Cat {l}}
→ (P : CatPred ℂ)
→ Cat {l}
subcatPred {_}{ℂ} P =
record
{ Obj = Σ[ x ∈ Obj ℂ ]( oinc P x)
; Hom = λ AP BP → let A = proj₁ AP
B = proj₁ BP
op₁ = proj₂ AP
op₂ = proj₂ BP
in Subsetoid (Hom ℂ A B) (minc P op₁ op₂)
; comp = λ {AP}{BP}{CP} →
let A = proj₁ AP
B = proj₁ BP
C = proj₁ CP
op₁ = proj₂ AP
op₂ = proj₂ BP
op₃ = proj₂ CP
in record {
appT = λ x →
record {
appT = λ x₁ →
record { subel = (subel x) ○[ comp ℂ ] (subel x₁) ;
insub = cp-compPf P op₁ op₂ op₃ (insub x) (insub x₁) } ;
extT = λ {y} {z} x₂ → eq-comp-right {_}{ℂ}{A}{B}{C}{subel x}{subel y}{subel z} x₂ } ;
extT = λ {f₁}{f₂} pf g₂ → extT (comp ℂ) pf (subel g₂) }
; id = λ {AP} → let A = proj₁ AP
A-op = proj₂ AP
in record { subel = id ℂ ; insub = cp-idPf P {_}{A-op} }
; assocPf = assocPf ℂ
; idPfCom = idPfCom ℂ
; idPf = idPf ℂ
}
-- Subcategories using subsetoids.
subcat : {l : Level}
→ (ℂ : Cat {l})(O : Set l)
→ (oinc : O → Obj ℂ)
→ (minc : ∀{A B} → Pred {l} (Hom ℂ (oinc A) (oinc B)))
→ (∀{A} → pf (minc {A}{A}) (id ℂ {oinc A}))
→ (∀{A B C}
→ {f : el (Hom ℂ (oinc A) (oinc B))}
→ {g : el (Hom ℂ (oinc B) (oinc C))}
→ (pf minc f)
→ (pf minc g)
→ (pf minc (f ○[ comp ℂ ] g)))
→ Cat {l}
subcat ℂ O oinc minc idPF compPF =
record {
Obj = O;
Hom = λ A B → Subsetoid (Hom ℂ (oinc A) (oinc B)) (minc {A}{B});
comp = λ {A} {B} {C} →
record { appT = λ x →
record { appT = λ x₁ →
record { subel = (subel x) ○[ comp ℂ ] (subel x₁);
insub = compPF {f = subel x}{subel x₁} (insub x) (insub x₁) };
extT = λ {y}{z} p → extT (appT (comp ℂ {oinc A}{oinc B}{oinc C}) (subel x)) {subel y}{subel z} p };
extT = λ {y}{z} x₁ x₂ → extT (comp ℂ {oinc A} {oinc B} {oinc C}) x₁ (subel x₂) };
id = λ {A} → record { subel = id ℂ {oinc A}; insub = idPF {A} };
assocPf = assocPf ℂ;
idPf = idPf ℂ;
idPfCom = idPfCom ℂ
}
-- An alternate definition of a subcategory where the predicate is not
-- a setoid predicate.
subcat-pred : {l : Level}
→ (ℂ : Cat {l})(O : Set l)
→ (oinc : O → Obj ℂ)
→ (minc : ∀{A B} → el (Hom ℂ (oinc A) (oinc B)) → Set l)
→ (∀{A} → minc (id ℂ {oinc A}))
→ (∀{A B C}
→ {f : el (Hom ℂ (oinc A) (oinc B))}
→ {g : el (Hom ℂ (oinc B) (oinc C))}
→ (minc f)
→ (minc g)
→ (minc (f ○[ comp ℂ ] g)))
→ Cat {l}
subcat-pred ℂ O oinc minc idPF compPF =
record {
Obj = O;
Hom = λ A B → ↓Setoid (Hom ℂ (oinc A) (oinc B)) (minc {A}{B});
comp = λ {A} {B} {C} → ↓BinSetoidFun (comp ℂ) compPF;
id = (id ℂ , idPF);
assocPf = assocPf ℂ;
idPf = idPf ℂ;
idPfCom = idPfCom ℂ}
|
loaders_patches_etc/trdos_save_load_sks.asm | alexanderbazhenoff/zx-spectrum-various | 0 | 81887 | DISPLAY "SKATEBOARD CONSTRUCTION SYSTEM.
DISPLAY "SAVE/LOAD OPTION"
ORG #C100
FILE_LEN EQU #0060
TEMP_SP EQU #C700
SEC_BUF EQU #C700
FONT EQU #3C00
LIN1ADR EQU #506A
LIN2ADR EQU #508A
JP LOAD
JP LOADSCR
SAVE DI
LD (STEK),SP
LD SP,TEMP_SP
EI
CALL ENTER_FILENAME
CALL SEL_DRIVE
CALL SEARCHING_MES
LD HL,0
LD (#5CF4),HL
LD BC,#810
SEA_SAL PUSH BC
PUSH BC
LD BC,#105
LD DE,(#5CF4)
LD HL,SEC_BUF
PUSH HL
CALL TR_DOS
POP HL
POP BC
CALL SEARCH_FILE
LD A,C
OR A
JP NZ,S_FOUND
POP BC
DJNZ SEA_SAL
LD DE,8
LD HL,SEC_BUF
LD BC,#105
CALL TR_DOS
LD HL,(SEC_BUF+#E5)
LD A,H
OR L
JP Z,NO_DSPACE
LD A,(SEC_BUF+#E4)
CP 128
JP NC,NO_DSPACE
LD HL,FILE_DISCRIPT
LD DE,SEC_BUF+#40
LD BC,14
LDIR
LD HL,(SEC_BUF+#E1)
LD A,L
LD (DE),A
INC DE
LD A,H
LD (DE),A
PUSH HL
LD (BODY_TRSC),HL
LD HL,SEC_BUF
LD DE,8
LD BC,#106
CALL TR_DOS_NOB
POP DE
PUSH DE
CALL SAVE_BODY
LD HL,(#5CF4)
PUSH HL
LD HL,0
LD (#5CF4),HL
LD BC,#810
SEA_EDI PUSH BC
PUSH BC
LD BC,#105
LD DE,(#5CF4)
LD HL,SEC_BUF
PUSH HL
CALL TR_DOS
POP HL
POP BC
LD DE,BYTE0
LD A,1
CALL SEARCH1
LD A,C
OR A
JR NZ,END_OF_CAT_FOUND
POP BC
DJNZ SEA_EDI
JP NO_DSPACE
END_OF_CAT_FOUND
POP BC
PUSH IX
POP DE
DEC DE
LD HL,FILE_DISCRIPT
LD BC,14
LDIR
LD HL,#1111
BODY_TRSC EQU $-2
LD A,L
LD (DE),A
INC DE
LD A,H
LD (DE),A
CALL PRNTMES1
DB "SAVING DIR ",#FF
LD DE,(#5CF4)
DEC E
LD HL,SEC_BUF
LD BC,#106
CALL TR_DOS
LD DE,8
LD HL,SEC_BUF
LD BC,#105
CALL TR_DOS
LD HL,(SEC_BUF+#E5)
LD BC,FILE_LEN
OR A
SBC HL,BC
LD (SEC_BUF+#E5),HL
LD A,(SEC_BUF+#E4)
INC A
LD (SEC_BUF+#E4),A
POP HL
LD (SEC_BUF+#E1),HL
LD HL,SEC_BUF
LD DE,8
LD BC,#106
CALL TR_DOS
JP EXIT
S_FOUND POP BC
CALL PRNTMES1
DB "FILE EXIST ",#FF
CALL PRNTMES2
DB "OVERWRITE? ",#FF
OW_KEY RES 5,(IY+1)
WAITK1 BIT 5,(IY+1)
JR Z,WAITK1
LD A,(IY-50)
CP "N"
JR Z,EXIT1
CP "n"
JR Z,EXIT1
CP 7
JR Z,EXIT1
CP 14
JR Z,EXIT1
CP "Y"
JR Z,OVERW
CP "y"
JR Z,OVERW
JR OW_KEY
OVERW LD E,(IX)
LD D,(IX+1)
PUSH DE
PUSH IX
LD BC,#0E
POP HL
PUSH HL
OR A
SBC HL,BC
LD DE,DISCRIPT_OWS
LD BC,15
LDIR
POP HL
LD A,L
LD (DE),A
INC DE
LD A,H
LD (DE),A
LD HL,SEC_BUF
LD DE,8
LD BC,#105
CALL TR_DOS
LD HL,DISCRIPT_OWS
LD DE,#7A40
LD BC,16
LDIR
LD HL,SEC_BUF
LD DE,8
LD BC,#106
CALL TR_DOS_NOB
POP DE
CALL SAVE_BODY
EXIT1 JP EXIT
SAVE_BODY
LD (#5CF4),DE
CALL PRNTMES1
DB "SAVING BODY ",#FF
CALL PR_FNAM
LD DE,(#5CF4)
LD BC,#6006
LD HL,#5FB4
JP TR_DOS
LOADSCR CALL EXCHANGE_DISCR
LD HL,LOAD_SC
LD (LOAD_SW),HL
CALL LOAD
LD HL,LOAD_DT
LD (LOAD_SW),HL
JP EXCHANGE_DISCR
EXCHANGE_DISCR
LD HL,FILE_DISCRIPT+8
LD DE,FILE_DIS_SCR
LD B,6
EC_D_L LD C,(HL)
LD A,(DE)
LD (HL),A
LD A,C
LD (DE),A
INC HL
INC DE
DJNZ EC_D_L
RET
LOAD DI
LD (STEK),SP
LD SP,TEMP_SP
EI
CALL ENTER_FILENAME
CALL SEL_DRIVE
CALL SEARCHING_MES
LD DE,0
LD BC,#805
LD HL,SEC_BUF
PUSH HL
CALL TR_DOS
POP HL
LD C,128
CALL SEARCH_FILE
LD A,C
OR A
JP Z,NO_FILE
CALL PRNTMES1
DB "LOADING FILE",#FF
LD E,(IX)
LD D,(IX+1)
JP LOAD_DT
LOAD_SW EQU $-2
LOAD_DT LD BC,#5F05
LD HL,#5FB4
CALL TR_DOS
LD DE,(#5CF4)
LD BC,#105
LD HL,SEC_BUF
PUSH HL
CALL TR_DOS
POP HL
LD DE,#BEB4
LD BC,#00E2
LDIR
EXIT CALL CLEAR1LIN
CALL CLEAR2LIN
EXIT_WC DI
LD SP,#3131
STEK EQU $-2
RET
LOAD_SC LD BC,#1B05
LD HL,#4000
CALL TR_DOS
JR EXIT_WC
ENTER_FILENAME
CALL CL_LA
LD A,#FF
LD (#5C00),A
LD HL,#10A
LD (#5C09),HL
LD C,2
INP_POS EQU $-1
RES 3,(IY+48)
CALL PRNTMES1
DB "ENTER NAME: ",#FF
LD IX,FILENAME
INP_PO1 EQU $-2
EFN_L LD A,":"
LD (EF_MES+1),A
LD (IX),"_"
HALT
CALL PR_FNAM
RES 5,(IY+1)
WAITK BIT 5,(IY+1)
JR Z,WAITK
CALL SOUND
LD A,(IY-50)
CP #0D
JR Z,ENTER
CP 8
JR Z,EFN_L
CP 9
JR Z,EFN_L
CP 10
JR Z,EFN_L
CP 11
JR Z,EFN_L
CP 14
JP Z,EXIT11
CP 7
JP Z,EXIT11
CP 12
JR Z,DELETE
CP 6
JR NZ,NO_CLP
LD HL,#5C6A
LD A,(HL)
XOR 8
LD (HL),A
JR EFN_L
NO_CLP EX AF,AF'
LD A,C
CP 10
JR Z,EFN_L
INC C
EX AF,AF'
LD (IX),A
INC IX
JR EFN_L
DELETE LD A,C
OR A
JR Z,EFN_L
DEC C
LD (IX),#20
DEC IX
LD (IX),"_"
JR EFN_L
EXIT11 LD A,":"
LD (EF_MES+1),A
LD (IX),#20
LD A,C
LD (INP_POS),A
LD (INP_PO1),IX
JP EXIT
ENTER LD A,(EF_MES)
OR #20
CP #61
JP C,EFN_L
CP #65
JP NC,EFN_L
LD A,":"
LD (EF_MES+1),A
LD (IX),#20
LD A,C
LD (INP_POS),A
LD (INP_PO1),IX
CALL PR_FNAM
LD HL,FILENAME
LD DE,FILE_DISCRIPT
LD BC,8
LDIR
RET
SEARCH_FILE
LD A,14
LD DE,FILE_DISCRIPT
SEARCH1 LD (SYM_2SEARCH),A
LD (DISCRIPT_2SEARCH),DE
LD DE,#1111
DISCRIPT_2SEARCH EQU $-2
SF_L PUSH HL
PUSH DE
LD B,6
SYM_2SEARCH EQU $-1
SF_COMP LD A,(DE)
CP (HL)
INC HL
INC DE
JR NZ,SF_COM1
DJNZ SF_COMP
PUSH HL
POP IX
POP DE
POP HL
RET
SF_COM1 POP DE
POP HL
PUSH BC
LD BC,16
ADD HL,BC
POP BC
DEC C
JR NZ,SF_L
RET
SEL_DRIVE
LD A,(EF_MES)
OR #20
SUB "a"
LD C,1
CALL TRDOS
LD A,(23823)
OR A
RET Z
JP OP_ERROR
SOUND PUSH BC
LD HL,#18
LD C,2
SOUN_L LD A,L
OUT (#FE),A
LD B,0
SOUN_L1 DJNZ SOUN_L1
LD A,H
OUT (#FE),A
LD B,0
SOUN_L2 DJNZ SOUN_L2
DEC C
JR NZ,SOUN_L
POP BC
RET
SEARCHING_MES
CALL PRNTMES1
DB "SEARCHING...",#FF
RET
PR_FNAM
CALL PRNTMES2
EF_MES DB "A:"
FILENAME
DB " ",#FF
RET
NO_FILE
CALL PRNTMES1
DB " NO FILE! ",#FF
JR CL_2LIN
OP_ERROR
CALL PRNTMES1
DB "DISK ERROR! ",#FF
CL_2LIN CALL CLEAR2LIN
EI
LD B,40
ER_PAUS HALT
LD A,2
OUT (#FE),A
DJNZ ER_PAUS
JP EXIT
NO_DSPACE
CALL PRNTMES1
DB "DISK IS FULL",#FF
JR CL_2LIN
CLEAR1LIN
LD DE,LIN1ADR
JR CLEARLI
CLEAR2LIN
LD DE,LIN2ADR
CLEARLI CALL PRNTMES
DB " ",#FF
RET
PRNTMES2
LD DE,LIN2ADR
JR PRNTMES
PRNTMES1
LD DE,LIN1ADR
PRNTMES POP HL
LD A,(HL)
INC HL
PUSH HL
CP #FF
RET Z
PUSH DE
LD DE,FONT
FONTADR EQU $-2
LD H,0
LD L,A
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,DE
POP DE
PUSH DE
LD B,8
OUTL_L LD A,(HL)
SRL A
OR (HL)
LD (DE),A
INC D
INC HL
DJNZ OUTL_L
POP DE
INC E
JR PRNTMES
CL_LA LD DE,LIN1ADR-1
CALL PRNTMES
DB #20,#FF
LD DE,LIN2ADR-1
CALL PRNTMES
DB #20,#FF
RET
TR_DOS PUSH HL
PUSH DE
PUSH BC
CALL TRDOS
POP BC
POP DE
POP HL
LD A,(23823)
OR A
RET Z
CP 6
JP Z,OP_ERROR
CP 7
JP Z,OP_ERROR
CP #14
JP Z,OP_ERROR
JR TR_DOS
TR_DOS_NOB
PUSH HL
PUSH DE
PUSH BC
CALL TRDOS
POP BC
POP DE
POP HL
LD A,(23823)
OR A
RET Z
JR TR_DOS_NOB
TRDOS PUSH HL
LD (REG_A),A
LD A,#FF
LD (#5D15),A
LD (#5D17),A
LD HL,(23613)
LD (ERR+1),HL
LD HL,DRIA
LD (#5CC3),HL
LD HL,ERR
EX (SP),HL
LD (23613),SP
EX AF,AF'
LD A,#C3
LD (#5CC2),A
XOR A
LD (23823),A
LD (23824),A
EX AF,AF'
LD (SP2),SP
LD A,#3E
REG_A EQU $-1
JP #3D13
DERR LD SP,#3131
SP2 EQU $-2
LD (23823),A
ERR LD HL,#2121
LD (23613),HL
LD A,#C9
LD (#5CC2),A
COMRET RET
DRIA EX (SP),HL
PUSH AF
LD A,H
CP 13
JR Z,RIA
XOR A
OR H
JR NZ,NO_ERR
LD A,L
CP #10
JR Z,DERR
NO_ERR POP AF
EX (SP),HL
RET
RIA DUP 3
POP HL
EDUP
LD A,"R"
LD HL,#3F7E
EX (SP),HL
JP #3D2F
FILE_DISCRIPT
DB " skt",#E2,#5F,#60
DISCRIPT_OWS
DS 16,0
BYTE0 DB 0
FILE_DIS_SCR
DB "scr",#00,#1B,#1B
ENDOBJ DISPLAY
DISPLAY "End object: ",ENDOBJ
|
disorderly/gamma.ads | jscparker/math_packages | 30 | 19440 | <filename>disorderly/gamma.ads
-------------------------------------------------------------------------------
-- package Gamma, Log of Gamma Function
-- Copyright (C) 1995-2018 <NAME>
--
-- 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.
-------------------------------------------------------------------------------
-- package Gamma
--
-- Natural logarithm of Gamma function for positive real arguments.
--
-- Uses Stieltjes' Continued Fraction method arg > 14, and rational
-- polynomial approximations for 0 < arg < 16.
--
-- Meant to be good to better than 30 digits (if you can instantiate
-- with a 30 digit Real). That's why the rational
-- polynomial approximations are so complicated at x < 16, and
-- why the order of the Stieltjes' Continued Fraction is so high.
-- But ordinarily you use a 15 digit Real.
generic
type Real is digits <>;
package Gamma is
pragma Pure (Gamma);
function Log_Gamma (x : in Real) return Real;
-- For x > 0 only. Natural logarithm of Gamma function.
--
-- Uses Stieltjes' Continued Fraction method above x=14.
-- For 0 < x < 10 uses simplest rational approx.
-- Probably good to a lot better than 32 digits.
function Log_Gamma_0_to_16 (x : in Real) return Real;
-- This is the part that uses a rational polynomial approx.
-- Only good for 0 < x < 16 !
procedure Test_Stieltjes_Coefficients;
private
Real_Epsilon : constant Real := (+0.125) * Real'Epsilon;
-- have to modify this if Real is abstract extended
end Gamma;
|
Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0xca_notsx.log_21829_838.asm | ljhsiun2/medusa | 9 | 2787 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r13
push %rax
push %rcx
push %rsi
lea addresses_UC_ht+0x8d4c, %r10
nop
nop
nop
dec %r12
movb (%r10), %al
nop
dec %r11
lea addresses_A_ht+0x104c, %rcx
nop
nop
nop
nop
dec %rsi
mov $0x6162636465666768, %r13
movq %r13, (%rcx)
nop
nop
nop
nop
nop
dec %r13
lea addresses_UC_ht+0x1118c, %r10
cmp $41746, %r11
mov (%r10), %ax
nop
nop
nop
nop
inc %rsi
pop %rsi
pop %rcx
pop %rax
pop %r13
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r8
push %r9
push %rax
push %rbx
// Store
lea addresses_normal+0x300c, %r8
nop
nop
nop
nop
nop
sub %r15, %r15
movl $0x51525354, (%r8)
nop
nop
nop
nop
nop
dec %r9
// Load
lea addresses_D+0x827c, %rbx
nop
cmp %r14, %r14
and $0xffffffffffffffc0, %rbx
movaps (%rbx), %xmm1
vpextrq $0, %xmm1, %r9
nop
nop
nop
add %rax, %rax
// Faulty Load
lea addresses_normal+0x300c, %r11
nop
nop
add $44793, %rax
mov (%r11), %r9
lea oracles, %r11
and $0xff, %r9
shlq $12, %r9
mov (%r11,%r9,1), %r9
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 4, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_D', 'size': 16, 'AVXalign': True}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': True}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'54': 21829}
54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54
*/
|
oeis/209/A209890.asm | neoneye/loda-programs | 11 | 11775 | ; A209890: Number of (n+1) X 2 0..2 arrays with every 2 X 2 subblock having two distinct values, and new values 0..2 introduced in row major order.
; Submitted by <NAME>(s4)
; 7,34,164,792,3824,18464,89152,430464,2078464,10035712,48456704,233969664,1129705472,5454700544,26337624064,127169298432,614027689984,2964787953664,14315262574592,69120202113024,333741858750464,1611448243453952,7780760408817664,37568834609086464,181398380071616512,875868858722811904,4229068955177713664,20419751255602102272,98595280843119263744,476060128394885464064,2298621636952018911232,11098727061387617501184,53589394793358545649664,258752487418984652603392,1249367528849372793012224
mov $1,6
mov $3,7
lpb $0
sub $0,1
mov $2,$3
mul $2,4
mul $3,4
add $3,$1
mov $1,$2
lpe
mov $0,$3
|
08/ProgramFlow/FibonacciSeries/FibonacciSeries.asm | SummerLife/building-my-computer | 10 | 98911 | @1
D=A
@ARG
A=D+M
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
@1
D=A
@3
D=D+A
@R13
M=D
@SP
A=M
D=M
@R13
A=M
M=D
@0
D=A
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
@0
D=A
@THAT
A=D+M
D=A
@R13
M=D
@SP
A=M
D=M
@R13
A=M
M=D
@1
D=A
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
@1
D=A
@THAT
A=D+M
D=A
@R13
M=D
@SP
A=M
D=M
@R13
A=M
M=D
@0
D=A
@ARG
A=D+M
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
@SP
A=M
D=M
@SP
M=M-1
@SP
A=M
M=M-D
@SP
M=M+1
@SP
M=M-1
@0
D=A
@ARG
A=D+M
D=A
@R13
M=D
@SP
A=M
D=M
@R13
A=M
M=D
(MAIN_LOOP_START)
@0
D=A
@ARG
A=D+M
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
@SP
A=M
D=M
@COMPUTE_ELEMENT
D;JGT
@END_PROGRAM
0;JMP
(COMPUTE_ELEMENT)
@0
D=A
@THAT
A=D+M
D=M
@SP
A=M
M=D
@SP
M=M+1
@1
D=A
@THAT
A=D+M
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
@SP
A=M
D=M
@SP
M=M-1
@SP
A=M
M=M+D
@SP
M=M+1
@SP
M=M-1
@2
D=A
@THAT
A=D+M
D=A
@R13
M=D
@SP
A=M
D=M
@R13
A=M
M=D
@1
D=A
@3
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
@SP
A=M
D=M
@SP
M=M-1
@SP
A=M
M=M+D
@SP
M=M+1
@SP
M=M-1
@1
D=A
@3
D=D+A
@R13
M=D
@SP
A=M
D=M
@R13
A=M
M=D
@0
D=A
@ARG
A=D+M
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
@SP
A=M
D=M
@SP
M=M-1
@SP
A=M
M=M-D
@SP
M=M+1
@SP
M=M-1
@0
D=A
@ARG
A=D+M
D=A
@R13
M=D
@SP
A=M
D=M
@R13
A=M
M=D
@MAIN_LOOP_START
0;JMP
(END_PROGRAM)
|
src/res/scenes/scene1.asm | Xeyler/gb-hello-world | 0 | 9831 | <gh_stars>0
SECTION "scene1", ROMX
scene1::
.tileset_length::
dw .tileset_end - .tileset
.tileset::
INCLUDE "res/scenes/tilesets/test.asm"
.tileset_end::
.metatileset::
INCLUDE "res/scenes/metatilesets/metatiles.asm"
.tilemap::
INCLUDE "res/scenes/tilemaps/map.asm"
|
8088/refresh_test/address.asm | reenigne/reenigne | 92 | 10444 | <reponame>reenigne/reenigne
%include "../defaults_com.asm"
main:
mov ax,cs
mov ds,ax
print "Test starting",10
cli
mov cx,512
cld
xor si,si
loopA:
mov al,[si]
inc si
loop loopA
refreshOff
mov cx,0x1000
loopTop:
times 512 nop
loop loopTop1
jmp loopDone
loopTop1:
jmp loopTop
loopDone:
refreshOn
mov cx,512*18
cld
xor si,si
loopB:
mov al,[si]
inc si
loop loopB
sti
mov cx,400
loopTop2:
in al,0x00
mov ah,al
in al,0x00
xchg ah,al
printHex
printCharacter 32
loop loopTop2
print "Test complete",10
mov ax,0x4c00
int 0x21
|
pruebas/ejec8/programa.asm | javito003/CPU_java | 0 | 98058 | ; Programa que convierte a mayúsculas el texto que se le ha pasado en minúsculas
; Funcionará mal si metemos cualquier cosa que no sea una letra
in
dup
push -1
eq
bt 50 ; Hemos llegado al final del fichero
push 32
sub
out
jump 0 |
notes/k-axiom/WithoutK.agda | asr/fotc | 11 | 17168 | <filename>notes/k-axiom/WithoutK.agda
------------------------------------------------------------------------------
-- Testing the --without-K flag
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
-- {-# OPTIONS --without-K #-}
module WithoutK where
-- The following code fails with the --without-K flag.
data _≡_ {A : Set} : A → A → Set where
refl : ∀ x → x ≡ x
K : {A : Set} (P : {x : A} → x ≡ x → Set) →
(∀ x → P (refl x)) →
∀ {x} (x≡x : x ≡ x) → P x≡x
K P p (refl x) = p x
|
test/Fail/Issue2100.agda | shlevy/agda | 1,989 | 6565 | <filename>test/Fail/Issue2100.agda
-- Andreas, 2016-07-20, issue #2100 termination and where
data D : Set where
pair : (x y : D) → D
works : (p q : D) → D
works (pair a b) (pair c d) = pair
(works a (pair c d))
(works (pair a b) c)
-- If we abstract out the two calls with where
-- termination check fails.
fails : (p q : D) → D
fails (pair a b) (pair c d) = pair u v
where
u = (fails a (pair c d))
v = (fails (pair a b) c)
-- Would be nice if this succeeded.
-- (Ideally before the year 2100.)
|
oeis/049/A049871.asm | neoneye/loda-programs | 11 | 160793 | <gh_stars>10-100
; A049871: a(n)=Sum{a(k): k=0,1,2,...,n-4,n-2,n-1}; a(n-3) is not a summand; 3 initial terms required.
; Submitted by <NAME>
; 1,3,3,6,10,20,37,70,130,243,453,846,1579,2948,5503,10273,19177,35799,66828,124752,232882,434735,811546,1514962,2828071,5279331,9855246,18397383,34343506,64111097,119680057,223413991,417060391
mov $2,2
mov $5,1
lpb $0
sub $0,1
sub $3,$4
add $1,$3
mov $3,$4
mov $4,$2
mov $2,$3
add $2,$1
add $5,$4
mov $3,$5
lpe
mov $0,$5
|
oeis/127/A127215.asm | neoneye/loda-programs | 11 | 99467 | ; A127215: a(n) = 3^n*tribonacci(n) or (3^n)*A001644(n+1).
; Submitted by <NAME>
; 3,27,189,891,5103,28431,155277,859491,4743603,26158707,144374805,796630059,4395548511,24254435799,133832255589,738466498755,4074759563139,22483948079115,124063275771981,684563868232731,3777327684782127,20842766314284447,115007472548176221,634595161962206115,3501607429305884403,19321380504378266211,106612677749867323365,588273858380265244875,3246012948507814832607,17911045870192249432551,98830648323414243402741,545333707411683975581571,3009075195640970852048259,16603656458360252908252923
add $0,1
mov $1,3
pow $1,$0
seq $0,1644 ; a(n) = a(n-1) + a(n-2) + a(n-3), a(0)=3, a(1)=1, a(2)=3.
mul $1,$0
mov $0,$1
|
src/test-programs/bitwise/bitwise.asm | SebastianPilarski/MIPS_Pipelined_Processor | 4 | 172102 | <filename>src/test-programs/bitwise/bitwise.asm<gh_stars>1-10
# Differences between bitwise and logical operators (& vs &&, | vs ||)
# $1: x = 3
# $2: y = 4
# $3: z = x & y */ bitwise AND: 0...0011 and 0...0100 = 0...0 /*
# $4: w = x && y */ logical AND: both are nonzero, so w = 1 /*
# $5: a = x | y */ bitwise OR: 0...0011 and 0...0100 = 0...0111 /*
# $6: b = x || y */ logical OR: at least one is nonzero, so w = 1 /*
# Assume that your data section in memory starts from address 2000. (Of course, since you will use separate memories for code and data for this part of the project, you could put data at address 0, but in the next phase of the project, you may use a single memory for both code and data, which is why we give you this program assuming a unified memory.)
addi $11, $0, 2000 # initializing the beginning of Data Section address in memory
addi $15, $0, 4 # word size in byte
Bitwise: addi $1, $0, 3
addi $2, $0, 4
and $3, $1, $2 # z = x & y
addi $10, $0, 0
mult $10, $15 # $lo=4*$10, for word alignment
mflo $12 # assume small numbers
add $13, $11, $12 # Make data pointer [2000+($10)*4]
add $2,$0,$3
sw $2, 0($13)
# w = x && y
beq $1, $0, False # branch to False if x = 0
beq $2, $0, False # branch to False if y = 0
addi $4, $0, 1 # x and y are both nonzero, so w = 1
addi $10, $0, 1
mult $10, $15 # $lo=4*$10, for word alignment
mflo $12 # assume small numbers
add $13, $11, $12 # Make data pointer [2000+($10)*4]
add $2,$0,$4
sw $2, 0($13)
j Continue
False: addi $4, $0, 0 # x and/or y are 0, so w = 0
Continue: or $5, $1, $2 # a = x | y
addi $10, $0, 3
mult $10, $15 # $lo=4*$10, for word alignment
mflo $12 # assume small numbers
add $13, $11, $12 # Make data pointer [2000+($10)*4]
add $2,$0,$5
sw $2, 0($13)
# w = x || y
bne $1, $0, True # branch to True if x is non-zero
bne $2, $0, True # branch to True if y is non-zero
addi $6, $0, 0 # x and y are both zero, so b = 0
addi $10, $0, 4
mult $10, $15 # $lo=4*$10, for word alignment
mflo $12 # assume small numbers
add $13, $11, $12 # Make data pointer [2000+($10)*4]
add $2,$0,$6
sw $2, 0($13)
j End
True: addi $6, $0, 1 # x and/or y are non-zero, so b = 1
End: beq $11, $11, End #end of program (infinite loop)
|
alloy4fun_models/trainstlt/models/2/vZ4GxDLLuQrgMrEXr.als | Kaixi26/org.alloytools.alloy | 0 | 1245 | <gh_stars>0
open main
pred idvZ4GxDLLuQrgMrEXr_prop3 {
always prox' = prox
}
pred __repair { idvZ4GxDLLuQrgMrEXr_prop3 }
check __repair { idvZ4GxDLLuQrgMrEXr_prop3 <=> prop3o } |
Nested.agda | nad/codata | 1 | 3481 | ------------------------------------------------------------------------
-- Nested applications of the defined function can be handled
------------------------------------------------------------------------
module Nested where
open import Codata.Musical.Notation
open import Codata.Musical.Stream
open import Function
import Relation.Binary.PropositionalEquality as P
------------------------------------------------------------------------
-- A definition of φ (x ∷ xs) = x ∷ φ (φ xs)
module φ where
infixr 5 _∷_
data StreamP (A : Set) : Set where
_∷_ : (x : A) (xs : ∞ (StreamP A)) → StreamP A
φP : (xs : StreamP A) → StreamP A
data StreamW (A : Set) : Set where
_∷_ : (x : A) (xs : StreamP A) → StreamW A
φW : {A : Set} → StreamW A → StreamW A
φW (x ∷ xs) = x ∷ φP (φP xs)
whnf : {A : Set} → StreamP A → StreamW A
whnf (x ∷ xs) = x ∷ ♭ xs
whnf (φP xs) = φW (whnf xs)
mutual
⟦_⟧W : {A : Set} → StreamW A → Stream A
⟦ x ∷ xs ⟧W = x ∷ ♯ ⟦ xs ⟧P
⟦_⟧P : {A : Set} → StreamP A → Stream A
⟦ xs ⟧P = ⟦ whnf xs ⟧W
⌈_⌉ : {A : Set} → Stream A → StreamP A
⌈ x ∷ xs ⌉ = x ∷ ♯ ⌈ ♭ xs ⌉
φ : {A : Set} → Stream A → Stream A
φ xs = ⟦ φP ⌈ xs ⌉ ⟧P
open φ using (⟦_⟧P; ⟦_⟧W; φP; φW; φ; _∷_; ⌈_⌉)
------------------------------------------------------------------------
-- An equality proof language
module Equality where
φ-rhs : {A : Set} → (Stream A → Stream A) → Stream A → Stream A
φ-rhs φ (x ∷ xs) = x ∷ ♯ φ (φ (♭ xs))
SatisfiesEquation : {A : Set} → (Stream A → Stream A) → Set
SatisfiesEquation φ = ∀ xs → φ xs ≈ φ-rhs φ xs
infixr 5 _∷_
infix 4 _≈P_ _≈W_
infix 3 _∎
infixr 2 _≈⟨_⟩_
data _≈P_ {A : Set} : Stream A → Stream A → Set where
_∷_ : ∀ (x : A) {xs ys}
(xs≈ys : ∞ (♭ xs ≈P ♭ ys)) → x ∷ xs ≈P x ∷ ys
_≈⟨_⟩_ : ∀ (xs : Stream A) {ys zs}
(xs≈ys : xs ≈P ys) (ys≈zs : ys ≈P zs) → xs ≈P zs
_∎ : (xs : Stream A) → xs ≈P xs
sym : ∀ {xs ys} (xs≈ys : xs ≈P ys) → ys ≈P xs
φP-cong : (xs ys : φ.StreamP A) (xs≈ys : ⟦ xs ⟧P ≈P ⟦ ys ⟧P) →
⟦ φP xs ⟧P ≈P ⟦ φP ys ⟧P
lemma : (φ₁ φ₂ : Stream A → Stream A)
(s₁ : SatisfiesEquation φ₁) (s₂ : SatisfiesEquation φ₂) →
∀ {xs ys} (xs≈ys : xs ≈P ys) → φ-rhs φ₁ xs ≈P φ-rhs φ₂ ys
-- Completeness.
completeP : {A : Set} {xs ys : Stream A} → xs ≈ ys → xs ≈P ys
completeP (P.refl ∷ xs≈ys) = _ ∷ ♯ completeP (♭ xs≈ys)
-- Weak head normal forms.
data _≈W_ {A : Set} : Stream A → Stream A → Set where
_∷_ : ∀ x {xs ys} (xs≈ys : ♭ xs ≈P ♭ ys) → x ∷ xs ≈W x ∷ ys
transW : {A : Set} {xs ys zs : Stream A} →
xs ≈W ys → ys ≈W zs → xs ≈W zs
transW (x ∷ xs≈ys) (.x ∷ ys≈zs) = x ∷ (_ ≈⟨ xs≈ys ⟩ ys≈zs)
reflW : {A : Set} (xs : Stream A) → xs ≈W xs
reflW (x ∷ xs) = x ∷ (♭ xs ∎)
symW : {A : Set} {xs ys : Stream A} → xs ≈W ys → ys ≈W xs
symW (x ∷ xs≈ys) = x ∷ sym xs≈ys
φW-cong : {A : Set} (xs ys : φ.StreamW A) →
⟦ xs ⟧W ≈W ⟦ ys ⟧W → ⟦ φW xs ⟧W ≈W ⟦ φW ys ⟧W
φW-cong (.x ∷ xs) (.x ∷ ys) (x ∷ xs≈ys) =
x ∷ φP-cong (φP xs) (φP ys) (φP-cong xs ys xs≈ys)
lemmaW : {A : Set} (φ₁ φ₂ : Stream A → Stream A)
(s₁ : SatisfiesEquation φ₁) (s₂ : SatisfiesEquation φ₂) →
∀ {xs ys} → xs ≈W ys → φ-rhs φ₁ xs ≈W φ-rhs φ₂ ys
lemmaW φ₁ φ₂ s₁ s₂ {.x ∷ xs} {.x ∷ ys} (x ∷ xs≈ys) = x ∷ (
φ₁ (φ₁ (♭ xs)) ≈⟨ completeP $ s₁ (φ₁ (♭ xs)) ⟩
φ-rhs φ₁ (φ₁ (♭ xs)) ≈⟨ lemma φ₁ φ₂ s₁ s₂ (
φ₁ (♭ xs) ≈⟨ completeP $ s₁ (♭ xs) ⟩
φ-rhs φ₁ (♭ xs) ≈⟨ lemma φ₁ φ₂ s₁ s₂ xs≈ys ⟩
φ-rhs φ₂ (♭ ys) ≈⟨ sym $ completeP $ s₂ (♭ ys) ⟩
φ₂ (♭ ys) ∎) ⟩
φ-rhs φ₂ (φ₂ (♭ ys)) ≈⟨ sym $ completeP $ s₂ (φ₂ (♭ ys)) ⟩
φ₂ (φ₂ (♭ ys)) ∎)
whnf : {A : Set} {xs ys : Stream A} → xs ≈P ys → xs ≈W ys
whnf (x ∷ xs≈ys) = x ∷ ♭ xs≈ys
whnf (xs ≈⟨ xs≈ys ⟩ ys≈zs) = transW (whnf xs≈ys) (whnf ys≈zs)
whnf (xs ∎) = reflW xs
whnf (sym xs≈ys) = symW (whnf xs≈ys)
whnf (lemma φ₁ φ₂ s₁ s₂ xs≈ys) = lemmaW φ₁ φ₂ s₁ s₂ (whnf xs≈ys)
whnf (φP-cong xs ys xs≈ys) =
φW-cong (φ.whnf xs) (φ.whnf ys) (whnf xs≈ys)
-- Soundness.
mutual
soundW : {A : Set} {xs ys : Stream A} → xs ≈W ys → xs ≈ ys
soundW (x ∷ xs≈ys) = P.refl ∷ ♯ soundP xs≈ys
soundP : {A : Set} {xs ys : Stream A} → xs ≈P ys → xs ≈ ys
soundP xs≈ys = soundW (whnf xs≈ys)
open Equality
using (_≈P_; _∷_; _≈⟨_⟩_; _∎; sym; φP-cong; φ-rhs; SatisfiesEquation)
------------------------------------------------------------------------
-- Correctness
module Correctness where
-- Uniqueness of solutions for φ's defining equation.
φ-unique : {A : Set} (φ₁ φ₂ : Stream A → Stream A) →
SatisfiesEquation φ₁ → SatisfiesEquation φ₂ →
∀ xs → φ₁ xs ≈P φ₂ xs
φ-unique φ₁ φ₂ hyp₁ hyp₂ xs =
φ₁ xs ≈⟨ Equality.completeP (hyp₁ xs) ⟩
φ-rhs φ₁ xs ≈⟨ Equality.lemma φ₁ φ₂ hyp₁ hyp₂ (xs ∎) ⟩
φ-rhs φ₂ xs ≈⟨ sym (Equality.completeP (hyp₂ xs)) ⟩
φ₂ xs ∎
-- The remainder of this module establishes the existence of a
-- solution.
⟦⌈_⌉⟧P : {A : Set} (xs : Stream A) → ⟦ ⌈ xs ⌉ ⟧P ≈P xs
⟦⌈ x ∷ xs ⌉⟧P = x ∷ ♯ ⟦⌈ ♭ xs ⌉⟧P
φ-cong : {A : Set} (xs ys : Stream A) → xs ≈P ys → φ xs ≈P φ ys
φ-cong xs ys xs≈ys =
φ xs ≈⟨ φ xs ∎ ⟩
⟦ φP ⌈ xs ⌉ ⟧P ≈⟨ φP-cong ⌈ xs ⌉ ⌈ ys ⌉ lemma ⟩
⟦ φP ⌈ ys ⌉ ⟧P ≈⟨ φ ys ∎ ⟩
φ ys ∎
where
lemma =
⟦ ⌈ xs ⌉ ⟧P ≈⟨ ⟦⌈ xs ⌉⟧P ⟩
xs ≈⟨ xs≈ys ⟩
ys ≈⟨ sym ⟦⌈ ys ⌉⟧P ⟩
⟦ ⌈ ys ⌉ ⟧P ∎
-- ♯′ provides a workaround for Agda's strange definitional
-- equality.
infix 10 ♯′_
♯′_ : {A : Set} → A → ∞ A
♯′ x = ♯ x
φW-hom : {A : Set} (xs : φ.StreamW A) →
⟦ φW xs ⟧W ≈P head ⟦ xs ⟧W ∷ ♯′ φ (φ (tail ⟦ xs ⟧W))
φW-hom (x ∷ xs) = x ∷ ♯ (
⟦ φP (φP xs) ⟧P ≈⟨ φP-cong (φP xs) (φP ⌈ ⟦ xs ⟧P ⌉) $
φP-cong xs (⌈ ⟦ xs ⟧P ⌉)
(sym ⟦⌈ ⟦ xs ⟧P ⌉⟧P) ⟩
⟦ φP (φP ⌈ ⟦ xs ⟧P ⌉) ⟧P ≈⟨ φP-cong (φP ⌈ ⟦ xs ⟧P ⌉)
⌈ ⟦ φP ⌈ ⟦ xs ⟧P ⌉ ⟧P ⌉
(sym ⟦⌈ ⟦ φP ⌈ ⟦ xs ⟧P ⌉ ⟧P ⌉⟧P) ⟩
⟦ φP ⌈ ⟦ φP ⌈ ⟦ xs ⟧P ⌉ ⟧P ⌉ ⟧P ∎)
φ-hom : {A : Set} (xs : φ.StreamP A) →
⟦ φP xs ⟧P ≈P head ⟦ xs ⟧P ∷ ♯′ φ (φ (tail ⟦ xs ⟧P))
φ-hom xs = φW-hom (φ.whnf xs)
φ-correct : {A : Set} (xs : Stream A) →
φ xs ≈P φ-rhs φ xs
φ-correct (x ∷ xs) =
φ (x ∷ xs) ≈⟨ φ (x ∷ xs) ∎ ⟩
⟦ φP ⌈ x ∷ xs ⌉ ⟧P ≈⟨ φ-hom ⌈ x ∷ xs ⌉ ⟩
x ∷ ♯′ φ (φ ⟦ ⌈ ♭ xs ⌉ ⟧P) ≈⟨ x ∷ ♯ φ-cong (φ ⟦ ⌈ ♭ xs ⌉ ⟧P) (φ (♭ xs))
(φ-cong (⟦ ⌈ ♭ xs ⌉ ⟧P) (♭ xs) ⟦⌈ ♭ xs ⌉⟧P) ⟩
φ-rhs φ (x ∷ xs) ∎
|
_incObj/DebugMode.asm | kodishmediacenter/msu-md-sonic | 9 | 96377 | <reponame>kodishmediacenter/msu-md-sonic
; ---------------------------------------------------------------------------
; When debug mode is currently in use
; ---------------------------------------------------------------------------
DebugMode:
moveq #0,d0
move.b (v_debuguse).w,d0
move.w Debug_Index(pc,d0.w),d1
jmp Debug_Index(pc,d1.w)
; ===========================================================================
Debug_Index: dc.w Debug_Main-Debug_Index
dc.w Debug_Action-Debug_Index
; ===========================================================================
Debug_Main: ; Routine 0
addq.b #2,(v_debuguse).w
move.w (v_limittop2).w,(v_limittopdb).w ; buffer level x-boundary
move.w (v_limitbtm1).w,(v_limitbtmdb).w ; buffer level y-boundary
move.w #0,(v_limittop2).w
move.w #$720,(v_limitbtm1).w
andi.w #$7FF,(v_player+obY).w
andi.w #$7FF,(v_screenposy).w
andi.w #$3FF,(v_bgscreenposy).w
move.b #0,obFrame(a0)
move.b #id_Walk,obAnim(a0)
cmpi.b #id_Special,(v_gamemode).w ; is game mode $10 (special stage)?
bne.s @islevel ; if not, branch
move.w #0,(v_ssrotate).w ; stop special stage rotating
move.w #0,(v_ssangle).w ; make special stage "upright"
moveq #6,d0 ; use 6th debug item list
bra.s @selectlist
; ===========================================================================
@islevel:
moveq #0,d0
move.b (v_zone).w,d0
@selectlist:
lea (DebugList).l,a2
add.w d0,d0
adda.w (a2,d0.w),a2
move.w (a2)+,d6
cmp.b (v_debugitem).w,d6 ; have you gone past the last item?
bhi.s @noreset ; if not, branch
move.b #0,(v_debugitem).w ; back to start of list
@noreset:
bsr.w Debug_ShowItem
move.b #12,(v_debugxspeed).w
move.b #1,(v_debugyspeed).w
Debug_Action: ; Routine 2
moveq #6,d0
cmpi.b #id_Special,(v_gamemode).w
beq.s @isntlevel
moveq #0,d0
move.b (v_zone).w,d0
@isntlevel:
lea (DebugList).l,a2
add.w d0,d0
adda.w (a2,d0.w),a2
move.w (a2)+,d6
bsr.w Debug_Control
jmp (DisplaySprite).l
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
Debug_Control:
moveq #0,d4
move.w #1,d1
move.b (v_jpadpress1).w,d4
andi.w #btnDir,d4 ; is up/down/left/right pressed?
bne.s @dirpressed ; if yes, branch
move.b (v_jpadhold1).w,d0
andi.w #btnDir,d0 ; is up/down/left/right held?
bne.s @dirheld ; if yes, branch
move.b #12,(v_debugxspeed).w
move.b #15,(v_debugyspeed).w
bra.w Debug_ChgItem
; ===========================================================================
@dirheld:
subq.b #1,(v_debugxspeed).w
bne.s loc_1D01C
move.b #1,(v_debugxspeed).w
addq.b #1,(v_debugyspeed).w
bne.s @dirpressed
move.b #-1,(v_debugyspeed).w
@dirpressed:
move.b (v_jpadhold1).w,d4
loc_1D01C:
moveq #0,d1
move.b (v_debugyspeed).w,d1
addq.w #1,d1
swap d1
asr.l #4,d1
move.l obY(a0),d2
move.l obX(a0),d3
btst #bitUp,d4 ; is up being pressed?
beq.s loc_1D03C ; if not, branch
sub.l d1,d2
bcc.s loc_1D03C
moveq #0,d2
loc_1D03C:
btst #bitDn,d4 ; is down being pressed?
beq.s loc_1D052 ; if not, branch
add.l d1,d2
cmpi.l #$7FF0000,d2
bcs.s loc_1D052
move.l #$7FF0000,d2
loc_1D052:
btst #bitL,d4
beq.s loc_1D05E
sub.l d1,d3
bcc.s loc_1D05E
moveq #0,d3
loc_1D05E:
btst #bitR,d4
beq.s loc_1D066
add.l d1,d3
loc_1D066:
move.l d2,obY(a0)
move.l d3,obX(a0)
Debug_ChgItem:
btst #bitA,(v_jpadhold1).w ; is button A pressed?
beq.s @createitem ; if not, branch
btst #bitC,(v_jpadpress1).w ; is button C pressed?
beq.s @nextitem ; if not, branch
subq.b #1,(v_debugitem).w ; go back 1 item
bcc.s @display
add.b d6,(v_debugitem).w
bra.s @display
; ===========================================================================
@nextitem:
btst #bitA,(v_jpadpress1).w ; is button A pressed?
beq.s @createitem ; if not, branch
addq.b #1,(v_debugitem).w ; go forwards 1 item
cmp.b (v_debugitem).w,d6
bhi.s @display
move.b #0,(v_debugitem).w ; loop back to first item
@display:
bra.w Debug_ShowItem
; ===========================================================================
@createitem:
btst #bitC,(v_jpadpress1).w ; is button C pressed?
beq.s @backtonormal ; if not, branch
jsr (FindFreeObj).l
bne.s @backtonormal
move.w obX(a0),obX(a1)
move.w obY(a0),obY(a1)
move.b 4(a0),0(a1) ; create object
move.b obRender(a0),obRender(a1)
move.b obRender(a0),obStatus(a1)
andi.b #$7F,obStatus(a1)
moveq #0,d0
move.b (v_debugitem).w,d0
lsl.w #3,d0
move.b 4(a2,d0.w),obSubtype(a1)
rts
; ===========================================================================
@backtonormal:
btst #bitB,(v_jpadpress1).w ; is button B pressed?
beq.s @stayindebug ; if not, branch
moveq #0,d0
move.w d0,(v_debuguse).w ; deactivate debug mode
move.l #Map_Sonic,(v_player+obMap).w
move.w #$780,(v_player+obGfx).w
move.b d0,(v_player+obAnim).w
move.w d0,obX+2(a0)
move.w d0,obY+2(a0)
move.w (v_limittopdb).w,(v_limittop2).w ; restore level boundaries
move.w (v_limitbtmdb).w,(v_limitbtm1).w
cmpi.b #id_Special,(v_gamemode).w ; are you in the special stage?
bne.s @stayindebug ; if not, branch
clr.w (v_ssangle).w
move.w #$40,(v_ssrotate).w ; set new level rotation speed
move.l #Map_Sonic,(v_player+obMap).w
move.w #$780,(v_player+obGfx).w
move.b #id_Roll,(v_player+obAnim).w
bset #2,(v_player+obStatus).w
bset #1,(v_player+obStatus).w
@stayindebug:
rts
; End of function Debug_Control
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
Debug_ShowItem:
moveq #0,d0
move.b (v_debugitem).w,d0
lsl.w #3,d0
move.l (a2,d0.w),obMap(a0) ; load mappings for item
move.w 6(a2,d0.w),obGfx(a0) ; load VRAM setting for item
move.b 5(a2,d0.w),obFrame(a0) ; load frame number for item
rts
; End of function Debug_ShowItem
|
oeis/004/A004609.asm | neoneye/loda-programs | 11 | 164095 | <reponame>neoneye/loda-programs
; A004609: Expansion of sqrt(6) in base 2.
; Submitted by <NAME>(s4)
; 1,0,0,1,1,1,0,0,1,1,0,0,0,1,0,0,0,1,1,1,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,1,1,1,0,0,1,1,1,1,1,0,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,1,0,0,1,0,0,0,1,0,1,0,0,0,0,1,1,0,0,1,0,0,0,0
mov $1,1
mov $2,1
mov $3,$0
add $3,2
mov $4,$0
add $4,2
mov $7,10
pow $7,$4
lpb $3
mov $4,$2
pow $4,2
mul $4,6
mov $5,$1
pow $5,2
add $4,$5
mov $6,$1
mov $1,$4
mul $6,$2
mul $6,2
mov $2,$6
mov $8,$4
div $8,$7
max $8,1
div $1,$8
div $2,$8
sub $3,1
mov $9,2
lpe
div $1,2
mov $3,$9
pow $3,$0
div $2,$3
div $1,$2
mod $1,$9
mov $0,$1
|
libtool/src/gmp-6.1.2/mpn/ia64/addmul_1.asm | kroggen/aergo | 1,602 | 24541 | <gh_stars>1000+
dnl IA-64 mpn_addmul_1 -- Multiply a limb vector with a limb and add the
dnl result to a second limb vector.
dnl Contributed to the GNU project by <NAME>.
dnl Copyright 2000-2005, 2007 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP 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 General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C Itanium: 3.0
C Itanium 2: 2.0
C TODO
C * Further optimize feed-in and wind-down code, both for speed and code size.
C * Handle low limb input and results specially, using a common stf8 in the
C epilogue.
C * Use 1 c/l carry propagation scheme in wind-down code.
C * Use extra pointer registers for `up' and rp to speed up feed-in loads.
C * Work out final differences with mul_1.asm. That function is 300 bytes
C smaller than this due to better loop scheduling and thus simpler feed-in
C code.
C INPUT PARAMETERS
define(`rp', `r32')
define(`up', `r33')
define(`n', `r34')
define(`vl', `r35')
ASM_START()
PROLOGUE(mpn_addmul_1)
.prologue
.save ar.lc, r2
.body
ifdef(`HAVE_ABI_32',
` addp4 rp = 0, rp C M I
addp4 up = 0, up C M I
zxt4 n = n C I
;;
')
{.mmi
adds r15 = -1, n C M I
mov r20 = rp C M I
mov.i r2 = ar.lc C I0
}
{.mmi
ldf8 f7 = [up], 8 C M
ldf8 f8 = [rp], 8 C M
and r14 = 3, n C M I
;;
}
{.mmi
setf.sig f6 = vl C M2 M3
cmp.eq p10, p0 = 0, r14 C M I
shr.u r31 = r15, 2 C I0
}
{.mmi
cmp.eq p11, p0 = 2, r14 C M I
cmp.eq p12, p0 = 3, r14 C M I
nop.i 0 C I
;;
}
{.mii
cmp.ne p6, p7 = r0, r0 C M I
mov.i ar.lc = r31 C I0
cmp.ne p8, p9 = r0, r0 C M I
}
{.bbb
(p10) br.dptk .Lb00 C B
(p11) br.dptk .Lb10 C B
(p12) br.dptk .Lb11 C B
;;
}
.Lb01: br.cloop.dptk .grt1 C B
xma.l f39 = f7, f6, f8 C F
xma.hu f43 = f7, f6, f8 C F
;;
getf.sig r8 = f43 C M2
stf8 [r20] = f39 C M2 M3
mov.i ar.lc = r2 C I0
br.ret.sptk.many b0 C B
.grt1:
ldf8 f32 = [up], 8
ldf8 f44 = [rp], 8
;;
ldf8 f33 = [up], 8
ldf8 f45 = [rp], 8
;;
ldf8 f34 = [up], 8
xma.l f39 = f7, f6, f8
ldf8 f46 = [rp], 8
xma.hu f43 = f7, f6, f8
;;
ldf8 f35 = [up], 8
ldf8 f47 = [rp], 8
br.cloop.dptk .grt5
xma.l f36 = f32, f6, f44
xma.hu f40 = f32, f6, f44
;;
stf8 [r20] = f39, 8
xma.l f37 = f33, f6, f45
xma.hu f41 = f33, f6, f45
;;
getf.sig r31 = f43
getf.sig r24 = f36
xma.l f38 = f34, f6, f46
xma.hu f42 = f34, f6, f46
;;
getf.sig r28 = f40
getf.sig r25 = f37
xma.l f39 = f35, f6, f47
xma.hu f43 = f35, f6, f47
;;
getf.sig r29 = f41
getf.sig r26 = f38
br .Lcj5
.grt5:
mov r30 = 0
xma.l f36 = f32, f6, f44
xma.hu f40 = f32, f6, f44
;;
ldf8 f32 = [up], 8
xma.l f37 = f33, f6, f45
ldf8 f44 = [rp], 8
xma.hu f41 = f33, f6, f45
;;
ldf8 f33 = [up], 8
getf.sig r27 = f39
;;
getf.sig r31 = f43
xma.l f38 = f34, f6, f46
ldf8 f45 = [rp], 8
xma.hu f42 = f34, f6, f46
;;
ldf8 f34 = [up], 8
getf.sig r24 = f36
;;
getf.sig r28 = f40
xma.l f39 = f35, f6, f47
ldf8 f46 = [rp], 8
xma.hu f43 = f35, f6, f47
;;
ldf8 f35 = [up], 8
getf.sig r25 = f37
br.cloop.dptk .Loop
br .Le0
.Lb10: ldf8 f35 = [up], 8
ldf8 f47 = [rp], 8
br.cloop.dptk .grt2
xma.l f38 = f7, f6, f8
xma.hu f42 = f7, f6, f8
;;
xma.l f39 = f35, f6, f47
xma.hu f43 = f35, f6, f47
;;
getf.sig r30 = f42
stf8 [r20] = f38, 8
getf.sig r27 = f39
getf.sig r8 = f43
br .Lcj2
.grt2:
ldf8 f32 = [up], 8
ldf8 f44 = [rp], 8
;;
ldf8 f33 = [up], 8
xma.l f38 = f7, f6, f8
ldf8 f45 = [rp], 8
xma.hu f42 = f7, f6, f8
;;
ldf8 f34 = [up], 8
xma.l f39 = f35, f6, f47
ldf8 f46 = [rp], 8
xma.hu f43 = f35, f6, f47
;;
ldf8 f35 = [up], 8
ldf8 f47 = [rp], 8
br.cloop.dptk .grt6
stf8 [r20] = f38, 8
xma.l f36 = f32, f6, f44
xma.hu f40 = f32, f6, f44
;;
getf.sig r30 = f42
getf.sig r27 = f39
xma.l f37 = f33, f6, f45
xma.hu f41 = f33, f6, f45
;;
getf.sig r31 = f43
getf.sig r24 = f36
xma.l f38 = f34, f6, f46
xma.hu f42 = f34, f6, f46
;;
getf.sig r28 = f40
getf.sig r25 = f37
xma.l f39 = f35, f6, f47
xma.hu f43 = f35, f6, f47
br .Lcj6
.grt6:
mov r29 = 0
xma.l f36 = f32, f6, f44
xma.hu f40 = f32, f6, f44
;;
ldf8 f32 = [up], 8
getf.sig r26 = f38
;;
getf.sig r30 = f42
xma.l f37 = f33, f6, f45
ldf8 f44 = [rp], 8
xma.hu f41 = f33, f6, f45
;;
ldf8 f33 = [up], 8
getf.sig r27 = f39
;;
getf.sig r31 = f43
xma.l f38 = f34, f6, f46
ldf8 f45 = [rp], 8
xma.hu f42 = f34, f6, f46
;;
ldf8 f34 = [up], 8
getf.sig r24 = f36
br .LL10
.Lb11: ldf8 f34 = [up], 8
ldf8 f46 = [rp], 8
;;
ldf8 f35 = [up], 8
ldf8 f47 = [rp], 8
br.cloop.dptk .grt3
;;
xma.l f37 = f7, f6, f8
xma.hu f41 = f7, f6, f8
xma.l f38 = f34, f6, f46
xma.hu f42 = f34, f6, f46
xma.l f39 = f35, f6, f47
xma.hu f43 = f35, f6, f47
;;
getf.sig r29 = f41
stf8 [r20] = f37, 8
getf.sig r26 = f38
getf.sig r30 = f42
getf.sig r27 = f39
getf.sig r8 = f43
br .Lcj3
.grt3:
ldf8 f32 = [up], 8
xma.l f37 = f7, f6, f8
ldf8 f44 = [rp], 8
xma.hu f41 = f7, f6, f8
;;
ldf8 f33 = [up], 8
xma.l f38 = f34, f6, f46
ldf8 f45 = [rp], 8
xma.hu f42 = f34, f6, f46
;;
ldf8 f34 = [up], 8
xma.l f39 = f35, f6, f47
ldf8 f46 = [rp], 8
xma.hu f43 = f35, f6, f47
;;
ldf8 f35 = [up], 8
getf.sig r25 = f37 C FIXME
ldf8 f47 = [rp], 8
br.cloop.dptk .grt7
getf.sig r29 = f41
stf8 [r20] = f37, 8 C FIXME
xma.l f36 = f32, f6, f44
getf.sig r26 = f38
xma.hu f40 = f32, f6, f44
;;
getf.sig r30 = f42
xma.l f37 = f33, f6, f45
getf.sig r27 = f39
xma.hu f41 = f33, f6, f45
;;
getf.sig r31 = f43
xma.l f38 = f34, f6, f46
getf.sig r24 = f36
xma.hu f42 = f34, f6, f46
br .Lcj7
.grt7:
getf.sig r29 = f41
xma.l f36 = f32, f6, f44
mov r28 = 0
xma.hu f40 = f32, f6, f44
;;
ldf8 f32 = [up], 8
getf.sig r26 = f38
;;
getf.sig r30 = f42
xma.l f37 = f33, f6, f45
ldf8 f44 = [rp], 8
xma.hu f41 = f33, f6, f45
;;
ldf8 f33 = [up], 8
getf.sig r27 = f39
br .LL11
.Lb00: ldf8 f33 = [up], 8
ldf8 f45 = [rp], 8
;;
ldf8 f34 = [up], 8
ldf8 f46 = [rp], 8
;;
ldf8 f35 = [up], 8
xma.l f36 = f7, f6, f8
ldf8 f47 = [rp], 8
xma.hu f40 = f7, f6, f8
br.cloop.dptk .grt4
xma.l f37 = f33, f6, f45
xma.hu f41 = f33, f6, f45
xma.l f38 = f34, f6, f46
xma.hu f42 = f34, f6, f46
;;
getf.sig r28 = f40
stf8 [r20] = f36, 8
xma.l f39 = f35, f6, f47
getf.sig r25 = f37
xma.hu f43 = f35, f6, f47
;;
getf.sig r29 = f41
getf.sig r26 = f38
getf.sig r30 = f42
getf.sig r27 = f39
br .Lcj4
.grt4:
ldf8 f32 = [up], 8
xma.l f37 = f33, f6, f45
ldf8 f44 = [rp], 8
xma.hu f41 = f33, f6, f45
;;
ldf8 f33 = [up], 8
xma.l f38 = f34, f6, f46
ldf8 f45 = [rp], 8
xma.hu f42 = f34, f6, f46
;;
ldf8 f34 = [up], 8
getf.sig r24 = f36 C FIXME
xma.l f39 = f35, f6, f47
ldf8 f46 = [rp], 8
getf.sig r28 = f40
xma.hu f43 = f35, f6, f47
;;
ldf8 f35 = [up], 8
getf.sig r25 = f37
ldf8 f47 = [rp], 8
br.cloop.dptk .grt8
getf.sig r29 = f41
stf8 [r20] = f36, 8 C FIXME
xma.l f36 = f32, f6, f44
getf.sig r26 = f38
getf.sig r30 = f42
xma.hu f40 = f32, f6, f44
;;
xma.l f37 = f33, f6, f45
getf.sig r27 = f39
xma.hu f41 = f33, f6, f45
br .Lcj8
.grt8:
getf.sig r29 = f41
xma.l f36 = f32, f6, f44
mov r31 = 0
xma.hu f40 = f32, f6, f44
;;
ldf8 f32 = [up], 8
getf.sig r26 = f38
br .LL00
C *** MAIN LOOP START ***
ALIGN(32) C insn fed cycle #
.Loop:
.pred.rel "mutex", p6, p7 C num by i1 i2
getf.sig r29 = f41 C 00 16 0 0
xma.l f36 = f32, f6, f44 C 01 06,15 0 0
(p6) add r14 = r30, r27, 1 C 02 0 0
ldf8 f47 = [rp], 8 C 03 0 0
xma.hu f40 = f32, f6, f44 C 04 06,15 0 0
(p7) add r14 = r30, r27 C 05 0 0
;;
.pred.rel "mutex", p6, p7
ldf8 f32 = [up], 8 C 06 1 1
(p6) cmp.leu p8, p9 = r14, r27 C 07 1 1
(p7) cmp.ltu p8, p9 = r14, r27 C 08 1 1
getf.sig r26 = f38 C 09 25 2 1
st8 [r20] = r14, 8 C 10 2 1
nop.b 0 C 11 2 1
;;
.LL00:
.pred.rel "mutex", p8, p9
getf.sig r30 = f42 C 12 28 3 2
xma.l f37 = f33, f6, f45 C 13 18,27 3 2
(p8) add r16 = r31, r24, 1 C 14 3 2
ldf8 f44 = [rp], 8 C 15 3 2
xma.hu f41 = f33, f6, f45 C 16 18,27 3 2
(p9) add r16 = r31, r24 C 17 3 2
;;
.pred.rel "mutex", p8, p9
ldf8 f33 = [up], 8 C 18 4 3
(p8) cmp.leu p6, p7 = r16, r24 C 19 4 3
(p9) cmp.ltu p6, p7 = r16, r24 C 20 4 3
getf.sig r27 = f39 C 21 37 5 3
st8 [r20] = r16, 8 C 22 5 3
nop.b 0 C 23 5 3
;;
.LL11:
.pred.rel "mutex", p6, p7
getf.sig r31 = f43 C 24 40 6 4
xma.l f38 = f34, f6, f46 C 25 30,39 6 4
(p6) add r14 = r28, r25, 1 C 26 6 4
ldf8 f45 = [rp], 8 C 27 6 4
xma.hu f42 = f34, f6, f46 C 28 30,39 6 4
(p7) add r14 = r28, r25 C 29 6 4
;;
.pred.rel "mutex", p6, p7
ldf8 f34 = [up], 8 C 30 7 5
(p6) cmp.leu p8, p9 = r14, r25 C 31 7 5
(p7) cmp.ltu p8, p9 = r14, r25 C 32 7 5
getf.sig r24 = f36 C 33 01 8 5
st8 [r20] = r14, 8 C 34 8 5
nop.b 0 C 35 8 5
;;
.LL10:
.pred.rel "mutex", p8, p9
getf.sig r28 = f40 C 36 04 9 6
xma.l f39 = f35, f6, f47 C 37 42,03 9 6
(p8) add r16 = r29, r26, 1 C 38 9 6
ldf8 f46 = [rp], 8 C 39 9 6
xma.hu f43 = f35, f6, f47 C 40 42,03 9 6
(p9) add r16 = r29, r26 C 41 9 6
;;
.pred.rel "mutex", p8, p9
ldf8 f35 = [up], 8 C 42 10 7
(p8) cmp.leu p6, p7 = r16, r26 C 43 10 7
(p9) cmp.ltu p6, p7 = r16, r26 C 44 10 7
getf.sig r25 = f37 C 45 13 11 7
st8 [r20] = r16, 8 C 46 11 7
br.cloop.dptk .Loop C 47 11 7
C *** MAIN LOOP END ***
;;
.Le0:
.pred.rel "mutex", p6, p7
getf.sig r29 = f41 C
xma.l f36 = f32, f6, f44 C
(p6) add r14 = r30, r27, 1 C
ldf8 f47 = [rp], 8 C
xma.hu f40 = f32, f6, f44 C
(p7) add r14 = r30, r27 C
;;
.pred.rel "mutex", p6, p7
(p6) cmp.leu p8, p9 = r14, r27 C
(p7) cmp.ltu p8, p9 = r14, r27 C
getf.sig r26 = f38 C
st8 [r20] = r14, 8 C
;;
.pred.rel "mutex", p8, p9
getf.sig r30 = f42 C
xma.l f37 = f33, f6, f45 C
(p8) add r16 = r31, r24, 1 C
xma.hu f41 = f33, f6, f45 C
(p9) add r16 = r31, r24 C
;;
.pred.rel "mutex", p8, p9
(p8) cmp.leu p6, p7 = r16, r24 C
(p9) cmp.ltu p6, p7 = r16, r24 C
getf.sig r27 = f39 C
st8 [r20] = r16, 8 C
;;
.Lcj8:
.pred.rel "mutex", p6, p7
getf.sig r31 = f43 C
xma.l f38 = f34, f6, f46 C
(p6) add r14 = r28, r25, 1 C
xma.hu f42 = f34, f6, f46 C
(p7) add r14 = r28, r25 C
;;
.pred.rel "mutex", p6, p7
(p6) cmp.leu p8, p9 = r14, r25 C
(p7) cmp.ltu p8, p9 = r14, r25 C
getf.sig r24 = f36 C
st8 [r20] = r14, 8 C
;;
.Lcj7:
.pred.rel "mutex", p8, p9
getf.sig r28 = f40 C
xma.l f39 = f35, f6, f47 C
(p8) add r16 = r29, r26, 1 C
xma.hu f43 = f35, f6, f47 C
(p9) add r16 = r29, r26 C
;;
.pred.rel "mutex", p8, p9
(p8) cmp.leu p6, p7 = r16, r26 C
(p9) cmp.ltu p6, p7 = r16, r26 C
getf.sig r25 = f37 C
st8 [r20] = r16, 8 C
;;
.Lcj6:
.pred.rel "mutex", p6, p7
getf.sig r29 = f41 C
(p6) add r14 = r30, r27, 1 C
(p7) add r14 = r30, r27 C
;;
.pred.rel "mutex", p6, p7
(p6) cmp.leu p8, p9 = r14, r27 C
(p7) cmp.ltu p8, p9 = r14, r27 C
getf.sig r26 = f38 C
st8 [r20] = r14, 8 C
;;
.Lcj5:
.pred.rel "mutex", p8, p9
getf.sig r30 = f42 C
(p8) add r16 = r31, r24, 1 C
(p9) add r16 = r31, r24 C
;;
.pred.rel "mutex", p8, p9
(p8) cmp.leu p6, p7 = r16, r24 C
(p9) cmp.ltu p6, p7 = r16, r24 C
getf.sig r27 = f39 C
st8 [r20] = r16, 8 C
;;
.Lcj4:
.pred.rel "mutex", p6, p7
getf.sig r8 = f43 C
(p6) add r14 = r28, r25, 1 C
(p7) add r14 = r28, r25 C
;;
.pred.rel "mutex", p6, p7
st8 [r20] = r14, 8 C
(p6) cmp.leu p8, p9 = r14, r25 C
(p7) cmp.ltu p8, p9 = r14, r25 C
;;
.Lcj3:
.pred.rel "mutex", p8, p9
(p8) add r16 = r29, r26, 1 C
(p9) add r16 = r29, r26 C
;;
.pred.rel "mutex", p8, p9
st8 [r20] = r16, 8 C
(p8) cmp.leu p6, p7 = r16, r26 C
(p9) cmp.ltu p6, p7 = r16, r26 C
;;
.Lcj2:
.pred.rel "mutex", p6, p7
(p6) add r14 = r30, r27, 1 C
(p7) add r14 = r30, r27 C
;;
.pred.rel "mutex", p6, p7
st8 [r20] = r14 C
(p6) cmp.leu p8, p9 = r14, r27 C
(p7) cmp.ltu p8, p9 = r14, r27 C
;;
(p8) add r8 = 1, r8 C M I
mov.i ar.lc = r2 C I0
br.ret.sptk.many b0 C B
EPILOGUE()
ASM_END()
|
programs/oeis/052/A052760.asm | neoneye/loda | 22 | 103944 | <filename>programs/oeis/052/A052760.asm
; A052760: Expansion of e.g.f.: x^2*(exp(x)-1)^2.
; 0,0,0,0,24,120,420,1260,3472,9072,22860,56100,134904,319176,745108,1719900,3931680,8912352,20053404,44825940,99613960,220200120,484441188,1061157900,2315254704,5033163600,10905189100,23555209860,50734299672,108984793512,233538844980,499289946300,1065151887424,2267742730176,4818953303868,10222022162100,21646635169320,45767171503512,96619584288004,203684529042540,428809534829520,901599534773040,1893359023026828,3971435999523300,8321103999004984,17416264183967880,36415825111936980,76068612456050460,158751886864805472,331014572611726752,689613692941102300,1435522381224340500,2985886552946633544,6205960286516537976,12889302133534353828,26751381786580740300,55484347409204504560,115003920084532979472,238222405889389749804,493162173595578787140,1020335531577059566680,2109846353430529958760,4360349130423095255668,9006622793988688568700,18594318026299228020864,38369227673315867352960,79136532076213976424060,163143004587887274483060,336173463999282868640872,692416985550761729448792,1425564382016274148874820,2933770177482767088998700,6035184365107406583093264,12410379116981427621582576,25510223740461823444374988,52418267959853061872014500,107669955809427910872257400,221082309262025310324380232,453800529537841426455318804,931175112558168121817419740,1910102794991114096035745440,3916919655551398526047997280,8029685293880366978398407708,16455898256594332326100454100,33714523257412778424205822344,69053842816387618459216758840,141395963862127028273634330340,289445855435412975524851467660,592354308798054461539230925872,1211943298460387289126242599632,2478974928668974000485496242540,5069364460873632225711913680900,10364034008897203661455467986584,21183629952251427264073813703976,43288287293731177452672575847348,88438436406547566838793434544700,180640210532522689713280206747840,368886324666414755835540632745792,753142912860596793164228791875004,1537343265426785206665126812300340
mov $2,$0
mov $5,2
bin $0,$5
mov $4,2
pow $4,$2
bin $5,4
add $$5,1
sub $0,1
sub $4,8
mul $0,$4
div $0,8
mul $0,4
|
src/iter/fibonacci.ads | shintakezou/adaplayground | 0 | 28383 | <filename>src/iter/fibonacci.ads
with Ada.Iterator_Interfaces;
package Fibonacci is
type Fibo_Cur is private;
function Has_Element (Pos : Fibo_Cur) return Boolean;
package Fibo is new Ada.Iterator_Interfaces (Fibo_Cur, Has_Element);
type Fibo_Type is tagged private;
type Fibo_List is tagged record
--X : Integer;
null;
end record
with
Default_Iterator => Iterate,
Iterator_Element => Fibo_Type'Class,
Constant_Indexing => Element_Value;
type Fibo_Forward
is new Fibo_Type and Fibo.Forward_Iterator with private; -- new Fibo_Type and Fibo.Forward_Iterator with null record;
type Fibo_Reversible
is new Fibo_Type and Fibo.Reversible_Iterator with private; -- new Fibo_Type and Fibo.Reversible_Iterator with null record;
function Element (C : Fibo_Cur) return Natural;
function Element (V : Fibo_Type'Class) return Natural;
function Element_Value
(C : Fibo_List; P : Fibo_Cur) return Fibo_Type'Class;
function Iterate
(C : Fibo_List) return Fibo.Forward_Iterator'Class;
overriding
function First (O : Fibo_Forward) return Fibo_Cur;
overriding
function Next (O : Fibo_Forward;
Pos : Fibo_Cur)
return Fibo_Cur;
overriding
function First (O : Fibo_Reversible) return Fibo_Cur;
overriding
function Next (O : Fibo_Reversible;
Pos : Fibo_Cur)
return Fibo_Cur;
overriding
function Last (O : Fibo_Reversible) return Fibo_Cur;
overriding
function Previous (O : Fibo_Reversible;
Pos : Fibo_Cur)
return Fibo_Cur;
procedure Put_Line (O : Fibo_Type'Class);
private
type Fibo_Cur is
record
Cur : Natural := 1;
Prev : Natural := 1;
end record;
type Fibo_Type is tagged record
Value : Natural;
Cursor : Fibo_Cur;
end record;
type Fibo_Forward is new Fibo_Type and Fibo.Forward_Iterator with null record;
type Fibo_Reversible is new Fibo_Type and Fibo.Reversible_Iterator with null record;
end Fibonacci;
|
source/action_lists.adb | jquorning/CELLE | 0 | 4543 | <gh_stars>0
with Symbols;
with States;
-- with Rules;
package body Action_Lists is
procedure Append (Action_List : in out List;
Kind : in Actions.Action_Kind;
Symbol : in Symbols.Symbol_Access;
State : in States.State_Access;
Rule : in Rule_Access)
is
use Actions;
-- New_Action : Action_Access;
Union : X_Union;
begin
if Kind = Shift then
Union.State := State;
else
Union.Rule := Rule;
end if;
Action_List.Append (Action_Record'(Kind => Kind,
Symbol => Symbol,
Symbol_Link => null,
X => Union,
Collide => null));
-- New_Action := new Action_Record; -- Action_New ();
-- New_Action.Next := Action;
-- Action := New_Action;
-- New_Action.Kind := Kind;
-- New_Action.Symbol := Symbol;
-- New_Action.spOpt := null;
-- if Kind = Shift then
-- New_Action.X.stp := State;
-- else
-- New_Action.X.Rule := Rule;
-- end if;
end Append;
package Action_Sorting is
new Action_DLLs.Generic_Sorting ("<" => Actions.Action_Cmp);
procedure Sort (Action_List : in out List)
-- procedure Action_Sort (Action_List : in out List)
-- function Action_Sort (Action : in Action_Access) return Action_Access
is
begin
Action_Sorting.Sort (Action_List);
-- static struct action *Action_sort(
-- struct action *ap
-- ){
-- ap = (struct action *)msort((char *)ap,(char **)&ap->next,
-- (int(*)(const char*,const char*))actioncmp);
-- return ap;
-- }
-- end Action_Sort;
end Sort;
end Action_Lists;
|
programs/oeis/257/A257845.asm | karttu/loda | 1 | 16036 | <reponame>karttu/loda
; A257845: a(n) = floor(n/5) * (n mod 5).
; 0,0,0,0,0,0,1,2,3,4,0,2,4,6,8,0,3,6,9,12,0,4,8,12,16,0,5,10,15,20,0,6,12,18,24,0,7,14,21,28,0,8,16,24,32,0,9,18,27,36,0,10,20,30,40,0,11,22,33,44,0,12,24,36,48,0,13,26,39,52,0,14,28,42,56,0,15,30,45,60,0,16,32,48,64,0,17,34,51,68,0,18,36,54,72,0,19,38,57,76,0,20,40,60,80,0,21,42,63,84,0,22,44,66,88,0,23,46,69,92,0,24,48,72,96,0,25,50,75,100,0,26,52,78,104,0,27,54,81,108,0,28,56,84,112,0,29,58,87,116,0,30,60,90,120,0,31,62,93,124,0,32,64,96,128,0,33,66,99,132,0,34,68,102,136,0,35,70,105,140,0,36,72,108,144,0,37,74,111,148,0,38,76,114,152,0,39,78,117,156,0,40,80,120,160,0,41,82,123,164,0,42,84,126,168,0,43,86,129,172,0,44,88,132,176,0,45,90,135,180,0,46,92,138,184,0,47,94,141,188,0,48,96,144,192,0,49,98,147,196
mov $1,$0
mod $1,5
sub $0,$1
mul $1,$0
div $1,5
|
Renderer.agda | nad/pretty | 0 | 11835 | <reponame>nad/pretty
------------------------------------------------------------------------
-- Document renderers
------------------------------------------------------------------------
{-# OPTIONS --guardedness #-}
module Renderer where
open import Algebra
open import Data.Bool
open import Data.Char using (Char)
open import Data.Empty
open import Data.Integer using (ℤ; +_; -[1+_]; _-_; _⊖_)
open import Data.List as List hiding ([_])
open import Data.List.NonEmpty using (_∷⁺_)
open import Data.List.Properties
open import Data.Nat
open import Data.Product
open import Data.String as String using (String)
open import Data.Unit
open import Function
open import Function.Equality using (_⟨$⟩_)
open import Function.Inverse using (module Inverse)
open import Relation.Binary.PropositionalEquality as P using (_≡_)
open import Relation.Nullary
open import Tactic.MonoidSolver
private
module LM {A : Set} = Monoid (++-monoid A)
open import Grammar.Infinite as G hiding (_⊛_; _<⊛_; _⊛>_)
open import Pretty using (Doc; Docs; Pretty-printer)
open Pretty.Doc
open Pretty.Docs
open import Utilities
------------------------------------------------------------------------
-- Renderers
record Renderer : Set₁ where
field
-- The function that renders.
render : ∀ {A} {g : Grammar A} {x : A} → Doc g x → List Char
-- The rendered string must be parsable.
parsable : ∀ {A} {g : Grammar A} {x : A}
(d : Doc g x) → x ∈ g · render d
----------------------------------------------------------------------
-- Some derived definitions and properties
-- Pretty-printers are correct by definition, for any renderer,
-- assuming that the underlying grammar is unambiguous.
correct :
∀ {A} {g : Grammar A} (pretty : Pretty-printer g) →
∀ x → x ∈ g · render (pretty x)
correct pretty x = parsable (pretty x)
correct-if-locally-unambiguous :
∀ {A} {g : Grammar A} →
(parse : Parser g) (pretty : Pretty-printer g) →
∀ x →
Locally-unambiguous g (render (pretty x)) →
∃ λ p → parse (render (pretty x)) ≡ yes (x , p)
correct-if-locally-unambiguous parse pretty x unambiguous = c
where
c : ∃ λ p → parse (render (pretty x)) ≡ yes (x , p)
c with parse (render (pretty x))
c | no no-parse = ⊥-elim (no-parse (x , correct pretty x))
c | yes (y , y∈g) with unambiguous y∈g (correct pretty x)
c | yes (.x , x∈g) | P.refl = (x∈g , P.refl)
correct-if-unambiguous :
∀ {A} {g : Grammar A} →
Unambiguous g → (parse : Parser g) (pretty : Pretty-printer g) →
∀ x → ∃ λ p → parse (render (pretty x)) ≡ yes (x , p)
correct-if-unambiguous unambiguous parse pretty x =
correct-if-locally-unambiguous parse pretty x unambiguous
-- If there is only one grammatically correct string, then the
-- renderer returns this string.
render-unique-string : ∀ {A} {g : Grammar A} {x s} →
(∀ {s′} → x ∈ g · s′ → s′ ≡ s) →
(d : Doc g x) → render d ≡ s
render-unique-string unique d = unique (parsable d)
-- Thus, in particular, documents for the grammar "string s" are
-- always rendered in the same way.
render-string : ∀ {s s′} (d : Doc (string s) s′) → render d ≡ s
render-string = render-unique-string λ s′∈ →
P.sym $ proj₂ (Inverse.to string-sem′ ⟨$⟩ s′∈)
-- The property of ignoring (top-level) emb constructors.
Ignores-emb : Set₁
Ignores-emb =
∀ {A B x y} {g₁ : Grammar A} {g₂ : Grammar B}
{f : ∀ {s} → x ∈ g₁ · s → y ∈ g₂ · s} {d : Doc g₁ x} →
render (emb f d) ≡ render d
-- If the renderer ignores emb constructors then, for every valid
-- string, there is a document that renders as that string. (The
-- renderers below ignore emb.)
every-string-possible :
Ignores-emb →
∀ {A} {g : Grammar A} {x s} →
x ∈ g · s → ∃ λ (d : Doc g x) → render d ≡ s
every-string-possible ignores-emb {g = g} {x} {s} x∈ =
(Pretty.embed lemma₁ text , lemma₂)
where
open P.≡-Reasoning
lemma₁ : ∀ {s′} → s ∈ string s · s′ → x ∈ g · s′
lemma₁ s∈ = cast (proj₂ (Inverse.to string-sem′ ⟨$⟩ s∈)) x∈
lemma₂ = begin
render (Pretty.embed lemma₁ text) ≡⟨ ignores-emb ⟩
render text ≡⟨ render-string _ ⟩
s ∎
------------------------------------------------------------------------
-- An example renderer
-- This renderer renders every occurrence of "line" as a single space
-- character.
ugly-renderer : Renderer
ugly-renderer = record
{ render = render
; parsable = parsable
}
where
mutual
render : ∀ {A} {g : Grammar A} {x} → Doc g x → List Char
render (d₁ ◇ d₂) = render d₁ ++ render d₂
render (text {s = s}) = s
render line = String.toList " "
render (group d) = render d
render (nest _ d) = render d
render (emb _ d) = render d
render (fill ds) = render-fills ds
render-fills : ∀ {A} {g : Grammar A} {x} → Docs g x → List Char
render-fills [ d ] = render d
render-fills (d ∷ ds) = render d ++ ' ' ∷ render-fills ds
mutual
parsable : ∀ {A x} {g : Grammar A}
(d : Doc g x) → x ∈ g · render d
parsable (d₁ ◇ d₂) = >>=-sem (parsable d₁) (parsable d₂)
parsable text = string-sem
parsable line = <$-sem single-space-sem
parsable (group d) = parsable d
parsable (nest _ d) = parsable d
parsable (emb f d) = f (parsable d)
parsable (fill ds) = parsable-fills ds
parsable-fills : ∀ {A xs} {g : Grammar A} (ds : Docs g xs) →
xs ∈ g sep-by whitespace + · render-fills ds
parsable-fills [ d ] = sep-by-sem-singleton (parsable d)
parsable-fills (d ∷ ds) =
sep-by-sem-∷ (parsable d) single-space-sem (parsable-fills ds)
-- The "ugly renderer" ignores emb constructors.
ugly-renderer-ignores-emb : Renderer.Ignores-emb ugly-renderer
ugly-renderer-ignores-emb = P.refl
------------------------------------------------------------------------
-- A general document property, proved using ugly-renderer
-- For every document of type Doc g x there is a string that witnesses
-- that the value x is generated by the grammar g.
string-exists : ∀ {A} {g : Grammar A} {x} →
Doc g x → ∃ λ s → x ∈ g · s
string-exists d = (render d , parsable d)
where open Renderer ugly-renderer
------------------------------------------------------------------------
-- An example renderer, based on the one in Wadler's "A prettier
-- printer"
module Wadler's-renderer where
-- Layouts (representations of certain strings).
data Layout-element : Set where
text : List Char → Layout-element
line : ℕ → Layout-element
Layout : Set
Layout = List Layout-element
-- Conversion of layouts into strings.
show-element : Layout-element → List Char
show-element (text s) = s
show-element (line i) = '\n' ∷ replicate i ' '
show : Layout → List Char
show = concat ∘ List.map show-element
-- Documents with unions instead of groups, and no fills. An extra
-- index—the nesting level—is also included, and the line
-- combinator's type is more precise (it can't be used for single
-- spaces, only for newline-plus-indentation).
infixr 20 _◇_
data DocN : ∀ {A} → ℕ → Grammar A → A → Set₁ where
_◇_ : ∀ {i c₁ c₂ A B x y}
{g₁ : ∞Grammar c₁ A} {g₂ : A → ∞Grammar c₂ B} →
DocN i (♭? g₁) x → DocN i (♭? (g₂ x)) y →
DocN i (g₁ >>= g₂) y
text : ∀ {i} (s : List Char) → DocN i (string s) s
line : (i : ℕ) →
let s = show-element (line i) in
DocN i (string s) s
union : ∀ {i A} {g : Grammar A} {x} →
DocN i g x → DocN i g x → DocN i g x
nest : ∀ {i A} {g : Grammar A} {x}
(j : ℕ) → DocN (j + i) g x → DocN i g x
emb : ∀ {i A B} {g₁ : Grammar A} {g₂ : Grammar B} {x y} →
(∀ {s} → x ∈ g₁ · s → y ∈ g₂ · s) →
DocN i g₁ x → DocN i g₂ y
-- Some derived combinators.
infix 21 <$>_
infixl 20 _⊛_ _⊛>_
embed : ∀ {i A B} {g₁ : Grammar A} {g₂ : Grammar B} {x y} →
(∀ {s} → x ∈ g₁ · s → y ∈ g₂ · s) → DocN i g₁ x → DocN i g₂ y
embed f (emb g d) = emb (f ∘ g) d
embed f d = emb f d
nil : ∀ {i A} {x : A} → DocN i (return x) x
nil = embed lemma (text [])
where
lemma : ∀ {x s} → [] ∈ string [] · s → x ∈ return x · s
lemma return-sem = return-sem
<$>_ : ∀ {i c A B} {f : A → B} {x} {g : ∞Grammar c A} →
DocN i (♭? g) x → DocN i (f <$> g) (f x)
<$> d = embed <$>-sem d
_⊛_ : ∀ {i c₁ c₂ A B f x} {g₁ : ∞Grammar c₁ (A → B)}
{g₂ : ∞Grammar c₂ A} →
DocN i (♭? g₁) f → DocN i (♭? g₂) x → DocN i (g₁ G.⊛ g₂) (f x)
_⊛_ {g₁ = g₁} {g₂} d₁ d₂ = embed lemma (d₁ ◇ <$> d₂)
where
lemma : ∀ {x s} →
x ∈ (g₁ >>= λ f → f <$> g₂) · s → x ∈ g₁ G.⊛ g₂ · s
lemma (>>=-sem f∈ (<$>-sem x∈)) = ⊛-sem f∈ x∈
_⊛>_ : ∀ {i c₁ c₂ A B x y} {g₁ : ∞Grammar c₁ A}
{g₂ : ∞Grammar c₂ B} →
DocN i (♭? g₁) x → DocN i (♭? g₂) y → DocN i (g₁ G.⊛> g₂) y
_⊛>_ {g₁ = g₁} {g₂} d₁ d₂ =
embed lemma (nil ⊛ d₁ ⊛ d₂)
where
lemma : ∀ {y s} →
y ∈ return (λ _ x → x) G.⊛ g₁ G.⊛ g₂ · s →
y ∈ g₁ G.⊛> g₂ · s
lemma (⊛-sem (⊛-sem return-sem x∈) y∈) = ⊛>-sem x∈ y∈
cons : ∀ {i A B} {g : Grammar A} {sep : Grammar B} {x xs} →
DocN i g x → DocN i (tt <$ sep) tt → DocN i (g sep-by sep) xs →
DocN i (g sep-by sep) (x ∷⁺ xs)
cons {g = g} {sep} d₁ d₂ d₃ =
embed lemma (<$> d₁ ⊛ (d₂ ⊛> d₃))
where
lemma : ∀ {ys s} →
ys ∈ _∷⁺_ <$> g G.⊛ ((tt <$ sep) G.⊛> (g sep-by sep)) · s →
ys ∈ g sep-by sep · s
lemma (⊛-sem (<$>-sem x∈) (⊛>-sem (<$-sem y∈) xs∈)) =
sep-by-sem-∷ x∈ y∈ xs∈
-- A single space character.
imprecise-space : ∀ {i} → DocN i (tt <$ whitespace +) tt
imprecise-space = embed lemma (text (String.toList " "))
where
lemma : ∀ {s} →
String.toList " " ∈ string′ " " · s →
tt ∈ tt <$ whitespace + · s
lemma s∈ =
cast (proj₂ (Inverse.to string-sem′ ⟨$⟩ s∈))
(<$-sem single-space-sem)
-- A variant of line that has the same type as Pretty.line (except
-- for the indentation index).
imprecise-line : (i : ℕ) → DocN i (tt <$ whitespace +) tt
imprecise-line i = embed lemma (line i)
where
replicate-lemma :
∀ i → replicate i ' ' ∈ whitespace ⋆ · replicate i ' '
replicate-lemma zero = ⋆-[]-sem
replicate-lemma (suc i) =
⋆-∷-sem (left-sem tok-sem) (replicate-lemma i)
lemma : ∀ {i s′} →
let s = show-element (line i) in
s ∈ string s · s′ → tt ∈ tt <$ whitespace + · s′
lemma s∈ =
cast (proj₂ (Inverse.to string-sem′ ⟨$⟩ s∈))
(<$-sem (+-sem (right-sem tok-sem) (replicate-lemma _)))
mutual
-- Replaces line constructors with single spaces, removes groups.
flatten : ∀ {i A} {g : Grammar A} {x} → Doc g x → DocN i g x
flatten (d₁ ◇ d₂) = flatten d₁ ◇ flatten d₂
flatten text = text _
flatten line = imprecise-space
flatten (group d) = flatten d
flatten (nest _ d) = flatten d
flatten (emb f d) = embed f (flatten d)
flatten (fill ds) = flatten-fills ds
flatten-fills : ∀ {i A} {g : Grammar A} {xs} →
Docs g xs → DocN i (g sep-by whitespace +) xs
flatten-fills [ d ] = embed sep-by-sem-singleton (flatten d)
flatten-fills (d ∷ ds) =
cons (flatten d) imprecise-space (flatten-fills ds)
mutual
-- Converts ("expands") groups to unions.
expand : ∀ {i A} {g : Grammar A} {x} → Doc g x → DocN i g x
expand (d₁ ◇ d₂) = expand d₁ ◇ expand d₂
expand text = text _
expand line = imprecise-line _
expand (group d) = union (flatten d) (expand d)
expand (nest j d) = nest j (expand d)
expand (emb f d) = embed f (expand d)
expand (fill ds) = expand-fills false ds
expand-fills : Bool → -- Unconditionally flatten the first document?
∀ {i A} {g : Grammar A} {xs} →
Docs g xs → DocN i (g sep-by whitespace +) xs
expand-fills fl [ d ] =
embed sep-by-sem-singleton (flatten/expand fl d)
expand-fills fl (d ∷ ds) =
union (cons (flatten d) imprecise-space (expand-fills true ds))
(cons (flatten/expand fl d) (imprecise-line _) (expand-fills false ds))
flatten/expand : Bool → -- Flatten?
∀ {i A} {g : Grammar A} {x} → Doc g x → DocN i g x
flatten/expand true d = flatten d
flatten/expand false d = expand d
-- Does the first line of the layout fit on a line with the given
-- number of characters?
fits : ℤ → Layout → Bool
fits -[1+ w ] _ = false
fits w [] = true
fits w (text s ∷ x) = fits (w - + length s) x
fits w (line i ∷ x) = true
module _ (width : ℕ) where
-- Chooses the first layout if it fits, otherwise the second. The
-- natural number is the current column number.
better : ℕ → Layout → Layout → Layout
better c x y = if fits (width ⊖ c) x then x else y
-- If, for any starting column c, κ c is the layout for some text,
-- then best i d κ c is the layout for the document d followed by
-- this text, given the current indentation i and the current column
-- number c.
best : ∀ {i A} {g : Grammar A} {x} →
DocN i g x → (ℕ → Layout) → (ℕ → Layout)
best (d₁ ◇ d₂) = best d₁ ∘ best d₂
best (text []) = id
best (text s) = λ κ c → text s ∷ κ (length s + c)
best (line i) = λ κ _ → line i ∷ κ i
best (union d₁ d₂) = λ κ c → better c (best d₁ κ c)
(best d₂ κ c)
best (nest _ d) = best d
best (emb _ d) = best d
-- Renders a document.
renderN : ∀ {A i} {g : Grammar A} {x} → DocN i g x → List Char
renderN d = show (best d (λ _ → []) 0)
-- Renders a document.
render : ∀ {A} {g : Grammar A} {x} → Doc g x → List Char
render d = renderN (expand {i = 0} d)
-- A simple lemma.
if-lemma :
∀ {A} {g : Grammar A} {x l₁ l₂} s b →
x ∈ g · s ++ show l₁ →
x ∈ g · s ++ show l₂ →
x ∈ g · s ++ show (if b then l₁ else l₂)
if-lemma _ true ∈l₁ ∈l₂ = ∈l₁
if-lemma _ false ∈l₁ ∈l₂ = ∈l₂
-- The main correctness property for best.
best-lemma :
∀ {c A B i} {g : Grammar A} {g′ : Grammar B} {x y κ}
s (d : DocN i g x) →
(∀ {s′ c′} → x ∈ g · s′ → y ∈ g′ · s ++ s′ ++ show (κ c′)) →
y ∈ g′ · s ++ show (best d κ c)
best-lemma s (text []) hyp = hyp return-sem
best-lemma s (text (_ ∷ _)) hyp = hyp string-sem
best-lemma s (line i) hyp = hyp string-sem
best-lemma {c} s (union d₁ d₂) hyp = if-lemma s
(fits (width ⊖ c) _)
(best-lemma s d₁ hyp)
(best-lemma s d₂ hyp)
best-lemma s (nest _ d) hyp = best-lemma s d hyp
best-lemma s (emb f d) hyp = best-lemma s d (hyp ∘ f)
best-lemma s (d₁ ◇ d₂) hyp =
best-lemma s d₁ λ {s′} f∈ →
cast (LM.assoc s _ _)
(best-lemma (s ++ s′) d₂ λ x∈ →
cast lemma
(hyp (>>=-sem f∈ x∈)))
where
lemma :
∀ {s′ s″ s‴} →
s ++ (s′ ++ s″) ++ s‴ ≡ (s ++ s′) ++ s″ ++ s‴
lemma = solve (++-monoid Char)
-- A corollary.
best-lemma′ :
∀ {A i} {g : Grammar A} {x}
(d : DocN i g x) → x ∈ g · renderN d
best-lemma′ d = best-lemma [] d (cast (P.sym $ proj₂ LM.identity _))
-- The renderer is correct.
parsable : ∀ {A} {g : Grammar A} {x}
(d : Doc g x) → x ∈ g · render d
parsable d = best-lemma′ (expand d)
-- The renderer.
wadler's-renderer : Renderer
wadler's-renderer = record
{ render = render
; parsable = parsable
}
-- The renderer ignores emb constructors.
ignores-emb :
∀ {w} → Renderer.Ignores-emb (wadler's-renderer w)
ignores-emb {d = d} with expand {i = 0} d
... | _ ◇ _ = P.refl
... | text _ = P.refl
... | line ._ = P.refl
... | union _ _ = P.refl
... | nest _ _ = P.refl
... | emb _ _ = P.refl
-- A (heterogeneous) notion of document equivalence.
infix 4 _≈_
_≈_ : ∀ {A₁ i₁ g₁} {x₁ : A₁}
{A₂ i₂ g₂} {x₂ : A₂} →
DocN i₁ g₁ x₁ → DocN i₂ g₂ x₂ → Set
d₁ ≈ d₂ = ∀ width → renderN width d₁ ≡ renderN width d₂
-- Some laws satisfied by the DocN combinators.
text-++ : ∀ {i₁ i₂} s₁ s₂ →
text {i = i₁} (s₁ ++ s₂) ≈
_⊛>_ {c₁ = false} {c₂ = false} (text {i = i₂} s₁) (text s₂)
text-++ [] [] _ = P.refl
text-++ [] (t₂ ∷ s₂) _ = P.refl
text-++ (t₁ ∷ s₁) [] _ = lemma
where
lemma : ∀ {s₁} → (s₁ ++ []) ++ [] ≡ s₁ ++ []
lemma = solve (++-monoid Char)
text-++ (t₁ ∷ s₁) (t₂ ∷ s₂) _ = lemma (_ ∷ s₁)
where
lemma : ∀ s₁ {s₂} → (s₁ ++ s₂) ++ [] ≡ s₁ ++ s₂ ++ []
lemma _ = solve (++-monoid Char)
nest-union : ∀ {A i j g} {x : A} {d₁ d₂ : DocN (j + i) g x} →
nest j (union d₁ d₂) ≈ union (nest j d₁) (nest j d₂)
nest-union _ = P.refl
union-◇ : ∀ {A B i x y c₁ c₂}
{g₁ : ∞Grammar c₁ A} {g₂ : A → ∞Grammar c₂ B}
{d₁ d₂ : DocN i (♭? g₁) x} {d₃ : DocN i (♭? (g₂ x)) y} →
_◇_ {g₁ = g₁} {g₂ = g₂} (union d₁ d₂) d₃ ≈
union (d₁ ◇ d₃) (_◇_ {g₁ = g₁} {g₂ = g₂} d₂ d₃)
union-◇ _ = P.refl
-- A law that is /not/ satisfied by the DocN combinators.
¬-◇-union :
¬ (∀ {A B i x y} c₁ c₂
{g₁ : ∞Grammar c₁ A} {g₂ : A → ∞Grammar c₂ B}
(d₁ : DocN i (♭? g₁) x) (d₂ d₃ : DocN i (♭? (g₂ x)) y) →
_◇_ {g₁ = g₁} {g₂ = g₂} d₁ (union d₂ d₃) ≈
union (d₁ ◇ d₂) (_◇_ {g₁ = g₁} {g₂ = g₂} d₁ d₃))
¬-◇-union hyp with hyp false false d₁ d₂ d₁ 0
where
d₁ = imprecise-line 0
d₂ = imprecise-space
-- The following four definitions are not part of the proof.
left : DocN 0 _ _
left = _◇_ {c₁ = false} {c₂ = false} d₁ (union d₂ d₁)
right : DocN 0 _ _
right = union (d₁ ◇ d₂) (_◇_ {c₁ = false} {c₂ = false} d₁ d₁)
-- Note that left and right are not rendered in the same way.
left-hand-string : renderN 0 left ≡ String.toList "\n\n"
left-hand-string = P.refl
right-hand-string : renderN 0 right ≡ String.toList "\n "
right-hand-string = P.refl
... | ()
-- Uses Wadler's-renderer.render to render a document using the
-- given line width.
render : ∀ {A} {g : Grammar A} {x} → ℕ → Doc g x → String
render w d = String.fromList (Wadler's-renderer.render w d)
|
case-studies/performance/verification/alloy/ppc/tests/bclwdww026.als | uwplse/memsynth | 19 | 563 | <filename>case-studies/performance/verification/alloy/ppc/tests/bclwdww026.als
module tests/bclwdww026
open program
open model
/**
PPC bclwdww026
"LwSyncsRR Fre LwSyncdWW Rfe DpsR Fre LwSyncdWW Rfe"
Cycle=LwSyncsRR Fre LwSyncdWW Rfe DpsR Fre LwSyncdWW Rfe
Relax=BCLwSyncdWW
Safe=Fre LwSyncsRR DpsR
{
0:r2=y; 0:r4=x;
1:r2=x;
2:r2=x; 2:r4=y;
3:r2=y;
}
P0 | P1 | P2 | P3 ;
li r1,2 | lwz r1,0(r2) | li r1,2 | lwz r1,0(r2) ;
stw r1,0(r2) | xor r3,r1,r1 | stw r1,0(r2) | lwsync ;
lwsync | lwzx r4,r3,r2 | lwsync | lwz r3,0(r2) ;
li r3,1 | | li r3,1 | ;
stw r3,0(r4) | | stw r3,0(r4) | ;
exists
(x=2 /\ y=2 /\ 1:r1=1 /\ 1:r4=1 /\ 3:r1=1 /\ 3:r3=1)
**/
one sig x, y extends Location {}
one sig P1, P2, P3, P4 extends Processor {}
one sig op1 extends Write {}
one sig op2 extends Lwsync {}
one sig op3 extends Write {}
one sig op4 extends Read {}
one sig op5 extends Read {}
one sig op6 extends Write {}
one sig op7 extends Lwsync {}
one sig op8 extends Write {}
one sig op9 extends Read {}
one sig op10 extends Lwsync {}
one sig op11 extends Read {}
fact {
P1.write[1, op1, y, 2]
P1.lwsync[2, op2]
P1.write[3, op3, x, 1]
P2.read[4, op4, x, 1]
P2.read[5, op5, x, 1] and op5.dep[op4]
P3.write[6, op6, x, 2]
P3.lwsync[7, op7]
P3.write[8, op8, y, 1]
P4.read[9, op9, y, 1]
P4.lwsync[10, op10]
P4.read[11, op11, y, 1]
}
fact {
y.final[2]
x.final[2]
}
Allowed:
run { Allowed_PPC } for 5 int expect 0 |
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1495.asm | ljhsiun2/medusa | 9 | 160242 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0xc79b, %rsi
lea addresses_A_ht+0x1559b, %rdi
xor $28861, %r10
mov $95, %rcx
rep movsw
nop
nop
nop
nop
xor $7429, %rdx
lea addresses_WC_ht+0x1489b, %rsi
lea addresses_A_ht+0x849b, %rdi
nop
nop
cmp $64615, %r11
mov $97, %rcx
rep movsb
nop
nop
nop
nop
nop
add $7125, %rdi
lea addresses_WC_ht+0x108b1, %r11
nop
nop
nop
nop
nop
add %rdx, %rdx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
movups %xmm3, (%r11)
and $36423, %rdx
lea addresses_WT_ht+0x1b05b, %rsi
lea addresses_normal_ht+0x10b1b, %rdi
nop
nop
nop
nop
nop
add $27038, %rax
mov $73, %rcx
rep movsl
nop
nop
nop
nop
nop
dec %r11
lea addresses_normal_ht+0x110b2, %r10
nop
nop
nop
nop
nop
sub %rdx, %rdx
mov (%r10), %ecx
nop
nop
nop
xor %r11, %r11
lea addresses_normal_ht+0x16c5b, %rcx
clflush (%rcx)
and %rdi, %rdi
movb $0x61, (%rcx)
nop
nop
add $38624, %rdx
lea addresses_WC_ht+0xb4db, %r10
nop
and $25821, %rdi
vmovups (%r10), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %rcx
and $13652, %rdx
lea addresses_A_ht+0x1025b, %rsi
lea addresses_WC_ht+0x18b32, %rdi
nop
nop
nop
nop
nop
sub $41452, %rbx
mov $85, %rcx
rep movsw
nop
nop
sub $31913, %rsi
lea addresses_WC_ht+0x85b, %rsi
clflush (%rsi)
nop
nop
nop
nop
xor $27275, %rdx
mov (%rsi), %ax
nop
nop
nop
inc %rsi
lea addresses_WC_ht+0x6f2b, %rdi
and $28672, %rdx
movb $0x61, (%rdi)
nop
nop
add %rdx, %rdx
lea addresses_normal_ht+0x205b, %rax
nop
sub $17400, %rcx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm3
vmovups %ymm3, (%rax)
nop
nop
nop
and %rdx, %rdx
lea addresses_UC_ht+0x1a25b, %r11
cmp $14616, %rax
movb (%r11), %cl
add $16583, %r10
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r15
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
// Load
lea addresses_UC+0x1965b, %r11
nop
nop
add $35044, %rcx
mov (%r11), %r13
nop
nop
nop
and %r13, %r13
// Store
lea addresses_UC+0x182db, %r15
nop
nop
nop
nop
dec %rbx
movw $0x5152, (%r15)
nop
nop
nop
nop
nop
add $6134, %r15
// Store
lea addresses_A+0x585b, %r13
nop
nop
nop
dec %rdx
mov $0x5152535455565758, %rcx
movq %rcx, %xmm5
vmovups %ymm5, (%r13)
nop
nop
nop
nop
sub %r13, %r13
// Store
lea addresses_UC+0x2ddb, %rdx
nop
add %r11, %r11
mov $0x5152535455565758, %rdi
movq %rdi, %xmm1
vmovups %ymm1, (%rdx)
nop
nop
nop
add $60169, %r15
// Store
lea addresses_UC+0x847b, %r11
inc %rcx
mov $0x5152535455565758, %rbx
movq %rbx, %xmm7
vmovups %ymm7, (%r11)
nop
nop
nop
sub %rdx, %rdx
// Store
lea addresses_A+0x1ea5b, %rcx
nop
sub %r13, %r13
mov $0x5152535455565758, %r15
movq %r15, %xmm2
vmovups %ymm2, (%rcx)
nop
cmp $54458, %rcx
// Store
lea addresses_UC+0x18a5b, %r15
nop
nop
nop
nop
xor %rdx, %rdx
movl $0x51525354, (%r15)
nop
nop
nop
inc %rcx
// Store
lea addresses_WT+0x1fb5b, %r11
nop
xor $2036, %r13
movl $0x51525354, (%r11)
nop
nop
nop
add $65156, %rbx
// REPMOV
lea addresses_PSE+0x1c34b, %rsi
lea addresses_WT+0x1c35b, %rdi
nop
nop
sub %rbx, %rbx
mov $112, %rcx
rep movsb
nop
nop
add %rsi, %rsi
// Faulty Load
lea addresses_UC+0xf85b, %r11
nop
nop
and $30581, %rcx
mov (%r11), %rbx
lea oracles, %rdi
and $0xff, %rbx
shlq $12, %rbx
mov (%rdi,%rbx,1), %rbx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC', 'same': False, 'size': 8, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_PSE', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
oeis/052/A052574.asm | neoneye/loda-programs | 11 | 26215 | <reponame>neoneye/loda-programs
; A052574: E.g.f. (1-2x)/(1-3x+x^2).
; Submitted by <NAME>
; 1,1,4,30,312,4080,64080,1174320,24595200,579519360,15172012800,436929292800,13726748851200,467182235520000,17123385600921600,672444082582272000,28167703419727872000,1253648083943743488000
mov $1,-1
mov $2,1
mov $3,$0
lpb $3
mul $1,$3
mul $2,$3
add $1,$2
add $2,$1
sub $3,1
lpe
mov $0,$2
|
oeis/250/A250015.asm | neoneye/loda-programs | 11 | 29950 | ; A250015: Number of length 1+5 0..n arrays with no six consecutive terms having the maximum of any three terms equal to the minimum of the remaining three terms.
; Submitted by <NAME>(s4)
; 20,300,2040,8840,28860,77700,182000,383760,745380,1355420,2335080,3845400,6095180,9349620,13939680,20272160,28840500,40236300,55161560,74441640,99038940,130067300,168807120,216721200,275471300,346935420,433225800,536707640,660018540,806088660,978161600,1179816000,1414987860,1687993580,2003553720,2366817480,2783387900,3259347780,3801286320,4416326480,5112153060,5897041500,6779887400,7770236760,8878316940,10115068340,11492176800,13022106720,14718134900,16594385100,18665863320,20948493800
add $0,2
bin $0,2
mov $1,$0
mul $0,2
pow $0,2
add $0,2
add $1,1
mul $1,$0
mov $0,$1
sub $0,12
mul $0,2
add $0,20
|
alloy4fun_models/trashltl/models/16/36v4iF7ymg9ecANhb.als | Kaixi26/org.alloytools.alloy | 0 | 5071 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred id36v4iF7ymg9ecANhb_prop17 {
all f: File |eventually (always f in Trash implies File' = File - f)
}
pred __repair { id36v4iF7ymg9ecANhb_prop17 }
check __repair { id36v4iF7ymg9ecANhb_prop17 <=> prop17o } |
programs/oeis/177/A177189.asm | karttu/loda | 0 | 16572 | <gh_stars>0
; A177189: Partial sums of round(n^2/16).
; 0,0,0,1,2,4,6,9,13,18,24,32,41,52,64,78,94,112,132,155,180,208,238,271,307,346,388,434,483,536,592,652,716,784,856,933,1014,1100,1190,1285,1385,1490,1600,1716,1837,1964,2096,2234,2378,2528,2684,2847,3016,3192,3374,3563,3759,3962,4172,4390,4615,4848,5088,5336,5592,5856,6128,6409,6698,6996,7302,7617,7941,8274,8616,8968,9329,9700,10080,10470,10870,11280,11700,12131,12572,13024,13486,13959,14443,14938,15444,15962,16491,17032,17584,18148,18724,19312,19912,20525,21150,21788,22438,23101,23777,24466,25168,25884,26613,27356,28112,28882,29666,30464,31276,32103,32944,33800,34670,35555,36455,37370,38300,39246,40207,41184,42176,43184,44208,45248,46304,47377,48466,49572,50694,51833,52989,54162,55352,56560,57785,59028,60288,61566,62862,64176,65508,66859,68228,69616,71022,72447,73891,75354,76836,78338,79859,81400,82960,84540,86140,87760,89400,91061,92742,94444,96166,97909,99673,101458,103264,105092,106941,108812,110704,112618,114554,116512,118492,120495,122520,124568,126638,128731,130847,132986,135148,137334,139543,141776,144032,146312,148616,150944,153296,155673,158074,160500,162950,165425,167925,170450,173000,175576,178177,180804,183456,186134,188838,191568,194324,197107,199916,202752,205614,208503,211419,214362,217332,220330,223355,226408,229488,232596,235732,238896,242088,245309,248558,251836,255142,258477,261841,265234,268656,272108,275589,279100,282640,286210,289810,293440,297100,300791,304512,308264,312046,315859,319703,323578
mov $2,$0
mov $4,$0
lpb $4,1
mov $0,$2
sub $4,1
sub $0,$4
mov $3,$0
mul $3,$0
mov $5,$3
div $5,8
add $5,1
div $5,2
add $1,$5
lpe
|
programs/oeis/035/A035022.asm | neoneye/loda | 22 | 93405 | ; A035022: One eighth of 9-factorial numbers.
; 1,17,442,15470,680680,36076040,2236714480,158806728080,12704538246400,1130703903929600,110808982585100800,11856561136605785600,1375361091846271129600,171920136480783891200000
mov $1,1
mov $2,8
lpb $0
sub $0,1
add $2,9
mul $1,$2
lpe
mov $0,$1
|
Transynther/x86/_processed/AVXALIGN/_st_zr_4k_/i9-9900K_12_0xca.log_21829_70.asm | ljhsiun2/medusa | 9 | 12621 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x1a7be, %r13
nop
nop
nop
sub $17247, %r10
movl $0x61626364, (%r13)
nop
nop
nop
nop
sub $49947, %r8
lea addresses_WC_ht+0x1156e, %rsi
lea addresses_WT_ht+0x257e, %rdi
sub $7123, %rdx
mov $83, %rcx
rep movsq
nop
add $32038, %r8
lea addresses_A_ht+0x95ee, %r8
nop
nop
nop
nop
nop
cmp %rdx, %rdx
movl $0x61626364, (%r8)
nop
nop
nop
nop
nop
sub %r10, %r10
lea addresses_WC_ht+0xe52e, %rsi
nop
nop
and %r8, %r8
movb (%rsi), %cl
and $41713, %r13
lea addresses_normal_ht+0xbd3f, %r10
clflush (%r10)
nop
xor %rdi, %rdi
movb (%r10), %r8b
xor %r13, %r13
lea addresses_D_ht+0xe5ee, %r8
nop
nop
xor $17388, %r13
movups (%r8), %xmm2
vpextrq $1, %xmm2, %rdx
nop
nop
nop
nop
add $32269, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r9
push %rcx
push %rdx
push %rsi
// Store
mov $0x5ee, %r13
cmp $23708, %rdx
movl $0x51525354, (%r13)
nop
sub $11627, %r13
// Store
lea addresses_D+0xe2ae, %rsi
nop
dec %rcx
movb $0x51, (%rsi)
nop
nop
nop
and $5780, %rcx
// Store
lea addresses_US+0x15aee, %r9
nop
cmp $1938, %r13
movb $0x51, (%r9)
nop
nop
nop
nop
nop
sub %rcx, %rcx
// Store
lea addresses_RW+0x271a, %rsi
nop
nop
nop
nop
dec %rcx
mov $0x5152535455565758, %r11
movq %r11, (%rsi)
nop
nop
nop
nop
sub %r12, %r12
// Store
mov $0x2f23130000000dee, %r9
dec %rsi
movb $0x51, (%r9)
nop
cmp %r12, %r12
// Faulty Load
lea addresses_UC+0x3dee, %rsi
nop
nop
nop
nop
nop
and %r9, %r9
mov (%rsi), %r12
lea oracles, %r9
and $0xff, %r12
shlq $12, %r12
mov (%r9,%r12,1), %r12
pop %rsi
pop %rdx
pop %rcx
pop %r9
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 11}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 8, 'NT': True, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': True, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': True, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'51': 21827, '00': 2}
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
*/
|
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver0/sfc/ys_exst.asm | prismotizm/gigaleak | 0 | 83654 | <filename>other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver0/sfc/ys_exst.asm
Name: ys_exst.asm
Type: file
Size: 110384
Last-Modified: '2016-05-13T04:50:38Z'
SHA-1: 9CD36FCA8FA7CDCEFC2D49524BDF8BABB4392CF2
Description: null
|
programs/oeis/158/A158659.asm | neoneye/loda | 22 | 168817 | <reponame>neoneye/loda<filename>programs/oeis/158/A158659.asm
; A158659: a(n) = 784*n^2 + 28.
; 28,812,3164,7084,12572,19628,28252,38444,50204,63532,78428,94892,112924,132524,153692,176428,200732,226604,254044,283052,313628,345772,379484,414764,451612,490028,530012,571564,614684,659372,705628,753452,802844,853804,906332,960428,1016092,1073324,1132124,1192492,1254428,1317932,1383004,1449644,1517852,1587628,1658972,1731884,1806364,1882412,1960028,2039212,2119964,2202284,2286172,2371628,2458652,2547244,2637404,2729132,2822428,2917292,3013724,3111724,3211292,3312428,3415132,3519404,3625244,3732652,3841628,3952172,4064284,4177964,4293212,4410028,4528412,4648364,4769884,4892972,5017628,5143852,5271644,5401004,5531932,5664428,5798492,5934124,6071324,6210092,6350428,6492332,6635804,6780844,6927452,7075628,7225372,7376684,7529564,7684012
mul $0,28
pow $0,2
add $0,28
|
test/fail/ATPBadType2.agda | asr/eagda | 1 | 5273 | -- An ATP type must be used with data-types or postulates.
-- This error is detected by TypeChecking.Rules.Decl.
module ATPBadType2 where
foo : Set → Set
foo A = A
{-# ATP type foo #-}
|
ParserMATLABHeader/MATLABHeaderLexer.g4 | dullin/MATLAB-Header-Generator | 0 | 5100 | lexer grammar MATLABHeaderLexer;
//Keywords
SYNTAX : 'Syntax:';
INPUTS : 'Inputs:';
OUTPUTS : 'Outputs:';
EXAMPLE : 'Example:';
OTHERM : 'Other m-files:';
ALSO : 'See also:';
COMMENT : '%';
LBRACK : '[';
RBRACK : ']';
SEPARATOR : '-';
COMMA : ',';
SYNTAX_ID: [=()];
NL : '\r'?'\n' -> skip;
WS : SPACE+ -> skip ;
fragment
SPACE : [ \t] ;
UNICODE_ID : [\p{Alnum}\p{General_Category=Other_Letter}_]*;
ANY : .; |
test/Succeed/Issue234.agda | cruhland/agda | 1,989 | 6748 | <filename>test/Succeed/Issue234.agda
-- There was a problem with reordering telescopes.
module Issue234 where
postulate
A : Set
P : A → Set
data List : Set where
_∷ : A → List
data _≅_ {x : A}(p : P x) : ∀ {y} → P y → Set where
refl : p ≅ p
data _≡_ (x : A) : A → Set where
refl : x ≡ x
data Any (x : A) : Set where
here : P x → Any x
it : ∀ {x : A} → Any x → A
it {x} (here _) = x
prf : ∀ {x : A}(p : Any x) → P (it p)
prf (here px) = px
foo : (x : A) (p : Any x) →
(f : ∀ {y} → it p ≡ y → P y) →
f refl ≅ prf p →
Set₁
foo x (here ._) f refl = Set
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/tail_call_p.ads | best08618/asylo | 7 | 21037 | <gh_stars>1-10
package Tail_Call_P is
type T is new Natural;
type Index is (First, Second);
type A is array (Index) of T;
My_Array : A := (0, 0);
procedure Insert (Into : A; Element : T; Value : T);
end Tail_Call_P;
|
id3/id8.ada | hulpke/smallgrp | 5 | 25992 | <gh_stars>1-10
#############################################################################
##
#W id8.ada GAP library of id's <NAME>
##
ID_GROUP_TREE.next[8].next[1].next[105]:=
rec(
fp:= [ 4304, 6104, 6704, 7004, 7304, 7604, 7904, 8204, 8504, 8804, 9104,
9404, 9704, 10004, 12704, 13904, 14504, 16304, 17504, 19304, 19604, 19904,
20204, 22304, 23804, 24104, 24404, 24704, 25004, 25304, 27104, 27404, 27704,
28904, 29204, 30104, 30404, 30704, 31004, 31304, 31604, 32204, 32504, 32804,
33104, 33404, 33704, 34304, 34604, 34904, 35204, 35804, 36104, 36404, 36704,
37004, 37304, 37904, 38204, 39104, 39404, 39704, 40004, 40304, 40604, 40904,
41504, 41804, 42104, 42404, 42704, 43304, 43604, 44204, 44504, 44804, 45104,
45404, 46604, 46904, 47204, 47504, 47804, 48404, 48704, 49004, 49304, 49604,
49904, 50204, 50504, 50804, 51104, 51704, 52004, 52304, 52604, 52904, 53204,
55304, 55904 ],
next:= [ rec(
fp:= [ 167, 466 ],
next:= [ rec(
desc:= [ 302004, 302006, 302008, 302010, 40309013 ],
fp:= [ 2, 30821 ],
next:= [ 78132, 78130 ] ), rec(
desc:= [ 302004, 302006, 302008, 302010, 40209010 ],
fp:= [ 15764, 15863, 15962 ],
next:= [ 78134, rec(
desc:= [ 309014, 309016, 40912012 ],
fp:= [ 5522, 5621 ],
next:= [ 78131, 78129 ] ), 78128 ] ) ] ), rec(
fp:= [ 118 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 87266, 87270 ] ) ] ), rec(
fp:= [ 148 ],
next:= [ rec(
desc:= [ 119015 ],
fp:= [ 8, 18 ],
next:= [ 90520, 90519 ] ) ] ), rec(
fp:= [ 165, 1019 ],
next:= [ rec(
fp:= [ 3450, 33365, 66724 ],
level:= 5,
next:= [ 92939, 92943, 92938 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 14 ],
next:= [ 92946, 92944 ] ) ] ), rec(
fp:= [ 166, 168, 173 ],
next:= [ rec(
desc:= [ 106003, 108003, 302008, 208002 ],
fp:= [ 14, 212 ],
next:= [ 96519, 96521 ] ), rec(
desc:= [ 106003, 302004, 302006, 208002 ],
fp:= [ 14, 212 ],
next:= [ 96523, 96525 ] ), rec(
desc:= [ 107003 ],
fp:= [ 12, 418, 814 ],
next:= [ 96522, 96516, rec(
desc:= [ 302006, 302011, 108003, 208003 ],
fp:= [ 8, 414 ],
next:= [ 96526, 96524 ] ) ] ) ] ), rec(
fp:= [ 166, 168, 169, 171 ],
next:= [ rec(
desc:= [ 302007 ],
fp:= [ 1584, 69500 ],
next:= [ 100158, 100157 ] ), rec(
desc:= [ 302005 ],
fp:= [ 1165, 26960 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 14, 212 ],
next:= [ 100153, 100152 ] ), rec(
desc:= [ 108003 ],
fp:= [ 14, 212 ],
next:= [ 100154, 100151 ] ) ] ), rec(
desc:= [ 108003 ],
fp:= [ 216, 414 ],
next:= [ rec(
desc:= [ 302005, 209002 ],
fp:= [ 2, 12 ],
next:= [ 100155, 100161 ] ), 100160 ] ), rec(
desc:= [ 302005 ],
fp:= [ 1363, 46760 ],
next:= [ 100162, 100156 ] ) ] ), rec(
fp:= [ 171 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 18, 216, 414 ],
next:= [ 103453, 103444, 103448 ] ) ] ), rec(
fp:= [ 167 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 8, 414 ],
next:= [ 106903, 106901 ] ) ] ), rec(
fp:= [ 165, 168, 171, 174 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 214, 412 ],
next:= [ 110943, 110935 ] ), rec(
desc:= [ 106003 ],
fp:= [ 16, 412 ],
next:= [ 110940, 110942 ] ), rec(
desc:= [ 106003 ],
fp:= [ 218, 416, 614 ],
next:= [ 110945, 110937, 110941 ] ), rec(
desc:= [ 106003 ],
fp:= [ 416, 614 ],
next:= [ 110946, rec(
desc:= [ 302006 ],
fp:= [ 1363, 46760 ],
next:= [ 110936, 110938 ] ) ] ) ] ), rec(
fp:= [ 168, 173, 174, 175 ],
next:= [ rec(
desc:= [ 110011 ],
fp:= [ 16, 818, 1214 ],
next:= [ rec(
desc:= [ 302007, 106003, 108003, 206002, 302007, 210002, 302011,
302013, 215002, 40309015 ],
fp:= [ 1, 7681 ],
next:= [ 115224, 115216 ] ), 115221, 115214 ] ), rec(
desc:= [ 302006 ],
fp:= [ 1584, 69500 ],
next:= [ 115218, rec(
desc:= [ 302007, 108003, 110003, 303009, 211003, 303012, 214003,
40710014 ],
fp:= [ 2, 2661 ],
next:= [ 115217, 115225 ] ) ] ), rec(
desc:= [ 302005 ],
fp:= [ 1165, 26960 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 218, 614 ],
next:= [ 115226, 115222 ] ), 115219 ] ), rec(
desc:= [ 105003 ],
fp:= [ 218, 614 ],
next:= [ 115227, 115215 ] ) ] ), rec(
fp:= [ 168, 174, 177 ],
next:= [ rec(
desc:= [ 302004 ],
fp:= [ 1264, 36860 ],
next:= [ 119380, 119386 ] ), rec(
desc:= [ 105003 ],
fp:= [ 20, 416, 614 ],
next:= [ 119379, 119383, 119381 ] ), rec(
desc:= [ 105003 ],
fp:= [ 416, 614 ],
next:= [ 119382, 119385 ] ) ] ), rec(
fp:= [ 165, 171, 172, 173, 174 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 8, 612 ],
next:= [ 123495, 123503 ] ), rec(
desc:= [ 105003 ],
fp:= [ 616, 814 ],
next:= [ 123507, 123497 ] ), rec(
desc:= [ 105003 ],
fp:= [ 814, 1012 ],
next:= [ 123499, 123505 ] ), rec(
desc:= [ 106003 ],
fp:= [ 616, 814 ],
next:= [ 123506, 123496 ] ), rec(
desc:= [ 106003 ],
fp:= [ 616, 814, 1012 ],
next:= [ 123502, 123500, 123504 ] ) ] ), rec(
fp:= [ 174, 175, 176 ],
next:= [ rec(
desc:= [ 105003 ],
fp:= [ 220, 616, 814 ],
next:= [ 127541, 127532, 127540 ] ), rec(
desc:= [ 302007, 206002 ],
fp:= [ 4, 14 ],
next:= [ 127534, 127530 ] ), rec(
desc:= [ 105003 ],
fp:= [ 418, 616, 814 ],
next:= [ 127538, 127543, 127535 ] ) ] ), rec(
fp:= [ 171, 172, 173, 174, 175 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 614, 812 ],
next:= [ rec(
desc:= [ 302012, 208003 ],
fp:= [ 16, 214 ],
next:= [ 131594, 131605 ] ), rec(
desc:= [ 302006, 210002 ],
fp:= [ 18, 414 ],
next:= [ 131606, 131598 ] ) ] ), rec(
desc:= [ 106003 ],
fp:= [ 10, 614 ],
next:= [ 131602, 131597 ] ), rec(
desc:= [ 302006, 302010, 112003, 211003, 303012, 214003 ],
fp:= [ 414, 612 ],
next:= [ 131600, 131608 ] ), rec(
desc:= [ 106003 ],
fp:= [ 616, 1012 ],
next:= [ 131596, 131607 ] ), rec(
desc:= [ 108003, 302005, 209002 ],
fp:= [ 16, 214 ],
next:= [ 131604, 131599 ] ) ] ), rec(
fp:= [ 452, 1960 ],
next:= [ rec(
desc:= [ 302009 ],
fp:= [ 49161, 59541 ],
next:= [ rec(
desc:= [ 113003 ],
fp:= [ 4, 14 ],
next:= [ 158437, 158427 ] ), 158425 ] ), rec(
desc:= [ 113003 ],
fp:= [ 4, 14 ],
next:= [ 158432, 158434 ] ) ] ), rec(
fp:= [ 1631 ],
next:= [ rec(
fp:= [ 66360, 99217 ],
level:= 5,
next:= [ 170849, 170850 ] ) ] ), rec(
fp:= [ 610 ],
next:= [ rec(
desc:= [ 111007 ],
fp:= [ 4, 14 ],
next:= [ 175994, 176002 ] ) ] ), rec(
fp:= [ 655 ],
next:= [ rec(
fp:= [ 44094, 76042 ],
level:= 5,
next:= [ 195675, 195671 ] ) ] ), rec(
fp:= [ 787 ],
next:= [ rec(
desc:= [ 115003 ],
fp:= [ 4, 14 ],
next:= [ 208416, 208406 ] ) ] ), rec(
fp:= [ 657 ],
next:= [ rec(
desc:= [ 114007 ],
fp:= [ 4, 14 ],
next:= [ 231770, 231768 ] ) ] ), rec(
fp:= [ 731 ],
next:= [ rec(
fp:= [ 27545, 90445 ],
level:= 5,
next:= [ 236040, 236032 ] ) ] ), rec(
fp:= [ 611 ],
next:= [ rec(
fp:= [ 25988, 89451 ],
level:= 5,
next:= [ 240544, 240543 ] ) ] ), rec(
fp:= [ 610 ],
next:= [ rec(
fp:= [ 11859, 92283 ],
level:= 5,
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 15, 213 ],
next:= [ 245012, 245014 ] ), 245019 ] ) ] ), rec(
fp:= [ 681 ],
next:= [ rec(
desc:= [ 302016, 106003, 302006, 302008, 211002, 302012, 216002 ],
fp:= [ 2, 111 ],
next:= [ 271283, 271281 ] ) ] ), rec(
fp:= [ 660 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 17, 215 ],
next:= [ 289561, 289560 ] ) ] ), rec(
fp:= [ 765 ],
next:= [ rec(
fp:= [ 17414, 63794 ],
level:= 5,
next:= [ 293773, 293777 ] ) ] ), rec(
fp:= [ 637, 814 ],
next:= [ rec(
fp:= [ 10189, 33237 ],
level:= 5,
next:= [ 297969, 297968 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 297976, 297964 ] ) ] ), rec(
fp:= [ 807 ],
next:= [ rec(
desc:= [ 113003 ],
fp:= [ 4, 14 ],
next:= [ 302381, 302377 ] ) ] ), rec(
fp:= [ 597, 768 ],
next:= [ rec(
desc:= [ 113007 ],
fp:= [ 4, 14 ],
next:= [ 306830, 306828 ] ), rec(
fp:= [ 14043, 89770 ],
level:= 5,
next:= [ 306820, 306829 ] ) ] ), rec(
fp:= [ 653, 815, 832 ],
next:= [ rec(
desc:= [ 302006 ],
fp:= [ 42693, 56441 ],
next:= [ 311184, rec(
desc:= [ 108003 ],
fp:= [ 413, 611 ],
next:= [ 311187, 311186 ] ) ] ), rec(
fp:= [ 10849, 60010 ],
level:= 5,
next:= [ 311176, 311188 ] ), rec(
fp:= [ 10849, 60010 ],
level:= 5,
next:= [ 311182, rec(
desc:= [ 302006 ],
fp:= [ 841, 58261 ],
next:= [ 311190, 311185 ] ) ] ) ] ), rec(
fp:= [ 1000 ],
next:= [ rec(
fp:= [ 52823, 80917 ],
level:= 5,
next:= [ 328910, 328901 ] ) ] ), rec(
fp:= [ 1031, 1053, 1066, 1093 ],
next:= [ rec(
desc:= [ 108003, 302008, 112003, 115005, 212003, 306016, 40106013 ],
fp:= [ 1, 3841 ],
next:= [ 333118, 333102 ] ), rec(
desc:= [ 107003, 302007, 117007, 313017, 214003, 304011, 215004 ],
fp:= [ 1, 11 ],
next:= [ 333122, 333106 ] ), rec(
desc:= [ 302014, 113003, 213003 ],
fp:= [ 14, 1014 ],
next:= [ 333117, 333097 ] ), rec(
fp:= [ 33329, 71175 ],
level:= 5,
next:= [ 333095, 333112 ] ) ] ), rec(
fp:= [ 1023, 2165 ],
next:= [ rec(
desc:= [ 105003 ],
fp:= [ 8, 18 ],
next:= [ 337980, 337981 ] ), rec(
fp:= [ 36113, 59883 ],
level:= 5,
next:= [ 337984, 337977 ] ) ] ), rec(
fp:= [ 1093 ],
next:= [ rec(
fp:= [ 6388, 10920 ],
level:= 5,
next:= [ 361299, 361284 ] ) ] ), rec(
fp:= [ 1070, 1150, 1180 ],
next:= [ rec(
desc:= [ 109003 ],
fp:= [ 8, 612 ],
next:= [ 367194, 367192 ] ), rec(
desc:= [ 110003 ],
fp:= [ 614, 812 ],
next:= [ 367186, 367190 ] ), rec(
desc:= [ 108003 ],
fp:= [ 816, 1014 ],
next:= [ 367199, 367203 ] ) ] ), rec(
fp:= [ 1201 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 414, 612 ],
next:= [ 387481, 387485 ] ) ] ), rec(
fp:= [ 1221 ],
next:= [ rec(
fp:= [ 6584, 66171 ],
level:= 5,
next:= [ 394008, 394001 ] ) ] ), rec(
fp:= [ 1142, 1156 ],
next:= [ rec(
desc:= [ 109003 ],
fp:= [ 216, 414 ],
next:= [ 399749, 399745 ] ), rec(
fp:= [ 16264, 83760 ],
level:= 5,
next:= [ 399733, 399743 ] ) ] ), rec(
fp:= [ 1418 ],
next:= [ rec(
desc:= [ 302007 ],
fp:= [ 38461, 48262 ],
next:= [ 407466, 407470 ] ) ] ), rec(
fp:= [ 1187, 1384 ],
next:= [ rec(
fp:= [ 47698, 49562 ],
level:= 5,
next:= [ 415495, 415484 ] ), rec(
fp:= [ 1659, 77827 ],
level:= 5,
next:= [ 415512, 415504 ] ) ] ), rec(
fp:= [ 1265 ],
next:= [ rec(
fp:= [ 21291, 89248 ],
level:= 5,
next:= [ 424429, 424411 ] ) ] ), rec(
fp:= [ 1221 ],
next:= [ rec(
fp:= [ 26451, 55675 ],
level:= 5,
next:= [ 440045, 440025 ] ) ] ), rec(
fp:= [ 1192, 1362 ],
next:= [ rec(
desc:= [ 302009, 210003 ],
fp:= [ 4, 14 ],
next:= [ 446789, 446780 ] ), rec(
fp:= [ 21553, 45381 ],
level:= 5,
next:= [ 446808, 446800 ] ) ] ), rec(
fp:= [ 1055, 1352 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 816, 1212 ],
next:= [ 453284, 453292 ] ), rec(
desc:= [ 107003 ],
fp:= [ 16, 412 ],
next:= [ 453298, 453302 ] ) ] ), rec(
fp:= [ 1032, 1146, 1177, 1488 ],
next:= [ rec(
desc:= [ 115011 ],
fp:= [ 8, 18 ],
next:= [ 461023, 461019 ] ), rec(
fp:= [ 54312, 60275 ],
level:= 5,
next:= [ 461032, rec(
desc:= [ 108003 ],
fp:= [ 616, 1012 ],
next:= [ 461034, 461029 ] ) ] ), rec(
fp:= [ 54312, 60275 ],
level:= 5,
next:= [ 461012, 461017 ] ), rec(
fp:= [ 37508, 45993 ],
level:= 5,
next:= [ 461030, 461026 ] ) ] ), rec(
fp:= [ 1327 ],
next:= [ rec(
desc:= [ 302009 ],
fp:= [ 285, 38461 ],
next:= [ 469697, 469693 ] ) ] ), rec(
fp:= [ 1202, 1384 ],
next:= [ rec(
fp:= [ 26541, 86068 ],
level:= 5,
next:= [ 478397, 478385 ] ), rec(
fp:= [ 47433, 63524 ],
level:= 5,
next:= [ 478403, 478388 ] ) ] ), rec(
fp:= [ 1383, 1417 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 416, 812 ],
next:= [ 496820, 496836 ] ), rec(
desc:= [ 302007 ],
fp:= [ 384, 48361 ],
next:= [ 496822, 496838 ] ) ] ), rec(
fp:= [ 1255 ],
next:= [ rec(
fp:= [ 21578, 84003 ],
level:= 5,
next:= [ 505590, 505591 ] ) ] ), rec(
fp:= [ 1384, 1561 ],
next:= [ rec(
desc:= [ 113011 ],
fp:= [ 4, 14 ],
next:= [ 514728, 514736 ] ), rec(
desc:= [ 302009 ],
fp:= [ 45121, 54583 ],
next:= [ 514732, 514740 ] ) ] ), rec(
fp:= [ 1310, 1528 ],
next:= [ rec(
desc:= [ 302008 ],
fp:= [ 483, 58261 ],
next:= [ 523205, 523193 ] ), rec(
fp:= [ 10986, 61635 ],
level:= 5,
next:= [ 523194, 523202 ] ) ] ), rec(
fp:= [ 1072, 1185, 1538 ],
next:= [ rec(
desc:= [ 302006, 302011, 112003, 212003 ],
fp:= [ 2, 12 ],
next:= [ 537647, 537635 ] ), rec(
desc:= [ 106003 ],
fp:= [ 18, 216, 414 ],
next:= [ 537642, 537645, 537649 ] ), rec(
desc:= [ 105003 ],
fp:= [ 20, 218 ],
next:= [ 537634, 537638 ] ) ] ), rec(
fp:= [ 1197 ],
next:= [ rec(
fp:= [ 36014, 46227 ],
level:= 5,
next:= [ 544828, 544813 ] ) ] ), rec(
fp:= [ 1259 ],
next:= [ rec(
fp:= [ 50993, 71362 ],
level:= 5,
next:= [ 553874, 553869 ] ) ] ), rec(
fp:= [ 1104, 1289 ],
next:= [ rec(
fp:= [ 1690, 16563 ],
level:= 5,
next:= [ 562707, 562729 ] ), rec(
desc:= [ 115011 ],
fp:= [ 8, 414 ],
next:= [ 562725, 562705 ] ) ] ), rec(
fp:= [ 1209, 1428 ],
next:= [ rec(
fp:= [ 16620, 42240 ],
level:= 5,
next:= [ 571683, 571656 ] ), rec(
fp:= [ 50333, 94724 ],
level:= 5,
next:= [ 571662, 571676 ] ) ] ), rec(
fp:= [ 1253, 1276 ],
next:= [ rec(
fp:= [ 8871, 52551 ],
level:= 5,
next:= [ 580888, 580865 ] ), rec(
fp:= [ 21314, 64994 ],
level:= 5,
next:= [ 580864, 580861 ] ) ] ), rec(
fp:= [ 1043, 1218 ],
next:= [ rec(
desc:= [ 302011, 211003 ],
fp:= [ 22, 418 ],
next:= [ 598539, 598547 ] ), rec(
fp:= [ 13679, 83668 ],
level:= 5,
next:= [ 598550, 598541 ] ) ] ), rec(
fp:= [ 1158 ],
next:= [ rec(
fp:= [ 14247, 87466 ],
level:= 5,
next:= [ 605142, 605135 ] ) ] ), rec(
fp:= [ 1174 ],
next:= [ rec(
desc:= [ 302007, 212002 ],
fp:= [ 418, 616 ],
next:= [ 627480, 627481 ] ) ] ), rec(
fp:= [ 1142, 1156, 1401, 1405 ],
next:= [ rec(
desc:= [ 302010 ],
fp:= [ 54781, 64921 ],
next:= [ 634770, 634774 ] ), rec(
fp:= [ 32588, 68207 ],
level:= 5,
next:= [ 634796, 634787 ] ), rec(
fp:= [ 11364, 26526 ],
level:= 5,
next:= [ 634788, 634799 ] ), rec(
fp:= [ 7626, 98195 ],
level:= 5,
next:= [ 634775, 634794 ] ) ] ), rec(
fp:= [ 1175, 1289, 1478 ],
next:= [ rec(
fp:= [ 11886, 77898 ],
level:= 5,
next:= [ 643771, 643758 ] ), rec(
fp:= [ 3193, 11826 ],
level:= 5,
next:= [ 643756, 643777 ] ), rec(
fp:= [ 41109, 52410 ],
level:= 5,
next:= [ 643784, 643775 ] ) ] ), rec(
fp:= [ 1139, 1196, 1488 ],
next:= [ rec(
fp:= [ 5625, 45981 ],
level:= 5,
next:= [ 652474, 652480 ] ), rec(
fp:= [ 39855, 89015 ],
level:= 5,
next:= [ 652498, 652473 ] ), rec(
fp:= [ 38377, 72206 ],
level:= 5,
next:= [ 652501, 652502 ] ) ] ), rec(
fp:= [ 1246, 1250, 1259, 1491 ],
next:= [ rec(
desc:= [ 302011, 211002 ],
fp:= [ 513, 711 ],
next:= [ 661193, 661198 ] ), rec(
desc:= [ 112011 ],
fp:= [ 8, 414 ],
next:= [ 661195, 661190 ] ), rec(
desc:= [ 112011 ],
fp:= [ 8, 18, 414 ],
next:= [ 661211, 661208, 661188 ] ), rec(
desc:= [ 302007, 211002 ],
fp:= [ 1016, 1214 ],
next:= [ 661206, 661196 ] ) ] ), rec(
fp:= [ 1055, 1155 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 818, 1016 ],
next:= [ 670251, 670235 ] ), rec(
fp:= [ 57636, 59126 ],
level:= 5,
next:= [ 670239, 670249 ] ) ] ), rec(
fp:= [ 1208 ],
next:= [ rec(
desc:= [ 302008 ],
fp:= [ 563, 38541 ],
next:= [ 678578, 678581 ] ) ] ), rec(
fp:= [ 1203, 1248, 1410 ],
next:= [ rec(
fp:= [ 42509, 51142 ],
level:= 5,
next:= [ 697034, 697035 ] ), rec(
fp:= [ 13269, 18843 ],
level:= 5,
next:= [ 697042, 697044 ] ), rec(
desc:= [ 107003 ],
fp:= [ 214, 412 ],
next:= [ 697056, 697050 ] ) ] ), rec(
fp:= [ 1285, 1451 ],
next:= [ rec(
fp:= [ 30879, 92165 ],
level:= 5,
next:= [ 706117, 706101 ] ), rec(
desc:= [ 302006 ],
fp:= [ 38461, 48262 ],
next:= [ 706130, 706104 ] ) ] ), rec(
fp:= [ 1242, 1246, 1308, 1494 ],
next:= [ rec(
desc:= [ 302007 ],
fp:= [ 28561, 38362 ],
next:= [ 715288, 715282 ] ), rec(
desc:= [ 302006 ],
fp:= [ 18661, 28462 ],
next:= [ 715296, 715287 ] ), rec(
fp:= [ 15947, 82834 ],
level:= 5,
next:= [ 715281, 715286 ] ), rec(
desc:= [ 302006 ],
fp:= [ 285, 38461 ],
next:= [ 715310, 715285 ] ) ] ), rec(
fp:= [ 1264 ],
next:= [ rec(
desc:= [ 302006 ],
fp:= [ 18661, 38263 ],
next:= [ 724589, 724582 ] ) ] ), rec(
fp:= [ 1462 ],
next:= [ rec(
fp:= [ 19110, 59406 ],
level:= 5,
next:= [ 733625, 733634 ] ) ] ), rec(
fp:= [ 1224, 1432, 1463 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 618, 816 ],
next:= [ 751875, 751870 ] ), rec(
desc:= [ 106003 ],
fp:= [ 416, 614 ],
next:= [ 751896, 751889 ] ), rec(
desc:= [ 106003 ],
fp:= [ 416, 614 ],
next:= [ 751892, 751872 ] ) ] ), rec(
fp:= [ 1502, 1511 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 414, 612 ],
next:= [ 761178, 761161 ] ), rec(
desc:= [ 302006 ],
fp:= [ 662, 48361 ],
next:= [ 761185, 761174 ] ) ] ), rec(
fp:= [ 1239, 1452, 1458, 1500 ],
next:= [ rec(
desc:= [ 105003 ],
fp:= [ 222, 420 ],
next:= [ 778653, 778662 ] ), rec(
desc:= [ 105003 ],
fp:= [ 18, 216 ],
next:= [ 778674, 778665 ] ), rec(
desc:= [ 105003 ],
fp:= [ 20, 218 ],
next:= [ 778682, 778656 ] ), rec(
desc:= [ 302008 ],
fp:= [ 80997, 87367, 89161 ],
next:= [ 778670, 778681, 778676 ] ) ] ), rec(
fp:= [ 1206, 1211, 1485 ],
next:= [ rec(
desc:= [ 302006 ],
fp:= [ 28462, 28641 ],
next:= [ 787713, 787720 ] ), rec(
desc:= [ 113011 ],
fp:= [ 8, 414 ],
next:= [ 787714, 787726 ] ), rec(
desc:= [ 302008 ],
fp:= [ 54922, 77227 ],
next:= [ 787733, 787740 ] ) ] ), rec(
fp:= [ 1209, 1487 ],
next:= [ rec(
fp:= [ 30879, 92165 ],
level:= 5,
next:= [ 796577, rec(
desc:= [ 106003 ],
fp:= [ 20, 614 ],
next:= [ 796593, 796592 ] ) ] ), rec(
desc:= [ 106003 ],
fp:= [ 416, 614 ],
next:= [ 796604, 796580 ] ) ] ), rec(
fp:= [ 1019, 1117 ],
next:= [ rec(
fp:= [ 8760, 20428 ],
level:= 5,
next:= [ 804528, rec(
desc:= [ 302008 ],
fp:= [ 69500, 79880 ],
next:= [ 804531, 804530 ] ) ] ), rec(
fp:= [ 26185, 62961 ],
level:= 5,
next:= [ 804532, 804534 ] ) ] ), rec(
fp:= [ 1410 ],
next:= [ rec(
fp:= [ 35670, 60283 ],
level:= 5,
next:= [ 810932, rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 810950, 810928 ] ) ] ) ] ), rec(
fp:= [ 1275, 1400, 1410, 1420 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 6, 412 ],
next:= [ 843785, 843767 ] ), rec(
fp:= [ 8767, 68714 ],
level:= 5,
next:= [ rec(
desc:= [ 302011 ],
fp:= [ 7536, 80547, 90348 ],
next:= [ 843772, 843773, 843783 ] ), 843768 ] ), rec(
desc:= [ 302010 ],
fp:= [ 69022, 80448 ],
next:= [ 843787, 843790 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 843766, 843789 ] ) ] ), rec(
fp:= [ 1212, 1259, 1421, 1430, 1470, 1515, 1563 ],
next:= [ rec(
desc:= [ 302007 ],
fp:= [ 18463, 28264 ],
next:= [ 852803, 852795 ] ), rec(
desc:= [ 302008 ],
fp:= [ 36033, 69053 ],
next:= [ 852799, 852786 ] ), rec(
desc:= [ 302008 ],
fp:= [ 5825, 62249 ],
next:= [ 852805, 852815 ] ), rec(
desc:= [ 302008 ],
fp:= [ 42723, 70603 ],
next:= [ 852807, 852789 ] ), rec(
desc:= [ 302008 ],
fp:= [ 49253, 59054 ],
next:= [ 852810, 852813 ] ), rec(
desc:= [ 302009 ],
fp:= [ 73739, 80448 ],
next:= [ 852808, 852792 ] ), rec(
desc:= [ 302009 ],
fp:= [ 926, 83738 ],
next:= [ 852806, 852816 ] ) ] ), rec(
fp:= [ 1377, 1491 ],
next:= [ rec(
desc:= [ 302008 ],
fp:= [ 643, 74581 ],
next:= [ 861996, 861980 ] ), rec(
desc:= [ 106003 ],
fp:= [ 214, 412 ],
next:= [ 861982, 861994 ] ) ] ), rec(
fp:= [ 1446 ],
next:= [ rec(
desc:= [ 302008 ],
fp:= [ 64681, 74821 ],
next:= [ 871258, 871260 ] ) ] ), rec(
fp:= [ 1135, 1345, 1402, 1417, 1429, 1560 ],
next:= [ rec(
fp:= [ 85775, 89204 ],
level:= 5,
next:= [ 880521, 880507 ] ), rec(
fp:= [ 38614, 66661 ],
level:= 5,
next:= [ 880500, 880513 ] ), rec(
fp:= [ 9381, 24543 ],
level:= 5,
next:= [ 880525, 880502 ] ), rec(
desc:= [ 302011 ],
fp:= [ 34783, 44584, 93977 ],
next:= [ 880523, 880524, 880514 ] ), rec(
fp:= [ 31051, 46671 ],
level:= 5,
next:= [ 880517, 880499 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 880518, 880528 ] ) ] ), rec(
fp:= [ 1150, 1367, 1418, 1510 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 6, 214 ],
next:= [ 898957, 898942 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 898949, 898952 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 898958, 898962 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 898963, 898944 ] ) ] ), rec(
fp:= [ 1199, 1308, 1532, 1561 ],
next:= [ rec(
desc:= [ 302006 ],
fp:= [ 48262, 48441 ],
next:= [ 908122, 908114 ] ), rec(
desc:= [ 106003 ],
fp:= [ 10, 614 ],
next:= [ 908128, 908137 ] ), rec(
desc:= [ 106003 ],
fp:= [ 6, 214 ],
next:= [ 908120, 908139 ] ), rec(
desc:= [ 302007 ],
fp:= [ 35934, 42643 ],
next:= [ 908134, 908144 ] ) ] ), rec(
fp:= [ 1163, 1405, 1420, 1481 ],
next:= [ rec(
desc:= [ 302009 ],
fp:= [ 742, 1081 ],
next:= [ 917366, 917363 ] ), rec(
fp:= [ 59148, 86302 ],
level:= 5,
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 14, 212 ],
next:= [ 917386, 917377 ] ), 917382 ] ), rec(
fp:= [ 38582, 72307 ],
level:= 5,
next:= [ rec(
desc:= [ 302007 ],
fp:= [ 582, 761 ],
next:= [ 917385, 917364 ] ), 917369 ] ), rec(
desc:= [ 107003 ],
fp:= [ 6, 412 ],
next:= [ 917359, 917361 ] ) ] ), rec(
fp:= [ 1416, 1435 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 926629, 926621 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 926638, 926626 ] ) ] ), rec(
fp:= [ 1424, 1437 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 14, 212 ],
next:= [ 935562, 935564 ] ), rec(
desc:= [ 108003 ],
fp:= [ 14, 212 ],
next:= [ 935567, 935546 ] ) ] ), rec(
fp:= [ 1263, 1381 ],
next:= [ rec(
fp:= [ 66609, 69242 ],
level:= 5,
next:= [ 944755, 944741 ] ), rec(
desc:= [ 107003 ],
fp:= [ 6, 412 ],
next:= [ 944734, 944750 ] ) ] ), rec(
fp:= [ 1204, 1446 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 414, 612 ],
next:= [ 953906, 953900 ] ), rec(
desc:= [ 107003 ],
fp:= [ 214, 412 ],
next:= [ 953920, 953921 ] ) ] ), rec(
fp:= [ 1212, 1384, 1430 ],
next:= [ rec(
desc:= [ 302007 ],
fp:= [ 18364, 36033 ],
next:= [ 963124, 963131 ] ), rec(
desc:= [ 302009 ],
fp:= [ 742, 1081 ],
next:= [ 963126, 963139 ] ), rec(
desc:= [ 302008 ],
fp:= [ 52703, 70603 ],
next:= [ 963148, 963127 ] ) ] ), rec(
fp:= [ 1445 ],
next:= [ rec(
desc:= [ 302006 ],
fp:= [ 36193, 70603 ],
next:= [ 972309, 972300 ] ) ] ), rec(
fp:= [ 1210, 1519, 1568 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 614, 812 ],
next:= [ 981448, 981447 ] ), rec(
desc:= [ 302006 ],
fp:= [ 841, 58261 ],
next:= [ 981459, 981469 ] ), rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 981460, 981452 ] ) ] ), rec(
fp:= [ 1421, 1457 ],
next:= [ rec(
desc:= [ 302010 ],
fp:= [ 7536, 69121, 90348 ],
next:= [ 999501, 999503, 999493 ] ), rec(
desc:= [ 302008 ],
fp:= [ 28443, 98876 ],
next:= [ 999496, 999502 ] ) ] ), rec(
fp:= [ 1149 ],
next:= [ rec(
fp:= [ 3117, 42657, 52576 ],
level:= 5,
next:= [ 1007769, 1007782, 1007780 ] ) ] ), rec(
fp:= [ 1155, 1217 ],
next:= [ rec(
fp:= [ 55160, 60046 ],
level:= 5,
next:= [ 1014685, 1014691 ] ), rec(
fp:= [ 27743, 52428 ],
level:= 5,
next:= [ 1014692, 1014687 ] ) ] ), rec(
fp:= [ 1037, 1252, 1256, 1307 ],
next:= [ rec(
desc:= [ 302006, 210002 ],
fp:= [ 1014, 1212 ],
next:= [ 1022311, 1022303 ] ), rec(
desc:= [ 106003 ],
fp:= [ 218, 416 ],
next:= [ 1022309, 1022296 ] ), rec(
fp:= [ 43640, 43795 ],
level:= 5,
next:= [ 1022317, 1022323 ] ), rec(
fp:= [ 51380, 66880 ],
level:= 5,
next:= [ 1022313, 1022310 ] ) ] ), rec(
fp:= [ 1091, 1170, 1182, 1205, 1254 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 224, 620 ],
next:= [ 1029593, 1029585 ] ), rec(
desc:= [ 107003 ],
fp:= [ 218, 614 ],
next:= [ 1029601, 1029609 ] ), rec(
fp:= [ 20339, 67982 ],
level:= 5,
next:= [ 1029595, 1029597 ] ), rec(
fp:= [ 5622, 21384 ],
level:= 5,
next:= [ 1029598, 1029605 ] ), rec(
desc:= [ 302010 ],
fp:= [ 44683, 93737 ],
next:= [ 1029586, 1029590 ] ) ] ), rec(
fp:= [ 1656, 1665, 1699, 1700 ],
next:= [ rec(
fp:= [ 3733, 31205 ],
level:= 5,
next:= [ 1034238, 1034220 ] ), rec(
fp:= [ 66297, 89133 ],
level:= 5,
next:= [ 1034222, 1034240 ] ), rec(
desc:= [ 110003, 302007, 211002, 40104012 ],
fp:= [ 1, 1921 ],
next:= [ 1034236, 1034224 ] ), rec(
fp:= [ 72475, 82523 ],
level:= 5,
next:= [ 1034227, 1034221 ] ) ] ), rec(
fp:= [ 2045 ],
next:= [ rec(
fp:= [ 51294, 51302 ],
level:= 5,
next:= [ 1070117, 1070123 ] ) ] ), rec(
fp:= [ 2230 ],
next:= [ rec(
fp:= [ 33419, 65748 ],
level:= 5,
next:= [ 1079962, 1079964 ] ) ] ) ] );
|
user/time.asm | Vidhi1109/Modified-XV6 | 0 | 8490 |
user/_time: file format elf64-littleriscv
Disassembly of section .text:
0000000000000000 <main>:
#include "user/user.h"
#include "kernel/fcntl.h"
int
main(int argc, char ** argv)
{
0: 7179 addi sp,sp,-48
2: f406 sd ra,40(sp)
4: f022 sd s0,32(sp)
6: ec26 sd s1,24(sp)
8: e84a sd s2,16(sp)
a: 1800 addi s0,sp,48
c: 892a mv s2,a0
e: 84ae mv s1,a1
int pid = fork();
10: 00000097 auipc ra,0x0
14: 302080e7 jalr 770(ra) # 312 <fork>
if(pid < 0) {
18: 02054a63 bltz a0,4c <main+0x4c>
printf("fork(): failed\n");
exit(1);
} else if(pid == 0) {
1c: ed39 bnez a0,7a <main+0x7a>
if(argc == 1) {
1e: 4785 li a5,1
20: 04f90363 beq s2,a5,66 <main+0x66>
sleep(10);
exit(0);
} else {
exec(argv[1], argv + 1);
24: 00848593 addi a1,s1,8
28: 6488 ld a0,8(s1)
2a: 00000097 auipc ra,0x0
2e: 328080e7 jalr 808(ra) # 352 <exec>
printf("exec(): failed\n");
32: 00001517 auipc a0,0x1
36: 82e50513 addi a0,a0,-2002 # 860 <malloc+0xfc>
3a: 00000097 auipc ra,0x0
3e: 672080e7 jalr 1650(ra) # 6ac <printf>
exit(1);
42: 4505 li a0,1
44: 00000097 auipc ra,0x0
48: 2d6080e7 jalr 726(ra) # 31a <exit>
printf("fork(): failed\n");
4c: 00001517 auipc a0,0x1
50: 80450513 addi a0,a0,-2044 # 850 <malloc+0xec>
54: 00000097 auipc ra,0x0
58: 658080e7 jalr 1624(ra) # 6ac <printf>
exit(1);
5c: 4505 li a0,1
5e: 00000097 auipc ra,0x0
62: 2bc080e7 jalr 700(ra) # 31a <exit>
sleep(10);
66: 4529 li a0,10
68: 00000097 auipc ra,0x0
6c: 342080e7 jalr 834(ra) # 3aa <sleep>
exit(0);
70: 4501 li a0,0
72: 00000097 auipc ra,0x0
76: 2a8080e7 jalr 680(ra) # 31a <exit>
}
} else {
int rtime, wtime;
waitx(0, &wtime, &rtime);
7a: fd840613 addi a2,s0,-40
7e: fdc40593 addi a1,s0,-36
82: 4501 li a0,0
84: 00000097 auipc ra,0x0
88: 336080e7 jalr 822(ra) # 3ba <waitx>
printf("\nwaiting:%d\nrunning:%d\n", wtime, rtime);
8c: fd842603 lw a2,-40(s0)
90: fdc42583 lw a1,-36(s0)
94: 00000517 auipc a0,0x0
98: 7dc50513 addi a0,a0,2012 # 870 <malloc+0x10c>
9c: 00000097 auipc ra,0x0
a0: 610080e7 jalr 1552(ra) # 6ac <printf>
}
exit(0);
a4: 4501 li a0,0
a6: 00000097 auipc ra,0x0
aa: 274080e7 jalr 628(ra) # 31a <exit>
00000000000000ae <strcpy>:
#include "kernel/fcntl.h"
#include "user/user.h"
char*
strcpy(char *s, const char *t)
{
ae: 1141 addi sp,sp,-16
b0: e422 sd s0,8(sp)
b2: 0800 addi s0,sp,16
char *os;
os = s;
while((*s++ = *t++) != 0)
b4: 87aa mv a5,a0
b6: 0585 addi a1,a1,1
b8: 0785 addi a5,a5,1
ba: fff5c703 lbu a4,-1(a1)
be: fee78fa3 sb a4,-1(a5)
c2: fb75 bnez a4,b6 <strcpy+0x8>
;
return os;
}
c4: 6422 ld s0,8(sp)
c6: 0141 addi sp,sp,16
c8: 8082 ret
00000000000000ca <strcmp>:
int
strcmp(const char *p, const char *q)
{
ca: 1141 addi sp,sp,-16
cc: e422 sd s0,8(sp)
ce: 0800 addi s0,sp,16
while(*p && *p == *q)
d0: 00054783 lbu a5,0(a0)
d4: cb91 beqz a5,e8 <strcmp+0x1e>
d6: 0005c703 lbu a4,0(a1)
da: 00f71763 bne a4,a5,e8 <strcmp+0x1e>
p++, q++;
de: 0505 addi a0,a0,1
e0: 0585 addi a1,a1,1
while(*p && *p == *q)
e2: 00054783 lbu a5,0(a0)
e6: fbe5 bnez a5,d6 <strcmp+0xc>
return (uchar)*p - (uchar)*q;
e8: 0005c503 lbu a0,0(a1)
}
ec: 40a7853b subw a0,a5,a0
f0: 6422 ld s0,8(sp)
f2: 0141 addi sp,sp,16
f4: 8082 ret
00000000000000f6 <strlen>:
uint
strlen(const char *s)
{
f6: 1141 addi sp,sp,-16
f8: e422 sd s0,8(sp)
fa: 0800 addi s0,sp,16
int n;
for(n = 0; s[n]; n++)
fc: 00054783 lbu a5,0(a0)
100: cf91 beqz a5,11c <strlen+0x26>
102: 0505 addi a0,a0,1
104: 87aa mv a5,a0
106: 4685 li a3,1
108: 9e89 subw a3,a3,a0
10a: 00f6853b addw a0,a3,a5
10e: 0785 addi a5,a5,1
110: fff7c703 lbu a4,-1(a5)
114: fb7d bnez a4,10a <strlen+0x14>
;
return n;
}
116: 6422 ld s0,8(sp)
118: 0141 addi sp,sp,16
11a: 8082 ret
for(n = 0; s[n]; n++)
11c: 4501 li a0,0
11e: bfe5 j 116 <strlen+0x20>
0000000000000120 <memset>:
void*
memset(void *dst, int c, uint n)
{
120: 1141 addi sp,sp,-16
122: e422 sd s0,8(sp)
124: 0800 addi s0,sp,16
char *cdst = (char *) dst;
int i;
for(i = 0; i < n; i++){
126: ca19 beqz a2,13c <memset+0x1c>
128: 87aa mv a5,a0
12a: 1602 slli a2,a2,0x20
12c: 9201 srli a2,a2,0x20
12e: 00a60733 add a4,a2,a0
cdst[i] = c;
132: 00b78023 sb a1,0(a5)
for(i = 0; i < n; i++){
136: 0785 addi a5,a5,1
138: fee79de3 bne a5,a4,132 <memset+0x12>
}
return dst;
}
13c: 6422 ld s0,8(sp)
13e: 0141 addi sp,sp,16
140: 8082 ret
0000000000000142 <strchr>:
char*
strchr(const char *s, char c)
{
142: 1141 addi sp,sp,-16
144: e422 sd s0,8(sp)
146: 0800 addi s0,sp,16
for(; *s; s++)
148: 00054783 lbu a5,0(a0)
14c: cb99 beqz a5,162 <strchr+0x20>
if(*s == c)
14e: 00f58763 beq a1,a5,15c <strchr+0x1a>
for(; *s; s++)
152: 0505 addi a0,a0,1
154: 00054783 lbu a5,0(a0)
158: fbfd bnez a5,14e <strchr+0xc>
return (char*)s;
return 0;
15a: 4501 li a0,0
}
15c: 6422 ld s0,8(sp)
15e: 0141 addi sp,sp,16
160: 8082 ret
return 0;
162: 4501 li a0,0
164: bfe5 j 15c <strchr+0x1a>
0000000000000166 <gets>:
char*
gets(char *buf, int max)
{
166: 711d addi sp,sp,-96
168: ec86 sd ra,88(sp)
16a: e8a2 sd s0,80(sp)
16c: e4a6 sd s1,72(sp)
16e: e0ca sd s2,64(sp)
170: fc4e sd s3,56(sp)
172: f852 sd s4,48(sp)
174: f456 sd s5,40(sp)
176: f05a sd s6,32(sp)
178: ec5e sd s7,24(sp)
17a: 1080 addi s0,sp,96
17c: 8baa mv s7,a0
17e: 8a2e mv s4,a1
int i, cc;
char c;
for(i=0; i+1 < max; ){
180: 892a mv s2,a0
182: 4481 li s1,0
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
184: 4aa9 li s5,10
186: 4b35 li s6,13
for(i=0; i+1 < max; ){
188: 89a6 mv s3,s1
18a: 2485 addiw s1,s1,1
18c: 0344d863 bge s1,s4,1bc <gets+0x56>
cc = read(0, &c, 1);
190: 4605 li a2,1
192: faf40593 addi a1,s0,-81
196: 4501 li a0,0
198: 00000097 auipc ra,0x0
19c: 19a080e7 jalr 410(ra) # 332 <read>
if(cc < 1)
1a0: 00a05e63 blez a0,1bc <gets+0x56>
buf[i++] = c;
1a4: faf44783 lbu a5,-81(s0)
1a8: 00f90023 sb a5,0(s2)
if(c == '\n' || c == '\r')
1ac: 01578763 beq a5,s5,1ba <gets+0x54>
1b0: 0905 addi s2,s2,1
1b2: fd679be3 bne a5,s6,188 <gets+0x22>
for(i=0; i+1 < max; ){
1b6: 89a6 mv s3,s1
1b8: a011 j 1bc <gets+0x56>
1ba: 89a6 mv s3,s1
break;
}
buf[i] = '\0';
1bc: 99de add s3,s3,s7
1be: 00098023 sb zero,0(s3)
return buf;
}
1c2: 855e mv a0,s7
1c4: 60e6 ld ra,88(sp)
1c6: 6446 ld s0,80(sp)
1c8: 64a6 ld s1,72(sp)
1ca: 6906 ld s2,64(sp)
1cc: 79e2 ld s3,56(sp)
1ce: 7a42 ld s4,48(sp)
1d0: 7aa2 ld s5,40(sp)
1d2: 7b02 ld s6,32(sp)
1d4: 6be2 ld s7,24(sp)
1d6: 6125 addi sp,sp,96
1d8: 8082 ret
00000000000001da <stat>:
int
stat(const char *n, struct stat *st)
{
1da: 1101 addi sp,sp,-32
1dc: ec06 sd ra,24(sp)
1de: e822 sd s0,16(sp)
1e0: e426 sd s1,8(sp)
1e2: e04a sd s2,0(sp)
1e4: 1000 addi s0,sp,32
1e6: 892e mv s2,a1
int fd;
int r;
fd = open(n, O_RDONLY);
1e8: 4581 li a1,0
1ea: 00000097 auipc ra,0x0
1ee: 170080e7 jalr 368(ra) # 35a <open>
if(fd < 0)
1f2: 02054563 bltz a0,21c <stat+0x42>
1f6: 84aa mv s1,a0
return -1;
r = fstat(fd, st);
1f8: 85ca mv a1,s2
1fa: 00000097 auipc ra,0x0
1fe: 178080e7 jalr 376(ra) # 372 <fstat>
202: 892a mv s2,a0
close(fd);
204: 8526 mv a0,s1
206: 00000097 auipc ra,0x0
20a: 13c080e7 jalr 316(ra) # 342 <close>
return r;
}
20e: 854a mv a0,s2
210: 60e2 ld ra,24(sp)
212: 6442 ld s0,16(sp)
214: 64a2 ld s1,8(sp)
216: 6902 ld s2,0(sp)
218: 6105 addi sp,sp,32
21a: 8082 ret
return -1;
21c: 597d li s2,-1
21e: bfc5 j 20e <stat+0x34>
0000000000000220 <atoi>:
int
atoi(const char *s)
{
220: 1141 addi sp,sp,-16
222: e422 sd s0,8(sp)
224: 0800 addi s0,sp,16
int n;
n = 0;
while('0' <= *s && *s <= '9')
226: 00054683 lbu a3,0(a0)
22a: fd06879b addiw a5,a3,-48
22e: 0ff7f793 zext.b a5,a5
232: 4625 li a2,9
234: 02f66863 bltu a2,a5,264 <atoi+0x44>
238: 872a mv a4,a0
n = 0;
23a: 4501 li a0,0
n = n*10 + *s++ - '0';
23c: 0705 addi a4,a4,1
23e: 0025179b slliw a5,a0,0x2
242: 9fa9 addw a5,a5,a0
244: 0017979b slliw a5,a5,0x1
248: 9fb5 addw a5,a5,a3
24a: fd07851b addiw a0,a5,-48
while('0' <= *s && *s <= '9')
24e: 00074683 lbu a3,0(a4)
252: fd06879b addiw a5,a3,-48
256: 0ff7f793 zext.b a5,a5
25a: fef671e3 bgeu a2,a5,23c <atoi+0x1c>
return n;
}
25e: 6422 ld s0,8(sp)
260: 0141 addi sp,sp,16
262: 8082 ret
n = 0;
264: 4501 li a0,0
266: bfe5 j 25e <atoi+0x3e>
0000000000000268 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
268: 1141 addi sp,sp,-16
26a: e422 sd s0,8(sp)
26c: 0800 addi s0,sp,16
char *dst;
const char *src;
dst = vdst;
src = vsrc;
if (src > dst) {
26e: 02b57463 bgeu a0,a1,296 <memmove+0x2e>
while(n-- > 0)
272: 00c05f63 blez a2,290 <memmove+0x28>
276: 1602 slli a2,a2,0x20
278: 9201 srli a2,a2,0x20
27a: 00c507b3 add a5,a0,a2
dst = vdst;
27e: 872a mv a4,a0
*dst++ = *src++;
280: 0585 addi a1,a1,1
282: 0705 addi a4,a4,1
284: fff5c683 lbu a3,-1(a1)
288: fed70fa3 sb a3,-1(a4)
while(n-- > 0)
28c: fee79ae3 bne a5,a4,280 <memmove+0x18>
src += n;
while(n-- > 0)
*--dst = *--src;
}
return vdst;
}
290: 6422 ld s0,8(sp)
292: 0141 addi sp,sp,16
294: 8082 ret
dst += n;
296: 00c50733 add a4,a0,a2
src += n;
29a: 95b2 add a1,a1,a2
while(n-- > 0)
29c: fec05ae3 blez a2,290 <memmove+0x28>
2a0: fff6079b addiw a5,a2,-1
2a4: 1782 slli a5,a5,0x20
2a6: 9381 srli a5,a5,0x20
2a8: fff7c793 not a5,a5
2ac: 97ba add a5,a5,a4
*--dst = *--src;
2ae: 15fd addi a1,a1,-1
2b0: 177d addi a4,a4,-1
2b2: 0005c683 lbu a3,0(a1)
2b6: 00d70023 sb a3,0(a4)
while(n-- > 0)
2ba: fee79ae3 bne a5,a4,2ae <memmove+0x46>
2be: bfc9 j 290 <memmove+0x28>
00000000000002c0 <memcmp>:
int
memcmp(const void *s1, const void *s2, uint n)
{
2c0: 1141 addi sp,sp,-16
2c2: e422 sd s0,8(sp)
2c4: 0800 addi s0,sp,16
const char *p1 = s1, *p2 = s2;
while (n-- > 0) {
2c6: ca05 beqz a2,2f6 <memcmp+0x36>
2c8: fff6069b addiw a3,a2,-1
2cc: 1682 slli a3,a3,0x20
2ce: 9281 srli a3,a3,0x20
2d0: 0685 addi a3,a3,1
2d2: 96aa add a3,a3,a0
if (*p1 != *p2) {
2d4: 00054783 lbu a5,0(a0)
2d8: 0005c703 lbu a4,0(a1)
2dc: 00e79863 bne a5,a4,2ec <memcmp+0x2c>
return *p1 - *p2;
}
p1++;
2e0: 0505 addi a0,a0,1
p2++;
2e2: 0585 addi a1,a1,1
while (n-- > 0) {
2e4: fed518e3 bne a0,a3,2d4 <memcmp+0x14>
}
return 0;
2e8: 4501 li a0,0
2ea: a019 j 2f0 <memcmp+0x30>
return *p1 - *p2;
2ec: 40e7853b subw a0,a5,a4
}
2f0: 6422 ld s0,8(sp)
2f2: 0141 addi sp,sp,16
2f4: 8082 ret
return 0;
2f6: 4501 li a0,0
2f8: bfe5 j 2f0 <memcmp+0x30>
00000000000002fa <memcpy>:
void *
memcpy(void *dst, const void *src, uint n)
{
2fa: 1141 addi sp,sp,-16
2fc: e406 sd ra,8(sp)
2fe: e022 sd s0,0(sp)
300: 0800 addi s0,sp,16
return memmove(dst, src, n);
302: 00000097 auipc ra,0x0
306: f66080e7 jalr -154(ra) # 268 <memmove>
}
30a: 60a2 ld ra,8(sp)
30c: 6402 ld s0,0(sp)
30e: 0141 addi sp,sp,16
310: 8082 ret
0000000000000312 <fork>:
# generated by usys.pl - do not edit
#include "kernel/syscall.h"
.global fork
fork:
li a7, SYS_fork
312: 4885 li a7,1
ecall
314: 00000073 ecall
ret
318: 8082 ret
000000000000031a <exit>:
.global exit
exit:
li a7, SYS_exit
31a: 4889 li a7,2
ecall
31c: 00000073 ecall
ret
320: 8082 ret
0000000000000322 <wait>:
.global wait
wait:
li a7, SYS_wait
322: 488d li a7,3
ecall
324: 00000073 ecall
ret
328: 8082 ret
000000000000032a <pipe>:
.global pipe
pipe:
li a7, SYS_pipe
32a: 4891 li a7,4
ecall
32c: 00000073 ecall
ret
330: 8082 ret
0000000000000332 <read>:
.global read
read:
li a7, SYS_read
332: 4895 li a7,5
ecall
334: 00000073 ecall
ret
338: 8082 ret
000000000000033a <write>:
.global write
write:
li a7, SYS_write
33a: 48c1 li a7,16
ecall
33c: 00000073 ecall
ret
340: 8082 ret
0000000000000342 <close>:
.global close
close:
li a7, SYS_close
342: 48d5 li a7,21
ecall
344: 00000073 ecall
ret
348: 8082 ret
000000000000034a <kill>:
.global kill
kill:
li a7, SYS_kill
34a: 4899 li a7,6
ecall
34c: 00000073 ecall
ret
350: 8082 ret
0000000000000352 <exec>:
.global exec
exec:
li a7, SYS_exec
352: 489d li a7,7
ecall
354: 00000073 ecall
ret
358: 8082 ret
000000000000035a <open>:
.global open
open:
li a7, SYS_open
35a: 48bd li a7,15
ecall
35c: 00000073 ecall
ret
360: 8082 ret
0000000000000362 <mknod>:
.global mknod
mknod:
li a7, SYS_mknod
362: 48c5 li a7,17
ecall
364: 00000073 ecall
ret
368: 8082 ret
000000000000036a <unlink>:
.global unlink
unlink:
li a7, SYS_unlink
36a: 48c9 li a7,18
ecall
36c: 00000073 ecall
ret
370: 8082 ret
0000000000000372 <fstat>:
.global fstat
fstat:
li a7, SYS_fstat
372: 48a1 li a7,8
ecall
374: 00000073 ecall
ret
378: 8082 ret
000000000000037a <link>:
.global link
link:
li a7, SYS_link
37a: 48cd li a7,19
ecall
37c: 00000073 ecall
ret
380: 8082 ret
0000000000000382 <mkdir>:
.global mkdir
mkdir:
li a7, SYS_mkdir
382: 48d1 li a7,20
ecall
384: 00000073 ecall
ret
388: 8082 ret
000000000000038a <chdir>:
.global chdir
chdir:
li a7, SYS_chdir
38a: 48a5 li a7,9
ecall
38c: 00000073 ecall
ret
390: 8082 ret
0000000000000392 <dup>:
.global dup
dup:
li a7, SYS_dup
392: 48a9 li a7,10
ecall
394: 00000073 ecall
ret
398: 8082 ret
000000000000039a <getpid>:
.global getpid
getpid:
li a7, SYS_getpid
39a: 48ad li a7,11
ecall
39c: 00000073 ecall
ret
3a0: 8082 ret
00000000000003a2 <sbrk>:
.global sbrk
sbrk:
li a7, SYS_sbrk
3a2: 48b1 li a7,12
ecall
3a4: 00000073 ecall
ret
3a8: 8082 ret
00000000000003aa <sleep>:
.global sleep
sleep:
li a7, SYS_sleep
3aa: 48b5 li a7,13
ecall
3ac: 00000073 ecall
ret
3b0: 8082 ret
00000000000003b2 <uptime>:
.global uptime
uptime:
li a7, SYS_uptime
3b2: 48b9 li a7,14
ecall
3b4: 00000073 ecall
ret
3b8: 8082 ret
00000000000003ba <waitx>:
.global waitx
waitx:
li a7, SYS_waitx
3ba: 48d9 li a7,22
ecall
3bc: 00000073 ecall
ret
3c0: 8082 ret
00000000000003c2 <trace>:
.global trace
trace:
li a7, SYS_trace
3c2: 48e1 li a7,24
ecall
3c4: 00000073 ecall
ret
3c8: 8082 ret
00000000000003ca <set_priority>:
.global set_priority
set_priority:
li a7, SYS_set_priority
3ca: 48dd li a7,23
ecall
3cc: 00000073 ecall
ret
3d0: 8082 ret
00000000000003d2 <putc>:
static char digits[] = "0123456789ABCDEF";
static void
putc(int fd, char c)
{
3d2: 1101 addi sp,sp,-32
3d4: ec06 sd ra,24(sp)
3d6: e822 sd s0,16(sp)
3d8: 1000 addi s0,sp,32
3da: feb407a3 sb a1,-17(s0)
write(fd, &c, 1);
3de: 4605 li a2,1
3e0: fef40593 addi a1,s0,-17
3e4: 00000097 auipc ra,0x0
3e8: f56080e7 jalr -170(ra) # 33a <write>
}
3ec: 60e2 ld ra,24(sp)
3ee: 6442 ld s0,16(sp)
3f0: 6105 addi sp,sp,32
3f2: 8082 ret
00000000000003f4 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
3f4: 7139 addi sp,sp,-64
3f6: fc06 sd ra,56(sp)
3f8: f822 sd s0,48(sp)
3fa: f426 sd s1,40(sp)
3fc: f04a sd s2,32(sp)
3fe: ec4e sd s3,24(sp)
400: 0080 addi s0,sp,64
402: 84aa mv s1,a0
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
404: c299 beqz a3,40a <printint+0x16>
406: 0805c963 bltz a1,498 <printint+0xa4>
neg = 1;
x = -xx;
} else {
x = xx;
40a: 2581 sext.w a1,a1
neg = 0;
40c: 4881 li a7,0
40e: fc040693 addi a3,s0,-64
}
i = 0;
412: 4701 li a4,0
do{
buf[i++] = digits[x % base];
414: 2601 sext.w a2,a2
416: 00000517 auipc a0,0x0
41a: 4d250513 addi a0,a0,1234 # 8e8 <digits>
41e: 883a mv a6,a4
420: 2705 addiw a4,a4,1
422: 02c5f7bb remuw a5,a1,a2
426: 1782 slli a5,a5,0x20
428: 9381 srli a5,a5,0x20
42a: 97aa add a5,a5,a0
42c: 0007c783 lbu a5,0(a5)
430: 00f68023 sb a5,0(a3)
}while((x /= base) != 0);
434: 0005879b sext.w a5,a1
438: 02c5d5bb divuw a1,a1,a2
43c: 0685 addi a3,a3,1
43e: fec7f0e3 bgeu a5,a2,41e <printint+0x2a>
if(neg)
442: 00088c63 beqz a7,45a <printint+0x66>
buf[i++] = '-';
446: fd070793 addi a5,a4,-48
44a: 00878733 add a4,a5,s0
44e: 02d00793 li a5,45
452: fef70823 sb a5,-16(a4)
456: 0028071b addiw a4,a6,2
while(--i >= 0)
45a: 02e05863 blez a4,48a <printint+0x96>
45e: fc040793 addi a5,s0,-64
462: 00e78933 add s2,a5,a4
466: fff78993 addi s3,a5,-1
46a: 99ba add s3,s3,a4
46c: 377d addiw a4,a4,-1
46e: 1702 slli a4,a4,0x20
470: 9301 srli a4,a4,0x20
472: 40e989b3 sub s3,s3,a4
putc(fd, buf[i]);
476: fff94583 lbu a1,-1(s2)
47a: 8526 mv a0,s1
47c: 00000097 auipc ra,0x0
480: f56080e7 jalr -170(ra) # 3d2 <putc>
while(--i >= 0)
484: 197d addi s2,s2,-1
486: ff3918e3 bne s2,s3,476 <printint+0x82>
}
48a: 70e2 ld ra,56(sp)
48c: 7442 ld s0,48(sp)
48e: 74a2 ld s1,40(sp)
490: 7902 ld s2,32(sp)
492: 69e2 ld s3,24(sp)
494: 6121 addi sp,sp,64
496: 8082 ret
x = -xx;
498: 40b005bb negw a1,a1
neg = 1;
49c: 4885 li a7,1
x = -xx;
49e: bf85 j 40e <printint+0x1a>
00000000000004a0 <vprintf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
vprintf(int fd, const char *fmt, va_list ap)
{
4a0: 7119 addi sp,sp,-128
4a2: fc86 sd ra,120(sp)
4a4: f8a2 sd s0,112(sp)
4a6: f4a6 sd s1,104(sp)
4a8: f0ca sd s2,96(sp)
4aa: ecce sd s3,88(sp)
4ac: e8d2 sd s4,80(sp)
4ae: e4d6 sd s5,72(sp)
4b0: e0da sd s6,64(sp)
4b2: fc5e sd s7,56(sp)
4b4: f862 sd s8,48(sp)
4b6: f466 sd s9,40(sp)
4b8: f06a sd s10,32(sp)
4ba: ec6e sd s11,24(sp)
4bc: 0100 addi s0,sp,128
char *s;
int c, i, state;
state = 0;
for(i = 0; fmt[i]; i++){
4be: 0005c903 lbu s2,0(a1)
4c2: 18090f63 beqz s2,660 <vprintf+0x1c0>
4c6: 8aaa mv s5,a0
4c8: 8b32 mv s6,a2
4ca: 00158493 addi s1,a1,1
state = 0;
4ce: 4981 li s3,0
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
4d0: 02500a13 li s4,37
4d4: 4c55 li s8,21
4d6: 00000c97 auipc s9,0x0
4da: 3bac8c93 addi s9,s9,954 # 890 <malloc+0x12c>
printptr(fd, va_arg(ap, uint64));
} else if(c == 's'){
s = va_arg(ap, char*);
if(s == 0)
s = "(null)";
while(*s != 0){
4de: 02800d93 li s11,40
putc(fd, 'x');
4e2: 4d41 li s10,16
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
4e4: 00000b97 auipc s7,0x0
4e8: 404b8b93 addi s7,s7,1028 # 8e8 <digits>
4ec: a839 j 50a <vprintf+0x6a>
putc(fd, c);
4ee: 85ca mv a1,s2
4f0: 8556 mv a0,s5
4f2: 00000097 auipc ra,0x0
4f6: ee0080e7 jalr -288(ra) # 3d2 <putc>
4fa: a019 j 500 <vprintf+0x60>
} else if(state == '%'){
4fc: 01498d63 beq s3,s4,516 <vprintf+0x76>
for(i = 0; fmt[i]; i++){
500: 0485 addi s1,s1,1
502: fff4c903 lbu s2,-1(s1)
506: 14090d63 beqz s2,660 <vprintf+0x1c0>
if(state == 0){
50a: fe0999e3 bnez s3,4fc <vprintf+0x5c>
if(c == '%'){
50e: ff4910e3 bne s2,s4,4ee <vprintf+0x4e>
state = '%';
512: 89d2 mv s3,s4
514: b7f5 j 500 <vprintf+0x60>
if(c == 'd'){
516: 11490c63 beq s2,s4,62e <vprintf+0x18e>
51a: f9d9079b addiw a5,s2,-99
51e: 0ff7f793 zext.b a5,a5
522: 10fc6e63 bltu s8,a5,63e <vprintf+0x19e>
526: f9d9079b addiw a5,s2,-99
52a: 0ff7f713 zext.b a4,a5
52e: 10ec6863 bltu s8,a4,63e <vprintf+0x19e>
532: 00271793 slli a5,a4,0x2
536: 97e6 add a5,a5,s9
538: 439c lw a5,0(a5)
53a: 97e6 add a5,a5,s9
53c: 8782 jr a5
printint(fd, va_arg(ap, int), 10, 1);
53e: 008b0913 addi s2,s6,8
542: 4685 li a3,1
544: 4629 li a2,10
546: 000b2583 lw a1,0(s6)
54a: 8556 mv a0,s5
54c: 00000097 auipc ra,0x0
550: ea8080e7 jalr -344(ra) # 3f4 <printint>
554: 8b4a mv s6,s2
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
556: 4981 li s3,0
558: b765 j 500 <vprintf+0x60>
printint(fd, va_arg(ap, uint64), 10, 0);
55a: 008b0913 addi s2,s6,8
55e: 4681 li a3,0
560: 4629 li a2,10
562: 000b2583 lw a1,0(s6)
566: 8556 mv a0,s5
568: 00000097 auipc ra,0x0
56c: e8c080e7 jalr -372(ra) # 3f4 <printint>
570: 8b4a mv s6,s2
state = 0;
572: 4981 li s3,0
574: b771 j 500 <vprintf+0x60>
printint(fd, va_arg(ap, int), 16, 0);
576: 008b0913 addi s2,s6,8
57a: 4681 li a3,0
57c: 866a mv a2,s10
57e: 000b2583 lw a1,0(s6)
582: 8556 mv a0,s5
584: 00000097 auipc ra,0x0
588: e70080e7 jalr -400(ra) # 3f4 <printint>
58c: 8b4a mv s6,s2
state = 0;
58e: 4981 li s3,0
590: bf85 j 500 <vprintf+0x60>
printptr(fd, va_arg(ap, uint64));
592: 008b0793 addi a5,s6,8
596: f8f43423 sd a5,-120(s0)
59a: 000b3983 ld s3,0(s6)
putc(fd, '0');
59e: 03000593 li a1,48
5a2: 8556 mv a0,s5
5a4: 00000097 auipc ra,0x0
5a8: e2e080e7 jalr -466(ra) # 3d2 <putc>
putc(fd, 'x');
5ac: 07800593 li a1,120
5b0: 8556 mv a0,s5
5b2: 00000097 auipc ra,0x0
5b6: e20080e7 jalr -480(ra) # 3d2 <putc>
5ba: 896a mv s2,s10
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
5bc: 03c9d793 srli a5,s3,0x3c
5c0: 97de add a5,a5,s7
5c2: 0007c583 lbu a1,0(a5)
5c6: 8556 mv a0,s5
5c8: 00000097 auipc ra,0x0
5cc: e0a080e7 jalr -502(ra) # 3d2 <putc>
for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4)
5d0: 0992 slli s3,s3,0x4
5d2: 397d addiw s2,s2,-1
5d4: fe0914e3 bnez s2,5bc <vprintf+0x11c>
printptr(fd, va_arg(ap, uint64));
5d8: f8843b03 ld s6,-120(s0)
state = 0;
5dc: 4981 li s3,0
5de: b70d j 500 <vprintf+0x60>
s = va_arg(ap, char*);
5e0: 008b0913 addi s2,s6,8
5e4: 000b3983 ld s3,0(s6)
if(s == 0)
5e8: 02098163 beqz s3,60a <vprintf+0x16a>
while(*s != 0){
5ec: 0009c583 lbu a1,0(s3)
5f0: c5ad beqz a1,65a <vprintf+0x1ba>
putc(fd, *s);
5f2: 8556 mv a0,s5
5f4: 00000097 auipc ra,0x0
5f8: dde080e7 jalr -546(ra) # 3d2 <putc>
s++;
5fc: 0985 addi s3,s3,1
while(*s != 0){
5fe: 0009c583 lbu a1,0(s3)
602: f9e5 bnez a1,5f2 <vprintf+0x152>
s = va_arg(ap, char*);
604: 8b4a mv s6,s2
state = 0;
606: 4981 li s3,0
608: bde5 j 500 <vprintf+0x60>
s = "(null)";
60a: 00000997 auipc s3,0x0
60e: 27e98993 addi s3,s3,638 # 888 <malloc+0x124>
while(*s != 0){
612: 85ee mv a1,s11
614: bff9 j 5f2 <vprintf+0x152>
putc(fd, va_arg(ap, uint));
616: 008b0913 addi s2,s6,8
61a: 000b4583 lbu a1,0(s6)
61e: 8556 mv a0,s5
620: 00000097 auipc ra,0x0
624: db2080e7 jalr -590(ra) # 3d2 <putc>
628: 8b4a mv s6,s2
state = 0;
62a: 4981 li s3,0
62c: bdd1 j 500 <vprintf+0x60>
putc(fd, c);
62e: 85d2 mv a1,s4
630: 8556 mv a0,s5
632: 00000097 auipc ra,0x0
636: da0080e7 jalr -608(ra) # 3d2 <putc>
state = 0;
63a: 4981 li s3,0
63c: b5d1 j 500 <vprintf+0x60>
putc(fd, '%');
63e: 85d2 mv a1,s4
640: 8556 mv a0,s5
642: 00000097 auipc ra,0x0
646: d90080e7 jalr -624(ra) # 3d2 <putc>
putc(fd, c);
64a: 85ca mv a1,s2
64c: 8556 mv a0,s5
64e: 00000097 auipc ra,0x0
652: d84080e7 jalr -636(ra) # 3d2 <putc>
state = 0;
656: 4981 li s3,0
658: b565 j 500 <vprintf+0x60>
s = va_arg(ap, char*);
65a: 8b4a mv s6,s2
state = 0;
65c: 4981 li s3,0
65e: b54d j 500 <vprintf+0x60>
}
}
}
660: 70e6 ld ra,120(sp)
662: 7446 ld s0,112(sp)
664: 74a6 ld s1,104(sp)
666: 7906 ld s2,96(sp)
668: 69e6 ld s3,88(sp)
66a: 6a46 ld s4,80(sp)
66c: 6aa6 ld s5,72(sp)
66e: 6b06 ld s6,64(sp)
670: 7be2 ld s7,56(sp)
672: 7c42 ld s8,48(sp)
674: 7ca2 ld s9,40(sp)
676: 7d02 ld s10,32(sp)
678: 6de2 ld s11,24(sp)
67a: 6109 addi sp,sp,128
67c: 8082 ret
000000000000067e <fprintf>:
void
fprintf(int fd, const char *fmt, ...)
{
67e: 715d addi sp,sp,-80
680: ec06 sd ra,24(sp)
682: e822 sd s0,16(sp)
684: 1000 addi s0,sp,32
686: e010 sd a2,0(s0)
688: e414 sd a3,8(s0)
68a: e818 sd a4,16(s0)
68c: ec1c sd a5,24(s0)
68e: 03043023 sd a6,32(s0)
692: 03143423 sd a7,40(s0)
va_list ap;
va_start(ap, fmt);
696: fe843423 sd s0,-24(s0)
vprintf(fd, fmt, ap);
69a: 8622 mv a2,s0
69c: 00000097 auipc ra,0x0
6a0: e04080e7 jalr -508(ra) # 4a0 <vprintf>
}
6a4: 60e2 ld ra,24(sp)
6a6: 6442 ld s0,16(sp)
6a8: 6161 addi sp,sp,80
6aa: 8082 ret
00000000000006ac <printf>:
void
printf(const char *fmt, ...)
{
6ac: 711d addi sp,sp,-96
6ae: ec06 sd ra,24(sp)
6b0: e822 sd s0,16(sp)
6b2: 1000 addi s0,sp,32
6b4: e40c sd a1,8(s0)
6b6: e810 sd a2,16(s0)
6b8: ec14 sd a3,24(s0)
6ba: f018 sd a4,32(s0)
6bc: f41c sd a5,40(s0)
6be: 03043823 sd a6,48(s0)
6c2: 03143c23 sd a7,56(s0)
va_list ap;
va_start(ap, fmt);
6c6: 00840613 addi a2,s0,8
6ca: fec43423 sd a2,-24(s0)
vprintf(1, fmt, ap);
6ce: 85aa mv a1,a0
6d0: 4505 li a0,1
6d2: 00000097 auipc ra,0x0
6d6: dce080e7 jalr -562(ra) # 4a0 <vprintf>
}
6da: 60e2 ld ra,24(sp)
6dc: 6442 ld s0,16(sp)
6de: 6125 addi sp,sp,96
6e0: 8082 ret
00000000000006e2 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
6e2: 1141 addi sp,sp,-16
6e4: e422 sd s0,8(sp)
6e6: 0800 addi s0,sp,16
Header *bp, *p;
bp = (Header*)ap - 1;
6e8: ff050693 addi a3,a0,-16
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
6ec: 00000797 auipc a5,0x0
6f0: 2147b783 ld a5,532(a5) # 900 <freep>
6f4: a02d j 71e <free+0x3c>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
6f6: 4618 lw a4,8(a2)
6f8: 9f2d addw a4,a4,a1
6fa: fee52c23 sw a4,-8(a0)
bp->s.ptr = p->s.ptr->s.ptr;
6fe: 6398 ld a4,0(a5)
700: 6310 ld a2,0(a4)
702: a83d j 740 <free+0x5e>
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
704: ff852703 lw a4,-8(a0)
708: 9f31 addw a4,a4,a2
70a: c798 sw a4,8(a5)
p->s.ptr = bp->s.ptr;
70c: ff053683 ld a3,-16(a0)
710: a091 j 754 <free+0x72>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
712: 6398 ld a4,0(a5)
714: 00e7e463 bltu a5,a4,71c <free+0x3a>
718: 00e6ea63 bltu a3,a4,72c <free+0x4a>
{
71c: 87ba mv a5,a4
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
71e: fed7fae3 bgeu a5,a3,712 <free+0x30>
722: 6398 ld a4,0(a5)
724: 00e6e463 bltu a3,a4,72c <free+0x4a>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
728: fee7eae3 bltu a5,a4,71c <free+0x3a>
if(bp + bp->s.size == p->s.ptr){
72c: ff852583 lw a1,-8(a0)
730: 6390 ld a2,0(a5)
732: 02059813 slli a6,a1,0x20
736: 01c85713 srli a4,a6,0x1c
73a: 9736 add a4,a4,a3
73c: fae60de3 beq a2,a4,6f6 <free+0x14>
bp->s.ptr = p->s.ptr->s.ptr;
740: fec53823 sd a2,-16(a0)
if(p + p->s.size == bp){
744: 4790 lw a2,8(a5)
746: 02061593 slli a1,a2,0x20
74a: 01c5d713 srli a4,a1,0x1c
74e: 973e add a4,a4,a5
750: fae68ae3 beq a3,a4,704 <free+0x22>
p->s.ptr = bp->s.ptr;
754: e394 sd a3,0(a5)
} else
p->s.ptr = bp;
freep = p;
756: 00000717 auipc a4,0x0
75a: 1af73523 sd a5,426(a4) # 900 <freep>
}
75e: 6422 ld s0,8(sp)
760: 0141 addi sp,sp,16
762: 8082 ret
0000000000000764 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
764: 7139 addi sp,sp,-64
766: fc06 sd ra,56(sp)
768: f822 sd s0,48(sp)
76a: f426 sd s1,40(sp)
76c: f04a sd s2,32(sp)
76e: ec4e sd s3,24(sp)
770: e852 sd s4,16(sp)
772: e456 sd s5,8(sp)
774: e05a sd s6,0(sp)
776: 0080 addi s0,sp,64
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
778: 02051493 slli s1,a0,0x20
77c: 9081 srli s1,s1,0x20
77e: 04bd addi s1,s1,15
780: 8091 srli s1,s1,0x4
782: 0014899b addiw s3,s1,1
786: 0485 addi s1,s1,1
if((prevp = freep) == 0){
788: 00000517 auipc a0,0x0
78c: 17853503 ld a0,376(a0) # 900 <freep>
790: c515 beqz a0,7bc <malloc+0x58>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
792: 611c ld a5,0(a0)
if(p->s.size >= nunits){
794: 4798 lw a4,8(a5)
796: 02977f63 bgeu a4,s1,7d4 <malloc+0x70>
79a: 8a4e mv s4,s3
79c: 0009871b sext.w a4,s3
7a0: 6685 lui a3,0x1
7a2: 00d77363 bgeu a4,a3,7a8 <malloc+0x44>
7a6: 6a05 lui s4,0x1
7a8: 000a0b1b sext.w s6,s4
p = sbrk(nu * sizeof(Header));
7ac: 004a1a1b slliw s4,s4,0x4
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
7b0: 00000917 auipc s2,0x0
7b4: 15090913 addi s2,s2,336 # 900 <freep>
if(p == (char*)-1)
7b8: 5afd li s5,-1
7ba: a895 j 82e <malloc+0xca>
base.s.ptr = freep = prevp = &base;
7bc: 00000797 auipc a5,0x0
7c0: 14c78793 addi a5,a5,332 # 908 <base>
7c4: 00000717 auipc a4,0x0
7c8: 12f73e23 sd a5,316(a4) # 900 <freep>
7cc: e39c sd a5,0(a5)
base.s.size = 0;
7ce: 0007a423 sw zero,8(a5)
if(p->s.size >= nunits){
7d2: b7e1 j 79a <malloc+0x36>
if(p->s.size == nunits)
7d4: 02e48c63 beq s1,a4,80c <malloc+0xa8>
p->s.size -= nunits;
7d8: 4137073b subw a4,a4,s3
7dc: c798 sw a4,8(a5)
p += p->s.size;
7de: 02071693 slli a3,a4,0x20
7e2: 01c6d713 srli a4,a3,0x1c
7e6: 97ba add a5,a5,a4
p->s.size = nunits;
7e8: 0137a423 sw s3,8(a5)
freep = prevp;
7ec: 00000717 auipc a4,0x0
7f0: 10a73a23 sd a0,276(a4) # 900 <freep>
return (void*)(p + 1);
7f4: 01078513 addi a0,a5,16
if((p = morecore(nunits)) == 0)
return 0;
}
}
7f8: 70e2 ld ra,56(sp)
7fa: 7442 ld s0,48(sp)
7fc: 74a2 ld s1,40(sp)
7fe: 7902 ld s2,32(sp)
800: 69e2 ld s3,24(sp)
802: 6a42 ld s4,16(sp)
804: 6aa2 ld s5,8(sp)
806: 6b02 ld s6,0(sp)
808: 6121 addi sp,sp,64
80a: 8082 ret
prevp->s.ptr = p->s.ptr;
80c: 6398 ld a4,0(a5)
80e: e118 sd a4,0(a0)
810: bff1 j 7ec <malloc+0x88>
hp->s.size = nu;
812: 01652423 sw s6,8(a0)
free((void*)(hp + 1));
816: 0541 addi a0,a0,16
818: 00000097 auipc ra,0x0
81c: eca080e7 jalr -310(ra) # 6e2 <free>
return freep;
820: 00093503 ld a0,0(s2)
if((p = morecore(nunits)) == 0)
824: d971 beqz a0,7f8 <malloc+0x94>
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
826: 611c ld a5,0(a0)
if(p->s.size >= nunits){
828: 4798 lw a4,8(a5)
82a: fa9775e3 bgeu a4,s1,7d4 <malloc+0x70>
if(p == freep)
82e: 00093703 ld a4,0(s2)
832: 853e mv a0,a5
834: fef719e3 bne a4,a5,826 <malloc+0xc2>
p = sbrk(nu * sizeof(Header));
838: 8552 mv a0,s4
83a: 00000097 auipc ra,0x0
83e: b68080e7 jalr -1176(ra) # 3a2 <sbrk>
if(p == (char*)-1)
842: fd5518e3 bne a0,s5,812 <malloc+0xae>
return 0;
846: 4501 li a0,0
848: bf45 j 7f8 <malloc+0x94>
|
src/test/resources/data/reorganizertests/test8.asm | cpcitor/mdlz80optimizer | 36 | 95484 | <filename>src/test/resources/data/reorganizertests/test8.asm<gh_stars>10-100
; Making sure the edge case of instructions directly specified as data is handled
; in this case, just for safety, the blocks before and after the "db" statement
; should not be moved.
ld a, 1
jp label1
label2: ; ideally, we would want this block to be moved at the very end,
; but the "db 0" breaks the block in two, and for safety, no
; optimization is made.
ld (hl), a
label3:
jr label3
label1:
add a,b
db 0 ; this is a "nop", but specified directly as a byte
jp label2
|
Data/List/Sort/MergeSort.agda | oisdk/agda-playground | 6 | 14617 | <filename>Data/List/Sort/MergeSort.agda
{-# OPTIONS --cubical --postfix-projections --safe #-}
open import Relation.Binary
open import Prelude
module Data.List.Sort.MergeSort {e} {E : Type e} {r₁ r₂} (totalOrder : TotalOrder E r₁ r₂) where
open TotalOrder totalOrder hiding (refl)
open import Data.List.Sort.InsertionSort totalOrder using (insert; insert-sort)
open import Data.List
open import Data.List.Properties
open import TreeFold
open import Algebra
open import Relation.Nullary.Decidable.Properties using (from-reflects)
open import Path.Reasoning
mergeˡ : E → (List E → List E) → List E → List E
mergeˡ x xs [] = x ∷ xs []
mergeˡ x xs (y ∷ ys) = if x ≤ᵇ y then x ∷ xs (y ∷ ys) else y ∷ mergeˡ x xs ys
_⋎_ : List E → List E → List E
_⋎_ = foldr mergeˡ id
merge-idʳ : ∀ xs → xs ⋎ [] ≡ xs
merge-idʳ [] = refl
merge-idʳ (x ∷ xs) = cong (x ∷_) (merge-idʳ xs)
merge-assoc : Associative _⋎_
merge-assoc [] ys zs = refl
merge-assoc (x ∷ xs) [] zs = cong (λ xs′ → mergeˡ x (xs′ ⋎_) zs) (merge-idʳ xs)
merge-assoc (x ∷ xs) (y ∷ ys) [] = merge-idʳ ((x ∷ xs) ⋎ (y ∷ ys)) ; cong ((x ∷ xs) ⋎_) (sym (merge-idʳ (y ∷ ys)))
merge-assoc (x ∷ xs) (y ∷ ys) (z ∷ zs)
with merge-assoc xs (y ∷ ys) (z ∷ zs)
| merge-assoc (x ∷ xs) ys (z ∷ zs)
| merge-assoc (x ∷ xs) (y ∷ ys) zs
| x ≤? y in x≤?y
| y ≤? z in y≤?z
... | _ | _ | r | no x≰y | no y≰z rewrite y≤?z rewrite x≤?y =
cong (z ∷_) r ;
cong (bool′ _ _)
(sym (from-reflects false (x ≤? z) (<⇒≱ (<-trans (≰⇒> y≰z) (≰⇒> x≰y)))))
... | _ | r | _ | no x≰y | yes y≤z rewrite y≤?z rewrite x≤?y = cong (y ∷_) r
... | r | _ | _ | yes x≤y | yes y≤z rewrite y≤?z rewrite x≤?y =
cong (bool′ _ _)
(from-reflects true (x ≤? z) (≤-trans x≤y y≤z)) ;
cong (x ∷_) r
merge-assoc (x ∷ xs) (y ∷ ys) (z ∷ zs) | rx≤z | _ | rx≰z | yes x≤y | no y≰z with x ≤? z
... | no x≰z rewrite x≤?y = cong (z ∷_) rx≰z
... | yes x≤z rewrite y≤?z = cong (x ∷_) rx≤z
merge-sort : List E → List E
merge-sort = treeFold _⋎_ [] ∘ map (_∷ [])
merge-insert : ∀ x xs → (x ∷ []) ⋎ xs ≡ insert x xs
merge-insert x [] = refl
merge-insert x (y ∷ xs) with x ≤ᵇ y
... | false = cong (y ∷_) (merge-insert x xs)
... | true = refl
merge≡insert-sort : ∀ xs → merge-sort xs ≡ insert-sort xs
merge≡insert-sort xs =
merge-sort xs ≡⟨⟩
treeFold _⋎_ [] (map (_∷ []) xs) ≡⟨ treeFoldHom _⋎_ [] merge-assoc (map (_∷ []) xs) ⟩
foldr _⋎_ [] (map (_∷ []) xs) ≡⟨ map-fusion _⋎_ [] (_∷ []) xs ⟩
foldr (λ x → (x ∷ []) ⋎_) [] xs ≡⟨ cong (λ f → foldr f [] xs) (funExt (funExt ∘ merge-insert)) ⟩
foldr insert [] xs ≡⟨⟩
insert-sort xs ∎
|
examples/utils/sdl/sdl_sdl_audio_h.ads | Fabien-Chouteau/GESTE | 13 | 12501 | <filename>examples/utils/sdl/sdl_sdl_audio_h.ads<gh_stars>10-100
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with SDL_SDL_stdinc_h;
with System;
with Interfaces.C.Strings;
limited with SDL_SDL_rwops_h;
package SDL_SDL_audio_h is
AUDIO_U8 : constant := 16#0008#; -- ../include/SDL/SDL_audio.h:100
AUDIO_S8 : constant := 16#8008#; -- ../include/SDL/SDL_audio.h:101
AUDIO_U16LSB : constant := 16#0010#; -- ../include/SDL/SDL_audio.h:102
AUDIO_S16LSB : constant := 16#8010#; -- ../include/SDL/SDL_audio.h:103
AUDIO_U16MSB : constant := 16#1010#; -- ../include/SDL/SDL_audio.h:104
AUDIO_S16MSB : constant := 16#9010#; -- ../include/SDL/SDL_audio.h:105
-- unsupported macro: AUDIO_U16 AUDIO_U16LSB
-- unsupported macro: AUDIO_S16 AUDIO_S16LSB
-- unsupported macro: AUDIO_U16SYS AUDIO_U16LSB
-- unsupported macro: AUDIO_S16SYS AUDIO_S16LSB
-- arg-macro: procedure SDL_LoadWAV (file, spec, audSDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
-- SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
SDL_MIX_MAXVOLUME : constant := 128; -- ../include/SDL/SDL_audio.h:250
type SDL_AudioSpec is record
freq : aliased int; -- ../include/SDL/SDL_audio.h:75
format : aliased SDL_SDL_stdinc_h.Uint16; -- ../include/SDL/SDL_audio.h:76
channels : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_audio.h:77
silence : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_audio.h:78
samples : aliased SDL_SDL_stdinc_h.Uint16; -- ../include/SDL/SDL_audio.h:79
padding : aliased SDL_SDL_stdinc_h.Uint16; -- ../include/SDL/SDL_audio.h:80
size : aliased SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_audio.h:81
callback : access procedure
(arg1 : System.Address;
arg2 : access SDL_SDL_stdinc_h.Uint8;
arg3 : int); -- ../include/SDL/SDL_audio.h:91
userdata : System.Address; -- ../include/SDL/SDL_audio.h:92
end record;
pragma Convention (C_Pass_By_Copy, SDL_AudioSpec); -- ../include/SDL/SDL_audio.h:74
type SDL_AudioCVT_filters_array is array (0 .. 9) of access procedure (arg1 : System.Address; arg2 : SDL_SDL_stdinc_h.Uint16);
type SDL_AudioCVT is record
needed : aliased int; -- ../include/SDL/SDL_audio.h:127
src_format : aliased SDL_SDL_stdinc_h.Uint16; -- ../include/SDL/SDL_audio.h:128
dst_format : aliased SDL_SDL_stdinc_h.Uint16; -- ../include/SDL/SDL_audio.h:129
rate_incr : aliased double; -- ../include/SDL/SDL_audio.h:130
buf : access SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_audio.h:131
len : aliased int; -- ../include/SDL/SDL_audio.h:132
len_cvt : aliased int; -- ../include/SDL/SDL_audio.h:133
len_mult : aliased int; -- ../include/SDL/SDL_audio.h:134
len_ratio : aliased double; -- ../include/SDL/SDL_audio.h:135
filters : aliased SDL_AudioCVT_filters_array; -- ../include/SDL/SDL_audio.h:136
filter_index : aliased int; -- ../include/SDL/SDL_audio.h:137
end record;
pragma Convention (C_Pass_By_Copy, SDL_AudioCVT); -- ../include/SDL/SDL_audio.h:126
function SDL_AudioInit (driver_name : Interfaces.C.Strings.chars_ptr) return int; -- ../include/SDL/SDL_audio.h:150
pragma Import (C, SDL_AudioInit, "SDL_AudioInit");
procedure SDL_AudioQuit; -- ../include/SDL/SDL_audio.h:151
pragma Import (C, SDL_AudioQuit, "SDL_AudioQuit");
function SDL_AudioDriverName (namebuf : Interfaces.C.Strings.chars_ptr; maxlen : int) return Interfaces.C.Strings.chars_ptr; -- ../include/SDL/SDL_audio.h:159
pragma Import (C, SDL_AudioDriverName, "SDL_AudioDriverName");
function SDL_OpenAudio (desired : access SDL_AudioSpec; obtained : access SDL_AudioSpec) return int; -- ../include/SDL/SDL_audio.h:178
pragma Import (C, SDL_OpenAudio, "SDL_OpenAudio");
type SDL_audiostatus is
(SDL_AUDIO_STOPPED,
SDL_AUDIO_PLAYING,
SDL_AUDIO_PAUSED);
pragma Convention (C, SDL_audiostatus); -- ../include/SDL/SDL_audio.h:184
function SDL_GetAudioStatus return SDL_audiostatus; -- ../include/SDL/SDL_audio.h:187
pragma Import (C, SDL_GetAudioStatus, "SDL_GetAudioStatus");
procedure SDL_PauseAudio (pause_on : int); -- ../include/SDL/SDL_audio.h:196
pragma Import (C, SDL_PauseAudio, "SDL_PauseAudio");
function SDL_LoadWAV_RW
(src : access SDL_SDL_rwops_h.SDL_RWops;
freesrc : int;
spec : access SDL_AudioSpec;
audio_buf : System.Address;
audio_len : access SDL_SDL_stdinc_h.Uint32) return access SDL_AudioSpec; -- ../include/SDL/SDL_audio.h:215
pragma Import (C, SDL_LoadWAV_RW, "SDL_LoadWAV_RW");
procedure SDL_FreeWAV (audio_buf : access SDL_SDL_stdinc_h.Uint8); -- ../include/SDL/SDL_audio.h:224
pragma Import (C, SDL_FreeWAV, "SDL_FreeWAV");
function SDL_BuildAudioCVT
(cvt : access SDL_AudioCVT;
src_format : SDL_SDL_stdinc_h.Uint16;
src_channels : SDL_SDL_stdinc_h.Uint8;
src_rate : int;
dst_format : SDL_SDL_stdinc_h.Uint16;
dst_channels : SDL_SDL_stdinc_h.Uint8;
dst_rate : int) return int; -- ../include/SDL/SDL_audio.h:234
pragma Import (C, SDL_BuildAudioCVT, "SDL_BuildAudioCVT");
function SDL_ConvertAudio (cvt : access SDL_AudioCVT) return int; -- ../include/SDL/SDL_audio.h:247
pragma Import (C, SDL_ConvertAudio, "SDL_ConvertAudio");
procedure SDL_MixAudio
(dst : access SDL_SDL_stdinc_h.Uint8;
src : access SDL_SDL_stdinc_h.Uint8;
len : SDL_SDL_stdinc_h.Uint32;
volume : int); -- ../include/SDL/SDL_audio.h:258
pragma Import (C, SDL_MixAudio, "SDL_MixAudio");
procedure SDL_LockAudio; -- ../include/SDL/SDL_audio.h:268
pragma Import (C, SDL_LockAudio, "SDL_LockAudio");
procedure SDL_UnlockAudio; -- ../include/SDL/SDL_audio.h:269
pragma Import (C, SDL_UnlockAudio, "SDL_UnlockAudio");
procedure SDL_CloseAudio; -- ../include/SDL/SDL_audio.h:275
pragma Import (C, SDL_CloseAudio, "SDL_CloseAudio");
end SDL_SDL_audio_h;
|
llvm-gcc-4.2-2.9/gcc/ada/s-traces-default.adb | vidkidz/crossbridge | 1 | 15816 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T R A C E S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-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. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Soft_Links;
with System.Parameters;
with System.Traces.Format;
package body System.Traces is
package SSL renames System.Soft_Links;
use System.Traces.Format;
----------------------
-- Send_Trace_Info --
----------------------
procedure Send_Trace_Info (Id : Trace_T) is
Task_S : constant String := SSL.Task_Name.all;
Trace_S : String (1 .. 3 + Task_S'Length);
begin
if Parameters.Runtime_Traces then
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. Trace_S'Last) := Task_S;
Send_Trace (Id, Trace_S);
end if;
end Send_Trace_Info;
procedure Send_Trace_Info (Id : Trace_T; Timeout : Duration) is
Task_S : constant String := SSL.Task_Name.all;
Timeout_S : constant String := Duration'Image (Timeout);
Trace_S : String (1 .. 6 + Task_S'Length + Timeout_S'Length);
begin
if Parameters.Runtime_Traces then
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + Task_S'Length) := Task_S;
Trace_S (4 + Task_S'Length .. 6 + Task_S'Length) := "/T:";
Trace_S (7 + Task_S'Length .. Trace_S'Last) := Timeout_S;
Send_Trace (Id, Trace_S);
end if;
end Send_Trace_Info;
end System.Traces;
|
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/_mul32.asm | gb-archive/really-old-stuff | 10 | 85571 |
; Ripped from: http://www.andreadrian.de/oldcpu/z80_number_cruncher.html#moztocid784223
; Used with permission.
; Multiplies 32x32 bit integer (DEHL x D'E'H'L')
; 64bit result is returned in H'L'H L B'C'A C
__MUL32_64START:
push hl
exx
ld b, h
ld c, l ; BC = Low Part (A)
pop hl ; HL = Load Part (B)
ex de, hl ; DE = Low Part (B), HL = HightPart(A) (must be in B'C')
push hl
exx
pop bc ; B'C' = HightPart(A)
exx ; A = B'C'BC , B = D'E'DE
; multiply routine 32 * 32bit = 64bit
; h'l'hlb'c'ac = b'c'bc * d'e'de
; needs register a, changes flags
;
; this routine was with tiny differences in the
; sinclair zx81 rom for the mantissa multiply
__LMUL:
and a ; reset carry flag
sbc hl,hl ; result bits 32..47 = 0
exx
sbc hl,hl ; result bits 48..63 = 0
exx
ld a,b ; mpr is b'c'ac
ld b,33 ; initialize loop counter
jp __LMULSTART
__LMULLOOP:
jr nc,__LMULNOADD ; JP is 2 cycles faster than JR. Since it's inside a LOOP
; it can save up to 33 * 2 = 66 cycles
; But JR if 3 cycles faster if JUMP not taken!
add hl,de ; result += mpd
exx
adc hl,de
exx
__LMULNOADD:
exx
rr h ; right shift upper
rr l ; 32bit of result
exx
rr h
rr l
__LMULSTART:
exx
rr b ; right shift mpr/
rr c ; lower 32bit of result
exx
rra ; equivalent to rr a
rr c
djnz __LMULLOOP
ret ; result in h'l'hlb'c'ac
|
libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sdcc_iy/wa_priority_queue_size.asm | meesokim/z88dk | 0 | 17606 | <filename>libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sdcc_iy/wa_priority_queue_size.asm
; size_t wa_priority_queue_size(wa_priority_queue_t *q)
SECTION code_adt_wa_priority_queue
PUBLIC _wa_priority_queue_size
EXTERN asm_wa_priority_queue_size
_wa_priority_queue_size:
pop af
pop hl
push hl
push af
jp asm_wa_priority_queue_size
|
programs/oeis/157/A157924.asm | karttu/loda | 1 | 87734 | <filename>programs/oeis/157/A157924.asm
; A157924: a(n) = 98*n - 1.
; 97,195,293,391,489,587,685,783,881,979,1077,1175,1273,1371,1469,1567,1665,1763,1861,1959,2057,2155,2253,2351,2449,2547,2645,2743,2841,2939,3037,3135,3233,3331,3429,3527,3625,3723,3821,3919,4017,4115,4213,4311,4409,4507,4605,4703,4801,4899,4997,5095,5193,5291,5389,5487,5585,5683,5781,5879,5977,6075,6173,6271,6369,6467,6565,6663,6761,6859,6957,7055,7153,7251,7349,7447,7545,7643,7741,7839,7937,8035,8133,8231,8329,8427,8525,8623,8721,8819,8917,9015,9113,9211,9309,9407,9505,9603,9701,9799,9897,9995,10093,10191,10289,10387,10485,10583,10681,10779,10877,10975,11073,11171,11269,11367,11465,11563,11661,11759,11857,11955,12053,12151,12249,12347,12445,12543,12641,12739,12837,12935,13033,13131,13229,13327,13425,13523,13621,13719,13817,13915,14013,14111,14209,14307,14405,14503,14601,14699,14797,14895,14993,15091,15189,15287,15385,15483,15581,15679,15777,15875,15973,16071,16169,16267,16365,16463,16561,16659,16757,16855,16953,17051,17149,17247,17345,17443,17541,17639,17737,17835,17933,18031,18129,18227,18325,18423,18521,18619,18717,18815,18913,19011,19109,19207,19305,19403,19501,19599,19697,19795,19893,19991,20089,20187,20285,20383,20481,20579,20677,20775,20873,20971,21069,21167,21265,21363,21461,21559,21657,21755,21853,21951,22049,22147,22245,22343,22441,22539,22637,22735,22833,22931,23029,23127,23225,23323,23421,23519,23617,23715,23813,23911,24009,24107,24205,24303,24401,24499
mov $1,$0
mul $1,98
add $1,97
|
programs/oeis/038/A038794.asm | neoneye/loda | 22 | 4090 | <reponame>neoneye/loda
; A038794: T(n,n-4), array T as in A038792.
; 1,5,12,21,34,55,88,138,211,314,455,643,888,1201,1594,2080,2673,3388,4241,5249,6430,7803,9388,11206,13279,15630,18283,21263,24596,28309,32430,36988,42013,47536,53589,60205,67418,75263
mov $2,$0
add $2,1
mov $12,$0
lpb $2
mov $0,$12
sub $2,1
sub $0,$2
mov $9,$0
mov $10,0
mov $11,$0
add $11,1
lpb $11
mov $0,$9
sub $11,1
sub $0,$11
mov $5,$0
mov $7,2
lpb $7
mov $0,$5
mov $3,0
sub $7,1
add $0,$7
sub $0,1
mov $4,$0
mov $0,-1
add $0,$4
add $3,$4
add $4,$0
add $0,1
trn $3,4
add $3,2
add $4,1
lpb $0
bin $0,3
add $3,$0
mov $0,1
add $3,2
mov $4,$3
lpe
mov $8,$7
lpb $8
mov $6,$4
sub $8,1
lpe
lpe
lpb $5
mov $5,0
sub $6,$4
lpe
mov $4,$6
add $4,1
add $10,$4
lpe
add $1,$10
lpe
mov $0,$1
|
test/Fail/PrimitiveInMutual.agda | alhassy/agda | 3 | 4221 | <reponame>alhassy/agda<gh_stars>1-10
-- Currently primitive functions are not allowed in mutual blocks.
-- This might change.
module PrimitiveInMutual where
postulate String : Set
{-# BUILTIN STRING String #-}
mutual
primitive primStringAppend : String -> String -> String
_++_ : String -> String -> String
x ++ y = primStringAppend x y
|
Transynther/x86/_processed/AVXALIGN/_ht_zr_/i7-8650U_0xd2.log_12660_1589.asm | ljhsiun2/medusa | 9 | 87628 | <filename>Transynther/x86/_processed/AVXALIGN/_ht_zr_/i7-8650U_0xd2.log_12660_1589.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x8535, %r12
nop
nop
nop
and $54539, %rax
mov (%r12), %esi
and $50597, %rdi
lea addresses_WC_ht+0xe155, %rcx
nop
nop
and $25492, %r15
mov (%rcx), %r9w
nop
nop
nop
nop
xor %rax, %rax
lea addresses_normal_ht+0xe4b5, %rsi
lea addresses_D_ht+0x11555, %rdi
nop
nop
and $22400, %r9
mov $55, %rcx
rep movsw
nop
nop
nop
nop
cmp $35117, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r9
push %rax
push %rcx
push %rdx
// Store
lea addresses_D+0x2f55, %r14
nop
and %rax, %rax
movw $0x5152, (%r14)
nop
nop
nop
nop
dec %r9
// Store
lea addresses_PSE+0x186d, %rdx
nop
nop
nop
xor $15174, %r13
movb $0x51, (%rdx)
sub $64417, %rdx
// Store
lea addresses_RW+0xbc55, %r13
clflush (%r13)
nop
nop
nop
inc %r14
movw $0x5152, (%r13)
nop
nop
nop
sub $52606, %rcx
// Store
mov $0x6a2f9100000002e1, %r14
clflush (%r14)
nop
nop
nop
nop
dec %rax
mov $0x5152535455565758, %r11
movq %r11, (%r14)
nop
nop
nop
nop
and %r11, %r11
// Store
lea addresses_WT+0x1a955, %rdx
nop
and %rax, %rax
mov $0x5152535455565758, %r9
movq %r9, %xmm3
movaps %xmm3, (%rdx)
nop
nop
sub $52924, %r14
// Faulty Load
lea addresses_A+0x7955, %r13
nop
nop
nop
nop
nop
sub $64291, %r11
movaps (%r13), %xmm1
vpextrq $1, %xmm1, %r14
lea oracles, %r9
and $0xff, %r14
shlq $12, %r14
mov (%r9,%r14,1), %r14
pop %rdx
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 11, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 5, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}}
{'00': 12646, '44': 14}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_video_gstvideosink_h.ads | persan/A-gst | 1 | 27925 | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with glib;
with glib.Values;
with System;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbasesink_h;
with System;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h;
with glib;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstvideosink_h is
-- unsupported macro: GST_TYPE_VIDEO_SINK (gst_video_sink_get_type())
-- arg-macro: function GST_VIDEO_SINK (obj)
-- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_SINK, GstVideoSink);
-- arg-macro: function GST_VIDEO_SINK_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass);
-- arg-macro: function GST_IS_VIDEO_SINK (obj)
-- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_SINK);
-- arg-macro: function GST_IS_VIDEO_SINK_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VIDEO_SINK);
-- arg-macro: function GST_VIDEO_SINK_GET_CLASS (klass)
-- return G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass);
-- arg-macro: function GST_VIDEO_SINK_CAST (obj)
-- return (GstVideoSink *) (obj);
-- arg-macro: procedure GST_VIDEO_SINK_PAD (obj)
-- GST_BASE_SINK_PAD(obj)
-- arg-macro: function GST_VIDEO_SINK_WIDTH (obj)
-- return GST_VIDEO_SINK_CAST (obj).width;
-- arg-macro: function GST_VIDEO_SINK_HEIGHT (obj)
-- return GST_VIDEO_SINK_CAST (obj).height;
-- GStreamer video sink base class
-- * Copyright (C) <2003> <NAME> <<EMAIL>>
-- * Copyright (C) <2009> <NAME> <tim centricular net>
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
-- FIXME 0.11: turn this into a proper base class
--*
-- * GST_VIDEO_SINK_CAST:
-- * @obj: a #GstVideoSink or derived object
-- *
-- * Cast @obj to a #GstVideoSink without runtime type check.
-- *
-- * Since: 0.10.12
--
--*
-- * GST_VIDEO_SINK_PAD:
-- * @obj: a #GstVideoSink
-- *
-- * Get the sink #GstPad of @obj.
--
type GstVideoSink;
type u_GstVideoSink_u_gst_reserved_array is array (0 .. 2) of System.Address;
--subtype GstVideoSink is u_GstVideoSink; -- gst/video/gstvideosink.h:64
type GstVideoSinkClass;
type u_GstVideoSinkClass_u_gst_reserved_array is array (0 .. 2) of System.Address;
--subtype GstVideoSinkClass is u_GstVideoSinkClass; -- gst/video/gstvideosink.h:65
type GstVideoRectangle;
--subtype GstVideoRectangle is u_GstVideoRectangle; -- gst/video/gstvideosink.h:66
-- skipped empty struct u_GstVideoSinkPrivate
-- skipped empty struct GstVideoSinkPrivate
--*
-- * GstVideoRectangle:
-- * @x: X coordinate of rectangle's top-left point
-- * @y: Y coordinate of rectangle's top-left point
-- * @w: width of the rectangle
-- * @h: height of the rectangle
-- *
-- * Helper structure representing a rectangular area.
--
type GstVideoRectangle is record
x : aliased GLIB.gint; -- gst/video/gstvideosink.h:79
y : aliased GLIB.gint; -- gst/video/gstvideosink.h:80
w : aliased GLIB.gint; -- gst/video/gstvideosink.h:81
h : aliased GLIB.gint; -- gst/video/gstvideosink.h:82
end record;
pragma Convention (C_Pass_By_Copy, GstVideoRectangle); -- gst/video/gstvideosink.h:78
--*
-- * GstVideoSink:
-- * @height: video height (derived class needs to set this)
-- * @width: video width (derived class needs to set this)
-- *
-- * The video sink instance structure. Derived video sinks should set the
-- * @height and @width members.
--
-- FIXME 0.11: this should not be called 'element'
type GstVideoSink is record
element : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbasesink_h.GstBaseSink; -- gst/video/gstvideosink.h:94
width : aliased GLIB.gint; -- gst/video/gstvideosink.h:97
height : aliased GLIB.gint; -- gst/video/gstvideosink.h:97
priv : System.Address; -- gst/video/gstvideosink.h:100
u_gst_reserved : u_GstVideoSink_u_gst_reserved_array; -- gst/video/gstvideosink.h:102
end record;
pragma Convention (C_Pass_By_Copy, GstVideoSink); -- gst/video/gstvideosink.h:93
--< public >
--< private >
--*
-- * GstVideoSinkClass:
-- * @parent_class: the parent class structure
-- * @show_frame: render a video frame. Maps to #GstBaseSinkClass.render() and
-- * #GstBaseSinkClass.preroll() vfuncs. Rendering during preroll will be
-- * suppressed if the #GstVideoSink:show-preroll-frame property is set to
-- * %FALSE. Since: 0.10.25
-- *
-- * The video sink class structure. Derived classes should override the
-- * @show_frame virtual function.
--
type GstVideoSinkClass is record
parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbasesink_h.GstBaseSinkClass; -- gst/video/gstvideosink.h:117
show_frame : access function (arg1 : access GstVideoSink; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/video/gstvideosink.h:119
u_gst_reserved : u_GstVideoSinkClass_u_gst_reserved_array; -- gst/video/gstvideosink.h:122
end record;
pragma Convention (C_Pass_By_Copy, GstVideoSinkClass); -- gst/video/gstvideosink.h:116
--< private >
function gst_video_sink_get_type return GLIB.GType; -- gst/video/gstvideosink.h:125
pragma Import (C, gst_video_sink_get_type, "gst_video_sink_get_type");
procedure gst_video_sink_center_rect
(src : GstVideoRectangle;
dst : GstVideoRectangle;
result : access GstVideoRectangle;
scaling : GLIB.gboolean); -- gst/video/gstvideosink.h:127
pragma Import (C, gst_video_sink_center_rect, "gst_video_sink_center_rect");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstvideosink_h;
|
programs/oeis/182/A182079.asm | jmorken/loda | 1 | 22702 | ; A182079: a(n) = floor(n*floor((n-1)/2)/3).
; 0,0,0,1,1,3,4,7,8,12,13,18,20,26,28,35,37,45,48,57,60,70,73,84,88,100,104,117,121,135,140,155,160,176,181,198,204,222,228,247,253,273,280,301,308,330,337,360,368,392,400,425,433,459,468,495,504,532,541,570,580,610,620,651,661,693,704,737,748,782,793,828,840,876,888,925,937,975,988,1027,1040,1080,1093,1134,1148,1190,1204,1247,1261,1305,1320,1365,1380,1426,1441,1488,1504,1552,1568,1617,1633,1683,1700,1751,1768,1820,1837,1890,1908,1962,1980,2035,2053,2109,2128,2185,2204,2262,2281,2340,2360,2420,2440,2501,2521,2583,2604,2667,2688,2752,2773,2838,2860,2926,2948,3015,3037,3105,3128,3197,3220,3290,3313,3384,3408,3480,3504,3577,3601,3675,3700,3775,3800,3876,3901,3978,4004,4082,4108,4187,4213,4293,4320,4401,4428,4510,4537,4620,4648,4732,4760,4845,4873,4959,4988,5075,5104,5192,5221,5310,5340,5430,5460,5551,5581,5673,5704,5797,5828,5922,5953,6048,6080,6176,6208,6305,6337,6435,6468,6567,6600,6700,6733,6834,6868,6970,7004,7107,7141,7245,7280,7385,7420,7526,7561,7668,7704,7812,7848,7957,7993,8103,8140,8251,8288,8400,8437,8550,8588,8702,8740,8855,8893,9009,9048,9165,9204,9322,9361,9480,9520,9640,9680,9801,9841,9963,10004,10127,10168,10292
mov $2,$0
mov $3,$0
lpb $3
lpb $0
trn $0,6
add $1,$3
sub $1,$2
add $4,3
trn $4,$2
lpe
sub $2,1
mov $5,1
lpb $5
sub $3,1
trn $5,$3
lpe
add $0,2
lpb $4
trn $3,$0
trn $4,5
lpe
trn $2,1
lpe
|
software/lib/ulog/ulog.ads | TUM-EI-RCS/StratoX | 12 | 12654 | -- Institution: Technische Universitaet Muenchen
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
-- Author: <NAME> (<EMAIL>)
with Ada.Real_Time;
with Interfaces;
with HIL;
-- @summary
-- Implements the structure andserialization of log objects
-- according to the self-describing ULOG file format used
-- in PX4.
-- The serialized byte array is returned.
--
-- Polymorphism with tagged type fails, because we cannot
-- copy a polymorphic object in SPARK.
-- TODO: offer a project-wide Ulog.Register_Parameter() function.
--
-- How to add a new message 'FOO':
-- 1. add another enum value 'FOO' to Message_Type
-- 2. extend record 'Message' with the case 'FOO'
-- 3. add procedure 'Serialize_Ulog_FOO' and only handle the
-- components for your new type
package ULog with SPARK_Mode is
-- types of log messages. Add new ones when needed.
type Message_Type is
(NONE, TEXT, GPS, BARO, IMU, MAG, CONTROLLER, NAV, LOG_QUEUE);
type GPS_fixtype is
(NOFIX, DEADR, FIX2D, FIX3D, FIX3DDEADR, FIXTIME);
-- polymorphism via variant record. Everything must be initialized
type Message (Typ : Message_Type := NONE) is record
t : Ada.Real_Time.Time := Ada.Real_Time.Time_First; -- set by caller
case Typ is
when NONE => null;
when TEXT =>
-- text message with up to 128 characters
txt : String (1 .. 128) := (others => Character'Val (0));
txt_last : Integer := 0; -- points to last valid char
when GPS =>
-- GPS message
gps_year : Interfaces.Unsigned_16 := 0;
gps_month : Interfaces.Unsigned_8 := 0;
gps_day : Interfaces.Unsigned_8 := 0;
gps_hour : Interfaces.Unsigned_8 := 0;
gps_min : Interfaces.Unsigned_8 := 0;
gps_sec : Interfaces.Unsigned_8 := 0;
fix : Interfaces.Unsigned_8 := 0;
nsat : Interfaces.Unsigned_8 := 0;
lat : Float := 0.0;
lon : Float := 0.0;
alt : Float := 0.0;
vel : Float := 0.0;
pos_acc : Float := 0.0;
when BARO =>
pressure : Float := 0.0;
temp : Float := 0.0;
press_alt : Float := 0.0;
when IMU =>
accX : Float := 0.0;
accY : Float := 0.0;
accZ : Float := 0.0;
gyroX : Float := 0.0;
gyroY : Float := 0.0;
gyroZ : Float := 0.0;
roll : Float := 0.0;
pitch : Float := 0.0;
yaw : Float := 0.0;
when MAG =>
magX : Float := 0.0;
magY : Float := 0.0;
magZ : Float := 0.0;
when CONTROLLER =>
ctrl_mode : Interfaces.Unsigned_8 := 0;
target_yaw : Float := 0.0;
target_roll : Float := 0.0;
target_pitch : Float := 0.0;
elevon_left : Float := 0.0;
elevon_right : Float := 0.0;
when NAV =>
home_dist : Float := 0.0;
home_course : Float := 0.0;
home_altdiff : Float := 0.0;
when LOG_QUEUE =>
-- logging queue info
n_overflows : Interfaces.Unsigned_16 := 0;
n_queued : Interfaces.Unsigned_8 := 0;
max_queued : Interfaces.Unsigned_8 := 0;
end case;
end record;
--------------------------
-- Primitive operations
--------------------------
procedure Serialize_Ulog
(msg : in Message; len : out Natural; bytes : out HIL.Byte_Array)
with Post => len < 256 and -- ulog messages cannot be longer
then len <= bytes'Length;
-- turn object into ULOG byte array
-- @return len=number of bytes written in 'bytes'
-- procedure Serialize_CSV (msg : in Message;
-- len : out Natural; bytes : out HIL.Byte_Array);
-- turn object into CSV string/byte array
procedure Get_Header_Ulog (bytes : in out HIL.Byte_Array;
len : out Natural; valid : out Boolean)
with Post => len <= bytes'Length;
-- every ULOG file starts with a header, which is generated here
-- for all known message types
-- @return If true, you must keep calling this. If false, then all
-- message defs have been delivered
private
subtype ULog_Label is HIL.Byte_Array (1 .. 64);
subtype ULog_Format is HIL.Byte_Array (1 .. 16);
subtype ULog_Name is HIL.Byte_Array (1 .. 4);
end ULog;
|
src/natools-smaz-tools.adb | faelys/natools | 0 | 18171 | <reponame>faelys/natools
------------------------------------------------------------------------------
-- Copyright (c) 2016, <NAME> --
-- --
-- Permission to use, copy, modify, and 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. --
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
package body Natools.Smaz.Tools is
package Sx renames Natools.S_Expressions;
function Build_Node
(Map : Dictionary_Maps.Map;
Empty_Value : Natural)
return Trie_Node;
function Dummy_Hash (Value : String) return Natural;
-- Placeholder for Hash member, always raises Program_Error
function Image (B : Boolean) return String;
-- Return correctly-cased image of B
procedure Free is new Ada.Unchecked_Deallocation
(Trie_Node, Trie_Node_Access);
------------------------------
-- Local Helper Subprograms --
------------------------------
function Build_Node
(Map : Dictionary_Maps.Map;
Empty_Value : Natural)
return Trie_Node
is
function First_Character (S : String) return Character
is (S (S'First));
function Is_Current (Cursor : Dictionary_Maps.Cursor; C : Character)
return Boolean
is (Dictionary_Maps.Has_Element (Cursor)
and then First_Character (Dictionary_Maps.Key (Cursor)) = C);
function Suffix (S : String) return String;
function Suffix (S : String) return String is
begin
return S (S'First + 1 .. S'Last);
end Suffix;
use type Ada.Containers.Count_Type;
Cursor : Dictionary_Maps.Cursor;
Result : Trie_Node
:= (Ada.Finalization.Controlled with
Is_Leaf => False,
Index => Empty_Value,
Children => (others => null));
begin
pragma Assert (Dictionary_Maps.Length (Map) >= 1);
Cursor := Dictionary_Maps.Find (Map, "");
if Dictionary_Maps.Has_Element (Cursor) then
Result.Index := Natural (Dictionary_Maps.Element (Cursor));
end if;
for C in Character'Range loop
Cursor := Dictionary_Maps.Ceiling (Map, (1 => C));
if Is_Current (Cursor, C) then
if not Is_Current (Dictionary_Maps.Next (Cursor), C)
and then Dictionary_Maps.Key (Cursor) = (1 => C)
then
Result.Children (C)
:= new Trie_Node'(Ada.Finalization.Controlled with
Is_Leaf => True,
Index => Natural (Dictionary_Maps.Element (Cursor)));
else
declare
New_Map : Dictionary_Maps.Map;
begin
loop
Dictionary_Maps.Insert
(New_Map,
Suffix (Dictionary_Maps.Key (Cursor)),
Dictionary_Maps.Element (Cursor));
Dictionary_Maps.Next (Cursor);
exit when not Is_Current (Cursor, C);
end loop;
Result.Children (C)
:= new Trie_Node'(Build_Node (New_Map, Empty_Value));
end;
end if;
end if;
end loop;
return Result;
end Build_Node;
function Dummy_Hash (Value : String) return Natural is
pragma Unreferenced (Value);
begin
raise Program_Error with "Dummy_Hash called";
return 0;
end Dummy_Hash;
function Image (B : Boolean) return String is
begin
if B then
return "True";
else
return "False";
end if;
end Image;
----------------------
-- Public Interface --
----------------------
function Append_String
(Dict : in Dictionary;
Value : in String)
return Dictionary is
begin
return Dictionary'
(Dict_Last => Dict.Dict_Last + 1,
String_Size => Dict.String_Size + Value'Length,
Variable_Length_Verbatim => Dict.Variable_Length_Verbatim,
Max_Word_Length => Positive'Max (Dict.Max_Word_Length, Value'Length),
Offsets => Dict.Offsets & (1 => Dict.String_Size + 1),
Values => Dict.Values & Value,
Hash => Dummy_Hash'Access);
end Append_String;
procedure Print_Dictionary_In_Ada
(Dict : in Dictionary;
Hash_Image : in String := "TODO";
Max_Width : in Positive := 70;
First_Prefix : in String := " := (";
Prefix : in String := " ";
Half_Indent : in String := " ")
is
procedure Append_Entity
(Buffer : in out String;
Last : in out Natural;
Entity : in String);
function Double_Quote (S : String; Count : Natural) return String;
function Offsets_Suffix (I : Ada.Streams.Stream_Element) return String;
function Strip_Image (S : String) return String;
function Values_Separator (I : Positive) return String;
procedure Append_Entity
(Buffer : in out String;
Last : in out Natural;
Entity : in String) is
begin
if Last + 1 + Entity'Length <= Buffer'Last then
Buffer (Last + 1) := ' ';
Buffer (Last + 2 .. Last + 1 + Entity'Length) := Entity;
Last := Last + 1 + Entity'Length;
else
Put_Line (Buffer (Buffer'First .. Last));
Last := Buffer'First + Prefix'Length - 1;
Buffer (Last + 1 .. Last + Half_Indent'Length) := Half_Indent;
Last := Last + Half_Indent'Length;
Buffer (Last + 1 .. Last + Entity'Length) := Entity;
Last := Last + Entity'Length;
end if;
end Append_Entity;
function Double_Quote (S : String; Count : Natural) return String is
begin
if Count = 0 then
return S;
else
return Quoted : String (1 .. S'Length + Count) do
declare
O : Positive := Quoted'First;
begin
for I in S'Range loop
Quoted (O) := S (I);
O := O + 1;
if S (I) = '"' then
Quoted (O) := S (I);
O := O + 1;
end if;
end loop;
end;
end return;
end if;
end Double_Quote;
function Offsets_Suffix (I : Ada.Streams.Stream_Element) return String is
begin
if I < Dict.Offsets'Last then
return ",";
else
return "),";
end if;
end Offsets_Suffix;
function Strip_Image (S : String) return String is
begin
if S'Length > 0 and then S (S'First) = ' ' then
return S (S'First + 1 .. S'Last);
else
return S;
end if;
end Strip_Image;
function Values_Separator (I : Positive) return String is
begin
if I > Dict.Values'First then
return "& ";
else
return "";
end if;
end Values_Separator;
Line_Buffer : String (1 .. Max_Width + Prefix'Length);
Buffer_Last : Natural;
begin
Put_Line (First_Prefix & "Dict_Last =>"
& Ada.Streams.Stream_Element'Image (Dict.Dict_Last) & ',');
Put_Line (Prefix & "String_Size =>"
& Natural'Image (Dict.String_Size) & ',');
Put_Line (Prefix & "Variable_Length_Verbatim => "
& Image (Dict.Variable_Length_Verbatim) & ',');
Put_Line (Prefix & "Max_Word_Length =>"
& Natural'Image (Dict.Max_Word_Length) & ',');
Line_Buffer (1 .. Prefix'Length) := Prefix;
Line_Buffer (Prefix'Length + 1 .. Prefix'Length + 11) := "Offsets => ";
Buffer_Last := Prefix'Length + 11;
for I in Dict.Offsets'Range loop
Append_Entity (Line_Buffer, Buffer_Last, Strip_Image
(Positive'Image (Dict.Offsets (I)) & Offsets_Suffix (I)));
if I = Dict.Offsets'First then
Line_Buffer (Prefix'Length + 12) := '(';
end if;
end loop;
Put_Line (Line_Buffer (Line_Buffer'First .. Buffer_Last));
Line_Buffer (Prefix'Length + 1 .. Prefix'Length + 9) := "Values =>";
Buffer_Last := Prefix'Length + 9;
declare
I : Positive := Dict.Values'First;
First, Last : Positive;
Quote_Count : Natural;
begin
Values_Loop :
while I <= Dict.Values'Last loop
Add_Unprintable :
while Dict.Values (I) not in ' ' .. '~' loop
Append_Entity
(Line_Buffer, Buffer_Last,
Values_Separator (I) & Character'Image (Dict.Values (I)));
I := I + 1;
exit Values_Loop when I > Dict.Values'Last;
end loop Add_Unprintable;
First := I;
Quote_Count := 0;
Find_Printable_Substring :
loop
if Dict.Values (I) = '"' then
Quote_Count := Quote_Count + 1;
end if;
I := I + 1;
exit Find_Printable_Substring when I > Dict.Values'Last
or else Dict.Values (I) not in ' ' .. '~';
end loop Find_Printable_Substring;
Last := I - 1;
Split_Lines :
loop
declare
Partial_Quote_Count : Natural := 0;
Partial_Width : Natural := 0;
Partial_Last : Natural := First - 1;
Sep : constant String := Values_Separator (First);
Available_Length : constant Natural
:= (if Line_Buffer'Last > Buffer_Last + Sep'Length + 4
then Line_Buffer'Last - Buffer_Last - Sep'Length - 4
else Line_Buffer'Length - Prefix'Length
- Half_Indent'Length - Sep'Length - 3);
begin
if 1 + Last - First + Quote_Count < Available_Length then
Append_Entity
(Line_Buffer, Buffer_Last,
Sep & '"' & Double_Quote
(Dict.Values (First .. Last), Quote_Count) & '"');
exit Split_Lines;
else
Count_Quotes :
loop
if Dict.Values (Partial_Last + 1) = '"' then
exit Count_Quotes
when Partial_Width + 2 > Available_Length;
Partial_Width := Partial_Width + 1;
Partial_Quote_Count := Partial_Quote_Count + 1;
else
exit Count_Quotes
when Partial_Width + 1 > Available_Length;
end if;
Partial_Width := Partial_Width + 1;
Partial_Last := Partial_Last + 1;
end loop Count_Quotes;
Append_Entity
(Line_Buffer, Buffer_Last, Sep & '"'
& Double_Quote
(Dict.Values (First .. Partial_Last),
Partial_Quote_Count)
& '"');
First := Partial_Last + 1;
Quote_Count := Quote_Count - Partial_Quote_Count;
end if;
end;
end loop Split_Lines;
end loop Values_Loop;
Put_Line (Line_Buffer (Line_Buffer'First .. Buffer_Last) & ',');
end;
Line_Buffer (Prefix'Length + 1 .. Prefix'Length + 7) := "Hash =>";
Buffer_Last := Prefix'Length + 7;
Append_Entity (Line_Buffer, Buffer_Last, Hash_Image & ");");
Put_Line (Line_Buffer (Line_Buffer'First .. Buffer_Last));
end Print_Dictionary_In_Ada;
procedure Read_List
(List : out String_Lists.List;
Descriptor : in out S_Expressions.Descriptor'Class)
is
use type Sx.Events.Event;
Event : Sx.Events.Event := Descriptor.Current_Event;
begin
String_Lists.Clear (List);
if Event = Sx.Events.Open_List then
Descriptor.Next (Event);
end if;
Read_Loop :
loop
case Event is
when Sx.Events.Add_Atom =>
String_Lists.Append
(List, Sx.To_String (Descriptor.Current_Atom));
when Sx.Events.Open_List =>
Descriptor.Close_Current_List;
when Sx.Events.End_Of_Input | Sx.Events.Error
| Sx.Events.Close_List =>
exit Read_Loop;
end case;
Descriptor.Next (Event);
end loop Read_Loop;
end Read_List;
function Remove_Element
(Dict : in Dictionary;
Index : in Ada.Streams.Stream_Element)
return Dictionary
is
Removed_Length : constant Positive := Dict_Entry (Dict, Index)'Length;
function New_Offsets return Offset_Array;
function New_Values return String;
function New_Offsets return Offset_Array is
Result : Offset_Array (0 .. Dict.Dict_Last - 1);
begin
for I in Result'Range loop
if I < Index then
Result (I) := Dict.Offsets (I);
else
Result (I) := Dict.Offsets (I + 1) - Removed_Length;
end if;
end loop;
return Result;
end New_Offsets;
function New_Values return String is
begin
if Index < Dict.Dict_Last then
return Dict.Values (1 .. Dict.Offsets (Index) - 1)
& Dict.Values (Dict.Offsets (Index + 1) .. Dict.Values'Last);
else
return Dict.Values (1 .. Dict.Offsets (Index) - 1);
end if;
end New_Values;
New_Max_Word_Length : Positive := Dict.Max_Word_Length;
begin
if Removed_Length = Dict.Max_Word_Length then
New_Max_Word_Length := 1;
for I in Dict.Offsets'Range loop
if I /= Index
and then Dict_Entry (Dict, I)'Length > New_Max_Word_Length
then
New_Max_Word_Length := Dict_Entry (Dict, I)'Length;
end if;
end loop;
end if;
return Dictionary'
(Dict_Last => Dict.Dict_Last - 1,
String_Size => Dict.String_Size - Removed_Length,
Variable_Length_Verbatim => Dict.Variable_Length_Verbatim,
Max_Word_Length => New_Max_Word_Length,
Offsets => New_Offsets,
Values => New_Values,
Hash => Dummy_Hash'Access);
end Remove_Element;
function Replace_Element
(Dict : in Dictionary;
Index : in Ada.Streams.Stream_Element;
Value : in String)
return Dictionary
is
Removed_Length : constant Positive := Dict_Entry (Dict, Index)'Length;
Length_Delta : constant Integer := Value'Length - Removed_Length;
function New_Offsets return Offset_Array;
function New_Values return String;
function New_Offsets return Offset_Array is
Result : Offset_Array (Dict.Offsets'First .. Dict.Dict_Last);
begin
for I in Result'Range loop
if I <= Index then
Result (I) := Dict.Offsets (I);
else
Result (I) := Dict.Offsets (I) + Length_Delta;
end if;
end loop;
return Result;
end New_Offsets;
function New_Values return String is
begin
if Index = 0 then
return Value
& Dict.Values (Dict.Offsets (Index + 1) .. Dict.Values'Last);
elsif Index < Dict.Dict_Last then
return Dict.Values (1 .. Dict.Offsets (Index) - 1)
& Value
& Dict.Values (Dict.Offsets (Index + 1) .. Dict.Values'Last);
else
return Dict.Values (1 .. Dict.Offsets (Index) - 1) & Value;
end if;
end New_Values;
New_Max_Word_Length : Positive := Dict.Max_Word_Length;
begin
if Removed_Length = Dict.Max_Word_Length then
New_Max_Word_Length := 1;
for I in Dict.Offsets'Range loop
if I /= Index
and then Dict_Entry (Dict, I)'Length > New_Max_Word_Length
then
New_Max_Word_Length := Dict_Entry (Dict, I)'Length;
end if;
end loop;
end if;
if New_Max_Word_Length < Value'Length then
New_Max_Word_Length := Value'Length;
end if;
return Dictionary'
(Dict_Last => Dict.Dict_Last,
String_Size => Dict.String_Size + Length_Delta,
Variable_Length_Verbatim => Dict.Variable_Length_Verbatim,
Max_Word_Length => New_Max_Word_Length,
Offsets => New_Offsets,
Values => New_Values,
Hash => Dummy_Hash'Access);
end Replace_Element;
function To_Dictionary
(List : in String_Lists.List;
Variable_Length_Verbatim : in Boolean)
return Dictionary
is
Dict_Last : constant Ada.Streams.Stream_Element
:= Ada.Streams.Stream_Element (String_Lists.Length (List)) - 1;
String_Size : Natural := 0;
Max_Word_Length : Positive := 1;
begin
for S of List loop
String_Size := String_Size + S'Length;
if S'Length > Max_Word_Length then
Max_Word_Length := S'Length;
end if;
end loop;
declare
Offsets : Offset_Array (0 .. Dict_Last);
Values : String (1 .. String_Size);
Current_Offset : Positive := 1;
Current_Index : Ada.Streams.Stream_Element := 0;
Next_Offset : Positive;
begin
for S of List loop
Offsets (Current_Index) := Current_Offset;
Next_Offset := Current_Offset + S'Length;
Values (Current_Offset .. Next_Offset - 1) := S;
Current_Offset := Next_Offset;
Current_Index := Current_Index + 1;
end loop;
pragma Assert (Current_Index = Dict_Last + 1);
pragma Assert (Current_Offset = String_Size + 1);
return
(Dict_Last => Dict_Last,
String_Size => String_Size,
Variable_Length_Verbatim => Variable_Length_Verbatim,
Max_Word_Length => Max_Word_Length,
Offsets => Offsets,
Values => Values,
Hash => Dummy_Hash'Access);
end;
end To_Dictionary;
---------------------------------
-- Dynamic Dictionary Searches --
---------------------------------
overriding procedure Adjust (Node : in out Trie_Node) is
begin
if not Node.Is_Leaf then
for C in Node.Children'Range loop
if Node.Children (C) /= null then
Node.Children (C) := new Trie_Node'(Node.Children (C).all);
end if;
end loop;
end if;
end Adjust;
overriding procedure Finalize (Node : in out Trie_Node) is
begin
if not Node.Is_Leaf then
for C in Node.Children'Range loop
Free (Node.Children (C));
end loop;
end if;
end Finalize;
procedure Initialize (Trie : out Search_Trie; Dict : in Dictionary) is
Map : Dictionary_Maps.Map;
begin
for I in Dict.Offsets'Range loop
Dictionary_Maps.Insert (Map, Dict_Entry (Dict, I), I);
end loop;
Trie := (Not_Found => Natural (Dict.Dict_Last) + 1,
Root => Build_Node (Map, Natural (Dict.Dict_Last) + 1));
end Initialize;
function Linear_Search (Value : String) return Natural is
Result : Ada.Streams.Stream_Element := 0;
begin
for S of List_For_Linear_Search loop
exit when S = Value;
Result := Result + 1;
end loop;
return Natural (Result);
end Linear_Search;
function Map_Search (Value : String) return Natural is
Cursor : constant Dictionary_Maps.Cursor
:= Dictionary_Maps.Find (Search_Map, Value);
begin
if Dictionary_Maps.Has_Element (Cursor) then
return Natural (Dictionary_Maps.Element (Cursor));
else
return Natural (Ada.Streams.Stream_Element'Last);
end if;
end Map_Search;
function Search (Trie : in Search_Trie; Value : in String) return Natural is
Index : Positive := Value'First;
Position : Trie_Node_Access;
begin
if Value'Length = 0 then
return Trie.Not_Found;
end if;
Position := Trie.Root.Children (Value (Index));
loop
if Position = null then
return Trie.Not_Found;
end if;
Index := Index + 1;
if Index not in Value'Range then
return Position.Index;
elsif Position.Is_Leaf then
return Trie.Not_Found;
end if;
Position := Position.Children (Value (Index));
end loop;
end Search;
procedure Set_Dictionary_For_Map_Search (Dict : in Dictionary) is
begin
Dictionary_Maps.Clear (Search_Map);
for I in Dict.Offsets'Range loop
Dictionary_Maps.Insert (Search_Map, Dict_Entry (Dict, I), I);
end loop;
end Set_Dictionary_For_Map_Search;
procedure Set_Dictionary_For_Trie_Search (Dict : in Dictionary) is
begin
Initialize (Trie_For_Search, Dict);
end Set_Dictionary_For_Trie_Search;
function Trie_Search (Value : String) return Natural is
begin
return Search (Trie_For_Search, Value);
end Trie_Search;
-------------------
-- Word Counting --
-------------------
procedure Add_Substrings
(Counter : in out Word_Counter;
Phrase : in String;
Min_Size : in Positive;
Max_Size : in Positive) is
begin
for First in Phrase'First .. Phrase'Last - Min_Size + 1 loop
for Last in First + Min_Size - 1
.. Natural'Min (First + Max_Size - 1, Phrase'Last)
loop
Add_Word (Counter, Phrase (First .. Last));
end loop;
end loop;
end Add_Substrings;
procedure Add_Word
(Counter : in out Word_Counter;
Word : in String;
Count : in String_Count := 1)
is
procedure Update
(Key : in String; Element : in out String_Count);
procedure Update
(Key : in String; Element : in out String_Count)
is
pragma Unreferenced (Key);
begin
Element := Element + Count;
end Update;
Cursor : constant Word_Maps.Cursor := Word_Maps.Find (Counter.Map, Word);
begin
if Word_Maps.Has_Element (Cursor) then
Word_Maps.Update_Element (Counter.Map, Cursor, Update'Access);
else
Word_Maps.Insert (Counter.Map, Word, Count);
end if;
end Add_Word;
procedure Add_Words
(Counter : in out Word_Counter;
Phrase : in String;
Min_Size : in Positive;
Max_Size : in Positive)
is
subtype Word_Part is Character with Static_Predicate
=> Word_Part in '0' .. '9' | 'A' .. 'Z' | 'a' .. 'z'
| Character'Val (128) .. Character'Val (255);
I, First, Next : Positive;
begin
if Max_Size < Min_Size then
return;
end if;
I := Phrase'First;
Main_Loop :
while I in Phrase'Range loop
Skip_Non_Word :
while I in Phrase'Range and then Phrase (I) not in Word_Part loop
I := I + 1;
end loop Skip_Non_Word;
exit Main_Loop when I not in Phrase'Range;
First := I;
Skip_Word :
while I in Phrase'Range and then Phrase (I) in Word_Part loop
I := I + 1;
end loop Skip_Word;
Next := I;
if Next - First in Min_Size .. Max_Size then
Add_Word (Counter, Phrase (First .. Next - 1));
end if;
end loop Main_Loop;
end Add_Words;
procedure Evaluate_Dictionary
(Dict : in Dictionary;
Corpus : in String_Lists.List;
Compressed_Size : out Ada.Streams.Stream_Element_Count;
Counts : out Dictionary_Counts) is
begin
Compressed_Size := 0;
Counts := (others => 0);
for S of Corpus loop
Evaluate_Dictionary_Partial
(Dict, S, Compressed_Size, Counts);
end loop;
end Evaluate_Dictionary;
procedure Evaluate_Dictionary_Partial
(Dict : in Dictionary;
Corpus_Entry : in String;
Compressed_Size : in out Ada.Streams.Stream_Element_Count;
Counts : in out Dictionary_Counts)
is
use type Ada.Streams.Stream_Element_Offset;
Verbatim_Code_Count : constant Ada.Streams.Stream_Element_Offset
:= Ada.Streams.Stream_Element_Offset
(Ada.Streams.Stream_Element'Last - Dict.Dict_Last);
Verbatim_Length : Ada.Streams.Stream_Element_Offset;
Input_Byte : Ada.Streams.Stream_Element;
Compressed : constant Ada.Streams.Stream_Element_Array
:= Compress (Dict, Corpus_Entry);
Index : Ada.Streams.Stream_Element_Offset := Compressed'First;
begin
Compressed_Size := Compressed_Size + Compressed'Length;
while Index in Compressed'Range loop
Input_Byte := Compressed (Index);
if Input_Byte in Dict.Offsets'Range then
Counts (Input_Byte) := Counts (Input_Byte) + 1;
Index := Index + 1;
else
if not Dict.Variable_Length_Verbatim then
Verbatim_Length := Ada.Streams.Stream_Element_Offset
(Ada.Streams.Stream_Element'Last - Input_Byte) + 1;
elsif Input_Byte < Ada.Streams.Stream_Element'Last then
Verbatim_Length := Ada.Streams.Stream_Element_Offset
(Ada.Streams.Stream_Element'Last - Input_Byte);
else
Index := Index + 1;
Verbatim_Length := Ada.Streams.Stream_Element_Offset
(Compressed (Index)) + Verbatim_Code_Count - 1;
end if;
Index := Index + Verbatim_Length + 1;
end if;
end loop;
end Evaluate_Dictionary_Partial;
procedure Filter_By_Count
(Counter : in out Word_Counter;
Threshold_Count : in String_Count)
is
Position, Next : Word_Maps.Cursor;
begin
Position := Word_Maps.First (Counter.Map);
while Word_Maps.Has_Element (Position) loop
Next := Word_Maps.Next (Position);
if Word_Maps.Element (Position) < Threshold_Count then
Word_Maps.Delete (Counter.Map, Position);
end if;
Position := Next;
end loop;
pragma Assert (for all Count of Counter.Map => Count >= Threshold_Count);
end Filter_By_Count;
function Simple_Dictionary
(Counter : in Word_Counter;
Word_Count : in Natural;
Method : in Methods.Enum := Methods.Encoded)
return String_Lists.List
is
use type Ada.Containers.Count_Type;
Target_Count : constant Ada.Containers.Count_Type
:= Ada.Containers.Count_Type (Word_Count);
Set : Scored_Word_Sets.Set;
Result : String_Lists.List;
begin
for Cursor in Word_Maps.Iterate (Counter.Map) loop
Scored_Word_Sets.Include (Set, To_Scored_Word (Cursor, Method));
if Scored_Word_Sets.Length (Set) > Target_Count then
Scored_Word_Sets.Delete_Last (Set);
end if;
end loop;
for Cursor in Scored_Word_Sets.Iterate (Set) loop
Result.Append (Scored_Word_Sets.Element (Cursor).Word);
end loop;
return Result;
end Simple_Dictionary;
procedure Simple_Dictionary_And_Pending
(Counter : in Word_Counter;
Word_Count : in Natural;
Selected : out String_Lists.List;
Pending : out String_Lists.List;
Method : in Methods.Enum := Methods.Encoded;
Max_Pending_Count : in Ada.Containers.Count_Type
:= Ada.Containers.Count_Type'Last)
is
use type Ada.Containers.Count_Type;
Target_Count : constant Ada.Containers.Count_Type
:= Ada.Containers.Count_Type (Word_Count);
Set : Scored_Word_Sets.Set;
begin
for Cursor in Word_Maps.Iterate (Counter.Map) loop
Scored_Word_Sets.Insert (Set, To_Scored_Word (Cursor, Method));
end loop;
Selected := String_Lists.Empty_List;
Pending := String_Lists.Empty_List;
for Cursor in Scored_Word_Sets.Iterate (Set) loop
if String_Lists.Length (Selected) < Target_Count then
Selected.Append (Scored_Word_Sets.Element (Cursor).Word);
else
Pending.Append (Scored_Word_Sets.Element (Cursor).Word);
exit when String_Lists.Length (Selected) >= Max_Pending_Count;
end if;
end loop;
end Simple_Dictionary_And_Pending;
function To_Scored_Word
(Cursor : in Word_Maps.Cursor;
Method : in Methods.Enum)
return Scored_Word
is
Word : constant String := Word_Maps.Key (Cursor);
begin
return Scored_Word'
(Size => Word'Length,
Word => Word,
Score => Score (Word_Maps.Element (Cursor), Word'Length, Method));
end To_Scored_Word;
function Worst_Index
(Dict : in Dictionary;
Counts : in Dictionary_Counts;
Method : in Methods.Enum;
First, Last : in Ada.Streams.Stream_Element)
return Ada.Streams.Stream_Element
is
Result : Ada.Streams.Stream_Element := First;
Worst_Score : Score_Value := Score (Dict, Counts, First, Method);
S : Score_Value;
begin
for I in First + 1 .. Last loop
S := Score (Dict, Counts, I, Method);
if S < Worst_Score then
Result := I;
Worst_Score := S;
end if;
end loop;
return Result;
end Worst_Index;
end Natools.Smaz.Tools;
|
ADA_Project/src/motor.adb | Intelligente-sanntidssystemer/Ada-prosjekt | 0 | 10569 | <filename>ADA_Project/src/motor.adb<gh_stars>0
package body Motor is
BLE_Port : aliased Serial_Port (BLE_UART_Transceiver_IRQ);
BLE : Bluefruit_LE_Transceiver (BLE_Port'Access);
Period : constant Time_Span := Milliseconds (System_Configuration.Remote_Control_Period);
Current_Vector : Travel_Vector := (0, Forward, Emergency_Braking => False) with
Atomic, Async_Readers, Async_Writers;
Temp_Vector : Travel_Vector;
Current_Steering_Target : Integer := 0 with
Atomic, Async_Readers, Async_Writers;
Temp_Target : Integer;
procedure Initialize;
-- initialize the BLE receiver
procedure Receive
(Requested_Vector : out Travel_Vector;
Requested_Steering : out Integer);
-- Get the requested control values from the input device
----------------------
-- Requested_Vector --
----------------------
function Requested_Vector return Travel_Vector is
begin
return Current_Vector;
end Requested_Vector;
------------------------------
-- Requested_Steering_Angle --
------------------------------
function Requested_Steering_Angle return Integer is
begin
return Current_Steering_Target;
end Requested_Steering_Angle;
----------
-- Pump --
----------
task body Pump is
Next_Release : Time;
begin
Global_Initialization.Critical_Instant.Wait (Epoch => Next_Release);
loop
Receive (Temp_Vector, Temp_Target);
Current_Vector := Temp_Vector;
Current_Steering_Target := Temp_Target;
Next_Release := Next_Release + Period;
delay until Next_Release;
end loop;
end Pump;
-----------------------
-- Parse_App_Message --
-----------------------
procedure Parse_App_Message is
new Parse_AdaFruit_Controller_Message (Payload => Three_Axes_Data);
-------------
-- Receive --
-------------
procedure Receive
(Requested_Vector : out Travel_Vector;
Requested_Steering : out Integer)
is
Buffer_Size : constant := 2 * Accelerometer_Msg_Length;
-- Buffer size is arbitrary but should be bigger than just one message
-- length. An integer multiple of that message length is a good idea.
-- The issue is that we will be receiving a continuous stream of such
-- messages from the phone, and we will not necessarily start receiving
-- just as a new message arrives. We might instead receive a partial
-- message at the beginning of the buffer. Thus when parsing we look for
-- the start of the message, but the point is that we need a big enough
-- buffer to handle at least one message and a partial message too. We
-- don't want the buffer size to be too big, though.
Buffer : String (1 .. Buffer_Size);
TAD : Three_Axes_Data;
Successful_Parse : Boolean;
Power : Integer;
begin
BLE.Get (Buffer);
Parse_App_Message (Buffer, Accelerometer_Msg, TAD, Successful_Parse);
if not Successful_Parse then
Requested_Vector.Emergency_Braking := True;
Requested_Vector.Power := 0;
Requested_Steering := 0;
return;
end if;
Requested_Steering := Integer (TAD.Y * 100.0);
Power := Integer (-TAD.X * 100.0);
if Power > 0 then
Requested_Vector.Direction := Forward;
elsif Power < 0 then
Requested_Vector.Direction := Backward;
Power := -Power; -- hence is positive
else -- zero
Requested_Vector.Direction := Neither;
end if;
Requested_Vector.Power := Integer'Min (100, Power);
-- we don't have a way to signal Emergency braking with the phone...
end Receive;
----------------
-- Initialize --
----------------
procedure Initialize is
BLE_Friend_Baudrate : constant := 9600;
begin
BLE_Port.Initialize
(Transceiver => BLE_UART_Transceiver,
Transceiver_AF => BLE_UART_Transceiver_AF,
Tx_Pin => BLE_UART_TXO_Pin,
Rx_Pin => BLE_UART_RXI_Pin,
CTS_Pin => BLE_UART_CTS_Pin,
RTS_Pin => BLE_UART_RTS_Pin);
BLE_Port.Configure (Baud_Rate => BLE_Friend_Baudrate);
BLE_Port.Set_CTS (False); -- essential!!
BLE.Configure (Mode_Pin => BLE_UART_MOD_Pin);
BLE.Set_Mode (Data);
end Initialize;
begin
-- initialize the BLE port for receiving messages
Initialize;
end Motor;
|
sharc/SHARCParser.g4 | ChristianWulf/grammars-v4 | 4 | 4876 | <reponame>ChristianWulf/grammars-v4<gh_stars>1-10
parser grammar SHARCParser;
options { tokenVocab=SHARCLexer; }
prog
: ( statement SEMICOLON )+
;
statement
: stmt_atom | ( ID COLON )+ stmt_atom
;
stmt_atom
: stmt | sec | seg | end_seg | directive_exp
;
//segment
sec
: DOT_SECTION seg_qualifier ID
;
seg
: DOT_SEGMENT seg_qualifier ID
;
end_seg
: DOT_ENDSEG
;
seg_qualifier
: seg_qualifier1 ( seg_qualifier2 | seg_qualifier3 )? | seg_qualifier2 ( seg_qualifier1 | seg_qualifier3 )? | seg_qualifier3 ( seg_qualifier1 | seg_qualifier2 )?
;
seg_qualifier1
: ( DIV ( seg_qualifier_1 | seg_qualifier_2 ) )
;
seg_qualifier2
: ( DIV seg_qualifier_3 )
;
seg_qualifier3
: ( DIV DMAONLY )
;
seg_qualifier_1
: PM | CODE
;
seg_qualifier_2
: DM | DATA | DATA64
;
seg_qualifier_3
: NO_INIT | ZERO_INIT | RUNTIME_INIT
;
stmt
: compute | flow_control_exp | imm_mov_exp | misc_exp | declaration | if_compute_mov | compute_mov_exp
;
//.VAR foo[N]="123.dat";
declaration
: DOT_VAR ( declaration_exp1 | declaration_exp2 | declaration_exp3 | declaration_exp4 | declaration_exp5 )
;
declaration_exp1
: ID ( COMMA ID )*
;
declaration_exp2
: EQU initExpression ( COMMA initExpression )*
;
declaration_exp3
: ID LBRACKET RBRACKET ( EQU declaration_exp_f2 )?
;
declaration_exp4
: ID LBRACKET value_exp RBRACKET ( EQU declaration_exp_f2 )?
;
declaration_exp5
: ID EQU value_exp
;
declaration_exp_f1
: initExpression ( COMMA initExpression )* | StringLiteral
;
declaration_exp_f2
: LBRACE declaration_exp_f1 RBRACE | declaration_exp_f1
;
initExpression
: value_exp | CharLiteral
;
//get addr
var_addr
: AT ID | LENGTH LPARENTHESE ID RPARENTHESE
;
value_exp
: value_exp2
;
value_exp2
: term ( ( PLUS | MINUS | MULT | DIV | DIV_MOD | I_OR | I_XOR ) term )*
;
term
: ( op = MINUS )? factor
;
factor
: atom | LPARENTHESE value_exp2 RPARENTHESE
;
atom
: INT | var_addr | ID
;
compute
: dual_op | fixpoint_alu_op | floating_point_alu_op | multi_op | shifter_op
;
//====================================================================================================
if_compute_mov
: IF condition if_compute_mov_exp
;
if_compute_mov_exp
: compute_mov_exp | compute
;
//move or modify instructions
compute_mov_exp
: ( compute COMMA )? ( mov_exp_1 | mov_exp_3a | mov_exp_3b | mov_exp_3c | mov_exp_3d | mov_exp_4a | mov_exp_4b | mov_exp_4c | mov_exp_4d | mov_exp_5 | mov_exp_7 )
;
mov_exp_1
: mov_exp_1_1 COMMA mov_exp_1_2
;
//DM(Ia, Mb) = dreg
//dreg = DM(Ia, Mb)
mov_exp_1_1
: mem_addr_dm_ia_mb EQU d_reg | d_reg EQU mem_addr_dm_ia_mb
;
//PM(Ic, Md) = dreg
//dreg = PM(Ic, Md)
mov_exp_1_2
: mem_addr_pm_ic_md EQU d_reg | d_reg EQU mem_addr_pm_ic_md
;
//DM(Ia, Mb) = ureg
//PM(Ic, Md)
mov_exp_3a
: ( mem_addr_dm_ia_mb | mem_addr_pm_ic_md ) EQU u_reg
;
//DM(Mb, Ia) = ureg
//PM(Md, Ic)
mov_exp_3b
: ( mem_addr_dm_mb_ia | mem_addr_pm_md_ic ) EQU u_reg
;
//u_reg = DM(Ia, Mb)
// PM(Ic, Md)
mov_exp_3c
: u_reg EQU ( mem_addr_dm_ia_mb | mem_addr_pm_ic_md )
;
//u_reg = DM(Mb, Ia)
// PM(Md, Ic)
mov_exp_3d
: u_reg EQU ( mem_addr_dm_mb_ia | mem_addr_pm_md_ic )
;
//DM(Ia, <data6>) = dreg
//PM(Ic, <data6>)
mov_exp_4a
: ( mem_addr_dm_ia_int | mem_addr_pm_ic_int ) EQU d_reg
;
//DM(<data6>, Ia) = dreg
//PM(Ic, <data6>)
mov_exp_4b
: imm_mov_15a
;
//d_reg = DM(Ia, <data6>)
// PM(Ic, <data6>)
mov_exp_4c
: d_reg EQU ( mem_addr_dm_ia_int | mem_addr_pm_ic_int )
;
//d_reg = DM(<data6>, Ia)
// PM(<data6>, Ic)
mov_exp_4d
: imm_mov_15b
;
//ureg1 = ureg2
mov_exp_5
: u_reg2 EQU u_reg
;
//DM(Ia, Mb) = dreg
//PM(Ic, Md)
mov_exp_6a
: ( mem_addr_dm_ia_mb | mem_addr_pm_ic_md ) EQU d_reg
;
//dreg = DM(Ia, Mb)
// PM(Ic, Md)
mov_exp_6b
: d_reg EQU ( mem_addr_dm_ia_mb | mem_addr_pm_ic_md )
;
//MODIFY (Ia, Mb)
// (Ic, Md)
mov_exp_7
: MODIFY ( LPARENTHESE ia COMMA mb RPARENTHESE | LPARENTHESE ic COMMA md RPARENTHESE )
;
mem_addr_ia_mb
: LPARENTHESE ia COMMA mb RPARENTHESE
;
mem_addr_ic_md
: LPARENTHESE ic COMMA md RPARENTHESE
;
mem_addr_md_ic
: LPARENTHESE md COMMA ic RPARENTHESE
;
mem_addr_mb_ia
: LPARENTHESE mb COMMA ia RPARENTHESE
;
mem_addr_ia_int
: LPARENTHESE ia COMMA value_exp RPARENTHESE
;
mem_addr_ic_int
: LPARENTHESE ic COMMA value_exp RPARENTHESE
;
mem_addr_int_ia
: LPARENTHESE value_exp COMMA ia RPARENTHESE
;
mem_addr_int_ic
: LPARENTHESE value_exp COMMA ic RPARENTHESE
;
mem_addr_int
:
//LPARENTHESE value_exp RPARENTHESE
//^(DIRECT value_exp) LPARENTHESE mem_addr_int_ RPARENTHESE
;
mem_addr_int_
: atom | atom ( PLUS | MINUS ) atom
;
mem_addr_dm_ia_mb
: DM mem_addr_ia_mb
;
mem_addr_pm_ic_md
: PM mem_addr_ic_md
;
mem_addr_dm_mb_ia
: DM mem_addr_mb_ia
;
mem_addr_pm_md_ic
: PM mem_addr_md_ic
;
mem_addr_dm_ia_int
: DM mem_addr_ia_int
;
mem_addr_pm_ic_int
: PM mem_addr_ic_int
;
mem_addr_dm_int_ia
: DM mem_addr_int_ia
;
mem_addr_pm_int_ic
: PM mem_addr_int_ic
;
mem_addr_dm_int
: DM mem_addr_int
;
mem_addr_pm_int
: PM mem_addr_int
;
//====================================================================================================
fixpoint_alu_op
: r_reg EQU r_exp | COMP LPARENTHESE r_reg COMMA r_reg RPARENTHESE
;
r_exp
: r_reg add_or_sub r_reg | r_reg PLUS r_reg PLUS CI | r_reg PLUS r_reg PLUS CI MINUS INT | LPARENTHESE r_reg PLUS r_reg RPARENTHESE DIV INT | r_reg PLUS CI | r_reg PLUS CI MINUS INT | r_reg PLUS INT | r_reg MINUS INT | MINUS r_reg | ABS r_reg | PASS r_reg | r_reg AND r_reg | r_reg OR r_reg | r_reg XOR r_reg | NOT r_reg | MIN LPARENTHESE r_reg COMMA r_reg RPARENTHESE | MAX LPARENTHESE r_reg COMMA r_reg RPARENTHESE | CLIP r_reg BY r_reg | MANT f_reg | LOGB f_reg | FIX f_reg ( BY r_reg )? | TRUNC f_reg ( BY r_reg )?
;
//====================================================================================================
floating_point_alu_op
: f_reg EQU f_exp | COMP LPARENTHESE f_reg COMMA f_reg RPARENTHESE
;
f_exp
: f_reg PLUS f_reg | f_reg MINUS f_reg | ABS LPARENTHESE f_reg PLUS f_reg RPARENTHESE | ABS LPARENTHESE f_reg MINUS f_reg RPARENTHESE | LPARENTHESE f_reg PLUS f_reg RPARENTHESE DIV INT | MINUS f_reg | ABS f_reg | PASS f_reg | RND f_reg | SCALB f_reg BY r_reg | FLOAT r_reg ( BY r_reg )? | RECIPS f_reg | RSQRTS f_reg | f_reg COPYSIGN f_reg | MIN LPARENTHESE f_reg COMMA f_reg RPARENTHESE | MAX LPARENTHESE f_reg COMMA f_reg RPARENTHESE | CLIP f_reg BY f_reg | f_reg MULT f_reg
;
//====================================================================================================
multi_op
: r_reg EQU multi_exp_r | MRF EQU multi_exp_mrf | MRB EQU multi_exp_mrb | mr EQU INT | ( mrf | mrb ) EQU r_reg | r_reg EQU ( mrf | mrb )
;
multi_r
: r_reg MULT r_reg multi_mod2?
;
multi_exp_r
: multi_r | mr add_or_sub multi_r | SAT mr multi_mod1? | RND mr multi_mod1? | mr
;
multi_exp_mrf
: multi_r | MRF add_or_sub multi_r | SAT MRF multi_mod1? | RND MRF multi_mod1?
;
multi_exp_mrb
: multi_r | MRB add_or_sub multi_r | SAT MRB multi_mod1? | RND MRB multi_mod1?
;
mr
: MRB | MRF
;
//====================================================================================================
shifter_op
: r_reg EQU shifter_exp | BTST r_reg BY sec_op | f_reg EQU FUNPACK r_reg
;
shifter_exp
: LSHIFT r_reg BY sec_op | r_reg OR LSHIFT r_reg BY sec_op | ASHIFT r_reg BY sec_op | r_reg OR ASHIFT r_reg BY sec_op | ROT r_reg BY sec_op | BCLR r_reg BY sec_op | BSET r_reg BY sec_op | BTGL r_reg BY sec_op | FDEP r_reg BY sec_op2 ( LPARENTHESE SE RPARENTHESE )? | FEXT r_reg BY sec_op2 ( LPARENTHESE SE RPARENTHESE )? | r_reg OR FDEP r_reg BY sec_op2 | EXP r_reg ( LPARENTHESE EX RPARENTHESE )? | LEFTZ r_reg | LEFTO r_reg | FPACK f_reg
;
sec_op
: r_reg | atom | MINUS atom
;
sec_op2
: r_reg | bit_data
;
bit_data
: INT COLON INT
;
add_or_sub
: PLUS | MINUS
;
dual_op
: dual_add_r | parallel_multi
;
dual_add_r
: r_reg EQU r_reg PLUS r_reg COMMA r_reg EQU r_reg MINUS r_reg
;
parallel_multi
: multi_op ( COMMA fixpoint_alu_op )+ | floating_point_alu_op ( COMMA floating_point_alu_op )+
;
//====================================================================================================
/*
dual_op : dual_add_r
| dual_add_f
| parallel_multi_1
| parallel_multi_2
| parallel_multi_3
| parallel_multi_4
//| parallel_multi_add_f
| parallel_multi_add_r
;
//-------------
parallel_multi_1
: parallel_multi_1_1 COMMA! ( parallel_multi_1_2 | parallel_multi_1_3 )
;
parallel_multi_1_1
: r_reg EQU r3_0 MULT r7_4 LPARENTHESE SSFR RPARENTHESE
-> ^(EQU r_reg ^(MULT r3_0 r7_4 SSFR))
;
parallel_multi_1_2
: r_reg EQU r11_8 add_or_sub r15_12
-> ^(EQU r_reg ^(add_or_sub r11_8 r15_12))
;
parallel_multi_1_3
: r_reg EQU LPARENTHESE r11_8 PLUS r15_12 RPARENTHESE DIV INT
-> ^(EQU r_reg ^(DIV ^(PLUS r11_8 r15_12) INT))
;
//-------------
parallel_multi_2
: parallel_multi_2_1 COMMA! ( parallel_multi_1_2 | parallel_multi_1_3 )
;
parallel_multi_2_1
: MRF EQU MRF add_or_sub r3_0 MULT r7_4 LPARENTHESE SSF RPARENTHESE
-> ^(EQU MRF ^(add_or_sub MRF ^(MULT r3_0 r7_4 SSF)))
;
//-------------
parallel_multi_3
: parallel_multi_3_1 COMMA! ( parallel_multi_1_2 | parallel_multi_1_3 )
;
parallel_multi_3_1
: r_reg EQU MRF add_or_sub r3_0 MULT r7_4 LPARENTHESE SSFR RPARENTHESE
-> ^(EQU r_reg ^(add_or_sub MRF ^(MULT r3_0 r7_4 SSFR)))
;
//--------------
parallel_multi_4
: f_reg EQU f_exp (COMMA f_reg EQU f_exp)+
-> ^(EQU f_reg f_exp) (^(EQU f_reg f_exp))+
;
/*parallel_multi_4_1 COMMA! (
| parallel_multi_4_1_1
| parallel_multi_4_1_2
| parallel_multi_4_1_3
| parallel_multi_4_1_4
| parallel_multi_4_1_5
| parallel_multi_4_1_6
| parallel_multi_4_1_7
)
;
parallel_multi_4_1
: f_reg EQU f3_0 MULT f7_4
-> ^(EQU f_reg ^(MULT f3_0 f7_4))
;
parallel_multi_4_1_1
: f_reg EQU f11_8 add_or_sub f15_12
-> ^(EQU f_reg ^(add_or_sub f11_8 f15_12))
;
parallel_multi_4_1_2
: f_reg EQU FLOAT r11_8 BY r15_12
-> ^(EQU f_reg ^(FLOAT r11_8 r15_12))
;
parallel_multi_4_1_3
: f_reg EQU FIX f11_8 BY r15_12
-> ^(EQU f_reg ^(FIX f11_8 r15_12))
;
parallel_multi_4_1_4
: f_reg EQU LPARENTHESE f11_8 PLUS f15_12 RPARENTHESE DIV INT
-> ^(EQU f_reg ^(DIV ^(PLUS f11_8 f15_12) INT))
;
parallel_multi_4_1_5
: f_reg EQU ABS f11_8
-> ^(EQU f_reg ^(ABS f11_8))
;
parallel_multi_4_1_6
: f_reg EQU MAX LPARENTHESE f11_8 COMMA f15_12 RPARENTHESE
-> ^(EQU f_reg ^(MAX f11_8 f15_12))
;
parallel_multi_4_1_7
: f_reg EQU MIN LPARENTHESE f11_8 COMMA f15_12 RPARENTHESE
-> ^(EQU f_reg ^(MIN f11_8 f15_12))
;
parallel_multi_add_r
: r_reg EQU r3_0 MULT r7_4 LPARENTHESE SSFR RPARENTHESE COMMA r_reg EQU r11_8 PLUS r15_12 COMMA r_reg EQU r11_8 MINUS r15_12
-> ^(EQU r_reg ^(MULT r3_0 r7_4 SSFR)) ^(EQU r_reg ^(PLUS r11_8 r15_12)) ^(EQU r_reg ^(MINUS r11_8 r15_12))
;
//parallel_multi_add_f
// : f_reg EQU f3_0 MULT f7_4 COMMA f_reg EQU f11_8 PLUS f15_12 COMMA f_reg EQU f11_8 MINUS f15_12
// -> ^(EQU f_reg ^(MULT f3_0 f7_4)) ^(EQU f_reg ^(PLUS f11_8 f15_12)) ^(EQU f_reg ^(MINUS f11_8 f15_12))
// ;
*/
//====================================================================================================
// program flow control instructions
flow_control_exp
: flow_contorl_8 | flow_control_9_and_11 | flow_control_10 | flow_control_8a | flow_control_8b | flow_control_9a | flow_control_9b | flow_control_11a | flow_control_11b | flow_control_12 | flow_control_13
;
/////////////////////////////////
flow_contorl_8
: IF condition flow_contorl_8_exp
;
flow_contorl_8_exp
: flow_control_8a | flow_control_8b
;
flow_control_9_and_11
: IF condition flow_control_9_and_11_exp COMMA ELSE compute
;
flow_control_9_and_11_exp
: flow_control_9a | flow_control_9b | flow_control_11a | flow_control_11b
;
flow_control_10
: IF condition JUMP flow_control_10_frag COMMA ELSE ( compute COMMA )? mov_exp_1_1
;
flow_control_10_frag
: mem_addr_md_ic | jump_addr_pc
;
flow_control_12
: LCNTR EQU lcntr_v ( COMMA DO jump_addr_int_or_pc UNTIL LCE )
;
lcntr_v
: value_exp | u_reg
;
//DO <addr24> UNTIL termination
// (PC, <reladdr24>)
flow_control_13
: DO jump_addr_int_or_pc UNTIL condition
;
flow_control_8a
: JUMP jump_addr_int jump_modifier?
;
flow_control_8b
: CALL jump_addr_int jump_modifier2?
;
flow_control_9a
: JUMP flow_control_10_frag jump_modifier? ( COMMA compute )?
;
flow_control_9b
: CALL flow_control_10_frag jump_modifier2? ( COMMA compute )?
;
flow_control_11a
: RTS jump_modifier3? ( COMMA compute )?
;
flow_control_11b
: RTI jump_modifier2? ( COMMA compute )?
;
//////////////////////////////////
jump_addr_int_or_pc
: jump_addr_int | jump_addr_pc
;
jump_addr_md_or_pc
: mem_addr_md_ic | jump_addr_pc
;
jump_addr_pc
: LPARENTHESE PC COMMA value_exp RPARENTHESE
;
jump_addr_int
: value_exp
;
jump_modifier
: jump_modifier_
;
jump_modifier_
: LPARENTHESE ( jump_modifier_1 | LA | CI ) RPARENTHESE
;
jump_modifier_1
: DB ( COMMA ( LA | CI ) )?
;
jump_modifier2
: LPARENTHESE DB RPARENTHESE
;
jump_modifier3
: jump_modifier3_
;
jump_modifier3_
: LPARENTHESE ( jump_modifier3_1 | LR ) RPARENTHESE
;
jump_modifier3_1
: DB ( COMMA LR )?
;
//====================================================================================================
//
imm_mov_exp
: imm_mov_14a | imm_mov_14b | imm_mov_16 | imm_mov_17
;
imm_mov_14a
: ( mem_addr_dm_int | mem_addr_pm_int ) EQU u_reg
;
imm_mov_15a
: ( mem_addr_dm_int_ia | mem_addr_pm_int_ic ) EQU u_reg
;
imm_mov_14b
: u_reg EQU ( mem_addr_dm_int | mem_addr_pm_int )
;
imm_mov_15b
: u_reg EQU ( mem_addr_dm_int_ia | mem_addr_pm_int_ic )
;
imm_mov_16
: ( mem_addr_dm_ia_mb | mem_addr_pm_ic_md ) EQU value_exp
;
imm_mov_17
: u_reg2 EQU value_exp
;
u_reg2
: d_reg | PC | PCSTK | PCSTKP | FADDR | DADDR | LADDR | CURLCNTR | dag_reg | PX1 | PX2 | PX | TPERIOD | TCOUNT | s_reg
;
misc_exp
: BIT ( SET | CLR | TGL | TST | XOR ) s_reg value_exp | BITREV ( mem_addr_ia_int | mem_addr_ic_int ) | MODIFY LPARENTHESE ia COMMA value_exp RPARENTHESE | MODIFY LPARENTHESE ic COMMA value_exp RPARENTHESE | misc_20 ( COMMA misc_20 )* | FLUSH CACHE | NOP | IDLE | IDLE16 | CJUMP jump_addr_int_or_pc jump_modifier2? | RFRAME
;
misc_20
: ( PUSH | POP ) ( LOOP | STS | PCSTK )
;
//====================================================================================================
directive_exp
: DOT_ALGIGN INT | DOT_COMPRESS | DOT_EXTERN ID ( COMMA ID )* | DOT_FILE StringLiteral | DOT_FILE_ATTR . | DOT_FORCECOMPRESS | DOT_GLOBAL ID ( COMMA ID )* | DOT_IMPORT StringLiteral ( COMMA StringLiteral )* | DOT_LEFTMARGIN value_exp | DOT_LIST | DOT_LIST_DATA | DOT_LIST_DATFILE | DOT_LIST_DEFTAB value_exp | DOT_LIST_LOCTAB value_exp | DOT_LIST_WRAPDATA | DOT_NEWPAGE | DOT_NOCOMPRESS | DOT_NOLIST_DATA | DOT_NOLIST_DATFILE | DOT_NOLIST_WRAPDATA | DOT_PAGELENGTH value_exp | DOT_PAGEWIDTH value_exp | DOT_PRECISION ( EQU? ) INT | DOT_ROUND_MINUS | DOT_ROUND_NEAREST | DOT_ROUND_PLUS | DOT_ROUND_ZERO | DOT_PREVIOUS | DOT_WEAK ID
;
//====================================================================================================
b_reg
: B0 | B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B10 | B11 | B12 | B13 | B14 | B15
;
l_reg
: L0 | L1 | L2 | L3 | L4 | L5 | L6 | L7 | L8 | L9 | L10 | L11 | L12 | L13 | L14 | L15
;
r_reg
: R0 | R1 | R2 | R3 | R4 | R5 | R6 | R7 | R8 | R9 | R10 | R11 | R12 | R13 | R14 | R15
;
f_reg
: F0 | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | F13 | F14 | F15
;
// system register
s_reg
: MODE1 | MODE2 | IRPTL | IMASK | IMASKP | ASTAT | STKY | USTAT1 | USTAT2
;
ia
: I0 | I1 | I2 | I3 | I4 | I5 | I6 | I7
;
mb
: M0 | M1 | M2 | M3 | M4 | M5 | M6 | M7
;
ic
: I8 | I9 | I10 | I11 | I12 | I13 | I14 | I15
;
md
: M8 | M9 | M10 | M11 | M12 | M13 | M14 | M15
;
i_reg
: ia | ic
;
m_reg
: mb | md
;
dag_reg
: i_reg | m_reg | b_reg | l_reg
;
d_reg
: r_reg | f_reg
;
// universal register
u_reg
: d_reg | PC | PCSTK | PCSTKP | FADDR | DADDR | LADDR | CURLCNTR | LCNTR | dag_reg | PX1 | PX2 | PX | TPERIOD | TCOUNT | s_reg
;
condition
: ccondition
;
ccondition
: EQ | LT | LE | AC | AV | MV | MS | SV | SZ | FLAG0_IN | FLAG1_IN | FLAG2_IN | FLAG3_IN | TF | BM | LCE | NOT LCE | NE | GE | GT | NOT AC | NOT AV | NOT MV | NOT MS | NOT SV | NOT SZ | NOT FLAG0_IN | NOT FLAG1_IN | NOT FLAG2_IN | NOT FLAG3_IN | NOT TF | NBM | FOREVER | TRUE
;
multi_mod1
: multi_mod1_
;
multi_mod1_
: LPARENTHESE ( SI | UI | SF | UF ) RPARENTHESE
;
multi_mod2
: multi_mod2_
;
multi_mod2_
: LPARENTHESE ( SSI | SUI | USI | UUI | SSF | SUF | USF | UUF | SSFR | SUFR | USFR | UUFR ) RPARENTHESE
;
r3_0
: R0 | R2 | R3
;
r7_4
: R4 | R5 | R6 | R7
;
r11_8
: R8 | R9 | R10 | R11
;
r15_12
: R12 | R13 | R14 | R15
;
f3_0
: F0 | F2 | F3
;
f7_4
: F4 | F5 | F6 | F7
;
f11_8
: F8 | F9 | F10 | F11
;
f15_12
: F12 | F13 | F14 | F15
;
addr
: ID | INT
;
mrf
: MR0F | MR1F | MR2F
;
mrb
: MR0B | MR1B | MR2B
;
|
programs/oeis/003/A003511.asm | karttu/loda | 0 | 176860 | ; A003511: A Beatty sequence: floor( n * (1 + sqrt(3))/2 ).
; 1,2,4,5,6,8,9,10,12,13,15,16,17,19,20,21,23,24,25,27,28,30,31,32,34,35,36,38,39,40,42,43,45,46,47,49,50,51,53,54,56,57,58,60,61,62,64,65,66,68,69,71,72,73,75,76,77,79,80,81,83,84,86,87,88,90,91,92,94,95,96,98,99,101,102,103,105,106,107,109,110,112,113,114,116,117,118,120,121,122,124,125,127,128,129,131,132,133,135,136,137,139,140,142,143,144,146,147,148,150,151,152,154,155,157,158,159,161,162,163,165,166,168,169,170,172,173,174,176,177,178,180,181,183,184,185,187,188,189,191,192,193,195,196,198,199,200,202,203,204,206,207,209,210,211,213,214,215,217,218,219,221,222,224,225,226,228,229,230,232,233,234,236,237,239,240,241,243,244,245,247,248,249,251,252,254,255,256,258,259,260,262,263,265,266,267,269,270,271,273,274,275,277,278,280,281,282,284,285,286,288,289,290,292,293,295,296,297,299,300,301,303,304,305,307,308,310,311,312,314,315,316,318,319,321,322,323,325,326,327,329,330,331,333,334,336,337,338,340,341
mov $2,$0
add $2,1
mov $3,$0
lpb $2,1
mov $0,$3
sub $2,1
sub $0,$2
cal $0,245222 ; Continued fraction of the constant c in A245221; c = sup{f(n,1)}, where f(1,x) = x + 1 and thereafter f(n,x) = x + 1 if n is in A022838, else f(n,x) = 1/x.
add $0,10
cal $0,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
add $0,1
add $1,$0
lpe
sub $1,1
|
libsrc/_DEVELOPMENT/adt/p_forward_list/c/sccz80/p_forward_list_push_back.asm | jpoikela/z88dk | 640 | 3146 |
; void p_forward_list_push_back(p_forward_list_t *list, void *item)
SECTION code_clib
SECTION code_adt_p_forward_list
PUBLIC p_forward_list_push_back
EXTERN asm_p_forward_list_push_back
p_forward_list_push_back:
pop af
pop de
pop hl
push hl
push de
push af
jp asm_p_forward_list_push_back
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _p_forward_list_push_back
defc _p_forward_list_push_back = p_forward_list_push_back
ENDIF
|
oeis/096/A096130.asm | neoneye/loda-programs | 11 | 172381 | ; A096130: Triangle read by rows: T(n,k) = binomial(k*n,n), 1 <= k <= n.
; Submitted by <NAME>(s3)
; 1,1,6,1,20,84,1,70,495,1820,1,252,3003,15504,53130,1,924,18564,134596,593775,1947792,1,3432,116280,1184040,6724520,26978328,85900584,1,12870,735471,10518300,76904685,377348994,1420494075,4426165368,1,48620,4686825,94143280,886163135,5317936260,23667689815,85113005120,260887834350,1,184756,30045015,847660528,10272278170,75394027566,396704524216,1646492110120,5720645481903,17310309456440,1,705432,193536720,7669339132,119653565850,1074082795968,6681687099710,32006008361808,126050526132804
add $0,1
lpb $0
add $1,1
mov $2,$0
trn $0,$1
mul $2,$1
bin $2,$1
lpe
mov $0,$2
|
src/miscellaneous/spatial_data-well_known_binary.adb | jrmarino/AdaBase | 30 | 25417 | <gh_stars>10-100
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../../License.txt
package body Spatial_Data.Well_Known_Binary is
-------------------
-- produce_WKT --
-------------------
function produce_WKT (WKBinary : CT.Text) return String
is
shape : Geometry := Translate_WKB (CT.USS (WKBinary));
begin
return Well_Known_Text (shape);
end produce_WKT;
---------------------
-- Translate_WKB --
---------------------
function Translate_WKB (WKBinary : String) return Geometry
is
binary : WKB_Chain := convert (WKBinary);
chainlen : Natural := binary'Length;
begin
if chainlen < 21 then
if chainlen = 0 then
declare
dummy : Geometry; -- unset
begin
return dummy;
end;
end if;
raise WKB_INVALID
with "Chain is smaller than required to accommodate a point)";
end if;
declare
function entity_count return Natural;
marker : Natural := binary'First;
endianness : constant WKB_Endianness :=
decode_endianness (binary (marker));
ID_chain : constant WKB_Identifier_Chain :=
binary (marker + 1 .. marker + 4);
Identity : constant WKB_Identifier :=
decode_identifier (direction => endianness,
value => ID_chain);
col_type : constant Collection_Type :=
get_collection_type (Identity);
product : Geometry;
entities : Natural;
function entity_count return Natural is
begin
return Natural (decode_hex32
(endianness, binary (marker + 5 .. marker + 8)));
end entity_count;
begin
case col_type is
when unset =>
return product; -- unset
when single_point |
single_line_string |
single_polygon |
multi_point |
multi_line_string |
multi_polygon =>
handle_unit_collection (flavor => col_type,
payload => binary,
marker => marker,
collection => product);
when heterogeneous =>
entities := entity_count;
marker := marker + 9;
for entity in 1 .. entities loop
handle_unit_collection (flavor => col_type,
payload => binary,
marker => marker,
collection => product);
end loop;
end case;
return product;
end;
end Translate_WKB;
------------------------------
-- handle_unit_collection --
------------------------------
procedure handle_unit_collection (flavor : Collection_Type;
payload : WKB_Chain;
marker : in out Natural;
collection : in out Geometry)
is
function entity_count return Natural;
procedure attach (anything : Geometry);
endianness : constant WKB_Endianness :=
decode_endianness (payload (marker));
ID_chain : constant WKB_Identifier_Chain :=
payload (marker + 1 .. marker + 4);
Identity : constant WKB_Identifier :=
decode_identifier (direction => endianness,
value => ID_chain);
col_type : constant Collection_Type :=
get_collection_type (Identity);
entities : Natural;
initialize_first : constant Boolean := (collection.contents = unset);
function entity_count return Natural is
begin
return Natural (decode_hex32 (endianness,
payload (marker + 5 .. marker + 8)));
end entity_count;
procedure attach (anything : Geometry) is
begin
if initialize_first then
if flavor = heterogeneous then
collection := initialize_as_collection (anything);
else
collection := anything;
end if;
else
augment_collection (collection, anything);
end if;
end attach;
begin
case col_type is
when unset =>
raise WKB_INVALID
with "Handle_Unit_collection: Should never happen";
when single_point =>
declare
pt : Geometric_Point := handle_new_point (payload, marker);
begin
attach (initialize_as_point (pt));
end;
when multi_point =>
entities := entity_count;
marker := marker + 9;
declare
-- required to have at least one point
pt1 : Geometric_Point := handle_new_point (payload, marker);
element : Geometry := initialize_as_multi_point (pt1);
begin
for x in 2 .. entities loop
augment_multi_point (element,
handle_new_point (payload, marker));
end loop;
attach (element);
end;
when single_line_string =>
declare
LS : Geometric_Line_String :=
handle_linestring (payload, marker);
begin
attach (initialize_as_line (LS));
end;
when multi_line_string =>
entities := entity_count;
marker := marker + 9;
-- Required to have at least one linestring
declare
LS : Geometric_Line_String :=
handle_linestring (payload, marker);
element : Geometry := initialize_as_multi_line (LS);
begin
for additional_LS in 2 .. entities loop
augment_multi_line (element,
handle_linestring (payload, marker));
end loop;
attach (element);
end;
when single_polygon =>
declare
PG : Geometric_Polygon := handle_polygon (payload, marker);
begin
attach (initialize_as_polygon (PG));
end;
when multi_polygon =>
entities := entity_count;
marker := marker + 9;
-- Required to have at least one polygon
declare
PG : Geometric_Polygon := handle_polygon (payload, marker);
element : Geometry := initialize_as_multi_polygon (PG);
begin
for additional_Poly in 2 .. entities loop
augment_multi_polygon (element,
handle_polygon (payload, marker));
end loop;
attach (element);
end;
when heterogeneous =>
-- Currently impossible with MySQL, but supported by PostGIS
entities := entity_count;
marker := marker + 9;
declare
mega_element : Geometry;
begin
for entity in 1 .. entities loop
handle_unit_collection (flavor => heterogeneous,
payload => payload,
marker => marker,
collection => mega_element);
end loop;
attach (mega_element);
end;
end case;
end handle_unit_collection;
-------------------------
-- handle_coordinate --
-------------------------
function handle_coordinate (direction : WKB_Endianness;
payload : WKB_Chain;
marker : in out Natural)
return Geometric_Real
is
Z : Geometric_Real;
begin
Z := convert_to_IEEE754 (direction, payload (marker .. marker + 7));
marker := marker + 8;
return Z;
end handle_coordinate;
------------------------
-- handle_new_point --
------------------------
function handle_new_point (payload : WKB_Chain;
marker : in out Natural) return Geometric_Point
is
pt_endian : WKB_Endianness := decode_endianness (payload (marker));
X : Geometric_Real;
Y : Geometric_Real;
begin
marker := marker + 5;
X := handle_coordinate (pt_endian, payload, marker);
Y := handle_coordinate (pt_endian, payload, marker);
return (X, Y);
end handle_new_point;
-------------------------
-- handle_linestring --
-------------------------
function handle_linestring (payload : WKB_Chain; marker : in out Natural)
return Geometric_Line_String
is
ls_endian : WKB_Endianness := decode_endianness (payload (marker));
num_points : Natural := Natural (decode_hex32 (ls_endian,
payload (marker + 5 .. marker + 8)));
LS : Geometric_Line_String (1 .. num_points);
X : Geometric_Real;
Y : Geometric_Real;
begin
marker := marker + 9;
for pt in 1 .. num_points loop
X := handle_coordinate (ls_endian, payload, marker);
Y := handle_coordinate (ls_endian, payload, marker);
LS (pt) := (X, Y);
end loop;
return LS;
end handle_linestring;
------------------------
-- handle_polyrings --
------------------------
function handle_polyrings (direction : WKB_Endianness;
payload : WKB_Chain;
marker : in out Natural)
return Geometric_Ring
is
num_points : Natural := Natural (decode_hex32 (direction,
payload (marker .. marker + 3)));
ring : Geometric_Ring (1 .. num_points);
X : Geometric_Real;
Y : Geometric_Real;
begin
marker := marker + 4;
for pt in 1 .. num_points loop
X := handle_coordinate (direction, payload, marker);
Y := handle_coordinate (direction, payload, marker);
ring (pt) := (X, Y);
end loop;
return ring;
end handle_polyrings;
----------------------
-- handle_polygon --
----------------------
function handle_polygon (payload : WKB_Chain;
marker : in out Natural)
return Geometric_Polygon
is
midway_polygon : Geometric_Polygon;
poly_endian : WKB_Endianness := decode_endianness (payload (marker));
num_rings : Natural := Natural (decode_hex32 (poly_endian,
payload (marker + 5 .. marker + 8)));
-- There must be at least one ring (exterior
begin
marker := marker + 9;
midway_polygon := start_polygon
(outer_ring => handle_polyrings (direction => poly_endian,
payload => payload,
marker => marker));
for x in 2 .. num_rings loop
append_inner_ring
(polygon => midway_polygon,
inner_ring => handle_polyrings (direction => poly_endian,
payload => payload,
marker => marker));
end loop;
return midway_polygon;
end handle_polygon;
-------------------------
-- decode_endianness --
-------------------------
function decode_endianness (value : WKB_Byte) return WKB_Endianness is
begin
case value is
when 0 => return big_endian;
when 1 => return little_endian;
when others =>
raise WKB_INVALID
with "Endian byte value is" & value'Img;
end case;
end decode_endianness;
--------------------
-- decode_hex32 --
--------------------
function decode_hex32 (direction : WKB_Endianness;
value : WKB_Identifier_Chain) return WKB_Hex32
is
result : WKB_Hex32 := 0;
mask : array (1 .. 4) of WKB_Hex32 := (2 ** 0, 2 ** 8, 2 ** 16, 2 ** 24);
begin
case direction is
when little_endian =>
result := (WKB_Hex32 (value (1)) * mask (1)) +
(WKB_Hex32 (value (2)) * mask (2)) +
(WKB_Hex32 (value (3)) * mask (3)) +
(WKB_Hex32 (value (4)) * mask (4));
when big_endian =>
result := (WKB_Hex32 (value (4)) * mask (1)) +
(WKB_Hex32 (value (3)) * mask (2)) +
(WKB_Hex32 (value (2)) * mask (3)) +
(WKB_Hex32 (value (1)) * mask (4));
end case;
return result;
end decode_hex32;
-------------------------
-- decode_identifier --
-------------------------
function decode_identifier (direction : WKB_Endianness;
value : WKB_Identifier_Chain)
return WKB_Identifier
is
result : WKB_Hex32 := decode_hex32 (direction, value);
begin
if result > WKB_Hex32 (WKB_Identifier'Last) then
raise WKB_INVALID
with "Identifier value is way too high:" & result'Img;
end if;
return WKB_Identifier (result);
end decode_identifier;
---------------------------
-- get_collection_type --
---------------------------
function get_collection_type (identifier : WKB_Identifier)
return Collection_Type is
begin
case identifier is
when 18 .. 999 | 1018 .. 1999 | 2018 .. 2999 | 3018 .. 4095 =>
raise WKB_INVALID
with "Identifier does not map to any known geometry shape: " &
identifier'Img;
when 1000 .. 1017 =>
raise WKB_INVALID
with "3D (Z) shapes are not supported at this time: " &
identifier'Img;
when 2000 .. 2017 =>
raise WKB_INVALID
with "2D + M shapes are not supported at this time: " &
identifier'Img;
when 3000 .. 3017 =>
raise WKB_INVALID
with "4D (ZM) shapes are not supported at this time: " &
identifier'Img;
when 0 | 8 .. 17 =>
raise WKB_INVALID
with "This particular 2D shape is not yet supported: " &
identifier'Img;
when 1 => return single_point;
when 2 => return single_line_string;
when 3 => return single_polygon;
when 4 => return multi_point;
when 5 => return multi_line_string;
when 6 => return multi_polygon;
when 7 => return heterogeneous;
end case;
end get_collection_type;
---------------------
-- decode_number --
---------------------
-- function decode_number (direction : WKB_Endianness;
-- value : WKB_Double_Precision_Chain)
-- return WKB_IEEE754_Hex
-- is
-- result : WKB_IEEE754_Hex := 0;
-- mask : array (1 .. 8) of WKB_IEEE754_Hex :=
-- (2 ** 0, 2 ** 8, 2 ** 16, 2 ** 24,
-- 2 ** 32, 2 ** 40, 2 ** 48, 2 ** 56);
-- begin
-- case direction is
-- when little_endian =>
-- result := (WKB_IEEE754_Hex (value (1)) * mask (1)) +
-- (WKB_IEEE754_Hex (value (2)) * mask (2)) +
-- (WKB_IEEE754_Hex (value (3)) * mask (3)) +
-- (WKB_IEEE754_Hex (value (4)) * mask (4)) +
-- (WKB_IEEE754_Hex (value (5)) * mask (5)) +
-- (WKB_IEEE754_Hex (value (6)) * mask (6)) +
-- (WKB_IEEE754_Hex (value (7)) * mask (7)) +
-- (WKB_IEEE754_Hex (value (8)) * mask (8));
-- when big_endian =>
-- result := (WKB_IEEE754_Hex (value (8)) * mask (1)) +
-- (WKB_IEEE754_Hex (value (7)) * mask (2)) +
-- (WKB_IEEE754_Hex (value (6)) * mask (3)) +
-- (WKB_IEEE754_Hex (value (5)) * mask (4)) +
-- (WKB_IEEE754_Hex (value (4)) * mask (5)) +
-- (WKB_IEEE754_Hex (value (3)) * mask (6)) +
-- (WKB_IEEE754_Hex (value (2)) * mask (7)) +
-- (WKB_IEEE754_Hex (value (1)) * mask (8));
-- end case;
-- return result;
-- end decode_number;
--------------------------
-- convert_to_IEEE754 --
--------------------------
-- function convert_to_IEEE754 (hex : WKB_IEEE754_Hex) return Geometric_Real
-- is
-- sign_mask : WKB_IEEE754_Hex := 2 ** 63;
-- work_mask : WKB_IEEE754_Hex;
-- exponent : WKB_exponent := 0;
-- fraction : Geometric_Real := 0.0;
-- power_res : Geometric_Real;
-- result : Geometric_Real;
-- factor : Geometric_Real;
-- marker : Integer := -1;
-- begin
-- if (hex and sign_mask) > 0 then
-- -- Negative sign
-- factor := -1.0;
-- else
-- factor := 1.0;
-- end if;
-- for x in 52 .. 62 loop
-- work_mask := 2 ** x;
-- if (hex and work_mask) > 0 then
-- exponent := exponent + (2 ** (x - 52));
-- end if;
-- end loop;
-- for x in reverse 0 .. 51 loop
-- work_mask := 2 ** x;
-- if (hex and work_mask) > 0 then
-- fraction := fraction + (2.0 ** marker);
-- end if;
-- marker := marker - 1;
-- end loop;
-- case exponent is
-- when 2047 =>
-- raise WKB_INVALID
-- with "Infinity/NAN";
-- when 0 =>
-- -- denormalized
-- power_res := 2.0 ** (-1022);
-- result := factor * fraction * power_res;
-- when 1 .. 2046 =>
-- -- normalized
-- power_res := 2.0 ** (Natural (exponent) - 1023);
-- result := factor * (1.0 + fraction) * power_res;
-- end case;
-- return result;
-- end convert_to_IEEE754;
--------------------------
-- convert_to_IEEE754 --
--------------------------
function convert_to_IEEE754 (direction : WKB_Endianness;
chain : WKB_Double_Precision_Chain)
return Geometric_Real
is
function slice (link : Positive; bitpos : Natural; exp : Natural)
return WKB_exponent;
function frack (link : Positive; bitpos : Natural; exp : Integer)
return Geometric_Real;
our_chain : WKB_Double_Precision_Chain;
fracked : Boolean := False;
byte_mask : constant array (0 .. 7) of WKB_Byte := (2 ** 0, 2 ** 1,
2 ** 2, 2 ** 3,
2 ** 4, 2 ** 5,
2 ** 6, 2 ** 7);
function slice (link : Positive; bitpos : Natural; exp : Natural)
return WKB_exponent is
begin
if (our_chain (link) and byte_mask (bitpos)) > 0 then
return 2 ** exp;
end if;
return 0;
end slice;
function frack (link : Positive; bitpos : Natural; exp : Integer)
return Geometric_Real is
begin
if (our_chain (link) and byte_mask (bitpos)) > 0 then
fracked := True;
return 2.0 ** exp;
end if;
return 0.0;
end frack;
sign_mask : constant WKB_Byte := byte_mask (7);
exponent : WKB_exponent := 0;
fraction : Geometric_Real := 0.0;
power_res : Geometric_Real;
result : Geometric_Real;
factor : Geometric_Real;
marker : Integer;
negative : Boolean;
begin
case direction is
when big_endian => our_chain := chain;
when little_endian =>
our_chain (1) := chain (8);
our_chain (2) := chain (7);
our_chain (3) := chain (6);
our_chain (4) := chain (5);
our_chain (5) := chain (4);
our_chain (6) := chain (3);
our_chain (7) := chain (2);
our_chain (8) := chain (1);
end case;
if (our_chain (1) and sign_mask) > 0 then
negative := True;
factor := -1.0;
else
negative := False;
factor := 1.0;
end if;
exponent :=
slice (link => 2, bitpos => 4, exp => 0) + -- bit 52
slice (link => 2, bitpos => 5, exp => 1) +
slice (link => 2, bitpos => 6, exp => 2) +
slice (link => 2, bitpos => 7, exp => 3) +
slice (link => 1, bitpos => 0, exp => 4) +
slice (link => 1, bitpos => 1, exp => 5) +
slice (link => 1, bitpos => 2, exp => 6) +
slice (link => 1, bitpos => 3, exp => 7) +
slice (link => 1, bitpos => 4, exp => 8) +
slice (link => 1, bitpos => 5, exp => 9) +
slice (link => 1, bitpos => 6, exp => 10); -- bit 62
fraction :=
frack (link => 2, bitpos => 3, exp => -1) +
frack (link => 2, bitpos => 2, exp => -2) +
frack (link => 2, bitpos => 1, exp => -3) +
frack (link => 2, bitpos => 0, exp => -4);
marker := -5;
for link in 3 .. 8 loop
for bitpos in reverse 0 .. 7 loop
fraction := fraction + frack (link, bitpos, marker);
marker := marker - 1;
end loop;
end loop;
if not fracked and then exponent = 0 then
if negative then
return -0.0;
else
return 0.0;
end if;
end if;
case exponent is
when 2047 =>
raise WKB_INVALID
with "Infinity/NAN";
when 0 =>
-- denormalized
power_res := 2.0 ** (-1022);
result := factor * fraction * power_res;
when 1 .. 2046 =>
-- normalized
power_res := 2.0 ** Integer (Natural (exponent) - 1023);
result := factor * (1.0 + fraction) * power_res;
end case;
return round_to_16_digits (result);
end convert_to_IEEE754;
--------------------------
-- round_to_16_digits --
--------------------------
function round_to_16_digits (FP : Geometric_Real) return Geometric_Real
is
type Int64 is range -2 ** 63 .. 2 ** 63 - 1;
-- Image always in form:
-- [sign/space][digit][dot][17 digits]E[sign][2..3 digits]
resimage : String := Geometric_Real'Image (FP);
dot : Natural := CT.pinpoint (resimage, ".");
exp : Natural := CT.pinpoint (resimage, "E");
dec : String := resimage (resimage'First .. dot - 1) &
resimage (dot + 1 .. exp - 1);
nagative : constant Boolean := (resimage (resimage'First) = '-');
halfpump : constant Int64 := 50;
vessel : Int64;
begin
if nagative then
vessel := Int64'Value (dec) - halfpump;
else
vessel := Int64'Value (dec) + halfpump;
end if;
declare
decimage : String := Int64'Image (vessel);
begin
return Geometric_Real'Value
(decimage (decimage'First .. decimage'First + 1) & '.' &
decimage (decimage'First + 2 .. decimage'Last - 2) &
resimage (exp .. resimage'Last));
end;
end round_to_16_digits;
---------------
-- convert --
---------------
function convert (nv : String) return WKB_Chain
is
Chainlen : Natural := nv'Length;
result : WKB_Chain (1 .. Chainlen) := (others => 0);
arrow : Natural := result'First;
begin
for x in nv'Range loop
result (arrow) := WKB_Byte (Character'Pos (nv (x)));
arrow := arrow + 1;
end loop;
return result;
end convert;
end Spatial_Data.Well_Known_Binary;
|
oeis/016/A016929.asm | neoneye/loda-programs | 11 | 98172 | <filename>oeis/016/A016929.asm
; A016929: a(n) = (6*n + 1)^9.
; 1,40353607,10604499373,322687697779,3814697265625,26439622160671,129961739795077,502592611936843,1628413597910449,4605366583984375,11694146092834141,27206534396294947,58871586708267913,119851595982618319,231616946283203125,427929800129788411,760231058654565217,1304773183829244583,2171893279442309389,3517876291919921875,5559917313492231481,8594754748609397887,13021612539908538853,19370159742424031659,28334269484119140625,40812436757196811351,57955795548021664957,81224760533853742723
mul $0,6
add $0,1
pow $0,9
|
mouseMove.applescript | rcmdnk/AppleScript | 11 | 4291 | property N_MOVE : 100
property MOUSE_KEY : 8
-- Mouse Move using Mouse Key
on mouseMove(pars)
-- Set Parameters
set nMove to nMove of (pars & {nMove:N_MOVE})
set mouseKey to mouseKey of (pars & {mouseKey:MOUSE_KEY})
tell application "System Events"
repeat nMove times
keystroke mouseKey
end repeat
end tell
end mouseMove
on run
mouseMove({})
end run
|
source/amf/uml/amf-uml-components.ads | svn2github/matreshka | 24 | 10704 | <filename>source/amf/uml/amf-uml-components.ads<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- A component represents a modular part of a system that encapsulates its
-- contents and whose manifestation is replaceable within its environment.
--
-- In the namespace of a component, all model elements that are involved in
-- or related to its definition are either owned or imported explicitly. This
-- may include, for example, use cases and dependencies (e.g. mappings),
-- packages, components, and artifacts.
------------------------------------------------------------------------------
with AMF.UML.Classes;
limited with AMF.UML.Classifiers;
limited with AMF.UML.Component_Realizations.Collections;
limited with AMF.UML.Interfaces.Collections;
limited with AMF.UML.Packageable_Elements.Collections;
package AMF.UML.Components is
pragma Preelaborate;
type UML_Component is limited interface
and AMF.UML.Classes.UML_Class;
type UML_Component_Access is
access all UML_Component'Class;
for UML_Component_Access'Storage_Size use 0;
not overriding function Get_Is_Indirectly_Instantiated
(Self : not null access constant UML_Component)
return Boolean is abstract;
-- Getter of Component::isIndirectlyInstantiated.
--
-- isIndirectlyInstantiated : Boolean {default = true} The kind of
-- instantiation that applies to a Component. If false, the component is
-- instantiated as an addressable object. If true, the Component is
-- defined at design-time, but at run-time (or execution-time) an object
-- specified by the Component does not exist, that is, the component is
-- instantiated indirectly, through the instantiation of its realizing
-- classifiers or parts. Several standard stereotypes use this meta
-- attribute (e.g., «specification», «focus», «subsystem»).
not overriding procedure Set_Is_Indirectly_Instantiated
(Self : not null access UML_Component;
To : Boolean) is abstract;
-- Setter of Component::isIndirectlyInstantiated.
--
-- isIndirectlyInstantiated : Boolean {default = true} The kind of
-- instantiation that applies to a Component. If false, the component is
-- instantiated as an addressable object. If true, the Component is
-- defined at design-time, but at run-time (or execution-time) an object
-- specified by the Component does not exist, that is, the component is
-- instantiated indirectly, through the instantiation of its realizing
-- classifiers or parts. Several standard stereotypes use this meta
-- attribute (e.g., «specification», «focus», «subsystem»).
not overriding function Get_Packaged_Element
(Self : not null access constant UML_Component)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is abstract;
-- Getter of Component::packagedElement.
--
-- The set of PackageableElements that a Component owns. In the namespace
-- of a component, all model elements that are involved in or related to
-- its definition may be owned or imported explicitly. These may include
-- e.g. Classes, Interfaces, Components, Packages, Use cases, Dependencies
-- (e.g. mappings), and Artifacts.
not overriding function Get_Provided
(Self : not null access constant UML_Component)
return AMF.UML.Interfaces.Collections.Set_Of_UML_Interface is abstract;
-- Getter of Component::provided.
--
-- The interfaces that the component exposes to its environment. These
-- interfaces may be Realized by the Component or any of its
-- realizingClassifiers, or they may be the Interfaces that are provided
-- by its public Ports.
not overriding function Get_Realization
(Self : not null access constant UML_Component)
return AMF.UML.Component_Realizations.Collections.Set_Of_UML_Component_Realization is abstract;
-- Getter of Component::realization.
--
-- The set of Realizations owned by the Component. Realizations reference
-- the Classifiers of which the Component is an abstraction; i.e., that
-- realize its behavior.
not overriding function Get_Required
(Self : not null access constant UML_Component)
return AMF.UML.Interfaces.Collections.Set_Of_UML_Interface is abstract;
-- Getter of Component::required.
--
-- The interfaces that the component requires from other components in its
-- environment in order to be able to offer its full set of provided
-- functionality. These interfaces may be used by the Component or any of
-- its realizingClassifiers, or they may be the Interfaces that are
-- required by its public Ports.
not overriding function Provided
(Self : not null access constant UML_Component)
return AMF.UML.Interfaces.Collections.Set_Of_UML_Interface is abstract;
-- Operation Component::provided.
--
-- Missing derivation for Component::/provided : Interface
not overriding function Realized_Interfaces
(Self : not null access constant UML_Component;
Classifier : AMF.UML.Classifiers.UML_Classifier_Access)
return AMF.UML.Interfaces.Collections.Set_Of_UML_Interface is abstract;
-- Operation Component::realizedInterfaces.
--
-- Utility returning the set of realized interfaces of a component.
not overriding function Required
(Self : not null access constant UML_Component)
return AMF.UML.Interfaces.Collections.Set_Of_UML_Interface is abstract;
-- Operation Component::required.
--
-- Missing derivation for Component::/required : Interface
not overriding function Used_Interfaces
(Self : not null access constant UML_Component;
Classifier : AMF.UML.Classifiers.UML_Classifier_Access)
return AMF.UML.Interfaces.Collections.Set_Of_UML_Interface is abstract;
-- Operation Component::usedInterfaces.
--
-- Utility returning the set of used interfaces of a component.
end AMF.UML.Components;
|
examples/test.asm | PotatoDrug/LSCVM-Tool | 1 | 100152 | <reponame>PotatoDrug/LSCVM-Tool
print hello world
hlt
|
programs/oeis/329/A329682.asm | karttu/loda | 1 | 15977 | <gh_stars>1-10
; A329682: Number of excursions of length n with Motzkin-steps forbidding all consecutive steps of length 2 except UH, UD, HU and DD.
; 1,1,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0
trn $0,3
mod $0,3
gcd $0,2
mov $1,$0
sub $1,1
|
dev/ansi/ansiinit.asm | minblock/msdos | 0 | 28387 | <gh_stars>0
PAGE ,132
TITLE ANSI Console device CON$INIT routine
;******************************************************************************
; Change Log:
; Date Who # Description
; -------- --- --- ------------------------------------------------------
; 06/05/90 MKS C03 Bug#234. ANSI was not recognizing the presence of a
; VGA if there was another video board in the system.
;******************************************************************************
; MODULE_NAME: CON$INIT
; FUNCTION:
; THIS PROCEDURE PERFORMS ALL NECESSARY INITIALIZATION ROUTINES
; FOR ANSI.SYS.
; THIS ROUTINE WAS SPLIT FROM THE ORIGINAL ANSI.ASM SOURCE FILE
; FOR RELEASE 4.00 OF DOS. ALL CHANGED LINES HAVE BEEN MARKED WITH
; . NEW PROCS HAVE BEEN MARKED AS SUCH.
; P1767 VIDEO_MODE_TABLE not initialized correctly 10/16/87 J.K.
; P2617 Order dependecy problem with Display.sys 11/23/87 J.K.
; D479 An option to disable the extended keyboard functions 02/12/88 J.K.
; D493 New INIT request structure for error message 02/25/88 J.K.
; P5699 Moving selecting alternate print screen routine to only when it
; 10/26/88 is needed. OEM EGA cards don't support the call it, so they
; K. Sayers couldn't (shift) print screen at all.
;-------------------------------------------------------------------------------
INCLUDE ANSI.INC ; equates and strucs
PUBLIC CON$INIT
CODE SEGMENT PUBLIC BYTE
ASSUME CS:CODE,DS:CODE
EXTRN VIDEO_MODE_TABLE:BYTE
EXTRN FUNC_INFO:BYTE
EXTRN HDWR_FLAG:WORD
EXTRN VIDEO_TABLE_MAX:ABS
EXTRN SCAN_LINES:BYTE
EXTRN PTRSAV:DWORD
EXTRN PARSE_PARM:NEAR
EXTRN ERR2:NEAR
EXTRN EXT_16:BYTE
EXTRN BRKKY:NEAR
EXTRN COUT:NEAR
EXTRN BASE:WORD
EXTRN MODE:BYTE
EXTRN MAXCOL:BYTE
EXTRN EXIT:NEAR
EXTRN MAX_SCANS:BYTE
EXTRN ROM_INT10:WORD
EXTRN INT10_COM:NEAR
EXTRN ROM_INT2F:WORD
EXTRN INT2F_COM:NEAR
EXTRN ABORT:BYTE
EXTRN Display_Loaded_Before_me:byte ;Defined in IOCTL.ASM
EXTRN Switch_K:Byte
EXTRN fhavek09:BYTE ; M006
EXTRN Switch_S:BYTE ; M008
ifdef DBCS
EXTRN DBCSLeadByteTable:dword
endif
INCLUDE ANSIVID.INC ; video tables data
CON$INIT:
lds bx,cs:[PTRSAV] ; establish addressability to request header
lds si,[BX].ARG_PTR ; ds:SI now points to rest of DEVICE=statement
call PARSE_PARM ; parse DEVICE= command line
jnc CONT_INIT ; no error in parse...continue install
lds bx,cs:[PTRSAV] ; prepare to abort install
xor ax,ax ;
mov [BX].NUM_UNITS,al ; set number of units to zero
mov [BX].END_ADDRESS_O,ax ; set ending address offset to 0
mov [BX].END_ADDRESS_S,cs ; set ending address segment to CS
mov word ptr [bx].CONFIG_ERRMSG, -1 ; Let IBMBIO display "Error in CONFIG.SYS..".
mov ax,UNKNOWN_CMD ; set error in status
mov WORD PTR [BX].STATUS,ax ; set error status
jmp ERR2 ; prepare to exit
CONT_INIT:
push cs
pop ds ; restore DS to ANSI segment
mov ax,ROM_BIOS
mov es,ax ; ES now points to BIOS data area
cmp Switch_S,OFF ; M008
jz noscreensizesw ; M008
mov BYTE PTR es:[84h],24 ; M008 ; Use default value
noscreensizesw: ; M008
mov ah,es:[KBD_FLAG_3] ; load AH with KBD_FLAG_3
test ah,EXT16_FLAG ; if extended Int16 available
jz tlab01
cmp Switch_K,OFF ; and user didn't disable it
jnz tlab01
mov EXT_16,ON ; then enable extended int16
tlab01:
call DET_HDWR ; procedure to determine video hardware status
call LOAD_INT10 ; load interrupt 10h handler
call LOAD_INT2F ; load interrupt 2Fh handler
; M006 - begin
push ds
pop es
xor di,di ; es:di points to begining of driver
mov ax,4101h ; wait for bh=es:[di]
mov bl,1 ; wait for 1 clock tick
mov bh,byte ptr es:[di]
stc ; Assume we will fail
int 15h
jc CheckColor
mov fhavek09,ON ; remember we have a k09 type
CheckColor:
; M006 - end
int 11h
and al,00110000b
cmp al,00110000b
jnz iscolor
mov [base],0b000h ;look for bw card
iscolor:
cmp al,00010000b ;look for 40 col mode
ja setbrk
mov [mode],0
mov [maxcol],39
setbrk:
xor bx,bx
mov ds,bx
mov bx,BRKADR
mov WORD PTR [BX],OFFSET BRKKY
mov WORD PTR [BX+2],cs
mov bx,29H*4
mov WORD PTR [BX],OFFSET COUT
mov WORD PTR [BX+2],cs
ifdef DBCS
mov ax,6300h
int 21h ; get DBCS lead byte table
mov word ptr cs:DBCSLeadByteTable,si
mov word ptr cs:DBCSLeadByteTable+2,ds
endif
lds bx,cs:[PTRSAV]
mov WORD PTR [BX].TRANS,OFFSET CON$INIT ;SET BREAK ADDRESS
mov [BX].TRANS+2,cs
jmp EXIT
; PROCEDURE_NAME: DET_HDWR
; FUNCTION:
; THIS CODE DETERMINES WHAT VIDEO HARDWARE IS AVAILABLE. THIS INFORMATION
; IS USED TO LOAD APPROPRIATE VIDEO TABLES INTO MEMORY FOR USE IN THE
; GENERIC IOCTL.
; AT ENTRY:
; AT EXIT:
; NORMAL: FLAG WORD WILL CONTAIN BITS SET FOR THE APPROPRIATE
; TABLES. IN ADDITION, FOR VGA SUPPORT, A FLAG BYTE
; WILL CONTAIN THE AVAILABLE SCAN LINE SETTINGS FOR THE
; INSTALLED ADAPTER.
; VIDEO TABLES WILL BE LOADED INTO MEMORY REFLECTING
; APPLICABLE MODE SETTINGS AND SCREEN LINE LENGTHS.
; ERROR: N/A
DET_HDWR PROC NEAR
mov ah,GET_SYS_ID ; see if this is a Convertible
int 15h
cmp es:[BX].MODEL_BYTE,LCD_MODEL ; and it has an LCD attached
jnz tlab04
mov ah,GET_STATUS ; system status will tell us
int 15h
test al,1 ; if bit 0 = 0 then LCD..
jnz tlab04
or HDWR_FLAG,LCD_ACTIVE ; so ...set hdwr flag and...
lea si,COLOR_TABLE
mov cx,COLOR_NUM ; load color table (for LCD)
call LOAD_TABLE
lea si,MONO_TABLE ; and mono table
mov cx,MONO_NUM
call LOAD_TABLE
jmp short tlab05
; not LCD... check for CGA and mono
tlab04:
mov ax,MONO_ADDRESS ; write to mono buffer to see if present
call CHECK_BUF
cmp ah,al
jnz tlab03 ; if present then,
or HDWR_FLAG,MONO_ACTIVE ; set hdwr flag and..
lea si,MONO_TABLE
mov cx,MONO_NUM ; load mono table
call LOAD_TABLE
tlab03:
mov ax,COLOR_ADDRESS ; write to CGA buffer to see if present
call CHECK_BUF
cmp ah,al
jnz tlab02 ; if present then,
or HDWR_FLAG,CGA_ACTIVE ; set hdwr flag and...
lea si,COLOR_TABLE
mov cx,COLOR_NUM ; load color table
call LOAD_TABLE
tlab02:
tlab05:
push cs ; setup addressiblity for
pop es ; functionality call
xor ax,ax
mov ah,FUNC_call ; functionality call
xor bx,bx ; implementation type 0
lea DI,FUNC_INFO ; block to hold data
int 10H
cmp al,FUNC_call ; if call supported, then...
jne tlab11
mov ax,1A00h ; alternate check for VGA ;C03
int 10h ; C03
cmp bl,8 ; test for color VGA or mono VGA
jz tlab08
cmp bl,7
jnz tlab09
tlab08:
or HDWR_FLAG,VGA_ACTIVE ; yes ....so
lea si,COLOR_TABLE ; set hdwr flag and...
mov cx,COLOR_NUM ; load color table +..
call LOAD_TABLE
lea si,VGA_TABLE ; load VGA table
mov cx,VGA_NUM
call LOAD_TABLE
jmp short tlab07
; not VGA, must be MCGA
tlab09:
cmp [DI].ACTIVE_DISPLAY,MOD30_MONO
jz tlab06
cmp [DI].ACTIVE_DISPLAY,MOD30_COLOR
jz tlab06
cmp [DI].ALT_DISPLAY,MOD30_MONO
jz tlab06
cmp [DI].ALT_DISPLAY,MOD30_COLOR
jnz tlab07
tlab06:
or HDWR_FLAG,MCGA_ACTIVE ; so...set hdwr flag and...
lea si,COLOR_TABLE
mov cx,COLOR_NUM ; load color table +..
call LOAD_TABLE
lea si,MCGA_TABLE ; load MCGA table
mov cx,MCGA_NUM
call LOAD_TABLE
tlab07:
mov al,[DI].CURRENT_SCANS ; copy current scan line setting..
mov MAX_SCANS,al ; as maximum text mode scan setting.
les DI,[DI].STATIC_ADDRESS ; point to static functionality table
mov al,es:[DI].SCAN_TEXT ; load available scan line flag byte..
mov SCAN_LINES,al ; and store it in resident data.
jmp short DET_HDWR_DONE
; call not supported, try EGA
tlab11:
mov ah,alT_SELECT ; alternate select call
mov BL,EGA_INFO ; get EGA information subcall
int 10H
cmp bl,EGA_INFO ; see if call was valid
jz DET_HDWR_DONE
cmp bh,MONOCHROME ; yes, check for monochrome
jnz tlab17
or HDWR_FLAG,E5151_ACTIVE ; ..5151 found so set hdwr flag and..
lea si,EGA_5151_TABLE
mov cx,EGA_5151_NUM ; load 5151 table.
call LOAD_TABLE
jmp short DET_HDWR_DONE
tlab17:
and CL,0FH ; clear upper nibble of switch setting byte
cmp cl,9 ; test for switch settings of 5154
jz tlab13
cmp cl,3
jnz tlab14
tlab13:
or HDWR_FLAG,E5154_ACTIVE ; so..set hdwr flag and...
lea si,COLOR_TABLE
mov cx,COLOR_NUM ; load color table +..
call LOAD_TABLE
lea si,EGA_5154_TABLE ; load 5154 table
mov cx,EGA_5154_NUM
call LOAD_TABLE
jmp short DET_HDWR_DONE
; 5154 not found, must be 5153
tlab14:
or HDWR_FLAG,E5153_ACTIVE ; so..set hdwr flag and...
lea si,COLOR_TABLE
mov cx,COLOR_NUM ; load color table +..
call LOAD_TABLE
lea si,EGA_5153_TABLE ; load 5153 table
mov cx,EGA_5153_NUM
call LOAD_TABLE
DET_HDWR_DONE:
ret
DET_HDWR ENDP
; PROCEDURE_NAME: CHECK_BUF
; FUNCTION:
; THIS PROCEDURE WRITES TO THE VIDEO BUFFER AND READS THE DATA BACK
; AGAIN TO DETERMINE THE EXISTANCE OF THE VIDEO CARD.
; AT ENTRY:
; AT EXIT:
; NORMAL: AH EQ AL IF BUFFER PRESENT
; AH NE AL IF NO BUFFER
; ERROR: N/A
CHECK_BUF PROC NEAR ; write to video buffer to see if it is present
push ds
mov ds,ax ; load DS with address of buffer
mov CH,ds:0 ; save buffer information (if present)
mov al,55H ; prepare to write sample data
mov ds:0,al ; write to buffer
push BX ; terminate the bus so that lines..
pop BX ; are reset
mov ah,ds:0 ; bring sample data back...
mov ds:0,CH ; repair damage to buffer
pop ds
ret
CHECK_BUF ENDP
; PROCEDURE_NAME: LOAD_TABLE
; FUNCTION:
; THIS PROCEDURE COPIES ONE OF THE VIDEO TABLES INTO RESIDENT DATA.
; IT MAY BE REPEATED TO LOAD SEVERAL TABLES INTO THE SAME DATA SPACE.
; MATCHING MODES WILL BE OVERWRITTEN...THEREFORE..CARE MUST BE TAKEN
; IN LOAD ORDERING.
; AT ENTRY:
; SI: POINTS TO TOP OF TABLE TO COPY
; CX: NUMBER OF RECORDS TO COPY
; AT EXIT:
; NORMAL: TABLE POINTED TO BY SI IS COPIED INTO RESIDENT DATA AREA
; ERROR: N/A
LOAD_TABLE PROC NEAR
push DI ; save DI
push es ; and ES
push cs ; setup ES to code segment
pop es
lea DI,VIDEO_MODE_TABLE ; point DI to resident video table
while01:
cmp cx,0 ; do for as many records as there are
jz while01_exit
cmp di,VIDEO_TABLE_MAX ; check to ensure other data not overwritten
jge while01_exit ; cas --- signed compare!!!
mov al,[DI].V_MODE ; prepare to check resident table
cmp al,UNOCCUPIED ; if this spot is occupied
jz tlab20
cmp al,[si].V_MODE ; and is not the same mode then
jz tlab20
add DI,TYPE MODE_TABLE ; do not touch...go to next mode
jmp short while01
; can write at this location
tlab20:
push cx ; save record count
mov cx,TYPE MODE_TABLE ; load record length
rep movsb ; copy record to resident data
lea DI,VIDEO_MODE_TABLE ; Set DI to the top of the target again.
pop cx ; restore record count and..
dec cx ; decrement
jmp short while01
while01_exit:
pop es ; restore..
pop DI ; registers
ret
LOAD_TABLE ENDP
; PROCEDURE_NAME: LOAD_INT10
; FUNCTION:
; THIS PROCEDURE LOADS THE INTERRUPT HANDLER FOR INT10H
; AT ENTRY:
; AT EXIT:
; NORMAL: INTERRUPT 10H VECTOR POINTS TO INT10_COM. OLD INT 10H
; VECTOR STORED.
; ERROR: N/A
LOAD_INT10 PROC NEAR
push es
xor ax,ax ; point ES to low..
mov es,ax ; memory.
mov cx,es:WORD PTR INT10_LOW; store original..
mov cs:ROM_INT10,cx ; interrupt 10h..
mov cx,es:WORD PTR INT10_HI ; location..
mov cs:ROM_INT10+2,cx
cli
mov es:WORD PTR INT10_LOW,OFFSET INT10_COM ; replace vector..
mov es:WORD PTR INT10_HI,cs ; with our own..
sti
mov ax, DISPLAY_CHECK ;DISPLAY.SYS already loaded?
int 2fh
cmp al, INSTALLED
jne L_INT10_Ret
mov cs:Display_Loaded_Before_Me,1
L_INT10_Ret:
pop es
ret
LOAD_INT10 ENDP
; PROCEDURE_NAME: LOAD_INT2F
; FUNCTION:
; THIS PROCEDURE LOADS THE INTERRUPT HANDLER FOR INT2FH
; AT ENTRY:
; AT EXIT:
; NORMAL: INTERRUPT 2FH VECTOR POINTS TO INT2F_COM. OLD INT 2FH
; VECTOR STORED.
; ERROR: N/A
LOAD_INT2F PROC NEAR
push es
xor ax,ax ; point ES to low..
mov es,ax ; memory.
mov ax,es:WORD PTR INT2F_LOW; store original..
mov cs:ROM_INT2F,ax ; interrupt 2Fh..
mov cx,es:WORD PTR INT2F_HI ; location..
mov cs:ROM_INT2F+2,cx
or ax,cx ; check if old int2F is 0
jnz tlab21
mov ax,OFFSET ABORT ; yes....point to..
mov cs:ROM_INT2F,ax ; IRET.
mov ax,cs
mov cs:ROM_INT2F+2,ax
tlab21:
cli
mov es:WORD PTR INT2F_LOW,OFFSET INT2F_COM ; replace vector..
mov es:WORD PTR INT2F_HI,cs ; with our own..
sti
pop es
ret
LOAD_INT2F ENDP
CODE ENDS
END
|
src/compiling/ANTLR/grammar/ParallelAndSequentialBlocks.g4 | jecassis/VSCode-SystemVerilog | 75 | 2757 | grammar ParallelAndSequentialBlocks;
import Statements;
action_block : statement_or_null | ( statement )? 'else' statement_or_null ;
seq_block : 'begin' ( ':' block_identifier )? ( block_item_declaration )* ( statement_or_null )* 'end'
( ':' block_identifier )? ;
par_block : 'fork' ( ':' block_identifier )? ( block_item_declaration )* ( statement_or_null )*
join_keyword ( ':' block_identifier )? ;
join_keyword : 'join' | 'join_any' | 'join_none' ;
|
programs/oeis/017/A017634.asm | neoneye/loda | 22 | 167506 | ; A017634: (12n+9)^6.
; 531441,85766121,1291467969,8303765625,34296447249,107918163081,282429536481,646990183449,1340095640625,2565164201769,4608273662721,7858047974841,12827693806929,20179187015625
mul $0,12
add $0,9
pow $0,6
|
mac/connect.scpt | Nirmal-zymr/anyconnect-autoconnect | 0 | 423 | <reponame>Nirmal-zymr/anyconnect-autoconnect
-- Copyright 2017 <NAME>
-- 1. Place in ~/Library/Scripts and enable the Applescript menu via the Applescript Editor
-- 2. Substitute "vpn.example.com" and "<my_pass>" for your VPN server and password
-- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility
-- 4. Enable Applescript Editor and System UI Server
-- 5. Trigger script from the menu
-- 6. Enjoy being connected
tell application "Cisco AnyConnect Secure Mobility Client"
activate
end tell
repeat until application "Cisco AnyConnect Secure Mobility Client" is running
delay 1
end repeat
tell application "System Events"
repeat until (window 1 of process "Cisco AnyConnect Secure Mobility Client" exists)
delay 1
end repeat
tell process "Cisco AnyConnect Secure Mobility Client"
--keystroke ("vpn.example.com" as string)
keystroke return
end tell
repeat until (window 2 of process "Cisco AnyConnect Secure Mobility Client" exists)
delay 1
end repeat
tell process "Cisco AnyConnect Secure Mobility Client"
keystroke ("<my_pass>" as string)
keystroke return
end tell
end tell
|
PIM/TP1_Algorithmique/somme_entier_reel.adb | Hathoute/ENSEEIHT | 1 | 10298 | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
procedure Somme_Entier_Reel is
Entier : Integer; -- l'entier lu au clavier
Reel : Float; -- le réel lu au clavier
Somme : Float; -- la somme de l'entier par le réel
begin
-- Demander l'entier
Get (Entier);
-- Demander le réel
Get (Reel);
-- Calculer la somme de l'entier et du réel
Somme := Float(Entier) + Reel;
-- Afficher la somme
Put ("Somme : ");
Put (Somme, Exp => 0);
-- Exp => 0 signifie utiliser 0 chiffre pour l'exposant (si possible)
New_Line;
end Somme_Entier_Reel;
|
software/hal/boards/stm32f7_discovery/framebuffer_rk043fn48h.adb | TUM-EI-RCS/StratoX | 12 | 11130 | <filename>software/hal/boards/stm32f7_discovery/framebuffer_rk043fn48h.adb
with STM32.Device; use STM32.Device;
with STM32.GPIO; use STM32.GPIO;
package body Framebuffer_RK043FN48H is
LCD_BL_CTRL : GPIO_Point renames PK3;
LCD_ENABLE : GPIO_Point renames PI12;
LCD_HSYNC : GPIO_Point renames PI10;
LCD_VSYNC : GPIO_Point renames PI9;
LCD_CLK : GPIO_Point renames PI14;
LCD_DE : GPIO_Point renames PK7;
LCD_INT : GPIO_Point renames PI13;
NC1 : GPIO_Point renames PI8;
LCD_CTRL_PINS : constant GPIO_Points :=
(LCD_VSYNC, LCD_HSYNC, LCD_INT,
LCD_CLK, LCD_DE, NC1);
LCD_RGB_AF14 : constant GPIO_Points :=
(PI15, PJ0, PJ1, PJ2, PJ3, PJ4, PJ5, PJ6, -- Red
PJ7, PJ8, PJ9, PJ10, PJ11, PK0, PK1, PK2, -- Green
PE4, PJ13, PJ14, PJ15, PK4, PK5, PK6); -- Blue
LCD_RGB_AF9 : constant GPIO_Points :=
(1 => PG12); -- B4
procedure Init_Pins;
---------------
-- Init_Pins --
---------------
procedure Init_Pins
is
LTDC_Pins : constant GPIO_Points :=
LCD_CTRL_PINS & LCD_RGB_AF14 & LCD_RGB_AF9;
begin
Enable_Clock (LTDC_Pins);
Configure_Alternate_Function
(LCD_CTRL_PINS & LCD_RGB_AF14, GPIO_AF_LTDC);
Configure_Alternate_Function (LCD_RGB_AF9, GPIO_AF_LTDC_2);
Configure_IO
(Points => LTDC_Pins,
Config => (Speed => Speed_50MHz,
Mode => Mode_AF,
Output_Type => Push_Pull,
Resistors => Floating));
Lock (LTDC_Pins);
Configure_IO
(GPIO_Points'(LCD_ENABLE, LCD_BL_CTRL),
Config => (Speed => Speed_2MHz,
Mode => Mode_Out,
Output_Type => Push_Pull,
Resistors => Pull_Down));
Lock (LCD_ENABLE & LCD_BL_CTRL);
end Init_Pins;
----------------
-- Initialize --
----------------
procedure Initialize
(Display : in out Frame_Buffer;
Orientation : HAL.Framebuffer.Display_Orientation := Default;
Mode : HAL.Framebuffer.Wait_Mode := Interrupt)
is
begin
Init_Pins;
Display.Initialize
(Width => LCD_Natural_Width,
Height => LCD_Natural_Height,
H_Sync => 41,
H_Back_Porch => 13,
H_Front_Porch => 32,
V_Sync => 10,
V_Back_Porch => 2,
V_Front_Porch => 2,
PLLSAI_N => 192,
PLLSAI_R => 5,
DivR => 4,
Orientation => Orientation,
Mode => Mode);
STM32.GPIO.Set (LCD_ENABLE);
STM32.GPIO.Set (LCD_BL_CTRL);
end Initialize;
end Framebuffer_RK043FN48H;
|
src/Categories/Adjoint/Mate.agda | Trebor-Huang/agda-categories | 279 | 5236 | <reponame>Trebor-Huang/agda-categories
{-# OPTIONS --without-K --safe #-}
-- the usual notion of mate is defined by two isomorphisms between hom set(oid)s are natural,
-- but due to explicit universe level, a different definition is used.
module Categories.Adjoint.Mate where
open import Level
open import Data.Product using (Σ; _,_)
open import Function.Equality using (Π; _⟶_; _⇨_) renaming (_∘_ to _∙_)
open import Relation.Binary using (Setoid; IsEquivalence)
open import Categories.Category
open import Categories.Category.Instance.Setoids
open import Categories.Functor
open import Categories.Functor.Hom
open import Categories.NaturalTransformation renaming (id to idN)
open import Categories.NaturalTransformation.Equivalence using (_≃_)
open import Categories.Adjoint
import Categories.Morphism.Reasoning as MR
private
variable
o ℓ e : Level
C D : Category o ℓ e
L L′ R R′ : Functor C D
-- this notion of mate can be seen in MacLane in which this notion is shown equivalent to the
-- definition via naturally isomorphic hom setoids.
record Mate {L : Functor C D}
(L⊣R : L ⊣ R) (L′⊣R′ : L′ ⊣ R′)
(α : NaturalTransformation L L′)
(β : NaturalTransformation R′ R) : Set (levelOfTerm L⊣R ⊔ levelOfTerm L′⊣R′) where
private
module L⊣R = Adjoint L⊣R
module L′⊣R′ = Adjoint L′⊣R′
module C = Category C
module D = Category D
field
commute₁ : (R ∘ˡ α) ∘ᵥ L⊣R.unit ≃ (β ∘ʳ L′) ∘ᵥ L′⊣R′.unit
commute₂ : L⊣R.counit ∘ᵥ L ∘ˡ β ≃ L′⊣R′.counit ∘ᵥ (α ∘ʳ R′)
-- there are two equivalent commutative diagram
open NaturalTransformation renaming (commute to η-commute)
open Functor
module _ where
open D
open HomReasoning
open MR D
commute₃ : ∀ {X} → L⊣R.counit.η (F₀ L′ X) ∘ F₁ L (η β (F₀ L′ X)) ∘ F₁ L (L′⊣R′.unit.η X) ≈ η α X
commute₃ {X} = begin
L⊣R.counit.η (F₀ L′ X) ∘ F₁ L (η β (F₀ L′ X)) ∘ F₁ L (L′⊣R′.unit.η X)
≈˘⟨ refl⟩∘⟨ homomorphism L ⟩
L⊣R.counit.η (F₀ L′ X) ∘ F₁ L (η β (F₀ L′ X) C.∘ L′⊣R′.unit.η X)
≈˘⟨ refl⟩∘⟨ F-resp-≈ L commute₁ ⟩
L⊣R.counit.η (F₀ L′ X) ∘ F₁ L (F₁ R (η α X) C.∘ L⊣R.unit.η X)
≈⟨ L⊣R.RLadjunct≈id ⟩
η α X
∎
module _ where
open C
open HomReasoning
open MR C
commute₄ : ∀ {X} → F₁ R (L′⊣R′.counit.η X) ∘ F₁ R (η α (F₀ R′ X)) ∘ L⊣R.unit.η (F₀ R′ X) ≈ η β X
commute₄ {X} = begin
F₁ R (L′⊣R′.counit.η X) ∘ F₁ R (η α (F₀ R′ X)) ∘ L⊣R.unit.η (F₀ R′ X)
≈˘⟨ pushˡ (homomorphism R) ⟩
F₁ R (L′⊣R′.counit.η X D.∘ η α (F₀ R′ X)) ∘ L⊣R.unit.η (F₀ R′ X)
≈˘⟨ F-resp-≈ R commute₂ ⟩∘⟨refl ⟩
F₁ R (L⊣R.counit.η X D.∘ F₁ L (η β X)) ∘ L⊣R.unit.η (F₀ R′ X)
≈⟨ L⊣R.LRadjunct≈id ⟩
η β X
∎
record HaveMate {L L′ : Functor C D} {R R′ : Functor D C}
(L⊣R : L ⊣ R) (L′⊣R′ : L′ ⊣ R′) : Set (levelOfTerm L⊣R ⊔ levelOfTerm L′⊣R′) where
field
α : NaturalTransformation L L′
β : NaturalTransformation R′ R
mate : Mate L⊣R L′⊣R′ α β
module α = NaturalTransformation α
module β = NaturalTransformation β
open Mate mate public
-- show that the commutative diagram implies natural isomorphism between homsetoids.
-- the problem is that two homsetoids live in two universe level, in a situation similar to the definition
-- of adjoint via naturally isomorphic homsetoids.
module _ {L L′ : Functor C D} {R R′ : Functor D C}
{L⊣R : L ⊣ R} {L′⊣R′ : L′ ⊣ R′}
{α : NaturalTransformation L L′}
{β : NaturalTransformation R′ R}
(mate : Mate L⊣R L′⊣R′ α β) where
private
open Mate mate
open Functor
module C = Category C
module D = Category D
module α = NaturalTransformation α
module β = NaturalTransformation β
module L⊣R = Adjoint L⊣R
module L′⊣R′ = Adjoint L′⊣R′
-- there are two squares to show
module _ {X : C.Obj} {Y : D.Obj} where
open Setoid (L′⊣R′.Hom[L-,-].F₀ (X , Y) ⇨ L⊣R.Hom[-,R-].F₀ (X , Y))
open C hiding (_≈_)
open MR C
open C.HomReasoning
module DH = D.HomReasoning
mate-commute₁ : F₁ Hom[ C ][-,-] (C.id , β.η Y) ∙ L′⊣R′.Hom-inverse.to {X} {Y}
≈ L⊣R.Hom-inverse.to {X} {Y} ∙ F₁ Hom[ D ][-,-] (α.η X , D.id)
mate-commute₁ {f} {g} f≈g = begin
β.η Y ∘ (F₁ R′ f ∘ L′⊣R′.unit.η X) ∘ C.id ≈⟨ refl⟩∘⟨ identityʳ ⟩
β.η Y ∘ F₁ R′ f ∘ L′⊣R′.unit.η X ≈⟨ pullˡ (β.commute f) ⟩
(F₁ R f ∘ β.η (F₀ L′ X)) ∘ L′⊣R′.unit.η X ≈˘⟨ pushʳ commute₁ ⟩
F₁ R f ∘ F₁ R (α.η X) ∘ L⊣R.unit.η X ≈˘⟨ pushˡ (homomorphism R) ⟩
F₁ R (f D.∘ α.η X) ∘ L⊣R.unit.η X ≈⟨ F-resp-≈ R (D.∘-resp-≈ˡ f≈g DH.○ DH.⟺ D.identityˡ) ⟩∘⟨refl ⟩
F₁ R (D.id D.∘ g D.∘ α.η X) ∘ L⊣R.unit.η X ∎
module _ {X : C.Obj} {Y : D.Obj} where
open Setoid (L′⊣R′.Hom[-,R-].F₀ (X , Y) ⇨ L⊣R.Hom[L-,-].F₀ (X , Y))
open D hiding (_≈_)
open MR D
open D.HomReasoning
module CH = C.HomReasoning
mate-commute₂ : F₁ Hom[ D ][-,-] (α.η X , D.id) ∙ L′⊣R′.Hom-inverse.from {X} {Y}
≈ L⊣R.Hom-inverse.from {X} {Y} ∙ F₁ Hom[ C ][-,-] (C.id , β.η Y)
mate-commute₂ {f} {g} f≈g = begin
D.id ∘ (L′⊣R′.counit.η Y ∘ F₁ L′ f) ∘ α.η X ≈⟨ identityˡ ⟩
(L′⊣R′.counit.η Y ∘ F₁ L′ f) ∘ α.η X ≈˘⟨ pushʳ (α.commute f) ⟩
L′⊣R′.counit.η Y ∘ α.η (F₀ R′ Y) ∘ F₁ L f ≈˘⟨ pushˡ commute₂ ⟩
(L⊣R.counit.η Y ∘ F₁ L (β.η Y)) ∘ F₁ L f ≈˘⟨ pushʳ (homomorphism L) ⟩
L⊣R.counit.η Y ∘ F₁ L (β.η Y C.∘ f) ≈⟨ refl⟩∘⟨ F-resp-≈ L (C.∘-resp-≈ʳ (f≈g CH.○ CH.⟺ C.identityʳ)) ⟩
L⊣R.counit.η Y ∘ F₁ L (β.η Y C.∘ g C.∘ C.id) ∎
-- alternatively, if commute₃ and commute₄ are shown, then a Mate can be constructed.
module _ {L L′ : Functor C D} {R R′ : Functor D C}
{L⊣R : L ⊣ R} {L′⊣R′ : L′ ⊣ R′}
{α : NaturalTransformation L L′}
{β : NaturalTransformation R′ R} where
private
open Functor
module C = Category C
module D = Category D
module α = NaturalTransformation α
module β = NaturalTransformation β
module L⊣R = Adjoint L⊣R
module L′⊣R′ = Adjoint L′⊣R′
module _ (commute₃ : ∀ {X} → L⊣R.counit.η (F₀ L′ X) D.∘ F₁ L (β.η (F₀ L′ X)) D.∘ F₁ L (L′⊣R′.unit.η X) D.≈ α.η X) where
open C
open HomReasoning
commute₁ : ∀ {X} → F₁ R (α.η X) ∘ L⊣R.unit.η X ≈ β.η (F₀ L′ X) ∘ L′⊣R′.unit.η X
commute₁ {X} = begin
F₁ R (α.η X) ∘ L⊣R.unit.η X
≈˘⟨ F-resp-≈ R commute₃ ⟩∘⟨refl ⟩
F₁ R (L⊣R.counit.η (F₀ L′ X) D.∘ F₁ L (β.η (F₀ L′ X)) D.∘ F₁ L (L′⊣R′.unit.η X)) ∘ L⊣R.unit.η X
≈˘⟨ F-resp-≈ R (D.∘-resp-≈ʳ (homomorphism L)) ⟩∘⟨refl ⟩
F₁ R (L⊣R.counit.η (F₀ L′ X) D.∘ F₁ L (β.η (F₀ L′ X) ∘ L′⊣R′.unit.η X)) ∘ L⊣R.unit.η X
≈⟨ L⊣R.LRadjunct≈id ⟩
β.η (F₀ L′ X) ∘ L′⊣R′.unit.η X
∎
module _ (commute₄ : ∀ {X} → F₁ R (L′⊣R′.counit.η X) C.∘ F₁ R (α.η (F₀ R′ X)) C.∘ L⊣R.unit.η (F₀ R′ X) C.≈ β.η X) where
open D
open HomReasoning
open MR C
commute₂ : ∀ {X} → L⊣R.counit.η X ∘ F₁ L (β.η X) ≈ L′⊣R′.counit.η X ∘ α.η (F₀ R′ X)
commute₂ {X} = begin
L⊣R.counit.η X ∘ F₁ L (β.η X)
≈˘⟨ refl⟩∘⟨ F-resp-≈ L commute₄ ⟩
L⊣R.counit.η X ∘ F₁ L (F₁ R (L′⊣R′.counit.η X) C.∘ F₁ R (α.η (F₀ R′ X)) C.∘ L⊣R.unit.η (F₀ R′ X))
≈˘⟨ refl⟩∘⟨ F-resp-≈ L (pushˡ (homomorphism R)) ⟩
L⊣R.counit.η X ∘ F₁ L (F₁ R (L′⊣R′.counit.η X ∘ α.η (F₀ R′ X)) C.∘ L⊣R.unit.η (F₀ R′ X))
≈⟨ L⊣R.RLadjunct≈id ⟩
L′⊣R′.counit.η X ∘ α.η (F₀ R′ X)
∎
mate′ : (∀ {X} → L⊣R.counit.η (F₀ L′ X) D.∘ F₁ L (β.η (F₀ L′ X)) D.∘ F₁ L (L′⊣R′.unit.η X) D.≈ α.η X) →
(∀ {X} → F₁ R (L′⊣R′.counit.η X) C.∘ F₁ R (α.η (F₀ R′ X)) C.∘ L⊣R.unit.η (F₀ R′ X) C.≈ β.η X) →
Mate L⊣R L′⊣R′ α β
mate′ commute₃ commute₄ = record
{ commute₁ = commute₁ commute₃
; commute₂ = commute₂ commute₄
}
|
marbles.asm | DChristianson/atari-vcs-samples | 0 | 6414 | <gh_stars>0
processor 6502
include "vcs.h"
include "macro.h"
NTSC = 0
PAL60 = 1
IFNCONST SYSTEM
SYSTEM = NTSC
ENDIF
; ----------------------------------
; constants
SPEED = 3
PLAYFIELD_HEIGHT_BLOCKS = 20
PLAYFIELD_HEIGHT_PIX = PLAYFIELD_HEIGHT_BLOCKS * 2
NUM_PLAYERS = 4
#if SYSTEM = NTSC
; NTSC Colors
WHITE = $0F
GREY = $08
RED = $44
YELLOW = $1A
GREEN = $B6
BLUE = $82
BLACK = 0
#else
; PAL Colors
WHITE = $0E
GREY = $08
RED = $62
YELLOW = $2A
GREEN = $36
BLUE = $B2
BLACK = 0
#endif
; ----------------------------------
; macros
MAC PLAYFIELD_BLOCKS
lda BLOCK_PF0,y ;4 14
sta PF0 ;3 17
lda BLOCK_PF1,y ;4 21
sta PF1 ;3 24
lda BLOCK_PF2,y ;4 28
sta PF2 ;3 31
lda BLOCK_PF3,y ;4 35
sta PF0 ;3 38
lda BLOCK_PF4,y ;4 42
sta PF1 ;3 45
lda BLOCK_PF5,y ;4 49
sta PF2 ;3 52
ENDM
; ----------------------------------
; variables
SEG.U variables
ORG $80
; game state
frame ds 1
blocks ds 40
player_vpos ds 4
missile_vpos ds 4
missile_hpos ds 4
missile_vvel ds 4
missile_hvel ds 4
; scratch vars
player_color ds 2
missile_hindex ds 2
missile_index ds 2
player_index ds 2
block_end_counter ds 2
block_counter ds 1
collision ds 4
SEG
; ----------------------------------
; code
SEG
ORG $F000
Reset
; do the clean start macro
CLEAN_START
initMissiles_start
ldx #10
stx player_vpos
stx player_vpos+1
stx player_vpos+2
stx player_vpos+3
ldx #$04
stx missile_vpos
stx missile_vpos+2
ldx #$07
stx missile_vpos+1
stx missile_vpos+3
ldx #$01
stx missile_vvel
stx missile_vvel + 2
ldx #$ff
stx missile_vvel + 1
stx missile_vvel + 3
ldx #$04
stx missile_hpos
stx missile_hpos + 2
ldx #$07
stx missile_hpos + 1
stx missile_hpos + 3
ldx #$10
stx missile_hvel
stx missile_hvel + 2
ldx #$f0
stx missile_hvel + 1
stx missile_hvel + 3
initMissiles_end
initBlocks_start
lda #PLAYFIELD_HEIGHT_BLOCKS
ldy #PLAYFIELD_HEIGHT_BLOCKS * 2 - 1
initBlocks_loop
sta blocks,y
dey
bpl initBlocks_loop
initblocks_end
newFrame
; Start of vertical blank processing
lda #0
sta VBLANK
sta COLUBK ; background colour to black
; 3 scanlines of vertical sync signal to follow
ldx #%00000010
stx VSYNC ; turn ON VSYNC bit 1
sta WSYNC ; wait a scanline
sta WSYNC ; another
sta WSYNC ; another = 3 lines total
sta VSYNC ; turn OFF VSYNC bit 1
; 37 scanlines of vertical blank to follow
;--------------------
; VBlank start
lda #1
sta VBLANK
lda #42 ; vblank timer will land us ~ on scanline 34
sta TIM64T
dec frame
bpl moveMissile_end
lda #SPEED
sta frame
ldx #NUM_PLAYERS - 1
moveMissile_loop
lda missile_vpos,x
clc
adc missile_vvel,x
cmp #1
bpl moveMissile_vgt0
lda #$01
sta missile_vvel,x
jmp moveMissile_savev
moveMissile_vgt0
cmp #PLAYFIELD_HEIGHT_PIX + 1
bmi moveMissile_savev
lda #$ff
sta missile_vvel,x
lda #PLAYFIELD_HEIGHT_PIX
moveMissile_savev
sta missile_vpos,x
moveMissile_horiz
lda missile_hvel,x
bmi moveMissile_right
clc
adc missile_hpos,x
bvc moveMissile_left_limit
adc #$0f
moveMissile_left_limit
tay
and #$0f
cmp #$02
bpl moveMissile_savehy
cpy #$31
bcs moveMissile_savehy
lda #$f0
sta missile_hvel,x
ldy #$21
jmp moveMissile_savehy
moveMissile_right
clc
adc missile_hpos,x
bvc moveMissile_right_limit
adc #$00 ; note carry is set
moveMissile_right_limit
tay
and #$0f
cmp #$0b
bmi moveMissile_savehy
cpy #$ab
bcc moveMissile_savehy
lda #$10
sta missile_hvel,x
ldy #$ab
moveMissile_savehy
tya
moveMissile_saveh
sta missile_hpos,x
dex
bpl moveMissile_loop
moveMissile_end
;-- collision logic
ldx #NUM_PLAYERS - 1
collideMissile_loop
lda collision,x
bpl collideMissile_next
lda #PLAYFIELD_HEIGHT_PIX - 1
sec
sbc missile_vpos,x
lsr
cpx #$02
bcc collideMissile_no_offset
adc #PLAYFIELD_HEIGHT_BLOCKS
collideMissile_no_offset
tay
txa
lsr
bcs collideMissile_right
lda blocks,y
cmp #39
bcs collideMissile_next
clc
adc #$01
sta blocks,y
lda #$03
sta missile_hpos,x
jmp collideMissile_next
collideMissile_right
lda blocks,y
beq collideMissile_next
sec
sbc #$01
sta blocks,y
lda #$09
sta missile_hpos,x
collideMissile_next
dex
bpl collideMissile_loop
; setupBlocks_start
; ldy #39
; setupBlocks_loop
; ldx blocks,y
; inx
; cpx #41
; bmi setupBlocks_save
; ldx #$00
; setupBlocks_save
; stx blocks,y
; dey
; bpl setupBlocks_loop
setupBlocks_end
ldx #0
waitOnVBlank
cpx INTIM
bmi waitOnVBlank
stx VBLANK
;--------------------
; Screen start
sta WSYNC
lda #$00
sta PF0
sta PF1
sta PF2
sta COLUBK
sta block_end_counter
lda #PLAYFIELD_HEIGHT_BLOCKS
sta block_counter
lda #WHITE
sta COLUP0
sta COLUP1
lda #BLUE
sta player_color
lda #RED
sta player_color + 1
lda player_vpos
sta player_index
lda player_vpos + 1
sta player_index + 1
lda missile_vpos
sta missile_index
lda missile_vpos + 1
sta missile_index + 1
lda missile_hpos
sta missile_hindex
lda missile_hpos + 1
sta missile_hindex + 1
sta CXCLR
jsr playfield
sta WSYNC
lda #$00
sta PF0
sta PF1
sta PF2
lda CXM0FB
eor #$80
sta collision
lda CXM1FB
sta collision + 1
sta COLUBK
lda #PLAYFIELD_HEIGHT_BLOCKS
sta block_end_counter
lda #PLAYFIELD_HEIGHT_BLOCKS * 2 - 1
sta block_counter
lda #GREEN
sta player_color
lda #YELLOW
sta player_color + 1
lda player_vpos + 2
sta player_index
lda player_vpos + 3
sta player_index + 1
lda missile_vpos + 2
sta missile_index
lda missile_vpos + 3
sta missile_index + 1
lda missile_hpos + 2
sta missile_hindex
lda missile_hpos + 3
sta missile_hindex + 1
sta CXCLR
jsr playfield
sta WSYNC
lda #$00
sta PF0
sta PF1
sta PF2
sta COLUBK
lda CXM0FB
eor #$80
sta collision + 2
lda CXM1FB
sta collision + 3
jmp overscan
playfield
; locate missile 0
sta WSYNC
lda missile_hindex
sta HMM0
and #$0F
tax
missile_0_resp
dex
bpl missile_0_resp
sta RESM0
sta WSYNC
; locate missile 1
lda missile_hindex+1
sta HMM1
and #$0F
tax
missile_1_resp
dex
bpl missile_1_resp
sta RESM1
sta WSYNC
sta HMOVE
lda player_color
sta COLUPF
lda player_color+1 ;3 3
sta COLUBK ;3 6
ldx block_counter
playfield_loop_block
ldy blocks,x ;4 --/72
sta WSYNC ;3 0
dec missile_index ;5 5
dec missile_index + 1 ;5 10
PLAYFIELD_BLOCKS ;42 52
lda missile_index ;3 55
beq missile_0_A ;2 57
lda #$ff ;2 59
missile_0_A
eor #$ff ;2 61
sta ENAM0 ;3 64
lda missile_index+1 ;3 67
beq missile_1_A ;2 69
lda #$ff ;2 71
missile_1_A
eor #$ff ;2 73
sta ENAM1 ;3 76
; sta WSYNC ;3 0
SLEEP 10 ; 10
PLAYFIELD_BLOCKS ;42 52
sta WSYNC ;3 0
dec missile_index ;5 5
dec missile_index + 1 ;5 10
PLAYFIELD_BLOCKS ;42 52
lda missile_index ;3 55
beq missile_0_B ;2 57
lda #$ff ;2 59
missile_0_B
eor #$ff ;2 61
sta ENAM0 ;3 64
lda missile_index+1 ;3 67
beq missile_1_B ;2 69
lda #$ff ;2 71
missile_1_B
eor #$ff ;2 73
sta ENAM1 ;3 76
; sta WSYNC ;3 0
SLEEP 10 ; 10
PLAYFIELD_BLOCKS ;42 52
ldx block_counter ;3 55
dex ;2 57
cpx block_end_counter ;3 60
bmi playfield_end ;2 62
stx block_counter ;3 65
jmp playfield_loop_block ;3 68
playfield_end
rts ;6 69
;--------------------
; Overscan start
overscan
ldx #30
waitOnOverscan
sta WSYNC
dex
bne waitOnOverscan
jmp newFrame
;--------------------
; Block Graphics
ORG $FF00
BLOCK_PF0 byte $00,$10,$30,$70,$F0,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
BLOCK_PF1 byte $00,$00,$00,$00,$00,$80,$C0,$E0,$F0,$F8,$FC,$FE,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
BLOCK_PF2 byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01,$03,$07,$0F,$1F,$3F,$7F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
BLOCK_PF3 byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$10,$30,$70,$F0,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
BLOCK_PF4 byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$80,$C0,$E0,$F0,$F8,$FC,$FE,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
BLOCK_PF5 byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01,$03,$07,$0F,$1F,$3F,$7F,$FF
;--------------------
; Reset
ORG $FFFA
.word Reset ; NMI
.word Reset ; RESET
.word Reset ; IRQ
END |
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0.log_21829_551.asm | ljhsiun2/medusa | 9 | 22190 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x9733, %rsi
lea addresses_UC_ht+0x1785, %rdi
nop
nop
sub %r13, %r13
mov $114, %rcx
rep movsl
nop
nop
nop
nop
and $24500, %rdx
lea addresses_D_ht+0x1ba55, %rsi
lea addresses_WT_ht+0x6425, %rdi
nop
nop
nop
xor %r14, %r14
mov $113, %rcx
rep movsb
nop
nop
nop
nop
nop
xor %rdi, %rdi
lea addresses_A_ht+0x1b445, %rsi
lea addresses_UC_ht+0x1d809, %rdi
nop
nop
and $38197, %r11
mov $88, %rcx
rep movsw
nop
nop
nop
nop
nop
xor $53798, %r14
lea addresses_WC_ht+0xc085, %r13
nop
nop
nop
nop
and $19027, %rdx
movw $0x6162, (%r13)
nop
nop
nop
inc %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %r8
push %rbp
push %rcx
push %rdi
push %rdx
// Store
lea addresses_UC+0xca85, %r8
add %rcx, %rcx
mov $0x5152535455565758, %rdi
movq %rdi, (%r8)
nop
nop
and %rcx, %rcx
// Store
mov $0xb3, %rdi
nop
inc %r15
movb $0x51, (%rdi)
nop
nop
nop
nop
add %r10, %r10
// Store
mov $0x8bd, %rdi
nop
inc %rdx
movl $0x51525354, (%rdi)
nop
nop
nop
and %rbp, %rbp
// Faulty Load
lea addresses_UC+0x1c485, %rdx
clflush (%rdx)
nop
nop
nop
inc %r8
mov (%rdx), %rcx
lea oracles, %r10
and $0xff, %rcx
shlq $12, %rcx
mov (%r10,%rcx,1), %rcx
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 9, 'type': 'addresses_UC', 'AVXalign': True, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_P', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_P', 'AVXalign': False, 'size': 4}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': True, 'size': 8}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}}
{'src': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}}
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 2}}
{'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
*/
|
tools-src/gnu/gcc/gcc/ada/i-os2err.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 25197 | <reponame>enfoTek/tomato.linksys.e2000.nvram-mod<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- I N T E R F A C E S . O S 2 L I B . E R R O R S --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1993,1994,1995 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Definition of values for OS/2 error returns
package Interfaces.OS2Lib.Errors is
pragma Preelaborate (Errors);
NO_ERROR : constant := 0;
ERROR_INVALID_FUNCTION : constant := 1;
ERROR_FILE_NOT_FOUND : constant := 2;
ERROR_PATH_NOT_FOUND : constant := 3;
ERROR_TOO_MANY_OPEN_FILES : constant := 4;
ERROR_ACCESS_DENIED : constant := 5;
ERROR_INVALID_HANDLE : constant := 6;
ERROR_ARENA_TRASHED : constant := 7;
ERROR_NOT_ENOUGH_MEMORY : constant := 8;
ERROR_INVALID_BLOCK : constant := 9;
ERROR_BAD_ENVIRONMENT : constant := 10;
ERROR_BAD_FORMAT : constant := 11;
ERROR_INVALID_ACCESS : constant := 12;
ERROR_INVALID_DATA : constant := 13;
ERROR_INVALID_DRIVE : constant := 15;
ERROR_CURRENT_DIRECTORY : constant := 16;
ERROR_NOT_SAME_DEVICE : constant := 17;
ERROR_NO_MORE_FILES : constant := 18;
ERROR_WRITE_PROTECT : constant := 19;
ERROR_BAD_UNIT : constant := 20;
ERROR_NOT_READY : constant := 21;
ERROR_BAD_COMMAND : constant := 22;
ERROR_CRC : constant := 23;
ERROR_BAD_LENGTH : constant := 24;
ERROR_SEEK : constant := 25;
ERROR_NOT_DOS_DISK : constant := 26;
ERROR_SECTOR_NOT_FOUND : constant := 27;
ERROR_OUT_OF_PAPER : constant := 28;
ERROR_WRITE_FAULT : constant := 29;
ERROR_READ_FAULT : constant := 30;
ERROR_GEN_FAILURE : constant := 31;
ERROR_SHARING_VIOLATION : constant := 32;
ERROR_LOCK_VIOLATION : constant := 33;
ERROR_WRONG_DISK : constant := 34;
ERROR_FCB_UNAVAILABLE : constant := 35;
ERROR_SHARING_BUFFER_EXCEEDED : constant := 36;
ERROR_CODE_PAGE_MISMATCHED : constant := 37;
ERROR_HANDLE_EOF : constant := 38;
ERROR_HANDLE_DISK_FULL : constant := 39;
ERROR_NOT_SUPPORTED : constant := 50;
ERROR_REM_NOT_LIST : constant := 51;
ERROR_DUP_NAME : constant := 52;
ERROR_BAD_NETPATH : constant := 53;
ERROR_NETWORK_BUSY : constant := 54;
ERROR_DEV_NOT_EXIST : constant := 55;
ERROR_TOO_MANY_CMDS : constant := 56;
ERROR_ADAP_HDW_ERR : constant := 57;
ERROR_BAD_NET_RESP : constant := 58;
ERROR_UNEXP_NET_ERR : constant := 59;
ERROR_BAD_REM_ADAP : constant := 60;
ERROR_PRINTQ_FULL : constant := 61;
ERROR_NO_SPOOL_SPACE : constant := 62;
ERROR_PRINT_CANCELLED : constant := 63;
ERROR_NETNAME_DELETED : constant := 64;
ERROR_NETWORK_ACCESS_DENIED : constant := 65;
ERROR_BAD_DEV_TYPE : constant := 66;
ERROR_BAD_NET_NAME : constant := 67;
ERROR_TOO_MANY_NAMES : constant := 68;
ERROR_TOO_MANY_SESS : constant := 69;
ERROR_SHARING_PAUSED : constant := 70;
ERROR_REQ_NOT_ACCEP : constant := 71;
ERROR_REDIR_PAUSED : constant := 72;
ERROR_SBCS_ATT_WRITE_PROT : constant := 73;
ERROR_SBCS_GENERAL_FAILURE : constant := 74;
ERROR_XGA_OUT_MEMORY : constant := 75;
ERROR_FILE_EXISTS : constant := 80;
ERROR_DUP_FCB : constant := 81;
ERROR_CANNOT_MAKE : constant := 82;
ERROR_FAIL_I24 : constant := 83;
ERROR_OUT_OF_STRUCTURES : constant := 84;
ERROR_ALREADY_ASSIGNED : constant := 85;
ERROR_INVALID_PASSWORD : constant := 86;
ERROR_INVALID_PARAMETER : constant := 87;
ERROR_NET_WRITE_FAULT : constant := 88;
ERROR_NO_PROC_SLOTS : constant := 89;
ERROR_NOT_FROZEN : constant := 90;
ERROR_SYS_COMP_NOT_LOADED : constant := 90;
ERR_TSTOVFL : constant := 91;
ERR_TSTDUP : constant := 92;
ERROR_NO_ITEMS : constant := 93;
ERROR_INTERRUPT : constant := 95;
ERROR_DEVICE_IN_USE : constant := 99;
ERROR_TOO_MANY_SEMAPHORES : constant := 100;
ERROR_EXCL_SEM_ALREADY_OWNED : constant := 101;
ERROR_SEM_IS_SET : constant := 102;
ERROR_TOO_MANY_SEM_REQUESTS : constant := 103;
ERROR_INVALID_AT_INTERRUPT_TIME : constant := 104;
ERROR_SEM_OWNER_DIED : constant := 105;
ERROR_SEM_USER_LIMIT : constant := 106;
ERROR_DISK_CHANGE : constant := 107;
ERROR_DRIVE_LOCKED : constant := 108;
ERROR_BROKEN_PIPE : constant := 109;
ERROR_OPEN_FAILED : constant := 110;
ERROR_BUFFER_OVERFLOW : constant := 111;
ERROR_DISK_FULL : constant := 112;
ERROR_NO_MORE_SEARCH_HANDLES : constant := 113;
ERROR_INVALID_TARGET_HANDLE : constant := 114;
ERROR_PROTECTION_VIOLATION : constant := 115;
ERROR_VIOKBD_REQUEST : constant := 116;
ERROR_INVALID_CATEGORY : constant := 117;
ERROR_INVALID_VERIFY_SWITCH : constant := 118;
ERROR_BAD_DRIVER_LEVEL : constant := 119;
ERROR_CALL_NOT_IMPLEMENTED : constant := 120;
ERROR_SEM_TIMEOUT : constant := 121;
ERROR_INSUFFICIENT_BUFFER : constant := 122;
ERROR_INVALID_NAME : constant := 123;
ERROR_INVALID_LEVEL : constant := 124;
ERROR_NO_VOLUME_LABEL : constant := 125;
ERROR_MOD_NOT_FOUND : constant := 126;
ERROR_PROC_NOT_FOUND : constant := 127;
ERROR_WAIT_NO_CHILDREN : constant := 128;
ERROR_CHILD_NOT_COMPLETE : constant := 129;
ERROR_DIRECT_ACCESS_HANDLE : constant := 130;
ERROR_NEGATIVE_SEEK : constant := 131;
ERROR_SEEK_ON_DEVICE : constant := 132;
ERROR_IS_JOIN_TARGET : constant := 133;
ERROR_IS_JOINED : constant := 134;
ERROR_IS_SUBSTED : constant := 135;
ERROR_NOT_JOINED : constant := 136;
ERROR_NOT_SUBSTED : constant := 137;
ERROR_JOIN_TO_JOIN : constant := 138;
ERROR_SUBST_TO_SUBST : constant := 139;
ERROR_JOIN_TO_SUBST : constant := 140;
ERROR_SUBST_TO_JOIN : constant := 141;
ERROR_BUSY_DRIVE : constant := 142;
ERROR_SAME_DRIVE : constant := 143;
ERROR_DIR_NOT_ROOT : constant := 144;
ERROR_DIR_NOT_EMPTY : constant := 145;
ERROR_IS_SUBST_PATH : constant := 146;
ERROR_IS_JOIN_PATH : constant := 147;
ERROR_PATH_BUSY : constant := 148;
ERROR_IS_SUBST_TARGET : constant := 149;
ERROR_SYSTEM_TRACE : constant := 150;
ERROR_INVALID_EVENT_COUNT : constant := 151;
ERROR_TOO_MANY_MUXWAITERS : constant := 152;
ERROR_INVALID_LIST_FORMAT : constant := 153;
ERROR_LABEL_TOO_LONG : constant := 154;
ERROR_TOO_MANY_TCBS : constant := 155;
ERROR_SIGNAL_REFUSED : constant := 156;
ERROR_DISCARDED : constant := 157;
ERROR_NOT_LOCKED : constant := 158;
ERROR_BAD_THREADID_ADDR : constant := 159;
ERROR_BAD_ARGUMENTS : constant := 160;
ERROR_BAD_PATHNAME : constant := 161;
ERROR_SIGNAL_PENDING : constant := 162;
ERROR_UNCERTAIN_MEDIA : constant := 163;
ERROR_MAX_THRDS_REACHED : constant := 164;
ERROR_MONITORS_NOT_SUPPORTED : constant := 165;
ERROR_UNC_DRIVER_NOT_INSTALLED : constant := 166;
ERROR_LOCK_FAILED : constant := 167;
ERROR_SWAPIO_FAILED : constant := 168;
ERROR_SWAPIN_FAILED : constant := 169;
ERROR_BUSY : constant := 170;
ERROR_CANCEL_VIOLATION : constant := 173;
ERROR_ATOMIC_LOCK_NOT_SUPPORTED : constant := 174;
ERROR_READ_LOCKS_NOT_SUPPORTED : constant := 175;
ERROR_INVALID_SEGMENT_NUMBER : constant := 180;
ERROR_INVALID_CALLGATE : constant := 181;
ERROR_INVALID_ORDINAL : constant := 182;
ERROR_ALREADY_EXISTS : constant := 183;
ERROR_NO_CHILD_PROCESS : constant := 184;
ERROR_CHILD_ALIVE_NOWAIT : constant := 185;
ERROR_INVALID_FLAG_NUMBER : constant := 186;
ERROR_SEM_NOT_FOUND : constant := 187;
ERROR_INVALID_STARTING_CODESEG : constant := 188;
ERROR_INVALID_STACKSEG : constant := 189;
ERROR_INVALID_MODULETYPE : constant := 190;
ERROR_INVALID_EXE_SIGNATURE : constant := 191;
ERROR_EXE_MARKED_INVALID : constant := 192;
ERROR_BAD_EXE_FORMAT : constant := 193;
ERROR_ITERATED_DATA_EXCEEDS_64k : constant := 194;
ERROR_INVALID_MINALLOCSIZE : constant := 195;
ERROR_DYNLINK_FROM_INVALID_RING : constant := 196;
ERROR_IOPL_NOT_ENABLED : constant := 197;
ERROR_INVALID_SEGDPL : constant := 198;
ERROR_AUTODATASEG_EXCEEDS_64k : constant := 199;
ERROR_RING2SEG_MUST_BE_MOVABLE : constant := 200;
ERROR_RELOC_CHAIN_XEEDS_SEGLIM : constant := 201;
ERROR_INFLOOP_IN_RELOC_CHAIN : constant := 202;
ERROR_ENVVAR_NOT_FOUND : constant := 203;
ERROR_NOT_CURRENT_CTRY : constant := 204;
ERROR_NO_SIGNAL_SENT : constant := 205;
ERROR_FILENAME_EXCED_RANGE : constant := 206;
ERROR_RING2_STACK_IN_USE : constant := 207;
ERROR_META_EXPANSION_TOO_LONG : constant := 208;
ERROR_INVALID_SIGNAL_NUMBER : constant := 209;
ERROR_THREAD_1_INACTIVE : constant := 210;
ERROR_INFO_NOT_AVAIL : constant := 211;
ERROR_LOCKED : constant := 212;
ERROR_BAD_DYNALINK : constant := 213;
ERROR_TOO_MANY_MODULES : constant := 214;
ERROR_NESTING_NOT_ALLOWED : constant := 215;
ERROR_CANNOT_SHRINK : constant := 216;
ERROR_ZOMBIE_PROCESS : constant := 217;
ERROR_STACK_IN_HIGH_MEMORY : constant := 218;
ERROR_INVALID_EXITROUTINE_RING : constant := 219;
ERROR_GETBUF_FAILED : constant := 220;
ERROR_FLUSHBUF_FAILED : constant := 221;
ERROR_TRANSFER_TOO_LONG : constant := 222;
ERROR_FORCENOSWAP_FAILED : constant := 223;
ERROR_SMG_NO_TARGET_WINDOW : constant := 224;
ERROR_NO_CHILDREN : constant := 228;
ERROR_INVALID_SCREEN_GROUP : constant := 229;
ERROR_BAD_PIPE : constant := 230;
ERROR_PIPE_BUSY : constant := 231;
ERROR_NO_DATA : constant := 232;
ERROR_PIPE_NOT_CONNECTED : constant := 233;
ERROR_MORE_DATA : constant := 234;
ERROR_VC_DISCONNECTED : constant := 240;
ERROR_CIRCULARITY_REQUESTED : constant := 250;
ERROR_DIRECTORY_IN_CDS : constant := 251;
ERROR_INVALID_FSD_NAME : constant := 252;
ERROR_INVALID_PATH : constant := 253;
ERROR_INVALID_EA_NAME : constant := 254;
ERROR_EA_LIST_INCONSISTENT : constant := 255;
ERROR_EA_LIST_TOO_LONG : constant := 256;
ERROR_NO_META_MATCH : constant := 257;
ERROR_FINDNOTIFY_TIMEOUT : constant := 258;
ERROR_NO_MORE_ITEMS : constant := 259;
ERROR_SEARCH_STRUC_REUSED : constant := 260;
ERROR_CHAR_NOT_FOUND : constant := 261;
ERROR_TOO_MUCH_STACK : constant := 262;
ERROR_INVALID_ATTR : constant := 263;
ERROR_INVALID_STARTING_RING : constant := 264;
ERROR_INVALID_DLL_INIT_RING : constant := 265;
ERROR_CANNOT_COPY : constant := 266;
ERROR_DIRECTORY : constant := 267;
ERROR_OPLOCKED_FILE : constant := 268;
ERROR_OPLOCK_THREAD_EXISTS : constant := 269;
ERROR_VOLUME_CHANGED : constant := 270;
ERROR_FINDNOTIFY_HANDLE_IN_USE : constant := 271;
ERROR_FINDNOTIFY_HANDLE_CLOSED : constant := 272;
ERROR_NOTIFY_OBJECT_REMOVED : constant := 273;
ERROR_ALREADY_SHUTDOWN : constant := 274;
ERROR_EAS_DIDNT_FIT : constant := 275;
ERROR_EA_FILE_CORRUPT : constant := 276;
ERROR_EA_TABLE_FULL : constant := 277;
ERROR_INVALID_EA_HANDLE : constant := 278;
ERROR_NO_CLUSTER : constant := 279;
ERROR_CREATE_EA_FILE : constant := 280;
ERROR_CANNOT_OPEN_EA_FILE : constant := 281;
ERROR_EAS_NOT_SUPPORTED : constant := 282;
ERROR_NEED_EAS_FOUND : constant := 283;
ERROR_DUPLICATE_HANDLE : constant := 284;
ERROR_DUPLICATE_NAME : constant := 285;
ERROR_EMPTY_MUXWAIT : constant := 286;
ERROR_MUTEX_OWNED : constant := 287;
ERROR_NOT_OWNER : constant := 288;
ERROR_PARAM_TOO_SMALL : constant := 289;
ERROR_TOO_MANY_HANDLES : constant := 290;
ERROR_TOO_MANY_OPENS : constant := 291;
ERROR_WRONG_TYPE : constant := 292;
ERROR_UNUSED_CODE : constant := 293;
ERROR_THREAD_NOT_TERMINATED : constant := 294;
ERROR_INIT_ROUTINE_FAILED : constant := 295;
ERROR_MODULE_IN_USE : constant := 296;
ERROR_NOT_ENOUGH_WATCHPOINTS : constant := 297;
ERROR_TOO_MANY_POSTS : constant := 298;
ERROR_ALREADY_POSTED : constant := 299;
ERROR_ALREADY_RESET : constant := 300;
ERROR_SEM_BUSY : constant := 301;
ERROR_INVALID_PROCID : constant := 303;
ERROR_INVALID_PDELTA : constant := 304;
ERROR_NOT_DESCENDANT : constant := 305;
ERROR_NOT_SESSION_MANAGER : constant := 306;
ERROR_INVALID_PCLASS : constant := 307;
ERROR_INVALID_SCOPE : constant := 308;
ERROR_INVALID_THREADID : constant := 309;
ERROR_DOSSUB_SHRINK : constant := 310;
ERROR_DOSSUB_NOMEM : constant := 311;
ERROR_DOSSUB_OVERLAP : constant := 312;
ERROR_DOSSUB_BADSIZE : constant := 313;
ERROR_DOSSUB_BADFLAG : constant := 314;
ERROR_DOSSUB_BADSELECTOR : constant := 315;
ERROR_MR_MSG_TOO_LONG : constant := 316;
MGS_MR_MSG_TOO_LONG : constant := 316;
ERROR_MR_MID_NOT_FOUND : constant := 317;
ERROR_MR_UN_ACC_MSGF : constant := 318;
ERROR_MR_INV_MSGF_FORMAT : constant := 319;
ERROR_MR_INV_IVCOUNT : constant := 320;
ERROR_MR_UN_PERFORM : constant := 321;
ERROR_TS_WAKEUP : constant := 322;
ERROR_TS_SEMHANDLE : constant := 323;
ERROR_TS_NOTIMER : constant := 324;
ERROR_TS_HANDLE : constant := 326;
ERROR_TS_DATETIME : constant := 327;
ERROR_SYS_INTERNAL : constant := 328;
ERROR_QUE_CURRENT_NAME : constant := 329;
ERROR_QUE_PROC_NOT_OWNED : constant := 330;
ERROR_QUE_PROC_OWNED : constant := 331;
ERROR_QUE_DUPLICATE : constant := 332;
ERROR_QUE_ELEMENT_NOT_EXIST : constant := 333;
ERROR_QUE_NO_MEMORY : constant := 334;
ERROR_QUE_INVALID_NAME : constant := 335;
ERROR_QUE_INVALID_PRIORITY : constant := 336;
ERROR_QUE_INVALID_HANDLE : constant := 337;
ERROR_QUE_LINK_NOT_FOUND : constant := 338;
ERROR_QUE_MEMORY_ERROR : constant := 339;
ERROR_QUE_PREV_AT_END : constant := 340;
ERROR_QUE_PROC_NO_ACCESS : constant := 341;
ERROR_QUE_EMPTY : constant := 342;
ERROR_QUE_NAME_NOT_EXIST : constant := 343;
ERROR_QUE_NOT_INITIALIZED : constant := 344;
ERROR_QUE_UNABLE_TO_ACCESS : constant := 345;
ERROR_QUE_UNABLE_TO_ADD : constant := 346;
ERROR_QUE_UNABLE_TO_INIT : constant := 347;
ERROR_VIO_INVALID_MASK : constant := 349;
ERROR_VIO_PTR : constant := 350;
ERROR_VIO_APTR : constant := 351;
ERROR_VIO_RPTR : constant := 352;
ERROR_VIO_CPTR : constant := 353;
ERROR_VIO_LPTR : constant := 354;
ERROR_VIO_MODE : constant := 355;
ERROR_VIO_WIDTH : constant := 356;
ERROR_VIO_ATTR : constant := 357;
ERROR_VIO_ROW : constant := 358;
ERROR_VIO_COL : constant := 359;
ERROR_VIO_TOPROW : constant := 360;
ERROR_VIO_BOTROW : constant := 361;
ERROR_VIO_RIGHTCOL : constant := 362;
ERROR_VIO_LEFTCOL : constant := 363;
ERROR_SCS_CALL : constant := 364;
ERROR_SCS_VALUE : constant := 365;
ERROR_VIO_WAIT_FLAG : constant := 366;
ERROR_VIO_UNLOCK : constant := 367;
ERROR_SGS_NOT_SESSION_MGR : constant := 368;
ERROR_SMG_INVALID_SGID : constant := 369;
ERROR_SMG_INVALID_SESSION_ID : constant := 369;
ERROR_SMG_NOSG : constant := 370;
ERROR_SMG_NO_SESSIONS : constant := 370;
ERROR_SMG_GRP_NOT_FOUND : constant := 371;
ERROR_SMG_SESSION_NOT_FOUND : constant := 371;
ERROR_SMG_SET_TITLE : constant := 372;
ERROR_KBD_PARAMETER : constant := 373;
ERROR_KBD_NO_DEVICE : constant := 374;
ERROR_KBD_INVALID_IOWAIT : constant := 375;
ERROR_KBD_INVALID_LENGTH : constant := 376;
ERROR_KBD_INVALID_ECHO_MASK : constant := 377;
ERROR_KBD_INVALID_INPUT_MASK : constant := 378;
ERROR_MON_INVALID_PARMS : constant := 379;
ERROR_MON_INVALID_DEVNAME : constant := 380;
ERROR_MON_INVALID_HANDLE : constant := 381;
ERROR_MON_BUFFER_TOO_SMALL : constant := 382;
ERROR_MON_BUFFER_EMPTY : constant := 383;
ERROR_MON_DATA_TOO_LARGE : constant := 384;
ERROR_MOUSE_NO_DEVICE : constant := 385;
ERROR_MOUSE_INV_HANDLE : constant := 386;
ERROR_MOUSE_INV_PARMS : constant := 387;
ERROR_MOUSE_CANT_RESET : constant := 388;
ERROR_MOUSE_DISPLAY_PARMS : constant := 389;
ERROR_MOUSE_INV_MODULE : constant := 390;
ERROR_MOUSE_INV_ENTRY_PT : constant := 391;
ERROR_MOUSE_INV_MASK : constant := 392;
NO_ERROR_MOUSE_NO_DATA : constant := 393;
NO_ERROR_MOUSE_PTR_DRAWN : constant := 394;
ERROR_INVALID_FREQUENCY : constant := 395;
ERROR_NLS_NO_COUNTRY_FILE : constant := 396;
ERROR_NLS_OPEN_FAILED : constant := 397;
ERROR_NLS_NO_CTRY_CODE : constant := 398;
ERROR_NO_COUNTRY_OR_CODEPAGE : constant := 398;
ERROR_NLS_TABLE_TRUNCATED : constant := 399;
ERROR_NLS_BAD_TYPE : constant := 400;
ERROR_NLS_TYPE_NOT_FOUND : constant := 401;
ERROR_VIO_SMG_ONLY : constant := 402;
ERROR_VIO_INVALID_ASCIIZ : constant := 403;
ERROR_VIO_DEREGISTER : constant := 404;
ERROR_VIO_NO_POPUP : constant := 405;
ERROR_VIO_EXISTING_POPUP : constant := 406;
ERROR_KBD_SMG_ONLY : constant := 407;
ERROR_KBD_INVALID_ASCIIZ : constant := 408;
ERROR_KBD_INVALID_MASK : constant := 409;
ERROR_KBD_REGISTER : constant := 410;
ERROR_KBD_DEREGISTER : constant := 411;
ERROR_MOUSE_SMG_ONLY : constant := 412;
ERROR_MOUSE_INVALID_ASCIIZ : constant := 413;
ERROR_MOUSE_INVALID_MASK : constant := 414;
ERROR_MOUSE_REGISTER : constant := 415;
ERROR_MOUSE_DEREGISTER : constant := 416;
ERROR_SMG_BAD_ACTION : constant := 417;
ERROR_SMG_INVALID_CALL : constant := 418;
ERROR_SCS_SG_NOTFOUND : constant := 419;
ERROR_SCS_NOT_SHELL : constant := 420;
ERROR_VIO_INVALID_PARMS : constant := 421;
ERROR_VIO_FUNCTION_OWNED : constant := 422;
ERROR_VIO_RETURN : constant := 423;
ERROR_SCS_INVALID_FUNCTION : constant := 424;
ERROR_SCS_NOT_SESSION_MGR : constant := 425;
ERROR_VIO_REGISTER : constant := 426;
ERROR_VIO_NO_MODE_THREAD : constant := 427;
ERROR_VIO_NO_SAVE_RESTORE_THD : constant := 428;
ERROR_VIO_IN_BG : constant := 429;
ERROR_VIO_ILLEGAL_DURING_POPUP : constant := 430;
ERROR_SMG_NOT_BASESHELL : constant := 431;
ERROR_SMG_BAD_STATUSREQ : constant := 432;
ERROR_QUE_INVALID_WAIT : constant := 433;
ERROR_VIO_LOCK : constant := 434;
ERROR_MOUSE_INVALID_IOWAIT : constant := 435;
ERROR_VIO_INVALID_HANDLE : constant := 436;
ERROR_VIO_ILLEGAL_DURING_LOCK : constant := 437;
ERROR_VIO_INVALID_LENGTH : constant := 438;
ERROR_KBD_INVALID_HANDLE : constant := 439;
ERROR_KBD_NO_MORE_HANDLE : constant := 440;
ERROR_KBD_CANNOT_CREATE_KCB : constant := 441;
ERROR_KBD_CODEPAGE_LOAD_INCOMPL : constant := 442;
ERROR_KBD_INVALID_CODEPAGE_ID : constant := 443;
ERROR_KBD_NO_CODEPAGE_SUPPORT : constant := 444;
ERROR_KBD_FOCUS_REQUIRED : constant := 445;
ERROR_KBD_FOCUS_ALREADY_ACTIVE : constant := 446;
ERROR_KBD_KEYBOARD_BUSY : constant := 447;
ERROR_KBD_INVALID_CODEPAGE : constant := 448;
ERROR_KBD_UNABLE_TO_FOCUS : constant := 449;
ERROR_SMG_SESSION_NON_SELECT : constant := 450;
ERROR_SMG_SESSION_NOT_FOREGRND : constant := 451;
ERROR_SMG_SESSION_NOT_PARENT : constant := 452;
ERROR_SMG_INVALID_START_MODE : constant := 453;
ERROR_SMG_INVALID_RELATED_OPT : constant := 454;
ERROR_SMG_INVALID_BOND_OPTION : constant := 455;
ERROR_SMG_INVALID_SELECT_OPT : constant := 456;
ERROR_SMG_START_IN_BACKGROUND : constant := 457;
ERROR_SMG_INVALID_STOP_OPTION : constant := 458;
ERROR_SMG_BAD_RESERVE : constant := 459;
ERROR_SMG_PROCESS_NOT_PARENT : constant := 460;
ERROR_SMG_INVALID_DATA_LENGTH : constant := 461;
ERROR_SMG_NOT_BOUND : constant := 462;
ERROR_SMG_RETRY_SUB_ALLOC : constant := 463;
ERROR_KBD_DETACHED : constant := 464;
ERROR_VIO_DETACHED : constant := 465;
ERROR_MOU_DETACHED : constant := 466;
ERROR_VIO_FONT : constant := 467;
ERROR_VIO_USER_FONT : constant := 468;
ERROR_VIO_BAD_CP : constant := 469;
ERROR_VIO_NO_CP : constant := 470;
ERROR_VIO_NA_CP : constant := 471;
ERROR_INVALID_CODE_PAGE : constant := 472;
ERROR_CPLIST_TOO_SMALL : constant := 473;
ERROR_CP_NOT_MOVED : constant := 474;
ERROR_MODE_SWITCH_INIT : constant := 475;
ERROR_CODE_PAGE_NOT_FOUND : constant := 476;
ERROR_UNEXPECTED_SLOT_RETURNED : constant := 477;
ERROR_SMG_INVALID_TRACE_OPTION : constant := 478;
ERROR_VIO_INTERNAL_RESOURCE : constant := 479;
ERROR_VIO_SHELL_INIT : constant := 480;
ERROR_SMG_NO_HARD_ERRORS : constant := 481;
ERROR_CP_SWITCH_INCOMPLETE : constant := 482;
ERROR_VIO_TRANSPARENT_POPUP : constant := 483;
ERROR_CRITSEC_OVERFLOW : constant := 484;
ERROR_CRITSEC_UNDERFLOW : constant := 485;
ERROR_VIO_BAD_RESERVE : constant := 486;
ERROR_INVALID_ADDRESS : constant := 487;
ERROR_ZERO_SELECTORS_REQUESTED : constant := 488;
ERROR_NOT_ENOUGH_SELECTORS_AVA : constant := 489;
ERROR_INVALID_SELECTOR : constant := 490;
ERROR_SMG_INVALID_PROGRAM_TYPE : constant := 491;
ERROR_SMG_INVALID_PGM_CONTROL : constant := 492;
ERROR_SMG_INVALID_INHERIT_OPT : constant := 493;
ERROR_VIO_EXTENDED_SG : constant := 494;
ERROR_VIO_NOT_PRES_MGR_SG : constant := 495;
ERROR_VIO_SHIELD_OWNED : constant := 496;
ERROR_VIO_NO_MORE_HANDLES : constant := 497;
ERROR_VIO_SEE_ERROR_LOG : constant := 498;
ERROR_VIO_ASSOCIATED_DC : constant := 499;
ERROR_KBD_NO_CONSOLE : constant := 500;
ERROR_MOUSE_NO_CONSOLE : constant := 501;
ERROR_MOUSE_INVALID_HANDLE : constant := 502;
ERROR_SMG_INVALID_DEBUG_PARMS : constant := 503;
ERROR_KBD_EXTENDED_SG : constant := 504;
ERROR_MOU_EXTENDED_SG : constant := 505;
ERROR_SMG_INVALID_ICON_FILE : constant := 506;
ERROR_TRC_PID_NON_EXISTENT : constant := 507;
ERROR_TRC_COUNT_ACTIVE : constant := 508;
ERROR_TRC_SUSPENDED_BY_COUNT : constant := 509;
ERROR_TRC_COUNT_INACTIVE : constant := 510;
ERROR_TRC_COUNT_REACHED : constant := 511;
ERROR_NO_MC_TRACE : constant := 512;
ERROR_MC_TRACE : constant := 513;
ERROR_TRC_COUNT_ZERO : constant := 514;
ERROR_SMG_TOO_MANY_DDS : constant := 515;
ERROR_SMG_INVALID_NOTIFICATION : constant := 516;
ERROR_LF_INVALID_FUNCTION : constant := 517;
ERROR_LF_NOT_AVAIL : constant := 518;
ERROR_LF_SUSPENDED : constant := 519;
ERROR_LF_BUF_TOO_SMALL : constant := 520;
ERROR_LF_BUFFER_CORRUPTED : constant := 521;
ERROR_LF_BUFFER_FULL : constant := 521;
ERROR_LF_INVALID_DAEMON : constant := 522;
ERROR_LF_INVALID_RECORD : constant := 522;
ERROR_LF_INVALID_TEMPL : constant := 523;
ERROR_LF_INVALID_SERVICE : constant := 523;
ERROR_LF_GENERAL_FAILURE : constant := 524;
ERROR_LF_INVALID_ID : constant := 525;
ERROR_LF_INVALID_HANDLE : constant := 526;
ERROR_LF_NO_ID_AVAIL : constant := 527;
ERROR_LF_TEMPLATE_AREA_FULL : constant := 528;
ERROR_LF_ID_IN_USE : constant := 529;
ERROR_MOU_NOT_INITIALIZED : constant := 530;
ERROR_MOUINITREAL_DONE : constant := 531;
ERROR_DOSSUB_CORRUPTED : constant := 532;
ERROR_MOUSE_CALLER_NOT_SUBSYS : constant := 533;
ERROR_ARITHMETIC_OVERFLOW : constant := 534;
ERROR_TMR_NO_DEVICE : constant := 535;
ERROR_TMR_INVALID_TIME : constant := 536;
ERROR_PVW_INVALID_ENTITY : constant := 537;
ERROR_PVW_INVALID_ENTITY_TYPE : constant := 538;
ERROR_PVW_INVALID_SPEC : constant := 539;
ERROR_PVW_INVALID_RANGE_TYPE : constant := 540;
ERROR_PVW_INVALID_COUNTER_BLK : constant := 541;
ERROR_PVW_INVALID_TEXT_BLK : constant := 542;
ERROR_PRF_NOT_INITIALIZED : constant := 543;
ERROR_PRF_ALREADY_INITIALIZED : constant := 544;
ERROR_PRF_NOT_STARTED : constant := 545;
ERROR_PRF_ALREADY_STARTED : constant := 546;
ERROR_PRF_TIMER_OUT_OF_RANGE : constant := 547;
ERROR_PRF_TIMER_RESET : constant := 548;
ERROR_VDD_LOCK_USEAGE_DENIED : constant := 639;
ERROR_TIMEOUT : constant := 640;
ERROR_VDM_DOWN : constant := 641;
ERROR_VDM_LIMIT : constant := 642;
ERROR_VDD_NOT_FOUND : constant := 643;
ERROR_INVALID_CALLER : constant := 644;
ERROR_PID_MISMATCH : constant := 645;
ERROR_INVALID_VDD_HANDLE : constant := 646;
ERROR_VLPT_NO_SPOOLER : constant := 647;
ERROR_VCOM_DEVICE_BUSY : constant := 648;
ERROR_VLPT_DEVICE_BUSY : constant := 649;
ERROR_NESTING_TOO_DEEP : constant := 650;
ERROR_VDD_MISSING : constant := 651;
ERROR_BIDI_INVALID_LENGTH : constant := 671;
ERROR_BIDI_INVALID_INCREMENT : constant := 672;
ERROR_BIDI_INVALID_COMBINATION : constant := 673;
ERROR_BIDI_INVALID_RESERVED : constant := 674;
ERROR_BIDI_INVALID_EFFECT : constant := 675;
ERROR_BIDI_INVALID_CSDREC : constant := 676;
ERROR_BIDI_INVALID_CSDSTATE : constant := 677;
ERROR_BIDI_INVALID_LEVEL : constant := 678;
ERROR_BIDI_INVALID_TYPE_SUPPORT : constant := 679;
ERROR_BIDI_INVALID_ORIENTATION : constant := 680;
ERROR_BIDI_INVALID_NUM_SHAPE : constant := 681;
ERROR_BIDI_INVALID_CSD : constant := 682;
ERROR_BIDI_NO_SUPPORT : constant := 683;
NO_ERROR_BIDI_RW_INCOMPLETE : constant := 684;
ERROR_IMP_INVALID_PARM : constant := 691;
ERROR_IMP_INVALID_LENGTH : constant := 692;
MSG_HPFS_DISK_ERROR_WARN : constant := 693;
ERROR_MON_BAD_BUFFER : constant := 730;
ERROR_MODULE_CORRUPTED : constant := 731;
ERROR_SM_OUTOF_SWAPFILE : constant := 1477;
ERROR_LF_TIMEOUT : constant := 2055;
ERROR_LF_SUSPEND_SUCCESS : constant := 2057;
ERROR_LF_RESUME_SUCCESS : constant := 2058;
ERROR_LF_REDIRECT_SUCCESS : constant := 2059;
ERROR_LF_REDIRECT_FAILURE : constant := 2060;
ERROR_SWAPPER_NOT_ACTIVE : constant := 32768;
ERROR_INVALID_SWAPID : constant := 32769;
ERROR_IOERR_SWAP_FILE : constant := 32770;
ERROR_SWAP_TABLE_FULL : constant := 32771;
ERROR_SWAP_FILE_FULL : constant := 32772;
ERROR_CANT_INIT_SWAPPER : constant := 32773;
ERROR_SWAPPER_ALREADY_INIT : constant := 32774;
ERROR_PMM_INSUFFICIENT_MEMORY : constant := 32775;
ERROR_PMM_INVALID_FLAGS : constant := 32776;
ERROR_PMM_INVALID_ADDRESS : constant := 32777;
ERROR_PMM_LOCK_FAILED : constant := 32778;
ERROR_PMM_UNLOCK_FAILED : constant := 32779;
ERROR_PMM_MOVE_INCOMPLETE : constant := 32780;
ERROR_UCOM_DRIVE_RENAMED : constant := 32781;
ERROR_UCOM_FILENAME_TRUNCATED : constant := 32782;
ERROR_UCOM_BUFFER_LENGTH : constant := 32783;
ERROR_MON_CHAIN_HANDLE : constant := 32784;
ERROR_MON_NOT_REGISTERED : constant := 32785;
ERROR_SMG_ALREADY_TOP : constant := 32786;
ERROR_PMM_ARENA_MODIFIED : constant := 32787;
ERROR_SMG_PRINTER_OPEN : constant := 32788;
ERROR_PMM_SET_FLAGS_FAILED : constant := 32789;
ERROR_INVALID_DOS_DD : constant := 32790;
ERROR_BLOCKED : constant := 32791;
ERROR_NOBLOCK : constant := 32792;
ERROR_INSTANCE_SHARED : constant := 32793;
ERROR_NO_OBJECT : constant := 32794;
ERROR_PARTIAL_ATTACH : constant := 32795;
ERROR_INCACHE : constant := 32796;
ERROR_SWAP_IO_PROBLEMS : constant := 32797;
ERROR_CROSSES_OBJECT_BOUNDARY : constant := 32798;
ERROR_LONGLOCK : constant := 32799;
ERROR_SHORTLOCK : constant := 32800;
ERROR_UVIRTLOCK : constant := 32801;
ERROR_ALIASLOCK : constant := 32802;
ERROR_ALIAS : constant := 32803;
ERROR_NO_MORE_HANDLES : constant := 32804;
ERROR_SCAN_TERMINATED : constant := 32805;
ERROR_TERMINATOR_NOT_FOUND : constant := 32806;
ERROR_NOT_DIRECT_CHILD : constant := 32807;
ERROR_DELAY_FREE : constant := 32808;
ERROR_GUARDPAGE : constant := 32809;
ERROR_SWAPERROR : constant := 32900;
ERROR_LDRERROR : constant := 32901;
ERROR_NOMEMORY : constant := 32902;
ERROR_NOACCESS : constant := 32903;
ERROR_NO_DLL_TERM : constant := 32904;
ERROR_CPSIO_CODE_PAGE_INVALID : constant := 65026;
ERROR_CPSIO_NO_SPOOLER : constant := 65027;
ERROR_CPSIO_FONT_ID_INVALID : constant := 65028;
ERROR_CPSIO_INTERNAL_ERROR : constant := 65033;
ERROR_CPSIO_INVALID_PTR_NAME : constant := 65034;
ERROR_CPSIO_NOT_ACTIVE : constant := 65037;
ERROR_CPSIO_PID_FULL : constant := 65039;
ERROR_CPSIO_PID_NOT_FOUND : constant := 65040;
ERROR_CPSIO_READ_CTL_SEQ : constant := 65043;
ERROR_CPSIO_READ_FNT_DEF : constant := 65045;
ERROR_CPSIO_WRITE_ERROR : constant := 65047;
ERROR_CPSIO_WRITE_FULL_ERROR : constant := 65048;
ERROR_CPSIO_WRITE_HANDLE_BAD : constant := 65049;
ERROR_CPSIO_SWIT_LOAD : constant := 65074;
ERROR_CPSIO_INV_COMMAND : constant := 65077;
ERROR_CPSIO_NO_FONT_SWIT : constant := 65078;
ERROR_ENTRY_IS_CALLGATE : constant := 65079;
end Interfaces.OS2Lib.Errors;
|
programs/oeis/081/A081016.asm | karttu/loda | 0 | 16480 | ; A081016: a(n) = (Lucas(4*n+3) + 1)/5, or Fibonacci(2*n+1)*Fibonacci(2*n+2), or A081015(n)/5.
; 1,6,40,273,1870,12816,87841,602070,4126648,28284465,193864606,1328767776,9107509825,62423800998,427859097160,2932589879121,20100270056686,137769300517680,944284833567073,6472224534451830
add $0,1
lpb $0,1
sub $0,1
add $4,$3
add $1,$4
add $4,$1
add $1,1
mov $3,$2
add $3,$1
mul $3,2
add $4,$3
lpe
|
programs/boxes.asm | informer2016/MichalOS | 0 | 96108 | ; ------------------------------------------------------------------
; MichalOS Box Test
; ------------------------------------------------------------------
BITS 16
%INCLUDE "michalos.inc"
ORG 100h
start:
mov byte [0082h], 1
mov ax, 13h
int 10h
.loop:
mov ax, 0
mov bx, 15
call os_get_random
mov [.color], cl
mov bx, 199
call os_get_random
mov di, cx
call os_get_random
mov dx, cx
mov bx, 319
call os_get_random
mov si, cx
call os_get_random
mov al, [.color]
call os_draw_box
call os_check_for_key
cmp al, 27
jne .loop
mov ax, 3
int 10h
ret
.color db 0
; ------------------------------------------------------------------ |
programs/oeis/246/A246146.asm | neoneye/loda | 22 | 27239 | ; A246146: Limiting block extension of A010060 (Thue-Morse sequence) with first term as initial block.
; 0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0
mov $2,$0
add $0,256
add $2,18787
add $2,$0
lpb $2
trn $2,5
add $1,$2
div $2,2
lpe
mod $1,2
mov $0,$1
|
src/Deterministic.agda | nad/chi | 2 | 8014 | <reponame>nad/chi
------------------------------------------------------------------------
-- The semantics is deterministic
------------------------------------------------------------------------
open import Atom
module Deterministic (atoms : χ-atoms) where
open import Equality.Propositional
open import Prelude hiding (const)
open import Tactic.By.Propositional
open import Chi atoms
open χ-atoms atoms
Lookup-deterministic :
∀ {c₁ c₂ bs xs₁ xs₂ e₁ e₂} →
Lookup c₁ bs xs₁ e₁ → Lookup c₂ bs xs₂ e₂ →
c₁ ≡ c₂ → xs₁ ≡ xs₂ × e₁ ≡ e₂
Lookup-deterministic here here _ = refl , refl
Lookup-deterministic here (there q _) refl = ⊥-elim (q refl)
Lookup-deterministic (there p _) here refl = ⊥-elim (p refl)
Lookup-deterministic (there p₁ p₂) (there q₁ q₂) refl =
Lookup-deterministic p₂ q₂ refl
↦-deterministic :
∀ {e xs es e₁ e₂} →
e [ xs ← es ]↦ e₁ → e [ xs ← es ]↦ e₂ → e₁ ≡ e₂
↦-deterministic [] [] = refl
↦-deterministic (∷ p) (∷ q) = by (↦-deterministic p q)
mutual
⇓-deterministic : ∀ {e v₁ v₂} → e ⇓ v₁ → e ⇓ v₂ → v₁ ≡ v₂
⇓-deterministic (apply p₁ p₂ p₃) (apply q₁ q₂ q₃)
with ⇓-deterministic p₁ q₁ | ⇓-deterministic p₂ q₂
... | refl | refl = ⇓-deterministic p₃ q₃
⇓-deterministic (case p₁ p₂ p₃ p₄) (case q₁ q₂ q₃ q₄)
with ⇓-deterministic p₁ q₁
... | refl with Lookup-deterministic p₂ q₂ refl
... | refl , refl rewrite ↦-deterministic p₃ q₃ =
⇓-deterministic p₄ q₄
⇓-deterministic (rec p) (rec q) = ⇓-deterministic p q
⇓-deterministic lambda lambda = refl
⇓-deterministic (const ps) (const qs) = by (⇓⋆-deterministic ps qs)
⇓⋆-deterministic : ∀ {es vs₁ vs₂} → es ⇓⋆ vs₁ → es ⇓⋆ vs₂ → vs₁ ≡ vs₂
⇓⋆-deterministic [] [] = refl
⇓⋆-deterministic (p ∷ ps) (q ∷ qs) =
cong₂ _∷_ (⇓-deterministic p q) (⇓⋆-deterministic ps qs)
|
theorems/groups/SumOfSubIndicator.agda | timjb/HoTT-Agda | 294 | 6187 | {-# OPTIONS --without-K --rewriting #-}
open import HoTT
{- Maybe it is actually easier to prove [sum-subindicator]
and then derive the other lemma. -}
module groups.SumOfSubIndicator where
module _ {i} (G : Group i) where
open Group G
abstract
sum-ident : ∀ {I} (f : Fin I → El)
→ (∀ <I → f <I == ident)
→ sum f == ident
sum-ident {I = O} f z = idp
sum-ident {I = S I} f z =
ap2 comp
(sum-ident (f ∘ Fin-S) (z ∘ Fin-S))
(z (I , ltS))
∙ unit-l _
sum-subindicator : ∀ {I} (f : Fin I → El) <I*
→ (sub-indicator : ∀ {<I} → <I ≠ <I* → f <I == ident)
→ sum f == f <I*
sum-subindicator f (I , ltS) subind =
ap (λ g → comp g (f (I , ltS)))
(sum-ident (f ∘ Fin-S) (λ <I → subind (ltSR≠ltS <I)))
∙ unit-l _
sum-subindicator {I = S I} f (m , ltSR m<I) subind =
ap2 comp
(sum-subindicator (f ∘ Fin-S) (m , m<I) (subind ∘ Fin-S-≠))
(subind (ltS≠ltSR (m , m<I)))
∙ unit-r _
module _ {i j k} (G : Group i) {A : Type j} {B : Type k}
{I} (p : Fin I ≃ Coprod A B) (f : B → Group.El G) b*
(sub-indicator : ∀ {b} → b ≠ b* → f b == Group.ident G)
where
open Group G
abstract
private
sub-indicator' : ∀ {<I} → <I ≠ <– p (inr b*)
→ Coprod-rec (λ _ → ident) f (–> p <I) == ident
sub-indicator' {<I} <I≠p⁻¹b* =
Coprod-elim
{C = λ c → c ≠ inr b* → Coprod-rec (λ _ → ident) f c == ident}
(λ _ _ → idp)
(λ b inrb≠inrb* → sub-indicator (inrb≠inrb* ∘ ap inr))
(–> p <I) (<I≠p⁻¹b* ∘ equiv-adj p)
subsum-r-subindicator : subsum-r (–> p) f == f b*
subsum-r-subindicator =
sum-subindicator G
(Coprod-rec (λ _ → ident) f ∘ –> p)
(<– p (inr b*))
sub-indicator'
∙ ap (Coprod-rec (λ _ → ident) f) (<–-inv-r p (inr b*))
|
examples/outdated-and-incorrect/AIM6/Cat/lib/Data/Permutation.agda | asr/agda-kanso | 1 | 9115 |
module Data.Permutation where
open import Prelude
open import Data.Fin as Fin hiding (_==_; _<_)
open import Data.Nat
open import Data.Vec
open import Logic.Identity
open import Logic.Base
import Logic.ChainReasoning
-- What is a permutation?
-- Answer 1: A bijection between Fin n and itself
data Permutation (n : Nat) : Set where
permutation :
(π π⁻¹ : Fin n -> Fin n) ->
(forall {i} -> π (π⁻¹ i) ≡ i) ->
Permutation n
module Permutation {n : Nat}(P : Permutation n) where
private
π' : Permutation n -> Fin n -> Fin n
π' (permutation x _ _) = x
π⁻¹' : Permutation n -> Fin n -> Fin n
π⁻¹' (permutation _ x _) = x
proof : (P : Permutation n) -> forall {i} -> π' P (π⁻¹' P i) ≡ i
proof (permutation _ _ x) = x
π : Fin n -> Fin n
π = π' P
π⁻¹ : Fin n -> Fin n
π⁻¹ = π⁻¹' P
module Proofs where
ππ⁻¹-id : {i : Fin n} -> π (π⁻¹ i) ≡ i
ππ⁻¹-id = proof P
open module Chain = Logic.ChainReasoning.Poly.Homogenous _≡_ (\x -> refl) (\x y z -> trans)
π⁻¹-inj : (i j : Fin n) -> π⁻¹ i ≡ π⁻¹ j -> i ≡ j
π⁻¹-inj i j h =
chain> i
=== π (π⁻¹ i) by sym ππ⁻¹-id
=== π (π⁻¹ j) by cong π h
=== j by ππ⁻¹-id
-- Generalise
lem : {n : Nat}(f g : Fin n -> Fin n)
-> (forall i -> f (g i) ≡ i)
-> (forall i -> g (f i) ≡ i)
lem {zero} f g inv ()
lem {suc n} f g inv i = ?
where
gz≠gs : {i : Fin n} -> g fzero ≢ g (fsuc i)
gz≠gs {i} gz=gs = fzero≠fsuc $
chain> fzero
=== f (g fzero) by sym (inv fzero)
=== f (g (fsuc i)) by cong f gz=gs
=== fsuc i by inv (fsuc i)
z≠f-thin-gz : {i : Fin n} -> fzero ≢ f (thin (g fzero) i)
z≠f-thin-gz {i} z=f-thin-gz = ?
-- f (g fzero)
-- = fzero
-- = f (thin (g fzero) i)
g' : Fin n -> Fin n
g' j = thick (g fzero) (g (fsuc j)) gz≠gs
f' : Fin n -> Fin n
f' j = thick fzero (f (thin (g fzero) j)) ?
g'f' : forall j -> g' (f' j) ≡ j
g'f' = lem {n} f' g' ?
π⁻¹π-id : forall {i} -> π⁻¹ (π i) ≡ i
π⁻¹π-id = ?
-- Answer 2: A Vec (Fin n) n with no duplicates
{-
infixr 40 _◅_ _↦_,_
infixr 20 _○_
data Permutation : Nat -> Set where
ε : Permutation zero
_◅_ : {n : Nat} -> Fin (suc n) -> Permutation n -> Permutation (suc n)
_↦_,_ : {n : Nat}(i j : Fin (suc n)) -> Permutation n -> Permutation (suc n)
fzero ↦ j , π = j ◅ π
fsuc i ↦ j , j' ◅ π = thin j j' ◅ i ↦ ? , π
indices : {n : Nat} -> Permutation n -> Vec (Fin n) n
indices ε = []
indices (i ◅ π) = i :: map (thin i) (indices π)
-- permute (i ◅ π) xs with xs [!] i where
-- permute₁ (i ◅ π) .(insert i x xs) (ixV x xs) = x :: permute π xs
permute : {n : Nat}{A : Set} -> Permutation n -> Vec A n -> Vec A n
permute (i ◅ π) xs = permute' π i xs (xs [!] i)
where
permute' : {n : Nat}{A : Set} -> Permutation n -> (i : Fin (suc n))(xs : Vec A (suc n)) ->
IndexView i xs -> Vec A (suc n)
permute' π i .(insert i x xs') (ixV x xs') = x :: permute π xs'
delete : {n : Nat} -> Fin (suc n) -> Permutation (suc n) -> Permutation n
delete fzero (j ◅ π) = π
delete {zero} (fsuc ()) _
delete {suc _} (fsuc i) (j ◅ π) = ? ◅ delete i π
identity : {n : Nat} -> Permutation n
identity {zero } = ε
identity {suc n} = fzero ◅ identity
_⁻¹ : {n : Nat} -> Permutation n -> Permutation n
ε ⁻¹ = ε
(i ◅ π) ⁻¹ = ?
_○_ : {n : Nat} -> Permutation n -> Permutation n -> Permutation n
ε ○ π₂ = ε
i ◅ π₁ ○ π₂ = (indices π₂ ! i) ◅ (π₁ ○ delete i π₂)
-}
|
CO2008/W4/ex1.asm | Smithienious/hcmut-201 | 0 | 95498 | .data:
msg: .asciiz "Enter an integer: "
msg1: .ascii "The entered number is not positive, the sum is: "
# Start program code
.text:
.globl main
# int i = 1, sum = -1;
# while (i > 0)
# {
# sum += i;
# cout << "Enter an integer: ";
# cin >> i;
# }
# cout << "The entered number is not positive, the sum is: " << sum;
main:
# i : s0, sum : s1
addi $s0, $zero, 1 # int i = 1
addi $s1, $zero, -1 # int sum = -1
WHILE:
slt $t0, $zero, $s0 # while (i > 0)
bne $t0, 1, WEXIT
add $s1, $s1, $s0 # sum += i
li $v0, 4 # cout << "Enter an integer: "
la $a0, msg #
syscall #
li $v0, 5 # cin >> i
syscall #
move $s0, $v0 #
j WHILE
WEXIT:
# Print string msg1
li $v0, 4
la $a0, msg1
syscall
# Print sum
li $v0, 1
move $a0, $s1
syscall
# Exit
li $v0, 10
syscall
|
src/skill-field_types-plain_types.adb | skill-lang/adaCommon | 0 | 17297 | <reponame>skill-lang/adaCommon<filename>src/skill-field_types-plain_types.adb<gh_stars>0
-- ___ _ ___ _ _ --
-- / __| |/ (_) | | Common SKilL implementation --
-- \__ \ ' <| | | |__ implementation of builtin field types --
-- |___/_|\_\_|_|____| by: <NAME> --
-- --
pragma Ada_2012;
with Ada.Containers;
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Hashed_Sets;
with Ada.Containers.Vectors;
with Skill.Types;
with Skill.Hashes; use Skill.Hashes;
with Skill.Types.Pools;
with Ada.Tags;
package body Skill.Field_Types.Plain_Types is
procedure Write_Box
(This : access Field_Type;
Output : Streams.Writer.Sub_Stream;
Target : Types.Box)
is
begin
Write_Single (Output, Unboxed (Target));
end Write_Box;
end Skill.Field_Types.Plain_Types;
|
libsrc/_DEVELOPMENT/l/sdcc/__sdcc_exit_div_64.asm | jpoikela/z88dk | 640 | 172101 | <gh_stars>100-1000
SECTION code_clib
SECTION code_l_sdcc
PUBLIC __sdcc_exit_div_64
__sdcc_exit_div_64:
ex af,af'
ld e,(ix-2)
ld d,(ix-1) ; de = quotient *
push ix
pop hl ; hl = & quotient
ld bc,8
ldir ; copy quotient to result
ex af,af'
pop ix ; restore ix
ret
|
bahamut/source/character-map.asm | higan-emu/bahamut-lagoon-translation-kit | 2 | 7291 | namespace character {
seek(codeCursor)
//converts character in A from text index into font index
//A => encoded character
//A <= decoded character
macro decode() {
php; rep #$30; phx
and #$00ff; tax
lda character.decoder,x; and #$00ff
plx; plp
}
//converts character in A from font index into text index
//A => decoded character
//A <= encoded character
macro encode() {
php; rep #$30; phx
and #$00ff; tax
lda character.encoder,x; and #$00ff
plx; plp
}
//[A-Z][0-9][space] are kept in the same locations as the Japanese font
decoder: {
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 //0
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 //1
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 //2
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 //3
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 //4
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 //5
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 //6
db $00,$00,$00,$00,$1b,$1c,$1d,$1e,$1f,$20,$21,$22,$23,$24,$25,$26 //7
db $27,$28,$29,$2a,$2b,$2c,$2d,$2e,$2f,$30,$31,$32,$33,$34,$40,$41 //8
db $42,$43,$44,$45,$46,$47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f,$50,$51 //9
db $52,$53,$54,$55,$56,$57,$58,$59,$5a,$5b,$5c,$5d,$5e,$5f,$35,$36 //a
db $37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f,$01,$02,$03,$04,$05,$06,$07 //b
db $08,$09,$0a,$0b,$0c,$0d,$0e,$0f,$10,$11,$12,$13,$14,$15,$16,$17 //c
db $18,$19,$1a,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 //d
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 //e
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 //f
}
encoder: {
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f
db $ef,$b9,$ba,$bb,$bc,$bd,$be,$bf,$c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7 //0
db $c8,$c9,$ca,$cb,$cc,$cd,$ce,$cf,$d0,$d1,$d2,$74,$75,$76,$77,$78 //1
db $79,$7a,$7b,$7c,$7d,$7e,$7f,$80,$81,$82,$83,$84,$85,$86,$87,$88 //2
db $89,$8a,$8b,$8c,$8d,$ae,$af,$b0,$b1,$b2,$b3,$b4,$b5,$b6,$b7,$b8 //3
db $8e,$8f,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$9a,$9b,$9c,$9d //4
db $9e,$9f,$a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8,$a9,$aa,$ab,$ac,$ad //5
db $ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef //6
db $ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef //7
db $ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef //8
db $ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef //9
db $ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef //a
db $ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef //b
db $ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef //c
db $ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef //d
db $ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef //e
db $ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef,$ef //f
}
codeCursor = pc()
}
map ' ', $ef
map 'A', $b9
map 'B', $ba
map 'C', $bb
map 'D', $bc
map 'E', $bd
map 'F', $be
map 'G', $bf
map 'H', $c0
map 'I', $c1
map 'J', $c2
map 'K', $c3
map 'L', $c4
map 'M', $c5
map 'N', $c6
map 'O', $c7
map 'P', $c8
map 'Q', $c9
map 'R', $ca
map 'S', $cb
map 'T', $cc
map 'U', $cd
map 'V', $ce
map 'W', $cf
map 'X', $d0
map 'Y', $d1
map 'Z', $d2
map 'a', $74
map 'b', $75
map 'c', $76
map 'd', $77
map 'e', $78
map 'f', $79
map 'g', $7a
map 'h', $7b
map 'i', $7c
map 'j', $7d
map 'k', $7e
map 'l', $7f
map 'm', $80
map 'n', $81
map 'o', $82
map 'p', $83
map 'q', $84
map 'r', $85
map 's', $86
map 't', $87
map 'u', $88
map 'v', $89
map 'w', $8a
map 'x', $8b
map 'y', $8c
map 'z', $8d
map '-', $ae
map '0', $af
map '1', $b0
map '2', $b1
map '3', $b2
map '4', $b3
map '5', $b4
map '6', $b5
map '7', $b6
map '8', $b7
map '9', $b8
map '.', $8e
map ',', $8f
map '?', $90
map '!', $91
map '\'',$92
map '\"',$93
map ':', $94
map ';', $95
map '*', $96
map '+', $97
map '/', $98
map '(', $99
map ')', $9a
map '^', $9b //en-question
map '~', $9c //en-dash
map '_', $9d //en-space
map '%', $9e
map '<', command.styleItalic
map '>', command.styleNormal
map '[', command.colorYellow
map ']', command.colorNormal
map '@', command.alignCenter
map '#', command.alignRight
map '\n',command.lineFeed
map '$', command.terminal
namespace map {
constant umlautA = $9f
constant umlautO = $a0
constant umlautU = $a1
constant hexA = $a2
constant hexB = $a3
constant hexC = $a4
constant hexD = $a5
constant hexE = $a6
constant hexF = $a7
constant reserved0 = $a8
constant reserved1 = $a9
constant reserved2 = $aa
constant windowBorder = $ab //8x8 font only
constant arrowIncrease = $ac //8x8 font only
constant arrowDecrease = $ad //8x8 font only
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.