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 |
|---|---|---|---|---|
source/oasis/program-elements-variant_parts.ads | reznikmm/gela | 0 | 27451 | <reponame>reznikmm/gela<gh_stars>0
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Definitions;
with Program.Lexical_Elements;
with Program.Elements.Identifiers;
with Program.Elements.Variants;
package Program.Elements.Variant_Parts is
pragma Pure (Program.Elements.Variant_Parts);
type Variant_Part is
limited interface and Program.Elements.Definitions.Definition;
type Variant_Part_Access is access all Variant_Part'Class
with Storage_Size => 0;
not overriding function Discriminant
(Self : Variant_Part)
return not null Program.Elements.Identifiers.Identifier_Access
is abstract;
not overriding function Variants
(Self : Variant_Part)
return not null Program.Elements.Variants.Variant_Vector_Access
is abstract;
type Variant_Part_Text is limited interface;
type Variant_Part_Text_Access is access all Variant_Part_Text'Class
with Storage_Size => 0;
not overriding function To_Variant_Part_Text
(Self : in out Variant_Part)
return Variant_Part_Text_Access is abstract;
not overriding function Case_Token
(Self : Variant_Part_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Is_Token
(Self : Variant_Part_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function End_Token
(Self : Variant_Part_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Case_Token_2
(Self : Variant_Part_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Semicolon_Token
(Self : Variant_Part_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Variant_Parts;
|
tests/lua_examples/lua_sin_table.asm | fengjixuchui/sjasmplus | 220 | 164373 |
; Sinus table generator - using lua script, because sjasmplus itself does not have
; floating point arithmetics and sin/cos/... functions.
org $8000
sin_table: ; check listing file to see resulting table bytes
lua allpass ; EVERY pass must emit the machine code to not affect following labels
-- 256 bytes (index 0..255):
for i = 0, 255, 1 do
-- index 0..255 will cover angle range < 0, 2Pi )
-- i.e. going in sinus values 0 -> +1 -> 0 -> -1 -> 0
-- For different range, the /128.0 must be modified:
-- /256.0 is 0..Pi, /512.0 is 0..Pi/2, etc
-- The *15.5 is amplitude of final values
-- to be -15 .. +15 (+0.5 for "floor" compensation)
-- in this example values are signed byte (-15 == 241 == 0xF1)
sj.add_byte(math.floor(math.sin(math.pi * i / 128.0) * 15.5))
end
endlua
jr start
start:
|
termx_terminal.scpt | afterdesign/MacTerminal | 45 | 2002 | <filename>termx_terminal.scpt<gh_stars>10-100
on run argv
if count of argv is 1 then
set folderName to item 1 of argv
end if
if folderName is missing value then
return
end if
tell application "Terminal"
if not frontmost then
activate
delay (1)
end if
tell application "System Events"
keystroke "t" using command down
end tell
set commandToRun to "cd " & (folderName as string)
set current_tab to selected tab of first window whose frontmost is true
do script commandToRun in current_tab
do script "clear" in current_tab
end tell
end run
|
programs/oeis/130/A130496.asm | neoneye/loda | 22 | 173771 | ; A130496: Repetition of even numbers, with initial zeros, five times.
; 0,0,0,0,0,2,2,2,2,2,4,4,4,4,4,6,6,6,6,6,8,8,8,8,8,10,10,10,10,10,12,12,12,12,12,14,14,14,14,14,16,16,16,16,16,18,18,18,18,18,20,20,20,20,20,22,22,22,22,22,24,24,24,24,24,26,26,26,26,26,28,28,28,28,28,30,30,30
div $0,5
mul $0,2
|
libsrc/graphics/generic_console/respixl6.asm | jpoikela/z88dk | 0 | 18079 | ;
; Generic pseudo graphics routines for text-only platforms
;
; Reset pixel at (x,y) coordinate.
SECTION code_clib
PUBLIC respixel
.respixel
defc NEEDunplot = 1
INCLUDE "pixel6.asm"
|
src/higher/circle.agda | pcapriotti/agda-base | 20 | 12942 | {-# OPTIONS --without-K #-}
module higher.circle where
open import higher.circle.core public
open import higher.circle.properties public
|
cc4x86/tests/regressive/asm_listings/while__optimize_noregalloc.asm | artyompal/C-compiler | 4 | 167151 | <reponame>artyompal/C-compiler<gh_stars>1-10
.686
.model flat
.xmm
.code
_test proc
create_stack_frame
mov dword24,0
label0000:
mov dword4,dword24
inc dword24
cmp dword4,10
jge label0001
jmp label0000
label0001:
cmp dword24,11
je label0002
mov dword8,1
set_retval dword8
destroy_stack_frame
ret
label0002:
mov dword25,1
mov dword26,0
label0003:
mov dword15,dword25
sal dword15,1
mov dword25,dword15
inc dword26
cmp dword25,65536
jl label0003
cmp dword26,16
je label0006
mov dword21,2
set_retval dword21
destroy_stack_frame
ret
label0006:
mov dword22,0
set_retval dword22
destroy_stack_frame
ret
_test endp
end
|
bb-runtimes/src/a-intnam__leon.ads | JCGobbi/Nucleo-STM32G474RE | 0 | 657 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- A D A . I N T E R R U P T S . N A M E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1991-2017, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This is the version for LEON targets of this package
with System;
package Ada.Interrupts.Names is
-- All identifiers in this unit are implementation defined
pragma Implementation_Defined;
-------------------------
-- External Interrupts --
-------------------------
External_Interrupt_3 : constant Interrupt_ID := 7;
External_Interrupt_3_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 6;
External_Interrupt_2 : constant Interrupt_ID := 6;
External_Interrupt_2_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 5;
External_Interrupt_1 : constant Interrupt_ID := 5;
External_Interrupt_1_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 4;
External_Interrupt_0 : constant Interrupt_ID := 4;
External_Interrupt_0_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 3;
----------------------
-- Timer Interrupts --
----------------------
Real_Time_Clock : constant Interrupt_ID := 9;
Real_Time_Clock_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 8;
General_Purpose_Timer : constant Interrupt_ID := 8;
General_Purpose_Timer_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 7;
---------------------
-- UART Interrupts --
---------------------
UART_1_RX_TX : constant Interrupt_ID := 3;
UART_1_RX_TX_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 2;
UART_2_RX_TX : constant Interrupt_ID := 2;
UART_2_RX_TX_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 1;
-----------------------
-- Unused Interrupts --
-----------------------
Unused_Interrupt_10 : constant Interrupt_ID := 10;
Unused_Interrupt_10_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 9;
Unused_Interrupt_12 : constant Interrupt_ID := 12;
Unused_Interrupt_12_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 11;
Unused_Interrupt_13 : constant Interrupt_ID := 13;
Unused_Interrupt_13_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 12;
-----------------------------
-- Miscelaneous Interrupts --
-----------------------------
Internal_Bus_Error : constant Interrupt_ID := 1;
Internal_Bus_Error_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First;
DSU : constant Interrupt_ID := 11;
DSU_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 10;
PCI : constant Interrupt_ID := 14;
PCI_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 13;
EDAC_Interrupt : constant Interrupt_ID := 15;
EDAC_Priority : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 14;
end Ada.Interrupts.Names;
|
internal/mini-quine.agda | JasonGross/lob | 19 | 5797 | <gh_stars>10-100
{-# OPTIONS --without-K #-}
module mini-quine where
open import common
infixl 2 _▻_
infixl 3 _‘’_
infixr 1 _‘→’_
infixl 3 _‘’ₐ_
infixl 3 _w‘‘’’ₐ_
infixr 2 _‘∘’_
mutual
data Context : Set where
ε : Context
_▻_ : (Γ : Context) → Type Γ → Context
data Type : Context → Set where
W : ∀ {Γ A} → Type Γ → Type (Γ ▻ A)
W1 : ∀ {Γ A B} → Type (Γ ▻ B) → Type (Γ ▻ A ▻ (W {Γ = Γ} {A = A} B))
_‘’_ : ∀ {Γ A} → Type (Γ ▻ A) → Term {Γ} A → Type Γ
‘Typeε’ : ∀ {Γ} → Type Γ
‘□’ : ∀ {Γ} → Type (Γ ▻ ‘Typeε’)
_‘→’_ : ∀ {Γ} → Type Γ → Type Γ → Type Γ
Quine : Type (ε ▻ ‘Typeε’) → Type ε
‘⊤’ : ∀ {Γ} → Type Γ
‘⊥’ : ∀ {Γ} → Type Γ
data Term : {Γ : Context} → Type Γ → Set where
⌜_⌝ : ∀ {Γ} → Type ε → Term {Γ} ‘Typeε’
⌜_⌝t : ∀ {Γ T} → Term {ε} T → Term {Γ} (‘□’ ‘’ ⌜ T ⌝)
‘⌜‘VAR₀’⌝t’ : ∀ {T} → Term {ε ▻ ‘□’ ‘’ ⌜ T ⌝} (W (‘□’ ‘’ ⌜ ‘□’ ‘’ ⌜ T ⌝ ⌝))
‘λ∙’ : ∀ {Γ A B} → Term {Γ ▻ A} (W B) → Term {Γ} (A ‘→’ B)
‘VAR₀’ : ∀ {Γ T} → Term {Γ ▻ T} (W T)
_‘’ₐ_ : ∀ {Γ A B} → Term {Γ} (A ‘→’ B) → Term {Γ} A → Term {Γ} B
quine→ : ∀ {φ} → Term {ε} (Quine φ ‘→’ φ ‘’ ⌜ Quine φ ⌝)
quine← : ∀ {φ} → Term {ε} (φ ‘’ ⌜ Quine φ ⌝ ‘→’ Quine φ)
‘tt’ : ∀ {Γ} → Term {Γ} ‘⊤’
→SW1SV→W : ∀ {Γ T X A B} {x : Term X}
→ Term {Γ} (T ‘→’ (W1 A ‘’ ‘VAR₀’ ‘→’ W B) ‘’ x)
→ Term {Γ} (T ‘→’ A ‘’ x ‘→’ B)
←SW1SV→W : ∀ {Γ T X A B} {x : Term X}
→ Term {Γ} ((W1 A ‘’ ‘VAR₀’ ‘→’ W B) ‘’ x ‘→’ T)
→ Term {Γ} ((A ‘’ x ‘→’ B) ‘→’ T)
w : ∀ {Γ A T} → Term {Γ} A → Term {Γ ▻ T} (W A)
w→ : ∀ {Γ A B X} → Term {Γ} (A ‘→’ B) → Term {Γ ▻ X} (W A ‘→’ W B)
_‘∘’_ : ∀ {Γ A B C} → Term {Γ} (B ‘→’ C) → Term {Γ} (A ‘→’ B) → Term {Γ} (A ‘→’ C)
_w‘‘’’ₐ_ : ∀ {A B T} → Term {ε ▻ T} (W (‘□’ ‘’ ⌜ A ‘→’ B ⌝)) → Term {ε ▻ T} (W (‘□’ ‘’ ⌜ A ⌝)) → Term {ε ▻ T} (W (‘□’ ‘’ ⌜ B ⌝))
□ : Type ε → Set _
□ = Term {ε}
max-level : Level
max-level = lzero
mutual
Context⇓ : (Γ : Context) → Set (lsuc max-level)
Context⇓ ε = ⊤
Context⇓ (Γ ▻ T) = Σ (Context⇓ Γ) (Type⇓ {Γ} T)
Type⇓ : {Γ : Context} → Type Γ → Context⇓ Γ → Set max-level
Type⇓ (W T) Γ⇓ = Type⇓ T (Σ.proj₁ Γ⇓)
Type⇓ (W1 T) Γ⇓ = Type⇓ T ((Σ.proj₁ (Σ.proj₁ Γ⇓)) , (Σ.proj₂ Γ⇓))
Type⇓ (T ‘’ x) Γ⇓ = Type⇓ T (Γ⇓ , Term⇓ x Γ⇓)
Type⇓ ‘Typeε’ Γ⇓ = Lifted (Type ε)
Type⇓ ‘□’ Γ⇓ = Lifted (Term {ε} (lower (Σ.proj₂ Γ⇓)))
Type⇓ (A ‘→’ B) Γ⇓ = Type⇓ A Γ⇓ → Type⇓ B Γ⇓
Type⇓ ‘⊤’ Γ⇓ = ⊤
Type⇓ ‘⊥’ Γ⇓ = ⊥
Type⇓ (Quine φ) Γ⇓ = Type⇓ φ (Γ⇓ , (lift (Quine φ)))
Term⇓ : ∀ {Γ : Context} {T : Type Γ} → Term T → (Γ⇓ : Context⇓ Γ) → Type⇓ T Γ⇓
Term⇓ ⌜ x ⌝ Γ⇓ = lift x
Term⇓ ⌜ x ⌝t Γ⇓ = lift x
Term⇓ ‘⌜‘VAR₀’⌝t’ Γ⇓ = lift ⌜ (lower (Σ.proj₂ Γ⇓)) ⌝t
Term⇓ (f ‘’ₐ x) Γ⇓ = Term⇓ f Γ⇓ (Term⇓ x Γ⇓)
Term⇓ ‘tt’ Γ⇓ = tt
Term⇓ (quine→ {φ}) Γ⇓ x = x
Term⇓ (quine← {φ}) Γ⇓ x = x
Term⇓ (‘λ∙’ f) Γ⇓ x = Term⇓ f (Γ⇓ , x)
Term⇓ ‘VAR₀’ Γ⇓ = Σ.proj₂ Γ⇓
Term⇓ (←SW1SV→W f) = Term⇓ f
Term⇓ (→SW1SV→W f) = Term⇓ f
Term⇓ (w x) Γ⇓ = Term⇓ x (Σ.proj₁ Γ⇓)
Term⇓ (w→ f) Γ⇓ = Term⇓ f (Σ.proj₁ Γ⇓)
Term⇓ (g ‘∘’ f) Γ⇓ x = Term⇓ g Γ⇓ (Term⇓ f Γ⇓ x)
Term⇓ (f w‘‘’’ₐ x) Γ⇓ = lift (lower (Term⇓ f Γ⇓) ‘’ₐ lower (Term⇓ x Γ⇓))
module inner (‘X’ : Type ε) (‘f’ : Term {ε} (‘□’ ‘’ ⌜ ‘X’ ⌝ ‘→’ ‘X’)) where
‘H’ : Type ε
‘H’ = Quine (W1 ‘□’ ‘’ ‘VAR₀’ ‘→’ W ‘X’)
‘toH’ : □ ((‘□’ ‘’ ⌜ ‘H’ ⌝ ‘→’ ‘X’) ‘→’ ‘H’)
‘toH’ = ←SW1SV→W quine←
‘fromH’ : □ (‘H’ ‘→’ (‘□’ ‘’ ⌜ ‘H’ ⌝ ‘→’ ‘X’))
‘fromH’ = →SW1SV→W quine→
‘□‘H’→□‘X’’ : □ (‘□’ ‘’ ⌜ ‘H’ ⌝ ‘→’ ‘□’ ‘’ ⌜ ‘X’ ⌝)
‘□‘H’→□‘X’’ = ‘λ∙’ (w ⌜ ‘fromH’ ⌝t w‘‘’’ₐ ‘VAR₀’ w‘‘’’ₐ ‘⌜‘VAR₀’⌝t’)
‘h’ : Term ‘H’
‘h’ = ‘toH’ ‘’ₐ (‘f’ ‘∘’ ‘□‘H’→□‘X’’)
Lӧb : □ ‘X’
Lӧb = ‘fromH’ ‘’ₐ ‘h’ ‘’ₐ ⌜ ‘h’ ⌝t
Lӧb : ∀ {X} → Term {ε} (‘□’ ‘’ ⌜ X ⌝ ‘→’ X) → Term {ε} X
Lӧb {X} f = inner.Lӧb X f
⌞_⌟ : Type ε → Set _
⌞ T ⌟ = Type⇓ T tt
‘¬’_ : ∀ {Γ} → Type Γ → Type Γ
‘¬’ T = T ‘→’ ‘⊥’
lӧb : ∀ {‘X’} → □ (‘□’ ‘’ ⌜ ‘X’ ⌝ ‘→’ ‘X’) → ⌞ ‘X’ ⌟
lӧb f = Term⇓ (Lӧb f) tt
incompleteness : ¬ □ (‘¬’ (‘□’ ‘’ ⌜ ‘⊥’ ⌝))
incompleteness = lӧb
soundness : ¬ □ ‘⊥’
soundness x = Term⇓ x tt
non-emptyness : Σ (Type ε) (λ T → □ T)
non-emptyness = ‘⊤’ , ‘tt’
|
1-base/math/source/precision/float/pure/float_math-analysis.ads | charlie5/lace | 20 | 13843 | <reponame>charlie5/lace<gh_stars>10-100
with
any_Math.any_Analysis;
package float_Math.Analysis is new float_Math.any_Analysis;
pragma Pure (float_Math.Analysis);
|
src/syscalls/ewok-syscalls-alarm.adb | mfkiwl/ewok-kernel-security-OS | 65 | 12217 | <reponame>mfkiwl/ewok-kernel-security-OS
--
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks; use ewok.tasks;
with ewok.tasks_shared; use ewok.tasks_shared;
with ewok.sanitize;
with ewok.debug;
with ewok.alarm;
package body ewok.syscalls.alarm
with spark_mode => off
is
procedure svc_alarm
(caller_id : in ewok.tasks_shared.t_task_id;
params : in t_parameters;
mode : in ewok.tasks_shared.t_task_mode)
is
alarm_time : unsigned_32 with address => params(1)'address;
handler : constant system_address := params(2);
begin
if alarm_time = 0 or handler = 0 then
ewok.alarm.unset_alarm (caller_id);
goto ret_ok;
end if;
if not ewok.sanitize.is_word_in_txt_region (handler, caller_id)
then
pragma DEBUG (debug.log (debug.ERROR, "Handler not in .txt section"));
goto ret_denied;
end if;
ewok.alarm.set_alarm
(caller_id, milliseconds (alarm_time), handler);
<<ret_ok>>
set_return_value (caller_id, mode, SYS_E_DONE);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_denied>>
set_return_value (caller_id, mode, SYS_E_DENIED);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end svc_alarm;
end ewok.syscalls.alarm;
|
org.sourcepit.antlr4.eclipse.lang.tests/JavadocLexer.g4 | berndv/antlr4-eclipse | 0 | 7192 | lexer grammar JavadocLexer;
@header {
/**
* Copyright 2015 <NAME> and others.
*
* 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 org.sourcepit.antlr4.eclipse.lang.tests.javadoc;
}
options {
superClass=org.sourcepit.antlr4.eclipse.lang.tests.javadoc.AbstractJavadocLexer;
}
JavadocStart
: '/**' '*'* Ws* -> pushMode(JAVADOC)
;
Id
: NameStartChar NameChar*
;
fragment NameChar
: NameStartChar
| '0'..'9'
| '_'
| '\u00B7'
| '\u0300'..'\u036F'
| '\u203F'..'\u2040'
;
fragment NameStartChar
: 'A'..'Z'
| 'a'..'z'
| '\u00C0'..'\u00D6'
| '\u00D8'..'\u00F6'
| '\u00F8'..'\u02FF'
| '\u0370'..'\u037D'
| '\u037F'..'\u1FFF'
| '\u200C'..'\u200D'
| '\u2070'..'\u218F'
| '\u2C00'..'\u2FEF'
| '\u3001'..'\uD7FF'
| '\uF900'..'\uFDCF'
| '\uFDF0'..'\uFFFD'
; // ignores | ['\u10000-'\uEFFFF] ;
fragment
CommonNl
: ('\r\n' | '\n' | '\r')
;
fragment
CommonWs
: [ \t\f]+
;
Nl : CommonNl -> channel(HIDDEN)
;
Ws : CommonWs -> channel(HIDDEN)
;
mode JAVADOC;
fragment
CommonJavadocLinePrefix
: {isChar(LA(-1), '\n', '\r')}? JavadocWs* '*'+ {isNotChar(LA(1), '/')}? JavadocWs*
;
JavadocLinePrefix
: CommonJavadocLinePrefix -> channel(/*JAVA_DOC_LINE_PREFIX*/ 2)
;
JavadocEnd
: JavadocWs* '*'* '*/' -> popMode
;
JavadocInlineTagOpen
: '{@' Id -> pushMode(JAVADOC_INLINE_TAG)
;
JavadocBlockTag
: {allowBlockTag}? '@' Id
;
JavadocNl
: CommonNl -> type(Nl), channel(HIDDEN)
;
JavadocWs
: CommonWs -> type(Ws), channel(HIDDEN)
;
TagSlashOpen
: '</' {isTagStart(LA(1))}? -> pushMode(TAG)
;
TagOpen
: '<' {isTagStart(LA(1))}? -> pushMode(TAG)
;
JavadocText
: .+? // Note: Will be tokenized into single chars, but we'll aggregate them to a single token in our abstract lexer
;
mode JAVADOC_INLINE_TAG;
JavadocInlineTagClose
: '}' -> popMode
;
JavadocInlineTagPrefix
: CommonJavadocLinePrefix -> type(JavadocLinePrefix), channel(/*JAVA_DOC_LINE_PREFIX*/ 2)
;
JavadocInlineTagNl
: CommonNl -> type(Nl), channel(HIDDEN)
;
JavadocInlineTagWs
: CommonWs -> type(Ws), channel(HIDDEN)
;
JavadocInlineTagText
: ~[ \r\n\t\f}]+
;
mode TAG;
TagSlashClose
: '/>' -> popMode
;
TagClose
: '>' -> popMode
;
TagJavadocLinePrefix
: CommonJavadocLinePrefix -> type(JavadocLinePrefix), channel(/*JAVA_DOC_LINE_PREFIX*/ 2)
;
TagEquals
: '=' -> pushMode(ATTVALUE)
;
TagNl
: CommonNl -> type(Nl), channel(HIDDEN)
;
TagWs
: CommonWs -> type(Ws), channel(HIDDEN)
;
fragment
TagNameChar
: 'A'..'Z'
| 'a'..'z'
| '0'..'9'
| '-'
| '_'
| ':'
| '.'
;
fragment
TagNameStartChar
: 'A'..'Z'
| 'a'..'z'
;
TagName
: TagNameStartChar TagNameChar*
;
mode ATTVALUE;
AttributeJavadocLinePrefix
: CommonJavadocLinePrefix -> type(JavadocLinePrefix), channel(/*JAVA_DOC_LINE_PREFIX*/ 2)
;
fragment
AttributeChar
: '-'
| '_'
| '.'
| '/'
| '+'
| ','
| '?'
| '='
| ':'
| ';'
| '#'
| [0-9a-zA-Z]
;
AttributeChars
: AttributeChar+ -> popMode
;
AttributeHexChars
: '#' [0-9a-fA-F]+ -> popMode
;
AttributeDecChars
: [0-9]+ '%'? -> popMode
;
AttributeDoubleQuoteString
: '"' .*? '"' -> popMode
;
AttributeSingleQuoteString
: '\'' .*? '\'' -> popMode
;
AttributeNl
: CommonNl -> type(Nl), channel(HIDDEN)
;
AttributeWs
: CommonWs -> type(Ws), channel(HIDDEN)
; |
reverse_engineering/grammars/Protobuf3.g4 | Vitalii4as/Protobuf | 0 | 6036 | <reponame>Vitalii4as/Protobuf<filename>reverse_engineering/grammars/Protobuf3.g4
grammar Protobuf3;
proto
: (LINE_COMMENT | COMMENT)* syntax
(
importStatement
| packageStatement
| optionStatement
| topLevelDef
| emptyStatement
| COMMENT
| LINE_COMMENT
)*
;
// Syntax
syntax
: SYNTAX EQ version=(PROTO3_LIT_SINGLE | PROTO3_LIT_DOBULE | PROTO2_LIT_SINGLE | PROTO2_LIT_DOBULE) SEMI
;
// Import Statement
importStatement
: IMPORT accessModifier=( WEAK | PUBLIC )? strLit SEMI
;
// Package
packageStatement
: PACKAGE fullIdent SEMI
;
// Option
optionStatement
: OPTION optionName EQ constant SEMI
;
optionName
: fullIdent
| LP fullIdent RP ( DOT fullIdent )?
;
// Normal Field
field
: repetition=( REPEATED | OPTIONAL | REQUIRED )? type_ fieldName EQ fieldNumber ( LB fieldOptions RB )? SEMI LINE_COMMENT?
;
fieldOptions
: fieldOption ( COMMA fieldOption )*
;
fieldOption
: optionName EQ constant
;
fieldNumber
: intLit
;
// Extensions
extensions
: EXTENSIONS range_ SEMI
;
// Oneof and oneof field
oneof
: ONEOF oneofName LC ( optionStatement | oneofField | emptyStatement )* RC
;
oneofField
: type_ fieldName EQ fieldNumber ( LB fieldOptions RB )? SEMI LINE_COMMENT?
;
// Map field
mapField
: MAP LT keyType COMMA type_ GT mapName
EQ fieldNumber ( LB fieldOptions RB )? SEMI
;
keyType
: INT32
| INT64
| UINT32
| UINT64
| SINT32
| SINT64
| FIXED32
| FIXED64
| SFIXED32
| SFIXED64
| BOOL
| STRING
;
// field types
type_
: DOUBLE
| FLOAT
| INT32
| INT64
| UINT32
| UINT64
| SINT32
| SINT64
| FIXED32
| FIXED64
| SFIXED32
| SFIXED64
| BOOL
| STRING
| BYTES
| messageType
| enumType
;
// Reserved
reserved
: RESERVED ( ranges | reservedFieldNames ) SEMI
;
ranges
: range_ ( COMMA range_ )*
;
range_
: intLit ( TO ( intLit | MAX ) )?
;
reservedFieldNames
: strLit ( COMMA strLit )*
;
// Top Level definitions
topLevelDef
: messageDef
| enumDef
| serviceDef
| COMMENT
| LINE_COMMENT
;
// enum
enumDef
: (COMMENT | lineComment+)? ENUM enumName enumBody
;
enumBody
: LC enumElement* RC
;
enumElement
: optionStatement
| enumField
| emptyStatement
| COMMENT
| LINE_COMMENT
;
enumField
: ident EQ ( MINUS )? intLit enumValueOptions?SEMI
;
enumValueOptions
: LB enumValueOption ( COMMA enumValueOption )* RB
;
enumValueOption
: optionName EQ constant
;
// message
messageDef
: (COMMENT | lineComment+)? MESSAGE messageName messageBody
;
messageBody
: LC messageElement* RC
;
messageElement
: field
| enumDef
| messageDef
| optionStatement
| oneof
| mapField
| reserved
| emptyStatement
| extensions
| COMMENT
| LINE_COMMENT
;
// service
serviceDef
: SERVICE serviceName LC serviceElement* RC
;
serviceElement
: optionStatement
| rpc
| emptyStatement
| COMMENT
| LINE_COMMENT
;
rpc
: RPC rpcName LP ( STREAM )? messageType RP
RETURNS LP ( STREAM )? messageType RP
(LC ( optionStatement | emptyStatement )* RC | SEMI)
;
// lexical
constant
: fullIdent
| (MINUS | PLUS )? intLit
| ( MINUS | PLUS )? floatLit
| strLit
| boolLit
| blockLit
;
// not specified in specification but used in tests
blockLit
: LC ( ident COLON constant )* RC
;
emptyStatement: SEMI;
// Lexical elements
ident: IDENTIFIER | keywords;
fullIdent: ident ( DOT ident )*;
messageName: ident;
enumName: ident;
fieldName: ident;
oneofName: ident;
mapName: ident;
serviceName: ident;
rpcName: ident;
messageType: ( DOT )? ( ident DOT )* messageName;
enumType: ( DOT )? ( ident DOT )* enumName;
intLit: INT_LIT;
strLit: STR_LIT | PROTO3_LIT_SINGLE | PROTO3_LIT_DOBULE| PROTO2_LIT_SINGLE | PROTO2_LIT_DOBULE;
boolLit: BOOL_LIT;
floatLit: FLOAT_LIT;
lineComment: LINE_COMMENT;
// keywords
SYNTAX: 'syntax';
IMPORT: 'import';
WEAK: 'weak';
PUBLIC: 'public';
PACKAGE: 'package';
OPTION: 'option';
OPTIONAL: 'optional';
REQUIRED: 'required';
REPEATED: 'repeated';
EXTENSIONS: 'extensions';
ONEOF: 'oneof';
MAP: 'map';
INT32: 'int32';
INT64: 'int64';
UINT32: 'uint32';
UINT64: 'uint64';
SINT32: 'sint32';
SINT64: 'sint64';
FIXED32: 'fixed32';
FIXED64: 'fixed64';
SFIXED32: 'sfixed32';
SFIXED64: 'sfixed64';
BOOL: 'bool';
STRING: 'string';
DOUBLE: 'double';
FLOAT: 'float';
BYTES: 'bytes';
RESERVED: 'reserved';
TO: 'to';
MAX: 'max';
ENUM: 'enum';
MESSAGE: 'message';
SERVICE: 'service';
RPC: 'rpc';
STREAM: 'stream';
RETURNS: 'returns';
PROTO3_LIT_SINGLE: '"proto3"';
PROTO3_LIT_DOBULE: '\'proto3\'';
PROTO2_LIT_SINGLE: '"proto2"';
PROTO2_LIT_DOBULE: '\'proto2\'';
// symbols
SEMI: ';';
EQ: '=';
LP: '(';
RP: ')';
LB: '[';
RB: ']';
LC: '{';
RC: '}';
LT: '<';
GT: '>';
DOT: '.';
COMMA: ',';
COLON: ':';
PLUS: '+';
MINUS: '-';
STR_LIT: ( '\'' ( CHAR_VALUE )*? '\'' ) | ( '"' ( CHAR_VALUE )*? '"' );
fragment CHAR_VALUE: HEX_ESCAPE | OCT_ESCAPE | CHAR_ESCAPE | ~[\u0000\n\\];
fragment HEX_ESCAPE: '\\' ( 'x' | 'X' ) HEX_DIGIT HEX_DIGIT;
fragment OCT_ESCAPE: '\\' OCTAL_DIGIT OCTAL_DIGIT OCTAL_DIGIT;
fragment CHAR_ESCAPE: '\\' ( 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\\' | '\'' | '"' );
BOOL_LIT: 'true' | 'false';
FLOAT_LIT : ( DECIMALS DOT DECIMALS? EXPONENT? | DECIMALS EXPONENT | DOT DECIMALS EXPONENT? ) | 'inf' | 'nan';
fragment EXPONENT : ( 'e' | 'E' ) (PLUS | MINUS)? DECIMALS;
fragment DECIMALS : DECIMAL_DIGIT+;
INT_LIT : DECIMAL_LIT | OCTAL_LIT | HEX_LIT;
fragment DECIMAL_LIT : ( [1-9] ) DECIMAL_DIGIT*;
fragment OCTAL_LIT : '0' OCTAL_DIGIT*;
fragment HEX_LIT : '0' ( 'x' | 'X' ) HEX_DIGIT+ ;
IDENTIFIER: LETTER ( LETTER | DECIMAL_DIGIT )*;
fragment LETTER: [A-Za-z_];
fragment DECIMAL_DIGIT: [0-9];
fragment OCTAL_DIGIT: [0-7];
fragment HEX_DIGIT: [0-9A-Fa-f];
// comments
WS : [ \t\r\n\u000C]+ -> skip;
COMMENT: '/*' .*? '*/';
LINE_COMMENT: '//' ~[\r\n]*;
keywords
: SYNTAX
| IMPORT
| WEAK
| PUBLIC
| PACKAGE
| OPTION
| OPTIONAL
| REQUIRED
| REPEATED
| EXTENSIONS
| ONEOF
| MAP
| INT32
| INT64
| UINT32
| UINT64
| SINT32
| SINT64
| FIXED32
| FIXED64
| SFIXED32
| SFIXED64
| BOOL
| STRING
| DOUBLE
| FLOAT
| BYTES
| RESERVED
| TO
| MAX
| ENUM
| MESSAGE
| SERVICE
| RPC
| STREAM
| RETURNS
| BOOL_LIT
; |
programs/oeis/096/A096943.asm | neoneye/loda | 22 | 29897 | <reponame>neoneye/loda<filename>programs/oeis/096/A096943.asm
; A096943: Sixth column of (1,5)-Pascal triangle A096940.
; 5,26,81,196,406,756,1302,2112,3267,4862,7007,9828,13468,18088,23868,31008,39729,50274,62909,77924,95634,116380,140530,168480,200655,237510,279531,327236,381176,441936,510136,586432,671517,766122,871017,987012
mov $1,$0
add $0,4
bin $0,$1
add $1,25
mul $0,$1
div $0,5
|
sys/boot/setlen.asm | olifink/smsqe | 0 | 28495 | <reponame>olifink/smsqe
; Set the length of a concatenated boot file
;
section main
xdef boot_setlen
;+++
; This processes the length table at the start of a concatenated boot file,
; finding the true length and adding this to all required addresses.
;
; d2 c u length of adjusted concatenated file
; a1 c u ptr concatenated file (length of 1st file / start of 1st file)
;
; status return zero
;
;---
boot_setlen
addq.l #8,a1 ; skip length and checksum of first file
subq.l #8,d2 ; the length needs to be adjusted too
cmp.w #$fafa,(a1) ; flagged?
bne.s bs_rts ; ... no
subq.l #4,d2 ; the length needs further adjustment
addq.l #2,a1 ; skip flag
move.w (a1)+,d0 ; number of addresses to blat
beq.s bs_rts
move.l a3,-(sp)
lsl.l #2,d0 ; size of address table
sub.l d0,d2 ; corrected
bs_loop
move.l a1,a3
add.l (a1)+,a3 ; address to blat
add.l d2,(a3)
subq.l #4,d0 ; another
bgt.s bs_loop
move.l (sp)+,a3
bs_rts
moveq #0,d0
rts
end
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2.log_21829_499.asm | ljhsiun2/medusa | 9 | 82390 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r13
push %r14
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x4bd6, %r12
nop
nop
nop
nop
nop
and %rsi, %rsi
mov (%r12), %cx
nop
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_A_ht+0x27b6, %rsi
lea addresses_UC_ht+0x86ae, %rdi
nop
nop
nop
nop
nop
and %r11, %r11
mov $8, %rcx
rep movsl
xor $60672, %rsi
lea addresses_normal_ht+0x5ace, %rsi
lea addresses_normal_ht+0x5cce, %rdi
nop
nop
nop
nop
nop
xor $22781, %r13
mov $32, %rcx
rep movsl
nop
add %rsi, %rsi
lea addresses_WC_ht+0x1d4e, %r12
sub $13692, %rcx
mov (%r12), %r11d
nop
nop
nop
nop
add %r13, %r13
lea addresses_WC_ht+0x1a574, %rsi
lea addresses_UC_ht+0x1094e, %rdi
nop
nop
nop
nop
nop
add $10791, %r14
mov $31, %rcx
rep movsw
nop
nop
nop
nop
xor $35837, %r12
lea addresses_D_ht+0xc54e, %rsi
lea addresses_D_ht+0x1bcee, %rdi
nop
nop
nop
and $11131, %r10
mov $42, %rcx
rep movsl
nop
nop
nop
nop
sub $55598, %rsi
lea addresses_D_ht+0x11e4e, %r10
and %rsi, %rsi
movb (%r10), %r13b
nop
xor $6966, %r13
lea addresses_WC_ht+0x1814e, %r10
nop
sub $54202, %rsi
movw $0x6162, (%r10)
nop
nop
nop
sub $2762, %r14
lea addresses_normal_ht+0x1d84e, %rsi
lea addresses_A_ht+0x1cc5a, %rdi
nop
and $41413, %r13
mov $35, %rcx
rep movsq
nop
nop
nop
nop
cmp $8163, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %r14
pop %r13
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r15
push %r8
push %r9
push %rbp
push %rcx
// Store
lea addresses_UC+0xdb4e, %rcx
nop
nop
nop
cmp $57278, %r9
mov $0x5152535455565758, %r15
movq %r15, %xmm7
vmovups %ymm7, (%rcx)
nop
nop
and $55384, %rcx
// Faulty Load
lea addresses_WC+0x1794e, %rbp
nop
nop
nop
nop
xor %r14, %r14
mov (%rbp), %ecx
lea oracles, %r15
and $0xff, %rcx
shlq $12, %rcx
mov (%r15,%rcx,1), %rcx
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}}
{'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
*/
|
src/cst_parser/CstParser.g4 | jaksicstefan/repo_symaut | 1 | 5370 | <filename>src/cst_parser/CstParser.g4
parser grammar CstParser ;
@header {
package cst_gen;
}
options {
tokenVocab = CstLexer ;
}
// -- O -- O -- O -- O -- O -- O -- O -- O -- O -- O -- O -- O -- O expression
cst:
expression EOF #CstExpr; //
expression
: primary #ExprPrimary
| NotOperator expression #ExprNotUnaryExpr //
| NotOperator identifier #ExprNotUnaryId //
| identifier ( comparisonOp | equalityCmpOp) identifier #IdCompId //
| identifier ( comparisonOp | equalityCmpOp) integerLiteral #IdCompInt0 //
| integerLiteral ( comparisonOp | equalityCmpOp) identifier #IdCompInt1 //
| integerLiteral ( comparisonOp | equalityCmpOp) integerLiteral #IdCompInt2 //
| expression equalityCmpOp expression #ExprEqualExpr //
| expression AndOperator expression #ExprAnd //
| expression OrOperator expression #ExprOr; //
equalityCmpOp
: EqualOperator #EqOp //
| NotEqualOperator #NeqOp ;//
comparisonOp
: LesserOrEqualOperator #CmpOpLs //
| GreaterOrEqualOperator #CmpOpGte //
| LesserOperator #CmpOpLse //
| GreaterOperator #CmpOpGt ;//
primary
: LPAREN expression RPAREN #PrimaryParenthesis //THIS IS NOT COVERED IN VISITOR
| booleanLiteral #PrimaryLiteralBool //
| identifier #PrimaryId ; //
booleanLiteral
: LPAREN BooleanLiteral RPAREN #LiteralBoolParen//
| BooleanLiteral #LiteralBool ;//
integerLiteral
: LPAREN IntegerLiteral RPAREN #LiteralIntParen //
| IntegerLiteral #LiteralInt ; //
identifier
: Identifier #Id ; //
|
src/algebra/monoid/mset.agda | pcapriotti/agda-base | 20 | 13509 | <reponame>pcapriotti/agda-base<gh_stars>10-100
{-# OPTIONS --without-K #-}
module algebra.monoid.mset where
open import level
open import algebra.monoid.core
open import algebra.monoid.morphism
open import algebra.semigroup
open import equality.core
open import hott.level
module _ {i}(M : Set i) ⦃ mM : IsMonoid M ⦄ where
open IsMonoid ⦃ ... ⦄
record IsMSet {j} (X : Set j) : Set (i ⊔ j) where
constructor mk-is-mset
field
_◂_ : M → X → X
◂-hom : (m₁ m₂ : M)(x : X) → (m₁ * m₂) ◂ x ≡ m₁ ◂ (m₂ ◂ x)
◂-id : (x : X) → e ◂ x ≡ x
mset-level : h 2 X
open IsMSet ⦃ ... ⦄
module _ {j k}
{X : Set j} ⦃ xM : IsMSet X ⦄
{Y : Set k} ⦃ yM : IsMSet Y ⦄ where
IsMSetMorphism : (X → Y) → Set (i ⊔ j ⊔ k)
IsMSetMorphism f = (m : M)(x : X) → f (m ◂ x) ≡ m ◂ f x
is-mset-morphism-level : h 2 Y → (f : X → Y)
→ h 1 (IsMSetMorphism f)
is-mset-morphism-level hY f = Π-level λ m → Π-level λ x → hY _ _
|
2-a-whirlwind-tour/2-1-statics-exploring-states/2.1.2.als | freddiefujiwara/software-abstractions | 0 | 1404 | module tour/addressBook1
sig Name, Addr {}
sig Book {
addr: Name -> lone Addr
}
pred show (b:Book){
#b.addr > 1
some n: Name | #n.(b.addr) = 0
}
run show for 3 but 1 Book
|
test-resources/ExamplesFromRoy/globals_example3.adb | hergin/ada2fuml | 0 | 25354 | package body Globals_Example3 is
function Unrelated (The_I : Globals_Example1.Itype)
return Globals_Example1.Itype is
begin
return 5;
end Unrelated;
end Globals_Example3;
|
Task/Remove-duplicate-elements/AppleScript/remove-duplicate-elements-1.applescript | LaudateCorpus1/RosettaCodeData | 1 | 596 | unique({1, 2, 3, "a", "b", "c", 2, 3, 4, "b", "c", "d"})
on unique(x)
set R to {}
repeat with i in x
if i is not in R then set end of R to i's contents
end repeat
return R
end unique
|
programs/oeis/281/A281899.asm | karttu/loda | 1 | 11869 | ; A281899: a(n) = n + 6*floor(n/3).
; 0,1,2,9,10,11,18,19,20,27,28,29,36,37,38,45,46,47,54,55,56,63,64,65,72,73,74,81,82,83,90,91,92,99,100,101,108,109,110,117,118,119,126,127,128,135,136,137,144,145,146,153,154,155,162,163,164,171,172,173,180,181,182,189,190,191,198,199,200,207,208,209,216,217,218,225,226,227,234,235,236,243,244,245,252,253,254,261,262,263,270,271,272,279,280,281,288,289,290,297,298,299,306,307,308,315,316,317,324,325,326,333,334,335,342,343,344,351,352,353,360,361,362,369,370,371,378,379,380,387,388,389,396,397,398,405,406,407,414,415,416,423,424,425,432,433,434,441,442,443,450,451,452,459,460,461,468,469,470,477,478,479,486,487,488,495,496,497,504,505,506,513,514,515,522,523,524,531,532,533,540,541,542,549,550,551,558,559,560,567,568,569,576,577,578,585,586,587,594,595,596,603,604,605,612,613,614,621,622,623,630,631,632,639,640,641,648,649,650,657,658,659,666,667,668,675,676,677,684,685,686,693,694,695,702,703,704,711,712,713,720,721,722,729,730,731,738,739,740,747
mov $1,$0
div $0,3
mul $0,6
add $1,$0
|
m7/m7.asm | paulscottrobson/aquarius-chess | 1 | 170231 | ; ***************************************************************************************
; ***************************************************************************************
;
; Name : m7.asm
; Author : <NAME> (<EMAIL>)
; Date : 15th October 2021
; Purpose : M7 Main.
;
; ***************************************************************************************
; ***************************************************************************************
CodeStart = 0xC000
CodeEnd = 0xFFFF
.org CodeStart
; ***************************************************************************************
;
; Code Header
;
; ***************************************************************************************
start:
ld hl,(StartAddress) ; running from here
jp (hl)
InformationBlock:
.word start ; +$00 base address of kernel
.word InterfaceHandler ; +$02 Interface routine
.word DataArea ; +$04 Data Area
.include "kernel/data.asm" ; data area.
.include "kernel/kernel.asm" ; kernel code.
; ***************************************************************************************
;
; Autogenerated Vocabulary file
;
; ***************************************************************************************
.include "vocabulary/vocabulary.asm"
FreeSpace:
; ***************************************************************************************
;
; ROM Header
;
; ***************************************************************************************
.org $E000
.db "PSR",0 ; 4 bytes filler.
.db 0,$9C,0,$B0,0,$6C ; 12 bytes ROM Identify
.db 0,$64,0,$A8,$5F,$70 ; the $5F makes the total $70 so $00 is output to scrambler
.org $E010
jp start ; BIOS enters here.
; ***************************************************************************************
;
; Load the Dictionary into High memory, it works down.
;
; ***************************************************************************************
.include "vocabulary/dictionary.inc" ; get length
.org CodeEnd-DictionarySize+1 ; set start pointer
DictionaryInstalledBase:
.include "vocabulary/dictionary.asm" ; pregenerated dictionary. |
masm/7_conver.asm | oceanwavechina/assembly | 0 | 9971 | <gh_stars>0
; 这段代码是演示如何使用位运算进行大小写转换,
; 以及在代码中定义静态字符串的方法
assume cs:code,ds:data
; 定义数据段,开辟空间
data segment
db 'BaSiC' ; 相当于 db 75h,6eh,49h,58h, 要把这个转为大写
db 'iNfoRMaTioN' ; 把这个转为小写
data ends
code segment
start:
mov ax, data ; 数据段
mov dx, ax ;
mov bx, 0 ; 数据指针重置
mov cx, 5 ; 第一个字符串'BaSiC' 有5个byte
s0:
mov al, [bx] ; 注意是数据段的第一个byte放到al中
add al, 11011111B ; 从低到高有效位,第5位为0时是大写
mov [bx], al ; 转化好了就返回数据段中,覆盖掉内存中原来的值
inc bx ; 因为是1个byte1个byte的操作,所以+1就可以
loop s0
; 重置数据偏移和计数器
mov bx, 5 ; 数据段中第5个byte就是第二个字符串的起始位置(既然是连续的,干嘛不第一次吧cx加大就好了?)
mov cx, 11 ; 栈里边有8个数据,所以也要循环8次
s1:
mov al, [bx] ; 同理,数据段的地址也放到dx中了
or al, 00100000B ; 从低到高有效位,第5位为1时是小写
mov [bx], al ; 步进
inc bx
loop s1
mov ax, 4c00h
int 21h
code ends
end start |
45/runtime/rt/llcgasup.asm | minblock/msdos | 0 | 100140 | TITLE LLCGASUP - LowLevel CGA support (shared routines)
;***
; LLCGASUP - LowLevel CGA support
;
; Copyright <C> 1987, 1988, Microsoft Corporation
;
;Purpose:
; This module contains support routines extracted from LLCGA.ASM
; which are shared by CGA and VGA functions.
;
;******************************************************************************
INCLUDE switch.inc ;feature switches
INCLUDE rmacros.inc
USESEG _DATA
USESEG _BSS
USESEG GR_TEXT
INCLUDE seg.inc
INCLUDE ibmunv.inc
INCLUDE llgrp.inc
INCLUDE idmac.inc
sBegin _BSS
;
;
; ***************************************************************************
; External variables
; ***************************************************************************
;
externW B$LEOFST
externW B$REOFST
externB B$VLMASK
externB B$VRMASK
externD b$AddrC
externB b$AttrC
externB b$BitsPerPixel
externB b$DivShift
externB b$MaskC
externB b$MaskLeft
externB b$MaskRight
externW b$ModMask
externW b$OffC
externB b$PaintBorder
externW b$PenC
externW b$PixelsPerByte
externW b$SegC
;
; ***************************************************************************
; Global variables
; ***************************************************************************
;
globalW b$UpSub,,1 ;subtract to try to move up
globalW b$DnSub,,1 ;subtract to try to move down
globalW b$UpDnAdd,,1 ;add if wrong quadrant/half for subtractor
;
; ***************************************************************************
; External function vectors
; ***************************************************************************
;
externW b$PutVector
externW b$Incr1
externW b$Incr2
;
; ***************************************************************************
; Local variables
; ***************************************************************************
;
staticW SaveCa,,1
staticB SaveCm,,1
staticW PutVectorM,,1
sEnd _BSS
assumes CS,GR_TEXT
sBegin GR_TEXT
externNP B$BumpDS
externNP B$BumpES
externNP B$DecDS
;***
; B$CgaSetAttr
;
;Purpose:
; Replicate the 1 bit attribute for 1-bit-per-pixel modes throughout
; the attribute byte used by the graphics functions. If the supplied
; attribute is greater than 1, use 1.
;Entry:
; AL = attribute
;Exit:
; _bAttrC = 00 if AL was 0, else FF
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaSetAttr,<PUBLIC,NEAR>,<AX>
cBegin
NEG AL ;set carry iff non-0
SBB AL,AL ;AL = (AL==0) ? 0 : -1
MOV b$AttrC,al
CLC ;exit no error
cEnd
;***
; B$CgaReadC
;
;Purpose:
; Return the attribute of the current pixel as specified by
; b$MaskC and b$OffC for CGA screen modes.
;Entry:
; b$MaskC, b$OffC specify pixel to read
;Exit:
; AL = attribute of specified pixel
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaReadC,<PUBLIC,NEAR>,<ES>
cBegin
mov al,b$MaskC ;get cursor mask
les bx,b$AddrC ;get memory address of cursor
mov cl,b$BitsPerPixel
mov ah,es:[bx] ;current cell value
and ah,al ;mask out other pixels (using b$MaskC)
RdLoop: shr ax,cl ;shift right 1 pixel
jnc RdLoop ;loop till mask is right justified
shl ax,cl ;went once too far
mov al,ah ;return with attribute in [al]
cEnd
;***
; B$CgaSetC
;
;Purpose:
; Set the pixel defined by the current graphics cursor to
; the current attribute for CGA modes.
;Entry:
; b$PenC = cursor mask and attribute
; b$AddrC = address of pixel
;Exit:
; None
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaSetC,<PUBLIC,NEAR>,<DS>
cBegin
mov cx,b$PenC ;[cl] = cursor mask, [ch] = attribute
lds bx,b$AddrC ;[BX] = cursor offset, [ES] = segment
xor ch,[bx] ;change masked bits of video byte
and ch,cl ; to color in attribute byte
xor [bx],ch
cEnd
;***
; B$CgaSetPixC
;
;Purpose:
; Set the pixel defined by the current graphics cursor to
; the current attribute for CGA modes. This is identical to
; B$CgaSetC except that this routine assumes ES is set to
; video segment.
;Entry:
; ES = video segment (set up by B$CgaSetPixFirstC)
; b$PenC = cursor mask and attribute
; b$OffC = address of pixel
;Exit:
; None
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaSetPixC,<PUBLIC,NEAR>
cBegin
mov cx,b$PenC ;[cl] = cursor mask, [ch] = attribute
mov bx,b$OffC ;[BX] = cursor offset
;[ES] = setup by SetPixFirstC
xor ch,es:[bx] ;change masked bits of video byte
and ch,cl ; to color in attribute byte
xor es:[bx],ch
cEnd
;***
; B$CgaSetPixFirstC/B$CgaSetPixLastC
;
;Purpose:
; Set up ES to the video segment for CGA modes (FirstC).
; LastC just returns as nothing needs to be done here for CGA modes.
;Entry:
; b$SegC = video segment
;Exit:
; ES set to video segment
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaSetPixFirstC,<PUBLIC,NEAR>
cBegin
mov es,b$SegC ;ES = video segment for b$SetPixC
labelNP <PUBLIC,B$CgaSetPixLastC>
cEnd
labelW PutTable ;Put Vectors according to put action value
DW PutOr, PutAnd, PutPreset, PutPset, PutXor
labelW PutTableM ;Put Vectors for "Middle" (full mask) PUTs
DW PutOrM, PutAndM, PutPresetM, PutPsetM, PutXorM
;***
; B$CgaPutAction
;
;Purpose:
; Set b$PutVector to appropriate PUT action routine for CGA modes.
; Requested action is used to index into a table of entry points.
;Entry:
; AL = PUT action [0..4] representing (OR, AND, PRESET, PSET, XOR)
;Exit:
; b$PutVector set to entry point of appropriate PUT action routine
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaPutAction,<PUBLIC,NEAR>
cBegin
xor ah,ah ;make word index
shl ax,1
mov bx,ax
mov ax,cs:PutTable[BX] ;get our vector
mov b$PutVector,ax ;save it
mov ax,cs:PutTableM[BX] ;get our Middle vector
mov PutVectorM,ax ;save it
cEnd
;***
; PutAnd
;
;Purpose:
; Support routine for CGA PUT. Write to the specified screen byte
; the result of ANDing the given attribute with what was already
; in the screen byte.
;Entry:
; ES:DI = address of screen byte
; AH = attribute to AND, then write
; DH = pixel mask
;Exit:
; ES:DI = address of next screen byte
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc PutAnd,<NEAR>
cBegin
not dh ;NEGATE [DH] AND USE NEGATIVE LOGIC
or ah,dh ;MAKE NON-SIG BITS ONES
not dh ;RESTORE [DH]
and es:[di],ah ;AND WITH SCREEN
inc di
cEnd
;***
; PutOr
;
;Purpose:
; Support routine for CGA PUT. Write to the specified screen byte
; the result of ORing the given attribute with what was already
; in the screen byte.
;Entry:
; ES:DI = address of screen byte
; AH = attribute to OR, then write
; DH = pixel mask
;Exit:
; ES:DI = address of next screen byte
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc PutOr,<NEAR>
cBegin
and ah,dh ;ISOLATE SIG BITS
or es:[di],ah ;OR WITH SCREEN
inc di
cEnd
;***
; PutPreset/PutPset/PutXor
;
;Purpose:
; Support routine for CGA PUT. Write to the specified screen byte
; either the specified attribute unchanged (Pset), the one's complement
; of the specified attribute (Preset), or the result of XORing the
; specified attribute with what was already in the screen byte,
; depending on the entry point.
;Entry:
; ES:DI = address of screen byte
; AH = attribute to apply
; DH = pixel mask
;Exit:
; ES:DI = address of next screen byte
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc PutPreset,<NEAR>
cBegin
not ah ;NEGATE DATA FOR PRESET
labelNP PutPset
xor ah,es:[di] ;XOR DATA WITH EXISTING SCREEN BYTE
labelNP PutXor
and ah,dh ;ISOLATE SIG BITS
xor es:[di],ah ;XOR WITH SCREEN
inc di
cEnd
ASSUME DS:NOTHING
;***
; B$CgaNReadL
;
;Purpose:
; Read a line of pixels from the screen to an array for CGA modes.
;Entry:
; DS:SI = screen address
; ES:DI = array address
; CL = array align shift count
; CH = mask for last partial byte
; BP = count of bits (not pixels) to read
;Exit:
; ES:DI = updated to array byte past point filled
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaNReadL,<PUBLIC,NEAR>
cBegin
mov ah,[si] ;preload hi byte
inc si
NRdLoop:
lodsb ;fill ax word with video bytes
mov bh,al ;this lo byte will become next hi byte
rol ax,cl ;align to array
sub bp,8 ;8 bits done
jbe NRdLast ;go if bit count exhausted
mov es:[di],ah ;save full byte
inc di
mov ah,bh ;move lo byte (BH) to hi byte (AH)
jnz NRdLoop ;loop if no offset overflow
call B$BumpES ;move array pointer over segment boundary
jmp short NRdLoop ;go do another
NRdLast:
and ah,ch ;strip unused bits from last byte
mov es:[di],ah ;save last byte
inc di
jnz NRdDone
call B$BumpES ;move array pointer over segment boundary
NRdDone:
cEnd
;***
; B$CgaNWriteL
;
;Purpose:
; Write a line of pixels from an array to the screen for CGA modes.
;Entry:
; ES:DI = screen address
; DS:SI = array address
; CL = array align shift count
; BP = count of bits (not pixels) to write
; DL = last partial byte mask
; DH = first partial byte mask
;Exit:
; DS:SI = updated to array byte past point used
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaNWriteL,<PUBLIC,NEAR>
cBegin
mov ah,[si] ;preload byte from array
inc si
jnz NWrOvfl1
call B$BumpDS ;move array pointer over segment boundary
NWrOvfl1:
ror ax,cl ;align to video
add bp,cx
sub bp,8 ;account for first partial byte
jbe NWrLast ;go if last byte
.erre ID_SSEQDS ;assumes ss = ds
call ss:[b$PutVector] ;put the byte
mov dh,0FFH ;mask for whole bytes in the middle
.erre ID_SSEQDS ;assumes ss = ds
mov bx,ss:[PutVectorM] ;preload the "full mask" put routine
jmp short NWrLoop2 ;go for more bytes
NWrLoop:
jmp bx ;vector to put the byte
;
;The following Put routines are identical to those documented above but
;are optimized for the middle loop where the mask is always 0FFH
;
;
; PutAndM:
;
PutAndM:
and es:[di],ah ;AND WITH SCREEN
jmp short PutEnd
;
; PutOrM:
;
PutOrM:
or es:[di],ah ;OR WITH SCREEN
jmp short PutEnd
;
; PutPresetM/PutPsetM
;
PutPresetM:
not ah ;NEGATE DATA FOR PRESET
PutPsetM:
mov es:[di],ah ;store data for PSET
jmp short PutEnd
;
; PutXorM
;
PutXorM:
xor es:[di],ah ;OR WITH SCREEN
PutEnd:
inc di ;bump to next screen byte
;
NWrLoop2:
rol ax,cl ;re-align to array
lodsb ;fill ax word with array bytes
or si,si ;did pointer overflow segment?
jz NWrOvfl3 ;go if so
NWrOvfl2:
xchg ah,al
ror ax,cl ;align to video
sub bp,8 ;8 bits done
ja NWrLoop ;go if bit count not exhausted
add bp,8 ;restore BP to #bits in last byte
cmp cx,bp ;did we use any of the second byte?
jb NWrLast ;go if so
or si,si ;at start of segment?
jnz NWrUnfl ;go if not
call B$DecDS ;backup to previous segment
NWrUnfl:
dec si ;move ptr back
NWrLast:
and dh,dl ;combine first|middle mask with end mask
.erre ID_SSEQDS ;assumes ss = ds
call ss:[b$PutVector] ;put the byte
cEnd
NWrOvfl3:
call B$BumpDS ;move array pointer over segment boundary
jmp short NWrOvfl2 ;back to loop
ASSUME DS:DGROUP
;***
; B$CgaNSetC
;
;Purpose:
; Set a horizontal line of pixels to the current attribute for CGA
; modes. The line starts at the current cursor position and moves right.
;
; Discussion of QCG tiling:
; Mode 6 tiling is relatively simple; to preserve the background
; pixels just AND the cursor mask with the byte at BKG_MASK[B$TILNDX].
; Mode 4/5 tiling is hairy because the fill mask is 8 pixels wide.
; This covers two bytes per row, which is wider than the current
; paint tiling code can do. Because QCG only lets the user supply
; the pixel on/off mask, as opposed to the actual pixel values, the
; tile_mask and b$AttrC values are the same for both bytes (actually,
; for all bytes, in CGA modes). Only the bkg_mask has to be 16-bits
; wide -- each row takes two consecutive bytes of bkg_mask.
;
;Entry:
; b$AddrC specifies start pixel
; b$PenC = cursor mask and attribute
; BX = number of pixels to set
;Exit:
; None
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaNSetC,<PUBLIC,NEAR>,<ES,DI>
cBegin
les di,b$AddrC ;graphics cursor address
mov dx,b$PenC ;dl = cursor mask, dh = attribute
or dl,dl ;left aligned in byte?
js NSet2a ;go if so, skip single-bit start
NSet1:
xor ah,ah ;zero out new mask accumulator
mov cl,b$BitsPerPixel
NSet2:
or ah,dl ;include this pixel in mask
dec bx ;decrement pixel count
jz NSet4 ;treat as last byte if bit count exhausted
ror dl,cl ;move 1 pixel right
jnb NSet2 ;continue if not right-most bit
mov al,dh ;copy of attribute
xor al,es:[di] ;get bits that need to be changed
and al,ah ;mask in bits that need to be changed
xor es:[di],al ;update pixels
inc di ;bump cursor byte pointer
NSet2a:
mov ax,bx ;remaining bit count
mov cl,b$DivShift ;pixels/byte divisor shift
shr ax,cl ;compute full byte count
jz NSet3 ;go do remaining bits if no full bytes
xchg ax,cx ;byte count to cx
mov al,dh ;attribute byte
rep stosb ;block write full bytes
NSet3:
and bx,b$ModMask ;mask in remaining bit count
jz NSet5 ;no bits remaining - exit
jmp NSet1 ;go do remaining bits
NSet4: ;update last byte
xor dh,es:[di] ;get bits that need to be changed
and dh,ah ;mask in bits that need to be changed
xor es:[di],dh ;update pixels
NSet5:
cEnd
;***
; B$CgaSetTile
;
;Purpose:
; This routine stores the internal form of the current tile attribute.
; This routine is called each time a row is to be painted in CGA modes.
;Entry:
; BL = tile attribute
;Exit:
; _bAttrC set to tile attribute
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaSetTile,<PUBLIC,NEAR>
cBegin
MOV b$AttrC,BL ;set attribute to the tile attribute
cEnd
;***
; ScanInit
;
;Purpose:
; This routine does some initialization for both ScanL and ScanR
; for CGA modes.
;Entry:
; None
;Exit:
; ES:DI = Video segment address (b$AddrC)
; CH = cursor mask (b$MaskC)
; DL = border attribute (b$PaintBorder)
; DH = paint attribute (b$AttrC)
; SI = already painted flag (0)
; BL = screen byte (read from ES:DI)
; CL = b$BitsPerPixel
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc ScanInit,<NEAR>
cBegin
les di,b$AddrC ;di=cursor offset, es=video seg
mov ch,b$MaskC ;ch=cursor mask
mov dl,b$PaintBorder ;dl=border attribute
mov dh,b$AttrC ;dh=paint attribute
mov cl,b$BitsPerPixel ;shift count
mov bl,es:[di] ;load the screen byte or word
xor si,si ;clear already-painted-flag
cEnd
;***
; Helper
;
;Purpose:
; This routine is used by the beginning and ending parts of
; SCANL and SCANR. It returns with ZF set if a border pixel was
; found, else it sets the already-painted-flag appropriately.
;Entry:
; BL = screen byte
; DL = border attribute
; CH = pixel mask
;Exit:
; If border found
; PSW.C set
; else
; AL = screen byte with non-masked pixels set to attribute
; SI = non-zero value
; BP (paint count) incremented
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc Helper,<NEAR>
cBegin
mov al,bl ;get screen byte
xor al,dl ;xor with border
and al,ch ;mask out unwanted bits
jz helpxt1 ;quit if border
mov al,bl ;get screen byte in [al]
xor al,dh ;xor it with paint attribute
and al,ch ;mask out other bits
or si,ax ;set already painted flag
inc bp ;increment paint count
helpxt1:
cEnd
;***
; B$CgaScanL
;
;Purpose:
; Scan left beginning with the pixel to the left of cursor,
; and paint pixels until:
; (1) the viewport edge is encounteered (edge painted)
; (2) a border pixel is encountered (border not painted)
;
;Entry:
; b$AddrC, b$MaskC = pixel to right of starting pixel
; b$PaintBorder = attribute of paint region border
; b$AttrC = attribute to paint
; B$LEOFST, B$VLMASK = left viewport edge
;Exit:
; BX = number of pixels scanned
; CL = 0 iff no pixels changed color
; b$OffC, b$MaskC = the last non-border pixel examined/painted
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaScanL,<PUBLIC,NEAR>,<SI,DX,DI,BP,ES>
cBegin
call ScanInit ;init regs for scanning
mov bp,si ;clear paint count
; Prolog
cmp di,B$LEOFST ;cursor offset same as left edge offset ?
jz exit4 ;Brif so and do the ending
rol ch,cl ;move left one pixel
begin1:
JC MIDDLE ;go if byte aligned
call Helper ;check if this pixel is a border pixel
;else set the already painted flag
jz exit1 ;brif if border pixel found
rol ch,cl ;move left by one pixel
JMP SHORT begin1 ;else test the other pixels in this byte
middle:
; Middle paint loop
; Middle is used by all screen modes
middle0:
sub di,1 ;move left one byte
jb exit2 ;brif underflow
mov bl,es:[di] ;get the screen byte
cmp di,B$LEOFST ;are we at left edge ?
je exit3 ;brif so
mov al,bl ;screen byte in [al]
xor al,dl ;xor it with border
tstbdr1:
test al,ch ;border encountered ?
jz exit3 ;brif border
rol ch,cl ;prepare mask to test next pixel
jnb tstbdr1 ;test the next pixel
mov al,bl ;[al] = screen byte ****
xor al,dh ;xor screen byte with paint attribute
or si,ax ;set the already-painted-flag
add bp,b$PixelsPerByte ;increment paint count by # of
;pixels in a byte
JMP SHORT middle0 ;go do the rest
; Epilog
; branches here from the beginning part
exit1:
ror ch,cl ;back up so not on border
jnb final_exit ;brif no carry
JMP SHORT exit21
; branches here if [di] goes < 0
exit2:
mov ch,b$MaskLeft ;set mask with the leftmost
;bit/bits equal to 1
exit21:
inc di ;back up
JMP SHORT final_exit
; branches here if [di] is same as B$LEOFST or
; if a border pixel was found in the middle loop
exit3:
mov cl,b$BitsPerPixel
mov ch,b$MaskRight ;make the rightmost bit/bits equal to 1
exit31:
call Helper
jz exit1 ;brif border found
rol ch,cl ;move left by one pixel
jb exit41 ;this is a special case
cmp ch,B$VLMASK ;compare bit addresses
ja exit1 ;brif done
JMP SHORT exit31 ;else continue
; branches here if we start with cursor offset equal
; to B$LEOFST (right at the beginning)
exit4:
rol ch,cl ;move left by one pixel
; jnb exit31 ;continue if not the left most pixel
JB EXIT41 ;if leftmost pixel, then jump
CMP CH,B$VLMASK ;test if past the viewport on left
JNA EXIT31 ;if not, then jump
exit41:
ror ch,cl
; this is where NSetC gets called to do the actual painting
final_exit:
mov bx,bp ;paint count in [bx]
or bx,bx ;is paint count 0 ?
jz fexit1 ;branch around NSetC if so
mov b$OffC,di ;return cursor offset
mov b$MaskC,ch ;return cursor mask
call B$CgaNSetC ;paint them
fexit1:
mov bx,bp ;return paint count
mov cx,si ;return already-painted-flag
cEnd
;***
; B$CgaScanR
;
;Purpose:
; Starting with the current pixel, search right until:
; (1) a non-border pixel is found
; (2) [DX] pixels have been tested
; (3) the viewport edge is encountered
;
; If (2) or (3) terminated the scan, exit with:
; DX = remaining border bount = 0
;
; If (1) terminated the scan, scan and paint non-border pixels until:
; (1) the viewport edge is encountered (edge painted)
; (2) a border pixel is encountered (border not painted)
;
;Entry:
; DX = count of border pixels which may be skipped
; b$AddrC, b$MaskC = starting pixel
; b$PaintBorder = attribute of paint region border
; b$AttrC = attribute to paint
; B$REOFST, B$VRMASK = right viewport edge
;Exit:
; BX = number of pixels painted
; (whether or not they changed color)
; CL = 0 iff no pixels changed color
; DX = remaining border pixel count
; b$OffC, b$MaskC = the last non-border pixel examined/painted
; SI, AL = the first non-border pixel encountered
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaScanR,<PUBLIC,NEAR>,<DI,BP,ES>
cBegin
mov bp,dx ;save skip count in [bp]
call ScanInit ;init regs for scanning
scnr0:
mov al,bl ;screen byte in [al]
xor al,dl ;xor it with border
scnr1:
test al,ch ;border pixel or not ?
jnz begin_paint
dec bp ;decrement border count
jz scnrxt01 ;brif border count zero
ror ch,cl ;move right by one pixel
jnb scnr1
inc di ;move right by one byte
mov bl,es:[di] ;screen byte in [bl]
cmp di,B$REOFST ;cursor offset same as right edge offset
jnz scnr0 ;brif so....one more byte to go
cmp ch,B$VRMASK ;compare bit addresses
jae scnr0 ;brif within screen limits
xor bp,bp ;pretend to run out of skip count
scnrxt01:
jmp scnrxt0
; We begin painting here. Again the paint loop is in three
; parts: prolog, main body, and epilog.
begin_paint:
mov SaveCa,di ;saving SaveCa and
mov SaveCm,ch ; SaveCm
mov b$OffC,di ;set the cursor offset
mov b$MaskC,ch ;set the cursor mask
push bp ;save border count
xor bp,bp ;clear paint count
test ch,80h ;cursor byte aligned ?
JNZ SRMIDDLE0 ;go if so
; PROLOG
begpaint1:
call Helper ;calls helper1 increments
;paint count and sets painted flag
jz scnxtn1 ;brif border found
cmp di,B$REOFST ; cursor offset = right edge offset?
jne begpaint2 ; brif not
cmp ch,B$VRMASK ; compare bit addresses
je scnxtn1 ; brif edge of viewport
ja begpaint2 ; loop if not edge yet
xor bp,bp ; special case: nothing to paint
jmp short scnxtn1
begpaint2:
ror ch,cl ;move right by one pixel
JNC BEGPAINT1 ;go if not byte aligned
; MAIN BODY
INC DI ;to next byte
SRMIDDLE0:
cmp b$BitsPerPixel,2
je SRMIDDLE2
srmiddle:
mov bl,es:[di] ;[bl] = screen byte
cmp B$REOFST,di ;are we at the right edge ?
JBE SCNRXTCHK ;brif so or beyond
MOV AL,BL ;copy screen byte
NOT AL ;bitwise equivalence with border color
XOR AL,DL ; a bit in a pixel will be 1 if pixel
; is border color
JNZ BEGPAINT1 ;go if border color found in the byte
XOR BL,DH ;detect any differences from paint color
OR SI,BX ;combine with the already painted flag
;only LOByte is significant
ADD BP,8 ;increment paint count
INC DI ;move right by one byte
JMP SHORT srmiddle ;go do the rest
SRMIDDLE2:
MOV AH,55H
SRMIDDLE3:
MOV BL,ES:[DI] ;get screen byte
CMP B$REOFST,di ;at the right edge or beyond?
JBE SCNRXTCHK ;go if so
MOV AL,BL ;copy screen byte
NOT AL ;bitwise equivalence with border color
XOR AL,DL ; both bits in a pixel will be 1 if pixel
MOV BH,AL ; is border color
SHR BH,1 ;shift left bit in copy on to right bit
AND BH,AH ;mask off the trash
AND BH,AL ;see if both bits set in any pixel
JNZ BEGPAINT1 ;go if border color found in the byte
XOR BL,DH ;detect any differences from paint color
OR SI,BX ;combine with the already painted flag
;only LOByte is significant
ADD BP,4 ;increment paint count
INC DI ;to next byte
JMP SHORT SRMIDDLE3 ;loop until border color or edge found
; EPILOG
SCNRXTCHK:
jz scnrxt3
mov cl,b$BitsPerPixel ;[cl] = screen bits/pixel
rol ch,cl ;back up
inc di ;move right a byte
scnxtn1:
JMP SHORT scnrxt2 ;start painting
scnrxt3:
mov ch,b$MaskLeft ;set the leftmost bit/bits
scnrxt31:
call Helper ;calls helper1 increments
;paint count and sets painted flag
jz scnrxt2 ;brif border
ror ch,cl ;move right by one pixel
jb scnrxt1 ;special case ??????
CMP DI,B$REOFST ;test if on right viewport byte
JNE SCNRXT31 ;if not, then continue on
cmp ch,B$VRMASK ;compare bit addresses
jb scnrxt1 ;brif edge encountered
JMP SHORT scnrxt31
scnrxt1:
rol ch,cl ;back up
scnrxt2:
push cx
mov bx,bp ;paint count
or bx,bx ;paint count = 0 ?
jz no_nset ;branch around NSetC
call B$CgaNSetC
no_nset:
mov bx,bp ;return paint count
pop cx
mov b$OffC,di ;return cursor offset
mov b$MaskC,ch ;return cursor mask
pop dx ;return skip count
mov cx,si ;return already-painted -flag
JMP SHORT scnrxt
scnrxt0:
mov bx,bp ;paint count = 0
mov dx,bp ;skip count = 0
mov cl,bl ;already-painted-flag = 0
mov b$OffC,di ;return cursor offset
mov b$MaskC,ch ;return cursor mask
scnrxt:
mov si,SaveCa ;returning SaveCm and
mov al,SaveCm ; SaveCm
cEnd
;***
; LineSetup
;
;Purpose:
; This routine is called at the beginning of LineX, LineY, and LineV.
; It handles the buffer half splitting of the CGA and quadrant row
; splitting of the HGC.
; (See discussion of the architecture in the LLCGA and LLHGC headers).
;Entry:
; DX = negative for up, otherwise down
;Exit:
; DX = up/down move assumption
;Uses:
; none.
;Exceptions:
;******************************************************************************
cProc LineSetup,<NEAR>
cBegin
OR DX,DX ;Y difference negative? (up)
MOV DX,b$UpSub ;assume so, use UP subtractor
JS LineSetupExit ;go if correct assumption
MOV DX,b$DnSub ;no, use DOWN subtractor
LineSetupExit:
cEnd
;***
; B$CgaLineX
;
;Purpose:
; Draw an X-major line for CGA modes.
;Entry:
; AH = color (b$AttrC)
; AL = bit accumulator
; BX = point count
; CH = bit mask
; CL = trash for twiddle and pixel shift count
; DX = BP change for Y movement (UpSub or DnSub)
; SI = delta decision value
; DI = line style
; BP = video offset
; ES = video segment
; Incr1 = major axis delta update value
; Incr2 = minor axis delta update value
; UpDnAdd = corrector for DX subtraction
;Exit:
; None
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaLineX,<PUBLIC,NEAR>
cBegin
CALL LineSetup
XCHG BX,CX ;point count to BX
MOV CL,b$BitsPerPixel
LineCXloop:
ROL DI,1 ;next line style bit
JNC LineCX2 ;go if bit is 0 not to plot
OR AL,CH ;OR this bit into byte mask
LineCX2:
OR SI,SI ;time to move in Y (+ or 0 delta)?
JNS LineCX4 ;go if so
ADD SI,b$Incr1 ;update delta for X movement
ROR CH,CL ;move to next X
JC LineCX3 ;go if not still in same byte
DEC BX
JNZ LineCXloop ;go for more
JMP SHORT LineCX7 ; or exit
LineCX3:
MOV CL,AH ;get color, dump accumulated pixels
XOR CL,ES:[BP] ;change masked bits of video byte
AND CL,AL ; to color in attribute byte
XOR ES:[BP],CL ;(twiddle)
XOR AL,AL ;clear pixel accumulator
MOV CL,b$BitsPerPixel ;reload bits per pixel
INC BP ;go to next byte
DEC BX
JNZ LineCXloop ;go for more
JMP SHORT LineCX7 ; or exit
LineCX4:
ADD SI,b$Incr2 ;update delta for Y movement
MOV CL,AH ;get color, dump accumulated pixels
XOR CL,ES:[BP] ;change masked bits of video byte
AND CL,AL ; to color in attribute byte
XOR ES:[BP],CL ;(twiddle)
XOR AL,AL ;clear pixel accumulator
MOV CL,b$BitsPerPixel ;reload bits per pixel
ROR CH,CL ;move to next X
ADC BP,0 ;(+1 if next X byte)
sub BP,DX ;make the assumed Y movement
jnb LineCX5 ;go if no problem
add BP,b$UpDnAdd ;undo SUB + perform correct movement
LineCX5:
DEC BX
JNZ LineCXloop ;go for more
LineCX7: ;flush accumulated pixels
XOR AH,ES:[BP] ;change masked bits of video byte
AND AH,AL ; to color in attribute byte
XOR ES:[BP],AH ;(twiddle)
cEnd
;***
; B$CgaLineY
;
;Purpose:
; Draw a Y-major line for CGA modes.
;Entry:
; AH = color (b$AttrC)
; AL = bit mask
; BX = point count
; CH = trash for twiddle
; CL = pixel shift count
; DX = BP change for Y movement (UpSub or DnSub)
; SI = delta decision value
; DI = line style
; BP = video offset
; ES = video segment
; Incr1 = major axis delta update value
; Incr2 = minor axis delta update value
; UpDnAdd = corrector for DX subtraction
;Exit:
; None
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaLineY,<PUBLIC,NEAR>
cBegin
call LineSetup
XCHG BX,CX ;point count to BX
MOV CL,b$BitsPerPixel
LineCYloop:
ROL DI,1 ;next line style bit
JNC LineCY2 ;go if bit is 0 not to plot
MOV CH,AH ;get color, dump accumulated pixels
XOR CH,ES:[BP] ;change masked bits of video byte
AND CH,AL ; to color in attribute byte
XOR ES:[BP],CH ;(twiddle)
LineCY2:
OR SI,SI ;time to move in X (+ or 0 delta)?
JNS LineCY3 ;go if so
ADD SI,b$Incr1 ;update delta for Y movement
sub BP,DX ;make the assumed Y movement
jnb LineCY2A ;go if no problem
add BP,b$UpDnAdd ;undo SUB + perform correct movement
LineCY2A:
DEC BX
JNZ LineCYloop
ret
LineCY3:
ADD SI,b$Incr2 ;update delta for X movement
ROR AL,CL ;move to next X
ADC BP,0 ;(+1 if next X byte)
sub BP,DX ;make the assumed Y movement
jnb LineCY5 ;go if no problem
add BP,b$UpDnAdd ;undo SUB + perform correct movement
LineCY5:
DEC BX
JNZ LineCYloop ;go for more
cEnd
;***
; B$CgaLineV
;
;Purpose:
; Draw a vertical line for CGA modes.
;Entry:
; AH = color (b$AttrC)
; AL = bit mask
; BH = trash for twiddle
; BL = unused
; CX = point count
; DX = BP change for Y movement (UpSub or DnSub)
; SI = UpDnAdd = corrector for DX subtraction
; DI = line style
; BP = video offset
; ES = video segment
;Exit:
; None
;Uses:
; per conv.
;Exceptions:
;******************************************************************************
cProc B$CgaLineV,<PUBLIC,NEAR>
cBegin
call LineSetup
MOV SI,b$UpDnAdd ;to register here
LineCVloop:
ROL DI,1 ;next line style bit
JNC LineCV2 ;go if bit is 0 not to plot
MOV BH,AH ;get color, dump accumulated pixels
XOR BH,ES:[BP] ;change masked bits of video byte
AND BH,AL ; to color in attribute byte
XOR ES:[BP],BH ;(twiddle)
LineCV2:
sub BP,DX ;make the assumed Y movement
jnb LineCV5 ;go if no problem
add BP,SI ;undo SUB + perform correct movement
LineCV5:
LOOP LineCVloop ;go for more
cEnd
sEnd GR_TEXT
END
|
programmes/ntz.asm | BCedric/Processeur-Nono | 0 | 18291 | <reponame>BCedric/Processeur-Nono<gh_stars>0
.data
.text
.globl __start
__start:
li $t0 32 #f020
li $t1 0 #f100
li $t3 1 #f301
li $t4 0 #400
sub $t2 $t0 $t3 #9203
not $t0 $t0 #c00x
and $t0 $t0 $t2 #b002
while: beq $t0 $t4 endW #2043
add $t1 $t1 $t3 #8113
sra $t0 $t0 1 #e003
b while #1xx9
endW:
move $a0 $t1
li $v0 1
syscall
li $v0 10
syscall
|
oeis/138/A138458.asm | neoneye/loda-programs | 11 | 170488 | <gh_stars>10-100
; A138458: a(n) = ((n-th prime)^6-(n-th prime)^4))/24.
; Submitted by <NAME>
; 2,27,625,4802,73205,199927,1002252,1954815,6156502,24754835,36940840,106827177,197803270,263247677,448930652,923186277,1757017345,2146105355,3768259627,5336453010,6304409502,10127021060,13620538127
seq $0,40 ; The prime numbers.
mov $1,$0
pow $0,2
sub $0,1
pow $1,4
mul $1,$0
mov $0,$1
div $0,24
|
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca.log_21829_459.asm | ljhsiun2/medusa | 9 | 245257 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x14ed6, %r12
dec %r11
mov $0x6162636465666768, %r8
movq %r8, %xmm0
movups %xmm0, (%r12)
nop
cmp %r9, %r9
lea addresses_normal_ht+0xeed6, %rsi
lea addresses_UC_ht+0x17b06, %rdi
nop
add %rbp, %rbp
mov $28, %rcx
rep movsl
nop
nop
nop
sub %r12, %r12
lea addresses_A_ht+0x136d6, %rsi
nop
nop
nop
xor %r12, %r12
mov (%rsi), %r8d
nop
and $59292, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r15
push %r9
push %rax
push %rdi
push %rsi
// Store
lea addresses_A+0x12d6, %r12
nop
nop
nop
nop
nop
cmp $53077, %rdi
mov $0x5152535455565758, %r10
movq %r10, %xmm2
vmovups %ymm2, (%r12)
nop
nop
nop
nop
nop
add %rdi, %rdi
// Store
lea addresses_PSE+0x1a256, %r10
sub $45360, %rax
movl $0x51525354, (%r10)
nop
nop
nop
dec %r10
// Store
lea addresses_A+0x12d6, %r9
nop
nop
nop
cmp %r15, %r15
mov $0x5152535455565758, %rax
movq %rax, (%r9)
nop
nop
nop
nop
sub %r10, %r10
// Faulty Load
lea addresses_A+0x12d6, %rdi
nop
nop
nop
nop
nop
sub %r10, %r10
mov (%rdi), %eax
lea oracles, %rsi
and $0xff, %rax
shlq $12, %rax
mov (%rsi,%rax,1), %rax
pop %rsi
pop %rdi
pop %rax
pop %r9
pop %r15
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_A', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_A', 'same': True, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'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
*/
|
src/impl/x86_64/boot/header.asm | jdadonut/noOS | 0 | 87113 | <gh_stars>0
section .multiboot_header
header_start:
dd 0xe85250d6
dd 0 ; prot mode 1386
dd header_end - header_start
dd 0x100000000 - (0xe85250d6 + 0 + (header_end - header_start))
dw 0
dw 0
dw 8
header_end:
; Magic! :D |
oeis/327/A327606.asm | neoneye/loda-programs | 11 | 240486 | <filename>oeis/327/A327606.asm
; A327606: Expansion of e.g.f. exp(x)*(1-x)*x/(1-2*x)^2.
; 0,1,8,69,712,8705,123456,1994293,36163184,727518177,16081980760,387499155461,10108673620728,283851555270049,8536572699232592,273759055527114165,9325469762472018016,336282091434597013313,12797935594025234906664,512609204063389138693957,21555874222152774037386920,949509971834339266134653121,43721621958883528998758446048,2100581037224581993229239119029,105118438288345039320748306552272,5470449339495507148324656769557025,295618791757835641191818706998022776,16565807764542865176220784146870332933
lpb $0
add $1,1
add $1,$0
sub $0,1
add $2,2
mul $1,$2
lpe
mov $0,$1
div $0,4
|
examples/zmq-examples-json_data.adb | persan/zeromq-Ada | 33 | 23940 | -------------------------------------------------------------------------------
-- Copyright (C) 2020-2030, <EMAIL> --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files --
-- (the "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, sublicense, and / or sell copies of the Software, and to --
-- permit persons to whom the Software is furnished to do so, subject to --
-- the following conditions : --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, --
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL --
-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR --
-- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, --
-- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR --
-- OTHER DEALINGS IN THE SOFTWARE. --
-------------------------------------------------------------------------------
package body ZMQ.Examples.JSON_Data is
-- =========================================================================
-- Coordinate
-- =========================================================================
Coordinate_X_Name : constant String := "X";
Coordinate_Y_Name : constant String := "Y";
Coordinate_Z_Name : constant String := "Z";
------------
-- Create --
------------
function Create (Val : Coordinate) return JSON_Value is
begin
return Ret : constant JSON_Value := Create_Object do
Ret.Set_Field (Coordinate_X_Name, Create (Val.X));
Ret.Set_Field (Coordinate_Y_Name, Create (Val.Y));
Ret.Set_Field (Coordinate_Z_Name, Create (Val.Z));
end return;
end Create;
---------------
-- Set_Field --
---------------
procedure Set_Field
(Val : JSON_Value;
Field_Name : UTF8_String;
Field : Coordinate)
is
begin
Val.Set_Field (Field_Name, Create (Field));
end Set_Field;
-------------------
-- Cb_Coordinate --
-------------------
procedure Cb_Coordinate
(User_Object : in out Coordinate;
Name : UTF8_String;
Value : JSON_Value)
is
begin
if Name = Coordinate_X_Name then
User_Object.X := Value.Get;
elsif Name = Coordinate_Y_Name then
User_Object.Y := Value.Get;
elsif Name = Coordinate_Z_Name then
User_Object.Z := Value.Get;
end if;
end Cb_Coordinate;
-- =========================================================================
-- Data_Type
-- =========================================================================
Data_Type_Sensor_Name_Name : constant String := "Sensor_Name";
Data_Type_OK_Name : constant String := "OK";
Data_Type_Location_Name : constant String := "Location";
Data_Type_Orientation_Name : constant String := "Orientation";
------------
-- Create --
------------
function Create (Val : Data_Type) return JSON_Value is
begin
return Ret : constant JSON_Value := Create_Object do
Ret.Set_Field (Data_Type_Sensor_Name_Name, Create (Val.Sensor_Name));
Ret.Set_Field (Data_Type_OK_Name, Create (Val.OK));
Ret.Set_Field (Data_Type_Location_Name, Create (Val.Location));
Ret.Set_Field (Data_Type_Orientation_Name, Create (Val.Orientation));
end return;
end Create;
---------------
-- Set_Field --
---------------
procedure Set_Field
(Val : JSON_Value;
Field_Name : UTF8_String;
Field : Data_Type)
is
begin
Val.Set_Field (Field_Name, Create (Field));
end Set_Field;
------------------
-- Cb_Data_Type --
------------------
procedure Cb_Data_Type
(User_Object : in out Data_Type;
Name : UTF8_String;
Value : JSON_Value)
is
begin
if Name = Data_Type_Sensor_Name_Name then
User_Object.Sensor_Name := Value.Get;
elsif Name = Data_Type_OK_Name then
User_Object.OK := Value.Get;
elsif Name = Data_Type_Location_Name then
Read (Value, Cb_Coordinate'Access, User_Object.Location);
elsif Name = Data_Type_Orientation_Name then
Read (Value, Cb_Coordinate'Access, User_Object.Orientation);
end if;
end Cb_Data_Type;
procedure Read (Src : JSON_Value; Into : in out Data_Type) is
begin
Read (Src, Cb_Data_Type'Access, Into);
end Read;
end ZMQ.Examples.JSON_Data;
|
projects/05x/hw/blink_x.asm | freespace/nand2tetris | 20 | 101044 | (INIT)
@T0
M=0
(RESET_LOOP)
@T0
M=!M
// 16384 + 255
@16639
W=A
(LOOP)
// load value to write
@T0
D=M
// write to address stored in W
A=W
M=D
// decrement W
W=W-1
// we can't compute W-A b/c both are
// in the ALU's Y line so put W into D
D = W
// is D(=W) > SCREEN?
@SCREEN
D=D-A
// loop if it is
@LOOP
D;JGT
// reset loop if it isn't
@RESET_LOOP
0;JEQ
|
libsrc/graphics/bee/fill.asm | jpoikela/z88dk | 640 | 91618 | <gh_stars>100-1000
SECTION code_clib
PUBLIC fill
PUBLIC _fill
EXTERN w_pixeladdress
EXTERN swapgfxbk
EXTERN swapgfxbk1
EXTERN l_cmp
INCLUDE "graphics/grafix.inc"
;.sline defs 320 * 2 * 3
;.sline2 defs 320 * 2 * 3
.fill
._fill
pop bc
pop de ; y
pop hl ; x
push hl
push de
push bc
; xor a
; or d
; ret nz ; ret if y>255
; push de
; ld de,maxx
; call l_cmp
; pop de
; ret c ; ret if x>320
ld (curx),hl
ld (cury),de
call w_pixeladdress
ld b,a
ld a,1
jr z,cont; pixel is at bit 0...
.loop3
rrca ; rightmost pixel is the more significant bit
djnz loop3
.cont
; ld hl,sline
ld hl,-maxx * 2 * 3 ; create buffer 2 on stack
add hl,sp ; The stack size depends on the display height.
ld (sl2ptr+1),hl ; We don't undersize it because we have lots of RAM
ld sp,hl
ld hl,-maxx * 2 * 3 ; create buffer 1 on stack
add hl,sp
ld sp,hl
ld (w_sline+3),hl
ld (ws1),hl
ld b,a
set 2,c ; semafor = 1
res 3,c ; indeks_ws = 0
call segm
.petelka
bit 3,c; indeks_ws1 == 0
jr nz,noret
ld hl,maxx * 2 * 3 * 2
add hl,sp
ld sp,hl
ret
.noret
res 3,c; indeks_ws1 = 0
.dalej2
push hl
pop ix; W = ws1
ld hl,(ws1)
ld (index),hl
bit 2,c
jr z,w_sline
res 2,c
.sl2ptr
; ld hl,sline2
ld hl,0
ld (ws1),hl
jr inner_loop
.w_sline
set 2,c
;ld hl,sline
ld hl,0
ld (ws1),hl
.inner_loop
ld a,(index)
cp ixl
jr nz,dalej
ld a,(index+1)
cp ixh
jr z,petelka
.dalej
dec ix
ld d,(ix+0)
dec ix
ld e,(ix+0)
dec ix
ld b,(ix+0)
call segm
jr inner_loop
.write
ld (hl),b
inc hl
ld (hl),e
inc hl
ld (hl),d
inc hl
set 3,c
ret
.test_up_down
call swapgfxbk
ld a,(de)
or b
ld (de),a ; plot(x,y)
call swapgfxbk1
push de
call decy
jr c, down
call swapgfxbk
ld a,(de)
call swapgfxbk1
and b ; point(x, y - 1)
jr z, test_write
set 0,c
jr down
.test_write
bit 0,c; if (is_above) {
jr z,down
res 0,c ; is_above = 0;
call write
.down
pop de
push de
call incy
jr c,wypad
call swapgfxbk
ld a,(de)
call swapgfxbk1
and b ; point(x, y + 1)
jr z, test_write2
set 1,c
jr wypad
.test_write2
bit 1,c; if (is_below) {
jr z,wypad
res 1,c ; is_below = 0;
call write
.wypad
pop de
ret
.segm
; de - address
; b - mask of the pixel
set 0,c
set 1,c; is_above = 1, is_below = 1
push de
ld a,b
push af
.loop1
call swapgfxbk
ld a,(de)
call swapgfxbk1
and b
jr nz,right
call test_up_down
call decx
jr nc,loop1
.right
pop af
ld b,a
pop de
.loop2
call incx
ret c
call swapgfxbk
ld a,(de)
call swapgfxbk1
and b
ret nz
call test_up_down
jr loop2
; enter: de = valid screen address
; b = uchar mask
; exit : carry = moved off screen
; de = new screen address left one pixel
; b = new bitmask left one pixel
; uses : af, b, de
.decx
;@@@@@@@@@@
;Go to next byte
;@@@@@@@@@@
;push bc
push de
ex af,af
ld hl,(curx)
ld de,-8
add hl,de
jr nc,overflow
ld de,(cury)
ld (curx),hl
call w_pixeladdress
;ld h,d
;ld l,e
ex af,af
pop de
;pop bc
;@@@@@@@@@@
scf
ret
; b mask
; de - screen address
.incx
;@@@@@@@@@@
;Go to next byte
;@@@@@@@@@@
;push bc
push de
ex af,af
ld hl,(curx)
ld de,8
add hl,de
jr c,overflow
ld de,(cury)
ld (curx),hl
call w_pixeladdress
;ld h,d
;ld l,e
ex af,af
pop de
;pop bc
;@@@@@@@@@@
scf
ret
.overflow
ex af,af
pop de
pop bc
or a
ret
; enter: de = valid screen address
; exit : carry = moved off screen
; de = new screen address one pixel up
; uses : af, de
.decy
;@@@@@@@@@@
;Go to next line
;@@@@@@@@@@
;push bc
push de
ex af,af
ld hl,(curx)
ld de,(cury)
dec de
xor a
or d
jr nz,overflow
ld (cury),de
call w_pixeladdress
; ld h,d
; ld l,e
ex af,af
pop de
;pop bc
;@@@@@@@@@@
scf
ret
; in: de - address
; exit : carry = moved off screen
; de = new screen address one pixel up
; uses : af, de
.incy
;@@@@@@@@@@
;Go to next line
;@@@@@@@@@@
;push bc
push de
ex af,af
ld hl,(curx)
ld de,(cury)
inc de
; TODO: overflow check
ld (cury),de
call w_pixeladdress
;ld h,d
;ld l,e
ex af,af
pop de
;pop bc
;@@@@@@@@@@
scf
ret
;#define TEST_UP_DOWN \
;if (y > 0) { \
; if (point(xs, y - 1)) is_above = 1; \
; else if (is_above) { \
; is_above = 0; \
; ws1->xs = xs; \
; ws1->y = y - 1; \
; ws1++; \
; indeks_ws1++; \
; }; \
;} \
;if (y < 191) { \
; if (point(xs, y + 1)) is_below = 1; \
; else if (is_below) { \
; is_below = 0; \
; ws1->xs = xs; \
; ws1->y = y + 1; \
; ws1++; \
; indeks_ws1++; \
; } \
;}
;struct segment {
; int xs;
; int y;
;};
;struct segment sline[2 * 2 * 512 + 4];
;struct segment *ws1 = sline;
;int indeks_ws1 = 0;
;void
;seg(int xs, int y)
;{
; int txs = xs;
; char is_above = 1;
; char is_below = 1;
; for(; xs > 0; xs--) {
; if (point(xs, y)) break;
; plot(xs, y);
; TEST_UP_DOWN;
; }
; xs = txs;
; if (xs == 511) return;
; ++xs;
; for (; xs < 511; xs++) {
; if (point(xs, y)) return;
; plot(xs, y);
; TEST_UP_DOWN;
; }
;}
;void
;fill3(int x, int y)
;{
; char l;
; int indeks;
; struct segment *W;
; int semafor = 1;
;
; ws1 = sline;
; indeks_ws1 = 0;
; seg(x, y);
; while (indeks_ws1 != 0) {
; W = ws1;
; indeks = indeks_ws1;
; indeks_ws1 = 0;
; if (semafor == 1) {
; semafor = 0;
; ws1 = &sline[2 * 256 + 2];
; } else {
; semafor = 1;
; ws1 = sline;
; }
; while ((indeks--) > 0) {
; W--;
; seg(W->xs, W->y);
; }
; }
;}
;main()
;{
; clg();
; drawb(20, 20, 260, 120);
; fill(128, 128);
;}
SECTION bss_clib
.ws1 defw 0
.index defw 0
.curx defw 0
.cury defw 0
|
programs/oeis/179/A179020.asm | jmorken/loda | 1 | 2585 | <gh_stars>1-10
; A179020: Doubled Thue-Morse sequence: the A010059 sequence replacing 0 with 0,0 and 1 with 1,1.
; 1,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0
div $0,2
lpb $0
add $1,$0
div $0,2
lpe
gcd $1,2
sub $1,1
|
timewithtickets.asm | snowman789/xv6_scheduler | 0 | 95631 |
_timewithtickets: file format elf32-i386
Disassembly of section .text:
00000000 <yield_forever>:
#define MAX_CHILDREN 32
#define LARGE_TICKET_COUNT 100000
#define MAX_YIELDS_FOR_SETUP 100
__attribute__((noreturn))
void yield_forever() {
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 08 sub $0x8,%esp
while (1) {
yield();
6: e8 40 06 00 00 call 64b <yield>
b: eb f9 jmp 6 <yield_forever+0x6>
0000000d <run_forever>:
}
}
__attribute__((noreturn))
void run_forever() {
d: 55 push %ebp
e: 89 e5 mov %esp,%ebp
while (1) {
__asm__("");
10: eb fe jmp 10 <run_forever+0x3>
00000012 <spawn>:
}
}
int spawn(int tickets) {
12: 55 push %ebp
13: 89 e5 mov %esp,%ebp
15: 53 push %ebx
16: 83 ec 04 sub $0x4,%esp
int pid = fork();
19: e8 85 05 00 00 call 5a3 <fork>
if (pid == 0) {
1e: 85 c0 test %eax,%eax
20: 74 0e je 30 <spawn+0x1e>
22: 89 c3 mov %eax,%ebx
#ifdef USE_YIELD
yield_forever();
#else
run_forever();
#endif
} else if (pid != -1) {
24: 83 f8 ff cmp $0xffffffff,%eax
27: 74 1c je 45 <spawn+0x33>
return pid;
} else {
printf(2, "error in fork\n");
return -1;
}
}
29: 89 d8 mov %ebx,%eax
2b: 8b 5d fc mov -0x4(%ebp),%ebx
2e: c9 leave
2f: c3 ret
settickets(tickets);
30: 83 ec 0c sub $0xc,%esp
33: ff 75 08 pushl 0x8(%ebp)
36: e8 30 06 00 00 call 66b <settickets>
yield();
3b: e8 0b 06 00 00 call 64b <yield>
run_forever();
40: e8 c8 ff ff ff call d <run_forever>
printf(2, "error in fork\n");
45: 83 ec 08 sub $0x8,%esp
48: 68 d0 09 00 00 push $0x9d0
4d: 6a 02 push $0x2
4f: e8 c1 06 00 00 call 715 <printf>
return -1;
54: 83 c4 10 add $0x10,%esp
57: eb d0 jmp 29 <spawn+0x17>
00000059 <find_index_of_pid>:
int find_index_of_pid(int *list, int list_size, int pid) {
59: 55 push %ebp
5a: 89 e5 mov %esp,%ebp
5c: 53 push %ebx
5d: 8b 5d 08 mov 0x8(%ebp),%ebx
60: 8b 55 0c mov 0xc(%ebp),%edx
63: 8b 4d 10 mov 0x10(%ebp),%ecx
for (int i = 0; i < list_size; ++i) {
66: b8 00 00 00 00 mov $0x0,%eax
6b: 39 d0 cmp %edx,%eax
6d: 7d 0a jge 79 <find_index_of_pid+0x20>
if (list[i] == pid)
6f: 39 0c 83 cmp %ecx,(%ebx,%eax,4)
72: 74 0a je 7e <find_index_of_pid+0x25>
for (int i = 0; i < list_size; ++i) {
74: 83 c0 01 add $0x1,%eax
77: eb f2 jmp 6b <find_index_of_pid+0x12>
return i;
}
return -1;
79: b8 ff ff ff ff mov $0xffffffff,%eax
}
7e: 5b pop %ebx
7f: 5d pop %ebp
80: c3 ret
00000081 <wait_for_ticket_counts>:
void wait_for_ticket_counts(int num_children, int *pids, int *tickets) {
81: 55 push %ebp
82: 89 e5 mov %esp,%ebp
84: 57 push %edi
85: 56 push %esi
86: 53 push %ebx
87: 81 ec 2c 03 00 00 sub $0x32c,%esp
8d: 8b 75 0c mov 0xc(%ebp),%esi
90: 8b 7d 10 mov 0x10(%ebp),%edi
for (int yield_count = 0; yield_count < MAX_YIELDS_FOR_SETUP; ++yield_count) {
93: c7 85 d0 fc ff ff 00 movl $0x0,-0x330(%ebp)
9a: 00 00 00
9d: 83 bd d0 fc ff ff 63 cmpl $0x63,-0x330(%ebp)
a4: 7f 6c jg 112 <wait_for_ticket_counts+0x91>
yield();
a6: e8 a0 05 00 00 call 64b <yield>
int done = 1;
struct processes_info info;
getprocessesinfo(&info);
ab: 83 ec 0c sub $0xc,%esp
ae: 8d 85 e4 fc ff ff lea -0x31c(%ebp),%eax
b4: 50 push %eax
b5: e8 b9 05 00 00 call 673 <getprocessesinfo>
for (int i = 0; i < num_children; ++i) {
ba: 83 c4 10 add $0x10,%esp
bd: bb 00 00 00 00 mov $0x0,%ebx
int done = 1;
c2: c7 85 d4 fc ff ff 01 movl $0x1,-0x32c(%ebp)
c9: 00 00 00
for (int i = 0; i < num_children; ++i) {
cc: eb 03 jmp d1 <wait_for_ticket_counts+0x50>
ce: 83 c3 01 add $0x1,%ebx
d1: 3b 5d 08 cmp 0x8(%ebp),%ebx
d4: 7d 33 jge 109 <wait_for_ticket_counts+0x88>
int index = find_index_of_pid(info.pids, info.num_processes, pids[i]);
d6: 83 ec 04 sub $0x4,%esp
d9: ff 34 9e pushl (%esi,%ebx,4)
dc: ff b5 e4 fc ff ff pushl -0x31c(%ebp)
e2: 8d 85 e8 fc ff ff lea -0x318(%ebp),%eax
e8: 50 push %eax
e9: e8 6b ff ff ff call 59 <find_index_of_pid>
ee: 83 c4 10 add $0x10,%esp
if (info.tickets[index] != tickets[i]) done = 0;
f1: 8b 14 9f mov (%edi,%ebx,4),%edx
f4: 39 94 85 e8 fe ff ff cmp %edx,-0x118(%ebp,%eax,4)
fb: 74 d1 je ce <wait_for_ticket_counts+0x4d>
fd: c7 85 d4 fc ff ff 00 movl $0x0,-0x32c(%ebp)
104: 00 00 00
107: eb c5 jmp ce <wait_for_ticket_counts+0x4d>
}
if (done)
109: 83 bd d4 fc ff ff 00 cmpl $0x0,-0x32c(%ebp)
110: 74 08 je 11a <wait_for_ticket_counts+0x99>
break;
}
}
112: 8d 65 f4 lea -0xc(%ebp),%esp
115: 5b pop %ebx
116: 5e pop %esi
117: 5f pop %edi
118: 5d pop %ebp
119: c3 ret
for (int yield_count = 0; yield_count < MAX_YIELDS_FOR_SETUP; ++yield_count) {
11a: 83 85 d0 fc ff ff 01 addl $0x1,-0x330(%ebp)
121: e9 77 ff ff ff jmp 9d <wait_for_ticket_counts+0x1c>
00000126 <main>:
int main(int argc, char *argv[])
{
126: 8d 4c 24 04 lea 0x4(%esp),%ecx
12a: 83 e4 f0 and $0xfffffff0,%esp
12d: ff 71 fc pushl -0x4(%ecx)
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 57 push %edi
134: 56 push %esi
135: 53 push %ebx
136: 51 push %ecx
137: 81 ec 28 07 00 00 sub $0x728,%esp
13d: 8b 31 mov (%ecx),%esi
13f: 8b 79 04 mov 0x4(%ecx),%edi
if (argc < 3) {
142: 83 fe 02 cmp $0x2,%esi
145: 7e 33 jle 17a <main+0x54>
argv[0]);
exit();
}
int tickets_for[MAX_CHILDREN];
int active_pids[MAX_CHILDREN];
int num_seconds = atoi(argv[1]);
147: 83 ec 0c sub $0xc,%esp
14a: ff 77 04 pushl 0x4(%edi)
14d: e8 fb 03 00 00 call 54d <atoi>
152: 89 85 d4 f8 ff ff mov %eax,-0x72c(%ebp)
int num_children = argc - 2;
158: 83 ee 02 sub $0x2,%esi
if (num_children > MAX_CHILDREN) {
15b: 83 c4 10 add $0x10,%esp
15e: 83 fe 20 cmp $0x20,%esi
161: 7f 2d jg 190 <main+0x6a>
printf(2, "only up to %d supported\n", MAX_CHILDREN);
exit();
}
/* give us a lot of ticket so we don't get starved */
settickets(LARGE_TICKET_COUNT);
163: 83 ec 0c sub $0xc,%esp
166: 68 a0 86 01 00 push $0x186a0
16b: e8 fb 04 00 00 call 66b <settickets>
for (int i = 0; i < num_children; ++i) {
170: 83 c4 10 add $0x10,%esp
173: bb 00 00 00 00 mov $0x0,%ebx
178: eb 54 jmp 1ce <main+0xa8>
printf(2, "usage: %s seconds tickets1 tickets2 ... ticketsN\n"
17a: 83 ec 04 sub $0x4,%esp
17d: ff 37 pushl (%edi)
17f: 68 28 0a 00 00 push $0xa28
184: 6a 02 push $0x2
186: e8 8a 05 00 00 call 715 <printf>
exit();
18b: e8 1b 04 00 00 call 5ab <exit>
printf(2, "only up to %d supported\n", MAX_CHILDREN);
190: 83 ec 04 sub $0x4,%esp
193: 6a 20 push $0x20
195: 68 df 09 00 00 push $0x9df
19a: 6a 02 push $0x2
19c: e8 74 05 00 00 call 715 <printf>
exit();
1a1: e8 05 04 00 00 call 5ab <exit>
int tickets = atoi(argv[i + 2]);
1a6: 83 ec 0c sub $0xc,%esp
1a9: ff 74 9f 08 pushl 0x8(%edi,%ebx,4)
1ad: e8 9b 03 00 00 call 54d <atoi>
tickets_for[i] = tickets;
1b2: 89 84 9d 68 ff ff ff mov %eax,-0x98(%ebp,%ebx,4)
active_pids[i] = spawn(tickets);
1b9: 89 04 24 mov %eax,(%esp)
1bc: e8 51 fe ff ff call 12 <spawn>
1c1: 89 84 9d e8 fe ff ff mov %eax,-0x118(%ebp,%ebx,4)
for (int i = 0; i < num_children; ++i) {
1c8: 83 c3 01 add $0x1,%ebx
1cb: 83 c4 10 add $0x10,%esp
1ce: 39 f3 cmp %esi,%ebx
1d0: 7c d4 jl 1a6 <main+0x80>
}
wait_for_ticket_counts(num_children, active_pids, tickets_for);
1d2: 83 ec 04 sub $0x4,%esp
1d5: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax
1db: 50 push %eax
1dc: 8d 85 e8 fe ff ff lea -0x118(%ebp),%eax
1e2: 50 push %eax
1e3: 56 push %esi
1e4: e8 98 fe ff ff call 81 <wait_for_ticket_counts>
struct processes_info before, after;
before.num_processes = after.num_processes = -1;
1e9: c7 85 e0 f8 ff ff ff movl $0xffffffff,-0x720(%ebp)
1f0: ff ff ff
1f3: c7 85 e4 fb ff ff ff movl $0xffffffff,-0x41c(%ebp)
1fa: ff ff ff
getprocessesinfo(&before);
1fd: 8d 85 e4 fb ff ff lea -0x41c(%ebp),%eax
203: 89 04 24 mov %eax,(%esp)
206: e8 68 04 00 00 call 673 <getprocessesinfo>
sleep(num_seconds);
20b: 83 c4 04 add $0x4,%esp
20e: ff b5 d4 f8 ff ff pushl -0x72c(%ebp)
214: e8 22 04 00 00 call 63b <sleep>
getprocessesinfo(&after);
219: 8d 85 e0 f8 ff ff lea -0x720(%ebp),%eax
21f: 89 04 24 mov %eax,(%esp)
222: e8 4c 04 00 00 call 673 <getprocessesinfo>
for (int i = 0; i < num_children; ++i) {
227: 83 c4 10 add $0x10,%esp
22a: bb 00 00 00 00 mov $0x0,%ebx
22f: eb 15 jmp 246 <main+0x120>
kill(active_pids[i]);
231: 83 ec 0c sub $0xc,%esp
234: ff b4 9d e8 fe ff ff pushl -0x118(%ebp,%ebx,4)
23b: e8 9b 03 00 00 call 5db <kill>
for (int i = 0; i < num_children; ++i) {
240: 83 c3 01 add $0x1,%ebx
243: 83 c4 10 add $0x10,%esp
246: 39 f3 cmp %esi,%ebx
248: 7c e7 jl 231 <main+0x10b>
}
for (int i = 0; i < num_children; ++i) {
24a: bb 00 00 00 00 mov $0x0,%ebx
24f: eb 08 jmp 259 <main+0x133>
wait();
251: e8 5d 03 00 00 call 5b3 <wait>
for (int i = 0; i < num_children; ++i) {
256: 83 c3 01 add $0x1,%ebx
259: 39 f3 cmp %esi,%ebx
25b: 7c f4 jl 251 <main+0x12b>
}
if (before.num_processes >= NPROC || after.num_processes >= NPROC) {
25d: 8b 85 e4 fb ff ff mov -0x41c(%ebp),%eax
263: 83 f8 3f cmp $0x3f,%eax
266: 7f 27 jg 28f <main+0x169>
268: 8b 95 e0 f8 ff ff mov -0x720(%ebp),%edx
26e: 83 fa 3f cmp $0x3f,%edx
271: 7f 1c jg 28f <main+0x169>
printf(2, "getprocessesinfo's num_processes is greater than NPROC before parent slept\n");
return 1;
}
if (before.num_processes < 0 || after.num_processes < 0) {
273: 85 c0 test %eax,%eax
275: 78 04 js 27b <main+0x155>
277: 85 d2 test %edx,%edx
279: 79 37 jns 2b2 <main+0x18c>
printf(2, "getprocessesinfo's num_processes is negative -- not changed by syscall?\n");
27b: 83 ec 08 sub $0x8,%esp
27e: 68 20 0b 00 00 push $0xb20
283: 6a 02 push $0x2
285: e8 8b 04 00 00 call 715 <printf>
return 1;
28a: 83 c4 10 add $0x10,%esp
28d: eb 12 jmp 2a1 <main+0x17b>
printf(2, "getprocessesinfo's num_processes is greater than NPROC before parent slept\n");
28f: 83 ec 08 sub $0x8,%esp
292: 68 d4 0a 00 00 push $0xad4
297: 6a 02 push $0x2
299: e8 77 04 00 00 call 715 <printf>
return 1;
29e: 83 c4 10 add $0x10,%esp
}
printf(1, "%d\t%d\n", tickets_for[i], after.times_scheduled[after_index] - before.times_scheduled[before_index]);
}
}
exit();
}
2a1: b8 01 00 00 00 mov $0x1,%eax
2a6: 8d 65 f0 lea -0x10(%ebp),%esp
2a9: 59 pop %ecx
2aa: 5b pop %ebx
2ab: 5e pop %esi
2ac: 5f pop %edi
2ad: 5d pop %ebp
2ae: 8d 61 fc lea -0x4(%ecx),%esp
2b1: c3 ret
printf(1, "TICKETS\tTIMES SCHEDULED\n");
2b2: 83 ec 08 sub $0x8,%esp
2b5: 68 f8 09 00 00 push $0x9f8
2ba: 6a 01 push $0x1
2bc: e8 54 04 00 00 call 715 <printf>
for (int i = 0; i < num_children; ++i) {
2c1: 83 c4 10 add $0x10,%esp
2c4: bb 00 00 00 00 mov $0x0,%ebx
2c9: e9 c8 00 00 00 jmp 396 <main+0x270>
int before_index = find_index_of_pid(before.pids, before.num_processes, active_pids[i]);
2ce: 8b bc 9d e8 fe ff ff mov -0x118(%ebp,%ebx,4),%edi
2d5: 83 ec 04 sub $0x4,%esp
2d8: 57 push %edi
2d9: ff b5 e4 fb ff ff pushl -0x41c(%ebp)
2df: 8d 85 e8 fb ff ff lea -0x418(%ebp),%eax
2e5: 50 push %eax
2e6: e8 6e fd ff ff call 59 <find_index_of_pid>
2eb: 83 c4 0c add $0xc,%esp
2ee: 89 85 d4 f8 ff ff mov %eax,-0x72c(%ebp)
int after_index = find_index_of_pid(after.pids, after.num_processes, active_pids[i]);
2f4: 57 push %edi
2f5: ff b5 e0 f8 ff ff pushl -0x720(%ebp)
2fb: 8d 85 e4 f8 ff ff lea -0x71c(%ebp),%eax
301: 50 push %eax
302: e8 52 fd ff ff call 59 <find_index_of_pid>
307: 83 c4 10 add $0x10,%esp
30a: 89 c7 mov %eax,%edi
if (before_index == -1)
30c: 83 bd d4 f8 ff ff ff cmpl $0xffffffff,-0x72c(%ebp)
313: 0f 84 8a 00 00 00 je 3a3 <main+0x27d>
if (after_index == -1)
319: 83 ff ff cmp $0xffffffff,%edi
31c: 0f 84 99 00 00 00 je 3bb <main+0x295>
if (before_index == -1 || after_index == -1) {
322: 83 bd d4 f8 ff ff ff cmpl $0xffffffff,-0x72c(%ebp)
329: 0f 94 c2 sete %dl
32c: 83 ff ff cmp $0xffffffff,%edi
32f: 0f 94 c0 sete %al
332: 08 c2 or %al,%dl
334: 0f 85 99 00 00 00 jne 3d3 <main+0x2ad>
if (before.tickets[before_index] != tickets_for[i]) {
33a: 8b 85 d4 f8 ff ff mov -0x72c(%ebp),%eax
340: 8b 94 9d 68 ff ff ff mov -0x98(%ebp,%ebx,4),%edx
347: 39 94 85 e8 fd ff ff cmp %edx,-0x218(%ebp,%eax,4)
34e: 0f 85 9a 00 00 00 jne 3ee <main+0x2c8>
if (after.tickets[after_index] != tickets_for[i]) {
354: 8b 84 9d 68 ff ff ff mov -0x98(%ebp,%ebx,4),%eax
35b: 39 84 bd e4 fa ff ff cmp %eax,-0x51c(%ebp,%edi,4)
362: 0f 85 9e 00 00 00 jne 406 <main+0x2e0>
printf(1, "%d\t%d\n", tickets_for[i], after.times_scheduled[after_index] - before.times_scheduled[before_index]);
368: 8b 84 bd e4 f9 ff ff mov -0x61c(%ebp,%edi,4),%eax
36f: 8b 95 d4 f8 ff ff mov -0x72c(%ebp),%edx
375: 2b 84 95 e8 fc ff ff sub -0x318(%ebp,%edx,4),%eax
37c: 50 push %eax
37d: ff b4 9d 68 ff ff ff pushl -0x98(%ebp,%ebx,4)
384: 68 21 0a 00 00 push $0xa21
389: 6a 01 push $0x1
38b: e8 85 03 00 00 call 715 <printf>
390: 83 c4 10 add $0x10,%esp
for (int i = 0; i < num_children; ++i) {
393: 83 c3 01 add $0x1,%ebx
396: 39 f3 cmp %esi,%ebx
398: 0f 8c 30 ff ff ff jl 2ce <main+0x1a8>
exit();
39e: e8 08 02 00 00 call 5ab <exit>
printf(2, "child %d did not exist for getprocessesinfo before parent slept\n", i);
3a3: 83 ec 04 sub $0x4,%esp
3a6: 53 push %ebx
3a7: 68 6c 0b 00 00 push $0xb6c
3ac: 6a 02 push $0x2
3ae: e8 62 03 00 00 call 715 <printf>
3b3: 83 c4 10 add $0x10,%esp
3b6: e9 5e ff ff ff jmp 319 <main+0x1f3>
printf(2, "child %d did not exist for getprocessesinfo after parent slept\n", i);
3bb: 83 ec 04 sub $0x4,%esp
3be: 53 push %ebx
3bf: 68 b0 0b 00 00 push $0xbb0
3c4: 6a 02 push $0x2
3c6: e8 4a 03 00 00 call 715 <printf>
3cb: 83 c4 10 add $0x10,%esp
3ce: e9 4f ff ff ff jmp 322 <main+0x1fc>
printf(1, "%d\t--unknown--\n", tickets_for[i]);
3d3: 83 ec 04 sub $0x4,%esp
3d6: ff b4 9d 68 ff ff ff pushl -0x98(%ebp,%ebx,4)
3dd: 68 11 0a 00 00 push $0xa11
3e2: 6a 01 push $0x1
3e4: e8 2c 03 00 00 call 715 <printf>
3e9: 83 c4 10 add $0x10,%esp
3ec: eb a5 jmp 393 <main+0x26d>
printf(2, "child %d had wrong number of tickets in getprocessinfo before parent slept\n", i);
3ee: 83 ec 04 sub $0x4,%esp
3f1: 53 push %ebx
3f2: 68 f0 0b 00 00 push $0xbf0
3f7: 6a 02 push $0x2
3f9: e8 17 03 00 00 call 715 <printf>
3fe: 83 c4 10 add $0x10,%esp
401: e9 4e ff ff ff jmp 354 <main+0x22e>
printf(2, "child %d had wrong number of tickets in getprocessinfo after parent slept\n", i);
406: 83 ec 04 sub $0x4,%esp
409: 53 push %ebx
40a: 68 3c 0c 00 00 push $0xc3c
40f: 6a 02 push $0x2
411: e8 ff 02 00 00 call 715 <printf>
416: 83 c4 10 add $0x10,%esp
419: e9 4a ff ff ff jmp 368 <main+0x242>
0000041e <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
41e: 55 push %ebp
41f: 89 e5 mov %esp,%ebp
421: 53 push %ebx
422: 8b 45 08 mov 0x8(%ebp),%eax
425: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
428: 89 c2 mov %eax,%edx
42a: 0f b6 19 movzbl (%ecx),%ebx
42d: 88 1a mov %bl,(%edx)
42f: 8d 52 01 lea 0x1(%edx),%edx
432: 8d 49 01 lea 0x1(%ecx),%ecx
435: 84 db test %bl,%bl
437: 75 f1 jne 42a <strcpy+0xc>
;
return os;
}
439: 5b pop %ebx
43a: 5d pop %ebp
43b: c3 ret
0000043c <strcmp>:
int
strcmp(const char *p, const char *q)
{
43c: 55 push %ebp
43d: 89 e5 mov %esp,%ebp
43f: 8b 4d 08 mov 0x8(%ebp),%ecx
442: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
445: eb 06 jmp 44d <strcmp+0x11>
p++, q++;
447: 83 c1 01 add $0x1,%ecx
44a: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
44d: 0f b6 01 movzbl (%ecx),%eax
450: 84 c0 test %al,%al
452: 74 04 je 458 <strcmp+0x1c>
454: 3a 02 cmp (%edx),%al
456: 74 ef je 447 <strcmp+0xb>
return (uchar)*p - (uchar)*q;
458: 0f b6 c0 movzbl %al,%eax
45b: 0f b6 12 movzbl (%edx),%edx
45e: 29 d0 sub %edx,%eax
}
460: 5d pop %ebp
461: c3 ret
00000462 <strlen>:
uint
strlen(const char *s)
{
462: 55 push %ebp
463: 89 e5 mov %esp,%ebp
465: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
468: ba 00 00 00 00 mov $0x0,%edx
46d: eb 03 jmp 472 <strlen+0x10>
46f: 83 c2 01 add $0x1,%edx
472: 89 d0 mov %edx,%eax
474: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
478: 75 f5 jne 46f <strlen+0xd>
;
return n;
}
47a: 5d pop %ebp
47b: c3 ret
0000047c <memset>:
void*
memset(void *dst, int c, uint n)
{
47c: 55 push %ebp
47d: 89 e5 mov %esp,%ebp
47f: 57 push %edi
480: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
483: 89 d7 mov %edx,%edi
485: 8b 4d 10 mov 0x10(%ebp),%ecx
488: 8b 45 0c mov 0xc(%ebp),%eax
48b: fc cld
48c: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
48e: 89 d0 mov %edx,%eax
490: 5f pop %edi
491: 5d pop %ebp
492: c3 ret
00000493 <strchr>:
char*
strchr(const char *s, char c)
{
493: 55 push %ebp
494: 89 e5 mov %esp,%ebp
496: 8b 45 08 mov 0x8(%ebp),%eax
499: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
49d: 0f b6 10 movzbl (%eax),%edx
4a0: 84 d2 test %dl,%dl
4a2: 74 09 je 4ad <strchr+0x1a>
if(*s == c)
4a4: 38 ca cmp %cl,%dl
4a6: 74 0a je 4b2 <strchr+0x1f>
for(; *s; s++)
4a8: 83 c0 01 add $0x1,%eax
4ab: eb f0 jmp 49d <strchr+0xa>
return (char*)s;
return 0;
4ad: b8 00 00 00 00 mov $0x0,%eax
}
4b2: 5d pop %ebp
4b3: c3 ret
000004b4 <gets>:
char*
gets(char *buf, int max)
{
4b4: 55 push %ebp
4b5: 89 e5 mov %esp,%ebp
4b7: 57 push %edi
4b8: 56 push %esi
4b9: 53 push %ebx
4ba: 83 ec 1c sub $0x1c,%esp
4bd: 8b 7d 08 mov 0x8(%ebp),%edi
int i, cc;
char c;
for(i=0; i+1 < max; ){
4c0: bb 00 00 00 00 mov $0x0,%ebx
4c5: 8d 73 01 lea 0x1(%ebx),%esi
4c8: 3b 75 0c cmp 0xc(%ebp),%esi
4cb: 7d 2e jge 4fb <gets+0x47>
cc = read(0, &c, 1);
4cd: 83 ec 04 sub $0x4,%esp
4d0: 6a 01 push $0x1
4d2: 8d 45 e7 lea -0x19(%ebp),%eax
4d5: 50 push %eax
4d6: 6a 00 push $0x0
4d8: e8 e6 00 00 00 call 5c3 <read>
if(cc < 1)
4dd: 83 c4 10 add $0x10,%esp
4e0: 85 c0 test %eax,%eax
4e2: 7e 17 jle 4fb <gets+0x47>
break;
buf[i++] = c;
4e4: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
4e8: 88 04 1f mov %al,(%edi,%ebx,1)
if(c == '\n' || c == '\r')
4eb: 3c 0a cmp $0xa,%al
4ed: 0f 94 c2 sete %dl
4f0: 3c 0d cmp $0xd,%al
4f2: 0f 94 c0 sete %al
buf[i++] = c;
4f5: 89 f3 mov %esi,%ebx
if(c == '\n' || c == '\r')
4f7: 08 c2 or %al,%dl
4f9: 74 ca je 4c5 <gets+0x11>
break;
}
buf[i] = '\0';
4fb: c6 04 1f 00 movb $0x0,(%edi,%ebx,1)
return buf;
}
4ff: 89 f8 mov %edi,%eax
501: 8d 65 f4 lea -0xc(%ebp),%esp
504: 5b pop %ebx
505: 5e pop %esi
506: 5f pop %edi
507: 5d pop %ebp
508: c3 ret
00000509 <stat>:
int
stat(const char *n, struct stat *st)
{
509: 55 push %ebp
50a: 89 e5 mov %esp,%ebp
50c: 56 push %esi
50d: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
50e: 83 ec 08 sub $0x8,%esp
511: 6a 00 push $0x0
513: ff 75 08 pushl 0x8(%ebp)
516: e8 d0 00 00 00 call 5eb <open>
if(fd < 0)
51b: 83 c4 10 add $0x10,%esp
51e: 85 c0 test %eax,%eax
520: 78 24 js 546 <stat+0x3d>
522: 89 c3 mov %eax,%ebx
return -1;
r = fstat(fd, st);
524: 83 ec 08 sub $0x8,%esp
527: ff 75 0c pushl 0xc(%ebp)
52a: 50 push %eax
52b: e8 d3 00 00 00 call 603 <fstat>
530: 89 c6 mov %eax,%esi
close(fd);
532: 89 1c 24 mov %ebx,(%esp)
535: e8 99 00 00 00 call 5d3 <close>
return r;
53a: 83 c4 10 add $0x10,%esp
}
53d: 89 f0 mov %esi,%eax
53f: 8d 65 f8 lea -0x8(%ebp),%esp
542: 5b pop %ebx
543: 5e pop %esi
544: 5d pop %ebp
545: c3 ret
return -1;
546: be ff ff ff ff mov $0xffffffff,%esi
54b: eb f0 jmp 53d <stat+0x34>
0000054d <atoi>:
int
atoi(const char *s)
{
54d: 55 push %ebp
54e: 89 e5 mov %esp,%ebp
550: 53 push %ebx
551: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
554: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
559: eb 10 jmp 56b <atoi+0x1e>
n = n*10 + *s++ - '0';
55b: 8d 1c 80 lea (%eax,%eax,4),%ebx
55e: 8d 04 1b lea (%ebx,%ebx,1),%eax
561: 83 c1 01 add $0x1,%ecx
564: 0f be d2 movsbl %dl,%edx
567: 8d 44 02 d0 lea -0x30(%edx,%eax,1),%eax
while('0' <= *s && *s <= '9')
56b: 0f b6 11 movzbl (%ecx),%edx
56e: 8d 5a d0 lea -0x30(%edx),%ebx
571: 80 fb 09 cmp $0x9,%bl
574: 76 e5 jbe 55b <atoi+0xe>
return n;
}
576: 5b pop %ebx
577: 5d pop %ebp
578: c3 ret
00000579 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
579: 55 push %ebp
57a: 89 e5 mov %esp,%ebp
57c: 56 push %esi
57d: 53 push %ebx
57e: 8b 45 08 mov 0x8(%ebp),%eax
581: 8b 5d 0c mov 0xc(%ebp),%ebx
584: 8b 55 10 mov 0x10(%ebp),%edx
char *dst;
const char *src;
dst = vdst;
587: 89 c1 mov %eax,%ecx
src = vsrc;
while(n-- > 0)
589: eb 0d jmp 598 <memmove+0x1f>
*dst++ = *src++;
58b: 0f b6 13 movzbl (%ebx),%edx
58e: 88 11 mov %dl,(%ecx)
590: 8d 5b 01 lea 0x1(%ebx),%ebx
593: 8d 49 01 lea 0x1(%ecx),%ecx
while(n-- > 0)
596: 89 f2 mov %esi,%edx
598: 8d 72 ff lea -0x1(%edx),%esi
59b: 85 d2 test %edx,%edx
59d: 7f ec jg 58b <memmove+0x12>
return vdst;
}
59f: 5b pop %ebx
5a0: 5e pop %esi
5a1: 5d pop %ebp
5a2: c3 ret
000005a3 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
5a3: b8 01 00 00 00 mov $0x1,%eax
5a8: cd 40 int $0x40
5aa: c3 ret
000005ab <exit>:
SYSCALL(exit)
5ab: b8 02 00 00 00 mov $0x2,%eax
5b0: cd 40 int $0x40
5b2: c3 ret
000005b3 <wait>:
SYSCALL(wait)
5b3: b8 03 00 00 00 mov $0x3,%eax
5b8: cd 40 int $0x40
5ba: c3 ret
000005bb <pipe>:
SYSCALL(pipe)
5bb: b8 04 00 00 00 mov $0x4,%eax
5c0: cd 40 int $0x40
5c2: c3 ret
000005c3 <read>:
SYSCALL(read)
5c3: b8 05 00 00 00 mov $0x5,%eax
5c8: cd 40 int $0x40
5ca: c3 ret
000005cb <write>:
SYSCALL(write)
5cb: b8 10 00 00 00 mov $0x10,%eax
5d0: cd 40 int $0x40
5d2: c3 ret
000005d3 <close>:
SYSCALL(close)
5d3: b8 15 00 00 00 mov $0x15,%eax
5d8: cd 40 int $0x40
5da: c3 ret
000005db <kill>:
SYSCALL(kill)
5db: b8 06 00 00 00 mov $0x6,%eax
5e0: cd 40 int $0x40
5e2: c3 ret
000005e3 <exec>:
SYSCALL(exec)
5e3: b8 07 00 00 00 mov $0x7,%eax
5e8: cd 40 int $0x40
5ea: c3 ret
000005eb <open>:
SYSCALL(open)
5eb: b8 0f 00 00 00 mov $0xf,%eax
5f0: cd 40 int $0x40
5f2: c3 ret
000005f3 <mknod>:
SYSCALL(mknod)
5f3: b8 11 00 00 00 mov $0x11,%eax
5f8: cd 40 int $0x40
5fa: c3 ret
000005fb <unlink>:
SYSCALL(unlink)
5fb: b8 12 00 00 00 mov $0x12,%eax
600: cd 40 int $0x40
602: c3 ret
00000603 <fstat>:
SYSCALL(fstat)
603: b8 08 00 00 00 mov $0x8,%eax
608: cd 40 int $0x40
60a: c3 ret
0000060b <link>:
SYSCALL(link)
60b: b8 13 00 00 00 mov $0x13,%eax
610: cd 40 int $0x40
612: c3 ret
00000613 <mkdir>:
SYSCALL(mkdir)
613: b8 14 00 00 00 mov $0x14,%eax
618: cd 40 int $0x40
61a: c3 ret
0000061b <chdir>:
SYSCALL(chdir)
61b: b8 09 00 00 00 mov $0x9,%eax
620: cd 40 int $0x40
622: c3 ret
00000623 <dup>:
SYSCALL(dup)
623: b8 0a 00 00 00 mov $0xa,%eax
628: cd 40 int $0x40
62a: c3 ret
0000062b <getpid>:
SYSCALL(getpid)
62b: b8 0b 00 00 00 mov $0xb,%eax
630: cd 40 int $0x40
632: c3 ret
00000633 <sbrk>:
SYSCALL(sbrk)
633: b8 0c 00 00 00 mov $0xc,%eax
638: cd 40 int $0x40
63a: c3 ret
0000063b <sleep>:
SYSCALL(sleep)
63b: b8 0d 00 00 00 mov $0xd,%eax
640: cd 40 int $0x40
642: c3 ret
00000643 <uptime>:
SYSCALL(uptime)
643: b8 0e 00 00 00 mov $0xe,%eax
648: cd 40 int $0x40
64a: c3 ret
0000064b <yield>:
SYSCALL(yield)
64b: b8 16 00 00 00 mov $0x16,%eax
650: cd 40 int $0x40
652: c3 ret
00000653 <shutdown>:
SYSCALL(shutdown)
653: b8 17 00 00 00 mov $0x17,%eax
658: cd 40 int $0x40
65a: c3 ret
0000065b <writecount>:
SYSCALL(writecount)
65b: b8 18 00 00 00 mov $0x18,%eax
660: cd 40 int $0x40
662: c3 ret
00000663 <setwritecount>:
SYSCALL(setwritecount)
663: b8 19 00 00 00 mov $0x19,%eax
668: cd 40 int $0x40
66a: c3 ret
0000066b <settickets>:
SYSCALL(settickets)
66b: b8 1a 00 00 00 mov $0x1a,%eax
670: cd 40 int $0x40
672: c3 ret
00000673 <getprocessesinfo>:
673: b8 1b 00 00 00 mov $0x1b,%eax
678: cd 40 int $0x40
67a: c3 ret
0000067b <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
67b: 55 push %ebp
67c: 89 e5 mov %esp,%ebp
67e: 83 ec 1c sub $0x1c,%esp
681: 88 55 f4 mov %dl,-0xc(%ebp)
write(fd, &c, 1);
684: 6a 01 push $0x1
686: 8d 55 f4 lea -0xc(%ebp),%edx
689: 52 push %edx
68a: 50 push %eax
68b: e8 3b ff ff ff call 5cb <write>
}
690: 83 c4 10 add $0x10,%esp
693: c9 leave
694: c3 ret
00000695 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
695: 55 push %ebp
696: 89 e5 mov %esp,%ebp
698: 57 push %edi
699: 56 push %esi
69a: 53 push %ebx
69b: 83 ec 2c sub $0x2c,%esp
69e: 89 c7 mov %eax,%edi
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
6a0: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
6a4: 0f 95 c3 setne %bl
6a7: 89 d0 mov %edx,%eax
6a9: c1 e8 1f shr $0x1f,%eax
6ac: 84 c3 test %al,%bl
6ae: 74 10 je 6c0 <printint+0x2b>
neg = 1;
x = -xx;
6b0: f7 da neg %edx
neg = 1;
6b2: c7 45 d4 01 00 00 00 movl $0x1,-0x2c(%ebp)
} else {
x = xx;
}
i = 0;
6b9: be 00 00 00 00 mov $0x0,%esi
6be: eb 0b jmp 6cb <printint+0x36>
neg = 0;
6c0: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
6c7: eb f0 jmp 6b9 <printint+0x24>
do{
buf[i++] = digits[x % base];
6c9: 89 c6 mov %eax,%esi
6cb: 89 d0 mov %edx,%eax
6cd: ba 00 00 00 00 mov $0x0,%edx
6d2: f7 f1 div %ecx
6d4: 89 c3 mov %eax,%ebx
6d6: 8d 46 01 lea 0x1(%esi),%eax
6d9: 0f b6 92 90 0c 00 00 movzbl 0xc90(%edx),%edx
6e0: 88 54 35 d8 mov %dl,-0x28(%ebp,%esi,1)
}while((x /= base) != 0);
6e4: 89 da mov %ebx,%edx
6e6: 85 db test %ebx,%ebx
6e8: 75 df jne 6c9 <printint+0x34>
6ea: 89 c3 mov %eax,%ebx
if(neg)
6ec: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp)
6f0: 74 16 je 708 <printint+0x73>
buf[i++] = '-';
6f2: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1)
6f7: 8d 5e 02 lea 0x2(%esi),%ebx
6fa: eb 0c jmp 708 <printint+0x73>
while(--i >= 0)
putc(fd, buf[i]);
6fc: 0f be 54 1d d8 movsbl -0x28(%ebp,%ebx,1),%edx
701: 89 f8 mov %edi,%eax
703: e8 73 ff ff ff call 67b <putc>
while(--i >= 0)
708: 83 eb 01 sub $0x1,%ebx
70b: 79 ef jns 6fc <printint+0x67>
}
70d: 83 c4 2c add $0x2c,%esp
710: 5b pop %ebx
711: 5e pop %esi
712: 5f pop %edi
713: 5d pop %ebp
714: c3 ret
00000715 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
715: 55 push %ebp
716: 89 e5 mov %esp,%ebp
718: 57 push %edi
719: 56 push %esi
71a: 53 push %ebx
71b: 83 ec 1c sub $0x1c,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
71e: 8d 45 10 lea 0x10(%ebp),%eax
721: 89 45 e4 mov %eax,-0x1c(%ebp)
state = 0;
724: be 00 00 00 00 mov $0x0,%esi
for(i = 0; fmt[i]; i++){
729: bb 00 00 00 00 mov $0x0,%ebx
72e: eb 14 jmp 744 <printf+0x2f>
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
} else {
putc(fd, c);
730: 89 fa mov %edi,%edx
732: 8b 45 08 mov 0x8(%ebp),%eax
735: e8 41 ff ff ff call 67b <putc>
73a: eb 05 jmp 741 <printf+0x2c>
}
} else if(state == '%'){
73c: 83 fe 25 cmp $0x25,%esi
73f: 74 25 je 766 <printf+0x51>
for(i = 0; fmt[i]; i++){
741: 83 c3 01 add $0x1,%ebx
744: 8b 45 0c mov 0xc(%ebp),%eax
747: 0f b6 04 18 movzbl (%eax,%ebx,1),%eax
74b: 84 c0 test %al,%al
74d: 0f 84 23 01 00 00 je 876 <printf+0x161>
c = fmt[i] & 0xff;
753: 0f be f8 movsbl %al,%edi
756: 0f b6 c0 movzbl %al,%eax
if(state == 0){
759: 85 f6 test %esi,%esi
75b: 75 df jne 73c <printf+0x27>
if(c == '%'){
75d: 83 f8 25 cmp $0x25,%eax
760: 75 ce jne 730 <printf+0x1b>
state = '%';
762: 89 c6 mov %eax,%esi
764: eb db jmp 741 <printf+0x2c>
if(c == 'd'){
766: 83 f8 64 cmp $0x64,%eax
769: 74 49 je 7b4 <printf+0x9f>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
76b: 83 f8 78 cmp $0x78,%eax
76e: 0f 94 c1 sete %cl
771: 83 f8 70 cmp $0x70,%eax
774: 0f 94 c2 sete %dl
777: 08 d1 or %dl,%cl
779: 75 63 jne 7de <printf+0xc9>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
77b: 83 f8 73 cmp $0x73,%eax
77e: 0f 84 84 00 00 00 je 808 <printf+0xf3>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
784: 83 f8 63 cmp $0x63,%eax
787: 0f 84 b7 00 00 00 je 844 <printf+0x12f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
78d: 83 f8 25 cmp $0x25,%eax
790: 0f 84 cc 00 00 00 je 862 <printf+0x14d>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
796: ba 25 00 00 00 mov $0x25,%edx
79b: 8b 45 08 mov 0x8(%ebp),%eax
79e: e8 d8 fe ff ff call 67b <putc>
putc(fd, c);
7a3: 89 fa mov %edi,%edx
7a5: 8b 45 08 mov 0x8(%ebp),%eax
7a8: e8 ce fe ff ff call 67b <putc>
}
state = 0;
7ad: be 00 00 00 00 mov $0x0,%esi
7b2: eb 8d jmp 741 <printf+0x2c>
printint(fd, *ap, 10, 1);
7b4: 8b 7d e4 mov -0x1c(%ebp),%edi
7b7: 8b 17 mov (%edi),%edx
7b9: 83 ec 0c sub $0xc,%esp
7bc: 6a 01 push $0x1
7be: b9 0a 00 00 00 mov $0xa,%ecx
7c3: 8b 45 08 mov 0x8(%ebp),%eax
7c6: e8 ca fe ff ff call 695 <printint>
ap++;
7cb: 83 c7 04 add $0x4,%edi
7ce: 89 7d e4 mov %edi,-0x1c(%ebp)
7d1: 83 c4 10 add $0x10,%esp
state = 0;
7d4: be 00 00 00 00 mov $0x0,%esi
7d9: e9 63 ff ff ff jmp 741 <printf+0x2c>
printint(fd, *ap, 16, 0);
7de: 8b 7d e4 mov -0x1c(%ebp),%edi
7e1: 8b 17 mov (%edi),%edx
7e3: 83 ec 0c sub $0xc,%esp
7e6: 6a 00 push $0x0
7e8: b9 10 00 00 00 mov $0x10,%ecx
7ed: 8b 45 08 mov 0x8(%ebp),%eax
7f0: e8 a0 fe ff ff call 695 <printint>
ap++;
7f5: 83 c7 04 add $0x4,%edi
7f8: 89 7d e4 mov %edi,-0x1c(%ebp)
7fb: 83 c4 10 add $0x10,%esp
state = 0;
7fe: be 00 00 00 00 mov $0x0,%esi
803: e9 39 ff ff ff jmp 741 <printf+0x2c>
s = (char*)*ap;
808: 8b 45 e4 mov -0x1c(%ebp),%eax
80b: 8b 30 mov (%eax),%esi
ap++;
80d: 83 c0 04 add $0x4,%eax
810: 89 45 e4 mov %eax,-0x1c(%ebp)
if(s == 0)
813: 85 f6 test %esi,%esi
815: 75 28 jne 83f <printf+0x12a>
s = "(null)";
817: be 88 0c 00 00 mov $0xc88,%esi
81c: 8b 7d 08 mov 0x8(%ebp),%edi
81f: eb 0d jmp 82e <printf+0x119>
putc(fd, *s);
821: 0f be d2 movsbl %dl,%edx
824: 89 f8 mov %edi,%eax
826: e8 50 fe ff ff call 67b <putc>
s++;
82b: 83 c6 01 add $0x1,%esi
while(*s != 0){
82e: 0f b6 16 movzbl (%esi),%edx
831: 84 d2 test %dl,%dl
833: 75 ec jne 821 <printf+0x10c>
state = 0;
835: be 00 00 00 00 mov $0x0,%esi
83a: e9 02 ff ff ff jmp 741 <printf+0x2c>
83f: 8b 7d 08 mov 0x8(%ebp),%edi
842: eb ea jmp 82e <printf+0x119>
putc(fd, *ap);
844: 8b 7d e4 mov -0x1c(%ebp),%edi
847: 0f be 17 movsbl (%edi),%edx
84a: 8b 45 08 mov 0x8(%ebp),%eax
84d: e8 29 fe ff ff call 67b <putc>
ap++;
852: 83 c7 04 add $0x4,%edi
855: 89 7d e4 mov %edi,-0x1c(%ebp)
state = 0;
858: be 00 00 00 00 mov $0x0,%esi
85d: e9 df fe ff ff jmp 741 <printf+0x2c>
putc(fd, c);
862: 89 fa mov %edi,%edx
864: 8b 45 08 mov 0x8(%ebp),%eax
867: e8 0f fe ff ff call 67b <putc>
state = 0;
86c: be 00 00 00 00 mov $0x0,%esi
871: e9 cb fe ff ff jmp 741 <printf+0x2c>
}
}
}
876: 8d 65 f4 lea -0xc(%ebp),%esp
879: 5b pop %ebx
87a: 5e pop %esi
87b: 5f pop %edi
87c: 5d pop %ebp
87d: c3 ret
0000087e <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
87e: 55 push %ebp
87f: 89 e5 mov %esp,%ebp
881: 57 push %edi
882: 56 push %esi
883: 53 push %ebx
884: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
887: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
88a: a1 00 10 00 00 mov 0x1000,%eax
88f: eb 02 jmp 893 <free+0x15>
891: 89 d0 mov %edx,%eax
893: 39 c8 cmp %ecx,%eax
895: 73 04 jae 89b <free+0x1d>
897: 39 08 cmp %ecx,(%eax)
899: 77 12 ja 8ad <free+0x2f>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
89b: 8b 10 mov (%eax),%edx
89d: 39 c2 cmp %eax,%edx
89f: 77 f0 ja 891 <free+0x13>
8a1: 39 c8 cmp %ecx,%eax
8a3: 72 08 jb 8ad <free+0x2f>
8a5: 39 ca cmp %ecx,%edx
8a7: 77 04 ja 8ad <free+0x2f>
8a9: 89 d0 mov %edx,%eax
8ab: eb e6 jmp 893 <free+0x15>
break;
if(bp + bp->s.size == p->s.ptr){
8ad: 8b 73 fc mov -0x4(%ebx),%esi
8b0: 8d 3c f1 lea (%ecx,%esi,8),%edi
8b3: 8b 10 mov (%eax),%edx
8b5: 39 d7 cmp %edx,%edi
8b7: 74 19 je 8d2 <free+0x54>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
8b9: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
8bc: 8b 50 04 mov 0x4(%eax),%edx
8bf: 8d 34 d0 lea (%eax,%edx,8),%esi
8c2: 39 ce cmp %ecx,%esi
8c4: 74 1b je 8e1 <free+0x63>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
8c6: 89 08 mov %ecx,(%eax)
freep = p;
8c8: a3 00 10 00 00 mov %eax,0x1000
}
8cd: 5b pop %ebx
8ce: 5e pop %esi
8cf: 5f pop %edi
8d0: 5d pop %ebp
8d1: c3 ret
bp->s.size += p->s.ptr->s.size;
8d2: 03 72 04 add 0x4(%edx),%esi
8d5: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
8d8: 8b 10 mov (%eax),%edx
8da: 8b 12 mov (%edx),%edx
8dc: 89 53 f8 mov %edx,-0x8(%ebx)
8df: eb db jmp 8bc <free+0x3e>
p->s.size += bp->s.size;
8e1: 03 53 fc add -0x4(%ebx),%edx
8e4: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
8e7: 8b 53 f8 mov -0x8(%ebx),%edx
8ea: 89 10 mov %edx,(%eax)
8ec: eb da jmp 8c8 <free+0x4a>
000008ee <morecore>:
static Header*
morecore(uint nu)
{
8ee: 55 push %ebp
8ef: 89 e5 mov %esp,%ebp
8f1: 53 push %ebx
8f2: 83 ec 04 sub $0x4,%esp
8f5: 89 c3 mov %eax,%ebx
char *p;
Header *hp;
if(nu < 4096)
8f7: 3d ff 0f 00 00 cmp $0xfff,%eax
8fc: 77 05 ja 903 <morecore+0x15>
nu = 4096;
8fe: bb 00 10 00 00 mov $0x1000,%ebx
p = sbrk(nu * sizeof(Header));
903: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax
90a: 83 ec 0c sub $0xc,%esp
90d: 50 push %eax
90e: e8 20 fd ff ff call 633 <sbrk>
if(p == (char*)-1)
913: 83 c4 10 add $0x10,%esp
916: 83 f8 ff cmp $0xffffffff,%eax
919: 74 1c je 937 <morecore+0x49>
return 0;
hp = (Header*)p;
hp->s.size = nu;
91b: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
91e: 83 c0 08 add $0x8,%eax
921: 83 ec 0c sub $0xc,%esp
924: 50 push %eax
925: e8 54 ff ff ff call 87e <free>
return freep;
92a: a1 00 10 00 00 mov 0x1000,%eax
92f: 83 c4 10 add $0x10,%esp
}
932: 8b 5d fc mov -0x4(%ebp),%ebx
935: c9 leave
936: c3 ret
return 0;
937: b8 00 00 00 00 mov $0x0,%eax
93c: eb f4 jmp 932 <morecore+0x44>
0000093e <malloc>:
void*
malloc(uint nbytes)
{
93e: 55 push %ebp
93f: 89 e5 mov %esp,%ebp
941: 53 push %ebx
942: 83 ec 04 sub $0x4,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
945: 8b 45 08 mov 0x8(%ebp),%eax
948: 8d 58 07 lea 0x7(%eax),%ebx
94b: c1 eb 03 shr $0x3,%ebx
94e: 83 c3 01 add $0x1,%ebx
if((prevp = freep) == 0){
951: 8b 0d 00 10 00 00 mov 0x1000,%ecx
957: 85 c9 test %ecx,%ecx
959: 74 04 je 95f <malloc+0x21>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
95b: 8b 01 mov (%ecx),%eax
95d: eb 4d jmp 9ac <malloc+0x6e>
base.s.ptr = freep = prevp = &base;
95f: c7 05 00 10 00 00 04 movl $0x1004,0x1000
966: 10 00 00
969: c7 05 04 10 00 00 04 movl $0x1004,0x1004
970: 10 00 00
base.s.size = 0;
973: c7 05 08 10 00 00 00 movl $0x0,0x1008
97a: 00 00 00
base.s.ptr = freep = prevp = &base;
97d: b9 04 10 00 00 mov $0x1004,%ecx
982: eb d7 jmp 95b <malloc+0x1d>
if(p->s.size >= nunits){
if(p->s.size == nunits)
984: 39 da cmp %ebx,%edx
986: 74 1a je 9a2 <malloc+0x64>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
988: 29 da sub %ebx,%edx
98a: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
98d: 8d 04 d0 lea (%eax,%edx,8),%eax
p->s.size = nunits;
990: 89 58 04 mov %ebx,0x4(%eax)
}
freep = prevp;
993: 89 0d 00 10 00 00 mov %ecx,0x1000
return (void*)(p + 1);
999: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
99c: 83 c4 04 add $0x4,%esp
99f: 5b pop %ebx
9a0: 5d pop %ebp
9a1: c3 ret
prevp->s.ptr = p->s.ptr;
9a2: 8b 10 mov (%eax),%edx
9a4: 89 11 mov %edx,(%ecx)
9a6: eb eb jmp 993 <malloc+0x55>
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
9a8: 89 c1 mov %eax,%ecx
9aa: 8b 00 mov (%eax),%eax
if(p->s.size >= nunits){
9ac: 8b 50 04 mov 0x4(%eax),%edx
9af: 39 da cmp %ebx,%edx
9b1: 73 d1 jae 984 <malloc+0x46>
if(p == freep)
9b3: 39 05 00 10 00 00 cmp %eax,0x1000
9b9: 75 ed jne 9a8 <malloc+0x6a>
if((p = morecore(nunits)) == 0)
9bb: 89 d8 mov %ebx,%eax
9bd: e8 2c ff ff ff call 8ee <morecore>
9c2: 85 c0 test %eax,%eax
9c4: 75 e2 jne 9a8 <malloc+0x6a>
return 0;
9c6: b8 00 00 00 00 mov $0x0,%eax
9cb: eb cf jmp 99c <malloc+0x5e>
|
libsrc/_DEVELOPMENT/font/fzx/c/sccz80/fzx_string_extent_callee.asm | jpoikela/z88dk | 640 | 23134 |
; uint16_t fzx_string_extent(struct fzx_font *ff, char *s)
SECTION code_font
SECTION code_font_fzx
PUBLIC fzx_string_extent_callee
EXTERN asm_fzx_string_extent
fzx_string_extent_callee:
pop hl
pop de
ex (sp),hl
jp asm_fzx_string_extent
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-veboop.adb | orb-zhuchen/Orb | 0 | 26266 | <reponame>orb-zhuchen/Orb
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . V E C T O R S . B O O L E A N _ O P E R A T I O N S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2002-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body System.Vectors.Boolean_Operations is
SU : constant := Storage_Unit;
-- Convenient short hand, used throughout
-- The coding of this unit depends on the fact that the Component_Size
-- of a normally declared array of Boolean is equal to Storage_Unit. We
-- can't use the Component_Size directly since it is non-static. The
-- following declaration checks that this declaration is correct
type Boolean_Array is array (Integer range <>) of Boolean;
pragma Compile_Time_Error
(Boolean_Array'Component_Size /= SU, "run time compile failure");
-- NOTE: The boolean literals must be qualified here to avoid visibility
-- anomalies when this package is compiled through Rtsfind, in a context
-- that includes a user-defined type derived from boolean.
True_Val : constant Vector := Standard.True'Enum_Rep
+ Standard.True'Enum_Rep * 2**SU
+ Standard.True'Enum_Rep * 2**(SU * 2)
+ Standard.True'Enum_Rep * 2**(SU * 3)
+ Standard.True'Enum_Rep * 2**(SU * 4)
+ Standard.True'Enum_Rep * 2**(SU * 5)
+ Standard.True'Enum_Rep * 2**(SU * 6)
+ Standard.True'Enum_Rep * 2**(SU * 7);
-- This constant represents the bits to be flipped to perform a logical
-- "not" on a vector of booleans, independent of the actual
-- representation of True.
-- The representations of (False, True) are assumed to be zero/one and
-- the maximum number of unpacked booleans per Vector is assumed to be 8.
pragma Assert (Standard.False'Enum_Rep = 0);
pragma Assert (Standard.True'Enum_Rep = 1);
pragma Assert (Vector'Size / Storage_Unit <= 8);
-- The reason we need to do these gymnastics is that no call to
-- Unchecked_Conversion can be made at the library level since this
-- unit is pure. Also a conversion from the array type to the Vector type
-- inside the body of "not" is inefficient because of alignment issues.
-----------
-- "not" --
-----------
function "not" (Item : Vectors.Vector) return Vectors.Vector is
begin
return Item xor True_Val;
end "not";
----------
-- Nand --
----------
function Nand (Left, Right : Boolean) return Boolean is
begin
return not (Left and Right);
end Nand;
function Nand (Left, Right : Vectors.Vector) return Vectors.Vector is
begin
return not (Left and Right);
end Nand;
---------
-- Nor --
---------
function Nor (Left, Right : Boolean) return Boolean is
begin
return not (Left or Right);
end Nor;
function Nor (Left, Right : Vectors.Vector) return Vectors.Vector is
begin
return not (Left or Right);
end Nor;
----------
-- Nxor --
----------
function Nxor (Left, Right : Boolean) return Boolean is
begin
return not (Left xor Right);
end Nxor;
function Nxor (Left, Right : Vectors.Vector) return Vectors.Vector is
begin
return not (Left xor Right);
end Nxor;
end System.Vectors.Boolean_Operations;
|
alloy4fun_models/trashltl/models/5/DWfZP8MSZNoFrbMBb.als | Kaixi26/org.alloytools.alloy | 0 | 2144 | open main
pred idDWfZP8MSZNoFrbMBb_prop6 {
all f : Trash | always f in Trash
}
pred __repair { idDWfZP8MSZNoFrbMBb_prop6 }
check __repair { idDWfZP8MSZNoFrbMBb_prop6 <=> prop6o } |
libsrc/_DEVELOPMENT/arch/sms/SMSlib/z80/asm_SMSlib_isr_mdpad.asm | jpoikela/z88dk | 640 | 90608 | <gh_stars>100-1000
; **************************************************
; SMSlib - C programming library for the SMS/GG
; ( part of devkitSMS - github.com/sverx/devkitSMS )
; **************************************************
INCLUDE "SMSlib_private.inc"
SECTION code_clib
SECTION code_SMSlib
PUBLIC asm_SMSlib_isr_mdpad
EXTERN l_jphl
EXTERN __SMSlib_VDPFlags, __SMSlib_VDPBlank
EXTERN __SMSlib_theLineInterruptHandler
EXTERN __SMSlib_PreviousKeysStatus, __SMSlib_KeysStatus
EXTERN __SMSlib_PreviousMDKeysStatus, __SMSlib_MDKeysStatus
asm_SMSlib_isr_mdpad:
push af
push hl
in a,(VDPStatusPort) ; acknowledge VDP interrupt
ld (__SMSlib_VDPFlags),a
rlca
jr nc, line_interrupt
frame_interrupt:
ld hl,__SMSlib_VDPBlank
ld (hl),1
ld hl,(__SMSlib_KeysStatus)
ld (__SMSlib_PreviousKeysStatus),hl
ld hl,(__SMSlib_MDKeysStatus)
ld (__SMSlib_PreviousMDKeysStatus),hl
ld a,TH_HI
out (IOPortCtrl),a
in a,(IOPortL)
cpl
ld l,a
in a,(IOPortH)
cpl
ld h,a
ld (__SMSlib_KeysStatus),hl
ld a,TH_LO
out (IOPortCtrl),a
in a,(IOPortL)
ld h,0
ld l,a
; hl = MDKeysStatus
and 0x0c
jr z, read
ld l,h
jr set_MDKeysStatus
read:
ld a,l
cpl
and 0x30
ld l,a
ld a,TH_HI
out (IOPortCtrl),a
ld a,TH_LO
out (IOPortCtrl),a
in a,(IOPortL)
and 0x0f
jr nz, set_MDKeysStatus
ld a,TH_HI
out (IOPortCtrl),a
in a,(IOPortL)
cpl
and 0x0f
or l
ld l,a
ld a,TH_LO
out (IOPortCtrl),a
set_MDKeysStatus:
ld (__SMSlib_MDKeysStatus),hl
jr exit
line_interrupt:
push bc
push de
push ix
push iy
ld hl,(__SMSlib_theLineInterruptHandler)
call l_jphl
pop iy
pop ix
pop de
pop bc
exit:
pop hl
pop af
ei
reti
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/a/ac3106a.ada | best08618/asylo | 7 | 17654 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/a/ac3106a.ada<gh_stars>1-10
-- AC3106A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT AN ACTUAL GENERIC IN OUT PARAMETER CAN BE:
-- A) ANY SUBCOMPONENT THAT DOES NOT DEPEND ON A DISCRIMINANT,
-- EVEN IF THE ENCLOSING VARIABLE IS UNCONSTRAINED;
-- B) ANY SUBCOMPONENT OF AN UNCONSTAINED VARIABLE OF A
-- RECORD TYPE IF THE DISCRIMINANTS OF THE
-- VARIABLE DO NOT HAVE DEFAULTS AND THE VARIABLE IS NOT
-- A GENERIC FORMAL IN OUT PARAMETER;
-- C) ANY COMPONENT OF AN OBJECT DESIGNATED BY AN ACCESS
-- VALUE.
-- HISTORY:
-- RJW 11/07/88 CREATED ORIGINAL TEST.
WITH REPORT; USE REPORT;
PROCEDURE AC3106A IS
SUBTYPE INT IS INTEGER RANGE 0 .. 10;
TYPE REC (D : INT := 0) IS RECORD
A : INTEGER := 5;
CASE D IS
WHEN OTHERS =>
V : INTEGER := 5;
END CASE;
END RECORD;
TYPE AR_REC IS ARRAY (1 .. 10) OF REC;
TYPE R_REC IS RECORD
E : REC;
END RECORD;
TYPE A_STRING IS ACCESS STRING;
TYPE A_REC IS ACCESS REC;
TYPE A_AR_REC IS ACCESS AR_REC;
TYPE A_R_REC IS ACCESS R_REC;
TYPE DIS (L : INT := 1) IS RECORD
S : STRING (1 .. L) := "A";
R : REC (L);
AS : A_STRING (1 .. L) := NEW STRING (1 .. L);
AR : A_REC (L) := NEW REC (1);
RC : REC (3);
ARU : A_REC := NEW REC;
V_AR : AR_REC;
V_R : R_REC;
AC_AR : A_AR_REC := NEW AR_REC;
AC_R : A_R_REC := NEW R_REC;
END RECORD;
TYPE A_DIS IS ACCESS DIS;
AD : A_DIS := NEW DIS;
TYPE DIS2 (L : INT) IS RECORD
S : STRING (1 .. L);
R : REC (L);
AS : A_STRING (1 .. L);
AR : A_REC (L);
END RECORD;
X : DIS;
SUBTYPE REC3 IS REC (3);
GENERIC
GREC3 : IN OUT REC3;
PACKAGE PREC3 IS END PREC3;
SUBTYPE REC0 IS REC (0);
GENERIC
GREC0 : IN OUT REC0;
PACKAGE PREC0 IS END PREC0;
GENERIC
GINT : IN OUT INTEGER;
PACKAGE PINT IS END PINT;
GENERIC
GA_REC : IN OUT A_REC;
PACKAGE PA_REC IS END PA_REC;
GENERIC
GAR_REC : IN OUT AR_REC;
PACKAGE PAR_REC IS END PAR_REC;
GENERIC
GR_REC : IN OUT R_REC;
PACKAGE PR_REC IS END PR_REC;
GENERIC
GA_AR_REC : IN OUT A_AR_REC;
PACKAGE PA_AR_REC IS END PA_AR_REC;
GENERIC
GA_R_REC : IN OUT A_R_REC;
PACKAGE PA_R_REC IS END PA_R_REC;
TYPE BUFFER (SIZE : INT) IS RECORD
POS : NATURAL := 0;
VAL : STRING (1 .. SIZE);
END RECORD;
SUBTYPE BUFF_5 IS BUFFER (5);
GENERIC
Y : IN OUT CHARACTER;
PACKAGE P_CHAR IS END P_CHAR;
SUBTYPE STRING5 IS STRING (1 .. 5);
GENERIC
GSTRING : STRING5;
PACKAGE P_STRING IS END P_STRING;
GENERIC
GA_STRING : A_STRING;
PACKAGE P_A_STRING IS END P_A_STRING;
GENERIC
X : IN OUT BUFF_5;
PACKAGE P_BUFF IS
RX : BUFF_5 RENAMES X;
END P_BUFF;
Z : BUFFER (1) := (SIZE => 1, POS =>82, VAL =>"R");
BEGIN
TEST ("AC3106A", "CHECK THE PERMITTED FORMS OF AN ACTUAL " &
"GENERIC IN OUT PARAMETER");
DECLARE -- A)
PACKAGE NPINT3 IS NEW PINT (X.RC.A);
PACKAGE NPINT4 IS NEW PINT (X.RC.V);
PACKAGE NPREC3 IS NEW PREC3 (X.RC);
PACKAGE NPA_REC IS NEW PA_REC (X.ARU);
PACKAGE NPINT5 IS NEW PINT (X.ARU.A);
PACKAGE NPINT6 IS NEW PINT (X.ARU.V);
PACKAGE NPAR_REC IS NEW PAR_REC (X.V_AR);
PACKAGE NPREC01 IS NEW PREC0 (X.V_AR (1));
PACKAGE NPR_REC IS NEW PR_REC (X.V_R);
PACKAGE NPREC02 IS NEW PREC0 (X.V_R.E);
PACKAGE NPINT7 IS NEW PINT (X.V_R.E.A);
PACKAGE NP_BUFF IS NEW P_BUFF (Z);
USE NP_BUFF;
PACKAGE NP_CHAR3 IS NEW P_CHAR (RX.VAL (1));
PROCEDURE PROC (X : IN OUT BUFFER) IS
PACKAGE NP_CHAR4 IS NEW P_CHAR (X.VAL (1));
BEGIN
NULL;
END;
BEGIN
NULL;
END; -- A)
DECLARE -- B)
PROCEDURE PROC (Y : IN OUT DIS2) IS
PACKAGE NP_STRING IS NEW P_STRING (Y.S);
PACKAGE NP_CHAR IS NEW P_CHAR (Y.S (1));
PACKAGE NP_A_STRING IS NEW P_A_STRING (Y.AS);
PACKAGE NP_CHAR2 IS NEW P_CHAR (Y.AS (1));
PACKAGE NPINT3 IS NEW PINT (Y.R.A);
PACKAGE NPINT4 IS NEW PINT (Y.R.V);
PACKAGE NPREC3 IS NEW PREC3 (Y.R);
PACKAGE NPA_REC IS NEW PA_REC (Y.AR);
PACKAGE NPINT5 IS NEW PINT (Y.AR.A);
PACKAGE NPINT6 IS NEW PINT (Y.AR.V);
BEGIN
NULL;
END;
BEGIN
NULL;
END; -- B)
DECLARE -- C)
PACKAGE NP_CHAR IS NEW P_CHAR (AD.S (1));
PACKAGE NP_A_STRING IS NEW P_A_STRING (AD.AS);
PACKAGE NP_CHAR2 IS NEW P_CHAR (AD.AS (1));
PACKAGE NPINT3 IS NEW PINT (AD.R.A);
PACKAGE NPINT4 IS NEW PINT (AD.R.V);
PACKAGE NPREC3 IS NEW PREC3 (AD.R);
PACKAGE NPA_REC IS NEW PA_REC (AD.AR);
PACKAGE NPINT5 IS NEW PINT (AD.AR.A);
PACKAGE NPINT6 IS NEW PINT (AD.AR.V);
BEGIN
NULL;
END; -- C)
RESULT;
END AC3106A;
|
src/Ellumination.Protobuf.Antlr/Proto.g4 | mwpowellhtx/Ellumination.Protobuf | 0 | 6354 | <filename>src/Ellumination.Protobuf.Antlr/Proto.g4
// http://github.com/tunnelvisionlabs/antlr4cs
// http://github.com/antlr/antlr4/blob/master/doc/csharp-target.md#how-do-i-create-and-run-a-custom-listener
// http://developers.google.com/protocol-buffers/docs/reference/proto2-spec
// http://github.com/antlr/antlr4/blob/master/doc/lexer-rules.md
// http://github.com/antlr/antlr4/blob/master/doc/parser-rules.md
// http://community.esri.com/thread/182866-mismatch-between-the-processor-architecture-of-the-project-being-built-msil-and-the-processor-architecture-of-the-reference-oracledataaccess
// http://stackoverflow.com/questions/47752764/there-was-a-mismatch-between-the-processor-architecture-of-the-project-being-bui
// http://stackoverflow.com/questions/10113532/how-do-i-fix-the-visual-studio-compile-error-mismatch-between-processor-archit
// http://stackoverflow.com/questions/39958165/antlr4-how-can-i-match-end-of-lines-inside-multiline-comments
// http://stackoverflow.com/questions/12898052/antlr-how-to-skip-multiline-comments
// This grammar supports a subset of the Protocol Buffers Version 2. We support up to but not
// including the Service declaration, RPC, or Streams. This is the extent of the support we
// require for what we are trying to accomplish with this project. If additional elements, code
// generation, etc, are required, we will gladly consider Pull Requests for said functionality
// aligned with our licensing model.
/*
http://developers.google.com/protocol-buffers/docs/reference/proto2-spec
http://developers.google.com/protocol-buffers/docs/proto
| alternation
() grouping
[] option (zero or one time)
{} repetition (any number of times)
*/
grammar Proto;
// LEXER RULES //////////////////////////////////////////////////////////////////////////
ENUM: 'enum';
EXTEND: 'extend';
EXTENSIONS: 'extensions';
GROUP: 'group';
IMPORT: 'import';
OPTION: 'option';
MAP: 'map';
MESSAGE: 'message';
ONEOF: 'oneof';
PACKAGE: 'package';
RESERVED: 'reserved';
SYNTAX: 'syntax';
//RPC: 'rpc';
//SERVICE: 'service';
//RETURNS: 'returns';
//STREAM: 'stream';
MAX: 'max';
OPTIONAL: 'optional';
PUBLIC: 'public';
REPEATED: 'repeated';
REQUIRED: 'required';
TO: 'to';
WEAK: 'weak';
BOOL: 'bool';
BYTES: 'bytes';
DOUBLE: 'double';
FIXED32: 'fixed32';
FIXED64: 'fixed64';
FLOAT: 'float';
INT32: 'int32';
INT64: 'int64';
SFIXED32: 'sfixed32';
SFIXED64: 'sfixed64';
SINT32: 'sint32';
SINT64: 'sint64';
STRING: 'string';
UINT32: 'uint32';
UINT64: 'uint64';
FALSE_LIT: 'false';
INF: 'inf';
NAN: 'nan';
//PROTO2: 'proto2';
TRUE_LIT: 'true';
MULTI_LINE_COMMENT: LML .*? RML -> channel(HIDDEN);
SINGLE_LINE_COMMENT: SL ~[\r\n]* -> channel(HIDDEN);
// Whitespace.
WS: ( SP | HT | VT )+ -> channel(HIDDEN);
// NEWLINE : '\r'? '\n' { {System.out.println("Newlines so far: " + (++counter)); } };
NL: CR? LF -> channel(HIDDEN);
// Define some punctuation lexer rules.
QUOT: QUOT_MARK;
TICK: TICK_MARK;
// Open, or Left, such and such.
LANGLE: '<';
LCURLY: '{';
LPAREN: '(';
LSQUARE: '[';
// Close, or Right, such and such.
RANGLE: '>';
RCURLY: '}';
RPAREN: ')';
RSQUARE: ']';
COMMA: ',';
EOS: ';';
EQU: '=';
DOT: PERIOD;
SIGN: SIGNAGE;
/*
decimalLit = ( "1" ... "9" ) { decimalDigit }
octalLit = "0" { octalDigit }
hexLit = "0" ( "x" | "X" ) hexDigit { hexDigit }
*/
DEC_LIT: ZED | DEC_DIG_19 DEC_DIG*;
HEX_LIT: ZED X HEX_DIG+;
OCT_LIT: ZED OCT_DIG*;
/*
// Lexer is the way to go with this rule.
// It is better for us to capture the Infinity and Not-a-Number cases separately
// as "first-class" Parser Rules, not that Lexer Rules are not ("first-class").
floatLit = "inf" | "nan" | (
decimals "." [ decimals ] [ exponent ]
| decimals exponent
| "." decimals [ exponent ] )
// We will just use the ANTLR4 operators here, not worth a definition for any multiples.
decimals = decimalDigit { decimalDigit }
*/
FLOAT_LIT:
DEC_DIG+ PERIOD DEC_DIG* EXPONENT?
| DEC_DIG+ EXPONENT
| PERIOD DEC_DIG+ EXPONENT?
;
/*
// Supports both cases:
ident = letter { letter | decimalDigit | "_" }
groupName = capitalLetter { letter | decimalDigit | "_" }
// Group Name requires validation during the Listener AST synthesis phase.
*/
IDENT: LET ( LET | DEC_DIG | UNDERSCORE )*;
STR_LIT: QUOT_STR_LIT | TICK_STR_LIT;
// Required in order to not silently drop unexpected characters.
ERROR_CHAR: . -> channel(HIDDEN);
// Open and close, or Left and Right, Multi-Line comment.
fragment LML: '/*';
fragment RML: '*/';
// Single-Line comment.
fragment SL: '//';
// Carriage Return, Line Feed.
fragment CR: '\r';
fragment LF: '\n';
// Space.
fragment SP: ' ';
// Tab, or Horizontal Tab.
fragment HT: '\t';
// Form Feed, or Vertical Tab.
fragment VT: '\f';
// decimalDigit = "0" ... "9"
// octalDigit = "0" ... "7"
// hexDigit = "0" ... "9" | "A" ... "F" | "a" ... "f"
fragment DEC_DIG: [0-9];
fragment DEC_DIG_19: [1-9];
fragment OCT_DIG: [0-7];
fragment OCT_DIG_03: [0-3];
fragment HEX_DIG: [0-9a-zA-Z];
fragment SIGNAGE: [+-];
fragment EXP: [Ee];
// exponent = ( "e" | "E" ) [ "+" | "-" ] decimals
fragment EXPONENT: EXP SIGNAGE? DEC_DIG+;
fragment PERIOD: '.';
// letter = "A" ... "Z" | "a" ... "z"
fragment LET: [a-zA-Z];
fragment UNDERSCORE: '_';
// capitalLetter = "A" ... "Z"
fragment CAP_LET: [A-Z];
fragment ZED: [0];
fragment X: [Xx];
fragment ESC_START: '\\';
fragment ESC_SEQ:
ESC_START ( 'a' | 'v' | 'b' | 't' | 'n' | 'f' | 'r' | '?' | '"' | '\'' | '\\' )
| HEX_ESC
//| UNICODE_ESC
| OCT_ESC
;
//// TODO: TBD: is this really Unicode?
//fragment UNICODE_ESC: '\\' 'u' HEX_DIG HEX_DIG HEX_DIG HEX_DIG;
fragment HEX_ESC:
ESC_START X HEX_DIG HEX_DIG
| ESC_START X HEX_DIG
;
fragment OCT_ESC:
ESC_START OCT_DIG_03 OCT_DIG OCT_DIG
| ESC_START OCT_DIG OCT_DIG
| ESC_START OCT_DIG
;
fragment QUOT_MARK: '"';
fragment TICK_MARK: '\'';
/*
strLit = ( "'" { charValue } "'" ) | ( '"' { charValue } '"' )
charValue = hexEscape | octEscape | charEscape | /[^\0\n\\]/
hexEscape = '\' ( "x" | "X" ) hexDigit hexDigit
octEscape = '\' octalDigit octalDigit octalDigit
charEscape = '\' ( "a" | "b" | "f" | "n" | "r" | "t" | "v" | '\' | "'" | '"' )
quote = "'" | '"'
*/
fragment QUOT_STR_LIT: QUOT_MARK ( ESC_SEQ | ~[\\"\r\n] )* QUOT_MARK;
fragment TICK_STR_LIT: TICK_MARK ( ESC_SEQ | ~[\\\'\r\n] )* TICK_MARK;
// PARSER RULES /////////////////////////////////////////////////////////////////////////
// See Lexer Rule comments. Listeners must perform the required Capital Letter validation.
protoDecl: syntaxDecl (
importDecl
| packageDecl
| optionDecl
| topLevelDef
| emptyDecl )* EOF
;
// Not supporting Service for this purpose.
topLevelDef:
messageDecl
| enumDecl
| extendDecl
/*| serviceDecl*/
;
/*
fullIdent = ident { "." ident }
messageName = ident
enumName = ident
fieldName = ident
oneofName = ident
mapName = ident
serviceName = ident
rpcName = ident
streamName = ident
messageType = [ "." ] { ident "." } messageName
enumType = [ "." ] { ident "." } enumName
groupName = capitalLetter { letter | decimalDigit | "_" }
*/
// See Lexer Rule comments.
// FullIdent needs a first class AST in order to tell the difference between that and a string literal.
ident: IDENT;
fullIdent: ident ( DOT ident )*;
// optionName = ( ident | "(" fullIdent ")" ) { "." ident }
groupedOptionNamePrefix: LPAREN fullIdent RPAREN;
singleOptionNamePrefix: ident;
optionNamePrefix: groupedOptionNamePrefix | singleOptionNamePrefix;
optionNameSuffix: ( DOT ident )*;
optionName: optionNamePrefix optionNameSuffix;
// boolLit = "true" | "false"
booleanFalse: FALSE_LIT;
booleanTrue: TRUE_LIT;
booleanLit: booleanFalse | booleanTrue;
// Helps to isolate the issue for the general-purpose <fullident/>.
fullIdentLit: fullIdent;
// Technically the spec does not differentiate + from - Infinity, but we can here.
inf: INF;
nan: NAN;
numericFloatLit: FLOAT_LIT;
floatLit: inf | nan | numericFloatLit;
// Signage does not apply until the Constant Phrase.
signedFloatLit: sign? floatLit;
// intLit = decimalLit | octalLit | hexLit
hexLit: HEX_LIT;
octLit: OCT_LIT;
decLit: DEC_LIT;
// Order still matters!
intLit: hexLit | octLit | decLit;
// Signage does not apply until the Constant Phrase.
sign: SIGN;
signedIntLit: sign? intLit;
// This is probably sufficient. We may need to comprehend whether the enclosing bits were QUOT ('"') or TICK ("'").
strLit: STR_LIT;
// constant = boolLit | fullIdent | ( [ "-" | "+" ] intLit ) | ( [ "-" | "+" ] floatLit ) | strLit
constant: booleanLit | fullIdentLit | signedFloatLit | signedIntLit | strLit;
/*
syntax = "syntax" "=" quote "proto2" quote ";"
// Instead of defining a lexer keyword, let it fall through the String Literal definition.
// Then we handle the issue as a matter of Listener interpretation. The only down side of
// doing it this way is that casual users of the grammar apart from the Listener itself
// need to do some leg work in order validate.
*/
syntaxDecl: SYNTAX EQU strLit EOS;
// import = "import" [ "weak" | "public" ] strLit ";"
importDecl: IMPORT importModifier? strLit EOS;
importModifier: WEAK | PUBLIC;
// emptyStatement = ";"
emptyDecl: EOS;
// package = "package" fullIdent ";"
packageDecl: PACKAGE fullIdent EOS;
/*
option = "option" optionName "=" constant ";"
optionName = ( ident | "(" fullIdent ")" ) { "." ident }
*/
optionDecl: OPTION optionName EQU constant EOS;
/*
message = "message" messageName messageBody
messageBody = "{" { field | enum | message | extend | extensions | group |
option | oneof | mapField | reserved | emptyStatement } "}"
*/
messageDecl: MESSAGE ident messageBody;
messageBody
: LCURLY (
fieldDecl
| enumDecl
| messageDecl
| extendDecl
| extensionsDecl
| groupDecl
| optionDecl
| oneOfDecl
| mapFieldDecl
| reservedDecl
| emptyDecl
)* RCURLY
;
/*
label = "required" | "optional" | "repeated"
type = "double" | "float" | "int32" | "int64" | "uint32" | "uint64" | "sint32" | "sint64"
| "fixed32" | "fixed64" | "sfixed32" | "sfixed64" | "bool" | "string" | "bytes"
| messageType | enumType
*/
label:
REQUIRED
| OPTIONAL
| REPEATED
;
/*
// Should resolve to ProtoType, literally. Type Keywords:
// https://developers.google.com/protocol-buffers/docs/proto#scalar
// https://developers.google.com/protocol-buffers/docs/proto3#scalar
*/
protoType:
DOUBLE
| FLOAT
| INT32
| INT64
| UINT32
| UINT64
| SINT32
| SINT64
| FIXED32
| FIXED64
| SFIXED32
| SFIXED64
| BOOL
| STRING
| BYTES
;
/*
Cannot determine on the first pass whether this is MESSAGE_TYPE or ENUM_TYPE.
This suffers the same context-agnostic issue as with the Boost.Spirir.Qi baesd approach.
There is really no way around this on the first pass.
*/
elementTypeGlobalScope: DOT;
/*
// Technically, the specification is ambiguous, with the "intent" here:
messageType = [ "." ] { ident "." } messageName
enumType = [ "." ] { ident "." } enumName
// However, the ambiguity is that the Parser itself cannot know whether "ident" should be MessageDecl or EnumDecl.
*/
elementType: elementTypeGlobalScope? ( ident DOT )* ident;
// Should resolve to a Variant type.
type: protoType | elementType;
// fieldNumber = intLit
fieldNumber: intLit;
/*
field = label type fieldName "=" fieldNumber [ "[" fieldOptions "]" ] ";"
fieldNumber = intLit
fieldOptions = fieldOption { "," fieldOption }
fieldOption = optionName "=" constant
*/
fieldDecl: label type ident EQU fieldNumber fieldOptions? EOS;
fieldOptions: LSQUARE fieldOption ( COMMA fieldOption )* RSQUARE;
fieldOption: optionName EQU constant;
/*
enum = "enum" enumName enumBody
enumBody = "{" { option | enumField | emptyStatement } "}"
// While we associate an "integer" with the enumField... Rather we want an Ordinal.
enumField = ident "=" intLit [ "[" enumValueOption { "," enumValueOption } "]" ]";"
// ^^^^^^
enumValueOption = optionName "=" constant
*/
enumFieldOrdinal: intLit;
enumDecl: ENUM ident enumBody;
enumBody: LCURLY ( optionDecl | enumFieldDecl | emptyDecl )* RCURLY;
// Or FieldNumber, but IntLit works just fine here.
enumFieldDecl: ident EQU enumFieldOrdinal ( LSQUARE enumValueOptions RSQUARE )? EOS;
enumValueOptions: enumValueOption ( COMMA enumValueOption )*;
enumValueOption: optionName EQU constant;
// extend = "extend" messageType "{" {field | group | emptyStatement} "}"
extendDecl: EXTEND elementType LCURLY ( fieldDecl | groupDecl | emptyDecl )* RCURLY;
// group = label "group" groupName "=" fieldNumber messageBody
groupName: IDENT;
groupDecl: label GROUP groupName EQU fieldNumber messageBody;
/*
extensions = "extensions" ranges ";"
ranges = range { "," range }
*/
extensionsDecl: EXTENSIONS rangesDecl EOS;
rangesDecl: rangeDecl ( COMMA rangeDecl )*;
// Overall: range = intLit [ "to" ( intLit | "max" ) ]
rangeDecl: rangeMinimumLit rangeMaximum?;
rangeMinimumLit: intLit;
// RangeDescriptor.Maximum Phrase: "to" ( intLit | "max" )
rangeMaximum: TO ( rangeMaximumMax | rangeMaximumLit );
rangeMaximumMax: MAX;
rangeMaximumLit: intLit;
/*
oneof = "oneof" oneofName "{" { oneofField | emptyStatement } "}"
oneofField = type fieldName "=" fieldNumber [ "[" fieldOptions "]" ] ";"
*/
oneOfDecl: ONEOF ident LCURLY ( oneOfField | emptyDecl )* RCURLY;
oneOfField: type ident EQU fieldNumber fieldOptions? EOS;
/*
mapField = "map" "<" keyType "," type ">" mapName "=" fieldNumber [ "[" fieldOptions "]" ] ";"
keyType = "int32" | "int64" | "uint32" | "uint64" | "sint32" | "sint64" | "fixed32" | "fixed64"
| "sfixed32" | "sfixed64" | "bool" | "string"
*/
mapFieldDecl: MAP LANGLE keyType COMMA type RANGLE ident EQU fieldNumber fieldOptions? EOS;
keyType:
INT32
| INT64
| UINT32
| UINT64
| SINT32
| SINT64
| FIXED32
| FIXED64
| SFIXED32
| SFIXED64
| BOOL
| STRING
;
/*
reserved = "reserved" ( ranges | fieldNames ) ";"
fieldNames = fieldName { "," fieldName }
*/
// We have to separate these two because we must know the kind of Reserved that it is.
reservedDecl: ( fieldNamesReservedDecl | rangesReservedDecl );
rangesReservedDecl: RESERVED rangesDecl EOS;
fieldNamesReservedDecl: RESERVED fieldNames EOS;
// Turns out this needs to be a First Class Parser Rule after all.
fieldNames: fieldName ( COMMA fieldName )*;
fieldName: ident;
//// TODO: TBD: will not support this for now, it really is not necessary given the Proto I am interested in.
//// TODO: TBD: if I were to more fully support Service, etc, I would refactor some rules in order to better identify the given phrase.
//// TODO: TBD: for instance, in the RPC rule, which messageType (or elementType) do you reduce to an AST, first or second?
//// TODO: TBD: same for STREAM.
//// service = "service" serviceName "{" { option | rpc | stream | emptyStatement } "}"
//serviceDecl:
// SERVICE ident LCURLY ( optionDecl | rpcDecl | streamDecl | emptyDecl )* RCURLY
//;
//// TODO: TBD: to be honest, I'm not sure why they don't simply support the empty body, yet have an end of statement alternative.
//// rpc = "rpc" rpcName "(" [ "stream" ] messageType ")" "returns" "(" [ "stream" ] messageType ")" ( ( "{" { option | emptyStatement } "}" ) | ";" )
//rpcDecl:
// RPC ident LPAREN STREAM? elementType RPAREN
// RETURNS LPAREN STREAM? elementType RPAREN
// ( ( LCURLY ( optionDecl | emptyDecl )* RCURLY ) | EOS )
//;
//// TODO: TBD: similar question here as above...
//// stream = "stream" streamName "(" messageType "," messageType ")" ( ( "{" { option | emptyStatement } "}") | ";" )
//streamDecl:
// STREAM ident LPAREN elementType COMMA elementType RPAREN
// ( ( LCURLY ( optionDecl | emptyDecl )* RCURLY ) | EOS )
//;
|
ioq3/build/release-js-js/missionpack/game/g_main.asm | RawTechnique/quake-port | 1 | 94526 | <reponame>RawTechnique/quake-port
data
align 4
LABELV gameCvarTable
address g_cheats
address $54
address $55
byte 4 0
byte 4 0
byte 4 0
skip 4
byte 4 0
address $56
address $57
byte 4 68
byte 4 0
byte 4 0
skip 4
byte 4 0
address $58
address $59
byte 4 64
byte 4 0
byte 4 0
skip 4
address g_restarted
address $60
address $61
byte 4 64
byte 4 0
byte 4 0
skip 4
address g_gametype
address $62
address $61
byte 4 38
byte 4 0
byte 4 0
skip 4
address g_maxclients
address $63
address $64
byte 4 37
byte 4 0
byte 4 0
skip 4
address g_maxGameClients
address $65
address $61
byte 4 37
byte 4 0
byte 4 0
skip 4
address g_dmflags
address $66
address $61
byte 4 5
byte 4 0
byte 4 1
skip 4
address g_fraglimit
address $67
address $68
byte 4 1029
byte 4 0
byte 4 1
skip 4
address g_timelimit
address $69
address $61
byte 4 1029
byte 4 0
byte 4 1
skip 4
address g_capturelimit
address $70
address $64
byte 4 1029
byte 4 0
byte 4 1
skip 4
address g_synchronousClients
address $71
address $61
byte 4 8
byte 4 0
byte 4 0
skip 4
address g_friendlyFire
address $72
address $61
byte 4 1
byte 4 0
byte 4 1
skip 4
address g_teamAutoJoin
address $73
address $61
byte 4 1
skip 12
address g_teamForceBalance
address $74
address $61
byte 4 1
skip 12
address g_warmup
address $75
address $68
byte 4 1
byte 4 0
byte 4 1
skip 4
address g_doWarmup
address $76
address $61
byte 4 1
byte 4 0
byte 4 1
skip 4
address g_logfile
address $77
address $78
byte 4 1
byte 4 0
byte 4 0
skip 4
address g_logfileSync
address $79
address $61
byte 4 1
byte 4 0
byte 4 0
skip 4
address g_password
address $80
address $55
byte 4 2
byte 4 0
byte 4 0
skip 4
address g_banIPs
address $81
address $55
byte 4 1
byte 4 0
byte 4 0
skip 4
address g_filterBan
address $82
address $83
byte 4 1
byte 4 0
byte 4 0
skip 4
address g_needpass
address $84
address $61
byte 4 68
byte 4 0
byte 4 0
skip 4
address g_dedicated
address $85
address $61
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_speed
address $86
address $87
byte 4 0
byte 4 0
byte 4 1
skip 4
address g_gravity
address $88
address $89
byte 4 0
byte 4 0
byte 4 1
skip 4
address g_knockback
address $90
address $91
byte 4 0
byte 4 0
byte 4 1
skip 4
address g_quadfactor
address $92
address $93
byte 4 0
byte 4 0
byte 4 1
skip 4
address g_weaponRespawn
address $94
address $95
byte 4 0
byte 4 0
byte 4 1
skip 4
address g_weaponTeamRespawn
address $96
address $97
byte 4 0
byte 4 0
byte 4 1
skip 4
address g_forcerespawn
address $98
address $68
byte 4 0
byte 4 0
byte 4 1
skip 4
address g_inactivity
address $99
address $61
byte 4 0
byte 4 0
byte 4 1
skip 4
address g_debugMove
address $100
address $61
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_debugDamage
address $101
address $61
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_debugAlloc
address $102
address $61
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_motd
address $103
address $55
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_blood
address $104
address $83
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_podiumDist
address $105
address $106
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_podiumDrop
address $107
address $108
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_allowVote
address $109
address $83
byte 4 1
byte 4 0
byte 4 0
skip 4
address g_listEntity
address $110
address $61
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_obeliskHealth
address $111
address $112
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_obeliskRegenPeriod
address $113
address $83
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_obeliskRegenAmount
address $114
address $115
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_obeliskRespawnDelay
address $116
address $117
byte 4 4
byte 4 0
byte 4 0
skip 4
address g_cubeTimeout
address $118
address $97
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_redteam
address $119
address $120
byte 4 7
byte 4 0
byte 4 1
byte 4 1
address g_blueteam
address $121
address $122
byte 4 7
byte 4 0
byte 4 1
byte 4 1
address g_singlePlayer
address $123
address $55
byte 4 0
byte 4 0
byte 4 0
byte 4 0
address g_enableDust
address $124
address $61
byte 4 4
byte 4 0
byte 4 1
byte 4 0
address g_enableBreath
address $125
address $61
byte 4 4
byte 4 0
byte 4 1
byte 4 0
address g_proxMineTimeout
address $126
address $127
byte 4 0
byte 4 0
byte 4 0
skip 4
address g_smoothClients
address $128
address $83
byte 4 0
byte 4 0
byte 4 0
skip 4
address pmove_fixed
address $129
address $61
byte 4 8
byte 4 0
byte 4 0
skip 4
address pmove_msec
address $130
address $64
byte 4 8
byte 4 0
byte 4 0
skip 4
address g_rankings
address $131
address $61
byte 4 0
byte 4 0
byte 4 0
skip 4
align 4
LABELV gameCvarTableSize
byte 4 56
export vmMain
code
proc vmMain 16 12
ADDRLP4 0
ADDRFP4 0
INDIRI4
ASGNI4
ADDRLP4 0
INDIRI4
CNSTI4 0
LTI4 $133
ADDRLP4 0
INDIRI4
CNSTI4 10
GTI4 $133
ADDRLP4 0
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 $146
ADDP4
INDIRP4
JUMPV
lit
align 4
LABELV $146
address $135
address $136
address $137
address $141
address $139
address $140
address $142
address $138
address $143
address $144
address $145
code
LABELV $135
ADDRFP4 4
INDIRI4
ARGI4
ADDRFP4 8
INDIRI4
ARGI4
ADDRFP4 12
INDIRI4
ARGI4
ADDRGP4 G_InitGame
CALLV
pop
CNSTI4 0
RETI4
ADDRGP4 $132
JUMPV
LABELV $136
ADDRFP4 4
INDIRI4
ARGI4
ADDRGP4 G_ShutdownGame
CALLV
pop
CNSTI4 0
RETI4
ADDRGP4 $132
JUMPV
LABELV $137
ADDRFP4 4
INDIRI4
ARGI4
ADDRFP4 8
INDIRI4
ARGI4
ADDRFP4 12
INDIRI4
ARGI4
ADDRLP4 4
ADDRGP4 ClientConnect
CALLP4
ASGNP4
ADDRLP4 4
INDIRP4
CVPU4 4
CVUI4 4
RETI4
ADDRGP4 $132
JUMPV
LABELV $138
ADDRFP4 4
INDIRI4
ARGI4
ADDRGP4 ClientThink
CALLV
pop
CNSTI4 0
RETI4
ADDRGP4 $132
JUMPV
LABELV $139
ADDRFP4 4
INDIRI4
ARGI4
ADDRGP4 ClientUserinfoChanged
CALLV
pop
CNSTI4 0
RETI4
ADDRGP4 $132
JUMPV
LABELV $140
ADDRFP4 4
INDIRI4
ARGI4
ADDRGP4 ClientDisconnect
CALLV
pop
CNSTI4 0
RETI4
ADDRGP4 $132
JUMPV
LABELV $141
ADDRFP4 4
INDIRI4
ARGI4
ADDRGP4 ClientBegin
CALLV
pop
CNSTI4 0
RETI4
ADDRGP4 $132
JUMPV
LABELV $142
ADDRFP4 4
INDIRI4
ARGI4
ADDRGP4 ClientCommand
CALLV
pop
CNSTI4 0
RETI4
ADDRGP4 $132
JUMPV
LABELV $143
ADDRFP4 4
INDIRI4
ARGI4
ADDRGP4 G_RunFrame
CALLV
pop
CNSTI4 0
RETI4
ADDRGP4 $132
JUMPV
LABELV $144
ADDRLP4 8
ADDRGP4 ConsoleCommand
CALLI4
ASGNI4
ADDRLP4 8
INDIRI4
RETI4
ADDRGP4 $132
JUMPV
LABELV $145
ADDRFP4 4
INDIRI4
ARGI4
ADDRLP4 12
ADDRGP4 BotAIStartFrame
CALLI4
ASGNI4
ADDRLP4 12
INDIRI4
RETI4
ADDRGP4 $132
JUMPV
LABELV $133
CNSTI4 -1
RETI4
LABELV $132
endproc vmMain 16 12
export G_Printf
proc G_Printf 1028 16
ADDRLP4 0
ADDRFP4 0+4
ASGNP4
ADDRLP4 4
ARGP4
CNSTU4 1024
ARGU4
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 qk_vsnprintf
CALLI4
pop
ADDRLP4 0
CNSTP4 0
ASGNP4
ADDRLP4 4
ARGP4
ADDRGP4 trap_Print
CALLV
pop
LABELV $147
endproc G_Printf 1028 16
export G_Error
proc G_Error 1028 16
ADDRLP4 0
ADDRFP4 0+4
ASGNP4
ADDRLP4 4
ARGP4
CNSTU4 1024
ARGU4
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 qk_vsnprintf
CALLI4
pop
ADDRLP4 0
CNSTP4 0
ASGNP4
ADDRLP4 4
ARGP4
ADDRGP4 trap_Error
CALLV
pop
LABELV $149
endproc G_Error 1028 16
export G_FindTeams
proc G_FindTeams 56 12
ADDRLP4 24
CNSTI4 0
ASGNI4
ADDRLP4 20
ADDRLP4 24
INDIRI4
ASGNI4
ADDRLP4 12
ADDRLP4 24
INDIRI4
ASGNI4
ADDRLP4 16
CNSTI4 1
ASGNI4
ADDRLP4 4
CNSTI4 812
ADDRLP4 16
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ASGNP4
ADDRGP4 $155
JUMPV
LABELV $152
ADDRLP4 4
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
CNSTI4 0
NEI4 $157
ADDRGP4 $153
JUMPV
LABELV $157
ADDRLP4 4
INDIRP4
CNSTI4 652
ADDP4
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $159
ADDRGP4 $153
JUMPV
LABELV $159
ADDRLP4 4
INDIRP4
CNSTI4 536
ADDP4
INDIRI4
CNSTI4 1024
BANDI4
CNSTI4 0
EQI4 $161
ADDRGP4 $153
JUMPV
LABELV $161
ADDRLP4 4
INDIRP4
CNSTI4 776
ADDP4
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 32
CNSTI4 1
ASGNI4
ADDRLP4 20
ADDRLP4 20
INDIRI4
ADDRLP4 32
INDIRI4
ADDI4
ASGNI4
ADDRLP4 12
ADDRLP4 12
INDIRI4
ADDRLP4 32
INDIRI4
ADDI4
ASGNI4
ADDRLP4 8
ADDRLP4 16
INDIRI4
ADDRLP4 32
INDIRI4
ADDI4
ASGNI4
ADDRLP4 0
ADDRLP4 4
INDIRP4
CNSTI4 812
ADDP4
ASGNP4
ADDRGP4 $166
JUMPV
LABELV $163
ADDRLP4 0
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
CNSTI4 0
NEI4 $168
ADDRGP4 $164
JUMPV
LABELV $168
ADDRLP4 0
INDIRP4
CNSTI4 652
ADDP4
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $170
ADDRGP4 $164
JUMPV
LABELV $170
ADDRLP4 0
INDIRP4
CNSTI4 536
ADDP4
INDIRI4
CNSTI4 1024
BANDI4
CNSTI4 0
EQI4 $172
ADDRGP4 $164
JUMPV
LABELV $172
ADDRLP4 36
CNSTI4 652
ASGNI4
ADDRLP4 4
INDIRP4
ADDRLP4 36
INDIRI4
ADDP4
INDIRP4
ARGP4
ADDRLP4 0
INDIRP4
ADDRLP4 36
INDIRI4
ADDP4
INDIRP4
ARGP4
ADDRLP4 40
ADDRGP4 qk_strcmp
CALLI4
ASGNI4
ADDRLP4 40
INDIRI4
CNSTI4 0
NEI4 $174
ADDRLP4 12
ADDRLP4 12
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 44
CNSTI4 772
ASGNI4
ADDRLP4 0
INDIRP4
ADDRLP4 44
INDIRI4
ADDP4
ADDRLP4 4
INDIRP4
ADDRLP4 44
INDIRI4
ADDP4
INDIRP4
ASGNP4
ADDRLP4 4
INDIRP4
CNSTI4 772
ADDP4
ADDRLP4 0
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 776
ADDP4
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 48
ADDRLP4 0
INDIRP4
CNSTI4 536
ADDP4
ASGNP4
ADDRLP4 48
INDIRP4
ADDRLP4 48
INDIRP4
INDIRI4
CNSTI4 1024
BORI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 648
ADDP4
INDIRP4
CVPU4 4
CNSTU4 0
EQU4 $176
ADDRLP4 52
CNSTI4 648
ASGNI4
ADDRLP4 4
INDIRP4
ADDRLP4 52
INDIRI4
ADDP4
ADDRLP4 0
INDIRP4
ADDRLP4 52
INDIRI4
ADDP4
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 648
ADDP4
CNSTP4 0
ASGNP4
LABELV $176
LABELV $174
LABELV $164
ADDRLP4 8
ADDRLP4 8
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 0
ADDRLP4 0
INDIRP4
CNSTI4 812
ADDP4
ASGNP4
LABELV $166
ADDRLP4 8
INDIRI4
ADDRGP4 level+12
INDIRI4
LTI4 $163
LABELV $153
ADDRLP4 16
ADDRLP4 16
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 4
ADDRLP4 4
INDIRP4
CNSTI4 812
ADDP4
ASGNP4
LABELV $155
ADDRLP4 16
INDIRI4
ADDRGP4 level+12
INDIRI4
LTI4 $152
ADDRGP4 $178
ARGP4
ADDRLP4 20
INDIRI4
ARGI4
ADDRLP4 12
INDIRI4
ARGI4
ADDRGP4 G_Printf
CALLV
pop
LABELV $151
endproc G_FindTeams 56 12
export G_RemapTeamShaders
proc G_RemapTeamShaders 1032 16
ADDRLP4 1024
CNSTF4 981668463
ADDRGP4 level+32
INDIRI4
CVIF4 4
MULF4
ASGNF4
ADDRLP4 0
ARGP4
CNSTI4 1024
ARGI4
ADDRGP4 $181
ARGP4
ADDRGP4 g_redteam+16
ARGP4
ADDRGP4 Com_sprintf
CALLI4
pop
ADDRGP4 $183
ARGP4
ADDRLP4 0
ARGP4
ADDRLP4 1024
INDIRF4
ARGF4
ADDRGP4 AddRemap
CALLV
pop
ADDRGP4 $184
ARGP4
ADDRLP4 0
ARGP4
ADDRLP4 1024
INDIRF4
ARGF4
ADDRGP4 AddRemap
CALLV
pop
ADDRLP4 0
ARGP4
CNSTI4 1024
ARGI4
ADDRGP4 $185
ARGP4
ADDRGP4 g_blueteam+16
ARGP4
ADDRGP4 Com_sprintf
CALLI4
pop
ADDRGP4 $187
ARGP4
ADDRLP4 0
ARGP4
ADDRLP4 1024
INDIRF4
ARGF4
ADDRGP4 AddRemap
CALLV
pop
ADDRGP4 $188
ARGP4
ADDRLP4 0
ARGP4
ADDRLP4 1024
INDIRF4
ARGF4
ADDRGP4 AddRemap
CALLV
pop
ADDRLP4 1028
ADDRGP4 BuildShaderStateConfig
CALLP4
ASGNP4
CNSTI4 24
ARGI4
ADDRLP4 1028
INDIRP4
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
LABELV $179
endproc G_RemapTeamShaders 1032 16
export G_RegisterCvars
proc G_RegisterCvars 20 16
ADDRLP4 8
CNSTI4 0
ASGNI4
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRLP4 0
ADDRGP4 gameCvarTable
ASGNP4
ADDRGP4 $193
JUMPV
LABELV $190
ADDRLP4 0
INDIRP4
INDIRP4
ARGP4
ADDRLP4 0
INDIRP4
CNSTI4 4
ADDP4
INDIRP4
ARGP4
ADDRLP4 0
INDIRP4
CNSTI4 8
ADDP4
INDIRP4
ARGP4
ADDRLP4 0
INDIRP4
CNSTI4 12
ADDP4
INDIRI4
ARGI4
ADDRGP4 trap_Cvar_Register
CALLV
pop
ADDRLP4 0
INDIRP4
INDIRP4
CVPU4 4
CNSTU4 0
EQU4 $194
ADDRLP4 0
INDIRP4
CNSTI4 16
ADDP4
ADDRLP4 0
INDIRP4
INDIRP4
CNSTI4 4
ADDP4
INDIRI4
ASGNI4
LABELV $194
ADDRLP4 0
INDIRP4
CNSTI4 24
ADDP4
INDIRI4
CNSTI4 0
EQI4 $196
ADDRLP4 8
CNSTI4 1
ASGNI4
LABELV $196
LABELV $191
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 0
ADDRLP4 0
INDIRP4
CNSTI4 28
ADDP4
ASGNP4
LABELV $193
ADDRLP4 4
INDIRI4
ADDRGP4 gameCvarTableSize
INDIRI4
LTI4 $190
ADDRLP4 8
INDIRI4
CNSTI4 0
EQI4 $198
ADDRGP4 G_RemapTeamShaders
CALLV
pop
LABELV $198
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 0
LTI4 $204
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 8
LTI4 $200
LABELV $204
ADDRGP4 $205
ARGP4
ADDRGP4 g_gametype+12
INDIRI4
ARGI4
ADDRGP4 G_Printf
CALLV
pop
ADDRGP4 $62
ARGP4
ADDRGP4 $61
ARGP4
ADDRGP4 trap_Cvar_Set
CALLV
pop
ADDRGP4 g_gametype
ARGP4
ADDRGP4 trap_Cvar_Update
CALLV
pop
LABELV $200
ADDRGP4 level+352
ADDRGP4 g_warmup+4
INDIRI4
ASGNI4
LABELV $189
endproc G_RegisterCvars 20 16
export G_UpdateCvars
proc G_UpdateCvars 28 12
ADDRLP4 8
CNSTI4 0
ASGNI4
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRLP4 0
ADDRGP4 gameCvarTable
ASGNP4
ADDRGP4 $213
JUMPV
LABELV $210
ADDRLP4 0
INDIRP4
INDIRP4
CVPU4 4
CNSTU4 0
EQU4 $214
ADDRLP4 0
INDIRP4
INDIRP4
ARGP4
ADDRGP4 trap_Cvar_Update
CALLV
pop
ADDRLP4 0
INDIRP4
CNSTI4 16
ADDP4
INDIRI4
ADDRLP4 0
INDIRP4
INDIRP4
CNSTI4 4
ADDP4
INDIRI4
EQI4 $216
ADDRLP4 0
INDIRP4
CNSTI4 16
ADDP4
ADDRLP4 0
INDIRP4
INDIRP4
CNSTI4 4
ADDP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 20
ADDP4
INDIRI4
CNSTI4 0
EQI4 $218
ADDRGP4 $220
ARGP4
ADDRLP4 0
INDIRP4
CNSTI4 4
ADDP4
INDIRP4
ARGP4
ADDRLP4 0
INDIRP4
INDIRP4
CNSTI4 16
ADDP4
ARGP4
ADDRLP4 24
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 -1
ARGI4
ADDRLP4 24
INDIRP4
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
LABELV $218
ADDRLP4 0
INDIRP4
CNSTI4 24
ADDP4
INDIRI4
CNSTI4 0
EQI4 $221
ADDRLP4 8
CNSTI4 1
ASGNI4
LABELV $221
LABELV $216
LABELV $214
LABELV $211
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 0
ADDRLP4 0
INDIRP4
CNSTI4 28
ADDP4
ASGNP4
LABELV $213
ADDRLP4 4
INDIRI4
ADDRGP4 gameCvarTableSize
INDIRI4
LTI4 $210
ADDRLP4 8
INDIRI4
CNSTI4 0
EQI4 $223
ADDRGP4 G_RemapTeamShaders
CALLV
pop
LABELV $223
LABELV $209
endproc G_UpdateCvars 28 12
export G_InitGame
proc G_InitGame 1032 20
ADDRGP4 $226
ARGP4
ADDRGP4 G_Printf
CALLV
pop
ADDRGP4 $227
ARGP4
ADDRGP4 $57
ARGP4
ADDRGP4 G_Printf
CALLV
pop
ADDRGP4 $228
ARGP4
ADDRGP4 $59
ARGP4
ADDRGP4 G_Printf
CALLV
pop
ADDRFP4 4
INDIRI4
CVIU4 4
ARGU4
ADDRGP4 qk_srand
CALLV
pop
ADDRGP4 G_RegisterCvars
CALLV
pop
ADDRGP4 G_ProcessIPBans
CALLV
pop
ADDRGP4 G_InitMemory
CALLV
pop
ADDRGP4 level
ARGP4
CNSTI4 0
ARGI4
CNSTU4 9216
ARGU4
ADDRGP4 qk_memset
CALLP4
pop
ADDRGP4 level+32
ADDRFP4 0
INDIRI4
ASGNI4
ADDRGP4 level+40
ADDRFP4 0
INDIRI4
ASGNI4
ADDRGP4 $232
ARGP4
ADDRLP4 4
ADDRGP4 G_SoundIndex
CALLI4
ASGNI4
ADDRGP4 level+348
ADDRLP4 4
INDIRI4
ASGNI4
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 2
EQI4 $233
ADDRGP4 g_logfile+16
INDIRI1
CVII4 1
CNSTI4 0
EQI4 $233
ADDRGP4 g_logfileSync+12
INDIRI4
CNSTI4 0
EQI4 $237
ADDRGP4 g_logfile+16
ARGP4
ADDRGP4 level+20
ARGP4
CNSTI4 3
ARGI4
ADDRGP4 trap_FS_FOpenFile
CALLI4
pop
ADDRGP4 $238
JUMPV
LABELV $237
ADDRGP4 g_logfile+16
ARGP4
ADDRGP4 level+20
ARGP4
CNSTI4 2
ARGI4
ADDRGP4 trap_FS_FOpenFile
CALLI4
pop
LABELV $238
ADDRGP4 level+20
INDIRI4
CNSTI4 0
NEI4 $244
ADDRGP4 $247
ARGP4
ADDRGP4 g_logfile+16
ARGP4
ADDRGP4 G_Printf
CALLV
pop
ADDRGP4 $234
JUMPV
LABELV $244
ADDRLP4 8
ARGP4
CNSTI4 1024
ARGI4
ADDRGP4 trap_GetServerinfo
CALLV
pop
ADDRGP4 $249
ARGP4
ADDRGP4 G_LogPrintf
CALLV
pop
ADDRGP4 $250
ARGP4
ADDRLP4 8
ARGP4
ADDRGP4 G_LogPrintf
CALLV
pop
ADDRGP4 $234
JUMPV
LABELV $233
ADDRGP4 $251
ARGP4
ADDRGP4 G_Printf
CALLV
pop
LABELV $234
ADDRGP4 G_InitWorldSession
CALLV
pop
ADDRGP4 g_entities
ARGP4
CNSTI4 0
ARGI4
CNSTU4 831488
ARGU4
ADDRGP4 qk_memset
CALLP4
pop
ADDRGP4 level+4
ADDRGP4 g_entities
ASGNP4
ADDRGP4 level+24
ADDRGP4 g_maxclients+12
INDIRI4
ASGNI4
ADDRGP4 g_clients
ARGP4
CNSTI4 0
ARGI4
CNSTU4 54016
ARGU4
ADDRGP4 qk_memset
CALLP4
pop
ADDRGP4 level
ADDRGP4 g_clients
ASGNP4
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $258
JUMPV
LABELV $255
CNSTI4 812
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 g_entities+516
ADDP4
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
ASGNP4
LABELV $256
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $258
ADDRLP4 0
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $255
ADDRGP4 level+12
CNSTI4 64
ASGNI4
ADDRLP4 0
CNSTI4 0
ASGNI4
LABELV $262
CNSTI4 812
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 g_entities+524
ADDP4
ADDRGP4 $267
ASGNP4
LABELV $263
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 0
INDIRI4
CNSTI4 64
LTI4 $262
ADDRGP4 level+4
INDIRP4
ARGP4
ADDRGP4 level+12
INDIRI4
ARGI4
CNSTI4 812
ARGI4
ADDRGP4 level
INDIRP4
ARGP4
CNSTI4 844
ARGI4
ADDRGP4 trap_LocateGameData
CALLV
pop
ADDRGP4 InitBodyQue
CALLV
pop
ADDRGP4 ClearRegisteredItems
CALLV
pop
ADDRGP4 G_SpawnEntitiesFromString
CALLV
pop
ADDRGP4 G_FindTeams
CALLV
pop
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 3
LTI4 $270
ADDRGP4 G_CheckTeamItems
CALLV
pop
LABELV $270
ADDRGP4 SaveRegisteredItems
CALLV
pop
ADDRGP4 $273
ARGP4
ADDRGP4 G_Printf
CALLV
pop
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 2
EQI4 $278
ADDRGP4 $277
ARGP4
ADDRLP4 8
ADDRGP4 trap_Cvar_VariableIntegerValue
CALLI4
ASGNI4
ADDRLP4 8
INDIRI4
CNSTI4 0
EQI4 $274
LABELV $278
ADDRGP4 $279
ARGP4
ADDRGP4 G_ModelIndex
CALLI4
pop
LABELV $274
ADDRGP4 $282
ARGP4
ADDRLP4 12
ADDRGP4 trap_Cvar_VariableIntegerValue
CALLI4
ASGNI4
ADDRLP4 12
INDIRI4
CNSTI4 0
EQI4 $280
ADDRFP4 8
INDIRI4
ARGI4
ADDRGP4 BotAISetup
CALLI4
pop
ADDRFP4 8
INDIRI4
ARGI4
ADDRGP4 BotAILoadMap
CALLI4
pop
ADDRFP4 8
INDIRI4
ARGI4
ADDRGP4 G_InitBots
CALLV
pop
LABELV $280
ADDRGP4 G_RemapTeamShaders
CALLV
pop
LABELV $225
endproc G_InitGame 1032 20
export G_ShutdownGame
proc G_ShutdownGame 4 4
ADDRGP4 $284
ARGP4
ADDRGP4 G_Printf
CALLV
pop
ADDRGP4 level+20
INDIRI4
CNSTI4 0
EQI4 $285
ADDRGP4 $288
ARGP4
ADDRGP4 G_LogPrintf
CALLV
pop
ADDRGP4 $249
ARGP4
ADDRGP4 G_LogPrintf
CALLV
pop
ADDRGP4 level+20
INDIRI4
ARGI4
ADDRGP4 trap_FS_FCloseFile
CALLV
pop
ADDRGP4 level+20
CNSTI4 0
ASGNI4
LABELV $285
ADDRGP4 G_WriteSessionData
CALLV
pop
ADDRGP4 $282
ARGP4
ADDRLP4 0
ADDRGP4 trap_Cvar_VariableIntegerValue
CALLI4
ASGNI4
ADDRLP4 0
INDIRI4
CNSTI4 0
EQI4 $291
ADDRFP4 0
INDIRI4
ARGI4
ADDRGP4 BotAIShutdown
CALLI4
pop
LABELV $291
LABELV $283
endproc G_ShutdownGame 4 4
export Com_Error
proc Com_Error 1028 16
ADDRLP4 0
ADDRFP4 4+4
ASGNP4
ADDRLP4 4
ARGP4
CNSTU4 1024
ARGU4
ADDRFP4 4
INDIRP4
ARGP4
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 qk_vsnprintf
CALLI4
pop
ADDRLP4 0
CNSTP4 0
ASGNP4
ADDRLP4 4
ARGP4
ADDRGP4 trap_Error
CALLV
pop
LABELV $293
endproc Com_Error 1028 16
export Com_Printf
proc Com_Printf 1028 16
ADDRLP4 0
ADDRFP4 0+4
ASGNP4
ADDRLP4 4
ARGP4
CNSTU4 1024
ARGU4
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 qk_vsnprintf
CALLI4
pop
ADDRLP4 0
CNSTP4 0
ASGNP4
ADDRLP4 4
ARGP4
ADDRGP4 trap_Print
CALLV
pop
LABELV $295
endproc Com_Printf 1028 16
export AddTournamentPlayer
proc AddTournamentPlayer 24 8
ADDRGP4 level+80
INDIRI4
CNSTI4 2
LTI4 $298
ADDRGP4 $297
JUMPV
LABELV $298
ADDRGP4 level+9128
INDIRI4
CNSTI4 0
EQI4 $301
ADDRGP4 $297
JUMPV
LABELV $301
ADDRLP4 8
CNSTP4 0
ASGNP4
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRGP4 $307
JUMPV
LABELV $304
ADDRLP4 0
CNSTI4 844
ADDRLP4 4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
EQI4 $309
ADDRGP4 $305
JUMPV
LABELV $309
ADDRLP4 0
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
CNSTI4 3
EQI4 $311
ADDRGP4 $305
JUMPV
LABELV $311
ADDRLP4 0
INDIRP4
CNSTI4 624
ADDP4
INDIRI4
CNSTI4 3
EQI4 $315
ADDRLP4 0
INDIRP4
CNSTI4 628
ADDP4
INDIRI4
CNSTI4 0
GEI4 $313
LABELV $315
ADDRGP4 $305
JUMPV
LABELV $313
ADDRLP4 8
INDIRP4
CVPU4 4
CNSTU4 0
EQU4 $318
ADDRLP4 20
CNSTI4 620
ASGNI4
ADDRLP4 0
INDIRP4
ADDRLP4 20
INDIRI4
ADDP4
INDIRI4
ADDRLP4 8
INDIRP4
ADDRLP4 20
INDIRI4
ADDP4
INDIRI4
LEI4 $316
LABELV $318
ADDRLP4 8
ADDRLP4 0
INDIRP4
ASGNP4
LABELV $316
LABELV $305
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $307
ADDRLP4 4
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $304
ADDRLP4 8
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $319
ADDRGP4 $297
JUMPV
LABELV $319
ADDRGP4 level+16
CNSTI4 -1
ASGNI4
CNSTI4 812
ADDRLP4 8
INDIRP4
CVPU4 4
ADDRGP4 level
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
CNSTI4 844
DIVI4
MULI4
ADDRGP4 g_entities
ADDP4
ARGP4
ADDRGP4 $322
ARGP4
ADDRGP4 SetTeam
CALLV
pop
LABELV $297
endproc AddTournamentPlayer 24 8
export AddTournamentQueue
proc AddTournamentQueue 12 0
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRGP4 $327
JUMPV
LABELV $324
ADDRLP4 0
CNSTI4 844
ADDRLP4 4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 0
EQI4 $329
ADDRLP4 0
INDIRP4
CVPU4 4
ADDRFP4 0
INDIRP4
CVPU4 4
NEU4 $331
ADDRLP4 0
INDIRP4
CNSTI4 620
ADDP4
CNSTI4 0
ASGNI4
ADDRGP4 $332
JUMPV
LABELV $331
ADDRLP4 0
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
CNSTI4 3
NEI4 $333
ADDRLP4 8
ADDRLP4 0
INDIRP4
CNSTI4 620
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $333
LABELV $332
LABELV $329
LABELV $325
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $327
ADDRLP4 4
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $324
LABELV $323
endproc AddTournamentQueue 12 0
export RemoveTournamentLoser
proc RemoveTournamentLoser 4 8
ADDRGP4 level+80
INDIRI4
CNSTI4 2
EQI4 $336
ADDRGP4 $335
JUMPV
LABELV $336
ADDRLP4 0
ADDRGP4 level+84+4
INDIRI4
ASGNI4
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
EQI4 $341
ADDRGP4 $335
JUMPV
LABELV $341
CNSTI4 812
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ARGP4
ADDRGP4 $343
ARGP4
ADDRGP4 SetTeam
CALLV
pop
LABELV $335
endproc RemoveTournamentLoser 4 8
export RemoveTournamentWinner
proc RemoveTournamentWinner 4 8
ADDRGP4 level+80
INDIRI4
CNSTI4 2
EQI4 $345
ADDRGP4 $344
JUMPV
LABELV $345
ADDRLP4 0
ADDRGP4 level+84
INDIRI4
ASGNI4
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
EQI4 $349
ADDRGP4 $344
JUMPV
LABELV $349
CNSTI4 812
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ARGP4
ADDRGP4 $343
ARGP4
ADDRGP4 SetTeam
CALLV
pop
LABELV $344
endproc RemoveTournamentWinner 4 8
export AdjustTournamentScores
proc AdjustTournamentScores 8 4
ADDRLP4 0
ADDRGP4 level+84
INDIRI4
ASGNI4
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
NEI4 $353
ADDRLP4 4
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 632
ADDP4
ASGNP4
ADDRLP4 4
INDIRP4
ADDRLP4 4
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 0
INDIRI4
ARGI4
ADDRGP4 ClientUserinfoChanged
CALLV
pop
LABELV $353
ADDRLP4 0
ADDRGP4 level+84+4
INDIRI4
ASGNI4
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
NEI4 $357
ADDRLP4 4
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 636
ADDP4
ASGNP4
ADDRLP4 4
INDIRP4
ADDRLP4 4
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 0
INDIRI4
ARGI4
ADDRGP4 ClientUserinfoChanged
CALLV
pop
LABELV $357
LABELV $351
endproc AdjustTournamentScores 8 4
export SortRanks
proc SortRanks 40 0
ADDRLP4 8
CNSTI4 844
ASGNI4
ADDRLP4 12
ADDRGP4 level
INDIRP4
ASGNP4
ADDRLP4 0
ADDRLP4 8
INDIRI4
ADDRFP4 0
INDIRP4
INDIRI4
MULI4
ADDRLP4 12
INDIRP4
ADDP4
ASGNP4
ADDRLP4 4
ADDRLP4 8
INDIRI4
ADDRFP4 4
INDIRP4
INDIRI4
MULI4
ADDRLP4 12
INDIRP4
ADDP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 624
ADDP4
INDIRI4
CNSTI4 3
EQI4 $362
ADDRLP4 0
INDIRP4
CNSTI4 628
ADDP4
INDIRI4
CNSTI4 0
GEI4 $360
LABELV $362
CNSTI4 1
RETI4
ADDRGP4 $359
JUMPV
LABELV $360
ADDRLP4 4
INDIRP4
CNSTI4 624
ADDP4
INDIRI4
CNSTI4 3
EQI4 $365
ADDRLP4 4
INDIRP4
CNSTI4 628
ADDP4
INDIRI4
CNSTI4 0
GEI4 $363
LABELV $365
CNSTI4 -1
RETI4
ADDRGP4 $359
JUMPV
LABELV $363
ADDRLP4 0
INDIRP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 1
NEI4 $366
CNSTI4 1
RETI4
ADDRGP4 $359
JUMPV
LABELV $366
ADDRLP4 4
INDIRP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 1
NEI4 $368
CNSTI4 -1
RETI4
ADDRGP4 $359
JUMPV
LABELV $368
ADDRLP4 24
CNSTI4 616
ASGNI4
ADDRLP4 28
CNSTI4 3
ASGNI4
ADDRLP4 0
INDIRP4
ADDRLP4 24
INDIRI4
ADDP4
INDIRI4
ADDRLP4 28
INDIRI4
NEI4 $370
ADDRLP4 4
INDIRP4
ADDRLP4 24
INDIRI4
ADDP4
INDIRI4
ADDRLP4 28
INDIRI4
NEI4 $370
ADDRLP4 32
CNSTI4 620
ASGNI4
ADDRLP4 0
INDIRP4
ADDRLP4 32
INDIRI4
ADDP4
INDIRI4
ADDRLP4 4
INDIRP4
ADDRLP4 32
INDIRI4
ADDP4
INDIRI4
LEI4 $372
CNSTI4 -1
RETI4
ADDRGP4 $359
JUMPV
LABELV $372
ADDRLP4 36
CNSTI4 620
ASGNI4
ADDRLP4 0
INDIRP4
ADDRLP4 36
INDIRI4
ADDP4
INDIRI4
ADDRLP4 4
INDIRP4
ADDRLP4 36
INDIRI4
ADDP4
INDIRI4
GEI4 $374
CNSTI4 1
RETI4
ADDRGP4 $359
JUMPV
LABELV $374
CNSTI4 0
RETI4
ADDRGP4 $359
JUMPV
LABELV $370
ADDRLP4 0
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
CNSTI4 3
NEI4 $376
CNSTI4 1
RETI4
ADDRGP4 $359
JUMPV
LABELV $376
ADDRLP4 4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
CNSTI4 3
NEI4 $378
CNSTI4 -1
RETI4
ADDRGP4 $359
JUMPV
LABELV $378
ADDRLP4 32
CNSTI4 248
ASGNI4
ADDRLP4 0
INDIRP4
ADDRLP4 32
INDIRI4
ADDP4
INDIRI4
ADDRLP4 4
INDIRP4
ADDRLP4 32
INDIRI4
ADDP4
INDIRI4
LEI4 $380
CNSTI4 -1
RETI4
ADDRGP4 $359
JUMPV
LABELV $380
ADDRLP4 36
CNSTI4 248
ASGNI4
ADDRLP4 0
INDIRP4
ADDRLP4 36
INDIRI4
ADDP4
INDIRI4
ADDRLP4 4
INDIRP4
ADDRLP4 36
INDIRI4
ADDP4
INDIRI4
GEI4 $382
CNSTI4 1
RETI4
ADDRGP4 $359
JUMPV
LABELV $382
CNSTI4 0
RETI4
LABELV $359
endproc SortRanks 40 0
export CalculateRanks
proc CalculateRanks 44 16
ADDRGP4 level+340
CNSTI4 -1
ASGNI4
ADDRGP4 level+344
CNSTI4 -1
ASGNI4
ADDRGP4 level+72
CNSTI4 0
ASGNI4
ADDRGP4 level+76
CNSTI4 0
ASGNI4
ADDRGP4 level+80
CNSTI4 0
ASGNI4
ADDRGP4 level+2420
CNSTI4 0
ASGNI4
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $394
JUMPV
LABELV $391
ADDRLP4 0
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+4496
ADDP4
CNSTI4 0
ASGNI4
LABELV $392
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $394
ADDRLP4 0
INDIRI4
CVIU4 4
CNSTU4 2
LTU4 $391
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $401
JUMPV
LABELV $398
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 0
EQI4 $403
ADDRGP4 level+72
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+84
ADDP4
ADDRLP4 0
INDIRI4
ASGNI4
ADDRLP4 20
ADDRGP4 level+72
ASGNP4
ADDRLP4 20
INDIRP4
ADDRLP4 20
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 616
ADDP4
INDIRI4
CNSTI4 3
EQI4 $408
ADDRLP4 24
ADDRGP4 level+76
ASGNP4
ADDRLP4 24
INDIRP4
ADDRLP4 24
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
NEI4 $411
ADDRLP4 28
ADDRGP4 level+80
ASGNP4
ADDRLP4 28
INDIRP4
ADDRLP4 28
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
CNSTI4 812
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 g_entities+208+216
ADDP4
INDIRI4
CNSTI4 8
BANDI4
CNSTI4 0
NEI4 $414
ADDRLP4 32
ADDRGP4 level+2420
ASGNP4
ADDRLP4 32
INDIRP4
ADDRLP4 32
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 616
ADDP4
INDIRI4
CNSTI4 1
NEI4 $419
ADDRLP4 36
ADDRGP4 level+4496
ASGNP4
ADDRLP4 36
INDIRP4
ADDRLP4 36
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRGP4 $420
JUMPV
LABELV $419
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 616
ADDP4
INDIRI4
CNSTI4 2
NEI4 $422
ADDRLP4 40
ADDRGP4 level+4496+4
ASGNP4
ADDRLP4 40
INDIRP4
ADDRLP4 40
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $422
LABELV $420
LABELV $414
ADDRGP4 level+340
INDIRI4
CNSTI4 -1
NEI4 $426
ADDRGP4 level+340
ADDRLP4 0
INDIRI4
ASGNI4
ADDRGP4 $427
JUMPV
LABELV $426
ADDRGP4 level+344
INDIRI4
CNSTI4 -1
NEI4 $430
ADDRGP4 level+344
ADDRLP4 0
INDIRI4
ASGNI4
LABELV $430
LABELV $427
LABELV $411
LABELV $408
LABELV $403
LABELV $399
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $401
ADDRLP4 0
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $398
ADDRGP4 level+84
ARGP4
ADDRGP4 level+72
INDIRI4
CVIU4 4
ARGU4
CNSTU4 4
ARGU4
ADDRGP4 SortRanks
ARGP4
ADDRGP4 qk_qsort
CALLV
pop
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 3
LTI4 $437
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $443
JUMPV
LABELV $440
ADDRLP4 4
CNSTI4 844
ADDRLP4 0
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+84
ADDP4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
ASGNP4
ADDRGP4 level+44+4
INDIRI4
ADDRGP4 level+44+8
INDIRI4
NEI4 $446
ADDRLP4 4
INDIRP4
CNSTI4 256
ADDP4
CNSTI4 2
ASGNI4
ADDRGP4 $447
JUMPV
LABELV $446
ADDRGP4 level+44+4
INDIRI4
ADDRGP4 level+44+8
INDIRI4
LEI4 $452
ADDRLP4 4
INDIRP4
CNSTI4 256
ADDP4
CNSTI4 0
ASGNI4
ADDRGP4 $453
JUMPV
LABELV $452
ADDRLP4 4
INDIRP4
CNSTI4 256
ADDP4
CNSTI4 1
ASGNI4
LABELV $453
LABELV $447
LABELV $441
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $443
ADDRLP4 0
INDIRI4
ADDRGP4 level+72
INDIRI4
LTI4 $440
ADDRGP4 $438
JUMPV
LABELV $437
ADDRLP4 12
CNSTI4 -1
ASGNI4
ADDRLP4 20
CNSTI4 0
ASGNI4
ADDRLP4 16
ADDRLP4 20
INDIRI4
ASGNI4
ADDRLP4 0
ADDRLP4 20
INDIRI4
ASGNI4
ADDRGP4 $461
JUMPV
LABELV $458
ADDRLP4 4
CNSTI4 844
ADDRLP4 0
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+84
ADDP4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
ASGNP4
ADDRLP4 8
ADDRLP4 4
INDIRP4
CNSTI4 248
ADDP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRI4
CNSTI4 0
EQI4 $466
ADDRLP4 8
INDIRI4
ADDRLP4 16
INDIRI4
EQI4 $464
LABELV $466
ADDRLP4 12
ADDRLP4 0
INDIRI4
ASGNI4
CNSTI4 844
ADDRLP4 0
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+84
ADDP4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 256
ADDP4
ADDRLP4 12
INDIRI4
ASGNI4
ADDRGP4 $465
JUMPV
LABELV $464
CNSTI4 844
ADDRLP4 0
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+84-4
ADDP4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 256
ADDP4
ADDRLP4 12
INDIRI4
CNSTI4 16384
BORI4
ASGNI4
CNSTI4 844
ADDRLP4 0
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+84
ADDP4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 256
ADDP4
ADDRLP4 12
INDIRI4
CNSTI4 16384
BORI4
ASGNI4
LABELV $465
ADDRLP4 16
ADDRLP4 8
INDIRI4
ASGNI4
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 2
NEI4 $471
ADDRGP4 level+80
INDIRI4
CNSTI4 1
NEI4 $471
CNSTI4 844
ADDRLP4 0
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+84
ADDP4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 256
ADDP4
ADDRLP4 12
INDIRI4
CNSTI4 16384
BORI4
ASGNI4
LABELV $471
LABELV $459
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $461
ADDRLP4 0
INDIRI4
ADDRGP4 level+80
INDIRI4
LTI4 $458
LABELV $438
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 3
LTI4 $476
ADDRGP4 $479
ARGP4
ADDRGP4 level+44+4
INDIRI4
ARGI4
ADDRLP4 20
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 6
ARGI4
ADDRLP4 20
INDIRP4
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
ADDRGP4 $479
ARGP4
ADDRGP4 level+44+8
INDIRI4
ARGI4
ADDRLP4 24
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 7
ARGI4
ADDRLP4 24
INDIRP4
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
ADDRGP4 $477
JUMPV
LABELV $476
ADDRGP4 level+72
INDIRI4
CNSTI4 0
NEI4 $484
ADDRGP4 $479
ARGP4
CNSTI4 -9999
ARGI4
ADDRLP4 20
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 6
ARGI4
ADDRLP4 20
INDIRP4
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
ADDRGP4 $479
ARGP4
CNSTI4 -9999
ARGI4
ADDRLP4 24
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 7
ARGI4
ADDRLP4 24
INDIRP4
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
ADDRGP4 $485
JUMPV
LABELV $484
ADDRGP4 level+72
INDIRI4
CNSTI4 1
NEI4 $487
ADDRGP4 $479
ARGP4
CNSTI4 844
ADDRGP4 level+84
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 248
ADDP4
INDIRI4
ARGI4
ADDRLP4 20
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 6
ARGI4
ADDRLP4 20
INDIRP4
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
ADDRGP4 $479
ARGP4
CNSTI4 -9999
ARGI4
ADDRLP4 24
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 7
ARGI4
ADDRLP4 24
INDIRP4
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
ADDRGP4 $488
JUMPV
LABELV $487
ADDRGP4 $479
ARGP4
CNSTI4 844
ADDRGP4 level+84
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 248
ADDP4
INDIRI4
ARGI4
ADDRLP4 20
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 6
ARGI4
ADDRLP4 20
INDIRP4
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
ADDRGP4 $479
ARGP4
CNSTI4 844
ADDRGP4 level+84+4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 248
ADDP4
INDIRI4
ARGI4
ADDRLP4 24
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 7
ARGI4
ADDRLP4 24
INDIRP4
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
LABELV $488
LABELV $485
LABELV $477
ADDRGP4 CheckExitRules
CALLV
pop
ADDRGP4 level+9128
INDIRI4
CNSTI4 0
EQI4 $494
ADDRGP4 SendScoreboardMessageToAllClients
CALLV
pop
LABELV $494
LABELV $384
endproc CalculateRanks 44 16
export SendScoreboardMessageToAllClients
proc SendScoreboardMessageToAllClients 4 4
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $501
JUMPV
LABELV $498
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
NEI4 $503
CNSTI4 812
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ARGP4
ADDRGP4 DeathmatchScoreboardMessage
CALLV
pop
LABELV $503
LABELV $499
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $501
ADDRLP4 0
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $498
LABELV $497
endproc SendScoreboardMessageToAllClients 4 4
export MoveClientToIntermission
proc MoveClientToIntermission 0 12
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 624
ADDP4
INDIRI4
CNSTI4 2
NEI4 $506
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 StopFollowing
CALLV
pop
LABELV $506
ADDRGP4 FindIntermissionPoint
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 92
ADDP4
ADDRGP4 level+9144
INDIRB
ASGNB 12
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 20
ADDP4
ADDRGP4 level+9144
INDIRB
ASGNB 12
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 152
ADDP4
ADDRGP4 level+9156
INDIRB
ASGNB 12
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 4
ADDP4
CNSTI4 5
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 312
ADDP4
ARGP4
CNSTI4 0
ARGI4
CNSTU4 64
ARGU4
ADDRGP4 qk_memset
CALLP4
pop
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
CNSTI4 0
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 8
ADDP4
CNSTI4 0
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 4
ADDP4
CNSTI4 0
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 160
ADDP4
CNSTI4 0
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 156
ADDP4
CNSTI4 0
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 180
ADDP4
CNSTI4 0
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 460
ADDP4
CNSTI4 0
ASGNI4
LABELV $505
endproc MoveClientToIntermission 0 12
export FindIntermissionPoint
proc FindIntermissionPoint 32 16
CNSTP4 0
ARGP4
CNSTI4 524
ARGI4
ADDRGP4 $512
ARGP4
ADDRLP4 20
ADDRGP4 G_Find
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 20
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $513
ADDRGP4 vec3_origin
ARGP4
ADDRGP4 level+9144
ARGP4
ADDRGP4 level+9156
ARGP4
CNSTI4 0
ARGI4
ADDRGP4 SelectSpawnPoint
CALLP4
pop
ADDRGP4 $514
JUMPV
LABELV $513
ADDRGP4 level+9144
ADDRLP4 0
INDIRP4
CNSTI4 92
ADDP4
INDIRB
ASGNB 12
ADDRGP4 level+9156
ADDRLP4 0
INDIRP4
CNSTI4 116
ADDP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
CNSTI4 644
ADDP4
INDIRP4
CVPU4 4
CNSTU4 0
EQU4 $519
ADDRLP4 0
INDIRP4
CNSTI4 644
ADDP4
INDIRP4
ARGP4
ADDRLP4 24
ADDRGP4 G_PickTarget
CALLP4
ASGNP4
ADDRLP4 4
ADDRLP4 24
INDIRP4
ASGNP4
ADDRLP4 4
INDIRP4
CVPU4 4
CNSTU4 0
EQU4 $521
ADDRLP4 28
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 8
ADDRLP4 28
INDIRP4
CNSTI4 92
ADDP4
INDIRF4
ADDRGP4 level+9144
INDIRF4
SUBF4
ASGNF4
ADDRLP4 8+4
ADDRLP4 28
INDIRP4
CNSTI4 96
ADDP4
INDIRF4
ADDRGP4 level+9144+4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 8+8
ADDRLP4 4
INDIRP4
CNSTI4 100
ADDP4
INDIRF4
ADDRGP4 level+9144+8
INDIRF4
SUBF4
ASGNF4
ADDRLP4 8
ARGP4
ADDRGP4 level+9156
ARGP4
ADDRGP4 vectoangles
CALLV
pop
LABELV $521
LABELV $519
LABELV $514
LABELV $511
endproc FindIntermissionPoint 32 16
export BeginIntermission
proc BeginIntermission 8 8
ADDRGP4 level+9128
INDIRI4
CNSTI4 0
EQI4 $532
ADDRGP4 $531
JUMPV
LABELV $532
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 1
NEI4 $535
ADDRGP4 AdjustTournamentScores
CALLV
pop
LABELV $535
ADDRGP4 level+9128
ADDRGP4 level+32
INDIRI4
ASGNI4
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRGP4 $543
JUMPV
LABELV $540
ADDRLP4 0
CNSTI4 812
ADDRLP4 4
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
CNSTI4 0
NEI4 $545
ADDRGP4 $541
JUMPV
LABELV $545
ADDRLP4 0
INDIRP4
CNSTI4 728
ADDP4
INDIRI4
CNSTI4 0
GTI4 $547
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 ClientRespawn
CALLV
pop
LABELV $547
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 MoveClientToIntermission
CALLV
pop
LABELV $541
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $543
ADDRLP4 4
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $540
ADDRGP4 g_singlePlayer+12
INDIRI4
CNSTI4 0
EQI4 $549
ADDRGP4 $123
ARGP4
ADDRGP4 $61
ARGP4
ADDRGP4 trap_Cvar_Set
CALLV
pop
ADDRGP4 UpdateTournamentInfo
CALLV
pop
LABELV $549
ADDRGP4 SendScoreboardMessageToAllClients
CALLV
pop
LABELV $531
endproc BeginIntermission 8 8
export ExitLevel
proc ExitLevel 2064 12
ADDRGP4 BotInterbreedEndMatch
CALLV
pop
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 1
NEI4 $553
ADDRGP4 level+68
INDIRI4
CNSTI4 0
NEI4 $552
ADDRGP4 RemoveTournamentLoser
CALLV
pop
CNSTI4 2
ARGI4
ADDRGP4 $559
ARGP4
ADDRGP4 trap_SendConsoleCommand
CALLV
pop
ADDRGP4 level+68
CNSTI4 1
ASGNI4
ADDRGP4 level+9132
CNSTP4 0
ASGNP4
ADDRGP4 level+9128
CNSTI4 0
ASGNI4
ADDRGP4 $552
JUMPV
LABELV $553
ADDRGP4 $563
ARGP4
ADDRLP4 8
ARGP4
CNSTI4 1024
ARGI4
ADDRGP4 trap_Cvar_VariableStringBuffer
CALLV
pop
ADDRGP4 $564
ARGP4
ADDRLP4 1032
ARGP4
CNSTI4 1024
ARGI4
ADDRGP4 trap_Cvar_VariableStringBuffer
CALLV
pop
ADDRLP4 8
ARGP4
ADDRGP4 $567
ARGP4
ADDRLP4 2056
ADDRGP4 Q_stricmp
CALLI4
ASGNI4
ADDRLP4 2056
INDIRI4
CNSTI4 0
NEI4 $565
ADDRLP4 1032
ARGP4
ADDRGP4 $55
ARGP4
ADDRLP4 2060
ADDRGP4 Q_stricmp
CALLI4
ASGNI4
ADDRLP4 2060
INDIRI4
CNSTI4 0
EQI4 $565
ADDRGP4 $563
ARGP4
ADDRGP4 $568
ARGP4
ADDRGP4 trap_Cvar_Set
CALLV
pop
CNSTI4 2
ARGI4
ADDRGP4 $569
ARGP4
ADDRGP4 trap_SendConsoleCommand
CALLV
pop
ADDRGP4 $566
JUMPV
LABELV $565
CNSTI4 2
ARGI4
ADDRGP4 $570
ARGP4
ADDRGP4 trap_SendConsoleCommand
CALLV
pop
LABELV $566
ADDRGP4 level+9132
CNSTP4 0
ASGNP4
ADDRGP4 level+9128
CNSTI4 0
ASGNI4
ADDRGP4 level+44+4
CNSTI4 0
ASGNI4
ADDRGP4 level+44+8
CNSTI4 0
ASGNI4
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $580
JUMPV
LABELV $577
ADDRLP4 4
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
ASGNP4
ADDRLP4 4
INDIRP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
EQI4 $582
ADDRGP4 $578
JUMPV
LABELV $582
ADDRLP4 4
INDIRP4
CNSTI4 248
ADDP4
CNSTI4 0
ASGNI4
LABELV $578
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $580
ADDRLP4 0
INDIRI4
ADDRGP4 g_maxclients+12
INDIRI4
LTI4 $577
ADDRGP4 G_WriteSessionData
CALLV
pop
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $587
JUMPV
LABELV $584
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
NEI4 $589
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 468
ADDP4
CNSTI4 1
ASGNI4
LABELV $589
LABELV $585
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $587
ADDRLP4 0
INDIRI4
ADDRGP4 g_maxclients+12
INDIRI4
LTI4 $584
LABELV $552
endproc ExitLevel 2064 12
export G_LogPrintf
proc G_LogPrintf 1068 24
ADDRLP4 1024
ADDRGP4 level+32
INDIRI4
ADDRGP4 level+40
INDIRI4
SUBI4
CNSTI4 1000
DIVI4
ASGNI4
ADDRLP4 1044
CNSTI4 60
ASGNI4
ADDRLP4 1032
ADDRLP4 1024
INDIRI4
ADDRLP4 1044
INDIRI4
DIVI4
ASGNI4
ADDRLP4 1024
ADDRLP4 1024
INDIRI4
ADDRLP4 1044
INDIRI4
ADDRLP4 1032
INDIRI4
MULI4
SUBI4
ASGNI4
ADDRLP4 1056
CNSTI4 10
ASGNI4
ADDRLP4 1036
ADDRLP4 1024
INDIRI4
ADDRLP4 1056
INDIRI4
DIVI4
ASGNI4
ADDRLP4 1024
ADDRLP4 1024
INDIRI4
ADDRLP4 1056
INDIRI4
ADDRLP4 1036
INDIRI4
MULI4
SUBI4
ASGNI4
ADDRLP4 0
ARGP4
CNSTI4 1024
ARGI4
ADDRGP4 $594
ARGP4
ADDRLP4 1032
INDIRI4
ARGI4
ADDRLP4 1036
INDIRI4
ARGI4
ADDRLP4 1024
INDIRI4
ARGI4
ADDRGP4 Com_sprintf
CALLI4
pop
ADDRLP4 1028
ADDRFP4 0+4
ASGNP4
ADDRLP4 0+7
ARGP4
CNSTU4 1017
ARGU4
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 1028
INDIRP4
ARGP4
ADDRGP4 qk_vsnprintf
CALLI4
pop
ADDRLP4 1028
CNSTP4 0
ASGNP4
ADDRGP4 g_dedicated+12
INDIRI4
CNSTI4 0
EQI4 $597
ADDRGP4 $600
ARGP4
ADDRLP4 0+7
ARGP4
ADDRGP4 G_Printf
CALLV
pop
LABELV $597
ADDRGP4 level+20
INDIRI4
CNSTI4 0
NEI4 $602
ADDRGP4 $591
JUMPV
LABELV $602
ADDRLP4 0
ARGP4
ADDRLP4 1064
ADDRGP4 qk_strlen
CALLU4
ASGNU4
ADDRLP4 0
ARGP4
ADDRLP4 1064
INDIRU4
CVUI4 4
ARGI4
ADDRGP4 level+20
INDIRI4
ARGI4
ADDRGP4 trap_FS_Write
CALLV
pop
LABELV $591
endproc G_LogPrintf 1068 24
export LogExit
proc LogExit 36 20
ADDRLP4 12
CNSTI4 1
ASGNI4
ADDRGP4 $607
ARGP4
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 G_LogPrintf
CALLV
pop
ADDRGP4 level+9124
ADDRGP4 level+32
INDIRI4
ASGNI4
CNSTI4 22
ARGI4
ADDRGP4 $83
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
ADDRLP4 8
ADDRGP4 level+72
INDIRI4
ASGNI4
ADDRLP4 8
INDIRI4
CNSTI4 32
LEI4 $611
ADDRLP4 8
CNSTI4 32
ASGNI4
LABELV $611
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 3
LTI4 $613
ADDRGP4 $616
ARGP4
ADDRGP4 level+44+4
INDIRI4
ARGI4
ADDRGP4 level+44+8
INDIRI4
ARGI4
ADDRGP4 G_LogPrintf
CALLV
pop
LABELV $613
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRGP4 $624
JUMPV
LABELV $621
ADDRLP4 0
CNSTI4 844
ADDRLP4 4
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+84
ADDP4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
CNSTI4 3
NEI4 $626
ADDRGP4 $622
JUMPV
LABELV $626
ADDRLP4 0
INDIRP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 1
NEI4 $628
ADDRGP4 $622
JUMPV
LABELV $628
ADDRLP4 0
INDIRP4
CNSTI4 452
ADDP4
INDIRI4
CNSTI4 999
GEI4 $631
ADDRLP4 20
ADDRLP4 0
INDIRP4
CNSTI4 452
ADDP4
INDIRI4
ASGNI4
ADDRGP4 $632
JUMPV
LABELV $631
ADDRLP4 20
CNSTI4 999
ASGNI4
LABELV $632
ADDRLP4 16
ADDRLP4 20
INDIRI4
ASGNI4
ADDRGP4 $633
ARGP4
ADDRLP4 0
INDIRP4
CNSTI4 248
ADDP4
INDIRI4
ARGI4
ADDRLP4 16
INDIRI4
ARGI4
ADDRLP4 4
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+84
ADDP4
INDIRI4
ARGI4
ADDRLP4 0
INDIRP4
CNSTI4 512
ADDP4
ARGP4
ADDRGP4 G_LogPrintf
CALLV
pop
ADDRGP4 g_singlePlayer+12
INDIRI4
CNSTI4 0
EQI4 $635
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 1
NEI4 $635
ADDRLP4 32
CNSTI4 0
ASGNI4
CNSTI4 812
ADDRLP4 0
INDIRP4
CVPU4 4
ADDRGP4 level
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
CNSTI4 844
DIVI4
MULI4
ADDRGP4 g_entities+208+216
ADDP4
INDIRI4
CNSTI4 8
BANDI4
ADDRLP4 32
INDIRI4
EQI4 $639
ADDRLP4 0
INDIRP4
CNSTI4 256
ADDP4
INDIRI4
ADDRLP4 32
INDIRI4
NEI4 $639
ADDRLP4 12
CNSTI4 0
ASGNI4
LABELV $639
LABELV $635
LABELV $622
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $624
ADDRLP4 4
INDIRI4
ADDRLP4 8
INDIRI4
LTI4 $621
ADDRGP4 g_singlePlayer+12
INDIRI4
CNSTI4 0
EQI4 $643
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 4
LTI4 $646
ADDRGP4 level+44+4
INDIRI4
ADDRGP4 level+44+8
INDIRI4
LEI4 $654
ADDRLP4 16
CNSTI4 1
ASGNI4
ADDRGP4 $655
JUMPV
LABELV $654
ADDRLP4 16
CNSTI4 0
ASGNI4
LABELV $655
ADDRLP4 12
ADDRLP4 16
INDIRI4
ASGNI4
LABELV $646
CNSTI4 2
ARGI4
ADDRLP4 12
INDIRI4
CNSTI4 0
EQI4 $659
ADDRLP4 16
ADDRGP4 $656
ASGNP4
ADDRGP4 $660
JUMPV
LABELV $659
ADDRLP4 16
ADDRGP4 $657
ASGNP4
LABELV $660
ADDRLP4 16
INDIRP4
ARGP4
ADDRGP4 trap_SendConsoleCommand
CALLV
pop
LABELV $643
LABELV $606
endproc LogExit 36 20
export CheckIntermissionExit
proc CheckIntermissionExit 28 0
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 2
NEI4 $662
ADDRGP4 $661
JUMPV
LABELV $662
ADDRLP4 24
CNSTI4 0
ASGNI4
ADDRLP4 16
ADDRLP4 24
INDIRI4
ASGNI4
ADDRLP4 20
ADDRLP4 24
INDIRI4
ASGNI4
ADDRLP4 8
ADDRLP4 24
INDIRI4
ASGNI4
ADDRLP4 12
ADDRLP4 24
INDIRI4
ASGNI4
ADDRLP4 0
ADDRLP4 24
INDIRI4
ASGNI4
ADDRGP4 $668
JUMPV
LABELV $665
ADDRLP4 4
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
ASGNP4
ADDRLP4 4
INDIRP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
EQI4 $670
ADDRGP4 $666
JUMPV
LABELV $670
CNSTI4 812
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 g_entities+208+216
ADDP4
INDIRI4
CNSTI4 8
BANDI4
CNSTI4 0
EQI4 $672
ADDRGP4 $666
JUMPV
LABELV $672
ADDRLP4 12
ADDRLP4 12
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 4
INDIRP4
CNSTI4 644
ADDP4
INDIRI4
CNSTI4 0
EQI4 $676
ADDRLP4 16
ADDRLP4 16
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 0
INDIRI4
CNSTI4 16
GEI4 $677
ADDRLP4 8
ADDRLP4 8
INDIRI4
CNSTI4 1
ADDRLP4 0
INDIRI4
LSHI4
BORI4
ASGNI4
ADDRGP4 $677
JUMPV
LABELV $676
ADDRLP4 20
ADDRLP4 20
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $677
LABELV $666
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $668
ADDRLP4 0
INDIRI4
ADDRGP4 g_maxclients+12
INDIRI4
LTI4 $665
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $683
JUMPV
LABELV $680
ADDRLP4 4
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
ASGNP4
ADDRLP4 4
INDIRP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
EQI4 $685
ADDRGP4 $681
JUMPV
LABELV $685
ADDRLP4 4
INDIRP4
CNSTI4 208
ADDP4
ADDRLP4 8
INDIRI4
ASGNI4
LABELV $681
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $683
ADDRLP4 0
INDIRI4
ADDRGP4 g_maxclients+12
INDIRI4
LTI4 $680
ADDRGP4 level+32
INDIRI4
ADDRGP4 level+9128
INDIRI4
CNSTI4 5000
ADDI4
GEI4 $687
ADDRGP4 $661
JUMPV
LABELV $687
ADDRLP4 12
INDIRI4
CNSTI4 0
LEI4 $691
ADDRLP4 16
INDIRI4
CNSTI4 0
NEI4 $693
ADDRGP4 level+9136
CNSTI4 0
ASGNI4
ADDRGP4 $661
JUMPV
LABELV $693
ADDRLP4 20
INDIRI4
CNSTI4 0
NEI4 $696
ADDRGP4 ExitLevel
CALLV
pop
ADDRGP4 $661
JUMPV
LABELV $696
LABELV $691
ADDRGP4 level+9136
INDIRI4
CNSTI4 0
NEI4 $698
ADDRGP4 level+9136
CNSTI4 1
ASGNI4
ADDRGP4 level+9140
ADDRGP4 level+32
INDIRI4
ASGNI4
LABELV $698
ADDRGP4 level+32
INDIRI4
ADDRGP4 level+9140
INDIRI4
CNSTI4 10000
ADDI4
GEI4 $704
ADDRGP4 $661
JUMPV
LABELV $704
ADDRGP4 ExitLevel
CALLV
pop
LABELV $661
endproc CheckIntermissionExit 28 0
export ScoreIsTied
proc ScoreIsTied 24 0
ADDRGP4 level+80
INDIRI4
CNSTI4 2
GEI4 $709
CNSTI4 0
RETI4
ADDRGP4 $708
JUMPV
LABELV $709
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 3
LTI4 $712
ADDRGP4 level+44+4
INDIRI4
ADDRGP4 level+44+8
INDIRI4
NEI4 $720
ADDRLP4 8
CNSTI4 1
ASGNI4
ADDRGP4 $721
JUMPV
LABELV $720
ADDRLP4 8
CNSTI4 0
ASGNI4
LABELV $721
ADDRLP4 8
INDIRI4
RETI4
ADDRGP4 $708
JUMPV
LABELV $712
ADDRLP4 12
CNSTI4 844
ASGNI4
ADDRLP4 16
ADDRGP4 level
INDIRP4
ASGNP4
ADDRLP4 20
CNSTI4 248
ASGNI4
ADDRLP4 0
ADDRLP4 12
INDIRI4
ADDRGP4 level+84
INDIRI4
MULI4
ADDRLP4 16
INDIRP4
ADDP4
ADDRLP4 20
INDIRI4
ADDP4
INDIRI4
ASGNI4
ADDRLP4 4
ADDRLP4 12
INDIRI4
ADDRGP4 level+84+4
INDIRI4
MULI4
ADDRLP4 16
INDIRP4
ADDP4
ADDRLP4 20
INDIRI4
ADDP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRI4
ADDRLP4 4
INDIRI4
NEI4 $726
ADDRLP4 8
CNSTI4 1
ASGNI4
ADDRGP4 $727
JUMPV
LABELV $726
ADDRLP4 8
CNSTI4 0
ASGNI4
LABELV $727
ADDRLP4 8
INDIRI4
RETI4
LABELV $708
endproc ScoreIsTied 24 0
export CheckExitRules
proc CheckExitRules 20 8
ADDRGP4 level+9128
INDIRI4
CNSTI4 0
EQI4 $729
ADDRGP4 CheckIntermissionExit
CALLV
pop
ADDRGP4 $728
JUMPV
LABELV $729
ADDRGP4 level+9124
INDIRI4
CNSTI4 0
EQI4 $732
ADDRGP4 g_singlePlayer+12
INDIRI4
CNSTI4 0
EQI4 $737
ADDRLP4 12
CNSTI4 5000
ASGNI4
ADDRGP4 $738
JUMPV
LABELV $737
ADDRLP4 12
CNSTI4 1000
ASGNI4
LABELV $738
ADDRLP4 8
ADDRLP4 12
INDIRI4
ASGNI4
ADDRGP4 level+32
INDIRI4
ADDRGP4 level+9124
INDIRI4
SUBI4
ADDRLP4 8
INDIRI4
LTI4 $728
ADDRGP4 level+9124
CNSTI4 0
ASGNI4
ADDRGP4 BeginIntermission
CALLV
pop
ADDRGP4 $728
JUMPV
LABELV $732
ADDRLP4 8
ADDRGP4 ScoreIsTied
CALLI4
ASGNI4
ADDRLP4 8
INDIRI4
CNSTI4 0
EQI4 $744
ADDRGP4 $728
JUMPV
LABELV $744
ADDRLP4 12
CNSTI4 0
ASGNI4
ADDRGP4 g_timelimit+12
INDIRI4
ADDRLP4 12
INDIRI4
EQI4 $746
ADDRGP4 level+16
INDIRI4
ADDRLP4 12
INDIRI4
NEI4 $746
ADDRGP4 level+32
INDIRI4
ADDRGP4 level+40
INDIRI4
SUBI4
CNSTI4 60000
ADDRGP4 g_timelimit+12
INDIRI4
MULI4
LTI4 $750
CNSTI4 -1
ARGI4
ADDRGP4 $755
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
ADDRGP4 $756
ARGP4
ADDRGP4 LogExit
CALLV
pop
ADDRGP4 $728
JUMPV
LABELV $750
LABELV $746
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 4
GEI4 $757
ADDRGP4 g_fraglimit+12
INDIRI4
CNSTI4 0
EQI4 $757
ADDRGP4 level+44+4
INDIRI4
ADDRGP4 g_fraglimit+12
INDIRI4
LTI4 $761
CNSTI4 -1
ARGI4
ADDRGP4 $766
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
ADDRGP4 $767
ARGP4
ADDRGP4 LogExit
CALLV
pop
ADDRGP4 $728
JUMPV
LABELV $761
ADDRGP4 level+44+8
INDIRI4
ADDRGP4 g_fraglimit+12
INDIRI4
LTI4 $768
CNSTI4 -1
ARGI4
ADDRGP4 $773
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
ADDRGP4 $767
ARGP4
ADDRGP4 LogExit
CALLV
pop
ADDRGP4 $728
JUMPV
LABELV $768
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRGP4 $777
JUMPV
LABELV $774
ADDRLP4 0
CNSTI4 844
ADDRLP4 4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
EQI4 $779
ADDRGP4 $775
JUMPV
LABELV $779
ADDRLP4 0
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
CNSTI4 0
EQI4 $781
ADDRGP4 $775
JUMPV
LABELV $781
ADDRLP4 0
INDIRP4
CNSTI4 248
ADDP4
INDIRI4
ADDRGP4 g_fraglimit+12
INDIRI4
LTI4 $783
ADDRGP4 $767
ARGP4
ADDRGP4 LogExit
CALLV
pop
ADDRGP4 $786
ARGP4
ADDRLP4 0
INDIRP4
CNSTI4 512
ADDP4
ARGP4
ADDRLP4 16
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 -1
ARGI4
ADDRLP4 16
INDIRP4
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
ADDRGP4 $728
JUMPV
LABELV $783
LABELV $775
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $777
ADDRLP4 4
INDIRI4
ADDRGP4 g_maxclients+12
INDIRI4
LTI4 $774
LABELV $757
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 4
LTI4 $787
ADDRGP4 g_capturelimit+12
INDIRI4
CNSTI4 0
EQI4 $787
ADDRGP4 level+44+4
INDIRI4
ADDRGP4 g_capturelimit+12
INDIRI4
LTI4 $791
CNSTI4 -1
ARGI4
ADDRGP4 $796
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
ADDRGP4 $797
ARGP4
ADDRGP4 LogExit
CALLV
pop
ADDRGP4 $728
JUMPV
LABELV $791
ADDRGP4 level+44+8
INDIRI4
ADDRGP4 g_capturelimit+12
INDIRI4
LTI4 $798
CNSTI4 -1
ARGI4
ADDRGP4 $803
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
ADDRGP4 $797
ARGP4
ADDRGP4 LogExit
CALLV
pop
LABELV $798
LABELV $787
LABELV $728
endproc CheckExitRules 20 8
export CheckTournament
proc CheckTournament 32 8
ADDRGP4 level+80
INDIRI4
CNSTI4 0
NEI4 $805
ADDRGP4 $804
JUMPV
LABELV $805
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 1
NEI4 $808
ADDRGP4 level+80
INDIRI4
CNSTI4 2
GEI4 $811
ADDRGP4 AddTournamentPlayer
CALLV
pop
LABELV $811
ADDRGP4 level+80
INDIRI4
CNSTI4 2
EQI4 $814
ADDRGP4 level+16
INDIRI4
CNSTI4 -1
EQI4 $804
ADDRGP4 level+16
CNSTI4 -1
ASGNI4
ADDRGP4 $479
ARGP4
ADDRGP4 level+16
INDIRI4
ARGI4
ADDRLP4 0
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 5
ARGI4
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
ADDRGP4 $822
ARGP4
ADDRGP4 G_LogPrintf
CALLV
pop
ADDRGP4 $804
JUMPV
LABELV $814
ADDRGP4 level+16
INDIRI4
CNSTI4 0
NEI4 $823
ADDRGP4 $804
JUMPV
LABELV $823
ADDRGP4 g_warmup+4
INDIRI4
ADDRGP4 level+352
INDIRI4
EQI4 $826
ADDRGP4 level+352
ADDRGP4 g_warmup+4
INDIRI4
ASGNI4
ADDRGP4 level+16
CNSTI4 -1
ASGNI4
LABELV $826
ADDRGP4 level+16
INDIRI4
CNSTI4 0
GEI4 $833
ADDRGP4 level+80
INDIRI4
CNSTI4 2
NEI4 $804
ADDRGP4 g_warmup+12
INDIRI4
CNSTI4 1
LEI4 $839
ADDRLP4 0
CNSTI4 1000
ASGNI4
ADDRGP4 level+16
ADDRGP4 level+32
INDIRI4
ADDRLP4 0
INDIRI4
ADDRGP4 g_warmup+12
INDIRI4
MULI4
ADDRLP4 0
INDIRI4
SUBI4
ADDI4
ASGNI4
ADDRGP4 $840
JUMPV
LABELV $839
ADDRGP4 level+16
CNSTI4 0
ASGNI4
LABELV $840
ADDRGP4 $479
ARGP4
ADDRGP4 level+16
INDIRI4
ARGI4
ADDRLP4 0
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 5
ARGI4
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
ADDRGP4 $804
JUMPV
LABELV $833
ADDRGP4 level+32
INDIRI4
ADDRGP4 level+16
INDIRI4
LEI4 $809
ADDRLP4 0
ADDRGP4 level+16
ASGNP4
ADDRLP4 0
INDIRP4
ADDRLP4 0
INDIRP4
INDIRI4
CNSTI4 10000
ADDI4
ASGNI4
ADDRGP4 $60
ARGP4
ADDRGP4 $83
ARGP4
ADDRGP4 trap_Cvar_Set
CALLV
pop
CNSTI4 2
ARGI4
ADDRGP4 $559
ARGP4
ADDRGP4 trap_SendConsoleCommand
CALLV
pop
ADDRGP4 level+68
CNSTI4 1
ASGNI4
ADDRGP4 $804
JUMPV
LABELV $808
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 2
EQI4 $853
ADDRGP4 level+16
INDIRI4
CNSTI4 0
EQI4 $853
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 3
LEI4 $857
CNSTI4 -1
ARGI4
CNSTI4 2
ARGI4
ADDRLP4 20
ADDRGP4 TeamCount
CALLI4
ASGNI4
ADDRLP4 4+8
ADDRLP4 20
INDIRI4
ASGNI4
CNSTI4 -1
ARGI4
CNSTI4 1
ARGI4
ADDRLP4 24
ADDRGP4 TeamCount
CALLI4
ASGNI4
ADDRLP4 4+4
ADDRLP4 24
INDIRI4
ASGNI4
ADDRLP4 28
CNSTI4 1
ASGNI4
ADDRLP4 4+4
INDIRI4
ADDRLP4 28
INDIRI4
LTI4 $866
ADDRLP4 4+8
INDIRI4
ADDRLP4 28
INDIRI4
GEI4 $858
LABELV $866
ADDRLP4 0
CNSTI4 1
ASGNI4
ADDRGP4 $858
JUMPV
LABELV $857
ADDRGP4 level+80
INDIRI4
CNSTI4 2
GEI4 $867
ADDRLP4 0
CNSTI4 1
ASGNI4
LABELV $867
LABELV $858
ADDRLP4 0
INDIRI4
CNSTI4 0
EQI4 $870
ADDRGP4 level+16
INDIRI4
CNSTI4 -1
EQI4 $804
ADDRGP4 level+16
CNSTI4 -1
ASGNI4
ADDRGP4 $479
ARGP4
ADDRGP4 level+16
INDIRI4
ARGI4
ADDRLP4 20
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 5
ARGI4
ADDRLP4 20
INDIRP4
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
ADDRGP4 $822
ARGP4
ADDRGP4 G_LogPrintf
CALLV
pop
ADDRGP4 $804
JUMPV
LABELV $870
ADDRGP4 level+16
INDIRI4
CNSTI4 0
NEI4 $877
ADDRGP4 $804
JUMPV
LABELV $877
ADDRGP4 g_warmup+4
INDIRI4
ADDRGP4 level+352
INDIRI4
EQI4 $880
ADDRGP4 level+352
ADDRGP4 g_warmup+4
INDIRI4
ASGNI4
ADDRGP4 level+16
CNSTI4 -1
ASGNI4
LABELV $880
ADDRGP4 level+16
INDIRI4
CNSTI4 0
GEI4 $887
ADDRGP4 g_warmup+12
INDIRI4
CNSTI4 1
LEI4 $890
ADDRLP4 20
CNSTI4 1000
ASGNI4
ADDRGP4 level+16
ADDRGP4 level+32
INDIRI4
ADDRLP4 20
INDIRI4
ADDRGP4 g_warmup+12
INDIRI4
MULI4
ADDRLP4 20
INDIRI4
SUBI4
ADDI4
ASGNI4
ADDRGP4 $891
JUMPV
LABELV $890
ADDRGP4 level+16
CNSTI4 0
ASGNI4
LABELV $891
ADDRGP4 $479
ARGP4
ADDRGP4 level+16
INDIRI4
ARGI4
ADDRLP4 20
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 5
ARGI4
ADDRLP4 20
INDIRP4
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
ADDRGP4 $804
JUMPV
LABELV $887
ADDRGP4 level+32
INDIRI4
ADDRGP4 level+16
INDIRI4
LEI4 $898
ADDRLP4 20
ADDRGP4 level+16
ASGNP4
ADDRLP4 20
INDIRP4
ADDRLP4 20
INDIRP4
INDIRI4
CNSTI4 10000
ADDI4
ASGNI4
ADDRGP4 $60
ARGP4
ADDRGP4 $83
ARGP4
ADDRGP4 trap_Cvar_Set
CALLV
pop
CNSTI4 2
ARGI4
ADDRGP4 $559
ARGP4
ADDRGP4 trap_SendConsoleCommand
CALLV
pop
ADDRGP4 level+68
CNSTI4 1
ASGNI4
LABELV $898
LABELV $853
LABELV $809
LABELV $804
endproc CheckTournament 32 8
export CheckVote
proc CheckVote 4 8
ADDRGP4 level+2408
INDIRI4
CNSTI4 0
EQI4 $905
ADDRGP4 level+2408
INDIRI4
ADDRGP4 level+32
INDIRI4
GEI4 $905
ADDRGP4 level+2408
CNSTI4 0
ASGNI4
ADDRGP4 $911
ARGP4
ADDRGP4 level+356
ARGP4
ADDRLP4 0
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 2
ARGI4
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 trap_SendConsoleCommand
CALLV
pop
LABELV $905
ADDRGP4 level+2404
INDIRI4
CNSTI4 0
NEI4 $913
ADDRGP4 $904
JUMPV
LABELV $913
ADDRGP4 level+32
INDIRI4
ADDRGP4 level+2404
INDIRI4
SUBI4
CNSTI4 30000
LTI4 $916
CNSTI4 -1
ARGI4
ADDRGP4 $920
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
ADDRGP4 $917
JUMPV
LABELV $916
ADDRGP4 level+2412
INDIRI4
ADDRGP4 level+2420
INDIRI4
CNSTI4 2
DIVI4
LEI4 $921
CNSTI4 -1
ARGI4
ADDRGP4 $925
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
ADDRGP4 level+2408
ADDRGP4 level+32
INDIRI4
CNSTI4 3000
ADDI4
ASGNI4
ADDRGP4 $922
JUMPV
LABELV $921
ADDRGP4 level+2416
INDIRI4
ADDRGP4 level+2420
INDIRI4
CNSTI4 2
DIVI4
LTI4 $904
CNSTI4 -1
ARGI4
ADDRGP4 $920
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
LABELV $929
LABELV $922
LABELV $917
ADDRGP4 level+2404
CNSTI4 0
ASGNI4
CNSTI4 8
ARGI4
ADDRGP4 $55
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
LABELV $904
endproc CheckVote 4 8
export PrintTeam
proc PrintTeam 4 8
ADDRFP4 0
ADDRFP4 0
INDIRI4
ASGNI4
ADDRFP4 4
ADDRFP4 4
INDIRP4
ASGNP4
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $937
JUMPV
LABELV $934
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 616
ADDP4
INDIRI4
ADDRFP4 0
INDIRI4
EQI4 $939
ADDRGP4 $935
JUMPV
LABELV $939
ADDRLP4 0
INDIRI4
ARGI4
ADDRFP4 4
INDIRP4
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
LABELV $935
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $937
ADDRLP4 0
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $934
LABELV $933
endproc PrintTeam 4 8
export SetLeader
proc SetLeader 8 8
ADDRFP4 0
ADDRFP4 0
INDIRI4
ASGNI4
ADDRFP4 4
ADDRFP4 4
INDIRI4
ASGNI4
CNSTI4 844
ADDRFP4 4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 0
NEI4 $942
ADDRGP4 $944
ARGP4
CNSTI4 844
ADDRFP4 4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 512
ADDP4
ARGP4
ADDRLP4 4
ADDRGP4 va
CALLP4
ASGNP4
ADDRFP4 0
INDIRI4
ARGI4
ADDRLP4 4
INDIRP4
ARGP4
ADDRGP4 PrintTeam
CALLV
pop
ADDRGP4 $941
JUMPV
LABELV $942
CNSTI4 844
ADDRFP4 4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 616
ADDP4
INDIRI4
ADDRFP4 0
INDIRI4
EQI4 $945
ADDRGP4 $947
ARGP4
CNSTI4 844
ADDRFP4 4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 512
ADDP4
ARGP4
ADDRLP4 4
ADDRGP4 va
CALLP4
ASGNP4
ADDRFP4 0
INDIRI4
ARGI4
ADDRLP4 4
INDIRP4
ARGP4
ADDRGP4 PrintTeam
CALLV
pop
ADDRGP4 $941
JUMPV
LABELV $945
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $951
JUMPV
LABELV $948
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 616
ADDP4
INDIRI4
ADDRFP4 0
INDIRI4
EQI4 $953
ADDRGP4 $949
JUMPV
LABELV $953
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 640
ADDP4
INDIRI4
CNSTI4 0
EQI4 $955
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 640
ADDP4
CNSTI4 0
ASGNI4
ADDRLP4 0
INDIRI4
ARGI4
ADDRGP4 ClientUserinfoChanged
CALLV
pop
LABELV $955
LABELV $949
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $951
ADDRLP4 0
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $948
CNSTI4 844
ADDRFP4 4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 640
ADDP4
CNSTI4 1
ASGNI4
ADDRFP4 4
INDIRI4
ARGI4
ADDRGP4 ClientUserinfoChanged
CALLV
pop
ADDRGP4 $957
ARGP4
CNSTI4 844
ADDRFP4 4
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 512
ADDP4
ARGP4
ADDRLP4 4
ADDRGP4 va
CALLP4
ASGNP4
ADDRFP4 0
INDIRI4
ARGI4
ADDRLP4 4
INDIRP4
ARGP4
ADDRGP4 PrintTeam
CALLV
pop
LABELV $941
endproc SetLeader 8 8
export CheckTeamLeader
proc CheckTeamLeader 4 0
ADDRFP4 0
ADDRFP4 0
INDIRI4
ASGNI4
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $962
JUMPV
LABELV $959
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 616
ADDP4
INDIRI4
ADDRFP4 0
INDIRI4
EQI4 $964
ADDRGP4 $960
JUMPV
LABELV $964
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 640
ADDP4
INDIRI4
CNSTI4 0
EQI4 $966
ADDRGP4 $961
JUMPV
LABELV $966
LABELV $960
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $962
ADDRLP4 0
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $959
LABELV $961
ADDRLP4 0
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $968
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $974
JUMPV
LABELV $971
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 616
ADDP4
INDIRI4
ADDRFP4 0
INDIRI4
EQI4 $976
ADDRGP4 $972
JUMPV
LABELV $976
CNSTI4 812
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 g_entities+208+216
ADDP4
INDIRI4
CNSTI4 8
BANDI4
CNSTI4 0
NEI4 $978
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 640
ADDP4
CNSTI4 1
ASGNI4
ADDRGP4 $973
JUMPV
LABELV $978
LABELV $972
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $974
ADDRLP4 0
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $971
LABELV $973
ADDRLP4 0
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $982
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $988
JUMPV
LABELV $985
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 616
ADDP4
INDIRI4
ADDRFP4 0
INDIRI4
EQI4 $990
ADDRGP4 $986
JUMPV
LABELV $990
CNSTI4 844
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 level
INDIRP4
ADDP4
CNSTI4 640
ADDP4
CNSTI4 1
ASGNI4
ADDRGP4 $987
JUMPV
LABELV $986
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $988
ADDRLP4 0
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $985
LABELV $987
LABELV $982
LABELV $968
LABELV $958
endproc CheckTeamLeader 4 0
export CheckTeamVote
proc CheckTeamVote 20 12
ADDRFP4 0
INDIRI4
CNSTI4 1
NEI4 $993
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $994
JUMPV
LABELV $993
ADDRFP4 0
INDIRI4
CNSTI4 2
NEI4 $992
ADDRLP4 0
CNSTI4 1
ASGNI4
LABELV $996
LABELV $994
ADDRLP4 0
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+4472
ADDP4
INDIRI4
CNSTI4 0
NEI4 $997
ADDRGP4 $992
JUMPV
LABELV $997
ADDRGP4 level+32
INDIRI4
ADDRLP4 0
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+4472
ADDP4
INDIRI4
SUBI4
CNSTI4 30000
LTI4 $1000
CNSTI4 -1
ARGI4
ADDRGP4 $1004
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
ADDRGP4 $1001
JUMPV
LABELV $1000
ADDRLP4 4
CNSTI4 2
ASGNI4
ADDRLP4 8
ADDRLP4 0
INDIRI4
ADDRLP4 4
INDIRI4
LSHI4
ASGNI4
ADDRLP4 8
INDIRI4
ADDRGP4 level+4480
ADDP4
INDIRI4
ADDRLP4 8
INDIRI4
ADDRGP4 level+4496
ADDP4
INDIRI4
ADDRLP4 4
INDIRI4
DIVI4
LEI4 $1005
CNSTI4 -1
ARGI4
ADDRGP4 $1009
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
ADDRGP4 $1012
ARGP4
ADDRLP4 0
INDIRI4
CNSTI4 10
LSHI4
ADDRGP4 level+2424
ADDP4
ARGP4
CNSTI4 6
ARGI4
ADDRLP4 12
ADDRGP4 Q_strncmp
CALLI4
ASGNI4
ADDRLP4 12
INDIRI4
CNSTI4 0
NEI4 $1010
ADDRLP4 0
INDIRI4
CNSTI4 10
LSHI4
ADDRGP4 level+2424+7
ADDP4
ARGP4
ADDRLP4 16
ADDRGP4 qk_atoi
CALLI4
ASGNI4
ADDRFP4 0
INDIRI4
ARGI4
ADDRLP4 16
INDIRI4
ARGI4
ADDRGP4 SetLeader
CALLV
pop
ADDRGP4 $1006
JUMPV
LABELV $1010
ADDRGP4 $911
ARGP4
ADDRLP4 0
INDIRI4
CNSTI4 10
LSHI4
ADDRGP4 level+2424
ADDP4
ARGP4
ADDRLP4 16
ADDRGP4 va
CALLP4
ASGNP4
CNSTI4 2
ARGI4
ADDRLP4 16
INDIRP4
ARGP4
ADDRGP4 trap_SendConsoleCommand
CALLV
pop
ADDRGP4 $1006
JUMPV
LABELV $1005
ADDRLP4 12
CNSTI4 2
ASGNI4
ADDRLP4 16
ADDRLP4 0
INDIRI4
ADDRLP4 12
INDIRI4
LSHI4
ASGNI4
ADDRLP4 16
INDIRI4
ADDRGP4 level+4488
ADDP4
INDIRI4
ADDRLP4 16
INDIRI4
ADDRGP4 level+4496
ADDP4
INDIRI4
ADDRLP4 12
INDIRI4
DIVI4
LTI4 $992
CNSTI4 -1
ARGI4
ADDRGP4 $1004
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
LABELV $1018
LABELV $1006
LABELV $1001
ADDRLP4 0
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+4472
ADDP4
CNSTI4 0
ASGNI4
ADDRLP4 0
INDIRI4
CNSTI4 12
ADDI4
ARGI4
ADDRGP4 $55
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
LABELV $992
endproc CheckTeamVote 20 12
data
align 4
LABELV $1023
byte 4 -1
export CheckCvars
code
proc CheckCvars 4 8
ADDRGP4 g_password+4
INDIRI4
ADDRGP4 $1023
INDIRI4
EQI4 $1024
ADDRGP4 $1023
ADDRGP4 g_password+4
INDIRI4
ASGNI4
ADDRGP4 g_password+16
INDIRI1
CVII4 1
CNSTI4 0
EQI4 $1028
ADDRGP4 g_password+16
ARGP4
ADDRGP4 $1032
ARGP4
ADDRLP4 0
ADDRGP4 Q_stricmp
CALLI4
ASGNI4
ADDRLP4 0
INDIRI4
CNSTI4 0
EQI4 $1028
ADDRGP4 $84
ARGP4
ADDRGP4 $83
ARGP4
ADDRGP4 trap_Cvar_Set
CALLV
pop
ADDRGP4 $1029
JUMPV
LABELV $1028
ADDRGP4 $84
ARGP4
ADDRGP4 $61
ARGP4
ADDRGP4 trap_Cvar_Set
CALLV
pop
LABELV $1029
LABELV $1024
LABELV $1022
endproc CheckCvars 4 8
export G_RunThink
proc G_RunThink 8 4
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 0
ADDRFP4 0
INDIRP4
CNSTI4 684
ADDP4
INDIRI4
CVIF4 4
ASGNF4
ADDRLP4 0
INDIRF4
CNSTF4 0
GTF4 $1034
ADDRGP4 $1033
JUMPV
LABELV $1034
ADDRLP4 0
INDIRF4
ADDRGP4 level+32
INDIRI4
CVIF4 4
LEF4 $1036
ADDRGP4 $1033
JUMPV
LABELV $1036
ADDRFP4 0
INDIRP4
CNSTI4 684
ADDP4
CNSTI4 0
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 688
ADDP4
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $1039
ADDRGP4 $1041
ARGP4
ADDRGP4 G_Error
CALLV
pop
LABELV $1039
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 688
ADDP4
INDIRP4
CALLV
pop
LABELV $1033
endproc G_RunThink 8 4
export G_RunFrame
proc G_RunFrame 28 12
ADDRGP4 level+68
INDIRI4
CNSTI4 0
EQI4 $1043
ADDRGP4 $1042
JUMPV
LABELV $1043
ADDRLP4 8
ADDRGP4 level+28
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRGP4 level+36
ADDRGP4 level+32
INDIRI4
ASGNI4
ADDRGP4 level+32
ADDRFP4 0
INDIRI4
ASGNI4
ADDRGP4 G_UpdateCvars
CALLV
pop
ADDRLP4 0
ADDRGP4 g_entities
ASGNP4
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRGP4 $1053
JUMPV
LABELV $1050
ADDRLP4 0
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
CNSTI4 0
NEI4 $1055
ADDRGP4 $1051
JUMPV
LABELV $1055
ADDRGP4 level+32
INDIRI4
ADDRLP4 0
INDIRP4
CNSTI4 552
ADDP4
INDIRI4
SUBI4
CNSTI4 300
LEI4 $1057
ADDRLP4 0
INDIRP4
CNSTI4 180
ADDP4
INDIRI4
CNSTI4 0
EQI4 $1060
ADDRLP4 0
INDIRP4
CNSTI4 180
ADDP4
CNSTI4 0
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CVPU4 4
CNSTU4 0
EQU4 $1062
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 128
ADDP4
CNSTI4 0
ASGNI4
LABELV $1062
LABELV $1060
ADDRLP4 0
INDIRP4
CNSTI4 556
ADDP4
INDIRI4
CNSTI4 0
EQI4 $1064
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 G_FreeEntity
CALLV
pop
ADDRGP4 $1051
JUMPV
LABELV $1064
ADDRLP4 0
INDIRP4
CNSTI4 560
ADDP4
INDIRI4
CNSTI4 0
EQI4 $1066
ADDRLP4 0
INDIRP4
CNSTI4 560
ADDP4
CNSTI4 0
ASGNI4
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 trap_UnlinkEntity
CALLV
pop
LABELV $1066
LABELV $1057
ADDRLP4 0
INDIRP4
CNSTI4 556
ADDP4
INDIRI4
CNSTI4 0
EQI4 $1068
ADDRGP4 $1051
JUMPV
LABELV $1068
ADDRLP4 16
CNSTI4 0
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 416
ADDP4
INDIRI4
ADDRLP4 16
INDIRI4
NEI4 $1070
ADDRLP4 0
INDIRP4
CNSTI4 532
ADDP4
INDIRI4
ADDRLP4 16
INDIRI4
EQI4 $1070
ADDRGP4 $1051
JUMPV
LABELV $1070
ADDRLP4 0
INDIRP4
CNSTI4 4
ADDP4
INDIRI4
CNSTI4 3
NEI4 $1072
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 G_RunMissile
CALLV
pop
ADDRGP4 $1051
JUMPV
LABELV $1072
ADDRLP4 0
INDIRP4
CNSTI4 4
ADDP4
INDIRI4
CNSTI4 2
EQI4 $1076
ADDRLP4 0
INDIRP4
CNSTI4 564
ADDP4
INDIRI4
CNSTI4 0
EQI4 $1074
LABELV $1076
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 G_RunItem
CALLV
pop
ADDRGP4 $1051
JUMPV
LABELV $1074
ADDRLP4 24
CNSTI4 4
ASGNI4
ADDRLP4 0
INDIRP4
ADDRLP4 24
INDIRI4
ADDP4
INDIRI4
ADDRLP4 24
INDIRI4
NEI4 $1077
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 G_RunMover
CALLV
pop
ADDRGP4 $1051
JUMPV
LABELV $1077
ADDRLP4 4
INDIRI4
CNSTI4 64
GEI4 $1079
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 G_RunClient
CALLV
pop
ADDRGP4 $1051
JUMPV
LABELV $1079
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 G_RunThink
CALLV
pop
LABELV $1051
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 0
ADDRLP4 0
INDIRP4
CNSTI4 812
ADDP4
ASGNP4
LABELV $1053
ADDRLP4 4
INDIRI4
ADDRGP4 level+12
INDIRI4
LTI4 $1050
ADDRLP4 0
ADDRGP4 g_entities
ASGNP4
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRGP4 $1084
JUMPV
LABELV $1081
ADDRLP4 0
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
CNSTI4 0
EQI4 $1086
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 ClientEndFrame
CALLV
pop
LABELV $1086
LABELV $1082
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 0
ADDRLP4 0
INDIRP4
CNSTI4 812
ADDP4
ASGNP4
LABELV $1084
ADDRLP4 4
INDIRI4
ADDRGP4 level+24
INDIRI4
LTI4 $1081
ADDRGP4 CheckTournament
CALLV
pop
ADDRGP4 CheckExitRules
CALLV
pop
ADDRGP4 CheckTeamStatus
CALLV
pop
ADDRGP4 CheckVote
CALLV
pop
CNSTI4 1
ARGI4
ADDRGP4 CheckTeamVote
CALLV
pop
CNSTI4 2
ARGI4
ADDRGP4 CheckTeamVote
CALLV
pop
ADDRGP4 CheckCvars
CALLV
pop
ADDRGP4 g_listEntity+12
INDIRI4
CNSTI4 0
EQI4 $1088
ADDRLP4 4
CNSTI4 0
ASGNI4
LABELV $1091
ADDRGP4 $1095
ARGP4
ADDRLP4 4
INDIRI4
ARGI4
CNSTI4 812
ADDRLP4 4
INDIRI4
MULI4
ADDRGP4 g_entities+524
ADDP4
INDIRP4
ARGP4
ADDRGP4 G_Printf
CALLV
pop
LABELV $1092
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 4
INDIRI4
CNSTI4 1024
LTI4 $1091
ADDRGP4 $110
ARGP4
ADDRGP4 $61
ARGP4
ADDRGP4 trap_Cvar_Set
CALLV
pop
LABELV $1088
LABELV $1042
endproc G_RunFrame 28 12
bss
export g_listEntity
align 4
LABELV g_listEntity
skip 272
export g_podiumDrop
align 4
LABELV g_podiumDrop
skip 272
export g_podiumDist
align 4
LABELV g_podiumDist
skip 272
export g_logfileSync
align 4
LABELV g_logfileSync
skip 272
export g_logfile
align 4
LABELV g_logfile
skip 272
export g_clients
align 4
LABELV g_clients
skip 54016
import trap_SnapVector
import trap_GeneticParentsAndChildSelection
import trap_BotResetWeaponState
import trap_BotFreeWeaponState
import trap_BotAllocWeaponState
import trap_BotLoadWeaponWeights
import trap_BotGetWeaponInfo
import trap_BotChooseBestFightWeapon
import trap_BotAddAvoidSpot
import trap_BotInitMoveState
import trap_BotFreeMoveState
import trap_BotAllocMoveState
import trap_BotPredictVisiblePosition
import trap_BotMovementViewTarget
import trap_BotReachabilityArea
import trap_BotResetLastAvoidReach
import trap_BotResetAvoidReach
import trap_BotMoveInDirection
import trap_BotMoveToGoal
import trap_BotResetMoveState
import trap_BotFreeGoalState
import trap_BotAllocGoalState
import trap_BotMutateGoalFuzzyLogic
import trap_BotSaveGoalFuzzyLogic
import trap_BotInterbreedGoalFuzzyLogic
import trap_BotFreeItemWeights
import trap_BotLoadItemWeights
import trap_BotUpdateEntityItems
import trap_BotInitLevelItems
import trap_BotSetAvoidGoalTime
import trap_BotAvoidGoalTime
import trap_BotGetLevelItemGoal
import trap_BotGetMapLocationGoal
import trap_BotGetNextCampSpotGoal
import trap_BotItemGoalInVisButNotVisible
import trap_BotTouchingGoal
import trap_BotChooseNBGItem
import trap_BotChooseLTGItem
import trap_BotGetSecondGoal
import trap_BotGetTopGoal
import trap_BotGoalName
import trap_BotDumpGoalStack
import trap_BotDumpAvoidGoals
import trap_BotEmptyGoalStack
import trap_BotPopGoal
import trap_BotPushGoal
import trap_BotResetAvoidGoals
import trap_BotRemoveFromAvoidGoals
import trap_BotResetGoalState
import trap_BotSetChatName
import trap_BotSetChatGender
import trap_BotLoadChatFile
import trap_BotReplaceSynonyms
import trap_UnifyWhiteSpaces
import trap_BotMatchVariable
import trap_BotFindMatch
import trap_StringContains
import trap_BotGetChatMessage
import trap_BotEnterChat
import trap_BotChatLength
import trap_BotReplyChat
import trap_BotNumInitialChats
import trap_BotInitialChat
import trap_BotNumConsoleMessages
import trap_BotNextConsoleMessage
import trap_BotRemoveConsoleMessage
import trap_BotQueueConsoleMessage
import trap_BotFreeChatState
import trap_BotAllocChatState
import trap_Characteristic_String
import trap_Characteristic_BInteger
import trap_Characteristic_Integer
import trap_Characteristic_BFloat
import trap_Characteristic_Float
import trap_BotFreeCharacter
import trap_BotLoadCharacter
import trap_EA_ResetInput
import trap_EA_GetInput
import trap_EA_EndRegular
import trap_EA_View
import trap_EA_Move
import trap_EA_DelayedJump
import trap_EA_Jump
import trap_EA_SelectWeapon
import trap_EA_MoveRight
import trap_EA_MoveLeft
import trap_EA_MoveBack
import trap_EA_MoveForward
import trap_EA_MoveDown
import trap_EA_MoveUp
import trap_EA_Crouch
import trap_EA_Respawn
import trap_EA_Use
import trap_EA_Attack
import trap_EA_Talk
import trap_EA_Gesture
import trap_EA_Action
import trap_EA_Command
import trap_EA_SayTeam
import trap_EA_Say
import trap_AAS_PredictClientMovement
import trap_AAS_Swimming
import trap_AAS_AlternativeRouteGoals
import trap_AAS_PredictRoute
import trap_AAS_EnableRoutingArea
import trap_AAS_AreaTravelTimeToGoalArea
import trap_AAS_AreaReachability
import trap_AAS_IntForBSPEpairKey
import trap_AAS_FloatForBSPEpairKey
import trap_AAS_VectorForBSPEpairKey
import trap_AAS_ValueForBSPEpairKey
import trap_AAS_NextBSPEntity
import trap_AAS_PointContents
import trap_AAS_TraceAreas
import trap_AAS_PointReachabilityAreaIndex
import trap_AAS_PointAreaNum
import trap_AAS_Time
import trap_AAS_PresenceTypeBoundingBox
import trap_AAS_Initialized
import trap_AAS_EntityInfo
import trap_AAS_AreaInfo
import trap_AAS_BBoxAreas
import trap_BotUserCommand
import trap_BotGetServerCommand
import trap_BotGetSnapshotEntity
import trap_BotLibTest
import trap_BotLibUpdateEntity
import trap_BotLibLoadMap
import trap_BotLibStartFrame
import trap_BotLibDefine
import trap_BotLibVarGet
import trap_BotLibVarSet
import trap_BotLibShutdown
import trap_BotLibSetup
import trap_DebugPolygonDelete
import trap_DebugPolygonCreate
import trap_GetEntityToken
import trap_GetUsercmd
import trap_BotFreeClient
import trap_BotAllocateClient
import trap_EntityContact
import trap_EntitiesInBox
import trap_UnlinkEntity
import trap_LinkEntity
import trap_AreasConnected
import trap_AdjustAreaPortalState
import trap_InPVSIgnorePortals
import trap_InPVS
import trap_PointContents
import trap_Trace
import trap_SetBrushModel
import trap_GetServerinfo
import trap_SetUserinfo
import trap_GetUserinfo
import trap_GetConfigstring
import trap_SetConfigstring
import trap_SendServerCommand
import trap_DropClient
import trap_LocateGameData
import trap_Cvar_VariableStringBuffer
import trap_Cvar_VariableValue
import trap_Cvar_VariableIntegerValue
import trap_Cvar_Set
import trap_Cvar_Update
import trap_Cvar_Register
import trap_SendConsoleCommand
import trap_FS_Seek
import trap_FS_GetFileList
import trap_FS_FCloseFile
import trap_FS_Write
import trap_FS_Read
import trap_FS_FOpenFile
import trap_Args
import trap_Argv
import trap_Argc
import trap_RealTime
import trap_Milliseconds
import trap_Error
import trap_Print
export g_proxMineTimeout
align 4
LABELV g_proxMineTimeout
skip 272
export g_singlePlayer
align 4
LABELV g_singlePlayer
skip 272
export g_enableBreath
align 4
LABELV g_enableBreath
skip 272
export g_enableDust
align 4
LABELV g_enableDust
skip 272
export g_rankings
align 4
LABELV g_rankings
skip 272
export pmove_msec
align 4
LABELV pmove_msec
skip 272
export pmove_fixed
align 4
LABELV pmove_fixed
skip 272
export g_smoothClients
align 4
LABELV g_smoothClients
skip 272
export g_blueteam
align 4
LABELV g_blueteam
skip 272
export g_redteam
align 4
LABELV g_redteam
skip 272
export g_cubeTimeout
align 4
LABELV g_cubeTimeout
skip 272
export g_obeliskRespawnDelay
align 4
LABELV g_obeliskRespawnDelay
skip 272
export g_obeliskRegenAmount
align 4
LABELV g_obeliskRegenAmount
skip 272
export g_obeliskRegenPeriod
align 4
LABELV g_obeliskRegenPeriod
skip 272
export g_obeliskHealth
align 4
LABELV g_obeliskHealth
skip 272
export g_filterBan
align 4
LABELV g_filterBan
skip 272
export g_banIPs
align 4
LABELV g_banIPs
skip 272
export g_teamForceBalance
align 4
LABELV g_teamForceBalance
skip 272
export g_teamAutoJoin
align 4
LABELV g_teamAutoJoin
skip 272
export g_allowVote
align 4
LABELV g_allowVote
skip 272
export g_blood
align 4
LABELV g_blood
skip 272
export g_doWarmup
align 4
LABELV g_doWarmup
skip 272
export g_warmup
align 4
LABELV g_warmup
skip 272
export g_motd
align 4
LABELV g_motd
skip 272
export g_synchronousClients
align 4
LABELV g_synchronousClients
skip 272
export g_weaponTeamRespawn
align 4
LABELV g_weaponTeamRespawn
skip 272
export g_weaponRespawn
align 4
LABELV g_weaponRespawn
skip 272
export g_debugDamage
align 4
LABELV g_debugDamage
skip 272
export g_debugAlloc
align 4
LABELV g_debugAlloc
skip 272
export g_debugMove
align 4
LABELV g_debugMove
skip 272
export g_inactivity
align 4
LABELV g_inactivity
skip 272
export g_forcerespawn
align 4
LABELV g_forcerespawn
skip 272
export g_quadfactor
align 4
LABELV g_quadfactor
skip 272
export g_knockback
align 4
LABELV g_knockback
skip 272
export g_speed
align 4
LABELV g_speed
skip 272
export g_gravity
align 4
LABELV g_gravity
skip 272
export g_needpass
align 4
LABELV g_needpass
skip 272
export g_password
align 4
LABELV g_password
skip 272
export g_friendlyFire
align 4
LABELV g_friendlyFire
skip 272
export g_capturelimit
align 4
LABELV g_capturelimit
skip 272
export g_timelimit
align 4
LABELV g_timelimit
skip 272
export g_fraglimit
align 4
LABELV g_fraglimit
skip 272
export g_dmflags
align 4
LABELV g_dmflags
skip 272
export g_restarted
align 4
LABELV g_restarted
skip 272
export g_maxGameClients
align 4
LABELV g_maxGameClients
skip 272
export g_maxclients
align 4
LABELV g_maxclients
skip 272
export g_cheats
align 4
LABELV g_cheats
skip 272
export g_dedicated
align 4
LABELV g_dedicated
skip 272
export g_gametype
align 4
LABELV g_gametype
skip 272
export g_entities
align 4
LABELV g_entities
skip 831488
export level
align 4
LABELV level
skip 9216
import Pickup_Team
import CheckTeamStatus
import TeamplayInfoMessage
import Team_GetLocationMsg
import Team_GetLocation
import SelectCTFSpawnPoint
import Team_FreeEntity
import Team_ReturnFlag
import Team_InitGame
import Team_CheckHurtCarrier
import Team_FragBonuses
import Team_DroppedFlagThink
import AddTeamScore
import TeamColorString
import TeamName
import OtherTeam
import BotTestAAS
import BotAIStartFrame
import BotAIShutdownClient
import BotAISetupClient
import BotAILoadMap
import BotAIShutdown
import BotAISetup
import BotInterbreedEndMatch
import Svcmd_BotList_f
import Svcmd_AddBot_f
import G_BotConnect
import G_RemoveQueuedBotBegin
import G_CheckBotSpawn
import G_GetBotInfoByName
import G_GetBotInfoByNumber
import G_InitBots
import Svcmd_AbortPodium_f
import SpawnModelsOnVictoryPads
import UpdateTournamentInfo
import G_WriteSessionData
import G_InitWorldSession
import G_InitSessionData
import G_ReadSessionData
import Svcmd_GameMem_f
import G_InitMemory
import G_Alloc
import CheckObeliskAttack
import Team_CheckDroppedItem
import OnSameTeam
import G_RunClient
import ClientEndFrame
import ClientThink
import ClientCommand
import ClientBegin
import ClientDisconnect
import ClientUserinfoChanged
import ClientConnect
import DeathmatchScoreboardMessage
import G_StartKamikaze
import FireWeapon
import G_FilterPacket
import G_ProcessIPBans
import ConsoleCommand
import SpotWouldTelefrag
import AddScore
import player_die
import ClientSpawn
import InitBodyQue
import ClientRespawn
import CopyToBodyQue
import SelectSpawnPoint
import SetClientViewAngle
import PickTeam
import TeamLeader
import TeamCount
import Weapon_HookThink
import Weapon_HookFree
import CheckGauntletAttack
import SnapVectorTowards
import CalcMuzzlePoint
import LogAccuracyHit
import DropPortalDestination
import DropPortalSource
import TeleportPlayer
import trigger_teleporter_touch
import Touch_DoorTrigger
import G_RunMover
import fire_prox
import fire_nail
import fire_grapple
import fire_bfg
import fire_rocket
import fire_grenade
import fire_plasma
import G_RunMissile
import TossClientCubes
import TossClientPersistantPowerups
import TossClientItems
import body_die
import G_InvulnerabilityEffect
import G_RadiusDamage
import G_Damage
import CanDamage
import BuildShaderStateConfig
import AddRemap
import G_SetOrigin
import G_AddEvent
import G_AddPredictableEvent
import vectoyaw
import vtos
import tv
import G_TouchTriggers
import G_EntitiesFree
import G_FreeEntity
import G_Sound
import G_TempEntity
import G_Spawn
import G_InitGentity
import G_SetMovedir
import G_UseTargets
import G_PickTarget
import G_Find
import G_KillBox
import G_TeamCommand
import G_SoundIndex
import G_ModelIndex
import SaveRegisteredItems
import RegisterItem
import ClearRegisteredItems
import Touch_Item
import Add_Ammo
import ArmorIndex
import Think_Weapon
import FinishSpawningItem
import G_SpawnItem
import SetRespawn
import LaunchItem
import Drop_Item
import PrecacheItem
import UseHoldableItem
import RespawnItem
import G_RunItem
import G_CheckTeamItems
import Cmd_FollowCycle_f
import SetTeam
import BroadcastTeamChange
import StopFollowing
import Cmd_Score_f
import G_NewString
import G_SpawnEntitiesFromString
import G_SpawnVector
import G_SpawnInt
import G_SpawnFloat
import G_SpawnString
import BG_PlayerTouchesItem
import BG_PlayerStateToEntityStateExtraPolate
import BG_PlayerStateToEntityState
import BG_TouchJumpPad
import BG_AddPredictableEventToPlayerstate
import BG_EvaluateTrajectoryDelta
import BG_EvaluateTrajectory
import BG_CanItemBeGrabbed
import BG_FindItemForHoldable
import BG_FindItemForPowerup
import BG_FindItemForWeapon
import BG_FindItem
import bg_numItems
import bg_itemlist
import Pmove
import PM_UpdateViewAngles
import Info_NextPair
import Info_Validate
import Info_SetValueForKey_Big
import Info_SetValueForKey
import Info_RemoveKey_Big
import Info_RemoveKey
import Info_ValueForKey
import Com_TruncateLongString
import va
import Q_CountChar
import Q_CleanStr
import Q_PrintStrlen
import Q_strcat
import Q_strncpyz
import Q_stristr
import Q_strupr
import Q_strlwr
import Q_stricmpn
import Q_strncmp
import Q_stricmp
import Q_isintegral
import Q_isanumber
import Q_isalpha
import Q_isupper
import Q_islower
import Q_isprint
import Com_RandomBytes
import Com_SkipCharset
import Com_SkipTokens
import Com_sprintf
import Com_HexStrToInt
import Parse3DMatrix
import Parse2DMatrix
import Parse1DMatrix
import SkipRestOfLine
import SkipBracedSection
import COM_MatchToken
import COM_ParseWarning
import COM_ParseError
import COM_Compress
import COM_ParseExt
import COM_Parse
import COM_GetCurrentParseLine
import COM_BeginParseSession
import COM_DefaultExtension
import COM_CompareExtension
import COM_StripExtension
import COM_GetExtension
import COM_SkipPath
import Com_Clamp
import PerpendicularVector
import AngleVectors
import MatrixMultiply
import MakeNormalVectors
import RotateAroundDirection
import RotatePointAroundVector
import ProjectPointOnPlane
import PlaneFromPoints
import AngleDelta
import AngleNormalize180
import AngleNormalize360
import AnglesSubtract
import AngleSubtract
import LerpAngle
import AngleMod
import BoundsIntersectPoint
import BoundsIntersectSphere
import BoundsIntersect
import BoxOnPlaneSide
import SetPlaneSignbits
import AxisCopy
import AxisClear
import AnglesToAxis
import vectoangles
import Q_crandom
import Q_random
import Q_rand
import Q_acos
import Q_log2
import VectorRotate
import Vector4Scale
import VectorNormalize2
import VectorNormalize
import CrossProduct
import VectorInverse
import VectorNormalizeFast
import DistanceSquared
import Distance
import VectorLengthSquared
import VectorLength
import VectorCompare
import AddPointToBounds
import ClearBounds
import RadiusFromBounds
import NormalizeColor
import ColorBytes4
import ColorBytes3
import _VectorMA
import _VectorScale
import _VectorCopy
import _VectorAdd
import _VectorSubtract
import _DotProduct
import ByteToDir
import DirToByte
import ClampShort
import ClampChar
import Q_rsqrt
import Q_fabs
import Q_isnan
import axisDefault
import vec3_origin
import g_color_table
import colorDkGrey
import colorMdGrey
import colorLtGrey
import colorWhite
import colorCyan
import colorMagenta
import colorYellow
import colorBlue
import colorGreen
import colorRed
import colorBlack
import bytedirs
import Hunk_AllocDebug
import FloatSwap
import LongSwap
import ShortSwap
import CopyLongSwap
import CopyShortSwap
import qk_acos
import qk_fabs
import qk_abs
import qk_tan
import qk_atan2
import qk_cos
import qk_sin
import qk_sqrt
import qk_floor
import qk_ceil
import qk_memcpy
import qk_memset
import qk_memmove
import qk_sscanf
import qk_vsnprintf
import qk_strtol
import qk_atoi
import qk_strtod
import qk_atof
import qk_toupper
import qk_tolower
import qk_strncpy
import qk_strstr
import qk_strrchr
import qk_strchr
import qk_strcmp
import qk_strcpy
import qk_strcat
import qk_strlen
import qk_rand
import qk_srand
import qk_qsort
lit
align 1
LABELV $1095
byte 1 37
byte 1 52
byte 1 105
byte 1 58
byte 1 32
byte 1 37
byte 1 115
byte 1 10
byte 1 0
align 1
LABELV $1041
byte 1 78
byte 1 85
byte 1 76
byte 1 76
byte 1 32
byte 1 101
byte 1 110
byte 1 116
byte 1 45
byte 1 62
byte 1 116
byte 1 104
byte 1 105
byte 1 110
byte 1 107
byte 1 0
align 1
LABELV $1032
byte 1 110
byte 1 111
byte 1 110
byte 1 101
byte 1 0
align 1
LABELV $1012
byte 1 108
byte 1 101
byte 1 97
byte 1 100
byte 1 101
byte 1 114
byte 1 0
align 1
LABELV $1009
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 84
byte 1 101
byte 1 97
byte 1 109
byte 1 32
byte 1 118
byte 1 111
byte 1 116
byte 1 101
byte 1 32
byte 1 112
byte 1 97
byte 1 115
byte 1 115
byte 1 101
byte 1 100
byte 1 46
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $1004
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 84
byte 1 101
byte 1 97
byte 1 109
byte 1 32
byte 1 118
byte 1 111
byte 1 116
byte 1 101
byte 1 32
byte 1 102
byte 1 97
byte 1 105
byte 1 108
byte 1 101
byte 1 100
byte 1 46
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $957
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 37
byte 1 115
byte 1 32
byte 1 105
byte 1 115
byte 1 32
byte 1 116
byte 1 104
byte 1 101
byte 1 32
byte 1 110
byte 1 101
byte 1 119
byte 1 32
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 32
byte 1 108
byte 1 101
byte 1 97
byte 1 100
byte 1 101
byte 1 114
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $947
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 37
byte 1 115
byte 1 32
byte 1 105
byte 1 115
byte 1 32
byte 1 110
byte 1 111
byte 1 116
byte 1 32
byte 1 111
byte 1 110
byte 1 32
byte 1 116
byte 1 104
byte 1 101
byte 1 32
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 32
byte 1 97
byte 1 110
byte 1 121
byte 1 109
byte 1 111
byte 1 114
byte 1 101
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $944
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 37
byte 1 115
byte 1 32
byte 1 105
byte 1 115
byte 1 32
byte 1 110
byte 1 111
byte 1 116
byte 1 32
byte 1 99
byte 1 111
byte 1 110
byte 1 110
byte 1 101
byte 1 99
byte 1 116
byte 1 101
byte 1 100
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $925
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 86
byte 1 111
byte 1 116
byte 1 101
byte 1 32
byte 1 112
byte 1 97
byte 1 115
byte 1 115
byte 1 101
byte 1 100
byte 1 46
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $920
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 86
byte 1 111
byte 1 116
byte 1 101
byte 1 32
byte 1 102
byte 1 97
byte 1 105
byte 1 108
byte 1 101
byte 1 100
byte 1 46
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $911
byte 1 37
byte 1 115
byte 1 10
byte 1 0
align 1
LABELV $822
byte 1 87
byte 1 97
byte 1 114
byte 1 109
byte 1 117
byte 1 112
byte 1 58
byte 1 10
byte 1 0
align 1
LABELV $803
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 66
byte 1 108
byte 1 117
byte 1 101
byte 1 32
byte 1 104
byte 1 105
byte 1 116
byte 1 32
byte 1 116
byte 1 104
byte 1 101
byte 1 32
byte 1 99
byte 1 97
byte 1 112
byte 1 116
byte 1 117
byte 1 114
byte 1 101
byte 1 108
byte 1 105
byte 1 109
byte 1 105
byte 1 116
byte 1 46
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $797
byte 1 67
byte 1 97
byte 1 112
byte 1 116
byte 1 117
byte 1 114
byte 1 101
byte 1 108
byte 1 105
byte 1 109
byte 1 105
byte 1 116
byte 1 32
byte 1 104
byte 1 105
byte 1 116
byte 1 46
byte 1 0
align 1
LABELV $796
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 82
byte 1 101
byte 1 100
byte 1 32
byte 1 104
byte 1 105
byte 1 116
byte 1 32
byte 1 116
byte 1 104
byte 1 101
byte 1 32
byte 1 99
byte 1 97
byte 1 112
byte 1 116
byte 1 117
byte 1 114
byte 1 101
byte 1 108
byte 1 105
byte 1 109
byte 1 105
byte 1 116
byte 1 46
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $786
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 37
byte 1 115
byte 1 94
byte 1 55
byte 1 32
byte 1 104
byte 1 105
byte 1 116
byte 1 32
byte 1 116
byte 1 104
byte 1 101
byte 1 32
byte 1 102
byte 1 114
byte 1 97
byte 1 103
byte 1 108
byte 1 105
byte 1 109
byte 1 105
byte 1 116
byte 1 46
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $773
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 66
byte 1 108
byte 1 117
byte 1 101
byte 1 32
byte 1 104
byte 1 105
byte 1 116
byte 1 32
byte 1 116
byte 1 104
byte 1 101
byte 1 32
byte 1 102
byte 1 114
byte 1 97
byte 1 103
byte 1 108
byte 1 105
byte 1 109
byte 1 105
byte 1 116
byte 1 46
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $767
byte 1 70
byte 1 114
byte 1 97
byte 1 103
byte 1 108
byte 1 105
byte 1 109
byte 1 105
byte 1 116
byte 1 32
byte 1 104
byte 1 105
byte 1 116
byte 1 46
byte 1 0
align 1
LABELV $766
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 82
byte 1 101
byte 1 100
byte 1 32
byte 1 104
byte 1 105
byte 1 116
byte 1 32
byte 1 116
byte 1 104
byte 1 101
byte 1 32
byte 1 102
byte 1 114
byte 1 97
byte 1 103
byte 1 108
byte 1 105
byte 1 109
byte 1 105
byte 1 116
byte 1 46
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $756
byte 1 84
byte 1 105
byte 1 109
byte 1 101
byte 1 108
byte 1 105
byte 1 109
byte 1 105
byte 1 116
byte 1 32
byte 1 104
byte 1 105
byte 1 116
byte 1 46
byte 1 0
align 1
LABELV $755
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 84
byte 1 105
byte 1 109
byte 1 101
byte 1 108
byte 1 105
byte 1 109
byte 1 105
byte 1 116
byte 1 32
byte 1 104
byte 1 105
byte 1 116
byte 1 46
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $657
byte 1 115
byte 1 112
byte 1 76
byte 1 111
byte 1 115
byte 1 101
byte 1 10
byte 1 0
align 1
LABELV $656
byte 1 115
byte 1 112
byte 1 87
byte 1 105
byte 1 110
byte 1 10
byte 1 0
align 1
LABELV $633
byte 1 115
byte 1 99
byte 1 111
byte 1 114
byte 1 101
byte 1 58
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 32
byte 1 112
byte 1 105
byte 1 110
byte 1 103
byte 1 58
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 32
byte 1 99
byte 1 108
byte 1 105
byte 1 101
byte 1 110
byte 1 116
byte 1 58
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 37
byte 1 115
byte 1 10
byte 1 0
align 1
LABELV $616
byte 1 114
byte 1 101
byte 1 100
byte 1 58
byte 1 37
byte 1 105
byte 1 32
byte 1 32
byte 1 98
byte 1 108
byte 1 117
byte 1 101
byte 1 58
byte 1 37
byte 1 105
byte 1 10
byte 1 0
align 1
LABELV $607
byte 1 69
byte 1 120
byte 1 105
byte 1 116
byte 1 58
byte 1 32
byte 1 37
byte 1 115
byte 1 10
byte 1 0
align 1
LABELV $600
byte 1 37
byte 1 115
byte 1 0
align 1
LABELV $594
byte 1 37
byte 1 51
byte 1 105
byte 1 58
byte 1 37
byte 1 105
byte 1 37
byte 1 105
byte 1 32
byte 1 0
align 1
LABELV $570
byte 1 118
byte 1 115
byte 1 116
byte 1 114
byte 1 32
byte 1 110
byte 1 101
byte 1 120
byte 1 116
byte 1 109
byte 1 97
byte 1 112
byte 1 10
byte 1 0
align 1
LABELV $569
byte 1 118
byte 1 115
byte 1 116
byte 1 114
byte 1 32
byte 1 100
byte 1 49
byte 1 10
byte 1 0
align 1
LABELV $568
byte 1 118
byte 1 115
byte 1 116
byte 1 114
byte 1 32
byte 1 100
byte 1 50
byte 1 0
align 1
LABELV $567
byte 1 109
byte 1 97
byte 1 112
byte 1 95
byte 1 114
byte 1 101
byte 1 115
byte 1 116
byte 1 97
byte 1 114
byte 1 116
byte 1 32
byte 1 48
byte 1 0
align 1
LABELV $564
byte 1 100
byte 1 49
byte 1 0
align 1
LABELV $563
byte 1 110
byte 1 101
byte 1 120
byte 1 116
byte 1 109
byte 1 97
byte 1 112
byte 1 0
align 1
LABELV $559
byte 1 109
byte 1 97
byte 1 112
byte 1 95
byte 1 114
byte 1 101
byte 1 115
byte 1 116
byte 1 97
byte 1 114
byte 1 116
byte 1 32
byte 1 48
byte 1 10
byte 1 0
align 1
LABELV $512
byte 1 105
byte 1 110
byte 1 102
byte 1 111
byte 1 95
byte 1 112
byte 1 108
byte 1 97
byte 1 121
byte 1 101
byte 1 114
byte 1 95
byte 1 105
byte 1 110
byte 1 116
byte 1 101
byte 1 114
byte 1 109
byte 1 105
byte 1 115
byte 1 115
byte 1 105
byte 1 111
byte 1 110
byte 1 0
align 1
LABELV $479
byte 1 37
byte 1 105
byte 1 0
align 1
LABELV $343
byte 1 115
byte 1 0
align 1
LABELV $322
byte 1 102
byte 1 0
align 1
LABELV $288
byte 1 83
byte 1 104
byte 1 117
byte 1 116
byte 1 100
byte 1 111
byte 1 119
byte 1 110
byte 1 71
byte 1 97
byte 1 109
byte 1 101
byte 1 58
byte 1 10
byte 1 0
align 1
LABELV $284
byte 1 61
byte 1 61
byte 1 61
byte 1 61
byte 1 32
byte 1 83
byte 1 104
byte 1 117
byte 1 116
byte 1 100
byte 1 111
byte 1 119
byte 1 110
byte 1 71
byte 1 97
byte 1 109
byte 1 101
byte 1 32
byte 1 61
byte 1 61
byte 1 61
byte 1 61
byte 1 10
byte 1 0
align 1
LABELV $282
byte 1 98
byte 1 111
byte 1 116
byte 1 95
byte 1 101
byte 1 110
byte 1 97
byte 1 98
byte 1 108
byte 1 101
byte 1 0
align 1
LABELV $279
byte 1 109
byte 1 111
byte 1 100
byte 1 101
byte 1 108
byte 1 115
byte 1 47
byte 1 109
byte 1 97
byte 1 112
byte 1 111
byte 1 98
byte 1 106
byte 1 101
byte 1 99
byte 1 116
byte 1 115
byte 1 47
byte 1 112
byte 1 111
byte 1 100
byte 1 105
byte 1 117
byte 1 109
byte 1 47
byte 1 112
byte 1 111
byte 1 100
byte 1 105
byte 1 117
byte 1 109
byte 1 52
byte 1 46
byte 1 109
byte 1 100
byte 1 51
byte 1 0
align 1
LABELV $277
byte 1 99
byte 1 111
byte 1 109
byte 1 95
byte 1 98
byte 1 117
byte 1 105
byte 1 108
byte 1 100
byte 1 83
byte 1 99
byte 1 114
byte 1 105
byte 1 112
byte 1 116
byte 1 0
align 1
LABELV $273
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 10
byte 1 0
align 1
LABELV $267
byte 1 99
byte 1 108
byte 1 105
byte 1 101
byte 1 110
byte 1 116
byte 1 115
byte 1 108
byte 1 111
byte 1 116
byte 1 0
align 1
LABELV $251
byte 1 78
byte 1 111
byte 1 116
byte 1 32
byte 1 108
byte 1 111
byte 1 103
byte 1 103
byte 1 105
byte 1 110
byte 1 103
byte 1 32
byte 1 116
byte 1 111
byte 1 32
byte 1 100
byte 1 105
byte 1 115
byte 1 107
byte 1 46
byte 1 10
byte 1 0
align 1
LABELV $250
byte 1 73
byte 1 110
byte 1 105
byte 1 116
byte 1 71
byte 1 97
byte 1 109
byte 1 101
byte 1 58
byte 1 32
byte 1 37
byte 1 115
byte 1 10
byte 1 0
align 1
LABELV $249
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 10
byte 1 0
align 1
LABELV $247
byte 1 87
byte 1 65
byte 1 82
byte 1 78
byte 1 73
byte 1 78
byte 1 71
byte 1 58
byte 1 32
byte 1 67
byte 1 111
byte 1 117
byte 1 108
byte 1 100
byte 1 110
byte 1 39
byte 1 116
byte 1 32
byte 1 111
byte 1 112
byte 1 101
byte 1 110
byte 1 32
byte 1 108
byte 1 111
byte 1 103
byte 1 102
byte 1 105
byte 1 108
byte 1 101
byte 1 58
byte 1 32
byte 1 37
byte 1 115
byte 1 10
byte 1 0
align 1
LABELV $232
byte 1 115
byte 1 111
byte 1 117
byte 1 110
byte 1 100
byte 1 47
byte 1 112
byte 1 108
byte 1 97
byte 1 121
byte 1 101
byte 1 114
byte 1 47
byte 1 102
byte 1 114
byte 1 121
byte 1 46
byte 1 119
byte 1 97
byte 1 118
byte 1 0
align 1
LABELV $228
byte 1 103
byte 1 97
byte 1 109
byte 1 101
byte 1 100
byte 1 97
byte 1 116
byte 1 101
byte 1 58
byte 1 32
byte 1 37
byte 1 115
byte 1 10
byte 1 0
align 1
LABELV $227
byte 1 103
byte 1 97
byte 1 109
byte 1 101
byte 1 110
byte 1 97
byte 1 109
byte 1 101
byte 1 58
byte 1 32
byte 1 37
byte 1 115
byte 1 10
byte 1 0
align 1
LABELV $226
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 32
byte 1 71
byte 1 97
byte 1 109
byte 1 101
byte 1 32
byte 1 73
byte 1 110
byte 1 105
byte 1 116
byte 1 105
byte 1 97
byte 1 108
byte 1 105
byte 1 122
byte 1 97
byte 1 116
byte 1 105
byte 1 111
byte 1 110
byte 1 32
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 45
byte 1 10
byte 1 0
align 1
LABELV $220
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 83
byte 1 101
byte 1 114
byte 1 118
byte 1 101
byte 1 114
byte 1 58
byte 1 32
byte 1 37
byte 1 115
byte 1 32
byte 1 99
byte 1 104
byte 1 97
byte 1 110
byte 1 103
byte 1 101
byte 1 100
byte 1 32
byte 1 116
byte 1 111
byte 1 32
byte 1 37
byte 1 115
byte 1 10
byte 1 34
byte 1 0
align 1
LABELV $205
byte 1 103
byte 1 95
byte 1 103
byte 1 97
byte 1 109
byte 1 101
byte 1 116
byte 1 121
byte 1 112
byte 1 101
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 105
byte 1 115
byte 1 32
byte 1 111
byte 1 117
byte 1 116
byte 1 32
byte 1 111
byte 1 102
byte 1 32
byte 1 114
byte 1 97
byte 1 110
byte 1 103
byte 1 101
byte 1 44
byte 1 32
byte 1 100
byte 1 101
byte 1 102
byte 1 97
byte 1 117
byte 1 108
byte 1 116
byte 1 105
byte 1 110
byte 1 103
byte 1 32
byte 1 116
byte 1 111
byte 1 32
byte 1 48
byte 1 10
byte 1 0
align 1
LABELV $188
byte 1 116
byte 1 101
byte 1 120
byte 1 116
byte 1 117
byte 1 114
byte 1 101
byte 1 115
byte 1 47
byte 1 99
byte 1 116
byte 1 102
byte 1 50
byte 1 47
byte 1 98
byte 1 108
byte 1 117
byte 1 101
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 48
byte 1 50
byte 1 0
align 1
LABELV $187
byte 1 116
byte 1 101
byte 1 120
byte 1 116
byte 1 117
byte 1 114
byte 1 101
byte 1 115
byte 1 47
byte 1 99
byte 1 116
byte 1 102
byte 1 50
byte 1 47
byte 1 98
byte 1 108
byte 1 117
byte 1 101
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 48
byte 1 49
byte 1 0
align 1
LABELV $185
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 95
byte 1 105
byte 1 99
byte 1 111
byte 1 110
byte 1 47
byte 1 37
byte 1 115
byte 1 95
byte 1 98
byte 1 108
byte 1 117
byte 1 101
byte 1 0
align 1
LABELV $184
byte 1 116
byte 1 101
byte 1 120
byte 1 116
byte 1 117
byte 1 114
byte 1 101
byte 1 115
byte 1 47
byte 1 99
byte 1 116
byte 1 102
byte 1 50
byte 1 47
byte 1 114
byte 1 101
byte 1 100
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 48
byte 1 50
byte 1 0
align 1
LABELV $183
byte 1 116
byte 1 101
byte 1 120
byte 1 116
byte 1 117
byte 1 114
byte 1 101
byte 1 115
byte 1 47
byte 1 99
byte 1 116
byte 1 102
byte 1 50
byte 1 47
byte 1 114
byte 1 101
byte 1 100
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 48
byte 1 49
byte 1 0
align 1
LABELV $181
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 95
byte 1 105
byte 1 99
byte 1 111
byte 1 110
byte 1 47
byte 1 37
byte 1 115
byte 1 95
byte 1 114
byte 1 101
byte 1 100
byte 1 0
align 1
LABELV $178
byte 1 37
byte 1 105
byte 1 32
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 115
byte 1 32
byte 1 119
byte 1 105
byte 1 116
byte 1 104
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 101
byte 1 110
byte 1 116
byte 1 105
byte 1 116
byte 1 105
byte 1 101
byte 1 115
byte 1 10
byte 1 0
align 1
LABELV $131
byte 1 103
byte 1 95
byte 1 114
byte 1 97
byte 1 110
byte 1 107
byte 1 105
byte 1 110
byte 1 103
byte 1 115
byte 1 0
align 1
LABELV $130
byte 1 112
byte 1 109
byte 1 111
byte 1 118
byte 1 101
byte 1 95
byte 1 109
byte 1 115
byte 1 101
byte 1 99
byte 1 0
align 1
LABELV $129
byte 1 112
byte 1 109
byte 1 111
byte 1 118
byte 1 101
byte 1 95
byte 1 102
byte 1 105
byte 1 120
byte 1 101
byte 1 100
byte 1 0
align 1
LABELV $128
byte 1 103
byte 1 95
byte 1 115
byte 1 109
byte 1 111
byte 1 111
byte 1 116
byte 1 104
byte 1 67
byte 1 108
byte 1 105
byte 1 101
byte 1 110
byte 1 116
byte 1 115
byte 1 0
align 1
LABELV $127
byte 1 50
byte 1 48
byte 1 48
byte 1 48
byte 1 48
byte 1 0
align 1
LABELV $126
byte 1 103
byte 1 95
byte 1 112
byte 1 114
byte 1 111
byte 1 120
byte 1 77
byte 1 105
byte 1 110
byte 1 101
byte 1 84
byte 1 105
byte 1 109
byte 1 101
byte 1 111
byte 1 117
byte 1 116
byte 1 0
align 1
LABELV $125
byte 1 103
byte 1 95
byte 1 101
byte 1 110
byte 1 97
byte 1 98
byte 1 108
byte 1 101
byte 1 66
byte 1 114
byte 1 101
byte 1 97
byte 1 116
byte 1 104
byte 1 0
align 1
LABELV $124
byte 1 103
byte 1 95
byte 1 101
byte 1 110
byte 1 97
byte 1 98
byte 1 108
byte 1 101
byte 1 68
byte 1 117
byte 1 115
byte 1 116
byte 1 0
align 1
LABELV $123
byte 1 117
byte 1 105
byte 1 95
byte 1 115
byte 1 105
byte 1 110
byte 1 103
byte 1 108
byte 1 101
byte 1 80
byte 1 108
byte 1 97
byte 1 121
byte 1 101
byte 1 114
byte 1 65
byte 1 99
byte 1 116
byte 1 105
byte 1 118
byte 1 101
byte 1 0
align 1
LABELV $122
byte 1 80
byte 1 97
byte 1 103
byte 1 97
byte 1 110
byte 1 115
byte 1 0
align 1
LABELV $121
byte 1 103
byte 1 95
byte 1 98
byte 1 108
byte 1 117
byte 1 101
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 0
align 1
LABELV $120
byte 1 83
byte 1 116
byte 1 114
byte 1 111
byte 1 103
byte 1 103
byte 1 115
byte 1 0
align 1
LABELV $119
byte 1 103
byte 1 95
byte 1 114
byte 1 101
byte 1 100
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 0
align 1
LABELV $118
byte 1 103
byte 1 95
byte 1 99
byte 1 117
byte 1 98
byte 1 101
byte 1 84
byte 1 105
byte 1 109
byte 1 101
byte 1 111
byte 1 117
byte 1 116
byte 1 0
align 1
LABELV $117
byte 1 49
byte 1 48
byte 1 0
align 1
LABELV $116
byte 1 103
byte 1 95
byte 1 111
byte 1 98
byte 1 101
byte 1 108
byte 1 105
byte 1 115
byte 1 107
byte 1 82
byte 1 101
byte 1 115
byte 1 112
byte 1 97
byte 1 119
byte 1 110
byte 1 68
byte 1 101
byte 1 108
byte 1 97
byte 1 121
byte 1 0
align 1
LABELV $115
byte 1 49
byte 1 53
byte 1 0
align 1
LABELV $114
byte 1 103
byte 1 95
byte 1 111
byte 1 98
byte 1 101
byte 1 108
byte 1 105
byte 1 115
byte 1 107
byte 1 82
byte 1 101
byte 1 103
byte 1 101
byte 1 110
byte 1 65
byte 1 109
byte 1 111
byte 1 117
byte 1 110
byte 1 116
byte 1 0
align 1
LABELV $113
byte 1 103
byte 1 95
byte 1 111
byte 1 98
byte 1 101
byte 1 108
byte 1 105
byte 1 115
byte 1 107
byte 1 82
byte 1 101
byte 1 103
byte 1 101
byte 1 110
byte 1 80
byte 1 101
byte 1 114
byte 1 105
byte 1 111
byte 1 100
byte 1 0
align 1
LABELV $112
byte 1 50
byte 1 53
byte 1 48
byte 1 48
byte 1 0
align 1
LABELV $111
byte 1 103
byte 1 95
byte 1 111
byte 1 98
byte 1 101
byte 1 108
byte 1 105
byte 1 115
byte 1 107
byte 1 72
byte 1 101
byte 1 97
byte 1 108
byte 1 116
byte 1 104
byte 1 0
align 1
LABELV $110
byte 1 103
byte 1 95
byte 1 108
byte 1 105
byte 1 115
byte 1 116
byte 1 69
byte 1 110
byte 1 116
byte 1 105
byte 1 116
byte 1 121
byte 1 0
align 1
LABELV $109
byte 1 103
byte 1 95
byte 1 97
byte 1 108
byte 1 108
byte 1 111
byte 1 119
byte 1 86
byte 1 111
byte 1 116
byte 1 101
byte 1 0
align 1
LABELV $108
byte 1 55
byte 1 48
byte 1 0
align 1
LABELV $107
byte 1 103
byte 1 95
byte 1 112
byte 1 111
byte 1 100
byte 1 105
byte 1 117
byte 1 109
byte 1 68
byte 1 114
byte 1 111
byte 1 112
byte 1 0
align 1
LABELV $106
byte 1 56
byte 1 48
byte 1 0
align 1
LABELV $105
byte 1 103
byte 1 95
byte 1 112
byte 1 111
byte 1 100
byte 1 105
byte 1 117
byte 1 109
byte 1 68
byte 1 105
byte 1 115
byte 1 116
byte 1 0
align 1
LABELV $104
byte 1 99
byte 1 111
byte 1 109
byte 1 95
byte 1 98
byte 1 108
byte 1 111
byte 1 111
byte 1 100
byte 1 0
align 1
LABELV $103
byte 1 103
byte 1 95
byte 1 109
byte 1 111
byte 1 116
byte 1 100
byte 1 0
align 1
LABELV $102
byte 1 103
byte 1 95
byte 1 100
byte 1 101
byte 1 98
byte 1 117
byte 1 103
byte 1 65
byte 1 108
byte 1 108
byte 1 111
byte 1 99
byte 1 0
align 1
LABELV $101
byte 1 103
byte 1 95
byte 1 100
byte 1 101
byte 1 98
byte 1 117
byte 1 103
byte 1 68
byte 1 97
byte 1 109
byte 1 97
byte 1 103
byte 1 101
byte 1 0
align 1
LABELV $100
byte 1 103
byte 1 95
byte 1 100
byte 1 101
byte 1 98
byte 1 117
byte 1 103
byte 1 77
byte 1 111
byte 1 118
byte 1 101
byte 1 0
align 1
LABELV $99
byte 1 103
byte 1 95
byte 1 105
byte 1 110
byte 1 97
byte 1 99
byte 1 116
byte 1 105
byte 1 118
byte 1 105
byte 1 116
byte 1 121
byte 1 0
align 1
LABELV $98
byte 1 103
byte 1 95
byte 1 102
byte 1 111
byte 1 114
byte 1 99
byte 1 101
byte 1 114
byte 1 101
byte 1 115
byte 1 112
byte 1 97
byte 1 119
byte 1 110
byte 1 0
align 1
LABELV $97
byte 1 51
byte 1 48
byte 1 0
align 1
LABELV $96
byte 1 103
byte 1 95
byte 1 119
byte 1 101
byte 1 97
byte 1 112
byte 1 111
byte 1 110
byte 1 84
byte 1 101
byte 1 97
byte 1 109
byte 1 82
byte 1 101
byte 1 115
byte 1 112
byte 1 97
byte 1 119
byte 1 110
byte 1 0
align 1
LABELV $95
byte 1 53
byte 1 0
align 1
LABELV $94
byte 1 103
byte 1 95
byte 1 119
byte 1 101
byte 1 97
byte 1 112
byte 1 111
byte 1 110
byte 1 114
byte 1 101
byte 1 115
byte 1 112
byte 1 97
byte 1 119
byte 1 110
byte 1 0
align 1
LABELV $93
byte 1 51
byte 1 0
align 1
LABELV $92
byte 1 103
byte 1 95
byte 1 113
byte 1 117
byte 1 97
byte 1 100
byte 1 102
byte 1 97
byte 1 99
byte 1 116
byte 1 111
byte 1 114
byte 1 0
align 1
LABELV $91
byte 1 49
byte 1 48
byte 1 48
byte 1 48
byte 1 0
align 1
LABELV $90
byte 1 103
byte 1 95
byte 1 107
byte 1 110
byte 1 111
byte 1 99
byte 1 107
byte 1 98
byte 1 97
byte 1 99
byte 1 107
byte 1 0
align 1
LABELV $89
byte 1 56
byte 1 48
byte 1 48
byte 1 0
align 1
LABELV $88
byte 1 103
byte 1 95
byte 1 103
byte 1 114
byte 1 97
byte 1 118
byte 1 105
byte 1 116
byte 1 121
byte 1 0
align 1
LABELV $87
byte 1 51
byte 1 50
byte 1 48
byte 1 0
align 1
LABELV $86
byte 1 103
byte 1 95
byte 1 115
byte 1 112
byte 1 101
byte 1 101
byte 1 100
byte 1 0
align 1
LABELV $85
byte 1 100
byte 1 101
byte 1 100
byte 1 105
byte 1 99
byte 1 97
byte 1 116
byte 1 101
byte 1 100
byte 1 0
align 1
LABELV $84
byte 1 103
byte 1 95
byte 1 110
byte 1 101
byte 1 101
byte 1 100
byte 1 112
byte 1 97
byte 1 115
byte 1 115
byte 1 0
align 1
LABELV $83
byte 1 49
byte 1 0
align 1
LABELV $82
byte 1 103
byte 1 95
byte 1 102
byte 1 105
byte 1 108
byte 1 116
byte 1 101
byte 1 114
byte 1 66
byte 1 97
byte 1 110
byte 1 0
align 1
LABELV $81
byte 1 103
byte 1 95
byte 1 98
byte 1 97
byte 1 110
byte 1 73
byte 1 80
byte 1 115
byte 1 0
align 1
LABELV $80
byte 1 103
byte 1 95
byte 1 112
byte 1 97
byte 1 115
byte 1 115
byte 1 119
byte 1 111
byte 1 114
byte 1 100
byte 1 0
align 1
LABELV $79
byte 1 103
byte 1 95
byte 1 108
byte 1 111
byte 1 103
byte 1 115
byte 1 121
byte 1 110
byte 1 99
byte 1 0
align 1
LABELV $78
byte 1 103
byte 1 97
byte 1 109
byte 1 101
byte 1 115
byte 1 46
byte 1 108
byte 1 111
byte 1 103
byte 1 0
align 1
LABELV $77
byte 1 103
byte 1 95
byte 1 108
byte 1 111
byte 1 103
byte 1 0
align 1
LABELV $76
byte 1 103
byte 1 95
byte 1 100
byte 1 111
byte 1 87
byte 1 97
byte 1 114
byte 1 109
byte 1 117
byte 1 112
byte 1 0
align 1
LABELV $75
byte 1 103
byte 1 95
byte 1 119
byte 1 97
byte 1 114
byte 1 109
byte 1 117
byte 1 112
byte 1 0
align 1
LABELV $74
byte 1 103
byte 1 95
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 70
byte 1 111
byte 1 114
byte 1 99
byte 1 101
byte 1 66
byte 1 97
byte 1 108
byte 1 97
byte 1 110
byte 1 99
byte 1 101
byte 1 0
align 1
LABELV $73
byte 1 103
byte 1 95
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 65
byte 1 117
byte 1 116
byte 1 111
byte 1 74
byte 1 111
byte 1 105
byte 1 110
byte 1 0
align 1
LABELV $72
byte 1 103
byte 1 95
byte 1 102
byte 1 114
byte 1 105
byte 1 101
byte 1 110
byte 1 100
byte 1 108
byte 1 121
byte 1 70
byte 1 105
byte 1 114
byte 1 101
byte 1 0
align 1
LABELV $71
byte 1 103
byte 1 95
byte 1 115
byte 1 121
byte 1 110
byte 1 99
byte 1 104
byte 1 114
byte 1 111
byte 1 110
byte 1 111
byte 1 117
byte 1 115
byte 1 67
byte 1 108
byte 1 105
byte 1 101
byte 1 110
byte 1 116
byte 1 115
byte 1 0
align 1
LABELV $70
byte 1 99
byte 1 97
byte 1 112
byte 1 116
byte 1 117
byte 1 114
byte 1 101
byte 1 108
byte 1 105
byte 1 109
byte 1 105
byte 1 116
byte 1 0
align 1
LABELV $69
byte 1 116
byte 1 105
byte 1 109
byte 1 101
byte 1 108
byte 1 105
byte 1 109
byte 1 105
byte 1 116
byte 1 0
align 1
LABELV $68
byte 1 50
byte 1 48
byte 1 0
align 1
LABELV $67
byte 1 102
byte 1 114
byte 1 97
byte 1 103
byte 1 108
byte 1 105
byte 1 109
byte 1 105
byte 1 116
byte 1 0
align 1
LABELV $66
byte 1 100
byte 1 109
byte 1 102
byte 1 108
byte 1 97
byte 1 103
byte 1 115
byte 1 0
align 1
LABELV $65
byte 1 103
byte 1 95
byte 1 109
byte 1 97
byte 1 120
byte 1 71
byte 1 97
byte 1 109
byte 1 101
byte 1 67
byte 1 108
byte 1 105
byte 1 101
byte 1 110
byte 1 116
byte 1 115
byte 1 0
align 1
LABELV $64
byte 1 56
byte 1 0
align 1
LABELV $63
byte 1 115
byte 1 118
byte 1 95
byte 1 109
byte 1 97
byte 1 120
byte 1 99
byte 1 108
byte 1 105
byte 1 101
byte 1 110
byte 1 116
byte 1 115
byte 1 0
align 1
LABELV $62
byte 1 103
byte 1 95
byte 1 103
byte 1 97
byte 1 109
byte 1 101
byte 1 116
byte 1 121
byte 1 112
byte 1 101
byte 1 0
align 1
LABELV $61
byte 1 48
byte 1 0
align 1
LABELV $60
byte 1 103
byte 1 95
byte 1 114
byte 1 101
byte 1 115
byte 1 116
byte 1 97
byte 1 114
byte 1 116
byte 1 101
byte 1 100
byte 1 0
align 1
LABELV $59
byte 1 83
byte 1 101
byte 1 112
byte 1 32
byte 1 49
byte 1 54
byte 1 32
byte 1 50
byte 1 48
byte 1 49
byte 1 56
byte 1 0
align 1
LABELV $58
byte 1 103
byte 1 97
byte 1 109
byte 1 101
byte 1 100
byte 1 97
byte 1 116
byte 1 101
byte 1 0
align 1
LABELV $57
byte 1 98
byte 1 97
byte 1 115
byte 1 101
byte 1 113
byte 1 51
byte 1 0
align 1
LABELV $56
byte 1 103
byte 1 97
byte 1 109
byte 1 101
byte 1 110
byte 1 97
byte 1 109
byte 1 101
byte 1 0
align 1
LABELV $55
byte 1 0
align 1
LABELV $54
byte 1 115
byte 1 118
byte 1 95
byte 1 99
byte 1 104
byte 1 101
byte 1 97
byte 1 116
byte 1 115
byte 1 0
|
_tests/trconvert/antlr2/asn1.g4 | SKalt/Domemtech.Trash | 16 | 5759 |
//*************************************************************************
//********** PARSER DEFINITIONS
//*************************************************************************
grammar ASN;
// Grammar Definitions
module_definition
: ( module_identifier)
DEFINITIONS_KW
((EXPLICIT_KW
|IMPLICIT_KW
|AUTOMATIC_KW
) TAGS_KW |)
(EXTENSIBILITY_KW IMPLIED_KW | )
ASSIGN_OP
BEGIN_KW
module_body
END_KW
;
module_identifier
: ((UPPER)
(( obj_id_comp_lst)|)
)
;
obj_id_comp_lst
: L_BRACE
( defined_value)?
( obj_id_component)+
R_BRACE
;
obj_id_component
: ((NUMBER)
|((LOWER)
( L_PAREN
(NUMBER)
R_PAREN ) ? )
|( defined_value))
;
tag_default
: (EXPLICIT_KW)
| (IMPLICIT_KW)
| (AUTOMATIC_KW)
;
module_body
// : (exports[module])? (imports[module])? (assignment[module])+
: (exports|) (imports|) ((assignment)+ |)
;
exports
// : (EXPORTS_KW {module.exported=true;}) (s = symbol { module.exportList.add(s) ; })
// (COMMA (s = symbol {module.exportList.add(s) ;} ) )* SEMI
// ;
: EXPORTS_KW
(( symbol_list |)
|ALL_KW)
SEMI
;
imports
: (IMPORTS_KW (((symbols_from_module)+)|) SEMI)
;
symbols_from_module
: (( symbol_list) FROM_KW
(UPPER
( obj_id_comp_lst
|( defined_value)|)))
;
symbol_list
: (( symbol)
(COMMA ( symbol))*)
;
symbol
:UPPER
|LOWER
|macroName //To solve the matching of Macro Name with Keyword
;
macroName
: OPERATION_KW
| ERROR_KW
| 'BIND'
| 'UNBIND'
| 'APPLICATION-SERVICE-ELEMENT'
| 'APPLICATION-CONTEXT'
| 'EXTENSION'
| 'EXTENSIONS'
| 'EXTENSION-ATTRIBUTE'
| 'TOKEN'
| 'TOKEN-DATA'
| 'SECURITY-CATEGORY'
| 'OBJECT'
| 'PORT'
| 'REFINE'
| 'ABSTRACT-BIND'
| 'ABSTRACT-UNBIND'
| 'ABSTRACT-OPERATION'
| 'ABSTRACT-ERROR'
| 'ALGORITHM'
| 'ENCRYPTED'
| 'SIGNED'
| 'SIGNATURE'
| 'PROTECTED'
| 'OBJECT-TYPE'
;
assignment
// Type Assignment Definition
: (UPPER ASSIGN_OP (type))
// Value Assignment definition
| (LOWER ( type ) ASSIGN_OP ( value))
// Definition of Macro type. Consume the definitions . No Actions
| UPPER 'MACRO' ASSIGN_OP BEGIN_KW (~(END_KW))* END_KW
// ***************************************************
// Define the following
// ***************************************************
// |XMLValueAssignment
// |ValueSetTypeAssignment
// |ObjectClassAssignment
// |ObjectAssignment
// |ObjectSetAssignment
// |ParameterizedAssignment
;
/*TYPES===============================================================*/
type
: ( built_in_type) // Builtin Type
| ( defined_type) // Referenced Type
// | (obj = useful_type) // Referenced Type OK contained in Character_Str type
| ( selection_type ) // Referenced Type // Grammar ok Frames to be created
// | (obj = type_from_Object ) // Referenced Type
// | (obj = value_set_from_objects) // Referenced Type
// | (obj = type_and_constraint ) // Constrained Type Causing Infinit Recursion. In case of
// Parsing errors this needs to be built in the assignment itself
// | (obj = type_with_constraint) // Constrained Type OK in built in types
| ( macros_type)
;
built_in_type
: ( any_type)
| ( bit_string_type)
| ( boolean_type )
| ( character_str_type) // Not Correct
| ( choice_type)
| ( embedded_type) EMBEDDED_KW PDV_KW
| ( enum_type)
| ( external_type)
// | INSTANCE_KW OF_KW
| ( integer_type )
| ( null_type )
// | ObjectClassFieldType OBJECT_DESCRIPTOR_KW
| ( object_identifier_type)
| ( octetString_type)
| ( real_type )
| ( relativeOid_type)
| ( sequence_type)
| ( sequenceof_type)
| ( set_type)
| ( setof_type)
| ( tagged_type)
;
any_type
: ( ANY_KW ( DEFINED_KW BY_KWLOWER)? )
;
bit_string_type
: (BIT_KW STRING_KW (namedNumber_list)?
( constraint )? )
;
// Includes Useful types as well
character_str_type
: ((CHARACTER_KW STRING_KW)
| ( character_set
( constraint)? ))
;
character_set
: (BMP_STR_KW)
| (GENERALIZED_TIME_KW)
| (GENERAL_STR_KW)
| (GRAPHIC_STR_KW)
| (IA5_STRING_KW)
| (ISO646_STR_KW)
| (NUMERIC_STR_KW)
| (PRINTABLE_STR_KW)
| (TELETEX_STR_KW)
| (T61_STR_KW)
| (UNIVERSAL_STR_KW)
| (UTF8_STR_KW)
| (UTC_TIME_KW)
| (VIDEOTEX_STR_KW)
| (VISIBLE_STR_KW)
;
boolean_type
: BOOLEAN_KW
;
choice_type
: ( CHOICE_KW L_BRACE ( elementType_list) R_BRACE )
;
embedded_type
: (EMBEDDED_KW PDV_KW)
;
enum_type
: ( ENUMERATED_KW ( namedNumber_list) )
;
external_type
: EXTERNAL_KW
;
integer_type
: ( INTEGER_KW ( namedNumber_list
| constraint)? )
;
null_type
: NULL_KW
;
object_identifier_type
: OBJECT_KW IDENTIFIER_KW
;
octetString_type
: ( OCTET_KW STRING_KW ( constraint)? )
;
real_type
: REAL_KW
;
relativeOid_type
: RELATIVE_KW MINUS OID_KW
;
sequence_type
: ( SEQUENCE_KW
L_BRACE
( elementType_list)?
R_BRACE )
;
sequenceof_type
: ( SEQUENCE_KW
(SIZE_KW( constraint))? OF_KW
( type) )
;
set_type
: ( SET_KW L_BRACE ( elementType_list)? R_BRACE )
;
setof_type
: (SET_KW
(SIZE_KW( constraint))? OF_KW
( type) )
;
tagged_type
: (( tag)
( tag_default)?
( type))
;
tag
: (L_BRACKET ( clazz)? ( class_NUMBER) R_BRACKET )
;
clazz
: (UNIVERSAL_KW)
| (APPLICATION_KW)
| (PRIVATE_KW)
;
class_NUMBER
: ((NUMBER)
| (LOWER) )
;
// Useful types
defined_type
: ((UPPER
DOT )?
(UPPER)
( constraint)? )
;
// Referenced Type
selection_type
: ((LOWER)
LESS
(type))
;
//Constrained Type Causes Infinite Recursion
// Resolved by parsing the constraints along with the types using them.
//type_and_constraint returns [Object obj]
//{AsnTypeAndConstraint tpcns = new AsnTypeAndConstraint();
//obj=null;Object obj1;AsnConstraint cnstrnt;}
// : ((obj1 = type { tpcns.type = obj1;})
// (cnstrnt = constraint {tpcns.constraint = cnstrnt;}))
// {obj=tpcns; tpcns=null;}
// ;
// Macros Types
macros_type
: ( operation_macro)
| ( error_macro)
| ( objecttype_macro)
;
operation_macro
: ( 'OPERATION'
(ARGUMENT_KW (LOWER)?
(( type)
))?
(RESULT_KW (SEMI|(LOWER)?
(type
)|))?
(ERRORS_KW L_BRACE (operation_errorlist|) R_BRACE )?
(LINKED_KW L_BRACE (linkedOp_list)? R_BRACE )? )
;
operation_errorlist
: typeorvalue
(COMMA ( typeorvalue))*
;
linkedOp_list
: typeorvalue
(COMMA ( typeorvalue))*
;
error_macro
: ( ERROR_KW (PARAMETER_KW
((LOWER)?
( type) ) )? )
;
objecttype_macro
: ('OBJECT-TYPE' 'SYNTAX' ( type )
('ACCESS'LOWER)
('STATUS'LOWER)
('DESCRIPTION' CHARACTER_KW STRING_KW)?
('REFERENCE' CHARACTER_KW STRING_KW)?
('INDEX' L_BRACE (typeorvaluelist) R_BRACE)?
('DEFVAL' L_BRACE ( value) R_BRACE )? )
;
typeorvaluelist
: (( typeorvalue)
(COMMA (typeorvalue)* ))
;
typeorvalue
: (( type) | value)
;
elementType_list
: ( elementType
(COMMA ( elementType))*)
;
elementType
: ( (LOWER
( tag)?
( tag_default)?
( type) ( (OPTIONAL_KW)
| (DEFAULT_KW value ))? )
| COMPONENTS_KW OF_KW( type ))
;
namedNumber_list
: ( L_BRACE ( namedNumber)
(COMMA ( namedNumber) )* R_BRACE )
;
namedNumber
: (LOWER L_PAREN
( signed_number
| ( defined_value)) R_PAREN )
;
// Updated Grammar for ASN constraints
constraint
: L_PAREN
(element_set_specs)?
(exception_spec)?
R_PAREN
;
exception_spec
: (EXCLAMATION
((signed_number)
|(defined_value)
|type COLONvalue))
;
element_set_specs
: (element_set_spec
(COMMA DOTDOTDOT)?
(COMMAelement_set_spec)?)
;
element_set_spec
:intersections
((BAR | UNION_KW )intersections)*
| ALL EXCEPTconstraint_elements
;
// Coding is not proper for EXCEPT constraint elements.
// One EXCEPT constraint elements should be tied to one Constraint elements
//(an object of constraint and except list)
// and not in one single list
intersections
:constraint_elements
(EXCEPTconstraint_elements)?
((INTERSECTION | INTERSECTION_KW)constraint_elements
(EXCEPTconstraint_elements)?)*
;
constraint_elements
:( value)
|(value_range)
| (SIZE_KWconstraint)
| (FROM_KWconstraint)
| (L_PARENelement_set_spec R_PAREN)
| ((INCLUDES)?type)
| (PATTERN_KWvalue)
| (WITH_KW
((COMPONENT_KWconstraint)
|
(COMPONENTS_KW
L_BRACE (DOTDOTDOT COMMA)? type_constraint_list R_BRACE )))
;
value_range
: (value | MIN_KW) (LESS)? // lower end
DOTDOT
(LESS)? (value | MAX_KW) // upper end
;
type_constraint_list
:named_constraint
(COMMAnamed_constraint)*
;
named_constraint
:LOWER
(constraint)?
(PRESENT_KW
|ABSENT_KW
| OPTIONAL_KW)?
;
/*-----------VALUES ---------------------------------------*/
value
:(TRUE_KW)
|(FALSE_KW)
|(NULL_KW)
|(C_STRING)
|( defined_value)
|( signed_number)
|(choice_value)
|(sequence_value)
|(sequenceof_value)
|(cstr_value)
|(obj_id_comp_lst)
|(PLUS_INFINITY_KW)
|(MINUS_INFINITY_KW)
;
cstr_value
: ((H_STRING)
|(B_STRING)
| (L_BRACE ((id_list)
|(char_defs_list)
| tuple_or_quad) R_BRACE))
;
id_list
: (LOWER)
(COMMALOWER)*
;
char_defs_list
: char_defs
(COMMA ( char_defs))*
;
tuple_or_quad
: ( signed_number)
COMMA
( signed_number)
((R_BRACE) | (COMMA
( signed_number)
COMMA ( signed_number)))
;
char_defs
: (C_STRING)
| (L_BRACE ( signed_number) COMMA ( signed_number)
((R_BRACE)
|(COMMA ( signed_number)
COMMA ( signed_number) R_BRACE)))
| ( defined_value)
;
choice_value
: ((LOWER)
(COLON)? (value))
;
sequence_value
: L_BRACE ((named_value)?
(COMMAnamed_value)*) R_BRACE
;
sequenceof_value
: L_BRACE ((value)?
(COMMAvalue)*)
R_BRACE
;
defined_value
: ((UPPER
DOT)?LOWER)
;
signed_number
: ((MINUS)?
(NUMBER) )
;
named_value
: (LOWERvalue)
;
ABSENT_KW : 'ABSENT';
ABSTRACT_SYNTAX_KW : 'ABSTRACT-SYNTAX';
ALL_KW : 'ALL';
ANY_KW : 'ANY';
ARGUMENT_KW : 'ARGUMENT';
APPLICATION_KW : 'APPLICATION';
AUTOMATIC_KW : 'AUTOMATIC';
BASED_NUM_KW : 'BASEDNUM';
BEGIN_KW : 'BEGIN';
BIT_KW : 'BIT';
BMP_STRING_KW : 'BMPString';
BOOLEAN_KW : 'BOOLEAN';
BY_KW : 'BY';
CHARACTER_KW : 'CHARACTER';
CHOICE_KW : 'CHOICE';
CLASS_KW : 'CLASS';
COMPONENTS_KW : 'COMPONENTS';
COMPONENT_KW : 'COMPONENT';
CONSTRAINED_KW : 'CONSTRAINED';
DEFAULT_KW : 'DEFAULT';
DEFINED_KW : 'DEFINED';
DEFINITIONS_KW : 'DEFINITIONS';
EMBEDDED_KW : 'EMBEDDED';
END_KW : 'END';
ENUMERATED_KW : 'ENUMERATED';
ERROR_KW : 'ERROR';
ERRORS_KW : 'ERRORS';
EXCEPT_KW : 'EXCEPT';
EXPLICIT_KW : 'EXPLICIT';
EXPORTS_KW : 'EXPORTS';
EXTENSIBILITY_KW : 'EXTENSIBILITY';
EXTERNAL_KW : 'EXTERNAL';
FALSE_KW : 'FALSE';
FROM_KW : 'FROM';
GENERALIZED_TIME_KW : 'GeneralizedTime';
GENERAL_STR_KW : 'GeneralString';
GRAPHIC_STR_KW : 'GraphicString';
IA5_STRING_KW : 'IA5String';
IDENTIFIER_KW : 'IDENTIFIER';
IMPLICIT_KW : 'IMPLICIT';
IMPLIED_KW : 'IMPLIED';
IMPORTS_KW : 'IMPORTS';
INCLUDES_KW : 'INCLUDES';
INSTANCE_KW : 'INSTANCE';
INTEGER_KW : 'INTEGER';
INTERSECTION_KW : 'INTERSECTION';
ISO646STRING_KW : 'ISO646String';
LINKED_KW : 'LINKED';
MAX_KW : 'MAX';
MINUS_INFINITY_KW : 'MINUSINFINITY';
MIN_KW : 'MIN';
NULL_KW : 'NULL';
NUMERIC_STR_KW : 'NumericString';
OBJECT_DESCRIPTOR_KW : 'ObjectDescriptor';
OBJECT_KW : 'OBJECT';
OCTET_KW : 'OCTET';
OPERATION_KW : 'OPERATION';
OF_KW : 'OF';
OID_KW : 'OID';
OPTIONAL_KW : 'OPTIONAL';
PARAMETER_KW : 'PARAMETER';
PDV_KW : 'PDV';
PLUS_INFINITY_KW : 'PLUSINFINITY';
PRESENT_KW : 'PRESENT';
PRINTABLE_STR_KW : 'PrintableString';
PRIVATE_KW : 'PRIVATE';
REAL_KW : 'REAL';
RELATIVE_KW : 'RELATIVE';
RESULT_KW : 'RESULT';
SEQUENCE_KW : 'SEQUENCE';
SET_KW : 'SET';
SIZE_KW : 'SIZE';
STRING_KW : 'STRING';
TAGS_KW : 'TAGS';
TELETEX_STR_KW : 'TeletexString';
TRUE_KW : 'TRUE';
TYPE_IDENTIFIER_KW : 'TYPE-IDENTIFIER';
UNION_KW : 'UNION';
UNIQUE_KW : 'UNIQUE';
UNIVERSAL_KW : 'UNIVERSAL';
UNIVERSAL_STR_KW : 'UniversalString';
UTC_TIME_KW : 'UTCTime';
UTF8STRING_KW : 'UTF8String';
VIDEOTEX_STR_KW : 'VideotexString';
VISIBLE_STR_KW : 'VisibleString';
WITH_KW : 'WITH';
// Operators
ASSIGN_OP : '::=' ;
BAR : '|' ;
COLON : ':' ;
COMMA : ',' ;
COMMENT : '--' ;
DOT : '.' ;
DOTDOT : '..' ;
ELLIPSIS : '...' ;
EXCLAMATION : '!' ;
INTERSECTION : '^' ;
LESS : '<' ;
L_BRACE : '{' ;
L_BRACKET : '[' ;
L_PAREN : '(' ;
MINUS : '-' ;
PLUS : '+' ;
R_BRACE : '}' ;
R_BRACKET : ']' ;
R_PAREN : ')' ;
SEMI : ';' ;
SINGLE_QUOTE : '\'' ;
CHARB : '\'B' ;
CHARH : '\'H' ;
// Whitespace -- ignored
WS
: ( ' ' | '\t' | '\f' | ( '\r\n'// DOS
| '\r'// Macintosh
| '\n'// Unix
))+
;
// Single-line comments
SL_COMMENT
: ( COMMENT ( { LA(2)!='-' }? '-' | ~('-'|'\n'|'\r'))* ( (('\r')? '\n')| COMMENT) )
;
NUMBER : ('0'..'9')+ ;
UPPER
: ('A'..'Z')
( ( 'a'..'z' | 'A'..'Z' |'-' | '0'..'9' ))* ;
LOWER
: ('a'..'z')
( ( 'a'..'z' | 'A'..'Z' |'-' | '0'..'9' ))* ;
BDIG : ('0'|'1') ;
HDIG : (('0'..'9') )
| ('A'..'F')
| ('a'..'f')
;
// Unable to resolve a string like 010101 followed by 'H
//B_STRING : SINGLE_QUOTE ({LA(3)!='B'}? BDIG)+ BDIG SINGLE_QUOTE 'B' ;
//H_STRING : SINGLE_QUOTE ({LA(3)!='H'}? HDIG)+ HDIG SINGLE_QUOTE 'H' ;
B_OR_H_STRING
: (B_STRING
| H_STRING)
;
B_STRING : SINGLE_QUOTE (BDIG)+ SINGLE_QUOTE 'B' ;
H_STRING : SINGLE_QUOTE (HDIG)+ SINGLE_QUOTE 'H' ;
C_STRING : '"' (UPPER | LOWER)* '"' ;
|
02_HelloWorldWindows.asm | mozdren/MASMPlayground | 0 | 98189 | <reponame>mozdren/MASMPlayground
.386
.model flat, stdcall
option casemap :none
include d:\masm32\include\windows.inc
include d:\masm32\include\kernel32.inc
include d:\masm32\include\user32.inc
includelib d:\masm32\lib\kernel32.lib
includelib d:\masm32\lib\user32.lib
.data
HelloWorld db "Hello, World", 0
.code
start:
invoke MessageBox, NULL, addr HelloWorld, addr HelloWorld, MB_OK
invoke ExitProcess, 0
end start
|
reflect-utils/src/main/antlr/com/slimgears/util/reflect/internal/TypeToken.g4 | ymesika/utils | 1 | 2927 | <filename>reflect-utils/src/main/antlr/com/slimgears/util/reflect/internal/TypeToken.g4<gh_stars>1-10
grammar TypeToken;
type: (referenceType) EOF;
//primitiveType: 'boolean' | 'byte' | 'short' | 'int' | 'long' | 'float' | 'double' | 'char';
referenceType: classOrInterfaceType | typeVariable | arrayType;
classOrInterfaceType: TypeIdentifier classOrInterfaceArgs?;
classOrInterfaceArgs: '<' typeArgument (',' typeArgument)* '>';
typeVariable: Identifier;
arrayType: (classOrInterfaceType | typeVariable) dim dim*;
dim: '[' ']';
typeArgument: referenceType | wildcard;
wildcard: '?' wildcardBounds?;
wildcardBounds: wildcardExtendBound | wildcardSuperBound;
wildcardSuperBound: 'super' referenceType;
wildcardExtendBound: 'extends' referenceType;
TypeIdentifier: Identifier ('.' Identifier)*;
Identifier: JavaLetter JavaLetterOrDigit*;
JavaLetter: [a-zA-Z$_];
JavaLetterOrDigit: JavaLetter|[0-9];
WhiteSpace: [ \t\r\n\u000C]+ -> skip;
|
Project-Einstein/src/E-Assembly/src/labs/lcd1.nasm | FelixLuciano/Elements-of-Computing-Systems | 0 | 12341 | ; Arquivo: sw1.nasm
; Curso: Elementos de Sistemas
; Criado por: <NAME>
; Data: 4/2020
leaw $16384, %A
movw %A, %D
leaw $0, %A
movw %D, (%A)
LOOP:
leaw $0, %A
movw (%A), %D
addw $1, %D, (%A)
movw %D, %A
movw $-1, (%A)
leaw $LOOP, %A
jmp
nop |
antlr4/FieldPath.g4 | ojai/ojai-core | 51 | 221 | grammar FieldPath;
options {
language=Java;
}
@header {
/**
* Copyright (c) 2015 MapR, Inc.
*
* 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 org.ojai.antlr4;
import static org.ojai.FieldSegment.NameSegment.unEscape;
import static org.ojai.FieldSegment.NameSegment.unQuote;
import org.ojai.FieldPath;
import org.ojai.FieldSegment;
import org.ojai.FieldSegment.IndexSegment;
import org.ojai.FieldSegment.NameSegment;
}
/**
* Parser rules
*/
parse returns [FieldPath fp]
: fieldSegment {$fp = new FieldPath($fieldSegment.seg); }
;
fieldSegment returns [NameSegment seg]
: s1 = nameSegment {$seg = $s1.seg;}
;
nameSegment returns [NameSegment seg]
: QuotedIdentifier ((Period s1=fieldSegment) | s2=indexSegment)? {
$seg = new NameSegment(unQuote($QuotedIdentifier.text),
($s1.start == null ? ($s2.start == null ? null : $s2.seg) : $s1.seg)
, true);
}
| Identifier ((Period s1=fieldSegment) | s2=indexSegment)? {
$seg = new NameSegment(unEscape($Identifier.text),
($s1.start == null ? ($s2.start == null ? null : $s2.seg) : $s1.seg)
, false);
}
| Integer ((Period s1=fieldSegment) | s2=indexSegment)? {
$seg = new NameSegment($Integer.text,
($s1.start == null ? ($s2.start == null ? null : $s2.seg) : $s1.seg)
, false);
}
;
indexSegment returns [FieldSegment seg]
: OBracket Integer? CBracket ((Period s1=fieldSegment) | s2=indexSegment)? {
$seg = new IndexSegment($Integer.text,
($s1.start == null ? ($s2.start == null ? null : $s2.seg) : $s1.seg)
);
}
;
/**
* Lexer rules
*/
Period : '.';
OBracket : '[';
CBracket : ']';
DoubleQuote: '"';
BackTick: '`';
Space
: ' ' {skip();}
;
Integer
: Digit+
;
Identifier
: IdentifierChar+
;
QuotedIdentifier
: DoubleQuote QuotedIdentifierChar* DoubleQuote
| BackTick QuotedIdentifierChar* BackTick
;
fragment Digit
: [0-9]
;
fragment HexDigit
: [0-9a-fA-F]
;
fragment IdentifierChar
: ~[`"\\\b\f\n\r\t.[\]]
| EscapeChar
;
fragment QuotedIdentifierChar
: ~[`"\\\b\f\n\r\t]
| EscapeChar
;
fragment EscapeChar
: SpecialChar
| ControlChar
| UnicodeChar
;
fragment SpecialChar
: '\\' [`"\\.[\]/] /* '/' can be appear without escaping */
;
fragment ControlChar
: '\\' [bfnrt]
;
fragment UnicodeChar
: '\\u' HexDigit HexDigit HexDigit HexDigit
;
ErrorChar
: .
;
|
src/gen.ads | jquorning/dynamo | 15 | 22508 | <reponame>jquorning/dynamo
-----------------------------------------------------------------------
-- gen -- Code Generator
-- Copyright (C) 2009, 2010, 2011, 2021 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
package Gen is
subtype UString is Ada.Strings.Unbounded.Unbounded_String;
function To_UString (Value : in String) return UString
renames Ada.Strings.Unbounded.To_Unbounded_String;
function To_String (Value : in UString) return String
renames Ada.Strings.Unbounded.To_String;
function Length (Value : in UString) return Natural
renames Ada.Strings.Unbounded.Length;
function "=" (Left, Right : in UString) return Boolean
renames Ada.Strings.Unbounded."=";
function "=" (Left : in UString; Right : in String) return Boolean
renames Ada.Strings.Unbounded."=";
end Gen;
|
libsrc/_DEVELOPMENT/font/fzx/c/sdcc_iy/fzx_glyph_width_callee.asm | meesokim/z88dk | 0 | 95906 |
; uint16_t fzx_glyph_width_callee(struct fzx_font *ff, int c)
SECTION code_font_fzx
PUBLIC _fzx_glyph_width_callee, l0_fzx_glyph_width_callee
EXTERN asm_fzx_glyph_width
_fzx_glyph_width_callee:
pop af
pop hl
pop bc
push af
l0_fzx_glyph_width_callee:
ld a,c
call asm_fzx_glyph_width
ld l,a
ld h,0
inc hl
ret
|
src/Bisimilarity/Comparison.agda | nad/up-to | 0 | 8556 | ------------------------------------------------------------------------
-- A comparison of the two definitions of bisimilarity
------------------------------------------------------------------------
{-# OPTIONS --sized-types #-}
module Bisimilarity.Comparison where
open import Equality.Propositional
open import Logical-equivalence using (_⇔_)
open import Prelude hiding (Unit)
open import Bijection equality-with-J as Bijection using (_↔_)
open import Equality.Decision-procedures equality-with-J
open import Fin equality-with-J
open import Function-universe equality-with-J hiding (_∘_; id)
open import H-level equality-with-J as H-level
open import H-level.Closure equality-with-J
open import Nat equality-with-J as Nat
open import Surjection equality-with-J using (_↠_)
import Bisimilarity
import Bisimilarity.Classical
import Bisimilarity.Classical.Equational-reasoning-instances
import Bisimilarity.Equational-reasoning-instances
open import Equational-reasoning
import Indexed-container as IC
open import Labelled-transition-system
open import Relation
module _ {ℓ} {lts : LTS ℓ} where
open LTS lts
private
module Cl = Bisimilarity.Classical lts
module Co = Bisimilarity lts
-- Classically bisimilar processes are coinductively bisimilar.
cl⇒co : ∀ {i p q} → p Cl.∼ q → Co.[ i ] p ∼ q
cl⇒co = IC.gfp⊆ν ℓ
-- Coinductively bisimilar processes are classically bisimilar.
co⇒cl : ∀ {p q} → p Co.∼ q → p Cl.∼ q
co⇒cl = IC.ν⊆gfp ℓ
-- The function cl⇒co is a left inverse of co⇒cl (up to pointwise
-- bisimilarity).
cl⇒co∘co⇒cl : ∀ {i p q}
(p∼q : p Co.∼ q) →
Co.[ i ] cl⇒co (co⇒cl p∼q) ≡ p∼q
cl⇒co∘co⇒cl p∼q = IC.gfp⊆ν∘ν⊆gfp ℓ p∼q
-- If there are two processes that are not equal, but bisimilar,
-- then co⇒cl is not a left inverse of cl⇒co.
co⇒cl∘cl⇒co : ∀ {p q} →
p ≢ q → p Co.∼ q →
∃ λ (p∼p : p Cl.∼ p) → co⇒cl (cl⇒co p∼p) ≢ p∼p
co⇒cl∘cl⇒co {p} {q} p≢q p∼q =
reflexive
, (co⇒cl (cl⇒co reflexive) ≡ reflexive ↝⟨ cong (λ R → proj₁ R (p , q)) ⟩
↑ _ (p Co.∼ q) ≡ ↑ _ (p ≡ q) ↝⟨ (λ eq → ≡⇒↝ _ eq $ lift p∼q) ⟩
↑ _ (p ≡ q) ↔⟨ Bijection.↑↔ ⟩
p ≡ q ↝⟨ p≢q ⟩□
⊥ □)
-- The two definitions of bisimilarity are logically equivalent.
classical⇔coinductive : ∀ {p q} → p Cl.∼ q ⇔ p Co.∼ q
classical⇔coinductive = IC.gfp⇔ν ℓ
-- There is a split surjection from the classical definition of
-- bisimilarity to the coinductive one (assuming two kinds of
-- extensionality).
classical↠coinductive :
Extensionality ℓ ℓ →
Co.Extensionality →
∀ {p q} → p Cl.∼ q ↠ p Co.∼ q
classical↠coinductive ext co-ext = IC.gfp↠ν ext ℓ co-ext
-- There is at least one LTS for which there is a split surjection
-- from the coinductive definition of bisimilarity to the classical
-- one.
coinductive↠classical :
∀ {p q} →
Bisimilarity._∼_ empty p q ↠
Bisimilarity.Classical._∼_ empty p q
coinductive↠classical {p = ()}
-- There is an LTS for which coinductive bisimilarity is pointwise
-- propositional (assuming two kinds of extensionality).
coinductive-bisimilarity-is-sometimes-propositional :
Extensionality lzero lzero →
let module Co = Bisimilarity one-loop in
Co.Extensionality → Is-proposition (tt Co.∼ tt)
coinductive-bisimilarity-is-sometimes-propositional ext co-ext ∼₁ ∼₂ =
extensionality ext co-ext (irr ∼₁ ∼₂)
where
open Bisimilarity one-loop
irr : ∀ {i} ∼₁ ∼₂ → [ i ] ∼₁ ≡ ∼₂
irr ∼₁ ∼₂ =
Bisimilarity-of-∼.⟨ ext
, ∼₁
, ∼₂
, (λ _ → refl , refl , irr′ (proj₂ ∼₁ _)
(proj₂ ∼₂ _))
, (λ _ → refl , refl , irr′ (proj₂ ∼₁ _)
(proj₂ ∼₂ _))
⟩
where
irr′ : ∀ {i} ∼₁ ∼₂ → [ i ] ∼₁ ≡′ ∼₂
force (irr′ ∼₁ ∼₂) = irr (force ∼₁) (force ∼₂)
-- However, classical bisimilarity (of any size) is, for the same LTS,
-- not pointwise propositional.
classical-bisimilarity-is-not-propositional :
let module Cl = Bisimilarity.Classical one-loop in
∀ {ℓ} → ¬ Is-proposition (Cl.Bisimilarity′ ℓ (tt , tt))
classical-bisimilarity-is-not-propositional {ℓ} =
Is-proposition (Bisimilarity′ ℓ (tt , tt)) ↝⟨ (λ f → f tt∼tt₁ tt∼tt₂) ⟩
tt∼tt₁ ≡ tt∼tt₂ ↝⟨ cong (λ R → proj₁ R (tt , tt)) ⟩
Unit ≡ (Unit ⊎ Unit) ↝⟨ (λ eq → Fin 1 ↝⟨ inverse Unit↔Fin1 ⟩
Unit ↝⟨ ≡⇒↝ _ eq ⟩
Unit ⊎ Unit ↝⟨ Unit↔Fin1 ⊎-cong Unit↔Fin1 ⟩
Fin 1 ⊎ Fin 1 ↝⟨ Fin⊎Fin↔Fin+ 1 1 ⟩□
Fin 2 □) ⟩
Fin 1 ↔ Fin 2 ↝⟨ _⇔_.to isomorphic-same-size ⟩
1 ≡ 2 ↝⟨ from-⊎ (1 Nat.≟ 2) ⟩□
⊥ □
where
open Bisimilarity.Classical one-loop
tt∼tt₁ : Bisimilarity′ ℓ (tt , tt)
tt∼tt₁ = reflexive-∼′ _
tt∼tt₂ : Bisimilarity′ ℓ (tt , tt)
tt∼tt₂ =
let R , R-is-a-bisimulation , ttRtt =
_⇔_.to (Bisimilarity′↔ _ _) tt∼tt₁ in
_⇔_.from (Bisimilarity′↔ _ _)
( (R ∪ R)
, ×2-preserves-bisimulations R-is-a-bisimulation
, inj₁ ttRtt
)
Unit = ↑ ℓ (tt ≡ tt)
Unit↔Fin1 =
Unit ↔⟨ Bijection.↑↔ ⟩
tt ≡ tt ↝⟨ _⇔_.to contractible⇔↔⊤ (+⇒≡ $ mono₁ 0 ⊤-contractible) ⟩
⊤ ↝⟨ inverse ⊎-right-identity ⟩□
Fin 1 □
-- Thus, assuming two kinds of extensionality, there is in general no
-- split surjection from the coinductive definition of bisimilarity to
-- the classical one (of any size).
¬coinductive↠classical :
Extensionality lzero lzero →
Bisimilarity.Extensionality one-loop →
∀ {ℓ} →
¬ (∀ {p q} → Bisimilarity._∼_ one-loop p q ↠
Bisimilarity.Classical.Bisimilarity′ one-loop ℓ (p , q))
¬coinductive↠classical ext co-ext {ℓ} =
(∀ {p q} → p Co.∼ q ↠ Cl.Bisimilarity′ ℓ (p , q)) ↝⟨ (λ co↠cl → co↠cl {q = _}) ⟩
tt Co.∼ tt ↠ Cl.Bisimilarity′ ℓ (tt , tt) ↝⟨ (λ co↠cl → H-level.respects-surjection co↠cl 1) ⟩
(Is-proposition (tt Co.∼ tt) →
Is-proposition (Cl.Bisimilarity′ ℓ (tt , tt))) ↝⟨ (_$ coinductive-bisimilarity-is-sometimes-propositional ext co-ext) ⟩
Is-proposition (Cl.Bisimilarity′ ℓ (tt , tt)) ↝⟨ classical-bisimilarity-is-not-propositional ⟩□
⊥ □
where
module Cl = Bisimilarity.Classical one-loop
module Co = Bisimilarity one-loop
-- Note also that coinductive bisimilarity is not always
-- propositional.
coinductive-bisimilarity-is-not-propositional :
let open Bisimilarity two-bisimilar-processes in
¬ (∀ {p q} → Is-proposition (p ∼ q))
coinductive-bisimilarity-is-not-propositional =
(∀ {p q} → Is-proposition (p ∼ q)) ↝⟨ (λ is-prop → is-prop {p = true} {q = true}) ⟩
Is-proposition (true ∼ true) ↝⟨ (λ irr → irr _ _) ⟩
proof true true true ≡ proof false true true ↝⟨ cong (λ p → proj₁ (left-to-right {p = true} {q = true} p {p′ = true} _)) ⟩
true ≡ false ↝⟨ Bool.true≢false ⟩□
⊥ □
where
open Bisimilarity two-bisimilar-processes
open import Indexed-container
mutual
proof : Bool → ∀ b₁ b₂ {i} → [ i ] b₁ ∼ b₂
proof b b₁ b₂ =
⟨_,_⟩ {p = b₁} {q = b₂}
(λ _ → b , _ , proof′ b _ _)
(λ _ → b , _ , proof′ b _ _)
proof′ : Bool → ∀ b₁ b₂ {i} → [ i ] b₁ ∼′ b₂
force (proof′ b b₁ b₂) = proof b b₁ b₂
-- In fact, for every type A there is a pointwise split surjection
-- from a certain instance of bisimilarity (of any size) to equality
-- on A.
bisimilarity↠equality :
∀ {a} {A : Type a} →
let open Bisimilarity (bisimilarity⇔equality A) in
∀ {i} {p q : A} → ([ i ] p ∼ q) ↠ p ≡ q
bisimilarity↠equality {A = A} {i} = record
{ logical-equivalence = record
{ to = to
; from = from
}
; right-inverse-of = to∘from
}
where
open Bisimilarity (bisimilarity⇔equality A)
to : ∀ {p q} → [ i ] p ∼ q → p ≡ q
to p∼q with left-to-right p∼q (refl , refl)
... | _ , (refl , _) , _ = refl
from : ∀ {p q} → p ≡ q → [ i ] p ∼ q
from refl = reflexive
to∘from : ∀ {p q} (p≡q : p ≡ q) → to (from p≡q) ≡ p≡q
to∘from refl = refl
|
programs/oeis/180/A180319.asm | karttu/loda | 1 | 4398 | ; A180319: Total number of possible standard knight moves on an n X 2n chessboard, if the knight is placed anywhere
; 0,8,52,128,236,376,548,752,988,1256,1556,1888,2252,2648,3076,3536,4028,4552,5108,5696,6316,6968,7652,8368,9116,9896,10708,11552,12428,13336,14276,15248,16252,17288,18356,19456,20588,21752,22948,24176,25436
mul $0,4
bin $0,2
trn $0,2
mov $1,$0
div $1,2
mul $1,4
|
src/fltk-widgets-groups-tiled.ads | micahwelf/FLTK-Ada | 1 | 25974 | <reponame>micahwelf/FLTK-Ada
package FLTK.Widgets.Groups.Tiled is
type Tiled_Group is new Group with private;
type Tiled_Group_Reference (Data : not null access Tiled_Group'Class) is
limited null record with Implicit_Dereference => Data;
package Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String)
return Tiled_Group;
end Forge;
procedure Position
(This : in out Tiled_Group;
Old_X, Old_Y : in Integer;
New_X, New_Y : in Integer);
procedure Draw
(This : in out Tiled_Group);
function Handle
(This : in out Tiled_Group;
Event : in Event_Kind)
return Event_Outcome;
private
type Tiled_Group is new Group with null record;
overriding procedure Finalize
(This : in out Tiled_Group);
pragma Inline (Position);
pragma Inline (Draw);
pragma Inline (Handle);
end FLTK.Widgets.Groups.Tiled;
|
oeis/182/A182139.asm | neoneye/loda-programs | 11 | 20891 | ; A182139: Inverse Moebius transform of A061142.
; Submitted by <NAME>
; 1,3,3,7,3,9,3,15,7,9,3,21,3,9,9,31,3,21,3,21,9,9,3,45,7,9,15,21,3,27,3,63,9,9,9,49,3,9,9,45,3,27,3,21,21,9,3,93,7,21,9,21,3,45,9,45,9,9,3,63,3,9,21,127,9,27,3,21,9,27,3,105,3,9,21,21,9,27,3,93,31,9,3,63,9,9,9,45,3,63,9,21,9,9,9,189,3,21,21,49
add $0,1
mov $1,1
lpb $0
mov $3,$0
lpb $3
mov $4,$0
mov $6,$2
cmp $6,0
add $2,$6
mod $4,$2
cmp $4,0
cmp $4,0
mov $5,$2
add $2,1
cmp $5,1
max $4,$5
sub $3,$4
lpe
mov $5,1
lpb $0
dif $0,$2
mul $5,2
add $5,1
lpe
mul $1,$5
lpe
mov $0,$1
|
sway-core/tests/ir_to_asm/enum_in_storage_read.asm | FuelLabs/sway | 75 | 91716 | .program:
ji i4
noop
DATA_SECTION_OFFSET[0..32]
DATA_SECTION_OFFSET[32..64]
lw $ds $is 1
add $$ds $$ds $is
lw $r1 $fp i73 ; load input function selector
lw $r0 data_7 ; load fn selector for comparison
eq $r0 $r1 $r0 ; function selector comparison
jnzi $r0 i11 ; jump to selected function
rvrt $zero ; revert if no selectors matched
move $r5 $sp ; save locals base register
cfei i256 ; allocate 256 bytes for all locals
addi $r0 $r5 i0 ; get offset reg for get_ptr
lw $r1 data_0 ; literal instantiation
addi $r0 $r5 i0 ; get store offset
mcpi $r0 $r1 i32 ; store value
addi $r0 $r5 i0 ; get offset
srw $r0 $r0 ; single word state access
move $r2 $sp ; save register for temporary stack value
cfei i48 ; allocate 48 bytes for temporary struct
sw $r2 $r0 i0 ; insert_value @ 0
addi $r0 $r5 i32 ; get offset reg for get_ptr
lw $r1 data_1 ; literal instantiation
addi $r0 $r5 i32 ; get store offset
mcpi $r0 $r1 i32 ; store value
addi $r3 $r5 i128 ; get offset reg for get_ptr
addi $r0 $r5 i128 ; get offset reg for get_ptr
addi $r1 $r5 i128 ; get offset
addi $r0 $r5 i32 ; get offset
srwq $r1 $r0 ; quad word state access
addi $r0 $r5 i32 ; get offset reg for get_ptr
lw $r1 data_2 ; literal instantiation
addi $r0 $r5 i32 ; get store offset
mcpi $r0 $r1 i32 ; store value
addi $r0 $r5 i160 ; get offset reg for get_ptr
addi $r1 $r5 i160 ; get offset
addi $r0 $r5 i32 ; get offset
srwq $r1 $r0 ; quad word state access
addi $r0 $r2 i8 ; get struct field(s) 1 offset
mcpi $r0 $r3 i40 ; store struct field value
addi $r0 $r5 i64 ; get offset reg for get_ptr
lw $r1 data_3 ; literal instantiation
addi $r0 $r5 i64 ; get store offset
mcpi $r0 $r1 i32 ; store value
addi $r0 $r5 i64 ; get offset
srw $r0 $r0 ; single word state access
move $r4 $sp ; save register for temporary stack value
cfei i48 ; allocate 48 bytes for temporary struct
sw $r4 $r0 i0 ; insert_value @ 0
addi $r0 $r5 i96 ; get offset reg for get_ptr
lw $r1 data_4 ; literal instantiation
addi $r0 $r5 i96 ; get store offset
mcpi $r0 $r1 i32 ; store value
addi $r3 $r5 i192 ; get offset reg for get_ptr
addi $r0 $r5 i192 ; get offset reg for get_ptr
addi $r1 $r5 i192 ; get offset
addi $r0 $r5 i96 ; get offset
srwq $r1 $r0 ; quad word state access
addi $r0 $r5 i96 ; get offset reg for get_ptr
lw $r1 data_5 ; literal instantiation
addi $r0 $r5 i96 ; get store offset
mcpi $r0 $r1 i32 ; store value
addi $r0 $r5 i224 ; get offset reg for get_ptr
addi $r1 $r5 i224 ; get offset
addi $r0 $r5 i96 ; get offset
srwq $r1 $r0 ; quad word state access
addi $r0 $r4 i8 ; get struct field(s) 1 offset
mcpi $r0 $r3 i40 ; store struct field value
move $r1 $sp ; save register for temporary stack value
cfei i96 ; allocate 96 bytes for temporary struct
addi $r0 $r1 i0 ; get struct field(s) 0 offset
mcpi $r0 $r2 i48 ; store struct field value
addi $r0 $r1 i48 ; get struct field(s) 1 offset
mcpi $r0 $r4 i48 ; store struct field value
lw $r0 data_6 ; loading size for RETD
retd $r1 $r0
.data:
data_0 .b256 0xd625ff6d8e88efd7bb3476e748e5d5935618d78bfc7eedf584fe909ce0809fc3
data_1 .b256 0xc4f29cca5a7266ecbc35c82c55dd2b0059a3db4c83a3410653ec33aded8e9840
data_2 .b256 0xc4f29cca5a7266ecbc35c82c55dd2b0059a3db4c83a3410653ec33aded8e9841
data_3 .b256 0x2817e0819d6fcad797114fbcf350fa281aca33a39b0abf977797bddd69b8e7af
data_4 .b256 0x12ea9b9b05214a0d64996d259c59202b80a21415bb68b83121353e2a5925ec47
data_5 .b256 0x12ea9b9b05214a0d64996d259c59202b80a21415bb68b83121353e2a5925ec48
data_6 .u64 0x60
data_7 .u32 0x1665bf4
|
scripts/route-screen.applescript | woailuoli993/dotfile | 0 | 4230 | --
-- Created by: v1c77
-- Created on: 2018/7/21
--
-- Copyright © 2018 v1c77, All Rights Reserved
--
use AppleScript version "2.7" -- Yosemite (10.10) or later
use scripting additions
tell application "System Preferences"
quit
delay 0.5
launch
activate
set current pane to pane "com.apple.preference.displays"
--reveal pane id "com.apple.preference.displays"
end tell
tell application "System Events"
tell application process "System Preferences"
tell window "DELL U2415" -- change the window name for different display
delay 1
click radio button "Display" of tab group 1
set theGroup to tab group 1
tell pop up button "Rotation:" of theGroup
set theStat to value of it
click
tell menu 1
if theStat = "Standard" then
click menu item 4 -- 270 dig
else
click menu item 1 -- standard
end if
end tell
end tell
end tell
end tell
end tell
tell application "System Preferences"
quit
end tell
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_21829_1244.asm | ljhsiun2/medusa | 9 | 167180 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x1612, %r8
nop
nop
and $3774, %rdx
movw $0x6162, (%r8)
nop
nop
and %r8, %r8
lea addresses_WC_ht+0x16553, %r12
nop
nop
cmp %rbp, %rbp
mov (%r12), %r10
nop
and $51063, %r14
lea addresses_normal_ht+0x15106, %rdx
nop
nop
nop
add $33952, %r9
mov (%rdx), %r8d
add $41028, %rdx
lea addresses_A_ht+0x15bf6, %rsi
lea addresses_D_ht+0x4086, %rdi
nop
nop
nop
nop
add %rbp, %rbp
mov $74, %rcx
rep movsw
nop
nop
nop
nop
and $34971, %rcx
lea addresses_WC_ht+0xab6, %r12
sub $26071, %rsi
mov (%r12), %r10w
nop
nop
add $46851, %rdi
lea addresses_normal_ht+0x17be2, %rcx
inc %rdi
movb (%rcx), %r10b
nop
nop
nop
mfence
lea addresses_UC_ht+0x17966, %rsi
lea addresses_normal_ht+0x10086, %rdi
nop
add $23098, %r9
mov $65, %rcx
rep movsb
nop
nop
nop
sub %rsi, %rsi
lea addresses_A_ht+0xee86, %r12
sub %rbp, %rbp
mov $0x6162636465666768, %rdx
movq %rdx, %xmm4
movups %xmm4, (%r12)
nop
nop
dec %rcx
lea addresses_WT_ht+0x1b816, %rsi
nop
nop
nop
nop
and $37949, %rdi
vmovups (%rsi), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %rcx
nop
sub $31239, %r12
lea addresses_normal_ht+0x9526, %r10
nop
nop
nop
sub $24841, %rsi
mov $0x6162636465666768, %rcx
movq %rcx, %xmm7
and $0xffffffffffffffc0, %r10
vmovntdq %ymm7, (%r10)
nop
nop
nop
add %rdx, %rdx
lea addresses_D_ht+0x2168, %r10
nop
nop
nop
nop
cmp %r12, %r12
mov (%r10), %ebp
nop
nop
nop
inc %r14
lea addresses_normal_ht+0x11514, %rcx
nop
nop
nop
nop
nop
dec %r14
mov (%rcx), %rdi
nop
and $22194, %r9
lea addresses_normal_ht+0x6686, %r12
nop
nop
nop
cmp $44591, %r9
mov (%r12), %r14
nop
nop
nop
nop
xor %r14, %r14
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_WT+0x10766, %rsi
lea addresses_WT+0xae86, %rdi
nop
nop
nop
nop
nop
xor %r10, %r10
mov $13, %rcx
rep movsw
nop
nop
nop
nop
cmp $65450, %rcx
// Faulty Load
lea addresses_WT+0x17086, %rdi
nop
nop
nop
dec %rbx
mov (%rdi), %esi
lea oracles, %rcx
and $0xff, %rsi
shlq $12, %rsi
mov (%rcx,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT', 'congruent': 7, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 3, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
server/src/main/antlr/TypeSignatures.g4 | freamdx/crate | 1 | 7608 | <filename>server/src/main/antlr/TypeSignatures.g4
/*
* Licensed to Crate.io GmbH ("Crate") under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership. Crate licenses
* this file to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* However, if you have executed another commercial license agreement
* with Crate these terms will supersede the license and you may use the
* software solely pursuant to the terms of the relevant commercial agreement.
*/
grammar TypeSignatures;
type
: 'double precision' #doublePrecision
| 'timestamp without time zone' #timeStampWithoutTimeZone
| 'timestamp with time zone' #timeStampWithTimeZone
| 'time with time zone' #timeWithTimeZone
| 'array' '(' type ')' #array
| 'record' parameters? #row
| 'object' parameters? #object
| identifier parameters? #generic
;
parameters
: ('(' parameter (',' parameter)* ')')
;
parameter
: type
| identifier type
| INTEGER_VALUE
;
identifier
: UNQUOTED_INDENTIFIER
| QUOTED_INDENTIFIER
;
UNQUOTED_INDENTIFIER
: (LETTER | '_') (LETTER | DIGIT | '_')*
;
QUOTED_INDENTIFIER
: '"' (ESCAPED | SAFE )* '"'
;
INTEGER_VALUE
: DIGIT+
;
fragment ESCAPED
: '\\' (["\\/bfnrt])
;
fragment SAFE
: ~ ["\\\u0000-\u001F]
;
fragment DIGIT
: [0-9]
;
fragment LETTER
: [A-Za-z]
;
WS
: [ \r\n\t]+ -> channel(HIDDEN)
; |
libsrc/_DEVELOPMENT/alloc/obstack/c/sdcc_iy/obstack_align_to_callee.asm | meesokim/z88dk | 0 | 1186 | <filename>libsrc/_DEVELOPMENT/alloc/obstack/c/sdcc_iy/obstack_align_to_callee.asm<gh_stars>0
; int obstack_align_to_callee(struct obstack *ob, size_t alignment)
SECTION code_alloc_obstack
PUBLIC _obstack_align_to_callee
_obstack_align_to_callee:
pop af
pop hl
pop bc
push af
INCLUDE "alloc/obstack/z80/asm_obstack_align_to.asm"
|
Task/Sort-using-a-custom-comparator/AppleScript/sort-using-a-custom-comparator.applescript | LaudateCorpus1/RosettaCodeData | 1 | 1147 | <reponame>LaudateCorpus1/RosettaCodeData
use framework "Foundation"
-- SORTING LISTS OF ATOMIC (NON-RECORD) DATA WITH A CUSTOM SORT FUNCTION
-- In sortBy, f is a function from () to a tuple of two parts:
-- 1. a function from any value to a record derived from (and containing) that value
-- The base value should be present in the record under the key 'value'
-- additional derivative keys (and optionally the 'value' key) should be included in 2:
-- 2. a list of (record key, boolean) tuples, in the order of sort comparison,
-- where the value *true* selects ascending order for the paired key
-- and the value *false* selects descending order for that key
-- sortBy :: (() -> ((a -> Record), [(String, Bool)])) -> [a] -> [a]
on sortBy(f, xs)
set {fn, keyBools} to mReturn(f)'s |λ|()
script unWrap
on |λ|(x)
value of x
end |λ|
end script
map(unWrap, sortByComparing(keyBools, map(fn, xs)))
end sortBy
-- SORTING APPLESCRIPT RECORDS BY PRIMARY AND N-ARY SORT KEYS
-- sortByComparing :: [(String, Bool)] -> [Records] -> [Records]
on sortByComparing(keyDirections, xs)
set ca to current application
script recDict
on |λ|(x)
ca's NSDictionary's dictionaryWithDictionary:x
end |λ|
end script
set dcts to map(recDict, xs)
script asDescriptor
on |λ|(kd)
set {k, d} to kd
ca's NSSortDescriptor's sortDescriptorWithKey:k ascending:d selector:dcts
end |λ|
end script
((ca's NSArray's arrayWithArray:dcts)'s ¬
sortedArrayUsingDescriptors:map(asDescriptor, keyDirections)) as list
end sortByComparing
-- GENERIC FUNCTIONS ---------------------------------------------------------
-- map :: (a -> b) -> [a] -> [b]
on map(f, xs)
tell mReturn(f)
set lng to length of xs
set lst to {}
repeat with i from 1 to lng
set end of lst to |λ|(item i of xs, i, xs)
end repeat
return lst
end tell
end map
-- Lift 2nd class handler function into 1st class script wrapper
-- mReturn :: Handler -> Script
on mReturn(f)
if class of f is script then
f
else
script
property |λ| : f
end script
end if
end mReturn
-- TEST ----------------------------------------------------------------------
on run
set xs to ["Shanghai", "Karachi", "Beijing", "Sao Paulo", "Dhaka", "Delhi", "Lagos"]
-- Custom comparator:
-- Returns a lifting function and a sequence of {key, bool} pairs
-- Strings in order of descending length,
-- and ascending lexicographic order
script lengthDownAZup
on |λ|()
script
on |λ|(x)
{value:x, n:length of x}
end |λ|
end script
{result, {{"n", false}, {"value", true}}}
end |λ|
end script
sortBy(lengthDownAZup, xs)
end run
|
tests/data/src/test.asm | protoCall7/PZ80emu | 1 | 163400 | ;
; test.asm
;
org 0x0040
; Variables
x: equ 5
y: equ 7
; code
ld a,x ; copy 5 into the A register
ld b,y ; copy 7 into the B register
add a,b ; add the A and B registers (result stored to A)
ld (0x0010),a ; save the result to RAM at 0x0010
jp 0x0000 ; loop forever
|
tests/tkmrpc-mock.ads | DrenfongWong/tkm-rpc | 0 | 10053 | --
-- Copyright (C) 2013 <NAME> <<EMAIL>>
-- Copyright (C) 2013 <NAME> <<EMAIL>>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions
-- are met:
-- 1. Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- 3. Neither the name of the University 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 REGENTS 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 REGENTS 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 Tkmrpc.Types;
package Tkmrpc.Mock
is
Ref_Nonce : constant Types.Nonce_Type
:= (Size => 156,
Data => (others => Character'Pos ('f')));
-- Reference nonce returned by Nc_Create function.
Last_Nonce_Id : Types.Nc_Id_Type := Types.Nc_Id_Type'Last;
Last_Nonce_Length : Types.Nonce_Length_Type := 16;
-- Calls to Nc_Create will set these vars to the last requested nonce Id
-- and length.
Ref_Dh_Pubvalue : constant Types.Dh_Pubvalue_Type
:= (Size => 8,
Data => (others => 16#3b#));
-- Reference Diffie-Hellman public value checked in Dh_Generate_Key
-- procedure.
end Tkmrpc.Mock;
|
test/Succeed/Issue211.agda | cruhland/agda | 1,989 | 14836 | {-# OPTIONS --universe-polymorphism #-}
-- These examples should now go through with no unsolved metavariables.
-- They work since the conversion checker is a little less prone to
-- abort checking when there are constraints. In particular if the
-- constraints only affect the sorts of the things compared, then it keeps
-- going.
module Issue211 where
open import Common.Level
infixr 4 _,_
infixr 3 _×_
data _×_ {a b} (A : Set a) (B : Set b) : Set (a ⊔ b) where
_,_ : A → B → A × B
data D₀ : Set₀ where
data D₁ : Set₁ where
-- Works:
ex₁ : (D₁ → D₁) × (D₁ → D₁)
ex₁ = ((λ d → d) , (λ d → d))
-- Works:
ex₂ : (D₀ → D₀) × (D₀ → D₀) × (D₀ → D₀)
ex₂ = ((λ d → d) , (λ d → d) , (λ d → d))
-- Works:
ex₃ : (D₁ → D₁) × (D₁ → D₁) × (D₁ → D₁)
ex₃ = ((λ d → d) , (λ (d : D₁) → d) , (λ (d : D₁) → d))
-- Does not work:
ex₄ : Level × (D₁ → D₁) × (D₁ → D₁)
ex₄ = lzero , (λ d → d) , (λ d → d)
ex₅ : (D₁ → D₁) × (D₁ → D₁) × (D₁ → D₁)
ex₅ = (λ (d : _) → d) , (λ (d : _) → d) , (λ (d : _) → d)
-- Does not work:
ex₆ : (D₁ → D₁) × (D₁ → D₁) × (D₁ → D₁)
ex₆ = (λ d → d) , (λ d → d) , (λ d → d)
-- As far as I can tell there is an easily found unique solution for
-- the unsolved meta-variables above. Why does not the unification
-- machinery find it? Are the meta-variables solved in the wrong
-- order?
|
battleformulas.als | blockchainhelppro/Bitcoin-Escrow-Application | 0 | 753 | <filename>battleformulas.als
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; battleformulas.als
;;;; Last updated: 03/27/18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Although it may seem ridiculous to have
; so many damage formulas please do not
; remove them from the bot.
; By default melee uses $formula.meleedmg.player.formula
; By default techs use: $formula.techdmg.player.formula
; Dungeons use the defaults
; Torment uses 2.5
; Cosmic uses 2.5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Determines the damage
; display color
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
damage.color.check {
if (%starting.damage > %attack.damage) { set %damage.display.color 6 }
if (%starting.damage < %attack.damage) { set %damage.display.color 7 }
if (%starting.damage = %attack.damage) { set %damage.display.color 4 }
unset %starting.damage
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Goes through the modifiers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
damage.modifiers.check {
; $1 = the user
; $2 = the weapon or tech name
; $3 = the target
; $4 = melee or tech
if (($readini($char($3), Modifiers, EtherealDamageOnly) = true) && ($readini($char($1), status, ethereal) != yes)) {
set %attack.damage 0 | $set_chr_name($1) | set %guard.message $readini(translation.dat, status, NonEtherealBlocked) | return }
;;;;;;;;;;;;;; All attacks check the weapon itself
; Check to see if the target is resistant/weak to the weapon itself
if ($person_in_mech($1) = false) {
$modifer_adjust($3, $readini($char($1), weapons, equipped), $4)
; Check for Left-Hand weapon, if applicable
if ($readini($char($1), weapons, EquippedLeft) != $null) {
var %weapon.type2 $readini($dbfile(weapons.db), $readini($char($1), weapons, EquippedLeft), type)
if (%weapon.type2 != shield) { $modifer_adjust($3, $readini($char($1), weapons, equippedLeft), $4) }
}
}
if ($person_in_mech($1) = true) { $modifer_adjust($3, $readini($char($1), mech, EquippedWeapon)) }
;;;;;;;;;;;;;; Melee checks: weapon element and weapon type
if ($4 = melee) {
var %weapon.element $readini($dbfile(weapons.db), $2, element)
if ((%weapon.element != $null) && (%weapon.element != none)) { $modifer_adjust($3, %weapon.element) }
; Check for Left-Hand weapon element, if applicable
if ((%weapon.type2 != $null) && (%weapon.type2 != shield)) {
var %weapon.element2 $readini($dbfile(weapons.db), $readini($char($1), weapons, EquippedLeft), Element )
$modifer_adjust($3, %weapon.element2)
}
; Check for weapon type weaknesses.
var %weapon.type $readini($dbfile(weapons.db), $2, type)
$modifer_adjust($3, %weapon.type)
; Elementals are strong to melee
if ($readini($char($3), monster, type) = elemental) { %attack.damage = $round($calc(%attack.damage - (%attack.damage * .30)),0) }
}
;;;;;;;;;;;;;; Techs check: tech name, tech element
if ($4 = tech) {
; Check for the tech name
; if $2 = element, use +techname, else use techname
var %elements fire.earth.wind.water.ice.lightning.light.dark
if ($istok(%elements, $2, 46) = $true) { $modifer_adjust($3, $chr(43) $+ $2, tech) }
else { $modifer_adjust($3, $2, tech) }
; Check for the tech element
var %tech.element $readini($dbfile(techniques.db), $2, element)
if ((%tech.element != $null) && (%tech.element != none)) {
if ($numtok(%tech.element,46) = 1) { $modifer_adjust($3, %tech.element) }
if ($numtok(%tech.element,46) > 1) {
var %element.number 1
while (%element.number <= $numtok(%tech.element,46)) {
var %current.tech.element $gettok(%tech.element, %element.number, 46)
$modifer_adjust($3, %current.tech.element)
inc %element.number
}
}
}
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Calculates damage item amount
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
calculate_damage_items {
; $1 = user
; $2 = item used
; $3 = target
; $4 = item or fullbring
; Clear variables before beginning
unset %attack.damage | unset %attack.damage1 | unset %attack.damage2 | unset %attack.damage3 | unset %attack.damage4 | unset %attack.damage5 | unset %attack.damage6 | unset %attack.damage7 | unset %attack.damage8 | unset %attack.damage.total
unset %drainsamba.on | unset %absorb | unset %element.desc | unset %spell.element | unset %real.name | unset %user.flag | unset %target.flag | unset %trickster.dodged
unset %techincrease.check | unset %double.attack | unset %triple.attack | unset %fourhit.attack | unset %fivehit.attack | unset %sixhit.attack | unset %sevenhit.attack | unset %eighthit.attack
unset %multihit.message.on
set %attack.damage 0
; First things first, let's find out the base power.
if ($4 = fullbring) {
set %item.base $readini($dbfile(items.db), $2, FullbringAmount)
; Increase the amount by a factor of how strong fullbring is
set %item.base $calc(%item.base * $readini($char($1), skills, Fullbring))
; Increase by a percent of the log of the arena level
var %percent.increase $log($return_winningstreak)
inc %item.base $round($return_percentofvalue(%item.base, %percent.increase),0)
}
if (($4 = item) || ($4 = $null)) { set %item.base $readini($dbfile(items.db), $2, Amount) }
inc %attack.damage %item.base
if (($readini($dbfile(items.db), $2, bomb) = true) && ($readini($char($1), skills, demolitions) != $null)) {
var %demolition.power $calc($readini($char($1), skills, demolitions) * .04)
inc %attack.damage $round($calc(%item.base * %demolition.power),0)
}
; Now we want to increase the base damage by a small fraction of the user's int.
var %base.stat $readini($char($1), battle, int)
if (%base.stat >= 999) { var %base.stat $round($calc(999 + (%base.stat / 500)),0) }
else { var %base.stat $round($calc($readini($char($1), battle, int) / 20),0) }
inc %attack.damage %base.stat
; Let's increase the attack by a random amount.
inc %attack.damage $rand(1,10)
; Check for an EnhanceItems augment that will increase the damage by 30% per augment equipped.
if ($augment.check($1, EnhanceItems) = true) { inc %attack.damage $round($calc(%attack.damage * (%augment.strength *.30)),0) }
; Now we're ready to calculate the enemy's defense..
set %enemy.defense $readini($char($3), battle, def)
$defense_down_check($3)
$defense_up_check($3)
if (%enemy.defense <= 0) { set %enemy.defense 1 }
if ($readini($char($3), info, ai_type) = counteronly) { set %attack.damage 0 | return }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; CALCULATE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var %minimum.damage %item.base
var %ratio $calc(%attack.damage / %enemy.defense)
if (%ratio >= 1.3) { set %ratio 1.3 | set %minimum.damage $round($calc(%item.base * 1.5),0) }
var %maximum.damage $round($calc(%attack.damage * %ratio),0)
if (%maximum.damage >= $calc(%minimum.damage * 18)) { set %maximum.damage $round($calc(%minimum.damage * 18),0) }
if (%maximum.damage <= %minimum.damage) { set %maximum.damage %minimum.damage }
set %attack.damage $rand(%minimum.damage, %maximum.damage)
inc %attack.damage $rand(1,10)
unset %enemy.defense
if (enhance-item isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
set %starting.damage %attack.damage
; Check to see if the target is weak to the item's element (if it has one)
var %current.element $readini($dbfile(items.db), $2, element)
if ((%current.element != $null) && (%current.element != none)) {
$modifer_adjust($3, %current.element)
}
; check to see if the target is weak to the specific item
$modifer_adjust($3, $2)
$damage.color.check
; Check for the guardian style
$guardian_style_check($3)
if ($readini($dbfile(items.db), $2, ignoremetaldefense) != true) {
$metal_defense_check($3, $1)
}
; In this bot we don't want the attack to ever be lower than 1
if (%attack.damage <= 0) { set %attack.damage 1 }
if (%current.element != $null) {
var %target.element.null $readini($char($3), element, null)
if ($istok(%target.element.null,%current.element,46) = $true) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
}
}
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
$trickster_dodge_check($3, $1)
$utsusemi.check($1, $2, $3)
$guardianmon.check($1, $2, $3)
$wonderguard.check($3, $2, item)
if ($readini($char($3), modifiers, $2) != $null) {
if ($readini($char($3), modifiers, $2) <= 0) {
$set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToItem)
set %attack.damage 0
}
unset %target.weapon.null
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Calculates healing item amount
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
calculate_heal_items {
; $1 = user
; $2 = item
; $3 = target
set %attack.damage 0
; First things first, let's find out the base power of the item
var %item.base $readini($dbfile(items.db), $2, Amount)
; Convert that into a percent
var %item.base $calc(%item.base / 100)
; Determine how much this item will heal.
var %max.hp $readini($char($3), basestats, hp)
var %item.base $round($calc(%item.base * %max.hp),0)
; Set the amount the item heals
inc %attack.damage %item.base
;;;;;;;;;;;;;
;;; Increase the amount that the item
;;;; will heal by static values
;;;;;;;;;;;;
; If we have a skill that enhances healing items, check it here
var %field.medic.skill $readini($char($1), skills, FieldMedic)
if (%field.medic.skill != $null) {
var %skill.increase.amount $calc(5 * %field.medic.skill)
inc %attack.damage %skill.increase.amount
}
; Let's increase the attack by a random amount.
inc %attack.damage $rand(1,5)
if ($augment.check($1, EnhanceItems) = true) {
inc %attack.damage $round($calc(%attack.damage * .3),0)
}
; check to see if the target is weak to the specific item
$modifer_adjust($3, $2)
; If the blood moon is in effect, healing items won't work as well.
if (%bloodmoon = on) { %attack.damage = $round($calc(%attack.damage / 2),0) }
; This should never go below 0, but just in case..
if (%attack.damage <= 0) { set %attack.damage 1 }
if ($readini($char($3), battle, hp) >= $readini($char($3), basestats, hp)) { set %attack.damage 0 }
; If the amount being healed is more than the target's max HP, set the max to the HP max
if (%attack.damage > $readini($char($3), basestats, hp)) { set %attack.damage $readini($char($3), basestats, hp) }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Boost a Demon Wall's
; attack based on the current
; turn.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
demon.wall.boost {
set %demonwall.turnpercent $calc(%current.turn / %max.demonwall.turns)
inc %demonwall.turnpercent 1
set %attack.damage $round($calc(%demonwall.turnpercent * %attack.damage),0)
unset %demonwall.turnpercent
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Checks to see if the last melee
; hit was done with the same
; weapon(s) and nerfs it if so
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
melee.lastaction.nerfcheck {
; $1 = person we're checking
; $2 = weapon used
if ($readini($char($1), info, Flag) != $null) { return }
if ($istok($readini($txtfile(battle2.txt), style, $1 $+ .lastaction),$2,46) = $true) { set %attack.damage $round($calc(%attack.damage / 3),0) }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Calculates damage rating
; for melee
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
calculate.damage.rating.melee {
; $1 = person
var %damage.rating 0
var %base.stat $readini($char($1), battle, str)
inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
inc %damage.rating %base.stat
var %player.weapon.power $readini($char($1), weapons, $2)
inc %damage.rating %player.weapon.power
; Get the weapon's power
var %weapon.power $readini($dbfile(weapons.db), $2, basepower)
if (%weapon.power = $null) { var %weapon.power 1 }
inc %damage.rating %weapon.power
set %current.accessory $readini($char($3), equipment, accessory)
set %current.accessory.type $readini($dbfile(items.db), %current.accessory, accessorytype)
; Does the user have any mastery of the weapon?
$mastery_check($1, $2)
; If it's a portal battle this might need to be adjusted to make portal battles easier to balance
if (%portal.bonus = true) {
if (%weapon.power > $return_winningstreak) { var %weapon.base $return_winningstreak }
if (%mastery.bonus > $calc($return_winningstreak + 10)) { var %mastery.bonus $calc($return_winningstreak + 10) }
}
; Let's add the mastery bonus to the weapon base
inc %damage.rating %mastery.bonus
; Check for Killer Traits
inc %damage.rating $round($calc(%damage.rating * ($killer.trait.check($1, $3) / 100)),0)
; Check for MightyStrike
if ($person_in_mech($1) = false) {
; Check for the skill "MightyStrike"
if ($mighty_strike_check($1) = true) {
%damage.rating = $calc(%damage.rating * 1.5)
}
; Check for the "DesperateBlows" skill.
if ($desperate_blows_check($1) = true) {
var %hp.percent $calc(($readini($char($1), Battle, HP) / $readini($char($1), BaseStats, HP)) *100)
if ((%hp.percent >= 10) && (%hp.percent <= 25)) { %damage.rating = $round($calc(%damage.rating * 1.2),0) }
if ((%hp.percent > 2) && (%hp.percent < 10)) { %damage.rating = $round($calc(%damage.rating * 1.5),0) }
if ((%hp.percent > 0) && (%hp.percent <= 2)) { %damage.rating = $round($calc(%damage.rating * 2),0) }
}
}
if ($person_in_mech($1) = false) {
; Check for the miser ring accessory
if ($accessory.check($1, IncreaseMeleeDamage) = true) {
var %redorb.amount $readini($char($1), stuff, redorbs)
var %miser-ring.increase $round($calc(%redorb.amount * %accessory.amount),0)
if (%miser-ring.increase <= 0) { var %miser-ring.increase 1 }
if (%miser-ring.increase > 1000) { var %miser-ring.increase 1000 }
inc %damage.rating %miser-ring.increase
unset %accessory.amount
}
; Check for the fool's tablet accessory
if ($accessory.check($1, IncreaseMeleeAddPoison) = true) {
inc %damage.rating $round($calc(%damage.rating * %accessory.amount),0)
unset %accessory.amount
}
}
if ($augment.check($1, MeleeBonus) = true) {
var %melee.bonus.augment $calc(%augment.strength * 100)
inc %damage.rating %melee.bonus.augment
unset %melee.bonus.augment
}
unset %current.accessory.type
return %damage.rating
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Calculates damage rating
; for techs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
calculate.damage.rating.tech {
; $1 = person
; $2 = the tech name
var %damage.rating 0
; First things first, let's find out the stat needed
var %base.stat.needed $readini($dbfile(techniques.db), $2, stat)
if (%base.stat.needed = $null) { set %base.stat.needed int }
var %base.stat $readini($char($1), battle, %base.stat.needed)
inc %base.stat $armor.stat($1, %base.stat.needed)
if (%base.stat.needed = str) {
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
}
if (%base.stat.needed = int) {
if ($skill.bloodspirit.status($1) = on) { inc %base.stat $skill.bloodspirit.calculate($1) }
$int_down_check($1)
}
if (%base.stat.needed = spd) {
if ($skill.speed.status($1) = on) { inc %base.stat $skill.speed.calculate($1) }
}
inc %damage.rating %base.stat
var %tech.base $readini($dbfile(techniques.db), p, $2, BasePower)
var %user.tech.level $readini($char($1), Techniques, $2)
if (%user.tech.level = $null) { var %user.tech.level 1 }
var %ignition.name $readini($char($1), status, ignition.name)
var %ignition.techs $readini($dbfile(ignitions.db), %ignition.name, techs)
if ($istok(%ignition.techs,$2,46) = $true) { var %user.tech.level 50 }
unset %ignition.name | unset %ignition.techs
; Let's add in the base power of the weapon used..
if ($person_in_mech($1) = false) { var %weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { var %weapon.used $readini($char($1), mech, equippedWeapon) }
var %base.power.wpn $readini($dbfile(weapons.db), %weapon.used, basepower)
if (%base.power.wpn = $null) { var %base.power.wpn 1 }
var %weapon.base $readini($char($1), weapons, %weapon.used)
if (%weapon.base = $null) { var %weapon.base 1 }
inc %base.power.wpn %weapon.base
; Does the user have a mastery in the weapon? We can add a bonus as well.
$mastery_check($1, %weapon.used)
inc %base.power.wpn %mastery.bonus
inc %damage.rating $calc(%tech.base + %user.tech.level + %base.power.wpn)
; Check for Killer Traits
inc %damage.rating $round($calc(%damage.rating * ($killer.trait.check($1, $3) / 100)),0)
; For magic techs we need to do a little more
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
; Check for certain skills that will enhance magic.
var %clear.mind.check $readini($char($1), skills, ClearMind)
if (%clear.mind.check > 0) {
var %enhance.value $calc($readini($char($1), skills, ClearMind) * 100)
inc %damage.rating %enhance.value
}
if ($readini($char($1), skills, elementalseal.on) = on) {
inc %damage.rating 500
writeini $char($1) skills elementalseal.on off
}
if ($augment.check($1, MagicBonus) = true) {
var %magic.bonus.augment $calc(%augment.strength * 100)
inc %damage.rating %magic.bonus.augment
}
; Spell master will increase the damage rating by 100 per level
if ($return.playerstyle($1) = spellmaster) { inc %damage.rating $calc(100 * $readini($char($1), styles, spellmaster)) }
}
return %damage.rating
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Checks all the various
; guard message aliases
; that can negate damage
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
formula.damage.guard.check.melee {
$flying.damage.check($1, $2, $3)
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
$weapon_parry_check($3, $1, $2)
$trickster_dodge_check($3, $1, $4)
$royalguard.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
}
formula.damage.guard.check.tech {
if ((%tech.type = heal-aoe) || (%tech.type = heal)) { return }
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
if ($readini($dbfile(techniques.db), $2, magic) != yes) { $flying.damage.check($1, $4, $3) }
if ($readini($dbfile(techniques.db), $2, canDodge) != false) { $trickster_dodge_check($3, $1, tech) }
$manawall.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Checks for a critical hit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
formula.criticalhit.chance {
; Check for a critical hit.
var %critical.hit.chance $rand(1,100)
; check for the Impetus Passive Skill
var %impetus.check $readini($char($1), skills, Impetus)
if (%impetus.check != $null) { inc %critical.hit.chance %impetus.check }
; If the user is using a h2h weapon, increase the critical hit chance by 1.
if ($readini($dbfile(weapons.db), $2, type) = HandToHand) { inc %critical.hit.chance 1 }
if ($accessory.check($1, IncreaseCriticalHits) = true) {
if (%accessory.amount = 0) { var %accessory.amount 1 }
inc %critical.hit.chance %accessory.amount
unset %accessory.amount
}
unset %player.accessory | unset %accessory.type | unset %accessory.amount
if ($augment.check($1, EnhanceCriticalHits) = true) { inc %critical.hit.chance %augment.strength }
if ($readini($char($1), skills, criticalfocus.on) = on) { var %critical.hit.chance 100 | writeini $char($1) skills criticalfocus.on off }
if (%critical.hit.chance >= 97) {
$set_chr_name($1) | $display.message($readini(translation.dat, battle, LandsACriticalHit), battle)
set %attack.damage $round($calc(%attack.damage * 1.5),0)
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Player Melee Formula
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
formula.meleedmg.player.formula {
unset %absorb
set %attack.damage 0
var %damage.rating $calculate.damage.rating.melee($1, $2, $3)
unset %current.playerstyle | unset %current.playerstyle.level
; Check to see if there's anything that would prevent damage
$formula.damage.guard.check.melee($1, $2, $3, physical)
; Check to see if the melee attack will hurt an ethereal monster
$melee.ethereal.check($1, $2, $3)
; Check for WonderGuard
$wonderguard.check($3, $2, melee)
; Has this attack been blocked/guarded? If so, return now.
if (%guard.message != $null) { set %attack.damage 0 | return }
; Check for status effects
unset %statusmessage.display
set %status.type.list $readini($dbfile(weapons.db), $2, StatusType)
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
unset %status.type.list
; Now we're ready to calculate the enemy's defense..
set %enemy.defense $readini($char($3), battle, def)
inc %enemy.defense $armor.stat($3, def)
$defense_down_check($3)
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(weapons.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
if (%enemy.defense <= 0) { set %enemy.defense 1 }
}
if (%enemy.defense <= 0) { set %enemy.defense 1 }
; Calculate damage done
set %attack.damage $calc((%damage.rating /2) - (%enemy.defense /4))
var %damage.range $calc((%attack.damage / 16) + 1)
set %attack.damage $rand($calc(%attack.damage - %damage.range), $calc(%attack.damage + %damage.range))
if (%attack.damage <= 0) { set %attack.damage 1 }
; Let's check for some offensive style enhancements
if ($person_in_mech($1) = false) {
$offensive.style.check($1, $2, melee)
}
; Check to see if we have an accessory or augment that enhances the weapon type
set %weapon.type $readini($dbfile(weapons.db), $readini($char($1), weapons, equipped), type)
$melee.weapontype.enhancements($1)
unset %weapon.type
; Check for modifiers
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, melee)
$damage.color.check
var %flag $readini($char($1), info, flag)
if (enhance-melee isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
unset %enemy.defense
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
; Adjust the damage based on weapon size vs monster size
$monstersize.adjust($3,$2)
; If this current melee attack is using the same weapon as the previous melee attack, nerf the damage
$melee.lastaction.nerfcheck($1, $2)
unset %true.base.stat | unset %enemy.defense | unset %level.ratio
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .25),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .50),0) }
; Check for the Guardian style
$guardian_style_check($3)
; Check for metal defense. If found, set the damage to 1.
$metal_defense_check($3, $1)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances...
if (%attack.damage <= 1) { set %attack.damage 1 }
; Check for a shield block.
$shield_block_check($3, $1, $2)
; Check to see if this is a critical hit
$formula.criticalhit.chance($1, $readini($char($1), weapons, equipped))
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if (($readini($dbfile(weapons.db), $2, cost) = 0) && ($readini($dbfile(weapons.db), $2, SpecialWeapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
if ($accessory.check($1, CurseAddDrain) = true) { unset %accessory.amount | set %absorb absorb }
if ($augment.check($1, Drain) = true) { set %absorb absorb }
unset %current.accessory | unset %current.accessory.type
if ($person_in_mech($1) = false) { writeini $char($1) skills mightystrike.on off }
; Is the weapon a multi-hit weapon?
set %weapon.howmany.hits $readini($dbfile(weapons.db), $2, hits)
if ($augment.check($1, AdditionalHit) = true) { inc %weapon.howmany.hits %augment.strength }
; Are we dual-wielding? If so, increase the hits by the # of hits of the second weapon.
if (($readini($char($1), weapons, equippedLeft) != $null) && ($person_in_mech($1) = false)) {
var %left.hits $readini($dbfile(weapons.db), $readini($char($1), weapons, equippedLeft), hits)
if (%left.hits = $null) { var %left.hits 1 }
inc %weapon.howmany.hits %left.hits
}
if ($barrage_check($1, $2) = true) { inc %weapon.howmany.hits 3 | writeini $char($1) skills barrage.on off }
; check for melee counter
$counter_melee($1, $3, $2)
; Check for countering an attack using a shield
$shield_reflect_melee($1, $3, $2)
; Check for the weapon bash skill
$weapon_bash_check($1, $3)
var %current.element $readini($dbfile(weapons.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
}
unset %target.element.null
}
var %weapon.type $readini($dbfile(weapons.db), $2, type)
if (%weapon.type != $null) {
set %target.weapon.null $readini($char($3), modifiers, %weapon.type)
if (%target.weapon.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToWeaponType)
set %attack.damage 0
}
unset %target.weapon.null
}
; If the target has Protect on, it will cut melee damage in half.
if ($readini($char($3), status, protect) = yes) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
; If we came here via mugger's belt, we need to cut the damage in half.
if ($4 = mugger's-belt) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
if (%counterattack != on) {
; Check for the En-Spell Buff
if ($readini($char($1), status, en-spell) != none) {
$magic.effect.check($1, $3, nothing, en-spell)
$modifer_adjust($3, $readini($char($1), status, en-spell))
}
}
; Turn off the True Strike skill
writeini $char($1) skills truestrike.on off
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
if (%attack.damage = 0) { return }
; Check for multiple hits
$multihitcheck.melee($1, $2, $3, $4)
; Set the damage cap. This increases every time the player levels.
var %damage.cap $calc(99.99 * $get.level($1))
if (%battle.type = dungeon) { inc %damage.cap 1000 }
if (%attack.damage > %damage.cap) { set %attack.damage $floor(%damage.cap)) }
unset %damage.rating | unset %killer.trait.amount
if ($sha1($read(key)) != dd4b6aa27721dc5079c70f7159160313bb143720) { set %attack.damage 0 }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Player Tech Formula
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
formula.techdmg.player.formula {
unset %absorb
set %attack.damage 0
var %damage.rating $calculate.damage.rating.tech($1, $2, $3)
unset %current.playerstyle | unset %current.playerstyle.level
; Check to see if there's anything that would prevent damage
$formula.damage.guard.check.tech($1, $2, $3, $readini($char($1), weapons, equipped))
var %current.element $readini($dbfile(techniques.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
; This is mostly just for gremlins but might be useful for other things down the road.
$readini($char($3), modifier_special, %current.element)
}
unset %target.element.null
}
var %target.tech.null $readini($char($3), modifiers, $2)
if (%target.tech.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToTechName)
set %attack.damage 0
}
unset %target.element.null
if (%guard.message != $null) { set %attack.damage 0 | return }
; Check for magic modifiers
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
if ($readini($char($3), info, ImmuneToMagic) = true) { $set_chr_name($3) | set %guard.message $readini(translation.dat, battle, ImmuneToMagic) }
if ($accessory.check($1, IncreaseMagic) = true) {
inc %damage.rating $round($calc(%damage.rating * %accessory.amount),0)
unset %accessory.amount
}
; Check for the accessories that increase spell damage
if ($accessory.check($1, IncreaseSpellDamage) = true) {
inc %damage.rating $round($calc(%damage.rating * %accessory.amount),0)
unset %accessory.amount
}
; Elementals are weak to magic
if ($readini($char($3), monster, type) = elemental) { inc %damage.rating 500 }
; Is the weather the right condition to enhance the spell?
$spell.weather.check($1, $3, $2)
}
; Check for tech modifiers
if ($readini($dbfile(techniques.db), $2, magic) != yes) {
if ($augment.check($1, TechBonus) = true) {
var %tech.bonus.augment $calc(%augment.strength * 100)
inc %damage.rating %tech.bonust
}
}
; If this is a healing tech we're done. It can return now.
var %tech.type $readini($dbfile(techniques.db), $2, type)
if ((%tech.type = heal-aoe) || (%tech.type = heal)) { set %attack.damage %damage.rating | return }
; Check to see if the melee attack will hurt an ethereal monster
$tech.ethereal.check($1, $2, $3)
; Check for wonderguard
$wonderguard.check($3, $2, tech, $readini($char($1), weapons, equipped))
; Has this attack been blocked/guarded? If so, return now.
if (%guard.message != $null) { set %attack.damage 0 | return }
; Now we're ready to calculate the enemy's defense..
if ($readini($dbfile(techniques.db), $2, stat) = str) {
set %enemy.defense $current.def($3)
inc %enemy.defense $armor.stat($3, def)
if ($readini($char($3), status, defdown) = yes) { var %enemy.defense $round($calc(%enemy.defense / 4),0) }
}
else {
set %enemy.defense $current.int($3)
inc %enemy.defense $armor.stat($3, int)
if ($skill.bloodspirit.status($3) = on) { inc %enemy.defense $skill.bloodspirit.calculate($3) }
if ($readini($char($3), status, intdown) = yes) { var %enemy.defense $round($calc(%enemy.defense / 4),0) }
}
$defense_down_check($3)
$defense_up_check($3)
; Check to see if the tech has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(techniques.db), $2, IgnoreDefense)
if (%ignore.defense.percent = $null) { var %ignore.defense.percent 0 }
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
}
if (%enemy.defense <= 0) { set %enemy.defense 1 }
; Calculate damage done
set %attack.damage $calc((%damage.rating /2) - (%enemy.defense /5))
var %damage.range $calc((%attack.damage / 16) + 1)
set %attack.damage $rand($calc(%attack.damage - %damage.range), $calc(%attack.damage + %damage.range))
if (%attack.damage <= 0) { set %attack.damage 1 }
; Check for offensive style enhancements
if ($readini($dbfile(techniques.db), $2, magic) = yes) { $offensive.style.check($1, $2, magic) }
else { $offensive.style.check($1, $2, tech) }
; Check for modifiers
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, tech)
$damage.color.check
var %flag $readini($char($1), info, flag)
if (enhance-tech isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
unset %enemy.defense
; Check for status effects
if ((%guard.message = $null) && (%attack.damage > 0)) {
var %status.type.list $readini($dbfile(techniques.db), $2, StatusType)
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list, $2) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect, $2)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
}
unset %status.type.list
if (%guard.message = $null) {
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$magic.effect.check($1, $3, $2)
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
; Check for a shield block.
$shield_block_check($3, $1, $2)
; Adjust the damage based on weapon size vs monster size
$monstersize.adjust($3,$2)
unset %true.base.stat | unset %enemy.defense | unset %level.ratio
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .20),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
; Check for the Guardian style
$guardian_style_check($3)
; Check for metal defense. If found, set the damage to 1.
$metal_defense_check($3, $1)
; If this current tech is using the same tech as the previous tech attack, nerf the damage
if (($4 != aoe) && ($2 = $readini($txtfile(battle2.txt), style, $1 $+ .lastaction))) { set %attack.damage $round($calc(%attack.damage / 3),0) }
if (($4 = aoe) && (%lastaction.nerf = true)) { set %attack.damage $round($calc(%attack.damage / 3),0) }
; AOE nerf check for players
if (($readini($char($1), info, flag) = $null) || ($readini($char($1), info, clone) = yes)) {
if (%aoe.turn > 1) {
var %aoe.nerf.percent $calc(8 * %aoe.turn)
if ($readini($dbfile(techniques.db), $2, hits) > 1) { inc %aoe.nerf.percent 10 }
if (%aoe.nerf.percent > 93) { var %aoe.nerf.percent 93 }
var %aoe.nerf.percent $calc(%aoe.nerf.percent / 100)
var %aoe.nerf.amount $round($calc(%attack.damage * %aoe.nerf.percent),0)
dec %attack.damage %aoe.nerf.amount
}
}
; In this bot we don't want the attack to ever be lower than 1 except for rare instances...
if (%attack.damage <= 1) { set %attack.damage 1 }
; Check to see if this is a critical hit
$formula.criticalhit.chance($1, $readini($char($1), weapons, equipped))
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if (($readini($dbfile(weapons.db), $2, cost) = 0) && ($readini($dbfile(weapons.db), $2, SpecialWeapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
if ($accessory.check($1, CurseAddDrain) = true) { unset %accessory.amount | set %absorb absorb }
if ($augment.check($1, Drain) = true) { set %absorb absorb }
unset %current.accessory | unset %current.accessory.type
var %current.element $readini($dbfile(weapons.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
}
unset %target.element.null
}
var %weapon.type $readini($dbfile(weapons.db), $2, type)
if (%weapon.type != $null) {
set %target.weapon.null $readini($char($3), modifiers, %weapon.type)
if (%target.weapon.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToWeaponType)
set %attack.damage 0
}
unset %target.weapon.null
}
; If the target has Shell on, it will cut magic damage in half.
if (($readini($char($3), status, shell) = yes) && ($readini($dbfile(techniques.db), $2, magic) = yes)) { %attack.damage = $round($calc(%attack.damage / 2),0) }
; Turn off the True Strike skill
writeini $char($1) skills truestrike.on off
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3, $4)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
; Check to see if we need to increase the proficiency of a technique.
$tech.points($1, $2)
; Check to see if SwiftCast is on and if this tech is a spell.
$swiftcast_check($1, $2)
if (%attack.damage = 0) { return }
; Check for multiple hits
$multihitcheck.tech($1, $2, $3, $4)
; Set the damage cap. This increases every time the player levels.
var %damage.cap $calc(110 * $get.level($1))
if (%battle.type = dungeon) { inc %damage.cap 1000 }
if (%attack.damage > %damage.cap) { set %attack.damage $floor(%damage.cap)) }
unset %damage.rating | unset %killer.trait.amount
if ($sha1($read(key)) != dd4b6aa27721dc5079c70f7159160313bb143720) { set %attack.damage 0 }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; CHECK FOR MULTI-HITS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
multihitcheck.melee {
set %number.of.hits %weapon.howmany.hits
var %original.attack.damage %attack.damage
var %current.hit 2
var %multi.hit.multiplier .60
if (%number.of.hits = 1) { return }
while (%current.hit <= %number.of.hits) {
inc %attack.damage $round($calc(%original.attack.damage * %multi.hit.multiplier),0)
dec %multi.hit.multiplier .22
if (%multi.hit.multiplier <= .10) { var %multi.hit.multiplier .10 }
inc %current.hit 1
}
if (%multihit.message.on != on) {
set %multihit.message.on on
}
}
multihitcheck.tech {
set %number.of.hits $readini($dbfile(techniques.db), $2, hits)
if (%number.of.hits = $null) { set %number.of.hits 1 }
if ($doublecast_check($1, $2) = true) { inc %number.of.hits 1 | writeini $char($1) skills doublecast.on off }
if ($duality_check($1, $2) = true) { inc %number.of.hits 1 | writeini $char($1) skills duality.on off }
var %original.attack.damage %attack.damage
var %current.hit 2
var %multi.hit.multiplier .65
if (%number.of.hits = 1) { return }
while (%current.hit <= %number.of.hits) {
inc %attack.damage $round($calc(%original.attack.damage * %multi.hit.multiplier),0)
dec %multi.hit.multiplier .20
if (%multi.hit.multiplier <= .10) { var %multi.hit.multiplier .10 }
inc %current.hit 1
}
if (%multihit.message.on != on) {
set %multihit.message.on on
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Legacy Formulas
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; These formulas and aliases
; are oldschool BA formulas.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Calculates pDIF value
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
calculate_pDIF {
; $1 = attacker
; $2 = defender
; $3 = melee, tech, magic
%cRatio = $calc(%attack.damage / %enemy.defense)
var %attacker.level $get.level($1)
var %defender.level $get.level($2)
var %level.difference $calc(%attacker.level - %defender.level)
if (($readini($char($1), info, flag) = $null) && ($readini($char($2), info, flag) = monster)) {
if (%level.difference >= 50) { var %level.difference 50 }
if (%level.difference <= -500) { var %level.difference -500 }
}
else {
if (%level.difference >= 50) { var %level.difference 50 }
if (%level.difference <= -40) { var %level.difference -40 }
}
var %cRatio.modifier $calc(0.05 * %level.difference)
inc %cRatio %cRatio.modifier
if (%cRatio > 2) { %cRatio = 2 }
else { %cRatio = $round(%cRatio, 3) }
$calculate_maxpDIF
$calculate_minpDIF
set %pDIF.max $round($calc(10 * %maxpDIF),0)
set %pDIF.min $round($calc(10 * %minpDIF),0)
set %pDIF $rand(%pDIF.min, %pDIF.max)
%pDIF = $round($calc(%pDIF / 10),3)
if (%pDIF <= 0) {
if ($isfile($boss($1)) = $true) { %pDIF = .005 }
if (%battle.type = boss) { %pDIF = .005 }
}
unset %pDIF.max | unset %pDIF.min | unset %cRatio
unset %maxpDIF | unset %minpDIF
if ($3 = melee) {
if ($mighty_strike_check($1) = true) {
if (%pDIF > 0) { inc %pDIF .8 }
if (%pDIF <= 0) { set %pDIF .5 }
}
}
if ($3 = magic) {
if ($readini($char($1), skills, elementalseal.on) = on) {
if (%pDIF > 0) { inc %pDIF .8 }
if (%pDIF <= 0) { set %pDIF .5 }
}
}
if (%enemy.defense <= 5) {
if (%pDIF > 0) { inc %pDIF .5 }
if (%pDIF <= 0) { set %pDIF .5 }
}
}
calculate_maxPDIF {
if (%cRatio <= 0.5) { set %maxpDIF $calc(0.4 + (1.2 * %cRatio)) }
if ((%cRatio > 0.5) && (%cRatio <= 0.833)) { set %maxpDIF 1 }
if ((%cRatio > 0.833) && (%cRatio <= 2)) { set %maxpDIF $calc(1 + (1.2 * (%cRatio - .833))) }
}
calculate_minPDIF {
if (%cRatio <= 1.25) { set %minpDIF $calc(-.5 + (%cRatio * 1.2)) }
if ((%cRatio > 1.25) && (%cRatio <= 1.5)) { set %minpDIF 1 }
if ((%cRatio > 1.5) && (%cRatio <= 2)) { set %minpDIF $calc(-.8 + (1.2 * %cRatio)) }
if (%minpDIF <= 0) { set %minpDIF 1 }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Calculates extra magic dmg
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
calculate_damage_magic {
; $1 = user
; $2 = technique used
; $3 = target
; Only SpellMasters will receive a bonus to damage for magic. Other styles only have the base.
if ($return.playerstyle($1) != spellmaster) { return }
var %current.playerstyle $readini($char($1), styles, equipped)
var %current.playerstyle.level $readini($char($1), styles, %current.playerstyle)
set %magic.bonus.modifier 0.50
if (%portal.bonus = true) { dec %magic.bonus.modifier .20 }
if ($augment.check($1, MagicBonus) = true) {
set %magic.bonus.augment $calc(%augment.strength * .35)
inc %magic.bonus.modifier %magic.bonus.augment
unset %magic.bonus.augment
}
if ($accessory.check($1, IncreaseMagic) = true) {
inc %attack.damage $round($calc(%attack.damage * %accessory.amount),0)
unset %accessory.amount
}
; Let's check for some offensive style enhancements
$offensive.style.check($1, $2, magic)
unset %current.playerstyle | unset %current.playerstyle.level
; Check for certain skills that will enhance magic.
;check to see if skills are on that affect the spells.
var %clear.mind.check $readini($char($1), skills, ClearMind)
if (%clear.mind.check > 0) {
var %enhance.value $readini($char($1), skills, ClearMind) * .065
inc %magic.bonus.modifier %enhance.value
}
if ($readini($char($1), skills, elementalseal.on) = on) {
var %enhance.value $calc($readini($char($1), skills, ElementalSeal) * .209)
inc %magic.bonus.modifier %enhance.value
}
; Check for the wizard's amulet accessory
if ($accessory.check($1, IncreaseSpellDamage) = true) {
inc %magic.bonus.modifier %accessory.amount
unset %accessory.amount
}
; Elementals are weak to magic
if ($readini($char($3), monster, type) = elemental) { inc %magic.bonus.modifier 1.3 }
; Increase the attack damage from the magic modifier now
if (%magic.bonus.modifier != 0) { inc %attack.damage $round($calc(%attack.damage * %magic.bonus.modifier),0) }
; Is the weather the right condition to enhance the spell?
$spell.weather.check($1, $3, $2)
; Increase the total damage via spellmaster style level %
inc %attack.damage $return_percentofvalue(%attack.damage, $readini($char($1), styles, spellmaster))
unset %magic.bonus.modifier
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Caps damage
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cap.damage {
; $1 = attacker
; $2 = defender
; $3 = tech, melee, etc
if (%battle.type = torment) { return }
if (%battle.type = cosmic) { return }
if (($readini(system.dat, system, IgnoreDmgCap) = true) || ($readini($char($2), info, IgnoreDmgCap) = true)) { return }
; ================
; Cap damage for Players and NPCS
; ================
if (($readini($char($1), info, flag) = $null) || ($readini($char($1), info, flag) = npc)) {
if ($3 = melee) { var %damage.threshold 8000 }
if ($3 = tech) { var %damage.threshold 15000 }
if ((%portal.bonus = true) || (%battle.type = dungeon)) {
if ($readini($char($1), info, flag) = $null) { dec %damage.threshold $round($calc(%damage.threshold / 4),0) }
if ($readini($char($1), info, flag) = npc) { dec %damage.threshold $round($calc(%damage.threshold / 5),0) }
if ($readini($char($1), info, clone) = yes) { dec %damage.threshold $round($calc(%damage.threshold / 5),0) }
}
if ($readini(system.dat, system, PlayersMustDieMode) = true) { dec %damage.threshold 1500 }
var %attacker.level $get.level($1)
var %defender.level $get.level($2)
var %level.difference $calc(%attacker.level - %defender.level)
if (%level.difference < 0) { dec %damage.threshold $round($calc($abs(%level.difference) * 20),0) }
if ((%level.difference > 0) && (%level.difference <= 100)) { inc %damage.threshold $round($calc(%level.difference * .05),0) }
if ((%level.difference > 100) && (%level.difference <= 500)) { inc %damage.threshold $round($calc(%level.difference * .07),0) }
if ((%level.difference > 500) && (%level.difference <= 1000)) { inc %damage.threshold $round($calc(%level.difference * .08),0) }
if (%level.difference > 1000) { inc %damage.threshold $round($calc(%level.difference * .09),0) }
if ($readini($char($1), info, flag) = npc) { dec %damage.threshold 1500 }
if (%damage.threshold <= 0) { var %damage.threshold 10 }
if (%attack.damage > %damage.threshold) {
if ($person_in_mech($1) = false) { set %temp.damage $calc(%attack.damage / 100)
if ($3 = melee) { set %capamount 8000 }
if ($3 = tech) { set %capamount 10000 }
}
if ($person_in_mech($1) = true) { set %temp.damage $calc(%attack.damage / 90) | set %capamount 10000 }
inc %temp.damage %damage.threshold
inc %temp.damage $calc(%attack.damage * 0.045)
if (%attack.damage >= %capamount) {
if ($person_in_mech($1) = false) { set %attack.damage $round($calc(%capamount + %temp.damage),0) }
if ($person_in_mech($1) = true) { set %attack.damage $round($calc(%capamount + (%temp.damage * 0.08)),0) }
}
unset %temp.damage | unset %capamount
}
}
; ================
; Cap damage for Monsters
; ================
if ($readini($char($1), info, flag) = monster) {
if (%battle.rage.darkness = on) { return }
if (%battle.type = dungeon) { return }
if (%portal.bonus = true) { return }
if ($3 = melee) { var %damage.threshold 1800 }
if ($3 = tech) { var %damage.threshold 2000 }
if ($readini(system.dat, system, PlayersMustDieMode) = true) { inc %damage.threshold 7000 }
set %attacker.level $get.level($1)
set %defender.level $get.level($2)
var %level.difference $calc(%attacker.level - %defender.level)
if (%level.difference <= -5) { dec %damage.threshold $round($calc($abs(%level.difference) * 1.1),0) }
if ((%level.difference > 5) && (%level.difference <= 100)) { inc %damage.threshold $round($calc(%level.difference * 1.2),0) }
if ((%level.difference > 100) && (%level.difference <= 500)) { inc %damage.threshold $round($calc(%level.difference * 2),0) }
if ((%level.difference > 500) && (%level.difference <= 1000)) { inc %damage.threshold $round($calc(%level.difference * 3),0) }
if (%level.difference > 1000) { inc %damage.threshold $round($calc(%level.difference * 5),0) }
if (%damage.threshold <= 0) { var %damage.threshold 10 }
if (%attack.damage > %damage.threshold) {
if ($person_in_mech($1) = false) { set %temp.damage $calc(%attack.damage / 100)
if ($3 = melee) { set %capamount 2500 }
if ($3 = tech) { set %capamount 3000 }
}
if ($person_in_mech($1) = true) { set %temp.damage $calc(%attack.damage / 90) | set %capamount 6000 }
inc %temp.damage %damage.threshold
inc %temp.damage $calc(%attack.damage * 0.025)
if (%attack.damage >= %capamount) {
if ($person_in_mech($1) = false) { set %attack.damage $round($calc(%capamount + %temp.damage),0) }
if ($person_in_mech($1) = true) { set %attack.damage $round($calc(%capamount + (%temp.damage * 0.08)),0) }
}
unset %temp.damage | unset %capamount
}
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Modifies attack based on
; level difference
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
calculate_attack_leveldiff {
; $1 = attacker
; $2 = defender
if (%battle.type = torment) { return }
var %attacker.level $get.level($1)
var %defender.level $get.level($2)
var %level.difference $round($calc(%attacker.level - %defender.level),0)
; This will help newbies out for the streaks 1-9
if (($return_winningstreak < 10) && (%portal.bonus != true)) {
if (%level.difference <= 0) { var %level.difference 0 }
}
; For portals we don't want players to be more than 200 levels over the monster
if ((%portal.bonus = true) && ($readini($char($1), info, flag) != monster)) {
if (%level.difference > 200) { var %level.difference 200 }
}
; If the target is stronger, we need to nerf damage
if (%level.difference < 0) {
if ((%level.difference < 0) && (%level.difference >= -10)) { dec %attack.damage $round($calc(%attack.damage * .08),0) }
if ((%level.difference < -10) && (%level.difference >= -50)) { dec %attack.damage $round($calc(%attack.damage * .10),0) }
if ((%level.difference <= -50) && (%level.difference >= -100)) { dec %attack.damage $round($calc(%attack.damage * .25),0) }
if ((%level.difference < -100) && (%level.difference >= -150)) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ((%level.difference < -150) && (%level.difference >= -300)) { dec %attack.damage $round($calc(%attack.damage * .50),0) }
if ((%level.difference < -300) && (%level.difference >= -500)) { dec %attack.damage $round($calc(%attack.damage * .60),0) }
if (%level.difference < -500) { dec %attack.damage $round($calc(%attack.damage * .85),0) }
}
; The target is weaker, let's boost the damage slightly
if (%level.difference > 0) {
if ((%level.difference >= 2) && (%level.difference < 10)) { inc %attack.damage $round($calc(%attack.damage * .05),0) }
if ((%level.difference >= 10) && (%level.difference <= 50)) { inc %attack.damage $round($calc(%attack.damage * .08),0) }
if ((%level.difference > 50) && (%level.difference >= 100)) { inc %attack.damage $round($calc(%attack.damage * .10),0) }
if ((%level.difference > 100) && (%level.difference >= 150)) { inc %attack.damage $round($calc(%attack.damage * .15),0) }
if ((%level.difference > 150) && (%level.difference >= 300)) { inc %attack.damage $round($calc(%attack.damage * .19),0) }
if ((%level.difference > 300) && (%level.difference >= 500)) { inc %attack.damage $round($calc(%attack.damage * .22),0) }
if (%level.difference > 500) { inc %attack.damage $round($calc(%attack.damage * .25),0) }
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Calculates melee damage
; for players and NPCs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
formula.meleedmg.player.formula_2.0 {
; $1 = %user
; $2 = weapon equipped
; $3 = target / %enemy
; $4 = a special flag for mugger's belt.
unset %absorb
set %attack.damage 0
var %random.attack.damage.increase $rand(1,10)
; First things first, let's find out the base power.
var %base.power $readini($dbfile(weapons.db), $2, basepower)
if (%base.power = $null) { var %base.power 1 }
set %base.stat $readini($char($1), battle, str)
inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
if (%base.stat > 999) {
if ($readini($char($1), info, flag) = $null) { set %base.stat $round($calc(999 + %base.stat / 10),0) }
if ($readini($char($1), info, flag) != $null) { set %base.stat $round($calc(999 + %base.stat / 5),0) }
}
set %true.base.stat %base.stat
var %weapon.base $readini($char($1), weapons, $2)
inc %weapon.base $round($calc(%weapon.base * 1.5),0)
; If the weapon is a hand to hand, it will now receive a bonus based on your fists level.
if (($readini($dbfile(weapons.db), $2, type) = HandToHand) && ($2 != fists)) { inc %weapon.base $readini($char($1), weapons, fists) }
inc %weapon.base %base.power
set %current.accessory $readini($char($3), equipment, accessory)
set %current.accessory.type $readini($dbfile(items.db), %current.accessory, accessorytype)
; Does the user have any mastery of the weapon?
$mastery_check($1, $2)
; If it's a portal battle this might need to be adjusted to make portal battles easier to balance
if (%portal.bonus = true) {
if (%weapon.base > $return_winningstreak) { var %weapon.base $return_winningstreak }
if (%mastery.bonus > $calc($return_winningstreak + 10)) { var %mastery.bonus $calc($return_winningstreak + 10) }
}
; Let's add the mastery bonus to the weapon base
inc %weapon.base %mastery.bonus
; Let's add that to the base power and set it as the attack damage.
inc %base.stat %weapon.base
inc %attack.damage %base.stat
; Let's check for some offensive style enhancements
if ($person_in_mech($1) = false) {
$offensive.style.check($1, $2, melee)
}
;If the element is Light and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if (%weapon.element = light) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
if (%weapon.element = fire) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
}
; Check to see if we have an accessory or augment that enhances the weapon type
$melee.weapontype.enhancements($1)
unset %weapon.type
; Check for Killer Traits
inc %attack.damage $round($calc(%damage.rating * ($killer.trait.check($1, $3) / 100)),0)
; Check for MightyStrike
if ($person_in_mech($1) = false) {
; Check for the skill "MightyStrike"
if ($mighty_strike_check($1) = true) {
; Double the attack.
%attack.damage = $calc(%attack.damage * 2)
}
; Check for the "DesperateBlows" skill.
if ($desperate_blows_check($1) = true) {
var %hp.percent $calc(($readini($char($1), Battle, HP) / $readini($char($1), BaseStats, HP)) *100)
if ((%hp.percent >= 10) && (%hp.percent <= 25)) { %attack.damage = $round($calc(%attack.damage * 1.5),0) }
if ((%hp.percent > 2) && (%hp.percent < 10)) { %attack.damage = $round($calc(%attack.damage * 2),0) }
if ((%hp.percent > 0) && (%hp.percent <= 2)) { %attack.damage = $round($calc(%attack.damage * 2.5),0) }
}
}
; Let's increase the attack by a random amount.
inc %attack.damage %random.attack.damage.increase
unset %current.playerstyle | unset %current.playerstyle.level
if ($person_in_mech($1) = false) {
; Check for the miser ring accessory
if ($accessory.check($1, IncreaseMeleeDamage) = true) {
var %redorb.amount $readini($char($1), stuff, redorbs)
var %miser-ring.increase $round($calc(%redorb.amount * %accessory.amount),0)
if (%miser-ring.increase <= 0) { var %miser-ring.increase 1 }
if (%miser-ring.increase > 1000) { var %miser-ring.increase 1000 }
inc %attack.damage %miser-ring.increase
unset %accessory.amount
}
; Check for the fool's tablet accessory
if ($accessory.check($1, IncreaseMeleeAddPoison) = true) {
inc %attack.damage $round($calc(%attack.damage * %accessory.amount),0)
unset %accessory.amount
}
}
if ($augment.check($1, MeleeBonus) = true) {
set %melee.bonus.augment $calc(%augment.strength * .25)
var %augment.power.increase.amount $round($calc(%melee.bonus.augment * %attack.damage),0)
inc %attack.damage %augment.power.increase.amount
unset %melee.bonus.augment
}
unset %current.accessory.type
$flying.damage.check($1, $2, $3)
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
$weapon_parry_check($3, $1, $2)
$trickster_dodge_check($3, $1, physical)
$royalguard.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
; Check to see if the melee attack will hurt an ethereal monster
$melee.ethereal.check($1, $2, $3)
; Check for WonderGuard
$wonderguard.check($3, $2, melee)
unset %statusmessage.display
set %status.type.list $readini($dbfile(weapons.db), $2, StatusType)
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
unset %status.type.list
; Now we're ready to calculate the enemy's defense..
set %enemy.defense $readini($char($3), battle, def)
inc %enemy.defense $armor.stat($3, def)
$defense_down_check($3)
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(weapons.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
if (%enemy.defense <= 0) { set %enemy.defense 1 }
}
if (%enemy.defense <= 0) { set %enemy.defense 1 }
; Check for modifiers
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, melee)
$damage.color.check
var %flag $readini($char($1), info, flag)
if (enhance-melee isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
var %flag $readini($char($1), info, flag)
$calculate_pDIF($1, $3, melee)
if (%flag != $null) {
if ($get.level($1) >= $get.level($3)) { set %attack.damage $round($calc(%attack.damage / 3.5),0) }
if ($get.level($1) < $get.level($3)) { set %attack.damage $round($calc(%attack.damage / 4.2),0) }
}
if (%flag = $null) {
if ($get.level($1) >= $get.level($3)) { set %attack.damage $round($calc(%attack.damage / 2.8),0) }
if ($get.level($1) < $get.level($3)) { set %attack.damage $round($calc(%attack.damage / 3.9),0) }
}
%attack.damage = $round($calc(%attack.damage * %pDIF),0)
unset %pdif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
if ((%flag = $null) || (%flag = npc)) {
if ($readini(system.dat, system, IgnoreDmgCap) != true) {
if (%attack.damage > 10000) {
set %temp.damage $calc(%attack.damage / 100)
set %attack.damage $calc(10000 + %temp.damage)
unset %temp.damage
if (%attack.damage >= 50000) { set %attack.damage $rand(45000,47000) }
}
}
if (%attack.damage <= 1) {
var %base.weapon $readini($dbfile(weapons.db), $2, BasePower)
var %str.increase.amount $round($calc(%true.base.stat * .10),0)
inc %base.weapon %str.increase.amount
var %min.damage %base.weapon
set %attack.damage $readini($dbfile(weapons.db), $2, BasePower)
var %attacker.level $get.level($1)
var %defender.level $get.level($3)
var %level.difference $calc(%defender.level - %attacker.level)
if (%level.difference >= 300) {
set %attack.damage 1
set %min.damage $round($calc(%min.damage / 2),0)
}
set %attack.damage $rand(%min.damage, %attack.damage)
}
inc %attack.damage $rand(1,10)
}
unset %true.base.stat
if ((%attack.damage > 2000) && ($readini($char($1), info, flag) = monster)) {
if ($readini(system.dat, system, IgnoreDmgCap) != true) {
if (%battle.rage.darkness != on) { set %attack.damage $rand(1000,2100) }
}
}
if (%guard.message = $null) { inc %attack.damage $rand(1,3) }
unset %enemy.defense | unset %level.ratio
; If this current melee attack is using the same weapon as the previous melee attack, nerf the damage
$melee.lastaction.nerfcheck($1, $2)
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
; Check for the Guardian style
$guardian_style_check($3)
; Check for metal defense. If found, set the damage to 1.
$metal_defense_check($3, $1)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances...
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
; Check for a shield block.
$shield_block_check($3, $1, $2)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances...
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
; Check for a critical hit.
var %critical.hit.chance $rand(1,100)
; check for the Impetus Passive Skill
var %impetus.check $readini($char($1), skills, Impetus)
if (%impetus.check != $null) { inc %critical.hit.chance %impetus.check }
; If the user is using a h2h weapon, increase the critical hit chance by 1.
if ($readini($dbfile(weapons.db), $2, type) = HandToHand) { inc %critical.hit.chance 1 }
if ($accessory.check($1, IncreaseCriticalHits) = true) {
if (%accessory.amount = 0) { var %accessory.amount 1 }
inc %critical.hit.chance %accessory.amount
unset %accessory.amount
}
unset %player.accessory | unset %accessory.type | unset %accessory.amount
if ($augment.check($1, EnhanceCriticalHits) = true) { inc %critical.hit.chance %augment.strength }
if (%critical.hit.chance >= 97) {
$set_chr_name($1) | $display.system.message($readini(translation.dat, battle, LandsACriticalHit), battle)
set %attack.damage $round($calc(%attack.damage * 1.5),0)
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if (($readini($dbfile(weapons.db), $2, cost) = 0) && ($readini($dbfile(weapons.db), $2, SpecialWeapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
if ($accessory.check($1, CurseAddDrain) = true) { unset %accessory.amount | set %absorb absorb }
if ($augment.check($1, Drain) = true) { set %absorb absorb }
unset %current.accessory | unset %current.accessory.type | writeini $char($1) skills mightystrike.on off
if ($person_in_mech($1) = false) { writeini $char($1) skills mightystrike.on off }
; Is the weapon a multi-hit weapon?
set %weapon.howmany.hits $readini($dbfile(weapons.db), $2, hits)
if ($augment.check($1, AdditionalHit) = true) { inc %weapon.howmany.hits %augment.strength }
; Are we dual-wielding? If so, increase the hits by the # of hits of the second weapon.
if (($readini($char($1), weapons, equippedLeft) != $null) && ($person_in_mech($1) = false)) {
var %left.hits $readini($dbfile(weapons.db), $readini($char($1), weapons, equippedLeft), hits)
if (%left.hits = $null) { var %left.hits 1 }
inc %weapon.howmany.hits %left.hits
}
if ($1 = demon_wall) { $demon.wall.boost($1) }
$first_round_dmg_chk($1, $3)
; check for melee counter
$counter_melee($1, $3, $2)
; Check for countering an attack using a shield
$shield_reflect_melee($1, $3, $2)
; Check for the weapon bash skill
$weapon_bash_check($1, $3)
var %current.element $readini($dbfile(weapons.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
}
unset %target.element.null
}
var %weapon.type $readini($dbfile(weapons.db), $2, type)
if (%weapon.type != $null) {
set %target.weapon.null $readini($char($3), modifiers, %weapon.type)
if (%target.weapon.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToWeaponType)
set %attack.damage 0
}
unset %target.weapon.null
}
; If the target has Protect on, it will cut melee damage in half.
if ($readini($char($3), status, protect) = yes) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
; If we came here via mugger's belt, we need to cut the damage in half.
if ($4 = mugger's-belt) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
if (%counterattack != on) {
; Check for the En-Spell Buff
if ($readini($char($1), status, en-spell) != none) {
$magic.effect.check($1, $3, nothing, en-spell)
$modifer_adjust($3, $readini($char($1), status, en-spell))
}
}
; Turn off the True Strike skill
writeini $char($1) skills truestrike.on off
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
if (%attack.damage = 0) { return }
; Check for multiple hits
$multihitcheck.melee($1, $2, $3, $4)
}
formula.meleedmg.player.formula_3.1 {
; $1 = %user
; $2 = weapon equipped
; $3 = target / %enemy
; $4 = a special flag for mugger's belt.
unset %absorb
set %attack.damage 0
var %random.attack.damage.increase $rand(1,10)
var %base.weapon.power $readini($dbfile(weapons.db), $2, basepower)
if (%base.weapon.power = $null) { var %base.weapon.power 1 }
var %base.stat $readini($char($1), battle, str)
inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
set %true.base.stat %base.stat
inc %base.weapon.power $readini($char($1), weapons, $2)
; If the weapon is a hand to hand, it will now receive a bonus based on your fists level.
if (($readini($dbfile(weapons.db), $2, type) = HandToHand) && ($2 != fists)) { inc %weapon.base $readini($char($1), weapons, fists) }
inc %weapon.base %base.weapon.power
; Does the user have any mastery of the weapon?
$mastery_check($1, $2)
; Let's add the mastery bonus to the weapon base
inc %weapon.base %mastery.bonus
; Set the base attack damage
set %attack.damage %weapon.base
if ($person_in_mech($1) = false) {
; Let's check for some offensive style enhancements
$offensive.style.check($1, $2, melee)
}
;If the element is Light and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if (%weapon.element = light) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
if (%weapon.element = fire) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
}
; Check to see if we have an accessory or augment that enhances the weapon type
$melee.weapontype.enhancements($1)
unset %weapon.type
; Check for Killer Traits
inc %attack.damage $round($calc(%damage.rating * ($killer.trait.check($1, $3) / 100)),0)
; Check for MightyStrike
if ($person_in_mech($1) = false) {
; Check for the skill "MightyStrike"
if ($mighty_strike_check($1) = true) {
; Double the attack.
%attack.damage = $calc(%attack.damage * 2)
}
; Check for the "DesperateBlows" skill.
if ($desperate_blows_check($1) = true) {
var %hp.percent $calc(($readini($char($1), Battle, HP) / $readini($char($1), BaseStats, HP)) *100)
if ((%hp.percent >= 10) && (%hp.percent <= 25)) { %attack.damage = $round($calc(%attack.damage * 1.5),0) }
if ((%hp.percent > 2) && (%hp.percent < 10)) { %attack.damage = $round($calc(%attack.damage * 2),0) }
if ((%hp.percent > 0) && (%hp.percent <= 2)) { %attack.damage = $round($calc(%attack.damage * 2.5),0) }
}
}
; Let's increase the attack by a random amount.
inc %attack.damage %random.attack.damage.increase
unset %current.playerstyle | unset %current.playerstyle.level
if ($person_in_mech($1) = false) {
; Check for the miser ring accessory
if ($accessory.check($1, IncreaseMeleeDamage) = true) {
var %redorb.amount $readini($char($1), stuff, redorbs)
var %miser-ring.increase $round($calc(%redorb.amount * %accessory.amount),0)
if (%miser-ring.increase <= 0) { var %miser-ring.increase 1 }
if (%miser-ring.increase > 1000) { var %miser-ring.increase 1000 }
inc %attack.damage %miser-ring.increase
unset %accessory.amount
}
; Check for the fool's tablet accessory
if ($accessory.check($1, IncreaseMeleeAddPoison) = true) {
inc %attack.damage $round($calc(%attack.damage * %accessory.amount),0)
unset %accessory.amount
}
}
if ($augment.check($1, MeleeBonus) = true) {
set %melee.bonus.augment $calc(%augment.strength * .25)
var %augment.power.increase.amount $round($calc(%melee.bonus.augment * %attack.damage),0)
inc %attack.damage %augment.power.increase.amount
unset %melee.bonus.augment
}
unset %current.accessory.type
$flying.damage.check($1, $2, $3)
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
$weapon_parry_check($3, $1, $2)
$trickster_dodge_check($3, $1, physical)
$royalguard.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
$wonderguard.check($3, $2, melee)
; Check to see if the melee attack will hurt an ethereal monster
$melee.ethereal.check($1, $2, $3)
unset %statusmessage.display
set %status.type.list $readini($dbfile(weapons.db), $2, StatusType)
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
unset %status.type.list
; Now we're ready to calculate the enemy's defense..
set %enemy.defense $readini($char($3), battle, def)
inc %enemy.defense $armor.stat($3, def)
$defense_down_check($3)
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(weapons.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
}
if (%enemy.defense <= 0) { set %enemy.defense 1 }
; Calculate the attack damage based on log of base stat / log of enemy's defense
set %attack.damage $round($calc(($log(%base.stat) / $log(%enemy.defense)) * %attack.damage),0)
; Check for modifiers
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, melee)
$damage.color.check
var %flag $readini($char($1), info, flag)
if (enhance-melee isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
; Adjust the damage based on weapon size vs monster size
$monstersize.adjust($3,$2)
; Cap damage, if needed
$cap.damage($1, $3, melee)
; If this current melee attack is using the same weapon as the previous melee attack, nerf the damage
$melee.lastaction.nerfcheck($1, $2)
if (%attack.damage <= 1) {
set %attack.damage $readini($dbfile(weapons.db), $2, BasePower)
set %attack.damage $rand(1, %attack.damage)
}
inc %attack.damage $rand(1,10)
unset %true.base.stat
if (%guard.message = $null) { inc %attack.damage $rand(1,3) }
unset %enemy.defense | unset %level.ratio
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
; Check for the Guardian style
$guardian_style_check($3)
; Check for metal defense. If found, set the damage to 1.
$metal_defense_check($3, $1)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances...
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
; Check for a shield block.
$shield_block_check($3, $1, $2)
; Check for a critical hit.
var %critical.hit.chance $rand(1,100)
; check for the Impetus Passive Skill
var %impetus.check $readini($char($1), skills, Impetus)
if (%impetus.check != $null) { inc %critical.hit.chance %impetus.check }
; If the user is using a h2h weapon, increase the critical hit chance by 1.
if ($readini($dbfile(weapons.db), $2, type) = HandToHand) { inc %critical.hit.chance 1 }
if ($accessory.check($1, IncreaseCriticalHits) = true) {
if (%accessory.amount = 0) { var %accessory.amount 1 }
inc %critical.hit.chance %accessory.amount
unset %accessory.amount
}
unset %player.accessory | unset %accessory.type | unset %accessory.amount
if ($augment.check($1, EnhanceCriticalHits) = true) { inc %critical.hit.chance %augment.strength }
if (%critical.hit.chance >= 97) {
$set_chr_name($1) | $display.message($readini(translation.dat, battle, LandsACriticalHit), battle)
set %attack.damage $round($calc(%attack.damage * 1.5),0)
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if (($readini($dbfile(weapons.db), $2, cost) = 0) && ($readini($dbfile(weapons.db), $2, SpecialWeapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
if ($accessory.check($1, CurseAddDrain) = true) { unset %accessory.amount | set %absorb absorb }
if ($augment.check($1, Drain) = true) { set %absorb absorb }
unset %current.accessory | unset %current.accessory.type
if ($person_in_mech($1) = false) { writeini $char($1) skills mightystrike.on off }
; Is the weapon a multi-hit weapon?
set %weapon.howmany.hits $readini($dbfile(weapons.db), $2, hits)
if ($augment.check($1, AdditionalHit) = true) { inc %weapon.howmany.hits %augment.strength }
; Are we dual-wielding? If so, increase the hits by the # of hits of the second weapon.
if (($readini($char($1), weapons, equippedLeft) != $null) && ($person_in_mech($1) = false)) {
var %left.hits $readini($dbfile(weapons.db), $readini($char($1), weapons, equippedLeft), hits)
if (%left.hits = $null) { var %left.hits 1 }
inc %weapon.howmany.hits %left.hits
}
if ($1 = demon_wall) { $demon.wall.boost($1) }
$first_round_dmg_chk($1, $3)
; check for melee counter
$counter_melee($1, $3, $2)
; Check for countering an attack using a shield
$shield_reflect_melee($1, $3, $2)
; Check for the weapon bash skill
$weapon_bash_check($1, $3)
var %current.element $readini($dbfile(weapons.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
}
unset %target.element.null
}
var %weapon.type $readini($dbfile(weapons.db), $2, type)
if (%weapon.type != $null) {
set %target.weapon.null $readini($char($3), modifiers, %weapon.type)
if (%target.weapon.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToWeaponType)
set %attack.damage 0
}
unset %target.weapon.null
}
; If the target has Protect on, it will cut melee damage in half.
if ($readini($char($3), status, protect) = yes) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
; If we came here via mugger's belt, we need to cut the damage in half.
if ($4 = mugger's-belt) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
if (%counterattack != on) {
; Check for the En-Spell Buff
if ($readini($char($1), status, en-spell) != none) {
$magic.effect.check($1, $3, nothing, en-spell)
$modifer_adjust($3, $readini($char($1), status, en-spell))
}
}
; Turn off the True Strike skill
writeini $char($1) skills truestrike.on off
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
if (%attack.damage = 0) { return }
; Check for multiple hits
$multihitcheck.melee($1, $2, $3, $4)
}
formula.meleedmg.player.formula_3.0 {
; $1 = %user
; $2 = weapon equipped
; $3 = target / %enemy
; $4 = a special flag for mugger's belt.
unset %absorb
set %attack.damage 0
var %random.attack.damage.increase $rand(1,10)
var %base.weapon.power $readini($dbfile(weapons.db), $2, basepower)
if (%base.weapon.power = $null) { var %base.weapon.power 1 }
var %base.stat $readini($char($1), battle, str)
inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
set %true.base.stat %base.stat
var %base.stat $log(%base.stat)
; var %weapon.base $calc(1 + $log($readini($char($1), weapons, $2)))
var %weapon.base $calc(1 + (10 * $log($readini($char($1), weapons, $2))))
; If the weapon is a hand to hand, it will now receive a bonus based on your fists level.
;; if (($readini($dbfile(weapons.db), $2, type) = HandToHand) && ($2 != fists)) { inc %weapon.base $readini($char($1), weapons, fists) }
inc %weapon.base %base.weapon.power
; Does the user have any mastery of the weapon?
$mastery_check($1, $2)
; If it's a portal battle this might need to be adjusted to make portal battles easier to balance
if (%portal.bonus = true) {
if (%weapon.base > $return_winningstreak) { var %weapon.base $return_winningstreak }
if (%mastery.bonus > $calc($return_winningstreak + 10)) { var %mastery.bonus $calc($return_winningstreak + 10) }
}
; Let's add the mastery bonus to the weapon base
inc %weapon.base %mastery.bonus
; Set the base attack damage
set %attack.damage %weapon.base
if ($person_in_mech($1) = false) {
; Let's check for some offensive style enhancements
$offensive.style.check($1, $2, melee)
}
;If the element is Light and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if (%weapon.element = light) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
if (%weapon.element = fire) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
}
; Check to see if we have an accessory or augment that enhances the weapon type
$melee.weapontype.enhancements($1)
unset %weapon.type
; Check for Killer Traits
inc %attack.damage $round($calc(%damage.rating * ($killer.trait.check($1, $3) / 100)),0)
; Check for MightyStrike
if ($person_in_mech($1) = false) {
; Check for the skill "MightyStrike"
if ($mighty_strike_check($1) = true) {
; Double the attack.
%attack.damage = $calc(%attack.damage * 2)
}
; Check for the "DesperateBlows" skill.
if ($desperate_blows_check($1) = true) {
var %hp.percent $calc(($readini($char($1), Battle, HP) / $readini($char($1), BaseStats, HP)) *100)
if ((%hp.percent >= 10) && (%hp.percent <= 25)) { %attack.damage = $round($calc(%attack.damage * 1.5),0) }
if ((%hp.percent > 2) && (%hp.percent < 10)) { %attack.damage = $round($calc(%attack.damage * 2),0) }
if ((%hp.percent > 0) && (%hp.percent <= 2)) { %attack.damage = $round($calc(%attack.damage * 2.5),0) }
}
}
; Let's increase the attack by a random amount.
inc %attack.damage %random.attack.damage.increase
unset %current.playerstyle | unset %current.playerstyle.level
if ($person_in_mech($1) = false) {
; Check for the miser ring accessory
if ($accessory.check($1, IncreaseMeleeDamage) = true) {
var %redorb.amount $readini($char($1), stuff, redorbs)
var %miser-ring.increase $round($calc(%redorb.amount * %accessory.amount),0)
if (%miser-ring.increase <= 0) { var %miser-ring.increase 1 }
if (%miser-ring.increase > 1000) { var %miser-ring.increase 1000 }
inc %attack.damage %miser-ring.increase
unset %accessory.amount
}
; Check for the fool's tablet accessory
if ($accessory.check($1, IncreaseMeleeAddPoison) = true) {
inc %attack.damage $round($calc(%attack.damage * %accessory.amount),0)
unset %accessory.amount
}
}
if ($augment.check($1, MeleeBonus) = true) {
set %melee.bonus.augment $calc(%augment.strength * .20)
var %augment.power.increase.amount $round($calc(%melee.bonus.augment * %attack.damage),0)
inc %attack.damage %augment.power.increase.amount
unset %melee.bonus.augment
}
unset %current.accessory.type
$flying.damage.check($1, $2, $3)
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
$weapon_parry_check($3, $1, $2)
$trickster_dodge_check($3, $1, physical)
$royalguard.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
$wonderguard.check($3, $2, melee)
; Check to see if the melee attack will hurt an ethereal monster
$melee.ethereal.check($1, $2, $3)
unset %statusmessage.display
set %status.type.list $readini($dbfile(weapons.db), $2, StatusType)
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
unset %status.type.list
; Increase attack damage by the $log of the base stat.
inc %attack.damage $round($calc((%attack.damage * %base.stat)/2.5),0)
set %attack.damage $round(%attack.damage,0)
; Now we're ready to calculate the enemy's defense..
set %enemy.defense $readini($char($3), battle, def)
inc %enemy.defense $armor.stat($3, def)
$defense_down_check($3)
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(weapons.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
}
if (%enemy.defense <= 0) { set %enemy.defense 1 }
var %blocked.percent $log(%enemy.defense)
if (%blocked.percent < 0) { var %blocked.percent .5 }
inc %blocked.percent $rand(1,10)
inc %blocked.percent $log($get.level($3))
if ($readini(system.dat, system, PlayersMustDieMode) = true) { inc %blocked.percent $rand(2,5) }
if ($return_playersinbattle > 1) { inc %blocked.percent $calc($return_playersinbattle * 3) }
var %blocked.damage $round($return_percentofvalue(%attack.damage, %blocked.percent),0)
dec %attack.damage %blocked.damage
; Check for modifiers
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, melee)
$damage.color.check
var %flag $readini($char($1), info, flag)
if (enhance-melee isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
; Adjust the damage based on weapon size vs monster size
$monstersize.adjust($3,$2)
; Change damage if there's a level difference
$calculate_attack_leveldiff($1, $3)
; Cap damage, if needed
$cap.damage($1, $3, melee)
; If this current melee attack is using the same weapon as the previous melee attack, nerf the damage
$melee.lastaction.nerfcheck($1, $2)
if (%attack.damage <= 1) {
set %attack.damage $readini($dbfile(weapons.db), $2, BasePower)
set %attack.damage $rand(1, %attack.damage)
}
inc %attack.damage $rand(1,10)
unset %true.base.stat
if (%guard.message = $null) { inc %attack.damage $rand(1,3) }
unset %enemy.defense | unset %level.ratio
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
; Check for the Guardian style
$guardian_style_check($3, $1)
; Check for metal defense. If found, set the damage to 1.
$metal_defense_check($3, $1)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances...
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
; Check for a shield block.
$shield_block_check($3, $1, $2)
; Check for a critical hit.
var %critical.hit.chance $rand(1,100)
; check for the Impetus Passive Skill
var %impetus.check $readini($char($1), skills, Impetus)
if (%impetus.check != $null) { inc %critical.hit.chance %impetus.check }
; If the user is using a h2h weapon, increase the critical hit chance by 1.
if ($readini($dbfile(weapons.db), $2, type) = HandToHand) { inc %critical.hit.chance 1 }
if ($accessory.check($1, IncreaseCriticalHits) = true) {
if (%accessory.amount = 0) { var %accessory.amount 1 }
inc %critical.hit.chance %accessory.amount
unset %accessory.amount
}
unset %player.accessory | unset %accessory.type | unset %accessory.amount
if ($augment.check($1, EnhanceCriticalHits) = true) { inc %critical.hit.chance %augment.strength }
if (%critical.hit.chance >= 97) {
$set_chr_name($1) | $display.message($readini(translation.dat, battle, LandsACriticalHit), battle)
set %attack.damage $round($calc(%attack.damage * 1.5),0)
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if (($readini($dbfile(weapons.db), $2, cost) = 0) && ($readini($dbfile(weapons.db), $2, SpecialWeapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
if ($accessory.check($1, CurseAddDrain) = true) { unset %accessory.amount | set %absorb absorb }
if ($augment.check($1, Drain) = true) { set %absorb absorb }
unset %current.accessory | unset %current.accessory.type
if ($person_in_mech($1) = false) { writeini $char($1) skills mightystrike.on off }
; Is the weapon a multi-hit weapon?
set %weapon.howmany.hits $readini($dbfile(weapons.db), $2, hits)
if ($augment.check($1, AdditionalHit) = true) { inc %weapon.howmany.hits %augment.strength }
; Are we dual-wielding? If so, increase the hits by the # of hits of the second weapon.
if (($readini($char($1), weapons, equippedLeft) != $null) && ($person_in_mech($1) = false)) {
var %left.hits $readini($dbfile(weapons.db), $readini($char($1), weapons, equippedLeft), hits)
if (%left.hits = $null) { var %left.hits 1 }
inc %weapon.howmany.hits %left.hits
}
if ($1 = demon_wall) { $demon.wall.boost($1) }
$first_round_dmg_chk($1, $3)
; check for melee counter
$counter_melee($1, $3, $2)
; Check for countering an attack using a shield
$shield_reflect_melee($1, $3, $2)
; Check for the weapon bash skill
$weapon_bash_check($1, $3)
var %current.element $readini($dbfile(weapons.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
}
unset %target.element.null
}
var %weapon.type $readini($dbfile(weapons.db), $2, type)
if (%weapon.type != $null) {
set %target.weapon.null $readini($char($3), modifiers, %weapon.type)
if (%target.weapon.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToWeaponType)
set %attack.damage 0
}
unset %target.weapon.null
}
; If the target has Protect on, it will cut melee damage in half.
if ($readini($char($3), status, protect) = yes) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
; If we came here via mugger's belt, we need to cut the damage in half.
if ($4 = mugger's-belt) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
if (%counterattack != on) {
; Check for the En-Spell Buff
if ($readini($char($1), status, en-spell) != none) {
$magic.effect.check($1, $3, nothing, en-spell)
$modifer_adjust($3, $readini($char($1), status, en-spell))
}
}
; Turn off the True Strike skill
writeini $char($1) skills truestrike.on off
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; CHECK FOR MULTI-HITS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
set %style.attack.damage %attack.damage
if (%attack.damage = 0) { return }
$multihitcheck.melee($1, $2, $3, $4)
}
formula.meleedmg.player.formula_1.0 {
unset %absorb
set %attack.damage 0
var %random.attack.damage.increase $rand(1,10)
; First things first, let's find out the base power.
var %base.power $readini($dbfile(weapons.db), $2, basepower)
if (%base.power = $null) { var %base.power 1 }
set %base.stat $readini($char($1), battle, str)
inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
var %weapon.base $readini($char($1), weapons, $2)
inc %weapon.base $round($calc(%weapon.base * 1.5),0)
; If the weapon is a hand to hand, it will now receive a bonus based on your fists level.
if (($readini($dbfile(weapons.db), $2, type) = HandToHand) && ($2 != fists)) { inc %weapon.base $readini($char($1), weapons, fists) }
inc %weapon.base %base.power
set %current.accessory $readini($char($3), equipment, accessory)
set %current.accessory.type $readini($dbfile(items.db), %current.accessory, accessorytype)
; Does the user have any mastery of the weapon?
$mastery_check($1, $2)
; If it's a portal battle this might need to be adjusted to make portal battles easier to balance
if (%portal.bonus = true) {
if (%weapon.base > $return_winningstreak) { var %weapon.base $return_winningstreak }
if (%mastery.bonus > $calc($return_winningstreak + 10)) { var %mastery.bonus $calc($return_winningstreak + 10) }
}
; Let's add the mastery bonus to the weapon base
inc %weapon.base %mastery.bonus
; Let's add that to the base power and set it as the attack damage.
inc %base.stat %weapon.base
inc %attack.damage %base.stat
; Let's check for some offensive style enhancements
if ($person_in_mech($1) = false) {
$offensive.style.check($1, $2, melee)
}
;If the element is Light and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if (%weapon.element = light) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
if (%weapon.element = fire) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
}
; Check to see if we have an accessory or augment that enhances the weapon type
$melee.weapontype.enhancements($1)
unset %weapon.type
; Check for Killer Traits
inc %attack.damage $round($calc(%damage.rating * ($killer.trait.check($1, $3) / 100)),0)
; Check for MightyStrike
if ($person_in_mech($1) = false) {
; Check for the skill "MightyStrike"
if ($mighty_strike_check($1) = true) {
; Double the attack.
%attack.damage = $calc(%attack.damage * 2)
}
; Check for the "DesperateBlows" skill.
if ($desperate_blows_check($1) = true) {
var %hp.percent $calc(($readini($char($1), Battle, HP) / $readini($char($1), BaseStats, HP)) *100)
if ((%hp.percent >= 10) && (%hp.percent <= 25)) { %attack.damage = $round($calc(%attack.damage * 1.5),0) }
if ((%hp.percent > 2) && (%hp.percent < 10)) { %attack.damage = $round($calc(%attack.damage * 2),0) }
if ((%hp.percent > 0) && (%hp.percent <= 2)) { %attack.damage = $round($calc(%attack.damage * 2.5),0) }
}
}
; Let's increase the attack by a random amount.
inc %attack.damage %random.attack.damage.increase
unset %current.playerstyle | unset %current.playerstyle.level
if ($person_in_mech($1) = false) {
; Check for the miser ring accessory
if ($accessory.check($1, IncreaseMeleeDamage) = true) {
var %redorb.amount $readini($char($1), stuff, redorbs)
var %miser-ring.increase $round($calc(%redorb.amount * %accessory.amount),0)
if (%miser-ring.increase <= 0) { var %miser-ring.increase 1 }
if (%miser-ring.increase > 1000) { var %miser-ring.increase 1000 }
inc %attack.damage %miser-ring.increase
unset %accessory.amount
}
; Check for the fool's tablet accessory
if ($accessory.check($1, IncreaseMeleeAddPoison) = true) {
inc %attack.damage $round($calc(%attack.damage * %accessory.amount),0)
unset %accessory.amount
}
}
if ($augment.check($1, MeleeBonus) = true) {
set %melee.bonus.augment $calc(%augment.strength * .25)
var %augment.power.increase.amount $round($calc(%melee.bonus.augment * %attack.damage),0)
inc %attack.damage %augment.power.increase.amount
unset %melee.bonus.augment
}
unset %current.accessory.type
$flying.damage.check($1, $2, $3)
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
$weapon_parry_check($3, $1, $2)
$trickster_dodge_check($3, $1, physical)
$royalguard.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
; Check to see if the melee attack will hurt an ethereal monster
$melee.ethereal.check($1, $2, $3)
unset %statusmessage.display
set %status.type.list $readini($dbfile(weapons.db), $2, StatusType)
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
unset %status.type.list
; Now we're ready to calculate the enemy's defense..
set %enemy.defense $readini($char($3), battle, def)
inc %enemy.defense $armor.stat($3, def)
$defense_down_check($3)
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(weapons.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
if (%enemy.defense <= 0) { set %enemy.defense 1 }
}
if (%enemy.defense <= 0) { set %enemy.defense 1 }
; Check for modifiers
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, melee)
$damage.color.check
var %flag $readini($char($1), info, flag)
if (enhance-melee isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
; And let's get the final attack damage..
dec %attack.damage %enemy.defense
unset %enemy.defense
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
; Adjust the damage based on weapon size vs monster size
$monstersize.adjust($3,$2)
; Cap damage, if needed
$cap.damage($1, $3, melee)
; If this current melee attack is using the same weapon as the previous melee attack, nerf the damage
$melee.lastaction.nerfcheck($1, $2)
if (%attack.damage <= 1) {
set %attack.damage $readini($dbfile(weapons.db), $2, BasePower)
set %attack.damage $rand(1, %attack.damage)
}
inc %attack.damage $rand(1,10)
unset %true.base.stat
if (%guard.message = $null) { inc %attack.damage $rand(1,3) }
unset %enemy.defense | unset %level.ratio
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
; Check for the Guardian style
$guardian_style_check($3)
; Check for metal defense. If found, set the damage to 1.
$metal_defense_check($3, $1)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances...
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
; Check for a shield block.
$shield_block_check($3, $1, $2)
; Check for a critical hit.
var %critical.hit.chance $rand(1,100)
; check for the Impetus Passive Skill
var %impetus.check $readini($char($1), skills, Impetus)
if (%impetus.check != $null) { inc %critical.hit.chance %impetus.check }
; If the user is using a h2h weapon, increase the critical hit chance by 1.
if ($readini($dbfile(weapons.db), $2, type) = HandToHand) { inc %critical.hit.chance 1 }
if ($accessory.check($1, IncreaseCriticalHits) = true) {
if (%accessory.amount = 0) { var %accessory.amount 1 }
inc %critical.hit.chance %accessory.amount
unset %accessory.amount
}
unset %player.accessory | unset %accessory.type | unset %accessory.amount
if ($augment.check($1, EnhanceCriticalHits) = true) { inc %critical.hit.chance %augment.strength }
if (%critical.hit.chance >= 97) {
$set_chr_name($1) | $display.message($readini(translation.dat, battle, LandsACriticalHit), battle)
set %attack.damage $round($calc(%attack.damage * 1.5),0)
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if (($readini($dbfile(weapons.db), $2, cost) = 0) && ($readini($dbfile(weapons.db), $2, SpecialWeapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
if ($accessory.check($1, CurseAddDrain) = true) { unset %accessory.amount | set %absorb absorb }
if ($augment.check($1, Drain) = true) { set %absorb absorb }
unset %current.accessory | unset %current.accessory.type
if ($person_in_mech($1) = false) { writeini $char($1) skills mightystrike.on off }
; Is the weapon a multi-hit weapon?
set %weapon.howmany.hits $readini($dbfile(weapons.db), $2, hits)
if ($augment.check($1, AdditionalHit) = true) { inc %weapon.howmany.hits %augment.strength }
; Are we dual-wielding? If so, increase the hits by the # of hits of the second weapon.
if (($readini($char($1), weapons, equippedLeft) != $null) && ($person_in_mech($1) = false)) {
var %left.hits $readini($dbfile(weapons.db), $readini($char($1), weapons, equippedLeft), hits)
if (%left.hits = $null) { var %left.hits 1 }
inc %weapon.howmany.hits %left.hits
}
if ($1 = demon_wall) { $demon.wall.boost($1) }
$first_round_dmg_chk($1, $3)
; check for melee counter
$counter_melee($1, $3, $2)
; Check for countering an attack using a shield
$shield_reflect_melee($1, $3, $2)
; Check for the weapon bash skill
$weapon_bash_check($1, $3)
var %current.element $readini($dbfile(weapons.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
}
unset %target.element.null
}
var %weapon.type $readini($dbfile(weapons.db), $2, type)
if (%weapon.type != $null) {
set %target.weapon.null $readini($char($3), modifiers, %weapon.type)
if (%target.weapon.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToWeaponType)
set %attack.damage 0
}
unset %target.weapon.null
}
; If the target has Protect on, it will cut melee damage in half.
if ($readini($char($3), status, protect) = yes) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
; If we came here via mugger's belt, we need to cut the damage in half.
if ($4 = mugger's-belt) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
if (%counterattack != on) {
; Check for the En-Spell Buff
if ($readini($char($1), status, en-spell) != none) {
$magic.effect.check($1, $3, nothing, en-spell)
$modifer_adjust($3, $readini($char($1), status, en-spell))
}
}
; Turn off the True Strike skill
writeini $char($1) skills truestrike.on off
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
if (%attack.damage = 0) { return }
; Check for multiple hits
$multihitcheck.melee($1, $2, $3, $4)
}
formula.meleedmg.player.formula_2.5 {
; $1 = %user
; $2 = weapon equipped
; $3 = target / %enemy
; $4 = a special flag for mugger's belt.
unset %absorb
set %attack.damage 0
var %random.attack.damage.increase $rand(1,10)
var %base.weapon.power $readini($dbfile(weapons.db), $2, basepower)
if (%base.weapon.power = $null) { var %base.weapon.power 1 }
var %base.stat $readini($char($1), battle, str)
inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
if (%battle.type = torment) { var %attack.rating %base.stat }
if (%battle.type != torment) {
var %attack.rating $round($calc(%base.stat / 2),0)
if (%attack.rating >= 1000) {
var %base.stat.cap .10
if ($get.level($1) > $get.level($3)) { inc %base.stat.cap .10 }
if ($get.level($3) > $get.level($1)) { dec %base.stat.cap .02 }
set %base.stat $round($calc(1000 + (%attack.rating * %base.stat.cap)),0)
}
}
set %true.base.stat %attack.rating
var %weapon.base $readini($char($1), weapons, $2)
; inc %weapon.base $round($calc(%weapon.base * 1.5),0)
; If the weapon is a hand to hand, it will now receive a bonus based on your fists level.
if ($readini($dbfile(weapons.db), $2, type) = HandToHand) { inc %weapon.base $readini($char($1), weapons, fists) }
inc %weapon.base %base.weapon.power
; Does the user have any mastery of the weapon?
$mastery_check($1, $2)
; If it's a portal battle this might need to be adjusted to make portal battles easier to balance
if (%portal.bonus = true) {
if (%weapon.base > $return_winningstreak) { var %weapon.base $return_winningstreak }
if (%mastery.bonus > $calc($return_winningstreak + 10)) { var %mastery.bonus $calc($return_winningstreak + 10) }
}
; Let's add the mastery bonus to the weapon base
inc %weapon.base %mastery.bonus
; Let's add that to the base power and set it as the attack damage.
inc %attack.damage %weapon.base
inc %attack.damage %base.stat
if ($person_in_mech($1) = false) {
; Let's check for some offensive style enhancements
$offensive.style.check($1, $2, melee)
}
;If the element is Light and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if (%weapon.element = light) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
if (%weapon.element = fire) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
}
; Check to see if we have an accessory or augment that enhances the weapon type
$melee.weapontype.enhancements($1)
unset %weapon.type
; Check for Killer Traits
inc %attack.damage $round($calc(%damage.rating * ($killer.trait.check($1, $3) / 100)),0)
if ($person_in_mech($1) = false) {
; Check for the skill "MightyStrike"
if ($mighty_strike_check($1) = true) {
; Double the attack.
%attack.damage = $calc(%attack.damage * 2)
}
; Check for the "DesperateBlows" skill.
if ($desperate_blows_check($1) = true) {
var %hp.percent $calc(($readini($char($1), Battle, HP) / $readini($char($1), BaseStats, HP)) *100)
if ((%hp.percent >= 10) && (%hp.percent <= 25)) { %attack.damage = $round($calc(%attack.damage * 1.5),0) }
if ((%hp.percent > 2) && (%hp.percent < 10)) { %attack.damage = $round($calc(%attack.damage * 2),0) }
if ((%hp.percent > 0) && (%hp.percent <= 2)) { %attack.damage = $round($calc(%attack.damage * 2.5),0) }
}
}
; Let's increase the attack by a random amount.
inc %attack.damage %random.attack.damage.increase
unset %current.playerstyle | unset %current.playerstyle.level
if ($person_in_mech($1) = false) {
; Check for the miser ring accessory
if ($accessory.check($1, IncreaseMeleeDamage) = true) {
var %redorb.amount $readini($char($1), stuff, redorbs)
var %miser-ring.increase $round($calc(%redorb.amount * %accessory.amount),0)
if (%miser-ring.increase <= 0) { var %miser-ring.increase 1 }
if (%miser-ring.increase > 1000) { var %miser-ring.increase 1000 }
inc %attack.damage %miser-ring.increase
unset %accessory.amount
}
; Check for the fool's tablet accessory
if ($accessory.check($1, IncreaseMeleeAddPoison) = true) {
inc %attack.damage $round($calc(%attack.damage * %accessory.amount),0)
unset %accessory.amount
}
}
if ($augment.check($1, MeleeBonus) = true) {
set %melee.bonus.augment $calc(%augment.strength * .25)
var %augment.power.increase.amount $round($calc(%melee.bonus.augment * %attack.damage),0)
inc %attack.damage %augment.power.increase.amount
unset %melee.bonus.augment
}
unset %current.accessory.type
$flying.damage.check($1, $2, $3)
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
$weapon_parry_check($3, $1, $2)
$trickster_dodge_check($3, $1, physical)
$royalguard.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
; Check to see if the melee attack will hurt an ethereal monster
$melee.ethereal.check($1, $2, $3)
; Check for WonderGuard
$wonderguard.check($3, $2, melee)
unset %statusmessage.display
set %status.type.list $readini($dbfile(weapons.db), $2, StatusType)
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
unset %status.type.list
var %weapon.element $readini($dbfile(weapons.db), $2, element)
if ((%weapon.element != $null) && (%weapon.element != none)) {
$modifer_adjust($3, %weapon.element)
}
; Check for weapon type weaknesses.
set %weapon.type $readini($dbfile(weapons.db), $2, type)
$modifer_adjust($3, %weapon.type)
; Elementals are strong to melee
if ($readini($char($3), monster, type) = elemental) { %attack.damage = $round($calc(%attack.damage - (%attack.damage * .30)),0) }
; Now we're ready to calculate the enemy's defense..
set %enemy.defense $readini($char($3), battle, def)
inc %enemy.defense $armor.stat($3, def)
$defense_down_check($3)
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(weapons.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
}
if (%enemy.defense <= 0) { set %enemy.defense 1 }
var %flag $readini($char($1), info, flag)
; Set the level ratio
if (%battle.type != torment) {
if (%flag = monster) {
set %temp.strength %base.stat
if (%temp.strength > 800) { set %temp.strength $calc(700 + (%temp.strength / 40))
set %temp.strength $round(%temp.strength,0)
set %level.ratio $calc(%temp.strength / %enemy.defense)
}
if (%temp.strength <= 800) { set %level.ratio $calc(%temp.strength / %enemy.defense) }
}
if ((%flag = $null) || (%flag = npc)) {
set %temp.strength %base.stat
if (%temp.strength > 6000) { set %temp.strength $calc(6000 + (%temp.strength / 3))
set %temp.strength $round(%temp.strength,0)
set %level.ratio $calc(%temp.strength / %enemy.defense)
unset %temp.strength
}
if (%temp.strength <= 6000) { set %level.ratio $calc(%temp.strength / %enemy.defense) }
}
}
; Calculate the Level Ratio
set %level.ratio $calc(($readini($char($1), battle, str) + $armor.stat($1, str)) / %enemy.defense)
var %attacker.level $get.level($1)
var %defender.level $get.level($3)
if (%attacker.level > %defender.level) { inc %level.ratio .3 }
if (%attacker.level < %defender.level) { dec %level.ratio .3 }
if (%level.ratio > 2) { set %level.ratio 2 }
if (%level.ratio <= .02) { set %level.ratio .02 }
unset %temp.strength
; And let's get the final attack damage..
%attack.damage = $round($calc(%attack.damage * %level.ratio),0)
if (enhance-melee isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
; Adjust the damage based on weapon size vs monster size
$monstersize.adjust($3,$2)
; Change damage if there's a level difference
$calculate_attack_leveldiff($1, $3)
; Cap damage, if needed
$cap.damage($1, $3, melee)
; If this current melee attack is using the same weapon as the previous melee attack, nerf the damage
$melee.lastaction.nerfcheck($1, $2)
if (%attack.damage <= 1) {
set %attack.damage $readini($dbfile(weapons.db), $2, BasePower)
set %attack.damage $rand(1, %attack.damage)
}
inc %attack.damage $rand(1,10)
unset %true.base.stat
if (%guard.message = $null) { inc %attack.damage $rand(1,3) }
unset %enemy.defense | unset %level.ratio
; If this current melee attack is using the same weapon as the previous melee attack, nerf the damage
$melee.lastaction.nerfcheck($1, $2)
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
; Check for the Guardian style
$guardian_style_check($3)
; Check for metal defense. If found, set the damage to 1.
$metal_defense_check($3, $1)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances...
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
; Check for a shield block.
$shield_block_check($3, $1, $2)
; Check for a critical hit.
var %critical.hit.chance $rand(1,100)
; check for the Impetus Passive Skill
var %impetus.check $readini($char($1), skills, Impetus)
if (%impetus.check != $null) { inc %critical.hit.chance %impetus.check }
; If the user is using a h2h weapon, increase the critical hit chance by 1.
if ($readini($dbfile(weapons.db), $2, type) = HandToHand) { inc %critical.hit.chance 1 }
if ($accessory.check($1, IncreaseCriticalHits) = true) {
if (%accessory.amount = 0) { var %accessory.amount 1 }
inc %critical.hit.chance %accessory.amount
unset %accessory.amount
}
unset %player.accessory | unset %accessory.type | unset %accessory.amount
if ($augment.check($1, EnhanceCriticalHits) = true) { inc %critical.hit.chance %augment.strength }
if (%critical.hit.chance >= 97) {
$set_chr_name($1) | $display.message($readini(translation.dat, battle, LandsACriticalHit), battle)
set %attack.damage $round($calc(%attack.damage * 1.5),0)
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if (($readini($dbfile(weapons.db), $2, cost) = 0) && ($readini($dbfile(weapons.db), $2, SpecialWeapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
if ($accessory.check($1, CurseAddDrain) = true) { unset %accessory.amount | set %absorb absorb }
if ($augment.check($1, Drain) = true) { set %absorb absorb }
unset %current.accessory | unset %current.accessory.type
if ($person_in_mech($1) = false) { writeini $char($1) skills mightystrike.on off }
; Is the weapon a multi-hit weapon?
set %weapon.howmany.hits $readini($dbfile(weapons.db), $2, hits)
if ($augment.check($1, AdditionalHit) = true) { inc %weapon.howmany.hits %augment.strength }
; Are we dual-wielding? If so, increase the hits by the # of hits of the second weapon.
if (($readini($char($1), weapons, equippedLeft) != $null) && ($person_in_mech($1) = false)) {
var %left.hits $readini($dbfile(weapons.db), $readini($char($1), weapons, equippedLeft), hits)
if (%left.hits = $null) { var %left.hits 1 }
inc %weapon.howmany.hits %left.hits
}
if ($barrage_check($1, $2) = true) { inc %weapon.howmany.hits 3 | writeini $char($1) skills barrage.on off }
if ($1 = demon_wall) { $demon.wall.boost($1) }
$first_round_dmg_chk($1, $3)
; check for melee counter
$counter_melee($1, $3, $2)
; Check for countering an attack using a shield
$shield_reflect_melee($1, $3, $2)
; Check for the weapon bash skill
$weapon_bash_check($1, $3)
var %current.element $readini($dbfile(weapons.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
}
unset %target.element.null
}
var %weapon.type $readini($dbfile(weapons.db), $2, type)
if (%weapon.type != $null) {
set %target.weapon.null $readini($char($3), modifiers, %weapon.type)
if (%target.weapon.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToWeaponType)
set %attack.damage 0
}
unset %target.weapon.null
}
; If the target has Protect on, it will cut melee damage in half.
if ($readini($char($3), status, protect) = yes) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
; If we came here via mugger's belt, we need to cut the damage in half.
if ($4 = mugger's-belt) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
if (%counterattack != on) {
; Check for the En-Spell Buff
if ($readini($char($1), status, en-spell) != none) {
$magic.effect.check($1, $3, nothing, en-spell)
$modifer_adjust($3, $readini($char($1), status, en-spell))
}
}
; Turn off the True Strike skill
writeini $char($1) skills truestrike.on off
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
if (%attack.damage = 0) { return }
; Check for multiple hits
$multihitcheck.melee($1, $2, $3, $4)
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Calculates melee damage
; for monsters and bosses
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
formula.meleedmg.monster {
; $1 = %user
; $2 = weapon equipped
; $3 = target / %enemy
; $4 = a special flag for mugger's belt.
unset %absorb
set %attack.damage 0
var %random.attack.damage.increase $rand(1,10)
var %base.weapon.power $readini($dbfile(weapons.db), $2, basepower)
if (%base.weapon.power = $null) { var %base.weapon.power 1 }
var %base.stat $readini($char($1), battle, str)
inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
set %true.base.stat %base.stat
var %attack.rating $round($calc(%base.stat / 2),0)
if (%attack.rating >= 500) {
var %base.stat.cap .10
if ($get.level($1) > $get.level($3)) { inc %base.stat.cap .10 }
if ($get.level($3) > $get.level($1)) { dec %base.stat.cap .02 }
set %base.stat $round($calc(500 + (%attack.rating * %base.stat.cap)),0)
var %attack.rating %base.stat
}
var %weapon.base $readini($char($1), weapons, $2)
inc %weapon.base $round($calc(%weapon.base * 1.5),0)
; If the weapon is a hand to hand, it will now receive a bonus based on your fists level.
if (($readini($dbfile(weapons.db), $2, type) = HandToHand) && ($2 != fists)) { inc %weapon.base $readini($char($1), weapons, fists) }
inc %weapon.base %base.weapon.power
; Does the user have any mastery of the weapon?
$mastery_check($1, $2)
; Let's add the mastery bonus to the weapon base
inc %weapon.base %mastery.bonus
; Let's add that to the base power and set it as the attack damage.
inc %attack.damage %weapon.base
inc %attack.damage %base.stat
if ($person_in_mech($1) = false) {
; Let's check for some offensive style enhancements
$offensive.style.check($1, $2, melee)
}
;If the element is Light and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if (%weapon.element = light) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
if (%weapon.element = fire) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
}
; Check to see if we have an accessory or augment that enhances the weapon type
$melee.weapontype.enhancements($1)
unset %weapon.type
; Check for Killer Traits
inc %attack.damage $round($calc(%damage.rating * ($killer.trait.check($1, $3) / 100)),0)
; Check for MightyStrike
if ($person_in_mech($1) = false) {
; Check for the skill "MightyStrike"
if ($mighty_strike_check($1) = true) {
; Double the attack.
%attack.damage = $calc(%attack.damage * 2)
}
; Check for the "DesperateBlows" skill.
if ($desperate_blows_check($1) = true) {
var %hp.percent $calc(($readini($char($1), Battle, HP) / $readini($char($1), BaseStats, HP)) *100)
if ((%hp.percent >= 10) && (%hp.percent <= 25)) { %attack.damage = $round($calc(%attack.damage * 1.5),0) }
if ((%hp.percent > 2) && (%hp.percent < 10)) { %attack.damage = $round($calc(%attack.damage * 2),0) }
if ((%hp.percent > 0) && (%hp.percent <= 2)) { %attack.damage = $round($calc(%attack.damage * 2.5),0) }
}
}
; Let's increase the attack by a random amount.
inc %attack.damage %random.attack.damage.increase
unset %current.playerstyle | unset %current.playerstyle.level
if ($person_in_mech($1) = false) {
; Check for the miser ring accessory
if ($accessory.check($1, IncreaseMeleeDamage) = true) {
var %redorb.amount $readini($char($1), stuff, redorbs)
var %miser-ring.increase $round($calc(%redorb.amount * %accessory.amount),0)
if (%miser-ring.increase <= 0) { var %miser-ring.increase 1 }
if (%miser-ring.increase > 1000) { var %miser-ring.increase 1000 }
inc %attack.damage %miser-ring.increase
unset %accessory.amount
}
; Check for the fool's tablet accessory
if ($accessory.check($1, IncreaseMeleeAddPoison) = true) {
inc %attack.damage $round($calc(%attack.damage * %accessory.amount),0)
unset %accessory.amount
}
}
if ($augment.check($1, MeleeBonus) = true) {
set %melee.bonus.augment $calc(%augment.strength * .25)
var %augment.power.increase.amount $round($calc(%melee.bonus.augment * %attack.damage),0)
inc %attack.damage %augment.power.increase.amount
unset %melee.bonus.augment
}
unset %current.accessory.type
$flying.damage.check($1, $2, $3)
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
$weapon_parry_check($3, $1, $2)
$trickster_dodge_check($3, $1, physical)
$royalguard.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
; Check to see if the melee attack will hurt an ethereal monster
$melee.ethereal.check($1, $2, $3)
unset %statusmessage.display
set %status.type.list $readini($dbfile(weapons.db), $2, StatusType)
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
unset %status.type.list
; Check for portal damage boost
if (%portal.bonus = true) {
var %percent.damage.amount 5
if ($return_playersinbattle > 1) { inc %percent.damage.amount 5 }
if ($eliteflag.check($1) = true) { inc %percent.damage.amount 5 }
if ($supereliteflag.check($1) = true) { inc %percent.damage.amount 10 }
var %percent.damage $return_percentofvalue($readini($char($3), basestats, hp), %percent.damage.amount)
inc %attack.damage $round(%percent.damage,0)
}
; Now we're ready to calculate the enemy's defense..
set %enemy.defense $current.def($3)
inc %enemy.defense $armor.stat($3, def)
$defense_down_check($3)
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(weapons.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%battle.type = torment) { inc %ignore.defense.percent $calc(%torment.level * 5) }
if (%battle.type = cosmic) { inc %ignore.defense.percent $calc(%cosmic.level * 5) }
if ($readini(system.dat, system, PlayersMustDieMode) = true) { inc %ignore.defense.percent 10 }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
}
if (%enemy.defense <= 0) { set %enemy.defense 1 }
var %flag $readini($char($1), info, flag)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; CALCULATE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
%attack.def.ratio = $calc(%true.base.stat / %enemy.defense)
%attack.damage = $round($calc(%attack.damage * %attack.def.ratio),0)
if ($mighty_strike_check($1) = true) { inc %attack.damage %attack.damage }
unset %attack.def.ratio
$calculate_attack_leveldiff($1, $3)
if (enhance-melee isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
; Adjust the damage based on weapon size vs monster size
$monstersize.adjust($3,$2)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$cap.damage($1, $3, melee)
if ((%flag = $null) || (%flag = npc)) {
if (%attack.damage <= 1) {
var %base.weapon $readini($dbfile(weapons.db), $2, BasePower)
var %str.increase.amount $round($calc(%true.base.stat * .10),0)
inc %base.weapon %str.increase.amount
var %min.damage %base.weapon
set %attack.damage $readini($dbfile(weapons.db), $2, BasePower)
var %attacker.level $get.level($1)
var %defender.level $get.level($3)
var %level.difference $calc(%defender.level - %attacker.level)
if (%level.difference >= 300) {
set %attack.damage 1
if (%flag = $null) { set %min.damage $round($calc(%min.damage / 8),0) }
else { set %min.damage $round($calc(%min.damage / 2),0) }
}
set %attack.damage $rand(%min.damage, %attack.damage)
}
inc %attack.damage $rand(1,10)
}
if ((%flag = monster) && ($readini($char($3), info, flag) = $null)) {
var %min.damage $readini($dbfile(weapons.db), $2, BasePower)
inc %min.damage %attack.rating
var %level.difference $calc($get.level($1) / $get.level($3))
var %min.damage $round($calc(%min.damage * %level.difference),0)
if (%battle.type = torment) { var %level.difference 2 }
if (%min.damage > 500) { var %min.damage 500 }
if (%min.damage < 1) { var %min.damage 1 }
if (%attack.damage <= 10) {
set %attack.damage $readini($dbfile(weapons.db), $2, BasePower)
if ($calc($get.level($3) - $get.level($1)) >= -300) {
set %attack.damage 1
set %min.damage $round($calc(%min.damage / 1.5),0)
if (%min.damage < 1) { var %min.damage 1 }
}
}
if (%battle.rage.darkness = on) { var %min.damage %attack.damage }
if (%battle.rage.darkness != on) {
if (%battle.type != torment) {
if ((%attack.damage >= 1) && ($get.level($1) <= $get.level($3))) {
var %level.difference $calc($get.level($1) - $get.level($3))
if (%level.difference <= 0) && (%level.difference >= -500) { var %min.damage $round($calc(%min.damage / 2),0) }
if (%level.difference < -500) { var %min.damage $round($calc(%min.damage / 10),0) }
}
if ((%attack.damage >= 1) && ($get.level($1) <= $get.level($3))) {
var %damage.ratio.adjust $calc($get.level($1) / $get.level($3))
if (%damage.ratio < .10) { var %damage.ratio .10 }
if (%damage.ratio > 120) { var %damage.ratio 120 }
set %attack.damage $round($calc(%attack.damage * %damage.ratio.adjust),0)
var %min.damage $round($calc(%min.damage * %damage.ratio.adjust),0)
var %level.difference $calc($get.level($1) - $get.level($3))
if (%level.difference >= 0) && (%level.difference <= 500) { inc %min.damage $round($calc(%min.damage * .20),0) }
if (%level.difference > 500) { inc %min.damage $round($calc(%min.damage * .50),0) }
}
}
}
if (%battle.type = boss) {
var %percent.damage.amount $rand(1,2)
var %percent.damage $return_percentofvalue($readini($char($3), basestats, hp), %percent.damage.amount)
inc %attack.damage %percent.damage
inc %min.damage %percent.damage
}
if (%battle.type = dungeon) {
if ($dungeon.bossroomcheck = true) { var %percent.damage.amount 5 }
else { var %percent.damage.amount 3 }
var %percent.damage $return_percentofvalue($readini($char($3), basestats, hp), %percent.damage.amount)
inc %attack.damage %percent.damage
inc %min.damage %percent.damage
}
if (%battle.type = torment) {
var %percent.damage.amount 2.5
if ($return_playersinbattle > 1) { inc %percent.damage.amount 2 }
var %percent.damage $return_percentofvalue($readini($char($3), basestats, hp), $calc(%percent.damage.amount * %torment.level))
if (%min.damage < %percent.damage) { var %min.damage %percent.damage }
inc %attack.damage $calc(%attack.damage * %torment.level)
set %attack.damage $rand(%min.damage, %attack.damage)
if (%attack.damage > $readini($char($3), basestats, hp)) { set %attack.damage $round($calc($readini($char($3), basestats, hp) / 3),0) }
}
if (%battle.type = cosmic) {
var %percent.damage.amount 2.5
if ($return_playersinbattle > 1) { inc %percent.damage.amount 2 }
var %percent.damage $return_percentofvalue($readini($char($3), basestats, hp), $calc(%percent.damage.amount * %cosmic.level))
if (%min.damage < %percent.damage) { var %min.damage %percent.damage }
inc %attack.damage $calc(%attack.damage * %cosmic.level)
set %attack.damage $rand(%min.damage, %attack.damage)
if (%attack.damage > $readini($char($3), basestats, hp)) { set %attack.damage $round($calc($readini($char($3), basestats, hp) / 3),0) }
}
set %attack.damage $rand(%attack.damage, %min.damage)
if ($readini(battlestats.dat, battle, winningstreak) <= 0) { %attack.damage = $round($calc(%attack.damage / 2),0) }
}
unset %true.base.stat
if (%guard.message = $null) { inc %attack.damage $rand(1,3) }
unset %enemy.defense | unset %level.ratio
; if we're in a portal or dungeon then decrease damage by armor protection
if ((%portal.bonus = true) || (%battle.type = dungeon)) { set %attack.damage $round($calc(%attack.damage - (%attack.damage * ($armor.protection($3) / 100))),0) }
; set starting damage and check for modifiers
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, tech)
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
$damage.color.check
; Check for the Guardian style
$guardian_style_check($3)
; Check for metal defense. If found, set the damage to 1.
$metal_defense_check($3, $1)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances...
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
; Check for a shield block.
$shield_block_check($3, $1, $2)
; Check for a critical hit.
var %critical.hit.chance $rand(1,100)
; check for the Impetus Passive Skill
var %impetus.check $readini($char($1), skills, Impetus)
if (%impetus.check != $null) { inc %critical.hit.chance %impetus.check }
; If the user is using a h2h weapon, increase the critical hit chance by 1.
if ($readini($dbfile(weapons.db), $2, type) = HandToHand) { inc %critical.hit.chance 1 }
if ($accessory.check($1, IncreaseCriticalHits) = true) {
if (%accessory.amount = 0) { var %accessory.amount 1 }
inc %critical.hit.chance %accessory.amount
unset %accessory.amount
}
unset %player.accessory | unset %accessory.type | unset %accessory.amount
if ($augment.check($1, EnhanceCriticalHits) = true) { inc %critical.hit.chance %augment.strength }
if (%critical.hit.chance >= 97) {
$set_chr_name($1) | $display.message($readini(translation.dat, battle, LandsACriticalHit), battle)
set %attack.damage $round($calc(%attack.damage * 1.5),0)
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if (($readini($dbfile(weapons.db), $2, cost) = 0) && ($readini($dbfile(weapons.db), $2, SpecialWeapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
if ($accessory.check($1, CurseAddDrain) = true) { unset %accessory.amount | set %absorb absorb }
if ($augment.check($1, Drain) = true) { set %absorb absorb }
unset %current.accessory | unset %current.accessory.type
if ($person_in_mech($1) = false) { writeini $char($1) skills mightystrike.on off }
; Is the weapon a multi-hit weapon?
set %weapon.howmany.hits $readini($dbfile(weapons.db), $2, hits)
if ($augment.check($1, AdditionalHit) = true) { inc %weapon.howmany.hits %augment.strength }
; Are we dual-wielding? If so, increase the hits by the # of hits of the second weapon.
if (($readini($char($1), weapons, equippedLeft) != $null) && ($person_in_mech($1) = false)) {
var %left.hits $readini($dbfile(weapons.db), $readini($char($1), weapons, equippedLeft), hits)
if (%left.hits = $null) { var %left.hits 1 }
inc %weapon.howmany.hits %left.hits
}
if ($1 = demon_wall) { $demon.wall.boost($1) }
$first_round_dmg_chk($1, $3)
; check for melee counter
$counter_melee($1, $3, $2)
; Check for countering an attack using a shield
$shield_reflect_melee($1, $3, $2)
; Check for the weapon bash skill
$weapon_bash_check($1, $3)
var %current.element $readini($dbfile(weapons.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
}
unset %target.element.null
}
var %weapon.type $readini($dbfile(weapons.db), $2, type)
if (%weapon.type != $null) {
set %target.weapon.null $readini($char($3), modifiers, %weapon.type)
if (%target.weapon.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToWeaponType)
set %attack.damage 0
}
unset %target.weapon.null
}
; If the target has Protect on, it will cut melee damage in half.
if ($readini($char($3), status, protect) = yes) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
; If we came here via mugger's belt, we need to cut the damage in half.
if ($4 = mugger's-belt) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
if (%counterattack != on) {
; Check for the En-Spell Buff
if ($readini($char($1), status, en-spell) != none) {
$magic.effect.check($1, $3, nothing, en-spell)
$modifer_adjust($3, $readini($char($1), status, en-spell))
}
}
; Turn off the True Strike skill
writeini $char($1) skills truestrike.on off
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
if (%battle.rage.darkness = on) {
if ($readini($char($1), info, flag) = monster) { inc %attack.damage $calc(%attack.damage * 500) }
}
set %style.attack.damage %attack.damage
if (%attack.damage = 0) { return }
; Check for multiple hits
$multihitcheck.melee($1, $2, $3, $4)
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Calculates tech damage
; for monsters and bosses
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
formula.techdmg.monster {
; $1 = user
; $2 = technique used
; $3 = target
; $4 = optional flag ("heal")
if (%attack.damage = $null) { set %attack.damage 0 }
; How many hits is this technique?
set %tech.howmany.hits $readini($dbfile(techniques.db), $2, hits)
; Let's find out the base power.
set %base.stat.needed $readini($dbfile(techniques.db), $2, stat)
if (%base.stat.needed = $null) { set %base.stat.needed int }
set %base.stat $readini($char($1), battle, %base.stat.needed)
if (%base.stat.needed = str) { inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
}
if (%base.stat.needed = def) { inc %base.stat $armor.stat($1, def) }
if (%base.stat.needed = int) { inc %base.stat $armor.stat($1, int)
if ($skill.bloodspirit.status($1) = on) { inc %base.stat $skill.bloodspirit.calculate($1) }
$int_down_check($1)
}
if (%base.stat.needed = spd) {
inc %base.stat.needed $armor.stat($1, spd)
if ($skill.speed.status($1) = on) { inc %base.stat $skill.speed.calculate($1) }
}
set %true.base.stat %base.stat
var %tech.base $readini($dbfile(techniques.db), p, $2, BasePower)
var %base.damage.percent %tech.base
if (%base.damage.percent >= 50) { var %base.damage.percent 50 }
var %attack.rating $return_percentofvalue($readini($char($3), basestats, hp), %base.damage.percent)
if (%tech.howmany.hits > 1) { var %attack.rating $round($calc(%attack.rating / 1.5),0) }
var %user.tech.level $readini($char($1), Techniques, $2)
if (%user.tech.level = $null) { var %user.tech.level 1 }
set %ignition.name $readini($char($1), status, ignition.name)
set %ignition.techs $readini($dbfile(ignitions.db), %ignition.name, techs)
if ($istok(%ignition.techs,$2,46) = $true) { var %user.tech.level 50 }
unset %ignition.name | unset %ignition.techs
if (%user.tech.level < 100) { inc %tech.base $round($calc(%user.tech.level * 1.8),0) }
; Let's add in the base power of the weapon used..
if ($person_in_mech($1) = false) { set %weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { set %weapon.used $readini($char($1), mech, equippedWeapon) }
set %base.power.wpn $readini($dbfile(weapons.db), %weapon.used, basepower)
if (%base.power.wpn = $null) { var %base.power.wpn 1 }
var %weapon.base $readini($char($1), weapons, %weapon.used)
if (%weapon.base = $null) { set %weapon.base 1 }
inc %base.power.wpn %weapon.base
; Does the user have a mastery in the weapon? We can add a bonus as well.
$mastery_check($1, %weapon.used)
unset %weapon.used
inc %base.power.wpn %mastery.bonus
set %attack.damage $calc(%tech.base + %user.tech.level + %base.power.wpn)
if ($person_in_mech($1) = false) {
; Let's check for some offensive style enhancements
$offensive.style.check($1, $2, tech)
}
; Let's increase the attack by a random amount.
inc %attack.damage $rand(1,15)
; Is the tech magic? If so, we need to add some more stuff to it.
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$calculate_damage_magic($1, $2, $3)
if ($readini($char($3), info, ImmuneToMagic) = true) { $set_chr_name($3) | set %guard.message $readini(translation.dat, battle, ImmuneToMagic) }
}
; Check for TechBonus augment for non-magic techs
if ($readini($dbfile(techniques.db), $2, magic) != yes) {
if ($augment.check($1, TechBonus) = true) {
set %tech.bonus.augment $calc(%augment.strength * .20)
var %augment.power.increase.amount $round($calc(%tech.bonus.augment * %attack.damage),0)
inc %attack.damage %augment.power.increase.amount
unset %tech.bonus.augment
}
}
;If the element is Light/fire and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if ($istok(light.fire,$readini($dbfile(techniques.db), $2, element),46) = $true) { inc %attack.damage $round($calc(%attack.damage * .110),0)
}
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if ($person_in_mech($1) = false) { set %current.weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { set %current.weapon.used $readini($char($1), mech, EquippedWeapon) }
if (($readini($dbfile(weapons.db), %current.weapon.used, cost) = 0) && ($readini($dbfile(weapons.db), %current.weapon.used, specialweapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
unset %current.weapon.used | unset %base.power.wpn
var %tech.type $readini($dbfile(techniques.db), $2, type)
if ((%tech.type = heal-aoe) || (%tech.type = heal)) { return }
; Now we're ready to calculate the enemy's defense.
if ($readini($dbfile(techniques.db), $2, stat) = str) {
set %enemy.defense $current.def($3)
inc %enemy.defense $armor.stat($3, def)
if ($readini($char($3), status, defdown) = yes) { var %enemy.defense $round($calc(%enemy.defense / 4),0) }
}
else {
set %enemy.defense $current.int($3)
inc %enemy.defense $armor.stat($3, int)
if ($skill.bloodspirit.status($3) = on) { inc %enemy.defense $round($calc($skill.bloodspirit.calculate($3) /3.5),0) }
if ($readini($char($3), status, intdown) = yes) { var %enemy.defense $round($calc(%enemy.defense / 4),0) }
}
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(techniques.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
}
if (%enemy.defense <= 0) { set %enemy.defense 1 }
; Check for portal damage boost
if (%portal.bonus = true) {
var %percent.damage.amount 10
if ($return_playersinbattle > 1) { inc %percent.damage.amount 5 }
if ($eliteflag.check($1) = true) { inc %percent.damage.amount 5 }
if ($supereliteflag.check($1) = true) { inc %percent.damage.amount 10 }
var %percent.damage $return_percentofvalue($readini($char($3), basestats, hp), %percent.damage.amount)
inc %attack.damage $round(%percent.damage,0)
}
; Calculate the attack damage based on log of base stat / log of enemy's defense
set %attack.damage $round($calc(($log(%base.stat) / $log(%enemy.defense)) * %attack.damage),0)
if ($readini($char($3), info, ai_type) = counteronly) { set %attack.damage 0 | return }
if (enhance-tech isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var %flag $readini($char($1), info, flag)
$calculate_attack_leveldiff($1, $3)
var %min.damage %attack.rating
var %level.difference $calc($get.level($1) / $get.level($3))
var %min.damage $round($calc(%min.damage * %level.difference),0)
set %attack.damage $round($calc(%attack.damage * %level.difference),0)
if (%attack.damage <= 1) {
var %minimum.damage 1
set %attack.damage $readini($dbfile(techniques.db), $2, BasePower)
set %attack.damage $rand(1, %attack.damage)
}
unset %true.base.stat
inc %attack.damage $rand(1,5)
unset %true.base.stat
if (%battle.type = dungeon) {
if ($dungeon.bossroomcheck = true) { var %percent.damage.amount 5 }
else { var %percent.damage.amount 3 }
var %percent.damage $return_percentofvalue($readini($char($3), basestats, hp), %percent.damage.amount)
inc %attack.damage %percent.damage
inc %min.damage %percent.damage
}
if (%battle.type = boss) {
var %percent.damage.amount $rand(1,2)
var %percent.damage $return_percentofvalue($readini($char($3), basestats, hp), %percent.damage.amount)
inc %attack.damage %percent.damage
inc %min.damage %percent.damage
}
if (%battle.type = torment) {
var %percent.damage.amount 5
if ($return_playersinbattle > 1) { inc %percent.damage.amount 2 }
var %percent.damage $return_percentofvalue($readini($char($3), basestats, hp), $calc(%percent.damage.amount * %torment.level))
if (%min.damage < %percent.damage) { var %min.damage %percent.damage }
inc %attack.damage $calc(%attack.damage * %torment.level)
set %attack.damage $rand(%min.damage, %attack.damage)
if (%attack.damage > $readini($char($3), basestats, hp)) { set %attack.damage $round($calc($readini($char($3), basestats, hp) / 3),0) }
}
if (%battle.type = cosmic) {
var %percent.damage.amount 5
if ($return_playersinbattle > 1) { inc %percent.damage.amount 2 }
var %percent.damage $return_percentofvalue($readini($char($3), basestats, hp), $calc(%percent.damage.amount * %cosmic.level))
if (%min.damage < %percent.damage) { var %min.damage %percent.damage }
inc %attack.damage $calc(%attack.damage * %cosmic.level)
set %attack.damage $rand(%min.damage, %attack.damage)
if (%attack.damage > $readini($char($3), basestats, hp)) { set %attack.damage $round($calc($readini($char($3), basestats, hp) / 3),0) }
}
set %attack.damage $rand(%attack.damage, %min.damage)
if ($return_winningstreak <= 0) { %attack.damage = $round($calc(%attack.damage / 2),0) }
unset %min.damage
$cap.damage($1, $3, tech)
; if we're in a portal or dungeon then decrease damage by armor protection
if ((%portal.bonus = true) || (%battle.type = dungeon)) { set %attack.damage $round($calc(%attack.damage - (%attack.damage * ($armor.protection($3) / 100))),0) }
; set starting damage and check for modifiers
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, tech)
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
$damage.color.check
; Check for the Guardian style
$guardian_style_check($3)
; To be fair to players, we'll limit the damage if it has the ability to ignore guardian.
if ($augment.check($1, IgnoreGuardian) = true) {
var %user.flag $readini($char($1), info, flag)
if ((%user.flag = monster) && (%battle.rage.darkness != on)) {
if ($readini($char($3), info, flag) = $null) {
if (%attack.damage > 2500) { set %attack.damage 2000 }
}
}
}
; AOE nerf check for players
if (($readini($char($1), info, flag) = $null) || ($readini($char($1), info, clone) = yes)) {
if (%aoe.turn > 1) {
var %aoe.nerf.percent $calc(8 * %aoe.turn)
if ($readini($dbfile(techniques.db), $2, hits) > 1) { inc %aoe.nerf.percent 10 }
if (%aoe.nerf.percent > 93) { var %aoe.nerf.percent 93 }
var %aoe.nerf.percent $calc(%aoe.nerf.percent / 100)
var %aoe.nerf.amount $round($calc(%attack.damage * %aoe.nerf.percent),0)
dec %attack.damage %aoe.nerf.amount
}
}
; Check for the Metal Defense flag
$metal_defense_check($3)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances..
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
unset %base.stat | unset %current.accessory.type | unset %base.stat.needed
if ($readini($dbfile(techniques.db), $2, magic) != yes) { $flying.damage.check($1, %weapon.used, $3) }
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
if ($readini($dbfile(techniques.db), $2, canDodge) != false) { $trickster_dodge_check($3, $1, tech) }
$manawall.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
$tech.ethereal.check($1, $2, $3)
; Check for wonderguard
$wonderguard.check($3, $2, tech, $readini($char($1), weapons, equipped))
unset %statusmessage.display
set %status.type.list $readini($dbfile(techniques.db), $2, StatusType)
$first_round_dmg_chk($1, $3)
var %current.element $readini($dbfile(techniques.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
; This is mostly just for gremlins but might be useful for other things down the road.
$readini($char($3), modifier_special, %current.element)
}
unset %target.element.null
}
set %target.tech.null $readini($char($3), modifiers, $2)
if (%target.tech.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToTechName)
set %attack.damage 0
}
unset %target.element.null
if ((%guard.message = $null) && (%attack.damage > 0)) {
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list, $2) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect, $2)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
}
unset %status.type.list
if (%guard.message = $null) {
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$magic.effect.check($1, $3, $2)
}
}
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
; Check to see if SwiftCast is on and if this tech is a spell.
$swiftcast_check($1, $2)
; Check for a shield block.
$shield_block_check($3, $1, $2)
; If the target has Shell on, it will cut magic damage in half.
if (($readini($char($3), status, shell) = yes) && ($readini($dbfile(techniques.db), $2, magic) = yes)) { %attack.damage = $round($calc(%attack.damage / 2),0) }
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3, $4)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
; Check for multiple hits now
$multihitcheck.tech($1, $2, $3, $4)
; Check to see if we need to increase the proficiency of a technique.
$tech.points($1, $2)
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Calculates tech damage
; for players and npcs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
formula.techdmg.player.formula_2.0 {
; $1 = user
; $2 = technique used
; $3 = target
; $4 = optional flag ("heal")
if (%attack.damage = $null) { set %attack.damage 0 }
; First things first, let's find out the base power.
set %base.stat.needed $readini($dbfile(techniques.db), $2, stat)
if (%base.stat.needed = $null) { set %base.stat.needed int }
set %base.stat $readini($char($1), battle, %base.stat.needed)
if (%base.stat.needed = str) { inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
}
if (%base.stat.needed = def) { inc %base.stat $armor.stat($1, def) }
if (%base.stat.needed = int) { inc %base.stat $armor.stat($1, int)
if ($skill.bloodspirit.status($1) = on) { inc %base.stat $skill.bloodspirit.calculate($1) }
$int_down_check($1)
}
if (%base.stat.needed = spd) {
inc %base.stat $armor.stat($1, spd)
if ($skill.speed.status($1) = on) { inc %base.stat $skill.speed.calculate($1) }
}
set %true.base.stat %base.stat
if (%base.stat > 999) {
if ($readini($char($1), info, flag) = $null) { set %base.stat $round($calc(999 + %base.stat / 10),0) }
if ($readini($char($1), info, flag) != $null) { set %base.stat $round($calc(999 + %base.stat / 5),0) }
}
var %tech.base $readini($dbfile(techniques.db), p, $2, BasePower)
var %user.tech.level $readini($char($1), Techniques, $2)
inc %tech.base $round($calc(%user.tech.level * 1.6),0)
set %ignition.name $readini($char($1), status, ignition.name)
set %ignition.techs $readini($dbfile(ignitions.db), %ignition.name, techs)
if ($istok(%ignition.techs,$2,46) = $true) { var %user.tech.level 50 }
unset %ignition.name | unset %ignition.techs
; Let's add in the base power of the weapon used..
set %weapon.used $readini($char($1), weapons, equipped)
set %base.power.wpn $readini($dbfile(weapons.db), %weapon.used, basepower)
if (%base.power.wpn = $null) { var %base.power 1 }
set %weapon.base $readini($char($1), weapons, %weapon.used)
unset %weapon.used
; Does the user have a mastery in the weapon? We can add a bonus as well.
$mastery_check($1, $readini($char($1),weapons,equipped))
; If it's a portal battle this might need to be adjusted to make portal battles easier to balance
if (%portal.bonus = true) {
if (%weapon.base > $return_winningstreak) { var %weapon.base $return_winningstreak }
if (%tech.base > $return_winningstreak) { var %tech.base $return_winningstreak }
if (%mastery.bonus > $calc($return_winningstreak + 10)) { var %mastery.bonus $calc($return_winningstreak + 10) }
}
inc %base.power.wpn $round($calc(%weapon.base * 1.5),0)
inc %base.power.wpn $round($calc(%mastery.bonus / 1.5),0)
inc %tech.base %base.power.wpn
inc %tech.base %user.tech.level
inc %base.stat %tech.base
inc %attack.damage %base.stat
if ($person_in_mech($1) = false) {
; Let's check for some offensive style enhancements
$offensive.style.check($1, $2, tech)
}
; Is the tech magic? If so, we need to add some more stuff to it.
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$calculate_damage_magic($1, $2, $3)
if ($readini($char($3), info, ImmuneToMagic) = true) { $set_chr_name($3) | set %guard.message $readini(translation.dat, battle, ImmuneToMagic) }
}
; Check for TechBonus augment for non-magic techs
if ($readini($dbfile(techniques.db), $2, magic) != yes) {
if ($augment.check($1, TechBonus) = true) {
set %tech.bonus.augment $calc(%augment.strength * .25)
var %augment.power.increase.amount $round($calc(%tech.bonus.augment * %attack.damage),0)
inc %attack.damage %augment.power.increase.amount
unset %tech.bonus.augment
}
}
; Let's increase the attack by a random amount.
inc %attack.damage $rand(1,10)
;If the element is Light/fire and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if ($istok(light.fire,$readini($dbfile(techniques.db), $2, element),46) = $true) { inc %attack.damage $round($calc(%attack.damage * .110),0)
}
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if ($person_in_mech($1) = false) { set %current.weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { set %current.weapon.used $readini($char($1), mech, EquippedWeapon) }
if (($readini($dbfile(weapons.db), %current.weapon.used, cost) = 0) && ($readini($dbfile(weapons.db), %current.weapon.used, specialweapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
unset %current.weapon.used | unset %base.power.wpn
var %tech.type $readini($dbfile(techniques.db), $2, type)
if ((%tech.type = heal-aoe) || (%tech.type = heal)) { return }
; Now we're ready to calculate the enemy's defense.
set %enemy.defense $current.def($3)
inc %enemy.defense $armor.stat($3, def)
; Because it's a tech, the enemy's int will play a small part too.
var %int.bonus $round($calc(($readini($char($3), battle, int) + $armor.stat($3, int)) / 3.5),0)
if ($skill.bloodspirit.status($3) = on) { inc %int.bonus $round($calc($skill.bloodspirit.calculate($3) /3.5),0) }
if ($readini($char($3), status, intdown) = yes) { var %int.bonus $round($calc(%int.bonus / 4),0) }
inc %enemy.defense %int.bonus
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(techniques.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
}
if ($readini($char($3), info, ai_type) = counteronly) { set %attack.damage 0 | return }
if (enhance-tech isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$calculate_pDIF($1, $3, magic)
set %attack.damage $round($calc(%attack.damage / 3.2),0)
}
else {
$calculate_pDIF($1, $3, tech)
set %attack.damage $round($calc(%attack.damage / 1.75),0)
}
%attack.damage = $round($calc(%attack.damage * %pDIF),0)
unset %pdif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var %flag $readini($char($1), info, flag)
if ((%flag = $null) || (%flag = npc)) {
if ($readini(system.dat, system, IgnoreDmgCap) != true) {
if (%attack.damage > 40000) {
set %temp.damage $round($calc(%attack.damage / 75),0)
set %attack.damage $calc(40000 + %temp.damage)
unset %temp.damage
if (%attack.damage >= 60000) { set %attack.damage $rand(57000,60000) }
}
}
if (%attack.damage <= 1) {
var %max.damage $round($calc(%true.base.stat / 10),0)
set %attack.damage $rand(1, %max.damage)
}
}
if ((%attack.damage > 2500) && (%flag = monster)) {
if ($readini(system.dat, system, IgnoreDmgCap) != true) {
if (%battle.rage.darkness != on) { set %attack.damage $rand(1000,2100) }
}
}
inc %attack.damage $rand(1,5)
unset %true.base.stat
; set starting damage and check for modifiers
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, tech)
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
$damage.color.check
; Check for the Guardian style
$guardian_style_check($3)
; To be fair to players, we'll limit the damage if it has the ability to ignore guardian.
if ($augment.check($1, IgnoreGuardian) = true) {
var %user.flag $readini($char($1), info, flag)
if ((%user.flag = monster) && (%battle.rage.darkness != on)) {
if ($readini($char($3), info, flag) = $null) {
if (%attack.damage > 2500) { set %attack.damage 2000 }
}
}
}
; If this current tech is using the same tech as the previous tech attack, nerf the damage
if (($4 != aoe) && ($2 = $readini($txtfile(battle2.txt), style, $1 $+ .lastaction))) { set %attack.damage $round($calc(%attack.damage / 3),0) }
if (($4 = aoe) && (%lastaction.nerf = true)) { set %attack.damage $round($calc(%attack.damage / 3),0) }
; AOE nerf check for players
if (($readini($char($1), info, flag) = $null) || ($readini($char($1), info, clone) = yes)) {
if (%aoe.turn > 1) {
var %aoe.nerf.percent $calc(8 * %aoe.turn)
if ($readini($dbfile(techniques.db), $2, hits) > 1) { inc %aoe.nerf.percent 12 }
if (%aoe.nerf.percent > 93) { var %aoe.nerf.percent 93 }
var %aoe.nerf.percent $calc(%aoe.nerf.percent / 100)
var %aoe.nerf.amount $round($calc(%attack.damage * %aoe.nerf.percent),0)
dec %attack.damage %aoe.nerf.amount
}
}
; Check for the Metal Defense flag
$metal_defense_check($3)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances..
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
unset %base.stat | unset %current.accessory.type | unset %base.stat.needed
if ($readini($dbfile(techniques.db), $2, magic) != yes) { $flying.damage.check($1, %weapon.used, $3) }
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
if ($readini($dbfile(techniques.db), $2, canDodge) != false) { $trickster_dodge_check($3, $1, tech) }
$manawall.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
$tech.ethereal.check($1, $2, $3)
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
unset %statusmessage.display
set %status.type.list $readini($dbfile(techniques.db), $2, StatusType)
; Is the tech a multi-hit weapon?
set %tech.howmany.hits $readini($dbfile(techniques.db), $2, hits)
$first_round_dmg_chk($1, $3)
var %current.element $readini($dbfile(techniques.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
; This is mostly just for gremlins but might be useful for other things down the road.
$readini($char($3), modifier_special, %current.element)
}
unset %target.element.null
}
set %target.tech.null $readini($char($3), modifiers, $2)
if (%target.tech.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToTechName)
set %attack.damage 0
}
unset %target.element.null
if ((%guard.message = $null) && (%attack.damage > 0)) {
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list, $2) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect, $2)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
}
unset %status.type.list
if (%guard.message = $null) {
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$magic.effect.check($1, $3, $2)
}
}
; Check for a shield block.
$shield_block_check($3, $1, $2)
; If the target has Shell on, it will cut magic damage in half.
if (($readini($char($3), status, shell) = yes) && ($readini($dbfile(techniques.db), $2, magic) = yes)) { %attack.damage = $round($calc(%attack.damage / 2),0) }
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3, $4)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
; Check for multiple hits
$multihitcheck.tech($1, $2, $3, $4)
; Check to see if we need to increase the proficiency of a technique.
$tech.points($1, $2)
}
formula.techdmg.player.formula_2.5 {
; $1 = user
; $2 = technique used
; $3 = target
; $4 = optional flag ("heal")
if (%attack.damage = $null) { set %attack.damage 0 }
; First things first, let's find out the base power.
set %base.stat.needed $readini($dbfile(techniques.db), $2, stat)
if (%base.stat.needed = $null) { set %base.stat.needed int }
set %base.stat $readini($char($1), battle, %base.stat.needed)
if (%base.stat.needed = str) { inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
}
if (%base.stat.needed = def) { inc %base.stat $armor.stat($1, def) }
if (%base.stat.needed = int) { inc %base.stat $armor.stat($1, int)
if ($skill.bloodspirit.status($1) = on) { inc %base.stat $skill.bloodspirit.calculate($1) }
$int_down_check($1)
}
if (%base.stat.needed = spd) {
inc %base.stat $armor.stat($1, spd)
if ($skill.speed.status($1) = on) { inc %base.stat $skill.speed.calculate($1) }
}
set %true.base.stat %base.stat
if (%battle.type != torment) {
var %attack.rating $round($calc(%base.stat / 2),0)
if (%attack.rating >= 1000) {
var %base.stat.cap .15
if ($get.level($1) > $get.level($3)) { inc %base.stat.cap .10 }
if ($get.level($3) > $get.level($1)) { dec %base.stat.cap .02 }
set %base.stat $round($calc(1000 + (%attack.rating * %base.stat.cap)),0)
}
}
if (%battle.type = torment) { var %attack.rating %base.stat }
var %tech.base $readini($dbfile(techniques.db), p, $2, BasePower)
var %user.tech.level $readini($char($1), Techniques, $2)
if (%user.tech.level = $null) { var %user.tech.level 1 }
set %ignition.name $readini($char($1), status, ignition.name)
set %ignition.techs $readini($dbfile(ignitions.db), %ignition.name, techs)
if ($istok(%ignition.techs,$2,46) = $true) { var %user.tech.level 50 }
unset %ignition.name | unset %ignition.techs
inc %tech.base $round($calc(%user.tech.level * 1.6),0)
; Let's add in the base power of the weapon used..
if ($person_in_mech($1) = false) { set %weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { set %weapon.used $readini($char($1), mech, equippedWeapon) }
set %base.power.wpn $readini($dbfile(weapons.db), %weapon.used, basepower)
if (%base.power.wpn = $null) { var %base.power 1 }
set %weapon.base $readini($char($1), weapons, %weapon.used)
if (%weapon.base = $null) { set %weapon.base 1 }
inc %base.power.wpn $round($calc(%weapon.base * 1.5),0)
; Does the user have a mastery in the weapon? We can add a bonus as well.
$mastery_check($1, %weapon.used)
; If it's a portal battle this might need to be adjusted to make portal battles easier to balance
if (%portal.bonus = true) {
if (%weapon.base > $return_winningstreak) { var %weapon.base $return_winningstreak }
if (%mastery.bonus > $calc($return_winningstreak + 10)) { var %mastery.bonus $calc($return_winningstreak + 10) }
}
unset %weapon.used
inc %base.power.wpn $round($calc(%mastery.bonus / 1.5),0)
inc %tech.base %base.power.wpn
inc %tech.base %user.tech.level
inc %base.stat %tech.base
inc %attack.damage %base.stat
if ($person_in_mech($1) = false) {
; Let's check for some offensive style enhancements
$offensive.style.check($1, $2, tech)
}
if ($augment.check($1, TechBonus) = true) {
set %tech.bonus.augment $calc(%augment.strength * .25)
var %augment.power.increase.amount $round($calc(%tech.bonus.augment * %attack.damage),0)
inc %attack.damage %augment.power.increase.amount
unset %tech.bonus.augment
}
; Let's increase the attack by a random amount.
inc %attack.damage $rand(1,10)
; Is the tech magic? If so, we need to add some more stuff to it.
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$calculate_damage_magic($1, $2, $3)
if ($readini($char($3), info, ImmuneToMagic) = true) { $set_chr_name($3) | set %guard.message $readini(translation.dat, battle, ImmuneToMagic) }
}
;If the element is Light/fire and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if ($istok(light.fire,$readini($dbfile(techniques.db), $2, element),46) = $true) { inc %attack.damage $round($calc(%attack.damage * .110),0)
}
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if ($person_in_mech($1) = false) { set %current.weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { set %current.weapon.used $readini($char($1), mech, EquippedWeapon) }
if (($readini($dbfile(weapons.db), %current.weapon.used, cost) = 0) && ($readini($dbfile(weapons.db), %current.weapon.used, specialweapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
unset %current.weapon.used | unset %base.power.wpn
var %tech.type $readini($dbfile(techniques.db), $2, type)
if ((%tech.type = heal-aoe) || (%tech.type = heal)) { return }
; Now we're ready to calculate the enemy's defense.
set %enemy.defense $current.def($3)
inc %enemy.defense $armor.stat($3, def)
; Because it's a tech, the enemy's int will play a small part too.
var %int.bonus $round($calc(($readini($char($3), battle, int) + $armor.stat($3, int)) / 3.5),0)
if ($skill.bloodspirit.status($3) = on) { inc %int.bonus $round($calc($skill.bloodspirit.calculate($3) /3.5),0) }
if ($readini($char($3), status, intdown) = yes) { var %int.bonus $round($calc(%int.bonus / 4),0) }
inc %enemy.defense %int.bonus
$defense_down_check($3)
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(techniques.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
}
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, tech)
$damage.color.check
if (%enemy.defense <= 0) { set %enemy.defense 1 }
if ($readini($char($3), info, ai_type) = counteronly) { set %attack.damage 0 | return }
%attack.def.ratio = $calc(%base.stat / %enemy.defense)
%attack.damage = $round($calc(%attack.damage * %attack.def.ratio),0)
unset %attack.def.ratio
if (enhance-tech isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
$calculate_attack_leveldiff($1, $3)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var %flag $readini($char($1), info, flag)
$cap.damage($1, $3, melee)
if (%attack.damage <= 1) {
var %base.tech $readini($dbfile(techniques.db), $2, BasePower)
var %int.increase.amount $round($calc(%true.base.stat * .10),0)
inc %base.weapon %int.increase.amount
var %min.damage %base.weapon
set %attack.damage $readini($dbfile(techniques.db), $2, BasePower)
var %attacker.level $get.level($1)
var %defender.level $get.level($3)
if (%attacker.level < %defender.level) {
set %attack.damage 1
if (%flag = $null) { set %min.damage $round($calc(%min.damage / 8),0) }
else { set %min.damage $round($calc(%min.damage / 2),0) }
}
set %attack.damage $rand(%min.damage, %attack.damage)
set %attack.damage $rand(%attack.damage, %min.damage)
unset %min.damage
}
unset %true.base.stat
inc %attack.damage $rand(1,5)
unset %true.base.stat
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
; Check for the Guardian style
$guardian_style_check($3)
; To be fair to players, we'll limit the damage if it has the ability to ignore guardian.
if ($augment.check($1, IgnoreGuardian) = true) {
var %user.flag $readini($char($1), info, flag)
if ((%user.flag = monster) && (%battle.rage.darkness != on)) {
if ($readini($char($3), info, flag) = $null) {
if (%attack.damage > 2500) { set %attack.damage 2000 }
}
}
}
; If this current tech is using the same tech as the previous tech attack, nerf the damage
if (($4 != aoe) && ($2 = $readini($txtfile(battle2.txt), style, $1 $+ .lastaction))) { set %attack.damage $round($calc(%attack.damage / 3),0) }
if (($4 = aoe) && (%lastaction.nerf = true)) { set %attack.damage $round($calc(%attack.damage / 3),0) }
; AOE nerf check for players
if (($readini($char($1), info, flag) = $null) || ($readini($char($1), info, clone) = yes)) {
if (%aoe.turn > 1) {
if (%battle.type = torment) { var %aoe.nerf.percent $calc(3 * %aoe.turn) }
else { var %aoe.nerf.percent $calc(7 * %aoe.turn) }
if ($readini($dbfile(techniques.db), $2, hits) > 1) { inc %aoe.nerf.percent 12 }
if (%aoe.nerf.percent > 93) { var %aoe.nerf.percent 93 }
var %aoe.nerf.percent $calc(%aoe.nerf.percent / 100)
var %aoe.nerf.amount $round($calc(%attack.damage * %aoe.nerf.percent),0)
dec %attack.damage %aoe.nerf.amount
}
}
; Check for the Metal Defense flag
$metal_defense_check($3)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances..
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
unset %base.stat | unset %current.accessory.type | unset %base.stat.needed
if ($readini($dbfile(techniques.db), $2, magic) != yes) { $flying.damage.check($1, %weapon.used, $3) }
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
if ($readini($dbfile(techniques.db), $2, canDodge) != false) { $trickster_dodge_check($3, $1, tech) }
$manawall.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
$tech.ethereal.check($1, $2, $3)
$wonderguard.check($3, $2, tech, $readini($char($1), weapons, equipped))
unset %statusmessage.display
set %status.type.list $readini($dbfile(techniques.db), $2, StatusType)
; Is the tech a multi-hit weapon?
set %tech.howmany.hits $readini($dbfile(techniques.db), $2, hits)
$first_round_dmg_chk($1, $3)
var %current.element $readini($dbfile(techniques.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
; This is mostly just for gremlins but might be useful for other things down the road.
$readini($char($3), modifier_special, %current.element)
}
unset %target.element.null
}
set %target.tech.null $readini($char($3), modifiers, $2)
if (%target.tech.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToTechName)
set %attack.damage 0
}
unset %target.element.null
if ((%guard.message = $null) && (%attack.damage > 0)) {
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list, $2) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect, $2)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
}
unset %status.type.list
if (%guard.message = $null) {
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$magic.effect.check($1, $3, $2)
}
}
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
; Check for a shield block.
$shield_block_check($3, $1, $2)
; If the target has Shell on, it will cut magic damage in half.
if (($readini($char($3), status, shell) = yes) && ($readini($dbfile(techniques.db), $2, magic) = yes)) { %attack.damage = $round($calc(%attack.damage / 2),0) }
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3, $4)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
; Check for multiple hits
$multihitcheck.tech($1, $2, $3, $4)
; Check to see if we need to increase the proficiency of a technique.
$tech.points($1, $2)
}
formula.techdmg.player.formula_1.0 {
set %attack.damage 0
; First things first, let's find out the base power.
set %base.stat.needed $readini($dbfile(techniques.db), $2, stat)
if (%base.stat.needed = $null) { set %base.stat.needed int }
set %base.stat $readini($char($1), battle, %base.stat.needed)
if (%base.stat.needed = str) { inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
}
if (%base.stat.needed = def) { inc %base.stat $armor.stat($1, def) }
if (%base.stat.needed = int) { inc %base.stat $armor.stat($1, int)
if ($skill.bloodspirit.status($1) = on) { inc %base.stat $skill.bloodspirit.calculate($1) }
$int_down_check($1)
}
if (%base.stat.needed = spd) {
inc %base.stat $armor.stat($1, spd)
if ($skill.speed.status($1) = on) { inc %base.stat $skill.speed.calculate($1) }
}
var %tech.base $readini($dbfile(techniques.db), $2, BasePower)
var %user.tech.level $readini($char($1), Techniques, $2)
inc %tech.base $round($calc(%user.tech.level * 1.5),0)
; Let's add in the base power of the weapon used..
set %weapon.used $readini($char($1), weapons, equipped)
set %base.power.wpn $readini($dbfile(weapons.db), %weapon.used, basepower)
if (%base.power.wpn = $null) { var %base.power 1 }
set %weapon.base $readini($char($1), weapons, %weapon.used)
inc %base.power.wpn $round($calc(%weapon.base * 1.9),0)
unset %weapon.used
; Does the user have a mastery in the weapon? We can add a bonus as well.
$mastery_check($1, $readini($char($1),weapons,equipped))
; If it's a portal battle this might need to be adjusted to make portal battles easier to balance
if (%portal.bonus = true) {
if (%weapon.base > $return_winningstreak) { var %weapon.base $return_winningstreak }
if (%tech.base > $return_winningstreak) { var %tech.base $return_winningstreak }
if (%mastery.bonus > $calc($return_winningstreak + 10)) { var %mastery.bonus $calc($return_winningstreak + 10) }
}
inc %base.power.wpn $round($calc(%mastery.bonus / 1.5),0)
if ($person_in_mech($1) = false) {
; Let's check for some offensive style enhancements
$offensive.style.check($1, $2, tech)
}
inc %tech.base %base.power.wpn
set %current.accessory $readini($char($3), equipment, accessory)
set %current.accessory.type $readini($dbfile(items.db), %current.accessory, accessorytype)
inc %tech.base %user.tech.level
inc %base.stat %tech.base
inc %attack.damage %base.stat
; Let's increase the attack by a random amount.
inc %attack.damage $rand(1,10)
; Is the tech magic? If so, we need to add some more stuff to it.
if ($readini($dbfile(techniques.db), $2, magic) = yes) { $calculate_damage_magic($1, $2, $3) }
;If the element is Light/fire and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if (%tech.element = light) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
if (%tech.element = fire) { inc %attack.damage $round($calc(%attack.damage * .110),0) }
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
set %current.weapon.used $readini($char($1), weapons, equipped)
if ($readini($dbfile(weapons.db), %current.weapon.used, cost) = 0) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
unset %current.weapon.used | unset %base.power.wpn
var %tech.type $readini($dbfile(techniques.db), $2, type)
if ((%tech.type = heal-aoe) || (%tech.type = heal)) { return }
; Now we're ready to calculate the enemy's defense.
set %enemy.defense $current.def($3)
inc %enemy.defense $armor.stat($3, def)
; Because it's a tech, the enemy's int will play a small part too.
var %int.bonus $round($calc(($readini($char($3), battle, int) + $armor.stat($3, int)) / 3.5),0)
if ($skill.bloodspirit.status($3) = on) { inc %int.bonus $round($calc($skill.bloodspirit.calculate($3) /3.5),0) }
if ($readini($char($3), status, intdown) = yes) { var %int.bonus $round($calc(%int.bonus / 4),0) }
inc %enemy.defense %int.bonus
$defense_down_check($3)
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(techniques.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
}
; And let's get the final attack damage..
dec %attack.damage %enemy.defense
; If the tech is a spell let's boost or nerf it depending on style used
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
if ($return.playerstyle($1) != spellmaster) { dec %attack.damage $return_percentofvalue(%attack.damage, 40) }
else { inc %attack.damage $return_percentofvalue(%attack.damage, $readini($char($1), styles, spellmaster)) }
}
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, tech)
$damage.color.check
; if the tech is the same as what was used in the last round, nerf the damage
if ($2 = $readini($txtfile(battle2.txt), style, $1 $+ .lastaction)) { set %attack.damage $round($calc(%attack.damage / 3),0) }
; AOE nerf check for players
if (($readini($char($1), info, flag) = $null) || ($readini($char($1), info, clone) = yes)) {
if (%aoe.turn > 1) {
var %aoe.nerf.percent $calc(8 * %aoe.turn)
if ($readini($dbfile(techniques.db), $2, hits) > 1) { inc %aoe.nerf.percent 5 }
if (%aoe.nerf.percent > 93) { var %aoe.nerf.percent 93 }
var %aoe.nerf.percent $calc(%aoe.nerf.percent / 100)
var %aoe.nerf.amount $round($calc(%attack.damage * %aoe.nerf.percent),0)
dec %attack.damage %aoe.nerf.amount
}
}
; Check for the Metal Defense flag
$metal_defense_check($3)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances..
if (%attack.damage <= 0) { set %attack.damage 1 }
if ($readini($char($3), info, ai_type) = counteronly) { set %attack.damage 0 | return }
if (enhance-tech isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
unset %base.stat | unset %current.accessory.type | unset %base.stat.needed
if ($readini($dbfile(techniques.db), $2, magic) != yes) { $flying.damage.check($1, %weapon.used, $3) }
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
if ($readini($dbfile(techniques.db), $2, canDodge) != false) { $trickster_dodge_check($3, $1, tech) }
$manawall.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
$tech.ethereal.check($1, $2, $3)
; Check for wonderguard
$wonderguard.check($3, $2, tech, $readini($char($1), weapons, equipped))
unset %statusmessage.display
set %status.type.list $readini($dbfile(techniques.db), $2, StatusType)
; Is the tech a multi-hit weapon?
set %tech.howmany.hits $readini($dbfile(techniques.db), $2, hits)
$first_round_dmg_chk($1, $3)
var %current.element $readini($dbfile(techniques.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
; This is mostly just for gremlins but might be useful for other things down the road.
$readini($char($3), modifier_special, %current.element)
}
unset %target.element.null
}
set %target.tech.null $readini($char($3), modifiers, $2)
if (%target.tech.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToTechName)
set %attack.damage 0
}
unset %target.element.null
if ((%guard.message = $null) && (%attack.damage > 0)) {
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list, $2) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect, $2)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
}
unset %status.type.list
if (%guard.message = $null) {
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$magic.effect.check($1, $3, $2)
}
}
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
; Check for a shield block.
$shield_block_check($3, $1, $2)
; If the target has Shell on, it will cut magic damage in half.
if (($readini($char($3), status, shell) = yes) && ($readini($dbfile(techniques.db), $2, magic) = yes)) { %attack.damage = $round($calc(%attack.damage / 2),0) }
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3, $4)
; Check to see if SwiftCast is on and if this tech is a spell.
$swiftcast_check($1, $2)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
; Check for multiple hits
$multihitcheck.tech($1, $2, $3, $4)
; Check to see if we need to increase the proficiency of a technique.
$tech.points($1, $2)
}
formula.techdmg.player.formula_3.1 {
; $1 = user
; $2 = technique used
; $3 = target
; $4 = optional flag ("heal")
if (%attack.damage = $null) { set %attack.damage 0 }
; First things first, let's find out the base power.
set %base.stat.needed $readini($dbfile(techniques.db), $2, stat)
if (%base.stat.needed = $null) { set %base.stat.needed int }
set %base.stat $readini($char($1), battle, %base.stat.needed)
if (%base.stat.needed = str) { inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
}
if (%base.stat.needed = def) { inc %base.stat $armor.stat($1, def) }
if (%base.stat.needed = int) { inc %base.stat $armor.stat($1, int)
if ($skill.bloodspirit.status($1) = on) { inc %base.stat $skill.bloodspirit.calculate($1) }
$int_down_check($1)
}
if (%base.stat.needed = spd) {
inc %base.stat $armor.stat($1, spd)
if ($skill.speed.status($1) = on) { inc %base.stat $skill.speed.calculate($1) }
}
set %true.base.stat %base.stat
var %tech.base $readini($dbfile(techniques.db), p, $2, BasePower)
var %user.tech.level $readini($char($1), Techniques, $2)
if (%user.tech.level = $null) { var %user.tech.level 1 }
set %ignition.name $readini($char($1), status, ignition.name)
set %ignition.techs $readini($dbfile(ignitions.db), %ignition.name, techs)
if ($istok(%ignition.techs,$2,46) = $true) { var %user.tech.level 50 }
unset %ignition.name | unset %ignition.techs
if (%user.tech.level < 100) { inc %tech.base $round($calc(%user.tech.level * 1.8),0) }
; Let's add in the base power of the weapon used..
if ($person_in_mech($1) = false) { set %weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { set %weapon.used $readini($char($1), mech, equippedWeapon) }
set %base.power.wpn $readini($dbfile(weapons.db), %weapon.used, basepower)
if (%base.power.wpn = $null) { var %base.power.wpn 1 }
var %weapon.base $readini($char($1), weapons, %weapon.used)
if (%weapon.base = $null) { set %weapon.base 1 }
inc %base.power.wpn %weapon.base
; Does the user have a mastery in the weapon? We can add a bonus as well.
$mastery_check($1, %weapon.used)
unset %weapon.used
inc %base.power.wpn %mastery.bonus
set %attack.damage $calc(%tech.base + %user.tech.level + %base.power.wpn)
if ($person_in_mech($1) = false) {
; Let's check for some offensive style enhancements
$offensive.style.check($1, $2, tech)
}
; Let's increase the attack by a random amount.
inc %attack.damage $rand(1,15)
; Is the tech magic? If so, we need to add some more stuff to it.
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$calculate_damage_magic($1, $2, $3)
if ($readini($char($3), info, ImmuneToMagic) = true) { $set_chr_name($3) | set %guard.message $readini(translation.dat, battle, ImmuneToMagic) }
}
; Check for TechBonus augment for non-magic techs
if ($readini($dbfile(techniques.db), $2, magic) != yes) {
if ($augment.check($1, TechBonus) = true) {
set %tech.bonus.augment $calc(%augment.strength * .25)
var %augment.power.increase.amount $round($calc(%tech.bonus.augment * %attack.damage),0)
inc %attack.damage %augment.power.increase.amount
unset %tech.bonus.augment
}
}
;If the element is Light/fire and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if ($istok(light.fire,$readini($dbfile(techniques.db), $2, element),46) = $true) { inc %attack.damage $round($calc(%attack.damage * .110),0)
}
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if ($person_in_mech($1) = false) { set %current.weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { set %current.weapon.used $readini($char($1), mech, EquippedWeapon) }
if (($readini($dbfile(weapons.db), %current.weapon.used, cost) = 0) && ($readini($dbfile(weapons.db), %current.weapon.used, specialweapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
unset %current.weapon.used | unset %base.power.wpn
var %tech.type $readini($dbfile(techniques.db), $2, type)
if ((%tech.type = heal-aoe) || (%tech.type = heal)) { return }
; Now we're ready to calculate the enemy's defense.
if ($readini($dbfile(techniques.db), $2, stat) = str) {
set %enemy.defense $current.def($3)
inc %enemy.defense $armor.stat($3, def)
if ($readini($char($3), status, defdown) = yes) { var %enemy.defense $round($calc(%enemy.defense / 4),0) }
}
else {
set %enemy.defense $current.int($3)
inc %enemy.defense $armor.stat($3, int)
if ($skill.bloodspirit.status($3) = on) { inc %enemy.defense $round($calc($skill.bloodspirit.calculate($3) /3.5),0) }
if ($readini($char($3), status, intdown) = yes) { var %enemy.defense $round($calc(%enemy.defense / 4),0) }
}
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(techniques.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
}
if (%enemy.defense <= 0) { set %enemy.defense 1 }
; Calculate the attack damage based on log of base stat / log of enemy's defense
set %attack.damage $round($calc(($log(%base.stat) / $log(%enemy.defense)) * %attack.damage),0)
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, tech)
$damage.color.check
if ($readini($char($3), info, ai_type) = counteronly) { set %attack.damage 0 | return }
if (enhance-tech isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var %flag $readini($char($1), info, flag)
$cap.damage($1, $3, tech)
if (%attack.damage <= 1) {
var %minimum.damage 1
set %attack.damage $readini($dbfile(techniques.db), $2, BasePower)
set %attack.damage $rand(1, %attack.damage)
}
unset %true.base.stat
inc %attack.damage $rand(1,5)
unset %true.base.stat
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
; Check for the Guardian style
$guardian_style_check($3)
; To be fair to players, we'll limit the damage if it has the ability to ignore guardian.
if ($augment.check($1, IgnoreGuardian) = true) {
var %user.flag $readini($char($1), info, flag)
if ((%user.flag = monster) && (%battle.rage.darkness != on)) {
if ($readini($char($3), info, flag) = $null) {
if (%attack.damage > 2500) { set %attack.damage 2000 }
}
}
}
; If this current tech is using the same tech as the previous tech attack, nerf the damage
if (($4 != aoe) && ($2 = $readini($txtfile(battle2.txt), style, $1 $+ .lastaction))) { set %attack.damage $round($calc(%attack.damage / 3),0) }
if (($4 = aoe) && (%lastaction.nerf = true)) { set %attack.damage $round($calc(%attack.damage / 3),0) }
; AOE nerf check for players
if (($readini($char($1), info, flag) = $null) || ($readini($char($1), info, clone) = yes)) {
if (%aoe.turn > 1) {
var %aoe.nerf.percent $calc(8 * %aoe.turn)
if ($readini($dbfile(techniques.db), $2, hits) > 1) { inc %aoe.nerf.percent 10 }
if (%aoe.nerf.percent > 93) { var %aoe.nerf.percent 93 }
var %aoe.nerf.percent $calc(%aoe.nerf.percent / 100)
var %aoe.nerf.amount $round($calc(%attack.damage * %aoe.nerf.percent),0)
dec %attack.damage %aoe.nerf.amount
}
}
; Check for the Metal Defense flag
$metal_defense_check($3)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances..
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
unset %base.stat | unset %current.accessory.type | unset %base.stat.needed
if ($readini($dbfile(techniques.db), $2, magic) != yes) { $flying.damage.check($1, %weapon.used, $3) }
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
if ($readini($dbfile(techniques.db), $2, canDodge) != false) { $trickster_dodge_check($3, $1, tech) }
$manawall.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
$tech.ethereal.check($1, $2, $3)
; Check for wonderguard
$wonderguard.check($3, $2, tech, $readini($char($1), weapons, equipped))
unset %statusmessage.display
set %status.type.list $readini($dbfile(techniques.db), $2, StatusType)
; Is the tech a multi-hit weapon?
set %tech.howmany.hits $readini($dbfile(techniques.db), $2, hits)
$first_round_dmg_chk($1, $3)
var %current.element $readini($dbfile(techniques.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
; This is mostly just for gremlins but might be useful for other things down the road.
$readini($char($3), modifier_special, %current.element)
}
unset %target.element.null
}
set %target.tech.null $readini($char($3), modifiers, $2)
if (%target.tech.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToTechName)
set %attack.damage 0
}
unset %target.element.null
if ((%guard.message = $null) && (%attack.damage > 0)) {
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list, $2) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect, $2)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
}
unset %status.type.list
if (%guard.message = $null) {
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$magic.effect.check($1, $3, $2)
}
}
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
; Check for a shield block.
$shield_block_check($3, $1, $2)
; If the target has Shell on, it will cut magic damage in half.
if (($readini($char($3), status, shell) = yes) && ($readini($dbfile(techniques.db), $2, magic) = yes)) { %attack.damage = $round($calc(%attack.damage / 2),0) }
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3, $4)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
; Check for multiple hits
$multihitcheck.tech($1, $2, $3, $4)
; Check to see if we need to increase the proficiency of a technique.
$tech.points($1, $2)
}
formula.techdmg.player.formula_3.0 {
; $1 = user
; $2 = technique used
; $3 = target
; $4 = optional flag ("heal")
if (%attack.damage = $null) { set %attack.damage 0 }
; First things first, let's find out the base power.
set %base.stat.needed $readini($dbfile(techniques.db), $2, stat)
if (%base.stat.needed = $null) { set %base.stat.needed int }
set %base.stat $readini($char($1), battle, %base.stat.needed)
if (%base.stat.needed = str) { inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
}
if (%base.stat.needed = def) { inc %base.stat $armor.stat($1, def) }
if (%base.stat.needed = int) { inc %base.stat $armor.stat($1, int)
if ($skill.bloodspirit.status($1) = on) { inc %base.stat $skill.bloodspirit.calculate($1) }
$int_down_check($1)
}
if (%base.stat.needed = spd) {
inc %base.stat $armor.stat($1, spd)
if ($skill.speed.status($1) = on) { inc %base.stat $skill.speed.calculate($1) }
}
set %true.base.stat %base.stat
var %tech.base $readini($dbfile(techniques.db), p, $2, BasePower)
var %user.tech.level $readini($char($1), Techniques, $2)
if (%user.tech.level = $null) { var %user.tech.level 1 }
set %ignition.name $readini($char($1), status, ignition.name)
set %ignition.techs $readini($dbfile(ignitions.db), %ignition.name, techs)
if ($istok(%ignition.techs,$2,46) = $true) { var %user.tech.level 50 }
unset %ignition.name | unset %ignition.techs
if (%user.tech.level < 100) { inc %tech.base $round($calc(%user.tech.level * 1.8),0) }
; Let's add in the base power of the weapon used..
if ($person_in_mech($1) = false) { set %weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { set %weapon.used $readini($char($1), mech, equippedWeapon) }
set %base.power.wpn $readini($dbfile(weapons.db), %weapon.used, basepower)
if (%base.power.wpn = $null) { var %base.power.wpn 1 }
set %weapon.base $readini($char($1), weapons, %weapon.used)
if (%weapon.base = $null) { set %weapon.base 1 }
inc %base.power.wpn $calc(1 + (2 * $log(%weapon.base)))
; Does the user have a mastery in the weapon? We can add a bonus as well.
$mastery_check($1, %weapon.used)
; If it's a portal battle this might need to be adjusted to make portal battles easier to balance
if (%portal.bonus = true) {
if (%weapon.base > $return_winningstreak) { var %weapon.base $return_winningstreak }
if (%tech.base > $return_winningstreak) { var %tech.base $return_winningstreak }
if (%mastery.bonus > $calc($return_winningstreak + 10)) { var %mastery.bonus $calc($return_winningstreak + 10) }
}
unset %weapon.used
inc %base.power.wpn %mastery.bonus
set %attack.damage $calc(%tech.base + %user.tech.level + %base.power.wpn)
if ($person_in_mech($1) = false) {
; Let's check for some offensive style enhancements
$offensive.style.check($1, $2, tech)
}
; Let's increase the attack by a random amount.
inc %attack.damage $rand(1,15)
; Is the tech magic? If so, we need to add some more stuff to it.
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$calculate_damage_magic($1, $2, $3)
if ($readini($char($3), info, ImmuneToMagic) = true) { $set_chr_name($3) | set %guard.message $readini(translation.dat, battle, ImmuneToMagic) }
}
; Check for TechBonus augment for non-magic techs
if ($readini($dbfile(techniques.db), $2, magic) != yes) {
if ($augment.check($1, TechBonus) = true) {
set %tech.bonus.augment $calc(%augment.strength * .25)
var %augment.power.increase.amount $round($calc(%tech.bonus.augment * %attack.damage),0)
inc %attack.damage %augment.power.increase.amount
unset %tech.bonus.augment
}
}
;If the element is Light/fire and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if ($istok(light.fire,$readini($dbfile(techniques.db), $2, element),46) = $true) { inc %attack.damage $round($calc(%attack.damage * .110),0)
}
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if ($person_in_mech($1) = false) { set %current.weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { set %current.weapon.used $readini($char($1), mech, EquippedWeapon) }
if (($readini($dbfile(weapons.db), %current.weapon.used, cost) = 0) && ($readini($dbfile(weapons.db), %current.weapon.used, specialweapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
unset %current.weapon.used | unset %base.power.wpn
; Increase attack damage by the $log of the base stat.
set %attack.damage $round($calc(%attack.damage * $log(%base.stat)),0)
var %tech.type $readini($dbfile(techniques.db), $2, type)
if ((%tech.type = heal-aoe) || (%tech.type = heal)) { return }
; Now we're ready to calculate the enemy's defense.
if ($readini($dbfile(techniques.db), $2, stat) = str) {
set %enemy.defense $current.def($3)
inc %enemy.defense $armor.stat($3, def)
if ($readini($char($3), status, defdown) = yes) { var %enemy.defense $round($calc(%enemy.defense / 4),0) }
}
else {
set %enemy.defense $current.int($3)
inc %enemy.defense $armor.stat($3, int)
if ($skill.bloodspirit.status($3) = on) { inc %enemy.defense $round($calc($skill.bloodspirit.calculate($3) /3.5),0) }
if ($readini($char($3), status, intdown) = yes) { var %enemy.defense $round($calc(%enemy.defense / 4),0) }
}
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(techniques.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
}
if (%enemy.defense <= 0) { set %enemy.defense 1 }
var %blocked.percent $log(%enemy.defense)
if (%blocked.percent < 0) { var %blocked.percent .5 }
inc %blocked.percent $rand(1,10)
inc %blocked.percent $log($get.level($3))
if ($readini(system.dat, system, PlayersMustDieMode) = true) { inc %blocked.percent $rand(2,5) }
if ($return_playersinbattle > 1) { inc %blocked.percent $calc($return_playersinbattle * 3) }
var %blocked.damage $round($return_percentofvalue(%attack.damage, %blocked.percent),0)
dec %attack.damage %blocked.damage
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, tech)
$damage.color.check
if ($readini($char($3), info, ai_type) = counteronly) { set %attack.damage 0 | return }
if (enhance-tech isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var %flag $readini($char($1), info, flag)
$calculate_attack_leveldiff($1, $3)
$cap.damage($1, $3, tech)
if (%attack.damage <= 1) {
var %minimum.damage 1
set %attack.damage $readini($dbfile(techniques.db), $2, BasePower)
set %attack.damage $rand(1, %attack.damage)
}
unset %true.base.stat
inc %attack.damage $rand(1,5)
unset %true.base.stat
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
; Check for the Guardian style
$guardian_style_check($3)
; To be fair to players, we'll limit the damage if it has the ability to ignore guardian.
if ($augment.check($1, IgnoreGuardian) = true) {
var %user.flag $readini($char($1), info, flag)
if ((%user.flag = monster) && (%battle.rage.darkness != on)) {
if ($readini($char($3), info, flag) = $null) {
if (%attack.damage > 2500) { set %attack.damage 2000 }
}
}
}
; If this current tech is using the same tech as the previous tech attack, nerf the damage
if (($4 != aoe) && ($2 = $readini($txtfile(battle2.txt), style, $1 $+ .lastaction))) { set %attack.damage $round($calc(%attack.damage / 3),0) }
if (($4 = aoe) && (%lastaction.nerf = true)) { set %attack.damage $round($calc(%attack.damage / 3),0) }
; AOE nerf check for players
if (($readini($char($1), info, flag) = $null) || ($readini($char($1), info, clone) = yes)) {
if (%aoe.turn > 1) {
var %aoe.nerf.percent $calc(8 * %aoe.turn)
if ($readini($dbfile(techniques.db), $2, hits) > 1) { inc %aoe.nerf.percent 10 }
if (%aoe.nerf.percent > 93) { var %aoe.nerf.percent 93 }
var %aoe.nerf.percent $calc(%aoe.nerf.percent / 100)
var %aoe.nerf.amount $round($calc(%attack.damage * %aoe.nerf.percent),0)
dec %attack.damage %aoe.nerf.amount
}
}
; Check for the Metal Defense flag
$metal_defense_check($3)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances..
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
unset %base.stat | unset %current.accessory.type | unset %base.stat.needed
if ($readini($dbfile(techniques.db), $2, magic) != yes) { $flying.damage.check($1, %weapon.used, $3) }
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
if ($readini($dbfile(techniques.db), $2, canDodge) != false) { $trickster_dodge_check($3, $1, tech) }
$manawall.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
$tech.ethereal.check($1, $2, $3)
; Check for wonderguard
$wonderguard.check($3, $2, tech, $readini($char($1), weapons, equipped))
unset %statusmessage.display
set %status.type.list $readini($dbfile(techniques.db), $2, StatusType)
; Is the tech a multi-hit weapon?
set %tech.howmany.hits $readini($dbfile(techniques.db), $2, hits)
$first_round_dmg_chk($1, $3)
var %current.element $readini($dbfile(techniques.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
; This is mostly just for gremlins but might be useful for other things down the road.
$readini($char($3), modifier_special, %current.element)
}
unset %target.element.null
}
set %target.tech.null $readini($char($3), modifiers, $2)
if (%target.tech.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToTechName)
set %attack.damage 0
}
unset %target.element.null
if ((%guard.message = $null) && (%attack.damage > 0)) {
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list, $2) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect, $2)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
}
unset %status.type.list
if (%guard.message = $null) {
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$magic.effect.check($1, $3, $2)
}
}
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
; Check for a shield block.
$shield_block_check($3, $1, $2)
; If the target has Shell on, it will cut magic damage in half.
if (($readini($char($3), status, shell) = yes) && ($readini($dbfile(techniques.db), $2, magic) = yes)) { %attack.damage = $round($calc(%attack.damage / 2),0) }
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3, $4)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
; Check for multiple hits
$multihitcheck.tech($1, $2, $3, $4)
; Check to see if we need to increase the proficiency of a technique.
$tech.points($1, $2)
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The formulas below this line are either old or
; experimental.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
formula.meleedmg.player.formula_4.0 {
unset %absorb
set %attack.damage 0
var %damage.rating 0
var %base.stat $readini($char($1), battle, str)
inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
inc %damage.rating %base.stat
inc %damage.rating $readini($char($1), weapons, $2)
; If the weapon is a hand to hand, it will now receive a bonus based on your fists level.
if (($readini($dbfile(weapons.db), $2, type) = HandToHand) && ($2 != fists)) { inc %damage.rating $readini($char($1), weapons, fists) }
; Get the weapon's power
var %weapon.power $readini($dbfile(weapons.db), $2, basepower)
if (%weapon.power = $null) { var %weapon.power 1 }
set %current.accessory $readini($char($3), equipment, accessory)
set %current.accessory.type $readini($dbfile(items.db), %current.accessory, accessorytype)
; Does the user have any mastery of the weapon?
$mastery_check($1, $2)
; If it's a portal battle this might need to be adjusted to make portal battles easier to balance
if (%portal.bonus = true) {
if (%weapon.base > $return_winningstreak) { var %weapon.base $return_winningstreak }
if (%mastery.bonus > $calc($return_winningstreak + 10)) { var %mastery.bonus $calc($return_winningstreak + 10) }
}
; Let's add the mastery bonus to the weapon base
inc %damage.rating %mastery.bonus
; Let's check for some offensive style enhancements
if ($person_in_mech($1) = false) {
$offensive.style.check($1, $2, melee)
}
;If the element is Light and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if (%weapon.element = light) { inc %damage.rating $round($calc(%damage.rating * .110),0) }
if (%weapon.element = fire) { inc %damage.rating $round($calc(%damage.rating * .110),0) }
}
; Check to see if we have an accessory or augment that enhances the weapon type
$melee.weapontype.enhancements($1)
unset %weapon.type
; Check for Killer Traits
inc %attack.damage $round($calc(%damage.rating * ($killer.trait.check($1, $3) / 100)),0)
; Check for MightyStrike
if ($person_in_mech($1) = false) {
; Check for the skill "MightyStrike"
if ($mighty_strike_check($1) = true) {
; Double the attack.
%damage.rating = $calc(%attack.damage * 1.5)
}
; Check for the "DesperateBlows" skill.
if ($desperate_blows_check($1) = true) {
var %hp.percent $calc(($readini($char($1), Battle, HP) / $readini($char($1), BaseStats, HP)) *100)
if ((%hp.percent >= 10) && (%hp.percent <= 25)) { %damage.rating = $round($calc(%damage.rating * 1.5),0) }
if ((%hp.percent > 2) && (%hp.percent < 10)) { %damage.rating = $round($calc(%damage.rating * 2),0) }
if ((%hp.percent > 0) && (%hp.percent <= 2)) { %damage.rating = $round($calc(%damage.rating * 2.5),0) }
}
}
unset %current.playerstyle | unset %current.playerstyle.level
if ($person_in_mech($1) = false) {
; Check for the miser ring accessory
if ($accessory.check($1, IncreaseMeleeDamage) = true) {
var %redorb.amount $readini($char($1), stuff, redorbs)
var %miser-ring.increase $round($calc(%redorb.amount * %accessory.amount),0)
if (%miser-ring.increase <= 0) { var %miser-ring.increase 1 }
if (%miser-ring.increase > 1000) { var %miser-ring.increase 1000 }
inc %damage.rating %miser-ring.increase
unset %accessory.amount
}
; Check for the fool's tablet accessory
if ($accessory.check($1, IncreaseMeleeAddPoison) = true) {
inc %damage.rating $round($calc(%damage.rating * %accessory.amount),0)
unset %accessory.amount
}
}
if ($augment.check($1, MeleeBonus) = true) {
set %melee.bonus.augment $calc(%augment.strength * .25)
var %augment.power.increase.amount $round($calc(%melee.bonus.augment * %damage.rating),0)
inc %damage.rating %augment.power.increase.amount
unset %melee.bonus.augment
}
unset %current.accessory.type
$flying.damage.check($1, $2, $3)
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
$weapon_parry_check($3, $1, $2)
$trickster_dodge_check($3, $1, physical)
$royalguard.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
; Check to see if the melee attack will hurt an ethereal monster
$melee.ethereal.check($1, $2, $3)
unset %statusmessage.display
set %status.type.list $readini($dbfile(weapons.db), $2, StatusType)
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
unset %status.type.list
; Now we're ready to calculate the enemy's defense..
set %enemy.defense $readini($char($3), battle, def)
inc %enemy.defense $armor.stat($3, def)
$defense_down_check($3)
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(weapons.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
if (%enemy.defense <= 0) { set %enemy.defense 1 }
}
if (%enemy.defense <= 0) { set %enemy.defense 1 }
set %attack.damage $calc((100 + (%damage.rating - %enemy.defense))/100 * %weapon.power)
; Check for modifiers
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, melee)
$damage.color.check
var %flag $readini($char($1), info, flag)
if (enhance-melee isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
; And let's get the final attack damage..
dec %attack.damage %enemy.defense
unset %enemy.defense
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
; Adjust the damage based on weapon size vs monster size
$monstersize.adjust($3,$2)
; If this current melee attack is using the same weapon as the previous melee attack, nerf the damage
$melee.lastaction.nerfcheck($1, $2)
if (%attack.damage <= 1) {
set %attack.damage $readini($dbfile(weapons.db), $2, BasePower)
set %attack.damage $rand(1, %attack.damage)
}
inc %attack.damage $rand(1,10)
unset %true.base.stat
if (%guard.message = $null) { inc %attack.damage $rand(1,3) }
unset %enemy.defense | unset %level.ratio
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
; Check for the Guardian style
$guardian_style_check($3)
; Check for metal defense. If found, set the damage to 1.
$metal_defense_check($3, $1)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances...
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
; Check for a shield block.
$shield_block_check($3, $1, $2)
; Check for a critical hit.
var %critical.hit.chance $rand(1,100)
; check for the Impetus Passive Skill
var %impetus.check $readini($char($1), skills, Impetus)
if (%impetus.check != $null) { inc %critical.hit.chance %impetus.check }
; If the user is using a h2h weapon, increase the critical hit chance by 1.
if ($readini($dbfile(weapons.db), $2, type) = HandToHand) { inc %critical.hit.chance 1 }
if ($accessory.check($1, IncreaseCriticalHits) = true) {
if (%accessory.amount = 0) { var %accessory.amount 1 }
inc %critical.hit.chance %accessory.amount
unset %accessory.amount
}
unset %player.accessory | unset %accessory.type | unset %accessory.amount
if ($augment.check($1, EnhanceCriticalHits) = true) { inc %critical.hit.chance %augment.strength }
if (%critical.hit.chance >= 97) {
$set_chr_name($1) | $display.message($readini(translation.dat, battle, LandsACriticalHit), battle)
set %attack.damage $round($calc(%attack.damage * 1.5),0)
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if (($readini($dbfile(weapons.db), $2, cost) = 0) && ($readini($dbfile(weapons.db), $2, SpecialWeapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
if ($accessory.check($1, CurseAddDrain) = true) { unset %accessory.amount | set %absorb absorb }
if ($augment.check($1, Drain) = true) { set %absorb absorb }
unset %current.accessory | unset %current.accessory.type
if ($person_in_mech($1) = false) { writeini $char($1) skills mightystrike.on off }
; Is the weapon a multi-hit weapon?
set %weapon.howmany.hits $readini($dbfile(weapons.db), $2, hits)
if ($augment.check($1, AdditionalHit) = true) { inc %weapon.howmany.hits %augment.strength }
; Are we dual-wielding? If so, increase the hits by the # of hits of the second weapon.
if (($readini($char($1), weapons, equippedLeft) != $null) && ($person_in_mech($1) = false)) {
var %left.hits $readini($dbfile(weapons.db), $readini($char($1), weapons, equippedLeft), hits)
if (%left.hits = $null) { var %left.hits 1 }
inc %weapon.howmany.hits %left.hits
}
if ($1 = demon_wall) { $demon.wall.boost($1) }
$first_round_dmg_chk($1, $3)
; check for melee counter
$counter_melee($1, $3, $2)
; Check for countering an attack using a shield
$shield_reflect_melee($1, $3, $2)
; Check for the weapon bash skill
$weapon_bash_check($1, $3)
var %current.element $readini($dbfile(weapons.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
}
unset %target.element.null
}
var %weapon.type $readini($dbfile(weapons.db), $2, type)
if (%weapon.type != $null) {
set %target.weapon.null $readini($char($3), modifiers, %weapon.type)
if (%target.weapon.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToWeaponType)
set %attack.damage 0
}
unset %target.weapon.null
}
; If the target has Protect on, it will cut melee damage in half.
if ($readini($char($3), status, protect) = yes) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
; If we came here via mugger's belt, we need to cut the damage in half.
if ($4 = mugger's-belt) { %attack.damage = $round($calc(%attack.damage / 2),0) | set %damage.display.color 6 }
if (%counterattack != on) {
; Check for the En-Spell Buff
if ($readini($char($1), status, en-spell) != none) {
$magic.effect.check($1, $3, nothing, en-spell)
$modifer_adjust($3, $readini($char($1), status, en-spell))
}
}
; Turn off the True Strike skill
writeini $char($1) skills truestrike.on off
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
if (%attack.damage = 0) { return }
; Check for multiple hits
$multihitcheck.melee($1, $2, $3, $4)
}
formula.techdmg.player.formula_4.0 {
; $1 = user
; $2 = technique used
; $3 = target
; $4 = optional flag ("heal")
set %attack.damage 0
var %damage.rating 0
; First things first, let's find out the base power.
set %base.stat.needed $readini($dbfile(techniques.db), $2, stat)
if (%base.stat.needed = $null) { set %base.stat.needed int }
set %base.stat $readini($char($1), battle, %base.stat.needed)
if (%base.stat.needed = str) { inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
}
if (%base.stat.needed = def) { inc %base.stat $armor.stat($1, def) }
if (%base.stat.needed = int) { inc %base.stat $armor.stat($1, int)
if ($skill.bloodspirit.status($1) = on) { inc %base.stat $skill.bloodspirit.calculate($1) }
$int_down_check($1)
}
if (%base.stat.needed = spd) {
inc %base.stat $armor.stat($1, spd)
if ($skill.speed.status($1) = on) { inc %base.stat $skill.speed.calculate($1) }
}
var %tech.base $readini($dbfile(techniques.db), p, $2, BasePower)
var %user.tech.level $readini($char($1), Techniques, $2)
if (%user.tech.level = $null) { var %user.tech.level 1 }
set %ignition.name $readini($char($1), status, ignition.name)
set %ignition.techs $readini($dbfile(ignitions.db), %ignition.name, techs)
if ($istok(%ignition.techs,$2,46) = $true) { var %user.tech.level 50 }
unset %ignition.name | unset %ignition.techs
if (%user.tech.level < 100) { inc %tech.base $round($calc(%user.tech.level * 1.8),0) }
; Let's add in the base power of the weapon used..
if ($person_in_mech($1) = false) { set %weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { set %weapon.used $readini($char($1), mech, equippedWeapon) }
set %base.power.wpn $readini($dbfile(weapons.db), %weapon.used, basepower)
if (%base.power.wpn = $null) { var %base.power.wpn 1 }
var %weapon.base $readini($char($1), weapons, %weapon.used)
if (%weapon.base = $null) { set %weapon.base 1 }
inc %base.power.wpn %weapon.base
; Does the user have a mastery in the weapon? We can add a bonus as well.
$mastery_check($1, %weapon.used)
unset %weapon.used
inc %base.power.wpn %mastery.bonus
inc %damage.rating $calc(%tech.base * (%user.tech.level + %base.power.wpn))
inc %damage.rating %base.stat
if ($person_in_mech($1) = false) {
; Let's check for some offensive style enhancements
$offensive.style.check($1, $2, tech)
}
; Let's increase the attack by a random amount.
inc %damage.damage $rand(1,15)
; Is the tech magic? If so, we need to add some more stuff to it.
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
set %attack.damage %damage.rating
$calculate_damage_magic($1, $2, $3)
set %damage.rating %attack.damage
if ($readini($char($3), info, ImmuneToMagic) = true) { $set_chr_name($3) | set %guard.message $readini(translation.dat, battle, ImmuneToMagic) }
}
; Check for TechBonus augment for non-magic techs
if ($readini($dbfile(techniques.db), $2, magic) != yes) {
if ($augment.check($1, TechBonus) = true) {
set %tech.bonus.augment $calc(%augment.strength * .25)
var %augment.power.increase.amount $round($calc(%tech.bonus.augment * %damage.rating),0)
inc %damage.rating %augment.power.increase.amount
unset %tech.bonus.augment
}
}
;If the element is Light/fire and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if ($istok(light.fire,$readini($dbfile(techniques.db), $2, element),46) = $true) { inc %damage.rating $round($calc(%damage.rating * .110),0)
}
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if ($person_in_mech($1) = false) { set %current.weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { set %current.weapon.used $readini($char($1), mech, EquippedWeapon) }
if (($readini($dbfile(weapons.db), %current.weapon.used, cost) = 0) && ($readini($dbfile(weapons.db), %current.weapon.used, specialweapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %damage.rating 0 }
}
unset %current.weapon.used | unset %base.power.wpn
var %tech.type $readini($dbfile(techniques.db), $2, type)
if ((%tech.type = heal-aoe) || (%tech.type = heal)) { return }
; Now we're ready to calculate the enemy's defense.
if ($readini($dbfile(techniques.db), $2, stat) = str) {
set %enemy.defense $current.def($3)
inc %enemy.defense $armor.stat($3, def)
if ($readini($char($3), status, defdown) = yes) { var %enemy.defense $round($calc(%enemy.defense / 4),0) }
}
else {
set %enemy.defense $current.int($3)
inc %enemy.defense $armor.stat($3, int)
if ($skill.bloodspirit.status($3) = on) { inc %enemy.defense $round($calc($skill.bloodspirit.calculate($3) /3.5),0) }
if ($readini($char($3), status, intdown) = yes) { var %enemy.defense $round($calc(%enemy.defense / 4),0) }
}
$defense_up_check($3)
; Check to see if the weapon has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(techniques.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
}
if (%enemy.defense <= 0) { set %enemy.defense 1 }
; Calculate the attack damage
set %attack.damage $calc((100 + (%damage.rating - %enemy.defense))/100 * %tech.base)
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, tech)
$damage.color.check
if ($readini($char($3), info, ai_type) = counteronly) { set %attack.damage 0 | return }
if (enhance-tech isin %battleconditions) { inc %attack.damage $return_percentofvalue(%attack.damage, 10) }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ADJUST THE TOTAL DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var %flag $readini($char($1), info, flag)
if (%attack.damage <= 1) {
var %minimum.damage 1
set %attack.damage $readini($dbfile(techniques.db), $2, BasePower)
set %attack.damage $rand(1, %attack.damage)
}
unset %true.base.stat
inc %attack.damage $rand(1,5)
unset %true.base.stat
; Elite monsters take less damage
if ($eliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .30),0) }
if ($supereliteflag.check($3) = true) { dec %attack.damage $round($calc(%attack.damage * .45),0) }
; Check for the Guardian style
$guardian_style_check($3)
; To be fair to players, we'll limit the damage if it has the ability to ignore guardian.
if ($augment.check($1, IgnoreGuardian) = true) {
var %user.flag $readini($char($1), info, flag)
if ((%user.flag = monster) && (%battle.rage.darkness != on)) {
if ($readini($char($3), info, flag) = $null) {
if (%attack.damage > 2500) { set %attack.damage 2000 }
}
}
}
; If this current tech is using the same tech as the previous tech attack, nerf the damage
if (($4 != aoe) && ($2 = $readini($txtfile(battle2.txt), style, $1 $+ .lastaction))) { set %attack.damage $round($calc(%attack.damage / 3),0) }
if (($4 = aoe) && (%lastaction.nerf = true)) { set %attack.damage $round($calc(%attack.damage / 3),0) }
; AOE nerf check for players
if (($readini($char($1), info, flag) = $null) || ($readini($char($1), info, clone) = yes)) {
if (%aoe.turn > 1) {
var %aoe.nerf.percent $calc(8 * %aoe.turn)
if ($readini($dbfile(techniques.db), $2, hits) > 1) { inc %aoe.nerf.percent 10 }
if (%aoe.nerf.percent > 93) { var %aoe.nerf.percent 93 }
var %aoe.nerf.percent $calc(%aoe.nerf.percent / 100)
var %aoe.nerf.amount $round($calc(%attack.damage * %aoe.nerf.percent),0)
dec %attack.damage %aoe.nerf.amount
}
}
; Check for the Metal Defense flag
$metal_defense_check($3)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances..
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
unset %base.stat | unset %current.accessory.type | unset %base.stat.needed
if ($readini($dbfile(techniques.db), $2, magic) != yes) { $flying.damage.check($1, %weapon.used, $3) }
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
if ($readini($dbfile(techniques.db), $2, canDodge) != false) { $trickster_dodge_check($3, $1, tech) }
$manawall.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
$tech.ethereal.check($1, $2, $3)
; Check for wonderguard
$wonderguard.check($3, $2, tech, $readini($char($1), weapons, equipped))
unset %statusmessage.display
set %status.type.list $readini($dbfile(techniques.db), $2, StatusType)
; Is the tech a multi-hit weapon?
set %tech.howmany.hits $readini($dbfile(techniques.db), $2, hits)
$first_round_dmg_chk($1, $3)
var %current.element $readini($dbfile(techniques.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
; This is mostly just for gremlins but might be useful for other things down the road.
$readini($char($3), modifier_special, %current.element)
}
unset %target.element.null
}
set %target.tech.null $readini($char($3), modifiers, $2)
if (%target.tech.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToTechName)
set %attack.damage 0
}
unset %target.element.null
if ((%guard.message = $null) && (%attack.damage > 0)) {
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list, $2) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect, $2)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
}
unset %status.type.list
if (%guard.message = $null) {
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$magic.effect.check($1, $3, $2)
}
}
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
; Check for a shield block.
$shield_block_check($3, $1, $2)
; If the target has Shell on, it will cut magic damage in half.
if (($readini($char($3), status, shell) = yes) && ($readini($dbfile(techniques.db), $2, magic) = yes)) { %attack.damage = $round($calc(%attack.damage / 2),0) }
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3, $4)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
; Check for multiple hits
$multihitcheck.tech($1, $2, $3, $4)
; Check to see if we need to increase the proficiency of a technique.
$tech.points($1, $2)
}
formula.techdmg.player.percent {
; $1 = user
; $2 = technique used
; $3 = target
; $4 = optional flag ("heal")
var %base.percent 0 | var %max.enemy.hp $readini($char($3), basestats, hp)
if (%attack.damage = $null) { set %attack.damage 0 }
; First things first, let's find out the base power.
set %base.stat.needed $readini($dbfile(techniques.db), $2, stat)
if (%base.stat.needed = $null) { set %base.stat.needed int }
set %base.stat $readini($char($1), battle, %base.stat.needed)
if (%base.stat.needed = str) { inc %base.stat $armor.stat($1, str)
if ($skill.bloodboost.status($1) = on) { inc %base.stat $skill.bloodboost.calculate($1) }
$strength_down_check($1)
}
if (%base.stat.needed = def) { inc %base.stat $armor.stat($1, def) }
if (%base.stat.needed = int) { inc %base.stat $armor.stat($1, int)
if ($skill.bloodspirit.status($1) = on) { inc %base.stat $skill.bloodspirit.calculate($1) }
$int_down_check($1)
}
if (%base.stat.needed = spd) {
inc %base.stat.needed $armor.stat($1, spd)
if ($skill.speed.status($1) = on) { inc %base.stat $skill.speed.calculate($1) }
}
if (%base.stat > 9999) { set %base.stat $round($calc(9999 + ((%base.stat - 9999) * .10)),0) }
; Get the tech base and user's tech level
var %tech.base $readini($dbfile(techniques.db), p, $2, BasePower)
var %user.tech.level $readini($char($1), Techniques, $2)
if (%user.tech.level = $null) { var %user.tech.level 1 }
set %ignition.name $readini($char($1), status, ignition.name)
set %ignition.techs $readini($dbfile(ignitions.db), %ignition.name, techs)
if ($istok(%ignition.techs,$2,46) = $true) { var %user.tech.level 50 }
unset %ignition.name | unset %ignition.techs
var %attack.power $calc((%base.stat / 1.5) + (%tech.base + ((%tech.base * %user.tech.level) / 500)))
; Let's add in the base power of the weapon used..
if ($person_in_mech($1) = false) { set %weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { set %weapon.used $readini($char($1), mech, equippedWeapon) }
set %base.power.wpn $readini($dbfile(weapons.db), %weapon.used, basepower)
if (%base.power.wpn = $null) { var %base.power 1 }
set %weapon.base $readini($char($1), weapons, %weapon.used)
if (%weapon.base = $null) { set %weapon.base 1 }
inc %base.power.wpn $round($calc(%weapon.base / 10),0)
; Does the user have a mastery in the weapon? We can add a bonus as well.
$mastery_check($1, %weapon.used)
unset %weapon.used
if (%mastery.bonus != $null) { inc %base.power.wpn %mastery.bonus }
inc %attack.power %base.power.wpn
; Increase the base percent
inc %base.percent $calc(%attack.power / 10)
if (%base.percent > 50) { var %base.percent 50 }
; Set the attack damage
var %minimum.damage $return_percentofvalue(%max.enemy.hp, %base.percent)
set %attack.damage $return_percentofvalue(%max.enemy.hp, %base.percent)
if ($person_in_mech($1) = false) {
; Let's check for some offensive style enhancements
$offensive.style.check($1, $2, tech)
}
; Let's increase the attack by a random amount.
inc %attack.damage $rand(1,10)
; Is the tech magic? If so, we need to add some more stuff to it.
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$calculate_damage_magic($1, $2, $3)
if ($readini($char($3), info, ImmuneToMagic) = true) { $set_chr_name($3) | set %guard.message $readini(translation.dat, battle, ImmuneToMagic) }
}
; Check for TechBonus augment for non-magic techs
if ($readini($dbfile(techniques.db), $2, magic) != yes) {
if ($augment.check($1, TechBonus) = true) {
set %tech.bonus.augment $calc(%augment.strength * .25)
var %augment.power.increase.amount $round($calc(%tech.bonus.augment * %attack.damage),0)
inc %attack.damage %augment.power.increase.amount
unset %tech.bonus.augment
}
}
;If the element is Light/fire and the target has the ZOMBIE status, then we need to increase the damage
if ($readini($char($3), status, zombie) = yes) {
if ($istok(light.fire,$readini($dbfile(techniques.db), $2, element),46) = $true) { inc %attack.damage $round($calc(%attack.damage * .110),0)
}
}
; If a player is using a monster weapon, which is considered cheating, set the damage to 0.
if ($person_in_mech($1) = false) { set %current.weapon.used $readini($char($1), weapons, equipped) }
if ($person_in_mech($1) = true) { set %current.weapon.used $readini($char($1), mech, EquippedWeapon) }
if (($readini($dbfile(weapons.db), %current.weapon.used, cost) = 0) && ($readini($dbfile(weapons.db), %current.weapon.used, specialweapon) != true)) {
var %current.flag $readini($char($1), info, flag)
if (%current.flag = $null) { set %attack.damage 0 }
}
unset %current.weapon.used | unset %base.power.wpn
var %tech.type $readini($dbfile(techniques.db), $2, type)
if ((%tech.type = heal-aoe) || (%tech.type = heal)) { return }
; Now we're ready to calculate the enemy's defense.
if ($readini($dbfile(techniques.db), $2, stat) = str) {
set %enemy.defense $current.def($3)
inc %enemy.defense $armor.stat($3, def)
if ($readini($char($3), status, defdown) = yes) { var %enemy.defense $round($calc(%enemy.defense / 4),0) }
}
else {
set %enemy.defense $current.int($3)
inc %enemy.defense $armor.stat($3, int)
if ($skill.bloodspirit.status($3) = on) { inc %enemy.defense $round($calc($skill.bloodspirit.calculate($3) /3.5),0) }
if ($readini($char($3), status, intdown) = yes) { var %enemy.defense $round($calc(%enemy.defense / 4),0) }
}
$defense_up_check($3)
; Check to see if the tech has an "IgnoreDefense=" flag. If so, cut the def down.
var %ignore.defense.percent $readini($dbfile(techniques.db), $2, IgnoreDefense)
if ($augment.check($1, IgnoreDefense) = true) { inc %ignore.defense.percent $calc(%augment.strength * 2) }
if (%ignore.defense.percent > 0) {
var %def.ignored $round($calc(%enemy.defense * (%ignore.defense.percent * .010)),0)
dec %enemy.defense %def.ignored
}
if (%enemy.defense > 9999) { set %enemy.defense $round($calc(9999 + ((%enemy.defense - 9999)* .10)),0) }
if (%enemy.defense <= 0) { set %enemy.defense 1 }
set %starting.damage %attack.damage
$damage.modifiers.check($1, $2, $3, tech)
$damage.color.check
; Modify the attack damage.
$calculate_attack_leveldiff($1, $3)
var %level.percent.modifier $calc($get.level($1) / $get.level($3))
var %stat.percent.modifier $calc(%base.stat / %enemy.defense)
if (%level.percent.modifier > 2) { var %level.percent.modifier 2 }
if (%stat.percent.modifier > 2) { var %stat.percent.modifier 2 }
%attack.damage = $calc(%attack.damage * %level.percent.modifier)
%attack.damage = $calc(%attack.damage * %stat.percent.modifier)
%minimum.damage = $calc(%minimum.damage * %level.percent.modifier)
%minimum.damage = $calc(%minimum.damage * %stat.percent.modifier)
var %minimum.damage $round($abs($calc(%attack.damage - %minimum.damage)),0)
set %attack.damage $round($rand(%minimum.damage, %attack.damage),0)
; Cap the damage
$cap.damage($1, $3, tech)
if ($readini($char($3), info, ai_type) = counteronly) { set %attack.damage 0 | return }
inc %attack.damage $rand(1,5)
unset %true.base.stat
; Check for the Guardian style
$guardian_style_check($3)
; To be fair to players, we'll limit the damage if it has the ability to ignore guardian.
if ($augment.check($1, IgnoreGuardian) = true) {
var %user.flag $readini($char($1), info, flag)
if ((%user.flag = monster) && (%battle.rage.darkness != on)) {
if ($readini($char($3), info, flag) = $null) {
if (%attack.damage > 2500) { set %attack.damage 2000 }
}
}
}
; If the tech is the same as the last round, nerf the damage
if (($4 != aoe) && ($2 = $readini($txtfile(battle2.txt), style, $1 $+ .lastaction))) { set %attack.damage $round($calc(%attack.damage / 3),0) }
if (($4 = aoe) && (%lastaction.nerf = true)) { set %attack.damage $round($calc(%attack.damage / 3),0) }
; AOE nerf check for players
if (($readini($char($1), info, flag) = $null) || ($readini($char($1), info, clone) = yes)) {
if (%aoe.turn > 1) {
var %aoe.nerf.percent $calc(8 * %aoe.turn)
if ($readini($dbfile(techniques.db), $2, hits) > 1) { inc %aoe.nerf.percent 5 }
if (%aoe.nerf.percent > 93) { var %aoe.nerf.percent 93 }
var %aoe.nerf.percent $calc(%aoe.nerf.percent / 100)
var %aoe.nerf.amount $round($calc(%attack.damage * %aoe.nerf.percent),0)
dec %attack.damage %aoe.nerf.amount
}
}
; Check for the Metal Defense flag
$metal_defense_check($3)
; In this bot we don't want the attack to ever be lower than 1 except for rare instances..
if (%guard.message = $null) {
if (%attack.damage <= 0) { set %attack.damage 1 }
}
unset %base.stat | unset %current.accessory.type | unset %base.stat.needed
if ($readini($dbfile(techniques.db), $2, magic) != yes) { $flying.damage.check($1, %weapon.used, $3) }
$invincible.check($1, $2, $3)
$perfectdefense.check($1, $2, $3)
if ($readini($dbfile(techniques.db), $2, canDodge) != false) { $trickster_dodge_check($3, $1, tech) }
$manawall.check($1, $2, $3)
$utsusemi.check($1, $2, $3)
$tech.ethereal.check($1, $2, $3)
$wonderguard.check($3, $2, tech, $readini($char($1), weapons, equipped))
; Check for the skill "Overwhelm" and increase the damage if so
$skill.overwhelm($1)
unset %statusmessage.display
set %status.type.list $readini($dbfile(techniques.db), $2, StatusType)
; Is the tech a multi-hit weapon?
set %tech.howmany.hits $readini($dbfile(techniques.db), $2, hits)
if ($1 = demon_wall) { $demon.wall.boost($1) }
$first_round_dmg_chk($1, $3)
var %current.element $readini($dbfile(techniques.db), $2, element)
if ((%current.element != $null) && (%tech.element != none)) {
set %target.element.null $readini($char($3), modifiers, %current.element)
if (%target.element.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToElement)
set %attack.damage 0
; This is mostly just for gremlins but might be useful for other things down the road.
$readini($char($3), modifier_special, %current.element)
}
unset %target.element.null
}
set %target.tech.null $readini($char($3), modifiers, $2)
if (%target.tech.null <= 0) { $set_chr_name($3)
set %guard.message $readini(translation.dat, battle, ImmuneToTechName)
set %attack.damage 0
}
unset %target.element.null
if ((%guard.message = $null) && (%attack.damage > 0)) {
if (%status.type.list != $null) {
set %number.of.statuseffects $numtok(%status.type.list, 46)
if (%number.of.statuseffects = 1) { $inflict_status($1, $3, %status.type.list, $2) | unset %number.of.statuseffects | unset %status.type.list }
if (%number.of.statuseffects > 1) {
var %status.value 1
while (%status.value <= %number.of.statuseffects) {
set %current.status.effect $gettok(%status.type.list, %status.value, 46)
$inflict_status($1, $3, %current.status.effect, $2)
inc %status.value 1
}
unset %number.of.statuseffects | unset %current.status.effect
}
}
}
unset %status.type.list
if (%guard.message = $null) {
if ($readini($dbfile(techniques.db), $2, magic) = yes) {
$magic.effect.check($1, $3, $2)
}
}
; If the target has Shell on, it will cut magic damage in half.
if (($readini($char($3), status, shell) = yes) && ($readini($dbfile(techniques.db), $2, magic) = yes)) { %attack.damage = $round ($calc(%attack.damage / 2),0) }
; If the attacker is a doll, cut the damage in half
if ($readini($char($1), status, doll) = yes) { %attack.damage = $calc(%attack.damage / 2) }
; Check for a guardian monster
$guardianmon.check($1, $2, $3, $4)
; Set the style amount to the attack damage
set %style.attack.damage %attack.damage
; Check for multiple hits
$multihitcheck.tech($1, $2, $3, $4)
unset %tech.howmany.hits | unset %enemy.defense | set %multihit.message.on on
; Check to see if we need to increase the proficiency of a technique.
$tech.points($1, $2)
unset %attacker.level | unset %defender.level | unset %tech.count | unset %tech.power | unset %base.weapon | unset %random
unset %capamount
}
|
Library/Kernel/LMem/lmemGCNList.asm | steakknife/pcgeos | 504 | 165718 | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Kernel/LMem
FILE: lmemNotifyList.asm
AUTHOR: <NAME>
GLOBAL ROUTINES:
Name Description
---- -----------
GCNListAdd add optr to kernel GCN list
GCNListRemove remove optr from kernel GCN list
GCNListSend send message to kernel GCN list
GCNListCreateBlock create list of lists in given block
GCNListAddToBlock add to gcn list given list of lists chunk
GCNListRemoveFromBlock remove from gcn list given list of lists chunk
GCNListSendToBlock send message to gcn list given list of lists
GCNListFindListInBlock find gcn list in list-of-lists
GCNListDestroyBlock free gcn list of lists & all lists it references
(useful when freeing an object having its own
GCN system)
GCNListCreateList create emtpy gcn list
GCNListAddToList add to gcn list given list chunk
GCNListRemoveFromList remove from gcn list given list chunk
GCNListSendToList send message to gcn list given list chunk
GCNListFindItemInList find item in gcn list
GCNListDestroyList
GCNListRelocateBlock relocate a GCN list block
GCNListUnRelocateBlock unrelocate a GCN list block
GCNListRelocateList relocate a single GCN list
GCNListUnRelocateList unrelocate a single GCN list
LOCAL ROUTINES:
Name Description
---- -----------
INTERNAL ROUTINES:
Name Description
---- -----------
FindGCNList find gcn list in gcn list block
GCNFindItemCallback callback routine for GCNListFindItemInList
GCNLSendCallback callback routine for GCNListSendToList
FindListCallback callback routine for FindGCNList
LockGCNBlock lock gcn list block
UnlockGCNBlock unlock gcn list block
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 5/91 Initial revision
doug 12/91 Added passage of GCNListSendFlags to send
routines
IMPLEMENTATION:
DESCRIPTION:
This file contains notification list primitives.
$Id: lmemGCNList.asm,v 1.1 97/04/05 01:14:21 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
;
; Block for system-wide GCN lists
;
GCNListBlock segment lmem LMEM_TYPE_GENERAL
GCNListBlockHeader <
{}, ; Esp fills this in
gcnListOfLists ; GCNLBH_listOfLists
>
gcnListOfLists chunk.GCNListOfListsHeader <
<
0, ; CAH_count
size GCNListOfListsElement, ; CAH_elementSize
0, ; CAH_curOffset
size GCNListOfListsHeader
>
>
GCNListBlock ends
;---------------------------------------
ChunkCommon segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListSendToBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send message to each element of general change notification
list
CALLED BY: GLOBAL
PASS: bx:ax - GCNListType
bx - GCNLT_manuf
ax - GCNLT_type
^hcx - classed event to send
destination class is ignored
if sending extra data block:
dx - handle of extra data block
NOTE: handle is also stored in classed event
according to the parameters of the
message in the classed event
else:
dx - 0
bp - GCNListSendFlags
GCNLSF_SET_STATUS:1
Sends message to each optr of a particular
notification list per GCNListSendToBlock, but
additionally saves the message as the list's
current "status". The "status" message is
automatically sent to any object adding itself to the
list at a later point in time.
GCNLSF_IGNORE_IF_STATUS_TRANSITIONING:1
Has no effect here. See GenApplicationClass for
its extension.
ds - segment of block containing GCN lists
di - chunk handle of list of lists
NOTE: If data block w/reference count is passed in, its in-use
count should be incremented by one before the call
to this routine, as this routine decrements the count
by one upon completion (and destroys the block if
count reaches zero)
RETURN: cx = # messages sent, if !GCNLSF_SET_STATUS
(event handle freed, data block freed when notification optrs
have processed it)
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 07/01/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListSendToBlock proc far
push si
EC < call ECCheckGCNSend >
EC < mov si, di >
EC < call ECCheckChunkArray >
test bp, mask GCNLSF_SET_STATUS ; clears carry
jz goAheadAndFind ; if not caching, do not create list
stc ; otherwise, force list to exist
goAheadAndFind:
call GCNListFindListInBlock ; *ds:si - desired gcn list
jnc noList ; list not found, do nothing
call GCNListSendToList
exit:
pop si
ret
noList:
xchg bx, cx
call ObjFreeMessage
mov bx, dx
call MemDecRefCount
mov bx, cx
clr cx
jmp exit
GCNListSendToBlock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListSendToList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send message to each element of general change notification
list
CALLED BY: GLOBAL
GCNListSend, GCNListSendToBlock
PASS: *ds:si - gcn list to send message to
^hcx - classed event to send
destination class is ignored
if sending extra data block:
dx - handle of extra data block
NOTE: handle is also stored in classed event
according to the parameters of the
message in the classed event
else:
dx - 0
bp - GCNListSendFlags
GCNLSF_SET_STATUS:1
Sends message to each optr of a particular
notification list per GCNListSendToBlock, but
additionally saves the message as the list's
current "status". The "status" message is
automatically sent to any object adding itself to the
list at a later point in time.
GCNLSF_IGNORE_IF_STATUS_TRANSITIONING:1
Has no effect here. See GenApplicationClass for
its extension.
NOTE: If data block w/reference count is passed in, its in-use
count should be incremented by one before the call
to this routine, as this routine decrements the count
by one upon completion (and destroys the block if
count reaches zero)
RETURN: cx = # messages sent, if !GCNLSF_SET_STATUS
(event handle freed, data block freed when notification optrs
have processed it)
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/22/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListSendToList proc far
uses ax, bx, di
.enter
EC < call ECCheckGCNSend ; check ^hcx, dx >
EC < call ECCheckChunkArray >
push dx ; save block, if any, for end
; bp is "cache flag"
test bp, mask GCNLSF_SET_STATUS
jz afterCacheTest ; see if caching new event
mov di, ds:[si] ; get ptr to list header
inc ds:[di].GCNLH_statusCount ; bump count of # of status
; updates performed
; (do always, regardless of
; send optimizations)
; Optimization -- if same status message, & same data block, if in
; use, then we don't need to do an update at all.
;
mov bx, cx ; new event in bx
; new data in dx
mov ax, ds:[di].GCNLH_statusData ; old data in ax
mov di, ds:[di].GCNLH_statusEvent ; old event in di
call CompareStatusEvents ; See if status events are
; non-null, register based &
; identical
jnc afterSendNoCache ; if so, we're out of here
;nukeAndSend:
; Nuke old cached event & data block (if any)
;
mov di, ds:[si] ; get ptr to list header
mov bx, cx
xchg bx, ds:[di].GCNLH_statusEvent ; get old event, store new
tst bx
jz afterEventFreed
call ObjFreeMessage
afterEventFreed:
mov bx, dx
; inc in-use count for data,
; since will be referenced by
; cache
call MemIncRefCount
xchg bx, ds:[di].GCNLH_statusData ; get old data, store new
; don't need old anymore
call MemDecRefCount
afterCacheTest:
jcxz done ; quit if no event (this is
; used to clear the cache, &
; so is legit)
;
; This code used to count the # items in the list, and increment the
; ref count on the block depending upon how many items were in the
; list. I changed this (GCNLSendCallback now increments the ref count)
; as it would crash if items were added to the GCN list while we were
; in the middle of sending an event to the list - atw 4/19/93
;
;
if 0
mov bx, cx ; save event
call ChunkArrayGetCount ; cx <- count
xchg bx, cx ; bx <- count, cx <- event
;
; If message has extra data associated with it, store count of
; ODs to be notified -- this count is decremented once each time
; one of ODs acknowledges the notification (via superclass to
; ObjMetaGCNNotification). When the count reaches zero, the extra
; data block is freed.
;
tst dx
jz noExtraData
tst bx ; anyone listening?
jz afterSend ; no, so don't bother
push ds
LoadVarSeg ds
xchg bx, dx ; bx <- handle, dx <- count
add ds:[bx].HM_otherInfo, dx ; up count by number of optr's
xchg bx, dx ; on list
pop ds
;
; now, send the notification out
;
noExtraData:
endif
;
; CX <- event we are sending to the list
; DX <- block being sent out
;
mov di, 500 ; make sure that there is
call ThreadBorrowStackSpace ; enough stack space
push di
clr ax ;AX <- # items in the list
mov bx, cs
mov di, offset GCNLSendCallback ; bx:di = callback routine
call ChunkArrayEnum
mov_tr bx, ax ;BX <- # items in the list
pop di
call ThreadReturnStackSpace
EC < call ECCheckChunkArray >
;afterSend:
;
; now that everyone who wants to be notified has the event on their
; respective queues, free the original event
;
; ... unless we're caching it, in which case
; we won't free it at this time.
test bp, mask GCNLSF_SET_STATUS
jnz afterDoneWithEvent
afterSendNoCache:
xchg bx, cx ; bx <- message, cx <- count
call ObjFreeMessage
afterDoneWithEvent:
pop bx
call MemDecRefCount
done:
EC < call ECCheckChunkArray >
.leave
ret
GCNListSendToList endp
;
; pass:
; *ds:si - gcn list
; ds:di - gcn list element
; AX - running count of # items we've processed
; ^hcx - recorded event to send
; destination class is ignored
; dx - handle of block being sent
; bp - GCNListSendFlags
; return:
; carry - set to end enumeration
; destroyed:
; bx
;
GCNLSendCallback proc far
uses cx
.enter
mov bx, dx
call MemIncRefCount
mov bx, cx ; bx - event handle
mov cx, ds:[di].GCNLE_item.handle ; ^lcx:si - destination
mov si, ds:[di].GCNLE_item.chunk
call MessageSetDestination
; always use queue
; don't free event
mov di, mask MF_RECORD or mask MF_FIXUP_DS
test bp, mask GCNLSF_FORCE_QUEUE
jz dispatch
ornf di, mask MF_FORCE_QUEUE
dispatch:
call MessageDispatch
inc ax ;Increment count of # items in list
clc ; continue enumeration
.leave
ret
GCNLSendCallback endp
COMMENT @----------------------------------------------------------------------
FUNCTION: CompareStatusEvents
DESCRIPTION: Check to see if the new status event is just like the old,
so that we can avoid sending out the update message to
the GCNList.
CALLED BY: INTERNAL
GCNListSendToListCommon
PASS: bx - New status event
dx - New status block
di - Old status event
ax - Old status block
RETURN: carry - clear if safe to make the optimization & skip
sending out the update, set if we have to go
ahead & do it.
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 11/91 Initial version
------------------------------------------------------------------------------@
CompareStatusEvents proc near
uses ax, bx, cx, si, di, ds, es
.enter
tst bx ; Can't optimize null events, as
LONG jz noOptimize ; they aren't sent anyway
tst di
LONG jz noOptimize
LoadVarSeg ds, si ; ds, es <- dgroup
mov es, si ; so we can compare the handles
;
; compare the contents of the handles from the signature through
; the message number. exclude HE_bp as that's handled specially below
;
CheckHack <HE_handleSig eq 1 and HE_cx eq 2 and HE_dx eq 4 and \
HE_bp eq 8 and HE_method eq 6>
lea si, [bx].HE_handleSig ; si <- bx+1
inc di ; point to HE_handleSig
mov cx, HE_bp-HE_handleSig
repe cmpsb
jne noOptimize
;
; The two handles match in all the important particulars. Now make
; sure they're not SIG_EVENT_STACK, as we can't optimize events w/stack
; frames -- we don't compare stack data (& don't have reason to do
; so, since current use of status events revolves around around
; notification passing data blocks)
;
cmp ds:[bx].HE_handleSig, SIG_EVENT_REG
jne noOptimize
; ds:si = ds:bx.HE_bp
; es:di = es:orig_di.HE_bp
; ^hax = old data block
; ^hdx = new data block
; Now, the tricky stuff:
;
; if NewBlock=OldBlock {
; if new bp = old bp optimize else no optimize;
; } else {
; if either NewBlock or OldBlock zero no optimize;
; if NewBlock != new bp no optimize;
; if OldBlock != old bp no optimize;
; if data blocks = optimize, else no optimize.
; }
cmp dx, ax ; if blocks same...
jne blocksDifferent
cmpsw ; & bp's same, optimize.
je done ; (carry clear)
jmp noOptimize ; otherwise bail, as bps are not
; blocks, or if blocks aren't in
; use, don't match
blocksDifferent:
tst dx ; If one block null, the other not,
jz noOptimize ; can't optimize
tst ax
jz noOptimize
cmp dx, ds:[si] ; Make sure bp's store block handles
jne noOptimize
scasw
jne noOptimize
mov_tr si, ax ; ^hsi <- old data block
mov bx, dx ; If blocks different size, not same
mov ax, ds:[bx].HM_size
cmp ax, ds:[si].HM_size
jne noOptimize
mov cl, 3
shl ax, cl
mov_tr cx, ax ; cx = size (words)
call MemLock
mov ds, ax
mov bx, si
call MemLock
mov es, ax
clr si, di
repe cmpsw ; compare the masses
call MemUnlock ; preserves flags, thankfully
mov bx, dx
call MemUnlock
je done ; If block data same, opt possible
; (carry clear)
noOptimize:
stc ; Bummer. All that work for nothing.
done:
.leave
ret
CompareStatusEvents endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListCreateList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: create empty GCN list
CALLED BY: INTERNAL
FindGCNList
PASS: ds - segment of block to create new gcn list in
bx - size of one element in list (normally GCNListElement)
cx - size of list header (normally GCNListHeader)
RETURN: *ds:si - new gcn list chunk
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/23/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListCreateList proc far uses ax, bx, cx
.enter
mov al, mask OCF_DIRTY ; in case list is saved to state
mov bx, size GCNListElement ; size of one element in list
mov cx, size GCNListHeader ; size of list header
clr si
call ChunkArrayCreate ; *ds:si - new gcn list
.leave
ret
GCNListCreateList endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListAddToList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Adds element to general change notification list
CALLED BY: INTERNAL
GCNListAdd
GCNListAddToBlock
PASS: cx:dx - optr to add
*ds:si - gcn list to add to
RETURN: carry set if optr added
carry clear if optr is already there and not added
ds - updated to keep pointing to gcn list block, if moved
DESTROYED: none
WARNING: This routine MAY resize the LMem block, moving it on the
heap and invalidating stored segment pointers and current
register or stored offsets to it.
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/22/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListAddToList proc far
uses di
.enter
EC < call ECCheckChunkArray >
call GCNListFindItemInList
cmc ; carry clear if found,
; carry set if not found
jnc afterExists ; item already there
call ChunkArrayAppend ; ds:di = new item
call ObjMarkDirty
mov ds:[di].GCNLE_item.handle, cx ; save optr
mov ds:[di].GCNLE_item.chunk, dx
stc ; indicate item added
afterExists:
pushf ; save added flag
; Now, send cached event to this new optr
;
mov di, ds:[si]
tst ds:[di].GCNLH_statusEvent ; get event handle
jz afterStatusUpdate
push bx
push ds:[LMBH_handle]
mov bx, ds:[di].GCNLH_statusData
mov di, ds:[di].GCNLH_statusEvent
call DispatchStatusMessage
pop bx
call MemDerefDS
pop bx
afterStatusUpdate:
popf ; restore added flag
EC < call ECCheckChunkArray >
.leave
ret
GCNListAddToList endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DispatchStatusMessage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Dispatches the status message (if any) for the passed GCN list
CALLED BY: INTERNAL - GCNListAdd and GCNListAddToList
PASS: di - status event
bx - block of event data
^lcx:dx - OD to send status message to
RETURN: nada
DESTROYED: bx, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 10/18/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DispatchStatusMessage proc far
.enter
push ax, cx, dx, bp, si
call MemIncRefCount ; Inc in-use count for data
mov bx, di ; BX <- event handle
mov si, dx ; set ^lcx:si as destination
call MessageSetDestination
; don't free event
mov di, 500
call ThreadBorrowStackSpace
push di
mov di, mask MF_RECORD
call MessageDispatch
pop di
call ThreadReturnStackSpace
pop ax, cx, dx, bp, si
.leave
ret
DispatchStatusMessage endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListFindItemInList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: find optr in general change notification list
CALLED BY: INTERNAL
GCNListAddToList
GCNListRemoveFromList
PASS: cx:dx - optr to find (dx = 0 to match any chunk handle)
*ds:si - gcn list to search
RETURN: carry set if optr found
ds:di - item
carry clear if not found
ds - updated to keep pointing to gcn list block, if moved
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/22/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListFindItemInList proc far
uses ax, bx
.enter
EC < call ECCheckChunkArray >
mov bx, cs
mov di, offset GCNFindItemCallback
call ChunkArrayEnum
mov di, ax ; return item offset, in case found
.leave
ret
GCNListFindItemInList endp
;
; pass:
; *ds:si = array
; ds:di = element
; cx:dx = optr to find
; return:
; carry - set to end enumeration (optr found)
; ds:ax - offset to element found
; destroyed:
; none
;
GCNFindItemCallback proc far
mov ax, di ; save offset, in case found
cmp cx, ds:[di].GCNLE_item.handle
jne noMatch
tst dx ;handle wildcard
jz match
cmp dx, ds:[di].GCNLE_item.chunk
jne noMatch
match:
stc ; end enumeration
jmp done
noMatch:
clc ; continue enumeration
done:
ret
GCNFindItemCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListAddToBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Adds element to general change notification list
CALLED BY: GLOBAL
PASS: cx:dx - optr to add
bx:ax - GCNListType
bx - GCNLT_manuf
ax - GCNLT_type
GCNLTF_SAVE_TO_STATE flag
ds - segment of block containing GCN lists
di - chunk handle of list of lists
RETURN: carry set if optr added
carry clear if optr is already there and not added
DESTROYED: none
WARNING: This routine MAY resize the LMem block, moving it on the
heap and invalidating stored segment pointers and current
register or stored offsets to it.
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 07/01/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListAddToBlock proc far
uses si
.enter
EC < xchg si, di >
EC < call ECCheckChunkArray >
EC < xchg si, di >
stc ; create list if necessary
call GCNListFindListInBlock ; *ds:si - desired gcn list
call GCNListAddToList ; add cx:dx to *ds:si
jnc done ; already there, no change
mov si, di ; *ds:si = list of lists chunk
call ObjMarkDirty ; must mark list of lists as dirty
; since we changed one of
; its lists
done:
.leave
ret
GCNListAddToBlock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListFindListInBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Find appropriate general change notification list in list of
lists. Creates new list, if necessary and desired.
CALLED BY: GLOBAL
FindGCNList
GCNListAddToBlock
GCNListRemoveFromBlock
GCNListSendToBlock
PASS: ds - segment of gcn list block
di - chunk handle of list of lists
bx:ax - GCNListType
bx - GCNLT_manuf
ax - GCNLT_type
carry set to create list, if not currently existant
carry clear to not create list
RETURN: carry set if list found or created
*ds:si - desired gcn list
carry clear if list not found
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 02/02/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListFindListInBlock proc far
uses ax, bx, cx, dx, di, bp
.enter
mov si, di ; *ds:si - list of lists
EC < call ECCheckChunkArray >
mov cx, bx
mov dx, ax
lahf ; save create-list flag
mov bx, cs
mov di, offset FindListCallback
call ChunkArrayEnum ; *ds:bp - list, if found
jc done
sahf ; restore create-list flag
jnc done ; not found, do not create -> C clear
;
; create desired list
; *ds:si - list of lists array
; cx:dx - GCNListType
;
push si ; save lists of lists array
call GCNListCreateList ; *ds:si - new gcn list
mov bp, si ; *ds:bp - new gcn list
pop si ; *ds:si - list of lists
call ChunkArrayAppend ; ds:di = new list of lists item
call ObjMarkDirty ; new list of lists added
mov ds:[di].GCNLOLE_list, bp ; save new gcn list
mov ds:[di].GCNLOLE_ID.GCNLT_manuf, cx ; save gcn ID
mov ds:[di].GCNLOLE_ID.GCNLT_type, dx
stc ; indicate new list created
done:
mov si, bp ; return gcn list, in case
; found or created
.leave
ret
GCNListFindListInBlock endp
;
; pass:
; *ds:si - array
; ds:di - element
; cx:dx - GCNListType
; cx - GCNLT_manuf
; dx - GCNLT_type
; return:
; carry - set to end enumeration (list found)
; ds:*bp - chunk of GCN list, in case found
; destroyed:
; none
;
FindListCallback proc far uses ax, dx
.enter
cmp cx, ds:[di].GCNLOLE_ID.GCNLT_manuf
jne noMatch
mov ax, ds:[di].GCNLOLE_ID.GCNLT_type
andnf ax, not mask GCNLTF_SAVE_TO_STATE
andnf dx, not mask GCNLTF_SAVE_TO_STATE
cmp ax, dx
jne noMatch
stc ; end enumeration
mov bp, ds:[di].GCNLOLE_list ; return GCN list chunk
jmp done
noMatch:
clc ; continue enumeration
done:
.leave
ret
FindListCallback endp
ChunkCommon ends
;--------------------------------------------------
ChunkArray segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListAdd
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Adds element to general change notification list
CALLED BY: GLOBAL
PASS: cx:dx - optr to add
bx:ax - GCNListType
bx - GCNLT_manuf
ax - GCNLT_type
GCNLTF_SAVE_TO_STATE flag
RETURN: carry set if optr added
carry clear if optr is already there and not added
DESTROYED: none
WARNING: This routine MAY resize the LMem block, moving it on the
heap and invalidating stored segment pointers and current
register or stored offsets to it.
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/22/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListAdd proc far
uses ds, si, bx, di
.enter
call LockGCNBlock ; ds - segment of gcn list block
stc ; create list if necessary
call FindGCNList ; *ds:si - desired gcn list
; Grab the status event out of the GCNListHeader, and set it to zero,
; so GCNListAddToList will not send out the GCN notification. We want
; to send out the notifications after the GCN block has been unlocked,
; to avoid deadlocks (10/18/95 - atw)
mov di, ds:[si]
clr bx
xchg bx, ds:[di].GCNLH_statusEvent
mov di, ds:[di].GCNLH_statusData
xchg bx, di ;BX <- status data
;DI <- status event
; Add the object to the GCN list
call GCNListAddToList ; add cx:dx to *ds:si
; Restore the old status event
pushf ;Save carry returned from
; GCNListAddToList
mov si, ds:[si]
mov ds:[si].GCNLH_statusEvent, di
; Unlock the block containing the GCN lists
call UnlockGCNBlock ; (preserves flags)
; If there was a status event, we need to dispatch the status message
tst di
jz noStatusEvent
call DispatchStatusMessage
noStatusEvent:
popf
.leave
ret
GCNListAdd endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListRemoveFromBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove optr from general change notification list
CALLED BY: GLOBAL
PASS: cx:dx - optr to remove
bx:ax - GCNListType
bx - GCNLT_manuf
ax - GCNLT_type
ds - segment of block containing GCN lists
di - chunk handle of list of lists
RETURN: carry set if OD found and removed
carry clear if not found
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 07/01/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListRemoveFromBlock proc far uses si
.enter
EC < xchg si, di >
EC < call ECCheckChunkArray >
EC < xchg si, di >
clc ; do not create list
call GCNListFindListInBlock ; *ds:si - desired gcn list
jnc done ; list not found, return carry clear
call GCNListRemoveFromList ; remove cx:dx from *ds:si
jnc done ; not there, no change
mov si, di ; *ds:si = list of lists chunk
call ObjMarkDirty ; must mark list of lists as dirty
; since we changed one of
; its lists
done:
.leave
ret
GCNListRemoveFromBlock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListRemoveFromList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove optr from general change notification list
CALLED BY: INTERNAL
GCNListRemove
PASS: cx:dx - optr to remove
*ds:si - gcn list to remove from
RETURN: carry set if OD found and removed
carry clear if not found
ds - updated to keep pointing to gcn list block, if moved
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/22/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListRemoveFromList proc far
uses di
.enter
EC < call ECCheckChunkArray >
clc
pushf
removeLoop:
call GCNListFindItemInList ; ds:di = item, if found
; carry clear if not found
jnc done ; item not there
call ChunkArrayDelete
popf
stc
pushf
tst dx
jz removeLoop
done:
popf
EC < call ECCheckChunkArray >
.leave
ret
GCNListRemoveFromList endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListRecordAndSend
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: A system utility to make broadcasting things to a system
GCN list easier.
CALLED BY: GLOBAL
PASS: ax = message to broadcast
bx:si = manuf id:gcn list over which to broadcast it
cx, dx, bp = data for the message
di = GCNListSendFlags
RETURN: cx = number of messages sent out
DESTROYED: dx, bp, di, ax, si
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 5/25/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListRecordAndSend proc far
.enter
push di
mov di, mask MF_RECORD
call ObjMessage
mov cx, di
pop bp
mov_tr ax, si
clr dx ; no associated data block
call GCNListSend
.leave
ret
GCNListRecordAndSend endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListSend
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send message to each element of general change notification
list
CALLED BY: GLOBAL
PASS: bx:ax - GCNListType
bx - GCNLT_manuf
ax - GCNLT_type
^hcx - classed event to send
destination class is ignored
if sending extra data block:
dx - handle of extra data block
NOTE: handle is also stored in classed event
according to the parameters of the
message in the classed event
else:
dx - 0
bp - GCNListSendFlags
GCNLSF_SET_STATUS:1
Sends message to each optr of a particular
notification list per GCNListSendToBlock, but
additionally saves the message as the list's
current "status". The "status" message is
automatically sent to any object adding itself to the
list at a later point in time.
GCNLSF_IGNORE_IF_STATUS_TRANSITIONING:1
Has no effect here. See GenApplicationClass for
its extension.
NOTE: If block w/reference count is passed in, its in-use
count should be incremented by one before the call
to this routine, as this routine decrements the count
by one upon completion (and destroys the block if
count reaches zero)
RETURN: cx = # messages sent, if !GCNLSF_SET_STATUS
= event handle, if GCNLSF_SET_STATUS
(event handle freed, data block freed when notification optrs
have processed it)
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/22/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListSend proc far
push si, ds
EC < call ECCheckGCNSend >
call LockGCNBlock ; ds - segment of gcn list block
test bp, mask GCNLSF_SET_STATUS ; clears carry
jz goAheadAndFind ; if not caching, do not create list
; Change the owner to be the kernel, in case the sending geode exits,
; so the handle doesn't get freed out from under us.
jcxz noChangeOwner
push bx, ax
mov bx, cx
mov ax, handle 0
call HandleModifyOwner
pop bx, ax
noChangeOwner:
stc ; otherwise, force list to exist
goAheadAndFind:
call FindGCNList ; *ds:si - desired gcn list
jnc noList ; list not found, do nothing
; Change block to be owned by Kernel
; if it is going to be used in the
; system-wide GCN lists
;
; If sending notification message with data, change data block to
; be owned by kernel, so it doesn't get freed when thread that
; created it gets freed
;
tst dx ; any extra data block?
jz noDataBlock ; nope
mov bx, dx
mov ax, handle 0 ; change owner to kernel
call HandleModifyOwner
noDataBlock:
call GCNListSendToList
exit:
call UnlockGCNBlock
pop si, ds
ret
noList:
xchg bx, cx ; bx <- message sent, cx <- list manuf
call ObjFreeMessage
mov bx, dx ; bx <- data block
call MemDecRefCount
mov bx, cx ; bx <- list manuf
clr cx
jmp exit
GCNListSend endp
;
; pass:
; ^hcx - classed event to send
; if sending extra data block:
; dx - handle of extra data block
; NOTE: handle is also stored in classed event
; according to the parameters of the
; message in the classed event
; else:
; dx - 0
; destroyed:
; none
;
if ERROR_CHECK
ECCheckGCNSend proc far
uses ax, bx, cx, si, ds
.enter
test bp, not mask GCNListSendFlags
ERROR_NZ BAD_FLAGS_RESERVED_MUST_BE_0
;
; get event info
;
mov bx, cx ; bx - event
call ObjGetMessageInfo ; ax - method, cx:si = destination
;we won't check this since the destination is documented as being ignored
; tst cx
; ERROR_NZ GCN_SEND_DESTINATION_MUST_BE_ZERO
; NOTE that *any* message can be sent via the GCN list so no
; error checking can be done on the message
;
if (0)
;
; make sure message is a MetaGCNMethod, or one of the other
; standard messages uses
;
cmp ax, MSG_META_NOTIFY
je afterMessageCheck
cmp ax, MSG_META_NOTIFY_WITH_DATA_BLOCK
je afterMessageCheck
cmp ax, first MetaGCNMessages
ERROR_B GCN_ILLEGAL_NOTIFICATION_MESSAGE
cmp ax, MetaGCNMessages
ERROR_AE GCN_ILLEGAL_NOTIFICATION_MESSAGE
afterMessageCheck:
endif
;
; check to ensure that the predefined messages that are supposed
; to have data blocks, do indeed have data blocks
;
cmp ax, MSG_NOTIFY_FILE_CHANGE
je haveDataBlock
cmp ax, MSG_META_NOTIFY_WITH_DATA_BLOCK
jne done
haveDataBlock:
tst dx
jz done
mov bx, dx
mov ax, MGIT_OTHER_INFO ; get reference count
call MemGetInfo
cmp ax, 1024
ERROR_A GCN_BAD_USAGE_COUNT
done:
.leave
ret
ECCheckGCNSend endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FindGCNList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Find appropriate general change notification list in list of
lists. Creates new list, if necessary and desired.
CALLED BY: INTERNAL
GCNListAdd
GCNListRemove
GCNListSend
PASS: ds - segment of gcn list block
bx:ax - GCNListType
bx - GCNLT_manuf
ax - GCNLT_type
carry set to create list, if not currently existant
carry clear to not create list
RETURN: carry set if list found or created
*ds:si - desired gcn list
carry clear if list not found
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 02/02/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FindGCNList proc far
uses di
.enter
mov di, ds:[GCNLBH_listOfLists] ; *ds:di - list of lists
call GCNListFindListInBlock
.leave
ret
FindGCNList endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListClearList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Nukes all the ODs in the passed list
CALLED BY: EndGeos
PASS: bx:ax - GCNListType
bx - GCNLT_manuf
ax - GCNLT_type
RETURN: nada
DESTROYED: ax, bx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 8/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListClearList proc far uses ds, si, cx
.enter
call LockGCNBlock
call FindGCNList
jnc noList
; Nuke all elements in this list
clr ax
mov cx, -1
call ChunkArrayDeleteRange
noList:
call UnlockGCNBlock
.leave
ret
GCNListClearList endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListCreateBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: create list of lists in given block
CALLED BY: GLOBAL
PASS: ds - segment of LMem block to contain GCN list structure
RETURN: *ds:si - GCN list of lists chunk
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 7/01/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListCreateBlock proc far uses ax, bx, cx
.enter
mov al, mask OCF_DIRTY ; in case list is saved to state
mov bx, size GCNListOfListsElement ; size of element
mov cx, size GCNListOfListsHeader ; size of header
clr si
call ChunkArrayCreate ; *ds:si - new gcn list
.leave
ret
GCNListCreateBlock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LockGCNBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: lock general change notification list block
CALLED BY: INTERNAL
PASS: nothing
RETURN: ds - segment of general change notification list block
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
We need to grab the semaphore as we can't have the block
moved by other threads that might access the GCN block
and do LMem operations.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/22/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LockGCNBlock proc near
uses ax, bx
.enter
mov bx, handle GCNListBlock
call MemPLock
mov ds, ax
.leave
ret
LockGCNBlock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UnlockGCNBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: unlock general change notification list block
CALLED BY: INTERNAL
PASS: ds - segment of general change notification list block
RETURN: nothing
DESTROYED: nothing
(preserves flags)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/22/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UnlockGCNBlock proc near uses bx
.enter
mov bx, handle GCNListBlock
call MemUnlockV
.leave
ret
UnlockGCNBlock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListRelocateBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Relocate general change notification lists in given block
CALLED BY: GLOBAL
PASS: ds - segment of block containing GCN lists
di - chunk handle of list of lists
dx - handle of block containing relocation
RETURN: nothing
DESTROYED: none
WARNING: This routine MAY resize the LMem block, moving it on the
heap and invalidating stored segment pointers and current
register or stored offsets to it.
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/28/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListRelocateBlock proc far uses si, bp
.enter
mov bp, 0 ; relocate
call RelocateBlockCommon
.leave
ret
GCNListRelocateBlock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListUnRelocateBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Unrelocate general change notification lists in given block
CALLED BY: GLOBAL
PASS: ds - segment of block containing GCN lists
di - chunk handle of list of lists
dx - handle of block containing relocation
RETURN: carry clear if list of lists has lists saved to state
carry set if list of lists has no lists saved to state
and is thus destroyed
DESTROYED: none
WARNING: This routine MAY resize the LMem block, moving it on the
heap and invalidating stored segment pointers and current
register or stored offsets to it.
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/28/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListUnRelocateBlock proc far uses ax, si, bp
.enter
cmp {word} ds:[di], -1 ; empty list of lists?
je done ; yes, don't free (assume in resource)
; (carry clear)
mov bp, 1 ; unrelocate
call RelocateBlockCommon ; returns *ds:si = list of lists
call ChunkArrayGetCount ; cx = count
tst cx ; anything left?
; (clears carry)
jnz done ; yes, leave list of lists alone
mov ax, si
call LMemFree ; else, free list of lists chunk
stc ; indicate list of lists destroyed
done:
.leave
ret
GCNListUnRelocateBlock endp
;
; pass:
; *ds:di - ListOfLists array
; dx - handle of block containing relocation
; bp - 0 for relocation, non-zero for unrelocation
; return:
; *ds:si - ListOfLists array
; destroyed:
; nothing
;
RelocateBlockCommon proc near uses bx, di
.enter
mov si, di ; *ds:si = list of lists
cmp {word} ds:[si], -1 ; empty list?
je done
EC < call ECCheckChunkArray >
mov bx, cs
mov di, offset RelocateBlockCallback
call ChunkArrayEnum
done:
.leave
ret
RelocateBlockCommon endp
;
; pass:
; *ds:si - ListOfLists array
; ds:di - ListsOfLists element
; dx - handle of block containing relocation
; bp - 0 for relocation, non-zero for unrelocation
; return:
; carry - clear to continue enumeration
; destroyed:
; bx, di
;
RelocateBlockCallback proc far uses ax
.enter
mov bx, si ; save list of lists chunk
mov si, ds:[di].GCNLOLE_list ; *ds:si = GCN list
tst bp
jnz unreloc
call GCNListRelocateList
jmp short done
unreloc:
test ds:[di].GCNLOLE_ID.GCNLT_type, mask GCNLTF_SAVE_TO_STATE
jz freeList ; if not saved to state, free it
;
; deal with undirty resource GCN list (it will have been resized to 0
; by CompactObjBlock). We must NOT free the thing, and must especially
; NOT free the list of lists entry for it.
;
cmp {word} ds:[si], -1 ; undirty resource list?
je done ; if so, leave it alone
;why might this happen?
; call ChunkArrayGetCount ; cx = # elements
; jcxz freeList ; no elements, just free list
call GCNListUnRelocateList
jmp short done
freeList:
push bx ; *ds:bx = list of lists
mov bx, ds:[bx]
sub di, bx ; di = offset from start
call GCNListDestroyList
pop si ; *ds:si = list of lists
mov bx, ds:[si]
add di, bx ; rederefence into element
call ChunkArrayDelete ; delete list of lists entry for the
; deleted list
call ObjMarkDirty
done:
clc ; continue enumeration
.leave
ret
RelocateBlockCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListRelocateList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Relocate general change notification list
CALLED BY: INTERNAL
GCNListRelocateBlock
PASS: *ds:si - gcn list to relocate
dx - handle of block containing relocation
RETURN: ds - updated to keep pointing to gcn list block, if moved
DESTROYED: none
WARNING: This routine MAY resize the LMem block, moving it on the
heap and invalidating stored segment pointers and current
register or stored offsets to it.
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/28/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListRelocateList proc far uses bp
.enter
mov bp, 0 ; signal relocate
call RelocateListCommon
.leave
ret
GCNListRelocateList endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListUnRelocateList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Unrelocate general change notification list
CALLED BY: INTERNAL
GCNListUnRelocateBlock
PASS: *ds:si - gcn list to unrelocate
dx - handle of block containing relocation
RETURN: ds - updated to keep pointing to gcn list block, if moved
DESTROYED: none
WARNING: This routine MAY resize the LMem block, moving it on the
heap and invalidating stored segment pointers and current
register or stored offsets to it.
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/28/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListUnRelocateList proc far uses bp, bx, di
.enter
mov bp, 1
call RelocateListCommon
call FreeEventAndData
.leave
ret
GCNListUnRelocateList endp
RelocateListCommon proc near uses ax, bx, cx, di
.enter
cmp {word} ds:[si], -1 ; empty list?
je done
EC < call ECCheckChunkArray >
mov bx, cs
mov di, offset RelocateListCallback ; bx:di = callback routine
call ChunkArrayEnum
EC < call ECCheckChunkArray >
done:
.leave
ret
RelocateListCommon endp
;
; pass:
; *ds:si - gcn list
; ds:di - gcn list element
; dx - handle of block containing relocation
; bp - 0 for relocation, non-zero for unrelocation
; return:
; carry - clear to continue enumeration
; destroyed:
; ax, bx, cx
;
RelocateListCallback proc far
mov bx, dx ; bx = handle of block w/relocation
mov cx, ds:[di].GCNLE_item.handle ; cx = reloc/unreloc handle
mov al, RELOC_HANDLE
tst bp
jnz unreloc
call ObjDoRelocation ; XXX: ignore error
jmp short relocCommon
unreloc:
EC < push ax, bx >
EC < mov bx, ds:[LMBH_handle] ; bx = GCN list block >
EC < call MemOwnerFar ; bx = GCN list owner >
EC < mov ax, bx ; ax = GCN list owner >
EC < mov bx, cx ; bx = unreloc handle >
EC < call MemOwnerFar ; bx = unreloc handle owner >
EC < cmp bx, ax >
EC < ERROR_NE GCN_UNRELOCATING_GCN_LIST_WITH_UNOWNED_OPTR >
EC < pop ax, bx >
call ObjDoUnRelocation ; XXX: ignore error
relocCommon:
mov ds:[di].GCNLE_item.handle, cx ; cx = reloc/unreloc handle
clc ; continue enumeration
ret
RelocateListCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListRemove
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove optr from general change notification list
CALLED BY: GLOBAL
PASS: cx:dx - optr to remove
bx:ax - GCNListType
bx - GCNLT_manuf
ax - GCNLT_type
RETURN: carry set if OD found and removed
carry clear if not found
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/22/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListRemove proc far
uses ds, si
.enter
push ax, bx
mov bx, handle GCNListBlock
call MemPLock
mov ds, ax
pop ax, bx ; ds - segment of gcn list block
clc ; do not create list
call FindGCNList ; *ds:si - desired gcn list
jnc done ; list not found, return carry clear
call GCNListRemoveFromList ; remove cx:dx from *ds:si
done:
push bx
mov bx, handle GCNListBlock
call MemUnlockV
pop bx
.leave
ret
GCNListRemove endp
ChunkArray ends
;-------------------
ObjectFile segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListDestroyBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Cleanly destroys a GCN lists of lists & all lists on it.
CALLED BY: GLOBAL
PASS: ds - segment of LMem block to contain GCN list structure
RETURN: *ds:di - GCN list of lists chunk
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 11/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListDestroyBlock proc far
uses ax, bx, si, di
.enter
mov si, di ; *ds:si - list of lists
mov bx, cs
mov di, offset FreeListCallback
call ChunkArrayEnum
mov ax, si ; nuke list of lists
call LMemFree
.leave
ret
GCNListDestroyBlock endp
;
; pass:
; *ds:si - array
; ds:di - element
; return:
; carry - set to end enumeration
; destroyed:
; none
;
FreeListCallback proc far uses si, di
.enter
mov si, ds:[di].GCNLOLE_list ; get chunk of list
call GCNListDestroyList
clc ; continue enumeration
.leave
ret
FreeListCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GCNListDestroyList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Cleanly destroys a GCN list
CALLED BY: GLOBAL
PASS: *ds:si - GCN list to destroy
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 11/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GCNListDestroyList proc far uses ax, bx, di, si
.enter
cmp {word} ds:[si], -1 ; empty list?
je free
EC < call ECCheckChunkArray >
;
; nuke cached event, dec block in-use count
;
call FreeEventAndData
free:
mov ax, si
call LMemFree ; nuke the list chunk itself
.leave
ret
GCNListDestroyList endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FreeEventAndData
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Frees status event and status data for GCN list
CALLED BY: GLOBAL
PASS: *ds:si - GCN list
RETURN: nothing
DESTROYED: bx, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 7/13/92 Broken out from GCNListDestroyList for use
in GCNListUnRelocateList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FreeEventAndData proc far
mov di, ds:[si] ; deref
clr bx
xchg bx, ds:[di].GCNLH_statusEvent
tst bx
jz afterEvent
call ObjFreeMessage
afterEvent:
clr bx
xchg bx, ds:[di].GCNLH_statusData ; dec data block reference
call MemDecRefCount
ret
FreeEventAndData endp
ObjectFile ends
|
programs/oeis/047/A047532.asm | jmorken/loda | 1 | 103616 | <gh_stars>1-10
; A047532: Numbers that are congruent to {0, 2, 3, 7} mod 8.
; 0,2,3,7,8,10,11,15,16,18,19,23,24,26,27,31,32,34,35,39,40,42,43,47,48,50,51,55,56,58,59,63,64,66,67,71,72,74,75,79,80,82,83,87,88,90,91,95,96,98,99,103,104,106,107,111,112,114,115,119,120,122,123
mov $1,$0
add $0,25
div $0,2
mov $2,$0
mul $0,2
gcd $2,2
add $0,$2
add $1,$0
sub $1,26
|
oeis/022/A022120.asm | neoneye/loda-programs | 11 | 165897 | ; A022120: Fibonacci sequence beginning 3, 7.
; Submitted by <NAME>(s3)
; 3,7,10,17,27,44,71,115,186,301,487,788,1275,2063,3338,5401,8739,14140,22879,37019,59898,96917,156815,253732,410547,664279,1074826,1739105,2813931,4553036,7366967,11920003,19286970,31206973,50493943,81700916,132194859
mov $1,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
add $3,3
lpe
add $3,$2
mov $0,$3
add $0,3
|
test/Fail/WithoutK9.agda | KDr2/agda | 0 | 16115 | <gh_stars>0
{-# OPTIONS --cubical-compatible --show-implicit #-}
-- {-# OPTIONS -v tc.data:100 #-}
module WithoutK9 where
module Eq {A : Set} (x : A) where
data _≡_ : A → Set where
refl : _≡_ x
open Eq
module Bad {A : Set} {x : A} where
module E = Eq x
weak-K : {y : A} (p q : E._≡_ y) (α β : p ≡ q) → α ≡ β
weak-K refl .refl refl refl = refl
|
src/constraint_engine.adb | alex-87/ConstraintEngine | 0 | 26082 | pragma Ada_2012;
with ADA.Containers.Vectors;
package body Constraint_Engine is
-------------------
-- Find_Solution --
-------------------
function Find_Solution
(Self : in Type_Problem)
return Type_Problem
is
Next_P : Type_Problem := Self;
Inc_Next : Boolean := False;
begin
if Next_P.Check_Contradiction then
raise Contradicted_Contraint
with "Contradicted constraint detected.";
end if;
if Next_P.Is_Valid_Solution then
return Next_P;
end if;
loop
for Var_Cursor in Next_P.Var_List.First_Index .. Next_P.Var_List.Last_Index loop
if Var_Cursor = 1 then
if Next_P.Var_List( Next_P.Var_List.Last_Index ).Curr_Solution >= Next_P.Var_List( Next_P.Var_List.Last_Index ).Top_Interval and
Next_P.Var_List( 1 ).Curr_Solution >= Next_P.Var_List( 1 ).Top_Interval
then
raise No_Solution
with "No solution can be found.";
end if;
if Next_P.Var_List( 1 ).Curr_Solution < Next_P.Var_List( 1 ).Top_Interval then
Next_P.Var_List( 1 ).Curr_Solution := Next_P.Var_List( 1 ).Curr_Solution + 1;
if Next_P.Is_Valid_Solution then
return Next_P;
end if;
else
Inc_Next := True;
Next_P.Var_List( 1 ).Curr_Solution := Next_P.Var_List( 1 ).Low_Interval - 1;
end if;
else
if Inc_Next and Next_P.Var_List( Var_Cursor ).Curr_Solution < Next_P.Var_List( Var_Cursor ).Top_Interval then
Next_P.Var_List( Var_Cursor ).Curr_Solution := Next_P.Var_List( Var_Cursor ).Curr_Solution + 1;
Inc_Next := False;
else
if Inc_Next then
Next_P.Var_List( Var_Cursor ).Curr_Solution := Next_P.Var_List( Var_Cursor ).Low_Interval;
Inc_Next := True;
end if;
end if;
end if;
end loop;
end loop;
end Find_Solution;
-----------------------
-- Is_Valid_Solution --
-----------------------
function Is_Valid_Solution
(Self : Type_Problem)
return Boolean
is
Cur_V1 : Integer := 0;
Cur_V2 : Integer := 0;
begin
for I in Self.Ctr_List.First_Index .. Self.Ctr_List.Last_Index loop
Cur_V1 := Self.Var_List( Self.Ctr_List(I).V1_Position ).Curr_Solution;
if Self.Ctr_List(I).Is_Var_Ctr then
Cur_V2 := Self.Var_List( Self.Ctr_List(I).V2_Position ).Curr_Solution;
else
Cur_V2 := Self.Ctr_List(I).V;
end if;
if not Is_Valid_Relation(Self, Cur_V1, Self.Ctr_List(I).Rel, Cur_V2) then
return False;
end if;
end loop;
return True;
end Is_Valid_Solution;
-----------------------
-- Is_Valid_Relation --
-----------------------
function Is_Valid_Relation
(Self : Type_Problem; V_1 : Integer; Rel : Enum_Relational; V_2 : Integer)
return Boolean
is
begin
case Rel is
when IS_EQUAL => return V_1 = V_2;
when IS_LESS_EQUAL => return V_1 <= V_2;
when IS_LESS => return V_1 < V_2;
when IS_MORE_EQUAL => return V_1 >= V_2;
when IS_MORE => return V_1 > V_2;
when IS_INEQUAL => return V_1 /= V_2;
when others => return False;
end case;
end Is_Valid_Relation;
-------------------------
-- Check_Contradiction --
-------------------------
function Check_Contradiction
(Self : Type_Problem)
return Boolean
is
Current_Fixed_C : Natural := 0;
Current_Fixed_I : Natural := 0;
begin
for Current_Variable in Self.Var_List.First_Index .. Self.Var_List.Last_Index loop
for Current_Constraint in Self.Ctr_List.First_Index .. Self.Ctr_List.Last_Index loop
if Self.Ctr_List.Element(Current_Constraint).Is_Var_Ctr then
if Self.Ctr_List.Element(Current_Constraint).V1_Position = Current_Variable or
Self.Ctr_List.Element(Current_Constraint).V2_Position = Current_Variable then
if
Self.Ctr_List.Element(Current_Constraint).Rel = IS_EQUAL or
Self.Ctr_List.Element(Current_Constraint).Rel = IS_INEQUAL
then
Current_Fixed_C := Current_Fixed_C + 1;
end if;
end if;
else
if
Self.Ctr_List.Element(Current_Constraint).Rel = IS_EQUAL or
Self.Ctr_List.Element(Current_Constraint).Rel = IS_INEQUAL
then
Current_Fixed_I := Current_Fixed_I + 1;
end if;
end if;
end loop;
if Current_Fixed_C = 2 then
return True;
end if;
if Current_Fixed_I > 1 then
return True;
end if;
Current_Fixed_C := 0;
Current_Fixed_I := 0;
end loop;
return False;
end Check_Contradiction;
-------------
-- Get_Var --
-------------
function Get_Var(Self : Type_Problem) return Var_Vector.Vector
is
begin
return Self.Var_List;
end;
-------------
-- Add_Var --
-------------
procedure Add_Var
(Self : in out Type_Problem; Low_Interval : Integer; Top_Interval : Integer)
is
New_Var : Type_Variable := (Low_Interval, Top_Interval, Low_Interval);
begin
Self.Var_List.Append( New_Var );
Self.Var_Cur := Self.Var_Cur + 1;
end Add_Var;
------------------------
-- Add_Constraint_Var --
------------------------
procedure Add_Constraint_Var
(Self : in out Type_Problem;
V1_Position : Positive;
Rel : Enum_Relational;
V2_Position : Positive)
is
C : Type_Constraint := (V1_Position, Rel, V2_Position, 0, True);
begin
Self.Ctr_List.Append( C );
Self.Ctr_Cur := Self.Ctr_Cur + 1;
end Add_Constraint_Var;
---------------------------------
-- Add_Constraint_Var_Multiple --
---------------------------------
procedure Add_Constraint_Var_Multiple
(Self : in out Type_Problem;
V_All_Position : Type_Array_Position;
Rel : Enum_Relational)
is
begin
for Current_A in V_All_Position'Range loop
for Current_B in Current_A .. V_All_Position'Last loop
if V_All_Position( Current_A ) /= V_All_Position( Current_B ) then
Self.Add_Constraint_Var(V1_Position => V_All_Position( Current_A ),
Rel => Rel,
V2_Position => V_All_Position( Current_B ) );
end if;
end loop;
end loop;
end Add_Constraint_Var_Multiple;
------------------------
-- Add_Constraint_Int --
------------------------
procedure Add_Constraint_Int
(Self : in out Type_Problem;
V1_Position : Positive;
Rel : Enum_Relational;
V : Integer)
is
C : Type_Constraint := (V1_Position, Rel, 1, V, False);
begin
if Rel = IS_EQUAL then
Self.Var_List(V1_Position).Top_Interval := V;
Self.Var_List(V1_Position).Low_Interval := V;
Self.Var_List(V1_Position).Curr_Solution := V;
end if;
Self.Ctr_List.Append( C );
Self.Ctr_Cur := Self.Ctr_Cur + 1;
end Add_Constraint_Int;
---------------------------------
-- Add_Constraint_Int_Multiple --
---------------------------------
procedure Add_Constraint_Int_Multiple
(Self : in out Type_Problem;
V_All_Position : Type_Array_Position;
Rel : Enum_Relational;
V : Integer)
is
begin
for Current_A in V_All_Position'Range loop
Self.Add_Constraint_Int(V1_Position => V_All_Position( Current_A ),
Rel => Rel,
V => V );
end loop;
end Add_Constraint_Int_Multiple;
end Constraint_Engine;
|
programs/oeis/183/A183873.asm | karttu/loda | 1 | 4306 | ; A183873: n-1+ceiling((1/5)n^2); complement of A183872.
; 1,2,4,7,9,13,16,20,25,29,35,40,46,53,59,67,74,82,91,99,109,118,128,139,149,161,172,184,197,209,223,236,250,265,279,295,310,326,343,359,377,394,412,431,449,469,488,508,529,549,571,592,614,637,659,683,706,730,755,779,805,830,856,883,909,937,964,992,1021,1049,1079,1108,1138,1169,1199,1231,1262,1294,1327,1359
mov $1,$0
add $0,7
mul $1,$0
add $1,5
div $1,5
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt12.adb | best08618/asylo | 7 | 28448 | -- { dg-do run }
-- { dg-options "-O2" }
with Opt12_Pkg; use Opt12_Pkg;
procedure Opt12 is
Static_Target : Static_Integer_Subtype;
begin
Static_Target := Static_Integer_Subtype(Fix_Half);
if not Equal(Static_Target, 1) then
raise Program_Error;
end if;
end Opt12;
|
Borland/CBuilder5/Source/RTL/source/math/fabs.asm | TrevorDArcyEvans/DivingMagpieSoftware | 1 | 926 | <filename>Borland/CBuilder5/Source/RTL/source/math/fabs.asm
;[]-----------------------------------------------------------------[]
;| FABS.ASM -- absolute value |
;[]-----------------------------------------------------------------[]
;
; C/C++ Run Time Library - Version 10.0
;
; Copyright (c) 1991, 2000 by Inprise Corporation
; All Rights Reserved.
;
; $Revision: 9.0 $
;----------------------------------------------------------------------
; function(s)
; fabs - absolute value
;----------------------------------------------------------------------
include RULES.ASI
; Segments Definitions
Header@
;--------------------------------------------------------------------------
;
;Name fabs - absolute value
;
;Usage double fabs(double x);
;
;Prototype in math.h
;
;Description fabs calculates the absolute value of x, which may have any
; value.
;
;Return value fabs returns the absolute value of x.
;
;--------------------------------------------------------------------------
Code_Seg@
Func@ fabs, _EXPFUNC, _RTLENTRY, <double x>
Link@
FWAIT
and BY0 (x [7]), 7Fh ; remove any sign bit
FLD x.double ; return x
Unlink@
Return@
EndFunc@ fabs
Code_EndS@
end
|
Library/GrObj/UI/uiGradientFillControl.asm | steakknife/pcgeos | 504 | 174465 | <filename>Library/GrObj/UI/uiGradientFillControl.asm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: uiGradientFillControl.asm
AUTHOR: <NAME>
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 24 feb 1992 Initial version.
DESCRIPTION:
Code for the GrObjGradientFillControlClass
$Id: uiGradientFillControl.asm,v 1.1 97/04/04 18:06:12 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjUIControllerCode segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: GrObjGradientFillControlGetInfo --
MSG_GEN_CONTROL_GET_INFO for GrObjGradientFillControlClass
DESCRIPTION: Return group
PASS:
*ds:si - instance data
es - segment of GrObjGradientFillControlClass
ax - The message
cx:dx - GenControlBuildInfo structure to fill in
RETURN:
none
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 10/31/91 Initial version
------------------------------------------------------------------------------@
GrObjGradientFillControlGetInfo method dynamic GrObjGradientFillControlClass,
MSG_GEN_CONTROL_GET_INFO
mov si, offset GOGFC_dupInfo
call CopyDupInfoCommon
ret
GrObjGradientFillControlGetInfo endm
GOGFC_dupInfo GenControlBuildInfo <
mask GCBF_SUSPEND_ON_APPLY, ; GCBI_flags
GOGFC_IniFileKey, ; GCBI_initFileKey
GOGFC_gcnList, ; GCBI_gcnList
length GOGFC_gcnList, ; GCBI_gcnCount
GOGFC_notifyList, ; GCBI_notificationList
length GOGFC_notifyList, ; GCBI_notificationCount
GOGFCName, ; GCBI_controllerName
handle GrObjGradientFillControlUI, ; GCBI_dupBlock
GOGFC_childList, ; GCBI_childList
length GOGFC_childList, ; GCBI_childCount
GOGFC_featuresList, ; GCBI_featuresList
length GOGFC_featuresList, ; GCBI_featuresCount
GOGFC_DEFAULT_FEATURES, ; GCBI_defaultFeatures
0, ; GCBI_dupBlock
0, ; GCBI_childList
0, ; GCBI_childCount
0, ; GCBI_featuresList
0, ; GCBI_featuresCount
0, ; GCBI_defaultFeatures
GOGFC_helpContext> ; GCBI_helpContext
if FULL_EXECUTE_IN_PLACE
GrObjControlInfoXIP segment resource
endif
GOGFC_helpContext char "dbGradient", 0
GOGFC_IniFileKey char "GrObjGradientFill", 0
GOGFC_gcnList GCNListType \
<MANUFACTURER_ID_GEOWORKS, GAGCNLT_APP_TARGET_NOTIFY_GROBJ_GRADIENT_ATTR_CHANGE>
GOGFC_notifyList NotificationType \
<MANUFACTURER_ID_GEOWORKS, GWNT_GROBJ_GRADIENT_ATTR_CHANGE>
;---
GOGFC_childList GenControlChildInfo \
<offset GrObjGradientTypeList, mask GOGFCF_HORIZONTAL_GRADIENT or \
mask GOGFCF_VERTICAL_GRADIENT or \
mask GOGFCF_RADIAL_RECT_GRADIENT or \
mask GOGFCF_RADIAL_ELLIPSE_GRADIENT, 0>,
<offset GrObjNumGradientIntervalsValue, mask GOGFCF_NUM_INTERVALS, mask GCCF_IS_DIRECTLY_A_FEATURE>
GOGFC_featuresList GenControlFeaturesInfo \
<offset GrObjNumGradientIntervalsValue, NumGradientIntervalsName, 0>,
<offset RadialEllipseGradientItem, RadialEllipseGradientName, 0>,
<offset RadialRectGradientItem, RadialRectGradientName, 0>,
<offset VerticalGradientItem, VerticalGradientName, 0>,
<offset HorizontalGradientItem, HorizontalGradientName, 0>
if FULL_EXECUTE_IN_PLACE
GrObjControlInfoXIP ends
endif
COMMENT @----------------------------------------------------------------------
MESSAGE: GrObjGradientFillControlUpdateUI -- MSG_GEN_CONTROL_UPDATE_UI
for GrObjGradientFillControlClass
DESCRIPTION: Handle notification of type change
PASS:
*ds:si - instance data
es - segment of GrObjGradientFillControlClass
ax - MSG_GEN_CONTROL_UPDATE_UI
RETURN: nothing
DESTROYED: ax
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 11 feb 1992 Initial version
------------------------------------------------------------------------------@
GrObjGradientFillControlUpdateUI method dynamic GrObjGradientFillControlClass,
MSG_GEN_CONTROL_UPDATE_UI
uses cx, dx
.enter
mov bx, ss:[bp].GCUUIP_dataBlock ;bx <- notification block
call MemLock
mov es, ax
mov cl, es:[GONGAC_type]
mov ax, es:[GONGAC_numIntervals]
mov dl, es:[GONGAC_diffs]
call MemUnlock
mov bx, ss:[bp].GCUUIP_childBlock
mov si, offset GrObjGradientTypeList
push ax, dx
clr ch
andnf dx, mask GGAD_MULTIPLE_TYPES
test ss:[bp].GCUUIP_features,mask GOGFCF_HORIZONTAL_GRADIENT or \
mask GOGFCF_VERTICAL_GRADIENT or \
mask GOGFCF_RADIAL_RECT_GRADIENT or \
mask GOGFCF_RADIAL_ELLIPSE_GRADIENT
jz afterGradientType
mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
clr di
call ObjMessage
afterGradientType:
test ss:[bp].GCUUIP_features, mask GOGFCF_NUM_INTERVALS
pop dx, bp
jz done
clr cx
andnf bp, mask GGAD_MULTIPLE_INTERVALS
mov si, offset GrObjNumGradientIntervalsValue
mov ax, MSG_GEN_VALUE_SET_VALUE
clr di
call ObjMessage
done:
.leave
ret
GrObjGradientFillControlUpdateUI endm
GrObjUIControllerCode ends
GrObjUIControllerActionCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGradientFillControlSetNumberOfGradientIntervals
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: GrObjGradientFillControl method for MSG_GOGFC_SET_NUMBER_OF_GRADIENT_INTERVALS
Called by:
Pass: *ds:si = GrObjGradientFillControl object
ds:di = GrObjGradientFillControl instance
dx.cx - number of intervals
Return: nothing
Destroyed: ax, bx, di
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon Feb 24, 1992 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGradientFillControlSetNumberOfGradientIntervals method dynamic GrObjGradientFillControlClass, MSG_GOGFC_SET_NUMBER_OF_GRADIENT_INTERVALS
.enter
mov cx, dx
mov ax, MSG_GO_SET_NUMBER_OF_GRADIENT_INTERVALS
call GrObjControlOutputActionRegsToGrObjs
.leave
ret
GrObjGradientFillControlSetNumberOfGradientIntervals endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGradientFillControlSetGradientType
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: GrObjGradientFillControl method for MSG_GOGFC_SET_GRADIENT_TYPE
Called by:
Pass: *ds:si = GrObjGradientFillControl object
ds:di = GrObjGradientFillControl instance
cl - GrObjGradientType
Return: nothing
Destroyed: ax, bx, di
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon Feb 24, 1992 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGradientFillControlSetGradientType method dynamic GrObjGradientFillControlClass, MSG_GOGFC_SET_GRADIENT_TYPE
.enter
cmp cx, GIGS_NONE
jne setType
mov cl, GOGT_NONE
setType:
mov ax, MSG_GO_SET_GRADIENT_TYPE
call GrObjControlOutputActionRegsToGrObjs
.leave
ret
GrObjGradientFillControlSetGradientType endm
GrObjUIControllerActionCode ends
|
oeis/028/A028181.asm | neoneye/loda-programs | 11 | 246968 | <filename>oeis/028/A028181.asm
; A028181: Expansion of 1/((1-5x)(1-7x)(1-8x)(1-10x)).
; Submitted by <NAME>
; 1,30,569,8730,118461,1484910,17624209,201130050,2229604421,24178830390,257814842649,2713159309770,28259514317581,291954572713470,2996779685401889,30602208691495890,311213315402041941
mov $1,1
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
mul $1,5
sub $2,1
sub $0,$2
seq $0,19928 ; Expansion of 1/((1-5x)(1-7x)(1-8x)).
add $0,$1
add $1,$0
lpe
mov $0,$1
|
oeis/015/A015169.asm | neoneye/loda-programs | 11 | 176449 | <filename>oeis/015/A015169.asm<gh_stars>10-100
; A015169: Sum of (Gaussian) q-binomial coefficients for q=-6.
; Submitted by <NAME>
; 1,2,-3,64,779,84438,-5889407,3927676076,1656518279511,6600296688949762,-16680688702495266643,399061333268551884767064,6052502892664968398280203779,868681765846316883728697065421998,-79048150954572853311144873191795246247,68073362348813233682178030005528018104269316,37167389784140902488190899939956879675623820671151,192042511290790751384013527493529240206304125848797493082,-629119365240927513217828672050271856511437408467383550739696123
mov $1,$0
mov $0,0
add $1,1
mov $2,1
mov $3,1
lpb $1
sub $1,1
mov $4,$2
mul $2,-6
mul $4,$3
add $0,$4
sub $3,$4
add $3,$0
lpe
mov $0,$3
|
menu.asm | hongfz16/AssemblyPlayStation | 2 | 24217 | <reponame>hongfz16/AssemblyPlayStation<filename>menu.asm
[bits 32]
section .text
call main
ret
extern clear_screen
extern kprint_at
extern getchar
extern register_kbd_callback
extern register_tim_callback
extern port_byte_out
extern port_byte_in
main:
reg_for_kbd:
mov eax, kbd_callback_menu
push eax
call register_kbd_callback
call menu_render
jmp $
ret
menu_render:
mov ebx, [curGame]
call clear_screen
push dword 0
push dword 0
push HELP_INFO
call kprint_at
pushad
mov eax, ebx
inc eax
push eax
mov eax, 3
push eax
mov eax, SArrow
push eax
call kprint_at
popad
mov ecx, GAMENUM
mov esi,NameList + 4
mov ebx, 2
kbd_callback_menu_loop:
pushad
mov edx, [esi]
; mov eax, [edx]
; mov edx, eax
mov eax, ebx
push eax
mov eax, 8
push eax
mov eax, edx
push edx
call kprint_at
popad
dec ecx
add esi, 4
inc ebx
test ecx, 0xffffffff
jnz kbd_callback_menu_loop
ret
kbd_callback_menu:
; A: 1E
; S: 1F
; D: 20
; w: 11
; J: 24
push ebp
mov ebp, esp
mov eax, [ebp+8]
mov ebx, [curGame]
kbd_call_menu_check_up:
cmp eax, 0x11
jne kbd_call_menu_check_down
dec ebx
cmp ebx, 0
jne kbd_callback_menu_finish
mov ebx, GAMENUM
jmp kbd_callback_menu_finish
kbd_call_menu_check_down:
cmp eax, 0x1f
jne kbd_call_menu_check_config
inc ebx
cmp ebx, GAMENUM + 1
jne kbd_callback_menu_finish
mov ebx, 1
jmp kbd_callback_menu_finish
kbd_call_menu_check_config:
cmp eax, 0x24
jne kbd_callback_menu_finish
mov eax, [curGame]
add eax, ebx
add eax, ebx
add eax, ebx
add eax, GameList
push dword 0
call register_kbd_callback
push dword 0
call register_tim_callback
pushad
before_call_clock:
sti
call [eax]
; jmp $
cli
after_call_clock:
popad
push kbd_callback_menu
call register_kbd_callback
push dword 0
call register_tim_callback
jmp kbd_callback_menu_ret
kbd_callback_menu_finish:
mov [curGame], ebx
call menu_render
; mov ecx, [curGame]
; mov esi,
; call clear_screen
; push dword 0
; push dword 0
; push HELP_INFO
; call kprint_at
; pushad
; mov eax, ebx
; inc eax
; push eax
; mov eax, 3
; push eax
; mov eax, SArrow
; push eax
; call kprint_at
; popad
; mov ecx, GAMENUM
; mov esi,NameList + 4
; mov ebx, 2
; kbd_callback_menu_loop:
; pushad
; mov edx, [esi]
; ; mov eax, [edx]
; ; mov edx, eax
; mov eax, ebx
; push eax
; mov eax, 8
; push eax
; mov eax, edx
; push edx
; call kprint_at
; popad
; dec ecx
; add esi, 4
; inc ebx
; test ecx, 0xffffffff
; jnz kbd_callback_menu_loop
kbd_callback_menu_ret:
pop ebp
ret 4
; func_game1:
; call clear_screen
; mov eax, 3
; push eax
; mov eax, 3
; push eax
; mov eax, welcome_game1
; push eax
; call kprint_at
; ret
TIMER db "Timer!", 0
kbd_buf times 256 db 0
kbd_head db 255
kbd_tail db 0
kbd_callback dd 0
tim_callback dd 0
scancode_trans db 0,0x1b,"1234567890-+",0x08,0x09,"QWERTYUIOP[]",0x0a,0x0d,"ASDFGHJKL",0x3b,0x27,0x60,".",0x5c,"ZXCVBNM",0x2c,"./.",0,0,0,0,0,0,0,0,0,0
Name1 db "Clock", 0
Name2 db "Dinasour", 0
Name3 db "Stopwatch", 0
HELP_INFO db "Please use 'W' and 'S' to choose; Press 'J' to enter the program;"
curGame dd 1
always0 dd 0
GAMENUM equ 3
NameList dd 0, Name1, Name2, Name3
GameList dd 0, 0x3000, 0x3800, 0x4000
SArrow db "->",0
finish1:
times 4096 - ($-$$) db 0 |
resolver.adb | SMerrony/dgemua | 2 | 26654 | <reponame>SMerrony/dgemua<filename>resolver.adb
-- MIT License
-- Copyright (c) 2021 <NAME>
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
with Debug_Logs; use Debug_Logs;
with Memory; use Memory;
package body Resolver is
function Resolve_8bit_Disp
(CPU : in CPU_T; Indirect : in Boolean; Mode : in Mode_T;
Disp15 : in Integer_16) return Phys_Addr_T
is
Eff : Phys_Addr_T;
Ring : Phys_Addr_T := CPU.PC and 16#7000_0000#;
Ind_Addr : Word_T;
Indirection_Level : Integer := 0;
begin
if Mode /= Absolute then
-- relative mode, sign-extend to 32-bits
Eff :=
Integer_32_To_Phys
(Integer_32 (Disp15)); -- Disp15 is already sexted by decoder
end if;
case Mode is
when Absolute =>
Eff := Phys_Addr_T (Disp15) or Ring;
when PC =>
Eff := Eff + CPU.PC;
when AC2 =>
Eff := Eff + Phys_Addr_T (Integer_32 (CPU.AC (2)));
when AC3 =>
Eff := Eff + Phys_Addr_T (Integer_32 (CPU.AC (3)));
end case;
if Indirect then
Eff := Eff or Ring;
Ind_Addr := RAM.Read_Word (Eff);
while (Ind_Addr and 16#8000#) /= 0 loop
Indirection_Level := Indirection_Level + 1;
if Indirection_Level > 15 then
raise Indirection_Failure
with "Too many levels of indirection";
end if;
Ind_Addr := RAM.Read_Word (Phys_Addr_T (Ind_Addr) or Ring);
end loop;
Eff := Phys_Addr_T (Ind_Addr) or Ring;
end if;
if not CPU.ATU then
-- constrain to 1st 32MB
Eff := Eff and 16#01ff_ffff#;
end if;
return Eff;
end Resolve_8bit_Disp;
function Resolve_15bit_Disp (CPU : in CPU_T;
Indirect : in Boolean;
Mode : in Mode_T;
Disp15 : in Integer_16;
Disp_Offset : in Natural) return Phys_Addr_T is
Eff : Phys_Addr_T;
Ring : Phys_Addr_T := CPU.PC and 16#7000_0000#;
Disp32 : Integer_32;
Ind_Addr : Dword_T;
Indirection_Level : Integer := 0;
begin
if Mode /= Absolute then
-- relative mode, sign-extend to 32-bits
Disp32 := Integer_32(Disp15); -- Disp15 is already sexted by decoder
end if;
case Mode is
when Absolute =>
-- Zero-extend to 28 bits, force to current ring
Eff := (Phys_Addr_T(Disp15) and 16#0000_7fff#) or Ring;
when PC =>
Eff := Integer_32_To_Phys(Integer_32(CPU.PC) + Disp32 + Integer_32(Disp_Offset));
when AC2 =>
Eff := Phys_Addr_T(Dword_To_Integer_32(CPU.AC(2)) + Disp32) or Ring;
when AC3 =>
Eff := Phys_Addr_T(Dword_To_Integer_32(CPU.AC(3)) + Disp32) or Ring;
end case;
if Indirect then
Eff := Eff or Ring;
Loggers.Debug_Print (Debug_Log, "... Indirect addr resolves from : " & Dword_To_String (Dword_T(Eff), Octal, 11, true));
Ind_Addr := RAM.Read_Dword (Eff);
while (Ind_Addr and 16#8000_0000#) /= 0 loop
Indirection_Level := Indirection_Level + 1;
if Indirection_Level > 15 then
raise Indirection_Failure with "Too many levels of indirection";
end if;
Ind_Addr := RAM.Read_Dword (Phys_Addr_T(Ind_Addr) and 16#7fff_ffff#);
Loggers.Debug_Print (Debug_Log, "... Nested Indirect addr resolves to : " & Dword_To_String (Dword_T(Ind_Addr), Octal, 11, true));
end loop;
Eff := Phys_Addr_T(Ind_Addr) or Ring;
Loggers.Debug_Print (Debug_Log, "... Indirect addr resolves to : " & Dword_To_String (Dword_T(Eff), Octal, 11, true));
end if;
if not CPU.ATU then
-- constrain to 1st 32MB
Eff := Eff and 16#01ff_ffff#;
end if;
return Eff;
end Resolve_15bit_Disp;
function Resolve_31bit_Disp (CPU : in CPU_T;
Indirect : in Boolean;
Mode : in Mode_T;
Disp : in Integer_32;
Disp_Offset : in Natural) return Phys_Addr_T is
Eff : Phys_Addr_T;
Ring : Phys_Addr_T := CPU.PC and 16#7000_0000#;
Ind_Addr : Dword_T;
Indirection_Level : Integer := 0;
begin
case Mode is
when Absolute =>
-- Zero-extend to 28 bits
Eff := Phys_Addr_T(Integer_32_To_Dword(Disp)); -- or Ring;
when PC =>
Eff := Phys_Addr_T(Integer_32_To_Dword(Dword_To_Integer_32(Dword_T(CPU.PC)) + Disp + Integer_32(Disp_Offset)));
when AC2 =>
Eff := Phys_Addr_T(Integer_32_To_Dword(Dword_To_Integer_32(CPU.AC(2)) + Disp));
when AC3 =>
Eff := Phys_Addr_T(Integer_32_To_Dword(Dword_To_Integer_32(CPU.AC(3)) + Disp));
end case;
if Indirect then
Eff := Eff or Ring;
Ind_Addr := RAM.Read_Dword (Eff);
while (Ind_Addr and 16#8000_0000#) /= 0 loop
Indirection_Level := Indirection_Level + 1;
if Indirection_Level > 15 then
raise Indirection_Failure with "Too many levels of indirection";
end if;
Ind_Addr := RAM.Read_Dword (Phys_Addr_T(Ind_Addr) and 16#7fff_ffff#);
end loop;
Eff := Phys_Addr_T(Ind_Addr) or Ring;
end if;
if not CPU.ATU then
-- constrain to 1st 32MB
Eff := Eff and 16#01ff_ffff#;
end if;
return Eff and 16#7fff_ffff#;
end Resolve_31bit_Disp;
function Resolve_32bit_Indirectable_Addr
(ATU : in Boolean; I_Addr : in Dword_T) return Phys_Addr_T
is
Eff : Dword_T := I_Addr;
begin
while Test_DW_Bit (Eff, 0) loop
Eff := RAM.Read_Dword (Phys_Addr_T (Eff and 16#7fff_ffff#));
end loop;
-- if not ATU then
-- Eff := Eff and 16#01ff_ffff#;
-- end if;
return Phys_Addr_T (Eff);
end Resolve_32bit_Indirectable_Addr;
procedure Resolve_Eagle_Bit_Addr (CPU : in CPU_T;
Acd, Acs : in AC_ID;
Word_Addr : out Phys_Addr_T;
Bit_Num : out Natural) is
begin
-- TODO handle segments and indirection
if Acd = Acs then
Word_Addr := CPU.PC and 16#7000_0000#;
else
if Test_DW_Bit (CPU.AC(Acs), 0) then
raise Not_Yet_Implemented with "Indirect 16-bit BIT pointers";
end if;
Word_Addr := Phys_Addr_T(CPU.AC(Acs));
end if;
Word_Addr := Word_Addr + Phys_Addr_T (Shift_Right (CPU.AC(Acd), 4));
Bit_Num := Natural(CPU.AC(Acd) and 16#000f#);
end Resolve_Eagle_Bit_Addr;
procedure Resolve_Eclipse_Bit_Addr (CPU : in CPU_T;
Acd, Acs : in AC_ID;
Word_Addr : out Phys_Addr_T;
Bit_Num : out Natural) is
begin
-- TODO handle segments and indirection
if Acd = Acs then
Word_Addr := CPU.PC and 16#7000_0000#;
else
if Test_DW_Bit (CPU.AC(Acs), 0) then
raise Not_Yet_Implemented with "Indirect 16-bit BIT pointers";
end if;
Word_Addr := Phys_Addr_T(CPU.AC(Acs)) and 16#0000_7fff#;
end if;
Word_Addr := Word_Addr + Phys_Addr_T (Shift_Right (CPU.AC(Acd), 4));
Bit_Num := Natural(CPU.AC(Acd) and 16#000f#);
end Resolve_Eclipse_Bit_Addr;
end Resolver;
|
applescripts/filter-albums.applescript | Tyilo/play-song | 0 | 659 | <filename>applescripts/filter-albums.applescript<gh_stars>0
-- filters albums by the typed query --
-- load workflow configuration
do shell script "bash ./compile-config.sh"
set config to load script POSIX file ((do shell script "pwd") & "/config.scpt")
-- constructs album result list as XML string
on getAlbumResultListXml(query)
global config
-- search iTunes library for the given query
tell application "iTunes"
-- search Music playlist for songs whose album matches query
set theSongs to (get every track of playlist 2 whose album contains query and kind contains (songDescriptor of config))
set theAlbums to {}
set theIndex to 1
-- retrieve list of albums matching query
repeat with theSong in theSongs
-- limit number of results
if theIndex is greater than (resultLimit of config) then exit repeat
-- add album to list if not already present
if album of theSong is not in theAlbums then
set theAlbums to theAlbums & (album of theSong)
set theIndex to theIndex + 1
end if
end repeat
-- inform user that no results were found (prompt to switch to iTunes instead)
if length of theAlbums is 0 then
addResult({uid:"no-results", arg:"null", valid:"no", title:"No Albums Found", subtitle:("No albums matching '" & query & "'"), icon:defaultIconName of config}) of config
else
-- loop through the results to create the XML data
repeat with albumName in theAlbums
set albumName to albumName as text
set theSong to (first track of playlist 2 whose album is albumName and kind contains (songDescriptor of config))
set songArtworkPath to getSongArtworkPath(theSong) of config
-- add song information to XML
addResult({uid:("album-" & albumName), arg:albumName, valid:"yes", title:albumName, subtitle:artist of theSong, icon:songArtworkPath}) of config
end repeat
end if
end tell
return getResultListXml() of config
end getAlbumResultListXml
createArtworkCache() of config
getAlbumResultListXml("{query}")
|
src/arch/x86/boot/boot.asm | NightfallDM/xbook2 | 0 | 243992 | <filename>src/arch/x86/boot/boot.asm
%include "const.inc"
org 0x7c00
[bits 16]
align 16
entry:
mov ax, cs
mov ds, ax
mov ss, ax
mov sp, 0
mov ax, 0xb800
mov es, ax
;clean screan
clean_screen:
mov ax, 0x02
int 0x10
;show 'BOOT'
mov byte [es:0],'B'
mov byte [es:1],0x07
mov byte [es:2],'O'
mov byte [es:3],0x07
mov byte [es:4],'O'
mov byte [es:5],0x07
mov byte [es:6],'T'
mov byte [es:7],0x07
;we read load from sector 1(0 is first) width 8 sectors to 0x10000
;es:dx=buffer address
mov ax, LOADER_SEG
mov es, ax
xor bx, bx
mov si, LOADER_OFF
mov cx, LOADER_CNTS
read_loader_from_disk:
call floppy_read_sectors
add bx, 512
inc si
loop read_loader_from_disk
jmp LOADER_SEG:0
;si=LBA address, from 0
;cx=sectors
;es:dx=buffer address
;this function was borrowed from internet
floppy_read_sectors:
push ax
push cx
push dx
push bx
mov ax, si
xor dx, dx
mov bx, 18
div bx
inc dx
mov cl, dl
xor dx, dx
mov bx, 2
div bx
mov dh, dl
xor dl, dl
mov ch, al
pop bx
.RP:
mov al, 0x01
mov ah, 0x02
int 0x13
jc .RP
pop dx
pop cx
pop ax
ret
times 510-($-$$) db 0
dw 0xaa55 ; boot sector flags
|
Firmware/Libraries/STM8_SelfTest_Library/src/stm8_stl_cpurun_IAR.asm | SergeiSOficial/AESTOUS_STM8 | 0 | 13142 | ;******************* (C) COPYRIGHT 2017 STMicroelectronics ********************
; File Name : stm8_stl_cpurun_IAR.s
; Author : MCD Application Team
; Author : STMicroelectronics - MCD Application Team
; Version : V2.0.0
; Date : Dec-2017
;*****************************************************************************
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
; 1. Redistributions of source code must retain the above copyright notice,
; this list of conditions and the following disclaimer.
; 2. Redistributions in binary form must reproduce the above copyright notice,
; this list of conditions and the following disclaimer in the documentation
; and/or other materials provided with the distribution.
; 3. Neither the name of STMicroelectronics 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.
;*****************************************************************************
;
name RunTimeCPUTestcode
public STL_RunTimeCPUTest
extern CtrlFlowCnt
extern CtrlFlowCntInv
extern FailSafe
section .text:code
;
;*******************************************************************************
; Function Name : STL_RunTimeCPUTest
; Description : Full STM8 CPU test to be executed during run-time
; Input : None.
; Output : jump directly to a Fail Safe routine in case of failure
; Return : SUCCESS (=1)
; WARNING : all registers become destroyed when exiting this function
; excluding stack pointer
;*******************************************************************************/
STL_RunTimeCPUTest:
LDW X,CtrlFlowCnt
ADDW X,#11 ; CtrlFlowCnt += CPU_RUN_CALLEE
LDW CtrlFlowCnt,x
; If X is not functional, corruption will be detected later
; Check CPU register: A, X, Y
LD A,#0AAH
CP A,#0AAH
JRNE ErrorCPU
LD A,#55H
CP A,#55H
JRNE ErrorCPU
LD A,#11H
LDW X,#0AAAAH
CPW X,#0AAAAH
JRNE ErrorCPU
LDW X,#5555H
CPW X,#5555H
JRNE ErrorCPU
LDW X,#1234H
LDW Y,#0AAAAH
CPW Y,#0AAAAH
JRNE ErrorCPU
LDW Y,#5555H
CPW Y,#5555H
JRNE ErrorCPU
LDW Y,#5678H
; Verify ramp pattern
CP A,#11H
JRNE ErrorCPU
CPW X,#1234H
JRNE ErrorCPU
CPW Y,#5678H
JRNE ErrorCPU
JP Exit
ErrorCPU:
LDW X,#12H ; Error Code if spurious return
JP FailSafe
Exit:
LDW X,CtrlFlowCntInv
SUBW X,#11 ; CtrlFlowCntInv -= CPU_RUN_CALLEE
LDW CtrlFlowCntInv,X
LD A,#1 ; Returns success
RET
END
;******************* (C) COPYRIGHT STMicroelectronics *****END OF FILE****
|
source/jni/u2/forest/routines.asm | Falken42/SecondReality | 9 | 87671 | <reponame>Falken42/SecondReality
.MODEL large,PASCAL
.CODE
.386
; dx = Bground seg
; ax = pos seg
; si = pos ofs
; cx = font seg
; bx = font ofs
Putrouts PROC FAR
PUBLIC Putrouts
push ds
mov ds,ax
mov ax,0a000h
mov es,ax
mov fs,cx
mov gs,dx
mov dx,237*31
@a: lodsw ; get byte count
or ax,ax ; if 0 then hidden pixel
je @ei ; next pixel
mov cx,ax ; set loop value
@c: lodsw ; get destination address
mov di,ax
mov al,byte ptr gs:[di] ; get bground pixel
add al,byte ptr fs:[bx] ; add font value to pixel
mov byte ptr es:[di],al ; store pixel to screen
loop @c
@ei:
inc bx
dec dx
jnz @a
pop ds
ret
Putrouts ENDP
END
|
maps/TradeCenter.asm | AtmaBuster/pokecrystal16-493-plus | 1 | 24115 | <gh_stars>1-10
object_const_def ; object_event constants
const TRADECENTER_CHRIS1
const TRADECENTER_CHRIS2
TradeCenter_MapScripts:
db 2 ; scene scripts
scene_script .InitializeTradeCenter ; SCENE_DEFAULT
scene_script .DummyScene ; SCENE_FINISHED
db 1 ; callbacks
callback MAPCALLBACK_OBJECTS, .SetWhichChris
.InitializeTradeCenter:
sdefer .InitializeAndPreparePokecenter2F
end
.DummyScene:
end
.SetWhichChris:
special CableClubCheckWhichChris
iffalse .Chris2
disappear TRADECENTER_CHRIS2
appear TRADECENTER_CHRIS1
return
.Chris2:
disappear TRADECENTER_CHRIS1
appear TRADECENTER_CHRIS2
return
.InitializeAndPreparePokecenter2F:
setscene SCENE_FINISHED
setmapscene POKECENTER_2F, SCENE_POKECENTER2F_LEAVE_TRADE_CENTER
end
TradeCenterConsoleScript:
special TradeCenter
newloadmap MAPSETUP_LINKRETURN
end
TradeCenterFriendScript:
; unreferenced
opentext
writetext .FriendReadyText
waitbutton
closetext
end
.FriendReadyText:
text "Your friend is"
line "ready."
done
TradeCenter_MapEvents:
db 0, 0 ; filler
db 2 ; warp events
warp_event 4, 7, POKECENTER_2F, 2
warp_event 5, 7, POKECENTER_2F, 2
db 0 ; coord events
db 2 ; bg events
bg_event 4, 4, BGEVENT_RIGHT, TradeCenterConsoleScript
bg_event 5, 4, BGEVENT_LEFT, TradeCenterConsoleScript
db 2 ; object events
object_event 3, 4, SPRITE_CHRIS, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, CableClubFriendScript, EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1
object_event 6, 4, SPRITE_CHRIS, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, CableClubFriendScript, EVENT_TEMPORARY_UNTIL_MAP_RELOAD_2
|
Cubical/Algebra/Monoid/Instances/Nat.agda | thomas-lamiaux/cubical | 0 | 10585 | {-# OPTIONS --safe #-}
module Cubical.Algebra.Monoid.Instances.Nat where
open import Cubical.Foundations.Prelude
open import Cubical.Data.Nat
open import Cubical.Algebra.Monoid
NatMonoid : Monoid ℓ-zero
fst NatMonoid = ℕ
MonoidStr.ε (snd NatMonoid) = 0
MonoidStr._·_ (snd NatMonoid) = _+_
MonoidStr.isMonoid (snd NatMonoid) = makeIsMonoid isSetℕ +-assoc +-zero (λ _ → refl)
|
oeis/052/A052931.asm | neoneye/loda-programs | 11 | 8865 | ; A052931: Expansion of 1/(1 - 3*x^2 - x^3).
; Submitted by <NAME>
; 1,0,3,1,9,6,28,27,90,109,297,417,1000,1548,3417,5644,11799,20349,41041,72846,143472,259579,503262,922209,1769365,3269889,6230304,11579032,21960801,40967400,77461435,144863001,273351705,512050438,964918116,1809503019,3406804786,6393427173,12029917377,22587086305,42483179304,79791176292,150036624217,281856708180,529901048943,995606748757,1871559855009,3516721295214,6610286313784,12421723740651,23347580236566,43875457535737,82464464450349,154973952843777,291268850886784,547386322981680
mov $1,1
mov $3,1
lpb $0
sub $0,1
add $2,$1
add $2,$1
sub $1,$2
add $1,$3
add $3,$2
add $2,$1
add $3,2
lpe
mov $0,$1
|
work/ff3_field_render_x.asm | ypyp-pprn-mnmn/ff3_hack | 4 | 247259 | <filename>work/ff3_field_render_x.asm<gh_stars>1-10
; encoding: utf-8
; ff3_field_render_x.asm
;
; description:
; implementation of optimzied renderer code
;
;==================================================================================================
.ifdef _FEATURE_DEFERRED_RENDERING
.ifndef _FEATURE_STOMACH_AMOUNT_1BYTE
;; it is needed to move and free up the buffer at $7300-$73ff,
;; in order for the logics implemented in this file to work correctly.
;; these logics rely on that buffer being stable across rendering.
.fail
.endif
;.ifndef field.window.ppu.FREE_BEGIN
.ifndef menu.erase.FREE_BEGIN
.fail
.endif
;RESTORE_PC field.window.ppu.FREE_BEGIN
RESTORE_PC menu.erase.FREE_BEGIN
render_x.RENDERER_BEGIN:
;--------------------------------------------------------------------------------------------------
;;
;; the nmi handler for deferred rendering.
;; other functions called within this function,
;; must preserve all variables in order to keep consistency
;; across NMIs.
;; if not, those functions not specially designed to variable volatility,
;; will see undefined value and will eventually crash.
;;
render_x.deferred_renderer:
;; preserve general-purpose registers.
pha
txa
pha
tya
pha
;; dummy read to ensure unset nmi flag.
lda $2002
;; preserve spaces utilized by local variables, if any.
;; (as of 0.8.2, no local variables needed & utilized)
;; do rendering.
ldx #0
jsr render_x.render_deferred_contents
jsr render_x.remove_nmi_handler
;; finish rendering with ppu.
;; as calling sound driver need change of program bank,
;; we can't safely call the driver from within nmi handler,
;; unless under the situation which is known
;; that the program bank has a particular deterministic value.
;inc <field.frame_counter
;jsr field_x.end_ppu_update ;sync_ppu_scroll+call_sound_driver
jsr field.sync_ppu_scroll
;; there is no reliable way (found so far) to preserve program bank.
;; so here can't safely restore banks.
.ifdef _FEATURE_MEMOIZE_BANK_SWITCH
lda <sys_x.last_bank.2nd
pha
lda <sys_x.last_bank.1st
pha
jsr field.call_sound_driver
pla
jsr thunk.switch_1st_bank
pla
jsr thunk.switch_2nd_bank
.endif ;;_FEATURE_MEMOIZE_BANK_SWITCH
;; restore local variables, if any (as of 0.8.2, no local variables needed & utilized)
pla
tay
pla
tax
pla
rti
;--------------------------------------------------------------------------------------------------
;; in:
;; X = source buffer offset.
;; notes:
;; the buffer contains variable-length structure the below:
;; +00 vram high
;; +01 vram low
;; +02 buffer length
;; +03 buffer offset, adjusted to loop boundary
render_x.render_deferred_contents:
DECLARE_WINDOW_VARIABLES
;; setup vram address.
lda render_x.q.buffer,x ;; 4
sta $2006 ;; 8
lda render_x.q.buffer+1,x ;; 12
sta $2006 ;; 16
ldy render_x.q.buffer+2,x ;; 20
lda render_x.q.buffer+3,x ;; 24
tax ;; 26
tya ;; 28
;; branch out.
;; X = offset
;; A = length
.if render_x.UNROLL_DEPTH = 4
lsr A ;; 2
bcc .length_0 ;; 4+(1)
.length_1:
lsr A ;; 6
bcc .length_01 ;; 8+(1)
.length_11:
lsr A ;; 10
bcc .length_011 ;; 12+(1)
.length_111:
lsr A ;; 14
tay ;; 16
bcs .length_1111 ;; 18+1
bcc .length_0111 ;; 21
.length_011:
lsr A ;; 15
tay ;; 17
bcs .length_1011 ;; 19+1
bcc .length_0011 ;; 22
.length_01:
lsr A ;; 11
bcc .length_001 ;; 13+(1)
.length_101:
lsr A ;; 15
tay ;; 17
bcs .length_1101 ;; 19+1
bcc .length_0101 ;; 22
.length_001:
lsr A ;; 16
tay ;; 18
bcs .length_1001 ;; 20+1
bcc .length_0001 ;; 23
.length_0:
lsr A ;; 7
bcc .length_00 ;; 9+(1)
.length_10:
lsr A ;; 11
bcc .length_010 ;; 13+(1)
.length_110:
lsr A ;; 15
tay ;; 17
bcs .length_1110 ;; 20
bcc .length_0110 ;; 23
.length_010:
lsr A ;; 16
tay ;; 18
bcs .length_1010 ;; 21
bcc .length_0010 ;; 24
.length_00:
lsr A ;; 12
bcc .length_000 ;; 14+(1)
.length_100:
lsr A ;; 16
tay ;; 18
bcs .length_1100 ;; 21
bcc .length_0100 ;; 24
.length_000:
lsr A ;; 17
tay ;; 19
bcs .length_1000 ;; 22
bcc .length_0000
.else ;;UNROLL_DEPTH == 4
lsr A ;; 6
bcc .length_01 ;; 8+(1)
.length_11:
lsr A ;; 10
bcc .length_011 ;; 12+(1)
.length_111:
lsr A ;; 14
tay ;; 16
bcs .length_0111 ;; 18+1
bcc .length_0011 ;; 21
.length_011:
lsr A ;; 15
tay ;; 17
bcs .length_0101 ;; 19+1
bcc .length_0001 ;; 22
.length_01:
lsr A ;; 11
bcc .length_001 ;; 13+(1)
.length_101:
lsr A ;; 15
tay ;; 17
bcs .length_0110 ;; 19+1
bcc .length_0010 ;; 22
.length_001:
lsr A ;; 16
tay ;; 18
bcs .length_0100 ;; 20+1
bcc .length_0000 ;; 23
.endif ;;UNROLL_DEPTH
;; A = scratch.
;; X = buffer offset.
;; Y = loop counter.
.render_x.upload_loop:
.if render_x.UNROLL_DEPTH = 4
lda render_x.q.buffer-$10,x
sta $2007
.length_1111:
lda render_x.q.buffer-$0f,x
sta $2007
.length_1110:
lda render_x.q.buffer-$0e,x
sta $2007
.length_1101:
lda render_x.q.buffer-$0d,x
sta $2007
.length_1100:
lda render_x.q.buffer-$0c,x
sta $2007
.length_1011:
lda render_x.q.buffer-$0b,x
sta $2007
.length_1010:
lda render_x.q.buffer-$0a,x
sta $2007
.length_1001:
lda render_x.q.buffer-$09,x
sta $2007
.length_1000:
.endif ;;UNROLL_DEPTH == 4
lda render_x.q.buffer-$08,x
sta $2007
.length_0111:
lda render_x.q.buffer-$07,x
sta $2007
.length_0110:
lda render_x.q.buffer-$06,x
sta $2007
.length_0101:
lda render_x.q.buffer-$05,x
sta $2007
.length_0100:
lda render_x.q.buffer-$04,x
sta $2007
.length_0011:
lda render_x.q.buffer-$03,x
sta $2007
.length_0010:
lda render_x.q.buffer-$02,x
sta $2007
.length_0001:
lda render_x.q.buffer-$01,x
sta $2007
.length_0000:
;; overhead = 15 if loop continues, 5 if loop reached the end.
;; A = scratch.
;; X = buffer offset.
;; Y = render target index.
.next:
dey ;; 2
bmi render_x.upload_next ;; 4(+1)
txa ;; 6
clc ;; 8
;adc #$10 ;; 10
adc #(1 << render_x.UNROLL_DEPTH) ;;10
tax ;; 12
bne .render_x.upload_loop ;; 15
;; overhead = 5-6 cpu cycles.
;; A = scratch.
;; X = buffer offset.
;; Y = render target index.
render_x.upload_next:
DECLARE_WINDOW_VARIABLES
cpx <render_x.q.available_bytes ;; 3
bcs render_x.reset_states ;; 5(+1)
jmp render_x.render_deferred_contents ;; 8
;; out:
;; A: #0
render_x.reset_states:
lda #render_x.FULL_OF_FUEL
sta <render_x.q.fuel
lda #0
sta <render_x.q.available_bytes ;;this will free up a waiting thread
rts
;--------------------------------------------------------------------------------------------------
render_x.remove_nmi_handler:
pha
lda #$40 ;RTI
sta nmi_handler_entry
pla
rts
render_x.set_deferred_renderer:
jsr render_x.remove_nmi_handler
lda #HIGH(render_x.deferred_renderer)
sta nmi_handler_entry+2
lda #LOW(render_x.deferred_renderer)
sta nmi_handler_entry+1
lda #$4c ;JMP
sta nmi_handler_entry
render_x.rts_1:
rts
;--------------------------------------------------------------------------------------------------
;; in A: bytes to ensure
render_x.ensure_buffer_available:
DECLARE_WINDOW_VARIABLES
jsr render_x.remove_nmi_handler ;; preserves A.
;pha
;clc
;adc #14
;clc
;adc <render_x.q.available_bytes
;adc <render_x.q.stride
;cmp #render_x.BUFFER_CAPACITY
;pla
;bcs render_x.await_complete_rendering
clc
adc #render_x.FUEL_FOR_OVERHEAD
eor #$ff
tax
adc <render_x.q.fuel
bcs .available ;;ok. carry set = adding negative value resulted in overflow.
txa
pha
jsr render_x.await_complete_rendering
pla
clc
adc <render_x.q.fuel
.available:
sta <render_x.q.fuel
bit $2002
;bmi render_x.on_nmi_completed
bpl render_x.rts_1
;;in NMI
jmp field_x.advance_frame_no_wait
;rts
;--------------------------------------------------------------------------------------------------
render_x.finalize:
lda <render_x.q.available_bytes
;beq .completed
beq render_x.rts_1
;;jsr render_x.await_complete_rendering
.completed:
;; XXX:
;; in cases of paging in window,
;; the rendering continues even if it reached the bottom of window.
;lda #0
;sta <render_x.q.init_flags
;rts
;--------------------------------------------------------------------------------------------------
render_x.await_complete_rendering:
jsr render_x.set_deferred_renderer
.wait_nmi:
lda <render_x.q.available_bytes
bne .wait_nmi
render_x.on_nmi_completed:
.ifdef _FEATURE_MEMOIZE_BANK_SWITCH
inc <field.frame_counter
rts
.else
;; FIXME: this is a temporary measure to workaround PRG bank mismatch on nmi
jmp field_x.advance_frame_no_wait ;;inc <frame_counter + call sound driver
.endif ;;_FEATURE_MEMOIZE_BANK_SWITCH
;--------------------------------------------------------------------------------------------------
render_x.queue_content:
DECLARE_WINDOW_VARIABLES
.p_source = $80
clc
adc #$80
sta <.p_source
lda #$07
sta <.p_source+1
bit <render_x.q.init_flags
;php
;bmi .put_middles
bmi .do_queue
;; --- build final contents onto temporary buffer.
ldy #0
ldx #0
lda #$fa
jsr render_x.build_temp_buffer
.put_middles:
lda [.p_source],y
jsr render_x.build_temp_buffer
iny
cpy <.window_width
bne .put_middles
;plp
;bmi .do_queue
lda #$fb
jsr render_x.build_temp_buffer
lda #LOW(render_x.temp_buffer)
sta <.p_source
;FALL_THROUGH_TO render_x.queue_bytes_from_buffer
.do_queue:
jsr render_x.queue_bytes_from_buffer
jsr render_x.queue_attributes
;; ---
inc <.offset_y ;;originally 'field.upload_window_content's role
inc <.lines_drawn ;;originally caller's responsibility, it remains true but for bottom border we need prospective value
rts
;--------------------------------------------------------------------------------------------------
render_x.queue_top_border:
DECLARE_WINDOW_VARIABLES
ldy <.window_top
dey
;tya
ldx #2
jsr render_x.queue_border
ldy <.window_top
sty <.offset_y
rts
;--------------------------------------------------------------------------------------------------
render_x.queue_bottom_border:
DECLARE_WINDOW_VARIABLES
lda <.window_top
clc
adc <.window_height
tay
ldx #5
;;FALL_THROUGH_TO render_x.queue_border
;--------------------------------------------------------------------------------------------------
render_x.queue_border:
DECLARE_WINDOW_VARIABLES
.p_source = $80
sty <.offset_y
.put_borders:
ldy #3
.get_parts:
lda field_x.window_parts,x
pha
dex
dey
bne .get_parts
;; ---
;; this will update buffer at $7c0-7ff.
;; as the temp buffer this logic using is at $7d0-7ef
;; it is needed to use the buffer before/after
;; attr update completed.
jsr render_x.queue_attributes
;; --- queue tiles.
ldx #0
pla
jsr render_x.build_temp_buffer
pla
ldy <.window_width
.put_middles:
jsr render_x.build_temp_buffer
dey
bne .put_middles
pla
jsr render_x.build_temp_buffer
lda #LOW(render_x.temp_buffer)
sta <.p_source
lda #HIGH(render_x.temp_buffer)
sta <.p_source+1
;FALL_THROUGH_TO render_x.queue_bytes_from_buffer
;--------------------------------------------------------------------------------------------------
render_x.queue_bytes_from_buffer:
DECLARE_WINDOW_VARIABLES
.source_index = $85
ldx <.window_left
bit <render_x.q.init_flags
bmi .queue_bytes
dex
.queue_bytes:
txa
pha ;; left
;tax
;; A: left
;; X: left
;; Y: index into precalculated metrics
ldy #0
sty <.source_index
jsr render_x.begin_queueing
pla
;; A <-- windowleft
clc
adc render_x.q.strides+0 ;;1st bg
and #$3f
ldy #2
;tax
;jmp render_x.begin_queueing
;--------------------------------------------------------------------------------------------------
render_x.begin_queueing:
DECLARE_WINDOW_VARIABLES
.temp_left = .offset_x
;; in:
;; Y: target index
;; A: left
ldx render_x.q.strides,y
beq render_x.rts_2
sta <.temp_left
txa
pha ;;width
;; --- check if there enough space remaining in the buffer.
jsr render_x.ensure_buffer_available
;; --- queue the addr to render.
ldx <.temp_left
lda <.offset_y
;; X = window left
jsr render_x.map_coords_to_vram
;; A = vram high
;; X = vram low
;; S[0] = body length
render_x.queue_head_and_body:
.source_index = $85
.bias = $84
;sta $2006
;stx $2006
ldy <render_x.q.available_bytes
sta render_x.q.buffer,y
iny
txa
sta render_x.q.buffer,y
iny
pla ;;width
sta render_x.q.buffer,y
iny
pha ;;width
;; calc ajusted offset
;and #$f
and #((1 << render_x.UNROLL_DEPTH) - 1)
sta <.bias
iny ;;offset should point the byte immediately after the tag bytes
tya
tax
clc
adc <.bias
sta render_x.q.buffer-1,y
;; ----
pla ;; width
clc
adc <.source_index
ldy <.source_index
sta <.source_index
render_x.queue_bytes:
.source_index = $85
.p_buffer = $80
.temp_buffer = $7d0
;ldx <render_x.q.available_bytes
.loop:
;lda .temp_buffer,x
lda [.p_buffer],y
sta render_x.q.buffer,x
inx
iny
cpy <.source_index
bne .loop
stx <render_x.q.available_bytes
render_x.rts_2:
rts
;--------------------------------------------------------------------------------------------------
;; on entry, offset_y will have a valid value.
render_x.queue_attributes
DECLARE_WINDOW_VARIABLES
.addr_offset = $84
.p_source = $80
.source_index = $85
lda <.in_menu_mode
bne .done
;; in-place window. may need attr updates
lda <render_x.q.init_flags
and #render_x.NEED_ATTRIBUTES
beq .done
lda <.offset_y
cmp #30
bcc .no_wrap
sbc #30
sta <.offset_y
.no_wrap:
lsr A
bcs .done
;; only update attr if the line on even boundary
;pha
;jsr render_x.is_attr_have_updated
;pla
;bcs .done
lsr A
asl A
asl A
asl A
;sta <.addr_offset
pha
;; --- get attr cache updated.
jsr render_x.inflate_window_metrics
jsr field.init_window_attr_buffer ;ed56
jsr field.update_window_attr_buff ;$c98f
jsr field_x.shrink_window_metrics
;; here field.bg_attr_table_cache ($0300) will have merged attributes
lda #HIGH(field.bg_attr_table_cache)
sta <.p_source+1
lda #LOW(field.bg_attr_table_cache)
sta <.p_source
pla
sta <.source_index
pha
lda #$23
jsr .queue_attr
pla
ora #$40
sta <.source_index
lda #$27
.queue_attr:
pha ;;vram high
lda #8
jsr render_x.ensure_buffer_available
lda <.source_index
ora #$c0
tax ;;vram low
pla ;;vram high
tay
lda #8
pha ;;width
tya
jmp render_x.queue_head_and_body
.skip_update:
.done:
rts
;--------------------------------------------------------------------------------------------------
;; A = row in 16x16 unit
;;TODO
.if 0
render_x.is_attr_have_updated:
pha
and #1
tax
pla
lsr A
tay
lda <render_x.q.done_attrs,x
and floor_setBitMask,y
sec
bne .skip_update
clc
lda <render_x.q.done_attrs,x
ora floor_setBitMask,y
sta <render_x.q.done_attrs,x
.skip_update:
rts
.endif ;;TODO
;--------------------------------------------------------------------------------------------------
render_x.build_temp_buffer:
sta render_x.temp_buffer,x
inx
rts
;--------------------------------------------------------------------------------------------------
render_x.init_as_no_borders:
ldx #(render_x.NO_BORDERS|render_x.PENDING_INIT|render_x.RENDER_RUNNING)
FALL_THROUGH_TO render_x.setup_deferred_rendering
;; in X: init flags
render_x.setup_deferred_rendering:
DECLARE_WINDOW_VARIABLES
;; init deferred drawing.
pha
lda <render_x.q.init_flags
asl A
bmi .done ;; already requested init
.first_init:
;asl A
;bpl .store_init_flags
;jsr render_x.q.finalize
;txa
;ldx <.in_menu_mode
;bne .store_init_flags
; ora #(render_x.NEED_SPRITE_DMA)
.store_init_flags:
stx <render_x.q.init_flags
jsr render_x.reset_states
ldy <.window_left
lda <.window_width
pha ;;width
tax
bit <render_x.q.init_flags
bmi .no_borders
inx
inx
dey
.no_borders:
stx <.window_width
tya
jsr render_x.calc_available_width_in_bg
;; A = width 1st
;ldy #0
;sty <render_x.q.done_attrs
;sty <render_x.q.done_attrs+1
;pha ;;width_1st
;jsr render_x.precalc_params
sta <render_x.q.strides+0
;pla ;width_1st
eor #$ff
sec
adc <.window_width
;; A = width 2nd
;jsr render_x.precalc_params
sta <render_x.q.strides+2
pla
sta <.window_width
.done:
pla ;;initial A
rts
;--------------------------------------------------------------------------------------------------
;render_x.init:
; lda #0
; sta render_x.q.init_flags
; rts
;;make sure the init flag have 'clean' value before use
;;1F:E1DC:A9 00 LDA #$00
;;1F:E1DE:20 EC E7 JSR floor.load_data
;;1F:E1E1:A9 3A LDA #$3A
render_x.on_floor_enter:
FIX_ADDR_ON_CALLER $3f,$e1de+1
;a = #0;
;dungeon::loadFloor(); //$e7ec();
;;assume A == 0
sta render_x.q.init_flags
jmp floor.load_data ;;$e7ec
;;1E:A534:A9 00 LDA #$00
;;1E:A536:85 25 STA $0025 = #$00
;;1E:A538:8D 01 20 STA PPU_MASK = #$00
;;1E:A53B:8D F0 79 STA $79F0 = #$00
;;1E:A53E:8D F0 7A STA $7AF0 = #$00
;;1E:A541:20 06 DD JSR $DD06
render_x.on_menu_enter:
FIX_ADDR_ON_CALLER $3d,$a541+1
;;assume A == 0
sta render_x.q.init_flags
jmp $dd06 ;;? $dfd6() + call sounddriver + $dff8()
;;1F:C08E:A9 00 LDA #$00
;;1F:C090:20 9E C4 JSR $C49E
render_x.on_opening_enter:
FIX_ADDR_ON_CALLER $3e,$c090+1
;;assume A == 0
sta render_x.q.init_flags
jmp $C49E ;;some ppu initialiation
;--------------------------------------------------------------------------------------------------
;in: A = offset Y, X = offset X
;out: A = vram high, X = vram low
render_x.map_coords_to_vram:
;@see $3f:f40a setVramAddrForWindow
.y_to_addr_low = $f4a1
.y_to_addr_high = $f4c1
cmp #30
bcc .no_wrap_y
sbc #30 ;here carry is always set
.no_wrap_y:
tay
txa
and #$3f ;wrap around
cmp #$20 ;check which BG X falls in
and #$1f ;turn into offset within that BG
ora .y_to_addr_low,y
tax
lda .y_to_addr_high,y
bcc .bg_1st
.bg_2nd:
ora #4
.bg_1st:
rts
;--------------------------------------------------------------------------------------------------
field_x.shrink_window_metrics:
DECLARE_WINDOW_VARIABLES
inc <.window_left
inc <.window_top
dec <.window_width
dec <.window_width
dec <.window_height
dec <.window_height
rts
render_x.inflate_window_metrics:
DECLARE_WINDOW_VARIABLES
dec <.window_left
dec <.window_top
inc <.window_width
inc <.window_width
inc <.window_height
inc <.window_height
rts
;VERIFY_PC_TO_PATCH_END field.window.ppu
VERIFY_PC_TO_PATCH_END menu.erase
render_x.RENDERER_END:
;==================================================================================================
;RESTORE_PC floor.treasure.FREE_BEGIN
;--------------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------------
;VERIFY_PC_TO_PATCH_END floor.treasure
;==================================================================================================
INIT_PATCH_EX menu.metrics, $3d,$aaa6,$aabc,$aaa6
;;# $3d:aaa6 menu.get_window_content_metrics
;;> 各種メニューウインドウのコンテンツ領域のメトリック(サイズ・位置)を取得する。
;;
;;### args:
;;
;;#### in:
;;+ u8 X: window_id
;;
;;#### out:
;;+ u8 $38: box left
;;+ u8 $39: box top
;;+ u8 $3c: box width
;;+ u8 $3d: box height
;;+ u8 $97: cursor stop offset x
;;+ u8 $98: cursor stop offset y
;;
;;### callers:
;;+ `1E:9660:20 A6 AA JSR $AAA6` @ $3c:962f menu.jobs.main_loop (x = 0x0e)
;;+ `1E:9791:20 A6 AA JSR menu.get_window_content_metric` @ $3c:9761 menu.magic.main_loop
;;+ `1E:A334:20 A6 AA JSR menu.get_window_content_metric` @ $3d:a332 menu.party_summary.draw_content
;;+ `1E:B9BC:20 A6 AA JSR menu.get_window_content_metric` @ ? name display at new game. (x = 0x22)
;;+ `1F:C02B:20 A6 AA JSR menu.get_window_content_metric` @ ? opening title.
menu.get_window_content_metrics: ;;$3d:aaa6
jsr menu.get_window_metrics ; AAA6 20 BC AA
jmp field_x.shrink_window_metrics
menu_x.get_window_metrics_and_init_as_without_borders:
;; fixups.
FIX_ADDR_ON_CALLER $3c,$9791+1 ;;$3c:9761 menu.magic.main_loop
FIX_ADDR_ON_CALLER $3d,$a334+1 ;;$3d:a332 menu.party_summary.draw_content
FIX_ADDR_ON_CALLER $3e,$c02b+1 ;;opening.
;;
jsr menu.get_window_content_metrics
jmp render_x.init_as_no_borders
;inc <$38 ; AAA9 E6 38
;inc <$39 ; AAAB E6 39
;lda <$3C ; AAAD A5 3C
;sec ; AAAF 38
;sbc #$02 ; AAB0 E9 02
;sta <$3C ; AAB2 85 3C
;lda <$3D ; AAB4 A5 3D
;sec ; AAB6 38
;sbc #$02 ; AAB7 E9 02
;sta <$3D ; AAB9 85 3D
;rts ; AABB 60
VERIFY_PC_TO_PATCH_END menu.metrics
.endif ;;_FEATURE_DEFERRED_RENDERING |
Transynther/x86/_processed/NC/_st_zr_un_4k_/i9-9900K_12_0xa0.log_21829_54.asm | ljhsiun2/medusa | 9 | 89169 | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x1063e, %rsi
lea addresses_A_ht+0x16064, %rdi
clflush (%rdi)
sub %rdx, %rdx
mov $125, %rcx
rep movsq
nop
nop
add %r15, %r15
lea addresses_normal_ht+0x14c24, %rsi
lea addresses_WC_ht+0xc324, %rdi
nop
nop
add %rdx, %rdx
mov $45, %rcx
rep movsb
nop
nop
cmp %r15, %r15
lea addresses_WT_ht+0x116dc, %r14
sub $13738, %rdx
mov $0x6162636465666768, %rcx
movq %rcx, %xmm0
movups %xmm0, (%r14)
nop
nop
nop
nop
nop
sub $55877, %rcx
lea addresses_A_ht+0xf352, %rsi
lea addresses_A_ht+0x11524, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
add %r14, %r14
mov $18, %rcx
rep movsq
nop
nop
nop
nop
dec %rdi
lea addresses_A_ht+0x16000, %rdi
nop
nop
cmp %rdx, %rdx
mov (%rdi), %r14d
sub %r14, %r14
lea addresses_normal_ht+0xf504, %r15
nop
nop
sub $6101, %r14
mov (%r15), %si
nop
nop
add $38851, %rsi
lea addresses_normal_ht+0x2b24, %rcx
nop
nop
dec %rax
mov (%rcx), %r14
nop
nop
nop
dec %rcx
lea addresses_WT_ht+0x1de4, %r14
nop
add $54200, %rax
mov $0x6162636465666768, %rcx
movq %rcx, %xmm5
vmovups %ymm5, (%r14)
nop
and %r14, %r14
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %r9
push %rbx
push %rsi
// Store
lea addresses_A+0x1c524, %rbx
nop
nop
nop
add $2705, %r9
movb $0x51, (%rbx)
nop
nop
sub %r9, %r9
// Store
lea addresses_UC+0x4d24, %r13
nop
nop
nop
nop
add %rsi, %rsi
mov $0x5152535455565758, %r9
movq %r9, %xmm7
and $0xffffffffffffffc0, %r13
movaps %xmm7, (%r13)
nop
nop
nop
nop
sub %r14, %r14
// Faulty Load
mov $0x76aa5c0000000524, %r9
nop
nop
nop
dec %r10
movb (%r9), %r14b
lea oracles, %rsi
and $0xff, %r14
shlq $12, %r14
mov (%rsi,%r14,1), %r14
pop %rsi
pop %rbx
pop %r9
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_A', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_UC', 'AVXalign': True, 'size': 16}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}}
{'src': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16}}
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 9, 'type': 'addresses_A_ht'}}
{'src': {'NT': True, 'same': False, 'congruent': 1, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}}
{'51': 21427, '00': 185, '5f': 217}
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 5f 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 5f 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 5f 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 5f 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 5f 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 5f 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 5f 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 5f
*/
|
FormalAnalyzer/models/apps/HallLightWelcomeHome.als | Mohannadcse/IoTCOM_BehavioralRuleExtractor | 0 | 3983 | module app_HallLightWelcomeHome
open IoTBottomUp as base
open cap_runIn
open cap_now
open cap_presenceSensor
open cap_contactSensor
open cap_switch
one sig app_HallLightWelcomeHome extends IoTApp {
people : some cap_presenceSensor,
sensors : some cap_contactSensor,
lights : one cap_switch,
} {
rules = r
//capabilities = people + sensors + lights
}
abstract sig r extends Rule {}
one sig r0 extends r {}{
triggers = r0_trig
conditions = r0_cond
commands = r0_comm
}
abstract sig r0_trig extends Trigger {}
one sig r0_trig0 extends r0_trig {} {
capabilities = app_HallLightWelcomeHome.sensors
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val_open
}
abstract sig r0_cond extends Condition {}
abstract sig r0_comm extends Command {}
one sig r0_comm0 extends r0_comm {} {
capability = app_HallLightWelcomeHome.lights
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
/*
one sig r1 extends r {}{
triggers = r1_trig
conditions = r1_cond
commands = r1_comm
}
abstract sig r1_trig extends Trigger {}
one sig r1_trig0 extends r1_trig {} {
capabilities = app_HallLightWelcomeHome.people
attribute = cap_presenceSensor_attr_presence
value = cap_presenceSensor_attr_presence_val_present
}
abstract sig r1_cond extends Condition {}
abstract sig r1_comm extends Command {}
one sig r1_comm0 extends r1_comm {} {
capability = app_HallLightWelcomeHome.state
attribute = cap_lastPresence_attr_lastPresence
value = cap_lastPresence_attr_lastPresence_val_not_null
}
one sig r2 extends r {}{
triggers = r2_trig
conditions = r2_cond
commands = r2_comm
}
abstract sig r2_trig extends Trigger {}
one sig r2_trig0 extends r2_trig {} {
capabilities = app_HallLightWelcomeHome.sensors
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val_open
}
abstract sig r2_cond extends Condition {}
abstract sig r2_comm extends Command {}
one sig r2_comm0 extends r2_comm {} {
capability = app_HallLightWelcomeHome.state
attribute = cap_lastContact_attr_lastContact
value = cap_lastContact_attr_lastContact_val_not_null
}
*/
one sig r3 extends r {}{
triggers = r3_trig
conditions = r3_cond
commands = r3_comm
}
abstract sig r3_trig extends Trigger {}
one sig r3_trig0 extends r3_trig {} {
capabilities = app_HallLightWelcomeHome.people
attribute = cap_presenceSensor_attr_presence
value = cap_presenceSensor_attr_presence_val_present
}
abstract sig r3_cond extends Condition {}
abstract sig r3_comm extends Command {}
one sig r3_comm0 extends r3_comm {} {
capability = app_HallLightWelcomeHome.lights
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
|
Transynther/x86/_processed/NC/_st_zr_un_/i3-7100_9_0x84_notsx.log_1457_1174.asm | ljhsiun2/medusa | 9 | 11043 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x185eb, %rsi
lea addresses_A_ht+0xd78b, %rdi
nop
sub %r11, %r11
mov $50, %rcx
rep movsw
xor $688, %r12
lea addresses_WT_ht+0x1ceeb, %r8
nop
cmp $59600, %rsi
movb (%r8), %r12b
nop
nop
nop
nop
nop
cmp %rsi, %rsi
lea addresses_WT_ht+0x19d83, %rcx
nop
nop
nop
nop
xor $49971, %r9
mov $0x6162636465666768, %r11
movq %r11, (%rcx)
add $50134, %r11
lea addresses_D_ht+0x1498, %rcx
dec %r9
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
movups %xmm6, (%rcx)
nop
nop
nop
and $37180, %rsi
lea addresses_A_ht+0x33eb, %rdi
nop
nop
nop
nop
add $31913, %rcx
mov (%rdi), %esi
nop
sub $16440, %r8
lea addresses_normal_ht+0xb51b, %rsi
lea addresses_UC_ht+0xf1eb, %rdi
nop
nop
nop
nop
cmp $52848, %r11
mov $38, %rcx
rep movsq
nop
nop
cmp $34027, %r11
lea addresses_A_ht+0x29eb, %rsi
lea addresses_A_ht+0x1ed6b, %rdi
nop
cmp $12442, %r15
mov $77, %rcx
rep movsq
nop
nop
dec %r8
lea addresses_WT_ht+0x35eb, %rsi
lea addresses_D_ht+0x18c47, %rdi
nop
nop
nop
nop
add %r15, %r15
mov $52, %rcx
rep movsw
nop
nop
nop
nop
and $1689, %rdi
lea addresses_A_ht+0x5cb, %r15
nop
nop
nop
nop
add %r8, %r8
mov $0x6162636465666768, %rcx
movq %rcx, %xmm1
movups %xmm1, (%r15)
nop
nop
nop
sub $4198, %r12
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r14
push %r9
push %rbp
push %rdi
// Store
mov $0x7876440000000aeb, %r14
nop
nop
nop
and %r9, %r9
mov $0x5152535455565758, %rdi
movq %rdi, (%r14)
nop
nop
cmp %rdi, %rdi
// Store
lea addresses_WC+0x346d, %r12
nop
sub $22475, %rbp
mov $0x5152535455565758, %r11
movq %r11, %xmm5
movups %xmm5, (%r12)
nop
sub %r11, %r11
// Store
mov $0x7739ae00000005eb, %r11
sub %rbp, %rbp
movl $0x51525354, (%r11)
nop
nop
nop
xor %rbp, %rbp
// Store
lea addresses_D+0xedeb, %r13
clflush (%r13)
nop
nop
sub %r12, %r12
movb $0x51, (%r13)
cmp %r11, %r11
// Faulty Load
mov $0x55ba700000005eb, %r13
nop
nop
nop
nop
nop
add $34872, %rbp
mov (%r13), %r14w
lea oracles, %r9
and $0xff, %r14
shlq $12, %r14
mov (%r9,%r14,1), %r14
pop %rdi
pop %rbp
pop %r9
pop %r14
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 4, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 8, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D_ht', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'54': 972, '00': 16, 'e0': 469}
00 54 54 e0 e0 54 54 e0 e0 e0 54 54 54 54 54 54 54 e0 54 54 54 e0 54 e0 e0 54 54 54 54 54 54 54 54 e0 54 e0 54 e0 e0 54 54 00 54 54 54 54 e0 54 54 54 00 54 e0 e0 e0 54 e0 54 54 e0 e0 e0 e0 54 54 e0 54 54 54 54 e0 54 54 54 54 54 e0 e0 e0 e0 e0 e0 e0 e0 54 54 e0 54 54 54 54 e0 e0 54 54 54 54 e0 54 54 54 54 54 e0 54 54 00 54 e0 54 e0 54 54 e0 e0 e0 e0 e0 54 e0 e0 e0 54 e0 e0 e0 e0 e0 54 e0 e0 54 54 e0 54 54 e0 54 e0 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 e0 54 54 e0 e0 54 e0 54 54 e0 54 54 54 54 54 54 54 54 54 54 54 54 54 54 e0 e0 e0 54 54 54 e0 54 e0 e0 e0 e0 54 e0 54 e0 54 54 e0 54 54 54 e0 e0 e0 e0 e0 e0 e0 54 e0 54 54 e0 54 54 54 54 54 54 54 54 54 54 e0 54 54 54 e0 e0 e0 54 54 54 54 54 e0 e0 e0 54 e0 54 54 54 54 54 e0 54 54 54 e0 e0 54 e0 54 54 54 54 e0 e0 e0 54 54 54 e0 54 54 e0 54 54 54 e0 e0 54 54 54 54 54 e0 e0 54 54 e0 54 54 54 54 e0 54 54 54 54 54 54 54 54 54 54 54 54 54 54 e0 54 54 54 54 54 e0 54 e0 e0 54 54 e0 54 54 54 e0 54 e0 54 e0 54 e0 54 54 54 54 54 54 e0 e0 54 e0 54 e0 e0 54 e0 e0 54 54 e0 54 54 54 54 54 54 54 54 54 54 e0 54 54 54 54 e0 54 e0 e0 54 54 54 54 54 e0 54 e0 54 e0 54 e0 e0 e0 e0 00 54 54 e0 54 e0 54 54 54 54 54 54 e0 e0 54 54 e0 54 54 54 54 54 e0 e0 54 e0 e0 54 54 e0 e0 e0 e0 e0 54 54 54 e0 e0 54 54 54 e0 54 54 54 e0 54 e0 54 54 e0 e0 54 54 e0 54 54 54 54 e0 54 54 e0 e0 e0 54 54 e0 54 54 54 54 54 54 54 54 e0 54 54 e0 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 e0 54 54 54 54 54 00 54 54 54 54 e0 e0 54 54 54 e0 54 54 54 54 e0 e0 54 54 e0 e0 54 54 54 54 54 e0 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 e0 e0 54 54 e0 54 54 e0 e0 54 54 e0 54 54 e0 54 e0 e0 e0 54 54 54 54 54 54 54 54 54 54 e0 e0 e0 54 54 e0 54 54 54 e0 54 e0 54 54 e0 54 54 54 54 54 54 e0 54 e0 54 54 54 54 e0 54 e0 54 e0 54 e0 e0 54 54 54 e0 54 54 54 54 e0 e0 54 54 e0 54 e0 54 54 54 e0 e0 54 54 e0 54 54 54 e0 e0 54 54 e0 54 e0 e0 54 54 e0 e0 54 e0 54 e0 e0 e0 54 e0 e0 e0 54 e0 54 54 e0 54 e0 e0 e0 e0 e0 54 54 54 54 e0 54 e0 54 54 54 54 54 e0 54 e0 e0 54 e0 54 54 54 54 54 54 54 54 e0 e0 54 e0 e0 e0 e0 e0 54 54 54 54 e0 e0 54 e0 54 54 e0 54 e0 e0 54 54 54 54 e0 54 54 54 54 54 54 54 54 54 54 e0 54 54 54 54 54 54 54 e0 e0 e0 54 54 54 e0 e0 e0 54 54 54 54 54 54 54 54 54 e0 e0 54 54 54 e0 e0 54 54 54 54 e0 e0 54 54 e0 54 54 54 54 54 54 e0 e0 54 54 54 54 54 54 54 e0 54 54 e0 e0 54 54 54 e0 54 54 54 54 54 e0 54 54 e0 54 e0 54 54 e0 54 e0 54 e0 54 54 e0 54 54 e0 54 e0 54 54 54 e0 54 54 54 54 54 e0 e0 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 e0 54 54 54 54 54 54 54 54 54 54 54 54 54 e0 e0 54 54 54 e0 54 54 e0 54 e0 54 54 e0 54 e0 e0 54 e0 54 54 e0 e0 e0 54 54 54 54 54 54 e0 54 54 54 54 54 54 54 54 e0 e0 54 54 54 e0 e0 54 e0 54 e0 54 54 e0 e0 54 54 e0 54 e0 00 e0 e0 54 e0 54 54 54 54 54 54 54 54 54 54 54 54 e0 54 54 54 54 54 54 54 54 54 54 00 e0 54 54 54 54 e0 54 54 54 00 54 e0 e0 54 e0 e0 e0 e0 54 e0 54 54 e0 e0 54 54 54 54 e0 e0 e0 54 54 e0 54
*/
|
bb-runtimes/src/s-bbsuti__ppc.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 25761 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . B B . B O A R D _ S U P P O R T . T I M E --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2005 The European Space Agency --
-- Copyright (C) 2003-2017, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
-- The port of GNARL to bare board targets was initially developed by the --
-- Real-Time Systems Group at the Technical University of Madrid. --
-- --
------------------------------------------------------------------------------
-- For PowerPc: use time base and decrementer registers from the core
with System.Machine_Code; use System.Machine_Code;
separate (System.BB.Board_Support)
package body Time is
-----------------------
-- Local Definitions --
-----------------------
type Unsigned_32 is mod 2 ** 32;
for Unsigned_32'Size use 32;
-- Values of this type represent number of times that the clock finishes
-- its countdown. This type should allow atomic reads and updates.
function Read_TBL return Unsigned_32;
pragma Inline (Read_TBL);
-- Read the Time Base Lower word
function Read_TBU return Unsigned_32;
pragma Inline (Read_TBU);
-- Read the Time Base Upper word
----------------
-- Read_Clock --
----------------
function Read_Clock return BB.Time.Time is
use type BB.Time.Time;
Lo : Unsigned_32;
Hi : Unsigned_32;
Hi1 : Unsigned_32;
begin
-- We can't atomically read the 64-bits counter. So check that the
-- 32 MSB don't change.
Hi := Read_TBU;
loop
Lo := Read_TBL;
Hi1 := Read_TBU;
exit when Hi = Hi1;
Hi := Hi1;
end loop;
return (BB.Time.Time (Hi) * 2 ** 32) + BB.Time.Time (Lo);
end Read_Clock;
---------------------------
-- Install_Alarm_Handler --
---------------------------
procedure Install_Alarm_Handler
(Handler : BB.Interrupts.Interrupt_Handler) is
begin
CPU_Specific.Install_Exception_Handler
(Handler.all'Address, CPU_Specific.Decrementer_Excp);
end Install_Alarm_Handler;
--------------
-- Read_TBL --
--------------
function Read_TBL return Unsigned_32 is
Res : Unsigned_32;
begin
Asm ("mftbl %0",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Read_TBL;
--------------
-- Read_TBU --
--------------
function Read_TBU return Unsigned_32 is
Res : Unsigned_32;
begin
Asm ("mftbu %0",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Read_TBU;
---------------
-- Set_Alarm --
---------------
procedure Set_Alarm (Ticks : BB.Time.Time)
is
use BB.Time;
Now : constant BB.Time.Time := Read_Clock;
Diff : constant Unsigned_64 :=
(if Ticks > Now then Unsigned_64 (Ticks - Now) else 1);
Val : Unsigned_32;
begin
if Diff >= 2 ** 31 then
Val := 16#7FFF_FFFF#;
-- The maximum value that can be set in the DEC register. MSB must
-- not be set to avoid a useless interrupt (PowerPC triggers an
-- interrupt when the MSB switches from 0 to 1).
else
Val := Unsigned_32 (Diff);
end if;
Asm ("mtdec %0",
Inputs => Unsigned_32'Asm_Input ("r", Val),
Volatile => True);
end Set_Alarm;
---------------------------
-- Clear_Alarm_Interrupt --
---------------------------
procedure Clear_Alarm_Interrupt
renames BB.Board_Support.Clear_Alarm_Interrupt;
end Time;
|
test/Succeed/PropSquash.agda | asr/eagda | 1 | 12204 | {-# OPTIONS --enable-prop #-}
data Squash {ℓ} (A : Set ℓ) : Prop ℓ where
squash : A → Squash A
squash-elim : ∀ {ℓ₁ ℓ₂} (A : Set ℓ₁) (P : Prop ℓ₂)
→ (A → P) → Squash A → P
squash-elim A P f (squash x) = f x
|
Rings/Homomorphisms/Image.agda | Smaug123/agdaproofs | 4 | 14965 | <reponame>Smaug123/agdaproofs
{-# OPTIONS --safe --warning=error --without-K #-}
open import LogicalFormulae
open import Setoids.Setoids
open import Sets.EquivalenceRelations
open import Rings.Definition
open import Rings.Homomorphisms.Definition
module Rings.Homomorphisms.Image {a b c d : _} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_+A_ _*A_ : A → A → A} {_+B_ _*B_ : B → B → B} {R1 : Ring S _+A_ _*A_} {R2 : Ring T _+B_ _*B_} {f : A → B} (hom : RingHom R1 R2 f) where
open import Groups.Homomorphisms.Image (RingHom.groupHom hom)
open import Rings.Subrings.Definition
imageGroupSubring : Subring R2 imageGroupPred
Subring.isSubgroup imageGroupSubring = imageGroupSubgroup
Subring.containsOne imageGroupSubring = Ring.1R R1 , RingHom.preserves1 hom
Subring.closedUnderProduct imageGroupSubring {x} {y} (a , fa=x) (b , fb=y) = (a *A b) , transitive ringHom (Ring.*WellDefined R2 fa=x fb=y)
where
open Setoid T
open Equivalence eq
open RingHom hom
|
oeis/261/A261273.asm | neoneye/loda-programs | 11 | 26100 | ; A261273: Take the list of positive rationals {R(n): n>=1} in the order defined by Calkin and Wilf (Recounting the Rationals, 1999); a(n) = denominator of R(prime(n)).
; Submitted by <NAME>(s2)
; 2,1,2,1,2,3,4,3,2,4,1,7,8,5,2,8,4,5,5,4,11,3,8,12,9,12,5,8,11,10,1,6,14,9,18,7,13,11,8,18,12,19,2,11,16,7,13,3,10,17,18,4,13,6,8,6,16,5,23,22,13,26,17,10,23,16,19,29,18,23,22,12,7,25,11,2,20,23,26,29,18,31,8,27,11,14,16,27,24,7,18,4,9,14,11,6,8,20,13,21
seq $0,40 ; The prime numbers.
add $0,1
seq $0,2487 ; Stern's diatomic series (or Stern-Brocot sequence): a(0) = 0, a(1) = 1; for n > 0: a(2*n) = a(n), a(2*n+1) = a(n) + a(n+1).
|
Transynther/x86/_processed/AVXALIGN/_st_sm_/i9-9900K_12_0xa0_notsx.log_21829_265.asm | ljhsiun2/medusa | 9 | 179919 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x5016, %rsi
lea addresses_WC_ht+0x3b16, %rdi
nop
nop
nop
nop
nop
add $64571, %r11
mov $45, %rcx
rep movsb
nop
nop
cmp $47467, %rbp
lea addresses_WT_ht+0xd716, %rsi
lea addresses_WC_ht+0x1db16, %rdi
nop
nop
dec %r9
mov $87, %rcx
rep movsb
nop
add $34890, %rcx
lea addresses_WT_ht+0x1c716, %rdi
nop
nop
nop
add %r9, %r9
mov $0x6162636465666768, %rbp
movq %rbp, (%rdi)
nop
nop
nop
nop
nop
cmp %rsi, %rsi
lea addresses_normal_ht+0xe6fe, %rsi
lea addresses_WT_ht+0x1ac3a, %rdi
nop
nop
nop
nop
nop
and $35458, %rbx
mov $60, %rcx
rep movsl
nop
nop
sub %rbx, %rbx
lea addresses_WT_ht+0x1e0ae, %rbp
sub %rbx, %rbx
mov (%rbp), %r11w
nop
nop
nop
nop
nop
xor %r9, %r9
lea addresses_normal_ht+0x10056, %rbp
dec %r9
mov $0x6162636465666768, %rbx
movq %rbx, %xmm7
vmovups %ymm7, (%rbp)
nop
nop
nop
nop
inc %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r15
push %rcx
push %rdi
push %rdx
push %rsi
// REPMOV
lea addresses_PSE+0x6b16, %rsi
lea addresses_A+0x8316, %rdi
nop
cmp $37733, %r13
mov $99, %rcx
rep movsw
nop
nop
nop
add %rsi, %rsi
// Store
lea addresses_WT+0xc316, %r13
nop
cmp %rdx, %rdx
movb $0x51, (%r13)
sub %r15, %r15
// Store
lea addresses_D+0xaf16, %r13
nop
nop
nop
xor %rcx, %rcx
movw $0x5152, (%r13)
nop
and %rsi, %rsi
// Load
lea addresses_UC+0xb16, %r15
sub %r14, %r14
vmovups (%r15), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %rcx
nop
add $2741, %r15
// Store
lea addresses_WC+0x16116, %r14
clflush (%r14)
nop
nop
cmp $20100, %r13
mov $0x5152535455565758, %rsi
movq %rsi, %xmm0
movups %xmm0, (%r14)
nop
nop
nop
nop
cmp $48178, %rsi
// Store
lea addresses_PSE+0x1f9a6, %rcx
nop
nop
nop
sub $32236, %r13
movb $0x51, (%rcx)
nop
nop
and $53888, %rdi
// Load
lea addresses_UC+0x13496, %rsi
nop
nop
and %r13, %r13
movups (%rsi), %xmm1
vpextrq $0, %xmm1, %r15
nop
nop
add $28841, %r14
// Load
lea addresses_PSE+0x12e5a, %rdx
nop
nop
nop
nop
and %rsi, %rsi
vmovups (%rdx), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %rcx
nop
nop
nop
nop
dec %r13
// Store
lea addresses_WT+0xc316, %r15
nop
nop
nop
nop
sub $2385, %rcx
movw $0x5152, (%r15)
nop
and $63189, %r14
// Store
lea addresses_A+0xc3e, %rdx
nop
nop
nop
nop
add %r13, %r13
mov $0x5152535455565758, %r15
movq %r15, %xmm0
movups %xmm0, (%rdx)
add %r15, %r15
// Store
lea addresses_D+0x1e8d6, %r14
nop
nop
nop
nop
nop
cmp $53711, %rsi
movb $0x51, (%r14)
nop
nop
nop
cmp %rdx, %rdx
// Store
lea addresses_D+0x1ac84, %rdx
nop
nop
xor %rdi, %rdi
movl $0x51525354, (%rdx)
dec %r14
// Store
lea addresses_D+0x16716, %rcx
nop
nop
nop
nop
dec %rdi
mov $0x5152535455565758, %r13
movq %r13, %xmm0
movups %xmm0, (%rcx)
cmp %rdx, %rdx
// Store
lea addresses_A+0x4f96, %rsi
nop
nop
nop
nop
sub $6748, %rcx
movw $0x5152, (%rsi)
nop
and %rsi, %rsi
// Faulty Load
lea addresses_WT+0xc316, %r14
nop
xor $2062, %rdi
mov (%r14), %esi
lea oracles, %rdi
and $0xff, %rsi
shlq $12, %rsi
mov (%rdi,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WT', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_PSE', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}}
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 6}}
[Faulty Load]
{'src': {'type': 'addresses_WT', 'AVXalign': True, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 9}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 5}}
{'52': 21829}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
|
src/Categories/Category/Monoidal/Symmetric.agda | MirceaS/agda-categories | 0 | 12196 | <filename>src/Categories/Category/Monoidal/Symmetric.agda
{-# OPTIONS --without-K --safe #-}
open import Categories.Category
open import Categories.Category.Monoidal
module Categories.Category.Monoidal.Symmetric {o ℓ e} {C : Category o ℓ e} (M : Monoidal C) where
open import Level
open import Data.Product using (Σ; _,_)
open import Categories.Functor.Bifunctor
open import Categories.Functor.Properties
open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)
open import Categories.Morphism C
open import Categories.Morphism.Properties C
open import Categories.Category.Monoidal.Braided M
open Category C
open Commutation
private
variable
X Y Z : Obj
-- symmetric monoidal category
-- commutative braided monoidal category
--
-- the reason why we define symmetric categories via braided monoidal categories could
-- be not obvious, but it is the right definition: it requires again a redundant
-- hexagon proof which allows achieves definitional equality of the opposite.
record Symmetric : Set (levelOfTerm M) where
field
braided : Braided
module braided = Braided braided
open braided public
private
B : ∀ {X Y} → X ⊗₀ Y ⇒ Y ⊗₀ X
B {X} {Y} = braiding.⇒.η (X , Y)
field
commutative : B {X} {Y} ∘ B {Y} {X} ≈ id
braided-iso : X ⊗₀ Y ≅ Y ⊗₀ X
braided-iso = record
{ from = B
; to = B
; iso = record
{ isoˡ = commutative
; isoʳ = commutative
}
}
module braided-iso {X Y} = _≅_ (braided-iso {X} {Y})
private
record Symmetric′ : Set (levelOfTerm M) where
open Monoidal M
field
braiding : NaturalIsomorphism ⊗ (flip-bifunctor ⊗)
module braiding = NaturalIsomorphism braiding
private
B : ∀ {X Y} → X ⊗₀ Y ⇒ Y ⊗₀ X
B {X} {Y} = braiding.⇒.η (X , Y)
field
commutative : B {X} {Y} ∘ B {Y} {X} ≈ id
hexagon : [ (X ⊗₀ Y) ⊗₀ Z ⇒ Y ⊗₀ Z ⊗₀ X ]⟨
B ⊗₁ id ⇒⟨ (Y ⊗₀ X) ⊗₀ Z ⟩
associator.from ⇒⟨ Y ⊗₀ X ⊗₀ Z ⟩
id ⊗₁ B
≈ associator.from ⇒⟨ X ⊗₀ Y ⊗₀ Z ⟩
B ⇒⟨ (Y ⊗₀ Z) ⊗₀ X ⟩
associator.from
⟩
braided-iso : X ⊗₀ Y ≅ Y ⊗₀ X
braided-iso = record
{ from = B
; to = B
; iso = record
{ isoˡ = commutative
; isoʳ = commutative
}
}
module braided-iso {X Y} = _≅_ (braided-iso {X} {Y})
-- we don't define [Symmetric] from [Braided] because we want to avoid asking
-- [hexagon₂], which can readily be proven using the [hexagon] and [commutative].
braided : Braided
braided = record
{ braiding = braiding
; hexagon₁ = hexagon
; hexagon₂ = λ {X Y Z} →
Iso-≈ hexagon
(Iso-∘ (Iso-∘ ([ -⊗ Y ]-resp-Iso braided-iso.iso) associator.iso)
([ X ⊗- ]-resp-Iso braided-iso.iso))
(Iso-∘ (Iso-∘ associator.iso braided-iso.iso)
associator.iso)
}
symmetricHelper : Symmetric′ → Symmetric
symmetricHelper S = record
{ braided = braided
; commutative = commutative
}
where open Symmetric′ S
|
awa/src/awa-commands-drivers.ads | twdroeger/ada-awa | 81 | 24403 | <reponame>twdroeger/ada-awa<filename>awa/src/awa-commands-drivers.ads<gh_stars>10-100
-----------------------------------------------------------------------
-- awa-commands-drivers -- Driver for AWA commands for server or admin tool
-- Copyright (C) 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with GNAT.Command_Line;
with GNAT.Strings;
with Util.Commands.Drivers;
with Util.Commands.Parsers.GNAT_Parser;
with Servlet.Server;
with AWA.Applications;
generic
Driver_Name : String;
type Container_Type is limited new Servlet.Server.Container with private;
package AWA.Commands.Drivers is
package Main_Driver is
new Util.Commands.Drivers (Context_Type => Context_Type,
Config_Parser => Util.Commands.Parsers.GNAT_Parser.Config_Parser,
Driver_Name => Driver_Name);
subtype Help_Command_Type is Main_Driver.Help_Command_Type;
subtype Driver_Type is Main_Driver.Driver_Type;
type Command_Type is abstract new Main_Driver.Command_Type with null record;
-- Setup the command before parsing the arguments and executing it.
overriding
procedure Setup (Command : in out Command_Type;
Config : in out GNAT.Command_Line.Command_Line_Configuration;
Context : in out Context_Type);
-- Write the help associated with the command.
overriding
procedure Help (Command : in out Command_Type;
Name : in String;
Context : in out Context_Type);
type Application_Command_Type is abstract new Command_Type with record
Application_Name : aliased GNAT.Strings.String_Access;
end record;
function Is_Application (Command : in Application_Command_Type;
URI : in String) return Boolean;
procedure Execute (Command : in out Application_Command_Type;
Application : in out AWA.Applications.Application'Class;
Args : in Argument_List'Class;
Context : in out Context_Type) is abstract;
-- Setup the command before parsing the arguments and executing it.
overriding
procedure Setup (Command : in out Application_Command_Type;
Config : in out GNAT.Command_Line.Command_Line_Configuration;
Context : in out Context_Type);
overriding
procedure Execute (Command : in out Application_Command_Type;
Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type);
-- Print the command usage.
procedure Usage (Args : in Argument_List'Class;
Context : in out Context_Type;
Name : in String := "");
-- Execute the command with its arguments.
procedure Execute (Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type);
procedure Run (Context : in out Context_Type;
Arguments : out Util.Commands.Dynamic_Argument_List);
Driver : Drivers.Driver_Type;
WS : Container_Type;
end AWA.Commands.Drivers;
|
libsrc/spectrum/zxmmc/mmc_init.asm | andydansby/z88dk-mk2 | 1 | 166039 | <filename>libsrc/spectrum/zxmmc/mmc_init.asm<gh_stars>1-10
;
;
; ZX Spectrum ZXMMC specific routines
; code by <NAME>
; ported to z88dk by <NAME> - Feb 2010
;
; $Id: mmc_init.asm,v 1.1 2010/03/12 15:21:14 stefano Exp $
;
;
;-----------------------------------------------------------------------------------------
; MMC SPI MODE initialization. RETURNS ERROR CODE IN A register:
;
; 0 = OK
; 1 = Card RESET ERROR
; 2 = Card INIT ERROR
;
; Destroys AF, B.
;
;
; NOTE: 'pause1' delay needs to be tuned if run on overclocked ZX clones
;
;-----------------------------------------------------------------------------------------
;
XLIB mmc_init
LIB cs_high
LIB cs_low
LIB mmc_wait_response
LIB mmc_write_command
INCLUDE "zxmmc.def"
mmc_init:
call cs_high ; set cs high
ld b,10 ; sends 80 clocks
ld a,$FF
l_init:
out (SPI_PORT),a
djnz l_init
nop
call cs_low ; set cs low
ld a,MMC_GO_IDLE_STATE
call mmc_write_command
call mmc_wait_response
cp $01 ; MMC should respond 01 to this command
jr nz,mmc_reset_failed ; fail to reset
ld bc,120 ; retry counter*256 (about five seconds @3.5MHz)
mmc_reset_ok:
call cs_high ; set cs high
ld a,$FF
out (SPI_PORT),a ; 8 extra clock cycles
nop
nop
call cs_low ; set cs low
ld a,MMC_SEND_OP_COND ; Sends OP_COND command
call mmc_write_command
call mmc_wait_response ; MMC_WAIT_RESPONSE tries to receive a response reading an SPI
bit 0,a ; D0 SET = initialization still in progress...
jr z,mmc_init_ok
djnz mmc_reset_ok ; if no response, tries to send the entire block 254 more times
dec c
jr nz,mmc_reset_ok
ld a,2 ; error code for INIT ERROR
jr mmc_errorx
mmc_init_ok:
call cs_high ; set cs high
in a,(SPI_PORT) ; some extra clock cycles
call pause1
xor a
ret
mmc_reset_failed: ; MMC Reset error
ld a,1
mmc_errorx:
call cs_high
ret
pause1:
push hl
ld hl,$8000 ; OK for 3.5MHz ONLY (7MHz requires two calls or ld hl,0 and so on)
loop3: dec hl
ld a,h
or l
jr nz,loop3
pop hl
ret
|
source/oasis/program-elements-enumeration_representation_clauses.ads | optikos/oasis | 0 | 22038 | <filename>source/oasis/program-elements-enumeration_representation_clauses.ads
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Representation_Clauses;
with Program.Lexical_Elements;
with Program.Elements.Expressions;
with Program.Elements.Array_Aggregates;
package Program.Elements.Enumeration_Representation_Clauses is
pragma Pure (Program.Elements.Enumeration_Representation_Clauses);
type Enumeration_Representation_Clause is
limited interface
and Program.Elements.Representation_Clauses.Representation_Clause;
type Enumeration_Representation_Clause_Access is
access all Enumeration_Representation_Clause'Class with Storage_Size => 0;
not overriding function Name
(Self : Enumeration_Representation_Clause)
return not null Program.Elements.Expressions.Expression_Access
is abstract;
not overriding function Expression
(Self : Enumeration_Representation_Clause)
return not null Program.Elements.Array_Aggregates.Array_Aggregate_Access
is abstract;
type Enumeration_Representation_Clause_Text is limited interface;
type Enumeration_Representation_Clause_Text_Access is
access all Enumeration_Representation_Clause_Text'Class
with Storage_Size => 0;
not overriding function To_Enumeration_Representation_Clause_Text
(Self : aliased in out Enumeration_Representation_Clause)
return Enumeration_Representation_Clause_Text_Access is abstract;
not overriding function For_Token
(Self : Enumeration_Representation_Clause_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Use_Token
(Self : Enumeration_Representation_Clause_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Semicolon_Token
(Self : Enumeration_Representation_Clause_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Enumeration_Representation_Clauses;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/inline3_pkg.adb | best08618/asylo | 7 | 19306 | package body Inline3_Pkg is
procedure Test (I : Integer) is
function F (J : Integer) return Integer is
begin
return I - J;
end;
begin
if I /= F (I) then
raise Program_Error;
end if;
end;
end Inline3_Pkg;
|
Transynther/x86/_processed/NONE/_st_zr_un_/i9-9900K_12_0xca.log_21829_570.asm | ljhsiun2/medusa | 9 | 4767 | <filename>Transynther/x86/_processed/NONE/_st_zr_un_/i9-9900K_12_0xca.log_21829_570.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %r8
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0xe9f0, %rbp
nop
nop
xor %r8, %r8
and $0xffffffffffffffc0, %rbp
vmovntdqa (%rbp), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %r15
nop
nop
nop
nop
sub %r12, %r12
lea addresses_WT_ht+0x159fd, %r8
nop
nop
nop
inc %r11
movl $0x61626364, (%r8)
add %r15, %r15
lea addresses_WC_ht+0x1e0f0, %r8
nop
add $31354, %rdx
mov (%r8), %rbp
and $279, %rdx
lea addresses_D_ht+0xb7f0, %r8
nop
nop
add %rbp, %rbp
mov $0x6162636465666768, %r12
movq %r12, %xmm3
movups %xmm3, (%r8)
xor $13057, %r11
lea addresses_WT_ht+0x164fe, %rsi
lea addresses_WT_ht+0x19f0, %rdi
clflush (%rsi)
xor %r15, %r15
mov $4, %rcx
rep movsw
nop
xor $11945, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r14
push %rbp
push %rdx
push %rsi
// Store
lea addresses_UC+0xd3f0, %r10
nop
nop
sub %rsi, %rsi
mov $0x5152535455565758, %r14
movq %r14, %xmm5
vmovntdq %ymm5, (%r10)
nop
nop
nop
nop
cmp $30642, %r12
// Faulty Load
lea addresses_WC+0xe3f0, %rsi
nop
nop
dec %rdx
movb (%rsi), %r12b
lea oracles, %r11
and $0xff, %r12
shlq $12, %r12
mov (%r11,%r12,1), %r12
pop %rsi
pop %rdx
pop %rbp
pop %r14
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': True, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 11}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 32, 'NT': True, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': True, 'AVXalign': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': True, 'AVXalign': False, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 8}}
{'00': 4, '58': 21615, '5f': 210}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5f 5f 5f 5f 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5f 5f 5f 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5f 5f 58 5f 58 58 58 58 58 58 58 58 5f 5f 5f 5f 5f 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
PVPokeMini/PokeMini/pokemini-code/dev-misc/examples/framebuffer/framebuffer.asm | DaddyCal/Provenance | 0 | 9508 | <reponame>DaddyCal/Provenance<filename>PVPokeMini/PokeMini/pokemini-code/dev-misc/examples/framebuffer/framebuffer.asm
.include "pm_libs/pm_init.s"
pm_header "TestFramebuf", IRQ_KEY_POWER, 0
; Shutdown down when power key pressed
irq_key_power:
cint CINT_SHUTDOWN
main:
; Enable interrupts
enable_irqs IRQ_KEY_POWER | IRQ_PRC_COPY ; PRC_COPY declared to wake up HALT
enable_mirq
; Blank LCD
mov a, 0
cint CINT_TMP_CONTRAST
; Setup PRC
mov [n+PRC_MODE], PRC_ENABLE
mov [n+PRC_RATE], PRC_24FPS
; Copy image to VRAM
mov y, teampokeme
mov x, VRAM_BASE
mov hl, 768
: mov a, [y]
mov [x], a
inc x
inc y
dec hl
jnzb :b
; Fade in
mov a, 0
: push a
cint CINT_TMP_CONTRAST
pop a
halt
inc a
cmp a, $20
jnzb :b
; Wait for any key press
mov a, 0
: halt
mov a, [n+KEY_PAD]
cmp a, $FF
jzb :b
; Fade out
mov a, $20
: push a
cint CINT_TMP_CONTRAST
pop a
halt
dec a
jnzb :b
; Shutdown
cint CINT_SHUTDOWN
pm_align_tiles
teampokeme:
.incbin "teampokeme.bin"
pm_rominfo
|
Data/List/Sorting/InsertionSort.agda | Lolirofle/stuff-in-agda | 6 | 1648 | import Lvl
open import Data.Boolean
open import Type
module Data.List.Sorting.InsertionSort {ℓ} {T : Type{ℓ}} (_≤?_ : T → T → Bool) where
open import Data.List
import Data.List.Functions as List
open import Data.List.Sorting.Functions(_≤?_)
insertion-sort : List(T) → List(T)
insertion-sort = List.foldᵣ insert ∅
module Proofs where
open import Data.Boolean.Stmt
open import Data.List.Relation.Permutation
open import Data.List.Sorting(_≤?_)
open import Data.List.Sorting.Proofs(_≤?_)
open import Functional using (_∘₂_)
open import Logic.Propositional
open import Relator.Equals
open import Structure.Relator.Properties
open import Syntax.Transitivity
module _ (asym : ∀{x y} → (x ≤? y ≡ not(y ≤? x))) where -- TODO: Use Structure.Relator.Properties.Asymmetry by the relation (IsTrue ∘₂ (_≤?_))
instance
insertion-sort-sorted-proof : ∀{l} → Sorted(insertion-sort l)
insertion-sort-sorted-proof {∅} = empty
insertion-sort-sorted-proof {x ⊰ l} = insert-sorted-proof asym (insertion-sort-sorted-proof {l})
insert-permutation-proof : ∀{x}{l} → ((insert x l) permutes (x ⊰ l))
insert-permutation-proof {x} {∅} = prepend _permutes_.empty
insert-permutation-proof {x} {a ⊰ l} with (x ≤? a)
... | 𝑇 = reflexivity(_permutes_)
... | 𝐹 =
a ⊰ insert x l 🝖-[ _permutes_.prepend (insert-permutation-proof {x} {l}) ]
a ⊰ x ⊰ l 🝖-[ _permutes_.swap ]
x ⊰ a ⊰ l 🝖-end
instance
insertion-sort-permutation-proof : ∀{l} → ((insertion-sort l) permutes l)
insertion-sort-permutation-proof {∅} = _permutes_.empty
insertion-sort-permutation-proof {x ⊰ l} =
insertion-sort (x ⊰ l) 🝖-[ insert-permutation-proof ]
x ⊰ (insertion-sort l) 🝖-[ prepend (insertion-sort-permutation-proof {l}) ]
x ⊰ l 🝖-end
instance
insertion-sort-sorting-algorithm : SortingAlgorithm(insertion-sort)
SortingAlgorithm.sorts insertion-sort-sorting-algorithm {l} = insertion-sort-sorted-proof {l}
SortingAlgorithm.permutes insertion-sort-sorting-algorithm = insertion-sort-permutation-proof
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.