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
oeis/064/A064329.asm
neoneye/loda-programs
11
94886
<gh_stars>10-100 ; A064329: Generalized Catalan numbers C(-7; n). ; Submitted by <NAME> ; 1,1,-6,85,-1490,29226,-614004,13511709,-307448490,7174776190,-170777485556,4130050311234,-101192982385844,2506610481299380,-62668163792277840,1579300030107459885,-40076101342241993370,1023149605518475916790,-26261523666090765436740,677286494263974533999670,-17542081072522912466942940,456102528857888277317647500,-11900327905773736244873149560,311482855297532426981642552370,-8176537545588854726948901702660,215209179600628931257196084098476,-5678277133340909504180249797662984 mov $1,1 mov $3,$0 lpb $3 mov $0,$1 mul $0,14 mul $1,7 sub $2,2 sub $3,1 mul $1,$3 add $2,1 div $1,$2 add $4,$1 sub $1,$0 lpe mov $0,$4 add $0,1
Streams/SizedStreams.agda
hbasold/Sandbox
0
1238
open import Function open import Relation.Binary open import Relation.Binary.PropositionalEquality as P open ≡-Reasoning open import Data.Empty open import Data.Unit open import Data.Sum as Sum open import Data.Product as Prod record ℕ∞ : Set where coinductive field pred : ⊤ ⊎ ℕ∞ open ℕ∞ public data-~ℕ∞~ : ⊤ ⊎ ℕ∞ → ⊤ ⊎ ℕ∞ → Set record _~ℕ∞~_ (n m : ℕ∞) : Set where coinductive field pred~ : data-~ℕ∞~ (pred n) (pred m) open _~ℕ∞~_ public data-~ℕ∞~ (inj₁ tt) (inj₁ tt) = ⊤ data-~ℕ∞~ (inj₁ tt) (inj₂ m') = ⊥ data-~ℕ∞~ (inj₂ n') (inj₁ tt) = ⊥ data-~ℕ∞~ (inj₂ n') (inj₂ m') = n' ~ℕ∞~ m' refl-ℕ∞ : {n : ℕ∞} → n ~ℕ∞~ n pred~ (refl-ℕ∞ {n}) with pred n pred~ refl-ℕ∞ | inj₁ tt = tt pred~ refl-ℕ∞ | inj₂ n' = refl-ℕ∞ ∞ : ℕ∞ pred ∞ = inj₂ ∞ succ : ℕ∞ → ℕ∞ pred (succ n) = inj₂ n _+∞_ : ℕ∞ → ℕ∞ → ℕ∞ pred (n +∞ m) with pred n | pred m pred (n +∞ m) | inj₁ tt | inj₁ tt = inj₁ tt pred (n +∞ m) | inj₁ tt | inj₂ m' = inj₂ m' pred (n +∞ m) | inj₂ n' | inj₁ tt = inj₂ n' pred (n +∞ m) | inj₂ n' | inj₂ m' = inj₂ (record { pred = inj₂ (n' +∞ m') }) +∞-comm : (n m : ℕ∞) → (n +∞ m) ~ℕ∞~ (m +∞ n) pred~ (+∞-comm n m) with pred n | pred m pred~ (+∞-comm n m) | inj₁ tt | inj₁ tt = tt pred~ (+∞-comm n m) | inj₁ tt | inj₂ m' = refl-ℕ∞ pred~ (+∞-comm n m) | inj₂ n' | inj₁ tt = refl-ℕ∞ pred~ (+∞-comm n m) | inj₂ n' | inj₂ m' = record { pred~ = +∞-comm n' m' } 2×_ : ℕ∞ → ℕ∞ pred (2× n) with pred n pred (2× n) | inj₁ tt = inj₁ tt pred (2× n) | inj₂ n' = inj₂ (record { pred = inj₂ (2× n') }) StrData : Set → (ℕ∞ → Set) → ⊤ ⊎ ℕ∞ → Set StrData A F (inj₁ tt) = ⊤ StrData A F (inj₂ d') = A × F d' record Str (A : Set) (d : ℕ∞) : Set where coinductive field str-out : StrData A (Str A) (pred d) open Str public reidx-Str : ∀{n m A} → n ~ℕ∞~ m → Str A n → Str A m str-out (reidx-Str {n} {m} p s) with pred n | pred m | pred~ p | str-out s str-out (reidx-Str p s) | inj₁ tt | inj₁ tt | _ | _ = tt str-out (reidx-Str p s) | inj₁ tt | inj₂ m' | () | _ str-out (reidx-Str p s) | inj₂ n' | inj₁ tt | () | _ str-out (reidx-Str p s) | inj₂ n' | inj₂ m' | q | (a , s') = (a , reidx-Str q s') tl : ∀{d A} → Str A (succ d) → Str A d tl {d} s = proj₂ (str-out s) tl₂ : ∀{d A} → Str A (succ (succ d)) → Str A d tl₂ {d} s = proj₂ (str-out (proj₂ (str-out s))) even : ∀{d A} → Str A (2× d) → Str A d str-out (even {d} s) with pred d | str-out s str-out (even s) | inj₁ tt | tt = tt str-out (even s) | inj₂ d' | (a , s') with str-out s' str-out (even s) | inj₂ d' | (a , s') | (_ , s'') = (a , even s'') zip₂ : ∀{m n A} → Str A m → Str A n → Str A (m +∞ n) str-out (zip₂ {m} {n} s t) with pred m | pred n | str-out s | str-out t str-out (zip₂ s t) | inj₁ tt | inj₁ tt | tt | _ = tt str-out (zip₂ s t) | inj₁ tt | inj₂ n' | tt | u = u str-out (zip₂ s t) | inj₂ m' | inj₁ tt | (a , s') | tt = (a , s') str-out (zip₂ s t) | inj₂ m' | inj₂ n' | (a , s') | (b , t') = (a , record { str-out = (b , zip₂ s' t') }) 𝔹 : Set 𝔹 = ⊤ ⊎ ⊤ l r : 𝔹 l = inj₁ tt r = inj₂ tt L R : Str 𝔹 ∞ str-out L = (l , L) str-out R = (r , R) restr : ∀{A} → Str A ∞ → (d : ℕ∞) → Str A d str-out (restr s d) with pred d | str-out s str-out (restr s d) | inj₁ tt | _ = tt str-out (restr s d) | inj₂ d' | (a , s') = (a , restr s' d') foo : ∀{d} → Str 𝔹 d str-out (foo {d}) with pred d str-out foo | inj₁ tt = tt str-out foo | inj₂ d' = (l , even {!!})
libsrc/_DEVELOPMENT/l/z80/longlong/l_add_64_mde_mbc_mhl.asm
jpoikela/z88dk
640
176898
SECTION code_clib SECTION code_l PUBLIC l_add_64_mde_mbc_mhl l_add_64_mde_mbc_mhl: ; 64-bit addition ; ; enter : de = int64_t *sum ; bc = int64_t *addend ; hl = int64_t *addend ; ; exit : *de = *bc + *hl ; ; de += 7 ; bc += 7 ; hl += 7 ; ; uses : af, bc, de, hl ld a,(bc) add a,(hl) ld (de),a inc bc inc de inc hl ld a,(bc) adc a,(hl) ld (de),a call again again: inc bc inc de inc hl ld a,(bc) adc a,(hl) ld (de),a inc bc inc de inc hl ld a,(bc) adc a,(hl) ld (de),a inc bc inc de inc hl ld a,(bc) adc a,(hl) ld (de),a ret
test/Succeed/SizedQuicksort.agda
redfish64/autonomic-agda
3
3709
-- 2014-04-24 module _ where open import Common.Size open import Common.Prelude using (Bool; true; false; if_then_else_) open import Common.Product -- sized lists data List A {i} : Set where [] : List A _∷_ : {i' : Size< i} (x : A) (xs : List A {i'}) → List A _++_ : ∀{A} → List A → List A → List A [] ++ ys = ys (x ∷ xs) ++ ys = x ∷ (xs ++ ys) partition : ∀{A i} (p : A → Bool) (l : List A {i}) → List A {i} × List A {i} partition p [] = [] , [] partition p (x ∷ xs) = let l , r = partition p xs in if p x then ((x ∷ l) , r) else (l , (x ∷ r)) module Sort {A : Set} (_≤_ : A → A → Bool) where quicksort : ∀{i} → List A {i} → List A quicksort [] = [] quicksort (x ∷ []) = x ∷ [] quicksort (x ∷ xs) = let x≤ , ≤x = partition (_≤_ x) xs in quicksort ≤x ++ (x ∷ quicksort x≤)
purge.applescript
emanuelbesliu/applescripts
0
3001
on idle do shell script "purge" return 2700 end idle
_build/dispatcher/jmp_ippsDESGetSize_b8231efb.asm
zyktrcn/ippcp
1
172482
extern m7_ippsDESGetSize:function extern n8_ippsDESGetSize:function extern y8_ippsDESGetSize:function extern e9_ippsDESGetSize:function extern l9_ippsDESGetSize:function extern n0_ippsDESGetSize:function extern k0_ippsDESGetSize:function extern ippcpJumpIndexForMergedLibs extern ippcpSafeInit:function segment .data align 8 dq .Lin_ippsDESGetSize .Larraddr_ippsDESGetSize: dq m7_ippsDESGetSize dq n8_ippsDESGetSize dq y8_ippsDESGetSize dq e9_ippsDESGetSize dq l9_ippsDESGetSize dq n0_ippsDESGetSize dq k0_ippsDESGetSize segment .text global ippsDESGetSize:function (ippsDESGetSize.LEndippsDESGetSize - ippsDESGetSize) .Lin_ippsDESGetSize: db 0xf3, 0x0f, 0x1e, 0xfa call ippcpSafeInit wrt ..plt align 16 ippsDESGetSize: db 0xf3, 0x0f, 0x1e, 0xfa mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc] movsxd rax, dword [rax] lea r11, [rel .Larraddr_ippsDESGetSize] mov r11, qword [r11+rax*8] jmp r11 .LEndippsDESGetSize:
checkout-parse_checkout_spec.adb
annexi-strayline/AURA
13
6737
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- Reference Implementation -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * <NAME> (ANNEXI-STRAYLINE) -- -- -- -- 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 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 -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Text_IO; with Ada.Exceptions; with Ada.Characters.Conversions; with Ada.Strings.Fixed; with Ada.Strings.Wide_Wide_Unbounded; with Ada_Lexical_Parser; use Ada_Lexical_Parser; with Registrar.Source_Files; separate (Checkout) function Parse_Checkout_Spec (Unit: Registrar.Library_Units.Library_Unit) return Repositories.Repository_Index is use Registrar.Source_Files; use type Repositories.Repository_Index; Stream: aliased Source_Stream := Checkout_Read_Stream (Unit.Spec_File); Source: Source_Buffer (Stream'Access); E: Lexical_Element; package WWU renames Ada.Strings.Wide_Wide_Unbounded; procedure Next_Element is begin loop E := Next_Element (Source); exit when E.Category /= Comment; end loop; end Next_Element; function Category return Lexical_Category is (E.Category); function Content return Wide_Wide_String is (WWU.To_Wide_Wide_String (E.Content)); Repo_Index: Repositories.Repository_Index; function Read_Index return Repositories.Repository_Index is use WWU; Ident: constant Unbounded_Wide_Wide_String := To_Unbounded_Wide_Wide_String (Content); Lead_In: constant Wide_Wide_String := "repository_"; begin -- Content should be an identifier that is expected to be -- "repository_xyz". We need to read in xyz Assert (Check => Slice (Source => Ident, Low => 1, High => Lead_In'Length) = Lead_In, Message => "Expected identifier of repository_nnn"); declare use Ada.Characters.Conversions; package Index_IO is new Ada.Text_IO.Integer_IO (Repositories.Repository_Index); Number_Part: constant String := To_String (Slice (Source => Ident, Low => Lead_In'Length + 1, High => Length (Ident))); Last: Positive; Index: Repositories.Repository_Index; begin Index_IO.Get (From => Number_Part, Item => Index, Last => Last); Assert (Check => Last = Number_Part'Last, Message => "Repository index is too large"); return Index; exception when Ada.Text_IO.Data_Error => raise Ada.Assertions.Assertion_Error with "Repository index must be a number."; end; end Read_Index; begin -- We expect exactly one with statement: -- with AURA.Repository_X; Next_Element; Assert (Check => Category = Reserved_Word and then Content = "with", Message => "Expected with"); Next_Element; Assert (Check => Category = Identifier and then Content = "aura", Message => "With shall be AURA.Repository_X only"); Next_Element; Assert (Check => Category = Delimiter and then Content = ".", Message => "Expected '.'"); Next_Element; Assert (Check => Category = Identifier, Message => "Identifier expected"); Repo_Index := Read_Index; Next_Element; Assert (Check => Category = Delimiter and then Content = ";", Message => "';' expected"); Next_Element; Assert (Check => Category = Reserved_Word and then Content = "package", Message => "Expected package"); -- Note that we don't need to actually check the package identifier, as this -- was handled by the unit entry logic (the name of Unit itself is derrived -- from parsing the identifier), we just want to specifically see what is -- after "renames" (it must be the same as the withed repository) loop Next_Element; exit when Category = Reserved_Word and then Content = "renames"; end loop; -- "AURA." is valid next, but typically not what we find - but it is legal Next_Element; Assert (Check => Category = Identifier, Message => "Expected identifier"); if Content = "AURA" then Next_Element; Assert (Check => Category = Delimiter and then Content = ".", Message => "Expected repository package identifier after " & "'AURA.'"); -- We now should be at the repositoy identifier Next_Element; Assert (Check => Category = Identifier, Message => "Expected repository package identifier"); end if; declare use Ada.Strings; use Ada.Strings.Fixed; begin Assert (Check => Read_Index = Repo_Index, Message => "Checkout rename mismatch. Expected " & "Repository_" & Trim (Source => Repositories.Repository_Index'Image (Repo_Index), Side => Both)); end; -- Lastly a closing delimiter Next_Element; Assert (Check => Category = Delimiter and then Content = ";", Message => "Expected ';'"); return Repo_Index; exception when e: Ada.Assertions.Assertion_Error => declare Pos: Source_Position := Last_Position (Source); begin raise Ada.Assertions.Assertion_Error with Unit.Spec_File.Full_Name & ":" & Positive'Image (Pos.Line) & ":" & Positive'Image (Pos.Column) & " - " & Ada.Exceptions.Exception_Information (e); end; end Parse_Checkout_Spec;
programs/oeis/147/A147846.asm
neoneye/loda
22
170858
<filename>programs/oeis/147/A147846.asm<gh_stars>10-100 ; A147846: Triangular numbers n*(n+1)/2 with n or n+1 prime. ; 1,3,6,10,15,21,28,55,66,78,91,136,153,171,190,253,276,406,435,465,496,666,703,820,861,903,946,1081,1128,1378,1431,1711,1770,1830,1891,2211,2278,2485,2556,2628,2701,3081,3160,3403,3486,3916,4005,4656,4753,5050,5151,5253,5356,5671,5778,5886,5995,6328,6441,8001,8128,8515,8646,9316,9453,9591,9730,11026,11175,11325,11476,12246,12403,13203,13366,13861,14028,14878,15051,15931,16110,16290,16471,18145,18336,18528,18721,19306,19503,19701,19900,22155,22366,24753,24976,25651,25878,26106,26335,27028 seq $0,93515 ; Numbers k such that either k or k-1 is a prime. bin $0,2
src/json_gen-main.adb
persan/testlibadalang
0
19694
with Utils.Command_Lines; use Utils.Command_Lines; with Utils.Drivers; with JSON_Gen.Actions; with JSON_Gen.Command_Lines; procedure JSON_Gen.Main is -- Main procedure for lalstub -- procedure Callback (Phase : Parse_Phase; Swit : Dynamically_Typed_Switch); procedure Callback (Phase : Parse_Phase; Swit : Dynamically_Typed_Switch) is null; Tool : Actions.Json_Gen_Tool; Cmd : Command_Line (JSON_Gen.Command_Lines.Descriptor'Access); begin Utils.Drivers.Driver (Cmd => Cmd, Tool => Tool, Tool_Package_Name => "jsongen", Needs_Per_File_Output => True, Callback => Callback'Unrestricted_Access); end JSON_Gen.Main;
lib/sam_crt0.asm
andydansby/z88dk-mk2
1
87539
<gh_stars>1-10 ; Startup fo SAM Coupe ; ; Stefano 26/3/2001 ; ; If an error occurs eg break we just drop back to BASIC ; ; $Id: sam_crt0.asm,v 1.10 2009/06/22 21:20:05 dom Exp $ ; MODULE sam_crt0 ; ; Initially include the zcc_opt.def file to find out lots of lovely ; information about what we should do.. ; INCLUDE "zcc_opt.def" ; No matter what set up we have, main is always, always external to ; this fileb XREF _main ; ; Some variables which are needed for both app and basic startup ; XDEF cleanup XDEF l_dcal ; Integer rnd seed XDEF _std_seed ; vprintf is internal to this file so we only ever include one of the set ; of routines XDEF _vfprintf ; Exit variables XDEF exitsp XDEF exitcount XDEF heaplast ;Near malloc heap variables XDEF heapblocks ; For stdin, stdout, stder XDEF __sgoioblk ; Graphics stuff XDEF base_graphics XDEF coords ; Sound stuff XDEF snd_tick ; Now, getting to the real stuff now! org 32768 start: ld (start1+1),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF ; Special SAM stuff goes here ; Set screen to mode 0 ld a,0 call $15A ; JMODE ; set stream to channel 's' (upper screen) ld a,2 call $112 ; JSETSTRM ; End of SAM stuff call _main cleanup: ; ; Deallocate memory which has been allocated here! ; push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF pop bc ; Special SAM stuff goes here ; End of SAM stuff start1: ld sp,0 ret l_dcal: jp (hl) ; Now, define some values for stdin, stdout, stderr __sgoioblk: IF DEFINED_ANSIstdio INCLUDE "stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ; Now, which of the vfprintf routines do we need? _vfprintf: IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;Seed for integer rand() routines _std_seed: defw 0 ;Atexit routine exitsp: defw 0 exitcount: defb 0 IF DEFINED_NEED1bitsound snd_tick: defb 0 ; Sound variable ENDIF ; Heap stuff heaplast: defw 0 heapblocks: defw 0 ; mem stuff base_graphics: defw 16384 coords: defw 0 defm "Small C+ SAM Coupe" defb 0 ;All the float stuff is kept in a different file...for ease of altering! ;It will eventually be integrated into the library ; ;Here we have a minor (minor!) problem, we've no idea if we need the ;float package if this is separated from main (we had this problem before ;but it wasn't critical..so, now we will have to read in a file from ;the directory (this will be produced by zcc) which tells us if we need ;the floatpackage, and if so what it is..kludgey, but it might just work! ; ;Brainwave time! The zcc_opt file could actually be written by the ;compiler as it goes through the modules, appending as necessary - this ;way we only include the package if we *really* need it! IF NEED_floatpack INCLUDE "float.asm" ;seed for random number generator - not used yet.. fp_seed: defb $80,$80,0,0,0,0 ;Floating point registers... extra: defs 6 fa: defs 6 fasign: defb 0 ENDIF
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1517.asm
ljhsiun2/medusa
9
89608
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r8 push %r9 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_UC_ht+0x11e3, %rsi lea addresses_UC_ht+0x17bcf, %rdi nop nop dec %r8 mov $0, %rcx rep movsl nop nop nop nop nop sub %rsi, %rsi lea addresses_WC_ht+0xe5b5, %rsi lea addresses_UC_ht+0x79e3, %rdi nop nop nop sub $54171, %r12 mov $96, %rcx rep movsb nop nop nop nop and %rsi, %rsi lea addresses_A_ht+0x19703, %r12 clflush (%r12) dec %rdi movb (%r12), %r8b nop nop nop sub $20599, %rsi lea addresses_D_ht+0x1aebe, %rsi lea addresses_normal_ht+0x111e3, %rdi clflush (%rsi) nop sub %rax, %rax mov $108, %rcx rep movsl and %rsi, %rsi lea addresses_WT_ht+0x1a03, %r12 cmp %r9, %r9 mov (%r12), %rsi nop nop nop nop nop cmp $32510, %r9 lea addresses_D_ht+0x4413, %r9 nop nop nop nop nop dec %rcx mov $0x6162636465666768, %r8 movq %r8, %xmm0 movups %xmm0, (%r9) add %rcx, %rcx lea addresses_UC_ht+0x197a3, %r9 nop nop nop nop sub $64721, %rdi movw $0x6162, (%r9) nop sub $36374, %r9 lea addresses_D_ht+0x19ae3, %rdi nop sub %r9, %r9 movups (%rdi), %xmm3 vpextrq $0, %xmm3, %r8 nop add $11112, %r9 lea addresses_normal_ht+0x1c7a3, %rsi lea addresses_D_ht+0x1a1e3, %rdi nop xor %rbp, %rbp mov $10, %rcx rep movsq add $57713, %rsi lea addresses_normal_ht+0x1b339, %rsi lea addresses_A_ht+0x100a3, %rdi clflush (%rsi) nop nop nop nop sub $37793, %r9 mov $99, %rcx rep movsl cmp $5405, %rsi lea addresses_UC_ht+0x16de3, %rsi lea addresses_D_ht+0x9263, %rdi nop nop nop add %r9, %r9 mov $86, %rcx rep movsl dec %r12 lea addresses_D_ht+0x1ce3, %rdi nop nop nop nop nop and $51354, %rcx movups (%rdi), %xmm4 vpextrq $0, %xmm4, %r12 nop nop and %r8, %r8 lea addresses_normal_ht+0x5ca3, %rsi nop nop nop and %rdi, %rdi mov (%rsi), %rax nop nop nop nop xor $17502, %rsi lea addresses_normal_ht+0x1d941, %rbp dec %r8 movl $0x61626364, (%rbp) nop nop nop nop nop xor $58449, %rdi pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r8 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %r15 push %r8 push %rbp push %rdi // Store lea addresses_PSE+0x109e3, %r13 nop add %r12, %r12 mov $0x5152535455565758, %r8 movq %r8, %xmm6 vmovups %ymm6, (%r13) nop nop nop nop xor %r15, %r15 // Faulty Load lea addresses_RW+0x49e3, %r12 nop nop nop nop sub $5163, %rbp vmovups (%r12), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $0, %xmm7, %rdi lea oracles, %r11 and $0xff, %rdi shlq $12, %rdi mov (%r11,%rdi,1), %rdi pop %rdi pop %rbp pop %r8 pop %r15 pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_PSE', 'size': 32, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': True}} {'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': True}} {'src': {'same': False, 'congruent': 5, 'NT': True, 'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}} {'src': {'same': True, 'congruent': 5, 'NT': False, 'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 2, 'NT': False, 'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False}} {'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}} {'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
audio/sfx/cry0f_3.asm
adhi-thirumala/EvoYellow
16
172682
SFX_Cry0F_3_Ch1: dutycycle 241 unknownsfx0x20 4, 247, 192, 7 unknownsfx0x20 12, 230, 194, 7 unknownsfx0x20 6, 181, 128, 6 unknownsfx0x20 4, 196, 112, 6 unknownsfx0x20 4, 181, 96, 6 unknownsfx0x20 8, 193, 64, 6 endchannel SFX_Cry0F_3_Ch2: dutycycle 204 unknownsfx0x20 3, 199, 129, 7 unknownsfx0x20 12, 182, 128, 7 unknownsfx0x20 6, 165, 65, 6 unknownsfx0x20 4, 196, 50, 6 unknownsfx0x20 6, 181, 33, 6 unknownsfx0x20 8, 161, 2, 6 endchannel SFX_Cry0F_3_Ch3: unknownnoise0x20 3, 228, 60 unknownnoise0x20 12, 214, 44 unknownnoise0x20 4, 228, 60 unknownnoise0x20 8, 183, 92 unknownnoise0x20 15, 194, 93 endchannel
oeis/021/A021984.asm
neoneye/loda-programs
11
85031
<reponame>neoneye/loda-programs ; A021984: Expansion of 1/((1-x)(1-4x)(1-10x)(1-11x)). ; Submitted by <NAME> ; 1,26,457,6822,93333,1210938,15168529,185357774,2224062445,26316305730,307996949481,3573147901206,41156463852037,471239561238602,5368820120200513,60908872219620318,688516109116593309,7758862370196716754,87199337862931756825,977711234766431926310,10940008766638592705461,122191948280966996935386,1362629949593517986101617,15174114630651333037478382,168767112788766315284815693,1874956759193947186734297698,20809709536314601039593686089,230758656751296450488707303734,2556863742782715422699598479205 add $0,2 lpb $0 sub $0,1 add $2,2 mul $2,11 mul $3,10 add $3,$1 mul $1,4 add $1,$2 lpe mov $0,$3 div $0,22
programs/oeis/123/A123363.asm
karttu/loda
1
27968
; A123363: a(n) = n^3 + (-1)^(n+1). ; -1,2,7,28,63,126,215,344,511,730,999,1332,1727,2198,2743,3376,4095,4914,5831,6860,7999,9262,10647,12168,13823,15626,17575,19684,21951,24390,26999,29792,32767,35938,39303,42876,46655,50654,54871,59320,63999,68922,74087,79508,85183,91126,97335,103824,110591,117650,124999,132652,140607,148878,157463,166376,175615,185194,195111,205380,215999,226982,238327,250048,262143,274626,287495,300764,314431,328510,342999,357912,373247,389018,405223,421876,438975,456534,474551,493040,511999,531442,551367,571788,592703,614126,636055,658504,681471,704970,728999,753572,778687,804358,830583,857376,884735,912674,941191,970300,999999,1030302,1061207,1092728,1124863,1157626,1191015,1225044,1259711,1295030,1330999,1367632,1404927,1442898,1481543,1520876,1560895,1601614,1643031,1685160,1727999,1771562,1815847,1860868,1906623,1953126,2000375,2048384,2097151,2146690,2196999,2248092,2299967,2352638,2406103,2460376,2515455,2571354,2628071,2685620,2743999,2803222,2863287,2924208,2985983,3048626,3112135,3176524,3241791,3307950,3374999,3442952,3511807,3581578,3652263,3723876,3796415,3869894,3944311,4019680,4095999,4173282,4251527,4330748,4410943,4492126,4574295,4657464,4741631,4826810,4912999,5000212,5088447,5177718,5268023,5359376,5451775,5545234,5639751,5735340,5831999,5929742,6028567,6128488,6229503,6331626,6434855,6539204,6644671,6751270,6858999,6967872,7077887,7189058,7301383,7414876,7529535,7645374,7762391,7880600,7999999,8120602,8242407,8365428,8489663,8615126,8741815,8869744,8998911,9129330,9260999,9393932,9528127,9663598,9800343,9938376,10077695,10218314,10360231,10503460,10647999,10793862,10941047,11089568,11239423,11390626,11543175,11697084,11852351,12008990,12166999,12326392,12487167,12649338,12812903,12977876,13144255,13312054,13481271,13651920,13823999,13997522,14172487,14348908,14526783,14706126,14886935,15069224,15252991,15438250 mov $1,$0 pow $1,3 mov $2,2 gcd $2,$0 mul $2,2 sub $1,$2 add $1,3
ADL/drivers/stm32h743/stm32-iwdg.adb
JCGobbi/Nucleo-STM32H743ZI
0
16984
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015, 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 STM32_SVD.RCC; use STM32_SVD.RCC; with STM32_SVD.IWDG; use STM32_SVD.IWDG; package body STM32.IWDG is -- commands to the watchdog hardware Reload_Counter : constant UInt16 := 16#AAAA#; Enable_Access : constant UInt16 := 16#5555#; Start : constant UInt16 := 16#CCCC#; ------------------------- -- Initialize_Watchdog -- ------------------------- procedure Initialize_Watchdog (Prescaler : Prescalers; Count : Countdown_Value) is begin -- Check if we're resuming from a watchdog reset if RCC_Periph.RSR.IWDG1RSTF then -- Clear the reset flag RCC_Periph.RSR.RMVF := True; end if; IWDG_Periph.KR.KEY := Enable_Access; IWDG_Periph.PR.PR := Prescalers'Enum_Rep (Prescaler); IWDG_Periph.RLR.RL := Count; end Initialize_Watchdog; -------------------- -- Start_Watchdog -- -------------------- procedure Start_Watchdog is begin IWDG_Periph.KR.KEY := Reload_Counter; IWDG_Periph.KR.KEY := Start; end Start_Watchdog; -------------------- -- Start_Watchdog -- -------------------- procedure Start_Watchdog (Window : UInt12) is begin IWDG_Periph.WINR.WIN := Window; IWDG_Periph.KR.KEY := Start; end Start_Watchdog; -------------------- -- Reset_Watchdog -- -------------------- procedure Reset_Watchdog is begin while IWDG_Periph.SR.RVU loop null; -- TODO: use a timeout instead of infinitely looping end loop; IWDG_Periph.KR.KEY := Reload_Counter; end Reset_Watchdog; end STM32.IWDG;
alloy4fun_models/trashltl/models/11/GYDTwKr36TXAazR9v.als
Kaixi26/org.alloytools.alloy
0
1941
open main pred idGYDTwKr36TXAazR9v_prop12 { eventually all f: File | eventually f in Trash } pred __repair { idGYDTwKr36TXAazR9v_prop12 } check __repair { idGYDTwKr36TXAazR9v_prop12 <=> prop12o }
attic/asis/find_entities/adam-assist-query-find_entities-unit_processing.adb
charlie5/aIDE
3
30420
<filename>attic/asis/find_entities/adam-assist-query-find_entities-unit_processing.adb<gh_stars>1-10 with asis.Elements, asis.Compilation_Units, AdaM.compilation_Unit, AdaM.library_Item, AdaM.library_Unit.declaration, AdaM.Assist.Query.find_Entities.element_Processing, AdaM.Assist.Query.find_Entities.Metrics, Ada.Characters.Handling; with Ada.Text_IO; use Ada.Text_IO; package body AdaM.Assist.Query.find_Entities.unit_Processing is procedure Process_Unit (The_Unit : Asis.Compilation_Unit) is use Asis, ada.Characters.Handling; Cont_Clause_Elements : constant Asis.Element_List := Asis.Elements.Context_Clause_Elements (Compilation_Unit => The_Unit, Include_Pragmas => True); -- This is the list of the context clauses, including pragmas, if any. -- If you do not want to process pragmas, set Include_Pragmas OFF when -- calling Asis.Elements.Context_Clause_Elements. Unit_Decl : constant Asis.Element := Asis.Elements.Unit_Declaration (The_Unit); -- The top-level structural element of the library item or subunit -- contained in The_Unit. the_Name : constant String := to_String (asis.Compilation_Units.Unit_Full_Name (The_Unit)); Kind : constant asis.Unit_Kinds := asis.Compilation_Units.Unit_Kind (the_Unit); begin -- Metrics.new_Unit := adam.compilation_Unit.new_Unit ("anon"); put_Line ("Processing compilation unit ***" & the_Name & "*** of kind " & asis.Unit_Kinds'Image (Kind)); if Kind = asis.a_Package then Metrics.current_compilation_Unit := AdaM.compilation_Unit.new_compilation_Unit; -- := adam.compilation_Unit.new_library_Unit -- (the_Name, -- library_Item.new_Item (adam.library_Unit.declaration.new_Package.all'Access)); -- -- Metrics.current_package_Declaration -- := AdaM.library_Unit.declaration.view (Metrics.current_compilation_Unit.library_Item.Unit).my_Package; end if; -- Metrics.compilation_Unit.clear; Metrics.compilation_Unit.Name_is (the_Name); for J in Cont_Clause_Elements'Range loop AdaM.Assist.Query.find_Entities.element_Processing.Process_Construct (Cont_Clause_Elements (J)); end loop; AdaM.Assist.Query.find_Entities.element_Processing.Process_Construct (Unit_Decl); -- This procedure does not contain any exception handler because it -- supposes that Element_Processing.Process_Construct should handle -- all the exceptions which can be raised when processing the element -- hierarchy. -- declare -- new_Unit : constant AdaM.compilation_Unit.view -- := AdaM.compilation_Unit.new_Unit (Name => "", -- of_Kind => compilation_Unit.library_unit_Kind); -- begin -- AdaM.compilation_Unit.item (new_Unit.all) := Metrics.compilation_Unit; -- Metrics.Environment.add (new_Unit); -- end; declare new_Unit : constant AdaM.compilation_Unit.view := AdaM.compilation_Unit.new_compilation_Unit; begin AdaM.compilation_Unit.item (new_Unit.all) := Metrics.compilation_Unit; Metrics.Environment.add (new_Unit); end; put_Line ("End of processing compilation unit ***" & the_Name & "*** of kind " & asis.Unit_Kinds'Image (Kind)); new_Line (2); end Process_Unit; end AdaM.Assist.Query.find_Entities.unit_Processing;
kliba.asm
zjhong-umr/myos
0
7857
; ------------------------------------------------------------- ; kernel library for C ; functions: ; clear() - clear screan ; put_str(str, color, pos) ; put_char(char, color, pos) ; get_char() -- return char ; get_time() -- return BCD-coded time ; ------------------------------------------------------------- public _memcopy _memcopy proc push ax push cx push ds push es mov ax, ds mov es, ax mov bp, sp ;len/dest_offset/dest_base/ori_offset/ori_base/ip/ax/cx/ds/es mov ax, word ptr [bp+5*2] mov ds, ax mov di, word ptr [bp+6*2] mov ax, word ptr [bp+7*2] mov es, ax mov si, word ptr [bp+8*2] mov cx, word ptr [bp+9*2] cpyloop: mov ax, ds:[di] mov es:[si], ax inc di inc si loop cpyloop pop es pop ds pop cx pop ax ret _memcopy endp public _run_file _run_file proc push ax push bx push cx push dx push ds push si push di push bp push es push sp mov ax, cs mov ds, ax mov bp, sp mov ax, word ptr [bp+11*2] mov ds:[BaseOfPrg], ax mov ax, word ptr [bp+12*2] mov ds:[OffsetOfPrg], ax mov bx, offset dgroup:OffsetOfPrg call dword ptr [bx] pop sp pop es pop bp pop di pop si pop ds pop dx pop cx pop bx pop ax ret _run_file endp public _clear _clear proc push dx push cx push bx push ax mov ax, 0600H mov bx, 0700H mov cx, 0 mov dx, 0184fH int 10H pop ax pop bx pop cx pop dx ret _clear endp public _put_str _put_str proc push bp push dx push cx push bx push ax push es mov ax, ds mov es, ax mov bp, sp mov si, word ptr [bp+7*2] ;/pos/color/len/str/ip/bp/dx/cx/bx/ax/es xor cx, cx mov cx, word ptr [bp+8*2] mov bx, word ptr [bp+9*2] mov dx, word ptr [bp+10*2] mov ax, si mov bp, ax mov ax, 1301h int 10h pop es pop ax pop bx pop cx pop dx pop bp ret _put_str endp public _put_char _put_char proc push es push bx push ax mov ax, 0B800h mov es, ax mov bp, sp mov al, byte ptr [bp+4*2] ; /pos/color/word/ip/es/bx/ax mov ah, byte ptr [bp+5*2] mov bx, word ptr [bp+6*2] mov es:[bx], ax pop ax pop bx pop es ret _put_char endp public _get_char _get_char proc xor ax, ax int 16h ret _get_char endp public _get_time _get_time proc push cx mov ah, 2 int 1aH mov ax, cx pop cx ret _get_time endp public _fopen ; /offset/base/file_name/ip _fopen proc mov bp, sp mov ax, word ptr [bp+4] ; 设置准备放入的基地址 mov ds:[BaseOfPrg], ax mov ax, word ptr [bp+6] ; 设置准备放入的偏移量 mov ds:[OffsetOfPrg], ax ; 软盘复位 xor ah, ah xor dl, dl int 13h ; 下面根目录寻找目标文件 mov ds:[wSectorNo], SectorNoOfRootDirectory ; 给表示当前扇区号的 ; 变量wSectorNo赋初值为根目录区的首扇区号(=19) mov ds:[wRootDirSizeForLoop], RootDirSectors ; 重新设置循环次数 LABEL_SEARCH_IN_ROOT_DIR_BEGIN: cmp ds:[wRootDirSizeForLoop], 0 ; 判断根目录区是否已读完 jz LABEL_NO_EXEC ;若读完则表示未找到目标文件 dec ds:[wRootDirSizeForLoop] ; 递减变量wRootDirSizeForLoop的值 ; 调用读扇区函数读入一个根目录扇区到装载区 mov ax, ds:[BaseOfPrg] mov es, ax ; ES <- BaseOfFile mov bx, ds:[OffsetOfPrg] ; BX <- OffsetOfFile mov ax, ds:[wSectorNo] ; AX <- 根目录中的当前扇区号 mov cl, 1 ; 只读一个扇区 call ReadSector ; 调用读扇区函数 mov si, word ptr [bp+2] ; DS:SI -> file name mov di, ds:[OffsetOfPrg] ; ES:DI -> BaseOfExec:0100 cld ; 清除DF标志位 ; 置比较字符串时的方向为左/上[索引增加] mov dx, 10h ; 循环次数=16(每个扇区有16个文件条目:512/32=16) LABEL_SEARCH_FOR_EXEC: cmp dx, 0 ; 循环次数控制 jz LABEL_GOTO_NEXT_SECTOR_IN_ROOT_DIR ; 若已读完一扇区 dec dx ; 就跳到下一扇区 mov cx, 11 ; 初始循环次数为11 LABEL_CMP_FILENAME: cmp cx, 0 jz LABEL_FILENAME_FOUND; 如果比较了11个字符都相等,表示找到 dec cx ; 递减循环次数值 lodsb ; DS:SI -> AL(装入字符串字节) cmp al, es:[di] ; 比较字符串的当前字符 jz LABEL_GO_ON jmp LABEL_DIFFERENT ; 只要发现不一样的字符就表明本DirectoryEntry ; 不是我们要找的文件 LABEL_GO_ON: inc di ; 递增DI jmp LABEL_CMP_FILENAME ; 继续循环 LABEL_DIFFERENT: and di, 0FFE0h ; DI &= E0为了让它指向本条目开头(低5位清零) ; FFE0h = 1111111111100000(低5位=32=目录条目大小) add di, 20h ; DI += 20h 下一个目录条目 mov si, word ptr [bp+2] ; SI指向装载文件名串的起始地址 jmp LABEL_SEARCH_FOR_EXEC; 转到循环开始处 LABEL_GOTO_NEXT_SECTOR_IN_ROOT_DIR: add ds:[wSectorNo], 1 ; 递增当前扇区号 jmp LABEL_SEARCH_IN_ROOT_DIR_BEGIN LABEL_NO_EXEC: mov ax, 0 ret LABEL_FILENAME_FOUND: ; 找到文件后便来到这里继续 ; 计算文件的起始扇区号 mov ax, RootDirSectors ; AX=根目录占用的扇区数 and di, 0FFE0h ; DI -> 当前条目的开始地址 add di, 1Ah ; DI -> 文件的首扇区号在条目中的偏移地址 mov cx, es:[di] ; CX=文件的首扇区号 push cx ; 保存此扇区在FAT中的序号 add cx, ax ; CX=文件的相对起始扇区号+根目录占用的扇区数 add cx, DeltaSectorNo ; CL <- 文件的起始扇区号(0-based) mov ax, ds:[BaseOfPrg] mov es, ax ; ES <- BaseOfFile mov bx, ds:[OffsetOfPrg]; BX <- OffsetOfFile mov ax, cx ; AX <- 起始扇区号 LABEL_GOON_LOADING_FILE: ; 此处不输出读取信息 mov cl, 1 ; 1个扇区 call ReadSector ; 读扇区 ; 计算文件的下一扇区号 pop ax call GetFATEntry ; 获取FAT项中的下一簇号 cmp ax, 0FF8h ; 是否是文件最后簇 jae LABEL_FILE_LOADED ; ≥FF8h时跳转,否则读下一个簇 push ax ; 保存扇区在FAT中的序号 mov dx, RootDirSectors ; DX = 根目录扇区数 = 14 add ax, dx ; 扇区序号 + 根目录扇区数 add ax, DeltaSectorNo ; AX = 要读的数据扇区地址 add bx, BPB_BytsPerSec ; BX+512指向装载程序区的下一个扇区地址 jmp LABEL_GOON_LOADING_FILE LABEL_FILE_LOADED: ; ********************************************************************** mov ax, 1 ret ; ********************************************************************** ;----------------------------------------------------------------------- ; 函数:ReadSector ; ax为Sector开始的序号,将cl个sector读入es:bx中 ;----------------------------------------------------------------------- ; 方法: ; 设扇区号为 x: ; ┌ 柱面号 = y >> 1 ; x ┌ 商 y ┤ ; -------------- => ┤ └ 磁头号 = y & 1 ; 每磁道扇区数 │ ; └ 余 z => 起始扇区号 = z + 1 ;--------------------------------------------------------------------- ReadSector: push bp ; 保存BP mov bp, sp ; 让BP=SP sub sp, 2 ; 辟出两个字节的堆栈区域保存要读的扇区数: byte [bp-2] mov byte [bp-2], cl ; 压CL入栈(保存表示读入扇区数的传递参数) push bx ; 保存BX mov bl, BPB_SecPerTrk ; BL=18(磁道扇区数)为除数 div bl ; AX/BL,商y在AL中、余数z在AH中 inc ah ; z ++(因磁盘的起始扇区号为1) mov cl, ah ; CL <- 起始扇区号 mov dh, al ; DH <- y shr al, 1 ; y >> 1 (等价于y/BPB_NumHeads,软盘有2个磁头) mov ch, al ; CH <- 柱面号 and dh, 1 ; DH & 1 = 磁头号 pop bx ; 恢复BX ; 至此,"柱面号、起始扇区、磁头号"已全部得到 mov dl, ds:[BS_DrvNum] ; 驱动器号(0表示软盘A) .GoOnReading: ; 使用磁盘中断读入扇区 mov ah, 2 ; 功能号(读扇区) mov al, byte [bp-2] ; 读AL个扇区 int 13h ; 磁盘服务BIOS调用 jc .GoOnReading ; 如果读取错误,CF会被置为1, ; 这时就不停地读,直到正确为止 add sp, 2 ; 栈指针+2 pop bp ; 恢复BP ret ;---------------------------------------------------------------------------- ;---------------------------------------------------------------------------- ; 函数名:GetFATEntry ;---------------------------------------------------------------------------- ; 作用:找到序号为AX的扇区在FAT中的条目,结果放在AX中。需要注意的 ; 是,中间需要读FAT的扇区到ES:BX处,所以函数一开始保存了ES和BX ;--------------------------------------------------------------------------- GetFATEntry: push es ; 保存ES、BX和AX(入栈) push bx push ax ; 设置读入的FAT扇区写入的基地址 mov ax, ds:[BaseOfPrg] ;BaseOfFile sub ax, 0100h ; 在BaseOfFile后面留出4K空间用于存放FAT mov es, ax ; 判断FAT项的奇偶 pop ax ; 取出FAT项序号(出栈) mov ds:[bOdd], 0; 初始化奇偶变量值为0(偶) mov bx, 3 ; AX*1.5 = (AX*3)/2 mul bx ; DX:AX = AX * 3(AX*BX 的结果值放入DX:AX中) mov bx, 2 ; BX = 2(除数) div bx ; DX:AX / 2 => AX <- 商、DX <- 余数 cmp dx, 0 ; 余数 = 0(偶数)? jz LABEL_EVEN ; 偶数跳转 mov ds:[bOdd], 1 ; 奇数 LABEL_EVEN: ; 偶数 ; 现在AX中是FAT项在FAT中的偏移量,下面来 ; 计算FAT项在哪个扇区中(FAT占用不止一个扇区) xor dx, dx ; DX=0 mov bx, BPB_BytsPerSec ; BX=512 div bx ; DX:AX / 512 ; AX <- 商 (FAT项所在的扇区相对于FAT的扇区号) ; DX <- 余数 (FAT项在扇区内的偏移) push dx ; 保存余数(入栈) mov bx, 0 ; BX <- 0 于是,ES:BX = 8000h:0 add ax, SectorNoOfFAT1 ; 此句之后的AX就是FAT项所在的扇区号 mov cl, 2 ; 读取FAT项所在的扇区,一次读两个,避免在边界 call ReadSector ; 发生错误, 因为一个 FAT项可能跨越两个扇区 pop dx ; DX= FAT项在扇区内的偏移(出栈) add bx, dx ; BX= FAT项在扇区内的偏移 mov ax, es:[bx] ; AX= FAT项值 cmp ds:[bOdd], 1 ; 是否为奇数项? jnz LABEL_EVEN_2 ; 偶数跳转 shr ax, 4 ; 奇数:右移4位(取高12位) LABEL_EVEN_2: ; 偶数 and ax, 0FFFh ; 取低12位 LABEL_GET_FAT_ENRY_OK: pop bx ; 恢复ES、BX(出栈) pop es ret ;---------------------------------------------------------------------------- ;============================================================== ;变量 wRootDirSizeForLoop dw RootDirSectors ; 根目录区剩余扇区数 ; 初始化为14,在循环中会递减至零 OffsetOfPrg dw 0 ; 偏移量 BaseOfPrg dw 0 ; 基地址 wSectorNo dw 0 ; 当前扇区号,初始化为0,在循环中会递增 bOdd db 0 ; 奇数还是偶数FAT项 ;============================================================== _fopen endp ;============================================================ BPB_BytsPerSec equ 512 ; 每扇区字节数 BPB_SecPerClus equ 1 ; 每簇多少扇区 BPB_RsvdSecCnt equ 1 ; Boot 记录占用多少扇区 BPB_NumFATs equ 2 ; 共有多少 FAT 表 BPB_SecPerTrk equ 18 ; 每磁道扇区数 BS_DrvNum equ 0 ; 中断 13 的驱动器号 RootDirSectors equ 14 ; 根目录占用空间 SectorNoOfRootDirectory equ 19 ; Root DIrectory的第一个扇区号 SectorNoOfFAT1 equ 1 ; FAT1 的第一个扇区号 = BPB_RsvdSecCnt DeltaSectorNo equ 17 ; DeltaSectorNo = BPB_RsvdSecCnt + (BPB_NumFATs * FATSz) - 2 ; 文件的开始Sector号 = DirEntry中的开始Sector号 + 根目录占用Sector数目 + DeltaSectorNo ;============================================================ public _load_sector ; /S/H/C/Offset/Base/ip/es/bx/ax/ _load_sector proc push es push bx push ax mov bp, sp mov ax, word ptr [bp+4*2] mov es, ax mov ax, word ptr [bp+5*2] mov bx, ax mov ah,2 ; 功能号,ah为0时为软硬盘控制器复位 mov al,1 ; 需要读入扇区数目 mov dl,0 ; 需要进行读操作的驱动器号,软盘为0,硬盘和U盘为80H mov dh,byte ptr [bp+6*2] ; 需读的磁头号,起始编号为0 mov ch,byte ptr [bp+7*2] ; 需读柱面号,起始编号为0 mov cl,byte ptr [bp+8*2] ; 低五位表示起始扇区号,起始编号为1, int 13h pop ax pop bx pop es ret _load_sector endp
P6/data_P6_2/b_cp1_test0.asm
alxzzhou/BUAA_CO_2020
1
2996
<filename>P6/data_P6_2/b_cp1_test0.asm lui $1,12172 ori $1,$1,64378 lui $2,40268 ori $2,$2,65345 lui $3,22075 ori $3,$3,59710 lui $4,52131 ori $4,$4,53110 lui $5,29493 ori $5,$5,26784 lui $6,60439 ori $6,$6,39004 mthi $1 mtlo $2 sec0: nop nop nop bgez $4,yes0 nop no0:addiu $k1,$k1,1 yes0:addiu $k0,$k0,1 sec1: nop nop subu $4,$4,$3 bgez $4,yes1 nop no1:addiu $k1,$k1,1 yes1:addiu $k0,$k0,1 sec2: nop nop sltiu $4,$5,-12858 bgez $4,yes2 nop no2:addiu $k1,$k1,1 yes2:addiu $k0,$k0,1 sec3: nop nop mfhi $4 bgez $4,yes3 nop no3:addiu $k1,$k1,1 yes3:addiu $k0,$k0,1 sec4: nop nop lhu $4,8($0) bgez $4,yes4 nop no4:addiu $k1,$k1,1 yes4:addiu $k0,$k0,1 sec5: nop sltu $4,$0,$3 nop bgez $4,yes5 nop no5:addiu $k1,$k1,1 yes5:addiu $k0,$k0,1 sec6: nop addu $4,$5,$6 subu $4,$3,$2 bgez $4,yes6 nop no6:addiu $k1,$k1,1 yes6:addiu $k0,$k0,1 sec7: nop or $4,$3,$0 andi $4,$3,41912 bgez $4,yes7 nop no7:addiu $k1,$k1,1 yes7:addiu $k0,$k0,1 sec8: nop xor $4,$2,$4 mfhi $4 bgez $4,yes8 nop no8:addiu $k1,$k1,1 yes8:addiu $k0,$k0,1 sec9: nop and $4,$1,$3 lbu $4,6($0) bgez $4,yes9 nop no9:addiu $k1,$k1,1 yes9:addiu $k0,$k0,1 sec10: nop andi $4,$5,17518 nop bgez $4,yes10 nop no10:addiu $k1,$k1,1 yes10:addiu $k0,$k0,1 sec11: nop addiu $4,$2,-13656 nor $4,$2,$2 bgez $4,yes11 nop no11:addiu $k1,$k1,1 yes11:addiu $k0,$k0,1 sec12: nop ori $4,$5,4923 xori $4,$1,13504 bgez $4,yes12 nop no12:addiu $k1,$k1,1 yes12:addiu $k0,$k0,1 sec13: nop sltiu $4,$0,-29575 mflo $4 bgez $4,yes13 nop no13:addiu $k1,$k1,1 yes13:addiu $k0,$k0,1 sec14: nop ori $4,$0,15411 lw $4,12($0) bgez $4,yes14 nop no14:addiu $k1,$k1,1 yes14:addiu $k0,$k0,1 sec15: nop mfhi $4 nop bgez $4,yes15 nop no15:addiu $k1,$k1,1 yes15:addiu $k0,$k0,1 sec16: nop mflo $4 or $4,$4,$4 bgez $4,yes16 nop no16:addiu $k1,$k1,1 yes16:addiu $k0,$k0,1 sec17: nop mfhi $4 xori $4,$3,24680 bgez $4,yes17 nop no17:addiu $k1,$k1,1 yes17:addiu $k0,$k0,1 sec18: nop mfhi $4 mflo $4 bgez $4,yes18 nop no18:addiu $k1,$k1,1 yes18:addiu $k0,$k0,1 sec19: nop mfhi $4 lb $4,10($0) bgez $4,yes19 nop no19:addiu $k1,$k1,1 yes19:addiu $k0,$k0,1 sec20: nop lhu $4,2($0) nop bgez $4,yes20 nop no20:addiu $k1,$k1,1 yes20:addiu $k0,$k0,1 sec21: nop lh $4,10($0) sltu $4,$5,$5 bgez $4,yes21 nop no21:addiu $k1,$k1,1 yes21:addiu $k0,$k0,1 sec22: nop lbu $4,7($0) addiu $4,$4,-1340 bgez $4,yes22 nop no22:addiu $k1,$k1,1 yes22:addiu $k0,$k0,1 sec23: nop lw $4,16($0) mflo $4 bgez $4,yes23 nop no23:addiu $k1,$k1,1 yes23:addiu $k0,$k0,1 sec24: nop lbu $4,1($0) lb $4,14($0) bgez $4,yes24 nop no24:addiu $k1,$k1,1 yes24:addiu $k0,$k0,1 sec25: subu $4,$0,$3 nop nop bgez $4,yes25 nop no25:addiu $k1,$k1,1 yes25:addiu $k0,$k0,1 sec26: or $4,$4,$6 nop nor $4,$2,$3 bgez $4,yes26 nop no26:addiu $k1,$k1,1 yes26:addiu $k0,$k0,1 sec27: nor $4,$2,$3 nop ori $4,$3,21322 bgez $4,yes27 nop no27:addiu $k1,$k1,1 yes27:addiu $k0,$k0,1 sec28: addu $4,$1,$6 nop mfhi $4 bgez $4,yes28 nop no28:addiu $k1,$k1,1 yes28:addiu $k0,$k0,1 sec29: sltu $4,$2,$6 nop lh $4,12($0) bgez $4,yes29 nop no29:addiu $k1,$k1,1 yes29:addiu $k0,$k0,1 sec30: addu $4,$3,$4 subu $4,$4,$4 nop bgez $4,yes30 nop no30:addiu $k1,$k1,1 yes30:addiu $k0,$k0,1 sec31: xor $4,$5,$1 or $4,$5,$1 and $4,$5,$1 bgez $4,yes31 nop no31:addiu $k1,$k1,1 yes31:addiu $k0,$k0,1 sec32: nor $4,$6,$0 sltu $4,$3,$4 lui $4,7785 bgez $4,yes32 nop no32:addiu $k1,$k1,1 yes32:addiu $k0,$k0,1 sec33: sltu $4,$3,$4 and $4,$5,$2 mflo $4 bgez $4,yes33 nop no33:addiu $k1,$k1,1 yes33:addiu $k0,$k0,1 sec34: sltu $4,$6,$4 and $4,$3,$5 lh $4,0($0) bgez $4,yes34 nop no34:addiu $k1,$k1,1 yes34:addiu $k0,$k0,1 sec35: nor $4,$2,$2 addiu $4,$3,-23384 nop bgez $4,yes35 nop no35:addiu $k1,$k1,1 yes35:addiu $k0,$k0,1 sec36: nor $4,$4,$5 lui $4,14616 xor $4,$0,$4 bgez $4,yes36 nop no36:addiu $k1,$k1,1 yes36:addiu $k0,$k0,1 sec37: addu $4,$5,$6 andi $4,$3,14127 slti $4,$3,-11936 bgez $4,yes37 nop no37:addiu $k1,$k1,1 yes37:addiu $k0,$k0,1 sec38: sltu $4,$4,$4 sltiu $4,$6,-31564 mfhi $4 bgez $4,yes38 nop no38:addiu $k1,$k1,1 yes38:addiu $k0,$k0,1 sec39: sltu $4,$3,$5 addiu $4,$2,22834 lbu $4,11($0) bgez $4,yes39 nop no39:addiu $k1,$k1,1 yes39:addiu $k0,$k0,1 sec40: sltu $4,$3,$3 mflo $4 nop bgez $4,yes40 nop no40:addiu $k1,$k1,1 yes40:addiu $k0,$k0,1 sec41: addu $4,$4,$4 mflo $4 subu $4,$3,$5 bgez $4,yes41 nop no41:addiu $k1,$k1,1 yes41:addiu $k0,$k0,1 sec42: slt $4,$3,$6 mflo $4 xori $4,$4,30660 bgez $4,yes42 nop no42:addiu $k1,$k1,1 yes42:addiu $k0,$k0,1 sec43: slt $4,$5,$4 mfhi $4 mflo $4 bgez $4,yes43 nop no43:addiu $k1,$k1,1 yes43:addiu $k0,$k0,1 sec44: subu $4,$3,$1 mfhi $4 lhu $4,6($0) bgez $4,yes44 nop no44:addiu $k1,$k1,1 yes44:addiu $k0,$k0,1 sec45: xor $4,$6,$5 lhu $4,2($0) nop bgez $4,yes45 nop no45:addiu $k1,$k1,1 yes45:addiu $k0,$k0,1 sec46: sltu $4,$1,$3 lhu $4,8($0) slt $4,$2,$0 bgez $4,yes46 nop no46:addiu $k1,$k1,1 yes46:addiu $k0,$k0,1 sec47: subu $4,$2,$3 lw $4,4($0) addiu $4,$4,-27614 bgez $4,yes47 nop no47:addiu $k1,$k1,1 yes47:addiu $k0,$k0,1 sec48: sltu $4,$2,$5 lhu $4,6($0) mfhi $4 bgez $4,yes48 nop no48:addiu $k1,$k1,1 yes48:addiu $k0,$k0,1 sec49: addu $4,$3,$4 lw $4,8($0) lbu $4,9($0) bgez $4,yes49 nop no49:addiu $k1,$k1,1 yes49:addiu $k0,$k0,1 sec50: addiu $4,$3,21178 nop nop bgez $4,yes50 nop no50:addiu $k1,$k1,1 yes50:addiu $k0,$k0,1 sec51: slti $4,$4,30960 nop or $4,$3,$1 bgez $4,yes51 nop no51:addiu $k1,$k1,1 yes51:addiu $k0,$k0,1 sec52: andi $4,$3,35263 nop addiu $4,$4,23826 bgez $4,yes52 nop no52:addiu $k1,$k1,1 yes52:addiu $k0,$k0,1 sec53: ori $4,$3,48622 nop mfhi $4 bgez $4,yes53 nop no53:addiu $k1,$k1,1 yes53:addiu $k0,$k0,1 sec54: ori $4,$1,17884 nop lbu $4,9($0) bgez $4,yes54 nop no54:addiu $k1,$k1,1 yes54:addiu $k0,$k0,1 sec55: ori $4,$3,30574 sltu $4,$2,$6 nop bgez $4,yes55 nop no55:addiu $k1,$k1,1 yes55:addiu $k0,$k0,1 sec56: xori $4,$4,51353 nor $4,$1,$2 xor $4,$3,$6 bgez $4,yes56 nop no56:addiu $k1,$k1,1 yes56:addiu $k0,$k0,1 sec57: lui $4,20151 slt $4,$2,$3 sltiu $4,$3,15026 bgez $4,yes57 nop no57:addiu $k1,$k1,1 yes57:addiu $k0,$k0,1 sec58: lui $4,46201 xor $4,$3,$3 mfhi $4 bgez $4,yes58 nop no58:addiu $k1,$k1,1 yes58:addiu $k0,$k0,1 sec59: slti $4,$3,4260 nor $4,$3,$2 lh $4,14($0) bgez $4,yes59 nop no59:addiu $k1,$k1,1 yes59:addiu $k0,$k0,1 sec60: slti $4,$4,9765 ori $4,$1,45625 nop bgez $4,yes60 nop no60:addiu $k1,$k1,1 yes60:addiu $k0,$k0,1 sec61: addiu $4,$3,25335 ori $4,$1,17981 sltu $4,$3,$2 bgez $4,yes61 nop no61:addiu $k1,$k1,1 yes61:addiu $k0,$k0,1 sec62: xori $4,$2,40621 xori $4,$4,8645 sltiu $4,$1,10312 bgez $4,yes62 nop no62:addiu $k1,$k1,1 yes62:addiu $k0,$k0,1 sec63: slti $4,$4,698 lui $4,33276 mfhi $4 bgez $4,yes63 nop no63:addiu $k1,$k1,1 yes63:addiu $k0,$k0,1 sec64: xori $4,$0,20585 sltiu $4,$3,-30941 lbu $4,1($0) bgez $4,yes64 nop no64:addiu $k1,$k1,1 yes64:addiu $k0,$k0,1 sec65: andi $4,$0,20051 mflo $4 nop bgez $4,yes65 nop no65:addiu $k1,$k1,1 yes65:addiu $k0,$k0,1 sec66: andi $4,$3,10765 mflo $4 subu $4,$2,$4 bgez $4,yes66 nop no66:addiu $k1,$k1,1 yes66:addiu $k0,$k0,1 sec67: xori $4,$4,47354 mflo $4 ori $4,$5,16150 bgez $4,yes67 nop no67:addiu $k1,$k1,1 yes67:addiu $k0,$k0,1 sec68: ori $4,$1,39972 mflo $4 mflo $4 bgez $4,yes68 nop no68:addiu $k1,$k1,1 yes68:addiu $k0,$k0,1 sec69: ori $4,$6,12589 mflo $4 lhu $4,2($0) bgez $4,yes69 nop no69:addiu $k1,$k1,1 yes69:addiu $k0,$k0,1 sec70: sltiu $4,$2,7822 lb $4,0($0) nop bgez $4,yes70 nop no70:addiu $k1,$k1,1 yes70:addiu $k0,$k0,1 sec71: andi $4,$4,17713 lh $4,16($0) or $4,$2,$1 bgez $4,yes71 nop no71:addiu $k1,$k1,1 yes71:addiu $k0,$k0,1 sec72: ori $4,$2,55457 lw $4,8($0) ori $4,$4,50710 bgez $4,yes72 nop no72:addiu $k1,$k1,1 yes72:addiu $k0,$k0,1 sec73: addiu $4,$4,-18932 lbu $4,2($0) mfhi $4 bgez $4,yes73 nop no73:addiu $k1,$k1,1 yes73:addiu $k0,$k0,1 sec74: lui $4,57595 lh $4,14($0) lhu $4,6($0) bgez $4,yes74 nop no74:addiu $k1,$k1,1 yes74:addiu $k0,$k0,1 sec75: mfhi $4 nop nop bgez $4,yes75 nop no75:addiu $k1,$k1,1 yes75:addiu $k0,$k0,1 sec76: mflo $4 nop subu $4,$3,$2 bgez $4,yes76 nop no76:addiu $k1,$k1,1 yes76:addiu $k0,$k0,1 sec77: mfhi $4 nop addiu $4,$1,17322 bgez $4,yes77 nop no77:addiu $k1,$k1,1 yes77:addiu $k0,$k0,1 sec78: mflo $4 nop mfhi $4 bgez $4,yes78 nop no78:addiu $k1,$k1,1 yes78:addiu $k0,$k0,1 sec79: mflo $4 nop lhu $4,12($0) bgez $4,yes79 nop no79:addiu $k1,$k1,1 yes79:addiu $k0,$k0,1 sec80: mfhi $4 subu $4,$3,$6 nop bgez $4,yes80 nop no80:addiu $k1,$k1,1 yes80:addiu $k0,$k0,1 sec81: mflo $4 subu $4,$4,$3 and $4,$0,$2 bgez $4,yes81 nop no81:addiu $k1,$k1,1 yes81:addiu $k0,$k0,1 sec82: mfhi $4 nor $4,$4,$6 xori $4,$3,17210 bgez $4,yes82 nop no82:addiu $k1,$k1,1 yes82:addiu $k0,$k0,1 sec83: mfhi $4 sltu $4,$3,$2 mflo $4 bgez $4,yes83 nop no83:addiu $k1,$k1,1 yes83:addiu $k0,$k0,1 sec84: mflo $4 addu $4,$4,$3 lb $4,15($0) bgez $4,yes84 nop no84:addiu $k1,$k1,1 yes84:addiu $k0,$k0,1 sec85: mfhi $4 andi $4,$1,60386 nop bgez $4,yes85 nop no85:addiu $k1,$k1,1 yes85:addiu $k0,$k0,1 sec86: mfhi $4 xori $4,$1,26279 sltu $4,$4,$4 bgez $4,yes86 nop no86:addiu $k1,$k1,1 yes86:addiu $k0,$k0,1 sec87: mfhi $4 addiu $4,$2,256 addiu $4,$5,21378 bgez $4,yes87 nop no87:addiu $k1,$k1,1 yes87:addiu $k0,$k0,1 sec88: mfhi $4 lui $4,13944 mfhi $4 bgez $4,yes88 nop no88:addiu $k1,$k1,1 yes88:addiu $k0,$k0,1 sec89: mflo $4 sltiu $4,$2,-11138 lw $4,16($0) bgez $4,yes89 nop no89:addiu $k1,$k1,1 yes89:addiu $k0,$k0,1 sec90: mflo $4 mflo $4 nop bgez $4,yes90 nop no90:addiu $k1,$k1,1 yes90:addiu $k0,$k0,1 sec91: mfhi $4 mfhi $4 nor $4,$4,$1 bgez $4,yes91 nop no91:addiu $k1,$k1,1 yes91:addiu $k0,$k0,1 sec92: mflo $4 mflo $4 addiu $4,$2,3161 bgez $4,yes92 nop no92:addiu $k1,$k1,1 yes92:addiu $k0,$k0,1 sec93: mflo $4 mflo $4 mfhi $4 bgez $4,yes93 nop no93:addiu $k1,$k1,1 yes93:addiu $k0,$k0,1 sec94: mfhi $4 mfhi $4 lbu $4,15($0) bgez $4,yes94 nop no94:addiu $k1,$k1,1 yes94:addiu $k0,$k0,1 sec95: mfhi $4 lbu $4,14($0) nop bgez $4,yes95 nop no95:addiu $k1,$k1,1 yes95:addiu $k0,$k0,1 sec96: mflo $4 lhu $4,6($0) slt $4,$2,$3 bgez $4,yes96 nop no96:addiu $k1,$k1,1 yes96:addiu $k0,$k0,1 sec97: mflo $4 lw $4,12($0) slti $4,$1,9391 bgez $4,yes97 nop no97:addiu $k1,$k1,1 yes97:addiu $k0,$k0,1 sec98: mflo $4 lw $4,8($0) mflo $4 bgez $4,yes98 nop no98:addiu $k1,$k1,1 yes98:addiu $k0,$k0,1 sec99: mflo $4 lw $4,8($0) lbu $4,11($0) bgez $4,yes99 nop no99:addiu $k1,$k1,1 yes99:addiu $k0,$k0,1 sec100: lhu $4,14($0) nop nop bgez $4,yes100 nop no100:addiu $k1,$k1,1 yes100:addiu $k0,$k0,1 sec101: lhu $4,6($0) nop xor $4,$6,$3 bgez $4,yes101 nop no101:addiu $k1,$k1,1 yes101:addiu $k0,$k0,1 sec102: lbu $4,4($0) nop addiu $4,$4,17005 bgez $4,yes102 nop no102:addiu $k1,$k1,1 yes102:addiu $k0,$k0,1 sec103: lb $4,12($0) nop mfhi $4 bgez $4,yes103 nop no103:addiu $k1,$k1,1 yes103:addiu $k0,$k0,1 sec104: lbu $4,16($0) nop lhu $4,14($0) bgez $4,yes104 nop no104:addiu $k1,$k1,1 yes104:addiu $k0,$k0,1 sec105: lh $4,2($0) sltu $4,$3,$4 nop bgez $4,yes105 nop no105:addiu $k1,$k1,1 yes105:addiu $k0,$k0,1 sec106: lhu $4,14($0) xor $4,$0,$0 or $4,$5,$2 bgez $4,yes106 nop no106:addiu $k1,$k1,1 yes106:addiu $k0,$k0,1 sec107: lbu $4,11($0) sltu $4,$3,$1 addiu $4,$3,-15642 bgez $4,yes107 nop no107:addiu $k1,$k1,1 yes107:addiu $k0,$k0,1 sec108: lb $4,12($0) sltu $4,$3,$6 mfhi $4 bgez $4,yes108 nop no108:addiu $k1,$k1,1 yes108:addiu $k0,$k0,1 sec109: lb $4,3($0) xor $4,$0,$3 lhu $4,14($0) bgez $4,yes109 nop no109:addiu $k1,$k1,1 yes109:addiu $k0,$k0,1 sec110: lb $4,6($0) lui $4,54222 nop bgez $4,yes110 nop no110:addiu $k1,$k1,1 yes110:addiu $k0,$k0,1 sec111: lb $4,13($0) sltiu $4,$3,-2884 subu $4,$0,$3 bgez $4,yes111 nop no111:addiu $k1,$k1,1 yes111:addiu $k0,$k0,1 sec112: lb $4,2($0) lui $4,28727 sltiu $4,$5,-4633 bgez $4,yes112 nop no112:addiu $k1,$k1,1 yes112:addiu $k0,$k0,1 sec113: lhu $4,4($0) slti $4,$1,11623 mfhi $4 bgez $4,yes113 nop no113:addiu $k1,$k1,1 yes113:addiu $k0,$k0,1 sec114: lw $4,12($0) andi $4,$4,54302 lh $4,10($0) bgez $4,yes114 nop no114:addiu $k1,$k1,1 yes114:addiu $k0,$k0,1 sec115: lh $4,4($0) mflo $4 nop bgez $4,yes115 nop no115:addiu $k1,$k1,1 yes115:addiu $k0,$k0,1 sec116: lbu $4,4($0) mfhi $4 or $4,$4,$1 bgez $4,yes116 nop no116:addiu $k1,$k1,1 yes116:addiu $k0,$k0,1 sec117: lb $4,14($0) mfhi $4 xori $4,$5,53240 bgez $4,yes117 nop no117:addiu $k1,$k1,1 yes117:addiu $k0,$k0,1 sec118: lb $4,14($0) mfhi $4 mfhi $4 bgez $4,yes118 nop no118:addiu $k1,$k1,1 yes118:addiu $k0,$k0,1 sec119: lbu $4,11($0) mfhi $4 lhu $4,0($0) bgez $4,yes119 nop no119:addiu $k1,$k1,1 yes119:addiu $k0,$k0,1 sec120: lbu $4,9($0) lb $4,10($0) nop bgez $4,yes120 nop no120:addiu $k1,$k1,1 yes120:addiu $k0,$k0,1 sec121: lw $4,16($0) lbu $4,16($0) nor $4,$1,$0 bgez $4,yes121 nop no121:addiu $k1,$k1,1 yes121:addiu $k0,$k0,1 sec122: lb $4,6($0) lb $4,2($0) addiu $4,$2,-24638 bgez $4,yes122 nop no122:addiu $k1,$k1,1 yes122:addiu $k0,$k0,1 sec123: lh $4,4($0) lw $4,0($0) mflo $4 bgez $4,yes123 nop no123:addiu $k1,$k1,1 yes123:addiu $k0,$k0,1 sec124: lh $4,14($0) lhu $4,6($0) lb $4,10($0) bgez $4,yes124 nop no124:addiu $k1,$k1,1 yes124:addiu $k0,$k0,1
dialectica-cats/DCBSets.agda
heades/AUGL
0
11467
<filename>dialectica-cats/DCBSets.agda module DCBSets where open import prelude open import relations -- The objects: Obj : Set₁ Obj = Σ[ U ∈ Set ] (Σ[ X ∈ Set ] (Σ[ x ∈ (⊤ → X) ] (Σ[ d ∈ (X × X → X) ](Σ[ α ∈ (U → X → Set) ]( (∀{u : U}{x₁ x₂ : X} → α u (d (x₁ , x₂)) → ((α u x₁) × (α u x₂))) × ( ∀{Y : Set}{x' : X}{F : Y → X}{y : ⊤ → Y} → d (x' , F (y triv)) ≡ x' ) × ( ∀{Y : Set}{x' : X}{F : Y → X}{y : ⊤ → Y} → d (F (y triv) , x') ≡ x' )))))) -- The morphisms: Hom : Obj → Obj → Set Hom (U , X , x , d₁ , α , p₁ ) (V , Y , y , d₂ , β , p₂) = Σ[ f ∈ (U → V) ] (Σ[ F ∈ (U → Y → X) ] ((∀{u : U}{y : Y} → α u (F u y) → β (f u) y))) -- Composition: comp : {A B C : Obj} → Hom A B → Hom B C → Hom A C comp {(U , X , x , d₁ , α , dec₁ , p₁ , p₂)} {(V , Y , y , d₂ , β , dec₂ , p₃ , p₄)} {(W , Z , z , d₃ , γ , dec₃ , p₅ , p₆)} (f , F , q₁) (g , G , q₂) = g ∘ f , (((λ u z' → F u (G (f u) z'))) ) , (λ {u} {z'} r → q₂ (q₁ r)) infixl 5 _○_ _○_ = comp -- The contravariant hom-functor: Homₐ : {A' A B B' : Obj} → Hom A' A → Hom B B' → Hom A B → Hom A' B' Homₐ f h g = comp f (comp g h) -- The identity function: id : {A : Obj} → Hom A A id {(U , V , n , d , α , p)} = (id-set , curry snd , id-set) -- In this formalization we will only worry about proving that the -- data of morphisms are equivalent, and not worry about the morphism -- conditions. This will make proofs shorter and faster. -- -- If we have parallel morphisms (f,F) and (g,G) in which we know that -- f = g and F = G, then the condition for (f,F) will imply the -- condition of (g,G) and vice versa. Thus, we can safely ignore it. infix 4 _≡h_ _≡h_ : {A B : Obj} → (f g : Hom A B) → Set _≡h_ {(U , X , _ , _ , _ , _ , _ , _)}{(V , Y , _ , β , _ , _ , _ , _)} (f , F , p₁) (g , G , p₂) = f ≡ g × F ≡ G ≡h-refl : {A B : Obj}{f : Hom A B} → f ≡h f ≡h-refl {U , X , _ , α , _ , _ , _ , _}{V , Y , _ , β , _ , _ , _ , _}{f , F , _} = refl , refl ≡h-trans : ∀{A B}{f g h : Hom A B} → f ≡h g → g ≡h h → f ≡h h ≡h-trans {U , X , _ , α , _ , _ , _ , _}{V , Y , _ , β , _ , _ , _ , _}{f , F , _}{g , G , _}{h , H , _} (p₁ , p₂) (p₃ , p₄) rewrite p₁ | p₂ | p₃ | p₄ = refl , refl ≡h-sym : ∀{A B}{f g : Hom A B} → f ≡h g → g ≡h f ≡h-sym {U , X , _ , α , _ , _ , _ , _}{V , Y , _ , β , _ , _ , _ , _}{f , F , _}{g , G , _} (p₁ , p₂) rewrite p₁ | p₂ = refl , refl ≡h-subst-○ : ∀{A B C}{f₁ f₂ : Hom A B}{g₁ g₂ : Hom B C}{j : Hom A C} → f₁ ≡h f₂ → g₁ ≡h g₂ → f₂ ○ g₂ ≡h j → f₁ ○ g₁ ≡h j ≡h-subst-○ {U , X , _ , α , _ , _ , _ , _} {V , Y , _ , β , _ , _ , _ , _} {W , Z , _ , γ , _ , _ , _ , _} {f₁ , F₁ , _} {f₂ , F₂ , _} {g₁ , G₁ , _} {g₂ , G₂ , _} {j , J , _} (p₅ , p₆) (p₇ , p₈) (p₉ , p₁₀) rewrite p₅ | p₆ | p₇ | p₈ | p₉ | p₁₀ = refl , refl ○-assoc : ∀{A B C D}{f : Hom A B}{g : Hom B C}{h : Hom C D} → f ○ (g ○ h) ≡h (f ○ g) ○ h ○-assoc {U , X , _ , α , _ , _ , _ , _}{V , Y , _ , β , _ , _ , _ , _}{W , Z , _ , γ , _ , _ , _ , _}{S , T , _ , ι , _ , _ , _ , _} {f , F , _}{g , G , _}{h , H , _} = refl , refl ○-idl : ∀{A B}{f : Hom A B} → id ○ f ≡h f ○-idl {U , X , _ , _ , _ , _ , _ , _}{V , Y , _ , _ , _ , _ , _ , _}{f , F , _} = refl , refl ○-idr : ∀{A B}{f : Hom A B} → f ○ id ≡h f ○-idr {U , X , _ , _ , _ , _ , _ , _}{V , Y , _ , _ , _ , _ , _ , _}{f , F , _} = refl , refl -- The tensor functor: ⊗ _⊗ᵣ_ : ∀{U X V Y : Set} → (U → X → Set) → (V → Y → Set) → ((U × V) → (X × Y) → Set) _⊗ᵣ_ α β (u , v) (x , y) = (α u x) × (β v y) _⊗ₒ_ : (A B : Obj) → Obj (U , X , n₁ , d₁ , α , pr₁ , q₁ , q₂ ) ⊗ₒ (V , Y , n₂ , d₂ , β , pr₂ , q₃ , q₄) = ((U × V) , (X × Y) , trans-× n₁ n₂ , d⊗ , (α ⊗ᵣ β) , pr⊗ , ((λ {Y x' F y} → q₁⊗ {Y} {x'}{F}{y}) , (λ {Y x' F y} → q₂⊗ {Y} {x'}{F}{y}))) where d⊗ : Σ (Σ X (λ x → Y)) (λ x → Σ X (λ x₁ → Y)) → Σ X (λ x → Y) d⊗ ((x , y) , (x' , y')) = d₁ (x , x') , d₂ (y , y') pr⊗ : {u : Σ U (λ x → V)} {x₁ x₂ : Σ X (λ x → Y)} → (α ⊗ᵣ β) u (d⊗ (x₁ , x₂)) → Σ ((α ⊗ᵣ β) u x₁) (λ x → (α ⊗ᵣ β) u x₂) pr⊗ {u , v}{x , y}{x' , y'} (p , p') = (fst (pr₁ p) , fst (pr₂ p')) , snd (pr₁ p) , snd (pr₂ p') q₁⊗ : {Y₁ : Set} {x' : Σ X (λ x → Y)} {F : Y₁ → Σ X (λ x → Y)}{y : ⊤ → Y₁} → d⊗ (x' , F (y triv)) ≡ x' q₁⊗ {_}{x , y}{F}{p} with q₁ {x' = x}{fst ∘ F}{p} | q₃ {x' = y}{snd ∘ F}{p} ... | q'₁ | q'₂ with F (p triv) ... | x' , y' rewrite q'₁ | q'₂ = refl q₂⊗ : {Y₁ : Set} {x' : Σ X (λ x → Y)} {F : Y₁ → Σ X (λ x → Y)}{y : ⊤ → Y₁} → d⊗ (F (y triv) , x') ≡ x' q₂⊗ {Y}{x , y}{F}{p} with q₂ {_}{x}{fst ∘ F}{p} | q₄ {_}{y}{snd ∘ F}{p} ... | q'₁ | q'₂ with F (p triv) ... | x' , y' rewrite q'₁ | q'₂ = refl F⊗ : ∀{Z T V X U Y : Set}{F : U → Z → X}{G : V → T → Y} → (U × V) → (Z × T) → (X × Y) F⊗ {F = F}{G} (u , v) (z , t) = F u z , G v t _⊗ₐ_ : {A B C D : Obj} → Hom A C → Hom B D → Hom (A ⊗ₒ B) (C ⊗ₒ D) _⊗ₐ_ {(U , X , _ , _ , α , _ , _ , _)}{(V , Y , _ , _ , β , _ , _ , _)}{(W , Z , _ , _ , γ , _ , _ , _)}{(S , T , _ , _ , δ , _ , _ , _)} (f , F , p₁) (g , G , p₂) = ⟨ f , g ⟩ , F⊗ {F = F}{G} , p⊗ where p⊗ : {u : Σ U (λ x → V)} {y : Σ Z (λ x → T)} → (α ⊗ᵣ β) u (F⊗ {F = F}{G} u y) → (γ ⊗ᵣ δ) (⟨ f , g ⟩ u) y p⊗ {u , v}{z , t} (p₃ , p₄) = p₁ p₃ , p₂ p₄ π₁ : {A B : Obj} → Hom (A ⊗ₒ B) A π₁ {U , X , n₁ , _ , α , _ , _ , _}{V , Y , n₂ , _ , β , _ , _ , _} = fst , (λ r x → x , n₂ triv) , cond where cond : {u : Σ U (λ x → V)} {y : X} → (α ⊗ᵣ β) u (y , n₂ triv) → α (fst u) y cond {u , v}{x} (p₁ , p₂) = p₁ π₂ : {A B : Obj} → Hom (A ⊗ₒ B) B π₂ {U , X , n₁ , _ , α , _ , _ , _}{V , Y , n₂ , _ , β , _ , _ , _} = snd , (λ r y → n₁ triv , y) , cond where cond : {u : Σ U (λ x → V)} {y : Y} → (α ⊗ᵣ β) u (n₁ triv , y) → β (snd u) y cond {u , v}{y} (p₁ , p₂) = p₂ cart-ar : {A B C : Obj} → (f : Hom C A) → (g : Hom C B) → Hom C (A ⊗ₒ B) cart-ar {U , X , x , d₁ , α , pr₁ , q₁ , q₂}{V , Y , y , d₂ , β , pr₂ , q₃ , q₄}{W , Z , z , d₃ , γ , pr₃ , q₅ , q₆} (f , F , p₁) (g , G , p₂) = trans-× f g , crt , cond where crt : W → Σ X (λ x₁ → Y) → Z crt w (x' , y') = d₃ ((F w x') , (G w y')) cond : {u : W} {y₁ : Σ X (λ x₁ → Y)} → γ u (crt u y₁) → (α ⊗ᵣ β) (f u , g u) y₁ cond {w}{x' , y'} p = p₁ (fst (pr₃ {w}{F w x'}{G w y'} p)) , p₂ (snd (pr₃ {w}{F w x'}{G w y'} p)) cart-diag₁ : ∀{A B C : Obj} → {f : Hom C A} → {g : Hom C B} → (cart-ar f g) ○ π₁ ≡h f cart-diag₁ {U , X , x , d₁ , α , pr₁ , q₁ , q₂}{V , Y , y , d₂ , β , q₃ , q₄ , q₅}{W , Z , z , d₃ , γ , q₆ , q₇ , q₈}{f , F , p₁}{g , G , p₂} = refl , ext-set (λ {w} → ext-set (λ {x} → q₇ {x' = F w x}{G w}{y})) cart-diag₂ : ∀{A B C : Obj} → {f : Hom C A} → {g : Hom C B} → (cart-ar f g) ○ π₂ ≡h g cart-diag₂ {U , X , x , d₁ , α , pr₁ , q₁ , q₂}{V , Y , y , d₂ , β , q₃ , q₄ , q₅}{W , Z , z , d₃ , γ , q₆ , q₇ , q₈}{f , F , p₁}{g , G , p₂} = refl , ext-set (λ {w} → ext-set (λ {y₁} → q₈ {x' = G w y₁}{F w}{x})) -- The □-comonad: □ₒ-cond : ∀{U X : Set} → (α : U → X → Set) → U → 𝕃 X → Set □ₒ-cond {U}{X} α u [] = ⊤ □ₒ-cond {U}{X} α u (x :: xs) = (α u x) × (□ₒ-cond α u xs) □ₒ-cond-++ : ∀{U X : Set}{α : U → X → Set}{u : U}{l₁ l₂ : 𝕃 X} → □ₒ-cond α u (l₁ ++ l₂) ≡ ((□ₒ-cond α u l₁) × (□ₒ-cond α u l₂)) □ₒ-cond-++ {U}{X}{α}{u}{[]}{l₂} = ∧-unit □ₒ-cond-++ {U}{X}{α}{u}{x :: xs}{l₂} rewrite □ₒ-cond-++ {U}{X}{α}{u}{xs}{l₂} = ∧-assoc □ₒ : Obj → Obj □ₒ (U , X , x , d , α , pr , q₁ , q₂) = U , X * , (λ t → [ x t ]) , □d , □ₒ-cond {U}{X} α , {!!} , {!!} , {!!} where □d : (X *) × (X *) → X * □d (l₁ , l₂) = l₁ ++ l₂ -- □pr : {u : U} {x₁ x₂ : 𝕃 X} -- → □ₒ-cond α u (□d (x₁ , x₂)) -- → Σ (□ₒ-cond α u x₁) (λ x₃ → □ₒ-cond α u x₂) -- □pr {_}{[]} {[]} x₁ = triv , triv -- □pr {u}{x₁ = []} {x₁ :: x₂} (a , b) = triv , snd (pr a) , snd (□pr {u}{[]}{x₂} b) -- □pr {u}{x₁ = x₁ :: x₂} {[]} (a , b) = (fst (pr a) , fst (□pr {u}{x₂}{[]} b)) , triv -- □pr {_}{x₁ :: x₂} {x₃ :: x₄} (a , b) with pr a -- ... | c , e with □pr {x₁ = x₂} b -- ... | f , g = (c , f) , (e , g) □q₁ : {Y : Set} {x' : 𝕃 X} {F : Y → 𝕃 X} {y : ⊤ → Y} → □d (x' , F (y triv)) ≡ x' □q₁ {x' = []}{F}{y} = {!!} □q₁ {x' = x₁ :: x'}{F}{y} with F (y triv) ... | [] = {!!} ... | a :: as = {!!} {- □ₐ-s : ∀{U Y X : Set} → (U → Y → X) → (U → Y * → X *) □ₐ-s f u l = map (f u) l □ₐ : {A B : Obj} → Hom A B → Hom (□ₒ A) (□ₒ B) □ₐ {U , X , α}{V , Y , β} (f , F , p) = f , (□ₐ-s F , aux) where aux : {u : U} {y : 𝕃 Y} → □ₒ-cond α u (□ₐ-s F u y) → □ₒ-cond β (f u) y aux {u}{[]} p₁ = triv aux {u}{y :: ys} (p₁ , p₂) = p p₁ , aux p₂ -- Of-course is a comonad: ε : ∀{A} → Hom (□ₒ A) A ε {U , X , α} = id-set , (λ u x → [ x ]) , fst δ-s : {U X : Set} → U → 𝕃 (𝕃 X) → 𝕃 X δ-s u xs = foldr _++_ [] xs δ : ∀{A} → Hom (□ₒ A) (□ₒ (□ₒ A)) δ {U , X , α} = id-set , δ-s , cond where cond : {u : U} {y : 𝕃 (𝕃 X)} → □ₒ-cond α u (foldr _++_ [] y) → □ₒ-cond (□ₒ-cond α) u y cond {u}{[]} p = triv cond {u}{l :: ls} p with □ₒ-cond-++ {U}{X}{α}{u}{l}{foldr _++_ [] ls} ... | p' rewrite p' with p ... | p₂ , p₃ = p₂ , cond {u}{ls} p₃ comonand-diag₁ : ∀{A} → (δ {A}) ○ (□ₐ (δ {A})) ≡h (δ {A}) ○ (δ { □ₒ A}) comonand-diag₁ {U , X , α} = refl , ext-set (λ {x} → ext-set (λ {l} → aux {x} {l})) where aux : ∀{x : U}{l : 𝕃 (𝕃 (𝕃 X))} → foldr _++_ [] (□ₐ-s (λ u xs → foldr _++_ [] xs) x l) ≡ foldr _++_ [] (foldr _++_ [] l) aux {u}{[]} = refl aux {u}{x :: xs} rewrite aux {u}{xs} = foldr-append {_}{_}{X}{X}{x}{foldr _++_ [] xs} comonand-diag₂ : ∀{A} → (δ {A}) ○ (ε { □ₒ A}) ≡h (δ {A}) ○ (□ₐ (ε {A})) comonand-diag₂ {U , X , α} = refl , ext-set (λ {u} → ext-set (λ {l} → aux {l})) where aux : ∀{a : 𝕃 X} → a ++ [] ≡ foldr _++_ [] (map (λ x → x :: []) a) aux {[]} = refl aux {x :: xs} rewrite (++[] xs) | sym (foldr-map {_}{X}{xs}) = refl -}
programs/oeis/277/A277097.asm
neoneye/loda
22
23626
<filename>programs/oeis/277/A277097.asm ; A277097: a(n) = 5 - (prime(n) mod 10). ; 3,2,0,-2,4,2,-2,-4,2,-4,4,-2,4,2,-2,2,-4,4,-2,4,2,-4,2,-4,-2,4,2,-2,-4,2,-2,4,-2,-4,-4,4,-2,2,-2,2,-4,4,4,2,-2,-4,4,2,-2,-4,2,-4,4,4,-2,2,-4,4,-2,4,2,2,-2,4,2,-2,4,-2,-2,-4,2 seq $0,7652 ; Final digit of prime(n). sub $1,$0 add $1,5 mov $0,$1
Cubical/Categories/Monoidal/Enriched.agda
FernandoLarrain/cubical
1
16735
-- Enriched categories {-# OPTIONS --safe #-} module Cubical.Categories.Monoidal.Enriched where open import Cubical.Categories.Monoidal.Base open import Cubical.Foundations.Prelude module _ {ℓV ℓV' : Level} (V : MonoidalCategory ℓV ℓV') (ℓE : Level) where open MonoidalCategory V renaming (ob to obV; Hom[_,_] to V[_,_]; id to idV; _⋆_ to _⋆V_) record EnrichedCategory : Type (ℓ-max (ℓ-max ℓV ℓV') (ℓ-suc ℓE)) where field ob : Type ℓE Hom[_,_] : ob → ob → obV id : ∀ {x} → V[ unit , Hom[ x , x ] ] seq : ∀ x y z → V[ Hom[ x , y ] ⊗ Hom[ y , z ] , Hom[ x , z ] ] -- Axioms ⋆IdL : ∀ x y → η⟨ _ ⟩ ≡ (id {x} ⊗ₕ idV) ⋆V (seq x x y) ⋆IdR : ∀ x y → ρ⟨ _ ⟩ ≡ (idV ⊗ₕ id {y}) ⋆V (seq x y y) ⋆Assoc : ∀ x y z w → α⟨ _ , _ , _ ⟩ ⋆V ((seq x y z) ⊗ₕ idV) ⋆V (seq x z w) ≡ (idV ⊗ₕ (seq y z w)) ⋆V (seq x y w) -- TODO: define underlying category using Hom[ x , y ] := V[ unit , Hom[ x , y ] ]
libsrc/target/zx81/zx_lprintc5.asm
jpoikela/z88dk
640
11232
; ; Print on the ZX PRINTER with a small ZX81 font in 51 columns ; use -D ASCIIFONT for a bigger version supporting lowercase text etc.. ; add also -DXFONT for an even more accurate, slightly different behavior ; (closer text rows, 50 columns, more symbols on chr$ <32) ; ; <NAME>, 2018 ; ; ; $Id: zx_lprintc5.asm $ ; SECTION code_clib PUBLIC zx_lprintc5 PUBLIC _zx_lprintc5 EXTERN zx_print_buf EXTERN asctozx81 EXTERN prbuf_x ; set this one to 0 to wipe the buffer EXTERN zx_print_row .offsets_table defb 128,64,32,16,8,4,2,1 .zx_lprintc5 ._zx_lprintc5 ld a,(prbuf_x) and a call z,buf_reset ld hl,2 add hl,sp ld (charptr+1),hl ld a,(hl) .charptr ld hl,0 ld a,(hl) IF STANDARDESCAPECHARS cp 10 ; CR? jp z,newline ELSE cp 13 ; CR? jp z,newline ENDIF IF ASCIIFONT ; ld a,(hl) ELSE call asctozx81 ; now A holds the character code ENDIF ld e,a rla ld a,0 ; NOP jr nc,nocpl ld a,$2f ; CPL .nocpl ld (invrs),a ld (invrs2),a ld a,e IF ASCIIFONT and 127 ; mask the inverse bit cp 32 ELSE and 127 ; mask the inverse bit ENDIF jr z,space ; space chr ld c,a IF ASCIIFONT EXTERN font ld ix,font-256-8+1 ld de,8 .fontptr add ix,de dec a jr nz,fontptr ELSE ld ix,font5-7 ld de,7 .fontptr add ix,de dec a jr nz,fontptr ld a,9 ; font is slightly condensed, here we rebuild the first row sub c sbc a,a ; 0 (nop) or FF and $AF ; xor a, overrides "ld a,(ix+1)" used on characters 0..8 ld (firstbyte),a ENDIF ld a,(prbuf_x) ld c,a AND 7 ; @00000111 ld hl,offsets_table ld e,a ;ld d,0 add hl,de ld a,(hl) ld (_smc1+1),a ld a,c rra srl a srl a ;ld d,0 ld e,a ld hl,buf add hl,de ld (rowadr1)+1,hl ld d,8 IF ASCIIFONT ld a,(ix-1) ; First chr shape line ELSE ld a,(ix+1) ; First chr shape line (=third one for chr$ codes <=8) .firstbyte xor a ; ld a,0 ..first chr shape line for the other characters, SMC disables it when necessary ENDIF .invrs nop ; toggles between "nop" and "cpl" ld c,a ._oloop ld b,5 ;Load width ._smc1 ld a,1 ;Load pixel mask ._iloop sla c ;Test leftmost pixel jr nc,_noplot ;See if a plot is needed ld e,a or (hl) ld (hl),a ld a,e ._noplot rrca jr nc,_notedge ;Test if edge of byte reached inc hl ;Go to next byte ._notedge djnz _iloop ; --------- .rowadr1 ld hl,0 ; current address push de ld de,32 add hl,de pop de ld (rowadr1+1),hl ; --------- ld a,(ix+0) ;Load one line of image .invrs2 nop ; changed into nop / cpl ld c,a inc ix dec d jr nz,_oloop .space ld a,(prbuf_x) cp 250 ; last valid column position ? jr z,newline add 5 ld (prbuf_x),a ret .newline ld hl,buf call zx_print_buf .buf_reset ld hl,buf xor a ld (prbuf_x),a ld (hl),a ld d,h ld e,l inc de ld bc,255 ldir ; -- optional text line spacing ld hl,buf call zx_print_row IF XFONT jr space ELSE ret ENDIF SECTION rodata_clib IF ASCIIFONT IF XFONT ; graphics and umlaut defb 0x00 , 0x60 , 0x90 , 0xE0 , 0x90 , 0x90 , 0xA0 , 0x00 ;11 - ss defb 0x00 , 0x00 , 0x60 , 0x90 , 0xE0 , 0x90 , 0xA0 , 0x80 ;12 - SS defb 0,0,0,0,0,0,0,0 defb 0x90 , 0x00 , 0x60 , 0x90 , 0xF0 , 0x90 , 0x90 , 0x00 ;14 - a defb 0x90 , 0x00 , 0x60 , 0x90 , 0x90 , 0x90 , 0x60 , 0x00 ;15 - o defb 0x90 , 0x00 , 0x90 , 0x90 , 0x90 , 0x90 , 0x60 , 0x00 ;16 - u defb 0x00 , 0x90 , 0x00 , 0x60 , 0x90 , 0x90 , 0x70 , 0x00 ;17 - A defb 0x00 , 0x90 , 0x00 , 0x60 , 0x90 , 0x90 , 0x60 , 0x00 ;18 - O defb 0x00 , 0x00 , 0x90 , 0x00 , 0x90 , 0x90 , 0x60 , 0x00 ;19 - U defb 0x00 , 0x60 , 0x90 , 0xC0 , 0xE0 , 0x80 , 0x90 , 0x60 ;20 (euro symbol) defb 0xE0 , 0xE0 , 0xE0 , 0xE0 , 0x00 , 0x00 , 0x00 , 0x00 defb 0x38 , 0x38 , 0x38 , 0x38 , 0x00 , 0x00 , 0x00 , 0x00 ;22 defb 0xF8 , 0xF8 , 0xF8 , 0xF8 , 0x00 , 0x00 , 0x00 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x00 , 0xE0 , 0xE0 , 0xE0 , 0xE0 ;24 defb 0xE0 , 0xE0 , 0xE0 , 0xE0 , 0xE0 , 0xE0 , 0xE0 , 0xE0 defb 0x38 , 0x38 , 0x38 , 0x38 , 0xE0 , 0xE0 , 0xE0 , 0xE0 ;26 defb 0xF8 , 0xF8 , 0xF8 , 0xF8 , 0xE0 , 0xE0 , 0xE0 , 0xE0 defb 0xA8 , 0x50 , 0xA8 , 0x50 , 0xA8 , 0x50 , 0xA8 , 0x50 ;28 (gray block) defb 0x00 , 0x00 , 0x00 , 0x00 , 0xA8 , 0x50 , 0xA8 , 0x50 defb 0xA8 , 0x50 , 0xA8 , 0x50 , 0x00 , 0x00 , 0x00 , 0x00 ;30 defb 0x50 , 0x50 , 0x50 , 0x50 , 0x00 , 0x00 , 0x00 , 0x00 defb 0,0,0,0,0,0,0,0 ENDIF .font defb 0x00 , 0x20 , 0x20 , 0x20 , 0x20 , 0x00 , 0x20 , 0x00 defb 0x00 , 0x50 , 0x50 , 0x50 , 0x00 , 0x00 , 0x00 , 0x00 defb 0x50 , 0x50 , 0xF8 , 0x50 , 0xF8 , 0x50 , 0x50 , 0x00 defb 0x20 , 0x70 , 0xA0 , 0x70 , 0x28 , 0x70 , 0x20 , 0x00 defb 0x00 , 0x40 , 0x50 , 0x20 , 0x50 , 0x10 , 0x00 , 0x00 defb 0x40 , 0xA0 , 0xA0 , 0x40 , 0xA0 , 0xA0 , 0x50 , 0x00 defb 0x00 , 0x20 , 0x20 , 0x20 , 0x00 , 0x00 , 0x00 , 0x00 defb 0x00 , 0x20 , 0x40 , 0x40 , 0x40 , 0x40 , 0x20 , 0x00 defb 0x00 , 0x40 , 0x20 , 0x20 , 0x20 , 0x20 , 0x40 , 0x00 defb 0x00 , 0x00 , 0x90 , 0x60 , 0xF0 , 0x60 , 0x90 , 0x00 defb 0x00 , 0x00 , 0x20 , 0x20 , 0xF8 , 0x20 , 0x20 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x30 , 0x20 , 0x40 defb 0x00 , 0x00 , 0x00 , 0x00 , 0xF0 , 0x00 , 0x00 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x20 , 0x70 , 0x00 ; '.' ;defb 0x00 , 0x10 , 0x10 , 0x20 , 0x40 , 0x80 , 0x80 , 0x00 ; '/' defb 0x00 , 0x10 , 0x10 , 0x20 , 0x40 , 0x80 , 0x80 , 0x00 ; '/' defb 0x00 , 0x60 , 0x90 , 0xB0 , 0xD0 , 0x90 , 0x60 , 0x00 ; '0' defb 0x00 , 0x20 , 0x60 , 0x20 , 0x20 , 0x20 , 0x70 , 0x00 defb 0x00 , 0x60 , 0x90 , 0x10 , 0x60 , 0x80 , 0xF0 , 0x00 defb 0x00 , 0xF0 , 0x20 , 0x60 , 0x10 , 0x90 , 0x60 , 0x00 defb 0x00 , 0x20 , 0x60 , 0xA0 , 0xF0 , 0x20 , 0x20 , 0x00 defb 0x00 , 0xF0 , 0x80 , 0xE0 , 0x10 , 0x90 , 0x60 , 0x00 defb 0x00 , 0x60 , 0x80 , 0xE0 , 0x90 , 0x90 , 0x60 , 0x00 defb 0x00 , 0xF0 , 0x10 , 0x20 , 0x20 , 0x40 , 0x40 , 0x00 defb 0x00 , 0x60 , 0x90 , 0x60 , 0x90 , 0x90 , 0x60 , 0x00 defb 0x00 , 0x60 , 0x90 , 0x90 , 0x70 , 0x10 , 0x60 , 0x00 defb 0x00 , 0x00 , 0x60 , 0x60 , 0x00 , 0x60 , 0x60 , 0x00 defb 0x00 , 0x00 , 0x30 , 0x30 , 0x00 , 0x30 , 0x20 , 0x40 defb 0x00 , 0x10 , 0x20 , 0x40 , 0x40 , 0x20 , 0x10 , 0x00 defb 0x00 , 0x00 , 0x00 , 0xF0 , 0x00 , 0xF0 , 0x00 , 0x00 defb 0x00 , 0x40 , 0x20 , 0x10 , 0x10 , 0x20 , 0x40 , 0x00 defb 0x00 , 0x20 , 0x50 , 0x10 , 0x20 , 0x00 , 0x20 , 0x00 defb 0x30 , 0x48 , 0x98 , 0xA8 , 0xA8 , 0x90 , 0x40 , 0x30 defb 0x00 , 0x60 , 0x90 , 0x90 , 0xF0 , 0x90 , 0x90 , 0x00 defb 0x00 , 0xE0 , 0x90 , 0xE0 , 0x90 , 0x90 , 0xE0 , 0x00 defb 0x00 , 0x60 , 0x90 , 0x80 , 0x80 , 0x90 , 0x60 , 0x00 defb 0x00 , 0xE0 , 0x90 , 0x90 , 0x90 , 0x90 , 0xE0 , 0x00 defb 0x00 , 0xF0 , 0x80 , 0xE0 , 0x80 , 0x80 , 0xF0 , 0x00 defb 0x00 , 0xF0 , 0x80 , 0xE0 , 0x80 , 0x80 , 0x80 , 0x00 defb 0x00 , 0x60 , 0x90 , 0x80 , 0xB0 , 0x90 , 0x60 , 0x00 defb 0x00 , 0x90 , 0x90 , 0xF0 , 0x90 , 0x90 , 0x90 , 0x00 defb 0x00 , 0x70 , 0x20 , 0x20 , 0x20 , 0x20 , 0x70 , 0x00 defb 0x00 , 0x70 , 0x20 , 0x20 , 0x20 , 0xA0 , 0x40 , 0x00 defb 0x00 , 0x90 , 0xA0 , 0xC0 , 0xA0 , 0xA0 , 0x90 , 0x00 defb 0x00 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0xF0 , 0x00 defb 0x00 , 0x90 , 0xF0 , 0xF0 , 0x90 , 0x90 , 0x90 , 0x00 defb 0x00 , 0x90 , 0xD0 , 0xF0 , 0xB0 , 0xB0 , 0x90 , 0x00 defb 0x00 , 0x60 , 0x90 , 0x90 , 0x90 , 0x90 , 0x60 , 0x00 defb 0x00 , 0xE0 , 0x90 , 0x90 , 0xE0 , 0x80 , 0x80 , 0x00 defb 0x00 , 0x60 , 0x90 , 0x90 , 0xD0 , 0xB0 , 0x60 , 0x10 defb 0x00 , 0xE0 , 0x90 , 0x90 , 0xE0 , 0x90 , 0x90 , 0x00 defb 0x00 , 0x60 , 0x90 , 0x40 , 0x20 , 0x90 , 0x60 , 0x00 defb 0x00 , 0x70 , 0x20 , 0x20 , 0x20 , 0x20 , 0x20 , 0x00 defb 0x00 , 0x90 , 0x90 , 0x90 , 0x90 , 0x90 , 0x60 , 0x00 defb 0x00 , 0x90 , 0x90 , 0x90 , 0x90 , 0x60 , 0x60 , 0x00 defb 0x00 , 0x90 , 0x90 , 0x90 , 0xF0 , 0xF0 , 0x90 , 0x00 defb 0x00 , 0x90 , 0x90 , 0x60 , 0x60 , 0x90 , 0x90 , 0x00 defb 0x00 , 0x88 , 0x88 , 0x50 , 0x20 , 0x20 , 0x20 , 0x00 defb 0x00 , 0xF0 , 0x10 , 0x20 , 0x40 , 0x80 , 0xF0 , 0x00 defb 0x00 , 0x70 , 0x40 , 0x40 , 0x40 , 0x40 , 0x70 , 0x00 defb 0x00 , 0x80 , 0x80 , 0x40 , 0x20 , 0x10 , 0x10 , 0x00 ; '\' defb 0x00 , 0x70 , 0x10 , 0x10 , 0x10 , 0x10 , 0x70 , 0x00 defb 0x00 , 0x20 , 0x50 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xF0 ; '_' defb 0x00 , 0x40 , 0x20 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x70 , 0x90 , 0x90 , 0x70 , 0x00 defb 0x00 , 0x80 , 0x80 , 0xE0 , 0x90 , 0x90 , 0xE0 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x30 , 0x40 , 0x40 , 0x30 , 0x00 defb 0x00 , 0x10 , 0x10 , 0x70 , 0x90 , 0x90 , 0x70 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x60 , 0xB0 , 0xC0 , 0x60 , 0x00 defb 0x00 , 0x20 , 0x50 , 0x40 , 0xE0 , 0x40 , 0x40 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x60 , 0x90 , 0x70 , 0x10 , 0x60 defb 0x00 , 0x80 , 0x80 , 0xE0 , 0x90 , 0x90 , 0x90 , 0x00 defb 0x00 , 0x20 , 0x00 , 0x60 , 0x20 , 0x20 , 0x70 , 0x00 defb 0x00 , 0x10 , 0x00 , 0x10 , 0x10 , 0x10 , 0x50 , 0x20 defb 0x00 , 0x80 , 0x80 , 0x90 , 0xE0 , 0x90 , 0x90 , 0x00 defb 0x00 , 0x60 , 0x20 , 0x20 , 0x20 , 0x20 , 0x70 , 0x00 defb 0x00 , 0x00 , 0x00 , 0xD0 , 0xA8 , 0xA8 , 0xA8 , 0x00 defb 0x00 , 0x00 , 0x00 , 0xE0 , 0x90 , 0x90 , 0x90 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x60 , 0x90 , 0x90 , 0x60 , 0x00 defb 0x00 , 0x00 , 0x00 , 0xE0 , 0x90 , 0xE0 , 0x80 , 0x80 defb 0x00 , 0x00 , 0x00 , 0x70 , 0x90 , 0x70 , 0x10 , 0x10 defb 0x00 , 0x00 , 0x00 , 0xA0 , 0xD0 , 0x80 , 0x80 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x30 , 0x60 , 0x10 , 0x60 , 0x00 defb 0x00 , 0x40 , 0x40 , 0xE0 , 0x40 , 0x50 , 0x20 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x90 , 0x90 , 0x90 , 0x70 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x50 , 0x50 , 0x50 , 0x20 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x88 , 0xA8 , 0xA8 , 0x50 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x90 , 0x60 , 0x60 , 0x90 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x90 , 0x90 , 0x70 , 0x90 , 0x60 defb 0x00 , 0x00 , 0x00 , 0xF0 , 0x20 , 0x40 , 0xF0 , 0x00 defb 0x30 , 0x40 , 0x20 , 0xC0 , 0x20 , 0x40 , 0x30 , 0x00 defb 0x00 , 0x20 , 0x20 , 0x20 , 0x20 , 0x20 , 0x20 , 0x00 defb 0xC0 , 0x20 , 0x40 , 0x30 , 0x40 , 0x20 , 0xC0 , 0x00 defb 0x00 , 0x50 , 0xA0 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ELSE .font5 ; 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00, ; 0 defb 0xE0 , 0xE0 , 0xE0 , 0x00 , 0x00 , 0x00 , 0x00 defb 0x38 , 0x38 , 0x38 , 0x00 , 0x00 , 0x00 , 0x00 defb 0xF8 , 0xF8 , 0xF8 , 0x00 , 0x00 , 0x00 , 0x00 defb 0x00 , 0x00 , 0x00 , 0xE0 , 0xE0 , 0xE0 , 0xE0 defb 0xE0 , 0xE0 , 0xE0 , 0xE0 , 0xE0 , 0xE0 , 0xE0 defb 0x38 , 0x38 , 0x38 , 0xE0 , 0xE0 , 0xE0 , 0xE0 defb 0xF8 , 0xF8 , 0xF8 , 0xE0 , 0xE0 , 0xE0 , 0xE0 defb 0x50 , 0xA8 , 0x50 , 0xA8 , 0x50 , 0xA8 , 0x50 defb 0x00 , 0x00 , 0x00 , 0xA8 , 0x50 , 0xA8 , 0x50 defb 0x50 , 0xA8 , 0x50 , 0x00 , 0x00 , 0x00 , 0x00 ; 10 defb 0x50 , 0x50 , 0x50 , 0x00 , 0x00 , 0x00 , 0x00 defb 0x60 , 0x90 , 0xC0 , 0x80 , 0x80 , 0xF0 , 0x00 defb 0x20 , 0x70 , 0x40 , 0x70 , 0x10 , 0x70 , 0x20 defb 0x00 , 0x20 , 0x00 , 0x00 , 0x00 , 0x20 , 0x00 defb 0x20 , 0x50 , 0x10 , 0x20 , 0x00 , 0x20 , 0x00 defb 0x10 , 0x20 , 0x20 , 0x20 , 0x20 , 0x10 , 0x00 defb 0x40 , 0x20 , 0x20 , 0x20 , 0x20 , 0x40 , 0x00 defb 0x00 , 0x40 , 0x20 , 0x10 , 0x20 , 0x40 , 0x00 defb 0x00 , 0x10 , 0x20 , 0x40 , 0x20 , 0x10 , 0x00 defb 0x00 , 0x00 , 0x70 , 0x00 , 0x70 , 0x00 , 0x00 ; 20 defb 0x00 , 0x00 , 0x20 , 0x70 , 0x20 , 0x00 , 0x00 defb 0x00 , 0x00 , 0x00 , 0x70 , 0x00 , 0x00 , 0x00 defb 0x00 , 0x00 , 0x50 , 0x20 , 0x50 , 0x00 , 0x00 defb 0x10 , 0x10 , 0x20 , 0x20 , 0x40 , 0x40 , 0x00 defb 0x00 , 0x20 , 0x00 , 0x00 , 0x00 , 0x20 , 0x40 defb 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x20 , 0x40 defb 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x20 , 0x00 defb 0x60 , 0x90 , 0xB0 , 0xD0 , 0x90 , 0x60 , 0x00 ; '0' defb 0x20 , 0x60 , 0x20 , 0x20 , 0x20 , 0x70 , 0x00 defb 0x60 , 0x90 , 0x10 , 0x60 , 0x80 , 0xF0 , 0x00 ; 30 defb 0xE0 , 0x10 , 0x60 , 0x10 , 0x10 , 0xE0 , 0x00 defb 0x20 , 0x60 , 0xA0 , 0xA0 , 0xF0 , 0x20 , 0x00 defb 0xF0 , 0x80 , 0x60 , 0x10 , 0x90 , 0x60 , 0x00 defb 0x70 , 0x80 , 0xE0 , 0x90 , 0x90 , 0x60 , 0x00 defb 0xF0 , 0x10 , 0x20 , 0x20 , 0x40 , 0x40 , 0x00 defb 0x60 , 0x90 , 0x60 , 0x90 , 0x90 , 0x60 , 0x00 defb 0x60 , 0x90 , 0x90 , 0x70 , 0x10 , 0xE0 , 0x00 defb 0x60 , 0x90 , 0x90 , 0xF0 , 0x90 , 0x90 , 0x00 defb 0xE0 , 0x90 , 0xE0 , 0x90 , 0x90 , 0xE0 , 0x00 defb 0x60 , 0x90 , 0x80 , 0x80 , 0x90 , 0x60 , 0x00 ; 40 defb 0xC0 , 0xA0 , 0x90 , 0x90 , 0x90 , 0xE0 , 0x00 defb 0xF0 , 0x80 , 0xE0 , 0x80 , 0x80 , 0xF0 , 0x00 defb 0xF0 , 0x80 , 0xE0 , 0x80 , 0x80 , 0x80 , 0x00 defb 0x60 , 0x80 , 0x80 , 0xB0 , 0x90 , 0x60 , 0x00 defb 0x90 , 0x90 , 0xF0 , 0x90 , 0x90 , 0x90 , 0x00 defb 0x70 , 0x20 , 0x20 , 0x20 , 0x20 , 0x70 , 0x00 defb 0x30 , 0x10 , 0x10 , 0x10 , 0x90 , 0x60 , 0x00 defb 0x90 , 0xA0 , 0xC0 , 0xA0 , 0x90 , 0x90 , 0x00 defb 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0xF0 , 0x00 defb 0x88 , 0xD8 , 0xA8 , 0x88 , 0x88 , 0x88 , 0x00 ; 50 defb 0x90 , 0xD0 , 0xB0 , 0x90 , 0x90 , 0x90 , 0x00 defb 0x60 , 0x90 , 0x90 , 0x90 , 0x90 , 0x60 , 0x00 defb 0xE0 , 0x90 , 0x90 , 0xE0 , 0x80 , 0x80 , 0x00 defb 0x60 , 0x90 , 0x90 , 0x90 , 0xB0 , 0x70 , 0x00 defb 0xE0 , 0x90 , 0x90 , 0xE0 , 0x90 , 0x90 , 0x00 defb 0x60 , 0x80 , 0x60 , 0x10 , 0x10 , 0xE0 , 0x00 defb 0xF8 , 0x20 , 0x20 , 0x20 , 0x20 , 0x20 , 0x00 defb 0x90 , 0x90 , 0x90 , 0x90 , 0x90 , 0x60 , 0x00 defb 0x88 , 0x88 , 0x50 , 0x50 , 0x50 , 0x20 , 0x00 ; 'V' defb 0x88 , 0x88 , 0x88 , 0x88 , 0xA8 , 0x50 , 0x00 ; 60 defb 0x88 , 0x50 , 0x20 , 0x20 , 0x50 , 0x88 , 0x00 defb 0x90 , 0x90 , 0x50 , 0x20 , 0x40 , 0x80 , 0x00 defb 0xF0 , 0x10 , 0x20 , 0x40 , 0x80 , 0xF0 , 0x00 ; ENDIF SECTION data_clib .prbuf_x defb 0 SECTION bss_clib .buf defs 256
alloy4fun_models/trashltl/models/11/Dx7bLPd2upJsCdPPf.als
Kaixi26/org.alloytools.alloy
0
4886
open main pred idDx7bLPd2upJsCdPPf_prop12 { eventually all f:File |eventually f in Trash implies always f in Trash } pred __repair { idDx7bLPd2upJsCdPPf_prop12 } check __repair { idDx7bLPd2upJsCdPPf_prop12 <=> prop12o }
src/third_party/nasm/travis/test/br2003451.asm
Mr-Sheep/naiveproxy
2,219
94650
<reponame>Mr-Sheep/naiveproxy cpu 8086 org 0 ; MOV r/m16,imm16 ; (imm16 given as number) mov word [bx], 10h ; MOV r/m16,imm16 ; (imm16 given as label) mov word [bx], label align 10h ; This label is at address 10h label:
oeis/164/A164609.asm
neoneye/loda-programs
11
29273
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A164609: a(n) = 10*a(n-1) - 17*a(n-2) for n > 1; a(0) = 1, a(1) = 13. ; Submitted by <NAME> ; 1,13,113,909,7169,56237,440497,3448941,27000961,211377613,1654759793,12954178509,101410868609,793887651437,6214891748017,48652827405741,380875114341121,2981653077513613,23341653831337073,182728435995639309,1430476244823662849,11198379036310760237,87665694201105333937,686284498393770415341,5372528182518913476481,42058445352495037704013,329251474422128847939953,2577521173228872838431309,20177936667112537969333889,157961506726234541440006637,1236590143921432268921390257 mov $1,7 mov $3,1 lpb $0 sub $0,1 mov $2,$3 mul $2,7 mul $3,6 add $3,$1 mul $1,4 add $1,$2 lpe mov $0,$3
oeis/126/A126590.asm
neoneye/loda-programs
11
99033
; A126590: Multiples of 3 or 5 but not both. ; Submitted by <NAME> ; 3,5,6,9,10,12,18,20,21,24,25,27,33,35,36,39,40,42,48,50,51,54,55,57,63,65,66,69,70,72,78,80,81,84,85,87,93,95,96,99,100,102,108,110,111,114,115,117,123,125,126,129,130,132,138,140,141,144,145,147,153,155,156,159,160,162,168,170,171,174,175,177,183,185,186,189,190,192,198,200,201,204,205,207,213,215,216,219,220,222,228,230,231,234,235,237,243,245,246,249 mov $1,10 mul $1,$0 div $0,2 mod $0,3 mul $0,6 sub $1,$0 div $1,4 mov $0,$1 add $0,3
tests/testAssembler/testCases/prog7.asm
1sand0s/Lc3B-Assembler
0
162212
.ORIG x1000 ADD R1, R0, 1 ; 1 is an invalid operand (neither a register nor an immediate) .END
oeis/069/A069894.asm
neoneye/loda-programs
11
177843
; A069894: Centered square numbers: a(n) = 4*n^2 + 4*n + 2. ; 2,10,26,50,82,122,170,226,290,362,442,530,626,730,842,962,1090,1226,1370,1522,1682,1850,2026,2210,2402,2602,2810,3026,3250,3482,3722,3970,4226,4490,4762,5042,5330,5626,5930,6242,6562,6890,7226,7570,7922,8282,8650,9026,9410,9802,10202,10610,11026,11450,11882,12322,12770,13226,13690,14162,14642,15130,15626,16130,16642,17162,17690,18226,18770,19322,19882,20450,21026,21610,22202,22802,23410,24026,24650,25282,25922,26570,27226,27890,28562,29242,29930,30626,31330,32042,32762,33490,34226,34970,35722 add $0,1 bin $0,2 mul $0,8 add $0,2
pgada-thin.ads
io7m/coreland-postgres-ada
1
8091
<reponame>io7m/coreland-postgres-ada ------------------------------------------------------------------------------ -- -- -- P G A D A . T H I N -- -- -- -- S p e c -- -- -- -- Copyright (c) coreland 2009 -- -- Copyright (c) <NAME> 2000 -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of <NAME> 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 SAMUEL TARDIEU 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 SAMUEL -- -- TARDIEU 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 Interfaces.C.Strings; with Interfaces.C; package PGAda.Thin is pragma Preelaborate; package C renames Interfaces.C; package CS renames Interfaces.C.Strings; type Conn_Status_t is (CONNECTION_OK, CONNECTION_BAD); for Conn_Status_t'Size use C.int'Size; pragma Convention (C, Conn_Status_t); type Exec_Status_t is (PGRES_EMPTY_QUERY, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PGRES_COPY_OUT, PGRES_COPY_IN, PGRES_BAD_RESPONSE, PGRES_NONFATAL_ERROR, PGRES_FATAL_ERROR); for Exec_Status_t'Size use C.int'Size; pragma Convention (C, Exec_Status_t); type PG_Conn is null record; type PG_Conn_Access_t is access PG_Conn; pragma Convention (C, PG_Conn_Access_t); type PG_Result is null record; type PG_Result_Access_t is access PG_Result; pragma Convention (C, PG_Result_Access_t); type Oid is new C.unsigned; type Error_Field is (PG_DIAG_SQLSTATE, PG_DIAG_MESSAGE_DETAIL, PG_DIAG_SOURCE_FILE, PG_DIAG_MESSAGE_HINT, PG_DIAG_SOURCE_LINE, PG_DIAG_MESSAGE_PRIMARY, PG_DIAG_STATEMENT_POSITION, PG_DIAG_SOURCE_FUNCTION, PG_DIAG_SEVERITY, PG_DIAG_CONTEXT, PG_DIAG_INTERNAL_POSITION, PG_DIAG_INTERNAL_QUERY); for Error_Field use (PG_DIAG_SQLSTATE => 67, PG_DIAG_MESSAGE_DETAIL => 68, PG_DIAG_SOURCE_FILE => 70, PG_DIAG_MESSAGE_HINT => 72, PG_DIAG_SOURCE_LINE => 76, PG_DIAG_MESSAGE_PRIMARY => 77, PG_DIAG_STATEMENT_POSITION => 80, PG_DIAG_SOURCE_FUNCTION => 82, PG_DIAG_SEVERITY => 83, PG_DIAG_CONTEXT => 87, PG_DIAG_INTERNAL_POSITION => 112, PG_DIAG_INTERNAL_QUERY => 113); for Error_Field'Size use C.int'Size; function PQ_Set_Db_Login (PG_Host : CS.chars_ptr; PG_Port : CS.chars_ptr; PG_Options : CS.chars_ptr; PG_TTY : CS.chars_ptr; Db_Name : CS.chars_ptr; Login : CS.chars_ptr; Password : CS.chars_ptr) return PG_Conn_Access_t; pragma Import (C, PQ_Set_Db_Login, "PQsetdbLogin"); function PQ_Db (Conn : PG_Conn_Access_t) return CS.chars_ptr; pragma Import (C, PQ_Db, "PQdb"); function PQ_Host (Conn : PG_Conn_Access_t) return CS.chars_ptr; pragma Import (C, PQ_Host, "PQhost"); function PQ_Port (Conn : PG_Conn_Access_t) return CS.chars_ptr; pragma Import (C, PQ_Port, "PQport"); function PQ_Options (Conn : PG_Conn_Access_t) return CS.chars_ptr; pragma Import (C, PQ_Options, "PQoptions"); function PQ_Status (Conn : PG_Conn_Access_t) return Conn_Status_t; pragma Import (C, PQ_Status, "PQstatus"); function PQ_Error_Message (Conn : PG_Conn_Access_t) return CS.chars_ptr; pragma Import (C, PQ_Error_Message, "PQerrorMessage"); procedure PQ_Finish (Conn : in PG_Conn_Access_t); pragma Import (C, PQ_Finish, "PQfinish"); procedure PQ_Reset (Conn : in PG_Conn_Access_t); pragma Import (C, PQ_Reset, "PQreset"); function PQ_Exec (Conn : PG_Conn_Access_t; Query : CS.chars_ptr) return PG_Result_Access_t; pragma Import (C, PQ_Exec, "PQexec"); function PQ_Result_Status (Res : PG_Result_Access_t) return Exec_Status_t; pragma Import (C, PQ_Result_Status, "PQresultStatus"); function PQ_N_Tuples (Res : PG_Result_Access_t) return C.int; pragma Import (C, PQ_N_Tuples, "PQntuples"); function PQ_N_Fields (Res : PG_Result_Access_t) return C.int; pragma Import (C, PQ_N_Fields, "PQnfields"); function PQ_F_Name (Res : PG_Result_Access_t; Field_Index : C.int) return CS.chars_ptr; pragma Import (C, PQ_F_Name, "PQfname"); function PQ_F_Number (Res : PG_Result_Access_t; Field_Index : CS.chars_ptr) return C.int; pragma Import (C, PQ_F_Number, "PQfnumber"); function PQ_F_Type (Res : PG_Result_Access_t; Field_Index : C.int) return Oid; pragma Import (C, PQ_F_Type, "PQftype"); function PQ_Get_Value (Res : PG_Result_Access_t; Tup_Num : C.int; Field_Num : C.int) return CS.chars_ptr; pragma Import (C, PQ_Get_Value, "PQgetvalue"); function PQ_Get_Length (Res : PG_Result_Access_t; Tup_Num : C.int; Field_Num : C.int) return C.int; pragma Import (C, PQ_Get_Length, "PQgetlength"); function PQ_Get_Is_Null (Res : PG_Result_Access_t; Tup_Num : C.int; Field_Num : C.int) return C.int; pragma Import (C, PQ_Get_Is_Null, "PQgetisnull"); function PQ_Cmd_Tuples (Res : PG_Result_Access_t) return CS.chars_ptr; pragma Import (C, PQ_Cmd_Tuples, "PQcmdTuples"); function PQ_Cmd_Status (Res : PG_Result_Access_t) return CS.chars_ptr; pragma Import (C, PQ_Cmd_Status, "PQcmdStatus"); function PQ_Oid_Status (Res : PG_Result_Access_t) return CS.chars_ptr; pragma Import (C, PQ_Oid_Status, "PQoidStatus"); procedure PQ_Clear (Res : in PG_Result_Access_t); pragma Import (C, PQ_Clear, "PQclear"); function PQ_Result_Error_Field (Res : PG_Result_Access_t; Field : Error_Field) return CS.chars_ptr; pragma Import (C, PQ_Result_Error_Field, "PQresultErrorField"); end PGAda.Thin;
source/amf/uml/amf-uml-behaviors.ads
svn2github/matreshka
24
12677
<filename>source/amf/uml/amf-uml-behaviors.ads ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- Behavior is a specification of how its context classifier changes state -- over time. This specification may be either a definition of possible -- behavior execution or emergent behavior, or a selective illustration of an -- interesting subset of possible executions. The latter form is typically -- used for capturing examples, such as a trace of a particular execution. -- -- A behavior owns zero or more parameter sets. ------------------------------------------------------------------------------ limited with AMF.UML.Behavioral_Features; limited with AMF.UML.Behaviored_Classifiers; limited with AMF.UML.Behaviors.Collections; with AMF.UML.Classes; limited with AMF.UML.Constraints.Collections; limited with AMF.UML.Parameter_Sets.Collections; limited with AMF.UML.Parameters.Collections; package AMF.UML.Behaviors is pragma Preelaborate; type UML_Behavior is limited interface and AMF.UML.Classes.UML_Class; type UML_Behavior_Access is access all UML_Behavior'Class; for UML_Behavior_Access'Storage_Size use 0; not overriding function Get_Context (Self : not null access constant UML_Behavior) return AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier_Access is abstract; -- Getter of Behavior::context. -- -- The classifier that is the context for the execution of the behavior. -- If the behavior is owned by a BehavioredClassifier, that classifier is -- the context. Otherwise, the context is the first BehavioredClassifier -- reached by following the chain of owner relationships. For example, -- following this algorithm, the context of an entry action in a state -- machine is the classifier that owns the state machine. The features of -- the context classifier as well as the elements visible to the context -- classifier are visible to the behavior. not overriding function Get_Is_Reentrant (Self : not null access constant UML_Behavior) return Boolean is abstract; -- Getter of Behavior::isReentrant. -- -- Tells whether the behavior can be invoked while it is still executing -- from a previous invocation. not overriding procedure Set_Is_Reentrant (Self : not null access UML_Behavior; To : Boolean) is abstract; -- Setter of Behavior::isReentrant. -- -- Tells whether the behavior can be invoked while it is still executing -- from a previous invocation. not overriding function Get_Owned_Parameter (Self : not null access constant UML_Behavior) return AMF.UML.Parameters.Collections.Ordered_Set_Of_UML_Parameter is abstract; -- Getter of Behavior::ownedParameter. -- -- References a list of parameters to the behavior which describes the -- order and type of arguments that can be given when the behavior is -- invoked and of the values which will be returned when the behavior -- completes its execution. not overriding function Get_Owned_Parameter_Set (Self : not null access constant UML_Behavior) return AMF.UML.Parameter_Sets.Collections.Set_Of_UML_Parameter_Set is abstract; -- Getter of Behavior::ownedParameterSet. -- -- The ParameterSets owned by this Behavior. not overriding function Get_Postcondition (Self : not null access constant UML_Behavior) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is abstract; -- Getter of Behavior::postcondition. -- -- An optional set of Constraints specifying what is fulfilled after the -- execution of the behavior is completed, if its precondition was -- fulfilled before its invocation. not overriding function Get_Precondition (Self : not null access constant UML_Behavior) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is abstract; -- Getter of Behavior::precondition. -- -- An optional set of Constraints specifying what must be fulfilled when -- the behavior is invoked. not overriding function Get_Redefined_Behavior (Self : not null access constant UML_Behavior) return AMF.UML.Behaviors.Collections.Set_Of_UML_Behavior is abstract; -- Getter of Behavior::redefinedBehavior. -- -- References a behavior that this behavior redefines. A subtype of -- Behavior may redefine any other subtype of Behavior. If the behavior -- implements a behavioral feature, it replaces the redefined behavior. If -- the behavior is a classifier behavior, it extends the redefined -- behavior. not overriding function Get_Specification (Self : not null access constant UML_Behavior) return AMF.UML.Behavioral_Features.UML_Behavioral_Feature_Access is abstract; -- Getter of Behavior::specification. -- -- Designates a behavioral feature that the behavior implements. The -- behavioral feature must be owned by the classifier that owns the -- behavior or be inherited by it. The parameters of the behavioral -- feature and the implementing behavior must match. A behavior does not -- need to have a specification, in which case it either is the classifer -- behavior of a BehavioredClassifier or it can only be invoked by another -- behavior of the classifier. not overriding procedure Set_Specification (Self : not null access UML_Behavior; To : AMF.UML.Behavioral_Features.UML_Behavioral_Feature_Access) is abstract; -- Setter of Behavior::specification. -- -- Designates a behavioral feature that the behavior implements. The -- behavioral feature must be owned by the classifier that owns the -- behavior or be inherited by it. The parameters of the behavioral -- feature and the implementing behavior must match. A behavior does not -- need to have a specification, in which case it either is the classifer -- behavior of a BehavioredClassifier or it can only be invoked by another -- behavior of the classifier. not overriding function Context (Self : not null access constant UML_Behavior) return AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier_Access is abstract; -- Operation Behavior::context. -- -- Missing derivation for Behavior::/context : BehavioredClassifier end AMF.UML.Behaviors;
test/Fail/QualifiedRecordProjections.agda
dxts/agda2hs
55
8123
module Fail.QualifiedRecordProjections where record Test (a : Set) : Set where field one : a {-# COMPILE AGDA2HS Test #-}
asm_src/pce_test3/pce_test3.asm
yhzmr442/jspce
9
26566
;VRAM ;0000-03FF BG0 1KWORD ;0400-07FF BG1 1KWORD ;0800-0FFF 2KWORD SPCHR SATB ;1000-1FFF CHR 4KWORD 0-255CHR ;2000-37FF CHRBG 6KWORD 32*12CHR(256*192 2bpp*2) ;3800-3FFF ;4000-57FF CHRBG 6KWORD 32*12CHR(256*192 2bpp*2) ;5800-7FFF ;MEMORY ;0000 I/O ;2000 RAM ;4000 mul data : div data ;6000 ;8000 ;A000 main ;C000 wireframe process ;E000 irq mul div ;////////////////////////////////// CHRBG0Addr .equ $20 CHRBG1Addr .equ $40 chardatBank .equ 3 muldatBank .equ 4 divdatBank .equ 20 VDC_0 .equ $0000 VDC_1 .equ $0001 VDC_2 .equ $0002 VDC_3 .equ $0003 VDC1_0 .equ VDC_0 VDC1_1 .equ VDC_1 VDC1_2 .equ VDC_2 VDC1_3 .equ VDC_3 VDC2_0 .equ $0010 VDC2_1 .equ $0011 VDC2_2 .equ $0012 VDC2_3 .equ $0013 VPC_0 .equ $0008 VPC_1 .equ $0009 VPC_2 .equ $000A VPC_3 .equ $000B VPC_4 .equ $000C VPC_5 .equ $000D VPC_6 .equ $000E VPC_7 .equ $000F VCE_0 .equ $0400 VCE_1 .equ $0401 VCE_2 .equ $0402 VCE_3 .equ $0403 VCE_4 .equ $0404 VCE_5 .equ $0405 VCE_6 .equ $0406 VCE_7 .equ $0407 INT_DIS_REG .equ $1402 IO_PAD .equ $1000 ;////////////////////////////////// ;---------------------------- jcc .macro bcs .jp\@ jmp \1 .jp\@ .endm ;---------------------------- jcs .macro bcc .jp\@ jmp \1 .jp\@ .endm ;---------------------------- jeq .macro bne .jp\@ jmp \1 .jp\@ .endm ;---------------------------- jne .macro beq .jp\@ jmp \1 .jp\@ .endm ;---------------------------- jpl .macro bmi .jp\@ jmp \1 .jp\@ .endm ;---------------------------- jmi .macro bpl .jp\@ jmp \1 .jp\@ .endm ;---------------------------- add .macro ;\1 = \2 + \3 ;\1 = \1 + \2 .if (\# = 3) clc lda \2 adc \3 sta \1 .else clc lda \1 adc \2 sta \1 .endif .endm ;---------------------------- sub .macro ;\1 = \2 - \3 ;\1 = \1 - \2 .if (\# = 3) sec lda \2 sbc \3 sta \1 .else sec lda \1 sbc \2 sta \1 .endif .endm ;---------------------------- addw .macro ;\1 = \2 + \3 ;\1 = \1 + \2 .if (\# = 3) .if (\?3 = 2);Immediate clc lda \2 adc #LOW(\3) sta \1 lda \2+1 adc #HIGH(\3) sta \1+1 .else clc lda \2 adc \3 sta \1 lda \2+1 adc \3+1 sta \1+1 .endif .else .if (\?2 = 2);Immediate clc lda \1 adc #LOW(\2) sta \1 lda \1+1 adc #HIGH(\2) sta \1+1 .else clc lda \1 adc \2 sta \1 lda \1+1 adc \2+1 sta \1+1 .endif .endif .endm ;---------------------------- addwb .macro ;\1(word) = \1(word) + \2(byte) clc lda \1 adc \2 sta \1 bcc .jp0\@ inc \1+1 .jp0\@ .endm ;---------------------------- subw .macro ;\1 = \2 - \3 ;\1 = \1 - \2 .if (\# = 3) .if (\?3 = 2);Immediate sec lda \2 sbc #LOW(\3) sta \1 lda \2+1 sbc #HIGH(\3) sta \1+1 .else .if (\?2 = 2);Immediate sec lda #LOW(\2) sbc \3 sta \1 lda #HIGH(\2) sbc \3+1 sta \1+1 .else sec lda \2 sbc \3 sta \1 lda \2+1 sbc \3+1 sta \1+1 .endif .endif .else .if (\?2 = 2);Immediate sec lda \1 sbc #LOW(\2) sta \1 lda \1+1 sbc #HIGH(\2) sta \1+1 .else sec lda \1 sbc \2 sta \1 lda \1+1 sbc \2+1 sta \1+1 .endif .endif .endm ;---------------------------- addq .macro ;\1 = \2 + \3 ;\1 = \1 + \2 .if (\# = 3) clc lda \2 adc \3 sta \1 lda \2+1 adc \3+1 sta \1+1 lda \2+2 adc \3+2 sta \1+2 lda \2+3 adc \3+3 sta \1+3 .else clc lda \1 adc \2 sta \1 lda \1+1 adc \2+1 sta \1+1 lda \1+2 adc \2+2 sta \1+2 lda \1+3 adc \2+3 sta \1+3 .endif .endm ;---------------------------- subq .macro ;\1 = \2 - \3 ;\1 = \1 - \2 .if (\# = 3) sec lda \2 sbc \3 sta \1 lda \2+1 sbc \3+1 sta \1+1 lda \2+2 sbc \3+2 sta \1+2 lda \2+3 sbc \3+3 sta \1+3 .else sec lda \1 sbc \2 sta \1 lda \1+1 sbc \2+1 sta \1+1 lda \1+2 sbc \2+2 sta \1+2 lda \1+3 sbc \2+3 sta \1+3 .endif .endm ;---------------------------- mov .macro ;\1 = \2 lda \2 sta \1 .endm ;---------------------------- movw .macro ;\1 = \2 .if (\?2 = 2);Immediate lda #LOW(\2) sta \1 lda #HIGH(\2) sta \1+1 .else lda \2 sta \1 lda \2+1 sta \1+1 .endif .endm ;---------------------------- movq .macro ;\1 = \2 ;\1 = \2:\3 .if (\?2 = 2);Immediate lda #LOW(\3) sta \1 lda #HIGH(\3) sta \1+1 lda #LOW(\2) sta \1+2 lda #HIGH(\2) sta \1+3 .else lda \2 sta \1 lda \2+1 sta \1+1 lda \2+2 sta \1+2 lda \2+3 sta \1+3 .endif .endm ;---------------------------- stzw .macro ;\1 = 0 stz \1 stz \1+1 .endm ;---------------------------- stzq .macro ;\1 = 0 stz \1 stz \1+1 stz \1+2 stz \1+3 .endm ;---------------------------- cmpw .macro ;\1 - \2 .if (\?2 = 2);Immediate sec lda \1 sbc #LOW(\2) lda \1+1 sbc #HIGH(\2) .else sec lda \1 sbc \2 lda \1+1 sbc \2+1 .endif .endm ;---------------------------- cmpzw .macro ;\1 - \2 phx tsx pha .if (\?2 = 2);Immediate sec lda \1 sbc #LOW(\2) sta $2100, x lda \1+1 sbc #HIGH(\2) .else sec lda \1 sbc \2 sta $2100, x lda \1+1 sbc \2+1 .endif php ora $2100, x bne .jp0\@ pla ora #$02 bra .jp1\@ .jp0\@ pla and #$FD .jp1\@ txs plx pha plp .endm ;---------------------------- cmpq .macro ;\1 - \2 ;\1 - \2:\3 .if (\?2 = 2);Immediate sec lda \1 sbc #LOW(\3) lda \1+1 sbc #HIGH(\3) lda \1+2 sbc #LOW(\2) lda \1+3 sbc #HIGH(\2) .else sec lda \1 sbc \2 lda \1+1 sbc \2+1 lda \1+2 sbc \2+2 lda \1+3 sbc \2+3 .endif .endm ;---------------------------- cmpzq .macro ;\1 - \2 ;\1 - \2:\3 phx tsx pha .if (\?2 = 2);Immediate sec lda \1 sbc #LOW(\3) sta $2100, x lda \1+1 sbc #HIGH(\3) ora $2100, x sta $2100, x lda \1+2 sbc #LOW(\2) ora $2100, x sta $2100, x lda \1+3 sbc #HIGH(\2) .else sec lda \1 sbc \2 sta $2100, x lda \1+1 sbc \2+1 ora $2100, x sta $2100, x lda \1+2 sbc \2+2 ora $2100, x sta $2100, x lda \1+3 sbc \2+3 .endif php ora $2100, x bne .jp0\@ pla ora #$02 bra .jp1\@ .jp0\@ pla and #$FD .jp1\@ txs plx pha plp .endm ;////////////////////////////////// SCREENZ .equ 128 ROTATIONXYZ .equ %00100100;ZYX ROTATIONXZY .equ %00011000;YZX ROTATIONYXZ .equ %00100001;ZXY ROTATIONYZX .equ %00001001;XZY ROTATIONZXY .equ %00010010;YXZ ROTATIONZYX .equ %00000110;XYZ ;////////////////////////////////// .zp ;********************************** .org $2000 ;--------------------- div64ans mul16a div16a .ds 2 mul16b div16b .ds 2 div64a mul16c div16c .ds 2 mul16d div16d .ds 2 .ds 4 div64b mul32a div32ans .ds 2 div32work .ds 2 mul32b .ds 4 mul32work div64work .ds 8 sqrt64a .ds 8 sqrt64ans sqrt64b .ds 8 muladdr .ds 2 mulbank .ds 1 ;--------------------- ;LDRU RSBA padlast .ds 1 padnow .ds 1 padstate .ds 1 ;--------------------- puthexaddr .ds 2 puthexdata .ds 1 ;--------------------- randomseed .ds 2 ;--------------------- clearBGWork .ds 2 CH0 .ds 1 CH1 .ds 1 CH0Work .ds 1 CH1Work .ds 1 getVramChrAddr .ds 2 setVramChrAddr .ds 2 CH0Data .ds 1 CH1Data .ds 1 CHMask .ds 1 CHNegMask .ds 1 ;--------------------- edgeX0 .ds 1 edgeY0 .ds 1 edgeX1 .ds 1 edgeY1 .ds 1 edgeSlopeX .ds 2 edgeSlopeY .ds 2 edgeSignX .ds 1 ;--------------------- lineX0 .ds 2 lineY0 .ds 2 lineX1 .ds 2 lineY1 .ds 2 clip2DFlag .ds 1 ;--------------------- wireBGAddr .ds 1 wireLineX0 .ds 1 wireLineX1 .ds 1 wireLineY .ds 1 wireLineLeftAddr .ds 2 wireLineRightAddr .ds 2 wireLineLeftData .ds 1 wireLineLeftMask .ds 1 wireLineRightData .ds 1 wireLineRightMask .ds 1 wireLineCount .ds 1 ;--------------------- vertexCount .ds 1 vertexCountWork .ds 1 vertex0Addr .ds 2 vertex1Addr .ds 2 vertexWork .ds 4 translationX .ds 2 translationY .ds 2 translationZ .ds 2 centerX .ds 2 centerY .ds 2 ;--------------------- modelAddr .ds 2 modelAddrWork .ds 2 modelWireCount .ds 1 ;--------------------- rotationX .ds 1 rotationY .ds 1 rotationZ .ds 1 ;--------------------- frontClipFlag .ds 1 drawModelData0 .ds 1 drawModelData1 .ds 1 clipFrontX .ds 2 clipFrontY .ds 2 ;--------------------- rotationSelect .ds 1 ;--------------------- clearVramDmaAddr .ds 1 clearVramCount .ds 1 clearVramFlag .ds 1 ;--------------------- eyeTranslationX .ds 2 eyeTranslationY .ds 2 eyeTranslationZ .ds 2 eyeRotationX .ds 1 eyeRotationY .ds 1 eyeRotationZ .ds 1 eyeRotationSelect .ds 1 ;--------------------- lineColor .ds 1 lineBufferCount .ds 1 lineBufferAddr .ds 2 ;--------------------- drawFlag .ds 1 ;--------------------- vdcStatus .ds 1 ;===================== ;--------------------- objRegTable_AddrWork .ds 2 ;////////////////////////////////// .bss ;********************************** .org $2100 ;********************************** .org $2200 ;--------------------- matrix0 .ds 2*3*3 matrix1 .ds 2*3*3 matrix2 .ds 2*3*3 ;--------------------- eyeMatrix .ds 2*3*3 ;--------------------- unitVectorX0 .ds 2 unitVectorY0 .ds 2 unitVectorZ0 .ds 2 unitVectorX unitVectorX1 .ds 2 .ds 2 unitVectorY unitVectorY1 .ds 2 .ds 2 unitVectorZ unitVectorZ1 .ds 2 .ds 2 unitVectorWork .ds 4 ;--------------------- transform2DWork0 .ds 256 transform2DWork1 .ds 256 ;--------------------- .rsset $0 LINEBUFFER_X0 .rs 1 LINEBUFFER_Y0 .rs 1 LINEBUFFER_X1 .rs 1 LINEBUFFER_Y1 .rs 1 LINEBUFFER_COLOR .rs 1 LINEBUFFER_SIZE .rs 0 LINEBUFFER_MAX .equ 200 lineBuffer .ds LINEBUFFER_SIZE*LINEBUFFER_MAX ;--------------------- .rsset $0 MODELDATA_WIREADDR .rs 2 MODELDATA_WIRECOUNT .rs 1 MODELDATA_VERTEXADDR .rs 2 MODELDATA_VERTEXCOUNT .rs 1 MODELDATA_SIZE .rs 0 ;--------------------- .rsset $0 MODELDATAWIRE_0 .rs 1 MODELDATAWIRE_1 .rs 1 MODELDATAWIRE_SIZE .rs 0 ;--------------------- .rsset $0 MODELDATAVERTEX_X .rs 2 MODELDATAVERTEX_Y .rs 2 MODELDATAVERTEX_Z .rs 2 MODELDATAVERTEX_SIZE .rs 0 ;--------------------- ;--------------------- shipTranslationX .ds 2 shipTranslationY .ds 2 shipTranslationZ .ds 2 shipRotationX .ds 1 shipRotationY .ds 1 shipRotationZ .ds 1 ;--------------------- angleX0 .ds 2 angleX1 .ds 2 angleY0 .ds 2 angleY1 .ds 2 angleZ0 .ds 2 angleZ1 .ds 2 ansAngleX .ds 1 ansAngleY .ds 1 angleShift .ds 2 ;--------------------- shipShiftX .ds 2 shipShiftY .ds 2 ;--------------------- .rsset $0 OBJ_NO .rs 1 OBJ_COLOR .rs 1 OBJ_X .rs 4 OBJ_Y .rs 4 OBJ_Z .rs 4 OBJ_RX .rs 1 OBJ_RY .rs 1 OBJ_RZ .rs 1 OBJ_STATE .rs 1 OBJ_SIZE .rs 0 ;--------------------- .rsset OBJ_SIZE ESHOT_SHIFTX .rs 4 ESHOT_SHIFTY .rs 4 ESHOT_SHIFTZ .rs 4 ESHOT_SIZE .rs 0 ESHOT_MAX .equ 8 ESHOTTABLE_SIZE .equ ESHOT_SIZE*ESHOT_MAX OBJ_NO_ESHOT .equ 4 ESHOT_SHIFT .equ $0030 eshotTable .ds ESHOTTABLE_SIZE eshot_X .ds 2 eshot_Y .ds 2 eshot_Z .ds 2 ;--------------------- .rsset OBJ_SIZE SHOT_SIZE .rs 0 SHOT_MAX .equ 4 SHOTTABLE_SIZE .equ SHOT_SIZE*SHOT_MAX SHOT_Z_SHIFT .equ $0100 SHOT_Z_MAX .equ $10 OBJ_NO_SHOT .equ 2 shotTable .ds SHOTTABLE_SIZE ;--------------------- .rsset OBJ_SIZE ENEMY_TIME .rs 1 ENEMY_SIZE .rs 0 ENEMY_MAX .equ 8 ENEMYTABLE_SIZE .equ ENEMY_SIZE*ENEMY_MAX OBJ_NO_ENEMY0 .equ 6 ENEMY0_Z_SHIFT .equ $FFF0 enemyTable .ds ENEMYTABLE_SIZE enemy_X .ds 2 enemy_Y .ds 2 enemy_Z .ds 2 ;--------------------- .rsset OBJ_SIZE EFFECT_TYPE .rs 1 EFFECT_TIME .rs 1 EFFECT_SIZE .rs 0 EFFECT_MAX .equ 8 EFFECTTABLE_SIZE .equ EFFECT_SIZE*EFFECT_MAX OBJ_NO_EFFECT0 .equ 8 OBJ_NO_EFFECT1 .equ 24 EFFECT_TYPE_0 .equ 0 EFFECT_TYPE_1 .equ 1 effectTable .ds EFFECTTABLE_SIZE effect_X .ds 2 effect_Y .ds 2 effect_Z .ds 2 effect_Type .ds 1 ;--------------------- .rsset $0 OBJREG_ADDR .rs 2 OBJREG_Z .rs 2 OBJREG_SIZE .rs 0 objRegTable .ds OBJREG_SIZE*64 objRegTable_index .ds 1 objReg_AddrWork .ds 2 objReg_ZWork .ds 2 ;--------------------- .rsset $0 STAR_X .rs 2 STAR_Y .rs 2 STAR_Z .rs 2 STAR_Z_SHIFT .rs 2 STAR_STRUCT_SIZE .rs 0 STAR_MAX .equ 8 STARTABLE_SIZE .equ STAR_STRUCT_SIZE*STAR_MAX starTable .ds STARTABLE_SIZE starShiftX .ds 2 starShiftY .ds 2 ;--------------------- .rsset $0 SPRITE_Y .rs 2 SPRITE_X .rs 2 SPRITE_NO .rs 2 SPRITE_ATTR .rs 2 SPRITE_STRUCT_SIZE .rs 0 SPRITE_STAR_SIZE .equ SPRITE_STRUCT_SIZE*STAR_MAX spriteAttrTable sprite0 .ds SPRITE_STRUCT_SIZE spriteStar .ds SPRITE_STAR_SIZE .ds 512-SPRITE_STRUCT_SIZE-SPRITE_STAR_SIZE ;--------------------- hitCheckX0 .ds 2 hitCheckY0 .ds 2 hitCheckZ0 .ds 2 hitCheckX1 .ds 2 hitCheckY1 .ds 2 hitCheckZ1 .ds 2 ;--------------------- enemyTimer .ds 1 ;--------------------- frameCount .ds 1 drawCount .ds 1 drawCountWork .ds 1 ;////////////////////////////////// .code ;********************************** .bank 0 .org $E000 ;---------------------------- sdiv32: ;div16a div16b = div16d:div16c / div16a ;d sign lda <div16d+1 pha ;d eor a sign eor <div16a+1 pha ;d sign bbr7 <div16d+1, .sdiv32jp00 ;d neg sec cla sbc <div16c sta <div16c cla sbc <div16c+1 sta <div16c+1 cla sbc <div16d sta <div16d cla sbc <div16d+1 sta <div16d+1 .sdiv32jp00: ;a sign bbr7 <div16a+1, .sdiv32jp01 ;a neg sec cla sbc <div16a sta <div16a cla sbc <div16a+1 sta <div16a+1 .sdiv32jp01: jsr udiv32_2 ;anser sign pla bpl .sdiv32jp02 ;anser neg sec cla sbc <div16a sta <div16a cla sbc <div16a+1 sta <div16a+1 .sdiv32jp02: ;remainder sign pla bpl .sdiv32jp03 ;remainder neg sec cla sbc <div16b sta <div16b cla sbc <div16b+1 sta <div16b+1 .sdiv32jp03: rts ;---------------------------- udiv32: ;div16a div16b = div16d:div16c / div16a ;push x y phx phy ;div16a to div16b lda <div16a sta <div16b lda <div16a+1 sta <div16b+1 ;set zero div16a stz <div16a stz <div16a+1 ;set count ldx #16 .udivloop: ;right shift div16b:div16a lsr <div16b+1 ror <div16b ror <div16a+1 ror <div16a ;div16d:div16c - div16b:div16a = a:y:div32work sec lda <div16c sbc <div16a sta <div32work lda <div16c+1 sbc <div16a+1 sta <div32work+1 lda <div16d sbc <div16b tay lda <div16d+1 sbc <div16b+1 ;check div16d:div16c >= div16b:div16a bcc .udivjump rol <div32ans rol <div32ans+1 ;div16d:div16c = a:y:div32work sty <div16d sta <div16d+1 lda <div32work sta <div16c lda <div32work+1 sta <div16c+1 dex bne .udivloop bra .udivjump01 .udivjump: rol <div32ans rol <div32ans+1 ;decrement x dex bne .udivloop .udivjump01: ;div32ans to div16a lda <div32ans sta <div16a lda <div32ans+1 sta <div16a+1 ;div16c to div16b lda <div16c sta <div16b lda <div16c+1 sta <div16b+1 ;pull y x ply plx rts ;---------------------------- udiv32_2: ;div16a(0_32767) div16b = div16d:div16c(0_32767*32767) / div16a(1_32767) ;push x phx ;dec div16a lda <div16a bne .jp00 dec <div16a+1 .jp00: dec <div16a ldx #$10 asl <div16c rol <div16c+1 .jpPl00: ;div16d MSB 0 rol <div16d rol <div16d+1 lda <div16d sbc <div16a sta <div16d lda <div16d+1 sbc <div16a+1 sta <div16d+1 bmi .jpMi01 .jpPl01: rol <div16c rol <div16c+1 dex bne .jpPl00 lda <div16c sta <div16a lda <div16c+1 sta <div16a+1 lda <div16d sta <div16b lda <div16d+1 sta <div16b+1 ;pull x plx rts .jpMi00: ;div16d MSB 1 rol <div16d rol <div16d+1 lda <div16d adc <div16a sta <div16d lda <div16d+1 adc <div16a+1 sta <div16d+1 bpl .jpPl01 .jpMi01: rol <div16c rol <div16c+1 dex bne .jpMi00 sec lda <div16d adc <div16a sta <div16b lda <div16d+1 adc <div16a+1 sta <div16b+1 lda <div16c sta <div16a lda <div16c+1 sta <div16a+1 ;pull x plx rts ;---------------------------- sqrt64: ;sqrt64ans = sqrt(sqrt64a) ;push x phx bbr7 <sqrt64a+7, .sqrtjump3 lda #$FF sta <sqrt64b sta <sqrt64b+1 sta <sqrt64b+2 sta <sqrt64b+3 bra .sqrtjump0 .sqrtjump3: ;sqrt64a to sqrt64b lda <sqrt64a sta <sqrt64b lda <sqrt64a+1 sta <sqrt64b+1 lda <sqrt64a+2 sta <sqrt64b+2 lda <sqrt64a+3 sta <sqrt64b+3 lda <sqrt64a+4 sta <sqrt64b+4 lda <sqrt64a+5 sta <sqrt64b+5 lda <sqrt64a+6 sta <sqrt64b+6 lda <sqrt64a+7 sta <sqrt64b+7 .sqrtjump1: ;right shift sqrt64b lda <sqrt64b+4 ora <sqrt64b+5 ora <sqrt64b+6 ora <sqrt64b+7 beq .sqrtjump0 lsr <sqrt64b+7 ror <sqrt64b+6 ror <sqrt64b+5 ror <sqrt64b+4 ror <sqrt64b+3 ror <sqrt64b+2 ror <sqrt64b+1 ror <sqrt64b bra .sqrtjump1 .sqrtjump0: ;set loop counter ldx #32 .sqrtloop: ;sqrt64a to div64a lda <sqrt64a sta <div64a lda <sqrt64a+1 sta <div64a+1 lda <sqrt64a+2 sta <div64a+2 lda <sqrt64a+3 sta <div64a+3 lda <sqrt64a+4 sta <div64a+4 lda <sqrt64a+5 sta <div64a+5 lda <sqrt64a+6 sta <div64a+6 lda <sqrt64a+7 sta <div64a+7 ;sqrt64b to div16b:div16a lda <sqrt64b sta <div16a lda <sqrt64b+1 sta <div16a+1 lda <sqrt64b+2 sta <div16b lda <sqrt64b+3 sta <div16b+1 jsr udiv64 ;sqrt64b+4 = (sqrt64b + div16b:div16a) / 2 clc lda <sqrt64b adc <div16a sta <sqrt64b+4 lda <sqrt64b+1 adc <div16a+1 sta <sqrt64b+5 lda <sqrt64b+2 adc <div16b sta <sqrt64b+6 lda <sqrt64b+3 adc <div16b+1 sta <sqrt64b+7 ror <sqrt64b+7 ror <sqrt64b+6 ror <sqrt64b+5 ror <sqrt64b+4 ;compare sqrt64b and sqrt64b+4 lda <sqrt64b+3 cmp <sqrt64b+7 bne .sqrtjump2 lda <sqrt64b+2 cmp <sqrt64b+6 bne .sqrtjump2 lda <sqrt64b+1 cmp <sqrt64b+5 bne .sqrtjump2 lda <sqrt64b cmp <sqrt64b+4 beq .sqrtend .sqrtjump2: ;sqrt64b+4 to sqrt64b lda <sqrt64b+4 sta <sqrt64b lda <sqrt64b+5 sta <sqrt64b+1 lda <sqrt64b+6 sta <sqrt64b+2 lda <sqrt64b+7 sta <sqrt64b+3 ;check loop counter dex bne .sqrtloop .sqrtend: ;pull x plx rts ;---------------------------- sdiv64: ;div16b:div16a div16d:div16c = div64a / div16b:div16a ;64a sign lda <div64a+7 pha ;64a eor b:a sign eor <div16b+1 pha ;64a sign bbr7 <div64a+7, .sdiv64jp00 ;64a neg sec cla sbc <div64a sta <div64a cla sbc <div64a+1 sta <div64a+1 cla sbc <div64a+2 sta <div64a+2 cla sbc <div64a+3 sta <div64a+3 cla sbc <div64a+4 sta <div64a+4 cla sbc <div64a+5 sta <div64a+5 cla sbc <div64a+6 sta <div64a+6 cla sbc <div64a+7 sta <div64a+7 .sdiv64jp00: ;b:a sign bbr7 <div16b+1, .sdiv64jp01 ;b:a neg sec cla sbc <div16a sta <div16a cla sbc <div16a+1 sta <div16a+1 cla sbc <div16b sta <div16b cla sbc <div16b+1 sta <div16b+1 .sdiv64jp01: jsr udiv64 ;anser sign pla bpl .sdiv64jp02 ;anser neg sec cla sbc <div16a sta <div16a cla sbc <div16a+1 sta <div16a+1 cla sbc <div16b sta <div16b cla sbc <div16b+1 sta <div16b+1 .sdiv64jp02: ;remainder sign pla bpl .sdiv64jp03 ;remainder neg sec cla sbc <div16c sta <div16c cla sbc <div16c+1 sta <div16c+1 cla sbc <div16d sta <div16d cla sbc <div16d+1 sta <div16d+1 .sdiv64jp03: rts ;---------------------------- udiv64: ;div16b:div16a div16d:div16c = div64a / div16b:div16a ;push x phx ;div16b:div16a to div64b+4 lda <div16a sta <div64b+4 lda <div16a+1 sta <div64b+5 lda <div16b sta <div64b+6 lda <div16b+1 sta <div64b+7 ;set zero div64b stz <div64b stz <div64b+1 stz <div64b+2 stz <div64b+3 ;set count ldx #32 .udivloop: ;right shift div64b lsr <div64b+7 ror <div64b+6 ror <div64b+5 ror <div64b+4 ror <div64b+3 ror <div64b+2 ror <div64b+1 ror <div64b ;div64a - div64b = div64work sec lda <div64a sbc <div64b sta <div64work lda <div64a+1 sbc <div64b+1 sta <div64work+1 lda <div64a+2 sbc <div64b+2 sta <div64work+2 lda <div64a+3 sbc <div64b+3 sta <div64work+3 lda <div64a+4 sbc <div64b+4 sta <div64work+4 lda <div64a+5 sbc <div64b+5 sta <div64work+5 lda <div64a+6 sbc <div64b+6 sta <div64work+6 lda <div64a+7 sbc <div64b+7 sta <div64work+7 ;check div64a >= div64b bcc .udivjump rol <div64ans rol <div64ans+1 rol <div64ans+2 rol <div64ans+3 ;div64a = div64work lda <div64work sta <div64a lda <div64work+1 sta <div64a+1 lda <div64work+2 sta <div64a+2 lda <div64work+3 sta <div64a+3 lda <div64work+4 sta <div64a+4 lda <div64work+5 sta <div64a+5 lda <div64work+6 sta <div64a+6 lda <div64work+7 sta <div64a+7 ;decrement x dex bne .udivloop bra .udivjump01 .udivjump: rol <div64ans rol <div64ans+1 rol <div64ans+2 rol <div64ans+3 ;decrement x dex bne .udivloop .udivjump01: ;div64ans to div16b:div16a lda <div64ans sta <div16a lda <div64ans+1 sta <div16a+1 lda <div64ans+2 sta <div16b lda <div64ans+3 sta <div16b+1 ;div64a to div16d:div16c lda <div64a sta <div16c lda <div64a+1 sta <div16c+1 lda <div64a+2 sta <div16d lda <div64a+3 sta <div16d+1 ;pull x plx rts ;---------------------------- smul16: ;mul16d:mul16c = mul16a * mul16b ;a eor b sign lda <mul16a+1 eor <mul16b+1 pha ;a sign bbr7 <mul16a+1, .smul16jp00 ;a neg sec cla sbc <mul16a sta <mul16a cla sbc <mul16a+1 sta <mul16a+1 .smul16jp00: ;b sign bbr7 <mul16b+1, .smul16jp01 ;b neg sec cla sbc <mul16b sta <mul16b cla sbc <mul16b+1 sta <mul16b+1 .smul16jp01: jsr umul16 ;anser sign pla bpl .smul16jp02 ;anser neg sec cla sbc <mul16c sta <mul16c cla sbc <mul16c+1 sta <mul16c+1 cla sbc <mul16d sta <mul16d cla sbc <mul16d+1 sta <mul16d+1 .smul16jp02: rts ;---------------------------- umul16: ;mul16d:mul16c = mul16a * mul16b ;push y phy stz <muladdr ldy <mul16b lda umul16Bank, y sta <mulbank tam #$02 lda umul16Address, y sta <muladdr+1 ldy <mul16a lda [muladdr], y sta <mul16c ldy <mul16a+1 lda [muladdr], y sta <mul16c+1 clc lda <mulbank adc #8 ;carry clear tam #$02 ldy <mul16a lda [muladdr], y adc <mul16c+1 sta <mul16c+1 ldy <mul16a+1 lda [muladdr], y adc #0 ;carry clear sta <mul16d ldy <mul16b+1 lda umul16Bank, y sta <mulbank tam #$02 lda umul16Address, y sta <muladdr+1 ldy <mul16a lda [muladdr], y adc <mul16c+1 sta <mul16c+1 ldy <mul16a+1 lda [muladdr], y adc <mul16d sta <mul16d cla adc #0 ;carry clear sta <mul16d+1 lda <mulbank adc #8 ;carry clear tam #$02 ldy <mul16a lda [muladdr], y adc <mul16d sta <mul16d ldy <mul16a+1 lda [muladdr], y adc <mul16d+1 sta <mul16d+1 ;pull y ply rts ;---------------------------- smul32: ;mul16d:mul16c:mul16b:mul16a = mul16d:mul16c * mul16b:mul16a ;b eor d sign lda <mul16b+1 eor <mul16d+1 pha ;b sign bbr7 <mul16b+1, .smul32jp00 ;b neg sec cla sbc <mul16a sta <mul16a cla sbc <mul16a+1 sta <mul16a+1 cla sbc <mul16b sta <mul16b cla sbc <mul16b+1 sta <mul16b+1 .smul32jp00: ;d sign bbr7 <mul16d+1, .smul32jp01 ;d neg sec cla sbc <mul16c sta <mul16c cla sbc <mul16c+1 sta <mul16c+1 cla sbc <mul16d sta <mul16d cla sbc <mul16d+1 sta <mul16d+1 .smul32jp01: jsr umul32 ;anser sign pla bpl .smul32jp02 ;anser neg sec cla sbc <mul16a sta <mul16a cla sbc <mul16a+1 sta <mul16a+1 cla sbc <mul16b sta <mul16b cla sbc <mul16b+1 sta <mul16b+1 cla sbc <mul16c sta <mul16c cla sbc <mul16c+1 sta <mul16c+1 cla sbc <mul16d sta <mul16d cla sbc <mul16d+1 sta <mul16d+1 .smul32jp02: rts ;---------------------------- umul32: ;mul16d:mul16c:mul16b:mul16a = mul16d:mul16c * mul16b:mul16a lda <mul16a sta <mul32a lda <mul16a+1 sta <mul32a+1 lda <mul16b sta <mul32a+2 lda <mul16b+1 sta <mul32a+3 lda <mul16c sta <mul32b lda <mul16c+1 sta <mul32b+1 lda <mul16d sta <mul32b+2 lda <mul16d+1 sta <mul32b+3 ;mul16c * mul16a lda <mul32a sta <mul16a lda <mul32a+1 sta <mul16a+1 lda <mul32b sta <mul16b lda <mul32b+1 sta <mul16b+1 jsr umul16 lda <mul16c sta <mul32work lda <mul16c+1 sta <mul32work+1 lda <mul16d sta <mul32work+2 lda <mul16d+1 sta <mul32work+3 ;mul16d * mul16a lda <mul32a sta <mul16a lda <mul32a+1 sta <mul16a+1 lda <mul32b+2 sta <mul16b lda <mul32b+3 sta <mul16b+1 jsr umul16 clc lda <mul16c adc <mul32work+2 sta <mul32work+2 lda <mul16c+1 adc <mul32work+3 sta <mul32work+3 lda <mul16d adc #$00 sta <mul32work+4 lda <mul16d+1 adc #$00 sta <mul32work+5 ;mul16c * mul16b lda <mul32a+2 sta <mul16a lda <mul32a+3 sta <mul16a+1 lda <mul32b sta <mul16b lda <mul32b+1 sta <mul16b+1 jsr umul16 clc lda <mul16c adc <mul32work+2 sta <mul32work+2 lda <mul16c+1 adc <mul32work+3 sta <mul32work+3 lda <mul16d adc <mul32work+4 sta <mul32work+4 lda <mul16d+1 adc <mul32work+5 sta <mul32work+5 cla adc #$00 sta <mul32work+6 ;mul16d * mul16b lda <mul32a+2 sta <mul16a lda <mul32a+3 sta <mul16a+1 lda <mul32b+2 sta <mul16b lda <mul32b+3 sta <mul16b+1 jsr umul16 lda <mul32work sta <mul16a lda <mul32work+1 sta <mul16a+1 lda <mul32work+2 sta <mul16b lda <mul32work+3 sta <mul16b+1 clc lda <mul16c adc <mul32work+4 sta <mul16c lda <mul16c+1 adc <mul32work+5 sta <mul16c+1 lda <mul16d adc <mul32work+6 sta <mul16d lda <mul16d+1 adc #$00 sta <mul16d+1 rts ;---------------------------- initRandom: ; lda #$C0 sta randomseed sta randomseed+1 rts ;---------------------------- getRandom: ; lda randomseed+1 lsr a rol randomseed bcc .getrandomJump eor #$B4 .getrandomJump: sta randomseed+1 eor randomseed rts ;---------------------------- numtochar: ;in A Register $0 to $F ;out A Register '0'-'9'($30-$39) 'A'-'Z'($41-$5A) cmp #10 bcs .numtochar000 ora #$30 rts .numtochar000: adc #$41-10-1 rts ;---------------------------- getPadData: ; lda <padnow sta <padlast lda #$01 sta IO_PAD lda #$03 sta IO_PAD lda #$01 sta IO_PAD lda IO_PAD asl a asl a asl a asl a sta <padnow lda #$00 sta IO_PAD lda IO_PAD and #$0F ora <padnow eor #$FF sta <padnow lda <padlast eor #$FF and <padnow sta <padstate rts ;---------------------------- onScreen: ;on screen ;bg sp vsync ;+1 st0 #$05 st1 #$C8 st2 #$00 rts ;---------------------------- _irq1: ;IRQ1 interrupt process pha phx phy ;ACK interrupt lda VDC_0 sta <vdcStatus jsr mainIrqProc ply plx pla rti ;---------------------------- _reset: ;reset process ;disable interrupts sei ;select the 7.16 MHz clock csh ;clear the decimal flag cld ;initialize the stack pointer ldx #$FF txs ;I/O page0 lda #$FF tam #$00 ;RAM page1 lda #$F8 tam #$01 ;jump main lda #$01 tam #$05 jmp main ;---------------------------- _irq2: _timer: _nmi: ;IRQ2 TIMER NMI interrupt process rti ;---------------------------- umul16Bank .db $00+muldatBank, $00+muldatBank, $00+muldatBank, $00+muldatBank,\ $00+muldatBank, $00+muldatBank, $00+muldatBank, $00+muldatBank,\ $00+muldatBank, $00+muldatBank, $00+muldatBank, $00+muldatBank,\ $00+muldatBank, $00+muldatBank, $00+muldatBank, $00+muldatBank,\ $00+muldatBank, $00+muldatBank, $00+muldatBank, $00+muldatBank,\ $00+muldatBank, $00+muldatBank, $00+muldatBank, $00+muldatBank,\ $00+muldatBank, $00+muldatBank, $00+muldatBank, $00+muldatBank,\ $00+muldatBank, $00+muldatBank, $00+muldatBank, $00+muldatBank .db $01+muldatBank, $01+muldatBank, $01+muldatBank, $01+muldatBank,\ $01+muldatBank, $01+muldatBank, $01+muldatBank, $01+muldatBank,\ $01+muldatBank, $01+muldatBank, $01+muldatBank, $01+muldatBank,\ $01+muldatBank, $01+muldatBank, $01+muldatBank, $01+muldatBank,\ $01+muldatBank, $01+muldatBank, $01+muldatBank, $01+muldatBank,\ $01+muldatBank, $01+muldatBank, $01+muldatBank, $01+muldatBank,\ $01+muldatBank, $01+muldatBank, $01+muldatBank, $01+muldatBank,\ $01+muldatBank, $01+muldatBank, $01+muldatBank, $01+muldatBank .db $02+muldatBank, $02+muldatBank, $02+muldatBank, $02+muldatBank,\ $02+muldatBank, $02+muldatBank, $02+muldatBank, $02+muldatBank,\ $02+muldatBank, $02+muldatBank, $02+muldatBank, $02+muldatBank,\ $02+muldatBank, $02+muldatBank, $02+muldatBank, $02+muldatBank,\ $02+muldatBank, $02+muldatBank, $02+muldatBank, $02+muldatBank,\ $02+muldatBank, $02+muldatBank, $02+muldatBank, $02+muldatBank,\ $02+muldatBank, $02+muldatBank, $02+muldatBank, $02+muldatBank,\ $02+muldatBank, $02+muldatBank, $02+muldatBank, $02+muldatBank .db $03+muldatBank, $03+muldatBank, $03+muldatBank, $03+muldatBank,\ $03+muldatBank, $03+muldatBank, $03+muldatBank, $03+muldatBank,\ $03+muldatBank, $03+muldatBank, $03+muldatBank, $03+muldatBank,\ $03+muldatBank, $03+muldatBank, $03+muldatBank, $03+muldatBank,\ $03+muldatBank, $03+muldatBank, $03+muldatBank, $03+muldatBank,\ $03+muldatBank, $03+muldatBank, $03+muldatBank, $03+muldatBank,\ $03+muldatBank, $03+muldatBank, $03+muldatBank, $03+muldatBank,\ $03+muldatBank, $03+muldatBank, $03+muldatBank, $03+muldatBank .db $04+muldatBank, $04+muldatBank, $04+muldatBank, $04+muldatBank,\ $04+muldatBank, $04+muldatBank, $04+muldatBank, $04+muldatBank,\ $04+muldatBank, $04+muldatBank, $04+muldatBank, $04+muldatBank,\ $04+muldatBank, $04+muldatBank, $04+muldatBank, $04+muldatBank,\ $04+muldatBank, $04+muldatBank, $04+muldatBank, $04+muldatBank,\ $04+muldatBank, $04+muldatBank, $04+muldatBank, $04+muldatBank,\ $04+muldatBank, $04+muldatBank, $04+muldatBank, $04+muldatBank,\ $04+muldatBank, $04+muldatBank, $04+muldatBank, $04+muldatBank .db $05+muldatBank, $05+muldatBank, $05+muldatBank, $05+muldatBank,\ $05+muldatBank, $05+muldatBank, $05+muldatBank, $05+muldatBank,\ $05+muldatBank, $05+muldatBank, $05+muldatBank, $05+muldatBank,\ $05+muldatBank, $05+muldatBank, $05+muldatBank, $05+muldatBank,\ $05+muldatBank, $05+muldatBank, $05+muldatBank, $05+muldatBank,\ $05+muldatBank, $05+muldatBank, $05+muldatBank, $05+muldatBank,\ $05+muldatBank, $05+muldatBank, $05+muldatBank, $05+muldatBank,\ $05+muldatBank, $05+muldatBank, $05+muldatBank, $05+muldatBank .db $06+muldatBank, $06+muldatBank, $06+muldatBank, $06+muldatBank,\ $06+muldatBank, $06+muldatBank, $06+muldatBank, $06+muldatBank,\ $06+muldatBank, $06+muldatBank, $06+muldatBank, $06+muldatBank,\ $06+muldatBank, $06+muldatBank, $06+muldatBank, $06+muldatBank,\ $06+muldatBank, $06+muldatBank, $06+muldatBank, $06+muldatBank,\ $06+muldatBank, $06+muldatBank, $06+muldatBank, $06+muldatBank,\ $06+muldatBank, $06+muldatBank, $06+muldatBank, $06+muldatBank,\ $06+muldatBank, $06+muldatBank, $06+muldatBank, $06+muldatBank .db $07+muldatBank, $07+muldatBank, $07+muldatBank, $07+muldatBank,\ $07+muldatBank, $07+muldatBank, $07+muldatBank, $07+muldatBank,\ $07+muldatBank, $07+muldatBank, $07+muldatBank, $07+muldatBank,\ $07+muldatBank, $07+muldatBank, $07+muldatBank, $07+muldatBank,\ $07+muldatBank, $07+muldatBank, $07+muldatBank, $07+muldatBank,\ $07+muldatBank, $07+muldatBank, $07+muldatBank, $07+muldatBank,\ $07+muldatBank, $07+muldatBank, $07+muldatBank, $07+muldatBank,\ $07+muldatBank, $07+muldatBank, $07+muldatBank, $07+muldatBank ;---------------------------- umul16Address .db $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4A, $4B, $4C, $4D, $4E, $4F,\ $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $5A, $5B, $5C, $5D, $5E, $5F,\ $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4A, $4B, $4C, $4D, $4E, $4F,\ $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $5A, $5B, $5C, $5D, $5E, $5F,\ $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4A, $4B, $4C, $4D, $4E, $4F,\ $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $5A, $5B, $5C, $5D, $5E, $5F,\ $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4A, $4B, $4C, $4D, $4E, $4F,\ $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $5A, $5B, $5C, $5D, $5E, $5F,\ $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4A, $4B, $4C, $4D, $4E, $4F,\ $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $5A, $5B, $5C, $5D, $5E, $5F,\ $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4A, $4B, $4C, $4D, $4E, $4F,\ $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $5A, $5B, $5C, $5D, $5E, $5F,\ $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4A, $4B, $4C, $4D, $4E, $4F,\ $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $5A, $5B, $5C, $5D, $5E, $5F,\ $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4A, $4B, $4C, $4D, $4E, $4F,\ $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $5A, $5B, $5C, $5D, $5E, $5F ;---------------------------- ;interrupt vectors .org $FFF6 .dw _irq2 .dw _irq1 .dw _timer .dw _nmi .dw _reset ;********************************** .bank 1 .org $A000 ;---------------------------- main: mov frameCount, #60 stz drawCount stz drawCountWork ;initialize VDP jsr initializeVdp ;on Screen jsr onScreen ;set sprite data st0 #$00 st1 #$00 st2 #$08 st0 #$02 tia spriteSightsData, VDC_2, 128 tia spriteStarData, VDC_2, 128 ;initialize sprite table stz spriteAttrTable tii spriteAttrTable, spriteAttrTable+1, 511 movw spriteAttrTable+SPRITE_Y, #96-8+64 movw spriteAttrTable+SPRITE_X, #128-8+32 movw spriteAttrTable+SPRITE_NO, #$0040 movw spriteAttrTable+SPRITE_ATTR, #$0080 ;initialize random jsr initRandom ;set wire proc bank lda #$02 tam #$06 ;clearBG jsr clearBG ;initialize wire proc jsr initWire ;set screen center movw <centerX, #128 movw <centerY, #96 ;set eye position stzw <eyeTranslationX stzw <eyeTranslationY movw <eyeTranslationZ, #$FF00 ;set eye angle stz <eyeRotationX stz <eyeRotationY stz <eyeRotationZ ;set eye rotation order mov <eyeRotationSelect, #ROTATIONXYZ ;initialize ship data stzw shipTranslationX stzw shipTranslationY stzw shipTranslationZ stz shipRotationX stz shipRotationY stz shipRotationZ stzw shipShiftX stzw shipShiftY ;initialize jsr initShotTable jsr initEnemyTable jsr initEshotTable jsr initEffectTable jsr initStarTable stz enemyTimer ;interrupt enable cli .mainloop: jsr initLineBuffer jsr checkGamePad jsr setEnemy jsr moveShotTable jsr moveEnemyTable jsr moveEshotTable jsr moveEffectTable jsr checkShotEshot jsr checkShotEnemy jsr initObjRegTable jsr regShotTable jsr regEnemyTable jsr regEshotTable jsr regEffectTable ;set line buffer process movw <eyeTranslationX, shipTranslationX movw <eyeTranslationY, shipTranslationY movw <eyeTranslationZ, shipTranslationZ mov <eyeRotationX, shipRotationX mov <eyeRotationY, shipRotationY mov <eyeRotationZ, shipRotationZ jsr drawObjRegTable jsr moveStarTable jsr setStarSprite jsr clearVram ;draw process jsr putLineBuffer jsr setSpriteAttrTable lda drawCountWork ldx #2 ldy #24 jsr puthex jsr switchBG inc drawCount jmp .mainloop ;---------------------------- checkGamePad: ;check pad .checkPadUpDown: lda <padnow and #%01010000 bne .checkPadUp lda shipShiftY beq .checkPadUpDownEnd bmi .checkPadUpJump bra .checkPadDownJump .checkPadUp: bbr4 <padnow, .checkPadDown lda shipShiftY cmp #$40 bpl .checkPadUpDownEnd ;shipShiftY <= 63 .checkPadUpJump: clc adc #$08 sta shipShiftY lda shipShiftY+1 adc #$00 sta shipShiftY+1 bra .checkPadUpDownEnd .checkPadDown: bbr6 <padnow, .checkPadUpDown lda shipShiftY cmp #$C1 bmi .checkPadUpDownEnd ;shipShiftY >= -63 .checkPadDownJump: sec sbc #$08 sta shipShiftY lda shipShiftY+1 sbc #$00 sta shipShiftY+1 .checkPadUpDownEnd: addw shipTranslationY, shipShiftY .checkPadLeftRight: lda <padnow and #%10100000 bne .checkPadLeft lda shipShiftX beq .checkPadLeftRightEnd bmi .checkPadRightJump bra .checkPadLeftJump .checkPadLeft: bbr7 <padnow, .checkPadRight lda shipShiftX cmp #$C1 bmi .checkPadLeftRightEnd ;shipShiftX >= -63 .checkPadLeftJump: sec sbc #$08 sta shipShiftX lda shipShiftX+1 sbc #$00 sta shipShiftX+1 bra .checkPadLeftRightEnd .checkPadRight: bbr5 <padnow, .checkPadDown lda shipShiftX cmp #$40 bpl .checkPadLeftRightEnd ;shipShiftX <= 63 .checkPadRightJump: clc adc #$08 sta shipShiftX lda shipShiftX+1 adc #$00 sta shipShiftX+1 .checkPadLeftRightEnd: addw shipTranslationX, shipShiftX .checkPadRun: bbr3 <padnow, .checkPadSelect .checkPadSelect: bbr2 <padnow, .checkPadB .checkPadB: bbr1 <padnow, .checkPadA .checkPadA: bbr0 <padnow, .checkPadEnd jsr setShotTable .checkPadEnd: clc lda shipShiftX eor #$FF adc #$01 sta starShiftX lda shipShiftX+1 eor #$FF adc #$00 sta starShiftX+1 clc lda shipShiftY eor #$FF adc #$01 sta starShiftY lda shipShiftY+1 eor #$FF adc #$00 sta starShiftY+1 rts ;---------------------------- setSpriteAttrTable: ; sei st0 #$00 st1 #$00 st2 #$0F st0 #$02 tia spriteAttrTable, VDC_2, SPRITE_STRUCT_SIZE*(STAR_MAX+1) st0 #$13 st1 #$00 st2 #$0F cli rts ;---------------------------- setStarSprite ; phx phy clx cly .loop: lda starTable+STAR_X, x sta <mul16c lda starTable+STAR_X+1, x sta <mul16c+1 lda starTable+STAR_Z, x sta <mul16a lda starTable+STAR_Z+1, x sta <mul16a+1 jsr transform2DProc clc lda <mul16a adc <centerX sta spriteStar+SPRITE_X, y lda <mul16a+1 adc <centerX+1 sta spriteStar+SPRITE_X+1, y clc lda spriteStar+SPRITE_X, y adc #32-8 sta spriteStar+SPRITE_X, y lda spriteStar+SPRITE_X+1, y adc #0 sta spriteStar+SPRITE_X+1, y lda starTable+STAR_Y, x sta <mul16c lda starTable+STAR_Y+1, x sta <mul16c+1 lda starTable+STAR_Z, x sta <mul16a lda starTable+STAR_Z+1, x sta <mul16a+1 jsr transform2DProc sec lda <centerY sbc <mul16a sta spriteStar+SPRITE_Y, y lda <centerY+1 sbc <mul16a+1 sta spriteStar+SPRITE_Y+1, y clc lda spriteStar+SPRITE_Y, y adc #64-8 sta spriteStar+SPRITE_Y, y lda spriteStar+SPRITE_Y+1, y adc #0 sta spriteStar+SPRITE_Y+1, y sec lda spriteStar+SPRITE_Y, y sbc #192+64-8 lda spriteStar+SPRITE_Y+1, y sbc #0 bcc .jp00 lda #$FF sta spriteStar+SPRITE_Y+1, y .jp00: lda #$42 sta spriteStar+SPRITE_NO, y lda #$00 sta spriteStar+SPRITE_NO+1, y lda #$00 sta spriteStar+SPRITE_ATTR, y lda #$00 sta spriteStar+SPRITE_ATTR+1, y clc tya adc #SPRITE_STRUCT_SIZE tay clc txa adc #STAR_STRUCT_SIZE tax cpx #STARTABLE_SIZE jne .loop ply plx rts ;---------------------------- moveStarTable: ; phx clx .loop: clc lda starTable+STAR_X, x adc starShiftX sta starTable+STAR_X, x lda starTable+STAR_X+1, x adc starShiftX+1 sta starTable+STAR_X+1, x clc lda starTable+STAR_Y, x adc starShiftY sta starTable+STAR_Y, x lda starTable+STAR_Y+1, x adc starShiftY+1 sta starTable+STAR_Y+1, x sec lda starTable+STAR_Z, x sbc starTable+STAR_Z_SHIFT, x sta starTable+STAR_Z, x lda starTable+STAR_Z+1, x sbc starTable+STAR_Z_SHIFT+1, x sta starTable+STAR_Z+1, x bmi .jp00 bne .jp01 lda starTable+STAR_Z, x cmp #128 bcs .jp01 .jp00: jsr setStarTable .jp01: clc txa adc #STAR_STRUCT_SIZE tax cpx #STARTABLE_SIZE bne .loop plx rts ;---------------------------- initStarTable: ; phx clx .loop: jsr setStarTable clc txa adc #STAR_STRUCT_SIZE tax cpx #STARTABLE_SIZE bne .loop plx rts ;---------------------------- setStarTable: ; jsr getRandom sta starTable+STAR_X, x jsr getRandom cmp #$00 bmi .jp00 and #$03 bra .jp01 .jp00: ora #$FC .jp01: sta starTable+STAR_X+1, x jsr getRandom sta starTable+STAR_Y, x jsr getRandom cmp #$00 bmi .jp02 and #$03 bra .jp03 .jp02: ora #$FC .jp03: sta starTable+STAR_Y+1, x lda #$00 sta starTable+STAR_Z, x lda #$10 sta starTable+STAR_Z+1, x jsr getRandom and #$7F ora #$20 sta starTable+STAR_Z_SHIFT, x lda #$00 sta starTable+STAR_Z_SHIFT+1, x rts ;---------------------------- checkShotEnemy: ; phx phy clx .shotLoop: lda shotTable+OBJ_STATE, x jeq .shotJump0 sec lda shotTable+OBJ_X+2, x sbc #200 sta hitCheckX0 lda shotTable+OBJ_X+3, x sbc #0 sta hitCheckX0+1 clc lda shotTable+OBJ_X+2, x adc #200 sta hitCheckX1 lda shotTable+OBJ_X+3, x adc #0 sta hitCheckX1+1 sec lda shotTable+OBJ_Y+2, x sbc #200 sta hitCheckY0 lda shotTable+OBJ_Y+3, x sbc #0 sta hitCheckY0+1 clc lda shotTable+OBJ_Y+2, x adc #200 sta hitCheckY1 lda shotTable+OBJ_Y+3, x adc #0 sta hitCheckY1+1 sec lda shotTable+OBJ_Z+2, x sbc #200 sta hitCheckZ0 lda shotTable+OBJ_Z+3, x sbc #0 sta hitCheckZ0+1 clc lda shotTable+OBJ_Z+2, x adc #200 sta hitCheckZ1 lda shotTable+OBJ_Z+3, x adc #0 sta hitCheckZ1+1 cly .enemyLoop: lda enemyTable+OBJ_STATE, y jeq .enemyJump0 sec lda hitCheckX0 sbc enemyTable+OBJ_X+2, y lda hitCheckX0+1 sbc enemyTable+OBJ_X+3, y jpl .enemyJump0 sec lda hitCheckX1 sbc enemyTable+OBJ_X+2, y lda hitCheckX1+1 sbc enemyTable+OBJ_X+3, y bmi .enemyJump0 sec lda hitCheckY0 sbc enemyTable+OBJ_Y+2, y lda hitCheckY0+1 sbc enemyTable+OBJ_Y+3, y bpl .enemyJump0 sec lda hitCheckY1 sbc enemyTable+OBJ_Y+2, y lda hitCheckY1+1 sbc enemyTable+OBJ_Y+3, y bmi .enemyJump0 sec lda hitCheckZ0 sbc enemyTable+OBJ_Z+2, y lda hitCheckZ0+1 sbc enemyTable+OBJ_Z+3, y bpl .enemyJump0 sec lda hitCheckZ1 sbc enemyTable+OBJ_Z+2, y lda hitCheckZ1+1 sbc enemyTable+OBJ_Z+3, y bmi .enemyJump0 cla sta shotTable+OBJ_STATE, x sta enemyTable+OBJ_STATE, y lda enemyTable+OBJ_X+2, y sta effect_X lda enemyTable+OBJ_X+3, y sta effect_X+1 lda enemyTable+OBJ_Y+2, y sta effect_Y lda enemyTable+OBJ_Y+3, y sta effect_Y+1 lda enemyTable+OBJ_Z+2, y sta effect_Z lda enemyTable+OBJ_Z+3, y sta effect_Z+1 lda #EFFECT_TYPE_0 sta effect_Type jsr setEffectTable bra .shotJump0 .enemyJump0: clc tya adc #ENEMY_SIZE tay cpy #ENEMYTABLE_SIZE jne .enemyLoop .shotJump0: clc txa adc #SHOT_SIZE tax cpx #SHOTTABLE_SIZE jne .shotLoop ply plx rts ;---------------------------- checkShotEshot: ; phx phy clx .shotLoop: lda shotTable+OBJ_STATE, x jeq .shotJump0 sec lda shotTable+OBJ_X+2, x sbc #100 sta hitCheckX0 lda shotTable+OBJ_X+3, x sbc #0 sta hitCheckX0+1 clc lda shotTable+OBJ_X+2, x adc #100 sta hitCheckX1 lda shotTable+OBJ_X+3, x adc #0 sta hitCheckX1+1 sec lda shotTable+OBJ_Y+2, x sbc #100 sta hitCheckY0 lda shotTable+OBJ_Y+3, x sbc #0 sta hitCheckY0+1 clc lda shotTable+OBJ_Y+2, x adc #100 sta hitCheckY1 lda shotTable+OBJ_Y+3, x adc #0 sta hitCheckY1+1 sec lda shotTable+OBJ_Z+2, x sbc #100 sta hitCheckZ0 lda shotTable+OBJ_Z+3, x sbc #0 sta hitCheckZ0+1 clc lda shotTable+OBJ_Z+2, x adc #100 sta hitCheckZ1 lda shotTable+OBJ_Z+3, x adc #0 sta hitCheckZ1+1 cly .eshotLoop: lda eshotTable+OBJ_STATE, y jeq .eshotJump0 sec lda hitCheckX0 sbc eshotTable+OBJ_X+2, y lda hitCheckX0+1 sbc eshotTable+OBJ_X+3, y jpl .eshotJump0 sec lda hitCheckX1 sbc eshotTable+OBJ_X+2, y lda hitCheckX1+1 sbc eshotTable+OBJ_X+3, y bmi .eshotJump0 sec lda hitCheckY0 sbc eshotTable+OBJ_Y+2, y lda hitCheckY0+1 sbc eshotTable+OBJ_Y+3, y bpl .eshotJump0 sec lda hitCheckY1 sbc eshotTable+OBJ_Y+2, y lda hitCheckY1+1 sbc eshotTable+OBJ_Y+3, y bmi .eshotJump0 sec lda hitCheckZ0 sbc eshotTable+OBJ_Z+2, y lda hitCheckZ0+1 sbc eshotTable+OBJ_Z+3, y bpl .eshotJump0 sec lda hitCheckZ1 sbc eshotTable+OBJ_Z+2, y lda hitCheckZ1+1 sbc eshotTable+OBJ_Z+3, y bmi .eshotJump0 cla sta shotTable+OBJ_STATE, x sta eshotTable+OBJ_STATE, y lda eshotTable+OBJ_X+2, y sta effect_X lda eshotTable+OBJ_X+3, y sta effect_X+1 lda eshotTable+OBJ_Y+2, y sta effect_Y lda eshotTable+OBJ_Y+3, y sta effect_Y+1 lda eshotTable+OBJ_Z+2, y sta effect_Z lda eshotTable+OBJ_Z+3, y sta effect_Z+1 lda #EFFECT_TYPE_1 sta effect_Type jsr setEffectTable bra .shotJump0 .eshotJump0: clc tya adc #ESHOT_SIZE tay cpy #ESHOTTABLE_SIZE jne .eshotLoop .shotJump0: clc txa adc #SHOT_SIZE tax cpx #SHOTTABLE_SIZE jne .shotLoop ply plx rts ;---------------------------- setEnemy: ; lda enemyTimer inc a and #$3F sta enemyTimer bne .setEnemyEnd jsr getRandom sta enemy_X jsr signExt sta enemy_X+1 asl enemy_X rol enemy_X+1 asl enemy_X rol enemy_X+1 jsr getRandom sta enemy_Y jsr signExt sta enemy_Y+1 asl enemy_Y rol enemy_Y+1 asl enemy_Y rol enemy_Y+1 movw enemy_Z, #$1000 jsr setEnemyTable .setEnemyEnd: rts ;---------------------------- initEnemyTable: ; phx clx .initEnemyTableLoop: lda #OBJ_NO_ENEMY0 sta enemyTable+OBJ_NO, x stz enemyTable+OBJ_STATE, x clc txa adc #ENEMY_SIZE tax cpx #ENEMYTABLE_SIZE bne .initEnemyTableLoop plx rts ;---------------------------- setEnemyTable: ; phx clx .setEnemyTableLoop: lda enemyTable+OBJ_STATE, x bne .setEnemyTableJump0 lda #$01 sta enemyTable+OBJ_STATE, x lda #$02 sta enemyTable+OBJ_COLOR, x stz enemyTable+OBJ_X, x stz enemyTable+OBJ_X+1, x lda enemy_X sta enemyTable+OBJ_X+2, x lda enemy_X+1 sta enemyTable+OBJ_X+3, x stz enemyTable+OBJ_Y, x stz enemyTable+OBJ_Y+1, x lda enemy_Y sta enemyTable+OBJ_Y+2, x lda enemy_Y+1 sta enemyTable+OBJ_Y+3, x stz enemyTable+OBJ_Z, x stz enemyTable+OBJ_Z+1, x lda enemy_Z sta enemyTable+OBJ_Z+2, x lda enemy_Z+1 sta enemyTable+OBJ_Z+3, x stz enemyTable+OBJ_RX, x stz enemyTable+OBJ_RY, x stz enemyTable+OBJ_RZ, x stz enemyTable+ENEMY_TIME, x bra .setEnemyTableEnd .setEnemyTableJump0: clc txa adc #ENEMY_SIZE tax cpx #ENEMYTABLE_SIZE bne .setEnemyTableLoop .setEnemyTableEnd: plx rts ;---------------------------- moveEnemyTable: ; phx clx .moveEnemyTableLoop: lda enemyTable+OBJ_STATE, x beq .moveEnemyTableJump0 clc lda enemyTable+OBJ_RY, x adc #$04 sta enemyTable+OBJ_RY, x clc lda enemyTable+OBJ_Z+2, x adc #LOW(ENEMY0_Z_SHIFT) sta enemyTable+OBJ_Z+2, x lda enemyTable+OBJ_Z+3, x adc #HIGH(ENEMY0_Z_SHIFT) sta enemyTable+OBJ_Z+3, x bmi .moveEnemyTableJump1 beq .moveEnemyTableJump0 lda enemyTable+ENEMY_TIME, x inc a and #$1F sta enemyTable+ENEMY_TIME, x bne .moveEnemyTableJump0 lda enemyTable+OBJ_X+2, x sta eshot_X lda enemyTable+OBJ_X+3, x sta eshot_X+1 lda enemyTable+OBJ_Y+2, x sta eshot_Y lda enemyTable+OBJ_Y+3, x sta eshot_Y+1 lda enemyTable+OBJ_Z+2, x sta eshot_Z lda enemyTable+OBJ_Z+3, x sta eshot_Z+1 jsr setEshotTable bra .moveEnemyTableJump0 .moveEnemyTableJump1: stz enemyTable+OBJ_STATE, x .moveEnemyTableJump0: clc txa adc #ENEMY_SIZE tax cpx #ENEMYTABLE_SIZE bne .moveEnemyTableLoop plx rts ;---------------------------- regEnemyTable: ; phx clx .regEnemyTableLoop: lda enemyTable+OBJ_STATE, x beq .regEnemyTableJump0 clc txa adc #LOW(enemyTable) sta objReg_AddrWork cla adc #HIGH(enemyTable) sta objReg_AddrWork+1 lda enemyTable+OBJ_Z+2, x sta objReg_ZWork lda enemyTable+OBJ_Z+3, x sta objReg_ZWork+1 jsr setObjRegTable .regEnemyTableJump0: clc txa adc #ENEMY_SIZE tax cpx #ENEMYTABLE_SIZE bne .regEnemyTableLoop plx rts ;---------------------------- initEffectTable: ; phx clx .initEffectTableLoop: stz effectTable+OBJ_NO, x stz effectTable+OBJ_STATE, x clc txa adc #EFFECT_SIZE tax cpx #EFFECTTABLE_SIZE bne .initEffectTableLoop plx rts ;---------------------------- setEffectTable: ; phx clx .setEffectTableLoop: lda effectTable+OBJ_STATE, x bne .setEffectTableJump0 lda #$01 sta effectTable+OBJ_STATE, x stz effectTable+OBJ_X, x stz effectTable+OBJ_X+1, x lda effect_X sta effectTable+OBJ_X+2, x lda effect_X+1 sta effectTable+OBJ_X+3, x stz effectTable+OBJ_Y, x stz effectTable+OBJ_Y+1, x lda effect_Y sta effectTable+OBJ_Y+2, x lda effect_Y+1 sta effectTable+OBJ_Y+3, x stz effectTable+OBJ_Z, x stz effectTable+OBJ_Z+1, x lda effect_Z sta effectTable+OBJ_Z+2, x lda effect_Z+1 sta effectTable+OBJ_Z+3, x lda effect_Type sta effectTable+EFFECT_TYPE, x stz effectTable+EFFECT_TIME, x stz effectTable+OBJ_RX, x stz effectTable+OBJ_RY, x stz effectTable+OBJ_RZ, x bra .setEffectTableEnd .setEffectTableJump0: clc txa adc #EFFECT_SIZE tax cpx #EFFECTTABLE_SIZE bne .setEffectTableLoop .setEffectTableEnd: plx rts ;---------------------------- moveEffectTable: ; phx clx .moveEffectTableLoop: lda effectTable+OBJ_STATE, x beq .moveEffectTableJump0 lda effectTable+EFFECT_TYPE, x bne .moveEffectTableJump2 ;EFFECT_TYPE_0 lda effectTable+EFFECT_TIME, x cmp #7 bne .moveEffectTableJump1 stz effectTable+OBJ_STATE, x bra .moveEffectTableJump0 .moveEffectTableJump1: inc a sta effectTable+EFFECT_TIME, x bra .moveEffectTableJump0 ;EFFECT_TYPE_1 .moveEffectTableJump2: lda effectTable+EFFECT_TIME, x cmp #3 bne .moveEffectTableJump3 stz effectTable+OBJ_STATE, x bra .moveEffectTableJump0 .moveEffectTableJump3: inc a sta effectTable+EFFECT_TIME, x .moveEffectTableJump0: clc txa adc #EFFECT_SIZE tax cpx #EFFECTTABLE_SIZE bne .moveEffectTableLoop plx rts ;---------------------------- regEffectTable: ; phx clx .regEffectTableLoop: lda effectTable+OBJ_STATE, x beq .regEffectTableJump0 clc txa adc #LOW(effectTable) sta objReg_AddrWork cla adc #HIGH(effectTable) sta objReg_AddrWork+1 lda effectTable+OBJ_Z+2, x sta objReg_ZWork lda effectTable+OBJ_Z+3, x sta objReg_ZWork+1 lda effectTable+EFFECT_TIME, x and #$01 inc a sta effectTable+OBJ_COLOR, x lda effectTable+EFFECT_TYPE, x bne .regEffectTableJump1 ;EFFECT_TYPE_0 lda effectTable+EFFECT_TIME, x asl a clc adc #OBJ_NO_EFFECT0 sta effectTable+OBJ_NO, x bra .regEffectTableJump2 ;EFFECT_TYPE_1 .regEffectTableJump1: lda effectTable+EFFECT_TIME, x asl a clc adc #OBJ_NO_EFFECT1 sta effectTable+OBJ_NO, x .regEffectTableJump2: jsr setObjRegTable .regEffectTableJump0: clc txa adc #EFFECT_SIZE tax cpx #EFFECTTABLE_SIZE bne .regEffectTableLoop plx rts ;---------------------------- initShotTable: ; phx clx .initShotTableLoop: lda #OBJ_NO_SHOT sta shotTable+OBJ_NO, x stz shotTable+OBJ_STATE, x clc txa adc #SHOT_SIZE tax cpx #SHOTTABLE_SIZE bne .initShotTableLoop plx rts ;---------------------------- setShotTable: ; phx clx .setShotTableLoop: lda shotTable+OBJ_STATE, x bne .setShotTableJump0 lda #$01 sta shotTable+OBJ_STATE, x lda #$03 sta shotTable+OBJ_COLOR, x stz shotTable+OBJ_X, x stz shotTable+OBJ_X+1, x lda shipTranslationX sta shotTable+OBJ_X+2, x lda shipTranslationX+1 sta shotTable+OBJ_X+3, x stz shotTable+OBJ_Y, x stz shotTable+OBJ_Y+1, x lda shipTranslationY sta shotTable+OBJ_Y+2, x lda shipTranslationY+1 sta shotTable+OBJ_Y+3, x stz shotTable+OBJ_Z, x stz shotTable+OBJ_Z+1, x stz shotTable+OBJ_Z+2, x stz shotTable+OBJ_Z+3, x stz shotTable+OBJ_RX, x stz shotTable+OBJ_RY, x stz shotTable+OBJ_RZ, x bra .setShotTableEnd .setShotTableJump0: clc txa adc #SHOT_SIZE tax cpx #SHOTTABLE_SIZE bne .setShotTableLoop .setShotTableEnd: plx rts ;---------------------------- moveShotTable: ; phx clx .moveShotTableLoop: lda shotTable+OBJ_STATE, x beq .moveShotTableJump0 clc lda shotTable+OBJ_RZ, x adc #$08 sta shotTable+OBJ_RZ, x clc lda shotTable+OBJ_Z+2, x adc #LOW(SHOT_Z_SHIFT) sta shotTable+OBJ_Z+2, x lda shotTable+OBJ_Z+3, x adc #HIGH(SHOT_Z_SHIFT) sta shotTable+OBJ_Z+3, x cmp #SHOT_Z_MAX bmi .moveShotTableJump0 stz shotTable+OBJ_STATE, x .moveShotTableJump0: clc txa adc #SHOT_SIZE tax cpx #SHOTTABLE_SIZE bne .moveShotTableLoop plx rts ;---------------------------- regShotTable: ; phx clx .regShotTableLoop: lda shotTable+OBJ_STATE, x beq .regShotTableJump0 clc txa adc #LOW(shotTable) sta objReg_AddrWork cla adc #HIGH(shotTable) sta objReg_AddrWork+1 lda shotTable+OBJ_Z+2, x sta objReg_ZWork lda shotTable+OBJ_Z+3, x sta objReg_ZWork+1 jsr setObjRegTable .regShotTableJump0: clc txa adc #SHOT_SIZE tax cpx #SHOTTABLE_SIZE bne .regShotTableLoop plx rts ;---------------------------- initEshotTable: ; phx clx .initEshotTableLoop: lda #OBJ_NO_ESHOT sta eshotTable+OBJ_NO, x stz eshotTable+OBJ_STATE, x clc txa adc #ESHOT_SIZE tax cpx #ESHOTTABLE_SIZE bne .initEshotTableLoop plx rts ;---------------------------- setEshotTable: ; phx clx .setEshotTableLoop: lda eshotTable+OBJ_STATE, x jne .setEshotTableJump0 lda #$01 sta eshotTable+OBJ_STATE, x lda #$01 sta eshotTable+OBJ_COLOR, x stz eshotTable+OBJ_X, x stz eshotTable+OBJ_X+1, x lda eshot_X sta eshotTable+OBJ_X+2, x lda eshot_X+1 sta eshotTable+OBJ_X+3, x stz eshotTable+OBJ_Y, x stz eshotTable+OBJ_Y+1, x lda eshot_Y sta eshotTable+OBJ_Y+2, x lda eshot_Y+1 sta eshotTable+OBJ_Y+3, x stz eshotTable+OBJ_Z, x stz eshotTable+OBJ_Z+1, x lda eshot_Z sta eshotTable+OBJ_Z+2, x lda eshot_Z+1 sta eshotTable+OBJ_Z+3, x stz eshotTable+OBJ_RX, x stz eshotTable+OBJ_RY, x stz eshotTable+OBJ_RZ, x movw angleX0, eshot_X movw angleY0, eshot_Y movw angleZ0, eshot_Z movw angleX1, shipTranslationX movw angleY1, shipTranslationY movw angleZ1, shipTranslationZ movw angleShift, #ESHOT_SHIFT jsr getAngleShift lda angleX0 sta eshotTable+ESHOT_SHIFTX, x lda angleX0+1 sta eshotTable+ESHOT_SHIFTX+1, x lda angleX0+2 sta eshotTable+ESHOT_SHIFTX+2, x lda angleX0+3 sta eshotTable+ESHOT_SHIFTX+3, x lda angleY0 sta eshotTable+ESHOT_SHIFTY, x lda angleY0+1 sta eshotTable+ESHOT_SHIFTY+1, x lda angleY0+2 sta eshotTable+ESHOT_SHIFTY+2, x lda angleY0+3 sta eshotTable+ESHOT_SHIFTY+3, x lda angleZ0 sta eshotTable+ESHOT_SHIFTZ, x lda angleZ0+1 sta eshotTable+ESHOT_SHIFTZ+1, x lda angleZ0+2 sta eshotTable+ESHOT_SHIFTZ+2, x lda angleZ0+3 sta eshotTable+ESHOT_SHIFTZ+3, x bra .setEshotTableEnd .setEshotTableJump0: clc txa adc #ESHOT_SIZE tax cpx #ESHOTTABLE_SIZE jne .setEshotTableLoop .setEshotTableEnd: plx rts ;---------------------------- moveEshotTable: ; phx clx .moveEshotTableLoop: lda eshotTable+OBJ_STATE, x jeq .moveEshotTableJump0 clc lda eshotTable+OBJ_RX, x adc #8 sta eshotTable+OBJ_RX, x clc lda eshotTable+OBJ_RY, x adc #8 sta eshotTable+OBJ_RY, x clc lda eshotTable+OBJ_X, x adc eshotTable+ESHOT_SHIFTX, x sta eshotTable+OBJ_X, x lda eshotTable+OBJ_X+1, x adc eshotTable+ESHOT_SHIFTX+1, x sta eshotTable+OBJ_X+1, x lda eshotTable+OBJ_X+2, x adc eshotTable+ESHOT_SHIFTX+2, x sta eshotTable+OBJ_X+2, x lda eshotTable+OBJ_X+3, x adc eshotTable+ESHOT_SHIFTX+3, x sta eshotTable+OBJ_X+3, x clc lda eshotTable+OBJ_Y, x adc eshotTable+ESHOT_SHIFTY, x sta eshotTable+OBJ_Y, x lda eshotTable+OBJ_Y+1, x adc eshotTable+ESHOT_SHIFTY+1, x sta eshotTable+OBJ_Y+1, x lda eshotTable+OBJ_Y+2, x adc eshotTable+ESHOT_SHIFTY+2, x sta eshotTable+OBJ_Y+2, x lda eshotTable+OBJ_Y+3, x adc eshotTable+ESHOT_SHIFTY+3, x sta eshotTable+OBJ_Y+3, x clc lda eshotTable+OBJ_Z, x adc eshotTable+ESHOT_SHIFTZ, x sta eshotTable+OBJ_Z, x lda eshotTable+OBJ_Z+1, x adc eshotTable+ESHOT_SHIFTZ+1, x sta eshotTable+OBJ_Z+1, x lda eshotTable+OBJ_Z+2, x adc eshotTable+ESHOT_SHIFTZ+2, x sta eshotTable+OBJ_Z+2, x lda eshotTable+OBJ_Z+3, x adc eshotTable+ESHOT_SHIFTZ+3, x sta eshotTable+OBJ_Z+3, x bpl .moveEshotTableJump0 stz eshotTable+OBJ_STATE, x .moveEshotTableJump0: clc txa adc #ESHOT_SIZE tax cpx #ESHOTTABLE_SIZE jne .moveEshotTableLoop plx rts ;---------------------------- regEshotTable: ; phx clx .regEshotTableLoop: lda eshotTable+OBJ_STATE, x beq .regEshotTableJump0 clc txa adc #LOW(eshotTable) sta objReg_AddrWork cla adc #HIGH(eshotTable) sta objReg_AddrWork+1 lda eshotTable+OBJ_Z+2, x sta objReg_ZWork lda eshotTable+OBJ_Z+3, x sta objReg_ZWork+1 jsr setObjRegTable .regEshotTableJump0: clc txa adc #ESHOT_SIZE tax cpx #ESHOTTABLE_SIZE bne .regEshotTableLoop plx rts ;---------------------------- initObjRegTable: ; movw objRegTable+OBJREG_Z, #$4000 mov objRegTable_index, #OBJREG_SIZE rts ;---------------------------- setObjRegTable: ; phx ldx objRegTable_index clc lda objRegTable_index adc #OBJREG_SIZE sta objRegTable_index lda objReg_AddrWork sta objRegTable+OBJREG_ADDR, x lda objReg_AddrWork+1 sta objRegTable+OBJREG_ADDR+1, x lda objReg_ZWork sta objRegTable+OBJREG_Z, x lda objReg_ZWork+1 sta objRegTable+OBJREG_Z+1, x .setObjRegTableLoop: sec lda objRegTable-OBJREG_SIZE+OBJREG_Z, x sbc objRegTable+OBJREG_Z, x lda objRegTable-OBJREG_SIZE+OBJREG_Z+1, x sbc objRegTable+OBJREG_Z+1, x bpl .setObjRegTableEnd lda objRegTable-OBJREG_SIZE+OBJREG_ADDR, x sta objReg_AddrWork lda objRegTable-OBJREG_SIZE+OBJREG_ADDR+1, x sta objReg_AddrWork+1 lda objRegTable+OBJREG_ADDR, x sta objRegTable-OBJREG_SIZE+OBJREG_ADDR, x lda objRegTable+OBJREG_ADDR+1, x sta objRegTable-OBJREG_SIZE+OBJREG_ADDR+1, x lda objReg_AddrWork sta objRegTable+OBJREG_ADDR, x lda objReg_AddrWork+1 sta objRegTable+OBJREG_ADDR+1, x lda objRegTable-OBJREG_SIZE+OBJREG_Z, x sta objReg_ZWork lda objRegTable-OBJREG_SIZE+OBJREG_Z+1, x sta objReg_ZWork+1 lda objRegTable+OBJREG_Z, x sta objRegTable-OBJREG_SIZE+OBJREG_Z, x lda objRegTable+OBJREG_Z+1, x sta objRegTable-OBJREG_SIZE+OBJREG_Z+1 ,x lda objReg_ZWork sta objRegTable+OBJREG_Z, x lda objReg_ZWork+1 sta objRegTable+OBJREG_Z+1, x sec txa sbc #OBJREG_SIZE tax bra .setObjRegTableLoop .setObjRegTableEnd: plx rts ;---------------------------- drawObjRegTable: ; phx ldx #OBJREG_SIZE .drawObjRegTableLoop: cpx objRegTable_index beq .drawObjRegTableEnd lda objRegTable+OBJREG_ADDR, x sta <objRegTable_AddrWork lda objRegTable+OBJREG_ADDR+1, x sta <objRegTable_AddrWork+1 ldy #OBJ_X+2 lda [objRegTable_AddrWork], y sta <translationX iny lda [objRegTable_AddrWork], y sta <translationX+1 ldy #OBJ_Y+2 lda [objRegTable_AddrWork], y sta <translationY iny lda [objRegTable_AddrWork], y sta <translationY+1 ldy #OBJ_Z+2 lda [objRegTable_AddrWork], y sta <translationZ iny lda [objRegTable_AddrWork], y sta <translationZ+1 ldy #OBJ_RX lda [objRegTable_AddrWork], y sta <rotationX ldy #OBJ_RY lda [objRegTable_AddrWork], y sta <rotationY ldy #OBJ_RZ lda [objRegTable_AddrWork], y sta <rotationZ ldy #OBJ_NO lda [objRegTable_AddrWork], y tay lda modelData, y sta <modelAddr lda modelData+1, y sta <modelAddr+1 ldy #OBJ_COLOR lda [objRegTable_AddrWork], y jsr setLineColor lda #ROTATIONZXY sta <rotationSelect jsr drawModel2 clc txa adc #OBJREG_SIZE tax bra .drawObjRegTableLoop .drawObjRegTableEnd: plx rts ;---------------------------- getAngleShift: ; phx phy jsr getAngle ;x=x y=zsinA+ycosA z=zcosA-ysinA ldy ansAngleX lda sinDataLow, y sta angleY0 lda sinDataHigh, y sta angleY0+1 ldy ansAngleX lda cosDataLow, y sta angleZ0 lda cosDataHigh, y sta angleZ0+1 ;x=xcosA-zsinA y=y z=xsinA+zcosA ldy ansAngleY clc lda sinDataLow, y eor #$FF adc #$01 sta <mul16a lda sinDataHigh, y eor #$FF adc #$00 sta <mul16a+1 movw <mul16b, angleZ0 jsr smul16 asl <mul16c rol <mul16c+1 rol <mul16d rol <mul16d+1 asl <mul16c rol <mul16c+1 rol <mul16d rol <mul16d+1 movw angleX0, <mul16d ;-------------------------------- ldy ansAngleY lda cosDataLow, y sta <mul16a lda cosDataHigh, y sta <mul16a+1 movw <mul16b, angleZ0 jsr smul16 asl <mul16c rol <mul16c+1 rol <mul16d rol <mul16d+1 asl <mul16c rol <mul16c+1 rol <mul16d rol <mul16d+1 movw angleZ0, <mul16d ;-------------------------------- movw <mul16a, angleX0 movw <mul16b, angleShift jsr smul16 asl <mul16c rol <mul16c+1 rol <mul16d rol <mul16d+1 asl <mul16c rol <mul16c+1 rol <mul16d rol <mul16d+1 movq angleX0, <mul16c ;-------------------------------- movw <mul16a, angleY0 movw <mul16b, angleShift jsr smul16 asl <mul16c rol <mul16c+1 rol <mul16d rol <mul16d+1 asl <mul16c rol <mul16c+1 rol <mul16d rol <mul16d+1 movq angleY0, <mul16c ;-------------------------------- movw <mul16a, angleZ0 movw <mul16b, angleShift jsr smul16 asl <mul16c rol <mul16c+1 rol <mul16d rol <mul16d+1 asl <mul16c rol <mul16c+1 rol <mul16d rol <mul16d+1 movq angleZ0, <mul16c ply plx rts ;---------------------------- getAngle: phx subw <mul16a, angleZ1, angleZ0 subw <mul16b, angleX1, angleX0 jsr atan tax eor #$FF inc a sta ansAngleY subw transform2DWork0, angleX1, angleX0 subw transform2DWork0+2, angleY1, angleY0 subw transform2DWork0+4, angleZ1, angleZ0 mov vertexCount, #1 jsr vertexRotationY movw <mul16a, transform2DWork0+4 movw <mul16b, transform2DWork0+2 jsr atan sta ansAngleX plx rts ;---------------------------- mainIrqProc: jsr wireIrqProc bcs .irqEnd jsr getPadData dec frameCount bne .irqEnd mov drawCountWork, drawCount mov frameCount, #60 stz drawCount .irqEnd: rts ;---------------------------- initializeVdp: ; ;reset wait cly .resetWaitloop0: clx .resetWaitloop1: dex bne .resetWaitloop1 dey bne .resetWaitloop0 ;set vdp vdpdataloop: lda vdpdata, y cmp #$FF beq vdpdataend sta VDC_0 iny lda vdpdata, y sta VDC_2 iny lda vdpdata, y sta VDC_3 iny bra vdpdataloop vdpdataend: ;disable interrupts TIQD IRQ2D lda #$05 sta INT_DIS_REG ;262Line VCE Clock 5MHz lda #$04 sta VCE_0 stz VCE_1 ;set palette stz VCE_2 stz VCE_3 tia palettebgdata, VCE_4, $80 stz VCE_2 lda #$01 sta VCE_3 tia palettebgdata, VCE_4, $80 ;CHAR set to vram lda #chardatBank tam #$06 ;vram address $1000 st0 #$00 st1 #$00 st2 #$10 st0 #$02 tia $C000, VDC_2, $1000 ;clear zeropage stz $2000 tii $2000, $2001, $00FF rts ;---------------------------- modelData .dw 0 ;0 .dw modelShotData ;2 .dw modelEshotData ;4 .dw modelEnemy0Data ;6 .dw modelEffect0_0Data ;8 .dw modelEffect0_1Data ;10 .dw modelEffect0_2Data ;12 .dw modelEffect0_3Data ;14 .dw modelEffect0_4Data ;16 .dw modelEffect0_5Data ;18 .dw modelEffect0_6Data ;20 .dw modelEffect0_7Data ;22 .dw modelEffect1_0Data ;24 .dw modelEffect1_1Data ;26 .dw modelEffect1_2Data ;28 .dw modelEffect1_3Data ;30 ;---------------------------- modelEffect0_0Data .dw modelEffect0_0DataWire .db 8 ;wire count .dw modelEffect0_0DataVertex .db 16 ;vertex count modelEffect0_0DataWire .db 0*6, 1*6 ;0 .db 2*6, 3*6 ;1 .db 4*6, 5*6 ;2 .db 6*6, 7*6 ;3 .db 8*6, 9*6 ;4 .db 10*6,11*6 ;5 .db 12*6,13*6 ;6 .db 14*6,15*6 ;7 modelEffect0_0DataVertex .dw -43, -25, -7;0 .dw 43, 25, 7;1 .dw -32, -21, -32;2 .dw 32, 21, 32;3 .dw -48, -8, -10;4 .dw 48, 8, 10;5 .dw -47, 15, 10;6 .dw 47, -15, -10;7 .dw -43, -25, -6;8 .dw 43, 25, 6;9 .dw -44, 24, 4;10 .dw 44, -24, -4;11 .dw -48, 10, 8;12 .dw 48, -10, -8;13 .dw -2, -25, -43;14 .dw 2, 25, 43;15 ;---------------------------- modelEffect0_1Data .dw modelEffect0_0DataWire .db 8 ;wire count .dw modelEffect0_1DataVertex .db 16 ;vertex count modelEffect0_1DataVertex .dw -53, -10, 3;0 .dw 33, 39, 16;1 .dw -40, -31, -17;2 .dw 23, 12, 47;3 .dw -52, -12, 10;4 .dw 45, 5, 29;5 .dw -41, 21, 28;6 .dw 53, -9, 8;7 .dw -53, -10, 3;8 .dw 33, 40, 15;9 .dw -34, 40, 11;10 .dw 53, -7, 2;11 .dw -45, 13, 27;12 .dw 52, -6, 12;13 .dw -12, -40, -34;14 .dw -8, 10, 52;15 ;---------------------------- modelEffect0_2Data .dw modelEffect0_0DataWire .db 8 ;wire count .dw modelEffect0_2DataVertex .db 16 ;vertex count modelEffect0_2DataVertex .dw -63, 4, 12;0 .dw 23, 54, 26;1 .dw -49, -41, -2;2 .dw 15, 2, 62;3 .dw -55, -15, 29;4 .dw 42, 2, 49;5 .dw -35, 27, 46;6 .dw 59, -2, 26;7 .dw -63, 6, 11;8 .dw 23, 55, 23;9 .dw -25, 56, 18;10 .dw 63, 9, 9;11 .dw -41, 17, 46;12 .dw 56, -2, 31;13 .dw -22, -55, -25;14 .dw -18, -5, 61;15 ;---------------------------- modelEffect0_3Data .dw modelEffect0_0DataWire .db 8 ;wire count .dw modelEffect0_3DataVertex .db 16 ;vertex count modelEffect0_3DataVertex .dw -73, 18, 22;0 .dw 13, 68, 35;1 .dw -58, -51, 13;2 .dw 6, -8, 77;3 .dw -58, -19, 48;4 .dw 38, -2, 68;5 .dw -29, 34, 64;6 .dw 64, 4, 44;7 .dw -73, 21, 20;8 .dw 13, 70, 32;9 .dw -16, 73, 24;10 .dw 72, 26, 16;11 .dw -37, 21, 65;12 .dw 60, 2, 50;13 .dw -32, -69, -16;14 .dw -28, -20, 70;15 ;---------------------------- modelEffect0_4Data .dw modelEffect0_0DataWire .db 8 ;wire count .dw modelEffect0_4DataVertex .db 16 ;vertex count modelEffect0_4DataVertex .dw -83, 33, 31;0 .dw 3, 83, 45;1 .dw -66, -61, 29;2 .dw -2, -18, 93;3 .dw -62, -22, 68;4 .dw 35, -5, 88;5 .dw -23, 40, 82;6 .dw 70, 10, 62;7 .dw -83, 36, 28;8 .dw 3, 85, 40;9 .dw -6, 89, 31;10 .dw 82, 42, 22;11 .dw -33, 25, 85;12 .dw 64, 6, 69;13 .dw -42, -84, -7;14 .dw -38, -34, 79;15 ;---------------------------- modelEffect0_5Data .dw modelEffect0_0DataWire .db 8 ;wire count .dw modelEffect0_5DataVertex .db 16 ;vertex count modelEffect0_5DataVertex .dw -93, 47, 41;0 .dw -7, 97, 54;1 .dw -75, -71, 44;2 .dw -11, -28, 108;3 .dw -65, -26, 87;4 .dw 31, -9, 107;5 .dw -17, 46, 100;6 .dw 76, 16, 80;7 .dw -92, 51, 37;8 .dw -6, 100, 49;9 .dw 3, 105, 37;10 .dw 91, 58, 29;11 .dw -29, 29, 104;12 .dw 68, 10, 88;13 .dw -52, -99, 2;14 .dw -48, -49, 88;15 ;---------------------------- modelEffect0_6Data .dw modelEffect0_0DataWire .db 8 ;wire count .dw modelEffect0_6DataVertex .db 16 ;vertex count modelEffect0_6DataVertex .dw -103, 62, 50;0 .dw -17, 112, 64;1 .dw -83, -81, 59;2 .dw -20, -38, 123;3 .dw -69, -29, 107;4 .dw 28, -12, 126;5 .dw -11, 53, 118;6 .dw 82, 23, 98;7 .dw -102, 66, 45;8 .dw -16, 116, 57;9 .dw 13, 122, 44;10 .dw 100, 75, 35;11 .dw -26, 33, 123;12 .dw 71, 14, 108;13 .dw -62, -114, 11;14 .dw -58, -64, 97;15 ;---------------------------- modelEffect0_7Data .dw modelEffect0_0DataWire .db 8 ;wire count .dw modelEffect0_7DataVertex .db 16 ;vertex count modelEffect0_7DataVertex .dw -113, 76, 60;0 .dw -27, 126, 73;1 .dw -92, -90, 74;2 .dw -28, -48, 138;3 .dw -72, -32, 126;4 .dw 25, -16, 146;5 .dw -5, 59, 136;6 .dw 88, 29, 116;7 .dw -112, 81, 54;8 .dw -26, 131, 66;9 .dw 22, 138, 51;10 .dw 110, 91, 42;11 .dw -22, 37, 142;12 .dw 75, 18, 127;13 .dw -72, -129, 20;14 .dw -67, -79, 106;15 ;---------------------------- modelEffect1_0Data .dw modelEffect1_0DataWire .db 6 ;wire count .dw modelEffect1_0DataVertex .db 12 ;vertex count modelEffect1_0DataWire .db 0*6, 1*6 ;0 .db 2*6, 3*6 ;1 .db 4*6, 5*6 ;2 .db 6*6, 7*6 ;3 .db 8*6, 9*6 ;4 .db 10*6,11*6 ;5 modelEffect1_0DataVertex .dw -21, -12, -4;0 .dw 21, 12, 4;1 .dw -22, 12, 3;2 .dw 22, -12, -3;3 .dw -25, -5, 0;4 .dw 25, 5, 0;5 .dw -25, -4, 0;6 .dw 25, 4, 0;7 .dw -24, 4, 5;8 .dw 24, -4, -5;9 .dw 13, -10, -19;10 .dw -13, 10, 19;11 ;---------------------------- modelEffect1_1Data .dw modelEffect1_0DataWire .db 6 ;wire count .dw modelEffect1_1DataVertex .db 12 ;vertex count modelEffect1_1DataVertex .dw -31, 2, 6;0 .dw 11, 27, 14;1 .dw -12, 28, 10;2 .dw 31, 4, 5;3 .dw -28, 15, 1;4 .dw 21, 24, 1;5 .dw -28, 15, 1;6 .dw 21, 24, 1;7 .dw -21, 1, 24;8 .dw 28, -8, 14;9 .dw 5, -28, -15;10 .dw -21, -8, 23;11 ;---------------------------- modelEffect1_2Data .dw modelEffect1_0DataWire .db 6 ;wire count .dw modelEffect1_2DataVertex .db 12 ;vertex count modelEffect1_2DataVertex .dw -41, 16, 16;0 .dw 1, 41, 24;1 .dw -2, 44, 18;2 .dw 41, 19, 13;3 .dw -32, 34, 1;4 .dw 17, 44, 2;5 .dw -31, 35, 1;6 .dw 18, 44, 1;7 .dw -17, -3, 44;8 .dw 31, -11, 34;9 .dw -3, -46, -11;10 .dw -29, -26, 27;11 ;---------------------------- modelEffect1_3Data .dw modelEffect1_0DataWire .db 6 ;wire count .dw modelEffect1_3DataVertex .db 12 ;vertex count modelEffect1_3DataVertex .dw -51, 30, 26;0 .dw -9, 55, 34;1 .dw 7, 59, 25;2 .dw 51, 35, 20;3 .dw -36, 54, 2;4 .dw 13, 64, 2;5 .dw -35, 55, 2;6 .dw 15, 63, 2;7 .dw -14, -6, 63;8 .dw 34, -14, 53;9 .dw -11, -64, -7;10 .dw -37, -44, 31;11 ;---------------------------- modelShotData .dw modelShotDataWire .db 6 ;wire count .dw modelShotDataVertex .db 6 ;vertex count modelShotDataWire .db 0*6, 1*6 ;0 .db 1*6, 2*6 ;1 .db 2*6, 0*6 ;2 .db 3*6, 4*6 ;3 .db 4*6, 5*6 ;4 .db 5*6, 3*6 ;5 modelShotDataVertex .dw -100, 0, 100;0 .dw -100, 20, -100;1 .dw -100, -20, -50;2 .dw 100, 0, 100;3 .dw 100, 20, -100;4 .dw 100, -20, -50;5 ;---------------------------- modelEshotData .dw modelEshotDataWire .db 6 ;wire count .dw modelEshotDataVertex .db 4 ;vertex count modelEshotDataWire .db 0*6, 1*6 ;0 .db 0*6, 2*6 ;1 .db 0*6, 3*6 ;2 .db 1*6, 2*6 ;3 .db 2*6, 3*6 ;4 .db 3*6, 1*6 ;5 modelEshotDataVertex .dw 0, 25, 0;0 .dw 0, -25, 35;1 .dw 31, -25, -18;2 .dw -31, -25, -18;3 ;---------------------------- modelEnemy0Data .dw modelEnemy0DataWire .db 15 ;wire count .dw modelEnemy0DataVertex .db 16 ;vertex count modelEnemy0DataWire .db 0*6, 1*6 ;0 .db 2*6, 3*6 ;1 .db 3*6, 4*6 ;2 .db 4*6, 5*6 ;3 .db 5*6, 2*6 ;4 .db 0*6, 6*6 ;5 .db 7*6, 8*6 ;6 .db 8*6, 9*6 ;7 .db 9*6,10*6 ;8 .db 10*6, 7*6 ;9 .db 0*6,11*6 ;10 .db 12*6,13*6 ;11 .db 13*6,14*6 ;12 .db 14*6,15*6 ;13 .db 15*6,12*6 ;14 modelEnemy0DataVertex .dw 0, 80, 0;0 .dw 0, 0, 100;1 .dw 0, 80, 80;2 .dw -25, 0, 100;3 .dw 0, -150, 80;4 .dw 25, 0, 100;5 .dw -87, 0, -50;6 .dw -69, 80, -40;7 .dw -74, 0, -72;8 .dw -69, -150, -40;9 .dw -99, 0, -28;10 .dw 87, 0, -50;11 .dw 69, 80, -40;12 .dw 99, 0, -28;13 .dw 69, -150, -40;14 .dw 74, 0, -72;15 ;---------------------------- vdpdata: .db $05, $00, $00 ;screen off +1 .db $0A, $02, $02 ;HSW $02 HDS $02 .db $0B, $1F, $04 ;HDW $1F HDE $04 .db $0C, $02, $0D ;VSW $02 VDS $0D .db $0D, $EF, $00 ;VDW $00EF .db $0E, $03, $00 ;VCR $03 .db $0F, $00, $00 ;DMA +1 +1 .db $07, $00, $00 ;scrollx 0 .db $08, $00, $00 ;scrolly 0 .db $09, $40, $00 ;32x64 .db $FF ;end ;---------------------------- palettebgdata: .dw $0000, $0020, $0100, $0120, $0004, $0024, $0104, $0124,\ $01B6, $0038, $01C0, $01F8, $0007, $003F, $01C7, $01FF .dw $0000, $0020, $0100, $0120, $0004, $0024, $0104, $0124,\ $01B6, $0038, $01C0, $01F8, $0007, $003F, $01C7, $01FF ;------------------ wireframe line color-- ---------------- .dw $0000, $0020, $0100, $0004, $0000, $0020, $0100, $0004,\ $0000, $0020, $0100, $0004, $0000, $0020, $0100, $0004 .dw $0000, $0000, $0000, $0000, $0020, $0020, $0020, $0020,\ $0100, $0100, $0100, $0100, $0004, $0004, $0004, $0004 ;---------------------------------------------------------- ;---------------------------- spriteStarData .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $80, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $80, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $80, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $80, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ;---------------------------- spriteSightsData .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $17, $E8,\ $00, $00, $1C, $38, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $17, $E8,\ $00, $00, $1C, $38, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $17, $E8,\ $00, $00, $1C, $38, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ;********************************** .bank 2 .org $C000 ;---------------------------- setLineColorData: ;reg A color no phx tax lda wireLineColorData0, x sta <CH0Data lda wireLineColorData1, x sta <CH1Data plx rts ;---------------------------- initWire: ; lda #CHRBG0Addr sta <wireBGAddr sta <clearVramDmaAddr stz <clearVramFlag smb7 <drawFlag rts ;---------------------------- switchBG: ; lda <wireBGAddr cmp #CHRBG0Addr bne .switchBGJump0 lda #CHRBG1Addr bra .switchBGJump1 .switchBGJump0: lda #CHRBG0Addr .switchBGJump1: sta <wireBGAddr stz <clearVramFlag smb7 <drawFlag rts ;---------------------------- wireIrqProc: ; ;check DMA completion lda <vdcStatus and #$10 bne .wireIrqJump3 bbr7 <drawFlag, .wireIrqEnd .wireIrqJump2: rmb7 <drawFlag lda #2 sta <clearVramCount lda <wireBGAddr sta <clearVramDmaAddr cmp #CHRBG0Addr bne .wireIrqJump st0 #$08 st1 #$00 st2 #$01 bra .wireIrqEnd .wireIrqJump: st0 #$08 st1 #$00 st2 #$00 .wireIrqEnd: jsr clearVramDma clc rts ;DMA completion .wireIrqJump3: lda <clearVramCount bne .wireIrqJump4 smb7 <clearVramFlag .wireIrqJump4: sec rts ;---------------------------- clearVramDma: ; lda <clearVramCount beq .clearVramDmaEnd dec <clearVramCount st0 #$00 st1 #$00 mov VDC_3, <clearVramDmaAddr st0 #$02 st1 #$00 st2 #$00 st0 #$0F st1 #$02 ;inc dst, inc src, VRAM-VRAM interrupt st2 #$00 st0 #$10 st1 #$00 mov VDC_3, <clearVramDmaAddr st0 #$11 st1 #$01 mov VDC_3, <clearVramDmaAddr st0 #$12 st1 #$FF st2 #$0B add <clearVramDmaAddr, #$0C .clearVramDmaEnd: rts ;---------------------------- clearVram: ; .clearVramJump: bbr7 <clearVramFlag, .clearVramJump rts ;---------------------------- drawModel: ; phx phy ;rotation ldy #MODELDATA_VERTEXCOUNT lda [modelAddr], y ;vertex count sta <vertexCount ldy #MODELDATA_VERTEXADDR lda [modelAddr], y ;vertex data address sta <vertex0Addr iny lda [modelAddr], y sta <vertex0Addr+1 movw <vertex1Addr, #transform2DWork0 jsr vertexMultiply ;translation ldy #MODELDATA_VERTEXCOUNT lda [modelAddr], y ;vertex count sta <vertexCount movw <vertex0Addr, #transform2DWork0 movw <vertex1Addr, #transform2DWork1 subw <translationX, <eyeTranslationX subw <translationY, <eyeTranslationY subw <translationZ, <eyeTranslationZ jsr vertexTranslation ;eye rotation jsr moveEyeMatrixToMatrix2 ldy #MODELDATA_VERTEXCOUNT lda [modelAddr], y ;vertex count sta <vertexCount movw <vertex0Addr, #transform2DWork1 movw <vertex1Addr, #transform2DWork0 jsr vertexMultiply ;move transform2DWork0 to transform2DWork1 ldy #MODELDATA_VERTEXCOUNT lda [modelAddr], y ;vertex count sta <vertexCount jsr copy2DWork0To2DWork1 ;transform2D ldy #MODELDATA_VERTEXCOUNT lda [modelAddr], y ;vertex count sta <vertexCount movw <vertex0Addr, #transform2DWork1 movw <vertex1Addr, #transform2DWork0 jsr transform2D jsr drawModelProc ply plx rts ;---------------------------- drawModel2: ; phx phy ;rotation ldy #MODELDATA_VERTEXCOUNT lda [modelAddr], y ;vertex count sta <vertexCount ldy #MODELDATA_VERTEXADDR lda [modelAddr], y ;vertex data address sta <vertex0Addr iny lda [modelAddr], y sta <vertex0Addr+1 jsr moveToTransform2DWork0 lda <rotationSelect and #3 jsr vertexRotationSelect lda <rotationSelect lsr a lsr a and #3 jsr vertexRotationSelect lda <rotationSelect lsr a lsr a lsr a lsr a and #3 jsr vertexRotationSelect ;translation subw <translationX, <eyeTranslationX subw <translationY, <eyeTranslationY subw <translationZ, <eyeTranslationZ jsr vertexTranslation2 ;eye rotation mov <rotationX, <eyeRotationX mov <rotationY, <eyeRotationY mov <rotationZ, <eyeRotationZ lda <eyeRotationSelect and #3 jsr vertexRotationSelect lda <eyeRotationSelect lsr a lsr a and #3 jsr vertexRotationSelect lda <eyeRotationSelect lsr a lsr a lsr a lsr a and #3 jsr vertexRotationSelect ;transform2D jsr transform2D2 jsr drawModelProc ply plx rts ;---------------------------- drawModelProc: ; ldy #MODELDATA_WIREADDR lda [modelAddr], y sta <modelAddrWork ;ModelData Wire Addr iny lda [modelAddr], y sta <modelAddrWork+1 ldy #MODELDATA_WIRECOUNT lda [modelAddr], y ;Wire Count sta <modelWireCount cly .drawModelLoop0: stz <frontClipFlag lda [modelAddrWork], y sta <drawModelData0 tax iny lda transform2DWork0, x sta <lineX0 lda transform2DWork0+1, x sta <lineX0+1 lda transform2DWork0+2, x sta <lineY0 lda transform2DWork0+3, x sta <lineY0+1 lda transform2DWork0+5, x bpl .drawModelJump1 smb0 <frontClipFlag .drawModelJump1: lda [modelAddrWork], y sta <drawModelData1 tax iny lda transform2DWork0, x sta <lineX1 lda transform2DWork0+1, x sta <lineX1+1 lda transform2DWork0+2, x sta <lineY1 lda transform2DWork0+3, x sta <lineY1+1 lda transform2DWork0+5, x bpl .drawModelJump2 smb1 <frontClipFlag .drawModelJump2: lda <frontClipFlag beq .drawModelJump3 cmp #3 beq .drawModelJump0 ;clip front jsr clipFront ;clipFrontX+centerX addw <clipFrontX, <centerX ;centerY-clipFrontY subw <clipFrontY, <centerY, <clipFrontY bbr0 <frontClipFlag, .drawModelJump4 movw <lineX0, <clipFrontX movw <lineY0, <clipFrontY bra .drawModelJump3 .drawModelJump4: movw <lineX1, <clipFrontX movw <lineY1, <clipFrontY .drawModelJump3: jsr drawLineClip2D .drawModelJump0: dec <modelWireCount jne .drawModelLoop0 rts ;---------------------------- clipFront: ;clip front phx phy ldx <drawModelData0 ldy <drawModelData1 ;(128-Z0) to mul16a sec lda #SCREENZ sbc transform2DWork1+4, x sta <mul16a lda #0 sbc transform2DWork1+5, x sta <mul16a+1 ;(X1-X0) to mul16b sec lda transform2DWork1+0, y sbc transform2DWork1+0, x sta <mul16b lda transform2DWork1+1, y sbc transform2DWork1+1, x sta <mul16b+1 ;(128-Z0)*(X1-X0) to mul16d:mul16c jsr smul16 ;(Z1-Z0) to mul16a sec lda transform2DWork1+4, y sbc transform2DWork1+4, x sta <mul16a lda transform2DWork1+5, y sbc transform2DWork1+5, x sta <mul16a+1 ;(128-Z0)*(X1-X0)/(Z1-Z0) jsr sdiv32 ;(128-Z0)*(X1-X0)/(Z1-Z0)+X0 clc lda <mul16a adc transform2DWork1+0, x sta <clipFrontX lda <mul16a+1 adc transform2DWork1+1, x sta <clipFrontX+1 ;(128-Z0) to mul16a sec lda #SCREENZ sbc transform2DWork1+4, x sta <mul16a lda #0 sbc transform2DWork1+5, x sta <mul16a+1 ;(Y1-Y0) to mul16b sec lda transform2DWork1+2, y sbc transform2DWork1+2, x sta <mul16b lda transform2DWork1+3, y sbc transform2DWork1+3, x sta <mul16b+1 ;(128-Z0)*(Y1-Y0) to mul16d:mul16c jsr smul16 ;(Z1-Z0) to mul16a sec lda transform2DWork1+4, y sbc transform2DWork1+4, x sta <mul16a lda transform2DWork1+5, y sbc transform2DWork1+5, x sta <mul16a+1 ;(128-Z0)*(Y1-Y0)/(Z1-Z0) jsr sdiv32 ;(128-Z0)*(Y1-Y0)/(Z1-Z0)+Y0 clc lda <mul16a adc transform2DWork1+2, x sta <clipFrontY lda <mul16a+1 adc transform2DWork1+3, x sta <clipFrontY+1 ply plx rts ;---------------------------- copy2DWork0To2DWork1: ; ldx <vertexCount cly .copy2DWork0To2DWork1Loop: lda transform2DWork0, y sta transform2DWork1, y iny lda transform2DWork0, y sta transform2DWork1, y iny lda transform2DWork0, y sta transform2DWork1, y iny lda transform2DWork0, y sta transform2DWork1, y iny lda transform2DWork0, y sta transform2DWork1, y iny lda transform2DWork0, y sta transform2DWork1, y iny dex bne .copy2DWork0To2DWork1Loop rts ;---------------------------- vertexRotationSelect: ; and #3 cmp #3 beq .rotationSelectJump2 cmp #1 beq .rotationSelectJump11 bcs .rotationSelectJump12 .rotationSelectJump10: ldx <rotationX jsr vertexRotationX jmp .rotationSelectJump2 .rotationSelectJump11: ldx <rotationY jsr vertexRotationY jmp .rotationSelectJump2 .rotationSelectJump12: ldx <rotationZ jsr vertexRotationZ .rotationSelectJump2: rts ;---------------------------- vertexRotationZ: ;x=xcosA-ysinA y=xsinA+ycosA z=z ;transform2DWork0 => transform2DWork0 ;vertexCount = count ;x = angle cpx #0 jeq .vertexRotationZEnd lda <vertexCount jeq .vertexRotationZEnd sta <vertexCountWork cly .vertexRotationZLoop: ;---------------- lda transform2DWork0, y ;X0 sta <mul16a lda transform2DWork0+1, y sta <mul16a+1 lda cosDataLow, x ;cos sta <mul16b lda cosDataHigh, x sta <mul16b+1 jsr smul16 ;xcosA movq <div32ans, <mul16c lda transform2DWork0+2, y ;Y0 sta <mul16a lda transform2DWork0+3, y sta <mul16a+1 lda sinDataLow, x ;sin sta <mul16b lda sinDataHigh, x sta <mul16b+1 jsr smul16 ;ysinA subq <mul16c, <div32ans, <mul16c ;xcosA-ysinA asl <mul16c+1 rol <mul16d rol <mul16d+1 asl <mul16c+1 rol <mul16d rol <mul16d+1 lda <mul16d+1 pha lda <mul16d pha ;---------------- lda transform2DWork0, y ;X0 sta <mul16a lda transform2DWork0+1, y sta <mul16a+1 lda sinDataLow, x ;sin sta <mul16b lda sinDataHigh, x sta <mul16b+1 jsr smul16 ;xsinA movq <div32ans, <mul16c lda transform2DWork0+2, y ;Y0 sta <mul16a lda transform2DWork0+3, y sta <mul16a+1 lda cosDataLow, x ;cos sta <mul16b lda cosDataHigh, x sta <mul16b+1 jsr smul16 ;ycosA addq <mul16c, <div32ans, <mul16c ;xsinA+ycosA asl <mul16c+1 rol <mul16d rol <mul16d+1 asl <mul16c+1 rol <mul16d rol <mul16d+1 lda <mul16d sta transform2DWork0+2, y lda <mul16d+1 sta transform2DWork0+3, y ;---------------- pla sta transform2DWork0, y pla sta transform2DWork0+1, y ;---------------- clc tya adc #6 tay dec <vertexCountWork jne .vertexRotationZLoop .vertexRotationZEnd: rts ;---------------------------- vertexRotationY: ;x=xcosA-zsinA y=y z=xsinA+zcosA ;transform2DWork0 => transform2DWork0 ;vertexCount = count ;x = angle cpx #0 jeq .vertexRotationYEnd lda <vertexCount jeq .vertexRotationYEnd . sta <vertexCountWork cly .vertexRotationYLoop: ;---------------- lda transform2DWork0+4, y ;Z0 sta <mul16a lda transform2DWork0+5, y sta <mul16a+1 lda sinDataLow, x ;sin sta <mul16b lda sinDataHigh, x sta <mul16b+1 jsr smul16 ;zsinA movq <div32ans, <mul16c lda transform2DWork0, y ;X0 sta <mul16a lda transform2DWork0+1, y sta <mul16a+1 lda cosDataLow, x ;cos sta <mul16b lda cosDataHigh, x sta <mul16b+1 jsr smul16 ;xcosA subq <mul16c, <mul16c, <div32ans ;xcosA-zsinA asl <mul16c+1 rol <mul16d rol <mul16d+1 asl <mul16c+1 rol <mul16d rol <mul16d+1 lda <mul16d+1 pha lda <mul16d pha ;---------------------------- lda transform2DWork0+4, y ;Z0 sta <mul16a lda transform2DWork0+5, y sta <mul16a+1 lda cosDataLow, x ;cos sta <mul16b lda cosDataHigh, x sta <mul16b+1 jsr smul16 ;zcosA movq <div32ans, <mul16c lda transform2DWork0, y ;X0 sta <mul16a lda transform2DWork0+1, y sta <mul16a+1 lda sinDataLow, x ;sin sta <mul16b lda sinDataHigh, x sta <mul16b+1 jsr smul16 ;xsinA addq <mul16c, <div32ans, <mul16c ;zcosA+xsinA asl <mul16c+1 rol <mul16d rol <mul16d+1 asl <mul16c+1 rol <mul16d rol <mul16d+1 lda <mul16d sta transform2DWork0+4, y lda <mul16d+1 sta transform2DWork0+5, y ;---------------- pla sta transform2DWork0, y pla sta transform2DWork0+1, y ;---------------- clc tya adc #6 tay dec <vertexCountWork jne .vertexRotationYLoop .vertexRotationYEnd: rts ;---------------------------- vertexRotationX: ;x=x y=ycosA+zsinA z=-ysinA+zcosA ;transform2DWork0 => transform2DWork0 ;vertexCount = count ;x = angle cpx #0 jeq .vertexRotationXEnd lda <vertexCount jeq .vertexRotationXEnd sta <vertexCountWork cly .vertexRotationXLoop: ;---------------- lda transform2DWork0+2, y ;Y0 sta <mul16a lda transform2DWork0+3, y sta <mul16a+1 lda cosDataLow, x ;cos sta <mul16b lda cosDataHigh, x sta <mul16b+1 jsr smul16 ;ycosA movq <div32ans, <mul16c lda transform2DWork0+4, y ;Z0 sta <mul16a lda transform2DWork0+5, y sta <mul16a+1 lda sinDataLow, x ;sin sta <mul16b lda sinDataHigh, x sta <mul16b+1 jsr smul16 ;zsinA addq <mul16c, <div32ans, <mul16c ;ycosA+zsinA asl <mul16c+1 rol <mul16d rol <mul16d+1 asl <mul16c+1 rol <mul16d rol <mul16d+1 lda <mul16d+1 pha lda <mul16d pha ;---------------- lda transform2DWork0+2, y ;Y0 sta <mul16a lda transform2DWork0+3, y sta <mul16a+1 lda sinDataLow, x ;sin sta <mul16b lda sinDataHigh, x sta <mul16b+1 jsr smul16 ;ysinA movq <div32ans, <mul16c lda transform2DWork0+4, y ;Z0 sta <mul16a lda transform2DWork0+5, y sta <mul16a+1 lda cosDataLow, x ;cos sta <mul16b lda cosDataHigh, x sta <mul16b+1 jsr smul16 ;zcosA subq <mul16c, <mul16c, <div32ans ;-ysinA+zcosA asl <mul16c+1 rol <mul16d rol <mul16d+1 asl <mul16c+1 rol <mul16d rol <mul16d+1 lda <mul16d sta transform2DWork0+4, y lda <mul16d+1 sta transform2DWork0+5, y ;---------------- pla sta transform2DWork0+2, y pla sta transform2DWork0+3, y ;---------------- clc tya adc #6 tay dec <vertexCountWork jne .vertexRotationXLoop .vertexRotationXEnd: rts ;---------------------------- vertexTranslation2: ; lda <vertexCount beq .vertexTranslation2End sta <vertexCountWork cly .vertexTranslation2Loop: clc lda transform2DWork0, y adc <translationX sta transform2DWork0, y lda transform2DWork0+1, y adc <translationX+1 sta transform2DWork0+1, y clc lda transform2DWork0+2, y adc <translationY sta transform2DWork0+2, y lda transform2DWork0+3, y adc <translationY+1 sta transform2DWork0+3, y clc lda transform2DWork0+4, y adc <translationZ sta transform2DWork0+4, y lda transform2DWork0+5, y adc <translationZ+1 sta transform2DWork0+5, y clc tya adc #6 tay dec <vertexCountWork bne .vertexTranslation2Loop .vertexTranslation2End: rts ;---------------------------- transform2D2: ; ldx <vertexCount cly .transform2D2Loop0: lda transform2DWork0, y sta transform2DWork1, y lda transform2DWork0+1, y sta transform2DWork1+1, y lda transform2DWork0+2, y sta transform2DWork1+2, y lda transform2DWork0+3, y sta transform2DWork1+3, y lda transform2DWork0+4, y sta transform2DWork1+4, y lda transform2DWork0+5, y sta transform2DWork1+5, y ;Z0 < 128 check sec lda transform2DWork0+4, y ;Z0 sbc #SCREENZ lda transform2DWork0+5, y sbc #00 bmi .transform2D2Jump00 ;X0*128/Z0 ;screen z = 128 lda transform2DWork0, y ;X0 sta <mul16c lda transform2DWork0+1, y sta <mul16c+1 lda transform2DWork0+4, y ;Z0 sta <mul16a lda transform2DWork0+5, y sta <mul16a+1 jsr transform2DProc ;X0*128/Z0+centerX ;mul16a+centerX to X0 clc lda <mul16a adc <centerX sta transform2DWork0, y ;X0 lda <mul16a+1 adc <centerX+1 sta transform2DWork0+1, y ;Y0*128/Z0 ;screen z = 128 lda transform2DWork0+2, y ;Y0 sta <mul16c lda transform2DWork0+3, y sta <mul16c+1 lda transform2DWork0+4, y ;Z0 sta <mul16a lda transform2DWork0+5, y sta <mul16a+1 jsr transform2DProc ;Y0*128/Z0+centerY ;centerY-mul16a to Y0 sec lda <centerY sbc <mul16a sta transform2DWork0+2, y ;Y0 lda <centerY+1 sbc <mul16a+1 sta transform2DWork0+3, y jmp .transform2D2Jump01 .transform2D2Jump00: ;Z0<128 flag set lda #$00 sta transform2DWork0+4, y lda #$80 sta transform2DWork0+5, y .transform2D2Jump01: clc tya adc #6 tay dex jne .transform2D2Loop0 rts ;---------------------------- transform2DProc: ;mul16a(rough value) = (mul16c(-32768_32767) * 128 / mul16a(1_32767)) ;push y phy ;c sign lda <mul16c+1 pha bpl .jp00 ;c neg sec cla sbc <mul16c sta <mul16c cla sbc <mul16c+1 sta <mul16c+1 .jp00: stz <muladdr ;get div data ldy <div16a+1 clc lda umul16Bank, y adc #divdatBank-muldatBank ;carry clear sta <mulbank tam #$02 lda umul16Address, y sta <muladdr+1 ldy <div16a lda [muladdr], y sta <sqrt64a lda <mulbank adc #4 ;carry clear tam #$02 lda [muladdr], y sta <sqrt64a+1 lda <mulbank adc #8 ;carry clear tam #$02 lda [muladdr], y sta <sqrt64a+2 ;mul mul16c low byte ldy <mul16c lda umul16Bank, y sta <mulbank tam #$02 lda umul16Address, y sta <muladdr+1 ldy <sqrt64a lda [muladdr], y sta <sqrt64b ldy <sqrt64a+1 lda [muladdr], y sta <sqrt64b+1 ldy <sqrt64a+2 lda [muladdr], y sta <sqrt64b+2 lda <mulbank adc #8 ;carry clear tam #$02 ldy <sqrt64a lda [muladdr], y adc <sqrt64b+1 sta <sqrt64b+1 ldy <sqrt64a+1 lda [muladdr], y adc <sqrt64b+2 sta <sqrt64b+2 ldy <sqrt64a+2 lda [muladdr], y adc #0 ;carry clear sta <sqrt64b+3 ;mul mul16c high byte ldy <mul16c+1 lda umul16Bank, y sta <mulbank tam #$02 lda umul16Address, y sta <muladdr+1 ldy <sqrt64a lda [muladdr], y adc <sqrt64b+1 sta <sqrt64b+1 ldy <sqrt64a+1 lda [muladdr], y adc <sqrt64b+2 sta <sqrt64b+2 ldy <sqrt64a+2 lda [muladdr], y adc <sqrt64b+3 ;carry clear sta <sqrt64b+3 lda <mulbank adc #8 ;carry clear tam #$02 ldy <sqrt64a lda [muladdr], y adc <sqrt64b+2 sta <sqrt64b+2 ldy <sqrt64a+1 lda [muladdr], y adc <sqrt64b+3 sta <sqrt64b+3 movw <mul16a, <sqrt64b+2 pla bpl .jp01 ;ans neg sec cla sbc <mul16a sta <mul16a cla sbc <mul16a+1 sta <mul16a+1 .jp01: ;pull y ply rts ;---------------------------- moveToTransform2DWork0: ;vertex0Addr to Transform2DWork0 lda <vertexCount beq .moveToTransform2DWork0End sta <vertexCountWork cly .moveToTransform2DWork0Loop: lda [vertex0Addr], y sta transform2DWork0, y iny lda [vertex0Addr], y sta transform2DWork0, y iny lda [vertex0Addr], y sta transform2DWork0, y iny lda [vertex0Addr], y sta transform2DWork0, y iny lda [vertex0Addr], y sta transform2DWork0, y iny lda [vertex0Addr], y sta transform2DWork0, y iny dec <vertexCountWork bne .moveToTransform2DWork0Loop .moveToTransform2DWork0End: rts ;---------------------------- moveMatrix1ToMatrix0: ; tii matrix1, matrix0, 18 rts ;---------------------------- moveMatrix1ToMatrix2: ; tii matrix1, matrix2, 18 rts ;---------------------------- moveMatrix2ToMatrix0: ; tii matrix2, matrix0, 18 rts ;---------------------------- moveMatrix2ToEyeMatrix: ; tii matrix2, eyeMatrix, 18 rts ;---------------------------- moveEyeMatrixToMatrix2: ; tii eyeMatrix, matrix2, 18 rts ;---------------------------- setMatrix1RotationX: ; stz matrix1+0+0 lda #$40 sta matrix1+0+1 stz matrix1+0+2 stz matrix1+0+3 stz matrix1+0+4 stz matrix1+0+5 stz matrix1+6+0 stz matrix1+6+1 lda cosDataLow, x sta matrix1+6+2 lda cosDataHigh, x sta matrix1+6+3 clc lda sinDataLow, x eor #$FF adc #$01 sta matrix1+6+4 lda sinDataHigh, x eor #$FF adc #$00 sta matrix1+6+5 stz matrix1+12+0 stz matrix1+12+1 lda sinDataLow, x sta matrix1+12+2 lda sinDataHigh, x sta matrix1+12+3 lda cosDataLow, x sta matrix1+12+4 lda cosDataHigh, x sta matrix1+12+5 rts ;---------------------------- setMatrix1RotationY: ; lda cosDataLow, x sta matrix1+0+0 lda cosDataHigh, x sta matrix1+0+1 stz matrix1+0+2 stz matrix1+0+3 lda sinDataLow, x sta matrix1+0+4 lda sinDataHigh, x sta matrix1+0+5 stz matrix1+6+0 stz matrix1+6+1 stz matrix1+6+2 lda #$40 sta matrix1+6+3 stz matrix1+6+4 stz matrix1+6+5 clc lda sinDataLow, x eor #$FF adc #$01 sta matrix1+12+0 lda sinDataHigh, x eor #$FF adc #$00 sta matrix1+12+1 stz matrix1+12+2 stz matrix1+12+3 lda cosDataLow, x sta matrix1+12+4 lda cosDataHigh, x sta matrix1+12+5 rts ;---------------------------- setMatrix1RotationZ: ; lda cosDataLow, x sta matrix1+0+0 lda cosDataHigh, x sta matrix1+0+1 clc lda sinDataLow, x eor #$FF adc #$01 sta matrix1+0+2 lda sinDataHigh, x eor #$FF adc #$00 sta matrix1+0+3 stz matrix1+0+4 stz matrix1+0+5 lda sinDataLow, x sta matrix1+6+0 lda sinDataHigh, x sta matrix1+6+1 lda cosDataLow, x sta matrix1+6+2 lda cosDataHigh, x sta matrix1+6+3 stz matrix1+6+4 stz matrix1+6+5 stz matrix1+12+0 stz matrix1+12+1 stz matrix1+12+2 stz matrix1+12+3 stz matrix1+12+4 lda #$40 sta matrix1+12+5 rts ;---------------------------- vertexTranslation: ; .vertexTranslationLoop: cly clc lda [vertex0Addr], y adc <translationX sta [vertex1Addr], y iny lda [vertex0Addr], y adc <translationX+1 sta [vertex1Addr], y iny clc lda [vertex0Addr], y adc <translationY sta [vertex1Addr], y iny lda [vertex0Addr], y adc <translationY+1 sta [vertex1Addr], y iny clc lda [vertex0Addr], y adc <translationZ sta [vertex1Addr], y iny lda [vertex0Addr], y adc <translationZ+1 sta [vertex1Addr], y iny add <vertex0Addr, #6 bcc .vertexTranslationJump00 inc <vertex0Addr+1 .vertexTranslationJump00: add <vertex1Addr, #6 bcc .vertexTranslationJump01 inc <vertex1Addr+1 .vertexTranslationJump01: dec <vertexCount bne .vertexTranslationLoop rts ;---------------------------- vertexMultiply: ; .vertexMultiplyLoop2: clx .vertexMultiplyLoop1: stzq <vertexWork cly .vertexMultiplyLoop0: lda [vertex0Addr], y sta <mul16a iny lda [vertex0Addr], y sta <mul16a+1 iny lda matrix2, x sta <mul16b inx lda matrix2, x sta <mul16b+1 inx jsr smul16 addq <vertexWork, <mul16c, <vertexWork cpy #6 bne .vertexMultiplyLoop0 lda <vertexWork+2 asl <vertexWork+1 rol a rol <vertexWork+3 asl <vertexWork+1 rol a rol <vertexWork+3 sta [vertex1Addr] inc <vertex1Addr bne .vertexMultiplyJump00 inc <vertex1Addr+1 .vertexMultiplyJump00: lda <vertexWork+3 sta [vertex1Addr] inc <vertex1Addr bne .vertexMultiplyJump01 inc <vertex1Addr+1 .vertexMultiplyJump01: cpx #18 bne .vertexMultiplyLoop1 add <vertex0Addr, #6 bcc .vertexMultiplyJump02 inc <vertex0Addr+1 .vertexMultiplyJump02: dec <vertexCount bne .vertexMultiplyLoop2 rts ;---------------------------- matrixMultiply: ; stz vertex1Addr cly clx .matrixMultiplyLoop0: lda matrix0, x sta <mul16a lda matrix0+1, x sta <mul16a+1 lda matrix1, y sta <mul16b lda matrix1+1, y sta <mul16b+1 jsr smul16 movq <vertexWork, <mul16c ;---------------- lda matrix0+6, x sta <mul16a lda matrix0+7, x sta <mul16a+1 lda matrix1+2, y sta <mul16b lda matrix1+3, y sta <mul16b+1 jsr smul16 addq <vertexWork, <mul16c, <vertexWork ;---------------- lda matrix0+12, x sta <mul16a lda matrix0+13, x sta <mul16a+1 lda matrix1+4, y sta <mul16b lda matrix1+5, y sta <mul16b+1 jsr smul16 addq <vertexWork, <mul16c, <vertexWork ;---------------- lda <vertexWork+2 asl <vertexWork+1 rol a rol <vertexWork+3 asl <vertexWork+1 rol a rol <vertexWork+3 phx ldx <vertex1Addr sta matrix2, x inx lda <vertexWork+3 sta matrix2, x inx stx <vertex1Addr plx inx inx cpx #6 jne .matrixMultiplyLoop0 clx clc tya adc #6 tay cpy #18 jne .matrixMultiplyLoop0 rts ;---------------------------- transform2D: ; .transform2DLoop0: ;Z0 < 128 check ldy #$04 sec lda [vertex0Addr], y sbc #SCREENZ iny lda [vertex0Addr], y sbc #00 bmi .transform2DJump00 ;X0*128/Z0 ;screen z = 128 .transform2DJump05: ldy #$00 lda [vertex0Addr], y sta <mul16c iny lda [vertex0Addr], y sta <mul16c+1 ldy #$04 lda [vertex0Addr], y sta <mul16a iny lda [vertex0Addr], y sta <mul16a+1 jsr transform2DProc ;X0*128/Z0+centerX ;mul16a+centerX to vertex1Addr X0 ldy #$00 clc lda <mul16a adc <centerX sta [vertex1Addr], y iny lda <mul16a+1 adc <centerX+1 sta [vertex1Addr], y ;Y0*128/Z0 ;screen z = 128 ldy #$02 lda [vertex0Addr], y sta <mul16c iny lda [vertex0Addr], y sta <mul16c+1 ldy #$04 lda [vertex0Addr], y sta <mul16a iny lda [vertex0Addr], y sta <mul16a+1 jsr transform2DProc ;centerY-Y0*128/Z0 ;centerY-mul16a to vertex1Addr Y0 ldy #$02 sec lda <centerY sbc <mul16a sta [vertex1Addr], y iny lda <centerY+1 sbc <mul16a+1 sta [vertex1Addr], y ;Z0>=128 flag set ;Z0 set iny lda [vertex0Addr], y sta [vertex1Addr], y iny lda [vertex0Addr], y sta [vertex1Addr], y jmp .transform2DJump01 .transform2DJump00: ;Z0<128 flag set ldy #$04 lda #$00 sta [vertex1Addr], y iny lda #$80 sta [vertex1Addr], y .transform2DJump01: clc lda <vertex0Addr adc #$06 sta <vertex0Addr bcc .transform2DJump03 inc <vertex0Addr+1 .transform2DJump03: clc lda <vertex1Addr adc #$06 sta <vertex1Addr bcc .transform2DJump04 inc <vertex1Addr+1 .transform2DJump04: dec <vertexCount jne .transform2DLoop0 rts ;---------------------------- setLineColor: ; sta <lineColor rts ;---------------------------- initLineBuffer: ; stz <lineBufferCount movw lineBufferAddr, #lineBuffer rts ;---------------------------- putLineBuffer: ; lda <lineBufferCount beq .putLineBufferEnd movw lineBufferAddr, #lineBuffer .putLineBufferLoop: cly lda [lineBufferAddr], y sta <edgeX0 iny lda [lineBufferAddr], y sta <edgeY0 iny lda [lineBufferAddr], y sta <edgeX1 iny lda [lineBufferAddr], y sta <edgeY1 iny lda [lineBufferAddr], y jsr setLineColorData jsr calcEdge addwb lineBufferAddr, #LINEBUFFER_SIZE dec <lineBufferCount bne .putLineBufferLoop .putLineBufferEnd: rts ;---------------------------- setLineBuffer: ; cly lda <lineX0 sta [lineBufferAddr], y iny lda <lineY0 sta [lineBufferAddr], y iny lda <lineX1 sta [lineBufferAddr], y iny lda <lineY1 sta [lineBufferAddr], y iny lda <lineColor sta [lineBufferAddr], y addwb lineBufferAddr, #LINEBUFFER_SIZE inc <lineBufferCount rts ;---------------------------- drawLineClip2D: ; phx phy jsr clip2D bcs .drawLineClip2DEnd jsr setLineBuffer .drawLineClip2DEnd: ply plx rts ;---------------------------- clip2D: ; jsr clip2DX0 bcs .clip2DEnd jsr clip2DX255 bcs .clip2DEnd jsr clip2DY0 bcs .clip2DEnd jsr clip2DY255 bcs .clip2DEnd .clip2DEnd: rts ;---------------------------- clip2DX255: ; stz <clip2DFlag cmpw <lineX0, #$0100 bmi .clip2DX255Jump00 smb0 <clip2DFlag .clip2DX255Jump00: cmpw <lineX1, #$0100 bmi .clip2DX255Jump01 smb1 <clip2DFlag .clip2DX255Jump01: lda <clip2DFlag bne .clip2DX255Jump05 jmp .clip2DX255Jump02 .clip2DX255Jump05: cmp #$03 bne .clip2DX255Jump06 jmp .clip2DX255Jump03 .clip2DX255Jump06: ;(255-X0) to mul16a subw <mul16a, #255, <lineX0 ;(Y1-Y0) to mul16b subw <mul16b, <lineY1, <lineY0 ;(255-X0)*(Y1-Y0) to mul16d:mul16c jsr smul16 ;(X1-X0) to mul16a subw <mul16a, <lineX1, <lineX0 ;(255-X0)*(Y1-Y0)/(X1-X0) jsr sdiv32 ;(255-X0)*(Y1-Y0)/(X1-X0)+Y0 addw <mul16a, <lineY0 bbs1 <clip2DFlag, .clip2DX255Jump04 ;X0>255 X1<=255 movw <lineX0, #$00FF movw <lineY0, <mul16a bra .clip2DX255Jump02 .clip2DX255Jump04: ;X0<=255 X1>255 movw <lineX1, #$00FF movw <lineY1, <mul16a .clip2DX255Jump02: ;X0<=255 X1<=255 clc rts .clip2DX255Jump03: ;X0>255 X1>255 sec rts ;---------------------------- clip2DX0: ; stz <clip2DFlag lda <lineX0+1 bpl .clip2DX0Jump00 smb0 <clip2DFlag .clip2DX0Jump00: lda <lineX1+1 bpl .clip2DX0Jump01 smb1 <clip2DFlag .clip2DX0Jump01: lda <clip2DFlag bne .clip2DX0Jump05 jmp .clip2DX0Jump02 .clip2DX0Jump05: cmp #$03 bne .clip2DX0Jump06 jmp .clip2DX0Jump03 .clip2DX0Jump06: ;(0-X0) to mul16a subw <mul16a, #0, <lineX0 ;(Y1-Y0) to mul16b subw <mul16b, <lineY1, <lineY0 ;(0-X0)*(Y1-Y0) to mul16d:mul16c jsr smul16 ;(X1-X0) to mul16a subw <mul16a, <lineX1, <lineX0 ;(0-X0)*(Y1-Y0)/(X1-X0) jsr sdiv32 ;(0-X0)*(Y1-Y0)/(X1-X0)+Y0 addw <mul16a, <lineY0 bbs1 <clip2DFlag, .clip2DX0Jump04 ;X0<0 X1>=0 stzw <lineX0 movw <lineY0, <mul16a bra .clip2DX0Jump02 .clip2DX0Jump04: ;X0>=0 X1<0 stzw <lineX1 movw <lineY1, <mul16a .clip2DX0Jump02: ;X0>=0 X1>=0 clc rts .clip2DX0Jump03: ;X0<0 X1<0 sec rts ;---------------------------- clip2DY255: ; stz <clip2DFlag cmpw <lineY0, #192 bmi .clip2DY255Jump00 smb0 <clip2DFlag .clip2DY255Jump00: cmpw <lineY1, #192 bmi .clip2DY255Jump01 smb1 <clip2DFlag .clip2DY255Jump01: lda <clip2DFlag bne .clip2DY255Jump05 jmp .clip2DY255Jump02 .clip2DY255Jump05: cmp #$03 bne .clip2DY255Jump06 jmp .clip2DY255Jump03 .clip2DY255Jump06: ;(191-Y0) to mul16a subw <mul16a, #191, <lineY0 ;(X1-X0) to mul16b subw <mul16b, <lineX1, <lineX0 ;(191-Y0)*(X1-X0) to mul16d:mul16c jsr smul16 ;(Y1-Y0) to mul16a subw <mul16a, <lineY1, <lineY0 ;(191-Y0)*(X1-X0)/(Y1-Y0) jsr sdiv32 ;(191-Y0)*(X1-X0)/(Y1-Y0)+X0 addw <mul16a, <lineX0 bbs1 <clip2DFlag, .clip2DY255Jump04 ;Y0>191 Y1<=191 movw <lineX0, <mul16a movw <lineY0, #191 bra .clip2DY255Jump02 .clip2DY255Jump04: ;Y0<=191 Y1>191 movw <lineX1, <mul16a movw <lineY1, #191 .clip2DY255Jump02: ;Y0<=191 Y1<=191 clc rts .clip2DY255Jump03: ;Y0>191 Y1>191 sec rts ;---------------------------- clip2DY0: ; stz <clip2DFlag lda <lineY0+1 bpl .clip2DY0Jump00 smb0 <clip2DFlag .clip2DY0Jump00: lda <lineY1+1 bpl .clip2DY0Jump01 smb1 <clip2DFlag .clip2DY0Jump01: lda <clip2DFlag bne .clip2DY0Jump05 jmp .clip2DY0Jump02 .clip2DY0Jump05: cmp #$03 bne .clip2DY0Jump06 jmp .clip2DY0Jump03 .clip2DY0Jump06: ;(0-Y0) to mul16a subw <mul16a, #0, <lineY0 ;(X1-X0) to mul16b subw <mul16b, <lineX1, <lineX0 ;(0-Y0)*(X1-X0) to mul16d:mul16c jsr smul16 ;(Y1-Y0) to mul16a subw <mul16a, <lineY1, <lineY0 ;(0-Y0)*(X1-X0)/(Y1-Y0) jsr sdiv32 ;(0-Y0)*(X1-X0)/(Y1-Y0)+X0 addw <mul16a, <lineX0 bbs1 <clip2DFlag, .clip2DY0Jump04 ;Y0<0 Y1>=0 movw <lineX0, <mul16a stzw <lineY0 bra .clip2DY0Jump02 .clip2DY0Jump04: ;Y0>=0 Y1<0 movw <lineX1, <mul16a stzw <lineY1 .clip2DY0Jump02: ;Y0>=0 Y1>=0 clc rts .clip2DY0Jump03: ;Y0<0 Y1<0 sec rts ;---------------------------- calcEdge: ;calculation edge ;compare edgeY0 edgeY1 lda <edgeY1 cmp <edgeY0 beq .edgeJump6 bcs .edgeJump7 ;edgeY0 > edgeY1 exchange X0 X1 Y0 Y1 lda <edgeX0 ldx <edgeX1 sta <edgeX1 stx <edgeX0 lda <edgeY0 ldx <edgeY1 sta <edgeY1 stx <edgeY0 jmp .edgeJump7 .edgeJump6: ;edgeY0 = edgeY1 ldy <edgeY0 lda <edgeX0 cmp <edgeX1 bcs .edgeJump10 sta <wireLineX0 mov <wireLineX1, <edgeX1 jsr putHorizontalLine rts .edgeJump10: sta <wireLineX1 mov <wireLineX0, <edgeX1 jsr putHorizontalLine rts .edgeJump7: ;calculation edge X sign sec lda <edgeX1 sbc <edgeX0 bcs .edgeJump0 eor #$FF inc a sta <edgeSlopeX stz <edgeSlopeX+1 mov <edgeSignX, #$FF bra .edgeJump1 .edgeJump0: sta <edgeSlopeX stz <edgeSlopeX+1 lda #$01 sta <edgeSignX .edgeJump1: ;calculation edge Y sign sec lda <edgeY1 sbc <edgeY0 sta <edgeSlopeY stz <edgeSlopeY+1 .edgeJump3: ;edgeSlope compare lda <edgeSlopeY cmp <edgeSlopeX bcs .edgeJump4 ;edgeSlopeX > edgeSlopeY ;edgeSlopeTemp initialize lda <edgeSlopeX eor #$FF inc a ;check edgeSignX bbs7 <edgeSignX, .edgeXLoop4Jump2 ;edgeSignX plus ldx <edgeX0 ldy <edgeY0 stx <wireLineX0 .edgeXLoop0: cpx <edgeX1 beq .edgeXLoop0Jump0 adc <edgeSlopeY bcs .edgeXLoop0Jump1 inx bra .edgeXLoop0 .edgeXLoop0Jump1: sbc <edgeSlopeX stx <wireLineX1 jsr putHorizontalLine inx stx <wireLineX0 iny bra .edgeXLoop0 .edgeXLoop0Jump0: stx <wireLineX1 jsr putHorizontalLine rts ;edgeSignX minus .edgeXLoop4Jump2: ldx <edgeX0 ldy <edgeY0 stx <wireLineX1 .edgeXLoop4: cpx <edgeX1 beq .edgeXLoop4Jump0 clc adc <edgeSlopeY bcs .edgeXLoop4Jump1 dex bra .edgeXLoop4 .edgeXLoop4Jump1: sbc <edgeSlopeX stx <wireLineX0 jsr putHorizontalLine dex stx <wireLineX1 iny bra .edgeXLoop4 .edgeXLoop4Jump0: stx <wireLineX0 jsr putHorizontalLine rts ;;;;-------------------------------- ;;;;edgeSignX minus ;;;.edgeXLoop4Jump2: ;;;;exchange X0 X1 Y0 Y1 ;;; ldy <edgeY0 ;;; ldx <edgeY1 ;;; sty <edgeY1 ;;; stx <edgeY0 ;;; ;;; ldy <edgeX0 ;;; ldx <edgeX1 ;;; sty <edgeX1 ;;; stx <edgeX0 ;;; ;;; ldy <edgeY0 ;;; stx <wireLineX0 ;;;.edgeXLoop4: ;;; cpx <edgeX1 ;;; beq .edgeXLoop4Jump0 ;;; ;;; adc <edgeSlopeY ;;; bcs .edgeXLoop4Jump1 ;;; ;;; inx ;;; bra .edgeXLoop4 ;;; ;;;.edgeXLoop4Jump1: ;;; sbc <edgeSlopeX ;;; ;;; stx <wireLineX1 ;;; jsr putHorizontalLine ;;; ;;; inx ;;; stx <wireLineX0 ;;; dey ;;; bra .edgeXLoop4 ;;; ;;;.edgeXLoop4Jump0: ;;; stx <wireLineX1 ;;; jsr putHorizontalLine ;;; ;;; rts ;;;;-------------------------------- .edgeJump4: ;edgeSlopeY >= edgeSlopeX ;set mask lda <edgeX0 and #$07 tax lda wireLinePixelDatas, x sta <CHMask lda wireLinePixelMasks, x sta <CHNegMask lda <CH0Data and <CHMask sta <CH0 lda <CH1Data and <CHMask sta <CH1 ;edgeSlopeTemp initialize lda <edgeSlopeY eor #$FF inc a ldx <edgeX0 ldy <edgeY0 stz <wireLineCount ;check edgeSignX bbs7 <edgeSignX, .edgeYLoop4Jump2 ;edgeSignX plus pha lda <CH0Data and #$80 sta <CH0Work lda <CH1Data and #$80 sta <CH1Work pla .edgeYLoop0: inc <wireLineCount cpy <edgeY1 beq .edgeYLoop0Jump0 iny adc <edgeSlopeX bcc .edgeYLoop0 sbc <edgeSlopeY inx jsr putVerticalLine stx <edgeX0 sty <edgeY0 sec ror <CHNegMask bcc .edgeYLoop0Jump1 lsr <CH0 lsr <CH1 bra .edgeYLoop0 .edgeYLoop0Jump1: pha lda #$7F sta <CHNegMask lda <CH0Work sta <CH0 lda <CH1Work sta <CH1 pla bra .edgeYLoop0 .edgeYLoop0Jump0: jsr putVerticalLine rts .edgeYLoop4Jump2: ;edgeSignX minus pha lda <CH0Data and #$01 sta <CH0Work lda <CH1Data and #$01 sta <CH1Work pla .edgeYLoop4: inc <wireLineCount cpy <edgeY1 beq .edgeYLoop4Jump0 iny adc <edgeSlopeX bcc .edgeYLoop4 sbc <edgeSlopeY dex jsr putVerticalLine stx <edgeX0 sty <edgeY0 sec rol <CHNegMask bcc .edgeYLoop4Jump1 asl <CH0 asl <CH1 bra .edgeYLoop4 .edgeYLoop4Jump1: pha lda #$FE sta <CHNegMask lda <CH0Work sta <CH0 lda <CH1Work sta <CH1 pla bra .edgeYLoop4 .edgeYLoop4Jump0: jsr putVerticalLine rts ;---------------------------- putVerticalLine: ; pha phx phy ldx <edgeX0 ldy <edgeY0 lda wireLineAddrConvXLow0, x sta <setVramChrAddr ora wireLineAddrConvYLow0, y pha lda wireLineAddrConvXHigh0, x ora <wireBGAddr sta <setVramChrAddr+1 ora wireLineAddrConvYHigh0, y tax tya and #$07 eor #$07 inc a tay pla sei .jp00: ;set write addr st0 #$00 sta VDC_2 stx VDC_3 ;set read addr st0 #$01 sta VDC_2 stx VDC_3 .loop00: ;read st0 #$02 lda VDC_2 and <CHNegMask ora <CH0 tax lda VDC_3 and <CHNegMask ora <CH1 ;write stx VDC_2 sta VDC_3 dec <wireLineCount beq .jpEnd inc <edgeY0 dey bne .loop00 ldy <edgeY0 lda wireLineAddrConvYLow0, y ora <setVramChrAddr pha lda wireLineAddrConvYHigh0, y ora <setVramChrAddr+1 tax pla ldy #8 bra .jp00 .jpEnd: cli ply plx pla rts ;---------------------------- putPixel: ; phx lda wireLineAddrConvYLow0, y ora wireLineAddrConvXLow0, x sta <setVramChrAddr lda wireLineAddrConvYHigh0, y ora wireLineAddrConvXHigh0, x ora <wireBGAddr sta <setVramChrAddr+1 txa and #$07 tax lda wireLinePixelDatas, x sta <CHMask lda wireLinePixelMasks, x sta <CHNegMask ;put pixel sei ;first addr lda <setVramChrAddr ldx <setVramChrAddr+1 ;set write first addr st0 #$00 sta VDC_2 stx VDC_3 ;set read first addr st0 #$01 sta VDC_2 stx VDC_3 ;read st0 #$02 lda VDC_2 and <CHNegMask sta <CH0 lda <CH0Data and <CHMask ora <CH0 tax lda VDC_3 and <CHNegMask sta <CH1 lda <CH1Data and <CHMask ora <CH1 ;write stx VDC_2 sta VDC_3 cli plx rts ;---------------------------- putHorizontalLine: ; ;calation vram address pha phx ;left ldx <wireLineX0 lda wireLineAddrConvYLow0, y ora wireLineAddrConvXLow0, x sta <wireLineLeftAddr lda wireLineAddrConvYHigh0, y ora wireLineAddrConvXHigh0, x ora <wireBGAddr sta <wireLineLeftAddr+1 lda wireLineAddrConvX, x sta <wireLineCount txa and #$07 tax lda wireLineLeftDatas, x sta <wireLineLeftData lda wireLineLeftMasks, x sta <wireLineLeftMask ;right ldx <wireLineX1 lda wireLineAddrConvYLow0, y ora wireLineAddrConvXLow0, x sta <wireLineRightAddr lda wireLineAddrConvYHigh0, y ora wireLineAddrConvXHigh0, x ora <wireBGAddr sta <wireLineRightAddr+1 sec lda wireLineAddrConvX, x sbc <wireLineCount sta <wireLineCount txa and #$07 tax lda wireLineRightDatas, x sta <wireLineRightData lda wireLineRightMasks, x sta <wireLineRightMask lda <wireLineCount beq .wireLineJump03 jsr putHorizontalLineProc jsr putHorizontalLineProcLeft jsr putHorizontalLineProcRight bra .wireLineJump04 .wireLineJump03: lda <wireLineLeftData and <wireLineRightData sta <wireLineLeftData eor #$FF sta <wireLineLeftMask jsr putHorizontalLineProcLeft .wireLineJump04: plx pla rts ;---------------------------- putHorizontalLineProcLeft: ;put left horizontal line ;first addr lda <wireLineLeftAddr ldx <wireLineLeftAddr+1 ;put pixel sei ;set write first addr st0 #$00 sta VDC_2 stx VDC_3 ;set read first addr st0 #$01 sta VDC_2 stx VDC_3 ;read st0 #$02 lda VDC_2 and <wireLineLeftMask sta <CH0 lda <CH0Data and <wireLineLeftData ora <CH0 tax lda VDC_3 and <wireLineLeftMask sta <CH1 lda <CH1Data and <wireLineLeftData ora <CH1 ;write stx VDC_2 sta VDC_3 cli rts ;---------------------------- putHorizontalLineProcRight: ;put right horizontal line ;first addr lda <wireLineRightAddr ldx <wireLineRightAddr+1 ;put pixel sei ;set write first addr st0 #$00 sta VDC_2 stx VDC_3 ;set read first addr st0 #$01 sta VDC_2 stx VDC_3 ;read st0 #$02 lda VDC_2 and <wireLineRightMask sta <CH0 lda <CH0Data and <wireLineRightData ora <CH0 tax lda VDC_3 and <wireLineRightMask sta <CH1 lda <CH1Data and <wireLineRightData ora <CH1 ;write stx VDC_2 sta VDC_3 cli rts ;---------------------------- putHorizontalLineProc: ;put left to right horizontal line add <setVramChrAddr, <wireLineLeftAddr, #$10 lda <wireLineLeftAddr+1 bcc .putHorizontalLineProcJump inc a .putHorizontalLineProcJump: sta <setVramChrAddr+1 ldx <wireLineCount .putHorizontalLineProcLoop: dex beq .putHorizontalLineProcEnd ;put pixel sei st0 #$00 lda <setVramChrAddr sta VDC_2 lda <setVramChrAddr+1 sta VDC_3 st0 #$02 mov VDC_2, <CH0Data mov VDC_3, <CH1Data cli add <setVramChrAddr, #$10 bcc .putHorizontalLineProcLoop inc <setVramChrAddr+1 bra .putHorizontalLineProcLoop .putHorizontalLineProcEnd: rts ;---------------------------- clearBG: ;clear BG BAT st0 #$00 st1 #$00 st2 #$00 st0 #$02 ldy #64 .clearbatloop8: ldx #32 .clearbatloop9: ;set char$00 st1 #$00 st2 #$01 dex bne .clearbatloop9 dey bne .clearbatloop8 ;clear BG0 BAT ;y<96 movw <clearBGWork, #$2000+CHRBG0Addr*16 st0 #$00 st1 #$00 st2 #$00 st0 #$02 ldy #12 .clearbatloop0: ldx #32 .clearbatloop1: movw VDC_2, <clearBGWork addw <clearBGWork, #1 dex bne .clearbatloop1 dey bne .clearbatloop0 ;y>=96 movw <clearBGWork, #$3000+CHRBG0Addr*16 st0 #$00 st1 #$80 st2 #$01 st0 #$02 ldy #12 .clearbatloop0B: ldx #32 .clearbatloop1B: movw VDC_2, <clearBGWork addw <clearBGWork, #1 dex bne .clearbatloop1B dey bne .clearbatloop0B ;clear BG1 BAT ;y<96 movw <clearBGWork, #$2000+CHRBG1Addr*16 st0 #$00 st1 #$00 st2 #$04 st0 #$02 ldy #12 .clearbatloop2: ldx #32 .clearbatloop3: movw VDC_2, <clearBGWork addw <clearBGWork, #1 dex bne .clearbatloop3 dey bne .clearbatloop2 ;y>=96 movw <clearBGWork, #$3000+CHRBG1Addr*16 st0 #$00 st1 #$80 st2 #$05 st0 #$02 ldy #12 .clearbatloop2B: ldx #32 .clearbatloop3B: movw VDC_2, <clearBGWork addw <clearBGWork, #1 dex bne .clearbatloop3B dey bne .clearbatloop2B rts ;---------------------------- calcUnitVector: ;unitVectorX, unitVectorY, unitVectorZ ;sqrt64a+4 = unitVectorX * unitVectorX lda unitVectorX sta <mul16a sta <mul16b lda unitVectorX+1 sta <mul16a+1 sta <mul16b+1 jsr smul16 movq sqrt64a+4, <mul16c ;sqrt64a+4 += unitVectorY * unitVectorY lda unitVectorY sta <mul16a sta <mul16b lda unitVectorY+1 sta <mul16a+1 sta <mul16b+1 jsr smul16 addq sqrt64a+4, <mul16c ;sqrt64a+4 += unitVectorZ * unitVectorZ lda unitVectorZ sta <mul16a sta <mul16b lda unitVectorZ+1 sta <mul16a+1 sta <mul16b+1 jsr smul16 addq sqrt64a+4, <mul16c ;sqrt stzq sqrt64a jsr sqrt64 ;unitVectorX / sqrt stzq div64a lda unitVectorX sta div64a+4 lda unitVectorX+1 sta div64a+5 bpl .calcUnitJump0 movw div64a+6, #$FFFF bra .calcUnitJump1 .calcUnitJump0: stzw div64a+6 .calcUnitJump1: movq <div16a, <sqrt64ans jsr sdiv64 movq unitVectorX, <div16a ;unitVectorY / sqrt stzq div64a lda unitVectorY sta div64a+4 lda unitVectorY+1 sta div64a+5 bpl .calcUnitJump2 movw div64a+6, #$FFFF bra .calcUnitJump3 .calcUnitJump2: stzw div64a+6 .calcUnitJump3: movq <div16a, <sqrt64ans jsr sdiv64 movq unitVectorY, <div16a ;unitVectorZ / sqrt stzq div64a lda unitVectorZ sta div64a+4 lda unitVectorZ+1 sta div64a+5 bpl .calcUnitJump4 movw div64a+6, #$FFFF bra .calcUnitJump5 .calcUnitJump4: stzw div64a+6 .calcUnitJump5: movq <div16a, <sqrt64ans jsr sdiv64 movq unitVectorZ, <div16a rts ;---------------------------- atan: ;mul16a = x(-32768_32767), mul16b = y(-32768_32767) ;A(0_255) = atan(y/x) phx lda <mul16b+1 pha bpl .atanJump0 sec lda <mul16b eor #$FF adc #0 sta <mul16b lda <mul16b+1 eor #$FF adc #0 sta <mul16b+1 .atanJump0: lda <mul16a+1 pha bpl .atanJump1 sec lda <mul16a eor #$FF adc #0 sta <mul16a lda <mul16a+1 eor #$FF adc #0 sta <mul16a+1 .atanJump1: jsr _atan plx bpl .atanJump2 eor #$FF inc a eor #$80 .atanJump2: plx bpl .atanJump3 eor #$FF inc a .atanJump3: plx rts ;---------------------------- _atan: ;mul16a = x(0_65535), mul16b = y(0_65535) ;A(0_63) = atan(y/x) phx lda <mul16a ora <mul16a+1 beq .atanJump0 stz <mul16c lda <mul16b sta <mul16c+1 lda <mul16b+1 sta <mul16d stz <mul16d+1 asl <mul16c+1 rol <mul16d rol <mul16d+1 sec lda <mul16d sbc <mul16a lda <mul16d+1 sbc <mul16a+1 bcs .atanJump0 jsr udiv32 clx .atanLoop: sec lda atanDataLow, x sbc <div16a lda atanDataHigh, x sbc <div16a+1 bcs .atanJump1 inx cpx #64 bne .atanLoop .atanJump1: txa bra .atanEnd .atanJump0: lda #64 .atanEnd: plx rts ;---------------------------- signExt: ;a(sign extension) = a bpl .convPositive lda #$FF bra .convEnd .convPositive: cla .convEnd: rts ;---------------------------- puthex: ; pha phx phy sta <puthexdata stz <puthexaddr sty <puthexaddr+1 lsr <puthexaddr+1 ror <puthexaddr lsr <puthexaddr+1 ror <puthexaddr lsr <puthexaddr+1 ror <puthexaddr txa ora <puthexaddr sta <puthexaddr lda <wireBGAddr cmp #CHRBG1Addr bne .putHexJump0 clc lda <puthexaddr+1 adc #$04 sta <puthexaddr+1 .putHexJump0: lda <puthexdata lsr a lsr a lsr a lsr a jsr numtochar tax lda <puthexdata and #$0F jsr numtochar stz VDC_0 ldy <puthexaddr sty VDC_2 ldy <puthexaddr+1 sty VDC_3 ldy #$02 sty VDC_0 stx VDC_2 ldy #$01 sty VDC_3 sta VDC_2 sty VDC_3 ply plx pla rts ;---------------------------- wireLineAddrConvYLow0: .db $00, $01, $02, $03, $04, $05, $06, $07, $00, $01, $02, $03, $04, $05, $06, $07,\ $00, $01, $02, $03, $04, $05, $06, $07, $00, $01, $02, $03, $04, $05, $06, $07,\ $00, $01, $02, $03, $04, $05, $06, $07, $00, $01, $02, $03, $04, $05, $06, $07,\ $00, $01, $02, $03, $04, $05, $06, $07, $00, $01, $02, $03, $04, $05, $06, $07,\ $00, $01, $02, $03, $04, $05, $06, $07, $00, $01, $02, $03, $04, $05, $06, $07,\ $00, $01, $02, $03, $04, $05, $06, $07, $00, $01, $02, $03, $04, $05, $06, $07,\ $08, $09, $0A, $0B, $0C, $0D, $0E, $0F, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F,\ $08, $09, $0A, $0B, $0C, $0D, $0E, $0F, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F,\ $08, $09, $0A, $0B, $0C, $0D, $0E, $0F, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F,\ $08, $09, $0A, $0B, $0C, $0D, $0E, $0F, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F,\ $08, $09, $0A, $0B, $0C, $0D, $0E, $0F, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F,\ $08, $09, $0A, $0B, $0C, $0D, $0E, $0F, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F ;---------------------------- wireLineAddrConvYHigh0: .db $00, $00, $00, $00, $00, $00, $00, $00, $02, $02, $02, $02, $02, $02, $02, $02,\ $04, $04, $04, $04, $04, $04, $04, $04, $06, $06, $06, $06, $06, $06, $06, $06,\ $08, $08, $08, $08, $08, $08, $08, $08, $0A, $0A, $0A, $0A, $0A, $0A, $0A, $0A,\ $0C, $0C, $0C, $0C, $0C, $0C, $0C, $0C, $0E, $0E, $0E, $0E, $0E, $0E, $0E, $0E,\ $10, $10, $10, $10, $10, $10, $10, $10, $12, $12, $12, $12, $12, $12, $12, $12,\ $14, $14, $14, $14, $14, $14, $14, $14, $16, $16, $16, $16, $16, $16, $16, $16,\ $00, $00, $00, $00, $00, $00, $00, $00, $02, $02, $02, $02, $02, $02, $02, $02,\ $04, $04, $04, $04, $04, $04, $04, $04, $06, $06, $06, $06, $06, $06, $06, $06,\ $08, $08, $08, $08, $08, $08, $08, $08, $0A, $0A, $0A, $0A, $0A, $0A, $0A, $0A,\ $0C, $0C, $0C, $0C, $0C, $0C, $0C, $0C, $0E, $0E, $0E, $0E, $0E, $0E, $0E, $0E,\ $10, $10, $10, $10, $10, $10, $10, $10, $12, $12, $12, $12, $12, $12, $12, $12,\ $14, $14, $14, $14, $14, $14, $14, $14, $16, $16, $16, $16, $16, $16, $16, $16 ;---------------------------- wireLineAddrConvXLow0: .db $00, $00, $00, $00, $00, $00, $00, $00, $10, $10, $10, $10, $10, $10, $10, $10,\ $20, $20, $20, $20, $20, $20, $20, $20, $30, $30, $30, $30, $30, $30, $30, $30,\ $40, $40, $40, $40, $40, $40, $40, $40, $50, $50, $50, $50, $50, $50, $50, $50,\ $60, $60, $60, $60, $60, $60, $60, $60, $70, $70, $70, $70, $70, $70, $70, $70,\ $80, $80, $80, $80, $80, $80, $80, $80, $90, $90, $90, $90, $90, $90, $90, $90,\ $A0, $A0, $A0, $A0, $A0, $A0, $A0, $A0, $B0, $B0, $B0, $B0, $B0, $B0, $B0, $B0,\ $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $D0, $D0, $D0, $D0, $D0, $D0, $D0, $D0,\ $E0, $E0, $E0, $E0, $E0, $E0, $E0, $E0, $F0, $F0, $F0, $F0, $F0, $F0, $F0, $F0,\ $00, $00, $00, $00, $00, $00, $00, $00, $10, $10, $10, $10, $10, $10, $10, $10,\ $20, $20, $20, $20, $20, $20, $20, $20, $30, $30, $30, $30, $30, $30, $30, $30,\ $40, $40, $40, $40, $40, $40, $40, $40, $50, $50, $50, $50, $50, $50, $50, $50,\ $60, $60, $60, $60, $60, $60, $60, $60, $70, $70, $70, $70, $70, $70, $70, $70,\ $80, $80, $80, $80, $80, $80, $80, $80, $90, $90, $90, $90, $90, $90, $90, $90,\ $A0, $A0, $A0, $A0, $A0, $A0, $A0, $A0, $B0, $B0, $B0, $B0, $B0, $B0, $B0, $B0,\ $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $D0, $D0, $D0, $D0, $D0, $D0, $D0, $D0,\ $E0, $E0, $E0, $E0, $E0, $E0, $E0, $E0, $F0, $F0, $F0, $F0, $F0, $F0, $F0, $F0 ;---------------------------- wireLineAddrConvXHigh0: .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01,\ $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01,\ $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01,\ $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01,\ $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01,\ $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01,\ $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01,\ $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01 ;---------------------------- wireLineAddrConvX: .db $00, $00, $00, $00, $00, $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01,\ $02, $02, $02, $02, $02, $02, $02, $02, $03, $03, $03, $03, $03, $03, $03, $03,\ $04, $04, $04, $04, $04, $04, $04, $04, $05, $05, $05, $05, $05, $05, $05, $05,\ $06, $06, $06, $06, $06, $06, $06, $06, $07, $07, $07, $07, $07, $07, $07, $07,\ $08, $08, $08, $08, $08, $08, $08, $08, $09, $09, $09, $09, $09, $09, $09, $09,\ $0A, $0A, $0A, $0A, $0A, $0A, $0A, $0A, $0B, $0B, $0B, $0B, $0B, $0B, $0B, $0B,\ $0C, $0C, $0C, $0C, $0C, $0C, $0C, $0C, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,\ $0E, $0E, $0E, $0E, $0E, $0E, $0E, $0E, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F,\ $10, $10, $10, $10, $10, $10, $10, $10, $11, $11, $11, $11, $11, $11, $11, $11,\ $12, $12, $12, $12, $12, $12, $12, $12, $13, $13, $13, $13, $13, $13, $13, $13,\ $14, $14, $14, $14, $14, $14, $14, $14, $15, $15, $15, $15, $15, $15, $15, $15,\ $16, $16, $16, $16, $16, $16, $16, $16, $17, $17, $17, $17, $17, $17, $17, $17,\ $18, $18, $18, $18, $18, $18, $18, $18, $19, $19, $19, $19, $19, $19, $19, $19,\ $1A, $1A, $1A, $1A, $1A, $1A, $1A, $1A, $1B, $1B, $1B, $1B, $1B, $1B, $1B, $1B,\ $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1D, $1D, $1D, $1D, $1D, $1D, $1D, $1D,\ $1E, $1E, $1E, $1E, $1E, $1E, $1E, $1E, $1F, $1F, $1F, $1F, $1F, $1F, $1F, $1F ;---------------------------- wireLinePixelDatas: .db $80, $40, $20, $10, $08, $04, $02, $01 ;---------------------------- wireLinePixelMasks: .db $7F, $BF, $DF, $EF, $F7, $FB, $FD, $FE ;---------------------------- wireLineLeftDatas: .db $FF, $7F, $3F, $1F, $0F, $07, $03, $01 ;---------------------------- wireLineLeftMasks: .db $00, $80, $C0, $E0, $F0, $F8, $FC, $FE ;---------------------------- wireLineRightDatas: .db $80, $C0, $E0, $F0, $F8, $FC, $FE, $FF ;---------------------------- wireLineRightMasks: .db $7F, $3F, $1F, $0F, $07, $03, $01, $00 ;---------------------------- wireLineColorData0: .db $00, $FF, $00, $FF ;---------------------------- wireLineColorData1: .db $00, $00, $FF, $FF ;---------------------------- sinDataHigh: ;sin * 16384 .db $00, $01, $03, $04, $06, $07, $09, $0A, $0C, $0E, $0F, $11, $12, $14, $15, $17,\ $18, $19, $1B, $1C, $1E, $1F, $20, $22, $23, $24, $26, $27, $28, $29, $2A, $2C,\ $2D, $2E, $2F, $30, $31, $32, $33, $34, $35, $36, $36, $37, $38, $39, $39, $3A,\ $3B, $3B, $3C, $3C, $3D, $3D, $3E, $3E, $3E, $3F, $3F, $3F, $3F, $3F, $3F, $3F,\ $40, $3F, $3F, $3F, $3F, $3F, $3F, $3F, $3E, $3E, $3E, $3D, $3D, $3C, $3C, $3B,\ $3B, $3A, $39, $39, $38, $37, $36, $36, $35, $34, $33, $32, $31, $30, $2F, $2E,\ $2D, $2C, $2A, $29, $28, $27, $26, $24, $23, $22, $20, $1F, $1E, $1C, $1B, $19,\ $18, $17, $15, $14, $12, $11, $0F, $0E, $0C, $0A, $09, $07, $06, $04, $03, $01,\ $00, $FE, $FC, $FB, $F9, $F8, $F6, $F5, $F3, $F1, $F0, $EE, $ED, $EB, $EA, $E8,\ $E7, $E6, $E4, $E3, $E1, $E0, $DF, $DD, $DC, $DB, $D9, $D8, $D7, $D6, $D5, $D3,\ $D2, $D1, $D0, $CF, $CE, $CD, $CC, $CB, $CA, $C9, $C9, $C8, $C7, $C6, $C6, $C5,\ $C4, $C4, $C3, $C3, $C2, $C2, $C1, $C1, $C1, $C0, $C0, $C0, $C0, $C0, $C0, $C0,\ $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C1, $C1, $C1, $C2, $C2, $C3, $C3, $C4,\ $C4, $C5, $C6, $C6, $C7, $C8, $C9, $C9, $CA, $CB, $CC, $CD, $CE, $CF, $D0, $D1,\ $D2, $D3, $D5, $D6, $D7, $D8, $D9, $DB, $DC, $DD, $DF, $E0, $E1, $E3, $E4, $E6,\ $E7, $E8, $EA, $EB, $ED, $EE, $F0, $F1, $F3, $F5, $F6, $F8, $F9, $FB, $FC, $FE ;---------------------------- sinDataLow: ;sin * 16384 .db $00, $92, $24, $B5, $46, $D6, $64, $F1, $7C, $06, $8D, $12, $94, $13, $90, $09,\ $7E, $EF, $5D, $C6, $2B, $8C, $E7, $3D, $8E, $DA, $20, $60, $9A, $CE, $FB, $21,\ $41, $5A, $6C, $76, $79, $74, $68, $53, $37, $12, $E5, $B0, $71, $2B, $DB, $82,\ $21, $B6, $42, $C5, $3F, $AF, $15, $72, $C5, $0F, $4F, $85, $B1, $D4, $EC, $FB,\ $00, $FB, $EC, $D4, $B1, $85, $4F, $0F, $C5, $72, $15, $AF, $3F, $C5, $42, $B6,\ $21, $82, $DB, $2B, $71, $B0, $E5, $12, $37, $53, $68, $74, $79, $76, $6C, $5A,\ $41, $21, $FB, $CE, $9A, $60, $20, $DA, $8E, $3D, $E7, $8C, $2B, $C6, $5D, $EF,\ $7E, $09, $90, $13, $94, $12, $8D, $06, $7C, $F1, $64, $D6, $46, $B5, $24, $92,\ $00, $6E, $DC, $4B, $BA, $2A, $9C, $0F, $84, $FA, $73, $EE, $6C, $ED, $70, $F7,\ $82, $11, $A3, $3A, $D5, $74, $19, $C3, $72, $26, $E0, $A0, $66, $32, $05, $DF,\ $BF, $A6, $94, $8A, $87, $8C, $98, $AD, $C9, $EE, $1B, $50, $8F, $D5, $25, $7E,\ $DF, $4A, $BE, $3B, $C1, $51, $EB, $8E, $3B, $F1, $B1, $7B, $4F, $2C, $14, $05,\ $00, $05, $14, $2C, $4F, $7B, $B1, $F1, $3B, $8E, $EB, $51, $C1, $3B, $BE, $4A,\ $DF, $7E, $25, $D5, $8F, $50, $1B, $EE, $C9, $AD, $98, $8C, $87, $8A, $94, $A6,\ $BF, $DF, $05, $32, $66, $A0, $E0, $26, $72, $C3, $19, $74, $D5, $3A, $A3, $11,\ $82, $F7, $70, $ED, $6C, $EE, $73, $FA, $84, $0F, $9C, $2A, $BA, $4B, $DC, $6E ;---------------------------- cosDataHigh: ;cos * 16384 .db $40, $3F, $3F, $3F, $3F, $3F, $3F, $3F, $3E, $3E, $3E, $3D, $3D, $3C, $3C, $3B,\ $3B, $3A, $39, $39, $38, $37, $36, $36, $35, $34, $33, $32, $31, $30, $2F, $2E,\ $2D, $2C, $2A, $29, $28, $27, $26, $24, $23, $22, $20, $1F, $1E, $1C, $1B, $19,\ $18, $17, $15, $14, $12, $11, $0F, $0E, $0C, $0A, $09, $07, $06, $04, $03, $01,\ $00, $FE, $FC, $FB, $F9, $F8, $F6, $F5, $F3, $F1, $F0, $EE, $ED, $EB, $EA, $E8,\ $E7, $E6, $E4, $E3, $E1, $E0, $DF, $DD, $DC, $DB, $D9, $D8, $D7, $D6, $D5, $D3,\ $D2, $D1, $D0, $CF, $CE, $CD, $CC, $CB, $CA, $C9, $C9, $C8, $C7, $C6, $C6, $C5,\ $C4, $C4, $C3, $C3, $C2, $C2, $C1, $C1, $C1, $C0, $C0, $C0, $C0, $C0, $C0, $C0,\ $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C1, $C1, $C1, $C2, $C2, $C3, $C3, $C4,\ $C4, $C5, $C6, $C6, $C7, $C8, $C9, $C9, $CA, $CB, $CC, $CD, $CE, $CF, $D0, $D1,\ $D2, $D3, $D5, $D6, $D7, $D8, $D9, $DB, $DC, $DD, $DF, $E0, $E1, $E3, $E4, $E6,\ $E7, $E8, $EA, $EB, $ED, $EE, $F0, $F1, $F3, $F5, $F6, $F8, $F9, $FB, $FC, $FE,\ $00, $01, $03, $04, $06, $07, $09, $0A, $0C, $0E, $0F, $11, $12, $14, $15, $17,\ $18, $19, $1B, $1C, $1E, $1F, $20, $22, $23, $24, $26, $27, $28, $29, $2A, $2C,\ $2D, $2E, $2F, $30, $31, $32, $33, $34, $35, $36, $36, $37, $38, $39, $39, $3A,\ $3B, $3B, $3C, $3C, $3D, $3D, $3E, $3E, $3E, $3F, $3F, $3F, $3F, $3F, $3F, $3F ;---------------------------- cosDataLow: ;cos * 16384 .db $00, $FB, $EC, $D4, $B1, $85, $4F, $0F, $C5, $72, $15, $AF, $3F, $C5, $42, $B6,\ $21, $82, $DB, $2B, $71, $B0, $E5, $12, $37, $53, $68, $74, $79, $76, $6C, $5A,\ $41, $21, $FB, $CE, $9A, $60, $20, $DA, $8E, $3D, $E7, $8C, $2B, $C6, $5D, $EF,\ $7E, $09, $90, $13, $94, $12, $8D, $06, $7C, $F1, $64, $D6, $46, $B5, $24, $92,\ $00, $6E, $DC, $4B, $BA, $2A, $9C, $0F, $84, $FA, $73, $EE, $6C, $ED, $70, $F7,\ $82, $11, $A3, $3A, $D5, $74, $19, $C3, $72, $26, $E0, $A0, $66, $32, $05, $DF,\ $BF, $A6, $94, $8A, $87, $8C, $98, $AD, $C9, $EE, $1B, $50, $8F, $D5, $25, $7E,\ $DF, $4A, $BE, $3B, $C1, $51, $EB, $8E, $3B, $F1, $B1, $7B, $4F, $2C, $14, $05,\ $00, $05, $14, $2C, $4F, $7B, $B1, $F1, $3B, $8E, $EB, $51, $C1, $3B, $BE, $4A,\ $DF, $7E, $25, $D5, $8F, $50, $1B, $EE, $C9, $AD, $98, $8C, $87, $8A, $94, $A6,\ $BF, $DF, $05, $32, $66, $A0, $E0, $26, $72, $C3, $19, $74, $D5, $3A, $A3, $11,\ $82, $F7, $70, $ED, $6C, $EE, $73, $FA, $84, $0F, $9C, $2A, $BA, $4B, $DC, $6E,\ $00, $92, $24, $B5, $46, $D6, $64, $F1, $7C, $06, $8D, $12, $94, $13, $90, $09,\ $7E, $EF, $5D, $C6, $2B, $8C, $E7, $3D, $8E, $DA, $20, $60, $9A, $CE, $FB, $21,\ $41, $5A, $6C, $76, $79, $74, $68, $53, $37, $12, $E5, $B0, $71, $2B, $DB, $82,\ $21, $B6, $42, $C5, $3F, $AF, $15, $72, $C5, $0F, $4F, $85, $B1, $D4, $EC, $FB ;---------------------------- atanDataHigh: ;tan(a + 0.5) * 512 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,\ $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01,\ $02, $02, $02, $02, $02, $02, $02, $02, $03, $03, $03, $03, $03, $04, $04, $04,\ $05, $05, $05, $06, $06, $07, $08, $09, $0A, $0C, $0E, $12, $17, $20, $36, $A2 ;---------------------------- atanDataLow: ;tan(a + 0.5) * 512 .db $06, $13, $1F, $2C, $39, $46, $52, $5F, $6C, $7A, $87, $94, $A2, $B0, $BE, $CD,\ $DB, $EB, $FA, $0A, $1A, $2A, $3B, $4D, $5F, $72, $86, $9A, $AF, $C5, $DC, $F4,\ $0D, $27, $43, $60, $80, $A1, $C4, $EA, $13, $3F, $6E, $A2, $DB, $19, $5E, $AA,\ $00, $61, $D0, $50, $E6, $97, $6C, $72, $BE, $6E, $BA, $09, $3A, $8E, $4D, $F7 ;********************************** .bank 3 INCBIN "char.dat" ; 8K 3 $03 INCBIN "mul.dat" ; 128K 4~19 $04~$13 INCBIN "div.dat" ; 96K 20~31 $14~$1F
unused/develop/obj/scene_1.asm
pau-tomas/gbvm
33
83558
;-------------------------------------------------------- ; File Created by SDCC : free open source ANSI-C Compiler ; Version 4.1.4 #12246 (Mac OS X x86_64) ;-------------------------------------------------------- .module scene_1 .optsdcc -mgbz80 ;-------------------------------------------------------- ; Public variables in this module ;-------------------------------------------------------- .globl _scene_1 .globl ___bank_scene_1 ;-------------------------------------------------------- ; special function registers ;-------------------------------------------------------- ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area _DATA ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area _INITIALIZED ;-------------------------------------------------------- ; absolute external ram data ;-------------------------------------------------------- .area _DABS (ABS) ;-------------------------------------------------------- ; global & static initialisations ;-------------------------------------------------------- .area _HOME .area _GSINIT .area _GSFINAL .area _GSINIT ;-------------------------------------------------------- ; Home ;-------------------------------------------------------- .area _HOME .area _HOME ;-------------------------------------------------------- ; code ;-------------------------------------------------------- .area _CODE_255 .area _CODE_255 ___bank_scene_1 = 0x00ff _scene_1: .db #0x20 ; 32 .db #0x20 ; 32 .db #0x00 ; 0 .db #0x06 ; 6 .db #0x02 ; 2 .db #0x00 ; 0 .db #0x04 ; 4 .byte ___bank_spritesheet_0 .dw _spritesheet_0 .byte ___bank_background_4 .dw _background_4 .byte ___bank_scene_1_collisions .dw _scene_1_collisions .byte ___bank_palette_2 .dw _palette_2 .byte ___bank_palette_0 .dw _palette_0 .byte ___bank_script_s1_init .dw _script_s1_init .byte #0x00 .dw #0x0000 .byte #0x00 .dw #0x0000 .byte #0x00 .dw #0x0000 .byte ___bank_scene_1_sprites .dw _scene_1_sprites .byte ___bank_scene_1_actors .dw _scene_1_actors .byte ___bank_scene_1_triggers .dw _scene_1_triggers .byte #0x00 .dw #0x0000 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x14 ; 20 .db #0x00 ; 0 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .db 0x00 .area _INITIALIZER .area _CABS (ABS)
software/obsolete/new-rom/video_vsync.asm
Noah1989/micro-21
1
163140
<reponame>Noah1989/micro-21 public video_vsync_init public video_vsync_wait extern error defc ctc_channel_0 = $E0 defc ctc_channel_1 = $E1 defc ctc_channel_2 = $E2 defc ctc_channel_3 = $E3 video_vsync_init: LD A, video_vsync_ctc_vectors & $FF ; Interrupt vector is the same for all channels OUT (ctc_channel_0), A ; Interrupt ON ; |Mode: Counter ; ||Prescaler (N/A) ; |||CLK/TRG Edge: Rising ; ||||Time Trigger (N/A) ; |||||Time Constant Follows ; ||||||Software Reset ; |||||||Control Word ; |||||||| LD A, %11010111 OUT (ctc_channel_3), A LD A, 1 OUT (ctc_channel_3), A RET video_vsync_wait: XOR A, A LD (video_vsync_status), A video_vsync_wait_loop: HALT LD A, (video_vsync_status) AND A, A JR Z, video_vsync_wait_loop RET video_vsync_interrupt: EX AF, AF' LD A, 1 LD (video_vsync_status), A EX AF, AF' EI RETI video_vsync_interrupt_invalid0: CALL error video_vsync_interrupt_invalid1: CALL error video_vsync_interrupt_invalid2: CALL error section ram_initialized video_vsync_status: defb 0 section interrupt_vectors align $100 video_vsync_ctc_vectors: defw video_vsync_interrupt_invalid0 ; channel 0 defw video_vsync_interrupt_invalid1 ; channel 1 defw video_vsync_interrupt_invalid2 ; channel 2 defw video_vsync_interrupt ; channel 3
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_504.asm
ljhsiun2/medusa
9
100174
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r15 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x6ed9, %rbp nop nop nop and $16728, %r12 mov (%rbp), %r15 and %rbp, %rbp lea addresses_A_ht+0x16a81, %rsi nop nop nop nop sub $19912, %rbx vmovups (%rsi), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $0, %xmm7, %r12 nop nop nop and %r12, %r12 lea addresses_WT_ht+0x103ef, %rsi lea addresses_normal_ht+0xbd51, %rdi nop cmp $51696, %rdx mov $117, %rcx rep movsq nop nop nop nop and %r12, %r12 lea addresses_D_ht+0x5871, %rdi clflush (%rdi) nop nop cmp $10046, %rsi and $0xffffffffffffffc0, %rdi vmovntdqa (%rdi), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $1, %xmm7, %rbx nop cmp $59801, %rdx lea addresses_A_ht+0x89c1, %rbx lfence mov (%rbx), %di nop nop nop sub %rsi, %rsi lea addresses_WC_ht+0x1ba59, %r12 nop nop nop nop nop cmp $41571, %r15 mov (%r12), %rdi nop nop nop xor $56497, %rbx lea addresses_UC_ht+0x96c1, %rbx nop nop nop nop nop sub $1639, %rbp movw $0x6162, (%rbx) nop nop nop nop nop and $12716, %r15 lea addresses_WT_ht+0x1e81, %rcx nop nop nop nop nop cmp %r12, %r12 and $0xffffffffffffffc0, %rcx movaps (%rcx), %xmm6 vpextrq $0, %xmm6, %rdi nop nop nop nop nop and %r15, %r15 lea addresses_A_ht+0x15981, %rsi lea addresses_D_ht+0x1bc81, %rdi nop nop nop nop nop add $21474, %rbx mov $47, %rcx rep movsb nop nop dec %rbp lea addresses_normal_ht+0xa539, %rcx nop nop nop nop nop cmp %rbp, %rbp mov $0x6162636465666768, %r12 movq %r12, %xmm5 and $0xffffffffffffffc0, %rcx vmovaps %ymm5, (%rcx) nop nop nop nop nop add $9704, %rcx lea addresses_A_ht+0x17f1, %rsi lea addresses_D_ht+0xb081, %rdi nop nop nop nop nop and $52545, %rbp mov $19, %rcx rep movsq add $13678, %r12 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r15 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r15 push %r8 push %rcx push %rdx // Faulty Load lea addresses_PSE+0x1b081, %rdx xor %r15, %r15 vmovups (%rdx), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $1, %xmm0, %rcx lea oracles, %rdx and $0xff, %rcx shlq $12, %rcx mov (%rdx,%rcx,1), %rcx pop %rdx pop %rcx pop %r8 pop %r15 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_PSE', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': True, 'congruent': 3}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 3}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': True, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 2}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': True, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 2}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': True, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_A_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 9}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': True, 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 9}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
os/ascii.asm
ceharris/sbz80
0
95519
ascii_bs .equ $08 ascii_tab .equ $09 ascii_lf .equ $0a ascii_cr .equ $0d ascii_esc .equ $1b ascii_space .equ $20 ascii_del .equ $7f
examples.agda
hazelgrove/hazelnut-agda
0
10956
<reponame>hazelgrove/hazelnut-agda open import Nat open import Prelude open import List open import contexts open import judgemental-erase open import moveerase open import sensibility open import statics-checks open import statics-core module examples where -- actions must always specify enough names to name all inserted holes. depending on -- the context, not all names are used, and we pass this argument to make that clear. -- an actual implementation could automatically insert hole names as needed no-hole : Nat no-hole = 0 -- the function (λx. x + 1) where x is named "0". add1 : hexp add1 = ·λ 0 (X 0 ·+ N 1) -- this is the derivation that fn has type num ==> num ex1 : ∅ ⊢ add1 <= (num ==> num) ex1 = ALam refl MAArr (ASubsume (SPlus (ASubsume (SVar refl) TCRefl) (ASubsume SNum TCRefl)) TCRefl) -- the derivation that when applied to the numeric argument 10 add1 -- produces a num. ex2 : ∅ ⊢ (add1 ·: (num ==> num)) ∘ (N 10) => num ex2 = SAp (SAsc ex1) MAArr (ASubsume SNum TCRefl) -- the slightly longer derivation that argues that add1 applied to a -- variable that's known to be a num produces a num ex2b : (∅ ,, (1 , num)) ⊢ (add1 ·: (num ==> num)) ∘ (X 1) => num ex2b = SAp (SAsc (ALam refl MAArr (ASubsume (SPlus (ASubsume (SVar refl) TCRefl) (ASubsume SNum TCRefl)) TCRefl))) MAArr (ASubsume (SVar refl) TCRefl) -- eta-expanding addition to curry it gets num → num → num ex3 : ∅ ⊢ ·λ 0 ( (·λ 1 (X 0 ·+ X 1)) ·: (num ==> num)) <= (num ==> (num ==> num)) ex3 = ALam refl MAArr (ASubsume (SAsc (ALam refl MAArr (ASubsume (SPlus (ASubsume (SVar refl) TCRefl) (ASubsume (SVar refl) TCRefl)) TCRefl))) TCRefl) -- applying three to four has type hole -- but there is no action that -- can fill the hole in the type so this term is forever incomplete. ex4 : ∅ ⊢ ((N 3) ·: ⦇-⦈) ∘ (N 4) => ⦇-⦈ ex4 = SAp (SAsc (ASubsume SNum TCHole2)) MAHole (ASubsume SNum TCHole2) -- this module contains small examples that demonstrate the judgements -- and definitions in action. a few of them are directly from the paper, -- to aid in comparision between the on-paper notation and the -- corresponding agda syntax. -- these smaller derivations motivate the need for the zipper rules: you -- have to unzip down to the point of the structure where you want to -- apply an edit, do the local edit rule, and then put it back together -- around you talk0 : ∅ ⊢ (▹ ⦇-⦈[ 0 ] ◃ ·+₁ ⦇-⦈[ 1 ]) => num ~ construct (numlit 7 no-hole) ~> (▹ N 7 ◃ ·+₁ ⦇-⦈[ 1 ]) => num talk0 = SAZipPlus1 (AASubsume EETop SEHole SAConNumlit TCRefl) talk1 : ∅ ⊢ (·λ 0 ⦇-⦈[ 0 ] ·:₂ (▹ ⦇-⦈ ◃ ==>₁ ⦇-⦈)) => (⦇-⦈ ==> ⦇-⦈) ~ construct num ~> (·λ 0 ⦇-⦈[ 0 ] ·:₂ (▹ num ◃ ==>₁ ⦇-⦈)) => (num ==> ⦇-⦈) talk1 = SAZipAsc2 (TMArrZip1 TMConNum) (ETArrL ETTop) (ETArrL ETTop) (ALam refl MAArr (ASubsume SEHole TCRefl)) -- this is similar to figure one from the paper, but with a half annotated lambda -- rather than a lambda with a full type ascription fig1-l : List action fig1-l = construct (lam 0 no-hole no-hole) :: construct num :: move parent :: move (child 2) :: construct (var 0 no-hole) :: construct (plus no-hole no-hole) :: construct (numlit 1 no-hole) :: [] figure1 : runsynth ∅ ▹ ⦇-⦈[ 0 ] ◃ ⦇-⦈ fig1-l (·λ 0 ·[ num ]₂ (X 0 ·+₂ ▹ N 1 ◃)) (num ==> num) figure1 = DoSynth (SAConLam refl) (DoSynth (SAZipLam1 refl ETTop ETTop TMConNum SEHole SEHole) (DoSynth (SAMove EMHalfLamParent1) (DoSynth (SAMove EMHalfLamChild2) (DoSynth (SAZipLam2 refl EETop SEHole (SAConVar refl)) (DoSynth (SAZipLam2 refl EETop (SVar refl) (SAConPlus1 TCRefl)) (DoSynth (SAZipLam2 refl (EEPlusR EETop) (SPlus (ASubsume (SVar refl) TCRefl) (ASubsume SEHole TCHole1)) (SAZipPlus2 (AASubsume EETop SEHole SAConNumlit TCRefl))) DoRefl)))))) -- this is figure two from the paper incr : Nat incr = 0 fig2-l : List action fig2-l = construct (var incr no-hole) :: construct (ap no-hole no-hole) :: construct (var incr 0) :: construct (ap no-hole no-hole) :: construct (numlit 3 no-hole) :: move parent :: move parent :: finish :: [] figure2 : runsynth (∅ ,, (incr , num ==> num)) ▹ ⦇-⦈[ 0 ] ◃ ⦇-⦈ fig2-l (X incr ∘₂ ▹ X incr ∘ (N 3) ◃) num figure2 = DoSynth (SAConVar refl) (DoSynth (SAConApArr MAArr) (DoSynth (SAZipApAna MAArr (SVar refl) (AAConVar (λ ()) refl)) (DoSynth (SAZipApAna MAArr (SVar refl) (AASubsume (EENEHole EETop) (SNEHole (SVar refl)) (SAZipNEHole EETop (SVar refl) (SAConApArr MAArr)) TCHole1)) (DoSynth (SAZipApAna MAArr (SVar refl) (AASubsume (EENEHole (EEApR EETop)) (SNEHole (SAp (SVar refl) MAArr (ASubsume SEHole TCHole1))) (SAZipNEHole (EEApR EETop) (SAp (SVar refl) MAArr (ASubsume SEHole TCHole1)) (SAZipApAna MAArr (SVar refl) (AASubsume EETop SEHole SAConNumlit TCRefl))) TCHole1)) (DoSynth (SAZipApAna MAArr (SVar refl) (AASubsume (EENEHole (EEApR EETop)) (SNEHole (SAp (SVar refl) MAArr (ASubsume SNum TCRefl))) (SAZipNEHole (EEApR EETop) (SAp (SVar refl) MAArr (ASubsume SNum TCRefl)) (SAMove EMApParent2)) TCHole1)) (DoSynth (SAZipApAna MAArr (SVar refl) (AAMove EMNEHoleParent)) (DoSynth (SAZipApAna MAArr (SVar refl) (AAFinish (ASubsume (SAp (SVar refl) MAArr (ASubsume SNum TCRefl)) TCRefl))) DoRefl))))))) --- this demonstrates that the other ordering discussed is also fine. it --- results in different proof terms and actions but ultimately produces --- the same expression. there are many other lists of actions that would --- also work, these are just two. fig2alt-l : List action fig2alt-l = construct (var incr no-hole) :: construct (ap no-hole 0) :: construct (ap no-hole 1) :: construct (numlit 3 no-hole) :: move parent :: move (child 1) :: construct (var incr no-hole) :: move parent :: [] figure2alt : runsynth (∅ ,, (incr , num ==> num)) ▹ ⦇-⦈[ 0 ] ◃ ⦇-⦈ fig2alt-l (X incr ∘₂ ▹ X incr ∘ (N 3) ◃) num figure2alt = DoSynth (SAConVar refl) (DoSynth (SAConApArr MAArr) (DoSynth (SAZipApAna MAArr (SVar refl) (AASubsume EETop SEHole (SAConApArr MAHole) TCHole1)) (DoSynth (SAZipApAna MAArr (SVar refl) (AASubsume (EEApR EETop) (SAp SEHole MAHole (ASubsume SEHole TCRefl)) (SAZipApAna MAHole SEHole (AASubsume EETop SEHole SAConNumlit TCHole2)) TCHole1)) (DoSynth (SAZipApAna MAArr (SVar refl) (AAMove EMApParent2)) (DoSynth (SAZipApAna MAArr (SVar refl) (AAMove EMApChild1)) (DoSynth (SAZipApAna MAArr (SVar refl) (AASubsume (EEApL EETop) (SAp SEHole MAHole (ASubsume SNum TCHole2)) (SAZipApArr MAArr EETop SEHole (SAConVar refl) (ASubsume SNum TCRefl)) TCRefl)) (DoSynth (SAZipApAna MAArr (SVar refl) (AAMove EMApParent1)) DoRefl))))))) -- these motivate why actions aren't deterministic, and why it's -- reasonable to ban the derivations that we do. the things that differ -- in the term as a result of the appeal to subsumption in the second -- derivation aren't needed -- the ascription is redundant because the -- type is already pinned to num, so that's the only thing that -- could fill the holes produced. notdet1A : ∅ ⊢ ▹ ⦇-⦈[ 0 ] ◃ ~ construct asc ~> ⦇-⦈[ 0 ] ·:₂ ▹ num ◃ ⇐ num notdet1A = AAConAsc notdet1B : ∅ ⊢ ▹ ⦇-⦈[ 0 ] ◃ ~ construct asc ~> ⦇-⦈[ 0 ] ·:₂ ▹ ⦇-⦈ ◃ ⇐ num notdet1B = AASubsume EETop SEHole SAConAsc TCHole1
test/data/Ada-83/signup.adb
jfitz/code-stat
0
29973
with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Exceptions; use Ada.Exceptions; procedure Checkpres is -- input file: signups People : File_Type; -- output files: times.html, names.html Times : File_Type; Pos, Lno : Integer := 0; Buf : String (1 .. 1024) := (others => ' '); Last, First : Integer := 0; type Day_Record is record Month : Integer; Day : Integer; end record; type Day_Array is array (Natural range <>) of Day_Record; Presentation_Days : constant Day_Array := ((9, 23), (9, 30), (10, 7), (10, 14), (10, 21), (10, 28), (11, 04), (11, 18), (12, 2), (12, 9)); type String_Access is access String; type Student_Index is new Integer range -1 .. 52; Student_Names : array (Student_Index range 0 .. 52) of String_Access; Last_Student : Student_Index := Student_Names'First - 1; Name_Order : array (Student_Names'Range) of Student_Index; type Presentation is record Student : Student_Index := -1; Topic : String_Access := null; end record; type Slot_Index is new Integer; Slots : array (Slot_Index range 0 .. Presentation_Days'Length * 8 - 1) of Presentation; subtype Time_String is String (1 .. 5); Presentation_Times : constant array (0 .. 7) of Time_String := ("12:20", "12:30", "12:40", "12:50", "01:25", "01:35", "01:45", "01:55"); function Time (I : Slot_Index) return String is begin return Presentation_Times (Integer (I) mod 8); end Time; function Recitation (I : Slot_Index) return Positive is begin return 1 + (Integer (I) / 4) mod 2; end Recitation; function Month (I : Slot_Index) return Positive is begin return Presentation_Days (Integer (I) / 8).Month; end Month; function Day (I : Slot_Index) return Positive is begin return Presentation_Days (Integer (I) / 8).Day; end Day; procedure Error (Msg : String) is begin Put_Line (Msg); raise Data_Error; end Error; function Find_Slot (Month : Positive; Day : Positive; Recitation : Positive; Slot : Positive) return Slot_Index is J, K : Slot_Index; begin for I in Presentation_Days'range loop if Presentation_Days (I).Month = Month and then Presentation_Days (I).Day = Day then J := Slot_Index( I - Presentation_Days'First); K := J * 8 + Slot_Index (Recitation - 1) * 4 + Slot_Index (Slot) - 1; return Slots'First + Slot_Index (K); end if; end loop; Error ("problem with slot identification"); return -1; end Find_Slot; function Find_Slot (S : Student_Index) return Slot_Index is begin for I in Slots'range loop if Slots (I).Student = S then return I; end if; end loop; return -1; end Find_Slot; procedure Check_Topic (Topic : String; Section : Integer) is begin for I in Slots'range loop if Recitation (I) = Section then declare T : String_Access renames Slots (I).Topic; begin if T /= null and then T.all /= "TBD" and then T.all (T.all'First .. T.all'First + 2) = Topic (Topic'First .. Topic'First + 2) then Error ("""" & Topic & """" & " apparently duplicates """ & T.all & """"); end if; end; end if; end loop; end Check_Topic; procedure Sort_Names is I, J, K : Student_Index; begin for L in Name_Order'Range loop Name_Order (L) := L; end loop; I := Student_Names'First; Sort: while I < Last_Student loop -- items 1 .. I are sorted while Student_Names (Name_Order (I)).all <= Student_Names (Name_Order (I+1)).all loop -- items 1 .. I + 1 are sorted I := I + 1; if I >= Last_Student then exit Sort; end if; end loop; -- items 1 .. I are sorted; item I+1 < item I K := Name_Order (I + 1); J := I; I := J + 1; loop -- items 1 .. J are sorted; tsk < items J+1 .. I are sorted Name_Order (J + 1) := Name_Order (J); exit when J = 1 or else Student_Names (Name_Order (J - 1)).all <= Student_Names (K).all; J := J - 1; end loop; Name_Order (J) := K; end loop Sort; end Sort_Names; begin -- read in data from signup file -- line format: "student name" section month day section slot "topic" Open (People, In_File, "signups"); declare Month : Integer range 9 .. 12; Day : Integer range 1 .. 31; Section : Integer range 1 .. 2; Slot : Integer range 1 .. 4; I : Slot_Index; begin loop Get_Line (People, Buf, Last); exit when Last < Buf'First; Lno := Lno + 1; -- extract student name field if Last = Buf'Last then Error ("input line longer than " & Integer'Image (Last - 1)); end if; Pos := Buf'First; if Buf (Pos) /= '"' then Error ("missing "" at start of name field"); end if; Pos := Pos + 1; First := Pos; while Pos <= Last and then Buf (Pos) /= '"' loop Pos := Pos + 1; end loop; if Buf (Pos) /= '"' then Error ("missing "" at end of name field"); end if; Last_Student := Last_Student + 1; Student_Names (Last_Student) := new String'(Buf (First .. Pos - 1)); Get (Buf (Pos + 1 .. Last), Section, Pos); if Pos < Last then -- read month, day, section, and slot as integers Get (Buf (Pos + 1 .. Last), Month, Pos); Get (Buf (Pos + 1 .. Last), Day, Pos); Get (Buf (Pos + 1 .. Last), Slot, Pos); I := Find_Slot (Month, Day, Section, Slot); -- read topic loop Pos := Pos + 1; exit when Pos = Last or else Buf (Pos) /= ' '; end loop; if Buf (Pos) /= '"' then Error ("missing "" at start of topic field"); end if; Pos := Pos + 1; First := Pos; while Pos <= Last and then Buf (Pos) /= '"' loop Pos := Pos + 1; end loop; if Buf (Pos) /= '"' then Error ("missing "" at end of topic field"); end if; Check_Topic (Buf (First .. Pos - 1), Section); if Slots (I).Student /= -1 then Error ("conflicting assignments: " & Student_Names (Last_Student).all & "vs." & Student_Names (Slots (I).Student).all); -- don't bother freeing Name_String, -- since this is a one-shot program -- and the number of names is few else Slots (I).Student := Last_Student; Slots (I).Topic := new String' (Buf (First .. Pos - 1)); end if; end if; end loop; exception when End_Error => null; end; begin Open (Times, Out_File, "times.html"); exception when Name_Error => Create (Times, Out_File, "times.html"); end; Put_Line (Times, "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN""><HTML><HEAD>"); Put_Line (Times, "<TITLE>times.html</TITLE>"); Put_Line (Times, "<META HTTP-EQUIV=""CONTENT-TYPE"" CONTENT=""TEXT/HTML; CHARSET=ISO-8859-1"">"); Put_Line (Times, "<LINK REL=""stylesheet"" TYPE=""text/css"" href=""style.css"" title=""stylesheet"">"); Put_Line (Times, "</HEAD><BODY><TABLE WIDTH=""100%""><TR><TD BGCOLOR=""#660000"" ALIGN=RIGHT>"); Put_Line (Times, "<A HREF=""../index.html""><U><FONT COLOR=""CCCC99""><FONT SIZE=2>"); Put_Line (Times, "COP 4020: Programming Languages</FONT>&uarr;</FONT></U></A></TD></TR></TABLE>"); Put_Line (Times, "<CENTER><H1 ALIGN=""CENTER"">Presentation Schedule</H1></CENTER>"); Put_Line (Times, "<TABLE WIDTH=""100%""><TR><TD BGCOLOR=""#CCCC99""><B>Fall Term 2005</B></TD></TR></TABLE>"); Put_Line (Times, "<P></P><UL><LI><A HREF=""times.html#Name"">by name</A></LI>"); Put_Line (Times, "<LI><A HREF=""times.html#Time"">by time</A></LI></UL><HR>"); Put_Line (Times, "<A NAME=""Time"">"); Put_Line (Times, "<P></P><TABLE BORDER>"); Put_Line (Times, "<TR><TH>Month</TH><TH>Day</TH><TH>Time</TH><TH>Student</TH><TH>Topic</TH></TR>"); for I in Slots'Range loop if I mod 8 = 0 then Put (Times, "<TR><TD COLSPAN=5 BGCOLOR=""#ff6600""></TD></TR>"); end if; -- create html line for this slot, showing the person and topic Put (Times, "<TR><TD>"); Put (Times, Month (I)); Put (Times, "</TD><TD>"); Put (Times, Day (I)); Put (Times, "</TD><TD>"); Put (Times, Time (I)); if Slots(I).Student /= -1 then Put (Times, "</TD><TD>"); Put (Times, Student_Names (Slots(I).Student).all); Put (Times, "</TD><TD>"); Put (Times, Slots(I).Topic.all); end if; Put_Line (Times, "</TD></TR>"); end loop; Sort_Names; Put_Line (Times, "</TABLE><HR><TABLE BORDER><A NAME=""Name"">"); Put_Line (Times, "<TR><TH>Name</TH><TH>Month</TH><TH>Day</TH><TH>Time</TH><TH>Topic</TH></TR>"); declare I : Slot_Index; begin for S in Student_Names'First .. Last_Student loop -- create html line for this person, showing time and topic Put (Times, "<TR><TD>"); Put (Times, Student_Names (Name_Order (S)).all); I := Find_Slot (Name_Order(S)); if I >= Slots'First then Put (Times, "</TD><TD>"); Put (Times, Month (I)); Put (Times, "</TD><TD>"); Put (Times, Day (I)); Put (Times, "</TD><TD>"); Put (Times, Time (I)); Put (Times, "</TD><TD>"); Put (Times, Slots(I).Topic.all); end if; Put_Line (Times, "</TD></TR>"); end loop; end; Put_Line (Times, "</TABLE>"); Put_Line (Times, "<TABLE WIDTH=""100%""><TR><TD BGCOLOR=""#CCCC99""><FONT SIZE=""1"">&copy; 2005"); Put_Line (Times, "<A HREF=""http://www.cs.fsu.edu/~baker""><NAME></A>. <BR> ($Id: checkpres.adb,v 1.2 2005/09/08 20:36:47 baker Exp baker $)"); Put_Line (Times, "</FONT>&nbsp;</TD></TR></TABLE> </BODY> </HTML>"); Close (Times); exception when E : others => Put (Lno, 4); Put (": '"); Put (Buf (Buf'First .. Last)); Put_Line ("'"); Put (" "); for I in 1 .. Pos loop Put (' '); end loop; Put_Line ("^"); Put_Line (Ada.Exceptions.Exception_Name (E)); New_Line; raise; end Checkpres;
oeis/154/A154140.asm
neoneye/loda-programs
11
24997
<gh_stars>10-100 ; A154140: Indices k such that 6 plus the k-th triangular number is a perfect square. ; Submitted by <NAME> ; 2,4,19,29,114,172,667,1005,3890,5860,22675,34157,132162,199084,770299,1160349,4489634,6763012,26167507,39417725,152515410,229743340,888924955,1339042317,5181034322,7804510564,30197280979,45488021069,176002651554,265123615852 mov $2,2 lpb $0 sub $0,1 add $1,1 mov $3,$0 add $3,$0 mod $3,4 mul $3,$2 add $1,$3 add $2,$1 lpe add $2,$1 mov $0,$2
Examples/test102.asm
NotFounds/pl0dash-run
0
7048
LOAD A,10 STORE A,#(800) JMP 39 PUSH FP LOAD FP,SP LOAD A,#(FP+4) PUSH A LOAD A,1 PUSH A POP B POP A PLUS PUSH C POP A STORE A,#(FP+4) LOAD A,#(FP+4) PUSH A LOAD A,#(FP+3) PUSH A POP B POP A PLUS PUSH C LOAD A,#(FP+2) PUSH A POP B POP A PLUS PUSH C POP A PRINT A PRINTLN LOAD A,0 PUSH A POP C LOAD SP,FP POP FP RET 3 LOAD A,1 PUSH A LOAD A,1 PUSH A LOAD A,2 PUSH A POP B POP A PLUS PUSH C LOAD A,3 PUSH A LOAD A,4 PUSH A POP B POP A PLUS PUSH C LOAD A,5 PUSH A LOAD A,6 PUSH A POP B POP A PLUS PUSH C CALL 4 PUSH C POP B POP A PLUS PUSH C POP A PRINT A PRINTLN END
oeis/030/A030655.asm
neoneye/loda-programs
11
6137
; A030655: Pair up the numbers. ; Submitted by <NAME>(s2) ; 12,34,56,78,910,1112,1314,1516,1718,1920,2122,2324,2526,2728,2930,3132,3334,3536,3738,3940,4142,4344,4546,4748,4950,5152,5354,5556,5758,5960,6162,6364,6566,6768,6970,7172,7374,7576,7778,7980,8182,8384,8586,8788,8990,9192,9394,9596,9798,99100,101102,103104,105106,107108,109110,111112,113114,115116,117118,119120,121122,123124,125126,127128,129130,131132,133134,135136,137138,139140,141142,143144,145146,147148,149150,151152,153154,155156,157158,159160,161162,163164,165166,167168,169170,171172 mul $0,2 mov $1,$0 add $0,1 add $1,2 mov $2,$0 lpb $1 mul $0,10 div $1,10 lpe add $0,1 add $0,$2
tests/t13.asm
mras0/sasm
26
86033
<gh_stars>10-100 org 0x100 mov word [Ptr], Msg mov ah, 9 mov dx, [Ptr] int 0x21 mov ax, 0x4c00 int 0x21 Msg: db 'Hello world!', 13, 10, '$' Ptr: dw 0
module/irq/handler.asm
Crupette/modit-micro
1
14288
BITS 32 extern _irq_handler irq_common: pushad push ds push es push fs push gs mov ax, 0x10 mov ds, ax mov es, ax mov fs, ax mov gs, ax cld push esp call _irq_handler add esp, 4 pop gs pop fs pop es pop ds popad add esp, 8 iret ;Requests %macro IRQ 1 global _irq%1 _irq%1: cli push 0 push %1+32 jmp irq_common %endmacro %assign irqno 0 %rep (256 - 32) IRQ irqno %assign irqno irqno+1 %endrep
programs/oeis/120/A120174.asm
jmorken/loda
1
93766
; A120174: a(1)=5; a(n)=floor((29+sum(a(1) to a(n-1)))/5). ; 5,6,8,9,11,13,16,19,23,27,33,39,47,57,68,82,98,118,141,169,203,244,293,351,421,506,607,728,874,1049,1258,1510,1812,2174,2609,3131,3757,4509,5410,6492 mov $2,2 mov $7,$0 lpb $2 mov $0,$7 sub $2,1 add $0,$2 mov $5,0 lpb $0 sub $0,1 mov $4,$5 add $5,4 div $5,5 add $5,5 add $5,$4 lpe mov $3,$2 mov $6,$5 lpb $3 mov $1,$6 sub $3,1 lpe lpe lpb $7 sub $1,$6 mov $7,0 lpe
alloy4fun_models/trashltl/models/1/uoos8TcvvoH52ndrd.als
Kaixi26/org.alloytools.alloy
0
3713
<reponame>Kaixi26/org.alloytools.alloy open main pred iduoos8TcvvoH52ndrd_prop2 { before no File and after some File } pred __repair { iduoos8TcvvoH52ndrd_prop2 } check __repair { iduoos8TcvvoH52ndrd_prop2 <=> prop2o }
src/shaders/h264/ildb/AVC_ILDB_Filter_Mbaff_UV_h.asm
me176c-dev/android_hardware_intel-vaapi-driver
192
5757
<reponame>me176c-dev/android_hardware_intel-vaapi-driver /* * Copyright © <2010>, Intel Corporation. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * This file was originally licensed under the following license * * 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. * */ ////////// AVC ILDB filter horizontal Mbaff UV /////////////////////////////////////////////////////// // // This filter code prepares the src data and control data for ILDB filtering on all horizontal edges of UV. // // It sssumes the data for horizontal de-blocking is already transposed. // // Chroma: // // +-------+-------+ H0 Edge // | | | // | | | // | | | // +-------+-------+ H1 Edge // | | | // | | | // | | | // +-------+-------+ // ///////////////////////////////////////////////////////////////////////////// #if defined(_DEBUG) mov (1) EntrySignatureC:w 0xBBBC:w #endif //=============== Chroma deblocking ================ //---------- Deblock UV external top edge ---------- and.z.f0.0 (1) null:w r[ECM_AddrReg, BitFlags]:ub FilterTopMbEdgeFlag:w // Check for FilterTopMbEdgeFlag mov (1) f0.1:w DualFieldMode:w // Check for dual field mode // Get Luma maskA and maskB shr (16) TempRow0(0)<1> r[ECM_AddrReg, wEdgeCntlMapA_ExtTopHorz0]<0;1,0>:uw RRampW(0) shr (16) TempRow1(0)<1> r[ECM_AddrReg, wEdgeCntlMapB_ExtTopHorz0]<0;1,0>:uw RRampW(0) (f0.0) jmpi H0_UV_DONE // Skip H0 UV edge (f0.1) jmpi DUAL_FIELD_UV // Non dual field mode // Extract UV MaskA and MaskB from every other bit of Y masks and.nz.f0.0 (8) null:w TempRow0(0)<16;8,2> 1:w and.nz.f0.1 (8) null:w TempRow1(0)<16;8,2> 1:w // Ext U // p1 = Prev MB U row 0 // p0 = Prev MB U row 1 // q0 = Cur MB U row 0 // q1 = Cur MB U row 1 mov (1) P_AddrReg:w PREV_MB_U_BASE:w { NoDDClr } mov (1) Q_AddrReg:w SRC_MB_U_BASE:w { NoDDChk } mov (8) Mbaff_ALPHA(0,0)<1> r[ECM_AddrReg, bAlphaTop0_Cb]<0;1,0>:ub mov (8) Mbaff_BETA(0,0)<1> r[ECM_AddrReg, bBetaTop0_Cb]<0;1,0>:ub mov (8) Mbaff_TC0(0,0)<1> r[ECM_AddrReg, bTc0_h00_0_Cb]<1;2,0>:ub // Store UV MaskA and MaskB mov (2) MaskA<1>:uw f0.0<2;2,1>:uw CALL(FILTER_UV_MBAFF, 1) // Ext V mov (1) P_AddrReg:w PREV_MB_V_BASE:w { NoDDClr } mov (1) Q_AddrReg:w SRC_MB_V_BASE:w { NoDDChk } mov (8) Mbaff_ALPHA(0,0)<1> r[ECM_AddrReg, bAlphaTop0_Cr]<0;1,0>:ub mov (8) Mbaff_BETA(0,0)<1> r[ECM_AddrReg, bBetaTop0_Cr]<0;1,0>:ub mov (8) Mbaff_TC0(0,0)<1> r[ECM_AddrReg, bTc0_h00_0_Cr]<1;2,0>:ub // Set UV MaskA and MaskB mov (2) f0.0<1>:uw MaskA<2;2,1>:uw CALL(FILTER_UV_MBAFF, 1) jmpi H0_UV_DONE DUAL_FIELD_UV: // Dual field mode, FieldModeCurrentMbFlag=0 && FieldModeAboveMbFlag=1 //===== Ext U, Top field // Extract UV MaskA and MaskB from every other bit of Y masks and.nz.f0.0 (8) null:w TempRow0(0)<16;8,2> 1:w and.nz.f0.1 (8) null:w TempRow1(0)<16;8,2> 1:w mov (1) P_AddrReg:w ABOVE_CUR_MB_BASE:w { NoDDClr } mov (1) Q_AddrReg:w ABOVE_CUR_MB_BASE+32:w { NoDDChk } mov (16) ABOVE_CUR_MB_UW(0)<1> PREV_MB_UW(0, 0)<16;8,1> // Copy p1, p0 mov (16) ABOVE_CUR_MB_UW(1)<1> SRC_UW(0, 0)<16;8,1> // Copy q1, q0 //===== Ext U, top field mov (8) Mbaff_ALPHA(0,0)<1> r[ECM_AddrReg, bAlphaTop0_Cb]<0;1,0>:ub mov (8) Mbaff_BETA(0,0)<1> r[ECM_AddrReg, bBetaTop0_Cb]<0;1,0>:ub mov (8) Mbaff_TC0(0,0)<1> r[ECM_AddrReg, bTc0_h00_0_Cb]<1;2,0>:ub // Store UV MaskA and MaskB mov (2) MaskA<1>:uw f0.0<2;2,1>:uw CALL(FILTER_UV_MBAFF, 1) // Ext U, top field //===== Ext V, top field mov (1) P_AddrReg:w ABOVE_CUR_MB_BASE+1:w { NoDDClr } mov (1) Q_AddrReg:w ABOVE_CUR_MB_BASE+33:w { NoDDChk } mov (8) Mbaff_ALPHA(0,0)<1> r[ECM_AddrReg, bAlphaTop0_Cr]<0;1,0>:ub mov (8) Mbaff_BETA(0,0)<1> r[ECM_AddrReg, bBetaTop0_Cr]<0;1,0>:ub mov (8) Mbaff_TC0(0,0)<1> r[ECM_AddrReg, bTc0_h00_0_Cr]<1;2,0>:ub // Set UV MaskA and MaskB mov (2) f0.0<1>:uw MaskA<2;2,1>:uw CALL(FILTER_UV_MBAFF, 1) // Ext U, top field // Prefetch for bottom field // Get bot field Luma maskA and maskB shr (16) TempRow0(0)<1> r[ECM_AddrReg, wEdgeCntlMapA_ExtTopHorz1]<0;1,0>:uw RRampW(0) shr (16) TempRow1(0)<1> r[ECM_AddrReg, wEdgeCntlMapB_ExtTopHorz1]<0;1,0>:uw RRampW(0) // Save deblocked top field rows mov (8) PREV_MB_UW(1, 0)<1> ABOVE_CUR_MB_UW(0, 8) // Copy p0 mov (8) SRC_UW(0, 0)<1> ABOVE_CUR_MB_UW(1, 0) // Copy q0 //========================================================================== //===== Ext U, Bot field // Extract UV MaskA and MaskB from every other bit of Y masks and.nz.f0.0 (8) null:w TempRow0(0)<16;8,2> 1:w and.nz.f0.1 (8) null:w TempRow1(0)<16;8,2> 1:w mov (1) P_AddrReg:w ABOVE_CUR_MB_BASE:w { NoDDClr } mov (1) Q_AddrReg:w ABOVE_CUR_MB_BASE+32:w { NoDDChk } mov (16) ABOVE_CUR_MB_UW(0)<1> PREV_MB_UW(0, 8)<16;8,1> // Copy p1, p0 mov (16) ABOVE_CUR_MB_UW(1)<1> SRC_UW(0, 8)<16;8,1> // Copy q1, q0 //===== Ext U, bottom field mov (8) Mbaff_ALPHA(0,0)<1> r[ECM_AddrReg, bAlphaTop1_Cb]<0;1,0>:ub mov (8) Mbaff_BETA(0,0)<1> r[ECM_AddrReg, bBetaTop1_Cb]<0;1,0>:ub mov (8) Mbaff_TC0(0,0)<1> r[ECM_AddrReg, bTc0_h00_1_Cb]<1;2,0>:ub // Store UV MaskA and MaskB mov (2) MaskA<1>:uw f0.0<2;2,1>:uw CALL(FILTER_UV_MBAFF, 1) // Ext U, bottom field //===== Ext V, bot field mov (1) P_AddrReg:w ABOVE_CUR_MB_BASE+1:w { NoDDClr } mov (1) Q_AddrReg:w ABOVE_CUR_MB_BASE+33:w { NoDDChk } mov (8) Mbaff_ALPHA(0,0)<1> r[ECM_AddrReg, bAlphaTop1_Cr]<0;1,0>:ub mov (8) Mbaff_BETA(0,0)<1> r[ECM_AddrReg, bBetaTop1_Cr]<0;1,0>:ub mov (8) Mbaff_TC0(0,0)<1> r[ECM_AddrReg, bTc0_h00_1_Cr]<1;2,0>:ub // Set UV MaskA and MaskB mov (2) f0.0<1>:uw MaskA<2;2,1>:uw CALL(FILTER_UV_MBAFF, 1) // Ext V, bottom field // Save deblocked bot field rows mov (8) PREV_MB_UW(1, 8)<1> ABOVE_CUR_MB_UW(0, 8) // Copy p0 mov (8) SRC_UW(0, 8)<1> ABOVE_CUR_MB_UW(1, 0) // Copy q0 //======================================== H0_UV_DONE: //---------- Deblock U internal horz middle edge ---------- //***** Need to take every other bit to form U maskA in core shr (16) TempRow0(0)<1> r[ECM_AddrReg, wEdgeCntlMap_IntMidHorz]<0;1,0>:uw RRampW(0) // p1 = Cur MB U row 2 // p0 = Cur MB U row 3 // q0 = Cur MB U row 4 // q1 = Cur MB U row 5 mov (1) P_AddrReg:w 4*UV_ROW_WIDTH+SRC_MB_U_BASE:w { NoDDClr } mov (1) Q_AddrReg:w 8*UV_ROW_WIDTH+SRC_MB_U_BASE:w { NoDDChk } mov (8) Mbaff_ALPHA(0,0)<1> r[ECM_AddrReg, bAlphaInternal_Cb]<0;1,0>:ub mov (8) Mbaff_BETA(0,0)<1> r[ECM_AddrReg, bBetaInternal_Cb]<0;1,0>:ub mov (8) Mbaff_TC0(0,0)<1> r[ECM_AddrReg, bTc0_h20_Cb]<1;2,0>:ub and.nz.f0.0 (8) null:w TempRow0(0)<16;8,2> 1:w // Store UV MaskA and MaskB mov (1) f0.1:uw 0:w mov (1) MaskB:uw 0:w { NoDDClr } mov (1) MaskA:uw f0.0:uw { NoDDChk } CALL(FILTER_UV_MBAFF, 1) //----------------------------------------------- //---------- Deblock V internal horz middle edge ---------- // p1 = Cur MB V row 2 // p0 = Cur MB V row 3 // q0 = Cur MB V row 4 // q1 = Cur MB V row 5 mov (1) P_AddrReg:w 4*UV_ROW_WIDTH+SRC_MB_V_BASE:w { NoDDClr } mov (1) Q_AddrReg:w 8*UV_ROW_WIDTH+SRC_MB_V_BASE:w { NoDDChk } mov (8) Mbaff_ALPHA(0,0)<1> r[ECM_AddrReg, bAlphaInternal_Cr]<0;1,0>:ub mov (8) Mbaff_BETA(0,0)<1> r[ECM_AddrReg, bBetaInternal_Cr]<0;1,0>:ub mov (8) Mbaff_TC0(0,0)<1> r[ECM_AddrReg, bTc0_h20_Cr]<1;2,0>:ub // Set UV MaskA and MaskB mov (2) f0.0<1>:uw MaskA<2;2,1>:uw CALL(FILTER_UV_MBAFF, 1) //-----------------------------------------------
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/X64/SecEntry.nasm
mefff/edk2
0
105213
<gh_stars>0 ;------------------------------------------------------------------------------ ; ; Copyright (c) 2022, Intel Corporation. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: ; ; SecEntry.asm ; ; Abstract: ; ; This is the code that calls TempRamInit API from FSP binary and passes ; control into PEI core. ; ;------------------------------------------------------------------------------ #include "Fsp.h" IA32_CR4_OSFXSR equ 200h IA32_CR4_OSXMMEXCPT equ 400h IA32_CR0_MP equ 2h IA32_CPUID_SSE2 equ 02000000h IA32_CPUID_SSE2_B equ 26 SECTION .text extern ASM_PFX(CallPeiCoreEntryPoint) extern ASM_PFX(FsptUpdDataPtr) ; Pcds extern ASM_PFX(PcdGet32 (PcdFsptBaseAddress)) ;---------------------------------------------------------------------------- ; ; Procedure: _ModuleEntryPoint ; ; Input: None ; ; Output: None ; ; Destroys: Assume all registers ; ; Description: ; ; Call TempRamInit API from FSP binary. After TempRamInit done, pass ; control into PEI core. ; ; Return: None ; ; MMX Usage: ; MM0 = BIST State ; ;---------------------------------------------------------------------------- BITS 64 align 16 global ASM_PFX(ModuleEntryPoint) ASM_PFX(ModuleEntryPoint): fninit ; clear any pending Floating point exceptions ; ; Store the BIST value in mm0 ; movd mm0, eax ; Find the fsp info header mov rax, ASM_PFX(PcdGet32 (PcdFsptBaseAddress)) mov edi, [eax] mov eax, dword [edi + FVH_SIGINATURE_OFFSET] cmp eax, FVH_SIGINATURE_VALID_VALUE jnz FspHeaderNotFound xor eax, eax mov ax, word [edi + FVH_EXTHEADER_OFFSET_OFFSET] cmp ax, 0 jnz FspFvExtHeaderExist xor eax, eax mov ax, word [edi + FVH_HEADER_LENGTH_OFFSET] ; Bypass Fv Header add edi, eax jmp FspCheckFfsHeader FspFvExtHeaderExist: add edi, eax mov eax, dword [edi + FVH_EXTHEADER_SIZE_OFFSET] ; Bypass Ext Fv Header add edi, eax ; Round up to 8 byte alignment mov eax, edi and al, 07h jz FspCheckFfsHeader and edi, 0FFFFFFF8h add edi, 08h FspCheckFfsHeader: ; Check the ffs guid mov eax, dword [edi] cmp eax, FSP_HEADER_GUID_DWORD1 jnz FspHeaderNotFound mov eax, dword [edi + 4] cmp eax, FSP_HEADER_GUID_DWORD2 jnz FspHeaderNotFound mov eax, dword [edi + 8] cmp eax, FSP_HEADER_GUID_DWORD3 jnz FspHeaderNotFound mov eax, dword [edi + 0Ch] cmp eax, FSP_HEADER_GUID_DWORD4 jnz FspHeaderNotFound add edi, FFS_HEADER_SIZE_VALUE ; Bypass the ffs header ; Check the section type as raw section mov al, byte [edi + SECTION_HEADER_TYPE_OFFSET] cmp al, 019h jnz FspHeaderNotFound add edi, RAW_SECTION_HEADER_SIZE_VALUE ; Bypass the section header jmp FspHeaderFound FspHeaderNotFound: jmp $ FspHeaderFound: ; Get the fsp TempRamInit Api address mov eax, dword [edi + FSP_HEADER_IMAGEBASE_OFFSET] add eax, dword [edi + FSP_HEADER_TEMPRAMINIT_OFFSET] ; Pass Fsp T Upd pointer as Input parameter mov rcx, ASM_PFX(FsptUpdDataPtr) ; Setup the hardcode stack mov rsp, TempRamInitStack ; Call the fsp TempRamInit Api jmp rax TempRamInitDone: cmp rax, 0800000000000000Eh ; Check if EFI_NOT_FOUND returned. Error code for Microcode Update not found. je CallSecFspInit ; If microcode not found, don't hang, but continue. cmp rax, 0 ; Check if EFI_SUCCESS returned. jnz FspApiFailed ; RDX: start of range ; R8: end of range CallSecFspInit: mov r8, rdx mov rdx, rcx xor ecx, ecx ; zero - no Hob List Yet mov rsp, r8 ; ; Per X64 calling convention, make sure RSP is 16-byte aligned. ; mov rax, rsp and rax, 0fh sub rsp, rax call ASM_PFX(CallPeiCoreEntryPoint) FspApiFailed: jmp $ align 10h TempRamInitStack: DQ TempRamInitDone
source/uaflex/generated/uaflex-scanners-on_accept.adb
svn2github/matreshka
24
11943
<reponame>svn2github/matreshka ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2015, <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$ ------------------------------------------------------------------------------ separate (UAFLEX.Scanners) procedure On_Accept (Self : not null access UAFLEX.Handlers.Handler'Class; Scanner : not null access UAFLEX.Scanners.Scanner'Class; Rule : UAFLEX.Lexer_Types.Rule_Index; Token : out Parser_Tokens.Token_Kind; Skip : in out Boolean) is begin case Rule is when 1 | 6 | 13 | 15 => Self.Skip_Line (Scanner, Rule, Token, Skip); when 2 => Self.On_Start (Scanner, Rule, Token, Skip); when 3 => Self.On_Exclusive (Scanner, Rule, Token, Skip); when 4 => Self.On_Name (Scanner, Rule, Token, Skip); when 5 => Self.On_Section_End (Scanner, Rule, Token, Skip); when 7 | 12 | 18 => Self.Skip (Scanner, Rule, Token, Skip); when 8 => Self.On_Regexp (Scanner, Rule, Token, Skip); when 9 => Self.End_Of_Macro (Scanner, Rule, Token, Skip); when 10 => Self.End_Of_Name_List (Scanner, Rule, Token, Skip); when 11 => Self.On_Name_2 (Scanner, Rule, Token, Skip); when 14 => Self.On_Regexp_2 (Scanner, Rule, Token, Skip); when 16 => Self.On_Section_End_2 (Scanner, Rule, Token, Skip); when 17 => Self.On_Action (Scanner, Rule, Token, Skip); when 19 => Self.On_End_Of_Rule (Scanner, Rule, Token, Skip); when others => raise Constraint_Error; end case; end On_Accept;
oeis/050/A050478.asm
neoneye/loda-programs
11
105061
; A050478: a(n) = C(n)*(8n+1) where C(n)=Catalan numbers (A000108). ; Submitted by <NAME> ; 1,9,34,125,462,1722,6468,24453,92950,354926,1360476,5231954,20177164,78004500,302211720,1173076245,4561139430,17761336230,69257611500,270391268070,1056823387620,4134799126380,16192413764280,63466028525250,248951500433532,977251226691852,3838776792079768,15088780548772868,59343289143831000,233522436479768744,919411747004245264,3621614373767500341,14272254673401386886,56269074559244424150,221933723506876498572,875676224068951654622,3456381733513671059188,13647388884412657482108 mov $2,$0 seq $0,108 ; Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!). mul $2,$0 mul $2,8 add $0,$2
data/pokemon/dex_entries/slowbro.asm
AtmaBuster/pokeplat-gen2
6
96706
db "HERMITCRAB@" ; species name db "An attached" next "SHELLDER won't let" next "go because of the" page "tasty flavor that" next "oozes out of its" next "tail.@"
_incObj/62 Gargoyle.asm
kodishmediacenter/msu-md-sonic
9
167972
<filename>_incObj/62 Gargoyle.asm ; --------------------------------------------------------------------------- ; Object 62 - gargoyle head (LZ) ; --------------------------------------------------------------------------- Gargoyle: moveq #0,d0 move.b obRoutine(a0),d0 move.w Gar_Index(pc,d0.w),d1 jsr Gar_Index(pc,d1.w) bra.w RememberState ; =========================================================================== Gar_Index: dc.w Gar_Main-Gar_Index dc.w Gar_MakeFire-Gar_Index dc.w Gar_FireBall-Gar_Index dc.w Gar_AniFire-Gar_Index Gar_SpitRate: dc.b 30, 60, 90, 120, 150, 180, 210, 240 ; =========================================================================== Gar_Main: ; Routine 0 addq.b #2,obRoutine(a0) move.l #Map_Gar,obMap(a0) move.w #$42E9,obGfx(a0) ori.b #4,obRender(a0) move.b #3,obPriority(a0) move.b #$10,obActWid(a0) move.b obSubtype(a0),d0 ; get object type andi.w #$F,d0 ; read only the 2nd digit move.b Gar_SpitRate(pc,d0.w),obDelayAni(a0) ; set fireball spit rate move.b obDelayAni(a0),obTimeFrame(a0) andi.b #$F,obSubtype(a0) Gar_MakeFire: ; Routine 2 subq.b #1,obTimeFrame(a0) ; decrement timer bne.s @nofire ; if time remains, branch move.b obDelayAni(a0),obTimeFrame(a0) ; reset timer bsr.w ChkObjectVisible bne.s @nofire bsr.w FindFreeObj bne.s @nofire move.b #id_Gargoyle,0(a1) ; load fireball object addq.b #4,obRoutine(a1) ; use Gar_FireBall routine move.w obX(a0),obX(a1) move.w obY(a0),obY(a1) move.b obRender(a0),obRender(a1) move.b obStatus(a0),obStatus(a1) @nofire: rts ; =========================================================================== Gar_FireBall: ; Routine 4 addq.b #2,obRoutine(a0) move.b #8,obHeight(a0) move.b #8,obWidth(a0) move.l #Map_Gar,obMap(a0) move.w #$2E9,obGfx(a0) ori.b #4,obRender(a0) move.b #4,obPriority(a0) move.b #$98,obColType(a0) move.b #8,obActWid(a0) move.b #2,obFrame(a0) addq.w #8,obY(a0) move.w #$200,obVelX(a0) btst #0,obStatus(a0) ; is gargoyle facing left? bne.s @noflip ; if not, branch neg.w obVelX(a0) @noflip: sfx sfx_Fireball,0,0,0 ; play lava ball sound Gar_AniFire: ; Routine 6 move.b (v_framebyte).w,d0 andi.b #7,d0 bne.s @nochg bchg #0,obFrame(a0) ; change every 8 frames @nochg: bsr.w SpeedToPos btst #0,obStatus(a0) ; is fireball moving left? bne.s @isright ; if not, branch moveq #-8,d3 bsr.w ObjHitWallLeft tst.w d1 bmi.w DeleteObject ; delete if the fireball hits a wall rts @isright: moveq #8,d3 bsr.w ObjHitWallRight tst.w d1 bmi.w DeleteObject rts
P6/data_P6_2/ALUTest16.asm
alxzzhou/BUAA_CO_2020
1
165675
srl $3,$3,31 sh $3,0($0) or $3,$4,$3 slti $1,$3,14412 addiu $0,$5,14365 lb $3,5($0) sh $4,14($0) or $3,$3,$3 slti $5,$5,6773 sw $1,16($0) slt $0,$5,$3 lb $6,11($0) sh $3,16($0) srlv $3,$2,$3 lh $1,16($0) sll $4,$6,28 lh $3,12($0) lw $6,4($0) lb $4,7($0) andi $3,$5,48910 sltu $1,$1,$3 sltu $0,$1,$3 lbu $0,11($0) subu $6,$5,$3 addiu $5,$2,9101 lh $3,16($0) lh $6,8($0) sltiu $5,$2,-28503 sltu $3,$3,$3 lh $4,8($0) sra $5,$3,19 or $3,$1,$3 srl $0,$0,1 addu $5,$1,$3 slti $6,$6,14428 sb $4,9($0) sltiu $4,$5,-10326 or $0,$0,$3 sw $1,12($0) lb $3,12($0) or $3,$3,$3 lw $4,4($0) srav $3,$1,$3 sra $3,$3,5 addu $4,$3,$3 lbu $3,1($0) sll $4,$4,8 slt $3,$3,$3 sllv $4,$4,$3 or $5,$0,$3 lbu $3,0($0) addu $3,$4,$3 addiu $1,$1,-8394 slt $0,$3,$3 subu $3,$0,$3 subu $4,$4,$3 sra $4,$3,6 ori $3,$3,59849 subu $5,$5,$3 xori $1,$3,33363 and $6,$0,$3 addiu $3,$3,23588 sltu $4,$4,$3 lhu $4,6($0) nor $3,$5,$3 lhu $0,2($0) sltu $5,$3,$3 lb $3,12($0) subu $1,$3,$3 srl $6,$3,30 sw $6,16($0) sra $3,$4,14 nor $3,$3,$3 sb $5,11($0) and $5,$1,$3 subu $4,$1,$3 addu $0,$4,$3 slti $1,$5,-7451 lb $6,9($0) addu $0,$3,$3 sh $4,0($0) lbu $3,13($0) sra $6,$1,19 addu $6,$1,$3 andi $6,$0,45788 subu $0,$6,$3 addiu $1,$1,-24430 slti $5,$6,-22194 slti $4,$1,32406 sll $5,$3,13 addiu $5,$1,13450 xor $0,$0,$3 srl $5,$6,26 addu $3,$4,$3 addiu $3,$3,15882 lhu $3,6($0) lb $5,6($0) addiu $4,$5,16082 subu $5,$5,$3 lbu $4,11($0) subu $1,$5,$3 lhu $4,2($0) andi $5,$4,56611 lhu $3,0($0) addiu $6,$2,26509 xor $1,$5,$3 addiu $3,$5,-13870 or $1,$4,$3 srlv $4,$4,$3 xori $6,$4,48199 addiu $6,$3,11499 sllv $3,$3,$3 slti $4,$5,4790 subu $1,$1,$3 sb $1,10($0) andi $6,$3,62614 lb $0,6($0) addiu $5,$4,30628 lhu $4,14($0) lhu $6,14($0) sh $1,2($0) addu $4,$4,$3 xori $4,$1,30975 lbu $4,4($0) lw $4,16($0) ori $0,$5,61998 nor $6,$6,$3 srl $4,$4,13 slti $4,$1,-25558 and $4,$0,$3 lhu $1,10($0) srl $4,$4,27 nor $1,$1,$3 lhu $5,16($0) srl $3,$3,27 nor $5,$6,$3 lb $4,8($0) xor $1,$6,$3 sb $5,9($0) srav $4,$1,$3 xori $3,$4,55048 lw $3,8($0) lh $4,10($0) sw $4,16($0) xori $3,$3,49542 lbu $3,8($0) addu $4,$3,$3 addiu $1,$1,16925 xori $5,$3,34328 lbu $3,4($0) sh $4,0($0) subu $6,$4,$3 sltu $4,$6,$3 lw $1,4($0) lw $1,0($0) lhu $5,4($0) srlv $6,$3,$3 addu $3,$5,$3 sb $3,2($0) sra $5,$5,12 sll $5,$4,20 slti $3,$4,1726 lh $6,12($0) lw $3,8($0) nor $4,$1,$3 sltiu $5,$3,11186 lb $5,7($0) lw $4,0($0) srav $0,$0,$3 ori $5,$5,21145 srl $3,$3,0 lh $1,12($0) lw $4,0($0) subu $5,$3,$3 srav $3,$3,$3 xori $5,$6,61382 sltu $3,$3,$3 sll $5,$5,12 lb $0,9($0) and $1,$4,$3 lhu $1,6($0) addiu $3,$3,28346 addiu $4,$3,-3809 subu $5,$4,$3 sllv $0,$0,$3 subu $3,$5,$3 sh $6,8($0) addiu $4,$4,-31859 slti $5,$0,-23437 addu $3,$6,$3 addu $1,$1,$3 addiu $5,$4,-16540 sll $3,$6,2 or $0,$3,$3 sh $1,16($0) andi $3,$4,53809 sw $4,4($0) sw $1,8($0) lh $0,6($0) sh $1,6($0) srl $1,$5,27 nor $1,$4,$3 srav $0,$5,$3 addu $3,$0,$3 sltu $3,$3,$3 addiu $3,$3,-25608 subu $3,$5,$3 srlv $3,$5,$3 addiu $5,$1,24906 lb $1,0($0) lbu $4,15($0) sltiu $1,$4,15598 sra $3,$4,31 lh $3,14($0) lb $1,8($0) sltu $4,$3,$3 sh $3,14($0) addiu $3,$3,3243 andi $3,$4,32300 xor $1,$5,$3 xor $3,$5,$3 subu $3,$6,$3 subu $4,$3,$3 lw $4,4($0) sh $1,12($0) addu $6,$4,$3 sltiu $5,$5,32269 lbu $3,14($0) addiu $3,$4,16504 sb $1,10($0) lhu $3,10($0) addiu $4,$3,-4769 lhu $3,14($0) srlv $3,$5,$3 subu $6,$6,$3 or $3,$3,$3 or $3,$4,$3 sltiu $4,$4,16152 lbu $5,10($0) subu $6,$6,$3 srlv $3,$3,$3 lh $3,8($0) xori $4,$3,6106 lbu $4,14($0) sll $5,$4,3 lb $4,14($0) slt $0,$3,$3 slti $1,$3,-3017 sll $3,$6,4 lb $3,0($0) sltiu $4,$5,-24248 and $1,$1,$3 srlv $4,$0,$3 subu $6,$6,$3 andi $6,$3,36369 sh $5,10($0) addiu $1,$3,20790 sra $3,$4,21 sltu $4,$4,$3 nor $1,$3,$3 lw $0,4($0) addiu $3,$3,-10532 andi $3,$4,57316 slti $4,$3,9172 andi $4,$4,998 and $3,$3,$3 addu $6,$4,$3 ori $0,$0,26880 sll $0,$0,24 lh $3,2($0) addiu $4,$0,-23291 subu $1,$1,$3 lw $1,12($0) and $1,$5,$3 slt $1,$3,$3 or $4,$3,$3 slti $4,$4,-15075 sltu $0,$6,$3 sw $3,12($0) lb $4,16($0) srlv $3,$5,$3 andi $6,$4,53886 subu $0,$5,$3 lbu $5,12($0) addu $5,$4,$3 lw $3,4($0) addiu $6,$1,-22042 slt $5,$4,$3 sw $3,16($0) slt $5,$3,$3 lh $3,8($0) or $4,$5,$3 lw $3,8($0) sb $5,14($0) srl $3,$3,26 lbu $4,7($0) ori $4,$0,40792 sb $3,9($0) lb $4,8($0) sw $4,16($0) lw $4,0($0) or $5,$5,$3 slti $4,$3,-18003 and $6,$1,$3 sllv $3,$4,$3 xor $1,$1,$3 srlv $1,$0,$3 andi $3,$3,58913 lhu $4,0($0) addu $3,$0,$3 lbu $3,1($0) and $3,$3,$3 lhu $1,2($0) addiu $3,$4,9211 addu $0,$5,$3 subu $3,$3,$3 lb $1,12($0) lw $3,8($0) addiu $4,$5,-3413 or $4,$4,$3 lh $3,10($0) ori $6,$4,21966 slt $0,$1,$3 xor $3,$5,$3 ori $4,$5,44451 andi $5,$1,3491 srlv $4,$4,$3 or $4,$3,$3 lb $4,2($0) addiu $3,$3,-27631 lw $3,12($0) addu $1,$4,$3 sllv $3,$1,$3 lw $1,4($0) sltiu $5,$4,-16287 sltu $4,$1,$3 lw $4,16($0) sra $5,$4,19 srl $1,$3,19 or $4,$4,$3 sw $1,4($0) lbu $0,15($0) sra $0,$3,9 sll $3,$3,25 nor $1,$1,$3 and $4,$4,$3 lw $4,8($0) lw $1,16($0) srlv $6,$4,$3 srav $5,$1,$3 sh $4,6($0) addiu $3,$3,23999 lbu $5,9($0) srav $3,$3,$3 sllv $1,$3,$3 slt $6,$6,$3 lhu $4,14($0) srav $1,$0,$3 and $5,$4,$3 addiu $4,$3,-23827 sltiu $0,$1,19815 addu $4,$5,$3 addu $0,$2,$3 lh $3,2($0) addu $1,$1,$3 srav $5,$4,$3 srav $4,$4,$3 sltiu $4,$5,27970 subu $4,$3,$3 subu $3,$4,$3 sw $1,8($0) sllv $1,$1,$3 and $1,$4,$3 andi $5,$5,17898 srlv $1,$5,$3 addiu $3,$3,29871 sll $3,$3,4 sh $3,10($0) or $3,$4,$3 sltiu $3,$1,9828 srl $1,$4,22 subu $5,$6,$3 addiu $3,$0,-14638 lbu $1,0($0) xori $4,$1,4100 sll $5,$3,20 srl $5,$4,23 subu $4,$4,$3 sb $3,5($0) sllv $3,$3,$3 lw $1,8($0) sw $0,16($0) addiu $5,$4,-9570 slt $5,$5,$3 sh $5,6($0) addu $3,$1,$3 lb $1,2($0) lhu $3,4($0) lbu $4,10($0) addu $3,$3,$3 xor $3,$3,$3 srav $1,$1,$3 lbu $1,7($0) slti $1,$3,31061 sw $4,8($0) slti $1,$5,17564 and $3,$4,$3 addu $4,$5,$3 ori $3,$0,27672 ori $1,$3,57927 addu $5,$3,$3 slti $4,$3,-10653 and $3,$4,$3 sllv $3,$3,$3 subu $3,$5,$3 srl $5,$1,3 sllv $3,$6,$3 lh $0,2($0) and $3,$0,$3 sltu $4,$0,$3 subu $1,$4,$3 subu $4,$5,$3 sll $4,$4,21 xori $3,$5,40425 ori $4,$3,46056 xori $4,$3,54057 srlv $4,$4,$3 subu $4,$4,$3 sll $1,$4,1 srl $4,$4,16 sh $5,16($0) slti $1,$4,-6519 lhu $4,10($0) sllv $5,$3,$3 sra $0,$2,2 lh $4,4($0) and $5,$4,$3 sltu $5,$5,$3 sb $4,12($0) sh $3,6($0) lhu $4,2($0) addu $0,$2,$3 sb $3,16($0) sltiu $4,$6,24160 srav $3,$5,$3 sh $3,8($0) nor $5,$5,$3 srl $3,$0,22 sllv $1,$4,$3 sltiu $0,$3,-3924 lh $5,6($0) slt $3,$3,$3 ori $1,$2,9055 sh $1,14($0) sltiu $3,$0,28249 sltiu $4,$0,10761 addu $6,$4,$3 sra $4,$1,24 nor $0,$3,$3 slti $1,$0,-17674 sw $1,4($0) ori $5,$5,52534 sra $0,$3,26 lh $3,16($0) andi $3,$4,62819 sllv $4,$3,$3 addiu $3,$3,-16965 srav $3,$0,$3 slt $3,$3,$3 lhu $6,16($0) lhu $4,16($0) sw $3,8($0) sh $5,8($0) subu $3,$2,$3 andi $6,$0,7196 srlv $5,$5,$3 addu $3,$1,$3 sltu $5,$4,$3 lh $5,12($0) sll $0,$4,13 or $0,$6,$3 subu $5,$2,$3 and $5,$3,$3 srl $1,$5,11 subu $4,$6,$3 slti $3,$1,-15549 lw $5,8($0) andi $0,$1,30250 and $4,$4,$3 sb $3,12($0) andi $5,$6,41147 nor $4,$4,$3 sb $4,10($0) or $5,$4,$3 addiu $1,$3,-4837 or $1,$1,$3 sllv $5,$0,$3 sw $5,16($0) or $6,$5,$3 addu $3,$1,$3 sra $1,$2,29 subu $3,$1,$3 addu $3,$3,$3 addu $5,$0,$3 sll $5,$5,30 lhu $4,0($0) sllv $4,$5,$3 addu $5,$3,$3 sltiu $4,$5,-11502 addu $1,$5,$3 addu $5,$1,$3 lbu $0,4($0) xor $4,$4,$3 lh $4,6($0) xor $0,$4,$3 ori $5,$5,23295 nor $4,$5,$3 subu $6,$1,$3 sll $6,$6,1 lbu $6,8($0) xor $1,$3,$3 addu $0,$2,$3 andi $4,$3,24702 lb $4,2($0) addiu $1,$1,-8969 sra $5,$5,23 addiu $6,$1,-28995 and $4,$5,$3 xor $3,$4,$3 srlv $3,$6,$3 andi $0,$4,32997 lw $3,12($0) addiu $3,$3,3293 ori $4,$1,16544 lb $0,14($0) lhu $4,12($0) slti $4,$5,31820 srlv $4,$5,$3 slti $6,$6,19037 andi $5,$6,28630 addu $5,$5,$3 and $5,$4,$3 srl $4,$1,7 srav $1,$4,$3 sll $3,$4,29 xor $1,$1,$3 lb $6,5($0) lhu $4,4($0) lw $6,4($0) srav $3,$3,$3 lw $3,16($0) addu $4,$1,$3 sh $4,16($0) sltu $6,$3,$3 or $4,$4,$3 sw $4,4($0) xori $3,$3,43490 sltu $4,$1,$3 subu $1,$5,$3 sra $4,$1,0 lw $4,16($0) addiu $4,$1,26066 andi $1,$4,50513 nor $3,$3,$3 lw $3,4($0) sw $5,16($0) ori $3,$4,18832 andi $4,$4,53565 sra $4,$1,12 or $3,$5,$3 lhu $3,2($0) subu $3,$3,$3 lhu $1,8($0) sh $3,16($0) slti $3,$5,19706 or $3,$3,$3 sra $4,$3,26 addu $1,$3,$3 nor $4,$0,$3 xor $4,$4,$3 lh $3,16($0) addiu $0,$4,-15865 sw $5,4($0) sltiu $4,$2,-32518 lb $5,6($0) subu $3,$5,$3 srav $3,$3,$3 xor $0,$4,$3 addiu $4,$5,-9758 sb $5,11($0) nor $3,$5,$3 sllv $3,$3,$3 lb $5,1($0) lhu $6,2($0) and $6,$4,$3 addu $4,$4,$3 addu $4,$5,$3 xor $3,$3,$3 sra $3,$3,25 lw $0,16($0) addiu $0,$5,4979 and $3,$4,$3 slti $3,$3,18760 addiu $0,$3,14331 sh $0,10($0) xori $1,$4,47192 srl $4,$0,17 addiu $0,$0,-9513 sra $1,$4,0 sra $4,$3,17 slt $4,$3,$3 sw $3,4($0) sltu $4,$6,$3 lb $3,0($0) addu $3,$4,$3 subu $3,$0,$3 or $3,$6,$3 addu $5,$5,$3 lh $6,10($0) sll $3,$3,26 lhu $6,8($0) sllv $3,$3,$3 sllv $6,$5,$3 addu $0,$1,$3 ori $5,$6,59949 and $3,$1,$3 sltiu $4,$2,-29341 lw $4,8($0) xor $3,$3,$3 sw $3,0($0) and $1,$4,$3 lhu $4,10($0) lw $3,4($0) xori $5,$5,60704 andi $3,$2,60796 or $6,$6,$3 slti $0,$3,-9654 sll $3,$1,30 lbu $6,8($0) sltu $3,$5,$3 sw $5,16($0) sltiu $1,$1,5451 srlv $1,$4,$3 lw $6,4($0) subu $5,$5,$3 subu $0,$3,$3 lhu $3,0($0) and $1,$3,$3 lhu $3,16($0) or $3,$5,$3 xori $4,$5,30732 lb $5,7($0) sltu $5,$2,$3 lb $6,10($0) addu $3,$3,$3 addu $4,$5,$3 slti $4,$1,5009 ori $4,$3,23652 srl $4,$3,13 srav $3,$1,$3 sra $4,$4,21 addiu $5,$4,-9562 sra $6,$6,3 subu $1,$1,$3 sll $0,$1,23 sltiu $3,$3,20088 sh $5,0($0) lh $3,10($0) sltu $1,$1,$3 nor $3,$4,$3 subu $4,$5,$3 nor $4,$4,$3 addu $3,$2,$3 subu $0,$5,$3 sra $3,$1,29 sltu $4,$3,$3 lb $2,9($0) subu $5,$5,$3 srl $6,$4,9 sllv $0,$5,$3 srlv $5,$2,$3 sll $3,$1,12 subu $1,$5,$3 sllv $5,$4,$3 addiu $1,$1,15319 addu $4,$5,$3 and $0,$5,$3 lb $0,12($0) lh $3,12($0) or $3,$6,$3 sltu $3,$3,$3 sb $4,11($0) lw $5,0($0) lh $4,2($0) subu $6,$6,$3 xori $4,$4,43983 sra $3,$4,1 slti $1,$3,-31107 lh $5,4($0) addiu $0,$4,-27945 slt $4,$6,$3 sltu $6,$3,$3 sh $1,4($0) or $1,$1,$3 lb $5,15($0) sltiu $4,$5,18976 sw $1,8($0) sh $3,0($0) sltu $5,$1,$3 sb $6,6($0) lbu $4,16($0) subu $4,$2,$3 slt $4,$4,$3 addiu $4,$4,26145 sll $1,$3,29 sw $4,16($0) slti $4,$5,-13128 subu $1,$3,$3 subu $4,$6,$3 sllv $0,$0,$3 srl $0,$2,12 slti $3,$3,-24249 addu $1,$3,$3 slti $5,$5,15811 addiu $5,$0,22654 or $3,$3,$3 xori $1,$6,41341 slti $1,$1,-29326 sw $3,8($0) nor $6,$5,$3 srlv $3,$3,$3 srav $4,$3,$3 srav $3,$3,$3 addu $3,$0,$3 sll $4,$3,21 addiu $6,$3,-11239 slt $4,$6,$3 sh $4,2($0) ori $5,$1,49810 srav $3,$1,$3 nor $3,$3,$3 and $4,$4,$3 sw $4,4($0) sltu $5,$4,$3 sw $3,0($0) addiu $3,$3,21855 lbu $0,4($0) addu $0,$3,$3 xor $6,$3,$3 subu $4,$5,$3 subu $1,$0,$3 addiu $4,$4,22556 addiu $4,$4,-16817 sb $1,2($0) subu $1,$2,$3 sltiu $6,$6,29814 lbu $1,9($0) addu $3,$4,$3 and $3,$3,$3 srlv $5,$5,$3 slti $4,$4,-2040 xor $4,$3,$3 lb $3,15($0) sltiu $5,$3,3349 lb $3,2($0) sw $0,12($0) xori $3,$3,7259 xori $5,$0,35981 andi $1,$1,20853 addiu $3,$1,18388 lhu $4,0($0) sra $1,$1,11 sra $6,$1,16 slt $3,$3,$3 sllv $1,$3,$3 lw $4,0($0) slt $3,$4,$3 sllv $1,$1,$3 sb $1,5($0) sb $6,11($0) xor $4,$5,$3 sw $5,0($0) srav $5,$5,$3 xori $3,$3,40835 sh $1,4($0) lw $1,4($0) lw $4,12($0) or $1,$4,$3 lhu $3,8($0) lh $3,4($0) srav $3,$4,$3 addu $5,$6,$3 slt $4,$3,$3 addu $5,$5,$3 and $3,$3,$3 lb $3,1($0) slti $5,$3,10625 sh $0,6($0) lbu $3,6($0) andi $1,$1,39931 ori $3,$1,15408 addu $3,$3,$3 xor $4,$4,$3 srlv $4,$0,$3 nor $4,$4,$3 xori $3,$3,43909 sb $5,15($0) sltiu $3,$4,-12614 lb $5,4($0) subu $3,$4,$3 or $1,$4,$3 addiu $4,$3,8017 slt $4,$3,$3 subu $4,$5,$3 xor $4,$4,$3 xor $3,$3,$3 xor $3,$3,$3 lh $5,12($0) lbu $5,14($0) nor $4,$1,$3 addu $0,$3,$3 xor $4,$3,$3 addu $1,$1,$3 slti $3,$5,-16902 nor $3,$3,$3 srlv $3,$5,$3 xor $4,$4,$3 srav $5,$3,$3 srlv $5,$3,$3 lh $5,8($0) ori $3,$3,8572 srav $0,$3,$3 addiu $3,$3,27118 srav $6,$4,$3 sb $1,8($0) and $4,$4,$3 or $4,$3,$3 subu $4,$4,$3 srav $3,$3,$3 nor $3,$2,$3 slt $3,$6,$3 addiu $1,$4,10021 andi $4,$4,64650 sb $5,2($0) sltu $4,$4,$3 subu $5,$5,$3 addiu $4,$2,13482 lw $3,8($0) lbu $4,1($0) srav $5,$5,$3 or $5,$4,$3 subu $4,$4,$3 or $4,$1,$3 xori $3,$4,39411 slti $1,$5,14465 addu $3,$3,$3 srlv $4,$4,$3 srlv $3,$3,$3 sb $0,5($0) addu $4,$3,$3 srav $3,$4,$3 srav $3,$3,$3 sw $1,12($0) lh $1,0($0) sb $1,15($0) addu $0,$3,$3 lh $4,6($0) lh $3,10($0) slt $3,$5,$3 addiu $4,$6,-30437 sw $1,8($0) lbu $3,14($0) subu $4,$1,$3 nor $3,$3,$3 nor $3,$4,$3 slti $5,$4,-28489 xori $4,$0,5631 srl $1,$1,29 sllv $5,$3,$3 sllv $0,$5,$3 and $6,$5,$3 subu $4,$0,$3 sllv $6,$0,$3 sra $4,$4,13 lh $4,6($0) ori $3,$5,47491 nor $3,$1,$3 sra $3,$5,4
oeis/091/A091712.asm
neoneye/loda-programs
11
3468
; A091712: a(n)=6(2n-4)!/((n-2)!n!), if n>2. a(0)=1,a(1)=a(2)=2. ; Submitted by <NAME> ; 1,2,2,2,3,6,14,36,99,286,858,2652,8398,27132,89148,297160,1002915,3421710,11785890,40940460,143291610,504932340,1790214660,6382504440,22870640910,82334307276,297670187844,1080432533656,3935861372604 mov $1,1 mov $3,$0 mov $0,10 lpb $3 sub $0,4 mul $1,$0 sub $2,1 div $1,$2 max $1,2 sub $3,1 lpe mov $0,$1
programs/oeis/292/A292465.asm
karttu/loda
1
9739
; A292465: a(n) = n*F(n)*F(n+1), where F = A000045. ; 0,1,4,18,60,200,624,1911,5712,16830,48950,140976,402624,1141933,3219580,9031050,25219824,70153016,194466672,537404835,1480993800,4071156726,11165970794,30561658848,83490220800,227687745625,619938027124,1685442626946,4575973716132,12407913817640,33604489762800,90910286252751,245683839315264,663308911870638,1789188466509470,4821925518118800 mov $1,$0 cal $0,120718 ; Expansion of 3*x/(1 - 2*x^2 - 2*x + x^3). mul $1,$0 div $1,3
operating_sys/zombie.asm
jasper-lov/waterville_os
0
175903
<reponame>jasper-lov/waterville_os<gh_stars>0 _zombie: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(void) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc push -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 51 push %ecx e: 83 ec 04 sub $0x4,%esp if(fork() > 0) 11: e8 65 02 00 00 call 27b <fork> 16: 85 c0 test %eax,%eax 18: 7e 0d jle 27 <main+0x27> sleep(5); // Let child exit before parent. 1a: 83 ec 0c sub $0xc,%esp 1d: 6a 05 push $0x5 1f: e8 ef 02 00 00 call 313 <sleep> 24: 83 c4 10 add $0x10,%esp exit(); 27: e8 57 02 00 00 call 283 <exit> 2c: 66 90 xchg %ax,%ax 2e: 66 90 xchg %ax,%ax 00000030 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 30: 55 push %ebp char *os; os = s; while((*s++ = *t++) != 0) 31: 31 c0 xor %eax,%eax { 33: 89 e5 mov %esp,%ebp 35: 53 push %ebx 36: 8b 4d 08 mov 0x8(%ebp),%ecx 39: 8b 5d 0c mov 0xc(%ebp),%ebx 3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi while((*s++ = *t++) != 0) 40: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx 44: 88 14 01 mov %dl,(%ecx,%eax,1) 47: 83 c0 01 add $0x1,%eax 4a: 84 d2 test %dl,%dl 4c: 75 f2 jne 40 <strcpy+0x10> ; return os; } 4e: 8b 5d fc mov -0x4(%ebp),%ebx 51: 89 c8 mov %ecx,%eax 53: c9 leave 54: c3 ret 55: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 5c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000060 <strcmp>: int strcmp(const char *p, const char *q) { 60: 55 push %ebp 61: 89 e5 mov %esp,%ebp 63: 53 push %ebx 64: 8b 55 08 mov 0x8(%ebp),%edx 67: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 6a: 0f b6 02 movzbl (%edx),%eax 6d: 84 c0 test %al,%al 6f: 75 17 jne 88 <strcmp+0x28> 71: eb 3a jmp ad <strcmp+0x4d> 73: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 77: 90 nop 78: 0f b6 42 01 movzbl 0x1(%edx),%eax p++, q++; 7c: 83 c2 01 add $0x1,%edx 7f: 8d 59 01 lea 0x1(%ecx),%ebx while(*p && *p == *q) 82: 84 c0 test %al,%al 84: 74 1a je a0 <strcmp+0x40> p++, q++; 86: 89 d9 mov %ebx,%ecx while(*p && *p == *q) 88: 0f b6 19 movzbl (%ecx),%ebx 8b: 38 c3 cmp %al,%bl 8d: 74 e9 je 78 <strcmp+0x18> return (uchar)*p - (uchar)*q; 8f: 29 d8 sub %ebx,%eax } 91: 8b 5d fc mov -0x4(%ebp),%ebx 94: c9 leave 95: c3 ret 96: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 9d: 8d 76 00 lea 0x0(%esi),%esi return (uchar)*p - (uchar)*q; a0: 0f b6 59 01 movzbl 0x1(%ecx),%ebx a4: 31 c0 xor %eax,%eax a6: 29 d8 sub %ebx,%eax } a8: 8b 5d fc mov -0x4(%ebp),%ebx ab: c9 leave ac: c3 ret return (uchar)*p - (uchar)*q; ad: 0f b6 19 movzbl (%ecx),%ebx b0: 31 c0 xor %eax,%eax b2: eb db jmp 8f <strcmp+0x2f> b4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi bb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bf: 90 nop 000000c0 <strlen>: uint strlen(const char *s) { c0: 55 push %ebp c1: 89 e5 mov %esp,%ebp c3: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) c6: 80 3a 00 cmpb $0x0,(%edx) c9: 74 15 je e0 <strlen+0x20> cb: 31 c0 xor %eax,%eax cd: 8d 76 00 lea 0x0(%esi),%esi d0: 83 c0 01 add $0x1,%eax d3: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) d7: 89 c1 mov %eax,%ecx d9: 75 f5 jne d0 <strlen+0x10> ; return n; } db: 89 c8 mov %ecx,%eax dd: 5d pop %ebp de: c3 ret df: 90 nop for(n = 0; s[n]; n++) e0: 31 c9 xor %ecx,%ecx } e2: 5d pop %ebp e3: 89 c8 mov %ecx,%eax e5: c3 ret e6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ed: 8d 76 00 lea 0x0(%esi),%esi 000000f0 <memset>: void* memset(void *dst, int c, uint n) { f0: 55 push %ebp f1: 89 e5 mov %esp,%ebp f3: 57 push %edi f4: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : f7: 8b 4d 10 mov 0x10(%ebp),%ecx fa: 8b 45 0c mov 0xc(%ebp),%eax fd: 89 d7 mov %edx,%edi ff: fc cld 100: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 102: 8b 7d fc mov -0x4(%ebp),%edi 105: 89 d0 mov %edx,%eax 107: c9 leave 108: c3 ret 109: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000110 <strchr>: char* strchr(const char *s, char c) { 110: 55 push %ebp 111: 89 e5 mov %esp,%ebp 113: 8b 45 08 mov 0x8(%ebp),%eax 116: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) 11a: 0f b6 10 movzbl (%eax),%edx 11d: 84 d2 test %dl,%dl 11f: 75 12 jne 133 <strchr+0x23> 121: eb 1d jmp 140 <strchr+0x30> 123: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 127: 90 nop 128: 0f b6 50 01 movzbl 0x1(%eax),%edx 12c: 83 c0 01 add $0x1,%eax 12f: 84 d2 test %dl,%dl 131: 74 0d je 140 <strchr+0x30> if(*s == c) 133: 38 d1 cmp %dl,%cl 135: 75 f1 jne 128 <strchr+0x18> return (char*)s; return 0; } 137: 5d pop %ebp 138: c3 ret 139: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return 0; 140: 31 c0 xor %eax,%eax } 142: 5d pop %ebp 143: c3 ret 144: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 14b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 14f: 90 nop 00000150 <gets>: char* gets(char *buf, int max) { 150: 55 push %ebp 151: 89 e5 mov %esp,%ebp 153: 57 push %edi 154: 56 push %esi int i, cc; char c; for(i=0; i+1 < max; ){ cc = read(0, &c, 1); 155: 8d 7d e7 lea -0x19(%ebp),%edi { 158: 53 push %ebx for(i=0; i+1 < max; ){ 159: 31 db xor %ebx,%ebx { 15b: 83 ec 1c sub $0x1c,%esp for(i=0; i+1 < max; ){ 15e: eb 27 jmp 187 <gets+0x37> cc = read(0, &c, 1); 160: 83 ec 04 sub $0x4,%esp 163: 6a 01 push $0x1 165: 57 push %edi 166: 6a 00 push $0x0 168: e8 2e 01 00 00 call 29b <read> if(cc < 1) 16d: 83 c4 10 add $0x10,%esp 170: 85 c0 test %eax,%eax 172: 7e 1d jle 191 <gets+0x41> break; buf[i++] = c; 174: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 178: 8b 55 08 mov 0x8(%ebp),%edx 17b: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 17f: 3c 0a cmp $0xa,%al 181: 74 1d je 1a0 <gets+0x50> 183: 3c 0d cmp $0xd,%al 185: 74 19 je 1a0 <gets+0x50> for(i=0; i+1 < max; ){ 187: 89 de mov %ebx,%esi 189: 83 c3 01 add $0x1,%ebx 18c: 3b 5d 0c cmp 0xc(%ebp),%ebx 18f: 7c cf jl 160 <gets+0x10> break; } buf[i] = '\0'; 191: 8b 45 08 mov 0x8(%ebp),%eax 194: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 198: 8d 65 f4 lea -0xc(%ebp),%esp 19b: 5b pop %ebx 19c: 5e pop %esi 19d: 5f pop %edi 19e: 5d pop %ebp 19f: c3 ret buf[i] = '\0'; 1a0: 8b 45 08 mov 0x8(%ebp),%eax 1a3: 89 de mov %ebx,%esi 1a5: c6 04 30 00 movb $0x0,(%eax,%esi,1) } 1a9: 8d 65 f4 lea -0xc(%ebp),%esp 1ac: 5b pop %ebx 1ad: 5e pop %esi 1ae: 5f pop %edi 1af: 5d pop %ebp 1b0: c3 ret 1b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1b8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1bf: 90 nop 000001c0 <stat>: int stat(const char *n, struct stat *st) { 1c0: 55 push %ebp 1c1: 89 e5 mov %esp,%ebp 1c3: 56 push %esi 1c4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 1c5: 83 ec 08 sub $0x8,%esp 1c8: 6a 00 push $0x0 1ca: ff 75 08 push 0x8(%ebp) 1cd: e8 f1 00 00 00 call 2c3 <open> if(fd < 0) 1d2: 83 c4 10 add $0x10,%esp 1d5: 85 c0 test %eax,%eax 1d7: 78 27 js 200 <stat+0x40> return -1; r = fstat(fd, st); 1d9: 83 ec 08 sub $0x8,%esp 1dc: ff 75 0c push 0xc(%ebp) 1df: 89 c3 mov %eax,%ebx 1e1: 50 push %eax 1e2: e8 f4 00 00 00 call 2db <fstat> close(fd); 1e7: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 1ea: 89 c6 mov %eax,%esi close(fd); 1ec: e8 ba 00 00 00 call 2ab <close> return r; 1f1: 83 c4 10 add $0x10,%esp } 1f4: 8d 65 f8 lea -0x8(%ebp),%esp 1f7: 89 f0 mov %esi,%eax 1f9: 5b pop %ebx 1fa: 5e pop %esi 1fb: 5d pop %ebp 1fc: c3 ret 1fd: 8d 76 00 lea 0x0(%esi),%esi return -1; 200: be ff ff ff ff mov $0xffffffff,%esi 205: eb ed jmp 1f4 <stat+0x34> 207: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 20e: 66 90 xchg %ax,%ax 00000210 <atoi>: int atoi(const char *s) { 210: 55 push %ebp 211: 89 e5 mov %esp,%ebp 213: 53 push %ebx 214: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') 217: 0f be 02 movsbl (%edx),%eax 21a: 8d 48 d0 lea -0x30(%eax),%ecx 21d: 80 f9 09 cmp $0x9,%cl n = 0; 220: b9 00 00 00 00 mov $0x0,%ecx while('0' <= *s && *s <= '9') 225: 77 1e ja 245 <atoi+0x35> 227: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 22e: 66 90 xchg %ax,%ax n = n*10 + *s++ - '0'; 230: 83 c2 01 add $0x1,%edx 233: 8d 0c 89 lea (%ecx,%ecx,4),%ecx 236: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') 23a: 0f be 02 movsbl (%edx),%eax 23d: 8d 58 d0 lea -0x30(%eax),%ebx 240: 80 fb 09 cmp $0x9,%bl 243: 76 eb jbe 230 <atoi+0x20> return n; } 245: 8b 5d fc mov -0x4(%ebp),%ebx 248: 89 c8 mov %ecx,%eax 24a: c9 leave 24b: c3 ret 24c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000250 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 250: 55 push %ebp 251: 89 e5 mov %esp,%ebp 253: 57 push %edi 254: 8b 45 10 mov 0x10(%ebp),%eax 257: 8b 55 08 mov 0x8(%ebp),%edx 25a: 56 push %esi 25b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 25e: 85 c0 test %eax,%eax 260: 7e 13 jle 275 <memmove+0x25> 262: 01 d0 add %edx,%eax dst = vdst; 264: 89 d7 mov %edx,%edi 266: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 26d: 8d 76 00 lea 0x0(%esi),%esi *dst++ = *src++; 270: a4 movsb %ds:(%esi),%es:(%edi) while(n-- > 0) 271: 39 f8 cmp %edi,%eax 273: 75 fb jne 270 <memmove+0x20> return vdst; } 275: 5e pop %esi 276: 89 d0 mov %edx,%eax 278: 5f pop %edi 279: 5d pop %ebp 27a: c3 ret 0000027b <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 27b: b8 01 00 00 00 mov $0x1,%eax 280: cd 40 int $0x40 282: c3 ret 00000283 <exit>: SYSCALL(exit) 283: b8 02 00 00 00 mov $0x2,%eax 288: cd 40 int $0x40 28a: c3 ret 0000028b <wait>: SYSCALL(wait) 28b: b8 03 00 00 00 mov $0x3,%eax 290: cd 40 int $0x40 292: c3 ret 00000293 <pipe>: SYSCALL(pipe) 293: b8 04 00 00 00 mov $0x4,%eax 298: cd 40 int $0x40 29a: c3 ret 0000029b <read>: SYSCALL(read) 29b: b8 05 00 00 00 mov $0x5,%eax 2a0: cd 40 int $0x40 2a2: c3 ret 000002a3 <write>: SYSCALL(write) 2a3: b8 10 00 00 00 mov $0x10,%eax 2a8: cd 40 int $0x40 2aa: c3 ret 000002ab <close>: SYSCALL(close) 2ab: b8 15 00 00 00 mov $0x15,%eax 2b0: cd 40 int $0x40 2b2: c3 ret 000002b3 <kill>: SYSCALL(kill) 2b3: b8 06 00 00 00 mov $0x6,%eax 2b8: cd 40 int $0x40 2ba: c3 ret 000002bb <exec>: SYSCALL(exec) 2bb: b8 07 00 00 00 mov $0x7,%eax 2c0: cd 40 int $0x40 2c2: c3 ret 000002c3 <open>: SYSCALL(open) 2c3: b8 0f 00 00 00 mov $0xf,%eax 2c8: cd 40 int $0x40 2ca: c3 ret 000002cb <mknod>: SYSCALL(mknod) 2cb: b8 11 00 00 00 mov $0x11,%eax 2d0: cd 40 int $0x40 2d2: c3 ret 000002d3 <unlink>: SYSCALL(unlink) 2d3: b8 12 00 00 00 mov $0x12,%eax 2d8: cd 40 int $0x40 2da: c3 ret 000002db <fstat>: SYSCALL(fstat) 2db: b8 08 00 00 00 mov $0x8,%eax 2e0: cd 40 int $0x40 2e2: c3 ret 000002e3 <link>: SYSCALL(link) 2e3: b8 13 00 00 00 mov $0x13,%eax 2e8: cd 40 int $0x40 2ea: c3 ret 000002eb <mkdir>: SYSCALL(mkdir) 2eb: b8 14 00 00 00 mov $0x14,%eax 2f0: cd 40 int $0x40 2f2: c3 ret 000002f3 <chdir>: SYSCALL(chdir) 2f3: b8 09 00 00 00 mov $0x9,%eax 2f8: cd 40 int $0x40 2fa: c3 ret 000002fb <dup>: SYSCALL(dup) 2fb: b8 0a 00 00 00 mov $0xa,%eax 300: cd 40 int $0x40 302: c3 ret 00000303 <getpid>: SYSCALL(getpid) 303: b8 0b 00 00 00 mov $0xb,%eax 308: cd 40 int $0x40 30a: c3 ret 0000030b <sbrk>: SYSCALL(sbrk) 30b: b8 0c 00 00 00 mov $0xc,%eax 310: cd 40 int $0x40 312: c3 ret 00000313 <sleep>: SYSCALL(sleep) 313: b8 0d 00 00 00 mov $0xd,%eax 318: cd 40 int $0x40 31a: c3 ret 0000031b <uptime>: SYSCALL(uptime) 31b: b8 0e 00 00 00 mov $0xe,%eax 320: cd 40 int $0x40 322: c3 ret 00000323 <ps>: SYSCALL(ps) 323: b8 16 00 00 00 mov $0x16,%eax 328: cd 40 int $0x40 32a: c3 ret 0000032b <chpr>: SYSCALL(chpr) 32b: b8 17 00 00 00 mov $0x17,%eax 330: cd 40 int $0x40 332: c3 ret 333: 66 90 xchg %ax,%ax 335: 66 90 xchg %ax,%ax 337: 66 90 xchg %ax,%ax 339: 66 90 xchg %ax,%ax 33b: 66 90 xchg %ax,%ax 33d: 66 90 xchg %ax,%ax 33f: 90 nop 00000340 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 340: 55 push %ebp 341: 89 e5 mov %esp,%ebp 343: 57 push %edi 344: 56 push %esi 345: 53 push %ebx 346: 83 ec 3c sub $0x3c,%esp 349: 89 4d c4 mov %ecx,-0x3c(%ebp) uint x; neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; 34c: 89 d1 mov %edx,%ecx { 34e: 89 45 b8 mov %eax,-0x48(%ebp) if(sgn && xx < 0){ 351: 85 d2 test %edx,%edx 353: 0f 89 7f 00 00 00 jns 3d8 <printint+0x98> 359: f6 45 08 01 testb $0x1,0x8(%ebp) 35d: 74 79 je 3d8 <printint+0x98> neg = 1; 35f: c7 45 bc 01 00 00 00 movl $0x1,-0x44(%ebp) x = -xx; 366: f7 d9 neg %ecx } else { x = xx; } i = 0; 368: 31 db xor %ebx,%ebx 36a: 8d 75 d7 lea -0x29(%ebp),%esi 36d: 8d 76 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 370: 89 c8 mov %ecx,%eax 372: 31 d2 xor %edx,%edx 374: 89 cf mov %ecx,%edi 376: f7 75 c4 divl -0x3c(%ebp) 379: 0f b6 92 78 07 00 00 movzbl 0x778(%edx),%edx 380: 89 45 c0 mov %eax,-0x40(%ebp) 383: 89 d8 mov %ebx,%eax 385: 8d 5b 01 lea 0x1(%ebx),%ebx }while((x /= base) != 0); 388: 8b 4d c0 mov -0x40(%ebp),%ecx buf[i++] = digits[x % base]; 38b: 88 14 1e mov %dl,(%esi,%ebx,1) }while((x /= base) != 0); 38e: 39 7d c4 cmp %edi,-0x3c(%ebp) 391: 76 dd jbe 370 <printint+0x30> if(neg) 393: 8b 4d bc mov -0x44(%ebp),%ecx 396: 85 c9 test %ecx,%ecx 398: 74 0c je 3a6 <printint+0x66> buf[i++] = '-'; 39a: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) buf[i++] = digits[x % base]; 39f: 89 d8 mov %ebx,%eax buf[i++] = '-'; 3a1: ba 2d 00 00 00 mov $0x2d,%edx while(--i >= 0) 3a6: 8b 7d b8 mov -0x48(%ebp),%edi 3a9: 8d 5c 05 d7 lea -0x29(%ebp,%eax,1),%ebx 3ad: eb 07 jmp 3b6 <printint+0x76> 3af: 90 nop putc(fd, buf[i]); 3b0: 0f b6 13 movzbl (%ebx),%edx 3b3: 83 eb 01 sub $0x1,%ebx write(fd, &c, 1); 3b6: 83 ec 04 sub $0x4,%esp 3b9: 88 55 d7 mov %dl,-0x29(%ebp) 3bc: 6a 01 push $0x1 3be: 56 push %esi 3bf: 57 push %edi 3c0: e8 de fe ff ff call 2a3 <write> while(--i >= 0) 3c5: 83 c4 10 add $0x10,%esp 3c8: 39 de cmp %ebx,%esi 3ca: 75 e4 jne 3b0 <printint+0x70> } 3cc: 8d 65 f4 lea -0xc(%ebp),%esp 3cf: 5b pop %ebx 3d0: 5e pop %esi 3d1: 5f pop %edi 3d2: 5d pop %ebp 3d3: c3 ret 3d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; 3d8: c7 45 bc 00 00 00 00 movl $0x0,-0x44(%ebp) 3df: eb 87 jmp 368 <printint+0x28> 3e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 3e8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 3ef: 90 nop 000003f0 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 3f0: 55 push %ebp 3f1: 89 e5 mov %esp,%ebp 3f3: 57 push %edi 3f4: 56 push %esi 3f5: 53 push %ebx 3f6: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 3f9: 8b 5d 0c mov 0xc(%ebp),%ebx { 3fc: 8b 75 08 mov 0x8(%ebp),%esi for(i = 0; fmt[i]; i++){ 3ff: 0f b6 13 movzbl (%ebx),%edx 402: 84 d2 test %dl,%dl 404: 74 6a je 470 <printf+0x80> ap = (uint*)(void*)&fmt + 1; 406: 8d 45 10 lea 0x10(%ebp),%eax 409: 83 c3 01 add $0x1,%ebx write(fd, &c, 1); 40c: 8d 7d e7 lea -0x19(%ebp),%edi state = 0; 40f: 31 c9 xor %ecx,%ecx ap = (uint*)(void*)&fmt + 1; 411: 89 45 d0 mov %eax,-0x30(%ebp) 414: eb 36 jmp 44c <printf+0x5c> 416: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 41d: 8d 76 00 lea 0x0(%esi),%esi 420: 89 4d d4 mov %ecx,-0x2c(%ebp) c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; 423: b9 25 00 00 00 mov $0x25,%ecx if(c == '%'){ 428: 83 f8 25 cmp $0x25,%eax 42b: 74 15 je 442 <printf+0x52> write(fd, &c, 1); 42d: 83 ec 04 sub $0x4,%esp 430: 88 55 e7 mov %dl,-0x19(%ebp) 433: 6a 01 push $0x1 435: 57 push %edi 436: 56 push %esi 437: e8 67 fe ff ff call 2a3 <write> 43c: 8b 4d d4 mov -0x2c(%ebp),%ecx } else { putc(fd, c); 43f: 83 c4 10 add $0x10,%esp for(i = 0; fmt[i]; i++){ 442: 0f b6 13 movzbl (%ebx),%edx 445: 83 c3 01 add $0x1,%ebx 448: 84 d2 test %dl,%dl 44a: 74 24 je 470 <printf+0x80> c = fmt[i] & 0xff; 44c: 0f b6 c2 movzbl %dl,%eax if(state == 0){ 44f: 85 c9 test %ecx,%ecx 451: 74 cd je 420 <printf+0x30> } } else if(state == '%'){ 453: 83 f9 25 cmp $0x25,%ecx 456: 75 ea jne 442 <printf+0x52> if(c == 'd'){ 458: 83 f8 25 cmp $0x25,%eax 45b: 0f 84 07 01 00 00 je 568 <printf+0x178> 461: 83 e8 63 sub $0x63,%eax 464: 83 f8 15 cmp $0x15,%eax 467: 77 17 ja 480 <printf+0x90> 469: ff 24 85 20 07 00 00 jmp *0x720(,%eax,4) putc(fd, c); } state = 0; } } } 470: 8d 65 f4 lea -0xc(%ebp),%esp 473: 5b pop %ebx 474: 5e pop %esi 475: 5f pop %edi 476: 5d pop %ebp 477: c3 ret 478: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 47f: 90 nop write(fd, &c, 1); 480: 83 ec 04 sub $0x4,%esp 483: 88 55 d4 mov %dl,-0x2c(%ebp) 486: 6a 01 push $0x1 488: 57 push %edi 489: 56 push %esi 48a: c6 45 e7 25 movb $0x25,-0x19(%ebp) 48e: e8 10 fe ff ff call 2a3 <write> putc(fd, c); 493: 0f b6 55 d4 movzbl -0x2c(%ebp),%edx write(fd, &c, 1); 497: 83 c4 0c add $0xc,%esp 49a: 88 55 e7 mov %dl,-0x19(%ebp) 49d: 6a 01 push $0x1 49f: 57 push %edi 4a0: 56 push %esi 4a1: e8 fd fd ff ff call 2a3 <write> putc(fd, c); 4a6: 83 c4 10 add $0x10,%esp state = 0; 4a9: 31 c9 xor %ecx,%ecx 4ab: eb 95 jmp 442 <printf+0x52> 4ad: 8d 76 00 lea 0x0(%esi),%esi printint(fd, *ap, 16, 0); 4b0: 83 ec 0c sub $0xc,%esp 4b3: b9 10 00 00 00 mov $0x10,%ecx 4b8: 6a 00 push $0x0 4ba: 8b 45 d0 mov -0x30(%ebp),%eax 4bd: 8b 10 mov (%eax),%edx 4bf: 89 f0 mov %esi,%eax 4c1: e8 7a fe ff ff call 340 <printint> ap++; 4c6: 83 45 d0 04 addl $0x4,-0x30(%ebp) 4ca: 83 c4 10 add $0x10,%esp state = 0; 4cd: 31 c9 xor %ecx,%ecx 4cf: e9 6e ff ff ff jmp 442 <printf+0x52> 4d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi s = (char*)*ap; 4d8: 8b 45 d0 mov -0x30(%ebp),%eax 4db: 8b 10 mov (%eax),%edx ap++; 4dd: 83 c0 04 add $0x4,%eax 4e0: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) 4e3: 85 d2 test %edx,%edx 4e5: 0f 84 8d 00 00 00 je 578 <printf+0x188> while(*s != 0){ 4eb: 0f b6 02 movzbl (%edx),%eax state = 0; 4ee: 31 c9 xor %ecx,%ecx while(*s != 0){ 4f0: 84 c0 test %al,%al 4f2: 0f 84 4a ff ff ff je 442 <printf+0x52> 4f8: 89 5d d4 mov %ebx,-0x2c(%ebp) 4fb: 89 d3 mov %edx,%ebx 4fd: 8d 76 00 lea 0x0(%esi),%esi write(fd, &c, 1); 500: 83 ec 04 sub $0x4,%esp s++; 503: 83 c3 01 add $0x1,%ebx 506: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); 509: 6a 01 push $0x1 50b: 57 push %edi 50c: 56 push %esi 50d: e8 91 fd ff ff call 2a3 <write> while(*s != 0){ 512: 0f b6 03 movzbl (%ebx),%eax 515: 83 c4 10 add $0x10,%esp 518: 84 c0 test %al,%al 51a: 75 e4 jne 500 <printf+0x110> state = 0; 51c: 8b 5d d4 mov -0x2c(%ebp),%ebx 51f: 31 c9 xor %ecx,%ecx 521: e9 1c ff ff ff jmp 442 <printf+0x52> 526: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 52d: 8d 76 00 lea 0x0(%esi),%esi printint(fd, *ap, 10, 1); 530: 83 ec 0c sub $0xc,%esp 533: b9 0a 00 00 00 mov $0xa,%ecx 538: 6a 01 push $0x1 53a: e9 7b ff ff ff jmp 4ba <printf+0xca> 53f: 90 nop putc(fd, *ap); 540: 8b 45 d0 mov -0x30(%ebp),%eax write(fd, &c, 1); 543: 83 ec 04 sub $0x4,%esp putc(fd, *ap); 546: 8b 00 mov (%eax),%eax write(fd, &c, 1); 548: 6a 01 push $0x1 54a: 57 push %edi 54b: 56 push %esi putc(fd, *ap); 54c: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); 54f: e8 4f fd ff ff call 2a3 <write> ap++; 554: 83 45 d0 04 addl $0x4,-0x30(%ebp) 558: 83 c4 10 add $0x10,%esp state = 0; 55b: 31 c9 xor %ecx,%ecx 55d: e9 e0 fe ff ff jmp 442 <printf+0x52> 562: 8d b6 00 00 00 00 lea 0x0(%esi),%esi putc(fd, c); 568: 88 55 e7 mov %dl,-0x19(%ebp) write(fd, &c, 1); 56b: 83 ec 04 sub $0x4,%esp 56e: e9 2a ff ff ff jmp 49d <printf+0xad> 573: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 577: 90 nop s = "(null)"; 578: ba 18 07 00 00 mov $0x718,%edx while(*s != 0){ 57d: 89 5d d4 mov %ebx,-0x2c(%ebp) 580: b8 28 00 00 00 mov $0x28,%eax 585: 89 d3 mov %edx,%ebx 587: e9 74 ff ff ff jmp 500 <printf+0x110> 58c: 66 90 xchg %ax,%ax 58e: 66 90 xchg %ax,%ax 00000590 <free>: static Header base; static Header *freep; void free(void *ap) { 590: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 591: a1 8c 07 00 00 mov 0x78c,%eax { 596: 89 e5 mov %esp,%ebp 598: 57 push %edi 599: 56 push %esi 59a: 53 push %ebx 59b: 8b 5d 08 mov 0x8(%ebp),%ebx bp = (Header*)ap - 1; 59e: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 5a8: 89 c2 mov %eax,%edx 5aa: 8b 00 mov (%eax),%eax 5ac: 39 ca cmp %ecx,%edx 5ae: 73 30 jae 5e0 <free+0x50> 5b0: 39 c1 cmp %eax,%ecx 5b2: 72 04 jb 5b8 <free+0x28> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5b4: 39 c2 cmp %eax,%edx 5b6: 72 f0 jb 5a8 <free+0x18> break; if(bp + bp->s.size == p->s.ptr){ 5b8: 8b 73 fc mov -0x4(%ebx),%esi 5bb: 8d 3c f1 lea (%ecx,%esi,8),%edi 5be: 39 f8 cmp %edi,%eax 5c0: 74 30 je 5f2 <free+0x62> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; 5c2: 89 43 f8 mov %eax,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 5c5: 8b 42 04 mov 0x4(%edx),%eax 5c8: 8d 34 c2 lea (%edx,%eax,8),%esi 5cb: 39 f1 cmp %esi,%ecx 5cd: 74 3a je 609 <free+0x79> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; 5cf: 89 0a mov %ecx,(%edx) } else p->s.ptr = bp; freep = p; } 5d1: 5b pop %ebx freep = p; 5d2: 89 15 8c 07 00 00 mov %edx,0x78c } 5d8: 5e pop %esi 5d9: 5f pop %edi 5da: 5d pop %ebp 5db: c3 ret 5dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5e0: 39 c2 cmp %eax,%edx 5e2: 72 c4 jb 5a8 <free+0x18> 5e4: 39 c1 cmp %eax,%ecx 5e6: 73 c0 jae 5a8 <free+0x18> if(bp + bp->s.size == p->s.ptr){ 5e8: 8b 73 fc mov -0x4(%ebx),%esi 5eb: 8d 3c f1 lea (%ecx,%esi,8),%edi 5ee: 39 f8 cmp %edi,%eax 5f0: 75 d0 jne 5c2 <free+0x32> bp->s.size += p->s.ptr->s.size; 5f2: 03 70 04 add 0x4(%eax),%esi 5f5: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 5f8: 8b 02 mov (%edx),%eax 5fa: 8b 00 mov (%eax),%eax 5fc: 89 43 f8 mov %eax,-0x8(%ebx) if(p + p->s.size == bp){ 5ff: 8b 42 04 mov 0x4(%edx),%eax 602: 8d 34 c2 lea (%edx,%eax,8),%esi 605: 39 f1 cmp %esi,%ecx 607: 75 c6 jne 5cf <free+0x3f> p->s.size += bp->s.size; 609: 03 43 fc add -0x4(%ebx),%eax freep = p; 60c: 89 15 8c 07 00 00 mov %edx,0x78c p->s.size += bp->s.size; 612: 89 42 04 mov %eax,0x4(%edx) p->s.ptr = bp->s.ptr; 615: 8b 4b f8 mov -0x8(%ebx),%ecx 618: 89 0a mov %ecx,(%edx) } 61a: 5b pop %ebx 61b: 5e pop %esi 61c: 5f pop %edi 61d: 5d pop %ebp 61e: c3 ret 61f: 90 nop 00000620 <malloc>: return freep; } void* malloc(uint nbytes) { 620: 55 push %ebp 621: 89 e5 mov %esp,%ebp 623: 57 push %edi 624: 56 push %esi 625: 53 push %ebx 626: 83 ec 1c sub $0x1c,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 629: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 62c: 8b 3d 8c 07 00 00 mov 0x78c,%edi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 632: 8d 70 07 lea 0x7(%eax),%esi 635: c1 ee 03 shr $0x3,%esi 638: 83 c6 01 add $0x1,%esi if((prevp = freep) == 0){ 63b: 85 ff test %edi,%edi 63d: 0f 84 9d 00 00 00 je 6e0 <malloc+0xc0> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 643: 8b 17 mov (%edi),%edx if(p->s.size >= nunits){ 645: 8b 4a 04 mov 0x4(%edx),%ecx 648: 39 f1 cmp %esi,%ecx 64a: 73 6a jae 6b6 <malloc+0x96> 64c: bb 00 10 00 00 mov $0x1000,%ebx 651: 39 de cmp %ebx,%esi 653: 0f 43 de cmovae %esi,%ebx p = sbrk(nu * sizeof(Header)); 656: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax 65d: 89 45 e4 mov %eax,-0x1c(%ebp) 660: eb 17 jmp 679 <malloc+0x59> 662: 8d b6 00 00 00 00 lea 0x0(%esi),%esi for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 668: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 66a: 8b 48 04 mov 0x4(%eax),%ecx 66d: 39 f1 cmp %esi,%ecx 66f: 73 4f jae 6c0 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 671: 8b 3d 8c 07 00 00 mov 0x78c,%edi 677: 89 c2 mov %eax,%edx 679: 39 d7 cmp %edx,%edi 67b: 75 eb jne 668 <malloc+0x48> p = sbrk(nu * sizeof(Header)); 67d: 83 ec 0c sub $0xc,%esp 680: ff 75 e4 push -0x1c(%ebp) 683: e8 83 fc ff ff call 30b <sbrk> if(p == (char*)-1) 688: 83 c4 10 add $0x10,%esp 68b: 83 f8 ff cmp $0xffffffff,%eax 68e: 74 1c je 6ac <malloc+0x8c> hp->s.size = nu; 690: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 693: 83 ec 0c sub $0xc,%esp 696: 83 c0 08 add $0x8,%eax 699: 50 push %eax 69a: e8 f1 fe ff ff call 590 <free> return freep; 69f: 8b 15 8c 07 00 00 mov 0x78c,%edx if((p = morecore(nunits)) == 0) 6a5: 83 c4 10 add $0x10,%esp 6a8: 85 d2 test %edx,%edx 6aa: 75 bc jne 668 <malloc+0x48> return 0; } } 6ac: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 6af: 31 c0 xor %eax,%eax } 6b1: 5b pop %ebx 6b2: 5e pop %esi 6b3: 5f pop %edi 6b4: 5d pop %ebp 6b5: c3 ret if(p->s.size >= nunits){ 6b6: 89 d0 mov %edx,%eax 6b8: 89 fa mov %edi,%edx 6ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(p->s.size == nunits) 6c0: 39 ce cmp %ecx,%esi 6c2: 74 4c je 710 <malloc+0xf0> p->s.size -= nunits; 6c4: 29 f1 sub %esi,%ecx 6c6: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 6c9: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 6cc: 89 70 04 mov %esi,0x4(%eax) freep = prevp; 6cf: 89 15 8c 07 00 00 mov %edx,0x78c } 6d5: 8d 65 f4 lea -0xc(%ebp),%esp return (void*)(p + 1); 6d8: 83 c0 08 add $0x8,%eax } 6db: 5b pop %ebx 6dc: 5e pop %esi 6dd: 5f pop %edi 6de: 5d pop %ebp 6df: c3 ret base.s.ptr = freep = prevp = &base; 6e0: c7 05 8c 07 00 00 90 movl $0x790,0x78c 6e7: 07 00 00 base.s.size = 0; 6ea: bf 90 07 00 00 mov $0x790,%edi base.s.ptr = freep = prevp = &base; 6ef: c7 05 90 07 00 00 90 movl $0x790,0x790 6f6: 07 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 6f9: 89 fa mov %edi,%edx base.s.size = 0; 6fb: c7 05 94 07 00 00 00 movl $0x0,0x794 702: 00 00 00 if(p->s.size >= nunits){ 705: e9 42 ff ff ff jmp 64c <malloc+0x2c> 70a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi prevp->s.ptr = p->s.ptr; 710: 8b 08 mov (%eax),%ecx 712: 89 0a mov %ecx,(%edx) 714: eb b9 jmp 6cf <malloc+0xaf>
alloy4fun_models/trashltl/models/5/X4S4te8HdByZhZaT2.als
Kaixi26/org.alloytools.alloy
0
2709
<reponame>Kaixi26/org.alloytools.alloy<filename>alloy4fun_models/trashltl/models/5/X4S4te8HdByZhZaT2.als open main pred idX4S4te8HdByZhZaT2_prop6 { all f:File | f in Trash implies always f in Trash } pred __repair { idX4S4te8HdByZhZaT2_prop6 } check __repair { idX4S4te8HdByZhZaT2_prop6 <=> prop6o }
third_party/webrtc/src/chromium/src/third_party/libjpeg_turbo/simd/jcqnts2i.asm
bopopescu/webrtc-streaming-node
27
92954
<reponame>bopopescu/webrtc-streaming-node ; ; jcqnts2i.asm - sample data conversion and quantization (SSE2) ; ; Copyright 2009 Pierre Ossman <<EMAIL>> for Cendio AB ; ; Based on ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. ; For conditions of distribution and use, see copyright notice in jsimdext.inc ; ; This file should be assembled with NASM (Netwide Assembler), ; can *not* be assembled with Microsoft's MASM or any compatible ; assembler (including Borland's Turbo Assembler). ; NASM is available from http://nasm.sourceforge.net/ or ; http://sourceforge.net/project/showfiles.php?group_id=6208 ; ; [TAB8] %include "jsimdext.inc" %include "jdct.inc" ; -------------------------------------------------------------------------- SECTION SEG_TEXT BITS 32 ; ; Load data into workspace, applying unsigned->signed conversion ; ; GLOBAL(void) ; jsimd_convsamp_sse2 (JSAMPARRAY sample_data, JDIMENSION start_col, ; DCTELEM * workspace); ; %define sample_data ebp+8 ; JSAMPARRAY sample_data %define start_col ebp+12 ; JDIMENSION start_col %define workspace ebp+16 ; DCTELEM * workspace align 16 global EXTN(jsimd_convsamp_sse2) PRIVATE EXTN(jsimd_convsamp_sse2): push ebp mov ebp,esp push ebx ; push ecx ; need not be preserved ; push edx ; need not be preserved push esi push edi pxor xmm6,xmm6 ; xmm6=(all 0's) pcmpeqw xmm7,xmm7 psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) mov eax, JDIMENSION [start_col] mov edi, POINTER [workspace] ; (DCTELEM *) mov ecx, DCTSIZE/4 alignx 16,7 .convloop: mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) movq xmm0, XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; xmm0=(01234567) movq xmm1, XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE] ; xmm1=(89ABCDEF) mov ebx, JSAMPROW [esi+2*SIZEOF_JSAMPROW] ; (JSAMPLE *) mov edx, JSAMPROW [esi+3*SIZEOF_JSAMPROW] ; (JSAMPLE *) movq xmm2, XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; xmm2=(GHIJKLMN) movq xmm3, XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE] ; xmm3=(OPQRSTUV) punpcklbw xmm0,xmm6 ; xmm0=(01234567) punpcklbw xmm1,xmm6 ; xmm1=(89ABCDEF) paddw xmm0,xmm7 paddw xmm1,xmm7 punpcklbw xmm2,xmm6 ; xmm2=(GHIJKLMN) punpcklbw xmm3,xmm6 ; xmm3=(OPQRSTUV) paddw xmm2,xmm7 paddw xmm3,xmm7 movdqa XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_DCTELEM)], xmm0 movdqa XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_DCTELEM)], xmm1 movdqa XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_DCTELEM)], xmm2 movdqa XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_DCTELEM)], xmm3 add esi, byte 4*SIZEOF_JSAMPROW add edi, byte 4*DCTSIZE*SIZEOF_DCTELEM dec ecx jnz short .convloop pop edi pop esi ; pop edx ; need not be preserved ; pop ecx ; need not be preserved pop ebx pop ebp ret ; -------------------------------------------------------------------------- ; ; Quantize/descale the coefficients, and store into coef_block ; ; This implementation is based on an algorithm described in ; "How to optimize for the Pentium family of microprocessors" ; (http://www.agner.org/assem/). ; ; GLOBAL(void) ; jsimd_quantize_sse2 (JCOEFPTR coef_block, DCTELEM * divisors, ; DCTELEM * workspace); ; %define RECIPROCAL(m,n,b) XMMBLOCK(DCTSIZE*0+(m),(n),(b),SIZEOF_DCTELEM) %define CORRECTION(m,n,b) XMMBLOCK(DCTSIZE*1+(m),(n),(b),SIZEOF_DCTELEM) %define SCALE(m,n,b) XMMBLOCK(DCTSIZE*2+(m),(n),(b),SIZEOF_DCTELEM) %define coef_block ebp+8 ; JCOEFPTR coef_block %define divisors ebp+12 ; DCTELEM * divisors %define workspace ebp+16 ; DCTELEM * workspace align 16 global EXTN(jsimd_quantize_sse2) PRIVATE EXTN(jsimd_quantize_sse2): push ebp mov ebp,esp ; push ebx ; unused ; push ecx ; unused ; push edx ; need not be preserved push esi push edi mov esi, POINTER [workspace] mov edx, POINTER [divisors] mov edi, JCOEFPTR [coef_block] mov eax, DCTSIZE2/32 alignx 16,7 .quantloop: movdqa xmm4, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_DCTELEM)] movdqa xmm5, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_DCTELEM)] movdqa xmm6, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_DCTELEM)] movdqa xmm7, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_DCTELEM)] movdqa xmm0,xmm4 movdqa xmm1,xmm5 movdqa xmm2,xmm6 movdqa xmm3,xmm7 psraw xmm4,(WORD_BIT-1) psraw xmm5,(WORD_BIT-1) psraw xmm6,(WORD_BIT-1) psraw xmm7,(WORD_BIT-1) pxor xmm0,xmm4 pxor xmm1,xmm5 pxor xmm2,xmm6 pxor xmm3,xmm7 psubw xmm0,xmm4 ; if (xmm0 < 0) xmm0 = -xmm0; psubw xmm1,xmm5 ; if (xmm1 < 0) xmm1 = -xmm1; psubw xmm2,xmm6 ; if (xmm2 < 0) xmm2 = -xmm2; psubw xmm3,xmm7 ; if (xmm3 < 0) xmm3 = -xmm3; paddw xmm0, XMMWORD [CORRECTION(0,0,edx)] ; correction + roundfactor paddw xmm1, XMMWORD [CORRECTION(1,0,edx)] paddw xmm2, XMMWORD [CORRECTION(2,0,edx)] paddw xmm3, XMMWORD [CORRECTION(3,0,edx)] pmulhuw xmm0, XMMWORD [RECIPROCAL(0,0,edx)] ; reciprocal pmulhuw xmm1, XMMWORD [RECIPROCAL(1,0,edx)] pmulhuw xmm2, XMMWORD [RECIPROCAL(2,0,edx)] pmulhuw xmm3, XMMWORD [RECIPROCAL(3,0,edx)] pmulhuw xmm0, XMMWORD [SCALE(0,0,edx)] ; scale pmulhuw xmm1, XMMWORD [SCALE(1,0,edx)] pmulhuw xmm2, XMMWORD [SCALE(2,0,edx)] pmulhuw xmm3, XMMWORD [SCALE(3,0,edx)] pxor xmm0,xmm4 pxor xmm1,xmm5 pxor xmm2,xmm6 pxor xmm3,xmm7 psubw xmm0,xmm4 psubw xmm1,xmm5 psubw xmm2,xmm6 psubw xmm3,xmm7 movdqa XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_DCTELEM)], xmm0 movdqa XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_DCTELEM)], xmm1 movdqa XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_DCTELEM)], xmm2 movdqa XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_DCTELEM)], xmm3 add esi, byte 32*SIZEOF_DCTELEM add edx, byte 32*SIZEOF_DCTELEM add edi, byte 32*SIZEOF_JCOEF dec eax jnz near .quantloop pop edi pop esi ; pop edx ; need not be preserved ; pop ecx ; unused ; pop ebx ; unused pop ebp ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. align 16
Assembly/keyboard/textbox_monster_search.asm
WildGenie/Ninokuni
14
28172
<reponame>WildGenie/Ninokuni<filename>Assembly/keyboard/textbox_monster_search.asm ;;----------------------------------------------------------------------------;; ;; Fix the position of the textboxes ;; Copyright 2015 <NAME> (aka pleonex) ;; ;; 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. ;;----------------------------------------------------------------------------;; .arm ; # Textbox Box X Position .org 0x020917FC MOV R1, #0x31 + 52 MOV R2, #0x1B @fixed_oam_initXYZ equ 0x02043BD0 @nanr__loadBank equ 0x020DA000 ; # L/R Cursor .org 0x020916AC ADD R8, R10, R9,LSL#2 ADD r8, R8, #0x3A000 ; Edited STR R0, [r8,#0xBB4] ; Edited LDR R2, [R0] ADD R1, R4, #0x3A800 LDR R2, [R2,#0x5C] BLX R2 ;ADD R0, R8, #0x3A000 ; Removed LDR R0, [r8,#0xBB4] ; Edited ;MOV R1, #0x80 ; Removed CMP R9, #0 MOVEQ R1, #0x80 + 53 MOVNE R1, #0x80 - 53 MOV R2, #0x60 MOV R3, R7 BL @fixed_oam_initXYZ ;ADD R0, R8, #0x3A000 ; Removed LDR R0, [r8,#0xBB4] ; Edited MOV R1, R6 LDR R2, [R0] LDR R2, [R2,#0x3C] BLX R2 MOV R0, R8 ; Edited LDR R0, [R0,#0xBB4] MOV R1, R6 BL 0x20D9FF0 MOV R0, R8 ; Edited ADD R1, R9, R9,LSL#1 MOV R1, R1,LSL#16 LDR R0, [R0,#0xBB4] MOV R1, R1,LSR#16 BL @nanr__loadBank MOV R0, R8 ; Edited LDR R0, [R0,#0xBB4] MOV R1, R7 BL 0x20DA190 ADD R9, R9, #1 CMP R9, #2 BLT 0x2091684
libsrc/_DEVELOPMENT/font/fzx/fonts/dkud3/Lovely/_ff_dkud3_Lovely.asm
jpoikela/z88dk
640
163377
<filename>libsrc/_DEVELOPMENT/font/fzx/fonts/dkud3/Lovely/_ff_dkud3_Lovely.asm SECTION rodata_font SECTION rodata_font_fzx PUBLIC _ff_dkud3_Lovely _ff_dkud3_Lovely: BINARY "font/fzx/fonts/dkud3/Lovely/LOVELY.fzx"
openal-context.adb
io7m/coreland-openal-ada
1
22471
<reponame>io7m/coreland-openal-ada<filename>openal-context.adb<gh_stars>1-10 with Ada.IO_Exceptions; with Interfaces.C.Strings; with Interfaces.C; with System; package body OpenAL.Context is package C renames Interfaces.C; package C_Strings renames Interfaces.C.Strings; -- -- Close_Device -- procedure Close_Device (Device : in out Device_t) is Return_Code : constant Boolean := Boolean (ALC_Thin.Close_Device (Device.Device_Data)); begin Device := Invalid_Device; pragma Assert (Return_Code'Size > 0); end Close_Device; -- -- Create_Context -- -- -- Mapping between attribute selection and constants. -- type Attribute_Map_t is array (Attribute_t) of Types.Integer_t; Attribute_Map : constant Attribute_Map_t := (Attribute_Frequency => ALC_Thin.ALC_FREQUENCY, Attribute_Refresh => ALC_Thin.ALC_REFRESH, Attribute_Synchronous => ALC_Thin.ALC_SYNC, Attribute_Mono_Sources => ALC_Thin.ALC_MONO_SOURCES, Attribute_Stereo_Sources => ALC_Thin.ALC_STEREO_SOURCES); -- -- The input to alcCreateContext is a list of 'integer pairs' terminated -- with zeroes: -- -- [ALC_FREQUENCY][44100][AL_SYNC][1][0][0] -- Input_Size : constant Natural := (Attribute_Array_t'Length + 1) * 2; type Input_Array_t is array (1 .. Input_Size) of aliased Types.Integer_t; function Create_Context (Device : in Device_t) return Context_t is begin return Context_t (ALC_Thin.Create_Context (Device => Device.Device_Data, Attribute_List => System.Null_Address)); end Create_Context; function Create_Context_With_Attributes (Device : in Device_t; Attributes : in Context_Attributes_t) return Context_t is Input : Input_Array_t := (others => 0); Position : Positive := Input_Array_t'First; begin for Attribute in Attribute_t'Range loop if Attributes.Specified (Attribute) then Input (Position) := Attribute_Map (Attribute); Input (Position + 1) := Attributes.Values (Attribute); Position := Position + 2; end if; end loop; return Context_t (ALC_Thin.Create_Context (Device => Device.Device_Data, Attribute_List => Input (Input'First)'Address)); end Create_Context_With_Attributes; -- -- Destroy_Context -- procedure Destroy_Context (Context : in Context_t) is begin ALC_Thin.Destroy_Context (ALC_Thin.Context_t (Context)); end Destroy_Context; -- -- Device_Data -- function Device_Data (Device : in Device_t) return ALC_Thin.Device_t is begin return Device.Device_Data; end Device_Data; -- -- Get_* -- function Get_String (Device : ALC_Thin.Device_t; Parameter : Types.Enumeration_t) return C_Strings.chars_ptr; pragma Import (C, Get_String, "alcGetString"); use type C_Strings.chars_ptr; use type ALC_Thin.Device_t; use type System.Address; Null_Device : constant ALC_Thin.Device_t := ALC_Thin.Device_t (System.Null_Address); function Get_Available_Capture_Devices return OpenAL.List.String_Vector_t is Address : System.Address; List : OpenAL.List.String_Vector_t; begin Address := ALC_Thin.Get_String (Device => ALC_Thin.Device_t (System.Null_Address), Token => ALC_Thin.ALC_CAPTURE_DEVICE_SPECIFIER); if Address /= System.Null_Address then OpenAL.List.Address_To_Vector (Address => Address, List => List); end if; return List; end Get_Available_Capture_Devices; function Get_Available_Playback_Devices return OpenAL.List.String_Vector_t is Address : System.Address; List : OpenAL.List.String_Vector_t; begin Address := ALC_Thin.Get_String (Device => ALC_Thin.Device_t (System.Null_Address), Token => ALC_Thin.ALC_DEVICE_SPECIFIER); if Address /= System.Null_Address then OpenAL.List.Address_To_Vector (Address => Address, List => List); end if; return List; end Get_Available_Playback_Devices; function Get_Capture_Samples (Device : in Device_t) return Natural is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => <PASSWORD>C_CAPTURE_SAMPLES, Size => 1, Data => Value'Address); return Natural (Value); end Get_Capture_Samples; function Get_Context_Device (Context : in Context_t) return Device_t is Device : Device_t; begin Device.Device_Data := ALC_Thin.Get_Contexts_Device (ALC_Thin.Context_t (Context)); return Device; end Get_Context_Device; function Get_Current_Context return Context_t is begin return Context_t (ALC_Thin.Get_Current_Context); end Get_Current_Context; function Get_Default_Capture_Device_Specifier return String is CS : constant C_Strings.chars_ptr := Get_String (Device => Null_Device, Parameter => ALC_Thin.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER); begin if CS /= C_Strings.Null_Ptr then return C_Strings.Value (CS); else raise Ada.IO_Exceptions.Device_Error with "no capture device available"; end if; end Get_Default_Capture_Device_Specifier; function Get_Default_Device_Specifier return String is CS : constant C_Strings.chars_ptr := Get_String (Device => Null_Device, Parameter => ALC_Thin.ALC_DEFAULT_DEVICE_SPECIFIER); begin if CS /= C_Strings.Null_Ptr then return C_Strings.Value (CS); else raise Ada.IO_Exceptions.Device_Error with "no device available"; end if; end Get_Default_Device_Specifier; function Get_Device_Specifier (Device : in Device_t) return String is begin if Device.Device_Data = Null_Device then raise Ada.IO_Exceptions.Device_Error with "invalid device"; end if; return C_Strings.Value (Get_String (Device => Device.Device_Data, Parameter => ALC_Thin.ALC_DEVICE_SPECIFIER)); end Get_Device_Specifier; function Get_Extensions (Device : in Device_t) return String is begin if Device.Device_Data = Null_Device then raise Ada.IO_Exceptions.Device_Error with "invalid device"; end if; return C_Strings.Value (Get_String (Device => Device.Device_Data, Parameter => ALC_Thin.ALC_EXTENSIONS)); end Get_Extensions; function Get_Frequency (Device : in Device_t) return Types.Frequency_t is Value : aliased Types.Integer_t := Types.Integer_t (Types.Frequency_t'First); begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_FREQUENCY, Size => 1, Data => Value'Address); return Types.Frequency_t (Value); end Get_Frequency; function Get_Major_Version (Device : in Device_t) return Natural is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_MAJOR_VERSION, Size => 1, Data => Value'Address); return Natural (Value); end Get_Major_Version; function Get_Minor_Version (Device : in Device_t) return Natural is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_MINOR_VERSION, Size => 1, Data => Value'Address); return Natural (Value); end Get_Minor_Version; function Get_Mono_Sources (Device : in Device_t) return Natural is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_MONO_SOURCES, Size => 1, Data => Value'Address); return Natural (Value); end Get_Mono_Sources; function Get_Refresh (Device : in Device_t) return Natural is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_REFRESH, Size => 1, Data => Value'Address); return Natural (Value); end Get_Refresh; function Get_Stereo_Sources (Device : in Device_t) return Natural is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_STEREO_SOURCES, Size => 1, Data => Value'Address); return Natural (Value); end Get_Stereo_Sources; function Get_Synchronous (Device : in Device_t) return Boolean is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_SYNC, Size => 1, Data => Value'Address); return Boolean'Val (Value); end Get_Synchronous; -- -- Is_Extension_Present -- function Is_Extension_Present (Device : in Device_t; Name : in String) return Boolean is C_Name : aliased C.char_array := C.To_C (Name); begin return Boolean (ALC_Thin.Is_Extension_Present (Device => Device.Device_Data, Extension_Name => C_Name (C_Name'First)'Address)); end Is_Extension_Present; -- -- Make_Context_Current -- function Make_Context_Current (Context : in Context_t) return Boolean is begin return Boolean (ALC_Thin.Make_Context_Current (ALC_Thin.Context_t (Context))); end Make_Context_Current; -- -- Open_Device -- function Open_Default_Device return Device_t is Device : Device_t; begin Device.Device_Data := ALC_Thin.Open_Device (Specifier => System.Null_Address); return Device; end Open_Default_Device; function Open_Device (Specifier : in String) return Device_t is C_Spec : aliased C.char_array := C.To_C (Specifier); Device : Device_t; begin Device.Device_Data := ALC_Thin.Open_Device (Specifier => C_Spec (C_Spec'First)'Address); return Device; end Open_Device; -- -- Process_Context -- procedure Process_Context (Context : in Context_t) is begin ALC_Thin.Process_Context (ALC_Thin.Context_t (Context)); end Process_Context; -- -- Set_* -- procedure Set_Frequency (Attributes : in out Context_Attributes_t; Frequency : in Types.Frequency_t) is begin Attributes.Values (Attribute_Frequency) := Types.Integer_t (Frequency); Attributes.Specified (Attribute_Frequency) := True; end Set_Frequency; procedure Set_Mono_Sources (Attributes : in out Context_Attributes_t; Sources : in Natural) is begin Attributes.Values (Attribute_Mono_Sources) := Types.Integer_t (Sources); Attributes.Specified (Attribute_Mono_Sources) := True; end Set_Mono_Sources; procedure Set_Refresh (Attributes : in out Context_Attributes_t; Refresh : in Positive) is begin Attributes.Values (Attribute_Refresh) := Types.Integer_t (Refresh); Attributes.Specified (Attribute_Refresh) := True; end Set_Refresh; procedure Set_Stereo_Sources (Attributes : in out Context_Attributes_t; Sources : in Natural) is begin Attributes.Values (Attribute_Stereo_Sources) := Types.Integer_t (Sources); Attributes.Specified (Attribute_Stereo_Sources) := True; end Set_Stereo_Sources; procedure Set_Synchronous (Attributes : in out Context_Attributes_t; Synchronous : in Boolean) is begin Attributes.Values (Attribute_Synchronous) := Types.Integer_t (Boolean'Pos (Synchronous)); Attributes.Specified (Attribute_Synchronous) := True; end Set_Synchronous; -- -- Suspend_Context -- procedure Suspend_Context (Context : in Context_t) is begin ALC_Thin.Suspend_Context (ALC_Thin.Context_t (Context)); end Suspend_Context; end OpenAL.Context;
source/sets.adb
jquorning/CELLE
0
7454
<filename>source/sets.adb -- -- -- with Ada.Unchecked_Deallocation; package body Sets is Index_First : Index_Type := Index_Type'First; Index_Last : Index_Type := Index_Type'First; procedure Set_Range (First : in Index_Type; Last : in Index_Type) is begin Index_First := First; Index_Last := Last; end Set_Range; function Set_New return Set_Type is begin return new Set_Array'(Index_First .. Index_Last => False); end Set_New; procedure Set_Free (Set : in out Set_Type) is procedure Free is new Ada.Unchecked_Deallocation (Object => Set_Array, Name => Set_Type); begin Free (Set); end Set_Free; function Set_Add (Set : in out Set_Type; Item : in Index_Type) return Boolean is RV : Boolean; begin pragma Assert (Item >= Index_First); pragma Assert (Item <= Index_Last); RV := Set (Item); Set (Item) := True; return not RV; end Set_Add; function Set_Union (Set_1 : in out Set_Type; Set_2 : in out Set_Type) return Boolean is Progress : Boolean; begin Progress := False; for I in Index_First .. Index_Last loop if Set_2 (I) then if not Set_1 (I) then Progress := True; Set_1 (I) := True; end if; end if; end loop; return Progress; end Set_Union; function Set_Find (Set : in Set_Type; Item : in Index_Type) return Boolean is begin return Set (Item); end Set_Find; function First_Index return Index_Type is (Index_First); function Last_Index return Index_Type is (Index_Last); end Sets;
src/SlimShader.Tests/Shaders/HlslCrossCompiler/ps5/interfaces.asm
tgjones/slimshader
125
6716
// // Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20714 // // /// // Buffer Definitions: // // interfaces $ThisPointer // { // // interface iChangeColour gAbstractColourChanger;// Offset: 0 Size: 1 // interface iChangeColour gAbstractColourChangerB;// Offset: 1 Size: 1 // interface iAlpha gAlphaChooser; // Offset: 2 Size: 1 // // } // // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // COLOR 0 xyz 0 NONE float xyz // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_TARGET 0 xyzw 0 TARGET float xyzw // // // Available Class Types: // // Name ID CB Stride Texture Sampler // ------------------------------ ---- --------- ------- ------- // cUnchangedColour 0 0 0 0 // cHalfColour 1 0 0 0 // cDoubleColour 2 0 0 0 // TwoThirdsAlpha 3 0 0 0 // OneAlpha 4 0 0 0 // // Interface slots, 3 total: // // Slots // +----------+---------+--------------------------------------- // | Type ID | 0 |0 1 2 // | Table ID | |0 1 2 // +----------+---------+--------------------------------------- // | Type ID | 1 |0 1 2 // | Table ID | |3 4 5 // +----------+---------+--------------------------------------- // | Type ID | 2 |3 4 // | Table ID | |6 7 // +----------+---------+--------------------------------------- ps_5_0 dcl_globalFlags refactoringAllowed dcl_function_body fb0 dcl_function_body fb1 dcl_function_body fb2 dcl_function_body fb3 dcl_function_body fb4 dcl_function_body fb5 dcl_function_body fb6 dcl_function_body fb7 dcl_function_table ft0 = {fb0} dcl_function_table ft1 = {fb1} dcl_function_table ft2 = {fb2} dcl_function_table ft3 = {fb3} dcl_function_table ft4 = {fb4} dcl_function_table ft5 = {fb5} dcl_function_table ft6 = {fb6} dcl_function_table ft7 = {fb7} dcl_interface fp0[1][1] = {ft0, ft1, ft2} dcl_interface fp1[1][1] = {ft3, ft4, ft5} dcl_interface fp2[1][1] = {ft6, ft7} dcl_input_ps linear v0.xyz dcl_output o0.xyzw dcl_temps 1 fcall fp0[0][0] fcall fp1[0][0] mov o0.xyz, r0.xyzx fcall fp2[0][0] mov o0.w, r0.x ret label fb0 mov r0.xyz, v0.xyzx ret label fb1 mul r0.xyz, v0.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000) ret label fb2 add r0.xyz, v0.xyzx, v0.xyzx ret label fb3 ret label fb4 mul r0.xyz, r0.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000) ret label fb5 add r0.xyz, r0.xyzx, r0.xyzx ret label fb6 mov r0.x, l(0.660000) ret label fb7 mov r0.x, l(1.000000) ret // Approximately 21 instruction slots used
examples/bintest.asm
AbdulrahmanAbumdas/emu8086
287
93134
; this is an example of how to make a ".bin" file. name "bintest" ; directive to create bin file: #make_bin# ; where to load? #load_segment=1234# #load_offset=0000# ; set these values to registers on load: #al=12# #ah=34# #bh=56# #bl=78# #ch=9a# #cl=bc# #dh=de# #dl=f0# #ds=ddee# #es=abcd# #si=aaaa# #di=cccc# #bp=dddd# #cs=1234# #ip=0000# #ss=3000# #sp=ffff# ; when loading "bintest.bin" file in emulator ; it will look for a "bintest.binf" file, ; and load ".bin" file to location specified ; in that file, registers are also set using ; information in that file (open this file ; in a text editor to edit or investigate). ; ; ".binf" file is created automatically ; by compiler when it processes the above ; directives. ; this sample just prints out a part of ; some ascii character set, in an eternal ; loop, press [stop] or esc to terminate. start: mov al, '0' mov ah, 0eh print_more: int 10h inc al ; keep original ax: mov cx, ax ;============================ ; check for esc key to ; reboot: ; check for keystroke in ; keyboard buffer: mov ah, 1 int 16h jz key_processed ; get keystroke from keyboard: ; (remove from the buffer) mov ah, 0 int 16h ; press 'esc' to exit: cmp al, 27 jnz key_processed hlt key_processed: ;============================ ; restore original ax: mov ax, cx cmp al, 'z' jbe print_more mov al, '0' jmp print_more
legend-engine-language-pure-grammar/src/main/antlr4/org/finos/legend/engine/language/pure/grammar/from/antlr4/core/M3LexerGrammar.g4
dave-wathen/legend-engine
32
7660
lexer grammar M3LexerGrammar; import CoreLexerGrammar; // -------------------------------------- KEYWORD -------------------------------------- ALL: 'all'; LET: 'let'; ALL_VERSIONS: 'allVersions'; ALL_VERSIONS_IN_RANGE: 'allVersionsInRange'; // ----------------------------------- BUILDING BLOCK ----------------------------------- NAVIGATION_PATH_BLOCK: '#/' (~[#])* '#';
programs/oeis/101/A101402.asm
neoneye/loda
22
91380
; A101402: a(0)=0, a(1)=1; for n>=2, let k = smallest power of 2 that is >= n, then a(n) = a(k/2) + a(n-1-k/2). ; 0,1,1,1,2,2,3,3,3,3,4,4,4,5,5,6,6,6,7,7,7,8,8,9,9,9,9,10,10,10,11,11,12,12,13,13,13,14,14,15,15,15,15,16,16,16,17,17,18,18,18,19,19,19,20,20,21,21,21,21,22,22,22,23,23,23,24,24,24,25,25,26,26,26,26,27,27,27,28,28,29,29,29,30,30,30,31,31,32,32,32,32,33,33,33,34,34,35,35,36 mov $3,$0 mov $4,$0 lpb $3 mov $0,$4 sub $3,1 sub $0,$3 lpb $0 sub $0,2 mov $2,$0 max $2,0 seq $2,92323 ; 2^m - 1 appears 2^m times. sub $0,$2 lpe add $1,$0 lpe mov $0,$1
workload.ads
gonma95/RealTimeSystem_CarDistrations
0
12461
--|--------------------------------------------------------------------------- --| --| Unit Name: Workload --| --| Unit Type: Package Specification --| --| Description: --| Encapsulates the synthetic computational workload of a Hartstone task. --| The actual computation is performed by the Small_Whetstone procedure, --| a variant of the Whetstone benchmark program. The amount of work --| requested is expressed in thousands of Whetstone instructions, or --| Kilo-Whetstones. An internal consistency check is performed on the --| workload computation within Small_Whetstone; if it fails, an exception --| is raised. --| --|--------------------------------------------------------------------------- package Workload is Workload_Failure : exception; -- Raised if Small_Whetstone self-check fails --| --| Unit Name: Small_Whetstone --| --| Unit Type: Procedure Specification --| --| Description: --| Performs the computational workload of a Hartstone task. The --| computation is a scaled-down version of the one performed by the --| full Whetstone benchmark program. An exception is raised if the --| computation fails to satisfy an internal consistency check. This --| procedure does not return any "result" from its computation; its --| sole function is to give a Hartstone task something to do. --| --| Parameters: --| Kilo_Whets: The number of Kilo-Whetstone instructions to be performed --| by the procedure. A value of 1 means one thousand Whetstone --| instructions will be executed as the computational load. --| procedure Small_Whetstone(Kilo_Whets : in Positive); pragma Inline(Small_Whetstone); -- Some implementations may ignore this end Workload;
src/Search.agda
nad/partiality-monad
2
5287
------------------------------------------------------------------------ -- An example: A function that, given a stream, tries to find an -- element satisfying a predicate ------------------------------------------------------------------------ {-# OPTIONS --cubical --safe #-} module Search where open import Equality.Propositional.Cubical open import Prelude hiding (⊥) open import Monad equality-with-J open import Univalence-axiom equality-with-J open import Partiality-algebra.Monotone open import Partiality-monad.Inductive open import Partiality-monad.Inductive.Fixpoints open import Partiality-monad.Inductive.Monad -- Streams. infixr 5 _∷_ record Stream {a} (A : Type a) : Type a where coinductive constructor _∷_ field head : A tail : Stream A open Stream -- A direct implementation of the function. module Direct {a} {A : Type a} (q : A → Bool) where Φ : Trans (Stream A) (λ _ → A) Φ f xs = if q (head xs) then return (head xs) else f (tail xs) Φ-monotone : ∀ {f₁ f₂} → (∀ xs → f₁ xs ⊑ f₂ xs) → ∀ xs → Φ f₁ xs ⊑ Φ f₂ xs Φ-monotone f₁⊑f₂ xs with q (head xs) ... | true = return (head xs) ■ ... | false = f₁⊑f₂ (tail xs) Φ-⊑ : Trans-⊑ (Stream A) (λ _ → A) Φ-⊑ = record { function = Φ; monotone = Φ-monotone } search : Stream A → A ⊥ search = fix→ Φ-⊑ search-least : ∀ f → (∀ xs → Φ f xs ⊑ f xs) → ∀ xs → search xs ⊑ f xs search-least = fix→-is-least Φ-⊑ Φ-ω-continuous : (s : ∃ λ (f : ℕ → Stream A → A ⊥) → ∀ n xs → f n xs ⊑ f (suc n) xs) → Φ (⨆ ∘ at s) ≡ ⨆ ∘ at [ Φ-⊑ $ s ]-inc Φ-ω-continuous s = ⟨ext⟩ helper where helper : ∀ xs → Φ (⨆ ∘ at s) xs ≡ ⨆ (at [ Φ-⊑ $ s ]-inc xs) helper xs with q (head xs) ... | true = return (head xs) ≡⟨ sym ⨆-const ⟩∎ ⨆ (constˢ (return (head xs))) ∎ ... | false = ⨆ (at s (tail xs)) ∎ Φ-ω : Trans-ω (Stream A) (λ _ → A) Φ-ω = record { monotone-function = Φ-⊑ ; ω-continuous = Φ-ω-continuous } search-fixpoint : search ≡ Φ search search-fixpoint = fix→-is-fixpoint-combinator Φ-ω -- An arguably more convenient implementation. module Indirect {a} {A : Type a} (q : A → Bool) where ΦP : Stream A → Partial (Stream A) (λ _ → A) A ΦP xs = if q (head xs) then return (head xs) else rec (tail xs) Φ : Trans (Stream A) (λ _ → A) Φ = Trans-⊑.function (transformer ΦP) search : Stream A → A ⊥ search = fixP ΦP search-least : ∀ f → (∀ xs → Φ f xs ⊑ f xs) → ∀ xs → search xs ⊑ f xs search-least = fixP-is-least ΦP search-fixpoint : search ≡ Φ search search-fixpoint = fixP-is-fixpoint-combinator ΦP
Transynther/x86/_processed/NONE/_st_/i7-7700_9_0x48.log_21829_1153.asm
ljhsiun2/medusa
9
93963
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r14 push %r15 push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x1d680, %r14 nop nop add %r15, %r15 mov (%r14), %ebx add $20720, %r11 lea addresses_normal_ht+0x11700, %rsi lea addresses_A_ht+0x13112, %rdi nop nop and %r12, %r12 mov $120, %rcx rep movsw mfence lea addresses_UC_ht+0x1380, %r11 nop add %rdi, %rdi mov $0x6162636465666768, %r14 movq %r14, (%r11) nop and $50422, %rdi lea addresses_UC_ht+0x15a80, %rsi nop nop nop nop nop and %r14, %r14 mov $0x6162636465666768, %rbx movq %rbx, %xmm3 movups %xmm3, (%rsi) nop nop nop nop nop xor $10213, %r11 lea addresses_WT_ht+0x3366, %rsi nop nop nop add %r11, %r11 movw $0x6162, (%rsi) cmp $7152, %rcx lea addresses_A_ht+0x138a8, %rdi nop nop nop nop add %rcx, %rcx mov (%rdi), %r12 nop inc %rdi lea addresses_normal_ht+0x1cb80, %r12 nop nop cmp %rdi, %rdi mov (%r12), %r15w nop nop sub $17379, %r11 lea addresses_A_ht+0x19550, %r12 nop add $40366, %rdi movl $0x61626364, (%r12) nop nop inc %r14 lea addresses_A_ht+0x4f88, %rdi nop nop nop nop cmp %rbx, %rbx and $0xffffffffffffffc0, %rdi vmovaps (%rdi), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %r14 nop nop xor $38339, %r15 pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r15 push %rbx push %rcx push %rdx push %rsi // Store mov $0xf80, %rcx nop nop nop and $48993, %r14 mov $0x5152535455565758, %rbx movq %rbx, (%rcx) nop nop nop nop nop dec %rsi // Store lea addresses_RW+0x19a00, %r10 clflush (%r10) nop nop nop inc %rdx movb $0x51, (%r10) nop and %r10, %r10 // Store lea addresses_WC+0x1d000, %r15 sub %rbx, %rbx movl $0x51525354, (%r15) nop nop xor $5757, %rcx // Store lea addresses_WC+0xf380, %rbx nop nop nop nop dec %rsi movb $0x51, (%rbx) nop nop nop dec %r10 // Load lea addresses_WC+0x1cf38, %rsi dec %r14 movb (%rsi), %cl nop xor $15119, %r15 // Store lea addresses_PSE+0xf280, %rdx nop nop nop sub $45129, %r14 mov $0x5152535455565758, %rbx movq %rbx, %xmm3 vmovups %ymm3, (%rdx) nop nop nop nop add $7518, %r10 // Faulty Load lea addresses_WC+0x6f80, %rdx nop nop nop nop cmp $431, %r10 movb (%rdx), %cl lea oracles, %rsi and $0xff, %rcx shlq $12, %rcx mov (%rsi,%rcx,1), %rcx pop %rsi pop %rdx pop %rcx pop %rbx pop %r15 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': True, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': True, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 3, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 6, 'size': 32, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 7, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 10, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 7, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 2, 'size': 8, 'same': False, 'NT': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 10, 'size': 2, 'same': True, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': True, 'congruent': 3, 'size': 32, 'same': False, 'NT': False}} {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
test/Fail/Issue2047a.agda
shlevy/agda
1,989
7962
<filename>test/Fail/Issue2047a.agda open import Common.Equality data Bool : Set where true false : Bool data IsTrue : Bool → Set where itis : IsTrue true module M (u : Bool) where foo bar : (p : IsTrue u) → Bool foo = \ { itis → true } bar = \ { itis → false } test : ∀ u → M.foo u ≡ M.bar u test u = refl -- Trigger printing of the extended lambdas. -- Ideally, this would not show the internal names, like in -- -- .Issue2047a.M..extendedlambda0 u p != -- .Issue2047a.M..extendedlambda1 u p of type Bool -- when checking that the expression refl has type M.foo u ≡ M.bar u -- -- but rather show -- -- (\ { itis → true }) .p != (\ { itis → false }) .p
automaton-script/src/main/antlr4/ascript/ASExpression.g4
francoiscolombo/fc-automation
0
2406
grammar ASExpression; import ASTokens; prog: stat+; stat : expression NEWLINE | NEWLINE ; expression : string # StringExpr | number # NumberExpr | func # FuncExpr | id # IdExpr | (LPAREN expression RPAREN) # ParenExpr | expression op=(MUL|DIV|MOD) expression # MulDivExpr | expression op=(ADD|SUB) expression # AddSubExpr | expression op=(GTE|GT|LTE|LT|EQ|NEQ) expression # RelExpr | NOT expression # NotExpr | expression AND expression # AndExpr | expression OR expression # OrExpr | <assoc=right> expression EXP expression # ExpExpr ; func : lenfunc | valfunc | isnanfunc ; string : STRINGLITERAL ; number : NUMBER ; id : ID ; lenfunc : LEN LPAREN expression RPAREN ; valfunc : VAL LPAREN expression RPAREN ; isnanfunc : ISNAN LPAREN expression RPAREN ; exprlist : expression (COMMA expression)* ;
oeis/160/A160103.asm
neoneye/loda-programs
11
162343
<reponame>neoneye/loda-programs ; A160103: Numerator of Hermite(n, 4/27). ; Submitted by <NAME> ; 1,8,-1394,-34480,5821516,247659488,-40457575736,-2490185806912,392988531506320,32189435503872128,-4899280026394954016,-508516209857615258368,74506523384461350441664,9493051794744527363939840,-1336252229871124217359780736,-204462191073294286291618259968,27588138738695132343325458616576,4990399103267370169357474437466112,-643876413951158588906805021770723840,-136119045377758131435871999311026434048,16747712056252930178409336718604380343296,4103213059665450554097302193658365859586048 mov $1,1 lpb $0 sub $0,1 mul $2,9 sub $2,$1 add $1,$2 sub $2,$1 mul $1,18 add $1,$2 mul $2,9 sub $1,$2 mul $2,$0 lpe mov $0,$1
sw/552tests/inst_tests/jal_36.asm
JPShen-UWM/ThreadKraken
1
95781
<reponame>JPShen-UWM/ThreadKraken // Original test: ./ziliang/hw4/problem6/jal_1.asm // Author: ziliang // Test source code follows //does three jumps lbi r1, 1 lbi r2, 1 jal .label2 .label1: add r1, r1, r2 jal .label3 .label2: sub r1, r1, r2 jal .label1 .label3: halt
helloworld.asm
ankbhatia19/hello-world
0
13795
section .text global _start section .data msg db 'Hello, world!',0xa len equ $ - msg section .text _start: mov edx,len ;message length mov ecx,msg ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel mov ebx,0 ;process' exit code mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel - this interrupt won't return
oeis/242/A242091.asm
neoneye/loda-programs
11
16192
<reponame>neoneye/loda-programs ; A242091: a(n) = r * (n-1)! where r is the rational number that satisfies the equation Sum_{k>=n} (-1)^(k + n)/C(k,n) = n*2^(n-1)*log(2) - r. ; Submitted by <NAME>(s3) ; 0,2,15,128,1310,15864,222936,3572736,64354608,1287495360,28328889600,679936896000,17678878214400,495015296025600,14850552286080000,475219068007219200,16157470542709708800,581669316147767500800,22103440771676298854400,884137758914526068736000,37133788428957203472384000,1633886744397961132670976000,75158791417397882052182016000,3607622015011115805167321088000,180381101396856208730490470400000,9379817288768181299049729884160000,506510134012284461318622035312640000 mov $2,1 mov $3,$0 lpb $3 mul $1,$3 mov $4,$3 mul $4,2 add $4,2 mul $2,$4 add $1,$2 sub $3,1 lpe div $1,2 mov $0,$1
test/asset/agda-stdlib-1.0/Relation/Binary/Indexed/Heterogeneous/Construct/Trivial.agda
omega12345/agda-mode
0
1160
------------------------------------------------------------------------ -- The Agda standard library -- -- Creates trivially indexed records from their non-indexed counterpart. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Relation.Binary.Indexed.Heterogeneous.Construct.Trivial {i} {I : Set i} where open import Relation.Binary open import Relation.Binary.Indexed.Heterogeneous hiding (Rel) hiding (IsEquivalence; Setoid) ------------------------------------------------------------------------ -- Structures module _ {a} {A : Set a} where private Aᵢ : I → Set a Aᵢ i = A isIndexedEquivalence : ∀ {ℓ} {_≈_ : Rel A ℓ} → IsEquivalence _≈_ → IsIndexedEquivalence Aᵢ _≈_ isIndexedEquivalence isEq = record { refl = refl ; sym = sym ; trans = trans } where open IsEquivalence isEq isIndexedPreorder : ∀ {ℓ₁ ℓ₂} {_≈_ : Rel A ℓ₁} {_∼_ : Rel A ℓ₂} → IsPreorder _≈_ _∼_ → IsIndexedPreorder Aᵢ _≈_ _∼_ isIndexedPreorder isPreorder = record { isEquivalence = isIndexedEquivalence isEquivalence ; reflexive = reflexive ; trans = trans } where open IsPreorder isPreorder ------------------------------------------------------------------------ -- Packages indexedSetoid : ∀ {a ℓ} → Setoid a ℓ → IndexedSetoid I a ℓ indexedSetoid S = record { isEquivalence = isIndexedEquivalence isEquivalence } where open Setoid S indexedPreorder : ∀ {a ℓ₁ ℓ₂} → Preorder a ℓ₁ ℓ₂ → IndexedPreorder I a ℓ₁ ℓ₂ indexedPreorder O = record { isPreorder = isIndexedPreorder isPreorder } where open Preorder O
source/adam-environment.adb
charlie5/aIDE
3
18154
<reponame>charlie5/aIDE with AdaM.Entity, AdaM.Assist, AdaM.a_Pragma, AdaM.Environment, AdaM.Declaration.of_package, AdaM.a_Type.enumeration_type, AdaM.a_Type.signed_integer_type, AdaM.a_Type.a_subtype, AdaM.a_Type.floating_point_type, AdaM.a_Type.array_type, AdaM.a_Type.ordinary_fixed_point_type, Ada.Text_IO, Ada.Tags, Ada.Strings.fixed; use Ada.Text_IO; package body AdaM.Environment is procedure add (Self : in out Item; Unit : in compilation_Unit.view) is begin Self.Units.append (Unit); end add; procedure clear (Self : in out Item) is begin Self.Units.Clear; end clear; function Length (Self : in Item) return Natural is begin return Natural (Self.Units.Length); end Length; function Unit (Self : in Item; Index : Positive) return compilation_Unit.View is begin return Self.Units.Element (Index); end Unit; procedure standard_package_is (Self : in out Item; Now : in AdaM.a_Package.view) is begin Self.standard_Package := Now; end standard_package_is; function standard_Package (Self : in Item) return AdaM.a_Package.view is begin return Self.standard_Package; end standard_Package; function all_Types (Self : in Item) return AdaM.a_Type.Vector is the_Types : AdaM.a_Type.Vector; the_Unit : AdaM.compilation_Unit.view; pragma Unreferenced (the_Unit); -- the_Entity : AdaM.Source.Entity_View; use type AdaM.a_Type.view; begin for i in 1 .. Self.Length loop the_Unit := Self.Units.Element (i); -- for j in 1 .. the_Unit.Length -- loop -- the_Entity := the_Unit.Entity (j); -- -- if the_Entity.all in AdaM.a_Type.item'Class -- then -- the_Types.append (AdaM.a_Type.view (the_Entity)); -- end if; -- end loop; end loop; return the_Types; end all_Types; -- -- TODO: Move these to AdaM.Assist. -- -- function parent_Name (Identifier : in String) return String -- is -- use Ada.Strings, -- Ada.Strings.fixed; -- I : constant Natural := Index (Identifier, ".", going => Backward); -- begin -- if I = 0 -- then -- return "Standard"; -- end if; -- -- return Identifier (Identifier'First .. I - 1); -- end parent_Name; -- -- -- -- function simple_Name (Identifier : in String) return String -- is -- use Ada.Strings, -- Ada.Strings.fixed; -- I : constant Natural := Index (Identifier, ".", going => Backward); -- begin -- if I = 0 -- then -- return Identifier; -- end if; -- -- return Identifier (I + 1 .. Identifier'Last); -- end simple_Name; -- -- -- -- function Split (Identifier : in String) return text_Lines -- is -- use Ada.Strings, -- Ada.Strings.fixed; -- -- First : Natural := Identifier'First; -- Last : Natural; -- -- I : Natural; -- Lines : text_Lines; -- begin -- loop -- I := Index (Identifier, ".", from => First); -- -- if I = 0 -- then -- Last := Identifier'Last; -- Lines.append (+Identifier (First .. Last)); -- exit; -- end if; -- -- Last := I - 1; -- Lines.append (+Identifier (First .. Last)); -- First := I + 1; -- end loop; -- -- return Lines; -- end Split; function find (Self : in Item; Identifier : in AdaM.Identifier) return AdaM.a_Package.view is use AdaM.Assist; the_Package : AdaM.a_Package.view := Self.standard_Package; begin if Identifier /= "Standard" then declare use type AdaM.a_Package.view; Names : constant text_Lines := Split (Identifier); begin for Each of Names loop the_Package := the_Package.child_Package (+Each); exit when the_Package = null; end loop; end; end if; return the_Package; end find; function fetch (Self : in Item; Identifier : in AdaM.Identifier) return AdaM.a_Package.view is use AdaM.Assist; use type AdaM.a_Package.view; the_Package : AdaM.a_Package.view := Self.standard_Package; Parent : AdaM.a_Package.view; Names : constant text_Lines := Split (Identifier); begin if Identifier = "Standard" then return the_Package; end if; for Each of Names loop Parent := the_Package; the_Package := the_Package.child_Package (+Each); if the_Package = null then -- Create a new package. -- the_Package := AdaM.a_Package.new_Package (Parent.Name & "." & (+Each)); the_Package.Parent_is (Parent); Parent.add_Child (the_Package); end if; end loop; return the_Package; end fetch; function find (Self : in Item; Identifier : in AdaM.Identifier) return AdaM.a_Type.view is use AdaM.Assist; the_Package : constant AdaM.a_Package.view := Self.find (parent_Name (Identifier)); begin return the_Package.find (simple_Name (Identifier)); end find; function find (Self : in Item; Identifier : in AdaM.Identifier) return AdaM.Declaration.of_exception.view is use AdaM.Assist; the_Package : constant AdaM.a_Package.view := Self.find (parent_Name (Identifier)); begin return the_Package.find (simple_Name (Identifier)); end find; procedure print (Self : in Item) is use Ada.Strings.fixed; the_Unit : AdaM.compilation_Unit.view; -- the_Entity : AdaM.Source.Entity_View; -- Depth : Natural := 0; -- -- function Indent return String -- is -- begin -- return Depth * " "; -- end Indent; begin put_Line ("Environment:"); for i in 1 .. Self.Length loop the_Unit := Self.Unit (i); New_Line (2); ada.Text_IO.put_Line ("Unit.Name = " & the_Unit.Name); -- for i in 1 .. the_Unit.Length -- loop -- the_Entity := the_Unit.Entity (i); -- -- Depth := Depth + 1; -- -- ada.Text_IO.put_Line (Indent & "Entity : " & the_Entity.Name & " Tag = " & ada.Tags.Expanded_Name (the_Entity.all'Tag)); -- Depth := Depth - 1; -- end loop; end loop; new_Line; put_Line ("End Environment:"); end print; procedure print_Entities (Self : in Item) is use Ada.Strings.fixed; the_Unit : AdaM.compilation_Unit.view; top_Entity : AdaM.Entity.view; Depth : Natural := 0; function Indent return String is begin return Depth * " "; end Indent; procedure print (the_Entity : in Entity.view) is begin Depth := Depth + 1; put_Line (Indent & "Entity.Name : " & (+the_Entity.Name) & " Tag = " & Ada.Tags.Expanded_Name (the_Entity.all'Tag)); Depth := Depth - 1; for Each of the_Entity.Children.all loop print (Each); end loop; end print; begin put_Line ("Environment:"); for i in 1 .. Self.Length loop the_Unit := Self.Unit (i); top_Entity := the_Unit.Entity; New_Line (2); put_Line ("Unit.Name = " & the_Unit.Name); put_Line ("Top Entity.Name = " & (+top_Entity.Name)); print (top_Entity); end loop; new_Line; put_Line ("End Environment:"); end print_Entities; procedure add_package_Standard (Self : in out Item) is current_compilation_Unit : AdaM.compilation_Unit.view; standard_Package : constant AdaM.a_Package.view := AdaM.a_Package.new_Package ("Standard"); procedure add (the_Entity : in AdaM.Entity.view) is begin the_Entity.is_Public; standard_Package.Children.append (the_Entity); end add; begin current_compilation_Unit := AdaM.compilation_Unit.new_compilation_Unit (Name => "Standard"); Self.add (current_compilation_Unit); Self.standard_package_is (standard_Package); current_compilation_Unit.Entity_is (standard_Package.all'Access); add_pragma_Pure: declare new_Pragma : constant AdaM.a_Pragma.view := AdaM.a_Pragma.new_Pragma (Name => "Pure"); begin new_Pragma.add_Argument ("Standard"); add (new_Pragma.all'Access); end add_pragma_Pure; add_Boolean: declare new_enum_Type : constant AdaM.a_Type.enumeration_type.view := AdaM.a_Type.enumeration_type.new_Type (Name => "Boolean"); begin new_enum_Type.add_Literal ("False"); new_enum_Type.add_Literal ("True"); add (new_enum_Type.all'Access); end add_Boolean; add_Integer: declare new_integer_Type : constant AdaM.a_Type.signed_integer_type.view := AdaM.a_Type.signed_integer_type.new_Type (Name => "Integer"); begin new_integer_Type.First_is (Long_Long_Integer (Integer'First)); new_integer_Type.Last_is (Long_Long_Integer (Integer'Last)); add (new_integer_Type.all'Access); end add_Integer; add_Natural: declare new_Subtype : constant AdaM.a_Type.a_subtype.view := AdaM.a_Type.a_subtype.new_Subtype (Name => "Natural"); begin new_Subtype.Indication.main_Type_is (Self.find ("Integer")); new_Subtype.Indication.First_is ("0"); new_Subtype.Indication.Last_is ("Integer'Last"); add (new_Subtype.all'Access); end add_Natural; add_Positive: declare new_Subtype : constant AdaM.a_Type.a_subtype.view := AdaM.a_Type.a_subtype.new_Subtype (Name => "Positive"); begin new_Subtype.Indication.main_Type_is (Self.find ("Integer")); new_Subtype.Indication.First_is ("1"); new_Subtype.Indication.Last_is ("Integer'Last"); add (new_Subtype.all'Access); end add_Positive; add_short_short_Integer: declare new_integer_Type : constant AdaM.a_Type.signed_integer_type.view := AdaM.a_Type.signed_integer_type.new_Type (Name => "Short_Short_Integer"); begin new_integer_Type.First_is (Long_Long_Integer (Short_Short_Integer'First)); new_integer_Type.Last_is (Long_Long_Integer (Short_Short_Integer'Last)); add (new_integer_Type.all'Access); end add_short_short_Integer; add_short_Integer: declare new_integer_Type : constant AdaM.a_Type.signed_integer_type.view := AdaM.a_Type.signed_integer_type.new_Type (Name => "Short_Integer"); begin new_integer_Type.First_is (Long_Long_Integer (short_Integer'First)); new_integer_Type.Last_is (Long_Long_Integer (short_Integer'Last)); add (new_integer_Type.all'Access); end add_short_Integer; add_long_Integer: declare new_integer_Type : constant AdaM.a_Type.signed_integer_type.view := AdaM.a_Type.signed_integer_type.new_Type (Name => "Long_Integer"); begin new_integer_Type.First_is (Long_Long_Integer (long_Integer'First)); new_integer_Type.Last_is (Long_Long_Integer (long_Integer'Last)); add (new_integer_Type.all'Access); end add_long_Integer; add_long_long_Integer: declare new_integer_Type : constant AdaM.a_Type.signed_integer_type.view := AdaM.a_Type.signed_integer_type.new_Type (Name => "Long_Long_Integer"); begin new_integer_Type.First_is (Long_Long_Integer'First); new_integer_Type.Last_is (Long_Long_Integer'Last); add (new_integer_Type.all'Access); end add_long_long_Integer; add_short_Float: declare new_float_Type : constant AdaM.a_Type.floating_point_type.view := AdaM.a_Type.floating_point_type.new_Type (Name => "Short_Float"); begin new_float_Type.Digits_are (6); new_float_Type.First_is (long_long_Float (Short_Float'First)); new_float_Type.Last_is (long_long_Float (Short_Float'Last)); add (new_float_Type.all'Access); end add_short_Float; add_Float: declare new_float_Type : constant AdaM.a_Type.floating_point_type.view := AdaM.a_Type.floating_point_type.new_Type (Name => "Float"); begin new_float_Type.Digits_are (6); new_float_Type.First_is (long_long_Float (Float'First)); new_float_Type.Last_is (long_long_Float (Float'Last)); add (new_float_Type.all'Access); end add_Float; add_long_Float: declare new_float_Type : constant AdaM.a_Type.floating_point_type.view := AdaM.a_Type.floating_point_type.new_Type (Name => "Long_Float"); begin new_float_Type.Digits_are (15); new_float_Type.First_is (long_long_Float (long_Float'First)); new_float_Type.Last_is (long_long_Float (long_Float'Last)); add (new_float_Type.all'Access); end add_long_Float; add_long_long_Float: declare new_float_Type : constant AdaM.a_Type.floating_point_type.view := AdaM.a_Type.floating_point_type.new_Type (Name => "Long_Long_Float"); begin new_float_Type.Digits_are (18); new_float_Type.First_is (long_long_Float'First); new_float_Type.Last_is (long_long_Float'Last); add (new_float_Type.all'Access); end add_long_long_Float; add_Character: declare new_enum_Type : constant AdaM.a_Type.enumeration_type.view := AdaM.a_Type.enumeration_type.new_Type (Name => "Character"); begin add (new_enum_Type.all'Access); end add_Character; add_wide_Character: declare new_enum_Type : constant AdaM.a_Type.enumeration_type.view := AdaM.a_Type.enumeration_type.new_Type (Name => "Wide_Character"); begin add (new_enum_Type.all'Access); end add_wide_Character; add_wide_wide_Character: declare new_enum_Type : constant AdaM.a_Type.enumeration_type.view := AdaM.a_Type.enumeration_type.new_Type (Name => "Wide_Wide_Character"); begin add (new_enum_Type.all'Access); end add_wide_wide_Character; add_String: declare new_array_Type : constant AdaM.a_Type.array_type.view := AdaM.a_Type.array_type.new_Type (Name => "String"); new_Pragma : constant AdaM.a_Pragma.view := AdaM.a_Pragma.new_Pragma (Name => "Pack"); begin new_array_Type.index_Indication .main_Type_is (Self.find ("Standard.Positive")); new_array_Type.component_Indication.main_Type_is (Self.find ("Standard.Character")); new_array_Type.component_Indication.is_Constrained; new_array_Type.is_Constrained (Now => False); new_Pragma.add_Argument ("String"); add (new_array_Type.all'Access); add (new_Pragma.all'Access); end add_String; add_wide_String: declare new_array_Type : constant AdaM.a_Type.array_type.view := AdaM.a_Type.array_type.new_Type (Name => "Wide_String"); new_Pragma : constant AdaM.a_Pragma.view := AdaM.a_Pragma.new_Pragma (Name => "Pack"); begin new_array_Type.index_Indication .main_Type_is (Self.find ("Standard.Positive")); new_array_Type.component_Indication.main_Type_is (Self.find ("Standard.Wide_Character")); new_array_Type.component_Indication.is_Constrained; new_array_Type.is_Constrained (Now => False); new_Pragma.add_Argument ("Wide_String"); add (new_array_Type.all'Access); add (new_Pragma .all'Access); end add_wide_String; add_wide_wide_String: declare new_array_Type : constant AdaM.a_Type.array_type.view := AdaM.a_Type.array_type.new_Type (Name => "Wide_Wide_String"); new_Pragma : constant AdaM.a_Pragma.view := AdaM.a_Pragma.new_Pragma (Name => "Pack"); begin new_array_Type.index_Indication .main_Type_is (Self.find ("Standard.Positive")); new_array_Type.component_Indication.main_Type_is (Self.find ("Standard.Wide_Wide_Character")); new_array_Type.component_Indication.is_Constrained; new_array_Type.is_Constrained (Now => False); add (new_array_Type.all'Access); add (new_Pragma .all'Access); new_Pragma.add_Argument ("Wide_Wide_String"); end add_wide_wide_String; add_Duration: declare use Ada.Strings, Ada.Strings.fixed; new_ordinary_fixed_Type : constant AdaM.a_Type.ordinary_fixed_point_type.view := AdaM.a_Type.ordinary_fixed_point_type.new_Type (Name => "Duration"); begin new_ordinary_fixed_Type.Delta_is (Trim (Duration'Image (Duration'Delta), Left)); new_ordinary_fixed_Type.First_is ("-((2 ** 63) * 0.000000001)"); new_ordinary_fixed_Type.Last_is ("+((2 ** 63 - 1) * 0.000000001)"); add (new_ordinary_fixed_Type.all'Access); end add_Duration; add_constraint_Error: declare new_Exception : constant AdaM.Declaration.of_exception.view := Adam.Declaration.of_exception.new_Declaration ("Constraint_Error"); begin add (new_Exception.all'Access); end add_constraint_Error; add_program_Error: declare new_Exception : constant AdaM.Declaration.of_exception.view := Adam.Declaration.of_exception.new_Declaration ("Program_Error"); begin add (new_Exception.all'Access); end add_program_Error; add_storage_Error: declare new_Exception : constant AdaM.Declaration.of_exception.view := Adam.Declaration.of_exception.new_Declaration ("Storage_Error"); begin add (new_Exception.all'Access); end add_storage_Error; add_tasking_Error: declare new_Exception : constant AdaM.Declaration.of_exception.view := Adam.Declaration.of_exception.new_Declaration ("Tasking_Error"); begin add (new_Exception.all'Access); end add_tasking_Error; add_numeric_Error: -- TODO: Make this a proper exception renaming as per 'standard.ads'. declare new_Exception : constant AdaM.Declaration.of_exception.view := Adam.Declaration.of_exception.new_Declaration ("Numeric_Error"); begin add (new_Exception.all'Access); end add_numeric_Error; end add_package_Standard; end AdaM.Environment;
.emacs.d/elpa/ada-mode-5.3.1/gps_source/generic_stack.ads
caqg/linux-home
0
19760
------------------------------------------------------------------------------ -- G P S -- -- -- -- Copyright (C) 2001-2016, AdaCore -- -- -- -- This is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. This software is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -- -- License for more details. You should have received a copy of the GNU -- -- General Public License distributed with this software; see file -- -- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy -- -- of the license. -- ------------------------------------------------------------------------------ generic type Generic_Type is private; package Generic_Stack is type Simple_Stack is private; type Generic_Type_Access is access all Generic_Type; Stack_Empty : exception; -- Raised by the functions below when stack is empty. procedure Push (Stack : in out Simple_Stack; Value : Generic_Type); -- Push Value on top of Stack. procedure Pop (Stack : in out Simple_Stack; Value : out Generic_Type); -- Remove the value on top of Stack and return it in Value. -- Raise Stack_Empty if Stack is empty. procedure Pop (Stack : in out Simple_Stack); -- Remove the value on top of Stack. -- Raise Stack_Empty if Stack is empty. function Top (Stack : Simple_Stack) return Generic_Type_Access; -- Return a pointer to the top of the stack. -- Note that modifying the contents of the returned pointer will -- modify the contents of the stack. -- Raise Stack_Empty if Stack is empty. function Next (Stack : Simple_Stack) return Generic_Type_Access; -- Return a pointer to the next item of the stack, or null if none. procedure Traverse_Stack (Stack : Simple_Stack; Callback : access function (Obj : Generic_Type) return Boolean); -- Traverse Stack and call Callback on each element of the stack. -- Stop when Stack is traversed or when Callback returns False. procedure Clear (Stack : in out Simple_Stack); -- Clear the contents of stack. This automatically frees memory for Stack -- as well. function Is_Empty (Stack : Simple_Stack) return Boolean; -- Returns True if the stack is empty. private type Type_Array is array (Positive range <>) of aliased Generic_Type; type Type_Array_Access is access all Type_Array; type Simple_Stack is record Values : Type_Array_Access; -- Index starts at 1 Last : Natural := 0; -- Last significant element in Values end record; pragma Inline (Push); pragma Inline (Pop); pragma Inline (Top); pragma Inline (Next); end Generic_Stack;
tools/ayacc/src/symbol_table.adb
svn2github/matreshka
24
29661
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- The primary authors of ayacc were <NAME> and <NAME>. -- Enhancements were made by <NAME>. -- -- Send requests for ayacc information to <EMAIL> -- Send bug reports for ayacc to <EMAIL> -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- Module : symbol_table_body.ada -- Component of : ayacc -- Version : 1.2 -- Date : 11/21/86 12:37:53 -- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxsymbol_table_body.ada -- $Header: symbol_table_body.a,v 0.1 86/04/01 15:13:55 ada Exp $ -- $Log: symbol_table_body.a,v $ -- Revision 0.1 86/04/01 15:13:55 ada -- This version fixes some minor bugs with empty grammars -- and $$ expansion. It also uses vads5.1b enhancements -- such as pragma inline. -- -- -- Revision 0.0 86/02/19 18:54:02 ada -- -- These files comprise the initial version of Ayacc -- designed and implemented by <NAME> and <NAME>. -- Ayacc has been compiled and tested under the Verdix Ada compiler -- version 4.06 on a vax 11/750 running Unix 4.2BSD. -- package body Symbol_Table is SCCS_ID : constant String := "@(#) symbol_table_body.ada, Version 1.2"; Next_Free_Terminal : Grammar_Symbol := 0; Next_Free_Nonterminal : Grammar_Symbol := -1; Start_Symbol_Pos, End_Symbol_Pos : Grammar_Symbol; type String_Pointer is access String; type Table_Entry(ID : Grammar_Symbol); type Entry_Pointer is access Table_Entry; type Table_Entry(ID :Grammar_Symbol) is record Name : String_Pointer; Next : Entry_Pointer; case ID is when 0..Grammar_Symbol'Last => -- Terminal Prec : Precedence; Assoc : Associativity; when others => -- Nonterminal null; end case; end record; Hash_Table_Size : constant := 613; -- A large prime number type Hash_Index is range 0..Hash_Table_Size-1; Hash_Table : array(Hash_Index) of Entry_Pointer; -- -- Create a 'dynamic' array for looking up an entry -- for a given grammar_symbol. -- Block_Size : constant Grammar_Symbol := 100; type Lookup_Array is array(Grammar_Symbol range 0..Block_Size-1) of Entry_Pointer; type Block; type Block_Pointer is access Block; type Block is record Lookup : Lookup_Array; Next : Block_Pointer := null; end record; -- have separate blocks for terminals and nonterminals. Terminal_Blocks, Nonterminal_Blocks : Block_Pointer := new Block; procedure Make_Lookup_Table_Entry (ID : in Grammar_Symbol; Entry_Ptr : in Entry_Pointer) is ID_Block : Block_Pointer; Block_Number : Integer; begin if ID >= 0 then ID_Block := Terminal_Blocks; else ID_Block := Nonterminal_Blocks; end if; Block_Number := Integer (abs ID / Block_Size); for I in 1..Block_Number loop if ID_Block.Next = null then ID_Block.Next := new Block; end if; ID_Block := ID_Block.Next; end loop; ID_Block.Lookup((abs ID) mod Block_Size) := Entry_Ptr; end Make_Lookup_Table_Entry; function Get_Lookup_Table_Entry(ID: Grammar_Symbol) return Entry_Pointer is ID_Block : Block_Pointer; begin if ID >= 0 then ID_Block := Terminal_Blocks; else ID_Block := Nonterminal_Blocks; end if; for I in 1.. abs ID / Block_Size loop ID_Block := ID_Block.Next; end loop; return ID_Block.Lookup((abs ID) mod Block_Size); end Get_Lookup_Table_Entry; -- some day someone should put in a good hash function. function Hash_Value (S : String) return Hash_Index is H : Integer; Mid : Integer; begin Mid := (S'First + S'Last) / 2; H := ((Character'Pos(S(S'First)) + Character'Pos(S(Mid)) + Character'Pos(S(S'Last))) * S'Length * 16 ) mod Hash_Table_Size; return Hash_Index(H); end Hash_Value; function Insert_Identifier (Name: in String) return Grammar_Symbol is Index : Hash_Index; Entry_Ptr : Entry_Pointer; begin Index := Hash_Value(Name); Entry_Ptr := Hash_Table(Index); if Entry_Ptr = null then Entry_Ptr := new Table_Entry(Next_Free_Nonterminal); Entry_Ptr.Name := new String(1..Name'Length); Entry_Ptr.Name.all := Name; Hash_Table(Index) := Entry_Ptr; Make_Lookup_Table_Entry(Next_Free_Nonterminal, Entry_Ptr); Next_Free_Nonterminal := Next_Free_Nonterminal - 1; else loop if Entry_Ptr.Name.all = Name then return Entry_Ptr.ID; end if; if Entry_Ptr.Next = null then exit; end if; Entry_Ptr := Entry_Ptr.Next; end loop; Entry_Ptr.Next := new Table_Entry(Next_Free_Nonterminal); Entry_Ptr := Entry_Ptr.Next; Entry_Ptr.Name := new String(1..Name'Length); Entry_Ptr.Name.all := Name; Make_Lookup_Table_Entry(Next_Free_Nonterminal, Entry_Ptr); Next_Free_Nonterminal := Next_Free_Nonterminal - 1; end if; return Next_Free_Nonterminal + 1; end Insert_Identifier; function Insert_Terminal (Name : String; Prec : Precedence := 0; Assoc : Associativity := Undefined) return Grammar_Symbol is Index : Hash_Index; Entry_Ptr : Entry_Pointer; begin Index := Hash_Value(Name); Entry_Ptr := Hash_Table(Index); if Entry_Ptr = null then Entry_Ptr := new Table_Entry(Next_Free_Terminal); Entry_Ptr.Name := new String(1..Name'Length); Entry_Ptr.Name.all := Name; Entry_Ptr.Assoc := Assoc; Entry_Ptr.Prec := Prec; Hash_Table(Index) := Entry_Ptr; Make_Lookup_Table_Entry(Next_Free_Terminal, Entry_Ptr); Next_Free_Terminal := Next_Free_Terminal + 1; else loop if Entry_Ptr.Name.all = Name then if Entry_Ptr.ID < 0 then -- Look out for nonterminals raise Illegal_Entry; end if; if Prec /= 0 then if Entry_Ptr.Prec /= 0 then raise Redefined_Precedence_Error; end if; Entry_Ptr.Prec := Prec; Entry_Ptr.Assoc := Assoc; end if; return Entry_Ptr.ID; end if; if Entry_Ptr.Next = null then exit; end if; Entry_Ptr := Entry_Ptr.Next; end loop; Entry_Ptr.Next := new Table_Entry(Next_Free_Terminal); Entry_Ptr := Entry_Ptr.Next; Entry_Ptr.Name := new String(1..Name'Length); Entry_Ptr.Name.all := Name; Entry_Ptr.Assoc := Assoc; Entry_Ptr.Prec := Prec; Make_Lookup_Table_Entry(Next_Free_Terminal, Entry_Ptr); Next_Free_Terminal := Next_Free_Terminal + 1; end if; return Next_Free_Terminal - 1; end Insert_Terminal; function Get_Associativity (ID: Grammar_Symbol) return Associativity is begin return Get_Lookup_Table_Entry(ID).Assoc; end; function Get_Precedence (ID: Grammar_Symbol) return Precedence is begin return Get_Lookup_Table_Entry(ID).Prec; end; function Get_Symbol_Name (ID: Grammar_Symbol) return String is begin return Get_Lookup_Table_Entry(ID).Name.all; end; function First_Symbol (Kind: Symbol_Type) return Grammar_Symbol is begin if Kind = Terminal then return 0; else return Next_Free_Nonterminal + 1; end if; end; function Last_Symbol (Kind: Symbol_Type) return Grammar_Symbol is begin if Kind = Terminal then return Next_Free_Terminal - 1; else return -1; end if; end; function First_Terminal return Grammar_Symbol is begin return 0; end; function Last_Terminal return Grammar_Symbol is begin return Next_Free_Terminal - 1; end; function Start_Symbol return Grammar_Symbol is begin return Start_Symbol_Pos; end; function End_Symbol return Grammar_Symbol is begin return End_Symbol_Pos; end; function Is_Terminal (ID: Grammar_Symbol) return Boolean is begin return ID >= 0; end; function Is_Nonterminal (ID: Grammar_Symbol) return Boolean is begin return ID < 0; end; begin End_Symbol_Pos := Insert_Terminal("END_OF_INPUT"); Start_Symbol_Pos := Insert_Identifier("$accept"); -- declare a dummy symbol to insert the "error" token. declare Dummy_Sym : Grammar_Symbol; begin Dummy_Sym := Insert_Terminal("ERROR"); end; end Symbol_Table;
programs/oeis/285/A285738.asm
neoneye/loda
22
6184
<gh_stars>10-100 ; A285738: Greatest prime less than 2*n^2 for n > 1, a(1) = 1. ; 1,7,17,31,47,71,97,127,157,199,241,283,337,389,449,509,577,647,719,797,881,967,1051,1151,1249,1327,1453,1567,1669,1789,1913,2039,2161,2311,2447,2591,2731,2887,3041,3191,3361,3527,3697,3863,4049,4231,4409,4603,4801 max $2,$0 add $2,1 pow $2,2 add $2,1 lpb $2 min $0,0 sub $2,1 mov $1,$2 mul $5,$2 mov $3,$5 max $3,0 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 trn $4,6 cmp $4,$0 mul $2,$4 mov $5,2 lpe mul $1,2 add $1,1 mov $0,$1
src/scheme.asm
clarkeaa/tinyschemeos
8
29026
<gh_stars>1-10 %define SCHEME_TYPE_ERROR 0x0 %define SCHEME_TYPE_INT 0x1 %define SCHEME_TYPE_STRING 0x2 %define SCHEME_TYPE_LIST 0x3 %define SCHEME_TYPE_ATOM 0x4 %define SCHEME_CODE_STACK_START 0x1000 ;////////////////////////////////////////////////////////////////////////////////////// scheme_prompt db ">",0 scheme_error db "* unknown scheme error",0x0d,0x0a,0 scheme_paren_mismatch_error db "error: parameter mismatch",0x0d,0x0a,0 scheme_code_sp dw SCHEME_CODE_STACK_START %macro scheme_debug_4hex 2 pusha mov si, %%msg call os_print_string mov ax, %2 call os_print_4hex call os_print_newline popa jmp %%exit %%msg db %1,0 %%exit: %endmacro %macro scheme_debug_mem 1 pusha mov si, %%prefix call os_print_string mov ax, %1 call os_print_4hex mov si, %%colon call os_print_string mov ax, [%1] call os_print_4hex call os_print_newline popa jmp %%exit %%prefix db "0x",0 %%colon db ":",0 %%exit: %endmacro ;;; ------------------------------- %macro scheme_push_word 1 pusha mov ax, %1 mov bx, [scheme_code_sp] ;get address mov [bx], ax ;write to address add bx, 2 mov word [scheme_code_sp], bx popa %endmacro %macro scheme_push_byte 1 pusha mov al, %1 mov bx, [scheme_code_sp] ;get address mov [bx], al ;write to address add bx, 1 mov word [scheme_code_sp], bx popa %endmacro ;;; ------------------------------- ;;; OUT AX - word removed from stack scheme_pop_word: pusha mov bx, [scheme_code_sp] sub bx, 2 mov ax, [bx] mov [.answer], ax mov word [scheme_code_sp], bx popa mov ax, [.answer] ret .answer dw 0 ;////////////////////////////////////////////////////////////////////////////////////// scheme_repl: mov word [scheme_code_sp], SCHEME_CODE_STACK_START ;reset code sp mov si, scheme_prompt ;print prompt call os_print_string mov ax, .input_buffer ; input sexp call os_input_string mov si, ax call os_print_newline call scheme_read ; read cmp ax, 0x0 jne scheme_repl mov ax, SCHEME_CODE_STACK_START ; eval call scheme_eval cmp ax, 0x0 jne scheme_repl mov ax, SCHEME_CODE_STACK_START ;print call scheme_print jmp scheme_repl ; repeat .input_buffer times 255 db 0 ; ----------------------------------------------------- ; IN: SI = location of sexp ; OUT: AX = 0 error code scheme_read: pusha mov word [.answer], 0 mov cx, 0 .loop: lodsb .loop_decide: cmp al, 0x0 ;exit at null char je .exit cmp al, ' ' ;ignore whitespace jb .loop cmp al, '(' ;start list je .read_list cmp al, ')' ;stray close paren je .paren_close cmp al, 0x22 ;start string " je .read_string cmp al, '0' ;start atom jb .read_atom cmp al, '9' ;start number jbe .read_number jmp .read_atom ;start atom ;;; ----- .read_list: scheme_push_word SCHEME_TYPE_LIST inc cx jmp .loop ;;; ----- .read_string: scheme_push_word SCHEME_TYPE_STRING jmp .loop ;;; ----- .read_atom: scheme_push_word SCHEME_TYPE_ATOM .loop_atom: scheme_push_byte al lodsb cmp al, 0x0 ;exit at null char je .finish_atom cmp al, ' ' ;ignore whitespace jb .finish_atom cmp al, '(' ;start list je .finish_atom cmp al, ')' ;stray close paren je .finish_atom cmp al, 0x22 ;start string " je .finish_atom cmp al, '0' ;start atom jb .loop_atom cmp al, '9' ;start number jbe .finish_atom jmp .loop_atom ;start atom .finish_atom: scheme_push_byte 0 jmp .loop_decide ;;; ----- .read_number: scheme_push_word SCHEME_TYPE_INT mov di, .read_buffer ; start writing to read_buffer .read_number_loop: stosb lodsb cmp al, '0' ; stop reading if not digit jb .read_number_end cmp al, '9' jg .read_number_end jmp .read_number_loop .read_number_end: mov dl, al ; store read character to dl mov al, 0 ; add null to string stosb mov ax, .read_buffer call scheme_string_to_int ;ax = int, bx = err cmp bx, 0 ; exit on error jne .read_error scheme_push_word ax ; put number on stack mov al, dl ; restore read character jmp .loop_decide ;;; ----- .paren_close: dec cx jmp .loop ;;; ----- .read_error: mov word [.answer], 2 jmp .exit_no_err ;;; ----- .exit: cmp cx, 0 je .exit_no_err mov word [.answer], 1 .exit_no_err: popa mov ax, [.answer] ret .answer dw 0 .read_buffer times 255 db 0 ;;; -------------------------- ;;; scheme_print_stack: pusha mov bx, SCHEME_CODE_STACK_START scheme_debug_4hex "stack start:", SCHEME_CODE_STACK_START scheme_debug_4hex "stack ptr:", [scheme_code_sp] cmp bx, scheme_code_sp je .return .loop: scheme_debug_mem bx add bx, 2 cmp bx, [scheme_code_sp] jl .loop .return: popa mov ax, 0x0 ret ; ----------------------------------------------------- ; IN: AX = location in memory to eval ; OUT: AX = err code scheme_eval: pusha mov WORD [.answer], 0 mov bx, ax mov ax, [bx] add bx, 2 cmp ax, SCHEME_TYPE_INT je .eval_int cmp ax, SCHEME_TYPE_LIST je .eval_list .eval_list: mov ax, [bx] add bx, 2 cmp ax, SCHEME_TYPE_ATOM je .eval_function mov WORD [.answer], 1 mov si, .eval_error call os_print_string jmp .return .eval_function: mov si, bx mov di, .print_stack_name call os_string_compare je .print_stack mov si, .unknown_function_error call os_print_string mov si, bx call os_print_string call os_print_newline mov WORD [.answer], 1 jmp .return .print_stack: call scheme_print_stack .eval_int: .return: popa mov ax, [.answer] ret .answer dw 0 .eval_error db "eval error",0x0d,0x0a,0 .unknown_function_error db "unknown function:",0 .print_stack_name db "print-stack",0 ; ----------------------------------------------------- ; IN: AX = memory location of value scheme_print: pusha mov bx, ax ;bx = meta address mov ax, [bx] ;deref bx cmp ax, SCHEME_TYPE_ERROR je .exit cmp ax, SCHEME_TYPE_INT je .print_int cmp ax, SCHEME_TYPE_STRING je .print_string cmp ax, SCHEME_TYPE_LIST je .print_list jmp .exit .print_int: mov ax, [bx+2] call os_print_4hex jmp .exit .print_string: jmp .exit .print_list: jmp .exit .exit: call os_print_newline popa ret ; -------------------------------------------------- ; IN: AX ptr to string ; OUT: AX number, BX err code scheme_string_to_int: pusha mov word [.err_code], 0 ;err_code = 0 mov si, ax ;string to read from = ax call os_string_length mov cx, ax ;cx = string length mov word [.answer], 0 ;answer = 0 .loop: cmp cx, 0 ;exit on last digit je .exit lodsb sub al, '0' ;al = number of digit mov dl, al ;dx = number for digit mov dh, 0 mov bx, cx ;bx = count dec bx ;bx-=1 mov ax, 10 ;ax = 10 call scheme_pow ;ax = 10^bx mul dx ;ax = number of digit * 10^loc mov bx, [.answer] add ax, bx mov [.answer], ax dec cx jmp .loop .exit: popa mov ax, [.answer] mov bx, [.err_code] ;bx = err_code ret .answer dw 0 .err_code dw 0 ;;; -------------------------------------- ;;; IN: ax number, bx power ;;; OUT: ax power scheme_pow: pusha mov cx, ax mov ax, 1 .loop: cmp bx, 0 je .exit mul cx dec bx jmp .loop .exit: mov [.answer], ax popa mov ax, [.answer] ret .answer dw 0 ;//////////////////////////////////////////////////////////////////////////////////////
dv3/q68/fat/fpart.asm
olifink/smsqe
0
172188
; DV3 Q68 FAT16 Find Partition V1.00  2017 <NAME> ; section dv3 xdef hfp_fat include 'dev8_keys_err' include 'dev8_dv3_keys' include 'dev8_dv3_hd_keys' include 'dev8_keys_dos' include 'dev8_mac_xword' ;+++ ; DV3 FAT16 find partition. ; ; ******* !!!! ; ; It is presumed here that the FAT16 partition one is looking for ; - either is the first and only partition on a FAT16 formatted medium ; - or is one of the primary (!!!!) partitions on a FAT32 formatted medium. ; If not, the partition won't be found. ; ; For the Q68, I need to card on which the parition can be found, and the ; partition nbr. They can be found at hdl_unit(a3) and hdl_part(a3) respectively. ; The hdl_part is used here, the hdl_unit in the read/write routines. ; ******* !!!! ; ; d1 r as d3 but in ths format if required ; d2 r size of partition, -1 no partition table ; d3 r sector number with partition root ; d4 r partition ID ; d7 c p drive ID / number ; a3 c p pointer to linkage block ; a4 c p pointer to physical definition ; ; error return 0 or error ;--- hfp.reg reg a1 hfp_fat movem.l hfp.reg,-(a7) ; lea hdl_part-1(a3),a1 ; table stating which drive on what arition moveq #0,d4 move.b (a1,d7.w),d4 ; partition required prt_chk ble.s hfp_mchk ; neither 0 nor negatives! cmp.b #4,d4 bgt.s hfp_mchk ; no more than 4 partitions, please clr.l d3 ; start by reading root sector hfp_chk move.l d3,d0 ; root sect or start sect of partition lea hdl_buff(a3),a1 ; sector buffer moveq #1,d2 jsr hdl_rsint(a3) ; read this sector bne.s hfp_npart ; oops, say no partition cmp.l #'FAT1',dos_f16s(a1) ; (direct) fat 16 partition? bne.s hfp_f32 ; no, could be fat32 cmp.b #'6',4+dos_f16s(a1) ; still fat16 ? bne.s hfp_mchk ; no hfp_got moveq #0,d2 move.w dos_sect+1(a1),d2 move.b dos_sect(a1),d2 ; total sectors (small numbers) tst.w d2 ; will be 0 if big number mck_badl blt.s hfp_mchk ; no negative values! bgt.s hfp_ok1 ; small numbers ok move.l dos_bnos(a1),d2 ; get big sectors number xlong d2 move.l d3,d1 ; got a FAT16 partition move.l #dos.fflg,d4 ; for FAT disk hfp_ok1 moveq #0,d0 move.b d0,hdl_npart(a3) ; partition found hfp_exit movem.l (sp)+,hfp.reg rts hfp_mchk moveq #err.mchk,d0 hfp_npart st hdl_npart(a3) ; set no partition found bra.s hfp_exit ; Check whether this is a FAT32 MBR, if yes, try to get the FAT16 partition. ; If d3<>0 then we alread checked the MBR, it was a FaT32 MBR and we tried to ; get the FAT16 partition from there - but this failed since we're back here. ; This means that we can't find the FAT16 partition. hfp_f32 tst.l d3 ; will be 0 if root sector read bne.s hfp_mchk ; we read a part. and it wasn't fat16 ; cmp.l #'FAT3',dos_f32s(a1) ; fat32? ; bne.s hfp_mchk ; no ; cmp.b #'2',4+dos_f32s(a1) ; still fat32 ? ; bne.s hfp_mchk ; no cmp.w #$55aa,$1fe(a1) ; could this be a partition table? bne.s hfp_mchk : definitely not lea dos_ptbl+dos_pstt(a1),a1; point to parition table start moveq #dos.plen,d0 ; length of one partition table entry hfp_lp subq.b #1,d4 ; this partition? beq.s hfp_fnd ; yes blt.s hfp_mchk ; too far (should have been caught at trp_chk) add.l d0,a1 ; point next entry in table bra.s hfp_lp ; try again hfp_fnd move.l (a1)+,d3 ; start of partition sector nbr xlong d3 bra hfp_chk ; check for FAT16 partition end
src/base/beans/util-beans-basic.ads
RREE/ada-util
60
13594
<filename>src/base/beans/util-beans-basic.ads ----------------------------------------------------------------------- -- util-beans-basic -- Interface Definition with Getter and Setters -- Copyright (C) 2009, 2010, 2017 <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.Beans.Objects; -- == Bean Interface == -- An Ada Bean is an object which implements the `Util.Beans.Basic.Readonly_Bean` or the -- `Util.Beans.Basic.Bean` interface. By implementing these interface, the object provides -- a behavior that is close to the Java Beans: a getter and a setter operation are available. -- package Util.Beans.Basic is pragma Preelaborate; -- ------------------------------ -- Read-only Bean interface. -- ------------------------------ -- The ''Readonly_Bean'' interface allows to plug a complex -- runtime object to the expression resolver. This interface -- must be implemented by any tagged record that should be -- accessed as a variable for an expression. -- -- For example, if 'foo' is bound to an object implementing that -- interface, expressions like 'foo.name' will resolve to 'foo' -- and the 'Get_Value' method will be called with 'name'. -- type Readonly_Bean is limited interface; type Readonly_Bean_Access is access all Readonly_Bean'Class; -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. function Get_Value (From : in Readonly_Bean; Name : in String) return Util.Beans.Objects.Object is abstract; -- ------------------------------ -- Bean interface. -- ------------------------------ -- The ''Bean'' interface allows to modify a property value. type Bean is limited interface and Readonly_Bean; -- Set the value identified by the name. -- If the name cannot be found, the method should raise the No_Value -- exception. procedure Set_Value (From : in out Bean; Name : in String; Value : in Util.Beans.Objects.Object) is abstract; -- ------------------------------ -- List of objects -- ------------------------------ -- The <b>List_Bean</b> interface gives access to a list of objects. type List_Bean is limited interface and Readonly_Bean; type List_Bean_Access is access all List_Bean'Class; -- Get the number of elements in the list. function Get_Count (From : in List_Bean) return Natural is abstract; -- Set the current row index. Valid row indexes start at 1. procedure Set_Row_Index (From : in out List_Bean; Index : in Natural) is abstract; -- Get the element at the current row index. function Get_Row (From : in List_Bean) return Util.Beans.Objects.Object is abstract; -- ------------------------------ -- Arrays of objects -- ------------------------------ -- The <tt>Array_Bean</tt> interface gives access to an array of objects. -- Unlike the <tt>List_Bean</tt> interface, it does not maintain any current position. -- The drawback is that there is no current row concept and a position must be specified -- to return a given row. type Array_Bean is limited interface and Readonly_Bean; type Array_Bean_Access is access all Array_Bean'Class; -- Get the number of elements in the array. function Get_Count (From : in Array_Bean) return Natural is abstract; -- Get the element at the given position. function Get_Row (From : in Array_Bean; Position : in Natural) return Util.Beans.Objects.Object is abstract; end Util.Beans.Basic;
programs/oeis/055/A055038.asm
neoneye/loda
22
103701
; A055038: Number of numbers <= n with an odd number of prime factors (counted with multiplicity). ; 0,1,2,2,3,3,4,5,5,5,6,7,8,8,8,8,9,10,11,12,12,12,13,13,13,13,14,15,16,17,18,19,19,19,19,19,20,20,20,20,21,22,23,24,25,25,26,27,27,28,28,29,30,30,30,30,30,30,31,31,32,32,33,33,33,34,35,36,36,37,38,39,40,40,41,42,42,43,44,45,45,45,46,46,46,46,46,46,47,47,47,48,48,48,48,48,49,50,51,51 lpb $0 mov $2,$0 sub $0,1 seq $2,66829 ; 1 if product of odd number of primes; 0 if product of even number of primes. add $1,$2 lpe mov $0,$1
pwnlib/shellcraft/templates/mips/setregs.asm
DrKeineLust/pwntools
8,966
10202
<filename>pwnlib/shellcraft/templates/mips/setregs.asm <% from pwnlib.regsort import regsort from pwnlib.constants import Constant, eval from pwnlib.shellcraft import registers from pwnlib.shellcraft.mips import mov %> <%page args="reg_context, stack_allowed = True"/> <%docstring> Sets multiple registers, taking any register dependencies into account (i.e., given eax=1,ebx=eax, set ebx first). Args: reg_context (dict): Desired register context stack_allowed (bool): Can the stack be used? Example: >>> print(shellcraft.setregs({'$t0':1, '$a3':'0'}).rstrip()) slti $a3, $zero, 0xFFFF /* $a3 = 0 */ li $t9, ~1 not $t0, $t9 >>> print(shellcraft.setregs({'$a0':'$a1', '$a1':'$a0', '$a2':'$a1'}).rstrip()) sw $a1, -4($sp) /* mov $a2, $a1 */ lw $a2, -4($sp) xor $a1, $a1, $a0 /* xchg $a1, $a0 */ xor $a0, $a1, $a0 xor $a1, $a1, $a0 </%docstring> <% reg_context = {k:v for k,v in reg_context.items() if v is not None} sorted_regs = regsort(reg_context, registers.mips) %> % if not sorted_regs: /* setregs noop */ % else: % for how, src, dst in regsort(reg_context, registers.mips): % if how == 'xchg': xor ${dst}, ${dst}, ${src} /* xchg ${dst}, ${src} */ xor ${src}, ${dst}, ${src} xor ${dst}, ${dst}, ${src} % else: ${mov(src, dst)} % endif % endfor % endif
programs/oeis/230/A230631.asm
jmorken/loda
1
82919
; A230631: a(n) = n + (sum of digits in base-4 representation of n). ; 0,2,4,6,5,7,9,11,10,12,14,16,15,17,19,21,17,19,21,23,22,24,26,28,27,29,31,33,32,34,36,38,34,36,38,40,39,41,43,45,44,46,48,50,49,51,53,55,51,53,55,57,56,58,60,62,61,63,65,67,66,68,70,72,65,67,69,71,70,72,74,76,75,77,79,81,80,82,84,86,82,84,86,88,87,89,91,93,92,94,96,98,97,99,101,103,99,101,103,105,104,106,108,110,109,111,113,115,114,116,118,120,116,118,120,122,121,123,125,127,126,128,130,132,131,133,135,137,130,132,134,136,135,137,139,141,140,142,144,146,145,147,149,151,147,149,151,153,152,154,156,158,157,159,161,163,162,164,166,168,164,166,168,170,169,171,173,175,174,176,178,180,179,181,183,185,181,183,185,187,186,188,190,192,191,193,195,197,196,198,200,202,195,197,199,201,200,202,204,206,205,207,209,211,210,212,214,216,212,214,216,218,217,219,221,223,222,224,226,228,227,229,231,233,229,231,233,235,234,236,238,240,239,241,243,245,244,246,248,250,246,248,250,252,251,253,255,257,256,258 mov $2,$0 mov $4,$0 sub $0,1 lpb $0 mov $3,3 div $4,4 mul $3,$4 sub $0,$3 lpe mov $1,$0 add $1,1 add $1,$2
Ada/inc/Problem_18.ads
Tim-Tom/project-euler
0
10152
package Problem_18 is procedure Solve; end Problem_18;
src/grammars/bigquery/BigQueryParser.g4
Attsun1031/antlr4ts-sql
0
6241
<filename>src/grammars/bigquery/BigQueryParser.g4 /* BigQuery grammar. The MIT License (MIT). Copyright (c) 2017, <NAME> (<EMAIL>) Copyright (c) 2015-2017, <NAME> (<EMAIL>), Positive Technologies. Copyright (c) 2016, <NAME> (<EMAIL>). Copyright (c) 2016, <NAME> (<EMAIL>). Copyright (c) 2016, <NAME> (<EMAIL>). Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ parser grammar BigQueryParser; options { tokenVocab = BigQueryLexer; } sql: query_statement; // Root statement for a SELECT query query_statement: with_statement? query_expr; // A Query Expression can contain a Select Statement, a parenthized Query Expression, or a set // operation of two or more Query Expressions query_expr: select_statement order_clause? limit_clause? | LR_BRACKET query_expr RR_BRACKET order_clause? limit_clause? | query_expr set_op query_expr order_clause? limit_clause?; // A Select Statement can select from table columns w/wo aliases, wildcard expressions, or any other 'expr' (Like a function call) select_statement: SELECT (ALL | DISTINCT)? ( ( expr? DOT? STAR (except_statement)? ( replace_statement )? ) | expr (AS? alias_name)? ) ( COMMA ( (expr? STAR (except_statement)? (replace_statement)?) | expr (AS? alias_name)? ) )* from_statement? where_statement? group_statement? having_statement? window_statement?; // From Statement can have one or more 'from_item's, separated by a comma from_statement: FROM from_item (COMMA from_item)*; // From Item - WIP From Items can be table expressions (project.dataset.table, Query Statements // (subqueries), or a valid array expression). Array expressions are still WIP from_item: table_expr (AS? alias_name)? (FOR SYSTEM TIME AS OF string)? | from_item join_type? JOIN from_item ( on_clause | using_clause ) | LR_BRACKET query_statement RR_BRACKET (AS? alias_name)? | UNNEST LR_BRACKET array_expr RR_BRACKET (AS? alias_name)? ( WITH OFFSET (AS? alias_name) )? | cte_name (AS? alias_name)?; // | field_path | UNNEST LR_BRACKET array_path RR_BRACKET (AS? alias_name)? ( WITH OFFSET (AS? // alias_name) )? | array_path (AS? alias_name)? (WITH OFFSET (AS? alias_name))?; // Where Statement can contain any boolean expression where_statement: WHERE bool_expression; // Group Statement can contain one or more expressions, separated by commas group_statement: GROUP BY ( (expr (COMMA expr)*) | ROLLUP LR_BRACKET expr (COMMA expr)* RR_BRACKET ); // Having statement can contain a boolean expression (TODO: Can HAVING statement contain comma separated boolean expressions?) having_statement: HAVING bool_expression; // Window statement is not complete window_statement: WINDOW window_name AS LR_BRACKET window_definition RR_BRACKET; // Order Statement can contain any number of comma separated expressions to order by. order_clause: ORDER BY expr (ASC | DESC)? (COMMA expr (ASC | DESC)?)*; // Limit Statement can contain a limit number and an optional offset limit_clause: LIMIT count (OFFSET skip_rows)?; // Unary Operators unary_operator: '-' | BIT_NOT | NOT; // Main expression rule can expand to any valid BigQuery expression. Still WIP expr: number | string | array_name LEFT_BRACKET ( OFFSET | ORDINAL | SAFE_OFFSET | SAFE_ORDINAL ) LR_BRACKET expr RR_BRACKET RIGHT_BRACKET | unary_operator expr | expr (STAR | DIVIDE) expr | expr (PLUS | MINUS) expr | expr (LESS_LESS | GREATER_GREATER) expr | expr BIT_AND expr | expr BIT_XOR expr | expr BIT_OR expr | expr ( EQUAL | LESS | GREATER | LEQ | GEQ | NOT_EQUAL | NOT? LIKE | NOT? BETWEEN expr AND expr ) expr | expr IS NOT? S_NULL | IS NOT? TRUE | IS NOT? FALSE // TODO: Separate this out into separate STRUCT and ARRAY rules. | expr NOT? IN ( ( LR_BRACKET expr (COMMA expr)* RR_BRACKET) | query_statement | UNNEST LR_BRACKET array_expr RR_BRACKET ) | expr AND expr | expr OR expr | function_name LR_BRACKET ((expr (COMMA expr)*) | STAR) RR_BRACKET | cast_expr | LR_BRACKET expr RR_BRACKET | column_expr | keyword; // Cast Expression can cast any expression to one of the datatype_name options cast_expr: CAST LR_BRACKET expr AS datatype_name RR_BRACKET; column_expr: BK_QUOTE column_expr BK_QUOTE | (((project_name DOT)? dataset_name DOT)? table_name DOT)? column_name; // Except Statement can exclude any number of comma separated column names. except_statement: EXCEPT LR_BRACKET column_name (COMMA column_name)* RR_BRACKET; // Replace Statement can replace any number of optionally aliased, comma separated expressions. replace_statement: REPLACE LR_BRACKET expr (AS? alias_name)? ( COMMA expr (AS? alias_name)* ) RR_BRACKET; // Join Type rule can expand to be any type of JOIN keyword. join_type: INNER | CROSS | FULL OUTER? | LEFT OUTER? | RIGHT OUTER?; // On Clause can contain a single boolean expression on_clause: ON bool_expression; // Set Operation expands to the keywords for each type of set operation set_op: UNION (ALL | DISTINCT)? | INTERSECT DISTINCT | EXCEPT DISTINCT; // Using Clause expands to a comma separated list of names using_clause: USING LR_BRACKET join_name (COMMA join_name)* RR_BRACKET; // Field path is WIP field_path:; // Struct can be the struct keyword followed by a datatype name. TODO: Need to expand this to support multiple comma separated datatypes sstruct: SSTRUCT '<' datatype_name '>'; // Array can be the Array keyword followed by a datatype name. array_expr: ARRAY '<' datatype_name '>'; // Array path is WIP array_path:; // Boolean expression can be any expression. (May change this later, but for now it works because we assume all queries are valid) bool_expression: expr; // Window name is WIP window_name:; // Window Definition is WIP window_definition:; // Count can be any number count: number; // Skip rows can be any number skip_rows: number; //with_query_name : ; WITH statement (CTE statement) with_statement: WITH cte_name AS LR_BRACKET query_expr RR_BRACKET ( COMMA cte_name AS LR_BRACKET query_expr RR_BRACKET )*; // Name can be any ID or string, with optional quotes and parens name: ID | DQOUTE name DQOUTE | LR_BRACKET name RR_BRACKET | BK_QUOTE name BK_QUOTE | QUOTE name QUOTE; // Name rules // Each specific type of name just expands to the parent name rule. This lets us assign handlers to // only a specific type of name. (i.e. we care about cte_names and column_names, but not about // datatype_names) alias_name: name; array_name: name; column_name: name; cte_name: name; dataset_name: name; datatype_name: name; function_name: name; join_name: name; member_name: name; project_name: name; struct_name: name; table_name: name; table_expr: (((project_name DOT)? dataset_name DOT)? table_name) | BK_QUOTE table_expr BK_QUOTE; // NUMBER LITERALS number: integer_type | float_type; integer_type: INT; float_type: FLOAT; // STRING LITERAL string: quoted_string | triple_quoted_string | raw_string | byte_string | raw_byte_string | special_string; // Quoted strings can be in single or double quotes. They can contain escaped quotes of the type // enclosing the string, or non escaped versions of the other type of quote. (A single quoted string // can contain unescaped double quotes or escaped single quotes, etc) quoted_string: QUOTED_STRING; triple_quoted_string: TRIPLE_QUOTED_STRING; raw_string: RAW_STRING; byte_string: BYTE_STRING; raw_byte_string: RAW_BYTE_STRING; // Special strings are strings with DATE, DATETIME, TIME, or TIMESTAMP preceding the string. These // keywords are not reserved keywords, which means that they can be used as identifiers without // backticks. special_string: datatype_name QUOTED_STRING; keyword: ALL | AND | ANY | ARRAY | AS | ASC | ASSERT_ROWS_MODIFIED | AT | BETWEEN | BY | CASE | CAST | COLLATE | CONTAINS | CREATE | CROSS | CUBE | CURRENT | DEFAULT | DEFINE | DESC | DISTINCT | ELSE | END | ENUM | ESCAPE | EXCEPT | EXCLUDE | EXISTS | EXTRACT | FALSE | FETCH | FOLLOWING | FOR | FROM | FULL | GROUP | GROUPING | GROUPS | HASH | HAVING | IF | IGNORE | IN | INNER | INTERSECT | INTERVAL | INTO | IS | JOIN | LATERAL | LEFT | LIKE | LIMIT | LOOKUP | MERGE | NATURAL | NEW | NO | NOT | S_NULL | NULLS | OF | OFFSET | ON | OR | ORDER | ORDINAL | OUTER | OVER | PARTITION | PRECEDING | PROTO | RANGE | RECURSIVE | REPLACE | RESPECT | RIGHT | ROLLUP | ROWS | SAFE_OFFSET | SAFE_ORDINAL | SELECT | SET | SOME | SSTRUCT | SYSTEM | TABLESAMPLE | THEN | TIME | TO | TREAT | TRUE | UNBOUNDED | UNION | UNNEST | USING | WHEN | WHERE | WINDOW | WITH | WITHIN;
even-odd-transfer-from-array-of-data.asm
Soumya-Dey/8085-asm-programs
0
4754
;Program title --------- ;An array of n hexadecimal data is given. ;Transfer all even data in a separate location ;and all odd data in another separate location ;in forward order (same as the original). ;Store 00 at the end of both of locations. ;|- Input -----------------|- Output -----|--------------| ;| f100 => 0A ;counter |- Even Data --|- Odd Data ---| ;| f101 => 01 ;1st data | f120 => 02 | f130 => 01 | ;| f102 => 02 | f121 => 04 | f131 => 03 | ;| f103 => 03 | f122 => 06 | f132 => 05 | ;| f104 => 04 | f123 => 08 | f133 => 07 | ;| f105 => 05 | f124 => 0A | f134 => 09 | ;| f106 => 06 | f125 => 00 | f135 => 00 | ;| f107 => 07 | | ;| f108 => 08 | | ;| f109 => 09 | | ;| f10A => 0A ;last data | | ;|-------------------------|-----------------------------| ;Source code ----- lxi h, f100h lxi d, f120h lxi b, f130h mov a, m sta f400h nozero: inx h mov a, m rrc mov a, m jnc even stax b inx b jump: lda f400h dcr a sta f400h jnz nozero xra a stax d stax b hlt even: stax d inx d jmp jump
libsrc/_DEVELOPMENT/adt/p_forward_list/z80/asm_p_forward_list_back.asm
jpoikela/z88dk
640
166660
<filename>libsrc/_DEVELOPMENT/adt/p_forward_list/z80/asm_p_forward_list_back.asm ; =============================================================== ; Jan 2014 ; =============================================================== ; ; void *p_forward_list_back(p_forward_list_t *list) ; ; Return item at back of list without removing it from the list. ; O(n) ; ; =============================================================== SECTION code_clib SECTION code_adt_p_forward_list PUBLIC asm_p_forward_list_back EXTERN __p_forward_list_locate_item, error_zc asm_p_forward_list_back: ; enter : hl = p_forward_list_t *list ; ; exit : success ; ; hl = void *item (item at back) ; carry reset ; ; fail if list is empty ; ; hl = 0 ; carry set ; ; uses : af, bc, de, hl ld a,(hl) inc hl or (hl) jp z, error_zc dec hl ld bc,0 ; locate end of list jp __p_forward_list_locate_item
test/Succeed/Issue2102.agda
shlevy/agda
3
5349
<gh_stars>1-10 -- {-# OPTIONS -v tc:30 #-} -- Andreas, 2016-07-19, issue #2102 -- An abstract definition in a where block should not -- stop metas of parent function to be solved! test : _ test = Set -- WAS: yellow where abstract def = Set -- should succeed test1 = Set module M where abstract def = Set -- Similar situation mutual test2 : _ abstract def = Set test2 = Set
kernel/asm/tss.asm
Phoenux-OS/Phoenux
6
161201
<filename>kernel/asm/tss.asm global _tss global _tss_size segment _DATA class=DATA use32 align 4 _tss: dd 0 dd 0xEFFFF0 dd 0x10 dd 0xEEFFF0 dd 0x21 times 21 dd 0 _tss_end: _tss_size equ _tss_end - _tss
tests/secretbox2.adb
yannickmoy/SPARKNaCl
0
12653
<filename>tests/secretbox2.adb with SPARKNaCl; use SPARKNaCl; with SPARKNaCl.Core; use SPARKNaCl.Core; with SPARKNaCl.Debug; use SPARKNaCl.Debug; with SPARKNaCl.Secretbox; use SPARKNaCl.Secretbox; with SPARKNaCl.Stream; with Ada.Text_IO; use Ada.Text_IO; procedure Secretbox2 is Firstkey : constant Core.Salsa20_Key := Construct ((16#1b#, 16#27#, 16#55#, 16#64#, 16#73#, 16#e9#, 16#85#, 16#d4#, 16#62#, 16#cd#, 16#51#, 16#19#, 16#7a#, 16#9a#, 16#46#, 16#c7#, 16#60#, 16#09#, 16#54#, 16#9e#, 16#ac#, 16#64#, 16#74#, 16#f2#, 16#06#, 16#c4#, 16#ee#, 16#08#, 16#44#, 16#f6#, 16#83#, 16#89#)); Nonce : constant Stream.HSalsa20_Nonce := (16#69#, 16#69#, 16#6e#, 16#e9#, 16#55#, 16#b6#, 16#2b#, 16#73#, 16#cd#, 16#62#, 16#bd#, 16#a8#, 16#75#, 16#fc#, 16#73#, 16#d6#, 16#82#, 16#19#, 16#e0#, 16#03#, 16#6b#, 16#7a#, 16#0b#, 16#37#); C : constant Byte_Seq (0 .. 162) := (16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F3#, 16#FF#, 16#C7#, 16#70#, 16#3F#, 16#94#, 16#00#, 16#E5#, 16#2A#, 16#7D#, 16#FB#, 16#4B#, 16#3D#, 16#33#, 16#05#, 16#D9#, 16#8E#, 16#99#, 16#3B#, 16#9F#, 16#48#, 16#68#, 16#12#, 16#73#, 16#C2#, 16#96#, 16#50#, 16#BA#, 16#32#, 16#FC#, 16#76#, 16#CE#, 16#48#, 16#33#, 16#2E#, 16#A7#, 16#16#, 16#4D#, 16#96#, 16#A4#, 16#47#, 16#6F#, 16#B8#, 16#C5#, 16#31#, 16#A1#, 16#18#, 16#6A#, 16#C0#, 16#DF#, 16#C1#, 16#7C#, 16#98#, 16#DC#, 16#E8#, 16#7B#, 16#4D#, 16#A7#, 16#F0#, 16#11#, 16#EC#, 16#48#, 16#C9#, 16#72#, 16#71#, 16#D2#, 16#C2#, 16#0F#, 16#9B#, 16#92#, 16#8F#, 16#E2#, 16#27#, 16#0D#, 16#6F#, 16#B8#, 16#63#, 16#D5#, 16#17#, 16#38#, 16#B4#, 16#8E#, 16#EE#, 16#E3#, 16#14#, 16#A7#, 16#CC#, 16#8A#, 16#B9#, 16#32#, 16#16#, 16#45#, 16#48#, 16#E5#, 16#26#, 16#AE#, 16#90#, 16#22#, 16#43#, 16#68#, 16#51#, 16#7A#, 16#CF#, 16#EA#, 16#BD#, 16#6B#, 16#B3#, 16#73#, 16#2B#, 16#C0#, 16#E9#, 16#DA#, 16#99#, 16#83#, 16#2B#, 16#61#, 16#CA#, 16#01#, 16#B6#, 16#DE#, 16#56#, 16#24#, 16#4A#, 16#9E#, 16#88#, 16#D5#, 16#F9#, 16#B3#, 16#79#, 16#73#, 16#F6#, 16#22#, 16#A4#, 16#3D#, 16#14#, 16#A6#, 16#59#, 16#9B#, 16#1F#, 16#65#, 16#4C#, 16#B4#, 16#5A#, 16#74#, 16#E3#, 16#55#, 16#A5#); M : Byte_Seq (0 .. 162); S : Boolean; begin Open (M, S, C, Nonce, Firstkey); Put_Line ("Status is " & S'Img); DH ("M is", M); end Secretbox2;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_822.asm
ljhsiun2/medusa
9
166604
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x10caa, %rdi nop nop xor %r13, %r13 movb $0x61, (%rdi) nop and %r13, %r13 lea addresses_normal_ht+0x14fca, %rax nop nop nop nop nop inc %rbp mov $0x6162636465666768, %rdx movq %rdx, %xmm4 vmovups %ymm4, (%rax) nop nop nop dec %r10 lea addresses_WC_ht+0x13c86, %rdi nop nop nop xor %r11, %r11 mov $0x6162636465666768, %r10 movq %r10, %xmm4 vmovups %ymm4, (%rdi) nop nop nop nop and $54602, %rdi lea addresses_WT_ht+0x58ea, %r10 clflush (%r10) nop nop nop xor %r13, %r13 mov (%r10), %rax nop nop nop and %r10, %r10 lea addresses_WT_ht+0xb34a, %rsi lea addresses_UC_ht+0x2eca, %rdi nop nop add $21696, %r10 mov $115, %rcx rep movsq nop nop nop nop nop sub $235, %r11 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r14 push %rax push %rdx push %rsi // Faulty Load lea addresses_WT+0x5fca, %rsi nop nop nop nop sub %rax, %rax mov (%rsi), %dx lea oracles, %r14 and $0xff, %rdx shlq $12, %rdx mov (%r14,%rdx,1), %rdx pop %rsi pop %rdx pop %rax pop %r14 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT', 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WC_ht', 'congruent': 4}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 7}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC_ht', 'congruent': 1}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 4}} {'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}} {'39': 21829} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
test/Fail/InvalidNamePartKeyword.agda
cruhland/agda
1,989
1749
test = forall _let_ → Set
src/day-2/adventofcode-day_2.ads
persan/advent-of-code-2020
0
16868
with Ada.Containers.Vectors; with Ada.Finalization; with GNAT.Strings; -- https://adventofcode.com/2020/day/2 -- ========================================================================== -- --- Day 2: Password Philosophy --- -- -- Your flight departs in a few days from the coastal airport; -- the easiest way down to the coast from here is via toboggan. -- -- The shopkeeper at the North Pole Toboggan Rental Shop is having a bad day. -- "Something's wrong with our computers; we can't log in!" You ask if you can take a look. -- -- Their password database seems to be a little corrupted: some of the passwords -- wouldn't have been allowed by the Official Toboggan Corporate Policy that was in effect when they were chosen. -- -- To try to debug the problem, they have created a list (your puzzle input) -- of passwords (according to the corrupted database) and the corporate policy when that password was set. -- -- For example, suppose you have the following list: -- -- 1-3 a: abcde -- 1-3 b: cdefg -- 2-9 c: ccccccccc -- -- Each line gives the password policy and then the password. -- The password policy indicates the lowest and highest number of times a given letter -- must appear for the password to be valid. -- For example, 1-3 a means that the password must contain a at least 1 time and at most 3 times. -- -- In the above example, 2 passwords are valid. -- The middle password, <PASSWORD>, is not; -- it contains no instances of b, but needs at least 1. -- The first and third passwords are valid: they contain one a or nine c, -- both within the limits of their respective policies. -- -- How many passwords are valid according to their policies? -- ========================================================================== --- Part Two --- -- While it appears you validated the passwords correctly, -- they don't seem to be what the Official Toboggan Corporate Authentication System is expecting. -- -- The shopkeeper suddenly realizes that he just accidentally explained the password policy rules -- from his old job at the sled rental place down the street! -- The Official Toboggan Corporate Policy actually works a little differently. -- -- Each policy actually describes two positions in the password, -- where 1 means the first character, -- 2 means the second character, and so on. -- (Be careful; Toboggan Corporate Policies have no concept of "index zero"!) -- Exactly one of these positions must contain the given letter. -- Other occurrences of the letter are irrelevant for the purposes of policy enforcement. -- -- Given the same example list from above: -- -- 1-3 a: abcde is valid: position 1 contains a and position 3 does not. -- 1-3 b: cdefg is invalid: neither position 1 nor position 3 contains b. -- 2-9 c: ccccccccc is invalid: both position 2 and position 9 contain c. package Adventofcode.Day_2 is use type GNAT.Strings.String_Access; type Password_Entry is new Ada.Finalization.Controlled with record Min, Max : Natural; Key : Character; Password : GNAT.Strings.String_Access; end record; function Image (Self : Password_Entry) return String is ("Min => " & Self.Min'Img & ", Max => " & Self.Max'Img & ", Key => '" & Self.Key & "'" & ", Password => " & (if Self.Password = null then "<null>" else '"' & Self.Password.all & '"')); overriding procedure Finalize (Object : in out Password_Entry); overriding procedure Adjust (Object : in out Password_Entry); function Valid (Self : Password_Entry) return Boolean; function Valid2 (Self : Password_Entry) return Boolean; function Parse (Line : String) return Password_Entry; package Password_Entrys is new Ada.Containers.Vectors (Natural, Password_Entry); end Adventofcode.Day_2;
Task/Anagrams-Deranged-anagrams/Ada/anagrams-deranged-anagrams.ada
LaudateCorpus1/RosettaCodeData
1
7057
with Ada.Text_IO; use Ada.Text_IO; with Ada.Containers.Generic_Array_Sort; with Ada.Containers.Indefinite_Vectors; procedure Danagrams is package StringVector is new Ada.Containers.Indefinite_Vectors (Positive, String); procedure StrSort is new Ada.Containers.Generic_Array_Sort (Index_Type => Positive, Element_Type => Character, Array_Type => String); function Derange (s1 : String; s2 : String) return Boolean is begin for i in s1'Range loop if (s1 (i) = s2 (i)) then return False; end if; end loop; return True; end Derange; File : File_Type; len, foundlen : Positive := 1; Vect, SVect : StringVector.Vector; index, p1, p2 : StringVector.Extended_Index := 0; begin Open (File, In_File, "unixdict.txt"); while not End_Of_File (File) loop declare str : String := Get_Line (File); begin len := str'Length; if len > foundlen then Vect.Append (str); StrSort (str); index := 0; loop -- Loop through anagrams by index in vector of sorted strings index := SVect.Find_Index (str, index + 1); exit when index = StringVector.No_Index; if Derange (Vect.Last_Element, Vect.Element (index)) then p1 := Vect.Last_Index; p2 := index; foundlen := len; end if; end loop; SVect.Append (str); end if; end; end loop; Close (File); Put_Line (Vect.Element (p1) & " " & Vect.Element (p2)); end Danagrams;
alloy4fun_models/trashltl/models/19/q6GD5qbayuNB99un2.als
Kaixi26/org.alloytools.alloy
0
3130
open main pred idq6GD5qbayuNB99un2_prop20 { always all f : Protected | f in Trash since f not in Protected } pred __repair { idq6GD5qbayuNB99un2_prop20 } check __repair { idq6GD5qbayuNB99un2_prop20 <=> prop20o }
.emacs.d/elpa/wisi-3.1.3/sal-generic_decimal_image.adb
caqg/linux-home
0
27540
-- Abstract: -- -- see spec -- -- Copyright (C) 2005, 2006, 2009 <NAME>. All Rights Reserved. -- -- This library is free software; you can redistribute it and/or -- modify it under terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3, or (at -- your option) any later version. This library is distributed in the -- hope that it will be useful, but WITHOUT ANY WARRANTY; without even -- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -- PURPOSE. See the GNU General Public License for more details. You -- should have received a copy of the GNU General Public License -- distributed with this program; see file COPYING. If not, write to -- the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- MA 02111-1307, USA. -- -- As a special exception, if other files instantiate generics from -- this unit, or you link this unit with other files to produce an -- executable, this unit does not by itself cause the resulting -- executable to be covered by the GNU General Public License. This -- exception does not however invalidate any other reasons why the -- executable file might be covered by the GNU Public License. pragma License (Modified_GPL); function SAL.Generic_Decimal_Image (Item : in Number_Type; Width : in Natural) return String is pragma Warnings (Off); -- Avoid warning about "abs applied to non-negative value has no -- effect" for some instantiations. Temp : Integer := abs Integer (Item); -- IMPROVEME: need test for Decimal_Image, include constrained positive number_type pragma Warnings (On); Digit : Integer; Image : String (1 .. Width); begin for I in reverse Image'Range loop Digit := Temp mod 10; Temp := Temp / 10; Image (I) := Character'Val (Character'Pos ('0') + Digit); end loop; return Image; end SAL.Generic_Decimal_Image;
PCMgrLoader/shellcode_x64.asm
fengjixuchui/PCMgr
40
10821
.data .code MGetCurrentPeb PROC mov rbx, 0 mov rbx, GS:[60h] mov rax, rbx ret MGetCurrentPeb ENDP END