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
|
---|---|---|---|---|
Reversing/Projects/StringMap.asm | Joey35233/FoxKit-3 | 3 | 92411 | ; Structure StringMap<int>
; {
; 0 uint* 4 vfptr
; 4 undefined4 4 unknown
; 8 uint 4 count
; 12 uint 4 capacity
; 16 StringMap<int>::Cell** 4 cells
; 20 StringMap<int>::Cell* 4 smUnknown0
; 24 StringMap<int>::Cell* 4 smUnknown1
; }
; Structure StringMap<int>::Cell
; {
; 0 String* 4 key
; 4 StringMap<int>::Cell* 4 cUnknown0
; 8 StringMap<int>::Cell* 4 cUnknown1
; 12 StringMap<int>::Cell* 4 cUnknown2
; 16 int 4 value
; }
; *************************************************************
; * fox::StringMap<int>::Insert(fox::String const&, int const&)
; *************************************************************
; void __thiscall Insert(StringMap<int> *this, String *key, int* value)
; assume LRset = 0x0
; assume TMode = 0x1
; void <VOID> <RETURN>
; StringMap<int> r0:4 (auto) this
; String * r1:4 key
; int* r2:4 value
; undefined4 r0:4 keyCString XREF[1]: 066c402e (W)
; StringMap<int> r0:4 local_r0_94 XREF[1]: 066c4066 (W)
; StringMap<int> r0:4 local_r0_100 XREF[1]: 066c406c (W)
push { r4, r5, r6, r7, r8, r9, r10 , lr } ; do stack stuff
sub sp, #0x10 ; more stack stuff
mov r10 , r0 ; copy StringMap<int>* this {r0} to r10_this
mov r6, r1 ; copy String* key {r1} to r6_pKey
ldr r0, [r0,#0x8 ] ; load uint this->count {r0 + 0x8} to r0_count
mov r8, r2 ; copy int* value {r2} to r8_pValue
ldr.w r1, [r10 ,#0xc ] ; load uint this->capacity {r10 + 0xc} to r1_workingCapacity
cmp r0, r1 ;
bcc LAB_066c402c ; if (!(r1_workingCapacity <= r0_count))
; jump to LAB_066c402c
; ELSE
lsl r1, r0, #0x1 ; r1_workingCapacity = r0_count << 1
cmp r0, #0x0 ;
it eq ; if (r0_count == 0)
mov.eq r1, #0x10 ; copy 0x10 to r1_workingCapacity
mov r0, r10 ; copy StringMap<int>* r10_this to r0_this
blx ChangeHashSize ; ChangeHashSize(r0_this, r1_workingCapacity)
; ENDELSE
LAB_066c402c:
mov r0, r6 ; copy String* r6_pKey to r0_pKey
blx CString ; copy char* key->CString() to r0_pKeyCString
blx FoxStrHash ; copy uint64_t FoxStrHash(char* r0_pKeyCString) into r0_hash0, r1_hash1
ldrd r2, r4, [r10 ,#0xc ] ; load this->capacity {r10_this + 0xc} to r2_capacity0, load Cell** this->cells {r10 + 0xc + 0x4} to r4_ppCells
mov r3, #0x0 ; copy 0 to r3_capacity1
blx __aeabi_uldivmod ; copy __aeabi_uldivmod(r0_hash0, r1_hash0, r2_capacity0, r3_capacity1) into r0_quo0, r1_quo0 and r2_rem0, r3_rem1
ldr.w r5,[ r4, r2, lsl #0x2 ] ; load r4_ppCells[r2_rem0] {r4_ppCells + r2_rem0 << 2} into r5_pIndexedCell
mov r9, r2 ; copy r2_rem0 to r9_idx
cbz r5, LAB_066c4062 ; if (r5_pIndexedCell == 0)
; jump to LAB_066c4062
; ELSE
add r7, sp,#0x8 ; copy String** &key {address of r6 (sp + 0x8)} into r7
mov r4, sp ; copy Cell*** &this->cells {address of r4} into r4
// Whole label: ????????????????????????????????????????????????????????????? (most parts of this are likely wrong)
LAB_066c404c:
mov r0, r7 ; copy r7_ppKey into r0_ppKey
mov r1, r6 ; copy r6_pKey into r1_pKey
blx operator.cast.to.StringId ; copy StringId operator.cast.to.String to address of r0 (r0 == &key, so basically: key.hash = r6.GetHash())
mov r0, r4 ; copy &this->cells {r4} into r0
mov r1, r5 ; copy Cell* r6->data {r5}
blx operator.cast.to.StringId ; copy StringId operator.cast.to.String to address of r0 (r0 == &this->cells, so basically: )
ldr r5, [r5,#0xc ] ;
cmp r5, #0x0
bne LAB_066c404c
; ENDELSE
LAB_066c4062:
mov r0, #0x14 ; copy 0x14 to r0_cellSize
mov r1, #0x0 ; copy 0x0 to r1_alignmentSize
blx BasicMalloc ; copy Cell* BasicMalloc(r0_cellSize, r1_alignmentSize) to r0_pNewCell
mov r4, r0 ; copy r0_pNewCell to r4_pNewCell
blx String ; undefined String(String * this)
mov r1, r6 ; copy r6_pKey to r1_pKey
blx operator= ; r0_pNewCell->key operator= r1_pKey
ldr.w r0, [r10 ,#0x10 ] ; load Cell** this->cells {r10_this + 0x10} into r0_ppCells
ldr.w r0,[ r0, r9,lsl # 0x2 ] ; load r0_ppCells[r9_idx] {r0_ppCells + r9_idx << 2} into r0_pIndexedCell
str r0, [r4,#0xc ] ; store r0_pIndexedCell in r4_pNewCell->pCUnknown2 {r4_pNewCell + 0x12}
ldr.w r0, [r8,#0x0 ] ; load r8_pValue {r8} into uint r0_value
str r0, [r4,#0x10 ] ; store r0_value in r4_pNewCell->value {r4_pNewCell + 0x10}
ldr.w r0, [r10 ,#0x10 ] ; load Cell** this->cells {r10_this + 0x10} into r0_ppCells
str.w r4,[ r0, r9,lsl # 0x2 ] ; store r4_pNewCell into r0_ppCells[r9_idx] {r0_ppCells + r9_idx << 2}
add.w r0, r10 , #0x14 ; copy &r10_this->smUnknown0 {r10_this + 0x14} to r0_ppSmUnknown0 @ NOTE: This "pointer retargeting" definitely suggests that it's some sort of inline struct
str r0, [r4,#0x8 ] ; store r0_ppSmUnknown0 in r4_pNewCell->pCUnknown1 {r4_pNewCell + 0x8}
ldr.w r0, [r10 ,#0x18 ] ; load r10_this->smUnknown1 {r10_this + 0x18} to r0_pSmUnknown1
str r0, [r4,#0x4 ] ; store r0_pSmUnknown1 in r4_pNewCell->pCUnknown0 {r4_pNewCell + 0x4}
ldr.w r0, [r10 ,#0x18 ] ; load r10_this->smUnknown1 {r10_this + 0x18} to r0_pSmUnknown1
str r4, [r0,#0x8 ] ; store r4_pNewCell in r0_pSmUnknown1
ldr.w r0, [r10 ,#0x8 ] ; load r10_this->count {r10_this + 0x8} to r0_count
str.w r4, [r10 ,#0x18 ] ; store r4_pNewCell in r10_this->smUnknown1 {r10_this + 0x18}
add r0, #0x1 ; copy r0_count + 1 to r0_newCount
str.w r0, [r10 ,#0x8 ] ; store r0_newCount in r10_this->count {r10_this + 0x8}
add sp, #0x10 ; stack stuff
pop.w { r4, r5, r6, r7, r8, r9, r10 , pc } ; more stack stuff
; *************************************************************
; * fox::String::CString() const
; *************************************************************
; char* __thiscall CString (String* this )
; assume LRset = 0x0
; assume TMode = 0x1
; char * r0:4 <RETURN>
; String * r0:4 (auto) this
ldr r0, [r0,#0x0 ]
ldr r0, [r0,#0x0 ]
bx lr
; *************************************************************
; * fox::FoxStrHash(char const*)
; *************************************************************
; uint64_t __stdcall FoxStrHash (char* str )
; assume LRset = 0x0
; assume TMode = 0x1
; uint64_t r0:4,r1:4 <RETURN>
; char * r0:4 str
push { r4, lr }
mov r4, r0
blx strlen ; size_t strlen(char * __s)
mov r1, r0
mov r0, r4
pop.w { r4, lr }
b.w ghidra_fox_hash ; uint64_t ghidra_fox_hash(char *
; *************************************************************
; * FUNCTION
; *************************************************************
; undefined __aeabi_uldivmod ()
; undefined r0:1 <RETURN>
; undefined4 Stack[-0x8]:4 local_8 XREF[1]: 05e0b110 (*)
; undefined4 Stack[-0xc]:4 local_c XREF[1]: 05e0b108 (R)
; undefined4 Stack[-0x10]:4 local_10 XREF[1]: 05e0b100 (*)
cmp r3, #0x0
cmpeq r2, #0x0
bne LAB_05e0b0fc
cmp r1, #0x0
cmpeq r0, #0x0
mvnne r1, #0x0
mvnne r0, #0x0
b LAB_060881bc
LAB_05e0b0fc:
sub sp, sp, #0x8
stmdb sp!,{ sp lr }=>local_10
bl __gnu_uldivmod_helper ; undefined __gnu_uldivmod_helper(
ldr lr, [sp,#0x4 ]=>local_c
add sp, sp, #0x8
ldmia sp!,{ r2 r3 }=>local_8
bx lr
; *************************************************************
; * fox::String::operator fox::StringId() const
; *************************************************************
; StringId __thiscall operator.cast.to.StringId(String *this,uint *param_1)
; assume LRset = 0x0
; assume TMode = 0x1
;
; StringId r0:4 <RETURN>
; String * r0:4 (auto) this
; uint * r1:4 param_1
ldr r1, [r1,#0x0 ]
ldrd r1, r2, [r1,#0x8 ]
strd r1, r2, [r0,#0x0 ]
bx lr |
libsrc/_DEVELOPMENT/target/zx/driver/terminal/zx_01_output_char_32_tty_z88dk/zx_01_output_char_32_tty_z88dk_02_font_address.asm | jpoikela/z88dk | 640 | 163877 |
SECTION code_driver
SECTION code_driver_terminal_output
PUBLIC zx_01_output_char_32_tty_z88dk_02_font_address
zx_01_output_char_32_tty_z88dk_02_font_address:
; de = parameters *
ld a,(de) ; a = MSB font address
inc de
ld (ix+22),a
ld a,(de) ; a = LSB of font address
ld (ix+21),a
ret
|
programs/oeis/165/A165994.asm | neoneye/loda | 22 | 245449 | ; A165994: a(n) is the number of nonzero values of floor (j^2/prime(n)), over 1 <= j < prime(n).
; 0,1,2,4,7,9,12,14,18,23,25,30,34,36,40,45,51,53,58,62,64,70,73,79,87,90,92,96,98,102,115,119,125,127,136,138,144,150,154,159,165,167,177,179,182,184,196,208,211,213,217,223,225,235,240,246,252,254,260,264,266,275,289,293,295,299,312,318,328,330,334,340,347,353,359,363,369,377,380,388,398,400,410,412,418,421,427,435,439,441,445,457,464,468,476,480,486,498,500,517
seq $0,40 ; The prime numbers.
seq $0,122800 ; A P_4-stuttered arithmetic progression with a(n+1)=a(n) if n is square, a(n+1)=a(n)+2 otherwise.
div $0,2
sub $0,1
|
orka/src/orka/implementation/orka-atomics.adb | onox/orka | 52 | 13441 | <filename>orka/src/orka/implementation/orka-atomics.adb
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package body Orka.Atomics is
protected body Counter is
procedure Add (Addition : Natural) is
begin
Value := Value + Addition;
end Add;
procedure Increment is
begin
Value := Value + 1;
end Increment;
procedure Decrement (Zero : out Boolean) is
begin
Value := Value - 1;
Zero := Value = 0;
end Decrement;
function Count return Natural is (Value);
end Counter;
end Orka.Atomics;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/loop_optimization8.adb | best08618/asylo | 7 | 17245 | -- { dg-do run }
-- { dg-options "-O -gnatn" }
with Loop_Optimization8_Pkg1;
procedure Loop_Optimization8 is
Data : Loop_Optimization8_Pkg1.T;
procedure Check_1 (N : in Natural) is
begin
if N /= 0 then
for I in 1 .. Data.Last loop
declare
F : constant Natural := Data.Elements (I);
begin
if F = N then
raise Program_Error;
end if;
end;
end loop;
end if;
end;
procedure Check is new Loop_Optimization8_Pkg1.Iter (Check_1);
begin
Data := Loop_Optimization8_Pkg1.Empty;
Check;
end;
|
archive/agda-1/HasNeitherNor.agda | m0davis/oscar | 0 | 9951 |
module HasNeitherNor where
record HasNeitherNor (A : Set) : Set
where
field
_⊗_ : A → A → A
open HasNeitherNor ⦃ … ⦄ public
|
oeis/180/A180060.asm | neoneye/loda-programs | 11 | 4939 | ; A180060: 2^(2^n mod n) mod n.
; Submitted by <NAME>
; 0,1,1,1,4,4,4,1,4,6,4,4,4,2,1,1,4,16,4,16,4,16,4,16,3,16,13,16,4,16,4,1,25,16,29,16,4,16,22,16,4,16,4,20,32,16,4,16,22,16,1,16,4,52,8,32,28,16,4,16,4,16,4,1,61,16,4,52,49,46,4,16,4,16,31,24,36,16,4,16,40,16,4,16,1,16,82,56,4,16,2,32,70,16,22,64,4,92,95,36
mov $1,$0
add $1,1
mov $2,2
pow $2,$1
mov $0,$2
mod $0,$1
mov $2,2
pow $2,$0
mod $2,$1
mov $0,$2
|
data/pokemon/dex_entries/zangoose.asm | AtmaBuster/pokeplat-gen2 | 6 | 244449 | <gh_stars>1-10
db "<NAME>@" ; species name
db "Its fur will stand"
next "on end if it"
next "smells a SEVIPER"
page "nearby. It uses"
next "its sharp claws to"
next "tear up its foes.@"
|
libsrc/_DEVELOPMENT/env/esxdos/c/sdcc_iy/getenv.asm | jpoikela/z88dk | 640 | 23482 | ; char *getenv(const char *name)
SECTION code_env
PUBLIC _getenv
EXTERN _getenv_fastcall
_getenv:
pop af
pop hl
push hl
push af
jp _getenv_fastcall
|
Transynther/x86/_processed/US/_zr_/i7-8650U_0xd2.log_19024_1444.asm | ljhsiun2/medusa | 9 | 100971 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1adf7, %rax
nop
nop
and $20535, %r14
movb $0x61, (%rax)
sub $17355, %rbx
lea addresses_normal_ht+0x10751, %rsi
lea addresses_A_ht+0x177f0, %rdi
nop
nop
nop
nop
and $21527, %r10
mov $119, %rcx
rep movsl
nop
nop
nop
nop
cmp %r10, %r10
lea addresses_normal_ht+0x4787, %rcx
cmp $27579, %r15
mov (%rcx), %si
dec %rax
lea addresses_UC_ht+0x4d87, %rsi
lea addresses_normal_ht+0x161c7, %rdi
nop
nop
nop
nop
inc %r15
mov $94, %rcx
rep movsl
nop
cmp %rsi, %rsi
lea addresses_UC_ht+0xea87, %rsi
lea addresses_A_ht+0x17647, %rdi
nop
add %rbx, %rbx
mov $62, %rcx
rep movsq
nop
nop
nop
nop
and %r10, %r10
lea addresses_normal_ht+0x19c87, %rsi
lea addresses_WT_ht+0xde87, %rdi
nop
nop
cmp $20514, %rax
mov $71, %rcx
rep movsq
nop
nop
dec %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r8
push %r9
push %rax
push %rbp
push %rcx
push %rsi
// Store
lea addresses_PSE+0x1df87, %rsi
nop
sub %r9, %r9
mov $0x5152535455565758, %rax
movq %rax, (%rsi)
nop
nop
nop
nop
add %rcx, %rcx
// Store
lea addresses_WT+0x4387, %rbp
nop
nop
inc %r8
mov $0x5152535455565758, %rax
movq %rax, (%rbp)
nop
nop
sub %r9, %r9
// Faulty Load
lea addresses_US+0x10b87, %rbp
nop
nop
nop
nop
and %r9, %r9
mov (%rbp), %r14d
lea oracles, %rbp
and $0xff, %r14
shlq $12, %r14
mov (%rbp,%r14,1), %r14
pop %rsi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}}
{'00': 19024}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Program 2/AddTwo.asm | smitc29/Assembly_Projects | 0 | 29063 | ; <NAME> Project 2
; CSCI 231 Professor <NAME>
; Oct 2, 2016
; Reverse a string
TITLE MASM Template
INCLUDE Irvine32.inc
.data
source BYTE "This is the source string",0
target BYTE SIZEOF source DUP('#')
.code
main proc
mov ebx, [SIZEOF source]-1 ; Find location for last character of source string
;mov ebx, [SIZEOF source]
;dec ebx ;alternate way to code if previous "ebx" line didn't want to copperate
mov esi, ebx ; Copies location for last character of string into seperate mem address
mov edi, 0 ; Sets location for target string array's [0] spot
mov ecx, [SIZEOF source] ; Sets counter for loop, size equal to source string
;mov ecx, [ebx]+1 ; For some reason, this throws an exception; will assemble but not run
reword:
mov al, source[esi] ; Finds can copies current character of string
mov target[edi], al ; Copies character from eax low register to target
dec esi ; Decrements mem location to previous character of source
inc edi ; Increments mem location to next character of target
loop reword
mov esi,OFFSET target
mov ebx,1
mov ecx,SIZEOF target
call DumpMem
exit
main endp
end main |
xasm/common/test/equstest.asm | gb-archive/asmotor | 0 | 168473 |
SECTION "Test",CODE
Print EQUS "\tPRINTT \"First\\n\"\nPRINTT \"Second\\n\"\n"
REPT 3
Print
REPT 2
PRINTT "\t2nd REPT\n"
ENDR
ENDR
|
programs/oeis/197/A197649.asm | jmorken/loda | 1 | 81227 | ; A197649: Sum(k*Fibonacci(2*k), k=0..n), Fibonacci(n)=A000045(n)
; 0,1,7,31,115,390,1254,3893,11789,35045,102695,297516,853932,2432041,6881395,19361995,54214939,151164018,419910354,1162585565,3209268665,8835468881,24266461007,66501634776,181882282200,496539007825,1353272290399,3682496714743
lpb $0
add $2,$1
add $2,$0
sub $0,1
add $1,$2
lpe
|
dino/lcs/123p/E7.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 94301 | copyright zengfr site:http://github.com/zengfr/romhack
0324CA addq.b #1, ($e7,A2)
0324CE dbra D6, $3245e [123p+ E7]
032C80 cmpi.b #$3, ($e7,A0)
032C86 blt $32c8c [123p+ E7]
copyright zengfr site:http://github.com/zengfr/romhack
|
libsrc/_DEVELOPMENT/arch/zx/esxdos/c/sdcc_iy/esxdos_f_write.asm | jpoikela/z88dk | 640 | 240796 | ; int esxdos_f_write(uchar handle, void *src, size_t nbyte)
SECTION code_clib
SECTION code_esxdos
PUBLIC _esxdos_f_write
EXTERN l0_esxdos_f_write_callee
_esxdos_f_write:
pop de
dec sp
pop af
pop hl
pop bc
push bc
push hl
dec sp
push de
jp l0_esxdos_f_write_callee
|
source/image/s-valerr.adb | ytomino/drake | 33 | 16347 | with System.Runtime_Context;
pragma Warnings (Off, System.Runtime_Context); -- break "pure" rule
package body System.Value_Errors is
procedure Raise_Value_Failure (T : String; S : String) is
T_Length : constant Natural := T'Length;
Message : String (1 .. T_Length + S'Length * 2 + 11);
Last : Natural;
begin
Last := T_Length;
Message (1 .. Last) := T;
Last := Last + 9;
Message (Last - 8 .. Last) := "'Value (""";
for I in S'Range loop
declare
E : Character renames S (I);
begin
if E = '"' then
Last := Last + 1;
Message (Last) := '"';
end if;
Last := Last + 1;
Message (Last) := E;
end;
end loop;
Last := Last + 1;
Message (Last) := '"';
Last := Last + 1;
Message (Last) := ')';
raise Constraint_Error with Message (1 .. Last);
end Raise_Value_Failure;
procedure Raise_Discrete_Value_Failure (T : String; S : String) is
TLS : constant not null Runtime_Context.Task_Local_Storage_Access :=
Runtime_Context.Get_Task_Local_Storage;
begin
if TLS.No_Discrete_Value_Failure_Propagation then
TLS.Discrete_Value_Failure := True;
else
Raise_Value_Failure (T, S);
end if;
end Raise_Discrete_Value_Failure;
end System.Value_Errors;
|
programs/oeis/249/A249983.asm | neoneye/loda | 22 | 102636 | <gh_stars>10-100
; A249983: Number of length 3+1 0..2*n arrays with the sum of the absolute values of adjacent differences equal to 3*n.
; 20,88,208,426,728,1178,1744,2508,3420,4580,5920,7558,9408,11606,14048,16888,20004,23568,27440,31810,36520,41778,47408,53636,60268,67548,75264,83678,92560,102190,112320,123248,134708,147016,159888,173658,188024,203338,219280,236220,253820,272468,291808,312246,333408,355718,378784,403048,428100,454400,481520,509938,539208,569826,601328,634228,668044,703308,739520,777230,815920,856158,897408,940256,984148,1029688,1076304,1124618,1174040,1225210,1277520,1331628,1386908,1444036,1502368,1562598,1624064,1687478,1752160,1818840,1886820,1956848,2028208,2101666,2176488,2253458,2331824,2412388,2494380,2578620,2664320,2752318,2841808,2933646,3027008,3122768,3220084,3319848,3421200,3525050
mov $2,$0
add $2,1
mov $7,$0
lpb $2
mov $0,$7
sub $2,1
sub $0,$2
mov $8,$0
add $8,1
mov $9,$0
mov $10,0
lpb $8
mov $0,$9
sub $8,1
sub $0,$8
mov $4,$0
mod $4,2
add $4,4
mul $0,$4
mov $3,2
mul $3,$4
mul $3,2
mov $5,$0
add $5,3
mul $5,$3
mov $6,$5
sub $6,48
div $6,8
mul $6,2
add $6,20
add $10,$6
lpe
add $1,$10
lpe
mov $0,$1
|
Mixing Desk Programming/Create PM scene recall.applescript | bsmith96/Qlab-Scripts | 1 | 213 | -- @description Create PM scene recall
-- @author <NAME>
-- @link bensmithsound.uk
-- @version 2.0
-- @testedmacos 10.13.6
-- @testedqlab 4.6.9
-- @about Creates a midi cue to recall a scene on Yamaha Rivage PM mixing desks
-- @separateprocess TRUE
-- @changelog
-- v2.0 + moved common functions to external script
-- USER DEFINED VARIABLES -----------------
set userColor to "green"
set colorParentGroups to true -- set colour of any groups containing the recall group as well?
set cueListName to "Main Cue List" -- Name of main cue list
---------- END OF USER DEFINED VARIABLES --
property util : script "Applescript Utilities"
-- RUN SCRIPT -----------------------------
tell application id "com.figure53.Qlab.4" to tell front workspace
-- set scene number to recall
display dialog "Please select a scene number to recall" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NUMBER"
set sceneNumber to text returned of result as string
-- set midi command to recall
display dialog "Please select the midi program change to recall, in the format \"Channel Value\"" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "MIDI PROGRAM CHANGE"
set midiCommandString to text returned of result as string
-- calculate the channel and value
set midiCommandList to util's splitString(midiCommandString, " ")
set chanNum to item 1 of midiCommandList
set valueNum to item 2 of midiCommandList
set valueNum to valueNum - 1
set sceneGroupName to "Scene " & sceneNumber
-- Make overall group
make type "Group"
set sceneGroup to last item of (selected as list)
set sceneGroupID to uniqueID of sceneGroup
set mode of sceneGroup to timeline
set q name of sceneGroup to sceneGroupName
-- Make the midi program cue
make type "Midi"
set midiBank to last item of (selected as list)
set midiBankID to uniqueID of midiBank
set message type of midiBank to voice
set command of midiBank to program_change
set channel of midiBank to chanNum
set byte one of midiBank to valueNum
move cue id midiBankID of parent of midiBank to end of sceneGroup
set q name of midiBank to "Scene " & sceneNumber & ": Program Change"
-- Color the group and any groups containing the group
set q color of sceneGroup to userColor
if colorParentGroups is true then
set groupParent to parent of sceneGroup
repeat
if q name of groupParent is cueListName then
exit repeat
else
set q color of groupParent to userColor
set groupParent to parent of groupParent
end if
end repeat
end if
collapse sceneGroup
end tell |
src/keystore-io-headers.adb | My-Colaborations/ada-keystore | 25 | 11705 | <reponame>My-Colaborations/ada-keystore<gh_stars>10-100
-----------------------------------------------------------------------
-- keystore-io-headers -- Keystore file header operations
-- Copyright (C) 2019, 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Log.Loggers;
with Util.Encoders.HMAC.SHA256;
with Keystore.Marshallers;
-- === Header block ===
-- The first block of the file is the keystore header block which contains clear
-- information signed by an HMAC header. The header block contains the keystore
-- UUID as well as a short description of each storage data file. It also contains
-- some optional header data.
--
-- ```
-- +------------------+
-- | 41 64 61 00 | 4b = Ada
-- | 00 9A 72 57 | 4b = 10/12/1815
-- | 01 9D B1 AC | 4b = 27/11/1852
-- | 00 01 | 2b = Version 1
-- | 00 01 | 2b = File header length in blocks
-- +------------------+
-- | Keystore UUID | 16b
-- | Storage ID | 4b
-- | Block size | 4b
-- | Storage count | 4b
-- | Header Data count| 2b
-- +------------------+-----
-- | Header Data size | 2b
-- | Header Data type | 2b = 0 (NONE), 1 (GPG1) 2, (GPG2)
-- +------------------+
-- | Header Data | Nb
-- +------------------+-----
-- | ... |
-- +------------------+-----
-- | 0 |
-- +------------------+-----
-- | ... |
-- +------------------+-----
-- | Storage ID | 4b
-- | Storage type | 2b
-- | Storage status | 2b 00 = open, Ada = sealed
-- | Storage max bloc | 4b
-- | Storage HMAC | 32b = 44b
-- +------------------+----
-- | Header HMAC-256 | 32b
-- +------------------+----
-- ```
package body Keystore.IO.Headers is
use type Interfaces.Unsigned_16;
use type Interfaces.Unsigned_32;
use type Keystore.Buffers.Storage_Identifier;
-- Header magic numbers.
MAGIC_1 : constant := 16#41646100#;
MAGIC_2 : constant := 16#009A7257#;
MAGIC_3 : constant := 16#019DB1AC#;
VERSION_1 : constant := 1;
-- Header positions and length.
STORAGE_COUNT_POS : constant := 1 + 16 + 16 + 4 + 4;
HEADER_DATA_POS : constant := STORAGE_COUNT_POS + 4;
STORAGE_SLOT_LENGTH : constant := 4 + 2 + 2 + 4 + 32;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.IO.Headers");
function Get_Storage_Offset (Index : in Natural) return Block_Index is
(Block_Index'Last - STORAGE_SLOT_LENGTH * Stream_Element_Offset (Index) - 1);
function Get_Header_Data_Size (Header : in Wallet_Header) return Buffer_Size;
procedure Seek_Header_Data (Buffer : in out Keystore.Marshallers.Marshaller;
Index : in Header_Slot_Index_Type);
-- ------------------------------
-- Build a new header with the given UUID and for the storage.
-- The header buffer is allocated and filled so that it can be written by Write_Header.
-- ------------------------------
procedure Build_Header (UUID : in UUID_Type;
Storage : in Storage_Identifier;
Header : in out Wallet_Header) is
Buffer : Keystore.Marshallers.Marshaller;
begin
Header.Buffer := Buffers.Allocate ((Storage, HEADER_BLOCK_NUM));
Buffer.Buffer := Header.Buffer;
Marshallers.Set_Header (Buffer, MAGIC_1);
Marshallers.Put_Unsigned_32 (Buffer, MAGIC_2);
Marshallers.Put_Unsigned_32 (Buffer, MAGIC_3);
Marshallers.Put_Unsigned_16 (Buffer, VERSION_1);
Marshallers.Put_Unsigned_16 (Buffer, 1);
Marshallers.Put_UUID (Buffer, UUID);
Marshallers.Put_Unsigned_32 (Buffer, Interfaces.Unsigned_32 (Storage));
Marshallers.Put_Unsigned_32 (Buffer, Buffers.Block_Size);
Marshallers.Put_Unsigned_32 (Buffer, 0);
Buffer.Buffer.Data.Value.Data (Buffer.Pos .. Buffers.Block_Type'Last) := (others => 0);
end Build_Header;
-- ------------------------------
-- Read the header block and verify its integrity.
-- ------------------------------
procedure Read_Header (Header : in out Wallet_Header) is
Buffer : Keystore.Marshallers.Marshaller;
Value : Interfaces.Unsigned_32;
Value16 : Interfaces.Unsigned_16;
Storage_Count : Interfaces.Unsigned_32;
begin
Buffer.Buffer := Header.Buffer;
-- Verify values found in header block.
Value := Marshallers.Get_Header (Buffer);
if Value /= MAGIC_1 then
Log.Warn ("Header magic 1 is invalid:{0}",
Interfaces.Unsigned_32'Image (Value));
raise Invalid_Keystore;
end if;
Value := Marshallers.Get_Unsigned_32 (Buffer);
if Value /= MAGIC_2 then
Log.Warn ("Header magic 2 is invalid:{0}",
Interfaces.Unsigned_32'Image (Value));
raise Invalid_Keystore;
end if;
Value := Marshallers.Get_Unsigned_32 (Buffer);
if Value /= MAGIC_3 then
Log.Warn ("Header magic 3 is invalid:{0}",
Interfaces.Unsigned_32'Image (Value));
raise Invalid_Keystore;
end if;
Header.Version := Natural (Marshallers.Get_Unsigned_16 (Buffer));
if Header.Version /= 1 then
Log.Warn ("Header version is not supported:{0}",
Natural'Image (Header.Version));
raise Invalid_Keystore;
end if;
Value := Interfaces.Unsigned_32 (Marshallers.Get_Unsigned_16 (Buffer));
if Value /= 1 then
Log.Warn ("Header block size bloc{0} is invalid:{0}",
Interfaces.Unsigned_32'Image (Value));
raise Invalid_Keystore;
end if;
-- Get keystore UUID
Marshallers.Get_UUID (Buffer, Header.UUID);
Header.Identifier := Storage_Identifier (Marshallers.Get_Unsigned_32 (Buffer));
if Header.Identifier /= Header.Buffer.Block.Storage then
Log.Warn ("Header storage identifier does not match:{0}",
Storage_Identifier'Image (Header.Identifier));
raise Invalid_Keystore;
end if;
Value := Marshallers.Get_Unsigned_32 (Buffer);
if Value /= Buffers.Block_Size then
Log.Warn ("Header block size is not supported:{0}",
Interfaces.Unsigned_32'Image (Value));
raise Invalid_Keystore;
end if;
Header.Block_Size := Natural (Value);
Storage_Count := Marshallers.Get_Unsigned_32 (Buffer);
Header.Storage_Count := Natural (Storage_Count);
Value16 := Marshallers.Get_Unsigned_16 (Buffer);
if Value16 > Interfaces.Unsigned_16 (Header_Slot_Count_Type'Last) then
Log.Warn ("Header data count is out of range:{0}",
Interfaces.Unsigned_16 'Image (Value16));
raise Invalid_Keystore;
end if;
Header.Data_Count := Header_Slot_Count_Type (Value16);
end Read_Header;
-- ------------------------------
-- Scan the header block for the storage and call the Process procedure for each
-- storage information found in the header block.
-- ------------------------------
procedure Scan_Storage (Header : in out Wallet_Header;
Process : not null access procedure (Storage : in Wallet_Storage)) is
Buf : constant Buffers.Buffer_Accessor := Header.Buffer.Data.Value;
Buffer : Keystore.Marshallers.Marshaller;
begin
Buffer.Buffer := Header.Buffer;
for I in 1 .. Header.Storage_Count loop
declare
S : Wallet_Storage;
Status : Interfaces.Unsigned_16;
begin
Buffer.Pos := Get_Storage_Offset (I);
S.Pos := Buffer.Pos + 1;
S.Identifier := Storage_Identifier (Marshallers.Get_Unsigned_32 (Buffer));
S.Kind := Marshallers.Get_Unsigned_16 (Buffer);
Status := Marshallers.Get_Unsigned_16 (Buffer);
S.Readonly := Status > 0;
S.Sealed := Status > 0;
S.Max_Block := Natural (Marshallers.Get_Unsigned_32 (Buffer));
S.HMAC := Buf.Data (Buffer.Pos + 1 .. Buffer.Pos + 32);
Process (S);
end;
end loop;
end Scan_Storage;
-- ------------------------------
-- Sign the header block for the storage.
-- ------------------------------
procedure Sign_Header (Header : in out Wallet_Header;
Sign : in Secret_Key) is
Buf : constant Buffers.Buffer_Accessor := Header.Buffer.Data.Value;
Context : Util.Encoders.HMAC.SHA256.Context;
begin
Util.Encoders.HMAC.SHA256.Set_Key (Context, Sign);
Util.Encoders.HMAC.SHA256.Update (Context, Buf.Data);
Util.Encoders.HMAC.SHA256.Finish (Context, Header.HMAC);
end Sign_Header;
procedure Seek_Header_Data (Buffer : in out Keystore.Marshallers.Marshaller;
Index : in Header_Slot_Index_Type) is
Size : Buffer_Size;
begin
Buffer.Pos := HEADER_DATA_POS + 2 - 1;
-- Skip entries until we reach the correct slot.
for I in 1 .. Index - 1 loop
Size := Marshallers.Get_Buffer_Size (Buffer);
Marshallers.Skip (Buffer, Size + 2);
end loop;
end Seek_Header_Data;
function Get_Header_Data_Size (Header : in Wallet_Header) return Buffer_Size is
Buffer : Keystore.Marshallers.Marshaller;
Total : Buffer_Size := 0;
Size : Buffer_Size;
begin
Buffer.Buffer := Header.Buffer;
Buffer.Pos := HEADER_DATA_POS + 2 - 1;
for I in 1 .. Header.Data_Count loop
Size := Marshallers.Get_Buffer_Size (Buffer);
Marshallers.Skip (Buffer, Size + 2);
Total := Total + Size + 4;
end loop;
return Total;
end Get_Header_Data_Size;
-- ------------------------------
-- Set some header data in the keystore file.
-- ------------------------------
procedure Set_Header_Data (Header : in out Wallet_Header;
Index : in Header_Slot_Index_Type;
Kind : in Header_Slot_Type;
Data : in Ada.Streams.Stream_Element_Array) is
Buf : constant Buffers.Buffer_Accessor := Header.Buffer.Data.Value;
Buffer : Keystore.Marshallers.Marshaller;
Size : Buffer_Size;
Last : Block_Index;
Space : Stream_Element_Offset;
Start : Stream_Element_Offset;
Limit : constant Stream_Element_Offset := Get_Storage_Offset (Header.Storage_Count);
begin
if Index > Header.Data_Count + 1 then
Log.Warn ("Not enough header slots to add a header data");
raise No_Header_Slot;
end if;
Buffer.Buffer := Header.Buffer;
Seek_Header_Data (Buffer, Index);
if Index <= Header.Data_Count then
Size := Marshallers.Get_Buffer_Size (Buffer);
Space := Data'Length - Size;
Buffer.Pos := Buffer.Pos - 2;
else
Space := Data'Length;
end if;
Last := Get_Header_Data_Size (Header) + HEADER_DATA_POS;
-- Verify there is enough room.
if Last + Space + 8 >= Limit then
Log.Warn ("Not enough header space to add a header data");
raise No_Header_Slot;
end if;
-- Shift
if Index < Header.Data_Count and Space /= 0 then
Start := Buffer.Pos + 4 + Size;
Buf.Data (Start + Space .. Last + Space) := Buf.Data (Start .. Last);
end if;
-- Update the header data slot.
Marshallers.Put_Buffer_Size (Buffer, Data'Length);
Marshallers.Put_Unsigned_16 (Buffer, Interfaces.Unsigned_16 (Kind));
Buf.Data (Buffer.Pos + 1 .. Buffer.Pos + Data'Length) := Data;
-- Update the header data count.
if Index > Header.Data_Count then
Header.Data_Count := Index;
end if;
Buffer.Pos := HEADER_DATA_POS - 1;
Marshallers.Put_Unsigned_16 (Buffer, Interfaces.Unsigned_16 (Header.Data_Count));
end Set_Header_Data;
-- ------------------------------
-- Get the header data information from the keystore file.
-- ------------------------------
procedure Get_Header_Data (Header : in out Wallet_Header;
Index : in Header_Slot_Index_Type;
Kind : out Header_Slot_Type;
Data : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset) is
Buffer : Keystore.Marshallers.Marshaller;
Size : Buffer_Size;
begin
if Index > Header.Data_Count then
Kind := SLOT_EMPTY;
Last := Data'First - 1;
return;
end if;
Buffer.Buffer := Header.Buffer;
Seek_Header_Data (Buffer, Index);
-- Extract data slot and truncate if the buffer is too small.
Size := Marshallers.Get_Buffer_Size (Buffer);
Kind := Header_Slot_Type (Marshallers.Get_Unsigned_16 (Buffer));
if Size > Data'Length then
Size := Data'Length;
end if;
Marshallers.Get_Data (Buffer, Size, Data, Last);
end Get_Header_Data;
-- ------------------------------
-- Add a new storage reference in the header and return its position in the header.
-- Raises the No_Header_Slot if there is no room in the header.
-- ------------------------------
procedure Add_Storage (Header : in out Wallet_Header;
Identifier : in Storage_Identifier;
Max_Block : in Positive;
Pos : out Block_Index) is
Buffer : Keystore.Marshallers.Marshaller;
Last : constant Block_Index := Get_Header_Data_Size (Header) + HEADER_DATA_POS;
begin
Pos := Get_Storage_Offset (Header.Storage_Count + 1);
if Pos <= Last + 4 then
Log.Warn ("Not enough header space to add a new storage file");
raise No_Header_Slot;
end if;
Buffer.Pos := Pos;
Header.Storage_Count := Header.Storage_Count + 1;
Buffer.Buffer := Header.Buffer;
Marshallers.Put_Unsigned_32 (Buffer, Interfaces.Unsigned_32 (Identifier));
Marshallers.Put_Unsigned_16 (Buffer, 0);
Marshallers.Put_Unsigned_16 (Buffer, 0);
Marshallers.Put_Unsigned_32 (Buffer, Interfaces.Unsigned_32 (Max_Block));
Buffer.Pos := STORAGE_COUNT_POS - 1;
Marshallers.Put_Unsigned_32 (Buffer, Interfaces.Unsigned_32 (Header.Storage_Count));
end Add_Storage;
end Keystore.IO.Headers;
|
3-mid/opengl/source/lean/opengl-visual.adb | charlie5/lace-alire | 1 | 1537 | with
ada.unchecked_Deallocation;
package body openGL.Visual
is
package body Forge
is
function new_Visual (Model : in openGL.Model.view;
Scale : in Vector_3 := (1.0, 1.0, 1.0);
is_Terrain : in Boolean := False) return openGL.Visual.view
is
begin
return new Visual.item' (Model => Model,
model_Transform => Identity_4x4,
camera_Transform => Identity_4x4,
Transform => Identity_4x4,
mvp_Transform => Identity_4x4,
Scale => Scale,
program_Parameters => null,
is_Terrain => is_Terrain,
face_Count => 1,
apparent_Size => <>);
end new_Visual;
end Forge;
procedure free (Self : in out View)
is
procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View);
begin
deallocate (Self);
end free;
function Model (Self : in Item) return openGL.Model.view
is
begin
return Self.Model;
end Model;
procedure Model_is (Self : in out Item; Now : in openGL.Model.view)
is
begin
Self.Model := Now;
end Model_is;
function Scale (Self : in Item) return Vector_3
is
begin
return Self.Scale;
end Scale;
procedure Scale_is (Self : in out Item; Now : in Vector_3)
is
begin
Self.Scale := Now;
end Scale_is;
function is_Terrain (Self : in Item) return Boolean
is
begin
return Self.is_Terrain;
end is_Terrain;
procedure is_Terrain (Self : in out Item; Now : in Boolean := True)
is
begin
Self.is_Terrain := Now;
end is_Terrain;
function face_Count (Self : in Item) return Natural
is
begin
return Self.face_Count;
end face_Count;
procedure face_Count_is (Self : in out Item; Now : in Natural)
is
begin
Self.face_Count := Now;
end face_Count_is;
function apparent_Size (Self : in Item) return Real
is
begin
return Self.apparent_Size;
end apparent_Size;
procedure apparent_Size_is (Self : in out Item; Now : in Real)
is
begin
Self.apparent_Size := Now;
end apparent_Size_is;
function Transform (Self : in Item) return Matrix_4x4
is
begin
return Self.Transform;
end Transform;
procedure Transform_is (Self : in out Item; Now : in Matrix_4x4)
is
begin
Self.Transform := Now;
end Transform_is;
function mvp_Transform (Self : in Item) return Matrix_4x4
is
begin
return Self.mvp_Transform;
end mvp_Transform;
procedure mvp_Transform_is (Self : in out Item; Now : in Matrix_4x4)
is
begin
Self.mvp_Transform := Now;
end mvp_Transform_is;
function model_Transform (Self : in Item) return Matrix_4x4
is
begin
return Self.model_Transform;
end model_Transform;
procedure model_Transform_is (Self : in out Item; Now : in Matrix_4x4)
is
begin
Self.model_Transform := Now;
end model_Transform_is;
function camera_Transform (Self : in Item) return Matrix_4x4
is
begin
return Self.camera_Transform;
end camera_Transform;
procedure camera_Transform_is (Self : in out Item; Now : in Matrix_4x4)
is
begin
Self.camera_Transform := Now;
end camera_Transform_is;
procedure Spin_is (Self : in out Item; Now : in Matrix_3x3)
is
use linear_Algebra_3d;
begin
set_Rotation (Self.Transform, Now);
-- set_Rotation (Self.model_Transform, Now);
end Spin_is;
function Spin_of (Self : in Item) return Matrix_3x3
is
use linear_Algebra_3d;
begin
return get_Rotation (Self.Transform);
-- return get_Rotation (Self.model_Transform);
end Spin_of;
procedure Site_is (Self : in out Item; Now : in Vector_3)
is
use linear_Algebra_3d;
begin
set_Translation (Self.Transform, Now);
-- set_Translation (Self.model_Transform, Now);
end Site_is;
function Site_of (Self : in Item) return Vector_3
is
use linear_Algebra_3d;
begin
return get_Translation (Self.Transform);
-- return get_Translation (Self.model_Transform);
end Site_of;
function program_Parameters (Self : in Item) return program.Parameters_view
is
begin
return Self.program_Parameters;
end program_Parameters;
procedure program_Parameters_are (Self : in out Item; Now : in program.Parameters_view)
is
begin
Self.program_Parameters := Now;
end program_Parameters_are;
end openGL.Visual;
|
vbdefines.asm | enthusi/VBeat | 6 | 3701 | BG_MAP equ $00020000
BRTA equ $0005F824
BRTA_DEFAULT equ 42
BRTB_DEFAULT equ 84
BRTC_DEFAULT equ 0
CHAR_TBL equ $00078000
DPCTRL equ $0005f822
DP_DISP equ %0000000000000010
DP_RE equ %0000000100000000
DP_SYNCE equ %0000001000000000
FRMCYC equ $0005f82e
GPLT0 equ $0005f860
INTCLR equ $0005f804
INTENB equ $0005f802
INTPND equ $0005f800
SDR_A equ %0000000000000100
SDR_B equ %0000000000001000
SDR_LD equ %0000010000000000
SDR_LL equ %0000001000000000
SDR_LR equ %0000000100000000
SDR_LU equ %0000100000000000
TIMER_TCR equ $02000020
TIMER_THR equ $0200001C
TIMER_TLR equ $02000018
VIP equ $00000000
VIP_END equ $00080000
VSU equ $01000000
VSU_END equ $01000800
VSU_S1INT equ $01000400
VSU_SSTOP equ $01000580
VSU_WAVE_0 equ $01000000
WCR equ $02000024
WORLD_BGM_NORMAL equ %0000000000000000
WORLD_END equ %0000000001000000
WORLD_LON equ %1000000000000000
WORLD_RON equ %0100000000000000
WORLD_SCX_0 equ %0000000000000000
WORLD_SCY_0 equ %0000000000000000
WORLD_TBL equ $0003d800
WRAM equ $05000000
WRAM_END equ $05010000
XPCTRL equ $0005f842
XPSTTS equ $0005f840
XP_XPEN equ %0000000000000010
XP_XPRST equ %0000000000000001
|
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca_notsx.log_21829_1787.asm | ljhsiun2/medusa | 9 | 17820 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca_notsx.log_21829_1787.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x17288, %rsi
xor %rdx, %rdx
mov (%rsi), %cx
nop
nop
nop
nop
nop
xor %rbp, %rbp
lea addresses_normal_ht+0x688, %rsi
lea addresses_A_ht+0xc30, %rdi
nop
nop
nop
nop
and $22175, %r14
mov $43, %rcx
rep movsq
nop
nop
nop
nop
and $10504, %rsi
lea addresses_WT_ht+0x6248, %rdi
nop
dec %r12
movw $0x6162, (%rdi)
nop
nop
nop
nop
nop
and $5379, %rsi
lea addresses_D_ht+0x1d3d8, %rsi
lea addresses_WT_ht+0x7778, %rdi
xor %r9, %r9
mov $116, %rcx
rep movsq
nop
nop
nop
and %r12, %r12
lea addresses_D_ht+0x288, %r9
xor %r14, %r14
movb $0x61, (%r9)
nop
cmp $15981, %r12
lea addresses_normal_ht+0xcc88, %rdi
cmp $40266, %r12
movb (%rdi), %r9b
nop
nop
cmp $27907, %r9
lea addresses_WT_ht+0xd298, %r12
clflush (%r12)
nop
sub $61370, %rdx
movups (%r12), %xmm1
vpextrq $0, %xmm1, %r9
inc %rsi
lea addresses_WC_ht+0x12088, %rdi
nop
add %rbp, %rbp
movb $0x61, (%rdi)
nop
add %rbp, %rbp
lea addresses_WT_ht+0x1a308, %rsi
lea addresses_WC_ht+0xa138, %rdi
nop
nop
nop
lfence
mov $103, %rcx
rep movsw
nop
xor $53658, %rdx
lea addresses_WC_ht+0x9708, %rdx
nop
nop
nop
sub $31691, %rcx
mov $0x6162636465666768, %rdi
movq %rdi, (%rdx)
nop
nop
nop
nop
and $17613, %rsi
lea addresses_WT_ht+0x166c8, %r9
nop
nop
nop
nop
nop
inc %rcx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
and $0xffffffffffffffc0, %r9
movntdq %xmm3, (%r9)
nop
nop
and $39144, %r12
lea addresses_D_ht+0xea27, %r12
nop
nop
nop
nop
cmp $38910, %rdx
mov $0x6162636465666768, %r14
movq %r14, %xmm5
movups %xmm5, (%r12)
nop
nop
nop
nop
nop
cmp $13946, %rcx
lea addresses_normal_ht+0x12608, %r12
nop
nop
nop
nop
nop
cmp %rdx, %rdx
mov (%r12), %rdi
nop
nop
sub $43430, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r15
push %rbx
push %rcx
push %rdi
push %rdx
// Store
lea addresses_A+0x9288, %rdi
nop
nop
nop
sub %r14, %r14
mov $0x5152535455565758, %rdx
movq %rdx, %xmm7
movups %xmm7, (%rdi)
nop
nop
nop
and %rdx, %rdx
// Store
lea addresses_WC+0x10f88, %r15
nop
nop
nop
nop
nop
add $5191, %rcx
movb $0x51, (%r15)
nop
nop
nop
nop
xor %rdi, %rdi
// Faulty Load
lea addresses_A+0x9288, %rdx
nop
add $33249, %r10
movb (%rdx), %r15b
lea oracles, %r10
and $0xff, %r15
shlq $12, %r15
mov (%r10,%r15,1), %r15
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 8}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT_ht', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7}}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
gcc-gcc-7_3_0-release/gcc/ada/exp_prag.ads | best08618/asylo | 7 | 16397 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ P R A G --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2015, 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. --
-- --
------------------------------------------------------------------------------
-- Expand routines for pragmas
with Types; use Types;
package Exp_Prag is
procedure Expand_N_Pragma (N : Node_Id);
procedure Expand_Pragma_Contract_Cases
(CCs : Node_Id;
Subp_Id : Entity_Id;
Decls : List_Id;
Stmts : in out List_Id);
-- Given pragma Contract_Cases CCs, create the circuitry needed to evaluate
-- case guards and trigger consequence expressions. Subp_Id is the related
-- subprogram for which the pragma applies. Decls are the declarations of
-- Subp_Id's body. All generated code is added to list Stmts. If Stmts is
-- No_List on entry, a new list is created.
procedure Expand_Pragma_Initial_Condition (Spec_Or_Body : Node_Id);
-- Generate a runtime check needed to verify the assumption of introduced
-- by pragma Initial_Condition. Spec_Or_Body denotes the spec or body of
-- the package where the pragma appears. The check is inserted according
-- to the following precedence rules:
-- 1) If the package has a body with a statement sequence, the check is
-- inserted at the end of the statments.
-- 2) If the package has a body, the check is inserted at the end of the
-- body declarations.
-- 3) The check is inserted at the end of the visible declarations.
end Exp_Prag;
|
src/apsepp-generic_shared_instance-access_setter.adb | thierr26/ada-apsepp | 0 | 12007 | -- Copyright (C) 2019 <NAME> <<EMAIL>>
-- MIT license. Please refer to the LICENSE file.
package body Apsepp.Generic_Shared_Instance.Access_Setter is
----------------------------------------------------------------------------
Locker : SB_L_Locker (Lock'Access);
----------------------------------------------------------------------------
function Has_Actually_Set return Boolean
is (Locker.Has_Actually_Locked);
----------------------------------------------------------------------------
begin
if Locker.Has_Actually_Locked then
Instance_Access := Inst_Access;
CB;
end if;
end Apsepp.Generic_Shared_Instance.Access_Setter;
|
programs/oeis/283/A283123.asm | neoneye/loda | 22 | 17167 | ; A283123: a(n) = sigma(9*n).
; 13,39,40,91,78,120,104,195,121,234,156,280,182,312,240,403,234,363,260,546,320,468,312,600,403,546,364,728,390,720,416,819,480,702,624,847,494,780,560,1170,546,960,572,1092,726,936,624,1240,741,1209,720,1274,702,1092,936,1560,800,1170,780,1680,806,1248,968,1651,1092,1440,884,1638,960,1872,936,1815,962,1482,1240,1820,1248,1680,1040,2418,1093,1638,1092,2240,1404,1716,1200,2340,1170,2178,1456,2184,1280,1872,1560,2520,1274,2223,1452,2821
add $0,1
mul $0,9
sub $0,1
seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1092.asm | ljhsiun2/medusa | 9 | 241472 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r15
push %r8
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x18feb, %rsi
lea addresses_normal_ht+0xcb4b, %rdi
nop
nop
nop
nop
xor $5714, %r8
mov $109, %rcx
rep movsb
nop
nop
nop
nop
xor $64146, %rax
lea addresses_WC_ht+0x1a233, %rsi
lea addresses_D_ht+0x169ab, %rdi
clflush (%rdi)
cmp %r8, %r8
mov $81, %rcx
rep movsl
xor $32725, %rdi
lea addresses_A_ht+0x1178b, %rsi
lea addresses_A_ht+0xd3ab, %rdi
clflush (%rdi)
nop
and $16467, %r15
mov $64, %rcx
rep movsb
nop
nop
nop
nop
add $60844, %rsi
lea addresses_WC_ht+0x81b7, %rax
clflush (%rax)
nop
nop
xor $22749, %rbx
vmovups (%rax), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %rsi
nop
nop
nop
add $22393, %r8
lea addresses_A_ht+0x1daff, %rdi
nop
nop
lfence
mov (%rdi), %r8w
nop
nop
nop
nop
nop
xor $11648, %r15
lea addresses_WT_ht+0xb91d, %rbx
nop
nop
cmp $54389, %rcx
and $0xffffffffffffffc0, %rbx
vmovntdqa (%rbx), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %rax
inc %rax
lea addresses_D_ht+0x123b, %r15
nop
nop
nop
nop
nop
inc %rax
mov $0x6162636465666768, %rdi
movq %rdi, %xmm7
and $0xffffffffffffffc0, %r15
vmovaps %ymm7, (%r15)
nop
nop
nop
cmp %rcx, %rcx
lea addresses_WT_ht+0x1022b, %rsi
nop
nop
nop
nop
sub $50351, %rax
mov $0x6162636465666768, %r8
movq %r8, %xmm1
movups %xmm1, (%rsi)
nop
sub %rbx, %rbx
lea addresses_WT_ht+0x1b9ab, %rcx
nop
nop
nop
and $23992, %rsi
movb (%rcx), %al
nop
nop
nop
add %r8, %r8
lea addresses_A_ht+0xfab4, %rsi
lea addresses_WC_ht+0xb1ab, %rdi
clflush (%rsi)
xor %r11, %r11
mov $8, %rcx
rep movsw
add $44864, %r15
lea addresses_normal_ht+0x10d1b, %rax
clflush (%rax)
nop
nop
nop
nop
nop
inc %r11
vmovups (%rax), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %rsi
nop
nop
nop
nop
nop
add %rbx, %rbx
lea addresses_A_ht+0x442b, %rbx
nop
nop
dec %rcx
movl $0x61626364, (%rbx)
nop
mfence
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r15
push %r8
push %r9
push %rdx
push %rsi
// Load
lea addresses_WT+0x1b0ab, %rdx
nop
add $38045, %r15
vmovups (%rdx), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %r14
nop
nop
nop
add $28812, %r9
// Faulty Load
lea addresses_normal+0x39ab, %r9
nop
nop
nop
nop
sub %r8, %r8
vmovups (%r9), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %r14
lea oracles, %r9
and $0xff, %r14
shlq $12, %r14
mov (%r9,%r14,1), %r14
pop %rsi
pop %rdx
pop %r9
pop %r8
pop %r15
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': True, 'size': 32, 'NT': True, 'same': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 6}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
y2s2/csa/practicals/prac-5/16-challenge-3-1.asm | ouldevloper/university | 8 | 19809 | <filename>y2s2/csa/practicals/prac-5/16-challenge-3-1.asm<gh_stars>1-10
; Display 1-9 vertically
.MODEL SMALL
.STACK 100
.DATA
NL DB 13,10, "$"
num DB "1"
trailer DB " x$"
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
MOV CX, 9
DISP:
MOV AH, 02H
MOV DL, num
INT 21H
MOV AH, 09H
LEA DX, trailer
INT 21H
CALL NEWLINE
INC num
LOOP DISP
MOV AX,4C00H
INT 21H
MAIN ENDP
NEWLINE PROC
MOV AH, 09H
LEA DX, NL
INT 21H
RET
END MAIN |
src/titlescreen.asm | NEPETAISCUTE/simon-gameboy | 1 | 164340 | ld a, [wIsFirstFrame] ;checks if it's the first frame of that specific game state
cp a, False
jp z, .skipFirstScreenLoading
.titleScreenLoading
xor a, a
ld [wIsFirstFrame], a
ld a, $99
ld [wVRAMCopyDest], a
ld a, $04
ld [wVRAMCopyDest+1], a
ld a, 13
ld [wVRAMCopyLen], a
ld c, a
xor a, a
ld [wVRAMCopyType], a
ld hl, wVRAMCopyBuffer
.zerofillBufferTitleScreen
ld [hli], a
dec c
jr nz, .zerofillBufferTitleScreen
halt
ld a, $99
ld [wVRAMCopyDest], a
ld a, $24
ld [wVRAMCopyDest+1], a
ld a, 12
ld [wVRAMCopyLen], a
halt
ld a, PRESS_START_SIZE
ld [wVRAMCopyLen], a
ld c, a
ld a, $9A
ld [wVRAMCopyDest], a
ld a, $04
ld [wVRAMCopyDest+1], a
ld hl, .pressStartMenu
ld a, h
ld [wVRAMCopyBuffer], a
ld a, l
ld [wVRAMCopyBuffer+1], a
ld a, VRAMCOPY_POINTER
ld [wVRAMCopyType], a
halt
jr .skipFirstScreenLoading
PRESS_START_SIZE equ 12
.pressStartMenu:
db $13, $15, $8, $16, $16, $0, $0, $16, $17, $4, $15, $17
.skipFirstScreenLoading:
|
source/3dasm/draw.asm | arbruijn/d2gl | 0 | 20165 | <filename>source/3dasm/draw.asm
; THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
; SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
; END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
; ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
; IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
; SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
; FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
; CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
; AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
; COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
DONT_USE_UPOLY = 1
.386
option oldstructs
.nolist
include pstypes.inc
include psmacros.inc
include gr.inc
include 3d.inc
.list
assume cs:_TEXT, ds:_DATA
_DATA segment dword public USE32 'DATA'
rcsid db "$Id: draw.asm 1.33 1996/02/14 09:59:13 matt Exp $"
align 4
tempv vms_vector <>
n_verts dd ?
n_verts_4 dd ? ; added by mk, 11/29/94, point coding optimization.
bitmap_ptr dd ?
uvl_list_ptr dd ?
tmap_drawer_ptr dd draw_tmap_
flat_drawer_ptr dd gr_upoly_tmap_
line_drawer_ptr dd gr_line_
_DATA ends
_TEXT segment dword public USE32 'CODE'
extn gr_upoly_tmap_
extn draw_tmap_
;specifies new routines to call to draw polygons
;takes eax=ptr to tmap routine, edx=ptr to flat routine, ebx=line rtn
g3_set_special_render:
or eax,eax
jnz got_tmap_ptr
lea eax,cs:draw_tmap_
got_tmap_ptr: mov tmap_drawer_ptr,eax
or edx,edx
jnz got_flat_ptr
lea edx,cs:gr_upoly_tmap_
got_flat_ptr: mov flat_drawer_ptr,edx
or ebx,ebx
jnz got_line_ptr
lea ebx,cs:gr_line_
got_line_ptr: mov line_drawer_ptr,ebx
ret
;alternate entry takes pointers to points. esi,edi = point pointers
g3_draw_line:
;;ifndef NDEBUG
;; mov ax,_Frame_count ;curren frame
;; cmp ax,[esi].p3_frame ;rotated this frame?
;; break_if ne,'Point not rotated in draw_line'
;; cmp ax,[edi].p3_frame ;rotated this frame?
;; break_if ne,'Point not rotated in draw_line'
;;endif
mov al,[esi].p3_codes
mov ah,[edi].p3_codes
;check codes for reject, clip, or no clip
test al,ah ;check codes_and
jnz no_draw_line ;both off same side
or al,ah ;al=codes_or
js must_clip_line ;neg z means must clip
test [esi].p3_flags,PF_PROJECTED
jnz p0_projected
call g3_project_point
p0_projected: test [esi].p3_flags,PF_OVERFLOW
jnz must_clip_line
test [edi].p3_flags,PF_PROJECTED
jnz p1_projected
xchg esi,edi ;get point in esi
call g3_project_point
xchg esi,edi
p1_projected: test [edi].p3_flags,PF_OVERFLOW
jnz must_clip_line
pushm ebx,ecx,edx ;save regs
test al,al ;check codes or
mov eax,[esi].p3_sx
mov edx,[esi].p3_sy
mov ebx,[edi].p3_sx
mov ecx,[edi].p3_sy
jz unclipped_line ;cc set from test above
;call clipping line drawer
;; call gr_line_ ;takes eax,edx,ebx,ecx
push esi
mov esi,line_drawer_ptr
call esi
pop esi
popm ebx,ecx,edx
ret ;return value from gr_line
;we know this one is on screen
unclipped_line: ;;call gr_uline_ ;takes eax,edx,ebx,ecx
;; call gr_line_
push esi
mov esi,line_drawer_ptr
call esi
pop esi
popm ebx,ecx,edx
mov al,1 ;definitely drew
ret
;both points off same side, no do draw
no_draw_line: xor al,al ;not drawn
ret
;jumped here from out of g3_draw_line. esi,edi=points, al=codes_or
must_clip_line: call clip_line ;do the 3d clip
call g3_draw_line ;try draw again
;free up temp points
test [esi].p3_flags,PF_TEMP_POINT
jz not_temp_esi
call free_temp_point
not_temp_esi: test [edi].p3_flags,PF_TEMP_POINT
jz not_temp_edi
xchg esi,edi
call free_temp_point
not_temp_edi:
check_free_points
ret ;ret code set from g3_draw_line
;returns true if a plane is facing the viewer. takes the unrotated surface
;normal of the plane, and a point on it. The normal need not be normalized
;takes esi=vector (unrotated point), edi=normal.
;returns al=true if facing, cc=g if facing
;trashes esi,edi
g3_check_normal_facing:
push edi ;save normal
lea eax,tempv
mov edi,esi
lea esi,View_position
call vm_vec_sub
mov esi,eax ;view vector
pop edi ;normal
call vm_vec_dotprod
or eax,eax ;check sign
setg al ;true if positive
ret
;see if face is visible and draw if it is.
;takes ecx=nv, esi=point list, edi=normal, ebx=point.
;normal can be NULL, which will for compution here (which will be slow).
;returns al=-1 if not facing, else 0
;Trashes ecx,esi,edx,edi
g3_check_and_draw_poly:
call do_facing_check
or al,al
jnz g3_draw_poly
mov al,-1
ret
g3_check_and_draw_tmap:
push ebx
mov ebx,eax
call do_facing_check
pop ebx
or al,al
jnz g3_draw_tmap
mov al,-1
ret
;takes edi=normal or NULL, esi=list of vert nums, ebx=pnt
;returns al=facing?
do_facing_check:
test edi,edi ;normal passed?
jz compute_normal ;..nope
;for debug, check for NULL normal
ifndef NDEBUG
mov eax,[edi].x
or eax,[edi].y
or eax,[edi].z
break_if z,'Zero-length normal in do_facing_check'
endif
;we have the normal. check if facing
push esi
mov esi,ebx
call g3_check_normal_facing ;edi=normal
pop esi
setg al ;set al true if facing
ret
;normal not specified, so must compute
compute_normal:
pushm ebx,ecx,edx,esi
;get three points (rotated) and compute normal
mov eax,[esi] ;get point
mov edi,8[esi] ;get point
mov esi,4[esi] ;get point
lea ebx,tempv
call vm_vec_perp ;get normal
mov edi,eax ;normal in edi
call vm_vec_dotprod ;point in esi
or eax,eax ;check result
popm ebx,ecx,edx,esi
sets al ;al=true if facing
ret
;draw a flat-shaded face. returns true if drew
;takes ecx=nv, esi=list of pointers to points
;returns al=0 if called 2d, 1 if all points off screen
;Trashes ecx,esi,edx
g3_draw_poly:
pushm ebx,edi
lea edi,Vbuf0 ;list of ptrs
xor ebx,ebx ;counter
mov dx,0ff00h ;init codes
codes_loop: mov eax,[esi+ebx*4] ;get point number
mov [edi+ebx*4],eax ;store in ptr array
;;ifndef NDEBUG
;; push ebx
;; mov bx,_Frame_count ;curren frame
;; cmp bx,[eax].p3_frame ;rotated this frame?
;; break_if ne,'Point not rotated in draw_poly'
;; pop ebx
;;endif
and dh,[eax].p3_codes ;update codes_and
or dl,[eax].p3_codes ;update codes_or
inc ebx
cmp ebx,ecx ;done?
jne codes_loop ;..nope
;now dx = codes
test dh,dh ;check codes_and
jnz face_off_screen ;not visible at all
test dl,dl ;how about codes_or
js must_clip_face ;neg z means must clip
jnz must_clip_face
;reentry point for jump back from clipper
draw_poly_reentry:
push edx ;save codes_or
;now make list of 2d coords (& check for overflow)
mov edx,edi ;edx=Vbuf0
xor ebx,ebx
lea edi,Vertex_list
coords_loop: mov esi,[edx+ebx*4] ;esi = point
test [esi].p3_flags,PF_PROJECTED
jnz pnt_projected
call g3_project_point
pnt_projected: test [esi].p3_flags,PF_OVERFLOW
jnz must_clip_face2
mov eax,[esi].p3_sx
mov [edi+ebx*8],eax
mov eax,[esi].p3_sy
mov 4[edi+ebx*8],eax
inc ebx
cmp ebx,ecx
jne coords_loop
mov eax,ecx ;eax=nverts
mov edx,edi ;edx=vertslist
;check for trivial accept
pop ebx ;get codes_or
ife DONT_USE_UPOLY
test bl,bl
jz no_clip_face
endif
;;call gr_poly_ ;takes eax,edx
;;; call gr_upoly_tmap_
push ecx
mov ecx,flat_drawer_ptr
call ecx
pop ecx
popm ebx,edi
xor al,al ;say it drew
ret
;all on screen. call non-clipping version
no_clip_face: ;;call gr_upoly_ ;takes eax,edx
;; call gr_poly_
call gr_upoly_tmap_
popm ebx,edi
xor al,al ;say it drew
ret
;all the way off screen. return
face_off_screen: popm ebx,edi
mov al,1 ;no draw
ret
;we require a 3d clip
must_clip_face2: pop edx ;get codes back
must_clip_face: lea esi,Vbuf0 ;src
lea edi,Vbuf1 ;dest
mov al,dl ;codes in al
call clip_polygon ;count in ecx
mov edi,esi ;new list in edi
;clipped away?
jecxz clipped_away
or dh,dh ;check codes_and
jnz clipped_away
test dl,dl ;check codes or
js clipped_away ;some points still behind eye
push edi ;need edi to free temp pnts
push offset cs:reentry_return
pushm ebx,edi ;match what draw has pushed
jmp draw_poly_reentry
reentry_return:
pop edi
clipped_away:
push eax ;save ret codes
;free temp points
xor ebx,ebx
free_loop: mov esi,[edi+ebx*4] ;get point
test [esi].p3_flags,PF_TEMP_POINT
jz not_temp
call free_temp_point
not_temp: inc ebx
cmp ebx,ecx
jne free_loop
check_free_points
pop eax ;get ret codes back
popm ebx,edi
ret
;draw a texture-mapped face. returns true if drew
;takes ecx=nv, esi=point list, ebx=uvl_list, edx=bitmap
;returns al=0 if called 2d, 1 if all points off screen
;Trashes ecx,esi,edx
g3_draw_tmap:
mov bitmap_ptr,edx ;save
pushm ebx,edi
lea edi,Vbuf0 ;list of ptrs
push ebp ;save ebp
mov ebp,ebx ;ebp=uvl list
mov uvl_list_ptr, ebx
mov n_verts,ecx ;save in memory
shl ecx, 2
;loop to check codes, make list of point ptrs, and copy uvl's into points
mov dh, 0ffh ; init codes (this pipelines nicely)
mov n_verts_4, ecx
xor ebx, ebx
xor dl, dl ; init codes (this pipelines nicely)
t_codes_loop: mov eax,[esi+ebx] ;get point number
mov [edi+ebx],eax ;store in ptr array
and dh,[eax].p3_codes ;update codes_and
or dl,[eax].p3_codes ;update codes_or
mov ecx,[ebp] ;get u
add ebp, 4 ; (this pipelines better ..mk, 11/29/94 ((my 33rd birthday...)))
mov [eax].p3_u,ecx
mov ecx,[ebp] ;get v
add ebp, 4
mov [eax].p3_v,ecx
mov ecx,[ebp] ;get l
add ebp, 4
mov [eax].p3_l,ecx
or [eax].p3_flags,PF_UVS + PF_LVS ;this point's got em
add ebx,4
cmp ebx, n_verts_4
jne t_codes_loop ;..nope
pop ebp ;restore ebp
;now dx = codes
test dh,dh ;check codes_and
jnz t_face_off_screen ;not visible at all
test dl,dl ;how about codes_or
jnz t_must_clip_face ;non-zero means must clip
;reentry point for jump back from clipper
t_draw_poly_reentry:
;make sure all points projected
mov edx,edi ;edx=Vbuf0
xor ebx,ebx
t_proj_loop: mov esi,[edx+ebx*4] ;esi = point
;;ifndef NDEBUG
;; mov ax,_Frame_count ;curren frame
;; cmp ax,[esi].p3_frame ;rotated this frame?
;; break_if ne,'Point not rotated in draw_tmap'
;;endif
test [esi].p3_flags,PF_PROJECTED
jnz t_pnt_projected
call g3_project_point
t_pnt_projected:
test [esi].p3_flags,PF_OVERFLOW
break_if nz,'Should not overflow after clip'
jnz t_face_off_screen
inc ebx
cmp ebx,n_verts
jne t_proj_loop
;now call the texture mapper
mov eax,bitmap_ptr ;eax=bitmap ptr
mov edx,n_verts ;edx=count
mov ebx,edi ;ebx=points
;;; call draw_tmap_
push ecx
mov ecx,tmap_drawer_ptr
call ecx
pop ecx
popm ebx,edi
xor al,al ;say it drew
ret
;all the way off screen. return
t_face_off_screen: popm ebx,edi
mov al,1 ;no draw
ret
;we require a 3d clip
t_must_clip_face: lea esi,Vbuf0 ;src
lea edi,Vbuf1 ;dest
mov al,dl ;codes in al
mov ecx,n_verts
call clip_polygon ;count in ecx
mov n_verts,ecx
mov edi,esi ;new list in edi
;clipped away?
jecxz t_clipped_away
or dh,dh ;check codes_and
jnz t_clipped_away
test dl,dl ;check codes or
js t_clipped_away ;some points still behind eye
push edi ;need edi to free temp pnts
push offset cs:t_reentry_return
pushm ebx,edi ;match what draw has pushed
jmp t_draw_poly_reentry
t_reentry_return:
pop edi
t_clipped_away:
; free temp points
mov ebx, ecx
push eax ;save ret code
dec ebx
shl ebx, 2
t_free_loop: mov esi,[edi+ebx] ;get point
test [esi].p3_flags,PF_TEMP_POINT
jz t_not_temp
call free_temp_point
t_not_temp: sub ebx, 4
jns t_free_loop
check_free_points
pop eax ;get ret code
popm ebx,edi
ret
;draw a sortof-sphere. takes esi=point, ecx=radius
g3_draw_sphere: test [esi].p3_codes,CC_BEHIND
jnz reject_sphere
test [esi].p3_flags,PF_PROJECTED
jnz sphere_p_projected
call g3_project_point
sphere_p_projected:
test [esi].p3_flags,PF_OVERFLOW
jnz reject_sphere
;calc radius. since disk doesn't take width & height, let's just
;say the the radius is the width
pushm eax,ebx,ecx,edx
mov eax,ecx
fixmul Matrix_scale.x
imul Canv_w2
sphere_proj_div: divcheck [esi].z,sphere_div_overflow_handler
idiv [esi].z
mov ebx,eax
mov eax,[esi].p3_sx
mov edx,[esi].p3_sy
call gr_disk_
sphere_div_overflow_handler:
popm eax,ebx,ecx,edx
reject_sphere: ret
_TEXT ends
end
|
unused/EffectUtil.agda | Zalastax/singly-typed-actors | 1 | 5448 | module EffectUtil where
open import Data.List
open import Data.List.All
open import Data.List.Any
open import Level
open import Relation.Binary.PropositionalEquality hiding ([_])
open import Function
open import Category.Monad
open import Data.Product
-- open import EffectUtil
open import Membership-equality hiding (_⊆_; set)
infix 3 _⊆_
-- Sublist without re-ordering, to be improved later...
data _⊆_ {a}{A : Set a} : List A → List A → Set a where
[] : ∀ {ys} → [] ⊆ ys
keep : ∀ {x xs ys} → xs ⊆ ys → x ∷ xs ⊆ x ∷ ys
skip : ∀ {x xs ys} → xs ⊆ ys → xs ⊆ x ∷ ys
singleton-⊆ : ∀ {a} {A : Set a} {x : A} {xs : List A} → x ∈ xs → [ x ] ⊆ xs
singleton-⊆ (here refl) = keep []
singleton-⊆ (there mem) = skip (singleton-⊆ mem)
reflexive-⊆ : ∀ {a} {A : Set a} {xs : List A} → xs ⊆ xs
reflexive-⊆ {xs = []} = []
reflexive-⊆ {xs = x ∷ xs} = keep reflexive-⊆
|
scripts/.finder-selection.applescript | looking-for-a-job/mac-finder.py | 7 | 4055 | <filename>scripts/.finder-selection.applescript
#!/usr/bin/env oascript
tell application "Finder"
set _selection to (get selection)
if count of _selection is 0 then
return POSIX path of (target of front Finder window as text)
else
repeat with s in _selection
try
log (POSIX path of (s as alias))
on error errorMessage number errorNumber
--Can’t make alias "..." into type alias. (-1700)
if (errorNumber is not in {-1700}) then
error errorMessage number errorNumber
end if
end try
end repeat
end if
end tell
|
data/mapObjects/ceruleanmart.asm | adhi-thirumala/EvoYellow | 16 | 21383 | <filename>data/mapObjects/ceruleanmart.asm
CeruleanMartObject:
db $0 ; border block
db $2 ; warps
db $7, $3, $5, $ff
db $7, $4, $5, $ff
db $0 ; signs
db $3 ; objects
object SPRITE_MART_GUY, $0, $5, STAY, RIGHT, $1 ; person
object SPRITE_BLACK_HAIR_BOY_1, $3, $4, WALK, $1, $2 ; person
object SPRITE_LASS, $6, $2, WALK, $2, $3 ; person
; warp-to
EVENT_DISP CERULEAN_MART_WIDTH, $7, $3
EVENT_DISP CERULEAN_MART_WIDTH, $7, $4
|
oeis/111/A111406.asm | neoneye/loda-programs | 11 | 163479 | ; A111406: a(n) = f(f(n+1)) - f(f(n)), where f(m) = pi(m) = A000720(m), with f(0) = 0.
; 0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,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,1,0,0,0,0,0,0,0,1,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
mov $3,$0
mov $5,2
lpb $5
mov $0,$3
sub $5,1
add $0,$5
trn $0,1
seq $0,132090 ; a(n) = pi(pi(n)), where pi = A000720.
mov $2,$5
mul $2,$0
add $4,$2
lpe
min $3,1
mul $3,$0
mov $0,$4
sub $0,$3
|
Task/Boolean-values/AppleScript/boolean-values-3.applescript | LaudateCorpus1/RosettaCodeData | 1 | 2858 | sortItems from L given reversal : true
|
programs/oeis/282/A282779.asm | neoneye/loda | 22 | 92775 | ; A282779: Period of cubes mod n.
; 1,2,3,4,5,6,7,8,3,10,11,12,13,14,15,16,17,6,19,20,21,22,23,24,25,26,9,28,29,30,31,32,33,34,35,12,37,38,39,40,41,42,43,44,15,46,47,48,49,50,51,52,53,18,55,56,57,58,59,60,61,62,21,64,65,66,67,68,69,70,71,24,73,74,75,76,77,78,79,80,27
mov $1,$0
add $0,1
add $1,1
div $1,3
gcd $1,3
dif $0,$1
|
oeis/144/A144328.asm | neoneye/loda-programs | 11 | 246359 | ; A144328: A002260 preceded by a column of 1's: a (1, 1, 2, 3, 4, 5,...) crescendo triangle by rows.
; Submitted by <NAME>
; 1,1,1,1,1,2,1,1,2,3,1,1,2,3,4,1,1,2,3,4,5,1,1,2,3,4,5,6,1,1,2,3,4,5,6,7,1,1,2,3,4,5,6,7,8,1,1,2,3,4,5,6,7,8,9,1,1,2,3,4,5,6,7,8,9,10,1,1,2,3,4,5,6,7,8,9,10,11,1,1,2,3,4,5,6,7,8,9,10,11,12,1,1,2,3,4,5,6,7,8
seq $0,25675 ; Exponent of 8 (value of j) in n-th number of form 7^i*8^j.
mul $0,1977326743
div $0,1977326753
add $0,1
|
courses/fundamentals_of_ada/labs/prompts/180_polymorphism/shapes.adb | AdaCore/training_material | 15 | 10196 | <reponame>AdaCore/training_material
with Ada.Numerics.Generic_Elementary_Functions;
package body Shapes is
package Math is new Ada.Numerics.Generic_Elementary_Functions (Float_T);
function Distance
(Vertex1 : Vertex_T;
Vertex2 : Vertex_T)
return Float_T is
begin
return
Math.Sqrt ((Vertex1.X - Vertex2.X)**2 + (Vertex1.Y - Vertex2.Y)**2);
end Distance;
-- Implement primitives as defined in the spec
end Shapes;
|
agda-stdlib-0.9/src/Coinduction.agda | qwe2/try-agda | 1 | 11320 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Basic types related to coinduction
------------------------------------------------------------------------
module Coinduction where
import Level
------------------------------------------------------------------------
-- A type used to make recursive arguments coinductive
infix 1000 ♯_
postulate
∞ : ∀ {a} (A : Set a) → Set a
♯_ : ∀ {a} {A : Set a} → A → ∞ A
♭ : ∀ {a} {A : Set a} → ∞ A → A
{-# BUILTIN INFINITY ∞ #-}
{-# BUILTIN SHARP ♯_ #-}
{-# BUILTIN FLAT ♭ #-}
------------------------------------------------------------------------
-- Rec, a type which is analogous to the Rec type constructor used in
-- ΠΣ (see Altenkirch, Danielsson, Löh and Oury. ΠΣ: Dependent Types
-- without the Sugar. FLOPS 2010, LNCS 6009.)
data Rec {a} (A : ∞ (Set a)) : Set a where
fold : (x : ♭ A) → Rec A
unfold : ∀ {a} {A : ∞ (Set a)} → Rec A → ♭ A
unfold (fold x) = x
{-
-- If --guardedness-preserving-type-constructors is enabled one can
-- define types like ℕ by recursion:
open import Data.Sum
open import Data.Unit
ℕ : Set
ℕ = ⊤ ⊎ Rec (♯ ℕ)
zero : ℕ
zero = inj₁ _
suc : ℕ → ℕ
suc n = inj₂ (fold n)
ℕ-rec : (P : ℕ → Set) →
P zero →
(∀ n → P n → P (suc n)) →
∀ n → P n
ℕ-rec P z s (inj₁ _) = z
ℕ-rec P z s (inj₂ (fold n)) = s n (ℕ-rec P z s n)
-- This feature is very experimental, though: it may lead to
-- inconsistencies.
-}
|
Cubical/Structures/MultiSet.agda | cmester0/cubical | 1 | 4589 | <reponame>cmester0/cubical
{-# OPTIONS --cubical --no-exact-split --safe #-}
module Cubical.Structures.MultiSet where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.SIP renaming (SNS-PathP to SNS)
open import Cubical.Functions.FunExtEquiv
open import Cubical.Structures.Pointed
open import Cubical.Structures.Queue
open import Cubical.Data.Unit
open import Cubical.Data.Sum
open import Cubical.Data.Nat
open import Cubical.Data.Sigma
module _(A : Type ℓ)
(Aset : isSet A) where
open Queues-on A Aset
member-structure : Type ℓ → Type ℓ
member-structure X = A → X → ℕ
Member : Type (ℓ-suc ℓ)
Member = TypeWithStr ℓ member-structure
member-iso : StrIso member-structure ℓ
member-iso (X , f) (Y , g) e = ∀ a x → f a x ≡ g a (e .fst x)
Member-is-SNS : SNS {ℓ} member-structure member-iso
Member-is-SNS = SNS-≡→SNS-PathP member-iso ((λ _ _ → funExt₂Equiv))
-- a multi set structure inspired bei Okasaki
multi-set-structure : Type ℓ → Type ℓ
multi-set-structure X = X × (A → X → X) × (A → X → ℕ)
Multi-Set : Type (ℓ-suc ℓ)
Multi-Set = TypeWithStr ℓ multi-set-structure
multi-set-iso : StrIso multi-set-structure ℓ
multi-set-iso (X , emp₁ , insert₁ , memb₁) (Y , emp₂ , insert₂ , memb₂) e =
(e .fst emp₁ ≡ emp₂)
× (∀ a q → e .fst (insert₁ a q) ≡ insert₂ a (e .fst q))
× (∀ a x → memb₁ a x ≡ memb₂ a (e .fst x))
Multi-Set-is-SNS : SNS {ℓ₁ = ℓ} multi-set-structure multi-set-iso
Multi-Set-is-SNS =
join-SNS pointed-iso pointed-is-SNS
{S₂ = λ X → (left-action-structure X) × (member-structure X)}
(λ B C e → (∀ a q → e .fst (B .snd .fst a q) ≡ C .snd .fst a (e .fst q))
× (∀ a x → (B .snd .snd a x) ≡ (C .snd .snd a (e .fst x))))
(join-SNS left-action-iso Left-Action-is-SNS member-iso Member-is-SNS)
|
programs/oeis/096/A096501.asm | karttu/loda | 0 | 12560 | ; A096501: Difference between primes preceding n+1 and n.
; 0,4,1,0,2,0,2,0,0,0,4,0,2,0,0,0,4,0,2,0,0,0,4,0,0,0,0,0,6,0,2,0,0,0,0,0,6,0,0,0,4,0,2,0,0,0,4,0,0,0,0,0,6,0,0,0,0,0,6,0,2,0,0,0,0,0,6,0,0,0,4,0,2,0,0,0,0,0,6,0,0,0,4,0,0,0,0,0,6,0,0,0,0,0,0,0,8,0,0,0,4,0,2,0,0,0,4,0,2,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,4,0,0,0,0,0,6,0,2,0,0,0,0,0,0,0,0,0,10,0,2,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,4,0,0,0,0,0,6,0,0,0,0,0,6,0,2,0,0,0,0,0,0,0,0,0,10,0,2,0,0,0,4,0,2,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,4,0,2,0,0,0,4,0,0,0,0,0,6,0,2,0,0,0,0,0,0,0,0,0
mov $4,$0
mov $6,2
lpb $6,1
clr $0,4
mov $0,$4
sub $6,1
add $0,$6
sub $0,1
lpb $0,1
mov $1,$0
mov $2,3
cal $1,70320 ; Max( phi(k) : k=1,2,3,...,n ).
mov $0,0
add $2,$1
lpe
mov $1,$2
mov $7,$6
lpb $7,1
mov $5,$1
sub $7,1
lpe
lpe
lpb $4,1
mov $4,0
sub $5,$1
lpe
mov $1,$5
|
alloy4fun_models/trashltl/models/16/JjwPXD86vztdPJJrw.als | Kaixi26/org.alloytools.alloy | 0 | 1500 | <gh_stars>0
open main
pred idJjwPXD86vztdPJJrw_prop17 {
all f: File |always (eventually f in Trash) implies after f not in File
}
pred __repair { idJjwPXD86vztdPJJrw_prop17 }
check __repair { idJjwPXD86vztdPJJrw_prop17 <=> prop17o } |
oeis/192/A192917.asm | neoneye/loda-programs | 11 | 90291 | <filename>oeis/192/A192917.asm
; A192917: Coefficient of x in the reduction by (x^2 -> x+1) of the polynomial C(n)*x^n, where C=A022095.
; Submitted by <NAME>
; 0,5,6,22,51,140,360,949,2478,6494,16995,44500,116496,304997,798486,2090470,5472915,14328284,37511928,98207509,257110590,673124270,1762262211,4613662372,12078724896,31622512325,82788812070,216743923894,567442959603,1485584954924,3889311905160,10182350760565,26657740376526,69790870369022,182714870730531,478353741822580,1252346354737200,3278685322389029,8583709612429878,22472443514900614,58833620932271955,154028419281915260,403251636913473816,1055726491458506197,2763927837462044766
seq $0,266700 ; Coefficient of x in minimal polynomial of the continued fraction [1^n,1/2,1,1,1,...], where 1^n means n ones.
mov $2,$0
sub $2,1
sub $2,$0
mul $2,$0
mov $0,$2
div $0,2
|
wof/lcs/base/318.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 103776 | copyright zengfr site:http://github.com/zengfr/romhack
00162E addq.w #1, ($318,A5) [base+324]
001632 rts [base+318]
008804 beq $882e [base+318]
008C04 beq $8c48 [base+318]
008FFE beq $9048 [base+318]
009282 beq $92ac [base+318]
00956C beq $9594 [base+318]
0096F6 beq $9720 [base+318]
0098CE beq $98ec [base+318]
009AA6 beq $9aca [base+318]
009F60 beq $9f82 [base+318]
01A66A move.w D0, ($318,A5) [base+324]
01A66E lea ($420,A5), A0
022C48 clr.w ($318,A5) [base+324]
022C4C tst.b ($199,A5) [base+318]
copyright zengfr site:http://github.com/zengfr/romhack
|
libsrc/_DEVELOPMENT/alloc/obstack/c/sccz80/obstack_room.asm | teknoplop/z88dk | 8 | 23920 |
; ===============================================================
; Dec 2013
; ===============================================================
;
; size_t obstack_room(struct obstack *ob)
;
; Number of free bytes available in the obstack.
;
; ===============================================================
SECTION code_clib
SECTION code_alloc_obstack
PUBLIC obstack_room
EXTERN asm_obstack_room
defc obstack_room = asm_obstack_room
|
data/mapObjects/fuchsiagym.asm | etdv-thevoid/pokemon-rgb-enhanced | 1 | 90636 | FuchsiaGymObject:
db $3 ; border block
db $2 ; warps
db $11, $4, $5, $ff
db $11, $5, $5, $ff
db $0 ; signs
db $8 ; objects
object SPRITE_KOGA, $4, $a, STAY, DOWN, $1, OPP_KOGA, $1
object SPRITE_ROCKER, $8, $d, STAY, DOWN, $2, OPP_JUGGLER, $4
object SPRITE_ROCKER, $7, $8, STAY, RIGHT, $3, OPP_JUGGLER, $2
object SPRITE_ROCKER, $1, $c, STAY, DOWN, $4, OPP_JUGGLER, $5
object SPRITE_ROCKER, $3, $5, STAY, UP, $5, OPP_TAMER, $1
object SPRITE_ROCKER, $8, $2, STAY, DOWN, $6, OPP_TAMER, $2
object SPRITE_ROCKER, $2, $7, STAY, LEFT, $7, OPP_JUGGLER, $3
object SPRITE_GYM_HELPER, $7, $f, STAY, DOWN, $8 ; person
; warp-to
EVENT_DISP FUCHSIA_GYM_WIDTH, $11, $4
EVENT_DISP FUCHSIA_GYM_WIDTH, $11, $5
|
problems/049/a049.adb | melwyncarlo/ProjectEuler | 0 | 13369 | with Ada.Text_IO;
with Ada.Integer_Text_IO;
-- Copyright 2021 <NAME>
procedure A049 is
use Ada.Text_IO;
use Ada.Integer_Text_IO;
-- File Reference: http://www.naturalnumbers.org/primes.html
N : constant Integer := 10;
FT : File_Type;
Last_Index : Natural;
Prime_Num : String (1 .. 10);
File_Name : constant String :=
"problems/003/PrimeNumbers_Upto_1000000";
Primes_Nums : array (Integer range 1 .. 1200,
Integer range 1 .. N) of Integer
:= (others => (others => 0));
Primes_Digits_Occurrences : array (Integer range 1 .. 1200) of Integer
:= (others => 0);
Prime_Digits : String (1 .. N) := (others => Character'Val (0));
Primes_Digits : array (Integer range 1 .. 1200) of String (1 .. N)
:= (others => (others => Character'Val (0)));
Duplicate_Found : Boolean;
I, J, K, L, M : Integer;
begin
I := 1;
Open (FT, In_File, File_Name);
while not End_Of_File (FT) loop
Get_Line (FT, Prime_Num, Last_Index);
if Integer'Value (Prime_Num (1 .. Last_Index)) >= 1000 then
if Integer'Value (Prime_Num (1 .. Last_Index)) <= 9999 then
Prime_Digits := "0000000000";
Prime_Digits (Integer'Value (Prime_Num (1 .. 1)) + 1) := '1';
Prime_Digits (Integer'Value (Prime_Num (2 .. 2)) + 1) := '1';
Prime_Digits (Integer'Value (Prime_Num (3 .. 3)) + 1) := '1';
Prime_Digits (Integer'Value (Prime_Num (4 .. 4)) + 1) := '1';
Duplicate_Found := False;
for J in 1 .. I loop
if Primes_Digits (J) = Prime_Digits then
if Primes_Nums (J, N) = 0 then
for K in 2 .. N loop
if Primes_Nums (J, K) = 0 then
Primes_Nums (J, K) := Integer'Value (
Prime_Num (1 .. Last_Index));
exit;
end if;
end loop;
Primes_Digits_Occurrences (J) :=
Primes_Digits_Occurrences (J) + 1;
end if;
Duplicate_Found := True;
exit;
end if;
end loop;
if not Duplicate_Found then
Primes_Digits_Occurrences (I) := 0;
Primes_Nums (I, 1) := Integer'Value (
Prime_Num (1 .. Last_Index));
Primes_Digits (I) := Prime_Digits;
I := I + 1;
end if;
end if;
end if;
end loop;
Close (FT);
J := 1;
K := 1;
L := 1;
M := 1;
J_Loop :
while J <= I loop
if Primes_Digits_Occurrences (J) >= 3 then
K := 1;
while K <= (N - 2) loop
if Primes_Nums (J, K) = 0 then
exit;
end if;
if Primes_Nums (J, K) /= 1487 then
L := K + 1;
while L <= (N - 1) loop
if Primes_Nums (J, L) = 0 then
exit;
end if;
M := L + 1;
while M <= N loop
if Primes_Nums (J, M) = 0 then
exit;
end if;
if (Primes_Nums (J, M) - Primes_Nums (J, L)) =
(Primes_Nums (J, L) - Primes_Nums (J, K))
then
exit J_Loop;
end if;
M := M + 1;
end loop;
L := L + 1;
end loop;
end if;
K := K + 1;
end loop;
end if;
J := J + 1;
end loop J_Loop;
Put (Primes_Nums (J, K), Width => 0);
Put (Primes_Nums (J, L), Width => 0);
Put (Primes_Nums (J, M), Width => 0);
end A049;
|
src/main/antlr/Expr.g4 | kylepls/Expr3 | 1 | 121 | grammar Expr;
operation : assignment
| expr
;
expr: function_call # OP_FUNC
| expr EXP<assoc=right> expr # OP_EXP
| expr op=(MUL|DIV) expr # OP_MULDIV
| expr (MOD) expr # OP_MOD
| expr op=(ADD|SUB) expr # OP_ADDSUB
| expr op=(EQ|GT|GTE|LT|LTE) expr # OP_COMPARE
| ABS expr ABS # ABS
| PAR_OPEN expr PAR_CLOSE PAR_OPEN expr PAR_CLOSE # IMP_MUL
| (number NAME | NAME number) # IMP_MUL_2
| PAR_OPEN expr PAR_CLOSE # PARENS
| NAME # OP_GETVAR
| number # OP_NUMBER
;
assignment : NAME EQ expr ;
function_call: NAME PAR_OPEN (expr (ARG_SEP expr)*)? PAR_CLOSE
| NAME expr;
number : SUB? INT ('.' INT)? (('E') power=INT)?;
ARG_SEP : ',' ;
NAME : [a-zA-Z]+ ;
PAR_OPEN : '(' ;
PAR_CLOSE : ')' ;
// NUM
ADD: '+' ;
SUB: '-' ;
DIV: '/' ;
MUL: '*' ;
MOD: '%' ;
EXP: '^' ;
ABS: '|' ;
// BOOL
GTE: '>=';
LTE: '<=';
EQ : '=' ;
GT : '>' ;
LT : '<' ;
WS: ' ' -> skip ;
INT: [0-9]+ ; |
data/test-files/Absurd.agda | carlostome/martin | 0 | 9596 | <gh_stars>0
module Absurd where
open import Prelude
absurd : {A : Set} -> Empty -> A
absurd x = {!!}
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1569.asm | ljhsiun2/medusa | 9 | 245964 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %rax
push %rdx
push %rsi
lea addresses_WT_ht+0xfd1f, %r13
nop
nop
nop
nop
nop
add %rsi, %rsi
mov $0x6162636465666768, %rax
movq %rax, %xmm0
and $0xffffffffffffffc0, %r13
movaps %xmm0, (%r13)
add %rdx, %rdx
pop %rsi
pop %rdx
pop %rax
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r9
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_RW+0xc024, %rsi
lea addresses_WC+0x113ec, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
sub $30935, %r9
mov $96, %rcx
rep movsb
nop
nop
sub $14336, %rdi
// Faulty Load
lea addresses_WT+0x12864, %r9
nop
nop
nop
nop
nop
sub %rsi, %rsi
mov (%r9), %r11
lea oracles, %r13
and $0xff, %r11
shlq $12, %r11
mov (%r13,%r11,1), %r11
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_RW', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC', 'congruent': 3, 'same': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': True}}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
source/data/zeropage.asm | mega65dev/rom-assembler | 0 | 160328 | ; ********************************************************************************************
; ********************************************************************************************
;
; Name : zeropage.asm
; Purpose : ..
; Created : 15th Nov 1991
; Updated : 4th Jan 2021
; Authors : <NAME>
;
; ********************************************************************************************
; ********************************************************************************************
* = $0000
!fill 2 ; '4510' registers (not used in C65 mode)
srchtk !fill 1 ; token 'search' looks for (run-time stack) / SYS 'bank#'
* = $000a ; skip over SYS address, status, a/x/y/z registers
integr ; used by math routines (this & following location)
charac !fill 1
endchr !fill 1
verck !fill 1 ; LOAD/VERIFY flag
count !fill 1 ; temp used all over
dimflg !fill 1 ; DIM flag used by variable search
valtyp !fill 1 ; 0=numeric, $FF=string
intflg !fill 1 ; b7: (0=float,1=integer), b6: (1=get flag)
garbfl ; garbage collection temporary
dores !fill 1 ; b7: P1LINE quote flag
subflg !fill 1 ; b7: subscript flag (set to disallow subscripts() & integers%)
input_flag !fill 1 ; READ($98), GET($40), or INPUT($00)
domask
tansgn !fill 1
channl !fill 1 ; active I/O channel
poker ; temp used all over
linnum !fill 2 ; line number
temppt !fill 1 ; pointer to next temporary descriptor in tempst
lastpt !fill 2 ; pointer to last used temporary string
tempst !fill 9 ; temporary descriptor pointers (3 at 3 bytes each)
index
index1 !fill 2
index2 !fill 2
multiplicand ; 2 bytes wide, for unsigned integer multiply
resho !fill 1
resmoh !fill 1
product ; 3 bytes wide, for unsigned integer multiply
addend
resmo !fill 1
reslo !fill 1
!fill 1
txttab !fill 2 ; where BASIC program begins (text_bank)
vartab !fill 2 ; where variable descriptors begin (var_bank)
arytab !fill 2 ; where array table begins (var_bank)
strend !fill 2 ; where arrays table ends (var_bank)
fretop !fill 2 ; bottom of string storage (var_bank)
frespc !fill 2 ; where temporary strings begin (var_bank)
max_mem_1 !fill 2 ; highest address available to BASIC in RAM 1 (var_bank)
curlin !fill 2
txtptr !fill 2 ; pointer to BASIC text used by CHRGET, etc.
form ; used by print using
fndpnt !fill 2 ; pointer to item found by search
datlin !fill 2
datptr !fill 2
inpptr !fill 2
varnam !fill 2
fdecpt
varpnt !fill 2
lstpnt
andmsk
forpnt !fill 2
eormsk =forpnt+1
vartxt
opptr !fill 2
opmask !fill 1
grbpnt
tempf3
defpnt !fill 2
dscpnt !fill 2
token_saver ; temp used by P1LINE/HELPSB (was spare????) [910628]
trmpos !fill 1 ; temp used by SPC(), TAB() [910628]
helper !fill 1 ; P1LINE flag b7: HELP vs. LIST
; b6: memory vs. file
; b5: FIND/CHANGE
; b4: highlight tokens
; b3: highlight REM
; b1: LINGET flag for AUTOSCROLL
; b0: token in progress
jmper !fill 1 ; 3 locations used by Function handler
!fill 1 ;
oldov !fill 1 ;
tempf1 !fill 1 ; used by math routines
ptarg1 =tempf1 ; multiply defined for INSTR thru FACexp
ptarg2 =tempf1+2 ; (also used by Monitor Utility, thru lowtr)
str1 =tempf1+4
str2 =tempf1+7
positn =tempf1+10
match =tempf1+11
arypnt
highds !fill 2
hightr !fill 2
tempf2 !fill 1 ; used by math routines
deccnt !fill 2
tenexp = deccnt+1
grbtop
dptflg
lowtr !fill 1
expsgn !fill 1
fac ; Floating point accumulator (primary) FAC1
dsctmp
facexp !fill 1
facho !fill 1
facmoh !fill 1
indice
facmo !fill 1
faclo !fill 1
facsgn !fill 1
degree
sgnflg !fill 1
argexp !fill 1 ; Floating point accumulator (secondary) FAC2
argho !fill 1
argmoh !fill 1
argmo !fill 1
arglo !fill 1
argsgn !fill 1
strng1
arisgn !fill 1
facov !fill 1
strng2
polypt
curtol
fbufpt !fill 2
autinc !fill 2 ; incremental value for AUTO (0=off)
z_p_temp_1 !fill 1 ; USING's leading zero counter
;GET, RENUMBER, KEY temporary
;MOVSPR, SPRITE, PLAY, VOL temporary
;MID$= temporary
hulp ; counter
keysiz !fill 1
syntmp !fill 1 ; used as temp all over the place
dsdesc !fill 3 ; descriptor for DS$
tos !fill 2 ; top of run time stack
runmod !fill 1 ; flags run/direct(b7), load(b6), trace(b5), edit(b4) modes
; autoboot wedge (b0)
point ; USING's pointer to decimal point, 2 bytes used by AutoScroll
parsts !fill 1 ; DOS parser status word
parstx !fill 1 ; DOS parser status extensions
oldstk !fill 1 ; BASIC saves uP stack pointer here
text_top !fill 2 ; top of BASIC text pointer (in text_bank)
text_bank !fill 1 ; where BASIC text lives (RAM0 default)
var_bank !fill 1 ; where BASIC vars live (RAM1 default)
sys_bank = 0 ; where system space is ???? (RAM0, make this a var?)
sid_speed_flag !fill 1 ; saves system speed during SID ops (used during IRQ)
time ; temporaries for TI, TI$, SLEEP (4 bytes)
grapnt ; used by SPRSAV, RMOUSE, RCOLOR
op
column !fill 1 ; temporaries for FIND/CHANGE, [L]INPUT, [L]READ, CURSOR
srow
fstr1 !fill 3 ;
fstr2 !fill 3 ;
; ********************************************************************************************
;
; Date Changes
; ==== =======
;
; ********************************************************************************************
|
programs/oeis/071/A071792.asm | jmorken/loda | 1 | 172861 | ; A071792: Decimal expansion of the fourth (of 10) decimal selvage number; the n-th digit of a decimal selvage number, x, is equal to the tenths digit of n*x.
; 3,7,1,4,8,2,6,9,3,7,0,4,8,2,5,9,3,6,0,4,8,1,5,9,2,6,0,4,7,1,5,8,2,6,0,3,7,1,4,8,2,6,9,3,7,0,4,8,2,5,9,3,6,0,4,8,1,5,9,2,6,0,4,7,1,5,8,2,6,0,3,7,1,4,8,2,6,9,3,7,0,4,8,2,5,9,3,6,0,4,8,1,5,9,2,6,0,4,7,1
add $0,2
lpb $0
sub $0,1
mul $0,26
div $0,7
mov $1,$0
mov $0,$2
mod $1,10
lpe
|
src/ASN1/Untyped.agda | semenov-vladyslav/asn1-agda | 0 | 801 | module ASN1.Untyped where
open import Data.Word8 using (Word8; _and_; _or_; _==_) renaming (primWord8fromNat to to𝕎; primWord8toNat to from𝕎)
open import Data.ByteString using (ByteString; Strict; empty; pack; fromChunks; toStrict)
open import Data.ByteString.Utf8 using (packStrict)
open import Data.Bool using (Bool; true; false)
open import Data.Nat using (ℕ; _+_; _*_)
open import Data.List using (List; []; _∷_; concatMap)
open import Data.Sum using (_⊎_; inj₁; inj₂)
open import Data.Product using (_×_; _,_)
open import Data.String using (String)
open import Relation.Nullary using (Dec; yes; no)
open import ASN1.Util
-- only short (8-bit) tags are supported
Tag = Word8
-- length can be arbitrary big; TODO: restrict to Int64?
Len = ℕ
data Value : Set
data AST : Set
data Value where
prim : (octets : ByteString Strict) → Value
constr : (vs : List AST) → Value
data AST where
tlv : (t : Tag) → (v : Value) → AST
private
constructed-flag : Word8
constructed-flag = to𝕎 0x20
context-specific-flag : Word8
context-specific-flag = to𝕎 0x80
constructed : Tag → Tag
constructed = _or constructed-flag
is-constructed : Tag → Bool
is-constructed t = (t and constructed-flag) == constructed-flag
context-specific : Tag → Tag
context-specific = _or context-specific-flag
is-context-specific : Tag → Bool
is-context-specific t = (t and context-specific-flag) == context-specific-flag
universal : ℕ
universal = 0
tag : ℕ → Tag
tag = to𝕎
OID = List ℕ
-- basic asn.1 types
module _ where
EXPLICIT : Tag → AST → AST
EXPLICIT t v = tlv (context-specific t) (constr (v ∷ []))
IMPLICIT : Tag → AST → AST
IMPLICIT t (tlv _ vs) = tlv t vs
NULL : AST
NULL = tlv (tag 5) (prim empty)
BOOLEAN : Bool → AST
BOOLEAN b = tlv (tag 1) (prim (pack (bv b ∷ []))) where
bv : Bool → Word8
bv b with b
... | true = to𝕎 0xff
... | false = to𝕎 0
INTEGER : ℕ → AST
INTEGER n = tlv (to𝕎 2) (prim (pack (base256 n)))
SEQUENCE : List AST → AST
SEQUENCE vs = tlv (tag 16) (constr vs)
SET : List AST → AST
SET vs = tlv (tag 17) (constr vs)
BIT-STRING : ℕ → ByteString Strict → AST
BIT-STRING unused os = tlv (tag 3) (prim (toStrict (fromChunks ((pack (to𝕎 unused ∷ [])) ∷ os ∷ []))))
OCTET-STRING : ByteString Strict → AST
OCTET-STRING os = tlv (tag 4) (prim os)
OBJECT-IDENTIFIER : OID → AST
OBJECT-IDENTIFIER oid = tlv (to𝕎 6) (prim (pack (packOID oid))) where
packOID : List ℕ → List Word8
packOID [] = [] -- invalid oid
packOID (n ∷ []) = to𝕎 n ∷ [] -- invalid oid
packOID (n ∷ n′ ∷ ns) = concatMap base128 ((40 * n + n′) ∷ ns) where
UTF8String : String → AST
UTF8String s = tlv (to𝕎 12) (prim (packStrict s))
GeneralizedTime : String → AST
GeneralizedTime yyyymmddhhz = tlv (to𝕎 24) (prim (packStrict yyyymmddhhz))
|
libsrc/video/tms9918/l_tms9918_disable_interrupts_im1.asm | jpoikela/z88dk | 640 | 92348 | <filename>libsrc/video/tms9918/l_tms9918_disable_interrupts_im1.asm
SECTION code_clib
PUBLIC l_tms9918_disable_interrupts
PUBLIC l_tms9918_enable_interrupts
EXTERN l_push_di
EXTERN l_pop_ei
defc l_tms9918_disable_interrupts = l_push_di
defc l_tms9918_enable_interrupts = l_pop_ei
|
src/PJ/input/doskeysh.asm | AnimatorPro/Animator-Pro | 119 | 174670 | CGROUP group code
code segment dword 'CODE'
assume cs:CGROUP,ds:CGROUP
include errcodes.i
public dos_key_shift
;dos_key_shift()
; returns keyboard shift/control/alt state
dos_key_shift proc near
mov ah,2
int 16h
and eax,0ffh
ret
dos_key_shift endp
code ends
end
|
oeis/068/A068012.asm | neoneye/loda-programs | 11 | 26063 | <filename>oeis/068/A068012.asm<gh_stars>10-100
; A068012: Number of subsets of {1,2,3,...,n} that sum to 0 mod 6.
; Submitted by <NAME>
; 1,1,1,2,3,6,12,22,44,88,172,344,688,1368,2736,5472,10928,21856,43712,87392,174784,349568,699072,1398144,2796288,5592448,11184896,22369792,44739328,89478656,178957312,357914112,715828224,1431656448,2863311872
mov $3,$0
seq $0,60547 ; a(n) is the number of patterns, invariant under 120 degree rotations, that may appear in a top-down equilateral triangular arrangement of closely packed black and white cells satisfying the local matching rule of Pascal's triangle modulo 2, where n is the number of cells in each edge of the arrangement.
mov $2,2
pow $2,$3
add $0,$2
sub $0,3
div $0,6
add $0,1
|
agda-stdlib/src/Data/List/Relation/BagAndSetEquality.agda | DreamLinuxer/popl21-artifact | 5 | 11701 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- This module is DEPRECATED. Please use
-- Data.List.Relation.Binary.BagAndSetEquality directly.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.List.Relation.BagAndSetEquality where
open import Data.List.Relation.Binary.BagAndSetEquality public
{-# WARNING_ON_IMPORT
"Data.List.Relation.BagAndSetEquality was deprecated in v1.0.
Use Data.List.Relation.Binary.BagAndSetEquality instead."
#-}
|
src/security-policies-roles.ads | jquorning/ada-security | 19 | 1748 | <filename>src/security-policies-roles.ads
-----------------------------------------------------------------------
-- security-policies-roles -- Role based policies
-- Copyright (C) 2010, 2011, 2012, 2017, 2018 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
-- == Role Based Security Policy ==
-- The `Security.Policies.Roles` package implements a role based security policy.
-- In this policy, users are assigned one or several roles and permissions are
-- associated with roles. A permission is granted if the user has one of the roles required
-- by the permission.
--
-- === Policy creation ===
-- An instance of the `Role_Policy` must be created and registered in the policy manager.
-- Get or declare the following variables:
--
-- Manager : Security.Policies.Policy_Manager;
-- Policy : Security.Policies.Roles.Role_Policy_Access;
--
-- Create the role policy and register it in the policy manager as follows:
--
-- Policy := new Role_Policy;
-- Manager.Add_Policy (Policy.all'Access);
--
-- === Policy Configuration ===
-- A role is represented by a name in security configuration files. A role based permission
-- is associated with a list of roles. The permission is granted if the user has one of these
-- roles. When the role based policy is registered in the policy manager, the following
-- XML configuration is used:
--
-- <policy-rules>
-- <security-role>
-- <role-name>admin</role-name>
-- </security-role>
-- <security-role>
-- <role-name>manager</role-name>
-- </security-role>
-- <role-permission>
-- <name>create-workspace</name>
-- <role>admin</role>
-- <role>manager</role>
-- </role-permission>
-- ...
-- </policy-rules>
--
-- This definition declares two roles: `admin` and `manager`
-- It defines a permission `create-workspace` that will be granted if the
-- user has either the `admin` or the `manager` role.
--
-- Each role is identified by a name in the configuration file. It is represented by
-- a `Role_Type`. To provide an efficient implementation, the `Role_Type`
-- is represented as an integer with a limit of 64 different roles.
--
-- === Assigning roles to users ===
-- A `Security_Context` must be associated with a set of roles before checking the
-- permission. This is done by using the `Set_Role_Context` operation:
--
-- Security.Policies.Roles.Set_Role_Context (Security.Contexts.Current, "admin");
--
package Security.Policies.Roles is
NAME : constant String := "Role-Policy";
-- Each role is represented by a <b>Role_Type</b> number to provide a fast
-- and efficient role check.
type Role_Type is new Natural range 0 .. 63;
for Role_Type'Size use 8;
type Role_Type_Array is array (Positive range <>) of Role_Type;
type Role_Name_Array is array (Positive range <>) of Ada.Strings.Unbounded.String_Access;
-- The <b>Role_Map</b> represents a set of roles which are assigned to a user.
-- Each role is represented by a boolean in the map. The implementation is limited
-- to 64 roles (the number of different permissions can be higher).
type Role_Map is array (Role_Type'Range) of Boolean;
pragma Pack (Role_Map);
-- Get the number of roles set in the map.
function Get_Count (Map : in Role_Map) return Natural;
-- Return the list of role names separated by ','.
function To_String (List : in Role_Name_Array) return String;
-- ------------------------------
-- Role principal context
-- ------------------------------
-- The <tt>Role_Principal_Context</tt> interface must be implemented by the user
-- <tt>Principal</tt> to be able to use the role based policy. The role based policy
-- controller will first check that the <tt>Principal</tt> implements that interface.
-- It uses the <tt>Get_Roles</tt> function to get the current roles assigned to the user.
type Role_Principal_Context is limited interface;
function Get_Roles (User : in Role_Principal_Context) return Role_Map is abstract;
-- ------------------------------
-- Policy context
-- ------------------------------
-- The <b>Role_Policy_Context</b> gives security context information that the role
-- based policy can use to verify the permission.
type Role_Policy_Context is new Policy_Context with record
Roles : Role_Map;
end record;
type Role_Policy_Context_Access is access all Role_Policy_Context'Class;
-- Set the roles which are assigned to the user in the security context.
-- The role policy will use these roles to verify a permission.
procedure Set_Role_Context (Context : in out Security.Contexts.Security_Context'Class;
Roles : in Role_Map);
-- Set the roles which are assigned to the user in the security context.
-- The role policy will use these roles to verify a permission.
procedure Set_Role_Context (Context : in out Security.Contexts.Security_Context'Class;
Roles : in String);
-- ------------------------------
-- Role based policy
-- ------------------------------
type Role_Policy is new Policy with private;
type Role_Policy_Access is access all Role_Policy'Class;
Invalid_Name : exception;
-- Get the policy name.
overriding
function Get_Name (From : in Role_Policy) return String;
-- Find the role type associated with the role name identified by <b>Name</b>.
-- Raises <b>Invalid_Name</b> if there is no role type.
function Find_Role (Manager : in Role_Policy;
Name : in String) return Role_Type;
-- Get the role name.
function Get_Role_Name (Manager : in Role_Policy;
Role : in Role_Type) return String;
-- Get the roles that grant the given permission.
function Get_Grants (Manager : in Role_Policy;
Permission : in Permissions.Permission_Index) return Role_Map;
-- Get the list of role names that are defined by the role map.
function Get_Role_Names (Manager : in Role_Policy;
Map : in Role_Map) return Role_Name_Array;
-- Create a role
procedure Create_Role (Manager : in out Role_Policy;
Name : in String;
Role : out Role_Type);
-- Get or add a role type for the given name.
procedure Add_Role_Type (Manager : in out Role_Policy;
Name : in String;
Result : out Role_Type);
-- Set the roles specified in the <tt>Roles</tt> parameter. Each role is represented by
-- its name and multiple roles are separated by ','.
-- Raises Invalid_Name if a role was not found.
procedure Set_Roles (Manager : in Role_Policy;
Roles : in String;
Into : out Role_Map);
-- Setup the XML parser to read the <b>role-permission</b> description.
overriding
procedure Prepare_Config (Policy : in out Role_Policy;
Mapper : in out Util.Serialize.Mappers.Processing);
-- Finalize the policy manager.
overriding
procedure Finalize (Policy : in out Role_Policy);
-- Get the role policy associated with the given policy manager.
-- Returns the role policy instance or null if it was not registered in the policy manager.
function Get_Role_Policy (Manager : in Security.Policies.Policy_Manager'Class)
return Role_Policy_Access;
private
-- Array to map a permission index to a list of roles that are granted the permission.
type Permission_Role_Array is array (Permission_Index) of Role_Map;
type Role_Map_Name_Array is array (Role_Type'Range) of Ada.Strings.Unbounded.String_Access;
type Role_Policy is new Policy with record
Names : Role_Map_Name_Array := (others => null);
Next_Role : Role_Type := Role_Type'First;
Name : Util.Beans.Objects.Object;
Roles : Role_Type_Array (1 .. Integer (Role_Type'Last)) := (others => 0);
Count : Natural := 0;
-- The Grants array indicates for each permission the list of roles
-- that are granted the permission. This array allows a O(1) lookup.
-- The implementation is limited to 256 permissions and 64 roles so this array uses 2K.
-- The default is that no role is assigned to the permission.
Grants : Permission_Role_Array := (others => (others => False));
end record;
end Security.Policies.Roles;
|
cpp-macro-parser/Preprocessor.g4 | zoloypzuo/regex_engine | 0 | 3911 | grammar Preprocessor;
chunk : block EOF;
// MSDN本来用text这个词,但是很模糊,text还包含C++代码部分,不只是宏语言
// 这里我使用block
// MSDN在这里描述模糊,我自己的理解是,每行至多一个宏指令语句
// 所以换行符被算入语法,不是当作空白符跳过
// text: Any sequence of text
//
// 首先源文本可以是空的
// 然后最后一行可以没有换行
//
// antlr能解析,我不能
// stat Newline
// Newline
// stat
// 最后一行可以没有空格,但是空格是分开stat之间的
block : (stat? Newline)* stat?;
// 经过实验,#和define之间是可以有空白符
stat
: '#' 'define' Identifier token_string? # define_stat
| '#' 'undef' Identifier # undef_stat
// 这里不会有if-else匹配错误的问题,LL算法进到block后if总是匹配正确的else
| if_part /*elif_parts?*/ else_part? endif_line # conditional_stat
;
if_part : if_line Newline block;
if_line
: /*#if constant_expression
|*/ '#' 'ifdef' Identifier # ifdef
| '#' 'ifndef' Identifier # ifndef
;
/*
elif_parts : elif_line text
| elif_parts elif_line text
;
elif_line : #elif constant_expression
*/
else_part : else_line Newline block;
else_line : '#' 'else';
endif_line : '#' 'endif';
// token_string定义被题目简化和限制,其实是字面量表达式
/*token_string : token+;
token : keyword
| identifier
| constant
| operator
| punctuator
;
*/
token_string
: Bool # bool_exp
| Char # char_exp // 忽略宽字符
| INT # int_exp
| FLOAT # float_exp
| string # string_exp
| '{' fieldlist? '}' # aggregate_exp // MSDN没有找到BNF描述,自己照着lua的table-constructor写一个
;
fieldlist : token_string (',' token_string)* ','?;
/* lexer */
// antlr提示不支持\v
// [ \t\v\f]+ -> skip
Whitespace : [ \t]+ -> skip;
Newline: ( '\r\n' | '\n'); // 保留空白符
// [x] 转为空格不知道antlr怎么写
// 单行注释是两个/开头,然后这行的内容被忽略,直到遇到换行符
LineComment: '//' ~[\r\n]* -> skip; // to ' '
// 多行注释是/**/中内容被忽略,注意多行注释不能嵌套,这个是非贪婪的,遇到第一个*/时解释
BlockComment: '/*' .*? '*/' -> skip; // to ' '
Bool : 'true' | 'false';
Char : '\'' ~'\'' '\'';
// number和string先参考一下lua,和MSDN标准是不一样的
number
: INT | HEX | FLOAT
;
string
: NORMALSTRING
| LONGSTRING
;
NORMALSTRING : '"' ( EscapeSequence | ~'"' )* '"';
LONGSTRING : 'L' NORMALSTRING;
INT
: Digit+
;
HEX
: '0' [xX] HexDigit+
;
// 这里加了f后缀
FLOAT
: Digit+ '.' Digit* ExponentPart? 'f'?
| '.' Digit+ ExponentPart? 'f'?
| Digit+ ExponentPart 'f'?
;
fragment
ExponentPart
: [eE] [+-]? Digit+
;
fragment
EscapeSequence
: '\\' [abfnrtvz"'\\]
| '\\' '\r'? '\n'
| DecimalEscape
| HexEscape
| UtfEscape
;
fragment
DecimalEscape
: '\\' Digit
| '\\' Digit Digit
| '\\' [0-2] Digit Digit
;
fragment
HexEscape
: '\\' 'x' HexDigit HexDigit
;
fragment
UtfEscape
: '\\' 'u{' HexDigit+ '}'
;
fragment
Digit
: [0-9]
;
fragment
HexDigit
: [0-9a-fA-F]
;
// 印象笔记 《true被识别为标识符》
Identifier : [a-zA-Z_][a-zA-Z_0-9]*; |
source/required/s-pack15.ads | ytomino/drake | 33 | 12359 | <filename>source/required/s-pack15.ads
pragma License (Unrestricted);
-- implementation unit required by compiler
with System.Packed_Arrays;
package System.Pack_15 is
pragma Preelaborate;
-- It can not be Pure, subprograms would become __attribute__((const)).
type Bits_15 is mod 2 ** 15;
for Bits_15'Size use 15;
package Indexing is new Packed_Arrays.Indexing (Bits_15);
-- required for accessing arrays by compiler
function Get_15 (
Arr : Address;
N : Natural;
Rev_SSO : Boolean)
return Bits_15
renames Indexing.Get;
procedure Set_15 (
Arr : Address;
N : Natural;
E : Bits_15;
Rev_SSO : Boolean)
renames Indexing.Set;
end System.Pack_15;
|
Cubical/HITs/FreeGroupoid/GroupoidActions.agda | thomas-lamiaux/cubical | 1 | 12594 | <reponame>thomas-lamiaux/cubical<gh_stars>1-10
{-
This file contains:
- Natural functions from FreeGroupoid into FreeGroupoid
- Proofs that they induce equivalences
- Natural paths in Universe from FreeGroupoid to FreeGroupoid
- Proofs that these functions and paths respect the groupoid structure of FreeGroupoid
-}
{-# OPTIONS --safe #-}
module Cubical.HITs.FreeGroupoid.GroupoidActions where
open import Cubical.HITs.FreeGroupoid.Base
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Univalence
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Equiv.BiInvertible
open import Cubical.Foundations.Function
private
variable
ℓ : Level
A : Type ℓ
-- A function for every element of FreeGroupoid A
action : ∀ (a : FreeGroupoid A) → FreeGroupoid A → FreeGroupoid A
action a g = g · a
invAction : FreeGroupoid A → FreeGroupoid A → FreeGroupoid A
invAction a = action (inv a)
-- Naturality properties of the FreeGroupoid operations
multNaturality : (g1 g2 : FreeGroupoid A) → action (g1 · g2) ≡ (action g2 ∘ action g1)
multNaturality g1 g2 = funExt (pointwise g1 g2) where
pointwise : (g1 g2 g3 : FreeGroupoid A) → action (g1 · g2) g3 ≡ (action g2 ∘ action g1) g3
pointwise g1 g2 g3 =
action (g1 · g2) g3
≡⟨ assoc g3 g1 g2 ⟩
(action g2 ∘ action g1) g3 ∎
idNaturality : action ε ≡ idfun (FreeGroupoid A)
idNaturality = funExt pointwise where
pointwise : (g : FreeGroupoid A) → action ε g ≡ idfun (FreeGroupoid A) g
pointwise g =
action ε g
≡⟨ sym (idr g) ⟩
idfun _ g ∎
rCancelAction : ∀ (a : FreeGroupoid A) → action a ∘ invAction a ≡ idfun (FreeGroupoid A)
rCancelAction a =
action a ∘ invAction a
≡⟨ sym (multNaturality (inv a) a) ⟩
action ((inv a) · a)
≡⟨ cong action (invl a) ⟩
action ε
≡⟨ idNaturality ⟩
idfun _ ∎
lCancelAction : ∀ (a : FreeGroupoid A) → invAction a ∘ action a ≡ idfun (FreeGroupoid A)
lCancelAction a =
invAction a ∘ action a
≡⟨ sym (multNaturality a (inv a)) ⟩
action (a · (inv a))
≡⟨ cong action (invr a) ⟩
action ε
≡⟨ idNaturality ⟩
idfun _ ∎
-- Characterization of the action functions
actionCharacterization : ∀ (f : FreeGroupoid A → FreeGroupoid A)
→ (∀ g1 g2 → f (g1 · g2) ≡ g1 · (f g2))
→ Σ[ a ∈ FreeGroupoid A ] (f ≡ action a)
actionCharacterization f property = f ε , (funExt pointwise) where
pointwise : ∀ g → f g ≡ action (f ε) g
pointwise g =
f g
≡⟨ cong f (idr g) ⟩
f (g · ε)
≡⟨ property g ε ⟩
action (f ε) g ∎
-- Actions induce equivalences
biInvAction : FreeGroupoid A → BiInvEquiv (FreeGroupoid A) (FreeGroupoid A)
biInvAction a = biInvEquiv (action a) (invAction a) (rhomotopy a) (invAction a) (lhomotopy a) where
rhomotopy : ∀ a g → (action a ∘ invAction a) g ≡ g
rhomotopy a g = cong (λ f → f g) (rCancelAction a)
lhomotopy : ∀ a g → (invAction a ∘ action a) g ≡ g
lhomotopy a g = cong (λ f → f g) (lCancelAction a)
equivs : FreeGroupoid A → (FreeGroupoid A) ≃ (FreeGroupoid A)
equivs a = biInvEquiv→Equiv-right (biInvAction a)
-- Naturality properties of the equivs group
multEquivsNaturality : ∀ (k1 k2 : FreeGroupoid A) → equivs (k1 · k2) ≡ compEquiv (equivs k1) (equivs k2)
multEquivsNaturality k1 k2 = equivEq h where
h : (equivs (k1 · k2)) .fst ≡ (compEquiv (equivs k1) (equivs k2)) .fst
h =
equivs (k1 · k2) .fst
≡⟨ multNaturality k1 k2 ⟩
compEquiv (equivs k1) (equivs k2) .fst ∎
idEquivsNaturality : equivs ε ≡ idEquiv (FreeGroupoid A)
idEquivsNaturality = equivEq h where
h : (equivs ε) .fst ≡ idEquiv (FreeGroupoid A) .fst
h =
(equivs ε) .fst
≡⟨ idNaturality ⟩
idEquiv _ .fst ∎
invEquivsNaturality : ∀ (g : FreeGroupoid A) → equivs (inv g) ≡ invEquiv (equivs g)
invEquivsNaturality g = equivEq refl
-- Actions induce paths in Universe
pathsInU : {A : Type ℓ} → FreeGroupoid A → (FreeGroupoid A) ≡ (FreeGroupoid A)
pathsInU a = ua (equivs a)
-- Naturality properties of the paths group
multPathsInUNaturality : ∀ (g1 g2 : FreeGroupoid A) → pathsInU (g1 · g2) ≡ (pathsInU g1) ∙ (pathsInU g2)
multPathsInUNaturality g1 g2 =
pathsInU (g1 · g2)
≡⟨ cong ua (multEquivsNaturality g1 g2) ⟩
ua (compEquiv (equivs g1) (equivs g2))
≡⟨ uaCompEquiv (equivs g1) (equivs g2) ⟩
(pathsInU g1) ∙ (pathsInU g2) ∎
idPathsInUNaturality : pathsInU {A = A} ε ≡ refl
idPathsInUNaturality =
pathsInU ε
≡⟨ cong ua idEquivsNaturality ⟩
ua (idEquiv _)
≡⟨ uaIdEquiv ⟩
refl ∎
invPathsInUNaturality : ∀ (g : FreeGroupoid A) → pathsInU (inv g) ≡ sym (pathsInU g)
invPathsInUNaturality g =
pathsInU (inv g)
≡⟨ cong ua (invEquivsNaturality g) ⟩
ua (invEquiv (equivs g))
≡⟨ uaInvEquiv (equivs g) ⟩
sym (pathsInU g) ∎
|
src/box_info.adb | SKNZ/BoiteMaker | 0 | 18465 | with ada.characters.latin_1;
with logger;
use logger;
package body box_info is
function initialize_box(t, w, l, h, q, b : integer) return box_info_t is
box : constant box_info_t := (thickness => t,
height => h,
width => w,
length => l,
queue_length => q,
inner_height => b);
begin
debug("Initialisation de la boite");
debug(to_string(box));
return box;
end;
-- requiert :
-- t, l, w, q, h, b, q > 0
-- l >= w
-- l-2t, w-2t > 0
-- b < h-2t
-- q <= l-4t (Test aussi sur la inner boite d'où le 4)
-- q <= w-4t (Test aussi sur la inner boite d'où le 4)
-- q <= h-2t
-- q <= b-2t
procedure validate_box_measurements(box : box_info_t) is
begin
debug("Verification des mesures entrées");
if not (box.thickness > 0) then
raise invalid_args with "t > 0";
end if;
if not (box.length > 0) then
raise invalid_args with "l > 0";
end if;
if not (box.width > 0) then
raise invalid_args with "w > 0";
end if;
if not (box.queue_length > 0) then
raise invalid_args with "q > 0";
end if;
if not (box.height > 0) then
raise invalid_args with "h > 0";
end if;
if not (box.inner_height > 0) then
raise invalid_args with "b > 0";
end if;
if not (box.queue_length > 0) then
raise invalid_args with "q > 0";
end if;
if not (box.length >= box.width) then
raise invalid_args with "l >= w";
end if;
if not (box.length - 2 * box.thickness > 0) then
raise invalid_args with "l - 2 * t > 0";
end if;
if not (box.width - 2 * box.thickness > 0) then
raise invalid_args with "w - 2 * t > 0";
end if;
if not (box.inner_height < box.height - 2 * box.thickness) then
raise invalid_args with "b < h - 2 * t";
end if;
if not (box.queue_length <= box.length - 4 * box.thickness) then
raise invalid_args with "q <= l - 4 * t";
end if;
if not (box.queue_length <= box.width - 4 * box.thickness) then
raise invalid_args with "q <= w - 4 * t";
end if;
if not (box.queue_length <= box.height - 2 * box.thickness) then
raise invalid_args with "q <= h - 2 * t";
end if;
if not (box.queue_length <= box.inner_height - 2 * box.thickness) then
raise invalid_args with "q <= b - 2 * t";
end if;
end;
-- renvoie une chaine de texte décrivant l'état de l'objet
function to_string(box : box_info_t) return string is
tab : constant character := ada.characters.latin_1.HT;
lf : constant character := ada.characters.latin_1.LF;
begin
return "[ "
& tab & "t: " & integer'image(box.thickness) & ", " & lf
& tab & "w: " & integer'image(box.width) & ", " & lf
& tab & "l: " & integer'image(box.length) & ", " & lf
& tab & "h: " & integer'image(box.height) & ", " & lf
& tab & "q: " & integer'image(box.queue_length) & ", " & lf
& tab & "b: " & integer'image(box.inner_height) & " ]";
end;
end box_info;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1589.asm | ljhsiun2/medusa | 9 | 3433 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r8
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x706d, %rbp
sub %rcx, %rcx
movl $0x61626364, (%rbp)
nop
nop
nop
nop
nop
and $11623, %r9
lea addresses_WC_ht+0x16154, %rdi
nop
nop
and %rax, %rax
mov (%rdi), %r12w
nop
nop
sub $62223, %rdi
lea addresses_WC_ht+0x12b18, %rbp
sub $33452, %r8
movl $0x61626364, (%rbp)
nop
nop
add %r12, %r12
lea addresses_A_ht+0x18235, %rsi
lea addresses_WC_ht+0x18a5, %rdi
nop
nop
inc %rbp
mov $11, %rcx
rep movsq
nop
nop
nop
nop
sub %r12, %r12
lea addresses_A_ht+0x72a5, %rsi
lea addresses_normal_ht+0x1dca5, %rdi
dec %r8
mov $28, %rcx
rep movsl
nop
nop
xor $4374, %r8
lea addresses_WT_ht+0x115a5, %r8
clflush (%r8)
sub $20706, %rsi
mov (%r8), %r12
dec %r8
lea addresses_normal_ht+0x1cfa5, %rsi
lea addresses_WC_ht+0x19ca5, %rdi
clflush (%rsi)
nop
xor %r9, %r9
mov $25, %rcx
rep movsb
nop
nop
nop
cmp %rax, %rax
lea addresses_D_ht+0x4bfd, %r9
xor $27095, %rcx
mov $0x6162636465666768, %rax
movq %rax, (%r9)
nop
nop
nop
nop
cmp $56433, %r8
lea addresses_A_ht+0x1b35b, %r9
nop
add $13300, %rax
mov $0x6162636465666768, %rdi
movq %rdi, %xmm5
vmovups %ymm5, (%r9)
nop
sub $56180, %rax
lea addresses_UC_ht+0x3a5, %rbp
nop
nop
nop
nop
nop
and %rcx, %rcx
movl $0x61626364, (%rbp)
nop
nop
nop
and %r12, %r12
lea addresses_WT_ht+0x1eae5, %rsi
lea addresses_normal_ht+0x136c5, %rdi
nop
nop
xor %rax, %rax
mov $49, %rcx
rep movsb
nop
nop
nop
and %rdi, %rdi
lea addresses_D_ht+0x4fe5, %rax
nop
nop
nop
and %rdi, %rdi
mov (%rax), %r9d
nop
nop
cmp %r12, %r12
lea addresses_WT_ht+0x14a5, %r12
nop
nop
sub $1722, %r8
mov (%r12), %esi
nop
nop
nop
nop
nop
add $31959, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r14
push %rbp
push %rdi
push %rdx
// Store
lea addresses_D+0x25db, %r12
nop
nop
nop
nop
nop
add $4625, %r10
mov $0x5152535455565758, %rdx
movq %rdx, %xmm0
movntdq %xmm0, (%r12)
nop
nop
nop
nop
nop
add $9200, %r10
// Load
lea addresses_RW+0xe8a5, %r12
nop
nop
cmp %rbp, %rbp
movups (%r12), %xmm5
vpextrq $0, %xmm5, %rdx
sub $34174, %rdi
// Load
lea addresses_UC+0xdf25, %rdx
nop
nop
nop
nop
nop
inc %r14
mov (%rdx), %rdi
nop
cmp $29247, %rbp
// Faulty Load
lea addresses_RW+0xe8a5, %rbp
add $56667, %rdi
movups (%rbp), %xmm2
vpextrq $1, %xmm2, %r10
lea oracles, %rdx
and $0xff, %r10
shlq $12, %r10
mov (%rdx,%r10,1), %r10
pop %rdx
pop %rdi
pop %rbp
pop %r14
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': True, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_RW', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 6}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_RW', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 4}, 'dst': {'same': True, 'type': 'addresses_normal_ht', 'congruent': 8}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': True, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca_notsx.log_21829_1226.asm | ljhsiun2/medusa | 9 | 170251 | <filename>Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca_notsx.log_21829_1226.asm
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
// Load
lea addresses_UC+0x17ab9, %r11
nop
nop
nop
nop
nop
inc %rbx
movb (%r11), %r8b
nop
nop
nop
nop
add $39790, %r11
// Faulty Load
mov $0x66dc6900000006b0, %rcx
clflush (%rcx)
nop
nop
nop
add $45675, %r9
vmovups (%rcx), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $1, %xmm7, %r8
lea oracles, %r11
and $0xff, %r8
shlq $12, %r8
mov (%r11,%r8,1), %r8
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
3-mid/opengl/source/lean/model/opengl-model-sphere-colored.ads | charlie5/lace | 20 | 9910 | <reponame>charlie5/lace<filename>3-mid/opengl/source/lean/model/opengl-model-sphere-colored.ads
with
openGL.Geometry;
package openGL.Model.sphere.colored
--
-- Models a colored sphere.
--
is
type Item is new openGL.Model.sphere.item with -- TODO: Make private.
record
Color : lucid_Color;
end record;
type View is access all Item'Class;
---------
--- Forge
--
function new_Sphere (Radius : in Real;
Color : in lucid_Color) return View;
--------------
--- Attributes
--
overriding
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
end openGL.Model.sphere.colored;
|
source/textio/a-lfteio.ads | ytomino/drake | 33 | 12313 | pragma License (Unrestricted);
with Ada.Text_IO;
package Ada.Long_Float_Text_IO is new Text_IO.Float_IO (Long_Float);
|
SLIDE_Ring0.asm | XlogicX/CactusCon2017 | 2 | 25451 | <reponame>XlogicX/CactusCon2017
%include 'textmode.h'
call draw_border
mov di, 160 * 2 + 8 ;where to place cursor
mov si, line01 ;fetch the text
mov ah, 0x0A ;color
call slide_line
mov di, 160 * 4 + 8 ;where to place cursor
mov si, line02 ;fetch the text
call slide_line
mov di, 160 * 6 + 8 ;where to place cursor
mov si, line03 ;fetch the text
call slide_line
mov di, 160 * 8 + 8 ;where to place cursor
mov si, line04 ;fetch the text
call slide_line
mov di, 160 * 10 + 8 ;where to place cursor
mov si, line05 ;fetch the text
call slide_line
mov di, 160 * 14 + 8 ;where to place cursor
mov si, line06 ;fetch the text
call slide_line
mov di, 160 * 16 + 16 ;where to place cursor
mov si, line07 ;fetch the text
call slide_line
jmp endloop
endloop:
jmp endloop
%include 'slide_frame.h'
%include 'pause.h'
line01 db 0x09, 0x07, 'HLT-Halt'
line02 db 0x20, 0x07, 'INVD-Invalidate Internal Caches'
line03 db 0x25, 0x07, 'LLDT-Load Local Descriptor Table Reg'
line04 db 0x1F, 0x07, 'MONITOR-Set Up Monitor Address'
line05 db 0x22, 0x07, 'WRMSR-Write to Model Specific Reg'
line06 db 0x45, 'Others: INVLPG,INVPCID,LGDT/LIDT,LTR,MWAIT,RDMSR,RDPMC,WBINVD,XSETBV,'
line07 db 0x3E, 'INVEPT,INVVPID,VMCLEAR,VMRESUME,VMPTRLD,VMPTRST,VMREAD,VMWRITE'
titlemessage db 0x13, 'Ring-0 Instructions'
;BIOS sig and padding
times 510-($-$$) db 0
dw 0xAA55 |
TasteModel/blsclient/blsclient.ads | ESROCOS/control-mc_watchdog | 0 | 29210 | -- This file was generated automatically: DO NOT MODIFY IT !
with Base_Types;
use Base_Types;
with TASTE_ExtendedTypes;
use TASTE_ExtendedTypes;
with TASTE_BasicTypes;
use TASTE_BasicTypes;
with UserDefs_Base_Types;
use UserDefs_Base_Types;
with adaasn1rtl;
use adaasn1rtl;
package blsclient is
-- Provided interface "mot_cmd"
procedure mot_cmd(cmd_val: access asn1SccBase_commands_Motion2D);
pragma Export(C, mot_cmd, "blsclient_PI_mot_cmd");
end blsclient; |
agda/BBHeap/Height/Log.agda | bgbianchi/sorting | 6 | 7854 | <reponame>bgbianchi/sorting
{-# OPTIONS --sized-types #-}
open import Relation.Binary.Core
module BBHeap.Height.Log {A : Set}
(_≤_ : A → A → Set)
(tot≤ : Total _≤_ ) where
open import BBHeap _≤_ hiding (#)
open import BBHeap.Height _≤_
open import BBHeap.Properties _≤_
open import Bound.Lower A
open import Data.Sum renaming (_⊎_ to _∨_)
open import SNat
open import SNat.Log
open import SNat.Order
open import SNat.Order.Properties
open import SNat.Properties
open import SNat.Sum
open import Relation.Binary.PropositionalEquality
lemma-height-≃ : {b b' : Bound}{l : BBHeap b}{r : BBHeap b'} → l ≃ r → height l ≡ height r
lemma-height-≃ ≃lf = refl
lemma-height-≃ (≃nd _ _ _ _ _ _ l≃l') rewrite lemma-height-≃ l≃l' = refl
lemma-height'-≃ : {b b' : Bound}{l : BBHeap b}{r : BBHeap b'} → l ≃ r → height' l ≡ height' r
lemma-height'-≃ ≃lf = refl
lemma-height'-≃ (≃nd _ _ _ _ l≃r l'≃r' l≃l') rewrite lemma-height'-≃ (trans≃ (trans≃ (sym≃ l≃r) l≃l') l'≃r') = refl
lemma-height-height'-⋗ : {b b' : Bound}{l : BBHeap b}{r : BBHeap b'} → l ⋗ r → height l ≡ succ (height' r)
lemma-height-height'-⋗ (⋗lf _) = refl
lemma-height-height'-⋗ (⋗nd _ _ _ _ _ l'≃r' l⋗l') rewrite lemma-height-height'-⋗ l⋗l' | lemma-height'-≃ l'≃r' = refl
lemma-height-height'-⋘ : {b b' : Bound}{l : BBHeap b}{r : BBHeap b'} → l ⋘ r → height l ≡ height' r ∨ height l ≡ succ (height' r)
lemma-height-height'-⋘ lf⋘ = inj₁ refl
lemma-height-height'-⋘ (ll⋘ _ _ l⋘r _ l'≃r' r≃l')
with lemma-height-height'-⋘ l⋘r
... | inj₁ hl≡h'r rewrite hl≡h'r | lemma-height'-≃ (trans≃ r≃l' l'≃r') = inj₁ refl
... | inj₂ hl≡h'r+1 rewrite hl≡h'r+1 | lemma-height'-≃ (trans≃ r≃l' l'≃r') = inj₂ refl
lemma-height-height'-⋘ (lr⋘ _ _ _ _ l'≃r' l⋗l') rewrite lemma-height-height'-⋗ (lemma⋗≃ l⋗l' l'≃r')= inj₂ refl
lemma-height-height'-⋙ : {b b' : Bound}{l : BBHeap b}{r : BBHeap b'} → l ⋙ r → height l ≡ height' r ∨ height l ≡ succ (height' r)
lemma-height-height'-⋙ (⋙lf _) = inj₂ refl
lemma-height-height'-⋙ (⋙rl _ _ _ _ _ l⋗r') rewrite lemma-height-height'-⋗ l⋗r' = inj₂ refl
lemma-height-height'-⋙ (⋙rr _ _ _ _ l'⋙r' l≃l')
with lemma-height-height'-⋙ l'⋙r'
... | inj₁ hl'≡h'r' rewrite lemma-height-≃ l≃l' | hl'≡h'r' = inj₁ refl
... | inj₂ hl'≡h'r'+1 rewrite lemma-height-≃ l≃l' | hl'≡h'r'+1 = inj₂ refl
lemma-height-height' : {b : Bound}(h : BBHeap b) → height h ≡ height' h ∨ height h ≡ succ (height' h)
lemma-height-height' leaf = inj₁ refl
lemma-height-height' (left _ l⋘r)
with lemma-height-height'-⋘ l⋘r
... | inj₁ hl≡h'r rewrite hl≡h'r = inj₁ refl
... | inj₂ hl≡h'r+1 rewrite hl≡h'r+1 = inj₂ refl
lemma-height-height' (right _ l⋙r)
with lemma-height-height'-⋙ l⋙r
... | inj₁ hl≡h'r rewrite hl≡h'r = inj₁ refl
... | inj₂ hl≡h'r+1 rewrite hl≡h'r+1 = inj₂ refl
lemma-#-≃ : {b b' : Bound}{l : BBHeap b}{r : BBHeap b'} → l ≃ r → # l ≡ # r
lemma-#-≃ ≃lf = refl
lemma-#-≃ (≃nd _ _ _ _ l≃r l'≃r' l≃l')
rewrite lemma-#-≃ (sym≃ l≃r)
| lemma-#-≃ l≃l'
| lemma-#-≃ l'≃r' = refl
lemma-#-⋗ : {b b' : Bound}{l : BBHeap b}{r : BBHeap b'} → l ⋗ r → # l ≡ succ (# r + # r)
lemma-#-⋗ (⋗lf _) = refl
lemma-#-⋗ (⋗nd _ _ _ _ l≃r l'≃r' l⋗l')
rewrite lemma-#-≃ (sym≃ l≃r)
| lemma-#-⋗ l⋗l'
| lemma-#-≃ l'≃r' = refl
lemma-⋘-# : {b b' : Bound}{l : BBHeap b}{r : BBHeap b'} → l ⋘ r → # r ≤′ # l
lemma-⋘-# lf⋘ = refl≤′
lemma-⋘-# (ll⋘ {r' = r'} _ _ l⋘r _ l'≃r' r≃l')
rewrite lemma-#-≃ r≃l'
| lemma-#-≃ l'≃r' = lemma-s≤′s (+-right-monotony-≤′ (# r') (lemma-≡-≤′ (lemma-#-≃ (sym≃ (trans≃ r≃l' l'≃r'))) (lemma-⋘-# l⋘r)))
lemma-⋘-# (lr⋘ {r = r} {r' = r'} _ _ _ _ l'≃r' l⋗l')
rewrite lemma-#-⋗ l⋗l'
| lemma-#-≃ l'≃r' = lemma-s≤′s (≤′-step (lemma-m≤′m+n (# r' + # r') (# r)))
lemma-#-⋙ : {b b' : Bound}{l : BBHeap b}{r : BBHeap b'} → l ⋙ r → # l ≤′ succ (# r + # r)
lemma-#-⋙ (⋙lf _) = refl≤′
lemma-#-⋙ (⋙rl {l' = l'}{r' = r'} _ _ _ l≃r l'⋘r' l⋗r')
rewrite lemma-#-≃ (sym≃ l≃r)
| lemma-#-⋗ l⋗r'
| +-assoc-succ (# r' + # r') (# r' + # r')
| +-assoc-succ (# l' + # r') (# l' + # r') = lemma-s≤′s (lemma-s≤′s (lemma-s≤′s (lemma-4m≤′n+m+n+m (lemma-⋘-# l'⋘r'))))
lemma-#-⋙ (⋙rr {l' = l'} {r' = r'} _ _ _ l≃r _ l≃l')
rewrite lemma-#-≃ (sym≃ l≃r)
| lemma-#-≃ l≃l'
| +-assoc-succ (# l' + # r') (# l' + # r') = lemma-s≤′s (≤′-step (≤′-step (lemma-2m≤′m+n+m+n (# l') (# r'))))
mutual
lemma-⋙-# : {b b' : Bound}{l : BBHeap b}{r : BBHeap b'} → l ⋙ r → # r ≤′ # l
lemma-⋙-# (⋙lf _) = ≤′-step refl≤′
lemma-⋙-# (⋙rl {r' = r'} _ _ _ l≃r l'⋘r' l⋗r')
rewrite lemma-#-≃ (sym≃ l≃r)
| lemma-#-⋗ l⋗r' = lemma-s≤′s (trans≤′ (+-right-monotony-≤′ (# r') (lemma-#-⋘ l'⋘r')) (lemma-s≤′s (+-left-monotony-≤′ (# r' + # r') (≤′-step (lemma-n≤′2n (# r'))))))
lemma-⋙-# (⋙rr {l' = l'} {r' = r'} _ _ _ l≃r l'⋙r' l≃l')
rewrite lemma-#-≃ (sym≃ l≃r)
| lemma-#-≃ l≃l'
| +-comm (# l') (# r') = lemma-s≤′s (+-right-monotony-≤′ (# l') (lemma-⋙-# l'⋙r'))
lemma-#-⋘ : {b b' : Bound}{l : BBHeap b}{r : BBHeap b'} → l ⋘ r → # l ≤′ succ (# r + # r)
lemma-#-⋘ lf⋘ = ≤′-step refl≤′
lemma-#-⋘ (ll⋘ {r = r} _ _ l⋘r _ l'≃r' r≃l')
rewrite lemma-#-≃ (sym≃ l'≃r')
| lemma-#-≃ (sym≃ r≃l')
| +-assoc-succ (# r + # r) (# r + # r)
| +-assoc-left (# r + # r) (# r) (# r) = lemma-s≤′s (≤′-step (trans≤′ (+-right-monotony-≤′ (# r) (lemma-#-⋘ l⋘r)) (lemma-s≤′s (lemma-m≤′m+n ((# r + # r) + # r) (# r)))))
lemma-#-⋘ (lr⋘ {r' = r'} _ _ l⋙r _ l'≃r' l⋗l')
rewrite lemma-#-⋗ l⋗l'
| lemma-#-≃ l'≃r' = lemma-s≤′s (lemma-s≤′s (+-left-monotony-≤′ (# r' + # r') (trans≤′ (lemma-⋙-# l⋙r) (lemma-≡-≤′ (lemma-#-⋗ (lemma⋗≃ l⋗l' l'≃r')) refl≤′))))
lemma-#-#' : {b : Bound}(h : BBHeap b) → #' h ≤′ # h
lemma-#-#' leaf = refl≤′
lemma-#-#' (left {r = r} _ l⋘r) = lemma-s≤′s (trans≤′ (lemma-2m≤′2n (lemma-#-#' r)) (+-right-monotony-≤′ (# r) (lemma-⋘-# l⋘r)))
lemma-#-#' (right {r = r} _ l⋙r) = lemma-s≤′s (trans≤′ (lemma-2m≤′2n (lemma-#-#' r)) (+-right-monotony-≤′ (# r) (lemma-⋙-# l⋙r)))
lemma-height'-#' : {b : Bound}(h : BBHeap b) → height' h ≤′ log₂ (#' h + #' h)
lemma-height'-#' leaf = refl≤′
lemma-height'-#' (left {r = r} _ _) = trans≤′ (lemma-s≤′s (trans≤′ (lemma-height'-#' r) (lemma-≤′-log (≤′-step (refl≤′ {#' r + #' r}))))) (lemma-1+logn≤′log2n (#' r + #' r))
lemma-height'-#' (right {r = r} _ _) = trans≤′ (lemma-s≤′s (trans≤′ (lemma-height'-#' r) (lemma-≤′-log (≤′-step (refl≤′ {#' r + #' r}))))) (lemma-1+logn≤′log2n (#' r + #' r))
lemma-height'-# : {b : Bound}(h : BBHeap b) → height' h ≤′ succ (log₂ (# h))
lemma-height'-# h = trans≤′ (trans≤′ (lemma-height'-#' h) (lemma-log2n≤′1+logn (#' h))) (lemma-s≤′s (lemma-≤′-log (lemma-#-#' h)))
theorem-height-# : {b : Bound}(h : BBHeap b) → height h ≤′ succ (succ (log₂ (# h)))
theorem-height-# h
with lemma-height-height' h
... | inj₁ hh≡h'h rewrite hh≡h'h = ≤′-step (lemma-height'-# h)
... | inj₂ hh≡h'h+1 rewrite hh≡h'h+1 = lemma-s≤′s (lemma-height'-# h)
|
msx/rc2014-extended/rc2014-extended.asm | zoggins/yellow-msx-series-for-rc2014 | 19 | 85988 |
ORG 08000H
include "msx.inc"
INCLUDE "fossil.sym"
INCLUDE "sio.inc"
; +0 ID Put these first two bytes at 041H and 042H ("AB") to indicate that it is an additional ROM.
; +2 INIT Address of the routine to call to initialize a work area or I/O ports, or run a game, etc.
; +4 STATEMENT Runtime address of a program whose purpose is to add instructions to the MSX-Basic using CALL.
; +6 DEVICE Execution address of a program used to control a device built into the cartridge. For example, a disk interface.
; +8 TEXT Pointer of the tokenizen Basic program contained in ROM.
; +10 Reserved 6 bytes reserved for future updates.
ROM_HEADER:
DB "AB"
DW ROM_INIT
DW 0
DW 0
DW 0
DS 6
INCLUDE "rominit.asm"
INCLUDE "alloc.asm"
INCLUDE "sio.asm"
INCLUDE "utils.asm"
INCLUDE "rs232.asm"
include "probing.asm"
include "extended-bios.asm"
DS $C000 - $
|
src/arch/socs/stm32f439/soc-usart-interfaces.adb | PThierry/ewok-kernel | 65 | 19918 | <reponame>PThierry/ewok-kernel
--
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
package body soc.usart.interfaces
with spark_mode => off
is
procedure configure
(usart_id : in unsigned_8;
baudrate : in unsigned_32;
data_len : in t_data_len;
parity : in t_parity;
stop : in t_stop_bits;
success : out boolean)
is
usart : t_USART_peripheral_access;
begin
case usart_id is
when 1 => usart := USART1'access;
when 4 => usart := UART4'access;
when 6 => usart := USART6'access;
when others =>
success := false;
return;
end case;
usart.all.CR1.UE := true; -- USART enable
usart.all.CR1.TE := true; -- Transmitter enable
-- The kernel does not attempt to receive any char from its
-- console
usart.all.CR1.RE := false; -- Receiver enable
set_baudrate (usart, baudrate);
usart.all.CR1.M := data_len;
usart.all.CR2.STOP := stop;
usart.all.CR1.PCE := true; -- Parity control enable
usart.all.CR1.PS := parity;
-- No flow control
usart.all.CR3.RTSE := false;
usart.all.CR3.CTSE := false;
success := true;
return;
end configure;
procedure transmit
(usart_id : in unsigned_8;
data : in t_USART_DR)
is
begin
case usart_id is
when 1 => soc.usart.transmit (USART1'access, data);
when 4 => soc.usart.transmit (UART4'access, data);
when 6 => soc.usart.transmit (USART6'access, data);
when others =>
raise program_error;
end case;
end transmit;
end soc.usart.interfaces;
|
display.adb | thieryw/game_of_life | 0 | 24372 | with ada.text_io,ada.integer_text_io ;
use ada.text_io ;
package body display is
procedure render(screen : grid) is
--Clear screen character for UNIX
procedure clear_screen is
begin
ada.text_io.put(ASCII.ESC & "[2J") ;
end clear_screen ;
screen_buffer : string(1..((screen'length(1) + 2) * (screen'length(2) + 2) + (screen'length(1) + 2))) ;
buffer_index : integer := 1 ;
begin
for i in screen'first(1)-1..screen'last(1)+1 loop
for j in screen'first(2)-1..screen'last(2)+1 loop
if
i = screen'first(1)-1
or
i = screen'last(1)+1 then
screen_buffer(buffer_index) := '-' ;
elsif
j = screen'first(2)-1
or
j = screen'last(2)+1
then
screen_buffer(buffer_index) := ('|') ;
else
if screen(i,j) = true then
screen_buffer(buffer_index) := ('#') ;
else
screen_buffer(buffer_index) := (' ') ;
end if ;
end if ;
buffer_index := buffer_index + 1 ;
end loop ;
screen_buffer(buffer_index) := character'val(10) ;
buffer_index := buffer_index+1 ;
end loop ;
clear_screen ;
put(screen_buffer) ;
end render ;
end display ;
|
data/mapHeaders/fuchsiamart.asm | adhi-thirumala/EvoYellow | 16 | 177754 | <reponame>adhi-thirumala/EvoYellow<filename>data/mapHeaders/fuchsiamart.asm<gh_stars>10-100
FuchsiaMart_h:
db MART ; tileset
db FUCHSIA_MART_HEIGHT, FUCHSIA_MART_WIDTH ; dimensions (y, x)
dw FuchsiaMartBlocks, FuchsiaMartTextPointers, FuchsiaMartScript ; blocks, texts, scripts
db $00 ; connections
dw FuchsiaMartObject ; objects
|
alloy4fun_models/trashltl/models/1/6QtDHDof7WXKYH6tD.als | Kaixi26/org.alloytools.alloy | 0 | 249 | <filename>alloy4fun_models/trashltl/models/1/6QtDHDof7WXKYH6tD.als
open main
pred id6QtDHDof7WXKYH6tD_prop2 {
no File and eventually some File
}
pred __repair { id6QtDHDof7WXKYH6tD_prop2 }
check __repair { id6QtDHDof7WXKYH6tD_prop2 <=> prop2o } |
Sources/Graphics/graphics_data.ads | ForYouEyesOnly/Space-Convoy | 1 | 28358 | <reponame>ForYouEyesOnly/Space-Convoy<gh_stars>1-10
--
-- Jan & <NAME>, Australia, July 2011
--
with GLOBE_3D;
with Graphics_Configuration; use Graphics_Configuration;
with Graphics_Structures; use Graphics_Structures;
with Models; use Models;
with Rotations; use Rotations; pragma Elaborate_All (Rotations);
with Vectors_3D; use Vectors_3D;
package Graphics_Data is
Default_Model : Model_Name := Spaceship;
Camera_Mode : Camera_Mode_T := Scene;
Cam : Camera := (Position => Zero_Vector_3D,
Scene_Offset => Zero_Vector_3D,
Object_Offset => Zero_Vector_3D,
Rotation => Zero_Rotation);
Eye : GLOBE_3D.Camera;
Viewer_Size : Size_2D := Initial_Viewer_Size;
Full_Screen_State : Boolean := False;
Show_Text_Overlay : Boolean := True;
Show_Connecting_Lines : Boolean := False;
Show_Axis : Boolean := False;
Current_Model : Model_Name := Default_Model;
Sphere_Angles : Vector_3D := Zero_Vector_3D;
end Graphics_Data;
|
alloy4fun_models/trashltl/models/19/oLb4DwxknzScBNk7e.als | Kaixi26/org.alloytools.alloy | 0 | 3016 | open main
pred idoLb4DwxknzScBNk7e_prop20 {
always (all f:File | f in Trash since no (f&Protected) )
}
pred __repair { idoLb4DwxknzScBNk7e_prop20 }
check __repair { idoLb4DwxknzScBNk7e_prop20 <=> prop20o } |
examples/litera.asm | Cichy3D/Komp2IDE | 0 | 4695 | <reponame>Cichy3D/Komp2IDE<filename>examples/litera.asm
:start
Print "Enter one character"
load a 0a;
mov e a;
print e
input b;
print "Character entered: "
print b
print e
goto :start
|
Library/Trans/Database/DBase3/Import/importFile.asm | steakknife/pcgeos | 504 | 90601 | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: dBase III
MODULE: Import
FILE: importFile.asm
AUTHOR: <NAME>, 9/14/92
ROUTINES:
Name Description
---- -----------
TransGetFormat Check for the format of import file
TransImport Import the file
ImportParseHeader Read in file header
ImportGetFieldData Read in a field from the source file
ImportAddFieldToArray Add the field to the huge array
REVISION HISTORY:
Name Date Description
---- ---- -----------
ted 9/92 Initial revision
DESCRIPTION:
Contains all of file import routines.
$Id: importFile.asm,v 1.1 97/04/07 11:43:01 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
Import segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TransGetFormat
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determines if the file is of dBase III format.
CALLED BY: GLOBAL
PASS: si - file handle (open for read)
RETURN: ax - TransError (0 = no error)
cx - format number if valid format
or NO_IDEA_FORMAT if not
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jenny 9/24/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TransGetFormat proc far uses bx, dx, ds
TGF_headerBuffer local DBaseHeader
TGF_fieldBuffer local FieldDescriptor
.enter
; read in dbase III file header
mov cx, FIELD_DESCRIPTOR_SIZE
segmov ds, ss ; read it into local variable
lea dx, TGF_headerBuffer
clr al ; flags = 0
mov bx,si ; bx - file handle
call FileRead ; read in the version number
jc notFormat ; skip if error
; check the version number of this file
cmp TGF_headerBuffer.DBH_version, DBASE3_NO_MEMO
je okay
cmp TGF_headerBuffer.DBH_version, DBASE3_MEMO
jne notFormat
okay:
mov cx, TGF_headerBuffer.DBH_headerSize
sub cx, FIELD_DESCRIPTOR_SIZE
dec cx
mainLoop:
; cx - number of bytes left to read in
; now check to make sure it is not dbase IV file
push cx
mov cx, size FieldDescriptor; read in a field descriptor
segmov ds, ss ; read it into local variable
lea dx, TGF_fieldBuffer
clr al ; flags = 0
mov bx,si ; bx - file handle
call FileRead ; read in the version number
pop cx
jc notFormat ; skip if error
mov al, TGF_fieldBuffer.FD_fieldType
call CheckFieldType ; check for field data type
jc notFormat ; exit if illegal data type,
sub cx, size FieldDescriptor; cx - update header size
js notFormat ; if sign bit set, then error
jne mainLoop ; if not done, get the next field
clr cx ; cx <- format number
done:
clr ax ; ax <- TE_NO_ERROR
.leave
ret
notFormat:
mov cx, NO_IDEA_FORMAT
jmp done
TransGetFormat endp
; returns carry set if illegal data type
; returns carry clear if legal data type
CheckFieldType proc near
cmp al, 'C'
je noError
cmp al, 'N'
je noError
cmp al, 'L'
je noError
cmp al, 'M'
je noError
cmp al, 'D'
je noError
stc
jmp done
noError:
clc
done:
ret
CheckFieldType endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TransImport
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Library routine called by the Impex library.
CALLED BY: Impex
PASS: ds:si - ImportFrame
RETURN: ax - TransError
bx - handle of error msg if ax = TE_CUSTOM
else- clipboardFormat CIF_SPREADSHEET
dx:cx - VM chain containing transfer format
si - ManufacturerID
DESTROYED: di, es
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ted 5/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TransImport proc far
TI_Local local ImpexStackFrame
TI_SSMeta local SSMetaStruc
.enter
; attach the source file for caching
mov bx, ds:[si].IF_sourceFile ; bx - handle of source file
call InputCacheAttach ; create the input buffer
mov ax, TE_OUT_OF_MEMORY ; ax - TransError
jc exit ; exit if memory alloc error
mov TI_Local.ISF_cacheBlock, bx ; save cache block handle
; save the map entry block handle
mov bx, ds:[si].IF_importOptions ; bx - map list block
mov TI_Local.ISF_mapBlock, bx ; save it
; initialize the stack frame for file importing
push bp
clr ax ; ax:cx - source ID
clr cx
mov bx, ds:[si].IF_transferVMFile ; bx - handle of transfer file
mov dx, ss
lea bp, TI_SSMeta ; dx:bp - SSMetaStruc
call SSMetaInitForStorage ; set up SSMeta header block
pop bp
; create a list of column numbers that are not mapped
;mov bx, TI_Local.ISF_mapBlock
;call ImportCreateNotMappedColumnList
;mov TI_Local.ISF_notMappedList, bx ; save the handle
; read in the source file and create meta file
call ImportParseHeader
jc error ; skip if error
call ImportParseData
error:
; destroy the cached block
mov bx, TI_Local.ISF_cacheBlock ; bx - cache block handle
call InputCacheDestroy ; does not trash flags
; this carry is the result of "ImportParseHeader"
; or "ImportParseData"
jc exit ; exit if error
; update SSMeta header block
push bp
mov ax, TI_Local.ISF_curRecord ; ax - number of records
mov cx, TI_Local.ISF_numFields ; cx - number of fields
mov dx, ss
lea bp, TI_SSMeta ; dx:bp - SSMetaStruc
call SSMetaSetScrapSize
pop bp
; return with VM chain and VM file handle
mov dx, TI_SSMeta.SSMDAS_hdrBlkVMHan
clr cx ; dx:cx - VM chain
mov ax, TE_NO_ERROR ; return with no error
mov bx, CIF_SPREADSHEET
mov si, MANUFACTURER_ID_GEOWORKS
; clean up
;mov bx, TI_Local.ISF_notMappedList ; handle of not-mapped block
;tst bx
;je exit ; exit if no map block
;call MemFree
exit:
.leave
ret
TransImport endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportParseHeader
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read in the various sections of file header.
CALLED BY: INTERNAL (TransImport)
PASS: ImpexStackFrame
RETURN: carry set if there was an error (ax = TransError)
DESTROYED: ax, bx, cx, dx, si, di, es
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportParseHeader proc near
IPH_Local local ImpexStackFrame
IPH_SSMeta local SSMetaStruc
.enter inherit near
; first check to see if this is indeed dBase III file
clr IPH_Local.ISF_numFields ; init. number of fields
clr IPH_Local.ISF_mappedNumFields ; init. mapped num of fields
call ImportCheckVersionNumber
jc quit ; if not, exit
mov cx, LAST_UPDATE ; number of bytes to skip
call ImportSkipBytes ; skip four bytes
jc fileErr ; exit if file error
call ImportGetNumRecords ; get number of records
jc fileErr ; exit if file error
call ImportGetHeaderSize ; get the size of header
jc fileErr ; exit if file error
call ImportGetRecordSize ; get the length of a record
jc fileErr ; exit if file error
mov cx, RESERVED1
call ImportSkipBytes ; skip ten bytes
jc fileErr ; exit if file error
; keep track of number of bytes left in the header block
sub IPH_Local.ISF_curHeaderSize, size DBaseHeader
js fileErr ; size mismatch, exit
; allocate a block for storing field length and type
mov ax, FIELD_INFO_BLOCK_SIZE ; ax - size of block to allocate
mov cx, ((mask HAF_ZERO_INIT or mask HAF_NO_ERR) shl 8) or 0
call MemAlloc ; allocate a block
mov IPH_Local.ISF_fieldInfoBlock, bx; save the handle
clr dx ; initialize column number
; read in field descriptors
next:
mov bx, IPH_Local.ISF_cacheBlock ; bx - handle of cache block
call InputCacheGetChar ; read in a character
jc fileErr ; exit if file error
cmp al, CR ; end of header block?
je exit ; if so, exit
call InputCacheUnGetChar
; update the number of bytes to be read in the header block
sub IPH_Local.ISF_curHeaderSize, FIELD_DESCRIPTOR_SIZE
js fileErr ; size mismatch, exit
call ImportGetFieldDescriptor ; read in a field descriptor
jnc skip ; skip if field not mapped
; carry is set. check to see if there was an error
cmp ax, TE_NO_ERROR
jne error ; exit if error
inc IPH_Local.ISF_mappedNumFields ; up mapped field number counter
skip:
inc dx ; up the column number
jmp next ; read in the next one
exit:
; subtract one for the end of header block character
dec IPH_Local.ISF_curHeaderSize
js fileErr ; if size mismatch, exit
; are there any more bytes to be read from the header block
mov cx, IPH_Local.ISF_curHeaderSize
jcxz okay ; if not, skip
; if so, skip those bytes
call ImportSkipBytes
jc fileErr ; exit if file error
okay:
mov IPH_Local.ISF_numFields, dx ; update number of fields
clc ; exit with no error
jmp quit
fileErr:
mov ax, TE_FILE_ERROR ; ax - TransError
error:
stc ; exit with carry set
quit:
.leave
ret
ImportParseHeader endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportCheckVersionNumber
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check to see if the file has the right version number.
CALLED BY: INTERNAL (ImportParseHeader)
PASS: ImpexStackFrame
RETURN: carry set if error (ax = TransError)
DESTROYED: ax, bx
SIDE EFFECTS: bx - handle of cache block
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportCheckVersionNumber proc near
ICVN_Local local ImpexStackFrame
ICVN_SSMeta local SSMetaStruc
.enter inherit near
; get the version number byte from the header
mov bx, ICVN_Local.ISF_cacheBlock
call InputCacheGetChar
jc fileErr ; exit if file error
cmp al, DBASE3_NO_MEMO
je okay
cmp al, DBASE3_MEMO
jne notOk
okay:
clc ; we have the correct version, exit with no error
jmp exit
fileErr:
mov ax, TE_FILE_ERROR ; ax - TransError
jmp exit
notOk:
mov ax, TE_INVALID_FORMAT ; ax - TransError
stc ; we have wrong version, exit with carry set
exit:
.leave
ret
ImportCheckVersionNumber endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportSkipBytes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Skip the given number of bytes in the header block.
CALLED BY: INTERNAL
PASS: cx - number of bytes to skip
RETURN: carry set if there was a file error
DESTROYED: ax, bx, cx
SIDE EFFECTS: bx - handle cache block
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportSkipBytes proc near
ISB_Local local ImpexStackFrame
ISB_SSMeta local SSMetaStruc
.enter inherit near
mov bx, ISB_Local.ISF_cacheBlock ; bx - handle of cache block
getNext:
call InputCacheGetChar ; read in a character
jc exit ; exit if error
loop getNext ; get the next character
clc
exit:
.leave
ret
ImportSkipBytes endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportGetNumRecords
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get total number of records from the header block.
CALLED BY: INTERNAL (ImportParseHeader)
PASS: ImpexStackFrame
RETURN: carry set if there was a file error
DESTROYED: ax, bx
SIDE EFFECTS: bx - handle cache block
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportGetNumRecords proc near
IGNR_Local local ImpexStackFrame
IGNR_SSMeta local SSMetaStruc
.enter inherit near
; get the low word of total number of records in database file
mov bx, IGNR_Local.ISF_cacheBlock ; bx - handle of cache block
call InputCacheGetChar ; read in a character
jc exit ; exit if error
mov ah, al
call InputCacheGetChar ; read in a character
jc exit ; exit if error
xchg al, ah
mov IGNR_Local.ISF_numRecords.low, ax ; save low word
; get the high word of total number of records in database file
call InputCacheGetChar ; read in a character
jc exit ; exit if error
mov ah, al
call InputCacheGetChar ; read in a character
jc exit ; exit if error
xchg al, ah
mov IGNR_Local.ISF_numRecords.high, ax ; save high word
clc
exit:
.leave
ret
ImportGetNumRecords endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportGetRecordSize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the record size info from the header block.
CALLED BY: INTERNAL (ImportParseHeader)
PASS: ImpexStackFrame
RETURN: carry set if there was a file error
DESTROYED: ax, bx
SIDE EFFECTS: bx - handle of cache block
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportGetRecordSize proc near
IGRS_Local local ImpexStackFrame
IGRS_SSMeta local SSMetaStruc
.enter inherit near
; get the size of one record
mov bx, IGRS_Local.ISF_cacheBlock
call InputCacheGetChar ; get low byte
jc exit ; exit if error
mov ah, al
call InputCacheGetChar ; get high byte
jc exit ; exit if error
xchg al, ah
mov IGRS_Local.ISF_recordSize, ax ; save record size
clc
exit:
.leave
ret
ImportGetRecordSize endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportGetHeaderSize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the size of header from the header block.
CALLED BY: INTERNAL (ImportParseHeader)
PASS: ImpexStackFrame
RETURN: carry set if there was a file error
DESTROYED: ax, bx
SIDE EFFECTS: bx - handle of cache block
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportGetHeaderSize proc near
IGHS_Local local ImpexStackFrame
IGHS_SSMeta local SSMetaStruc
.enter inherit near
; get the size of header
mov bx, IGHS_Local.ISF_cacheBlock
call InputCacheGetChar
jc exit ; exit if error
mov ah, al
call InputCacheGetChar
jc exit ; exit if error
xchg al, ah
mov IGHS_Local.ISF_headerSize, ax ; save it
mov IGHS_Local.ISF_curHeaderSize, ax
clc
exit:
.leave
ret
ImportGetHeaderSize endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportGetFieldDescriptor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the field descriptor and store it with meta file.
CALLED BY: INTERNAL (ImportParseHeader)
PASS: dx - current column number
RETURN: ImpexStackFrame
carry set if current field is mapped (ax = TE_NO_ERROR)
carry also set if erorr (ax = TE_FILE_ERROR)
DESTROYED: ax, bx, cx, si, di, es, ds
SIDE EFFECTS: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportGetFieldDescriptor proc near
IGFD_Local local ImpexStackFrame
IGFD_SSMeta local SSMetaStruc
.enter inherit near
push dx
; allocate a block for storing field property
mov ax, size FieldInfoBlock ; ax - size of block to allocate
mov cx, ((mask HAF_LOCK or mask HAF_ZERO_INIT or \
mask HAF_NO_ERR) shl 8) or 0 ; HeapAllocFlags
call MemAlloc ; allocate a block
mov IGFD_Local.ISF_fieldDcptrBlock, bx ; save the handle
mov es, ax
clr di ; es:di - ptr to FieldProperty struct
mov es:[di].FIB_fieldNum, dl; save the column number
call ImportGetFieldName ; copy field name into FieldProperty
LONG jc fileErr ; exit if file error
call ImportGetFieldType ; get the field type byte
LONG jc fileErr ; exit if file error
mov cx, FIELD_DATA_ADDR
call ImportSkipBytes ; skip four bytes
LONG jc fileErr ; exit if file error
; get the field length
call InputCacheGetChar
LONG jc fileErr ; exit if file error
clr ah
mov IGFD_Local.ISF_fieldLength, ax
; check to see if this is a logic field
cmp IGFD_Local.ISF_fieldType, 'L'
jne notLogic ; if not, skip
; since in GeoFile this field would contain more than
; one character, use the default logic fied size, which is 32
mov al, LOGIC_FIELD_SIZE
notLogic:
mov es:[di].FIB_fieldSize, ax ; save it
; get decimal count for interger field
call InputCacheGetChar
LONG jc fileErr ; exit if file error
; check to see if this is a numeric field
cmp IGFD_Local.ISF_fieldType, 'N'
jne notInteger ; if not a numeric field, skip
; check to see if the decimal count is zero
tst al
je notInteger ; if zero, then integer field
; if not zero, then treat this field as a float field
mov es:[di].FIB_fieldType, FDT_REAL
mov IGFD_Local.ISF_fieldType, 'F'
notInteger:
mov cx, RESERVED2
call ImportSkipBytes ; skip four bytes
jc fileErr ; exit if file error
; get true column number after the field has been mapped
clr ah
mov al, es:[di].FIB_fieldNum ; ax - column number
mov bx, IGFD_Local.ISF_mapBlock ; bx - handle of map block
mov cl, mask IF_IMPORT ; do import
call GetMappedRowAndColNumber ; ax - mapped column number
jnc empty ; skip if not mapped
; add FieldInfoBlock to DAS_FIELD data array
;mov bx, IGFD_Local.ISF_notMappedList
;call ImportGetActualColumnNumber
mov IGFD_SSMeta.SSMDAS_col, ax
mov IGFD_SSMeta.SSMDAS_row, 0 ; row number
mov IGFD_SSMeta.SSMDAS_dataArraySpecifier, DAS_FIELD
segmov ds, es ; ds:si - ptr to data
clr si
mov cx, size FieldInfoBlock ; cx - size of block
mov al, SSMAEF_ADD_IN_ROW_ORDER ; al - SSMetaAddEntryFlags
; check to see if there is map block
tst IGFD_Local.ISF_mapBlock
jne mapExists ; skip if it exists
; if no map block, append the cell at the end
mov al, SSMETA_ADD_TO_END ; al - SSMetaAddEntryFlags
mapExists:
push bp
mov dx, ss
lea bp, IGFD_SSMeta ; dx:bp - SSMetaStruc
call SSMetaDataArrayAddEntry ; add the new entry
pop bp
stc
empty:
pop dx
pushf
; lock the data block with FieldHeaderInfo
push dx
mov bx, IGFD_Local.ISF_fieldInfoBlock
call MemLock
mov es, ax
mov ax, size FieldHeaderInfo
mul dx
mov di, ax ; es:di - place to insert
; update the FieldHeaderInfo for this field
mov al, IGFD_Local.ISF_fieldType
mov es:[di].FHI_type, al
mov ax, IGFD_Local.ISF_fieldLength
mov es:[di].FHI_length, ax
call MemUnlock ; unlock the data block
; free FieldProperty block
mov bx, IGFD_Local.ISF_fieldDcptrBlock
call MemFree
pop dx
popf
jnc exit ; if carry not set, exit
; carry is set but here it means that current field is
; being mapped. So return with ax = TE_NO_ERROR
mov ax, TE_NO_ERROR ; ax - TransError
jmp exit
; handle the error case
fileErr:
pop dx
mov bx, IGFD_Local.ISF_fieldDcptrBlock
call MemFree
mov ax, TE_FILE_ERROR ; ax - TransError
stc ; return with carry set
exit:
.leave
ret
ImportGetFieldDescriptor endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportGetFieldName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy the field name into FieldInfoBlock block.
CALLED BY: INTERNAL (ImportGetFieldDescriptor)
PASS: es - address of FieldInfoBlock block
RETURN: carry set if there was a file error
DESTROYED: ax, bx, cx
SIDE EFFECTS: bx - handle of cache block
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportGetFieldName proc near uses di
IGFN_Local local ImpexStackFrame
IGFN_SSMeta local SSMetaStruc
.enter inherit near
; copy the field name into FieldInfoBlock block
mov di, offset FIB_fieldName; es:di - destination
mov cx, FIELD_NAME_SIZE ; cx - number of bytes to copy
mov bx, IGFN_Local.ISF_cacheBlock
nextChar:
call InputCacheGetChar ; read in a character
jc exit ; exit if error
stosb ; store it
loop nextChar ; get the next character
clc
exit:
.leave
ret
ImportGetFieldName endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportGetFieldType
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read in field type byte and convert it to FieldDataType.
CALLED BY: INTERNAL (ImportGetFieldDescriptor)
PASS: es:di - ptr to FieldInfoBlock block
RETURN: carry set if there was a file error
DESTROYED: ax, bx
SIDE EFFECTS: al - FieldDataType
bx - handle of cache block
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportGetFieldType proc near
IGFT_Local local ImpexStackFrame
IGFT_SSMeta local SSMetaStruc
.enter inherit near
; read in the field type byte from the header block
mov bx, IGFT_Local.ISF_cacheBlock
call InputCacheGetChar
jc exit ; exit if error
mov IGFT_Local.ISF_fieldType, al ; save it
; check to see if character field type
cmp al, 'C'
jne checkNum
mov al, FDT_GENERAL_TEXT ; assign FDT_GENERAL_TEXT
jmp common
; check to see if numeric field type
checkNum:
cmp al, 'N'
jne checkLogic
mov al, FDT_INTEGER ; assume integer field
mov es:[di].FIB_minValue.F_exponent, FP_NAN
mov es:[di].FIB_maxValue.F_exponent, FP_NAN
jmp common
; check to see if logical field type
checkLogic:
cmp al, 'L'
jne checkMemo
mov al, FDT_GENERAL_TEXT ; convert it into text field
jmp common
; check to see if memo field type
checkMemo:
cmp al, 'M'
jne date
mov al, FDT_GENERAL_TEXT ; convert it into text field
jmp common
; check to see if date field type
date:
cmp al, 'D'
je ok
stc ; if not 'D'
jmp exit ; exit with carry set
ok:
mov al, FDT_DATE
mov es:[di].FIB_minValue.F_exponent, FP_NAN
mov es:[di].FIB_maxValue.F_exponent, FP_NAN
common:
mov es:[di].FIB_fieldType, al ; save FieldDataType
clc
exit:
.leave
ret
ImportGetFieldType endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportParseData
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read in data portion of import file.
CALLED BY: INTERNAL (TransImport)
PASS: ImpexStackFrame
RETURN: carry set if there was an error (ax = TransError)
DESTROYED: bx, cx, dx, es, ds, si, di
SIDE EFFECTS: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportParseData proc near
IPD_Local local ImpexStackFrame
IPD_SSMeta local SSMetaStruc
.enter inherit near
clr ax
mov IPD_SSMeta.SSMDAS_entryPos.high, ax
mov IPD_SSMeta.SSMDAS_entryPos.low, ax
; allocate a block for storing field data
mov ax, FIELD_BLOCK_SIZE ; ax - size of block to allocate
mov cx, (HAF_STANDARD_NO_ERR shl 8) or 0 ; HeapAllocFlags
call MemAlloc ; allocate a block
mov IPD_Local.ISF_fieldBlock, bx ; save the handle of this block
mov cx, IPD_Local.ISF_numRecords.low; cx - record loop counter
clr IPD_Local.ISF_curRecord
nextEntry:
; save the entry position
mov ax, IPD_SSMeta.SSMDAS_entryPos.high
mov IPD_Local.ISF_entryPos.high, ax
mov ax, IPD_SSMeta.SSMDAS_entryPos.low
mov IPD_Local.ISF_entryPos.low, ax
push cx
clr IPD_Local.ISF_curNumFields ; init. current column number
mov cx, IPD_Local.ISF_numFields ; cx - field loop counter
clr di ; di - offset to FieldHeaderInfo block
; initialize ISF_curRecSize
mov ax, IPD_Local.ISF_recordSize
mov IPD_Local.ISF_curRecSize, ax
; get the first character of field data
mov bx, IPD_Local.ISF_cacheBlock ; bx - handle of cache block
call InputCacheGetChar
jc fileErr
dec IPD_Local.ISF_curRecSize ; update current record size
cmp al, SPACE ; record deleted?
je nextField ; if not, read in data
cmp al, ASTERISK ; deleted record?
je delete ; if so, skip
tst al ; if zero,
je delete ; treat it as a deleted entry
stc ; carry set
jmp fileErr ; if not, file error
delete:
; this record has been deleted, just skip it
mov cx, IPD_Local.ISF_curRecSize ; cx - # of bytes to skip
call ImportSkipBytes ; skip the entire field
jc fileErr
jmp next
nextField:
; lock FieldHeaderInfo data block
push cx
mov bx, IPD_Local.ISF_fieldInfoBlock
call MemLock
mov es, ax
; get field length, field type, and decimal count
push di
mov ax, es:[di].FHI_length
mov IPD_Local.ISF_fieldLength, ax
mov al, es:[di].FHI_type
mov IPD_Local.ISF_fieldType, al
call MemUnlock
; read in the field data and add it to ssmeta file
call ImportGetFieldData ; get field data
jc fileErr0 ; exit if file error
call ImportAddFieldToArray ; add it to huge array
pop di ; dx - ptr to FieldHeaderInfo
add di, size FieldHeaderInfo ; update the pointer
inc IPD_Local.ISF_curNumFields ; update column number
; figure out how many bytes are left in current record
mov ax, IPD_Local.ISF_fieldLength ; ax - current field length
sub IPD_Local.ISF_curRecSize, ax
pop cx
loop nextField ; check the next field
; check for record size error
tst IPD_Local.ISF_curRecSize
je okay
stc
jmp fileErr ; exit if file error
okay:
inc IPD_Local.ISF_curRecord ; update row number
next:
pop cx
dec cx
LONG jne nextEntry ; check the next record
clc ; exit with carry clear
jmp exit
; restore the stack and delete some mem blocks
fileErr0:
pop di
pop cx
fileErr:
pop cx
exit:
pushf
mov bx, IPD_Local.ISF_fieldInfoBlock
call MemFree
mov bx, IPD_Local.ISF_fieldBlock
call MemFree
popf
jnc done ; exit if carry not set
; if carry is set, ax = TransError
mov ax, TE_FILE_ERROR ; ax - TransError
done:
.leave
ret
ImportParseData endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportGetFieldData
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read in field data
CALLED BY: INTERNAL (ImportParseData)
PASS: nothing
RETURN: carry set if there was a file error
DESTROYED: ax, bx, cx, dx, es, ds, si, di
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Ted 9/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportGetFieldData proc near
IGFD_Local local ImpexStackFrame
IGFD_SSMeta local SSMetaStruc
.enter inherit near
; lock the field data block
mov bx, IGFD_Local.ISF_fieldBlock
call MemLock
mov es, ax
clr di
; initialize CellCommon
mov al, 0
mov cx, size CellCommon ; cx - number of bytes to initialize
rep stosb ; clear the header
clr di ; restore the pointer
; check to see if this is a text field
mov al, IGFD_Local.ISF_fieldType
cmp al, 'C'
jne checkNum
call ImportTextField ; if text field, handle it
jmp common
; check to see if this is a numeric field
checkNum:
cmp al, 'N'
jne checkFloat
call ImportNumericField ; if numeric field, handle it
jmp common
; check to see if this is a float field
checkFloat:
cmp al, 'F'
jne checkLogic
call ImportNumericField ; call the same routine as 'N'
jmp common
; check to see if this is a logical field
checkLogic:
cmp al, 'L'
jne checkMemo
call ImportLogicField ; if logical field, handle it
jmp common
; check to see if this is a memo field
checkMemo:
cmp al, 'M'
jne date
call ImportMemoField ; if memo field, handle it
jmp common
date:
; check to see if this is a date field
cmp al, 'D'
je dateField
stc ; if not date field, exit with error
jmp common
dateField:
call ImportDateField ; if date field, handle it
common:
pushf
mov bx, IGFD_Local.ISF_fieldBlock
call MemUnlock
popf
.leave
ret
ImportGetFieldData endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportTextField
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read in text field data
CALLED BY: INTERNAL (ImportGetFieldData)
PASS: es:di - ptr to read field data into
RETURN: carry set if there was a file error
DESTROYED: ax, bx, cx
SIDE EFFECTS: di - size of field data
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportTextField proc near
ITF_Local local ImpexStackFrame
ITF_SSMeta local SSMetaStruc
.enter inherit near
mov es:[di].CC_type, CT_TEXT ; this is a text field
add di, size CellCommon ; es:di - ptr to destination
mov bx, ITF_Local.ISF_cacheBlock ; bx - handle of cache block
mov cx, ITF_Local.ISF_fieldLength ; cx - number of bytes to copy
jcxz exit
nextChar:
call InputCacheGetChar ; get a character
jc error ; exit if error
stosb ; copy it to field block
loop nextChar ; read in the next character
; At this point, the buffer has been filled with the field's
; text. Now scan backwards, looking for the first non-space
; character.
mov cx, ITF_Local.ISF_fieldLength ; cx <- number of bytes to scan
mov al, C_SPACE ; Looking for a space char
dec di ; di <- last char in string
std ; we're scanning backwards
repz scasb ; do the scan
cld ; reset the direction flag
jz allSpaces ; jump if there were
; nothing but spaces
inc di ; di <- last non-space char
allSpaces:
inc di ; di <- last non-space char + 1
exit:
mov al, 0
stosb ; null terminate the data block
sub di, size CellCommon ; di - size of field data
mov ITF_Local.ISF_sizeFieldData, di ; save it
clc
error:
.leave
ret
ImportTextField endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportNumericField
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read in a numeric field data
CALLED BY: INTERNAL (ImportGetFieldData)
PASS: es:di - ptr to read field data into
RETURN: carry set if there was an error
DESTROYED: ax, bx, cx, ds, si, di
SIDE EFFECTS: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 1/93 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportNumericField proc near
INF_Local local ImpexStackFrame
INF_SSMeta local SSMetaStruc
.enter inherit near
mov es:[di].CC_type, CT_CONSTANT ; this is a numeric field
add di, size CellCommon ; es:di - destination
; allocate a temporary block
mov ax, INF_Local.ISF_fieldLength ; ax - size of ascii string
mov cx, (HAF_STANDARD_NO_ERR_LOCK shl 8) or 0 ; HeapAllocFlags
push ax
call MemAlloc ; allocate a block
pop cx
push bx ; save the handle
mov ds, ax
clr si
; copy the numeric string into the data block
mov bx, INF_Local.ISF_cacheBlock
next:
call InputCacheGetChar ; read in a character
jc error ; exit if error
mov ds:[si], al
inc si
loop next
; convert the ascii string to float number
mov cx, INF_Local.ISF_fieldLength ; cx - size of ascii string
clr si ; ds:si - ptr to string
mov al, mask FAF_STORE_NUMBER ; al - FloatAsciiToFloatFlags
call FloatAsciiToFloat ; returns FloatNum in es:di
clc ; no error
; delete the temporary data block
error:
pop bx
pushf
call MemFree
mov INF_Local.ISF_sizeFieldData, size FloatNum ; save size
popf
.leave
ret
ImportNumericField endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportLogicalField
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read in logical field data
CALLED BY: INTERNAL (ImportGetFieldData)
PASS: es:di - ptr to read field data into
RETURN: carry set if there was an error
DESTROYED: ax, bx, si, di, ds
SIDE EFFECTS: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportLogicField proc near
ILF_Local local ImpexStackFrame
ILF_SSMeta local SSMetaStruc
.enter inherit near
mov es:[di].CC_type, CT_TEXT ; this is a text field
add di, size CellCommon ; es:di - destination
; get logic field data
mov bx, ILF_Local.ISF_cacheBlock
call InputCacheGetChar
jc exit ; exit if error
; check to see if it is empty
cmp al, SPACE
jne checkYes
mov di, 1 ; empty field
jmp empty
; check to see if "Yes"
checkYes:
cmp al, 'Y'
jne checkNo
mov si, offset ImportYesString
jmp common
; check to see if "No"
checkNo:
cmp al, 'N'
jne checkTrue
mov si, offset ImportNoString
jmp common
; check to see if "True"
checkTrue:
cmp al, 'T'
jne checkFalse
mov si, offset ImportTrueString
jmp common
; check to see if "False"
checkFalse:
cmp al, 'F'
je noError
stc ; if not 'F', then exit with
jmp exit ; carry set
noError:
mov si, offset ImportFalseString
; locate the string to copy
common:
mov bx, handle Strings
call MemLock
mov ds, ax
mov si, ds:[si] ; ds:si - source string
; copy the string
next:
lodsb
stosb
tst al
jne next
call MemUnlock
sub di, size CellCommon ; di - size of field data
empty:
mov ILF_Local.ISF_sizeFieldData, di ; save it
clc ; no error
exit:
.leave
ret
ImportLogicField endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportMemoField
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read in a memo field data
CALLED BY: INTERNAL (ImportGetFieldData)
PASS: es:di - ptr to read field data into
RETURN: carry set if there was a file error
DESTROYED: ax, bx, cx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportMemoField proc near
IMF_Local local ImpexStackFrame
IMF_SSMeta local SSMetaStruc
.enter inherit near
; skip the memo field for now
mov cx, IMF_Local.ISF_fieldLength
mov bx, IMF_Local.ISF_cacheBlock
next:
call InputCacheGetChar
jc exit ; exit if file error
loop next
mov IMF_Local.ISF_sizeFieldData, 1 ; empty field
clc
exit:
.leave
ret
ImportMemoField endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportDateField
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read in a date field data
CALLED BY: INTERNAL (ImportGetFieldData)
PASS: es:di - ptr to read field data into
RETURN: carry set if there was an error
DESTROYED: ax, bx, cx, si, di
SIDE EFFECTS: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 9/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportDateField proc near
IDF_Local local ImpexStackFrame
IDF_SSMeta local SSMetaStruc
.enter inherit near
mov es:[di].CC_type, CT_CONSTANT ; this is a constant field
add di, size CellCommon ; es:di - destination
; initialize the floating point stack
mov ax, FP_DEFAULT_STACK_SIZE
mov bl, FLOAT_STACK_DEFAULT_TYPE
call FloatInit
; allocate a temporary block
mov ax, IDF_Local.ISF_fieldLength ; ax - size of ascii string
mov cx, (HAF_STANDARD_NO_ERR_LOCK shl 8) or 0 ; HeapAllocFlags
push ax
call MemAlloc ; allocate a block
pop cx
push bx ; save the handle
mov ds, ax
clr si
; copy year into this temporary data block
mov cx, DATE_YEAR_SIZE ; read in four bytes
mov bx, IDF_Local.ISF_cacheBlock
next:
call InputCacheGetChar
LONG jc exit ; exit if file error
mov ds:[si], al
inc si
loop next
mov byte ptr ds:[si], 0 ; null terminate the string
clr si
call UtilAsciiToHex32 ; conver year to hex number
jc error1
mov cx, ax ; save the result
; copy month into the data block
call InputCacheGetChar
jc exit ; exit if file error
mov ds:[si], al
call InputCacheGetChar
jc exit ; exit if file error
mov ds:[si+1], al
mov byte ptr ds:[si+2], 0
call UtilAsciiToHex32 ; convert month to hex number
jc error2
push ax ; save the result
; copy date into the data block
call InputCacheGetChar
jc fileErr0 ; exit if file error
mov ds:[si], al
call InputCacheGetChar
jc fileErr0 ; exit if file error
mov ds:[si+1], al
call UtilAsciiToHex32 ; convert date to hex number
pop bx
jc error3
mov bh, al
mov ax, cx
; conver the ascii string to float number
; ax - year bl - month bh - date
call FloatGetDateNumber ; conver the string
jc error3 ; exit if error
; pop the float number from the floating point stack
call FloatPopNumber
mov IDF_Local.ISF_sizeFieldData, size FloatNum ; save size info
clc ; no error
jmp exit
error1:
; read in the rest of date field data
call InputCacheGetChar
jc exit ; exit if file error
call InputCacheGetChar
jc exit ; exit if file error
error2:
call InputCacheGetChar
jc exit ; exit if file error
call InputCacheGetChar
jc exit ; exit if file error
error3:
mov IDF_Local.ISF_sizeFieldData, 1 ; empty field
clc ; no error
jmp exit
fileErr0:
pop ax
exit:
; delete the temporary data block
pop bx
pushf
call MemFree
call FloatExit ; destory the stack
popf
.leave
ret
ImportDateField endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImportAddFieldToArray
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Add a new field to the huge array.
CALLED BY: ImportTransferFile
PASS: cx - number of bytes in the string
RETURN: nothing
DESTROYED: ax, bx, cx, dx, es, si, di
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ted 3/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ImportAddFieldToArray proc near uses ds, bp
IAFTA_Local local ImpexStackFrame
IAFTA_SSMeta local SSMetaStruc
.enter inherit near
cmp IAFTA_Local.ISF_sizeFieldData, 1; empty field?
je exit ; exit if so
; get true column number after the field has been mapped
mov ax, IAFTA_Local.ISF_curNumFields ; ax - column number
mov bx, IAFTA_Local.ISF_mapBlock ; bx - handle of map block
mov cl, mask IF_IMPORT ; do import
call GetMappedRowAndColNumber ; returns ax - mapped col num
jnc exit ; exit if not mapped
; stuff stack frame with the new coordinate and array type
;mov bx, IAFTA_Local.ISF_notMappedList
;call ImportGetActualColumnNumber
mov IAFTA_SSMeta.SSMDAS_col, ax
mov ax, IAFTA_Local.ISF_curRecord
mov IAFTA_SSMeta.SSMDAS_row, ax
mov IAFTA_SSMeta.SSMDAS_dataArraySpecifier, DAS_CELL
mov bx, IAFTA_Local.ISF_fieldBlock ; bx - handle of field block
call MemLock
segmov ds, ax ; ds:si - ptr to data
clr si
mov cx, IAFTA_Local.ISF_sizeFieldData; cx - size of cell data
add cx, size CellCommon ; adjust size of cell data
mov al, SSMETA_ADD_TO_END ; al - SSMetaAddEntryFlags
tst IAFTA_Local.ISF_mapBlock ; does map block exist?
je noMap ; skip if no map block
; if map block exists, just add the entry to its correct position
mov ax, IAFTA_Local.ISF_entryPos.high
mov IAFTA_SSMeta.SSMDAS_entryPos.high, ax
mov ax, IAFTA_Local.ISF_entryPos.low
mov IAFTA_SSMeta.SSMDAS_entryPos.low, ax
mov al, SSMAEF_ENTRY_POS_PASSED ; al - SSMetaAddEntryFlags
noMap:
push bp
mov dx, ss
lea bp, IAFTA_SSMeta ; dx:bp - SSMetaStruc
call SSMetaDataArrayAddEntry ; add the new entry
pop bp
mov bx, IAFTA_Local.ISF_fieldBlock ; bx - handle of field block
call MemUnlock ; free it!
exit:
.leave
ret
ImportAddFieldToArray endp
Import ends
|
oeis/253/A253457.asm | neoneye/loda-programs | 11 | 242497 | ; A253457: Indices of centered hexagonal numbers (A003215) which are also centered heptagonal numbers (A069099).
; Submitted by <NAME>
; 1,14,351,9100,236237,6133050,159223051,4133666264,107316099801,2786084928550,72330892042487,1877817108176100,48750913920536101,1265645944825762514,32858043651549289251,853043488995455758000,22146272670230300418737,574950045936992355129150,14926554921691570932939151,387515477918043851901288764,10060475870947448578500568701,261184857166715619189113497450,6780745810463658650338450364987,176038206214888409289610595992200,4570212615776634982879537045432201,118649489803977621145578352585245014
mov $2,1
lpb $0
sub $0,1
add $3,1
mov $1,$3
mul $1,24
add $2,$1
add $3,$2
lpe
mov $0,$3
div $0,2
add $0,1
|
stdlib-exts/IO/Exts.agda | WhatisRT/meta-cedille | 35 | 12766 | {-# OPTIONS --type-in-type --guardedness #-}
module IO.Exts where
import IO.Primitive as Prim
open import Class.Monad
open import Class.Functor
open import Data.List
open import Data.Nat using (ℕ)
open import Data.String
open import Data.Sum
open import Data.Unit
open import Function
open import IO using (IO; run; readFiniteFile; lift)
open import IO.Instance
open import Level
private
variable
A : Set
{-#
FOREIGN GHC
import Data.Text
import System.CPUTime
import System.Environment
import System.Exit
import System.IO
import System.IO.Error
import System.Process
#-}
postulate
flushStdoutPrim : Prim.IO ⊤
getCPUTimePrim : Prim.IO ℕ
putStrErrPrim : String → Prim.IO ⊤
runShellCmdPrim : String → List String → Prim.IO String
catchIOErrorPrim : Prim.IO A → (String → Prim.IO A) → Prim.IO A
{-# COMPILE GHC flushStdoutPrim = hFlush stdout #-}
{-# COMPILE GHC getCPUTimePrim = getCPUTime #-}
{-# COMPILE GHC putStrErrPrim = hPutStr stderr . unpack #-}
{-# COMPILE GHC runShellCmdPrim = \ s t -> pack <$> (readProcess (unpack s) (fmap unpack t) "") #-} -- use haskell proc
{-# COMPILE GHC catchIOErrorPrim = \ _ a f -> catchIOError a (f . pack . show) #-}
flushStdout : IO ⊤
flushStdout = lift flushStdoutPrim
getCPUTime : IO ℕ
getCPUTime = lift getCPUTimePrim
putStrErr : String → IO ⊤
putStrErr s = lift (putStrErrPrim s)
runShellCmd : String → List String → IO String
runShellCmd s args = lift (runShellCmdPrim s args)
catchIOError : IO A → (String → IO A) → IO A
catchIOError a f = lift $ catchIOErrorPrim (run a) (run ∘ f)
readFiniteFileError : String → IO (String ⊎ String)
readFiniteFileError name =
catchIOError (inj₂ <$> readFiniteFile name) (return ∘ inj₁)
|
5/5-1.asm | userElaina/MicrocomputerLab | 0 | 174078 | <reponame>userElaina/MicrocomputerLab<gh_stars>0
DATA SEGMENT
NUMBER1 DB 8 DUP(0)
NUMBER2 DB 8 DUP(0)
NUMBER3 DB 9 DUP(0)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
MAIN PROC FAR
MOV AX,DATA
MOV DS,AX
CALL SUB1
POP CX
LEA BX,NUMBER1
AA3: POP AX
MOV [BX],AL
INC BX
LOOP AA3
MOV AH,3
INT 10H
MOV AH,2
MOV DL,8
INT 10H
MOV DL,2BH
MOV AH,2
INT 21H
CALL SUB1
POP CX
LEA BX,NUMBER2
AA4: POP AX
MOV [BX],AL
INC BX
LOOP AA4
MOV AH,3
INT 10H
MOV AH,2
MOV DL,17
INT 10H
MOV DL,3DH
MOV AH,2
INT 21H
LEA SI,NUMBER1
LEA DI,NUMBER2
LEA BX,NUMBER3
SUB CX,CX
MOV CX,8
AA5: MOV AL,[SI]
ADC AL,[DI]
AAA
MOV [BX],AX
INC SI
INC DI
INC BX
LOOP AA5
ADC CL,CL
MOV [BX],CL
LEA AX,NUMBER3+8
PUSH AX
CALL SUB2
MOV CX,16
LEA BX,NUMBER1
XOR AL,AL
QQQ2: MOV [BX],AL
INC BX
LOOP QQQ2
MOV AH,4CH
INT 21H
SUB1 PROC NEAR
POP BX
SUB CX,CX
AA1: MOV AH,1
INT 21H
CMP AL,30H
JC AA2
CMP AL,3AH
JNC AA2
INC CX
PUSH AX
JMP AA1
AA2: PUSH CX
PUSH BX
RET
SUB1 ENDP
SUB2 PROC NEAR
POP AX
POP BX
PUSH AX
MOV CX,9
AA7: MOV AL,[BX]
CMP AL,0
JNZ AA6
DEC CX
DEC BX
JMP AA7
AA6: MOV DL,[BX]
ADD DL,30H
MOV AH,2
INT 21H
DEC BX
LOOP AA6
RET
SUB2 ENDP
MAIN ENDP
CODE ENDS
END MAIN
|
engine/events/move_tutor.asm | genterz/pokecross | 28 | 7746 | MoveTutor:
call FadeToMenu
call ClearBGPalettes
call ClearScreen
call DelayFrame
ld b, SCGB_PACKPALS
call GetSGBLayout
xor a
ld [wItemAttributeParamBuffer], a
call .GetMoveTutorMove
ld [wNamedObjectIndexBuffer], a
ld [wPutativeTMHMMove], a
call GetMoveName
call CopyName1
farcall ChooseMonToLearnTMHM
jr c, .cancel
jr .enter_loop
.loop
farcall ChooseMonToLearnTMHM_NoRefresh
jr c, .cancel
.enter_loop
call CheckCanLearnMoveTutorMove
jr nc, .loop
xor a ; FALSE
ld [wScriptVar], a
jr .quit
.cancel
ld a, -1
ld [wScriptVar], a
.quit
call CloseSubmenu
ret
.GetMoveTutorMove:
ld a, [wScriptVar]
cp MOVETUTOR_FLAMETHROWER
jr z, .flamethrower
cp MOVETUTOR_THUNDERBOLT
jr z, .thunderbolt
; MOVETUTOR_ICE_BEAM
ld a, ICE_BEAM
ret
.flamethrower
ld a, FLAMETHROWER
ret
.thunderbolt
ld a, THUNDERBOLT
ret
CheckCanLearnMoveTutorMove:
ld hl, .MenuHeader
call LoadMenuHeader
predef CanLearnTMHMMove
push bc
ld a, [wCurPartyMon]
ld hl, wPartyMonNicknames
call GetNick
pop bc
ld a, c
and a
jr nz, .can_learn
push de
ld de, SFX_WRONG
call PlaySFX
pop de
ld a, BANK(Text_TMHMNotCompatible)
ld hl, Text_TMHMNotCompatible
call FarPrintText
jr .didnt_learn
.can_learn
callfar KnowsMove
jr c, .didnt_learn
predef LearnMove
ld a, b
and a
jr z, .didnt_learn
ld c, HAPPINESS_LEARNMOVE
callfar ChangeHappiness
jr .learned
.didnt_learn
call ExitMenu
and a
ret
.learned
call ExitMenu
scf
ret
.MenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
oeis/052/A052699.asm | neoneye/loda-programs | 11 | 99266 | <gh_stars>10-100
; A052699: E.g.f. (1+x^5-x^6)/(1-x).
; Submitted by <NAME>
; 1,1,2,6,24,240,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,20922789888000,355687428096000,6402373705728000,121645100408832000,2432902008176640000,51090942171709440000,1124000727777607680000,25852016738884976640000,620448401733239439360000,15511210043330985984000000,403291461126605635584000000,10888869450418352160768000000,304888344611713860501504000000,8841761993739701954543616000000,265252859812191058636308480000000,8222838654177922817725562880000000
mov $1,1
mov $2,5
lpb $0
mul $1,$0
sub $0,1
cmp $2,$1
add $2,1
mul $1,$2
lpe
mov $0,$1
|
alloy4fun_models/trashltl/models/12/mKy5z8gqSsy3K7eS9.als | Kaixi26/org.alloytools.alloy | 0 | 358 | <gh_stars>0
open main
pred idmKy5z8gqSsy3K7eS9_prop13 {
some f : Trash | once f not in Trash
}
pred __repair { idmKy5z8gqSsy3K7eS9_prop13 }
check __repair { idmKy5z8gqSsy3K7eS9_prop13 <=> prop13o } |
c4/C4.g4 | marked42/jsjs | 0 | 2432 | <filename>c4/C4.g4<gh_stars>0
grammar C4;
program: globalDeclaration+;
globalDeclaration:
enumDeclaration
| variableDeclaration
| functionDeclaration;
enumDeclaration:
'enum' Identifier? '{' enumMember (',' enumMember)* '}';
enumMember: Identifier ('=' NumericLiteral)?;
// 不支持变量声明的同时初始化
variableDeclaration: type variable (',' variable)*;
variable: '*'* Identifier;
type: ('int' | 'char');
functionDeclaration:
type variable '(' functionParameterList ')' '{' functionBody '}';
functionParameterList:
functionParameter (',' functionParameter)*;
functionParameter: type variable;
functionBody: variableDeclaration? statement*;
statement: emptyStatement | nonEmptyStatement;
nonEmptyStatement:
ifStatement
| whileStatement
| blockStatement
| returnStatement
| expressionStatement;
ifStatement:
'if' '(' expr ')' statement ('else' nonEmptyStatement)?;
whileStatement: 'while' '(' expr ')' nonEmptyStatement;
blockStatement: '{' statement* '}';
returnStatement: 'return' expr?;
emptyStatement: ';';
expressionStatement: expr ';';
expr:
Identifier
| NumericLiteral
| StringLiteral
| 'sizeof' expr
| '!' expr
| '-' expr
| '+' expr
| '~' expr
| '*' expr
| '&' expr
// expr必须是左值
| expr '++'
// expr必须是左值
| expr '--'
| '(' expr ')'
// 等号左边必须是左值
| expr '=' expr
| expr '?' expr ':' expr
| expr '(' expr (',' expr)* ')'
| expr '**' expr
| expr ('*' | '/') expr
| expr ('+' | '-') expr
| expr ('==' | '!=' | '>' | '>=' | '<' | '<=') expr
| expr ('>>' | '<<') expr
| expr ('%') expr
| expr '[' expr ']'
| expr '&&' expr
| expr '||' expr
| expr '&' expr
| expr '|' expr
| expr '^' expr
| expr '.' expr;
Identifier: [a-zA-Z_][a-zA-Z0-9_]*;
StringLiteral:
'"' (~["\\\r\n] | EscapeSequence | LineContinuation)* '"';
fragment LineContinuation: '\\\r\n' | '\\\r' | '\\\n';
// "\c" unknown escape sequence 其中'\'被忽略
fragment EscapeSequence: '\\' ['"?abfnrtv\\];
LineComment: '//' ~[\r\n]* -> skip;
Whitespace: [ \t] -> skip;
Newline: ('\r' '\n'? | '\n') -> skip;
NumericLiteral:
'0'
| [1-9][0-9]*
| '0' ('x' | 'X') [0-9A-Fa-f]+
| '0' [0-7]+;
|
test/interaction/PragmasRespected.agda | asr/agda-kanso | 1 | 1880 | {-# OPTIONS --show-implicit #-}
module PragmasRespected where
postulate
Foo : {A : Set₁} → Set
Bar : Foo {A = Set}
|
text/maps/route_4.asm | adhi-thirumala/EvoYellow | 16 | 103786 | _Route4Text1::
text "Ouch! I tripped"
line "over a rocky"
cont "#MON, GEODUDE!"
done
_Route4BattleText1::
text "I came to get my"
line "mushroom #MON!"
done
_Route4EndBattleText1::
text "Oh! My cute"
line "mushroom #MON!"
prompt
_Route4AfterBattleText1::
text "There might not"
line "be any more"
cont "mushrooms here."
para "I think I got"
line "them all."
done
_Route4Text5::
text "MT.MOON"
line "Tunnel Entrance"
done
_Route4Text6::
text "ROUTE 4"
line "MT.MOON -"
cont "CERULEAN CITY"
done
|
transformy/tables/gen/004e.asm | mborik/regression | 3 | 1621 | ld a, 102
ld d,a
ld e,a
ld (basescradr + #01ed), de
ld (basescradr + #02ed), de
ld (basescradr + #06ae), de
ld (basescradr + #0989), de
ld (basescradr + #0a0c), de
ld (basescradr + #0d2b), de
ld (basescradr + #0d4a), de
ld (basescradr + #0e4a), de
ld (basescradr + #01ce), a
ld (basescradr + #02ce), a
ld (basescradr + #05ce), a
ld (basescradr + #05ed), a
ld (basescradr + #06ce), a
ld (basescradr + #06ed), a
ld (basescradr + #090d), a
ld (basescradr + #092c), a
ld (basescradr + #094b), a
ld (basescradr + #096a), a
ld (basescradr + #0a2c), a
ld (basescradr + #0a4b), a
ld (basescradr + #0a6a), a
ld (basescradr + #0a89), a
ld (basescradr + #0d0c), a
ld (basescradr + #0d6a), a
ld (basescradr + #0e0c), a
ld (basescradr + #0e2b), a
ld (basescradr + #0e6a), a
ld a, 112
ld (basescradr + #06b0), a
xor a
ld hl, basescradr + #0aaa
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0acb
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0aec
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #120d
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #120e
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #122e
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #122f
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld d,a
ld e,a
ld (basescradr + #084a), de
ld (basescradr + #0869), de
ld (basescradr + #0889), de
ld (basescradr + #0b0c), de
ld (basescradr + #0b2b), de
ld (basescradr + #0b4a), de
ld (basescradr + #0b69), de
ld (basescradr + #0c0c), de
ld (basescradr + #0c2b), de
ld (basescradr + #0c4a), de
ld (basescradr + #0c69), de
ld (basescradr + #0ecb), de
ld (basescradr + #0eec), de
ld hl, basescradr + #0f49
ld (hl), a
inc hl
ld (hl), a
inc hl
ld (hl), a
ld (basescradr + #0f69), de
ld (basescradr + #102e), de
ld (basescradr + #160d), de
ld (basescradr + #162f), de
ld (basescradr + #170e), de
ld (basescradr + #00cf), a
ld (basescradr + #00ee), a
ld (basescradr + #03ed), a
ld (basescradr + #04ce), a
ld (basescradr + #04ed), a
ld (basescradr + #07af), a
ld (basescradr + #07ce), a
ld (basescradr + #07ed), a
ld (basescradr + #080d), a
ld (basescradr + #082c), a
ld (basescradr + #08cb), a
ld (basescradr + #08ec), a
ld (basescradr + #0b89), a
ld (basescradr + #0bed), a
ld (basescradr + #0c89), a
ld (basescradr + #0ced), a
ld (basescradr + #0f0c), a
ld (basescradr + #0f2b), a
ld (basescradr + #0fab), a
ld (basescradr + #0fcc), a
ld (basescradr + #0fed), a
ld (basescradr + #100d), a
ld (basescradr + #104f), a
ld (basescradr + #124f), a
ld (basescradr + #172f), a
ld a, 120
ld (basescradr + #07b0), a
ld a, 252
ld (basescradr + #00d0), a
ld (basescradr + #04f2), a
ld (basescradr + #06d1), a
ld (basescradr + #0a13), a
ld (basescradr + #0a96), a
ld (basescradr + #0cb5), a
ld (basescradr + #0d56), a
ld (basescradr + #0dd4), a
ld (basescradr + #0ed4), a
ld (basescradr + #0ff3), a
ld (basescradr + #1132), a
ld a, 103
ld (basescradr + #01cf), a
ld (basescradr + #02cf), a
ld (basescradr + #05ee), a
ld (basescradr + #094c), a
ld (basescradr + #096b), a
ld (basescradr + #0a6b), a
ld (basescradr + #0a8a), a
ld (basescradr + #0d0d), a
ld (basescradr + #0e0d), a
ld (basescradr + #0e2c), a
ld a, 254
ld (basescradr + #01d0), a
ld (basescradr + #05f2), a
ld (basescradr + #07d1), a
ld (basescradr + #0934), a
ld (basescradr + #0996), a
ld (basescradr + #0b13), a
ld (basescradr + #0bb5), a
ld (basescradr + #0cd4), a
ld (basescradr + #0ef3), a
ld (basescradr + #0f35), a
ld (basescradr + #1032), a
ld a, 2
ld (basescradr + #02cd), a
ld (basescradr + #0969), a
ld (basescradr + #0a88), a
ld (basescradr + #0d0b), a
ld (basescradr + #0e0b), a
ld a, 255
ld hl, basescradr + #00f1
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #02d0
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0812
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0833
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0854
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0855
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0875
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0876
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #08b5
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #08d4
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #08f3
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0a34
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0af2
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0c13
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0cd3
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0db4
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #1012
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #1031
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #1111
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld (basescradr + #06f2), a
ld (basescradr + #07f2), a
ld (basescradr + #0896), a
ld (basescradr + #0e56), a
ld (basescradr + #0e95), a
ld (basescradr + #0f56), a
ld (basescradr + #0f95), a
ld a, 128
ld (basescradr + #02d1), a
ld (basescradr + #08b6), a
ld (basescradr + #0956), a
ld (basescradr + #0ad5), a
ld (basescradr + #0b35), a
ld (basescradr + #0bf4), a
ld (basescradr + #0cf4), a
ld (basescradr + #0f57), a
ld (basescradr + #0f77), a
ld (basescradr + #1513), a
ld (basescradr + #1613), a
ld (basescradr + #1732), a
ld a, 3
ld (basescradr + #03cf), a
ld (basescradr + #04ee), a
ld (basescradr + #084c), a
ld (basescradr + #0b8a), a
ld (basescradr + #0f8a), a
ld (basescradr + #100e), a
ld (basescradr + #1430), a
ld (basescradr + #160f), a
ld a, 192
ld (basescradr + #01f2), a
ld (basescradr + #03d1), a
ld (basescradr + #07f3), a
ld (basescradr + #0877), a
ld (basescradr + #09d5), a
ld (basescradr + #0a56), a
ld (basescradr + #0af4), a
ld (basescradr + #0d14), a
ld (basescradr + #0d77), a
ld (basescradr + #0e77), a
ld (basescradr + #0f96), a
ld (basescradr + #1413), a
ld (basescradr + #1632), a
ld a, 7
ld (basescradr + #04cf), a
ld (basescradr + #0b6b), a
ld (basescradr + #0bcc), a
ld (basescradr + #0c8a), a
ld (basescradr + #0f0d), a
ld (basescradr + #0fee), a
ld (basescradr + #1330), a
ld a, 224
ld (basescradr + #02f2), a
ld (basescradr + #04d1), a
ld (basescradr + #0813), a
ld (basescradr + #08d5), a
ld (basescradr + #09f4), a
ld (basescradr + #0c35), a
ld (basescradr + #0c77), a
ld (basescradr + #0e14), a
ld (basescradr + #0e96), a
ld (basescradr + #0fb5), a
ld (basescradr + #1313), a
ld (basescradr + #1532), a
ld a, 6
ld (basescradr + #05cd), a
ld (basescradr + #05ec), a
ld (basescradr + #06cd), a
ld (basescradr + #06ec), a
ld (basescradr + #092b), a
ld (basescradr + #094a), a
ld (basescradr + #0a4a), a
ld (basescradr + #0a69), a
ld (basescradr + #0d69), a
ld a, 111
ld (basescradr + #05cf), a
ld (basescradr + #06ee), a
ld (basescradr + #0a4c), a
ld (basescradr + #0d8a), a
ld a, 248
ld (basescradr + #03f2), a
ld (basescradr + #05d1), a
ld (basescradr + #0834), a
ld (basescradr + #0b96), a
ld (basescradr + #0c56), a
ld (basescradr + #0c96), a
ld (basescradr + #0db5), a
ld (basescradr + #0e35), a
ld (basescradr + #0fd4), a
ld (basescradr + #1013), a
ld (basescradr + #1113), a
ld (basescradr + #1232), a
ld a, 127
ld hl, basescradr + #0d6b
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld (basescradr + #00ef), a
ld (basescradr + #01ef), a
ld (basescradr + #06cf), a
ld (basescradr + #090e), a
ld (basescradr + #092d), a
ld (basescradr + #0a0e), a
ld (basescradr + #0a2d), a
ld (basescradr + #0c2d), a
ld (basescradr + #0cee), a
ld (basescradr + #0d4c), a
ld (basescradr + #0e4c), a
ld (basescradr + #0ecd), a
ld (basescradr + #1030), a
ld (basescradr + #120f), a
ld (basescradr + #1631), a
ld a, 63
ld (basescradr + #07cf), a
ld (basescradr + #08cc), a
ld (basescradr + #0aab), a
ld (basescradr + #0b2d), a
ld (basescradr + #0c4c), a
ld (basescradr + #0dee), a
ld (basescradr + #1130), a
ld (basescradr + #130f), a
ld a, 1
ld (basescradr + #03ee), a
ld (basescradr + #086b), a
ld (basescradr + #08aa), a
ld (basescradr + #0aed), a
ld (basescradr + #0ccc), a
ld (basescradr + #0eab), a
ld (basescradr + #0f2c), a
ld a, 15
ld (basescradr + #07ee), a
ld (basescradr + #082d), a
ld (basescradr + #08ed), a
ld (basescradr + #0acc), a
ld (basescradr + #0c6b), a
ld (basescradr + #0cab), a
ld (basescradr + #0e8a), a
ld (basescradr + #0eee), a
ld (basescradr + #1051), a
ld (basescradr + #1230), a
ld (basescradr + #140f), a
ld a, 31
ld (basescradr + #080e), a
ld (basescradr + #0b4c), a
ld (basescradr + #0bab), a
ld (basescradr + #0fcd), a
ld (basescradr + #1731), a
ld a, 38
ld (basescradr + #090c), a
ld (basescradr + #0a2b), a
ld (basescradr + #0e69), a
ld a, 240
ld hl, basescradr + #0977
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld (basescradr + #08f4), a
ld (basescradr + #0913), a
ld (basescradr + #0b56), a
ld (basescradr + #0d35), a
ld (basescradr + #0d96), a
ld (basescradr + #0eb5), a
ld (basescradr + #0f14), a
ld (basescradr + #1213), a
ld (basescradr + #1332), a
ld (basescradr + #1432), a
ld a, 4
ld (basescradr + #09ca), a
ld (basescradr + #09eb), a
ld (basescradr + #0d88), a
ld (basescradr + #0dec), a
ld (basescradr + #112e), a
ld (basescradr + #114f), a
ld (basescradr + #150d), a
ld a, 68
ld d,a
ld e,a
ld (basescradr + #09a9), de
ld (basescradr + #0dcb), de
ld (basescradr + #110d), de
ld (basescradr + #152f), de
ld (basescradr + #09cb), a
ld (basescradr + #09ec), a
ld (basescradr + #0d89), a
ld (basescradr + #0daa), a
ld (basescradr + #0ded), a
ld (basescradr + #112f), a
ld (basescradr + #1150), a
ld (basescradr + #150e), a
ld a, 71
ld (basescradr + #09ed), a
ld (basescradr + #0dab), a
ld (basescradr + #150f), a
ld a, 95
ld (basescradr + #09cc), a
ld a, 66
ld (basescradr + #1151), a
ret
|
alloy4fun_models/trashltl/models/5/Kd5iRenzATR6S3DL4.als | Kaixi26/org.alloytools.alloy | 0 | 4932 | open main
pred idKd5iRenzATR6S3DL4_prop6 {
always some f:File | f in Trash implies f in Trash'
}
pred __repair { idKd5iRenzATR6S3DL4_prop6 }
check __repair { idKd5iRenzATR6S3DL4_prop6 <=> prop6o } |
Examples/ASM/keyboard.asm | Tashenea/F20-243-course-materials | 1 | 161417 | @direction
M = 0
@y_coord
M = 0
@x_coord
M = 0
@i
M = 0
(:Main)
//start at top of screen
@SCREEN
D = A
@x_coord
M = D
//offset by 1
@y_coord
D = M
@x_coord
M = M + D
//initialize counter to 25
@25
D = A
@i
M = D
(:DrawLoop)
@i
D = M
//draw single line
@x_coord
A = M
D = -1
M = D
//increment line
D = A
@32
D = D + A
@x_coord
M = D
//subtract 1 from i, loop if necessary
@i
D = M - 1
M = D
@:DrawLoop
D;JGT
//sniff for keyboard input
//left arrow
@KBD
D = M
@130
D = D - A
@:LeftArrowPressed
D;JEQ
//rigt arrow
@KBD
D = M
@132
D = D - A
@:RightArrowPressed
D;JEQ
//no input
@:Main
0;JMP
(:LeftArrowPressed)
@y_coord
D = M - 1
M = D
@:Main
0;JMP
(:RightArrowPressed)
@y_coord
D = M + 1
M = D
@:Main
0;JMP |
AP1/kernel_pr.asm | KilnerJhow/ihs | 1 | 176671 | org 0x7E00
jmp 0x0000:start
section .text
start:
; call registerAcc
call clearscreen
mov ax, 0
mov si, ax
mov di, ax
mov ds, ax
mov es, ax
call printWelcomeScreen
.loop:
call readOption
cmp ax, 255
je .cheio
call clearscreen
jmp start
.cheio:
call clearscreen
call printWelcomeScreen
mov si, cheio
call printString
jmp .loop
;usuário 1
; call new_line
; mov si, memory
; call printString
; call new_line
; mov si, memory
; add si, 21
; call printString
; call new_line
; mov si, memory
; add si, 32
; call printString
; call new_line
; mov si, memory
; add si, 39
; call printString
; call new_line
; call registerAcc
; ;usário 2
; call new_line
; mov si, memory
; add si, 48
; call printString
; call new_line
; mov si, memory
; add si, 69 ; 21 + 48
; call printString
; call new_line
; mov si, memory
; add si, 80 ;32 + 48
; call printString
; call new_line
; mov si, memory
; add si, 87;39 + 48
; call printString
; call new_line
jmp exit
new_line:
mov ah, 0x0E
mov al, 0xA
int 10h
mov al, 0xD
int 10h
ret
printWelcomeScreen:
push si
mov si, welcome
call printString
mov si, trace
call printString
mov si, option1
call printString
mov si, trace
call printString
mov si, option2
call printString
mov si, trace
call printString
mov si, option3
call printString
mov si, trace
call printString
mov si, option4
call printString
mov si, trace
call printString
mov si, option5
call printString
mov si, trace
call printString
mov si, option6
call printString
mov si, trace
call printString
pop si
ret
clearscreen:
push ax
mov ah, 00h ;Apaga o que estiver escrito na tela anteriormente
mov al, 00h
int 0x10
mov al, 03h ;Seta a tela para modo texto com 80x25
mov ah, 0
int 0x10
pop ax
ret
readOption:
.loop:
mov ah, 0 ;função para pegar um dígito do teclado
int 0x16
cmp al, 0x0D ; valor do enter
je .done ; (je - Faz um jump caso o ZF = 1)
cmp al, 0x08 ;valor do backspace
je .backspace ;trata o backspace
cmp cl, 0x01 ; Lê 20 caracteres
je .loop ; Caso a opção tenha sido escolhida, espera o enter ou backspace
mov ah, 0x0E ;função de printar um número na tela
int 0x10
push ax
inc cl ;incrementa a quantidade de teclas digitadas
jmp .loop
.backspace:
cmp cl, 0
je .loop
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
mov al, ' '
mov ah, 0x0E
int 0x10
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
dec cl
pop ax
jmp .loop
.done:
pop ax
cmp cl, 0
je .loop
cmp al, '1' ;tecla 1
je .option1
cmp al, '2' ;tecla 2
je .option2
cmp al, '3' ;tecla 3
je .option3
cmp al, '4' ;tecla 4
je .option4
cmp al, '5' ;tecla 5
je .option5
cmp al, '6' ;tecla 6
je .option6 ;tecla 6
.err:
call clearscreen
call printWelcomeScreen
mov si, err
call printString
jmp .loop
.option1: ;registrar conta
call registerAcc
jmp .exit
.option2: ;buscar conta
call findAcc
jmp .exit
.option3: ;editar conta
;call editAcc
jmp .exit
.option4: ;deletar conta
;call delAcc
jmp .exit
.option5: ;listar agencias
;call listAg
jmp .exit
.option6: ;listar contas de uma agencia
;call listAgAcc
jmp .exit
.exit:
ret
registerAcc:
call findPos ;retorna em ax a posição de ínicio da conta
cmp ax, 255
je .exit
mov di, memory ;pega a base do vetor
add di, ax ;soma com o offset da posição de memória onde vai ser salva
call clearscreen
mov si, insertName
call printString
call _insertName
call clearscreen
mov si, insertCPF
call printString
mov di, memory
add di, ax
add di, 21
call _insertCPF
call clearscreen
mov si, insertConta
call printString
mov di, memory
add di, 32 ;32
add di, ax
call _insertConta
call clearscreen
mov si, insertAg
call printString
mov di, memory
add di, 39 ;41
add di, ax
call _insertAg
jmp .exit
.cheio:
.exit:
ret
findAcc:
push di
push si
push ax
push cx
call clearscreen
mov si, insertNumConta
call printString
mov di, buffer
call getConta
mov cl, 0
mov si, tableOccuped
.loop:
cmp cl, 5
je .erro
lodsb
cmp al, '1'
je .occupied
inc cl
jmp .loop
.occupied:
mov al, 48
mul cl
.compare:
push si
mov di, buffer
mov si, buffer
call printString
mov si, memory
add si, ax
call printString
mov si, memory
add si, ax
call strcmp
jc .igual
.n_igual:
mov si, naoigual
call printString
pop si
jmp .loop
.igual:
mov si, igual
call printString
jmp .exit
.erro:
mov si, noAcc
call printString
call waitEnter
.exit:
jmp .exit
pop cx
pop ax
pop si
pop di
ret
getConta:
push di
.loop:
mov ah, 0 ;função para pegar um dígito do teclado
int 0x16
cmp al, 0x0D ; valor do enter
je .done ; (je - Faz um jump caso o ZF = 1)
cmp al, 0x08 ;valor do backspace
je .backspace ;trata o backspace
cmp cl, 0x05 ; Lê 5 caracteres para a conta
je .loop ; Caso a opção tenha sido escolhida, espera o enter ou backspace
mov ah, 0x0E ;função de printar um número na tela
int 0x10
stosb
inc cl ;incrementa a quantidade de teclas digitadas
jmp .loop
.backspace:
cmp cl, 0
je .loop
dec di
mov byte[di], 0
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
mov al, ' '
mov ah, 0x0E
int 0x10
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
dec cl
jmp .loop
.done:
mov al, 0 ;salvar terminador de string
stosb ;salvamos o terminador de string na última posição apontada por di
mov ah, 0x0E
mov al, 0xA ;nova linha e carriage return
int 10h
mov al, 0xD
int 10h
.exit:
pop di
ret
_insertName:
push ax
push di
mov cl, 0
.loop:
mov ah, 0 ;função para pegar um dígito do teclado
int 0x16
cmp al, 0x0D ; valor do enter
je .done ; (je - Faz um jump caso o ZF = 1)
cmp al, 0x08 ;valor do backspace
je .backspace ;trata o backspace
cmp cl, 0x14 ; Lê 20 caracteres para o nome
je .loop ; Caso a opção tenha sido escolhida, espera o enter ou backspace
mov ah, 0x0E ;função de printar um número na tela
int 0x10
stosb
inc cl ;incrementa a quantidade de teclas digitadas
jmp .loop
.backspace:
cmp cl, 0
je .loop
dec di
mov byte[di], 0
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
mov al, ' '
mov ah, 0x0E
int 0x10
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
dec cl
jmp .loop
.done:
mov al, 0 ;salvar terminador de string
stosb ;salvamos o terminador de string na última posição apontada por di
mov ah, 0x0E
mov al, 0xA ;nova linha e carriage return
int 10h
mov al, 0xD
int 10h
.exit:
pop di
pop ax
ret
_insertCPF:
push ax
push di
mov cl, 0
.loop:
mov ah, 0 ;função para pegar um dígito do teclado
int 0x16
cmp al, 0x0D ; valor do enter
je .done ; (je - Faz um jump caso o ZF = 1)
cmp al, 0x08 ;valor do backspace
je .backspace ;trata o backspace
cmp cl, 0xB ; Lê 11 caracteres para o CPF
je .loop ; Caso a opção tenha sido escolhida, espera o enter ou backspace
mov ah, 0x0E ;função de printar um número na tela
int 0x10
stosb
inc cl ;incrementa a quantidade de teclas digitadas
jmp .loop
.backspace:
cmp cl, 0
je .loop
dec di
mov byte[di], 0
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
mov al, ' '
mov ah, 0x0E
int 0x10
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
dec cl
jmp .loop
.done:
mov al, 0 ;salvar terminador de string
stosb ;salvamos o terminador de string na última posição apontada por di
mov ah, 0x0E
mov al, 0xA ;nova linha e carriage return
int 10h
mov al, 0xD
int 10h
.exit:
pop di
pop ax
ret
_insertConta:
push ax
push di
mov cl, 0
.loop:
mov ah, 0 ;função para pegar um dígito do teclado
int 0x16
cmp al, 0x0D ; valor do enter
je .done ; (je - Faz um jump caso o ZF = 1)
cmp al, 0x08 ;valor do backspace
je .backspace ;trata o backspace
cmp cl, 0x05 ; Lê 11 caracteres para a conta
je .loop ; Caso a opção tenha sido escolhida, espera o enter ou backspace
mov ah, 0x0E ;função de printar um número na tela
int 0x10
stosb
inc cl ;incrementa a quantidade de teclas digitadas
jmp .loop
.backspace:
cmp cl, 0
je .loop
dec di
mov byte[di], 0
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
mov al, ' '
mov ah, 0x0E
int 0x10
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
dec cl
jmp .loop
.done:
mov al, 0 ;salvar terminador de string
stosb ;salvamos o terminador de string na última posição apontada por di
mov ah, 0x0E
mov al, 0xA ;nova linha e carriage return
int 10h
mov al, 0xD
int 10h
.exit:
pop di
pop ax
ret
_insertAg:
push ax
push di
mov cl, 0
.loop:
mov ah, 0 ;função para pegar um dígito do teclado
int 0x16
cmp al, 0x0D ; valor do enter
je .done ; (je - Faz um jump caso o ZF = 1)
cmp al, 0x08 ;valor do backspace
je .backspace ;trata o backspace
cmp cl, 0x05 ; Lê 5 caracteres para a Ag
je .loop ; Caso a opção tenha sido escolhida, espera o enter ou backspace
mov ah, 0x0E ;função de printar um número na tela
int 0x10
stosb
inc cl ;incrementa a quantidade de teclas digitadas
jmp .loop
.backspace:
cmp cl, 0
je .loop
dec di
mov byte[di], 0
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
mov al, ' '
mov ah, 0x0E
int 0x10
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
dec cl
jmp .loop
.done:
mov al, 0 ;salvar terminador de string
stosb ;salvamos o terminador de string na última posição apontada por di
mov ah, 0x0E
mov al, 0xA ;nova linha e carriage return
int 10h
mov al, 0xD
int 10h
.exit:
pop di
pop ax
ret
findPos:
push si
push di
push cx
;push dx
mov cx, 0
mov ds, cx
mov es, cx
mov si, tableOccuped
mov di, tableOccuped
.loop:
cmp cx, 5
je .cheio
lodsb
cmp al, 0
je .posLivre
inc cx
jmp .loop
.posLivre:
cmp cx, 0
je .op1
cmp cx, 1
je .op2
cmp cx, 2
je .op3
cmp cx, 3
je .op4
cmp cx, 4
je .op5
.op1:
mov al, '1'
stosb
mov ax, 0
jmp .exit
.op2:
add di, cx
mov al, '1'
stosb
mov ax, 48
jmp .exit
.op3:
add di, cx
mov al, '1'
stosb
mov ax, 96
jmp .exit
.op4:
add di, cx
mov al, '1'
stosb
mov ax, 144
jmp .exit
.op5:
add di, cx
mov al, '1'
stosb
mov ax, 192
jmp .exit
.cheio:
mov ax, 255
.exit:
pop cx
pop di
pop si
ret
printString:
push ax ;empilha reg para salva os valores anteriores
push di
push si
mov cl, 0
.loop:
lodsb ;carregamos em ax um byte, word ou dword apontado por DS:SI, (Data Segment):(Source Index), SI incrementa/decrementa automaticamente
cmp cl, al ;comparamos cl com al, seta flag ZF (Zero flag) para 1 caso operando iguais, 0 caso contrário
jz .exit ;caso al seja 0, chegamos ao final da string e podemos retornar
mov ah, 0xE ;função para printar um caracter na tela
int 0x10 ;interrupção para printar um caracter na tela
jmp .loop
.exit:
pop si
pop di
pop ax
ret
waitEnter:
.loop:
mov ah, 0 ;função para pegar um dígito do teclado
int 0x16
cmp al, 0x0D ; valor do enter
je .done ; (je - Faz um jump caso o ZF = 1)
jmp .loop
.done:
ret
strcmp:
push ax
push bx
push di
push si
.loop:
mov al, [si] ; grab a byte from SI
mov bl, [di] ; grab a byte from DI
cmp al, bl ; are they equal?
jne .notequal ; nope, we're done.
cmp al, 0 ; are both bytes (they were equal before) null?
je .done ; yes, we're done.
inc di ; increment DI
inc si ; increment SI
jmp .loop ; loop!
.notequal:
clc ; not equal, clear the carry flag
ret
.done:
stc ; equal, set the carry flag
pop si
pop di
pop bx
pop ax
ret
exit:
jmp exit
section .data
;{
memory: times 240 db 0 ;reserva 240 bytes inicializado com 0
;ex: [Nome][T][CPF][T][Ag][T][Conta][T][NewLine]
; 20 - Nome + 1 Caractere terminador
; 11 - CPF + 1 Caractere terminador
; 5 - Agência + 1 Caractere terminador
; 9 - Conta + 1 Caractere terminador
tableOccuped: times 5 db 0 ; tabela onde marcamos cada bit do byte como ocupado (1) ou não (0)
buffer: times 64 db 0 ;buffer para armazernar dados temporários
welcome: db 'Bem vindo, selecione a opcao desejada abaixo', 0xA, 0xD, 0 ;0xA - New line, 0xD - Carriage Return, 0 - fim da string
option1: db '|Cadastrar conta: 1|', 0xA, 0xD, 0
option2: db '|Buscar conta: 2|', 0xA, 0xD, 0
option3: db '|Editar conta: 3|', 0xA, 0xD, 0
option4: db '|Deletar conta: 4|', 0xA, 0xD, 0
option5: db '|Listar agencias: 5|', 0xA, 0xD, 0
option6: db '|Listar contas de uma agencia: 6|', 0xA, 0xD, 0
trace: db '=================================', 0xA, 0xD, 0
insertName: db 'Insira seu nome: ', 0xA, 0xD, 0
insertCPF: db 'Insira seu CPF: ', 0xA, 0xD, 0
insertConta: db 'Insira sua conta: ', 0xA, 0xD, 0
insertAg: db 'Insira sua agencia: ', 0xA, 0xD, 0
insertNumConta: db 'Insira o num da conta: ', 0xA, 0xD, 0
noAcc: db 'Conta nao encontrada no banco de dados ', 0xA, 0xD, 0
cheio: db 'Banco de dados cheio', 0xA, 0xD, 0
err: db '|Erro, opcao invalida |', 0xA, 0xD, 0
;debug string
naoigual: db 'Nao igual', 0xA, 0xD, 0
igual: db 'Igual', 0xA, 0xD, 0
;} |
src/sys/encoders/util-encoders-ecc.ads | RREE/ada-util | 60 | 22943 | <reponame>RREE/ada-util<gh_stars>10-100
-----------------------------------------------------------------------
-- util-encoders-ecc -- Error Correction Code
-- Copyright (C) 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
-- == Error Correction Code ==
-- The `Util.Encoders.ECC` package provides operations to support error correction codes.
-- The error correction works on blocks of 256 or 512 bytes and can detect 2-bit errors
-- and correct 1-bit error. The ECC uses only three additional bytes.
-- The ECC algorithm implemented by this package is implemented by several NAND Flash
-- memory. It can be used to increase the robustness of data to bit-tempering when
-- the data is restored from an external storage (note that if the external storage has
-- its own ECC correction, adding another software ECC correction will probably not help).
--
-- The ECC code is generated by using the `Make` procedure that gets a block of 256 or
-- 512 bytes and produces the 3 bytes ECC code. The ECC code must be saved together with
-- the data block.
--
-- Code : Util.Encoders.ECC.ECC_Code;
-- ...
-- Util.Encoders.ECC.Make (Data, Code);
--
-- When reading the data block, you can verify and correct it by running again the
-- `Make` procedure on the data block and then compare the current ECC code with the
-- expected ECC code produced by the first call. The `Correct` function is then called
-- with the data block, the expected ECC code that was saved with the data block and
-- the computed ECC code.
--
-- New_Code : Util.Encoders.ECC.ECC_Code;
-- ...
-- Util.Encoders.ECC.Make (Data, New_Code);
-- case Util.Encoders.ECC.Correct (Data, Expect_Code, New_Code) is
-- when NO_ERROR | CORRECTABLE_ERROR => ...
-- when others => ...
-- end case;
package Util.Encoders.ECC is
type ECC_Result is (NO_ERROR, CORRECTABLE_ERROR, UNCORRECTABLE_ERROR, ECC_ERROR);
subtype ECC_Code is Ada.Streams.Stream_Element_Array (0 .. 2);
-- Make the 3 bytes ECC code that corresponds to the data array.
procedure Make (Data : in Ada.Streams.Stream_Element_Array;
Code : out ECC_Code) with
Pre => Data'Length = 256 or Data'Length = 512;
-- Check and correct the data array according to the expected ECC codes and current codes.
-- At most one bit can be fixed and two error bits can be detected.
function Correct (Data : in out Ada.Streams.Stream_Element_Array;
Expect_Code : in ECC_Code;
Current_Code : in ECC_Code) return ECC_Result with
Pre => Data'Length = 256 or Data'Length = 512;
-- Check and correct the data array according to the expected ECC codes and current codes.
-- At most one bit can be fixed and two error bits can be detected.
function Correct (Data : in out Ada.Streams.Stream_Element_Array;
Expect_Code : in ECC_Code) return ECC_Result with
Pre => Data'Length = 256 or Data'Length = 512;
end Util.Encoders.ECC;
|
oeis/015/A015015.asm | neoneye/loda-programs | 11 | 7371 | ; A015015: q-factorial numbers for q=-3.
; Submitted by <NAME>
; 1,-2,-14,280,17080,-3108560,-1700382320,2788627004800,13722833490620800,-202576467988544249600,-8971504037808659182035200,1191954026463258458925196672000,475090227821752019816863814722432000,-568085339196037403679856371543830284544000,-2037851067068183667490280132124059680133919488000,21930701071446330810756797892276850578503598675619840000,708033583250388719524846460980871704277862401889932234813440000,-68576679085813555977002786009570568584180284834262417174588378439680000
mov $1,1
mov $2,1
lpb $0
sub $0,1
mul $2,-3
add $2,1
mul $1,$2
lpe
mov $0,$1
|
libsrc/_DEVELOPMENT/temp/sp1/zx/sprites/asm_sp1_PutSprClr.asm | jpoikela/z88dk | 640 | 8915 | <reponame>jpoikela/z88dk
; void sp1_PutSprClr(uchar **sprdest, struct sp1_ap *src, uchar n)
; 02.2006 aralbrec, Sprite Pack v3.0
; sinclair spectrum version
SECTION code_clib
SECTION code_temp_sp1
PUBLIC asm_sp1_PutSprClr
asm_sp1_PutSprClr:
; Colour sprite by writing (mask,attr) pairs into each
; struct_sp1_cs whose addresses are stored in the array
; pointed at by hl. The array of struct_sp1_cs is
; populated by a call to SP1GetSprClrAddr.
;
; enter : b = number of colour pairs to copy (size of sprite in tiles)
; de = struct sp1_ap[] source array of colour pairs
; hl = array of sprite colour addresses (all point at struct sp1_cs.attr_mask)
; uses : af, bc, de, hl
ld c,$ff
.loop
push de
ld e,(hl)
inc hl
ld d,(hl) ; de = & sp1_cs.attr_mask
inc hl
ex (sp),hl ; hl = struct sp1_ap[
ldi ; copy mask and attribute into struct sp1_cs
ldi
pop de ; de = array of sprite colour addresses advanced one entry
ex de,hl
djnz loop
ret
|
examples/program6.asm | hleonps/Micro-To-MIPS32-Compiler | 1 | 173391 | <gh_stars>1-10
.text
.globl main
main:
li $v0, 5
syscall
sw $v0, var1
lw $t0, var1
li $t1, 0
beq $t0, $t1, .label0
li $t0, 0
j .label1
.label0:
li $t0, 1
.label1:
sw $t0, var2
li $t2, 0
lw $t3, var2
beq $t3, $t2, .label2
li $t4, 123
sw $t4, var2
j .label3
.label2:
li $t5, 3
sw $t5, var2
.label3:
lw $t7, var2
li $t8, 600
add $t6, $t7, $t8
move $t0, $t6
li $t1, 60
add $t9, $t0, $t1
move $t3, $t9
li $t4, 6
add $t2, $t3, $t4
sw $t2, var2
lw $t6, var1
li $v0, 1
move $a0, $t6
syscall
li $a0, 10
li $v0, 11
syscall
lw $t8, var2
li $v0, 1
move $a0, $t8
syscall
li $a0, 10
li $v0, 11
syscall
li $v0, 10
syscall
.data
var1: .word 0
var2: .space 4
|
programs/oeis/090/A090973.asm | neoneye/loda | 22 | 88761 | <reponame>neoneye/loda<gh_stars>10-100
; A090973: a(n) = ceiling((prime(n)/n).
; 2,2,2,2,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,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,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6
mov $1,$0
add $0,1
seq $1,40 ; The prime numbers.
mov $2,$0
cmp $2,1
add $0,$2
div $1,$0
mov $0,$1
add $0,1
|
src/system_random.ads | AntonMeep/system_random | 0 | 2350 | with Interfaces; use Interfaces;
with Interfaces.C; use Interfaces.C;
generic
type Element is mod <>;
-- ELement type, must be mod 2**8, i.e. represent a byte
type Index is range <>;
-- Index type
type Element_Array is array (Index range <>) of aliased Element;
-- An array of aliased Elements
package System_Random with
Preelaborate
is
-- @summary
-- Ada interface to system sources of randomness
--
-- @description
-- This package provides generic interface to OS' sources of randomeness.
-- On Windows, BCryptGenRandom() is used, on other platforms such as Linux,
-- BSD, Mac OS portable getentropy() is used.
--
-- This is a generic package as it is intended to be used with user-defined
-- byte array type, that would later be converted to a seed value used to
-- seed an appropriate strong PRNG algorithm.
pragma Compile_Time_Error
(Element'Modulus /= 2**8,
"'Element' type must be mod 2**8, i.e. represent a byte");
System_Random_Error : exception;
-- Raised whenever an underlying system function has failed
procedure Random (Output : aliased out Element_Array) with
Pre => Output'Length <= Interfaces.Unsigned_32'Last and
Output'Length <= Interfaces.C.size_t'Last;
-- Fill Output with random data. This function call blocks, thus it's
-- better to call it as few times as possible.
--
-- Maximum length of Output array is determined by the underlying system
-- implementation, and for unix is equal to 256 bytes.
end System_Random;
|
snake.asm | HELLKING66666/snake | 0 | 104097 | <gh_stars>0
org 0x100
mov ax, cs
mov es, ax
mov ds, ax
mov ss, ax ; 设置堆栈指针
mov sp, 100h - 8
; 环境设置
mov ah, 0x01
mov cx, 0x2000
int 0x10 ; 利用10号中断停止光标闪烁
mov ax, 0x0305
mov bx, 0x031F
int 0x16 ; 增加重复键入延迟
call game_loop
game_loop:
call cls ; 清屏
push word [snake_pos] ; 讲蛇头位置压栈保存
mov ah, 0x01 ; 调用功能号为01的16中断判断是否有按键信号
int 0x16
jz keep_going ; 没有按键,则跳转到keep_going,继续移动
mov ah, 0x00 ; 有则从缓存读取按键
int 0x16
jmp update_snakepos ; 更新蛇头位置
keep_going:
mov al, [last_move] ; 没有按键,继续以最后方向移动
update_snakepos:
cmp al, 'a'
je left
cmp al, 's'
je down
cmp al, 'd'
je right
cmp al, 'w'
jne keep_going
up:
dec byte [snake_y_pos]
jmp move_done ; 蛇头移动完毕后跳转到move_done
left:
dec byte [snake_x_pos]
jmp move_done ; 蛇头移动完毕后跳转到move_done
right:
inc byte [snake_x_pos]
jmp move_done ; 蛇头移动完毕后跳转到move_done
down:
inc word [snake_y_pos]
move_done:
mov [last_move], al ; 保存最后移动方向
mov si, snake_body_pos ; 蛇身储存在寄存器si,其中si为源变址寄存器
pop ax ; 原来的蛇头位置出栈以让蛇身移动
update_body: ;主要完成蛇身往之前的蛇部位前进
mov bx, [si] ; 将蛇身数组[0]赋值给bx
test bx, bx ; 判断是否为蛇身
jz done_update ; 如果不是完成蛇身更新
mov [si], ax ; 迭代
add si, 2 ; 迭代
mov ax, bx ; 迭代
jmp update_body ;
done_update:
cmp byte [grow_snake_flag], 1 ; 利用标识变量判断是否生长
jne add_zero_snake ; 为0,则跳转到add_zero_snake例程
mov word [si], ax ; 保存蛇尾
mov byte [grow_snake_flag], 0 ; 标识变量置零
add si, 2 ; 蛇长大了
add_zero_snake:
mov word [si], 0x0000 ;
print_stuff: ; 打印界面
call DispScoStr ; 打印分数段
mov ax, [score] ; 将Score传入寄存器ax,准备调用
call print_int ; 打印数字
mov dx, [food_pos] ; 传入食物位置,准备移动光标
call move_cursor ; 移动光标
mov al, '*' ; 食物'*'传入al
call print_char ; 打印食物
mov dx, [snake_pos] ; 传入蛇头位置,准备移动光标
call move_cursor ; 移动光标
mov al, '@' ; 打印蛇头
call print_char ; 打印蛇头
mov si, snake_body_pos ; 传入蛇身数组位置,准备打印蛇身
snake_body_print_loop:
lodsw ; 存取串操作lodsw(字):AX ← [DS:(R|E)SI]、(R|E)SI ← (R|E)SI ± 2
test ax, ax ; 判断是够蛇身存在
jz check_collisions ; 蛇身没有则跳转到check_collisions
mov dx, ax ; 传入蛇身位置,准备移动光标到蛇身位置
call move_cursor ; 移动光标
mov al, 'o' ; 蛇身标志为'o'
call print_char ; 打印蛇身
jmp snake_body_print_loop ; 迭代操作
check_collisions:
mov bx, [snake_pos] ; 将蛇头位置储存在Bx
cmp bh, 25 ; 判断是否撞到墙(下面)
jge game_over_hit_wall
cmp bh, 0 ; 判断是否撞到墙(上面)
jl game_over_hit_wall
cmp bl, 80 ; 判断是否撞到墙(右面)
jge game_over_hit_wall
cmp bl, 0 ; 判断是否撞到墙(左面)
jl game_over_hit_wall
mov si, snake_body_pos ; 加载蛇身位置
check_collisions_self: ; 跌代判断蛇身与蛇头位置是否相等
lodsw ; 加载蛇身位置并将si ++2
cmp ax, bx
je game_over_hit_self
or ax, ax ; 判断是否到达蛇尾,即蛇自撞检测结束条件
jne check_collisions_self ; 没则继续检测
no_collision:
mov ax, [snake_pos] ; 加载蛇头位置
cmp ax, [food_pos] ; 与食物位置判断是否吃到
jne game_loop_continued ; 如果没吃到,则直接跳转到game_loop_continued
inc word [score] ; 计分器++1
mov bx, 24 ; 初始化行随机数范围
call rand ; 调用随机函数结果储存在dx
push dx ; 将 xpos(dx)压栈保存
mov bx, 78 ; 初始化列随机数范围
call rand ; 产生随机数ypos(dx)
pop cx ; 将行位置出栈于cx
mov dh, cl ; 保存cl(实际的行位置)
mov [food_pos], dx ; 更新食物位置
mov byte [grow_snake_flag], 1 ; 标志变量grow_snake_flag置1
game_loop_continued:
mov cx, 0x0002 ; Sleep for 0,15 seconds (cx:dx)
mov dx, 0x49F0 ; 0x000249F0 = 150000
mov ah, 0x86
int 0x15 ; Sleep
jmp game_loop ; loop
game_over_hit_self:
call cls
call DispHitSelfStr
call wait_for_r
game_over_hit_wall:
call cls
call DispHitWallStr
call wait_for_r
wait_for_r:
mov ah, 0x00
int 0x16
cmp al, 'r'
jne goout
mov word [snake_pos], 0x0F0F
and word [snake_body_pos], 0
and word [score], 0
mov byte [last_move], 'd'
jmp game_loop
goout:
mov ax,4c00h ; AH=4Ch(功能号,终止进程)、AL=0(返回代码)
int 21h ; DOS软中断
; 屏幕功能区 ------------------------------------------------------------
cls:
mov ah, 06h ; 功能号(向上滚动文本显示屏幕)
mov al, 0
mov ch, 0
mov cl, 0
mov dh, 24
mov dl, 79
mov bh, 0ch
int 10h ; 调用中断清屏
ret ; 例程返回
;
DispScoStr: ; 显示分数字符串例程
mov ah, 13h ; BIOS中断的功能号(显示字符串)
mov al, 1 ; 光标放到串尾
mov bh, 0 ; 页号 = 0
mov bl, 0ch ; 字符颜色=不闪(0)黑底(000)亮红字(1100)
mov cx, Scostrlen; 串长=strlen
mov dx, 0 ; 显示串的起始位置(0,0):DH=行号、DL=列号
mov bp, Scostr; ES:BP=串地址
int 10h ; 调用10H号显示中断
ret ; 从例程返回
DispHitSelfStr: ; 显示自杀字符串例程
mov ah, 13h ; BIOS中断的功能号(显示字符串)
mov al, 1 ; 光标放到串尾
mov bh, 0 ; 页号 = 0
mov bl, 0ch ; 字符颜色=不闪(0)黑底(000)亮红字(1100)
mov cx, HitSelfstrlen; 串长=strlen
mov dx, 0 ; 显示串的起始位置(0,0):DH=行号、DL=列号
mov bp, HitSelfstr; ES:BP=串地址
int 10h ; 调用10H号显示中断
ret ; 从例程返回
DispHitWallStr: ; 显示撞墙字符串例程
mov ah, 13h ; BIOS中断的功能号(显示字符串)
mov al, 1 ; 光标放到串尾
mov bh, 0 ; 页号 = 0
mov bl, 0ch ; 字符颜色=不闪(0)黑底(000)亮红字(1100)
mov cx, HitWallstrlen; 串长=strlen
mov dx, 0 ; 显示串的起始位置(0,0):DH=行号、DL=列号
mov bp, HitWallstr; ES:BP=串地址
int 10h ; 调用10H号显示中断
ret ; 从例程返回
move_cursor:
mov ah, 0x02 ; move to (dl, dh)
xor bh, bh ; page 0
int 0x10
ret
print_char: ; print the char at al
and al, 0x7F ; unset the high bit
mov ah, 0x0E
int 0x10
ret
;-------------------------------------------------------------------------
; 打印数字例程,由print_int,push_digits,pop_and_print_digits共同完成
;-------------------------------------------------------------------------
print_int: ; 参数为ax
push bp ;
mov bp, sp ;
push_digits:
xor dx, dx
mov bx, 10
div bx
push dx
test ax, ax
jnz push_digits
pop_and_print_digits:
pop ax
add al, '0'
call print_char
cmp sp, bp
jne pop_and_print_digits
pop bp
ret
;--------------------------------------------------------------------
; 函数
;--------------------------------------------------------------------
; 随机函数, 利用功能号为10的1A中断()产生1至bx的随机数 -> dx
; 参考http://webpages.charter.net/danrollins/techhelp/0245.HTM
;
rand:
mov ah, 0x00
int 0x1A
mov ax, dx
xor dx, dx
div bx
inc dx
ret
;------------------------------------------------------------------------
; 定义消息,变量以及变量初始化
;------------------------------------------------------------------------
Scostr db 'Score: '
Scostrlen equ $ - Scostr
HitSelfstr db 'You hit yourself ! Press r to retry'
HitSelfstrlen equ $ - HitSelfstr
HitWallstr db 'You hit the wall ! Press r to retry'
HitWallstrlen equ $ - HitWallstr
; 变量以及初始化
grow_snake_flag db 0
food_pos dw 0x0D0D
score dw 0
last_move db 'd'
snake_pos:
snake_x_pos db 0x0F
snake_y_pos db 0x0F
snake_body_pos dw 0x0000
|
ejercicios5/lab10_03.ads | iyan22/AprendeAda | 0 | 12034 | <filename>ejercicios5/lab10_03.ads
package Lab10_03 is
type T_Vector is array (Integer range <>) of Natural;
type T_Lista_Estatica is
record
Elem : T_Vector (1 .. 10);
Cont : Natural;
end record;
procedure Escribir_Lista (L : in T_Lista_Estatica);
--Pre:
--Post: se han escrito en pantalla los valores de L
-- desde 1 hasta L.Cont
procedure Quitar_Repetidos_Primero (L : in out T_Lista_Estatica);
--pre: --
--post: L no tiene elementos iguales al primer elemento
end Lab10_03;
|
linux/contrib/libjpeg-turbo-dev/simd/i386/jdmrgext-mmx.asm | darthrake/openpnp-capture | 76 | 170290 | ;
; jdmrgext.asm - merged upsampling/color conversion (MMX)
;
; Copyright 2009 Pierre Ossman <<EMAIL>> for Cendio AB
; Copyright (C) 2016, <NAME>.
;
; Based on the x86 SIMD extension for IJG JPEG library
; Copyright (C) 1999-2006, MIYASAKA Masaru.
; For conditions of distribution and use, see copyright notice in jsimdext.inc
;
; This file should be assembled with NASM (Netwide Assembler),
; can *not* be assembled with Microsoft's MASM or any compatible
; assembler (including Borland's Turbo Assembler).
; NASM is available from http://nasm.sourceforge.net/ or
; http://sourceforge.net/project/showfiles.php?group_id=6208
;
; [TAB8]
%include "jcolsamp.inc"
; --------------------------------------------------------------------------
;
; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical.
;
; GLOBAL(void)
; jsimd_h2v1_merged_upsample_mmx (JDIMENSION output_width,
; JSAMPIMAGE input_buf,
; JDIMENSION in_row_group_ctr,
; JSAMPARRAY output_buf);
;
%define output_width(b) (b)+8 ; JDIMENSION output_width
%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf
%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr
%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf
%define original_ebp ebp+0
%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM]
%define WK_NUM 3
%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr
align 32
global EXTN(jsimd_h2v1_merged_upsample_mmx)
EXTN(jsimd_h2v1_merged_upsample_mmx):
push ebp
mov eax,esp ; eax = original ebp
sub esp, byte 4
and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits
mov [esp],eax
mov ebp,esp ; ebp = aligned ebp
lea esp, [wk(0)]
pushpic eax ; make a room for GOT address
push ebx
; push ecx ; need not be preserved
; push edx ; need not be preserved
push esi
push edi
get_GOT ebx ; get GOT address
movpic POINTER [gotptr], ebx ; save GOT address
mov ecx, JDIMENSION [output_width(eax)] ; col
test ecx,ecx
jz near .return
push ecx
mov edi, JSAMPIMAGE [input_buf(eax)]
mov ecx, JDIMENSION [in_row_group_ctr(eax)]
mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY]
mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY]
mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY]
mov edi, JSAMPARRAY [output_buf(eax)]
mov esi, JSAMPROW [esi+ecx*SIZEOF_JSAMPROW] ; inptr0
mov ebx, JSAMPROW [ebx+ecx*SIZEOF_JSAMPROW] ; inptr1
mov edx, JSAMPROW [edx+ecx*SIZEOF_JSAMPROW] ; inptr2
mov edi, JSAMPROW [edi] ; outptr
pop ecx ; col
alignx 16,7
.columnloop:
movpic eax, POINTER [gotptr] ; load GOT address (eax)
movq mm6, MMWORD [ebx] ; mm6=Cb(01234567)
movq mm7, MMWORD [edx] ; mm7=Cr(01234567)
pxor mm1,mm1 ; mm1=(all 0's)
pcmpeqw mm3,mm3
psllw mm3,7 ; mm3={0xFF80 0xFF80 0xFF80 0xFF80}
movq mm4,mm6
punpckhbw mm6,mm1 ; mm6=Cb(4567)=CbH
punpcklbw mm4,mm1 ; mm4=Cb(0123)=CbL
movq mm0,mm7
punpckhbw mm7,mm1 ; mm7=Cr(4567)=CrH
punpcklbw mm0,mm1 ; mm0=Cr(0123)=CrL
paddw mm6,mm3
paddw mm4,mm3
paddw mm7,mm3
paddw mm0,mm3
; (Original)
; R = Y + 1.40200 * Cr
; G = Y - 0.34414 * Cb - 0.71414 * Cr
; B = Y + 1.77200 * Cb
;
; (This implementation)
; R = Y + 0.40200 * Cr + Cr
; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr
; B = Y - 0.22800 * Cb + Cb + Cb
movq mm5,mm6 ; mm5=CbH
movq mm2,mm4 ; mm2=CbL
paddw mm6,mm6 ; mm6=2*CbH
paddw mm4,mm4 ; mm4=2*CbL
movq mm1,mm7 ; mm1=CrH
movq mm3,mm0 ; mm3=CrL
paddw mm7,mm7 ; mm7=2*CrH
paddw mm0,mm0 ; mm0=2*CrL
pmulhw mm6,[GOTOFF(eax,PW_MF0228)] ; mm6=(2*CbH * -FIX(0.22800))
pmulhw mm4,[GOTOFF(eax,PW_MF0228)] ; mm4=(2*CbL * -FIX(0.22800))
pmulhw mm7,[GOTOFF(eax,PW_F0402)] ; mm7=(2*CrH * FIX(0.40200))
pmulhw mm0,[GOTOFF(eax,PW_F0402)] ; mm0=(2*CrL * FIX(0.40200))
paddw mm6,[GOTOFF(eax,PW_ONE)]
paddw mm4,[GOTOFF(eax,PW_ONE)]
psraw mm6,1 ; mm6=(CbH * -FIX(0.22800))
psraw mm4,1 ; mm4=(CbL * -FIX(0.22800))
paddw mm7,[GOTOFF(eax,PW_ONE)]
paddw mm0,[GOTOFF(eax,PW_ONE)]
psraw mm7,1 ; mm7=(CrH * FIX(0.40200))
psraw mm0,1 ; mm0=(CrL * FIX(0.40200))
paddw mm6,mm5
paddw mm4,mm2
paddw mm6,mm5 ; mm6=(CbH * FIX(1.77200))=(B-Y)H
paddw mm4,mm2 ; mm4=(CbL * FIX(1.77200))=(B-Y)L
paddw mm7,mm1 ; mm7=(CrH * FIX(1.40200))=(R-Y)H
paddw mm0,mm3 ; mm0=(CrL * FIX(1.40200))=(R-Y)L
movq MMWORD [wk(0)], mm6 ; wk(0)=(B-Y)H
movq MMWORD [wk(1)], mm7 ; wk(1)=(R-Y)H
movq mm6,mm5
movq mm7,mm2
punpcklwd mm5,mm1
punpckhwd mm6,mm1
pmaddwd mm5,[GOTOFF(eax,PW_MF0344_F0285)]
pmaddwd mm6,[GOTOFF(eax,PW_MF0344_F0285)]
punpcklwd mm2,mm3
punpckhwd mm7,mm3
pmaddwd mm2,[GOTOFF(eax,PW_MF0344_F0285)]
pmaddwd mm7,[GOTOFF(eax,PW_MF0344_F0285)]
paddd mm5,[GOTOFF(eax,PD_ONEHALF)]
paddd mm6,[GOTOFF(eax,PD_ONEHALF)]
psrad mm5,SCALEBITS
psrad mm6,SCALEBITS
paddd mm2,[GOTOFF(eax,PD_ONEHALF)]
paddd mm7,[GOTOFF(eax,PD_ONEHALF)]
psrad mm2,SCALEBITS
psrad mm7,SCALEBITS
packssdw mm5,mm6 ; mm5=CbH*-FIX(0.344)+CrH*FIX(0.285)
packssdw mm2,mm7 ; mm2=CbL*-FIX(0.344)+CrL*FIX(0.285)
psubw mm5,mm1 ; mm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H
psubw mm2,mm3 ; mm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L
movq MMWORD [wk(2)], mm5 ; wk(2)=(G-Y)H
mov al,2 ; Yctr
jmp short .Yloop_1st
alignx 16,7
.Yloop_2nd:
movq mm0, MMWORD [wk(1)] ; mm0=(R-Y)H
movq mm2, MMWORD [wk(2)] ; mm2=(G-Y)H
movq mm4, MMWORD [wk(0)] ; mm4=(B-Y)H
alignx 16,7
.Yloop_1st:
movq mm7, MMWORD [esi] ; mm7=Y(01234567)
pcmpeqw mm6,mm6
psrlw mm6,BYTE_BIT ; mm6={0xFF 0x00 0xFF 0x00 ..}
pand mm6,mm7 ; mm6=Y(0246)=YE
psrlw mm7,BYTE_BIT ; mm7=Y(1357)=YO
movq mm1,mm0 ; mm1=mm0=(R-Y)(L/H)
movq mm3,mm2 ; mm3=mm2=(G-Y)(L/H)
movq mm5,mm4 ; mm5=mm4=(B-Y)(L/H)
paddw mm0,mm6 ; mm0=((R-Y)+YE)=RE=(R0 R2 R4 R6)
paddw mm1,mm7 ; mm1=((R-Y)+YO)=RO=(R1 R3 R5 R7)
packuswb mm0,mm0 ; mm0=(R0 R2 R4 R6 ** ** ** **)
packuswb mm1,mm1 ; mm1=(R1 R3 R5 R7 ** ** ** **)
paddw mm2,mm6 ; mm2=((G-Y)+YE)=GE=(G0 G2 G4 G6)
paddw mm3,mm7 ; mm3=((G-Y)+YO)=GO=(G1 G3 G5 G7)
packuswb mm2,mm2 ; mm2=(G0 G2 G4 G6 ** ** ** **)
packuswb mm3,mm3 ; mm3=(G1 G3 G5 G7 ** ** ** **)
paddw mm4,mm6 ; mm4=((B-Y)+YE)=BE=(B0 B2 B4 B6)
paddw mm5,mm7 ; mm5=((B-Y)+YO)=BO=(B1 B3 B5 B7)
packuswb mm4,mm4 ; mm4=(B0 B2 B4 B6 ** ** ** **)
packuswb mm5,mm5 ; mm5=(B1 B3 B5 B7 ** ** ** **)
%if RGB_PIXELSIZE == 3 ; ---------------
; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **)
; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **)
; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **)
; mmG=(** ** ** ** ** ** ** **), mmH=(** ** ** ** ** ** ** **)
punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16)
punpcklbw mmE,mmB ; mmE=(20 01 22 03 24 05 26 07)
punpcklbw mmD,mmF ; mmD=(11 21 13 23 15 25 17 27)
movq mmG,mmA
movq mmH,mmA
punpcklwd mmA,mmE ; mmA=(00 10 20 01 02 12 22 03)
punpckhwd mmG,mmE ; mmG=(04 14 24 05 06 16 26 07)
psrlq mmH,2*BYTE_BIT ; mmH=(02 12 04 14 06 16 -- --)
psrlq mmE,2*BYTE_BIT ; mmE=(22 03 24 05 26 07 -- --)
movq mmC,mmD
movq mmB,mmD
punpcklwd mmD,mmH ; mmD=(11 21 02 12 13 23 04 14)
punpckhwd mmC,mmH ; mmC=(15 25 06 16 17 27 -- --)
psrlq mmB,2*BYTE_BIT ; mmB=(13 23 15 25 17 27 -- --)
movq mmF,mmE
punpcklwd mmE,mmB ; mmE=(22 03 13 23 24 05 15 25)
punpckhwd mmF,mmB ; mmF=(26 07 17 27 -- -- -- --)
punpckldq mmA,mmD ; mmA=(00 10 20 01 11 21 02 12)
punpckldq mmE,mmG ; mmE=(22 03 13 23 04 14 24 05)
punpckldq mmC,mmF ; mmC=(15 25 06 16 26 07 17 27)
cmp ecx, byte SIZEOF_MMWORD
jb short .column_st16
movq MMWORD [edi+0*SIZEOF_MMWORD], mmA
movq MMWORD [edi+1*SIZEOF_MMWORD], mmE
movq MMWORD [edi+2*SIZEOF_MMWORD], mmC
sub ecx, byte SIZEOF_MMWORD
jz near .endcolumn
add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr
add esi, byte SIZEOF_MMWORD ; inptr0
dec al ; Yctr
jnz near .Yloop_2nd
add ebx, byte SIZEOF_MMWORD ; inptr1
add edx, byte SIZEOF_MMWORD ; inptr2
jmp near .columnloop
alignx 16,7
.column_st16:
lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE
cmp ecx, byte 2*SIZEOF_MMWORD
jb short .column_st8
movq MMWORD [edi+0*SIZEOF_MMWORD], mmA
movq MMWORD [edi+1*SIZEOF_MMWORD], mmE
movq mmA,mmC
sub ecx, byte 2*SIZEOF_MMWORD
add edi, byte 2*SIZEOF_MMWORD
jmp short .column_st4
.column_st8:
cmp ecx, byte SIZEOF_MMWORD
jb short .column_st4
movq MMWORD [edi+0*SIZEOF_MMWORD], mmA
movq mmA,mmE
sub ecx, byte SIZEOF_MMWORD
add edi, byte SIZEOF_MMWORD
.column_st4:
movd eax,mmA
cmp ecx, byte SIZEOF_DWORD
jb short .column_st2
mov DWORD [edi+0*SIZEOF_DWORD], eax
psrlq mmA,DWORD_BIT
movd eax,mmA
sub ecx, byte SIZEOF_DWORD
add edi, byte SIZEOF_DWORD
.column_st2:
cmp ecx, byte SIZEOF_WORD
jb short .column_st1
mov WORD [edi+0*SIZEOF_WORD], ax
shr eax,WORD_BIT
sub ecx, byte SIZEOF_WORD
add edi, byte SIZEOF_WORD
.column_st1:
cmp ecx, byte SIZEOF_BYTE
jb short .endcolumn
mov BYTE [edi+0*SIZEOF_BYTE], al
%else ; RGB_PIXELSIZE == 4 ; -----------
%ifdef RGBX_FILLER_0XFF
pcmpeqb mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **)
pcmpeqb mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **)
%else
pxor mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **)
pxor mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **)
%endif
; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **)
; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **)
; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **)
; mmG=(30 32 34 36 ** ** ** **), mmH=(31 33 35 37 ** ** ** **)
punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16)
punpcklbw mmE,mmG ; mmE=(20 30 22 32 24 34 26 36)
punpcklbw mmB,mmD ; mmB=(01 11 03 13 05 15 07 17)
punpcklbw mmF,mmH ; mmF=(21 31 23 33 25 35 27 37)
movq mmC,mmA
punpcklwd mmA,mmE ; mmA=(00 10 20 30 02 12 22 32)
punpckhwd mmC,mmE ; mmC=(04 14 24 34 06 16 26 36)
movq mmG,mmB
punpcklwd mmB,mmF ; mmB=(01 11 21 31 03 13 23 33)
punpckhwd mmG,mmF ; mmG=(05 15 25 35 07 17 27 37)
movq mmD,mmA
punpckldq mmA,mmB ; mmA=(00 10 20 30 01 11 21 31)
punpckhdq mmD,mmB ; mmD=(02 12 22 32 03 13 23 33)
movq mmH,mmC
punpckldq mmC,mmG ; mmC=(04 14 24 34 05 15 25 35)
punpckhdq mmH,mmG ; mmH=(06 16 26 36 07 17 27 37)
cmp ecx, byte SIZEOF_MMWORD
jb short .column_st16
movq MMWORD [edi+0*SIZEOF_MMWORD], mmA
movq MMWORD [edi+1*SIZEOF_MMWORD], mmD
movq MMWORD [edi+2*SIZEOF_MMWORD], mmC
movq MMWORD [edi+3*SIZEOF_MMWORD], mmH
sub ecx, byte SIZEOF_MMWORD
jz short .endcolumn
add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr
add esi, byte SIZEOF_MMWORD ; inptr0
dec al ; Yctr
jnz near .Yloop_2nd
add ebx, byte SIZEOF_MMWORD ; inptr1
add edx, byte SIZEOF_MMWORD ; inptr2
jmp near .columnloop
alignx 16,7
.column_st16:
cmp ecx, byte SIZEOF_MMWORD/2
jb short .column_st8
movq MMWORD [edi+0*SIZEOF_MMWORD], mmA
movq MMWORD [edi+1*SIZEOF_MMWORD], mmD
movq mmA,mmC
movq mmD,mmH
sub ecx, byte SIZEOF_MMWORD/2
add edi, byte 2*SIZEOF_MMWORD
.column_st8:
cmp ecx, byte SIZEOF_MMWORD/4
jb short .column_st4
movq MMWORD [edi+0*SIZEOF_MMWORD], mmA
movq mmA,mmD
sub ecx, byte SIZEOF_MMWORD/4
add edi, byte 1*SIZEOF_MMWORD
.column_st4:
cmp ecx, byte SIZEOF_MMWORD/8
jb short .endcolumn
movd DWORD [edi+0*SIZEOF_DWORD], mmA
%endif ; RGB_PIXELSIZE ; ---------------
.endcolumn:
emms ; empty MMX state
.return:
pop edi
pop esi
; pop edx ; need not be preserved
; pop ecx ; need not be preserved
pop ebx
mov esp,ebp ; esp <- aligned ebp
pop esp ; esp <- original ebp
pop ebp
ret
; --------------------------------------------------------------------------
;
; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical.
;
; GLOBAL(void)
; jsimd_h2v2_merged_upsample_mmx (JDIMENSION output_width,
; JSAMPIMAGE input_buf,
; JDIMENSION in_row_group_ctr,
; JSAMPARRAY output_buf);
;
%define output_width(b) (b)+8 ; JDIMENSION output_width
%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf
%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr
%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf
align 32
global EXTN(jsimd_h2v2_merged_upsample_mmx)
EXTN(jsimd_h2v2_merged_upsample_mmx):
push ebp
mov ebp,esp
push ebx
; push ecx ; need not be preserved
; push edx ; need not be preserved
push esi
push edi
mov eax, JDIMENSION [output_width(ebp)]
mov edi, JSAMPIMAGE [input_buf(ebp)]
mov ecx, JDIMENSION [in_row_group_ctr(ebp)]
mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY]
mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY]
mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY]
mov edi, JSAMPARRAY [output_buf(ebp)]
lea esi, [esi+ecx*SIZEOF_JSAMPROW]
push edx ; inptr2
push ebx ; inptr1
push esi ; inptr00
mov ebx,esp
push edi ; output_buf (outptr0)
push ecx ; in_row_group_ctr
push ebx ; input_buf
push eax ; output_width
call near EXTN(jsimd_h2v1_merged_upsample_mmx)
add esi, byte SIZEOF_JSAMPROW ; inptr01
add edi, byte SIZEOF_JSAMPROW ; outptr1
mov POINTER [ebx+0*SIZEOF_POINTER], esi
mov POINTER [ebx-1*SIZEOF_POINTER], edi
call near EXTN(jsimd_h2v1_merged_upsample_mmx)
add esp, byte 7*SIZEOF_DWORD
pop edi
pop esi
; pop edx ; need not be preserved
; pop ecx ; need not be preserved
pop ebx
pop ebp
ret
; For some reason, the OS X linker does not honor the request to align the
; segment unless we do this.
align 32
|
tests/typing/bad/testfile-params-4.adb | xuedong/mini-ada | 0 | 14272 | with Ada.Text_IO; use Ada.Text_IO;
procedure Test is
function F(A: integer; A: character) return integer is begin return 0; end;
begin
New_Line;
end;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.