max_stars_repo_path stringlengths 4 261 | max_stars_repo_name stringlengths 6 106 | max_stars_count int64 0 38.8k | id stringlengths 1 6 | text stringlengths 7 1.05M |
|---|---|---|---|---|
programs/oeis/087/A087055.asm | karttu/loda | 0 | 163657 | <reponame>karttu/loda
; A087055: Largest square number less than 2*n^2.
; 1,4,16,25,49,64,81,121,144,196,225,256,324,361,441,484,576,625,676,784,841,961,1024,1089,1225,1296,1444,1521,1681,1764,1849,2025,2116,2304,2401,2500,2704,2809,3025,3136,3249,3481,3600,3844,3969,4225,4356,4489,4761,4900,5184,5329,5476,5776,5929,6241,6400,6724,6889,7056,7396,7569,7921,8100,8281,8649,8836,9216,9409,9604,10000,10201,10609,10816,11236,11449,11664,12100,12321,12769,12996,13225,13689,13924,14400,14641,15129,15376,15625,16129,16384,16900,17161,17424,17956,18225,18769,19044,19600,19881,20164,20736,21025,21609,21904,22201,22801,23104,23716,24025,24336,24964,25281,25921,26244,26896,27225,27556,28224,28561,29241,29584,29929,30625,30976,31684,32041,32761,33124,33489,34225,34596,35344,35721,36100,36864,37249,38025,38416,38809,39601,40000,40804,41209,42025,42436,42849,43681,44100,44944,45369,45796,46656,47089,47961,48400,49284,49729,50176,51076,51529,52441,52900,53361,54289,54756,55696,56169,57121,57600,58081,59049,59536,60516,61009,61504,62500,63001,64009,64516,65025,66049,66564,67600,68121,69169,69696,70225,71289,71824,72900,73441,73984,75076,75625,76729,77284,78400,78961,79524,80656,81225,82369,82944,83521,84681,85264,86436,87025,87616,88804,89401,90601,91204,92416,93025,93636,94864,95481,96721,97344,97969,99225,99856,101124,101761,103041,103684,104329,105625,106276,107584,108241,108900,110224,110889,112225,112896,113569,114921,115600,116964,117649,119025,119716,120409,121801,122500,123904,124609
add $0,1
pow $0,2
lpb $0,1
add $1,1
sub $0,$1
lpe
pow $1,2
|
src/mathlib.asm | secworks/prince_6502 | 0 | 6905 | <reponame>secworks/prince_6502<gh_stars>0
//======================================================================
//
// mathlib.asm
// -----------
// Library providing 32- and 64-bit integer operations as needed
// by PRINCE, SipHash etc.
//
//
// Copyright (c) 2020, Assured AB
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or
// without modification, are permitted provided that the following
// conditions are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in
// the documentation and/or other materials provided with the
// distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//======================================================================
#importonce
//------------------------------------------------------------------
// rol64bits(addr, bits)
//
// Macro to rotate 64 bit word, bits number of steps.
//
//------------------------------------------------------------------
.macro rol64bits(addr, bits)
{
ldy #bits
rol64_1: lda addr
rol
rol addr + 7
rol addr + 6
rol addr + 5
rol addr + 4
rol addr + 3
rol addr + 2
rol addr + 1
rol addr
dey
bne rol64_1
}
//------------------------------------------------------------------
// ror64bits(addr, bits)
//
// Macro to rotate a 64 bit word, bits number of steps right.
//------------------------------------------------------------------
.macro ror64bits(addr, bits)
{
ldy #bits
ror64_1: lda addr + 7
ror
ror addr
ror addr + 1
ror addr + 2
ror addr + 3
ror addr + 4
ror addr + 5
ror addr + 6
ror addr + 7
dey
bne ror64_1
}
//------------------------------------------------------------------
// rol13(addr)
//
// Macro to rotate a 64 bit word, 13 bits left.
// We do this by moving 16 bits left and then 3 bits right.
// TODO: Implement.
//------------------------------------------------------------------
.macro rol13(addr)
{
:rol16(addr)
:ror64bits(addr, 3)
}
//------------------------------------------------------------------
// rol16(addr)
//
// Macro to rotate a 64 bit word, 16 bits left.
// We do this by moving the bytes two steps.
//------------------------------------------------------------------
.macro rol16(addr)
{
lda addr
sta tmp
lda addr + 1
sta tmp + 1
ldx #$00
rol16_1: lda addr + 2, x
sta addr, x
inx
cpx #$07
bne rol16_1
lda tmp
sta addr + 6
lda tmp + 1
sta addr + 7
}
//------------------------------------------------------------------
// rol17(addr)
//
// Macro to rotate a 64 bit word, 17 bits left.
// We do this by moving 2 bytes left and then rotating 1 bit left.
//------------------------------------------------------------------
.macro rol17(addr)
{
:rol16(addr)
:rol64bits(addr, 1)
}
//------------------------------------------------------------------
// rol21(addr)
//
// Macro to rotate a 64 bit word, 21 bits left.
// We do this by moving 3 bytes left and rotating 3 bits right.
//------------------------------------------------------------------
.macro rol21(addr)
{
// Move three bytes left.
// Using tmp
ldx #$02
rol21_1: lda addr, x
sta tmp, x
dex
bpl rol21_1
ldx #$00
rol21_2: lda addr + 3, x
sta addr,x
inx
cpx #$07
bne rol21_2
ldx #$02
rol21_3: lda tmp, x
sta addr + 5, x
dex
bpl rol21_3
:ror64bits(addr, 3)
}
//------------------------------------------------------------------
// rol32(addr)
//
// Macro to rotate a 64 bit word, 32 bits left.
// We do this by moving 32 bits left via the temp bytes.
//------------------------------------------------------------------
.macro rol32(addr)
{
ldx #$03
rol32_1: lda addr, x
sta tmp, x
lda addr+4, x
sta addr, x
lda tmp, x
sta addr + 4, x
dex
bpl rol32_1
}
//------------------------------------------------------------------
// xor64(addr0, addr1)
//
// Macro to rotate 64 bit word bits number of steps.
//------------------------------------------------------------------
.macro xor64(addr0, addr1)
{
ldx #$07
xor64_1: lda addr0, x
eor addr1, x
sta addr0, x
dex
bpl xor64_1
}
//------------------------------------------------------------------
// add64(addr0, addr1)
//
// Macro to add two 64 bit words. Results in addr0.
//------------------------------------------------------------------
.macro add64(addr0, addr1)
{
ldx #$07
clc
add64_1: lda addr0, x
adc addr1, x
sta addr0, x
dex
bpl add64_1
}
//------------------------------------------------------------------
// mov64(addr0, addr1)
//
// Macro to move 64 bit word in addr1 into addr0
//------------------------------------------------------------------
.macro mov64(addr0, addr1)
{
ldx #$07
clc
mov64_1: lda addr1, x
sta addr0, x
dex
bpl mov64_1
}
//======================================================================
// EOF mathlib.asm
//======================================================================
|
Transynther/x86/_processed/P/_zr_/i3-7100_9_0xca_notsx.log_2_677.asm | ljhsiun2/medusa | 9 | 167830 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xa885, %r11
inc %rax
movups (%r11), %xmm4
vpextrq $0, %xmm4, %r12
nop
nop
nop
nop
nop
inc %rbp
lea addresses_WC_ht+0x19d8d, %r14
nop
nop
xor %rcx, %rcx
mov (%r14), %esi
nop
nop
xor $35056, %rax
lea addresses_D_ht+0x143df, %rsi
lea addresses_A_ht+0x1de0d, %rdi
nop
nop
nop
nop
nop
and $30112, %r12
mov $123, %rcx
rep movsl
nop
and %rax, %rax
lea addresses_UC_ht+0x6b0d, %rsi
lea addresses_A_ht+0x300d, %rdi
nop
nop
nop
nop
nop
and $11948, %rax
mov $55, %rcx
rep movsq
nop
nop
and %r11, %r11
lea addresses_WT_ht+0x1440d, %rcx
nop
xor $65178, %r12
movw $0x6162, (%rcx)
nop
nop
nop
nop
nop
add $2645, %rcx
lea addresses_A_ht+0x19e0d, %r12
nop
nop
nop
nop
inc %rsi
movups (%r12), %xmm6
vpextrq $0, %xmm6, %rbp
nop
nop
nop
nop
nop
xor $55908, %rcx
lea addresses_WC_ht+0x1be0d, %rcx
nop
nop
nop
nop
nop
add $44379, %r14
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
movups %xmm3, (%rcx)
nop
nop
nop
cmp %rax, %rax
lea addresses_A_ht+0x3b4d, %rsi
lea addresses_D_ht+0x1b3c5, %rdi
clflush (%rdi)
xor %r14, %r14
mov $21, %rcx
rep movsq
nop
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_normal_ht+0x15e0d, %rcx
nop
nop
add $29331, %rax
mov (%rcx), %r12w
nop
nop
inc %r11
lea addresses_A_ht+0xa643, %rax
clflush (%rax)
nop
nop
nop
nop
add $24124, %rsi
movb $0x61, (%rax)
nop
nop
nop
inc %rsi
lea addresses_UC_ht+0x12559, %r12
nop
nop
nop
nop
nop
sub $57789, %r11
mov $0x6162636465666768, %rbp
movq %rbp, %xmm4
vmovups %ymm4, (%r12)
nop
nop
cmp %r11, %r11
lea addresses_D_ht+0xe0d, %r12
nop
nop
nop
nop
nop
dec %rbp
mov (%r12), %di
nop
nop
nop
nop
dec %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r8
push %rbx
push %rdi
// Faulty Load
mov $0xe0d, %r12
nop
nop
add $50123, %r14
movups (%r12), %xmm7
vpextrq $1, %xmm7, %rbx
lea oracles, %r8
and $0xff, %rbx
shlq $12, %rbx
mov (%r8,%rbx,1), %rbx
pop %rdi
pop %rbx
pop %r8
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_P', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_P', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}}
{'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'00': 2}
00 00
*/
|
src/TemporalOps/Diamond/Functor.agda | DimaSamoz/temporal-type-systems | 4 | 7939 | <reponame>DimaSamoz/temporal-type-systems
{- Diamond operator. -}
module TemporalOps.Diamond.Functor where
open import CategoryTheory.Categories
open import CategoryTheory.Instances.Reactive
open import CategoryTheory.Functor
open import TemporalOps.Common
open import TemporalOps.Next
open import TemporalOps.Delay
open import Data.Product
-- Arbitrary delay
◇_ : τ -> τ
(◇ A) n = Σ[ k ∈ ℕ ] (delay A by k at n)
infixr 65 ◇_
-- ◇ instances
F-◇ : Endofunctor ℝeactive
F-◇ = record
{ omap = ◇_
; fmap = fmap-◇
; fmap-id = fmap-◇-id
; fmap-∘ = fmap-◇-∘
; fmap-cong = fmap-◇-cong
}
where
-- Lifting of ◇
fmap-◇ : {A B : τ} -> A ⇴ B -> ◇ A ⇴ ◇ B
fmap-◇ f n (k , v) = k , (Functor.fmap (F-delay k) f at n) v
-- ◇ preserves identities
fmap-◇-id : ∀ {A : τ} {n : ℕ} {a : (◇ A) n}
-> (fmap-◇ (id {A}) at n) a ≡ a
fmap-◇-id {A} {n} {zero , v} = refl
fmap-◇-id {A} {zero} {suc k , v} = refl
fmap-◇-id {A} {suc n} {suc k , v}
rewrite delay-+ {A} 1 k n
| Functor.fmap-id (F-delay (suc k)) {A} {suc n} {v}
= refl
-- ◇ preserves composition
fmap-◇-∘ : ∀ {A B C : τ} {g : B ⇴ C} {f : A ⇴ B} {n : ℕ} {a : (◇ A) n}
-> (fmap-◇ (g ∘ f) at n) a ≡ (fmap-◇ g ∘ fmap-◇ f at n) a
fmap-◇-∘ {n = n} {zero , v} = refl
fmap-◇-∘ {n = zero} {suc k , v} = refl
fmap-◇-∘ {A} {B} {C} {g} {f} {suc n} {suc k , v}
rewrite delay-+ {A} 1 k n
| Functor.fmap-∘ (F-delay (suc k)) {A} {B} {C} {g} {f} {suc n} {v}
= refl
-- ▹ is congruent
fmap-◇-cong : ∀{A B : τ} {f f′ : A ⇴ B}
-> ({n : ℕ} {a : A at n} -> f n a ≡ f′ n a)
-> ({n : ℕ} {a : ◇ A at n} -> (fmap-◇ f at n) a
≡ (fmap-◇ f′ at n) a)
fmap-◇-cong {A} e {n} {zero , a}
rewrite delay-+-left0 {A} 0 n
| e {n} {a} = refl
fmap-◇-cong e {zero} {suc k , a} = refl
fmap-◇-cong {A} {B} {f} {f′} e {suc n} {suc k , a}
rewrite delay-+ {A} 1 k n
| Functor.fmap-cong (F-delay (suc k)) {A} {B} {f} {f′} e {suc n} {a}
= refl
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1245.asm | ljhsiun2/medusa | 9 | 167204 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xb01c, %rsi
lea addresses_WC_ht+0x1c79c, %rdi
nop
nop
nop
nop
mfence
mov $108, %rcx
rep movsl
nop
nop
nop
xor $23976, %r14
lea addresses_UC_ht+0x7814, %r13
clflush (%r13)
nop
sub $4332, %rax
movw $0x6162, (%r13)
nop
nop
dec %r10
lea addresses_A_ht+0x11ccc, %rsi
lea addresses_A_ht+0x1bd1c, %rdi
nop
nop
xor $7745, %rdx
mov $102, %rcx
rep movsq
nop
sub $20599, %rsi
lea addresses_normal_ht+0x19edc, %rsi
lea addresses_normal_ht+0x102f0, %rdi
nop
nop
and $14624, %rax
mov $95, %rcx
rep movsb
add %rax, %rax
lea addresses_A_ht+0xa477, %rcx
nop
mfence
vmovups (%rcx), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %r10
nop
nop
nop
nop
add %rsi, %rsi
lea addresses_D_ht+0x130dc, %rsi
lea addresses_A_ht+0x401c, %rdi
nop
nop
nop
nop
and %r13, %r13
mov $110, %rcx
rep movsb
nop
nop
nop
nop
nop
sub $50562, %rdx
lea addresses_D_ht+0x15bc2, %r14
nop
nop
nop
nop
nop
xor $13971, %r10
movw $0x6162, (%r14)
nop
nop
nop
xor $32475, %r13
lea addresses_UC_ht+0x11e9c, %rdx
nop
nop
sub $28401, %r13
movb $0x61, (%rdx)
nop
nop
nop
cmp %rdx, %rdx
lea addresses_WT_ht+0x7706, %rsi
lea addresses_A_ht+0x14c1c, %rdi
nop
nop
nop
nop
add %rax, %rax
mov $47, %rcx
rep movsw
nop
nop
xor %r14, %r14
lea addresses_D_ht+0x1ac7c, %rsi
lea addresses_UC_ht+0x1210c, %rdi
sub %r10, %r10
mov $80, %rcx
rep movsl
nop
nop
nop
nop
sub %rax, %rax
lea addresses_A_ht+0x1401c, %rdi
nop
nop
nop
nop
cmp $58735, %rdx
mov $0x6162636465666768, %r10
movq %r10, (%rdi)
xor $19264, %r14
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r15
push %r8
push %r9
push %rax
push %rcx
push %rdi
// Load
lea addresses_D+0x939c, %rdi
nop
sub %r15, %r15
movb (%rdi), %r9b
nop
cmp %r15, %r15
// Faulty Load
lea addresses_PSE+0x9e1c, %r9
nop
nop
nop
nop
nop
inc %r8
vmovups (%r9), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $1, %xmm2, %r15
lea oracles, %r9
and $0xff, %r15
shlq $12, %r15
mov (%r9,%r15,1), %r15
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r15
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_PSE', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 5}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_PSE', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': True, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 1}, 'dst': {'same': True, 'type': 'addresses_A_ht', 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
polynomial/clenshaw/clenshaw.ads | jscparker/math_packages | 30 | 22981 | <filename>polynomial/clenshaw/clenshaw.ads
-- package Clenshaw
--
-- Clenshaw's formula is used to evaluate functions Q_k (X), and
-- summations over functions Q_k (X), where the functions Q_k (X)
-- are defined by recurrance relations of the sort:
--
-- Q_0 = some given function of X
-- Q_1 = Alpha(1, X) * Q_0(X)
-- Q_k = Alpha(k, X) * Q_k-1(X) + Beta(k, X) * Q_k-2(X) (k > 1)
--
-- The procedure "Sum" evaluates the sum
-- n
-- F_n(X) = SUM ( C_k * Q_k(X) )
-- k=0
--
-- where the coefficients C_k are given quantities, like Alpha, Beta, Q_0, Q_1.
-- Procedure "Evaluate_Qs" calculates the function Q_k, a special case
-- of the sum above. Clenshaw's method is usually more accurate and less
-- unstable than direct summations of F_n.
--
-- The most common application of this algorithm is in the construction
-- of orthogonal polynomials and their sums. But notice that the functions
-- functions Q_k need not be orthogonal, and they need not be polynomials.
-- In most cases, though, the Q_k are orthogonal polynomials.
-- Common cases are Hermite, Laguerre, Chebychev, Legendre,
-- and Gegenbauer polynomials.
--
-- WARNING:
--
-- These functions are not the same as the Gram-Schmidt polynomials.
-- Gram-Schmidt polys are orthogonal on a discrete set of points, and
-- form a complete for function defined on that discrete set of points.
-- The orthogonality of the following functions is respect integration on
-- an interval, not summation over a discrete set of points. So these
-- functions don't form a complete set on a discrete set of points
-- (unlike the discrete polys generated by a gram-schmidt method, or
-- the sinusoids in a discrete Fourier transform.)
--
-- EXAMPLES.
--
-- Chebychev Polynomials of the first kind:
-- Q_0(X) = 1
-- Q_1(X) = X
-- Q_k(X) = 2X*Q_k-1(X) - Q_k-2(X) (k > 1)
-- Alpha(k,X) = 2*X (k > 1)
-- Alpha(k,X) = X (k = 1)
-- Beta(k,X) = -1
-- They are orthogonal on the interval (-1,1) with
-- weight function W(X) = 1.0 / SQRT(1 - X*X).
-- Normalizing integral: Integral(Q_n(X) * Q_n(X) * W(X)) = Pi/2 for n>0
-- Normalizing integral: Integral(Q_n(X) * Q_n(X) * W(X)) = Pi for n=0
--
-- Chebychev Polynomials of the 2nd kind:
-- Q_0(X) = 1
-- Q_1(X) = 2*X
-- Q_k(X) = 2X*Q_k-1(X) - Q_k-2(X)
-- Alpha(k,X) = 2*X
-- Beta(k,X) = -1
-- They are orthogonal on the interval (-1,1) with
-- weight function W(X) = SQRT(1 - X*X).
-- Normalizing integral: Integral(Q_n(X) * Q_n(X) * W(X)) = Pi/2
--
-- Legendre: Q_0(X) = 1
-- Q_1(X) = X
-- Q_k(X) = ((2*k-1)/k)*X*Q_k-1(X) - ((k-1)/k)*Q_k-2(X)
-- Alpha(k,X) = X*(2*k-1)/k
-- Beta(k,X) = -(k-1)/k
-- They are orthogonal on the interval [-1,1] with
-- weight function W(X) = 1.
-- Normalizing integral: Integral(Q_n(X) * Q_n(X) * W(X)) = 2/(2n+1)
--
-- Associated Legendre(m, k): ( k must be greater than m-1 )
-- Q_m(X) = (-1)**m * (2m-1)!! * Sqrt(1-X*X)**m
-- Q_m+1(X) = X * (2*m + 1) * Q_m(X)
-- Q_k(X) = ((2*k-1)/(k-m))*X*Q_k-1(X) - ((k-1+m)/(k-m))*Q_k-2(X)
-- Alpha(k,X) = X*(2*k-1)/(k-m)
-- Beta(k,X) = -(k-1+m)/k
-- They are orthogonal on the interval [-1,1] with
-- weight function W(X) = 1.
-- Normalizing integral:
-- Integral(Q_n(X) * Q_n(X) * W(X)) = 2*(n+m)! / (2*n+1)*(n-m)!)
--
-- Hermite: Q_0(X) = 1
-- Q_1(X) = 2*X
-- Q_k(X) = 2*X*Q_k-1(X) - 2*(k-1)*Q_k-2(X)
-- Alpha(k,X) = 2*X
-- Beta(k,X) = -2*(k-1)
-- They are orthogonal on the interval (-infinity, infinity) with
-- weight function W(X) = Exp (-X*X).
-- Normalizing integral: Integral (Q_n(X)*Q_n(X)*W(X)) = n!(2**n)*Sqrt(Pi)
--
-- Laguerre: Q_0(X) = 1
-- Q_1(X) = 1 - X
-- Q_k(X) = (2*k - 1 - X)*Q_k-1(X) - (k-1)*(k-1)*Q_k-2(X)
-- Alpha(k,X) = 2*k - 1 - X
-- Beta(k,X) = -(k-1)*(k-1)
-- They are orthogonal on the interval (0,infinity) with
-- weight function Exp(-X).
-- Normalizing integral: Integral (Q_n(X)*Q_n(X)*W(X)) = Gamma(n+1)/n!
--
-- Generalized Laguerre:
-- Q_0(X) = 1
-- Q_1(X) = 1 - X
-- Q_k(X) = ((2*k-1+a-X)/k)*Q_k-1(X) - ((k-1+a)/k)*Q_k-2(X)
-- Alpha(k,X) = (2*k - 1 + a - X) / k
-- Beta(k,X) = -(k - 1 + a) / k
-- They are orthogonal on the interval (0,infinity) with
-- weight function W(X) = (X**a)*Exp(-X).
-- Normalizing integral: Integral (Q_n(X)*Q_n(X)*W(X)) = Gamma(n+a+1)/n!
--
--
-- procedure Evaluate_Qs
--
-- The procedure calculates the value of functions Q_k at points
-- X for each k in 0..Poly_ID. These are returned in the array
-- Q in the range 0..PolyID.
--
-- In most cases only the value of Q_k (X) at k = Poly_ID is desired. This
-- is returned as Q(k), where k = Poly_ID, the ID of the desired function.
-- The values of the other Q's are returned (in the same array
-- Q, at the appropriate index) because they are calculated along the
-- way, and may be useful also.
--
-- WARNING:
--
-- The functions Q_k generated by this routine are usually
-- *un-normalized*. Frequently, values of the normalized Q_k
-- are desired. The normalization factors are not given
-- by this package. They are given in most cases by the
-- procedures that use this package, and by standard reference
-- sources. These factors are usually k dependent, so you
-- must multiply each element of Q(1..Poly_ID) by a different
-- number to get an array of values of the normalized functions.
--
-- function Sum
--
-- This function sums the functions Q_k (at X) with coefficients given
-- by the array C. The result is returned as the function value.
-- This function is also a fast and efficient way of getting the
-- value of Q_k at X. Just let C = 0 everywhere, except at k. Let
-- the of C at k be C(k) = 1.0. then the function returns Q_k(X).
--
-- Notes on the algorithm.
--
-- We want to evaluate
-- n
-- F_n(X) = SUM ( C_k * Q_k(X) )
-- k=0
--
-- where Q is defined by
--
-- Q_k = Alpha(k, X) * Q_k-1 + Beta(k, X) * Q_k-2 (k > 1)
--
-- This package calculates F_n by the following formula
--
-- (*) F_n(X) = D_0*Q_0(X) + D_1*(Q_1(X) - Alpha(1,X)*Q_0(X)).
--
-- where the D_k are functions of X that satisfy:
--
-- D_n+2 = 0
-- D_n+1 = 0
-- D_k = C_k + Alpha(k+1,X) * D_k+1(X) + Beta(k+2,X) * D_k+2(X)
--
-- The proof of (*) is straightforward. Solve for C_k in the equation for
-- D_k above and plug it into the sum that defines F_n to get
--
-- n
-- F_n = SUM (D_k - Alpha(k+1)*D_k+1 - Beta(k+1)*D_k+2 ) * Q_k
-- k=0
-- n
-- F_n = D_0*Q_0 + D_1*Q_1 + SUM ( D_k * Q_k )
-- k=2
-- n
-- -Alpha(1)*D_1*Q_0 + SUM (-Alpha(k) * D_k * Q_k-1 )
-- k=2
-- n
-- + SUM (-Beta(k) * D_k * Q_k-2 ).
-- k=2
--
-- Now factor out D_k from the three SUM terms above, and notice
-- that what remains is just the recurrance relation that defines
-- Q_k for k > 0. It evaluates to zero, leaving
--
-- F_n(X) = D_0*Q_0(X)
--
-- (It should be clear that this process can be easily generalized
-- to recurrance relations in which Q_k depends on the previous 3 Q's.
--
-- Q_0 = some given function of X
-- Q_1 = some given function of X
-- Q_2 = some given function of X
-- Q_k = Alpha(k,X)*Q_k-1(X) + Beta(k,X)*Q_k-2(k,X) + Gamma*Q_k-3(X)
--
-- The SUM's above should start at k=3, but the derivation is identical.)
--
-- Finally notice that in special cases this simplifies further.
-- In many cases, particularly the orthogonal polynomials,
-- Q_0 is 1, so that F_n = D_0.
--
generic
type Real is digits <>;
-- Package only sums functions of real variables.
type Base_Poly_Index_Type is range <>;
Poly_Limit : Base_Poly_Index_Type;
with function Alpha
(k : Base_Poly_Index_Type;
Parameter : Real;
X : Real)
return Real;
with function Beta
(k : Base_Poly_Index_Type;
Parameter : Real;
X : Real)
return Real;
with function Q_0
(Parameter : Real;
X : Real)
return Real;
package Clenshaw is
subtype Poly_ID_Type is Base_Poly_Index_Type range 0 .. Poly_Limit;
-- The index k. k always starts a 0.
type Poly_Values is array(Poly_ID_Type) of Real;
procedure Evaluate_Qs
(X : in Real;
Q : in out Poly_Values;
Max_Poly_ID : in Poly_ID_Type;
P : in Real := 0.0;
No_Of_Iterations : in Positive := 1);
-- Get Q_0(X), Q_1(X) ... Q_m(X) where m = Max_Poly_ID.
-- P is the parameter in Alpha and Beta.
type Coefficients is array(Poly_ID_Type) of Real;
function Sum
(X : in Real;
C : in Coefficients;
Sum_Limit : in Poly_ID_Type;
P : in Real := 0.0;
No_Of_Iterations : in Positive := 1)
return Real;
-- Sum the polys Q times the Coefficients: SUM (Q_k * C_k)
-- P is the parameter in Alpha and Beta.
end Clenshaw;
|
libsrc/zx81/zx_coord_adj.asm | meesokim/z88dk | 0 | 89506 | ;
; ZX81 libraries - Stefano
;
;----------------------------------------------------------------
; adjust coordinates from-to ZX81 ROM style:
; ROM expects (0,0) close to the bottom-left corner, Z88DK
; wants it in the top-left
;----------------------------------------------------------------
;
; $Id: zx_coord_adj.asm,v 1.4 2015/01/19 01:33:26 pauloscustodio Exp $
;
;----------------------------------------------------------------
PUBLIC zx_coord_adj
IF FORzx81
DEFC COLUMN=$4039 ; S_POSN_x
DEFC ROW=$403A ; S_POSN_y
ELSE
DEFC COLUMN=$4024 ; S_POSN_x
DEFC ROW=$4025 ; S_POSN_y
ENDIF
zx_coord_adj: ; adjust coordinates from-to ZX81 ROM style
ld hl,$1821 ; (33,24) = top left screen posn
ld de,(COLUMN)
and a
sbc hl,de
ld (COLUMN),hl
ret
|
src/aco-protocols-service_data.ads | jonashaggstrom/ada-canopen | 6 | 8489 | with Ada.Real_Time;
with ACO.CANopen;
with ACO.Messages;
with ACO.OD;
with ACO.SDO_Sessions;
private with Interfaces;
private with ACO.Log;
private with ACO.Utils.Generic_Alarms;
private with ACO.Configuration;
private with ACO.SDO_Commands;
private with ACO.OD_Types;
package ACO.Protocols.Service_Data is
SDO_S2C_Id : constant ACO.Messages.Function_Code := 16#B#;
SDO_C2S_Id : constant ACO.Messages.Function_Code := 16#C#;
type SDO
(Handler : not null access ACO.CANopen.Handler;
Od : not null access ACO.OD.Object_Dictionary'Class)
is abstract new Protocol with private;
function Tx_CAN_Id
(This : SDO;
Parameter : ACO.SDO_Sessions.SDO_Parameters)
return ACO.Messages.Id_Type is abstract;
function Rx_CAN_Id
(This : SDO;
Parameter : ACO.SDO_Sessions.SDO_Parameters)
return ACO.Messages.Id_Type is abstract;
function Get_Endpoint
(This : SDO;
Rx_CAN_Id : ACO.Messages.Id_Type)
return ACO.SDO_Sessions.Endpoint_Type is abstract;
procedure Result_Callback
(This : in out SDO;
Session : in ACO.SDO_Sessions.SDO_Session;
Result : in ACO.SDO_Sessions.SDO_Result) is abstract;
overriding
function Is_Valid
(This : in out SDO;
Msg : in ACO.Messages.Message)
return Boolean;
procedure Message_Received
(This : in out SDO'Class;
Msg : in ACO.Messages.Message)
with Pre => This.Is_Valid (Msg);
procedure Periodic_Actions
(This : in out SDO;
T_Now : in Ada.Real_Time.Time);
procedure Clear
(This : in out SDO;
Id : in ACO.SDO_Sessions.Valid_Endpoint_Nr);
private
type Error_Type is
(Nothing,
Unknown,
General_Error,
Invalid_Value_For_Parameter,
Toggle_Bit_Not_Altered,
SDO_Protocol_Timed_Out,
Command_Specifier_Not_Valid_Or_Unknown,
Object_Does_Not_Exist_In_The_Object_Dictionary,
Attempt_To_Read_A_Write_Only_Object,
Attempt_To_Write_A_Read_Only_Object,
Failed_To_Transfer_Or_Store_Data,
Failed_To_Transfer_Or_Store_Data_Due_To_Local_Control);
Abort_Code : constant array (Error_Type) of ACO.SDO_Commands.Abort_Code_Type :=
(Nothing => 16#0000_0000#,
Unknown => 16#0000_0000#,
General_Error => 16#0800_0000#,
Invalid_Value_For_Parameter => 16#0609_0030#,
Toggle_Bit_Not_Altered => 16#0503_0000#,
SDO_Protocol_Timed_Out => 16#0504_0000#,
Command_Specifier_Not_Valid_Or_Unknown => 16#0504_0001#,
Object_Does_Not_Exist_In_The_Object_Dictionary => 16#0602_0000#,
Attempt_To_Read_A_Write_Only_Object => 16#0601_0001#,
Attempt_To_Write_A_Read_Only_Object => 16#0601_0002#,
Failed_To_Transfer_Or_Store_Data => 16#0800_0020#,
Failed_To_Transfer_Or_Store_Data_Due_To_Local_Control => 16#0800_0021#);
package Alarms is new ACO.Utils.Generic_Alarms
(Configuration.Max_Nof_Simultaneous_SDO_Sessions);
type Alarm
(SDO_Ref : access SDO'Class := null)
is new Alarms.Alarm_Type with record
Id : ACO.SDO_Sessions.Endpoint_Nr := ACO.SDO_Sessions.No_Endpoint_Id;
end record;
overriding
procedure Signal
(This : access Alarm;
T_Now : in Ada.Real_Time.Time);
type Alarm_Array is array (ACO.SDO_Sessions.Valid_Endpoint_Nr'Range)
of aliased Alarm;
type SDO
(Handler : not null access ACO.CANopen.Handler;
Od : not null access ACO.OD.Object_Dictionary'Class)
--Wrap : not null access SDO_Wrapper_Base'Class)
is abstract new Protocol (Od) with record
Sessions : ACO.SDO_Sessions.Session_Manager;
Timers : Alarms.Alarm_Manager;
Alarms : Alarm_Array :=
(others => (SDO'Access, ACO.SDO_Sessions.No_Endpoint_Id));
end record;
procedure Indicate_Status
(This : in out SDO'Class;
Session : in ACO.SDO_Sessions.SDO_Session;
Status : in ACO.SDO_Sessions.SDO_Status);
procedure Handle_Message
(This : in out SDO;
Msg : in ACO.Messages.Message;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type) is null;
procedure SDO_Log
(This : in out SDO;
Level : in ACO.Log.Log_Level;
Message : in String);
procedure Start_Alarm
(This : in out SDO;
Id : in ACO.SDO_Sessions.Valid_Endpoint_Nr);
procedure Stop_Alarm
(This : in out SDO;
Id : in ACO.SDO_Sessions.Valid_Endpoint_Nr);
procedure Abort_All
(This : in out SDO;
Msg : in ACO.Messages.Message;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type);
procedure Write
(This : in out SDO;
Index : in ACO.OD_Types.Entry_Index;
Data : in ACO.Messages.Data_Array;
Error : out Error_Type);
procedure Send_SDO
(This : in out SDO'Class;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type;
Raw_Data : in ACO.Messages.Msg_Data);
procedure Send_Abort
(This : in out SDO;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type;
Error : in Error_Type;
Index : in ACO.OD_Types.Entry_Index := (0,0));
function Hex_Str
(X : Interfaces.Unsigned_32;
Trim : Boolean := True)
return String;
end ACO.Protocols.Service_Data;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/array28.adb | best08618/asylo | 7 | 2145 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/array28.adb
-- { dg-do run }
-- { dg-options "-O" }
with Array28_Pkg; use Array28_Pkg;
procedure Array28 is
function Get return Outer_type is
Ret : Outer_Type;
begin
Ret (Inner_Type'Range) := F;
return Ret;
end;
A : Outer_Type := Get;
B : Inner_Type := A (Inner_Type'Range);
begin
if B /= "12345" then
raise Program_Error;
end if;
end;
|
programs/oeis/332/A332149.asm | neoneye/loda | 22 | 90337 | <filename>programs/oeis/332/A332149.asm<gh_stars>10-100
; A332149: a(n) = 4*(10^(2*n+1)-1)/9 + 5*10^n.
; 9,494,44944,4449444,444494444,44444944444,4444449444444,444444494444444,44444444944444444,4444444449444444444,444444444494444444444,44444444444944444444444,4444444444449444444444444,444444444444494444444444444,44444444444444944444444444444,4444444444444449444444444444444
mov $1,10
pow $1,$0
mul $1,8
add $1,5
bin $1,2
sub $1,21
div $1,9
mul $1,5
add $1,6
div $1,4
mov $0,$1
|
cql/src/main/java/com/huawei/streaming/cql/semanticanalyzer/parser/CQLParser.g4 | chenqixu/StreamCQL | 8 | 4719 | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* CQL语法定义入口
*/
parser grammar CQLParser;
options
{
tokenVocab=CQLLexer;
}
import CreateStatements,CommandsStatements,Expressions,SelectStatements,Identifiers;
@parser::header {
package com.huawei.streaming.cql.semanticanalyzer.parser;
}
statement
: ddlStatement EOF
| execStatement EOF
| expression EOF
;
execStatement
: insertStatement
| insertUserOperatorStatement
| multiInsertStatement
| selectStatement
;
ddlStatement
: createInputStreamStatement
| createOutputStreamStatement
| createPipeStreamStatement
| createDataSourceStatement
| createOperatorStatement
| dropApplication
| submitApplication
| showFunctions
| showApplications
| loadStatement
| explainStatement
| getStatement
| setStatement
| createFunctionStatement
| dropFunctionStatement
| addFileStatement
| addJARStatement
;
|
agda-stdlib/src/Data/Vec/Functional.agda | DreamLinuxer/popl21-artifact | 5 | 3378 | <gh_stars>1-10
------------------------------------------------------------------------
-- The Agda standard library
--
-- Vectors defined as functions from a finite set to a type.
------------------------------------------------------------------------
-- This implementation is designed for reasoning about fixed-size
-- vectors where ease of retrieval of elements is prioritised.
-- See `Data.Vec` for an alternative implementation using inductive
-- data-types, which is more suitable for reasoning about vectors that
-- will grow or shrink in size.
{-# OPTIONS --without-K --safe #-}
module Data.Vec.Functional where
open import Data.Fin.Base using (Fin; zero; suc; splitAt; punchIn)
open import Data.List.Base as L using (List)
open import Data.Nat.Base using (ℕ; zero; suc; _+_)
open import Data.Product using (Σ; ∃; _×_; _,_; proj₁; proj₂)
open import Data.Sum.Base using (_⊎_; inj₁; inj₂; [_,_])
open import Data.Vec.Base as V using (Vec)
open import Function
open import Level using (Level)
infixr 5 _∷_ _++_
infixl 4 _⊛_
private
variable
a b c : Level
A : Set a
B : Set b
C : Set c
------------------------------------------------------------------------
-- Definition
Vector : Set a → ℕ → Set a
Vector A n = Fin n → A
------------------------------------------------------------------------
-- Conversion
toVec : ∀ {n} → Vector A n → Vec A n
toVec = V.tabulate
fromVec : ∀ {n} → Vec A n → Vector A n
fromVec = V.lookup
toList : ∀ {n} → Vector A n → List A
toList = L.tabulate
fromList : ∀ (xs : List A) → Vector A (L.length xs)
fromList = L.lookup
------------------------------------------------------------------------
-- Construction and deconstruction
[] : Vector A zero
[] ()
_∷_ : ∀ {n} → A → Vector A n → Vector A (suc n)
(x ∷ xs) zero = x
(x ∷ xs) (suc i) = xs i
head : ∀ {n} → Vector A (suc n) → A
head xs = xs zero
tail : ∀ {n} → Vector A (suc n) → Vector A n
tail xs = xs ∘ suc
uncons : ∀ {n} → Vector A (suc n) → A × Vector A n
uncons xs = head xs , tail xs
replicate : ∀ {n} → A → Vector A n
replicate = const
remove : ∀ {n} → Fin (suc n) → Vector A (suc n) → Vector A n
remove i t = t ∘ punchIn i
------------------------------------------------------------------------
-- Transformations
map : (A → B) → ∀ {n} → Vector A n → Vector B n
map f xs = f ∘ xs
_++_ : ∀ {m n} → Vector A m → Vector A n → Vector A (m + n)
_++_ {m = m} xs ys i = [ xs , ys ] (splitAt m i)
foldr : (A → B → B) → B → ∀ {n} → Vector A n → B
foldr f z {n = zero} xs = z
foldr f z {n = suc n} xs = f (head xs) (foldr f z (tail xs))
foldl : (B → A → B) → B → ∀ {n} → Vector A n → B
foldl f z {n = zero} xs = z
foldl f z {n = suc n} xs = foldl f (f z (head xs)) (tail xs)
rearrange : ∀ {m n} → (Fin m → Fin n) → Vector A n → Vector A m
rearrange r xs = xs ∘ r
_⊛_ : ∀ {n} → Vector (A → B) n → Vector A n → Vector B n
_⊛_ = _ˢ_
zipWith : (A → B → C) → ∀ {n} → Vector A n → Vector B n → Vector C n
zipWith f xs ys i = f (xs i) (ys i)
zip : ∀ {n} → Vector A n → Vector B n → Vector (A × B) n
zip = zipWith _,_
|
programs/oeis/110/A110667.asm | neoneye/loda | 22 | 11185 | <gh_stars>10-100
; A110667: Sequence is {a(2,n)}, where a(m,n) is defined at sequence A110665.
; 0,1,2,0,-6,-12,-12,-5,2,0,-12,-24,-24,-11,2,0,-18,-36,-36,-17,2,0,-24,-48,-48,-23,2,0,-30,-60,-60,-29,2,0,-36,-72,-72,-35,2,0,-42,-84,-84,-41,2,0,-48,-96,-96,-47,2,0,-54,-108,-108,-53,2,0,-60,-120,-120,-59,2,0,-66,-132,-132,-65,2,0,-72,-144,-144,-71,2,0,-78,-156,-156,-77,2,0,-84,-168,-168,-83,2,0,-90,-180,-180,-89,2,0,-96,-192,-192,-95,2,0
lpb $0
mov $2,$0
sub $0,1
seq $2,110666 ; Sequence is {a(1,n)}, where a(m,n) is defined at sequence A110665.
add $1,$2
lpe
mov $0,$1
|
programs/oeis/130/A130658.asm | neoneye/loda | 22 | 6893 | <gh_stars>10-100
; A130658: Period 4: repeat [1, 1, 2, 2].
; 1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2
mod $0,4
div $0,2
add $0,1
|
examples/tts_example2.adb | jorge-real/TTS | 1 | 29842 | <reponame>jorge-real/TTS<gh_stars>1-10
with System;
with Ada.Real_Time; use Ada.Real_Time;
with Time_Triggered_Scheduling; -- use Time_Triggered_Scheduling;
-- The following packages are for tracing and timing support
with Ada.Exceptions; use Ada.Exceptions;
with Logging_Support; use Logging_Support;
with Use_CPU; use Use_CPU;
with Ada.Text_IO; use Ada.Text_IO;
with Epoch_Support; use Epoch_Support;
with STM32.Board; use STM32.Board;
-- with Stats;
package body TTS_Example2 is
-- package MyStats is new Stats (5);
-- Instantiation of generic TT scheduler
No_Of_TT_Works : constant := 3;
package TT_Scheduler is new Time_Triggered_Scheduling (No_Of_TT_Works);
use TT_Scheduler;
function New_Slot (ms : Natural;
WId : Any_Work_Id;
Slot_Separation : Natural := 0) return Time_Slot;
function New_Slot (ms : Natural;
WId : Any_Work_Id;
Slot_Separation : Natural := 0) return Time_Slot is
Slot : Time_Slot;
begin
Slot.Slot_Duration := Milliseconds (ms);
Slot.Work_Id := WId;
Slot.Next_Slot_Separation := Milliseconds (Slot_Separation);
return Slot;
end New_Slot;
----------------------------
-- Time-triggered plans --
----------------------------
TTP1 : aliased Time_Triggered_Plan :=
(
New_Slot (30, 1),
New_Slot (70, Empty_Slot),
New_Slot (60, 2),
New_Slot (40, Empty_Slot),
New_Slot (90, 3),
New_Slot (10, Mode_Change_Slot)
);
TTP2 : aliased Time_Triggered_Plan :=
(
New_Slot (90, 3),
New_Slot (10, Empty_Slot),
New_Slot (60, 2),
New_Slot (40, Empty_Slot),
New_Slot (30, 1),
New_Slot (70, Mode_Change_Slot)
);
Null_Plan : aliased Time_Triggered_Plan :=
(
0 => New_Slot (100, Empty_Slot),
1 => New_Slot (100, Mode_Change_Slot)
);
-------------------
-- Task Patterns --
-------------------
-- A basic TT task
task type Basic_TT_Task (Work_Id : Regular_Work_Id;
Execution_Time_MS : Natural)
with Priority => System.Priority'Last is
end Basic_TT_Task;
task body Basic_TT_Task is
Work_To_Be_Done : constant Natural := Execution_Time_MS;
LED_To_Turn : User_LED;
When_Was_Released : Time;
-- Jitter : Time_Span;
begin
case Work_Id is
when 1 =>
LED_To_Turn := Red_LED;
when 2 =>
LED_To_Turn := Blue_LED;
when 3 =>
LED_To_Turn := Green_LED;
end case;
loop
Wait_For_Activation (Work_Id, When_Was_Released);
-- Jitter := Clock - When_Was_Released;
-- Log (No_Event, "|---> Jitter of Worker" & Integer'Image (Integer (Work_Id)) &
-- " = " & Duration'Image (1000.0 * To_Duration (Jitter)) & " ms.");
-- MyStats.Register_Time(Integer(Work_Id)*2-1, Jitter);
Set (Probe_TT_Point);
Turn_On (LED_To_Turn);
Work (Work_To_Be_Done);
Turn_Off (LED_To_Turn);
Clear (Probe_TT_Point);
-- Log (Stop_Task, "W" & Character'Val (Character'Pos ('0') + Integer (Work_Id)));
end loop;
exception
when E : others =>
Put_Line ("Periodic worker W" & Character'Val (Character'Pos ('0') + Integer (Work_Id)) &
": " & Exception_Message (E));
end Basic_TT_Task;
-------------------------------
-- Priority scheduled tasks --
-------------------------------
task type DM_Task (Id : Natural; Period : Integer; Prio : System.Priority)
with Priority => Prio;
task body DM_Task is
Next : Time := Epoch;
Per : constant Time_Span := Milliseconds (Period);
Jitter : Time_Span;
begin
loop
delay until Next;
Jitter := Clock - Next;
Log (No_Event, "|---------> Jitter of DM Task" & Integer'Image (Id) &
" = " & Duration'Image (1000.0 * To_Duration (Jitter)) & " ms.");
-- MyStats.Register_Time(Integer(Id)*2-1, Jitter);
-- Log (Start_Task, "T" & Character'Val (Character'Pos ('0') + Integer (Id)));
Set (Probe_ET_Point);
Turn_On (Orange_LED);
Work (5);
Next := Next + Per;
Turn_Off (Orange_LED);
Clear (Probe_ET_Point);
-- Log (Stop_Task, "T" & Character'Val (Character'Pos ('0') + Integer (Id)));
end loop;
exception
when E : others =>
Put_Line (Exception_Message (E));
end DM_Task;
-- Event-triggered tasks
T4 : DM_Task (Id => 4, Period => 90, Prio => System.Priority'First + 1);
T5 : DM_Task (Id => 5, Period => 210, Prio => System.Priority'First);
-- Time-triggered tasks
-- Work_ID, Execution (ms)
Wk1 : Basic_TT_Task (1, 20);
Wk2 : Basic_TT_Task (2, 40);
Wk3 : Basic_TT_Task (3, 60);
procedure Main is
K : Integer := 0; -- Number of iterations in main loop
begin
-- Generate trace header --
Log (No_Event, "1 M1"); -- Nr of modes
Log (No_Event, "5"); -- Nr of works + Nr of tasks
Log (No_Event, "W1 9.200 9.200 0.0 10"); -- Task_name Period Deadline Phasing Priority
Log (No_Event, "W2 9.200 9.200 0.0 9");
Log (No_Event, "W3 9.200 9.200 0.0 8");
Log (No_Event, "T4 0.600 0.600 0.0 5");
Log (No_Event, "T5 0.800 0.800 0.0 4");
Log (No_Event, ":BODY");
delay until Epoch;
loop
Log (Mode_Change, "M1");
Set_Plan (TTP1'Access);
delay until Epoch + Seconds (K * 30 + 10);
Log (Mode_Change, "Null Plan");
Set_Plan (Null_Plan'Access);
delay until Epoch + Seconds (K * 30 + 15);
Log (Mode_Change, "M2");
Set_Plan (TTP2'Access);
delay until Epoch + Seconds (K * 30 + 25);
Log (Mode_Change, "Null Plan");
Set_Plan (Null_Plan'Access);
delay until Epoch + Seconds (K * 30 + 30);
K := K + 1;
end loop;
-- MyStats.Print_Stats;
-- delay until Time_Last;
end Main;
procedure Configure_Probe_Points;
procedure Configure_Probe_Points is
Configuration : GPIO_Port_Configuration;
begin
Configuration.Mode := Mode_Out;
Configuration.Output_Type := Push_Pull;
Configuration.Speed := Speed_50MHz;
Configuration.Resistors := Floating;
Enable_Clock (Probe_TT_Point & Probe_ET_Point);
Configure_IO (Probe_TT_Point & Probe_ET_Point, Configuration);
Clear (Probe_TT_Point);
Clear (Probe_ET_Point);
end Configure_Probe_Points;
begin
Configure_Probe_Points;
Initialize_LEDs;
All_LEDs_Off;
end TTS_Example2;
|
oeis/015/A015469.asm | neoneye/loda-programs | 11 | 169710 | ; A015469: q-Fibonacci numbers for q=11.
; Submitted by <NAME>(s4)
; 0,1,1,12,133,16105,1963358,2595689713,3480804151551,50586130104323474,746191869036731097905,119280194867984161366496439,19354414621214347335584253057344,34032051023004810891710239239325511573,60742478094093955203024050473128650573200597,1174878761877245690915036416189130627371356755414060,23066947122544603317981007703757542453816935646571145808937,4907760180403998219935618170749901376071792077813630425171895261997,1059919993965987867566301257266818507900333341534109821661147979714713464854
mov $1,1
lpb $0
sub $0,1
mov $2,$3
add $3,$1
mov $1,11
pow $1,$0
mul $1,$2
lpe
mov $0,$3
|
data/pokemon/base_stats/poliwag.asm | AtmaBuster/pokeplat-gen2 | 6 | 176131 | db 0 ; species ID placeholder
db 40, 50, 40, 90, 40, 40
; hp atk def spd sat sdf
db WATER, WATER ; type
db 255 ; catch rate
db 77 ; base exp
db NO_ITEM, NO_ITEM ; items
db GENDER_F50 ; gender ratio
db 20 ; step cycles to hatch
INCBIN "gfx/pokemon/poliwag/front.dimensions"
db GROWTH_MEDIUM_SLOW ; growth rate
dn EGG_WATER_1, EGG_WATER_1 ; egg groups
db 70 ; happiness
; tm/hm learnset
tmhm WATER_PULSE, TOXIC, HAIL, HIDDEN_POWER, ICE_BEAM, BLIZZARD, PROTECT, RAIN_DANCE, FRUSTRATION, RETURN, DIG, PSYCHIC_M, DOUBLE_TEAM, FACADE, SECRET_POWER, REST, ATTRACT, THIEF, ENDURE, CAPTIVATE, SLEEP_TALK, NATURAL_GIFT, SWAGGER, SUBSTITUTE, SURF, WATERFALL, DIVE, HELPING_HAND, ICY_WIND, SNORE
; end
|
oeis/017/A017445.asm | neoneye/loda-programs | 11 | 14675 | ; A017445: a(n) = (11*n + 4)^9.
; 262144,38443359375,5429503678976,129961739795077,1352605460594688,8662995818654939,40353607000000000,150094635296999121,472161363286556672,1304773183829244583,3251948521156637184,7450580596923828125,15916595351771938816,32052064847671367667,61364017143100579328,112455406951957393129,198359290368000000000,338298681559573317311,559966859614392781312,902436039641232277173,1419816323814495617024,2185801705278841796875,3299255610714283193856,4891005035897482905857,7132029752782342586368
mul $0,11
add $0,4
pow $0,9
|
echo.asm | UyChooTran/CS153Lab3 | 0 | 3406 | <gh_stars>0
_echo: file format elf32-i386
Disassembly of section .text:
00001000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
1000: 8d 4c 24 04 lea 0x4(%esp),%ecx
1004: 83 e4 f0 and $0xfffffff0,%esp
1007: ff 71 fc pushl -0x4(%ecx)
100a: 55 push %ebp
100b: 89 e5 mov %esp,%ebp
100d: 57 push %edi
100e: 56 push %esi
100f: 53 push %ebx
1010: 51 push %ecx
1011: 83 ec 08 sub $0x8,%esp
1014: 8b 31 mov (%ecx),%esi
1016: 8b 79 04 mov 0x4(%ecx),%edi
int i;
for(i = 1; i < argc; i++)
1019: 83 fe 01 cmp $0x1,%esi
101c: 7e 41 jle 105f <main+0x5f>
101e: bb 01 00 00 00 mov $0x1,%ebx
1023: eb 1b jmp 1040 <main+0x40>
1025: 8d 76 00 lea 0x0(%esi),%esi
printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n");
1028: 68 64 17 00 00 push $0x1764
102d: ff 74 9f fc pushl -0x4(%edi,%ebx,4)
1031: 68 66 17 00 00 push $0x1766
1036: 6a 01 push $0x1
1038: e8 d3 03 00 00 call 1410 <printf>
103d: 83 c4 10 add $0x10,%esp
1040: 83 c3 01 add $0x1,%ebx
1043: 39 de cmp %ebx,%esi
1045: 75 e1 jne 1028 <main+0x28>
1047: 68 6b 17 00 00 push $0x176b
104c: ff 74 b7 fc pushl -0x4(%edi,%esi,4)
1050: 68 66 17 00 00 push $0x1766
1055: 6a 01 push $0x1
1057: e8 b4 03 00 00 call 1410 <printf>
105c: 83 c4 10 add $0x10,%esp
exit();
105f: e8 4e 02 00 00 call 12b2 <exit>
1064: 66 90 xchg %ax,%ax
1066: 66 90 xchg %ax,%ax
1068: 66 90 xchg %ax,%ax
106a: 66 90 xchg %ax,%ax
106c: 66 90 xchg %ax,%ax
106e: 66 90 xchg %ax,%ax
00001070 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
1070: 55 push %ebp
1071: 89 e5 mov %esp,%ebp
1073: 53 push %ebx
1074: 8b 45 08 mov 0x8(%ebp),%eax
1077: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
107a: 89 c2 mov %eax,%edx
107c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1080: 83 c1 01 add $0x1,%ecx
1083: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
1087: 83 c2 01 add $0x1,%edx
108a: 84 db test %bl,%bl
108c: 88 5a ff mov %bl,-0x1(%edx)
108f: 75 ef jne 1080 <strcpy+0x10>
;
return os;
}
1091: 5b pop %ebx
1092: 5d pop %ebp
1093: c3 ret
1094: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
109a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000010a0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
10a0: 55 push %ebp
10a1: 89 e5 mov %esp,%ebp
10a3: 56 push %esi
10a4: 53 push %ebx
10a5: 8b 55 08 mov 0x8(%ebp),%edx
10a8: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
10ab: 0f b6 02 movzbl (%edx),%eax
10ae: 0f b6 19 movzbl (%ecx),%ebx
10b1: 84 c0 test %al,%al
10b3: 75 1e jne 10d3 <strcmp+0x33>
10b5: eb 29 jmp 10e0 <strcmp+0x40>
10b7: 89 f6 mov %esi,%esi
10b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
10c0: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
10c3: 0f b6 02 movzbl (%edx),%eax
p++, q++;
10c6: 8d 71 01 lea 0x1(%ecx),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
10c9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
10cd: 84 c0 test %al,%al
10cf: 74 0f je 10e0 <strcmp+0x40>
10d1: 89 f1 mov %esi,%ecx
10d3: 38 d8 cmp %bl,%al
10d5: 74 e9 je 10c0 <strcmp+0x20>
p++, q++;
return (uchar)*p - (uchar)*q;
10d7: 29 d8 sub %ebx,%eax
}
10d9: 5b pop %ebx
10da: 5e pop %esi
10db: 5d pop %ebp
10dc: c3 ret
10dd: 8d 76 00 lea 0x0(%esi),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
10e0: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
10e2: 29 d8 sub %ebx,%eax
}
10e4: 5b pop %ebx
10e5: 5e pop %esi
10e6: 5d pop %ebp
10e7: c3 ret
10e8: 90 nop
10e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000010f0 <strlen>:
uint
strlen(char *s)
{
10f0: 55 push %ebp
10f1: 89 e5 mov %esp,%ebp
10f3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
10f6: 80 39 00 cmpb $0x0,(%ecx)
10f9: 74 12 je 110d <strlen+0x1d>
10fb: 31 d2 xor %edx,%edx
10fd: 8d 76 00 lea 0x0(%esi),%esi
1100: 83 c2 01 add $0x1,%edx
1103: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
1107: 89 d0 mov %edx,%eax
1109: 75 f5 jne 1100 <strlen+0x10>
;
return n;
}
110b: 5d pop %ebp
110c: c3 ret
uint
strlen(char *s)
{
int n;
for(n = 0; s[n]; n++)
110d: 31 c0 xor %eax,%eax
;
return n;
}
110f: 5d pop %ebp
1110: c3 ret
1111: eb 0d jmp 1120 <memset>
1113: 90 nop
1114: 90 nop
1115: 90 nop
1116: 90 nop
1117: 90 nop
1118: 90 nop
1119: 90 nop
111a: 90 nop
111b: 90 nop
111c: 90 nop
111d: 90 nop
111e: 90 nop
111f: 90 nop
00001120 <memset>:
void*
memset(void *dst, int c, uint n)
{
1120: 55 push %ebp
1121: 89 e5 mov %esp,%ebp
1123: 57 push %edi
1124: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
1127: 8b 4d 10 mov 0x10(%ebp),%ecx
112a: 8b 45 0c mov 0xc(%ebp),%eax
112d: 89 d7 mov %edx,%edi
112f: fc cld
1130: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
1132: 89 d0 mov %edx,%eax
1134: 5f pop %edi
1135: 5d pop %ebp
1136: c3 ret
1137: 89 f6 mov %esi,%esi
1139: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00001140 <strchr>:
char*
strchr(const char *s, char c)
{
1140: 55 push %ebp
1141: 89 e5 mov %esp,%ebp
1143: 53 push %ebx
1144: 8b 45 08 mov 0x8(%ebp),%eax
1147: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
114a: 0f b6 10 movzbl (%eax),%edx
114d: 84 d2 test %dl,%dl
114f: 74 1d je 116e <strchr+0x2e>
if(*s == c)
1151: 38 d3 cmp %dl,%bl
1153: 89 d9 mov %ebx,%ecx
1155: 75 0d jne 1164 <strchr+0x24>
1157: eb 17 jmp 1170 <strchr+0x30>
1159: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1160: 38 ca cmp %cl,%dl
1162: 74 0c je 1170 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
1164: 83 c0 01 add $0x1,%eax
1167: 0f b6 10 movzbl (%eax),%edx
116a: 84 d2 test %dl,%dl
116c: 75 f2 jne 1160 <strchr+0x20>
if(*s == c)
return (char*)s;
return 0;
116e: 31 c0 xor %eax,%eax
}
1170: 5b pop %ebx
1171: 5d pop %ebp
1172: c3 ret
1173: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1179: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00001180 <gets>:
char*
gets(char *buf, int max)
{
1180: 55 push %ebp
1181: 89 e5 mov %esp,%ebp
1183: 57 push %edi
1184: 56 push %esi
1185: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
1186: 31 f6 xor %esi,%esi
cc = read(0, &c, 1);
1188: 8d 7d e7 lea -0x19(%ebp),%edi
return 0;
}
char*
gets(char *buf, int max)
{
118b: 83 ec 1c sub $0x1c,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
118e: eb 29 jmp 11b9 <gets+0x39>
cc = read(0, &c, 1);
1190: 83 ec 04 sub $0x4,%esp
1193: 6a 01 push $0x1
1195: 57 push %edi
1196: 6a 00 push $0x0
1198: e8 2d 01 00 00 call 12ca <read>
if(cc < 1)
119d: 83 c4 10 add $0x10,%esp
11a0: 85 c0 test %eax,%eax
11a2: 7e 1d jle 11c1 <gets+0x41>
break;
buf[i++] = c;
11a4: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
11a8: 8b 55 08 mov 0x8(%ebp),%edx
11ab: 89 de mov %ebx,%esi
if(c == '\n' || c == '\r')
11ad: 3c 0a cmp $0xa,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
11af: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
11b3: 74 1b je 11d0 <gets+0x50>
11b5: 3c 0d cmp $0xd,%al
11b7: 74 17 je 11d0 <gets+0x50>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
11b9: 8d 5e 01 lea 0x1(%esi),%ebx
11bc: 3b 5d 0c cmp 0xc(%ebp),%ebx
11bf: 7c cf jl 1190 <gets+0x10>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
11c1: 8b 45 08 mov 0x8(%ebp),%eax
11c4: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
11c8: 8d 65 f4 lea -0xc(%ebp),%esp
11cb: 5b pop %ebx
11cc: 5e pop %esi
11cd: 5f pop %edi
11ce: 5d pop %ebp
11cf: c3 ret
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
11d0: 8b 45 08 mov 0x8(%ebp),%eax
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
11d3: 89 de mov %ebx,%esi
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
11d5: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
11d9: 8d 65 f4 lea -0xc(%ebp),%esp
11dc: 5b pop %ebx
11dd: 5e pop %esi
11de: 5f pop %edi
11df: 5d pop %ebp
11e0: c3 ret
11e1: eb 0d jmp 11f0 <stat>
11e3: 90 nop
11e4: 90 nop
11e5: 90 nop
11e6: 90 nop
11e7: 90 nop
11e8: 90 nop
11e9: 90 nop
11ea: 90 nop
11eb: 90 nop
11ec: 90 nop
11ed: 90 nop
11ee: 90 nop
11ef: 90 nop
000011f0 <stat>:
int
stat(char *n, struct stat *st)
{
11f0: 55 push %ebp
11f1: 89 e5 mov %esp,%ebp
11f3: 56 push %esi
11f4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
11f5: 83 ec 08 sub $0x8,%esp
11f8: 6a 00 push $0x0
11fa: ff 75 08 pushl 0x8(%ebp)
11fd: e8 f0 00 00 00 call 12f2 <open>
if(fd < 0)
1202: 83 c4 10 add $0x10,%esp
1205: 85 c0 test %eax,%eax
1207: 78 27 js 1230 <stat+0x40>
return -1;
r = fstat(fd, st);
1209: 83 ec 08 sub $0x8,%esp
120c: ff 75 0c pushl 0xc(%ebp)
120f: 89 c3 mov %eax,%ebx
1211: 50 push %eax
1212: e8 f3 00 00 00 call 130a <fstat>
1217: 89 c6 mov %eax,%esi
close(fd);
1219: 89 1c 24 mov %ebx,(%esp)
121c: e8 b9 00 00 00 call 12da <close>
return r;
1221: 83 c4 10 add $0x10,%esp
1224: 89 f0 mov %esi,%eax
}
1226: 8d 65 f8 lea -0x8(%ebp),%esp
1229: 5b pop %ebx
122a: 5e pop %esi
122b: 5d pop %ebp
122c: c3 ret
122d: 8d 76 00 lea 0x0(%esi),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
1230: b8 ff ff ff ff mov $0xffffffff,%eax
1235: eb ef jmp 1226 <stat+0x36>
1237: 89 f6 mov %esi,%esi
1239: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00001240 <atoi>:
return r;
}
int
atoi(const char *s)
{
1240: 55 push %ebp
1241: 89 e5 mov %esp,%ebp
1243: 53 push %ebx
1244: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
1247: 0f be 11 movsbl (%ecx),%edx
124a: 8d 42 d0 lea -0x30(%edx),%eax
124d: 3c 09 cmp $0x9,%al
124f: b8 00 00 00 00 mov $0x0,%eax
1254: 77 1f ja 1275 <atoi+0x35>
1256: 8d 76 00 lea 0x0(%esi),%esi
1259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
1260: 8d 04 80 lea (%eax,%eax,4),%eax
1263: 83 c1 01 add $0x1,%ecx
1266: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
126a: 0f be 11 movsbl (%ecx),%edx
126d: 8d 5a d0 lea -0x30(%edx),%ebx
1270: 80 fb 09 cmp $0x9,%bl
1273: 76 eb jbe 1260 <atoi+0x20>
n = n*10 + *s++ - '0';
return n;
}
1275: 5b pop %ebx
1276: 5d pop %ebp
1277: c3 ret
1278: 90 nop
1279: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001280 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
1280: 55 push %ebp
1281: 89 e5 mov %esp,%ebp
1283: 56 push %esi
1284: 53 push %ebx
1285: 8b 5d 10 mov 0x10(%ebp),%ebx
1288: 8b 45 08 mov 0x8(%ebp),%eax
128b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
128e: 85 db test %ebx,%ebx
1290: 7e 14 jle 12a6 <memmove+0x26>
1292: 31 d2 xor %edx,%edx
1294: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
1298: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
129c: 88 0c 10 mov %cl,(%eax,%edx,1)
129f: 83 c2 01 add $0x1,%edx
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
12a2: 39 da cmp %ebx,%edx
12a4: 75 f2 jne 1298 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
12a6: 5b pop %ebx
12a7: 5e pop %esi
12a8: 5d pop %ebp
12a9: c3 ret
000012aa <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
12aa: b8 01 00 00 00 mov $0x1,%eax
12af: cd 40 int $0x40
12b1: c3 ret
000012b2 <exit>:
SYSCALL(exit)
12b2: b8 02 00 00 00 mov $0x2,%eax
12b7: cd 40 int $0x40
12b9: c3 ret
000012ba <wait>:
SYSCALL(wait)
12ba: b8 03 00 00 00 mov $0x3,%eax
12bf: cd 40 int $0x40
12c1: c3 ret
000012c2 <pipe>:
SYSCALL(pipe)
12c2: b8 04 00 00 00 mov $0x4,%eax
12c7: cd 40 int $0x40
12c9: c3 ret
000012ca <read>:
SYSCALL(read)
12ca: b8 05 00 00 00 mov $0x5,%eax
12cf: cd 40 int $0x40
12d1: c3 ret
000012d2 <write>:
SYSCALL(write)
12d2: b8 10 00 00 00 mov $0x10,%eax
12d7: cd 40 int $0x40
12d9: c3 ret
000012da <close>:
SYSCALL(close)
12da: b8 15 00 00 00 mov $0x15,%eax
12df: cd 40 int $0x40
12e1: c3 ret
000012e2 <kill>:
SYSCALL(kill)
12e2: b8 06 00 00 00 mov $0x6,%eax
12e7: cd 40 int $0x40
12e9: c3 ret
000012ea <exec>:
SYSCALL(exec)
12ea: b8 07 00 00 00 mov $0x7,%eax
12ef: cd 40 int $0x40
12f1: c3 ret
000012f2 <open>:
SYSCALL(open)
12f2: b8 0f 00 00 00 mov $0xf,%eax
12f7: cd 40 int $0x40
12f9: c3 ret
000012fa <mknod>:
SYSCALL(mknod)
12fa: b8 11 00 00 00 mov $0x11,%eax
12ff: cd 40 int $0x40
1301: c3 ret
00001302 <unlink>:
SYSCALL(unlink)
1302: b8 12 00 00 00 mov $0x12,%eax
1307: cd 40 int $0x40
1309: c3 ret
0000130a <fstat>:
SYSCALL(fstat)
130a: b8 08 00 00 00 mov $0x8,%eax
130f: cd 40 int $0x40
1311: c3 ret
00001312 <link>:
SYSCALL(link)
1312: b8 13 00 00 00 mov $0x13,%eax
1317: cd 40 int $0x40
1319: c3 ret
0000131a <mkdir>:
SYSCALL(mkdir)
131a: b8 14 00 00 00 mov $0x14,%eax
131f: cd 40 int $0x40
1321: c3 ret
00001322 <chdir>:
SYSCALL(chdir)
1322: b8 09 00 00 00 mov $0x9,%eax
1327: cd 40 int $0x40
1329: c3 ret
0000132a <dup>:
SYSCALL(dup)
132a: b8 0a 00 00 00 mov $0xa,%eax
132f: cd 40 int $0x40
1331: c3 ret
00001332 <getpid>:
SYSCALL(getpid)
1332: b8 0b 00 00 00 mov $0xb,%eax
1337: cd 40 int $0x40
1339: c3 ret
0000133a <sbrk>:
SYSCALL(sbrk)
133a: b8 0c 00 00 00 mov $0xc,%eax
133f: cd 40 int $0x40
1341: c3 ret
00001342 <sleep>:
SYSCALL(sleep)
1342: b8 0d 00 00 00 mov $0xd,%eax
1347: cd 40 int $0x40
1349: c3 ret
0000134a <uptime>:
SYSCALL(uptime)
134a: b8 0e 00 00 00 mov $0xe,%eax
134f: cd 40 int $0x40
1351: c3 ret
00001352 <shm_open>:
SYSCALL(shm_open)
1352: b8 16 00 00 00 mov $0x16,%eax
1357: cd 40 int $0x40
1359: c3 ret
0000135a <shm_close>:
SYSCALL(shm_close)
135a: b8 17 00 00 00 mov $0x17,%eax
135f: cd 40 int $0x40
1361: c3 ret
1362: 66 90 xchg %ax,%ax
1364: 66 90 xchg %ax,%ax
1366: 66 90 xchg %ax,%ax
1368: 66 90 xchg %ax,%ax
136a: 66 90 xchg %ax,%ax
136c: 66 90 xchg %ax,%ax
136e: 66 90 xchg %ax,%ax
00001370 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
1370: 55 push %ebp
1371: 89 e5 mov %esp,%ebp
1373: 57 push %edi
1374: 56 push %esi
1375: 53 push %ebx
1376: 89 c6 mov %eax,%esi
1378: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
137b: 8b 5d 08 mov 0x8(%ebp),%ebx
137e: 85 db test %ebx,%ebx
1380: 74 7e je 1400 <printint+0x90>
1382: 89 d0 mov %edx,%eax
1384: c1 e8 1f shr $0x1f,%eax
1387: 84 c0 test %al,%al
1389: 74 75 je 1400 <printint+0x90>
neg = 1;
x = -xx;
138b: 89 d0 mov %edx,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
138d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
x = -xx;
1394: f7 d8 neg %eax
1396: 89 75 c0 mov %esi,-0x40(%ebp)
} else {
x = xx;
}
i = 0;
1399: 31 ff xor %edi,%edi
139b: 8d 5d d7 lea -0x29(%ebp),%ebx
139e: 89 ce mov %ecx,%esi
13a0: eb 08 jmp 13aa <printint+0x3a>
13a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
13a8: 89 cf mov %ecx,%edi
13aa: 31 d2 xor %edx,%edx
13ac: 8d 4f 01 lea 0x1(%edi),%ecx
13af: f7 f6 div %esi
13b1: 0f b6 92 74 17 00 00 movzbl 0x1774(%edx),%edx
}while((x /= base) != 0);
13b8: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
13ba: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
13bd: 75 e9 jne 13a8 <printint+0x38>
if(neg)
13bf: 8b 45 c4 mov -0x3c(%ebp),%eax
13c2: 8b 75 c0 mov -0x40(%ebp),%esi
13c5: 85 c0 test %eax,%eax
13c7: 74 08 je 13d1 <printint+0x61>
buf[i++] = '-';
13c9: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
13ce: 8d 4f 02 lea 0x2(%edi),%ecx
13d1: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi
13d5: 8d 76 00 lea 0x0(%esi),%esi
13d8: 0f b6 07 movzbl (%edi),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
13db: 83 ec 04 sub $0x4,%esp
13de: 83 ef 01 sub $0x1,%edi
13e1: 6a 01 push $0x1
13e3: 53 push %ebx
13e4: 56 push %esi
13e5: 88 45 d7 mov %al,-0x29(%ebp)
13e8: e8 e5 fe ff ff call 12d2 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
13ed: 83 c4 10 add $0x10,%esp
13f0: 39 df cmp %ebx,%edi
13f2: 75 e4 jne 13d8 <printint+0x68>
putc(fd, buf[i]);
}
13f4: 8d 65 f4 lea -0xc(%ebp),%esp
13f7: 5b pop %ebx
13f8: 5e pop %esi
13f9: 5f pop %edi
13fa: 5d pop %ebp
13fb: c3 ret
13fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
} else {
x = xx;
1400: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
1402: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
1409: eb 8b jmp 1396 <printint+0x26>
140b: 90 nop
140c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00001410 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
1410: 55 push %ebp
1411: 89 e5 mov %esp,%ebp
1413: 57 push %edi
1414: 56 push %esi
1415: 53 push %ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
1416: 8d 45 10 lea 0x10(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
1419: 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++){
141c: 8b 75 0c mov 0xc(%ebp),%esi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
141f: 8b 7d 08 mov 0x8(%ebp),%edi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
1422: 89 45 d0 mov %eax,-0x30(%ebp)
1425: 0f b6 1e movzbl (%esi),%ebx
1428: 83 c6 01 add $0x1,%esi
142b: 84 db test %bl,%bl
142d: 0f 84 b0 00 00 00 je 14e3 <printf+0xd3>
1433: 31 d2 xor %edx,%edx
1435: eb 39 jmp 1470 <printf+0x60>
1437: 89 f6 mov %esi,%esi
1439: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
1440: 83 f8 25 cmp $0x25,%eax
1443: 89 55 d4 mov %edx,-0x2c(%ebp)
state = '%';
1446: ba 25 00 00 00 mov $0x25,%edx
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
144b: 74 18 je 1465 <printf+0x55>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
144d: 8d 45 e2 lea -0x1e(%ebp),%eax
1450: 83 ec 04 sub $0x4,%esp
1453: 88 5d e2 mov %bl,-0x1e(%ebp)
1456: 6a 01 push $0x1
1458: 50 push %eax
1459: 57 push %edi
145a: e8 73 fe ff ff call 12d2 <write>
145f: 8b 55 d4 mov -0x2c(%ebp),%edx
1462: 83 c4 10 add $0x10,%esp
1465: 83 c6 01 add $0x1,%esi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
1468: 0f b6 5e ff movzbl -0x1(%esi),%ebx
146c: 84 db test %bl,%bl
146e: 74 73 je 14e3 <printf+0xd3>
c = fmt[i] & 0xff;
if(state == 0){
1470: 85 d2 test %edx,%edx
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
1472: 0f be cb movsbl %bl,%ecx
1475: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
1478: 74 c6 je 1440 <printf+0x30>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
147a: 83 fa 25 cmp $0x25,%edx
147d: 75 e6 jne 1465 <printf+0x55>
if(c == 'd'){
147f: 83 f8 64 cmp $0x64,%eax
1482: 0f 84 f8 00 00 00 je 1580 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
1488: 81 e1 f7 00 00 00 and $0xf7,%ecx
148e: 83 f9 70 cmp $0x70,%ecx
1491: 74 5d je 14f0 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
1493: 83 f8 73 cmp $0x73,%eax
1496: 0f 84 84 00 00 00 je 1520 <printf+0x110>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
149c: 83 f8 63 cmp $0x63,%eax
149f: 0f 84 ea 00 00 00 je 158f <printf+0x17f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
14a5: 83 f8 25 cmp $0x25,%eax
14a8: 0f 84 c2 00 00 00 je 1570 <printf+0x160>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
14ae: 8d 45 e7 lea -0x19(%ebp),%eax
14b1: 83 ec 04 sub $0x4,%esp
14b4: c6 45 e7 25 movb $0x25,-0x19(%ebp)
14b8: 6a 01 push $0x1
14ba: 50 push %eax
14bb: 57 push %edi
14bc: e8 11 fe ff ff call 12d2 <write>
14c1: 83 c4 0c add $0xc,%esp
14c4: 8d 45 e6 lea -0x1a(%ebp),%eax
14c7: 88 5d e6 mov %bl,-0x1a(%ebp)
14ca: 6a 01 push $0x1
14cc: 50 push %eax
14cd: 57 push %edi
14ce: 83 c6 01 add $0x1,%esi
14d1: e8 fc fd ff ff call 12d2 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
14d6: 0f b6 5e ff movzbl -0x1(%esi),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
14da: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
14dd: 31 d2 xor %edx,%edx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
14df: 84 db test %bl,%bl
14e1: 75 8d jne 1470 <printf+0x60>
putc(fd, c);
}
state = 0;
}
}
}
14e3: 8d 65 f4 lea -0xc(%ebp),%esp
14e6: 5b pop %ebx
14e7: 5e pop %esi
14e8: 5f pop %edi
14e9: 5d pop %ebp
14ea: c3 ret
14eb: 90 nop
14ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
14f0: 83 ec 0c sub $0xc,%esp
14f3: b9 10 00 00 00 mov $0x10,%ecx
14f8: 6a 00 push $0x0
14fa: 8b 5d d0 mov -0x30(%ebp),%ebx
14fd: 89 f8 mov %edi,%eax
14ff: 8b 13 mov (%ebx),%edx
1501: e8 6a fe ff ff call 1370 <printint>
ap++;
1506: 89 d8 mov %ebx,%eax
1508: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
150b: 31 d2 xor %edx,%edx
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
150d: 83 c0 04 add $0x4,%eax
1510: 89 45 d0 mov %eax,-0x30(%ebp)
1513: e9 4d ff ff ff jmp 1465 <printf+0x55>
1518: 90 nop
1519: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
1520: 8b 45 d0 mov -0x30(%ebp),%eax
1523: 8b 18 mov (%eax),%ebx
ap++;
1525: 83 c0 04 add $0x4,%eax
1528: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
s = "(null)";
152b: b8 6d 17 00 00 mov $0x176d,%eax
1530: 85 db test %ebx,%ebx
1532: 0f 44 d8 cmove %eax,%ebx
while(*s != 0){
1535: 0f b6 03 movzbl (%ebx),%eax
1538: 84 c0 test %al,%al
153a: 74 23 je 155f <printf+0x14f>
153c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1540: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
1543: 8d 45 e3 lea -0x1d(%ebp),%eax
1546: 83 ec 04 sub $0x4,%esp
1549: 6a 01 push $0x1
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
154b: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
154e: 50 push %eax
154f: 57 push %edi
1550: e8 7d fd ff ff call 12d2 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
1555: 0f b6 03 movzbl (%ebx),%eax
1558: 83 c4 10 add $0x10,%esp
155b: 84 c0 test %al,%al
155d: 75 e1 jne 1540 <printf+0x130>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
155f: 31 d2 xor %edx,%edx
1561: e9 ff fe ff ff jmp 1465 <printf+0x55>
1566: 8d 76 00 lea 0x0(%esi),%esi
1569: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
1570: 83 ec 04 sub $0x4,%esp
1573: 88 5d e5 mov %bl,-0x1b(%ebp)
1576: 8d 45 e5 lea -0x1b(%ebp),%eax
1579: 6a 01 push $0x1
157b: e9 4c ff ff ff jmp 14cc <printf+0xbc>
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
1580: 83 ec 0c sub $0xc,%esp
1583: b9 0a 00 00 00 mov $0xa,%ecx
1588: 6a 01 push $0x1
158a: e9 6b ff ff ff jmp 14fa <printf+0xea>
158f: 8b 5d d0 mov -0x30(%ebp),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
1592: 83 ec 04 sub $0x4,%esp
1595: 8b 03 mov (%ebx),%eax
1597: 6a 01 push $0x1
1599: 88 45 e4 mov %al,-0x1c(%ebp)
159c: 8d 45 e4 lea -0x1c(%ebp),%eax
159f: 50 push %eax
15a0: 57 push %edi
15a1: e8 2c fd ff ff call 12d2 <write>
15a6: e9 5b ff ff ff jmp 1506 <printf+0xf6>
15ab: 66 90 xchg %ax,%ax
15ad: 66 90 xchg %ax,%ax
15af: 90 nop
000015b0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
15b0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
15b1: a1 58 1a 00 00 mov 0x1a58,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
15b6: 89 e5 mov %esp,%ebp
15b8: 57 push %edi
15b9: 56 push %esi
15ba: 53 push %ebx
15bb: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
15be: 8b 10 mov (%eax),%edx
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
15c0: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
15c3: 39 c8 cmp %ecx,%eax
15c5: 73 19 jae 15e0 <free+0x30>
15c7: 89 f6 mov %esi,%esi
15c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
15d0: 39 d1 cmp %edx,%ecx
15d2: 72 1c jb 15f0 <free+0x40>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
15d4: 39 d0 cmp %edx,%eax
15d6: 73 18 jae 15f0 <free+0x40>
static Header base;
static Header *freep;
void
free(void *ap)
{
15d8: 89 d0 mov %edx,%eax
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
15da: 39 c8 cmp %ecx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
15dc: 8b 10 mov (%eax),%edx
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
15de: 72 f0 jb 15d0 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
15e0: 39 d0 cmp %edx,%eax
15e2: 72 f4 jb 15d8 <free+0x28>
15e4: 39 d1 cmp %edx,%ecx
15e6: 73 f0 jae 15d8 <free+0x28>
15e8: 90 nop
15e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
if(bp + bp->s.size == p->s.ptr){
15f0: 8b 73 fc mov -0x4(%ebx),%esi
15f3: 8d 3c f1 lea (%ecx,%esi,8),%edi
15f6: 39 d7 cmp %edx,%edi
15f8: 74 19 je 1613 <free+0x63>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
15fa: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
15fd: 8b 50 04 mov 0x4(%eax),%edx
1600: 8d 34 d0 lea (%eax,%edx,8),%esi
1603: 39 f1 cmp %esi,%ecx
1605: 74 23 je 162a <free+0x7a>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
1607: 89 08 mov %ecx,(%eax)
freep = p;
1609: a3 58 1a 00 00 mov %eax,0x1a58
}
160e: 5b pop %ebx
160f: 5e pop %esi
1610: 5f pop %edi
1611: 5d pop %ebp
1612: c3 ret
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
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;
1613: 03 72 04 add 0x4(%edx),%esi
1616: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
1619: 8b 10 mov (%eax),%edx
161b: 8b 12 mov (%edx),%edx
161d: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
1620: 8b 50 04 mov 0x4(%eax),%edx
1623: 8d 34 d0 lea (%eax,%edx,8),%esi
1626: 39 f1 cmp %esi,%ecx
1628: 75 dd jne 1607 <free+0x57>
p->s.size += bp->s.size;
162a: 03 53 fc add -0x4(%ebx),%edx
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
freep = p;
162d: a3 58 1a 00 00 mov %eax,0x1a58
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
1632: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
1635: 8b 53 f8 mov -0x8(%ebx),%edx
1638: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
}
163a: 5b pop %ebx
163b: 5e pop %esi
163c: 5f pop %edi
163d: 5d pop %ebp
163e: c3 ret
163f: 90 nop
00001640 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
1640: 55 push %ebp
1641: 89 e5 mov %esp,%ebp
1643: 57 push %edi
1644: 56 push %esi
1645: 53 push %ebx
1646: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
1649: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
164c: 8b 15 58 1a 00 00 mov 0x1a58,%edx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
1652: 8d 78 07 lea 0x7(%eax),%edi
1655: c1 ef 03 shr $0x3,%edi
1658: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
165b: 85 d2 test %edx,%edx
165d: 0f 84 a3 00 00 00 je 1706 <malloc+0xc6>
1663: 8b 02 mov (%edx),%eax
1665: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
1668: 39 cf cmp %ecx,%edi
166a: 76 74 jbe 16e0 <malloc+0xa0>
166c: 81 ff 00 10 00 00 cmp $0x1000,%edi
1672: be 00 10 00 00 mov $0x1000,%esi
1677: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx
167e: 0f 43 f7 cmovae %edi,%esi
1681: ba 00 80 00 00 mov $0x8000,%edx
1686: 81 ff ff 0f 00 00 cmp $0xfff,%edi
168c: 0f 46 da cmovbe %edx,%ebx
168f: eb 10 jmp 16a1 <malloc+0x61>
1691: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
1698: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
169a: 8b 48 04 mov 0x4(%eax),%ecx
169d: 39 cf cmp %ecx,%edi
169f: 76 3f jbe 16e0 <malloc+0xa0>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
16a1: 39 05 58 1a 00 00 cmp %eax,0x1a58
16a7: 89 c2 mov %eax,%edx
16a9: 75 ed jne 1698 <malloc+0x58>
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
16ab: 83 ec 0c sub $0xc,%esp
16ae: 53 push %ebx
16af: e8 86 fc ff ff call 133a <sbrk>
if(p == (char*)-1)
16b4: 83 c4 10 add $0x10,%esp
16b7: 83 f8 ff cmp $0xffffffff,%eax
16ba: 74 1c je 16d8 <malloc+0x98>
return 0;
hp = (Header*)p;
hp->s.size = nu;
16bc: 89 70 04 mov %esi,0x4(%eax)
free((void*)(hp + 1));
16bf: 83 ec 0c sub $0xc,%esp
16c2: 83 c0 08 add $0x8,%eax
16c5: 50 push %eax
16c6: e8 e5 fe ff ff call 15b0 <free>
return freep;
16cb: 8b 15 58 1a 00 00 mov 0x1a58,%edx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
16d1: 83 c4 10 add $0x10,%esp
16d4: 85 d2 test %edx,%edx
16d6: 75 c0 jne 1698 <malloc+0x58>
return 0;
16d8: 31 c0 xor %eax,%eax
16da: eb 1c jmp 16f8 <malloc+0xb8>
16dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
16e0: 39 cf cmp %ecx,%edi
16e2: 74 1c je 1700 <malloc+0xc0>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
16e4: 29 f9 sub %edi,%ecx
16e6: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
16e9: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
16ec: 89 78 04 mov %edi,0x4(%eax)
}
freep = prevp;
16ef: 89 15 58 1a 00 00 mov %edx,0x1a58
return (void*)(p + 1);
16f5: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
16f8: 8d 65 f4 lea -0xc(%ebp),%esp
16fb: 5b pop %ebx
16fc: 5e pop %esi
16fd: 5f pop %edi
16fe: 5d pop %ebp
16ff: c3 ret
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
1700: 8b 08 mov (%eax),%ecx
1702: 89 0a mov %ecx,(%edx)
1704: eb e9 jmp 16ef <malloc+0xaf>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
1706: c7 05 58 1a 00 00 5c movl $0x1a5c,0x1a58
170d: 1a 00 00
1710: c7 05 5c 1a 00 00 5c movl $0x1a5c,0x1a5c
1717: 1a 00 00
base.s.size = 0;
171a: b8 5c 1a 00 00 mov $0x1a5c,%eax
171f: c7 05 60 1a 00 00 00 movl $0x0,0x1a60
1726: 00 00 00
1729: e9 3e ff ff ff jmp 166c <malloc+0x2c>
172e: 66 90 xchg %ax,%ax
00001730 <uacquire>:
#include "uspinlock.h"
#include "x86.h"
void
uacquire(struct uspinlock *lk)
{
1730: 55 push %ebp
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
1731: b9 01 00 00 00 mov $0x1,%ecx
1736: 89 e5 mov %esp,%ebp
1738: 8b 55 08 mov 0x8(%ebp),%edx
173b: 90 nop
173c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1740: 89 c8 mov %ecx,%eax
1742: f0 87 02 lock xchg %eax,(%edx)
// The xchg is atomic.
while(xchg(&lk->locked, 1) != 0)
1745: 85 c0 test %eax,%eax
1747: 75 f7 jne 1740 <uacquire+0x10>
;
// Tell the C compiler and the processor to not move loads or stores
// past this point, to ensure that the critical section's memory
// references happen after the lock is acquired.
__sync_synchronize();
1749: f0 83 0c 24 00 lock orl $0x0,(%esp)
}
174e: 5d pop %ebp
174f: c3 ret
00001750 <urelease>:
void urelease (struct uspinlock *lk) {
1750: 55 push %ebp
1751: 89 e5 mov %esp,%ebp
1753: 8b 45 08 mov 0x8(%ebp),%eax
__sync_synchronize();
1756: f0 83 0c 24 00 lock orl $0x0,(%esp)
// Release the lock, equivalent to lk->locked = 0.
// This code can't use a C assignment, since it might
// not be atomic. A real OS would use C atomics here.
asm volatile("movl $0, %0" : "+m" (lk->locked) : );
175b: c7 00 00 00 00 00 movl $0x0,(%eax)
}
1761: 5d pop %ebp
1762: c3 ret
|
libsrc/target/gal/scrolluptxt.asm | jpoikela/z88dk | 640 | 169101 | <reponame>jpoikela/z88dk
;
; Galaksija libraries
;
;--------------------------------------------------------------
; Text scrollup.
; Doesn't directly set the current cursor position
;--------------------------------------------------------------
;
; $Id: scrolluptxt.asm $
;
;----------------------------------------------------------------
SECTION code_clib
PUBLIC scrolluptxt
PUBLIC _scrolluptxt
scrolluptxt:
_scrolluptxt:
ld hl,$2800
push hl
ld de,32
add hl,de
pop de
ld bc,32*15
ldir
ld a,32
ld b,a
blankline:
ld (de),a
inc de
djnz blankline
ret
|
code_snippets/file/close.asm | smirzaei/systems-programming-class | 0 | 85014 | <gh_stars>0
; Stack
stk segment
dw 64 dup(?)
stk ends
; Data
dts segment
f_handle dw ?
fl_smsg db 'FILE CLOSED SUCCESSFULLY',10,13, '$'
fl_fmsg db 'FAILED TO CLOSE THE FILE',10,13, '$'
dts ends
; Code
cds segment
assume cs:cds,ss:stk,ds:dts
main proc far
; Close file
mov ah,3eh
mov bx,f_hndle
int 21h
jnc file_close_ok
file_close_nok:
mov ah,09h
mov dx,offset fl_fmsg
int 21h
jmp exit
file_close_ok:
mov ah,09h
mov dx,offset fl_smsg
int 21h
exit: ; terminate the program
mov ah,4ch
int 21h
main endp
cds ends
end main
|
src/spat-spark_files.ads | yannickmoy/spat | 0 | 23923 | <filename>src/spat-spark_files.ads
------------------------------------------------------------------------------
-- Copyright (C) 2020 by Heisenbug Ltd. (<EMAIL>)
--
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
------------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------------
--
-- SPARK Proof Analysis Tool
--
-- S.P.A.T. - Read .spark files
--
-- Collect file contents.
--
-- Please note that Read is parallelized and uses background threads, hence
-- you need to call Shutdown once you're done, otherwise the application will
-- hang.
--
------------------------------------------------------------------------------
limited with Ada.Containers.Hashed_Maps;
limited with SPAT.Strings;
package SPAT.Spark_Files is
-- .spark files are stored in a Hash map with the file name as key and the
-- JSON reading result as value.
package File_Maps is new Ada.Containers.Hashed_Maps
(Key_Type => File_Name,
Element_Type => GNATCOLL.JSON.Read_Result,
Hash => Hash,
Equivalent_Keys => "=",
"=" => GNATCOLL.JSON."=");
--
-- Some renames for commonly used File_Maps.Cursor operations.
--
No_Element : File_Maps.Cursor renames File_Maps.No_Element;
subtype Cursor is File_Maps.Cursor;
---------------------------------------------------------------------------
-- Key
---------------------------------------------------------------------------
function Key (C : in Cursor) return File_Name renames File_Maps.Key;
--
-- Data collection and operations defined on it.
--
type T is new File_Maps.Map with private;
-- Stores all data collected from SPARK files for analysis.
---------------------------------------------------------------------------
-- Read
---------------------------------------------------------------------------
not overriding
procedure Read (This : in out T;
Names : in Strings.File_Names);
-- Reads the list of files, and parses and stores their content in This.
---------------------------------------------------------------------------
-- Num_Workers
--
-- Report the number of tasks used for parallel file reads.
---------------------------------------------------------------------------
function Num_Workers return Positive;
---------------------------------------------------------------------------
-- Shutdown
--
-- Terminates all worker tasks.
---------------------------------------------------------------------------
procedure Shutdown;
private
type T is new File_Maps.Map with null record;
end SPAT.Spark_Files;
|
source/s-growth.ads | ytomino/drake | 33 | 22596 | pragma License (Unrestricted);
-- implementation unit
package System.Growth is
pragma Preelaborate;
generic
type Count_Type is range <>;
function Fast_Grow (Capacity : Count_Type) return Count_Type;
generic
type Count_Type is range <>;
Component_Size : Positive;
function Good_Grow (Capacity : Count_Type) return Count_Type;
generic
type Count_Type is range <>;
Component_Size : Positive;
package Scoped_Holder is
function Capacity return Count_Type;
procedure Reserve_Capacity (Capacity : Count_Type);
function Storage_Address return Address;
end Scoped_Holder;
end System.Growth;
|
programs/oeis/156/A156774.asm | karttu/loda | 1 | 169340 | <reponame>karttu/loda
; A156774: 6561n^2 - 3564n + 485.
; 485,3482,19601,48842,91205,146690,215297,297026,391877,499850,620945,755162,902501,1062962,1236545,1423250,1623077,1836026,2062097,2301290,2553605,2819042,3097601,3389282,3694085,4012010,4343057,4687226,5044517,5414930,5798465,6195122,6604901,7027802,7463825,7912970,8375237,8850626,9339137,9840770,10355525,10883402,11424401,11978522,12545765,13126130,13719617,14326226,14945957,15578810,16224785,16883882,17556101,18241442,18939905,19651490,20376197,21114026,21864977,22629050,23406245,24196562,25000001,25816562,26646245,27489050,28344977,29214026,30096197,30991490,31899905,32821442,33756101,34703882,35664785,36638810,37625957,38626226,39639617,40666130,41705765,42758522,43824401,44903402,45995525,47100770,48219137,49350626,50495237,51652970,52823825,54007802,55204901,56415122,57638465,58874930,60124517,61387226,62663057,63952010,65254085,66569282,67897601,69239042,70593605,71961290,73342097,74736026,76143077,77563250,78996545,80442962,81902501,83375162,84860945,86359850,87871877,89397026,90935297,92486690,94051205,95628842,97219601,98823482,100440485,102070610,103713857,105370226,107039717,108722330,110418065,112126922,113848901,115584002,117332225,119093570,120868037,122655626,124456337,126270170,128097125,129937202,131790401,133656722,135536165,137428730,139334417,141253226,143185157,145130210,147088385,149059682,151044101,153041642,155052305,157076090,159112997,161163026,163226177,165302450,167391845,169494362,171610001,173738762,175880645,178035650,180203777,182385026,184579397,186786890,189007505,191241242,193488101,195748082,198021185,200307410,202606757,204919226,207244817,209583530,211935365,214300322,216678401,219069602,221473925,223891370,226321937,228765626,231222437,233692370,236175425,238671602,241180901,243703322,246238865,248787530,251349317,253924226,256512257,259113410,261727685,264355082,266995601,269649242,272316005,274995890,277688897,280395026,283114277,285846650,288592145,291350762,294122501,296907362,299705345,302516450,305340677,308178026,311028497,313892090,316768805,319658642,322561601,325477682,328406885,331349210,334304657,337273226,340254917,343249730,346257665,349278722,352312901,355360202,358420625,361494170,364580837,367680626,370793537,373919570,377058725,380211002,383376401,386554922,389746565,392951330,396169217,399400226,402644357,405901610
mov $2,$0
mul $0,9
mov $1,$0
sub $0,5
mul $1,$0
add $2,4
mov $0,$2
add $0,8
add $1,5
add $1,$0
sub $1,17
mul $1,81
add $1,485
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/loop_optimization16.adb | best08618/asylo | 7 | 25228 | -- { dg-do run }
with Loop_Optimization16_Pkg; use Loop_Optimization16_Pkg;
procedure Loop_Optimization16 is
Counter : Natural := 0;
C : constant Natural := F;
subtype Index_T is Index_Base range 1 .. Index_Base (C);
begin
for I in Index_T'First .. Index_T'Last loop
Counter := Counter + 1;
exit when Counter > 200;
end loop;
if Counter > 200 then
raise Program_Error;
end if;
end Loop_Optimization16;
|
src/For-iterated-equality.agda | nad/equality | 3 | 3824 | <reponame>nad/equality
------------------------------------------------------------------------
-- Some results related to the For-iterated-equality predicate
-- transformer
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Equality
module For-iterated-equality
{c⁺} (eq : ∀ {a p} → Equality-with-J a p c⁺) where
open Derived-definitions-and-properties eq
open import Logical-equivalence using (_⇔_)
open import Prelude
open import Bijection eq as Bijection using (_↔_)
open import Equivalence eq as Eq using (_≃_)
open import Equivalence.Erased eq as EEq using (_≃ᴱ_)
open import Function-universe eq as F hiding (id; _∘_)
open import H-level eq
open import List eq
open import Nat eq
open import Surjection eq as Surj using (_↠_)
private
variable
a b ℓ p q : Level
A B : Type a
P Q R : Type p → Type p
x y : A
k : Kind
n : ℕ
------------------------------------------------------------------------
-- Some lemmas related to nested occurrences of For-iterated-equality
-- Nested uses of For-iterated-equality can be merged.
For-iterated-equality-For-iterated-equality′ :
{A : Type a} →
∀ m n →
For-iterated-equality m (For-iterated-equality n P) A ↝[ a ∣ a ]
For-iterated-equality (m + n) P A
For-iterated-equality-For-iterated-equality′ zero _ _ = F.id
For-iterated-equality-For-iterated-equality′ {P = P} {A = A}
(suc m) n ext =
((x y : A) →
For-iterated-equality m (For-iterated-equality n P) (x ≡ y)) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ →
For-iterated-equality-For-iterated-equality′ m n ext) ⟩□
((x y : A) → For-iterated-equality (m + n) P (x ≡ y)) □
-- A variant of the previous result.
For-iterated-equality-For-iterated-equality :
{A : Type a} →
∀ m n →
For-iterated-equality m (For-iterated-equality n P) A ↝[ a ∣ a ]
For-iterated-equality (n + m) P A
For-iterated-equality-For-iterated-equality {P = P} {A = A}
m n ext =
For-iterated-equality m (For-iterated-equality n P) A ↝⟨ For-iterated-equality-For-iterated-equality′ m n ext ⟩
For-iterated-equality (m + n) P A ↝⟨ ≡⇒↝ _ $ cong (λ n → For-iterated-equality n P A) (+-comm m) ⟩□
For-iterated-equality (n + m) P A □
------------------------------------------------------------------------
-- Preservation lemmas for For-iterated-equality
-- A preservation lemma for the predicate.
For-iterated-equality-cong₁ :
{P Q : Type ℓ → Type ℓ} →
Extensionality? k ℓ ℓ →
∀ n →
(∀ {A} → P A ↝[ k ] Q A) →
For-iterated-equality n P A ↝[ k ] For-iterated-equality n Q A
For-iterated-equality-cong₁ _ zero P↝Q = P↝Q
For-iterated-equality-cong₁ {A = A} {P = P} {Q = Q} ext (suc n) P↝Q =
((x y : A) → For-iterated-equality n P (x ≡ y)) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ →
For-iterated-equality-cong₁ ext n P↝Q) ⟩□
((x y : A) → For-iterated-equality n Q (x ≡ y)) □
-- A variant of For-iterated-equality-cong₁.
For-iterated-equality-cong₁ᴱ-→ :
{@0 A : Type ℓ} {@0 P Q : Type ℓ → Type ℓ} →
∀ n →
(∀ {@0 A} → P A → Q A) →
For-iterated-equality n P A → For-iterated-equality n Q A
For-iterated-equality-cong₁ᴱ-→ zero P→Q = P→Q
For-iterated-equality-cong₁ᴱ-→ {A = A} {P = P} {Q = Q} (suc n) P→Q =
((x y : A) → For-iterated-equality n P (x ≡ y)) →⟨ For-iterated-equality-cong₁ᴱ-→ n (λ {A} → P→Q {A = A}) ∘_ ∘_ ⟩□
((x y : A) → For-iterated-equality n Q (x ≡ y)) □
-- Preservation lemmas for both the predicate and the type.
For-iterated-equality-cong-→ :
∀ n →
(∀ {A B} → A ↠ B → P A → Q B) →
A ↠ B →
For-iterated-equality n P A → For-iterated-equality n Q B
For-iterated-equality-cong-→ zero P↝Q A↠B = P↝Q A↠B
For-iterated-equality-cong-→ {P = P} {Q = Q} {A = A} {B = B}
(suc n) P↝Q A↠B =
((x y : A) → For-iterated-equality n P (x ≡ y)) ↝⟨ (Π-cong-contra-→ (_↠_.from A↠B) λ _ → Π-cong-contra-→ (_↠_.from A↠B) λ _ →
For-iterated-equality-cong-→ n P↝Q $ Surj.↠-≡ A↠B) ⟩□
((x y : B) → For-iterated-equality n Q (x ≡ y)) □
For-iterated-equality-cong :
{P : Type p → Type p} {Q : Type q → Type q} →
Extensionality? k (p ⊔ q) (p ⊔ q) →
∀ n →
(∀ {A B} → A ↔ B → P A ↝[ k ] Q B) →
A ↔ B →
For-iterated-equality n P A ↝[ k ] For-iterated-equality n Q B
For-iterated-equality-cong _ zero P↝Q A↔B = P↝Q A↔B
For-iterated-equality-cong {A = A} {B = B} {P = P} {Q = Q}
ext (suc n) P↝Q A↔B =
((x y : A) → For-iterated-equality n P (x ≡ y)) ↝⟨ (Π-cong ext A↔B λ _ → Π-cong ext A↔B λ _ →
For-iterated-equality-cong ext n P↝Q $ inverse $ _≃_.bijection $
Eq.≃-≡ $ from-isomorphism A↔B) ⟩□
((x y : B) → For-iterated-equality n Q (x ≡ y)) □
------------------------------------------------------------------------
-- Some "closure properties" for the type
private
-- A lemma.
lift≡lift↔ : lift {ℓ = ℓ} x ≡ lift y ↔ x ≡ y
lift≡lift↔ = inverse $ _≃_.bijection $ Eq.≃-≡ $ Eq.↔⇒≃ Bijection.↑↔
-- Closure properties for ⊤.
For-iterated-equality-↑-⊤ :
Extensionality? k ℓ ℓ →
∀ n →
(∀ {A B} → A ↔ B → P A ↝[ k ] P B) →
P (↑ ℓ ⊤) ↝[ k ] For-iterated-equality n P (↑ ℓ ⊤)
For-iterated-equality-↑-⊤ _ zero _ = F.id
For-iterated-equality-↑-⊤ {P = P} ext (suc n) resp =
P (↑ _ ⊤) ↝⟨ For-iterated-equality-↑-⊤ ext n resp ⟩
For-iterated-equality n P (↑ _ ⊤) ↝⟨ For-iterated-equality-cong ext n resp $
inverse lift≡lift↔ F.∘ inverse tt≡tt↔⊤ F.∘ Bijection.↑↔ ⟩
For-iterated-equality n P (lift tt ≡ lift tt) ↝⟨ inverse-ext? (λ ext → drop-⊤-left-Π ext Bijection.↑↔) ext ⟩
((y : ↑ _ ⊤) → For-iterated-equality n P (lift tt ≡ y)) ↝⟨ inverse-ext? (λ ext → drop-⊤-left-Π ext Bijection.↑↔) ext ⟩□
((x y : ↑ _ ⊤) → For-iterated-equality n P (x ≡ y)) □
For-iterated-equality-⊤ :
Extensionality? k lzero lzero →
∀ n →
(∀ {A B} → A ↔ B → P A ↝[ k ] P B) →
P ⊤ ↝[ k ] For-iterated-equality n P ⊤
For-iterated-equality-⊤ {P = P} ext n resp =
P ⊤ ↝⟨ resp (inverse Bijection.↑↔) ⟩
P (↑ _ ⊤) ↝⟨ For-iterated-equality-↑-⊤ ext n resp ⟩
For-iterated-equality n P (↑ _ ⊤) ↝⟨ For-iterated-equality-cong ext n resp Bijection.↑↔ ⟩□
For-iterated-equality n P ⊤ □
-- Closure properties for ⊥.
For-iterated-equality-suc-⊥ :
{P : Type p → Type p} →
∀ n → ⊤ ↝[ p ∣ p ] For-iterated-equality (suc n) P ⊥
For-iterated-equality-suc-⊥ {P = P} n ext =
⊤ ↝⟨ inverse-ext? Π⊥↔⊤ ext ⟩□
((x y : ⊥) → For-iterated-equality n P (x ≡ y)) □
For-iterated-equality-⊥ :
{P : Type p → Type p} →
Extensionality? k p p →
∀ n →
⊤ ↝[ k ] P ⊥ →
⊤ ↝[ k ] For-iterated-equality n P ⊥
For-iterated-equality-⊥ _ zero = id
For-iterated-equality-⊥ ext (suc n) _ =
For-iterated-equality-suc-⊥ n ext
-- A closure property for Π.
For-iterated-equality-Π :
{A : Type a} {B : A → Type b} →
Extensionality a b →
∀ n →
(∀ {A B} → A ↔ B → Q A → Q B) →
({A : Type a} {B : A → Type b} →
(∀ x → P (B x)) → Q (∀ x → B x)) →
(∀ x → For-iterated-equality n P (B x)) →
For-iterated-equality n Q (∀ x → B x)
For-iterated-equality-Π _ zero _ hyp = hyp
For-iterated-equality-Π {Q = Q} {P = P} {B = B} ext (suc n) resp hyp =
(∀ x (y z : B x) → For-iterated-equality n P (y ≡ z)) ↝⟨ (λ hyp _ _ _ → hyp _ _ _) ⟩
(∀ (f g : ∀ x → B x) x → For-iterated-equality n P (f x ≡ g x)) ↝⟨ (∀-cong _ λ _ → ∀-cong _ λ _ → For-iterated-equality-Π ext n resp hyp) ⟩
((f g : ∀ x → B x) → For-iterated-equality n Q (∀ x → f x ≡ g x)) ↝⟨ (∀-cong _ λ _ → ∀-cong _ λ _ → For-iterated-equality-cong _ n resp $
from-isomorphism $ Eq.extensionality-isomorphism ext) ⟩□
((f g : ∀ x → B x) → For-iterated-equality n Q (f ≡ g)) □
-- A closure property for Σ.
For-iterated-equality-Σ :
{A : Type a} {B : A → Type b} →
∀ n →
(∀ {A B} → A ↔ B → R A → R B) →
({A : Type a} {B : A → Type b} →
P A → (∀ x → Q (B x)) → R (Σ A B)) →
For-iterated-equality n P A →
(∀ x → For-iterated-equality n Q (B x)) →
For-iterated-equality n R (Σ A B)
For-iterated-equality-Σ zero _ hyp = hyp
For-iterated-equality-Σ {R = R} {P = P} {Q = Q} {A = A} {B = B}
(suc n) resp hyp = curry (
((x y : A) → For-iterated-equality n P (x ≡ y)) ×
((x : A) (y z : B x) → For-iterated-equality n Q (y ≡ z)) ↝⟨ (λ (hyp₁ , hyp₂) _ _ → hyp₁ _ _ , λ _ → hyp₂ _ _ _) ⟩
(((x₁ , x₂) (y₁ , y₂) : Σ A B) →
For-iterated-equality n P (x₁ ≡ y₁) ×
(∀ p → For-iterated-equality n Q (subst B p x₂ ≡ y₂))) ↝⟨ (∀-cong _ λ _ → ∀-cong _ λ _ → uncurry $
For-iterated-equality-Σ n resp hyp) ⟩
(((x₁ , x₂) (y₁ , y₂) : Σ A B) →
For-iterated-equality n R (∃ λ (p : x₁ ≡ y₁) → subst B p x₂ ≡ y₂)) ↝⟨ (∀-cong _ λ _ → ∀-cong _ λ _ →
For-iterated-equality-cong _ n resp Bijection.Σ-≡,≡↔≡) ⟩□
((x y : Σ A B) → For-iterated-equality n R (x ≡ y)) □)
-- A closure property for _×_.
For-iterated-equality-× :
{A : Type a} {B : Type b} →
∀ n →
(∀ {A B} → A ↔ B → R A → R B) →
({A : Type a} {B : Type b} → P A → Q B → R (A × B)) →
For-iterated-equality n P A →
For-iterated-equality n Q B →
For-iterated-equality n R (A × B)
For-iterated-equality-× zero _ hyp = hyp
For-iterated-equality-× {R = R} {P = P} {Q = Q} {A = A} {B = B}
(suc n) resp hyp = curry (
((x y : A) → For-iterated-equality n P (x ≡ y)) ×
((x y : B) → For-iterated-equality n Q (x ≡ y)) ↝⟨ (λ (hyp₁ , hyp₂) _ _ → hyp₁ _ _ , hyp₂ _ _) ⟩
(((x₁ , x₂) (y₁ , y₂) : A × B) →
For-iterated-equality n P (x₁ ≡ y₁) ×
For-iterated-equality n Q (x₂ ≡ y₂)) ↝⟨ (∀-cong _ λ _ → ∀-cong _ λ _ → uncurry $
For-iterated-equality-× n resp hyp) ⟩
(((x₁ , x₂) (y₁ , y₂) : A × B) →
For-iterated-equality n R (x₁ ≡ y₁ × x₂ ≡ y₂)) ↝⟨ (∀-cong _ λ _ → ∀-cong _ λ _ →
For-iterated-equality-cong _ n resp ≡×≡↔≡) ⟩□
((x y : A × B) → For-iterated-equality n R (x ≡ y)) □)
-- A closure property for ↑.
For-iterated-equality-↑ :
{A : Type a} {Q : Type (a ⊔ ℓ) → Type (a ⊔ ℓ)} →
Extensionality? k (a ⊔ ℓ) (a ⊔ ℓ) →
∀ n →
(∀ {A B} → A ↔ B → P A ↝[ k ] Q B) →
For-iterated-equality n P A ↝[ k ]
For-iterated-equality n Q (↑ ℓ A)
For-iterated-equality-↑ ext n resp =
For-iterated-equality-cong ext n resp (inverse Bijection.↑↔)
-- Closure properties for W.
For-iterated-equality-W-suc :
{A : Type a} {B : A → Type b} →
Extensionality b (a ⊔ b) →
∀ n →
(∀ {A B} → A ↔ B → Q A → Q B) →
({A : Type b} {B : A → Type (a ⊔ b)} →
(∀ x → Q (B x)) → Q (∀ x → B x)) →
({A : Type a} {B : A → Type (a ⊔ b)} →
P A → (∀ x → Q (B x)) → Q (Σ A B)) →
For-iterated-equality (suc n) P A →
For-iterated-equality (suc n) Q (W A B)
For-iterated-equality-W-suc {Q = Q} {P = P} {B = B}
ext n resp hyp-Π hyp-Σ fie = lemma
where
lemma : ∀ x y → For-iterated-equality n Q (x ≡ y)
lemma (sup x f) (sup y g) = $⟨ (λ p i → lemma (f i) _) ⟩
(∀ p i → For-iterated-equality n Q (f i ≡ g (subst B p i))) ↝⟨ (∀-cong _ λ _ → For-iterated-equality-Π ext n resp hyp-Π) ⟩
(∀ p → For-iterated-equality n Q (∀ i → f i ≡ g (subst B p i))) ↝⟨ fie _ _ ,_ ⟩
For-iterated-equality n P (x ≡ y) ×
(∀ p → For-iterated-equality n Q (∀ i → f i ≡ g (subst B p i))) ↝⟨ uncurry $ For-iterated-equality-Σ n resp hyp-Σ ⟩
For-iterated-equality n Q
(∃ λ (p : x ≡ y) → ∀ i → f i ≡ g (subst B p i)) ↝⟨ For-iterated-equality-cong _ n resp $ _≃_.bijection $ Eq.W-≡,≡≃≡ ext ⟩□
For-iterated-equality n Q (sup x f ≡ sup y g) □
For-iterated-equality-W :
{A : Type a} {B : A → Type b} →
Extensionality b (a ⊔ b) →
∀ n →
(∀ {A B} → A ↔ B → Q A → Q B) →
({A : Type b} {B : A → Type (a ⊔ b)} →
(∀ x → Q (B x)) → Q (∀ x → B x)) →
({A : Type a} {B : A → Type (a ⊔ b)} →
P A → (∀ x → Q (B x)) → Q (Σ A B)) →
(P A → Q (W A B)) →
For-iterated-equality n P A →
For-iterated-equality n Q (W A B)
For-iterated-equality-W _ zero _ _ _ hyp-W = hyp-W
For-iterated-equality-W ext (suc n) resp hyp-Π hyp-Σ _ =
For-iterated-equality-W-suc ext n resp hyp-Π hyp-Σ
-- Closure properties for _⊎_.
For-iterated-equality-⊎-suc :
{A : Type a} {B : Type b} →
∀ n →
(∀ {A B} → A ↔ B → P A → P B) →
P ⊥ →
For-iterated-equality (suc n) P (↑ b A) →
For-iterated-equality (suc n) P (↑ a B) →
For-iterated-equality (suc n) P (A ⊎ B)
For-iterated-equality-⊎-suc {P = P} n resp hyp-⊥ fie-A fie-B = λ where
(inj₁ x) (inj₁ y) → $⟨ fie-A (lift x) (lift y) ⟩
For-iterated-equality n P (lift x ≡ lift y) ↝⟨ For-iterated-equality-cong _ n resp (Bijection.≡↔inj₁≡inj₁ F.∘ lift≡lift↔) ⟩□
For-iterated-equality n P (inj₁ x ≡ inj₁ y) □
(inj₂ x) (inj₂ y) → $⟨ fie-B (lift x) (lift y) ⟩
For-iterated-equality n P (lift x ≡ lift y) ↝⟨ For-iterated-equality-cong _ n resp (Bijection.≡↔inj₂≡inj₂ F.∘ lift≡lift↔) ⟩□
For-iterated-equality n P (inj₂ x ≡ inj₂ y) □
(inj₁ x) (inj₂ y) → $⟨ hyp-⊥ ⟩
P ⊥ ↝⟨ (λ hyp → For-iterated-equality-⊥ _ n (λ _ → hyp) _) ⟩
For-iterated-equality n P ⊥ ↝⟨ For-iterated-equality-cong _ n resp (inverse Bijection.≡↔⊎) ⟩□
For-iterated-equality n P (inj₁ x ≡ inj₂ y) □
(inj₂ x) (inj₁ y) → $⟨ hyp-⊥ ⟩
P ⊥ ↝⟨ (λ hyp → For-iterated-equality-⊥ _ n (λ _ → hyp) _) ⟩
For-iterated-equality n P ⊥ ↝⟨ For-iterated-equality-cong _ n resp (inverse Bijection.≡↔⊎) ⟩□
For-iterated-equality n P (inj₂ x ≡ inj₁ y) □
For-iterated-equality-⊎ :
{A : Type a} {B : Type b} →
∀ n →
(∀ {A B} → A ↔ B → P A → P B) →
P ⊥ →
(P (↑ b A) → P (↑ a B) → P (A ⊎ B)) →
For-iterated-equality n P (↑ b A) →
For-iterated-equality n P (↑ a B) →
For-iterated-equality n P (A ⊎ B)
For-iterated-equality-⊎ zero _ _ hyp-⊎ = hyp-⊎
For-iterated-equality-⊎ (suc n) resp hyp-⊥ _ =
For-iterated-equality-⊎-suc n resp hyp-⊥
-- Closure properties for List.
For-iterated-equality-List-suc :
{A : Type a} →
∀ n →
(∀ {A B} → A ↔ B → P A → P B) →
P (↑ a ⊤) →
P ⊥ →
(∀ {A B} → P A → P B → P (A × B)) →
For-iterated-equality (suc n) P A →
For-iterated-equality (suc n) P (List A)
For-iterated-equality-List-suc {P = P} n resp hyp-⊤ hyp-⊥ hyp-× fie = λ where
[] [] → $⟨ hyp-⊤ ⟩
P (↑ _ ⊤) ↝⟨ For-iterated-equality-↑-⊤ _ n resp ⟩
For-iterated-equality n P (↑ _ ⊤) ↝⟨ For-iterated-equality-cong _ n resp (inverse []≡[]↔⊤ F.∘ Bijection.↑↔) ⟩□
For-iterated-equality n P ([] ≡ []) □
(x ∷ xs) (y ∷ ys) → $⟨ For-iterated-equality-List-suc n resp hyp-⊤ hyp-⊥ hyp-× fie xs ys ⟩
For-iterated-equality n P (xs ≡ ys) ↝⟨ fie _ _ ,_ ⟩
For-iterated-equality n P (x ≡ y) ×
For-iterated-equality n P (xs ≡ ys) ↝⟨ uncurry $ For-iterated-equality-× n resp hyp-× ⟩
For-iterated-equality n P (x ≡ y × xs ≡ ys) ↝⟨ For-iterated-equality-cong _ n resp (inverse ∷≡∷↔≡×≡) ⟩□
For-iterated-equality n P (x ∷ xs ≡ y ∷ ys) □
[] (y ∷ ys) → $⟨ hyp-⊥ ⟩
P ⊥ ↝⟨ (λ hyp → For-iterated-equality-⊥ _ n (λ _ → hyp) _) ⟩
For-iterated-equality n P ⊥ ↝⟨ For-iterated-equality-cong _ n resp (inverse []≡∷↔⊥) ⟩□
For-iterated-equality n P ([] ≡ y ∷ ys) □
(x ∷ xs) [] → $⟨ hyp-⊥ ⟩
P ⊥ ↝⟨ (λ hyp → For-iterated-equality-⊥ _ n (λ _ → hyp) _) ⟩
For-iterated-equality n P ⊥ ↝⟨ For-iterated-equality-cong _ n resp (inverse ∷≡[]↔⊥) ⟩□
For-iterated-equality n P (x ∷ xs ≡ []) □
For-iterated-equality-List :
{A : Type a} →
∀ n →
(∀ {A B} → A ↔ B → P A → P B) →
P (↑ a ⊤) →
P ⊥ →
(∀ {A B} → P A → P B → P (A × B)) →
(P A → P (List A)) →
For-iterated-equality n P A →
For-iterated-equality n P (List A)
For-iterated-equality-List zero _ _ _ _ hyp-List = hyp-List
For-iterated-equality-List (suc n) resp hyp-⊤ hyp-⊥ hyp-× _ =
For-iterated-equality-List-suc n resp hyp-⊤ hyp-⊥ hyp-×
------------------------------------------------------------------------
-- Some "closure properties" for the predicate
-- For-iterated-equality commutes with certain type constructors
-- (assuming extensionality).
For-iterated-equality-commutes :
Extensionality? k ℓ ℓ →
(F : Type ℓ → Type ℓ) →
∀ n →
({A : Type ℓ} {P : A → Type ℓ} →
F (∀ x → P x) ↝[ k ] ∀ x → F (P x)) →
F (For-iterated-equality n P A) ↝[ k ]
For-iterated-equality n (F ∘ P) A
For-iterated-equality-commutes _ _ zero _ = F.id
For-iterated-equality-commutes {P = P} {A = A} ext F (suc n) hyp =
F ((x y : A) → For-iterated-equality n P (x ≡ y)) ↝⟨ hyp ⟩
((x : A) → F ((y : A) → For-iterated-equality n P (x ≡ y))) ↝⟨ (∀-cong ext λ _ → hyp) ⟩
((x y : A) → F (For-iterated-equality n P (x ≡ y))) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → For-iterated-equality-commutes ext F n hyp) ⟩□
((x y : A) → For-iterated-equality n (F ∘ P) (x ≡ y)) □
-- A variant of For-iterated-equality-commutes.
For-iterated-equality-commutesᴱ-→ :
{@0 A : Type ℓ} {@0 P : Type ℓ → Type ℓ}
(@0 F : Type ℓ → Type ℓ) →
∀ n →
({@0 A : Type ℓ} {@0 P : A → Type ℓ} →
F (∀ x → P x) → ∀ x → F (P x)) →
F (For-iterated-equality n P A) →
For-iterated-equality n (F ∘ P) A
For-iterated-equality-commutesᴱ-→ _ zero _ = id
For-iterated-equality-commutesᴱ-→ {A = A} {P = P} F (suc n) hyp =
F ((x y : A) → For-iterated-equality n P (x ≡ y)) →⟨ hyp ⟩
((x : A) → F ((y : A) → For-iterated-equality n P (x ≡ y))) →⟨ hyp ∘_ ⟩
((x y : A) → F (For-iterated-equality n P (x ≡ y))) →⟨ For-iterated-equality-commutesᴱ-→ F n hyp ∘_ ∘_ ⟩□
((x y : A) → For-iterated-equality n (F ∘ P) (x ≡ y)) □
-- Another variant of For-iterated-equality-commutes.
For-iterated-equality-commutes-← :
Extensionality? k ℓ ℓ →
(F : Type ℓ → Type ℓ) →
∀ n →
({A : Type ℓ} {P : A → Type ℓ} →
(∀ x → F (P x)) ↝[ k ] F (∀ x → P x)) →
For-iterated-equality n (F ∘ P) A ↝[ k ]
F (For-iterated-equality n P A)
For-iterated-equality-commutes-← _ _ zero _ = F.id
For-iterated-equality-commutes-← {P = P} {A = A} ext F (suc n) hyp =
((x y : A) → For-iterated-equality n (F ∘ P) (x ≡ y)) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → For-iterated-equality-commutes-← ext F n hyp) ⟩
((x y : A) → F (For-iterated-equality n P (x ≡ y))) ↝⟨ (∀-cong ext λ _ → hyp) ⟩
((x : A) → F ((y : A) → For-iterated-equality n P (x ≡ y))) ↝⟨ hyp ⟩□
F ((x y : A) → For-iterated-equality n P (x ≡ y)) □
-- A variant of For-iterated-equality-commutes-←.
For-iterated-equality-commutesᴱ-← :
{@0 A : Type ℓ} {@0 P : Type ℓ → Type ℓ}
(@0 F : Type ℓ → Type ℓ) →
∀ n →
({@0 A : Type ℓ} {@0 P : A → Type ℓ} →
(∀ x → F (P x)) → F (∀ x → P x)) →
For-iterated-equality n (F ∘ P) A →
F (For-iterated-equality n P A)
For-iterated-equality-commutesᴱ-← _ zero _ = id
For-iterated-equality-commutesᴱ-← {A = A} {P = P} F (suc n) hyp =
((x y : A) → For-iterated-equality n (F ∘ P) (x ≡ y)) →⟨ For-iterated-equality-commutesᴱ-← F n hyp ∘_ ∘_ ⟩
((x y : A) → F (For-iterated-equality n P (x ≡ y))) →⟨ hyp ∘_ ⟩
((x : A) → F ((y : A) → For-iterated-equality n P (x ≡ y))) →⟨ hyp ⟩□
F ((x y : A) → For-iterated-equality n P (x ≡ y)) □
-- For-iterated-equality commutes with certain binary type
-- constructors (assuming extensionality).
For-iterated-equality-commutes₂ :
Extensionality? k ℓ ℓ →
(F : Type ℓ → Type ℓ → Type ℓ) →
∀ n →
({A : Type ℓ} {P Q : A → Type ℓ} →
F (∀ x → P x) (∀ x → Q x) ↝[ k ] ∀ x → F (P x) (Q x)) →
F (For-iterated-equality n P A) (For-iterated-equality n Q A) ↝[ k ]
For-iterated-equality n (λ A → F (P A) (Q A)) A
For-iterated-equality-commutes₂ _ _ zero _ = F.id
For-iterated-equality-commutes₂ {P = P} {A = A} {Q = Q}
ext F (suc n) hyp =
F ((x y : A) → For-iterated-equality n P (x ≡ y))
((x y : A) → For-iterated-equality n Q (x ≡ y)) ↝⟨ hyp ⟩
((x : A) → F ((y : A) → For-iterated-equality n P (x ≡ y))
((y : A) → For-iterated-equality n Q (x ≡ y))) ↝⟨ (∀-cong ext λ _ → hyp) ⟩
((x y : A) → F (For-iterated-equality n P (x ≡ y))
(For-iterated-equality n Q (x ≡ y))) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ →
For-iterated-equality-commutes₂ ext F n hyp) ⟩□
((x y : A) → For-iterated-equality n (λ A → F (P A) (Q A)) (x ≡ y)) □
-- A variant of For-iterated-equality-commutes₂.
For-iterated-equality-commutes₂ᴱ-→ :
{@0 A : Type ℓ} {@0 P Q : Type ℓ → Type ℓ}
(@0 F : Type ℓ → Type ℓ → Type ℓ) →
∀ n →
({@0 A : Type ℓ} {@0 P Q : A → Type ℓ} →
F (∀ x → P x) (∀ x → Q x) → ∀ x → F (P x) (Q x)) →
F (For-iterated-equality n P A) (For-iterated-equality n Q A) →
For-iterated-equality n (λ A → F (P A) (Q A)) A
For-iterated-equality-commutes₂ᴱ-→ _ zero _ = id
For-iterated-equality-commutes₂ᴱ-→ {A = A} {P = P} {Q = Q}
F (suc n) hyp =
F ((x y : A) → For-iterated-equality n P (x ≡ y))
((x y : A) → For-iterated-equality n Q (x ≡ y)) →⟨ hyp ⟩
((x : A) → F ((y : A) → For-iterated-equality n P (x ≡ y))
((y : A) → For-iterated-equality n Q (x ≡ y))) →⟨ hyp ∘_ ⟩
((x y : A) → F (For-iterated-equality n P (x ≡ y))
(For-iterated-equality n Q (x ≡ y))) →⟨ For-iterated-equality-commutes₂ᴱ-→ F n hyp ∘_ ∘_ ⟩□
((x y : A) → For-iterated-equality n (λ A → F (P A) (Q A)) (x ≡ y)) □
-- Another variant of For-iterated-equality-commutes₂.
For-iterated-equality-commutes₂-← :
Extensionality? k ℓ ℓ →
(F : Type ℓ → Type ℓ → Type ℓ) →
∀ n →
({A : Type ℓ} {P Q : A → Type ℓ} →
(∀ x → F (P x) (Q x)) ↝[ k ] F (∀ x → P x) (∀ x → Q x)) →
For-iterated-equality n (λ A → F (P A) (Q A)) A ↝[ k ]
F (For-iterated-equality n P A) (For-iterated-equality n Q A)
For-iterated-equality-commutes₂-← _ _ zero _ = F.id
For-iterated-equality-commutes₂-← {P = P} {Q = Q} {A = A}
ext F (suc n) hyp =
((x y : A) → For-iterated-equality n (λ A → F (P A) (Q A)) (x ≡ y)) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ →
For-iterated-equality-commutes₂-← ext F n hyp) ⟩
((x y : A) → F (For-iterated-equality n P (x ≡ y))
(For-iterated-equality n Q (x ≡ y))) ↝⟨ (∀-cong ext λ _ → hyp) ⟩
((x : A) → F ((y : A) → For-iterated-equality n P (x ≡ y))
((y : A) → For-iterated-equality n Q (x ≡ y))) ↝⟨ hyp ⟩□
F ((x y : A) → For-iterated-equality n P (x ≡ y))
((x y : A) → For-iterated-equality n Q (x ≡ y)) □
-- A variant of For-iterated-equality-commutes₂-←.
For-iterated-equality-commutes₂ᴱ-← :
{@0 A : Type ℓ} {@0 P Q : Type ℓ → Type ℓ}
(@0 F : Type ℓ → Type ℓ → Type ℓ) →
∀ n →
({@0 A : Type ℓ} {@0 P Q : A → Type ℓ} →
(∀ x → F (P x) (Q x)) → F (∀ x → P x) (∀ x → Q x)) →
For-iterated-equality n (λ A → F (P A) (Q A)) A →
F (For-iterated-equality n P A) (For-iterated-equality n Q A)
For-iterated-equality-commutes₂ᴱ-← _ zero _ = id
For-iterated-equality-commutes₂ᴱ-← {A = A} {P = P} {Q = Q}
F (suc n) hyp =
((x y : A) → For-iterated-equality n (λ A → F (P A) (Q A)) (x ≡ y)) →⟨ For-iterated-equality-commutes₂ᴱ-← F n hyp ∘_ ∘_ ⟩
((x y : A) → F (For-iterated-equality n P (x ≡ y))
(For-iterated-equality n Q (x ≡ y))) →⟨ hyp ∘_ ⟩
((x : A) → F ((y : A) → For-iterated-equality n P (x ≡ y))
((y : A) → For-iterated-equality n Q (x ≡ y))) →⟨ hyp ⟩□
F ((x y : A) → For-iterated-equality n P (x ≡ y))
((x y : A) → For-iterated-equality n Q (x ≡ y)) □
-- A corollary of For-iterated-equality-commutes₂.
For-iterated-equality-commutes-× :
{A : Type a} →
∀ n →
For-iterated-equality n P A × For-iterated-equality n Q A ↝[ a ∣ a ]
For-iterated-equality n (λ A → P A × Q A) A
For-iterated-equality-commutes-× n ext =
For-iterated-equality-commutes₂ ext _×_ n
(from-isomorphism $ inverse ΠΣ-comm)
-- Some corollaries of For-iterated-equality-commutes₂ᴱ-→.
For-iterated-equality-commutesᴱ-×-→ :
{@0 A : Type ℓ} {@0 P Q : Type ℓ → Type ℓ} →
∀ n →
For-iterated-equality n P A × For-iterated-equality n Q A →
For-iterated-equality n (λ A → P A × Q A) A
For-iterated-equality-commutesᴱ-×-→ n =
For-iterated-equality-commutes₂ᴱ-→ _×_ n
(λ (f , g) x → f x , g x)
For-iterated-equality-commutes-⊎ :
{@0 A : Type ℓ} {@0 P Q : Type ℓ → Type ℓ} →
∀ n →
For-iterated-equality n P A ⊎ For-iterated-equality n Q A →
For-iterated-equality n (λ A → P A ⊎ Q A) A
For-iterated-equality-commutes-⊎ n =
For-iterated-equality-commutes₂ᴱ-→ _⊎_ n
[ (λ f x → inj₁ (f x)) , (λ f x → inj₂ (f x)) ]
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1644.asm | ljhsiun2/medusa | 9 | 80306 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r14
push %r8
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x9069, %rsi
lea addresses_A_ht+0x23e9, %rdi
nop
nop
nop
nop
add $43753, %r8
mov $41, %rcx
rep movsl
nop
and %r12, %r12
lea addresses_normal_ht+0x13235, %r14
nop
nop
nop
nop
nop
and %r11, %r11
vmovups (%r14), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $1, %xmm6, %r12
nop
nop
nop
nop
nop
dec %r8
lea addresses_D_ht+0x1e429, %rsi
clflush (%rsi)
nop
nop
nop
nop
nop
add $12359, %r14
mov (%rsi), %rcx
nop
nop
and $48942, %r11
lea addresses_D_ht+0xf269, %rsi
lea addresses_UC_ht+0xee69, %rdi
nop
add %r13, %r13
mov $120, %rcx
rep movsb
nop
nop
nop
xor $12687, %rsi
lea addresses_WT_ht+0x136e5, %rsi
lea addresses_normal_ht+0x10f49, %rdi
clflush (%rdi)
nop
nop
nop
lfence
mov $13, %rcx
rep movsl
nop
nop
nop
nop
sub %r8, %r8
lea addresses_A_ht+0x18305, %r12
nop
nop
nop
nop
dec %rdi
mov (%r12), %r14
nop
nop
nop
nop
xor $31125, %r11
lea addresses_WT_ht+0x9469, %r12
nop
and $62813, %r13
movl $0x61626364, (%r12)
nop
nop
nop
and $48419, %r13
lea addresses_WT_ht+0x6c89, %r12
nop
xor $26883, %rdi
mov $0x6162636465666768, %r11
movq %r11, (%r12)
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_UC_ht+0x8135, %r13
nop
nop
nop
nop
xor %rsi, %rsi
mov $0x6162636465666768, %r11
movq %r11, %xmm5
movups %xmm5, (%r13)
nop
nop
xor $33839, %r8
lea addresses_UC_ht+0x10869, %rcx
nop
nop
inc %r11
vmovups (%rcx), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %rdi
xor %rsi, %rsi
lea addresses_A_ht+0x19e79, %r8
nop
nop
nop
nop
nop
xor %rdi, %rdi
mov (%r8), %r13
nop
nop
nop
nop
xor %r12, %r12
lea addresses_normal_ht+0x17e0f, %r11
nop
nop
nop
and %r13, %r13
movl $0x61626364, (%r11)
nop
nop
nop
inc %rsi
pop %rsi
pop %rdi
pop %rcx
pop %r8
pop %r14
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %rax
push %rbx
push %rdi
push %rsi
// Store
lea addresses_D+0x16fb9, %r13
nop
nop
nop
nop
nop
sub $39074, %r12
movl $0x51525354, (%r13)
nop
xor $10344, %rax
// Store
lea addresses_PSE+0x19169, %rsi
nop
nop
add $38506, %r12
movb $0x51, (%rsi)
nop
and $35046, %rbx
// Store
lea addresses_normal+0x3201, %rsi
nop
nop
nop
nop
and $62847, %rdi
movb $0x51, (%rsi)
nop
add %rdi, %rdi
// Store
lea addresses_RW+0x1eb69, %rbx
nop
nop
nop
nop
nop
add $11216, %r12
mov $0x5152535455565758, %rsi
movq %rsi, %xmm2
vmovups %ymm2, (%rbx)
nop
nop
nop
dec %r13
// Store
lea addresses_PSE+0x1de69, %rsi
nop
nop
nop
dec %r14
movb $0x51, (%rsi)
nop
sub %rbx, %rbx
// Faulty Load
lea addresses_D+0x9c69, %rsi
nop
add $20542, %rdi
vmovups (%rsi), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %r12
lea oracles, %rbx
and $0xff, %r12
shlq $12, %r12
mov (%rbx,%r12,1), %r12
pop %rsi
pop %rdi
pop %rbx
pop %rax
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': True, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 9}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 9}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 6}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 3}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
libsrc/target/zx/if1/if1_write_record.asm | jpoikela/z88dk | 38 | 80248 | ;
; ZX IF1 & Microdrive functions
; write a new record for the current buffer
;
; if1_write_record (int drive, struct M_CHAN buffer);
;
; This one is similar to "write sector" but fixes the record header.
; It is necessary to load a copy of the microdirve MAP and to pass it
; putting its location into the record structure.;
;
; $Id: if1_write_record.asm,v 1.4 2017-01-03 01:40:06 aralbrec Exp $
;
SECTION code_clib
PUBLIC if1_write_record
PUBLIC _if1_write_record
if1_write_record:
_if1_write_record:
rst 8
defb 31h ; Create Interface 1 system vars if required
push ix ;save callers
ld ix,4
add ix,sp
ld a,(ix+2)
ld hl,-1
and a ; drive no. = 0 ?
jr z,if1_write_record_exit ; yes, return -1
dec a
cp 8 ; drive no. >8 ?
jr nc,if1_write_record_exit ; yes, return -1
inc a
;push af
ld ($5cd6),a
ld hl,1
ld ($5cda),hl ; filename length
ld hl,filename ; filename location
ld (5cdch),hl ; pointer to filename
ld l,(ix+0) ; buffer
ld h,(ix+1)
push hl
pop ix
rst 8
defb 26h ; Write Record
;pop ix
;rst 8
;defb 23h ; (close)
;rst 8
;defb 2Ch ; reclaim buffer
xor a
rst 8
defb 21h ; Switch microdrive motor off (a=0)
if1_write_record_exit:
pop ix ; restore callers
ret
SECTION rodata_clib
filename: defm 3
|
programs/oeis/269/A269723.asm | karttu/loda | 0 | 243301 | <filename>programs/oeis/269/A269723.asm
; A269723: Start with A_0 = 0, then extend by setting B_k = complement of A_k and A_{k+1} = A_k A_k B_k B_k; sequence is limit of A_k as k -> infinity.
; 0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,1
mul $0,2
lpb $0,1
div $0,4
mod $1,2
add $1,$0
lpe
|
programs/oeis/174/A174334.asm | karttu/loda | 1 | 247669 | <reponame>karttu/loda
; A174334: 73*n^2.
; 0,73,292,657,1168,1825,2628,3577,4672,5913,7300,8833,10512,12337,14308,16425,18688,21097,23652,26353,29200,32193,35332,38617,42048,45625,49348,53217,57232,61393,65700,70153,74752,79497,84388,89425,94608,99937,105412,111033,116800,122713,128772,134977,141328,147825,154468,161257,168192,175273,182500,189873,197392,205057,212868,220825,228928,237177,245572,254113,262800,271633,280612,289737,299008,308425,317988,327697,337552,347553,357700,367993,378432,389017,399748,410625,421648,432817,444132,455593,467200,478953,490852,502897,515088,527425,539908,552537,565312,578233,591300,604513,617872,631377,645028,658825,672768,686857,701092,715473,730000,744673,759492,774457,789568,804825,820228,835777,851472,867313,883300,899433,915712,932137,948708,965425,982288,999297,1016452,1033753,1051200,1068793,1086532,1104417,1122448,1140625,1158948,1177417,1196032,1214793,1233700,1252753,1271952,1291297,1310788,1330425,1350208,1370137,1390212,1410433,1430800,1451313,1471972,1492777,1513728,1534825,1556068,1577457,1598992,1620673,1642500,1664473,1686592,1708857,1731268,1753825,1776528,1799377,1822372,1845513,1868800,1892233,1915812,1939537,1963408,1987425,2011588,2035897,2060352,2084953,2109700,2134593,2159632,2184817,2210148,2235625,2261248,2287017,2312932,2338993,2365200,2391553,2418052,2444697,2471488,2498425,2525508,2552737,2580112,2607633,2635300,2663113,2691072,2719177,2747428,2775825,2804368,2833057,2861892,2890873,2920000,2949273,2978692,3008257,3037968,3067825,3097828,3127977,3158272,3188713,3219300,3250033,3280912,3311937,3343108,3374425,3405888,3437497,3469252,3501153,3533200,3565393,3597732,3630217,3662848,3695625,3728548,3761617,3794832,3828193,3861700,3895353,3929152,3963097,3997188,4031425,4065808,4100337,4135012,4169833,4204800,4239913,4275172,4310577,4346128,4381825,4417668,4453657,4489792,4526073
mov $1,$0
pow $1,2
mul $1,73
|
dino/lcs/enemy/22.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 161548 | <reponame>zengfr/arcade_game_romhacking_sourcecode_top_secret_data<filename>dino/lcs/enemy/22.asm
copyright zengfr site:http://github.com/zengfr/romhack
00042A move.l D1, (A0)+
00042C dbra D0, $42a
0017BA move.b ($22,A6), D0
0017BE lsl.w #2, D0 [enemy+22]
001868 move.b ($22,A6), D0
00186C lsl.w #2, D0 [enemy+22]
00491E move.l D0, (A4)+
004920 move.l D0, (A4)+
004D38 move.l D0, (A4)+
004D3A move.l D0, (A4)+
0324D4 move.b ($22,A6), D0
0324D8 lsr.b #4, D0 [enemy+22]
032A6A move.b D0, ($22,A6)
032A6E rts [enemy+22]
032A82 move.b D0, ($22,A6)
032A86 rts [enemy+22]
032AA6 move.b D0, ($22,A6)
032AAA rts [enemy+22]
032ADE move.b D0, ($22,A6)
032AE2 rts [enemy+22]
0339F2 move.b D1, ($22,A6)
0339F6 move.b D2, ($24,A6) [enemy+22]
033A80 move.b D1, ($22,A6)
033A84 move.b D2, ($24,A6) [enemy+22]
034690 cmpi.b #$10, ($22,A6)
034696 bcc $3469a [enemy+22]
035208 move.b ($22,A6), D1
03520C sub.b D0, D1 [enemy+22]
035224 add.b ($22,A6), D2
035228 move.w D2, D0 [enemy+22]
03522E move.b D0, ($22,A6)
035232 moveq #$0, D1 [enemy+22]
035290 move.b D0, ($22,A6)
035294 rts [enemy+22]
0352DA move.b D0, ($22,A6)
0352DE moveq #$0, D1 [enemy+22]
0354A0 move.b D0, ($22,A6)
0354A4 move.b #$32, ($a6,A6) [enemy+22]
035676 move.b ($22,A6), D1
03567A sub.b D0, D1 [enemy+22]
035692 add.b ($22,A6), D2
035696 move.w D2, D0 [enemy+22]
03569C move.b D0, ($22,A6)
0356A0 rts [enemy+22]
035772 move.b ($22,A6), D0
035776 subq.b #6, D0 [enemy+22]
03580A bchg #$4, ($22,A6) [enemy+7C]
035810 rts [enemy+22]
03591C move.b ($22,A6), ($22,A0)
035922 move.b ($96,A6), ($96,A0)
035952 move.b ($22,A0), ($22,A1)
035958 move.w ($8,A0), ($8,A1)
0359D4 move.b #$18, ($22,A6)
0359DA moveq #$0, D0 [enemy+22]
035EAE tst.b ($22,A6)
035EB2 beq $35ec6 [enemy+22]
035EB6 cmpi.b #$10, ($22,A6)
035EBC bge $35ec6 [enemy+22]
0364CA move.b ($22,A6), D0
0364CE sub.b ($a4,A6), D0 [enemy+22]
0364F8 move.b D0, ($22,A6)
0364FC bra $3650e [enemy+22]
03650A move.b D0, ($22,A6)
03650E rts [enemy+22]
036580 move.b ($22,A6), D0
036584 addq.b #8, D0 [enemy+22]
0365AC move.b #$10, ($22,A6)
0365B2 jsr $119c.l [enemy+22]
0365C0 ble $365d0
0365D0 moveq #$1c, D0
038ED2 move.b ($22,A6), ($22,A0) [enemy+26]
038ED8 move.b #$10, ($25,A0)
03B980 move.b D1, ($22,A6)
03B984 move.b D2, ($24,A6) [enemy+22]
03CCBA move.b D0, ($22,A6)
03CCBE rts [enemy+22]
03CCD2 move.b D0, ($22,A6)
03CCD6 rts [enemy+22]
03CCF6 move.b D0, ($22,A6)
03CCFA moveq #$0, D1 [enemy+22]
03CD3A move.b ($22,A6), D1
03CD3E btst #$4, D1 [enemy+22]
03CD92 move.b ($22,A6), D1
03CD96 btst #$4, D1 [enemy+22]
03CE20 move.b ($22,A6), D1
03CE24 sub.b D0, D1 [enemy+22]
03CE3C add.b ($22,A6), D2
03CE40 move.w D2, D0 [enemy+22]
03CE46 move.b D0, ($22,A6)
03CE4A rts [enemy+22]
03CE52 move.b ($22,A6), D1
03CE56 sub.b D0, D1 [enemy+22]
03CE6E add.b ($22,A6), D2
03CE72 move.w D2, D0 [enemy+22]
03CE78 move.b D0, ($22,A6)
03CE7C rts [enemy+22]
03DE80 move.b #$18, ($22,A6)
03DE86 moveq #$0, D0 [enemy+22]
03E630 cmpi.b #$10, ($22,A6) [enemy+24]
03E636 ble $3e640 [enemy+22]
03F194 move.b #$8, ($22,A6) [enemy+24]
03F19A bra $3f1aa [enemy+22]
03F1AA moveq #$d, D0 [enemy+22]
03F2E8 move.b ($22,A6), D0
03F2EC sub.b ($a9,A6), D0 [enemy+22]
03F2FE ble $3f32c
03F32C rts [enemy+22]
03F32E move.b ($22,A6), D0
03F332 sub.b ($a9,A6), D0 [enemy+22]
03F35C move.b D0, ($22,A6)
03F360 bra $3f372 [enemy+22]
03F36E move.b D0, ($22,A6)
03F372 rts [enemy+22]
03F408 move.b ($22,A6), D0
03F40C addq.b #8, D0 [enemy+22]
03F420 move.b #$0, ($22,A6) [enemy+24]
03F426 bra $3f436
03F430 move.b #$10, ($22,A6)
03F436 jsr $119c.l [enemy+22]
03F448 addi.b #$10, ($22,A6)
03F44E andi.b #$10, ($22,A6) [enemy+22]
03F454 moveq #$1c, D0 [enemy+22]
03F8D2 move.b #$18, ($22,A6)
03F8D8 cmpi.b #$0, ($24,A6) [enemy+22]
03F8DE beq $3f8e8 [enemy+24]
03F8E8 moveq #$15, D0 [enemy+22]
04003C move.b D0, ($22,A6)
040040 jsr $32c5e.l [enemy+22]
040280 move.w ($22,A6), ($22,A1) [enemy+96]
040286 move.w ($8,A6), ($8,A1)
040346 move.b #$18, ($22,A6)
04034C moveq #$0, D0 [enemy+22]
040C74 cmpi.b #$10, ($22,A6) [enemy+24]
040C7A ble $40c84 [enemy+22]
0412B0 move.b ($22,A6), D0
0412B4 sub.b ($a4,A6), D0 [enemy+22]
0412DE move.b D0, ($22,A6)
0412E2 bra $412f4 [enemy+22]
0412F0 move.b D0, ($22,A6)
0412F4 rts [enemy+22]
041974 move.b D0, ($22,A6)
041978 jsr $32d90.l [enemy+22]
041984 move.b #$8, ($22,A6)
04198A tst.b ($24,A6) [enemy+22]
041992 move.b #$18, ($22,A6)
041998 moveq #$5, D0 [enemy+22]
0419D0 move.b D0, ($22,A6)
0419D4 jsr $32d90.l [enemy+22]
0419E0 move.b #$8, ($22,A6)
0419E6 tst.b ($24,A6) [enemy+22]
0419EE move.b #$18, ($22,A6)
0419F4 moveq #$d, D0 [enemy+22]
041AD2 move.b ($22,A6), D0
041AD6 addq.b #8, D0 [enemy+22]
041AFA move.b #$10, ($22,A6)
041B00 jsr $119c.l [enemy+22]
041B0E ble $41b1e
041B1E moveq #$b, D0
041BA2 move.b ($22,A6), D0
041BA6 sub.b ($a4,A6), D0 [enemy+22]
041BE2 move.b D0, ($22,A6)
041BE6 rts [enemy+22]
042172 move.b ($22,A6), ($22,A0)
042178 move.l A6, ($ac,A0)
0421A8 move.b ($22,A6), ($22,A0) [enemy+26]
0421AE move.l A6, ($ac,A0)
04277E move.b D0, ($22,A6)
042782 bsr $44aa2
042796 move.b D0, ($22,A6)
04279A jsr $1862.l [enemy+22]
04498E move.b D0, ($22,A6)
044992 rts [enemy+22]
04499A move.b ($22,A6), D1
04499E sub.b D0, D1 [enemy+22]
0449B6 add.b ($22,A6), D2
0449BA move.w D2, D0 [enemy+22]
0449C0 move.b D0, ($22,A6)
0449C4 rts [enemy+22]
045A88 move.b D1, ($22,A6)
045A8C move.b D2, ($24,A6) [enemy+22]
045B14 move.b D1, ($22,A6)
045B18 move.b D2, ($24,A6) [enemy+22]
045F06 move.b D0, ($22,A6)
045F0A tst.b ($51,A6) [enemy+22]
04662C move.b ($22,A6), D0
046630 lsr.b #4, D0 [enemy+22]
046B14 move.b ($22,A6), D1
046B18 sub.b D0, D1 [enemy+22]
046B30 add.b ($22,A6), D2
046B34 move.w D2, D0 [enemy+22]
046B3A move.b D0, ($22,A6)
046B3E rts [enemy+22]
046BC6 move.b D0, ($22,A6)
046BCA rts [enemy+22]
046BDA move.b D0, ($22,A6)
046BDE rts [enemy+22]
046C74 move.b ($22,A6), D0
046C78 move.b #$8, D1 [enemy+22]
046CBA move.b ($22,A6), D0
046CBE move.b #$20, D1 [enemy+22]
046CCA move.b ($22,A6), D0
046CCE move.b #$20, D1 [enemy+22]
046CEA move.b D1, ($22,A6)
046CEE rts [enemy+22]
046E50 move.b ($22,A6), D1
046E54 sub.b D0, D1 [enemy+22]
046E6C add.b ($22,A6), D2
046E70 move.w D2, D0 [enemy+22]
046E76 move.b D0, ($22,A6)
046E7A rts [enemy+22]
046F20 move.b D0, ($22,A6)
046F24 rts [enemy+22]
048448 move.b #$18, ($22,A6)
04844E clr.b ($24,A6) [enemy+22]
04898C move.b D0, ($22,A6)
048990 bra $489bc [enemy+22]
0489B8 move.b D0, ($22,A6)
0489BC bra $4937e [enemy+22]
048CAE addi.b #$10, ($22,A6)
048CB4 andi.b #$1f, ($22,A6) [enemy+22]
048CBA addq.b #2, ($6,A6) [enemy+22]
048E0E move.b D0, ($22,A6)
048E12 move.b #$a, ($78,A6) [enemy+22]
049398 move.b ($22,A6), D0
04939C lsl.w #2, D0 [enemy+22]
04E004 move.b #$18, ($22,A6) [enemy+34]
04E00A clr.b ($24,A6) [enemy+22]
04E2AE move.b #$8, ($22,A6)
04E2B4 move.b #$1, ($24,A6) [enemy+22]
04E7A2 move.b D0, ($22,A6)
04E7A6 bra $4e7d2 [enemy+22]
04E7CE move.b D0, ($22,A6)
04E7D2 bra $4f374 [enemy+22]
04EC7C move.b D1, ($22,A6)
04EC80 move.b D2, ($24,A6) [enemy+22]
04EEF4 move.b D0, ($22,A6)
04EEF8 move.b #$a, ($78,A6) [enemy+22]
04F388 move.b ($22,A6), D0
04F38C lsl.w #2, D0 [enemy+22]
04FD14 move.w ($22,A6), ($22,A0)
04FD1A move.w ($8,A6), ($8,A0)
050000 move.b D1, ($22,A6) [enemy+24]
050004 move.b D0, ($24,A0) [enemy+22]
050008 move.b D1, ($22,A0) [enemy+24]
05000C bsr $50894 [enemy+22]
050976 move.b D0, ($22,A6)
05097A movea.l (A7)+, A6 [enemy+22]
050DCC move.b #$18, ($22,A6)
050DD2 move.b #$18, ($22,A0) [enemy+22]
050DD8 rts [enemy+22]
050DEC move.b #$8, ($22,A6) [enemy+24]
050DF2 move.b #$8, ($22,A0) [enemy+22]
050DF8 rts [enemy+22]
05365A clr.b ($22,A6)
05365E clr.b ($a8,A6)
05384E addq.b #1, ($22,A6) [enemy+A8]
053852 andi.b #$1f, ($22,A6) [enemy+22]
053858 move.b ($22,A6), D0 [enemy+22]
0539A2 move.b D0, ($22,A6)
0539A6 move.b D0, ($a8,A6)
05595A move.b #$8, ($22,A6) [enemy+24]
055960 addi.w #$40, ($8,A6) [enemy+22]
05673A move.b #$0, ($22,A0)
056740 movem.w (A7)+, A0
057200 move.b ($22,A6), ($22,A0) [enemy+26]
057206 move.b #$10, ($25,A0)
0584E8 move.b #$18, ($22,A6)
0584EE moveq #$1, D0 [enemy+22]
0596CA move.b D0, ($22,A6)
0596CE jsr $32b68.l [enemy+22]
0597DC move.b ($22,A6), D0
0597E0 sub.b ($a4,A6), D0 [enemy+22]
05980A move.b D0, ($22,A6)
05980E bra $59820 [enemy+22]
05982A move.b ($22,A6), D0
05982E neg.b D0 [enemy+22]
05A688 move.b #$8, ($22,A6)
05A68E addi.w #$0, ($8,A6) [enemy+22]
05A6A2 move.b #$18, ($22,A6)
05A6A8 subi.w #$0, ($8,A6) [enemy+22]
05AAE6 move.b #$18, ($22,A6)
05AAEC moveq #$0, D0 [enemy+22]
05ADA2 move.b #$8, ($22,A6) [enemy+24]
05ADA8 cmp.w ($8,A6), D0 [enemy+22]
05ADB6 move.b #$18, ($22,A6)
05ADBC moveq #$1e, D0 [enemy+22]
05AE18 move.b D0, ($22,A6)
05AE1C jsr $32d90.l [enemy+22]
05AE28 move.b #$8, ($22,A6)
05AE2E tst.b ($24,A6) [enemy+22]
05AE32 bne $5ae3c [enemy+24]
05AE3C moveq #$d, D0 [enemy+22]
05B012 move.w ($22,A6), ($22,A0) [enemy+26]
05B018 move.w ($8,A6), ($8,A0)
05B1AC move.b D1, ($22,A6)
05B1B0 move.b D2, ($24,A6) [enemy+22]
05B21C move.b D1, ($22,A6)
05B220 move.b D2, ($24,A6) [enemy+22]
05B592 move.b D2, ($22,A6) [enemy+24]
05B596 addq.b #2, ($a6,A6) [enemy+22]
05F1CA move.b D0, ($22,A6)
05F1CE move.b D1, ($24,A6) [enemy+22]
05F27A add.b D0, ($22,A6)
05F27E andi.b #$1f, ($22,A6) [enemy+22]
05F284 move.b #$1, ($24,A6) [enemy+22]
05F28A btst #$4, ($22,A6) [enemy+24]
05F290 beq $5f298 [enemy+22]
05F79C move.b D1, ($22,A6)
05F7A0 move.b D2, ($24,A6) [enemy+22]
05F8DE move.b D1, ($22,A6)
05F8E2 bsr $5fae0
05F90E move.b D1, ($22,A6)
05F912 bsr $5faf4 [enemy+22]
05F946 move.b D1, ($22,A6)
05F94A bsr $5fae0
05FB0E move.b D1, ($22,A6)
05FB12 move.b D2, ($24,A6) [enemy+22]
089A6A move.b #$0, ($22,A0)
089A70 move.w ($5c,A6), ($5c,A0)
089B04 move.b #$0, ($22,A0)
089B0A jsr $119c.l
089BAE move.b #$0, ($22,A0)
089BB4 move.w #$4c0, ($8,A0)
089C0E move.b #$0, ($22,A0)
089C14 move.w #$490, ($8,A0)
089C44 move.b #$0, ($22,A0) [enemy+26]
089C4A move.w #$4a0, ($8,A0)
089C7A move.b #$0, ($22,A0) [enemy+26]
089C80 move.w #$4a0, ($8,A0)
089CD8 move.b #$0, ($22,A0) [enemy+26]
089CDE move.b #$1, ($24,A0)
089D14 move.b #$0, ($22,A0) [enemy+26]
089D1A move.b #$1, ($24,A0)
089D50 move.b #$0, ($22,A0) [enemy+26]
089D56 move.b #$1, ($24,A0)
0AAACA move.l (A0), D2
0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAACE move.w D0, ($2,A0)
0AAAD2 cmp.l (A0), D0
0AAAD4 bne $aaafc
0AAAD8 move.l D2, (A0)+
0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAE6 move.l (A0), D2
0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAF4 move.l D2, (A0)+
0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
copyright zengfr site:http://github.com/zengfr/romhack
|
test-resources/ExamplesFromRoy/gm_unit_rank_types.1.ads | hergin/ada2fuml | 0 | 21777 | <reponame>hergin/ada2fuml<gh_stars>0
package Gm_Unit_Rank_Types is
-- This type defines an extended numeric ranking. 0 indicates no
-- rank, 1 is the highest rank and 99 is the lowest rank.
--
subtype Extended_Numeric_Rank_Type is Integer range 0 .. 99;
-- The following constant defines the value returned when a given
-- object is not described in a particular Guidance and therefore has
-- no rank value.
--
No_Numeric_Rank : constant Extended_Numeric_Rank_Type := 0;
-- This type defines a numeric ranking. 1 is the highest rank and 99 is
-- the lowest rank.
--
subtype Numeric_Rank_Type is Extended_Numeric_Rank_Type range 1 .. 99;
Default_Numeric_Rank : constant Numeric_Rank_Type := 1;
-- This type defines an extended ranking. The numeric ranking is
-- supplemented by the values of Restricted, Not Applicable, and
-- Blank.
--
type Rank_Type is (Unknown, Restricted, Not_Applicable, Zero, One, Two, Three,
Four, Five, Six, Seven, Eight, Nine, Ten, Eleven, Twelve,
Thirteen, Fourteen, Fifteen, Sixteen, Seventeen, Eighteen,
Nineteen, Twenty, Twenty_One, Twenty_Two, Twenty_Three,
Twenty_Four, Twenty_Five, Twenty_Six, Twenty_Seven,
Twenty_Eight, Twenty_Nine, Thirty, Thirty_One, Thirty_Two,
Thirty_Three, Thirty_Four, Thirty_Five, Thirty_Six,
Thirty_Seven, Thirty_Eight, Thirty_Nine, Forty, Forty_One,
Forty_Two, Forty_Three, Forty_Four, Forty_Five, Forty_Six,
Forty_Seven, Forty_Eight, Forty_Nine, Fifty, Fifty_One,
Fifty_Two, Fifty_Three, Fifty_Four, Fifty_Five, Fifty_Six,
Fifty_Seven, Fifty_Eight, Fifty_Nine, Sixty, Sixty_One,
Sixty_Two, Sixty_Three, Sixty_Four, Sixty_Five,
Sixty_Six, Sixty_Seven, Sixty_Eight, Sixty_Nine, Seventy,
Seventy_One, Seventy_Two, Seventy_Three, Seventy_Four,
Seventy_Five, Seventy_Six, Seventy_Seven, Seventy_Eight,
Seventy_Nine, Eighty, Eighty_One, Eighty_Two, Eighty_Three,
Eighty_Four, Eighty_Five, Eighty_Six, Eighty_Seven,
Eighty_Eight, Eighty_Nine, Ninety, Ninety_One,
Ninety_Two, Ninety_Three, Ninety_Four, Ninety_Five,
Ninety_Six, Ninety_Seven, Ninety_Eight, Ninety_Nine);
Default_Rank : constant Rank_Type := Unknown;
-- This type defines a system unit and its associated numeric rank.
--
type Unit_Numeric_Rank_Type is
record
Unit : Integer;
Rank : Numeric_Rank_Type;
end record;
Default_Unit_Numeric_Rank : constant Unit_Numeric_Rank_Type :=
Unit_Numeric_Rank_Type'(Unit => 0,
Rank => Default_Numeric_Rank);
-- This type defines a system unit and its associated extended rank.
--
type Unit_Rank_Type is
record
Unit : Integer;
Rank : Rank_Type;
end record;
Default_Unit_Rank : constant Unit_Rank_Type :=
Unit_Rank_Type'(Unit => 0,
Rank => Default_Rank);
end Gm_Unit_Rank_Types;
|
flashlight.asm | ISSOtm/gb-flashlight | 3 | 176070 | <reponame>ISSOtm/gb-flashlight<filename>flashlight.asm<gh_stars>1-10
INCLUDE "hardware.inc"
SPRITE_SIZE = 8
SECTION "Header", ROM0[$0100]
EntryPoint:
di
jr Start
nop
REPT $150 - $104
db 0
ENDR
SECTION "Interrupt handlers", ROM0[$0040]
VBlankHandler::
push af
push bc
ldh a, [hIsFlashlightEnabled]
and a
jp VBlankHandler2
STATHandler::
push af
push hl
ldh a, [rSTAT]
bit 2, a ; STATB_LYCF
jr nz, .toggleRectangle
ld h, a
; Wait for precisely Mode 2
; ld a, h
.triggerScanline0
xor STATF_MODE00 | STATF_MODE10 ; Need to remove Mode 0 to avoid STAT blocking
ldh [rSTAT], a
ldh a, [hFlashlightCurrentLeft]
ld l, a
xor a
ldh [rIF], a ; Clear IF for upcoming sync
dec a ; ld a, $FF
ldh [rBGP], a
halt ; Halt with ints disabled to sync with Mode 2 perfectly
nop ; Avoid halt bug... I'd prefer to never trigger it, though.
; Clear setup
ld a, h ; Restore
ldh [rSTAT], a
; Now, wait depending on the required offset (1 cycle offset per 8 pixels)
ld h, HIGH(DelayFuncTable)
; l already loaded, there
ld l, [hl]
ld h, HIGH(DelayFunc)
jp hl ; Ends on its own
.toggleRectangle
xor STATF_MODE00
ldh [rSTAT], a
ld h, a ; For .triggerScanline0
; Put LYC at disable scanline (do it now to avoid STAT IRQ blocking)
ldh a, [hFlashlightDisableScanline]
ldh [rLYC], a
; Toggle sprites each time
ldh a, [rLCDC]
xor LCDCF_OBJON
ldh [rLCDC], a
; Don't to this if disabling
ld a, h
and STATF_MODE00
jr z, .done
; Starting on scanline 0 is extra special
ldh a, [hFlashlightTop]
and a
ld a, h
jr z, .triggerScanline0
.done
; Cancel IRQ bug
ldh a, [rIF]
and ~IEF_LCDC
ldh [rIF], a
pop hl
pop af
reti
DelayFunc:
REPT SCRN_X / 4 - 1
nop
ENDR
; Do this before to save cycles after writing BGP
ldh a, [rSTAT]
and STATF_LYCF ; Check if we need to end in this scanline
; Do a thing here with BGP
nop ; Delay to land "just right"
ld a, $E4
ldh [rBGP], a
jr nz, .endRectangle
; Cancel IRQ bug
ldh a, [rIF]
and ~IEF_LCDC
ldh [rIF], a
pop hl
pop af
reti
.endRectangle
; We need to end this. Wait till HBlank, then set palette to black, and stop the process.
.waitHBlank
ldh a, [rSTAT]
and STATF_LCD
jr nz, .waitHBlank
dec a ; ld a, $FF
ldh [rBGP], a
ldh a, [rSTAT]
; Add some delay so VBlank doesn't trigger while removing STAT flag from IF
; Incredibly annoying that this falls "just right"
; AAAAAAAAAAAAAAAA
nop
nop
nop
nop
jr STATHandler.toggleRectangle
SECTION "DelayFunc entry point table", ROM0,ALIGN[8]
DelayFuncTable::
DELAY_OFFSET = SCRN_X / 4 - 1
REPT SCRN_X / 4
REPT 4
db LOW(DelayFunc) + DELAY_OFFSET
ENDR
DELAY_OFFSET = DELAY_OFFSET + (-1)
ENDR
SECTION "VBlank handler, second part", ROM0
VBlankHandler2:
jr z, .noFlashlight
; Do not do flashlight if it's not displayed, it causes errors
ldh a, [hFlashlightLeft]
ldh [hFlashlightCurrentLeft], a ; This is re-read during the frame, so buffer it
ld c, a
cp SCRN_X
jr nc, .oobFlashlight
ldh a, [hFlashlightHeight]
and a
jr z, .oobFlashlight
; Set bits in STAT reg
ldh a, [rSTAT]
and ~STATF_MODE00
ldh [rSTAT], a
; Cancel hw bug
ldh a, [rIF]
and ~IEF_LCDC
ldh [rIF], a
; Calc WX
ldh a, [hFlashlightWidth]
add a, c
jr c, .forceWX
cp SCRN_X - 1
jr c, .WXok
.forceWX
ld a, SCRN_X
.WXok
add a, 7
ldh [rWX], a
; Set LYC
ldh a, [hFlashlightTop]
ld c, a
and a ; Scanline 0 triggers differently, due to a lack of "previous" lines
jr z, .specialTrigger
dec a
.specialTrigger
ldh [rLYC], a
; Set scanline where it must be disabled
ldh a, [hFlashlightHeight]
dec a
add a, c
cp $8F + 1
jr c, .disableScanlineOK
ld a, $8F
.disableScanlineOK
ldh [hFlashlightDisableScanline], a
.finishOobFlashlight
; Transfer OAM!
ld a, HIGH(wSievedOAM)
call PerformDMA
; Set blackness for top half
ld a, $FF
jr .flashlightDone
.oobFlashlight
ld a, SCRN_X + 7
ldh [rWX], a
; This value can be re-used as a never-trigger LYC
ldh [rLYC], a
jr .finishOobFlashlight
.noFlashlight
ld a, SCRN_X + 7
ldh [rWX], a
ldh [rLYC], a
ld a, $E4
.flashlightDone
ldh [rBGP], a
xor a
ldh [hVBlankFlag], a
; Poll joypad and update regs
ld c, LOW(rP1)
ld a, $20 ; Select D-pad
ld [$ff00+c], a
REPT 6
ld a, [$ff00+c]
ENDR
or $F0 ; Set 4 upper bits (give them consistency)
ld b, a
swap b ; Put D-pad buttons in upper nibble
ld a, $10 ; Select buttons
ld [$ff00+c], a
REPT 6
ld a, [$ff00+c]
ENDR
or $F0 ; Set 4 upper bits
xor b ; Mix with D-pad bits, and invert all bits (such that pressed=1) thanks to "or $F0"
ld b, a
ldh a, [hHeldButtons]
cpl
and b
ldh [hPressedButtons], a
ld a, b
ldh [hHeldButtons], a
; Release joypad
ld a, $30
ld [$ff00+c], a
pop bc
pop af
reti
SECTION "Main code", ROM0[$150]
Start::
ld sp, $E000
.waitVBlank
ldh a, [rLY]
cp SCRN_Y
jr c, .waitVBlank
xor a
ldh [rLCDC], a
; Init OAM buffers
ld hl, wOAMBuffer
ld de, InitialOAM
ld c, $A0
.fillOAM
ld a, [de]
inc e; inc de
ld [hli], a
dec c
jr nz, .fillOAM
ld hl, wSievedOAM
xor a
ld c, $A0
.fillSievedOAM
ld [hli], a
dec c
jr nz, .fillSievedOAM
; Set up VRAM
; Write black tiles
ld a, $FF
ld hl, $8800
.nextTile
ld c, $10
.fillBlack
ld [hli], a
dec c
jr nz, .fillBlack
srl a
jr nz, .nextTile
ld bc, $AA << 8 | 8
.fillGreyTile
ld a, $FF
ld [hli], a
ld a, b
cpl
ld b, a
ld [hli], a
dec c
jr nz, .fillGreyTile
ld hl, $9C00
ld bc, SCRN_Y_B * SCRN_VX_B
.fillWindow
ld a, $80
ld [hli], a
dec bc
ld a, b
or c
jr nz, .fillWindow
; Copy BG (font) tiles
ld hl, $9200
ld de, Font
ld bc, FontEnd - Font
.copyFont
ld a, [de]
inc de
ld [hli], a
dec bc
ld a, b
or c
jr nz, .copyFont
; Write BG tilemap
ld hl, $9800
ld de, BGTilemap
ld b, SCRN_Y_B
.nextRow
ld c, SCRN_X_B
.copyRow
ld a, [de]
inc de
ld [hli], a
dec c
jr nz, .copyRow
ld a, l
add a, SCRN_VX_B - SCRN_X_B
ld l, a
adc a, h
sub l
ld h, a
dec b
jr nz, .nextRow
; Copy OAM DMA
ld hl, OAMDMA
ld bc, (OAMDMAEnd - OAMDMA) << 8 | LOW(PerformDMA)
.copyOAMDMA
ld a, [hli]
ld [$ff00+c], a
inc c
dec b
jr nz, .copyOAMDMA
xor a
ldh [hHeldButtons], a
ldh [hPressedButtons], a
inc a ; ld a, 1
ldh [hIsFlashlightEnabled], a
ld a, 90
ldh [hFlashlightTop], a
ldh [hFlashlightLeft], a
ld a, 20
ldh [hFlashlightHeight], a
ldh [hFlashlightWidth], a
xor a
ldh [rWY], a
ldh [rSCY], a
ldh [rSCX], a
ld a, $E4
ldh [rOBP0], a
ld a, STATF_LYC
ldh [rSTAT], a
IF SPRITE_SIZE == 8
ld a, LCDCF_ON | LCDCF_WIN9C00 | LCDCF_WINON | LCDCF_BGON
ELIF SPRITE_SIZE == 16
ld a, LCDCF_ON | LCDCF_WIN9C00 | LCDCF_WINON | LCDCF_OBJ16 | LDCF_BGON
ELSE
FAIL "Sprite size must be either 8 or 16"
ENDC
ldh [rLCDC], a
ld a, IEF_VBLANK | IEF_LCDC
ldh [rIE], a
xor a
ei ; Ensure we start on a clean basis
ldh [rIF], a
MainLoop::
; Wait for VBlank
ld a, 1
ldh [hVBlankFlag], a
.waitVBlank
halt
ldh a, [hVBlankFlag]
and a
jr nz, .waitVBlank
; Check input
ldh a, [hHeldButtons]
ld b, a
and PADF_A ; A edits size, not position
add a, a
add a, LOW(hFlashlightTop)
ld c, a
ld a, [$ff00+c]
bit PADB_UP, b
jr z, .noUp
dec a
.noUp
bit PADB_DOWN, b
jr z, .noDown
inc a
.noDown
ld [$ff00+c], a
inc c
ld a, [$ff00+c]
bit PADB_LEFT, b
jr z, .noLeft
dec a
.noLeft
bit PADB_RIGHT, b
jr z, .noRight
inc a
.noRight
ld [$ff00+c], a
; Sieve OAM
ld hl, wSievedOAM
; Write left masking sprites
ldh a, [hFlashlightHeight]
cp SCRN_X
jr c, .heightOk
ld a, SCRN_X
.heightOk
add a, SPRITE_SIZE - 1
and -SPRITE_SIZE
IF SPRITE_SIZE == 8
rra
rra
rra
ELSE
swap a
ENDC
ld c, a
ld e, a ; Save this for right border, maybe
ldh a, [hFlashlightLeft]
and a
jr z, .noLeftEdgeSprites
cp SCRN_X + 8
jr nc, .noLeftEdgeSprites
ld b, a
ldh a, [hFlashlightTop]
add a, 8
.writeLeftEdgeSprite
cp SCRN_Y + 8
jr nc, .noLeftEdgeSprites
add a, 8
ld [hli], a
ld [hl], b
inc l ; inc hl
ld [hl], $80
inc l ; inc hl
ld [hl], 0
inc l ; inc hl
dec c
jr nz, .writeLeftEdgeSprite
.noLeftEdgeSprites
; WX = $A6 (1 px on-screen) behaves incorrectly, therefore sprites are used instead
ldh a, [hFlashlightLeft]
ld c, a
ldh a, [hFlashlightWidth]
add a, c
cp SCRN_X - 1
jr nz, .noRightEdgeSprites
; Put sprites to form right border
ldh a, [hFlashlightWidth]
add a, b
add a, 8
ld b, a
ldh a, [hFlashlightTop]
add a, 8
.writeRightEdgeSprite
cp SCRN_Y + 8
jr nc, .noRightEdgeSprites
add a, 8
ld [hli], a
ld [hl], b
inc l ; inc hl
ld [hl], $80
inc l ; inc hl
ld [hl], 0
inc l ; inc hl
dec e
jr nz, .writeRightEdgeSprite
.noRightEdgeSprites
ld de, wOAMBuffer
.sieveSprite
; Check if sprite is fully outside of the flashlight window
; Check if sprite Y > flashlight Y (remember that there's a 16-px offset!)
ldh a, [hFlashlightTop]
IF SPRITE_SIZE == 8
add a, 9
ELSE
inc a
ENDC
ld b, a
ld a, [de]
ld c, a
sub b
jr c, .culledOut
inc a ; Get offset
ld b, a
; Check if sprite is within bounds (ofs < h)
ldh a, [hFlashlightHeight]
add a, 7
cp b
jr c, .culledOut
inc e ; inc de
; Check if sprite X > flashlight X (again, 8-px offset)
ldh a, [hFlashlightLeft]
inc a
ld b, a
ld a, [de]
dec e ; dec de
sub b
jr c, .culledOut
inc a ; Get offset
ld b, a
; Check if sprite is within bounds (ofs < w)
ldh a, [hFlashlightWidth]
add a, 7
cp b
jr c, .culledOut
inc e ; inc de
sub 7
sub b
jr nc, .notClipped
ld b, a
; Add sprite on top of this one, to apply clipping
ld a, c
ld [hli], a
ld a, [de]
ld [hli], a
ld a, b
and %111
add a, $80
ld [hli], a
xor a
ld [hli], a
.notClipped
ld a, c
ld [hli], a
REPT 3
ld a, [de]
inc e ; inc de
ld [hli], a
ENDR
ld a, e
cp $A0
jr c, .sieveSprite
jr .finishSieve
.culledOut
ld a, e
add a, 4
ld e, a
cp $A0
jr c, .sieveSprite
; Fill rest of sieved OAM with nothing
.finishSieve
ld a, l
cp $A0
jr nc, .doneSieving
ld [hl], 0
add a, 4
ld l, a
jr .finishSieve
.doneSieving
jp MainLoop
SECTION "OAM DMA routine", ROM0
OAMDMA::
ldh [rDMA], a
ld a, $28
.wait
dec a
jr nz, .wait
ret
OAMDMAEnd::
SECTION "OAM buffer", WRAM0,ALIGN[8]
wOAMBuffer::
ds $A0
SECTION "Sieved OAM", WRAM0,ALIGN[8]
wSievedOAM::
ds $A0
SECTION "Misc. variables", HRAM
hHeldButtons::
db
hPressedButtons::
db
hVBlankFlag::
db
SECTION "Flashlight variables", HRAM
hIsFlashlightEnabled::
db
hFlashlightTop::
db
hFlashlightLeft::
db
hFlashlightHeight::
db
hFlashlightWidth::
db
hFlashlightDisableScanline::
db
hFlashlightCurrentLeft::
db
SECTION "OAM DMA", HRAM
PerformDMA::
ds OAMDMAEnd - OAMDMA
SECTION "Font", ROM0
Font::
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 ; Space
; Symbols 1
dw $8000, $8000, $8000, $8000, $8000, $0000, $8000, $0000
dw $0000, $6C00, $6C00, $4800, $0000, $0000, $0000, $0000
dw $4800, $FC00, $4800, $4800, $4800, $FC00, $4800, $0000
dw $1000, $7C00, $9000, $7800, $1400, $F800, $1000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 ; %, empty slot for now
dw $6000, $9000, $5000, $6000, $9400, $9800, $6C00, $0000
dw $0000, $3800, $3800, $0800, $1000, $0000, $0000, $0000
dw $1800, $2000, $2000, $2000, $2000, $2000, $1800, $0000
dw $1800, $0400, $0400, $0400, $0400, $0400, $1800, $0000
dw $0000, $1000, $5400, $3800, $5400, $1000, $0000, $0000
dw $0000, $1000, $1000, $7C00, $1000, $1000, $0000, $0000
dw $0000, $0000, $0000, $0000, $3000, $3000, $6000, $0000
dw $0000, $0000, $0000, $7C00, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $6000, $6000, $0000
dw $0000, $0400, $0800, $1000, $2000, $4000, $8000, $0000
dw $3000, $5800, $CC00, $CC00, $CC00, $6800, $3000, $0000
dw $3000, $7000, $F000, $3000, $3000, $3000, $FC00, $0000
dw $7800, $CC00, $1800, $3000, $6000, $C000, $FC00, $0000
dw $7800, $8C00, $0C00, $3800, $0C00, $8C00, $7800, $0000
dw $3800, $5800, $9800, $FC00, $1800, $1800, $1800, $0000
dw $FC00, $C000, $C000, $7800, $0C00, $CC00, $7800, $0000
dw $7800, $CC00, $C000, $F800, $CC00, $CC00, $7800, $0000
dw $FC00, $0C00, $0C00, $1800, $1800, $3000, $3000, $0000
dw $7800, $CC00, $CC00, $7800, $CC00, $CC00, $7800, $0000
dw $7800, $CC00, $CC00, $7C00, $0C00, $CC00, $7800, $0000
dw $0000, $C000, $C000, $0000, $C000, $C000, $0000, $0000
dw $0000, $C000, $C000, $0000, $C000, $4000, $8000, $0000
dw $0400, $1800, $6000, $8000, $6000, $1800, $0400, $0000
dw $0000, $0000, $FC00, $0000, $FC00, $0000, $0000, $0000
dw $8000, $6000, $1800, $0400, $1800, $6000, $8000, $0000
dw $7800, $CC00, $1800, $3000, $2000, $0000, $2000, $0000
dw $0000, $2000, $7000, $F800, $F800, $F800, $0000, $0000 ; "Up" arrow, not ASCII but otherwise unused :P
; Uppercase
dw $3000, $4800, $8400, $8400, $FC00, $8400, $8400, $0000
dw $F800, $8400, $8400, $F800, $8400, $8400, $F800, $0000
dw $3C00, $4000, $8000, $8000, $8000, $4000, $3C00, $0000
dw $F000, $8800, $8400, $8400, $8400, $8800, $F000, $0000
dw $FC00, $8000, $8000, $FC00, $8000, $8000, $FC00, $0000
dw $FC00, $8000, $8000, $FC00, $8000, $8000, $8000, $0000
dw $7C00, $8000, $8000, $BC00, $8400, $8400, $7800, $0000
dw $8400, $8400, $8400, $FC00, $8400, $8400, $8400, $0000
dw $7C00, $1000, $1000, $1000, $1000, $1000, $7C00, $0000
dw $0400, $0400, $0400, $0400, $0400, $0400, $F800, $0000
dw $8400, $8800, $9000, $A000, $E000, $9000, $8C00, $0000
dw $8000, $8000, $8000, $8000, $8000, $8000, $FC00, $0000
dw $8400, $CC00, $B400, $8400, $8400, $8400, $8400, $0000
dw $8400, $C400, $A400, $9400, $8C00, $8400, $8400, $0000
dw $7800, $8400, $8400, $8400, $8400, $8400, $7800, $0000
dw $F800, $8400, $8400, $F800, $8000, $8000, $8000, $0000
dw $7800, $8400, $8400, $8400, $A400, $9800, $6C00, $0000
dw $F800, $8400, $8400, $F800, $9000, $8800, $8400, $0000
dw $7C00, $8000, $8000, $7800, $0400, $8400, $7800, $0000
dw $7C00, $1000, $1000, $1000, $1000, $1000, $1000, $0000
dw $8400, $8400, $8400, $8400, $8400, $8400, $7800, $0000
dw $8400, $8400, $8400, $8400, $8400, $4800, $3000, $0000
dw $8400, $8400, $8400, $8400, $B400, $CC00, $8400, $0000
dw $8400, $8400, $4800, $3000, $4800, $8400, $8400, $0000
dw $4400, $4400, $4400, $2800, $1000, $1000, $1000, $0000
dw $FC00, $0400, $0800, $1000, $2000, $4000, $FC00, $0000
; Symbols 2
dw $3800, $2000, $2000, $2000, $2000, $2000, $3800, $0000
dw $0000, $8000, $4000, $2000, $1000, $0800, $0400, $0000
dw $1C00, $0400, $0400, $0400, $0400, $0400, $1C00, $0000
dw $1000, $2800, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $FF00
dw $C000, $6000, $0000, $0000, $0000, $0000, $0000, $0000
; Lowercase
dw $0000, $0000, $7800, $0400, $7C00, $8400, $7800, $0000
dw $8000, $8000, $8000, $F800, $8400, $8400, $7800, $0000
dw $0000, $0000, $7C00, $8000, $8000, $8000, $7C00, $0000
dw $0400, $0400, $0400, $7C00, $8400, $8400, $7800, $0000
dw $0000, $0000, $7800, $8400, $F800, $8000, $7C00, $0000
dw $0000, $3C00, $4000, $FC00, $4000, $4000, $4000, $0000
dw $0000, $0000, $7800, $8400, $7C00, $0400, $F800, $0000
dw $8000, $8000, $F800, $8400, $8400, $8400, $8400, $0000
dw $0000, $1000, $0000, $1000, $1000, $1000, $1000, $0000
dw $0000, $1000, $0000, $1000, $1000, $1000, $E000, $0000
dw $8000, $8000, $8400, $9800, $E000, $9800, $8400, $0000
dw $1000, $1000, $1000, $1000, $1000, $1000, $1000, $0000
dw $0000, $0000, $6800, $9400, $9400, $9400, $9400, $0000
dw $0000, $0000, $7800, $8400, $8400, $8400, $8400, $0000
dw $0000, $0000, $7800, $8400, $8400, $8400, $7800, $0000
dw $0000, $0000, $7800, $8400, $8400, $F800, $8000, $0000
dw $0000, $0000, $7800, $8400, $8400, $7C00, $0400, $0000
dw $0000, $0000, $BC00, $C000, $8000, $8000, $8000, $0000
dw $0000, $0000, $7C00, $8000, $7800, $0400, $F800, $0000
dw $0000, $4000, $F800, $4000, $4000, $4000, $3C00, $0000
dw $0000, $0000, $8400, $8400, $8400, $8400, $7800, $0000
dw $0000, $0000, $8400, $8400, $4800, $4800, $3000, $0000
dw $0000, $0000, $8400, $8400, $8400, $A400, $5800, $0000
dw $0000, $0000, $8C00, $5000, $2000, $5000, $8C00, $0000
dw $0000, $0000, $8400, $8400, $7C00, $0400, $F800, $0000
dw $0000, $0000, $FC00, $0800, $3000, $4000, $FC00, $0000
; Symbols 3
dw $1800, $2000, $2000, $4000, $2000, $2000, $1800, $0000
dw $1000, $1000, $1000, $1000, $1000, $1000, $1000, $0000
dw $3000, $0800, $0800, $0400, $0800, $0800, $3000, $0000
dw $0000, $0000, $4800, $A800, $9000, $0000, $0000, $0000
dw $C000, $E000, $F000, $F800, $F000, $E000, $C000, $0000 ; Left arrow
FontEnd::
SECTION "OAM", ROM0
InitialOAM::
db $6A, $68, $88, $00
db $30, $30, $88, $00
db $30, $39, $88, $00
db $30, $42, $88, $00
db $30, $4B, $88, $00
db $30, $54, $88, $00
db $30, $5D, $88, $00
db $30, $66, $88, $00
db $30, $6F, $88, $00
db $30, $78, $88, $00
db $30, $81, $88, $00
InitialOAMEnd:
REPT $A0 - (InitialOAMEnd - InitialOAM)
db 0
ENDR
SECTION "BG tilemap", ROM0
BGTilemap::
db "BUP "
db " "
db " "
db " "
db " "
db " "
db " "
db " "
db " "
db " "
db " "
db " "
db " "
db " "
db " "
db " "
db " "
db " BUP"
|
1A/S5/PIM/tps/tp2/dates.adb | MOUDDENEHamza/ENSEEIHT | 4 | 15397 | <filename>1A/S5/PIM/tps/tp2/dates.adb
with Ada.Text_IO;
use Ada.Text_IO;
procedure Dates is
-- T_Date is a date type.
type T_Date is record
day : Integer; -- day >= 1 and day <= 31.
month : Integer; -- month >= 1 and month <= 12.
year : Integer; -- year >= 1.
end record;
-- Check if a given year is leap year.
Function Is_Leap (Year : In Integer) return Boolean with
Pre => Year > 0
is
begin
if Year mod 4 = 0 Then -- Year is divisible by 4.
if Year mod 100 = 0 Then -- Year is divisible by 100.
if Year mod 400 = 0 Then -- Year is divisible by 400, hence the year is a leap year.
return True; -- Year is a leap year.
else
return False; -- Year is not a leap year.
end if;
else
return True; -- Year is a leap year.
end if;
else
return False; -- Year is not a leap year.
end if;
end Is_Leap;
-- Display date.
procedure display_date (date : in T_Date) is
begin
Put_Line (Integer'Image(date.day) & " / " & Integer'Image(date.month) &
" / " & Integer'Image(date.year));
end display_date;
-- Calculate the number of days in a given months.
function Calcul_Days_Of_Month (Month, Year: IN Integer) return Integer with
Pre => Month >= 1 and Month <= 12 and Year >= 1,
Post => Calcul_Days_Of_Month'Result >= 28 and Calcul_Days_Of_Month'Result <= 31
is
Days : Integer; -- The number of days that will be returned.
begin
Case Month is
when 1 | 3 | 5 | 7 | 8 | 10 | 12 => Days := 31; -- The months that contain 31 days.
when 4 | 6 | 9 | 11 => Days := 30; -- The months that contain 30 days.
when 2 =>
if Is_Leap (Year) Then -- If the year is leap.
Days := 29; -- Febrary contains 29 days.
else
Days := 28; -- Febrary contains 28 days.
end if;
when others => null;
end Case;
return Days;
end Calcul_Days_Of_Month;
function next_day (date : in out T_Date) return T_Date with
Pre => date.day >= 1 and date.day <= 31 and date.month >= 1 and date.month <= 12 and
date.year >= 1
is
begin
if date.day >= 1 and date.day < 28 then -- if day is between 1 and 27.
date.day := date.day + 1;
elsif date.day >= 28 and date.day <= 31 then -- if day is between 28 and 31.
if date.day = Calcul_Days_Of_Month (date.month, date.year) then -- if day equals to number of days of the month.
if date.month = 12 then -- If the month is december.
date.day := 1;
date.month := 1;
date.year := date.year + 1;
else
date.day := 1;
date.month := date.month + 1;
end if;
else
if date.day = Calcul_Days_Of_Month (date.month, date.year) then -- if day least to number of days of the month.
date.day := date.day + 1;
else
Put_Line ( "month" & Integer'Image(date.month) & " contains just "
& Integer'Image(Calcul_Days_Of_Month (date.month, date.year)) & " days.");
end if;
end if;
end if;
display_date (date);
return date;
end next_day;
-- Procedure that tests the is_leap function.
procedure test_is_leap is
begin
pragma assert(False = Is_Leap (2019));
Pragma assert(True = Is_Leap (2020));
Pragma assert(True = Is_Leap (2016));
Pragma assert(False = Is_Leap (2021));
end test_is_leap;
-- Procedure that tests the Calcul_Days_Of_Month function.
procedure test_calcul_days is
begin
pragma assert(28 = Calcul_Days_Of_Month (2, 2019));
Pragma assert(31 = Calcul_Days_Of_Month (10, 2019));
Pragma assert(30 = Calcul_Days_Of_Month (9, 2019));
Pragma assert(31 = Calcul_Days_Of_Month (12, 2019));
end test_calcul_days;
-- Procedure that tests the next_day function.
procedure test_next_day is
temp, res : T_Date;
begin
-- Execute the precedent sub-programs.
temp.day := 29;
temp.month := 2;
temp.year := 2019;
pragma assert(temp = next_day (temp));
temp.day:= 13;
temp.month := 10;
temp.year := 2019;
res := temp;
res.day := res.day + 1;
pragma assert(res = next_day (temp));
end test_next_day;
begin
-- Test the sub-programs.
test_calcul_days;
test_is_leap;
test_next_day;
end Dates;
|
oeis/017/A017506.asm | neoneye/loda-programs | 11 | 18385 | <reponame>neoneye/loda-programs
; A017506: a(n) = (11*n + 9)^10.
; 3486784401,10240000000000,819628286980801,17080198121677824,174887470365513049,1152921504606846976,5631351470947265625,22130157888803070976,73742412689492826049,215892499727278669824,569468379011812486801,1378584918490000000000,3105926159393528563401,6583182266716099969024,13239635967018160063849,25438557613203014501376,46958831761893056640625,83668255425284801560576,144445313087602911489249,242418040278232804762624,396601930091015154838201,634033809653760000000000,992515310305509690315001
mul $0,11
add $0,9
pow $0,10
|
programs/oeis/136/A136396.asm | jmorken/loda | 1 | 10984 | ; A136396: 1+n*(n+1)*(n^2-n+12)/12.
; 1,3,8,19,41,81,148,253,409,631,936,1343,1873,2549,3396,4441,5713,7243,9064,11211,13721,16633,19988,23829,28201,33151,38728,44983,51969,59741,68356,77873,88353,99859,112456,126211,141193,157473,175124,194221,214841,237063,260968,286639
mov $1,$0
bin $0,2
add $1,$0
add $0,6
mul $1,2
mul $1,$0
div $1,6
add $1,1
|
programs/oeis/047/A047368.asm | neoneye/loda | 22 | 163019 | <reponame>neoneye/loda<filename>programs/oeis/047/A047368.asm
; A047368: Numbers that are congruent to {0, 1, 2, 3, 4, 5} mod 7; a(n)=floor(7(n-1)/6).
; 0,1,2,3,4,5,7,8,9,10,11,12,14,15,16,17,18,19,21,22,23,24,25,26,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,47,49,50,51,52,53,54,56,57,58,59,60,61,63,64,65,66,67,68,70,71,72,73,74,75,77,78,79,80,81,82,84,85,86,87,88,89,91,92,93,94,95,96,98,99,100,101,102,103,105,106,107,108,109,110,112,113,114,115
mov $1,$0
div $0,6
add $0,$1
|
oeis/256/A256649.asm | neoneye/loda-programs | 11 | 166084 | ; A256649: 29-gonal pyramidal numbers: a(n) = n*(n+1)*(9*n-8)/2.
; Submitted by <NAME>(s1.)
; 0,1,30,114,280,555,966,1540,2304,3285,4510,6006,7800,9919,12390,15240,18496,22185,26334,30970,36120,41811,48070,54924,62400,70525,79326,88830,99064,110055,121830,134416,147840,162129,177310,193410,210456,228475,247494,267540,288640,310821,334110,358534,384120,410895,438886,468120,498624,530425,563550,598026,633880,671139,709830,749980,791616,834765,879454,925710,973560,1023031,1074150,1126944,1181440,1237665,1295646,1355410,1416984,1480395,1545670,1612836,1681920,1752949,1825950,1900950,1977976
mov $3,$0
lpb $0
sub $0,1
add $2,$3
add $4,$2
add $1,$4
mov $3,24
lpe
mov $0,$1
|
raycast/mute-meet.applescript | g-ongenae/dotfiles | 1 | 3434 | <reponame>g-ongenae/dotfiles
#!/usr/bin/osascript
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Mute Meet
# @raycast.mode compact
# Optional parameters:
# @raycast.icon 🤖
# @raycast.packageName Communication
# Documentation:
# @raycast.description Mute Google Meet
# @raycast.author <NAME>
# @raycast.authorURL https://github.com/g-ongenae
-- Source: https://github.com/aezell/mutemeet
tell application "Google Chrome"
activate
repeat with w in (windows) -- loop over each window
set j to 1 -- tabs are not zeroeth
repeat with t in (tabs of w) -- loop over each tab
if title of t starts with "Meet " then
set (active tab index of w) to j -- set Meet tab to active
set index of w to 1 -- set window with Meet tab to active
-- these two lines are hackery to actually activate the window
delay 0.5
do shell script "open -a \"Google Chrome\""
-- do Cmd+D in Google Chrome - Meet Window
-- FIXME: doesn't work
tell application "System Events" to tell process "Google Chrome" to keystroke "d" using command down
return
end if
set j to j + 1
end repeat
end repeat
end tell
|
programs/oeis/037/A037492.asm | neoneye/loda | 22 | 243576 | ; A037492: Base 7 digits are, in order, the first n terms of the periodic sequence with initial period 2,1.
; 2,15,107,750,5252,36765,257357,1801500,12610502,88273515,617914607,4325402250,30277815752,211944710265,1483612971857,10385290803000,72697035621002,508879249347015,3562154745429107
add $0,1
mov $1,7
pow $1,$0
mul $1,5
div $1,16
mov $0,$1
|
programs/oeis/330/A330700.asm | jmorken/loda | 1 | 176581 | <reponame>jmorken/loda
; A330700: a(n) = (n - 1)*n*(2*n^2 + 4*n - 1)/6.
; 0,0,5,29,94,230,475,875,1484,2364,3585,5225,7370,10114,13559,17815,23000,29240,36669,45429,55670,67550,81235,96899,114724,134900,157625,183105,211554,243194,278255,316975,359600,406384,457589,513485,574350,640470,712139,789659
mov $12,$0
mov $14,$0
lpb $14
clr $0,12
mov $0,$12
sub $14,1
sub $0,$14
mov $9,$0
mov $11,$0
lpb $11
mov $0,$9
sub $11,1
sub $0,$11
mov $3,$0
mul $0,6
mov $2,$0
mul $3,2
mov $4,$3
sub $3,$3
pow $0,$3
pow $4,2
sub $4,$2
mov $1,$4
add $1,$0
div $2,8
mov $5,8
lpb $5
mov $5,7
pow $6,$8
lpb $2
div $2,2
add $5,4
lpe
lpe
lpb $6
div $1,2
sub $6,1
lpe
add $10,$1
lpe
add $13,$10
lpe
mov $1,$13
|
agda/Dsub.agda | HuStmpHrrr/popl20-artifact | 1 | 16415 | <reponame>HuStmpHrrr/popl20-artifact
{-# OPTIONS --without-K --safe #-}
-- In this module, we define the subtyping relation of D<: according to Lemma 2.
module Dsub where
open import Data.List as List
open import Data.List.All as All
open import Data.Nat as ℕ
open import Data.Maybe as Maybe
open import Data.Product as Σ
open import Data.Sum
open import Data.Empty renaming (⊥ to False)
open import Data.Vec as Vec renaming (_∷_ to _‼_ ; [] to nil) hiding (_++_)
open import Function
open import Data.Maybe.Properties as Maybeₚ
open import Data.Nat.Properties as ℕₚ
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
open import DsubDef
open import Utils
module Dsub where
infix 4 _⊢_<:_
data _⊢_<:_ : Env → Typ → Typ → Set where
dtop : ∀ {Γ T} →
Γ ⊢ T <: ⊤
dbot : ∀ {Γ T} →
Γ ⊢ ⊥ <: T
drefl : ∀ {Γ T} →
Γ ⊢ T <: T
dtrans : ∀ {Γ S U} T →
(S<:T : Γ ⊢ S <: T) →
(T<:U : Γ ⊢ T <: U) →
Γ ⊢ S <: U
dbnd : ∀ {Γ S U S′ U′} →
(S′<:S : Γ ⊢ S′ <: S) →
(U<:U′ : Γ ⊢ U <: U′) →
Γ ⊢ ⟨A: S ⋯ U ⟩ <: ⟨A: S′ ⋯ U′ ⟩
dall : ∀ {Γ S U S′ U′} →
(S′<:S : Γ ⊢ S′ <: S) →
(U<:U′ : (S′ ∷ Γ) ⊢ U <: U′) →
Γ ⊢ Π S ∙ U <: Π S′ ∙ U′
dsel₁ : ∀ {Γ n T S} →
(T∈Γ : env-lookup Γ n ≡ just T) →
(D : Γ ⊢ T <: ⟨A: S ⋯ ⊤ ⟩) →
Γ ⊢ S <: n ∙A
dsel₂ : ∀ {Γ n T U} →
(T∈Γ : env-lookup Γ n ≡ just T) →
(D : Γ ⊢ T <: ⟨A: ⊥ ⋯ U ⟩) →
Γ ⊢ n ∙A <: U
D-measure : ∀ {Γ S U} (D : Γ ⊢ S <: U) → ℕ
D-measure dtop = 1
D-measure dbot = 1
D-measure drefl = 1
D-measure (dtrans _ S<:T T<:U) = 1 + D-measure S<:T + D-measure T<:U
D-measure (dbnd D₁ D₂) = 1 + D-measure D₁ + D-measure D₂
D-measure (dall Dp Db) = 1 + D-measure Dp + D-measure Db
D-measure (dsel₁ T∈Γ D) = 1 + D-measure D
D-measure (dsel₂ T∈Γ D) = 1 + D-measure D
D-measure≥1 : ∀ {Γ S U} (D : Γ ⊢ S <: U) → D-measure D ≥ 1
D-measure≥1 dtop = s≤s z≤n
D-measure≥1 dbot = s≤s z≤n
D-measure≥1 drefl = s≤s z≤n
D-measure≥1 (dtrans _ _ _) = s≤s z≤n
D-measure≥1 (dbnd _ _) = s≤s z≤n
D-measure≥1 (dall _ _) = s≤s z≤n
D-measure≥1 (dsel₁ _ _) = s≤s z≤n
D-measure≥1 (dsel₂ _ _) = s≤s z≤n
D-deriv : Set
D-deriv = Σ (Env × Typ × Typ) λ { (Γ , S , U) → Γ ⊢ S <: U }
env : D-deriv → Env
env ((Γ , _) , _) = Γ
typ₁ : D-deriv → Typ
typ₁ ((_ , S , U) , _) = S
typ₂ : D-deriv → Typ
typ₂ ((_ , S , U) , _) = U
drefl-dec : ∀ (D : D-deriv) → Dec (D ≡ ((env D , typ₁ D , _) , drefl))
drefl-dec (_ , dtop) = no (λ ())
drefl-dec (_ , dbot) = no (λ ())
drefl-dec (_ , drefl) = yes refl
drefl-dec (_ , dtrans _ _ _) = no (λ ())
drefl-dec (_ , dbnd _ _) = no (λ ())
drefl-dec (_ , dall _ _) = no (λ ())
drefl-dec (_ , dsel₁ _ _) = no (λ ())
drefl-dec (_ , dsel₂ _ _) = no (λ ())
-- weakening
infixl 7 _⇑
_⇑ : Env → Env
[] ⇑ = []
(T ∷ Γ) ⇑ = T ↑ length Γ ∷ Γ ⇑
↦∈-weaken-≤ : ∀ {n T Γ} →
n ↦ T ∈ Γ →
∀ Γ₁ Γ₂ T′ →
Γ ≡ Γ₁ ‣ Γ₂ →
length Γ₂ ≤ n →
suc n ↦ T ↑ length Γ₂ ∈ Γ₁ ‣ T′ ! ‣ Γ₂ ⇑
↦∈-weaken-≤ hd .(_ ∷ _) [] T′ refl z≤n = tl hd
↦∈-weaken-≤ hd Γ₁ (_ ∷ Γ₂) T′ eqΓ ()
↦∈-weaken-≤ (tl T∈Γ) .(_ ∷ _) [] T′ refl z≤n = tl (tl T∈Γ)
↦∈-weaken-≤ (tl {_} {T} T∈Γ) Γ₁ (_ ∷ Γ₂) T′ refl (s≤s l≤n)
rewrite ↑-↑-comm T 0 (length Γ₂) z≤n = tl (↦∈-weaken-≤ T∈Γ Γ₁ Γ₂ T′ refl l≤n)
↦∈-weaken-> : ∀ {n T Γ} →
n ↦ T ∈ Γ →
∀ Γ₁ Γ₂ T′ →
Γ ≡ Γ₁ ‣ Γ₂ →
length Γ₂ > n →
n ↦ T ↑ length Γ₂ ∈ Γ₁ ‣ T′ ! ‣ Γ₂ ⇑
↦∈-weaken-> T∈Γ Γ₁ [] T′ eqΓ ()
↦∈-weaken-> (hd {T}) Γ₁ (_ ∷ Γ₂) T′ refl (s≤s l>n)
rewrite ↑-↑-comm T 0 (length Γ₂) l>n = hd
↦∈-weaken-> (tl {_} {T} T∈Γ) Γ₁ (_ ∷ Γ₂) T′ refl (s≤s l>n)
rewrite ↑-↑-comm T 0 (length Γ₂) z≤n = tl (↦∈-weaken-> T∈Γ Γ₁ Γ₂ T′ refl l>n)
↦∈-weaken : ∀ {n T Γ} →
n ↦ T ∈ Γ →
∀ Γ₁ Γ₂ T′ →
Γ ≡ Γ₁ ‣ Γ₂ →
↑-idx n (length Γ₂) ↦ T ↑ length Γ₂ ∈ Γ₁ ‣ T′ ! ‣ Γ₂ ⇑
↦∈-weaken {n} T∈Γ _ Γ₂ _ eqΓ with length Γ₂ ≤? n
... | yes l≤n = ↦∈-weaken-≤ T∈Γ _ Γ₂ _ eqΓ l≤n
... | no l>n = ↦∈-weaken-> T∈Γ _ Γ₂ _ eqΓ (≰⇒> l>n)
↦∈-weaken′ : ∀ {n T Γ} →
env-lookup Γ n ≡ just T →
∀ Γ₁ Γ₂ T′ →
Γ ≡ Γ₁ ‣ Γ₂ →
env-lookup (Γ₁ ‣ T′ ! ‣ Γ₂ ⇑) (↑-idx n (length Γ₂)) ≡ just (T ↑ length Γ₂)
↦∈-weaken′ T∈Γ Γ₁ Γ₂ T′ eqΓ = ↦∈⇒lookup (↦∈-weaken (lookup⇒↦∈ T∈Γ) Γ₁ Γ₂ T′ eqΓ)
<:-weakening-gen : ∀ {Γ S U} →
Γ ⊢ S <: U →
∀ Γ₁ Γ₂ T →
Γ ≡ Γ₁ ‣ Γ₂ →
Γ₁ ‣ T ! ‣ Γ₂ ⇑ ⊢ S ↑ length Γ₂ <: U ↑ length Γ₂
<:-weakening-gen dtop Γ₁ Γ₂ T eqΓ = dtop
<:-weakening-gen dbot Γ₁ Γ₂ T eqΓ = dbot
<:-weakening-gen drefl Γ₁ Γ₂ T eqΓ = drefl
<:-weakening-gen (dtrans T′ S<:T′ T′<:U) Γ₁ Γ₂ T eqΓ = dtrans _
(<:-weakening-gen S<:T′ Γ₁ Γ₂ T eqΓ)
(<:-weakening-gen T′<:U Γ₁ Γ₂ T eqΓ)
<:-weakening-gen (dbnd S′<:S U<:U′) Γ₁ Γ₂ T eqΓ = dbnd (<:-weakening-gen S′<:S Γ₁ Γ₂ T eqΓ)
(<:-weakening-gen U<:U′ Γ₁ Γ₂ T eqΓ)
<:-weakening-gen (dall S′<:S U<:U′) Γ₁ Γ₂ T eqΓ = dall (<:-weakening-gen S′<:S Γ₁ Γ₂ T eqΓ)
(<:-weakening-gen U<:U′ Γ₁ (_ ∷ Γ₂) T (cong (_ ∷_) eqΓ))
<:-weakening-gen (dsel₁ {_} {n} T∈Γ T<:B) Γ₁ Γ₂ T eqΓ
rewrite ↑-var n (length Γ₂) = dsel₁ (↦∈-weaken′ T∈Γ Γ₁ Γ₂ T eqΓ)
(<:-weakening-gen T<:B Γ₁ Γ₂ T eqΓ)
<:-weakening-gen (dsel₂ {_} {n} T∈Γ T<:B) Γ₁ Γ₂ T eqΓ
rewrite ↑-var n (length Γ₂) = dsel₂ (↦∈-weaken′ T∈Γ Γ₁ Γ₂ T eqΓ)
(<:-weakening-gen T<:B Γ₁ Γ₂ T eqΓ)
<:-weakening : ∀ {Γ₁ Γ₂ S U} T →
Γ₁ ‣ Γ₂ ⊢ S <: U →
Γ₁ ‣ T ! ‣ Γ₂ ⇑ ⊢ S ↑ length Γ₂ <: U ↑ length Γ₂
<:-weakening T S<:U = <:-weakening-gen S<:U _ _ T refl
<:-weakening-hd : ∀ {Γ S U} T →
Γ ⊢ S <: U →
Γ ‣ T ! ⊢ S ↑ 0 <: U ↑ 0
<:-weakening-hd T = <:-weakening {Γ₂ = []} T
-- narrowing
infix 4 _≺:[_]_
data _≺:[_]_ : Env → ℕ → Env → Set where
≺[_,_] : ∀ {Γ U} S → Γ ⊢ S <: U → Γ ‣ S ! ≺:[ 0 ] Γ ‣ U !
_∷_ : ∀ {Γ₁ n Γ₂} T → Γ₁ ≺:[ n ] Γ₂ → Γ₁ ‣ T ! ≺:[ suc n ] Γ₂ ‣ T !
<:∈-find : ∀ {x T Γ Γ′ n} →
x ↦ T ∈ Γ →
Γ′ ≺:[ n ] Γ →
x ≡ n × (∃ λ T′ → n ↦ T′ ∈ Γ′ × Γ′ ⊢ T′ <: T) ⊎ x ≢ n × x ↦ T ∈ Γ′
<:∈-find hd ≺[ T′ , T′<:T ] = inj₁ (refl , T′ ↑ 0 , hd , <:-weakening-hd T′ T′<:T)
<:∈-find hd (T ∷ Γ′≺:Γ) = inj₂ ((λ ()) , hd)
<:∈-find (tl T∈Γ) ≺[ T′ , T′<:T ] = inj₂ ((λ ()) , tl T∈Γ)
<:∈-find (tl T∈Γ) (S ∷ Γ′≺:Γ) with <:∈-find T∈Γ Γ′≺:Γ
... | inj₁ (x≡n , T′ , T′∈Γ′ , T′<:T) = inj₁ (cong suc x≡n , T′ ↑ 0 , tl T′∈Γ′ , <:-weakening-hd S T′<:T)
... | inj₂ (x≢n , T∈Γ′) = inj₂ (x≢n ∘ suc-injective , tl T∈Γ′)
<:∈-find′ : ∀ {x T Γ Γ′ n} →
env-lookup Γ x ≡ just T →
Γ′ ≺:[ n ] Γ →
x ≡ n × (∃ λ T′ → env-lookup Γ′ n ≡ just T′ × Γ′ ⊢ T′ <: T) ⊎ x ≢ n × env-lookup Γ′ x ≡ just T
<:∈-find′ T∈Γ Γ′≺Γ with <:∈-find (lookup⇒↦∈ T∈Γ) Γ′≺Γ
... | inj₁ (x≡n , T′ , T′∈Γ′ , T′<:T) = inj₁ (x≡n , T′ , ↦∈⇒lookup T′∈Γ′ , T′<:T)
... | inj₂ (x≢n , T∈Γ′) = inj₂ (x≢n , ↦∈⇒lookup T∈Γ′)
<:-narrow : ∀ {Γ Γ′ n S U T} →
Γ ⊢ S <: U →
Γ′ ≺:[ n ] Γ →
env-lookup Γ n ≡ just T →
Γ′ ⊢ S <: U
<:-narrow dtop Γ′≺Γ T∈Γ = dtop
<:-narrow dbot Γ′≺Γ T∈Γ = dbot
<:-narrow drefl Γ′≺Γ T∈Γ = drefl
<:-narrow (dtrans T S<:T T<:U) Γ′≺Γ T∈Γ = dtrans T (<:-narrow S<:T Γ′≺Γ T∈Γ) (<:-narrow T<:U Γ′≺Γ T∈Γ)
<:-narrow (dbnd S′<:S U<:U′) Γ′≺Γ T∈Γ = dbnd (<:-narrow S′<:S Γ′≺Γ T∈Γ) (<:-narrow U<:U′ Γ′≺Γ T∈Γ)
<:-narrow {Γ} {Γ′} {n} (dall {S′ = S′} S′<:S U<:U′) Γ′≺Γ T∈Γ
= dall (<:-narrow S′<:S Γ′≺Γ T∈Γ)
(<:-narrow U<:U′ (_ ∷ Γ′≺Γ) (↦∈⇒lookup (tl {n} {T′ = S′} {Γ} (lookup⇒↦∈ T∈Γ))))
<:-narrow (dsel₁ T′∈Γ T′<:B) Γ′≺Γ T∈Γ
with <:∈-find′ T′∈Γ Γ′≺Γ
... | inj₁ (refl , T″ , T″∈Γ′ , T″<:T)
rewrite just-injective (trans (sym T′∈Γ) T∈Γ) = dsel₁ T″∈Γ′ (dtrans _ T″<:T (<:-narrow T′<:B Γ′≺Γ T∈Γ))
... | inj₂ (x≢n , T′∈Γ′) = dsel₁ T′∈Γ′ (<:-narrow T′<:B Γ′≺Γ T∈Γ)
<:-narrow (dsel₂ T′∈Γ T′<:B) Γ′≺Γ T∈Γ
with <:∈-find′ T′∈Γ Γ′≺Γ
... | inj₁ (refl , T″ , T″∈Γ′ , T″<:T)
rewrite just-injective (trans (sym T′∈Γ) T∈Γ) = dsel₂ T″∈Γ′ (dtrans _ T″<:T (<:-narrow T′<:B Γ′≺Γ T∈Γ))
... | inj₂ (x≢n , T′∈Γ′) = dsel₂ T′∈Γ′ (<:-narrow T′<:B Γ′≺Γ T∈Γ)
open Dsub hiding (<:-weakening-gen; <:-weakening; <:-weakening-hd
; _≺:[_]_; ≺[_,_]; _∷_; <:∈-find; <:∈-find′; <:-narrow) public
-- materialization of inversion properties in invertible contexts
module DsubInvProperties {P : Env → Set}
(invertible : InvertibleEnv P) where
module ContraEnvProperties = InvertibleProperties invertible _⊢_<:_
open ContraEnvProperties public
mutual
<:⇒<:ᵢ : ∀ {Γ S U} → Γ ⊢ S <: U → P Γ → Γ ⊢ᵢ S <: U
<:⇒<:ᵢ dtop pΓ = ditop
<:⇒<:ᵢ dbot pΓ = dibot
<:⇒<:ᵢ drefl pΓ = direfl
<:⇒<:ᵢ (dtrans T S<:T T<:U) pΓ = ditrans T (<:⇒<:ᵢ S<:T pΓ) (<:⇒<:ᵢ T<:U pΓ)
<:⇒<:ᵢ (dbnd S′<:S U<:U′) pΓ = dibnd (<:⇒<:ᵢ S′<:S pΓ) (<:⇒<:ᵢ U<:U′ pΓ)
<:⇒<:ᵢ (dall S′<:S U<:U′) pΓ = diall (<:⇒<:ᵢ S′<:S pΓ) U<:U′
<:⇒<:ᵢ (dsel₁ T∈Γ T<:B) pΓ with sel-case T∈Γ T<:B pΓ
... | refl , _ = dibot
<:⇒<:ᵢ (dsel₂ T∈Γ T<:B) pΓ with sel-case T∈Γ T<:B pΓ
... | refl , U′ , refl
with ⟨A:⟩<:⟨A:⟩ (<:⇒<:ᵢ T<:B pΓ) pΓ
... | _ , U′<:U = ditrans U′ (disel T∈Γ) U′<:U
sel-case : ∀ {T Γ n S U} →
env-lookup Γ n ≡ just T →
Γ ⊢ T <: ⟨A: S ⋯ U ⟩ →
P Γ →
S ≡ ⊥ × ∃ λ U′ → T ≡ ⟨A: ⊥ ⋯ U′ ⟩
sel-case {⊤} T∈Γ T<:B pΓ = case ⊤<: (<:⇒<:ᵢ T<:B pΓ) of λ ()
sel-case {⊥} T∈Γ T<:B pΓ = ⊥-elim (no-⊥ pΓ T∈Γ)
sel-case {n ∙A} T∈Γ T<:B pΓ
with <:⟨A:⟩ (<:⇒<:ᵢ T<:B pΓ) pΓ
... | inj₁ ()
... | inj₂ (_ , _ , ())
sel-case {Π S ∙ U} T∈Γ T<:B pΓ
with <:⟨A:⟩ (<:⇒<:ᵢ T<:B pΓ) pΓ
... | inj₁ ()
... | inj₂ (_ , _ , ())
sel-case {⟨A: S ⋯ U ⟩} T∈Γ T<:B pΓ
rewrite ⊥-lb pΓ T∈Γ with ⟨A:⟩<:⟨A:⟩ (<:⇒<:ᵢ T<:B pΓ) pΓ
... | S<:⊥ , _ with <:⊥ S<:⊥ pΓ
... | refl = refl , U , refl
<:ᵢ⇒<: : ∀ {Γ S U} → Γ ⊢ᵢ S <: U → Γ ⊢ S <: U
<:ᵢ⇒<: ditop = dtop
<:ᵢ⇒<: dibot = dbot
<:ᵢ⇒<: direfl = drefl
<:ᵢ⇒<: (ditrans T S<:T T<:U) = dtrans T (<:ᵢ⇒<: S<:T) (<:ᵢ⇒<: T<:U)
<:ᵢ⇒<: (dibnd S′<:S U<:U′) = dbnd (<:ᵢ⇒<: S′<:S) (<:ᵢ⇒<: U<:U′)
<:ᵢ⇒<: (diall S′<:S U<:U′) = dall (<:ᵢ⇒<: S′<:S) U<:U′
<:ᵢ⇒<: (disel T∈Γ) = dsel₂ T∈Γ drefl
⊤<:′ : ∀ {Γ T} → Γ ⊢ ⊤ <: T → P Γ → T ≡ ⊤
⊤<:′ ⊤<:T = ⊤<: ∘ <:⇒<:ᵢ ⊤<:T
<:⊥′ : ∀ {Γ T} → Γ ⊢ T <: ⊥ → P Γ → T ≡ ⊥
<:⊥′ T<:⊥ pΓ = <:⊥ (<:⇒<:ᵢ T<:⊥ pΓ) pΓ
⟨A:⟩<:⟨A:⟩′ : ∀ {Γ S′ U U′} → Γ ⊢ ⟨A: ⊥ ⋯ U ⟩ <: ⟨A: S′ ⋯ U′ ⟩ → P Γ →
S′ ≡ ⊥
⟨A:⟩<:⟨A:⟩′ B<:B′ pΓ with ⟨A:⟩<:⟨A:⟩ (<:⇒<:ᵢ B<:B′ pΓ) pΓ
... | S<:⊥ , _ = <:⊥ S<:⊥ pΓ
Π<:⟨A:⟩⇒⊥ : ∀ {Γ S U S′ U′} → Γ ⊢ᵢ Π S ∙ U <: ⟨A: S′ ⋯ U′ ⟩ → P Γ → False
Π<:⟨A:⟩⇒⊥ Π<:⟨A:⟩ eΓ with <:⟨A:⟩ Π<:⟨A:⟩ eΓ
... | inj₁ ()
... | inj₂ (_ , _ , ())
∙A<:⟨A:⟩⇒⊥ : ∀ {Γ x S U} → Γ ⊢ᵢ x ∙A <: ⟨A: S ⋯ U ⟩ → P Γ → False
∙A<:⟨A:⟩⇒⊥ x∙A<:⟨A:⟩ eΓ with <:⟨A:⟩ x∙A<:⟨A:⟩ eΓ
... | inj₁ ()
... | inj₂ (_ , _ , ())
Π<:Π : ∀ {Γ S U S′ U′} →
Γ ⊢ Π S ∙ U <: Π S′ ∙ U′ →
P Γ →
Γ ⊢ S′ <: S × (S′ ∷ Γ) ⊢ U <: U′
Π<:Π <: pΓ = Σ.map₁ <:ᵢ⇒<: $ helper (<:⇒<:ᵢ <: pΓ) pΓ
where helper : ∀ {Γ S U S′ U′} →
Γ ⊢ᵢ Π S ∙ U <: Π S′ ∙ U′ →
P Γ →
Γ ⊢ᵢ S′ <: S × (S′ ∷ Γ) ⊢ U <: U′
helper direfl pΓ = direfl , drefl
helper (ditrans T <: <:′) pΓ with Π<: <:
... | inj₁ refl = case ⊤<: <:′ of λ ()
... | inj₂ (_ , _ , refl)
with helper <: pΓ | helper <:′ pΓ
... | S″<:S′ , U′<:U″ | S‴<:S″ , U″<:U‴ = ditrans _ S‴<:S″ S″<:S′
, dtrans _ (Dsub.<:-narrow U′<:U″ Dsub.≺[ _ , <:ᵢ⇒<: S‴<:S″ ] refl) U″<:U‴
helper (diall <: U<:U′) pΓ = <: , U<:U′
|
extern/game_support/src/backends/opengl_sdl_gnat_sdl/display-basic-fonts.ads | AdaCore/training_material | 15 | 2554 | with Display.Basic.Utils; use Display.Basic.Utils;
with SDL_SDL_stdinc_h; use SDL_SDL_stdinc_h;
with SDL_SDL_video_h; use SDL_SDL_video_h;
package Display.Basic.Fonts is
type BMP_Font is (Font8x8, Font12x12, Font16x24);
procedure Draw_Char
(S : access SDL_Surface;
P : Screen_Point;
Char : Character;
Font : BMP_Font;
FG, BG : Uint32);
procedure Draw_Char
(Canvas : T_Internal_Canvas;
P : Screen_Point;
Char : Character;
Font : BMP_Font;
FG, BG : Uint32);
procedure Draw_String
(S : access SDL_Surface;
P : Screen_Point;
Str : String;
Font : BMP_Font;
FG, BG : RGBA_T;
Wrap : Boolean := False);
procedure Draw_String
(Canvas : T_Internal_Canvas;
P : Screen_Point;
Str : String;
Font : BMP_Font;
FG, BG : RGBA_T;
Wrap : Boolean := False);
function Char_Size (Font : BMP_Font) return Screen_Point;
function String_Size (Font : BMP_Font; Text : String) return Screen_Point;
end Display.Basic.Fonts;
|
programs/oeis/081/A081604.asm | jmorken/loda | 1 | 13349 | <reponame>jmorken/loda
; A081604: Number of digits in ternary representation of n.
; 1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6
lpb $0,$0
div $0,3
add $2,1
lpe
mov $1,$2
add $1,1
|
lib/title.asm | cppchriscpp/waddles-the-duck | 0 | 85957 | .macro draw_title_screen num
set_ppu_addr $2000
store #<(.ident(.concat("title_tile_", .string(num)))), tempAddr
store #>(.ident(.concat("title_tile_", .string(num)))), tempAddr+1
jsr PKB_unpackblk
store #<(.ident(.concat("title_sprites_", .string(num)))), tempAddr
store #>(.ident(.concat("title_sprites_", .string(num)))), tempAddr+1
jsr draw_title_sprites_origin
.endmacro
.macro draw_title_text_only num
set_ppu_addr $21c0
store #<(.ident(.concat("title_tile_", .string(num)))), tempAddr
store #>(.ident(.concat("title_tile_", .string(num)))), tempAddr+1
jsr PKB_unpackblk
store #<(.ident(.concat("title_sprites_", .string(num)))), tempAddr
store #>(.ident(.concat("title_sprites_", .string(num)))), tempAddr+1
jsr draw_title_sprites_origin
.endmacro
show_intro:
lda #SONG_INTRO
jsr music_play
lda #%11001000
sta ppuCtrlBuffer
lda #0
sta scrollX
sta scrollY
reset_ppu_scrolling_and_ctrl
lda #MENU_PALETTE_ID
sta currentPalette
lda #$0f
sta currentBackgroundColorOverride
lda #0 ; High-resolution timer for events... tempe = lo, tempf = hi
sta tempe
sta tempf
draw_title_screen 1
set_ppu_addr $3f00
lda #0
ldx #0
@loop_pal:
sta PPU_DATA
inx
cpx #32
bne @loop_pal
reset_ppu_scrolling_and_ctrl
jsr vblank_wait
jsr vblank_wait
jsr enable_all
jsr do_menu_fade_in
@loop:
jsr sound_update
jsr read_controller
jsr draw_title_sprites
lda ctrlButtons
cmp #CONTROLLER_START
beq @no_start
lda lastCtrlButtons
cmp #CONTROLLER_START
bne @no_start
rts
@no_start:
inc tempe
lda #0
cmp tempe
bne @no_increment
inc tempf
@no_increment:
jsr vblank_wait
bne16 375, tempe, @not_flash
jsr bright_flash
@not_flash:
bne16 434, tempe, @not_1st_fadeout
jsr do_menu_fade_out
@not_1st_fadeout:
; Look up where in the cycle we are and if we need to take action.
bne16 435, tempe, @not_2nd
jsr disable_all
jsr vblank_wait
jsr sound_update
draw_title_screen 2
reset_ppu_scrolling_and_ctrl
jsr vblank_wait
jsr sound_update
jsr enable_all
@not_2nd:
bne16 480, tempe, @not_2nd_fadein
jsr do_menu_fade_in
@not_2nd_fadein:
bne16 974, tempe, @not_2nd_fadeout
jsr do_menu_fade_out
@not_2nd_fadeout:
bne16 975, tempe, @not_3rd
jsr disable_all
jsr vblank_wait
jsr sound_update
draw_title_text_only 3
reset_ppu_scrolling_and_ctrl
jsr vblank_wait
jsr sound_update
jsr enable_all
@not_3rd:
bne16 1035, tempe, @not_3rd_fadein
jsr do_menu_fade_in
@not_3rd_fadein:
bne16 1665, tempe, @not_3rd_fadeout
jsr do_menu_fade_out
rts
@not_3rd_fadeout:
jmp @loop
do_menu_fade_out:
phx
ldx #0
stx temp0
@loop:
txa
pha ; Shove it into the stack so we can get it back.
lsr
lsr ; Now between 0-3 decreasing
asl
asl
asl
asl ; Now a multiple of 16
sta temp0
jsr do_fade_anim
reset_ppu_scrolling_and_ctrl
jsr sound_update
pla
tax ; x is back.
inx
cpx #17
bne @loop
plx
rts
do_menu_fade_in:
phx
ldx #16
stx temp0
@loop:
txa
pha ; Shove it into the stack so we can get it back.
lsr
lsr ; Now between 0-3 decreasing
asl
asl
asl
asl ; Now a multiple of 16
sta temp0
jsr do_fade_anim
reset_ppu_scrolling_and_ctrl
jsr sound_update
pla
tax ; x is back.
dex
cpx #255
bne @loop
plx
rts
bright_flash:
phx
jsr vblank_wait
set_ppu_addr $3f00
lda #$10
ldx #0
@loop_pal_0:
sta PPU_DATA
inx
cpx #16
bne @loop_pal_0
reset_ppu_scrolling_and_ctrl
jsr sound_update
; Everyone is gone!
ldx #24
lda #SPRITE_OFFSCREEN
@loop_desprite:
sta EXTENDED_SPRITE_DATA, x
inx
cpx #0
bne @loop_desprite
.repeat 4
jsr vblank_wait
jsr sound_update
.endrepeat
jsr vblank_wait
set_ppu_addr $3f00
lda #$30
ldx #0
@loop_pal_1:
sta PPU_DATA
inx
cpx #16
bne @loop_pal_1
reset_ppu_scrolling_and_ctrl
jsr sound_update
jsr vblank_wait
set_ppu_addr $3f00
lda #$10
ldx #0
@loop_pal_2:
sta PPU_DATA
inx
cpx #16
bne @loop_pal_2
reset_ppu_scrolling_and_ctrl
jsr sound_update
jsr vblank_wait
jsr load_palettes_for_dimension
reset_ppu_scrolling_and_ctrl
plx
rts
draw_title_sprites_origin:
phy
ldy #0
@loop:
lda (tempAddr), y
cmp #$ff
beq @done
sta EXTENDED_SPRITE_DATA, y
iny
.repeat 3
lda (tempAddr), y
sta EXTENDED_SPRITE_DATA, y
.endrepeat
jmp @loop
@done:
ply
rts
; Copies ending_sprites over, adding floating for any sprites that deserve it.
draw_title_sprites:
lda frameCounter
and #%001100000
lsr
lsr
lsr
lsr
lsr
sta tempa
cmp #1
bcc @low
; It's above... cut it down to its own size
lda #2
sec
sbc tempa
sta tempa
@low:
phy
ldy #0
@loop:
lda EXTENDED_SPRITE_DATA+1, y
cmp #$c0
bcc @not_grp1
cmp #$c6
bcs @not_grp1
jmp @rotator
@not_grp1:
cmp #$d0
bcc @not_grp2
cmp #$d6
bcs @not_grp2
jmp @rotator
@not_grp2:
; Plain, non-rotating sprite code
sta SPRITE_DATA+1, y
lda EXTENDED_SPRITE_DATA+2, y
sta SPRITE_DATA+2, y
lda EXTENDED_SPRITE_DATA+3, y
sta SPRITE_DATA+3, y
lda EXTENDED_SPRITE_DATA, y
sta SPRITE_DATA, y
jmp @continue
@rotator:
; Regular rotating sprite
sta SPRITE_DATA+1, y
lda EXTENDED_SPRITE_DATA+2, y
sta SPRITE_DATA+2, y
lda EXTENDED_SPRITE_DATA+3, y
sta SPRITE_DATA+3, y
lda EXTENDED_SPRITE_DATA, y
cmp #17
bcc @skip
cmp #SPRITE_OFFSCREEN-1
bcs @skip
clc
adc tempa
jmp @do
@skip:
lda #SPRITE_OFFSCREEN
@do:
sta SPRITE_DATA, y
@continue:
.repeat 4
iny
.endrepeat
cpy #0
bne @loop
ply
rts
title_tile_1:
.incbin "graphics/processed/title_0.nam.pkb"
title_sprites_1:
.scope TITLE_SPRITE_0
DX1 = 60
DY1 = 48
.byte DY1, $c0, 0, DX1, DY1, $c1, 0, DX1+8, DY1, $c2, 0, DX1+16
.byte DY1+8, $d0, 0, DX1, DY1+8, $d1, 0, DX1+8, DY1+8, $d2, 0, DX1+16
DX2 = 160
DY2 = 48
.byte DY2, $c2, $40, DX2, DY2, $c1, $40, DX2+8, DY2, $c0, $40, DX2+16
.byte DY2+8, $d2, $40, DX2, DY2+8, $d1, $40, DX2+8, DY2+8, $d0, $40, DX2+16
DX3 = 90
DY3 = 40
.byte DY3, $c4, 0, DX3, DY3, $c5, 0, DX3+8
DX4 = 140
DY4 = 40
.byte DY4, $c5, $40, DX4, DY4, $c4, $40, DX4+8
DX5 = 120
DY5 = 60
.byte DY5, $c4, 0, DX5, DY5, $c5, 0, DX5+8
.byte $ff
.endscope
title_tile_2:
.incbin "graphics/processed/title_1.nam.pkb"
title_sprites_2:
title_sprites_3:
.scope TITLE_SPRITE_1
DX1 = 160
DY1 = 48
.byte DY1, $c6, 0, DX1, DY1, $c7, 0, DX1+8, DY1, $c8, 0, DX1+16
.byte DY1+8, $d6, 0, DX1, DY1+8, $d7, 0, DX1+8, DY1+8, $d8, 0, DX1+16
DX2 = 190
DY2 = 48
.byte DY2, $c8, $40, DX2, DY2, $c7, $40, DX2+8, DY2, $c6, $40, DX2+16
.byte DY2+8, $d8, $40, DX2, DY2+8, $d7, $40, DX2+8, DY2+8, $d6, $40, DX2+16
.byte $ff
.endscope
title_tile_3:
.incbin "graphics/processed/title_2_half.nam.pkb" |
Transynther/x86/_processed/NONE/_ht_st_zr_un_/i9-9900K_12_0xa0.log_21829_1897.asm | ljhsiun2/medusa | 9 | 82932 | <filename>Transynther/x86/_processed/NONE/_ht_st_zr_un_/i9-9900K_12_0xa0.log_21829_1897.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r15
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0xe370, %r10
nop
nop
nop
nop
add $18646, %rsi
vmovups (%r10), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $1, %xmm2, %r15
nop
nop
nop
nop
cmp $50508, %rsi
lea addresses_UC_ht+0x1c490, %rdi
add $46657, %r10
mov $0x6162636465666768, %r13
movq %r13, %xmm4
movups %xmm4, (%rdi)
cmp %r10, %r10
lea addresses_D_ht+0x5770, %rsi
lea addresses_WT_ht+0x17d10, %rdi
nop
nop
nop
nop
nop
sub %rdx, %rdx
mov $29, %rcx
rep movsw
nop
nop
nop
nop
nop
and $55771, %r13
lea addresses_A_ht+0x1d1e8, %r13
nop
nop
sub $49379, %rsi
movl $0x61626364, (%r13)
nop
nop
add $5557, %r15
lea addresses_UC_ht+0x70f0, %rsi
lea addresses_WT_ht+0x1e130, %rdi
nop
nop
nop
nop
nop
add %r8, %r8
mov $96, %rcx
rep movsl
nop
nop
nop
nop
xor $41277, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r15
push %rbp
push %rdi
// Faulty Load
lea addresses_WT+0xd4f0, %rdi
clflush (%rdi)
nop
nop
and %r10, %r10
movups (%rdi), %xmm4
vpextrq $1, %xmm4, %rbp
lea oracles, %r12
and $0xff, %rbp
shlq $12, %rbp
mov (%r12,%rbp,1), %rbp
pop %rdi
pop %rbp
pop %r15
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'same': True, 'congruent': 7, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}}
{'src': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4}}
{'src': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 5, 'type': 'addresses_WT_ht'}}
{'46': 18040, '49': 3761, 'ff': 2, '00': 1, 'c0': 4, '36': 12, '08': 9}
00 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 46 46 49 49 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 49 49 46 46 46 46 49 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 46 49 46 46 46 46 49 46 46 46 49 49 46 46 46 46 46 46 46 46 49 36 46 46 46 46 46 46 46 46 49 46 46 46 49 46 46 46 46 46 46 46 46 46 46 49 46 46 46 49 46 46 46 46 46 46 46 46 46 49 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 46 46 46 49 46 46 46 46 46 46 46 46 46 46 49 46 46 46 46 46 46 46 49 46 46 46 49 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 46 49 46 46 46 49 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 49 49 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 46 49 46 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 08 49 46 46 46 46 49 49 46 46 46 49 46 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 46 46 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 46 46 49 46 46 46 46 46 46 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 49 46 46 46 46 46 46 46 46 49 46 46 46 49 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 46 46 46 46 46 46 46 46 46 46 49 46 46 46 49 46 46 46 46 49 49 46 46 46 46 49 46 46 46 49 46 46 46 46 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 46 46 46 46 49 46 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 46 46 49 46 46 46 49 46 46 46 46 49 46 46 46 46 46 46 46 46 46 49 46 46 46 46 46 46 46
*/
|
programs/oeis/206/A206735.asm | karttu/loda | 1 | 178568 | ; A206735: Triangle T(n,k), read by rows, given by (0, 2, -1/2, 1/2, 0, 0, 0, 0, 0, 0, 0, ...) DELTA (1, 0, -1/2, 1/2, 0, 0, 0, 0, 0, 0, 0, ...) where DELTA is the operator defined in A084938.
; 1,0,1,0,2,1,0,3,3,1,0,4,6,4,1,0,5,10,10,5,1,0,6,15,20,15,6,1,0,7,21,35,35,21,7,1,0,8,28,56,70,56,28,8,1,0,9,36,84,126,126,84,36,9,1,0,10,45,120,210,252,210,120,45,10,1,0,11,55,165,330,462,462,330,165,55,11,1
mov $4,$0
lpb $4,$4
add $3,1
sub $4,$3
lpe
bin $3,$4
mov $1,$3
|
src/gnat/prj-conf.adb | Letractively/ada-gen | 0 | 13269 | <filename>src/gnat/prj-conf.adb
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J . C O N F --
-- --
-- B o d y --
-- --
-- Copyright (C) 2006-2010, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Hostparm;
with Makeutl; use Makeutl;
with MLib.Tgt;
with Opt; use Opt;
with Output; use Output;
with Prj.Env;
with Prj.Err;
with Prj.Part;
with Prj.PP;
with Prj.Proc; use Prj.Proc;
with Prj.Tree; use Prj.Tree;
with Prj.Util; use Prj.Util;
with Prj; use Prj;
with Snames; use Snames;
with Ada.Directories; use Ada.Directories;
with Ada.Exceptions; use Ada.Exceptions;
with GNAT.Case_Util; use GNAT.Case_Util;
with GNAT.HTable; use GNAT.HTable;
package body Prj.Conf is
Auto_Cgpr : constant String := "auto.cgpr";
Default_Name : constant String := "default.cgpr";
-- Default configuration file that will be used if found
Config_Project_Env_Var : constant String := "GPR_CONFIG";
-- Name of the environment variable that provides the name of the
-- configuration file to use.
Gprconfig_Name : constant String := "gprconfig";
package RTS_Languages is new GNAT.HTable.Simple_HTable
(Header_Num => Prj.Header_Num,
Element => Name_Id,
No_Element => No_Name,
Key => Name_Id,
Hash => Prj.Hash,
Equal => "=");
-- Stores the runtime names for the various languages. This is in general
-- set from a --RTS command line option.
-----------------------
-- Local_Subprograms --
-----------------------
procedure Add_Attributes
(Project_Tree : Project_Tree_Ref;
Conf_Decl : Declarations;
User_Decl : in out Declarations);
-- Process the attributes in the config declarations.
-- For single string values, if the attribute is not declared in the user
-- declarations, declare it with the value in the config declarations.
-- For string list values, prepend the value in the user declarations with
-- the value in the config declarations.
function Check_Target
(Config_File : Prj.Project_Id;
Autoconf_Specified : Boolean;
Project_Tree : Prj.Project_Tree_Ref;
Target : String := "") return Boolean;
-- Check that the config file's target matches Target.
-- Target should be set to the empty string when the user did not specify
-- a target. If the target in the configuration file is invalid, this
-- function will raise Invalid_Config with an appropriate message.
-- Autoconf_Specified should be set to True if the user has used
-- autoconf.
function Locate_Config_File (Name : String) return String_Access;
-- Search for Name in the config files directory. Return full path if
-- found, or null otherwise.
procedure Raise_Invalid_Config (Msg : String);
pragma No_Return (Raise_Invalid_Config);
-- Raises exception Invalid_Config with given message
--------------------
-- Add_Attributes --
--------------------
procedure Add_Attributes
(Project_Tree : Project_Tree_Ref;
Conf_Decl : Declarations;
User_Decl : in out Declarations)
is
Conf_Attr_Id : Variable_Id;
Conf_Attr : Variable;
Conf_Array_Id : Array_Id;
Conf_Array : Array_Data;
Conf_Array_Elem_Id : Array_Element_Id;
Conf_Array_Elem : Array_Element;
Conf_List : String_List_Id;
Conf_List_Elem : String_Element;
User_Attr_Id : Variable_Id;
User_Attr : Variable;
User_Array_Id : Array_Id;
User_Array : Array_Data;
User_Array_Elem_Id : Array_Element_Id;
User_Array_Elem : Array_Element;
begin
Conf_Attr_Id := Conf_Decl.Attributes;
User_Attr_Id := User_Decl.Attributes;
while Conf_Attr_Id /= No_Variable loop
Conf_Attr :=
Project_Tree.Variable_Elements.Table (Conf_Attr_Id);
User_Attr :=
Project_Tree.Variable_Elements.Table (User_Attr_Id);
if not Conf_Attr.Value.Default then
if User_Attr.Value.Default then
-- No attribute declared in user project file: just copy the
-- value of the configuration attribute.
User_Attr.Value := Conf_Attr.Value;
Project_Tree.Variable_Elements.Table (User_Attr_Id) :=
User_Attr;
elsif User_Attr.Value.Kind = List
and then Conf_Attr.Value.Values /= Nil_String
then
-- List attribute declared in both the user project and the
-- configuration project: prepend the user list with the
-- configuration list.
declare
Conf_List : String_List_Id := Conf_Attr.Value.Values;
Conf_Elem : String_Element;
User_List : constant String_List_Id :=
User_Attr.Value.Values;
New_List : String_List_Id;
New_Elem : String_Element;
begin
-- Create new list
String_Element_Table.Increment_Last
(Project_Tree.String_Elements);
New_List := String_Element_Table.Last
(Project_Tree.String_Elements);
-- Value of attribute is new list
User_Attr.Value.Values := New_List;
Project_Tree.Variable_Elements.Table (User_Attr_Id) :=
User_Attr;
loop
-- Get each element of configuration list
Conf_Elem :=
Project_Tree.String_Elements.Table (Conf_List);
New_Elem := Conf_Elem;
Conf_List := Conf_Elem.Next;
if Conf_List = Nil_String then
-- If it is the last element in the list, connect to
-- first element of user list, and we are done.
New_Elem.Next := User_List;
Project_Tree.String_Elements.Table
(New_List) := New_Elem;
exit;
else
-- If it is not the last element in the list, add to
-- new list.
String_Element_Table.Increment_Last
(Project_Tree.String_Elements);
New_Elem.Next :=
String_Element_Table.Last
(Project_Tree.String_Elements);
Project_Tree.String_Elements.Table
(New_List) := New_Elem;
New_List := New_Elem.Next;
end if;
end loop;
end;
end if;
end if;
Conf_Attr_Id := Conf_Attr.Next;
User_Attr_Id := User_Attr.Next;
end loop;
Conf_Array_Id := Conf_Decl.Arrays;
while Conf_Array_Id /= No_Array loop
Conf_Array := Project_Tree.Arrays.Table (Conf_Array_Id);
User_Array_Id := User_Decl.Arrays;
while User_Array_Id /= No_Array loop
User_Array := Project_Tree.Arrays.Table (User_Array_Id);
exit when User_Array.Name = Conf_Array.Name;
User_Array_Id := User_Array.Next;
end loop;
-- If this associative array does not exist in the user project file,
-- do a shallow copy of the full associative array.
if User_Array_Id = No_Array then
Array_Table.Increment_Last (Project_Tree.Arrays);
User_Array := Conf_Array;
User_Array.Next := User_Decl.Arrays;
User_Decl.Arrays := Array_Table.Last (Project_Tree.Arrays);
Project_Tree.Arrays.Table (User_Decl.Arrays) := User_Array;
else
-- Otherwise, check each array element
Conf_Array_Elem_Id := Conf_Array.Value;
while Conf_Array_Elem_Id /= No_Array_Element loop
Conf_Array_Elem :=
Project_Tree.Array_Elements.Table (Conf_Array_Elem_Id);
User_Array_Elem_Id := User_Array.Value;
while User_Array_Elem_Id /= No_Array_Element loop
User_Array_Elem :=
Project_Tree.Array_Elements.Table (User_Array_Elem_Id);
exit when User_Array_Elem.Index = Conf_Array_Elem.Index;
User_Array_Elem_Id := User_Array_Elem.Next;
end loop;
-- If the array element does not exist in the user array,
-- insert a shallow copy of the conf array element in the
-- user array.
if User_Array_Elem_Id = No_Array_Element then
Array_Element_Table.Increment_Last
(Project_Tree.Array_Elements);
User_Array_Elem := Conf_Array_Elem;
User_Array_Elem.Next := User_Array.Value;
User_Array.Value :=
Array_Element_Table.Last (Project_Tree.Array_Elements);
Project_Tree.Array_Elements.Table (User_Array.Value) :=
User_Array_Elem;
Project_Tree.Arrays.Table (User_Array_Id) := User_Array;
-- Otherwise, if the value is a string list, prepend the
-- user array element with the conf array element value.
elsif Conf_Array_Elem.Value.Kind = List then
Conf_List := Conf_Array_Elem.Value.Values;
if Conf_List /= Nil_String then
declare
Link : constant String_List_Id :=
User_Array_Elem.Value.Values;
Previous : String_List_Id := Nil_String;
Next : String_List_Id;
begin
loop
Conf_List_Elem :=
Project_Tree.String_Elements.Table
(Conf_List);
String_Element_Table.Increment_Last
(Project_Tree.String_Elements);
Next :=
String_Element_Table.Last
(Project_Tree.String_Elements);
Project_Tree.String_Elements.Table (Next) :=
Conf_List_Elem;
if Previous = Nil_String then
User_Array_Elem.Value.Values := Next;
Project_Tree.Array_Elements.Table
(User_Array_Elem_Id) := User_Array_Elem;
else
Project_Tree.String_Elements.Table
(Previous).Next := Next;
end if;
Previous := Next;
Conf_List := Conf_List_Elem.Next;
if Conf_List = Nil_String then
Project_Tree.String_Elements.Table
(Previous).Next := Link;
exit;
end if;
end loop;
end;
end if;
end if;
Conf_Array_Elem_Id := Conf_Array_Elem.Next;
end loop;
end if;
Conf_Array_Id := Conf_Array.Next;
end loop;
end Add_Attributes;
------------------------------------
-- Add_Default_GNAT_Naming_Scheme --
------------------------------------
procedure Add_Default_GNAT_Naming_Scheme
(Config_File : in out Project_Node_Id;
Project_Tree : Project_Node_Tree_Ref)
is
procedure Create_Attribute
(Name : Name_Id;
Value : String;
Index : String := "";
Pkg : Project_Node_Id := Empty_Node);
----------------------
-- Create_Attribute --
----------------------
procedure Create_Attribute
(Name : Name_Id;
Value : String;
Index : String := "";
Pkg : Project_Node_Id := Empty_Node)
is
Attr : Project_Node_Id;
pragma Unreferenced (Attr);
Expr : Name_Id := No_Name;
Val : Name_Id := No_Name;
Parent : Project_Node_Id := Config_File;
begin
if Index /= "" then
Name_Len := Index'Length;
Name_Buffer (1 .. Name_Len) := Index;
Val := Name_Find;
end if;
if Pkg /= Empty_Node then
Parent := Pkg;
end if;
Name_Len := Value'Length;
Name_Buffer (1 .. Name_Len) := Value;
Expr := Name_Find;
Attr := Create_Attribute
(Tree => Project_Tree,
Prj_Or_Pkg => Parent,
Name => Name,
Index_Name => Val,
Kind => Prj.Single,
Value => Create_Literal_String (Expr, Project_Tree));
end Create_Attribute;
-- Local variables
Name : Name_Id;
Naming : Project_Node_Id;
-- Start of processing for Add_Default_GNAT_Naming_Scheme
begin
if Config_File = Empty_Node then
-- Create a dummy config file is none was found
Name_Len := Auto_Cgpr'Length;
Name_Buffer (1 .. Name_Len) := Auto_Cgpr;
Name := Name_Find;
-- An invalid project name to avoid conflicts with user-created ones
Name_Len := 5;
Name_Buffer (1 .. Name_Len) := "_auto";
Config_File :=
Create_Project
(In_Tree => Project_Tree,
Name => Name_Find,
Full_Path => Path_Name_Type (Name),
Is_Config_File => True);
-- Setup library support
case MLib.Tgt.Support_For_Libraries is
when None =>
null;
when Static_Only =>
Create_Attribute (Name_Library_Support, "static_only");
when Full =>
Create_Attribute (Name_Library_Support, "full");
end case;
if MLib.Tgt.Standalone_Library_Auto_Init_Is_Supported then
Create_Attribute (Name_Library_Auto_Init_Supported, "true");
else
Create_Attribute (Name_Library_Auto_Init_Supported, "false");
end if;
-- Setup Ada support (Ada is the default language here, since this
-- is only called when no config file existed initially, ie for
-- gnatmake).
Create_Attribute (Name_Default_Language, "ada");
Naming := Create_Package (Project_Tree, Config_File, "naming");
Create_Attribute (Name_Spec_Suffix, ".ads", "ada", Pkg => Naming);
Create_Attribute (Name_Separate_Suffix, ".adb", "ada", Pkg => Naming);
Create_Attribute (Name_Body_Suffix, ".adb", "ada", Pkg => Naming);
Create_Attribute (Name_Dot_Replacement, "-", Pkg => Naming);
Create_Attribute (Name_Casing, "lowercase", Pkg => Naming);
if Current_Verbosity = High then
Write_Line ("Automatically generated (in-memory) config file");
Prj.PP.Pretty_Print
(Project => Config_File,
In_Tree => Project_Tree,
Backward_Compatibility => False);
end if;
end if;
end Add_Default_GNAT_Naming_Scheme;
-----------------------
-- Apply_Config_File --
-----------------------
procedure Apply_Config_File
(Config_File : Prj.Project_Id;
Project_Tree : Prj.Project_Tree_Ref)
is
Conf_Decl : constant Declarations := Config_File.Decl;
Conf_Pack_Id : Package_Id;
Conf_Pack : Package_Element;
User_Decl : Declarations;
User_Pack_Id : Package_Id;
User_Pack : Package_Element;
Proj : Project_List;
begin
Proj := Project_Tree.Projects;
while Proj /= null loop
if Proj.Project /= Config_File then
User_Decl := Proj.Project.Decl;
Add_Attributes
(Project_Tree => Project_Tree,
Conf_Decl => Conf_Decl,
User_Decl => User_Decl);
Conf_Pack_Id := Conf_Decl.Packages;
while Conf_Pack_Id /= No_Package loop
Conf_Pack := Project_Tree.Packages.Table (Conf_Pack_Id);
User_Pack_Id := User_Decl.Packages;
while User_Pack_Id /= No_Package loop
User_Pack := Project_Tree.Packages.Table (User_Pack_Id);
exit when User_Pack.Name = Conf_Pack.Name;
User_Pack_Id := User_Pack.Next;
end loop;
if User_Pack_Id = No_Package then
Package_Table.Increment_Last (Project_Tree.Packages);
User_Pack := Conf_Pack;
User_Pack.Next := User_Decl.Packages;
User_Decl.Packages :=
Package_Table.Last (Project_Tree.Packages);
Project_Tree.Packages.Table (User_Decl.Packages) :=
User_Pack;
else
Add_Attributes
(Project_Tree => Project_Tree,
Conf_Decl => Conf_Pack.Decl,
User_Decl => Project_Tree.Packages.Table
(User_Pack_Id).Decl);
end if;
Conf_Pack_Id := Conf_Pack.Next;
end loop;
Proj.Project.Decl := User_Decl;
end if;
Proj := Proj.Next;
end loop;
end Apply_Config_File;
------------------
-- Check_Target --
------------------
function Check_Target
(Config_File : Project_Id;
Autoconf_Specified : Boolean;
Project_Tree : Prj.Project_Tree_Ref;
Target : String := "") return Boolean
is
Variable : constant Variable_Value :=
Value_Of
(Name_Target, Config_File.Decl.Attributes, Project_Tree);
Tgt_Name : Name_Id := No_Name;
OK : Boolean;
begin
if Variable /= Nil_Variable_Value and then not Variable.Default then
Tgt_Name := Variable.Value;
end if;
if Target = "" then
OK := not Autoconf_Specified or else Tgt_Name = No_Name;
else
OK := Tgt_Name /= No_Name
and then Target = Get_Name_String (Tgt_Name);
end if;
if not OK then
if Autoconf_Specified then
if Verbose_Mode then
Write_Line ("inconsistent targets, performing autoconf");
end if;
return False;
else
if Tgt_Name /= No_Name then
Raise_Invalid_Config
("invalid target name """
& Get_Name_String (Tgt_Name) & """ in configuration");
else
Raise_Invalid_Config
("no target specified in configuration file");
end if;
end if;
end if;
return True;
end Check_Target;
--------------------------------------
-- Get_Or_Create_Configuration_File --
--------------------------------------
procedure Get_Or_Create_Configuration_File
(Project : Project_Id;
Project_Tree : Project_Tree_Ref;
Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref;
Allow_Automatic_Generation : Boolean;
Config_File_Name : String := "";
Autoconf_Specified : Boolean;
Target_Name : String := "";
Normalized_Hostname : String;
Packages_To_Check : String_List_Access := null;
Config : out Prj.Project_Id;
Config_File_Path : out String_Access;
Automatically_Generated : out Boolean;
Flags : Processing_Flags;
On_Load_Config : Config_File_Hook := null)
is
At_Least_One_Compiler_Command : Boolean := False;
-- Set to True if at least one attribute Ide'Compiler_Command is
-- specified for one language of the system.
function Default_File_Name return String;
-- Return the name of the default config file that should be tested
procedure Do_Autoconf;
-- Generate a new config file through gprconfig. In case of error, this
-- raises the Invalid_Config exception with an appropriate message
function Get_Config_Switches return Argument_List_Access;
-- Return the --config switches to use for gprconfig
function Might_Have_Sources (Project : Project_Id) return Boolean;
-- True if the specified project might have sources (ie the user has not
-- explicitly specified it. We haven't checked the file system, nor do
-- we need to at this stage.
-----------------------
-- Default_File_Name --
-----------------------
function Default_File_Name return String is
Ada_RTS : constant String := Runtime_Name_For (Name_Ada);
Tmp : String_Access;
begin
if Target_Name /= "" then
if Ada_RTS /= "" then
return Target_Name & '-' & Ada_RTS
& Config_Project_File_Extension;
else
return Target_Name & Config_Project_File_Extension;
end if;
elsif Ada_RTS /= "" then
return Ada_RTS & Config_Project_File_Extension;
else
Tmp := Getenv (Config_Project_Env_Var);
declare
T : constant String := Tmp.all;
begin
Free (Tmp);
if T'Length = 0 then
return Default_Name;
else
return T;
end if;
end;
end if;
end Default_File_Name;
------------------------
-- Might_Have_Sources --
------------------------
function Might_Have_Sources (Project : Project_Id) return Boolean is
Variable : Variable_Value;
begin
Variable :=
Value_Of
(Name_Source_Dirs,
Project.Decl.Attributes,
Project_Tree);
if Variable = Nil_Variable_Value
or else Variable.Default
or else Variable.Values /= Nil_String
then
Variable :=
Value_Of
(Name_Source_Files,
Project.Decl.Attributes,
Project_Tree);
return Variable = Nil_Variable_Value
or else Variable.Default
or else Variable.Values /= Nil_String;
else
return False;
end if;
end Might_Have_Sources;
-------------------------
-- Get_Config_Switches --
-------------------------
function Get_Config_Switches return Argument_List_Access is
package Language_Htable is new GNAT.HTable.Simple_HTable
(Header_Num => Prj.Header_Num,
Element => Name_Id,
No_Element => No_Name,
Key => Name_Id,
Hash => Prj.Hash,
Equal => "=");
-- Hash table to keep the languages used in the project tree
IDE : constant Package_Id :=
Value_Of
(Name_Ide,
Project.Decl.Packages,
Project_Tree);
Prj_Iter : Project_List;
List : String_List_Id;
Elem : String_Element;
Lang : Name_Id;
Variable : Variable_Value;
Name : Name_Id;
Count : Natural;
Result : Argument_List_Access;
Check_Default : Boolean;
begin
Prj_Iter := Project_Tree.Projects;
while Prj_Iter /= null loop
if Might_Have_Sources (Prj_Iter.Project) then
Variable :=
Value_Of
(Name_Languages,
Prj_Iter.Project.Decl.Attributes,
Project_Tree);
if Variable = Nil_Variable_Value
or else Variable.Default
then
-- Languages is not declared. If it is not an extending
-- project, or if it extends a project with no Languages,
-- check for Default_Language.
Check_Default := Prj_Iter.Project.Extends = No_Project;
if not Check_Default then
Variable :=
Value_Of
(Name_Languages,
Prj_Iter.Project.Extends.Decl.Attributes,
Project_Tree);
Check_Default :=
Variable /= Nil_Variable_Value
and then Variable.Values = Nil_String;
end if;
if Check_Default then
Variable :=
Value_Of
(Name_Default_Language,
Prj_Iter.Project.Decl.Attributes,
Project_Tree);
if Variable /= Nil_Variable_Value
and then not Variable.Default
then
Get_Name_String (Variable.Value);
To_Lower (Name_Buffer (1 .. Name_Len));
Lang := Name_Find;
Language_Htable.Set (Lang, Lang);
else
-- If no default language is declared, default to Ada
Language_Htable.Set (Name_Ada, Name_Ada);
end if;
end if;
elsif Variable.Values /= Nil_String then
-- Attribute Languages is declared with a non empty
-- list: put all the languages in Language_HTable.
List := Variable.Values;
while List /= Nil_String loop
Elem := Project_Tree.String_Elements.Table (List);
Get_Name_String (Elem.Value);
To_Lower (Name_Buffer (1 .. Name_Len));
Lang := Name_Find;
Language_Htable.Set (Lang, Lang);
List := Elem.Next;
end loop;
end if;
end if;
Prj_Iter := Prj_Iter.Next;
end loop;
Name := Language_Htable.Get_First;
Count := 0;
while Name /= No_Name loop
Count := Count + 1;
Name := Language_Htable.Get_Next;
end loop;
Result := new String_List (1 .. Count);
Count := 1;
Name := Language_Htable.Get_First;
while Name /= No_Name loop
-- Check if IDE'Compiler_Command is declared for the language.
-- If it is, use its value to invoke gprconfig.
Variable :=
Value_Of
(Name,
Attribute_Or_Array_Name => Name_Compiler_Command,
In_Package => IDE,
In_Tree => Project_Tree,
Force_Lower_Case_Index => True);
declare
Config_Command : constant String :=
"--config=" & Get_Name_String (Name);
Runtime_Name : constant String :=
Runtime_Name_For (Name);
begin
if Variable = Nil_Variable_Value
or else Length_Of_Name (Variable.Value) = 0
then
Result (Count) :=
new String'(Config_Command & ",," & Runtime_Name);
else
At_Least_One_Compiler_Command := True;
declare
Compiler_Command : constant String :=
Get_Name_String (Variable.Value);
begin
if Is_Absolute_Path (Compiler_Command) then
Result (Count) :=
new String'
(Config_Command & ",," & Runtime_Name & "," &
Containing_Directory (Compiler_Command) & "," &
Simple_Name (Compiler_Command));
else
Result (Count) :=
new String'
(Config_Command & ",," & Runtime_Name & ",," &
Compiler_Command);
end if;
end;
end if;
end;
Count := Count + 1;
Name := Language_Htable.Get_Next;
end loop;
return Result;
end Get_Config_Switches;
-----------------
-- Do_Autoconf --
-----------------
procedure Do_Autoconf is
Obj_Dir : constant Variable_Value :=
Value_Of
(Name_Object_Dir,
Project.Decl.Attributes,
Project_Tree);
Gprconfig_Path : String_Access;
Success : Boolean;
begin
Gprconfig_Path := Locate_Exec_On_Path (Gprconfig_Name);
if Gprconfig_Path = null then
Raise_Invalid_Config
("could not locate gprconfig for auto-configuration");
end if;
-- First, find the object directory of the user's project
if Obj_Dir = Nil_Variable_Value or else Obj_Dir.Default then
Get_Name_String (Project.Directory.Display_Name);
else
if Is_Absolute_Path (Get_Name_String (Obj_Dir.Value)) then
Get_Name_String (Obj_Dir.Value);
else
Name_Len := 0;
Add_Str_To_Name_Buffer
(Get_Name_String (Project.Directory.Display_Name));
Add_Str_To_Name_Buffer (Get_Name_String (Obj_Dir.Value));
end if;
end if;
if Subdirs /= null then
Add_Char_To_Name_Buffer (Directory_Separator);
Add_Str_To_Name_Buffer (Subdirs.all);
end if;
for J in 1 .. Name_Len loop
if Name_Buffer (J) = '/' then
Name_Buffer (J) := Directory_Separator;
end if;
end loop;
declare
Obj_Dir : constant String := Name_Buffer (1 .. Name_Len);
Switches : Argument_List_Access := Get_Config_Switches;
Args : Argument_List (1 .. 5);
Arg_Last : Positive;
Obj_Dir_Exists : Boolean := True;
begin
-- Check if the object directory exists. If Setup_Projects is True
-- (-p) and directory does not exist, attempt to create it.
-- Otherwise, if directory does not exist, fail without calling
-- gprconfig.
if not Is_Directory (Obj_Dir)
and then (Setup_Projects or else Subdirs /= null)
then
begin
Create_Path (Obj_Dir);
if not Quiet_Output then
Write_Str ("object directory """);
Write_Str (Obj_Dir);
Write_Line (""" created");
end if;
exception
when others =>
Raise_Invalid_Config
("could not create object directory " & Obj_Dir);
end;
end if;
if not Is_Directory (Obj_Dir) then
case Flags.Require_Obj_Dirs is
when Error =>
Raise_Invalid_Config
("object directory " & Obj_Dir & " does not exist");
when Warning =>
Prj.Err.Error_Msg
(Flags,
"?object directory " & Obj_Dir & " does not exist");
Obj_Dir_Exists := False;
when Silent =>
null;
end case;
end if;
-- Invoke gprconfig
Args (1) := new String'("--batch");
Args (2) := new String'("-o");
-- If no config file was specified, set the auto.cgpr one
if Config_File_Name = "" then
if Obj_Dir_Exists then
Args (3) :=
new String'(Obj_Dir & Directory_Separator & Auto_Cgpr);
else
declare
Path_FD : File_Descriptor;
Path_Name : Path_Name_Type;
begin
Prj.Env.Create_Temp_File
(In_Tree => Project_Tree,
Path_FD => Path_FD,
Path_Name => Path_Name,
File_Use => "configuration file");
if Path_FD /= Invalid_FD then
Args (3) := new String'(Get_Name_String (Path_Name));
GNAT.OS_Lib.Close (Path_FD);
else
-- We'll have an error message later on
Args (3) :=
new String'
(Obj_Dir & Directory_Separator & Auto_Cgpr);
end if;
end;
end if;
else
Args (3) := new String'(Config_File_Name);
end if;
if Normalized_Hostname = "" then
Arg_Last := 3;
else
if Target_Name = "" then
if At_Least_One_Compiler_Command then
Args (4) := new String'("--target=all");
else
Args (4) :=
new String'("--target=" & Normalized_Hostname);
end if;
else
Args (4) := new String'("--target=" & Target_Name);
end if;
Arg_Last := 4;
end if;
if not Verbose_Mode then
Arg_Last := Arg_Last + 1;
Args (Arg_Last) := new String'("-q");
end if;
if Verbose_Mode then
Write_Str (Gprconfig_Name);
for J in 1 .. Arg_Last loop
Write_Char (' ');
Write_Str (Args (J).all);
end loop;
for J in Switches'Range loop
Write_Char (' ');
Write_Str (Switches (J).all);
end loop;
Write_Eol;
elsif not Quiet_Output then
-- Display no message if we are creating auto.cgpr, unless in
-- verbose mode
if Config_File_Name /= ""
or else Verbose_Mode
then
Write_Str ("creating ");
Write_Str (Simple_Name (Args (3).all));
Write_Eol;
end if;
end if;
Spawn (Gprconfig_Path.all, Args (1 .. Arg_Last) & Switches.all,
Success);
Free (Switches);
Config_File_Path := Locate_Config_File (Args (3).all);
if Config_File_Path = null then
Raise_Invalid_Config
("could not create " & Args (3).all);
end if;
for F in Args'Range loop
Free (Args (F));
end loop;
end;
end Do_Autoconf;
Success : Boolean;
Config_Project_Node : Project_Node_Id := Empty_Node;
begin
Free (Config_File_Path);
Config := No_Project;
if Config_File_Name /= "" then
Config_File_Path := Locate_Config_File (Config_File_Name);
else
Config_File_Path := Locate_Config_File (Default_File_Name);
end if;
if Config_File_Path = null then
if (not Allow_Automatic_Generation) and then
Config_File_Name /= ""
then
Raise_Invalid_Config
("could not locate main configuration project "
& Config_File_Name);
end if;
end if;
Automatically_Generated :=
Allow_Automatic_Generation and then Config_File_Path = null;
<<Process_Config_File>>
if Automatically_Generated then
if Hostparm.OpenVMS then
-- There is no gprconfig on VMS
Raise_Invalid_Config
("could not locate any configuration project file");
else
-- This might raise an Invalid_Config exception
Do_Autoconf;
end if;
end if;
-- Parse the configuration file
if Verbose_Mode and then Config_File_Path /= null then
Write_Str ("Checking configuration ");
Write_Line (Config_File_Path.all);
end if;
if Config_File_Path /= null then
Prj.Part.Parse
(In_Tree => Project_Node_Tree,
Project => Config_Project_Node,
Project_File_Name => Config_File_Path.all,
Always_Errout_Finalize => False,
Packages_To_Check => Packages_To_Check,
Current_Directory => Current_Directory,
Is_Config_File => True,
Flags => Flags);
else
-- Maybe the user will want to create his own configuration file
Config_Project_Node := Empty_Node;
end if;
if On_Load_Config /= null then
On_Load_Config
(Config_File => Config_Project_Node,
Project_Node_Tree => Project_Node_Tree);
end if;
if Config_Project_Node /= Empty_Node then
Prj.Proc.Process_Project_Tree_Phase_1
(In_Tree => Project_Tree,
Project => Config,
Success => Success,
From_Project_Node => Config_Project_Node,
From_Project_Node_Tree => Project_Node_Tree,
Flags => Flags,
Reset_Tree => False);
end if;
if Config_Project_Node = Empty_Node
or else Config = No_Project
then
Raise_Invalid_Config
("processing of configuration project """
& Config_File_Path.all & """ failed");
end if;
-- Check that the target of the configuration file is the one the user
-- specified on the command line. We do not need to check that when in
-- auto-conf mode, since the appropriate target was passed to gprconfig.
if not Automatically_Generated
and then not
Check_Target (Config, Autoconf_Specified, Project_Tree, Target_Name)
then
Automatically_Generated := True;
goto Process_Config_File;
end if;
end Get_Or_Create_Configuration_File;
------------------------
-- Locate_Config_File --
------------------------
function Locate_Config_File (Name : String) return String_Access is
Prefix_Path : constant String := Executable_Prefix_Path;
begin
if Prefix_Path'Length /= 0 then
return Locate_Regular_File
(Name,
"." & Path_Separator &
Prefix_Path & "share" & Directory_Separator & "gpr");
else
return Locate_Regular_File (Name, ".");
end if;
end Locate_Config_File;
------------------------------------
-- Parse_Project_And_Apply_Config --
------------------------------------
procedure Parse_Project_And_Apply_Config
(Main_Project : out Prj.Project_Id;
User_Project_Node : out Prj.Tree.Project_Node_Id;
Config_File_Name : String := "";
Autoconf_Specified : Boolean;
Project_File_Name : String;
Project_Tree : Prj.Project_Tree_Ref;
Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref;
Packages_To_Check : String_List_Access;
Allow_Automatic_Generation : Boolean := True;
Automatically_Generated : out Boolean;
Config_File_Path : out String_Access;
Target_Name : String := "";
Normalized_Hostname : String;
Flags : Processing_Flags;
On_Load_Config : Config_File_Hook := null)
is
begin
-- Parse the user project tree
Prj.Initialize (Project_Tree);
Main_Project := No_Project;
Automatically_Generated := False;
Prj.Part.Parse
(In_Tree => Project_Node_Tree,
Project => User_Project_Node,
Project_File_Name => Project_File_Name,
Always_Errout_Finalize => False,
Packages_To_Check => Packages_To_Check,
Current_Directory => Current_Directory,
Is_Config_File => False,
Flags => Flags);
if User_Project_Node = Empty_Node then
User_Project_Node := Empty_Node;
return;
end if;
Process_Project_And_Apply_Config
(Main_Project => Main_Project,
User_Project_Node => User_Project_Node,
Config_File_Name => Config_File_Name,
Autoconf_Specified => Autoconf_Specified,
Project_Tree => Project_Tree,
Project_Node_Tree => Project_Node_Tree,
Packages_To_Check => Packages_To_Check,
Allow_Automatic_Generation => Allow_Automatic_Generation,
Automatically_Generated => Automatically_Generated,
Config_File_Path => Config_File_Path,
Target_Name => Target_Name,
Normalized_Hostname => Normalized_Hostname,
Flags => Flags,
On_Load_Config => On_Load_Config);
end Parse_Project_And_Apply_Config;
--------------------------------------
-- Process_Project_And_Apply_Config --
--------------------------------------
procedure Process_Project_And_Apply_Config
(Main_Project : out Prj.Project_Id;
User_Project_Node : Prj.Tree.Project_Node_Id;
Config_File_Name : String := "";
Autoconf_Specified : Boolean;
Project_Tree : Prj.Project_Tree_Ref;
Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref;
Packages_To_Check : String_List_Access;
Allow_Automatic_Generation : Boolean := True;
Automatically_Generated : out Boolean;
Config_File_Path : out String_Access;
Target_Name : String := "";
Normalized_Hostname : String;
Flags : Processing_Flags;
On_Load_Config : Config_File_Hook := null;
Reset_Tree : Boolean := True)
is
Main_Config_Project : Project_Id;
Success : Boolean;
begin
Main_Project := No_Project;
Automatically_Generated := False;
Process_Project_Tree_Phase_1
(In_Tree => Project_Tree,
Project => Main_Project,
Success => Success,
From_Project_Node => User_Project_Node,
From_Project_Node_Tree => Project_Node_Tree,
Flags => Flags,
Reset_Tree => Reset_Tree);
if not Success then
Main_Project := No_Project;
return;
end if;
if Project_Tree.Source_Info_File_Name /= null then
if not Is_Absolute_Path (Project_Tree.Source_Info_File_Name.all) then
declare
Obj_Dir : constant Variable_Value :=
Value_Of
(Name_Object_Dir,
Main_Project.Decl.Attributes,
Project_Tree);
begin
if Obj_Dir = Nil_Variable_Value or else Obj_Dir.Default then
Get_Name_String (Main_Project.Directory.Display_Name);
else
if Is_Absolute_Path (Get_Name_String (Obj_Dir.Value)) then
Get_Name_String (Obj_Dir.Value);
else
Name_Len := 0;
Add_Str_To_Name_Buffer
(Get_Name_String (Main_Project.Directory.Display_Name));
Add_Str_To_Name_Buffer (Get_Name_String (Obj_Dir.Value));
end if;
end if;
Add_Char_To_Name_Buffer (Directory_Separator);
Add_Str_To_Name_Buffer (Project_Tree.Source_Info_File_Name.all);
Free (Project_Tree.Source_Info_File_Name);
Project_Tree.Source_Info_File_Name :=
new String'(Name_Buffer (1 .. Name_Len));
end;
end if;
Read_Source_Info_File (Project_Tree);
end if;
-- Find configuration file
Get_Or_Create_Configuration_File
(Config => Main_Config_Project,
Project => Main_Project,
Project_Tree => Project_Tree,
Project_Node_Tree => Project_Node_Tree,
Allow_Automatic_Generation => Allow_Automatic_Generation,
Config_File_Name => Config_File_Name,
Autoconf_Specified => Autoconf_Specified,
Target_Name => Target_Name,
Normalized_Hostname => Normalized_Hostname,
Packages_To_Check => Packages_To_Check,
Config_File_Path => Config_File_Path,
Automatically_Generated => Automatically_Generated,
Flags => Flags,
On_Load_Config => On_Load_Config);
Apply_Config_File (Main_Config_Project, Project_Tree);
-- Finish processing the user's project
Prj.Proc.Process_Project_Tree_Phase_2
(In_Tree => Project_Tree,
Project => Main_Project,
Success => Success,
From_Project_Node => User_Project_Node,
From_Project_Node_Tree => Project_Node_Tree,
Flags => Flags);
if Success then
if Project_Tree.Source_Info_File_Name /= null and then
not Project_Tree.Source_Info_File_Exists
then
Write_Source_Info_File (Project_Tree);
end if;
else
Main_Project := No_Project;
end if;
end Process_Project_And_Apply_Config;
--------------------------
-- Raise_Invalid_Config --
--------------------------
procedure Raise_Invalid_Config (Msg : String) is
begin
Raise_Exception (Invalid_Config'Identity, Msg);
end Raise_Invalid_Config;
----------------------
-- Runtime_Name_For --
----------------------
function Runtime_Name_For (Language : Name_Id) return String is
begin
if RTS_Languages.Get (Language) /= No_Name then
return Get_Name_String (RTS_Languages.Get (Language));
else
return "";
end if;
end Runtime_Name_For;
---------------------
-- Set_Runtime_For --
---------------------
procedure Set_Runtime_For (Language : Name_Id; RTS_Name : String) is
begin
Name_Len := RTS_Name'Length;
Name_Buffer (1 .. Name_Len) := RTS_Name;
RTS_Languages.Set (Language, Name_Find);
end Set_Runtime_For;
end Prj.Conf;
|
src/bootloader/boot.asm | basic60/ARCUS | 0 | 7519 | <reponame>basic60/ARCUS
[BITS 16]
org 7c00h
mov ax, cs
mov ds, ax
mov es, ax
mov esp, 7c00h
jmp load_stage2
disk_rw_struct:
db 16 ; size of disk_rw_struct, 10h
db 0 ; reversed, must be 0
dw 0 ; number of sectors
dd 0 ; target address
dq 0 ; start LBA number
read_disk_by_int13h:
mov eax, dword [esp + 8]
mov dword [disk_rw_struct + 4], eax
mov ax, [esp + 6]
mov word [disk_rw_struct + 2], ax
mov eax,dword [esp + 2]
mov dword [disk_rw_struct + 8], eax
mov ax, 4200h
mov dx, 0080h
mov si, disk_rw_struct
int 13h
ret
load_stage2:
push dword 0x7e00 ; target address
push word 50 ; number of blocks
push dword 1 ; start LBA number
call read_disk_by_int13h
add esp, 10
jmp enter_long_mode
times 510-($-$$) db 0
dw 0xaa55
%define E820_BUFFER 0xc000
%define PAGE_TABLE 0x40000
%define CODE_SEG 0x0008
%define DATA_SEG 0x0010
gdt64:
.Null:
dq 0 ; Null Descriptor - should be present.
.Code:
dq 0x00209A0000000000 ; 64-bit code descriptor (exec/read).
.pointer:
dw $ - gdt64 - 1 ; 16-bit Size (Limit) of GDT.
dd gdt64
enter_long_mode:
call memory_detect ; 利用e820中断探测内存
call fill_page_table ; 初始化临时页表
call enable_paging ; 开启分页
lgdt [gdt64.pointer]
jmp CODE_SEG:long_mode_entry
mmap_entry_count equ E820_BUFFER
memory_detect:
mov edi, 0xc004
xor ebx, ebx
xor bp, bp
mov edx, 0x0534D4150
mov eax, 0xe820
mov [es:edi + 20], dword 1
mov ecx, 24
int 0x15
jc .failed
mov edx, 0x0534D4150
cmp eax, edx
jne short .failed
test ebx, ebx
je .failed
jmp .jmpin
.e820_loop:
mov eax, 0xe820 ; eax, ecx get trashed on every int 0x15 call
mov [es:edi + 20], dword 1 ; force a valid ACPI 3.X entry
mov ecx, 24 ; ask for 24 bytes again
int 0x15
jc short .detect_finish ; carry set means "end of list already reached"
mov edx, 0x0534D4150 ; repair potentially trashed register
.jmpin:
jcxz .skip_entry ; skip any 0 length entries
cmp cl, 20 ; got a 24 byte ACPI 3.X response?
jbe .add_idx
test byte [es:edi + 20], 1 ; if so: is the "ignore this data" bit clear?
je .skip_entry
.add_idx:
mov ecx, dword [es:edi + 8] ; get lower uint32_t of memory region length
or ecx, dword [es:edi + 12] ; "or" it with upper uint32_t to test for zero
jz .skip_entry ; if length uint64_t is 0, skip entry
inc bp ; got a good entry: ++count, move to next storage spot
add edi, 24
.skip_entry:
test ebx, ebx ; if ebx resets to 0, list is complete
jne .e820_loop
.detect_finish:
mov [mmap_entry_count], bp
clc
ret
.failed:
hlt
fill_page_table:
mov edi, PAGE_TABLE ; page talbe start at 0x40000, occupy 20KB memroy and map the first 26MB
push edi
mov ecx, 0x10000
xor eax, eax
cld
rep stosd ; zero out 64KB memory
pop edi
lea eax, [es:edi + 0x1000]
or eax, 3
mov [es:edi], eax
lea eax, [es:edi + 0x2000]
or eax, 3
mov [es:edi + 0x1000], eax
mov ebx, 0x3000
mov edx, 0x2000
mov ecx, 52
.loop_p4:
lea eax, [es:edi + ebx]
or eax, 3
mov [es:edi + edx], eax
add ebx, 0x1000
add edx, 8
dec ecx
cmp ecx, 0
jne .loop_p4
push edi
lea edi, [es:edi + 0x3000]
mov eax, 3
.loop_page_table:
mov [es:edi], eax
add eax, 0x1000
add edi, 8
cmp eax, 0x1a00000
jb .loop_page_table
pop edi
mov ax, 0x2401
int 0x15 ; Enalbe A20 address line.
cli
ret
enable_paging:
; enable pae and pge
mov eax, 10100000b
mov cr4, eax
mov eax, PAGE_TABLE
mov cr3, eax
; set the long mode bit in the EFER MSR (model specific register)
mov ecx, 0xC0000080
rdmsr
or eax, 0x00000100
wrmsr
; enable paging and protection
mov eax, cr0
or eax, 0x80000001
mov cr0, eax
ret
[BITS 64]
long_mode_entry:
call cli_clear
jmp 0x8000
cli_clear:
mov edi,0xB8000
mov ecx,500
mov eax,0x0030 ; Set the value to set the screen to: Blue background, white foreground, blank spaces.
rep stosq
mov edi, 0xb8000
ret |
extern/gnat_sdl/gnat_sdl2/src/process_h.ads | AdaCore/training_material | 15 | 25134 | <reponame>AdaCore/training_material
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with umingw_h;
with System;
package process_h is
-- unsupported macro: P_WAIT _P_WAIT
-- unsupported macro: P_NOWAIT _P_NOWAIT
-- unsupported macro: P_OVERLAY _P_OVERLAY
-- unsupported macro: OLD_P_OVERLAY _OLD_P_OVERLAY
-- unsupported macro: P_NOWAITO _P_NOWAITO
-- unsupported macro: P_DETACH _P_DETACH
-- unsupported macro: WAIT_CHILD _WAIT_CHILD
-- unsupported macro: WAIT_GRANDCHILD _WAIT_GRANDCHILD
--*
-- * This file has no copyright assigned and is placed in the Public Domain.
-- * This file is part of the mingw-w64 runtime package.
-- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
--
-- Includes a definition of _pid_t and pid_t
-- skipped func _beginthread
-- skipped func _endthread
-- skipped func _beginthreadex
-- skipped func _endthreadex
procedure c_exit (u_Code : int); -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:36
pragma Import (C, c_exit, "exit");
-- skipped func _exit
-- C99 function name
-- skipped func _Exit
procedure c_abort; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:50
pragma Import (C, c_abort, "abort");
-- skipped func _cexit
-- skipped func _c_exit
-- skipped func _getpid
-- skipped func _cwait
-- skipped func _execl
-- skipped func _execle
-- skipped func _execlp
-- skipped func _execlpe
-- skipped func _execv
-- skipped func _execve
-- skipped func _execvp
-- skipped func _execvpe
-- skipped func _spawnl
-- skipped func _spawnle
-- skipped func _spawnlp
-- skipped func _spawnlpe
-- skipped func _spawnv
-- skipped func _spawnve
-- skipped func _spawnvp
-- skipped func _spawnvpe
function c_system (u_Command : Interfaces.C.Strings.chars_ptr) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:78
pragma Import (C, c_system, "system");
-- skipped func _wexecl
-- skipped func _wexecle
-- skipped func _wexeclp
-- skipped func _wexeclpe
-- skipped func _wexecv
-- skipped func _wexecve
-- skipped func _wexecvp
-- skipped func _wexecvpe
-- skipped func _wspawnl
-- skipped func _wspawnle
-- skipped func _wspawnlp
-- skipped func _wspawnlpe
-- skipped func _wspawnv
-- skipped func _wspawnve
-- skipped func _wspawnvp
-- skipped func _wspawnvpe
-- skipped func _wsystem
-- skipped func __security_init_cookie
-- skipped func __security_check_cookie
-- skipped func __report_gsfailure
-- skipped func _loaddll
-- skipped func _unloaddll
-- skipped func _getdllprocaddr
function cwait
(u_TermStat : access int;
u_ProcHandle : umingw_h.intptr_t;
u_Action : int) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:143
pragma Import (C, cwait, "cwait");
function execl (u_Filename : Interfaces.C.Strings.chars_ptr; u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:145
pragma Import (C, execl, "execl");
function execle (u_Filename : Interfaces.C.Strings.chars_ptr; u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:146
pragma Import (C, execle, "execle");
function execlp (u_Filename : Interfaces.C.Strings.chars_ptr; u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:147
pragma Import (C, execlp, "execlp");
function execlpe (u_Filename : Interfaces.C.Strings.chars_ptr; u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:148
pragma Import (C, execlpe, "execlpe");
function spawnl
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:155
pragma Import (C, spawnl, "spawnl");
function spawnle
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:156
pragma Import (C, spawnle, "spawnle");
function spawnlp
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:157
pragma Import (C, spawnlp, "spawnlp");
function spawnlpe
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:158
pragma Import (C, spawnlpe, "spawnlpe");
function getpid return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:159
pragma Import (C, getpid, "getpid");
-- Those methods are predefined by gcc builtins to return int. So to prevent
-- stupid warnings, define them in POSIX way. This is save, because those
-- methods do not return in success case, so that the return value is not
-- really dependent to its scalar width.
function execv (u_Filename : Interfaces.C.Strings.chars_ptr; u_ArgList : System.Address) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:165
pragma Import (C, execv, "execv");
function execve
(u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : System.Address;
u_Env : System.Address) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:166
pragma Import (C, execve, "execve");
function execvp (u_Filename : Interfaces.C.Strings.chars_ptr; u_ArgList : System.Address) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:167
pragma Import (C, execvp, "execvp");
function execvpe
(u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : System.Address;
u_Env : System.Address) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:168
pragma Import (C, execvpe, "execvpe");
function spawnv
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : System.Address) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:175
pragma Import (C, spawnv, "spawnv");
function spawnve
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : System.Address;
u_Env : System.Address) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:176
pragma Import (C, spawnve, "spawnve");
function spawnvp
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : System.Address) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:177
pragma Import (C, spawnvp, "spawnvp");
function spawnvpe
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : System.Address;
u_Env : System.Address) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:178
pragma Import (C, spawnvpe, "spawnvpe");
end process_h;
|
oeis/094/A094556.asm | neoneye/loda-programs | 11 | 13439 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A094556: Number of walks of length n between opposite vertices on a triangular prism.
; Submitted by <NAME>(s1)
; 0,1,0,7,8,51,100,407,1008,3451,9500,30207,87208,268451,791700,2402407,7152608,21567051,64482700,193885007,580781208,1744091251,5228778500,15693326007,47065997008,141225953051,423621935100,1270977653407,3812709264008,11438575184451,34314830768500,102946281875207,308835266486208,926512957737451,2779524556654700,8338602303079407,25015749643007608,75047363461484051,225141861319529700,675426042088434007,2026277210005612208,6078833462536216251,18236496722569889500,54709497497787187007
mov $1,$0
min $0,1
sub $0,3
pow $0,$1
mov $2,3
pow $2,$1
sub $2,$0
sub $2,$0
mov $0,$2
div $0,6
|
src/usb-logging-device.ads | JeremyGrosser/usb_embedded | 14 | 28158 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2021, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL;
with USB.HAL.Device;
package USB.Logging.Device is
procedure Log (Evt : USB.HAL.Device.UDC_Event);
procedure Log_MIDI_Init;
procedure Log_MIDI_Config;
procedure Log_MIDI_Send;
procedure Log_MIDI_Receive;
procedure Log_MIDI_Out_TC;
procedure Log_MIDI_In_TC;
procedure Log_MIDI_Setup_TX;
procedure Log_MIDI_Setup_RX;
procedure Log_MIDI_RX_Discarded;
procedure Log_MIDI_TX_Discarded;
procedure Log_MIDI_Write_Packet;
private
type Log_Event_Kind is (None,
UDC_Evt,
-- MIDI Class --
MIDI_Init,
MIDI_Config,
MIDI_Send,
MIDI_Receive,
MIDI_Out_TC,
MIDI_In_TC,
MIDI_Setup_TX,
MIDI_Setup_RX,
MIDI_RX_Discarded,
MIDI_TX_Discarded,
MIDI_Write_Packet
);
type Log_Event_ID is new Standard.HAL.UInt16;
type Log_Event (Kind : Log_Event_Kind := None) is record
ID : Log_Event_ID;
case Kind is
when UDC_Evt =>
UDC_Event : USB.HAL.Device.UDC_Event;
when others =>
null;
end case;
end record;
Event_Buffer_Size : constant := 256;
type Event_Index is mod Event_Buffer_Size;
Event_Buffer : array (Event_Index) of Log_Event :=
(others => (Kind => None, ID => 0));
Index : Event_Index := Event_Index'First;
ID : Log_Event_ID;
procedure Log (Evt : Log_Event);
end USB.Logging.Device;
|
Library/Cards/deck.asm | steakknife/pcgeos | 504 | 313 | COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Solitaire
FILE: deck.asm
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jon 6/90 Initial Version
DESCRIPTION:
this file contains handlers for DeckClass
RCS STAMP:
$Id: deck.asm,v 1.1 97/04/04 17:44:40 newdeal Exp $
------------------------------------------------------------------------------@
CardsClassStructures segment resource
DeckClass
CardsClassStructures ends
;---------------------------------------------------
CardsCodeResource segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckSaveState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: Deck method for MSG_DECK_SAVE_STATE
marks the deck as dirty.
Called by: MSG_DECK_SAVE_STATE
Pass: *ds:si = Deck object
ds:di = Deck instance
Return: nothing
Destroyed: nothing
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon Feb 18, 1993 Initial version.
PW March 23, 1993 modified.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckSaveState method dynamic DeckClass, MSG_DECK_SAVE_STATE
.enter
call ObjMarkDirty
.leave
ret
DeckSaveState endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckRestoreState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: Deck method for MSG_DECK_RESTORE_STATE
does nothing, just there to subclass
Called by: MSG_DECK_RESTORE_STATE
Pass: *ds:si = Deck object
ds:di = Deck instance
Return: nothing
Destroyed: nothing
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon Feb 18, 1993 Initial version.
PW March 23, 1993 modified.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckRestoreState method dynamic DeckClass, MSG_DECK_RESTORE_STATE
.enter
.leave
ret
DeckRestoreState endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckGetVMFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: Deck method for MSG_DECK_GET_VM_FILE
Called by: MSG_DECK_GET_VM_FILE
Pass: *ds:si = Deck object
ds:di = Deck instance
Return: cx = vm file
Destroyed: ax
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon Sep 2, 1992 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckGetVMFile method dynamic DeckClass, MSG_DECK_GET_VM_FILE
.enter
mov ax, MSG_GAME_GET_VM_FILE
call VisCallParent
.leave
ret
DeckGetVMFile endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckAddCardFirst
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_ADD_CARD_FIRST handler for DeckClass
This method moves the card into the proper position
(DI_topCardLeft, DI_topCardTop), and then adds
the card into the deck's child tree as the first child.
CALLED BY: DeckPushCard, DeckGetDealt;
PASS: ds:di = deck instance
*ds:si = instance data of deck
^lcx:dx = child to be added
CHANGES: card in ^lcx:dx is moved to DI_topCardLeft, DI_topCardTop
card is added to deck's vis tree as first child
DI_nCards is updated accordingly
RETURN: nothing
DESTROYED: ax, bx, cx, dx, di
PSEUDO CODE/STRATEGY:
moves card
adds card
gets card's attributes
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckAddCardFirst method DeckClass, MSG_DECK_ADD_CARD_FIRST
;;move the card (visually) to where it is supposed to be
push cx, dx, si ;save card OD and deck offset
mov bx, cx
mov si, dx ;^lbx:si = card
mov cx, ds:[di].DI_topCardLeft
mov dx, ds:[di].DI_topCardTop
mov ax, MSG_VIS_SET_POSITION ;move card to topCard(Left,Top)
mov di, mask MF_FIXUP_DS
call ObjMessage
pop cx, dx, si ;restore card OD and
;deck offset
;;add the card into the deck's composite
mov bp, CCO_FIRST or mask CCF_MARK_DIRTY
;card as the first child
mov ax, MSG_VIS_ADD_CHILD
GOTO ObjCallInstanceNoLock
DeckAddCardFirst endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckCardDoubleClicked
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_CARD_DOUBLE_CLICKED handler for DeckClass
This method is called by a child card when it gets
double clicked. The deck turns this event into a sort of
psuedo-drag, then asks if anydeck wants it.
CALLED BY: called by the double clicked card in CardStartSelect
PASS: ds:di = deck instance
*ds:si = instance data of deck
bp = # of card double clicked in composite
CHANGES: sends a message to the playing table to check its children
for acceptance of the double clicked card. If it is accepted,
it is transferred. Otherwise, no changes.
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
checks to make sure double clicked card is top card
checks to make sure card is face up
sets up drag data
informs playing table of the double click
if card is accepted by another deck:
new top card of deck *ds:si is maximized
DI_topCard(Left,Top) is updated
we check if we need to uncover the deck (valid
only for TalonClass)
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckCardDoubleClicked method DeckClass, MSG_DECK_CARD_DOUBLE_CLICKED
test ds:[di].DI_deckAttrs, mask DA_IGNORE_DOUBLE_CLICKS
jnz endDCDC
tst bp ;test if card is first child
jnz endDCDC ;if not, jump to end
mov ax, MSG_CARD_GET_ATTRIBUTES ;get card's attrs
call VisCallFirstChild
test bp, mask CA_FACE_UP ;test if card is face up
jz endDCDC ;if not, jump to end
push bp ;save card attrs
mov bp,1 ;bp <- # cards to drag
mov ax, MSG_DECK_SETUP_DRAG ;setup deck's drag data
call ObjCallInstanceNoLock
pop bp ;restore card attrs
mov ax, MSG_GAME_BROADCAST_DOUBLE_CLICK
call DeckCallParentWithSelf ;tell playing table to tell the
;foundations that a card has
;been double clicked
jnc endDCDC ;if nobody took the cards,
;jump to end
Deref_DI Deck_offset
clr ds:[di].DI_nDragCards ;clear # drag cards
call ObjMarkDirty
mov ax, MSG_DECK_REPAIR_SUCCESSFUL_TRANSFER
call ObjCallInstanceNoLock
endDCDC:
Deref_DI Deck_offset
clr ds:[di].DI_nDragCards ;clear # drag cards
call ObjMarkDirty
ret
DeckCardDoubleClicked endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckDragOrFlip
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_DRAG_OR_FLIP handler for DeckClass
Deck will either start a drag or flip a card, depending
on whether the card is face up or face down.
CALLED BY: called by the selected card
PASS: *ds:si = instance data of deck
cx,dx = mouse position
bp = # of selected card in deck's composite
CHANGES:
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
issues a MSG_[UP|DOWN]_CARD_SELECTED to self, depending
on the attrs of the selected card
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckDragOrFlip method DeckClass, MSG_DECK_DRAG_OR_FLIP
push bp ;save card #
mov ax, MSG_CARD_GET_ATTRIBUTES
call DeckCallNthChild
test bp, mask CA_FACE_UP ;see if card is face up
pop bp ;restore card #
jz cardIsFaceDown ;if card face down, jmp
;cardIsFaceUp:
Deref_DI Deck_offset
mov cx, ds:[di].DI_initLeft
mov dx, ds:[di].DI_initTop
mov ax, MSG_DECK_UP_CARD_SELECTED
call ObjCallInstanceNoLock
jmp endDeckDragOrFlip
cardIsFaceDown:
mov ax, MSG_DECK_DOWN_CARD_SELECTED
call ObjCallInstanceNoLock
endDeckDragOrFlip:
ret
DeckDragOrFlip endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckCardSelected
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_CARD_SELECTED handler for DeckClass
CALLED BY: called by the selected card
PASS: ds:di = deck instance
*ds:si = instance data of deck
cx,dx = mouse position
bp = # of selected card in deck's composite
CHANGES:
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckCardSelected method DeckClass, MSG_DECK_CARD_SELECTED
mov ds:[di].DI_initLeft, cx
mov ds:[di].DI_initTop, dx
call ObjMarkDirty
mov ax, MSG_GAME_DECK_SELECTED
call DeckCallParentWithSelf
ret
DeckCardSelected endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckFlipCard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_CARD_FLIP_CARD handler for DeckClass.
Flips the top card (i.e., if it's face up, turns
it face down, and vice-versa) and sends it a fade redraw.
CALLED BY:
PASS: *ds:si = deck object
CHANGES: top card gets flipped
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckFlipCard method DeckClass, MSG_CARD_FLIP_CARD
mov ax, MSG_CARD_FLIP
call VisCallFirstChild
mov ax, MSG_CARD_FADE_REDRAW
call VisCallFirstChild
mov ax, MSG_GAME_NOTIFY_CARD_FLIPPED
call VisCallParent
ret
DeckFlipCard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckCheckDragCaught
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_CHECK_DRAG_CAUGHT handler for DeckClass
checks to see whether a drag area intersects with this
deck's catch area
CALLED BY:
PASS: *ds:si = instance data of deck
^lcx:dx = dragging deck
CHANGES: nothing
RETURN: carry set if drag area of deck ^lcx:dx overlaps with catch area
of deck *ds:si
DESTROYED: ax, bx, cx, dx, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckCheckDragCaught method DeckClass, MSG_DECK_CHECK_DRAG_CAUGHT
CallObjectCXDX MSG_DECK_GET_DRAG_BOUNDS, MF_CALL
push ax ;save drag left
push bp ;save drag top
push cx ;save drag right
push dx ;save drag bottom
mov ax, MSG_DECK_GET_CATCH_BOUNDS
call ObjCallInstanceNoLock
mov bx, bp
;at this point,
;ax = catch left
;bx = catch top
;cx = catch right
;dx = catch bottom
pop bp ;bp <- drag bottom
cmp bx, bp
jle continue1 ;if catch top <= drag bottom, continue
add sp, 6 ;else clear stack
jmp noIntersect ;catch area is below drag area
continue1:
pop bp ;bp <- drag right
cmp ax, bp
jle continue2 ;if catch left <= drag right, continue
add sp, 4 ;else clear stack
jmp noIntersect ;catch area is to right of drag area
continue2:
pop bp ;bp <- drag top
cmp bp, dx
jle continue3 ;if drag top <= catch bottom, continue
add sp, 2 ;else clear stack
jmp noIntersect ;catch area is above drag area
continue3:
pop bp ;bp <- drag left
cmp bp, cx
jg noIntersect ;if drag left > catch right, drag area
;is left of catch area
;yesIntersect:
stc ;set carry to indicate that
;areas intersect
jmp endDeckCheckDragCaught
noIntersect:
clc ;clear carry to indicate that
;areas do not intersect
endDeckCheckDragCaught:
ret
DeckCheckDragCaught endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckClipNthCard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_CLIP_NTH_CARD handler for DeckClass
CALLED BY: used when full drag cards are misplaced, the card immediately
under the drag cards must be re-clipped
PASS: *ds:si = instance data of deck
bp = nth card to clip (0 = top card)
cx = (left of card to be placed onto nth) - (left of nth)
dx = (top of card to be placed onto nth) - (top of nth)
CHANGES: bp'th card is clipped according to offsets in cx,dx
RETURN: nothing
DESTROYED: ax, bx, cx, dx, di, si
PSEUDO CODE/STRATEGY:
calls MSG_VIS_FIND_CHILD with cx, dx as passed
passes MSG_CARD_CLIP_BOUNDS to child returned (if any)
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckClipNthCard method DeckClass, MSG_DECK_CLIP_NTH_CARD
tst bp
mov ax, MSG_CARD_CLIP_BOUNDS ;tell card to clip its bounds
jnz callChild
call VisCallFirstChild ;for top card, do it quickly
jmp endDeckClipNthCard
callChild:
call DeckCallNthChild
endDeckClipNthCard:
ret
DeckClipNthCard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckDraggableCardSelected
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_DRAGGABLE_CARD_SELECTED handler for DeckClass
CALLED BY:
PASS: *ds:si = instance data of deck
cx,dx = mouse position
bp = # of children to drag
CHANGES: GState is created (destroyed in DeckEndSelect)
drag data is set up (via MSG_DECK_SETUP_DRAG)
if outline dragging:
*inital outline is drawn (via MSG_DECK_DRAW_DRAG_OUTLINE)
if full dragging:
*deck registers itself with the playing table in order
to assure that it is redrawn during an exposed event
(in case the drag goes off the screen, we don't want
the graphics to be lost)
*card immediately beneath selected card is maximized
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp, di
PSEUDO CODE/STRATEGY:
[0]: Grab mouse and Ptr Events
[1]: Create GState
[2]: call MSG_DECK_SETUP_DRAG on self
[3]: check drag type from playing table
[4 outline]: call MSG_DECK_DRAW_DRAG_OUTLINE
[4 full]: register self as dragger with playing table
[5 full]: maximize card below selected card
KNOWN BUGS/IDEAS:
RENAME THIS TO REFLECT ACTUAL PURPOSE!!!!!!!!!
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckDraggableCardSelected method DeckClass, MSG_DECK_DRAGGABLE_CARD_SELECTED
push cx,dx,bp ;save mouse position, n cards
call VisForceGrabMouse ;grab mouse events
; call VisSendAllPtrEvents ;and ptr events
mov ax, MSG_VIS_VUP_CREATE_GSTATE
call ObjCallInstanceNoLock
Deref_DI Deck_offset
mov ds:[di].DI_gState, bp ;save gstate for later use
call ObjMarkDirty
pop cx,dx,bp ;restore mouse position, n card
mov ax, MSG_DECK_SETUP_DRAG
call ObjCallInstanceNoLock ;set up drag data
mov ax, MSG_GAME_MARK_ACCEPTORS
call DeckCallParentWithSelf
mov ax, MSG_GAME_GET_DRAG_TYPE
call VisCallParent
cmp cl, DRAG_OUTLINE ;see if we're outline dragging
jne fullDragging ;if not, jump to full dragging
;outlineDragging:
Deref_DI Deck_offset
mov di, ds:[di].DI_gState ;di <- graphics state
;change the graphics state to our liking and draw the outline
mov al, MM_INVERT
call GrSetMixMode ;set invert mode
clr ax, dx
call GrSetLineWidth ;set line width = 1
mov ax, MSG_DECK_DRAW_DRAG_OUTLINE
call ObjCallInstanceNoLock ;draw the outline
jmp checkInvertAcceptors
fullDragging:
; set first card under last drag card to drawable, full-size
Deref_DI Deck_offset
mov bp, ds:[di].DI_nDragCards
mov ax, MSG_CARD_MAXIMIZE
call DeckCallNthChild
checkInvertAcceptors:
mov ax, MSG_DECK_GET_DROP_CARD_ATTRIBUTES
call ObjCallInstanceNoLock
mov ax, MSG_GAME_INVERT_ACCEPTORS
call DeckCallParentWithSelf
;the deck must register itself with the playing table as being a
;dragger so that MSG_EXPOSEDs are passed to the deck no matter what
mov ax, MSG_GAME_REGISTER_DRAG
call DeckCallParentWithSelf
ret
DeckDraggableCardSelected endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckDraw
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_VIS_DRAW handler for DeckClass
CALLED BY:
PASS: ds:di = deck instance
*ds:si = instance data of deck
bp = gState
CHANGES: draws deck
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
checks to see if deck owns any visible children.
if so, processes them, then frees ClipRect
if not, draws its marker
KNOWN BUGS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckDraw method DeckClass, MSG_VIS_DRAW
.enter
;;we want to draw the marker instead of the children when the
;number of cards in the deck is not greater than the number of drag
;cards (i.e., when there are no undragged cards)
mov dx, ds:[di].DI_nCards ;dx <- # total cards
sub dx, ds:[di].DI_nDragCards ;dx <- (total - drag) cards
jnz drawChildren ;if the deck has any cards that
;are not currently dragging,
;then we want to draw them
mov ax, MSG_DECK_DRAW_MARKER
call ObjCallInstanceNoLock ;otherwise, draw the marker
jmp done
drawChildren:
mov ax, MSG_DECK_DRAW_REVERSE
call ObjCallInstanceNoLock ;draw children in reverse order
done:
.leave
ret
DeckDraw endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckDrawDragOutline
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_DRAW_DRAG_OUTLINE handler for DeckClass
CALLED BY: DeckDraggableCardSelected, DeckOutlinePtr, etc.
PASS: ds:di = deck instance
*ds:si = instance data of deck
CHANGES: draws outine of drag cards
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp
PSEUDO CODE/STRATEGY:
draws a big box around entire drag area
draws in horizontal lines as needed to show multiple cards
KNOWN BUGS/IDEAS:
this outline drawer will only look good if DI_offsetFromUpCardX is 0. For the
present, this is OK because it is 0.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckDrawDragOutline method DeckClass, MSG_DECK_DRAW_DRAG_OUTLINE
mov si, ds:[di].DI_offsetFromUpCardY ;si <- vert. offset
mov bp, ds:[di].DI_nDragCards ;bp <- # drag cards
dec bp ;bp <- # of extra
;lines we have to
;draw other than the
;bounding box
mov ax, ds:[di].DI_dragWidth
mov bx, ds:[di].DI_dragHeight
mov cx, ds:[di].DI_prevLeft
mov dx, ds:[di].DI_prevTop
CONVERT_WHLT_TO_LTRB
;;now ax,bx,cx,dx = left,top,right,bottom of drag area
mov di, ds:[di].DI_gState ;di <- gState
push ax, dx
mov dx, 5
clr ax
call GrSetLineWidth ;set line width = 5
pop ax, dx
call GrDrawRect ;draw bounding outline
;;this loop draws in the extra lines we need to indicate multiple cards
startLoop:
dec bp
; tst bp ;see if we're done yet
jl endLoop ;if so, end
add bx, si ;otherwise add vert. offset to top
; mov dx, bx ;set dx = bx so we get a horizontal line
; call GrDrawLine ;draw in our line
call GrDrawHLine ;This one line should replace the two
;preceeding lines
jmp startLoop
endLoop:
ret
DeckDrawDragOutline endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckDrawDrags
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_DRAW_DRAGS handler for DeckClass
Deck sends MSG_VIS_DRAW's to each of its drag cards
CALLED BY: PlayingTableDraw
PASS: ds:di = deck instance
*ds:si = instance data of deck
bp = gstate
CHANGES:
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
draws drag cards. used for conditions where the drag area
has gone out of bounds and we need to expose the area.
KNOWN BUGS/IDEAS:
This should be changed to use ObjCompProcessChildren
stuff instead of the vis links.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckDrawDrags method DeckClass, MSG_DECK_DRAW_DRAGS
mov cx, ds:[di].DI_nDragCards ;cx <- # drag cards
jcxz endLoop
mov si, ds:[si]
add si, ds:[si].Vis_offset
mov bx, ds:[si].VCI_comp.CP_firstChild.handle
mov si, ds:[si].VCI_comp.CP_firstChild.chunk
mov ax, MSG_VIS_DRAW
startLoop:
dec cx ;cx--
tst cx ;test for more drag cards
jl endLoop ;if none, jump
mov di, mask MF_FIXUP_DS
call ObjMessage ;make the call
mov si, ds:[si]
add si, ds:[si].Vis_offset
add si, offset VI_link
mov bx, ds:[si].LP_next.handle
mov si, ds:[si].LP_next.chunk
jmp startLoop ;jump to start of loop
endLoop:
ret
DeckDrawDrags endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckDrawMarker
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_DRAW_MARKER handler for DeckClass
draws a colored box in the bounds of the deck
CALLED BY: DeckDraw
PASS: ds:di = deck instance
*ds:si = instance data of deck
bp = gstate
CHANGES: changes color, area mask, draw mode of gstate, then
fills a box in the vis bounds of the deck
RETURN: nothing
DESTROYED: ax, bx, cx, dx, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
probably want to put in cool bitmaps eventually to replace the colored boxes
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckDrawMarker method DeckClass, MSG_DECK_DRAW_MARKER
uses ax, cx, dx, bp
.enter
mov cl, ds:[di].DI_markerMask
mov al, ds:[di].DI_markerColor ;get our color into al
mov di,bp ;move gstate into di
mov ah, CF_INDEX
call GrSetAreaColor ;set our color
mov al, cl
call GrSetAreaMask
mov al, MM_COPY ;copy mode
call GrSetMixMode
mov al, CMT_DITHER
call GrSetAreaColorMap
clr cl ;clear CompBoundsFlags
call VisGetBounds
mov cx, ax
mov dx, bx
mov ax, MSG_GAME_DRAW_BLANK_CARD
call VisCallParent
mov di, bp
mov al, SDM_100
call GrSetAreaMask
.leave
ret
DeckDrawMarker endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckDrawReverse
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_DRAW_REVERSE handler for DeckClass
CALLED BY:
PASS: *ds:si = instance data of deck
bp = graphics state
CHANGES: nothing
RETURN: nothing
DESTROYED: ax, bx, cx, dx, di
PSEUDO CODE/STRATEGY:
cycles through children and pushes their OD to the stack
then pops each one off the stack and sends each a MSG_VIS_DRAW
KNOWN BUGS/IDEAS:
THIS METHOD WONT BE NEEDED IF VIS BOUNDS DONT OVERLAP, WHICH
WOULD HAPPEN IF EITHER OF THE DI_offsetFromUpCard IN TALON
IS ZEROED
i would prefer the routine to use the next sibling links, rather than calling
MSG_VIS_FIND_CHILD each time
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckDrawReverse method DeckClass, MSG_DECK_DRAW_REVERSE
push bp ;gstate
clr dx
clr bx
startPushLoop:
push dx ;save # of child we're about to examine
push bx ;save # pushed so far
clr cx ;cx:dx = # of child
mov ax, MSG_VIS_FIND_CHILD
call ObjCallInstanceNoLock
jc endPushLoop ;if no children, we're done
CallObjectCXDX MSG_CARD_QUERY_DRAWABLE, MF_CALL ;do we want to draw it?
jnc checkOutNext ;if not, check next
;;otherwise, get the OD of this child onto the stack
; we want it so that the OD's are always at the bottom of the stack:
;
; +---------------------+
; top of stack ->| # pushed so far |
; +---------------------+
; |# of child to examine|
; +---------------------+
; | gstate |
; +---------------------+
; | OD |
; | #1 |
; +---------------------+
; | OD |
; | #2 |
; +---------------------+
; | OD |
; | #3 |
; .
; .
; .
;
;
pop bx ;get # pushed so far off stack
pop ax ;get # of child just examined off stack
pop bp ;get gstate off stack
push cx,dx ;push card OD
push bp ;put gstate back on stack
push ax ;put # of child just examined back on stack
inc bx ;increment # of OD's pushed on stack
push bx ;and push it onto the stack
checkOutNext:
pop bx ;restore # of OD's on stack so far
pop dx ;restore # of child just examined
inc dx ;get number of next child
jmp startPushLoop
endPushLoop:
pop bx ; # of ODs pushed
pop dx ; junk
pop bp ; gstate
startDrawLoop:
dec bx ;see if there are any more ODs on the stack
jl endDrawLoop ;if not, end
pop cx,si ;otherwise, pop one off
push bx ;save # of ODs
mov bx, cx ;^lbx:si <- OD
mov ax, MSG_VIS_DRAW ;draw the card
mov di, mask MF_FIXUP_DS
call ObjMessage
pop bx ;restore # of ODs
jmp startDrawLoop
endDrawLoop:
ret
DeckDrawReverse endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckDropDrags
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_DROP_DRAGS handler for DeckClass
CALLED BY: DeckEndSelect
PASS: *ds:si = instance data of deck
CHANGES:
RETURN: nothing
DESTROYED: ax, cx, dx
PSEUDO CODE/STRATEGY:
sends a method to the playing table asking it to give
the drag cards to any deck that'll take them.
if the cards are taken:
issues a MSG_DECK_REPAIR_SUCCESSFUL_TRANSFER to self
else:
issues a MSG_DECK_REPAIR_FAILED_TRANSFER to self
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckDropDrags method DeckClass, MSG_DECK_DROP_DRAGS
push si
mov ax, MSG_DECK_GET_DROP_CARD_ATTRIBUTES
call ObjCallInstanceNoLock
mov ax, MSG_GAME_DROPPING_DRAG_CARDS
call DeckCallParentWithSelf ;tell parent to
;advertise the dropped
;cards
pop si
mov ax, MSG_DECK_REPAIR_SUCCESSFUL_TRANSFER
jc repair
mov ax, MSG_DECK_REPAIR_FAILED_TRANSFER ;do visual repairs
repair:
call ObjCallInstanceNoLock
ret
DeckDropDrags endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckEndSelect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_META_END_SELECT, MSG_META_END_MOVE_COPY handler for DeckClass
CALLED BY:
PASS: ds:di = deck instance
*ds:si = instance data of deck
CHANGES: DI_gState cleared
DI_nDragCards zeroed
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp,
PSEUDO CODE/STRATEGY:
[outline 0] erases last outline
[full 0] invalidates last drag region
[1] send self a MSG_DRAP_DRAGS
[2] release mouse
[3] destroy gState
[4] clear DI_gState and DI_nDragCards
[5] send a method to playing table to inform that it is no
longer dragging
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckEndDrag method DeckClass, MSG_META_END_SELECT, MSG_META_END_MOVE_COPY
tst ds:[di].DI_gState ;if we have a gstate, we're dragging,
jnz getDragType ;so continue
jmp endDeckEndDrag ;otherwise, end
getDragType:
; CallObject MyPlayingTable, MSG_GAME_GET_DRAG_TYPE, MF_CALL
mov ax, MSG_GAME_GET_DRAG_TYPE
call VisCallParent
cmp cl, DRAG_OUTLINE ;see what kind of drag we're doing
jne eraseDragArea ;if full dragging, erase drag area
;eraseOutline:
mov ax, MSG_DECK_DRAW_DRAG_OUTLINE ;erase the outline
call ObjCallInstanceNoLock
jmp invertAcceptors
eraseDragArea:
Deref_DI Deck_offset
mov cx, ds:[di].DI_prevLeft
mov dx, ds:[di].DI_prevTop
cmp cx, ds:[di].DI_initLeft ;have we moved horizontally?
jne loadDimensions ;if so, go ahead with erasing
cmp dx, ds:[di].DI_initTop ;have we moved vertically?
je invertAcceptors ;if not, don't erase
loadDimensions:
mov ax, ds:[di].DI_dragWidth
mov bx, ds:[di].DI_dragHeight
CONVERT_WHLT_TO_LTRB
mov di, ds:[di].DI_gState
call GrInvalRect ;erase the last drag area
invertAcceptors:
mov ax, MSG_GAME_GET_USER_MODE
call VisCallParent
cmp cl, INTERMEDIATE_MODE
jne $10
clr cx
clr dx
mov ax, MSG_GAME_REGISTER_HILITED
call VisCallParent
$10:
mov ax, MSG_DECK_GET_DROP_CARD_ATTRIBUTES
call ObjCallInstanceNoLock
mov ax, MSG_GAME_INVERT_ACCEPTORS
call DeckCallParentWithSelf
mov ax, MSG_DECK_DROP_DRAGS ;drop these babies!!!
call ObjCallInstanceNoLock
call VisReleaseMouse ;We no longer want all the mouse events
Deref_DI Deck_offset
mov di, ds:[di].DI_gState
tst di
jz cleanUp
call GrDestroyState ;Free the gstate
cleanUp:
Deref_DI Deck_offset
clr ds:[di].DI_gState ;clear gstate pointer
clr ds:[di].DI_nDragCards ;no longer dragging any cards
call ObjMarkDirty
endDeckEndDrag:
; do this since the mouse event is processed here (return code)
mov ax, mask MRF_PROCESSED
ret
DeckEndDrag endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckFullPtr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_FULL_ PTR handler for DeckClass
CALLED BY: DeckPtr when the game is in full card dragging mode
PASS: ds:di = deck instance
*ds:si = instance data of deck
cx,dx = mouse coordinates
CHANGES: moves dragged cards to reflect new mouse position
bit blts to reflect new mouse position
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp, di
PSEUDO CODE/STRATEGY:
calculate spatial differences between this mouse
event and the last (deltaX and deltaY)
move the dragged cards by deltaX and deltaY
via (MSG_CARD_MOVE_RELATIVE)
update the drag coordinates
call GrBitBlt
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckFullPtr method DeckClass, MSG_DECK_FULL_PTR
push cx,dx ;save mouse position
;;get the x and y distances between this mouse event and
; the last one
sub cx, ds:[di].DI_dragOffsetX ;cx <- new left
sub dx, ds:[di].DI_dragOffsetY ;dx <- new top
sub cx, ds:[di].DI_prevLeft ;cx <- change in x from last
sub dx, ds:[di].DI_prevTop ;dx <- change in y from last
mov bp, ds:[di].DI_nDragCards ;bp <- # drag cards
push si
tst bp ;any drag cards?
jz endLoop
;;Point to first child
mov si, ds:[si] ;load ^lbx:si with first child
add si, ds:[si].Vis_offset
add si, offset VCI_comp
; mov bx, ds:[si].CP_firstChild.handle
mov si, ds:[si].CP_firstChild.chunk
startLoop:
dec bp ;bp--
tst bp ;test for more drag cards
jl endLoop ;if none, jump
call VisSetPositionRelative
mov si, ds:[si]
add si, ds:[si].Vis_offset
add si, offset VI_link
mov si, ds:[si].LP_next.chunk
jmp startLoop ;jump to start of loop
endLoop:
pop si
pop cx,dx
mov ax, MSG_DECK_UPDATE_DRAG ;update drag data
call ObjCallInstanceNoLock
;
; See if the hilight status has changed.
;
; Currently has visual bug
;
push ax, bp, cx, dx
mov ax, MSG_GAME_CHECK_HILITES
call DeckCallParentWithSelf
pop ax, bx, cx, dx
Deref_DI Deck_offset
push ds:[di].DI_dragHeight ;push height to stack
mov si, BLTM_MOVE
push si ;push BLTM_MOVE to stack
mov si, ds:[di].DI_dragWidth ;si <- width
mov di, ds:[di].DI_gState ;di <- gstate
call GrBitBlt ;do the move
ret
DeckFullPtr endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckGetCatchBounds
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_GET_CATCH_BOUNDS handler for DeckClass
Returns the boundaries against which drag boundaries are
tested.
CALLED BY:
PASS: *ds:si = instance data of deck
CHANGES: nothing
RETURN: ax = left of catch boundary
bp = top of catch boundary
cx = right of catch boundary
dx = bottom of catch boundary
DESTROYED: ax, bp, cx, dx
PSEUDO CODE/STRATEGY:
currently, catch boundaries = vis boundaries, so this
routine just passes the call on to MSG_VIS_GET_BOUNDS
KNOWN BUGS/IDEAS:
may want to change boundaries to be the bounds of just the first card in the
deck (i think the windows version does it this way)
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckGetCatchBounds method DeckClass, MSG_DECK_GET_CATCH_BOUNDS
;;for now, the catch bounds are the same as the vis bounds
mov ax, MSG_VIS_GET_BOUNDS
call ObjCallInstanceNoLock
ret
DeckGetCatchBounds endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckGetDragBounds
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_GET_DRAG_BOUNDS handler for DeckClass
Returns vis bounds of a deck's drag region
CALLED BY:
PASS: ds:di = deck instance
*ds:si = instance data of deck
CHANGES: nothing
RETURN: ax = left of drag region
bp = top of drag region
cx = right of drag region
dx = bottom of drag region
DESTROYED: bx
PSEUDO CODE/STRATEGY:
loads in drag parameters and passes them to CovertWHLT2LTRB
to get them into the proper format
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckGetDragBounds method DeckClass, MSG_DECK_GET_DRAG_BOUNDS
mov cx, ds:[di].DI_prevLeft
mov dx, ds:[di].DI_prevTop
mov ax, ds:[di].DI_dragWidth
mov bx, ds:[di].DI_dragHeight
CONVERT_WHLT_TO_LTRB
mov bp, bx
ret
DeckGetDragBounds endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckGetDropCardAttributes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_GET_DROP_CARD_ATTRIBUTES handler for DeckClass
CALLED BY:
PASS: ds:di = deck instance
*ds:si = instance data of deck
CHANGES: nothing
RETURN: bp = CardAttrs of the drop card
The "drop card" is the card in a drag group whose attributes
must be checked when determining the legality of a transfer
For example, in the following drag group:
+--------------------+
! !
! 6 Hearts !
! !
+--------------------+
! !
! 5 Clubs !
! !
+--------------------+
! !
! 4 Diamonds !
! !
+--------------------+
! !
! 3 Clubs !
! !
! !
! !
! !
! !
! !
! !
! !
! !
+--------------------+
the 6 of Hearts is the "drop card", because this group wants
to find a black 7 to land on, and the red 6 is what dictates
this criteria. In general, the drop card is the last card
in a drag group.
DESTROYED: ax, cx, dx
PSEUDO CODE/STRATEGY:
get attributes of card #(DI_nDragCards - 1)
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckGetDropCardAttributes method DeckClass, MSG_DECK_GET_DROP_CARD_ATTRIBUTES
mov bp, ds:[di].DI_nDragCards
dec bp
mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES
call ObjCallInstanceNoLock
ret
DeckGetDropCardAttributes endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckGetNthCardAttributes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_GET_NTH_CARD_ATTRIBUTES handler for DeckClass
Returns the attributes of the deck's nth card
CALLED BY:
PASS: bp = # of card to get attributes of (n=0 for top card)
CHANGES: nothing
RETURN: bp = attributes of nth card
carry = clear for success
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckGetNthCardAttributes method DeckClass, MSG_DECK_GET_NTH_CARD_ATTRIBUTES
mov ax, MSG_CARD_GET_ATTRIBUTES
call DeckCallNthChild
ret
DeckGetNthCardAttributes endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckImplodeExplode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_IMPLODE_EXPLODE handler for DeckClass
This is the effect of an illegal drop in outline dragging
mode. the outline of the drag region shinks to nothing
(implodes), then an outline grows to the size of the drag,
only relocated to where the drag began.
CALLED BY: DeckRepairFailedTransfer
PASS: ds:di = deck instance
*ds:si = instance data of deck
CHANGES: DI_dragOffset(X,Y) are changed to store the offset between
the initial and final mouse coordinates of the drag
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp, di
PSEUDO CODE/STRATEGY:
draw and erase a bunch of ever-shrinking outlines at the point
where the cards were droped, then
draw and erase a bunch of ever-growing outlines at the point
where the cards were originally selected
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckImplodeExplode method DeckClass, MSG_DECK_IMPLODE_EXPLODE
;draw first outline
mov cx, ds:[di].DI_prevLeft
mov dx, ds:[di].DI_prevTop
; since we no longer need the info in DI_dragOffset(X,Y), we'll
; use these slots to store the offset between the initial and final
; mouse coordinates of the drag
mov ds:[di].DI_dragOffsetX, cx
mov ax, ds:[di].DI_initLeft
sub ds:[di].DI_dragOffsetX, ax
mov ds:[di].DI_dragOffsetY, dx
mov ax, ds:[di].DI_initTop
sub ds:[di].DI_dragOffsetY, ax
call ObjMarkDirty
mov ax, ds:[di].DI_dragWidth
mov bx, ds:[di].DI_dragHeight
CONVERT_WHLT_TO_LTRB
mov di, ds:[di].DI_gState
call GrDrawRect ; draw the first outline
clr bp ; clear counter
startImplodeLoop:
push ax, bx, cx, dx ; old coords
inc ax ; increment left
inc bx ; increment top
dec cx ; decrement bottom
dec dx ; decrement right
cmp ax,cx
jge endImplodeLoop
inc bp ; increment the counter
call GrDrawRect ; draw the new outline
pop ax, bx, cx, dx ; restore old coords
call GrDrawRect ; erase the old outline
inc ax
inc bx ; shrink the outline
dec cx
dec dx
jmp startImplodeLoop ; loop back
endImplodeLoop:
pop ax, bx, cx, dx
call GrDrawRect ; erase last outline from imploding
; reposition ourselves so we can explode where the dragging originated
Deref_DI Deck_offset
sub ax, ds:[di].DI_dragOffsetX
sub bx, ds:[di].DI_dragOffsetY
sub cx, ds:[di].DI_dragOffsetX
sub dx, ds:[di].DI_dragOffsetY
mov di, ds:[di].DI_gState
call GrDrawRect ; draw initial outline
startExplodeLoop:
push ax, bx, cx, dx ; old coords
dec ax ;
dec bx ; grow the outline
inc cx ;
inc dx ;
tst bp
jz endExplodeLoop
dec bp
call GrDrawRect ; draw new outline
pop ax, bx, cx, dx ; restore old coords
call GrDrawRect ; erase old outline
dec ax ;
dec bx ; grow the outline
inc cx ;
inc dx ;
jmp startExplodeLoop ; loop back
endExplodeLoop:
pop ax, bx, cx, dx ; restore old coords
call GrDrawRect ; erase last outline
ret
DeckImplodeExplode endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckInvalidateInit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_INVALIDATE_INIT handler for DeckClass
Invalidates the initial drag area
CALLED BY:
PASS: ds:di = deck instance
*ds:si = instance data of deck
CHANGES: nothing
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp, di
PSEUDO CODE/STRATEGY:
creates a graphics state
calculates initial drag area
calls WinInvalRect on the area
destroys th graphics state
KNOWN BUGS/IDEAS:
rename method to MSG_DECK_INVALIDATE_INIT_AREA
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckInvalidateInit method DeckClass, MSG_DECK_INVALIDATE_INIT
tst ds:[di].DI_gState
jnz clean
mov ax, MSG_VIS_VUP_CREATE_GSTATE
call ObjCallInstanceNoLock
Deref_DI Deck_offset
mov ds:[di].DI_gState, bp
call ObjMarkDirty
clean:
mov bp, ds:[di].DI_gState
push bp
mov ax, MSG_DECK_CLEAN_AFTER_SHRINK
call ObjCallInstanceNoLock
pop bp
tst ds:[di].DI_nCards
jz drawMarker
mov ax, MSG_VIS_DRAW
call VisCallFirstChild
jmp done
drawMarker:
mov ax, MSG_VIS_INVALIDATE
call ObjCallInstanceNoLock
done:
Deref_DI Deck_offset
clr bp
xchg bp, ds:[di].DI_gState
call ObjMarkDirty
mov di, bp
call GrDestroyState
ret
DeckInvalidateInit endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckCleanAfterShrink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_CLEAN_AFTER_SHRINK handler for DeckClass
This method invalidates the portion of a deck's original
vis bounds that was clipped as a result of the deck
shinking.
(i.e., Let A = original deck bounds, B = new deck bounds:
this method invalidates A - B)
CALLED BY:
PASS: bp = gstate to invalidate through.
Also:
DI_initRight and DI_initBottom should contain
the right, bottom coordinates of the deck BEFORE
any shrinking occurred.
CHANGES:
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckCleanAfterShrink method DeckClass, MSG_DECK_CLEAN_AFTER_SHRINK
push bp
mov ax, MSG_VIS_GET_BOUNDS
call ObjCallInstanceNoLock
mov bx, bp
pop bp
Deref_DI Deck_offset
cmp cx, ds:[di].DI_initRight ;see if new right < old right
jge checkHeights
push ax, bx, cx, dx
mov ax, cx ;ax <- new right + 1
; inc ax
mov cx, ds:[di].DI_initRight ;cx <- old right
mov dx, ds:[di].DI_initBottom ;dx <- old top
mov di, bp
call GrInvalRect
pop ax, bx, cx, dx
checkHeights:
Deref_DI Deck_offset
cmp dx, ds:[di].DI_initBottom
jge done
mov bx, dx
; inc bx
mov cx, ds:[di].DI_initRight ;cx <- old right
mov dx, ds:[di].DI_initBottom ;dx <- old top
sub bx, 2 ; bx = top
mov di, bp
call GrInvalRect
done:
ret
DeckCleanAfterShrink endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckMoveAndClip
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_MOVE_AND_CLIP handler for DeckClass
Prepares the deck to push a card into its composite.
The data in DI_topCardLeft and DI_topCardTop are changed
to reflect the new card coming, and the vis bounds of the
current top card are clipped.
CALLED BY:
PASS: *ds:si = instance data of deck
CHANGES: DI_topCard(Left,Top) are updated via DeckOffsetTopLeft
Deck's vis bounds are stretched to cover all cards
Deck's top card's vis bounds are clipped
RETURN: nothing
DESTROYED: ax, cx, dx
PSEUDO CODE/STRATEGY:
bundle calls to MSG_DECK_OFFSET_TOP_LEFT,
MSG_DECK_STRETCH_BOUNDS
KNOWN BUGS/IDEAS:
i'm not sure why i put MSG_DECK_STRETCH_BOUNDS here.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckMoveAndClip method DeckClass, MSG_DECK_MOVE_AND_CLIP
;
; We need to update our records regarding the origin of
; the deck's top card.
;
; cx <- amount added to DI_topCardLeft
; dx <- amount added to DI_topCardTop
;
mov ax, MSG_DECK_OFFSET_TOP_LEFT
call ObjCallInstanceNoLock
;
; Stretch the deck by the amount that the new card is offset
; from the old top card
;
push cx,dx
mov ax, MSG_DECK_STRETCH_BOUNDS
call ObjCallInstanceNoLock
pop cx,dx
;
; Clip the vis bounds of the deck's top card
;
mov bp, 0
mov ax, MSG_DECK_CLIP_NTH_CARD
call ObjCallInstanceNoLock
ret
DeckMoveAndClip endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckOffsetTopLeft
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_OFFSET_TOP_LEFT handler for DeckClass
Adds offsets to the deck's information about the origin of its
top card.
CALLED BY:
PASS: *ds:si = instance data of deck
CHANGES: DI_topCardLeft and DI_topCardTop are offset by
DI_offsetFrom[Up|Down]Card[X|Y]
RETURN: cx = offset added to DI_topCardLeft
dx = offset added to DI_topCardTop
DESTROYED: bp, cx, dx, di
PSEUDO CODE/STRATEGY:
get attributes of first child
if no children, clear cx,dx and return
else use attributes to determine whether we want
UpCard or DownCard offsets, then add them
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckOffsetTopLeft method DeckClass, MSG_DECK_OFFSET_TOP_LEFT
clr bp
mov ax, MSG_CARD_GET_ATTRIBUTES
call VisCallFirstChild
tst bp ;see if we got anything back (i.e.,
;see if we have any children)
jnz gotTopCardAttrs ;if so, we've got its attributes in bp
;noKids:
clr cx ;no kids, so no offsets
clr dx
jmp endDeckOffsetTopLeft
gotTopCardAttrs:
Deref_DI Deck_offset
test bp, mask CA_FACE_UP
jz faceDown
;faceUp:
mov cx, ds:[di].DI_offsetFromUpCardX ;if the card is face up
mov dx, ds:[di].DI_offsetFromUpCardY ;we want up offsets
jmp addOffsets
faceDown:
mov cx, ds:[di].DI_offsetFromDownCardX ;if card is face down,
mov dx, ds:[di].DI_offsetFromDownCardY ;we want down offsets
addOffsets:
add ds:[di].DI_topCardLeft, cx ;add the offsets to the topCard
add ds:[di].DI_topCardTop, dx ;position
call ObjMarkDirty
endDeckOffsetTopLeft:
ret
DeckOffsetTopLeft endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckOutlinePtr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_OUTLINE_PTR handler for DeckClass
Handles a new mouse event during a drag under outline
dragging.
CALLED BY: DeckPtr
PASS: *ds:si = instance data of deck
cx,dx = mouse position
CHANGES: instance data in the deck is changed to reflect new mouse
coordinates, old outline is erased, new outline is drawn
RETURN: nothing
DESTROYED: ax, cx, dx
PSEUDO CODE/STRATEGY:
erase old outline
update drag data
draw new outline
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckOutlinePtr method DeckClass, MSG_DECK_OUTLINE_PTR
push cx,dx ;save mouse
mov ax, MSG_DECK_DRAW_DRAG_OUTLINE ;erase old outline
call ObjCallInstanceNoLock
pop cx,dx ;restore mouse
mov ax, MSG_DECK_UPDATE_DRAG ;update drag data
call ObjCallInstanceNoLock
mov ax, MSG_DECK_DRAW_DRAG_OUTLINE ;draw new outline
call ObjCallInstanceNoLock
mov ax, MSG_GAME_CHECK_HILITES
call DeckCallParentWithSelf
ret
DeckOutlinePtr endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckPopAllCards
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_POP_ALL_CARDS handler for DeckClass
Pops all of a deck's cards to another deck. Relative
order of the cards is reversed.
CALLED BY:
PASS: ds:di = deck instance
*ds:si = instance data of deck
^lcx:dx = instance of VisCompClass to receive the cards
(usually another Deck)
CHANGES: Deck's cards popped to deck in ^lcx:dx
RETURN: nothing
DESTROYED: ax, bp, di
PSEUDO CODE/STRATEGY:
sends self a MSG_DECK_POP_N_CARDS with n = total # of cards
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckPopAllCards method DeckClass, MSG_DECK_POP_ALL_CARDS
mov bp, ds:[di].DI_nCards
mov ax, MSG_DECK_POP_N_CARDS ;set bp = total cards and
call ObjCallInstanceNoLock ;pop 'em all
ret
DeckPopAllCards endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckPopCard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_POP_CARD handler for DeckClass
Remove deck's top card from deck's composite.
CALLED BY:
PASS: *ds:si = instance data of deck
CHANGES: if deck has children:
its top card is removed from the vis tree
RETURN: if deck has children:
carry clear
^lcx:dx = popped card
if not:
carry set
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckPopCard method DeckClass, MSG_DECK_POP_CARD
clr cx
clr dx
mov ax, MSG_DECK_REMOVE_NTH_CARD ;remove 1st card
call ObjCallInstanceNoLock
ret
DeckPopCard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckPopNCards
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_POP_N_CARDS handler for DeckClass
Give a certain number of cards to another deck by popping
them off, and pushing them onto the other deck.
CALLED BY:
PASS: *ds:si = instance data of deck
bp = number of cards to transfer
^lcx:dx = instance of VisCompClass to receive the cards
(usually another Deck)
CHANGES: The top bp cards of deck at *ds:si are popped
to the top of deck at ^lcx:dx. The order of the cards is
reversed (i.e., the top card of the donor will be the bp'th
card of the recipient).
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp
PSEUDO CODE/STRATEGY:
loops bp times, popping cards (starting with the 0th, ending
with the bp'th) from the donor and pushing them to the
recipient
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckPopNCards method DeckClass, MSG_DECK_POP_N_CARDS
startLoop:
dec bp ;done yet?
js endLoop ;if so, end
push bp ;total left to pop
push cx, dx ;save OD of recipient
mov ax, MSG_DECK_POP_CARD
call ObjCallInstanceNoLock
mov bp, si ;save deck chunk in bp
pop bx, si ;restore OD of recipient
push bp ;push deck chunk to stack
push bx, si ;save OD of recipient
mov ax, MSG_DECK_PUSH_CARD ;give card to recipient
mov di, mask MF_FIXUP_DS
call ObjMessage
pop cx, dx ;restore OD of recipient
pop si ;restore deck chunk
pop bp ;restore cards left to pop
jmp startLoop
endLoop:
ret
DeckPopNCards endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckPtr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_META_PTR handler for DeckClass
CALLED BY:
PASS: *ds:si = instance data of deck
cx,dx = mouse position
bp = ButtonInfo
CHANGES: nothing
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
depending on the drag type, passes the call on to either
MSG_DECK_OUTLINE_PTR or MSG_DECK_FULL_PTR
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckPtr method DeckClass, MSG_META_PTR
; test bp, mask BI_B0_DOWN or mask BI_B2_DOWN
; ;see if button is still down
; jz endDeckPtr ;if not, end
;
; We'll test the gstate to see whether or not the user is
; dragging. Could also just test DI_nDragCards.
;
tst ds:[di].DI_gState ;see if we have a gstate (i.e.,
;if we're dragging)
jz endDeckPtr ;if not, end
push cx,dx ;save mouse position
;; see what kind of drag we're supposed to be doing
; CallObject MyPlayingTable, MSG_GAME_GET_DRAG_TYPE, MF_CALL
mov ax, MSG_GAME_GET_DRAG_TYPE
call VisCallParent
cmp cl, DRAG_OUTLINE
pop cx,dx ;restore mouse position
jne fullDragging
;outlineDragging:
mov ax, MSG_DECK_OUTLINE_PTR ;dispatch call to outline ptr
call ObjCallInstanceNoLock
jmp endDeckPtr
fullDragging:
mov ax, MSG_DECK_FULL_PTR ;dispatch call to full ptr
call ObjCallInstanceNoLock
endDeckPtr:
mov ax, mask MRF_PROCESSED ;the ptr event has been
;processed
ret
DeckPtr endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckPushCard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_PUSH_CARD, MSG_DECK_PUSH_CARD_NO_EFFECTS handler
for DeckClass
Adds a card to the deck's composite, and does some visual
operations that reflect the adoption. The two methods
are identical at this level, but exist independently so
they can be subclassed differently.
CALLED BY:
PASS: *ds:si = instance data of deck
^lcx:dx = card to be added
CHANGES:
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp, di
PSEUDO CODE/STRATEGY:
[0] self-call MSG_DECK_MOVE_AND_CLIP
[1] self-call MSG_DECK_ADD_CARD_FIRST
[2] send added card MSG_CARD_SET_NOT_DRAWABLE
[3] send added card MSG_CARD_SET_DRAWABLE via queue
[4] send added card MSG_CARD_FADE_REDRAW via queue
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckPushCard method DeckClass, MSG_DECK_PUSH_CARD, MSG_DECK_PUSH_CARD_NO_EFFECTS
push cx,dx ;save card OD
mov ax, MSG_DECK_MOVE_AND_CLIP ;prepare to push card
call ObjCallInstanceNoLock
pop cx,dx ;restore card OD
push cx, dx ;save card OD
mov ax, MSG_DECK_ADD_CARD_FIRST ;push it
call ObjCallInstanceNoLock
Deref_DI Deck_offset
mov dx, ds:[di].DI_pushPoints
tst dx
jz afterScore
clr cx
mov ax, MSG_GAME_UPDATE_SCORE
call VisCallParent
afterScore:
pop bx, si ;restore card OD
mov ax, MSG_CARD_SET_DRAWABLE
mov di, mask MF_FIXUP_DS ; or mask MF_FORCE_QUEUE
call ObjMessage
mov ax, MSG_CARD_NORMAL_REDRAW
mov di, mask MF_FIXUP_DS ; or mask MF_FORCE_QUEUE
GOTO ObjMessage
DeckPushCard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckRedraw
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_REDRAW handler for DeckClass
CALLED BY:
PASS: *ds:si = instance data of deck
CHANGES: nothing
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp, di
PSEUDO CODE/STRATEGY:
generates a graphics state
issues a MSG_VIS_DRAW to self
destroys the graphics state
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckRedraw method DeckClass, MSG_DECK_REDRAW
mov ax, MSG_VIS_VUP_CREATE_GSTATE
call ObjCallInstanceNoLock
tst bp
jz endDeckRedraw
;;draw it
push bp
mov ax, MSG_VIS_DRAW
call ObjCallInstanceNoLock
;;destroy the graphics state
pop di
call GrDestroyState
endDeckRedraw:
ret
DeckRedraw endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckRemoveNthCard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_REMOVE_NTH_CARD method handler for DeckClass
Removes a card from the deck's composite
CALLED BY: DeckPopCard, others
PASS: *ds:si = instance data of deck
^lcx:dx = child to remove
- or -
if cx = 0, dx = nth child to remove (0 = first child)
CHANGES: if deck has children:
the card indicated by cx,dx is removed
from the vis tree and DI_nCards
is updated accordingly
RETURN: if deck has children:
carry clear
^lcx:dx = removed card
if not:
carry set
DESTROYED: ax, bx, cx, dx, di
PSEUDO CODE/STRATEGY:
locates the child
removes it
gets its attrs
decrements n[Up|Down]Cards depending on attributes
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckRemoveNthCard method DeckClass, MSG_DECK_REMOVE_NTH_CARD
;;cx:dx = number of child to remove (for pop, cx=dx=0)
mov ax, MSG_VIS_FIND_CHILD
call ObjCallInstanceNoLock
jc cantFindNthCard
;;now ^lcx:dx = nth child
mov bp, mask CCF_MARK_DIRTY
mov ax, MSG_VIS_REMOVE_CHILD
call ObjCallInstanceNoLock
;endDeckRemoveNthCard:
push cx,dx
mov dx, ds:[di].DI_popPoints
tst dx
jz afterScore
clr cx
; CallObject MyPlayingTable, MSG_GAME_UPDATE_SCORE, MF_FIXUP_DS
mov ax, MSG_GAME_UPDATE_SCORE
call VisCallParent
afterScore:
mov ax, MSG_DECK_UPDATE_TOPLEFT
call ObjCallInstanceNoLock
pop cx,dx
clc ; clear carry to denote that we popped a card
cantFindNthCard:
ret
DeckRemoveNthCard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckRemoveVisChild
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_VIS_REMOVE_CHILD handler for DeckClass
This method is subclassed from VisCompClass so that we can
update the number of cards we have.
CALLED BY:
PASS: ds:di = deck instance
*ds:si - instance data (offset through Vis_offset)
es - segment of VisCompClass
ax - MSG_VIS_REMOVE_CHILD
bp - mask CCF_MARK_DIRTY set if parent and siblings should be dirtied
appropriately
cx:dx - child to remove
CHANGES: card ^lcx:dx is removed from the deck's composite, DI_nCards
is decremented accordingly
RETURN: nothing
DESTROYED:
ax, bx, cx, dx, bp, si, di, ds, es
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 12/19/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckRemoveVisChild method DeckClass, MSG_VIS_REMOVE_CHILD
dec ds:[di].DI_nCards
call ObjMarkDirty
mov di, offset DeckClass
call ObjCallSuperNoLock
ret
DeckRemoveVisChild endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckAddVisChild
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_VIS_ADD_CHILD handler for DeckClass
This method is subclassed from VisCompClass so that we can
update the number of cards we have.
CALLED BY:
PASS: ds:di = deck instance
*ds:si - instance data (offset through Vis_offset)
es - segment of VisCompClass
ax - MSG_VIS_ADD_CHILD
cx:dx - object to add
bp - CompChildFlags
CHANGES: card ^lcx:dx is added from the deck's composite, DI_nCards
is incremented accordingly
RETURN: nothing
DESTROYED:
ax, bx, cx, dx, bp, si, di, ds, es
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 12/19/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckAddVisChild method DeckClass, MSG_VIS_ADD_CHILD
inc ds:[di].DI_nCards
call ObjMarkDirty
mov di, offset DeckClass
GOTO ObjCallSuperNoLock
DeckAddVisChild endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckRepairFailedTransfer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_REPAIR_FAILED_TRANSFER handler for DeckClass
Fixes up the state of affairs (both visual and internal)
when cards are dropped and no deck accepts them.
CALLED BY: DeckDropDrags
PASS: ds:di = deck instance
*ds:si = instance data of deck
CHANGES:
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp, di
PSEUDO CODE/STRATEGY:
[0] clip the vis bounds of the top *UN*dragged card in the deck
to prepare for the return of the dragged cards
[1] get drag type from playing table
[2] check to see if there was any mouse movement
if no mouse movement:
jump to the end
[outline dragging 3] issue self a MSG_DECK_IMPLODE_EXPLODE
[outline dragging 4] jump to end
[full dragging 3] move the dragged cards back to their original
positions
[full dragging 4] set the cards *NOT* drawable
we queue the calls in [5] and [6] so that the MSG_META_EXPOSED generated by the
call to WinInvalRect in DeckEndSelect can occur before [5] and [6]
[full dragging 5] queue call to set drag cards drawable
[full dragging 6] queue call to fade redraw drag cards
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckRepairFailedTransfer method DeckClass, MSG_DECK_REPAIR_FAILED_TRANSFER
;;the card below the drop card has been set to full size, so we must
; re-clip its bounds to prepare for the return of the drag cards
mov bp, ds:[di].DI_nDragCards
mov ax, MSG_CARD_GET_ATTRIBUTES
call DeckCallNthChild
Deref_DI Deck_offset
test bp, mask CA_FACE_UP
jnz faceUp
;faceDown:
mov cx, ds:[di].DI_offsetFromDownCardX
mov dx, ds:[di].DI_offsetFromDownCardY
jmp clipCard
faceUp:
mov cx, ds:[di].DI_offsetFromUpCardX
mov dx, ds:[di].DI_offsetFromUpCardY
clipCard:
mov bp, ds:[di].DI_nDragCards
mov ax, MSG_DECK_CLIP_NTH_CARD
call ObjCallInstanceNoLock
Deref_DI Deck_offset
mov cx, ds:[di].DI_initLeft
mov dx, ds:[di].DI_initTop
sub cx, ds:[di].DI_prevLeft ;cx <- total horizontal travel
sub dx, ds:[di].DI_prevTop ;dx <- total vertical travel
jnz notifyGame ;if we moved vertically, fixup
jcxz endRepair ;if we haven't moved, don't fixup
notifyGame:
push cx, dx
mov dx, si
mov cx, ds:[LMBH_handle] ;^lcx:dx - self
mov ax, MSG_GAME_TRANSFER_FAILED
call VisCallParent
;checkType:
; CallObject MyPlayingTable, MSG_GAME_GET_DRAG_TYPE, MF_CALL
mov ax, MSG_GAME_GET_DRAG_TYPE
call VisCallParent
cmp cl, DRAG_OUTLINE
pop cx, dx
jne failedFull
;failedOutline:
tst cx
jge checkHorizDisp
neg cx
checkHorizDisp:
cmp cx, MINIMUM_HORIZONTAL_DISPLACEMENT
jg implodeExplode
tst dx
jge checkVertDisp
neg dx
checkVertDisp:
cmp dx, MINIMUM_VERTICAL_DISPLACEMENT
jle endRepair
implodeExplode:
mov ax, MSG_DECK_IMPLODE_EXPLODE ;funky outline effect
call ObjCallInstanceNoLock
jmp endRepair
failedFull:
mov bp, MSG_CARD_MOVE_RELATIVE ;move drag cards back to where
mov di, mask MF_FIXUP_DS ;they came from
call DeckCallDrags
mov bp, MSG_CARD_SET_NOT_DRAWABLE ; set drags not drawable, so
mov di, mask MF_FIXUP_DS ; that when the area is cleaned
call DeckCallDrags ; up, they don't appear
mov bp, MSG_CARD_SET_DRAWABLE ; by queueing this request, we
; make sure that WinInvalRect
; is done before redrawing
mov di, mask MF_FIXUP_DS or mask MF_FORCE_QUEUE
call DeckCallDrags
mov bp, MSG_CARD_FADE_REDRAW
mov di, mask MF_FIXUP_DS or mask MF_FORCE_QUEUE
call DeckCallDrags
endRepair:
;; Telling the game object that no deck is dragging anymore
;; used to be handled at the end of DeckEndDrag, but that
;; handler generated methods that needed to be handled before
;; we can really say that there is no more dragger.
;; Accordingly, the sent MSG_GAME_REGISTER_DRAG has been moved to
;; the end of DeckRepairFailedTransfer and DeckRepairSuccessfulTransfer
clr cx
clr dx
mov ax, MSG_GAME_REGISTER_DRAG
call VisCallParent
ret
DeckRepairFailedTransfer endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckCallDrags
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sends a method to a deck's dragging cards. Used for
stuff like sending a method to move to all the dragging
cards, etc.
CALLED BY: DeckRepairFailedTransfer
PASS: *ds:si = instance data of deck
bp = method number
cx, dx = other data
di = flags for ObjMessage
CHANGES: the dragged cards (= the first DI_nDragCards) are
called with message #bp and data cx,dx
RETURN: nothing
DESTROYED: ax, bx, cx, dx, di, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
jon 10/90 merged two methods into one fuunction
by letting the user pass in his own
ObjMessage flags
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckCallDrags proc near
class DeckClass
push si
mov ax, bp ;ax <- method #
push di
Deref_DI Deck_offset
mov bp, ds:[di].DI_nDragCards ;bp <- # drag cards
tst bp ;any drag cards?
pop di
jz endLoop
push di
;;set ^lbx:si to first child
mov si, ds:[si] ;load ^lbx:si with first child
add si, ds:[si].Vis_offset
add si, offset VCI_comp
mov bx, ds:[si].CP_firstChild.handle
mov si, ds:[si].CP_firstChild.chunk
startLoop:
;;test for completion
pop di
dec bp ;decrement the number of cards
;left to process
tst bp
jl endLoop ;if no more drag cards, jump
;; make the call
push di
call ObjMessage ;make the call
;;get the next child to process
mov si, ds:[si]
add si, ds:[si].Vis_offset
add si, offset VI_link
mov bx, ds:[si].LP_next.handle ;load ^lbx:si with next child
mov si, ds:[si].LP_next.chunk
jmp startLoop ;jump to start of loop
endLoop:
pop si
ret
DeckCallDrags endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckRepairSuccessfulTransfer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_REPAIR_SUCCESSFUL_TRANSFER handler for DeckClass
fixes up the visual state of affairs when cards are dropped
successfully (i.e., the dragged cards are accepted by another
deck).
CALLED BY: DeckDropDrags
PASS: *ds:si = instance data of deck
CHANGES: nothing
RETURN: nothing
DESTROYED: ax, cx, dx
PSEUDO CODE/STRATEGY:
maximizes bounds of new top card, and issues a
MSG_UPDATE_TOP_LEFT to self.
KNOWN BUGS/IDEAS:
this method is really only necessary for outline dragging,
but doesn't hurt in full dragging, and it's faster just
to do it anyway.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckRepairSuccessfulTransfer method DeckClass,MSG_DECK_REPAIR_SUCCESSFUL_TRANSFER
mov ax, MSG_CARD_MAXIMIZE ;make sure top card is now
call VisCallFirstChild ;set to full size
clr cx
clr dx
mov ax, MSG_GAME_REGISTER_DRAG
call VisCallParent
mov ax, MSG_DECK_INVALIDATE_INIT
call ObjCallInstanceNoLock
ret
DeckRepairSuccessfulTransfer endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckRequestBlankCard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_REQUEST_BLANK_CARD handler for DeckClass
Draws a blank card at the specified location.
CALLED BY:
PASS: cx,dx = origin of blank card
bp = gstate
CHANGES:
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
should be turned into a VUQ in the game object, maybe?
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckRequestBlankCard method DeckClass, MSG_DECK_REQUEST_BLANK_CARD
mov ax, MSG_GAME_DRAW_BLANK_CARD
call VisCallParent
ret
DeckRequestBlankCard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckRequestFrame
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_REQUEST_FRAME handler for DeckClass
Draws a card frame at the specified location.
CALLED BY:
PASS: cx,dx = origin of blank card
bp = gstate
CHANGES:
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
should be turned into a VUQ in the game object, maybe?
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckRequestFrame method DeckClass, MSG_DECK_REQUEST_FRAME
mov ax, MSG_GAME_DRAW_FRAME
call VisCallParent
ret
DeckRequestFrame endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckRequestFakeBlankCard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_REQUEST_FAKE_BLANK_CARD handler for DeckClass
Deck makes a request to the game object to draw a fake
blank card at the specified position.
A fake blank card is simply a black-bordered white rectangle
the size of a card.
CALLED BY:
PASS: cx,dx = where to draw fake blank card
bp = gstate
CHANGES:
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckRequestFakeBlankCard method DeckClass, MSG_DECK_REQUEST_FAKE_BLANK_CARD
mov ax, MSG_GAME_FAKE_BLANK_CARD
call VisCallParent
ret
DeckRequestFakeBlankCard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckStretchBounds
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_STRETCH_BOUNDS handler for DeckClass
Widens (or shrinks) a deck's vis bounds by a certain amount.
CALLED BY:
PASS: *ds:si = instance data of deck
cx = incremental width
dx = incremental height
CHANGES: deck's vis dimensions are increased by cx,dx
RETURN: nothing
DESTROYED: ax, bx, cx, dx
PSEUDO CODE/STRATEGY:
get size
add increments to size
resize
KNOWN BUGS/IDEAS:
maybe turn into VisStretch?
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckStretchBounds method DeckClass, MSG_DECK_STRETCH_BOUNDS
push cx, dx ;save increments
mov ax, MSG_VIS_GET_SIZE ;get current size
call ObjCallInstanceNoLock
pop ax, bx
add cx, ax ;add in increments
add dx, bx
mov ax, MSG_VIS_SET_SIZE ;resize
call ObjCallInstanceNoLock
ret
DeckStretchBounds endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckTakeCardsIfOK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_TAKE_CARDS_IF_OK handler for DeckClass
Determines whether a deck will accept a drop from another
deck. If so, issues a MSG_DECK_TRANSFER_DRAGGED_CARDS to
the donor.
CALLED BY:
PASS: *ds:si = instance data of deck
bp = CardAttr of the drop card (bottom card in the drag)
^lcx:dx = potential donor deck
CHANGES: If the transfer is accepted, the deck with OD ^lcx:dx
transfers #DI_nDragCards cards to the deck
RETURN: carry set if transfer occurs,
carry clear if not
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
calls TestAcceptCards
if deck accepts, issues a MSG_DECK_TRANSFER_DRAGGED_CARDS
to donor
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckTakeCardsIfOK method DeckClass, MSG_DECK_TAKE_CARDS_IF_OK
push cx,dx ;save donor OD
mov ax, MSG_DECK_TEST_ACCEPT_CARDS
call ObjCallInstanceNoLock
jc willAccept
;wontAccept:
add sp, 4 ;clear OD off stack
jmp endDeckTakeCardsIfOK
willAccept:
;;get drag type
; CallObject MyPlayingTable, MSG_GAME_GET_DRAG_TYPE, MF_CALL
mov ax, MSG_GAME_GET_DRAG_TYPE
call VisCallParent
cmp cl, DRAG_OUTLINE
pop cx,dx ;restore donor OD
jne transferCards
;;tell donor to invalidate the initial drag area if we in outline mode
; CallObjectCXDX MSG_DECK_INVALIDATE_INIT, MF_FIXUP_DS
transferCards:
mov bx, ds:[LMBH_handle]
xchg bx, cx
xchg si, dx
;^lbx:si = donor
;^lcx:dx = recipient
mov ax, MSG_DECK_TRANSFER_DRAGGED_CARDS ;do the transfer
mov di, mask MF_FIXUP_DS
call ObjMessage
stc ;indicate that we took
;the cards
endDeckTakeCardsIfOK:
ret
DeckTakeCardsIfOK endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckTakeDoubleClickIfOK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_TAKE_DOUBLE_CLICK_IF_OK handler for DeckClass
Determines whether a deck wil accept a double click from
another deck. If so, issues a MSG_DECK_TRANSFER_DRAGGED_CARDS
to the donor.
CALLED BY:
PASS: ds:di = deck instance
*ds:si = instance data of deck
bp = CardAttr of the double clicked card
^lcx:dx = potential donor deck
CHANGES: nothing
RETURN: carry set if card(s) are accepted elsewhere
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
since only a foundation should be accepting a double click,
this default routine returns carry clear, indicating no
transfer. See FoundationTakeDoubleClickIfOK for something
more exciting.
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckTakeDoubleClickIfOK method DeckClass, MSG_DECK_TAKE_DOUBLE_CLICK_IF_OK
test ds:[di].DI_deckAttrs, mask DA_IGNORE_EXPRESS_DRAG
jnz endDeckTakeDoubleClickIfOK
push cx,dx ;save OD of donor
; mov ax, MSG_DECK_TEST_RIGHT_CARD ;check if right card
; call ObjCallInstanceNoLock
mov ax, MSG_DECK_GET_COMPARISON_KIT
call ObjCallInstanceNoLock
pop cx,dx
push cx,dx ;save OD of donor
call Test4RightCard
pop cx,dx ;restore OD of donor
jc willAccept
;wontAccept:
jmp clearCarry
willAccept:
; CallObjectCXDX MSG_DECK_INVALIDATE_INIT, MF_FIXUP_DS ;inval. donor
mov bx, ds:[LMBH_handle]
xchg bx, cx ;^lbx:si <- donor
xchg si, dx ;^lcx:dx <- acceptor
mov ax, MSG_DECK_TRANSFER_DRAGGED_CARDS
mov di, mask MF_FIXUP_DS
call ObjMessage
stc ;we've taken the cards
jmp endDeckTakeDoubleClickIfOK
clearCarry:
clc ;we didn't take cards
endDeckTakeDoubleClickIfOK:
ret
DeckTakeDoubleClickIfOK endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckInvertSelf
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_INVERT handler for DeckClass
Deck visually inverts itself (its top card if it has one,
its marker if not).
CALLED BY:
PASS: ds:di = deck instance
*ds:si = deck object
CHANGES:
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp, di
PSEUDO CODE/STRATEGY:
if (deck has cards) {
tell top card to invert itself;
}
else {
create a gstate;
set draw mode to MM_INVERT;
get deck's vis bounds;
invert the bounds;
destroy gstate;
}
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckInvertSelf method DeckClass, MSG_DECK_INVERT
TOGGLE ds:[di].DI_deckAttrs, DA_INVERTED
call ObjMarkDirty
tst ds:[di].DI_nCards
jz invertMarker
mov ax, MSG_CARD_INVERT
call VisCallFirstChild
jmp endDeckInvertSelf
invertMarker:
ifdef I_DONT_REALLY_LIKE_THIS_EFFECT
mov ax, MSG_VIS_VUP_CREATE_GSTATE
call ObjCallInstanceNoLock
mov di, bp
mov al, MM_INVERT
call GrSetMixMode ;set invert mode
push di
mov ax, MSG_VIS_GET_BOUNDS
call ObjCallInstanceNoLock
mov bx, bp
pop di
call GrFillRect
call GrDestroyState
endif
endDeckInvertSelf:
ret
DeckInvertSelf endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckClearInverted
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_CLEAR_INVERTED handler for DeckClass
CALLED BY:
PASS: ds:di = deck instance
*ds:si = deck object
CHANGES:
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 19 feb 92 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckClearInverted method DeckClass, MSG_DECK_CLEAR_INVERTED
test ds:[di].DI_deckAttrs, mask DA_INVERTED
jz done
RESET ds:[di].DI_deckAttrs, DA_INVERTED
call ObjMarkDirty
tst ds:[di].DI_nCards
jz done ; jz clearMarker
mov ax, MSG_CARD_CLEAR_INVERTED
call VisSendToChildren
ifdef I_DONT_REALLY_LIKE_THIS_EFFECT
jmp done
clearMarker:
mov ax, MSG_VIS_INVALIDATE
call ObjCallInstanceNoLock
endif
done:
ret
DeckClearInverted endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckInvertIfAccept
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_INVERT_IF_ACCEPT handler for DeckClass.
Deck visually inverts itself (or its top card, if any) if
its DA_WANTS_DRAG bit is set.
CALLED BY:
PASS: ds:di = deck instance
*ds:si = deck object
CHANGES:
RETURN: nothing
DESTROYED: ax, cx, dx
PSEUDO CODE/STRATEGY:
if (ds:[di].DI_deckAttrs && mask DA_WANTS_DRAG)
send self MSG_DECK_INVERT
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckInvertIfAccept method DeckClass, MSG_DECK_INVERT_IF_ACCEPT
test ds:[di].DI_deckAttrs, mask DA_WANTS_DRAG
jz endDeckInvertIfAccept
mov ax, MSG_DECK_INVERT
call ObjCallInstanceNoLock
endDeckInvertIfAccept:
ret
DeckInvertIfAccept endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckMarkIfAccept
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_MARK_IF_ACCEPT handler for DeckClass
This method sets the DA_WANTS_DRAG bit in the DeckAttrs
iff the deck would accept the drag set from the passed dragger.
CALLED BY:
PASS: ^lcx:dx = dragging deck
CHANGES:
RETURN: nothing
DESTROYED: ax, cx, dx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckMarkIfAccept method DeckClass, MSG_DECK_MARK_IF_ACCEPT
mov ax, MSG_DECK_TEST_RIGHT_CARD
call ObjCallInstanceNoLock
jnc noAccept
;accept:
Deref_DI Deck_offset
SET ds:[di].DI_deckAttrs, DA_WANTS_DRAG
call ObjMarkDirty
jmp endDeckMarkIfAccept
noAccept:
Deref_DI Deck_offset
RESET ds:[di].DI_deckAttrs, DA_WANTS_DRAG
call ObjMarkDirty
endDeckMarkIfAccept:
ret
DeckMarkIfAccept endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckCheckPotentialDrop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_CHECK_POTENTIAL_DROP handler for DeckClass
Checks to see whether this deck would accept the drag
if it were to be dropped right now. If it would, it sends
a MSG_GAME_REGISTER_HILITED to the game object with its own OD.
CALLED BY:
PASS: *ds:si = deck object
^lcx:dx = dragging deck
CHANGES:
RETURN: carry set if deck would accept cards
DESTROYED: ax, cx, dx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckCheckPotentialDrop method DeckClass, MSG_DECK_CHECK_POTENTIAL_DROP
mov ax, MSG_DECK_TEST_ACCEPT_CARDS
call ObjCallInstanceNoLock
jnc endDeckCheckPotentialDrop
mov ax, MSG_GAME_REGISTER_HILITED
call DeckCallParentWithSelf
stc
endDeckCheckPotentialDrop:
ret
DeckCheckPotentialDrop endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckTestAcceptCards
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_TEST_ACCEPT_CARDS handler for DeckClass
Tests deck to see whether a set of dragged cards
would be accepted to the drag if it were dropped right
now (i.e., rank&suit are ok, and position is ok).
CALLED BY:
PASS: ds:di = deck instance
*ds:si = instance data of deck
^lcx:dx = potential donor deck
CHANGES:
RETURN: carry set if deck would accept cards,
carry clear otherwise
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
calls TestRightCard to see if the card type is correct
calls CheckDragCaught to see if the bounds are correct
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckTestAcceptCards method DeckClass, MSG_DECK_TEST_ACCEPT_CARDS
test ds:[di].DI_deckAttrs, mask DA_WANTS_DRAG
jz endTest
mov ax, MSG_DECK_CHECK_DRAG_CAUGHT ;see if the drag area is in the
call ObjCallInstanceNoLock ;right place
endTest:
;;the carry bit will now be set if the deck will accept the cards
ret
DeckTestAcceptCards endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckTestRightCard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_TEST_RIGHT_CARD handler for DeckClass
Checks to see if the deck would accept the drag set from
the passed deck (i.e., see if the catch card of this
deck would take the drop card fom the drag deck).
CALLED BY:
PASS: ^lcx:dx = dragging deck
CHANGES: nothing
RETURN: carry set if deck will accept card
carry clear else
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckTestRightCard method DeckClass, MSG_DECK_TEST_RIGHT_CARD
push cx,dx
mov ax, MSG_DECK_GET_COMPARISON_KIT ;get the info needed to
call ObjCallInstanceNoLock ;check for acceptance
pop cx,dx
FALL_THRU Test4RightCard
DeckTestRightCard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Test4RightCard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks to see whether a deck has the appropriate catch card
to take the drag from the dragging deck.
CALLED BY:
PASS: *ds:si = deck object
^lcx:dx = potential donor deck
bp = ComparisonKit of *ds:si deck
CHANGES:
RETURN: carry set if the deck's catch card would catch the dragging
deck's drag card
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 8/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
Test4RightCard proc far
class DeckClass
;
; if there is a restriction on the number of cards that
; a deck can catch at any one time (such as the case of
; klondike's foundations, which only accept a drag of
; size one), then we must check that here.
;
test bp, mask CAC_SINGLE_CARD_ONLY shl offset CK_CAC
jz testSuit
;
; We want to access data from the deck at ^lcx:dx, so we'll
; lock its block, get the info, then swap back out.
;
mov bx, cx ;bx <- block handle of dragger
call ObjSwapLock ;ds <- segment of dragger,
;bx <- block handle of the
; deck we're checking
mov di, dx
mov di, ds:[di]
add di, ds:[di].Deck_offset
cmp ds:[di].DI_nDragCards, 1
call ObjSwapLock ;restore ds to original segment
;(flags preserved).
jne returnCarry ;carry clear if cmp <>, so
;we return it
;
; Test the cards for suit compatibility
;
testSuit:
push bp ;save Kit
CallObjectCXDX MSG_DECK_GET_DROP_CARD_ATTRIBUTES, MF_CALL ;bp <- dropAttr
pop bx ;bx <- Kit
push bx, bp ;save Kit,
;CardAttrs of
;drop card
call TestSuit
pop bx, bp
jnc returnCarry ;if suit is
;wrong, then
;the cards
;do not match
;testRank:
call TestRank ;at this point, it all rides
;on TestRank, so we'll return
;whatever it returns
returnCarry:
ret
Test4RightCard endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TestSuit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks to see whether a drop card would be suit-wise
accepted according to a ComparisonKit
CALLED BY:
PASS: bp = CardAttrs of the drop card
bx = ComparisonKit of catch deck
CHANGES:
RETURN: carry set if drop card is suit-wise compatible with the
ComparisonKit
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
maybe could be done more efficiently when testing
same/opposite color
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TestSuit proc near
mov dx, bx ;dx <- acceptor ComparisonKit
ANDNF dx, mask CAC_SAC shl offset CK_CAC ;filter thru SAC
cmp dx, SAC_ANY_SUIT shl (offset CAC_SAC + offset CK_CAC)
je returnTrue ;if any suit will
;do, then we return
;true
ANDNF bp, mask CA_SUIT ;filter dropsuit
mov cl, offset CK_TOP_CARD
shr bx, cl ;bx <- topcard
ANDNF bx, mask CA_SUIT ;filter suit
cmp dx, SAC_SAME_SUIT shl (offset CAC_SAC + offset CK_CAC)
je testSameSuit
ANDNF bp, CS_CLUBS shl offset CA_SUIT ;filter black bit
ANDNF bx, CS_CLUBS shl offset CA_SUIT ;filter black bit
cmp dx, SAC_OPPOSITE_COLOR shl (offset CAC_SAC + offset CK_CAC)
je testOppositeColor
;testSameColor:
cmp bx,bp
je returnTrue
jmp returnFalse
testOppositeColor:
cmp bx, bp
jne returnTrue
jmp returnFalse
testSameSuit:
cmp bx,bp
je returnTrue
returnFalse:
clc
jmp endTestSuit
returnTrue:
stc
endTestSuit:
ret
TestSuit endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TestRank
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks to see whether a drop card would be rank-wise
accepted according to a ComparisonKit
CALLED BY:
PASS: bp = CardAttrs of the drop card
bx = ComparisonKit of catch deck
CHANGES:
RETURN: carry set if drop card is rank-wise compatible with the
ComparisonKit
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TestRank proc near
mov dx, bx ;dx <- acceptor comparison kit
ANDNF bp, mask CA_RANK ;filter thru droprank
mov cl, offset CA_RANK
shr bp, cl
ANDNF dx, mask CAC_RAC shl offset CK_CAC
cmp dx, RAC_ABSOLUTE_RANK shl (offset CAC_RAC + offset CK_CAC)
je absoluteRank
;relativeRank:
ANDNF bx, mask CA_RANK shl offset CK_TOP_CARD
mov cl, offset CA_RANK + offset CK_TOP_CARD
shr bx, cl
dec bx
cmp dx, RAC_ONE_LESS_RANK shl (offset CAC_RAC + offset CK_CAC)
je compare
inc bx
cmp dx, RAC_EQUAL_RANK shl (offset CAC_RAC + offset CK_CAC)
je compare
inc bx
jmp compare
absoluteRank:
ANDNF bx, mask CAC_RANK shl offset CK_CAC
mov cl, offset CAC_RANK + offset CK_CAC
shr bx, cl
cmp bx, CR_WILD
je returnTrue
compare:
cmp bx, bp
je returnTrue
;returnFalse:
clc
jmp endTestRank
returnTrue:
stc
endTestRank:
ret
TestRank endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckGetRidOfCards
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_GET_RID_OF_CARDS handler for DeckClass
Pops all the deck's cards to another deck.
CALLED BY:
PASS: ds:di = deck instance
^lcx:dx = deck to receive cards
CHANGES:
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckGetRidOfCards method DeckClass, MSG_DECK_GET_RID_OF_CARDS
mov bp, ds:[di].DI_popPoints
push bp
clr ds:[di].DI_popPoints
call ObjMarkDirty
mov ax, MSG_DECK_POP_ALL_CARDS
call ObjCallInstanceNoLock
Deref_DI Deck_offset
pop ds:[di].DI_popPoints
call ObjMarkDirty
ret
DeckGetRidOfCards endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckTransferAllCards
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_TRANSFER_ALL_CARDS handler for DeckClass
Transfers all of a deck's cards to another deck. Relative
order of the cards is preserved.
CALLED BY:
PASS: ds:di = deck instance
*ds:si = instance data of deck
^lcx:dx = instance of VisCompClass to receive the cards
(usually another Deck)
CHANGES: Deck's cards transferred to deck in ^lcx:dx
RETURN: nothing
DESTROYED: ax, bp, di
PSEUDO CODE/STRATEGY:
calls TransferNCards with n = total # of cards
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckTransferAllCards method DeckClass, MSG_DECK_TRANSFER_ALL_CARDS
mov bp, ds:[di].DI_nCards ;set bp = all cards
mov ax, MSG_DECK_TRANSFER_N_CARDS ;and transfer them
call ObjCallInstanceNoLock
ret
DeckTransferAllCards endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckTransferDraggedCards
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_TRANSFER_DRAGGED_CARDS handler for DeckClass
Transfers the deck's drag cards (if any) to another deck.
CALLED BY:
PASS: ds:di = deck instance
*ds:si = instance data of deck
^lcx:dx = deck to which to transfer the cards
CHANGES: deck *ds:si transfers its cards to deck ^lcx:dx
RETURN: nothing
DESTROYED: ax, bp, cx, dx
PSEUDO CODE/STRATEGY:
forwards the call to MSG_DECK_TRANSFER_N_CARDS, setting N to
the number of dragged cards
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckTransferDraggedCards method DeckClass, MSG_DECK_TRANSFER_DRAGGED_CARDS
mov ax, MSG_GAME_TRANSFERRING_CARDS
call VisCallParent ;notify the game
mov bp, ds:[di].DI_nDragCards ;set bp = # drag cards
mov ax, MSG_DECK_TRANSFER_N_CARDS ;and transfer them
call ObjCallInstanceNoLock
ret
DeckTransferDraggedCards endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckTransferNCards
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_TRANSFER_N_CARDS handler for DeckClass
Transfers a specified number of cards to another deck.
CALLED BY: DeckTransferAllCards, DeckTransferDragCards, etc.
PASS: ds:di = deck instance
*ds:si = instance data of deck
bp = number of cards to transfer
^lcx:dx = instance of VisCompClass to receive the cards
(usually another Deck)
CHANGES: The top bp cards of deck at *ds:si are transferred
to the top of deck at ^lcx:dx. The order of the cards is
preserved.
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp
PSEUDO CODE/STRATEGY:
loops bp times, popping cards (starting with the bp'th, ending
with the top)from the donor and pushing them to the
recipient
KNOWN BUGS/IDEAS:
*WARNING*
A deck must never transfer to itself.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckTransferNCards method DeckClass, MSG_DECK_TRANSFER_N_CARDS
push cx,dx,bp
mov ds:[di].DI_lastRecipient.handle, cx
mov ds:[di].DI_lastRecipient.chunk, dx
mov ds:[di].DI_lastGift, bp
call ObjMarkDirty
mov ax, MSG_GAME_SET_DONOR
call DeckCallParentWithSelf
pop cx,dx,bp
startDeckTransferNCards:
dec bp ;see if we're done
tst bp
jl endDeckTransferNCards
push bp ;save count
push cx, dx ;save OD of recipient
clr cx ;cx:dx <- # of child
mov dx, bp ;to remove
mov ax, MSG_DECK_REMOVE_NTH_CARD
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjCallInstanceNoLock ;^lcx:dx <- OD of card
mov bp, si ;save donor offset
pop bx,si ;restore recipient OD
push bp ;push donor offset
push bx,si
mov ax, MSG_DECK_PUSH_CARD ;give card to recipient
mov di, mask MF_FIXUP_DS
call ObjMessage
pop cx, dx
pop si ;restore donor offset
pop bp ;restore count
jmp startDeckTransferNCards
endDeckTransferNCards:
ret
DeckTransferNCards endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckUpdateDrag
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_UPDATE_DRAG handler for DeckClass
Updates the deck's drag instance data to reflect a new
mouse position.
CALLED BY: various
PASS: ds:di = deck instance
*ds:si = instance data of deck
cx,dx = new mouse position
CHANGES: DI_prevLeft and DI_prevTop to reflect new mouse position
RETURN: cx,dx = new prevLeft, new prevTop
ax,bp = old prevLeft, old prevTop
DESTROYED: ax, bp, cx, dx
PSEUDO CODE/STRATEGY:
subtract the drag offsets from cx,dx to turn them from mouse
positions to left,top of drag area
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckUpdateDrag method DeckClass, MSG_DECK_UPDATE_DRAG
sub cx, ds:[di].DI_dragOffsetX ;cx <- new left drag bound
sub dx, ds:[di].DI_dragOffsetY ;dx <- new top drag bound
mov ax, ds:[di].DI_prevLeft ;ax <- old left drag bound
mov bp, ds:[di].DI_prevTop ;bp <- old top drag bound
mov ds:[di].DI_prevLeft, cx
mov ds:[di].DI_prevTop, dx
call ObjMarkDirty
ret
DeckUpdateDrag endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckUpdateTopLeft
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_UPDATE_TOPLEFT handler for DeckClass
Sets the instance data indicating the position of the deck's
top card, and also resizes the deck to make a tight fit
around its cards.
CALLED BY:
PASS: *ds:si = instance data of deck
CHANGES: if deck has children:
DI_topCard(Left,Top) are set to Left,Top of top child
deck's Right,Bottom match Right,Bottom of top card
if deck doesn't have children:
DI_topCard(Left,Top) are set to Left,Top of deck
deck is resized to the size of one card
RETURN: nothing
DESTROYED: ax, bp, cx, dx, di
PSEUDO CODE/STRATEGY:
checks to see if deck has a card
if so:
gets bounds of top card
sets DI_topCard(Left,Top)
sets right,bottom vis bounds to deck
if not:
gets own bounds
sets DI_topCard(Left,Top)
KNOWN BUGS/IDEAS:
This method assumes (and the assumption is general over a
large portion of the cards library) that overlapping cards
go left -> right, top -> bottom. This should really by made
more general.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckUpdateTopLeft method DeckClass, MSG_DECK_UPDATE_TOPLEFT
clr cx
clr dx
mov ax, MSG_VIS_FIND_CHILD ;find first child
call ObjCallInstanceNoLock
jc noTopCard ;if no children, jump
;yesTopCard:
CallObjectCXDX MSG_VIS_GET_BOUNDS, MF_CALL ;get top card's bounds
Deref_DI Deck_offset
mov ds:[di].DI_topCardLeft, ax ;set DI_topCardLeft to
;left of top card
mov ds:[di].DI_topCardTop, bp ;set DI_topCardTop to
;top of top card
Deref_DI Vis_offset
mov ds:[di].VI_bounds.R_right, cx ;set right,bottom of
mov ds:[di].VI_bounds.R_bottom, dx ;deck to right,bottom
;of top card
call ObjMarkDirty
jmp endDeckUpdateTopLeft
noTopCard:
mov cx, VUQ_CARD_DIMENSIONS
mov ax, MSG_VIS_VUP_QUERY
call VisCallParent
push cx, dx
mov ax, MSG_VIS_GET_BOUNDS ;if no card, use self
call ObjCallInstanceNoLock ; bounds
Deref_DI Deck_offset
mov ds:[di].DI_topCardLeft, ax
mov ds:[di].DI_topCardTop, bp
call ObjMarkDirty
pop cx, dx
mov ax, MSG_VIS_SET_SIZE
call ObjCallInstanceNoLock
endDeckUpdateTopLeft:
ret
DeckUpdateTopLeft endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckReturnCards
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_RETURN_CARDS handler for DeckClass
Gives a specified # of cards to a specified deck, and
fixes things up visually. Used primarily for UNDO.
CALLED BY:
PASS: *ds:si = deck object
^lcx:dx = deck to give cards to
bp = # of cards to give
CHANGES:
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckReturnCards method DeckClass, MSG_DECK_RETURN_CARDS
.enter
;
; since the deck will soon be changing, we want to invalidate
; its screen area now instead of after the change
;
push cx,dx,bp
mov ax, MSG_VIS_INVALIDATE
call ObjCallInstanceNoLock
pop cx,dx,bp
;
; give the cards back to ^lcx:dx
;
mov ax, MSG_DECK_TRANSFER_N_CARDS
call ObjCallInstanceNoLock
;
; Make the top card fully sized again
;
mov ax, MSG_CARD_MAXIMIZE
call VisCallFirstChild
.leave
ret
DeckReturnCards endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckRetrieveCards
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_RETRIEVE_CARDS handler for DeckClass.
Retrieves the last set of cards that were given to another
deck. Used for UNDO
CALLED BY:
PASS: ds:di = deck instance
*ds:si = deck object
CHANGES:
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckRetrieveCards method DeckClass, MSG_DECK_RETRIEVE_CARDS
mov cx, ds:[LMBH_handle]
mov dx, si
mov bx, ds:[di].DI_lastRecipient.handle
mov si, ds:[di].DI_lastRecipient.chunk
mov bp, ds:[di].DI_lastGift
mov ax, MSG_DECK_RETURN_CARDS
mov di, mask MF_FIXUP_DS
GOTO ObjMessage
DeckRetrieveCards endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckDownCardSelected
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_DOWN_CARD_SELECTED handler for DeckClass
CALLED BY: CardStartSelect
PASS: *ds:si = deck object
bp = # of selected child in composite
CHANGES: if card is top card, turns it face up
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
make sure card is top card
if so, turn it face up
redraw it.
KNOWN BUGS/IDEAS:
don't know if the call to MSG_DECK_UPDATE_TOPLEFT does anything
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckDownCardSelected method DeckClass, MSG_DECK_DOWN_CARD_SELECTED
tst bp ;see if bp = first child
jnz endDeckDownCardSelected ;do nothing unless top card
mov ax, MSG_CARD_FLIP_CARD
call ObjCallInstanceNoLock
mov ax, MSG_DECK_UPDATE_TOPLEFT ;update top left
call ObjCallInstanceNoLock
Deref_DI Deck_offset
mov dx, ds:[di].DI_flipPoints
tst dx
jz afterScore
clr cx
mov ax, MSG_GAME_UPDATE_SCORE
call VisCallParent
afterScore:
mov dl, VUM_NOW
mov ax, MSG_GAME_DISABLE_UNDO
call VisCallParent
endDeckDownCardSelected:
ret
DeckDownCardSelected endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckGetDealt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_GET_DEALT handler for DeckClass
CALLED BY: HandDeal
PASS: *ds:si = deck object
^lcx:dx = card to add
CHANGES:
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
send self MSG_DECK_MOVE_AND_CLIP to prepare for the new card
add the card
set the card drawable
get card's attributes
if card is face up, fade it in
if card is face down, just draw it
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckGetDealt method DeckClass, MSG_DECK_GET_DEALT
push cx,dx ;save card OD
mov ax, MSG_DECK_MOVE_AND_CLIP ;get ready for new card
call ObjCallInstanceNoLock
pop cx,dx ;restore card OD
push cx, dx ;save card OD
mov ax, MSG_DECK_ADD_CARD_FIRST ;add the card
call ObjCallInstanceNoLock
pop bx, si ;^lbx:si <- card OD
mov ax, MSG_CARD_SET_DRAWABLE ;set card drawable
mov di, mask MF_FIXUP_DS
call ObjMessage
mov ax, MSG_CARD_GET_ATTRIBUTES ;get card's attributes
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage
mov ax, MSG_CARD_NORMAL_REDRAW ;normal redraw for face down
test bp, mask CA_FACE_UP
jz redraw
mov ax, MSG_CARD_FADE_REDRAW ;fade in for face up
redraw:
mov di, mask MF_FIXUP_DS
call ObjMessage
ret
DeckGetDealt endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckSetupDrag
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_SETUP_DRAG handler for DeckClass
Prepares the deck's drag instance data for dragging.
CALLED BY:
PASS: *ds:si = deck object
cx,dx = mouse position
bp = # of children to drag
CHANGES: fills in some drag data
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckSetupDrag method DeckClass, MSG_DECK_SETUP_DRAG
push cx,dx ;save mouse position
push bp
mov ax, MSG_VIS_GET_BOUNDS
call ObjCallInstanceNoLock
Deref_DI Deck_offset
mov ds:[di].DI_initRight, cx
mov ds:[di].DI_initBottom, dx
pop bp
mov cx, VUQ_CARD_DIMENSIONS
mov ax, MSG_VIS_VUP_QUERY
call VisCallParent
push dx
Deref_DI Deck_offset
mov ds:[di].DI_nDragCards, bp
dec bp ;bp <- # drag cards - 1
push bp ;save # drag cards - 1
mov ax, ds:[di].DI_offsetFromUpCardX ;ax <- horiz. offset
mul bp ;ax <- offset * #cards
; = total offset
add cx, ax
mov ds:[di].DI_dragWidth, cx ;dragWidth =
;cardWidth + tot.offset
mov cx, ds:[di].DI_topCardLeft
sub cx,ax ;cx <- left drag bound
mov ds:[di].DI_prevLeft, cx
mov ds:[di].DI_initLeft, cx
pop ax
mul ds:[di].DI_offsetFromUpCardY
pop dx
add dx, ax
mov ds:[di].DI_dragHeight, dx ;dragHeight =
;cardHeight + offset
mov dx, ds:[di].DI_topCardTop
sub dx,ax ;dx <- top drag bound
mov ds:[di].DI_prevTop, dx
mov ds:[di].DI_initTop, dx
pop ax,bx ;restore mouse position
sub ax, cx ;get offset from mouse
mov ds:[di].DI_dragOffsetX, ax ;left to drag left
sub bx, dx ;get offset from mouse
mov ds:[di].DI_dragOffsetY, bx ;top to drag top
call ObjMarkDirty
ret
DeckSetupDrag endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckUpCardSelected
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_UP_CARD_SELECTED handler for DeckClass
This method determines the number of cards that will
be dragged as a result of this card selection
CALLED BY: CardStartSelect
PASS: *ds:si = deck object
cx,dx = mouse
bp = # of card selected
CHANGES:
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 7/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckUpCardSelected method DeckClass, MSG_DECK_UP_CARD_SELECTED
;
; Our first task is to load cx with:
;
; ch = # of selected card in composite
; cl = low 8 bits of selected CardAttrs, which contains
; info on rank and suit
;
push cx,dx ;stack-> mouseX,mouseY
push bp ;stack-> # selected
; mouseX, mouseY
mov ax, MSG_CARD_GET_ATTRIBUTES
call DeckCallNthChild
mov cx, bp ;cl <- selected attrs
pop dx ;dx <- selected #
;stack-> mouseX, mouseY
mov ch, dl ;ch <- selected #
push cx ;stack-> selected card
; mouseX, mouseY
clr dx
;
; Now we're going to go through our cards, starting with the
; first card, and find out which ones want to be dragged.
;
startLoop:
;
; We want to load:
;
; dh = # of card we're checking for dragability in composite
; (so that we can compare its place with that of
; the selected card)
;
; dl = low 8 bits of CardAttrs of card we're examining (so we
; can check things like face up, etc.)
;
push dx ;stack-> # of card examining
; selected card
; mouseX, mouseY
mov bp, dx
mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES
call ObjCallInstanceNoLock
jc endLoop
mov dx, bp ;dl <- nth card attrs
pop cx ;cx <- # of card examining
;stack-> selected card
; mouseX, mouseY
mov dh, cl ;dh <- n
pop cx ;cx <- selected card
;stack-> mouseX, mouseY
push cx
Deref_DI Deck_offset
mov al, ds:[di].DI_deckAttrs
clr ah
mov bp, ax
;
; Make the query on whether or not the examined card should
; be dragged.
;
mov ax, MSG_GAME_QUERY_DRAG_CARD
call VisCallParent
mov dl, dh
mov dh, 0
push dx
jnc endLoop ;if we don't want to drag this one,
;then screw all the rest, too.
;doDrag:
pop dx
inc dx
; push dx
jmp startLoop
endLoop:
pop bp
add sp, 2
pop cx,dx
tst bp
jz endDeckUpCardSelected
mov ax, MSG_DECK_DRAGGABLE_CARD_SELECTED
call ObjCallInstanceNoLock
endDeckUpCardSelected:
ret
DeckUpCardSelected endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckGetComparisonKit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_GET_COMPARISION_KIT handler for DeckClass.
Returns the comparison kit for this deck (see definition
of ComparisonKit).
CALLED BY:
PASS: *ds:si = deck object
CHANGES:
RETURN: bp = ComparisonKit for this deck
DESTROYED: ax, bx, cx, dx, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckGetComparisonKit method DeckClass, MSG_DECK_GET_COMPARISON_KIT
clr bp
mov ax, MSG_CARD_GET_ATTRIBUTES
call VisCallFirstChild
Deref_DI Deck_offset
tst bp
jz noCard
mov dx, bp
mov cl, offset CK_TOP_CARD
shl dx, cl
test bp, mask CA_FACE_UP
jz faceDown
;faceUp:
mov bp, ds:[di].DI_upCardAC
jmp makeKit
faceDown:
mov bp, ds:[di].DI_downCardAC
jmp makeKit
noCard:
mov bp, ds:[di].DI_noCardAC
clr dx
makeKit:
mov cl, offset CK_CAC
shl bp, cl
ORNF bp, dx
ret
DeckGetComparisonKit endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckSetPoints
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_SET_POINTS handler for DeckClass
Sets the # of points awarded/penalized for pushing,
popping, and turning cards in this deck
CALLED BY:
PASS: ds:di = deck instance
*ds:si = deck object
cx = points awarded for pushing a card to this deck
dx = points awarded for popping a card from this deck
bp = points awarded for flipping over a card in this deck
CHANGES:
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckSetPoints method DeckClass, MSG_DECK_SET_POINTS
mov ds:[di].DI_pushPoints, cx
mov ds:[di].DI_popPoints, dx
mov ds:[di].DI_flipPoints, bp
call ObjMarkDirty
ret
DeckSetPoints endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckSetUpSpreads
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_SET_UP_SPREADS handler for DeckClass
CALLED BY:
PASS: ds:di = deck instance
cx, dx = x,y spreads for face up cards
RETURN: nothing
DESTROYED: nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 27 nov 1992 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckSetUpSpreads method dynamic DeckClass, MSG_DECK_SET_UP_SPREADS
.enter
mov ds:[di].DI_offsetFromUpCardX, cx
mov ds:[di].DI_offsetFromUpCardY, dx
call ObjMarkDirty
.leave
ret
DeckSetUpSpreads endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckSetDownSpreads
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_SET_DOWN_SPREADS handler for DeckClass
CALLED BY:
PASS: ds:di = deck instance
cx, dx = x,y spreads for face down cards
RETURN: nothing
DESTROYED: nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 27 nov 1992 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckSetDownSpreads method dynamic DeckClass, MSG_DECK_SET_DOWN_SPREADS
.enter
mov ds:[di].DI_offsetFromDownCardX, cx
mov ds:[di].DI_offsetFromDownCardY, dx
call ObjMarkDirty
.leave
ret
DeckSetDownSpreads endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckSetAttrs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sets deck's attrs to value passed
CALLED BY:
PASS: ds:di = deck instance
*ds:si = deck object
cl = DeckAttrs
CHANGES:
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckSetAttrs method DeckClass, MSG_DECK_SET_ATTRS
mov ds:[di].DI_deckAttrs, cl
call ObjMarkDirty
ret
DeckSetAttrs endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckMove
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_VIS_SET_POSITION handler for DeckClass
Moves the deck's vis bounds and sets DI_topCardLeft
and DI_topCardTop to the new location (the assumption
is that the deck has no cards when you move it).
CALLED BY:
PASS: cx, dx = horizontal, vertical displacements
CHANGES:
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 12/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckMove method DeckClass, MSG_VIS_SET_POSITION
call VisSetPosition
Deref_DI Deck_offset
mov ds:[di].DI_topCardLeft, cx
mov ds:[di].DI_topCardTop, dx
call ObjMarkDirty
ret
DeckMove endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckChangeKidsBacks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_CHANGE_KIDS_BACKS handler for DeckClass
Marks any face down children as dirty, indicating that
their bitmap has changed.
CALLED BY:
PASS: *ds:si = deck object
CHANGES:
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckChangeKidsBacks method DeckClass, MSG_DECK_CHANGE_KIDS_BACKS
mov ax, MSG_CARD_MARK_DIRTY_IF_FACE_DOWN
call VisSendToChildren
ret
DeckChangeKidsBacks endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckSprayCards
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: MSG_DECK_SPRAY_CARDS handler for DeckClass
Creates cool card fan visual effect with the cards in this
deck.
CALLED BY:
PASS: ds:di = deck instance
*ds:si = deck object
bp = gstate (ready for first card)
cx = distance from origin along y-axis to draw cards (radius of
the fan)
dx = # degrees to rotate the gstate after each card is drawn
CHANGES:
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckSprayCards method DeckClass, MSG_DECK_SPRAY_CARDS
mov bx, ds:[di].DI_nCards
neg cx ;cx <- -length
startLoop:
dec bx ;test for more cards
js done
xchg bx, dx ;dx<-# kid, bx <-angle
push dx ;save #
push si ;save deck offset
push cx, bp ;save -length. gstate
clr cx
mov ax, MSG_VIS_FIND_CHILD
call ObjCallInstanceNoLock
jnc callChild
add sp, 8
jmp done
callChild:
mov si, dx ;si <- card offset
mov dx, bx ;dx <- angle
mov bx, cx ;bx <- card handle
pop cx, bp ;cx <- -length, gstate
mov ax, MSG_CARD_SPRAY_DRAW
mov di, mask MF_FIXUP_DS or mask MF_FORCE_QUEUE
call ObjMessage
pop si ;si <- deck offset
pop bx ;bx <- kid #
jmp startLoop
done:
ret
DeckSprayCards endm
DeckGetNCards method DeckClass, MSG_DECK_GET_N_CARDS
mov cx, ds:[di].DI_nCards
ret
DeckGetNCards endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckCallNthChild
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Common routine to find the deck's Nth child and send a
method to it.
CALLED BY:
PASS: bp = Nth child
ax = method number to send to Nth child
*ds:si = deck object
cx,dx = arguments to pass to card
CHANGES:
RETURN: carry set if Nth child was not found
carry returned from method if child was found
DESTROYED: bp, cx, dx, di
PSEUDO CODE/STRATEGY:
search for nth card
if found, send the method
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 10/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckCallNthChild proc near
;
; get the OD of the nth card
;
push si
push ax, cx, dx
mov dx, bp
clr cx
mov ax, MSG_VIS_FIND_CHILD
call ObjCallInstanceNoLock
pop ax, bx, si
jc afterCall
xchg bx, cx
xchg si, dx
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage
afterCall:
pop si
ret
DeckCallNthChild endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeckCallParentWithSelf
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Loads the deck's OD into cx:dx and calls the deck's paren
with the passed method.
CALLED BY:
PASS: *ds:si = deck object
ax = method number for parent
bp = additional data to pass to parent
CHANGES:
RETURN: return values from parent method handler
DESTROYED: bp, cx, dx,
PSEUDO CODE/STRATEGY:
KNOWN BUGS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 12/19/90 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeckCallParentWithSelf proc near
mov cx, ds:[LMBH_handle]
mov dx, si
call VisCallParent
ret
DeckCallParentWithSelf endp
CardsCodeResource ends
|
source/amf/uml/amf-uml-loop_nodes.ads | svn2github/matreshka | 24 | 13199 | <reponame>svn2github/matreshka<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 loop node is a structured activity node that represents a loop with
-- setup, test, and body sections.
------------------------------------------------------------------------------
limited with AMF.UML.Executable_Nodes.Collections;
limited with AMF.UML.Input_Pins.Collections;
limited with AMF.UML.Output_Pins.Collections;
with AMF.UML.Structured_Activity_Nodes;
package AMF.UML.Loop_Nodes is
pragma Preelaborate;
type UML_Loop_Node is limited interface
and AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node;
type UML_Loop_Node_Access is
access all UML_Loop_Node'Class;
for UML_Loop_Node_Access'Storage_Size use 0;
not overriding function Get_Body_Output
(Self : not null access constant UML_Loop_Node)
return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is abstract;
-- Getter of LoopNode::bodyOutput.
--
-- A list of output pins within the body fragment the values of which are
-- moved to the loop variable pins after completion of execution of the
-- body, before the next iteration of the loop begins or before the loop
-- exits.
not overriding function Get_Body_Part
(Self : not null access constant UML_Loop_Node)
return AMF.UML.Executable_Nodes.Collections.Set_Of_UML_Executable_Node is abstract;
-- Getter of LoopNode::bodyPart.
--
-- The set of nodes and edges that perform the repetitive computations of
-- the loop. The body section is executed as long as the test section
-- produces a true value.
not overriding function Get_Decider
(Self : not null access constant UML_Loop_Node)
return AMF.UML.Output_Pins.UML_Output_Pin_Access is abstract;
-- Getter of LoopNode::decider.
--
-- An output pin within the test fragment the value of which is examined
-- after execution of the test to determine whether to execute the loop
-- body.
not overriding procedure Set_Decider
(Self : not null access UML_Loop_Node;
To : AMF.UML.Output_Pins.UML_Output_Pin_Access) is abstract;
-- Setter of LoopNode::decider.
--
-- An output pin within the test fragment the value of which is examined
-- after execution of the test to determine whether to execute the loop
-- body.
not overriding function Get_Is_Tested_First
(Self : not null access constant UML_Loop_Node)
return Boolean is abstract;
-- Getter of LoopNode::isTestedFirst.
--
-- If true, the test is performed before the first execution of the body.
-- If false, the body is executed once before the test is performed.
not overriding procedure Set_Is_Tested_First
(Self : not null access UML_Loop_Node;
To : Boolean) is abstract;
-- Setter of LoopNode::isTestedFirst.
--
-- If true, the test is performed before the first execution of the body.
-- If false, the body is executed once before the test is performed.
not overriding function Get_Loop_Variable
(Self : not null access constant UML_Loop_Node)
return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is abstract;
-- Getter of LoopNode::loopVariable.
--
-- A list of output pins that hold the values of the loop variables during
-- an execution of the loop. When the test fails, the values are movied to
-- the result pins of the loop.
not overriding function Get_Loop_Variable_Input
(Self : not null access constant UML_Loop_Node)
return AMF.UML.Input_Pins.Collections.Ordered_Set_Of_UML_Input_Pin is abstract;
-- Getter of LoopNode::loopVariableInput.
--
-- A list of values that are moved into the loop variable pins before the
-- first iteration of the loop.
not overriding function Get_Result
(Self : not null access constant UML_Loop_Node)
return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is abstract;
-- Getter of LoopNode::result.
--
-- A list of output pins that constitute the data flow output of the
-- entire loop.
not overriding function Get_Setup_Part
(Self : not null access constant UML_Loop_Node)
return AMF.UML.Executable_Nodes.Collections.Set_Of_UML_Executable_Node is abstract;
-- Getter of LoopNode::setupPart.
--
-- The set of nodes and edges that initialize values or perform other
-- setup computations for the loop.
not overriding function Get_Test
(Self : not null access constant UML_Loop_Node)
return AMF.UML.Executable_Nodes.Collections.Set_Of_UML_Executable_Node is abstract;
-- Getter of LoopNode::test.
--
-- The set of nodes, edges, and designated value that compute a Boolean
-- value to determine if another execution of the body will be performed.
end AMF.UML.Loop_Nodes;
|
oeis/103/A103976.asm | neoneye/loda-programs | 11 | 885 | ; A103976: Partial sums of A040976 (= primes-2).
; Submitted by <NAME>
; 0,1,4,9,18,29,44,61,82,109,138,173,212,253,298,349,406,465,530,599,670,747,828,915,1010,1109,1210,1315,1422,1533,1658,1787,1922,2059,2206,2355,2510,2671,2836,3007,3184,3363,3552,3743,3938,4135,4344,4565,4790,5017,5248
mov $2,$0
seq $0,101301 ; The sum of the first n primes, minus n.
sub $0,$2
sub $0,1
|
programs/oeis/024/A024219.asm | neoneye/loda | 22 | 94943 | ; A024219: a(n) = floor( (2nd elementary symmetric function of S(n))/(first elementary symmetric function of S(n)) ), where S(n) = {first n+1 positive integers congruent to 1 mod 3}.
; 0,3,7,12,19,28,38,49,62,77,93,110,129,150,172,195,220,247,275,304,335,368,402,437,474,513,553,594,637,682,728,775,824,875,927,980,1035,1092,1150,1209,1270,1333,1397,1462,1529,1598,1668,1739,1812,1887,1963,2040,2119,2200,2282,2365,2450,2537,2625,2714,2805,2898,2992,3087,3184,3283,3383,3484,3587,3692,3798,3905,4014,4125,4237,4350,4465,4582,4700,4819,4940,5063,5187,5312,5439,5568,5698,5829,5962,6097,6233,6370,6509,6650,6792,6935,7080,7227,7375,7524
add $0,2
mov $1,$0
mul $1,6
sub $1,10
mul $0,$1
div $0,8
|
libsrc/_DEVELOPMENT/adt/w_array/z80/asm_w_array_size.asm | jpoikela/z88dk | 640 | 25197 |
; ===============================================================
; Mar 2014
; ===============================================================
;
; size_t w_array_size(w_array_t *a)
;
; Return the array's current size in words.
;
; ===============================================================
SECTION code_clib
SECTION code_adt_w_array
PUBLIC asm_w_array_size
EXTERN l_readword_2_hl
defc asm_w_array_size = l_readword_2_hl - 2
; enter : hl = array *
;
; exit : hl = size in words
;
; uses : a, hl
|
old/Cpp14Lexer.g4 | kaby76/scrape-c-plus-plus-spec | 1 | 5463 | lexer grammar Cpp14Lexer;
options { superClass=LexerBase; }
tokens { KWDefine, KWDefined, KWInclude, KWUndef, KWIfndef, KWIfdef, KWElse, KWEndif, KWIf, KWPragma, KWElif, KWLine, KWError, KWWarning, Newline }
KWGnuAttribute: '__attribute__';
KWAlignas: 'alignas';
KWAlignof: 'alignof'
// GNU
| '__alignof__'
;
KWAnd: 'and';
KWAndEq: 'and_eq';
KWAsm: 'asm'
// GNU
| '__asm__'
;
KWAuto: 'auto';
KWBitAnd: 'bitand';
KWBitOr: 'bitor';
KWBool: 'bool';
KWBreak: 'break';
KWCase: 'case';
KWCatch: 'catch';
KWChar16: 'char16_t';
KWChar32: 'char32_t';
KWChar: 'char';
KWClass: 'class';
KWCompl: 'compl';
KWConst: 'const';
KWConst_cast: 'const_cast';
KWConstexpr: 'constexpr';
KWContinue: 'continue';
KWDecltype: 'decltype';
KWDefault: 'default';
KWDelete: 'delete';
KWDo: 'do';
KWDouble: 'double';
KWDynamic_cast: 'dynamic_cast';
KWElse: 'else';
KWEnum: 'enum';
KWExplicit: 'explicit';
KWExport: 'export';
KWExtern: 'extern';
KWFalse_: 'false';
KWFinal: 'final';
KWFloat: 'float';
KWFor: 'for';
KWFriend: 'friend';
KWGoto: 'goto';
KWIf: 'if';
KWInline: 'inline';
KWInt: 'int';
KWLong: 'long';
KWMutable: 'mutable';
KWNamespace: 'namespace';
KWNew: 'new';
KWNoexcept: 'noexcept';
KWNot: 'not';
KWNotEq: 'not_eq';
KWNullptr: 'nullptr';
KWOperator: 'operator';
KWOr: 'or';
KWOrEq: 'or_eq';
KWOverride: 'override';
KWPrivate: 'private';
KWProtected: 'protected';
KWPublic: 'public';
KWRegister: 'register';
KWReinterpret_cast: 'reinterpret_cast';
KWReturn: 'return';
KWShort: 'short';
KWSigned: 'signed';
KWSizeof: 'sizeof';
KWStatic: 'static';
KWStatic_assert: 'static_assert';
KWStatic_cast: 'static_cast';
KWStruct: 'struct';
KWSwitch: 'switch';
KWTemplate: 'template';
KWThis: 'this';
KWThread_local: 'thread_local';
KWThrow: 'throw';
KWTrue_: 'true';
KWTry: 'try';
KWTypedef: 'typedef';
KWTypeid_: 'typeid'
// GNU
| '__typeof__'
| '__typeof'
;
KWTypename_: 'typename';
KWUnion: 'union';
KWUnsigned: 'unsigned';
KWUsing: 'using';
KWVirtual: 'virtual';
KWVoid: 'void';
KWVolatile: 'volatile';
KWWchar: 'wchar_t';
KWWhile: 'while';
KWXor: 'xor';
KWXorEq: 'xor_eq';
/*Operators*/
And: '&';
AndAnd: '&&';
AndAssign: '&=';
Arrow: '->';
ArrowStar: '->*';
Assign: '=';
Caret: '^';
Colon: ':';
ColonGt: ':>';
Comma: ',';
Div: '/';
DivAssign: '/=';
Dot: '.';
DotStar: '.*';
Doublecolon: '::';
Ellipsis: '...';
Equal: '==';
Greater: '>';
GreaterEqual: '>=';
LeftBrace: '{';
LeftBracket: '[';
LeftParen: '(';
LeftShift: '<<';
LeftShiftAssign: '<<=';
Less: '<';
LessEqual: '<=';
LtColon: '<:';
LtPer: '<%';
Minus: '-';
MinusAssign: '-=';
MinusMinus: '--';
Mod: '%';
ModAssign: '%=';
Not: '!';
NotEqual: '!=';
Or: '|';
OrAssign: '|=';
OrOr: '||';
PerColon: '%:';
PerColonPerColon: '%:%:';
PerGt: '%>';
Plus: '+';
PlusAssign: '+=';
PlusPlus: '++';
Pound: '#';
PoundPound: '##';
Question: '?';
RightBrace: '}';
RightBracket: ']';
RightParen: ')';
//RightShift: '>>';
RightShiftAssign: '>>=';
Semi: ';';
Star: '*';
StarAssign: '*=';
Tilde: '~';
XorAssign: '^=';
// namespace_alias : identifier ;
// class_name : identifier | simple_template_id ;
// enum_name : identifier ;
// template_name : identifier ;
// A.2 Lexical conventions [gram.lex]
fragment FHex_quad : FHexadecimal_digit FHexadecimal_digit FHexadecimal_digit FHexadecimal_digit ;
fragment FUniversal_character_name : '\\u' FHex_quad | '\\U' FHex_quad FHex_quad ;
Identifier : ( FIdentifier_nondigit ) ( FIdentifier_nondigit | FDigit ) * ;
fragment FIdentifier_nondigit : FNondigit | FUniversal_character_name ;
fragment FNondigit : 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '_' ;
fragment FDigit : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ;
Integer_literal : Binary_literal FInteger_suffix ? | Octal_literal FInteger_suffix ? | Decimal_literal FInteger_suffix ? | Hexadecimal_literal FInteger_suffix ? ;
Binary_literal : ( '0b' FBinary_digit | '0B' FBinary_digit ) ( '’' ? FBinary_digit ) * ;
Octal_literal : ( '0' ) ( '’' ? FOctal_digit ) * ;
Decimal_literal : ( FNonzero_digit ) ( '’' ? FDigit ) * ;
Hexadecimal_literal : ( '0x' FHexadecimal_digit | '0X' FHexadecimal_digit ) ( '’' ? FHexadecimal_digit ) * ;
fragment FBinary_digit : '0' | '1' ;
fragment FOctal_digit : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' ;
fragment FNonzero_digit : '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ;
fragment FHexadecimal_digit : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' ;
fragment FInteger_suffix : FUnsigned_suffix FLong_suffix ? | FUnsigned_suffix FLong_long_suffix ? | FLong_suffix FUnsigned_suffix ? | FLong_long_suffix FUnsigned_suffix ? ;
// § A.2 1212 c ISO/IEC N4296
fragment FUnsigned_suffix : 'u' | 'U' ;
fragment FLong_suffix : 'l' | 'L' ;
fragment FLong_long_suffix : 'll' | 'LL' ;
Character_literal : FEncoding_prefix ? '\'' FC_char_sequence '\'' ;
fragment FEncoding_prefix : 'u8' | 'u' | 'U' | 'L' ;
fragment FC_char_sequence : ( FC_char ) ( FC_char ) * ;
fragment FC_char : ~['\\r\n] | FEscape_sequence | FUniversal_character_name ;
fragment FEscape_sequence : FSimple_escape_sequence | FOctal_escape_sequence | FHexadecimal_escape_sequence ;
fragment FSimple_escape_sequence : '\\\'' | '\\"' | '\\?' | '\\\\' | '\\a' | '\\b' | '\\f' | '\\n' | '\\r' | '\\t' | '\\v' ;
fragment FOctal_escape_sequence : '\\' FOctal_digit | '\\' FOctal_digit FOctal_digit | '\\' FOctal_digit FOctal_digit FOctal_digit ;
fragment FHexadecimal_escape_sequence : ( '\\x' FHexadecimal_digit ) ( FHexadecimal_digit ) * ;
Floating_literal : FFractional_constant FExponent_part ? FFloating_suffix ? | FDigit_sequence FExponent_part FFloating_suffix ? ;
fragment FFractional_constant : FDigit_sequence ? '.' FDigit_sequence | FDigit_sequence '.' ;
fragment FExponent_part : 'e' FSign ? FDigit_sequence | 'E' FSign ? FDigit_sequence ;
fragment FSign : '+' | '-' ;
fragment FDigit_sequence : ( FDigit ) ( '\'' ? FDigit ) * ;
fragment FFloating_suffix : 'f' | 'l' | 'F' | 'L' ;
String_literal : FEncoding_prefix ? '"' FS_char_sequence ? '"' | FEncoding_prefix ? 'R' FRaw_string ;
// § A.2 1213 c ISO/IEC N4296
fragment FS_char_sequence : ( FS_char ) ( FS_char ) * ;
fragment FS_char : ~["\\\r\n] | FEscape_sequence | FUniversal_character_name ;
fragment FRaw_string : '"' FD_char_sequence ? '(' FR_char_sequence ? ')' FD_char_sequence ? '"' ;
fragment FR_char_sequence : ( FR_char ) ( FR_char ) * ;
fragment FR_char : ~[)"] ;
fragment FD_char_sequence : ( FD_char ) ( FD_char ) * ;
fragment FD_char : ~[ ()\\\r\n\t\u000B] ;
User_defined_literal : User_defined_integer_literal | User_defined_floating_literal | User_defined_string_literal | User_defined_character_literal ;
User_defined_integer_literal : Decimal_literal FUd_suffix | Octal_literal FUd_suffix | Hexadecimal_literal FUd_suffix | Binary_literal FUd_suffix ;
User_defined_floating_literal : FFractional_constant FExponent_part ? FUd_suffix | FDigit_sequence FExponent_part FUd_suffix ;
User_defined_string_literal : String_literal FUd_suffix ;
User_defined_character_literal : Character_literal FUd_suffix ;
fragment FUd_suffix : Identifier ;
WS : [\n\r\t ]+ -> channel(HIDDEN);
//Newline: [\n\r];
COMMENT : '//' ~[\n\r]* -> channel(HIDDEN);
ML_COMMENT : '/*' .*? '*/' -> channel(HIDDEN);
Prep : '#' ~[\n\r]* -> channel(HIDDEN);
mode PP;
PPCOMMENT : '//' ~[\n\r]* -> channel(HIDDEN);
PPML_COMMENT : '/*' .*? '*/' -> channel(HIDDEN);
PPKWAnd: 'and' -> type(KWAnd);
PPKWAndEq: 'and_eq' -> type(KWAndEq);
PPKWBitAnd: 'bitand' -> type(KWBitAnd);
PPKWBitOr: 'bitor' -> type(KWBitOr);
PPKWCompl: 'compl' -> type(KWCompl);
PPKWDefine: 'define' -> type(KWDefine);
PPKWDefined: 'defined' -> type(KWDefined);
PPKWDelete: 'delete' -> type(KWDelete);
PPKWElif: 'elif' -> type(KWElif);
PPKWElse: 'else' -> type(KWElse);
PPKWEndif: 'endif' -> type(KWEndif);
PPKWError: 'error' -> type(KWError);
PPKWWarning: 'warning' -> type(KWWarning);
PPKWFalse: 'false' -> type(KWFalse_);
PPKWTrue: 'true' -> type(KWTrue_);
PPKWIf: 'if' -> type(KWIf);
PPKWIfdef: 'ifdef' -> type(KWIfdef);
PPKWIfndef: 'ifndef' -> type(KWIfndef);
PPKWInclude: 'include' -> type(KWInclude);
PPKWLine: 'line' -> type(KWLine);
PPKWNew: 'new' -> type(KWNew);
PPKWNot: 'not' -> type(KWNot);
PPKWNotEq: 'not_eq' -> type(KWNotEq);
PPKWOr: 'or' -> type(KWOr);
PPKWOrEq: 'or_eq' -> type(KWOrEq);
PPKWPragma: 'pragma' -> type(KWPragma);
PPKWUndef: 'undef' -> type(KWUndef);
PPKWXor: 'xor' -> type(KWXor);
PPKWXorEq: 'xor_eq' -> type(KWXorEq);
fragment H_char_sequence : H_char+;
fragment H_char : ~[ <\t\n>] ;
fragment Q_char_sequence : Q_char+ ;
fragment Q_char : ~[ \t\n"] ;
Pp_number : ( FDigit | '.' FDigit ) ( FDigit | FIdentifier_nondigit | '\'' FDigit | '\'' FNondigit | 'e' FSign | 'E' FSign | '.' ) * -> type(Floating_literal) ;
Header_name : ( '<' H_char_sequence '>' | '"' Q_char_sequence '"' ) -> type(String_literal) ;
PPEOL: [\r\n]+ -> type(Newline);
PPWS : [\t ]+ -> channel(HIDDEN);
PPIdentifier : ( FIdentifier_nondigit ) ( FIdentifier_nondigit | FDigit ) * -> type(Identifier);
PPLeftBrace: '{' -> type(LeftBrace);
PPRightBrace: '}' -> type(RightBrace);
PPLeftBracket: '[' -> type(LeftBracket);
PPRightBracket: ']' -> type(RightBracket);
PPPoundPound: '##' -> type(PoundPound);
PPLeftParen: '(' -> type(LeftParen);
PPRightParen: ')' -> type(RightParen);
PPLtColon: '<:' -> type(LtColon);
PPColonGt: ':>' -> type(ColonGt);
PPLtPer: '<%' -> type(LtPer);
PPPerGt: '%>' -> type(PerGt);
PPPerColon: '%:' -> type(PerColon);
PPPerColonPerColon: '%:%:' -> type(PerColonPerColon);
PPSemi: ';' -> type(Semi);
PPColon: ':' -> type(Colon);
PPEllipsis: '...' -> type(Ellipsis);
PPPound: '#' -> type(Pound);
PPQuestion: '?' -> type(Question);
PPDoublecolon: '::' -> type(Doublecolon);
PPDot: '.' -> type(Dot);
PPDotStar: '.*' -> type(DotStar);
PPPlus: '+' -> type(Plus);
PPMinus: '-' -> type(Minus);
PPAssign: '=' -> type(Assign);
PPStar: '*' -> type(Star);
PPLess: '<' -> type(Less);
PPDiv: '/' -> type(Div);
PPGreater: '>' -> type(Greater);
PPMod: '%' -> type(Mod);
PPPlusAssign: '+=' -> type(PlusAssign);
PPTilde: '~' -> type(Tilde);
PPNot: '!' -> type(Not);
PPCaret: '^' -> type(Caret);
PPMinusAssign: '-=' -> type(MinusAssign);
PPAnd: '&' -> type(And);
PPStarAssign: '*=' -> type(StarAssign);
PPOr: '|' -> type(Or);
PPDivAssign: '/=' -> type(DivAssign);
PPModAssign: '%=' -> type(ModAssign);
PPXorAssign: '^=' -> type(XorAssign);
PPAndAssign: '&=' -> type(AndAssign);
PPOrAssign: '|=' -> type(OrAssign);
PPLeftShift: '<<' -> type(LeftShift);
//PPRightShift: '>>' -> type(RightShift);
PPRightShiftAssign: '>>=' -> type(RightShiftAssign);
PPLeftShiftAssign: '<<=' -> type(LeftShiftAssign);
PPEqual: '==' -> type(Equal);
PPLessEqual: '<=' -> type(LessEqual);
PPGreaterEqual: '>=' -> type(GreaterEqual);
PPAndAnd: '&&' -> type(AndAnd);
PPOrOr: '||' -> type(OrOr);
PPPlusPlus: '++' -> type(PlusPlus);
PPMinusMinus: '--' -> type(MinusMinus);
PPComma: ',' -> type(Comma);
PPArrow: '->' -> type(Arrow);
PPArrowStar: '->*' -> type(ArrowStar);
PPNotEqual: '!=' -> type(NotEqual);
PPContinue : [\\][\r\n]+ -> channel(HIDDEN);
PPString_literal : ( FEncoding_prefix ? '"' FS_char_sequence ? '"' | FEncoding_prefix ? 'R' FRaw_string ) -> type(String_literal) ;
PPCharacter_literal : ( FEncoding_prefix ? '\'' FC_char_sequence '\'' ) -> type(Character_literal) ;
PPAny : .;
|
agda-stdlib-0.9/src/Data/Empty.agda | qwe2/try-agda | 1 | 11598 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Empty type
------------------------------------------------------------------------
module Data.Empty where
open import Level
data ⊥ : Set where
{-# IMPORT Data.FFI #-}
{-# COMPILED_DATA ⊥ Data.FFI.AgdaEmpty #-}
⊥-elim : ∀ {w} {Whatever : Set w} → ⊥ → Whatever
⊥-elim ()
|
test/Succeed/WithoutKDisjointSum.agda | KDr2/agda | 0 | 15516 | {-# OPTIONS --cubical-compatible #-}
-- Issue raised by <NAME> 2012-12-13
-- on the Agda list "no longer type checks"
module WithoutKDisjointSum where
open import Common.Equality
data ⊥ : Set where
data _⊎_ (A B : Set) : Set where
inl : A → A ⊎ B
inr : B → A ⊎ B
distinct : {A B : Set} (a : A) (b : B) → inl a ≡ inr b → ⊥
distinct a b ()
|
programs/oeis/093/A093390.asm | jmorken/loda | 1 | 174210 | ; A093390: a(n) = floor(n/9) + floor((n+1)/9) + floor((n+2)/9).
; 0,0,0,0,0,0,0,1,2,3,3,3,3,3,3,3,4,5,6,6,6,6,6,6,6,7,8,9,9,9,9,9,9,9,10,11,12,12,12,12,12,12,12,13,14,15,15,15,15,15,15,15,16,17,18,18,18,18,18,18,18,19,20,21,21,21,21,21,21,21,22,23,24,24,24,24,24,24,24,25,26,27,27,27,27,27,27,27,28,29,30,30,30,30,30,30,30,31,32,33,33,33,33,33,33,33,34,35,36,36,36,36,36,36,36,37,38,39,39,39,39,39,39,39,40,41,42,42,42,42,42,42,42,43,44,45,45,45,45,45,45,45,46,47,48,48,48,48,48,48,48,49,50,51,51,51,51,51,51,51,52,53,54,54,54,54,54,54,54,55,56,57,57,57,57,57,57,57,58,59,60,60,60,60,60,60,60,61,62,63,63,63,63,63,63,63,64,65,66,66,66,66,66,66,66,67,68,69,69,69,69,69,69,69,70,71,72,72,72,72,72,72,72,73,74,75,75,75,75,75,75,75,76,77,78,78,78,78,78,78,78,79,80,81,81,81,81,81,81,81
lpb $0
trn $0,6
add $1,$0
trn $0,3
sub $1,$0
lpe
|
.emacs.d/elpa/wisi-3.1.3/wisitoken-bnf-utils.adb | caqg/linux-home | 0 | 17637 | -- Abstract :
--
-- See spec
--
-- Copyright (C) 2012, 2013, 2015, 2017, 2018 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or
-- modify it under terms of the GNU General Public License as
-- published by the Free Software Foundation; either version 3, or (at
-- your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-- PURPOSE. See the GNU General Public License for more details. You
-- should have received a copy of the GNU General Public License
-- distributed with this program; see file COPYING. If not, write to
-- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston,
-- MA 02110-1335, USA.
pragma License (GPL);
package body WisiToken.BNF.Utils is
function Strip_Quotes (Item : in String) return String
is begin
if Item'Length < 2 then
return Item;
else
return Item
((if Item (Item'First) = '"' then Item'First + 1 else Item'First) ..
(if Item (Item'Last) = '"' then Item'Last - 1 else Item'Last));
end if;
end Strip_Quotes;
function Strip_Parens (Item : in String) return String
is begin
if Item'Length < 2 then
return Item;
else
return Item
((if Item (Item'First) = '(' then Item'First + 1 else Item'First) ..
(if Item (Item'Last) = ')' then Item'Last - 1 else Item'Last));
end if;
end Strip_Parens;
end WisiToken.BNF.Utils;
|
programs/oeis/147/A147704.asm | karttu/loda | 1 | 94664 | ; A147704: Diagonal sums of Riordan array ((1-2x)/(1 - 3x + x^2),x(1-x)/(1 - 3x + x^2)).
; 1,1,3,8,23,66,190,547,1575,4535,13058,37599,108262,311728,897585,2584493,7441751,21427668,61698511,177653782,511533678,1472902523,4241053787,12211627683,35161980526,101244887791
cal $0,215885 ; a(n) = 3*a(n-1) - a(n-3), with a(0) = 3, a(1) = 3, and a(2) = 9.
mov $1,$0
div $1,3
|
programs/oeis/194/A194139.asm | neoneye/loda | 22 | 1839 | ; A194139: a(n) = Sum_{j=1..n} floor(j*(2+sqrt(2))); n-th partial sum of Beatty sequence for 2+sqrt(2).
; 3,9,19,32,49,69,92,119,149,183,220,260,304,351,402,456,514,575,639,707,778,853,931,1012,1097,1185,1277,1372,1471,1573,1678,1787,1899,2015,2134,2256,2382,2511,2644,2780,2919,3062,3208,3358,3511,3668,3828,3991,4158,4328,4502,4679,4859,5043,5230,5421,5615,5813,6014,6218,6426,6637,6852,7070,7291,7516,7744,7976,8211,8449,8691,8936,9185,9437,9693,9952,10214,10480,10749,11022,11298,11577,11860,12146,12436,12729,13026,13326,13629,13936,14246,14560,14877,15197,15521,15848,16179,16513,16851,17192
lpb $0
mov $2,$0
sub $0,1
seq $2,286927 ; Positions of 1 in A286925; complement of A286926.
add $1,$2
lpe
div $1,2
add $1,3
mov $0,$1
|
programs/oeis/017/A017245.asm | karttu/loda | 1 | 163831 | ; A017245: a(n) = 9*n + 7.
; 7,16,25,34,43,52,61,70,79,88,97,106,115,124,133,142,151,160,169,178,187,196,205,214,223,232,241,250,259,268,277,286,295,304,313,322,331,340,349,358,367,376,385,394,403,412,421,430,439,448,457,466,475,484
mov $1,$0
mul $1,9
add $1,7
|
src/asf-components-widgets-selects.ads | jquorning/ada-asf | 12 | 6353 | -----------------------------------------------------------------------
-- components-widgets-selects -- Select component with jQuery Chosen
-- Copyright (C) 2015 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Components.Html.Selects;
with ASF.Contexts.Faces;
package ASF.Components.Widgets.Selects is
OPTIONS_FACET_NAME : constant String := "options";
EVENTS_FACET_NAME : constant String := "events";
-- ------------------------------
-- UIChosen
-- ------------------------------
-- The <b>UIChosen</b> component displays a HTML select component.
type UIChosen is new ASF.Components.Html.Selects.UISelectOne with null record;
-- Render the chosen configuration script.
overriding
procedure Encode_End (UI : in UIChosen;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
end ASF.Components.Widgets.Selects;
|
packages/external/libmpg123-1.22.x/src/asm_nasm/synth_i586_dither.asm | sezero/SDL2-OS2 | 2 | 21240 | <reponame>sezero/SDL2-OS2<filename>packages/external/libmpg123-1.22.x/src/asm_nasm/synth_i586_dither.asm
; 1 "synth_i586_dither.S"
; 1 "<built-in>"
; 1 "<command line>"
; 1 "synth_i586_dither.S"
; 14 "synth_i586_dither.S"
; 1 "mangle.h" 1
; 13 "mangle.h"
; 1 "config.h" 1
; 14 "mangle.h" 2
; 1 "intsym.h" 1
; 15 "mangle.h" 2
; 15 "synth_i586_dither.S" 2
%include "asm_nasm.inc"
_sym_mangle dct64_i386
_sym_mangle synth_1to1_i586_asm_dither
EXTERN dct64_i386
SECTION .data
ALIGN 8
_LC0:
dd 00h,040dfffc0h
ALIGN 8
_LC1:
dd 00h,0c0e00000h
ALIGN 8
SECTION .text
GLOBAL synth_1to1_i586_asm_dither
synth_1to1_i586_asm_dither:
sub esp,16
push ebp
push edi
push esi
push ebx
; 53 "synth_i586_dither.S"
mov eax, [esp+36]
mov esi, [esp+44]
mov ebx, [esp+52]
mov ebp, [ebx]
mov edi, [ebx+4]
mov [esp+28],edi
xor edi,edi
cmp [esp+40],edi
jne L48
dec ebp
and ebp,15
mov [ebx],ebp
mov ecx, [esp+48]
jmp L49
L48:
sub dword [esp+28],128
and dword [esp+28],00003fffch
add esi,2
mov ecx, [esp+48]
add ecx,2176
L49:
test ebp,1
je L50
mov ebx,ecx
mov [esp+16],ebp
push eax
mov edx, [esp+20]
lea eax, [ebx+edx*4]
push eax
mov eax, [esp+24]
inc eax
and eax,15
lea eax, [eax*4+1088]
add eax,ebx
jmp L74
L50:
lea ebx, [ecx+1088]
lea edx, [ebp+1]
mov [esp+16],edx
push eax
lea eax, [ecx+ebp*4+1092]
push eax
lea eax, [ecx+ebp*4]
L74:
push eax
call dct64_i386
add esp,12
mov edx, [esp+16]
lea edx, [edx*4+0]
mov eax, [esp+56]
add eax,64
mov ecx,eax
sub ecx,edx
mov ebp,16
L55:
fld dword [ecx]
fmul dword [ebx]
fld dword [ecx+4]
fmul dword [ebx+4]
fxch st1
fld dword [ecx+8]
fmul dword [ebx+8]
fxch st2
fsubrp st1,st0
fld dword [ecx+12]
fmul dword [ebx+12]
fxch st2
faddp st1,st0
fld dword [ecx+16]
fmul dword [ebx+16]
fxch st2
fsubrp st1,st0
fld dword [ecx+20]
fmul dword [ebx+20]
fxch st2
faddp st1,st0
fld dword [ecx+24]
fmul dword [ebx+24]
fxch st2
fsubrp st1,st0
fld dword [ecx+28]
fmul dword [ebx+28]
fxch st2
faddp st1,st0
fld dword [ecx+32]
fmul dword [ebx+32]
fxch st2
fsubrp st1,st0
fld dword [ecx+36]
fmul dword [ebx+36]
fxch st2
faddp st1,st0
fld dword [ecx+40]
fmul dword [ebx+40]
fxch st2
fsubrp st1,st0
fld dword [ecx+44]
fmul dword [ebx+44]
fxch st2
faddp st1,st0
fld dword [ecx+48]
fmul dword [ebx+48]
fxch st2
fsubrp st1,st0
fld dword [ecx+52]
fmul dword [ebx+52]
fxch st2
faddp st1,st0
fld dword [ecx+56]
fmul dword [ebx+56]
fxch st2
fsubrp st1,st0
fld dword [ecx+60]
fmul dword [ebx+60]
fxch st2
sub esp,4
faddp st1,st0
fxch st1
fsubrp st1,st0
add dword [esp+32],4
and dword [esp+32],00003fffch
mov edi, [esp+64]
add edi, [esp+32]
fadd dword [edi]
fistp dword [esp]
pop eax
cmp eax,32767
jg short .l1
cmp eax,-32768
jl short .l2
mov [esi],ax
jmp short .l4
.l1: mov word [esi],32767
jmp short .l3
.l2: mov word [esi],-32768
.l3:
.l4:
L54:
add ebx,64
sub ecx,-128
add esi,4
dec ebp
jnz L55
fld dword [ecx]
fmul dword [ebx]
fld dword [ecx+8]
fmul dword [ebx+8]
fld dword [ecx+16]
fmul dword [ebx+16]
fxch st2
faddp st1,st0
fld dword [ecx+24]
fmul dword [ebx+24]
fxch st2
faddp st1,st0
fld dword [ecx+32]
fmul dword [ebx+32]
fxch st2
faddp st1,st0
fld dword [ecx+40]
fmul dword [ebx+40]
fxch st2
faddp st1,st0
fld dword [ecx+48]
fmul dword [ebx+48]
fxch st2
faddp st1,st0
fld dword [ecx+56]
fmul dword [ebx+56]
fxch st2
sub esp,4
faddp st1,st0
fxch st1
faddp st1,st0
add dword [esp+32],4
and dword [esp+32],00003fffch
mov edi, [esp+64]
add edi, [esp+32]
fadd dword [edi]
fistp dword [esp]
pop eax
cmp eax,32767
jg short .l1
cmp eax,-32768
jl short .l2
mov [esi],ax
jmp short .l4
.l1: mov word [esi],32767
jmp short .l3
.l2: mov word [esi],-32768
.l3:
.l4:
L62:
add ebx,-64
add esi,4
mov edx, [esp+16]
lea ecx, [ecx+edx*8-128]
mov ebp,15
L68:
fld dword [ecx-4]
fchs
fmul dword [ebx]
fld dword [ecx-8]
fmul dword [ebx+4]
fxch st1
fld dword [ecx-12]
fmul dword [ebx+8]
fxch st2
fsubrp st1,st0
fld dword [ecx-16]
fmul dword [ebx+12]
fxch st2
fsubrp st1,st0
fld dword [ecx-20]
fmul dword [ebx+16]
fxch st2
fsubrp st1,st0
fld dword [ecx-24]
fmul dword [ebx+20]
fxch st2
fsubrp st1,st0
fld dword [ecx-28]
fmul dword [ebx+24]
fxch st2
fsubrp st1,st0
fld dword [ecx-32]
fmul dword [ebx+28]
fxch st2
fsubrp st1,st0
fld dword [ecx-36]
fmul dword [ebx+32]
fxch st2
fsubrp st1,st0
fld dword [ecx-40]
fmul dword [ebx+36]
fxch st2
fsubrp st1,st0
fld dword [ecx-44]
fmul dword [ebx+40]
fxch st2
fsubrp st1,st0
fld dword [ecx-48]
fmul dword [ebx+44]
fxch st2
fsubrp st1,st0
fld dword [ecx-52]
fmul dword [ebx+48]
fxch st2
fsubrp st1,st0
fld dword [ecx-56]
fmul dword [ebx+52]
fxch st2
fsubrp st1,st0
fld dword [ecx-60]
fmul dword [ebx+56]
fxch st2
fsubrp st1,st0
fld dword [ecx]
fmul dword [ebx+60]
fxch st2
sub esp,4
fsubrp st1,st0
fxch st1
fsubrp st1,st0
add dword [esp+32],4
and dword [esp+32],00003fffch
mov edi, [esp+64]
add edi, [esp+32]
fadd dword [edi]
fistp dword [esp]
pop eax
cmp eax,32767
jg short .l1
cmp eax,-32768
jl short .l2
mov [esi],ax
jmp short .l4
.l1: mov word [esi],32767
jmp short .l3
.l2: mov word [esi],-32768
.l3:
.l4:
L67:
add ebx,-64
add ecx,-128
add esi,4
dec ebp
jnz L68
mov eax,0
mov ebx, [esp+52]
mov esi, [esp+28]
mov [ebx+4],esi
pop ebx
pop esi
pop edi
pop ebp
add esp,16
ret
; 382 "synth_i586_dither.S"
|
library/fmGUI_ManageDataSources/fmGUI_ManageDataSources_Save.applescript | NYHTC/applescript-fm-helper | 1 | 3286 | -- fmGUI_ManageDataSources_Save(notInManageWindowIsError:null)
-- <NAME>, NYHTC
-- Close ( and Save ) Manage Data Sources
(*
HISTORY:
1.4.1 - 2017-06-26 ( eshagdar ): narrowed scope
1.4 -
1.3 -
1.2 -
1.1 -
1.0 - created
REQUIRES:
fmGUI_AppFrontMost
*)
on run
fmGUI_ManageDataSources_Save({})
end run
--------------------
-- START OF CODE
--------------------
on fmGUI_ManageDataSources_Save(prefs)
-- version 1.4.1
set defaultPrefs to {notInManageWindowIsError:true}
set prefs to prefs & defaultPrefs
set manageWindowNamePrefix to "Manage External Data Sources"
set waitCycleDelaySeconds to 5 -- seconds
set waitSaveTotalSeconds to 5 * minutes --seconds
set waitCycleMax to round (waitSaveTotalSeconds / waitCycleDelaySeconds) rounding down
try
fmGUI_AppFrontMost()
tell application "System Events"
tell application process "FileMaker Pro Advanced"
if name of window 1 starts with manageWindowNamePrefix then
try
set manageWindowName to name of window 1
click (button "OK" of window 1)
delay 1 -- let click register.
-- will continue below to wait for window to close
on error errMsg number errNum
error "Couldn't save Manage Data Sources - " & errMsg number errNum
end try
else
if notInManageWindowIsError of prefs then
error "Manage Data Source window wasn't open, so nothing to close." number 1024
else
-- Not in Manage Data Source, but that is OK.
return true
end if
end if
end tell
end tell
windowWaitUntil({windowName:manageWindowName, windowNameTest:"does not contain", whichWindow:"any", waitCycleDelaySeconds:waitCycleDelaySeconds, waitCycleMax:waitCycleMax})
delay 1 -- let normal window come to front.
return true
on error errMsg number errNum
error "Couldn't save Manage Data Sources - " & errMsg number errNum
end try
end fmGUI_ManageDataSources_Save
--------------------
-- END OF CODE
--------------------
on fmGUI_AppFrontMost()
tell application "htcLib" to fmGUI_AppFrontMost()
end fmGUI_AppFrontMost
on windowWaitUntil(prefs)
tell application "htcLib" to windowWaitUntil(prefs)
end windowWaitUntil
|
awa/plugins/awa-mail/src/aws/awa-mail-clients-aws_smtp-initialize_ssl.adb | fuzzysloth/ada-awa | 81 | 27736 | <filename>awa/plugins/awa-mail/src/aws/awa-mail-clients-aws_smtp-initialize_ssl.adb
-----------------------------------------------------------------------
-- awa-mail-clients-aws_smtp-initialize -- Initialize SMTP client with SSL support
-- Copyright (C) 2016 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
separate (AWA.Mail.Clients.AWS_SMTP)
procedure Initialize (Client : in out AWS_Mail_Manager'Class;
Props : in Util.Properties.Manager'Class) is
Server : constant String := Props.Get (Name => "smtp.host", Default => "localhost");
User : constant String := Props.Get (Name => "smtp.user", Default => "");
Passwd : constant String := Props.Get (Name => "smtp.password", Default => "");
Secure : constant String := Props.Get (Name => "smtp.ssl", Default => "0");
begin
Client.Secure := Secure = "1" or Secure = "yes" or Secure = "true";
if User'Length > 0 then
Client.Creds := AWS.SMTP.Authentication.Plain.Initialize (User, Passwd);
Client.Server := AWS.SMTP.Client.Initialize (Server_Name => Server,
Port => Client.Port,
Secure => Client.Secure,
Credential => Client.Creds'Unchecked_Access);
else
Client.Server := AWS.SMTP.Client.Initialize (Server_Name => Server,
Port => Client.Port,
Secure => Client.Secure);
end if;
end Initialize;
|
programs/oeis/267/A267092.asm | karttu/loda | 0 | 15415 | <gh_stars>0
; A267092: a(n) is the number of P-positions for n-modular Nim with 2 piles.
; 1,3,3,8,5,9,7,20,9,15,11,24,13,21,15,48,17,27,19,40,21,33,23,60,25,39,27,56,29,45,31,112,33,51,35,72,37,57,39,100,41,63,43,88,45,69,47,144,49,75,51,104,53,81,55,140,57,87,59,120,61,93,63,256,65,99,67,136,69,105,71,180,73,111,75,152,77,117,79,240,81,123,83,168,85,129,87,220,89,135,91,184,93,141,95,336,97,147,99,200,101,153,103,260,105,159,107,216,109,165,111,336,113,171,115,232,117,177,119,300,121,183,123,248,125,189,127,576,129,195,131,264,133,201,135,340,137,207,139,280,141,213,143,432,145,219,147,296,149,225,151,380,153,231,155,312,157,237,159,560,161,243,163,328,165,249,167,420,169,255,171,344,173,261,175,528,177,267,179,360,181,273,183,460,185,279,187,376,189,285,191,768,193,291,195,392,197,297,199,500,201,303,203,408,205,309,207,624,209,315,211,424,213,321,215,540,217,327,219,440,221,333,223,784,225,339,227,456,229,345,231,580,233,351,235,472,237,357,239,720,241,363,243,488,245,369,247,620,249,375
mov $2,$0
cal $0,91512 ; a(n) is the largest integer m such that 2^m divides (2*n)^n, i.e., the exponent of 2 in (2*n)^n.
add $0,6
add $2,$0
mov $0,1
sub $1,$2
sub $0,$1
mov $1,$0
sub $1,7
div $1,2
add $1,1
|
programs/oeis/229/A229135.asm | neoneye/loda | 22 | 92743 | <reponame>neoneye/loda<gh_stars>10-100
; A229135: n * (2 + 2^(2*n - 1)).
; 0,4,20,102,520,2570,12300,57358,262160,1179666,5242900,23068694,100663320,436207642,1879048220,8053063710,34359738400,146028888098,618475290660,2611340116006,10995116277800,46179488366634,193514046488620,809240558043182,3377699720527920,14073748835532850,58546795155816500,243194379878006838,1008806316530991160,4179340454199820346,17293822569102704700,71481133285624512574,295147905179352825920,1217485108864830406722,5017514388048998039620,20660353362554697809990,85002596691653613846600,349455119732353745813578,1435599410792372144963660,5893513370621317226692686,24178516392292583494123600,99131917208399592325906514,406199075390515402701275220,1663481927789729744395698262,6808670216069591511945183320,27853650883921056185230295130,113890483614254985290719428700,465465454771302983362070708318,1901475900342344102245054808160,7764359926397905084167307133026,31691265005705735037417580134500,129300361223279398952663726948454,527342649694943431022628533436520,2149935417987077064938408636317802,8762000948777521623145212555559020,35697040902426939946147162263388270,145384312038975173598853897218162800,591921841872970349652476581531091058
mov $1,4
pow $1,$0
add $1,4
mul $0,$1
div $0,4
mul $0,2
|
programs/oeis/312/A312100.asm | jmorken/loda | 1 | 99897 | <gh_stars>1-10
; A312100: Coordination sequence Gal.5.54.2 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,4,8,13,18,22,27,32,36,40,44,48,53,58,62,67,72,76,80,84,88,93,98,102,107,112,116,120,124,128,133,138,142,147,152,156,160,164,168,173,178,182,187,192,196,200,204,208,213,218
mov $3,$0
add $3,1
mov $8,$0
lpb $3
mov $0,$8
sub $3,1
sub $0,$3
add $2,1
lpb $2
mov $4,$0
mul $0,2
sub $2,1
mov $5,3
mov $6,$4
bin $6,2
lpb $0
mov $0,4
div $6,$5
mod $6,3
add $0,$6
sub $0,1
add $6,3
lpe
lpe
mov $7,$0
add $7,1
add $1,$7
lpe
|
smsq/sbas/procs/instr.asm | olifink/smsqe | 0 | 12629 | ; SBAS_PROCS_INSTR - SBASIC INSTR control V2.00 1994 <NAME>
section exten
xdef instr_case
xref ut_gxin1
include 'dev8_keys_sbasic'
;+++
; INSTR_CASE 0/1
;---
instr_case
jsr ut_gxin1
tst.w (a6,a1.l)
sne sb_cinst(a6) ; set instr flag
rts
end
|
Transynther/x86/_processed/NC/_st_zr_/i9-9900K_12_0xca_notsx.log_21829_110.asm | ljhsiun2/medusa | 9 | 173941 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r9
push %rbx
push %rdx
push %rsi
lea addresses_WC_ht+0x121b5, %r11
nop
nop
nop
sub %rdx, %rdx
mov (%r11), %rsi
nop
nop
and %r14, %r14
lea addresses_WC_ht+0x1eb80, %r9
nop
nop
nop
nop
nop
xor $36053, %rbx
mov $0x6162636465666768, %rsi
movq %rsi, (%r9)
nop
nop
nop
nop
sub %rbx, %rbx
pop %rsi
pop %rdx
pop %rbx
pop %r9
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r15
push %r9
push %rax
push %rdi
push %rdx
push %rsi
// Load
lea addresses_RW+0x1fa15, %rdx
nop
nop
nop
sub $44331, %rax
movups (%rdx), %xmm1
vpextrq $0, %xmm1, %rsi
nop
nop
inc %rdx
// Faulty Load
mov $0x671700000000e15, %rdx
nop
nop
nop
nop
nop
sub %r15, %r15
movups (%rdx), %xmm2
vpextrq $1, %xmm2, %r12
lea oracles, %rdx
and $0xff, %r12
shlq $12, %r12
mov (%rdx,%r12,1), %r12
pop %rsi
pop %rdx
pop %rdi
pop %rax
pop %r9
pop %r15
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': True, 'AVXalign': True, 'size': 4, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
{'00': 21826, '32': 3}
00 00 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
oeis/142/A142325.asm | neoneye/loda-programs | 11 | 19472 | ; A142325: Primes congruent to 26 mod 45.
; Submitted by <NAME>
; 71,251,431,521,701,881,971,1061,1151,1511,1601,1871,2141,2411,2591,2861,3041,3221,3491,3581,3671,3761,3851,4211,4391,4481,4751,4931,5021,5381,5471,5651,5741,6011,6101,6551,6911,7001,7451,7541,7901,8081,8171,9161,9341,9431,9521,9791,10061,10151,10331,10601,10691,10781,11321,11411,11681,12041,12401,12491,12671,12941,13121,13751,13841,13931,14561,14741,14831,15101,15461,15551,15641,15731,16001,16091,16361,16451,16631,16811,16901,17351,17891,17981,18251,18341,18521,18701,19421,19961,20051,20231
mov $1,35
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $2,2
mov $3,$1
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,45
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
sub $0,80
mul $0,2
add $0,71
|
oeis/039/A039964.asm | neoneye/loda-programs | 11 | 160650 | ; A039964: Motzkin numbers A001006 read mod 3.
; Submitted by <NAME>
; 1,1,2,1,0,0,0,1,2,1,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,1,2,1,1,2,1,0,0,0,1,2,1,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,1,1,2,1,0,0,0,1,2,1,1,2,1,0,0,0,0,0,0
mov $1,$0
add $0,2
add $1,52126
sub $1,$0
bin $1,$0
mod $1,3
mov $0,$1
|
programs/oeis/092/A092139.asm | karttu/loda | 0 | 167811 | ; A092139: Duplicate of A084558.
; 0,1,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4
mul $0,11
add $0,1
log $0,4
mov $1,$0
|
applescript/iTunes/Embed Metainfo in Comments.applescript | chbrown/sandbox | 0 | 25 | <reponame>chbrown/sandbox<filename>applescript/iTunes/Embed Metainfo in Comments.applescript
tell application "iTunes"
set sel to selection
if sel is not {} then
set old_indexing to fixed indexing
set fixed indexing to true
repeat with this_track in sel
try
set mode to "embed"
if mode is "embed" then
set track_played_count to (get played count of this_track)
set track_rating to (get rating of this_track)
set encoded_details to ("plays:" & track_played_count & ";rating:" & track_rating) as string
set track_playlists to (get playlists of this_track)
repeat with track_playlist in track_playlists
if (get special kind of track_playlist) is none then
if (get smart of track_playlist) is false then
set playlist_name to (get name of track_playlist)
set encoded_details to (encoded_details & ";playlist:" & playlist_name)
end if
end if
end repeat
set comment of this_track to encoded_details
else
set track_comment to (get comment of this_track)
set comment_splits to my splitText(";", track_comment)
repeat with comment_split in comment_splits
set {prop_name, prop_value} to my splitText(":", comment_split)
if prop_name is "plays" then
set played count of this_track to prop_value
end if
if prop_name is "rating" then
set rating of this_track to prop_value
end if
if prop_name is "playlist" then
set new_playlist_name to prop_value
if exists (some user playlist whose name is new_playlist_name) then
--set my_opts to (display dialog "This Playlist exists: " & new_playlist_name buttons {"Don't Replace", "Replace"} default button 2 with icon 0)
set new_playlist to user playlist new_playlist_name
else
set new_playlist to (make user playlist with properties {name:new_playlist_name})
end if
--set rating of this_track to prop_value
duplicate this_track to new_playlist
end if
end repeat
--log thisTrack
--global track_class
--set track_class to (get class of thisTrack)
--set comment_text to (encodeTrack(thisTrack))
--log (get played count of thisTrack)
--log comment_text
end if
on error m
log m -- do you care?
end try
end repeat
set fixed indexing to old_indexing
else
display dialog return & "Select some tracks first..." buttons {"Cancel"} default button 1 with icon 0 giving up after 15
return
end if
log "Did " & (count (sel))
end tell
on splitText(delimiter, someText)
set prevTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to delimiter
set output to text items of someText
set AppleScript's text item delimiters to prevTIDs
return output
end splitText
|
test/11_amx.asm | x86128/pymesm | 2 | 9961 | #
# Test for instruction AMX.
#
org 1
ptr start
vtm stack,15
ntr 3 # без нормализации и округления
vtm 64,14
ita 14
amx f65 # целое 65 без порядка
uza fail # |64| - |65| = -1
aex minus1 # целое -1 без порядка
uia fail
#-------------------------
xta minus1
amx minus1
uia fail
#
aox 0 # |-1| - |-1| = 0
uia fail
#-------------------------
xta b2
xts b3
amx 0,15 # |3| - |2| = 1
uia fail
#
aex b1
uia fail
#-------------------------
xta b0067777777777777
amx b1
aex b0050000000000000
uia fail
#-------------------------
xta b4050000000000000 # =e'1' b4050000000000000
xts b6427777777777777 # =e'-549755813889' b6427777777777777
amx 0,15
aex b6410000000000000 # =e'549755813888' b6410000000000000
uia fail
#-------------------------
ntr 0 # с нормализацией и округлением
xta b6410000000000002 # =e'549755813890' b6410000000000002
xts b6410000000000003 # =e'549755813891' 6410000000000003
amx 0,15
aex b4050000000000000 # =e'1' b4050000000000000
uia fail
#
xta b4060000000000000 # -2
amx b4057777777777765 # 1.99999999998
aex b1653000000000000 # 2.0008883439004e-11
uia fail
#-------------------------
lbl pass
stop 0o12345,6
lbl fail
stop 0o76543,2
#-------------------------
dorg 0o2000 # данные с адреса 2000
arr minus1 0o0037777777777777 # целое -1 без порядка
arr b1 1
arr b2 2
arr b3 3
arr b0067777777777777 0o0067777777777777
arr b0050000000000000 0o0050000000000000
arr b4050000000000000 0o4050000000000000
arr b6427777777777777 0o6427777777777777
arr b6410000000000000 0o6410000000000000
arr b6410000000000002 0o6410000000000002
arr b6410000000000003 0o6410000000000003
arr b4060000000000000 0o4060000000000000
arr b4057777777777765 0o4057777777777765
arr b1653000000000000 0o1653000000000000
mem stack 10 # стек
arr f65 65
fin
|
avx2/sha1_x8_avx2.asm | kingwelx/intel-ipsec-mb | 17 | 104797 | ;;
;; Copyright (c) 2012-2018, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
;; Stack must be aligned to 32 bytes before call
;; Windows clobbers: rax rdx r8 r9 r10 r11 r12 r13 r14 r15
;; Windows preserves: rbx rcx rsi rdi rbp
;;
;; Linux clobbers: rax rdx rsi r9 r10 r11 r12 r13 r14 r15
;; Linux preserves: rbx rcx rdi rbp r8
;;
;; clobbers ymm0-15
%include "os.asm"
;%define DO_DBGPRINT
%include "dbgprint.asm"
%include "mb_mgr_datastruct.asm"
section .data
default rel
align 32
PSHUFFLE_BYTE_FLIP_MASK: ;ddq 0x0c0d0e0f08090a0b0405060700010203
;ddq 0x0c0d0e0f08090a0b0405060700010203
dq 0x0405060700010203, 0x0c0d0e0f08090a0b
dq 0x0405060700010203, 0x0c0d0e0f08090a0b
K00_19: ;ddq 0x5A8279995A8279995A8279995A827999
;ddq 0x5A8279995A8279995A8279995A827999
dq 0x5A8279995A827999, 0x5A8279995A827999
dq 0x5A8279995A827999, 0x5A8279995A827999
K20_39: ;ddq 0x6ED9EBA16ED9EBA16ED9EBA16ED9EBA1
;ddq 0x6ED9EBA16ED9EBA16ED9EBA16ED9EBA1
dq 0x6ED9EBA16ED9EBA1, 0x6ED9EBA16ED9EBA1
dq 0x6ED9EBA16ED9EBA1, 0x6ED9EBA16ED9EBA1
K40_59: ;ddq 0x8F1BBCDC8F1BBCDC8F1BBCDC8F1BBCDC
;ddq 0x8F1BBCDC8F1BBCDC8F1BBCDC8F1BBCDC
dq 0x8F1BBCDC8F1BBCDC, 0x8F1BBCDC8F1BBCDC
dq 0x8F1BBCDC8F1BBCDC, 0x8F1BBCDC8F1BBCDC
K60_79: ;ddq 0xCA62C1D6CA62C1D6CA62C1D6CA62C1D6
;ddq 0xCA62C1D6CA62C1D6CA62C1D6CA62C1D6
dq 0xCA62C1D6CA62C1D6, 0xCA62C1D6CA62C1D6
dq 0xCA62C1D6CA62C1D6, 0xCA62C1D6CA62C1D6
section .text
%ifdef LINUX
%define arg1 rdi
%define arg2 rsi
%define reg3 rdx
%else
%define arg1 rcx
%define arg2 rdx
%define reg3 r8
%endif
%define state arg1
%define num_blks arg2
%define inp0 r9
%define inp1 r10
%define inp2 r11
%define inp3 r12
%define inp4 r13
%define inp5 r14
%define inp6 r15
%define inp7 reg3
%define IDX rax
; ymm0 A
; ymm1 B
; ymm2 C
; ymm3 D
; ymm4 E
; ymm5 F AA
; ymm6 T0 BB
; ymm7 T1 CC
; ymm8 T2 DD
; ymm9 T3 EE
; ymm10 T4 TMP
; ymm11 T5 FUN
; ymm12 T6 K
; ymm13 T7 W14
; ymm14 T8 W15
; ymm15 T9 W16
%define A ymm0
%define B ymm1
%define C ymm2
%define D ymm3
%define E ymm4
%define F ymm5
%define T0 ymm6
%define T1 ymm7
%define T2 ymm8
%define T3 ymm9
%define T4 ymm10
%define T5 ymm11
%define T6 ymm12
%define T7 ymm13
%define T8 ymm14
%define T9 ymm15
%define AA ymm5
%define BB ymm6
%define CC ymm7
%define DD ymm8
%define EE ymm9
%define TMP ymm10
%define FUN ymm11
%define K ymm12
%define W14 ymm13
%define W15 ymm14
%define W16 ymm15
;; Assume stack aligned to 32 bytes before call
;; Therefore FRAMESIZE mod 32 must be 32-8 = 24
%define FRAMESZ 32*16 + 24
%define VMOVPS vmovups
; TRANSPOSE8 r0, r1, r2, r3, r4, r5, r6, r7, t0, t1
; "transpose" data in {r0...r7} using temps {t0...t1}
; Input looks like: {r0 r1 r2 r3 r4 r5 r6 r7}
; r0 = {a7 a6 a5 a4 a3 a2 a1 a0}
; r1 = {b7 b6 b5 b4 b3 b2 b1 b0}
; r2 = {c7 c6 c5 c4 c3 c2 c1 c0}
; r3 = {d7 d6 d5 d4 d3 d2 d1 d0}
; r4 = {e7 e6 e5 e4 e3 e2 e1 e0}
; r5 = {f7 f6 f5 f4 f3 f2 f1 f0}
; r6 = {g7 g6 g5 g4 g3 g2 g1 g0}
; r7 = {h7 h6 h5 h4 h3 h2 h1 h0}
;
; Output looks like: {r0 r1 r2 r3 r4 r5 r6 r7}
; r0 = {h0 g0 f0 e0 d0 c0 b0 a0}
; r1 = {h1 g1 f1 e1 d1 c1 b1 a1}
; r2 = {h2 g2 f2 e2 d2 c2 b2 a2}
; r3 = {h3 g3 f3 e3 d3 c3 b3 a3}
; r4 = {h4 g4 f4 e4 d4 c4 b4 a4}
; r5 = {h5 g5 f5 e5 d5 c5 b5 a5}
; r6 = {h6 g6 f6 e6 d6 c6 b6 a6}
; r7 = {h7 g7 f7 e7 d7 c7 b7 a7}
;
%macro TRANSPOSE8 10
%define %%r0 %1
%define %%r1 %2
%define %%r2 %3
%define %%r3 %4
%define %%r4 %5
%define %%r5 %6
%define %%r6 %7
%define %%r7 %8
%define %%t0 %9
%define %%t1 %10
; process top half (r0..r3) {a...d}
vshufps %%t0, %%r0, %%r1, 0x44 ; t0 = {b5 b4 a5 a4 b1 b0 a1 a0}
vshufps %%r0, %%r0, %%r1, 0xEE ; r0 = {b7 b6 a7 a6 b3 b2 a3 a2}
vshufps %%t1, %%r2, %%r3, 0x44 ; t1 = {d5 d4 c5 c4 d1 d0 c1 c0}
vshufps %%r2, %%r2, %%r3, 0xEE ; r2 = {d7 d6 c7 c6 d3 d2 c3 c2}
vshufps %%r3, %%t0, %%t1, 0xDD ; r3 = {d5 c5 b5 a5 d1 c1 b1 a1}
vshufps %%r1, %%r0, %%r2, 0x88 ; r1 = {d6 c6 b6 a6 d2 c2 b2 a2}
vshufps %%r0, %%r0, %%r2, 0xDD ; r0 = {d7 c7 b7 a7 d3 c3 b3 a3}
vshufps %%t0, %%t0, %%t1, 0x88 ; t0 = {d4 c4 b4 a4 d0 c0 b0 a0}
; use r2 in place of t0
; process bottom half (r4..r7) {e...h}
vshufps %%r2, %%r4, %%r5, 0x44 ; r2 = {f5 f4 e5 e4 f1 f0 e1 e0}
vshufps %%r4, %%r4, %%r5, 0xEE ; r4 = {f7 f6 e7 e6 f3 f2 e3 e2}
vshufps %%t1, %%r6, %%r7, 0x44 ; t1 = {h5 h4 g5 g4 h1 h0 g1 g0}
vshufps %%r6, %%r6, %%r7, 0xEE ; r6 = {h7 h6 g7 g6 h3 h2 g3 g2}
vshufps %%r7, %%r2, %%t1, 0xDD ; r7 = {h5 g5 f5 e5 h1 g1 f1 e1}
vshufps %%r5, %%r4, %%r6, 0x88 ; r5 = {h6 g6 f6 e6 h2 g2 f2 e2}
vshufps %%r4, %%r4, %%r6, 0xDD ; r4 = {h7 g7 f7 e7 h3 g3 f3 e3}
vshufps %%t1, %%r2, %%t1, 0x88 ; t1 = {h4 g4 f4 e4 h0 g0 f0 e0}
vperm2f128 %%r6, %%r5, %%r1, 0x13 ; h6...a6
vperm2f128 %%r2, %%r5, %%r1, 0x02 ; h2...a2
vperm2f128 %%r5, %%r7, %%r3, 0x13 ; h5...a5
vperm2f128 %%r1, %%r7, %%r3, 0x02 ; h1...a1
vperm2f128 %%r7, %%r4, %%r0, 0x13 ; h7...a7
vperm2f128 %%r3, %%r4, %%r0, 0x02 ; h3...a3
vperm2f128 %%r4, %%t1, %%t0, 0x13 ; h4...a4
vperm2f128 %%r0, %%t1, %%t0, 0x02 ; h0...a0
%endmacro
;;
;; Magic functions defined in FIPS 180-1
;;
;MAGIC_F0 MACRO regF:REQ,regB:REQ,regC:REQ,regD:REQ,regT:REQ ;; ((D ^ (B & (C ^ D)))
%macro MAGIC_F0 5
%define %%regF %1
%define %%regB %2
%define %%regC %3
%define %%regD %4
%define %%regT %5
;vmovdqa %%regF,%%regC
vpxor %%regF, %%regC,%%regD
vpand %%regF, %%regF,%%regB
vpxor %%regF, %%regF,%%regD
%endmacro
;MAGIC_F1 MACRO regF:REQ,regB:REQ,regC:REQ,regD:REQ,regT:REQ ;; (B ^ C ^ D)
%macro MAGIC_F1 5
%define %%regF %1
%define %%regB %2
%define %%regC %3
%define %%regD %4
%define %%regT %5
;vmovdqa %%regF,%%regD
vpxor %%regF,%%regD,%%regC
vpxor %%regF,%%regF,%%regB
%endmacro
;MAGIC_F2 MACRO regF:REQ,regB:REQ,regC:REQ,regD:REQ,regT:REQ ;; ((B & C) | (B & D) | (C & D))
%macro MAGIC_F2 5
%define %%regF %1
%define %%regB %2
%define %%regC %3
%define %%regD %4
%define %%regT %5
;vmovdqa %%regF,%%regB
;vmovdqa %%regT,%%regB
vpor %%regF,%%regB,%%regC
vpand %%regT,%%regB,%%regC
vpand %%regF,%%regF,%%regD
vpor %%regF,%%regF,%%regT
%endmacro
;MAGIC_F3 MACRO regF:REQ,regB:REQ,regC:REQ,regD:REQ,regT:REQ
%macro MAGIC_F3 5
%define %%regF %1
%define %%regB %2
%define %%regC %3
%define %%regD %4
%define %%regT %5
MAGIC_F1 %%regF,%%regB,%%regC,%%regD,%%regT
%endmacro
; PROLD reg, imm, tmp
%macro PROLD 3
%define %%reg %1
%define %%imm %2
%define %%tmp %3
;vmovdqa %%tmp, %%reg
vpsrld %%tmp, %%reg, (32-%%imm)
vpslld %%reg, %%reg, %%imm
vpor %%reg, %%reg, %%tmp
%endmacro
; PROLD reg, imm, tmp
%macro PROLD_nd 4
%define %%reg %1
%define %%imm %2
%define %%tmp %3
%define %%src %4
;vmovdqa %%tmp, %%reg
vpsrld %%tmp, %%src, (32-%%imm)
vpslld %%reg, %%src, %%imm
vpor %%reg, %%reg, %%tmp
%endmacro
%macro SHA1_STEP_00_15 10
%define %%regA %1
%define %%regB %2
%define %%regC %3
%define %%regD %4
%define %%regE %5
%define %%regT %6
%define %%regF %7
%define %%memW %8
%define %%immCNT %9
%define %%MAGIC %10
vpaddd %%regE, %%regE,%%immCNT
vpaddd %%regE, %%regE,[rsp + (%%memW * 32)]
;vmovdqa %%regT,%%regA
PROLD_nd %%regT,5, %%regF,%%regA
vpaddd %%regE, %%regE,%%regT
%%MAGIC %%regF,%%regB,%%regC,%%regD,%%regT ;; FUN = MAGIC_Fi(B,C,D)
PROLD %%regB,30, %%regT
vpaddd %%regE, %%regE,%%regF
%endmacro
%macro SHA1_STEP_16_79 10
%define %%regA %1
%define %%regB %2
%define %%regC %3
%define %%regD %4
%define %%regE %5
%define %%regT %6
%define %%regF %7
%define %%memW %8
%define %%immCNT %9
%define %%MAGIC %10
vpaddd %%regE, %%regE,%%immCNT
vmovdqa W14, [rsp + ((%%memW - 14) & 15) * 32]
vpxor W16, W16, W14
vpxor W16, W16, [rsp + ((%%memW - 8) & 15) * 32]
vpxor W16, W16, [rsp + ((%%memW - 3) & 15) * 32]
;vmovdqa %%regF, W16
vpsrld %%regF, W16, (32-1)
vpslld W16, W16, 1
vpor %%regF, %%regF, W16
ROTATE_W
vmovdqa [rsp + ((%%memW - 0) & 15) * 32],%%regF
vpaddd %%regE, %%regE,%%regF
;vmovdqa %%regT,%%regA
PROLD_nd %%regT,5, %%regF, %%regA
vpaddd %%regE, %%regE,%%regT
%%MAGIC %%regF,%%regB,%%regC,%%regD,%%regT ;; FUN = MAGIC_Fi(B,C,D)
PROLD %%regB,30, %%regT
vpaddd %%regE,%%regE,%%regF
%endmacro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%macro ROTATE_ARGS 0
%xdefine TMP_ E
%xdefine E D
%xdefine D C
%xdefine C B
%xdefine B A
%xdefine A TMP_
%endm
%macro ROTATE_W 0
%xdefine TMP_ W16
%xdefine W16 W15
%xdefine W15 W14
%xdefine W14 TMP_
%endm
align 32
; void sha1_x8_avx2(void *state, int num_blks)
; arg 1 : rcx : pointer to array[4] of pointer to input data
; arg 2 : rdx : size (in blocks) ;; assumed to be >= 1
MKGLOBAL(sha1_x8_avx2,function,internal)
sha1_x8_avx2:
sub rsp, FRAMESZ
;; Initialize digests
vmovdqu A, [state + 0*SHA1_DIGEST_ROW_SIZE]
vmovdqu B, [state + 1*SHA1_DIGEST_ROW_SIZE]
vmovdqu C, [state + 2*SHA1_DIGEST_ROW_SIZE]
vmovdqu D, [state + 3*SHA1_DIGEST_ROW_SIZE]
vmovdqu E, [state + 4*SHA1_DIGEST_ROW_SIZE]
DBGPRINTL_YMM "Sha1-AVX2 incoming transposed digest", A, B, C, D, E
;; transpose input onto stack
mov inp0,[state+_data_ptr_sha1+0*PTR_SZ]
mov inp1,[state+_data_ptr_sha1+1*PTR_SZ]
mov inp2,[state+_data_ptr_sha1+2*PTR_SZ]
mov inp3,[state+_data_ptr_sha1+3*PTR_SZ]
mov inp4,[state+_data_ptr_sha1+4*PTR_SZ]
mov inp5,[state+_data_ptr_sha1+5*PTR_SZ]
mov inp6,[state+_data_ptr_sha1+6*PTR_SZ]
mov inp7,[state+_data_ptr_sha1+7*PTR_SZ]
xor IDX, IDX
lloop:
vmovdqa F, [rel PSHUFFLE_BYTE_FLIP_MASK]
%assign I 0
%rep 2
VMOVPS T0,[inp0+IDX]
VMOVPS T1,[inp1+IDX]
VMOVPS T2,[inp2+IDX]
VMOVPS T3,[inp3+IDX]
VMOVPS T4,[inp4+IDX]
VMOVPS T5,[inp5+IDX]
VMOVPS T6,[inp6+IDX]
VMOVPS T7,[inp7+IDX]
TRANSPOSE8 T0, T1, T2, T3, T4, T5, T6, T7, T8, T9
DBGPRINTL_YMM "Sha1-AVX2 incoming transposed input", T0, T1, T2, T3, T4, T5, T6, T7, T8, T9
vpshufb T0, T0, F
vmovdqa [rsp+(I*8+0)*32],T0
vpshufb T1, T1, F
vmovdqa [rsp+(I*8+1)*32],T1
vpshufb T2, T2, F
vmovdqa [rsp+(I*8+2)*32],T2
vpshufb T3, T3, F
vmovdqa [rsp+(I*8+3)*32],T3
vpshufb T4, T4, F
vmovdqa [rsp+(I*8+4)*32],T4
vpshufb T5, T5, F
vmovdqa [rsp+(I*8+5)*32],T5
vpshufb T6, T6, F
vmovdqa [rsp+(I*8+6)*32],T6
vpshufb T7, T7, F
vmovdqa [rsp+(I*8+7)*32],T7
add IDX, 32
%assign I (I+1)
%endrep
; save old digests
vmovdqa AA, A
vmovdqa BB, B
vmovdqa CC, C
vmovdqa DD, D
vmovdqa EE, E
;;
;; perform 0-79 steps
;;
vmovdqa K, [rel K00_19]
;; do rounds 0...15
%assign I 0
%rep 16
SHA1_STEP_00_15 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F0
ROTATE_ARGS
%assign I (I+1)
%endrep
;; do rounds 16...19
vmovdqa W16, [rsp + ((16 - 16) & 15) * 32]
vmovdqa W15, [rsp + ((16 - 15) & 15) * 32]
%rep 4
SHA1_STEP_16_79 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F0
ROTATE_ARGS
%assign I (I+1)
%endrep
;; do rounds 20...39
vmovdqa K, [rel K20_39]
%rep 20
SHA1_STEP_16_79 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F1
ROTATE_ARGS
%assign I (I+1)
%endrep
;; do rounds 40...59
vmovdqa K, [rel K40_59]
%rep 20
SHA1_STEP_16_79 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F2
ROTATE_ARGS
%assign I (I+1)
%endrep
;; do rounds 60...79
vmovdqa K, [rel K60_79]
%rep 20
SHA1_STEP_16_79 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F3
ROTATE_ARGS
%assign I (I+1)
%endrep
vpaddd A,A,AA
vpaddd B,B,BB
vpaddd C,C,CC
vpaddd D,D,DD
vpaddd E,E,EE
sub num_blks, 1
jne lloop
; write out digests
vmovdqu [state + 0*SHA1_DIGEST_ROW_SIZE], A
vmovdqu [state + 1*SHA1_DIGEST_ROW_SIZE], B
vmovdqu [state + 2*SHA1_DIGEST_ROW_SIZE], C
vmovdqu [state + 3*SHA1_DIGEST_ROW_SIZE], D
vmovdqu [state + 4*SHA1_DIGEST_ROW_SIZE], E
DBGPRINTL_YMM "Sha1-AVX2 outgoing transposed digest", A, B, C, D, E
;; update input pointers
add inp0, IDX
add inp1, IDX
add inp2, IDX
add inp3, IDX
add inp4, IDX
add inp5, IDX
add inp6, IDX
add inp7, IDX
mov [state+_data_ptr_sha1+0*PTR_SZ], inp0
mov [state+_data_ptr_sha1+1*PTR_SZ], inp1
mov [state+_data_ptr_sha1+2*PTR_SZ], inp2
mov [state+_data_ptr_sha1+3*PTR_SZ], inp3
mov [state+_data_ptr_sha1+4*PTR_SZ], inp4
mov [state+_data_ptr_sha1+5*PTR_SZ], inp5
mov [state+_data_ptr_sha1+6*PTR_SZ], inp6
mov [state+_data_ptr_sha1+7*PTR_SZ], inp7
;;;;;;;;;;;;;;;;
;; Postamble
add rsp, FRAMESZ
ret
%ifdef LINUX
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
|
library/fmGUI_ManageScripts/fmGUI_ManageScripts_SearchBoxClear.applescript | NYHTC/applescript-fm-helper | 1 | 4502 | -- fmGUI_ManageScripts_SearchBoxClear({})
-- <NAME>, NYHTC
-- Clears the search box in the Script Workspace.
(*
HISTORY
2020-03-03 ( dshockley, hdu ): Updated as standalone function for fm-scripts git repository.
2017-06-02 ( eshagdar ): created
REQUIRES:
fmGUI_AppFrontMost
fmGUI_ManageScripts_Open
*)
on run
fmGUI_ManageScripts_SearchBoxClear({})
end run
--------------------
-- START OF CODE
--------------------
on fmGUI_ManageScripts_SearchBoxClear(prefs)
-- version 2020-03-03, <NAME>, NYHTC
try
fmGUI_AppFrontMost()
fmGUI_ManageScripts_Open({})
tell application "System Events"
tell application process "FileMaker Pro Advanced"
set searchField to text field 1 of splitter group 1 of window 1
if value of searchField is equal to "" then return true
set focused of searchField to true
keystroke "a" using command down
key code 51 -- clear the search box
return true
end tell
end tell
on error errMsg number errNum
error "Couldn't fmGUI_ManageScripts_SearchBoxClear - " & errMsg number errNum
end try
end fmGUI_ManageScripts_SearchBoxClear
--------------------
-- END OF CODE
--------------------
on fmGUI_AppFrontMost()
tell application "htcLib" to fmGUI_AppFrontMost()
end fmGUI_AppFrontMost
on fmGUI_ManageScripts_Open(prefs)
tell application "htcLib" to fmGUI_ManageScripts_Open(prefs)
end fmGUI_ManageScripts_Open
|
oeis/085/A085447.asm | neoneye/loda-programs | 11 | 176085 | <reponame>neoneye/loda-programs
; A085447: a(n) = 6*a(n-1) + a(n-2), starting with a(0)=2 and a(1)=6.
; Submitted by <NAME>
; 2,6,38,234,1442,8886,54758,337434,2079362,12813606,78960998,486579594,2998438562,18477210966,113861704358,701647437114,4323746327042,26644125399366,164188498723238,1011775117738794,6234839205156002,38420810348674806,236759701297204838,1458979018131903834,8990633810088627842,55402781878663670886,341407325082070653158,2103846732371087589834,12964487719308596192162,79890773048222664742806,492309126008644584648998,3033745529100090172636794,18694782300609185620469762,115202439332755203895455366
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
mul $2,3
add $3,$2
lpe
mov $0,$3
mul $0,2
|
mel/source/tasking/Process_X64_MSVC_asm.asm | dani-barrientos/dabal | 0 | 172614 | <reponame>dani-barrientos/dabal
.code
Attributes STRUCT
IniRSP QWORD ?;
StackEnd QWORD ?;
Stack QWORD ?;
RegBP QWORD ?;
RegBX QWORD ? ;
RegSI QWORD ? ;
RegDI QWORD ? ;
Reg12 QWORD ?
Reg13 QWORD ?
Reg14 QWORD ?
Reg15 QWORD ?
ALIGN 16
RegXMM6 OWORD ?
RegXMM7 OWORD ?
RegXMM8 OWORD ?
RegXMM9 OWORD ?
RegXMM10 OWORD ?
RegXMM11 OWORD ?
RegXMM12 OWORD ?
RegXMM13 OWORD ?
RegXMM14 OWORD ?
RegXMM15 OWORD ?
;Switched BYTE ? ; cuidado con alineamientos,claro!!!
Switched WORD ? ;
RegFPCSR WORD ?
RegMXCSR DWORD ?;
StackSize DWORD ?;
Attributes ENDS
EXTERN mel_tasking_resizeStack:PROC
;EXTERN Process_execute:PROC
;void _checkMicrothread(MThreadAttributtes*,uint64_t msegs,void* executePtr);
_checkMicrothread PROC
mov rax,rcx; //save rcx because it will be modified later
mov [rcx+Attributes.RegBP],rbp;
mov [rcx+Attributes.RegBX],rbx;
mov [rcx+Attributes.RegSI],rsi;
mov [rcx+Attributes.RegDI],rdi;
mov [rcx+Attributes.Reg12],r12;
mov [rcx+Attributes.Reg13],r13;
mov [rcx+Attributes.Reg14],r14;
mov [rcx+Attributes.Reg15],r15;
mov [rcx+Attributes.IniRSP],rsp;
;SSE2 registers 128 bits no-volatile
movdqa [rcx+Attributes.RegXMM6],xmm6
movdqa [rcx+Attributes.RegXMM7],xmm7
movdqa [rcx+Attributes.RegXMM8],xmm8
movdqa [rcx+Attributes.RegXMM9],xmm9
movdqa [rcx+Attributes.RegXMM10],xmm10
movdqa [rcx+Attributes.RegXMM11],xmm11
movdqa [rcx+Attributes.RegXMM12],xmm12
movdqa [rcx+Attributes.RegXMM13],xmm13
movdqa [rcx+Attributes.RegXMM14],xmm14
movdqa [rcx+Attributes.RegXMM15],xmm15
fnstcw [rcx+Attributes.RegFPCSR]
stmxcsr DWORD PTR [rcx+Attributes.RegMXCSR];
cmp BYTE PTR [rcx+Attributes.Switched],0
je continueExecuting_1
mov[rcx+Attributes.Switched],BYTE PTR 0
std
mov ecx,[rax+Attributes.StackSize]
shr ecx,3
sub rsp,8
mov rdi,rsp
mov rsi,[rax+Attributes.StackEnd]
sub rsi,8
rep movsq
mov rsp,rdi
add rsp,8
cld
movdqa xmm6,[rsp]
movdqa xmm7,[rsp+16]
movdqa xmm8,[rsp+32]
movdqa xmm9,[rsp+48]
movdqa xmm10,[rsp+64]
movdqa xmm11,[rsp+80]
movdqa xmm12,[rsp+96]
movdqa xmm13,[rsp+112]
movdqa xmm14,[rsp+128]
movdqa xmm15,[rsp+144]
ldmxcsr DWORD PTR [rsp+160];
fldcw [rsp+164]
add rsp,10*16+8
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbx
pop rbp
ret
continueExecuting_1:
mov rcx,rax
push r15
xor r15,r15
sub rsp,32 ;space for arguments, as defined by calling convention in MSVC
;check alignment
test rsp,0fh
jz callfunction
mov r15,8
sub rsp,8 ; //align
callfunction:
mov rcx,r8
call r9
;call Process_execute
add rsp,32
add rsp,r15
pop r15
ret
_checkMicrothread ENDP
;void _switchMT(MThreadAttributtes*)
_switchMT PROC
push rbp
push rbx
push rsi
push rdi
push r12
push r13
push r14
push r15
;at function call, stack must be aligned to 16 byte. rip "unalign it". so need to add another 8 bytes to the 10 xmm registers
sub rsp,10*16+8
movdqa [rsp],xmm6
movdqa [rsp+16],xmm7
movdqa [rsp+32],xmm8
movdqa [rsp+48],xmm9
movdqa [rsp+64],xmm10
movdqa [rsp+80],xmm11
movdqa [rsp+96],xmm12
movdqa [rsp+112],xmm13
movdqa [rsp+128],xmm14
movdqa [rsp+144],xmm15
stmxcsr DWORD PTR [rsp+160];
fnstcw [rsp+164]
mov r12,rcx ;MThreadAttributtes*
mov [r12+Attributes.Switched],BYTE PTR 1
mov r13,[r12+Attributes.IniRSP]
mov r14,r13
sub r14,8
sub r13,rsp
sub rsp,8
mov rdx,r13 ;//size parameter in ecx
sub rsp,32 ;space for arguments, as defined by calling convention in MSVC
mov r15,0
;check alignment
test rsp,0fh
jz callfunction
mov r15,8
sub rsp,8 ;if not aligned to 16, at least is aligned to 8 (sure??)
callfunction:
call mel_tasking_resizeStack
mov rcx,r13
mov rsi,r14
add rsp,32
add rsp,r15 ;add alignment
std
shr rcx,3
mov rdi,[r12+Attributes.StackEnd]
sub rdi,8
rep movsq
cld
mov rsp,[r12+Attributes.IniRSP]
mov rbp,[r12+Attributes.RegBP]
mov rbx,[r12+Attributes.RegBX]
mov rsi,[r12+Attributes.RegSI]
mov rdi,[r12+Attributes.RegDI]
mov r13,[r12+Attributes.Reg13]
mov r14,[r12+Attributes.Reg14]
mov r15,[r12+Attributes.Reg15]
movdqa xmm6,[r12+Attributes.RegXMM6]
movdqa xmm7,[r12+Attributes.RegXMM7]
movdqa xmm8,[r12+Attributes.RegXMM8]
movdqa xmm9,[r12+Attributes.RegXMM9]
movdqa xmm10,[r12+Attributes.RegXMM10]
movdqa xmm11,[r12+Attributes.RegXMM11]
movdqa xmm12,[r12+Attributes.RegXMM12]
movdqa xmm13,[r12+Attributes.RegXMM13]
movdqa xmm14,[r12+Attributes.RegXMM14]
movdqa xmm15,[r12+Attributes.RegXMM15]
fldcw [r12+Attributes.RegFPCSR];
ldmxcsr DWORD PTR [r12+Attributes.RegMXCSR];
mov r12,[r12+Attributes.Reg12]
ret
_switchMT ENDP
END |
source/a-sbtwst.ads | ytomino/drake | 33 | 14250 | <filename>source/a-sbtwst.ads
pragma License (Unrestricted);
-- extended unit
package Ada.Streams.Block_Transmission.Wide_Strings is
-- There are efficient streaming operations for Wide_String.
pragma Pure;
procedure Read is
new Block_Transmission.Read (Positive, Wide_Character, Wide_String);
procedure Write is
new Block_Transmission.Write (Positive, Wide_Character, Wide_String);
end Ada.Streams.Block_Transmission.Wide_Strings;
|
programs/oeis/242/A242669.asm | neoneye/loda | 22 | 175111 | <gh_stars>10-100
; A242669: a(n) = n*floor(n/3).
; 0,0,0,3,4,5,12,14,16,27,30,33,48,52,56,75,80,85,108,114,120,147,154,161,192,200,208,243,252,261,300,310,320,363,374,385,432,444,456,507,520,533,588,602,616,675,690,705,768,784,800,867,884,901,972,990,1008,1083,1102,1121,1200,1220,1240,1323,1344,1365,1452,1474,1496,1587,1610,1633,1728,1752,1776,1875,1900,1925,2028,2054,2080,2187,2214,2241,2352,2380,2408,2523,2552,2581,2700,2730,2760,2883,2914,2945,3072,3104,3136,3267
mov $1,$0
div $1,3
mul $0,$1
|
programs/oeis/113/A113047.asm | neoneye/loda | 22 | 92864 | <filename>programs/oeis/113/A113047.asm<gh_stars>10-100
; A113047: a(n) = C(3n,n)/(2n+1) mod 3.
; 1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
lpb $0
sub $0,1
mul $0,2
dif $0,6
lpe
cmp $0,0
|
programs/oeis/132/A132171.asm | karttu/loda | 0 | 160717 | <reponame>karttu/loda
; A132171: 3^n repeated 3^n times.
; 1,3,3,3,9,9,9,9,9,9,9,9,9,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243
lpb $0,1
sub $0,1
add $1,2
trn $0,$1
mul $1,3
lpe
div $1,6
mul $1,2
add $1,1
|
Appl/Saver/Hopalong/HopalongPrefVM/hopalongpref.asm | steakknife/pcgeos | 504 | 80540 | <gh_stars>100-1000
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1994 -- All Rights Reserved
PROJECT:
MODULE:
FILE: hopalongpref.asm
AUTHOR: <NAME>, Dec 3, 1992
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Adam 12/ 3/92 Initial revision
DESCRIPTION:
Saver-specific preferences for Hopalong driver.
$Id: hopalongpref.asm,v 1.1 97/04/04 16:45:00 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
; include the standard suspects
include geos.def
include geode.def
include lmem.def
include object.def
include graphics.def
include gstring.def
UseLib ui.def
include vmdef.def ; contains macros that allow us to create a
; VM file in this way.
UseLib config.def ; Most objects we use come from here
UseLib saver.def ; Might need some of the constants from
; here, though we can't use objects from here.
;
; Define the VMAttributes used for the file.
;
ATTRIBUTES equ PREFVM_ATTRIBUTES
;
; Include constants from Hopalong, the saver, for use in our objects.
;
include ../hopalong.def
;
; Now the object tree.
;
include hopalongpref.rdef
;
; Define the map block for the VM file, which Preferences will use to get
; to the root of the tree we hold.
;
DefVMBlock MapBlock
PrefVMMapBlock <RootObject>
EndVMBlock MapBlock
|
src/ant_handler.adb | Ingen-ear/Formica | 0 | 11137 | package body Ant_Handler with SPARK_Mode => On
is
function Do_Something (Text : String) return String
is begin
return Text;
end Do_Something;
end Ant_Handler;
|
src/InnerProduct.agda | cspollard/diff | 0 | 7634 | {-# OPTIONS --allow-unsolved-metas #-}
module InnerProduct where
open import Algebra.Bundles using (CommutativeRing)
open import NormedModule using (NormedModule)
open import Level using (_⊔_; suc)
open import Relation.Nullary using (¬_)
module _
{r ℓr} (CR : CommutativeRing r ℓr)
m ℓm rel
where
module _
{r ℓr} {CR : CommutativeRing r ℓr}
(open CommutativeRing CR renaming (Carrier to S))
{rel} {_<_ : S → S → Set rel} (STO : IsStrictTotalOrder _≈_ _<_)
(_† : S → S)
{m ℓm} (M : Module CR m ℓm)
(open Module M renaming (Carrierᴹ to A))
(⟨_,_⟩ : A → A → S)
where
record IsInnerProduct : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm ⊔ rel)) where
field
⟨,⟩-linear-+ : ∀ x y z → ⟨ x +ᴹ y , z ⟩ ≈ ⟨ x , z ⟩ + ⟨ y , z ⟩
⟨,⟩-linear-* : ∀ s x y → ⟨ s *ₗ x , y ⟩ ≈ s * ⟨ x , y ⟩
⟨,⟩-cong : ∀ {x y} → x ≈ᴹ y → ⟨ x , x ⟩ ≈ ⟨ y , y ⟩
†-linear-+ : ∀ x y → (x + y) † ≈ x † + y †
†-cong : ∀ {s t} → s ≈ t → s † ≈ t †
†-inv : ∀ s → (s †) † ≈ s
⟨,⟩-herm : ∀ x y → ⟨ x , y ⟩ ≈ ⟨ y , x ⟩ †
real : S → Set _
real s = s ≈ s †
field
⟨x,x⟩-real : ∀ x → real ⟨ x , x ⟩
positive-definite : ∀ {x} → ¬ (x ≈ᴹ 0ᴹ) → 0# < ⟨ x , x ⟩
open IsStrictTotalOrder STO public
open import Relation.Binary.Construct.StrictToNonStrict _≈_ _<_ public using (_≤_)
_-ᴹ_ : A → A → A
x -ᴹ y = x +ᴹ (-ᴹ y)
∥_∥² : A → S
∥ x ∥² = ⟨ x , x ⟩
-- TODO
-- is this universally true?
-- or just common?
∥-x∥²≈∥x∥² : ∀ x → ∥ -ᴹ x ∥² ≈ ∥ x ∥²
∥-x∥²≈∥x∥² = {! !}
-- ∥a-b∥≤∥a∥-∥b∥ : ∀ a b → ∥ a -ᴹ b ∥² ≤ ∥ a ∥² - ∥ b ∥²
-- ∥a-b∥≤∥a∥-∥b∥ = {! !}
[s+s†]†≈s+s† : ∀ s → (s + s †) † ≈ s + s †
[s+s†]†≈s+s† s =
begin
(s + s †) †
≈⟨ †-linear-+ s (s †) ⟩
(s † + (s †) †)
≈⟨ +-cong refl (†-inv _) ⟩
(s † + s)
≈⟨ +-comm _ _ ⟩
(s + s †)
∎
where open import Relation.Binary.Reasoning.Setoid setoid
|
libsrc/stdlib/inp.asm | jpoikela/z88dk | 38 | 178807 | <gh_stars>10-100
; uchar __FASTCALL__ inp(uint port)
; 09.2005 aralbrec
SECTION code_clib
PUBLIC inp
PUBLIC _inp
.inp
._inp
IF __CPU_R2K__|__CPU_R3K__
defb 0d3h ; ioi
ld a,(hl)
ld h,0
ld l,a
ELSE
ld c,l
ld b,h
in l,(c)
ld h,0
ENDIF
ret
|
21-Big-Data.speed.size.asm | blueset/7bh-solutions | 0 | 241580 | -- 7 Billion Humans --
-- 21: Big Data --
-- Size: 9/9 --
-- Speed: 29/37 --
a:
if s != printer:
step s
jump a
endif
b:
takefrom s
if myitem < 50:
giveto sw
step e
jump b
endif
step nw
c:
|
3-mid/opengl/applet/test/suite/egl/linkage/launch_egl_linkage_test.adb | charlie5/lace | 20 | 18898 | with
eGL.Binding,
Swig,
interfaces.C.Strings,
System;
procedure launch_egl_linkage_Test
--
-- Tests linkage to eGL functions.
-- Is not meant to be run.
--
is
use eGL,
eGL.Binding,
System;
an_EGLint : EGLint;
an_EGLdisplay : EGLdisplay;
an_EGLboolean : EGLboolean;
an_EGLsurface : EGLsurface;
an_EGLcontext : EGLcontext;
a_chars_ptr : interfaces.C.strings.chars_ptr;
a_void_ptr : swig.void_ptr;
an_EGLdisplay_pointer : access EGLdisplay;
begin
an_EGLint := eglGetError;
an_EGLdisplay := eglGetDisplay (null);
an_EGLboolean := eglInitialize (null_Address, null, null);
an_EGLboolean := eglTerminate (null_Address);
a_chars_ptr := eglQueryString (null_Address, 0);
an_EGLboolean := eglGetConfigs (null_Address, null, 0, null);
an_EGLboolean := eglChooseConfig (null_Address, null, null, 0, null);
an_EGLboolean := eglGetConfigAttrib (null_Address, null_Address, 0, null);
an_EGLsurface := eglCreateWindowSurface (null_Address, null_Address, 0, null);
an_EGLsurface := eglCreatePbufferSurface (null_Address, null_Address, null);
an_EGLsurface := eglCreatePixmapSurface (null_Address, null_Address, 0, null);
an_EGLboolean := eglDestroySurface (null_Address, null_Address);
an_EGLboolean := eglQuerySurface (null_Address, null_Address, 0, null);
an_EGLboolean := eglBindAPI (0);
an_EGLboolean := eglQueryAPI;
an_EGLboolean := eglWaitClient;
an_EGLboolean := eglReleaseThread;
an_EGLsurface := eglCreatePbufferFromClientBuffer
(null_Address, 0, null_Address, null_Address, null);
an_EGLboolean := eglSurfaceAttrib (null_Address, null_Address, 0, 0);
an_EGLboolean := eglBindTexImage (null_Address, null_Address, 0);
an_EGLboolean := eglReleaseTexImage (null_Address, null_Address, 0);
an_EGLboolean := eglSwapInterval (null_Address, 0);
an_EGLcontext := eglCreateContext (null_Address, null_Address, null_Address, null);
an_EGLboolean := eglDestroyContext (null_Address, null_Address);
an_EGLboolean := eglMakeCurrent (null_Address, null_Address, null_Address, null_Address);
an_EGLcontext := eglGetCurrentContext;
an_EGLsurface := eglGetCurrentSurface (0);
an_EGLdisplay := eglGetCurrentDisplay;
an_EGLboolean := eglQueryContext (null_Address, null_Address, 0, null);
an_EGLboolean := eglWaitGL;
an_EGLboolean := eglWaitNative (0);
an_EGLboolean := eglSwapBuffers (null_Address, null_Address);
an_EGLboolean := eglCopyBuffers (null_Address, null_Address, 0);
a_void_ptr := eglGetProcAddress (Interfaces.C.Strings.null_ptr);
an_EGLdisplay_pointer
:= egl_DEFAULT_DISPLAY;
an_EGLcontext := egl_NO_CONTEXT;
an_EGLdisplay := egl_NO_DISPLAY;
an_EGLsurface := egl_NO_SURFACE;
an_EGLint := egl_DONT_CARE;
end launch_egl_linkage_Test;
|
programs/oeis/066/A066237.asm | neoneye/loda | 22 | 92902 | ; A066237: First differences give A052849.
; 1,3,7,19,67,307,1747,11827,92467,818227,8075827,87909427,1045912627,13499954227,187856536627,2803205272627,44648785048627,756023641240627,13560771052696627,256850971870360627,5122654988223640627
lpb $0
add $1,1
mul $1,$0
sub $0,1
lpe
mul $1,2
add $1,1
mov $0,$1
|
oeis/016/A016939.asm | neoneye/loda-programs | 11 | 98266 | ; A016939: a(n) = (6n+2)^7.
; 128,2097152,105413504,1280000000,8031810176,34359738368,114415582592,319277809664,781250000000,1727094849536,3521614606208,6722988818432,12151280273024,20971520000000,34792782221696,55784660123648,86812553324672,131593177923584,194871710000000,282621973446656,402271083010688,562949953421312,775771085481344,1054135040000000,1414067010444416,1874584905187328,2458100350228352,3190854023266304,4103386730000000,5231047633534976,6614541047773568,8300513205665792,10342180413198464,12800000000000000
mul $0,6
add $0,2
pow $0,7
|
software/hal/hpl/STM32/drivers/i2c_stm32f7/stm32-i2c.adb | TUM-EI-RCS/StratoX | 12 | 20038 | ------------------------------------------------------------------------------
-- --
-- Standard Peripheral Library for STM32 Targets --
-- --
-- Copyright (C) 2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Real_Time; use Ada.Real_Time;
with STM32_SVD.I2C; use STM32_SVD.I2C;
with STM32_SVD.RCC; use STM32_SVD.RCC;
with STM32.RCC;
with HAL.I2C; use HAL.I2C;
package body STM32.I2C is
type I2C_Transfer_Mode is
(Reload_Mode, -- Enable reload mode
Autoend_Mode, -- Enable automatic end mode
Softend_Mode); -- Enable software end mode
type I2C_Request is
(No_Start_Stop, -- Don't generate start or stop
Generate_Stop, -- Generate a stop condition
Generate_Start_Read, -- Generate a start read request
Generate_Start_Write); -- Generate a start write request
procedure Config_Transfer
(Port : in out I2C_Port;
Addr : I2C_Address;
Size : Byte;
Mode : I2C_Transfer_Mode;
Request : I2C_Request);
procedure Reset_Config (Port : in out I2C_Port);
procedure Check_Nack
(Port : in out I2C_Port;
Timeout : Natural;
Status : out HAL.I2C.I2C_Status);
procedure Wait_Tx_Interrupt_Status
(Port : in out I2C_Port;
Timeout : Natural;
Status : out I2C_Status);
procedure Wait_Transfer_Complete_Reset_Flag
(Port : in out I2C_Port;
Timeout : Natural;
Status : out I2C_Status);
procedure Wait_Stop_Flag
(Port : in out I2C_Port;
Timeout : Natural;
Status : out I2C_Status);
------------------
-- Port_Enabled --
------------------
function Port_Enabled (Port : I2C_Port) return Boolean
is
begin
return Port.Periph.CR1.PE;
end Port_Enabled;
---------------
-- Configure --
---------------
procedure Configure
(Port : in out I2C_Port;
Configuration : I2C_Configuration)
is
begin
if Port.State /= Reset then
return;
end if;
Port.Config := Configuration;
STM32.RCC.Enable_Clock (STM32_SVD.I2C.I2C_Peripheral (Port.Periph.all));
STM32.RCC.Reset (STM32_SVD.I2C.I2C_Peripheral (Port.Periph.all));
-- Disable the I2C port
Port.Periph.CR1.PE := False;
-- Reset the timing register to 100_000 Hz
Port.Periph.TIMINGR :=
(SCLL => 50,
SCLH => 39,
SDADEL => 1,
SCLDEL => 9,
PRESC => 4,
others => <>);
-- I2C Own Address Register configuration
if Configuration.Own_Address /= 0 then
Port.Periph.OAR1 :=
(OA1 => Configuration.Own_Address,
OA1EN => True,
OA1MODE => Configuration.Addressing_Mode = Addressing_Mode_10bit,
others => <>);
end if;
-- CR2 configuration
-- Enable AUTOEND by default, set NACK (should be disabled only in
-- slave mode
Port.Periph.CR2 :=
(AUTOEND => True,
NACK => True,
ADD10 => Configuration.Addressing_Mode = Addressing_Mode_10bit,
others => <>);
-- OAR2 configuration
-- ??? Add support for dual addressing
Port.Periph.OAR2 := (others => <>);
-- CR1 configuration
Port.Periph.CR1 :=
(GCEN => Configuration.General_Call_Enabled,
NOSTRETCH => Configuration.Clock_Stretching_Enabled,
others => <>);
Port.State := Ready;
-- Enable the port
Port.Periph.CR1.PE := True;
end Configure;
-------------------
-- Is_Configured --
-------------------
function Is_Configured (Port : I2C_Port) return Boolean
is
begin
return Port.State /= Reset;
end Is_Configured;
---------------------
-- Config_Transfer --
---------------------
procedure Config_Transfer
(Port : in out I2C_Port;
Addr : I2C_Address;
Size : Byte;
Mode : I2C_Transfer_Mode;
Request : I2C_Request)
is
CR2 : CR2_Register := Port.Periph.CR2;
begin
CR2.SADD := UInt10 (Addr);
CR2.NBYTES := Size;
CR2.RELOAD := Mode = Reload_Mode;
CR2.AUTOEND := Mode = Autoend_Mode;
CR2.RD_WRN := False;
CR2.START := False;
CR2.STOP := False;
case Request is
when No_Start_Stop =>
null;
when Generate_Stop =>
CR2.STOP := True;
when Generate_Start_Read =>
CR2.RD_WRN := True;
CR2.START := True;
when Generate_Start_Write =>
CR2.START := True;
end case;
Port.Periph.CR2 := CR2;
end Config_Transfer;
------------------
-- Reset_Config --
------------------
procedure Reset_Config (Port : in out I2C_Port)
is
CR2 : CR2_Register := Port.Periph.CR2;
begin
CR2.SADD := 0;
CR2.HEAD10R := False;
CR2.NBYTES := 0;
CR2.RELOAD := False;
CR2.RD_WRN := False;
Port.Periph.CR2 := CR2;
end Reset_Config;
----------------
-- Check_Nack --
----------------
procedure Check_Nack
(Port : in out I2C_Port;
Timeout : Natural;
Status : out I2C_Status)
is
Start : constant Time := Clock;
begin
if Port.Periph.ISR.NACKF then
if Port.State = Master_Busy_Tx
or else Port.State = Mem_Busy_Tx
or else Port.State = Mem_Busy_Rx
then
-- We generate a STOP condition if SOFTEND mode is enabled
if not Port.Periph.CR2.AUTOEND then
Port.Periph.CR2.STOP := True;
end if;
end if;
while not Port.Periph.ISR.STOPF loop
if Timeout > 0
and then Start + Milliseconds (Timeout) < Clock
then
Port.State := Ready;
Status := Err_Timeout;
return;
end if;
end loop;
-- Clear the MACL amd STOP flags
Port.Periph.ICR.NACKCF := True;
Port.Periph.ICR.STOPCF := True;
-- Clear CR2
Reset_Config (Port);
Port.State := Ready;
Status := Err_Error;
else
Status := Ok;
end if;
end Check_Nack;
------------------------------
-- Wait_Tx_Interrupt_Status --
------------------------------
procedure Wait_Tx_Interrupt_Status
(Port : in out I2C_Port;
Timeout : Natural;
Status : out I2C_Status)
is
Start : constant Time := Clock;
begin
while not Port.Periph.ISR.TXIS loop
Check_Nack (Port, Timeout, Status);
if Status /= Ok then
Port.State := Ready;
Status := Err_Error;
return;
end if;
if Timeout > 0
and then Start + Milliseconds (Timeout) < Clock
then
Reset_Config (Port);
Port.State := Ready;
Status := Err_Timeout;
return;
end if;
end loop;
Status := Ok;
end Wait_Tx_Interrupt_Status;
---------------------------------------
-- Wait_Transfer_Complete_Reset_Flag --
---------------------------------------
procedure Wait_Transfer_Complete_Reset_Flag
(Port : in out I2C_Port;
Timeout : Natural;
Status : out I2C_Status)
is
Start : constant Time := Clock;
begin
while not Port.Periph.ISR.TCR loop
if Timeout > 0
and then Start + Milliseconds (Timeout) < Clock
then
Reset_Config (Port);
Status := Err_Timeout;
Port.State := Ready;
return;
end if;
end loop;
Status := Ok;
end Wait_Transfer_Complete_Reset_Flag;
--------------------
-- Wait_Stop_Flag --
--------------------
procedure Wait_Stop_Flag
(Port : in out I2C_Port;
Timeout : Natural;
Status : out I2C_Status)
is
Start : constant Time := Clock;
begin
while not Port.Periph.ISR.STOPF loop
Check_Nack (Port, Timeout, Status);
if Status /= Ok then
Port.State := Ready;
Status := Err_Error;
return;
end if;
if Timeout > 0
and then Start + Milliseconds (Timeout) < Clock
then
Reset_Config (Port);
Status := Err_Timeout;
Port.State := Ready;
return;
end if;
end loop;
-- Clear the stop flag
Port.Periph.ICR.STOPCF := True;
Status := Ok;
end Wait_Stop_Flag;
---------------------
-- Master_Transmit --
---------------------
overriding
procedure Master_Transmit
(Port : in out I2C_Port;
Addr : I2C_Address;
Data : I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000)
is
Size_Temp : Natural := 0;
Transmitted : Natural := 0;
begin
if Port.Periph.ISR.BUSY then
Status := Busy;
return;
end if;
if Data'Length = 0 then
Status := Err_Error;
return;
end if;
if Port.State /= Ready then
Status := Busy;
return;
end if;
Port.State := Master_Busy_Tx;
-- Initiate the transfer
if Data'Length > 255 then
Config_Transfer
(Port, Addr, 255, Reload_Mode, Generate_Start_Write);
Size_Temp := 255;
else
Config_Transfer
(Port, Addr, Data'Length, Autoend_Mode, Generate_Start_Write);
Size_Temp := Data'Length;
end if;
-- Transfer the data
while Transmitted <= Data'Length loop
Wait_Tx_Interrupt_Status (Port, Timeout, Status);
if Status /= Ok then
return;
end if;
Port.Periph.TXDR.TXDATA := Data (Data'First + Transmitted);
Transmitted := Transmitted + 1;
if Transmitted = Size_Temp
and then Transmitted < Data'Length
then
-- Wait for the Transfer complete reload flag
Wait_Transfer_Complete_Reset_Flag (Port, Timeout, Status);
if Status /= Ok then
return;
end if;
if Data'Length - Transmitted > 255 then
Config_Transfer
(Port, Addr, 255, Reload_Mode, No_Start_Stop);
Size_Temp := 255;
else
Config_Transfer
(Port, Addr, Byte (Data'Length - Transmitted), Autoend_Mode,
No_Start_Stop);
Size_Temp := Data'Length - Transmitted;
end if;
end if;
end loop;
Wait_Stop_Flag (Port, Timeout, Status);
if Status /= Ok then
return;
end if;
-- Reset CR2
Reset_Config (Port);
Port.State := Ready;
Status := Ok;
end Master_Transmit;
--------------------
-- Master_Receive --
--------------------
overriding
procedure Master_Receive
(Port : in out I2C_Port;
Addr : I2C_Address;
Data : out I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000)
is
Size_Temp : Natural := 0;
Transmitted : Natural := 0;
begin
if Port.Periph.ISR.BUSY then
Status := Busy;
return;
end if;
if Port.State /= Ready then
Status := Busy;
return;
end if;
Port.State := Master_Busy_Rx;
if Data'Length = 0 then
Status := Err_Error;
return;
end if;
-- Initiate the transfer
if Data'Length > 255 then
Config_Transfer
(Port, Addr, 255, Reload_Mode, Generate_Start_Read);
Size_Temp := 255;
else
Config_Transfer
(Port, Addr, Data'Length, Autoend_Mode, Generate_Start_Read);
Size_Temp := Data'Length;
end if;
-- Transfer the data
while Transmitted < Data'Length loop
while not Port.Periph.ISR.RXNE loop
null;
end loop;
Data (Data'First + Transmitted) := Port.Periph.RXDR.RXDATA;
Transmitted := Transmitted + 1;
Size_Temp := Size_Temp - 1;
if Size_Temp = 0
and then Transmitted < Data'Length
then
-- Wait for the Transfer complete reload flag
while Port.Periph.ISR.TCR loop
null;
end loop;
if Data'Length - Transmitted > 255 then
Config_Transfer
(Port, Addr, 255, Reload_Mode, No_Start_Stop);
Size_Temp := 255;
else
Config_Transfer
(Port, Addr, Byte (Data'Length - Transmitted), Autoend_Mode,
No_Start_Stop);
Size_Temp := Data'Length - Transmitted;
end if;
end if;
end loop;
Wait_Stop_Flag (Port, Timeout, Status);
if Status /= Ok then
return;
end if;
-- Reset CR2
Reset_Config (Port);
Port.State := Ready;
Status := Ok;
end Master_Receive;
---------------
-- Mem_Write --
---------------
overriding
procedure Mem_Write
(Port : in out I2C_Port;
Addr : I2C_Address;
Mem_Addr : Short;
Mem_Addr_Size : I2C_Memory_Address_Size;
Data : I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000)
is
Size_Temp : Natural := 0;
Transmitted : Natural := 0;
begin
if Port.Periph.ISR.BUSY then
Status := Busy;
return;
end if;
if Data'Length = 0 then
Status := Err_Error;
return;
end if;
if Port.State /= Ready then
Status := Busy;
return;
end if;
Port.State := Mem_Busy_Tx;
-- Configure the memory transfer
Config_Transfer
(Port,
Addr,
(case Mem_Addr_Size is
when Memory_Size_8b => 1,
when Memory_Size_16b => 2),
Reload_Mode,
Generate_Start_Write);
Wait_Tx_Interrupt_Status (Port, Timeout, Status);
if Status /= Ok then
Port.State := Ready;
return;
end if;
case Mem_Addr_Size is
when Memory_Size_8b =>
Port.Periph.TXDR.TXDATA := Byte (Mem_Addr);
when Memory_Size_16b =>
declare
MSB : constant Byte := Byte (Shift_Right (Mem_Addr, 8));
LSB : constant Byte := Byte (Mem_Addr and 16#FF#);
begin
Port.Periph.TXDR.TXDATA := MSB;
Wait_Tx_Interrupt_Status (Port, Timeout, Status);
if Status /= Ok then
return;
end if;
Port.Periph.TXDR.TXDATA := LSB;
end;
end case;
Wait_Transfer_Complete_Reset_Flag (Port, Timeout, Status);
if Status /= Ok then
return;
end if;
-- Initiate the transfer
if Data'Length > 255 then
Config_Transfer
(Port, Addr, 255, Reload_Mode, No_Start_Stop);
Size_Temp := 255;
else
Config_Transfer
(Port, Addr, Data'Length, Autoend_Mode, No_Start_Stop);
Size_Temp := Data'Length;
end if;
-- Transfer the data
while Transmitted < Data'Length loop
Wait_Tx_Interrupt_Status (Port, Timeout, Status);
if Status /= Ok then
return;
end if;
Port.Periph.TXDR.TXDATA := Data (Data'First + Transmitted);
Transmitted := Transmitted + 1;
if Transmitted = Size_Temp
and then Transmitted < Data'Length
then
-- Wait for the Transfer complete reload flag
Wait_Transfer_Complete_Reset_Flag (Port, Timeout, Status);
if Status /= Ok then
return;
end if;
if Data'Length - Transmitted > 255 then
Config_Transfer
(Port, Addr, 255, Reload_Mode, No_Start_Stop);
Size_Temp := 255;
else
Config_Transfer
(Port, Addr,
Byte (Data'Length - Transmitted),
Autoend_Mode,
No_Start_Stop);
Size_Temp := Data'Length - Transmitted;
end if;
end if;
end loop;
Wait_Stop_Flag (Port, Timeout, Status);
if Status /= Ok then
return;
end if;
-- Reset CR2
Reset_Config (Port);
Port.State := Ready;
Status := Ok;
end Mem_Write;
--------------
-- Mem_Read --
--------------
overriding
procedure Mem_Read
(Port : in out I2C_Port;
Addr : I2C_Address;
Mem_Addr : Short;
Mem_Addr_Size : I2C_Memory_Address_Size;
Data : out I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000)
is
Size_Temp : Natural := 0;
Transmitted : Natural := 0;
begin
if Port.Periph.ISR.BUSY then
Status := Busy;
return;
end if;
if Data'Length = 0 then
Status := Err_Error;
return;
end if;
if Port.State /= Ready then
Status := Busy;
return;
end if;
Port.State := Mem_Busy_Rx;
-- Configure the memory transfer
Config_Transfer
(Port,
Addr,
(case Mem_Addr_Size is
when Memory_Size_8b => 1,
when Memory_Size_16b => 2),
Softend_Mode,
Generate_Start_Write);
Wait_Tx_Interrupt_Status (Port, Timeout, Status);
if Status /= Ok then
return;
end if;
case Mem_Addr_Size is
when Memory_Size_8b =>
Port.Periph.TXDR.TXDATA := Byte (Mem_Addr);
when Memory_Size_16b =>
declare
MSB : constant Byte := Byte (Shift_Right (Mem_Addr, 8));
LSB : constant Byte := Byte (Mem_Addr and 16#FF#);
begin
Port.Periph.TXDR.TXDATA := MSB;
Wait_Tx_Interrupt_Status (Port, Timeout, Status);
if Status /= Ok then
return;
end if;
Port.Periph.TXDR.TXDATA := LSB;
end;
end case;
-- Wait for transfer complete
while not Port.Periph.ISR.TC loop
null;
end loop;
-- Initiate the transfer
if Data'Length > 255 then
Config_Transfer
(Port, Addr, 255, Reload_Mode, Generate_Start_Read);
Size_Temp := 255;
else
Config_Transfer
(Port, Addr, Data'Length, Autoend_Mode, Generate_Start_Read);
Size_Temp := Data'Length;
end if;
-- Transfer the data
while Transmitted < Data'Length loop
while not Port.Periph.ISR.RXNE loop
null;
end loop;
Data (Data'First + Transmitted) := Port.Periph.RXDR.RXDATA;
Transmitted := Transmitted + 1;
Size_Temp := Size_Temp - 1;
if Size_Temp = 0
and then Transmitted < Data'Length
then
-- Wait for the Transfer complete reload flag
while not Port.Periph.ISR.TCR loop
null;
end loop;
if Data'Length - Transmitted > 255 then
Config_Transfer
(Port, Addr, 255, Reload_Mode, No_Start_Stop);
Size_Temp := 255;
else
Config_Transfer
(Port, Addr,
Byte (Data'Length - Transmitted),
Autoend_Mode,
No_Start_Stop);
Size_Temp := Data'Length - Transmitted;
end if;
end if;
end loop;
Wait_Stop_Flag (Port, Timeout, Status);
if Status /= Ok then
return;
end if;
-- Reset CR2
Reset_Config (Port);
Port.State := Ready;
Status := Ok;
end Mem_Read;
end STM32.I2C;
|
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sccz80/modf.asm | meesokim/z88dk | 0 | 165125 | <reponame>meesokim/z88dk<gh_stars>0
SECTION code_fp_math48
PUBLIC modf
EXTERN cm48_sccz80_modf
defc modf = cm48_sccz80_modf
|
Cubical/Codata/M/Bisimilarity.agda | dan-iel-lee/cubical | 0 | 10755 | {-# OPTIONS --cubical --no-import-sorts --postfix-projections #-}
module Cubical.Codata.M.Bisimilarity where
open import Cubical.Core.Everything
open import Cubical.Codata.M
open import Cubical.Foundations.Equiv.Fiberwise
open import Cubical.Foundations.Everything
open Helpers using (J')
-- Bisimilarity as a coinductive record type.
record _≈_ {X : Type₀} {C : IxCont X} {x : X} (a b : M C x) : Type₀ where
coinductive
constructor _,_
field
head≈ : a .head ≡ b .head
tails≈ : ∀ y → (pa : C .snd x (a .head) y) (pb : C .snd x (b .head) y)
→ (\ i → C .snd x (head≈ i) y) [ pa ≡ pb ]
→ a .tails y pa ≈ b .tails y pb
open _≈_ public
module _ {X : Type₀} {C : IxCont X} where
-- Here we show that `a ≡ b` and `a ≈ b` are equivalent.
--
-- A direct construction of an isomorphism, like we do for streams,
-- would be complicated by the type dependencies between the fields
-- of `M C x` and even more so between the fields of the bisimilarity relation itself.
--
-- Instead we rely on theorem 4.7.7 of the HoTT book (fiberwise equivalences) to show that `misib` is an equivalence.
misib : {x : X} (a b : M C x) → a ≡ b → a ≈ b
misib a b eq .head≈ i = eq i .head
misib a b eq .tails≈ y pa pb q = misib (a .tails y pa) (b .tails y pb) (\ i → eq i .tails y (q i))
-- With `a` fixed, `misib` is a fiberwise transformation between (a ≡_) and (a ≈_).
--
-- We show that the induced map on the total spaces is an
-- equivalence because it is a map of contractible types.
--
-- The domain is the HoTT singleton type, so contractible, while the
-- codomain is shown to be contractible by `contr-T` below.
T : ∀ {x} → M C x → Type _
T a = Σ (M C _) \ b → a ≈ b
private
lemma : ∀ {A} (B : Type₀) (P : A ≡ B) (pa : P i0) (pb : P i1) (peq : PathP (\ i → P i) pa pb)
→ PathP (\ i → PathP (\ j → P j) (transp (\ k → P (~ k ∧ i)) (~ i) (peq i)) pb)
peq
(\ j → transp (\ k → P (~ k ∨ j)) j pb)
lemma {A} = J' _ \ pa → J' _ \ { i j → transp (\ _ → A) (~ i ∨ j) pa }
-- We predefine `u'` so that Agda will agree that `contr-T-fst` is productive.
private
module Tails x a φ (u : Partial φ (T {x} a)) y (p : C .snd x (hcomp (λ i .o → u o .snd .head≈ i) (a .head)) y) where
q = transp (\ i → C .snd x (hfill (\ i o → u o .snd .head≈ i) (inS (a .head)) (~ i)) y) i0 p
a' = a .tails y q
u' : Partial φ (T a')
u' (φ = i1) = u 1=1 .fst .tails y p
, u 1=1 .snd .tails≈ y q p \ j → transp (\ i → C .snd x (u 1=1 .snd .head≈ (~ i ∨ j)) y) j p
contr-T-fst : ∀ x a φ → Partial φ (T {x} a) → M C x
contr-T-fst x a φ u .head = hcomp (\ i o → u o .snd .head≈ i) (a .head)
contr-T-fst x a φ u .tails y p = contr-T-fst y a' φ u'
where
open Tails x a φ u y p
-- `contr-T-snd` is productive as the corecursive call appears as
-- the main argument of transport, which is guardedness-preserving.
{-# TERMINATING #-}
contr-T-snd : ∀ x a φ → (u : Partial φ (T {x} a)) → a ≈ contr-T-fst x a φ u
contr-T-snd x a φ u .head≈ i = hfill (λ { i (φ = i1) → u 1=1 .snd .head≈ i }) (inS (a .head)) i
contr-T-snd x a φ u .tails≈ y pa pb peq =
let r = contr-T-snd y (a .tails y pa) φ (\ { (φ = i1) → u 1=1 .fst .tails y pb , u 1=1 .snd .tails≈ y pa pb peq }) in
transport (\ i → a .tails y pa
≈ contr-T-fst y (a .tails y (sym (fromPathP (\ i → peq (~ i))) i)) φ
(\ { (φ = i1) → u 1=1 .fst .tails y pb , u 1=1 .snd .tails≈ y
((fromPathP (\ i → peq (~ i))) (~ i)) pb
\ j → lemma _ (λ h → C .snd x (u _ .snd .head≈ h) y) pa pb peq i j })) r
contr-T : ∀ x a φ → Partial φ (T {x} a) → T a
contr-T x a φ u .fst = contr-T-fst x a φ u
contr-T x a φ u .snd = contr-T-snd x a φ u
contr-T-φ-fst : ∀ x a → (u : Partial i1 (T {x} a)) → contr-T x a i1 u .fst ≡ u 1=1 .fst
contr-T-φ-fst x a u i .head = u 1=1 .fst .head
contr-T-φ-fst x a u i .tails y p
= let
q = (transp (\ i → C .snd x (hfill (\ i o → u o .snd .head≈ i) (inS (a .head)) (~ i)) y) i0 p)
in contr-T-φ-fst y (a .tails y q)
(\ o → u o .fst .tails y p
, u o .snd .tails≈ y q p \ j → transp (\ i → C .snd x (u 1=1 .snd .head≈ (~ i ∨ j)) y) j p)
i
-- `contr-T-φ-snd` is productive as the corecursive call appears as
-- the main argument of transport, which is guardedness-preserving (even for paths of a coinductive type).
{-# TERMINATING #-}
contr-T-φ-snd : ∀ x a → (u : Partial i1 (T {x} a)) → (\ i → a ≈ contr-T-φ-fst x a u i) [ contr-T x a i1 u .snd ≡ u 1=1 .snd ]
contr-T-φ-snd x a u i .head≈ = u _ .snd .head≈
contr-T-φ-snd x a u i .tails≈ y pa pb peq = let
eqh = u 1=1 .snd .head≈
r = contr-T-φ-snd y (a .tails y pa) (\ o → u o .fst .tails y pb , u 1=1 .snd .tails≈ y pa pb peq)
F : I → Type _
F k = a .tails y pa
≈ contr-T-fst y
(a .tails y (transp (λ j → C .snd x (eqh (k ∧ ~ j)) y) (~ k) (peq k)))
i1
(λ _ → u _ .fst .tails y pb
, u _ .snd .tails≈ y
(transp (λ j → C .snd x (eqh (k ∧ ~ j)) y) (~ k) (peq k))
pb
(λ j → lemma (C .snd x (u 1=1 .fst .head) y) (λ h → C .snd x (eqh h) y) pa pb peq k j)
)
u0 = contr-T-snd y (a .tails y pa) i1 (λ o → u o .fst .tails y pb , u o .snd .tails≈ y pa pb peq)
in transport
(λ l → PathP
(λ z → a .tails y pa
≈ contr-T-φ-fst y
(a .tails y (transp (λ k → C .snd x (u 1=1 .snd .head≈ (~ k ∧ l)) y) (~ l) (peq l)))
(λ _ → u _ .fst .tails y pb
, u _ .snd .tails≈ y (transp (λ k → C .snd x (u _ .snd .head≈ (~ k ∧ l)) y) (~ l) (peq l)) pb
\ j → lemma (C .snd x (u 1=1 .fst .head) y) (λ h → C .snd x (eqh h) y) pa pb peq l j)
z)
(transpFill {A = F i0} i0 (\ i → inS (F i)) u0 l)
(u _ .snd .tails≈ y pa pb peq))
r
i
contr-T-φ : ∀ x a → (u : Partial i1 (T {x} a)) → contr-T x a i1 u ≡ u 1=1
contr-T-φ x a u i .fst = contr-T-φ-fst x a u i
contr-T-φ x a u i .snd = contr-T-φ-snd x a u i
contr-T' : ∀ {x} a → isContr (T {x} a)
contr-T' a = isContrPartial→isContr (contr-T _ a) \ u → sym (contr-T-φ _ a (\ _ → u))
bisimEquiv : ∀ {x} {a b : M C x} → isEquiv (misib a b)
bisimEquiv = isContrToUniv _≈_ (misib _ _) contr-T'
|
programs/oeis/017/A017332.asm | karttu/loda | 1 | 88691 | ; A017332: a(n) = (10*n + 5)^4.
; 625,50625,390625,1500625,4100625,9150625,17850625,31640625,52200625,81450625,121550625,174900625,244140625,332150625,442050625,577200625,741200625,937890625,1171350625,1445900625,1766100625,2136750625,2562890625,3049800625,3603000625,4228250625,4931550625,5719140625,6597500625,7573350625,8653650625,9845600625,11156640625,12594450625,14166950625,15882300625,17748900625,19775390625,21970650625,24343800625,26904200625,29661450625,32625390625,35806100625,39213900625,42859350625,46753250625,50906640625,55330800625,60037250625,65037750625,70344300625,75969140625,81924750625,88223850625,94879400625,101904600625,109312890625,117117950625,125333700625,133974300625,143054150625,152587890625,162590400625,173076800625,184062450625,195562950625,207594140625,220172100625,233313150625,247033850625,261351000625,276281640625,291843050625,308052750625,324928500625,342488300625,360750390625,379733250625,399455600625,419936400625,441194850625,463250390625,486122700625,509831700625,534397550625,559840650625,586181640625,613441400625,641641050625,670801950625,700945700625,732094140625,764269350625,797493650625,831789600625,867180000625,903687890625,941336550625,980149500625,1020150500625,1061363550625,1103812890625,1147523000625,1192518600625,1238824650625,1286466350625,1335469140625,1385858700625,1437660950625,1490902050625,1545608400625,1601806640625,1659523650625,1718786550625,1779622700625,1842059700625,1906125390625,1971847850625,2039255400625,2108376600625,2179240250625,2251875390625,2326311300625,2402577500625,2480703750625,2560720050625,2642656640625,2726544000625,2812412850625,2900294150625,2990219100625,3082219140625,3176325950625,3272571450625,3370987800625,3471607400625,3574462890625,3679587150625,3787013300625,3896774700625,4008904950625,4123437890625,4240407600625,4359848400625,4481794850625,4606281750625,4733344140625,4863017300625,4995336750625,5130338250625,5268057800625,5408531640625,5551796250625,5697888350625,5846844900625,5998703100625,6153500390625,6311274450625,6472063200625,6635904800625,6802837650625,6972900390625,7146131900625,7322571300625,7502257950625,7685231450625,7871531640625,8061198600625,8254272650625,8450794350625,8650804500625,8854344140625,9061454550625,9272177250625,9486554000625,9704626800625,9926437890625,10152029750625,10381445100625,10614726900625,10851918350625,11093062890625,11338204200625,11587386200625,11840653050625,12098049150625,12359619140625,12625407900625,12895460550625,13169822450625,13448539200625,13731656640625,14019220850625,14311278150625,14607875100625,14909058500625,15214875390625,15525373050625,15840599000625,16160601000625,16485427050625,16815125390625,17149744500625,17489333100625,17833940150625,18183614850625,18538406640625,18898365200625,19263540450625,19633982550625,20009741900625,20390869140625,20777415150625,21169431050625,21566968200625,21970078200625,22378812890625,22793224350625,23213364900625,23639287100625,24071043750625,24508687890625,24952272800625,25401852000625,25857479250625,26319208550625,26787094140625,27261190500625,27741552350625,28228234650625,28721292600625,29220781640625,29726757450625,30239275950625,30758393300625,31284165900625,31816650390625,32355903650625,32901982800625,33454945200625,34014848450625,34581750390625,35155709100625,35736782900625,36325030350625,36920510250625,37523281640625,38133403800625,38750936250625
mul $0,10
add $0,5
pow $0,4
mov $1,$0
|
programs/oeis/016/A016164.asm | neoneye/loda | 22 | 102494 | <filename>programs/oeis/016/A016164.asm
; A016164: Expansion of 1/((1-5x)(1-10x)).
; 1,15,175,1875,19375,196875,1984375,19921875,199609375,1998046875,19990234375,199951171875,1999755859375,19998779296875,199993896484375,1999969482421875,19999847412109375,199999237060546875
add $0,1
mov $1,10
pow $1,$0
mov $2,5
pow $2,$0
sub $1,$2
div $1,5
mov $0,$1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.