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
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_3_1575.asm
ljhsiun2/medusa
9
16860
<filename>Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_3_1575.asm .global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r9 push %rax push %rbp push %rdx push %rsi // Store lea addresses_RW+0x8d54, %r13 nop nop xor %rsi, %rsi mov $0x5152535455565758, %rdx movq %rdx, (%r13) and %r10, %r10 // Store lea addresses_D+0x19c54, %rax nop inc %r9 movl $0x51525354, (%rax) nop nop inc %rbp // Store lea addresses_RW+0x128b, %rsi and %r10, %r10 mov $0x5152535455565758, %r13 movq %r13, %xmm7 movups %xmm7, (%rsi) nop nop nop nop sub %rbp, %rbp // Store mov $0xbc0, %rsi nop nop nop dec %rax movw $0x5152, (%rsi) nop nop nop xor %rbp, %rbp // Store lea addresses_D+0x1dd54, %rbp nop inc %rdx movw $0x5152, (%rbp) nop nop nop nop nop xor $9975, %rsi // Store lea addresses_RW+0x15754, %rbp nop nop cmp $6079, %rax movw $0x5152, (%rbp) nop nop nop nop cmp $54886, %r10 // Faulty Load lea addresses_D+0x15554, %r13 clflush (%r13) nop nop nop nop nop add $44626, %rax mov (%r13), %r10d lea oracles, %rsi and $0xff, %r10 shlq $12, %r10 mov (%rsi,%r10,1), %r10 pop %rsi pop %rdx pop %rbp pop %rax pop %r9 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'36': 3} 36 36 36 */
data/pokemon/base_stats/kecleon.asm
TastySnax12/pokecrystal16-493-plus
2
243116
<gh_stars>1-10 db 0 ; species ID placeholder db 60, 90, 70, 40, 60, 120 ; hp atk def spd sat sdf db NORMAL, NORMAL ; type db 200 ; catch rate db 132 ; base exp db NO_ITEM, BITTER_BERRY ; items db GENDER_F50 ; gender ratio db 100 ; unknown 1 db 20 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/kecleon/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_MEDIUM_SLOW ; growth rate dn EGG_GROUND, EGG_GROUND ; egg groups ; tm/hm learnset tmhm DYNAMICPUNCH, HEADBUTT, CURSE, ROLLOUT, TOXIC, ZAP_CANNON, ROCK_SMASH, PSYCH_UP, HIDDEN_POWER, SUNNY_DAY, SNORE, BLIZZARD, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, SOLARBEAM, IRON_TAIL, THUNDER, RETURN, DIG, SHADOW_BALL, MUD_SLAP, DOUBLE_TEAM, ICE_PUNCH, SWAGGER, SLEEP_TALK, FIRE_BLAST, SWIFT, DEFENSE_CURL, THUNDERPUNCH, REST, ATTRACT, THIEF, FIRE_PUNCH, FURY_CUTTER, CUT, STRENGTH, FLASH, FLAMETHROWER, THUNDERBOLT, ICE_BEAM ; end
oeis/180/A180965.asm
neoneye/loda-programs
11
178445
; A180965: Number of tatami tilings of a 2 X n grid (with monomers allowed). ; Submitted by <NAME>(s4) ; 1,2,6,13,29,68,156,357,821,1886,4330,9945,22841,52456,120472,276681,635433,1459354,3351598,7697381,17678037,40599916,93242996,214144685,491811165,1129508406,2594063186,5957604017,13682413681,31423445328,72168035504,165743294353,380651065681,874214757042,2007748067286,4611054971581,10589888391565,24321058160660,55856478197196,128281678205941,294615584341637,676623066917006,1553953012048698,3568855514574729,8196341578641833,18823966114464056,43231690246028872,99287208134766681,228026006919819641 mov $1,1 lpb $0 sub $0,1 add $2,$1 sub $4,$3 add $3,1 add $1,$3 add $4,$2 add $3,$4 add $3,$4 lpe mov $0,$1
programs/oeis/007/A007798.asm
neoneye/loda
22
18457
; A007798: Expected number of random moves in Tower of Hanoi problem with n disks starting with a randomly chosen position and ending at a position with all disks on the same peg. ; 0,0,2,18,116,660,3542,18438,94376,478440,2411882,12118458,60769436,304378620,1523487422,7622220078,38125449296,190670293200,953480606162,4767790451298,23840114517956,119204059374180,596030757224102,2980185167180118,14901019979079416,74505382324933560,372527758913277242,1862641336432214538,9313214307758557676,46566094415585243340,232830540708303581582,1164152909432650002558,5820765164836646296736,29103827677203420335520,145519143945077668233122,727595736402570040832178,3637978732044395303160596,18189893810316611812802100,90949469501866964955007862,454747348860186542448031398,2273736748353487865259133256,11368683753925104785352595080,56843418806098520303933761802,284217094139911590651181168218,1421085471027814920650442918716,7105427356123845505435825826460,35527136783573540233729962830942,177635683926730639288302315250638,888178419660242010800469079540976,4440892098380976497079217907568240,22204460492144181814626707067431282,111022302461438807060825387925926658,555111512309347729267202497395944036 mov $1,5 pow $1,$0 mov $2,3 pow $2,$0 sub $1,$2 sub $1,$2 sub $1,7 div $1,8 add $1,1 mul $1,2 mov $0,$1
asm/_debug.asm
RockmanEXEZone/MMBN45-English-Translation
6
11798
<filename>asm/_debug.asm // Always enables Select=BattleSkip //.org 0x0800825C // nop // Hold Select to expire mission timer .org 0x8006A04 bl debug_expireMissionTimer // Battle target cheats .org 0x08020114 ldr r1,=debug_battleTargetCheats|1b bx r1 .pool // Higher default text speed .org 0x0804FB82 mov r0,1h // Walking = 2.5x normal walk speed .org 0x0806C028 .dw 0x00028000,0xFFFD8000 .org 0x0806C034 .dw 0x00028000,0x00000000 .org 0x0806C040 .dw 0x00014000,0x00014000 .org 0x0806C04C .dw 0x00000000,0x00028000 .org 0x0806C058 .dw 0xFFFD8000,0x00028000 .org 0x0806C064 .dw 0xFFFD8000,0x00000000 .org 0x0806C070 .dw 0xFFFEC000,0xFFFEC000 .org 0x0806C07C .dw 0x00000000,0xFFFD8000 // Running = 5x normal walk speed .org 0x0806C0E8 .dw 0x00050000,0xFFFB0000 .org 0x0806C0F4 .dw 0x00050000,0x00000000 .org 0x0806C100 .dw 0x00028000,0x00028000 .org 0x0806C10C .dw 0x00000000,0x00050000 .org 0x0806C118 .dw 0xFFFB0000,0x00050000 .org 0x0806C124 .dw 0xFFFB0000,0x00000000 .org 0x0806C130 .dw 0xFFFD8000,0xFFFD8000 .org 0x0806C13C .dw 0x00000000,0xFFFB0000 // Encounter rate x1 when walking, x2 when running .org 0x0806C78C mov r3,1h .org 0x0806C794 mov r3,2h .org 0x0806C8D6 mov r0,2h // Hook for debug menu .org 0x0802DA88 ldr r0,=debug_debugMenuTrigger|1b bx r0 .pool // Fix Heart/Star data location check if nonexistent .org 0x080508D4 .dw debug_heartDataNoneCheck|1b .dw debug_starDataNoneCheck|1b
third_party/heif_decoder/src/main/cpp/libx265/common/x86/cpu-a.asm
vy12021/glide_webp
14
90411
;***************************************************************************** ;* cpu-a.asm: x86 cpu utilities ;***************************************************************************** ;* Copyright (C) 2003-2013 x264 project ;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: <NAME> <<EMAIL>> ;* <NAME> <<EMAIL>> ;* <NAME> <<EMAIL>> ;* ;* This program is free software; you can redistribute it and/or modify ;* it under the terms of the GNU General Public License as published by ;* the Free Software Foundation; either version 2 of the License, or ;* (at your option) any later version. ;* ;* This program is distributed in the hope that it will be useful, ;* but WITHOUT ANY WARRANTY; without even the implied warranty of ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;* GNU General Public License for more details. ;* ;* You should have received a copy of the GNU General Public License ;* along with this program; if not, write to the Free Software ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. ;* ;* This program is also available under a commercial proprietary license. ;* For more information, contact us at license @ x265.com. ;***************************************************************************** %include "x86inc.asm" SECTION .text ;----------------------------------------------------------------------------- ; void cpu_cpuid( int op, int *eax, int *ebx, int *ecx, int *edx ) ;----------------------------------------------------------------------------- cglobal cpu_cpuid, 5,7 push rbx push r4 push r3 push r2 push r1 mov eax, r0d xor ecx, ecx cpuid pop r4 mov [r4], eax pop r4 mov [r4], ebx pop r4 mov [r4], ecx pop r4 mov [r4], edx pop rbx RET ;----------------------------------------------------------------------------- ; uint64_t cpu_xgetbv( int xcr ) ;----------------------------------------------------------------------------- cglobal cpu_xgetbv movifnidn ecx, r0m xgetbv %if ARCH_X86_64 shl rdx, 32 or rax, rdx %endif ret %if ARCH_X86_64 ;----------------------------------------------------------------------------- ; void stack_align( void (*func)(void*), void *arg ); ;----------------------------------------------------------------------------- cglobal stack_align push rbp mov rbp, rsp %if WIN64 sub rsp, 32 ; shadow space %endif and rsp, ~(STACK_ALIGNMENT - 1) mov rax, r0 mov r0, r1 mov r1, r2 mov r2, r3 call rax leave ret %else ;----------------------------------------------------------------------------- ; int cpu_cpuid_test( void ) ; return 0 if unsupported ;----------------------------------------------------------------------------- cglobal cpu_cpuid_test pushfd push ebx push ebp push esi push edi pushfd pop eax mov ebx, eax xor eax, 0x200000 push eax popfd pushfd pop eax xor eax, ebx pop edi pop esi pop ebp pop ebx popfd ret cglobal stack_align push ebp mov ebp, esp sub esp, 12 and esp, ~(STACK_ALIGNMENT - 1) mov ecx, [ebp+8] mov edx, [ebp+12] mov [esp], edx mov edx, [ebp+16] mov [esp+4], edx mov edx, [ebp+20] mov [esp+8], edx call ecx leave ret %endif ;----------------------------------------------------------------------------- ; void cpu_emms( void ) ;----------------------------------------------------------------------------- cglobal cpu_emms emms ret ;----------------------------------------------------------------------------- ; void cpu_sfence( void ) ;----------------------------------------------------------------------------- cglobal cpu_sfence sfence ret cextern intel_cpu_indicator_init ;----------------------------------------------------------------------------- ; void safe_intel_cpu_indicator_init( void ); ;----------------------------------------------------------------------------- cglobal safe_intel_cpu_indicator_init push r0 push r1 push r2 push r3 push r4 push r5 push r6 %if ARCH_X86_64 push r7 push r8 push r9 push r10 push r11 push r12 push r13 push r14 %endif push rbp mov rbp, rsp %if WIN64 sub rsp, 32 ; shadow space %endif and rsp, ~31 call intel_cpu_indicator_init leave %if ARCH_X86_64 pop r14 pop r13 pop r12 pop r11 pop r10 pop r9 pop r8 pop r7 %endif pop r6 pop r5 pop r4 pop r3 pop r2 pop r1 pop r0 ret
code/OrderLemmas.agda
DSLsofMath/ValiantAgda
3
7173
<filename>code/OrderLemmas.agda import Relation.Binary.EqReasoning as EqReasoning open import SemiNearRingRecords module OrderLemmas (snro : SemiNearRing) where open SemiNearRing snro -- public open import CommAssocLemmas s _≃s_ _+s_ zers isCommMon using (assoc; comm) renaming (SA to Ss) open EqReasoning Ss monoPlusLeft : ∀ {a} {b} {c} → a ≤s b → (a +s c) ≤s (b +s c) monoPlusLeft {a} {b} {c} a≤b = begin (a +s c) +s (b +s c) ≈⟨ assoc _ _ _ ⟩ a +s (c +s (b +s c)) ≈⟨ refls <+> comm _ _ ⟩ a +s ((b +s c) +s c) ≈⟨ refls <+> assoc _ _ _ ⟩ a +s (b +s (c +s c)) ≈⟨ sym (assoc _ _ _) ⟩ (a +s b) +s (c +s c) ≈⟨ a≤b <+> idem _ ⟩ b +s c ∎ monoTimesLeft : ∀ {a} {b} {c} → a ≤s b → (a *s c) ≤s (b *s c) monoTimesLeft {a} {b} {c} a≤b = begin (a *s c) +s (b *s c) ≈⟨ sym (distr _ _ _) ⟩ (a +s b) *s c ≈⟨ a≤b <*> refls ⟩ -- a≤=b means a+b==b b *s c ∎ infixl 6 _[+]_ infixl 7 _[*]_ _[+]_ : ∀ {a} {a'} {b} {b'} -> a ≤s a' -> b ≤s b' -> (a +s b) ≤s (a' +s b') _[+]_ {a} {a'} {b} {b'} pa pb = begin (a +s b) +s (a' +s b') ≈⟨ assoc _ _ _ ⟩ a +s (b +s (a' +s b')) ≈⟨ refls <+> comm _ _ ⟩ a +s ((a' +s b') +s b) ≈⟨ refls <+> assoc _ _ _ ⟩ a +s (a' +s (b' +s b)) ≈⟨ sym (assoc _ _ _) ⟩ (a +s a') +s (b' +s b) ≈⟨ pa <+> comm _ _ ⟩ a' +s (b +s b') ≈⟨ refls <+> pb ⟩ a' +s b' ∎ _[*]_ : ∀ {a} {a'} {b} {b'} -> a ≤s a' -> b ≤s b' -> (a *s b) ≤s (a' *s b') _[*]_ {a} {a'} {b} {b'} pa pb = begin (a *s b) +s (a' *s b') ≈⟨ refls <+> (sym pa <*> refls) ⟩ a *s b +s (a +s a') *s b' ≈⟨ refls <+> distr _ _ _ ⟩ a *s b +s (a *s b' +s a' *s b') ≈⟨ sym (assoc _ _ _) ⟩ (a *s b +s a *s b') +s a' *s b' ≈⟨ sym (distl _ _ _) <+> (refls <*> sym pb) ⟩ a *s (b +s b') +s a' *s (b +s b') ≈⟨ sym (distr _ _ _) ⟩ (a +s a') *s (b +s b') ≈⟨ pa <*> pb ⟩ a' *s b' ∎ ≤s-trans : ∀ {a b c} → a ≤s b → b ≤s c → a ≤s c ≤s-trans {a} {b} {c} p q = begin a +s c ≈⟨ refls <+> sym q ⟩ a +s (b +s c) ≈⟨ sym (assoc _ _ _) ⟩ (a +s b) +s c ≈⟨ p <+> refls ⟩ b +s c ≈⟨ q ⟩ c ∎ ≃sTo≤s : ∀ {a b} → a ≃s b → a ≤s b ≃sTo≤s {a} {b} a=b = begin a +s b ≈⟨ a=b <+> refls ⟩ b +s b ≈⟨ idem _ ⟩ b ∎
xmt_edit/proto/hdr/hdr.asm
fractalic/XMT
1
167709
{ #************************************************************************ # $Version:$ # Package : xmt_edit # Synopsis : # Purpose : Perl block which, when eval'ed, prints the desired # file header for assembler files. # # Copyright (c) 1998 Neumann & Associates Information Systems Inc. # <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. #************************************************************************ $copyright =~ s/\n*$//; $copyright =~ s/\n/\n* /g; print qq{************************************************************************ * Package : $module->{pkg} * $cm->{rev} * $copyright * * Purpose : ************************************************************************ * * These 2 lines must be at the start of the program code * FCC "$module->{pkg}::${filename} $cm->{id}" FCB 0 }; }
Function/Surjective/Properties.agda
oisdk/agda-playground
6
17253
<filename>Function/Surjective/Properties.agda {-# OPTIONS --cubical --safe --postfix-projections #-} module Function.Surjective.Properties where open import Path open import Function.Fiber open import Level open import HITs.PropositionalTruncation open import Data.Sigma open import Function.Surjective.Base open import Function.Injective.Base open import Function.Injective.Properties open import Path.Reasoning open import Relation.Nullary.Discrete open import Function surj-to-inj : (A ↠! B) → (B ↣ A) surj-to-inj (f , surj) .fst x = surj x .fst surj-to-inj (f , surj) .snd x y f⁻¹⟨x⟩≡f⁻¹⟨y⟩ = x ≡˘⟨ surj x .snd ⟩ f (surj x .fst) ≡⟨ cong f f⁻¹⟨x⟩≡f⁻¹⟨y⟩ ⟩ f (surj y .fst) ≡⟨ surj y .snd ⟩ y ∎ Discrete-distrib-surj : (A ↠! B) → Discrete A → Discrete B Discrete-distrib-surj = Discrete-pull-inj ∘ surj-to-inj SplitSurjective⟨id⟩ : SplitSurjective (id {A = A}) SplitSurjective⟨id⟩ x .fst = x SplitSurjective⟨id⟩ x .snd _ = x ↠!-ident : A ↠! A ↠!-ident .fst = id ↠!-ident .snd y .fst = y ↠!-ident .snd y .snd _ = y ↠!-comp : A ↠! B → B ↠! C → A ↠! C ↠!-comp a→b b→c .fst = b→c .fst ∘ a→b .fst ↠!-comp a→b b→c .snd y .fst = a→b .snd (b→c .snd y .fst) .fst ↠!-comp a→b b→c .snd y .snd = cong (fst b→c) (snd (snd a→b (fst (snd b→c y)))) ; snd (snd b→c y)
shared/libso.asm
akruman/low-level-programming-c
0
82614
<reponame>akruman/low-level-programming-c extern _GLOBAL_OFFSET_TABLE_ global func:function section .rodata message: db "Shared object wrote this", 10, 0 section .text func: mov rax, 1 mov rdi, 1 mov rsi, message mov rdx, 14 syscall ret
.build/ada/asis-gela-elements-defs-accs.adb
faelys/gela-asis
4
26054
<reponame>faelys/gela-asis ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the Maxim Reznik, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------ package body Asis.Gela.Elements.Defs.Accs is function Anonymous_Access_To_Object_Subtype_Mark (Element : Anonymous_Access_To_Variable_Node) return Asis.Name is begin return Element.Anonymous_Access_To_Object_Subtype_Mark; end Anonymous_Access_To_Object_Subtype_Mark; procedure Set_Anonymous_Access_To_Object_Subtype_Mark (Element : in out Anonymous_Access_To_Variable_Node; Value : in Asis.Name) is begin Element.Anonymous_Access_To_Object_Subtype_Mark := Value; end Set_Anonymous_Access_To_Object_Subtype_Mark; function New_Anonymous_Access_To_Variable_Node (The_Context : ASIS.Context) return Anonymous_Access_To_Variable_Ptr is Result : Anonymous_Access_To_Variable_Ptr := new Anonymous_Access_To_Variable_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Anonymous_Access_To_Variable_Node; function Access_Definition_Kind (Element : Anonymous_Access_To_Variable_Node) return Asis.Access_Definition_Kinds is begin return An_Anonymous_Access_To_Variable; end; function Children (Element : access Anonymous_Access_To_Variable_Node) return Traverse_List is begin return (1 => (False, Element.Anonymous_Access_To_Object_Subtype_Mark'Access)); end Children; function Clone (Element : Anonymous_Access_To_Variable_Node; Parent : Asis.Element) return Asis.Element is Result : constant Anonymous_Access_To_Variable_Ptr := new Anonymous_Access_To_Variable_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Has_Null_Exclusion := Element.Has_Null_Exclusion; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Anonymous_Access_To_Variable_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Target.Anonymous_Access_To_Object_Subtype_Mark := Copy (Cloner, Anonymous_Access_To_Object_Subtype_Mark (Source.all), Asis.Element (Target)); end Copy; function New_Anonymous_Access_To_Constant_Node (The_Context : ASIS.Context) return Anonymous_Access_To_Constant_Ptr is Result : Anonymous_Access_To_Constant_Ptr := new Anonymous_Access_To_Constant_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Anonymous_Access_To_Constant_Node; function Access_Definition_Kind (Element : Anonymous_Access_To_Constant_Node) return Asis.Access_Definition_Kinds is begin return An_Anonymous_Access_To_Constant; end; function Clone (Element : Anonymous_Access_To_Constant_Node; Parent : Asis.Element) return Asis.Element is Result : constant Anonymous_Access_To_Constant_Ptr := new Anonymous_Access_To_Constant_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Has_Null_Exclusion := Element.Has_Null_Exclusion; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Anonymous_Access_To_Constant_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Target.Anonymous_Access_To_Object_Subtype_Mark := Copy (Cloner, Anonymous_Access_To_Object_Subtype_Mark (Source.all), Asis.Element (Target)); end Copy; function Access_To_Subprogram_Parameter_Profile (Element : Anonymous_Access_To_Procedure_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Parameter_Lists.To_Element_List (Element.Access_To_Subprogram_Parameter_Profile, Include_Pragmas); end Access_To_Subprogram_Parameter_Profile; procedure Set_Access_To_Subprogram_Parameter_Profile (Element : in out Anonymous_Access_To_Procedure_Node; Value : in Asis.Element) is begin Element.Access_To_Subprogram_Parameter_Profile := Primary_Parameter_Lists.List (Value); end Set_Access_To_Subprogram_Parameter_Profile; function Access_To_Subprogram_Parameter_Profile_List (Element : Anonymous_Access_To_Procedure_Node) return Asis.Element is begin return Asis.Element (Element.Access_To_Subprogram_Parameter_Profile); end Access_To_Subprogram_Parameter_Profile_List; function New_Anonymous_Access_To_Procedure_Node (The_Context : ASIS.Context) return Anonymous_Access_To_Procedure_Ptr is Result : Anonymous_Access_To_Procedure_Ptr := new Anonymous_Access_To_Procedure_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Anonymous_Access_To_Procedure_Node; function Access_Definition_Kind (Element : Anonymous_Access_To_Procedure_Node) return Asis.Access_Definition_Kinds is begin return An_Anonymous_Access_To_Procedure; end; function Children (Element : access Anonymous_Access_To_Procedure_Node) return Traverse_List is begin return (1 => (True, Asis.Element (Element.Access_To_Subprogram_Parameter_Profile))); end Children; function Clone (Element : Anonymous_Access_To_Procedure_Node; Parent : Asis.Element) return Asis.Element is Result : constant Anonymous_Access_To_Procedure_Ptr := new Anonymous_Access_To_Procedure_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Has_Null_Exclusion := Element.Has_Null_Exclusion; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Anonymous_Access_To_Procedure_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Set_Access_To_Subprogram_Parameter_Profile (Target.all, Primary_Parameter_Lists.Deep_Copy (Access_To_Subprogram_Parameter_Profile (Source.all), Cloner, Asis.Element (Target))); end Copy; function New_Anonymous_Access_To_Protected_Procedure_Node (The_Context : ASIS.Context) return Anonymous_Access_To_Protected_Procedure_Ptr is Result : Anonymous_Access_To_Protected_Procedure_Ptr := new Anonymous_Access_To_Protected_Procedure_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Anonymous_Access_To_Protected_Procedure_Node; function Access_Definition_Kind (Element : Anonymous_Access_To_Protected_Procedure_Node) return Asis.Access_Definition_Kinds is begin return An_Anonymous_Access_To_Protected_Procedure; end; function Clone (Element : Anonymous_Access_To_Protected_Procedure_Node; Parent : Asis.Element) return Asis.Element is Result : constant Anonymous_Access_To_Protected_Procedure_Ptr := new Anonymous_Access_To_Protected_Procedure_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Has_Null_Exclusion := Element.Has_Null_Exclusion; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Anonymous_Access_To_Protected_Procedure_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Set_Access_To_Subprogram_Parameter_Profile (Target.all, Primary_Parameter_Lists.Deep_Copy (Access_To_Subprogram_Parameter_Profile (Source.all), Cloner, Asis.Element (Target))); end Copy; function Access_To_Function_Result_Subtype (Element : Anonymous_Access_To_Function_Node) return Asis.Definition is begin return Element.Access_To_Function_Result_Subtype; end Access_To_Function_Result_Subtype; procedure Set_Access_To_Function_Result_Subtype (Element : in out Anonymous_Access_To_Function_Node; Value : in Asis.Definition) is begin Element.Access_To_Function_Result_Subtype := Value; end Set_Access_To_Function_Result_Subtype; function New_Anonymous_Access_To_Function_Node (The_Context : ASIS.Context) return Anonymous_Access_To_Function_Ptr is Result : Anonymous_Access_To_Function_Ptr := new Anonymous_Access_To_Function_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Anonymous_Access_To_Function_Node; function Access_Definition_Kind (Element : Anonymous_Access_To_Function_Node) return Asis.Access_Definition_Kinds is begin return An_Anonymous_Access_To_Function; end; function Children (Element : access Anonymous_Access_To_Function_Node) return Traverse_List is begin return ((True, Asis.Element (Element.Access_To_Subprogram_Parameter_Profile)), (False, Element.Access_To_Function_Result_Subtype'Access)); end Children; function Clone (Element : Anonymous_Access_To_Function_Node; Parent : Asis.Element) return Asis.Element is Result : constant Anonymous_Access_To_Function_Ptr := new Anonymous_Access_To_Function_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Has_Null_Exclusion := Element.Has_Null_Exclusion; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Anonymous_Access_To_Function_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Set_Access_To_Subprogram_Parameter_Profile (Target.all, Primary_Parameter_Lists.Deep_Copy (Access_To_Subprogram_Parameter_Profile (Source.all), Cloner, Asis.Element (Target))); Target.Access_To_Function_Result_Subtype := Copy (Cloner, Access_To_Function_Result_Subtype (Source.all), Asis.Element (Target)); end Copy; function New_Anonymous_Access_To_Protected_Function_Node (The_Context : ASIS.Context) return Anonymous_Access_To_Protected_Function_Ptr is Result : Anonymous_Access_To_Protected_Function_Ptr := new Anonymous_Access_To_Protected_Function_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Anonymous_Access_To_Protected_Function_Node; function Access_Definition_Kind (Element : Anonymous_Access_To_Protected_Function_Node) return Asis.Access_Definition_Kinds is begin return An_Anonymous_Access_To_Protected_Function; end; function Clone (Element : Anonymous_Access_To_Protected_Function_Node; Parent : Asis.Element) return Asis.Element is Result : constant Anonymous_Access_To_Protected_Function_Ptr := new Anonymous_Access_To_Protected_Function_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Has_Null_Exclusion := Element.Has_Null_Exclusion; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Anonymous_Access_To_Protected_Function_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Set_Access_To_Subprogram_Parameter_Profile (Target.all, Primary_Parameter_Lists.Deep_Copy (Access_To_Subprogram_Parameter_Profile (Source.all), Cloner, Asis.Element (Target))); Target.Access_To_Function_Result_Subtype := Copy (Cloner, Access_To_Function_Result_Subtype (Source.all), Asis.Element (Target)); end Copy; end Asis.Gela.Elements.Defs.Accs;
src/IsblCheck.Core/Parser/Isbl.g4
arhipovdv/IsblCheck
13
4759
grammar Isbl; @parser::header {#pragma warning disable 3021} @lexer::header {#pragma warning disable 3021} /******************************************************************************* *********************************Правила лексера******************************** *******************************************************************************/ // Английские регистронезависимые символы. fragment A:('a'|'A'); fragment B:('b'|'B'); fragment C:('c'|'C'); fragment D:('d'|'D'); fragment E:('e'|'E'); fragment F:('f'|'F'); fragment G:('g'|'G'); fragment H:('h'|'H'); fragment I:('i'|'I'); fragment J:('j'|'J'); fragment K:('k'|'K'); fragment L:('l'|'L'); fragment M:('m'|'M'); fragment N:('n'|'N'); fragment O:('o'|'O'); fragment P:('p'|'P'); fragment Q:('q'|'Q'); fragment R:('r'|'R'); fragment S:('s'|'S'); fragment T:('t'|'T'); fragment U:('u'|'U'); fragment V:('v'|'V'); fragment W:('w'|'W'); fragment X:('x'|'X'); fragment Y:('y'|'Y'); fragment Z:('z'|'Z'); // Русские регистронезависимые символы. fragment А:('а'|'А'); fragment Б:('б'|'Б'); fragment В:('в'|'В'); fragment Г:('г'|'Г'); fragment Д:('д'|'Д'); fragment Е:('е'|'Е'); fragment Ё:('ё'|'Ё'); fragment Ж:('ж'|'Ж'); fragment З:('з'|'З'); fragment И:('и'|'И'); fragment Й:('й'|'Й'); fragment К:('к'|'К'); fragment Л:('л'|'Л'); fragment М:('м'|'М'); fragment Н:('н'|'Н'); fragment О:('о'|'О'); fragment П:('п'|'П'); fragment Р:('р'|'Р'); fragment С:('с'|'С'); fragment Т:('т'|'Т'); fragment У:('у'|'У'); fragment Ф:('ф'|'Ф'); fragment Х:('х'|'Х'); fragment Ц:('ц'|'Ц'); fragment Ч:('ч'|'Ч'); fragment Ш:('ш'|'Ш'); fragment Щ:('щ'|'Щ'); fragment Ъ:('ъ'|'Ъ'); fragment Ы:('ы'|'Ы'); fragment Ь:('ь'|'Ь'); fragment Э:('э'|'Э'); fragment Ю:('ю'|'Ю'); fragment Я:('я'|'Я'); // Разделитель. WS: [ \t\r\n]+->skip; // Комментарии. BLOCK_COMMENT: '/*' .*? '*/'->skip; LINE_COMMENT: '//' ~[\r\n]*->skip; // Ключевые слова. AND: A N D | И; ELSE: E L S E | И Н А Ч Е; ENDEXCEPT: E N D E X C E P T; ENDFINALLY: E N D F I N A L L Y; ENDFOREACH: E N D F O R E A C H | К О Н Е Ц В С Е; ENDIF: E N D I F | К О Н Е Ц Е С Л И; ENDWHILE: E N D W H I L E | К О Н Е Ц П О К А; EXCEPT: E X C E P T; EXITFOR: E X I T F O R; FINALLY: F I N A L L Y; FOREACH: F O R E A C H | В С Е; IF: I F | Е С Л И; IN: I N | В; NOT: N O T | Н Е; OR: O R | И Л И; TRY: T R Y; WHILE: W H I L E | П О К А; // Операторы. EQ: '='; NEQ: '<>'; GT: '>'; GEQ: '>='; LT: '<'; LEQ: '<='; STR_EQ: '=='; STR_NEQ: '<<>>'; STR_GT: '>>'; STR_GEQ: '>>='; STR_LT: '<<'; STR_LEQ: '<<='; PLUS: '+'; MINUS: '-'; MUL: '*'; DIV: '/'; POINTER:'^'; CONCAT: '&'; L_PAREN: '('; R_PAREN: ')'; L_BRACKET: '['; R_BRACKET: ']'; COLON : ':'; COMMA: ';'; DOT: '.'; // Литералы. STRINGLITERAL: '"' ~["]* '"' | '\'' ~[\']* '\''; NUMBERLITERAL: [0-9]+ ([.] [0-9]+ )?; IDENTLITERAL : ('a'..'z' | 'A'..'Z' | 'а'..'я' | 'ё' | 'А'..'Я' | 'Ё' | '!') ('a'..'z' | 'A'..'Z' | 'а'..'я' | 'ё' | 'А'..'Я' | 'Ё' | '0'..'9'| '_')*; /******************************************************************************* *********************************Правила парсера******************************** *******************************************************************************/ // Блок предложений. statementBlock : ( declareVariableStatement | assignStatement | invokeStatement | ifStatement | foreachStatement | whileStatement | tryStatement | exitforStatement )* ; // Объявление переменной. declareVariableStatement : variable COLON typedefinition ; // Означивание. assignStatement : ( variable COLON typedefinition | variable indexer? (DOT invocationCall)* | function (DOT invocationCall)+ ) EQ expression ; // Вызов метода. invokeStatement : variable indexer? (DOT invocationCall)+ | function (DOT invocationCall)* ; // Условие. ifStatement : IF expression statementBlock (ELSE statementBlock)? ENDIF ; // Совместный цикл. foreachStatement : FOREACH variable (IN | EQ) expression statementBlock ENDFOREACH ; // Цикл с предусловием. whileStatement : WHILE expression statementBlock ENDWHILE ; // Обработка исключений. tryStatement : TRY statementBlock ( EXCEPT statementBlock ENDEXCEPT | FINALLY statementBlock ENDFINALLY ) ; // Выход из цикла. exitforStatement : EXITFOR ; // Выражение. expression : operand | (PLUS | MINUS) expression | NOT expression | expression (MUL | DIV) expression | expression (PLUS | MINUS | CONCAT) expression | expression (EQ | NEQ | GT | GEQ | LT | LEQ | STR_EQ | STR_NEQ | STR_GT | STR_GEQ | STR_LT | STR_LEQ) expression | expression AND expression | expression OR expression ; // Операнд. operand : unsignedNumber | string | variable indexer? (DOT invocationCall)* | variable POINTER | function (DOT invocationCall)* | L_PAREN expression R_PAREN; // Функция. function : identifier L_PAREN parameterList R_PAREN ; // COM вызов. invocationCall : identifier (L_PAREN parameterList R_PAREN)? ; // Индексатор. indexer : L_BRACKET parameterList R_BRACKET ; // Типизатор. typedefinition : type (DOT subtype)? ; // Список параметров. parameterList : expression? (COMMA expression?)* ; // Идентификатор. Есть функция IN, включаем её, для учета. identifier : IDENTLITERAL | IN ; // Переменная. variable : IDENTLITERAL ; // Тип. type : IDENTLITERAL ; // Суб-тип. subtype : IDENTLITERAL ; // Безнаковое число. unsignedNumber : NUMBERLITERAL ; // Строка. string : STRINGLITERAL ;
source/calendar/machine-w64-mingw32/s-nareti.ads
ytomino/drake
33
8730
<reponame>ytomino/drake pragma License (Unrestricted); -- implementation unit specialized for Windows with C.winnt; package System.Native_Real_Time is subtype Native_Time is C.winnt.LONGLONG; function To_Native_Time (T : Duration) return Native_Time; function To_Duration (T : Native_Time) return Duration; pragma Pure_Function (To_Native_Time); pragma Pure_Function (To_Duration); pragma Inline (To_Native_Time); pragma Inline (To_Duration); function Clock return Native_Time; -- same as Ada.Real_Time subtype Time is Duration; Tick : constant := 1.0 / 1_000_000_000; -- QueryPerformanceCounter returns nano-seconds. -- for delay until procedure Delay_Until (T : Native_Time); -- no hook for Windows end System.Native_Real_Time;
test/Succeed/Issue87.agda
cruhland/agda
1,989
7187
module Issue87 where data I : Set where data D : I -> Set where d : forall {i} (x : D i) -> D i bar : forall {i} -> D i -> D i -> D i bar (d x) (d y) with y bar (d x) (d {i} y) | z = d {i} y -- ERROR WAS: -- Panic: unbound variable i -- when checking that the expression i has type I -- Andreas, 2016-06-02 -- This looks weird, but is accepted currently: test : ∀ i → D i → D i → D i test .i (d {i} x) (d {.i} y) with y test .i (d {j} x) (d {i} y) | _ = d {i} y -- Note the {j}!
src/test/ref/struct-ptr-11.asm
jbrandwood/kickc
2
103288
// Minimal struct - array of 3-byte structs (required *3) // Commodore 64 PRG executable file .file [name="struct-ptr-11.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(main) .const SIZEOF_STRUCT_POINT = 3 .const OFFSET_STRUCT_POINT_Y = 1 .const OFFSET_STRUCT_POINT_Z = 2 .segment Code main: { .label SCREEN = $400 .label __0 = 3 .label i1 = 2 ldx #0 __b1: // -(signed byte)i txa eor #$ff clc adc #1 sta.z __0 // points[i] = { (signed byte)i, -(signed byte)i, (signed byte)i } txa asl stx.z $ff clc adc.z $ff tay txa sta points,y lda.z __0 sta points+OFFSET_STRUCT_POINT_Y,y txa sta points+OFFSET_STRUCT_POINT_Z,y // for( byte i: 0..3) inx cpx #4 bne __b1 lda #0 sta.z i1 __b2: // SCREEN[i] = points[i] lda.z i1 asl clc adc.z i1 ldx #SIZEOF_STRUCT_POINT tay !: lda points,y sta SCREEN,y iny dex bne !- // for( byte i: 0..3) inc.z i1 lda #4 cmp.z i1 bne __b2 // } rts } .segment Data points: .fill 3*4, 0
src/intel/tools/tests/gen6/rnde.asm
SoftReaper/Mesa-Renoir-deb
0
162405
rnde(8) g6<1>F g3<8,8,1>F { align1 1Q }; rnde(16) g8<1>F g4<8,8,1>F { align1 1H };
oeis/279/A279543.asm
neoneye/loda-programs
11
25978
; A279543: a(n) = a(n-1) + 3^n * a(n-2) with a(0) = 1 and a(1) = 1. ; Submitted by <NAME> ; 1,1,10,37,847,9838,627301,22143007,4137864868,439978671649,244776761262181,78185678507867584,130162592460442600405,124783388108159412726037,622688428086038843429228482,1791127919536971393223950620041,26806486161667815059653905660527563,231333357969017038062337732481706334246,10385613310483046983010742639493938161772553,268880233612416366253310501146281048642110071435,36212663366043870411678222761314176397575794420417188,2812618425554393841177849288241797452878092462208081473493 mov $2,1 mov $3,1 lpb $0 sub $0,1 mov $1,$3 mul $2,3 mul $4,$2 add $3,$4 mov $4,$1 lpe mov $0,$3
puzzle_21/src/puzzle_21.adb
AdaForge/Advent_of_Code_2020
0
15203
procedure Puzzle_21 is begin null; end Puzzle_21;
oeis/145/A145382.asm
neoneye/loda-programs
11
176720
<reponame>neoneye/loda-programs ; A145382: Write the n-th prime in binary. Change all 0's to 1's and all 1's to 0's. a(n) is the decimal equivalent of the result. ; Submitted by Jon Maiga ; 1,0,2,0,4,2,14,12,8,2,0,26,22,20,16,10,4,2,60,56,54,48,44,38,30,26,24,20,18,14,0,124,118,116,106,104,98,92,88,82,76,74,64,62,58,56,44,32,28,26,22,16,14,4,254,248,242,240,234,230,228,218,204,200,198,194,180,174 seq $0,40 ; The prime numbers. seq $0,35327 ; Write n in binary, interchange 0's and 1's, convert back to decimal.
micro_kernel/timer.asm
bursaiskender/BaseLevelComputerKernel
1
14053
install_timer: mov r8, 1193180 / 1000 mov al, 0x36 out 0x43, al mov rax, r8 out 0x40, al mov rax, r8 shr rax, 8 out 0x40, al mov r8, 0 mov r9, irq_timer_handler call register_irq_handler ret irq_timer_handler: push rax push rbx push rcx push rdx mov rax, [timer_ticks] inc rax mov [timer_ticks], rax xor rdx, rdx mov rcx, 1000 div rcx test rdx, rdx jnz .end mov rax, [timer_seconds] inc rax mov [timer_seconds], rax .end: pop rdx pop rcx pop rbx pop rax ret wait_ms: push r9 push r10 mov r9, [timer_ticks] add r9, r8 .start: cli mov r10, [timer_ticks] cmp r10, r9 je .done sti nop nop nop nop nop nop jmp .start .done: pop r10 pop r9 ret timer_ticks dq 0 timer_seconds dq 0
examples/tty_info.adb
ytomino/drake
33
20096
<filename>examples/tty_info.adb with Ada.Command_Line; with Ada.Text_IO.Terminal; procedure tty_info is use Ada.Text_IO; use Ada.Text_IO.Terminal; package Count_IO is new Integer_IO (Count); use Count_IO; Try_Resize, Try_Move, Try_Col, Try_Save : Boolean := False; State : Terminal.Output_State; begin Count_IO.Default_Width := 0; for I in 1 .. Ada.Command_Line.Argument_Count loop declare Arg : constant String := Ada.Command_Line.Argument (I); begin if Arg = "--resize" then Try_Resize := True; elsif Arg = "--move" then Try_Move := True; elsif Arg = "--col" then Try_Col := True; elsif Arg = "--save" then Try_Save := True; else Put (Standard_Error, "unknown option: "); Put (Standard_Error, Arg); New_Line (Standard_Error); end if; end; end loop; if Try_Save then Save_State (Standard_Output.all, State); end if; Put ("isatty(stdin) = "); Put (Boolean'Image (Is_Terminal (Standard_Input.all))); New_Line; Put ("isatty(stdout) = "); Put (Boolean'Image (Is_Terminal (Standard_Output.all))); New_Line; Put ("isatty(stderr) = "); Put (Boolean'Image (Is_Terminal (Standard_Error.all))); New_Line; if Try_Resize then Set_Size (Standard_Output.all, 75, 25); end if; declare S : Size_Type := Size (Standard_Output.all); begin Put ("size = "); Put (S.Line_Length); Put ("x"); Put (S.Page_Length); New_Line; end; declare V : View_Type := View (Standard_Output.all); begin Put ("view = ("); Put (V.Left); Put (", "); Put (V.Top); Put (")-("); Put (V.Right); Put (", "); Put (V.Bottom); Put (")"); New_Line; end; if Try_Move then Set_Position (Standard_Output.all, 20, 10); end if; if Try_Col then Terminal.Set_Col (Standard_Output.all, 30); end if; declare P : Position_Type := Position (Standard_Output.all); begin Put ("position = ("); Put (P.Col); Put (", "); Put (P.Line); Put (")"); New_Line; end; if Try_Save then Reset_State (Standard_Output.all, State); end if; end tty_info;
env/zx/common/fputc_cons_rst.asm
pjshumphreys/querycsv
18
14466
<reponame>pjshumphreys/querycsv include "equs.inc" ; (char to print) this function is written to only use jr instructions to make it be relocatable code fputc_cons_rom_rst: ld hl, 2 add hl, sp ld b, (hl) ld hl, skip_count ld a, (hl) and a ld a, b jr nz, not_cont cp 10 jr z, lf cp 22 ;move to jr z, posn cp 07 jr z, beep not_beep: push af direct: ld a, 255 ld hl, SCR_CT ;disable the scroll? prompt ld (hl), a pop af push iy ;save callers iy ld iy, ERR_NR call call_rom3 defw 16 pop iy ret not_cont: dec (hl) jr not_beep posn: push af ld a, 2 ld (hl), a jr direct lf: ld a, 13 jr not_beep beep: push hl push bc push de ld hl, $02f6 ; parameters for the beep. 128k uses $0300 instead to account for the cpu speed differences ld de, $002f ; 128k uses $30 instead call call_rom3 defw 0x03b5 ; call BEEPER pop de pop bc pop hl ret
src/ram_defs.asm
PeterCamilleri/zed8e
0
96814
; Zed8E FORTH - A direct threaded FORTH for the Z-80 ; ; RAM definitions. Since this is RAM not ROM, no code should be emitted here. ; org $8000 ram_start: __here: reserve 2 ; The next byte to be used in the dictionary __last: reserve 2 ; The LFA of the last word to be defined. __current: reserve 2 ; The LFA of the word currently being defined. __mode: reserve 1 ; The current mode. 0 is interpret else compiling. __width: reserve 1 ; The terminal width in characters. free_start: ; First free location for dictionary use. org $FF00 ; The FORTH return stack grows up from here. free_end: ; First not free location for dictionary use. init_rs: org $FFFF init_ds: ; The FORTH data stack grows down from here. ; Also the system stack.
agda-stdlib/src/Data/List/Fresh/Relation/Unary/Any/Properties.agda
DreamLinuxer/popl21-artifact
5
8853
------------------------------------------------------------------------ -- The Agda standard library -- -- Properties of Any predicate transformer for fresh lists ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.List.Fresh.Relation.Unary.Any.Properties where open import Level using (Level; _⊔_; Lift) open import Data.Bool.Base using (true; false) open import Data.Empty open import Data.Nat.Base using (ℕ; zero; suc) open import Data.Product using (_,_) open import Data.Sum.Base as Sum using (_⊎_; inj₁; inj₂) open import Function using (_∘′_) open import Relation.Nullary.Reflects using (invert) open import Relation.Nullary open import Relation.Unary as U using (Pred) open import Relation.Binary as B using (Rel) open import Relation.Nary open import Relation.Binary.PropositionalEquality using (_≡_; refl; cong) open import Data.List.Fresh open import Data.List.Fresh.Relation.Unary.All open import Data.List.Fresh.Relation.Unary.Any private variable a b p q r s : Level A : Set a B : Set b ------------------------------------------------------------------------ -- NonEmpty module _ {R : Rel A r} {P : Pred A p} where Any⇒NonEmpty : {xs : List# A R} → Any P xs → NonEmpty xs Any⇒NonEmpty {xs = cons x xs pr} p = cons x xs pr ------------------------------------------------------------------------ -- Correspondence between Any and All module _ {R : Rel A r} {P : Pred A p} {Q : Pred A q} (P⇒¬Q : ∀[ P ⇒ ∁ Q ]) where Any⇒¬All : {xs : List# A R} → Any P xs → ¬ (All Q xs) Any⇒¬All (here p) (q ∷ _) = P⇒¬Q p q Any⇒¬All (there ps) (_ ∷ qs) = Any⇒¬All ps qs All⇒¬Any : {xs : List# A R} → All P xs → ¬ (Any Q xs) All⇒¬Any (p ∷ _) (here q) = P⇒¬Q p q All⇒¬Any (_ ∷ ps) (there qs) = All⇒¬Any ps qs module _ {R : Rel A r} {P : Pred A p} {Q : Pred A q} (P? : Decidable P) where ¬All⇒Any : {xs : List# A R} → ¬ (All P xs) → Any (∁ P) xs ¬All⇒Any {xs = []} ¬ps = ⊥-elim (¬ps []) ¬All⇒Any {xs = x ∷# xs} ¬ps with P? x ... | true because [p] = there (¬All⇒Any (¬ps ∘′ (invert [p] ∷_))) ... | false because [¬p] = here (invert [¬p]) ¬Any⇒All : {xs : List# A R} → ¬ (Any P xs) → All (∁ P) xs ¬Any⇒All {xs = []} ¬ps = [] ¬Any⇒All {xs = x ∷# xs} ¬ps with P? x ... | true because [p] = ⊥-elim (¬ps (here (invert [p]))) ... | false because [¬p] = invert [¬p] ∷ ¬Any⇒All (¬ps ∘′ there) ------------------------------------------------------------------------ -- remove module _ {R : Rel A r} {P : Pred A p} where length-remove : {xs : List# A R} (k : Any P xs) → length xs ≡ suc (length (xs ─ k)) length-remove (here _) = refl length-remove (there p) = cong suc (length-remove p) ------------------------------------------------------------------------ -- append module _ {R : Rel A r} {P : Pred A p} where append⁺ˡ : {xs ys : List# A R} {ps : All (_# ys) xs} → Any P xs → Any P (append xs ys ps) append⁺ˡ (here px) = here px append⁺ˡ (there p) = there (append⁺ˡ p) append⁺ʳ : {xs ys : List# A R} {ps : All (_# ys) xs} → Any P ys → Any P (append xs ys ps) append⁺ʳ {xs = []} p = p append⁺ʳ {xs = x ∷# xs} p = there (append⁺ʳ p) append⁻ : ∀ xs {ys : List# A R} {ps : All (_# ys) xs} → Any P (append xs ys ps) → Any P xs ⊎ Any P ys append⁻ [] p = inj₂ p append⁻ (x ∷# xs) (here px) = inj₁ (here px) append⁻ (x ∷# xs) (there p) = Sum.map₁ there (append⁻ xs p)
Appl/ScrapBk/scrapbk.asm
steakknife/pcgeos
504
87323
<reponame>steakknife/pcgeos COMMENT @---------------------------------------------------------------------- Copyright (c) GeoWorks 1990 -- All Rights Reserved PROJECT: PC GEOS MODULE: scrapbk FILE: scrapbk.asm REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 2/90 Initial version DESCRIPTION: This file contains the scrapbook application $Id: scrapbk.asm,v 1.1 97/04/04 16:49:45 newdeal Exp $ ------------------------------------------------------------------------------@ ;------------------------------------------------------------------------------ ; Conditional Assembly Flags ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; Common GEODE stuff ;------------------------------------------------------------------------------ ; ; Standard include files ; include geos.def include heap.def include geode.def include resource.def include ec.def include vm.def include object.def include graphics.def include win.def include lmem.def include timer.def include file.def include char.def include localize.def ; for Resources file include win.def include gstring.def include Objects/winC.def include initfile.def ; for .ini file routines include library.def include Objects/inputC.def ;------------------------------------------------------------------------------ ; Libraries used ;------------------------------------------------------------------------------ UseLib ui.def UseLib Objects/vTextC.def UseLib impex.def UseLib Internal/convert.def ; for conversion of 1.2 documents ; Testing scan library ;------------------------------------------------------------------------------ ; Feature Flags ;------------------------------------------------------------------------------ ; Options: ; ; HEADER_SIZE_CHECKING: ; try to keep a lid on document's VM header size ; ; NO_BACKUP: ; Turn off backup blocks in the Scrapbook data file. This helps ; with header size, but you lose "revert-on-close" functionality ; We save before closing to avoid the "revert-on-close" dialog, and ; auto-save will also be doing a non-revertable save. (if set, make ; sure .gp file exports ScrapDocumentClass and declares NoBackupUI) ; ; _OPTIONS_MENU: ; Turn On/Off the Options Menu ; ; _SLIDE_SHOW: ; Turn On/Off "Slide Show" feature ; ; _REMEMBER_LAST_SCRAP ; Remember the last scrap the user had selected prior to closing ; the Scrapbook, so that when it is opened again that scrap is ; selected (think of it as an internal "state file" machanism. ; This is only active in the CUI, as we don't want to guess what ; the advanced user wants in the AUI. ; ifdef SLIDE_SHOW_FEATURE ifdef GPC _SLIDE_SHOW = 0 else _SLIDE_SHOW = 1 endif else _SLIDE_SHOW = 0 endif ifdef GPC HEADER_SIZE_CHECKING = 1 NO_BACKUP = 1 _OPTIONS_MENU = 1 _REMEMBER_LAST_SCRAP = 1 else HEADER_SIZE_CHECKING = 1 NO_BACKUP = 0 _OPTIONS_MENU = 1 _REMEMBER_LAST_SCRAP = 0 endif if _SLIDE_SHOW include Internal/im.def UseLib saver.def UseLib Objects/colorC.def endif ;------------------------------------------------------------------------------ ; Resource Definitions ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; Macros ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; Constants ;------------------------------------------------------------------------------ ScrapBookIndexHeader struct SBIH_numScraps word ; number of scraps in this scrapbook ScrapBookIndexHeader ends ScrapBookIndexEntry struct SBIE_vmBlock word ; VM block handle of transfer item ; header of this scrap ScrapBookIndexEntry ends ScrapBookExtraState struct SBES_currentPage word ScrapBookExtraState ends ;UI level stuff ScrapbookFeatures record SF_GOTO_PAGE_DIALOG:1 SF_PASTE_AT_END:1 SF_IMPORTING:1 :13 ScrapbookFeatures end if _OPTIONS_MENU INTRODUCTORY_FEATURES = 0 endif ; if _OPTIONS_MENU BEGINNING_FEATURES = mask SF_GOTO_PAGE_DIALOG or mask SF_IMPORTING or \ mask SF_PASTE_AT_END if _OPTIONS_MENU INTERMEDIATE_FEATURES = mask SF_GOTO_PAGE_DIALOG or mask SF_IMPORTING or \ mask SF_PASTE_AT_END ADVANCED_FEATURES = mask SF_GOTO_PAGE_DIALOG or mask SF_IMPORTING or \ mask SF_PASTE_AT_END endif ; if _OPTIONS_MENU DEFAULT_FEATURES = BEGINNING_FEATURES ; ; Size of text scraps above which we just so a small portion of it ; SBCS<SHOWABLE_TEXT_SIZE_THRESHOLD = 8192 ; 8K > DBCS<SHOWABLE_TEXT_SIZE_THRESHOLD = 8192*(size wchar) > if HEADER_SIZE_CHECKING ; ; warning and error size thresholds for document's VM header ; HEADER_WARNING_SIZE = 16384 HEADER_ERROR_SIZE = 50000 endif ;------------------------------------------------------------------------------ ; Definitions ;------------------------------------------------------------------------------ ScrapBookClass class GenProcessClass ; ; *** MUST BE FIRST MESSAGE *** ; MSG_SCRAPBOOK_PASTE_APPEND_TO_FILE message ; ; Pass: cx = handle of block with: ; FileLongName ; DiskHandle ; PathName ; MSG_SCRAPBOOK_PREVIOUS message MSG_SCRAPBOOK_NEXT message ;MSG_SCRAPBOOK_CUT equ MSG_META_CLIPBOARD_CUT ;MSG_SCRAPBOOK_COPY equ MSG_META_CLIPBOARD_COPY ;MSG_SCRAPBOOK_PASTE equ MSG_META_CLIPBOARD_PASTE MSG_SCRAPBOOK_PASTE_AT_END message ;MSG_SCRAPBOOK_DELETE equ MSG_META_DELETE MSG_SCRAPBOOK_NAMEBOX message MSG_SCRAPBOOK_SHOW_SCRAP message MSG_SCRAPBOOK_SHOW_SCRAP_STATUS message MSG_SCRAPBOOK_SCRAPNAME_CR message MSG_SCRAPBOOK_SCRAP_LIST_REQUEST_ENTRY_MONIKER message MSG_SCRAPBOOK_IMPORT message MSG_SCRAPBOOK_TOGGLE_PAGE_LIST message MSG_SCRAPBOOK_SET_SELECTION message MSG_SCRAPBOOK_SEND_PASTE message if _SLIDE_SHOW MSG_SCRAPBOOK_DRAW_SLIDE_WINDOW message endif ScrapBookClass endc ScrapbookApplicationClass class GenApplicationClass if _OPTIONS_MENU MSG_SCRAPBOOK_APPLICATION_SET_USER_LEVEL message MSG_SCRAPBOOK_APPLICATION_INITIATE_FINE_TUNE message MSG_SCRAPBOOK_APPLICATION_FINE_TUNE message MSG_SCRAPBOOK_APPLICATION_CHANGE_USER_LEVEL message MSG_SCRAPBOOK_APPLICATION_CANCEL_USER_LEVEL message MSG_SCRAPBOOK_APPLICATION_QUERY_RESET_OPTIONS message MSG_SCRAPBOOK_APPLICATION_USER_LEVEL_STATUS message endif ;if _OPTIONS_MENU if NO_BACKUP MSG_SCRAPBOOK_APPLICATION_CANCEL_COMPRESS message endif ScrapbookApplicationClass endc ScrapBookListClass class GenDynamicListClass ScrapBookListClass endc if NO_BACKUP ScrapBookDocumentClass class GenDocumentClass MSG_SCRAPBOOK_DOCUMENT_COMPRESS message MSG_SCRAPBOOK_DOCUMENT_COMPRESS_PART2 message ScrapBookDocumentClass endc endif if _SLIDE_SHOW SlideShowTransitionType etype word, 0, 2 SSTT_CLEAR enum SlideShowTransitionType SSTT_CORNER_WIPE enum SlideShowTransitionType SSTT_EDGE_WIPE enum SlideShowTransitionType SSTT_FADE enum SlideShowTransitionType SlideShowClass class VisClass MSG_SLIDE_SHOW_START message MSG_SLIDE_SHOW_END message MSG_SLIDE_SHOW_SET_TRANSITION message MSG_SLIDE_SHOW_PREVIOUS message MSG_SLIDE_SHOW_NEXT message SSI_window hptr.Window SSI_trans SlideShowTransitionType SSI_color ColorQuad SlideShowClass endc endif ;------------------------------------------------------------------------------ ; Resources ;------------------------------------------------------------------------------ include scrapbk.rdef ;------------------------------------------------------------------------------ ; Variables ;------------------------------------------------------------------------------ idata segment ScrapBookClass mask CLASSF_NEVER_SAVED ScrapbookApplicationClass ScrapBookListClass if NO_BACKUP ScrapBookDocumentClass endif if _SLIDE_SHOW SlideShowClass endif if HEADER_SIZE_CHECKING ;shared scrapMaxCat char "scrapbook",0 warningSizeKey char "warningSize",0 errorSizeKey char "errorSize",0 endif if _SLIDE_SHOW ssKbdMon Monitor <> ssUIHan hptr endif idata ends ;--------------------------------------------------- udata segment ; ; VM file handle of current scrapbook ; currentScrapFile hptr.HandleFile currentDoc optr ; ; 0-based # of currently displayed scrap ; currentScrap word ; ; current format being displayed in scrapbook ; currentFormat ClipboardItemFormat ; ; window for GenView that displays GStrings ; gStringWindow hptr.Window ; ; buffer for "20000) scrap-name" ; SBCS<scrapNameMonikerBuffer char 7 + CLIPBOARD_ITEM_NAME_LENGTH+1 dup (?) > DBCS<scrapNameMonikerBuffer wchar 7 + CLIPBOARD_ITEM_NAME_LENGTH+1 dup (?) > ; SCRAP_NAME_MONIKER_BUFFER_SIZE equ ($-scrapNameMonikerBuffer) ; ; flag indicating whether paste is possible ; canPaste word ; ; last viewed page, used for saving page number across shutdown ; ; lastViewedPage's life story: ; initialized to 0 in OPEN_APPLICATION ; set to value in extra state block, if restoring from state ; used for currentScrap value in DC_FILE_OPEN handler ; set to currentScrap value in DC_FILE_DETACH handler ; set to 0 in DC_FILE_CLOSE handler ; store to extra state block in CLOSE_APPLICATION handler ; lastViewedPage word callerAppName char GEODE_NAME_SIZE + GEODE_NAME_EXT_SIZE + 1 dup (?) callerAppToken word ; ; most recently pasted in CIF_TEXT VMChain (for PASTE_APPEND_TO_FILE) ; pastedTextFormat dword if HEADER_SIZE_CHECKING warningSize word errorSize word endif udata ends ;------------------------------------------------------------------------------ ; Code ;------------------------------------------------------------------------------ AppInitExit segment resource ; START of levels support COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapbookApplicationAttach %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: attach application... CALLED BY: MSG_META_ATTACH PASS: *ds:si - instance data es - segment of ScrapbookApplicationClass ax - MSG_META_ATTACH cx - AppAttachFlags dx - AppLaunchBlock, if any bp - extra state block RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 10/6/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapbookApplicationAttach method dynamic ScrapbookApplicationClass, MSG_META_ATTACH push ax, cx, dx, si, bp call UserGetInterfaceOptions test ax, mask UIIO_OPTIONS_MENU jnz keepOptionsMenu if _OPTIONS_MENU GetResourceHandleNS OptionsMenu, bx mov si, offset OptionsMenu mov ax, MSG_GEN_SET_NOT_USABLE mov dl, VUM_NOW call AIE_ObjMessageCall endif keepOptionsMenu: pop ax, cx, dx, si, bp mov di, offset ScrapbookApplicationClass GOTO ObjCallSuperNoLock ScrapbookApplicationAttach endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapbookApplicationLoadOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: load options for application... CALLED BY: MSG_META_LOAD_OPTIONS PASS: *ds:si - instance data es - segment of ScrapbookApplicationClass ax - MSG_META_LOAD_OPTIONS RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 10/6/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ featuresKey char "features", 0 if _OPTIONS_MENU featuresTable ScrapbookFeatures \ INTRODUCTORY_FEATURES, BEGINNING_FEATURES, INTERMEDIATE_FEATURES, ADVANCED_FEATURES endif ScrapbookApplicationLoadOptions method dynamic ScrapbookApplicationClass, MSG_META_LOAD_OPTIONS, MSG_META_RESET_OPTIONS mov di, offset ScrapbookApplicationClass call ObjCallSuperNoLock ; if no features settings are stored then use ; defaults based on the system's user level sub sp, INI_CATEGORY_BUFFER_SIZE movdw cxdx, sssp mov ax, MSG_META_GET_INI_CATEGORY call ObjCallInstanceNoLock mov ax, sp push si, ds segmov ds, ss mov_tr si, ax mov cx, cs mov dx, offset featuresKey call InitFileReadInteger pop si, ds mov bp, sp lea sp, ss:[bp+INI_CATEGORY_BUFFER_SIZE] jnc done ; This is done for NIKE cos we have an ini setting. For Other ; products which dont need the Options menu , might have to tweek ; the code over here. if _OPTIONS_MENU ; ; no .ini file settings -- set features based on level ; call UserGetDefaultLaunchLevel ; ax = UserLevel .assert (size ScrapbookFeatures eq 2) shl ax, 1 mov di, ax push {ScrapbookFeatures} cs:[featuresTable][di] GetResourceHandleNS UserLevelList, bx mov si, offset UserLevelList mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION call AIE_ObjMessageCall ; ax = selection pop cx cmp ax, cx ; desired level already set? je done ; yes, do nothing mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION clr dx ; no indeterminate call AIE_ObjMessageCall ; ax = selection mov ax, MSG_GEN_ITEM_GROUP_SET_MODIFIED_STATE mov cx, 1 ; mark modified call AIE_ObjMessageSend mov ax, MSG_GEN_APPLY call AIE_ObjMessageSend ; send out changes endif ;if _OPTIONS_MENU done: ret ScrapbookApplicationLoadOptions endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScraBbookMetaQuit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handler for MSG_META_QUIT CALLED BY: MSG_META_QUIT PASS: ds,es = dgroup ax = MSG_META_QUIT dx = QuitLevel cx,dx,bp,si = see documentation for MSG_META_QUIT RETURN: see documentation for MSG_META_QUIT SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Don 10/22/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _REMEMBER_LAST_SCRAP rememberCategory char "scrapbook",0 rememberDiskKey char "remDisk",0 rememberPathKey char "remPath",0 rememberFileKey char "remFile",0 rememberScrapKey char "remScrap",0 ScrapBookMetaQuit method ScrapBookClass, MSG_META_QUIT ; ; Only do something for QL_BEFORE_UI (QuitLevel 0) ; push ax, cx, dx, bp, si, ds, es push ds:[LMBH_handle] cmp dx, QL_BEFORE_UI je begin callSuper: pop bx pop ax, cx, dx, bp, si, ds, es mov di, offset ScrapBookClass GOTO ObjCallSuperNoLock ; ; If we're in the CUI, save the document, its path, and the current ; scrap. Otherwise, delete all of the keys. ; begin: segmov ds, cs call UserGetDefaultUILevel cmp ax, UIIL_INTRODUCTORY jne deleteKeysNear ; not in CUI - delete the keys ; ; Write the current scrap number ; mov si, offset rememberCategory mov cx, ds mov dx, offset rememberScrapKey mov bp, es:[currentScrap] call InitFileWriteInteger ; ; Get the document's path from the GenDocument object ; movdw bxsi, es:[currentDoc] tst bx ; if no GenDocument object jnz getPath ; ...then get out of here deleteKeysNear: jmp deleteKeys getPath: sub sp, PATH_BUFFER_SIZE segmov es, ss, dx mov bp, sp ; buffer -> ES:BP mov ax, MSG_GEN_PATH_GET mov cx, PATH_BUFFER_SIZE mov di, mask MF_CALL call ObjMessage ; path -> buffer; diskhan -> cx jc cleanUpAndDeleteKeys push cx ; save disk handle ; ; Write the document name out to the .INI file ; push si mov si, offset rememberCategory mov cx, ds mov dx, offset rememberPathKey mov di, bp ; path string -> es:di call InitFileWriteString pop si ; ; Write the disk handle out to the .INI file. Note that we ; cannot write the handle out as it will change from session ; to session, so we instead write an opaque value representing ; the disk. ; pop ax push bx, si mov_tr bx, ax mov cx, PATH_BUFFER_SIZE call DiskSave ; overwrites path buffer pop bx, si jc cleanUpAndDeleteKeys mov bp, cx ; buffer bytes used -> bp push si mov si, offset rememberCategory mov cx, ds mov dx, offset rememberDiskKey call InitFileWriteData pop si ; ; Finally, get the document name and write it to the .INI file ; mov ax, MSG_GEN_DOCUMENT_GET_FILE_NAME movdw cxdx, esdi mov di, mask MF_CALL call ObjMessage ; file buffer with filename mov di, dx ; path string -> es:di mov si, offset rememberCategory mov cx, ds mov dx, offset rememberFileKey call InitFileWriteString call InitFileCommit ; commit all changes add sp, PATH_BUFFER_SIZE jmp callSuper ; ; Delete the keys, either because we're not in the CUI or ; because there is no file currently open (indicated as such ; by the lack of a GenDocument optr). ; cleanUpAndDeleteKeys: add sp, PATH_BUFFER_SIZE deleteKeys: mov si, offset rememberCategory mov cx, ds mov dx, offset rememberDiskKey call InitFileDeleteEntry mov dx, offset rememberPathKey call InitFileDeleteEntry mov dx, offset rememberFileKey call InitFileDeleteEntry mov dx, offset rememberScrapKey call InitFileDeleteEntry jmp callSuper ScrapBookMetaQuit endm endif ; _REMEMBER_LAST_SCRAP COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapbookRemember %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Load the AppLaunchBlock with our remembered settings CALLED BY: ScrapBookOpenApplication PASS: bx - handle of AppLaunchBlock RETURN: nothing, though fields in AppLaunchBlock will be changed DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: also stores value in lastViewedPage REVISION HISTORY: Name Date Description ---- ---- ----------- Don 10/22/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _REMEMBER_LAST_SCRAP ScrapbookRemember proc near uses ax, bx, cx, dx, bp, di, si, ds, es .enter ; ; We only do anything if we are: ; a) running in the CUI, and ; b) the AppLaunchBlock doesn't already hold a document name ; call UserGetDefaultUILevel cmp ax, UIIL_INTRODUCTORY jne exit push bx call MemLock mov es, ax ; AppLaunch Block -> es:0 tst {byte}es:ALB_dataFile jnz done ; ; The sequence of operations is important here. We need to have ; all keys present in order to do anything, and we also stand a ; a chance of the DiskRestore failing. So we'll start with that. ; segmov ds, cs, cx mov si, offset rememberCategory mov dx, offset rememberDiskKey clr bp ; allocate a buffer, please call InitFileReadData jc failure call MemLock mov ds, ax clr si clr cx ; no callback routine call DiskRestore ; disk handle -> ax (we hope!) pushf call MemFree popf jc failure mov es:[ALB_diskHandle], ax ; ; OK, the toughest part is over. Now read the path & document name ; segmov ds, cs, cx mov si, offset rememberCategory mov dx, offset rememberPathKey mov bp, size ALB_path mov di, offset ALB_path call InitFileReadString jc failure mov cx, cs mov dx, offset rememberFileKey mov bp, size ALB_dataFile mov di, offset ALB_dataFile call InitFileReadString jc failure ; ; Finally, read the scrap that was being used ; mov cx, cs mov dx, offset rememberScrapKey call InitFileReadInteger jc failure mov ss:[lastViewedPage], ax done: pop bx ; restore ALB handle call MemUnlock ; unlock the sucker exit: .leave ret ; ; We failed. Delete all of the keys and get out of here ; failure: mov si, offset rememberCategory mov cx, ds mov dx, offset rememberDiskKey call InitFileDeleteEntry mov dx, offset rememberPathKey call InitFileDeleteEntry mov dx, offset rememberFileKey call InitFileDeleteEntry mov dx, offset rememberScrapKey call InitFileDeleteEntry jmp done ScrapbookRemember endp endif ; _REMEMBER_LAST_SCRAP COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapbookApplicationUpdateAppFeatures %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: attach application... CALLED BY: MSG_GEN_APPLICATION_UPDATE_APP_FEATURES PASS: *ds:si - instance data es - segment of ScrapbookApplicationClass ax - MSG_GEN_APPLICATION_UPDATE_APP_FEATURES ss:bp - GenAppUpdateFeaturesParams RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 10/6/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ; This table has an entry corresponding to each feature bit. The entry is a ; pointer to the list of objects to turn on/off usabilityTable fptr \ gotoPageDialogList, ;SF_GOTO_PAGE_DIALOG pasteAtEndList, ;SF_PASTE_AT_END importingList ;SF_IMPORTING gotoPageDialogList label GenAppUsabilityTuple GenAppMakeUsabilityTuple ScrapNameBox GenAppMakeUsabilityTuple ScrapNameBoxTrigger, end pasteAtEndList label GenAppUsabilityTuple GenAppMakeUsabilityTuple PasteAtEndTrigger, end importingList label GenAppUsabilityTuple GenAppMakeUsabilityTuple ScrapBookImporter, end levelTable label GenAppUsabilityTuple GenAppMakeUsabilityTuple ScrapUIDocControl, recalc, end ScrapbookApplicationUpdateAppFeatures method dynamic ScrapbookApplicationClass, MSG_GEN_APPLICATION_UPDATE_APP_FEATURES mov ss:[bp].GAUFP_table.segment, cs mov ss:[bp].GAUFP_table.offset, offset usabilityTable mov ss:[bp].GAUFP_tableLength, length usabilityTable mov ss:[bp].GAUFP_levelTable.segment, cs mov ss:[bp].GAUFP_levelTable.offset, offset levelTable mov ax, MSG_GEN_APPLICATION_UPDATE_FEATURES_VIA_TABLE call ObjCallInstanceNoLock ret ScrapbookApplicationUpdateAppFeatures endm if _OPTIONS_MENU COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapbookApplicationSetUserLevel %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: set user level for application... CALLED BY: MSG_SCRAPBOOK_APPLICATION_SET_USER_LEVEL PASS: *ds:si - instance data es - segment of ScrapbookApplicationClass ax - MSG_SCRAPBOOK_APPLICATION_SET_USER_LEVEL cx - user level (as feature bits) RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 10/6/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapbookApplicationSetUserLevel method dynamic ScrapbookApplicationClass, MSG_SCRAPBOOK_APPLICATION_SET_USER_LEVEL mov ax, cx ;ax <- new features ; ; find the corresponding bar states and level ; push si clr di, bp mov cx, (length featuresTable) ;cx <- # entries mov dl, UIIL_INTRODUCTORY ;dl <- UIInterfaceLevel mov dh, dl ;dh <- nearest so far (level) mov si, 16 ;si <- nearest so far (# bits) findLoop: cmp ax, cs:featuresTable[di] je found push ax, cx ; ; See how closely the features match what we're looking for ; mov bx, ax xor bx, cs:featuresTable[di] clr ax ;no bits on mov cx, 16 countBits: ror bx, 1 jnc nextBit ;bit on? inc ax ;ax <- more bit nextBit: loop countBits cmp ax, si ;fewer differences? jae nextEntry ;branch if not fewer difference ; ; In the event we don't find a match, use the closest ; mov si, ax ;si <- nearest so far (# bits) mov dh, dl ;dh <- nearest so far (level) mov bp, di ;bp <- corresponding entry nextEntry: pop ax, cx inc dl ;dl <- next UIInterfaceLevel add di, (size ScrapbookFeatures) loop findLoop ; ; No exact match -- set the level to the closest ; mov dl, dh ;dl <- nearest level mov di, bp ;di <- corresponding entry ; ; Set the app features and level ; found: pop si clr dh ;dx <- UIInterfaceLevel push dx mov cx, ax ;cx <- features to set mov ax, MSG_GEN_APPLICATION_SET_APP_FEATURES call ObjCallInstanceNoLock pop cx ;cx <- UIInterfaceLevel to set mov ax, MSG_GEN_APPLICATION_SET_APP_LEVEL call ObjCallInstanceNoLock ret ScrapbookApplicationSetUserLevel endm COMMENT @---------------------------------------------------------------------- MESSAGE: ScrapbookApplicationChangeUserLevel -- MSG_SCRAPBOOK_APPLICATION_CHANGE_USER_LEVEL for ScrapbookApplicationClass DESCRIPTION: User change to the user level PASS: *ds:si - instance data es - segment of ScrapbookApplicationClass ax - The message RETURN: DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 11/16/92 Initial version ------------------------------------------------------------------------------@ ScrapbookApplicationChangeUserLevel method dynamic ScrapbookApplicationClass, MSG_SCRAPBOOK_APPLICATION_CHANGE_USER_LEVEL push si mov ax, MSG_GEN_GUP_INTERACTION_COMMAND mov cx, IC_APPLY GetResourceHandleNS SetUserLevelDialog, bx mov si, offset SetUserLevelDialog clr di call ObjMessage pop si ret ScrapbookApplicationChangeUserLevel endm COMMENT @---------------------------------------------------------------------- MESSAGE: ScrapbookApplicationCancelUserLevel -- MSG_SCRAPBOOK_APPLICATION_CANCEL_USER_LEVEL for ScrapbookApplicationClass DESCRIPTION: Cancel user level dialog PASS: *ds:si - instance data es - segment of ScrapbookApplicationClass ax - The message RETURN: DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 2/19/93 Initial version ------------------------------------------------------------------------------@ ScrapbookApplicationCancelUserLevel method dynamic ScrapbookApplicationClass, MSG_SCRAPBOOK_APPLICATION_CANCEL_USER_LEVEL mov cx, ds:[di].GAI_appFeatures GetResourceHandleNS UserLevelList, bx mov si, offset UserLevelList mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION clr dx call AIE_ObjMessageSend GetResourceHandleNS SetUserLevelDialog, bx mov si, offset SetUserLevelDialog mov ax, MSG_GEN_GUP_INTERACTION_COMMAND mov cx, IC_DISMISS call AIE_ObjMessageSend ret ScrapbookApplicationCancelUserLevel endm COMMENT @---------------------------------------------------------------------- MESSAGE: ScrapbookApplicationQueryResetOptions -- MSG_SCRAPBOOK_APPLICATION_QUERY_RESET_OPTIONS for ScrapbookApplicationClass DESCRIPTION: Make sure that the user wants to reset options PASS: *ds:si - instance data es - segment of ScrapbookApplicationClass ax - The message RETURN: DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 11/24/92 Initial version ------------------------------------------------------------------------------@ ScrapbookApplicationQueryResetOptions method dynamic ScrapbookApplicationClass, MSG_SCRAPBOOK_APPLICATION_QUERY_RESET_OPTIONS ; ask the user if she wants to reset the options push ds:[LMBH_handle] clr ax pushdw axax ;SDOP_helpContext pushdw axax ;SDOP_customTriggers pushdw axax ;SDOP_stringArg2 pushdw axax ;SDOP_stringArg1 GetResourceHandleNS ResetOptionsQueryString, bx mov ax, offset ResetOptionsQueryString pushdw bxax mov ax, CustomDialogBoxFlags <0, CDT_QUESTION, GIT_AFFIRMATION,0> push ax call UserStandardDialogOptr pop bx call MemDerefDS cmp ax, IC_YES jnz done mov ax, MSG_META_RESET_OPTIONS call ObjCallInstanceNoLock done: ret ScrapbookApplicationQueryResetOptions endm COMMENT @---------------------------------------------------------------------- MESSAGE: ScrapbookApplicationUserLevelStatus -- MSG_SCRAPBOOK_APPLICATION_USER_LEVEL_STATUS for ScrapbookApplicationClass DESCRIPTION: Update the "Fine Tune" trigger PASS: *ds:si - instance data es - segment of ScrapbookApplicationClass ax - The message cx - current selection RETURN: DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 11/24/92 Initial version ------------------------------------------------------------------------------@ if 0 ScrapbookApplicationUserLevelStatus method dynamic ScrapbookApplicationClass, MSG_SCRAPBOOK_APPLICATION_USER_LEVEL_STATUS mov ax, MSG_GEN_SET_ENABLED cmp cx, ADVANCED_FEATURES jz 10$ mov ax, MSG_GEN_SET_NOT_ENABLED 10$: mov dl, VUM_NOW GetResourceHandleNS FineTuneTrigger, bx mov si, offset FineTuneTrigger call AIE_ObjMessageSend ret ScrapbookApplicationUserLevelStatus endm endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapbookApplicationInitiateFineTune %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: initiate fine tune box for application... CALLED BY: MSG_SCRAPBOOK_APPLICATION_INITIATE_FINE_TUNE PASS: *ds:si - instance data es - segment of ScrapbookApplicationClass ax - MSG_SCRAPBOOK_APPLICATION_INITIATE_FINE_TUNE RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 10/6/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapbookApplicationInitiateFineTune method dynamic ScrapbookApplicationClass, MSG_SCRAPBOOK_APPLICATION_INITIATE_FINE_TUNE GetResourceHandleNS UserLevelList, bx mov si, offset UserLevelList mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION call AIE_ObjMessageCall ;ax = features mov_tr cx, ax clr dx GetResourceHandleNS FeaturesList, bx mov si, offset FeaturesList mov ax, MSG_GEN_BOOLEAN_GROUP_SET_GROUP_STATE call AIE_ObjMessageSend GetResourceHandleNS FineTuneDialog, bx mov si, offset FineTuneDialog mov ax, MSG_GEN_INTERACTION_INITIATE call AIE_ObjMessageSend ret ScrapbookApplicationInitiateFineTune endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapbookApplicationFineTune %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: fine tune features for application... CALLED BY: MSG_SCRAPBOOK_APPLICATION_FINE_TUNE PASS: *ds:si - instance data es - segment of ScrapbookApplicationClass ax - MSG_SCRAPBOOK_APPLICATION_FINE_TUNE RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 10/6/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapbookApplicationFineTune method dynamic ScrapbookApplicationClass, MSG_SCRAPBOOK_APPLICATION_FINE_TUNE ; get fine tune settings GetResourceHandleNS FeaturesList, bx mov si, offset FeaturesList mov ax, MSG_GEN_BOOLEAN_GROUP_GET_SELECTED_BOOLEANS call AIE_ObjMessageCall ;ax = new features mov cx, ax ;cx = new features GetResourceHandleNS UserLevelList, bx mov si, offset UserLevelList mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION clr dx call AIE_ObjMessageSend mov cx, 1 ;mark modified mov ax, MSG_GEN_ITEM_GROUP_SET_MODIFIED_STATE call AIE_ObjMessageSend ret ScrapbookApplicationFineTune endm endif ;if _OPTIONS_MENU AIE_ObjMessageCall proc near mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ret AIE_ObjMessageCall endp if _OPTIONS_MENU AIE_ObjMessageSend proc near mov di, mask MF_FIXUP_DS call ObjMessage ret AIE_ObjMessageSend endp endif ;if _OPTIONS_MENU ; END of levels support COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookOpenApplication %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: open application... CALLED BY: MSG_GEN_PROCESS_OPEN_APPLICATION PASS: cx - AppAttachFlags dx - AppLaunchBlock, if any bp - extra state block RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 03/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookOpenApplication method ScrapBookClass, \ MSG_GEN_PROCESS_OPEN_APPLICATION if HEADER_SIZE_CHECKING ; ; read limits ; push ax, cx, dx, si mov cx, ds mov si, offset scrapMaxCat mov dx, offset warningSizeKey mov ax, HEADER_WARNING_SIZE ; default warning level (16K) call InitFileReadInteger mov ss:[warningSize], ax mov dx, offset errorSizeKey mov ax, HEADER_ERROR_SIZE ; default error level (50K) call InitFileReadInteger mov ss:[errorSize], ax pop ax, cx, dx, si endif ; ; restore extra data from state file ; push ax, bx, cx, ds, es mov ss:[lastViewedPage], 0 ; default is first scrap tst bp jz noState mov bx, bp call MemLock ; ax - segment of extra data push ds mov ds, ax mov ax, ds:[SBES_currentPage] ; restore last viewed page mov ss:[lastViewedPage], ax pop ds call MemUnlock noState: ; ; Check for appLaunchBlock, since the original scrapbook app ; doesn't use ALB_dataFile. Here I used it as a storage of ; the caller application's GeodeToken, if the scrapbook is called ; by any caller app. ; tst dx jz noAppLaunchBlock mov bx, dx call MemLock ; ax - segment of launch block mov ds, ax tst ds:[ALB_dataFile] jnz noCallerApp ; lea si, ds:[ALB_dataFile] inc si tst {byte}ds:[si] jz noCallerApp call ScrapbookCopyCallerApp call ScrapbookChangeIcon ; change the icon moniker call ScrapbookAddGCNList noCallerApp: call MemUnlock ; unlock the app launch block if _REMEMBER_LAST_SCRAP call ScrapbookRemember ; remember where we were endif noAppLaunchBlock: pop ax, bx, cx, ds, es mov ss:[currentScrapFile], 0 mov ss:[currentFormat], CIF_TEXT mov ss:[gStringWindow], 0 mov ss:[canPaste], FALSE ; ; call superclass to start up ; mov di, offset ScrapBookClass call ObjCallSuperNoLock ; ; set up text object ; call ClipboardGetClipboardFile mov cx, bx GetResourceHandleNS ScrapText, bx mov si, offset ScrapText mov ax, MSG_VIS_TEXT_SET_VM_FILE call AIE_ObjMessageCall ; ; sync what we think the current view content is ; mov cx, MANUFACTURER_ID_GEOWORKS ; force change mov dx, CIF_TEXT call SetScrapViewContent EC < ERROR_C 0 ; CIF_TEXT not known?!? > ; ; we want to be notified about normal transfer item ; call GeodeGetProcessHandle mov cx, bx ; cx:dx = our process clr dx call ClipboardAddToNotificationList ; ; disable stuff, opening a file will re-enable ; call DisableScrapBook ret ScrapBookOpenApplication endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookCloseApplication %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: close application... CALLED BY: MSG_GEN_PROCESS_CLOSE_APPLICATION PASS: RETURN: cx - handle of extra state block 0 if none DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 05/02/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookCloseApplication method ScrapBookClass, \ MSG_GEN_PROCESS_CLOSE_APPLICATION if NO_BACKUP ; ; remove status dialog ; push ax, cx, dx, bp, si GetResourceHandleNS CompressStatus, bx mov si, offset CompressStatus mov ax, MSG_GEN_SET_NOT_USABLE mov dl, VUM_NOW mov di, mask MF_CALL call ObjMessage pop ax, cx, dx, bp, si endif if _SLIDE_SHOW ; ; make sure the slide show window is closed ; push ax, cx, dx, bp, si GetResourceHandleNS SlideControl, bx mov si, offset SlideControl mov ax, MSG_SLIDE_SHOW_END mov di, mask MF_CALL call ObjMessage pop ax, cx, dx, bp, si endif ; ; remove from transfer notification ; push bx, cx, dx call GeodeGetProcessHandle mov cx, bx clr dx call ClipboardRemoveFromNotificationList pop bx, cx, dx ; ; call superclass ; mov di, offset ScrapBookClass call ObjCallSuperNoLock ; ; save extra data to state block ; mov ax, size ScrapBookExtraState mov cx, ALLOC_DYNAMIC_LOCK or mask HF_SHARABLE call MemAlloc mov cx, 0 ; assume error - no extra state ; (preserve flags) jc done ; error mov cx, bx ; cx - handle of extra state mov ds, ax ; ds - segment of extra state mov ax, ss:[lastViewedPage] mov ds:[SBES_currentPage], ax ; save current page call MemUnlock ; unlock before returning it done: tst ss:[callerAppName] jz noApp call ScrapbookRemoveGCNList noApp: ret ScrapBookCloseApplication endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookInstallToken %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Install tokens CALLED BY: MSG_GEN_PROCESS_INSTALL_TOKEN PASS: none RETURN: none DESTROYED: ax, cx, dx, si, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- eca 2/19/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookInstallToken method ScrapBookClass, MSG_GEN_PROCESS_INSTALL_TOKEN ; ; Call our superclass to get the ball rolling... ; mov di, offset ScrapBookClass call ObjCallSuperNoLock ; install datafile token mov ax, ('s') or ('c' shl 8) ; ax:bx:si = token used for mov bx, ('b') or ('k' shl 8) ; datafile mov si, MANUFACTURER_ID_GEOWORKS call TokenGetTokenInfo ; is it there yet? jnc done ; yes, do nothing ; cx:dx = OD of moniker list GetResourceHandleNS DatafileMonikerList, cx mov dx, offset DatafileMonikerList clr bp ; in data resource, so no ; relocation call TokenDefineToken ; add icon to token database done: ret ScrapBookInstallToken endm AppInitExit ends CommonCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookNotifyNormalTransferItemChanged %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: enable Paste button if a transfer item exists CALLED BY: MSG_META_CLIPBOARD_NOTIFY_NORMAL_TRANSFER_ITEM_CHANGED PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 05/02/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookNotifyNormalTransferItemChanged method ScrapBookClass, \ MSG_META_CLIPBOARD_NOTIFY_NORMAL_TRANSFER_ITEM_CHANGED cmp ss:[canPaste], TRUE ; possible to paste? jne done ; nope, don't even check clr bp ; normal transfer call ClipboardQueryItem tst bp ; any transfer item? pushf ; save answer call ClipboardDoneWithItem popf ; retrieve answer mov ax, MSG_GEN_SET_NOT_ENABLED ; assume no paste jz 50$ ; if no transfer item, no paste mov ax, MSG_GEN_SET_ENABLED ; else, allow paste 50$: GetResourceHandleNS PasteTrigger, bx mov si, offset PasteTrigger push ax ; save method call SendAbleMessage pop ax ; retrieve method GetResourceHandleNS PasteAtEndTrigger, bx mov si, offset PasteAtEndTrigger call SendAbleMessage done: ret ScrapBookNotifyNormalTransferItemChanged endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookExposed %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: draw gstring, if needed CALLED BY: MSG_META_EXPOSED PASS: cx - window handle RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 01/02/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _SLIDE_SHOW ScrapBookDrawSlideShow method ScrapBookClass, MSG_SCRAPBOOK_DRAW_SLIDE_WINDOW jcxz done call DrawScrap done: ret ScrapBookDrawSlideShow endm endif ScrapBookExposed method ScrapBookClass, MSG_META_EXPOSED mov ss:[gStringWindow], cx FALL_THRU DrawScrap ScrapBookExposed endm DrawScrap proc far mov di, cx call GrCreateState call GrBeginUpdate call GetNumScraps ; cx = number of scraps cmp cx, ss:[currentScrap] LONG jbe done ; bogus scrap, don't draw mov bx, ss:[currentScrapFile] tst bx ; no file (closed) LONG jz done ; ; bx = current scrap file ; call VMGetMapBlock ; get index block call VMLock ; ax = segment; bp = handle mov es, ax mov ax, ds:[currentScrap] ; ax = current scrap index call GetThisScrapIndexOffset ; si = offset in header mov ax, es:[si].SBIE_vmBlock ; ax = transfer item VM block call VMUnlock ; unlock map block call VMLock ; lock transfer item mov es, ax clr si mov cx, es:[CIH_formatCount] startLoop: cmp es:[CIH_formats][si].CIFI_format.CIFID_manufacturer, MANUFACTURER_ID_GEOWORKS jne next cmp es:[CIH_formats][si].CIFI_format.CIFID_type, CIF_GRAPHICS_STRING je foundGString cmp es:[CIH_formats][si].CIFI_format.CIFID_type, CIF_BITMAP je foundBitmap next: add si, size ClipboardItemFormatInfo loop startLoop call VMUnlock jmp done foundBitmap: mov cx, es:[CIH_formats][si].CIFI_vmChain.high mov dx, bx call VMUnlock clr ax, bx call GrDrawHugeBitmap jmp done foundGString: mov si, es:[CIH_formats][si].CIFI_vmChain.high call VMUnlock ; unlock transfer item ; ; bx - VM file ; si - GString VM block ; mov cx, GST_VMEM ; gstring in VM format call GrLoadGString ; si = handle of gstring ; ; deal with GeoDraw TIF_GSTRING scraps that are centered on 0,0 ; clr dx call GrGetGStringBounds ; ax, bx, cx, dx = bounds neg ax ; convert to draw position neg bx push ax ; save X position mov al, GSSPT_BEGINNING ; reposition to beginning call GrSetGStringPos pop ax ; restore X position clr dx call GrDrawGString ; draw gstring mov dl, GSKT_LEAVE_DATA ; clobber only header, ; LEAVE VM BLOCKS ALONE! call GrDestroyGString ; destory gstring handle done: call GrEndUpdate call GrDestroyState ret DrawScrap endp ScrapBookViewWinClosed method ScrapBookClass, MSG_META_CONTENT_VIEW_WIN_CLOSED mov ss:[gStringWindow], 0 mov di, offset ScrapBookClass call ObjCallSuperNoLock ret ScrapBookViewWinClosed endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookNameBox %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: bring up scrap name list dialog box CALLED BY: MSG_SCRAPBOOK_NAMEBOX PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 04/23/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookNameBox method ScrapBookClass, MSG_SCRAPBOOK_NAMEBOX call SaveCurrentScrapName mov ax, MSG_GEN_INTERACTION_INITIATE GetResourceHandleNS ScrapNameBox, bx mov si, offset ScrapNameBox clr di call ObjMessage ret ScrapBookNameBox endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookShowScrap %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: show scrap selected from list CALLED BY: MSG_SCRAPBOOK_SHOW_SCRAP PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 03/13/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookShowScrapStatus method ScrapBookClass, MSG_SCRAPBOOK_SHOW_SCRAP_STATUS ; ; if list is in primary, show scrap ; GetResourceHandleNS ScrapBody, bx mov si, offset ScrapBody GetResourceHandleNS ScrapNameList, cx mov dx, offset ScrapNameList mov ax, MSG_GEN_FIND_CHILD mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ; C set if not found jc done ; in dialog, ignore call ScrapBookShowScrap done: ret ScrapBookShowScrapStatus endm ScrapBookShowScrap method ScrapBookClass, MSG_SCRAPBOOK_SHOW_SCRAP ; ; get selected scrap from list ; GetResourceHandleNS ScrapNameList, bx mov si, offset ScrapNameList mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ; ax = entry selected cmp ax, GIGS_NONE je done ; no selection ; ; show specified scrap ; mov cx, ax ; cx = entry selected call SaveCurrentScrapName ; save name of current scrap ; before changing to ; new scrap ; (returns flag in ax) mov ss:[currentScrap], cx ; assume in-bounds call ShowCurrentScrap done: ret ScrapBookShowScrap endm GetNumScraps proc near uses bx, ax, es, bp .enter GetResourceSegmentNS dgroup, es mov bx, es:[currentScrapFile] mov cx, bx ; in case no scrap file jcxz done call VMGetMapBlock call VMLock mov es, ax mov cx, es:[SBIH_numScraps] ; cx = number of scraps call VMUnlock done: .leave ret GetNumScraps endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookRequestMoniker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: request for entry in scrap name list CALLED BY: MSG_SCRAPBOOK_SCRAP_LIST_REQUEST_ENTRY_MONIKER PASS: cx:dx = OD of list bp = entry to get RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 03/13/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookRequestMoniker method ScrapBookClass, \ MSG_SCRAPBOOK_SCRAP_LIST_REQUEST_ENTRY_MONIKER mov ax, bp mov di, ax ; di = entry to get call GetThisScrapIndexOffset ; si = index offset mov bx, ss:[currentScrapFile] tst bx LONG jz done call VMGetMapBlock call VMLock ; lock index block mov es, ax cmp di, es:[SBIH_numScraps] ; beyond last scrap? ; (check results later) mov ax, es:[si].SBIE_vmBlock call VMUnlock ; unlock index block ; (preserves flags) LONG jae done ; yes beyond last one, do nada call VMLock ; lock item block push bp push di ; save entry # to get ; ; copy over scrap name into our buffer so we can tack on scrap number ; push ds push ax ; save scrap segment mov ax, di ; ax = entry # inc ax ; 1-based GetResourceSegmentNS scrapNameMonikerBuffer, es ; es:di = buffer mov di, offset scrapNameMonikerBuffer call ASCIIizeWordAX ; store ASCII number into es:di if DBCS_PCGEOS LocalLoadChar ax, C_PERIOD LocalPutChar esdi, ax LocalLoadChar ax, C_SPACE LocalPutChar esdi, ax else mov ax, '.' or (' ' shl 8) ; seperator stosw endif pop ds ; ds:si = scrap name mov si, offset CIH_name mov cx, length CIH_name LocalCopyNString ; copy over scrap name&C_NULL pop ds ; ; clip moniker, if necessary ; scrapNameMonikerBuffer = moniker ; es = scrapNameMonikerBuffer segment ; GetResourceHandleNS ScrapNameList, bx mov si, offset ScrapNameList mov ax, MSG_VIS_VUP_CREATE_GSTATE mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ; bp = gstate jnc noClip mov di, offset scrapNameMonikerBuffer ; es:di = moniker call LocalStringLength ; cx = length mov di, bp push ds segmov ds, ss, si mov si, offset scrapNameMonikerBuffer call GrTextWidth mov bx, dx ; bx = text width mov si, GFMI_ROUNDED or GFMI_AVERAGE_WIDTH call GrFontMetrics ; dx mov ax, 25 ; match hint in ScrapNameList mul dl ; ax = available width cmp bx, ax jbe haveRoom push ax mov ax, C_ELLIPSIS call GrCharWidth ; dx = ellipsis width pop ax sub ax, dx ; ax = target width mov si, offset scrapNameMonikerBuffer dec cx truncateLoop: call GrTextWidth ; dx = width cmp dx, ax jbe truncated loop truncateLoop truncated: push di mov di, offset scrapNameMonikerBuffer add di, cx ; es:di = position for ellipsis DBCS < add di, cx > LocalLoadChar ax, C_ELLIPSIS LocalPutChar esdi, ax LocalLoadChar ax, C_NULL LocalPutChar esdi, ax pop di haveRoom: call GrDestroyState pop ds noClip: ; ; set up params for MSG_GEN_LIST_SET_ENTRY_MONIKER ; pop bp ; bp = entry # to get push bp ; save again mov cx, es mov dx, offset scrapNameMonikerBuffer mov ax, MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_TEXT GetResourceHandleNS ScrapNameList, bx mov si, offset ScrapNameList mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ; ; set this entry as the exclusive if it is the current scrap ; pop ax ; ax = entry # cmp ax, ss:[currentScrap] ; is it the current one? jne afterCurrent ; nope call SetCurrentScrapInScrapNameList ; else, set as exclusive afterCurrent: ; ; finish up ; pop bp call VMUnlock done: ret ScrapBookRequestMoniker endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookNext %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: advance to next scrap in current scrapbook CALLED BY: MSG_SCRAPBOOK_NEXT PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 02/28/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookNext method ScrapBookClass, MSG_SCRAPBOOK_NEXT call SaveCurrentScrapName mov bx, ss:[currentScrapFile] tst bx jz done call VMGetMapBlock ; ax = map block call VMLock ; lock map block push bp mov ds, ax ; ds = map block segment EC < cmp ds:[SBIH_numScraps], 0 ; any scraps? > EC < je exit ; nope > mov ax, ss:[currentScrap] ; ax = current scrap # inc ax ; move to next scrap cmp ax, ds:[SBIH_numScraps] ; at last scrap? jne haveNextScrap ; no, use it mov ax, 0 ; else, wrap-around to first ; scrap haveNextScrap: mov ss:[currentScrap], ax ; store new current scrap exit:: pop bp ; unlock map block call VMUnlock call ShowCurrentScrap ; show new current scrap done: ret ScrapBookNext endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookPrevious %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: advance to previous scrap in current scrapbook CALLED BY: MSG_SCRAPBOOK_PREVIOUS PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 02/28/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookPrevious method ScrapBookClass, MSG_SCRAPBOOK_PREVIOUS call SaveCurrentScrapName mov bx, ss:[currentScrapFile] tst bx jz done call VMGetMapBlock ; ax = map block call VMLock ; lock map block push bp mov ds, ax ; ds = map block segment EC < cmp ds:[SBIH_numScraps], 0 ; any scraps? > EC < je exit ; nope > mov ax, ss:[currentScrap] ; ax = current scrap # dec ax cmp ax, -1 ; beyond first scrap? jne havePrevScrap ; no, use it mov ax, ds:[SBIH_numScraps] ; else, wrap-around to dec ax ; last scrap havePrevScrap: mov ss:[currentScrap], ax ; store new current scrap exit:: pop bp ; unlock map block call VMUnlock call ShowCurrentScrap ; show new current scrap done: ret ScrapBookPrevious endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookVMFileDirty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: current scrapbook dirtied, notify document control CALLED BY: MSG_META_VM_FILE_DIRTY PASS: cx - file handle RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 04/11/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookVMFileDirty method ScrapBookClass, MSG_META_VM_FILE_DIRTY uses ax, bx, cx, dx, es, di, ds, si, bp .enter tst ss:[currentDoc].handle ; engine mode? jz done GetResourceHandleNS ScrapAppDocControl, bx mov si, offset ScrapAppDocControl mov ax, MSG_GEN_DOCUMENT_GROUP_MARK_DIRTY_BY_FILE clr di call ObjMessage done: .leave ret ScrapBookVMFileDirty endm ScrapBookTextUserModified method ScrapBookClass, MSG_META_TEXT_USER_MODIFIED GetResourceHandleNS ScrapName, bx cmp cx, bx jne done cmp dx, offset ScrapName jne done ; ; we need to ensure that the text object is actually dirty as the ; SET_TEXT-followed-by-SET_CLEAN sequence will queue up a USER_MODIFIED ; but the text object is actually clean ; mov si, dx ; bx:si = text object mov ax, MSG_VIS_TEXT_GET_USER_MODIFIED_STATE mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage ; cx = 0 if clean jcxz done ; clean, do nothing ; ; text is genuinely dirty ; if 0 mov cx, ss:[currentScrapFile] ; cx = file handle jcxz done call ScrapBookVMFileDirty else mov bx, ss:[currentScrapFile] ; bx = file handle tst bx jz done call VMGetMapBlock call VMLock ; bp = mem handle call VMDirty ; this generates MSG_META_VM_FILE_DIRTY call VMUnlock endif done: ret ScrapBookTextUserModified endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookDocOutputInitializeDocumentFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: ScrapBookDocOutputInitializeDocumentFile CALLED BY: MSG_META_DOC_OUTPUT_INITIALIZE_DOCUMENT_FILE PASS: cx:dx = document object bp = file handle of new file RETURN: carry clear for no error DESTROYED: PSEUDO CODE/STRATEGY: remove current scrapbook from memory KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 02/27/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookDocOutputInitializeDocumentFile method ScrapBookClass, MSG_META_DOC_OUTPUT_INITIALIZE_DOCUMENT_FILE mov ss:[currentScrapFile], bp ; use new file movdw ss:[currentDoc], cxdx ; ; We want to be notified when the block is dirty, and we also want ; the block to be asynchronously updated, so set/clear those bits... ; mov bx, bp if NO_BACKUP mov ax, mask VMA_NOTIFY_DIRTY or ((mask VMA_SYNC_UPDATE or mask VMA_BACKUP) shl 8) else mov ax, mask VMA_NOTIFY_DIRTY or (mask VMA_SYNC_UPDATE shl 8) endif call VMSetAttributes ; ; create index block ; mov cx, size ScrapBookIndexHeader call VMAlloc call VMSetMapBlock ; use as index block call VMLock mov es, ax mov es:[SBIH_numScraps], 0 ; no scraps yet call VMDirty call VMUnlock call VMSave ; save initial stuff (now ; that we have a ; consistent file) tst ss:[currentDoc].handle jz done ; that's all for engine mode ; ; set up stuff for new scrapbook file ; mov ss:[currentScrap], 0 ; no current scrap call ClearScrapView ; no scrap to show ; ; active previous, next buttons ; call EnableScrapBook done: clc ; return no error ret ScrapBookDocOutputInitializeDocumentFile endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookDocOutputAttachUItoDocument %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: ScrapBookDocOutputAttachUItoDocument CALLED BY: MSG_META_DOC_OUTPUT_ATTACH_UI_TO_DOCUMENT PASS: cx:dx = document object bp = file handle of file RETURN: carry clear for no error DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 02/27/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookDocOutputAttachUItoDocument method ScrapBookClass, MSG_META_DOC_OUTPUT_ATTACH_UI_TO_DOCUMENT mov ss:[currentScrapFile], bp ; use new file movdw ss:[currentDoc], cxdx mov bx, bp ; ; check if valid scrapbook file ; call VMGetMapBlock tst ax ; any map block? jz error ; no, bad file ; ; other checks ; jmp short fileOK error: mov es:[currentScrap], 0 ; no current scrap mov es:[currentScrapFile], 0 mov bp, offset InvalidScrapBookFileString call ScrapError if 0 ; ; after reporting bad scrapbook file error, close the scrapbook file ; mov ax, MSG_GEN_APP_DOCUMENT_CONTROL_CLOSE_DOC clr cx ; only one file mov dx, cx GetResourceHandleNS ScrapAppDocControl, bx mov si, offset ScrapAppDocControl mov di, mask MF_FORCE_QUEUE call ObjMessage jmp short done else ; let document control handle the error -- brianc 4/17/91 stc ; indicate error jmp short exit endif fileOK: ; ; display first scrap; or last viewed page, if restoring from state ; mov ax, ss:[lastViewedPage] mov ss:[currentScrap], ax call ShowCurrentScrap ; ; active previous, next buttons ; call EnableScrapBook ; ; reset scrap name list ; mov di, mask MF_CALL call ResetScrapNameList ;done: clc ; return no error exit: ret ScrapBookDocOutputAttachUItoDocument endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookDocOutputWriteCachedDataToFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: ScrapBookDocOutputWriteCachedDataToFile CALLED BY: MSG_META_DOC_OUTPUT_WRITE_CACHED_DATA_TO_FILE PASS: cx:dx = document control object bp = file handle of file to save to RETURN: carry clear for no error ax = 0 to queue remainder of save ax <> 0 to NOT queue remainder of save DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 01/02/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookDocOutputWriteCachedDataToFile method ScrapBookClass, MSG_META_DOC_OUTPUT_WRITE_CACHED_DATA_TO_FILE call SaveCurrentScrapName ; returns ax = 0 if name saved ; --> queue save clc ; return no error ; ; nothing specific for us to do, document control handles it ; ret ScrapBookDocOutputWriteCachedDataToFile endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookDocOutputSaveAsCompleted %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: ScrapBookDocOutputSaveAsCompleted CALLED BY: MSG_META_DOC_OUTPUT_SAVE_AS_COMPLETED PASS: cx:dx = document bp = new file handle RETURN: carry clear for no error DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 04/20/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookDocOutputSaveAsCompleted method ScrapBookClass, \ MSG_META_DOC_OUTPUT_SAVE_AS_COMPLETED mov ss:[currentScrapFile], bp ; use new file ; ; nothing specific for us to do, document control handles it ; clc ; return no error ret ScrapBookDocOutputSaveAsCompleted endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookDocOutputReadCachedDataFromFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: ScrapBookDocOutputReadCachedDataFromFile CALLED BY: MSG_META_DOC_OUTPUT_READ_CACHED_DATA_FROM_FILE PASS: RETURN: carry clear for no error DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 04/20/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookDocOutputReadCachedDataFromFile method ScrapBookClass, \ MSG_META_DOC_OUTPUT_READ_CACHED_DATA_FROM_FILE ; ; save scrap name, if needed ; (this shouldn't be needed as revert will undo this change, if this ; change is actually made?) ; call SaveCurrentScrapName ; ; clear stuff, in case we revert to nothing, we will open the revert ; file again later, anyway ; mov es:[currentScrapFile], 0 mov es:[currentScrap], 0 ; no current scrap call ClearScrapView clc ; return no error ret ScrapBookDocOutputReadCachedDataFromFile endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookDocOutputDestroyUIForDocument %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: ScrapBookDocOutputDestroyUIForDocument CALLED BY: MSG_META_DOC_OUTPUT_DESTROY_UI_FOR_DOCUMENT PASS: cx:dx - document control object bp - file handle of file being closed RETURN: carry clear for no error DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 02/28/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookDocOutputDestroyUIForDocument method ScrapBookClass, MSG_META_DOC_OUTPUT_DESTROY_UI_FOR_DOCUMENT mov bx, 0 ; assume not detach -- set ; lastViewedPage to 0 mov ax, MSG_GEN_APPLICATION_GET_STATE call GenCallApplication ; al - ApplicationStates test al, mask AS_DETACHING ; check if detaching jz notDetach ; nope mov bx, es:[currentScrap] ; if so, save last viewed page ; as current page notDetach: mov es:[lastViewedPage], bx mov es:[currentScrapFile], 0 mov es:[currentScrap], 0 ; no current scrap call ClearScrapView ; ; de-active previous, next buttons ; call DisableScrapBook clc ; return no error ret ScrapBookDocOutputDestroyUIForDocument endm ScrapBookDocOutputDetachUI method ScrapBookClass, MSG_META_DOC_OUTPUT_DETACH_UI_FROM_DOCUMENT mov bx, es:[currentScrap] ; save last viewed page mov es:[lastViewedPage], bx ; ...to be the current page mov es:[currentScrapFile], 0 mov es:[currentScrap], 0 ; no current scrap call ClearScrapView ; ; de-active previous, next buttons ; call DisableScrapBook clc ; return no error ret ScrapBookDocOutputDetachUI endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookDocOutputUpdateEarlierIncompatibleDocument %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Convert a 1.X document to 2.0 CALLED BY: MSG_META_DOC_OUTPUT_UPDATE_EARLIER_INCOMPATIBLE_DOCUMENT PASS: ds = es = dgroup bp = VM file handle RETURN: carry clear for no error ax - non-zero to up protocol DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 10/28/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if not DBCS_PCGEOS convertLibDir char CONVERT_LIB_DIR convertLibPath char CONVERT_LIB_PATH endif ScrapBookDocOutputUpdateEarlierIncompatibleDocument method ScrapBookClass, MSG_META_DOC_OUTPUT_UPDATE_EARLIER_INCOMPATIBLE_DOCUMENT if DBCS_PCGEOS stc ;don't load conversion library; return error else ; Load the conversion library segmov ds, cs mov bx, CONVERT_LIB_DISK_HANDLE mov dx, offset convertLibDir call FileSetCurrentPath mov si, offset convertLibPath mov ax, CONVERT_PROTO_MAJOR mov bx, CONVERT_PROTO_MINOR call GeodeUseLibrary ; bx = library jc done push bx ; save library handle mov ax, enum ConvertOldScrapbookDocument call ProcGetLibraryEntry call ProcCallFixedOrMovable pop bx call GeodeFreeLibrary mov ax, -1 ; up protocol, please clc ; indicate no error done: endif ret ScrapBookDocOutputUpdateEarlierIncompatibleDocument endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SaveCurrentScrapName %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: save user-entered name for current scrap CALLED BY: INTERNAL PASS: ds - object block RETURN: ax = 0 if name changed and saved ax = -1 if name unchanged and NOTHING saved DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 03/01/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SaveCurrentScrapName proc near uses bx, cx, dx, si, es, di, bp .enter ; ; check if any scraps; if none, no name to save ; call GetNumScraps ; cx = number of scraps jcxz clean ; no scraps -> no name to save ; ; check if name was dirtied ; GetResourceHandleNS ScrapName, bx mov si, offset ScrapName mov ax, MSG_VIS_TEXT_GET_USER_MODIFIED_STATE mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ; cx = 0 if object is clean jcxz clean ; text clean, don't save again ; ; get scrap name, if any ; mov ax, MSG_VIS_TEXT_GET_ALL_BLOCK clr dx ; allocate new block mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ;if name is null, clear old name - 8/13/90 ; tst cx ; any name? ; jz clean ; no ; ; name changed, save in scrap block ; call SaveNameInScrap ; ; mark text as being clean again ; GetResourceHandleNS ScrapName, bx mov si, offset ScrapName mov ax, MSG_VIS_TEXT_SET_NOT_USER_MODIFIED mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ; ; reset scrap name list ; mov di, mask MF_CALL or mask MF_FIXUP_DS call ResetScrapNameList mov ax, 0 ; indicate name saved jmp short done clean: mov ax, -1 ; indicate no name saved done: .leave ret SaveCurrentScrapName endp ; ; Pass: ; cx = block handle of new name ; ax = length w/o null ; SaveNameInScrap proc near uses ds .enter push cx ; save name block handle GetResourceSegmentNS dgroup, es call ScrapBookLockMap mov es, ax call GetCurrentScrapIndexOffset mov di, si ; es:di = index entry for scrap mov ax, es:[di].SBIE_vmBlock ; ax = transfer header block call VMUnlock ; unlock map block call VMLock ; lock transfer header block call VMDirty ; mark as dirty - new name mov es, ax ; es = name field in transfer mov di, offset CIH_name ; header block SBCS< mov {char} es:[di], 0 ; in case no name > DBCS< mov {wchar} es:[di], 0 ; in case no name > pop bx tst bx ; any name? jz afterName call MemLock ; lock name block mov ds, ax ; ds:si = null-term'ed name clr si mov cx, length CIH_name ; plus null LocalCopyNString call MemUnlock ; unlock handle bx afterName: call VMUnlock ; unlock handle bp .leave ret SaveNameInScrap endp ; ; di = ObjMessage flags ; ResetScrapNameList proc near GetResourceHandleNS ScrapNameList, bx mov si, offset ScrapNameList mov ax, MSG_GEN_DYNAMIC_LIST_INITIALIZE call GetNumScraps ; cx = number of scraps push di ; save MessageFlags call ObjMessage pop di ; retrieve MessageFlags mov cx, ss:[currentScrap] ; select current scrap cmp cx, -1 je exit ; no current scrap clr dx ; not indeterminate mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION call ObjMessage exit: ret ResetScrapNameList endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookScrapNameCR %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: User pressed <CR> in scrap name entry field, save current scrap name. CALLED BY: MSG_SCRAPBOOK_SCRAPNAME_CR PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 04/24/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookScrapNameCR method ScrapBookClass, MSG_SCRAPBOOK_SCRAPNAME_CR call SaveCurrentScrapName ret ScrapBookScrapNameCR endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% {Enable,Disable}ScrapBook %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: enable or disable "previous" and "next" controls CALLED BY: INTERNAL PASS: nothing RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 02/28/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ EnableScrapBook proc near mov ss:[canPaste], TRUE mov ax, MSG_GEN_SET_ENABLED call AbleCommon ; ; disable scrap name field if there are no scraps ; call GetNumScraps ; cx = number of scraps cmp cx, 1 je disableOne ; disable one scrap items ja skipName ; if > 1 scraps exist, don't disable call DisableNoScrapItems jmp short skipName disableOne: call DisableOneScrapItems skipName: ; ; enable paste button if there is something to paste ; call ScrapBookNotifyNormalTransferItemChanged ret EnableScrapBook endp DisableNoScrapItems proc near GetResourceHandleNS ScrapName, bx mov si, offset ScrapName call SendDisableMessage GetResourceHandleNS DeleteTrigger, bx mov si, offset DeleteTrigger call SendDisableMessage GetResourceHandleNS CutTrigger, bx mov si, offset CutTrigger call SendDisableMessage GetResourceHandleNS CopyTrigger, bx mov si, offset CopyTrigger call SendDisableMessage GetResourceHandleNS ScrapNameControlShow, bx mov si, offset ScrapNameControlShow call SendDisableMessage GetResourceHandleNS ScrapPrevious, bx mov si, offset ScrapPrevious call SendDisableMessage GetResourceHandleNS ScrapNext, bx mov si, offset ScrapNext call SendDisableMessage GetResourceHandleNS ScrapNameBoxTrigger, bx mov si, offset ScrapNameBoxTrigger call SendDisableMessage ret DisableNoScrapItems endp DisableOneScrapItems proc near GetResourceHandleNS ScrapPrevious, bx mov si, offset ScrapPrevious call SendDisableMessage GetResourceHandleNS ScrapNext, bx mov si, offset ScrapNext call SendDisableMessage GetResourceHandleNS ScrapNameBoxTrigger, bx mov si, offset ScrapNameBoxTrigger call SendDisableMessage ret DisableOneScrapItems endp SendDisableMessage proc near mov ax, MSG_GEN_SET_NOT_ENABLED call SendAbleMessage ret SendDisableMessage endp SendAbleMessage proc near push ax mov dl, VUM_NOW mov di, mask MF_CALL call ObjMessage pop ax ret SendAbleMessage endp DisableScrapBook proc far mov ss:[canPaste], FALSE mov ax, MSG_GEN_SET_NOT_ENABLED call AbleCommon ; ; disable these also ; GetResourceHandleNS PasteTrigger, bx mov si, offset PasteTrigger call SendAbleMessage GetResourceHandleNS PasteAtEndTrigger, bx mov si, offset PasteAtEndTrigger call SendAbleMessage ret DisableScrapBook endp ; ; ax = method to send ; AbleCommon proc near GetResourceHandleNS ScrapNext, bx mov si, offset ScrapNext call SendAbleMessage GetResourceHandleNS ScrapPrevious, bx mov si, offset ScrapPrevious call SendAbleMessage GetResourceHandleNS ScrapNameBox, bx mov si, offset ScrapNameBox call SendAbleMessage GetResourceHandleNS ScrapNameBoxTrigger, bx mov si, offset ScrapNameBoxTrigger call SendAbleMessage GetResourceHandleNS ScrapNameControlShow, bx mov si, offset ScrapNameControlShow call SendAbleMessage GetResourceHandleNS ScrapName, bx mov si, offset ScrapName call SendAbleMessage GetResourceHandleNS ScrapNumber, bx mov si, offset ScrapNumber call SendAbleMessage GetResourceHandleNS CutTrigger, bx mov si, offset CutTrigger call SendAbleMessage GetResourceHandleNS DeleteTrigger, bx mov si, offset DeleteTrigger call SendAbleMessage GetResourceHandleNS CopyTrigger, bx mov si, offset CopyTrigger call SendAbleMessage GetResourceHandleNS ScrapBody, bx mov si, offset ScrapBody call SendAbleMessage GetResourceHandleNS ScrapBookImporter, bx mov si, offset ScrapBookImporter call SendAbleMessage ret AbleCommon endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ClearScrapView %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: clear scrapbook display CALLED BY: INTERNAL ScrapBookFileNew ScrapBookFileClose ScrapBookFileRevertPart1 PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 02/27/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ClearScrapView proc near GetResourceHandleNS ScrapName, bx mov si, offset ScrapName mov ax, MSG_GEN_SET_NOT_ENABLED call SendAbleMessage ; ; clear whatever mode we are in ; cmp ss:[currentFormat], CIF_TEXT je clearText ; ; clear gstring view ; call InvalViewWindow jmp afterClear clearText: ; ; clear text view ; call ClearTextArea afterClear: ; ; clear scrap number ; GetResourceHandleNS EmptyScrapbookString, bx push bx call MemLock push ds mov dx, ax ; dx = segment of string mov ds, ax mov si, offset EmptyScrapbookString mov bp, ds:[si] ; deref. string chunk pop ds clr cx ; null-terminated GetResourceHandleNS ScrapNumber, bx mov si, offset ScrapNumber mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR mov di, mask MF_CALL call ObjMessage pop bx call MemUnlock ; unlock string block ; ; clear scrap name area ; mov dx, cs mov bp, offset nullString clr cx ; null-terminated GetResourceHandleNS ScrapName, bx mov si, offset ScrapName mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR mov di, mask MF_CALL call ObjMessage ; ; clear scrap name list ; GetResourceHandleNS ScrapNameList, bx mov si, offset ScrapNameList mov ax, MSG_GEN_DYNAMIC_LIST_INITIALIZE mov cx, 0 ; no entries mov di, mask MF_CALL call ObjMessage ret ClearScrapView endp InvalViewWindow proc near mov di, ss:[gStringWindow] tst di jz done clr ax, bx, bp mov cx, MAX_COORD mov dx, cx call WinInvalReg ; clear it (forces redraw) done: ret InvalViewWindow endp ; ; pass: ; di = ObjMessage flags ; ClearTextArea proc near ; ; first, clear any old text ; GetResourceHandleNS ScrapText, bx mov si, offset ScrapText mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR mov dx, cs mov bp, offset nullString clr cx ; null-terminated mov di, mask MF_CALL call ObjMessage ;turned back on - brianc 2/25/93 if 1 ; ; second, clear any old style and ruler info ; mov ax, MSG_VIS_TEXT_SET_PARA_ATTR_BY_DEFAULT ; clear ruler mov dx, size VisTextSetParaAttrByDefaultParams sub sp, dx mov bp, sp mov ss:[bp].VTSPABDP_range.VTR_start.low, 0 mov ss:[bp].VTSPABDP_range.VTR_start.high, 0 mov ss:[bp].VTSPABDP_range.VTR_end.low, TEXT_ADDRESS_PAST_END_LOW mov ss:[bp].VTSPABDP_range.VTR_end.high, TEXT_ADDRESS_PAST_END_HIGH mov ss:[bp].VTSPABDP_paraAttr, VIS_TEXT_INITIAL_PARA_ATTR mov di, mask MF_CALL or mask MF_STACK call ObjMessage add sp, size VisTextSetParaAttrByDefaultParams mov ax, MSG_VIS_TEXT_SET_CHAR_ATTR_BY_DEFAULT ; clear styles mov dx, size VisTextSetCharAttrByDefaultParams sub sp, dx mov bp, sp mov ss:[bp].VTSPABDP_range.VTR_start.low, 0 mov ss:[bp].VTSPABDP_range.VTR_start.high, 0 mov ss:[bp].VTSPABDP_range.VTR_end.low, TEXT_ADDRESS_PAST_END_LOW mov ss:[bp].VTSPABDP_range.VTR_end.high, TEXT_ADDRESS_PAST_END_HIGH NPZ < mov ss:[bp].VTSCABDP_charAttr, (VTDS_10 shl offset VTDCA_SIZE) or (VTDF_BERKELEY) > PZ < mov ss:[bp].VTSCABDP_charAttr, (VTDS_16 shl offset VTDCA_SIZE) or (VTDF_PIZZA_KANJI) > mov di, mask MF_CALL or mask MF_STACK call ObjMessage add sp, size VisTextSetCharAttrByDefaultParams endif ret ClearTextArea endp LocalDefNLString nullString <0> ; Pass: ss: dgroup ; Return: ax - segment of map block ; bx - scrapbook file handle ; bp - handle of map block ScrapBookLockMap proc near mov bx, ss:[currentScrapFile] call VMGetMapBlock call VMLock ret ScrapBookLockMap endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ShowCurrentScrap %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: displays current scrap of opened scrapbook CALLED BY: INTERNAL ScrapBookNext ScrapBookPrevious ScrapBookFileOpen PASS: nothing RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 02/28/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ShowCurrentScrap proc near call ScrapBookLockMap push bp mov ds, ax ; ds = segment of index block mov dx, ds:[SBIH_numScraps] ; any scraps? tst dx LONG jz exit ; no, nothing to draw cmp ss:[currentScrap], dx ; deal with bogus scrap numbers jb curScrapOK mov ss:[currentScrap], 0 curScrapOK: call GetCurrentScrapIndexOffset ; ds:si = entry for current ; scrap in index block ; ; get scrap from index block ; mov bx, ss:[currentScrapFile] mov ax, ds:[si].SBIE_vmBlock call VMLock push bp mov ds, ax ; ; show scrap number ; dx = number of scraps ; call ShowScrapNumber ; ; show name of scrap ; call ShowScrapName ; ; set the appropriate view contents to show the scrap ; mov ax, MANUFACTURER_ID_GEOWORKS mov dx, CIF_BITMAP call findFormat jnc found mov dx, CIF_GRAPHICS_STRING call findFormat jnc found mov dx, CIF_TEXT call findFormat jnc found ; ; no gstring or text found, use first format, and report error ; mov cx, ds:[CIH_formats].CIFI_format.CIFID_manufacturer mov dx, ds:[CIH_formats].CIFI_format.CIFID_type call SetScrapViewContent jmp done found: mov cx, ax ; cx,dx = format push bx, dx ; save offset, type found call SetScrapViewContent pop bx, dx ; restore offset, type found EC < ERROR_C -1 > ; ax = most appropriate item mov ax, ds:[CIH_formats][bx].CIFI_vmChain.high ; ; we know formatManufacturer = MANUFACTURER_ID_GEOWORKS ; bx = offset ; dx = CIF_TEXT, CIF_GRAPHICS_STRING, or CIF_BITMAP ; cmp dx, CIF_TEXT ; text? je showText ; yes cmp dx, CIF_GRAPHICS_STRING je showGString showBitmap:: push ax mov bx, ss:[currentScrapFile] mov di, ax call GrGetHugeBitmapSize mov_tr cx, ax mov dx, bx pop ax jmp checkSizes showGString: ; ; set document size for this gstring ; bx = offset ; mov cx, ds:[CIH_formats][bx].CIFI_extra1 ; width mov dx, ds:[CIH_formats][bx].CIFI_extra2 ; height checkSizes: cmp cx, 7fffh ; 16 bit max jbe widthOkay ; unsigned compare mov cx, 7fffh widthOkay: cmp dx, 7fffh ; 16 bit max jbe heightOkay ; unsigned compare mov dx, 7fffh heightOkay: GetResourceHandleNS ScrapGString, bx mov si, offset ScrapGString push ds clr di call GenViewSetSimpleBounds pop ds jmp done showText: push ax ; save VM block handle of scrap ; ; clear any old text and style and ruler ; call ClearTextArea pop ax ; ; Determine if there is little enough text that we can just do a ; MSG_VIS_TEXT_REPLACE_WITH_TEXT_TRANSFER_ITEM. If not, we'll ; just show some of the text with MSG_VIS_TEXT_REPLACE_ALL_PTR. ; ax = VM block handle of scrap item (TextTransferBlockHeader) ; push ds, ax mov bx, ss:[currentScrapFile] call VMLock ; bp = mem handle, ax = seg mov ds, ax mov di, ds:[TTBH_text].high call HugeArrayGetCount ; dx:ax = count mov cx, ax ; dx:cx = count call VMUnlock pop ds, ax tst dx ; if > 64K, too big jnz tooBig cmp cx, SHOWABLE_TEXT_SIZE_THRESHOLD jbe smallEnough tooBig: ; ; use MSG_VIS_TEXT_REPLACE_ALL_PTR with some of the text ; di = HA text block ; push ds mov bx, ss:[currentScrapFile] mov ax, 0 ; start at first element mov dx, ax call HugeArrayLock ; ds:si = element, ax = count EC <SBCS < cmp dx, 1 >> EC <DBCS < cmp dx, (size wchar) >> EC < ERROR_NE 0 > movdw dxbp, dssi ; dxbp = ptr mov cx, ax ; cx = count mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR GetResourceHandleNS ScrapText, bx mov si, offset ScrapText mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage call HugeArrayUnlock ; ; add reminder to end ; mov si, offset TextOverflowString GetResourceHandleNS ScrapStrings, bx push bx call MemLock ; ax = string segment mov dx, ax ; dx:bp = error string mov ds, ax mov bp, ds:[si] GetResourceHandleNS ScrapText, bx ; then set error message mov si, offset ScrapText mov ax, MSG_VIS_TEXT_APPEND_PTR clr cx ; null-terminated mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop bx call MemUnlock pop ds jmp short done smallEnough: ; ; set up params for MSG_VIS_TEXT_REPLACE_WITH_TEXT_TRANSFER_ITEM ; ax = VM block handle of scrap item ; mov dx, size CommonTransferParams sub sp, dx mov bp, sp mov ss:[bp].CTP_range.VTR_start.low, 0 mov ss:[bp].CTP_range.VTR_start.high, 0 movdw ss:[bp].CTP_range.VTR_end, TEXT_ADDRESS_PAST_END mov ss:[bp].CTP_pasteFrame, 0 mov ss:[bp].CTP_vmBlock, ax mov ax, ss:[currentScrapFile] mov ss:[bp].CTP_vmFile, ax GetResourceHandleNS ScrapText, bx mov si, offset ScrapText mov ax, MSG_VIS_TEXT_REPLACE_WITH_TEXT_TRANSFER_FORMAT mov di, mask MF_CALL or mask MF_STACK call ObjMessage add sp, size CommonTransferParams done: pop bp ; unlock transfer item block call VMUnlock exit: pop bp ; unlock map block call VMUnlock ret ;-------------------- findFormat: ; ax:dx - format to find ; clr bx mov cx, ds:[CIH_formatCount] ; cx = num formats findLoop: cmp ds:[CIH_formats][bx].CIFI_format.CIFID_manufacturer, ax jne findNext cmp ds:[CIH_formats][bx].CIFI_format.CIFID_type, dx je findDone findNext: add bx, size ClipboardItemFormatInfo loop findLoop stc findDone: retn ShowCurrentScrap endp ShowScrapName proc near mov dx, ds ; dx:bp = scrap name mov bp, offset CIH_name clr cx ; null-terminated GetResourceHandleNS ScrapName, bx mov si, offset ScrapName mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR mov di, mask MF_CALL call ObjMessage mov ax, MSG_VIS_TEXT_SELECT_START mov di, mask MF_CALL call ObjMessage ; reposition to beginning ret ShowScrapName endp ; ; pass: dx = number of scraps ; ss:bp = important struct ptr with [currentScrap]. ; hose: ax, bx, cx, dx, es ; ShowScrapNumber proc near FORMAT_BUFFER_LENGTH equ 38 ; (doesn't included NULL) uses ds .enter SBCS< sub sp, FORMAT_BUFFER_LENGTH+2 ; plenty of room > DBCS< sub sp, (FORMAT_BUFFER_LENGTH+1)*(size wchar) > segmov es, ss mov di, sp ; es:di = buffer GetResourceHandleNS PageNumberString, bx call MemLock mov ds, ax ; ds = string segment mov si, offset PageNumberString mov si, ds:[si] ; ds:si = page number string clr cx charLoop: LocalGetChar ax, dssi LocalIsNull ax ; end of string? jz stringDone ; yes LocalCmpChar ax, 01h ; current page param? jne notCurPage ; nope mov ax, ss:[currentScrap] ; 0-base current scrap inc ax ; ax = scrap # cmp cx, FORMAT_BUFFER_LENGTH - 6 ; enough room? (6=len("65536")) ja nextChar ; nope, skip call ASCIIizeWordAX ; place ASCII # in buffer add cx, 6 ; bump char count jmp short nextChar notCurPage: LocalCmpChar ax, 02h ; num pages param? jne notNumPage ; nope mov ax, dx ; ax = number of pages cmp cx, FORMAT_BUFFER_LENGTH - 6 ; enough room? (6=len("65536")) ja nextChar ; nope, skip call ASCIIizeWordAX ; (points di past end) add cx, 6 ; bump char count jmp short nextChar notNumPage: cmp cx, FORMAT_BUFFER_LENGTH ; enough room? ja nextChar ; nope, skip LocalPutChar esdi, ax ; copy character verbatim inc cx nextChar: jmp short charLoop stringDone: LocalPutChar esdi, ax ; store null-terminator call MemUnlock ; unlock string resource mov dx, ss ; dx:bp = scrap number mov bp, sp clr cx ; null-terminated GetResourceHandleNS ScrapNumber, bx mov si, offset ScrapNumber mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR mov di, mask MF_CALL call ObjMessage SBCS< add sp, FORMAT_BUFFER_LENGTH+2 ; remove stack buffer > DBCS< add sp, (FORMAT_BUFFER_LENGTH+1)*(size wchar) ; remove stack buffer > ; ; select current scrap in scrap name list ; call SetCurrentScrapInScrapNameList ; ; enable or disable the previous and next triggers based on the ; current scrap shown. -- jwu 11/3/93 ; call ScrapbookSetPreviousAndNext .leave ret ShowScrapNumber endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapbookSetPreviousAndNext %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Enable the previous/next triger only if there is a previous/next scrap, else disable it. Wraparound is allowed. Also, "Go To Page" trigger is disabled here if there is only one scrap in the scrapbook, and enabled otherwise. CALLED BY: ShowScrapNumber PASS: nothing RETURN: nothing DESTROYED: ax, bx, cx, dx, di, si PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- jwu 11/ 3/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapbookSetPreviousAndNext proc near ; ; If the number of scraps is two, it may mean that a new scrap was ; just added, in which case we want to make sure that the triggers ; are enabled. If there are more than 2, then we know that the ; triggers are already enabled so we don't have to do anything. ; call GetNumScraps ; cx <- number of scraps cmp cx, 2 ja done ; ; If there is only one scrap, then disable the previous and ; next triggers and the "Go To Page" trigger. ; mov ax, MSG_GEN_SET_NOT_ENABLED jb sendMessage mov ax, MSG_GEN_SET_ENABLED sendMessage: GetResourceHandleNS ScrapNameBoxTrigger, bx mov si, offset ScrapNameBoxTrigger call SendAbleMessage GetResourceHandleNS ScrapPrevious, bx mov si, offset ScrapPrevious call SendAbleMessage GetResourceHandleNS ScrapNext, bx mov si, offset ScrapNext call SendAbleMessage done: ret ScrapbookSetPreviousAndNext endp SetCurrentScrapInScrapNameList proc near GetResourceHandleNS ScrapNameList, bx mov si, offset ScrapNameList mov cx, ss:[currentScrap] ; cx = 0-based current scrap clr dx ; not indeterminate mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION mov di, mask MF_CALL call ObjMessage ret SetCurrentScrapInScrapNameList endp ; ; PASS: ax = unsigned value to convert ; es:di = buffer to store string. ; RETURN: es:di = pointing after last character ; HOSED: ax ; ASCIIizeWordAX proc near push bx, cx, dx mov bx, 10 ; print in base ten clr cx AWA_nextDigit: clr dx div bx add dl, '0' ; convert to ASCII push dx ; save resulting character inc cx ; bump character count tst ax ; check if done jnz AWA_nextDigit ; if not, do next digit AWA_nextChar: pop ax ; retrieve character (in AL) LocalPutChar esdi, ax ; stuff in buffer > loop AWA_nextChar ; loop to stuff all pop bx, cx, dx ret ASCIIizeWordAX endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SetScrapViewContent %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: sets correct object in scrapbook window to draw specified scrap CALLED BY: INTERNAL ShowCurrentScrap PASS: cx:dx = transfer item format (cx - format manufacturer, dx - format type) RETURN: carry clear if successful carry set if error (unsupported format) DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 02/27/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SetScrapViewContent proc far cmp cx, MANUFACTURER_ID_GEOWORKS jne unknownFormat cmp dx, CIF_GRAPHICS_STRING je tifGString cmp dx, CIF_BITMAP je tifBitmap cmp dx, CIF_TEXT jne unknownFormat call SetTifText jmp noError unknownFormat: pushdw cxdx ; save format mov bp, offset UnsupportedScrapFormatString call ScrapError call SetTifText ; then switch to text mode popdw cxdx ; cxdx = type ; then set status message ; based on type cmp cx, MANUFACTURER_ID_GEOWORKS jne unsupportedType mov bp, offset SpreadsheetTypeString cmp dx, CIF_SPREADSHEET je haveTypeString mov bp, offset InkTypeString cmp dx, CIF_INK je haveTypeString mov bp, offset GrObjTypeString cmp dx, CIF_GROBJ je haveTypeString mov bp, offset GeodexTypeString cmp dx, CIF_GEODEX je haveTypeString unsupportedType: mov bp, offset UnsupportedTypeString haveTypeString: GetResourceHandleNS ScrapStrings, dx ; ^ldx:bp - string GetResourceHandleNS ScrapText, bx ; then set error message mov si, offset ScrapText mov ax, MSG_VIS_TEXT_REPLACE_ALL_OPTR clr cx, di call ObjMessage stc ; indicate unsupported format jmp done tifBitmap: mov ss:[currentFormat], CIF_BITMAP jmp bitmapGStringCommon tifGString: mov ss:[currentFormat], CIF_GRAPHICS_STRING bitmapGStringCommon: GetResourceHandleNS ScrapText, bx mov si, offset ScrapText mov ax, MSG_GEN_SET_NOT_USABLE mov dl, VUM_DELAYED_VIA_APP_QUEUE clr di call ObjMessage GetResourceHandleNS ScrapGString, bx mov si, offset ScrapGString mov ax, MSG_GEN_SET_USABLE mov dl, VUM_DELAYED_VIA_APP_QUEUE clr di call ObjMessage mov ax, MSG_META_GRAB_TARGET_EXCL clr di call ObjMessage ; ; if no focus yet, grab it ; ^lbx:si = ScrapView ; call GrabFocusIfNone call InvalViewWindow ; clear it (forces redraw) noError: clc ; indicate no error done: ret ; <-- EXIT HERE SetScrapViewContent endp SetTifText proc near cmp ss:[currentFormat], CIF_TEXT je alreadyTifText mov ss:[currentFormat], CIF_TEXT mov ss:[gStringWindow], 0 GetResourceHandleNS ScrapGString, bx mov si, offset ScrapGString mov ax, MSG_GEN_SET_NOT_USABLE mov dl, VUM_DELAYED_VIA_APP_QUEUE mov di, mask MF_CALL call ObjMessage GetResourceHandleNS ScrapText, bx mov si, offset ScrapText mov ax, MSG_GEN_SET_USABLE mov dl, VUM_DELAYED_VIA_APP_QUEUE mov di, mask MF_CALL call ObjMessage ; ; set up text object ; call ClipboardGetClipboardFile mov cx, bx GetResourceHandleNS ScrapText, bx mov si, offset ScrapText mov ax, MSG_VIS_TEXT_SET_VM_FILE mov di, mask MF_CALL call ObjMessage alreadyTifText: ; ; if no focus yet, grab it ; GetResourceHandleNS ScrapText, bx mov si, offset ScrapText call GrabFocusIfNone ret SetTifText endp ; ; pass: ; ^lbx:si = object to grab focus if none ; GrabFocusIfNone proc near push bx, si GetResourceHandleNS ScrapBookPrimary, bx mov si, offset ScrapBookPrimary mov ax, MSG_META_GET_FOCUS_EXCL mov di, mask MF_CALL call ObjMessage ; carry set if response, ^lcx:dx pop bx, si ; ^lbx:si = object to grab focus jnc grabFocus ; no response, grab focus tst cx jnz done ; have focus already, leave it grabFocus: mov ax, MSG_META_GRAB_FOCUS_EXCL mov di, mask MF_CALL call ObjMessage done: ret GrabFocusIfNone endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookDelete %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: delete current scrap CALLED BY: MSG_META_DELETE PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 06/19/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookDelete method ScrapBookClass, MSG_META_DELETE mov ax, FALSE ; no copying scrap call DeleteCutCommon ; common handling ret ScrapBookDelete endm if HEADER_SIZE_CHECKING ; ; check file size, warning if getting too big ; pass: nothing ; return: carry set to abort operation ; FileSizeWarning proc near uses ax, bx, cx, dx .enter mov bx, ss:[currentScrapFile] tst bx jz abortOp ; no file, abort call VMGetHeaderInfo ; cx = byte size cmp cx, ss:[warningSize] cmc ; C set if cx < warningSize jnc done ; C clear if ... cmp cx, ss:[errorSize] ; this is just too big ja abortWithError tstdw ss:[currentDoc] ;; jz engineMode ;;since we only use this in browser, we'll just report error -- brianc 1/31/01 jz abortWithError push bp mov bp, offset ScrapSizeWarning call ScrapQuery ; ax = IC_ pop bp cmp ax, IC_YES je done ; C clear to continue abortOp: stc ; else, abort operation done: .leave ret abortWithError: push bp mov bp, offset ScrapTooBigError call ScrapError pop bp jmp short abortOp ;;engineMode: ;; ; if engine mode, just beep and cancel operation ;; mov ax, SST_ERROR ;; call UserStandardSound ;; jmp short abortOp FileSizeWarning endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookCut %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: cut current scrap to clipboard CALLED BY: MSG_META_CLIPBOARD_CUT PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 02/27/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookCut method ScrapBookClass, MSG_META_CLIPBOARD_CUT mov ax, TRUE ; copy to scrap call DeleteCutCommon ; common handling ret ScrapBookCut endm ; ; pass: ; ax = TRUE to copy current scrap to clipboard ; ax = FALSE to not copy ; DeleteCutCommon proc near if HEADER_SIZE_CHECKING if NO_BACKUP ; delete won't enlarge header if no backup else call FileSizeWarning jc exit endif endif ; ; check if any scraps ; push ax ; save flag call GetNumScraps ; cx = number of scraps pop ax ; restore flag jcxz exit ; no scraps to delete ; ; copy current scrap to system clipboard item, if needed ; cmp ax, TRUE ; do we need to? jne noCopy ; nope, skip call ScrapBookCopy ; copy text to scrap noCopy: ; ; delete current scrap from scrapbook ; call DeleteCurrentScrap ; ; show the new current scrap ; call GetNumScraps ; cx = number of scraps jcxz noScrap ; deleted only scrap cmp cx, ss:[currentScrap] ; did we delete last scrap? jne showIt dec ss:[currentScrap] ; yes, show new last scrap showIt: call ShowCurrentScrap jmp short done ; ; delete last scrap ; noScrap: call ClearScrapView ; no more scraps, clear view call DisableNoScrapItems ; turn off cut, copy trigger ; and scrap name field done: ; ; reset scrap name list to reflect deleted scrap ; mov di, mask MF_CALL call ResetScrapNameList if NO_BACKUP ; ; shrink file if needed ; movdw bxsi, ss:[currentDoc] tst bx ; no delete should occur ; when in engine mode, anyway jz exit mov ax, MSG_SCRAPBOOK_DOCUMENT_COMPRESS mov di, mask MF_FORCE_QUEUE ; to let name list queries ; get handled first call ObjMessage endif exit: ret DeleteCutCommon endp DeleteCurrentScrap proc near call ScrapBookLockMap call VMDirty mov bx, bp ; bx = scrapbk map VM mem block mov ds, ax ; ds = scrapbk map block segment mov es, ax call GetCurrentScrapIndexOffset ; ds:si = entry for current ; scrap in index block mov ax, ds:[si].SBIE_vmBlock ; bx:ax = scrap VM block for ; entry to delete push ax ; save it ; ; remove transfer item from map block ; mov ax, ds:[SBIH_numScraps] call GetThisScrapIndexOffset ; ds:cx = end of current last mov cx, si ; scrap entry push cx call GetCurrentScrapIndexOffset ; ds:si = current scrap mov di, si ; ds:di = current scrap add si, size ScrapBookIndexEntry ; ds:si = next scrap sub cx, si ; cx = bytes to move pop dx ; dx = current size of index push si, di, cx ; save, in case of error rep movsb ; remove old scrap entry xchg ax, dx ; ax = index size (1 byte inst.) sub ax, size ScrapBookIndexEntry ; ax = new size clr ch ; keep locked call MemReAlloc ; remove space taken by deleted ; scrap pop di, si, cx ; retrieve in case of error ; di = destination ; si = source jnc noMemErr ; ; error, restore index block ; add di, cx ; point at correct places dec di ; for undo-ing add si, cx dec si std ; restore space for deleted rep movsb ; scrap cld pop ds:[si+1].SBIE_vmBlock ; restore scrap block handle stc ; indicate error noMemErr: jc noUpdateCount ; if error, don't update count mov ds, ax ; (in case block moved) dec ds:[SBIH_numScraps] ; one less scrap noUpdateCount: call VMUnlock ; unlock scrapbk map block ; (preserves flags) jnc noError ; if no error, continue mov bp, offset NoCutErrorString ; report error after unlocking call ScrapError jmp short done ; if error, don't free scrap ; (item already pop'ed) noError: ; ; now that its unhooked, free transfer item ; mov bx, ss:[currentScrapFile] pop ax ; ax = transfer item to delete call FreeTransferItem ; free it done: ret DeleteCurrentScrap endp ; ; pass: ; bx:ax = transfer item ; FreeTransferItem proc near uses cx, si, di, bp .enter push ax call VMLock mov ds, ax ; test ds:[CIH_flags], mask TIF_RAW ; jnz raw mov si, offset CIH_formats mov cx, ds:[CIH_formatCount] push bp freeLoop: push cx movdw axbp, ds:[si].CIFI_vmChain call VMFreeVMChain pop cx add si, size ClipboardItemFormatInfo loop freeLoop pop bp ;raw: call VMUnlock pop ax call VMFree .leave ret FreeTransferItem endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookCopyBitmapToGString %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: If the clipboard item only contains one format, and that format is a bitmap, then create a gstring in the clipboard file as well. CALLED BY: ScrapBookCopy PASS: dx - clipboard file handle es - segment of ClipboardItemHeader RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 10/31/94 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CIH_bitmapFormat equ <CIH_formats> CIH_gstringFormat equ <CIH_formats + size ClipboardItemFormatInfo> ScrapBookCopyBitmapToGString proc near uses ax,bx,cx,dx,di,si .enter cmp es:[CIH_formatCount], 1 jne done cmp es:[CIH_bitmapFormat].CIFI_format.CIFID_manufacturer, MANUFACTURER_ID_GEOWORKS jne done cmp es:[CIH_bitmapFormat].CIFI_format.CIFID_type, CIF_BITMAP jne done mov cl, GST_VMEM mov bx, dx ; clipboard file call GrCreateGString mov es:[CIH_gstringFormat].CIFI_vmChain.high,si clr es:[CIH_gstringFormat].CIFI_vmChain.low clr ax, bx ;draw coordinate mov cx, es:[CIH_bitmapFormat].CIFI_vmChain.high call GrDrawHugeBitmap call GrEndGString mov si, di ;gstring handle clr di ;no gstate push dx ; clipboard file mov dl, GSKT_LEAVE_DATA call GrDestroyGString pop bx ; clipboard file mov di, es:[CIH_bitmapFormat].CIFI_vmChain.high call GrGetHugeBitmapSize mov_tr cx, ax ;width mov dx, bx ;height mov ax,CIF_GRAPHICS_STRING mov di, size ClipboardItemFormatInfo call ScrapBookInitializeClipboardItemFormatInfo inc es:[CIH_formatCount] done: .leave ret ScrapBookCopyBitmapToGString endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookCopy %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: copy current scrap to clipboard CALLED BY: MSG_META_CLIPBOARD_COPY PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 02/27/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookCopy method ScrapBookClass, MSG_META_CLIPBOARD_COPY uses ds .enter call SaveCurrentScrapName call ScrapBookLockMap push bp mov ds, ax ; ds = segment of index block cmp ds:[SBIH_numScraps], 0 ; any scraps? LONG je exit ; nope call GetCurrentScrapIndexOffset ; ds:si = entry for current ; scrap in index block ; ; create transfer item block from current scrap ; call ClipboardGetClipboardFile mov dx, bx ; clipboard file mov bx, ss:[currentScrapFile] mov ax, ds:[si].SBIE_vmBlock ; bx:ax = scrap VM block for ; current entry clr cx ; preserve user id's call VMCopyVMBlock ; ax = transfer VM block handle push ax ; save transfer VM block handle mov bx, dx ; clipboard file call VMLock ; ax = segment, bp = mem handle push bp ; save transfer item hdr handle mov es, ax ; es = segment of TIH ; ; fill in transfer item info ; keep CIH_flags, CIH_formatCount ; call GeodeGetProcessHandle ; bx = our handle mov es:[CIH_owner].handle, bx mov es:[CIH_owner].chunk, 0 mov es:[CIH_sourceID].handle, 0 ; no associated document mov es:[CIH_sourceID].chunk, 0 ; ; create mem blocks for each transfer item format block in scrap ; mov cx, es:[CIH_formatCount] ; cx = number of formats mov di, offset CIH_formats ; es:di = first format mov si, 0 ; null-terminate chain mov bx, ss:[currentScrapFile] ; bx = source VM file formatLoop: movdw axbp, es:[di].CIFI_vmChain ; ax = src scrap VM ; block handle push cx clr cx ; preserve user id's call VMCopyVMChain ; ax = transfer VM block handle pop cx movdw es:[di].CIFI_vmChain, axbp ; store new scrap VM block han. add di, size ClipboardItemFormatInfo ; move to next format loop formatLoop call ScrapBookCopyBitmapToGString pop bp ; retrieve transfer item ; header handle push es:[CIH_flags] ; save transfer flags call VMUnlock ; unlock built-up transfer item pop bp ; bp = transfer flags andnf bp, not (mask CIF_QUICK) ; make sure not quick item pop ax ; ax = VM block handle of ; transfer item ; ; register newly created transfer item ; bp = flags ; ax = VM handle ; mov bx, dx ; clipboard file call ClipboardRegisterItem ; pass bx:ax, bp jnc exit ; Not enough disk space mov bp, offset NoCopyErrorString call ScrapError exit: pop bp ; unlock scrapbook map block call VMUnlock .leave ret ScrapBookCopy endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookPaste %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: paste current system clipboard item into scrapbook, inserts new scrap before current scrap CALLED BY: MSG_META_CLIPBOARD_PASTE PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 02/28/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookPaste method ScrapBookClass, MSG_META_CLIPBOARD_PASTE mov ax, FALSE ; paste at current scrap call PasteCommon ret ScrapBookPaste endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookPasteAtEnd %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: paste current system clipboard item into scrapbook, inserts new scrap at end of scrapbook CALLED BY: MSG_SCRAPBOOK_PASTE_AT_END PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 06/19/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookPasteAtEnd method ScrapBookClass, MSG_SCRAPBOOK_PASTE_AT_END mov ax, TRUE ; paste at end call PasteCommon ret ScrapBookPasteAtEnd endm ; ; ax = TRUE to paste at end ; ax = FALSE to paste BEFORE current scrap ; PasteCommon proc near if HEADER_SIZE_CHECKING call FileSizeWarning LONG jc exit endif push ax ; save paste flag tst ss:[currentDoc].handle jz engineMode call SaveCurrentScrapName engineMode: ; ; get current transfer item ; clr bp ; get normal item call ClipboardQueryItem ; bx:ax = transfer item ; VM file/block handle ; bp = number of formats pop di ; retreive paste flag tst bp ; check number of formats LONG jz exit ; no transfer item, exit tst ss:[currentScrapFile] LONG jz exit ; no file, exit push bx, ax ; save header block mov dx, ss:[currentScrapFile] ; copy to scrap file clr cx ; preserve user id's call VMCopyVMBlock ; ax = scrap VM block push ax ; save scrap VM block handle push di ; save paste flag push bx ; save transfer item VM file mov bx, ss:[currentScrapFile] call VMLock ; lock scrap VM block pop bx ; bx = transfer item VM file mov es, ax ; es = VM transfer item push bp ; save mem handle mov di, offset CIH_formats ; *es:di = formats mov cx, es:[CIH_formatCount] ; cx = number of formats mov si, 0 ; null-term. chain of VM blocks mov dx, ss:[currentScrapFile] ; copy to scrap file formatLoop: movdw axbp, es:[di].CIFI_vmChain ; bx:ax = transfer VM data block push cx clr cx ; preserve user id's call VMCopyVMChain ; ax = new scrap VM data block pop cx movdw es:[di].CIFI_vmChain, axbp ; store new scrap VM block han. cmp es:[di].CIFI_format.CIFID_type, CIF_TEXT jne notText cmp es:[di].CIFI_format.CIFID_manufacturer, MANUFACTURER_ID_GEOWORKS jne notText movdw ss:[pastedTextFormat], axbp ; store text format for ; PASTE_APPEND_TO_FILE notText: add di, size ClipboardItemFormatInfo ; move to next format loop formatLoop ; loop to do all formats pop bp call VMDirty call VMUnlock ; unlock scrap VM block ; ; add transfer item to map block ; pop bp ; bp = paste flag pop ax ; ax = item VM block handle call AddItemToMapBlock ; ; finish with transfer item ; pop bx, ax pushf ; save error status call ClipboardDoneWithItem popf ; retrieve error status call PostPaste ; handle error, clean-up exit: ret PasteCommon endp SendEnableMessage proc near mov ax, MSG_GEN_SET_ENABLED call SendAbleMessage ret SendEnableMessage endp ; ; pass: ; ax = VM block handle of new transfer item ; bp = TRUE to paste at end ; bp = FALSE to paste before current scrap ; return: ; carry clear if ok ; carry set if error ; AddItemToMapBlock proc near push ax ; save VM block handle push bp ; save paste flag call ScrapBookLockMap call VMDirty mov ds, ax ; ds = scrapbk map block segment mov bx, bp ; bx = scrapbk map VM mem block mov ax, ds:[SBIH_numScraps] mov cx, size ScrapBookIndexEntry mul cx add ax, size ScrapBookIndexHeader ; ax = current size add ax, size ScrapBookIndexEntry ; ax = new size clr ch ; keep locked call MemReAlloc ; make space for new entry jnc noMemErr ; if no error, continue ; ; handle error adding scrap to index block ; (index block unchanged, we hope) ; pop ax ; throw away paste flag pop ax ; retrieve scrap block mov bx, ss:[currentScrapFile] call FreeTransferItem ; free the scrap as it was ; not added to index stc ; indicate error jmp short afterErr noMemErr: mov ds, ax ; ds = es = map block segment mov es, ax mov ax, ds:[SBIH_numScraps] ; ds:si = position of new call GetThisScrapIndexOffset ; last scrap pop ax ; retrieve paste flag cmp ax, TRUE ; paste at end? je haveNewScrapEntry ; yes, do it EC < cmp ax, FALSE > EC < ERROR_NZ 0 > dec si ; ds:si = end of current last ; scrap entry mov di, si add di, size ScrapBookIndexEntry ; es:di = end of new last entry mov cx, ds:[SBIH_numScraps] ; cx = number of scrap sub cx, ss:[currentScrap] ; cx = num scraps to move mov ax, size ScrapBookIndexEntry mul cx mov cx, ax ; cx = # bytes to move std rep movsb ; make room for new entry cld call GetCurrentScrapIndexOffset ; ds:si = new scrap's entry haveNewScrapEntry: inc ds:[SBIH_numScraps] ; one more scrap pop ax mov ds:[si].SBIE_vmBlock, ax ; store VM block handle clc ; indicate no error afterErr: call VMUnlock ; unlock scrapbk map block ; (preserves flags) ret AddItemToMapBlock endp ; ; pass: ; carry clear if no error ; carry set if error adding scrap ; return: ; nothing PostPaste proc near jnc noError ; if no error, continue mov bp, offset NoPasteErrorString ; report error call ScrapError jmp exit ; if error, not pasted, so no ; need to update noError: ; ; We are now asynchronous update - to shrink the window in which the ; document on disk is in an inconsistent state, we do an autosave after ; each paste... (9/13/93 - atw) ; mov ax, MSG_GEN_DOCUMENT_AUTO_SAVE movdw bxsi, ss:[currentDoc] tst bx jz exit ; that's all for engine mode clr di call ObjMessage ; ; display newly pasted in scrap ; call ShowCurrentScrap ; ; reset scrap name list ; mov di, mask MF_CALL call ResetScrapNameList ; ; be sure scrap name entry is enabled ; GetResourceHandleNS ScrapName, bx mov si, offset ScrapName call SendEnableMessage GetResourceHandleNS DeleteTrigger, bx mov si, offset DeleteTrigger call SendEnableMessage GetResourceHandleNS CutTrigger, bx mov si, offset CutTrigger call SendEnableMessage GetResourceHandleNS CopyTrigger, bx mov si, offset CopyTrigger call SendEnableMessage GetResourceHandleNS ScrapNameControlShow, bx mov si, offset ScrapNameControlShow call SendEnableMessage ; ; ScrapPrevious and ScrapNext are set in ShowCurrentScrap so that ; they will be disabled if there is no previous/next scrap. ; Don't enable them here! -- jwu 11/3/93 ; ; GetResourceHandleNS ScrapPrevious, bx ; mov si, offset ScrapPrevious ; call SendEnableMessage ; GetResourceHandleNS ScrapNext, bx ; mov si, offset ScrapNext ; call SendEnableMessage exit: ret PostPaste endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookPasteAppendToFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Paste scrap to end of specified file CALLED BY: MSG_SCRAPBOOK_PASTE_APPEND_TO_FILE PASS: cx = block containing: FileLongName DiskHandle PathName RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 09/30/99 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookPasteAppendToFile method ScrapBookClass, MSG_SCRAPBOOK_PASTE_APPEND_TO_FILE if HEADER_SIZE_CHECKING ; ; make sure we have limits set ; push ax, cx, dx, si mov cx, ds mov si, offset scrapMaxCat mov dx, offset warningSizeKey mov ax, HEADER_WARNING_SIZE ; default warning level (16K) call InitFileReadInteger mov ss:[warningSize], ax mov dx, offset errorSizeKey mov ax, HEADER_ERROR_SIZE ; default error level (50K) call InitFileReadInteger mov ss:[errorSize], ax pop ax, cx, dx, si endif ; ; if specified file is currently opened, just paste at end ; sub sp, size DocumentCommonParams mov bp, sp mov bx, cx push ds call MemLock mov ds, ax clr si segmov es, ss mov di, bp mov cx, size FileLongName + size word + size PathName rep movsb call MemUnlock pop ds mov ss:[bp].DCP_docAttrs, 0 mov ss:[bp].DCP_flags, 0 mov ss:[bp].DCP_connection, 0 mov dx, size DocumentCommonParams push bx GetResourceHandleNS ScrapAppDocControl, bx mov si, offset ScrapAppDocControl mov ax, MSG_GEN_DOCUMENT_GROUP_SEARCH_FOR_DOC mov di, mask MF_CALL or mask MF_STACK push bp call ObjMessage pop bp pop bx ; bx = file info block lea sp, ss:[bp][size DocumentCommonParams] ; (preserves flags) jnc notOpen call MemFree ; free file info block call ScrapBookPasteAtEnd jmp exit notOpen: ; ; save current document, if any ; push ss:[currentScrapFile] pushdw ss:[currentDoc] ; ; open or create passed file ; call FilePushDir push bx ; save file info block push ds call MemLock mov ds, ax mov dx, size FileLongName + size word ; ds:dx = path mov bx, ds:[(size FileLongName)] ; bx = disk handle call FileSetCurrentPath jc noFilePop mov dx, 0 ; ds:dx = filename mov ah, VMO_CREATE mov al, 0 ; access flags clr cx ; default VM compression call VMOpen noFilePop: pop ds jc noFile mov ss:[currentScrapFile], bx clrdw ss:[currentDoc] cmp ax, VM_CREATE_OK jne opened call SetFileAttrs mov bp, bx ; bp = VM file handle clr cx, dx ; indicate engine mode call ScrapBookDocOutputInitializeDocumentFile opened: ; ; paste at end ; movdw ss:[pastedTextFormat], 0 mov ax, TRUE call PasteCommon ; handles engine mode ; ; fix up stuff in the text format ; tstdw ss:[pastedTextFormat] jz noFixup call FixupTextFormat noFixup: ; ; save and close file ; mov bx, ss:[currentScrapFile] call VMSave ; ignore error? mov al, 0 call VMClose ; ignore error? noFile: pop bx ; free file info block call MemFree call FilePopDir ; ; restore current document ; popdw ss:[currentDoc] pop ss:[currentScrapFile] exit: ret ScrapBookPasteAppendToFile endm ; ; this is taken from SPUI to set up initial VM-based document file ; OLDocExtAttrs struct ; extended attributes we set for a new file OLDEA_protocol ProtocolNumber OLDEA_release ReleaseNumber OLDEA_token GeodeToken OLDEA_creator GeodeToken OLDocExtAttrs ends SetFileAttrs proc near push bx mov ax, MSG_GEN_DOCUMENT_GROUP_GET_PROTOCOL GetResourceHandleNS ScrapAppDocControl, bx mov si, offset ScrapAppDocControl mov di, mask MF_CALL call ObjMessage ;cx, dx = protocol pop bx sub sp, size OLDocExtAttrs mov bp, sp ;ss:bp <- buffer for new ; attrs mov ss:[bp].OLDEA_protocol.PN_major, cx mov ss:[bp].OLDEA_protocol.PN_minor, dx segmov es, ss push bx ;save VM file handle ; get release # of application clr bx lea di, ss:[bp].OLDEA_release mov ax, GGIT_GEODE_RELEASE call GeodeGetInfo ; get the token and creator mov cx, es lea dx, ss:[bp].OLDEA_token mov ax, MSG_GEN_DOCUMENT_GROUP_GET_TOKEN push bp GetResourceHandleNS ScrapAppDocControl, bx mov si, offset ScrapAppDocControl mov di, mask MF_CALL call ObjMessage pop bp lea dx, ss:[bp].OLDEA_creator mov ax, MSG_GEN_DOCUMENT_GROUP_GET_CREATOR push bp GetResourceHandleNS ScrapAppDocControl, bx mov si, offset ScrapAppDocControl mov di, mask MF_CALL call ObjMessage pop bp pop bx ; bx <- file handle ; ; Now set up the array of extended attribute descriptors for the ; actual setting. ; sub sp, 4 * size FileExtAttrDesc mov di, bp mov bp, sp mov ss:[bp][0*FileExtAttrDesc].FEAD_attr, FEA_PROTOCOL mov ss:[bp][0*FileExtAttrDesc].FEAD_value.segment, ss lea ax, ss:[di].OLDEA_protocol mov ss:[bp][0*FileExtAttrDesc].FEAD_value.offset, ax mov ss:[bp][0*FileExtAttrDesc].FEAD_size, size OLDEA_protocol mov ss:[bp][1*FileExtAttrDesc].FEAD_attr, FEA_RELEASE mov ss:[bp][1*FileExtAttrDesc].FEAD_value.segment, ss lea ax, ss:[di].OLDEA_release mov ss:[bp][1*FileExtAttrDesc].FEAD_value.offset, ax mov ss:[bp][1*FileExtAttrDesc].FEAD_size, size OLDEA_release mov ss:[bp][2*FileExtAttrDesc].FEAD_attr, FEA_TOKEN mov ss:[bp][2*FileExtAttrDesc].FEAD_value.segment, ss lea ax, ss:[di].OLDEA_token mov ss:[bp][2*FileExtAttrDesc].FEAD_value.offset, ax mov ss:[bp][2*FileExtAttrDesc].FEAD_size, size OLDEA_token mov ss:[bp][3*FileExtAttrDesc].FEAD_attr, FEA_CREATOR mov ss:[bp][3*FileExtAttrDesc].FEAD_value.segment, ss lea ax, ss:[di].OLDEA_creator mov ss:[bp][3*FileExtAttrDesc].FEAD_value.offset, ax mov ss:[bp][3*FileExtAttrDesc].FEAD_size, size OLDEA_creator ; ; Finally, set the attributes for the file. ; mov cx, 4 mov di, bp mov ax, FEA_MULTIPLE call FileSetHandleExtAttributes ; ; Clear the stack of the descriptors and the attributes themselves. ; add sp, 4*size FileExtAttrDesc + size OLDocExtAttrs ret SetFileAttrs endp ; ; this is taken from text object to fix up copied text transfer item ; FixupTextFormat proc near ; lock the header block mov ax, ss:[pastedTextFormat].high ; VM block mov bx, ss:[currentScrapFile] ; VM file call VMLock ;ax = segment, bp = handle mov es, ax ;es <- seg addr of transfer. ; We have to take care of a slight problem here. The various run ; arrays contain the VM block handle of the corresponding elements ; in their huge array header. Unfortunately this VM block handle ; could be wrong, since VMCopyVMChain could have been used to copy ; the transfer item. We need to go into each run array and fix ; the element block if needed. mov di, es:[TTBH_charAttrRuns].high mov cx, es:[TTBH_charAttrElements].high call fixElementVMBlock mov di, es:[TTBH_paraAttrRuns].high mov cx, es:[TTBH_paraAttrElements].high call fixElementVMBlock mov di, es:[TTBH_typeRuns].high mov cx, es:[TTBH_typeElements].high call fixElementVMBlock mov di, es:[TTBH_graphicRuns].high mov cx, es:[TTBH_graphicElements].high call fixElementVMBlock ; The problem, sad to say, is worse than that described above. The ; graphics element array also contains references to VM blocks that ; are likely out of date. We must fix them up also mov ax, es:[TTBH_graphicElements].high mov di, size TextTransferBlockHeader call TT_RelocateGraphics call VMUnlock ret ;--- ; di = runs, cx = elements, bx = file fixElementVMBlock: push ds tst di jz fixDone call HugeArrayLockDir mov ds, ax cmp cx, ds:[TLRAH_elementVMBlock] jz fixUnlock mov ds:[TLRAH_elementVMBlock], cx call HugeArrayDirty fixUnlock: call HugeArrayUnlockDir fixDone: pop ds retn FixupTextFormat endp COMMENT @---------------------------------------------------------------------- FUNCTION: TT_RelocateGraphics DESCRIPTION: Relocate graphics in a run array after they have been possibly mangled CALLED BY: INTERNAL PASS: ax - VM block containing graphics element array bx - VM file es:di - array of dwords of correct VM trees RETURN: none DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 12/29/92 Initial version ------------------------------------------------------------------------------@ TT_RelocateGraphics proc near uses ax, cx, dx, si, di, bp, ds .enter tst ax jz exit call VMLock mov ds, ax mov si, VM_ELEMENT_ARRAY_CHUNK ;*ds:si = element array mov si, ds:[si] mov cx, ds:[si].CAH_count jcxz done mov dx, ds:[si].CAH_elementSize add si, ds:[si].CAH_offset relocateLoop: cmp ds:[si].REH_refCount.WAAH_high, EA_FREE_ELEMENT jz next tstdw ds:[si].VTG_vmChain ;does it have a vmChain? ;; ;; Don't jump to next, as that will skip the incrementing of the ptr ;; into the fix-up table, and skipping an element in the fix-up table ;; means that the wrong values will be stored in the VisTextGraphic ;; element's vmChain field from this element on. (cassie - 7/94) ;; ;; jz next jz afterCopy ;no, don't do the fix up cmpdw ds:[si].VTG_vmChain, es:[di], ax ;has the value changed? jz afterCopy ;no, don't need to do fix up movdw ds:[si].VTG_vmChain, es:[di], ax ;do the fix up call VMDirty afterCopy: add di, size dword ;point to next fix up VMChain next: add si, dx ;point to next graphic element loop relocateLoop done: call VMUnlock exit: .leave ret TT_RelocateGraphics endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookImport %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Import into current page CALLED BY: MSG_SCRAPBOOK_IMPORT PASS: ss:bp = ImpexTranslationParams RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 07/21/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookImport method ScrapBookClass, MSG_SCRAPBOOK_IMPORT call SaveCurrentScrapName ; in case current name modified if HEADER_SIZE_CHECKING call FileSizeWarning jc exit endif test ss:[bp].ITP_dataClass, mask IDC_TEXT or mask IDC_GRAPHICS EC < ERROR_Z 0 > mov ax, MSG_GEN_APPLICATION_MARK_BUSY call CallApp call ScrapBookCreateAndInitClipboardItemHeader cmp ss:[bp].ITP_clipboardFormat,CIF_GRAPHICS_STRING je itsAGString cmp ss:[bp].ITP_clipboardFormat,CIF_BITMAP je itsBitmap clr di ;first CIFI call ScrapBookCreateTextClipboardItemFormatInfo unlockHeader: ; ; unlock transfer item header ; push bp ; ImpexTranslationParams mov bp, cx ; VM block mem handle call VMUnlock pop bp ; ImpexTranslationParams ; we're finished with the impex data structure now, so let it know ; call ImpexImportExportCompleted ; ; add new transfer item to datafile map block, effectively putting it ; into our datafile ; mov bp, FALSE ; add before current scrap call AddItemToMapBlock ; (returns error, if any) call PostPaste ; handle error, clean-up mov ax, MSG_GEN_APPLICATION_MARK_NOT_BUSY call CallApp exit: ret itsBitmap: ; This guy creates two ClipboardItemFormatInfos ; clr di ;1st and 2nd CIFIs call ScrapBookCreateBitmapClipboardItemFormatInfo jmp unlockHeader itsAGString: clr di ;first CIFI call ScrapBookCreateGStringClipboardItemFormatInfo jmp unlockHeader ScrapBookImport endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookTogglePageList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Toggle the page list CALLED BY: PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 07/21/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookTogglePageList method ScrapBookClass, MSG_SCRAPBOOK_TOGGLE_PAGE_LIST uses ax, bx, cx, dx, di, si, bp .enter GetResourceHandleNS ViewPageToggle, bx mov si, offset ViewPageToggle mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION mov di, mask MF_CALL call ObjMessage jc noneSelected call HidePageListToTrigger jmp done noneSelected: call ShowPageListOnScreen done: .leave ret ScrapBookTogglePageList endm ScrapBookSetSelection method ScrapBookClass, MSG_SCRAPBOOK_SET_SELECTION uses ax, bx, cx, dx, bp .enter call SaveCurrentScrapName mov bx, ss:[currentScrapFile] tst bx jz done call VMGetMapBlock ; ax = map block call VMLock ; lock map block push bp mov ds, ax ; ds = map block segment EC < cmp ds:[SBIH_numScraps], 0 ; any scraps? > EC < je exit ; nope > mov ss:[currentScrap], cx ; store new current scrap exit:: pop bp ; unlock map block call VMUnlock call ShowCurrentScrap ; show new current scrap done: .leave ret ScrapBookSetSelection endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookTogglePageList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Copy the currently visible clip art to either the clip board or the caller application. CALLED BY: PASS: RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- edwin 01/12/99 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookSendPaste method ScrapBookClass, MSG_SCRAPBOOK_SEND_PASTE uses ax, bx, cx, dx, bp, di, si .enter call GeodeGetProcessHandle clr si mov ax, MSG_META_CLIPBOARD_COPY mov di, mask MF_CALL call ObjMessage tst ss:[callerAppName] jz copyToClipboard ; ; Copy the clip art to the parent application. ; segmov es, ss mov di, offset callerAppName mov ax, (GEODE_NAME_SIZE + GEODE_NAME_EXT_SIZE) clrdw cxdx call GeodeFind ; return bx - handle of GEODE jnc done call GeodeGetAppObject push bx, si clr bx, si mov ax, MSG_META_CLIPBOARD_PASTE mov di, mask MF_RECORD call ObjMessage ; di = handle of msg to send mov bx, di mov ax, handle ui call HandleModifyOwner ; make it stays around pop bx, si mov cx, di mov ax, MSG_META_SEND_CLASSED_EVENT mov dx, TO_TARGET mov di, mask MF_CALL call ObjMessage mov ax, MSG_META_QUIT call CallApp copyToClipboard: done: .leave ret ScrapBookSendPaste endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookCreateAndInitClipboardItemHeader %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Create vm block to hold ClipboardItemHeader and initialize the header CALLED BY: INTERNAL ScrapBookImport PASS: nothing RETURN: ax - vm block handle of header cx - vm mem handle of header es - segment of header DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/10/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookCreateAndInitClipboardItemHeader proc near uses bx,bp,si,ds,di .enter ; ; create transfer item header in our datafile ; mov bx, ss:[currentScrapFile] clr ax ; user ID mov cx, size ClipboardItemHeader call VMAlloc ; push ax ; vm block handle call VMLock push bp ; vm mem handle mov es, ax ; ; zero some fields ; clr ax mov es:[CIH_owner].handle, ax mov es:[CIH_owner].chunk, ax mov es:[CIH_flags], ax mov es:[CIH_sourceID].handle, ax mov es:[CIH_sourceID].chunk, ax mov es:[CIH_reserved].high, ax mov es:[CIH_reserved].low, ax mov es:[CIH_formatCount],ax ; ; store scrap name ; mov di, offset CIH_name mov cx, length CIH_name GetResourceHandleNS ScrapStrings, bx call MemLock ; ax = string segment mov ds, ax mov si, offset DefaultScrapName mov si, ds:[si] LocalCopyNString call MemUnlock pop cx ;vm mem handle pop ax ;vm block handle .leave ret ScrapBookCreateAndInitClipboardItemHeader endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookInitializeClipboardItemFormatInfo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Initialize the data in a ClipboardItemFormatInfo CALLED BY: INTERNAL ScrapBookImport PASS: es - segment of ClipboardItemHeader di - offset of ClipboardItemFormatInfo to initalize cx - extra1 dx - extra2 ax - type (ie CIF_TEXT) RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/10/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookInitializeClipboardItemFormatInfo proc near uses cx .enter mov es:[CIH_formats][di][CIFI_extra1], cx mov es:[CIH_formats][di][CIFI_extra2], dx clr cl mov es:[CIH_formats][di][CIFI_renderer].GT_chars[0], cl mov es:[CIH_formats][di][CIFI_renderer].GT_chars[1], cl mov es:[CIH_formats][di][CIFI_renderer].GT_chars[2], cl mov es:[CIH_formats][di][CIFI_renderer].GT_chars[3], cl mov es:[CIH_formats][di][CIFI_format].CIFID_manufacturer, \ MANUFACTURER_ID_GEOWORKS mov es:[CIH_formats][di][CIFI_format].CIFID_type,ax .leave ret ScrapBookInitializeClipboardItemFormatInfo endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookCopyChainToClipboardItemFormatInfo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Copy VMChain scrapbooks vm file CALLED BY: INTERNAL ScrapBookImport PASS: es - segment of ClipboardItemHeader di - offset of ClipboardItemFormatInfo to initalize bx - vm file ax:cx - vm chain RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/10/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookCopyChainToClipboardItemFormatInfo proc near uses dx,bp .enter mov bp,cx ; low word of vm chain mov dx, ss:[currentScrapFile] ; destination vm file handle call VMCopyVMChain ; movdw es:[CIH_formats][di][CIFI_vmChain], axbp; dest vm chain .leave ret ScrapBookCopyChainToClipboardItemFormatInfo endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookCreateTextClipboardItemFormatInfo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Fills out the ClipboardItemFormatInfo for a text scrap. CALLED BY: INTERNAL ScrapBookImport PASS: ss:bp - ImpexTranslationParams must be CIF_TEXT es - segment of ClipboardItemHeader di - offset to CIFI to use in header RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/10/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookCreateTextClipboardItemFormatInfo proc near uses ax,bx,cx,dx .enter clr cx,dx ;extra data mov ax,CIF_TEXT call ScrapBookInitializeClipboardItemFormatInfo mov bx,ss:[bp].ITP_transferVMFile movdw axcx,ss:[bp].ITP_transferVMChain call ScrapBookCopyChainToClipboardItemFormatInfo inc es:[CIH_formatCount] .leave ret ScrapBookCreateTextClipboardItemFormatInfo endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookCreateGStringClipboardItemFormatInfo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Fills out the ClipboardItemFormatInfo for a gstring scrap. CALLED BY: INTERNAL ScrapBookImport PASS: ss:bp - ImpexTranslationParams must be CIF_GRAPHICS_STRING es - segment of ClipboardItemHeader di - offset to CIFI to use in header RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/10/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookCreateGStringClipboardItemFormatInfo proc near uses ax,bx,cx,dx,di,si .enter push di ;ClipboardItemFormat offset mov bx,ss:[bp].ITP_transferVMFile mov si,ss:[bp].ITP_transferVMChain.high mov cx,GST_VMEM call GrLoadGString clr di,dx ;no gstate, no flags call GrGetGStringBounds sub cx,ax ;width sub dx,bx ;height pop di ;ClipboardItemFormat offset mov ax,CIF_GRAPHICS_STRING call ScrapBookInitializeClipboardItemFormatInfo mov bx,ss:[bp].ITP_transferVMFile movdw axcx,ss:[bp].ITP_transferVMChain call ScrapBookCopyChainToClipboardItemFormatInfo inc es:[CIH_formatCount] clr di ;no gstate mov dl,GSKT_LEAVE_DATA call GrDestroyGString .leave ret ScrapBookCreateGStringClipboardItemFormatInfo endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookCreateBitmapClipboardItemFormatInfo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Currently the scrapbook doesn't display bitmap format stuff. So if we get a bitmap import create a gstring scrap also so the scrapbook can display something. This functionality may still be useful once the scrapbook can display bitmaps. Since this creates to ClipboardItemFormatInfo structures the first is created at the passed offset and the second one is create at the offset after the passed one. CALLED BY: INTERNAL ScrapBookImport PASS: ss:bp - ImpexTranslationParams es - segment of ClipboardItemHeader di - offset to first CIFI to use in header RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/10/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookCreateBitmapClipboardItemFormatInfo proc near uses ax,bx,cx,dx,di,si .enter clr cx,dx ;extra data mov ax,CIF_BITMAP call ScrapBookInitializeClipboardItemFormatInfo mov bx,ss:[bp].ITP_transferVMFile movdw axcx,ss:[bp].ITP_transferVMChain call ScrapBookCopyChainToClipboardItemFormatInfo inc es:[CIH_formatCount] .leave ret ScrapBookCreateBitmapClipboardItemFormatInfo endp ; ; Pass: ; nothing ; Returns: ; si - offset to index entry for current scrap ; Destroys: ; nothing GetCurrentScrapIndexOffset proc near uses ax .enter mov ax, ss:[currentScrap] call GetThisScrapIndexOffset .leave ret GetCurrentScrapIndexOffset endp ; ; Pass: ; ax - scrap entry to get offset for ; Returns: ; si - offset to index entry for this scrap ; Destroys: ; nothing GetThisScrapIndexOffset proc near uses cx, dx .enter mov cx, size ScrapBookIndexEntry mul cx ; ax = offset to current entry mov si, ax add si, size ScrapBookIndexHeader .leave ret GetThisScrapIndexOffset endp ScrapError proc near uses ax, bx, di, es, bp .enter GetResourceHandleNS ScrapStrings, bx call MemLock ; ax = string segment mov es, ax mov ax, es:[bp] ; es:ax - error string sub sp, size StandardDialogParams mov bp, sp mov ss:[bp].SDP_customFlags, \ (CDT_ERROR shl offset CDBF_DIALOG_TYPE) or \ (GIT_NOTIFICATION shl offset CDBF_INTERACTION_TYPE) mov ss:[bp].SDP_customString.high, es mov ss:[bp].SDP_customString.low, ax clr ss:[bp].SDP_helpContext.segment call UserStandardDialog call MemUnlock ; unlock string resource .leave ret ScrapError endp if HEADER_SIZE_CHECKING ScrapQuery proc near uses bx, di, es, bp .enter GetResourceHandleNS ScrapStrings, bx call MemLock ; ax = string segment mov es, ax mov ax, es:[bp] ; es:ax - error string sub sp, size StandardDialogParams mov bp, sp mov ss:[bp].SDP_customFlags, \ (CDT_WARNING shl offset CDBF_DIALOG_TYPE) or \ (GIT_AFFIRMATION shl offset CDBF_INTERACTION_TYPE) mov ss:[bp].SDP_customString.high, es mov ss:[bp].SDP_customString.low, ax clr ss:[bp].SDP_helpContext.segment call UserStandardDialog call MemUnlock ; unlock string resource .leave ret ScrapQuery endp endif CallApp proc near uses ax, cx, dx, bp, bx, si, di .enter GetResourceHandleNS ScrapBookApp, bx mov si, offset ScrapBookApp mov di, mask MF_CALL call ObjMessage .leave ret CallApp endp ShowPageListOnScreen proc far params local AddVarDataParams sizeArg local CompSizeHintArgs .enter push bp ; ; Set the "GO TO PAGE..." trigger usble ; GetResourceHandleNS ScrapNameBoxTrigger, bx mov si, offset ScrapNameBoxTrigger clr dx mov dl, VUM_NOW mov ax, MSG_GEN_SET_NOT_USABLE mov di, mask MF_CALL call ObjMessage ; ; Set the NEXT and PREVIOUS button usable ; GetResourceHandleNS ScrapPreviousAndNext, bx mov si, offset ScrapPreviousAndNext clr dx mov dl, VUM_NOW mov ax, MSG_GEN_SET_NOT_USABLE mov di, mask MF_CALL call ObjMessage ; ; Set the GenDynamic List not usable ; GetResourceHandleNS ScrapNameList, bx mov si, offset ScrapNameList clr dx mov dl, VUM_NOW mov ax, MSG_GEN_SET_NOT_USABLE mov di, mask MF_CALL call ObjMessage ; ; Remove the GenDynamic list from a dialog box ; GetResourceHandleNS ScrapNameBox, bx mov si, offset ScrapNameBox GetResourceHandleNS ScrapNameList, cx mov dx, offset ScrapNameList mov ax, MSG_GEN_REMOVE_CHILD mov bp, mask CCF_MARK_DIRTY call ObjMessage ; ; Add the GenDynamic list to a different parent ; GetResourceHandleNS ScrapBody, bx mov si, offset ScrapBody GetResourceHandleNS ScrapNameList, cx mov dx, offset ScrapNameList mov ax, MSG_GEN_ADD_CHILD mov bp, mask CCF_MARK_DIRTY call ObjMessage pop bp ; ; Add a var data ; mov sizeArg.CSHA_width, SST_AVG_CHAR_WIDTHS shl offset SW_TYPE or 25 mov sizeArg.CSHA_height, 0 ; SST_LINES_OF_TEXT shl offset SH_TYPE or 9 mov sizeArg.CSHA_count, 9 lea ax, sizeArg movdw params.AVDP_data, ssax mov params.AVDP_dataSize, size CompSizeHintArgs mov params.AVDP_dataType, HINT_FIXED_SIZE GetResourceHandleNS ScrapNameList, bx mov si, offset ScrapNameList mov ax, MSG_META_ADD_VAR_DATA mov dx, size AddVarDataParams mov di, mask MF_STACK or mask MF_CALL push bp lea bp, params call ObjMessage ; ; Set the GenDynamic List usable ; GetResourceHandleNS ScrapNameList, bx mov si, offset ScrapNameList clr dx mov dl, VUM_NOW mov ax, MSG_GEN_SET_USABLE mov di, mask MF_CALL call ObjMessage pop bp .leave ret ShowPageListOnScreen endp HidePageListToTrigger proc far params local AddVarDataParams sizeArg local CompSizeHintArgs .enter push bp ; GetResourceHandleNS ScrapNameBoxTrigger, bx ; mov si, offset ScrapNameBoxTrigger ; clr dx ; mov dl, VUM_NOW ; mov ax, MSG_GEN_SET_NOT_USABLE ; mov di, mask MF_CALL ; call ObjMessage ; ; Set the GenDynamic List not usable ; GetResourceHandleNS ScrapNameList, bx mov si, offset ScrapNameList clr dx mov dl, VUM_NOW mov ax, MSG_GEN_SET_NOT_USABLE mov di, mask MF_CALL call ObjMessage ; ; Remove the GenDynamic list from a dialog box ; GetResourceHandleNS ScrapBody, bx mov si, offset ScrapBody GetResourceHandleNS ScrapNameList, cx mov dx, offset ScrapNameList mov ax, MSG_GEN_REMOVE_CHILD mov bp, mask CCF_MARK_DIRTY call ObjMessage ; ; Add the GenDynamic list to a different parent ; GetResourceHandleNS ScrapNameBox, bx mov si, offset ScrapNameBox GetResourceHandleNS ScrapNameList, cx mov dx, offset ScrapNameList mov ax, MSG_GEN_ADD_CHILD mov bp, mask CCF_MARK_DIRTY call ObjMessage ; ; Set the GenDynamic List usable ; GetResourceHandleNS ScrapNameList, bx mov si, offset ScrapNameList clr dx mov dl, VUM_NOW mov ax, MSG_GEN_SET_USABLE mov di, mask MF_CALL call ObjMessage pop bp ; ; Add a var data ; mov sizeArg.CSHA_width, SST_AVG_CHAR_WIDTHS shl offset SW_TYPE or 32 mov sizeArg.CSHA_height, SST_LINES_OF_TEXT shl offset SH_TYPE or 5 mov sizeArg.CSHA_count, 5 lea ax, sizeArg movdw params.AVDP_data, ssax mov params.AVDP_dataSize, size CompSizeHintArgs mov params.AVDP_dataType, HINT_FIXED_SIZE GetResourceHandleNS ScrapNameList, bx mov si, offset ScrapNameList mov ax, MSG_META_ADD_VAR_DATA mov dx, size AddVarDataParams mov di, mask MF_STACK or mask MF_CALL push bp lea bp, params call ObjMessage ; ; Set the "GO TO PAGE.." trigger usable ; GetResourceHandleNS ScrapNameBoxTrigger, bx mov si, offset ScrapNameBoxTrigger clr dx mov dl, VUM_NOW mov ax, MSG_GEN_SET_USABLE mov di, mask MF_CALL call ObjMessage ; ; Set the NEXT and PREVIOUS button usable ; GetResourceHandleNS ScrapPreviousAndNext, bx mov si, offset ScrapPreviousAndNext clr dx mov dl, VUM_NOW mov ax, MSG_GEN_SET_USABLE mov di, mask MF_CALL call ObjMessage pop bp .leave ret HidePageListToTrigger endp ScrapbookCopyCallerApp proc far uses ax, bx, dx, cx, es, di, si .enter segmov es, ss lea di, ss:[callerAppName] mov cx, (GEODE_NAME_SIZE + GEODE_NAME_EXT_SIZE) rep movsb lea di, ss:[callerAppName] mov ax, (GEODE_NAME_SIZE + GEODE_NAME_EXT_SIZE) clrdw cxdx call GeodeFind ; return bx - handle of GEODE mov ss:[callerAppToken], bx .leave ret ScrapbookCopyCallerApp endp ; Change the ScrapInsert moniker from "Copy to Clipboard" to ; "Insert into Document" ; Pass: ; ; Returns: ; ; Destroys: ; nothing ScrapbookChangeIcon proc far uses ax, bx, si, cx, dx, bp, di, es .enter GetResourceHandleNS ScrapStrings, bx push bx call MemLock ; ax = string segment mov es, ax mov si, offset NewMonikerString mov dx, es:[si] mov cx, es ; cx:dx - string GetResourceHandleNS ScrapInsert, bx mov si, offset ScrapInsert mov ax, MSG_GEN_REPLACE_VIS_MONIKER_TEXT mov bp, VUM_NOW mov di, mask MF_CALL call ObjMessage pop bx call MemUnlock .leave ret ScrapbookChangeIcon endp ScrapbookChangeIconBack proc far uses ax, bx, si, cx, dx, bp, di, es .enter GetResourceHandleNS ScrapStrings, bx push bx call MemLock ; ax = string segment mov es, ax mov si, offset OldMonikerString mov dx, es:[si] mov cx, es ; cx:dx - string GetResourceHandleNS ScrapInsert, bx mov si, offset ScrapInsert mov ax, MSG_GEN_REPLACE_VIS_MONIKER_TEXT mov bp, VUM_NOW mov di, mask MF_CALL call ObjMessage pop bx call MemUnlock .leave ret ScrapbookChangeIconBack endp ; Add to the GCNList so that when the parent app quits, ; scrapbook get notified and change its moniker. ; Pass: none ; Returns: none ; ; Destroys: ; nothing ScrapbookAddGCNList proc far uses ax, bx, cx, dx .enter call GeodeGetProcessHandle mov cx, bx clr dx mov bx, MANUFACTURER_ID_GEOWORKS mov ax, GCNSLT_APPLICATION call GCNListAdd .leave ret ScrapbookAddGCNList endp ; Remove scrapbook app from the GCN list. It's no longer need ; to be notified. ; Pass: none ; Returns: none ; ; Destroys: ; nothing ScrapbookRemoveGCNList proc far uses ax, bx, cx, dx .enter call GeodeGetProcessHandle mov cx, bx clr dx mov bx, MANUFACTURER_ID_GEOWORKS mov ax, GCNSLT_APPLICATION call GCNListRemove .leave ret ScrapbookRemoveGCNList endp ; Some app is quitting. Check to see if it's the parent application. ; If so, change scrapbook moniker. ; Pass: none ; Returns: none ; ; Destroys: ; nothing ScrapBookNotifyExit method dynamic ScrapBookClass, MSG_NOTIFY_APP_EXITED .enter cmp dx, ss:[callerAppToken] jne done ; ; The parent app exited, scrapbook no longer needs to be notified. ; call ScrapbookRemoveGCNList mov ss:[callerAppName], 0 call ScrapbookChangeIconBack done: .leave ret ScrapBookNotifyExit endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookKbdChar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: handle keys from view by FUP'ing them back to the view CALLED BY: MSG_META_KBD_CHAR PASS: ds = ScrapBookClass segment es = segment of ScrapBookClass ax = MSG_META_KBD_CHAR cx = character value dl = CharFlags dh = ShiftState bp low = ToggleState bh high = scan code RETURN: nothing ALLOWED TO DESTROY: ax, cx, dx, bp bx, si, di, ds, es SIDE EFFECTS: PSEUDO CODE/STRATEGY: Handled, so that TAB navigation works REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 1/21/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookKbdChar method dynamic ScrapBookClass, MSG_META_KBD_CHAR ; ; Our view has 'sendAllKbdChars', so send everything back up ; GetResourceHandleNS ScrapGString, bx mov si, offset ScrapGString mov ax, MSG_META_FUP_KBD_CHAR mov di, mask MF_CALL call ObjMessage ret ScrapBookKbdChar endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScrapBookBringUpHelp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Bring up TOC help, we get this because we are the content of the view and the HELP stuff goes to TO_FOCUS. CALLED BY: MSG_META_BRING_UP_HELP PASS: ds = dgroup of ScrapBookClass es = segment of ScrapBookClass ax = MSG_META_BRING_UP_HELP RETURN: nothing ALLOWED TO DESTROY: ax, cx, dx, bp bx, si, di, ds, es SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 1/2/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapBookBringUpHelp method ScrapBookClass, MSG_META_BRING_UP_HELP ; ; let primary bring up TOC help ; GetResourceHandleNS ScrapBookPrimary, bx mov si, offset ScrapBookPrimary mov di, mask MF_CALL call ObjMessage ret ScrapBookBringUpHelp endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Intercept the C_ENTER event and load the clip art. CALLED BY: MSG_META_BRING_UP_HELP PASS: ds = dgroup of ScrapBookClass es = segment of ScrapBookClass ax = MSG_META_BRING_UP_HELP RETURN: nothing ALLOWED TO DESTROY: ax, cx, dx, bp bx, si, di, ds, es SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 1/2/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ MyDynamicListSetSelection method ScrapBookListClass, MSG_META_FUP_KBD_CHAR .enter push cx mov di, offset ScrapBookListClass call ObjCallSuperNoLock pop cx cmp cl, C_ENTER jne exit cmp dl, mask CF_RELEASE jne exit GetResourceHandleNS ScrapNameList, bx mov si, offset ScrapNameList mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION mov di, mask MF_CALL call ObjMessage mov cx, ax call GeodeGetProcessHandle mov ax, MSG_SCRAPBOOK_SET_SELECTION mov di, mask MF_FORCE_QUEUE call ObjMessage exit: .leave ret MyDynamicListSetSelection endm if NO_BACKUP ; ; ScrapBookDocumentClass code ; ; ; save before closing, so we don't get the "revert" dialog, as we have ; nothing to revert, UNLESS it is untitled, in which case, we'll let the ; "revert" dialog allow the user to option of throwing away the document ; ScrapBookDocumentClose method ScrapBookDocumentClass, MSG_GEN_DOCUMENT_CLOSE push bp mov ax, MSG_GEN_DOCUMENT_GET_FILE_HANDLE call ObjCallInstanceNoLock tst ax jz close mov bx, ax call VMGetAttributes test al, mask VMA_BACKUP jnz close ; normal close if in backup mode mov ax, MSG_GEN_DOCUMENT_GET_ATTRS call ObjCallInstanceNoLock test ax, mask GDA_UNTITLED jnz close mov ax, MSG_GEN_DOCUMENT_SAVE call ObjCallInstanceNoLock ;how to handle error? let DOCUMENT_CLOSE handle it... close: pop bp mov ax, MSG_GEN_DOCUMENT_CLOSE mov di, offset ScrapBookDocumentClass call ObjCallSuperNoLock ret ScrapBookDocumentClose endm ; ; try to reduce size of VM header ; scrapDir TCHAR "Scrap" SCRAP_DIR_LEN = $-scrapDir .warn -unref scrapDirNull TCHAR 0 ; null-terminator .warn @unref udata segment scrapTempName TCHAR (SCRAP_DIR_LEN+1) dup (?) ; "Scrap\" tempName FileLongName scrapDocName TCHAR (SCRAP_DIR_LEN+1) dup (?) ; "Scrap\" docName FileLongName curFile word newFile word newSBIHMem word newCIHMem word numScraps word docObj optr waitForAck byte cancelCompress byte udata ends VMSaveAsHeader struct VMSAH_flags GeosFileHeaderFlags VMSAH_release ReleaseNumber VMSAH_protocol ProtocolNumber VMSAH_token GeodeToken VMSAH_creator GeodeToken VMSAH_notes FileUserNotes VMSaveAsHeader ends VMSAH_NUM_ATTRS equ 6 VMSaveAsTransferHeader proc near uses es, di headerCopy local VMSaveAsHeader ; Buffer for copying relevant pieces of ; the header when done. headerAttrs local VMSAH_NUM_ATTRS dup(FileExtAttrDesc) .enter ; ; Copy the important pieces of the header from the source to the dest. ; mov ss:[headerAttrs][0*FileExtAttrDesc].FEAD_attr, FEA_FLAGS mov ss:[headerAttrs][0*FileExtAttrDesc].FEAD_value.segment, ss lea ax, ss:[headerCopy].VMSAH_flags mov ss:[headerAttrs][0*FileExtAttrDesc].FEAD_value.offset, ax mov ss:[headerAttrs][0*FileExtAttrDesc].FEAD_size, size VMSAH_flags mov ss:[headerAttrs][1*FileExtAttrDesc].FEAD_attr, FEA_RELEASE mov ss:[headerAttrs][1*FileExtAttrDesc].FEAD_value.segment, ss lea ax, ss:[headerCopy].VMSAH_release mov ss:[headerAttrs][1*FileExtAttrDesc].FEAD_value.offset, ax mov ss:[headerAttrs][1*FileExtAttrDesc].FEAD_size, size VMSAH_release mov ss:[headerAttrs][2*FileExtAttrDesc].FEAD_attr, FEA_PROTOCOL mov ss:[headerAttrs][2*FileExtAttrDesc].FEAD_value.segment, ss lea ax, ss:[headerCopy].VMSAH_protocol mov ss:[headerAttrs][2*FileExtAttrDesc].FEAD_value.offset, ax mov ss:[headerAttrs][2*FileExtAttrDesc].FEAD_size, size VMSAH_protocol mov ss:[headerAttrs][3*FileExtAttrDesc].FEAD_attr, FEA_TOKEN mov ss:[headerAttrs][3*FileExtAttrDesc].FEAD_value.segment, ss lea ax, ss:[headerCopy].VMSAH_token mov ss:[headerAttrs][3*FileExtAttrDesc].FEAD_value.offset, ax mov ss:[headerAttrs][3*FileExtAttrDesc].FEAD_size, size VMSAH_token mov ss:[headerAttrs][4*FileExtAttrDesc].FEAD_attr, FEA_CREATOR mov ss:[headerAttrs][4*FileExtAttrDesc].FEAD_value.segment, ss lea ax, ss:[headerCopy].VMSAH_creator mov ss:[headerAttrs][4*FileExtAttrDesc].FEAD_value.offset, ax mov ss:[headerAttrs][4*FileExtAttrDesc].FEAD_size, size VMSAH_creator mov ss:[headerAttrs][5*FileExtAttrDesc].FEAD_attr, FEA_USER_NOTES mov ss:[headerAttrs][5*FileExtAttrDesc].FEAD_value.segment, ss lea ax, ss:[headerCopy].VMSAH_notes mov ss:[headerAttrs][5*FileExtAttrDesc].FEAD_value.offset, ax mov ss:[headerAttrs][5*FileExtAttrDesc].FEAD_size, size VMSAH_notes segmov es, ss lea di, ss:[headerAttrs] mov cx, length headerAttrs mov bx, ss:[curFile] mov ax, FEA_MULTIPLE call FileGetHandleExtAttributes jc headerTransferred andnf ss:[headerCopy].VMSAH_flags, not (mask GFHF_TEMPLATE or \ mask GFHF_SHARED_MULTIPLE or \ mask GFHF_SHARED_SINGLE) mov bx, ss:[newFile] mov ax, FEA_MULTIPLE call FileSetHandleExtAttributes headerTransferred: .leave ret VMSaveAsTransferHeader endp ScrapBookDocumentCompress method dynamic ScrapBookDocumentClass, MSG_SCRAPBOOK_DOCUMENT_COMPRESS mov ss:[waitForAck], BB_FALSE mov ss:[cancelCompress], BB_FALSE ; ; only do if beyond warning size, and if free handles is a ; significant ; mov ax, MSG_GEN_DOCUMENT_GET_FILE_HANDLE call ObjCallInstanceNoLock tst ax LONG jz exit mov ss:[curFile], ax mov bx, ax call VMGetHeaderInfo cmp cx, ss:[warningSize] LONG jb exit ; ; display status dialog ; push si mov ax, MSG_GEN_APPLICATION_MARK_BUSY call GenCallApplication GetResourceHandleNS CompressStatus, bx mov si, offset CompressStatus mov ax, MSG_GEN_SET_USABLE mov dl, VUM_NOW mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage mov ax, MSG_GEN_INTERACTION_INITIATE mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage clr dx, cx, bp mov ax, MSG_GEN_VALUE_SET_VALUE GetResourceHandleNS CompressStatusProgress, bx mov si, offset CompressStatusProgress mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop si ; ; save to get everything out onto disk ; mov ax, ds:[LMBH_handle] mov ss:[docObj].handle, ax mov ss:[docObj].chunk, si mov bx, ss:[curFile] call VMSave LONG jc errExit tst ss:[cancelCompress] stc LONG jnz errExit ; ; create new compressed version of file with unique name ; call FilePushDir ; ensure our work directory exists mov ax, SP_PRIVATE_DATA call FileSetStandardPath segmov ds, cs, dx mov dx, offset scrapDir call FileCreateDir jnc createOK cmp ax, ERROR_FILE_EXISTS je createOK stc ; indicate error errPopDirFar: jmp errPopDir createOK: ; switch to our work directory mov bx, SP_PRIVATE_DATA call FileSetCurrentPath jc errPopDirFar ; set up our temp file's path segmov ds, cs, si mov si, offset scrapDir segmov es, ss, di mov di, offset scrapTempName mov cx, SCRAP_DIR_LEN LocalCopyNString LocalLoadChar ax, '\\' LocalPutChar esdi, ax ; create temp file mov di, offset tempName clr ax mov cx, length FileLongName SBCS < rep stosb > DBCS < rep stosw > segmov ds, ss, dx mov dx, offset tempName mov ax, (VMO_TEMP_FILE shl 8) mov cx, 0 ; default compression call VMOpen ; bx = VM file handle jc errPopDirFar ; couldn't create temp file mov ss:[newFile], bx mov ax, mask VMA_SINGLE_THREAD_ACCESS or ((mask VMA_SYNC_UPDATE or mask VMA_BACKUP or mask VMA_NOTIFY_DIRTY) shl 8) call VMSetAttributes call VMSaveAsTransferHeader LONG jc closeNew call VMSave LONG jc closeNew tst ss:[cancelCompress] stc LONG jnz closeNew ; ; get our working copy of SBIH ; mov bx, ss:[curFile] call VMGetMapBlock mov dx, ss:[newFile] call VMCopyVMBlock ; ax = new SBIH mov bx, dx call VMSetMapBlock push ax call VMSave pop ax LONG jc closeNew tst ss:[cancelCompress] stc LONG jnz closeNew call VMLock ; ax = segment, bp = handle mov ss:[newSBIHMem], bp mov es, ax mov ax, es:[SBIH_numScraps] mov ss:[numScraps], ax ; initialize status mov dx, ax clr cx mov ax, MSG_GEN_VALUE_SET_MAXIMUM GetResourceHandleNS CompressStatusProgress, bx mov si, offset CompressStatusProgress mov di, mask MF_CALL call ObjMessage mov di, size ScrapBookIndexHeader ; es:di = first scrap ; ; copy all scraps over, saving in between each to ensure compressed ; scrapLoop: tst ss:[numScraps] LONG jz doneScraps mov bx, ss:[curFile] mov ax, es:[di].SBIE_vmBlock ; bx:ax = CIH block mov dx, ss:[newFile] clr cx ; preserve user id's call VMCopyVMBlock ; ax = new CIH block mov es:[di].SBIE_vmBlock, ax ; update CIH in new SBIH mov bx, dx ; bx = newFile call VMSave LONG jc unlockSBIH tst ss:[cancelCompress] stc LONG jnz unlockSBIH mov ax, es:[di].SBIE_vmBlock call VMLock ; ax = segment, bp = mem handle mov ss:[newCIHMem], bp mov ds, ax ; ds = segment of CIH ; copy each format's VMChain mov cx, ds:[CIH_formatCount] ; cx = number of formats mov si, offset CIH_formats ; ds:si = first format mov bx, ss:[curFile] ; bx = source file mov dx, ss:[newFile] ; dx = dest file formatLoop: movdw axbp, ds:[si].CIFI_vmChain ; ax = cur item chain push cx clr cx ; preserve user id's call VMCopyVMChain ; ax = transfer VM block handle pop cx jc unlockCIH push ax call VMSave pop ax jc unlockCIH tst ss:[cancelCompress] stc LONG jnz unlockCIH movdw ds:[si].CIFI_vmChain, axbp ; store new item chain add si, size ClipboardItemFormatInfo ; move to next format loop formatLoop mov bp, ss:[newCIHMem] ; retrieve new CIH mem handle call VMDirty clc ; all formats copied unlockCIH: mov bp, ss:[newCIHMem] ; retrieve new CIH mem handle call VMUnlock ; unlock new CIH (preserves C) jc unlockSBIH mov bx, ss:[newFile] call VMSave ; commit new CIH jc unlockSBIH tst ss:[cancelCompress] stc LONG jnz unlockSBIH add di, size ScrapBookIndexEntry dec ss:[numScraps] ; update status push di mov ax, MSG_GEN_VALUE_INCREMENT GetResourceHandleNS CompressStatusProgress, bx mov si, offset CompressStatusProgress mov di, mask MF_CALL call ObjMessage pop di jmp scrapLoop doneScraps: mov bp, ss:[newSBIHMem] ; retrieve new SBIH mem handle call VMDirty clc ; all scraps copied unlockSBIH: mov bp, ss:[newSBIHMem] ; retrieve new SBIH mem handle call VMUnlock ; unlock new SBIH (preserves C) jc closeNew mov bx, ss:[newFile] call VMSave jc closeNew mov ax, mask VMA_NOTIFY_DIRTY call VMSetAttributes ; set when we're clean clc ; no error closeNew: lahf push ax mov bx, ss:[newFile] mov al, 0 call VMClose pop ax LONG jc deleteNew ; close error sahf LONG jc deleteNew ; save error tst ss:[cancelCompress] stc LONG jnz deleteNew ; ; close old file, continue when ack'ed ; mov bx, ss:[docObj].handle call MemDerefDS mov si, ss:[docObj].chunk clr bp mov ax, MSG_GEN_DOCUMENT_CLOSE_FILE call ObjCallInstanceNoLock ; wait for MSG_GEN_APPLICATION_CLOSE_FILE_ACK mov ss:[waitForAck], BB_TRUE call FilePopDir exit: ret ; <-- EXIT HERE deleteNew: ; delete temporary new document mov ax, SP_PRIVATE_DATA call FileSetStandardPath segmov ds, ss, dx mov dx, offset scrapTempName call FileDelete errPopDir: call FilePopDir errExit: mov bx, ss:[docObj].handle call MemDerefDS mov si, ss:[docObj].chunk clr cx ; cleanup after error mov ax, MSG_SCRAPBOOK_DOCUMENT_COMPRESS_PART2 call ObjCallInstanceNoLock ret ; <-- EXIT HERE ScrapBookDocumentCompress endm ScrapBookApplicationCloseFileAck method dynamic ScrapbookApplicationClass, MSG_GEN_APPLICATION_CLOSE_FILE_ACK ; es = dgroup tst es:[waitForAck] jz done movdw bxsi, es:[docObj] mov ax, MSG_SCRAPBOOK_DOCUMENT_COMPRESS_PART2 mov cx, -1 ; do real work clr di call ObjMessage done: ret ScrapBookApplicationCloseFileAck endm ; ;continuing when GenApp gets MSG_GEN_APPLICATION_CLOSE_FILE_ACK ; ScrapBookDocumentCompressPart2 method dynamic ScrapBookDocumentClass, MSG_SCRAPBOOK_DOCUMENT_COMPRESS_PART2 tst cx LONG jz cleanUp call FilePushDir ; get current document name mov cx, ss mov dx, offset docName mov ax, MSG_GEN_DOCUMENT_GET_FILE_NAME call ObjCallInstanceNoLock ; build the name of document in our work directory segmov es, ss, di mov di, offset scrapDocName segmov ds, cs, si mov si, offset scrapDir mov cx, SCRAP_DIR_LEN LocalCopyNString LocalLoadChar ax, '\\' LocalPutChar esdi, ax ; switch to document directory mov bx, ss:[docObj].handle call MemDerefDS mov si, ss:[docObj].chunk mov ax, ATTR_GEN_PATH_DATA mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE call GenPathSetCurrentPathFromObjectPath tst ss:[cancelCompress] LONG jnz deleteNew ; copy original document to our work directory (in case of problems?) segmov ds, ss, si mov si, offset docName mov cx, 0 ; in current directory mov di, offset scrapDocName mov dx, SP_PRIVATE_DATA ; in work directory call FileCopy jc deleteNew tst ss:[cancelCompress] LONG jnz deleteNew ; copy new document (in work directory) over(write) original document, segmov ds, ss, si mov si, offset scrapTempName mov cx, SP_PRIVATE_DATA ; in work directory segmov es, ss, di mov di, offset docName mov dx, 0 ; in current directory call FileCopy ; if error here, hopefully original document wasn't clobbered, ; so we'll just re-open it deleteNew: ; delete temporary new document mov ax, SP_PRIVATE_DATA call FileSetStandardPath segmov ds, ss, dx mov dx, offset scrapTempName call FileDelete ; ignore error ; delete copy of old document (in work directory) mov dx, offset scrapDocName call FileDelete ; ignore error ; reopen new compressed document mov bx, ss:[docObj].handle call MemDerefDS mov si, ss:[docObj].chunk mov ax, MSG_GEN_DOCUMENT_REOPEN_FILE call ObjCallInstanceNoLock call FilePopDir cleanUp: ; ; remove status dialog ; GetResourceHandleNS CompressStatus, bx mov si, offset CompressStatus mov ax, MSG_GEN_GUP_INTERACTION_COMMAND mov cx, IC_DISMISS clr di call ObjMessage mov ax, MSG_GEN_APPLICATION_MARK_NOT_BUSY call GenCallApplication ; ; all done ; mov ss:[waitForAck], BB_FALSE mov ss:[cancelCompress], BB_FALSE ret ScrapBookDocumentCompressPart2 endm ScrapbookApplicationCancelCompress method dynamic ScrapbookApplicationClass, MSG_SCRAPBOOK_APPLICATION_CANCEL_COMPRESS ; es = dgroup mov es:[cancelCompress], BB_TRUE ret ScrapbookApplicationCancelCompress endm endif CommonCode ends if _SLIDE_SHOW CommonCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlideShowSetColor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the color CALLED BY: MSG_SLIDE_SHOW_SET_TRANSITION PASS: *ds:si - SlideShowClass object ds:di - SlideShow instance dxcx - ColorQuad RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- gene 08/01/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScrapbookApplicationQuit method ScrapbookApplicationClass, MSG_META_QUIT mov ax, MSG_META_SAVE_OPTIONS mov di, offset ScrapbookApplicationClass call ObjCallSuperNoLock mov ax, MSG_META_QUIT mov di, offset ScrapbookApplicationClass GOTO ObjCallSuperNoLock ScrapbookApplicationQuit endm CommonCode ends SlideCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlideShowStart %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Open a full-screen window for a slide show CALLED BY: MSG_SLIDE_SHOW_START PASS: *ds:si - SlideShowClass object ds:di - SlideShow instance RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- gene 07/28/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SlideShowStart method SlideShowClass, MSG_SLIDE_SHOW_START push si ; ; get the field dimensions ; push si mov ax, MSG_GEN_GUP_QUERY mov cx, GUQT_FIELD GetResourceHandleNS ScrapBookApp, bx mov si, offset ScrapBookApp mov di, mask MF_CALL call ObjMessage pop si ; ; stack parameters for WinOpen ; clr ax push ax ;layer ID (not used) call GeodeGetProcessHandle push bx ;owner for window (us) push bp ;parent window = field push ax ;region = rectangular push ax ;region = rectangular mov di, bp ;di <- field window call WinGetWinScreenBounds ;(ax,bx,cx,dx) <- bnds push dx ;bottom push cx ;right push bx ;top push ax ;left mov di, ds:[LMBH_handle] mov bp, si ;^ldi:bp <- expose OD (us) mov cx, di mov dx, si ;^lcx:dx <- input OD (us) mov si, ds:[si] add si, ds:[si].SlideShow_offset mov al, ds:[si].SSI_color.CQ_redOrIndex mov bx, {word}ds:[si].SSI_color.CQ_green mov ah, WinColorFlags < 0, ; WCF_RGB: using color index 0, ; WCF_TRANSPARENT: has background 0, ; WCF_PLAIN: window requires exposes 0, ; WCF_MASKED 0, ; WCF_DRAW_MASK ColorMapMode < ; WCF_MAP_MODE 0, ; CMM_ON_BLACK: black is our ; background color, always. CMT_CLOSEST ; CM_MAP_TYPE: map to ; solid, never pattern or ; dither, please. > > cmp ds:[si].SSI_color.CQ_info, CF_INDEX je gotColor ornf ah, mask WCF_RGB gotColor: mov si, WinPriorityData < LAYER_PRIO_ON_TOP, WIN_PRIO_ON_TOP > ;si <- WinPassFlags call WinOpen ; ; save the window handle for later ; pop si mov di, ds:[si] add di, ds:[di].SlideShow_offset mov ds:[di].SSI_window, bx ;save for later ; ; add a keyboard monitor ; GetResourceHandleNS idata, bx call MemDerefDS mov bx, offset ssKbdMon mov al, ML_DRIVER mov cx, segment SlideShowKbdMon mov dx, offset SlideShowKbdMon call ImAddMonitor GetResourceHandleNS SlideControl, bx mov es:ssUIHan, bx ret SlideShowStart endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlideShowEnd %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Close the full-screen window for a slide show CALLED BY: MSG_SLIDE_SHOW_END PASS: *ds:si - SlideShowClass object ds:di - SlideShow instance RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- gene 07/28/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SlideShowEnd method SlideShowClass, MSG_SLIDE_SHOW_END ; ; close the window ; clr cx xchg ds:[di].SSI_window, cx jcxz done mov di, cx call WinClose ; ; remove the keyboard monitor ; GetResourceHandleNS idata, bx call MemDerefDS mov bx, offset ssKbdMon ;ds:bx <- monitor mov al, mask MF_REMOVE_IMMEDIATE call ImRemoveMonitor done: ret SlideShowEnd endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlideShowDraw %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draw to the full-screen window CALLED BY: MSG_META_EXPOSED PASS: *ds:si - SlideShowClass object ds:di - SlideShow instance RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- gene 07/28/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SlideShowDraw method SlideShowClass, MSG_META_EXPOSED mov cx, ds:[di].SSI_window call GeodeGetProcessHandle mov di, mask MF_FIXUP_DS mov ax, MSG_SCRAPBOOK_DRAW_SLIDE_WINDOW GOTO ObjMessage SlideShowDraw endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlideShowNext, SlideShowPrev %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle mouse input for the slide show CALLED BY: MSG_META_START_SELECT PASS: *ds:si - SlideShowClass object ds:di - SlideShow instance RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- gene 07/28/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SlideShowPrev method SlideShowClass, MSG_META_START_MOVE_COPY, MSG_SLIDE_SHOW_PREVIOUS mov ax, MSG_SCRAPBOOK_PREVIOUS GOTO ChangeSlide SlideShowPrev endm SlideShowNext method SlideShowClass, MSG_META_START_SELECT, MSG_SLIDE_SHOW_NEXT mov ax, MSG_SCRAPBOOK_NEXT FALL_THRU ChangeSlide SlideShowNext endm ChangeSlide proc far class SlideShowClass ; ; clear the window as desired ; mov di, ds:[si] add di, ds:[di].SlideShow_offset mov di, ds:[di].SSI_window ;di <- window tst di ;any window? jz done ;branch if not push ax, si call WinGetWinScreenBounds inc cx inc dx call GrCreateState mov si, ds:[si] add si, ds:[si].SlideShow_offset mov si, ds:[si].SSI_trans call cs:slideShowProcs[si] call GrDestroyState pop ax, si ; ; change the current scrap ; call GeodeGetProcessHandle mov di, mask MF_FIXUP_DS call ObjMessage ; ; invalidate our window to force redraw ; mov di, ds:[si] add di, ds:[di].SlideShow_offset mov di, ds:[di].SSI_window ;di <- window clr ax, bx, bp mov cx, MAX_COORD mov dx, cx call WinInvalReg ;force redraw done: mov ax, mask MRF_PROCESSED ret ChangeSlide endp slideShowProcs nptr.near \ SlideShowClear, SlideShowCornerWipe, SlideShowEdgeWipe, SlideShowFade CheckHack <size slideShowProcs eq SlideShowTransitionType> SlideShowClear proc near ret SlideShowClear endp SlideShowCornerWipe proc near mov si, SAVER_FADE_FAST_SPEED mov bp, mask SWT_RIGHT or mask SWT_BOTTOM call SaverFadeWipe ret SlideShowCornerWipe endp SlideShowEdgeWipe proc near mov si, SAVER_FADE_FAST_SPEED mov bp, mask SWT_RIGHT call SaverFadeWipe ret SlideShowEdgeWipe endp SlideShowFade proc near mov si, SAVER_FADE_FAST_SPEED call SaverFadePatternFade ret SlideShowFade endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlideShowQuit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Quit if both buttons pressed CALLED BY: MSG_META_START_OTHER PASS: *ds:si - SlideShowClass object ds:di - SlideShow instance RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- gene 07/31/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SlideShowMouseQuit method SlideShowClass, MSG_META_START_OTHER mov ax, MSG_SLIDE_SHOW_END call ObjCallInstanceNoLock mov ax, mask MRF_PROCESSED ret SlideShowMouseQuit endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlideShowSetTransition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the transition type CALLED BY: MSG_SLIDE_SHOW_SET_TRANSITION PASS: *ds:si - SlideShowClass object ds:di - SlideShow instance cx - SlideShowTransitionType RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- gene 08/01/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SlideShowSetTransition method SlideShowClass, MSG_SLIDE_SHOW_SET_TRANSITION mov ds:[di].SSI_trans, cx ret SlideShowSetTransition endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlideShowSetColor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the color CALLED BY: MSG_SLIDE_SHOW_SET_TRANSITION PASS: *ds:si - SlideShowClass object ds:di - SlideShow instance dxcx - ColorQuad RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- gene 08/01/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SlideShowSetColor method SlideShowClass, MSG_META_COLORED_OBJECT_SET_COLOR movdw ds:[di].SSI_color, dxcx ret SlideShowSetColor endm SlideCode ends FixedSlideCode segment COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlideShowKbdMon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Monitor keyboard input CALLED BY: im::ProcessUserInput PASS: al = mask MF_DATA di = event type MSG_META_KBD_CHAR: cx = character value dl = CharFlags dh = ShiftState bp low = ToggleState bp high = scan code si = event data ds = seg addr of monitor (idata) RETURN: al = mask MF_DATA if event is to be passed through 0 if we've swallowed the event DESTROYED: ah, bx, ds, es (possibly) cx, dx, si, bp (if event swallowed) PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- eca 11/3/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ssKbdShortcuts KeyboardShortcut \ <0, 0, 0, 0, 0x0, C_SPACE>, ;<spacebar> <0, 0, 0, 0, 0xf, VC_ESCAPE>, ;<Esc> <0, 0, 0, 0, 0xf, VC_LEFT>, ;<left arrow> <0, 0, 0, 0, 0xf, VC_DOWN>, ;<down arrow> <0, 0, 0, 0, 0xf, VC_RIGHT> ;<right arrow> ssMessages word \ MSG_SLIDE_SHOW_NEXT, ;<spacebar> MSG_SLIDE_SHOW_END, ;<Esc> MSG_SLIDE_SHOW_PREVIOUS, ;<left arrow> MSG_SLIDE_SHOW_END, ;<down arrow> MSG_SLIDE_SHOW_NEXT ;<right arrow> SlideShowKbdMon proc far .enter test al, mask MF_DATA jz done ; ; only track keypresses ; cmp di, MSG_META_KBD_CHAR jne done test dl, mask CF_RELEASE jnz done ; ; see if it's one of ours and handle it ; push bx, si, di, ds mov bx, ds:ssUIHan CheckHack <length ssKbdShortcuts eq length ssMessages> mov ax, (length ssKbdShortcuts) segmov ds, cs mov si, offset ssKbdShortcuts call FlowCheckKbdShortcut jnc consumeMe ;branch if not shortcut mov ax, cs:ssMessages[si] mov si, offset SlideControl ;^lbx:si <- object clr di ;di <- send, no fixup call ObjMessage ; ; We don't want the keypress handled elsewhere, so consume the event ; consumeMe: clr al ;gulp... pop bx, si, di, ds done: .leave ret SlideShowKbdMon endp FixedSlideCode ends endif end
oeis/239/A239130.asm
neoneye/loda-programs
11
23493
<filename>oeis/239/A239130.asm<gh_stars>10-100 ; A239130: Smallest positive integer solution x = a(n) of (3^4)*x - 2^n*y = 1 for n >= 0. ; Submitted by <NAME> ; 1,1,1,1,1,17,49,49,177,177,177,177,2225,2225,2225,18609,18609,84145,84145,84145,608433,1657009,1657009,1657009,1657009,1657009,1657009,1657009,135874737,404310193,941181105,2014922929,2014922929,2014922929,10604857521,10604857521,44964595889,113684072625,251123026097,251123026097,800878839985,1900390467761,1900390467761,6298436978865,6298436978865,23890623023281,59074995112113,59074995112113,59074995112113,340549971822769,903499925244081,2029399832086705,4281199645771953,8784799273142449 mov $1,$0 pow $0,0 mov $2,2 pow $2,$1 lpb $1 mul $0,9 pow $0,2 mod $0,$2 sub $1,1 lpe
alloy4fun_models/trashltl/models/4/37qYjWqQeJSgfJ7L7.als
Kaixi26/org.alloytools.alloy
0
2733
open main pred id37qYjWqQeJSgfJ7L7_prop5 { some f : Trash | eventually f not in File } pred __repair { id37qYjWqQeJSgfJ7L7_prop5 } check __repair { id37qYjWqQeJSgfJ7L7_prop5 <=> prop5o }
programs/oeis/016/A016978.asm
neoneye/loda
22
104676
; A016978: a(n) = (6*n + 5)^10. ; 9765625,25937424601,2015993900449,41426511213649,420707233300201,2758547353515625,13422659310152401,52599132235830049,174887470365513049,511116753300641401,1346274334462890625,3255243551009881201,7326680472586200649,15516041187205853449,31181719929966183601,59873693923837890625,110462212541120451001,196715135728956532249,339456738992222314849,569468379011812486801,931322574615478515625,1488377021731616101801,2329194047563391944849,3575694237941010577249,5393400662063408511001,8004182490046884765625,11701964070276793473601,16871927924929095158449,24013807852610947920649,33769941616283277616201,46958831761893056640625,64615048177878503606401,88036397287336250493049,118839380482575369225049,159024068785448665562401,211049631965666494140625,277921878692682183940201,363294289954110647868649,471584161164422542970449,608105609331265108509601,779221350562617197265625,992515310305509690315001,1256988294225653106805249,1583279121786431447236849,1983913807584764801017801,2473585567569732666015625,3069468628627004928970801,3791569030877467700422849,4663115832631376345704249,5710996358479337764047001,6966239371707837900390625,8464550303319308288547601,10246902931634286779441449,12360192178975492163652649,14857952975500019812957201,17801150435075795400390625,21259046894411315872085401,25310151684662980796181049,30043259834681392663962049,35558586247136301325508401,41969002243198805166015625,49401381738478419529024201,57998064692731100928561649,67918445868691693423112449,79340697341459960809860601,92463633619402804697265625,107508728670745863687204001,124722294597134862504103249,144377832156670251607183849,166778563814477267272573801,192260160488986968994140625,221193673666991494984864801,253988685080418137223925849,291096686672861294547856249,333014704134438335386608001,380289177849714310556640625,433520115685490720702646601,493365532643394582186749449,560546193016655269118409649,635850671321437457459323201,720140748920828379384765625,814357163924275931995589401,919525732627160393712894049,1036763861454476003909724049,1167287469089518876200479401,1312418339203244062978515625,1473591924952786487925133201,1652365627188757333968279649,1850427569100548736206279449,2069605890837224702290236601,2311878588468864486337890625,2579383922499675596291118001,2874431422010026638388426249,3199513511389984715762155849,3557317787532197520747154801,3950739976277256011962890625,4382897597850229067263783801,4857144371993096171902453849,5377085394484537457377033249,5946593117746191670096194001 mul $0,6 add $0,5 pow $0,10
tests/notcurses_test.adb
JeremyGrosser/notcursesada
5
27444
-- -- Copyright 2021 (C) <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Exceptions; with Ada.Text_IO; with Tests; use Tests; with Notcurses.Context; with Notcurses; procedure Notcurses_Test is begin begin Notcurses.Context.Initialize; Test_Version; Test_Hello_World; Test_Colors; Test_Palette; Test_Dimensions; Test_Plane_Split; Test_Progress_Bar; Test_Visual_File; Test_Visual_Bitmap; Test_Visual_Pixel; -- Test_Input; Notcurses.Context.Stop; exception when E : others => Notcurses.Context.Stop; Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E)); return; end; Test_Direct; end Notcurses_Test;
libsrc/_DEVELOPMENT/adt/wv_priority_queue/c/sdcc_iy/wv_priority_queue_data.asm
meesokim/z88dk
0
160966
<reponame>meesokim/z88dk<gh_stars>0 ; void *wv_priority_queue_data(wv_priority_queue_t *q) SECTION code_adt_wv_priority_queue PUBLIC _wv_priority_queue_data EXTERN _wa_priority_queue_data defc _wv_priority_queue_data = _wa_priority_queue_data
theorems/cohomology/FlipPushout.agda
cmknapp/HoTT-Agda
0
8814
<reponame>cmknapp/HoTT-Agda<filename>theorems/cohomology/FlipPushout.agda {-# OPTIONS --without-K #-} open import HoTT open import cohomology.FunctionOver {- Flipping the pushout diagram (switching left and right) gives the - same pushout. -} module cohomology.FlipPushout where {- Span-flipping functions -} flip-span : ∀ {i j k} → Span {i} {j} {k} → Span {j} {i} {k} flip-span (span A B C f g) = span B A C g f flip-⊙span : ∀ {i j k} → ⊙Span {i} {j} {k} → ⊙Span {j} {i} {k} flip-⊙span (⊙span X Y Z f g) = ⊙span Y X Z g f {- Pushout-flipping function -} module _ {i j k} {d : Span {i} {j} {k}} where module FlipPushout = PushoutRec (right {d = flip-span d}) (left {d = flip-span d}) (λ z → ! (glue {d = flip-span d} z)) flip-pushout : Pushout d → Pushout (flip-span d) flip-pushout = FlipPushout.f flip-pushout-involutive : ∀ {i j k} (d : Span {i} {j} {k}) (s : Pushout d) → flip-pushout (flip-pushout s) == s flip-pushout-involutive d = Pushout-elim (λ a → idp) (λ b → idp) (λ c → ↓-∘=idf-in flip-pushout flip-pushout $ ap flip-pushout (ap flip-pushout (glue c)) =⟨ ap (ap flip-pushout) (FlipPushout.glue-β c) ⟩ ap flip-pushout (! (glue c)) =⟨ ap-! flip-pushout (glue c) ⟩ ! (ap flip-pushout (glue c)) =⟨ ap ! (FlipPushout.glue-β c) ⟩ ! (! (glue c)) =⟨ !-! (glue c) ⟩ glue c ∎) {- Equivalence for spans with proofs that the equivalence swaps the - injections -} module _ {i j k} (d : Span {i} {j} {k}) where open Span d flip-pushout-equiv : Pushout d ≃ Pushout (flip-span d) flip-pushout-equiv = equiv flip-pushout flip-pushout (flip-pushout-involutive (flip-span d)) (flip-pushout-involutive d) flip-pushout-path : Pushout d == Pushout (flip-span d) flip-pushout-path = ua flip-pushout-equiv flip-left : left == right [ (λ D → (A → D)) ↓ flip-pushout-path ] flip-left = codomain-over-equiv _ _ flip-right : right == left [ (λ D → (B → D)) ↓ flip-pushout-path ] flip-right = codomain-over-equiv _ _ {- Path for pointed spans with proofs that the path swaps the pointed - injections -} module _ {i j k} (ps : ⊙Span {i} {j} {k}) where open ⊙Span ps private s = ⊙span-out ps preserves : –> (flip-pushout-equiv s) (left (snd X)) == left (snd Y) preserves = snd (⊙right (flip-⊙span ps)) flip-⊙pushout : fst (⊙Pushout ps ⊙→ ⊙Pushout (flip-⊙span ps)) flip-⊙pushout = (FlipPushout.f , preserves) flip-⊙pushout-path : ⊙Pushout ps == ⊙Pushout (flip-⊙span ps) flip-⊙pushout-path = ⊙ua (⊙≃-in (flip-pushout-equiv s) preserves) {- action of [flip-pushout] on [snd ⊙right] -} ap-flip-right : ap flip-pushout (snd (⊙right ps)) == ! (snd (⊙right (flip-⊙span ps))) ap-flip-right = lemma f g where lemma : {X : Ptd i} {Y : Ptd j} {Z : Ptd k} (f : fst (Z ⊙→ X)) (g : fst (Z ⊙→ Y)) → ap (flip-pushout {d = ⊙span-out (⊙span X Y Z f g)}) (ap right (! (snd g)) ∙ ! (glue (snd Z)) ∙' ap left (snd f)) == ! (ap right (! (snd f)) ∙ ! (glue (snd Z)) ∙' ap left (snd g)) lemma {Z = Z} (f , idp) (g , idp) = ap flip-pushout (! (glue (snd Z))) =⟨ ap-! flip-pushout (glue (snd Z)) ⟩ ! (ap flip-pushout (glue (snd Z))) =⟨ FlipPushout.glue-β (snd Z) |in-ctx ! ⟩ ! (! (glue (snd Z))) ∎ flip-⊙left : ⊙left ps == ⊙right (flip-⊙span ps) [ (λ W → fst (X ⊙→ W)) ↓ flip-⊙pushout-path ] flip-⊙left = codomain-over-⊙equiv _ _ flip-⊙right : ⊙right ps == ⊙left (flip-⊙span ps) [ (λ W → fst (Y ⊙→ W)) ↓ flip-⊙pushout-path ] flip-⊙right = codomain-over-⊙equiv _ _ ▹ pair= idp (ap (λ w → w ∙ preserves) ap-flip-right ∙ !-inv-l preserves) flip-⊙pushout-involutive : ∀ {i j k} (ps : ⊙Span {i} {j} {k}) → flip-⊙pushout (flip-⊙span ps) ⊙∘ flip-⊙pushout ps == ⊙idf _ flip-⊙pushout-involutive ps = ⊙λ= (flip-pushout-involutive _) lemma where lemma : ap flip-pushout (snd (⊙right (flip-⊙span ps))) ∙ snd (⊙right ps) == idp lemma = ap flip-pushout (snd (⊙right (flip-⊙span ps))) ∙ snd (⊙right ps) =⟨ ap-flip-right (flip-⊙span ps) |in-ctx (λ w → w ∙ snd (⊙right ps)) ⟩ ! (snd (⊙right ps)) ∙ snd (⊙right ps) =⟨ !-inv-l (snd (⊙right ps)) ⟩ idp
Setoids/Orders/Partial/Definition.agda
Smaug123/agdaproofs
4
3045
{-# OPTIONS --safe --warning=error --without-K #-} open import Sets.EquivalenceRelations open import LogicalFormulae open import Orders.Total.Definition open import Orders.Partial.Definition open import Setoids.Setoids open import Functions.Definition open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) module Setoids.Orders.Partial.Definition where record SetoidPartialOrder {a b c : _} {A : Set a} (S : Setoid {a} {b} A) (_<_ : Rel {a} {c} A) : Set (a ⊔ b ⊔ c) where open Setoid S field <WellDefined : {a b c d : A} → (a ∼ b) → (c ∼ d) → a < c → b < d irreflexive : {x : A} → (x < x) → False <Transitive : {a b c : A} → (a < b) → (b < c) → (a < c) _<=_ : Rel {a} {b ⊔ c} A a <= b = (a < b) || (a ∼ b) <=Transitive : {a b c : A} → (a <= b) → (b <= c) → (a <= c) <=Transitive (inl a<b) (inl b<c) = inl (<Transitive a<b b<c) <=Transitive (inl a<b) (inr b=c) = inl (<WellDefined (Equivalence.reflexive eq) b=c a<b) <=Transitive (inr a=b) (inl b<c) = inl (<WellDefined (Equivalence.symmetric eq a=b) (Equivalence.reflexive eq) b<c) <=Transitive (inr a=b) (inr b=c) = inr (Equivalence.transitive eq a=b b=c) partialOrderToSetoidPartialOrder : {a b : _} {A : Set a} (P : PartialOrder {a} A {b}) → SetoidPartialOrder (reflSetoid A) (PartialOrder._<_ P) SetoidPartialOrder.<WellDefined (partialOrderToSetoidPartialOrder P) a=b c=d a<c rewrite a=b | c=d = a<c SetoidPartialOrder.irreflexive (partialOrderToSetoidPartialOrder P) = PartialOrder.irreflexive P SetoidPartialOrder.<Transitive (partialOrderToSetoidPartialOrder P) = PartialOrder.<Transitive P
winxp_sp3/trun/enable_rdp/win-api_enable-rdp/firewall_enable-rdp_winapi.nasm
danf42/vulnserver
0
244000
<filename>winxp_sp3/trun/enable_rdp/win-api_enable-rdp/firewall_enable-rdp_winapi.nasm ; Purpose: ; Enable RDP via Windows API ; Open port 3386 ; set fDenyTSConnections to False [BITS 32] global _start _start: ;for the handle xor edx, edx mov edi, esp mov dword [edi], edx sub esp, 0x10 ;avoid handle being overwritten ; Prepare the key ; SYSTEM\CurrentControlSet\Control\Terminal Server push edx push 0x72657672 push 0x6553206c push 0x616e696d push 0x7265545c push 0x6c6f7274 push 0x6e6f435c push 0x7465536c push 0x6f72746e push 0x6f43746e push 0x65727275 push 0x435c4d45 push 0x54535953 mov edx, esp ; https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regcreatekeyexa ; https://www.pinvoke.net/default.aspx/advapi32/RegCreateKeyA.html xor eax, eax push eax ; pDisposion = NULL push edi ; pHandle push eax ; pSecurity = NULL push 0x0f003f ; Access = KEY_ALL_ACCESS push eax ; Options = REG_OPTION_NON_VOLATILE push eax ; Class = NULL push eax ; Reserved = NULL push edx ; Subkey push 0x80000002 ; hkey = HKEY_LOCAL_MACHINE mov eax, 0x77dde9e4 ; RegCreateKeyExA call eax ; RegSetValue ValueName = fDenyTSConnections push 0x0000736e push 0x6f697463 push 0x656e6e6f push 0x43535479 push 0x6e654466 mov edx, esp ; RegSetValue buffer = 0 xor ecx, ecx push ecx mov ecx, esp ; https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regsetvalueexa ; https://www.pinvoke.net/default.aspx/advapi32.reggetvalue xor eax, eax push 0x4 ; cbData - size of DWORD push ecx ; lpData - pointer to data (0) push 0x4 ; dwType - REG_DWORD push eax ; Reserved - must by Null push edx ; lpValueName push dword [edi] ; hKey mov eax, 0x77ddead7 ; RegSetValueExA call eax ; Close handle to Key push dword [edi] ;hKey mov eax, 0x77dd6c17 ;RegCloseKey call eax ;Prepare the key ; SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\Firewallpolicy\StandardProfile\GloballyOpenPorts\List push 0x00747369 push 0x4c5c7374 push 0x726f506e push 0x65704f79 push 0x6c6c6162 push 0x6f6c475c push 0x656c6966 push 0x6f725064 push 0x7261646e push 0x6174535c push 0x7963696c push 0x6f706c6c push 0x61776572 push 0x69465c73 push 0x72657465 push 0x6d617261 push 0x505c7373 push 0x65636341 push 0x64657261 push 0x68535c73 push 0x65636976 push 0x7265535c push 0x7465536c push 0x6f72746e push 0x6f43746e push 0x65727275 push 0x435c4d45 push 0x54535953 mov edx, esp ; https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regcreatekeyexa ; https://www.pinvoke.net/default.aspx/advapi32/RegCreateKeyA.html xor eax, eax push eax ;pDisposion = NULL push edi ;pHandle push eax ;pSecurity = NULL push 0x0f003f ;Access = KEY_ALL_ACCESS push eax ;Options = REG_OPTION_NON_VOLATILE push eax ;Class = NULL push eax ;Reserved = NULL push edx ;Subkey push 0x80000002 ;hkey = HKEY_LOCAL_MACHINE mov eax, 0x77dde9e4 ;RegCreateKeyExA call eax ; RegSetValue ValueName = 3389:TCP xor edx, edx push edx push 0x5043543a push 0x39383333 mov edx, esp ; RegSetValue buffer = 3389:TCP:*:Enabled:RDP xor ecx, ecx push ecx push 0x00205044 push 0x523a6465 push 0x6c62616e push 0x453a2a3a push 0x5043543a push 0x39383333 mov ecx, esp ; https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regsetvalueexa ; https://www.pinvoke.net/default.aspx/advapi32.reggetvalue xor eax, eax inc eax push 0x18 ;BufSize = 0x16 push ecx ;Buffer push eax ;ValueType = REG-SZ dec eax push eax ;Reserved = 0 push edx ;ValueName push dword [edi] ;hKey mov eax, 0x77ddead7 ;RegSetValueExA call eax ; Close handle to Key push dword [edi] ;hKey mov eax, 0x77dd6c17 ;RegCloseKey call eax
alloy4fun_models/trashltl/models/7/bAPL8vujSi3o7pebs.als
Kaixi26/org.alloytools.alloy
0
684
open main pred idbAPL8vujSi3o7pebs_prop8 { always (all f : File | some f.link implies eventually link.f in Trash) } pred __repair { idbAPL8vujSi3o7pebs_prop8 } check __repair { idbAPL8vujSi3o7pebs_prop8 <=> prop8o }
programs/oeis/129/A129011.asm
karttu/loda
0
27637
<reponame>karttu/loda ; A129011: a(n) = floor(n^(4/3)). ; 0,1,2,4,6,8,10,13,16,18,21,24,27,30,33,36,40,43,47,50,54,57,61,65,69,73,77,81,85,89,93,97,101,105,110,114,118,123,127,132,136,141,145,150,155,160,164,169,174,179,184,189,194,199,204,209,214,219,224,229,234 mov $27,$0 mov $29,2 lpb $29,1 clr $0,27 mov $0,$27 sub $29,1 add $0,$29 sub $0,1 mov $24,$0 mov $26,$0 lpb $26,1 clr $0,24 mov $0,$24 sub $26,1 sub $0,$26 mov $21,$0 mov $23,$0 lpb $23,1 mov $0,$21 sub $23,1 sub $0,$23 mov $17,$0 mov $19,2 lpb $19,1 clr $0,17 mov $0,$17 sub $19,1 add $0,$19 sub $0,1 pow $0,4 lpb $0,1 sub $0,1 add $4,6 add $1,$4 trn $0,$1 lpe mov $1,$4 mov $20,$19 lpb $20,1 mov $18,$1 sub $20,1 lpe lpe lpb $17,1 mov $17,0 sub $18,$1 lpe mov $1,$18 div $1,6 add $22,$1 lpe add $25,$22 lpe mov $1,$25 mov $30,$29 lpb $30,1 mov $28,$1 sub $30,1 lpe lpe lpb $27,1 mov $27,0 sub $28,$1 lpe mov $1,$28
test/Succeed/Issue1998.agda
alhassy/agda
3
5606
<filename>test/Succeed/Issue1998.agda {-# OPTIONS --allow-unsolved-metas #-} postulate Foo : Set record BaseT : Set₁ where field f : Foo record ParamT (p : Foo) : Set₁ where field f : Foo instance postulate asBaseT : ∀ {p} → ParamT p → BaseT -- BaseT.f (asBaseT p) = ParamT.f p data Bar : Set where o : Bar data Baz {{_ : BaseT}} : Bar → Set where t1 : Baz o t2 : Baz o → Baz o t3 : Baz o → Baz o → Baz o t4 : Baz o → Baz o → Baz o → Baz o
src/SystemF/Syntax/Term.agda
metaborg/ts.agda
4
7678
<filename>src/SystemF/Syntax/Term.agda module SystemF.Syntax.Term where open import Prelude open import SystemF.Syntax.Type infixl 9 _[_] _·_ data Term (ν n : ℕ) : Set where var : (x : Fin n) → Term ν n Λ : Term (suc ν) n → Term ν n λ' : Type ν → Term ν (suc n) → Term ν n _[_] : Term ν n → Type ν → Term ν n _·_ : Term ν n → Term ν n → Term ν n
libsrc/_DEVELOPMENT/arch/zxn/memory/c/sdcc/zxn_addr_in_mmu_callee.asm
jpoikela/z88dk
640
6259
; unsigned int zxn_addr_in_mmu(unsigned char mmu, unsigned int addr) SECTION code_clib SECTION code_arch PUBLIC _zxn_addr_in_mmu_callee EXTERN asm_zxn_addr_in_mmu _zxn_addr_in_mmu_callee: pop hl dec sp pop af ex (sp),hl jp asm_zxn_addr_in_mmu
programs/oeis/024/A024127.asm
neoneye/loda
22
3197
<reponame>neoneye/loda ; A024127: a(n) = 11^n-1. ; 0,10,120,1330,14640,161050,1771560,19487170,214358880,2357947690,25937424600,285311670610,3138428376720,34522712143930,379749833583240,4177248169415650,45949729863572160,505447028499293770 mov $1,11 pow $1,$0 sub $1,1 mov $0,$1
Classes/alias/info for/info for (path to me).applescript
looking-for-a-job/applescript-examples
1
3393
#!/usr/bin/osascript info for (path to me)
util/gut/thini.asm
olifink/smsqe
0
101917
; Thing Initialisation V1.00  1990 <NAME> QJUMP section gen_util xdef gu_thini xref gu_achpp xref gu_thzlk include 'dev8_keys_thg' include 'dev8_mac_assert' ;+++ ; Create a Thing. The linkage block is filled with sensible defaults. ; ; The pointer to the extension Thing definition should point to 3 long words ; and the Thing name: ; long word linkage block alloc ; long relative pointer to Thing (or 0) ; long word Version ID ; Thing name ; ; Registers: ; Entry Exit ; D0 error code ; A1 Pointer to Extension def base of linkage block ;--- gu_thini gti.reg reg a0/a2 movem.l gti.reg,-(sp) move.l (a1)+,d0 jsr gu_achpp ; allocate linkage bne.s gti_exit move.l a1,a2 ; thing move.l (a2)+,d0 beq.s gti_sver add.l d0,a1 move.l a1,th_thing(a0) ; pointer to thing gti_sver assert th_verid,th_name-4 lea th_verid(a0),a1 move.l (a2)+,(a1)+ ; version move.w (a2)+,d0 move.w d0,(a1)+ bra.s gti_cend gti_cloop move.b (a2)+,(a1)+ ; name gti_cend dbra d0,gti_cloop move.l a0,a1 ; we need this as well for return jsr gu_thzlk ; link in gti_exit movem.l (sp)+,gti.reg rts end
NEWPT.asm
LutzGrosshennig/amiga-drunken-coder-intro
0
25909
<gh_stars>0 ;************************************************** ;* ----- Protracker V2.3A Playroutine ----- * ;************************************************** ; VBlank Version 2: ; Call mt_init to initialize the routine, then call mt_music on ; each vertical blank (50 Hz). To end the song and turn off all ; voices, call mt_end. ; This playroutine is not very fast, optimized or well commented, ; but all the new commands in PT2.3A should work. ; If it's not good enough, you'll have to change it yourself. ; We'll try to write a faster routine soon... ; Changes from V1.0C playroutine: ; - Vibrato depth changed to be compatible with Noisetracker 2.0. ; You'll have to double all vib. depths on old PT modules. ; - Funk Repeat changed to Invert Loop. ; - Period set back earlier when stopping an effect. DMAWait = 300 ; Set this as low as possible without losing low notes. n_note EQU 0 ; W n_cmd EQU 2 ; W n_cmdlo EQU 3 ; B n_start EQU 4 ; L n_length EQU 8 ; W n_loopstart EQU 10 ; L n_replen EQU 14 ; W n_period EQU 16 ; W n_finetune EQU 18 ; B n_volume EQU 19 ; B n_dmabit EQU 20 ; W n_toneportdirec EQU 22 ; B n_toneportspeed EQU 23 ; B n_wantedperiod EQU 24 ; W n_vibratocmd EQU 26 ; B n_vibratopos EQU 27 ; B n_tremolocmd EQU 28 ; B n_tremolopos EQU 29 ; B n_wavecontrol EQU 30 ; B n_glissfunk EQU 31 ; B n_sampleoffset EQU 32 ; B n_pattpos EQU 33 ; B n_loopcount EQU 34 ; B n_funkoffset EQU 35 ; B n_wavestart EQU 36 ; L n_reallength EQU 40 ; W mt_init: LEA mt_data,A0 MOVE.L A0,mt_SongDataPtr MOVE.L A0,A1 LEA 952(A1),A1 MOVEQ #127,D0 MOVEQ #0,D1 mtloop: MOVE.L D1,D2 SUBQ.W #1,D0 mtloop2: MOVE.B (A1)+,D1 CMP.B D2,D1 BGT.S mtloop DBRA D0,mtloop2 ADDQ.B #1,D2 LEA mt_SampleStarts(PC),A1 ASL.L #8,D2 ASL.L #2,D2 ADD.L #1084,D2 ADD.L A0,D2 MOVE.L D2,A2 MOVEQ #30,D0 mtloop3: CLR.L (A2) MOVE.L A2,(A1)+ MOVEQ #0,D1 MOVE.W 42(A0),D1 ASL.L #1,D1 ADD.L D1,A2 ADD.L #30,A0 DBRA D0,mtloop3 OR.B #2,$BFE001 MOVE.B #6,mt_speed CLR.B mt_counter CLR.B mt_SongPos CLR.W mt_PatternPos mt_end: CLR.W $DFF0A8 CLR.W $DFF0B8 CLR.W $DFF0C8 CLR.W $DFF0D8 MOVE.W #$F,$DFF096 RTS mt_music: MOVEM.L D0-D4/A0-A6,-(SP) ADDQ.B #1,mt_counter MOVE.B mt_counter(PC),D0 CMP.B mt_speed(PC),D0 BLO.S mt_NoNewNote CLR.B mt_counter TST.B mt_PattDelTime2 BEQ.S mt_GetNewNote BSR.S mt_NoNewAllChannels BRA mt_dskip mt_NoNewNote: BSR.S mt_NoNewAllChannels BRA mt_NoNewPosYet mt_NoNewAllChannels: LEA $DFF0A0,A5 LEA mt_chan1temp(PC),A6 BSR mt_CheckEfx LEA $DFF0B0,A5 LEA mt_chan2temp(PC),A6 BSR mt_CheckEfx LEA $DFF0C0,A5 LEA mt_chan3temp(PC),A6 BSR mt_CheckEfx LEA $DFF0D0,A5 LEA mt_chan4temp(PC),A6 BRA mt_CheckEfx mt_GetNewNote: MOVE.L mt_SongDataPtr(PC),A0 LEA 12(A0),A3 LEA 952(A0),A2 ;pattpo LEA 1084(A0),A0 ;patterndata MOVEQ #0,D0 MOVEQ #0,D1 MOVE.B mt_SongPos(PC),D0 MOVE.B (A2,D0.W),D1 ASL.L #8,D1 ASL.L #2,D1 ADD.W mt_PatternPos(PC),D1 CLR.W mt_DMACONtemp LEA $DFF0A0,A5 LEA mt_chan1temp(PC),A6 BSR.S mt_PlayVoice LEA $DFF0B0,A5 LEA mt_chan2temp(PC),A6 BSR.S mt_PlayVoice LEA $DFF0C0,A5 LEA mt_chan3temp(PC),A6 BSR.S mt_PlayVoice LEA $DFF0D0,A5 LEA mt_chan4temp(PC),A6 BSR.S mt_PlayVoice BRA mt_SetDMA mt_PlayVoice: TST.L (A6) BNE.S mt_plvskip BSR mt_PerNop mt_plvskip: MOVE.L (A0,D1.L),(A6) ADDQ.L #4,D1 MOVEQ #0,D2 MOVE.B n_cmd(A6),D2 AND.B #$F0,D2 LSR.B #4,D2 MOVE.B (A6),D0 AND.B #$F0,D0 OR.B D0,D2 TST.B D2 BEQ mt_SetRegs MOVEQ #0,D3 LEA mt_SampleStarts(PC),A1 MOVE D2,D4 SUBQ.L #1,D2 ASL.L #2,D2 MULU #30,D4 MOVE.L (A1,D2.L),n_start(A6) MOVE.W (A3,D4.L),n_length(A6) MOVE.W (A3,D4.L),n_reallength(A6) MOVE.B 2(A3,D4.L),n_finetune(A6) MOVE.B 3(A3,D4.L),n_volume(A6) MOVE.W 4(A3,D4.L),D3 ; Get repeat TST.W D3 BEQ.S mt_NoLoop MOVE.L n_start(A6),D2 ; Get start ASL.W #1,D3 ADD.L D3,D2 ; Add repeat MOVE.L D2,n_loopstart(A6) MOVE.L D2,n_wavestart(A6) MOVE.W 4(A3,D4.L),D0 ; Get repeat ADD.W 6(A3,D4.L),D0 ; Add replen MOVE.W D0,n_length(A6) MOVE.W 6(A3,D4.L),n_replen(A6) ; Save replen MOVEQ #0,D0 MOVE.B n_volume(A6),D0 MOVE.W D0,8(A5) ; Set volume BRA.S mt_SetRegs mt_NoLoop: MOVE.L n_start(A6),D2 ADD.L D3,D2 MOVE.L D2,n_loopstart(A6) MOVE.L D2,n_wavestart(A6) MOVE.W 6(A3,D4.L),n_replen(A6) ; Save replen MOVEQ #0,D0 MOVE.B n_volume(A6),D0 MOVE.W D0,8(A5) ; Set volume mt_SetRegs: MOVE.W (A6),D0 AND.W #$0FFF,D0 BEQ mt_CheckMoreEfx ; If no note MOVE.W 2(A6),D0 AND.W #$0FF0,D0 CMP.W #$0E50,D0 BEQ.S mt_DoSetFineTune MOVE.B 2(A6),D0 AND.B #$0F,D0 CMP.B #3,D0 ; TonePortamento BEQ.S mt_ChkTonePorta CMP.B #5,D0 BEQ.S mt_ChkTonePorta CMP.B #9,D0 ; Sample Offset BNE.S mt_SetPeriod BSR mt_CheckMoreEfx BRA.S mt_SetPeriod mt_DoSetFineTune: BSR mt_SetFineTune BRA.S mt_SetPeriod mt_ChkTonePorta: BSR mt_SetTonePorta BRA mt_CheckMoreEfx mt_SetPeriod: MOVEM.L D0-D1/A0-A1,-(SP) MOVE.W (A6),D1 AND.W #$0FFF,D1 LEA mt_PeriodTable(PC),A1 MOVEQ #0,D0 MOVEQ #36,D7 mt_ftuloop: CMP.W (A1,D0.W),D1 BHS.S mt_ftufound ADDQ.L #2,D0 DBRA D7,mt_ftuloop mt_ftufound: MOVEQ #0,D1 MOVE.B n_finetune(A6),D1 MULU #36*2,D1 ADD.L D1,A1 MOVE.W (A1,D0.W),n_period(A6) MOVEM.L (SP)+,D0-D1/A0-A1 MOVE.W 2(A6),D0 AND.W #$0FF0,D0 CMP.W #$0ED0,D0 ; Notedelay BEQ mt_CheckMoreEfx MOVE.W n_dmabit(A6),$DFF096 BTST #2,n_wavecontrol(A6) BNE.S mt_vibnoc CLR.B n_vibratopos(A6) mt_vibnoc: BTST #6,n_wavecontrol(A6) BNE.S mt_trenoc CLR.B n_tremolopos(A6) mt_trenoc: MOVE.L n_start(A6),(A5) ; Set start MOVE.W n_length(A6),4(A5) ; Set length MOVE.W n_period(A6),D0 MOVE.W D0,6(A5) ; Set period MOVE.W n_dmabit(A6),D0 OR.W D0,mt_DMACONtemp BRA mt_CheckMoreEfx mt_SetDMA: MOVE.W #300,D0 mt_WaitDMA: DBRA D0,mt_WaitDMA MOVE.W mt_DMACONtemp(PC),D0 OR.W #$8000,D0 MOVE.W D0,$DFF096 MOVE.W #300,D0 mt_WaitDMA2: DBRA D0,mt_WaitDMA2 LEA $DFF000,A5 LEA mt_chan4temp(PC),A6 MOVE.L n_loopstart(A6),$D0(A5) MOVE.W n_replen(A6),$D4(A5) LEA mt_chan3temp(PC),A6 MOVE.L n_loopstart(A6),$C0(A5) MOVE.W n_replen(A6),$C4(A5) LEA mt_chan2temp(PC),A6 MOVE.L n_loopstart(A6),$B0(A5) MOVE.W n_replen(A6),$B4(A5) LEA mt_chan1temp(PC),A6 MOVE.L n_loopstart(A6),$A0(A5) MOVE.W n_replen(A6),$A4(A5) mt_dskip: ADD.W #16,mt_PatternPos MOVE.B mt_PattDelTime,D0 BEQ.S mt_dskc MOVE.B D0,mt_PattDelTime2 CLR.B mt_PattDelTime mt_dskc: TST.B mt_PattDelTime2 BEQ.S mt_dska SUBQ.B #1,mt_PattDelTime2 BEQ.S mt_dska SUB.W #16,mt_PatternPos mt_dska: TST.B mt_PBreakFlag BEQ.S mt_nnpysk SF mt_PBreakFlag MOVEQ #0,D0 MOVE.B mt_PBreakPos(PC),D0 CLR.B mt_PBreakPos LSL.W #4,D0 MOVE.W D0,mt_PatternPos mt_nnpysk: CMP.W #1024,mt_PatternPos BLO.S mt_NoNewPosYet mt_NextPosition: MOVEQ #0,D0 MOVE.B mt_PBreakPos(PC),D0 LSL.W #4,D0 MOVE.W D0,mt_PatternPos CLR.B mt_PBreakPos CLR.B mt_PosJumpFlag ADDQ.B #1,mt_SongPos AND.B #$7F,mt_SongPos MOVE.B mt_SongPos(PC),D1 MOVE.L mt_SongDataPtr(PC),A0 CMP.B 950(A0),D1 BLO.S mt_NoNewPosYet CLR.B mt_SongPos mt_NoNewPosYet: TST.B mt_PosJumpFlag BNE.S mt_NextPosition MOVEM.L (SP)+,D0-D4/A0-A6 RTS mt_CheckEfx: BSR mt_UpdateFunk MOVE.W n_cmd(A6),D0 AND.W #$0FFF,D0 BEQ.S mt_PerNop MOVE.B n_cmd(A6),D0 AND.B #$0F,D0 BEQ.S mt_Arpeggio CMP.B #1,D0 BEQ mt_PortaUp CMP.B #2,D0 BEQ mt_PortaDown CMP.B #3,D0 BEQ mt_TonePortamento CMP.B #4,D0 BEQ mt_Vibrato CMP.B #5,D0 BEQ mt_TonePlusVolSlide CMP.B #6,D0 BEQ mt_VibratoPlusVolSlide CMP.B #$E,D0 BEQ mt_E_Commands SetBack: MOVE.W n_period(A6),6(A5) CMP.B #7,D0 BEQ mt_Tremolo CMP.B #$A,D0 BEQ mt_VolumeSlide mt_Return2: RTS mt_PerNop: MOVE.W n_period(A6),6(A5) RTS mt_Arpeggio: MOVEQ #0,D0 MOVE.B mt_counter(PC),D0 DIVS #3,D0 SWAP D0 CMP.W #0,D0 BEQ.S mt_Arpeggio2 CMP.W #2,D0 BEQ.S mt_Arpeggio1 MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 LSR.B #4,D0 BRA.S mt_Arpeggio3 mt_Arpeggio1: MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 AND.B #15,D0 BRA.S mt_Arpeggio3 mt_Arpeggio2: MOVE.W n_period(A6),D2 BRA.S mt_Arpeggio4 mt_Arpeggio3: ASL.W #1,D0 MOVEQ #0,D1 MOVE.B n_finetune(A6),D1 MULU #36*2,D1 LEA mt_PeriodTable(PC),A0 ADD.L D1,A0 MOVEQ #0,D1 MOVE.W n_period(A6),D1 MOVEQ #36,D7 mt_arploop: MOVE.W (A0,D0.W),D2 CMP.W (A0),D1 BHS.S mt_Arpeggio4 ADDQ.L #2,A0 DBRA D7,mt_arploop RTS mt_Arpeggio4: MOVE.W D2,6(A5) RTS mt_FinePortaUp: TST.B mt_counter BNE.S mt_Return2 MOVE.B #$0F,mt_LowMask mt_PortaUp: MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 AND.B mt_LowMask(PC),D0 MOVE.B #$FF,mt_LowMask SUB.W D0,n_period(A6) MOVE.W n_period(A6),D0 AND.W #$0FFF,D0 CMP.W #113,D0 BPL.S mt_PortaUskip AND.W #$F000,n_period(A6) OR.W #113,n_period(A6) mt_PortaUskip: MOVE.W n_period(A6),D0 AND.W #$0FFF,D0 MOVE.W D0,6(A5) RTS mt_FinePortaDown: TST.B mt_counter BNE mt_Return2 MOVE.B #$0F,mt_LowMask mt_PortaDown: CLR.W D0 MOVE.B n_cmdlo(A6),D0 AND.B mt_LowMask(PC),D0 MOVE.B #$FF,mt_LowMask ADD.W D0,n_period(A6) MOVE.W n_period(A6),D0 AND.W #$0FFF,D0 CMP.W #856,D0 BMI.S mt_PortaDskip AND.W #$F000,n_period(A6) OR.W #856,n_period(A6) mt_PortaDskip: MOVE.W n_period(A6),D0 AND.W #$0FFF,D0 MOVE.W D0,6(A5) RTS mt_SetTonePorta: MOVE.L A0,-(SP) MOVE.W (A6),D2 AND.W #$0FFF,D2 MOVEQ #0,D0 MOVE.B n_finetune(A6),D0 MULU #36*2,D0 ;37? LEA mt_PeriodTable(PC),A0 ADD.L D0,A0 MOVEQ #0,D0 mt_StpLoop: CMP.W (A0,D0.W),D2 BHS.S mt_StpFound ADDQ.W #2,D0 CMP.W #36*2,D0 ;37? BLO.S mt_StpLoop MOVEQ #35*2,D0 mt_StpFound: MOVE.B n_finetune(A6),D2 AND.B #8,D2 BEQ.S mt_StpGoss TST.W D0 BEQ.S mt_StpGoss SUBQ.W #2,D0 mt_StpGoss: MOVE.W (A0,D0.W),D2 MOVE.L (SP)+,A0 MOVE.W D2,n_wantedperiod(A6) MOVE.W n_period(A6),D0 CLR.B n_toneportdirec(A6) CMP.W D0,D2 BEQ.S mt_ClearTonePorta BGE mt_Return2 MOVE.B #1,n_toneportdirec(A6) RTS mt_ClearTonePorta: CLR.W n_wantedperiod(A6) RTS mt_TonePortamento: MOVE.B n_cmdlo(A6),D0 BEQ.S mt_TonePortNoChange MOVE.B D0,n_toneportspeed(A6) CLR.B n_cmdlo(A6) mt_TonePortNoChange: TST.W n_wantedperiod(A6) BEQ mt_Return2 MOVEQ #0,D0 MOVE.B n_toneportspeed(A6),D0 TST.B n_toneportdirec(A6) BNE.S mt_TonePortaUp mt_TonePortaDown: ADD.W D0,n_period(A6) MOVE.W n_wantedperiod(A6),D0 CMP.W n_period(A6),D0 BGT.S mt_TonePortaSetPer MOVE.W n_wantedperiod(A6),n_period(A6) CLR.W n_wantedperiod(A6) BRA.S mt_TonePortaSetPer mt_TonePortaUp: SUB.W D0,n_period(A6) MOVE.W n_wantedperiod(A6),D0 CMP.W n_period(A6),D0 BLT.S mt_TonePortaSetPer MOVE.W n_wantedperiod(A6),n_period(A6) CLR.W n_wantedperiod(A6) mt_TonePortaSetPer: MOVE.W n_period(A6),D2 MOVE.B n_glissfunk(A6),D0 AND.B #$0F,D0 BEQ.S mt_GlissSkip MOVEQ #0,D0 MOVE.B n_finetune(A6),D0 MULU #36*2,D0 LEA mt_PeriodTable(PC),A0 ADD.L D0,A0 MOVEQ #0,D0 mt_GlissLoop: CMP.W (A0,D0.W),D2 BHS.S mt_GlissFound ADDQ.W #2,D0 CMP.W #36*2,D0 BLO.S mt_GlissLoop MOVEQ #35*2,D0 mt_GlissFound: MOVE.W (A0,D0.W),D2 mt_GlissSkip: MOVE.W D2,6(A5) ; Set period RTS mt_Vibrato: MOVE.B n_cmdlo(A6),D0 BEQ.S mt_Vibrato2 MOVE.B n_vibratocmd(A6),D2 AND.B #$0F,D0 BEQ.S mt_vibskip AND.B #$F0,D2 OR.B D0,D2 mt_vibskip: MOVE.B n_cmdlo(A6),D0 AND.B #$F0,D0 BEQ.S mt_vibskip2 AND.B #$0F,D2 OR.B D0,D2 mt_vibskip2: MOVE.B D2,n_vibratocmd(A6) mt_Vibrato2: MOVE.B n_vibratopos(A6),D0 LEA mt_VibratoTable(PC),A4 LSR.W #2,D0 AND.W #$001F,D0 MOVEQ #0,D2 MOVE.B n_wavecontrol(A6),D2 AND.B #$03,D2 BEQ.S mt_vib_sine LSL.B #3,D0 CMP.B #1,D2 BEQ.S mt_vib_rampdown MOVE.B #255,D2 BRA.S mt_vib_set mt_vib_rampdown: TST.B n_vibratopos(A6) BPL.S mt_vib_rampdown2 MOVE.B #255,D2 SUB.B D0,D2 BRA.S mt_vib_set mt_vib_rampdown2: MOVE.B D0,D2 BRA.S mt_vib_set mt_vib_sine: MOVE.B 0(A4,D0.W),D2 mt_vib_set: MOVE.B n_vibratocmd(A6),D0 AND.W #15,D0 MULU D0,D2 LSR.W #7,D2 MOVE.W n_period(A6),D0 TST.B n_vibratopos(A6) BMI.S mt_VibratoNeg ADD.W D2,D0 BRA.S mt_Vibrato3 mt_VibratoNeg: SUB.W D2,D0 mt_Vibrato3: MOVE.W D0,6(A5) MOVE.B n_vibratocmd(A6),D0 LSR.W #2,D0 AND.W #$003C,D0 ADD.B D0,n_vibratopos(A6) RTS mt_TonePlusVolSlide: BSR mt_TonePortNoChange BRA mt_VolumeSlide mt_VibratoPlusVolSlide: BSR.S mt_Vibrato2 BRA mt_VolumeSlide mt_Tremolo: MOVE.B n_cmdlo(A6),D0 BEQ.S mt_Tremolo2 MOVE.B n_tremolocmd(A6),D2 AND.B #$0F,D0 BEQ.S mt_treskip AND.B #$F0,D2 OR.B D0,D2 mt_treskip: MOVE.B n_cmdlo(A6),D0 AND.B #$F0,D0 BEQ.S mt_treskip2 AND.B #$0F,D2 OR.B D0,D2 mt_treskip2: MOVE.B D2,n_tremolocmd(A6) mt_Tremolo2: MOVE.B n_tremolopos(A6),D0 LEA mt_VibratoTable(PC),A4 LSR.W #2,D0 AND.W #$001F,D0 MOVEQ #0,D2 MOVE.B n_wavecontrol(A6),D2 LSR.B #4,D2 AND.B #$03,D2 BEQ.S mt_tre_sine LSL.B #3,D0 CMP.B #1,D2 BEQ.S mt_tre_rampdown MOVE.B #255,D2 BRA.S mt_tre_set mt_tre_rampdown: TST.B n_vibratopos(A6) BPL.S mt_tre_rampdown2 MOVE.B #255,D2 SUB.B D0,D2 BRA.S mt_tre_set mt_tre_rampdown2: MOVE.B D0,D2 BRA.S mt_tre_set mt_tre_sine: MOVE.B 0(A4,D0.W),D2 mt_tre_set: MOVE.B n_tremolocmd(A6),D0 AND.W #15,D0 MULU D0,D2 LSR.W #6,D2 MOVEQ #0,D0 MOVE.B n_volume(A6),D0 TST.B n_tremolopos(A6) BMI.S mt_TremoloNeg ADD.W D2,D0 BRA.S mt_Tremolo3 mt_TremoloNeg: SUB.W D2,D0 mt_Tremolo3: BPL.S mt_TremoloSkip CLR.W D0 mt_TremoloSkip: CMP.W #$40,D0 BLS.S mt_TremoloOk MOVE.W #$40,D0 mt_TremoloOk: MOVE.W D0,8(A5) MOVE.B n_tremolocmd(A6),D0 LSR.W #2,D0 AND.W #$003C,D0 ADD.B D0,n_tremolopos(A6) RTS mt_SampleOffset: MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 BEQ.S mt_sononew MOVE.B D0,n_sampleoffset(A6) mt_sononew: MOVE.B n_sampleoffset(A6),D0 LSL.W #7,D0 CMP.W n_length(A6),D0 BGE.S mt_sofskip SUB.W D0,n_length(A6) LSL.W #1,D0 ADD.L D0,n_start(A6) RTS mt_sofskip: MOVE.W #$0001,n_length(A6) RTS mt_VolumeSlide: MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 LSR.B #4,D0 TST.B D0 BEQ.S mt_VolSlideDown mt_VolSlideUp: ADD.B D0,n_volume(A6) CMP.B #$40,n_volume(A6) BMI.S mt_vsuskip MOVE.B #$40,n_volume(A6) mt_vsuskip: MOVE.B n_volume(A6),D0 MOVE.W D0,8(A5) RTS mt_VolSlideDown: MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 AND.B #$0F,D0 mt_VolSlideDown2: SUB.B D0,n_volume(A6) BPL.S mt_vsdskip CLR.B n_volume(A6) mt_vsdskip: MOVE.B n_volume(A6),D0 MOVE.W D0,8(A5) RTS mt_PositionJump: MOVE.B n_cmdlo(A6),D0 SUBQ.B #1,D0 MOVE.B D0,mt_SongPos mt_pj2: CLR.B mt_PBreakPos ST mt_PosJumpFlag RTS mt_VolumeChange: MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 CMP.B #$40,D0 BLS.S mt_VolumeOk MOVEQ #$40,D0 mt_VolumeOk: MOVE.B D0,n_volume(A6) MOVE.W D0,8(A5) RTS mt_PatternBreak: MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 MOVE.L D0,D2 LSR.B #4,D0 MULU #10,D0 AND.B #$0F,D2 ADD.B D2,D0 CMP.B #63,D0 BHI.S mt_pj2 MOVE.B D0,mt_PBreakPos ST mt_PosJumpFlag RTS mt_SetSpeed: MOVE.B 3(A6),D0 BEQ mt_Return2 CLR.B mt_counter MOVE.B D0,mt_speed RTS mt_CheckMoreEfx: BSR mt_UpdateFunk MOVE.B 2(A6),D0 AND.B #$0F,D0 CMP.B #$9,D0 BEQ mt_SampleOffset CMP.B #$B,D0 BEQ mt_PositionJump CMP.B #$D,D0 BEQ.S mt_PatternBreak CMP.B #$E,D0 BEQ.S mt_E_Commands CMP.B #$F,D0 BEQ.S mt_SetSpeed CMP.B #$C,D0 BEQ mt_VolumeChange BRA mt_PerNop mt_E_Commands: MOVE.B n_cmdlo(A6),D0 AND.B #$F0,D0 LSR.B #4,D0 BEQ.S mt_FilterOnOff CMP.B #1,D0 BEQ mt_FinePortaUp CMP.B #2,D0 BEQ mt_FinePortaDown CMP.B #3,D0 BEQ.S mt_SetGlissControl CMP.B #4,D0 BEQ mt_SetVibratoControl CMP.B #5,D0 BEQ mt_SetFineTune CMP.B #6,D0 BEQ mt_JumpLoop CMP.B #7,D0 BEQ mt_SetTremoloControl CMP.B #9,D0 BEQ mt_RetrigNote CMP.B #$A,D0 BEQ mt_VolumeFineUp CMP.B #$B,D0 BEQ mt_VolumeFineDown CMP.B #$C,D0 BEQ mt_NoteCut CMP.B #$D,D0 BEQ mt_NoteDelay CMP.B #$E,D0 BEQ mt_PatternDelay CMP.B #$F,D0 BEQ mt_FunkIt RTS mt_FilterOnOff: MOVE.B n_cmdlo(A6),D0 AND.B #1,D0 ASL.B #1,D0 AND.B #$FD,$BFE001 OR.B D0,$BFE001 RTS mt_SetGlissControl: MOVE.B n_cmdlo(A6),D0 AND.B #$0F,D0 AND.B #$F0,n_glissfunk(A6) OR.B D0,n_glissfunk(A6) RTS mt_SetVibratoControl: MOVE.B n_cmdlo(A6),D0 AND.B #$0F,D0 AND.B #$F0,n_wavecontrol(A6) OR.B D0,n_wavecontrol(A6) RTS mt_SetFineTune: MOVE.B n_cmdlo(A6),D0 AND.B #$0F,D0 MOVE.B D0,n_finetune(A6) RTS mt_JumpLoop: TST.B mt_counter BNE mt_Return2 MOVE.B n_cmdlo(A6),D0 AND.B #$0F,D0 BEQ.S mt_SetLoop TST.B n_loopcount(A6) BEQ.S mt_jumpcnt SUBQ.B #1,n_loopcount(A6) BEQ mt_Return2 mt_jmploop: MOVE.B n_pattpos(A6),mt_PBreakPos ST mt_PBreakFlag RTS mt_jumpcnt: MOVE.B D0,n_loopcount(A6) BRA.S mt_jmploop mt_SetLoop: MOVE.W mt_PatternPos(PC),D0 LSR.W #4,D0 MOVE.B D0,n_pattpos(A6) RTS mt_SetTremoloControl: MOVE.B n_cmdlo(A6),D0 AND.B #$0F,D0 LSL.B #4,D0 AND.B #$0F,n_wavecontrol(A6) OR.B D0,n_wavecontrol(A6) RTS mt_RetrigNote: MOVE.L D1,-(SP) MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 AND.B #$0F,D0 BEQ.S mt_rtnend MOVEQ #0,D1 MOVE.B mt_counter(PC),D1 BNE.S mt_rtnskp MOVE.W (A6),D1 AND.W #$0FFF,D1 BNE.S mt_rtnend MOVEQ #0,D1 MOVE.B mt_counter(PC),D1 mt_rtnskp: DIVU D0,D1 SWAP D1 TST.W D1 BNE.S mt_rtnend mt_DoRetrig: MOVE.W n_dmabit(A6),$DFF096 ; Channel DMA off MOVE.L n_start(A6),(A5) ; Set sampledata pointer MOVE.W n_length(A6),4(A5) ; Set length MOVE.W #300,D0 mt_rtnloop1: DBRA D0,mt_rtnloop1 MOVE.W n_dmabit(A6),D0 BSET #15,D0 MOVE.W D0,$DFF096 MOVE.W #300,D0 mt_rtnloop2: DBRA D0,mt_rtnloop2 MOVE.L n_loopstart(A6),(A5) MOVE.L n_replen(A6),4(A5) mt_rtnend: MOVE.L (SP)+,D1 RTS mt_VolumeFineUp: TST.B mt_counter BNE mt_Return2 MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 AND.B #$F,D0 BRA mt_VolSlideUp mt_VolumeFineDown: TST.B mt_counter BNE mt_Return2 MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 AND.B #$0F,D0 BRA mt_VolSlideDown2 mt_NoteCut: MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 AND.B #$0F,D0 CMP.B mt_counter(PC),D0 BNE mt_Return2 CLR.B n_volume(A6) MOVE.W #0,8(A5) RTS mt_NoteDelay: MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 AND.B #$0F,D0 CMP.B mt_Counter,D0 BNE mt_Return2 MOVE.W (A6),D0 BEQ mt_Return2 MOVE.L D1,-(SP) BRA mt_DoRetrig mt_PatternDelay: TST.B mt_counter BNE mt_Return2 MOVEQ #0,D0 MOVE.B n_cmdlo(A6),D0 AND.B #$0F,D0 TST.B mt_PattDelTime2 BNE mt_Return2 ADDQ.B #1,D0 MOVE.B D0,mt_PattDelTime RTS mt_FunkIt: TST.B mt_counter BNE mt_Return2 MOVE.B n_cmdlo(A6),D0 AND.B #$0F,D0 LSL.B #4,D0 AND.B #$0F,n_glissfunk(A6) OR.B D0,n_glissfunk(A6) TST.B D0 BEQ mt_Return2 mt_UpdateFunk: MOVEM.L A0/D1,-(SP) MOVEQ #0,D0 MOVE.B n_glissfunk(A6),D0 LSR.B #4,D0 BEQ.S mt_funkend LEA mt_FunkTable(PC),A0 MOVE.B (A0,D0.W),D0 ADD.B D0,n_funkoffset(A6) BTST #7,n_funkoffset(A6) BEQ.S mt_funkend CLR.B n_funkoffset(A6) MOVE.L n_loopstart(A6),D0 MOVEQ #0,D1 MOVE.W n_replen(A6),D1 ADD.L D1,D0 ADD.L D1,D0 MOVE.L n_wavestart(A6),A0 ADDQ.L #1,A0 CMP.L D0,A0 BLO.S mt_funkok MOVE.L n_loopstart(A6),A0 mt_funkok: MOVE.L A0,n_wavestart(A6) MOVEQ #-1,D0 SUB.B (A0),D0 MOVE.B D0,(A0) mt_funkend: MOVEM.L (SP)+,A0/D1 RTS mt_FunkTable: dc.b 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128 mt_VibratoTable: dc.b 0, 24, 49, 74, 97,120,141,161 dc.b 180,197,212,224,235,244,250,253 dc.b 255,253,250,244,235,224,212,197 dc.b 180,161,141,120, 97, 74, 49, 24 mt_PeriodTable: ; Tuning 0, Normal dc.w 856,808,762,720,678,640,604,570,538,508,480,453 dc.w 428,404,381,360,339,320,302,285,269,254,240,226 dc.w 214,202,190,180,170,160,151,143,135,127,120,113 ; Tuning 1 dc.w 850,802,757,715,674,637,601,567,535,505,477,450 dc.w 425,401,379,357,337,318,300,284,268,253,239,225 dc.w 213,201,189,179,169,159,150,142,134,126,119,113 ; Tuning 2 dc.w 844,796,752,709,670,632,597,563,532,502,474,447 dc.w 422,398,376,355,335,316,298,282,266,251,237,224 dc.w 211,199,188,177,167,158,149,141,133,125,118,112 ; Tuning 3 dc.w 838,791,746,704,665,628,592,559,528,498,470,444 dc.w 419,395,373,352,332,314,296,280,264,249,235,222 dc.w 209,198,187,176,166,157,148,140,132,125,118,111 ; Tuning 4 dc.w 832,785,741,699,660,623,588,555,524,495,467,441 dc.w 416,392,370,350,330,312,294,278,262,247,233,220 dc.w 208,196,185,175,165,156,147,139,131,124,117,110 ; Tuning 5 dc.w 826,779,736,694,655,619,584,551,520,491,463,437 dc.w 413,390,368,347,328,309,292,276,260,245,232,219 dc.w 206,195,184,174,164,155,146,138,130,123,116,109 ; Tuning 6 dc.w 820,774,730,689,651,614,580,547,516,487,460,434 dc.w 410,387,365,345,325,307,290,274,258,244,230,217 dc.w 205,193,183,172,163,154,145,137,129,122,115,109 ; Tuning 7 dc.w 814,768,725,684,646,610,575,543,513,484,457,431 dc.w 407,384,363,342,323,305,288,272,256,242,228,216 dc.w 204,192,181,171,161,152,144,136,128,121,114,108 ; Tuning -8 dc.w 907,856,808,762,720,678,640,604,570,538,508,480 dc.w 453,428,404,381,360,339,320,302,285,269,254,240 dc.w 226,214,202,190,180,170,160,151,143,135,127,120 ; Tuning -7 dc.w 900,850,802,757,715,675,636,601,567,535,505,477 dc.w 450,425,401,379,357,337,318,300,284,268,253,238 dc.w 225,212,200,189,179,169,159,150,142,134,126,119 ; Tuning -6 dc.w 894,844,796,752,709,670,632,597,563,532,502,474 dc.w 447,422,398,376,355,335,316,298,282,266,251,237 dc.w 223,211,199,188,177,167,158,149,141,133,125,118 ; Tuning -5 dc.w 887,838,791,746,704,665,628,592,559,528,498,470 dc.w 444,419,395,373,352,332,314,296,280,264,249,235 dc.w 222,209,198,187,176,166,157,148,140,132,125,118 ; Tuning -4 dc.w 881,832,785,741,699,660,623,588,555,524,494,467 dc.w 441,416,392,370,350,330,312,294,278,262,247,233 dc.w 220,208,196,185,175,165,156,147,139,131,123,117 ; Tuning -3 dc.w 875,826,779,736,694,655,619,584,551,520,491,463 dc.w 437,413,390,368,347,328,309,292,276,260,245,232 dc.w 219,206,195,184,174,164,155,146,138,130,123,116 ; Tuning -2 dc.w 868,820,774,730,689,651,614,580,547,516,487,460 dc.w 434,410,387,365,345,325,307,290,274,258,244,230 dc.w 217,205,193,183,172,163,154,145,137,129,122,115 ; Tuning -1 dc.w 862,814,768,725,684,646,610,575,543,513,484,457 dc.w 431,407,384,363,342,323,305,288,272,256,242,228 dc.w 216,203,192,181,171,161,152,144,136,128,121,114 mt_chan1temp: dc.l 0,0,0,0,0,$00010000,0, 0,0,0,0 mt_chan2temp: dc.l 0,0,0,0,0,$00020000,0, 0,0,0,0 mt_chan3temp: dc.l 0,0,0,0,0,$00040000,0, 0,0,0,0 mt_chan4temp: dc.l 0,0,0,0,0,$00080000,0, 0,0,0,0 mt_SampleStarts: dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 mt_SongDataPtr: dc.l 0 mt_speed: dc.b 6 mt_counter: dc.b 0 mt_SongPos: dc.b 0 mt_PBreakPos: dc.b 0 mt_PosJumpFlag: dc.b 0 mt_PBreakFlag: dc.b 0 mt_LowMask: dc.b 0 mt_PattDelTime: dc.b 0 mt_PattDelTime2: dc.b 0,0 mt_PatternPos: dc.w 0 mt_DMACONtemp: dc.w 0 End
src/boot/bootloader.asm
DrDeano/DeanOS
6
89719
<filename>src/boot/bootloader.asm<gh_stars>1-10 ; --------------------------------------------------------------------- ; Here is some information for you so can understand the whole thing :) ; Using a 1440KB 3.5" Floppy for the bootloader ; --------------------------------------------------------------------- %define boot0_location (0x7C00) ; The location that BOOT0 is load to by the BIOS %define boot_signature (0xAA55) ; The boot signature that is needed at the end of the 512 bytes so that it is recognized as a boot device. %define fat_segment (0x0050) ; The memory location to load the FAT into memory ;%define stage_2_load_segment (0x0200) ; The location of the second stage bootloader %define stage_2_load_segment (0x07E0) [bits 16] ; Tell the assembler that this is a 16bit program not 32bit [org boot0_location] ; As the bootloader is loaded at 0x7C00, all addressing will be relative to this location ; Will need to jump over the FAT16 header. 3 Bytes are allowed before the header ; so can only use a relative/short jump. jmp short bootloader_start ; Need to pad to a total of 3 bytes so far. ; This is so to comply with the FAT16 header. ; We could use a NOP instruction as the previous instruction (JMP) is 2 bytes and NOP is 1 byte ; See https://www.win.tue.nl/~aeb/linux/fs/fat/fat-1.html ; Bytes 0-2 times (3 - ($ - $$)) db 0 %include 'fat_descripter.asm' ; Bytes 62-509 %include 'macros.asm' bootloader_start: ; The BIOS can load use (the bootloader) at address 0x000:7C00 or 0x7C00:0000 ; This is in fact the same address ; So we need to normalise this by using a long jump jmp long 0x0000:start_boot0_16bit start_boot0_16bit: ; ------------------------------------------------------------------------ ; Set up the memory segment for accessing memory the old way. ; ------------------------------------------------------------------------ cli ; Disable interrupts so not mess up the declarations of the segments mov byte [Logical_drive_number], dl ; Save what drive we booted from (should be 0x00) into our boot parameter block above mov ax, cs ; Set all the sectors to start to begin with. Can get this from the code segment. Should be 0x00 mov ds, ax ; Set the data segment at the beginning of the bootloader location mov es, ax ; Set the extra1 segment at the beginning of the bootloader location mov ss, ax ; Set the stack segment at the beginning of the bootloader location mov sp, boot0_location ; Set the stack pointer to the bootloader and grows down to 0x0. sti ; Enable interrupts ; ------------------------------------------------------------------------ ; Finished setting up the memory segment for accessing memory the old way. ; ------------------------------------------------------------------------ ; Reset the floppy disk m_reset_disk ; Print the loading message m_write_line loading_msg ; Find the 2ndstage bootloader in the root directory m_find_file stage_2_filename, stage_2_load_segment ; Load the FAT table into memory m_read_fat fat_segment ; Read the 2ndstage bootloader into memory m_read_file stage_2_load_segment, fat_segment ; ------------------------------------------------------------------------ ; Start the second stage bootloader ; ------------------------------------------------------------------------ ; Jump to second stage start of code: jmp long stage_2_load_segment:0000h ; If there is a floppy disk error or a boot error, the call this function boot_error: m_write_line disk_error_msg ; Print the disk error message m_reboot ; Reboot ; Include the functions that can be called %include 'functions.asm' ; Messages disk_error_msg db "Disk error", 0 loading_msg db "Loading: 1st stage bootloader", 0 reboot_msg db "Press any key to reboot", 0 ; Stage 2 bootloader file name to find stage_2_filename db "2NDSTAGEBIN", 0 ; Data storage root_sectors db 0,0 root_start db 0,0 file_start db 0,0 ; Pad the rest of the file with zeros ; Bytes 510-511 times 510 - ($ - $$) db 0 ; Add the boot signature at the end dw boot_signature
stone/testcases/dec.asm
yutopp/sekki
6
98356
bits 64 dec rcx dec qword [rbp-32] dec byte [rdi+26]
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2_notsx.log_254_1086.asm
ljhsiun2/medusa
9
23427
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %r8 push %rax push %rdi // Store lea addresses_WC+0x13eb0, %r8 xor %rax, %rax movl $0x51525354, (%r8) nop nop nop add %r8, %r8 // Faulty Load lea addresses_WT+0x5190, %r14 nop nop nop cmp %rdi, %rdi vmovntdqa (%r14), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %r11 lea oracles, %rax and $0xff, %r11 shlq $12, %r11 mov (%rax,%r11,1), %r11 pop %rdi pop %rax pop %r8 pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'00': 254} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
life.adb
jdgoal512/Life
0
14638
with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure Life is -- D: Die, S: Stay the same, G: Grow a new cell type Rules_Type is (D, S, G); type Rule_Set is array (Natural range 0 .. 8) of Rules_Type; type Grid_Type is array (Natural range <>, Natural range <>) of Boolean; type Points_Type is array(Natural range <>, Natural range <>) of Natural; type Life (Width : Natural := 10; Height : Natural := 10) is record Generation : Natural := 0; Rules : Rule_Set := (D, D, S, G, D, D, D, D, D); Grid : Grid_Type (1 .. Width, 1 .. Height) := (others => (others => false)); Next_Grid : Grid_Type (1 .. Width, 1 .. Height) := (others => (others => false)); end record; function Get(Self : Life; X : Natural; Y : Natural) return Boolean is begin if X > 0 and X <= Self.Width and Y > 0 and Y <= Self.Height then return Self.Grid (X, Y); end if; return false; end get; function Get_Neighbors(Self : Life; X : Natural; Y : Natural) return Natural is Neighbors: Natural; begin Neighbors := 0; for X_Offset in Integer range -1 .. 1 loop for Y_Offset in Integer range -1 .. 1 loop -- Don't count the offset 0, 0 if X_Offset /= 0 or Y_Offset /= 0 then if get(Self, X+X_Offset, Y+Y_Offset) then Neighbors := Neighbors + 1; end if; end if; end loop; end loop; return Neighbors; end Get_Neighbors; procedure Print_Grid(Self : Life) is begin Put ("Generation "); Put (Self.Generation); Put_Line(""); Put ("+"); for X in Self.Grid'Range (1) loop Put ("-"); end loop; Put_Line ("+"); for Y in Self.Grid'Range (2) loop Put ("|"); for X in Self.Grid'Range (1) loop if Get(Self, X, Y) then Put("0"); else Put(" "); end if; end loop; Put_Line ("|"); end loop; Put ("+"); for X in Self.Grid'Range (1) loop Put ("-"); end loop; Put_Line ("+"); end Print_Grid; procedure Next_Generation(Self : out Life) is Neighbors : Natural; Next_State : Rules_Type; begin for X in Integer range 1 .. Self.Width loop for Y in Integer range 1 .. Self.Height loop Neighbors := Get_Neighbors(Self, x, y); Next_State := Self.Rules (Neighbors); if Next_State = G then Self.Next_Grid (X, Y) := TRUE; elsif Next_State = D then Self.Next_Grid (X, Y) := FALSE; end if; end loop; end loop; Self.Generation := Self.Generation + 1; for X in Integer range 1 .. Self.Width loop for Y in Integer range 1 .. Self.Height loop Self.Grid (X, Y) := Self.Next_Grid(X, Y); end loop; end loop; end Next_Generation; procedure Add_Figure(Self : out Life; X : in Natural; Y : in Natural; Points : in Points_Type) is begin for I in points'Range loop Self.Grid(X+Points(I, 0), Y+Points(I, 1)) := TRUE; Self.Next_Grid(X+Points(I, 0), Y+Points(I, 1)) := TRUE; end loop; end Add_Figure; Rpentomino : Points_Type := ((1, 0), (2, 0), (0, 1), (1, 1), (1, 2)); Block : Points_Type := ((0, 0), (1, 0), (0, 1), (1, 1)); Blinker : Points_Type := ((1, 0), (1, 1), (1, 2)); Beacon : Points_Type := ((0, 0), (0, 1), (1, 0), (2, 3), (3, 2), (3, 3)); Rules : Rule_Set := (D, D, S, G, D, D, D, D, D); Game : Life(Width => 20, Height => 10); begin Add_Figure(Game, 15, 3, BEACON); Add_Figure(Game, 5, 5, Rpentomino); loop Print_Grid(Game); Next_Generation(Game); delay(1.0); end loop; end Life;
tools-src/gnu/gcc/gcc/ada/s-traceb.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
6901
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . T R A C E B A C K -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1999-2001 Ada Core Technologies, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- This is the default version of this package package body System.Traceback is ------------------ -- C_Call_Chain -- ------------------ function C_Call_Chain (Traceback : System.Address; Max_Len : Natural) return Natural is Val : Natural; begin Call_Chain (Traceback, Max_Len, Val); return Val; end C_Call_Chain; ---------------- -- Call_Chain -- ---------------- function Backtrace (Traceback : System.Address; Len : Integer; Exclude_Min : System.Address; Exclude_Max : System.Address) return Integer; pragma Import (C, Backtrace, "__gnat_backtrace"); procedure Call_Chain (Traceback : System.Address; Max_Len : Natural; Len : out Natural; Exclude_Min, Exclude_Max : System.Address := System.Null_Address) is begin Len := Backtrace (Traceback, Max_Len, Exclude_Min, Exclude_Max); end Call_Chain; end System.Traceback;
plugin/src/main/antlr/Template.g4
cbyrneee/JetBrains-Discord-Integration
426
7078
grammar Template; template: text_eval; DOLLAR_SIGN : '$' ; PERCENT_SIGN : '%' ; PR_OPEN : '(' ; PR_CLOSED : ')' ; BR_OPEN : '{' ; BR_CLOSED : '}' ; RAW_TEXT : '#"' .*? '"#' ; IF_sym : 'if' ; fragment NAME_CHAR : [a-zA-Z] ; NAME : NAME_CHAR+ ; fragment CHAR : ~[$(){}a-zA-Z%#"] ; TEXT : CHAR+ ; raw_text_rule: RAW_TEXT; text_eval: (NAME | TEXT | raw_text_rule | fun | var | if_rule | PR_OPEN | PR_CLOSED | IF_sym | PERCENT_SIGN)*; var: DOLLAR_SIGN NAME | DOLLAR_SIGN BR_OPEN NAME BR_CLOSED; fun: DOLLAR_SIGN NAME (BR_OPEN text_eval BR_CLOSED)+; if_rule: PERCENT_SIGN IF_sym PR_OPEN text_eval PR_CLOSED BR_OPEN text_eval BR_CLOSED (BR_OPEN text_eval BR_CLOSED)?;
libsrc/msx/msx_noblank.asm
meesokim/z88dk
0
241565
; ; MSX specific routines ; by <NAME>, 30/11/2007 ; ; void msx_noblank(); ; ; Enable screen ; ; $Id: msx_noblank.asm,v 1.4 2015/01/19 01:32:57 pauloscustodio Exp $ ; PUBLIC msx_noblank EXTERN msxbios INCLUDE "msxbios.def" msx_noblank: ld ix,ENASCR jp msxbios
music/Save Play Count to BPM.applescript
casey/local
18
1506
<filename>music/Save Play Count to BPM.applescript<gh_stars>10-100 property my_title : "Save Play Count to BPM" tell application "Music" set sel to selection repeat with t in sel set plays to t's «class pPlC» set t's bpm to plays end repeat end tell
src/asm/gameplay.asm
DJRideout/MegaManX4Practice
1
8132
.psx ; Overwrite the logic for ending a stage to always either go to part 2 or go to mission complete @stage_end: replace 0x800200FC lb v0,CURRENT_STAGE lb v1,STAGE_PART subi v0,v0,9 ; Will now be 0 if this is X's Colonel fight beq v0,$zero,@@set_mission_complete subi v0,v0,1 ; Will now be 0 if this is Space Port beq v0,$zero,@@set_mission_complete subi v1,1 ; Will now be 0 if already on part 2 of the stage beq v1,$zero,@@set_mission_complete li v1,1 sb v1,STAGE_PART j @stage_end nop @@set_mission_complete: j 0x80020348 li v0,9 endreplace @stage_end ; I can't remember how much space left I have above to overwrite more existing code, ; so I'll just jump to my own space on going to part 2 of a stage for now. push t1 push ra jal store_upgrades sb $zero,CHECKPOINT_STORAGE sb $zero,WEAPON_STORAGE pop ra pop t1 j 0x80020348 li v0,4 ; Game state 4 loads a stage. Existing code sets v0 to the game state after 0x80020348 ; Always keep refight capsules enabled. @capsules_enabled: replace 0x800C78DC li v0,2 ; Exit. Faking out the refight capsules as being in disabled state. endreplace @capsules_enabled replace 0x8008026C sb $zero,0x21EC(at) ; Dragoon endreplace @capsules_enabled replace 0x800758C8 sb $zero,0x21EC(at) ; Owl endreplace @capsules_enabled replace 0x80072894 sb $zero,0x21EC(at) ; Walrus endreplace @capsules_enabled replace 0x8006C244 sb $zero,0x21EC(at) ; Beast endreplace @capsules_enabled replace 0x80079078 sb $zero,0x21EC(at) ; Mushroom endreplace @capsules_enabled replace 0x800720E8 sb $zero,0x21EC(at) ; Stingray endreplace @capsules_enabled replace 0x8007DBA8 sb $zero,0x21EC(at) ; Peacock endreplace @capsules_enabled replace 0x80065504 sb $zero,0x21EC(at) ; Spider endreplace @capsules_enabled ; Move player's return position after a refight to not re-teleport back into the fight. ; All are offset by 10 pixels in the appropriate direction. @capsule_respawn_positions: replace 0x800F3DA0 db 0x52 ; Exit endreplace @capsule_respawn_positions replace 0x800F3F08 db 0x26 ; Dragoon endreplace @capsule_respawn_positions replace 0x800F3F98 db 0xE6 ; Owl endreplace @capsule_respawn_positions replace 0x800F4004 db 0xA6 ; Walrus endreplace @capsule_respawn_positions replace 0x800F3FE0 db 0x86 ; Beast endreplace @capsule_respawn_positions replace 0x800F3F50 db 0x0A ; Mushroom endreplace @capsule_respawn_positions replace 0x800F3F74 db 0xEA ; Stingray endreplace @capsule_respawn_positions replace 0x800F3F2C db 0xAA ; Peacock endreplace @capsule_respawn_positions replace 0x800F3FBC db 0x6A ; Spider endreplace @capsule_respawn_positions ; Infinite lives @infinite_lives: replace 0x800202C0 nop endreplace @infinite_lives ; Show current checkpoint under health bar instead of lives. @show_checkpoint: replace 0x80024EA8 lbu a1,CHECKPOINT_STORAGE endreplace @show_checkpoint ; Select+INPUT hacks @select_hacks: replace 0x8001247C ; this only runs when the screen isn't fading out jal @select_hacks nop ; there's an lhu here, nopping out second part of 2-instruction endreplace @select_hacks push t1 push t2 push t3 push t4 ; If not in a gameplay state, don't do anything. (0x0006 halfword) lhu t1,GAME_STATE_1 nop subi t1,t1,0x0006 bne t1,$zero,@@done nop ; If ready to load checkpoint, just do that. lb t1,CHECKPOINT_LOAD_READY nop bne $zero,t1,@@checkpoint_loading nop lhu v0,CONTROLLER_INPUTS_1 lhu t2,CONTROLLER_INPUTS_1_PREV @@check_select_l2: li t1,0x0101 andi t3,v0,0x0101 andi t4,t2,0x0101 bgeu t4,t3,@@check_select_r2 nop beq t3,t1,@@select_l2 nop @@check_select_r2: li t1,0x0102 andi t3,v0,0x0102 andi t4,t2,0x0102 bgeu t4,t3,@@check_select_left nop beq t3,t1,@@select_r2 nop @@check_select_left: li t1,0x8100 andi t3,v0,0x8100 andi t4,t2,0x8100 bgeu t4,t3,@@check_select_right nop beq t3,t1,@@select_left nop @@check_select_right: li t1,0x2100 andi t3,v0,0x2100 andi t4,t2,0x2100 bgeu t4,t3,@@check_select_up nop beq t3,t1,@@select_right nop @@check_select_up: li t1,0x1100 andi t3,v0,0x1100 andi t4,t2,0x1100 bgeu t4,t3,@@done nop beq t3,t1,@@select_up nop j @@done nop @@select_l2: li t1,1 sb t1,CHECKPOINT_LOAD_READY push ra jal load_upgrades nop jal refill_all nop lb t2,CHECKPOINT_STORAGE pop ra sb t2,CURRENT_CHECKPOINT j @@done nop @@select_r2: push ra jal store_upgrades nop pop ra push a0 push a1 push a2 push ra li a0,0 li a1,MENU_SELECT_SOUND_ID jal PLAY_SOUND_SUB li a2,0 pop ra pop a2 pop a1 pop a0 j @@done nop @@select_left: lb t1,CURRENT_STAGE lui t0,hi(org(stage_id_to_num_checkpoints)) sll t1,t1,1 addu t0,t0,t1 lb t1,STAGE_PART nop addu t0,t0,t1 lb t1,CHECKPOINT_STORAGE lb t0,lo(org(stage_id_to_num_checkpoints))(t0) subi t1,t1,1 bge t1,$zero,@@finish_select_left ; Loop to highest possible checkpoint subi t0,t0,1 addu t1,$zero,t0 @@finish_select_left: sb t1,CHECKPOINT_STORAGE j @@done nop @@select_right: lb t1,CURRENT_STAGE lui t0,hi(org(stage_id_to_num_checkpoints)) sll t1,t1,1 addu t0,t0,t1 lb t1,STAGE_PART nop addu t0,t0,t1 lb t1,CHECKPOINT_STORAGE lb t0,lo(org(stage_id_to_num_checkpoints))(t0) addiu t1,t1,1 blt t1,t0,@@finish_select_right nop li t1,0 @@finish_select_right: sb t1,CHECKPOINT_STORAGE j @@done nop @@select_up: push ra jal refill_all nop pop ra j @@done nop @@checkpoint_loading: li t1,1 sb t1,CHECKPOINT_LOADING li t1,0x0003 sh t1,TELEPORT_VALUE_1 li t1,0x00C0 ;can't sh here, unaligned? sb t1,TELEPORT_VALUE_2 srl t1,8 sb t1,(TELEPORT_VALUE_2 + 1) sb $zero,CHECKPOINT_LOAD_READY ;j @@done ;nop @@done: lhu v0,INPUT_1_PREV ; Overwritten code. pop t4 pop t3 pop t2 pop t1 jr ra nop @prevent_stun: replace 0x800343C0 ; Sets stunned state (0x801418CD) to 2, or not stunned j org(@prevent_stun) nop endreplace @prevent_stun push t1 lb t1,CHECKPOINT_LOADING nop beq t1,$zero,@@not_preventing sb $zero,CHECKPOINT_LOADING ; When the top bit of HP is set (negative), player becomes stunned. ; So unset that bit here. lb t1,CURRENT_HP nop andi t1,t1,0x7F sb t1,CURRENT_HP @@not_preventing: pop t1 ; Overwritten code lb v1,2(s0) j (0x800343C0 + 8) sb v0,5(s0) ; Remove WARNING sirens before bosses. ; This overwrites the subroutine address for starting the siren. ; Also wait until camera stops before spawning bosses. @warning_remove: replace 0x8010BE84 dw org(@warning_remove) endreplace @warning_remove push t0 push t1 lw t0,CAM_X_CURR nop lw t1,CAM_X_PREV nop bne t0,t1,@@wait_for_camera nop lw t0,CAM_Y_CURR nop lw t1,CAM_Y_PREV nop bne t0,t1,@@wait_for_camera nop pop t1 pop t0 j 0x800BAF04 ; Subroutine addr next in table nop @@wait_for_camera: pop t1 pop t0 jr ra nop ; Refill HP of Sigma forms on death and keep fight state at 0 (both alive) @sigma_reset_state: replace 0x8008F644 ; Keep the fight state at 0 when one of the forms dies, and refill the HP. jal @sigma_reset_state nop endreplace @sigma_reset_state ; v0 here is 2 if ground is dying, 1 if gunner is dying sb $zero,SIGMA_FIGHT_STATE push t0 push t1 li t0,0x30 la t1,ONE_BEFORE_SIGMA_HPS add t1,t1,v0 sb t0,0(t1) pop t1 pop t0 jr ra nop @flag_spawn_which_sigma: replace 0x8008DBE8 jal @flag_spawn_which_sigma nop endreplace @flag_spawn_which_sigma ; v0 will be 4 here if spawning gunner push v1 li v1,4 beq v0,v1,@@flag_spawn_ground_next nop li v1,1 sb v1,SPAWN_NEXT_SIGMA j @@end nop @@flag_spawn_ground_next: sb $zero,SPAWN_NEXT_SIGMA @@end: pop v1 ; Overwritten code sb v0,5(s0) lbu v0,0x96(s0) nop jr ra nop @check_spawn_gunner: replace 0x8008DBC4 ; this runs when deciding whether to spawn gunner or not jal @check_spawn_gunner nop nop nop endreplace @check_spawn_gunner lb v1,SPAWN_NEXT_SIGMA li v0,1 beq v1,v0,@@spawn_gunner_trampoline nop jr ra nop @@spawn_gunner_trampoline: j 0x8008DBE4 li v0,2 @check_spawn_ground: replace 0x8008DB6C ; this runs when deciding whether to spawn ground or not jal @check_spawn_ground nop nop nop endreplace @check_spawn_ground lb v1,SPAWN_NEXT_SIGMA nop beq v1,$zero,@@spawn_ground_trampoline nop jr ra nop @@spawn_ground_trampoline: j 0x8008DBE8 li v0,6 ; Enable Escape option in start menu in all stages. @escape_option: replace 0x80017514 nop ; Don't skip over updating start menu stuff based on current stage endreplace @escape_option replace 0x80017568 nop ; Always draw escape button regardless of if current stage is flagged defeated endreplace @escape_option replace 0x8002FF48 nop ; Nop out branch depending on current stage, which would disable escape option endreplace @escape_option replace 0x8002FF64 nop ; Nop out branch on mav not defeated for this stage, so every mav stage and endgame stages have escape option endreplace @escape_option ; Fix checkpoint 0x03 in Mushroom so player ends up with the correct Y position. ; This adds the correct Y position into a lookup table based on stage and checkpoint IDs, ; where for some reason Mushroom checkpoint 3 had a Y position of 0. @mushroom_checkpoint_fix: replace 0x800F8B5E dh 0x02CB endreplace @mushroom_checkpoint_fix ; 0x8003593C sets y position to 0x09CB if the current stage part is not equal to 0. ; This position is not correct for part 2 checkpoint 0, so X dies immediately. ; Add some code to check for Peacock stage, part 2, checkpoint 0. @peacock_checkpoint_fix: replace 0x8003593C j org(@peacock_checkpoint_fix) li v0,0x09CB endreplace @peacock_checkpoint_fix push t0 push t1 lb t0,STAGE_PART nop beq t0,$zero,@@skip nop lb t0,CURRENT_STAGE li t1,STAGE_ID_PEACOCK bne t0,t1,@@end lb t0,STAGE_PART li t1,1 bne t0,t1,@@end nop lb t0,CURRENT_CHECKPOINT nop bne t0,$zero,@@end nop li v0,0x03CB ; The correct Y position for this checkpoint @@end: pop t1 pop t0 j 0x800359A0 ; Where the game was conditionally branching in the replaced code nop @@skip: ; Since the original code was a BNE this accounts for the false case pop t1 pop t0 j (0x8003593C + 8) nop
src/state_handlers/loading_scene.asm
Xeyler/gb-hello-world
0
104209
SECTION "loading scene state handler", ROM0 state_loading_scene: ; Disable the screen so we can access vram outside of vblank ld a, [h_lcdc] res 7, a ld [h_lcdc], a ld a, VBLANK_FLAG_UPDATE_VARS ld [h_vblank_flag], a call wait_for_vblank ; Copy tileset ld hl, h_event_index dereference_hl_into_hl ld a, [hli] set_rom_bank_from_a ld [h_scene_bank], a ld a, [hli] ld e, a ld a, [hli] ld d, a ld a, h ld [h_event_index + 1], a ld a, l ld [h_event_index], a ld h, d ld l, e ld c, [hl] inc hl ld b, [hl] inc hl ld d, h ld e, l ld hl, $8000 call memcpy ; Copy map via metatileset ld hl, 4 * 64 add hl, de push de ld d, h ld a, h ld [h_scene_map + 1], a ld e, l ld a, l ld [h_scene_map], a pop hl ld bc, $9800 ; de contains location of tilemap ; hl contains location of metatileset ; bc contains vram tilemap beginning .repeat_metatile_copy: ld a, [de] inc de push de push hl push bc call copy_metatile pop bc pop hl pop de inc bc inc bc bit 5, c jr z, .dont_skip_row ld a, c add a, 32 ld c, a jr nc, .dont_carry inc b .dont_carry: .dont_skip_row: ld a, b cp a, $9C jr c, .repeat_metatile_copy ; Set player location ld hl, h_event_index dereference_hl_into_hl ld a, [hli] ld [h_player_y], a ld a, [hli] ld [h_player_x], a ld a, h ld [h_event_index + 1], a ld a, l ld [h_event_index], a ; Re-enable screen ld a, [h_lcdc] set 7, a ld [h_lcdc], a ld [rLCDC], a jp main ; @param a Metatile index ; @param hl Metatileset pointer ; @param bc Destination pointer copy_metatile: ld e, a ld d, 0 add hl, de add hl, de add hl, de add hl, de ld a, [hli] ld [bc], a inc bc ld a, [hli] ld [bc], a ld a, c add a, 31 ld c, a jr nc, .skip_carry inc b .skip_carry: ld a, [hli] ld [bc], a inc bc ld a, [hli] ld [bc], a ret SECTION "scene hram variables", HRAM h_scene_bank: db h_scene_map: dw
programs/oeis/188/A188090.asm
neoneye/loda
22
97301
; A188090: [nr+kr]-[nr]-[kr], where r=sqrt(3), k=5, [ ]=floor. ; 1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0,0,1,1,0 mov $2,$0 mov $0,5 lpb $0 sub $2,1 add $0,$2 seq $0,188082 ; [nr+kr]-[nr]-[kr], where r=sqrt(3), k=1, [ ]=floor. add $2,$0 lpe
t65/min_pass3.asm
PeterCamilleri/test65
0
86791
; Minimum code that passes a test .import exit:absolute .export _main .pc02 .code _main: lda #0 jmp exit
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_1466.asm
ljhsiun2/medusa
9
83290
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x11ff6, %rsi lea addresses_normal_ht+0xaff6, %rdi clflush (%rsi) nop cmp %r12, %r12 mov $105, %rcx rep movsw add $58911, %rbx lea addresses_WT_ht+0x12bf6, %rsi lea addresses_normal_ht+0x1a836, %rdi and %r12, %r12 mov $45, %rcx rep movsl nop nop nop nop inc %r12 lea addresses_D_ht+0x19096, %rsi lea addresses_D_ht+0x123f6, %rdi nop inc %r11 mov $72, %rcx rep movsb nop nop nop and $2047, %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r15 push %rax push %rbp push %rbx push %rdi // Faulty Load lea addresses_RW+0x1abf6, %rax nop nop add %rbp, %rbp vmovups (%rax), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $0, %xmm3, %rbx lea oracles, %r15 and $0xff, %rbx shlq $12, %rbx mov (%r15,%rbx,1), %rbx pop %rdi pop %rbx pop %rbp pop %rax pop %r15 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}} {'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 */
agda-stdlib/src/Data/Sum/Relation/LeftOrder.agda
DreamLinuxer/popl21-artifact
5
10603
------------------------------------------------------------------------ -- The Agda standard library -- -- This module is DEPRECATED. Please use -- Data.Sum.Relation.Binary.LeftOrder directly. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Sum.Relation.LeftOrder where open import Data.Sum.Relation.Binary.LeftOrder public {-# WARNING_ON_IMPORT "Data.Sum.Relation.LeftOrder was deprecated in v1.0. Use Data.Sum.Relation.Binary.LeftOrder instead." #-}
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xa0_notsx.log_21829_125.asm
ljhsiun2/medusa
9
166856
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %r8 push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x6a6c, %rsi lea addresses_WC_ht+0x8330, %rdi nop nop nop nop dec %r10 mov $5, %rcx rep movsq nop nop dec %rsi lea addresses_UC_ht+0xe188, %rsi lea addresses_A_ht+0xdc20, %rdi nop nop nop nop nop add %r8, %r8 mov $118, %rcx rep movsb nop nop xor $30539, %rsi lea addresses_A_ht+0x150b0, %r13 nop nop nop nop sub $9721, %rcx mov (%r13), %r10d nop nop nop nop nop add %rsi, %rsi lea addresses_WT_ht+0x2ac8, %rcx nop inc %rbx mov $0x6162636465666768, %rsi movq %rsi, %xmm0 movups %xmm0, (%rcx) nop nop nop nop nop inc %r10 lea addresses_A_ht+0x8d30, %rsi lea addresses_D_ht+0x123b0, %rdi cmp %r10, %r10 mov $93, %rcx rep movsb nop sub $53693, %r8 lea addresses_UC_ht+0x8469, %rsi lea addresses_normal_ht+0xaa70, %rdi sub $12424, %r14 mov $48, %rcx rep movsb nop nop nop nop nop inc %rcx lea addresses_UC_ht+0x6d30, %r14 nop nop xor %r8, %r8 movw $0x6162, (%r14) dec %r8 pop %rsi pop %rdi pop %rcx pop %rbx pop %r8 pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r14 push %r15 push %rcx push %rdi push %rsi // REPMOV lea addresses_RW+0xb272, %rsi lea addresses_PSE+0xc764, %rdi nop nop nop nop nop xor %r14, %r14 mov $75, %rcx rep movsb nop add %rcx, %rcx // Store lea addresses_normal+0x5530, %rsi nop nop nop inc %r10 mov $0x5152535455565758, %rdi movq %rdi, %xmm3 vmovups %ymm3, (%rsi) nop nop nop nop add %rdi, %rdi // Store lea addresses_WC+0x18810, %r10 cmp %r15, %r15 mov $0x5152535455565758, %rcx movq %rcx, %xmm3 vmovups %ymm3, (%r10) nop nop nop nop inc %r12 // Load lea addresses_PSE+0x3dd0, %rdi nop nop nop inc %r15 movb (%rdi), %r14b nop cmp %r15, %r15 // Store lea addresses_normal+0x5530, %r14 clflush (%r14) nop xor $24562, %r10 movb $0x51, (%r14) nop nop add %r14, %r14 // Store lea addresses_WC+0xe2f0, %rdi sub %r15, %r15 mov $0x5152535455565758, %r12 movq %r12, %xmm0 vmovups %ymm0, (%rdi) nop nop and %rdi, %rdi // Store lea addresses_RW+0x1b540, %r15 nop nop inc %r12 movb $0x51, (%r15) nop nop nop nop nop xor %r14, %r14 // Load lea addresses_normal+0x1bc0, %rcx nop cmp %r12, %r12 mov (%rcx), %edi nop nop nop nop xor %rdi, %rdi // Store lea addresses_US+0x1530, %r15 nop cmp $48939, %rsi movw $0x5152, (%r15) nop nop nop nop cmp %r10, %r10 // Store lea addresses_RW+0x17630, %rcx nop nop and %rsi, %rsi movb $0x51, (%rcx) add $10263, %r15 // Store lea addresses_normal+0x5530, %r10 nop sub $11647, %r15 mov $0x5152535455565758, %rcx movq %rcx, %xmm5 vmovups %ymm5, (%r10) nop nop nop nop xor %r12, %r12 // Store lea addresses_A+0x4274, %rcx add $27220, %rsi movb $0x51, (%rcx) nop nop inc %r12 // Store lea addresses_UC+0xba48, %rdi nop and %rsi, %rsi movl $0x51525354, (%rdi) nop nop nop nop nop cmp %r12, %r12 // Faulty Load lea addresses_normal+0x5530, %r14 xor $44083, %r10 mov (%r14), %r15w lea oracles, %rdi and $0xff, %r15 shlq $12, %r15 mov (%rdi,%r15,1), %r15 pop %rsi pop %rdi pop %rcx pop %r15 pop %r14 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} {'src': {'type': 'addresses_RW', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_PSE', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 1}} {'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}} {'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 11}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': True, 'size': 1, 'NT': False, 'same': False, 'congruent': 8}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 2}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 2}} [Faulty Load] {'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}} {'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 7}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 3}} {'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': True, 'same': False, 'congruent': 10}} {'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 */
antlr-definition/src/main/antlr/mylanguage/antlr/MyLanguageParser.g4
AlexLandau/antlr-preferring-later-rule
0
5544
parser grammar MyLanguageParser; @header { package mylanguage.antlr; } tokens { NEWLINE, WS, LINE_COMMENT, BLOCK_COMMENT, LPAREN, RPAREN, LESS_THAN, GREATER_THAN, ID } // String to parse: foo<bar>(baz) // This fails to parse as intended expression : ID | expression LESS_THAN ID GREATER_THAN LPAREN ID RPAREN | expression LESS_THAN expression // < operator | expression GREATER_THAN expression // > operator | LPAREN expression RPAREN ; // This fails to parse as intended expression2 : ID | ID LESS_THAN ID GREATER_THAN LPAREN ID RPAREN | expression2 LESS_THAN expression2 // < operator | expression2 GREATER_THAN expression2 // > operator | LPAREN ID RPAREN ; // This parses as intended expression3 : ID | ID LESS_THAN ID GREATER_THAN LPAREN ID RPAREN | ID LESS_THAN ID // < operator | expression3 GREATER_THAN expression3 // > operator | LPAREN ID RPAREN ; // This parses as intended expression4 : ID | ID LESS_THAN ID GREATER_THAN LPAREN ID RPAREN | ID LESS_THAN expression4 // < operator | ID GREATER_THAN expression4 // > operator | LPAREN ID RPAREN ;
test/Succeed/Issue2386BuiltinEqualityUniverseLub.agda
cruhland/agda
1,989
11108
-- Andreas, 2017-01-12, issue #2386 open import Agda.Primitive data _≡_ {a b} {A : Set (a ⊔ b)} : (x y : A) → Set where refl : (x : A) → x ≡ x {-# BUILTIN EQUALITY _≡_ #-} -- Should be accepted -- The type of primErase has to match the flavor of EQUALITY primitive primEraseEquality : ∀ {a b}{A : Set (a ⊔ b)} {x y : A} → _≡_ x y → _≡_ x y testTM : ∀ {a b} {A : Set (a ⊔ b)} {x : A} (eq : _≡_ {a} {b} x x) → primEraseEquality {x = x} {y = x} eq ≡ refl _ testTM _ = refl _ -- Testing rewrite subst : ∀{ℓ}{A : Set ℓ} {P : A → Set}{a b : A} → _≡_ {a = ℓ} {b = ℓ} a b → P a → P b subst eq p rewrite eq = p
hangout/advanced-gdb.asm
netguy204/cmsc313_examples
1
29149
%define WRITE 4 %define STDOUT 1 [SECTION .data] ;;; Here we declare initialized data. For example: messages, prompts, ;;; and numbers that we know in advance data: db "abcd" [SECTION .bss] ;;; Here we declare uninitialized data. We're reserving space (and ;;; potentially associating names with that space) that our code ;;; will use as it executes. Think of these as "global variables" buf: resb 4 [SECTION .text] ;;; This is where our program lives. global _start ; make start global so ld can find it _start: ; the program actually starts here ;; look at eax using p/x ;; look at &data using x/4c ;; look at &data again using x/x mov eax, [data] ;; grab a byte at a time and shuffle them around. we ;; accomplish the same thing as bitmanip but in a more ;; obvious way. Apparnt downside is that there are a lot of reads ;; from memory but cache will make this have virtually no impact. mov bl, [data] mov [buf+3], bl mov bl, [data+1] mov [buf+2], bl mov bl, [data+2] mov [buf+1], bl mov bl, [data+3] mov [buf], bl ;; look at eax using p/x ;; look at &data using x/4c ;; look at &data again using x/x mov eax, [buf] ;; print stuff out, just for fun mov eax, WRITE mov ebx, STDOUT mov ecx, buf mov edx, 4 int 80H ;; call sys_exit to finish things off mov eax, 1 ; sys_exit syscall mov ebx, 0 ; no error int 80H ; kernel interrupt
src/opus.adb
onox/opus-ada
2
25285
-- Copyright (c) 2014 onox <<EMAIL>> -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. with Interfaces.C.Strings; package body Opus is function Get_Version return String is function Opus_Get_Version_String return Interfaces.C.Strings.chars_ptr with Import, Convention => C, External_Name => "opus_get_version_string"; begin return Interfaces.C.Strings.Value (Opus_Get_Version_String); end Get_Version; procedure Check_Error (Error : in Interfaces.C.int) is begin case Error is when -1 => raise Bad_Argument; when -2 => raise Buffer_Too_Small; when -3 => raise Internal_Error; when -4 => raise Invalid_Packet; when -5 => raise Unimplemented; when -6 => raise Invalid_State; when -7 => raise Allocation_Fail; when others => null; end case; end Check_Error; end Opus;
oeis/021/A021893.asm
neoneye/loda-programs
11
94366
<reponame>neoneye/loda-programs<filename>oeis/021/A021893.asm ; A021893: Decimal expansion of 1/889. ; Submitted by <NAME> ; 0,0,1,1,2,4,8,5,9,3,9,2,5,7,5,9,2,8,0,0,8,9,9,8,8,7,5,1,4,0,6,0,7,4,2,4,0,7,1,9,9,1,0,0,1,1,2,4,8,5,9,3,9,2,5,7,5,9,2,8,0,0,8,9,9,8,8,7,5,1,4,0,6,0,7,4,2,4,0,7,1,9,9,1,0,0,1,1,2,4,8,5,9,3,9,2,5,7,5 seq $0,83811 ; Numbers n such that 2n+1 is the digit reversal of n+1. div $0,3556 mod $0,10
programs/oeis/266/A266300.asm
neoneye/loda
22
243658
; A266300: Triangle read by rows giving successive states of cellular automaton generated by "Rule 15" initiated with a single ON (black) cell. ; 1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 add $0,1 seq $0,48760 ; Largest square <= n. mod $0,2
samples/asm/simple_call.asm
tkmru/cibo
4
170649
BITS 32 org 0x7c00 start: mov eax, 0x00f1 mov ebx, 0x0029 call add_routine jmp 0 add_routine: mov ebx, eax mov eax, 0x1011 ret
alloy4fun_models/trainstlt/models/5/ZYeQQikmHg5wpxBif.als
Kaixi26/org.alloytools.alloy
0
4961
<reponame>Kaixi26/org.alloytools.alloy open main pred idZYeQQikmHg5wpxBif_prop6 { always ( all s : Signal { s in Green => Green' = Green - s s not in Green => Green' = Green + s } ) } pred __repair { idZYeQQikmHg5wpxBif_prop6 } check __repair { idZYeQQikmHg5wpxBif_prop6 <=> prop6o }
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_ix/___slonglong2fs.asm
jpoikela/z88dk
640
172341
SECTION code_clib SECTION code_fp_math48 PUBLIC ___slonglong2fs EXTERN cm48_sdccixp_slonglong2ds defc ___slonglong2fs = cm48_sdccixp_slonglong2ds
oeis/213/A213565.asm
neoneye/loda-programs
11
247452
<filename>oeis/213/A213565.asm<gh_stars>10-100 ; A213565: Principal diagonal of the convolution array A213564. ; Submitted by <NAME>(w1) ; 1,21,127,467,1302,3038,6258,11754,20559,33979,53625,81445,119756,171276,239156,327012,438957,579633,754243,968583,1229074,1542794,1917510,2361710,2884635,3496311,4207581,5030137,5976552,7060312,8295848,9698568,11284889,13072269,15079239,17325435,19831630,22619766,25712986,29135666,32913447,37073267,41643393,46653453,52134468,58118884,64640604,71735020,79439045,87791145,96831371,106601391,117144522,128505762,140731822,153871158,167974003,183092399,199280229,216593249,235089120,254827440 add $0,1 mov $2,$0 lpb $0 cmp $3,$2 cmp $3,0 mul $3,$0 sub $0,1 mov $4,$3 mov $3,$2 mov $5,$4 mul $5,$2 add $2,1 add $3,$5 mul $3,$5 add $1,$3 lpe mov $0,$1 div $0,2
Dave/Algebra/Naturals/Definition.agda
DavidStahl97/formal-proofs
0
12989
<reponame>DavidStahl97/formal-proofs module Dave.Algebra.Naturals.Definition where open import Dave.Equality public open import Dave.Structures.Monoid public data ℕ : Set where zero : ℕ suc : ℕ → ℕ one = suc zero two = suc one three = suc two four = suc three five = suc four six = suc five seven = suc six eight = suc seven nine = suc eight {-# BUILTIN NATURAL ℕ #-} ℕ-suc-≡ : ∀ {m n : ℕ} → m ≡ n → suc m ≡ suc n ℕ-suc-≡ refl = refl
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0.log_21829_10.asm
ljhsiun2/medusa
9
170844
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r9 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0xc9f1, %rsi lea addresses_WC_ht+0x1a831, %rdi nop nop nop nop cmp %rax, %rax mov $126, %rcx rep movsw add $44440, %rdx lea addresses_D_ht+0x15031, %r10 clflush (%r10) nop nop nop nop nop dec %r11 movb $0x61, (%r10) nop nop sub %rcx, %rcx lea addresses_D_ht+0xf031, %rsi lea addresses_UC_ht+0x12a93, %rdi xor %r9, %r9 mov $110, %rcx rep movsw and $40722, %rdx lea addresses_normal_ht+0x1bc31, %rsi lea addresses_D_ht+0x1cd49, %rdi nop nop nop nop cmp $31168, %r10 mov $47, %rcx rep movsw inc %r9 lea addresses_D_ht+0x168f1, %rsi lea addresses_D_ht+0xbc31, %rdi nop nop and $16791, %rax mov $122, %rcx rep movsq and $47894, %rax lea addresses_A_ht+0xfab1, %r11 nop nop add %rdx, %rdx and $0xffffffffffffffc0, %r11 movaps (%r11), %xmm6 vpextrq $0, %xmm6, %r10 nop nop dec %rcx lea addresses_A_ht+0xfb36, %rsi lea addresses_A_ht+0x1e431, %rdi nop nop nop and $4264, %r9 mov $24, %rcx rep movsb nop nop nop nop sub %rdx, %rdx lea addresses_WC_ht+0xa031, %rcx nop nop nop sub $2778, %r11 mov (%rcx), %r9d nop nop nop nop nop cmp $1446, %r10 lea addresses_WT_ht+0x9c1, %rax nop nop nop dec %rcx movw $0x6162, (%rax) nop add $14181, %r9 lea addresses_UC_ht+0xa831, %r11 nop nop nop nop nop and $3148, %r10 movb $0x61, (%r11) nop and $49256, %rsi lea addresses_normal_ht+0xe48d, %rsi nop nop nop nop sub $63493, %r10 vmovups (%rsi), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %r11 nop nop nop cmp $39741, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r9 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r14 push %rax push %rdx push %rsi // Faulty Load lea addresses_US+0x9831, %r13 nop cmp $11418, %r10 mov (%r13), %ax lea oracles, %rdx and $0xff, %rax shlq $12, %rax mov (%rdx,%rax,1), %rax pop %rsi pop %rdx pop %rax pop %r14 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 5, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1}} {'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}} {'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}} {'src': {'same': False, 'congruent': 6, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 6, 'type': 'addresses_D_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_A_ht', 'AVXalign': True, 'size': 16}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 11, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1}} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'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 */
source/expression/exprutils.asm
paulscottrobson/x16-basic
1
240953
<filename>source/expression/exprutils.asm ; ***************************************************************************** ; ***************************************************************************** ; ; Name : exprutils.asm ; Purpose : Expression Utilities ; Author : <NAME> (<EMAIL>) ; Date : 8th February 2020 ; ; ***************************************************************************** ; ***************************************************************************** ; ***************************************************************************** ; ; Evaluate a term at stack level X ; ; ***************************************************************************** EvaluateTermAtX: lda #$1F ; too high precedence so just term jsr EvaluateExpressionAtXPrecA rts ; ***************************************************************************** ; ; Dereference either 2 stack references, or 1 ; ; Used when stack contains a reference (normally a variable) and needs its ; value to calculate an expression. ; ; ***************************************************************************** DeReferenceBinary: inx jsr DeReferenceUnary dex DeReferenceUnary: lda xsStatus,x ; the reference flag is in bit 0 ror a ; shift into carry. bcc _DRNotReference ; if clear, it's already a reference. asl a ; get back, but with bit 0 cleared sta xsStatus,x ; lda xsAddrLow,x ; put the address to dereference into zTemp1 sta zTemp1 lda xsAddrHigh,x sta zTemp1+1 ; phy ; save position in code lda (zTemp1) ; dereference the first two bytes - this will be sta xsIntLow,x ; for float, int and string, and will go in these ldy #1 ; which are also the address, and mantissa3 & 2 lda (zTemp1),y sta xsIntHigh,x ; lda xsStatus,x ; check if it's a float (bit 7) bpl _DRNotFloat ; if not, we are complete ; iny ; if float, copy all five bytes of the floating point lda (zTemp1),y ; number into the stack. sta xsMantissa1,x iny lda (zTemp1),y sta xsMantissa0,x iny lda (zTemp1),y sta xsExponent,x ; _DRNotFloat: ply ; restore code position. _DRNotReference: rts ; ***************************************************************************** ; ; Check the top 1/2 stack values are number(s). Return CS if a float is ; required (e.g. if one of them is a floating point number), CC if ; can be done using integers. ; ; ***************************************************************************** UnaryNumberTypeCheck: lda xsStatus,x bra BNTCMain BinaryNumberTypeCheck: lda xsStatus,x ; bit 7 set if either float, bit 6 set if either string. ora xsStatus+1,x BNTCMain: asl a ; carry set if either float, bit 7 set if either string bmi _NTCError ; so fail if string, we want int rts _NTCError: berror "Number expected" ; ***************************************************************************** ; ; Unary version of above ; ; ***************************************************************************** BinaryStringTypeCheck: bit xsStatus+1,x bvc STCError UnaryStringTypeCheck: bit xsStatus,x ; check if string bvc STCError rts STCError: berror "String expected"
kernel/temp/__dictionary.asm
paulscottrobson/flat
0
167187
<gh_stars>0 db 1+5 db $20 dw define_21 db 1 db "!" db 1+5 db $20 dw define_2a db 1 db "*" db 1+5 db $20 dw define_2b db 1 db "+" db 2+5 db $20 dw define_2b_21 db 2 db "+!" db 2+5 db $20 dw define_2b_2b db 2 db "++" db 3+5 db $20 dw define_2b_2b_2b db 3 db "+++" db 1+5 db $20 dw define_2c db 1 db "," db 1+5 db $20 dw define_2d db 1 db "-" db 2+5 db $20 dw define_2d_2d db 2 db "--" db 3+5 db $20 dw define_2d_2d_2d db 3 db "---" db 1+5 db $20 dw define_2f db 1 db "/" db 2+5 db $20 dw define_30_2d db 2 db "0-" db 2+5 db $20 dw define_30_3c db 2 db "0<" db 2+5 db $20 dw define_30_3d db 2 db "0=" db 3+5 db $20 dw define_31_36_2a db 3 db "16*" db 2+5 db $20 dw define_32_2a db 2 db "2*" db 2+5 db $20 dw define_32_2f db 2 db "2/" db 2+5 db $20 dw define_34_2a db 2 db "4*" db 2+5 db $20 dw define_34_2f db 2 db "4/" db 2+5 db $20 dw define_38_2a db 2 db "8*" db 1+5 db $20 dw define_3b db 1 db ";" db 1+5 db $20 dw define_3c db 1 db "<" db 1+5 db $20 dw define_3d db 1 db "=" db 1+5 db $20 dw define_40 db 1 db "@" db 3+5 db $20 dw define_61_3e_62 db 3 db "a>b" db 3+5 db $20 dw define_61_3e_72 db 3 db "a>r" db 4+5 db $20 dw define_61_62_3e_72 db 4 db "ab>r" db 3+5 db $20 dw define_61_62_73 db 3 db "abs" db 3+5 db $20 dw define_61_6e_64 db 3 db "and" db 3+5 db $20 dw define_62_3e_61 db 3 db "b>a" db 3+5 db $20 dw define_62_3e_72 db 3 db "b>r" db 5+5 db $20 dw define_62_72_65_61_6b db 5 db "break" db 5+5 db $20 dw define_62_73_77_61_70 db 5 db "bswap" db 2+5 db $20 dw define_63_21 db 2 db "c!" db 2+5 db $20 dw define_63_2c db 2 db "c," db 2+5 db $20 dw define_63_40 db 2 db "c@" db 13+5 db $20 dw define_63_6f_6e_2e_72_61_77_2e_63_68_61_72_21 db 13 db "con.raw.char!" db 12+5 db $20 dw define_63_6f_6e_2e_72_61_77_2e_68_65_78_21 db 12 db "con.raw.hex!" db 13+5 db $20 dw define_63_6f_6e_2e_72_61_77_2e_69_6e_6b_65_79 db 13 db "con.raw.inkey" db 15+5 db $20 dw define_63_6f_6e_2e_72_61_77_2e_73_65_74_6d_6f_64_65 db 15 db "con.raw.setmode" db 4+5 db $20 dw define_63_6f_70_79 db 4 db "copy" db 5+5 db $20 dw define_64_65_62_75_67 db 5 db "debug" db 11+5 db $20 dw define_64_69_63_74_2e_63_72_75_6e_63_68 db 11 db "dict.crunch" db 4+5 db $20 dw define_66_69_6c_6c db 4 db "fill" db 4+5 db $20 dw define_68_61_6c_74 db 4 db "halt" db 8+5 db $20 dw define_6c_6f_61_64_66_72_6f_6d db 8 db "loadfrom" db 3+5 db $20 dw define_6d_6f_64 db 3 db "mod" db 3+5 db $20 dw define_6e_6f_74 db 3 db "not" db 2+5 db $20 dw define_6f_72 db 2 db "or" db 2+5 db $20 dw define_70_21 db 2 db "p!" db 2+5 db $20 dw define_70_40 db 2 db "p@" db 6+5 db $20 dw define_70_61_72_61_6d_21 db 6 db "param!" db 3+5 db $20 dw define_70_6f_70 db 3 db "pop" db 4+5 db $20 dw define_70_75_73_68 db 4 db "push" db 3+5 db $20 dw define_72_3e_61 db 3 db "r>a" db 4+5 db $20 dw define_72_3e_61_62 db 4 db "r>ab" db 3+5 db $20 dw define_72_3e_62 db 3 db "r>b" db 4+5 db $20 dw define_73_77_61_70 db 4 db "swap" db 4+5 db $20 dw define_77_61_72_6d db 4 db "warm" db 3+5 db $20 dw define_78_6f_72 db 3 db "xor" db 0
vendor/ring/pregenerated/tmp/poly1305-x86-win32n.asm
yilinhan/crates-io
210
161637
<filename>vendor/ring/pregenerated/tmp/poly1305-x86-win32n.asm ; This file is generated from a similarly-named Perl script in the BoringSSL ; source tree. Do not edit by hand. %ifdef BORINGSSL_PREFIX %include "boringssl_prefix_symbols_nasm.inc" %endif %ifidn __OUTPUT_FORMAT__,obj section code use32 class=code align=64 %elifidn __OUTPUT_FORMAT__,win32 %ifdef __YASM_VERSION_ID__ %if __YASM_VERSION_ID__ < 01010000h %error yasm version 1.1.0 or later needed. %endif ; Yasm automatically includes .00 and complains about redefining it. ; https://www.tortall.net/projects/yasm/manual/html/objfmt-win32-safeseh.html %else [email protected] equ 1 %endif section .text code align=64 %else section .text code %endif ;extern _GFp_ia32cap_P align 64 global _GFp_poly1305_init_asm align 16 _GFp_poly1305_init_asm: L$_GFp_poly1305_init_asm_begin: push ebp push ebx push esi push edi mov edi,DWORD [20+esp] mov esi,DWORD [24+esp] mov ebp,DWORD [28+esp] xor eax,eax mov DWORD [edi],eax mov DWORD [4+edi],eax mov DWORD [8+edi],eax mov DWORD [12+edi],eax mov DWORD [16+edi],eax mov DWORD [20+edi],eax cmp esi,0 je NEAR L$000nokey call L$001pic_point L$001pic_point: pop ebx lea eax,[(_GFp_poly1305_blocks-L$001pic_point)+ebx] lea edx,[(_GFp_poly1305_emit-L$001pic_point)+ebx] lea edi,[_GFp_ia32cap_P] mov ecx,DWORD [edi] and ecx,83886080 cmp ecx,83886080 lea eax,[(__poly1305_blocks_sse2-L$001pic_point)+ebx] lea edx,[(__poly1305_emit_sse2-L$001pic_point)+ebx] mov edi,DWORD [20+esp] mov DWORD [ebp],eax mov DWORD [4+ebp],edx mov eax,DWORD [esi] mov ebx,DWORD [4+esi] mov ecx,DWORD [8+esi] mov edx,DWORD [12+esi] and eax,268435455 and ebx,268435452 and ecx,268435452 and edx,268435452 mov DWORD [24+edi],eax mov DWORD [28+edi],ebx mov DWORD [32+edi],ecx mov DWORD [36+edi],edx mov eax,1 L$000nokey: pop edi pop esi pop ebx pop ebp ret global _GFp_poly1305_blocks align 16 _GFp_poly1305_blocks: L$_GFp_poly1305_blocks_begin: push ebp push ebx push esi push edi mov edi,DWORD [20+esp] mov esi,DWORD [24+esp] mov ecx,DWORD [28+esp] L$enter_blocks: and ecx,-15 jz NEAR L$002nodata sub esp,64 mov eax,DWORD [24+edi] mov ebx,DWORD [28+edi] lea ebp,[ecx*1+esi] mov ecx,DWORD [32+edi] mov edx,DWORD [36+edi] mov DWORD [92+esp],ebp mov ebp,esi mov DWORD [36+esp],eax mov eax,ebx shr eax,2 mov DWORD [40+esp],ebx add eax,ebx mov ebx,ecx shr ebx,2 mov DWORD [44+esp],ecx add ebx,ecx mov ecx,edx shr ecx,2 mov DWORD [48+esp],edx add ecx,edx mov DWORD [52+esp],eax mov DWORD [56+esp],ebx mov DWORD [60+esp],ecx mov eax,DWORD [edi] mov ebx,DWORD [4+edi] mov ecx,DWORD [8+edi] mov esi,DWORD [12+edi] mov edi,DWORD [16+edi] jmp NEAR L$003loop align 32 L$003loop: add eax,DWORD [ebp] adc ebx,DWORD [4+ebp] adc ecx,DWORD [8+ebp] adc esi,DWORD [12+ebp] lea ebp,[16+ebp] adc edi,DWORD [96+esp] mov DWORD [esp],eax mov DWORD [12+esp],esi mul DWORD [36+esp] mov DWORD [16+esp],edi mov edi,eax mov eax,ebx mov esi,edx mul DWORD [60+esp] add edi,eax mov eax,ecx adc esi,edx mul DWORD [56+esp] add edi,eax mov eax,DWORD [12+esp] adc esi,edx mul DWORD [52+esp] add edi,eax mov eax,DWORD [esp] adc esi,edx mul DWORD [40+esp] mov DWORD [20+esp],edi xor edi,edi add esi,eax mov eax,ebx adc edi,edx mul DWORD [36+esp] add esi,eax mov eax,ecx adc edi,edx mul DWORD [60+esp] add esi,eax mov eax,DWORD [12+esp] adc edi,edx mul DWORD [56+esp] add esi,eax mov eax,DWORD [16+esp] adc edi,edx imul eax,DWORD [52+esp] add esi,eax mov eax,DWORD [esp] adc edi,0 mul DWORD [44+esp] mov DWORD [24+esp],esi xor esi,esi add edi,eax mov eax,ebx adc esi,edx mul DWORD [40+esp] add edi,eax mov eax,ecx adc esi,edx mul DWORD [36+esp] add edi,eax mov eax,DWORD [12+esp] adc esi,edx mul DWORD [60+esp] add edi,eax mov eax,DWORD [16+esp] adc esi,edx imul eax,DWORD [56+esp] add edi,eax mov eax,DWORD [esp] adc esi,0 mul DWORD [48+esp] mov DWORD [28+esp],edi xor edi,edi add esi,eax mov eax,ebx adc edi,edx mul DWORD [44+esp] add esi,eax mov eax,ecx adc edi,edx mul DWORD [40+esp] add esi,eax mov eax,DWORD [12+esp] adc edi,edx mul DWORD [36+esp] add esi,eax mov ecx,DWORD [16+esp] adc edi,edx mov edx,ecx imul ecx,DWORD [60+esp] add esi,ecx mov eax,DWORD [20+esp] adc edi,0 imul edx,DWORD [36+esp] add edx,edi mov ebx,DWORD [24+esp] mov ecx,DWORD [28+esp] mov edi,edx shr edx,2 and edi,3 lea edx,[edx*4+edx] add eax,edx adc ebx,0 adc ecx,0 adc esi,0 adc edi,0 cmp ebp,DWORD [92+esp] jne NEAR L$003loop mov edx,DWORD [84+esp] add esp,64 mov DWORD [edx],eax mov DWORD [4+edx],ebx mov DWORD [8+edx],ecx mov DWORD [12+edx],esi mov DWORD [16+edx],edi L$002nodata: pop edi pop esi pop ebx pop ebp ret global _GFp_poly1305_emit align 16 _GFp_poly1305_emit: L$_GFp_poly1305_emit_begin: push ebp push ebx push esi push edi mov ebp,DWORD [20+esp] L$enter_emit: mov edi,DWORD [24+esp] mov eax,DWORD [ebp] mov ebx,DWORD [4+ebp] mov ecx,DWORD [8+ebp] mov edx,DWORD [12+ebp] mov esi,DWORD [16+ebp] add eax,5 adc ebx,0 adc ecx,0 adc edx,0 adc esi,0 shr esi,2 neg esi and eax,esi and ebx,esi and ecx,esi and edx,esi mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [8+edi],ecx mov DWORD [12+edi],edx not esi mov eax,DWORD [ebp] mov ebx,DWORD [4+ebp] mov ecx,DWORD [8+ebp] mov edx,DWORD [12+ebp] mov ebp,DWORD [28+esp] and eax,esi and ebx,esi and ecx,esi and edx,esi or eax,DWORD [edi] or ebx,DWORD [4+edi] or ecx,DWORD [8+edi] or edx,DWORD [12+edi] add eax,DWORD [ebp] adc ebx,DWORD [4+ebp] adc ecx,DWORD [8+ebp] adc edx,DWORD [12+ebp] mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [8+edi],ecx mov DWORD [12+edi],edx pop edi pop esi pop ebx pop ebp ret align 32 align 16 __poly1305_init_sse2: movdqu xmm4,[24+edi] lea edi,[48+edi] mov ebp,esp sub esp,224 and esp,-16 movq xmm7,[64+ebx] movdqa xmm0,xmm4 movdqa xmm1,xmm4 movdqa xmm2,xmm4 pand xmm0,xmm7 psrlq xmm1,26 psrldq xmm2,6 pand xmm1,xmm7 movdqa xmm3,xmm2 psrlq xmm2,4 psrlq xmm3,30 pand xmm2,xmm7 pand xmm3,xmm7 psrldq xmm4,13 lea edx,[144+esp] mov ecx,2 L$004square: movdqa [esp],xmm0 movdqa [16+esp],xmm1 movdqa [32+esp],xmm2 movdqa [48+esp],xmm3 movdqa [64+esp],xmm4 movdqa xmm6,xmm1 movdqa xmm5,xmm2 pslld xmm6,2 pslld xmm5,2 paddd xmm6,xmm1 paddd xmm5,xmm2 movdqa [80+esp],xmm6 movdqa [96+esp],xmm5 movdqa xmm6,xmm3 movdqa xmm5,xmm4 pslld xmm6,2 pslld xmm5,2 paddd xmm6,xmm3 paddd xmm5,xmm4 movdqa [112+esp],xmm6 movdqa [128+esp],xmm5 pshufd xmm6,xmm0,68 movdqa xmm5,xmm1 pshufd xmm1,xmm1,68 pshufd xmm2,xmm2,68 pshufd xmm3,xmm3,68 pshufd xmm4,xmm4,68 movdqa [edx],xmm6 movdqa [16+edx],xmm1 movdqa [32+edx],xmm2 movdqa [48+edx],xmm3 movdqa [64+edx],xmm4 pmuludq xmm4,xmm0 pmuludq xmm3,xmm0 pmuludq xmm2,xmm0 pmuludq xmm1,xmm0 pmuludq xmm0,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[48+edx] movdqa xmm7,xmm6 pmuludq xmm6,[32+edx] paddq xmm4,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[16+edx] paddq xmm3,xmm6 movdqa xmm6,[80+esp] pmuludq xmm5,[edx] paddq xmm2,xmm7 pmuludq xmm6,[64+edx] movdqa xmm7,[32+esp] paddq xmm1,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[32+edx] paddq xmm0,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[16+edx] paddq xmm4,xmm7 movdqa xmm7,[96+esp] pmuludq xmm6,[edx] paddq xmm3,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[64+edx] paddq xmm2,xmm6 pmuludq xmm5,[48+edx] movdqa xmm6,[48+esp] paddq xmm1,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[16+edx] paddq xmm0,xmm5 movdqa xmm5,[112+esp] pmuludq xmm7,[edx] paddq xmm4,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[64+edx] paddq xmm3,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[48+edx] paddq xmm2,xmm5 pmuludq xmm7,[32+edx] movdqa xmm5,[64+esp] paddq xmm1,xmm6 movdqa xmm6,[128+esp] pmuludq xmm5,[edx] paddq xmm0,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[64+edx] paddq xmm4,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[16+edx] paddq xmm3,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[32+edx] paddq xmm0,xmm7 pmuludq xmm6,[48+edx] movdqa xmm7,[64+ebx] paddq xmm1,xmm5 paddq xmm2,xmm6 movdqa xmm5,xmm3 pand xmm3,xmm7 psrlq xmm5,26 paddq xmm5,xmm4 movdqa xmm6,xmm0 pand xmm0,xmm7 psrlq xmm6,26 movdqa xmm4,xmm5 paddq xmm6,xmm1 psrlq xmm5,26 pand xmm4,xmm7 movdqa xmm1,xmm6 psrlq xmm6,26 paddd xmm0,xmm5 psllq xmm5,2 paddq xmm6,xmm2 paddq xmm5,xmm0 pand xmm1,xmm7 movdqa xmm2,xmm6 psrlq xmm6,26 pand xmm2,xmm7 paddd xmm6,xmm3 movdqa xmm0,xmm5 psrlq xmm5,26 movdqa xmm3,xmm6 psrlq xmm6,26 pand xmm0,xmm7 paddd xmm1,xmm5 pand xmm3,xmm7 paddd xmm4,xmm6 dec ecx jz NEAR L$005square_break punpcklqdq xmm0,[esp] punpcklqdq xmm1,[16+esp] punpcklqdq xmm2,[32+esp] punpcklqdq xmm3,[48+esp] punpcklqdq xmm4,[64+esp] jmp NEAR L$004square L$005square_break: psllq xmm0,32 psllq xmm1,32 psllq xmm2,32 psllq xmm3,32 psllq xmm4,32 por xmm0,[esp] por xmm1,[16+esp] por xmm2,[32+esp] por xmm3,[48+esp] por xmm4,[64+esp] pshufd xmm0,xmm0,141 pshufd xmm1,xmm1,141 pshufd xmm2,xmm2,141 pshufd xmm3,xmm3,141 pshufd xmm4,xmm4,141 movdqu [edi],xmm0 movdqu [16+edi],xmm1 movdqu [32+edi],xmm2 movdqu [48+edi],xmm3 movdqu [64+edi],xmm4 movdqa xmm6,xmm1 movdqa xmm5,xmm2 pslld xmm6,2 pslld xmm5,2 paddd xmm6,xmm1 paddd xmm5,xmm2 movdqu [80+edi],xmm6 movdqu [96+edi],xmm5 movdqa xmm6,xmm3 movdqa xmm5,xmm4 pslld xmm6,2 pslld xmm5,2 paddd xmm6,xmm3 paddd xmm5,xmm4 movdqu [112+edi],xmm6 movdqu [128+edi],xmm5 mov esp,ebp lea edi,[edi-48] ret align 32 align 16 __poly1305_blocks_sse2: push ebp push ebx push esi push edi mov edi,DWORD [20+esp] mov esi,DWORD [24+esp] mov ecx,DWORD [28+esp] mov eax,DWORD [20+edi] and ecx,-16 jz NEAR L$006nodata cmp ecx,64 jae NEAR L$007enter_sse2 test eax,eax jz NEAR L$enter_blocks align 16 L$007enter_sse2: call L$008pic_point L$008pic_point: pop ebx lea ebx,[(L$const_sse2-L$008pic_point)+ebx] test eax,eax jnz NEAR L$009base2_26 call __poly1305_init_sse2 mov eax,DWORD [edi] mov ecx,DWORD [3+edi] mov edx,DWORD [6+edi] mov esi,DWORD [9+edi] mov ebp,DWORD [13+edi] mov DWORD [20+edi],1 shr ecx,2 and eax,67108863 shr edx,4 and ecx,67108863 shr esi,6 and edx,67108863 movd xmm0,eax movd xmm1,ecx movd xmm2,edx movd xmm3,esi movd xmm4,ebp mov esi,DWORD [24+esp] mov ecx,DWORD [28+esp] jmp NEAR L$010base2_32 align 16 L$009base2_26: movd xmm0,DWORD [edi] movd xmm1,DWORD [4+edi] movd xmm2,DWORD [8+edi] movd xmm3,DWORD [12+edi] movd xmm4,DWORD [16+edi] movdqa xmm7,[64+ebx] L$010base2_32: mov eax,DWORD [32+esp] mov ebp,esp sub esp,528 and esp,-16 lea edi,[48+edi] shl eax,24 test ecx,31 jz NEAR L$011even movdqu xmm6,[esi] lea esi,[16+esi] movdqa xmm5,xmm6 pand xmm6,xmm7 paddd xmm0,xmm6 movdqa xmm6,xmm5 psrlq xmm5,26 psrldq xmm6,6 pand xmm5,xmm7 paddd xmm1,xmm5 movdqa xmm5,xmm6 psrlq xmm6,4 pand xmm6,xmm7 paddd xmm2,xmm6 movdqa xmm6,xmm5 psrlq xmm5,30 pand xmm5,xmm7 psrldq xmm6,7 paddd xmm3,xmm5 movd xmm5,eax paddd xmm4,xmm6 movd xmm6,DWORD [12+edi] paddd xmm4,xmm5 movdqa [esp],xmm0 movdqa [16+esp],xmm1 movdqa [32+esp],xmm2 movdqa [48+esp],xmm3 movdqa [64+esp],xmm4 pmuludq xmm0,xmm6 pmuludq xmm1,xmm6 pmuludq xmm2,xmm6 movd xmm5,DWORD [28+edi] pmuludq xmm3,xmm6 pmuludq xmm4,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[48+esp] movdqa xmm7,xmm6 pmuludq xmm6,[32+esp] paddq xmm4,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[16+esp] paddq xmm3,xmm6 movd xmm6,DWORD [92+edi] pmuludq xmm5,[esp] paddq xmm2,xmm7 pmuludq xmm6,[64+esp] movd xmm7,DWORD [44+edi] paddq xmm1,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[32+esp] paddq xmm0,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[16+esp] paddq xmm4,xmm7 movd xmm7,DWORD [108+edi] pmuludq xmm6,[esp] paddq xmm3,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[64+esp] paddq xmm2,xmm6 pmuludq xmm5,[48+esp] movd xmm6,DWORD [60+edi] paddq xmm1,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[16+esp] paddq xmm0,xmm5 movd xmm5,DWORD [124+edi] pmuludq xmm7,[esp] paddq xmm4,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[64+esp] paddq xmm3,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[48+esp] paddq xmm2,xmm5 pmuludq xmm7,[32+esp] movd xmm5,DWORD [76+edi] paddq xmm1,xmm6 movd xmm6,DWORD [140+edi] pmuludq xmm5,[esp] paddq xmm0,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[64+esp] paddq xmm4,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[16+esp] paddq xmm3,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[32+esp] paddq xmm0,xmm7 pmuludq xmm6,[48+esp] movdqa xmm7,[64+ebx] paddq xmm1,xmm5 paddq xmm2,xmm6 movdqa xmm5,xmm3 pand xmm3,xmm7 psrlq xmm5,26 paddq xmm5,xmm4 movdqa xmm6,xmm0 pand xmm0,xmm7 psrlq xmm6,26 movdqa xmm4,xmm5 paddq xmm6,xmm1 psrlq xmm5,26 pand xmm4,xmm7 movdqa xmm1,xmm6 psrlq xmm6,26 paddd xmm0,xmm5 psllq xmm5,2 paddq xmm6,xmm2 paddq xmm5,xmm0 pand xmm1,xmm7 movdqa xmm2,xmm6 psrlq xmm6,26 pand xmm2,xmm7 paddd xmm6,xmm3 movdqa xmm0,xmm5 psrlq xmm5,26 movdqa xmm3,xmm6 psrlq xmm6,26 pand xmm0,xmm7 paddd xmm1,xmm5 pand xmm3,xmm7 paddd xmm4,xmm6 sub ecx,16 jz NEAR L$012done L$011even: lea edx,[384+esp] lea eax,[esi-32] sub ecx,64 movdqu xmm5,[edi] pshufd xmm6,xmm5,68 cmovb esi,eax pshufd xmm5,xmm5,238 movdqa [edx],xmm6 lea eax,[160+esp] movdqu xmm6,[16+edi] movdqa [edx-144],xmm5 pshufd xmm5,xmm6,68 pshufd xmm6,xmm6,238 movdqa [16+edx],xmm5 movdqu xmm5,[32+edi] movdqa [edx-128],xmm6 pshufd xmm6,xmm5,68 pshufd xmm5,xmm5,238 movdqa [32+edx],xmm6 movdqu xmm6,[48+edi] movdqa [edx-112],xmm5 pshufd xmm5,xmm6,68 pshufd xmm6,xmm6,238 movdqa [48+edx],xmm5 movdqu xmm5,[64+edi] movdqa [edx-96],xmm6 pshufd xmm6,xmm5,68 pshufd xmm5,xmm5,238 movdqa [64+edx],xmm6 movdqu xmm6,[80+edi] movdqa [edx-80],xmm5 pshufd xmm5,xmm6,68 pshufd xmm6,xmm6,238 movdqa [80+edx],xmm5 movdqu xmm5,[96+edi] movdqa [edx-64],xmm6 pshufd xmm6,xmm5,68 pshufd xmm5,xmm5,238 movdqa [96+edx],xmm6 movdqu xmm6,[112+edi] movdqa [edx-48],xmm5 pshufd xmm5,xmm6,68 pshufd xmm6,xmm6,238 movdqa [112+edx],xmm5 movdqu xmm5,[128+edi] movdqa [edx-32],xmm6 pshufd xmm6,xmm5,68 pshufd xmm5,xmm5,238 movdqa [128+edx],xmm6 movdqa [edx-16],xmm5 movdqu xmm5,[32+esi] movdqu xmm6,[48+esi] lea esi,[32+esi] movdqa [112+esp],xmm2 movdqa [128+esp],xmm3 movdqa [144+esp],xmm4 movdqa xmm2,xmm5 movdqa xmm3,xmm6 psrldq xmm2,6 psrldq xmm3,6 movdqa xmm4,xmm5 punpcklqdq xmm2,xmm3 punpckhqdq xmm4,xmm6 punpcklqdq xmm5,xmm6 movdqa xmm3,xmm2 psrlq xmm2,4 psrlq xmm3,30 movdqa xmm6,xmm5 psrlq xmm4,40 psrlq xmm6,26 pand xmm5,xmm7 pand xmm6,xmm7 pand xmm2,xmm7 pand xmm3,xmm7 por xmm4,[ebx] movdqa [80+esp],xmm0 movdqa [96+esp],xmm1 jbe NEAR L$013skip_loop jmp NEAR L$014loop align 32 L$014loop: movdqa xmm7,[edx-144] movdqa [16+eax],xmm6 movdqa [32+eax],xmm2 movdqa [48+eax],xmm3 movdqa [64+eax],xmm4 movdqa xmm1,xmm5 pmuludq xmm5,xmm7 movdqa xmm0,xmm6 pmuludq xmm6,xmm7 pmuludq xmm2,xmm7 pmuludq xmm3,xmm7 pmuludq xmm4,xmm7 pmuludq xmm0,[edx-16] movdqa xmm7,xmm1 pmuludq xmm1,[edx-128] paddq xmm0,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[edx-112] paddq xmm1,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[edx-96] paddq xmm2,xmm7 movdqa xmm7,[16+eax] pmuludq xmm6,[edx-80] paddq xmm3,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[edx-128] paddq xmm4,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[edx-112] paddq xmm2,xmm7 movdqa xmm7,[32+eax] pmuludq xmm6,[edx-96] paddq xmm3,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[edx-32] paddq xmm4,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[edx-16] paddq xmm0,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[edx-128] paddq xmm1,xmm5 movdqa xmm5,[48+eax] pmuludq xmm7,[edx-112] paddq xmm3,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[edx-48] paddq xmm4,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[edx-32] paddq xmm0,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[edx-16] paddq xmm1,xmm6 movdqa xmm6,[64+eax] pmuludq xmm5,[edx-128] paddq xmm2,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[edx-16] paddq xmm4,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[edx-64] paddq xmm3,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[edx-48] paddq xmm0,xmm7 movdqa xmm7,[64+ebx] pmuludq xmm6,[edx-32] paddq xmm1,xmm5 paddq xmm2,xmm6 movdqu xmm5,[esi-32] movdqu xmm6,[esi-16] lea esi,[32+esi] movdqa [32+esp],xmm2 movdqa [48+esp],xmm3 movdqa [64+esp],xmm4 movdqa xmm2,xmm5 movdqa xmm3,xmm6 psrldq xmm2,6 psrldq xmm3,6 movdqa xmm4,xmm5 punpcklqdq xmm2,xmm3 punpckhqdq xmm4,xmm6 punpcklqdq xmm5,xmm6 movdqa xmm3,xmm2 psrlq xmm2,4 psrlq xmm3,30 movdqa xmm6,xmm5 psrlq xmm4,40 psrlq xmm6,26 pand xmm5,xmm7 pand xmm6,xmm7 pand xmm2,xmm7 pand xmm3,xmm7 por xmm4,[ebx] lea eax,[esi-32] sub ecx,64 paddd xmm5,[80+esp] paddd xmm6,[96+esp] paddd xmm2,[112+esp] paddd xmm3,[128+esp] paddd xmm4,[144+esp] cmovb esi,eax lea eax,[160+esp] movdqa xmm7,[edx] movdqa [16+esp],xmm1 movdqa [16+eax],xmm6 movdqa [32+eax],xmm2 movdqa [48+eax],xmm3 movdqa [64+eax],xmm4 movdqa xmm1,xmm5 pmuludq xmm5,xmm7 paddq xmm5,xmm0 movdqa xmm0,xmm6 pmuludq xmm6,xmm7 pmuludq xmm2,xmm7 pmuludq xmm3,xmm7 pmuludq xmm4,xmm7 paddq xmm6,[16+esp] paddq xmm2,[32+esp] paddq xmm3,[48+esp] paddq xmm4,[64+esp] pmuludq xmm0,[128+edx] movdqa xmm7,xmm1 pmuludq xmm1,[16+edx] paddq xmm0,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[32+edx] paddq xmm1,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[48+edx] paddq xmm2,xmm7 movdqa xmm7,[16+eax] pmuludq xmm6,[64+edx] paddq xmm3,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[16+edx] paddq xmm4,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[32+edx] paddq xmm2,xmm7 movdqa xmm7,[32+eax] pmuludq xmm6,[48+edx] paddq xmm3,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[112+edx] paddq xmm4,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[128+edx] paddq xmm0,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[16+edx] paddq xmm1,xmm5 movdqa xmm5,[48+eax] pmuludq xmm7,[32+edx] paddq xmm3,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[96+edx] paddq xmm4,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[112+edx] paddq xmm0,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[128+edx] paddq xmm1,xmm6 movdqa xmm6,[64+eax] pmuludq xmm5,[16+edx] paddq xmm2,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[128+edx] paddq xmm4,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[80+edx] paddq xmm3,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[96+edx] paddq xmm0,xmm7 movdqa xmm7,[64+ebx] pmuludq xmm6,[112+edx] paddq xmm1,xmm5 paddq xmm2,xmm6 movdqa xmm5,xmm3 pand xmm3,xmm7 psrlq xmm5,26 paddq xmm5,xmm4 movdqa xmm6,xmm0 pand xmm0,xmm7 psrlq xmm6,26 movdqa xmm4,xmm5 paddq xmm6,xmm1 psrlq xmm5,26 pand xmm4,xmm7 movdqa xmm1,xmm6 psrlq xmm6,26 paddd xmm0,xmm5 psllq xmm5,2 paddq xmm6,xmm2 paddq xmm5,xmm0 pand xmm1,xmm7 movdqa xmm2,xmm6 psrlq xmm6,26 pand xmm2,xmm7 paddd xmm6,xmm3 movdqa xmm0,xmm5 psrlq xmm5,26 movdqa xmm3,xmm6 psrlq xmm6,26 pand xmm0,xmm7 paddd xmm1,xmm5 pand xmm3,xmm7 paddd xmm4,xmm6 movdqu xmm5,[32+esi] movdqu xmm6,[48+esi] lea esi,[32+esi] movdqa [112+esp],xmm2 movdqa [128+esp],xmm3 movdqa [144+esp],xmm4 movdqa xmm2,xmm5 movdqa xmm3,xmm6 psrldq xmm2,6 psrldq xmm3,6 movdqa xmm4,xmm5 punpcklqdq xmm2,xmm3 punpckhqdq xmm4,xmm6 punpcklqdq xmm5,xmm6 movdqa xmm3,xmm2 psrlq xmm2,4 psrlq xmm3,30 movdqa xmm6,xmm5 psrlq xmm4,40 psrlq xmm6,26 pand xmm5,xmm7 pand xmm6,xmm7 pand xmm2,xmm7 pand xmm3,xmm7 por xmm4,[ebx] movdqa [80+esp],xmm0 movdqa [96+esp],xmm1 ja NEAR L$014loop L$013skip_loop: pshufd xmm7,[edx-144],16 add ecx,32 jnz NEAR L$015long_tail paddd xmm5,xmm0 paddd xmm6,xmm1 paddd xmm2,[112+esp] paddd xmm3,[128+esp] paddd xmm4,[144+esp] L$015long_tail: movdqa [eax],xmm5 movdqa [16+eax],xmm6 movdqa [32+eax],xmm2 movdqa [48+eax],xmm3 movdqa [64+eax],xmm4 pmuludq xmm5,xmm7 pmuludq xmm6,xmm7 pmuludq xmm2,xmm7 movdqa xmm0,xmm5 pshufd xmm5,[edx-128],16 pmuludq xmm3,xmm7 movdqa xmm1,xmm6 pmuludq xmm4,xmm7 movdqa xmm6,xmm5 pmuludq xmm5,[48+eax] movdqa xmm7,xmm6 pmuludq xmm6,[32+eax] paddq xmm4,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[16+eax] paddq xmm3,xmm6 pshufd xmm6,[edx-64],16 pmuludq xmm5,[eax] paddq xmm2,xmm7 pmuludq xmm6,[64+eax] pshufd xmm7,[edx-112],16 paddq xmm1,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[32+eax] paddq xmm0,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[16+eax] paddq xmm4,xmm7 pshufd xmm7,[edx-48],16 pmuludq xmm6,[eax] paddq xmm3,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[64+eax] paddq xmm2,xmm6 pmuludq xmm5,[48+eax] pshufd xmm6,[edx-96],16 paddq xmm1,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[16+eax] paddq xmm0,xmm5 pshufd xmm5,[edx-32],16 pmuludq xmm7,[eax] paddq xmm4,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[64+eax] paddq xmm3,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[48+eax] paddq xmm2,xmm5 pmuludq xmm7,[32+eax] pshufd xmm5,[edx-80],16 paddq xmm1,xmm6 pshufd xmm6,[edx-16],16 pmuludq xmm5,[eax] paddq xmm0,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[64+eax] paddq xmm4,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[16+eax] paddq xmm3,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[32+eax] paddq xmm0,xmm7 pmuludq xmm6,[48+eax] movdqa xmm7,[64+ebx] paddq xmm1,xmm5 paddq xmm2,xmm6 jz NEAR L$016short_tail movdqu xmm5,[esi-32] movdqu xmm6,[esi-16] lea esi,[32+esi] movdqa [32+esp],xmm2 movdqa [48+esp],xmm3 movdqa [64+esp],xmm4 movdqa xmm2,xmm5 movdqa xmm3,xmm6 psrldq xmm2,6 psrldq xmm3,6 movdqa xmm4,xmm5 punpcklqdq xmm2,xmm3 punpckhqdq xmm4,xmm6 punpcklqdq xmm5,xmm6 movdqa xmm3,xmm2 psrlq xmm2,4 psrlq xmm3,30 movdqa xmm6,xmm5 psrlq xmm4,40 psrlq xmm6,26 pand xmm5,xmm7 pand xmm6,xmm7 pand xmm2,xmm7 pand xmm3,xmm7 por xmm4,[ebx] pshufd xmm7,[edx],16 paddd xmm5,[80+esp] paddd xmm6,[96+esp] paddd xmm2,[112+esp] paddd xmm3,[128+esp] paddd xmm4,[144+esp] movdqa [esp],xmm5 pmuludq xmm5,xmm7 movdqa [16+esp],xmm6 pmuludq xmm6,xmm7 paddq xmm0,xmm5 movdqa xmm5,xmm2 pmuludq xmm2,xmm7 paddq xmm1,xmm6 movdqa xmm6,xmm3 pmuludq xmm3,xmm7 paddq xmm2,[32+esp] movdqa [32+esp],xmm5 pshufd xmm5,[16+edx],16 paddq xmm3,[48+esp] movdqa [48+esp],xmm6 movdqa xmm6,xmm4 pmuludq xmm4,xmm7 paddq xmm4,[64+esp] movdqa [64+esp],xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[48+esp] movdqa xmm7,xmm6 pmuludq xmm6,[32+esp] paddq xmm4,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[16+esp] paddq xmm3,xmm6 pshufd xmm6,[80+edx],16 pmuludq xmm5,[esp] paddq xmm2,xmm7 pmuludq xmm6,[64+esp] pshufd xmm7,[32+edx],16 paddq xmm1,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[32+esp] paddq xmm0,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[16+esp] paddq xmm4,xmm7 pshufd xmm7,[96+edx],16 pmuludq xmm6,[esp] paddq xmm3,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[64+esp] paddq xmm2,xmm6 pmuludq xmm5,[48+esp] pshufd xmm6,[48+edx],16 paddq xmm1,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[16+esp] paddq xmm0,xmm5 pshufd xmm5,[112+edx],16 pmuludq xmm7,[esp] paddq xmm4,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[64+esp] paddq xmm3,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[48+esp] paddq xmm2,xmm5 pmuludq xmm7,[32+esp] pshufd xmm5,[64+edx],16 paddq xmm1,xmm6 pshufd xmm6,[128+edx],16 pmuludq xmm5,[esp] paddq xmm0,xmm7 movdqa xmm7,xmm6 pmuludq xmm6,[64+esp] paddq xmm4,xmm5 movdqa xmm5,xmm7 pmuludq xmm7,[16+esp] paddq xmm3,xmm6 movdqa xmm6,xmm5 pmuludq xmm5,[32+esp] paddq xmm0,xmm7 pmuludq xmm6,[48+esp] movdqa xmm7,[64+ebx] paddq xmm1,xmm5 paddq xmm2,xmm6 L$016short_tail: pshufd xmm6,xmm4,78 pshufd xmm5,xmm3,78 paddq xmm4,xmm6 paddq xmm3,xmm5 pshufd xmm6,xmm0,78 pshufd xmm5,xmm1,78 paddq xmm0,xmm6 paddq xmm1,xmm5 pshufd xmm6,xmm2,78 movdqa xmm5,xmm3 pand xmm3,xmm7 psrlq xmm5,26 paddq xmm2,xmm6 paddq xmm5,xmm4 movdqa xmm6,xmm0 pand xmm0,xmm7 psrlq xmm6,26 movdqa xmm4,xmm5 paddq xmm6,xmm1 psrlq xmm5,26 pand xmm4,xmm7 movdqa xmm1,xmm6 psrlq xmm6,26 paddd xmm0,xmm5 psllq xmm5,2 paddq xmm6,xmm2 paddq xmm5,xmm0 pand xmm1,xmm7 movdqa xmm2,xmm6 psrlq xmm6,26 pand xmm2,xmm7 paddd xmm6,xmm3 movdqa xmm0,xmm5 psrlq xmm5,26 movdqa xmm3,xmm6 psrlq xmm6,26 pand xmm0,xmm7 paddd xmm1,xmm5 pand xmm3,xmm7 paddd xmm4,xmm6 L$012done: movd DWORD [edi-48],xmm0 movd DWORD [edi-44],xmm1 movd DWORD [edi-40],xmm2 movd DWORD [edi-36],xmm3 movd DWORD [edi-32],xmm4 mov esp,ebp L$006nodata: pop edi pop esi pop ebx pop ebp ret align 32 align 16 __poly1305_emit_sse2: push ebp push ebx push esi push edi mov ebp,DWORD [20+esp] cmp DWORD [20+ebp],0 je NEAR L$enter_emit mov eax,DWORD [ebp] mov edi,DWORD [4+ebp] mov ecx,DWORD [8+ebp] mov edx,DWORD [12+ebp] mov esi,DWORD [16+ebp] mov ebx,edi shl edi,26 shr ebx,6 add eax,edi mov edi,ecx adc ebx,0 shl edi,20 shr ecx,12 add ebx,edi mov edi,edx adc ecx,0 shl edi,14 shr edx,18 add ecx,edi mov edi,esi adc edx,0 shl edi,8 shr esi,24 add edx,edi adc esi,0 mov edi,esi and esi,3 shr edi,2 lea ebp,[edi*4+edi] mov edi,DWORD [24+esp] add eax,ebp mov ebp,DWORD [28+esp] adc ebx,0 adc ecx,0 adc edx,0 adc esi,0 movd xmm0,eax add eax,5 movd xmm1,ebx adc ebx,0 movd xmm2,ecx adc ecx,0 movd xmm3,edx adc edx,0 adc esi,0 shr esi,2 neg esi and eax,esi and ebx,esi and ecx,esi and edx,esi mov DWORD [edi],eax movd eax,xmm0 mov DWORD [4+edi],ebx movd ebx,xmm1 mov DWORD [8+edi],ecx movd ecx,xmm2 mov DWORD [12+edi],edx movd edx,xmm3 not esi and eax,esi and ebx,esi or eax,DWORD [edi] and ecx,esi or ebx,DWORD [4+edi] and edx,esi or ecx,DWORD [8+edi] or edx,DWORD [12+edi] add eax,DWORD [ebp] adc ebx,DWORD [4+ebp] mov DWORD [edi],eax adc ecx,DWORD [8+ebp] mov DWORD [4+edi],ebx adc edx,DWORD [12+ebp] mov DWORD [8+edi],ecx mov DWORD [12+edi],edx pop edi pop esi pop ebx pop ebp ret align 64 L$const_sse2: dd 16777216,0,16777216,0,16777216,0,16777216,0 dd 0,0,0,0,0,0,0,0 dd 67108863,0,67108863,0,67108863,0,67108863,0 dd 268435455,268435452,268435452,268435452 db 80,111,108,121,49,51,48,53,32,102,111,114,32,120,56,54 db 44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32 db 60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111 db 114,103,62,0 align 4 segment .bss common _GFp_ia32cap_P 16
home/time.asm
AtmaBuster/pc16-tpp1
3
10337
<reponame>AtmaBuster/pc16-tpp1 ; Functions relating to the timer interrupt and the real-time-clock. AskTimer:: push af ldh a, [hMobile] and a jr z, .not_mobile call Timer .not_mobile pop af reti LatchClock:: ; latch clock counter data ld a, LATCH_RTC ld [TPP1LatchClock], a ; waste some time to allow clock to latch properly nop nop nop ret UpdateTime:: call GetClock call FixDays call FixTime farcall GetTimeOfDay ret GetClock:: ; store clock data in hRTCDayHi-hRTCSeconds call LatchClock ; enable clock r/w ld a, RTC_REG_ENABLE ld [TPP1SRamEnable], a ld de, TPP1RTC ld a, [de] ; weeks maskbits 100 cp 50 jr c, .got_weeks sub 50 .got_weeks push bc ld c, a ld b, 0 ld hl, 0 ld a, 7 call AddNTimes pop bc inc de ld a, [de] ; day / hour and RTC_D_MASK ; day swap a srl a add l ldh [hRTCDayLo], a ld a, h jr nc, .set_day_hi inc h .set_day_hi ldh [hRTCDayHi], a ld a, [de] ; day / hour and RTC_H_MASK ; hour ldh [hRTCHours], a inc de ld a, [de] ; minutes maskbits 60 ldh [hRTCMinutes], a inc de ld a, [de] ; seconds maskbits 60 ldh [hRTCSeconds], a ; unlatch clock / disable clock r/w jp CloseSRAM FixDays:: ; fix day count ; mod by 140 ; check if day count > 255 (bit 8 set) ldh a, [hRTCDayHi] ; DH bit 0, a jr z, .daylo ; reset dh (bit 8) res 0, a ldh [hRTCDayHi], a ; DH ; mod 140 ; mod twice since bit 8 (DH) was set ldh a, [hRTCDayLo] ; DL .modh sub 140 jr nc, .modh .modl sub 140 jr nc, .modl add 140 ; update dl ldh [hRTCDayLo], a ; DL ; flag for sRTCStatusFlags ld a, %01000000 jr .set .daylo ; quit if fewer than 140 days have passed ldh a, [hRTCDayLo] ; DL cp 140 jr c, .quit ; mod 140 .mod sub 140 jr nc, .mod add 140 ; update dl ldh [hRTCDayLo], a ; DL ; flag for sRTCStatusFlags ld a, %00100000 .set ; update clock with modded day value push af call SetClock pop af scf ret .quit xor a ret FixTime:: ; add ingame time (set at newgame) to current time ; day hr min sec ; store time in wCurDay, hHours, hMinutes, hSeconds ; second ldh a, [hRTCSeconds] ; S ld c, a ld a, [wStartSecond] add c sub 60 jr nc, .updatesec add 60 .updatesec ldh [hSeconds], a ; minute ccf ; carry is set, so turn it off ldh a, [hRTCMinutes] ; M ld c, a ld a, [wStartMinute] adc c sub 60 jr nc, .updatemin add 60 .updatemin ldh [hMinutes], a ; hour ccf ; carry is set, so turn it off ldh a, [hRTCHours] ; H ld c, a ld a, [wStartHour] adc c sub 24 jr nc, .updatehr add 24 .updatehr ldh [hHours], a ; day ccf ; carry is set, so turn it off ldh a, [hRTCDayLo] ; DL ld c, a ld a, [wStartDay] adc c ld [wCurDay], a ret InitTimeOfDay:: xor a ld [wStringBuffer2], a ld a, $0 ; useless ld [wStringBuffer2 + 3], a jr InitTime InitDayOfWeek:: call UpdateTime ldh a, [hHours] ld [wStringBuffer2 + 1], a ldh a, [hMinutes] ld [wStringBuffer2 + 2], a ldh a, [hSeconds] ld [wStringBuffer2 + 3], a jr InitTime ; useless InitTime:: farcall _InitTime ret PanicResetClock:: xor a ldh [hRTCSeconds], a ldh [hRTCMinutes], a ldh [hRTCHours], a ldh [hRTCDayLo], a ldh [hRTCDayHi], a ; fallthrough SetClock:: ; set clock data from hram call LatchClock ; enable clock r/w ld a, RTC_REG_ENABLE ld [TPP1SRamEnable], a ld de, TPP1RTC ; hRTCDayHi is always 0 when calling SetClock ldh a, [hRTCDayLo] ld c, 7 call SimpleDivide push af ld a, b ld [de], a inc de pop af add a swap a ld b, a ldh a, [hRTCHours] or b ld [de], a inc de ldh a, [hRTCMinutes] ld [de], a inc de ldh a, [hRTCSeconds] ld [de], a ld a, SET_RTC ld [TPP1LatchClock], a ; cleanup jp CloseSRAM ; unlatch clock, disable clock r/w ClearRTCStatus:: ; clear sRTCStatusFlags xor a push af ld a, BANK(sRTCStatusFlags) call GetSRAMBank pop af ld [sRTCStatusFlags], a jp CloseSRAM RecordRTCStatus:: ; append flags to sRTCStatusFlags ld hl, sRTCStatusFlags push af ld a, BANK(sRTCStatusFlags) call GetSRAMBank pop af or [hl] ld [hl], a jp CloseSRAM CheckRTCStatus:: ; check sRTCStatusFlags ld a, BANK(sRTCStatusFlags) call GetSRAMBank ld a, [sRTCStatusFlags] jp CloseSRAM
server/src/main/antlr4/io/druid/sql/antlr4/DruidSQL.g4
xurenlu/druid
0
3390
grammar DruidSQL; @header { import com.google.common.base.Joiner; import com.google.common.collect.Lists; import io.druid.granularity.PeriodGranularity; import io.druid.granularity.QueryGranularity; import io.druid.query.aggregation.AggregatorFactory; import io.druid.query.aggregation.CountAggregatorFactory; import io.druid.query.aggregation.DoubleSumAggregatorFactory; import io.druid.query.aggregation.MaxAggregatorFactory; import io.druid.query.aggregation.MinAggregatorFactory; import io.druid.query.aggregation.PostAggregator; import io.druid.query.aggregation.post.ArithmeticPostAggregator; import io.druid.query.aggregation.post.ConstantPostAggregator; import io.druid.query.aggregation.post.FieldAccessPostAggregator; import io.druid.query.dimension.DefaultDimensionSpec; import io.druid.query.dimension.DimensionSpec; import io.druid.query.filter.AndDimFilter; import io.druid.query.filter.DimFilter; import io.druid.query.filter.NotDimFilter; import io.druid.query.filter.OrDimFilter; import io.druid.query.filter.RegexDimFilter; import io.druid.query.filter.SelectorDimFilter; import org.antlr.v4.runtime.NoViableAltException; import org.antlr.v4.runtime.Parser; import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.RecognitionException; import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.TokenStream; import org.antlr.v4.runtime.atn.ATN; import org.antlr.v4.runtime.atn.ATNSimulator; import org.antlr.v4.runtime.atn.ParserATNSimulator; import org.antlr.v4.runtime.atn.PredictionContextCache; import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.tree.ParseTreeListener; import org.antlr.v4.runtime.tree.TerminalNode; import org.joda.time.DateTime; import org.joda.time.Period; import java.text.NumberFormat; import java.text.ParseException; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; } @parser::members { public Map<String, AggregatorFactory> aggregators = new LinkedHashMap<String, AggregatorFactory>(); public List<PostAggregator> postAggregators = new LinkedList<PostAggregator>(); public DimFilter filter; public List<org.joda.time.Interval> intervals; public List<String> fields = new LinkedList<String>(); public QueryGranularity granularity = QueryGranularity.ALL; public Map<String, DimensionSpec> groupByDimensions = new LinkedHashMap<String, DimensionSpec>(); String dataSourceName = null; public String getDataSource() { return dataSourceName; } public String unescape(String quoted) { String unquote = quoted.trim().replaceFirst("^'(.*)'\$", "\$1"); return unquote.replace("''", "'"); } AggregatorFactory evalAgg(String name, int fn) { switch (fn) { case SUM: return new DoubleSumAggregatorFactory("sum("+name+")", name); case MIN: return new MinAggregatorFactory("min("+name+")", name); case MAX: return new MaxAggregatorFactory("max("+name+")", name); case COUNT: return new CountAggregatorFactory(name); } throw new IllegalArgumentException("Unknown function [" + fn + "]"); } PostAggregator evalArithmeticPostAggregator(PostAggregator a, List<Token> ops, List<PostAggregator> b) { if(b.isEmpty()) return a; else { int i = 0; PostAggregator root = a; while(i < ops.size()) { List<PostAggregator> list = new LinkedList<PostAggregator>(); List<String> names = new LinkedList<String>(); names.add(root.getName()); list.add(root); Token op = ops.get(i); while(i < ops.size() && ops.get(i).getType() == op.getType()) { PostAggregator e = b.get(i); list.add(e); names.add(e.getName()); i++; } root = new ArithmeticPostAggregator("("+Joiner.on(op.getText()).join(names)+")", op.getText(), list); } return root; } } } AND: 'and'; OR: 'or'; SUM: 'sum'; MIN: 'min'; MAX: 'max'; COUNT: 'count'; AS: 'as'; OPEN: '('; CLOSE: ')'; STAR: '*'; NOT: '!' ; PLUS: '+'; MINUS: '-'; DIV: '/'; COMMA: ','; EQ: '='; NEQ: '!='; MATCH: '~'; GROUP: 'group'; IDENT : (LETTER)(LETTER | DIGIT | '_')* ; QUOTED_STRING : '\'' ( ESC | ~'\'' )*? '\'' ; ESC : '\'' '\''; NUMBER: DIGIT*'.'?DIGIT+(EXPONENT)?; EXPONENT: ('e') ('+'|'-')? ('0'..'9')+; fragment DIGIT : '0'..'9'; fragment LETTER : 'a'..'z' | 'A'..'Z'; LINE_COMMENT : '--' .*? '\r'? '\n' -> skip ; COMMENT : '/*' .*? '*/' -> skip ; WS : (' '| '\t' | '\r' '\n' | '\n' | '\r')+ -> skip; query : select_stmt where_stmt (groupby_stmt)? ; select_stmt : 'select' e+=aliasedExpression (',' e+=aliasedExpression)* 'from' datasource { for(AliasedExpressionContext a : $e) { postAggregators.add(a.p); fields.add(a.p.getName()); } this.dataSourceName = $datasource.text; } ; where_stmt : 'where' f=timeAndDimFilter { if($f.filter != null) this.filter = $f.filter; this.intervals = Lists.newArrayList($f.interval); } ; groupby_stmt : GROUP 'by' groupByExpression ( COMMA! groupByExpression )* ; groupByExpression : gran=granularityFn {this.granularity = $gran.granularity;} | dim=IDENT { this.groupByDimensions.put($dim.text, new DefaultDimensionSpec($dim.text, $dim.text)); } ; datasource : IDENT ; aliasedExpression returns [PostAggregator p] : expression ( AS^ name=IDENT )? { if($name != null) { postAggregators.add($expression.p); $p = new FieldAccessPostAggregator($name.text, $expression.p.getName()); } else $p = $expression.p; } ; expression returns [PostAggregator p] : additiveExpression { $p = $additiveExpression.p; } ; additiveExpression returns [PostAggregator p] : a=multiplyExpression (( ops+=PLUS^ | ops+=MINUS^ ) b+=multiplyExpression)* { List<PostAggregator> rhs = new LinkedList<PostAggregator>(); for(MultiplyExpressionContext e : $b) rhs.add(e.p); $p = evalArithmeticPostAggregator($a.p, $ops, rhs); } ; multiplyExpression returns [PostAggregator p] : a=unaryExpression ((ops+= STAR | ops+=DIV ) b+=unaryExpression)* { List<PostAggregator> rhs = new LinkedList<PostAggregator>(); for(UnaryExpressionContext e : $b) rhs.add(e.p); $p = evalArithmeticPostAggregator($a.p, $ops, rhs); } ; unaryExpression returns [PostAggregator p] : MINUS e=unaryExpression { if($e.p instanceof ConstantPostAggregator) { ConstantPostAggregator c = (ConstantPostAggregator)$e.p; double v = c.getConstantValue().doubleValue() * -1; $p = new ConstantPostAggregator(Double.toString(v), v); } else { $p = new ArithmeticPostAggregator( "-"+$e.p.getName(), "*", Lists.newArrayList($e.p, new ConstantPostAggregator("-1", -1.0)) ); } } | PLUS e=unaryExpression { $p = $e.p; } | primaryExpression { $p = $primaryExpression.p; } ; primaryExpression returns [PostAggregator p] : constant { $p = $constant.c; } | aggregate { aggregators.put($aggregate.agg.getName(), $aggregate.agg); $p = new FieldAccessPostAggregator($aggregate.agg.getName(), $aggregate.agg.getName()); } | OPEN! e=expression CLOSE! { $p = $e.p; } ; aggregate returns [AggregatorFactory agg] : fn=( SUM^ | MIN^ | MAX^ ) OPEN! name=(IDENT|COUNT) CLOSE! { $agg = evalAgg($name.text, $fn.type); } | fn=COUNT OPEN! STAR CLOSE! { $agg = evalAgg("count(*)", $fn.type); } ; constant returns [ConstantPostAggregator c] : value=NUMBER { double v = Double.parseDouble($value.text); $c = new ConstantPostAggregator(Double.toString(v), v); } ; /* time filters must be top level filters */ timeAndDimFilter returns [DimFilter filter, org.joda.time.Interval interval] : (f1=dimFilter AND)? t=timeFilter (AND f2=dimFilter)? { if($f1.ctx != null || $f2.ctx != null) { if($f1.ctx != null && $f2.ctx != null) { $filter = new AndDimFilter(Lists.newArrayList($f1.filter, $f2.filter)); } else if($f1.ctx != null) { $filter = $f1.filter; } else { $filter = $f2.filter; } } $interval = $t.interval; } ; dimFilter returns [DimFilter filter] : e=orDimFilter { $filter = $e.filter; } ; orDimFilter returns [DimFilter filter] : a=andDimFilter (OR^ b+=andDimFilter)* { if($b.isEmpty()) $filter = $a.filter; else { List<DimFilter> rest = new ArrayList<DimFilter>(); for(AndDimFilterContext e : $b) rest.add(e.filter); $filter = new OrDimFilter(Lists.asList($a.filter, rest.toArray(new DimFilter[]{}))); } } ; andDimFilter returns [DimFilter filter] : a=primaryDimFilter (AND^ b+=primaryDimFilter)* { if($b.isEmpty()) $filter = $a.filter; else { List<DimFilter> rest = new ArrayList<DimFilter>(); for(PrimaryDimFilterContext e : $b) rest.add(e.filter); $filter = new AndDimFilter(Lists.asList($a.filter, rest.toArray(new DimFilter[]{}))); } } ; primaryDimFilter returns [DimFilter filter] : e=selectorDimFilter { $filter = $e.filter; } | l=inListDimFilter { $filter = $l.filter; } | NOT f=dimFilter { $filter = new NotDimFilter($f.filter); } | OPEN! f=dimFilter CLOSE! { $filter = $f.filter; } ; selectorDimFilter returns [DimFilter filter] : dimension=IDENT op=(EQ|NEQ|MATCH) value=QUOTED_STRING { String dim = $dimension.text; String val = unescape($value.text); switch($op.type) { case(EQ): $filter = new SelectorDimFilter(dim, val); break; case(NEQ): $filter = new NotDimFilter(new SelectorDimFilter(dim, val)); break; case(MATCH): $filter = new RegexDimFilter(dim, val); break; } } ; inListDimFilter returns [DimFilter filter] : dimension=IDENT 'in' (OPEN! ( (list+=QUOTED_STRING (COMMA! list+=QUOTED_STRING)*) ) CLOSE!) { List<DimFilter> filterList = new LinkedList<DimFilter>(); for(Token e : $list) filterList.add(new SelectorDimFilter($dimension.text, unescape(e.getText()))); $filter = new OrDimFilter(filterList); } ; timeFilter returns [org.joda.time.Interval interval, QueryGranularity granularity] : 'timestamp' 'between' s=timestamp AND e=timestamp { $interval = new org.joda.time.Interval($s.t, $e.t); } ; granularityFn returns [QueryGranularity granularity] : 'granularity' OPEN! 'timestamp' ',' str=QUOTED_STRING CLOSE! { String granStr = unescape($str.text); try { $granularity = QueryGranularity.fromString(granStr); } catch(IllegalArgumentException e) { $granularity = new PeriodGranularity(new Period(granStr), null, null); } } ; timestamp returns [DateTime t] : NUMBER { String str = $NUMBER.text.trim(); try { $t = new DateTime(NumberFormat.getInstance().parse(str)); } catch(ParseException e) { throw new IllegalArgumentException("Unable to parse number [" + str + "]"); } } | QUOTED_STRING { $t = new DateTime(unescape($QUOTED_STRING.text)); } ;
programs/oeis/286/A286748.asm
neoneye/loda
22
85230
; A286748: Characteristic sequence of the Beatty sequence, A194028, of sqrt(12). ; 0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1 mov $3,2 mov $5,$0 lpb $3 mov $0,$5 sub $3,1 add $0,$3 sub $0,1 mov $6,0 lpb $0 sub $0,1 add $4,$0 trn $0,5 lpe lpb $4 add $6,2 sub $4,$6 trn $4,1 lpe mov $2,$3 mul $2,$6 add $1,$2 lpe min $5,1 mul $5,$6 sub $1,$5 div $1,2 mov $0,$1
src/plugins/plugin-base.adb
Okasu/Byron
1
9247
<reponame>Okasu/Byron<filename>src/plugins/plugin-base.adb<gh_stars>1-10 package body Plugin.Base is procedure Say (Message : IRC.Message) is Arguments : Vector := Words (Message.Content); Answer : IRC.Message := Message; begin Answer.Channel := Arguments (2); Delete (Arguments, 1); Delete (Arguments, 1); Answer.Content := Unwords (Arguments); IRC.Put_Message (Answer); end Say; procedure Join (Message : IRC.Message) is Channel : Unbounded_String := Words (Message.Content)(2); begin if Element (Channel, 1) /= '#' then Channel := "#" & Channel; end if; IRC.Join_Channel (To_String (Channel)); end Join; procedure Leave (Message : IRC.Message) is begin IRC.Put_Line (To_String ("PART " & Message.Channel)); end Leave; procedure Nick (Message : IRC.Message) is begin IRC.Set_Nick (To_String (Element (Words (Message.Content), 2))); end Nick; end Plugin.Base;
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/fzero.lzh/fzero/en-data-2.asm
prismotizm/gigaleak
0
163909
Name: en-data-2.asm Type: file Size: 8595 Last-Modified: '1993-07-20T07:13:23Z' SHA-1: 07024E2AC73157BB0AD7C50B2B967979A75A26BD Description: null
assembly_tests/testEmu3.asm
znjRoLS/ss
0
161220
<filename>assembly_tests/testEmu3.asm .public fact .text.fact fact: ldc r15, fact mul r1, r2 sub r2, 1 cmps r2, 0 callne r15, 0 ret
parsers/action_expression/ActionExpression.g4
trgswe/fs2open.github.com
307
3970
grammar ActionExpression; expression_main: expression EOF; expression : value_expression | random_range_expression | parenthesis_expression | variable_reference_expression | expression ( PLUS | MINUS ) expression ; parenthesis_expression: L_PAREN expression R_PAREN; value_expression : literal_expression | vec3d_constructor ; literal_expression : FLOAT | INT | STRING ; // variable references are just a list of identifiers instead of being applied to expressions to avoid introducing types // for all the intermediate parts variable_reference_expression: IDENTIFIER (DOT IDENTIFIER)*; random_range_expression: RAND_L_PAREN expression expression R_PAREN; vec3d_constructor: L_PAREN expression expression expression R_PAREN; PLUS: '+'; MINUS: '-'; FLOAT : '-'? ([0-9]+ '.' [0-9]+) ; INT: '-'? [0-9]+; // The left parenthesis for the start of a random range RAND_L_PAREN: '~('; L_PAREN: '('; R_PAREN: ')'; IDENTIFIER: [a-zA-Z][a-zA-Z0-9]*; DOT: '.'; STRING: '"' .*? '"'; SPACE : [ \t\r\n] -> skip ; OTHER : . ;
AppleScripts/Applications/Pro Tools/ReVoice Capture.applescript
fantopop/post-production-scripts
16
3115
-- -- AppleScripts for Avid Pro Tools. -- -- Script description: -- Sends selection to Revoice Pro. -- -- (C) 2017 <NAME> -- http://github.com/fantopop -- tell application "Finder" tell application "System Events" set PT to the first application process whose creator type is "PTul" tell PT activate set frontmost to true -- Check if Revoice APT is open. set ReVoiceOpen to count (windows whose name contains "Audio Suite: Revoice Pro") -- Open Revoice APT if needed. if ReVoiceOpen is 0 then click menu item "Revoice Pro APT" of menu "Other" of menu item "Other" of menu "AudioSuite" of menu bar item "AudioSuite" of menu bar 1 -- Wait until the window opens. repeat while ReVoiceOpen is 0 delay 0.05 set ReVoiceOpen to count (windows whose name contains "Audio Suite: Revoice Pro") end repeat end if set Revoice to (1st window whose name contains "Audio Suite: Revoice Pro") -- Click "Capture" button tell Revoice to click button "Analyze" -- Wait until Capture performs -- Count windows before processing. set numBefore to count windows -- Count current number of windows. set num to count windows -- Wait until render completes. repeat while num is greater than numBefore set num to count windows delay 0.1 end repeat -- Move selection down keystroke ";" delay 0.05 -- Click "Capture" button tell Revoice to click button "Analyze" end tell -- Switch to Revoice window tell process "Revoice Pro" activate set frontmost to true end tell end tell end tell
oeis/229/A229213.asm
neoneye/loda-programs
11
8688
<reponame>neoneye/loda-programs<filename>oeis/229/A229213.asm ; A229213: Square array of denominators of t(n,k) = (1+1/(k*n))^n, read by descending antidiagonals. ; Submitted by <NAME> ; 1,2,4,3,16,27,4,36,216,256,5,64,729,4096,3125,6,100,1728,20736,100000,46656,7,144,3375,65536,759375,2985984,823543,8,196,5832,160000,3200000,34012224,105413504,16777216,9,256 lpb $0 add $1,1 sub $0,$1 lpe add $0,1 add $1,2 sub $1,$0 mul $1,$0 pow $1,$0 mov $0,$1
libsrc/_DEVELOPMENT/libgen/c/sdcc/glob_fat.asm
jpoikela/z88dk
640
177144
; unsigned char glob_fat(const char *s, const char *pattern) SECTION code_string PUBLIC _glob_fat EXTERN l0_glob_fat_callee _glob_fat: pop af pop hl pop de push de push hl push af jp l0_glob_fat_callee
app/prelude1/trashcan/player-3.asm
ern0/549notes
2
240158
;----------------------------------------------------------------------- ; Prelude1 - PC-DOS 256-byte intro by ern0 & TomCat ; Prototype-2: raw-diff-5 nctab nutab ; ; Target: 80386 real mode, assembler: FASM ; ;----------------------------------------------------------------------- ; Register allocation: ; ; AL - local, bit counter (SHL until carry) + result ; AH - local, data sub correction ; BX - global, delay ; DX - free ; CL - local, line counter, note counter ; CH - global, constant zero ; SI - local, 5-byte rotation, used in 5+3 repeat ; DI - global, 5-byte rotation ; BP - global, load bit pointer ; ES - DS=CS ; ;----------------------------------------------------------------------- TEST_MODE = 1 if TEST_MODE > 0 display "----[ test mode ]------------" end if ;----------------------------------------------------------------------- org 100H DB 3FH MOV DX,331H OUTSB MOV BP,(data_notes-data_start)*8 MOV BL,2 @next_line: MOV SI,data_start MOV DI,snapshot_start pusha call eight_of_eight popa XCHG SI,DI call eight_of_eight SUB DX,331H/32+1 JNC @next_line INC BX ; next_simple MOV CL,5+16+16-1 @next: CMP CL,5+16-1 JA @set_delay MOV BL,7 ; next_last CMP CL,5-1 JA @set_delay MOV BL,1 ; next_finish @set_delay: call load_play_note LOOP @next if TEST_MODE > 0 call test_summary end if ; RETN ;----------------------------------------------------------------------- load_play_note: MOV DI,data_start MOV AX,256*DATA_CSUB+32;AH:DATA_CSUB, AL:%xx10'0000: 3 SHL to carry @read_bit: BT [DI],BP INC BP RCL AL,1 JNC @read_bit ;word_read: SUB AL,AH ; adjust_word CMP AL,3 ; check for %011 special value JNE @rotate_notes ;load_uncompressed: MOV AH,128+DATA_USUB;AH:DATA_USUB, AL:%xxxx'xx11: 7 SHL to carry JMP @read_bit @rotate_notes: if TEST_MODE > 0 call test_diff end if add al,[di] lea si,[di + 1] movsw movsw stosb ; fall play_note ;----------------------------------------------------------------------- play_note: if TEST_MODE > 0 jmp test_note end if pusha PUSH AX INT 29H MOV DX,330H MOV AL,90H OUT DX,AL POP AX OUT DX,AL MOV AL,7FH OUT DX,AL ; fall wait ;----------------------------------------------------------------------- ;wait: @wait_some: mov ah,2cH int 21H MOV SI,DX @wait_tick: int 21H CMP SI,DX je @wait_tick DEC BX jne @wait_some popa ret ;----------------------------------------------------------------------- eight_of_eight: MOVSW MOVSW MOVSB MOV CL,5 @five_of_eight: call load_play_note LOOP @five_of_eight MOV CL,3 SUB SI,CX ; SI is from rotate_notes @three_of_eight: LODSB call play_note LOOP @three_of_eight ret ;----------------------------------------------------------------------- include "data-3.inc" include "test.asm" snapshot_start:
ROM_00.asm
neilbaldwin/Pulsar
11
241359
.feature force_range .include "pulsar.h" .include "common.h" .segment "HEADER" .byte "NES",$1a ; iNES identifier .byte $08 ; Number of PRG-ROM blocks .byte $00 ; Number of CHR-ROM blocks .IF SRAM_MAP=32 .BYTE %00010010, %00001000 .BYTE $00 ;.BYTE $01,$92 .BYTE $00,$92 .BYTE $07,$00,$00,$00,$00 .ELSE .BYTE %00010010, %00000000 .BYTE $00 .BYTE $00,$02 .BYTE $00,$00,$00,$00,$00 .ENDIF .segment "CODE_00" .include "macros.asm" .include "editor.asm" .include "editSong.asm" .include "editChain.asm" .include "editPattern.asm" .include "editInstrument.asm" .include "editDrumKit.asm" .include "editEnvelopeTable.asm" .include "editPitchTable.asm" .include "editVibratoTable.asm" .segment "RESET_00" .include "reset_stub.asm"
projects/batfish/src/main/antlr4/org/batfish/grammar/juniper/JuniperParser.g4
jeffkala/batfish
0
3192
parser grammar JuniperParser; options { superClass = 'org.batfish.grammar.BatfishParser'; tokenVocab = JuniperLexer; } braced_clause : OPEN_BRACE statement* ; bracketed_clause : OPEN_BRACKET word+ ; juniper_configuration : statement+ MULTILINE_COMMENT? EOF ; statement : flat_statement | hierarchical_statement ; flat_statement : START_FLAT_LINE words += word+ NEWLINE ; hierarchical_statement : descriptive_comment += MULTILINE_COMMENT* ( INACTIVE | REPLACE )? words += word+ ( braced_clause MULTILINE_COMMENT* close = CLOSE_BRACE | bracketed_clause close = CLOSE_BRACKET terminator | terminator ) ; terminator : SEMICOLON ; word : WORD ;
Library/Kernel/Win/winState.asm
steakknife/pcgeos
504
81398
<filename>Library/Kernel/Win/winState.asm COMMENT @---------------------------------------------------------------------- Copyright (c) GeoWorks 1988 -- All Rights Reserved PROJECT: PC GEOS MODULE: Win FILE: winState.asm ROUTINES: Name Description ---- ----------- GLB WinSetInfo Set some piece of window data GLB WinGetInfo Get the private data from a GState GLB WinGetWinScreenBounds Returns bounds of window, in screen coordinates. Useful to determine window's current position & size. REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 11/88 Initial version DESCRIPTION: This file contains routines to get and set window state. $Id: winState.asm,v 1.1 97/04/05 01:16:10 newdeal Exp $ ------------------------------------------------------------------------------@ WinMisc segment resource COMMENT @---------------------------------------------------------------------- FUNCTION: WinSetInfo DESCRIPTION: Set some piece of window data CALLED BY: GLOBAL PASS: si - value in WinInfoType for type of info to set WIT_PRIVATE_DATA: ax, bx, cx, dx - private data WIT_COLOR: al - color index or red value for RGB ah - WCF_TRANSPARENT if none, WIN_RGB if RGB colors low bits are color map mode bl - green value (for RGB) bh - blue value (for RGB) WIT_INPUT_OBJ: cx:dx - new input OD WIT_EXPOSURE_OBJ: cx:dx - new exposure OD WIT_STRATEGY: cx:dx - new video driver strategy routine this should probably never be executed.... di - handle of window RETURN: carry set if di is a gstate or a window that is closing DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/88 Initial version Chris 4/26/91 Changed to return carry ------------------------------------------------------------------------------@ WinSetInfo proc far push di push ds call FarWinLockFromDI jc exit ; exit if gstring EC< test si, 01h ; ODD? > EC< jnz badWinInfoType > EC< cmp si, WinInfoType > EC< ja badWinInfoType > push di call cs:[winSetInfoTable][si] pop di push bx mov bx, di ; get window handle call MemUnlockV pop bx clc ; window did exist exit: pop ds pop di ret EC<badWinInfoType: > EC< ERROR WIN_BAD_WIN_INFO_TYPE > WinSetInfo endp ;---------------------- winSetInfoTable label word word WinSetPrivateData word WinSetColor word WinSetInputOD word WinSetExposureOD word WinSetStrategy word WinSetDummy ; Can't set flags, just reserve slot word WinSetDummy ; Can't set layer ID, reserve slot word WinSetDummy ; Can't set window link, reserve slot word WinSetDummy ; Can't set window link, reserve slot word WinSetDummy ; Can't set window link, reserve slot word WinSetDummy ; Can't set window link, reserve slot word WinSetDummy ; Can't set window link, reserve slot word WinSetDummy ; Can't set priority, reserve slot WinSetPrivateData proc near mov ds:[W_privData].WPD_ax,ax mov ds:[W_privData].WPD_bx,bx mov ds:[W_privData].WPD_cx,cx mov ds:[W_privData].WPD_dx,dx ret WinSetPrivateData endp WinSetColor proc near mov ds:[W_color], ah ; store into Window structure mov ds:[W_colorRGB].RGB_red, al ; store red color mov ds:[W_colorRGB].RGB_green, bl ; store green color mov ds:[W_colorRGB].RGB_blue, bh ; store blue color ret WinSetColor endp WinSetInputOD proc near mov di, offset W_inputObj jmp CallSetOD WinSetInputOD endp WinSetExposureOD proc near mov di, offset W_exposureObj CallSetOD label near call WinSetOD ret WinSetExposureOD endp WinSetStrategy proc near mov ds:[W_driverStrategy].segment, cx mov ds:[W_driverStrategy].offset, dx REAL_FALL_THRU WinSetDummy WinSetStrategy endp WinSetDummy proc near ret WinSetDummy endp WinSetOD proc near uses bx, si .enter mov bx, ds:[di].handle ; get OLD input/exposure OD mov si, ds:[di].chunk cmp bx, cx ; see if any different from new jne changeOfOD cmp si, dx je done ; if no change, done changeOfOD: ; BEFORE setting new OD, flush the queues, using the OLD OD values. ; this will make sure that any references they have of this window ; will be cleared out before the window is allowed to die. ; call WinFlushQueue mov ds:[di].handle, cx ; store NEW OD mov ds:[di].chunk, dx done: .leave ret WinSetOD endp WinMisc ends WinMovable segment resource COMMENT @----------------------------------------------------------------------- FUNCTION: WinGetInfo DESCRIPTION: Get the private data from a GState CALLED BY: GLOBAL PASS: di - handle of graphics state or window si - value in WinInfoType for type of info to get RETURN: for si = WIT_PRIVATE_DATA: ax, bx, cx, dx - private data WIT_COLOR: al - color index or red value for RGB ah - WCF_TRANSPARENT if none, WIN_RGB if RGB colors low bits are color map mode bl - blue value (for RGB) bh - green value (for RGB) WIT_INPUT_OBJ: cx:dx - input OD WIT_EXPOSURE_OBJ: cx:dx - exposure OD WIT_STRATEGY: cx:dx - strategy routine WIT_FLAGS: (READ ONLY) al - WinRegFlags. Bits that may be inspected are: mask WRF_EXPOSE_PENDING - set if MSG_META_EXPOSED has been sent out, & neither GrBeginUpdate nor WinAckUpdate have been called yet. ah - WinPtrFlags. Bits that may be inspected are: mask WPF_WIN_GRABBED - set if Window has grabbed mouse input mask WPF_WIN_BRANCH_EXCLUDED - set if window is excluded from mouse input mask WPF_PTR_IN_UNIV - set if ptr is in univ of window (RAW), NOT synchronous w/UI thread mask WPF_PTR_IN_VIS - set if ptr is in vis reg of window (RAW), NOT synchronous w/UI thread. mask WPF_UNIV_ENTERED - set if in middle of MSG_META_UNIV_ENTER/LEAVE pair (NOT sync w/UI) mask WPF_VIS_ENTERED - set if in middle of MSG_META_VIS_ENTER/LEAVE pair (NOT sync w/UI) WIT_LAYER_ID ax - layer ID (a unique handle) WIT_PARENT_WIN, WIT_FIRST_CHILD_WIN, WIT_LAST_CHILD_WIN, WIT_PREV_SIBLING_WIN, WIT_NEXT_SIBLING_WIN: ax - window link (generally only useful from within callback routine of WinProcess) WIT_PRIORITY al - WinPriorityData carry set if di is a gstate or a window that is closing DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/88 Initial version Chris 4/26/91 Changed to return carry -------------------------------------------------------------------------------@ WinGetInfo proc far push di push ds call FarWinLockFromDI jc exit ; exit if gstring EC< test si, 01h ; ODD? > EC< jnz badWinInfoType > EC< cmp si, WinInfoType > EC< ja badWinInfoType > push di call cs:winGetInfoTable[si] pop di push ax, bx mov bx, di ; get window handle call WinUnlockV pop ax, bx clc ;window did exist exit: pop ds pop di ret EC<badWinInfoType: > EC< ERROR WIN_BAD_WIN_INFO_TYPE > WinGetInfo endp ;---------------------- winGetInfoTable label word word WinGetPrivateData word WinGetColor word WinGetInputOD word WinGetExposureOD word WinGetStrategy word WinGetFlags word WinGetLayerID word WinGetParentWin word WinGetFirstChildWin word WinGetLastChildWin word WinGetPrevSiblingWin word WinGetNextSiblingWin word WinGetPriority WinGetPrivateData proc near mov ax,ds:[W_privData].WPD_ax mov bx,ds:[W_privData].WPD_bx mov cx,ds:[W_privData].WPD_cx mov dx,ds:[W_privData].WPD_dx ret WinGetPrivateData endp WinGetColor proc near mov ah, ds:[W_color] ; get flags mov al, ds:[W_colorRGB].RGB_red ; get red color mov bh, ds:[W_colorRGB].RGB_green ; get green color mov bl, ds:[W_colorRGB].RGB_blue ; get blue color ret WinGetColor endp WinGetInputOD proc near mov di, offset W_inputObj jmp GetTwoWords WinGetInputOD endp WinGetExposureOD proc near mov di, offset W_exposureObj jmp GetTwoWords WinGetExposureOD endp WinGetStrategy proc near mov di, offset W_driverStrategy REAL_FALL_THRU GetTwoWords WinGetStrategy endp GetTwoWords proc near mov cx, ds:[di].segment mov dx, ds:[di].offset ret GetTwoWords endp WinGetFlags proc near mov al, ds:[W_regFlags] mov ah, ds:[W_ptrFlags] ret WinGetFlags endp WinGetLayerID proc near mov ax, ds:[W_layerID] ret WinGetLayerID endp WinGetParentWin proc near mov ax, ds:[W_parent] ret WinGetParentWin endp WinGetFirstChildWin proc near mov ax, ds:[W_firstChild] ret WinGetFirstChildWin endp WinGetLastChildWin proc near mov ax, ds:[W_lastChild] ret WinGetLastChildWin endp WinGetPrevSiblingWin proc near mov ax, ds:[W_prevSibling] ret WinGetPrevSiblingWin endp WinGetNextSiblingWin proc near mov ax, ds:[W_nextSibling] ret WinGetNextSiblingWin endp WinGetPriority proc near mov al, ds:[W_priority] ret WinGetPriority endp WinMovable ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% WinGetWinScreenBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns bounds of window, in screen coordinates. Useful to determine window's current position & size. CALLED BY: GLOBAL PASS: di - handle of window or graphics state RETURN: ax - window left bx - window top cx - window right dx - window bottom carry set if di is a gstate or a window that is closing DESTROYED: nothing PSEUDO CODE/STRATEGY: lofty pseudo code here; KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 10/18/88 Initial version Jim 2/90 changed to use common code Chris 4/26/91 Changed to return carry Doug 5/14/91 Corrected header doc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ WinGetWinScreenBounds proc far uses di, ds .enter call FarWinLockFromDI ; ds = window segment. jc handleGS ; handle passed gstring ; see if closing (note: clears carry) test ds:[W_regFlags], mask WRF_CLOSED jz 10$ stc ; set carry flag to indicate closing 10$: mov ax, ds:[W_winRect.R_left] mov bx, ds:[W_winRect.R_top] mov cx, ds:[W_winRect.R_right] mov dx, ds:[W_winRect.R_bottom] xchg bx, di ; get window handle, save coord. call MemUnlockV ; release window xchg bx, di ; restore coord. ; carry should be intact from above exit: ; .leave ret ; if passed a gstring, return big bounds handleGS: mov ax, MIN_COORD mov bx, ax mov cx, MAX_COORD mov dx, cx stc ; say the window didn't exist jmp short exit WinGetWinScreenBounds endp GraphicsObscure segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% WinRealizePalette %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Realize the palette for this window in hardware CALLED BY: GLOBAL OpenWinUpdateSystemFocusExcl PASS: di - Window handle RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jim 11/18/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ WinRealizePalette proc far uses bx, ax, ds, si, dx, cx, di, es .enter mov bx, di ; setup Win handle call MemPLock mov es, ax ; check for palette mov si, es:[W_palette] ; get palette handle tst si jz defPalette mov si, es:[si] ; ds:si -> palette data clr ax ; start with 1st entry mov cx, 0x100 ; set all of them mov dx, es ; dx:si -> palette entries ; check for vidmem. If we're writing to vidmem, then lock ; down the bitmap block and allow modifications to all entries. setPalCommon: tst es:[W_bitmap].segment ; check VM file handle jnz handleBitmap ; there is one, deal with it mov di, DR_VID_SET_PALETTE call es:[W_driverStrategy] ; call video driver done: call MemUnlockV ; release window .leave ret defPalette: mov dx, segment idata mov si, offset idata:defaultPalette mov ax, 0x100 mov cx, 0x100 ; set all registers jmp setPalCommon ; we are going to vidmem. Lock down bitmap header handleBitmap: push ax, bx mov bx, es:[W_bitmap].segment mov di, es:[W_bitmap].offset call HugeArrayLockDir EC < tst es:[W_bmSegment] ; has to be zero here > EC < ERROR_NZ GRAPHICS_BITMAP_SHOULDNT_BE_LOCKED > mov es:[W_bmSegment], ax pop ax, bx ; if we're already setting all the entries, continue ; tst ax ; if starting at zero ; jz callDriver ; need to determine what the size of the palette is push ds mov ds, es:[W_bmSegment] mov di, offset EB_bm add di, ds:[di].CB_palette mov cx, ds:[di] ; get number of entries in palette pop ds mov di, DR_VID_SET_PALETTE call es:[W_driverStrategy] ; call video driver ; unlock the bitmap push ds mov ds, es:[W_bmSegment] mov es:[W_bmSegment], 0 call HugeArrayUnlockDir pop ds EC < push bx, di > EC < mov bx, es:[W_bitmap].segment > EC < mov di, es:[W_bitmap].offset > EC < call ECCheckHugeArrayFar > EC < pop bx, di > jmp done WinRealizePalette endp GraphicsObscure ends
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0_notsx.log_21829_115.asm
ljhsiun2/medusa
9
85935
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r14 push %r15 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x1c36c, %rsi lea addresses_normal_ht+0xf5fc, %rdi nop nop cmp $33402, %r15 mov $102, %rcx rep movsq nop nop add %rbx, %rbx lea addresses_D_ht+0x12754, %r9 nop nop nop add $36506, %r14 movw $0x6162, (%r9) nop nop nop nop nop cmp %rbx, %rbx lea addresses_normal_ht+0xb9d0, %r14 nop nop nop nop nop dec %r15 movb (%r14), %r9b nop nop add %rcx, %rcx lea addresses_UC_ht+0xdeec, %rdi nop nop nop nop xor $9931, %r15 mov (%rdi), %cx nop nop nop nop nop and %rdi, %rdi lea addresses_WT_ht+0x12f6c, %rcx nop nop nop nop sub %rdi, %rdi movl $0x61626364, (%rcx) nop nop cmp %rcx, %rcx lea addresses_WC_ht+0x19cec, %rsi lea addresses_UC_ht+0x546c, %rdi dec %r9 mov $49, %rcx rep movsl inc %r14 lea addresses_WT_ht+0x79ec, %r14 nop nop nop nop sub $36780, %r15 mov $0x6162636465666768, %rbx movq %rbx, %xmm4 vmovups %ymm4, (%r14) add $43835, %r14 lea addresses_A_ht+0x1c12c, %r15 nop nop nop nop nop cmp $6089, %r9 mov (%r15), %edi nop nop and $42760, %rsi lea addresses_UC_ht+0x9c98, %rsi lea addresses_WT_ht+0x1d1a0, %rdi sub %rdx, %rdx mov $6, %rcx rep movsw nop nop nop xor $28561, %r15 lea addresses_WT_ht+0x776c, %rsi lea addresses_UC_ht+0x158ac, %rdi nop nop cmp %r15, %r15 mov $21, %rcx rep movsb nop nop nop nop and %rcx, %rcx lea addresses_UC_ht+0x12f6c, %rbx nop inc %rcx mov $0x6162636465666768, %rdi movq %rdi, %xmm6 and $0xffffffffffffffc0, %rbx movntdq %xmm6, (%rbx) nop nop nop nop nop sub %rsi, %rsi lea addresses_UC_ht+0x276c, %r15 xor %rbx, %rbx movl $0x61626364, (%r15) nop nop inc %rbx lea addresses_D_ht+0xa36c, %rdi nop nop xor %rdx, %rdx mov (%rdi), %r9w nop and $29041, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r14 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r15 push %rbp push %rbx push %rcx push %rdi // Store lea addresses_WT+0x1b4ac, %rbp clflush (%rbp) nop nop nop and %rcx, %rcx movl $0x51525354, (%rbp) nop nop nop nop xor $29195, %r12 // Store lea addresses_WT+0xa630, %r10 nop nop nop nop sub $52164, %r15 movl $0x51525354, (%r10) dec %rbp // Store lea addresses_A+0x18260, %rdi sub $8564, %r15 movw $0x5152, (%rdi) nop and %rbx, %rbx // Store mov $0x4ce, %rbx cmp $30663, %rdi movb $0x51, (%rbx) nop nop nop cmp %rcx, %rcx // Faulty Load lea addresses_D+0x876c, %rdi nop sub $52438, %rcx mov (%rdi), %rbx lea oracles, %r10 and $0xff, %rbx shlq $12, %rbx mov (%r10,%rbx,1), %rbx pop %rdi pop %rcx pop %rbx pop %rbp pop %r15 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 2}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': True, 'size': 4, 'NT': True, 'same': False, 'congruent': 2}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 2}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 1}} [Faulty Load] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 8, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 2}} {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 11}} {'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 7}} {'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}} {'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': True, 'same': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 11}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
alloy4fun_models/trashltl/models/11/nh5DQR6aJd6LpryQD.als
Kaixi26/org.alloytools.alloy
0
229
open main pred idnh5DQR6aJd6LpryQD_prop12 { all f:File-Protected | eventually always f in Trash } pred __repair { idnh5DQR6aJd6LpryQD_prop12 } check __repair { idnh5DQR6aJd6LpryQD_prop12 <=> prop12o }
oeis/269/A269790.asm
neoneye/loda-programs
11
8288
<filename>oeis/269/A269790.asm<gh_stars>10-100 ; A269790: Primes p such that 2*p + 79 is a square. ; Submitted by <NAME> ; 73,181,2341,4861,6121,9901,12601,18973,20161,26641,47701,51481,59473,61561,68041,79561,81973,84421,94573,110881,157321,185401,192781,207973,231841,244261,248473,270073,292573,335341,365473,440821,446473,452161,475273 mov $1,9 mov $2,332202 lpb $2 mul $6,4 mov $3,$6 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,9 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,18 add $5,$1 mov $6,$5 lpe mov $0,$6 mul $0,4 add $0,1
src/asf-components-utils-scripts.adb
jquorning/ada-asf
12
16300
<reponame>jquorning/ada-asf<filename>src/asf-components-utils-scripts.adb ----------------------------------------------------------------------- -- components-utils-scripts -- Javascript queue -- Copyright (C) 2011, 2012, 2015 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body ASF.Components.Utils.Scripts is -- ------------------------------ -- Write the content that was collected by rendering the inner children. -- Write the content in the Javascript queue. -- ------------------------------ overriding procedure Write_Content (UI : in UIScript; Writer : in out Contexts.Writer.Response_Writer'Class; Content : in String; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is pragma Unreferenced (UI, Context); begin Writer.Queue_Script (Content); end Write_Content; -- ------------------------------ -- If the component provides a src attribute, render the <script src='xxx'></script> -- tag with an optional async attribute. -- ------------------------------ overriding procedure Encode_Begin (UI : in UIScript; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is begin if not UI.Is_Rendered (Context) then return; end if; declare Src : constant String := UI.Get_Attribute (Context => Context, Name => "src"); Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer; begin if Src'Length > 0 then Writer.Queue_Include_Script (URL => Src, Async => UI.Get_Attribute (Context => Context, Name => "async")); end if; end; end Encode_Begin; end ASF.Components.Utils.Scripts;
programs/oeis/288/A288601.asm
jmorken/loda
1
2639
<filename>programs/oeis/288/A288601.asm<gh_stars>1-10 ; A288601: Positions of 0 in A288600; complement of A288602. ; 1,3,4,6,8,9,12,13,15,18,19,21,23,24,28,29,31,33,34,37,38,40,44,45,47,49,50,53,54,56,59,60,62,64,65,70,71,73,75,76,79,80,82,85,86,88,90,91,95,96,98,100,101,104,105,107,112,113,115,117,118,121,122,124,127,128,130,132,133,137,138,140,142,143,146,147,149,153,154,156,158,159,162,163,165,168,169,171,173,174,180,181,183,185,186,189,190,192,195,196,198,200,201,205,206,208,210,211,214,215,217,221,222,224,226,227,230,231,233,236,237,239,241,242,247,248,250,252,253,256,257,259,262,263,265,267,268,272,273,275,277,278,281,282,284,290,291,293,295,296,299,300,302,305,306,308,310,311,315,316,318,320,321,324,325,327,331,332,334,336,337,340,341,343,346,347,349,351,352,357,358,360,362,363,366,367,369,372,373,375,377,378,382,383,385,387,388,391,392,394,399,400,402,404,405,408,409,411,414,415,417,419,420,424,425,427,429,430,433,434,436,440,441,443,445,446,449,450,452,455,456,458,460,461,468,469,471,473,474,477,478,480,483,484,486,488,489,493,494,496 mov $9,$0 mov $11,$0 add $11,1 lpb $11 mov $0,$9 sub $11,1 sub $0,$11 mov $5,$0 mov $7,2 lpb $7 clr $0,5 mov $0,$5 sub $7,1 add $0,$7 sub $0,1 lpb $0 sub $0,1 mov $1,$0 mov $2,1 cal $1,219641 ; a(n) = n minus (number of 1's in Zeckendorf expansion of n). mov $0,0 add $2,$1 lpe mov $1,$2 mov $8,$7 lpb $8 mov $6,$1 sub $8,1 lpe lpe lpb $5 mov $5,0 sub $6,$1 lpe mov $1,$6 add $1,1 add $10,$1 lpe mov $1,$10
src/PJ/rastlib/byulccmp.asm
AnimatorPro/Animator-Pro
119
20136
CGROUP group code code segment dword 'CODE' assume cs:CGROUP,ds:CGROUP ;pj_unlccomp decodes a FLI_LC chunk of a flic frame. This is the main ;'delta' type chunk. It contains information to transform one frame ;into the next frame where hopefully the next frame is mostly the same ;as the one frame. This uses a combination of 'skip' compression and ;run length compression. Each packet of this chunk public pj_unlccomp ; pj_unlccomp(cbuf, screen, bpr, screen_seg) ; UBYTE *cbuf; /* points to a FLI_LC chunk after chunk header. */ ; UBYTE *screen; /* 64000 byte screen */ ; int screen_seg pj_unlccomp proc near pubr struc pulc_savebp dd ? pulc_ret dd ? pulc_cbuf dd ? pulc_screen dd ? pulc_bpr dd ? pulc_seg dd ? pubr ends linect equ dword ptr[ebp-4] ;save the world and set the basepage push ebp mov ebp,esp sub esp,4 push es push esi push edi push ebx push ecx push edx cld ;clear direction flag in case Aztec or someone mucks with it. xor eax,eax ;clear hi bits of accumulator mov eax,[ebp].pulc_seg mov es,ax ;set destination segment mov esi,[ebp].pulc_cbuf mov edi,[ebp].pulc_screen lodsw ;get the count of # of lines to skip mul [ebp].pulc_bpr add edi,eax lodsw ;get line count mov linect,eax ;save it on stack mov edx,edi ;keep pointer to start of line in dx xor ah,ah ;clear hi bit of ah cause lots of unsigned uses to follow linelp: mov edi,edx lodsb ;get op count for this line mov bl,al test bl,bl jmp endulcloop ulcloop: lodsb ;load in the byte skip add edi,eax lodsb ; load op/count test al,al js ulcrun mov ecx,eax rep movsb dec bl jnz ulcloop jmp ulcout ulcrun: neg al mov ecx,eax ;get signed count lodsb ;value to repeat in al rep stosb dec bl endulcloop: jnz ulcloop ulcout: add edx,[ebp].pulc_bpr dec linect jnz linelp mov eax,esi ;return position in compression stream pop edx pop ecx pop ebx pop edi pop esi pop es mov esp,ebp pop ebp ret pj_unlccomp endp code ends end
prototyping/Luau/RuntimeError/ToString.agda
TheGreatSageEqualToHeaven/luau
1
8706
<reponame>TheGreatSageEqualToHeaven/luau {-# OPTIONS --rewriting #-} module Luau.RuntimeError.ToString where open import Agda.Builtin.Float using (primShowFloat) open import FFI.Data.String using (String; _++_) open import Luau.RuntimeError using (RuntimeErrorᴮ; RuntimeErrorᴱ; local; return; FunctionMismatch; BinOpMismatch₁; BinOpMismatch₂; UnboundVariable; SEGV; app₁; app₂; block; bin₁; bin₂) open import Luau.RuntimeType.ToString using (runtimeTypeToString) open import Luau.Addr.ToString using (addrToString) open import Luau.Syntax.ToString using (valueToString; exprToString) open import Luau.Var.ToString using (varToString) open import Luau.Syntax using (var; val; addr; binexp; block_is_end; local_←_; return; _∙_; name; _$_; ··) errToStringᴱ : ∀ {a H} M → RuntimeErrorᴱ {a} H M → String errToStringᴮ : ∀ {a H} B → RuntimeErrorᴮ {a} H B → String errToStringᴱ (var x) (UnboundVariable) = "variable " ++ varToString x ++ " is unbound" errToStringᴱ (val (addr a)) (SEGV p) = "address " ++ addrToString a ++ " is unallocated" errToStringᴱ (M $ N) (FunctionMismatch v w p) = "value " ++ (valueToString v) ++ " is not a function" errToStringᴱ (M $ N) (app₁ E) = errToStringᴱ M E errToStringᴱ (M $ N) (app₂ E) = errToStringᴱ N E errToStringᴱ (binexp M ·· N) (BinOpMismatch₁ v w p) = "value " ++ (valueToString v) ++ " is not a string" errToStringᴱ (binexp M ·· N) (BinOpMismatch₂ v w p) = "value " ++ (valueToString w) ++ " is not a string" errToStringᴱ (binexp M op N) (BinOpMismatch₁ v w p) = "value " ++ (valueToString v) ++ " is not a number" errToStringᴱ (binexp M op N) (BinOpMismatch₂ v w p) = "value " ++ (valueToString w) ++ " is not a number" errToStringᴱ (binexp M op N) (bin₁ E) = errToStringᴱ M E errToStringᴱ (binexp M op N) (bin₂ E) = errToStringᴱ N E errToStringᴱ (block b is B end) (block E) = errToStringᴮ B E ++ "\n in call of function " ++ varToString (name b) errToStringᴮ (local x ← M ∙ B) (local E) = errToStringᴱ M E ++ "\n in definition of " ++ varToString (name x) errToStringᴮ (return M ∙ B) (return E) = errToStringᴱ M E ++ "\n in return statement"
3-mid/opengl/source/lean/light/opengl-light.ads
charlie5/lace-alire
1
18200
with openGL.Palette; package openGL.Light -- -- Models a light. -- is type Item is tagged private; type Items is array (Positive range <>) of Item; -------------- --- Attributes -- type Id_t is new Natural; type Kind_t is (Diffuse, Direct); null_Id : constant Id_t; function Id (Self : in Item) return light.Id_t; procedure Id_is (Self : in out Item; Now : in light.Id_t); function Kind (Self : in Item) return light.Kind_t; procedure Kind_is (Self : in out Item; Now : in light.Kind_t); function is_On (Self : in Item) return Boolean; procedure is_On (Self : in out Item; Now : in Boolean := True); function Site (Self : in Item) return openGL.Site; procedure Site_is (Self : in out Item; Now : in openGL.Site); function Color (Self : in Item) return Color; function Attenuation (Self : in Item) return Real; function ambient_Coefficient (Self : in Item) return Real; function cone_Angle (Self : in Item) return Degrees; function cone_Direction (Self : in Item) return Vector_3; procedure Color_is (Self : in out Item; Now : in openGL.Color); procedure Attenuation_is (Self : in out Item; Now : in Real); procedure ambient_Coefficient_is (Self : in out Item; Now : in Real); procedure cone_Angle_is (Self : in out Item; Now : in Degrees); procedure cone_Direction_is (Self : in out Item; Now : in Vector_3); private null_Id : constant Id_t := Id_t'First; type Item is tagged record Id : light.Id_t := null_Id; Kind : light.Kind_t := Direct; On : Boolean := True; Site : openGL.Site := (0.0, 0.0, 1.0); -- The GL default. Color : openGL.Color := Palette.White; Attenuation : Real := 0.1; ambient_Coefficient : Real := 0.1; cone_Angle : Degrees := 2.0; cone_Direction : Vector_3 := (0.0, 0.0, -1.0); end record; end openGL.Light;
ground-decidable.agda
hazelgrove/hazelnut-dynamics-agda
16
3214
<reponame>hazelgrove/hazelnut-dynamics-agda open import Prelude open import core module ground-decidable where ground-decidable : (τ : htyp) → (τ ground) + ((τ ground) → ⊥) ground-decidable b = Inl GBase ground-decidable ⦇-⦈ = Inr (λ ()) ground-decidable (b ==> b) = Inr (λ ()) ground-decidable (b ==> ⦇-⦈) = Inr (λ ()) ground-decidable (b ==> τ' ==> τ'') = Inr (λ ()) ground-decidable (⦇-⦈ ==> b) = Inr (λ ()) ground-decidable (⦇-⦈ ==> ⦇-⦈) = Inl GHole ground-decidable (⦇-⦈ ==> τ' ==> τ'') = Inr (λ ()) ground-decidable ((τ ==> τ₁) ==> b) = Inr (λ ()) ground-decidable ((τ ==> τ₁) ==> ⦇-⦈) = Inr (λ ()) ground-decidable ((τ ==> τ₁) ==> τ' ==> τ'') = Inr (λ ()) ground-arr-lem : (τ : htyp) → ((τ ground) → ⊥) → (τ ≠ ⦇-⦈) → Σ[ τ1 ∈ htyp ] Σ[ τ2 ∈ htyp ] ((τ == (τ1 ==> τ2)) × ((τ1 ==> τ2) ≠ (⦇-⦈ ==> ⦇-⦈))) ground-arr-lem b ng nh = abort (ng GBase) ground-arr-lem ⦇-⦈ ng nh = abort (nh refl) ground-arr-lem (τ1 ==> τ2) ng nh = τ1 , τ2 , refl , (λ x → ng (lem' x)) where lem' : ∀{τ1 τ2} → τ1 ==> τ2 == ⦇-⦈ ==> ⦇-⦈ → (τ1 ==> τ2) ground lem' refl = GHole
test/interaction/Issue1950.agda
cruhland/agda
1,989
10140
-- Andreas, 2016-05-03 issue #1950 -- testcases from issue #679 -- {-# OPTIONS --show-implicit #-} -- {-# OPTIONS -v reify.display:100 #-} -- {-# OPTIONS -v tc.display.top:100 #-} postulate anything : ∀{A : Set} → A postulate Anything : ∀{A : Set1} → A record ⊤ : Set where data ty : Set where ♭ : ty _`→_ : ty → ty → ty ⟦_⟧ : ty → Set ⟦ ♭ ⟧ = ⊤ ⟦ A `→ B ⟧ = ⟦ A ⟧ → ⟦ B ⟧ eq : ∀ (σ : ty) (a b : ⟦ σ ⟧) → Set eq ♭ a b = Anything eq (A `→ B) f g = ∀ {a : ⟦ A ⟧} → eq B (f a) (g a) eq-sym : ∀ σ {a b} (h : eq σ a b) → eq σ b a eq-sym ♭ h = anything eq-sym (A `→ B) h with B ... | B' = {!B'!} -- splitting on B' should yield -- eq-sym (A `→ B) h | ♭ = {!!} -- eq-sym (A `→ B) h | B' `→ B'' = {!!} data Unit : Set where unit : Unit T : Unit → Set T unit = {u : Unit} → Unit fails : (u : Unit) → T u fails unit with unit ... | q = {!q!} -- Splitting on q should yield -- fails unit | unit = {!!}
source/nodes/program-nodes-type_conversions.adb
reznikmm/gela
0
27229
<gh_stars>0 -- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Program.Nodes.Type_Conversions is function Create (Subtype_Mark : not null Program.Elements.Expressions .Expression_Access; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Operand : not null Program.Elements.Expressions .Expression_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Type_Conversion is begin return Result : Type_Conversion := (Subtype_Mark => Subtype_Mark, Left_Bracket_Token => Left_Bracket_Token, Operand => Operand, Right_Bracket_Token => Right_Bracket_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Subtype_Mark : not null Program.Elements.Expressions .Expression_Access; Operand : not null Program.Elements.Expressions .Expression_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Type_Conversion is begin return Result : Implicit_Type_Conversion := (Subtype_Mark => Subtype_Mark, Operand => Operand, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Subtype_Mark (Self : Base_Type_Conversion) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Subtype_Mark; end Subtype_Mark; overriding function Operand (Self : Base_Type_Conversion) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Operand; end Operand; overriding function Left_Bracket_Token (Self : Type_Conversion) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Left_Bracket_Token; end Left_Bracket_Token; overriding function Right_Bracket_Token (Self : Type_Conversion) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Right_Bracket_Token; end Right_Bracket_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Type_Conversion) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Type_Conversion) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Type_Conversion) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : in out Base_Type_Conversion'Class) is begin Set_Enclosing_Element (Self.Subtype_Mark, Self'Unchecked_Access); Set_Enclosing_Element (Self.Operand, Self'Unchecked_Access); null; end Initialize; overriding function Is_Type_Conversion (Self : Base_Type_Conversion) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Type_Conversion; overriding function Is_Expression (Self : Base_Type_Conversion) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Expression; overriding procedure Visit (Self : not null access Base_Type_Conversion; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Type_Conversion (Self); end Visit; overriding function To_Type_Conversion_Text (Self : in out Type_Conversion) return Program.Elements.Type_Conversions.Type_Conversion_Text_Access is begin return Self'Unchecked_Access; end To_Type_Conversion_Text; overriding function To_Type_Conversion_Text (Self : in out Implicit_Type_Conversion) return Program.Elements.Type_Conversions.Type_Conversion_Text_Access is pragma Unreferenced (Self); begin return null; end To_Type_Conversion_Text; end Program.Nodes.Type_Conversions;
src/shared/generic/lsc-internal-aes.ads
Componolit/libsparkcrypto
30
26955
<filename>src/shared/generic/lsc-internal-aes.ads ------------------------------------------------------------------------------- -- This file is part of libsparkcrypto. -- -- Copyright (C) 2010, <NAME> -- Copyright (C) 2010, secunet Security Networks AG -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- -- * Neither the name of the nor the names of its contributors may be used -- to endorse or promote products derived from this software without -- specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS -- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- with LSC.Internal.Types; use type LSC.Internal.Types.Word32; use type LSC.Internal.Types.Index; ------------------------------------------------------------------------------- -- The AES algorithm -- -- <ul> -- <li> -- <a href="http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf"> -- FIPS PUB 197, Advanced Encryption Standard (AES), National Institute of -- Standards and Technology, U.S. Department of Commerce, November 2001. </a> -- </li> -- -- <li> -- <a href="http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf"> -- <NAME> and <NAME>, AES submission document on Rijndael, -- Version 2, September 1999.</a> -- </li> -- </ul> ------------------------------------------------------------------------------- package LSC.Internal.AES is pragma Pure; -- AES encryption context type AES_Enc_Context is private; -- AES decryption context type AES_Dec_Context is private; -- Index of AES key subtype Key_Index is Types.Index range 0 .. 7; -- AES key type Key_Type is array (Key_Index range <>) of Types.Word32; -- Index of AES-128 key subtype AES128_Key_Index is Types.Index range 0 .. 3; -- AES-128 key subtype AES128_Key_Type is Key_Type (AES128_Key_Index); -- Index of AES-192 key subtype AES192_Key_Index is Types.Index range 0 .. 5; -- AES-192 key subtype AES192_Key_Type is Key_Type (AES192_Key_Index); -- Index of AES-256 key subtype AES256_Key_Index is Types.Index range 0 .. 7; -- AES-256 key subtype AES256_Key_Type is Key_Type (AES256_Key_Index); -- Index of AES block subtype Block_Index is Types.Index range 0 .. 3; -- AES block subtype Block_Type is Types.Word32_Array_Type (Block_Index); -- Index of AES message subtype Message_Index is Natural; -- AES message (unconstrained array of AES blocks) type Message_Type is array (Message_Index range <>) of Block_Type; -- Create AES-128 encryption context from AES-128 @Key@ function Create_AES128_Enc_Context (Key : AES128_Key_Type) return AES_Enc_Context; -- Create AES-192 encryption context from AES-192 @Key@ function Create_AES192_Enc_Context (Key : AES192_Key_Type) return AES_Enc_Context; -- Create AES-256 encryption context from AES-256 @Key@ function Create_AES256_Enc_Context (Key : AES256_Key_Type) return AES_Enc_Context; -- Encrypt one @Plaintext@ block using given @Context@, return one block of -- ciphertext function Encrypt (Context : AES_Enc_Context; Plaintext : Block_Type) return Block_Type with Global => null; -- Create AES-128 decryption context from AES-128 @Key@ function Create_AES128_Dec_Context (Key : AES128_Key_Type) return AES_Dec_Context; -- Create AES-192 decryption context from AES-192 @Key@ function Create_AES192_Dec_Context (Key : AES192_Key_Type) return AES_Dec_Context; -- Create AES-256 decryption context from AES-256 @Key@ function Create_AES256_Dec_Context (Key : AES256_Key_Type) return AES_Dec_Context; -- Decrypt one @Ciphertext@ block using given @Context@, return one block of -- plaintext function Decrypt (Context : AES_Dec_Context; Ciphertext : Block_Type) return Block_Type with Global => null; -- Empty AES block Null_Block : constant Block_Type; -- Empty AES-128 key Null_AES128_Key : constant AES128_Key_Type; -- Empty AES-192 key Null_AES192_Key : constant AES192_Key_Type; -- Empty AES-256 key Null_AES256_Key : constant AES256_Key_Type; private Nb : constant Types.Index := 4; subtype Schedule_Index is Types.Index range 0 .. 15 * Nb - 1; subtype Schedule_Type is Types.Word32_Array_Type (Schedule_Index); Null_Schedule : constant Schedule_Type := Schedule_Type'(Schedule_Index => 0); subtype Nr_Type is Types.Index range 10 .. 14; subtype Nk_Type is Types.Index range 4 .. 8; type AES_Enc_Context is record Schedule : Schedule_Type; Nr : Nr_Type; end record; type AES_Dec_Context is record Schedule : Schedule_Type; Nr : Nr_Type; end record; Null_Block : constant Block_Type := Block_Type'(Block_Index => 0); Null_AES128_Key : constant AES128_Key_Type := AES128_Key_Type'(AES128_Key_Index => 0); Null_AES192_Key : constant AES192_Key_Type := AES192_Key_Type'(AES192_Key_Index => 0); Null_AES256_Key : constant AES256_Key_Type := AES256_Key_Type'(AES256_Key_Index => 0); end LSC.Internal.AES;
Exercise_4/partA.asm
dekoperez/SEL0433_microprocessorAplications
0
28383
<reponame>dekoperez/SEL0433_microprocessorAplications ;******************************************************************************* ; @INSTITUTION ; University of Sao Paulo | Sao Carlos School of Engineering | SEL ;------------------------------------------------------------------------------ ; @DISCIPLINE ; Name: SEL0433 | Applications of Microprocessors I ; Professor: <NAME> ; Semester: 2017\01 ;------------------------------------------------------------------------------ ; @DEVELOPMENT ; MCU: Intel 8052 ; IDE: MCU 8051 v1.5.7 ; Compiler: IDE native assembler ;------------------------------------------------------------------------------ ; @WARRANTY ; Copyright (c) 2017 <NAME> ; The software is provided by "as is", without warranty of any kind, express or ; implied, including but not limited to the warranties of merchantability, ; fitness for a particular purpose and noninfringement. In no event shall the ; authors or copyright holders be liable for any claim, damages or other ; liability, whether in an action of contract, tort or otherwise, arising from, ; out of or in connection with the software or the use or other dealings in the ; software. ;------------------------------------------------------------------------------ ; @EXERCISE ; Ex. : # 4 ; Part: # -- ;------------------------------------------------------------------------------ ; @AUTHOR ; Name: <NAME> ; Email: <EMAIL> ; #USP: 8006891 ;******************************************************************************* ;******************************************************************************* ; @CONSTANT ; Code's constants ;------------------------------------------------------------------------------ BUFFER_HEAD EQU 20H BUFFER_TAIL EQU BUFFER_HEAD + 11 ;******************************************************************************* ;******************************************************************************* ; @VARIABLE ; Code's variables ;------------------------------------------------------------------------------ MOTOR_STEPS_QTD EQU 1FH MOTOR_DIRECTION BIT P1.1 MOTOR_CLOCK BIT P1.0 ;******************************************************************************* ;******************************************************************************* ; @MACROS ; Code's macros ;------------------------------------------------------------------------------ ; @Description ; Simulates one step on the stepper motor ;------------------------------------------------------------------------------ MOTOR_STEP MACRO SETB MOTOR_CLOCK ; DELAY CLR MOTOR_CLOCK ENDM ;******************************************************************************* ;******************************************************************************* ; @CODE ; Main code ;------------------------------------------------------------------------------ ORG 0 LCALL MAIN ORG 23H LCALL ISR_SERIAL RETI MAIN: CLR MOTOR_CLOCK MOV TMOD,#20H MOV TH1,#0FDH MOV TL1,#0FDH MOV SCON,#50H SETB TR1 SETB ES SETB EA MOV R0,#BUFFER_HEAD LOOP: JNB F0,$ CLR F0 CLR ES MOV R0,#(BUFFER_HEAD + 0) LCALL BUFFER_CHECK MOV R0,#(BUFFER_HEAD + 3) LCALL BUFFER_CHECK MOV R0,#(BUFFER_HEAD + 6) LCALL BUFFER_CHECK MOV R0,#(BUFFER_HEAD + 9) LCALL BUFFER_CHECK LCALL BUFFER_FLUSH SETB ES SJMP LOOP ;******************************************************************************* ;******************************************************************************* ; @ROUTINE ; BUFFER_CHECK ;------------------------------------------------------------------------------ ; @Description ; Checks whether the three next ASCII chars present on the BUFFER are valid or ; not. If at least one char is invalid, it skips the entire command, else, calls ; a routine to perform the valid command. ;------------------------------------------------------------------------------ ; @Param ; R0: Is the pointer for the 1st char of the command sequence stored on BUFFER ;------------------------------------------------------------------------------ ; @Returns ; Void ;------------------------------------------------------------------------------ BUFFER_CHECK: CJNE @R0,#00H,CHECK_MSB SJMP ERROR CHECK_MSB: CJNE @R0,#30H,CHECK_MSB_A CHECK_MSB_A: JC ERROR CJNE @R0,#3AH,CHECK_MSB_B CHECK_MSB_B: JNC ERROR CLR C INC R0 CJNE @R0,#00H,CHECK_LSB SJMP ERROR CHECK_LSB: CJNE @R0,#30H,CHECK_LSB_A CHECK_LSB_A: JC ERROR CJNE @R0,#3AH,CHECK_LSB_B CHECK_LSB_B: JNC ERROR INC R0 CJNE @R0,#'A',CHECK_CHAR_H DEC R0 DEC R0 CLR MOTOR_DIRECTION LCALL MOTOR_START RET CHECK_CHAR_H: CJNE @R0,#'H',ERROR DEC R0 DEC R0 SETB MOTOR_DIRECTION LCALL MOTOR_START ERROR: RET ;******************************************************************************* ;******************************************************************************* ; @ROUTINE ; BUFFER_FLUSH ;------------------------------------------------------------------------------ ; @Description ; Clears the BUFFER. ;------------------------------------------------------------------------------ ; @Precondition ; BUFFER_HEAD: The first BUFFER element position on the ram must be defined here ; BUFFER_TAIL: The last BUFFER element position on the ram must be defined here ;------------------------------------------------------------------------------ ; @Param ; Void ;------------------------------------------------------------------------------ ; @Returns ; Void ;------------------------------------------------------------------------------ BUFFER_FLUSH: MOV R0,#BUFFER_TAIL FLUSH: MOV @R0,#00H DEC R0 CJNE R0,#BUFFER_HEAD,FLUSH MOV @R0,#00H RET ;******************************************************************************* ;******************************************************************************* ; @ROUTINE ; MOTOR_START ;------------------------------------------------------------------------------ ; @Description ; Perfoms the command sequence stored on the BUFFER. It makes the stepper motor ; performs as many steps as the user input. Also, for each step, it sends the ; number of steps performed and its direction to a monitor via serial. ;------------------------------------------------------------------------------ ; @Precondition ; R2: Must be free to be used. ;------------------------------------------------------------------------------ ; @Param ; R0: Is the pointer for the 1st char of the command sequence stored on BUFFER ;------------------------------------------------------------------------------ ; @Returns ; Void ;------------------------------------------------------------------------------ MOTOR_START: LCALL NUMBER_ASCII_TO_HEX MOV MOTOR_STEPS_QTD,A CLR A STEP: ADD A,#01H DA A MOV R2,A LCALL NUMBER_HEX_TO_ASCII MOV SBUF,A JNB TI,$ CLR TI MOV A,R1 MOV SBUF,A JNB TI,$ CLR TI MOV SBUF,@R0 JNB TI,$ CLR TI MOTOR_STEP MOV A,R2 CJNE A,MOTOR_STEPS_QTD,STEP RET ;******************************************************************************* ;******************************************************************************* ; @ROUTINE ; NUMBER_ASCII_TO_HEX ;------------------------------------------------------------------------------ ; @Description ; Converts a two digit ASCII number into one digit hexadecimal number. ;------------------------------------------------------------------------------ ; @Precondition ; R1: Must be free to be used. ;------------------------------------------------------------------------------ ; @Param ; @(R1+0): Is the pointer for the MSB two digit ASCII number to be converted. ; @(R1+1): Is the pointer for the LSB two digit ASCII number to be converted. ;------------------------------------------------------------------------------ ; @Returns ; A: Is the one digit hexadecimal number converted. ;------------------------------------------------------------------------------ NUMBER_ASCII_TO_HEX: MOV A,@R0 SUBB A,#30H SWAP A MOV R1,A INC R0 MOV A,@R0 SUBB A,#30H ORL A,R1 INC R0 RET ;******************************************************************************* ;******************************************************************************* ; @ROUTINE ; NUMBER_HEX_TO_ASCII ;------------------------------------------------------------------------------ ; @Description ; Converts an one digit hexadecimal number into two digit ASCII number. ;------------------------------------------------------------------------------ ; @Param ; A: Is the one digit hexadecimal number to be convertd. ;------------------------------------------------------------------------------ ; @Returns ; A: Is the MSB two digit ASCII number converted. ; R1: Is the LSB two digit ASCII number converted. ;------------------------------------------------------------------------------ NUMBER_HEX_TO_ASCII: MOV R1,A ANL A,#0FH ADD A,#30H XCH A,R1 SWAP A ANL A,#0FH ADD A,#30H RET ;******************************************************************************* ;******************************************************************************* ; @INTERRUPTION ; ISR_SERIAL ;------------------------------------------------------------------------------ ; @Description ; Checks whether the buffer is full or the 'A' ASCII char (enter key) was received ; via serial. If the buffer is full, do nothing. If the 'A' char was received, ; changes the F0 flag status, making the main program to check the buffer entries ; and control the stepper motor, eventually. If neither the buffer is full nor the ; A char was received, enqueues the data received on the buffer. ;------------------------------------------------------------------------------ ; @Precondition ; BUFFER_TAIL: The last BUFFER element position on the ram must be defined here ;------------------------------------------------------------------------------ ; @Param ; Void ;------------------------------------------------------------------------------ ; @Returns ; Void ;------------------------------------------------------------------------------ ISR_SERIAL: CLR RI MOV A,SBUF CJNE A,#0AH,BUFFER_FULL SETB F0 RET BUFFER_FULL: CJNE R0,#(BUFFER_TAIL+1),BUFFER_ENQUEUE RET BUFFER_ENQUEUE: MOV @R0,A INC R0 RET ;******************************************************************************* END
tests/ada/test_queue.adb
jwhitham/x86determiniser
7
3341
<reponame>jwhitham/x86determiniser with Ada . Text_IO ; with Ada . Integer_Text_IO ; with Ada . Float_Text_IO ; with Binary_Heap ; with Measure_Time ; use Ada . Text_IO ; use Ada . Integer_Text_IO ; use Ada . Float_Text_IO ; with Ada.Numerics.Discrete_Random ; procedure test_queue is arr_size : constant Natural := 100 ; package Binary_Heap_For_Naturals is new Binary_Heap ( Natural , ">" , 0 ) ; use Binary_Heap_For_Naturals ; type My_Record is record number : Natural ; data : Integer ; end record ; function RecordCompareAsNumber ( a , b : My_Record ) return Boolean is begin return ( a . number > b . number ) ; end RecordCompareAsNumber ; BlankRecord : constant My_Record := ( others => 0 ) ; package Binary_Heap_For_My_Record is new Binary_Heap ( My_Record , RecordCompareAsNumber , BlankRecord ) ; use Binary_Heap_For_My_Record ; type pqa is access Binary_Heap_For_My_Record . Priority_Queue ; procedure My_Record_Adder_WC ( rqueue : in pqa ) is rec : My_Record ; begin rec . data := 2 ; for I in reverse 1 .. arr_size loop rec . number := I ; Insert ( rec , rqueue . all ) ; end loop ; end My_Record_Adder_WC ; procedure My_Record_Deleter ( rqueue : in pqa ) is rec : My_Record ; begin for I in 1 .. arr_size loop Delete_Min ( rec , rqueue . all ) ; end loop ; end My_Record_Deleter ; package Measure_Add_Time is new Measure_Time ( pqa , My_Record_Adder_WC ) ; package Measure_Del_Time is new Measure_Time ( pqa , My_Record_Deleter ) ; nqueue : Binary_Heap_For_Naturals . Priority_Queue ( arr_size ) ; ex : Boolean ; outvar : Natural ; begin put_line ( "Testing heap properties with natural numbers" ) ; for I in 1 .. arr_size loop Insert ( I * 10 , nqueue ) ; end loop ; ex := FALSE ; begin Insert ( 1 , nqueue ) ; exception when others => ex := TRUE ; end ; if ( not ex ) then put_line ( "No exception thrown on last item added." ) ; return ; end if ; Delete_Min ( outvar , nqueue ) ; if ( Find_Min ( nqueue ) /= 20 ) then put_line ( "Agh, why isn't the minimum 20?" ) ; return ; end if ; Insert ( 10 , nqueue ) ; if ( not Is_Full ( nqueue ) ) then put_line ( "Is not full!?" ) ; return ; end if ; for I in 1 .. arr_size loop Delete_Min ( outvar , nqueue ) ; if ( outvar /= ( I * 10 )) then put_line ( "Output from queue not as expected." ) ; put ( "Got " ) ; put ( outvar , 0 ) ; put ( " but expected " ) ; put ( I * 10 , 0 ) ; new_line ; return ; end if ; end loop ; if ( not Is_Empty ( nqueue ) ) then put_line ( "Queue is not empty, why not?" ) ; return ; end if ; put_line ( "Second stage pseudo random tests." ) ; declare subtype In_Numbers is Natural range 1 .. arr_size ; package Natural_Random is new Ada.Numerics.Discrete_Random ( In_Numbers ) ; Natural_Generator : Natural_Random . Generator; numbers : array ( 1 .. arr_size ) of Natural ; numbers_present : Natural ; J , K : Natural ; begin for I in 1 .. arr_size loop numbers ( I ) := I ; end loop ; numbers_present := arr_size ; Natural_Random . Reset ( Natural_Generator , 1 ) ; for I in 1 .. 100 loop if ( Natural_Random . Random ( Natural_Generator ) < numbers_present ) then -- add J := Natural_Random . Random ( Natural_Generator ) ; while ( numbers ( J ) = 0 ) loop J := J + 1 ; if ( J > arr_size ) then J := 1 ; end if ; end loop ; numbers ( J ) := 0 ; Insert ( J , nqueue ) ; numbers_present := numbers_present - 1 ; else -- remove J := 1 ; while ( numbers ( J ) /= 0 ) loop J := J + 1 ; end loop ; Delete_Min ( K , nqueue ) ; if ( K /= J ) then put ( "Delete gave unexpected value. Was expecting " ) ; put ( J ) ; put ( " but I got " ) ; put ( K ) ; new_line ; return ; end if ; numbers ( J ) := J ; numbers_present := numbers_present + 1 ; end if ; end loop ; end ; Make_Empty ( nqueue ) ; put_line ( "Tests good, benchmarking now." ) ; declare add , del_wc , del_ac : Natural ; rec : My_Record ; rqueue : pqa ; package Natural_Random is new Ada.Numerics.Discrete_Random ( Natural ) ; Natural_Generator : Natural_Random . Generator; begin rqueue := new Binary_Heap_For_My_Record . Priority_Queue ( arr_size ) ; add := Measure_Add_Time . Time ( rqueue , 1 ) ; del_wc := Measure_Del_Time . Time ( rqueue , 1 ) ; -- Do an average case pseudo random add rec . data := 1 ; Natural_Random . Reset ( Natural_Generator , 1 ) ; for I in 1 .. arr_size loop rec . number := Natural_Random . Random ( Natural_Generator ) ; Insert ( rec , rqueue . all ) ; end loop ; del_ac := Measure_Del_Time . Time ( rqueue , 1 ) ; put ( "For " ) ; put ( arr_size , 0 ) ; put_line ( " operations" ) ; put ( "Average/worst case add time: " ) ; put ( add , 0 ) ; put_line ( " instructions" ) ; put ( "Average delete time: " ) ; put ( del_ac , 0 ) ; put_line ( " instructions" ) ; put ( "Worst case delete time: " ) ; put ( del_wc , 0 ) ; put_line ( " instructions" ) ; end ; end test_queue ;