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/021/A021069.asm | neoneye/loda-programs | 11 | 21626 | ; A021069: Decimal expansion of 1/65.
; Submitted by <NAME>
; 0,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3
mov $2,10
pow $2,$0
mul $2,2
div $2,13
mov $0,$2
mod $0,10
|
src/Nats/Multiply/Distrib.agda | ice1k/Theorems | 1 | 13300 | <gh_stars>1-10
module Nats.Multiply.Distrib where
open import Nats
open import Equality
open import Function
open import Nats.Multiply.Comm
open import Nats.Add.Assoc
open import Nats.Add.Comm
------------------------------------------------------------------------
-- internal stuffs
private
a*1+b=a+a*b : ∀ a b → a * suc b ≡ a + a * b
a*1+b=a+a*b a b
rewrite nat-multiply-comm a $ suc b
| nat-multiply-comm a b
= refl
a*c+b*c=/a+b/*c : ∀ a b c → a * c + b * c ≡ (a + b) * c
a*c+b*c=/a+b/*c a b zero
rewrite nat-multiply-comm a 0
| nat-multiply-comm b 0
| nat-multiply-comm (a + b) 0
= refl
a*c+b*c=/a+b/*c a b sc@(suc c)
rewrite nat-add-comm a b
| a*1+b=a+a*b a c
| nat-add-assoc a (a * c) (b * sc)
| nat-add-comm a $ a * c + b * sc
| a*1+b=a+a*b b c
| nat-multiply-comm (b + a) sc
| nat-add-assoc b a $ c * (b + a)
| nat-add-comm a $ c * (b + a)
| sym $ nat-add-assoc b (c * (b + a)) a
| nat-multiply-comm c $ b + a
| sym $ a*c+b*c=/a+b/*c b a c
| sym $ nat-add-assoc (a * c) b (b * c)
| nat-add-comm (b * c) (a * c)
| sym $ nat-add-assoc b (b * c) (a * c)
| sym $ nat-add-assoc b (a * c) (b * c)
| nat-add-comm b $ a * c
= refl
------------------------------------------------------------------------
-- public aliases
nat-multiply-distrib : ∀ a b c → a * c + b * c ≡ (a + b) * c
nat-multiply-distrib = a*c+b*c=/a+b/*c
|
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/ツール/tool/cos2/chip/ys_chip0.asm | prismotizm/gigaleak | 0 | 94672 | <reponame>prismotizm/gigaleak
Name: ys_chip0.asm
Type: file
Size: 360209
Last-Modified: '2016-05-13T04:52:57Z'
SHA-1: 5BBED4C490161A54FDF1CFCF8F128A336FE7EF5C
Description: null
|
kernel/mm/heap.asm | ssebs/xos | 15 | 174463 | <gh_stars>10-100
;; xOS32
;; Copyright (C) 2016-2017 by <NAME>.
use32
KERNEL_HEAP = VBE_BACK_BUFFER + VBE_BUFFER_SIZE + 0x1000000
USER_HEAP = KERNEL_HEAP + 0x8000000 ; 128 MB
KMALLOC_FLAGS = PAGE_PRESENT OR PAGE_WRITEABLE
MALLOC_FLAGS = PAGE_PRESENT OR PAGE_WRITEABLE OR PAGE_USER
; kmalloc:
; Allocates memory in the kernel's heap
; In\ ECX = Bytes to allocate
; Out\ EAX = SSE-aligned pointer to allocated memory
; Note:
; kmalloc() NEVER returns NULL, because it never fails.
; When kmalloc() fails, it fires up a kernel panic.
kmalloc:
add ecx, 16 ; force sse-alignment
add ecx, 4095
shr ecx, 12 ; to pages
mov [.pages], ecx
mov eax, KERNEL_HEAP
mov ecx, [.pages]
call vmm_alloc_pages
cmp eax, USER_HEAP
jge .no
mov eax, KERNEL_HEAP
mov ecx, [.pages]
mov dl, KMALLOC_FLAGS
call vmm_alloc
cmp eax, 0
je .no
mov [.return], eax
mov edi, [.return]
mov eax, [.pages]
stosd
mov eax, [.return]
add eax, 16
ret
.no:
push .no_msg
jmp panic
align 4
.pages dd 0
.return dd 0
.no_msg db "kmalloc: kernel heap overflowed to user heap.",0
; kfree:
; Frees kernel memory
; In\ EAX = Pointer to memory
; Out\ Nothing
kfree:
mov ecx, [eax-16]
;sub ecx, 16
call vmm_free
ret
; malloc:
; Allocates user heap memory
; In\ ECX = Bytes to allocate
; Out\ EAX = SSE-aligned pointer, 0 on error
malloc:
add ecx, 16 ; force sse-alignment
add ecx, 4095
shr ecx, 12 ; to pages
mov [.pages], ecx
mov eax, USER_HEAP
mov ecx, [.pages]
mov dl, MALLOC_FLAGS
call vmm_alloc
cmp eax, 0
je .no
mov [.return], eax
mov edi, [.return]
mov eax, [.pages]
stosd
mov eax, [.return]
add eax, 16
ret
.no:
mov eax, 0
ret
align 4
.pages dd 0
.return dd 0
; realloc:
; Reallocates user memory
; In\ EAX = Pointer
; In\ ECX = New size
; Out\ EAX = New pointer
realloc:
mov [.pointer], eax
mov [.size], ecx
mov ecx, [.size]
call malloc
mov [.new_pointer], eax
mov esi, [.pointer]
mov ecx, [esi-16]
shl ecx, 12
sub ecx, 16
;add esi, 16
mov edi, [.new_pointer]
rep movsb
mov eax, [.pointer]
call free
mov eax, [.new_pointer]
ret
.msg db "realloc",10,0
align 4
.pointer dd 0
.new_pointer dd 0
.size dd 0
; free:
; Frees user memory
; In\ EAX = Pointer to memory
; Out\ Nothing
free:
mov ecx, [eax-16]
;sub ecx, 16
call vmm_free
ret
|
programs/oeis/328/A328994.asm | neoneye/loda | 22 | 3436 | <gh_stars>10-100
; A328994: a(n) = n^2*(1+n)*(1+n^2)/4.
; 1,15,90,340,975,2331,4900,9360,16605,27775,44286,67860,100555,144795,203400,279616,377145,500175,653410,842100,1072071,1349755,1682220,2077200,2543125,3089151,3725190,4461940,5310915,6284475,7395856,8659200,10089585
sub $2,$0
add $0,2
mul $2,$0
sub $2,1
bin $2,2
mul $0,$2
div $0,2
|
cohomology/WithCoefficients.agda | danbornside/HoTT-Agda | 0 | 10334 | {-# OPTIONS --without-K #-}
open import HoTT
module cohomology.WithCoefficients where
→Ω-group-structure : ∀ {i j} (X : Ptd i) (Y : Ptd j)
→ GroupStructure (fst (X ⊙→ ⊙Ω Y))
→Ω-group-structure X Y = record {
ident = ((λ _ → idp) , idp);
inv = λ F → ((! ∘ fst F) , ap ! (snd F));
comp = λ F G →
((λ x → fst F x ∙ fst G x), ap2 _∙_ (snd F) (snd G));
unitl = λ G → pair= idp (ap2-idp-l _∙_ {x = idp} (snd G) ∙ ap-idf (snd G));
unitr = λ F → ⊙λ=
(∙-unit-r ∘ fst F)
(ap2-idp-r _∙_ (snd F) ∙ unitr-lemma (snd F));
assoc = λ F G H → ⊙λ=
(λ x → ∙-assoc (fst F x) (fst G x) (fst H x))
(! (∙-unit-r _) ∙ assoc-lemma (snd F) (snd G) (snd H));
invl = λ F → ⊙λ=
(!-inv-l ∘ fst F)
(invl-lemma (snd F) ∙ ! (∙-unit-r _));
invr = λ F → ⊙λ=
(!-inv-r ∘ fst F)
(invr-lemma (snd F) ∙ ! (∙-unit-r _))}
where
unitr-lemma : ∀ {i} {A : Type i} {x : A} {p : x == x} (α : p == idp)
→ ap (λ r → r ∙ idp) α == ∙-unit-r p ∙ α
unitr-lemma idp = idp
assoc-lemma : ∀ {i} {A : Type i} {w x y z : A}
{p₁ p₂ : w == x} {q₁ q₂ : x == y} {r₁ r₂ : y == z}
(α : p₁ == p₂) (β : q₁ == q₂) (γ : r₁ == r₂)
→ ap2 _∙_ (ap2 _∙_ α β) γ ∙ ∙-assoc p₂ q₂ r₂ ==
∙-assoc p₁ q₁ r₁ ∙ ap2 _∙_ α (ap2 _∙_ β γ)
assoc-lemma idp idp idp = ! (∙-unit-r _)
invl-lemma : ∀ {i} {A : Type i} {x : A} {p : x == x} (α : p == idp)
→ ap2 _∙_ (ap ! α) α == !-inv-l p
invl-lemma idp = idp
invr-lemma : ∀ {i} {A : Type i} {x : A} {p : x == x} (α : p == idp)
→ ap2 _∙_ α (ap ! α) == !-inv-r p
invr-lemma idp = idp
→Ω-Group : ∀ {i j} (X : Ptd i) (Y : Ptd j) → Group (lmax i j)
→Ω-Group X Y = Trunc-Group (→Ω-group-structure X Y)
{- Pointed maps out of bool -}
Bool⊙→-out : ∀ {i} {X : Ptd i}
→ fst (⊙Lift {j = i} ⊙Bool ⊙→ X) → fst X
Bool⊙→-out (h , _) = h (lift false)
Bool⊙→-equiv : ∀ {i} (X : Ptd i)
→ fst (⊙Lift {j = i} ⊙Bool ⊙→ X) ≃ fst X
Bool⊙→-equiv {i} X = equiv Bool⊙→-out g f-g g-f
where
g : fst X → fst (⊙Lift {j = i} ⊙Bool ⊙→ X)
g x = ((λ {(lift b) → if b then snd X else x}) , idp)
f-g : ∀ x → Bool⊙→-out (g x) == x
f-g x = idp
g-f : ∀ H → g (Bool⊙→-out H) == H
g-f (h , hpt) = pair=
(λ= lemma)
(↓-app=cst-in $
idp
=⟨ ! (!-inv-l hpt) ⟩
! hpt ∙ hpt
=⟨ ! (app=-β lemma (lift true)) |in-ctx (λ w → w ∙ hpt) ⟩
app= (λ= lemma) (lift true) ∙ hpt ∎)
where lemma : ∀ b → fst (g (h (lift false))) b == h b
lemma (lift true) = ! hpt
lemma (lift false) = idp
abstract
Bool⊙→-path : ∀ {i} (X : Ptd i)
→ fst (⊙Lift {j = i} ⊙Bool ⊙→ X) == fst X
Bool⊙→-path X = ua (Bool⊙→-equiv X)
abstract
Bool⊙→Ω-is-π₁ : ∀ {i} (X : Ptd i)
→ →Ω-Group (⊙Lift {j = i} ⊙Bool) X == π 1 (ℕ-S≠O _) X
Bool⊙→Ω-is-π₁ {i} X =
group-ua
(record {
f = Trunc-fmap Bool⊙→-out;
pres-comp = Trunc-elim {i = i}
(λ _ → Π-level {j = i} (λ _ → =-preserves-level _ Trunc-level))
(λ g₁ → Trunc-elim
(λ _ → =-preserves-level _ Trunc-level)
(λ g₂ → idp))} ,
is-equiv-Trunc ⟨0⟩ _ (snd (Bool⊙→-equiv (⊙Ω X))))
|
programs/oeis/298/A298791.asm | karttu/loda | 0 | 4288 | <filename>programs/oeis/298/A298791.asm
; A298791: Partial sums of A298789.
; 1,5,12,22,37,55,75,101,130,160,197,237,277,325,376,426,485,547,607,677,750,820,901,985,1065,1157,1252,1342,1445,1551,1651,1765,1882,1992,2117,2245,2365,2501,2640,2770,2917,3067,3207,3365,3526,3676,3845,4017,4177,4357,4540,4710,4901,5095,5275,5477,5682,5872,6085,6301,6501,6725,6952,7162,7397,7635,7855,8101,8350,8580,8837,9097,9337,9605,9876,10126,10405,10687,10947,11237,11530,11800,12101,12405,12685,12997,13312,13602,13925,14251,14551,14885,15222,15532,15877,16225,16545,16901,17260,17590,17957,18327,18667,19045,19426,19776,20165,20557,20917,21317,21720,22090,22501,22915,23295,23717,24142,24532,24965,25401,25801,26245,26692,27102,27557,28015,28435,28901,29370,29800,30277,30757,31197,31685,32176,32626,33125,33627,34087,34597,35110,35580,36101,36625,37105,37637,38172,38662,39205,39751,40251,40805,41362,41872,42437,43005,43525,44101,44680,45210,45797,46387,46927,47525,48126,48676,49285,49897,50457,51077,51700,52270,52901,53535,54115,54757,55402,55992,56645,57301,57901,58565,59232,59842,60517,61195,61815,62501,63190,63820,64517,65217,65857,66565,67276,67926,68645,69367,70027,70757,71490,72160,72901,73645,74325,75077,75832,76522,77285,78051,78751,79525,80302,81012,81797,82585,83305,84101,84900,85630,86437,87247,87987,88805,89626,90376,91205,92037,92797,93637,94480,95250,96101,96955,97735,98597,99462,100252,101125,102001,102801,103685,104572,105382,106277,107175,107995,108901,109810,110640
mov $2,$0
mul $0,2
lpb $0,1
add $1,$0
add $1,$2
add $1,$0
sub $0,2
trn $0,1
sub $1,1
sub $2,1
lpe
add $1,1
|
error_addresses.asm | jwestfall69/ddragon-sound-diag | 0 | 12340 | <gh_stars>0
section errors,"rodata"
; fills the errors section with bra to self instructions
blkw (0x5ff2/2),0x20fe
|
bessel_func1_old1.asm | rgimad/fasm_programs | 8 | 246864 | format PE64 Console 5.0
entry main
include 'C:\Program Files (x86)\fasmw17322\INCLUDE\win64a.inc'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
section '.text' code readable executable
main:
; for printf, scanf etc. we use cinvoke (__cdecl), invoke is used for __stdcall functions
cinvoke printf, msg_enter_x
cinvoke scanf, x_read_fmt, x
mov [s], 0.0 ; for double values we must write .0 always.
mov rax, 1.0 ; 64bit mode allows only signed 32bit immediates. Only instruction that can take 64bit immediate is "mov rax, imm64"
mov [p], rax
mov [n], 0
while_1:
; check if abs(p) >= eps. if false break
movq xmm0, [p]
pslld xmm0, 1
psrld xmm0, 1
comisd xmm0, [eps]
jc while_1_end ; if abs(p) < eps then break
movq xmm1, [s]
addsd xmm1, [p]
movq [s], xmm1
inc [n]
cvtsi2sd xmm1, [n] ; convert int to double. ~ xmm1 = (double)n;
mulsd xmm1, xmm1 ; now xmm1 = n^2
mov rax, 4.0
movq xmm4, rax
mulsd xmm1, xmm4 ; now xmm1 = 4*(n^2)
movq xmm0, [x]
mulsd xmm0, xmm0 ; now xmm0 = x^2
mov rax, -1.0
movq xmm4, rax
mulsd xmm0, xmm4 ; now xmm0 = -(x^2)
movq xmm3, [p]
mulsd xmm3, xmm0
divsd xmm3, xmm1
movq [p], xmm3
jmp while_1
while_1_end:
;cinvoke printf, format1, 1337
;cinvoke printf, <'a = %s', 13, 10, 'b = %s', 13, 10>, 'apple', 'boy'
;cinvoke printf, "num = %x", 2227
;cinvoke printf, "var1 = %.11lf", [var1]
;movq xmm0, [var1] ; load from memory
;addsd xmm0, xmm0 ; *=2
;mulsd xmm0, xmm0
; 1st way to get absolute value of for example xmm0
;mov rax, 0
;movq xmm1, rax
;subsd xmm1, xmm0
;movq xmm0, xmm1
; 2nd way to get abs of xmm register
;pslld xmm0, 1
;psrld xmm0, 1
;movq [var1], xmm0
;cinvoke printf, " var1 = %.11lf", [var1]
;inc [n]
;inc [n]
;cvtsi2sd xmm1, [n]
;movq [p], xmm1
cinvoke printf, "J0(%f) = %f", [x], [s]
cinvoke getchar ; first getchar will read \n
cinvoke getchar
jmp main
;cinvoke system, cmd
Exit: ; exit from program
invoke ExitProcess, 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
section '.data' data readable writeable
; db - reserve byte, dw - reserve word, dd - reserve dword, dq - reserve qword
eps dq 0.000001 ; double eps = 0.000001; // epsilon
x dq ? ; double x; // x value
n dd ? ; int n; // step counter
s dq ? ; double s; // current sum
p dq ? ; double p; // current member of series
msg_enter_x db 'Enter x: ', 13, 10, 0
x_read_fmt db '%lf', 0
;cmd db 'mspaint.exe', 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;section '.bss' readable writeable ; statically-allocated variables that are not explicitly initialized to any value
; readBuf db ?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
section '.idata' import data readable
library msvcrt,'MSVCRT.DLL',\
kernel,'KERNEL32.DLL'
import kernel,\
ExitProcess, 'ExitProcess'
;SetConsoleTitleA, 'SetConsoleTitleA',\
;GetStdHandle, 'GetStdHandle',\
;WriteConsoleA, 'WriteConsoleA',\
;ReadConsoleA, 'ReadConsoleA'
import msvcrt,\
puts,'puts',\
scanf,'scanf',\
printf,'printf',\
getchar,'getchar',\
system,'system',\
exit,'exit' |
oeis/130/A130064.asm | neoneye/loda-programs | 11 | 6664 | ; A130064: (n / SmallestPrimeFactor(n)) * GreatestPrimeFactor(n).
; Submitted by <NAME>
; 1,2,3,4,5,9,7,8,9,25,11,18,13,49,25,16,17,27,19,50,49,121,23,36,25,169,27,98,29,75,31,32,121,289,49,54,37,361,169,100,41,147,43,242,75,529,47,72,49,125,289,338,53,81,121,196,361,841,59,150,61,961,147,64,169,363,67,578,529,245,71,108,73,1369,125,722,121,507,79,200,81,1681,83,294,289,1849,841,484,89,225,169,1058,961,2209,361,144,97,343,363,250
seq $0,129598 ; a(n) = n * A111089(n).
sub $0,1
seq $0,32742 ; a(1) = 1; for n > 1, a(n) = largest proper divisor of n.
|
examples/debug.adb | ytomino/drake | 33 | 11444 | <gh_stars>10-100
with Ada;
procedure Debug is
pragma Debug (Ada.Debug.Put ("here, we go !"));
begin
null;
end Debug;
|
src/parser/grammars/ErgoForm.g4 | houfu/ergoform | 0 | 2911 | grammar ErgoForm;
import Items, ItemRows;
ergoForm
: items
| itemRows
;
|
Transynther/x86/_processed/AVXALIGN/_ht_zr_/i7-8650U_0xd2_notsx.log_388_351.asm | ljhsiun2/medusa | 9 | 172253 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x18bb0, %r11
sub $60651, %rcx
mov (%r11), %rax
nop
nop
cmp $5042, %r9
lea addresses_UC_ht+0x15a0, %r12
nop
nop
nop
nop
nop
mfence
movl $0x61626364, (%r12)
cmp $49882, %r11
lea addresses_A_ht+0x16214, %rsi
lea addresses_WT_ht+0x16798, %rdi
nop
nop
nop
xor $64801, %r12
mov $30, %rcx
rep movsq
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_WC_ht+0x6be8, %r9
nop
nop
nop
sub %rax, %rax
vmovups (%r9), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %r12
cmp %r12, %r12
lea addresses_D_ht+0x28e8, %rsi
lea addresses_WC_ht+0xb0e8, %rdi
clflush (%rsi)
nop
nop
cmp $4920, %rax
mov $50, %rcx
rep movsl
nop
and $17785, %rsi
lea addresses_D_ht+0x1a68, %rax
nop
inc %rdi
mov $0x6162636465666768, %rbp
movq %rbp, %xmm1
movups %xmm1, (%rax)
nop
nop
dec %rcx
lea addresses_WT_ht+0x1a2e8, %rcx
sub $47650, %rsi
mov (%rcx), %r12
xor %rsi, %rsi
lea addresses_WT_ht+0x178d2, %rsi
lea addresses_WC_ht+0x86e8, %rdi
clflush (%rsi)
nop
add %rax, %rax
mov $108, %rcx
rep movsq
sub $63697, %r9
lea addresses_D_ht+0x10e8e, %rsi
lea addresses_UC_ht+0x159e8, %rdi
and $56242, %rbp
mov $7, %rcx
rep movsq
nop
nop
nop
nop
nop
dec %r12
lea addresses_A_ht+0x34e8, %rsi
lea addresses_UC_ht+0xb9e0, %rdi
nop
nop
nop
nop
xor $21622, %r11
mov $111, %rcx
rep movsl
nop
nop
nop
nop
nop
add %rax, %rax
lea addresses_WC_ht+0x158e8, %rcx
sub $41307, %rsi
mov $0x6162636465666768, %r9
movq %r9, %xmm3
movups %xmm3, (%rcx)
nop
nop
nop
and %r11, %r11
lea addresses_A_ht+0x1d8e8, %rsi
lea addresses_WC_ht+0x10528, %rdi
nop
nop
nop
dec %r9
mov $39, %rcx
rep movsb
nop
cmp $20617, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %rax
push %rdx
push %rsi
// Store
lea addresses_WT+0x6cf6, %r8
nop
nop
nop
nop
nop
add %r13, %r13
mov $0x5152535455565758, %r12
movq %r12, %xmm0
vmovups %ymm0, (%r8)
nop
nop
nop
and $32368, %rax
// Store
lea addresses_WC+0x5ba8, %rsi
nop
nop
nop
nop
sub %rdx, %rdx
movb $0x51, (%rsi)
inc %r12
// Faulty Load
lea addresses_US+0x118e8, %rsi
nop
nop
nop
add %r12, %r12
movaps (%rsi), %xmm5
vpextrq $1, %xmm5, %r8
lea oracles, %r12
and $0xff, %r8
shlq $12, %r8
mov (%r12,%r8,1), %r8
pop %rsi
pop %rdx
pop %rax
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}}
{'00': 168, '46': 164, '45': 50, '48': 6}
00 00 00 46 45 46 00 00 46 00 45 00 00 00 45 46 46 00 46 46 46 46 46 46 46 00 45 00 46 00 46 00 00 00 00 45 00 46 00 00 48 46 46 46 00 46 00 00 00 46 45 45 00 00 00 45 45 45 45 45 45 46 00 00 46 00 00 46 48 00 46 46 46 00 00 00 48 00 46 46 46 00 00 46 00 00 00 00 45 46 00 00 00 46 00 00 00 00 00 46 45 00 46 46 00 00 46 46 46 46 45 00 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 00 00 45 46 00 00 00 46 46 46 46 46 46 46 46 00 00 46 00 46 46 46 46 46 00 00 00 46 00 46 00 00 46 46 46 46 46 00 45 00 45 46 46 46 00 00 46 00 46 00 46 46 00 00 00 00 00 46 46 46 48 46 00 45 00 46 46 46 46 00 00 46 46 46 46 46 00 00 45 46 46 45 45 45 46 45 45 00 45 00 46 00 00 00 00 46 00 46 45 00 00 00 00 46 00 00 00 00 46 45 00 46 46 00 00 46 46 46 46 46 46 46 46 46 00 46 00 00 00 46 46 00 00 00 45 00 46 00 00 46 45 45 46 00 00 45 45 46 00 00 00 45 46 00 46 46 46 00 00 46 46 00 46 00 00 46 46 00 46 00 48 46 46 46 00 46 45 00 00 00 45 45 00 46 00 00 48 46 45 45 00 00 00 00 00 45 46 00 00 00 00 00 00 00 46 46 46 46 46 00 46 46 46 45 00 00 46 00 46 45 46 00 46 46 00 00 46 45 46 00 00 00 45 46 45 00 00 45 46 00 00 46 46 46 00 46 45 46 45 00 45 00 00 00 00 46 46 00 00 46 00
*/
|
src/vms_cobol/parser/cobol.g4 | GitMensch/vms-ide | 5 | 5377 | <reponame>GitMensch/vms-ide<gh_stars>1-10
// It is obligatory that CharStream must have this function:
// calculateTabBasedCharPositionInLine(index: number, tabSize: number)
grammar cobol;
options { tokenVocab = cobolLexer; }
cobol_source
: replace_statement*
program* EOF
;
program
: identification_division
environment_division?
data_division?
procedure_division?
program*
end_program?
;
identification_division
: identification_division_header
program_id
author?
installation?
date_written?
date_compiled?
security?
options_?
;
identification_division_header
: //{this.inputStream.LT(1).charPositionInLine < 4}?
IDENTIFICATION DIVISION DOT_ replace_statement*
;
environment_division
: environment_division_header
configuration_section?
input_output_section?
;
environment_division_header
: ENVIRONMENT DIVISION DOT_ replace_statement*
;
data_division
: data_division_header
file_section?
working_storage_section?
linkage_section?
report_section?
screen_section?
;
data_division_header
: DATA DIVISION DOT_ replace_statement*
;
procedure_division
: procedure_division_header
declaratives?
(section*|paragraph*)
;
// word_in_area_A
// : {this.inputStream.LT(1).charPositionInLine < 4}? .
// ;
word_in_area_B
: { (this as any).testCurrentWordInAreaB ? (this as any).testCurrentWordInAreaB() as boolean : false }? .
;
author
: author_header
word_in_area_B*
replace_statement*
;
author_header
: AUTHOR DOT_
;
figurative_constant_witout_all_zero
: SPACE
| SPACES
| HIGH_VALUE
| HIGH_VALUES
| LOW_VALUE
| LOW_VALUES
| QUOTE
| QUOTES
;
figurative_constant_zero
: ZERO
| ZEROS
| ZEROES
;
figurative_constant_witout_all
: figurative_constant_witout_all_zero
| figurative_constant_zero
;
figurative_constant_witout_zero
: figurative_constant_witout_all_zero
| ALL STRING_LITERAL_
;
figurative_constant
: figurative_constant_witout_zero
| figurative_constant_zero
;
end_program
: end_program_header
program_name DOT_ replace_statement*
;
end_program_header
: //{this.inputStream.LT(1).charPositionInLine < 4}?
END PROGRAM
;
procedure_division_header
: procedure_division_header_start
using? giving?
procedure_division_header_end
;
procedure_division_header_start
: PROCEDURE DIVISION
;
procedure_division_header_end
: DOT_ replace_statement*
;
section
: section_header
paragraph*
;
declaratives
: declaratives_header
declaratives_section*
end_declaratives
;
declaratives_header
: //{this.inputStream.LT(1).charPositionInLine < 4}?
DECLARATIVES DOT_ replace_statement*
;
end_declaratives
: //{this.inputStream.LT(1).charPositionInLine < 4}?
END DECLARATIVES DOT_ replace_statement*
;
declaratives_section
: section_header
use_statement
paragraph*
;
paragraph
: //{this.inputStream.LT(1).charPositionInLine < 4}?
paragraph_name DOT_ replace_statement*
((statement | exec_sql_statement)+ DOT_ replace_statement*)*
;
paragraph_name
: USER_DEFINED_WORD_
| INTEGER_LITERAL_
;
use_statement
: USE GLOBAL?
(AFTER STANDARD? (EXCEPTION|ERROR) PROCEDURE ON? use_on
|BEFORE REPORTING group_data_name)
DOT_ replace_statement*
;
group_data_name
: qualified_data_item
;
use_on
: file_name+
| INPUT
| OUTPUT
| I_O
| EXTEND
;
section_header
: //{this.inputStream.LT(1).charPositionInLine < 4}?
section_name SECTION segment_number? DOT_ replace_statement*
;
section_name
: USER_DEFINED_WORD_
| INTEGER_LITERAL_
;
using
: USING qualified_data_item+
;
giving
: GIVING qualified_data_item
;
statement
: //{this.inputStream.LT(1).charPositionInLine >= 4}?
( accept_statement
| add_statement
| alter_statement
| call_statement
| cancel_statement
| close_statement
| compute_statement
| continue_statement
| delete_statement
| display_statement
| divide_statement
| evaluate_statement
| exit_statement
| exit_program_statement
| generate_statement
| go_to_statement
| if_statement
| initialize_statement
| initiate_statement
| inspect_statement
| merge_statement
| move_statement
| multiply_statement
| open_statement
| perform_statement
| read_statement
| release_statement
| return_statement
| rewrite_statement
| search_statement
| set_statement
| sort_statement
| start_statement
| stop_statement
| string_statement
| subtract_statement
| suppress_statement
| terminate_statement
| unlock_statement
| unstring_statement
| write_statement
| record_statement
)
;
exec_sql_statement
: EXEC SQL (~END_EXEC)* END_EXEC DOT_?
;
record_name
: USER_DEFINED_WORD_
| STRING_LITERAL_
;
library_name
: USER_DEFINED_WORD_
| STRING_LITERAL_
;
text_name
: USER_DEFINED_WORD_
| STRING_LITERAL_
;
replace_statement
: REPLACE OFF DOT_
| REPLACE (PSEUDO_TEXT_ BY PSEUDO_TEXT_)+ DOT_
;
write_statement
: WRITE rec_name (FROM src_item)?
(ALLOWING NO OTHERS?)?
(invalid_key_variants
|((BEFORE|AFTER) ADVANCING? advance_value)?
at_eop_variants
|(BEFORE|AFTER) ADVANCING? advance_value
(at_eop_variants)?
)?
END_WRITE?
;
advance_value
: advance_num (LINE|LINES)?
| top_of_page_name
| PAGE
;
advance_num
: identifier
| (INTEGER_LITERAL_|HEX_LITERAL_)
;
unstring_statement
: UNSTRING unstring_src
(DELIMITED BY? unstring_delim_clause (OR unstring_delim_clause)*)?
INTO unstring_dest_clause+
(WITH? POINTER string_pointer)?
(TALLYING IN? unstring_tally_ctr)?
on_overflow_variants?
END_UNSTRING?
;
unstring_tally_ctr
: identifier_result
;
unstring_dest_clause
: dest_string (DELIMITER IN? delim_dest)? (COUNT IN? countr)?
;
countr
: identifier_result
;
dest_string
: identifier_result
;
delim_dest
: identifier_result
;
unstring_delim_clause
: ALL? unstring_delim
;
unstring_delim
: identifier
| STRING_LITERAL_
| figurative_constant_witout_all
;
unstring_src
: identifier
;
unlock_statement
: UNLOCK file_name (RECORD|RECORDS|ALL RECORDS?)?
;
terminate_statement
: TERMINATE report_name+
;
suppress_statement
: SUPPRESS PRINTING?
;
subtract_statement
: SUBTRACT
( sub_num+ FROM (sub_num GIVING)? (identifier_result ROUNDED?)+
| (CORRESPONDING|CORR) sub_grp FROM sub_grp ROUNDED?
)
on_size_variants?
END_SUBTRACT?
;
sub_grp
: identifier_result
;
sub_num
: (NUMERIC_LITERAL_|INTEGER_LITERAL_|HEX_LITERAL_)
| identifier
;
string_statement
: STRING (string_src+ DELIMITED BY? (SIZE|string_delim))+
INTO string_dest (WITH? POINTER string_pointer)?
on_overflow_variants?
END_STRING?
;
string_pointer
: identifier_result
;
string_dest
: identifier_result
;
string_delim
: string_src
;
string_src
: identifier_result
| STRING_LITERAL_
| figurative_constant
;
stop_statement
: STOP (RUN|stop_disp)
;
stop_disp
: STRING_LITERAL_
| (NUMERIC_LITERAL_|INTEGER_LITERAL_|HEX_LITERAL_)
| figurative_constant_witout_all
;
start_statement
: START file_name
(KEY condition_operator sort_key_data)?
regard_allow?
invalid_key_variants?
END_START?
;
sort_key_data
: qualified_data_item
;
sort_statement
: SORT sort_name on_sort_key*
(WITH? DUPLICATES IN? ORDER?)?
(COLLATING? SEQUENCE IS? alpha_name)?
(INPUT procedure_is|USING file_name+)?
(OUTPUT procedure_is|GIVING file_name+)?
;
sort_name
: qualified_data_item // file_name or table_name depends on clauses
;
procedure_is
: PROCEDURE IS? proc_thru_proc
;
on_sort_key
: ON? (DESCENDING|ASCENDING) KEY? sort_key sort_key*
;
sort_key
: qualified_data_item
;
set_statement
: set_statement_form1
| set_statement_form2
| set_statement_form3
| set_statement_form4
| set_statement_form5
| set_statement_form6
;
set_statement_form1
: SET identifier_result+ TO set_val
;
set_statement_form2
: SET identifier_result+ (UP|DOWN) BY set_increm
;
set_statement_form3
: SET identifier_result+ TO TRUE
;
set_statement_form4
: SET (identifier_result TO (ON|OFF))+
;
set_statement_form5
: SET identifier_result+ TO REFERENCE OF? identifier_result
;
set_statement_form6
: SET identifier_result TO (SUCCESS|FAILURE)
;
set_increm
: identifier
| (NUMERIC_LITERAL_|INTEGER_LITERAL_|HEX_LITERAL_)
;
set_val
: identifier
| (NUMERIC_LITERAL_|INTEGER_LITERAL_|HEX_LITERAL_)
;
search_statement
: SEARCH src_table (VARYING search_pointer)?
at_end?
((WHEN logic_expression (statement | exec_sql_statement)+)+ END_SEARCH
|(WHEN logic_expression ((statement | exec_sql_statement)+ END_SEARCH?|NEXT SENTENCE))+
)
| SEARCH ALL src_table
at_end?
WHEN search_condition
(AND search_condition)*
((statement | exec_sql_statement)+ END_SEARCH?|NEXT SENTENCE)
;
search_condition
: search_elemnt (IS? EQUAL TO?|IS? EQUAL_) search_arg
| condition_name
;
search_arg
: arithmetic_expression
;
search_elemnt
: identifier_result
;
search_pointer
: identifier
;
src_table
: qualified_data_item
;
rewrite_statement
: REWRITE rewrite_rec_name (FROM src_item)?
(ALLOWING NO OTHERS?)?
invalid_key_variants?
END_REWRITE?
;
rewrite_rec_name
: qualified_data_item
;
return_statement
: RETURN smrg_file RECORD? (INTO dest_item)?
at_end
(NOT at_end)?
END_RETURN?
;
smrg_file
: USER_DEFINED_WORD_
;
release_statement
: RELEASE release_rec (FROM release_src_area)?
;
release_src_area
: identifier
;
release_rec
: qualified_data_item
;
record_statement
: RECORD DEPENDENCY path_name
(TYPE IS? relation_type)?
(IN? DICTIONARY)?
;
relation_type
: USER_DEFINED_WORD_
| STRING_LITERAL_
;
path_name
: USER_DEFINED_WORD_
| STRING_LITERAL_
;
read_statement
: READ file_name (NEXT|PREVIOUS|PRIOR)? RECORD? (INTO dest_item)?
(read_options (KEY IS? key_name)?
| KEY IS? key_name read_options?
)?
(at_end_variants|invalid_key_variants)?
END_READ?
;
regard_allow
: REGARDLESS OF? LOCK?
| ALLOWING (UPDATERS|READERS|NO OTHERS?)
;
read_options
: WITH? NO? LOCK
| regard_allow
;
perform_statement
: PERFORM proc_thru_proc?
(
( perform_times
| perform_until
| perform_varying
)
)?
(statement+ END_PERFORM)?
;
proc_thru_proc
: proc_name ((THROUGH|THRU) proc_name)?
;
perform_times
: (identifier|(INTEGER_LITERAL_|HEX_LITERAL_)) TIMES
;
with_test
: WITH? TEST (BEFORE|AFTER)
;
perform_until
: with_test? UNTIL logic_expression
;
perform_varying
: with_test?
VARYING perform_range UNTIL logic_expression
(AFTER perform_range UNTIL logic_expression)*
;
perform_range
: perform_var FROM perform_init BY perform_increm
;
perform_increm
: identifier
| (NUMERIC_LITERAL_|INTEGER_LITERAL_|HEX_LITERAL_)
;
perform_init
: identifier
| (NUMERIC_LITERAL_|INTEGER_LITERAL_|HEX_LITERAL_)
;
perform_var
: identifier_result
;
open_statement
: OPEN open_definition+
| OPEN ((OUTPUT|EXTEND) (file_name (WITH? NO REWIND)?)+)+
;
open_definition
: (INPUT|OUTPUT|EXTEND|I_O) (file_name (WITH? NO REWIND)? open_file_attributes?)+
;
open_file_attributes
: WITH? LOCK
| ALLOWING
(NO OTHERS?
|ALL
|( READERS WRITERS? UPDATERS?
| READERS UPDATERS WRITERS
| WRITERS READERS? UPDATERS?
| WRITERS UPDATERS READERS
| UPDATERS READERS? WRITERS?
| UPDATERS WRITERS READERS
)
)
;
multiply_statement
: MULTIPLY mult_num BY (mult_num GIVING)? (identifier_result ROUNDED?)+
on_size_variants?
END_MULTIPLY?
;
mult_num
: identifier
| (NUMERIC_LITERAL_|INTEGER_LITERAL_|HEX_LITERAL_)
;
merge_statement
: MERGE mergefile merge_on+
(COLLATING? SEQUENCE IS? alpha_name)?
USING infile+
(output_proc|giving_file)
;
output_proc
: OUTPUT PROCEDURE IS? proc_thru_proc
;
first_proc
: qualified_data_item
;
end_proc
: qualified_data_item
;
giving_file
: GIVING file_name
;
infile
: USER_DEFINED_WORD_
;
merge_on
: ON? (DESCENDING|ASCENDING) KEY? mergekey+
;
mergefile
: USER_DEFINED_WORD_
;
mergekey
: qualified_data_item
;
inspect_statement
: INSPECT src_string
(inspect_tallying inspect_replacing?|inspect_replacing|inspect_converting)
;
inspect_converting
: CONVERTING compare_chars TO convert_chars delim_definition*
;
convert_chars
: compare_val
;
compare_chars
: compare_val
;
inspect_replacing
: REPLACING (replacing_characters|replacing_all)+
;
replacing_all
: (ALL|LEADING|FIRST) (compare_val BY replace_val delim_definition*)+
;
replace_val
: compare_val
;
replacing_characters
: CHARACTERS BY replace_char delim_definition*
;
replace_char
: compare_val
;
inspect_tallying
: TALLYING tallying_for+
;
tallying_for
: tally_ctr FOR (tallying_for_characters|tallying_for_all)+
;
tallying_for_characters
: CHARACTERS delim_definition*
;
delim_definition
: (BEFORE|AFTER) INITIAL? delim_val
;
tallying_for_all
: (ALL|LEADING) (compare_val delim_definition*)+
;
compare_val
: identifier_result
| STRING_LITERAL_
| figurative_constant_witout_all
;
delim_val
: compare_val
;
tally_ctr
: identifier_result
;
src_string
: identifier
;
initiate_statement
: INITIATE ( report_name)+
;
initialize_statement
: INITIALIZE fld_name+ replacing*
;
replacing
: REPLACING
((ALPHABETIC|ALPHANUMERIC|NUMERIC|ALPHANUMERIC_EDITED|NUMERIC_EDITED) DATA? BY init_value)+
;
init_value
: qualified_data_item
| constant
;
fld_name
: qualified_data_item
;
move_statement
: MOVE (CORRESPONDING|CORR)? src_item TO dest_item+
;
if_statement
: IF logic_expression THEN? ((statement | exec_sql_statement)+|NEXT SENTENCE)
(ELSE ((statement | exec_sql_statement)+|NEXT SENTENCE))?
END_IF?
;
generate_statement
: GENERATE report_item
;
report_item
: qualified_data_item
;
exit_statement
: EXIT
;
exit_program_statement
: EXIT PROGRAM
;
go_to_statement
: GO TO? proc_name?
| GO TO? proc_name+ DEPENDING ON? identifier_result
;
proc_name
: qualified_data_item
;
evaluate_statement
: EVALUATE subj_item (ALSO? subj_item)*
(WHEN when_condition (ALSO? when_condition)* (statement | exec_sql_statement)*)+
(WHEN OTHER (statement | exec_sql_statement)*)?
END_EVALUATE?
;
when_condition
: logic_expression
| NOT? arithmetic_expression ((THROUGH|THRU) arithmetic_expression)?
| ANY
| TRUE
| FALSE
;
subj_item
: arithmetic_expression
| logic_expression
| TRUE
| FALSE
;
divide_statement
: divide_statement_form1
| divide_statement_form2
;
divide_statement_form1
: DIVIDE divide_num (INTO|BY) (divide_num GIVING)? (identifier_result ROUNDED?)+
on_size_variants?
END_DIVIDE?
;
divide_statement_form2
: DIVIDE divide_num (INTO|BY) (divide_num GIVING)? identifier_result ROUNDED?
REMAINDER remaind
on_size_variants?
END_DIVIDE?
;
remaind
: identifier_result
;
divide_num
: identifier
| (NUMERIC_LITERAL_|INTEGER_LITERAL_|HEX_LITERAL_)
;
display_statement
: display_statement_form1
| display_statement_form2
| display_statement_form3
| display_statement_form4
;
display_statement_form1
: DISPLAY (src_item display_form1_clause*)+
END_DISPLAY?
;
display_statement_form2
: DISPLAY (src_item display_form2_clause*)+
END_DISPLAY?
;
display_statement_form3
: DISPLAY identifier_result (AT? (disp_f3_line disp_f3_column?|disp_f3_column disp_f3_line?))?
END_DISPLAY?
;
display_statement_form4
: DISPLAY src_item upon_dest
on_exception_variants?
END_DISPLAY?
;
src_item
: identifier
| constant
;
disp_f3_line
: LINE NUMBER? (identifier|(INTEGER_LITERAL_|HEX_LITERAL_))
;
disp_f3_column
: COLUMN NUMBER? (identifier|(INTEGER_LITERAL_|HEX_LITERAL_))
;
display_form1_clause
: with_conversion
| upon_dest
| with_no_advancing
;
upon_dest
: UPON out_dest
;
with_conversion
: WITH? CONVERSION
;
with_no_advancing
: WITH? NO ADVANCING?
;
display_form2_clause
: display_form1_clause
| at_line_number
| at_column_number
| erase_to
| with_bell
| underlined
| bold
| with_blinking
| reversed
| with_conversion
| with_no_advancing
;
reversed
: REVERSED
;
with_blinking
: WITH? BLINKING
;
bold
: BOLD
;
with_bell
: WITH? BELL
;
underlined
: UNDERLINED
;
erase_to
: ERASE (TO? END OF?)? (SCREEN|LINE)
;
at_line_number
: AT? LINE NUMBER? number_value
;
at_column_number
: AT? COLUMN NUMBER? number_value
;
out_dest
: USER_DEFINED_WORD_
;
delete_statement
: DELETE file_name RECORD?
invalid_key_variants?
END_DELETE?
;
continue_statement
: CONTINUE
;
compute_statement
: COMPUTE (identifier_result ROUNDED?)+ (EQUAL|EQUAL_) arithmetic_expression
on_size_variants?
END_COMPUTE?
;
close_statement
: CLOSE (file_name close_params?)+
;
close_params
: (REEL|UNIT) (FOR? REMOVAL|WITH? NO REWIND)?
| WITH? (NO REWIND|LOCK)
;
cancel_statement
: CANCEL prog_name+
;
call_statement
: CALL prog_name
call_using?
call_giving?
on_exception_variants?
END_CALL?
;
call_giving
: GIVING identifier_result
;
call_using
: USING using_arg+
;
using_arg
: OMITTED
| using_prefix? argument+
;
using_prefix
: BY? REFERENCE
| BY? CONTENT
| BY? DESCRIPTOR
| BY? VALUE
;
argument
: identifier_result
| (INTEGER_LITERAL_|HEX_LITERAL_)
| STRING_LITERAL_
;
prog_name
: identifier_result
| STRING_LITERAL_
;
alter_statement
: ALTER (proc_name TO (PROCEED TO)? proc_name )+
;
add_statement
: ( ADD add_num+ TO (identifier_result ROUNDED?)+
| ADD add_num* TO? add_num+ GIVING (identifier_result ROUNDED?)+
| ADD (CORR|CORRESPONDING) add_grp TO add_grp ROUNDED?
)
on_size_variants?
END_ADD?
;
add_grp
: identifier_result
;
add_num
: (NUMERIC_LITERAL_|INTEGER_LITERAL_|HEX_LITERAL_)
| identifier
;
accept_statement
: accept_form1
| accept_form2
| accept_form3
| accept_form4
| accept_form5
| accept_form6
;
on_exception_variants
: on_exception (NOT on_exception)?
| NOT on_exception on_exception?
;
at_end_variants
: at_end (NOT at_end)?
| NOT at_end at_end?
;
on_size_variants
: on_size (NOT on_size)?
| NOT on_size on_size?
;
on_overflow_variants
: on_overflow (NOT on_overflow)?
| NOT on_overflow on_overflow?
;
at_eop_variants
: at_eop (NOT at_eop)?
| NOT at_eop at_eop?
;
invalid_key_variants
: invalid_key (NOT invalid_key)?
| NOT invalid_key invalid_key?
;
accept_form6
: ACCEPT dest_item FROM? arg_env_accept
on_exception_variants?
END_ACCEPT?
;
arg_env_accept
: USER_DEFINED_WORD_
;
accept_form1
: ACCEPT dest_item (FROM input_source)? (WITH CONVERSION)?
at_end_variants?
END_ACCEPT?
;
accept_form2
: ACCEPT dest_item FROM date_time
;
accept_form3
: ACCEPT dest_item
accept_form3_clause+
(on_exception_variants|at_end_variants)?
END_ACCEPT?
;
accept_form4
: ACCEPT CONTROL? KEY IN? key_dest_item
accept_form4_clause+
(on_exception_variants|at_end_variants)?
END_ACCEPT?
;
accept_form5
: ACCEPT data_name
accept_at?
on_exception_variants?
END_ACCEPT?
;
accept_at
: AT? (accept_at_line accept_at_column?|accept_at_column accept_at_line?)
;
accept_at_line
: LINE NUMBER? ((INTEGER_LITERAL_|HEX_LITERAL_)|identifier)
;
accept_at_column
: COLUMN NUMBER? ((INTEGER_LITERAL_|HEX_LITERAL_)|identifier)
;
accept_form4_clause
: from_line_number
| from_column_number
| erase_to
| with_bell
;
from_column_number
: FROM? COLUMN NUMBER? number_value
;
from_line_number
: FROM? LINE NUMBER? number_value
;
accept_form3_clause
: accept_form4_clause
| underlined
| bold
| with_blinking
| protected_clause
| with_conversion
| reversed
| with_no_echo
| default_is
| control_key_in
;
protected_clause
: PROTECTED protected_value*
;
control_key_in
: CONTROL? KEY IN? key_dest_item
;
default_is
: DEFAULT IS? def_value
;
with_no_echo
: WITH? NO ECHO
;
key_dest_item
: identifier
;
def_value
: figurative_constant
| STRING_LITERAL_
| identifier
| CURRENT VALUE?
;
protected_value
: SIZE prot_size_value
| WITH? AUTOTERMINATE
| WITH? NO BLANK
| WITH? EDITING
| WITH? FILLER prot_fill_lit
;
prot_fill_lit
: STRING_LITERAL_
;
prot_size_value
: (INTEGER_LITERAL_|HEX_LITERAL_)
| identifier
;
number_value
: line_num
| identifier (PLUS line_num?)?
| PLUS line_num?
;
date_time
: DATE YYYYMMDD?
| DAY YYYYDDD?
| DAY_OF_WEEK
| TIME
;
dest_item
: identifier_result
;
input_source
: USER_DEFINED_WORD_
;
at_end
: AT? END (statement | exec_sql_statement)*
;
on_exception
: ON? EXCEPTION (statement | exec_sql_statement)*
;
on_size
: ON? SIZE ERROR (statement | exec_sql_statement)*
;
on_overflow
: ON? OVERFLOW (statement | exec_sql_statement)*
;
at_eop
: AT? (END_OF_PAGE|EOP) (statement | exec_sql_statement)*
;
invalid_key
: INVALID KEY? (statement | exec_sql_statement)*
;
file_section
: FILE SECTION DOT_ replace_statement*
(file_description|sort_merge_file_description)*
;
file_description
: file_description_entry data_description_entry*
;
sort_merge_file_description
: sort_merge_file_description_entry data_description_entry*
;
working_storage_section
: WORKING_STORAGE SECTION DOT_ replace_statement*
working_storage_entry*
;
working_storage_entry
: data_description_entry
| exec_sql_statement
;
linkage_section
: LINKAGE SECTION DOT_ replace_statement*
data_description_entry*
;
report_section
: REPORT SECTION DOT_ replace_statement*
report_description*
;
report_description
: report_description_entry report_group_data_description_entry*
;
screen_section
: SCREEN SECTION DOT_ replace_statement*
screen_description_entry*
;
file_description_entry
: FD file_name
fd_clause*
DOT_ replace_statement*
;
sort_merge_file_description_entry
: SD file_name
sd_clause*
DOT_ replace_statement*
;
report_description_entry
: RD report_name
rd_clause*
DOT_ replace_statement*
;
fd_clause
: is_external
| is_global
| block_contains
| record
| label
| value_of_id
| data_rec
| linage
| report_is
| code_set
| access_mode
| record_key
| alt_record_key
| file_status
;
is_external
: IS? EXTERNAL
;
is_global
: IS? GLOBAL
;
data_description_entry
: level_number (data_name|FILLER)?
(REDEFINES other_data_item)?
data_description_clause*
DOT_ replace_statement*
;
level_number
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
data_description_clause
: is_external
| is_global
| picture
| usage
| sign_is
| occurs
| synchronized_lr
| justified
| black_when_zero
| value_is
| renames
;
synchronized_lr
: (SYNCHRONIZED|SYNC) (LEFT|RIGHT)?
;
justified
: (JUSTIFIED|JUST) RIGHT?
;
black_when_zero
: BLANK WHEN? ZERO
;
renames
: RENAMES rename_start ((THRU|THROUGH) rename_end)?
;
rename_start
: qualified_data_item
;
rename_end
: qualified_data_item
;
value_is
: (VALUE IS?|VALUES ARE?) value_is_definition+
;
value_is_definition
: value_is_definition_part value_is_definition_thru?
;
value_is_definition_part
: value_is_literal
| REFERENCE ref_data_name
| EXTERNAL external_name
;
value_is_definition_thru
: (THRU|THROUGH) value_is_definition_part
;
external_name
: USER_DEFINED_WORD_
;
ref_data_name
: identifier_result
;
value_is_literal
: STRING_LITERAL_
| (NUMERIC_LITERAL_|INTEGER_LITERAL_|HEX_LITERAL_)
| figurative_constant
| USER_DEFINED_WORD_
;
occurs
: OCCURS times_definition key_is* indexed_by?
;
indexed_by
: INDEXED BY? ind_name+
;
ind_name
: USER_DEFINED_WORD_
;
key_is
: (ASCENDING|DESCENDING) KEY? IS? key_name+
;
key_name
: qualified_data_item
;
times_definition
: table_size TIMES?
| min_times TO max_times TIMES? DEPENDING ON? depending_item
;
table_size
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
min_times
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
max_times
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
report_group_data_description_entry
: level_number data_name?
report_group_data_description_clause*
DOT_ replace_statement*
;
report_group_data_description_clause
: rep_line_num
| rep_next_group
| rep_type
| usage_display
| black_when_zero
| rep_column
| rep_group_ind
| justified
| picture
| sign_is
| rep_source_sum_or_value
;
rep_source_sum_or_value
: rep_source
| rep_sum
| rep_value_is
;
rep_value_is
: VALUE IS? value_is_literal
;
rep_source
: SOURCE IS? source_name
;
rep_group_ind
: GROUP INDICATE?
;
rep_column
: COLUMN NUMBER? IS? column_number
;
usage_display
: (USAGE IS?)? DISPLAY
;
rep_type
: TYPE IS? type_is_definition
;
rep_next_group
: NEXT GROUP IS? next_group_definition
;
rep_line_num
: LINE NUMBER? IS? line_num_definition
;
sign_is
: (SIGN IS?)? (LEADING|TRAILING) (SEPARATE CHARACTER?)?
;
rep_sum
: (SUM sum_name+ UPON? detail_report_group_name*)+
(RESET ON? control_foot_name)?
;
control_foot_name
: USER_DEFINED_WORD_
| FINAL
;
detail_report_group_name
: USER_DEFINED_WORD_
;
sum_name
: USER_DEFINED_WORD_
;
source_name
: qualified_data_item
;
column_number
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
type_is_definition
: rep_type_rh
| rep_type_ph
| rep_type_ch
| rep_type_de
| rep_type_cf
| rep_type_pf
| rep_type_rf
;
rep_type_pf
: PAGE FOOTING
| PF
;
rep_type_rf
: REPORT FOOTING
| RF
;
rep_type_de
: DETAIL
| DE
;
rep_type_ch
: (CONTROL HEADING | CH) type_control_name
;
rep_type_cf
: (CONTROL FOOTING | CF) type_control_name
;
rep_type_rh
: REPORT HEADING
| RH
;
rep_type_ph
: PAGE HEADING
| PH
;
type_control_name
: USER_DEFINED_WORD_
| FINAL
;
next_group_definition
: line_num
| PLUS line_num
| NEXT PAGE
;
line_num_definition
: line_num (ON? NEXT PAGE)?
| PLUS line_num
;
line_num
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
rd_clause
: is_global
| report_code
| report_control
| report_page
;
report_page
: PAGE
(LIMIT IS?|LIMITS ARE?)? page_size_rd (LINE|LINES)?
(HEADING heading_line)?
(FIRST DETAIL first_detail_line)?
(LAST DETAIL last_detail_line)?
(FOOTING footing_line_rd)?
;
report_control
: (CONTROL IS?|CONTROLS ARE?) (control_name+|FINAL control_name*)
;
report_code
: CODE STRING_LITERAL_
;
footing_line_rd
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
last_detail_line
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
first_detail_line
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
heading_line
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
page_size_rd
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
control_name
: qualified_data_item
;
usage
: (USAGE IS?)? usage_definition
;
usage_definition
: BINARY
| BINARY_CHAR (SIGNED|UNSIGNED)?
| BINARY_SHORT (SIGNED|UNSIGNED)?
| BINARY_LONG (SIGNED|UNSIGNED)?
| BINARY_DOUBLE (SIGNED|UNSIGNED)?
| COMPUTATIONAL
| COMPUTATIONAL_1
| COMPUTATIONAL_2
| COMPUTATIONAL_3
| COMPUTATIONAL_4
| COMPUTATIONAL_5
| COMPUTATIONAL_X
| COMP
| COMP_1
| COMP_2
| COMP_3
| COMP_4
| COMP_5
| COMP_X
| DISPLAY
| FLOAT_SHORT
| FLOAT_LONG
| FLOAT_EXTENDED
| INDEX
| PACKED_DECIMAL
| POINTER
| POINTER_64
;
picture
: (PICTURE|PIC) (IS|IS_IN_PICTURE_)? character_string
;
character_string
: CHARACTER_STRING_
;
other_data_item
: USER_DEFINED_WORD_
;
data_name
: USER_DEFINED_WORD_
;
sd_clause
: record
| data_rec
;
report_is
: (REPORT IS?|REPORTS ARE?) report_name+
;
report_name
: USER_DEFINED_WORD_
;
linage
: LINAGE IS? page_size LINES?
(WITH? FOOTING AT? footing_line)?
(LINES? AT? TOP top_lines)?
(LINES? AT? BOTTOM bottom_lines)?
;
bottom_lines
: (INTEGER_LITERAL_|HEX_LITERAL_)
| identifier_result
;
top_lines
: (INTEGER_LITERAL_|HEX_LITERAL_)
| identifier_result
;
footing_line
: (INTEGER_LITERAL_|HEX_LITERAL_)
| identifier_result
;
page_size
: (INTEGER_LITERAL_|HEX_LITERAL_)
| identifier_result
;
data_rec
: DATA (RECORDS ARE?|RECORD IS?) rec_name+
;
rec_name
: USER_DEFINED_WORD_
;
value_of_id
: VALUE OF (ID|FILE_ID) IS? value_of_id_definition
;
value_of_id_definition
: STRING_LITERAL_
| qualified_data_item
;
label
: LABEL (RECORDS ARE?|RECORD IS?) (STANDARD|OMITTED)
;
record
: RECORD record_definition
;
record_definition
: CONTAINS?
(shortest_rec TO)?
longest_rec CHARACTERS?
| IS? VARYING IN? SIZE?
(FROM? shortest_rec)? (TO longest_rec)? CHARACTERS?
(DEPENDING ON? depending_item)?
;
depending_item
: qualified_data_item
;
shortest_rec
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
longest_rec
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
screen_description_entry
: level_number (data_name | FILLER)?
screen_description_clause*
DOT_ replace_statement*
;
screen_description_clause
: scr_blank
| scr_foreground
| scr_background
| scr_auto
| scr_secure
| scr_required
| usage_display
| sign_is
| scr_full
| scr_bell
| scr_blink
| scr_erase
| scr_light
| scr_reverse
| scr_underline
| scr_line
| scr_column
| scr_value
| black_when_zero
| justified
| scr_picture
;
scr_light
: scr_highlight
| scr_lowlight
;
scr_picture
: picture (scr_pic_using|scr_pic_from scr_pic_to?|scr_pic_to)
;
scr_value
: VALUE IS? nonnumeric_literal
;
scr_column
: COLUMN NUMBER? IS? PLUS? src_number
;
scr_line
: LINE NUMBER? IS? PLUS? src_number
;
scr_underline
: UNDERLINE
;
scr_reverse
: REVERSE_VIDEO
;
scr_lowlight
: LOWLIGHT
;
scr_highlight
: HIGHLIGHT
;
scr_erase
: ERASE (EOL|EOS)
;
scr_blink
: BLINK
;
scr_bell
: BELL
;
scr_full
: FULL
;
scr_required
: REQUIRED
;
scr_secure
: SECURE
;
scr_auto
: AUTO
;
scr_background
: BACKGROUND_COLOR IS? color_num
;
scr_foreground
: FOREGROUND_COLOR IS? color_num
;
scr_blank
: BLANK (SCREEN|LINE)
;
scr_pic_using
: USING identifier_result
;
scr_pic_from
: FROM (identifier_result|nonnumeric_literal)
;
scr_pic_to
: TO identifier_result
;
nonnumeric_literal
: STRING_LITERAL_
;
src_number
: identifier_result
| (INTEGER_LITERAL_|HEX_LITERAL_)
;
color_num
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
// program id
program_id
: PROGRAM_ID DOT_ replace_statement*
program_name
common_initial?
with_ident?
DOT_ replace_statement*
;
program_name
: USER_DEFINED_WORD_
;
common_initial
: IS? (COMMON INITIAL?|INITIAL COMMON?) PROGRAM?
;
with_ident
: WITH? IDENT ident_string
;
ident_string
: STRING_LITERAL_
;
// installation
installation
: INSTALLATION DOT_
word_in_area_B*
replace_statement*
;
// date written
date_written
: DATE_WRITTEN DOT_
word_in_area_B*
replace_statement*
;
// date compiled
date_compiled
: DATE_COMPILED DOT_
word_in_area_B*
replace_statement*
;
// security
security
: SECURITY DOT_
word_in_area_B*
replace_statement*
;
// options (ANTLR reserved word)
options_
: OPTIONS DOT_ replace_statement*
arithmetic?
// DOT_?
;
arithmetic
: ARITHMETIC IS? (NATIVE|STANDARD) DOT_ replace_statement*
;
// ENVIRONMENT DIVISION
configuration_section
: CONFIGURATION SECTION DOT_ replace_statement*
source_computer?
object_computer?
special_names?
;
input_output_section
: INPUT_OUTPUT SECTION DOT_ replace_statement*
file_control?
i_o_control?
;
source_computer
: SOURCE_COMPUTER DOT_ replace_statement*
(computer_type with_debugging? DOT_ replace_statement*)?
;
computer_type
: ALPHA
| I64
| VAX
| USER_DEFINED_WORD_
;
with_debugging
: WITH? DEBUGGING MODE
;
object_computer
: OBJECT_COMPUTER DOT_ replace_statement*
(computer_type memory_size? program_collating? segment_limit? DOT_ replace_statement*)?
;
memory_size
: MEMORY SIZE? memory_size_amount memory_size_unit
;
memory_size_amount
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
memory_size_unit
: WORDS
| CHARACTERS
| MODULES
;
program_collating
: PROGRAM? COLLATING? SEQUENCE IS? alpha_name
;
alpha_name
: USER_DEFINED_WORD_
;
segment_limit
: SEGMENT_LIMIT IS? segment_number
;
segment_number
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
special_names
: SPECIAL_NAMES DOT_ replace_statement*
(special_names_content DOT_ replace_statement*)?
;
special_names_content
: (predefined_name_relation|switch_definition)*
(alphabet)*
(symbolic_chars)*
(class_)*
(currency)*
(DECIMAL_POINT IS? COMMA)?
cursor_is?
crt_is?
;
cursor_is
: CURSOR IS? qualified_data_item
;
crt_is
: CRT STATUS IS? qualified_data_item
;
predefined_name_relation
: predefined_name IS? user_name
;
predefined_name
: CARD_READER
| PAPER_TAPE_READER
| CONSOLE
| LINE_PRINTER
| PAPER_TAPE_PUNCH
| SYSIN
| SYSOUT
| SYSERR
| C01
| ARGUMENT_NUMBER
| ARGUMENT_VALUE
| ENVIRONMENT_NAME
| ENVIRONMENT_VALUE
;
switch_definition
: (SWITCH switch_num|SWITCH_N_)
(IS? switch_name)?
( switch_clause_on switch_clause_off?
| switch_clause_off switch_clause_on?
)?
;
switch_clause_on
: ON STATUS? IS? cond_name
;
switch_clause_off
: OFF STATUS? IS? cond_name
;
cond_name
: USER_DEFINED_WORD_
;
switch_name
: USER_DEFINED_WORD_
;
switch_num
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
qualified_data_item
: USER_DEFINED_WORD_ ((IN|OF) USER_DEFINED_WORD_)*
;
currency
: CURRENCY SIGN? IS? currency_definition
;
currency_definition
: (currency_string WITH? PICTURE (SYMBOL|SYMBOL_IN_PICTURE_))? currency_char
;
currency_string
: STRING_LITERAL_
;
currency_char
: STRING_LITERAL_
;
class_
: CLASS class_name IS? user_class+
;
class_name
: USER_DEFINED_WORD_
;
user_class
: first_literal ((THRU|THROUGH) last_literal)?
;
symbolic_chars
: SYMBOLIC CHARACTERS?
symb_ch_definition+
;
symb_ch_definition
: symb_ch_def_clause+ symb_ch_def_in_alphabet?
;
symb_ch_def_clause
: (symbol_char )+ (ARE|IS)? (char_val )+
;
symb_ch_def_in_alphabet
: IN alpha_name
;
symbol_char
: USER_DEFINED_WORD_
;
char_val
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
alphabet
: ALPHABET alpha_name IS? alpha_value
;
alpha_value
: ASCII
| STANDARD_1
| STANDARD_2
| NATIVE
| EBCDIC
| user_alpha+
;
user_alpha
: first_literal ((THRU|THROUGH) last_literal)?
| first_literal (ALSO same_literal)+
;
first_literal
: STRING_LITERAL_
| (INTEGER_LITERAL_|HEX_LITERAL_)
;
last_literal
: STRING_LITERAL_
| (INTEGER_LITERAL_|HEX_LITERAL_)
;
same_literal
: STRING_LITERAL_
| (INTEGER_LITERAL_|HEX_LITERAL_)
;
top_of_page_name
: USER_DEFINED_WORD_
;
user_name
: USER_DEFINED_WORD_
;
file_control
: FILE_CONTROL DOT_ replace_statement*
select*
;
select
: SELECT OPTIONAL? file_name
select_clause+
DOT_ replace_statement*
;
select_clause
: assign_to
| reserve
| organization
| padding
| record_delimiter
| lock_mode
| block_contains
| code_set
| access_mode
| record_key
| alt_record_key
| file_status
;
file_status
: FILE? STATUS IS? file_stat
;
file_stat
: qualified_data_item
;
record_key
: RECORD KEY? IS? record_key_definition
(WITH? DUPLICATES)?
(ASCENDING|DESCENDING)?
;
alt_record_key
: ALTERNATE RECORD KEY? IS? record_key_definition
(WITH? DUPLICATES)?
(ASCENDING|DESCENDING)?
;
record_key_definition
: rec_key
| seg_key EQUAL_ rec_key+
;
seg_key
: USER_DEFINED_WORD_
;
rec_key
: qualified_data_item
;
access_mode
: (ACCESS MODE? IS?)?
(
SEQUENTIAL
| RANDOM
| DYNAMIC
)
(RELATIVE KEY? IS? qualified_data_item )?
;
reserve
: RESERVE reserve_num (AREA|AREAS)?
;
reserve_num
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
record_delimiter
: RECORD DELIMITER IS? STANDARD_1
;
padding
: PADDING CHARACTER? IS? pad_char
;
pad_char
: STRING_LITERAL_
;
organization
: (ORGANIZATION IS?)?
(
SEQUENTIAL
| LINE SEQUENTIAL
| RELATIVE
| INDEXED
)
;
lock_mode
: LOCK MODE? IS? lock_mode_definition
;
lock_mode_definition
: MANUAL WITH? LOCK ON MULTIPLE RECORDS
| AUTOMATIC (WITH? (LOCK ON RECORD|ROLLBACK))?
| EXCLUSIVE
;
code_set
: CODE_SET IS? alpha_name
;
block_contains
: BLOCK CONTAINS? (smallest_block TO)? blocksize (RECORDS|CHARACTERS)
;
smallest_block
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
blocksize
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
assign_to
: ASSIGN TO? assign_to_definition
;
assign_to_definition
: (EXTERNAL|DYNAMIC)? file_spec
| MULTIPLE? (REEL|UNIT) FILE?
;
file_spec
: STRING_LITERAL_
| qualified_data_item
| DISK
| PRINTER
;
file_name
: USER_DEFINED_WORD_
;
i_o_control
: I_O_CONTROL DOT_ replace_statement*
(i_o_control_clause+ DOT_ replace_statement*)?
;
i_o_control_clause
: apply
| same
| rerun
| multiple_file
;
multiple_file
: MULTIPLE FILE TAPE? CONTAINS? multiple_file_definition+
;
multiple_file_definition
: multiple_file_name (POSITION pos_integer)?
;
multiple_file_name
: USER_DEFINED_WORD_
;
pos_integer
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
rerun
: RERUN (ON file_name)? EVERY? rerun_definition
;
rerun_definition
: rerun_def_file OF? file_name
| clock_count CLOCK_UNITS
| condition_name
;
clock_count
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
condition_name
: USER_DEFINED_WORD_
;
rerun_def_file
: (END OF?)? (REEL|UNIT)
| rec_count RECORDS
;
rec_count
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
same
: SAME (RECORD|SORT|SORT_MERGE)? AREA? FOR? same_area_file same_area_file+
;
same_area_file
: USER_DEFINED_WORD_
;
apply
: APPLY apply_definition+ ON file_name+
;
apply_definition
: DEFERRED_WRITE
| EXTENSION extend_amt
| FILL_SIZE
| LOCK_HOLDING
| MASS_INSERT
| (CONTIGUOUS|CONTIGUOUS_BEST_TRY)? PREALLOCATION preall_amt
| PRINT_CONTROL
| WINDOW window_ptrs
;
window_ptrs
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
preall_amt
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
extend_amt
: (INTEGER_LITERAL_|HEX_LITERAL_)
;
//
arithmetic_expression
: LPAREN_ arithmetic_expression RPAREN_
| arithmetic_expression binary_arithmetic_operator arithmetic_expression
| unary_arithmetic_operator arithmetic_expression
| identifier
| constant
;
constant
: (NUMERIC_LITERAL_|INTEGER_LITERAL_|HEX_LITERAL_)
| STRING_LITERAL_
| figurative_constant
;
binary_arithmetic_operator
: PLUS_
| MINUS_
| STAR_
| SLASH_
| STAR_ STAR_
;
unary_arithmetic_operator
: PLUS_
| MINUS_
;
logic_expression
: LPAREN_ logic_expression RPAREN_
| logic_expression logic_operation logic_expression
| NOT logic_expression
| logic_condition
;
logic_condition
: arithmetic_expression condition_operator arithmetic_expression (logic_operation logic_condition_abbrev)*
| arithmetic_expression IS? NOT? (class_condition_name|sign_condition_name) (logic_operation logic_condition_abbrev)*
| arithmetic_expression IS? NOT? (SUCCESS|FAILURE)
| identifier_result
;
logic_condition_abbrev
: condition_operator? arithmetic_expression
;
logic_operation
: AND
| OR
;
bool_condition_name
: SUCCESS
| FAILURE
;
sign_condition_name
: POSITIVE
| NEGATIVE
| ZERO
;
class_condition_name
: NUMERIC
| ALPHABETIC
| ALPHABETIC_LOWER
| ALPHABETIC_UPPER
| USER_DEFINED_WORD_
;
condition_operator
: IS?
(
NOT?
(
GREATER THAN?
| GT_ THAN?
| LESS THAN?
| LT_ THAN?
| EQUAL TO?
| EQUAL_ TO?
)
| GREATER THAN? OR EQUAL TO?
| GE_
| LESS THAN? OR EQUAL TO?
| LE_
)
;
identifier_result
: qualified_data_item subscripting? reference_modification?
;
identifier
: identifier_result
| FUNCTION function_name arguments? reference_modification?
;
arguments
: subscripting
;
subscripting
: LPAREN_ (arithmetic_expression|ALL)+ RPAREN_
;
reference_modification
: LPAREN_ leftmost_character_position COLON_ length? RPAREN_
;
leftmost_character_position
: arithmetic_expression
;
length
: arithmetic_expression
;
function_name
: USER_DEFINED_WORD_
| RANDOM
;
|
ADL/drivers/stm32h743/stm32-opamp.ads | JCGobbi/Nucleo-STM32H743ZI | 0 | 24243 |
-- This file provides interfaces for the operational amplifiers on the
-- STM32G4 (ARM Cortex M4F) microcontrollers from ST Microelectronics.
private with STM32_SVD.OPAMP;
package STM32.OPAMP is
type Operational_Amplifier is limited private;
procedure Enable (This : in out Operational_Amplifier)
with Post => Enabled (This);
procedure Disable (This : in out Operational_Amplifier)
with Post => not Enabled (This);
function Enabled (This : Operational_Amplifier) return Boolean;
type NI_Input_Mode is (Normal_Mode, Calibration_Mode);
procedure Set_NI_Input_Mode
(This : in out Operational_Amplifier;
Input : NI_Input_Mode)
with Post => Get_NI_Input_Mode (This) = Input;
-- Select a calibration reference voltage on non-inverting input and
-- disables external connections.
function Get_NI_Input_Mode
(This : Operational_Amplifier) return NI_Input_Mode;
-- Return the source connected to the non-inverting input of the
-- operational amplifier.
type NI_Input_Port is (GPIO, Option_2)
with Size => 2;
-- These bits allows to select the source connected to the non-inverting
-- input of the operational amplifier. The first 3 options are common, the
-- last option change for each OPAMP:
-- Option OPAMP1 OPAMP2
-- 2 DAC1_OUT DAC2_OUT
procedure Set_NI_Input_Port
(This : in out Operational_Amplifier;
Input : NI_Input_Port)
with Post => Get_NI_Input_Port (This) = Input;
-- Select the source connected to the non-inverting input of the
-- operational amplifier.
function Get_NI_Input_Port
(This : Operational_Amplifier) return NI_Input_Port;
-- Return the source connected to the non-inverting input of the
-- operational amplifier.
type I_Input_Port is
(INM0,
INM1,
Feedback_Resistor_PGA_Mode,
Follower_Mode);
procedure Set_I_Input_Port
(This : in out Operational_Amplifier;
Input : I_Input_Port)
with Post => Get_I_Input_Port (This) = Input;
-- Select the source connected to the inverting input of the
-- operational amplifier.
function Get_I_Input_Port
(This : Operational_Amplifier) return I_Input_Port;
-- Return the source connected to the inverting input of the
-- operational amplifier.
type PGA_Mode_Gain is
(NI_Gain_2,
NI_Gain_4,
NI_Gain_8,
NI_Gain_16,
NI_Gain_2_Filtering_INM0,
NI_Gain_4_Filtering_INM0,
NI_Gain_8_Filtering_INM0,
NI_Gain_16_Filtering_INM0,
I_Gain_1_NI_Gain_2_INM0,
I_Gain_3_NI_Gain_4_INM0,
I_Gain_7_NI_Gain_8_INM0,
I_Gain_15_NI_Gain_16_INM0,
I_Gain_1_NI_Gain_2_INM0_INM1,
I_Gain_3_NI_Gain_4_INM0_INM1,
I_Gain_7_NI_Gain_8_INM0_INM1,
I_Gain_15_NI_Gain_16_INM0_INM1)
with Size => 4;
-- Gain in PGA mode.
procedure Set_PGA_Mode_Gain
(This : in out Operational_Amplifier;
Input : PGA_Mode_Gain)
with Post => Get_PGA_Mode_Gain (This) = Input;
-- Select the gain in PGA mode.
function Get_PGA_Mode_Gain
(This : Operational_Amplifier) return PGA_Mode_Gain;
-- Return the gain in PGA mode.
type Speed_Mode is (Normal_Mode, HighSpeed_Mode);
procedure Set_Speed_Mode
(This : in out Operational_Amplifier;
Input : Speed_Mode)
with Pre => not Enabled (This),
Post => Get_Speed_Mode (This) = Input;
-- OPAMP in normal or high-speed mode.
function Get_Speed_Mode
(This : Operational_Amplifier) return Speed_Mode;
-- Return the OPAMP speed mode.
type Init_Parameters is record
Input_Minus : I_Input_Port;
Input_Plus : NI_Input_Port;
PGA_Mode : PGA_Mode_Gain;
Power_Mode : Speed_Mode;
end record;
procedure Configure_Opamp
(This : in out Operational_Amplifier;
Param : Init_Parameters);
procedure Set_User_Trimming
(This : in out Operational_Amplifier;
Enabled : Boolean)
with Post => Get_User_Trimming (This) = Enabled;
-- Allows to switch from ‘factory’ AOP offset trimmed values to ‘user’ AOP
-- offset trimmed values.
function Get_User_Trimming
(This : Operational_Amplifier) return Boolean;
-- Return the state of user trimming.
type Differential_Pair is (NMOS, PMOS);
procedure Set_Offset_Trimming
(This : in out Operational_Amplifier;
Pair : Differential_Pair;
Input : UInt5)
with Post => Get_Offset_Trimming (This, Pair) = Input;
-- Select the offset trimming value for NMOS or PMOS.
function Get_Offset_Trimming
(This : Operational_Amplifier;
Pair : Differential_Pair) return UInt5;
-- Return the offset trimming value for NMOS or PMOS.
procedure Set_Calibration_Mode
(This : in out Operational_Amplifier;
Enabled : Boolean)
with Post => Get_Calibration_Mode (This) = Enabled;
-- Select the calibration mode connecting VM and VP to the OPAMP
-- internal reference voltage.
function Get_Calibration_Mode
(This : Operational_Amplifier) return Boolean;
-- Return the calibration mode.
type Calibration_Value is
(VREFOPAMP_Is_3_3_VDDA, -- 3.3%
VREFOPAMP_Is_10_VDDA, -- 10%
VREFOPAMP_Is_50_VDDA, -- 50%
VREFOPAMP_Is_90_VDDA -- 90%
);
-- Offset calibration bus to generate the internal reference voltage.
procedure Set_Calibration_Value
(This : in out Operational_Amplifier;
Input : Calibration_Value)
with Post => Get_Calibration_Value (This) = Input;
-- Select the offset calibration bus used to generate the internal
-- reference voltage when CALON = 1 or FORCE_VP = 1.
function Get_Calibration_Value
(This : Operational_Amplifier) return Calibration_Value;
-- Return the offset calibration bus voltage.
procedure Calibrate (This : in out Operational_Amplifier);
-- Calibrate the NMOS and PMOS differential pair. This routine
-- is described in the RM0440 rev 6 pg. 797. The offset trim time,
-- during calibration, must respect the minimum time needed
-- between two steps to have 1 mV accuracy.
-- This routine must be executed first with normal speed mode, then with
-- high-speed mode, if used.
type Internal_Output is
(Is_Output,
Is_Not_Output);
type Output_Status_Flag is
(NI_Lesser_Then_I,
NI_Greater_Then_I);
function Get_Output_Status_Flag
(This : Operational_Amplifier) return Output_Status_Flag;
-- Return the output status flag when the OPAMP is used as comparator
-- during calibration.
private
-- representation for the whole Operationa Amplifier type -----------------
type Operational_Amplifier is limited record
CSR : STM32_SVD.OPAMP.OPAMP1_CSR_Register;
OTR : STM32_SVD.OPAMP.OPAMP1_OTR_Register;
HSOTR : STM32_SVD.OPAMP.OPAMP1_HSOTR_Register;
end record with Volatile, Size => 3 * 32;
for Operational_Amplifier use record
CSR at 16#00# range 0 .. 31;
OTR at 16#04# range 0 .. 31;
HSOTR at 16#08# range 0 .. 31;
end record;
end STM32.OPAMP;
|
alloy4fun_models/trainstlt/models/8/T8xqwf79AAdrFACqx.als | Kaixi26/org.alloytools.alloy | 0 | 2631 | <gh_stars>0
open main
pred idT8xqwf79AAdrFACqx_prop9 {
always(all t:Train| eventually ( before no t.pos and after ( one t.pos:>Entry)) )
}
pred __repair { idT8xqwf79AAdrFACqx_prop9 }
check __repair { idT8xqwf79AAdrFACqx_prop9 <=> prop9o } |
C/LoDosLib/resetdrv.asm | p-k-p/SysToolsLib | 232 | 176737 | <gh_stars>100-1000
page ,132
;*****************************************************************************;
; ;
; FILE NAME: resetdrv.asm ;
; ;
; DESCRIPTION: Reset a specific DOS drive using the MS-DOS 7 method ;
; ;
; NOTES: ;
; ;
; HISTORY: ;
; 1995/09/05 JFL Created this file. ;
; ;
; (c) Copyright 1995-2017 Hewlett Packard Enterprise Development LP ;
; Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 ;
;*****************************************************************************;
INCLUDE ADEFINE.INC
INCLUDE DOS.INC ; For the DOS call macros
.CODE
;-----------------------------------------------------------------------------;
; ;
; Function: ResetDrive ;
; ;
; Description: Reset a specific DOS drive using the MS-DOS 7 method ;
; ;
; Parameters: AX iDrive Drive number. 0=A, 1=B, 2=C, etc... ;
; DX iFlushFlag 0 = Reset drive and flush buffers ;
; 1 = Idem + invalidate the cache ;
; ;
; Returns: AX MS-DOS error code. 0=Success. ;
; ;
; Notes: ;
; ;
; Regs altered: AX, CX, DX. ;
; ;
; History: ;
; ;
; 1995/09/04 JFL Created this routine ;
; ;
;-----------------------------------------------------------------------------;
CFASTPROC ResetDrive
mov cx, dx ; iFlushFlag
mov dx, ax ; iDrive
inc dx ; Call expects 1-based value
mov ax, 710DH
int 21H
check_error ; Clear AX if no carry
ret
ENDCFASTPROC ResetDrive
END
|
old/Structure/Logic/Classical/SetTheory/ZFC/BinaryRelatorSet.agda | Lolirofle/stuff-in-agda | 6 | 8115 | <filename>old/Structure/Logic/Classical/SetTheory/ZFC/BinaryRelatorSet.agda
open import Functional hiding (Domain)
import Structure.Logic.Classical.NaturalDeduction
import Structure.Logic.Classical.SetTheory.ZFC
module Structure.Logic.Classical.SetTheory.ZFC.BinaryRelatorSet {ℓₗ} {Formula} {ℓₘₗ} {Proof} {ℓₒ} {Domain} ⦃ classicLogic : _ ⦄ (_∈_ : Domain → Domain → Formula) ⦃ signature : _ ⦄ where
open Structure.Logic.Classical.NaturalDeduction.ClassicalLogic {ℓₗ} {Formula} {ℓₘₗ} {Proof} {ℓₒ} {Domain} (classicLogic)
open Structure.Logic.Classical.SetTheory.ZFC.Signature {ℓₗ} {Formula} {ℓₘₗ} {Proof} {ℓₒ} {Domain} ⦃ classicLogic ⦄ {_∈_} (signature)
open import Structure.Logic.Classical.SetTheory.SetBoundedQuantification ⦃ classicLogic ⦄ (_∈_)
-- Like:
-- (x,f(x)) = (x , y)
-- f = {(x , y)}
-- = {{{x},{x,y}}}
-- ⋃f = {{x},{x,y}}
-- ⋃²f = {x,y}
lefts : Domain → Domain
lefts(s) = filter(⋃(⋃ s)) (x ↦ ∃ₗ(y ↦ (x , y) ∈ s))
rights : Domain → Domain
rights(s) = filter(⋃(⋃ s)) (y ↦ ∃ₗ(x ↦ (x , y) ∈ s))
leftsOfMany : Domain → Domain → Domain
leftsOfMany f(S) = filter(⋃(⋃ f)) (a ↦ ∃ₛ(S)(y ↦ (a , y) ∈ f))
rightsOfMany : Domain → Domain → Domain
rightsOfMany f(S) = filter(⋃(⋃ f)) (a ↦ ∃ₛ(S)(x ↦ (x , a) ∈ f))
leftsOf : Domain → Domain → Domain
leftsOf f(y) = leftsOfMany f(singleton(y))
rightsOf : Domain → Domain → Domain
rightsOf f(x) = rightsOfMany f(singleton(x))
-- swap : Domain → Domain
-- swap(s) = filter(rights(s) ⨯ left(s)) (xy ↦ )
|
programs/oeis/070/A070605.asm | karttu/loda | 1 | 4410 | <reponame>karttu/loda<filename>programs/oeis/070/A070605.asm
; A070605: n^5 mod 21.
; 0,1,11,12,16,17,6,7,8,18,19,2,3,13,14,15,4,5,9,10,20,0,1,11,12,16,17,6,7,8,18,19,2,3,13,14,15,4,5,9,10,20,0,1,11,12,16,17,6,7,8,18,19,2,3,13,14,15,4,5,9,10,20,0,1,11,12,16,17,6,7,8,18,19,2,3,13,14,15,4,5,9,10,20,0,1,11,12,16,17,6,7,8,18,19,2,3,13,14,15,4,5,9,10,20,0,1,11,12,16,17,6,7,8,18,19,2,3,13,14,15,4,5,9,10,20,0,1,11,12,16,17,6,7,8,18,19,2,3,13,14,15,4,5,9,10,20,0,1,11,12,16,17,6,7,8,18,19,2,3,13,14,15,4,5,9,10,20,0,1,11,12,16,17,6,7,8,18,19,2,3,13,14,15,4,5,9,10,20,0,1,11,12,16,17,6,7,8,18,19,2,3,13,14,15,4,5,9,10,20,0,1,11,12,16,17,6,7,8,18,19,2,3,13,14,15,4,5,9,10,20,0,1,11,12,16,17,6,7,8,18,19,2,3,13,14,15,4,5,9
pow $0,5
mod $0,21
mov $1,$0
|
3-mid/impact/source/2d/collision/impact-d2-broadphase.adb | charlie5/lace | 20 | 29030 | with ada.unchecked_Deallocation,
ada.Containers.generic_array_Sort;
package body impact.d2.Broadphase
is
use type int32;
procedure free is new ada.Unchecked_Deallocation (int32_array, int32_array_view);
procedure free is new ada.Unchecked_Deallocation (b2Pairs, b2Pairs_view);
function to_b2BroadPhase return b2BroadPhase
is
Self : b2BroadPhase;
begin
Self.m_proxyCount := 0;
Self.m_pairCapacity := 16;
Self.m_pairCount := 0;
Self.m_pairBuffer := new b2Pairs (1 .. Self.m_pairCapacity);
Self.m_moveCapacity := 16;
Self.m_moveCount := 0;
Self.m_moveBuffer := new int32_array (1 .. Self.m_moveCapacity);
return Self;
end to_b2BroadPhase;
procedure destruct (Self : in out b2BroadPhase)
is
begin
free (Self.m_moveBuffer);
free (Self.m_pairBuffer);
end destruct;
function CreateProxy (Self : access b2BroadPhase; aabb : in collision.b2AABB;
userData : access Any'Class) return int32
is
proxyId : constant int32 := Self.m_tree.createProxy (aabb, userData);
begin
Self.m_proxyCount := Self.m_proxyCount + 1;
Self.BufferMove (proxyId);
return proxyId;
end CreateProxy;
procedure DestroyProxy (Self : in out b2BroadPhase; proxyId : in int32)
is
begin
Self.UnBufferMove (proxyId);
Self.m_proxyCount := Self.m_proxyCount - 1;
Self.m_tree.destroyProxy (proxyId);
end DestroyProxy;
procedure MoveProxy (Self : in out b2BroadPhase; proxyId : in int32;
aabb : in collision.b2AABB;
displacement : in b2Vec2)
is
buffer : constant Boolean := Self.m_tree.moveProxy (proxyId, aabb, displacement);
begin
if buffer then
Self.BufferMove (proxyId);
end if;
end MoveProxy;
function GetFatAABB (Self : in b2BroadPhase; proxyId : in int32) return collision.b2AABB
is
begin
return Self.m_tree.getFatAABB (proxyId);
end GetFatAABB;
function GetUserData (Self : in b2BroadPhase; proxyId : in int32) return access Any'Class
is
begin
return Self.m_tree.getUserData (proxyId);
end GetUserData;
function TestOverlap (Self : in b2BroadPhase; proxyIdA, proxyIdB : in int32) return Boolean
is
aabbA : constant collision.b2AABB := Self.m_tree.getFatAABB (proxyIdA);
aabbB : constant collision.b2AABB := Self.m_tree.getFatAABB (proxyIdB);
begin
return collision.b2TestOverlap (aabbA, aabbB);
end TestOverlap;
function GetProxyCount (Self : in b2BroadPhase) return int32
is
begin
return Self.m_proxyCount;
end GetProxyCount;
function ComputeHeight (Self : in b2BroadPhase) return int32
is
begin
return Self.m_tree.getHeight;
-- return Self.m_tree.ComputeHeight;
end ComputeHeight;
procedure BufferMove (Self : in out b2BroadPhase; proxyId : in int32)
is
oldBuffer : int32_array_view;
begin
if Self.m_moveCount = Self.m_moveCapacity then
oldBuffer := Self.m_moveBuffer;
Self.m_moveCapacity := Self.m_moveCapacity * 2;
Self.m_moveBuffer := new int32_array (1 .. Self.m_moveCapacity);
Self.m_moveBuffer (oldBuffer'Range) := oldBuffer.all;
free (oldBuffer);
end if;
Self.m_moveCount := Self.m_moveCount + 1;
Self.m_moveBuffer (Self.m_moveCount) := proxyId;
end BufferMove;
procedure unBufferMove (Self : in out b2BroadPhase; proxyId : in int32)
is
begin
for i in 1 .. Self.m_moveCount loop
if Self.m_moveBuffer (i) = proxyId then
Self.m_moveBuffer (i) := e_nullProxy;
return;
end if;
end loop;
end unBufferMove;
-- This is called from b2DynamicTree::Query when we are gathering pairs.
--
function QueryCallback (Self : access b2BroadPhase; proxyId : in int32) return Boolean
is
oldBuffer : b2Pairs_view;
begin
-- A proxy cannot form a pair with itself.
if proxyId = Self.m_queryProxyId then
return True;
end if;
-- Grow the pair buffer as needed.
if Self.m_pairCount = Self.m_pairCapacity then
oldBuffer := Self.m_pairBuffer;
Self.m_pairCapacity := Self.m_pairCapacity * 2;
Self.m_pairBuffer := new b2Pairs (1 .. Self.m_pairCapacity);
Self.m_pairBuffer (oldBuffer'Range) := oldBuffer.all;
free (oldBuffer);
end if;
Self.m_pairCount := Self.m_pairCount + 1;
Self.m_pairBuffer (Self.m_pairCount).proxyIdA := int32'Min (proxyId, Self.m_queryProxyId);
Self.m_pairBuffer (Self.m_pairCount).proxyIdB := int32'Max (proxyId, Self.m_queryProxyId);
return True;
end QueryCallback;
-- This is used to sort pairs.
--
function b2PairLessThan (pair1, pair2 : in b2Pair) return Boolean
is
begin
if pair1.proxyIdA < pair2.proxyIdA then
return True;
end if;
if pair1.proxyIdA = pair2.proxyIdA then
return pair1.proxyIdB < pair2.proxyIdB;
end if;
return False;
end b2PairLessThan;
procedure UpdatePairs (Self : in out b2BroadPhase; the_Callback : access callback_t)
is
userDataA,
userDataB : access Any'Class;
procedure sort is new ada.Containers.Generic_Array_Sort (int32, b2Pair,
b2Pairs,
b2PairLessThan);
i : int32;
begin
-- Reset pair buffer
Self.m_pairCount := 0;
-- Perform tree queries for all moving proxies.
for i in 1 .. Self.m_moveCount loop
Self.m_queryProxyId := Self.m_moveBuffer (i);
if Self.m_queryProxyId /= e_nullProxy then
declare
-- We have to query the tree with the fat AABB so that
-- we don't fail to create a pair that may touch later.
fatAABB : collision.b2AABB renames Self.m_tree.GetFatAABB (Self.m_queryProxyId);
procedure Query is new dynamic_tree.Query (b2BroadPhase, QueryCallback);
begin
-- Query tree, create pairs and add them pair buffer.
Query (Self.m_tree, Self'Access, fatAABB);
end;
end if;
end loop;
-- Reset move buffer
Self.m_moveCount := 0;
-- Sort the pair buffer to expose duplicates.
sort (Self.m_pairBuffer (1 .. Self.m_pairCount));
-- Send the pairs back to the client.
i := 1;
while i <= Self.m_pairCount loop
declare
primaryPair : constant access b2Pair := Self.m_pairBuffer (i)'Access;
pair : access b2Pair;
begin
userDataA := Self.m_tree.GetUserData (primaryPair.proxyIdA);
userDataB := Self.m_tree.GetUserData (primaryPair.proxyIdB);
addPair (the_Callback, userDataA, userDataB);
i := i + 1;
-- Skip any duplicate pairs.
while i <= Self.m_pairCount loop
pair := Self.m_pairBuffer (i)'Access;
exit when pair.proxyIdA /= primaryPair.proxyIdA or else pair.proxyIdB /= primaryPair.proxyIdB;
i := i + 1;
end loop;
end;
end loop;
-- Try to keep the tree balanced.
-- Self.m_tree.Rebalance (4);
end UpdatePairs;
procedure Query (Self : in b2BroadPhase; the_Callback : access callback_t;
aabb : in collision.b2AABB)
is
procedure Query is new dynamic_tree.Query (callback_t, QueryCallback);
begin
Query (Self.m_tree, the_Callback, aabb);
end Query;
procedure RayCast (Self : in b2BroadPhase; the_Callback : access callback_t;
input : in collision.b2RayCastInput)
is
procedure RayCast is new dynamic_tree.Raycast (callback_t, RayCastCallback);
begin
RayCast (Self.m_tree, the_Callback, input);
end RayCast;
function GetTreeHeight (Self : in b2BroadPhase) return int32
is
begin
return Self.m_tree.getHeight;
end GetTreeHeight;
function GetTreeBalance (Self : in b2BroadPhase) return int32
is
begin
return Self.m_tree.GetMaxBalance;
end GetTreeBalance;
function GetTreeQuality (Self : in b2BroadPhase) return float32
is
begin
return Self.m_tree.GetAreaRatio;
end GetTreeQuality;
end impact.d2.Broadphase;
|
scripts/Route15Gate2F.asm | opiter09/ASM-Machina | 1 | 246722 | Route15Gate2F_Script:
jp DisableAutoTextBoxDrawing
Route15Gate2F_TextPointers:
dw Route15GateUpstairsText1
dw Route15GateUpstairsText2
Route15GateUpstairsText1:
text_asm
CheckEvent EVENT_GOT_EXP_ALL
jr nz, .got_item
ld a, 50
ldh [hOaksAideRequirement], a
ld a, CASCADEBADGE
ldh [hOaksAideRewardItem], a
ld [wd11e], a
call GetItemName
ld hl, wcd6d
ld de, wOaksAideRewardItemName
ld bc, ITEM_NAME_LENGTH
call CopyData
predef OaksAideScript
ldh a, [hOaksAideResult]
cp OAKS_AIDE_GOT_ITEM
jr nz, .no_item
SetEvent EVENT_GOT_EXP_ALL
.got_item
ld hl, Route15GateUpstairsText_4968c
call PrintText
.no_item
jp TextScriptEnd
Route15GateUpstairsText_4968c:
text_far _Route15GateUpstairsText_4968c
text_end
Route15GateUpstairsText2:
text_asm
ld hl, Route15GateUpstairsText_49698
jp GateUpstairsScript_PrintIfFacingUp
Route15GateUpstairsText_49698:
text_far _Route15GateUpstairsText_49698
text_end
|
oeis/152/A152690.asm | neoneye/loda-programs | 11 | 168696 | ; A152690: Partial sums of superfactorials (A000178).
; 1,2,4,16,304,34864,24918064,125436246064,5056710181206064,1834938528961266006064,6658608419043265483506006064,265790273955000365854215115506006064,127313963565189690704560137101626315506006064,792786697723110759172566777105431625654586315506006064,69113789583285499641209911265635301339952845127606586315506006064,90378331112440256052562807068271946246288883032939701211463606586315506006064,1890966832292325105373989810883277631003486859829880442065552320111579463606586315506006064
lpb $0
mov $2,$0
sub $0,1
seq $2,178 ; Superfactorials: product of first n factorials.
add $3,$2
lpe
mov $0,$3
add $0,1
|
src/main/antlr4/ch/unibe/scg/pdfhiscore/HistogramQueryLanguage.g4 | limstepf/pdfhiscore | 0 | 5089 | grammar HistogramQueryLanguage;
prog: AND expr+
| OR expr+
| GT value+ INT
| expr+
;
expr: '(' AND expr+ ')'
| '(' OR expr+ ')'
| '(' GT value+ INT ')'
| NOT expr
| value
;
value: WORD | SQWORD | DQWORD;
AND: '&&';
OR: '||';
NOT: '!';
GT: '>';
SQWORD: '\'' .*? '\'';
DQWORD: '"' .*? '"';
WORD: ALPHA (ALPHA|DIGIT)*;
INT: DIGIT+;
fragment ALPHA: [a-zA-Z_\-];
fragment DIGIT: [0-9];
WS: [ \t\r\n]+ -> skip;
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca_notsx.log_21829_1594.asm | ljhsiun2/medusa | 9 | 13130 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r15
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0xead, %r8
sub %r9, %r9
movw $0x6162, (%r8)
nop
nop
nop
nop
nop
and %r8, %r8
lea addresses_normal_ht+0xff5, %rsi
lea addresses_WT_ht+0x1a90d, %rdi
xor $8256, %rbp
mov $104, %rcx
rep movsw
nop
xor $32827, %r8
lea addresses_WC_ht+0x1ddf8, %r11
nop
add $34119, %rsi
movl $0x61626364, (%r11)
and $45887, %r9
lea addresses_D_ht+0x362d, %rsi
nop
nop
nop
nop
nop
add $63428, %rcx
vmovups (%rsi), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rbp
nop
nop
nop
nop
nop
xor %r11, %r11
lea addresses_normal_ht+0x82fa, %rsi
lea addresses_normal_ht+0x3e2d, %rdi
xor %r15, %r15
mov $10, %rcx
rep movsb
nop
nop
nop
sub %rcx, %rcx
lea addresses_WC_ht+0x123a9, %r9
nop
cmp %rcx, %rcx
mov $0x6162636465666768, %rbp
movq %rbp, (%r9)
nop
nop
nop
nop
nop
inc %rbp
lea addresses_D_ht+0x18e7f, %rcx
nop
nop
nop
nop
lfence
mov (%rcx), %esi
nop
nop
nop
nop
dec %rbp
lea addresses_UC_ht+0x1482d, %r15
nop
add %rsi, %rsi
mov (%r15), %edi
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_WC_ht+0x16e25, %r8
nop
nop
inc %r9
mov (%r8), %cx
add $22630, %r11
lea addresses_WC_ht+0x1162d, %rsi
lea addresses_UC_ht+0x662d, %rdi
nop
nop
nop
nop
nop
sub %r9, %r9
mov $34, %rcx
rep movsw
nop
nop
nop
and %rdi, %rdi
lea addresses_normal_ht+0x1722d, %rdi
cmp $45094, %rsi
movups (%rdi), %xmm0
vpextrq $0, %xmm0, %rbp
nop
inc %rsi
lea addresses_normal_ht+0x19597, %rsi
lea addresses_UC_ht+0xe035, %rdi
nop
nop
nop
nop
nop
inc %r11
mov $104, %rcx
rep movsl
add %rdi, %rdi
lea addresses_A_ht+0x1e2dd, %rcx
clflush (%rcx)
nop
nop
nop
nop
dec %r9
mov $0x6162636465666768, %r11
movq %r11, %xmm2
and $0xffffffffffffffc0, %rcx
movaps %xmm2, (%rcx)
nop
nop
nop
nop
and $7891, %r15
lea addresses_UC_ht+0x7c2d, %r15
nop
nop
nop
dec %rcx
vmovups (%r15), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %rsi
nop
nop
nop
nop
nop
sub %r9, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r9
push %rcx
push %rsi
// Faulty Load
mov $0x30ff030000000e2d, %rsi
nop
nop
nop
and $57501, %r13
mov (%rsi), %rcx
lea oracles, %r11
and $0xff, %rcx
shlq $12, %rcx
mov (%r11,%rcx,1), %rcx
pop %rsi
pop %rcx
pop %r9
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 5, 'same': True, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 11, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 9, 'same': True, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 2, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
programs/oeis/100/A100149.asm | karttu/loda | 0 | 89801 | ; A100149: Structured small rhombicubeoctahedral numbers.
; 1,24,106,284,595,1076,1764,2696,3909,5440,7326,9604,12311,15484,19160,23376,28169,33576,39634,46380,53851,62084,71116,80984,91725,103376,115974,129556,144159,159820,176576,194464,213521,233784,255290,278076,302179,327636,354484,382760,412501,443744,476526,510884,546855,584476,623784,664816,707609,752200,798626,846924,897131,949284,1003420,1059576,1117789,1178096,1240534,1305140,1371951,1441004,1512336,1585984,1661985,1740376,1821194,1904476,1990259,2078580,2169476,2262984,2359141,2457984,2559550,2663876,2770999,2880956,2993784,3109520,3228201,3349864,3474546,3602284,3733115,3867076,4004204,4144536,4288109,4434960,4585126,4738644,4895551,5055884,5219680,5386976,5557809,5732216,5910234,6091900,6277251,6466324,6659156,6855784,7056245,7260576,7468814,7680996,7897159,8117340,8341576,8569904,8802361,9038984,9279810,9524876,9774219,10027876,10285884,10548280,10815101,11086384,11362166,11642484,11927375,12216876,12511024,12809856,13113409,13421720,13734826,14052764,14375571,14703284,15035940,15373576,15716229,16063936,16416734,16774660,17137751,17506044,17879576,18258384,18642505,19031976,19426834,19827116,20232859,20644100,21060876,21483224,21911181,22344784,22784070,23229076,23679839,24136396,24598784,25067040,25541201,26021304,26507386,26999484,27497635,28001876,28512244,29028776,29551509,30080480,30615726,31157284,31705191,32259484,32820200,33387376,33961049,34541256,35128034,35721420,36321451,36928164,37541596,38161784,38788765,39422576,40063254,40710836,41365359,42026860,42695376,43370944,44053601,44743384,45440330,46144476,46855859,47574516,48300484,49033800,49774501,50522624,51278206,52041284,52811895,53590076,54375864,55169296,55970409,56779240,57595826,58420204,59252411,60092484,60940460,61796376,62660269,63532176,64412134,65300180,66196351,67100684,68013216,68933984,69863025,70800376,71746074,72700156,73662659,74633620,75613076,76601064,77597621,78602784,79616590,80639076,81670279,82710236,83758984,84816560,85883001,86958344,88042626,89135884,90238155,91349476,92469884,93599416,94738109,95886000
mov $1,2
add $1,$0
mov $2,$1
mov $7,$0
lpb $2,1
add $3,$0
add $3,1
lpb $0,1
add $3,$0
sub $0,1
lpe
mov $1,$3
sub $2,1
add $0,$2
lpe
sub $1,3
mov $5,$7
mov $8,$7
lpb $5,1
sub $5,1
add $6,$8
lpe
mov $4,9
mov $8,$6
lpb $4,1
add $1,$8
sub $4,1
lpe
mov $5,$7
mov $6,0
lpb $5,1
sub $5,1
add $6,$8
lpe
mov $4,6
mov $8,$6
lpb $4,1
add $1,$8
sub $4,1
lpe
|
alloy4fun_models/trainstlt/models/1/weG9RvWywMEpTFEF3.als | Kaixi26/org.alloytools.alloy | 0 | 2427 | open main
pred idweG9RvWywMEpTFEF3_prop2 {
always all s: Signal | eventually s in Green
}
pred __repair { idweG9RvWywMEpTFEF3_prop2 }
check __repair { idweG9RvWywMEpTFEF3_prop2 <=> prop2o } |
programs/oeis/000/A000572.asm | jmorken/loda | 1 | 98067 | <filename>programs/oeis/000/A000572.asm<gh_stars>1-10
; A000572: A Beatty sequence: [ n(e+1) ].
; 3,7,11,14,18,22,26,29,33,37,40,44,48,52,55,59,63,66,70,74,78,81,85,89,92,96,100,104,107,111,115,118,122,126,130,133,137,141,145,148,152,156,159,163,167,171,174,178,182,185,189,193,197,200,204,208,211,215,219,223,226,230,234,237,241,245,249,252,256,260,263,267,271,275,278,282,286,290,293,297,301,304,308,312,316,319,323,327,330,334,338,342,345,349,353,356,360,364,368,371,375,379,382,386,390,394,397,401,405,409,412,416,420,423,427,431,435,438,442,446,449,453,457,461,464,468,472,475,479,483,487,490,494,498,501,505,509,513,516,520,524,527,531,535,539,542,546,550,554,557,561,565,568,572,576,580,583,587,591,594,598,602,606,609,613,617,620,624,628,632,635,639,643,646,650,654,658,661,665,669,673,676,680,684,687,691,695,699,702,706,710,713,717,721,725,728,732,736,739,743,747,751,754,758,762,765,769,773,777,780,784,788,791,795,799,803,806,810,814,818,821,825,829,832,836,840,844,847,851,855,858,862,866,870,873,877,881,884,888,892,896,899,903,907,910,914,918,922,925,929
mov $5,$0
mov $6,$0
mul $6,2
add $6,1
add $0,$6
add $0,2
mov $1,2
mov $4,$0
mul $4,16
add $0,$4
mov $2,70
lpb $0
sub $0,1
sub $1,1
add $2,$1
div $0,$2
mov $3,1
mul $3,$0
mov $0,1
add $3,4
lpe
mov $1,$3
sub $1,1
mov $7,$5
mul $7,3
add $1,$7
|
iPhotoExport.applescript | Obbut/iPhoto-album-export-AppleScript | 6 | 1794 | (*
The MIT License (MIT)
Copyright (c) 2014 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*)
log "Started exporting photos"
set the destination to "/insert/your/absolute/photo/export/path/here/"
tell application "iPhoto"
set theEvents to get every album
repeat with aEvent in theEvents
if (type of aEvent) is regular album then
set shouldcopy to true
if the name of aEvent is "Laatste import" then
set shouldcopy to false
end if
set thepath to the name of aEvent
# Repeat until the upper parent is found
set thecurrentparent to the parent of aEvent
try
repeat while the type of thecurrentparent is folder album
if the name of thecurrentparent is "Verzamelingen" then
set shouldcopy to false
end if
set thisname to (get name of thecurrentparent)
set thepath to thisname & "/" & thepath
set thecurrentparent to the parent of thecurrentparent
end repeat
end try
set thepath to destination & thepath & "/"
# Create parent folder
if shouldcopy then
log "Copying to " & thepath
do shell script "mkdir -p \"" & thepath & "\""
set theImagePaths to image path of every photo of aEvent
set totalphotos to count of theImagePaths
set photoscopied to 0
set lastreportpercentage to 0
log (totalphotos as string) & " photos to be copied"
repeat with theimagepath in theImagePaths
do shell script "cp \"" & theimagepath & "\" \"" & thepath & "\""
set photoscopied to photoscopied + 1
set percentage to (photoscopied / totalphotos * 100) as integer
if percentage is not lastreportpercentage then
log (percentage as string) & "%"
set lastreportpercentage to percentage
end if
end repeat
else
log "Not copying " & name of aEvent
end if
end if
end repeat
end tell |
src/fot/FOL/Everything.agda | asr/fotc | 11 | 292 | <gh_stars>10-100
------------------------------------------------------------------------------
-- All the predicate logic modules
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOL.Everything where
open import FOL.Base
open import FOL.ExclusiveDisjunction.Base
open import FOL.ExclusiveDisjunction.TheoremsATP
open import FOL.ExclusiveDisjunction.TheoremsI
open import FOL.NonEmptyDomain.TheoremsATP
open import FOL.NonEmptyDomain.TheoremsI
open import FOL.NonIntuitionistic.TheoremsATP
open import FOL.NonIntuitionistic.TheoremsI
open import FOL.PropositionalLogic.TheoremsATP
open import FOL.PropositionalLogic.TheoremsI
open import FOL.SchemataATP
open import FOL.TheoremsATP
open import FOL.TheoremsI
|
ejercicios3/ordenar_por_burbuja.adb | iyan22/AprendeAda | 0 | 2854 | with datos;
use datos;
with intercambiar;
procedure Ordenar_Por_Burbuja (L : in out Lista_Enteros) is
-- pre:
-- post: L contiene los valores iniciales en orden ascendente
I : Integer;
J: Integer;
Cuenta : Integer;
begin
I := L.Numeros'First;
if L.Cont > 1 then
loop
Cuenta := 0;
J := 1;
loop exit when J > L.Cont-1;
if L.Numeros(J) > L.Numeros(J+1) then
Intercambiar(J, J+1, L);
Cuenta := Cuenta+1;
end if;
J:= J+1;
end loop;
I := I+1;
exit when I > L.Cont-1 or Cuenta = 0; -- Usamos esto como Boolean para comprobar si hay cambios
end loop;
end if;
end Ordenar_Por_Burbuja;
|
grep.asm | vdthatte/Operating-Systems-Class-CS-UY-3224 | 1 | 93452 | <reponame>vdthatte/Operating-Systems-Class-CS-UY-3224<gh_stars>1-10
_grep: file format elf32-i386
Disassembly of section .text:
00000000 <grep>:
char buf[1024];
int match(char*, char*);
void
grep(char *pattern, int fd)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
int n, m;
char *p, *q;
m = 0;
6: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
d: e9 b4 00 00 00 jmp c6 <grep+0xc6>
m += n;
12: 8b 45 ec mov -0x14(%ebp),%eax
15: 01 45 f4 add %eax,-0xc(%ebp)
buf[m] = '\0';
18: 8b 45 f4 mov -0xc(%ebp),%eax
1b: 05 c0 0d 00 00 add $0xdc0,%eax
20: c6 00 00 movb $0x0,(%eax)
p = buf;
23: c7 45 f0 c0 0d 00 00 movl $0xdc0,-0x10(%ebp)
while((q = strchr(p, '\n')) != 0){
2a: eb 46 jmp 72 <grep+0x72>
*q = 0;
2c: 8b 45 e8 mov -0x18(%ebp),%eax
2f: c6 00 00 movb $0x0,(%eax)
if(match(pattern, p)){
32: 83 ec 08 sub $0x8,%esp
35: ff 75 f0 pushl -0x10(%ebp)
38: ff 75 08 pushl 0x8(%ebp)
3b: e8 95 01 00 00 call 1d5 <match>
40: 83 c4 10 add $0x10,%esp
43: 85 c0 test %eax,%eax
45: 74 24 je 6b <grep+0x6b>
*q = '\n';
47: 8b 45 e8 mov -0x18(%ebp),%eax
4a: c6 00 0a movb $0xa,(%eax)
write(1, p, q+1 - p);
4d: 8b 45 e8 mov -0x18(%ebp),%eax
50: 40 inc %eax
51: 89 c2 mov %eax,%edx
53: 8b 45 f0 mov -0x10(%ebp),%eax
56: 29 c2 sub %eax,%edx
58: 89 d0 mov %edx,%eax
5a: 83 ec 04 sub $0x4,%esp
5d: 50 push %eax
5e: ff 75 f0 pushl -0x10(%ebp)
61: 6a 01 push $0x1
63: e8 11 05 00 00 call 579 <write>
68: 83 c4 10 add $0x10,%esp
}
p = q+1;
6b: 8b 45 e8 mov -0x18(%ebp),%eax
6e: 40 inc %eax
6f: 89 45 f0 mov %eax,-0x10(%ebp)
m = 0;
while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
m += n;
buf[m] = '\0';
p = buf;
while((q = strchr(p, '\n')) != 0){
72: 83 ec 08 sub $0x8,%esp
75: 6a 0a push $0xa
77: ff 75 f0 pushl -0x10(%ebp)
7a: e8 66 03 00 00 call 3e5 <strchr>
7f: 83 c4 10 add $0x10,%esp
82: 89 45 e8 mov %eax,-0x18(%ebp)
85: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
89: 75 a1 jne 2c <grep+0x2c>
*q = '\n';
write(1, p, q+1 - p);
}
p = q+1;
}
if(p == buf)
8b: 81 7d f0 c0 0d 00 00 cmpl $0xdc0,-0x10(%ebp)
92: 75 07 jne 9b <grep+0x9b>
m = 0;
94: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
if(m > 0){
9b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
9f: 7e 25 jle c6 <grep+0xc6>
m -= p - buf;
a1: ba c0 0d 00 00 mov $0xdc0,%edx
a6: 8b 45 f0 mov -0x10(%ebp),%eax
a9: 29 c2 sub %eax,%edx
ab: 89 d0 mov %edx,%eax
ad: 01 45 f4 add %eax,-0xc(%ebp)
memmove(buf, p, m);
b0: 83 ec 04 sub $0x4,%esp
b3: ff 75 f4 pushl -0xc(%ebp)
b6: ff 75 f0 pushl -0x10(%ebp)
b9: 68 c0 0d 00 00 push $0xdc0
be: e8 52 04 00 00 call 515 <memmove>
c3: 83 c4 10 add $0x10,%esp
{
int n, m;
char *p, *q;
m = 0;
while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
c6: 8b 45 f4 mov -0xc(%ebp),%eax
c9: ba ff 03 00 00 mov $0x3ff,%edx
ce: 29 c2 sub %eax,%edx
d0: 89 d0 mov %edx,%eax
d2: 8b 55 f4 mov -0xc(%ebp),%edx
d5: 81 c2 c0 0d 00 00 add $0xdc0,%edx
db: 83 ec 04 sub $0x4,%esp
de: 50 push %eax
df: 52 push %edx
e0: ff 75 0c pushl 0xc(%ebp)
e3: e8 89 04 00 00 call 571 <read>
e8: 83 c4 10 add $0x10,%esp
eb: 89 45 ec mov %eax,-0x14(%ebp)
ee: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
f2: 0f 8f 1a ff ff ff jg 12 <grep+0x12>
if(m > 0){
m -= p - buf;
memmove(buf, p, m);
}
}
}
f8: c9 leave
f9: c3 ret
000000fa <main>:
int
main(int argc, char *argv[])
{
fa: 8d 4c 24 04 lea 0x4(%esp),%ecx
fe: 83 e4 f0 and $0xfffffff0,%esp
101: ff 71 fc pushl -0x4(%ecx)
104: 55 push %ebp
105: 89 e5 mov %esp,%ebp
107: 53 push %ebx
108: 51 push %ecx
109: 83 ec 10 sub $0x10,%esp
10c: 89 cb mov %ecx,%ebx
int fd, i;
char *pattern;
if(argc <= 1){
10e: 83 3b 01 cmpl $0x1,(%ebx)
111: 7f 17 jg 12a <main+0x30>
printf(2, "usage: grep pattern [file ...]\n");
113: 83 ec 08 sub $0x8,%esp
116: 68 78 0a 00 00 push $0xa78
11b: 6a 02 push $0x2
11d: e8 a9 05 00 00 call 6cb <printf>
122: 83 c4 10 add $0x10,%esp
exit();
125: e8 2f 04 00 00 call 559 <exit>
}
pattern = argv[1];
12a: 8b 43 04 mov 0x4(%ebx),%eax
12d: 8b 40 04 mov 0x4(%eax),%eax
130: 89 45 f0 mov %eax,-0x10(%ebp)
if(argc <= 2){
133: 83 3b 02 cmpl $0x2,(%ebx)
136: 7f 15 jg 14d <main+0x53>
grep(pattern, 0);
138: 83 ec 08 sub $0x8,%esp
13b: 6a 00 push $0x0
13d: ff 75 f0 pushl -0x10(%ebp)
140: e8 bb fe ff ff call 0 <grep>
145: 83 c4 10 add $0x10,%esp
exit();
148: e8 0c 04 00 00 call 559 <exit>
}
for(i = 2; i < argc; i++){
14d: c7 45 f4 02 00 00 00 movl $0x2,-0xc(%ebp)
154: eb 73 jmp 1c9 <main+0xcf>
if((fd = open(argv[i], 0)) < 0){
156: 8b 45 f4 mov -0xc(%ebp),%eax
159: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
160: 8b 43 04 mov 0x4(%ebx),%eax
163: 01 d0 add %edx,%eax
165: 8b 00 mov (%eax),%eax
167: 83 ec 08 sub $0x8,%esp
16a: 6a 00 push $0x0
16c: 50 push %eax
16d: e8 27 04 00 00 call 599 <open>
172: 83 c4 10 add $0x10,%esp
175: 89 45 ec mov %eax,-0x14(%ebp)
178: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
17c: 79 29 jns 1a7 <main+0xad>
printf(1, "grep: cannot open %s\n", argv[i]);
17e: 8b 45 f4 mov -0xc(%ebp),%eax
181: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
188: 8b 43 04 mov 0x4(%ebx),%eax
18b: 01 d0 add %edx,%eax
18d: 8b 00 mov (%eax),%eax
18f: 83 ec 04 sub $0x4,%esp
192: 50 push %eax
193: 68 98 0a 00 00 push $0xa98
198: 6a 01 push $0x1
19a: e8 2c 05 00 00 call 6cb <printf>
19f: 83 c4 10 add $0x10,%esp
exit();
1a2: e8 b2 03 00 00 call 559 <exit>
}
grep(pattern, fd);
1a7: 83 ec 08 sub $0x8,%esp
1aa: ff 75 ec pushl -0x14(%ebp)
1ad: ff 75 f0 pushl -0x10(%ebp)
1b0: e8 4b fe ff ff call 0 <grep>
1b5: 83 c4 10 add $0x10,%esp
close(fd);
1b8: 83 ec 0c sub $0xc,%esp
1bb: ff 75 ec pushl -0x14(%ebp)
1be: e8 be 03 00 00 call 581 <close>
1c3: 83 c4 10 add $0x10,%esp
if(argc <= 2){
grep(pattern, 0);
exit();
}
for(i = 2; i < argc; i++){
1c6: ff 45 f4 incl -0xc(%ebp)
1c9: 8b 45 f4 mov -0xc(%ebp),%eax
1cc: 3b 03 cmp (%ebx),%eax
1ce: 7c 86 jl 156 <main+0x5c>
exit();
}
grep(pattern, fd);
close(fd);
}
exit();
1d0: e8 84 03 00 00 call 559 <exit>
000001d5 <match>:
int matchhere(char*, char*);
int matchstar(int, char*, char*);
int
match(char *re, char *text)
{
1d5: 55 push %ebp
1d6: 89 e5 mov %esp,%ebp
1d8: 83 ec 08 sub $0x8,%esp
if(re[0] == '^')
1db: 8b 45 08 mov 0x8(%ebp),%eax
1de: 8a 00 mov (%eax),%al
1e0: 3c 5e cmp $0x5e,%al
1e2: 75 15 jne 1f9 <match+0x24>
return matchhere(re+1, text);
1e4: 8b 45 08 mov 0x8(%ebp),%eax
1e7: 40 inc %eax
1e8: 83 ec 08 sub $0x8,%esp
1eb: ff 75 0c pushl 0xc(%ebp)
1ee: 50 push %eax
1ef: e8 37 00 00 00 call 22b <matchhere>
1f4: 83 c4 10 add $0x10,%esp
1f7: eb 30 jmp 229 <match+0x54>
do{ // must look at empty string
if(matchhere(re, text))
1f9: 83 ec 08 sub $0x8,%esp
1fc: ff 75 0c pushl 0xc(%ebp)
1ff: ff 75 08 pushl 0x8(%ebp)
202: e8 24 00 00 00 call 22b <matchhere>
207: 83 c4 10 add $0x10,%esp
20a: 85 c0 test %eax,%eax
20c: 74 07 je 215 <match+0x40>
return 1;
20e: b8 01 00 00 00 mov $0x1,%eax
213: eb 14 jmp 229 <match+0x54>
}while(*text++ != '\0');
215: 8b 45 0c mov 0xc(%ebp),%eax
218: 8d 50 01 lea 0x1(%eax),%edx
21b: 89 55 0c mov %edx,0xc(%ebp)
21e: 8a 00 mov (%eax),%al
220: 84 c0 test %al,%al
222: 75 d5 jne 1f9 <match+0x24>
return 0;
224: b8 00 00 00 00 mov $0x0,%eax
}
229: c9 leave
22a: c3 ret
0000022b <matchhere>:
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
22b: 55 push %ebp
22c: 89 e5 mov %esp,%ebp
22e: 83 ec 08 sub $0x8,%esp
if(re[0] == '\0')
231: 8b 45 08 mov 0x8(%ebp),%eax
234: 8a 00 mov (%eax),%al
236: 84 c0 test %al,%al
238: 75 0a jne 244 <matchhere+0x19>
return 1;
23a: b8 01 00 00 00 mov $0x1,%eax
23f: e9 8a 00 00 00 jmp 2ce <matchhere+0xa3>
if(re[1] == '*')
244: 8b 45 08 mov 0x8(%ebp),%eax
247: 40 inc %eax
248: 8a 00 mov (%eax),%al
24a: 3c 2a cmp $0x2a,%al
24c: 75 20 jne 26e <matchhere+0x43>
return matchstar(re[0], re+2, text);
24e: 8b 45 08 mov 0x8(%ebp),%eax
251: 8d 50 02 lea 0x2(%eax),%edx
254: 8b 45 08 mov 0x8(%ebp),%eax
257: 8a 00 mov (%eax),%al
259: 0f be c0 movsbl %al,%eax
25c: 83 ec 04 sub $0x4,%esp
25f: ff 75 0c pushl 0xc(%ebp)
262: 52 push %edx
263: 50 push %eax
264: e8 67 00 00 00 call 2d0 <matchstar>
269: 83 c4 10 add $0x10,%esp
26c: eb 60 jmp 2ce <matchhere+0xa3>
if(re[0] == '$' && re[1] == '\0')
26e: 8b 45 08 mov 0x8(%ebp),%eax
271: 8a 00 mov (%eax),%al
273: 3c 24 cmp $0x24,%al
275: 75 19 jne 290 <matchhere+0x65>
277: 8b 45 08 mov 0x8(%ebp),%eax
27a: 40 inc %eax
27b: 8a 00 mov (%eax),%al
27d: 84 c0 test %al,%al
27f: 75 0f jne 290 <matchhere+0x65>
return *text == '\0';
281: 8b 45 0c mov 0xc(%ebp),%eax
284: 8a 00 mov (%eax),%al
286: 84 c0 test %al,%al
288: 0f 94 c0 sete %al
28b: 0f b6 c0 movzbl %al,%eax
28e: eb 3e jmp 2ce <matchhere+0xa3>
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
290: 8b 45 0c mov 0xc(%ebp),%eax
293: 8a 00 mov (%eax),%al
295: 84 c0 test %al,%al
297: 74 30 je 2c9 <matchhere+0x9e>
299: 8b 45 08 mov 0x8(%ebp),%eax
29c: 8a 00 mov (%eax),%al
29e: 3c 2e cmp $0x2e,%al
2a0: 74 0e je 2b0 <matchhere+0x85>
2a2: 8b 45 08 mov 0x8(%ebp),%eax
2a5: 8a 10 mov (%eax),%dl
2a7: 8b 45 0c mov 0xc(%ebp),%eax
2aa: 8a 00 mov (%eax),%al
2ac: 38 c2 cmp %al,%dl
2ae: 75 19 jne 2c9 <matchhere+0x9e>
return matchhere(re+1, text+1);
2b0: 8b 45 0c mov 0xc(%ebp),%eax
2b3: 8d 50 01 lea 0x1(%eax),%edx
2b6: 8b 45 08 mov 0x8(%ebp),%eax
2b9: 40 inc %eax
2ba: 83 ec 08 sub $0x8,%esp
2bd: 52 push %edx
2be: 50 push %eax
2bf: e8 67 ff ff ff call 22b <matchhere>
2c4: 83 c4 10 add $0x10,%esp
2c7: eb 05 jmp 2ce <matchhere+0xa3>
return 0;
2c9: b8 00 00 00 00 mov $0x0,%eax
}
2ce: c9 leave
2cf: c3 ret
000002d0 <matchstar>:
// matchstar: search for c*re at beginning of text
int matchstar(int c, char *re, char *text)
{
2d0: 55 push %ebp
2d1: 89 e5 mov %esp,%ebp
2d3: 83 ec 08 sub $0x8,%esp
do{ // a * matches zero or more instances
if(matchhere(re, text))
2d6: 83 ec 08 sub $0x8,%esp
2d9: ff 75 10 pushl 0x10(%ebp)
2dc: ff 75 0c pushl 0xc(%ebp)
2df: e8 47 ff ff ff call 22b <matchhere>
2e4: 83 c4 10 add $0x10,%esp
2e7: 85 c0 test %eax,%eax
2e9: 74 07 je 2f2 <matchstar+0x22>
return 1;
2eb: b8 01 00 00 00 mov $0x1,%eax
2f0: eb 27 jmp 319 <matchstar+0x49>
}while(*text!='\0' && (*text++==c || c=='.'));
2f2: 8b 45 10 mov 0x10(%ebp),%eax
2f5: 8a 00 mov (%eax),%al
2f7: 84 c0 test %al,%al
2f9: 74 19 je 314 <matchstar+0x44>
2fb: 8b 45 10 mov 0x10(%ebp),%eax
2fe: 8d 50 01 lea 0x1(%eax),%edx
301: 89 55 10 mov %edx,0x10(%ebp)
304: 8a 00 mov (%eax),%al
306: 0f be c0 movsbl %al,%eax
309: 3b 45 08 cmp 0x8(%ebp),%eax
30c: 74 c8 je 2d6 <matchstar+0x6>
30e: 83 7d 08 2e cmpl $0x2e,0x8(%ebp)
312: 74 c2 je 2d6 <matchstar+0x6>
return 0;
314: b8 00 00 00 00 mov $0x0,%eax
}
319: c9 leave
31a: c3 ret
0000031b <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
31b: 55 push %ebp
31c: 89 e5 mov %esp,%ebp
31e: 57 push %edi
31f: 53 push %ebx
asm volatile("cld; rep stosb" :
320: 8b 4d 08 mov 0x8(%ebp),%ecx
323: 8b 55 10 mov 0x10(%ebp),%edx
326: 8b 45 0c mov 0xc(%ebp),%eax
329: 89 cb mov %ecx,%ebx
32b: 89 df mov %ebx,%edi
32d: 89 d1 mov %edx,%ecx
32f: fc cld
330: f3 aa rep stos %al,%es:(%edi)
332: 89 ca mov %ecx,%edx
334: 89 fb mov %edi,%ebx
336: 89 5d 08 mov %ebx,0x8(%ebp)
339: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
33c: 5b pop %ebx
33d: 5f pop %edi
33e: 5d pop %ebp
33f: c3 ret
00000340 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
340: 55 push %ebp
341: 89 e5 mov %esp,%ebp
343: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
346: 8b 45 08 mov 0x8(%ebp),%eax
349: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
34c: 90 nop
34d: 8b 45 08 mov 0x8(%ebp),%eax
350: 8d 50 01 lea 0x1(%eax),%edx
353: 89 55 08 mov %edx,0x8(%ebp)
356: 8b 55 0c mov 0xc(%ebp),%edx
359: 8d 4a 01 lea 0x1(%edx),%ecx
35c: 89 4d 0c mov %ecx,0xc(%ebp)
35f: 8a 12 mov (%edx),%dl
361: 88 10 mov %dl,(%eax)
363: 8a 00 mov (%eax),%al
365: 84 c0 test %al,%al
367: 75 e4 jne 34d <strcpy+0xd>
;
return os;
369: 8b 45 fc mov -0x4(%ebp),%eax
}
36c: c9 leave
36d: c3 ret
0000036e <strcmp>:
int
strcmp(const char *p, const char *q)
{
36e: 55 push %ebp
36f: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
371: eb 06 jmp 379 <strcmp+0xb>
p++, q++;
373: ff 45 08 incl 0x8(%ebp)
376: ff 45 0c incl 0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
379: 8b 45 08 mov 0x8(%ebp),%eax
37c: 8a 00 mov (%eax),%al
37e: 84 c0 test %al,%al
380: 74 0e je 390 <strcmp+0x22>
382: 8b 45 08 mov 0x8(%ebp),%eax
385: 8a 10 mov (%eax),%dl
387: 8b 45 0c mov 0xc(%ebp),%eax
38a: 8a 00 mov (%eax),%al
38c: 38 c2 cmp %al,%dl
38e: 74 e3 je 373 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
390: 8b 45 08 mov 0x8(%ebp),%eax
393: 8a 00 mov (%eax),%al
395: 0f b6 d0 movzbl %al,%edx
398: 8b 45 0c mov 0xc(%ebp),%eax
39b: 8a 00 mov (%eax),%al
39d: 0f b6 c0 movzbl %al,%eax
3a0: 29 c2 sub %eax,%edx
3a2: 89 d0 mov %edx,%eax
}
3a4: 5d pop %ebp
3a5: c3 ret
000003a6 <strlen>:
uint
strlen(char *s)
{
3a6: 55 push %ebp
3a7: 89 e5 mov %esp,%ebp
3a9: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
3ac: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
3b3: eb 03 jmp 3b8 <strlen+0x12>
3b5: ff 45 fc incl -0x4(%ebp)
3b8: 8b 55 fc mov -0x4(%ebp),%edx
3bb: 8b 45 08 mov 0x8(%ebp),%eax
3be: 01 d0 add %edx,%eax
3c0: 8a 00 mov (%eax),%al
3c2: 84 c0 test %al,%al
3c4: 75 ef jne 3b5 <strlen+0xf>
;
return n;
3c6: 8b 45 fc mov -0x4(%ebp),%eax
}
3c9: c9 leave
3ca: c3 ret
000003cb <memset>:
void*
memset(void *dst, int c, uint n)
{
3cb: 55 push %ebp
3cc: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
3ce: 8b 45 10 mov 0x10(%ebp),%eax
3d1: 50 push %eax
3d2: ff 75 0c pushl 0xc(%ebp)
3d5: ff 75 08 pushl 0x8(%ebp)
3d8: e8 3e ff ff ff call 31b <stosb>
3dd: 83 c4 0c add $0xc,%esp
return dst;
3e0: 8b 45 08 mov 0x8(%ebp),%eax
}
3e3: c9 leave
3e4: c3 ret
000003e5 <strchr>:
char*
strchr(const char *s, char c)
{
3e5: 55 push %ebp
3e6: 89 e5 mov %esp,%ebp
3e8: 83 ec 04 sub $0x4,%esp
3eb: 8b 45 0c mov 0xc(%ebp),%eax
3ee: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
3f1: eb 12 jmp 405 <strchr+0x20>
if(*s == c)
3f3: 8b 45 08 mov 0x8(%ebp),%eax
3f6: 8a 00 mov (%eax),%al
3f8: 3a 45 fc cmp -0x4(%ebp),%al
3fb: 75 05 jne 402 <strchr+0x1d>
return (char*)s;
3fd: 8b 45 08 mov 0x8(%ebp),%eax
400: eb 11 jmp 413 <strchr+0x2e>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
402: ff 45 08 incl 0x8(%ebp)
405: 8b 45 08 mov 0x8(%ebp),%eax
408: 8a 00 mov (%eax),%al
40a: 84 c0 test %al,%al
40c: 75 e5 jne 3f3 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
40e: b8 00 00 00 00 mov $0x0,%eax
}
413: c9 leave
414: c3 ret
00000415 <gets>:
char*
gets(char *buf, int max)
{
415: 55 push %ebp
416: 89 e5 mov %esp,%ebp
418: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
41b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
422: eb 41 jmp 465 <gets+0x50>
cc = read(0, &c, 1);
424: 83 ec 04 sub $0x4,%esp
427: 6a 01 push $0x1
429: 8d 45 ef lea -0x11(%ebp),%eax
42c: 50 push %eax
42d: 6a 00 push $0x0
42f: e8 3d 01 00 00 call 571 <read>
434: 83 c4 10 add $0x10,%esp
437: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
43a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
43e: 7f 02 jg 442 <gets+0x2d>
break;
440: eb 2c jmp 46e <gets+0x59>
buf[i++] = c;
442: 8b 45 f4 mov -0xc(%ebp),%eax
445: 8d 50 01 lea 0x1(%eax),%edx
448: 89 55 f4 mov %edx,-0xc(%ebp)
44b: 89 c2 mov %eax,%edx
44d: 8b 45 08 mov 0x8(%ebp),%eax
450: 01 c2 add %eax,%edx
452: 8a 45 ef mov -0x11(%ebp),%al
455: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
457: 8a 45 ef mov -0x11(%ebp),%al
45a: 3c 0a cmp $0xa,%al
45c: 74 10 je 46e <gets+0x59>
45e: 8a 45 ef mov -0x11(%ebp),%al
461: 3c 0d cmp $0xd,%al
463: 74 09 je 46e <gets+0x59>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
465: 8b 45 f4 mov -0xc(%ebp),%eax
468: 40 inc %eax
469: 3b 45 0c cmp 0xc(%ebp),%eax
46c: 7c b6 jl 424 <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
46e: 8b 55 f4 mov -0xc(%ebp),%edx
471: 8b 45 08 mov 0x8(%ebp),%eax
474: 01 d0 add %edx,%eax
476: c6 00 00 movb $0x0,(%eax)
return buf;
479: 8b 45 08 mov 0x8(%ebp),%eax
}
47c: c9 leave
47d: c3 ret
0000047e <stat>:
int
stat(char *n, struct stat *st)
{
47e: 55 push %ebp
47f: 89 e5 mov %esp,%ebp
481: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
484: 83 ec 08 sub $0x8,%esp
487: 6a 00 push $0x0
489: ff 75 08 pushl 0x8(%ebp)
48c: e8 08 01 00 00 call 599 <open>
491: 83 c4 10 add $0x10,%esp
494: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
497: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
49b: 79 07 jns 4a4 <stat+0x26>
return -1;
49d: b8 ff ff ff ff mov $0xffffffff,%eax
4a2: eb 25 jmp 4c9 <stat+0x4b>
r = fstat(fd, st);
4a4: 83 ec 08 sub $0x8,%esp
4a7: ff 75 0c pushl 0xc(%ebp)
4aa: ff 75 f4 pushl -0xc(%ebp)
4ad: e8 ff 00 00 00 call 5b1 <fstat>
4b2: 83 c4 10 add $0x10,%esp
4b5: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
4b8: 83 ec 0c sub $0xc,%esp
4bb: ff 75 f4 pushl -0xc(%ebp)
4be: e8 be 00 00 00 call 581 <close>
4c3: 83 c4 10 add $0x10,%esp
return r;
4c6: 8b 45 f0 mov -0x10(%ebp),%eax
}
4c9: c9 leave
4ca: c3 ret
000004cb <atoi>:
int
atoi(const char *s)
{
4cb: 55 push %ebp
4cc: 89 e5 mov %esp,%ebp
4ce: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
4d1: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
4d8: eb 24 jmp 4fe <atoi+0x33>
n = n*10 + *s++ - '0';
4da: 8b 55 fc mov -0x4(%ebp),%edx
4dd: 89 d0 mov %edx,%eax
4df: c1 e0 02 shl $0x2,%eax
4e2: 01 d0 add %edx,%eax
4e4: 01 c0 add %eax,%eax
4e6: 89 c1 mov %eax,%ecx
4e8: 8b 45 08 mov 0x8(%ebp),%eax
4eb: 8d 50 01 lea 0x1(%eax),%edx
4ee: 89 55 08 mov %edx,0x8(%ebp)
4f1: 8a 00 mov (%eax),%al
4f3: 0f be c0 movsbl %al,%eax
4f6: 01 c8 add %ecx,%eax
4f8: 83 e8 30 sub $0x30,%eax
4fb: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
4fe: 8b 45 08 mov 0x8(%ebp),%eax
501: 8a 00 mov (%eax),%al
503: 3c 2f cmp $0x2f,%al
505: 7e 09 jle 510 <atoi+0x45>
507: 8b 45 08 mov 0x8(%ebp),%eax
50a: 8a 00 mov (%eax),%al
50c: 3c 39 cmp $0x39,%al
50e: 7e ca jle 4da <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
510: 8b 45 fc mov -0x4(%ebp),%eax
}
513: c9 leave
514: c3 ret
00000515 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
515: 55 push %ebp
516: 89 e5 mov %esp,%ebp
518: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
51b: 8b 45 08 mov 0x8(%ebp),%eax
51e: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
521: 8b 45 0c mov 0xc(%ebp),%eax
524: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
527: eb 16 jmp 53f <memmove+0x2a>
*dst++ = *src++;
529: 8b 45 fc mov -0x4(%ebp),%eax
52c: 8d 50 01 lea 0x1(%eax),%edx
52f: 89 55 fc mov %edx,-0x4(%ebp)
532: 8b 55 f8 mov -0x8(%ebp),%edx
535: 8d 4a 01 lea 0x1(%edx),%ecx
538: 89 4d f8 mov %ecx,-0x8(%ebp)
53b: 8a 12 mov (%edx),%dl
53d: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
53f: 8b 45 10 mov 0x10(%ebp),%eax
542: 8d 50 ff lea -0x1(%eax),%edx
545: 89 55 10 mov %edx,0x10(%ebp)
548: 85 c0 test %eax,%eax
54a: 7f dd jg 529 <memmove+0x14>
*dst++ = *src++;
return vdst;
54c: 8b 45 08 mov 0x8(%ebp),%eax
}
54f: c9 leave
550: c3 ret
00000551 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
551: b8 01 00 00 00 mov $0x1,%eax
556: cd 40 int $0x40
558: c3 ret
00000559 <exit>:
SYSCALL(exit)
559: b8 02 00 00 00 mov $0x2,%eax
55e: cd 40 int $0x40
560: c3 ret
00000561 <wait>:
SYSCALL(wait)
561: b8 03 00 00 00 mov $0x3,%eax
566: cd 40 int $0x40
568: c3 ret
00000569 <pipe>:
SYSCALL(pipe)
569: b8 04 00 00 00 mov $0x4,%eax
56e: cd 40 int $0x40
570: c3 ret
00000571 <read>:
SYSCALL(read)
571: b8 05 00 00 00 mov $0x5,%eax
576: cd 40 int $0x40
578: c3 ret
00000579 <write>:
SYSCALL(write)
579: b8 10 00 00 00 mov $0x10,%eax
57e: cd 40 int $0x40
580: c3 ret
00000581 <close>:
SYSCALL(close)
581: b8 15 00 00 00 mov $0x15,%eax
586: cd 40 int $0x40
588: c3 ret
00000589 <kill>:
SYSCALL(kill)
589: b8 06 00 00 00 mov $0x6,%eax
58e: cd 40 int $0x40
590: c3 ret
00000591 <exec>:
SYSCALL(exec)
591: b8 07 00 00 00 mov $0x7,%eax
596: cd 40 int $0x40
598: c3 ret
00000599 <open>:
SYSCALL(open)
599: b8 0f 00 00 00 mov $0xf,%eax
59e: cd 40 int $0x40
5a0: c3 ret
000005a1 <mknod>:
SYSCALL(mknod)
5a1: b8 11 00 00 00 mov $0x11,%eax
5a6: cd 40 int $0x40
5a8: c3 ret
000005a9 <unlink>:
SYSCALL(unlink)
5a9: b8 12 00 00 00 mov $0x12,%eax
5ae: cd 40 int $0x40
5b0: c3 ret
000005b1 <fstat>:
SYSCALL(fstat)
5b1: b8 08 00 00 00 mov $0x8,%eax
5b6: cd 40 int $0x40
5b8: c3 ret
000005b9 <link>:
SYSCALL(link)
5b9: b8 13 00 00 00 mov $0x13,%eax
5be: cd 40 int $0x40
5c0: c3 ret
000005c1 <mkdir>:
SYSCALL(mkdir)
5c1: b8 14 00 00 00 mov $0x14,%eax
5c6: cd 40 int $0x40
5c8: c3 ret
000005c9 <chdir>:
SYSCALL(chdir)
5c9: b8 09 00 00 00 mov $0x9,%eax
5ce: cd 40 int $0x40
5d0: c3 ret
000005d1 <dup>:
SYSCALL(dup)
5d1: b8 0a 00 00 00 mov $0xa,%eax
5d6: cd 40 int $0x40
5d8: c3 ret
000005d9 <getpid>:
SYSCALL(getpid)
5d9: b8 0b 00 00 00 mov $0xb,%eax
5de: cd 40 int $0x40
5e0: c3 ret
000005e1 <sbrk>:
SYSCALL(sbrk)
5e1: b8 0c 00 00 00 mov $0xc,%eax
5e6: cd 40 int $0x40
5e8: c3 ret
000005e9 <sleep>:
SYSCALL(sleep)
5e9: b8 0d 00 00 00 mov $0xd,%eax
5ee: cd 40 int $0x40
5f0: c3 ret
000005f1 <uptime>:
SYSCALL(uptime)
5f1: b8 0e 00 00 00 mov $0xe,%eax
5f6: cd 40 int $0x40
5f8: c3 ret
000005f9 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
5f9: 55 push %ebp
5fa: 89 e5 mov %esp,%ebp
5fc: 83 ec 18 sub $0x18,%esp
5ff: 8b 45 0c mov 0xc(%ebp),%eax
602: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
605: 83 ec 04 sub $0x4,%esp
608: 6a 01 push $0x1
60a: 8d 45 f4 lea -0xc(%ebp),%eax
60d: 50 push %eax
60e: ff 75 08 pushl 0x8(%ebp)
611: e8 63 ff ff ff call 579 <write>
616: 83 c4 10 add $0x10,%esp
}
619: c9 leave
61a: c3 ret
0000061b <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
61b: 55 push %ebp
61c: 89 e5 mov %esp,%ebp
61e: 53 push %ebx
61f: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
622: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
629: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
62d: 74 17 je 646 <printint+0x2b>
62f: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
633: 79 11 jns 646 <printint+0x2b>
neg = 1;
635: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
63c: 8b 45 0c mov 0xc(%ebp),%eax
63f: f7 d8 neg %eax
641: 89 45 ec mov %eax,-0x14(%ebp)
644: eb 06 jmp 64c <printint+0x31>
} else {
x = xx;
646: 8b 45 0c mov 0xc(%ebp),%eax
649: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
64c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
653: 8b 4d f4 mov -0xc(%ebp),%ecx
656: 8d 41 01 lea 0x1(%ecx),%eax
659: 89 45 f4 mov %eax,-0xc(%ebp)
65c: 8b 5d 10 mov 0x10(%ebp),%ebx
65f: 8b 45 ec mov -0x14(%ebp),%eax
662: ba 00 00 00 00 mov $0x0,%edx
667: f7 f3 div %ebx
669: 89 d0 mov %edx,%eax
66b: 8a 80 84 0d 00 00 mov 0xd84(%eax),%al
671: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
675: 8b 5d 10 mov 0x10(%ebp),%ebx
678: 8b 45 ec mov -0x14(%ebp),%eax
67b: ba 00 00 00 00 mov $0x0,%edx
680: f7 f3 div %ebx
682: 89 45 ec mov %eax,-0x14(%ebp)
685: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
689: 75 c8 jne 653 <printint+0x38>
if(neg)
68b: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
68f: 74 0e je 69f <printint+0x84>
buf[i++] = '-';
691: 8b 45 f4 mov -0xc(%ebp),%eax
694: 8d 50 01 lea 0x1(%eax),%edx
697: 89 55 f4 mov %edx,-0xc(%ebp)
69a: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
69f: eb 1c jmp 6bd <printint+0xa2>
putc(fd, buf[i]);
6a1: 8d 55 dc lea -0x24(%ebp),%edx
6a4: 8b 45 f4 mov -0xc(%ebp),%eax
6a7: 01 d0 add %edx,%eax
6a9: 8a 00 mov (%eax),%al
6ab: 0f be c0 movsbl %al,%eax
6ae: 83 ec 08 sub $0x8,%esp
6b1: 50 push %eax
6b2: ff 75 08 pushl 0x8(%ebp)
6b5: e8 3f ff ff ff call 5f9 <putc>
6ba: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
6bd: ff 4d f4 decl -0xc(%ebp)
6c0: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
6c4: 79 db jns 6a1 <printint+0x86>
putc(fd, buf[i]);
}
6c6: 8b 5d fc mov -0x4(%ebp),%ebx
6c9: c9 leave
6ca: c3 ret
000006cb <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
6cb: 55 push %ebp
6cc: 89 e5 mov %esp,%ebp
6ce: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
6d1: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
6d8: 8d 45 0c lea 0xc(%ebp),%eax
6db: 83 c0 04 add $0x4,%eax
6de: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
6e1: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
6e8: e9 54 01 00 00 jmp 841 <printf+0x176>
c = fmt[i] & 0xff;
6ed: 8b 55 0c mov 0xc(%ebp),%edx
6f0: 8b 45 f0 mov -0x10(%ebp),%eax
6f3: 01 d0 add %edx,%eax
6f5: 8a 00 mov (%eax),%al
6f7: 0f be c0 movsbl %al,%eax
6fa: 25 ff 00 00 00 and $0xff,%eax
6ff: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
702: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
706: 75 2c jne 734 <printf+0x69>
if(c == '%'){
708: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
70c: 75 0c jne 71a <printf+0x4f>
state = '%';
70e: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
715: e9 24 01 00 00 jmp 83e <printf+0x173>
} else {
putc(fd, c);
71a: 8b 45 e4 mov -0x1c(%ebp),%eax
71d: 0f be c0 movsbl %al,%eax
720: 83 ec 08 sub $0x8,%esp
723: 50 push %eax
724: ff 75 08 pushl 0x8(%ebp)
727: e8 cd fe ff ff call 5f9 <putc>
72c: 83 c4 10 add $0x10,%esp
72f: e9 0a 01 00 00 jmp 83e <printf+0x173>
}
} else if(state == '%'){
734: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
738: 0f 85 00 01 00 00 jne 83e <printf+0x173>
if(c == 'd'){
73e: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
742: 75 1e jne 762 <printf+0x97>
printint(fd, *ap, 10, 1);
744: 8b 45 e8 mov -0x18(%ebp),%eax
747: 8b 00 mov (%eax),%eax
749: 6a 01 push $0x1
74b: 6a 0a push $0xa
74d: 50 push %eax
74e: ff 75 08 pushl 0x8(%ebp)
751: e8 c5 fe ff ff call 61b <printint>
756: 83 c4 10 add $0x10,%esp
ap++;
759: 83 45 e8 04 addl $0x4,-0x18(%ebp)
75d: e9 d5 00 00 00 jmp 837 <printf+0x16c>
} else if(c == 'x' || c == 'p'){
762: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
766: 74 06 je 76e <printf+0xa3>
768: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
76c: 75 1e jne 78c <printf+0xc1>
printint(fd, *ap, 16, 0);
76e: 8b 45 e8 mov -0x18(%ebp),%eax
771: 8b 00 mov (%eax),%eax
773: 6a 00 push $0x0
775: 6a 10 push $0x10
777: 50 push %eax
778: ff 75 08 pushl 0x8(%ebp)
77b: e8 9b fe ff ff call 61b <printint>
780: 83 c4 10 add $0x10,%esp
ap++;
783: 83 45 e8 04 addl $0x4,-0x18(%ebp)
787: e9 ab 00 00 00 jmp 837 <printf+0x16c>
} else if(c == 's'){
78c: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
790: 75 40 jne 7d2 <printf+0x107>
s = (char*)*ap;
792: 8b 45 e8 mov -0x18(%ebp),%eax
795: 8b 00 mov (%eax),%eax
797: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
79a: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
79e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
7a2: 75 07 jne 7ab <printf+0xe0>
s = "(null)";
7a4: c7 45 f4 ae 0a 00 00 movl $0xaae,-0xc(%ebp)
while(*s != 0){
7ab: eb 1a jmp 7c7 <printf+0xfc>
putc(fd, *s);
7ad: 8b 45 f4 mov -0xc(%ebp),%eax
7b0: 8a 00 mov (%eax),%al
7b2: 0f be c0 movsbl %al,%eax
7b5: 83 ec 08 sub $0x8,%esp
7b8: 50 push %eax
7b9: ff 75 08 pushl 0x8(%ebp)
7bc: e8 38 fe ff ff call 5f9 <putc>
7c1: 83 c4 10 add $0x10,%esp
s++;
7c4: ff 45 f4 incl -0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
7c7: 8b 45 f4 mov -0xc(%ebp),%eax
7ca: 8a 00 mov (%eax),%al
7cc: 84 c0 test %al,%al
7ce: 75 dd jne 7ad <printf+0xe2>
7d0: eb 65 jmp 837 <printf+0x16c>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
7d2: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
7d6: 75 1d jne 7f5 <printf+0x12a>
putc(fd, *ap);
7d8: 8b 45 e8 mov -0x18(%ebp),%eax
7db: 8b 00 mov (%eax),%eax
7dd: 0f be c0 movsbl %al,%eax
7e0: 83 ec 08 sub $0x8,%esp
7e3: 50 push %eax
7e4: ff 75 08 pushl 0x8(%ebp)
7e7: e8 0d fe ff ff call 5f9 <putc>
7ec: 83 c4 10 add $0x10,%esp
ap++;
7ef: 83 45 e8 04 addl $0x4,-0x18(%ebp)
7f3: eb 42 jmp 837 <printf+0x16c>
} else if(c == '%'){
7f5: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
7f9: 75 17 jne 812 <printf+0x147>
putc(fd, c);
7fb: 8b 45 e4 mov -0x1c(%ebp),%eax
7fe: 0f be c0 movsbl %al,%eax
801: 83 ec 08 sub $0x8,%esp
804: 50 push %eax
805: ff 75 08 pushl 0x8(%ebp)
808: e8 ec fd ff ff call 5f9 <putc>
80d: 83 c4 10 add $0x10,%esp
810: eb 25 jmp 837 <printf+0x16c>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
812: 83 ec 08 sub $0x8,%esp
815: 6a 25 push $0x25
817: ff 75 08 pushl 0x8(%ebp)
81a: e8 da fd ff ff call 5f9 <putc>
81f: 83 c4 10 add $0x10,%esp
putc(fd, c);
822: 8b 45 e4 mov -0x1c(%ebp),%eax
825: 0f be c0 movsbl %al,%eax
828: 83 ec 08 sub $0x8,%esp
82b: 50 push %eax
82c: ff 75 08 pushl 0x8(%ebp)
82f: e8 c5 fd ff ff call 5f9 <putc>
834: 83 c4 10 add $0x10,%esp
}
state = 0;
837: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
83e: ff 45 f0 incl -0x10(%ebp)
841: 8b 55 0c mov 0xc(%ebp),%edx
844: 8b 45 f0 mov -0x10(%ebp),%eax
847: 01 d0 add %edx,%eax
849: 8a 00 mov (%eax),%al
84b: 84 c0 test %al,%al
84d: 0f 85 9a fe ff ff jne 6ed <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
853: c9 leave
854: c3 ret
00000855 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
855: 55 push %ebp
856: 89 e5 mov %esp,%ebp
858: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
85b: 8b 45 08 mov 0x8(%ebp),%eax
85e: 83 e8 08 sub $0x8,%eax
861: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
864: a1 a8 0d 00 00 mov 0xda8,%eax
869: 89 45 fc mov %eax,-0x4(%ebp)
86c: eb 24 jmp 892 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
86e: 8b 45 fc mov -0x4(%ebp),%eax
871: 8b 00 mov (%eax),%eax
873: 3b 45 fc cmp -0x4(%ebp),%eax
876: 77 12 ja 88a <free+0x35>
878: 8b 45 f8 mov -0x8(%ebp),%eax
87b: 3b 45 fc cmp -0x4(%ebp),%eax
87e: 77 24 ja 8a4 <free+0x4f>
880: 8b 45 fc mov -0x4(%ebp),%eax
883: 8b 00 mov (%eax),%eax
885: 3b 45 f8 cmp -0x8(%ebp),%eax
888: 77 1a ja 8a4 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
88a: 8b 45 fc mov -0x4(%ebp),%eax
88d: 8b 00 mov (%eax),%eax
88f: 89 45 fc mov %eax,-0x4(%ebp)
892: 8b 45 f8 mov -0x8(%ebp),%eax
895: 3b 45 fc cmp -0x4(%ebp),%eax
898: 76 d4 jbe 86e <free+0x19>
89a: 8b 45 fc mov -0x4(%ebp),%eax
89d: 8b 00 mov (%eax),%eax
89f: 3b 45 f8 cmp -0x8(%ebp),%eax
8a2: 76 ca jbe 86e <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
8a4: 8b 45 f8 mov -0x8(%ebp),%eax
8a7: 8b 40 04 mov 0x4(%eax),%eax
8aa: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
8b1: 8b 45 f8 mov -0x8(%ebp),%eax
8b4: 01 c2 add %eax,%edx
8b6: 8b 45 fc mov -0x4(%ebp),%eax
8b9: 8b 00 mov (%eax),%eax
8bb: 39 c2 cmp %eax,%edx
8bd: 75 24 jne 8e3 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
8bf: 8b 45 f8 mov -0x8(%ebp),%eax
8c2: 8b 50 04 mov 0x4(%eax),%edx
8c5: 8b 45 fc mov -0x4(%ebp),%eax
8c8: 8b 00 mov (%eax),%eax
8ca: 8b 40 04 mov 0x4(%eax),%eax
8cd: 01 c2 add %eax,%edx
8cf: 8b 45 f8 mov -0x8(%ebp),%eax
8d2: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
8d5: 8b 45 fc mov -0x4(%ebp),%eax
8d8: 8b 00 mov (%eax),%eax
8da: 8b 10 mov (%eax),%edx
8dc: 8b 45 f8 mov -0x8(%ebp),%eax
8df: 89 10 mov %edx,(%eax)
8e1: eb 0a jmp 8ed <free+0x98>
} else
bp->s.ptr = p->s.ptr;
8e3: 8b 45 fc mov -0x4(%ebp),%eax
8e6: 8b 10 mov (%eax),%edx
8e8: 8b 45 f8 mov -0x8(%ebp),%eax
8eb: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
8ed: 8b 45 fc mov -0x4(%ebp),%eax
8f0: 8b 40 04 mov 0x4(%eax),%eax
8f3: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
8fa: 8b 45 fc mov -0x4(%ebp),%eax
8fd: 01 d0 add %edx,%eax
8ff: 3b 45 f8 cmp -0x8(%ebp),%eax
902: 75 20 jne 924 <free+0xcf>
p->s.size += bp->s.size;
904: 8b 45 fc mov -0x4(%ebp),%eax
907: 8b 50 04 mov 0x4(%eax),%edx
90a: 8b 45 f8 mov -0x8(%ebp),%eax
90d: 8b 40 04 mov 0x4(%eax),%eax
910: 01 c2 add %eax,%edx
912: 8b 45 fc mov -0x4(%ebp),%eax
915: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
918: 8b 45 f8 mov -0x8(%ebp),%eax
91b: 8b 10 mov (%eax),%edx
91d: 8b 45 fc mov -0x4(%ebp),%eax
920: 89 10 mov %edx,(%eax)
922: eb 08 jmp 92c <free+0xd7>
} else
p->s.ptr = bp;
924: 8b 45 fc mov -0x4(%ebp),%eax
927: 8b 55 f8 mov -0x8(%ebp),%edx
92a: 89 10 mov %edx,(%eax)
freep = p;
92c: 8b 45 fc mov -0x4(%ebp),%eax
92f: a3 a8 0d 00 00 mov %eax,0xda8
}
934: c9 leave
935: c3 ret
00000936 <morecore>:
static Header*
morecore(uint nu)
{
936: 55 push %ebp
937: 89 e5 mov %esp,%ebp
939: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
93c: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
943: 77 07 ja 94c <morecore+0x16>
nu = 4096;
945: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
94c: 8b 45 08 mov 0x8(%ebp),%eax
94f: c1 e0 03 shl $0x3,%eax
952: 83 ec 0c sub $0xc,%esp
955: 50 push %eax
956: e8 86 fc ff ff call 5e1 <sbrk>
95b: 83 c4 10 add $0x10,%esp
95e: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
961: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
965: 75 07 jne 96e <morecore+0x38>
return 0;
967: b8 00 00 00 00 mov $0x0,%eax
96c: eb 26 jmp 994 <morecore+0x5e>
hp = (Header*)p;
96e: 8b 45 f4 mov -0xc(%ebp),%eax
971: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
974: 8b 45 f0 mov -0x10(%ebp),%eax
977: 8b 55 08 mov 0x8(%ebp),%edx
97a: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
97d: 8b 45 f0 mov -0x10(%ebp),%eax
980: 83 c0 08 add $0x8,%eax
983: 83 ec 0c sub $0xc,%esp
986: 50 push %eax
987: e8 c9 fe ff ff call 855 <free>
98c: 83 c4 10 add $0x10,%esp
return freep;
98f: a1 a8 0d 00 00 mov 0xda8,%eax
}
994: c9 leave
995: c3 ret
00000996 <malloc>:
void*
malloc(uint nbytes)
{
996: 55 push %ebp
997: 89 e5 mov %esp,%ebp
999: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
99c: 8b 45 08 mov 0x8(%ebp),%eax
99f: 83 c0 07 add $0x7,%eax
9a2: c1 e8 03 shr $0x3,%eax
9a5: 40 inc %eax
9a6: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
9a9: a1 a8 0d 00 00 mov 0xda8,%eax
9ae: 89 45 f0 mov %eax,-0x10(%ebp)
9b1: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
9b5: 75 23 jne 9da <malloc+0x44>
base.s.ptr = freep = prevp = &base;
9b7: c7 45 f0 a0 0d 00 00 movl $0xda0,-0x10(%ebp)
9be: 8b 45 f0 mov -0x10(%ebp),%eax
9c1: a3 a8 0d 00 00 mov %eax,0xda8
9c6: a1 a8 0d 00 00 mov 0xda8,%eax
9cb: a3 a0 0d 00 00 mov %eax,0xda0
base.s.size = 0;
9d0: c7 05 a4 0d 00 00 00 movl $0x0,0xda4
9d7: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
9da: 8b 45 f0 mov -0x10(%ebp),%eax
9dd: 8b 00 mov (%eax),%eax
9df: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
9e2: 8b 45 f4 mov -0xc(%ebp),%eax
9e5: 8b 40 04 mov 0x4(%eax),%eax
9e8: 3b 45 ec cmp -0x14(%ebp),%eax
9eb: 72 4d jb a3a <malloc+0xa4>
if(p->s.size == nunits)
9ed: 8b 45 f4 mov -0xc(%ebp),%eax
9f0: 8b 40 04 mov 0x4(%eax),%eax
9f3: 3b 45 ec cmp -0x14(%ebp),%eax
9f6: 75 0c jne a04 <malloc+0x6e>
prevp->s.ptr = p->s.ptr;
9f8: 8b 45 f4 mov -0xc(%ebp),%eax
9fb: 8b 10 mov (%eax),%edx
9fd: 8b 45 f0 mov -0x10(%ebp),%eax
a00: 89 10 mov %edx,(%eax)
a02: eb 26 jmp a2a <malloc+0x94>
else {
p->s.size -= nunits;
a04: 8b 45 f4 mov -0xc(%ebp),%eax
a07: 8b 40 04 mov 0x4(%eax),%eax
a0a: 2b 45 ec sub -0x14(%ebp),%eax
a0d: 89 c2 mov %eax,%edx
a0f: 8b 45 f4 mov -0xc(%ebp),%eax
a12: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
a15: 8b 45 f4 mov -0xc(%ebp),%eax
a18: 8b 40 04 mov 0x4(%eax),%eax
a1b: c1 e0 03 shl $0x3,%eax
a1e: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
a21: 8b 45 f4 mov -0xc(%ebp),%eax
a24: 8b 55 ec mov -0x14(%ebp),%edx
a27: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
a2a: 8b 45 f0 mov -0x10(%ebp),%eax
a2d: a3 a8 0d 00 00 mov %eax,0xda8
return (void*)(p + 1);
a32: 8b 45 f4 mov -0xc(%ebp),%eax
a35: 83 c0 08 add $0x8,%eax
a38: eb 3b jmp a75 <malloc+0xdf>
}
if(p == freep)
a3a: a1 a8 0d 00 00 mov 0xda8,%eax
a3f: 39 45 f4 cmp %eax,-0xc(%ebp)
a42: 75 1e jne a62 <malloc+0xcc>
if((p = morecore(nunits)) == 0)
a44: 83 ec 0c sub $0xc,%esp
a47: ff 75 ec pushl -0x14(%ebp)
a4a: e8 e7 fe ff ff call 936 <morecore>
a4f: 83 c4 10 add $0x10,%esp
a52: 89 45 f4 mov %eax,-0xc(%ebp)
a55: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
a59: 75 07 jne a62 <malloc+0xcc>
return 0;
a5b: b8 00 00 00 00 mov $0x0,%eax
a60: eb 13 jmp a75 <malloc+0xdf>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
a62: 8b 45 f4 mov -0xc(%ebp),%eax
a65: 89 45 f0 mov %eax,-0x10(%ebp)
a68: 8b 45 f4 mov -0xc(%ebp),%eax
a6b: 8b 00 mov (%eax),%eax
a6d: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
a70: e9 6d ff ff ff jmp 9e2 <malloc+0x4c>
}
a75: c9 leave
a76: c3 ret
|
unittests/ASM/3DNow/A7.asm | Seas0/FEX | 0 | 166198 | %ifdef CONFIG
{
"RegData": {
"MM0": ["0x9192939481828384", "0x0"],
"MM1": ["0xB1B2B3B4A1A2A3A4", "0x0"]
}
}
%endif
movq mm0, [rel data1]
movq mm1, [rel data2]
; Legitimate to implement as a move if the rsqrt or recip instruction does the full calculation
pfrsqit1 mm0, [rel data3]
pfrsqit1 mm1, [rel data4]
hlt
align 8
data1:
dd 0x41424344
dd 0x51525354
data2:
dd 0x61626364
dd 0x71727374
data3:
dd 0x81828384
dd 0x91929394
data4:
dd 0xA1A2A3A4
dd 0xB1B2B3B4
|
src/syscalls.asm | Iemnur/Mother2GbaTranslation | 149 | 245949 | cpufastset:
swi 0xC
bx lr
|
example_relationships/src/many_to_many_associative.adb | cortlandstarrett/mcada | 0 | 8573 | <filename>example_relationships/src/many_to_many_associative.adb
-- *************************************************************************************
--
-- The recipient is warned that this code should be handled in accordance
-- with the HM Government Security Classification indicated throughout.
--
-- This code and its contents shall not be used for other than UK Government
-- purposes.
--
-- The copyright in this code is the property of BAE SYSTEMS Electronic Systems Limited.
-- The Code is supplied by BAE SYSTEMS on the express terms that it is to be treated in
-- confidence and that it may not be copied, used or disclosed to others for any
-- purpose except in accordance with DEFCON 91 (Edn 10/92).
--
-- File Name: Many_To_Many_Associative.adb
-- Version: As detailed by ClearCase
-- Version Date: As detailed by ClearCase
-- Creation Date: 03-11-99
-- Security Classification: Unclassified
-- Project: SRLE (Sting Ray Life Extension)
-- Author: <NAME>
-- Section: Tactical Software/ Software Architecture
-- Division: Underwater Systems Division
-- Description: Generic implementation of 1-M:M relationship
-- Comments:
--
-- MODIFICATION RECORD
-- --------------------
-- NAME DATE ECR No MODIFICATION
--
-- DB 24/09/01 PILOT_0000_2473 Rename Link, Unlink & Unassociate parameters
-- to match those for 1:1 type relationships,
-- at the request of George.
--
-- db 17/04/02 SRLE100003005 Correlated associative navigations supported.
--
-- db 22/04/02 SRLE100002907 Procedure initialise removed as surplus to requirements
--
-- db 09/05/02 SRLE100002899 Role phrase string is limited to 32 characters
-- by calling routine, no checks necessary here.
--
-- db 14/08/02 SRLE100003644 Correlated associative navigations leave
-- iteration lists on the heap, remove them.
--
-- db 10/10/02 SRLE100003928 Remove null checks on source navigates and
-- calls to log.
--
-- db 03/12/02 SRLE100004150 Add extra check for navigate from empty set
--
-- DNS 20/05/15 CR 10265 For Navigate procedures returning a list,
-- the Return is now an "in" parameter
--
-- **************************************************************************************
with Root_Object;
use type Root_Object.Object_Access;
use type Root_Object.Object_List.Node_Access_Type;
with Ada.Tags;
use type Ada.Tags.Tag;
with One_To_Many_Associative;
package body Many_To_Many_Associative is
------------------------------------------------------------------------
package M1_Single_M2_Multiple is new One_To_Many_Associative;
package M2_Single_M1_Multiple is new One_To_Many_Associative;
------------------------------------------------------------------------
M1_Side: Ada.Tags.Tag;
M2_Side: Ada.Tags.Tag;
Associative_Side: Ada.Tags.Tag;
---------------------------------------------------------------------
procedure Register_M1_End_Class (M1_Instance: in Ada.Tags.Tag) is
begin
M1_Side := M1_Instance;
M1_Single_M2_Multiple.Register_Single_End_Class (M1_Instance);
M2_Single_M1_Multiple.Register_Multiple_End_Class (M1_Instance);
end Register_M1_End_Class;
---------------------------------------------------------------------
function Report_M1_End_Class return Ada.Tags.Tag is
begin
return M1_Side;
end Report_M1_End_Class;
-----------------------------------------------------------------------
procedure Register_M2_End_Class (M2_Instance: in Ada.Tags.Tag) is
begin
M2_Side := M2_Instance;
M1_Single_M2_Multiple.Register_Multiple_End_Class (M2_Instance);
M2_Single_M1_Multiple.Register_Single_End_Class (M2_Instance);
end Register_M2_End_Class;
---------------------------------------------------------------------
function Report_M2_End_Class return Ada.Tags.Tag is
begin
return M2_Side;
end Report_M2_End_Class;
-----------------------------------------------------------------------
procedure Register_Associative_End_Class (Associative_Instance: in Ada.Tags.Tag) is
begin
Associative_Side := Associative_Instance;
M1_Single_M2_Multiple.Register_Associative_End_Class (Associative_Instance);
M2_Single_M1_Multiple.Register_Associative_End_Class (Associative_Instance);
end Register_Associative_End_Class;
---------------------------------------------------------------------
function Report_Associative_End_Class return Ada.Tags.Tag is
begin
return Associative_Side;
end Report_Associative_End_Class;
---------------------------------------------------------------------
procedure Link (
A_Instance : in Root_Object.Object_Access;
B_Instance : in Root_Object.Object_Access;
Using : in Root_Object.Object_Access) is
begin
M1_Single_M2_Multiple.Link (
A_Instance => A_Instance,
B_Instance => B_Instance,
Using => Using);
M2_Single_M1_Multiple.Link (
A_Instance => A_Instance,
B_Instance => B_Instance,
Using => Using);
end Link;
-----------------------------------------------------------------------
procedure Unassociate (
A_Instance : in Root_Object.Object_Access;
B_Instance : in Root_Object.Object_Access;
From : in Root_Object.Object_Access) is
begin
M1_Single_M2_Multiple.Unassociate (
A_Instance => A_Instance,
B_Instance => B_Instance,
From => From);
M2_Single_M1_Multiple.Unassociate (
A_Instance => B_Instance,
B_Instance => A_Instance,
From => From);
end Unassociate;
-----------------------------------------------------------------------
procedure Unlink (
A_Instance : in Root_Object.Object_Access;
B_Instance : in Root_Object.Object_Access) is
begin
M1_Single_M2_Multiple.Unlink (
A_Instance => A_Instance,
B_Instance => B_Instance);
M2_Single_M1_Multiple.Unlink (
A_Instance => B_Instance,
B_Instance => A_Instance);
end Unlink;
-----------------------------------------------------------------------
procedure Navigate (
From : in Root_Object.Object_List.List_Header_Access_Type;
Class : in Ada.Tags.Tag;
To : in Root_Object.Object_List.List_Header_Access_Type) is
The_A_Instance: Root_Object.Object_Access;
begin
The_A_Instance := Root_Object.Object_List.First_Entry_Of (From).Item;
if The_A_Instance /= null then
if The_A_Instance.all'tag = M1_Side then
M1_Single_M2_Multiple.Navigate (
From => From,
Class => Class,
To => To);
elsif The_A_Instance.all'tag = M2_Side then
M2_Single_M1_Multiple.Navigate (
From => From,
Class => Class,
To => To);
elsif The_A_Instance.all'tag = Associative_Side then
if Class = M2_Side then
M1_Single_M2_Multiple.Navigate (
From => From,
Class => Class,
To => To);
elsif Class = M1_Side then
M2_Single_M1_Multiple.Navigate (
From => From,
Class => Class,
To => To);
end if;
end if;
end if;
end Navigate;
---------------------------------------------------------------------
procedure Navigate (
From : in Root_Object.Object_Access;
Class : in Ada.Tags.Tag;
To : in Root_Object.Object_List.List_Header_Access_Type) is
--
-- navigate from a single to a set
-- valid for:
-- M1 -> M2
-- M1 -> A
-- M2 -> M1
-- M2 -> A
--
begin
if From.all'tag = M1_Side then
M1_Single_M2_Multiple.Navigate (
From => From,
Class => Class,
To => To);
elsif From.all'tag = M2_Side then
M2_Single_M1_Multiple.Navigate (
From => From,
Class => Class,
To => To);
elsif From.all'tag = Associative_Side then
if Class = M2_Side then
M1_Single_M2_Multiple.Navigate (
From => From,
Class => Class,
To => To);
elsif Class = M1_Side then
M2_Single_M1_Multiple.Navigate (
From => From,
Class => Class,
To => To);
end if;
end if;
end Navigate;
---------------------------------------------------------------------
procedure Navigate (
From : in Root_Object.Object_Access;
Class : in Ada.Tags.Tag;
To : out Root_Object.Object_Access) is
--
-- navigate from a single to a single
-- valid for:
-- A -> M1
-- A -> M2
--
begin
if From.all'tag = Associative_Side then
if Class = M2_Side then
M1_Single_M2_Multiple.Navigate (
From => From,
Class => Class,
To => To);
elsif Class = M1_Side then
M2_Single_M1_Multiple.Navigate (
From => From,
Class => Class,
To => To);
end if;
end if;
end Navigate;
---------------------------------------------------------------------
-- associative correlated navigation
procedure Navigate (
From : in Root_Object.Object_Access;
Also : in Root_Object.Object_Access;
Class : in Ada.Tags.Tag;
To : out Root_Object.Object_Access) is
--
-- navigate from two singles to a single
-- valid for:
-- M1 and M2 -> A
-- M1 and M2 -> A
Temp_Associative_One, Temp_Associative_Two : Root_Object.Object_Access := null;
Assoc_Set_One : Root_Object.Object_List.List_Header_Access_Type := Root_Object.Object_List.Initialise;
Assoc_Set_Two : Root_Object.Object_List.List_Header_Access_Type := Root_Object.Object_List.Initialise;
Matched, Inner_Matched : Boolean := FALSE;
begin
-- Reset the output pointer to null so that if we don't find anything
-- useful, the caller can check for it.
To := null;
if ((( From.all'tag = M1_Side) and then
( Also.all'Tag = M2_Side))
or else (( From.all'tag = M2_Side) and then
( Also.all'Tag = M1_Side)))
then
-- Navigate from single instance of first object
-- returns a set.
Navigate (
From => Also,
Class => Class,
To => Assoc_Set_One);
-- Navigate from single instance of second object
-- returns a set.
Navigate (
From => From,
Class => Class,
To => Assoc_Set_Two);
-- Compare results of the two sets from the above navigations.
-- A nice simple find operation on a set would be appropriate here, but
-- there isn't one available, so do it the hard way.
-- Outer loop
declare
use type Root_Object.Object_List.Node_Access_Type;
Temp_Entry : Root_Object.Object_List.Node_Access_Type;
Matched : boolean := FALSE;
begin
-- Grab the first entry of the set
Temp_Entry := Root_Object.Object_List.First_Entry_Of(Assoc_Set_One);
-- While the set is not empty and the entry does not match the
-- assoc instance already found, burn rubber
while (not Matched) and (Temp_Entry /= null) loop
Temp_Associative_One := Temp_Entry.Item;
-- Compare this entry against the other set.
-- Inner loop
declare
use type Root_Object.Object_List.Node_Access_Type;
Inner_Temp_Entry : Root_Object.Object_List.Node_Access_Type;
begin
-- Grab the first entry of the set
Inner_Temp_Entry := Root_Object.Object_List.First_Entry_Of(Assoc_Set_Two);
-- While the set is not empty and the entry does not match the
-- assoc instance already found, smoke 'em
while (not matched) and (Inner_Temp_Entry /= null) loop
Temp_Associative_Two := Inner_Temp_Entry.Item;
-- If M-M:M associative was ever implemented,
-- it would be easy to add the matched instance into a set for
-- return from this procedure.
Matched := Temp_Associative_One = Temp_Associative_Two;
if not Matched then
Inner_Temp_Entry := Root_Object.Object_List.Next_Entry_Of(Assoc_Set_Two);
end if;
end loop; -- end of (Temp_Entry /= null) or else Matched loop
end;
Temp_Entry := Root_Object.Object_List.Next_Entry_Of(Assoc_Set_One);
end loop; -- end of (Temp_Entry /= null) and not matched loop
if Matched and then Temp_associative_One /= null then
-- Gotcha
To := Temp_Associative_One;
end if;
end;
Root_Object.Object_List.Destroy_List(Assoc_Set_One);
Root_Object.Object_List.Destroy_List(Assoc_Set_Two);
end if;
end Navigate;
-----------------------------------------------------------------------
end Many_To_Many_Associative;
|
src/flickering_shadow_fix.asm | mvdhout1992/ts-patches | 33 | 165963 | ; Disable Flickering Shadow When Vehicles With Turrets Flash
; The shadow is originally hardcoded to not draw two out of every four game
; frames. This looks strange and is kinda inconsistent with infantry and units
; without turrets. This hack disables this feature.
; Author: AlexB
; Date: 2016-03-25, 2016-11-24
%include "macros/patch.inc"
@SET 0x0063587E, {and eax, DWORD 0}
|
oeis/078/A078031.asm | neoneye/loda-programs | 11 | 168779 | ; A078031: Expansion of (1-x)/(1 + x^2 - x^3).
; Submitted by <NAME>
; 1,-1,-1,2,0,-3,2,3,-5,-1,8,-4,-9,12,5,-21,7,26,-28,-19,54,-9,-73,63,64,-136,-1,200,-135,-201,335,66,-536,269,602,-805,-333,1407,-472,-1740,1879,1268,-3619,611,4887,-4230,-4276,9117,46,-13393,9071,13439,-22464,-4368,35903,-18096,-40271,53999,22175,-94270,31824,116445,-126094,-84621,242539,-41473,-327160,284012,285687,-611172,-1675,896859,-609497,-898534,1506356,289037,-2404890,1217319,2693927,-3622209,-1476608,6316136,-2145601,-7792744,8461737,5647143,-16254481,2814594,21901624,-19069075
mov $3,1
lpb $0
sub $0,1
add $1,$3
sub $3,$1
add $1,$3
sub $2,$1
add $3,$2
lpe
mov $0,$3
|
test/Fail/Issue3331.agda | shlevy/agda | 1,989 | 12523 | <filename>test/Fail/Issue3331.agda
-- Andreas, 2018-10-29, issue #3331
-- Document that using and renaming lists cannot overlap.
open import Agda.Builtin.Bool using (true) renaming (true to tt)
-- Expected error:
-- Repeated name in import directive: true
|
source/web/tools/a2js/properties-tools.adb | svn2github/matreshka | 24 | 13228 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015-2018, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Asis.Clauses;
with Asis.Compilation_Units;
with Asis.Declarations;
with Asis.Definitions;
with Asis.Elements;
with Asis.Expressions;
with Asis.Iterator;
with Asis.Statements;
with League.String_Vectors;
package body Properties.Tools is
function Name_Image
(Name : Asis.Name) return League.Strings.Universal_String;
function Full_Type_View
(Type_Definition : Asis.Type_Definition) return Asis.Type_Definition;
--------------------------
-- Attribute_Definition --
--------------------------
function Attribute_Definition
(Decl : Asis.Declaration;
Attr : Wide_String) return Asis.Expression
is
Parent : constant Asis.Declaration := Enclosing_Declaration (Decl);
Name : Asis.Name := Asis.Declarations.Names (Decl) (1);
Image : constant Wide_String :=
Asis.Declarations.Defining_Name_Image (Name);
begin
case Asis.Elements.Declaration_Kind (Parent) is
when Asis.A_Package_Declaration =>
declare
use type Asis.Expression_Kinds;
use type Asis.Representation_Clause_Kinds;
use type Asis.Declaration_List;
List : constant Asis.Declaration_List :=
Asis.Declarations.Visible_Part_Declarative_Items (Parent) &
Asis.Declarations.Private_Part_Declarative_Items (Parent);
begin
for Item in List'Range loop
if Asis.Elements.Representation_Clause_Kind (List (Item))
= Asis.An_Attribute_Definition_Clause
then
Name :=
Asis.Clauses.Representation_Clause_Name (List (Item));
if Asis.Elements.Expression_Kind (Name) =
Asis.An_Attribute_Reference
and then
Asis.Expressions.Name_Image
(Asis.Expressions.Prefix (Name)) = Image
and then
Asis.Expressions.Name_Image
(Asis.Expressions.Attribute_Designator_Identifier
(Name)) = Attr
then
return Asis.Clauses.Representation_Clause_Expression
(List (Item));
end if;
end if;
end loop;
end;
when others =>
null;
end case;
return Asis.Nil_Element;
end Attribute_Definition;
--------------------------------
-- Array_Component_Definition --
--------------------------------
function Array_Component_Definition
(Type_Definition : Asis.Type_Definition)
return Asis.Component_Definition
is
Subtipe_Indication : Asis.Subtype_Indication;
Mark : Asis.Expression;
Decl : Asis.Declaration;
View : Asis.Type_Definition :=
Type_Declaration_View
(Asis.Elements.Enclosing_Element (Type_Definition));
begin
if Asis.Elements.Type_Kind (View) in Asis.An_Access_Type_Definition then
Subtipe_Indication :=
Asis.Definitions.Access_To_Object_Definition (View);
Mark := Asis.Definitions.Subtype_Mark (Subtipe_Indication);
Decl := Corresponding_Declaration (Mark);
View := Asis.Declarations.Type_Declaration_View (Decl);
end if;
return Asis.Definitions.Array_Component_Definition (View);
end Array_Component_Definition;
-----------
-- Comma --
-----------
function Comma
(Left, Right : League.Strings.Universal_String)
return League.Strings.Universal_String
is
use type League.Strings.Universal_String;
begin
if Left.Is_Empty then
return Right;
elsif Right.Is_Empty then
return Left;
else
return Left & "," & Right;
end if;
end Comma;
-------------------------------
-- Corresponding_Declaration --
-------------------------------
function Corresponding_Declaration
(Name : Asis.Expression) return Asis.Declaration
is
Mark : Asis.Subtype_Mark := Name;
begin
case Asis.Elements.Expression_Kind (Mark) is
when Asis.A_Selected_Component =>
Mark := Asis.Expressions.Selector (Mark);
when others =>
null;
end case;
return Asis.Expressions.Corresponding_Name_Declaration (Mark);
end Corresponding_Declaration;
------------------------
-- Corresponding_Type --
------------------------
function Corresponding_Type
(Declaration : Asis.Declaration) return Asis.Declaration
is
List : constant Asis.Declaration_List :=
Asis.Declarations.Parameter_Profile (Declaration);
View : constant Asis.Element :=
Asis.Declarations.Object_Declaration_View (List (List'First));
Mark : Asis.Subtype_Mark;
begin
case Asis.Elements.Access_Definition_Kind (View) is
when Asis.An_Anonymous_Access_To_Variable |
Asis.An_Anonymous_Access_To_Constant =>
Mark :=
Asis.Definitions.Anonymous_Access_To_Object_Subtype_Mark (View);
when others =>
Mark := View;
end case;
return Corresponding_Declaration (Mark);
end Corresponding_Type;
-----------------------------------
-- Corresponding_Type_Components --
-----------------------------------
function Corresponding_Type_Components
(Definition : Asis.Definition) return Asis.Declaration_List
is
function Filter
(List : Asis.Record_Component_List)
return Asis.Declaration_List;
-- Filter out anything except component declaration, flatten variants.
function Flatten_Variant_List
(List : Asis.Variant_List)
return Asis.Declaration_List;
-- The same for given Variant_List
------------
-- Filter --
------------
function Filter
(List : Asis.Record_Component_List)
return Asis.Declaration_List
is
use type Asis.Record_Component_List;
begin
for J in List'Range loop
case Asis.Elements.Element_Kind (List (J)) is
when Asis.A_Declaration =>
null;
when Asis.A_Clause =>
return List (List'First .. J - 1) &
Filter (List (J + 1 .. List'Last));
when Asis.A_Definition =>
case Asis.Elements.Definition_Kind (List (J)) is
when Asis.A_Variant_Part =>
return List (List'First .. J - 1) &
Corresponding_Type_Components (List (J)) &
Filter (List (J + 1 .. List'Last));
when others =>
return List (List'First .. J - 1) &
Filter (List (J + 1 .. List'Last));
end case;
when others =>
raise Constraint_Error;
end case;
end loop;
return List;
end Filter;
--------------------------
-- Flatten_Variant_List --
--------------------------
function Flatten_Variant_List
(List : Asis.Variant_List)
return Asis.Declaration_List
is
Length : Natural := 0;
begin
for J in List'Range loop
declare
X : constant Asis.Declaration_List :=
Asis.Definitions.Record_Components (List (J));
begin
Length := Length + X'Length;
end;
end loop;
declare
Result : Asis.Declaration_List (1 .. Length);
begin
Length := 0;
for J in List'Range loop
declare
X : constant Asis.Declaration_List :=
Asis.Definitions.Record_Components (List (J));
begin
Result (Length + 1 .. Length + X'Length) := X;
Length := Length + X'Length;
end;
end loop;
return Filter (Result);
end;
end Flatten_Variant_List;
Def_Kind : constant Asis.Definition_Kinds :=
Asis.Elements.Definition_Kind (Definition);
Type_Kind : constant Asis.Type_Kinds :=
Asis.Elements.Type_Kind (Definition);
begin
case Def_Kind is
when Asis.A_Null_Record_Definition =>
return Asis.Nil_Element_List;
when Asis.A_Private_Type_Definition |
Asis.A_Tagged_Private_Type_Definition
=>
return Corresponding_Type_Components (Full_Type_View (Definition));
when Asis.A_Record_Definition =>
return Filter (Asis.Definitions.Record_Components (Definition));
when Asis.A_Type_Definition =>
case Type_Kind is
when Asis.A_Derived_Record_Extension_Definition |
Asis.A_Record_Type_Definition |
Asis.A_Tagged_Record_Type_Definition =>
return Corresponding_Type_Components
(Asis.Definitions.Record_Definition (Definition));
when Asis.An_Interface_Type_Definition =>
return Asis.Nil_Element_List;
when Asis.A_Derived_Type_Definition =>
return Corresponding_Type_Components
(Type_Declaration_View
(Asis.Elements.Enclosing_Element (Definition)));
when others =>
raise Program_Error;
end case;
when Asis.A_Variant_Part =>
return Flatten_Variant_List
(Asis.Definitions.Variants (Definition));
when others =>
raise Program_Error;
end case;
end Corresponding_Type_Components;
--------------------------------------
-- Corresponding_Type_Discriminants --
--------------------------------------
function Corresponding_Type_Discriminants
(Definition : Asis.Definition) return Asis.Declaration_List
is
function Discriminants
(Decl : Asis.Declaration) return Asis.Declaration_List;
function Parent_Discriminants
(Parent : Asis.Subtype_Indication) return Asis.Declaration_List;
-------------------
-- Discriminants --
-------------------
function Discriminants
(Decl : Asis.Declaration) return Asis.Declaration_List
is
Kind : constant Asis.Declaration_Kinds :=
Asis.Elements.Declaration_Kind (Decl);
begin
case Kind is
when Asis.A_Full_Type_Declaration |
Asis.A_Private_Extension_Declaration =>
declare
Part : constant Asis.Element :=
Asis.Declarations.Discriminant_Part (Decl);
View : constant Asis.Element :=
Asis.Declarations.Type_Declaration_View (Decl);
View_Kind : constant Asis.Type_Kinds :=
Asis.Elements.Type_Kind (View);
Parent : Asis.Subtype_Indication;
Constr : Asis.Constraint;
begin
case Asis.Elements.Definition_Kind (Part) is
when Asis.A_Known_Discriminant_Part =>
return Asis.Definitions.Discriminants (Part);
when others =>
null;
end case;
case View_Kind is
when Asis.A_Derived_Type_Definition |
Asis.A_Derived_Record_Extension_Definition =>
Parent :=
Asis.Definitions.Parent_Subtype_Indication (View);
Constr := Asis.Definitions.Subtype_Constraint (Parent);
if Asis.Elements.Is_Nil (Constr) then
return Parent_Discriminants (Parent);
else
return Asis.Nil_Element_List;
end if;
when others =>
null;
end case;
end;
when others =>
null;
end case;
return Asis.Nil_Element_List;
end Discriminants;
--------------------------
-- Parent_Discriminants --
--------------------------
function Parent_Discriminants
(Parent : Asis.Subtype_Indication) return Asis.Declaration_List
is
Mark : constant Asis.Subtype_Mark :=
Asis.Definitions.Subtype_Mark (Parent);
Decl : constant Asis.Declaration := Corresponding_Declaration (Mark);
begin
return Discriminants (Decl);
end Parent_Discriminants;
Decl : constant Asis.Declaration :=
Asis.Elements.Enclosing_Element (Definition);
begin
return Discriminants (Decl);
end Corresponding_Type_Discriminants;
------------------------------------
-- Corresponding_Type_Subprograms --
------------------------------------
function Corresponding_Type_Subprograms
(Definition : Asis.Definition) return Asis.Declaration_List
is
use type Asis.Declaration_Kinds;
Decl : constant Asis.Declaration :=
Asis.Elements.Enclosing_Element (Definition);
Pkg : constant Asis.Element := Asis.Elements.Enclosing_Element (Decl);
begin
if Asis.Elements.Declaration_Kind (Pkg) = Asis.A_Package_Declaration then
declare
use type Asis.Element_List;
List : Asis.Element_List :=
Asis.Declarations.Visible_Part_Declarative_Items (Pkg) &
Asis.Declarations.Private_Part_Declarative_Items (Pkg);
Last : Natural := 0;
begin
for J in List'Range loop
if Asis.Elements.Declaration_Kind (List (J)) in
Asis.A_Procedure_Declaration
| Asis.A_Null_Procedure_Declaration
| Asis.A_Function_Declaration
| Asis.An_Expression_Function_Declaration
and then Is_Primitive_Subprogram (Definition, List (J))
then
Last := Last + 1;
List (Last) := List (J);
end if;
end loop;
return List (1 .. Last);
end;
else
return Asis.Nil_Element_List;
end if;
end Corresponding_Type_Subprograms;
---------------------------
-- Enclosing_Declaration --
---------------------------
function Enclosing_Declaration (X : Asis.Element) return Asis.Declaration is
use type Asis.Element_Kinds;
Parent : Asis.Element := Asis.Elements.Enclosing_Element (X);
begin
while not Asis.Elements.Is_Nil (Parent) and then
Asis.Elements.Element_Kind (Parent) /= Asis.A_Declaration
loop
Parent := Asis.Elements.Enclosing_Element (Parent);
end loop;
return Parent;
end Enclosing_Declaration;
--------------------
-- Full_Type_View --
--------------------
function Full_Type_View
(Type_Definition : Asis.Type_Definition) return Asis.Type_Definition
is
Decl : Asis.Declaration :=
Asis.Elements.Enclosing_Element (Type_Definition);
begin
while Asis.Elements.Declaration_Kind (Decl) in
Asis.An_Incomplete_Type_Declaration |
Asis.A_Tagged_Incomplete_Type_Declaration |
Asis.A_Private_Type_Declaration |
Asis.A_Private_Extension_Declaration
loop
Decl :=
Asis.Declarations.Corresponding_Type_Completion (Decl);
end loop;
return Asis.Declarations.Type_Declaration_View (Decl);
end Full_Type_View;
----------------
-- Get_Aspect --
----------------
function Get_Aspect
(Element : Asis.Declaration;
Name : Wide_String)
return Wide_String
is
Mark : Asis.Expression;
List : constant Asis.Declaration_List :=
Asis.Declarations.Aspect_Specifications (Element);
begin
for J in List'Range loop
Mark := Asis.Definitions.Aspect_Mark (List (J));
if Asis.Expressions.Name_Image (Mark) = Name then
declare
Exp : constant Asis.Expression :=
Asis.Definitions.Aspect_Definition (List (J));
begin
case Asis.Elements.Expression_Kind (Exp) is
when Asis.An_Integer_Literal |
Asis.A_Real_Literal =>
return Asis.Expressions.Value_Image (Exp);
when Asis.A_String_Literal =>
declare
Result : constant Wide_String :=
Asis.Expressions.Value_Image (Exp);
begin
return Result (2 .. Result'Last - 1);
end;
when others =>
return Asis.Expressions.Name_Image (Exp);
end case;
end;
end if;
end loop;
return "";
end Get_Aspect;
-------------------
-- Get_Dimension --
-------------------
function Get_Dimension (Exp : Asis.Expression) return Natural is
Tipe : Asis.Declaration :=
Asis.Expressions.Corresponding_Expression_Type (Exp);
View : Asis.Definition;
begin
if Asis.Elements.Declaration_Kind (Tipe)
in Asis.A_Private_Type_Declaration
then
Tipe := Asis.Declarations.Corresponding_Type_Completion (Tipe);
end if;
if Asis.Elements.Is_Nil (Tipe) then
declare
Enclosing : constant Asis.Declaration :=
Asis.Elements.Enclosing_Element (Exp);
begin
if Asis.Elements.Declaration_Kind (Enclosing) in
Asis.An_Object_Declaration
then
View := Asis.Declarations.Object_Declaration_View (Enclosing);
else
return 0;
end if;
end;
else
View := Asis.Declarations.Type_Declaration_View (Tipe);
end if;
if Asis.Elements.Definition_Kind (View) in Asis.A_Subtype_Indication then
declare
Constraint : constant Asis.Constraint :=
Asis.Definitions.Subtype_Constraint (View);
begin
if Asis.Elements.Is_Nil (Constraint) then
raise Constraint_Error;
else
declare
Ranges : constant Asis.Discrete_Range_List :=
Asis.Definitions.Discrete_Ranges (Constraint);
begin
return Ranges'Length;
end;
end if;
end;
end if;
loop
case Asis.Elements.Type_Kind (View) is
when Asis.A_Constrained_Array_Definition =>
return Asis.Definitions
.Discrete_Subtype_Definitions (View)'Length;
when Asis.An_Unconstrained_Array_Definition =>
return Asis.Definitions.Index_Subtype_Definitions (View)'Length;
when Asis.A_Derived_Type_Definition =>
declare
SI : constant Asis.Subtype_Indication :=
Asis.Definitions.Parent_Subtype_Indication (View);
Mark : Asis.Subtype_Mark :=
Asis.Definitions.Subtype_Mark (SI);
Decl : Asis.Declaration;
begin
if Asis.Elements.Expression_Kind (Mark) in
Asis.A_Selected_Component
then
Mark := Asis.Expressions.Selector (Mark);
end if;
Decl :=
Asis.Expressions.Corresponding_Name_Declaration (Mark);
View := Asis.Declarations.Type_Declaration_View (Decl);
end;
when others =>
raise Constraint_Error;
end case;
end loop;
end Get_Dimension;
----------------------------
-- Has_Controlling_Result --
----------------------------
function Has_Controlling_Result (Func : Asis.Declaration) return Boolean is
Result_Type : Asis.Element;
Type_Decl : Asis.Declaration;
Type_Def : Asis.Type_Definition;
begin
if Asis.Elements.Declaration_Kind (Func) not in
Asis.A_Function_Declaration
then
return False;
end if;
Result_Type := Asis.Declarations.Result_Profile (Func);
if Asis.Elements.Expression_Kind (Result_Type) not in
Asis.An_Identifier
then
-- TODO: Check others cases
return False;
end if;
Type_Decl :=
Asis.Expressions.Corresponding_Name_Declaration (Result_Type);
if Asis.Elements.Declaration_Kind (Type_Decl) not in
Asis.An_Ordinary_Type_Declaration |
Asis.A_Private_Type_Declaration
then
return False;
end if;
Type_Def := Asis.Declarations.Type_Declaration_View (Type_Decl);
if Asis.Elements.Definition_Kind (Type_Def) not in
Asis.A_Tagged_Private_Type_Definition
then
return False;
end if;
return Asis.Elements.Is_Equal
(Asis.Elements.Enclosing_Element (Func),
Asis.Elements.Enclosing_Element (Type_Decl));
end Has_Controlling_Result;
--------------
-- Is_Array --
--------------
function Is_Array (Exp : Asis.Expression) return Boolean is
Decl : constant Asis.Declaration :=
Asis.Expressions.Corresponding_Expression_Type (Exp);
View : Asis.Definition;
Kind : Asis.Type_Kinds := Asis.Not_A_Type_Definition;
begin
if not Asis.Elements.Is_Nil (Decl) then
View := Type_Declaration_View (Decl);
Kind := Asis.Elements.Type_Kind (View);
end if;
return Kind in Asis.An_Unconstrained_Array_Definition
| Asis.A_Constrained_Array_Definition;
end Is_Array;
-------------------
-- Is_Equal_Type --
-------------------
function Is_Equal_Type
(Left : Asis.Declaration;
Right : Asis.Declaration) return Boolean
is
function Up (X : Asis.Declaration) return Asis.Declaration;
--------
-- Up --
--------
function Up (X : Asis.Declaration) return Asis.Declaration is
begin
case Asis.Elements.Declaration_Kind (X) is
when Asis.An_Ordinary_Type_Declaration |
Asis.A_Task_Type_Declaration |
Asis.A_Protected_Type_Declaration =>
declare
CT : constant Asis.Declaration :=
Asis.Declarations.Corresponding_Type_Declaration (X);
begin
case Asis.Elements.Declaration_Kind (CT) is
when Asis.An_Incomplete_Type_Declaration |
Asis.A_Tagged_Incomplete_Type_Declaration =>
return X;
when Asis.A_Private_Type_Declaration |
Asis.A_Private_Extension_Declaration =>
return CT;
when others =>
return X;
end case;
end;
when Asis.An_Incomplete_Type_Declaration
| Asis.A_Tagged_Incomplete_Type_Declaration =>
declare
CT : constant Asis.Declaration :=
Asis.Declarations.Corresponding_Type_Declaration (X);
begin
case Asis.Elements.Declaration_Kind (CT) is
when Asis.A_Private_Type_Declaration |
Asis.A_Private_Extension_Declaration =>
return CT;
when others =>
return Up (CT);
end case;
end;
when others =>
return X;
end case;
end Up;
Left_Up : constant Asis.Declaration := Up (Left);
Right_Up : constant Asis.Declaration := Up (Right);
begin
return Asis.Elements.Is_Equal (Left_Up, Right_Up);
end Is_Equal_Type;
-----------------------------
-- Is_Primitive_Subprogram --
-----------------------------
function Is_Primitive_Subprogram
(Definition : Asis.Definition;
Subprogram : Asis.Declaration) return Boolean
is
List : constant Asis.Declaration_List :=
Asis.Declarations.Parameter_Profile (Subprogram);
begin
if List'Length >= 1 then
declare
use type Asis.Expression_Kinds;
Decl : Asis.Declaration;
First : constant Asis.Element :=
Asis.Declarations.Object_Declaration_View (List (List'First));
begin
if Asis.Elements.Expression_Kind (First) = Asis.An_Identifier then
Decl := Asis.Expressions.Corresponding_Name_Declaration (First);
return Is_Equal_Type
(Asis.Elements.Enclosing_Element (Definition), Decl);
end if;
end;
end if;
return False;
end Is_Primitive_Subprogram;
---------------------
-- Is_Array_Buffer --
---------------------
function Is_Array_Buffer (Element : Asis.Declaration) return Boolean is
Env : constant Asis.Element :=
Asis.Elements.Enclosing_Element (Element);
Name : constant Asis.Program_Text :=
Asis.Declarations.Defining_Name_Image
(Asis.Declarations.Names (Element) (1));
procedure Pre_Operation
(Element : Asis.Element;
Control : in out Asis.Traverse_Control;
State : in out Boolean);
procedure Post_Operation
(Element : Asis.Element;
Control : in out Asis.Traverse_Control;
State : in out Boolean) is null;
-------------------
-- Pre_Operation --
-------------------
procedure Pre_Operation
(Element : Asis.Element;
Control : in out Asis.Traverse_Control;
State : in out Boolean)
is
use type Asis.Pragma_Kinds;
begin
if Asis.Elements.Pragma_Kind (Element)
= Asis.An_Unknown_Pragma
then
declare
Image : constant Asis.Program_Text :=
Asis.Elements.Pragma_Name_Image (Element);
begin
if Image = "JavaScript_Array_Buffer" then
declare
Args : constant Asis.Association_List :=
Asis.Elements.Pragma_Argument_Associations (Element);
Arg : Asis.Expression;
begin
pragma Assert
(Args'Length = 1,
"Expected one argument in pragma"
&" JavaScript_Array_Buffer");
Arg := Asis.Expressions.Actual_Parameter (Args (1));
if Name = Asis.Expressions.Name_Image (Arg) then
State := True;
Control := Asis.Terminate_Immediately;
end if;
end;
end if;
end;
elsif not Asis.Elements.Is_Identical (Element, Env) then
Control := Asis.Abandon_Children;
end if;
end Pre_Operation;
procedure Search_Array_Buffer_Pragma is
new Asis.Iterator.Traverse_Element
(State_Information => Boolean,
Pre_Operation => Pre_Operation,
Post_Operation => Post_Operation);
Control : Asis.Traverse_Control := Asis.Continue;
Found : Boolean := False;
begin
Search_Array_Buffer_Pragma (Env, Control, Found);
return Found;
end Is_Array_Buffer;
----------
-- Join --
----------
function Join
(Left, Right : League.Strings.Universal_String)
return League.Strings.Universal_String
is
use type League.Strings.Universal_String;
begin
return Left & Right;
end Join;
--------------------------
-- Library_Level_Header --
--------------------------
function Library_Level_Header
(Unit : Asis.Compilation_Unit) return League.Strings.Universal_String
is
procedure Append_Dependencies (Unit : Asis.Compilation_Unit);
procedure Append (Unit : Asis.Compilation_Unit);
procedure Check_And_Append (Name : Asis.Name);
function Body_Context_Clause_Elements (Unit : Asis.Compilation_Unit)
return Asis.Context_Clause_List;
function To_Module_Name (Unit : Asis.Compilation_Unit)
return League.Strings.Universal_String;
function To_Unit (Name : Asis.Name) return Asis.Compilation_Unit;
Text : League.Strings.Universal_String;
Deps : League.String_Vectors.Universal_String_Vector;
------------
-- Append --
------------
procedure Append (Unit : Asis.Compilation_Unit) is
Name : constant League.Strings.Universal_String :=
To_Module_Name (Unit);
begin
if Deps.Index (Name) = 0 then
Deps.Append (Name);
end if;
end Append;
-------------------------
-- Append_Dependencies --
-------------------------
procedure Append_Dependencies (Unit : Asis.Compilation_Unit) is
use type Asis.Context_Clause_List;
Parent : constant Asis.Compilation_Unit :=
Asis.Compilation_Units.Corresponding_Parent_Declaration (Unit);
List : constant Asis.Context_Clause_List :=
Asis.Elements.Context_Clause_Elements (Unit) &
Body_Context_Clause_Elements (Unit);
begin
Append (Parent);
for Clause of List loop
case Asis.Elements.Clause_Kind (Clause) is
when Asis.A_With_Clause =>
declare
Names : constant Asis.Name_List :=
Asis.Clauses.Clause_Names (Clause);
begin
if not Asis.Elements.Has_Limited (Clause) then
for Name of Names loop
Check_And_Append (Name);
end loop;
end if;
end;
when others =>
null;
end case;
end loop;
end Append_Dependencies;
----------------------------------
-- Body_Context_Clause_Elements --
----------------------------------
function Body_Context_Clause_Elements (Unit : Asis.Compilation_Unit)
return Asis.Context_Clause_List is
Impl : constant Asis.Compilation_Unit :=
Asis.Compilation_Units.Corresponding_Body (Unit);
begin
if Asis.Compilation_Units.Is_Nil (Impl) then
return Asis.Nil_Element_List;
else
return Asis.Elements.Context_Clause_Elements (Impl);
end if;
end Body_Context_Clause_Elements;
---------------------
-- Is_Ada_Numerics --
---------------------
function Is_Ada_Numerics (Name : Asis.Name) return Boolean is
begin
return Name_Image (Name).Starts_With ("Ada.Numerics");
end Is_Ada_Numerics;
---------------
-- Is_WebAPI --
---------------
function Is_WebAPI (Name : Asis.Name) return Boolean is
begin
return Name_Image (Name).Starts_With ("WebAPI");
end Is_WebAPI;
----------------
-- Is_Generic --
----------------
function Is_Generic (Unit : Asis.Compilation_Unit) return Boolean is
begin
return Asis.Compilation_Units.Unit_Kind (Unit) in
Asis.A_Generic_Unit_Declaration;
end Is_Generic;
-----------------
-- Is_Renaming --
-----------------
function Is_Renaming (Unit : Asis.Compilation_Unit) return Boolean is
begin
return Asis.Compilation_Units.Unit_Kind (Unit) in Asis.A_Renaming;
end Is_Renaming;
----------------------
-- Check_And_Append --
----------------------
procedure Check_And_Append (Name : Asis.Name) is
Unit : constant Asis.Compilation_Unit := To_Unit (Name);
begin
if Is_Generic (Unit)
or else Is_WebAPI (Name)
or else Is_Ada_Numerics (Name)
then
return;
elsif Is_Renaming (Unit) then
Append_Dependencies (Unit);
return;
end if;
Append (Unit);
end Check_And_Append;
--------------------
-- To_Module_Name --
--------------------
function To_Module_Name
(Unit : Asis.Compilation_Unit)
return League.Strings.Universal_String
is
Full_Name : constant League.Strings.Universal_String :=
League.Strings.From_UTF_16_Wide_String
(Asis.Compilation_Units.Unit_Full_Name (Unit)).To_Lowercase;
List : constant League.String_Vectors.Universal_String_Vector :=
Full_Name.Split ('.');
begin
return List.Join ('-');
end To_Module_Name;
-------------
-- To_Unit --
-------------
function To_Unit (Name : Asis.Name) return Asis.Compilation_Unit is
Decl : Asis.Declaration;
begin
case Asis.Elements.Expression_Kind (Name) is
when Asis.A_Selected_Component =>
Decl := Asis.Expressions.Corresponding_Name_Declaration
(Asis.Expressions.Selector (Name));
when Asis.An_Identifier =>
Decl := Asis.Expressions.Corresponding_Name_Declaration (Name);
when others =>
raise Constraint_Error;
end case;
return Asis.Elements.Enclosing_Compilation_Unit (Decl);
end To_Unit;
begin
Text.Append ("define(['");
Append_Dependencies (Unit);
Text.Append (Deps.Join ("', '"));
Text.Append ("'], function(_ec) {");
return Text;
end Library_Level_Header;
----------------
-- Name_Image --
----------------
function Name_Image
(Name : Asis.Name) return League.Strings.Universal_String
is
procedure Prepend (Text : Asis.Program_Text);
Item : Asis.Name := Name;
Result : League.Strings.Universal_String;
-------------
-- Prepend --
-------------
procedure Prepend (Text : Asis.Program_Text) is
begin
Result.Prepend
(League.Strings.From_UTF_16_Wide_String (Text));
end Prepend;
begin
loop
case Asis.Elements.Expression_Kind (Item) is
when Asis.An_Identifier =>
Prepend (Asis.Expressions.Name_Image (Item));
return Result;
when Asis.A_Selected_Component =>
Prepend
(Asis.Expressions.Name_Image
(Asis.Expressions.Selector (Item)));
Prepend (".");
Item := Asis.Expressions.Prefix (Item);
when others =>
raise Program_Error;
end case;
end loop;
end Name_Image;
-----------------------
-- Parameter_Profile --
-----------------------
function Parameter_Profile
(Prefix : Asis.Expression) return Asis.Parameter_Specification_List
is
Tipe : Asis.Declaration;
Stmt : constant Asis.Statement :=
Asis.Elements.Enclosing_Element (Prefix);
Entity : Asis.Declaration :=
Asis.Statements.Corresponding_Called_Entity (Stmt);
begin
loop
if Asis.Elements.Is_Nil (Entity) then
exit;
else
if Asis.Elements.Declaration_Kind (Entity) in
Asis.A_Generic_Instantiation
then
Entity := Asis.Declarations.Corresponding_Declaration (Entity);
else
return Asis.Declarations.Parameter_Profile (Entity);
end if;
end if;
end loop;
Tipe :=
Asis.Expressions.Corresponding_Expression_Type_Definition (Prefix);
if Asis.Elements.Is_Nil (Tipe) then
raise Constraint_Error;
else
return Asis.Definitions.Access_To_Subprogram_Parameter_Profile (Tipe);
end if;
end Parameter_Profile;
---------------------------
-- Type_Declaration_View --
---------------------------
function Type_Declaration_View
(Declaration : Asis.Declaration) return Asis.Definition
is
First : constant Asis.Declaration :=
Asis.Declarations.Corresponding_First_Subtype (Declaration);
View : Asis.Element :=
Asis.Declarations.Type_Declaration_View (First);
begin
loop
View := Full_Type_View (View);
case Asis.Elements.Type_Kind (View) is
when Asis.A_Derived_Type_Definition =>
declare
SI : constant Asis.Subtype_Indication :=
Asis.Definitions.Parent_Subtype_Indication (View);
Mark : Asis.Subtype_Mark :=
Asis.Definitions.Subtype_Mark (SI);
Decl : Asis.Declaration;
begin
if Asis.Elements.Expression_Kind (Mark) in
Asis.A_Selected_Component
then
Mark := Asis.Expressions.Selector (Mark);
end if;
Decl :=
Asis.Expressions.Corresponding_Name_Declaration (Mark);
View := Asis.Declarations.Type_Declaration_View (Decl);
end;
when others =>
return View;
end case;
end loop;
end Type_Declaration_View;
end Properties.Tools;
|
Tools/System/Minnow5DataManipulation.asm | jaredwhitney/os3 | 5 | 244586 | Minnow5.appendDataBlock : ; qword buffer (file) in eax, returns eax=blockptr
methodTraceEnter
pusha
push eax ; interface setting
mov eax, [eax+0x0]
call Minnow5.setInterfaceSmart
pop eax
mov eax, [eax+0x4]
mov dword [.base], eax
call Minnow5.findFreeBlock ; find a free block
mov dword [.block], ebx
mov ebx, [Minnow5._dat] ; figure out what should point to it; make it do so
mov ecx, [.block]
call Minnow5.readBlock
mov edx, [ebx+Minnow5.Block_innerPointer]
cmp edx, null
jne .noInner
mov [ebx+Minnow5.Block_innerPointer], ecx
call Minnow5.writeBlock
jmp .doPlacementEnd
.noInner :
mov eax, edx
.loopGoOn :
call Minnow5.readBlock
cmp dword [ebx+Minnow5.Block_nextPointer], null
je .loopDone
mov eax, [ebx+Minnow5.Block_nextPointer]
jmp .loopGoOn
.loopDone :
mov [ebx+Minnow5.Block_nextPointer], ecx
call Minnow5.writeBlock
.doPlacementEnd :
mov eax, [Minnow5._dat] ; clear a buffer
mov ebx, 0x200
call Buffer.clear
mov dword [eax], "MINF" ; fill it with the proper headers
mov dword [eax+Minnow5.Block_signatureHigh], Minnow5.SIGNATURE_HIGH
mov dword [eax+Minnow5.Block_nextPointer], null
mov ecx, [.base]
mov dword [eax+Minnow5.Block_upperPointer], ecx
mov dword [eax+Minnow5.Block_type], Minnow5.BLOCK_TYPE_DATA
mov ebx, eax ; write it out to the disk
mov eax, [.block]
call Minnow5.writeBlock
popa
mov eax, [.block]
methodTraceLeave
ret
.base :
dd 0x0
.block :
dd 0x0
Minnow5.writeBuffer : ; eax = qword buffer (file), ebx = buffer (data), ecx = buffer size, edx = position in file
methodTraceEnter
pusha
mov [.file], eax
mov [.dataBuffer], ebx
mov [.buffersize], ecx
mov [.writePos], edx
push eax ; interface setting
mov eax, [eax+0x0]
call Minnow5.setInterfaceSmart
pop eax
mov eax, [eax+0x4]
; mov dword [.base], eax
mov ebx, [Minnow5._dat]
call Minnow5.readBlock
mov ecx, [ebx+Minnow5.Block_byteSize]
; mov [.oldsize], ecx
mov edx, [.buffersize]
add edx, [.writePos]
cmp edx, ecx
jbe .noSizeUp
mov dword [ebx+Minnow5.Block_byteSize], edx
.noSizeUp :
call Minnow5.writeBlock
cmp dword [ebx+Minnow5.Block_innerPointer], null
jne .notEmptyFile
mov eax, [.file]
call Minnow5.appendDataBlock
mov eax, [.file]
mov eax, [eax+0x4]
call Minnow5.readBlock
.notEmptyFile :
mov eax, [ebx+Minnow5.Block_innerPointer]
mov ecx, [.writePos]
shr ecx, 9 ; div by 0x200 (ecx is now the start sector)
push ecx
.goToPosLoop :
call Minnow5.readBlock
cmp ecx, 0
je .gotoPosDone
dec ecx
mov edx, [ebx+Minnow5.Block_nextPointer]
cmp edx, null
jne .noMake
mov eax, [.file]
call Minnow5.appendDataBlock
jmp .gtpmdone
.noMake :
mov eax, edx
.gtpmdone :
jmp .goToPosLoop
.gotoPosDone :
mov [.currentBlock], eax ; also already read into [ebx]
mov ecx, [.writePos]
pop edx
shl edx, 9
sub ecx, edx
mov [.startOffs], ecx
; ;
; Now that we know where to start, do the actual copying
; ;
mov ecx, 0x200-Minnow5.Block_data
sub ecx, [.startOffs]
add ebx, [.startOffs]
.innerLoop :
mov eax, [.currentBlock]
mov ebx, [Minnow5._dat]
call Minnow5.readBlock
cmp [.buffersize], ecx
jae .nosmod
mov ecx, [.buffersize]
.nosmod :
sub [.buffersize], ecx
mov eax, [.dataBuffer]
add dword [.dataBuffer], ecx
add ebx, Minnow5.Block_data
; copy from [eax] to [ebx]... size = ecx
.copyLoop :
mov dl, [eax]
mov [ebx], dl
add ebx, 1
add eax, 1
sub ecx, 1
cmp ecx, 0
jg .copyLoop
mov eax, [.currentBlock]
mov ebx, [Minnow5._dat]
call Minnow5.writeBlock
mov eax, [ebx+Minnow5.Block_nextPointer]
cmp eax, null
jne .noMake2
mov eax, [.file]
call Minnow5.appendDataBlock
.noMake2 :
mov [.currentBlock], eax
mov ecx, 0x200-Minnow5.Block_data
cmp dword [.buffersize], 0
jg .innerLoop
popa
methodTraceLeave
ret
.file :
dd 0x0
.startOffs :
dd 0x0
.dataBuffer :
dd 0x0
.buffersize :
dd 0x0
.writePos :
dd 0x0
.currentBlock :
dd 0x0
Minnow5.readBuffer : ; eax = qword buffer (file), ebx = buffer (data), ecx = buffer size, edx = position in file, ecx out = bytes read
methodTraceEnter
pusha
mov [.dataBuffer], ebx
mov [.buffersize], ecx
mov [.readPos], edx
push eax
mov eax, [eax+0x0]
call Minnow5.setInterfaceSmart
pop eax
mov eax, [eax+0x4]
mov ebx, [Minnow5._dat]
call Minnow5.readBlock
mov ecx, [ebx+Minnow5.Block_byteSize]
; mov [.filesize], ecx
; Check / correct actual read size... return if the offset is at or after the EOF
mov edx, [.buffersize]
add edx, [.readPos]
cmp ecx, edx
jae .nosizelimit
cmp ecx, [.readPos]
ja .readOffsetExistsInFile
mov dword [.bytesread], 0
jmp .readLoopDone
.readOffsetExistsInFile :
sub ecx, [.readPos]
mov [.buffersize], ecx
mov [.bytesread], ecx
.nosizelimit :
; Navigate to the read offset
mov eax, [ebx+Minnow5.Block_innerPointer]
mov ecx, [.readPos]
shr ecx, 9 ; div by 0x200 (ecx is now the start sector)
push ecx
.goToPosLoop :
call Minnow5.readBlock
cmp ecx, 0
je .gotoPosDone
dec ecx
mov eax, [ebx+Minnow5.Block_nextPointer]
jmp .goToPosLoop
.gotoPosDone : ; the first block has already been read into [ebx]
; Calculate the starting offset
mov ecx, [.readPos]
pop edx
shl edx, 9
sub ecx, edx
mov [.offs], ecx
; Figure out values for the first read (the offset one) then jump into the loop
mov ecx, [ebx+Minnow5.Block_nextPointer] ; ready next sector
mov [.next], ecx
mov ecx, 0x200-Minnow5.Block_data ; get read size
sub ecx, [.offs]
cmp [.buffersize], ecx ; fix read size if it should be an incomplete read
jge .startNoReadLimit
mov ecx, [.buffersize]
.startNoReadLimit :
sub [.buffersize], ecx
add ebx, [.offs]
jmp .readLoopEntryPoint
; Read / copy the actual data
.readLoop :
cmp dword [.buffersize], 0
jle .readLoopDone
mov ebx, [Minnow5._dat]
call Minnow5.readBlock
mov ecx, [ebx+Minnow5.Block_nextPointer]
mov [.next], ecx
mov ecx, 0x200-Minnow5.Block_data
cmp [.buffersize], ecx
jge .noReadLimit
mov ecx, [.buffersize]
.noReadLimit :
sub [.buffersize], ecx
.readLoopEntryPoint :
mov eax, [.dataBuffer]
add [.dataBuffer], ecx
add ebx, Minnow5.Block_data
; copy from [ebx] to [eax]... size = ecx
.copyLoop :
mov dl, [ebx]
mov [eax], dl
inc eax
inc ebx
dec ecx
cmp ecx, 0
jg .copyLoop
mov eax, [.next]
jmp .readLoop
.readLoopDone :
popa
mov ecx, [.bytesread]
methodTraceLeave
ret
.dataBuffer :
dd 0x0
.buffersize :
dd 0x0
.readPos :
dd 0x0
.bytesread :
dd 0x0
.offs :
dd 0x0
.next :
dd 0x0 |
alloy4fun_models/trashltl/models/9/jpja8wNWrgpnPiXvj.als | Kaixi26/org.alloytools.alloy | 0 | 2151 | open main
pred idjpja8wNWrgpnPiXvj_prop10 {
Protected' = Protected
}
pred __repair { idjpja8wNWrgpnPiXvj_prop10 }
check __repair { idjpja8wNWrgpnPiXvj_prop10 <=> prop10o } |
regtests/files/test-ada-7/src/test7.adb | stcarrez/resource-embedder | 7 | 6073 | <reponame>stcarrez/resource-embedder
with Resources7;
with Ada.Command_Line;
with Ada.Text_IO;
procedure Test7 is
use Resources7;
C : Content_Access := Get_Content ("config/test7.xml");
begin
if C = null then
Ada.Text_IO.Put_Line ("FAIL: No content 'config/test7.xml'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
if C'Length /= 22 then
Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'config/test7.xml'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
end if;
C := Get_Content ("CONFIG/TEST7.XML");
if C = null then
Ada.Text_IO.Put_Line ("FAIL: No content 'config/test7.xml'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
C := Get_Content ("CoNfIg/TeSt7.XmL");
if C = null then
Ada.Text_IO.Put_Line ("FAIL: No content 'config/test7.xml'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
Ada.Text_IO.Put ("PASS: ");
Ada.Text_IO.Put_Line (C.all);
end Test7;
|
apps/breakfast/pde_fw/toast/examples/Assembly (CCE)/msp430x24x_hfxt2_nmi.asm | tp-freeforall/breakfast | 1 | 6413 | ;*******************************************************************************
; MSP430x24x Demo - Basic Clock, LFXT1/MCLK Sourced from HF XTAL, NMI
;
; Description: Proper selection of an external HF XTAL for MCLK is shown with
; enabled OSC fault interrupt - if HF XTAL fails, NMI interrupt is requested.
; HF XTAL can only source MCLK when OSC fault is clear. For demonstration
; purposes P1.0 is set during OSC fault. MCLK/10 is on P1.1.
; ACLK = MCLK = LFXT1 = HFXTAL
; //* HF XTAL NOT INSTALLED ON FET *//
; //* Min Vcc required varies with MCLK frequency - refer to datasheet *//
;
; MSP430F249
; -----------------
; /|\| XIN|-
; | | | HF XTAL (3 16MHz crystal or resonator)
; --|RST XOUT|-
; | |
; | P1.1|-->MCLK/10
; | P1.0|-->LED
;
; <NAME>
; Texas Instruments Inc.
; May 2008
; Built Code Composer Essentials: v3 FET
;*******************************************************************************
.cdecls C,LIST, "msp430x24x.h"
;-------------------------------------------------------------------------------
.text ;Program Start
;-------------------------------------------------------------------------------
RESET mov.w #0500h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
SetupBC bic.b #XT2OFF,&BCSCTL1 ; Activate XT2 high freq xtal
bis.b #XT2S_2,&BCSCTL3 ; 3 16MHz crystal or resonator
bis.b #OFIE,&IE1 ; Enable osc fault interrupt
SetupP1 bis.b #003h,&P1DIR ; P1.0,1 = output direction
bic.b #001h,&P1OUT ; P1.0 = reset
;
Mainloop bis.b #002h,&P1OUT ; P1.1 = 1
bic.b #002h,&P1OUT ; P1.1 = 0
jmp Mainloop ; Repeat
;
;-------------------------------------------------------------------------------
NMI_ISR; Only osc fault enabled, R15 used temporarly and not saved
;-------------------------------------------------------------------------------
bis.b #001h,&P1OUT ; P1.0= set
bic.b #SELM_3,&BCSCTL2 ; Ensure MCLK runs from DCO
CheckOsc bic.b #OFIFG,&IFG1 ; Clear OSC fault flag
mov.w #0FFh,R15 ; R15= Delay
CheckOsc1 dec.w R15 ; Additional delay to ensure start
jnz CheckOsc1 ;
bit.b #OFIFG,&IFG1 ; OSC fault flag set?
jnz CheckOsc ; OSC Fault, clear flag again
bic.b #001h,&P1OUT ; P1.0= reset
bis.b #SELM_2,&BCSCTL2 ; MCLK = XT2 HF XTAL (safe)
bis.b #OFIE,&IE1 ; re-enable osc fault interrupt
reti ; return from interrupt
;
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".int30" ; NMI vector
.short NMI_ISR
.sect ".reset" ; POR, ext. Reset
.short RESET
.end
|
gcc-gcc-7_3_0-release/gcc/ada/osint-b.adb | best08618/asylo | 7 | 550 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- O S I N T - B --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Opt; use Opt;
with Output; use Output;
package body Osint.B is
Current_List_File : File_Descriptor := Invalid_FD;
-------------------------
-- Close_Binder_Output --
-------------------------
procedure Close_Binder_Output is
Status : Boolean;
begin
Close (Output_FD, Status);
if not Status then
Fail
("error while closing generated file "
& Get_Name_String (Output_File_Name));
end if;
end Close_Binder_Output;
---------------------
-- Close_List_File --
---------------------
procedure Close_List_File is
begin
if Current_List_File /= Invalid_FD then
Close (Current_List_File);
Current_List_File := Invalid_FD;
Set_Standard_Output;
end if;
end Close_List_File;
--------------------------
-- Create_Binder_Output --
--------------------------
procedure Create_Binder_Output
(Output_File_Name : String;
Typ : Character;
Bfile : out Name_Id)
is
File_Name : String_Ptr;
Findex1 : Natural;
Findex2 : Natural;
Flength : Natural;
Bind_File_Prefix_Len : constant Natural := 2;
-- Length of binder file prefix (2 for b~)
begin
if Output_File_Name /= "" then
Name_Buffer (1 .. Output_File_Name'Length) := Output_File_Name;
Name_Buffer (Output_File_Name'Length + 1) := ASCII.NUL;
if Typ = 's' then
Name_Buffer (Output_File_Name'Last) := 's';
end if;
Name_Len := Output_File_Name'Last;
else
Name_Buffer (1) := 'b';
File_Name := File_Names (Current_File_Name_Index);
Findex1 := File_Name'First;
-- The ali file might be specified by a full path name. However,
-- the binder generated file should always be created in the
-- current directory, so the path might need to be stripped away.
-- In addition to the default directory_separator allow the '/' to
-- act as separator since this is allowed in MS-DOS and OS2 ports.
for J in reverse File_Name'Range loop
if File_Name (J) = Directory_Separator
or else File_Name (J) = '/'
then
Findex1 := J + 1;
exit;
end if;
end loop;
Findex2 := File_Name'Last;
while File_Name (Findex2) /= '.' loop
Findex2 := Findex2 - 1;
end loop;
Flength := Findex2 - Findex1;
if Maximum_File_Name_Length > 0 then
-- Make room for the extra two characters in "b?"
while Int (Flength) >
Maximum_File_Name_Length - Nat (Bind_File_Prefix_Len)
loop
Findex2 := Findex2 - 1;
Flength := Findex2 - Findex1;
end loop;
end if;
Name_Buffer
(Bind_File_Prefix_Len + 1 .. Flength + Bind_File_Prefix_Len) :=
File_Name (Findex1 .. Findex2 - 1);
Name_Buffer (Flength + Bind_File_Prefix_Len + 1) := '.';
-- Ada bind file, name is b~xxx.adb or b~xxx.ads
Name_Buffer (2) := '~';
Name_Buffer (Flength + Bind_File_Prefix_Len + 2) := 'a';
Name_Buffer (Flength + Bind_File_Prefix_Len + 3) := 'd';
Name_Buffer (Flength + Bind_File_Prefix_Len + 4) := Typ;
Name_Buffer (Flength + Bind_File_Prefix_Len + 5) := ASCII.NUL;
Name_Len := Flength + Bind_File_Prefix_Len + 4;
end if;
Bfile := Name_Find;
Create_File_And_Check (Output_FD, Text);
end Create_Binder_Output;
--------------------
-- More_Lib_Files --
--------------------
function More_Lib_Files return Boolean renames More_Files;
------------------------
-- Next_Main_Lib_File --
------------------------
function Next_Main_Lib_File return File_Name_Type renames Next_Main_File;
---------------------------------
-- Set_Current_File_Name_Index --
---------------------------------
procedure Set_Current_File_Name_Index (To : Int) is
begin
Current_File_Name_Index := To;
end Set_Current_File_Name_Index;
-------------------
-- Set_List_File --
-------------------
procedure Set_List_File (Filename : String) is
begin
pragma Assert (Current_List_File = Invalid_FD);
Current_List_File := Create_File (Filename, Text);
if Current_List_File = Invalid_FD then
Fail ("cannot create list file: " & Filename);
else
Set_Output (Current_List_File);
end if;
end Set_List_File;
-----------------------
-- Write_Binder_Info --
-----------------------
procedure Write_Binder_Info (Info : String) renames Write_Info;
begin
Set_Program (Binder);
end Osint.B;
|
Library/Chart/PArea/pareaGeometry.asm | steakknife/pcgeos | 504 | 87796 | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: pareaGeometry.asm
AUTHOR: <NAME>, Oct 9, 1991
ROUTINES:
Name Description
---- -----------
PlotAreaRecalcSize Recompute the size of the plot area.
PlotAreaRecalcAxisSizes Recalculate the sizes of the (passed) axes
Stub Do nothing
Do nothing
CallXAxisFirst send a message to the X axis, then to the Y
axis
CallYAxisFirst send a message to the X axis, then to the Y
axis
CallYOnly send a message only to the Y axis
REVISION HISTORY:
Name Date Description
---- ---- -----------
John 10/ 9/91 Initial revision
DESCRIPTION:
Geometry code for the plot area.
$Id: pareaGeometry.asm,v 1.1 97/04/04 17:46:48 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PlotAreaRecalcSize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Recompute the size of the plot area.
CALLED BY: via MSG_CHART_OBJECT_RECALC_SIZE
PASS: *ds:si = Instance ptr
ds:di = Instance ptr
cx = suggested width
dx = suggested height
RETURN: cx = Desired width
dx = Desired height
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
Calculate axis sizes,
set series area size.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 10/20/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PlotAreaRecalcSize method dynamic PlotAreaClass,
MSG_CHART_OBJECT_RECALC_SIZE
.enter
push si ; plot area
; calculate margin
call PlotAreaCalcMargin
;
; Call superclass -- have kids recalc sizes. XXX: This causes
; the SeriesGroup (and its children) to get a RECALC_SIZE
; message, even though its too early at this point for that
; object to get the message. The result is that it's sent
; reduntantly, but it really doesn't take that long...
;
mov di, offset PlotAreaClass
call ObjCallSuperNoLock ; cx, dx - child sizes
;
; See if there're any axes. If not, just send size to series
; group.
;
DerefChartObject ds, si, di
tst ds:[di].PAI_yAxis
jz setSeriesGroup
;
; Otherwise, do "PASS 2" of the axis geometry calculations
;
call UtilGetChartAttributes
mov bl, cl
clr bh
push bx
mov ax, MSG_AXIS_GEOMETRY_PART_2
call cs:RecalcAxesTable[bx]
pop bx
;
; Update the plot area's size to the max width/height of the axes
;
call PlotAreaUpdateSize
setSeriesGroup:
; If there are axes, then use the PlotBounds of the axes to
; set the series area. Otherwise, series area is the same as
; the PlotArea bounds.
DerefChartObject ds, si, di
mov si, ds:[di].PAI_xAxis
tst si
ifdef SPIDER_CHART
; Since spider charts have no x-axis we have to check the y-axis.
jz checkY ;No x - Is it a pie or
;spider chart?
else
jz noAxes ;A pie chart
endif ; SPIDER_CHART
mov ax, MSG_AXIS_GET_PLOTTABLE_WIDTH
call ObjCallInstanceNoLock
mov_tr cx, ax
ifdef SPIDER_CHART
jmp getY
checkY:
movP cxdx, ds:[di].COI_size
mov si, ds:[di].PAI_yAxis
tst si
jz callSeriesGroup ;No x or y axis - Pie
;chart
getY:
endif ; SPIDER_CHART
mov si, ds:[di].PAI_yAxis
mov ax, MSG_AXIS_GET_PLOTTABLE_HEIGHT
call ObjCallInstanceNoLock
mov_tr dx, ax
ifndef SPIDER_CHART
jmp callSeriesGroup
noAxes:
movP cxdx, ds:[di].COI_size
endif ; SPIDER_CHART
callSeriesGroup:
mov ax, MSG_CHART_OBJECT_RECALC_SIZE
mov si, offset TemplateSeriesGroup
call ObjCallInstanceNoLock
; Return size to caller
pop si
DerefChartObject ds, si, di
movP cxdx, ds:[di].COI_size
.leave
ret
PlotAreaRecalcSize endm
ifdef SPIDER_CHART
RecalcAxesTable word \
offset CallXAxisFirst,
offset CallYAxisFirst,
offset CallXAxisFirst,
offset CallXAxisFirst,
offset CallYAxisFirst,
offset Stub,
offset CallXAxisFirst,
offset CallYOnly
else ; SPIDER_CHART
RecalcAxesTable word \
offset CallXAxisFirst,
offset CallYAxisFirst,
offset CallXAxisFirst,
offset CallXAxisFirst,
offset CallYAxisFirst,
offset Stub,
offset CallXAxisFirst
endif ; SPIDER_CHART
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PlotAreaUpdateSize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Update the plot area's size in the event that the axes
became larger in "step 2" calculations
CALLED BY: PlotAreaRecalcSize
PASS: cx, dx - original plot area size
*ds:si - plot area
RETURN: cx, dx - new, larger bounds
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 1/20/93 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PlotAreaUpdateSize proc near
class PlotAreaClass
bounds local Point
uses ax, di, si
.enter
clr bounds.P_x
clr bounds.P_y
push si
DerefChartObject ds, si, di
mov ax, MSG_CHART_OBJECT_GET_SIZE
mov si, ds:[di].PAI_xAxis
tst si
jz getY
call ObjCallInstanceNoLock
Max bounds.P_x, cx
Max bounds.P_y, dx
getY:
mov si, ds:[di].PAI_yAxis
call ObjCallInstanceNoLock
Max cx, bounds.P_x
Max dx, bounds.P_y
pop si
add cx, ds:[di].CCI_margin.R_left
add cx, ds:[di].CCI_margin.R_right
add dx, ds:[di].CCI_margin.R_top
add dx, ds:[di].CCI_margin.R_bottom
mov ax, MSG_CHART_OBJECT_SET_SIZE
call ObjCallInstanceNoLock
.leave
ret
PlotAreaUpdateSize endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Stub
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Do nothing
CALLED BY:
PASS: nothing
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 3/ 3/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
Stub proc near
ret
Stub endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CallXAxisFirst
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: send a message to the X axis, then to the Y axis
CALLED BY:
PASS: ds:di - PlotArea
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 1/10/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CallXAxisFirst proc near
uses si
class PlotAreaClass
.enter
push ds:[di].PAI_yAxis, ax
mov si, ds:[di].PAI_xAxis
call ObjCallInstanceNoLock
pop si, ax
call ObjCallInstanceNoLock
.leave
ret
CallXAxisFirst endp
CallYAxisFirst proc near
uses si
class PlotAreaClass
.enter
push ds:[di].PAI_xAxis, ax
mov si, ds:[di].PAI_yAxis
call ObjCallInstanceNoLock
pop si, ax
call ObjCallInstanceNoLock
.leave
ret
CallYAxisFirst endp
ifdef SPIDER_CHART
CallYOnly proc near
uses si
class PlotAreaClass
.enter
mov si, ds:[di].PAI_yAxis
call ObjCallInstanceNoLock
.leave
ret
CallYOnly endp
endif ; SPIDER_CHART
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PlotAreaCalcMargin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Figure out the extra space surrounding the axes
CALLED BY: PlotAreaRecalcSize
PASS: ds:di - plot area
cx, dx - suggested size for plot area
RETURN: cx, dx - suggested size for axes
CCI_margin filled in.
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 3/18/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PlotAreaCalcMargin proc near
class PlotAreaClass
uses ax, cx, dx
.enter
clr ax
mov ds:[di].CCI_margin.R_top, ax
mov ds:[di].CCI_margin.R_bottom, ax
mov ds:[di].CCI_margin.R_left, ax
mov ds:[di].CCI_margin.R_right, ax
call UtilGetChartAttributes
;
; For COLUMN and BAR charts, add space for value labels, if any
;
test dx, mask CF_VALUES
jz done
cmp cl, CT_COLUMN
je column
cmp cl, CT_BAR
jne done
;
; XXX: FIX THIS: Should really send
; MSG_CHART_OBJECT_GET_MAX_TEXT_SIZE to the series
; group to find out the max x/y bounds of all the series objects!
;
; BAR CHART
; put extra space on the sides
add ds:[di].CCI_margin.R_left, DEFAULT_VALUE_LABEL_WIDTH
add ds:[di].CCI_margin.R_right, DEFAULT_VALUE_LABEL_WIDTH
jmp done
column:
add ds:[di].CCI_margin.R_top, DEFAULT_VALUE_LABEL_HEIGHT
add ds:[di].CCI_margin.R_bottom, DEFAULT_VALUE_LABEL_HEIGHT
done:
.leave
ret
PlotAreaCalcMargin endp
|
data/pokemon/dex_entries/slaking.asm | AtmaBuster/pokeplat-gen2 | 6 | 246573 | <reponame>AtmaBuster/pokeplat-gen2
db "LAZY@" ; species name
db "The world's"
next "laziest #MON."
next "It moves to"
page "another spot when"
next "there's no food"
next "within its reach.@"
|
src/STLC2/Kovacs/Normalisation/SoundNotComplete.agda | mietek/coquand-kovacs | 0 | 5941 | <filename>src/STLC2/Kovacs/Normalisation/SoundNotComplete.agda
-- If we try to naively extend the Kripke structure used for NbE of STLC,
-- we find that it is sound, but not complete.
--
-- The definition of semantic objects, which represent terms in normal form,
-- is not big enough to represent neutral terms of the coproduct types.
-- The problem is visible in the definition of `reflect`.
module STLC2.Kovacs.Normalisation.SoundNotComplete where
open import STLC2.Kovacs.NormalForm public
--------------------------------------------------------------------------------
-- (Tyᴺ)
infix 3 _⊩_
_⊩_ : 𝒞 → 𝒯 → Set
Γ ⊩ ⎵ = Γ ⊢ⁿᶠ ⎵
Γ ⊩ A ⇒ B = ∀ {Γ′} → (η : Γ′ ⊇ Γ) (a : Γ′ ⊩ A)
→ Γ′ ⊩ B
Γ ⊩ A ⩕ B = Γ ⊩ A × Γ ⊩ B
Γ ⊩ ⫪ = ⊤
Γ ⊩ ⫫ = ⊥
Γ ⊩ A ⩖ B = Γ ⊩ A ⊎ Γ ⊩ B
-- (Conᴺ ; ∙ ; _,_)
infix 3 _⊩⋆_
data _⊩⋆_ : 𝒞 → 𝒞 → Set
where
∅ : ∀ {Γ} → Γ ⊩⋆ ∅
_,_ : ∀ {Γ Ξ A} → (ρ : Γ ⊩⋆ Ξ) (a : Γ ⊩ A)
→ Γ ⊩⋆ Ξ , A
--------------------------------------------------------------------------------
-- (Tyᴺₑ)
acc : ∀ {A Γ Γ′} → Γ′ ⊇ Γ → Γ ⊩ A → Γ′ ⊩ A
acc {⎵} η M = renⁿᶠ η M
acc {A ⇒ B} η f = λ η′ a → f (η ○ η′) a
acc {A ⩕ B} η s = acc η (proj₁ s) , acc η (proj₂ s)
acc {⫪} η s = tt
acc {⫫} η s = elim⊥ s
acc {A ⩖ B} η s = elim⊎ s (λ a → inj₁ (acc η a))
(λ b → inj₂ (acc η b))
-- (Conᴺₑ)
-- NOTE: _⬖_ = acc⋆
_⬖_ : ∀ {Γ Γ′ Ξ} → Γ ⊩⋆ Ξ → Γ′ ⊇ Γ → Γ′ ⊩⋆ Ξ
∅ ⬖ η = ∅
(ρ , a) ⬖ η = ρ ⬖ η , acc η a
--------------------------------------------------------------------------------
-- (∈ᴺ)
getᵥ : ∀ {Γ Ξ A} → Γ ⊩⋆ Ξ → Ξ ∋ A → Γ ⊩ A
getᵥ (ρ , a) zero = a
getᵥ (ρ , a) (suc i) = getᵥ ρ i
-- (Tmᴺ)
eval : ∀ {Γ Ξ A} → Γ ⊩⋆ Ξ → Ξ ⊢ A → Γ ⊩ A
eval ρ (𝓋 i) = getᵥ ρ i
eval ρ (ƛ M) = λ η a → eval (ρ ⬖ η , a) M
eval ρ (M ∙ N) = eval ρ M idₑ (eval ρ N)
eval ρ (M , N) = eval ρ M , eval ρ N
eval ρ (π₁ M) = proj₁ (eval ρ M)
eval ρ (π₂ M) = proj₂ (eval ρ M)
eval ρ τ = tt
eval ρ (φ M) = elim⊥ (eval ρ M)
eval ρ (ι₁ M) = inj₁ (eval ρ M)
eval ρ (ι₂ M) = inj₂ (eval ρ M)
eval ρ (M ⁇ N₁ ∥ N₂) = elim⊎ (eval ρ M) (λ M₁ → eval (ρ , M₁) N₁)
(λ M₂ → eval (ρ , M₂) N₂)
-- mutual
-- -- (qᴺ)
-- reify : ∀ {A Γ} → Γ ⊩ A → Γ ⊢ⁿᶠ A
-- reify {⎵} M = M
-- reify {A ⇒ B} f = ƛ (reify (f (wkₑ idₑ) (reflect 0)))
-- reify {A ⩕ B} s = reify (proj₁ s) , reify (proj₂ s)
-- reify {⫪} s = τ
-- reify {⫫} s = elim⊥ s
-- reify {A ⩖ B} s = elim⊎ s (λ a → ι₁ (reify a))
-- (λ b → ι₂ (reify b))
-- -- (uᴺ)
-- reflect : ∀ {A Γ} → Γ ⊢ⁿᵉ A → Γ ⊩ A
-- reflect {⎵} M = ne M
-- reflect {A ⇒ B} M = λ η a → reflect (renⁿᵉ η M ∙ reify a)
-- reflect {A ⩕ B} M = reflect (π₁ M) , reflect (π₂ M)
-- reflect {⫪} M = tt
-- reflect {⫫} M = {!!}
-- reflect {A ⩖ B} M = {!!}
-- -- (uᶜᴺ)
-- idᵥ : ∀ {Γ} → Γ ⊩⋆ Γ
-- idᵥ {∅} = ∅
-- idᵥ {Γ , A} = idᵥ ⬖ wkₑ idₑ , reflect 0
-- -- (nf)
-- nf : ∀ {Γ A} → Γ ⊢ A → Γ ⊢ⁿᶠ A
-- nf M = reify (eval idᵥ M)
--------------------------------------------------------------------------------
|
ada/src/nymph_logger.ads | Watch-Later/NymphRPC | 52 | 5077 | -- nymph_logging.ads - Main package for use by NymphRPC clients (Spec).
--
-- 2017/07/01, <NAME>
-- (c) Nyanko.ws
type LogFunction is not null access procedure (level: in integer, text: in string);
|
Task/Huffman-coding/Ada/huffman-coding-2.ada | LaudateCorpus1/RosettaCodeData | 1 | 18785 | with Ada.Text_IO;
with Ada.Unchecked_Deallocation;
with Ada.Containers.Vectors;
package body Huffman is
package Node_Vectors is new Ada.Containers.Vectors
(Element_Type => Node_Access,
Index_Type => Positive);
function "<" (Left, Right : Node_Access) return Boolean is
begin
-- compare frequency
if Left.Frequency < Right.Frequency then
return True;
elsif Right.Frequency < Left.Frequency then
return False;
end if;
-- same frequency, choose leaf node
if Left.Left_Child = null and then Right.Left_Child /= null then
return True;
elsif Left.Left_Child /= null and then Right.Left_Child = null then
return False;
end if;
-- same frequency, same node type (internal/leaf)
if Left.Left_Child /= null then
-- for internal nodes, compare left children, then right children
if Left.Left_Child < Right.Left_Child then
return True;
elsif Right.Left_Child < Left.Left_Child then
return False;
else
return Left.Right_Child < Right.Right_Child;
end if;
else
-- for leaf nodes, compare symbol
return Left.Symbol < Right.Symbol;
end if;
end "<";
package Node_Vector_Sort is new Node_Vectors.Generic_Sorting;
procedure Create_Tree
(Tree : out Huffman_Tree;
Frequencies : Frequency_Maps.Map) is
Node_Queue : Node_Vectors.Vector := Node_Vectors.Empty_Vector;
begin
-- insert all leafs into the queue
declare
use Frequency_Maps;
Position : Cursor := Frequencies.First;
The_Node : Node_Access := null;
begin
while Position /= No_Element loop
The_Node :=
Create_Node
(Symbol => Key (Position),
Frequency => Element (Position));
Node_Queue.Append (The_Node);
Next (Position);
end loop;
end;
-- sort by frequency (see "<")
Node_Vector_Sort.Sort (Node_Queue);
-- iterate over all elements
while not Node_Queue.Is_Empty loop
declare
First : constant Node_Access := Node_Queue.First_Element;
begin
Node_Queue.Delete_First;
-- if we only have one node left, it is the root node of the tree
if Node_Queue.Is_Empty then
Tree.Tree := First;
else
-- create new internal node with two smallest frequencies
declare
Second : constant Node_Access := Node_Queue.First_Element;
begin
Node_Queue.Delete_First;
Node_Queue.Append (Create_Node (First, Second));
end;
Node_Vector_Sort.Sort (Node_Queue);
end if;
end;
end loop;
-- fill encoding map
Fill (The_Node => Tree.Tree, Map => Tree.Map, Prefix => Zero_Sequence);
end Create_Tree;
-- create leaf node
function Create_Node
(Symbol : Symbol_Type;
Frequency : Frequency_Type)
return Node_Access
is
Result : Node_Access := new Huffman_Node;
begin
Result.Frequency := Frequency;
Result.Symbol := Symbol;
return Result;
end Create_Node;
-- create internal node
function Create_Node (Left, Right : Node_Access) return Node_Access is
Result : Node_Access := new Huffman_Node;
begin
Result.Frequency := Left.Frequency + Right.Frequency;
Result.Left_Child := Left;
Result.Right_Child := Right;
return Result;
end Create_Node;
-- fill encoding map
procedure Fill
(The_Node : Node_Access;
Map : in out Encoding_Maps.Map;
Prefix : Bit_Sequence) is
begin
if The_Node.Left_Child /= null then
-- append false (0) for left child
Fill (The_Node.Left_Child, Map, Prefix & False);
-- append true (1) for right child
Fill (The_Node.Right_Child, Map, Prefix & True);
else
-- leaf node reached, prefix = code for symbol
Map.Insert (The_Node.Symbol, Prefix);
end if;
end Fill;
-- free memory after finalization
overriding procedure Finalize (Object : in out Huffman_Tree) is
procedure Free is new Ada.Unchecked_Deallocation
(Name => Node_Access,
Object => Huffman_Node);
-- recursively free all nodes
procedure Recursive_Free (The_Node : in out Node_Access) is
begin
-- free node if it is a leaf
if The_Node.Left_Child = null then
Free (The_Node);
else
-- free left and right child if node is internal
Recursive_Free (The_Node.Left_Child);
Recursive_Free (The_Node.Right_Child);
-- free node afterwards
Free (The_Node);
end if;
end Recursive_Free;
begin
-- recursively free root node
Recursive_Free (Object.Tree);
end Finalize;
-- encode single symbol
function Encode
(Tree : Huffman_Tree;
Symbol : Symbol_Type)
return Bit_Sequence
is
begin
-- simply lookup in map
return Tree.Map.Element (Symbol);
end Encode;
-- encode symbol sequence
function Encode
(Tree : Huffman_Tree;
Symbols : Symbol_Sequence)
return Bit_Sequence
is
begin
-- only one element
if Symbols'Length = 1 then
-- see above
return Encode (Tree, Symbols (Symbols'First));
else
-- encode first element, append result of recursive call
return Encode (Tree, Symbols (Symbols'First)) &
Encode (Tree, Symbols (Symbols'First + 1 .. Symbols'Last));
end if;
end Encode;
-- decode a bit sequence
function Decode
(Tree : Huffman_Tree;
Code : Bit_Sequence)
return Symbol_Sequence
is
-- maximum length = code length
Result : Symbol_Sequence (1 .. Code'Length);
-- last used index of result
Last : Natural := 0;
The_Node : Node_Access := Tree.Tree;
begin
-- iterate over the code
for I in Code'Range loop
-- if current element is true, descent the right branch
if Code (I) then
The_Node := The_Node.Right_Child;
else
-- false: descend left branch
The_Node := The_Node.Left_Child;
end if;
if The_Node.Left_Child = null then
-- reached leaf node: append symbol to result
Last := Last + 1;
Result (Last) := The_Node.Symbol;
-- reset current node to root
The_Node := Tree.Tree;
end if;
end loop;
-- return subset of result array
return Result (1 .. Last);
end Decode;
-- output a bit sequence
procedure Put (Code : Bit_Sequence) is
package Int_IO is new Ada.Text_IO.Integer_IO (Integer);
begin
for I in Code'Range loop
if Code (I) then
-- true = 1
Int_IO.Put (1, 0);
else
-- false = 0
Int_IO.Put (0, 0);
end if;
end loop;
Ada.Text_IO.New_Line;
end Put;
-- dump encoding map
procedure Dump_Encoding (Tree : Huffman_Tree) is
use type Encoding_Maps.Cursor;
Position : Encoding_Maps.Cursor := Tree.Map.First;
begin
-- iterate map
while Position /= Encoding_Maps.No_Element loop
-- key
Put (Encoding_Maps.Key (Position));
Ada.Text_IO.Put (" = ");
-- code
Put (Encoding_Maps.Element (Position));
Encoding_Maps.Next (Position);
end loop;
end Dump_Encoding;
end Huffman;
|
base/Kernel/Native/arm/Crt/r_dtoi64.asm | sphinxlogic/Singularity-RDK-2.0 | 0 | 90422 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Microsoft Research Singularity
;;;
;;; Copyright (c) Microsoft Corporation. All rights reserved.
;;;
;;; This file contains ARM-specific assembly code.
;;;
; __dtoi64 double precision floating point to signed 64-bit integer convert
;
; Input: r1 - Most significant word of the double to be converted
; r0 - Least significant word of the double to be converted
;
; Output: r1 - Most significant word of the converted double in signed
; 64-bit integer format
; r0 - Least significant word of the converted double in signed
; 64-bit integer format
;
; Local storage size and offsets
LOC_SIZE EQU 0x18
OrgOp1h EQU 0x14
OrgOp1l EQU 0x10
ExDResh EQU 0x0C
ExDResl EQU 0x08
NewResh EQU 0x14
NewResl EQU 0x10
GET fpe.asm
GET kxarm.inc
AREA |.text|, CODE, READONLY
Export __dtoi64
IMPORT FPE_Raise
NESTED_ENTRY __dtoi64
EnterWithLR_16
STMFD sp!, {lr} ; Save return address
SUB sp, sp, #LOC_SIZE ; Allocate local storage
PROLOG_END
STR r1, [sp, #OrgOp1h] ; Save off original args in case of exception
ORRS r12, r0, r1, LSL #1 ; Check for zero
STR r0, [sp, #OrgOp1l] ; ..
MOVEQ r1, r0 ; return if zero (r0 already zero)
ADDEQ sp, sp, #LOC_SIZE ; restore stack
IF Interworking :LOR: Thumbing
LDMEQFD sp!, {lr} ; ..
BXEQ lr
ELSE
LDMEQFD sp!, {pc} ; ..
ENDIF
MOVS r2, r1, LSL #1 ; Right justify exponent, save sign bit in C
MOV r1, r1, LSL #11 ; Left justify mantissa
ORR r1, r1, r0, LSR #21 ; ..
; ..
MOV r0, r0, LSL #11 ; ..
ORR r1, r1, #1 << 31 ; Insert hidden one (even for denorms)
BCS _ffix_negative ; If negative input, separate case
MOV r3, #DExp_bias+1 ; r3 = 63 + DExp_bias
ADD r3, r3, #62 ; ..
SUBS r2, r3, r2, LSR #21 ; Determine shift amount
BLE shift_left ; Negative shift is a shift left, NaN,
; or INF
CMP r2, #64 ; See if shifting all bits out
BGE shift_right_64 ; If shifting all bits out, return zero
shift_right
MOV r12, #0 ; Need to clear r12 for inexact check
CMP r2, #32 ; See if shift amount >= 32
BLT shift_right_31 ; If not, shift right 31 or less
MOV r12, r0 ; If >= 32, save lost bits in temp reg,
MOV r0, r1 ; shift by moving words, and
MOV r1, #0 ; adjust the shift amount
SUB r2, r2, #32 ; ..
shift_right_31
RSB r3, r2, #32 ; Check for inexact
ORRS r12, r12, r0, LSL r3 ; ..
MOV r0, r0, LSR r2 ; Shift the result
ORR r0, r0, r1, LSL r3 ; ..
MOV r1, r1, LSR r2 ; ..
MOVNE r3, #INX_bit ; Set inexact if inexact
MOVEQ r3, #0 ; Otherwise set to no exceptions
B __dtoi64_return ; Return
shift_left
RSB r2, r2, #0 ; Get left shift amount
CMP r2, #32 ; If >= 32, shift by moving words, and
MOVGE r1, r0 ; adjusting shift amount
MOVGE r0, #0 ; ..
SUBGE r2, r2, #32 ; ..
MOV r1, r1, LSL r2 ; Perform rest of shift
RSB r3, r2, #32 ; ..
ORR r1, r1, r0, LSR r3 ; ..
MOV r0, r0, LSL r2 ; ..
MOV r3, #IVO_bit ; Overflow so set invalid operation
B __dtoi64_return ; Return
shift_right_64 ; 0.0 < abs(Arg) < 1.0, so losing all bits
MOV r3, #INX_bit ; Set inexact
MOV r0, #0 ; Return zero
MOV r1, #0 ; ..
B __dtoi64_return ; Return
_ffix_negative
MOV r3, #DExp_bias+1 ; r3 = 63 + DExp_bias
ADD r3, r3, #62 ; ..
SUBS r2, r3, r2, LSR #21 ; Determine shift amount
BLT shift_left_neg ; Negative shift is a shift left, NaN,
; or INF
BEQ special_int64_min ; Special case of 0x8000000000000000
CMP r2, #64 ; See if shifting all bits out
BGE shift_right_64 ; If shifting all bits out, return zero
shift_right_neg
MOV r12, #0 ; Need to clear r12 for inexact check
CMP r2, #32 ; See if shift amount >= 32
BLT shift_right_31_neg ; If not, shift right 31 or less
MOV r12, r0 ; If >= 32, save lost bits in temp reg,
MOV r0, r1 ; shift by moving words, and
MOV r1, #0 ; adjust the shift amount
SUB r2, r2, #32 ; ..
shift_right_31_neg
RSB r3, r2, #32 ; Check for inexact
ORRS r12, r12, r0, LSL r3 ; ..
MOV r0, r0, LSR r2 ; Shift the result
ORR r0, r0, r1, LSL r3 ; ..
MOV r1, r1, LSR r2 ; ..
MOVNE r3, #INX_bit ; Set inexact if inexact
MOVEQ r3, #0 ; Otherwise set to no exceptions
RSBS r0, r0, #0 ; Negate result
RSC r1, r1, #0 ; ..
B __dtoi64_return ; Return
shift_left_neg
RSB r2, r2, #0 ; Get left shift amount
CMP r2, #32 ; If >= 32, shift by moving words, and
MOVGE r1, r0 ; adjusting shift amount
MOVGE r0, #0 ; ..
SUBGE r2, r2, #32 ; ..
MOV r1, r1, LSL r2 ; Perform rest of shift
RSB r3, r2, #32 ; ..
ORR r1, r1, r0, LSR r3 ; ..
MOV r0, r0, LSL r2 ; ..
RSBS r0, r0, #0 ; Negate result
RSC r1, r1, #0 ; ..
MOV r3, #IVO_bit ; Overflow so set invalid operation
B __dtoi64_return ; Return
special_int64_min
TEQ r1, #0x80000000 ; If shift amount zero and result is
TEQEQ r0, #0 ; 0x8000000000000000, just leave it
MOVEQ r3, #0 ; ..
MOVNE r3, #IVO_bit ; Otherwise it's invalid (overflow)
RSBS r0, r0, #0 ; Negate result
RSC r1, r1, #0 ; ..
__dtoi64_return
TST r3, #FPECause_mask ; Any exceptions?
ADDEQ sp, sp, #LOC_SIZE ; If not, pop off saved arg and
IF Interworking :LOR: Thumbing
LDMEQFD sp!, {lr} ; return
BXEQ lr
ELSE
LDMEQFD sp!, {pc} ; return
ENDIF
ORR r12, r3, #_FpDToI64 ; Save exception info
LDR r3, [sp, #OrgOp1h] ; Load original arg
LDR r2, [sp, #OrgOp1l] ; ..
STR r0, [sp, #ExDResl] ; Store default result
STR r1, [sp, #ExDResh] ; ..
MOV r1, r12 ; Exception information
ADD r0, sp, #NewResl ; Pointer to new result
CALL FPE_Raise ; Handle exception information
IF Thumbing :LAND: :LNOT: Interworking
CODE16
bx pc ; switch back to ARM mode
nop
CODE32
ENDIF
LDR r0, [sp, #NewResl] ; Load new result
LDR r1, [sp, #NewResh] ; ..
ADD sp, sp, #LOC_SIZE ; Pop off exception record and result
IF Interworking :LOR: Thumbing
LDMFD sp!, {lr} ; Return
BX lr
ELSE
LDMFD sp!, {pc} ; Return
ENDIF
ENTRY_END __dtoi64
END
|
oeis/271/A271668.asm | neoneye/loda-programs | 11 | 162484 | ; A271668: Triangle read by rows. The first column is A000217(n+1). From the second row we apply - A002262(n) for the following terms of the row.
; Submitted by <NAME>(s1.)
; 1,3,3,6,6,5,10,10,9,7,15,15,14,12,9,21,21,20,18,15,11,28,28,27,25,22,18,13,36,36,35,33,30,26,21,15,45,45,44,42,39,35,30,24,17,55,55,54,52,49,45,40,34,27,19,66,66,65,63,60,56,51,45,38,30,21
mov $2,1
lpb $0
sub $0,$2
add $2,1
add $1,$2
lpe
bin $0,2
sub $1,$0
mov $0,$1
add $0,1
|
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_endt.asm | prismotizm/gigaleak | 0 | 96504 | <filename>other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_endt.asm
Name: zel_endt.asm
Type: file
Size: 216990
Last-Modified: '2016-05-13T04:36:32Z'
SHA-1: 1E6C972D773A43FE843C5EEBE403B72160A26AD1
Description: null
|
llvm-gcc-4.2-2.9/gcc/ada/s-tpopsp-posix-foreign.adb | vidkidz/crossbridge | 1 | 75 | <filename>llvm-gcc-4.2-2.9/gcc/ada/s-tpopsp-posix-foreign.adb
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K _ P R I M I T I V E S . O P E R A T I O N S . --
-- S P E C I F I C --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNARL; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, 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. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This is a POSIX version of this package where foreign threads are
-- recognized.
-- Currently, DEC Unix, SCO UnixWare, Solaris pthread, HPUX pthread and
-- GNU/Linux threads use this version.
separate (System.Task_Primitives.Operations)
package body Specific is
----------------
-- Initialize --
----------------
procedure Initialize (Environment_Task : Task_Id) is
pragma Warnings (Off, Environment_Task);
Result : Interfaces.C.int;
begin
Result := pthread_key_create (ATCB_Key'Access, null);
pragma Assert (Result = 0);
end Initialize;
-------------------
-- Is_Valid_Task --
-------------------
function Is_Valid_Task return Boolean is
begin
return pthread_getspecific (ATCB_Key) /= System.Null_Address;
end Is_Valid_Task;
---------
-- Set --
---------
procedure Set (Self_Id : Task_Id) is
Result : Interfaces.C.int;
begin
Result := pthread_setspecific (ATCB_Key, To_Address (Self_Id));
pragma Assert (Result = 0);
end Set;
----------
-- Self --
----------
-- To make Ada tasks and C threads interoperate better, we have added some
-- functionality to Self. Suppose a C main program (with threads) calls an
-- Ada procedure and the Ada procedure calls the tasking runtime system.
-- Eventually, a call will be made to self. Since the call is not coming
-- from an Ada task, there will be no corresponding ATCB.
-- What we do in Self is to catch references that do not come from
-- recognized Ada tasks, and create an ATCB for the calling thread.
-- The new ATCB will be "detached" from the normal Ada task master
-- hierarchy, much like the existing implicitly created signal-server
-- tasks.
function Self return Task_Id is
Result : System.Address;
begin
Result := pthread_getspecific (ATCB_Key);
-- If the key value is Null, then it is a non-Ada task.
if Result /= System.Null_Address then
return To_Task_Id (Result);
else
return Register_Foreign_Thread;
end if;
end Self;
end Specific;
|
src/arch/x86_64/boot/entry.nasm | Seris/thalix | 0 | 88064 | global kernel_entry
global multiboot_address
extern setup_long_mode
section .multiboot_header
header_start:
dd 0xe85250d6 ; multiboot2 magic
dd 0 ; architecture (x86_64)
dd header_end - header_start
dd 0x100000000 - (0xe85250d6 + 0 + header_end - header_start)
dw 0
dw 0
dd 8
header_end:
section .data
multiboot_address:
dd 0
section .text
bits 32
kernel_entry:
xor ebp, ebp
mov esp, stack_start
cli
call check_multiboot
mov [multiboot_address], ebx
call check_cpuid
call check_longmode
; long mode is available, multiboot2 header is present
; let us go on an adventure ! :)
jmp setup_long_mode
; we are now in long mode ! c:
mov dword [0xb8000], 0x2f4b2f4f
hlt
check_multiboot:
cmp eax, 0x36d76289 ; multiboot2 assure that eax must contain this magic
mov al, 'M'
jne early_error
ret
check_cpuid:
pushfd
pop eax
mov ebx, eax ; copy flag in ebx for future comparaison
xor eax, 1 << 21 ; flip 21th bit
push eax
popfd ; set flags register
pushfd
pop eax
cmp eax, ebx
mov al, 'C'
je early_error ; CPUID not available because 21th bit of flags was not flipped
ret
check_longmode:
mov eax, 0x80000000
cpuid
cmp eax, 0x80000001
mov al, 'L'
jb early_error ; if longmode available, we must have function above this value
ret
; print a ascii as error (which is stored in al) and halt
early_error:
mov dword [0xB8000], 0x04720445
mov dword [0xB8004], 0x043A0472
mov dword [0xB8008], 0x04200420
mov byte [0xB800A], al
mov word [0xB800C], 0x0420
hlt
section .bss
; stack is growing from high to low address
stack_end:
resb 4096
stack_start:
|
3-mid/opengl/source/opengl-errors.adb | charlie5/lace | 20 | 30653 | with
openGL.Tasks,
GL.Binding,
ada.Text_IO;
package body openGL.Errors
is
use GL;
function Current return String
is
use GL.Binding;
check_is_OK : constant Boolean := openGL.Tasks.Check; pragma Unreferenced (check_is_OK);
the_Error : constant GL.GLenum := glGetError;
begin
case the_Error is
when GL.GL_NO_ERROR => return "no error";
when GL_INVALID_ENUM => return "invalid Enum";
when GL_INVALID_VALUE => return "invalid Value";
when GL_INVALID_OPERATION => return "invalid Operation";
when GL_OUT_OF_MEMORY => return "out of Memory";
when others => return "unknown openGL error detected";
end case;
end Current;
procedure log (Prefix : in String := "")
is
current_Error : constant String := Current;
function Error_Message return String
is
begin
if Prefix = ""
then return "openGL error: '" & current_Error & "'";
else return Prefix & ": '" & current_Error & "'";
end if;
end Error_Message;
begin
if current_Error = "no error"
then
return;
end if;
raise openGL.Error with Error_Message;
end log;
procedure log (Prefix : in String := ""; Error_occurred : out Boolean)
is
use ada.Text_IO;
current_Error : constant String := Current;
begin
if current_Error = "no error"
then
error_Occurred := False;
return;
end if;
error_Occurred := True;
if Prefix = ""
then put_Line ("openGL error: '" & current_Error & "'");
else put_Line (Prefix & ": '" & current_Error & "'");
end if;
end log;
end openGL.Errors;
|
programs/oeis/134/A134770.asm | neoneye/loda | 22 | 246249 | ; A134770: a(n) = 4*A000984(n) - 3.
; 1,5,21,77,277,1005,3693,13725,51477,194477,739021,2821725,10816621,41602397,160466397,620470077,2404321557,9334424877,36300541197,141381055197,551386115277,2153031497757,8416395854877,32933722910397,128990414732397,505642425751005,1983674131792413
mov $1,2
mul $1,$0
bin $1,$0
mul $1,4
sub $1,3
mov $0,$1
|
coverage/IN_CTS/0554-COVERAGE-ssa-updater-impl-h-133-256/work/variant/2_spirv_opt_asm/shader.frag.asm | asuonpaa/ShaderTests | 0 | 1638 | <filename>coverage/IN_CTS/0554-COVERAGE-ssa-updater-impl-h-133-256/work/variant/2_spirv_opt_asm/shader.frag.asm<gh_stars>0
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 10
; Bound: 171
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %4 "main" %43 %48
OpExecutionMode %4 OriginUpperLeft
OpSource ESSL 320
OpName %4 "main"
OpName %10 "func(f1;"
OpName %9 "x"
OpName %14 "_GLF_global_loop_count"
OpName %16 "f"
OpName %33 "buf0"
OpMemberName %33 0 "_GLF_uniform_float_values"
OpName %35 ""
OpName %43 "_GLF_color"
OpName %48 "gl_FragCoord"
OpName %87 "v"
OpName %91 "param"
OpDecorate %32 ArrayStride 16
OpMemberDecorate %33 0 Offset 0
OpDecorate %33 Block
OpDecorate %35 DescriptorSet 0
OpDecorate %35 Binding 0
OpDecorate %43 Location 0
OpDecorate %48 BuiltIn FragCoord
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeFloat 32
%7 = OpTypePointer Function %6
%8 = OpTypeFunction %6 %7
%12 = OpTypeInt 32 1
%13 = OpTypePointer Private %12
%14 = OpVariable %13 Private
%15 = OpConstant %12 0
%17 = OpConstant %6 1
%24 = OpConstant %12 10
%25 = OpTypeBool
%28 = OpConstant %12 1
%30 = OpTypeInt 32 0
%31 = OpConstant %30 2
%32 = OpTypeArray %6 %31
%33 = OpTypeStruct %32
%34 = OpTypePointer Uniform %33
%35 = OpVariable %34 Uniform
%36 = OpTypePointer Uniform %6
%41 = OpTypeVector %6 4
%42 = OpTypePointer Output %41
%43 = OpVariable %42 Output
%47 = OpTypePointer Input %41
%48 = OpVariable %47 Input
%49 = OpConstant %30 0
%50 = OpTypePointer Input %6
%74 = OpConstant %6 0.100000001
%79 = OpConstant %30 1
%86 = OpTypePointer Function %41
%100 = OpConstant %6 0
%112 = OpConstantFalse %25
%113 = OpTypePointer Function %25
%115 = OpConstantTrue %25
%132 = OpUndef %6
%4 = OpFunction %2 None %3
%5 = OpLabel
%134 = OpVariable %113 Function %112
%135 = OpVariable %7 Function
%136 = OpVariable %7 Function
%137 = OpVariable %7 Function
%87 = OpVariable %86 Function
%91 = OpVariable %7 Function
OpSelectionMerge %110 None
OpSwitch %49 %111
%111 = OpLabel
OpStore %14 %15
%72 = OpAccessChain %50 %48 %49
%73 = OpLoad %6 %72
%75 = OpFOrdLessThan %25 %73 %74
OpSelectionMerge %77 None
OpBranchConditional %75 %76 %77
%76 = OpLabel
OpBranch %110
%77 = OpLabel
%80 = OpAccessChain %50 %48 %79
%81 = OpLoad %6 %80
%82 = OpFOrdLessThan %25 %81 %74
OpSelectionMerge %84 None
OpBranchConditional %82 %83 %84
%83 = OpLabel
OpBranch %110
%84 = OpLabel
%88 = OpAccessChain %36 %35 %15 %28
%89 = OpLoad %6 %88
%90 = OpCompositeConstruct %41 %89 %89 %89 %89
OpStore %87 %90
OpStore %91 %81
OpStore %134 %112
OpSelectionMerge %169 None
OpSwitch %49 %139
%139 = OpLabel
OpStore %136 %17
OpBranch %140
%140 = OpLabel
%141 = OpPhi %6 %17 %139 %149 %163
%142 = OpLoad %12 %14
%143 = OpSLessThan %25 %142 %24
OpLoopMerge %164 %163 None
OpBranchConditional %143 %144 %164
%144 = OpLabel
%145 = OpLoad %12 %14
%146 = OpIAdd %12 %145 %28
OpStore %14 %146
%147 = OpAccessChain %36 %35 %15 %15
%148 = OpLoad %6 %147
%149 = OpFAdd %6 %141 %148
OpStore %136 %149
%150 = OpAccessChain %36 %35 %15 %28
%151 = OpLoad %6 %150
%152 = OpCompositeConstruct %41 %151 %151 %151 %151
OpStore %43 %152
%153 = OpAccessChain %50 %48 %49
%154 = OpLoad %6 %153
%155 = OpFOrdGreaterThanEqual %25 %154 %151
OpSelectionMerge %158 None
OpBranchConditional %155 %156 %158
%156 = OpLabel
%157 = OpCompositeConstruct %41 %148 %148 %148 %148
OpStore %43 %157
OpBranch %158
%158 = OpLabel
%160 = OpFOrdLessThan %25 %81 %151
OpSelectionMerge %162 None
OpBranchConditional %160 %161 %162
%161 = OpLabel
OpStore %134 %115
OpStore %135 %149
OpBranch %164
%162 = OpLabel
OpBranch %163
%163 = OpLabel
OpBranch %140
%164 = OpLabel
%165 = OpPhi %6 %132 %140 %149 %161
%166 = OpPhi %6 %141 %140 %149 %161
%167 = OpPhi %25 %112 %140 %115 %161
OpSelectionMerge %168 None
OpBranchConditional %167 %169 %168
%168 = OpLabel
OpStore %134 %115
OpStore %135 %166
OpBranch %169
%169 = OpLabel
%170 = OpPhi %6 %165 %164 %166 %168
OpStore %137 %170
%107 = OpCompositeInsert %41 %170 %90 3
%109 = OpCompositeInsert %41 %170 %107 0
OpStore %87 %109
%101 = OpFOrdLessThan %25 %73 %100
OpSelectionMerge %103 None
OpBranchConditional %101 %102 %103
%102 = OpLabel
OpBranch %110
%103 = OpLabel
OpStore %43 %109
OpBranch %110
%110 = OpLabel
OpReturn
OpFunctionEnd
%10 = OpFunction %6 None %8
%9 = OpFunctionParameter %7
%11 = OpLabel
%120 = OpVariable %113 Function %112
%117 = OpVariable %7 Function
%16 = OpVariable %7 Function
OpSelectionMerge %116 None
OpSwitch %49 %119
%119 = OpLabel
OpStore %16 %17
OpBranch %18
%18 = OpLabel
%123 = OpPhi %6 %17 %119 %40 %21
%23 = OpLoad %12 %14
%26 = OpSLessThan %25 %23 %24
OpLoopMerge %20 %21 None
OpBranchConditional %26 %19 %20
%19 = OpLabel
%27 = OpLoad %12 %14
%29 = OpIAdd %12 %27 %28
OpStore %14 %29
%37 = OpAccessChain %36 %35 %15 %15
%38 = OpLoad %6 %37
%40 = OpFAdd %6 %123 %38
OpStore %16 %40
%44 = OpAccessChain %36 %35 %15 %28
%45 = OpLoad %6 %44
%46 = OpCompositeConstruct %41 %45 %45 %45 %45
OpStore %43 %46
%51 = OpAccessChain %50 %48 %49
%52 = OpLoad %6 %51
%55 = OpFOrdGreaterThanEqual %25 %52 %45
OpSelectionMerge %57 None
OpBranchConditional %55 %56 %57
%56 = OpLabel
%60 = OpCompositeConstruct %41 %38 %38 %38 %38
OpStore %43 %60
OpBranch %57
%57 = OpLabel
%61 = OpLoad %6 %9
%64 = OpFOrdLessThan %25 %61 %45
OpSelectionMerge %66 None
OpBranchConditional %64 %65 %66
%65 = OpLabel
OpStore %120 %115
OpStore %117 %40
OpBranch %20
%66 = OpLabel
OpBranch %21
%21 = OpLabel
OpBranch %18
%20 = OpLabel
%130 = OpPhi %6 %132 %18 %40 %65
%128 = OpPhi %6 %123 %18 %40 %65
%125 = OpPhi %25 %112 %18 %115 %65
OpSelectionMerge %121 None
OpBranchConditional %125 %116 %121
%121 = OpLabel
OpStore %120 %115
OpStore %117 %128
OpBranch %116
%116 = OpLabel
%129 = OpPhi %6 %130 %20 %128 %121
OpReturnValue %129
OpFunctionEnd
|
programs/oeis/282/A282850.asm | karttu/loda | 1 | 28372 | <reponame>karttu/loda
; A282850: 38-gonal numbers: a(n) = n*(18*n-17).
; 0,1,38,111,220,365,546,763,1016,1305,1630,1991,2388,2821,3290,3795,4336,4913,5526,6175,6860,7581,8338,9131,9960,10825,11726,12663,13636,14645,15690,16771,17888,19041,20230,21455,22716,24013,25346,26715,28120,29561
mov $1,$0
mul $0,18
sub $0,17
mul $1,$0
|
src/main/antlr4/org/ek9lang/antlr/EK9LexerRules.g4 | stephenjohnlimb/ek9 | 9 | 6648 | lexer grammar EK9LexerRules;
//Synthetic tokens for indenting and dedenting.
tokens { INDENT, DEDENT }
@lexer::members {
//It is necessary to declare this here to be used with predicates.
//As this call is used in the baase lexer antlr generates.
protected boolean isRegexPossible() { return true; }
}
//The order is important in antlr first and longest match.
MODULE : 'module';
//Type of module
DEFINES : 'defines';
CONSTANT : 'constant';
TYPE : 'type';
RECORD: 'record';
SERVICE : 'service';
PURE : 'pure' ;
FUNCTION : 'function';
PROGRAM : 'program';
APPLICATION: 'application';
ASPECT : 'aspect';
REGISTER : 'register';
ISOLATED : 'isolated';
ALLOW : 'allow';
EMPTY : 'empty';
CONSTRAIN : 'constrain';
TEXT : 'text';
AS : 'as';
OF : 'of';
URI : 'uri';
MAP : 'map';
HEAD : 'head';
TAIL : 'tail';
TEE : 'tee';
COLLECT : 'collect';
UNIQ : 'uniq';
CAT : 'cat';
SORT : 'sort';
FILTER : 'filter';
SELECT : 'select';
CALL: 'call';
ASYNC: 'async';
FLATTEN: 'flatten';
GROUP: 'group';
JOIN: 'join';
SPLIT: 'split';
SKIPPING: 'skip';
RANGE : 'range';
WITH : 'with';
THEN : 'then';
TRAIT: 'trait';
OPEN : 'open';
DECORATION : 'decoration';
WHEN : 'when';
REFERENCES: 'references';
LENGTH : 'length';
ONLY : 'only';
BY : 'by';
//Not all may be used - but are reserved
DISPATCHER : 'dispatcher'; //For certain classes etc we can support double dispatch if method marked with this
ABSTRACT : 'abstract';
ASSERT : 'assert';
BOOLEAN : 'Boolean'; //ek9 boolean
CASE : 'case';
CATCH : 'catch';
HANDLE : 'handle';
CHARACTER : 'Character'; //ek9 character
CLASS : 'class';
COMPONENT: 'component';
CONST : 'const';
DO : 'do';
ELSE : 'else';
EXTENDS : 'extends';
FINAL : 'final';
FINALLY : 'finally';
FLOAT : 'Float'; //ek9 float
FOR : 'for';
IF : 'if';
IS : 'is';
INTEGER : 'Integer'; //ek9 Integer
PACKAGE : 'package';
PRIVATE : 'private';
PROTECTED : 'protected';
OVERRIDE : 'override';
PUBLIC : 'public';
OPERATOR: 'operator';
SUPER : 'super';
SWITCH : 'switch';
GIVEN : 'given' ;
STRING : 'String';
REGEX : 'RegEx';
DATE : 'Date';
DATETIME : 'DateTime';
DURATION : 'Duration';
TIME : 'Time';
THIS : 'this';
THROW : 'throw';
TRY : 'try';
WHILE : 'while';
COLOUR: 'Colour';
DIMENSION: 'Dimension';
RESOLUTION: 'Resolution';
MONEY: 'Money';
VERSION: 'Version';
HTTP_GET: 'GET';
HTTP_DELETE: 'DELETE';
HTTP_HEAD: 'HEAD';
HTTP_POST: 'POST';
HTTP_PUT: 'PUT';
HTTP_PATCH: 'PATCH';
HTTP_OPTIONS: 'OPTIONS';
HTTP_PATH: 'PATH';
HTTP_HEADER: 'HEADER';
HTTP_QUERY: 'QUERY';
HTTP_REQUEST: 'REQUEST';
HTTP_CONTENT: 'CONTENT';
HTTP_CONTEXT: 'CONTEXT';
Uriproto
: ':' + UriprotoPart+
;
fragment
UriprotoPart
: '/'
| '/' Identifier ((SUB|DOT) Identifier)?
| '/' LBRACE Identifier (SUB Identifier)? RBRACE
;
IntegerLiteral
: DecimalIntegerLiteral
| HexIntegerLiteral
| OctalIntegerLiteral
;
BinaryLiteral
: BinaryIntegerLiteral
;
DateTimeLiteral
: Digit Digit Digit Digit '-' Digit Digit '-' Digit Digit 'T' Digit Digit ':' Digit Digit ':' Digit Digit ( ((('-'|'+') Digit Digit COLON Digit Digit)) | 'Z')
;
DateLiteral
: Digit Digit Digit Digit '-' Digit Digit '-' Digit Digit
;
TimeLiteral
: Digit Digit COLON Digit Digit (COLON Digit Digit)?
;
//ISO 8601 i.e P[n]Y[n]M[n]W[n]DT[n]H[n]M[n]S
DurationLiteral
: 'P' ('-'? Digit+ ('Y' | 'M' | 'W' | 'D') )* ('T' ('-'? Digit+ ('H' | 'M' | 'S') )* )?
;
MillisecondLiteral
: Digit+ 'ms'
;
DecorationDimensionLiteral
: Digit+ '.' Digit+ DimensionType
| Digit+ DimensionType
;
fragment
DimensionType
: ('km' | 'm' | 'cm' | 'mm' | 'mile' | 'in' | 'pc' | 'pt' | 'px' | 'em' | 'ex' | 'ch' | 'rem' | 'vw' | 'vh' | 'vmin' | 'vmax' | '%' )
;
DecorationResolutionLiteral
: Digit+ ('dpi' | 'dpc')
;
MoneyLiteral
: Digits ('.' Digits)? HASH [A-Z][A-Z][A-Z]
;
//With optional alpha, if present the alpha is first two hex digits
ColourLiteral
: HASH HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit (HexDigit HexDigit)?
;
fragment
DecimalIntegerLiteral
: DecimalNumeral
;
fragment
HexIntegerLiteral
: HexNumeral
;
fragment
OctalIntegerLiteral
: OctalNumeral
;
fragment
BinaryIntegerLiteral
: BinaryNumeral
;
fragment
DecimalNumeral
: '0'
| NonZeroDigit (Digits? | Underscores Digits)
;
fragment
Digits
: Digit (DigitsAndUnderscores? Digit)?
;
fragment
Digit
: '0'
| NonZeroDigit
;
fragment
NonZeroDigit
: [1-9]
;
fragment
DigitsAndUnderscores
: DigitOrUnderscore+
;
fragment
DigitOrUnderscore
: Digit
| '_'
;
fragment
Underscores
: '_'+
;
fragment
HexNumeral
: '0' [xX] HexDigits
;
fragment
HexDigits
: HexDigit (HexDigitsAndUnderscores? HexDigit)?
;
fragment
HexDigit
: [0-9a-fA-F]
;
fragment
HexDigitsAndUnderscores
: HexDigitOrUnderscore+
;
fragment
HexDigitOrUnderscore
: HexDigit
| '_'
;
fragment
OctalNumeral
: '0' Underscores? OctalDigits
;
fragment
OctalDigits
: OctalDigit (OctalDigitsAndUnderscores? OctalDigit)?
;
fragment
OctalDigit
: [0-7]
;
fragment
OctalDigitsAndUnderscores
: OctalDigitOrUnderscore+
;
fragment
OctalDigitOrUnderscore
: OctalDigit
| '_'
;
fragment
BinaryNumeral
: '0' [bB] BinaryDigits
;
fragment
BinaryDigits
: BinaryDigit (BinaryDigitsAndUnderscores? BinaryDigit)?
;
fragment
BinaryDigit
: [01]
;
fragment
BinaryDigitsAndUnderscores
: BinaryDigitOrUnderscore+
;
fragment
BinaryDigitOrUnderscore
: BinaryDigit
| '_'
;
FloatingPointLiteral
: DecimalFloatingPointLiteral
| HexadecimalFloatingPointLiteral
;
//Versions number must look like this major.minor.patch-buildNo is 3.2.1-9
//Or look like this major.minor.patch-buildNo is 3.2.1-feature12-9 for a feature based version
VersionNumberLiteral
: Digits ('.' Digits) ('.' Digits) ('-' Digits)
| Digits ('.' Digits) ('.' Digits) ('-' StringCharacter+ Digits* StringCharacter*) ('-' Digits)
;
fragment
DecimalFloatingPointLiteral
: Digits '.' Digits? ExponentPart?
| '.' Digits ExponentPart?
| Digits ExponentPart
| Digits
;
fragment
ExponentPart
: ExponentIndicator SignedInteger
;
fragment
ExponentIndicator
: [eE]
;
fragment
SignedDecimal
: Sign? DecimalFloatingPointLiteral
;
fragment
SignedInteger
: Sign? Digits
;
fragment
Sign
: [+-]
;
fragment
HexadecimalFloatingPointLiteral
: HexSignificand BinaryExponent
;
fragment
HexSignificand
: HexNumeral '.'?
| '0' [xX] HexDigits? '.' HexDigits
;
fragment
BinaryExponent
: BinaryExponentIndicator SignedInteger
;
fragment
BinaryExponentIndicator
: [pP]
;
BooleanLiteral
: 'true'
| 'false'
;
CharacterLiteral
: '\'' SingleCharacter '\''
| '\'' EscapeSequence '\''
;
fragment
SingleCharacter
: ~['\\]
;
//semantic predecate to limit when regular expression token can be provided.
//Also the order of this the line comment and the un-closed regex is important and antlr processes them in order and tries to find longest match
//The ~ means 'not' so " | ~[\r\n]" means any char that is not new line or line feed.
// Note that we use normal reg ex like \d, \D, \s, \S, \w, \W, \b so EK9 will escape these to \\d for example, to use a literal \ you need to escape to \\ and ek9 will escape to \\\\
//The ~ means 'not' so " | ~[\r\n/]" means any char that is not new line or line feed and not / - but then ends with a new line '\n'.
//The *? is the non greedy any number of!
RegExLiteral
: {isRegexPossible()}? '/' ( '\\/' | ~[\r\n] )*? '/'
;
LINE_COMMENT: '//' ~[\r\n]* -> skip;
//html style for developers with that back ground
BLOCK_COMMENT1: '<!--' .*? '-->' -> skip;
//These two are more consistent ek9 type first is just to comment out
BLOCK_COMMENT2: '<!-' .*? '-!>' -> skip;
//But this comments out put is intended to be attached to the source as helpful doc comments.
CODE_COMMENT: '<?-' .*? '-?>' -> skip;
StringLiteral
: '"' StringCharacters? '"'
;
fragment
StringCharacters
: StringCharacter+
;
fragment
StringCharacter
: ~["]
| EscapeSequence
;
fragment
EscapeSequence
: '\\' [btnfr"'\\]
| OctalEscape
| UnicodeEscape
;
fragment
OctalEscape
: '\\' OctalDigit
| '\\' OctalDigit OctalDigit
| '\\' ZeroToThree OctalDigit OctalDigit
;
fragment
ZeroToThree
: [0-3]
;
fragment
UnicodeEscape
: '\\' 'u' HexDigit HexDigit HexDigit HexDigit
;
LPAREN : '(';
RPAREN : ')';
LBRACE : '{';
//Also acts as end of interpolation - Lexer must override popMode to be safe on empty stack
RBRACE : '}' -> popMode;
//Start of a String literal so go into STRING interpolation MODE
OPEN_STRING: '`' -> pushMode(STRING_MODE); // Switch context
LBRACK : '[';
RBRACK : ']';
SEMI : ';';
COMMA : ',';
DOT : '.';
HASH : '#';
TOJSON : '$$';
DOLLAR : '$';
SHEBANG : '#!ek9';
PROMOTE : '#^'; //ek9 promote operator
HASHCODE : '#?'; //ek9 hashcode operator
PREFIX : '#<'; //ek9 prefix/first operator
SUFFIX : '#>'; //ek9 suffix/last operator
PIPE : '|'; //Used in streams but also as operator on collect into a type.
DEFAULT : 'default';
GT : '>';
LT : '<';
QUESTION : '?'; // used in syntax and as an operator for isSet
CHECK : '??'; //null coalescing
ELVIS: '?:'; //null and isSet coalescing
GUARD : '?='; // a special type of assign that also checks if null on assignment used in if statements
TERNARY_LT : '<?'; //ternary operator
TERNARY_LE : '<=?'; //ternary operator
TERNARY_GT : '>?'; //ternary operator
TERNARY_GE : '>=?'; //ternary operator
ASSIGN_UNSET : ':=?'; //Assign to the left hand side if left handside is null or unset
COLON : ':';
EQUAL : '==';
LE : '<=';
GE : '>=';
NOT : 'not'; //ek9 not
IN : 'in'; //ek9 in
MATCHES : 'matches' ; //also matching
CONTAINS : 'contains'; // ek9 contains
NOTEQUAL : '<>'; //SQL styles of not equals
NOTEQUAL2 : '!='; //ek9 not equals more like C C++ and Java
AND : 'and'; //ek9 and
OR : 'or'; //ek9 or
XOR : 'xor'; //ek9 X or
CMP : '<=>'; //ek9 compare
FUZ : '<~>'; //ek9 fuzzy compare
INC : '++';
DEC : '--';
ADD : '+';
SUB : '-';
MUL : '*';
DIV : '/';
SHFTL : '<<'; //The logical left shift
SHFTR : '>>' ; //The logical right shift
BANG : '!'; //Factorial/Clear operator or requires injection
TILDE : '~'; //ek9 not/negate operator
CARET : '^'; //ek9 power
MOD : 'mod'; //ek9 modulus for values
REM : 'rem'; //ek9 remainder check sign on MOD and REM
ABS : 'abs'; //EK9 absolute removes negative
SQRT : 'sqrt';
RIGHT_ARROW : '->';
LEFT_ARROW : '<-';
COLONCOLON : '::';
MERGE : ':~:'; //ek9 merge right item into left
COPY : ':=:'; //ek9 make a copy/clone - this is different to assignment.
REPLACE : ':^:'; //ek9 replace something if possible ideal for lists of things
ASSIGN : ':='; //ek9 assign - this copies the variable pointer over - above does a copy of the contents.
ASSIGN2 : '='; //Also allow '=' as assignment
ADD_ASSIGN : '+=';
SUB_ASSIGN : '-=';
MUL_ASSIGN : '*=';
DIV_ASSIGN : '/=';
Identifier
: Letter LetterOrDigit*
;
fragment
LowerCase
: [a-z]
;
fragment
Letter
: [a-zA-Z]
;
fragment
LetterOrDigit
: [a-zA-Z0-9]
;
AT : '@';
ELLIPSIS : '...';
NL: ('\r'? '\n' ' '*); // note the ' '*
TAB: '\t';
WS: [ ]+ -> skip;
ANY: . ;
mode STRING_MODE;
//Only when inside a String i.e STRING_MODE - do with push interpolation
//which is just normal processing again
ENTER_EXPR_INTERPOLATION: INTERP_START -> pushMode(DEFAULT_MODE);
STRING_TEXT: TEXT_CHAR+;
TEXT_CHAR
: ~[$`]
| '\\$'
| '\\`'
| EscapeSequence
;
fragment
INTERP_START: '$' '{';
//End of the String when in string mode - pop out of STRING_MODE
CLOSE_STRING: '`' -> popMode;
//EOF
|
src/dw1000-reception_quality.ads | SALLYPEMDAS/DW1000 | 9 | 15070 | -------------------------------------------------------------------------------
-- Copyright (c) 2016 <NAME>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------------
with DW1000.Register_Types; use DW1000.Register_Types;
with DW1000.Types; use DW1000.Types;
-- @summary
-- Utility functions for measuring the quality of received frames.
package DW1000.Reception_Quality
with SPARK_Mode => On
is
function Adjust_RXPACC (RXPACC : in RX_FINFO_RXPACC_Field;
RXPACC_NOSAT : in RXPACC_NOSAT_Field;
RXBR : in RX_FINFO_RXBR_Field;
SFD_LENGTH : in Bits_8;
Non_Standard_SFD : in Boolean) return RX_FINFO_RXPACC_Field
with Pre => (RXBR /= Reserved
and (if Non_Standard_SFD then SFD_LENGTH in 8 | 16));
-- Apply the correction to the RXPACC value.
--
-- The preamble accumulation count (RXPACC) value may include SFD symbols
-- in the count. This function removes SFD symbols from the preamble
-- symbol count in RXPACC, and returns the adjusted RXPACC value.
--
-- Note: This function does not support user-defined SFD sequences. It only
-- supports the standard and DecaWave defined SFD sequences. The specific
-- SFD sequence used is determined from the RXBR, SFD_LENGTH, and
-- Non_Standard_SFD parameters.
--
-- @param RXPACC The value of the RXPACC field from the RX_FINFO register.
-- This is the value which is to be adjusted.
--
-- @param RXPACC_NOSAT The value of the RXPACC_NOSAT register.
--
-- @param RXBR The value of the RXBR field from the RX_FINFO register.
-- This value determines the data rate of the received frame (110 kbps,
-- 850 kbps, or 6.8 Mbps).
--
-- @param SFD_LENGTH The value of the SFD_LENGTH field from the USR_SFD
-- register. This value must be 8 or 16 symbols and is used only if
-- Non_Standard_SFD is True. Otherwise, the value does not matter.
--
-- @param Non_Standard_SFD Determines whether or not the standards-defined
-- SFD sequence is used, or the DecaWave defined sequence is used.
function Receive_Signal_Power (Use_16MHz_PRF : in Boolean;
RXPACC : in RX_FINFO_RXPACC_Field;
CIR_PWR : in RX_FQUAL_CIR_PWR_Field)
return Float
with Post => Receive_Signal_Power'Result in -142.81 .. -14.43;
-- Compute the estimated receive signal power in dBm.
--
-- @param Use_16MHz_PRF Set to True if a 16 MHz PRF is used, otherwise set
-- to False to indicate a 64 MHz PRF.
--
-- @param RXPACC The value of the RXPACC field from the RX_FINFO register.
-- Note that this value should be corrected before calling this function
-- if it is equal to the RXPACC_NOSAT register. See the description for
-- the RXPACC field in the DW1000 User Manual in Section 7.2.18 for more
-- information on correcting the RXPACC.
--
-- @param CIR_PWR The value of the CIR_PWR field from the RX_FQUAL register
--
-- @return The estimated receive signal power in dBm. The theoretical range
-- is -166.90 dBm to -14.43 dBm.
function First_Path_Signal_Power (Use_16MHz_PRF : in Boolean;
F1 : in RX_TIME_FP_AMPL1_Field;
F2 : in RX_FQUAL_FP_AMPL2_Field;
F3 : in RX_FQUAL_FP_AMPL3_Field;
RXPACC : in RX_FINFO_RXPACC_Field)
return Float
with Post => First_Path_Signal_Power'Result in -193.99 .. -17.44;
-- Compute the estimated first path power level in dBm.
--
-- @param Use_16MHz_PRF Set to True if a 16 MHz PRF is used, otherwise set
-- to False to indicate a 64 MHz PRF.
--
-- @param F1 The value of the FP_AMPL1 field from the RX_TIME register.
--
-- @param F2 The value of the FP_AMPL2 field from the RX_FQUAL register.
--
-- @param F3 The value of the FP_AMPL3 field from the RX_FQUAL register.
--
-- @param RXPACC The value of the RXPACC field from the RX_FINFO register.
-- Note that this value should be corrected before calling this function
-- if it is equal to the RXPACC_NOSAT register. See the description for
-- the RXPACC field in the DW1000 User Manual in Section 7.2.18 for more
-- information on correcting the RXPACC.
--
-- @return The estimated first path power in dBm. The theoretical range
-- is -218.07 dBm to -12.67 dBm.
function Transmitter_Clock_Offset (RXTOFS : in RX_TTCKO_RXTOFS_Field;
RXTTCKI : in RX_TTCKI_RXTTCKI_Field)
return Long_Float
with Post => Transmitter_Clock_Offset'Result in -1.0 .. 1.0;
-- Calculate the clock offset between the receiver's and transmitter's
-- clocks.
--
-- Since the transmitter and receiver radios are clocked by their own
-- crystals, there can be a slight variation between the crystals'
-- frequencies. This function provides a measure of the offset
-- between this receiver and the remote transmitter clocks.
--
-- @param RXTOFS The value of the RXTOFS field from the RX_TTCKO register.
--
-- @param RXTTCKI The value of the RXTTCKI field from the RX_TTCKI
-- register.
--
-- @return The computed clock offset. A positive value indicates that the
-- transmitter's clock is running faster than the receiver's clock, and
-- a negative value indicates that the transmitter's clock is running
-- slower than the receiver's clock. For example, a value of 7.014E-06
-- indicates that the transmitter is faster by 7 ppm. Likewise, a value
-- of -5.045E-06 indicates that the transmitter's clock is slower by
-- 5 ppm.
end DW1000.Reception_Quality;
|
asm/inc.asm | stfnwong/z8t | 0 | 166834 | ; INC instruction
; For testing lexer and assembler
; Taken from http://www.z80.info/lesson1.htm
ld a,5 ;a=5
inc a ;a=a+1, a=6
ld b,a ;b=a, b=6
dec b ;b=b-1, b=5
ld bc,568 ;bc=568
inc bc ;bc=bc+1, bc=569
inc bc ;bc=bc+1, bc=570
|
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/___fsgt_callee.asm | jpoikela/z88dk | 0 | 163737 |
SECTION code_fp_math32
PUBLIC ___fsgt_callee
EXTERN cm32_sdcc___fsgt_callee
defc ___fsgt_callee = cm32_sdcc___fsgt_callee
|
oeis/007/A007613.asm | neoneye/loda-programs | 11 | 171495 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A007613: a(n) = (8^n + 2(-1)^n)/3.
; 1,2,22,170,1366,10922,87382,699050,5592406,44739242,357913942,2863311530,22906492246,183251937962,1466015503702,11728124029610,93824992236886,750599937895082,6004799503160662,48038396025285290,384307168202282326,3074457345618258602,24595658764946068822,196765270119568550570,1574122160956548404566,12592977287652387236522,100743818301219097892182,805950546409752783137450,6447604371278022265099606,51580834970224178120796842,412646679761793424966374742,3301173438094347399730997930
mov $2,-8
pow $2,$0
add $2,2
gcd $1,$2
div $1,3
mov $0,$1
|
Automaton/TuringMachine.agda | Lolirofle/stuff-in-agda | 6 | 1990 | <filename>Automaton/TuringMachine.agda
import Lvl
open import Structure.Setoid
open import Type
module Automaton.TuringMachine where
open import Data.Boolean
import Data.Boolean.Operators
open Data.Boolean.Operators.Programming
open import Data.Either as Either using (_‖_)
open import Data.Either.Setoid
open import Data.Option as Option
open import Data.Option.Functions as Option
open import Data.Option.Setoid
open import Data.Tuple as Tuple using (_⨯_ ; _,_)
open import Data.Tuple.Equivalence
open import Data.List renaming (∅ to ε ; _⊰_ to _·_)
open import Data.List.Setoid
open import Functional
open import Logic
open import Relator.Equals.Proofs.Equivalence
open import Structure.Operator
open import Structure.Relator
open import Structure.Relator.Properties
open import Syntax.Transitivity
open import Type.Size.Finite
private variable ℓₚ ℓₛ ℓₐ ℓₑₛ ℓₑₐ : Lvl.Level
private variable Alphabet : Type{ℓₐ}
data Direction : Type{Lvl.𝟎} where
Backward : Direction
Stay : Direction
Forward : Direction
private instance _ = [≡]-equiv {T = Direction}
record Tape (Alphabet : Type{ℓₐ}) : Type{ℓₐ} where
coinductive
field
back : Tape(Alphabet)
current : Alphabet
front : Tape(Alphabet)
update : (Alphabet → Alphabet) → Tape(Alphabet)
back (update _) = back
current(update f) = f(current)
front (update _) = front
stepBackward : Tape(Alphabet) → Tape(Alphabet)
Tape.back (stepBackward t) = Tape.back(Tape.back t)
Tape.current(stepBackward t) = Tape.current(Tape.back t)
Tape.front (stepBackward t) = t
stepForward : Tape(Alphabet) → Tape(Alphabet)
Tape.back (stepForward t) = t
Tape.current(stepForward t) = Tape.current(Tape.front t)
Tape.front (stepForward t) = Tape.front(Tape.front t)
stepInDirection : Direction → Tape(Alphabet) → Tape(Alphabet)
stepInDirection Backward = stepBackward
stepInDirection Stay = id
stepInDirection Forward = stepForward
module _ ⦃ equiv-alphabet : Equiv{ℓₑₐ}(Alphabet) ⦄ where
step-inverseₗᵣ : ∀{t : Tape(Alphabet)} → (Tape.current(stepBackward(stepForward(t))) ≡ Tape.current(t))
step-inverseₗᵣ = reflexivity(_≡_ ⦃ equiv-alphabet ⦄)
step-inverseᵣₗ : ∀{t : Tape(Alphabet)} → (Tape.current(stepBackward(stepForward(t))) ≡ Tape.current(t))
step-inverseᵣₗ = reflexivity(_≡_ ⦃ equiv-alphabet ⦄)
module _
(State : Type{ℓₛ}) ⦃ equiv-state : Equiv{ℓₑₛ}(State) ⦄
(Alphabet : Type{ℓₐ}) ⦃ equiv-alphabet : Equiv{ℓₑₐ}(Alphabet) ⦄
where
private instance _ = [≡]-equiv {T = Bool}
-- Turing machine
-- `State` (Q) is the set of states.
-- `Alphabet` (Σ) is the set of symbols/the alphabet.
-- `transition` (δ) is the transition function.
-- `start` (q₀) is the start state.
-- `Final` (F) is the subset of State which are the final/accepting states.
record TuringMachine : Type{ℓₛ Lvl.⊔ ℓₑₐ Lvl.⊔ ℓₑₛ Lvl.⊔ ℓₐ Lvl.⊔ Lvl.𝐒(ℓₚ)} where
constructor turingMachine
field
⦃ State-finite ⦄ : Finite(State)
⦃ Alphabet-finite ⦄ : Finite(Alphabet)
transition : State → Option(Alphabet) → Option(State ⨯ Alphabet ⨯ Direction)
⦃ transition-binaryOperator ⦄ : BinaryOperator(transition)
start : State
Final : State → Type{ℓₚ}
⦃ Final-unaryRelator ⦄ : UnaryRelator(Final)
-- isFinal : State → Bool
-- TODO: Not sure what the best (most easy to use) formalization of a TM would be or if this is correct
Configuration = State ⨯ Tape(Option(Alphabet))
module Configuration where
step : TuringMachine{ℓₚ} → (Configuration → Option(Configuration))
step tm (s , t) = Option.map (\(ns , nx , dir) → (ns , stepInDirection dir (Tape.update t (Some ∘ const nx)))) (TuringMachine.transition tm s (Tape.current t))
|
quit_simulator.applescript | mikegolay/applescript | 0 | 307 | <gh_stars>0
tell application "Simulator"
quit
end tell
|
programs/oeis/010/A010706.asm | karttu/loda | 1 | 7233 | <reponame>karttu/loda
; A010706: Period 2: repeat (3,8).
; 3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3
mod $0,2
mov $1,$0
mul $1,5
add $1,3
|
predef.ada | daveshields/AdaEd | 3 | 9529 | <gh_stars>1-10
--
--
-- **********************************
-- * *
-- * T e x t *
-- * *
-- * Input / Output Package *
-- * *
-- * and other *
-- * *
-- * Predefined Units *
-- * *
-- * *
-- * ADA Project *
-- * Courant Institute *
-- * New York University *
-- * 251 Mercer Street, *
-- * New York, NY 10012 *
-- * *
-- **********************************
--
--
--
pragma page;
-- This file contains several of the predefined Ada package spec-
-- ifications. They do not actually implement the package's
-- operations, which are coded in the implementation language C,
-- but they provide an interface to them through the standard
-- procedure/function calling mechanism. The predefined packages are:
--
-- . The SYSTEM package.
--
-- . The IO_EXCEPTIONS package.
--
-- . The generic SEQUENTIAL_IO package.
--
-- . The generic DIRECT_IO package.
--
-- . The TEXT_IO package.
--
-- . The CALENDAR package and the predefined subprograms
-- UNCHECKED_CONVERSION and UNCHECKED_DEALLOCATION.
--
--
pragma page;
package SYSTEM is
type NAME is (ELXSI_BSD, ELXSI_ENIX, PC_DOS,
SUN_UNIX, VAX_UNIX, VAX_VMS) ;
SYSTEM_NAME : constant NAME := SUN_UNIX;
STORAGE_UNIT : constant := 32;
MEMORY_SIZE : constant := 2**16 - 1;
-- System Dependent Named Numbers:
MIN_INT : constant := -2**31;
MAX_INT : constant := 2**31-1;
MAX_DIGITS : constant := 6;
MAX_MANTISSA : constant := 31;
FINE_DELTA : constant := 2.0**(-30);
TICK : constant := 0.01;
-- Other System Dependent Declarations
subtype PRIORITY is INTEGER range 1 .. 4;
type SEGMENT_TYPE is new INTEGER range 0..255;
type OFFSET_TYPE is new INTEGER range 0..32767;
type ADDRESS is record
SEGMENT : SEGMENT_TYPE := SEGMENT_TYPE'LAST;
OFFSET : OFFSET_TYPE := OFFSET_TYPE'LAST;
end record;
SYSTEM_ERROR : exception;
end SYSTEM;
package IO_EXCEPTIONS is
STATUS_ERROR : exception;
MODE_ERROR : exception;
NAME_ERROR : exception;
USE_ERROR : exception;
DEVICE_ERROR : exception;
END_ERROR : exception;
DATA_ERROR : exception;
LAYOUT_ERROR : exception;
end IO_EXCEPTIONS;
pragma page;
with IO_EXCEPTIONS;
generic
type ELEMENT_TYPE is private;
package SEQUENTIAL_IO is
type FILE_TYPE is limited private;
type FILE_MODE is (IN_FILE, OUT_FILE);
-- File management
procedure CREATE (FILE : in out FILE_TYPE;
MODE : in FILE_MODE := OUT_FILE;
NAME : in STRING := "";
FORM : in STRING := "");
pragma IO_interface(CREATE,SIO_CREATE,ELEMENT_TYPE);
procedure OPEN (FILE : in out FILE_TYPE;
MODE : in FILE_MODE;
NAME : in STRING;
FORM : in STRING := "");
pragma IO_interface(OPEN,SIO_OPEN,ELEMENT_TYPE);
procedure CLOSE (FILE : in out FILE_TYPE);
pragma IO_interface(CLOSE,SIO_CLOSE);
procedure DELETE (FILE : in out FILE_TYPE);
pragma IO_interface(DELETE,SIO_DELETE);
procedure RESET (FILE : in out FILE_TYPE; MODE : in FILE_MODE);
pragma IO_interface(RESET,SIO_RESET_MODE,ELEMENT_TYPE);
procedure RESET (FILE : in out FILE_TYPE);
pragma IO_interface(RESET,SIO_RESET,ELEMENT_TYPE);
function MODE (FILE : in FILE_TYPE) return FILE_MODE;
pragma IO_interface(MODE,SIO_MODE);
function NAME (FILE : in FILE_TYPE) return STRING;
pragma IO_interface(NAME,SIO_NAME);
function FORM (FILE : in FILE_TYPE) return STRING;
pragma IO_interface(FORM,SIO_FORM);
function IS_OPEN (FILE : in FILE_TYPE) return BOOLEAN;
pragma IO_interface(IS_OPEN,SIO_IS_OPEN);
-- Input and Output Operations:
procedure READ (FILE : in FILE_TYPE; ITEM : out ELEMENT_TYPE);
pragma IO_interface(READ,SIO_READ,ELEMENT_TYPE);
procedure WRITE (FILE : in FILE_TYPE; ITEM : in ELEMENT_TYPE);
pragma IO_interface(WRITE,SIO_WRITE,ELEMENT_TYPE);
function END_OF_FILE(FILE : in FILE_TYPE) return BOOLEAN;
pragma IO_interface(END_OF_FILE,SIO_END_OF_FILE);
-- Exceptions:
STATUS_ERROR : exception renames IO_EXCEPTIONS.STATUS_ERROR;
MODE_ERROR : exception renames IO_EXCEPTIONS.MODE_ERROR;
NAME_ERROR : exception renames IO_EXCEPTIONS.NAME_ERROR;
USE_ERROR : exception renames IO_EXCEPTIONS.USE_ERROR;
DEVICE_ERROR : exception renames IO_EXCEPTIONS.DEVICE_ERROR;
END_ERROR : exception renames IO_EXCEPTIONS.END_ERROR;
DATA_ERROR : exception renames IO_EXCEPTIONS.DATA_ERROR;
private
UNINITIALIZED: constant := 0;
type FILE_TYPE is record
FILENUM: INTEGER := UNINITIALIZED;
end record;
end SEQUENTIAL_IO;
package body SEQUENTIAL_IO is
end SEQUENTIAL_IO;
pragma page;
with IO_EXCEPTIONS;
generic
type ELEMENT_TYPE is private;
package DIRECT_IO is
type FILE_TYPE is limited private;
type FILE_MODE is (IN_FILE, INOUT_FILE, OUT_FILE);
type COUNT is range 0 .. INTEGER'LAST;
subtype POSITIVE_COUNT is COUNT range 1 .. COUNT'LAST;
-- File management
procedure CREATE (FILE : in out FILE_TYPE;
MODE : in FILE_MODE := INOUT_FILE;
NAME : in STRING := "";
FORM : in STRING := "");
pragma IO_interface(CREATE,DIO_CREATE,ELEMENT_TYPE);
procedure OPEN (FILE : in out FILE_TYPE;
MODE : in FILE_MODE;
NAME : in STRING;
FORM : in STRING := "");
pragma IO_interface(OPEN,DIO_OPEN,ELEMENT_TYPE);
procedure CLOSE (FILE : in out FILE_TYPE);
pragma IO_interface(CLOSE,DIO_CLOSE);
procedure DELETE (FILE : in out FILE_TYPE);
pragma IO_interface(DELETE,DIO_DELETE);
procedure RESET (FILE : in out FILE_TYPE; MODE : in FILE_MODE);
pragma IO_interface(RESET,DIO_RESET_MODE,ELEMENT_TYPE);
procedure RESET (FILE : in out FILE_TYPE);
pragma IO_interface(RESET,DIO_RESET,ELEMENT_TYPE);
function MODE (FILE : in FILE_TYPE) return FILE_MODE;
pragma IO_interface(MODE,DIO_MODE);
function NAME (FILE : in FILE_TYPE) return STRING;
pragma IO_interface(NAME,DIO_NAME);
function FORM (FILE : in FILE_TYPE) return STRING;
pragma IO_interface(FORM,DIO_FORM);
function IS_OPEN (FILE : in FILE_TYPE) return BOOLEAN;
pragma IO_interface(IS_OPEN,DIO_IS_OPEN);
-- Input and Output Operations:
procedure READ (FILE : in FILE_TYPE; ITEM : out ELEMENT_TYPE);
pragma IO_interface(READ,DIO_READ,ELEMENT_TYPE);
procedure READ (FILE : in FILE_TYPE; ITEM : out ELEMENT_TYPE;
FROM : in POSITIVE_COUNT);
pragma IO_interface(READ,DIO_READ_FROM,ELEMENT_TYPE);
procedure WRITE (FILE : in FILE_TYPE; ITEM : in ELEMENT_TYPE);
pragma IO_interface(WRITE,DIO_WRITE,ELEMENT_TYPE);
procedure WRITE (FILE : in FILE_TYPE; ITEM : in ELEMENT_TYPE;
TO : in POSITIVE_COUNT);
pragma IO_interface(WRITE,DIO_WRITE_TO,ELEMENT_TYPE);
procedure SET_INDEX(FILE : in FILE_TYPE; TO :in POSITIVE_COUNT);
pragma IO_interface(SET_INDEX,DIO_SET_INDEX);
function INDEX (FILE : in FILE_TYPE) return POSITIVE_COUNT;
pragma IO_interface(INDEX,DIO_INDEX);
function SIZE (FILE : in FILE_TYPE) return COUNT;
pragma IO_interface(SIZE,DIO_SIZE);
function END_OF_FILE(FILE : in FILE_TYPE) return BOOLEAN;
pragma IO_interface(END_OF_FILE,DIO_END_OF_FILE);
-- Exceptions:
STATUS_ERROR : exception renames IO_EXCEPTIONS.STATUS_ERROR;
MODE_ERROR : exception renames IO_EXCEPTIONS.MODE_ERROR;
NAME_ERROR : exception renames IO_EXCEPTIONS.NAME_ERROR;
USE_ERROR : exception renames IO_EXCEPTIONS.USE_ERROR;
DEVICE_ERROR : exception renames IO_EXCEPTIONS.DEVICE_ERROR;
END_ERROR : exception renames IO_EXCEPTIONS.END_ERROR;
DATA_ERROR : exception renames IO_EXCEPTIONS.DATA_ERROR;
private
UNINITIALIZED: constant := 0;
type FILE_TYPE is record
FILENUM: INTEGER := UNINITIALIZED;
end record;
end DIRECT_IO;
package body DIRECT_IO is
end DIRECT_IO;
pragma page;
with IO_EXCEPTIONS;
package TEXT_IO is
type FILE_TYPE is limited private;
type FILE_MODE is (IN_FILE, OUT_FILE);
type COUNT is range 0 .. 32767;
subtype POSITIVE_COUNT IS COUNT range 1 .. COUNT'LAST;
UNBOUNDED : constant COUNT := 0; -- line and page length
subtype FIELD is INTEGER range 0 .. 100 ;
subtype NUMBER_BASE is INTEGER range 2 .. 16;
type TYPE_SET is (LOWER_CASE, UPPER_CASE);
-- File Management
procedure CREATE (FILE : in out FILE_TYPE;
MODE : in FILE_MODE := OUT_FILE;
NAME : in STRING := "";
FORM : in STRING := "");
pragma IO_interface(CREATE,TIO_CREATE);
procedure OPEN (FILE : in out FILE_TYPE;
MODE : in FILE_MODE;
NAME : in STRING;
FORM : in STRING := "");
pragma IO_interface(OPEN,TIO_OPEN);
procedure CLOSE (FILE : in out FILE_TYPE);
pragma IO_interface(CLOSE,TIO_CLOSE);
procedure DELETE (FILE : in out FILE_TYPE);
pragma IO_interface(DELETE,TIO_DELETE);
procedure RESET (FILE : in out FILE_TYPE; MODE : in FILE_MODE);
pragma IO_interface(RESET,TIO_RESET_MODE);
procedure RESET (FILE : in out FILE_TYPE);
pragma IO_interface(RESET,TIO_RESET);
function MODE (FILE : in FILE_TYPE) return FILE_MODE;
pragma IO_interface(MODE,TIO_MODE);
function NAME (FILE : in FILE_TYPE) return STRING;
pragma IO_interface(NAME,TIO_NAME);
function FORM (FILE : in FILE_TYPE) return STRING;
pragma IO_interface(FORM,TIO_FORM);
function IS_OPEN (FILE : in FILE_TYPE) return BOOLEAN;
pragma IO_interface(IS_OPEN,TIO_IS_OPEN);
-- Control of default input and output files
procedure SET_INPUT (FILE : in FILE_TYPE);
pragma IO_interface(SET_INPUT,SET_INPUT);
procedure SET_OUTPUT (FILE : in FILE_TYPE);
pragma IO_interface(SET_OUTPUT,SET_OUTPUT);
function STANDARD_INPUT return FILE_TYPE;
pragma IO_interface(STANDARD_INPUT,STANDARD_INPUT);
function STANDARD_OUTPUT return FILE_TYPE;
pragma IO_interface(STANDARD_OUTPUT,STANDARD_OUTPUT);
function CURRENT_INPUT return FILE_TYPE;
pragma IO_interface(CURRENT_INPUT,CURRENT_INPUT);
function CURRENT_OUTPUT return FILE_TYPE;
pragma IO_interface(CURRENT_OUTPUT,CURRENT_OUTPUT);
-- Specification of line and page lengths
procedure SET_LINE_LENGTH (FILE : in FILE_TYPE; TO : in COUNT);
pragma IO_interface(SET_LINE_LENGTH,SET_LINE_LENGTH_FILE);
procedure SET_LINE_LENGTH (TO : in COUNT); -- default output file
pragma IO_interface(SET_LINE_LENGTH,SET_LINE_LENGTH);
procedure SET_PAGE_LENGTH (FILE : in FILE_TYPE; TO : in COUNT);
pragma IO_interface(SET_PAGE_LENGTH,SET_PAGE_LENGTH_FILE);
procedure SET_PAGE_LENGTH (TO : in COUNT); -- default output file
pragma IO_interface(SET_PAGE_LENGTH,SET_PAGE_LENGTH);
function LINE_LENGTH (FILE : in FILE_TYPE) return COUNT;
pragma IO_interface(LINE_LENGTH,LINE_LENGTH_FILE);
function LINE_LENGTH return COUNT; -- default output file
pragma IO_interface(LINE_LENGTH,LINE_LENGTH);
function PAGE_LENGTH (FILE : in FILE_TYPE) return COUNT;
pragma IO_interface(PAGE_LENGTH,PAGE_LENGTH_FILE);
function PAGE_LENGTH return COUNT; -- default output file
pragma IO_interface(PAGE_LENGTH,PAGE_LENGTH);
-- Column, Line and Page Control
procedure NEW_LINE (FILE : in FILE_TYPE; SPACING : in POSITIVE_COUNT := 1);
pragma IO_interface(NEW_LINE,NEW_LINE_FILE);
procedure NEW_LINE (SPACING : in POSITIVE_COUNT := 1);
pragma IO_interface(NEW_LINE,NEW_LINE);
procedure SKIP_LINE (FILE : in FILE_TYPE; SPACING : in POSITIVE_COUNT := 1);
pragma IO_interface(SKIP_LINE,SKIP_LINE_FILE);
procedure SKIP_LINE (SPACING : in POSITIVE_COUNT := 1);
pragma IO_interface(SKIP_LINE,SKIP_LINE);
function END_OF_LINE (FILE : in FILE_TYPE) return BOOLEAN;
pragma IO_interface(END_OF_LINE,END_OF_LINE_FILE);
function END_OF_LINE return BOOLEAN; -- default input file
pragma IO_interface(END_OF_LINE,END_OF_LINE);
procedure NEW_PAGE (FILE : in FILE_TYPE);
pragma IO_interface(NEW_PAGE,NEW_PAGE_FILE);
procedure NEW_PAGE; -- default output file
pragma IO_interface(NEW_PAGE,NEW_PAGE);
procedure SKIP_PAGE (FILE : in FILE_TYPE);
pragma IO_interface(SKIP_PAGE,SKIP_PAGE_FILE);
procedure SKIP_PAGE; -- default input file
pragma IO_interface(SKIP_PAGE,SKIP_PAGE);
function END_OF_PAGE (FILE : in FILE_TYPE) return BOOLEAN;
pragma IO_interface(END_OF_PAGE,END_OF_PAGE_FILE);
function END_OF_PAGE return BOOLEAN;
pragma IO_interface(END_OF_PAGE,END_OF_PAGE);
function END_OF_FILE (FILE : in FILE_TYPE) return BOOLEAN;
pragma IO_interface(END_OF_FILE,TIO_END_OF_FILE_FILE);
function END_OF_FILE return BOOLEAN;
pragma IO_interface(END_OF_FILE,TIO_END_OF_FILE);
procedure SET_COL(FILE : in FILE_TYPE; TO : in POSITIVE_COUNT);
pragma IO_interface(SET_COL,SET_COL_FILE);
procedure SET_COL(TO : in POSITIVE_COUNT); -- default output file
pragma IO_interface(SET_COL,SET_COL);
procedure SET_LINE(FILE : in FILE_TYPE; TO : in POSITIVE_COUNT);
pragma IO_interface(SET_LINE,SET_LINE_FILE);
procedure SET_LINE(TO : in POSITIVE_COUNT); -- default output file
pragma IO_interface(SET_LINE,SET_LINE);
function COL(FILE : in FILE_TYPE) return POSITIVE_COUNT;
pragma IO_interface(COL,COL_FILE);
function COL return POSITIVE_COUNT; -- default output file
pragma IO_interface(COL,COL);
function LINE(FILE : in FILE_TYPE) return POSITIVE_COUNT;
pragma IO_interface(LINE,LINE_FILE);
function LINE return POSITIVE_COUNT; -- default output file
pragma IO_interface(LINE,LINE);
function PAGE(FILE : in FILE_TYPE) return POSITIVE_COUNT;
pragma IO_interface(PAGE,PAGE_FILE);
function PAGE return POSITIVE_COUNT; -- default output file
pragma IO_interface(PAGE,PAGE);
-- Character Input-Output
procedure GET (FILE : in FILE_TYPE; ITEM : out CHARACTER);
pragma IO_interface(GET,GET_CHAR_FILE_ITEM);
procedure GET (ITEM : out CHARACTER);
pragma IO_interface(GET,GET_CHAR_ITEM);
procedure PUT (FILE : in FILE_TYPE; ITEM : in CHARACTER);
pragma IO_interface(PUT,PUT_CHAR_FILE_ITEM);
procedure PUT (ITEM : in CHARACTER);
pragma IO_interface(PUT,PUT_CHAR_ITEM);
-- String Input-Output
procedure GET (FILE : in FILE_TYPE; ITEM : out STRING);
pragma IO_interface(GET,GET_STRING_FILE_ITEM);
procedure GET (ITEM : out STRING);
pragma IO_interface(GET,GET_STRING_ITEM);
procedure PUT (FILE : in FILE_TYPE; ITEM : in STRING);
pragma IO_interface(PUT,PUT_STRING_FILE_ITEM);
procedure PUT (ITEM : in STRING);
pragma IO_interface(PUT,PUT_STRING_ITEM);
procedure GET_LINE (FILE : in FILE_TYPE; ITEM : out STRING;
LAST : out NATURAL);
pragma IO_interface(GET_LINE,GET_LINE_FILE);
procedure GET_LINE (ITEM : out STRING; LAST : out NATURAL);
pragma IO_interface(GET_LINE,GET_LINE);
procedure PUT_LINE (FILE : in FILE_TYPE; ITEM : in STRING);
pragma IO_interface(PUT_LINE,PUT_LINE_FILE);
procedure PUT_LINE (ITEM : in STRING);
pragma IO_interface(PUT_LINE,PUT_LINE);
-- Generic package for Input-Output of Integer Types
generic
type NUM is range <>;
package INTEGER_IO is
DEFAULT_WIDTH : FIELD := NUM'WIDTH;
DEFAULT_BASE : NUMBER_BASE := 10;
procedure GET (FILE : in FILE_TYPE; ITEM : out NUM;
WIDTH : in FIELD := 0);
pragma IO_interface(GET,GET_INTEGER_FILE_ITEM,NUM);
procedure GET (ITEM : out NUM; WIDTH : in FIELD := 0);
pragma IO_interface(GET,GET_INTEGER_ITEM,NUM);
procedure PUT (FILE : in FILE_TYPE;
ITEM : in NUM;
WIDTH : in FIELD := DEFAULT_WIDTH;
BASE : in NUMBER_BASE := DEFAULT_BASE);
pragma IO_interface(PUT,PUT_INTEGER_FILE_ITEM,NUM);
procedure PUT (ITEM : in NUM;
WIDTH : in FIELD := DEFAULT_WIDTH;
BASE : in NUMBER_BASE := DEFAULT_BASE);
pragma IO_interface(PUT,PUT_INTEGER_ITEM,NUM);
procedure GET (FROM : in STRING; ITEM: out NUM; LAST: out POSITIVE);
pragma IO_interface(GET,GET_INTEGER_STRING,NUM);
procedure PUT (TO : out STRING;
ITEM : in NUM;
BASE : in NUMBER_BASE := DEFAULT_BASE);
pragma IO_interface(PUT,PUT_INTEGER_STRING,NUM);
end INTEGER_IO;
-- Generic packages for Input-Output of Real Types
generic
type NUM is digits <>;
package FLOAT_IO is
DEFAULT_FORE : FIELD := 2;
DEFAULT_AFT : FIELD := NUM'DIGITS-1;
DEFAULT_EXP : FIELD := 3;
procedure GET (FILE : in FILE_TYPE; ITEM : out NUM;
WIDTH : in FIELD := 0);
pragma IO_interface(GET,GET_FLOAT_FILE_ITEM,NUM);
procedure GET (ITEM : out NUM; WIDTH : in FIELD := 0);
pragma IO_interface(GET,GET_FLOAT_ITEM,NUM);
procedure PUT (FILE : in FILE_TYPE;
ITEM : in NUM;
FORE : in FIELD := DEFAULT_FORE;
AFT : in FIELD := DEFAULT_AFT;
EXP : in FIELD := DEFAULT_EXP);
pragma IO_interface(PUT,PUT_FLOAT_FILE_ITEM,NUM);
procedure PUT (ITEM : in NUM;
FORE : in FIELD := DEFAULT_FORE;
AFT : in FIELD := DEFAULT_AFT;
EXP : in FIELD := DEFAULT_EXP);
pragma IO_interface(PUT,PUT_FLOAT_ITEM,NUM);
procedure GET (FROM : in STRING; ITEM: out NUM; LAST: out POSITIVE);
pragma IO_interface(GET,GET_FLOAT_STRING,NUM);
procedure PUT (TO : out STRING;
ITEM : in NUM;
AFT : in FIELD := DEFAULT_AFT;
EXP : in FIELD := DEFAULT_EXP);
pragma IO_interface(PUT,PUT_FLOAT_STRING,NUM);
end FLOAT_IO;
generic
type NUM is delta <>;
package FIXED_IO is
DEFAULT_FORE : FIELD := NUM'FORE;
DEFAULT_AFT : FIELD := NUM'AFT;
DEFAULT_EXP : FIELD := 0;
procedure GET (FILE : in FILE_TYPE; ITEM : out NUM;
WIDTH : in FIELD := 0);
pragma IO_interface(GET,GET_FIXED_FILE_ITEM,NUM);
procedure GET (ITEM : out NUM; WIDTH : in FIELD := 0);
pragma IO_interface(GET,GET_FIXED_ITEM,NUM);
procedure PUT (FILE : in FILE_TYPE;
ITEM : in NUM;
FORE : in FIELD := DEFAULT_FORE;
AFT : in FIELD := DEFAULT_AFT;
EXP : in FIELD := DEFAULT_EXP);
pragma IO_interface(PUT,PUT_FIXED_FILE_ITEM,NUM);
procedure PUT (ITEM : in NUM;
FORE : in FIELD := DEFAULT_FORE;
AFT : in FIELD := DEFAULT_AFT;
EXP : in FIELD := DEFAULT_EXP);
pragma IO_interface(PUT,PUT_FIXED_ITEM,NUM);
procedure GET (FROM : in STRING; ITEM: out NUM; LAST: out POSITIVE);
pragma IO_interface(GET,GET_FIXED_STRING,NUM);
procedure PUT (TO : out STRING;
ITEM : in NUM;
AFT : in FIELD := DEFAULT_AFT;
EXP : in FIELD := DEFAULT_EXP);
pragma IO_interface(PUT,PUT_FIXED_STRING,NUM);
end FIXED_IO;
-- Generic package for Input-Output of Enumeration Types
generic
type ENUM is (<>);
package ENUMERATION_IO is
DEFAULT_WIDTH : FIELD := 0;
DEFAULT_SETTING : TYPE_SET := UPPER_CASE;
procedure GET (FILE : in FILE_TYPE; ITEM : out ENUM);
pragma IO_interface(GET,GET_ENUM_FILE_ITEM,ENUM);
procedure GET (ITEM : out ENUM);
pragma IO_interface(GET,GET_ENUM_ITEM,ENUM);
procedure PUT (FILE : in FILE_TYPE;
ITEM : in ENUM;
WIDTH : in FIELD := DEFAULT_WIDTH;
SET : in TYPE_SET := DEFAULT_SETTING);
pragma IO_interface(PUT,PUT_ENUM_FILE_ITEM,ENUM);
procedure PUT (ITEM : in ENUM;
WIDTH : in FIELD := DEFAULT_WIDTH;
SET : in TYPE_SET := DEFAULT_SETTING);
pragma IO_interface(PUT,PUT_ENUM_ITEM,ENUM);
procedure GET(FROM : in STRING; ITEM: out ENUM; LAST: out POSITIVE);
pragma IO_interface(GET,GET_ENUM_STRING,ENUM);
procedure PUT (TO : out STRING;
ITEM : in ENUM;
SET : in TYPE_SET := DEFAULT_SETTING);
pragma IO_interface(PUT,PUT_ENUM_STRING,ENUM);
end ENUMERATION_IO;
-- Exceptions:
--
-- These are the exceptions whose names are visible to the
-- calling environment.
STATUS_ERROR : exception renames IO_EXCEPTIONS.STATUS_ERROR;
MODE_ERROR : exception renames IO_EXCEPTIONS.MODE_ERROR;
NAME_ERROR : exception renames IO_EXCEPTIONS.NAME_ERROR;
USE_ERROR : exception renames IO_EXCEPTIONS.USE_ERROR;
DEVICE_ERROR : exception renames IO_EXCEPTIONS.DEVICE_ERROR;
END_ERROR : exception renames IO_EXCEPTIONS.END_ERROR;
DATA_ERROR : exception renames IO_EXCEPTIONS.DATA_ERROR;
LAYOUT_ERROR : exception renames IO_EXCEPTIONS.LAYOUT_ERROR;
private
UNINITIALIZED: constant := 0;
type FILE_TYPE is record
FILENUM: INTEGER := UNINITIALIZED;
end record;
end TEXT_IO;
package body TEXT_IO is
package body INTEGER_IO is
end INTEGER_IO;
package body FLOAT_IO is
end FLOAT_IO;
package body FIXED_IO is
end FIXED_IO;
package body ENUMERATION_IO is
end ENUMERATION_IO;
end TEXT_IO;
pragma page;
-- Predefined library units: calendar & generic subprograms
package CALENDAR is
type TIME is private;
subtype YEAR_NUMBER is INTEGER range 1901 .. 2099;
subtype MONTH_NUMBER is INTEGER range 1 .. 12;
subtype DAY_NUMBER is INTEGER range 1 .. 31;
subtype DAY_DURATION is DURATION range 0.0 .. 86_400.0;
function CLOCK return TIME;
pragma IO_interface(CLOCK,CLOCK);
function YEAR (DATE : TIME) return YEAR_NUMBER;
pragma IO_interface(YEAR,YEAR);
function MONTH (DATE : TIME) return MONTH_NUMBER;
pragma IO_interface(MONTH,MONTH);
function DAY (DATE : TIME) return DAY_NUMBER;
pragma IO_interface(DAY,DAY);
function SECONDS(DATE : TIME) return DAY_DURATION;
pragma IO_interface(SECONDS,SECONDS);
procedure SPLIT (DATE : in TIME;
YEAR : out YEAR_NUMBER;
MONTH : out MONTH_NUMBER;
DAY : out DAY_NUMBER;
SECONDS : out DAY_DURATION);
pragma IO_interface(SPLIT,SPLIT);
function TIME_OF(YEAR : YEAR_NUMBER;
MONTH : MONTH_NUMBER;
DAY : DAY_NUMBER;
SECONDS : DAY_DURATION := 0.0) return TIME;
pragma IO_interface(TIME_OF,TIME_OF);
function "+" (LEFT : TIME; RIGHT : DURATION) return TIME;
pragma IO_interface("+",ADD_TIME_DUR);
function "+" (LEFT : DURATION; RIGHT : TIME) return TIME;
pragma IO_interface("+",ADD_DUR_TIME);
function "-" (LEFT : TIME; RIGHT : DURATION) return TIME;
pragma IO_interface("-",SUB_TIME_DUR);
function "-" (LEFT : TIME; RIGHT : TIME) return DURATION;
pragma IO_interface("-",SUB_TIME_TIME,DURATION);
function "<" (LEFT, RIGHT : TIME) return BOOLEAN;
pragma IO_interface("<",LT_TIME);
function "<=" (LEFT, RIGHT : TIME) return BOOLEAN;
pragma IO_interface("<=",LE_TIME);
function ">" (LEFT, RIGHT : TIME) return BOOLEAN;
pragma IO_interface(">",GT_TIME);
function ">=" (LEFT, RIGHT : TIME) return BOOLEAN;
pragma IO_interface(">=",GE_TIME);
TIME_ERROR : exception; -- can be raised by TIME_OF, "+", "-"
private
type TIME is record
Y_N : YEAR_NUMBER;
M_N : MONTH_NUMBER;
D_N : DAY_NUMBER;
D_D : DURATION;
end record;
end CALENDAR;
package body CALENDAR is
end CALENDAR;
pragma page;
generic
type OBJECT is limited private;
type NAME is access OBJECT;
procedure UNCHECKED_DEALLOCATION(X : in out NAME);
procedure UNCHECKED_DEALLOCATION(X : in out NAME) is
begin
X := null;
end;
generic
type SOURCE is limited private;
type TARGET is limited private;
function UNCHECKED_CONVERSION(S : SOURCE) return TARGET;
function UNCHECKED_CONVERSION(S : SOURCE) return TARGET is
NOT_USED_ANYWAY: TARGET;
begin
raise PROGRAM_ERROR;
return NOT_USED_ANYWAY;
end;
|
programs/oeis/085/A085271.asm | neoneye/loda | 22 | 95490 | ; A085271: Difference between n-th composite number and its smallest prime divisor.
; 2,4,6,6,8,10,12,12,14,16,18,18,20,22,20,24,24,26,28,30,30,32,30,34,36,36,38,40,42,42,44,46,42,48,48,50,52,50,54,54,56,58,60,60,62,60,64,66,66,68,70,72,72,74,70,76,78,78,80,82,80,84,84,86,88,84,90,90,92,90,94
seq $0,72668 ; Numbers one less than composite numbers.
sub $0,1
seq $0,46667 ; a(n) = A046666(n)/2.
mul $0,2
|
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sccz80/asin.asm | Frodevan/z88dk | 640 | 91847 |
SECTION code_fp_math32
PUBLIC asin
EXTERN _m32_asinf
defc asin = _m32_asinf
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _asin
EXTERN cm32_sdcc_asin
defc _asin = cm32_sdcc_asin
ENDIF
|
programs/oeis/172/A172076.asm | neoneye/loda | 22 | 247613 | <filename>programs/oeis/172/A172076.asm
; A172076: a(n) = n*(n+1)*(14*n-11)/6.
; 0,1,17,62,150,295,511,812,1212,1725,2365,3146,4082,5187,6475,7960,9656,11577,13737,16150,18830,21791,25047,28612,32500,36725,41301,46242,51562,57275,63395,69936,76912,84337,92225,100590,109446,118807,128687,139100,150060,161581,173677,186362,199650,213555,228091,243272,259112,275625,292825,310726,329342,348687,368775,389620,411236,433637,456837,480850,505690,531371,557907,585312,613600,642785,672881,703902,735862,768775,802655,837516,873372,910237,948125,987050,1027026,1068067,1110187,1153400,1197720,1243161,1289737,1337462,1386350,1436415,1487671,1540132,1593812,1648725,1704885,1762306,1821002,1880987,1942275,2004880,2068816,2134097,2200737,2268750
mov $2,$0
lpb $0
sub $0,1
add $3,$2
add $1,$3
add $2,11
lpe
mov $0,$1
|
Src/SacaraVm/vm_xor.asm | mrfearless/sacara | 0 | 17866 | header_VmXor
vm_xor PROC
push ebp
mov ebp, esp
; read the first operand
push [ebp+arg0]
call_vm_stack_pop_enc
push eax
; read the second operand
push [ebp+arg0]
call_vm_stack_pop_enc
mov ebx, eax
; do operation
pop eax
xor eax, ebx
; push result
push eax
push [ebp+arg0]
call_vm_stack_push_enc
mov esp, ebp
pop ebp
ret
vm_xor ENDP
header_marker |
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_1919.asm | ljhsiun2/medusa | 9 | 161896 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r8
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
lea addresses_UC_ht+0xacfc, %rax
nop
nop
nop
nop
nop
inc %rcx
mov (%rax), %r8d
nop
xor %r11, %r11
lea addresses_WC_ht+0x1e100, %rbx
and $12164, %rbp
mov (%rbx), %edi
nop
xor $38689, %rbx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r8
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r8
push %rax
push %rdx
// Load
lea addresses_RW+0x725c, %r8
nop
nop
xor %r14, %r14
vmovups (%r8), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $0, %xmm5, %rax
dec %r8
// Faulty Load
lea addresses_normal+0x485c, %rax
nop
nop
nop
nop
cmp %r11, %r11
movb (%rax), %r14b
lea oracles, %r12
and $0xff, %r14
shlq $12, %r14
mov (%r12,%r14,1), %r14
pop %rdx
pop %rax
pop %r8
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 2, 'size': 32, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': True, 'congruent': 1, 'size': 4, 'same': False, 'NT': False}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
alloy4fun_models/trashltl/models/4/XyYvtAEweRSCjCRD5.als | Kaixi26/org.alloytools.alloy | 0 | 3139 | <filename>alloy4fun_models/trashltl/models/4/XyYvtAEweRSCjCRD5.als
open main
pred idXyYvtAEweRSCjCRD5_prop5 {
some f : File | eventually f not in (File + Protected + Trash)
}
pred __repair { idXyYvtAEweRSCjCRD5_prop5 }
check __repair { idXyYvtAEweRSCjCRD5_prop5 <=> prop5o } |
HoTT/Equivalence/Empty.agda | michaelforney/hott | 0 | 5101 | <filename>HoTT/Equivalence/Empty.agda
{-# OPTIONS --without-K #-}
open import HoTT.Base
open import HoTT.Equivalence
module HoTT.Equivalence.Empty where
open variables
𝟎-equiv : {A : 𝒰 i} → ¬ A → 𝟎 {i} ≃ A
𝟎-equiv ¬a = 𝟎-rec , qinv→isequiv (𝟎-rec ∘ ¬a , 𝟎-ind , 𝟎-rec ∘ ¬a)
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/sizetype3_pkg.ads | best08618/asylo | 7 | 26174 | <reponame>best08618/asylo<gh_stars>1-10
package Sizetype3_Pkg is
type List is array (Integer range <>) of Integer;
function F return List;
end Sizetype3_Pkg;
|
programs/oeis/335/A335749.asm | neoneye/loda | 22 | 22390 | <filename>programs/oeis/335/A335749.asm
; A335749: a(n) = n!*[x^n] exp(2*x)*(y*sinh(x*y) + cosh(x*y)) and y = sqrt(6).
; 1,8,34,152,676,3008,13384,59552,264976,1179008,5245984,23341952,103859776,462123008,2056211584,9149092352,40708792576,181133355008,805951005184,3586070730752,15956184933376,70996881195008,315899894646784,1405593340977152,6254173153202176,27827879294763008,123819863485456384,550935212531351552,2451380577096318976,10907392733447979008,48532332087984553984,215944113818834173952,960841119451305803776,4275252705442891563008,19022693060674177859584,84641277653582494564352,376610496735678333976576,1675724542249878325035008,7456119162470869968093184,33175925734383236522442752,147615941262474686025957376,656815616518665217148715008,2922494348599610240646774784,13003608627435771396884529152,57859423206942306068831666176,257444910082640767069095723008,1145498486744447680414046224384,5096883767143072255794376343552,22678532042061184384005597822976,100907895702530882047611143979008,448988646894245896958455771561984,1997770378982045351929045374205952,8889058809716673201633093039947776,39551775996830783510390462908203008,175985221606756480444828037712707584,783044438420687488800093076667236352
add $0,1
seq $0,189741 ; a(1)=4, a(2)=2, a(n) = 4*a(n-1) + 2*a(n-2).
div $0,2
|
programs/oeis/053/A053156.asm | neoneye/loda | 22 | 80415 | <reponame>neoneye/loda<gh_stars>10-100
; A053156: Number of 2-element intersecting families (with not necessary distinct sets) whose union is an n-element set.
; 1,3,10,33,106,333,1030,3153,9586,29013,87550,263673,793066,2383293,7158070,21490593,64504546,193579173,580868590,1742867913,5229128026,15688432653,47067395110,141206379633,423627527506,1270899359733,3812731633630,11438262009753,34314920246986,102945029176413,308835624400150,926507946942273,2779525988310466,8338582259898693,25015755369630670,75047283288761193,225141884226021946,675425721397542573,2026277301631581190,6078832179772650513,18236497089073765426,54709492366732924053,164128479299222027710,492385442295712594233,1477156335683230804906,4431469024641878459133,13294407109110007466230,39883221397698766576353,119649664333833788084386,358948993282976340963813,1076846980411878976312750,3230540942361536835780873,9691622829336410321027866,29074868492512830590454093,87224605486545691026103270,261673816477651471587791793,785021449468983211782339346,2355064348479007229384945973,7065193045581136876230693790,21195579137031641004843793113,63586737411671383766834802826,190760212236167072805111255453,572280636710807061424547460310,1716841910137032870292069768833,5150525730420321982913064082306,15451577191279412692812901798533,46354731573875131566586124498830,139064194721699181676053211702953,417192584165245118980749311521786,1251577752496030504847427287391213,3754733257488681810352640567825350,11264199772467226022678639114779473,33792599317404039251277352166945266,101377797952216840120314926146049493,304133393856659965093910517728575870,912400181569998784747663031766582393
add $0,1
mov $1,3
pow $1,$0
mov $2,2
pow $2,$0
sub $1,$2
div $1,2
add $1,1
mov $0,$1
|
.config/alfred/Alfred.alfredpreferences/workflows/user.workflow.D27B6AD4-C1F8-4105-8C0B-0E52489E70FE/app_Mail.applescript | kuanger/dotfiles | 1 | 2039 | on getTitle()
tell application id "com.apple.mail"
using terms from application "Mail"
set selectedMails to selection
--sort newest messages to the top
repeat with i from 1 to (count of selectedMails) - 1
repeat with j from i + 1 to count of selectedMails
set iMessage to item i of selectedMails
set jMessage to item j of selectedMails
if date received of jMessage is greater than date received of iMessage then
set temp to item i of selectedMails
set item i of selectedMails to item j of selectedMails
set item j of selectedMails to temp
end if
end repeat
end repeat
set theMessage to first item of selectedMails
return the subject of theMessage & " (From " & the sender of theMessage & ")"
end using terms from
end tell
end getTitle
on getBody()
tell application id "com.apple.mail"
using terms from application "Mail"
set selectedMails to selection
--sort newest messages to the top
repeat with i from 1 to (count of selectedMails) - 1
repeat with j from i + 1 to count of selectedMails
set iMessage to item i of selectedMails
set jMessage to item j of selectedMails
if date received of jMessage is greater than date received of iMessage then
set temp to item i of selectedMails
set item i of selectedMails to item j of selectedMails
set item j of selectedMails to temp
end if
end repeat
end repeat
set theMessage to first item of selectedMails
return "message://<" & message id of theMessage & ">"
end using terms from
end tell
end getBody |
Transynther/x86/_processed/AVXALIGN/_zr_/i3-7100_9_0x84_notsx.log_21829_1670.asm | ljhsiun2/medusa | 9 | 240420 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1c139, %rdi
nop
nop
nop
xor %r8, %r8
movb (%rdi), %bl
nop
nop
sub $30308, %rdi
lea addresses_UC_ht+0x13439, %rsi
sub $27526, %rbp
movups (%rsi), %xmm3
vpextrq $1, %xmm3, %r13
nop
nop
nop
nop
nop
add $24095, %rsi
lea addresses_WT_ht+0x1d507, %rsi
lea addresses_WC_ht+0x15539, %rdi
nop
nop
cmp $15683, %rbx
mov $91, %rcx
rep movsq
nop
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_D_ht+0x3a39, %r13
nop
and $34607, %rcx
movl $0x61626364, (%r13)
nop
nop
nop
nop
nop
cmp %r13, %r13
lea addresses_A_ht+0xf939, %rbp
nop
nop
cmp %rbx, %rbx
and $0xffffffffffffffc0, %rbp
movaps (%rbp), %xmm1
vpextrq $0, %xmm1, %rcx
nop
nop
nop
nop
and $61366, %rbp
lea addresses_normal_ht+0x1a139, %r13
nop
nop
nop
nop
and %rbx, %rbx
mov (%r13), %r8d
nop
nop
add %rdi, %rdi
lea addresses_A_ht+0x121f9, %rsi
nop
nop
nop
nop
xor %rdi, %rdi
mov (%rsi), %ebx
nop
nop
nop
and $15883, %rbp
lea addresses_normal_ht+0x1234f, %r8
clflush (%r8)
nop
nop
xor $44732, %rbx
movw $0x6162, (%r8)
nop
nop
nop
nop
xor %rbx, %rbx
lea addresses_D_ht+0xa539, %rsi
lea addresses_WT_ht+0x186a7, %rdi
sub %r10, %r10
mov $21, %rcx
rep movsb
nop
nop
cmp %rbx, %rbx
lea addresses_normal_ht+0x19539, %rdi
nop
nop
cmp $58095, %r10
movw $0x6162, (%rdi)
nop
nop
xor $58931, %rdi
lea addresses_normal_ht+0x2da9, %r13
and %rsi, %rsi
movups (%r13), %xmm1
vpextrq $1, %xmm1, %rbx
nop
nop
nop
nop
nop
xor $19261, %r10
lea addresses_WC_ht+0x1c039, %r10
add $63097, %rbx
movw $0x6162, (%r10)
nop
and %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
// REPMOV
mov $0xaa5, %rsi
mov $0xb39, %rdi
clflush (%rsi)
nop
sub $45985, %r8
mov $4, %rcx
rep movsw
xor %rdi, %rdi
// Load
lea addresses_UC+0x9339, %r12
nop
nop
cmp $34698, %rbp
mov (%r12), %edi
sub $50604, %rcx
// Faulty Load
lea addresses_US+0x6539, %rdi
nop
nop
nop
nop
nop
xor %r8, %r8
mov (%rdi), %r12w
lea oracles, %r11
and $0xff, %r12
shlq $12, %r12
mov (%r11,%r12,1), %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_US', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_P', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_P', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC', 'same': False, 'size': 4, 'congruent': 9, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_US', 'same': True, 'size': 2, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 8, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': True, 'size': 4, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 5, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 1, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Python3/decafAlejandroV2.g4 | tej17584/compis_proyecto3 | 0 | 2531 | grammar decafAlejandroV2;
/*
* Lexer Rules
*/
// Keyword specification
CLASS: 'class';
PROGRAM: 'Program';
IF: 'if';
ELSE: 'else';
FOR: 'for';
WHILE: 'while';
RETURN: 'return';
BREAK: 'break';
CONTINUE: 'continue';
BOOLEAN: 'boolean';
CHAR: 'char';
INT: 'int';
TRUE: 'True';
FALSE: 'False';
VOID: 'void';
STRUCT: 'struct';
CALLOUT: 'callout';
// Symbol Specification
SEMICOLON: ';';
LCURLY: '{';
RCURLY: '}';
LSQUARE: '[';
RSQUARE: ']';
LROUND: '(';
RROUND: ')';
COMMA: ',';
QUOTES: '"';
APOSTROPHE: '\'';
ADD: '+';
SUB: '-';
MULTIPLY: '*';
DIVIDE: '/';
REMINDER: '%';
AND: '&&';
OR: '||';
NOT: '!';
GREATER_OP: '>';
LESS_OP: '<';
GREATER_eq_op: '>=';
LESS_eq_op: '<=';
EQUAL_OP: '=';
ADD_eq_op: '+=';
SUB_eq_op: '-=';
EQUALITY_OP: '==';
UNEQUALITY_OP: '!=';
POINT: '.';
// Variable names & literal specification
ID: ALPHA ALPHA_NUM*; // for variable name
ALPHA: [a-zA-Z_];
DECIMAL_LITERAL: [0-9]+;
DIGIT: [0-9];
//BOOL_LITERAL : 'True' | 'False';
STRING_LITERAL: ('"' ( ALPHA_NUM)* '"')
| (APOSTROPHE ( ALPHA_NUM) APOSTROPHE);
ALPHA_NUM: ALPHA | DIGIT;
HEX_DIGIT: '0' [xX]([0-9] | [a-fA-F]);
LINE_COMMENT:
'//' .*? '\n' -> skip; // skip single line comments starting from // and ending with new line
COMMENT: '/*' .*? '*/' -> skip; // skip mutliple comments
//SPACE : ' ' -> skip; // ignore spaces
NEWLINE: ('\r'? '\n' | '\r')+ -> skip;
/*
* Parser Rules
*/
program: CLASS PROGRAM LCURLY (declaration)* RCURLY;
declaration:
struct_declr
| vardeclr
| method_declr
| field_declr;
vardeclr: var_type field_var SEMICOLON;
field_declr: var_type field_var (COMMA field_var)* SEMICOLON;
array_id:
ID LSQUARE (int_literal | var_id) RSQUARE (POINT location)?;
field_var: var_id | array_id;
var_id: ID (POINT location)?;
struct_declr: STRUCT ID LCURLY (vardeclr)* RCURLY SEMICOLON;
method_declr:
return_type method_name LROUND (
((var_type var_id) | VOID) (COMMA var_type var_id)*
)? RROUND block;
return_type: (var_type | VOID);
block: LCURLY (vardeclr)* statement* RCURLY;
statement:
location assign_op expr SEMICOLON? # statement_assign
| method_call # statement_methodcall
| IF LROUND expr RROUND block (ELSE block)? # statement_if
| WHILE LROUND expr RROUND block # statement_while
| RETURN expr SEMICOLON # statement_return
| FOR var_id (EQUAL_OP int_literal)? COMMA (
(var_id (EQUAL_OP int_literal)?)
| int_literal
) block # statement_for
| BREAK SEMICOLON # statement_break;
method_call:
method_name LROUND (expr (COMMA expr)*)? RROUND (SEMICOLON)?;
expr:
literal # expr_literal
| location # expr_location
| method_call # expr_methodCall
| expr ('*' | '/' | '%') expr # expr_PrecedenciaMax
| expr ('+' | '-') expr # expr_PrecedenciaMenor
| expr (arith_op | rel_op | eq_op | cond_op) expr # expr_normal
| SUB expr # expr_menos
| NOT expr # expr_negacion
| LROUND expr RROUND # expr_parentesis;
location: var_id | array_id;
int_literal: DECIMAL_LITERAL;
string_literal: STRING_LITERAL;
bool_literal: 'True' | 'False';
rel_op: GREATER_OP | LESS_OP | LESS_eq_op | GREATER_eq_op;
eq_op: EQUALITY_OP | UNEQUALITY_OP;
cond_op: AND | OR;
literal: int_literal | string_literal | bool_literal;
arith_op: ADD | SUB | MULTIPLY | DIVIDE | REMINDER;
var_type: INT | CHAR | BOOLEAN | STRUCT ID | struct_declr;
assign_op: EQUAL_OP | ADD_eq_op | SUB_eq_op;
method_name: ID;
// recognize the whitespace at the end to prevent string concatenation due to elemination of all sapces
WHITESPACE: [ \t\r\n] -> skip; |
ls.asm | youngPieros/OS_Lab4 | 0 | 20149 | <filename>ls.asm
_ls: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
close(fd);
}
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 56 push %esi
e: 53 push %ebx
f: 51 push %ecx
10: 83 ec 0c sub $0xc,%esp
13: 8b 01 mov (%ecx),%eax
15: 8b 51 04 mov 0x4(%ecx),%edx
int i;
if(argc < 2){
18: 83 f8 01 cmp $0x1,%eax
1b: 7e 24 jle 41 <main+0x41>
1d: 8d 5a 04 lea 0x4(%edx),%ebx
20: 8d 34 82 lea (%edx,%eax,4),%esi
23: 90 nop
24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
ls(".");
exit();
}
for(i=1; i<argc; i++)
ls(argv[i]);
28: 83 ec 0c sub $0xc,%esp
2b: ff 33 pushl (%ebx)
2d: 83 c3 04 add $0x4,%ebx
30: e8 cb 00 00 00 call 100 <ls>
for(i=1; i<argc; i++)
35: 83 c4 10 add $0x10,%esp
38: 39 f3 cmp %esi,%ebx
3a: 75 ec jne 28 <main+0x28>
exit();
3c: e8 41 05 00 00 call 582 <exit>
ls(".");
41: 83 ec 0c sub $0xc,%esp
44: 68 80 0a 00 00 push $0xa80
49: e8 b2 00 00 00 call 100 <ls>
exit();
4e: e8 2f 05 00 00 call 582 <exit>
53: 66 90 xchg %ax,%ax
55: 66 90 xchg %ax,%ax
57: 66 90 xchg %ax,%ax
59: 66 90 xchg %ax,%ax
5b: 66 90 xchg %ax,%ax
5d: 66 90 xchg %ax,%ax
5f: 90 nop
00000060 <fmtname>:
{
60: 55 push %ebp
61: 89 e5 mov %esp,%ebp
63: 56 push %esi
64: 53 push %ebx
65: 8b 5d 08 mov 0x8(%ebp),%ebx
for(p=path+strlen(path); p >= path && *p != '/'; p--)
68: 83 ec 0c sub $0xc,%esp
6b: 53 push %ebx
6c: e8 3f 03 00 00 call 3b0 <strlen>
71: 83 c4 10 add $0x10,%esp
74: 01 d8 add %ebx,%eax
76: 73 0f jae 87 <fmtname+0x27>
78: eb 12 jmp 8c <fmtname+0x2c>
7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80: 83 e8 01 sub $0x1,%eax
83: 39 c3 cmp %eax,%ebx
85: 77 05 ja 8c <fmtname+0x2c>
87: 80 38 2f cmpb $0x2f,(%eax)
8a: 75 f4 jne 80 <fmtname+0x20>
p++;
8c: 8d 58 01 lea 0x1(%eax),%ebx
if(strlen(p) >= DIRSIZ)
8f: 83 ec 0c sub $0xc,%esp
92: 53 push %ebx
93: e8 18 03 00 00 call 3b0 <strlen>
98: 83 c4 10 add $0x10,%esp
9b: 83 f8 0d cmp $0xd,%eax
9e: 77 4a ja ea <fmtname+0x8a>
memmove(buf, p, strlen(p));
a0: 83 ec 0c sub $0xc,%esp
a3: 53 push %ebx
a4: e8 07 03 00 00 call 3b0 <strlen>
a9: 83 c4 0c add $0xc,%esp
ac: 50 push %eax
ad: 53 push %ebx
ae: 68 ac 0d 00 00 push $0xdac
b3: e8 98 04 00 00 call 550 <memmove>
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
b8: 89 1c 24 mov %ebx,(%esp)
bb: e8 f0 02 00 00 call 3b0 <strlen>
c0: 89 1c 24 mov %ebx,(%esp)
c3: 89 c6 mov %eax,%esi
return buf;
c5: bb ac 0d 00 00 mov $0xdac,%ebx
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
ca: e8 e1 02 00 00 call 3b0 <strlen>
cf: ba 0e 00 00 00 mov $0xe,%edx
d4: 83 c4 0c add $0xc,%esp
d7: 05 ac 0d 00 00 add $0xdac,%eax
dc: 29 f2 sub %esi,%edx
de: 52 push %edx
df: 6a 20 push $0x20
e1: 50 push %eax
e2: e8 f9 02 00 00 call 3e0 <memset>
return buf;
e7: 83 c4 10 add $0x10,%esp
}
ea: 8d 65 f8 lea -0x8(%ebp),%esp
ed: 89 d8 mov %ebx,%eax
ef: 5b pop %ebx
f0: 5e pop %esi
f1: 5d pop %ebp
f2: c3 ret
f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000100 <ls>:
{
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 57 push %edi
104: 56 push %esi
105: 53 push %ebx
106: 81 ec 64 02 00 00 sub $0x264,%esp
10c: 8b 7d 08 mov 0x8(%ebp),%edi
if((fd = open(path, 0)) < 0){
10f: 6a 00 push $0x0
111: 57 push %edi
112: e8 ab 04 00 00 call 5c2 <open>
117: 83 c4 10 add $0x10,%esp
11a: 85 c0 test %eax,%eax
11c: 78 52 js 170 <ls+0x70>
if(fstat(fd, &st) < 0){
11e: 8d b5 d4 fd ff ff lea -0x22c(%ebp),%esi
124: 83 ec 08 sub $0x8,%esp
127: 89 c3 mov %eax,%ebx
129: 56 push %esi
12a: 50 push %eax
12b: e8 aa 04 00 00 call 5da <fstat>
130: 83 c4 10 add $0x10,%esp
133: 85 c0 test %eax,%eax
135: 0f 88 c5 00 00 00 js 200 <ls+0x100>
switch(st.type){
13b: 0f b7 85 d4 fd ff ff movzwl -0x22c(%ebp),%eax
142: 66 83 f8 01 cmp $0x1,%ax
146: 0f 84 84 00 00 00 je 1d0 <ls+0xd0>
14c: 66 83 f8 02 cmp $0x2,%ax
150: 74 3e je 190 <ls+0x90>
close(fd);
152: 83 ec 0c sub $0xc,%esp
155: 53 push %ebx
156: e8 4f 04 00 00 call 5aa <close>
15b: 83 c4 10 add $0x10,%esp
}
15e: 8d 65 f4 lea -0xc(%ebp),%esp
161: 5b pop %ebx
162: 5e pop %esi
163: 5f pop %edi
164: 5d pop %ebp
165: c3 ret
166: 8d 76 00 lea 0x0(%esi),%esi
169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
printf(2, "ls: cannot open %s\n", path);
170: 83 ec 04 sub $0x4,%esp
173: 57 push %edi
174: 68 38 0a 00 00 push $0xa38
179: 6a 02 push $0x2
17b: e8 60 05 00 00 call 6e0 <printf>
return;
180: 83 c4 10 add $0x10,%esp
}
183: 8d 65 f4 lea -0xc(%ebp),%esp
186: 5b pop %ebx
187: 5e pop %esi
188: 5f pop %edi
189: 5d pop %ebp
18a: c3 ret
18b: 90 nop
18c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
190: 83 ec 0c sub $0xc,%esp
193: 8b 95 e4 fd ff ff mov -0x21c(%ebp),%edx
199: 8b b5 dc fd ff ff mov -0x224(%ebp),%esi
19f: 57 push %edi
1a0: 89 95 b4 fd ff ff mov %edx,-0x24c(%ebp)
1a6: e8 b5 fe ff ff call 60 <fmtname>
1ab: 8b 95 b4 fd ff ff mov -0x24c(%ebp),%edx
1b1: 59 pop %ecx
1b2: 5f pop %edi
1b3: 52 push %edx
1b4: 56 push %esi
1b5: 6a 02 push $0x2
1b7: 50 push %eax
1b8: 68 60 0a 00 00 push $0xa60
1bd: 6a 01 push $0x1
1bf: e8 1c 05 00 00 call 6e0 <printf>
break;
1c4: 83 c4 20 add $0x20,%esp
1c7: eb 89 jmp 152 <ls+0x52>
1c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
1d0: 83 ec 0c sub $0xc,%esp
1d3: 57 push %edi
1d4: e8 d7 01 00 00 call 3b0 <strlen>
1d9: 83 c0 10 add $0x10,%eax
1dc: 83 c4 10 add $0x10,%esp
1df: 3d 00 02 00 00 cmp $0x200,%eax
1e4: 76 42 jbe 228 <ls+0x128>
printf(1, "ls: path too long\n");
1e6: 83 ec 08 sub $0x8,%esp
1e9: 68 6d 0a 00 00 push $0xa6d
1ee: 6a 01 push $0x1
1f0: e8 eb 04 00 00 call 6e0 <printf>
break;
1f5: 83 c4 10 add $0x10,%esp
1f8: e9 55 ff ff ff jmp 152 <ls+0x52>
1fd: 8d 76 00 lea 0x0(%esi),%esi
printf(2, "ls: cannot stat %s\n", path);
200: 83 ec 04 sub $0x4,%esp
203: 57 push %edi
204: 68 4c 0a 00 00 push $0xa4c
209: 6a 02 push $0x2
20b: e8 d0 04 00 00 call 6e0 <printf>
close(fd);
210: 89 1c 24 mov %ebx,(%esp)
213: e8 92 03 00 00 call 5aa <close>
return;
218: 83 c4 10 add $0x10,%esp
}
21b: 8d 65 f4 lea -0xc(%ebp),%esp
21e: 5b pop %ebx
21f: 5e pop %esi
220: 5f pop %edi
221: 5d pop %ebp
222: c3 ret
223: 90 nop
224: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
strcpy(buf, path);
228: 83 ec 08 sub $0x8,%esp
22b: 57 push %edi
22c: 8d bd e8 fd ff ff lea -0x218(%ebp),%edi
232: 57 push %edi
233: e8 f8 00 00 00 call 330 <strcpy>
p = buf+strlen(buf);
238: 89 3c 24 mov %edi,(%esp)
23b: e8 70 01 00 00 call 3b0 <strlen>
240: 01 f8 add %edi,%eax
while(read(fd, &de, sizeof(de)) == sizeof(de)){
242: 83 c4 10 add $0x10,%esp
*p++ = '/';
245: 8d 48 01 lea 0x1(%eax),%ecx
p = buf+strlen(buf);
248: 89 85 a8 fd ff ff mov %eax,-0x258(%ebp)
*p++ = '/';
24e: c6 00 2f movb $0x2f,(%eax)
251: 89 8d a4 fd ff ff mov %ecx,-0x25c(%ebp)
257: 89 f6 mov %esi,%esi
259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
while(read(fd, &de, sizeof(de)) == sizeof(de)){
260: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax
266: 83 ec 04 sub $0x4,%esp
269: 6a 10 push $0x10
26b: 50 push %eax
26c: 53 push %ebx
26d: e8 28 03 00 00 call 59a <read>
272: 83 c4 10 add $0x10,%esp
275: 83 f8 10 cmp $0x10,%eax
278: 0f 85 d4 fe ff ff jne 152 <ls+0x52>
if(de.inum == 0)
27e: 66 83 bd c4 fd ff ff cmpw $0x0,-0x23c(%ebp)
285: 00
286: 74 d8 je 260 <ls+0x160>
memmove(p, de.name, DIRSIZ);
288: 8d 85 c6 fd ff ff lea -0x23a(%ebp),%eax
28e: 83 ec 04 sub $0x4,%esp
291: 6a 0e push $0xe
293: 50 push %eax
294: ff b5 a4 fd ff ff pushl -0x25c(%ebp)
29a: e8 b1 02 00 00 call 550 <memmove>
p[DIRSIZ] = 0;
29f: 8b 85 a8 fd ff ff mov -0x258(%ebp),%eax
2a5: c6 40 0f 00 movb $0x0,0xf(%eax)
if(stat(buf, &st) < 0){
2a9: 58 pop %eax
2aa: 5a pop %edx
2ab: 56 push %esi
2ac: 57 push %edi
2ad: e8 0e 02 00 00 call 4c0 <stat>
2b2: 83 c4 10 add $0x10,%esp
2b5: 85 c0 test %eax,%eax
2b7: 78 5f js 318 <ls+0x218>
printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
2b9: 0f bf 85 d4 fd ff ff movswl -0x22c(%ebp),%eax
2c0: 83 ec 0c sub $0xc,%esp
2c3: 8b 8d e4 fd ff ff mov -0x21c(%ebp),%ecx
2c9: 8b 95 dc fd ff ff mov -0x224(%ebp),%edx
2cf: 57 push %edi
2d0: 89 8d ac fd ff ff mov %ecx,-0x254(%ebp)
2d6: 89 95 b0 fd ff ff mov %edx,-0x250(%ebp)
2dc: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp)
2e2: e8 79 fd ff ff call 60 <fmtname>
2e7: 5a pop %edx
2e8: 8b 95 b0 fd ff ff mov -0x250(%ebp),%edx
2ee: 59 pop %ecx
2ef: 8b 8d ac fd ff ff mov -0x254(%ebp),%ecx
2f5: 51 push %ecx
2f6: 52 push %edx
2f7: ff b5 b4 fd ff ff pushl -0x24c(%ebp)
2fd: 50 push %eax
2fe: 68 60 0a 00 00 push $0xa60
303: 6a 01 push $0x1
305: e8 d6 03 00 00 call 6e0 <printf>
30a: 83 c4 20 add $0x20,%esp
30d: e9 4e ff ff ff jmp 260 <ls+0x160>
312: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "ls: cannot stat %s\n", buf);
318: 83 ec 04 sub $0x4,%esp
31b: 57 push %edi
31c: 68 4c 0a 00 00 push $0xa4c
321: 6a 01 push $0x1
323: e8 b8 03 00 00 call 6e0 <printf>
continue;
328: 83 c4 10 add $0x10,%esp
32b: e9 30 ff ff ff jmp 260 <ls+0x160>
00000330 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
330: 55 push %ebp
331: 89 e5 mov %esp,%ebp
333: 53 push %ebx
334: 8b 45 08 mov 0x8(%ebp),%eax
337: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
33a: 89 c2 mov %eax,%edx
33c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
340: 83 c1 01 add $0x1,%ecx
343: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
347: 83 c2 01 add $0x1,%edx
34a: 84 db test %bl,%bl
34c: 88 5a ff mov %bl,-0x1(%edx)
34f: 75 ef jne 340 <strcpy+0x10>
;
return os;
}
351: 5b pop %ebx
352: 5d pop %ebp
353: c3 ret
354: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
35a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000360 <strcmp>:
int
strcmp(const char *p, const char *q)
{
360: 55 push %ebp
361: 89 e5 mov %esp,%ebp
363: 53 push %ebx
364: 8b 55 08 mov 0x8(%ebp),%edx
367: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
36a: 0f b6 02 movzbl (%edx),%eax
36d: 0f b6 19 movzbl (%ecx),%ebx
370: 84 c0 test %al,%al
372: 75 1c jne 390 <strcmp+0x30>
374: eb 2a jmp 3a0 <strcmp+0x40>
376: 8d 76 00 lea 0x0(%esi),%esi
379: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
380: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
383: 0f b6 02 movzbl (%edx),%eax
p++, q++;
386: 83 c1 01 add $0x1,%ecx
389: 0f b6 19 movzbl (%ecx),%ebx
while(*p && *p == *q)
38c: 84 c0 test %al,%al
38e: 74 10 je 3a0 <strcmp+0x40>
390: 38 d8 cmp %bl,%al
392: 74 ec je 380 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
394: 29 d8 sub %ebx,%eax
}
396: 5b pop %ebx
397: 5d pop %ebp
398: c3 ret
399: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3a0: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
3a2: 29 d8 sub %ebx,%eax
}
3a4: 5b pop %ebx
3a5: 5d pop %ebp
3a6: c3 ret
3a7: 89 f6 mov %esi,%esi
3a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000003b0 <strlen>:
uint
strlen(const char *s)
{
3b0: 55 push %ebp
3b1: 89 e5 mov %esp,%ebp
3b3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
3b6: 80 39 00 cmpb $0x0,(%ecx)
3b9: 74 15 je 3d0 <strlen+0x20>
3bb: 31 d2 xor %edx,%edx
3bd: 8d 76 00 lea 0x0(%esi),%esi
3c0: 83 c2 01 add $0x1,%edx
3c3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
3c7: 89 d0 mov %edx,%eax
3c9: 75 f5 jne 3c0 <strlen+0x10>
;
return n;
}
3cb: 5d pop %ebp
3cc: c3 ret
3cd: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
3d0: 31 c0 xor %eax,%eax
}
3d2: 5d pop %ebp
3d3: c3 ret
3d4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
3da: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000003e0 <memset>:
void*
memset(void *dst, int c, uint n)
{
3e0: 55 push %ebp
3e1: 89 e5 mov %esp,%ebp
3e3: 57 push %edi
3e4: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
3e7: 8b 4d 10 mov 0x10(%ebp),%ecx
3ea: 8b 45 0c mov 0xc(%ebp),%eax
3ed: 89 d7 mov %edx,%edi
3ef: fc cld
3f0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
3f2: 89 d0 mov %edx,%eax
3f4: 5f pop %edi
3f5: 5d pop %ebp
3f6: c3 ret
3f7: 89 f6 mov %esi,%esi
3f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000400 <strchr>:
char*
strchr(const char *s, char c)
{
400: 55 push %ebp
401: 89 e5 mov %esp,%ebp
403: 53 push %ebx
404: 8b 45 08 mov 0x8(%ebp),%eax
407: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
40a: 0f b6 10 movzbl (%eax),%edx
40d: 84 d2 test %dl,%dl
40f: 74 1d je 42e <strchr+0x2e>
if(*s == c)
411: 38 d3 cmp %dl,%bl
413: 89 d9 mov %ebx,%ecx
415: 75 0d jne 424 <strchr+0x24>
417: eb 17 jmp 430 <strchr+0x30>
419: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
420: 38 ca cmp %cl,%dl
422: 74 0c je 430 <strchr+0x30>
for(; *s; s++)
424: 83 c0 01 add $0x1,%eax
427: 0f b6 10 movzbl (%eax),%edx
42a: 84 d2 test %dl,%dl
42c: 75 f2 jne 420 <strchr+0x20>
return (char*)s;
return 0;
42e: 31 c0 xor %eax,%eax
}
430: 5b pop %ebx
431: 5d pop %ebp
432: c3 ret
433: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
439: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000440 <gets>:
char*
gets(char *buf, int max)
{
440: 55 push %ebp
441: 89 e5 mov %esp,%ebp
443: 57 push %edi
444: 56 push %esi
445: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
446: 31 f6 xor %esi,%esi
448: 89 f3 mov %esi,%ebx
{
44a: 83 ec 1c sub $0x1c,%esp
44d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
450: eb 2f jmp 481 <gets+0x41>
452: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
458: 8d 45 e7 lea -0x19(%ebp),%eax
45b: 83 ec 04 sub $0x4,%esp
45e: 6a 01 push $0x1
460: 50 push %eax
461: 6a 00 push $0x0
463: e8 32 01 00 00 call 59a <read>
if(cc < 1)
468: 83 c4 10 add $0x10,%esp
46b: 85 c0 test %eax,%eax
46d: 7e 1c jle 48b <gets+0x4b>
break;
buf[i++] = c;
46f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
473: 83 c7 01 add $0x1,%edi
476: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
479: 3c 0a cmp $0xa,%al
47b: 74 23 je 4a0 <gets+0x60>
47d: 3c 0d cmp $0xd,%al
47f: 74 1f je 4a0 <gets+0x60>
for(i=0; i+1 < max; ){
481: 83 c3 01 add $0x1,%ebx
484: 3b 5d 0c cmp 0xc(%ebp),%ebx
487: 89 fe mov %edi,%esi
489: 7c cd jl 458 <gets+0x18>
48b: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
48d: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
490: c6 03 00 movb $0x0,(%ebx)
}
493: 8d 65 f4 lea -0xc(%ebp),%esp
496: 5b pop %ebx
497: 5e pop %esi
498: 5f pop %edi
499: 5d pop %ebp
49a: c3 ret
49b: 90 nop
49c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
4a0: 8b 75 08 mov 0x8(%ebp),%esi
4a3: 8b 45 08 mov 0x8(%ebp),%eax
4a6: 01 de add %ebx,%esi
4a8: 89 f3 mov %esi,%ebx
buf[i] = '\0';
4aa: c6 03 00 movb $0x0,(%ebx)
}
4ad: 8d 65 f4 lea -0xc(%ebp),%esp
4b0: 5b pop %ebx
4b1: 5e pop %esi
4b2: 5f pop %edi
4b3: 5d pop %ebp
4b4: c3 ret
4b5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
4b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000004c0 <stat>:
int
stat(const char *n, struct stat *st)
{
4c0: 55 push %ebp
4c1: 89 e5 mov %esp,%ebp
4c3: 56 push %esi
4c4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
4c5: 83 ec 08 sub $0x8,%esp
4c8: 6a 00 push $0x0
4ca: ff 75 08 pushl 0x8(%ebp)
4cd: e8 f0 00 00 00 call 5c2 <open>
if(fd < 0)
4d2: 83 c4 10 add $0x10,%esp
4d5: 85 c0 test %eax,%eax
4d7: 78 27 js 500 <stat+0x40>
return -1;
r = fstat(fd, st);
4d9: 83 ec 08 sub $0x8,%esp
4dc: ff 75 0c pushl 0xc(%ebp)
4df: 89 c3 mov %eax,%ebx
4e1: 50 push %eax
4e2: e8 f3 00 00 00 call 5da <fstat>
close(fd);
4e7: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
4ea: 89 c6 mov %eax,%esi
close(fd);
4ec: e8 b9 00 00 00 call 5aa <close>
return r;
4f1: 83 c4 10 add $0x10,%esp
}
4f4: 8d 65 f8 lea -0x8(%ebp),%esp
4f7: 89 f0 mov %esi,%eax
4f9: 5b pop %ebx
4fa: 5e pop %esi
4fb: 5d pop %ebp
4fc: c3 ret
4fd: 8d 76 00 lea 0x0(%esi),%esi
return -1;
500: be ff ff ff ff mov $0xffffffff,%esi
505: eb ed jmp 4f4 <stat+0x34>
507: 89 f6 mov %esi,%esi
509: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000510 <atoi>:
int
atoi(const char *s)
{
510: 55 push %ebp
511: 89 e5 mov %esp,%ebp
513: 53 push %ebx
514: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
517: 0f be 11 movsbl (%ecx),%edx
51a: 8d 42 d0 lea -0x30(%edx),%eax
51d: 3c 09 cmp $0x9,%al
n = 0;
51f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
524: 77 1f ja 545 <atoi+0x35>
526: 8d 76 00 lea 0x0(%esi),%esi
529: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
530: 8d 04 80 lea (%eax,%eax,4),%eax
533: 83 c1 01 add $0x1,%ecx
536: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
53a: 0f be 11 movsbl (%ecx),%edx
53d: 8d 5a d0 lea -0x30(%edx),%ebx
540: 80 fb 09 cmp $0x9,%bl
543: 76 eb jbe 530 <atoi+0x20>
return n;
}
545: 5b pop %ebx
546: 5d pop %ebp
547: c3 ret
548: 90 nop
549: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000550 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
550: 55 push %ebp
551: 89 e5 mov %esp,%ebp
553: 56 push %esi
554: 53 push %ebx
555: 8b 5d 10 mov 0x10(%ebp),%ebx
558: 8b 45 08 mov 0x8(%ebp),%eax
55b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
55e: 85 db test %ebx,%ebx
560: 7e 14 jle 576 <memmove+0x26>
562: 31 d2 xor %edx,%edx
564: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
568: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
56c: 88 0c 10 mov %cl,(%eax,%edx,1)
56f: 83 c2 01 add $0x1,%edx
while(n-- > 0)
572: 39 d3 cmp %edx,%ebx
574: 75 f2 jne 568 <memmove+0x18>
return vdst;
}
576: 5b pop %ebx
577: 5e pop %esi
578: 5d pop %ebp
579: c3 ret
0000057a <fork>:
57a: b8 01 00 00 00 mov $0x1,%eax
57f: cd 40 int $0x40
581: c3 ret
00000582 <exit>:
582: b8 02 00 00 00 mov $0x2,%eax
587: cd 40 int $0x40
589: c3 ret
0000058a <wait>:
58a: b8 03 00 00 00 mov $0x3,%eax
58f: cd 40 int $0x40
591: c3 ret
00000592 <pipe>:
592: b8 04 00 00 00 mov $0x4,%eax
597: cd 40 int $0x40
599: c3 ret
0000059a <read>:
59a: b8 05 00 00 00 mov $0x5,%eax
59f: cd 40 int $0x40
5a1: c3 ret
000005a2 <write>:
5a2: b8 10 00 00 00 mov $0x10,%eax
5a7: cd 40 int $0x40
5a9: c3 ret
000005aa <close>:
5aa: b8 15 00 00 00 mov $0x15,%eax
5af: cd 40 int $0x40
5b1: c3 ret
000005b2 <kill>:
5b2: b8 06 00 00 00 mov $0x6,%eax
5b7: cd 40 int $0x40
5b9: c3 ret
000005ba <exec>:
5ba: b8 07 00 00 00 mov $0x7,%eax
5bf: cd 40 int $0x40
5c1: c3 ret
000005c2 <open>:
5c2: b8 0f 00 00 00 mov $0xf,%eax
5c7: cd 40 int $0x40
5c9: c3 ret
000005ca <mknod>:
5ca: b8 11 00 00 00 mov $0x11,%eax
5cf: cd 40 int $0x40
5d1: c3 ret
000005d2 <unlink>:
5d2: b8 12 00 00 00 mov $0x12,%eax
5d7: cd 40 int $0x40
5d9: c3 ret
000005da <fstat>:
5da: b8 08 00 00 00 mov $0x8,%eax
5df: cd 40 int $0x40
5e1: c3 ret
000005e2 <link>:
5e2: b8 13 00 00 00 mov $0x13,%eax
5e7: cd 40 int $0x40
5e9: c3 ret
000005ea <mkdir>:
5ea: b8 14 00 00 00 mov $0x14,%eax
5ef: cd 40 int $0x40
5f1: c3 ret
000005f2 <chdir>:
5f2: b8 09 00 00 00 mov $0x9,%eax
5f7: cd 40 int $0x40
5f9: c3 ret
000005fa <dup>:
5fa: b8 0a 00 00 00 mov $0xa,%eax
5ff: cd 40 int $0x40
601: c3 ret
00000602 <getpid>:
602: b8 0b 00 00 00 mov $0xb,%eax
607: cd 40 int $0x40
609: c3 ret
0000060a <sbrk>:
60a: b8 0c 00 00 00 mov $0xc,%eax
60f: cd 40 int $0x40
611: c3 ret
00000612 <sleep>:
612: b8 0d 00 00 00 mov $0xd,%eax
617: cd 40 int $0x40
619: c3 ret
0000061a <uptime>:
61a: b8 0e 00 00 00 mov $0xe,%eax
61f: cd 40 int $0x40
621: c3 ret
00000622 <acquireTest>:
622: b8 16 00 00 00 mov $0x16,%eax
627: cd 40 int $0x40
629: c3 ret
0000062a <barrier>:
62a: b8 17 00 00 00 mov $0x17,%eax
62f: cd 40 int $0x40
631: c3 ret
632: 66 90 xchg %ax,%ax
634: 66 90 xchg %ax,%ax
636: 66 90 xchg %ax,%ax
638: 66 90 xchg %ax,%ax
63a: 66 90 xchg %ax,%ax
63c: 66 90 xchg %ax,%ax
63e: 66 90 xchg %ax,%ax
00000640 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
640: 55 push %ebp
641: 89 e5 mov %esp,%ebp
643: 57 push %edi
644: 56 push %esi
645: 53 push %ebx
646: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
649: 85 d2 test %edx,%edx
{
64b: 89 45 c0 mov %eax,-0x40(%ebp)
neg = 1;
x = -xx;
64e: 89 d0 mov %edx,%eax
if(sgn && xx < 0){
650: 79 76 jns 6c8 <printint+0x88>
652: f6 45 08 01 testb $0x1,0x8(%ebp)
656: 74 70 je 6c8 <printint+0x88>
x = -xx;
658: f7 d8 neg %eax
neg = 1;
65a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
} else {
x = xx;
}
i = 0;
661: 31 f6 xor %esi,%esi
663: 8d 5d d7 lea -0x29(%ebp),%ebx
666: eb 0a jmp 672 <printint+0x32>
668: 90 nop
669: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
do{
buf[i++] = digits[x % base];
670: 89 fe mov %edi,%esi
672: 31 d2 xor %edx,%edx
674: 8d 7e 01 lea 0x1(%esi),%edi
677: f7 f1 div %ecx
679: 0f b6 92 8c 0a 00 00 movzbl 0xa8c(%edx),%edx
}while((x /= base) != 0);
680: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
682: 88 14 3b mov %dl,(%ebx,%edi,1)
}while((x /= base) != 0);
685: 75 e9 jne 670 <printint+0x30>
if(neg)
687: 8b 45 c4 mov -0x3c(%ebp),%eax
68a: 85 c0 test %eax,%eax
68c: 74 08 je 696 <printint+0x56>
buf[i++] = '-';
68e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
693: 8d 7e 02 lea 0x2(%esi),%edi
696: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi
69a: 8b 7d c0 mov -0x40(%ebp),%edi
69d: 8d 76 00 lea 0x0(%esi),%esi
6a0: 0f b6 06 movzbl (%esi),%eax
write(fd, &c, 1);
6a3: 83 ec 04 sub $0x4,%esp
6a6: 83 ee 01 sub $0x1,%esi
6a9: 6a 01 push $0x1
6ab: 53 push %ebx
6ac: 57 push %edi
6ad: 88 45 d7 mov %al,-0x29(%ebp)
6b0: e8 ed fe ff ff call 5a2 <write>
while(--i >= 0)
6b5: 83 c4 10 add $0x10,%esp
6b8: 39 de cmp %ebx,%esi
6ba: 75 e4 jne 6a0 <printint+0x60>
putc(fd, buf[i]);
}
6bc: 8d 65 f4 lea -0xc(%ebp),%esp
6bf: 5b pop %ebx
6c0: 5e pop %esi
6c1: 5f pop %edi
6c2: 5d pop %ebp
6c3: c3 ret
6c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
6c8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
6cf: eb 90 jmp 661 <printint+0x21>
6d1: eb 0d jmp 6e0 <printf>
6d3: 90 nop
6d4: 90 nop
6d5: 90 nop
6d6: 90 nop
6d7: 90 nop
6d8: 90 nop
6d9: 90 nop
6da: 90 nop
6db: 90 nop
6dc: 90 nop
6dd: 90 nop
6de: 90 nop
6df: 90 nop
000006e0 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
6e0: 55 push %ebp
6e1: 89 e5 mov %esp,%ebp
6e3: 57 push %edi
6e4: 56 push %esi
6e5: 53 push %ebx
6e6: 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++){
6e9: 8b 75 0c mov 0xc(%ebp),%esi
6ec: 0f b6 1e movzbl (%esi),%ebx
6ef: 84 db test %bl,%bl
6f1: 0f 84 b3 00 00 00 je 7aa <printf+0xca>
ap = (uint*)(void*)&fmt + 1;
6f7: 8d 45 10 lea 0x10(%ebp),%eax
6fa: 83 c6 01 add $0x1,%esi
state = 0;
6fd: 31 ff xor %edi,%edi
ap = (uint*)(void*)&fmt + 1;
6ff: 89 45 d4 mov %eax,-0x2c(%ebp)
702: eb 2f jmp 733 <printf+0x53>
704: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
708: 83 f8 25 cmp $0x25,%eax
70b: 0f 84 a7 00 00 00 je 7b8 <printf+0xd8>
write(fd, &c, 1);
711: 8d 45 e2 lea -0x1e(%ebp),%eax
714: 83 ec 04 sub $0x4,%esp
717: 88 5d e2 mov %bl,-0x1e(%ebp)
71a: 6a 01 push $0x1
71c: 50 push %eax
71d: ff 75 08 pushl 0x8(%ebp)
720: e8 7d fe ff ff call 5a2 <write>
725: 83 c4 10 add $0x10,%esp
728: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
72b: 0f b6 5e ff movzbl -0x1(%esi),%ebx
72f: 84 db test %bl,%bl
731: 74 77 je 7aa <printf+0xca>
if(state == 0){
733: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
735: 0f be cb movsbl %bl,%ecx
738: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
73b: 74 cb je 708 <printf+0x28>
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
73d: 83 ff 25 cmp $0x25,%edi
740: 75 e6 jne 728 <printf+0x48>
if(c == 'd'){
742: 83 f8 64 cmp $0x64,%eax
745: 0f 84 05 01 00 00 je 850 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
74b: 81 e1 f7 00 00 00 and $0xf7,%ecx
751: 83 f9 70 cmp $0x70,%ecx
754: 74 72 je 7c8 <printf+0xe8>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
756: 83 f8 73 cmp $0x73,%eax
759: 0f 84 99 00 00 00 je 7f8 <printf+0x118>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
75f: 83 f8 63 cmp $0x63,%eax
762: 0f 84 08 01 00 00 je 870 <printf+0x190>
putc(fd, *ap);
ap++;
} else if(c == '%'){
768: 83 f8 25 cmp $0x25,%eax
76b: 0f 84 ef 00 00 00 je 860 <printf+0x180>
write(fd, &c, 1);
771: 8d 45 e7 lea -0x19(%ebp),%eax
774: 83 ec 04 sub $0x4,%esp
777: c6 45 e7 25 movb $0x25,-0x19(%ebp)
77b: 6a 01 push $0x1
77d: 50 push %eax
77e: ff 75 08 pushl 0x8(%ebp)
781: e8 1c fe ff ff call 5a2 <write>
786: 83 c4 0c add $0xc,%esp
789: 8d 45 e6 lea -0x1a(%ebp),%eax
78c: 88 5d e6 mov %bl,-0x1a(%ebp)
78f: 6a 01 push $0x1
791: 50 push %eax
792: ff 75 08 pushl 0x8(%ebp)
795: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
798: 31 ff xor %edi,%edi
write(fd, &c, 1);
79a: e8 03 fe ff ff call 5a2 <write>
for(i = 0; fmt[i]; i++){
79f: 0f b6 5e ff movzbl -0x1(%esi),%ebx
write(fd, &c, 1);
7a3: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
7a6: 84 db test %bl,%bl
7a8: 75 89 jne 733 <printf+0x53>
}
}
}
7aa: 8d 65 f4 lea -0xc(%ebp),%esp
7ad: 5b pop %ebx
7ae: 5e pop %esi
7af: 5f pop %edi
7b0: 5d pop %ebp
7b1: c3 ret
7b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
state = '%';
7b8: bf 25 00 00 00 mov $0x25,%edi
7bd: e9 66 ff ff ff jmp 728 <printf+0x48>
7c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
7c8: 83 ec 0c sub $0xc,%esp
7cb: b9 10 00 00 00 mov $0x10,%ecx
7d0: 6a 00 push $0x0
7d2: 8b 7d d4 mov -0x2c(%ebp),%edi
7d5: 8b 45 08 mov 0x8(%ebp),%eax
7d8: 8b 17 mov (%edi),%edx
7da: e8 61 fe ff ff call 640 <printint>
ap++;
7df: 89 f8 mov %edi,%eax
7e1: 83 c4 10 add $0x10,%esp
state = 0;
7e4: 31 ff xor %edi,%edi
ap++;
7e6: 83 c0 04 add $0x4,%eax
7e9: 89 45 d4 mov %eax,-0x2c(%ebp)
7ec: e9 37 ff ff ff jmp 728 <printf+0x48>
7f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
7f8: 8b 45 d4 mov -0x2c(%ebp),%eax
7fb: 8b 08 mov (%eax),%ecx
ap++;
7fd: 83 c0 04 add $0x4,%eax
800: 89 45 d4 mov %eax,-0x2c(%ebp)
if(s == 0)
803: 85 c9 test %ecx,%ecx
805: 0f 84 8e 00 00 00 je 899 <printf+0x1b9>
while(*s != 0){
80b: 0f b6 01 movzbl (%ecx),%eax
state = 0;
80e: 31 ff xor %edi,%edi
s = (char*)*ap;
810: 89 cb mov %ecx,%ebx
while(*s != 0){
812: 84 c0 test %al,%al
814: 0f 84 0e ff ff ff je 728 <printf+0x48>
81a: 89 75 d0 mov %esi,-0x30(%ebp)
81d: 89 de mov %ebx,%esi
81f: 8b 5d 08 mov 0x8(%ebp),%ebx
822: 8d 7d e3 lea -0x1d(%ebp),%edi
825: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
828: 83 ec 04 sub $0x4,%esp
s++;
82b: 83 c6 01 add $0x1,%esi
82e: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
831: 6a 01 push $0x1
833: 57 push %edi
834: 53 push %ebx
835: e8 68 fd ff ff call 5a2 <write>
while(*s != 0){
83a: 0f b6 06 movzbl (%esi),%eax
83d: 83 c4 10 add $0x10,%esp
840: 84 c0 test %al,%al
842: 75 e4 jne 828 <printf+0x148>
844: 8b 75 d0 mov -0x30(%ebp),%esi
state = 0;
847: 31 ff xor %edi,%edi
849: e9 da fe ff ff jmp 728 <printf+0x48>
84e: 66 90 xchg %ax,%ax
printint(fd, *ap, 10, 1);
850: 83 ec 0c sub $0xc,%esp
853: b9 0a 00 00 00 mov $0xa,%ecx
858: 6a 01 push $0x1
85a: e9 73 ff ff ff jmp 7d2 <printf+0xf2>
85f: 90 nop
write(fd, &c, 1);
860: 83 ec 04 sub $0x4,%esp
863: 88 5d e5 mov %bl,-0x1b(%ebp)
866: 8d 45 e5 lea -0x1b(%ebp),%eax
869: 6a 01 push $0x1
86b: e9 21 ff ff ff jmp 791 <printf+0xb1>
putc(fd, *ap);
870: 8b 7d d4 mov -0x2c(%ebp),%edi
write(fd, &c, 1);
873: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
876: 8b 07 mov (%edi),%eax
write(fd, &c, 1);
878: 6a 01 push $0x1
ap++;
87a: 83 c7 04 add $0x4,%edi
putc(fd, *ap);
87d: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
880: 8d 45 e4 lea -0x1c(%ebp),%eax
883: 50 push %eax
884: ff 75 08 pushl 0x8(%ebp)
887: e8 16 fd ff ff call 5a2 <write>
ap++;
88c: 89 7d d4 mov %edi,-0x2c(%ebp)
88f: 83 c4 10 add $0x10,%esp
state = 0;
892: 31 ff xor %edi,%edi
894: e9 8f fe ff ff jmp 728 <printf+0x48>
s = "(null)";
899: bb 82 0a 00 00 mov $0xa82,%ebx
while(*s != 0){
89e: b8 28 00 00 00 mov $0x28,%eax
8a3: e9 72 ff ff ff jmp 81a <printf+0x13a>
8a8: 66 90 xchg %ax,%ax
8aa: 66 90 xchg %ax,%ax
8ac: 66 90 xchg %ax,%ax
8ae: 66 90 xchg %ax,%ax
000008b0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
8b0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8b1: a1 bc 0d 00 00 mov 0xdbc,%eax
{
8b6: 89 e5 mov %esp,%ebp
8b8: 57 push %edi
8b9: 56 push %esi
8ba: 53 push %ebx
8bb: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
8be: 8d 4b f8 lea -0x8(%ebx),%ecx
8c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8c8: 39 c8 cmp %ecx,%eax
8ca: 8b 10 mov (%eax),%edx
8cc: 73 32 jae 900 <free+0x50>
8ce: 39 d1 cmp %edx,%ecx
8d0: 72 04 jb 8d6 <free+0x26>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
8d2: 39 d0 cmp %edx,%eax
8d4: 72 32 jb 908 <free+0x58>
break;
if(bp + bp->s.size == p->s.ptr){
8d6: 8b 73 fc mov -0x4(%ebx),%esi
8d9: 8d 3c f1 lea (%ecx,%esi,8),%edi
8dc: 39 fa cmp %edi,%edx
8de: 74 30 je 910 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
8e0: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
8e3: 8b 50 04 mov 0x4(%eax),%edx
8e6: 8d 34 d0 lea (%eax,%edx,8),%esi
8e9: 39 f1 cmp %esi,%ecx
8eb: 74 3a je 927 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
8ed: 89 08 mov %ecx,(%eax)
freep = p;
8ef: a3 bc 0d 00 00 mov %eax,0xdbc
}
8f4: 5b pop %ebx
8f5: 5e pop %esi
8f6: 5f pop %edi
8f7: 5d pop %ebp
8f8: c3 ret
8f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
900: 39 d0 cmp %edx,%eax
902: 72 04 jb 908 <free+0x58>
904: 39 d1 cmp %edx,%ecx
906: 72 ce jb 8d6 <free+0x26>
{
908: 89 d0 mov %edx,%eax
90a: eb bc jmp 8c8 <free+0x18>
90c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
910: 03 72 04 add 0x4(%edx),%esi
913: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
916: 8b 10 mov (%eax),%edx
918: 8b 12 mov (%edx),%edx
91a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
91d: 8b 50 04 mov 0x4(%eax),%edx
920: 8d 34 d0 lea (%eax,%edx,8),%esi
923: 39 f1 cmp %esi,%ecx
925: 75 c6 jne 8ed <free+0x3d>
p->s.size += bp->s.size;
927: 03 53 fc add -0x4(%ebx),%edx
freep = p;
92a: a3 bc 0d 00 00 mov %eax,0xdbc
p->s.size += bp->s.size;
92f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
932: 8b 53 f8 mov -0x8(%ebx),%edx
935: 89 10 mov %edx,(%eax)
}
937: 5b pop %ebx
938: 5e pop %esi
939: 5f pop %edi
93a: 5d pop %ebp
93b: c3 ret
93c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000940 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
940: 55 push %ebp
941: 89 e5 mov %esp,%ebp
943: 57 push %edi
944: 56 push %esi
945: 53 push %ebx
946: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
949: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
94c: 8b 15 bc 0d 00 00 mov 0xdbc,%edx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
952: 8d 78 07 lea 0x7(%eax),%edi
955: c1 ef 03 shr $0x3,%edi
958: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
95b: 85 d2 test %edx,%edx
95d: 0f 84 9d 00 00 00 je a00 <malloc+0xc0>
963: 8b 02 mov (%edx),%eax
965: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
968: 39 cf cmp %ecx,%edi
96a: 76 6c jbe 9d8 <malloc+0x98>
96c: 81 ff 00 10 00 00 cmp $0x1000,%edi
972: bb 00 10 00 00 mov $0x1000,%ebx
977: 0f 43 df cmovae %edi,%ebx
p = sbrk(nu * sizeof(Header));
97a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
981: eb 0e jmp 991 <malloc+0x51>
983: 90 nop
984: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
988: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
98a: 8b 48 04 mov 0x4(%eax),%ecx
98d: 39 f9 cmp %edi,%ecx
98f: 73 47 jae 9d8 <malloc+0x98>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
991: 39 05 bc 0d 00 00 cmp %eax,0xdbc
997: 89 c2 mov %eax,%edx
999: 75 ed jne 988 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
99b: 83 ec 0c sub $0xc,%esp
99e: 56 push %esi
99f: e8 66 fc ff ff call 60a <sbrk>
if(p == (char*)-1)
9a4: 83 c4 10 add $0x10,%esp
9a7: 83 f8 ff cmp $0xffffffff,%eax
9aa: 74 1c je 9c8 <malloc+0x88>
hp->s.size = nu;
9ac: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
9af: 83 ec 0c sub $0xc,%esp
9b2: 83 c0 08 add $0x8,%eax
9b5: 50 push %eax
9b6: e8 f5 fe ff ff call 8b0 <free>
return freep;
9bb: 8b 15 bc 0d 00 00 mov 0xdbc,%edx
if((p = morecore(nunits)) == 0)
9c1: 83 c4 10 add $0x10,%esp
9c4: 85 d2 test %edx,%edx
9c6: 75 c0 jne 988 <malloc+0x48>
return 0;
}
}
9c8: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
9cb: 31 c0 xor %eax,%eax
}
9cd: 5b pop %ebx
9ce: 5e pop %esi
9cf: 5f pop %edi
9d0: 5d pop %ebp
9d1: c3 ret
9d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
9d8: 39 cf cmp %ecx,%edi
9da: 74 54 je a30 <malloc+0xf0>
p->s.size -= nunits;
9dc: 29 f9 sub %edi,%ecx
9de: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
9e1: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
9e4: 89 78 04 mov %edi,0x4(%eax)
freep = prevp;
9e7: 89 15 bc 0d 00 00 mov %edx,0xdbc
}
9ed: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
9f0: 83 c0 08 add $0x8,%eax
}
9f3: 5b pop %ebx
9f4: 5e pop %esi
9f5: 5f pop %edi
9f6: 5d pop %ebp
9f7: c3 ret
9f8: 90 nop
9f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
a00: c7 05 bc 0d 00 00 c0 movl $0xdc0,0xdbc
a07: 0d 00 00
a0a: c7 05 c0 0d 00 00 c0 movl $0xdc0,0xdc0
a11: 0d 00 00
base.s.size = 0;
a14: b8 c0 0d 00 00 mov $0xdc0,%eax
a19: c7 05 c4 0d 00 00 00 movl $0x0,0xdc4
a20: 00 00 00
a23: e9 44 ff ff ff jmp 96c <malloc+0x2c>
a28: 90 nop
a29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
prevp->s.ptr = p->s.ptr;
a30: 8b 08 mov (%eax),%ecx
a32: 89 0a mov %ecx,(%edx)
a34: eb b1 jmp 9e7 <malloc+0xa7>
|
growroom/bytecode-interpreter.asm | SvenMichaelKlose/bender | 2 | 91018 | <reponame>SvenMichaelKlose/bender<filename>growroom/bytecode-interpreter.asm
; Combined direct and token threading.
; See also: https://en.wikipedia.org/wiki/Threaded_code
interpret:
.(
ldy #0
lda (bytecode_ptr),y
beq done
inc bytecode_ptr
asl
bcs local_fun
sta jump+1
bytecode_funs:
lda bytecode_flags
ldy bytecode_y
pha
lda bytecode_a
plp
jump:
jsr $1234
sta bytecode_a
sty bytecode_y
php
pla
sta bytecode_flags
jmp interpret
local_fun:
sta jump2+1
jump2:
jsr $1234
jmp interpret
done:
rts
.)
local_bytecode_funs:
bc_lda:
iny
lda (bytecode_ptr),y
sta bytecode_a
inc bytecode_ptr
rts
bc_bcs:
.(
bcc r
lda (bytecode_ptr),y
sta bytecode_ptr
r: inc bytecode_ptr
rts
.)
|
oeis/320/A320465.asm | neoneye/loda-programs | 11 | 8625 | <gh_stars>10-100
; A320465: a(n) = 2^n - (2^(n-1) mod n), where "mod" is the nonnegative remainder operator.
; Submitted by <NAME>
; 2,4,7,16,31,62,127,256,508,1022,2047,4088,8191,16382,32764,65536,131071,262130,524287,1048568,2097148,4194302,8388607,16777208,33554416,67108862,134217715,268435448,536870911,1073741822,2147483647,4294967296,8589934588
mov $1,$0
add $1,1
mov $2,2
pow $2,$1
mov $0,$2
div $2,2
mod $2,$1
sub $0,$2
|
macros/wram.asm | opiter09/ASM-Machina | 1 | 168307 | ; Used in wram.asm
flag_array: MACRO
ds ((\1) + 7) / 8
ENDM
BOX_STRUCT_LENGTH EQU 25 + NUM_MOVES * 2
box_struct: MACRO
\1Species:: db
\1HP:: dw
\1BoxLevel:: db
\1Status:: db
\1Type::
\1Type1:: db
\1Type2:: db
\1CatchRate:: db
\1Moves:: ds NUM_MOVES
\1OTID:: dw
\1Exp:: ds 3
\1HPExp:: dw
\1AttackExp:: dw
\1DefenseExp:: dw
\1SpeedExp:: dw
\1SpecialExp:: dw
\1DVs:: ds 2
\1PP:: ds NUM_MOVES
ENDM
party_struct: MACRO
box_struct \1
\1Level:: db
\1Stats::
\1MaxHP:: dw
\1Attack:: dw
\1Defense:: dw
\1Speed:: dw
\1Special:: dw
ENDM
battle_struct: MACRO
\1Species:: db
\1HP:: dw
\1PartyPos::
\1BoxLevel:: db
\1Status:: db
\1Type::
\1Type1:: db
\1Type2:: db
\1CatchRate:: db
\1Moves:: ds NUM_MOVES
\1DVs:: ds 2
\1Level:: db
\1Stats::
\1MaxHP:: dw
\1Attack:: dw
\1Defense:: dw
\1Speed:: dw
\1Special:: dw
\1PP:: ds NUM_MOVES
ENDM
spritestatedata1: MACRO
\1PictureID:: db
\1MovementStatus:: db
\1ImageIndex:: db
\1YStepVector:: db
\1YPixels:: db
\1XStepVector:: db
\1XPixels:: db
\1IntraAnimFrameCounter:: db
\1AnimFrameCounter:: db
\1FacingDirection:: db
\1YAdjusted:: db
\1XAdjusted:: db
\1CollisionData:: db
ds 3
\1End::
ENDM
spritestatedata2: MACRO
\1WalkAnimationCounter:: db
ds 1
\1YDisplacement:: db
\1XDisplacement:: db
\1MapY:: db
\1MapX:: db
\1MovementByte1:: db
\1GrassPriority:: db
\1MovementDelay:: db
\1OrigFacingDirection:: db
ds 3
\1PictureID:: db
\1ImageBaseOffset:: db
ds 1
\1End::
ENDM
sprite_oam_struct: MACRO
\1YCoord:: db
\1XCoord:: db
\1TileID:: db
\1Attributes:: db
ENDM
map_connection_struct: MACRO
\1ConnectedMap:: db
\1ConnectionStripSrc:: dw
\1ConnectionStripDest:: dw
\1ConnectionStripLength:: db
\1ConnectedMapWidth:: db
\1ConnectedMapYAlignment:: db
\1ConnectedMapXAlignment:: db
\1ConnectedMapViewPointer:: dw
ENDM
|
xlateFont.asm | dshadoff/SYSCARD_Translatefont | 4 | 83846 | <reponame>dshadoff/SYSCARD_Translatefont
.list
.mlist
; **************************************************************************
;
; System Card V3.00 Patches to include Translate font (8x12 and 8x16)
;
; **************************************************************************
JPN_SYSCARD = 1
.bank $0
.org $0000
.if JPN_SYSCARD
.incbin "syscard3.pce.jpn"
VERPTCH = $C868
VERTGT = $C950
VERORG = $CDA0
FNTPTCH = $E060
ORGTRGT = $F124
FNTERR = $F129
FNTORG0 = $FEC4
.else
.incbin "syscard3.pce.usa"
VERPTCH = $C868
VERTGT = $C943
VERORG = $CD30
FNTPTCH = $E060
ORGTRGT = $F13D
FNTERR = $F142
FNTORG0 = $FEDD
.endif
VERBANK = 1 ; Bank where version ID appears
FONTBANK = 1 ; We are putting the font code in Bank 1
_AL = $F8 ; input = SJIS code LSB
_AH = $F9 ; input = SJIS code MSB (or ASCII)
_BL = $FA ; input = target buffer LSB
_BH = $FB ; input = target buffer MSB
_DH = $FF ; input = character set
; 0 = 16x16
; 1 = 12x12
; 2 = 8x16 (NEW !!)
; 3 = 8x12 (NEW !!)
BASEADDR_MSB = $FC
BANK_STORE = $22BA ; syscard's EX_GETFNT puts old bank here
RET_CODE = $EE
SRCLOC = $EC
SRCLOC_L = $EC
SRCLOC_H = $ED
.bank 0
.org FNTPTCH
JMP FNTORG0
.org FNTORG0
LDA <_DH
CMP #$2 ; 0=16x16
; 1=12x12
BCC NORMAL
CMP #$4 ; 2=8x16
; 3=8x12
BCC BNKMAP
JMP FNTERR ; other value
NORMAL: JMP ORGTRGT ; original instruction
BNKMAP: LDA #$C0 ; Presumptive location where
; bank 1 will be mapped
STA <BASEADDR_MSB ; Store base addr
LDA <_BH ; MSB of target buffer
SEC
CMP #$C0 ; is it a conflict ?
BCS .ALTMAP
TMA6 ; store old bank
STA BANK_STORE
LDA #FONTBANK ; swap in FONT BANK
TAM6
JSR FNTORG1 ; our font routine
LDA BANK_STORE ; swap original bank back in
TAM6
BRA EXIT
.ALTMAP: LDA #$60 ; base location ($6000 range)
STA <BASEADDR_MSB
TMA3 ; store old bank
STA BANK_STORE
LDA #FONTBANK ; swap in FONT BANK
TAM3
JSR FNTORG1-$6000 ; our font routine
LDA BANK_STORE ; swap original bank back in
TAM3
EXIT:
LDA <RET_CODE
RTS
; **************************************************************************
;
; Now, add some identification information
;
; **************************************************************************
; This string is here so that games can check version ID
; to ensure that they don't try to run on a card without
; the functionality. So, it's at a fixed location.
;
; It may be sufficient to check only the first two letters ('NU')
;
.bank 0
.org $FFAA
.db "NUFONT"
;
; Now, we patch the screen paint function to print out
; an additional identification string
;
.bank VERBANK
.org VERPTCH
JSR VERORG
.org VERORG
JSR VERTGT
LDA #LOW(VERSTR)
STA <_AL
LDA #HIGH(VERSTR)
STA <_AH
JSR VERTGT
RTS
VERSTR: .db $00 ; color attribute
.db $13,$0f ; x, y position on screen
.db "NUFONT 1.00"
.db $ff ; string end
.db $ff ; string list end
ENDVER:
; **************************************************************************
;
; The print function lives substantially in this bank and must be
; relocatable, as the target buffer's RAM location is not known
; until runtime (and this can't occupy the same bank)
;
; **************************************************************************
.if FONTBANK = VERBANK
.bank FONTBANK ; if same bank, just continue
.org ENDVER
.else
.bank FONTBANK ; only needed if relocated
.org $C000 ; to a new empty bank
.endif
FONT1: .incbin "font8x16.bin"
FONT2: .incbin "font8x12.bin"
FNTORG1:
LDA #1
STA <RET_CODE ; set presumptive error code
LDA <_AH ; ASCII will be stored in MSB
.CHK1: CMP #$80
BCC .CHK2
RTS
.CHK2: CMP #$20
BCS .CHKOK
RTS
.CHKOK: STZ <RET_CODE ; ASCII OK - not an error now
SEC ; set up new value range
SBC #$20
STA <_AL
STZ <_AH
LDA <_DH
CMP #$2 ; if 8x12 font, used different
; offset calculation
BEQ .WID8X16
LDA <_AL
STA <SRCLOC_L ; store temporarily
LDA <_AH
STA <SRCLOC_H
ASL <_AL ; _AX = _AX * 2
ROL <_AH
CLC
LDA <SRCLOC_L
ADC <_AL
STA <_AL
LDA <SRCLOC_H
ADC <_AH
STA <_AH ; Now, _AX = (orig _AX) * 3
ASL <_AL ; Now, _AX = (orig _AX) * 6
ROL <_AH
ASL <_AL ; Now, _AX = (orig _AX) * 12
ROL <_AH
LDA #LOW(FONT2) ; character width table
STA <SRCLOC_L
LDA #HIGH(FONT2) & $1F
CLC
ADC <BASEADDR_MSB ; base address
STA <SRCLOC_H
LDX #$0C ; loop setup - 12 pix tall
BRA ADD
.WID8X16: LDX #4
.LOOP1: ASL <_AL ; 16 bytes per character
ROL <_AH
DEX
BNE .LOOP1
LDA #LOW(FONT1) ; set up base address for font
STA <SRCLOC_L
LDA #HIGH(FONT1) & $1F
CLC
ADC <BASEADDR_MSB ; add base memory offset
STA <SRCLOC_H
LDX #$10 ; loop setup - 16 pix tall
ADD: CLC ; add character offset to base
LDA <_AL
ADC <SRCLOC_L
STA <SRCLOC_L
LDA <_AH
ADC <SRCLOC_H
STA <SRCLOC_H
LDY #0
.CPYLP: LDA [SRCLOC] ; get byte
STA [_BL],Y
INY
CLA ; right side is empty
STA [_BL],Y
INY
CLC
LDA <SRCLOC_L ; increment font source pointer
ADC #1
STA <SRCLOC_L
LDA <SRCLOC_H
ADC #0
STA <SRCLOC_H
DEX
BNE .CPYLP
LDA <_DH
CMP #$3
BNE .RET
LDX #8 ; Need to fill remainder of buffer
CLA
.CPYLP2: STA [_BL],Y
INY
DEX
BNE .CPYLP2
.RET: RTS
|
test/Compiler/simple/Erased-cubical-FFI.agda | KDr2/agda | 1 | 7608 | {-# OPTIONS --erased-cubical --no-main --save-metas #-}
open import Agda.Builtin.Bool
open import Erased-cubical-Cubical
postulate
f : Not-compiled → Bool
-- It is at the time of writing not possible to give a COMPILE GHC
-- pragma for f, because Not-compiled is not compiled.
{-# COMPILE GHC f = \_ -> True #-}
|
programs/oeis/008/A008859.asm | karttu/loda | 1 | 13963 | <reponame>karttu/loda
; A008859: a(n) = Sum_{k=0..6} C(n,k).
; 1,2,4,8,16,32,64,127,247,466,848,1486,2510,4096,6476,9949,14893,21778,31180,43796,60460,82160,110056,145499,190051,245506,313912,397594,499178,621616,768212,942649,1149017,1391842,1676116,2007328,2391496,2835200,3345616,3930551,4598479,5358578,6220768,7195750,8295046,9531040,10917020,12467221,14196869,16122226,18260636,20630572,23251684,26144848,29332216,32837267,36684859,40901282,45514312,50553266,56049058,62034256,68543140,75611761,83278001,91581634,100564388,110270008,120744320,132035296,144193120,157270255,171321511,186404114,202577776,219904766,238449982,258281024,279468268,302084941,326207197,351914194,379288172,408414532,439381916,472282288,507211016,544266955,583552531,625173826,669240664,715866698,765169498,817270640,872295796,930374825,991641865,1056235426,1124298484,1195978576,1271427896,1350803392,1434266864,1521985063,1614129791,1710878002,1812411904,1918919062,2030592502,2147630816,2270238268,2398624901,2533006645,2673605426,2820649276,2974372444,3135015508,3302825488,3478055960,3660967171,3851826155,4050906850,4258490216,4474864354,4700324626,4935173776,5179722052,5434287329,5699195233,5974779266,6261380932,6559349864,6869043952,7190829472,7525081216,7872182623,8232525911,8606512210,8994551696,9397063726,9814476974,10247229568,10695769228,11160553405,11642049421,12140734610,12657096460,13191632756,13744851724,14317272176,14909423656,15521846587,16155092419,16809723778,17486314616,18185450362,18907728074,19653756592,20424156692,21219561241,22040615353,22887976546,23762314900,24664313216,25594667176,26554085504,27543290128,28563016343,29614012975,30697042546,31812881440,32962320070,34146163046,35365229344,36620352476,37912380661,39242176997,40610619634,42018601948,43467032716,44956836292,46488952784,48064338232,49683964787,51348820891,53059911458,54818258056,56624899090,58480889986,60387303376,62345229284,64355775313,66420066833,68539247170,70714477796,72946938520,75237827680,77588362336,79999778464,82473331151,85010294791,87611963282,90279650224,93014689118,95818433566,98692257472,101637555244,104655741997,107748253757,110916547666,114162102188,117486417316,120891014780,124377438256,127947253576,131602048939,135343435123,139173045698,143092537240,147103589546,151207905850,155407213040,159703261876,164097827209,168592708201,173189728546,177890736692,182697606064,187612235288,192636548416,197772495152,203022051079,208387217887,213870023602,219472522816,225196796918,231044954326,237019130720,243121489276,249354220901,255719544469,262219707058,268856984188,275633680060,282552127796,289614689680,296823757400,304181752291,311691125579,319354358626
cal $0,115567 ; a(n) = C(n,6) + C(n,5) + C(n,4) + C(n,3) + C(n,2) + C(n,1).
mov $1,$0
add $1,1
|
examples.agda | agda/agda-github-syntax-highlighting | 3 | 6182 | -- The following file contains various examples of highlighting.
-- It does not necessarily typecheck (but it should parse)
a : A → Set
a b : A → Set
postulate a : A → Set
abstract a b : A → Set
abstracta : A → Set
postulate abstract a : A → Set
private
a b : A → Set
abstract a : A → Set
pattern-a : A → Set
abstractSet : Set
x-rewrite : abstractSet
|
programs/oeis/055/A055274.asm | neoneye/loda | 22 | 96576 | <reponame>neoneye/loda
; A055274: First differences of 8^n (A001018).
; 1,7,56,448,3584,28672,229376,1835008,14680064,117440512,939524096,7516192768,60129542144,481036337152,3848290697216,30786325577728,246290604621824,1970324836974592,15762598695796736,126100789566373888,1008806316530991104,8070450532247928832,64563604257983430656,516508834063867445248,4132070672510939561984,33056565380087516495872,264452523040700131966976,2115620184325601055735808,16924961474604808445886464,135399691796838467567091712,1083197534374707740536733696,8665580274997661924293869568,69324642199981295394350956544,554597137599850363154807652352,4436777100798802905238461218816,35494216806390423241907689750528,283953734451123385935261518004224,2271629875608987087482092144033792,18173039004871896699856737152270336,145384312038975173598853897218162688
mov $1,8
pow $1,$0
mul $1,7
sub $1,6
div $1,8
add $1,1
mov $0,$1
|
software/profi/net-tools/src/pqdos/browser/gopher/render/dialogbox.asm | andykarpov/karabas-pro | 26 | 88983 | <gh_stars>10-100
module DialogBox
inputBox:
xor a : ld (inputBuffer), a
.noclear
call drawBox
.loop
ld de, #0B05 : call TextMode.gotoXY
ld hl, inputBuffer : call TextMode.printZ
ld a, MIME_INPUT : call TextMode.putC : ld a, ' ' : call TextMode.putC
.checkkey
call Console.getC
cp BACKSPACE : jr z, .removeChar
cp CR : ret z
cp SPACE : jr c, .checkkey
jr .putC
.putC
ld e, a
xor a : ld hl, inputBuffer, bc, #ff : cpir
ld (hl), a : dec hl : ld (hl), e
jr .loop
.removeChar
xor a
ld hl, inputBuffer, bc, #ff : cpir
push hl
ld de, inputBuffer + 1
or a : sbc hl, de
ld a, h : or l
pop hl
jr z, .loop
xor a
dec hl : dec hl : ld (hl), a
jr .loop
inputBuffer ds 80
msgBox:
call msgNoWait
ld b, 150
.loop
halt
djnz .loop
ret
msgNoWait:
push hl
call drawBox
pop hl
jp TextMode.printZ
drawBox:
ld h, #0A, a, '*' : call TextMode.fillLine
ld h, #0B, a, ' ' : call TextMode.fillLine
ld h, #0C, a, '*' : call TextMode.fillLine
ld a, #0a : call TextMode.highlightLine
ld a, #0c : call TextMode.highlightLine
ld de, #0B05 : call TextMode.gotoXY
ret
endmodule
|
src/third_party/nasm/travis/test/br3026808.asm | Mr-Sheep/naiveproxy | 2,219 | 246420 | <gh_stars>1000+
%imacro proc 1
%push proc
%assign %$arg 1
%endmacro
%imacro arg 0-1 1
%assign %$arg %1+%$arg
%endmacro
%imacro endproc 0
%pop
%endmacro
;----------------------------
proc Test
%$ARG arg
endproc
|
Test_B.asm | LiaoHanwen/microcomputer-experiment | 0 | 18942 | <reponame>LiaoHanwen/microcomputer-experiment
;Test B
;macro for output
output macro ostr,onum
mov dx,offset ostr
mov ah,09h
int 21h
mov dl,onum
mov ah,02h
int 21h
endm
data segment
orgin dw 1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,-1,-2,-3,-4,-5,-6,-7 ;test numbers
count equ $-orgin ;size of numbers
poev db '0'
pood db '0'
neev db '0'
neod db '0'
zero db '0'
poevstr db 'Positive and even: ','$'
poodstr db 0dh,0ah,'Positive and odd: ','$'
neevstr db 0dh,0ah,'Negative and even: ','$'
neodstr db 0dh,0ah,'Negative and odd: ','$'
zerostr db 0dh,0ah,'Equal to 0: ','$'
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax ;ds=data
lea ax,orgin
mov si,ax ;si=orgin
mov ax,count
mov bl,2 ;bx=2
div bl
mov cx,ax
malp: mov ax,[si]
cmp ax,0
jz fzero ;lower than 0
jg posi ;greater than 0
jl nega ;is 0
edlp: add si,2
loop malp
jmp otpt
fzero: add [zero],1 ;zero+1
jmp edlp ;return
posi: idiv bl ;positive
cmp ah,0
jz fpoev
jmp fpood
fpoev: add poev,1 ;positive & even
jmp edlp
fpood: add pood,1 ;positive & odd
jmp edlp
nega: idiv bl ;negative
cmp ah,0
jz fneev
jmp fneod
fneev: add neev,1 ;negative & even
jmp edlp
fneod: add neod,1 ;negative & odd
jmp edlp
otpt: output poevstr,poev
output poodstr,pood
output neevstr,neev
output neodstr,neod
output zerostr,zero
mov ax,4c00h
int 21h
code ends
end start |
programs/oeis/265/A265227.asm | karttu/loda | 0 | 166260 | ; A265227: Nonnegative m for which k*floor(m^2/9) = floor(k*m^2/9), with 2 < k < 9.
; 0,1,3,6,8,9,10,12,15,17,18,19,21,24,26,27,28,30,33,35,36,37,39,42,44,45,46,48,51,53,54,55,57,60,62,63,64,66,69,71,72,73,75,78,80,81,82,84,87,89,90,91,93,96,98,99,100,102,105,107,108,109,111,114,116,117,118,120,123,125,126,127,129,132,134,135,136,138,141,143,144,145,147,150,152,153,154,156,159,161,162,163,165,168,170,171,172,174,177,179,180,181,183,186,188,189,190,192,195,197,198,199,201,204,206,207,208,210,213,215,216,217,219,222,224,225,226,228,231,233,234,235,237,240,242,243,244,246,249,251,252,253,255,258,260,261,262,264,267,269,270,271,273,276,278,279,280,282,285,287,288,289,291,294,296,297,298,300,303,305,306,307,309,312,314,315,316,318,321,323,324,325,327,330,332,333,334,336,339,341,342,343,345,348,350,351,352,354,357,359,360,361,363,366,368,369,370,372,375,377,378,379,381,384,386,387,388,390,393,395,396,397,399,402,404,405,406,408,411,413,414,415,417,420,422,423,424,426,429,431,432,433,435,438,440,441,442,444,447,449
mov $2,$0
mul $0,2
add $0,4
lpb $0,1
sub $0,2
trn $0,5
add $0,1
add $2,4
mov $1,$2
sub $1,4
add $1,$0
trn $0,4
lpe
sub $1,1
|
src/data.adb | Rassol/AdaSem | 0 | 5360 | <reponame>Rassol/AdaSem
-- Implementation of class called data
with Text_IO, Ada.Integer_Text_IO;
use Text_IO, Ada.Integer_Text_IO;
package body Data is
procedure Find_Borders (s: out integer; f: out integer; num: in integer) is
begin
s:= 1+num*n/p;
f:= (num+1)*n/p;
end Find_Borders;
--Input Vector from keyboard
procedure Vector_Input (A: out Vector; S: in String) is
begin
for i in 1..n loop
Get(A(i));
Put(S);
Put("[");
Put(i);
Put("]= ");
Put(A(i));
Put(" inputed");
New_Line(1);
end loop;
end Vector_input;
--Fill Vector with numbers
procedure Vector_Fill (A: out Vector; B: in Integer) is
begin
for i in 1..n loop
A(i):=B;
end loop;
end Vector_Fill;
--Print Vector on screen
procedure Vector_Output(A: in Vector) is
begin
for i in 1..n loop
Put(A(i));
Put(" ");
end loop;
end Vector_Output;
--Input Matrix from keyboard
procedure Matrix_Input (A: out Matrix; S: in String) is
begin
for i in 1..n loop
for j in 1..n loop
Get(A(i)(j));
Put(S);
Put("[");
Put(i);
Put("][");
Put(j);
Put("]= ");
Put(A(i)(j));
Put(" inputed");
New_Line(1);
end loop;
end loop;
end Matrix_Input;
--Fill Matrix with numbers
procedure Matrix_Fill (A: out Matrix; B: in Integer) is
begin
for i in 1..n loop
for j in 1..n loop
A(i)(j):=B;
end loop;
end loop;
end Matrix_Fill;
--Print Matrix on screen
procedure Matrix_Output (A: in Matrix) is
begin
for i in 1..n loop
for j in 1..n loop
Put(A(i)(j));
Put(" ");
end loop;
New_Line(1);
end loop;
end Matrix_Output;
--Adds the vector A to the vector B
function Vector_Add (A,B: in Vector; num: in integer) return Vector is
C: Vector;
s, f: integer;
begin
Vector_Fill(C,0);
Find_Borders(s,f,num);
for i in s..f loop
C(i):=A(i)+B(i);
end loop;
return C;
end Vector_Add;
--Adds the matrix A to the matrix B
function Matrix_Add (A,B: in Matrix; num: in integer) return Matrix is
C: Matrix;
s, f: integer;
begin
Matrix_Fill(C,0);
Find_Borders(s,f,num);
for i in s..f loop
for j in 1..n loop
C(i)(j):= A(i)(j)+B(i)(j);
end loop;
end loop;
return C;
end Matrix_Add;
--Multiply Matrix
function Matrix_Multiply (A,B: in Matrix; num: in integer) return Matrix is
C: Matrix;
s, f: integer;
begin
Matrix_Fill(C,0);
Find_Borders(s,f,num);
for i in s..f loop
for j in 1..n loop
C(i)(j):=0;
for k in 1..n loop
C(i)(j):=C(i)(j)+A(i)(k)*B(k)(j);
end loop;
end loop;
end loop;
return C;
end Matrix_Multiply;
--Multiply Vector on Matrix
function Matrix_Vector_Multiply (A: in Matrix; B: in Vector; num: in integer) return Vector is
C: Vector;
s, f: integer;
begin
Vector_Fill(C,0);
Find_Borders(s,f,num);
for i in s..f loop
C(i):=0;
for j in 1..n loop
C(i):=C(i)+A(j)(i)*B(i);
end loop;
end loop;
return C;
end Matrix_Vector_Multiply;
--Multiply Matrix on Number
function Matrix_Number_Multiply (A: in Matrix; B,num: in integer) return Matrix is
C: Matrix;
s, f: integer;
begin
Matrix_Fill(C,0);
Find_Borders(s,f,num);
for i in s..f loop
for j in 1..n loop
C(i)(j):= A(i)(j)*B;
end loop;
end loop;
return C;
end Matrix_Number_Multiply;
--Calculating Func1
--d=((A+B)*(C*(MA*ME)))
procedure Func(A: out Vector; B,C: in Vector;MO,MK,MR: in Matrix; d: in Integer; num: in integer) is
Res: Vector;
s, f: integer;
begin
Find_Borders(s,f,num);
Res:= Matrix_Vector_Multiply(Matrix_Add(MO,Matrix_Number_Multiply(Matrix_Multiply(MK,MR,num),d,num),num),Vector_Add(B,C,num),num);
for i in s..f loop
A(i):= Res(i);
end loop;
end Func;
end Data;
|
src/test/ref/ptrtestmin.asm | jbrandwood/kickc | 2 | 243429 | // Test all types of pointers
// Commodore 64 PRG executable file
.file [name="ptrtestmin.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.segment Code
main: {
// A constant pointer
.label SCREEN = $400
lda #0
ldx #2
__b1:
// while(i<10)
cpx #$a
bcc __b2
// SCREEN[999] = b
sta SCREEN+$3e7
// }
rts
__b2:
// b = SCREEN[i++]
lda SCREEN,x
// b = SCREEN[i++];
inx
jmp __b1
}
|
Pro3.asm | lestersantos/Assembly2019 | 0 | 2610 | <filename>Pro3.asm
org 100h
;============= muestra el mensaje inicial ==============
%macro print 1
push ax
push dx
mov dx, %1
mov ah, 09h
int 21h
pop dx
pop ax
%endmacro
%macro setvideo 1
mov ah, 00h
mov al, %1
int 10h
%endmacro
;pintar un pixel
%macro pixel 3
push ax
push bx
push dx
push di
mov ax, %3
mov bx, 140h
mul bx
add ax, %2
mov di, ax
mov es, word[vga]
mov ax, %1
mov[es:di], ax
pop di
pop dx
pop bx
pop ax
%endmacro
;pintar un area
%macro pixelarea 5
push ax
push bx
push si
push di
mov si, %2
mov bx, si
add bx, %3
%%x:
cmp si, bx
je %%finx
mov di, %4
mov ax, di
add ax, %5
%%y:
cmp di, ax
je %%finy
pixel %1, si, di
inc di
jmp %%y
%%finy:
inc si
jmp %%x
%%finx:
pop si
pop di
pop bx
pop ax
%endmacro
;dibujar el carro, y agregarle a los lados uncontorno negro
;para que la moverce se borre automaticamente
%macro print_car 1
push ax
push cx
xor cx, cx;
mov cl, %1;
; pixlearea color,x,ancho,y,alto
pixelarea 0h, cx, 5, 080h, 35
add cl, 5
pixelarea 0h, cx, 5, 080h, 35
pixelarea 7h, cx, 5, 085h, 8
pixelarea 7h, cx, 5, 095h, 8
add cl, 5
pixelarea 01h, cx, 20, 080h, 35
add cl, 20
pixelarea 0h, cx, 5, 080h, 35
pixelarea 7h, cx, 5, 085h, 8
pixelarea 7h, cx, 5, 095h, 8
add cl, 5
pixelarea 0h, cx, 5, 080h, 35
pop cx
pop ax
%endmacro
; tambien tienen que llevar un controno negro
%macro print_ob 3
push ax
push cx
pixelarea %1, %2, 10, %3, 10
pop cx
pop ax
%endmacro
%macro sleep 1
push si
mov si, %1
%%b1:
dec si
jnz %%b1
pop si
%endmacro
%macro sleep2 1
push si
push di
mov si, %1
%%b1:
mov di, %1
%%b2:
dec di
jne %%b2
dec si
jnz %%b1
pop di
pop si
%endmacro
%macro printchar 3
push ax
push bx
push dx
push cx
mov bh,00h
mov dx,%2
mov ah,02h
int 10h
mov al, %1
mov bh, 00h
mov bl, 0fh
mov ah, 09h
mov cx, %3
int 10h
pop cx
pop dx
pop bx
pop ax
%endmacro
%macro getchar 1
; devuelve el contenido en ax
push bx
push dx
push cx
mov bh,00h
mov dx,%1
mov ah,02h
int 10h
mov ah, 08h
int 10h
pop cx
pop dx
pop bx
%endmacro
%macro printin 2
push ax
push bx
push dx
mov bh,00h
mov dx,%2
mov ah,02h
int 10h
mov dx, %1
mov ah, 09h
int 21h
pop dx
pop bx
pop ax
%endmacro
menu:
setvideo 2h
call clean
printin mnu, 10ah
print msg3
print msg5
print msg6
;=============================== menu ==============================
mov ah, 01h
int 21h
sub al, 30h
cmp al, 1h
je op1
cmp al, 2h
je op3
jmp def
op1:
jmp susses
call clean
op3:
mov ah, 4Ch
int 21h
def:
jmp menu
;================================== Juego ================================
susses:
setvideo 13h
pixel 14,160,100
; pintar el cuadro verde
;pixlearea color,x,ancho,y,alto
pixelarea 2h, 0bh, 5h, 10h, 150
pixelarea 2h, 0bh, 160, 0bh, 5
;pixelarea 1h, 10h, 150, 10h, 150
pixelarea 2h, 0a6h, 5h, 10h, 150
pixelarea 2h, 0bh, 160, 0a6h, 5
mov al, [dir]
;pintar inicial mente el carro
print_car al
.while:
; leer el teclado
call keystatus
; manejar los obstaculos(no programado)
call obstacles
; retarndo general
sleep 100h
jmp .while
jmp menu
;this part of code tell when a key is pressed
keystatus:
;lee si se ha presionado una tecla o no
mov ah, 01h
int 16h
je .return
;si se presiona una tecla lee que tecla se ha presionado
;las teclas de direccion son combinaciones de dos teclas por eso se lee dos
;veces la tecla que se presiono
.keypress:
mov ah, 08h
int 21h
mov ah, 08h
int 21h
cmp al, 1bh
je fin
cmp al, 4bh
je .movleft
cmp al, 4dh
je .movright
;segun la tecla que se presiono se elije una accion
.movleft:
mov al, [dir]
sub al, 5h
;si sale de los limites del escenario no permite el movimiento
cmp al, 11h
jb .return
mov [dir], al
print_car al
jmp .return
.movright:
mov al, [dir]
add al, 5h
;lo mismo si sale de los limites nel perro
cmp al, 07eh
ja .return
mov [dir], al
print_car al
je .return
mov al, 01h
mov [dir], al
.return:
ret
obstacles:
; aqui se suponia que iba lo de los obstaculos, pero la cosa no coopera
.return:
ret
;=================== limpiar pantalla ==================
clean:
mov bh, 07h
mov cx,0000h
mov dx,194Fh
mov ax,0600h
int 10h
mov bh,00h
mov dx,00h
mov ah,02h
int 10h
ret
fin:
setvideo 2h
call clean
mov ah, 4Ch
int 21h
SEGMENT .data
dir db 20h,'$'
mnu db 'MENU',10,'$'
msg3 db ' 1.Jugar',10,'$'
msg5 db ' 3.Salir',10,'$'
charcl db ' ','$'
msg6 db ' >> ','$'
obs times 100 db '$'
red db 25, 100, 40, 120, 50
green db 30, 60,70, 40 , 100
vga dw 0a000h |
Build/Interpreters/beebOzmoo/asm/text.asm | polluks/Puddle-BuildTools | 38 | 8386 | ; text opcodes
;TRACE_READTEXT = 1
;TRACE_TOKENISE = 1
;TRACE_SHOW_DICT_ENTRIES = 1
;TRACE_PRINT_ARRAYS = 1
;SFTODODATA 2
!ifndef ACORN { ; SFTODO!?
.text_tmp !byte 0
.current_character !byte 0
}
.petscii_char_read = zp_temp
; only ENTER + cursor + F1-F8 possible on a C64
; SFTODO: It may be a good idea to tweak this to reflect the fact we have F1-F9 or F1-F10 on Acorn (depending on what the f0 key is mapped to), but I'll leave it alone for now until the handling of function keys settles down.
num_terminating_characters !byte 1
terminating_characters !byte $0d
!ifdef Z5PLUS {
!byte $81,$82,$83,$84,$85,$86,$87,$88,$89,$8a,$8b,$8c
parse_terminating_characters
; read terminating characters list ($2e)
; must be one of function keys 129-154, 252-254.
; 129-132: cursor u/d/l/r
; 133-144: F1-F12 (only F1-F8 on C64)
; 145-154: keypad 0-9 (not on C64 of course)
; 252 menu click (V6) (not C64)
; 253 double click (V6) (not C64)
; 254 single click (not C64)
; 255 means any function key
lda story_start + header_terminating_chars_table ; 5c
ldx story_start + header_terminating_chars_table + 1 ; 18
bne +
cmp #0
bne +
rts
+ jsr set_z_address
; read terminator
ldy #1
- jsr read_next_byte
cmp #$ff
bne +
; all function keys (already the default)
lda #$0d ; 13 keys in total (enter+cursor+F1-F8)
sta num_terminating_characters
rts
+ cmp #$8d ; F8=8c. Any higher values are not accepted in C64 mode
bpl +
sta terminating_characters,y
iny
+ cmp #$00
bne -
sty num_terminating_characters
rts
}
!ifdef BENCHMARK {
; SFTODO +make_acorn_screen_hole
; SFTODO: Annoying duplication here...
benchmark_commands
!ifndef ACORN {
; !pet "turn statue w:turn it e:turn it n:n:open door:",255,0
!pet 255,"turn statue w:turn it e:turn it n:n:open door:n:turn flashlight on:n:examine model:press green:g:g:press black:g:press white:g:press green:g:g:press black:press blue:press green:g:g:g:press red:g:g:take ring:e:e:take yellow card:s:take slide:put it in slide projector:turn slide projector on:focus slide projector:take film:examine film projector:remove cap:drop it:put film in film projector:turn film projector on:examine screen:n:w:w:s:e:e:examine piano:open lid:take violet card:play tomorrow:push piano n:d:s:take dirty pillar:n:u:push piano s:g:d:n:take meter:s:u:drop pillar:w:w:w:drop ring:drop meter:e:drop yellow and violet:n:drop letter and photo:s:w:enter fireplace:take brick and drop it:u:u:u:e:d:take penguin:u:w:d:d:d:take indigo card:e:drop penguin:e:drop indigo:w:examine red statue:examine white statue:examine blue statue:e:e:move painting:take green card:examine safe:turn dial right 3:turn dial left 7:turn dial right 5:open safe:take grater:w:drop green:w:drop grater:e:open closet:enter closet:pull third peg:open door:n:examine newel:turn newel:e:take sack:open window:open sack:take finch:drop sack:w:w:s:move mat:take red card:n:e:s:pull second peg:open door:n:drop red:w:drop finch:e:enter closet:take bucket:n:n:unlock patio door:open door:n:take orange card:e:n:n:examine cannon:fill bucket with water:e:s:w:s:s:enter closet:hang bucket on third peg:n:u:open closet:s:wait:wait:open door:n:open panel:open trunk:take hydrant:d:d:w:drop hydrant:e:take all:n:w:w:d:open door:s:take blue card:n:turn computer on:examine it:put red in slot:put yellow in slot:put orange in slot:put green in slot:put blue in slot:put indigo in slot:put violet in slot:examine display:u:take matchbox:open it:take match:drop matchbox:e:e:n:e:n:n:take cannon ball:put it in cannon:light match:light fuse:open compartment:take mask:e:s:w:s:s:w:drop mask:e:s:open mailbox:take yellowed piece of paper:take card:examine card:drop card:n:n:w:take thin:e:n:n:nw:take shovel:ne:n:put thin on yellowed:n:w:n:w:n:w:s:w:w:n:w:s:e:s:e:n:e:s:w:n:w:s:w:n:w:s:w:n:e:n:e:n:e:e:n:e:s:e:e:s:e:n:e:n:e:s:w:s:w:s:e:n:w:s:dig ground with shovel:take stamp:n:e:s:w:n:e:n:e:n:w:s:w:s:w:n:w:w:n:w:s:w:w:s:w:s:w:s:e:n:e:s:e:n:e:s:e:n:w:s:w:n:w:n:e:s:e:e:n:e:s:e:s:e:s:w:s:e:s:s:w:drop stamp:e:drop all except flashlight:w:take red statuette:e:u:open door:enter closet:take skis:n:d:n:n:e:n:n:n:drop flashlight:s:e:e:wear skis:n:take match:light red statue:put wax on match:take skis off:swim:s:d:d:w:u:u:n:n:u:light match:light red statue:lift left end of plank:pull chain:burn rope:stand on right end of plank:wait:blow statue out:drop skis:drop statue:take ladder and flashlight:d:hang ladder on hooks:examine safe:turn dial left 4:turn dial right 5:turn dial left 7:open safe:take film:u:s:e:s:w:s:s:w:drop film:call 576-3190:n:w:d:take toupee:take peg and note:read note:u:e:e:s:u:s:put peg in hole:get gun:shoot herman:get sword:kill herman with sword:get shears:kill herman with shears:untie hildegarde:",255,0
} else {
!text 255,"turn statue w:turn it e:turn it n:n:open door:n:turn flashlight on:n:examine model:press green:g:g:press black:g:press white:g:press green:g:g:press black:press blue:press green:g:g:g:press red:g:g:take ring:e:e:take yellow card:s:take slide:put it in slide projector:turn slide projector on:focus slide projector:take film:examine film projector:remove cap:drop it:put film in film projector:turn film projector on:examine screen:n:w:w:s:e:e:examine piano:open lid:take violet card:play tomorrow:push piano n:d:s:take dirty pillar:n:u:push piano s:g:d:n:take meter:s:u:drop pillar:w:w:w:drop ring:drop meter:e:drop yellow and violet:n:drop letter and photo:s:w:enter fireplace:take brick and drop it:u:u:u:e:d:take penguin:u:w:d:d:d:take indigo card:e:drop penguin:e:drop indigo:w:examine red statue:examine white statue:examine blue statue:e:e:move painting:take green card:examine safe:turn dial right 3:turn dial left 7:turn dial right 5:open safe:take grater:w:drop green:w:drop grater:e:open closet:enter closet:pull third peg:open door:n:examine newel:turn newel:e:take sack:open window:open sack:take finch:drop sack:w:w:s:move mat:take red card:n:e:s:pull second peg:open door:n:drop red:w:drop finch:e:enter closet:take bucket:n:n:unlock patio door:open door:n:take orange card:e:n:n:examine cannon:fill bucket with water:e:s:w:s:s:enter closet:hang bucket on third peg:n:u:open closet:s:wait:wait:open door:n:open panel:open trunk:take hydrant:d:d:w:drop hydrant:e:take all:n:w:w:d:open door:s:take blue card:n:turn computer on:examine it:put red in slot:put yellow in slot:put orange in slot:put green in slot:put blue in slot:put indigo in slot:put violet in slot:examine display:u:take matchbox:open it:take match:drop matchbox:e:e:n:e:n:n:take cannon ball:put it in cannon:light match:light fuse:open compartment:take mask:e:s:w:s:s:w:drop mask:e:s:open mailbox:take yellowed piece of paper:take card:examine card:drop card:n:n:w:take thin:e:n:n:nw:take shovel:ne:n:put thin on yellowed:n:w:n:w:n:w:s:w:w:n:w:s:e:s:e:n:e:s:w:n:w:s:w:n:w:s:w:n:e:n:e:n:e:e:n:e:s:e:e:s:e:n:e:n:e:s:w:s:w:s:e:n:w:s:dig ground with shovel:take stamp:n:e:s:w:n:e:n:e:n:w:s:w:s:w:n:w:w:n:w:s:w:w:s:w:s:w:s:e:n:e:s:e:n:e:s:e:n:w:s:w:n:w:n:e:s:e:e:n:e:s:e:s:e:s:w:s:e:s:s:w:drop stamp:e:drop all except flashlight:w:take red statuette:e:u:open door:enter closet:take skis:n:d:n:n:e:n:n:n:drop flashlight:s:e:e:wear skis:n:take match:light red statue:put wax on match:take skis off:swim:s:d:d:w:u:u:n:n:u:light match:light red statue:lift left end of plank:pull chain:burn rope:stand on right end of plank:wait:blow statue out:drop skis:drop statue:take ladder and flashlight:d:hang ladder on hooks:examine safe:turn dial left 4:turn dial right 5:turn dial left 7:open safe:take film:u:s:e:s:w:s:s:w:drop film:call 576-3190:n:w:d:take toupee:take peg and note:read note:u:e:e:s:u:s:put peg in hole:get gun:shoot herman:get sword:kill herman with sword:get shears:kill herman with shears:untie hildegarde:",255,0
}
benchmark_read_char
lda benchmark_commands
beq +++
inc benchmark_read_char + 1
bne +
inc benchmark_read_char + 2
+ cmp #255
beq ++
sta .petscii_char_read
jsr translate_petscii_to_zscii
+++ rts
++ jsr dollar
!ifndef ACORN {
lda $a0
jsr print_byte_as_hex
lda $a1
jsr print_byte_as_hex
lda $a2
} else {
jsr kernal_readtime
pha
tya
jsr print_byte_as_hex
txa
jsr print_byte_as_hex
pla
}
jsr print_byte_as_hex
jsr space
jsr printchar_flush
lda #13
rts
}
z_ins_print_char
; lda #0
; sta alphabet_offset
; sta escape_char_counter
; sta abbreviation_command
lda z_operand_value_low_arr
; jsr invert_case
; jsr translate_zscii_to_petscii
jmp streams_print_output
z_ins_new_line
lda #13
jmp streams_print_output
!ifdef Z4PLUS {
z_ins_read_char
; read_char 1 [time routine] -> (result)
; ignore argument 0 (always 1)
; ldy z_operand_value_low_arr
; optional time routine arguments
jsr printchar_flush
jsr turn_on_cursor
ldy #0
tya
sty .read_text_time
sty .read_text_time + 1
ldy z_operand_count
cpy #3
bne .read_char_loop
ldy z_operand_value_high_arr + 1
sty .read_text_time
ldy z_operand_value_low_arr + 1
sty .read_text_time + 1
ldy z_operand_value_high_arr + 2
sty .read_text_routine
ldy z_operand_value_low_arr + 2
sty .read_text_routine + 1
!ifndef ACORN {
!ifdef USE_BLINKING_CURSOR {
jsr init_cursor_timer
}
}
jsr init_read_text_timer
.read_char_loop
jsr read_char
cmp #0
beq .read_char_loop ; timer routine returned false
pha
jsr turn_off_cursor
; lda current_window
; bne .no_need_to_start_buffering
; lda is_buffered_window
; beq .no_need_to_start_buffering
jsr start_buffering
; .no_need_to_start_buffering
pla
cmp #1
bne +
lda #0 ; time routine returned true, and read_char should return 0
+ tax
lda #0
jmp z_store_result
}
!ifdef Z5PLUS {
z_ins_tokenise_text
; tokenise text parse dictionary flag
; setup string_array
ldx z_operand_value_low_arr
lda z_operand_value_high_arr
stx string_array
clc
adc #>story_start
sta string_array + 1
; setup user dictionary, if supplied
lda z_operand_count
cmp #3
bcc .no_user_dictionary
ldx z_operand_value_low_arr + 2
txa
ora z_operand_value_high_arr + 2
beq .no_user_dictionary
; user dictionary
lda z_operand_value_high_arr + 2 ; X is already set
jsr parse_user_dictionary
jmp .tokenise_main
.no_user_dictionary
; Setup default dictionary
lda dict_is_default
bne +
jsr parse_default_dictionary
+
.tokenise_main
; setup parse_array and flag
ldy #0
lda z_operand_count
cmp #4
bcc .flag_set
ldy z_operand_value_low_arr + 3
.flag_set
ldx z_operand_value_low_arr + 1
lda z_operand_value_high_arr + 1
jmp tokenise_text
; SFTODO +make_acorn_screen_hole
z_ins_encode_text
; encode_text zscii-text length from coded-text
; setup string_array
ldx z_operand_value_low_arr
lda z_operand_value_high_arr
stx string_array
clc
adc #>story_start
sta string_array + 1
; setup length (seems okay to ignore)
; ldx z_operand_value_low_arr + 1
; setup from
ldx z_operand_value_low_arr + 2
stx .wordstart
; do the deed
jsr encode_text
; save result
ldx z_operand_value_low_arr + 3
lda z_operand_value_high_arr + 3
stx string_array
clc
adc #>story_start
sta string_array + 1
ldy #0
- lda zword,y
sta (string_array),y
iny
cpy #6
bne -
rts
}
z_ins_print_addr
ldx z_operand_value_low_arr
lda z_operand_value_high_arr
jsr set_z_address
jmp print_addr
z_ins_print_paddr
; Packed address is now in (z_operand_value_high_arr, z_operand_value_low_arr)
lda z_operand_value_high_arr
ldx z_operand_value_low_arr
jsr set_z_paddress
jmp print_addr
z_ins_print
ldy z_pc
lda z_pc + 1
ldx z_pc + 2
jsr set_z_himem_address
jsr print_addr
jsr get_z_himem_address
stx zp_temp
tax
tya
ldy zp_temp
jmp set_z_pc
z_ins_print_ret
jsr z_ins_print
lda #$0d
jsr streams_print_output
lda #0
ldx #1
jmp stack_return_from_routine
; ============================= New unified read instruction
z_ins_read
; z3: sread text parse
; z4: sread text parse time routine
; z5: aread text parse time routine -> (result)
jsr printchar_flush
!ifdef ACORN_CURSOR_PASS_THROUGH {
!ifdef ACORN_CURSOR_EDIT_READ {
; Since we're reading a line of text here, we temporarily re-enable cursor
; editing.
jsr do_osbyte_set_cursor_editing_x_0
}
}
!ifdef Z3 {
; Z1 - Z3 should redraw the status line before input
jsr draw_status_line
}
!ifdef Z4PLUS {
; arguments that need to be copied to their own locations because there *may* be a timed interrupt call
ldx z_operand_count
stx .read_text_operand_count
ldy z_operand_value_low_arr + 1
sty .read_parse_buffer
ldy z_operand_value_high_arr + 1
sty .read_parse_buffer + 1
lda #0
tay
cpx #3
bcc + ; time and routine are omitted
ldy z_operand_value_high_arr + 3
sty .read_text_routine
ldy z_operand_value_low_arr + 3
sty .read_text_routine + 1
lda z_operand_value_high_arr + 2
ldy z_operand_value_low_arr + 2
+ sta .read_text_time
sty .read_text_time + 1
}
; Read input
lda z_operand_value_high_arr
ldx z_operand_value_low_arr
jsr read_text
!ifdef TRACE_READTEXT {
jsr print_following_string
!ifndef ACORN {
!pet "read_text ",0
} else {
!text "read_text ",0
}
ldx z_operand_value_low_arr
lda z_operand_value_high_arr
jsr printx
jsr space
jsr printa
jsr colon
ldx string_array
lda string_array+1
jsr printx
jsr space
jsr printa
!ifdef Z5PLUS {
jsr colon
lda .read_text_return_value
jsr printa
}
jsr newline
ldy #0
- lda (string_array),y
jsr printa
jsr space
iny
cpy #10
bne -
jsr newline
}
!ifdef Z5PLUS {
; parse it as well? In Z5, this can be avoided by setting parse to 0
ldx .read_text_operand_count
cpx #2
bcc .read_done
lda .read_parse_buffer
ora .read_parse_buffer + 1
beq .read_done
; Setup default dictionary
lda dict_is_default
bne +
jsr parse_default_dictionary
+
}
!ifdef Z3 {
lda z_operand_value_high_arr + 1
ldx z_operand_value_low_arr + 1
} else {
lda .read_parse_buffer + 1
ldx .read_parse_buffer
}
ldy #0
jsr tokenise_text
!ifdef TRACE_TOKENISE {
ldy #0
- lda (parse_array),y
jsr printa
jsr space
iny
cpy #10
bne -
jsr newline
}
.read_done
!ifdef ACORN_CURSOR_PASS_THROUGH {
!ifdef ACORN_CURSOR_EDIT_READ {
ldx #1
jsr do_osbyte_set_cursor_editing
}
}
jsr start_buffering
; debug - print parsearray
!ifdef TRACE_PRINT_ARRAYS {
ldy #0
- lda (string_array),y
tax
jsr printx
lda #$20
jsr streams_print_output
iny
cpy #12
bne -
lda #$0d
jsr streams_print_output
ldy #0
- lda (parse_array),y
tax
jsr printx
lda #$20
jsr streams_print_output
iny
cpy #16
bne -
lda #$0d
jsr streams_print_output
}
!ifdef DEBUG {
!ifdef PREOPT {
jsr print_following_string
!raw "[preopt mode. type xxx to exit early.]",13,0
!ifdef Z5PLUS {
ldy #2
} else {
ldy #1
}
.check_next_preopt_exit_char
lda (string_array),y
cmp #$78
bne .not_preopt_exit
iny
!ifdef Z5PLUS {
cpy #5
} else {
cpy #4
}
bne .check_next_preopt_exit_char
; Exit PREOPT mode
ldx #1
jmp print_optimized_vm_map
.not_preopt_exit
}
}
!ifdef Z5PLUS {
lda #0
ldx .read_text_return_value
jmp z_store_result
} else {
rts
}
; ============================= End of new unified read instruction
!ifdef Z5PLUS {
z_ins_check_unicode
lda #0
tax
jmp z_store_result
z_ins_print_unicode
lda #$28 ; (
jsr streams_print_output
lda #$23 ; #
jsr streams_print_output
jsr print_num_unsigned
lda #$29 ; )
jmp streams_print_output
}
convert_zchar_to_char
; input: a=zchar
; output: a=char
; side effects:
; used registers: a,y
cmp #$20
beq +++
cmp #6
bcc +++
sec
sbc #6
clc
adc alphabet_offset
tay
lda (alphabet_table),y
+++ rts
translate_petscii_to_zscii
ldx #character_translation_table_in_end - character_translation_table_in - 1
- cmp character_translation_table_in,x
bcc .no_match
beq .translation_match
dex
dex
bpl -
.no_match
; cmp #$60
; bcc .no_shadow
; cmp #$80
; bcs .no_shadow
; eor #$a0
; .no_shadow
!ifndef ACORN {
cmp #$41
bcc .case_conversion_done
cmp #$5b
bcs .not_lower_case
; Lower case. $41 -> $61
ora #$20
bcc .case_conversion_done
.not_lower_case
cmp #$c1
bcc .case_conversion_done
cmp #$db
bcs .case_conversion_done
; Upper case. $c1 -> $41
and #$7f
.case_conversion_done
}
rts
.translation_match
dex
lda character_translation_table_in,x
rts
convert_char_to_zchar
; input: a=char
; output: store zchars in z_temp,x. Increase x. Exit if x >= ZCHARS_PER_ENTRY
; side effects:
; used registers: a,x
; NOTE: This routine can't convert space (code 0) or newline (code 7 in A2) properly, but there's no need to either.
; jsr translate_petscii_to_zscii
sty zp_temp + 4
ldy #0
- cmp (alphabet_table),y
beq .found_char_in_alphabet
iny
cpy #26*3
bne -
; Char is not in alphabet
pha
lda #5
sta z_temp,x
inx
lda #6
sta z_temp,x
inx
pla
pha
lsr
lsr
lsr
lsr
lsr
sta z_temp,x
pla
and #%00011111
inx
bne .store_last_char ; Always branch
; tax
; !ifdef DEBUG {
; jsr printx
; }
; lda #ERROR_INVALID_CHAR
; jsr fatalerror
.found_char_in_alphabet
cpy #26
bcc .found_in_a0
lda #4 ; Shift to A1
cpy #26*2
bcc .found_in_a1
lda #5 ; Shift to A2
.found_in_a1
; stx zp_temp + 3
; ldx zp_temp + 4
sta z_temp,x
inx
sty zp_temp + 2 ; Remember old Y value
tay ; Holds 4 for A1 or 5 for A2
lda zp_temp + 2
- sec
sbc #26
dey
cpy #4
bcs -
; ldy zp_temp + 2 ; Restore old Y value
tay
.found_in_a0
tya
clc
adc #6
; ldx zp_temp + 4
.store_last_char
sta z_temp,x
inx
.convert_return
ldy zp_temp + 4
rts
.first_word = z_temp ; !byte 0,0
.last_word = z_temp + 2 ; !byte 0,0
.median_word = z_temp + 4 ; !byte 0,0
.final_word = zp_temp; !byte 0
.is_word_found = zp_temp + 1 ; !byte 0
.triplet_counter = zp_temp + 2; !byte 0
; SFTODODATA 2
.last_char_index !byte 0
.parse_array_index !byte 0
.dictionary_address = zp_temp + 3 ; !byte 0,0
; .zword !byte 0,0,0,0,0,0
!ifdef Z4PLUS {
ZCHARS_PER_ENTRY = 9
} else {
ZCHARS_PER_ENTRY = 6
}
ZCHAR_BYTES_PER_ENTRY = ZCHARS_PER_ENTRY * 2 / 3
ZWORD_OFFSET = 6 - ZCHAR_BYTES_PER_ENTRY
encode_text
; input .wordstart
; registers: a,x,y
; side effects: .last_char_index, .triplet_counter, zword
ldy .wordstart ; Pointer to current character
ldx #0 ; Next position in z_temp
- lda (string_array),y
jsr convert_char_to_zchar
cpx #ZCHARS_PER_ENTRY
bcs .done_converting_to_zchars
iny
cpy .wordend
bcc -
; Pad rest of word
lda #5 ; Pad character
- sta z_temp,x
inx
cpx #ZCHARS_PER_ENTRY
bcc -
.done_converting_to_zchars
ldx #0 ; x = start of current triplet
ldy #0 ; Pointer to next character in buffer
- lda z_temp,y
sta zword + ZWORD_OFFSET,x
iny
lda z_temp,y
asl
asl
asl
asl
rol zword + ZWORD_OFFSET,x
asl
rol zword + ZWORD_OFFSET,x
iny
ora z_temp,y
sta zword + ZWORD_OFFSET + 1,x
iny
inx
inx
cpx #(2 * (ZCHARS_PER_ENTRY / 3))
bcc -
lda zword + 4
ora #$80
sta zword + 4
rts
; SFTODO +make_acorn_screen_hole
find_word_in_dictionary
; convert word to zchars and find it in the dictionary
; see: http://inform-fiction.org/zmachine/standards/z1point1/sect13.html
; http://inform-fiction.org/manual/html/s2.html#s2_5
; input:
; y = index in parse_array to store result in
; parse_array = indirect address to parse_array
; string_array = indirect address to string being parsed
; .wordstart = index in string_array to first char of current word
; .wordend = index in string_array to last char of current word
; output: puts address in parse_array[y] and parse_array[y+1]
; side effects:
; used registers: a,x
sty .parse_array_index ; store away the index for later
; lda #0
; ldx #5
; - sta .zword,x ; clear zword buffer
; dex
; bpl -
lda #1
sta .is_word_found ; assume success until proven otherwise
jsr encode_text
!ifdef TRACE_TOKENISE {
; print zword (6 or 9 bytes)
jsr newline
ldx zword
jsr printx
jsr comma
ldx zword + 1
jsr printx
jsr comma
ldx zword + 2
jsr printx
jsr comma
ldx zword + 3
jsr printx
jsr comma
ldx zword + 4
jsr printx
jsr comma
ldx zword + 5
jsr printx
jsr newline
}
; find entry in dictionary, using binary search
; Step 1: Set start and end of dictionary
lda #0
sta .final_word
sta .first_word
sta .first_word + 1
lda dict_num_entries + 1 ; This is stored High-endian
tax
ora dict_num_entries ; This is stored High-endian
bne +
jmp .no_entry_found
+ txa
sec
sbc #1
sta .last_word
lda dict_num_entries
sbc #0
sta .last_word + 1
!ifdef Z5PLUS {
lda dict_ordered
bne .loop_check_next_entry
jmp .find_word_in_unordered_dictionary
}
; Step 2: Calculate the median word
.loop_check_next_entry
lda .last_word
cmp .first_word
bne .more_than_one_word
ldx .last_word + 1
cpx .first_word + 1
bne .more_than_one_word
; This is the last possible word that can match
dec .final_word ; Signal that this is the last possible word
.more_than_one_word
sec
sbc .first_word
tax
lda .last_word + 1
sbc .first_word + 1
lsr
tay
txa
ror
clc
adc .first_word
sta .median_word
sta multiplicand
tya
adc .first_word + 1
sta .median_word + 1
sta multiplicand + 1
; Step 3: Set the address of the median word
lda dict_len_entries
sta multiplier
lda #0
sta multiplier + 1
jsr mult16
lda product
clc
adc dict_entries
tax
lda product + 1
adc dict_entries + 1
sta .dictionary_address
stx .dictionary_address + 1
jsr set_z_address
; show the dictonary word
!ifdef TRACE_SHOW_DICT_ENTRIES {
jsr dollar
lda .dictionary_address
jsr print_byte_as_hex
lda .dictionary_address + 1
jsr print_byte_as_hex
; lda z_address + 2
; jsr print_byte_as_hex
jsr space
; jsr pause
lda z_address + 1
pha
lda z_address + 2
pha
; lda z_address+1
; jsr printa
; jsr comma
; lda z_address+2
; jsr printa
jsr print_addr
pla
sta z_address + 2
pla
sta z_address + 1
}
; check if correct entry
ldy #0
.loop_check_entry
jsr read_next_byte
; !ifdef TRACE_SHOW_DICT_ENTRIES {
; jsr printa
; jsr space
; }
!ifdef Z4PLUS {
cmp zword,y
} else {
cmp zword + 2,y
}
bne .zchars_differ
iny
cpy #ZCHAR_BYTES_PER_ENTRY
bne .loop_check_entry
beq .found_dict_entry ; Always branch
.zchars_differ
php
lda .final_word
beq .not_final_word
plp
bne .no_entry_found ; Always branch
.not_final_word
plp
bcs .larger_than_sought_word
; The median word is smaller than the sought word
!ifdef TRACE_SHOW_DICT_ENTRIES {
lda #60
jsr streams_print_output
jsr newline
}
lda .median_word
clc
adc #1
sta .first_word
lda .median_word + 1
adc #0
sta .first_word + 1
jmp .loop_check_next_entry ; Always branch
.larger_than_sought_word
; The median word is larger than the sought word
!ifdef TRACE_SHOW_DICT_ENTRIES {
lda #62
jsr streams_print_output
jsr newline
}
lda .median_word
cmp .first_word
bne .median_is_not_first
ldy .median_word + 1
cpy .first_word + 1
beq .no_entry_found
.median_is_not_first
sec
sbc #1
sta .last_word
lda .median_word + 1
sbc #0
sta .last_word + 1
jmp .loop_check_next_entry ; Always branch
; no entry found
.no_entry_found
!ifdef TRACE_SHOW_DICT_ENTRIES {
lda #60
jsr streams_print_output
lda #62
jsr streams_print_output
jsr newline
}
lda #0
sta .dictionary_address
sta .dictionary_address + 1
sta .is_word_found
lda .ignore_unknown_words
beq .store_find_result
ldy .parse_array_index
iny
iny
rts
; After adding an rts above, the following code can't be reached anyway.
;!ifdef TRACE_SHOW_DICT_ENTRIES {
; beq .store_find_result ; Only needed if TRACE_SHOW_DICT_ENTRIES is set
;}
.found_dict_entry
; store result into parse_array and exit
!ifdef TRACE_SHOW_DICT_ENTRIES {
lda #61
jsr streams_print_output
jsr newline
}
.store_find_result
ldy .parse_array_index
lda .dictionary_address
sta (parse_array),y
iny
lda .dictionary_address + 1
sta (parse_array),y
iny
rts
!ifdef Z5PLUS {
.find_word_in_unordered_dictionary
; In the end, jump to either .found_dict_entry or .no_entry_found
ldx dict_entries
stx .dictionary_address + 1 ; Stored with high-byte first!
lda dict_entries + 1
sta .dictionary_address ; Stored with high-byte first!
.unordered_check_next_word
jsr set_z_address
; check if correct entry
ldy #0
.unordered_loop_check_entry
jsr read_next_byte
!ifdef Z4PLUS {
cmp zword,y
} else {
cmp zword + 2,y
}
bne .unordered_not_a_match
iny
cpy #ZCHAR_BYTES_PER_ENTRY
bne .unordered_loop_check_entry
beq .found_dict_entry ; Always branch
.unordered_not_a_match
inc .first_word
bne +
inc .first_word + 1
+ lda .last_word
cmp .first_word
lda .last_word + 1
sbc .first_word + 1
bcc + ; No more words to check
lda .dictionary_address + 1
clc
adc dict_len_entries
tax
sta .dictionary_address + 1
lda .dictionary_address
adc #0
sta .dictionary_address
bcc .unordered_check_next_word ; Always branch
+ bcs .no_entry_found ; Always branch
} ; End of !ifdef Z5PLUS
!ifndef ACORN {
!ifdef USE_BLINKING_CURSOR {
init_cursor_timer
lda #0
sta s_cursormode
; calculate timer interval in jiffys (1/60 second NTSC, 1/50 second PAL)
sta .cursor_time_jiffy
sta .cursor_time_jiffy + 1
lda USE_BLINKING_CURSOR
sta .cursor_time_jiffy + 2
update_cursor_timer
; calculate when the next cursor update occurs
jsr kernal_readtime ; read current time (in jiffys)
clc
adc .cursor_time_jiffy + 2
sta .cursor_jiffy + 2
txa
adc .cursor_time_jiffy + 1
sta .cursor_jiffy + 1
tya
adc .cursor_time_jiffy
sta .cursor_jiffy
rts
}
}
!ifdef Z4PLUS {
init_read_text_timer
lda .read_text_time
ora .read_text_time + 1
bne +
rts ; no timer
+ ; calculate timer interval in jiffys (1/60 second NTSC, 1/50 second PAL)
lda .read_text_time
sta multiplier + 1
lda .read_text_time + 1
sta multiplier
lda #0
sta multiplicand + 1
!ifndef ACORN {
lda #6
} else {
lda #5 ; our kernal_readtime uses 1/50 second jiffys
}
sta multiplicand ; t*6 to get jiffies
jsr mult16
lda product
sta .read_text_time_jiffy + 2
lda product + 1
sta .read_text_time_jiffy + 1
lda product + 2
sta .read_text_time_jiffy
update_read_text_timer
; prepare time for next routine call (current time + time_jiffy)
jsr kernal_readtime ; read current time (in jiffys)
clc
adc .read_text_time_jiffy + 2
sta .read_text_jiffy + 2
txa
adc .read_text_time_jiffy + 1
sta .read_text_jiffy + 1
tya
adc .read_text_time_jiffy
sta .read_text_jiffy
rts
}
getchar_and_maybe_toggle_darkmode
!ifndef ACORN {
!ifdef NODARKMODE {
jmp kernal_getchar
} else {
jsr kernal_getchar
cmp #133
bne +
jsr toggle_darkmode
ldx #40 ; Side effect to help when called from MORE prompt
lda #0
+ rts
}
} else { ; ACORN
; In non-teletext modes, copying characters with COPY will only work if they
; share the current OS foreground and background colours. There's a fair
; chance the OS colours are still set to reverse video from drawing the
; status bar; s_printchar would set these correctly the next time it's
; called, but we need to make sure this is right now so COPY works. (We
; can't make this work perfectly if the game mixes normal and reverse video
; a lot, but this will fix things for the typical game anyway.)
jsr s_reverse_to_os_reverse
!ifndef ACORN_OSRDCH {
lda #osbyte_read_key
ldx #0
jsr do_osbyte_y_0
bcc +
ldx #0
+ txa
} else {
; Some emulators (e.g. BeebEm 4.15) don't allow text to be pasted in unless
; it's read via OSRDCH, so we allow the use of OSRDCH as a workaround. This
; will break games which rely on timers being able to break into user
; input.
jsr osrdch
}
jmp check_user_interface_controls
}
read_char
; return: 0,1: return value of routine (false, true)
; any other number: char value
!ifdef BENCHMARK {
jsr benchmark_read_char
cmp #0
beq +
cmp #58 ; colon
bne ++
lda #13
++ rts
+
}
!ifndef ACORN {
!ifdef USE_BLINKING_CURSOR {
; check if time for to update the blinking cursor
; http://www.6502.org/tutorials/compare_beyond.html#2.2
jsr kernal_readtime ; read start time (in jiffys) in a,x,y (low to high)
cmp .cursor_jiffy + 2
txa
sbc .cursor_jiffy + 1
tya
sbc .cursor_jiffy
bcc .no_cursor_blink
; blink the cursor
;
; set up next time out
jsr update_cursor_timer
; cursor on/off depending on if s_cursormode is even/odd
lda #CURSORCHAR ; cursor on
sta cursor_character
jsr update_cursor
inc s_cursormode
lda s_cursormode
and #$01
beq .no_cursor_blink
lda #$20 ; blank space, cursor off
sta cursor_character
jsr update_cursor
.no_cursor_blink
}
}
!ifdef Z4PLUS {
; check if time for routine call
; http://www.6502.org/tutorials/compare_beyond.html#2.2
lda .read_text_time
ora .read_text_time + 1
beq .no_timer
jsr kernal_readtime ; read start time (in jiffys) in a,x,y (low to high)
cmp .read_text_jiffy + 2
txa
sbc .read_text_jiffy + 1
tya
sbc .read_text_jiffy
bcc .no_timer
.call_routine
; current time >= .read_text_jiffy. Time to call routine
jsr turn_off_cursor
lda .read_text_routine
sta z_operand_value_high_arr
ldx .read_text_routine + 1
stx z_operand_value_low_arr
lda #z_exe_mode_return_from_read_interrupt
ldx #0
ldy #0
jsr stack_call_routine
; let the interrupt routine start, so we need to rts.
jsr z_execute
; Restore buffering setting
; lda .text_tmp
; sta is_buffered_window
jsr printchar_flush
jsr turn_on_cursor
; Interrupt routine has been executed, with value in word
; z_interrupt_return_value
; set up next time out
jsr update_read_text_timer
; just return the value: 0 or 1 (true or false)
lda z_interrupt_return_value
ora z_interrupt_return_value + 1
beq +
lda #1
+ rts
}
.no_timer
jsr getchar_and_maybe_toggle_darkmode
cmp #$00
beq read_char
sta .petscii_char_read
jmp translate_petscii_to_zscii
!ifndef ACORN {
s_cursorswitch !byte 0
!ifdef USE_BLINKING_CURSOR {
s_cursormode !byte 0
}
turn_on_cursor
lda #1
sta s_cursorswitch
bne update_cursor ; always branch
turn_off_cursor
lda #0
sta s_cursorswitch
update_cursor
sty object_temp
ldy zp_screencolumn
lda s_cursorswitch
bne +
; no cursor
lda (zp_screenline),y
and #$7f
sta (zp_screenline),y
ldy object_temp
rts
+ ; cursor
lda cursor_character
sta (zp_screenline),y
lda current_cursor_colour
sta (zp_colourline),y
ldy object_temp
rts
}
!ifndef ACORN {
!ifdef USE_BLINKING_CURSOR {
reset_cursor_blink
; resets the cursor timer and blink mode
; effectively puts the cursor back on the screen for another timer duration
lda #$00
sta .cursor_jiffy
sta .cursor_jiffy + 1
sta .cursor_jiffy + 2
lda #$01
sta s_cursormode
rts
}
}
; SFTODO +make_acorn_screen_hole
read_text
; read line from keyboard into an array (address: a/x)
; See also: http://inform-fiction.org/manual/html/s2.html#p54
; input: a,x, .read_text_time (Z4PLUS), .read_text_routine (Z4PLUS)
; output: string_array, .read_text_return_value (Z5PLUS)
; side effects: zp_screencolumn, zp_screenline, .read_text_jiffy
; used registers: a,x,y
stx string_array
clc
adc #>story_start
sta string_array + 1
jsr printchar_flush
; clear [More] counter
jsr clear_num_rows
!ifndef ACORN {
!ifdef USE_BLINKING_CURSOR {
jsr init_cursor_timer
}
}
!ifdef Z4PLUS {
; check timer usage
jsr init_read_text_timer
}
ldy #0
lda (string_array),y
!ifdef Z5PLUS {
tax
inx
stx .read_text_char_limit
} else {
sta .read_text_char_limit
}
; store start column
iny
!ifdef Z5PLUS {
tya
clc
adc (string_array),y
} else {
lda #0
sta (string_array),y ; default is empty string (0 in pos 1)
tya
}
sta .read_text_column
; turn on blinking cursor
jsr turn_on_cursor
.readkey
jsr get_cursor ; x=row, y=column
stx .read_text_cursor
sty .read_text_cursor + 1
jsr read_char
cmp #0
bne +
; timer routine returned false
; did the routine draw something on the screen?
jsr get_cursor ; x=row, y=column
cpy .read_text_cursor + 1
beq .readkey
; text changed, redraw input line
jsr turn_off_cursor
jsr clear_num_rows
!ifdef Z5PLUS {
; lda #$0d ; Enter
; jsr s_printchar
; lda #$3e ; ">"
; jsr s_printchar
ldy #1
lda (string_array),y
tax
.p0 cpx #0
beq .p1
iny
lda (string_array),y
jsr translate_zscii_to_petscii
!ifdef DEBUG {
bcc .could_convert
cmp #0
beq .done_printing_this_char
jsr print_bad_zscii_code
jmp .done_printing_this_char
.could_convert
} else {
bcs .done_printing_this_char
}
jsr s_printchar
!ifndef ACORN {
!ifdef USE_BLINKING_CURSOR {
jsr reset_cursor_blink
}
}
.done_printing_this_char
dex
jmp .p0
.p1
} else {
ldy #1
.p0 lda (string_array),y ; default is empty string (0 in pos 1)
beq .p1
jsr translate_zscii_to_petscii
!ifdef DEBUG {
bcc .could_convert
cmp #0
beq .done_printing_this_char
jsr print_bad_zscii_code
jmp .done_printing_this_char
.could_convert
} else {
bcs .done_printing_this_char
}
jsr s_printchar
!ifndef ACORN {
!ifdef USE_BLINKING_CURSOR {
jsr reset_cursor_blink
}
}
.done_printing_this_char
iny
jmp .p0
.p1
}
jsr turn_on_cursor
jmp .readkey
+ cmp #1
bne +
; timer routine returned true
; clear input and return
ldy #1
lda #0
sta (string_array),y
jmp .read_text_done ; a should hold 0 to return 0 here
; check terminating characters
+ ldy #0
- cmp terminating_characters,y
beq .read_text_done
iny
cpy num_terminating_characters
bne -
+ cmp #8 ; SF: ZSCII delete
bne +
; allow delete if anything in the buffer
ldy .read_text_column
cpy #2
bcc .readkey
dec .read_text_column
!ifndef ACORN {
jsr turn_off_cursor
}
lda .petscii_char_read
jsr s_printchar ; print the delete char
!ifndef ACORN {
!ifdef USE_BLINKING_CURSOR {
jsr reset_cursor_blink
}
jsr turn_on_cursor
}
!ifdef Z5PLUS {
ldy #1
lda (string_array),y ; number of characters in the array
sec
sbc #1
sta (string_array),y
}
jmp .readkey ; don't store in the array
+ ; disallow cursor keys etc
; SF: Note that this is part of read_text, used only by z_ins_read, and
; therefore we are reading a line of text here. The following code will
; filter out superficially interesting things like Escape and function keys,
; but as we're just reading a line of text that's probably OK. This is
; upstream code anyway and we're in the ZSCII world here, so this is
; presumably well tested. (ozmoo doesn't appear to support custom
; terminating characters in Z5, so some of the more exotic possibilities are
; probably not relevant in practice.) Although I doubt there's the memory to
; do it properly, this would probably also mean we could implement history
; recall/editing using the cursor keys here without preventing the
; possibility of a game using the cursor keys for its own purposes, as the
; game would probably read them using z_ins_read_char. SFTODO: UPDATE THIS COMMENT
cmp #32
bcs ++
jmp .readkey
++ cmp #128
bcc .char_is_ok
cmp #155
bpl +
jmp .readkey
+ cmp #252
bcc .char_is_ok
jmp .readkey
; print the allowed char and store in the array
.char_is_ok
ldx .read_text_column ; compare with size of keybuffer
cpx .read_text_char_limit
bcc +
jmp .readkey
+ ; keybuffer < maxchars
pha
txa
!ifdef Z5PLUS {
ldy #1
sta (string_array),y ; number of characters in the array
}
tay
!ifdef Z5PLUS {
iny
}
lda .petscii_char_read
jsr s_printchar
!ifndef ACORN {
!ifdef USE_BLINKING_CURSOR {
jsr reset_cursor_blink
}
jsr update_cursor
}
pla
; convert to lower case
; SF: We are working with ZSCII here, so this is nothing to do with PETSCII.
; I suspect this is done to comply with 3.7 of the Z-machine specification.
cmp #$41
bcc .dont_invert_case
cmp #$5b
bcs .dont_invert_case
ora #$20
.dont_invert_case
sta (string_array),y ; store new character in the array
inc .read_text_column
!ifndef Z5PLUS {
iny
lda #0
sta (string_array),y ; store 0 after last char
}
jmp .readkey
.read_text_done
pha ; the terminating character, usually newline
!ifdef Z5PLUS {
sta .read_text_return_value
}
; turn off blinking cursor
jsr turn_off_cursor
!ifndef Z5PLUS {
; Store terminating 0, in case characters were deleted at the end.
ldy .read_text_column ; compare with size of keybuffer
lda #0
sta (string_array),y
}
pla ; the terminating character, usually newline
beq +
jsr s_printchar; print terminating char unless 0 (0 indicates timer abort)
!ifndef ACORN {
!ifdef USE_BLINKING_CURSOR {
jsr reset_cursor_blink
}
}
; jsr start_buffering
+ rts
; SFTODODATA 7+10
.read_parse_buffer !byte 0,0
.read_text_cursor !byte 0,0
.read_text_column !byte 0
.read_text_char_limit !byte 0
.read_text_operand_count !byte 0
!ifdef Z4PLUS {
.read_text_time !byte 0,0 ; update interval in 1/10 seconds
.read_text_time_jiffy !byte 0,0,0 ; update interval in jiffys
.read_text_jiffy !byte 0,0,0 ; current time
.read_text_routine !byte 0,0 ; called with .read_text_time intervals
}
!ifdef Z5PLUS {
.read_text_return_value !byte 0 ; return value
}
!ifndef ACORN {
!ifdef USE_BLINKING_CURSOR {
.cursor_jiffy !byte 0,0,0 ; next cursor update time
.cursor_time_jiffy !byte 0,0,0 ; time between cursor updates
}
}
; SFTODO +make_acorn_screen_hole
tokenise_text
; divide read_line input into words and look up them in the dictionary
; input: string_array should be pointing to the text array
; (this will be okay if called immediately after read_text)
; a/x should be the address of the parse array
; input: - string_array
; - x,a: address of parse_array
; - y: flag (1 = don't add unknown words to parse_array)
; output: parse_array
; side effects:
; used registers: a,x,y
sty .ignore_unknown_words
stx parse_array
clc
adc #>story_start
sta parse_array + 1
lda #2
sta .wordoffset ; where to store the next word in parse_array
ldy #0
sty .numwords ; no words found yet
lda (parse_array),y
sta .maxwords
!ifdef Z5PLUS {
iny
lda (string_array),y ; number of chars in text string
tax
inx
stx .textend
iny ; sets y to 2 = start position in text
} else {
- iny
lda (string_array),y
bne -
dey
sty .textend
ldy #1 ; start position in text
}
; look over text and find each word
.find_word_loop
; skip initial space
cpy .textend
beq +
bcs .parsing_done
+ lda (string_array),y
cmp #$20
bne .start_of_word
iny
bne .find_word_loop ; Always branch
.start_of_word
; start of next word found (y is first character of new word)
sty .wordstart
- ; look for the end of the word
lda (string_array),y
cmp #$20
beq .space_found
; check for terminators
ldx num_terminators
-- cmp terminators - 1,x
beq .terminator_found
dex
bne --
; check if end of string
cpy .textend
bcs .word_found
iny
bne - ; Always branch
.terminator_found
cpy .wordstart
beq .word_found
.space_found
dey
.word_found
; word found. Look it up in the dictionary
iny
sty .wordend ; .wordend is the last character of the word + 1
; update parse_array
lda .wordoffset
tay
clc
adc #4
sta .wordoffset
jsr find_word_in_dictionary ; will update y
inc .numwords
lda .is_word_found
bne .store_word_in_parse_array
lda .ignore_unknown_words
bne .find_next_word ; word unknown, and we shouldn't store unknown words
.store_word_in_parse_array
lda .wordend
sec
sbc .wordstart
sta (parse_array),y ; length
iny
lda .wordstart
sta (parse_array),y ; start index
; find the next word
.find_next_word
ldy #1
lda .numwords
sta (parse_array),y ; num of words
ldy .wordend
lda .numwords
cmp .maxwords
bne .find_word_loop
.parsing_done
lda .numwords
ldy #1
sta (parse_array),y
rts
;SFTODODATA 7
.maxwords !byte 0
.numwords !byte 0
.wordoffset !byte 0
.textend !byte 0
.wordstart !byte 0
.wordend !byte 0
.ignore_unknown_words !byte 0
get_next_zchar
; returns the next zchar in a
; side effects: z_address
; used registers: a,x,y
ldx zchar_triplet_cnt
cpx #2
bne .just_read
; extract 3 zchars (5 bits each)
; stop bit remains in packed_text + 1
jsr read_next_byte
sta packed_text
jsr read_next_byte
sta packed_text + 1
and #$1f
sta zchars
lda packed_text
lsr
ror packed_text + 1
lsr
ror packed_text + 1
and #$1f
sta zchars + 2
lda packed_text + 1
lsr
lsr
lsr
sta zchars + 1
ldx #0
bit packed_text
bpl +
inx
+ stx packed_text + 1
ldx zchar_triplet_cnt
.just_read
lda zchars,x
dex
bpl +
init_get_zchar
; Setup for reading zchars from packed string
; side effects: -
; used registers: x
ldx #2
+ stx zchar_triplet_cnt
rts
; .zchar_triplet_cnt !byte 0
was_last_zchar
; only call after a get_next_zchar
; returns a=0 if current zchar is the last zchar, else > 0
lda zchar_triplet_cnt ; 0 - 2
cmp #2
bne +
lda packed_text + 1
eor #1
+ rts
get_abbreviation_offset
; abbreviation is 32(abbreviation_command-1)+a
sta .current_zchar
dey
tya
asl
asl
asl
asl
asl
clc
adc .current_zchar
asl ; byte -> word
tay
rts
;SFTODODATA 1
.current_zchar !byte 0
print_addr
; print zchar-encoded text
; input: (z_address set with set_z_addr or set_z_paddr)
; output:
; side effects: z_address
; used registers: a,x,y
lda #0
sta alphabet_offset
sta escape_char_counter
sta abbreviation_command
jsr init_get_zchar
.print_chars_loop
jsr get_next_zchar
ldy abbreviation_command
beq .l0
; handle abbreviation
jsr get_abbreviation_offset
; need to store state before calling print_addr recursively
txa
pha
lda z_address
pha
lda z_address + 1
pha
lda z_address + 2
pha
lda zchars
pha
lda zchars + 1
pha
lda zchars + 2
pha
lda packed_text
pha
lda packed_text + 1
pha
lda zchar_triplet_cnt
pha
lda story_start + header_abbreviations ; high byte
ldx story_start + header_abbreviations + 1 ; low byte
jsr set_z_address
tya
jsr skip_bytes_z_address
jsr read_next_byte ; 0
pha
jsr read_next_byte ; 33
tax
pla
jsr set_z_address
; abbreviation index is word, *2 for bytes
asl z_address + 2
rol z_address + 1
rol z_address
; print the abbreviation
jsr print_addr
; restore state
pla
sta zchar_triplet_cnt
pla
sta packed_text + 1
pla
sta packed_text
pla
sta zchars + 2
pla
sta zchars + 1
pla
sta zchars
pla
sta z_address + 2
pla
sta z_address + 1
pla
sta z_address
pla
tax
lda #0
sta alphabet_offset
jmp .next_zchar
.l0 ldy escape_char_counter
beq .l0a
; handle the two characters that make up an escaped character
ldy #5
- asl escape_char
dey
bne -
ora escape_char
sta escape_char
dec escape_char_counter
beq +
jmp .next_zchar
+ lda escape_char
; jsr translate_zscii_to_petscii
jsr streams_print_output
jmp .next_zchar
.l0a
; If alphabet A2, special treatment for code 6 and 7!
ldy alphabet_offset
cpy #52
bne .not_A2
; newline?
cmp #7
bne .l0b
lda #13
bne .print_normal_char ; Always jump
.l0b
; Direct jump for all normal chars in A2
bcs .l6
; escape char?
cmp #6
bne .l1
lda #2
sta escape_char_counter
lda #0
sta escape_char
beq .sta_offset
.not_A2
cmp #6
bcs .l6
.l1 ; Space?
cmp #0
bne .l2
; space
lda #$20
bne .print_normal_char ; Always jump
.l2 cmp #4
bcc .abbreviation
bne .l3
; change to A1
lda #26
sta alphabet_offset
jmp .next_zchar
.l3 ; This can only be #5: Change to A2
; cmp #5
; bne .l6
; change to A2
lda #52
sta alphabet_offset
jmp .next_zchar
.l5 ; abbreviation command?
.abbreviation
; cmp #4
; bcs .l6
sta abbreviation_command ; 1, 2 or 3
jmp .next_zchar
.l6 ; normal char
jsr convert_zchar_to_char
.print_normal_char
jsr streams_print_output
; change back to A0
lda #0
.sta_offset
sta alphabet_offset
.next_zchar
jsr was_last_zchar
beq +
jmp .print_chars_loop
+ rts
; .escape_char !byte 0
; .escape_char_counter !byte 0
; .abbreviation_command !byte 0
; .zchars !byte 0,0,0
; .packedtext !byte 0,0
; .alphabet_offset !byte 0
default_alphabet ; 26 * 3
!raw "abcdefghijklmnopqrstuvwxyz"
!raw "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
!raw 32,13,"0123456789.,!?_#'",34,47,92,"-:()"
!ifdef ACORN_OSRDCH {
; BeebEm (4.15, at least) pokes code into memory at $100 to implement paste
; via OSRDCH, so we need to relocate these buffers to avoid problems.
print_buffer
!fill 81
print_buffer2
!fill 81
}
|
oeis/088/A088386.asm | neoneye/loda-programs | 22 | 160931 | ; A088386: a(n) = 2^n*(n!)^3.
; 1,2,32,1728,221184,55296000,23887872000,16387080192000,16780370116608000,24465779630014464000,48931559260028928000000,130255810750197006336000000,450164081952680853897216000000
mov $2,1
lpb $0
mov $1,$0
sub $0,1
pow $1,3
mul $1,2
mul $2,$1
lpe
mov $0,$2
|
Transynther/x86/_processed/AVXALIGN/_st_/i7-8650U_0xd2.log_3635_312.asm | ljhsiun2/medusa | 9 | 240860 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x13b5f, %rbp
nop
dec %r10
mov (%rbp), %r12d
nop
nop
xor $63019, %rsi
lea addresses_WC_ht+0x13ba9, %rsi
lea addresses_normal_ht+0x7ac0, %rdi
nop
nop
nop
nop
nop
xor $22325, %rdx
mov $45, %rcx
rep movsq
nop
nop
nop
nop
add %rdx, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r9
push %rax
push %rcx
push %rdi
// Store
lea addresses_WT+0x1aaf0, %r11
nop
nop
nop
inc %r9
movw $0x5152, (%r11)
cmp %rcx, %rcx
// Store
lea addresses_UC+0x1f9f0, %r9
nop
inc %r10
mov $0x5152535455565758, %rdi
movq %rdi, %xmm6
vmovntdq %ymm6, (%r9)
nop
sub $46773, %r11
// Faulty Load
lea addresses_UC+0x59f0, %r10
nop
nop
sub $53331, %rax
movb (%r10), %r14b
lea oracles, %r9
and $0xff, %r14
shlq $12, %r14
mov (%r9,%r14,1), %r14
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 11, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'58': 3635}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
oeis/034/A034387.asm | neoneye/loda-programs | 11 | 103094 | ; A034387: Sum of primes <= n.
; Submitted by <NAME>(w3)
; 0,2,5,5,10,10,17,17,17,17,28,28,41,41,41,41,58,58,77,77,77,77,100,100,100,100,100,100,129,129,160,160,160,160,160,160,197,197,197,197,238,238,281,281,281,281,328,328,328,328,328,328,381,381,381,381,381,381,440,440,501,501,501,501,501,501,568,568,568,568,639,639,712,712,712,712,712,712,791,791,791,791,874,874,874,874,874,874,963,963,963,963,963,963,963,963,1060,1060,1060,1060
add $0,1
lpb $0
sub $0,1
div $0,2
mul $0,2
trn $0,1
seq $0,151799 ; Version 2 of the "previous prime" function: largest prime < n.
add $1,$0
sub $0,1
lpe
mov $0,$1
|
a8/ramdetect.asm | lybrown/fujiconvert | 7 | 18309 | extwindow equ $4000
banks
dontuse
org *+$100
bankindex
dta 0
prepnextbank
ldx bankindex
lda banks,x
sne:jmp main ; cancel load and run if banks are full
sta PORTB
inx
stx bankindex
sta rdscr+38
rts
; destroys addresses 0, 4000, 8000, C000 on RAMBO 256K
; destroys first byte in every extended RAM bank and 4000 in main mem
detectram
sei
mva #0 NMIEN
sta DMACTL
; clear dontuse table
tax
sta:rne dontuse,x+
; store 5A in every bank
lda #$5A
l1
stx PORTB
sta extwindow
:2 inx
bne l1
; store 5A in address zero to detect RAMBO 256K
sta 0
; loop through banks by X
l2
; skip if bank X has been marked as dont-use
ldy dontuse,x
bne c1
; write A5 into bank X
stx PORTB
mva #$A5 extwindow
; if address 0 contains A5 then mark as RAMBO 256K main mem alias
cmp 0
bne c0
sta dontuse,x
beq c1
c0
; loop through banks by Y = X+2 .. $FE
txa
tay
:2 iny
l3
sty PORTB
; if this bank contains A5 then mark as not unique
lda #$A5
cmp extwindow
sne:sta dontuse,y
:2 iny
bne l3
; write 5A back into bank X
stx PORTB
mvy #$5A extwindow
c1
:2 inx
bne l2
; enumerate unique banks
ldy #0
l4
lda dontuse,x
bne c2
cpx #$10
sne:ldx #$90 ; disable self-test in main ram bank
txa
; set OS enable bit on all banks
ora #1
sta banks,y+
c2
:2 inx
bne l4
; terminate list with 0
mva #0 banks,y
jsr displaycount
lda #0
sta:rne banks,y+
; display loading message
mwa #rddlist $230 ; SDLSTL
mva #0 $2C6 ; COLOR2
mva #15 $2C5 ; COLOR1
lda:rne VCOUNT
mva #$22 $22F ; SDMCTL
; restore OS ROM
mva #$FF PORTB
; restore interrupts
cli
mva #$40 NMIEN
rts
rddlist
:5 dta $70
dta $42,a(rdscr)
dta $70
dta $42,a(banks)
dta $2
dta $41,a(rddlist)
rdscr
; 0123456789012345678901234567890123456789
dta d' Loading into 00 detected banks... '
displaycount
tya
ldx #0
divmod
cmp #10
bcc done
sbc #10
inx
jmp divmod
done
adc #16
sta rdscr+18
txa
adc #16
sta rdscr+17
rts
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.