max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_905.asm
ljhsiun2/medusa
9
81222
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x1ad2f, %rcx nop nop nop sub %rdi, %rdi mov $0x6162636465666768, %r10 movq %r10, %xmm6 and $0xffffffffffffffc0, %rcx movaps %xmm6, (%rcx) nop nop nop add $34572, %r10 lea addresses_normal_ht+0x19c8f, %r10 clflush (%r10) xor $4236, %rdx mov $0x6162636465666768, %rcx movq %rcx, (%r10) nop nop nop nop add $18636, %r13 lea addresses_A_ht+0xe48f, %rsi lea addresses_normal_ht+0x10a43, %rdi clflush (%rdi) nop nop and $44445, %rax mov $49, %rcx rep movsb add %r10, %r10 lea addresses_normal_ht+0xbccf, %rsi lea addresses_UC_ht+0x1448f, %rdi nop xor %rdx, %rdx mov $127, %rcx rep movsl nop nop nop nop nop and $24491, %rax lea addresses_WT_ht+0x14c7f, %rdi and $16057, %r10 movb $0x61, (%rdi) add $41926, %rcx lea addresses_UC_ht+0x1dcf, %rsi lea addresses_A_ht+0xb1df, %rdi sub $24189, %rbx mov $41, %rcx rep movsb nop nop nop nop add %r13, %r13 lea addresses_WT_ht+0xd08f, %rdx clflush (%rdx) cmp %rdi, %rdi mov $0x6162636465666768, %r13 movq %r13, %xmm1 vmovups %ymm1, (%rdx) add %rax, %rax lea addresses_WC_ht+0x1b38f, %rsi nop nop nop nop sub $60305, %r10 mov $0x6162636465666768, %rbx movq %rbx, (%rsi) inc %rsi lea addresses_WT_ht+0x11921, %rdi nop nop add %rcx, %rcx vmovups (%rdi), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $1, %xmm6, %rbx nop nop nop inc %rbx lea addresses_WC_ht+0x128c7, %r10 nop nop nop nop nop sub %rax, %rax mov (%r10), %rsi nop nop sub $9485, %rdi lea addresses_A_ht+0x7f8f, %rsi lea addresses_UC_ht+0x15c8f, %rdi nop nop nop nop sub %rbx, %rbx mov $88, %rcx rep movsq xor $51361, %rsi lea addresses_UC_ht+0x174ab, %rsi lea addresses_WT_ht+0xcd1f, %rdi nop nop nop nop sub %rax, %rax mov $86, %rcx rep movsq nop nop sub $51655, %rax lea addresses_A_ht+0xa0c7, %rcx inc %r10 mov $0x6162636465666768, %r13 movq %r13, (%rcx) and %rax, %rax lea addresses_UC_ht+0x96ed, %rdi nop inc %r13 mov (%rdi), %eax nop and $7801, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r15 push %r8 push %r9 push %rax push %rbp push %rdi push %rdx // Store lea addresses_WT+0x348f, %r9 nop nop nop cmp $46559, %rbp mov $0x5152535455565758, %r15 movq %r15, (%r9) and %r15, %r15 // Store lea addresses_PSE+0x2fc3, %r15 nop nop nop nop sub %rdx, %rdx movl $0x51525354, (%r15) nop nop nop nop sub %rdi, %rdi // Faulty Load lea addresses_RW+0xbc8f, %r9 nop nop nop add %r15, %r15 movb (%r9), %dl lea oracles, %rbp and $0xff, %rdx shlq $12, %rdx mov (%rbp,%rdx,1), %rdx pop %rdx pop %rdi pop %rbp pop %rax pop %r9 pop %r8 pop %r15 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 2}} [Faulty Load] {'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': True, 'size': 16, 'NT': False, 'same': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 9}} {'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 1, 'NT': False, 'same': False, 'congruent': 3}} {'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 8}} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': True, 'same': False, 'congruent': 3}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': True}} {'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 3}} {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
src/Parse/Escape.agda
WhatisRT/meta-cedille
35
1811
<reponame>WhatisRT/meta-cedille -------------------------------------------------------------------------------- -- This file provides functions for escaping -------------------------------------------------------------------------------- module Parse.Escape where open import Class.Map open import Data.SimpleMap open import Data.String using (fromList; toList) open import Prelude open import Prelude.Strings private translationTable : SimpleMap String Char translationTable = ("newline" , '\n') ∷ ("space" , ' ') ∷ ("ast" , '*') ∷ ("sq" , '□') ∷ ("lparen" , '(') ∷ ("rparen" , ')') ∷ ("lbrace" , '{') ∷ ("rbrace" , '}') ∷ ("lsquare" , '[') ∷ ("rsquare" , ']') ∷ ("langle" , '<') ∷ ("rangle" , '>') ∷ ("equal" , '=') ∷ ("dot" , '.') ∷ ("comma" , ',') ∷ ("colon" , ':') ∷ ("semicolon" , ';') ∷ ("question" , '?') ∷ ("exclamation" , '!') ∷ ("at" , '@') ∷ ("doublequote" , '"') ∷ ("ampersand" , '&') ∷ ("backslash" , '\\') ∷ ("slash" , '/') ∷ ("pipe" , '|') ∷ ("circumflex" , '^') ∷ ("underscore" , '_') ∷ ("dollar" , '$') ∷ ("minus" , '-') ∷ ("forall" , '∀') ∷ ("exists" , '∃') ∷ ("alpha" , 'α') ∷ ("beta" , 'β') ∷ ("gamma" , 'γ') ∷ ("delta" , 'δ') ∷ ("epsilon" , 'ε') ∷ ("zeta" , 'ζ') ∷ ("eta" , 'η') ∷ ("theta" , 'θ') ∷ ("iota" , 'ι') ∷ ("kappa" , 'κ') ∷ ("lambda" , 'λ') ∷ ("mu" , 'μ') ∷ ("nu" , 'ν') ∷ ("xi" , 'ξ') ∷ ("omicron" , 'ο') ∷ ("pi" , 'π') ∷ ("rho" , 'ρ') ∷ ("varsigma" , 'ς') ∷ ("sigma" , 'σ') ∷ ("tau" , 'τ') ∷ ("upsilon" , 'υ') ∷ ("phi" , 'φ') ∷ ("chi" , 'χ') ∷ ("psi" , 'ψ') ∷ ("omega" , 'ω') ∷ ("Alpha" , 'Α') ∷ ("Beta" , 'Β') ∷ ("Gamma" , 'Γ') ∷ ("Delta" , 'Δ') ∷ ("Epsilon" , 'Ε') ∷ ("Zeta" , 'Ζ') ∷ ("Eta" , 'Η') ∷ ("Theta" , 'Θ') ∷ ("Iota" , 'Ι') ∷ ("Kappa" , 'Κ') ∷ ("Lambda" , 'Λ') ∷ ("Mu" , 'Μ') ∷ ("Nu" , 'Ν') ∷ ("Xi" , 'Ξ') ∷ ("Omicron" , 'Ο') ∷ ("Pi" , 'Π') ∷ ("Rho" , 'Ρ') ∷ ("Varsigma" , 'Σ') ∷ ("Sigma" , 'Σ') ∷ ("Tau" , 'Τ') ∷ ("Upsilon" , 'Υ') ∷ ("Phi" , 'Φ') ∷ ("Chi" , 'Χ') ∷ ("Psi" , 'Ψ') ∷ ("Omega" , 'Ω') ∷ [] escapeTable : SimpleMap Char String escapeTable = map swap translationTable isSpecialChar : Char → Bool isSpecialChar c = c ≣ '$' ∨ c ≣ '_' ∨ c ≣ '!' ∨ c ≣ '@' ∨ c ≣ '&' ∨ c ≣ '^' -- accepts the head and tail of a string and returns the head of the full string without escape symbols unescape : Char → String → Char unescape c r = if ⌊ c ≟ '\\' ⌋ then (case strHead r of λ { nothing → c ; (just x) → x }) else c groupEscaped : List Char → List (List Char) groupEscaped = helper false where helper : Bool → List Char → List (List Char) helper b [] = [] helper false (x ∷ l) = if ⌊ x ≟ '\\' ⌋ then helper true l else [ x ] ∷ helper false l helper true (x ∷ l) = ('\\' ∷ [ x ]) ∷ helper false l translate : List Char → Maybe (List Char) translate = helper ∘ splitMulti '=' where helper : List (List Char) → Maybe (List Char) helper [] = just [] helper (l ∷ []) = just l helper (l ∷ l₁ ∷ l₂) = do l' ← lookup (fromList l₁) translationTable l'' ← helper l₂ return $ l + (if isSpecialChar l' then '\\' ∷ [ l' ] else [ l' ]) + l'' escapeChar : Char → List Char escapeChar c = maybe (λ s → "=" ++ toList s ++ "=") [ c ] $ lookup c escapeTable ruleToConstr : String → String ruleToConstr = fromList ∘ concat ∘ helper ∘ groupEscaped ∘ toList where helper : List (List Char) → List (List Char) helper [] = [] helper (l ∷ l₁) = (case l of λ where (c ∷ []) → if isSpecialChar c then [ c ] else escapeChar c ('\\' ∷ c ∷ []) → if isSpecialChar c then escapeChar c else l _ → l) ∷ (helper l₁)
sound/musicasm/ALZ.asm
NatsumiFox/Sonic-3-93-Nov-03
7
176804
<filename>sound/musicasm/ALZ.asm<gh_stars>1-10 ALZ_Header: sHeaderInit ; Z80 offset is $BE82 sHeaderPatch ALZ_Patches sHeaderCh $06, $03 sHeaderTempo $01, $00 sHeaderDAC ALZ_DAC sHeaderFM ALZ_FM1, $00, $15 sHeaderFM ALZ_FM2, $00, $0B sHeaderFM ALZ_FM3, $00, $15 sHeaderFM ALZ_FM4, $00, $15 sHeaderFM ALZ_FM5, $00, $19 sHeaderPSG ALZ_PSG1, $E8, $04, $00, v00 sHeaderPSG ALZ_PSG2, $E8, $02, $00, v00 sHeaderPSG ALZ_PSG3, $E8, $02, $00, v00 ALZ_FM1: sPan spCenter sPatFM $00 ssModZ80 $0D, $01, $02, $06 dc.b nC4, $08, nF4, nG4, nF4, nG4, nC5, nG4 dc.b nC5, nD5, nF5, $18 ALZ_Jump1: dc.b nRst, $60, nRst, nRst, nRst sPatFM $04 dc.b nRst, $18, nG5, $30, nC5, $06, nRst, $12 dc.b nRst, $54, nG5, $06, nRst, nG5, $12, nC5 dc.b $06, nRst, $0C, nG4, $06, nRst, nG4, $12 dc.b nC4, $06, nRst, $18 sPatFM $03 dc.b nRst, $30, nRst, $06, nC4, nE4, nG4, nE4 dc.b nG4, nC5, nE5, nF5, $0C, nE5, nD5, nC5 dc.b $06, nRst, $12, nG5, $18, nE5, $0C, nF5 dc.b nE5, nD5, nE5, $08, nRst, $0A, nC4, $06 dc.b nE4, nG4, nE4, nG4, nC5, nE5, nF5, $0C dc.b nE5, nD5, nC5, $06, nRst, $12, nG5, $18 dc.b nE5, $0C, nF5, nE5, nD5, nC5, $08, nRst dc.b $0A, nC6, $06, nG5, nE5, nG5, nE5, nC5 dc.b nG4 sPatFM $00 dc.b nRst, $18, nG4, $06, nRst, $1E, nF4, $06 dc.b nRst, $1E, nC5, $06, nRst, $1E, nG4, $06 dc.b nRst, $1E, nE5, $06, nRst, $12, nRst, $0C dc.b nC5, $06, nRst, $1E, nG5, $06, nRst, $2A dc.b nRst, $36 sPatFM $03 dc.b nC4, $06, nE4, nG4, nE4, nG4, nC5, nE5 dc.b nF5, $0C, nE5, nD5, nC5, $06, nRst, $12 dc.b nG5, $18, nE5, $0C, nF5, nE5, nD5, nE5 dc.b $08, nRst, $0A, nC4, $06, nE4, nG4, nE4 dc.b nG4, nC5, nE5, nF5, $0C, nE5, nD5, nC5 dc.b $06, nRst, $12, nG5, $18, nE5, $0C, nF5 dc.b nE5, nD5, nC5, $08, nRst, $0A, nC6, $06 dc.b nG5, nE5, nG5, nE5, nC5, nG4 sPatFM $00 dc.b nRst, $18, nG4, $06, nRst, $1E, nF4, $06 dc.b nRst, $1E, nC5, $06, nRst, $1E, nG4, $06 dc.b nRst, $1E, nE5, $06, nRst, $12, nRst, $0C dc.b nC5, $06, nRst, $1E, nG5, $06, nRst, $12 dc.b nD5, $06, nRst, nE5, nRst, nG3, $0C, nG3 dc.b $06, nRst, nBb3, nRst, $12, nD4, $0C, nC4 dc.b $06, nRst, $12 saVolFM $03 sPatFM $04 dc.b nE5, $18, nD5, $06, nRst, nE5, nRst, nD5 dc.b nRst, nE5, nRst, nD5, nE5, nRst, $0C, nF5 dc.b $18, nE5, $06, nRst, nF5, nRst, nE5, nRst dc.b nF5, nRst, nE5, nF5, nRst, $0C, nG5, $18 dc.b nF5, $06, nRst, nG5, nRst, nF5, nRst, nG5 dc.b nRst, nF5, nE5, nRst, $0C, nA4, $1E, nRst dc.b $06, nB4, nRst, nB4, nRst, nB4, $0C, nG4 dc.b $06, nRst, nG4, nRst, nE5, $18, nD5, $06 dc.b nRst, nE5, nRst, nD5, nRst, nE5, nRst, nD5 dc.b nE5, nRst, $0C, nF5, $18, nE5, $06, nRst dc.b nF5, nRst, nE5, nRst, nF5, nRst, nE5, nF5 dc.b nRst, $0C, nG5, $18, nF5, $06, nRst, nG5 dc.b nRst, nF5, nRst, nG5, nRst, nF5, nE5, nRst dc.b $0C, nA4, $1E, nRst, $06, nBb4, nRst, nBb4 dc.b nRst, nB4, $0C, nRst, nC5, $06, nRst, nF5 dc.b $3C, nE5, $0C, nC5, nA4, nE5, $06, nRst dc.b nRst, $0C, nD5, $08, nRst, $28, nC5, $06 dc.b nRst, nC5, nRst, nC5, nRst saVolFM $FD sJump ALZ_Jump1 dc.b $F2 ; Unused ALZ_FM2: sPatFM $01 ssModZ80 $0D, $01, $02, $06 dc.b nC2, $48, nC2, $06, nC2, nC2, nC2 ALZ_Loop1: dc.b nC2, $06, nRst, nC2, nRst, nC2, nRst, nC2 dc.b nC2, $05, nRst, $07, nC2, $06, nG2, nC2 dc.b nC2, $05, nRst, $07, nC2, $06, nC2 sLoop $00, $0C, ALZ_Loop1 dc.b nC2, $06, nRst, nC2, nRst, nC2, nRst, nC2 dc.b nC2, $05, nRst, $07, nC2, $03, nRst, nC2 dc.b $0C, nC2, nC2, nC2, $06, nC2, nC2, nRst dc.b nC2, nRst, nC2, nC2, $05, nRst, $07, nC2 dc.b $05, nRst, $07, nC2, $06, nG2, nC2, nG2 dc.b nC2, nC2, nRst, nC2, nRst, nC2, nRst, nC2 dc.b nC2, $05, nRst, $07, nC2, $03, nRst, nC2 dc.b $0C, nC2, nC2, nC2, nC3, $01, nRst, $0B dc.b nC2, $12, nC2, $05, nRst, $0D, nC2, $05 dc.b nRst, $07, nC2, $06, nC3, nC2, nC2 ALZ_Loop2: dc.b nC2, $06, nRst, nC2, nRst, nC2, nRst, nC2 dc.b nC2, $05, nRst, $07, nC2, $06, nG2, nC2 dc.b nC2, $05, nRst, $07, nC2, $06, nC2 sLoop $00, $04, ALZ_Loop2 dc.b nC2, $06, nRst, nC2, nRst, nC2, nRst, nC2 dc.b nC2, $05, nRst, $07, nC2, $03, nRst, nC2 dc.b $0C, nC2, nC2, nC2, $06, nC2, nC2, nRst dc.b nC2, nRst, nC2, nC2, $05, nRst, $07, nC2 dc.b $05, nRst, $07, nC2, $06, nG2, nC2, nG2 dc.b nC2, nC2, nRst, nC2, nRst, nC2, nRst, nC2 dc.b nC2, $05, nRst, $07, nC2, $03, nRst, nC2 dc.b $0C, nC2, nC2, nC2, nC3, $01, nRst, $0B dc.b nC2, $12, nC2, $06, nC2, $0C, nC2, $05 dc.b nRst, $13 ALZ_Loop3: dc.b nC2, $18, nC2, $0C, nC2, nC2, nC2, nC2 dc.b nC2 sLoop $00, $08, ALZ_Loop3 dc.b nC2, $18, nC2, $0C, nC2, nC2, $06, nG2 dc.b $02, nRst, $04, nC3, $0C, nG2, nE2, nC2 dc.b nRst, nC2, $06, nRst, $12, nC2, $06, nC2 dc.b nC2, $0C, nC2, nG2, nC2 sJump ALZ_Loop1 dc.b $F2 ; Unused ALZ_FM3: sPatFM $04 ssModZ80 $0D, $01, $02, $06 dc.b nRst, $18, nF5, $30, nE4, $06, nG4, nC5 dc.b nE5 ALZ_Loop4: sPatFM $02 dc.b nF4, $06, nRst, $0C, nF4, $06, nRst, $0C dc.b nE4, $06, nRst, $12, nE4, $06, nRst, nE4 dc.b nRst, nE4, nRst, nD4, nRst, $0C, nD4, $06 dc.b nRst, $0C, nE4, $06, nRst, $12, nE4, $06 dc.b nRst, nE4, nRst, nE4, nRst, nF4, nRst, $0C dc.b nF4, $06, nRst, $0C, nE4, $06, nRst, $12 dc.b nE4, $06, nRst, nE4, nRst, nE4, nRst, nD4 dc.b nRst, $0C, nD4, $06, nRst, $0C, nC4, $06 dc.b nRst, $12, nC4, $06, nRst, nC4, nRst, nC4 dc.b nRst sLoop $00, $03, ALZ_Loop4 sPatFM $04 dc.b nRst, $0C, nG4, $08, nRst, $0A, nG4, $06 dc.b nRst, $0C, nG4, $08, nRst, $0A, nG4, $08 dc.b nRst, $0A, nG4, $20, nG4, $0C, nRst, $10 dc.b nG4, $06, nG4, $08, nRst, $04, nG4, $08 dc.b nRst, $0A, nG4, $20, nG4, $0C, nRst, $10 dc.b nG4, $06, nG4, $08, nRst, $04, nG4, $08 dc.b nRst, $0A, nG4, $1E, nG4, $0E, nRst, $40 sPatFM $02 dc.b nF4, $06, nRst, $0C, nF4, $06, nRst, $0C dc.b nE4, $06, nRst, $12, nE4, $06, nRst, nE4 dc.b nRst, nE4, nRst, nD4, nRst, $0C, nD4, $06 dc.b nRst, $0C, nE4, $06, nRst, $12, nE4, $06 dc.b nRst, nE4, nRst, nE4, nRst, nF4, nRst, $0C dc.b nF4, $06, nRst, $0C, nE4, $06, nRst, $12 dc.b nE4, $06, nRst, nE4, nRst, nE4, nRst, nD4 dc.b nRst, $0C, nD4, $06, nRst, $0C, nC4, $06 dc.b nRst, $12, nC4, $06, nRst, nC4, nRst, nC4 dc.b nRst sPatFM $04 dc.b nRst, $0C, nG4, $08, nRst, $0A, nG4, $06 dc.b nRst, $0C, nG4, $08, nRst, $0A, nG4, $08 dc.b nRst, $0A, nG4, $20, nG4, $0C, nRst, $10 dc.b nG4, $06, nG4, $08, nRst, $04, nG4, $08 dc.b nRst, $0A, nG4, $1E, nG4, $0C, nRst, $12 dc.b nG4, $06, nG4, nRst, nG4, nRst, $0C, nE4 dc.b $1E, nRst, $06, nF4, nRst, $12, nA4, $0C dc.b nG4, $06, nRst, $12 sPatFM $03 saVolFM $FD dc.b nC5, $54, nG4, $06, nRst, nD5, $54, nC5 dc.b $06, nRst, nE5, $48, nC5, $08, nRst, $1C dc.b nRst, $18, nG5, $08, nRst, $10, nD5, $08 dc.b nRst, $10, nE5, $08, nRst, $04, nC5, $54 dc.b nG4, $06, nRst, nD5, $54, nC5, $06, nRst dc.b nE5, $48, nC6, $08, nRst, $10, nF5, $24 dc.b nE5, $18, nG5, $08, nRst, $28, nRst, $60 sPatFM $02 dc.b nRst, $3C, nC4, $06, nRst, nC4, nRst, nC4 dc.b nRst saVolFM $03 sJump ALZ_Loop4 dc.b $F2 ; Unused ALZ_FM4: sPatFM $04 ssModZ80 $0D, $01, $02, $06 dc.b nRst, $18, nG5, $30, nC5, $06, nRst, $12 ALZ_Loop5: sPatFM $02 dc.b nC4, $06, nRst, $0C, nC4, $06, nRst, $0C dc.b nC4, $06, nRst, $12, nC4, $06, nRst, nC4 dc.b nRst, nC4, nRst, nC4, nRst, $0C, nC4, $06 dc.b nRst, $0C, nC4, $06, nRst, $12, nC4, $06 dc.b nRst, nC4, nRst, nC4, nRst, nC4, nRst, $0C dc.b nC4, $06, nRst, $0C, nC4, $06, nRst, $12 dc.b nC4, $06, nRst, nC4, nRst, nC4, nRst, nC4 dc.b nRst, $0C, nC4, $06, nRst, $0C, nG3, $06 dc.b nRst, $12, nG3, $06, nRst, nG3, nRst, nG3 dc.b nRst sLoop $00, $03, ALZ_Loop5 sPatFM $04 dc.b nRst, $0C, nF4, $08, nRst, $0A, nF4, $06 dc.b nRst, $0C, nF4, $08, nRst, $0A, nF4, $08 dc.b nRst, $0A, nE4, $20, nE4, $0C, nRst, $10 dc.b nE4, $06, nE4, $08, nRst, $04, nE4, $08 dc.b nRst, $0A, nF4, $20, nF4, $0C, nRst, $10 dc.b nF4, $06, nF4, $08, nRst, $04, nF4, $08 dc.b nRst, $0A, nE4, $18, nD4, $06, nRst, nE4 dc.b $08, nRst, $40 sPatFM $02 dc.b nC4, $06, nRst, $0C, nC4, $06, nRst, $0C dc.b nC4, $06, nRst, $12, nC4, $06, nRst, nC4 dc.b nRst, nC4, nRst, nC4, nRst, $0C, nC4, $06 dc.b nRst, $0C, nC4, $06, nRst, $12, nC4, $06 dc.b nRst, nC4, nRst, nC4, nRst, nC4, nRst, $0C dc.b nC4, $06, nRst, $0C, nC4, $06, nRst, $12 dc.b nC4, $06, nRst, nC4, nRst, nC4, nRst, nC4 dc.b nRst, $0C, nC4, $06, nRst, $0C, nG3, $06 dc.b nRst, $12, nG3, $06, nRst, nG3, nRst, nG3 dc.b nRst sPatFM $04 dc.b nRst, $0C, nF4, $08, nRst, $0A, nF4, $06 dc.b nRst, $0C, nF4, $08, nRst, $0A, nF4, $08 dc.b nRst, $0A, nE4, $20, nE4, $0C, nRst, $10 dc.b nE4, $06, nE4, $08, nRst, $04, nE4, $08 dc.b nRst, $0A, nF4, $1E, nF4, $0C, nRst, $12 dc.b nF4, $06, nF4, nRst, nF4, nRst, $0C, nC4 dc.b $1E, nRst, $06, nD4, nRst, $12, nF4, $0C dc.b nE4, $06, nRst, $1E, nRst, $60, nRst, nRst dc.b nRst, nRst, nRst, nRst, nRst, nRst, $0C sPatFM $2D dc.b nF5, $06, nG5, nC6, nG5, nF5, nE5, nC5 dc.b $05, nRst, $2B, nRst, $3C sPatFM $02 dc.b nG3, $06, nRst, nG3, nRst, nG3, nRst sJump ALZ_Loop5 dc.b $F2 ; Unused ALZ_FM5: dc.b nRst, $0E sPatFM $00 ssModZ80 $0D, $01, $02, $06 dc.b nC4, $08, nF4, nG4, nF4, nG4, nC5, nG4 dc.b nC5, nD5, nF5, $18 ALZ_Jump2: dc.b nRst, $60, nRst, nRst, nRst sPatFM $04 dc.b nRst, $18, nG5, $30, nC5, $06, nRst, $12 dc.b nRst, $54, nG5, $06, nRst, nG5, $12, nC5 dc.b $06, nRst, $0C, nG4, $06, nRst, nG4, $12 dc.b nC4, $06, nRst, $18 sPatFM $03 dc.b nRst, $30, nRst, $06, nC4, nE4, nG4, nE4 dc.b nG4, nC5, nE5, nF5, $0C, nE5, nD5, nC5 dc.b $06, nRst, $12, nG5, $18, nE5, $0C, nF5 dc.b nE5, nD5, nE5, $08, nRst, $0A, nC4, $06 dc.b nE4, nG4, nE4, nG4, nC5, nE5, nF5, $0C dc.b nE5, nD5, nC5, $06, nRst, $12, nG5, $18 dc.b nE5, $0C, nF5, nE5, nD5, nC5, $08, nRst dc.b $0A, nC6, $06, nG5, nE5, nG5, nE5, nC5 dc.b nG4 sPatFM $00 dc.b nRst, $18, nG4, $06, nRst, $1E, nF4, $06 dc.b nRst, $1E, nC5, $06, nRst, $1E, nG4, $06 dc.b nRst, $1E, nE5, $06, nRst, $12, nRst, $0C dc.b nC5, $06, nRst, $1E, nG5, $06, nRst, $2A dc.b nRst, $36 sPatFM $03 dc.b nC4, $06, nE4, nG4, nE4, nG4, nC5, nE5 dc.b nF5, $0C, nE5, nD5, nC5, $06, nRst, $12 dc.b nG5, $18, nE5, $0C, nF5, nE5, nD5, nE5 dc.b $08, nRst, $0A, nC4, $06, nE4, nG4, nE4 dc.b nG4, nC5, nE5, nF5, $0C, nE5, nD5, nC5 dc.b $06, nRst, $12, nG5, $18, nE5, $0C, nF5 dc.b nE5, nD5, nC5, $08, nRst, $0A, nC6, $06 dc.b nG5, nE5, nG5, nE5, nC5, nG4 sPatFM $00 dc.b nRst, $18, nG4, $06, nRst, $1E, nF4, $06 dc.b nRst, $1E, nC5, $06, nRst, $1E, nG4, $06 dc.b nRst, $1E, nE5, $06, nRst, $12, nRst, $0C dc.b nC5, $06, nRst, $1E, nG5, $06, nRst, $12 dc.b nD5, $06, nRst, nE5, nRst, nG3, $0C, nG3 dc.b $06, nRst, nBb3, nRst, $12, nD4, $0C, nC4 dc.b $06, nRst, $12 sPatFM $04 saVolFM $03 dc.b nE5, $18, nD5, $06, nRst, nE5, nRst, nD5 dc.b nRst, nE5, nRst, nD5, nE5, nRst, $0C, nF5 dc.b $18, nE5, $06, nRst, nF5, nRst, nE5, nRst dc.b nF5, nRst, nE5, nF5, nRst, $0C, nG5, $18 dc.b nF5, $06, nRst, nG5, nRst, nF5, nRst, nG5 dc.b nRst, nF5, nE5, nRst, $0C, nA4, $1E, nRst dc.b $06, nB4, nRst, nB4, nRst, nB4, $0C, nG4 dc.b $06, nRst, nG4, nRst, nE5, $18, nD5, $06 dc.b nRst, nE5, nRst, nD5, nRst, nE5, nRst, nD5 dc.b nE5, nRst, $0C, nF5, $18, nE5, $06, nRst dc.b nF5, nRst, nE5, nRst, nF5, nRst, nE5, nF5 dc.b nRst, $0C, nG5, $18, nF5, $06, nRst, nG5 dc.b nRst, nF5, nRst, nG5, nRst, nF5, nE5, nRst dc.b $0C, nA4, $1E, nRst, $06, nBb4, nRst, nBb4 dc.b nRst, nB4, $0C, nRst, nC5, $06, nRst, nF5 dc.b $3C, nE5, $0C, nC5, nA4, nE5, $06, nRst dc.b nRst, $0C, nD5, $08, nRst, $28, nC5, $06 dc.b nRst, nC5, nRst, nC5, nRst saVolFM $FD sJump ALZ_Jump2 dc.b $F2 ; Unused ALZ_DAC: dc.b dSnare, $18, dKick, dKick, dSnare, $06, dSnare, dSnare dc.b dSnare ALZ_Loop6: dc.b dKick, $18, dSnare, $12, dKick, dKick, $0C, dSnare dc.b dKick sLoop $00, $03, ALZ_Loop6 dc.b dKick, $18, dSnare, $12, dKick, dKick, $0C, dSnare dc.b $06, dKick, dSnare, dSnare, dKick, $0C, dKick, $06 dc.b dKick, dSnare, $12, dKick, dKick, $0C, dSnare, dKick ALZ_Loop7: dc.b dKick, $18, dSnare, $12, dKick, dKick, $0C, dSnare dc.b dKick sLoop $00, $02, ALZ_Loop7 dc.b dKick, $18, dSnare, $12, dKick, $0C, dSnare, $06 dc.b dKick, $0C, dSnare, dKick ALZ_Loop8: dc.b dKick, $18, dSnare, $12, dKick, dKick, $0C, dSnare dc.b dKick sLoop $00, $03, ALZ_Loop8 dc.b dKick, $18, dSnare, $12, dKick, dSnare, $0C, dSnare dc.b dSnare, $06, dSnare ALZ_Loop9: dc.b dKick, $18, dSnare, $12, dKick, dKick, $0C, dSnare dc.b dKick sLoop $00, $02, ALZ_Loop9 dc.b dKick, $18, dSnare, $12, dKick, dKick, $0C, dSnare dc.b $06, dSnare, dSnare, $0C, dKick, dSnare, dSnare, dSnare dc.b $06, dSnare, dKick, dSnare, $0C, dSnare, $06, dSnare dc.b dSnare, dKick, dSnare ALZ_Loop10: dc.b dKick, $18, dSnare, $12, dKick, dKick, $0C, dSnare dc.b dKick sLoop $00, $03, ALZ_Loop10 dc.b dKick, $18, dSnare, $12, dKick, dSnare, $0C, dSnare dc.b dSnare, $06, dSnare ALZ_Loop11: dc.b dKick, $18, dSnare, $12, dKick, dKick, $0C, dSnare dc.b dKick sLoop $00, $02, ALZ_Loop11 dc.b dKick, $18, dSnare, $12, dKick, dKick, $0C, dSnare dc.b $06, dSnare, dSnare, $0C, dKick, dSnare, $06, dSnare dc.b dSnare, $18, dSnare, $0C, dSnare, $06, dSnare, dSnare dc.b dSnare, dSnare, dSnare, dKick, $0C, dKick, dSnare, $18 dc.b dKick, $0C, dKick, dSnare, dKick, dKick, dKick, dSnare dc.b $18, dKick, $0C, dKick, dSnare, dKick, dKick, dKick dc.b dSnare, dKick, dSnare, dKick, dSnare, dKick, dKick, dKick dc.b dSnare, $18, dKick, $0C, dKick, dSnare, dSnare, dKick dc.b dKick, dSnare, $18, dKick, $0C, dKick, dSnare, dKick dc.b dKick, dKick, dSnare, $18, dKick, $0C, dKick, dSnare dc.b dKick, dKick, dKick, dSnare, dKick, dSnare, dKick, dSnare dc.b dKick, dKick, dKick, dSnare, $18, dSnare, $06, dKick dc.b dKick, $0C, dSnare, $06, dSnare, dSnare, $0C, dKick dc.b dKick, dSnare, $18, dKick, $0C, dKick, dSnare, dSnare dc.b dKick, dSnare, dSnare, dKick, dSnare, dKick, dSnare, dSnare dc.b $06, dSnare sJump ALZ_Loop6 dc.b $F2 ; Unused ALZ_PSG1: ssModZ80 $0D, $01, $02, $06 dc.b nRst, $12, nD5, $01, nE5, nF5, nG5, nA5 dc.b nB5, nC6, $30, nF5, $06, nE5, $02, nD5 dc.b nC5, nB4, $01, nA4, nG4, nF4, nE4, nD4 dc.b nC4, nB3, nA3, nG3, nF3, nE3 ALZ_Jump3: dc.b nRst, $3C, nG4, $06, nRst, nC5, nRst, nG4 dc.b nRst, nD5, nRst, nG4, nD5, nRst, nC5, nRst dc.b nE5, nRst, $30, nRst, $3C, nG4, $06, nRst dc.b nC5, nRst, nG4, nRst, nD5, nRst, nG4, nD5 dc.b nRst, nC5, nRst, nC5, nRst, $30, nRst, $12 dc.b nD5, $01, nE5, nF5, nG5, nA5, nB5, nC6 dc.b $30, nF5, $06, nE5, $02, nD5, nC5, nB4 dc.b $01, nA4, nG4, nF4, nE4, nD4, nC4, nB3 dc.b nA3, nG3, nF3, nE3, nRst, $54, nC6, $06 dc.b nRst, nC6, $12, nG5, $06, nRst, $0C, nC5 dc.b $06, nRst, nC5, $12, nG4, $06, nRst, $18 dc.b nRst, $30, nRst, $06, nE4, nG4, nC5, nG4 dc.b nC5, nE5, nG5, nRst, $0C, nC4, $06, nRst dc.b $12, nC4, $06, nRst, $2A, nC4, $06, nRst dc.b nC4, nRst, $0C, nC4, $06, nRst, $1E, nE4 dc.b $06, nG4, nC5, nG4, nC5, nE5, nG5, nRst dc.b $0C, nC4, $06, nRst, $12, nC4, $06, nRst dc.b $2A, nC4, $06, nRst, nC4, nRst, $0C, nC4 dc.b $06, nRst, $1E, nC6, $06, nG5, nE5, nG5 dc.b nE5, nC5, nG4, nRst, $0C, nC4, $08, nRst dc.b $0A, nC4, $06, nRst, $0C, nC4, $08, nRst dc.b $0A, nC4, $08, nRst, $0A, nC4, $20, nC4 dc.b $0C, nRst, $10, nC4, $06, nC4, $08, nRst dc.b $04, nC4, $08, nRst, $0A, nC4, $20, nC4 dc.b $0C, nRst, $10, nC4, $06, nC4, $08, nRst dc.b $04, nC4, $08, nRst, $0A, nC4, $18, nB3 dc.b $06, nRst, nC4, $08, nRst, $16, nE4, $06 dc.b nG4, nC5, nG4, nC5, nE5, nG5, nRst, $0C dc.b nC4, $06, nRst, $12, nC4, $06, nRst, $2A dc.b nC4, $06, nRst, nC4, nRst, $0C, nC4, $06 dc.b nRst, $1E, nE4, $06, nG4, nC5, nG4, nC5 dc.b nE5, nG5, nRst, $0C, nC4, $06, nRst, $12 dc.b nC4, $06, nRst, $2A, nC4, $06, nRst, nC4 dc.b nRst, $0C, nC4, $06, nRst, $1E, nC6, $06 dc.b nG5, nE5, nG5, nE5, nC5, nG4, nRst, $0C dc.b nC4, $08, nRst, $0A, nC4, $06, nRst, $0C dc.b nC4, $08, nRst, $0A, nC4, $08, nRst, $0A dc.b nC4, $20, nC4, $0C, nRst, $10, nC4, $06 dc.b nC4, $08, nRst, $04, nC4, $08, nRst, $0A dc.b nC4, $1E, nC4, $0C, nRst, $12, nC4, $06 dc.b nC4, nRst, nC4, nRst, $0C, nG3, $1E, nRst dc.b $06, nBb3, nRst, $12, nD4, $0C, nC4, $06 dc.b nRst, $12, nC5, $18, nB4, $06, nRst, nC5 dc.b nRst, nB4, nRst, nC5, nRst, nB4, nC5, nRst dc.b $0C, nD5, $18, nC5, $06, nRst, nD5, nRst dc.b nC5, nRst, nD5, nRst, nC5, nD5, nRst, $0C dc.b nE5, $18, nD5, $06, nRst, nE5, nRst, nD5 dc.b nRst, nE5, nRst, nD5, nC5, nRst, $0C, nF4 dc.b $1E, nRst, $06, nG4, nRst, nG4, nRst, nG4 dc.b $0C, nE4, $06, nRst, nD4, nRst, nC5, $18 dc.b nB4, $06, nRst, nC5, nRst, nB4, nRst, nC5 dc.b nRst, nB4, nC5, nRst, $0C, nD5, $18, nC5 dc.b $06, nRst, nD5, nRst, nC5, nRst, nD5, nRst dc.b nC5, nD5, nRst, $0C, nE5, $18, nD5, $06 dc.b nRst, nE5, nRst, nD5, nRst, nE5, nRst, nD5 dc.b nC5, nRst, $0C, nF4, $1E, nRst, $06, nFs4 dc.b nRst, nFs4, nRst, nG4, $0C, nRst, nA4, $06 dc.b nRst, nA4, $3C, nE5, $0C, nRst, $18, nG4 dc.b $06, nRst, nRst, $0C, nG4, $08, nRst, $28 dc.b nG4, $06, nRst, nG4, nRst, nG4, nRst sJump ALZ_Jump3 dc.b $F2 ; Unused ALZ_PSG2: sStop dc.b $F2 ; Unused ALZ_PSG3: sStop ALZ_Patches: ; Patch $00 ; $3C ; $44, $31, $12, $61, $1F, $1F, $1F, $1F ; $0A, $08, $0B, $01, $00, $0F, $00, $00 ; $1F, $3F, $5F, $1F, $21, $87, $10, $88 spAlgorithm $04 spFeedback $07 spDetune $04, $01, $03, $06 spMultiple $04, $02, $01, $01 spRateScale $00, $00, $00, $00 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $0A, $0B, $08, $01 spSustainLv $01, $05, $03, $01 spDecayRt $00, $00, $0F, $00 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $21, $10, $07, $08 ; Patch $01 ; $38 ; $75, $13, $71, $11, $DF, $5F, $1F, $1F ; $0C, $0D, $01, $01, $00, $00, $00, $00 ; $FF, $FF, $FF, $FF, $1E, $1E, $1E, $81 spAlgorithm $00 spFeedback $07 spDetune $07, $07, $01, $01 spMultiple $05, $01, $03, $01 spRateScale $03, $00, $01, $00 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $0C, $01, $0D, $01 spSustainLv $0F, $0F, $0F, $0F spDecayRt $00, $00, $00, $00 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $1E, $1E, $1E, $01 ; Patch $02 ; $3D ; $71, $51, $41, $11, $1F, $1F, $1F, $1F ; $01, $01, $01, $01, $00, $00, $00, $00 ; $FF, $FF, $FF, $FF, $20, $85, $85, $85 spAlgorithm $05 spFeedback $07 spDetune $07, $04, $05, $01 spMultiple $01, $01, $01, $01 spRateScale $00, $00, $00, $00 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $01, $01, $01, $01 spSustainLv $0F, $0F, $0F, $0F spDecayRt $00, $00, $00, $00 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $20, $05, $05, $05 ; Patch $03 ; $3D ; $51, $61, $71, $21, $1C, $18, $18, $1B ; $06, $05, $04, $05, $06, $05, $06, $06 ; $6F, $8F, $5F, $7F, $17, $80, $80, $80 spAlgorithm $05 spFeedback $07 spDetune $05, $07, $06, $02 spMultiple $01, $01, $01, $01 spRateScale $00, $00, $00, $00 spAttackRt $1C, $18, $18, $1B spAmpMod $00, $00, $00, $00 spSustainRt $06, $04, $05, $05 spSustainLv $06, $05, $08, $07 spDecayRt $06, $06, $05, $06 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $17, $00, $00, $00 ; Patch $04 ; $07 ; $78, $54, $42, $11, $1F, $1F, $1F, $1F ; $01, $01, $01, $01, $00, $00, $00, $00 ; $FF, $FF, $FF, $FF, $8A, $84, $83, $84 spAlgorithm $07 spFeedback $00 spDetune $07, $04, $05, $01 spMultiple $08, $02, $04, $01 spRateScale $00, $00, $00, $00 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $01, $01, $01, $01 spSustainLv $0F, $0F, $0F, $0F spDecayRt $00, $00, $00, $00 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $0A, $03, $04, $04
demo/tutorial/guis.adb
csb6/libtcod-ada
0
12305
with Engines, Ada.Strings.Fixed; package body GUIs is use Ada.Strings; use type Console.Y_Pos; Log_X : constant := Bar_Width + 2; Message_Height : constant := Panel_Height - 1; procedure render_bar(self : in out GUI; x : Console.X_Pos; y : Console.Y_Pos; w : Width; name : String; value, max_value : Float; bar_color, bg_color : RGB_Color) is bar_w : Width := Width(Float'Rounding(value / max_value * Float(w))); begin self.screen.set_default_bg(bg_color); self.screen.rect(x, y, w, h => 1); if bar_w > 0 then self.screen.set_default_bg(bar_color); self.screen.rect(x, y, bar_w, h => 1); end if; self.screen.set_default_fg(Color.white); self.screen.print(x, y, name & " :" & Integer(value)'Image & " /" & Integer(max_value)'Image); end render_bar; function make_GUI(screen_w : Width) return GUI is begin return self : GUI := (screen => Console.make_screen(screen_w, Panel_Height), log => <>); end make_GUI; procedure render(self : in out GUI; main_screen : in out Console.Screen; engine : in out Engines.Engine) is y : Console.Y_Pos := 1; begin self.screen.set_default_bg(Color.black); self.screen.clear; self.render_bar(1, 1, Bar_Width, "HP", Float(engine.player.destructible.hp), Float(engine.player.destructible.max_hp), bar_color => Color.light_red, bg_color => Color.dark_red); for message of self.log loop self.screen.set_default_fg(message.color); self.screen.print(Log_X, y, Log_Strings.To_String(message.text)); y := y + 1; end loop; self.screen.blit(0, 0, main_screen.get_width, Panel_Height, main_screen, 0, Console.Y_Pos(main_screen.get_height-Panel_Height)); end render; procedure log(self : in out GUI; text : String; color : RGB_Color := Libtcod.Color.light_grey) is curr_pos : Positive := text'First; newline_pos : Natural; begin loop if self.log.Length = Message_Height then self.log.Delete_First; end if; newline_pos := Fixed.Index(text, ASCII.LF & "", curr_pos); if newline_pos = 0 then self.log.Append((Log_Strings.To_Bounded_String(text(curr_pos .. text'Last), Drop => Right), color)); exit; end if; self.log.Append((Log_Strings.To_Bounded_String(text(curr_pos .. newline_pos - 1), Drop => Right), color)); curr_pos := newline_pos + 1; exit when curr_pos > text'Last; end loop; end log; end GUIs;
oeis/134/A134346.asm
neoneye/loda-programs
11
7686
<filename>oeis/134/A134346.asm<gh_stars>10-100 ; A134346: Triangle read by rows: A124929 * A007318. ; Submitted by <NAME> ; 1,3,3,7,14,7,15,45,45,15,31,124,186,124,31,63,315,630,630,315,63,127,762,1905,2540,1905,762,127,255,1785,5355,8925,8925,5355,1785,255,511,4088,14308,28616,35770,28616,14308,4088,511 lpb $0 add $1,1 sub $0,$1 mul $2,2 add $2,2 lpe bin $1,$0 mul $2,$1 add $2,$1 mov $0,$2
src/main/fragment/mos6502-common/vwum1=vwuc1_setbyte0_vbuxx.asm
jbrandwood/kickc
2
85015
stx {m1} ldx #>{c1} stx {m1}+1
Test_C.asm
LiaoHanwen/microcomputer-experiment
0
168506
;Test C ;separator is spa 20h ;terminator is cret 0dh ;macro for output output macro ostr mov dx,offset ostr mov ah,09h int 21h endm data segment buff db 80h db 0 db 80h dup(0) minnum dw 0ffffh hint db 'Input a sequence of numbers: ','$' minstr db 0dh,0ah,'The minimum number is: ','$' errstr db 0dh,0ah,'Error: Invalid input!','$' data ends stack segment stack'stack' db 10h dup(0) stack ends code segment assume cs:code,ds:data,ss:stack start: mov ax,data mov ds,ax ;ds=data output hint ;output hint mov dx,offset buff mov ah,0ah int 21h ;input numbers add dx,2 ;buff+2 mov si,dx ;set begin addr malp: mov ax,[si] ;ax=[si] add si,2 call vanuj ;judge number call comp ;compare ax with minnum mov al,[si] ;judge separator add si,1 cmp al,20h jz malp ;20h ->malp cmp al,0dh jz otpt ;0dh end ->otpt jmp inverr ;other ->inverr otpt: output minstr ;output str mov ax,minnum mov dl,ah mov ah,02h int 21h mov ax,minnum mov dl,al mov ah,02h int 21h ;output minnum mov ax,4c00h int 21h ;valid number judge ;judge if the number is valid ;ax=number si+2 or jmp invalid number error vanuj: cmp ah,30h jb innerr cmp ah,39h ja innerr cmp al,30h jb innerr cmp al,39h ja innerr ret ;compare ;minnum=the min of ax and minnum comp: mov bx,ax mov al,bh mov ah,bl ;exchange ah al mov bx,minnum cmp ax,bx jae edcp mov [minnum],ax edcp: ret innerr: pop ax ;pop ip pop ax ;pop cs inverr: output errstr mov ax,4c00h int 21h code ends end start
Transynther/x86/_processed/US/_zr_/i3-7100_9_0xca_notsx.log_264_653.asm
ljhsiun2/medusa
9
1998
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %rbp push %rcx push %rdi push %rsi lea addresses_UC_ht+0x1887f, %rsi lea addresses_A_ht+0x56bb, %rdi clflush (%rsi) nop nop nop xor $63329, %rbp mov $29, %rcx rep movsq nop and $1943, %rcx lea addresses_UC_ht+0x1372b, %rsi lea addresses_normal_ht+0x15c3b, %rdi nop inc %r14 mov $29, %rcx rep movsl nop nop nop nop nop cmp %rcx, %rcx lea addresses_WT_ht+0x1be5b, %rsi lea addresses_WT_ht+0x1303b, %rdi nop sub $10895, %r14 mov $29, %rcx rep movsw nop cmp $64106, %rbp lea addresses_normal_ht+0xe76, %rsi lea addresses_UC_ht+0x1523b, %rdi nop nop nop nop nop cmp $34641, %r13 mov $25, %rcx rep movsw nop nop cmp %r13, %r13 pop %rsi pop %rdi pop %rcx pop %rbp pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r15 push %r8 push %rbp push %rdi push %rdx // Store mov $0x4a8954000000063b, %rdx nop dec %r11 mov $0x5152535455565758, %r8 movq %r8, (%rdx) nop nop nop nop nop add $43474, %r8 // Load lea addresses_normal+0xfabb, %r8 nop nop nop nop nop xor %r15, %r15 mov (%r8), %ebp nop nop nop nop nop inc %r8 // Load lea addresses_PSE+0x1f7b, %r15 nop nop nop nop nop add $16989, %rdi mov (%r15), %edx nop nop and $58802, %rdx // Faulty Load lea addresses_US+0xaa3b, %r12 nop xor %r8, %r8 vmovups (%r12), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $1, %xmm3, %rdi lea oracles, %r15 and $0xff, %rdi shlq $12, %rdi mov (%r15,%rdi,1), %rdi pop %rdx pop %rdi pop %rbp pop %r8 pop %r15 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_NC', 'size': 8, 'AVXalign': False}} {'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_normal', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_PSE', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}} {'00': 264} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
oldstuff/tigcc/PolySnd/sources/statique/Sample_voice2.asm
bcherry/bcherry
3
23152
<gh_stars>1-10 section ".data" xdef pSnd_Sample_voice2 pSnd_Sample_voice2: move.w d0,wav_sample_voice2 rts
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_2008_565.asm
ljhsiun2/medusa
9
82500
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r15 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x15bbe, %r14 nop nop nop cmp %rbx, %rbx movb $0x61, (%r14) nop nop cmp $32700, %rdx lea addresses_WT_ht+0x12a9c, %r9 nop and %rdi, %rdi mov $0x6162636465666768, %r14 movq %r14, %xmm7 movups %xmm7, (%r9) nop xor $64792, %rbx lea addresses_A_ht+0x1da9c, %rbx nop nop nop nop add $51242, %r10 mov $0x6162636465666768, %r14 movq %r14, (%rbx) add $37210, %r9 lea addresses_D_ht+0x18e9c, %r10 nop nop nop nop and $20199, %r9 movw $0x6162, (%r10) cmp %rdi, %rdi lea addresses_WC_ht+0x15900, %rsi lea addresses_WC_ht+0x1ca9c, %rdi clflush (%rdi) and $32563, %r9 mov $73, %rcx rep movsl nop nop nop nop nop and %rbx, %rbx lea addresses_normal_ht+0x10268, %r10 clflush (%r10) nop nop nop add $4861, %r14 vmovups (%r10), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %rsi nop nop nop nop nop add %rbx, %rbx lea addresses_D_ht+0x1869c, %r14 sub $26419, %r9 movl $0x61626364, (%r14) nop nop nop nop nop xor %rdx, %rdx lea addresses_A_ht+0x1e9c, %rdx and $7629, %r9 movl $0x61626364, (%rdx) add %rbx, %rbx lea addresses_A_ht+0x1a9dc, %rdx clflush (%rdx) nop nop xor %rbx, %rbx movl $0x61626364, (%rdx) nop nop nop dec %r10 lea addresses_WT_ht+0x12e9c, %r10 nop nop nop nop nop xor %rcx, %rcx mov $0x6162636465666768, %rdi movq %rdi, %xmm1 movups %xmm1, (%r10) nop nop sub $63488, %r9 lea addresses_D_ht+0x13c00, %rsi lea addresses_UC_ht+0x18adc, %rdi nop nop xor %r9, %r9 mov $42, %rcx rep movsq nop nop cmp $45757, %rdx lea addresses_normal_ht+0x15b64, %rsi lea addresses_UC_ht+0xa49c, %rdi nop nop nop cmp $6098, %r14 mov $48, %rcx rep movsb nop nop cmp %r9, %r9 lea addresses_WT_ht+0x52ec, %r9 nop nop nop nop nop inc %rdi mov $0x6162636465666768, %rsi movq %rsi, %xmm4 and $0xffffffffffffffc0, %r9 vmovaps %ymm4, (%r9) nop nop nop nop dec %rdx lea addresses_A_ht+0xe09c, %rdx nop nop sub $12189, %rdi mov (%rdx), %esi nop and %rdx, %rdx lea addresses_D_ht+0x1ca5c, %rsi lea addresses_D_ht+0xce9c, %rdi nop nop nop xor $45908, %r14 mov $16, %rcx rep movsw sub %r15, %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %r15 push %rax push %rcx push %rsi // Load lea addresses_WC+0x1d39c, %rax nop nop nop nop inc %r11 vmovups (%rax), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $0, %xmm2, %r14 nop nop nop nop xor $61096, %rax // Store lea addresses_US+0x1c59c, %rcx nop nop nop nop cmp $63869, %r10 movb $0x51, (%rcx) nop nop nop nop xor $42843, %rcx // Store lea addresses_WT+0xee1c, %rax nop add %r14, %r14 mov $0x5152535455565758, %r11 movq %r11, %xmm7 movntdq %xmm7, (%rax) nop nop dec %r11 // Load lea addresses_D+0x8594, %rax clflush (%rax) nop nop nop nop cmp $48560, %rsi movntdqa (%rax), %xmm6 vpextrq $1, %xmm6, %rcx nop nop nop cmp $11212, %r10 // Store mov $0xcbc, %rsi nop nop add $45732, %r11 movb $0x51, (%rsi) add $9588, %r15 // Faulty Load lea addresses_A+0xe69c, %rcx nop nop xor $50149, %rax vmovups (%rcx), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %rsi lea oracles, %rax and $0xff, %rsi shlq $12, %rsi mov (%rax,%rsi,1), %rsi pop %rsi pop %rcx pop %rax pop %r15 pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}} {'00': 2008} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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/004/A004957.asm
neoneye/loda
22
89704
<reponame>neoneye/loda ; A004957: a(n) = ceiling(n*phi^2), where phi is the golden ratio, A001622. ; 0,3,6,8,11,14,16,19,21,24,27,29,32,35,37,40,42,45,48,50,53,55,58,61,63,66,69,71,74,76,79,82,84,87,90,92,95,97,100,103,105,108,110,113,116,118,121,124,126,129,131,134,137,139,142,144,147,150,152,155,158,160,163,165,168,171,173,176,179,181,184,186,189,192,194,197,199,202,205,207,210,213,215,218,220,223,226,228,231,234,236,239,241,244,247,249,252,254,257,260 seq $0,288713 ; Positions of 1 in A288711; complement of A288712. div $0,2
src/shaders/h264/ildb/AVC_ILDB_SpawnChromaRoot.asm
me176c-dev/android_hardware_intel-vaapi-driver
192
19386
<reponame>me176c-dev/android_hardware_intel-vaapi-driver /* * Copyright © <2010>, Intel Corporation. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * This file was originally licensed under the following license * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ //=============== Spawn a chroma root thread =============== //----- Create chroma root thread R0 header ----- #if defined(_DEBUG) mov (1) EntrySignature:w 0xAABA:w #endif // Restore CT_R0Hdr.4:ud to r0.4:ud // mov (1) CT_R0Hdr.4:ud r0.4:ud // R0.2: Interface Discriptor Ptr. Add child offset for child kernel add (1) CT_R0Hdr.2:ud r0.2:ud CHROMA_ROOT_OFFSET:w // Assign a new Thread Count for this child mov (1) CT_R0Hdr.6:ud 1:w // ThreadID=1 for chroma root //----- Copy luma root r1 for launching chroma root thread ----- mov (16) m2.0:w RootParam<16;16,1>:w #include "writeURB.asm" //-------------------------------------------------- // Set URB handle for child thread launching: // URB handle Length (bit 15:10) - 0000 0000 0000 0000 yyyy yy00 0000 0000 // URB handle offset (bit 9:0) - 0000 0000 0000 0000 0000 00xx xxxx xxxx or (1) CT_R0Hdr.4:ud URB_EntriesPerMB_2:w URBOffset:uw // 2 URB entries: // Entry 0 - CT_R0Hdr // Entry 1 - input parameter to child kernel //----- Spawn a child now ----- send (8) null:ud CT_R0Hdr null:ud TS TSMSGDSC // Restore CT_R0Hdr.4:ud to r0.4:ud for next use mov (1) CT_R0Hdr.4:ud r0.4:ud
programs/oeis/195/A195291.asm
karttu/loda
0
22740
; A195291: Years in the Gregorian calendar which are not (proleptic) leap years. ; 1,2,3,5,6,7,9,10,11,13,14,15,17,18,19,21,22,23,25,26,27,29,30,31,33,34,35,37,38,39,41,42,43,45,46,47,49,50,51,53,54,55,57,58,59,61,62,63,65,66,67,69,70,71,73,74,75,77,78,79,81,82,83,85,86,87,89,90,91,93,94,95,97,98,99,100 mov $3,$0 div $0,3 mov $2,6 lpb $0,1 mov $0,$2 mul $0,4 lpe mov $1,$0 add $1,1 add $1,$3
oeis/142/A142986.asm
neoneye/loda-programs
11
172033
<filename>oeis/142/A142986.asm ; A142986: a(1) = 1, a(2) = 8, a(n+2) = 8*a(n+1) + (n+1)*(n+2)*a(n). ; Submitted by <NAME> ; 1,8,70,656,6648,72864,862128,10977408,149892480,2187106560,33985025280,560578268160,9786290088960,180315565516800,3497645442816000,71256899266560000,1521414754578432000,33975929212194816000,792131279763382272000,19247903338741088256000,486678364210549260288000,12785958256182776856576000,348546918340000140558336000,9846224304132893949296640000,287897945437063235929374720000,8703229361182886954477813760000,271730192586281487258243563520000,8753482937744514435651175710720000 add $0,1 mov $3,1 lpb $0 mov $2,$3 mul $2,$0 sub $0,1 mul $3,8 add $3,$1 mov $1,$0 mul $1,$2 lpe mov $0,$2
LAB4/q2A.asm
Avigdor-Kolonimus/ASM
0
246095
<filename>LAB4/q2A.asm dseg segment N1 DB 33H,41H,58H ;first number N2 DB 56H,44H,77H ;second number N3 DB ?,?,? ;answer number dseg ends sseg segment stack dw 100h dup(?) sseg ends cseg segment assume ds:dseg,cs:cseg,ss:sseg ;procedure add N1 and N2,answer saved in N3 sum proc ;initialization mov cx,3 mov si,2 ;summation of N1 and N2 P1: mov al,N1[si] mov bl,N2[si] add al,bl DAA jnc P2 cmp si,0 je P2 mov N3[si-1],1 P2: add N3[si],al dec si loop P1 ret sum endp start: mov ax,dseg mov ds,ax ;sum of two numbers call sum ; SOF: mov ah,4ch int 21h cseg ends end start
code/decomp.asm
StardustGear/AMPS
0
178876
<reponame>StardustGear/AMPS<filename>code/decomp.asm ; --------------------------------------------------------------------------- ; KOSINSKI DECOMPRESSION PROCEDURE ; (sometimes called KOZINSKI decompression) ; ; ARGUMENTS: ; a0 = source address ; a1 = destination address ; ; For format explanation see http://info.sonicretro.org/Kosinski_compression ; New faster version by written by vladikcomper, with additional improvements by ; MarkeyJester and Flamewing ; --------------------------------------------------------------------------- _Kos_UseLUT = 1 _Kos_LoopUnroll = 3 _Kos_ExtremeUnrolling = 1 _Kos_RunBitStream macro dbra d2,.skip\@ moveq #7,d2 ; Set repeat count to 8. move.b d1,d0 ; Use the remaining 8 bits. not.w d3 ; Have all 16 bits been used up? bne.s .skip\@ ; Branch if not. move.b (a0)+,d0 ; Get desc field low-byte. move.b (a0)+,d1 ; Get desc field hi-byte. if _Kos_UseLUT=1 move.b (a4,d0.w),d0 ; Invert bit order... move.b (a4,d1.w),d1 ; ... for both bytes. endif .skip\@ endm _Kos_ReadBit macro if _Kos_UseLUT=1 add.b d0,d0 ; Get a bit from the bitstream. else lsr.b #1,d0 ; Get a bit from the bitstream. endif endm ; =========================================================================== ; KozDec_193A: KosDec: moveq #(1<<_Kos_LoopUnroll)-1,d7 if _Kos_UseLUT=1 moveq #0,d0 moveq #0,d1 lea KosDec_ByteMap(pc),a4 ; Load LUT pointer. endif move.b (a0)+,d0 ; Get desc field low-byte. move.b (a0)+,d1 ; Get desc field hi-byte. if _Kos_UseLUT=1 move.b (a4,d0.w),d0 ; Invert bit order... move.b (a4,d1.w),d1 ; ... for both bytes. endif moveq #7,d2 ; Set repeat count to 8. moveq #0,d3 ; d3 will be desc field switcher. bra.s .FetchNewCode ; --------------------------------------------------------------------------- .FetchCodeLoop: ; Code 1 (Uncompressed byte). _Kos_RunBitStream move.b (a0)+,(a1)+ .FetchNewCode: _Kos_ReadBit bcs.s .FetchCodeLoop ; If code = 1, branch. ; Codes 00 and 01. moveq #-1,d5 lea (a1),a5 _Kos_RunBitStream if _Kos_ExtremeUnrolling=1 _Kos_ReadBit bcs.w .Code_01 ; Code 00 (Dictionary ref. short). _Kos_RunBitStream _Kos_ReadBit bcs.s .Copy45 _Kos_RunBitStream _Kos_ReadBit bcs.s .Copy3 _Kos_RunBitStream move.b (a0)+,d5 ; d5 = displacement. adda.w d5,a5 move.b (a5)+,(a1)+ move.b (a5)+,(a1)+ bra.s .FetchNewCode ; --------------------------------------------------------------------------- .Copy3: _Kos_RunBitStream move.b (a0)+,d5 ; d5 = displacement. adda.w d5,a5 move.b (a5)+,(a1)+ move.b (a5)+,(a1)+ move.b (a5)+,(a1)+ bra.w .FetchNewCode ; --------------------------------------------------------------------------- .Copy45: _Kos_RunBitStream _Kos_ReadBit bcs.s .Copy5 _Kos_RunBitStream move.b (a0)+,d5 ; d5 = displacement. adda.w d5,a5 move.b (a5)+,(a1)+ move.b (a5)+,(a1)+ move.b (a5)+,(a1)+ move.b (a5)+,(a1)+ bra.w .FetchNewCode ; --------------------------------------------------------------------------- .Copy5: _Kos_RunBitStream move.b (a0)+,d5 ; d5 = displacement. adda.w d5,a5 move.b (a5)+,(a1)+ move.b (a5)+,(a1)+ move.b (a5)+,(a1)+ move.b (a5)+,(a1)+ move.b (a5)+,(a1)+ bra.w .FetchNewCode ; --------------------------------------------------------------------------- else moveq #0,d4 ; d4 will contain copy count. _Kos_ReadBit bcs.s .Code_01 ; Code 00 (Dictionary ref. short). _Kos_RunBitStream _Kos_ReadBit addx.w d4,d4 _Kos_RunBitStream _Kos_ReadBit addx.w d4,d4 _Kos_RunBitStream move.b (a0)+,d5 ; d5 = displacement. .StreamCopy: adda.w d5,a5 move.b (a5)+,(a1)+ ; Do 1 extra copy (to compensate +1 to copy counter). .copy: move.b (a5)+,(a1)+ dbra d4,.copy bra.w .FetchNewCode endif ; --------------------------------------------------------------------------- .Code_01: moveq #0,d4 ; d4 will contain copy count. ; Code 01 (Dictionary ref. long / special). _Kos_RunBitStream move.b (a0)+,d6 ; d6 = %LLLLLLLL. move.b (a0)+,d4 ; d4 = %HHHHHCCC. move.b d4,d5 ; d5 = %11111111 HHHHHCCC. lsl.w #5,d5 ; d5 = %111HHHHH CCC00000. move.b d6,d5 ; d5 = %111HHHHH LLLLLLLL. if _Kos_LoopUnroll=3 and.w d7,d4 ; d4 = %00000CCC. else andi.w #7,d4 endif bne.s .StreamCopy ; if CCC=0, branch. ; special mode (extended counter) move.b (a0)+,d4 ; Read cnt beq.s .Quit ; If cnt=0, quit decompression. subq.b #1,d4 beq.w .FetchNewCode ; If cnt=1, fetch a new code. adda.w d5,a5 move.b (a5)+,(a1)+ ; Do 1 extra copy (to compensate +1 to copy counter). move.w d4,d6 not.w d6 and.w d7,d6 add.w d6,d6 lsr.w #_Kos_LoopUnroll,d4 jmp .largecopy(pc,d6.w) ; --------------------------------------------------------------------------- .largecopy: rept (1<<_Kos_LoopUnroll) move.b (a5)+,(a1)+ endr dbra d4,.largecopy bra.w .FetchNewCode ; --------------------------------------------------------------------------- if _Kos_ExtremeUnrolling=1 .StreamCopy: adda.w d5,a5 move.b (a5)+,(a1)+ ; Do 1 extra copy (to compensate +1 to copy counter). if _Kos_LoopUnroll=3 eor.w d7,d4 else eori.w #7,d4 endif add.w d4,d4 jmp .mediumcopy(pc,d4.w) ; --------------------------------------------------------------------------- .mediumcopy: rept 8 move.b (a5)+,(a1)+ endr bra.w .FetchNewCode endif ; --------------------------------------------------------------------------- .Quit: rts ; End of function KosDec. ; =========================================================================== if _Kos_UseLUT=1 KosDec_ByteMap: dc.b $00,$80,$40,$C0,$20,$A0,$60,$E0,$10,$90,$50,$D0,$30,$B0,$70,$F0 dc.b $08,$88,$48,$C8,$28,$A8,$68,$E8,$18,$98,$58,$D8,$38,$B8,$78,$F8 dc.b $04,$84,$44,$C4,$24,$A4,$64,$E4,$14,$94,$54,$D4,$34,$B4,$74,$F4 dc.b $0C,$8C,$4C,$CC,$2C,$AC,$6C,$EC,$1C,$9C,$5C,$DC,$3C,$BC,$7C,$FC dc.b $02,$82,$42,$C2,$22,$A2,$62,$E2,$12,$92,$52,$D2,$32,$B2,$72,$F2 dc.b $0A,$8A,$4A,$CA,$2A,$AA,$6A,$EA,$1A,$9A,$5A,$DA,$3A,$BA,$7A,$FA dc.b $06,$86,$46,$C6,$26,$A6,$66,$E6,$16,$96,$56,$D6,$36,$B6,$76,$F6 dc.b $0E,$8E,$4E,$CE,$2E,$AE,$6E,$EE,$1E,$9E,$5E,$DE,$3E,$BE,$7E,$FE dc.b $01,$81,$41,$C1,$21,$A1,$61,$E1,$11,$91,$51,$D1,$31,$B1,$71,$F1 dc.b $09,$89,$49,$C9,$29,$A9,$69,$E9,$19,$99,$59,$D9,$39,$B9,$79,$F9 dc.b $05,$85,$45,$C5,$25,$A5,$65,$E5,$15,$95,$55,$D5,$35,$B5,$75,$F5 dc.b $0D,$8D,$4D,$CD,$2D,$AD,$6D,$ED,$1D,$9D,$5D,$DD,$3D,$BD,$7D,$FD dc.b $03,$83,$43,$C3,$23,$A3,$63,$E3,$13,$93,$53,$D3,$33,$B3,$73,$F3 dc.b $0B,$8B,$4B,$CB,$2B,$AB,$6B,$EB,$1B,$9B,$5B,$DB,$3B,$BB,$7B,$FB dc.b $07,$87,$47,$C7,$27,$A7,$67,$E7,$17,$97,$57,$D7,$37,$B7,$77,$F7 dc.b $0F,$8F,$4F,$CF,$2F,$AF,$6F,$EF,$1F,$9F,$5F,$DF,$3F,$BF,$7F,$FF endif ; =========================================================================== ; ============================================================================== ; ------------------------------------------------------------------------------ ; Nemesis decompression routine ; ------------------------------------------------------------------------------ ; Optimized by vladikcomper ; ------------------------------------------------------------------------------ NemDec_RAM: lea NemDec_WriteRowToRAM(pc),a3 NemDec_Main: lea Buffer+$3000,a1 ; load Nemesis decompression buffer move.w (a0)+,d2 ; get number of patterns bpl.s .0 ; are we in Mode 0? lea $A(a3),a3 ; if not, use Mode 1 .0 lsl.w #3,d2 movea.w d2,a5 moveq #7,d3 moveq #0,d2 moveq #0,d4 bsr.w NemDec4 move.b (a0)+,d5 ; get first byte of compressed data asl.w #8,d5 ; shift up by a byte move.b (a0)+,d5 ; get second byte of compressed data move.w #$10,d6 ; set initial shift value bsr.s NemDec2 rts ; --------------------------------------------------------------------------- ; Part of the Nemesis decompressor, processes the actual compressed data ; --------------------------------------------------------------------------- NemDec2: move.w d6,d7 subq.w #8,d7 ; get shift value move.w d5,d1 lsr.w d7,d1 ; shift so that high bit of the code is in bit position 7 cmpi.b #%11111100,d1 ; are the high 6 bits set? bcc.s NemDec_InlineData ; if they are, it signifies inline data andi.w #$FF,d1 add.w d1,d1 sub.b (a1,d1.w),d6 ; ~~ subtract from shift value so that the next code is read next time around cmpi.w #9,d6 ; does a new byte need to be read? bcc.s .0 ; if not, branch addq.w #8,d6 asl.w #8,d5 move.b (a0)+,d5 ; read next byte .0 move.b 1(a1,d1.w),d1 move.w d1,d0 andi.w #$F,d1 ; get palette index for pixel andi.w #$F0,d0 NemDec_GetRepeatCount: lsr.w #4,d0 ; get repeat count NemDec_WritePixel: lsl.l #4,d4 ; shift up by a nybble or.b d1,d4 ; write pixel dbf d3,NemDec_WritePixelLoop; ~~ jmp (a3) ; otherwise, write the row to its destination ; --------------------------------------------------------------------------- NemDec3: moveq #0,d4 ; reset row moveq #7,d3 ; reset nybble counter NemDec_WritePixelLoop: dbf d0,NemDec_WritePixel bra.s NemDec2 ; --------------------------------------------------------------------------- NemDec_InlineData: subq.w #6,d6 ; 6 bits needed to signal inline data cmpi.w #9,d6 bcc.s .0 addq.w #8,d6 asl.w #8,d5 move.b (a0)+,d5 .0 subq.w #7,d6 ; and 7 bits needed for the inline data itself move.w d5,d1 lsr.w d6,d1 ; shift so that low bit of the code is in bit position 0 move.w d1,d0 andi.w #$F,d1 ; get palette index for pixel andi.w #$70,d0 ; high nybble is repeat count for pixel cmpi.w #9,d6 bcc.s NemDec_GetRepeatCount addq.w #8,d6 asl.w #8,d5 move.b (a0)+,d5 bra.s NemDec_GetRepeatCount ; --------------------------------------------------------------------------- ; Subroutines to output decompressed entry ; Selected depending on current decompression mode ; --------------------------------------------------------------------------- NemDec_WriteRowToVDP: loc_1502: move.l d4,(a4) ; write 8-pixel row subq.w #1,a5 move.w a5,d4 ; have all the 8-pixel rows been written? bne.s NemDec3 ; if not, branch rts ; --------------------------------------------------------------------------- NemDec_WriteRowToVDP_XOR: eor.l d4,d2 ; XOR the previous row by the current row move.l d2,(a4) ; and write the result subq.w #1,a5 move.w a5,d4 bne.s NemDec3 rts ; --------------------------------------------------------------------------- NemDec_WriteRowToRAM: move.l d4,(a4)+ ; write 8-pixel row subq.w #1,a5 move.w a5,d4 ; have all the 8-pixel rows been written? bne.s NemDec3 ; if not, branch rts ; --------------------------------------------------------------------------- NemDec_WriteRowToRAM_XOR: eor.l d4,d2 ; XOR the previous row by the current row move.l d2,(a4)+ ; and write the result subq.w #1,a5 move.w a5,d4 bne.s NemDec3 rts ; --------------------------------------------------------------------------- ; Part of the Nemesis decompressor, builds the code table (in RAM) ; --------------------------------------------------------------------------- NemDec4: move.b (a0)+,d0 ; read first byte .ChkEnd: cmpi.b #$FF,d0 ; has the end of the code table description been reached? bne.s .NewPalIndex ; if not, branch rts ; --------------------------------------------------------------------------- .NewPalIndex: move.w d0,d7 .ItemLoop: move.b (a0)+,d0 ; read next byte bmi.s .ChkEnd ; ~~ move.b d0,d1 andi.w #$F,d7 ; get palette index andi.w #$70,d1 ; get repeat count for palette index or.w d1,d7 ; combine the two andi.w #$F,d0 ; get the length of the code in bits move.b d0,d1 lsl.w #8,d1 or.w d1,d7 ; combine with palette index and repeat count to form code table entry moveq #8,d1 sub.w d0,d1 ; is the code 8 bits long? bne.s .ItemShortCode ; if not, a bit of extra processing is needed move.b (a0)+,d0 ; get code add.w d0,d0 ; each code gets a word-sized entry in the table move.w d7,(a1,d0.w) ; store the entry for the code bra.s .ItemLoop ; repeat ; --------------------------------------------------------------------------- .ItemShortCode: move.b (a0)+,d0 ; get code lsl.w d1,d0 ; shift so that high bit is in bit position 7 add.w d0,d0 ; get index into code table moveq #1,d5 lsl.w d1,d5 subq.w #1,d5 ; d5 = 2^d1 - 1 lea (a1,d0.w),a6 ; ~~ .ItemShortCodeLoop: move.w d7,(a6)+ ; ~~ store entry dbf d5,.ItemShortCodeLoop ; repeat for required number of entries bra.s .ItemLoop ; =============================================================== ; --------------------------------------------------------------- ; COMPER Decompressor ; --------------------------------------------------------------- ; INPUT: ; a0 - Source Offset ; a1 - Destination Offset ; --------------------------------------------------------------- CompDec: .newblock move.w (a0)+,d0 ; fetch description field moveq #15,d3 ; set bits counter to 16 .mainloop add.w d0,d0 ; roll description field bcs.s .flag ; if a flag issued, branch move.w (a0)+,(a1)+ ; otherwise, do uncompressed data dbf d3,.mainloop ; if bits counter remains, parse the next word bra.s .newblock ; start a new block ; --------------------------------------------------------------- .flag moveq #-1,d1 ; init displacement move.b (a0)+,d1 ; load displacement add.w d1,d1 moveq #0,d2 ; init copy count move.b (a0)+,d2 ; load copy length beq.s .end ; if zero, branch lea (a1,d1),a2 ; load start copy address .loop move.w (a2)+,(a1)+ ; copy given sequence dbf d2,.loop ; repeat dbf d3,.mainloop ; if bits counter remains, parse the next word bra.s .newblock ; start a new block .end rts ; --------------------------------------------------------------------------- ; Enigma decompression algorithm ; input: ; d0 = starting art tile (added to each 8x8 before writing to destination) ; a0 = source address ; a1 = destination address ; usage: ; lea (source).l,a0 ; lea (destination).l,a1 ; move.w #arttile,d0 ; bsr.w EniDec ; See http://www.segaretro.org/Enigma_compression for format description ; --------------------------------------------------------------------------- EniDec: movea.w d0,a3 ; store starting art tile move.b (a0)+,d0 ext.w d0 movea.w d0,a5 ; store number of bits in inline copy value move.b (a0)+,d4 lsl.b #3,d4 ; store PCCVH flags bitfield movea.w (a0)+,a2 adda.w a3,a2 ; store incremental copy word movea.w (a0)+,a4 adda.w a3,a4 ; store literal copy word move.b (a0)+,d5 asl.w #8,d5 move.b (a0)+,d5 ; get first word in format list moveq #16,d6 ; initial shift value ; loc_173E: Eni_Loop: moveq #7,d0 ; assume a format list entry is 7 bits move.w d6,d7 sub.w d0,d7 move.w d5,d1 lsr.w d7,d1 andi.w #$7F,d1 ; get format list entry move.w d1,d2 ; and copy it cmpi.w #$40,d1 ; is the high bit of the entry set? bhs.s .sevenbitentry moveq #6,d0 ; if it isn't, the entry is actually 6 bits lsr.w #1,d2 ; loc_1758: .sevenbitentry: bsr.w EniDec_FetchByte andi.w #$F,d2 ; get repeat count lsr.w #4,d1 add.w d1,d1 jmp EniDec_Index(pc,d1.w) ; End of function EniDec ; =========================================================================== ; loc_1768: EniDec_00: .loop: move.w a2,(a1)+ ; copy incremental copy word addq.w #1,a2 ; increment it dbf d2,.loop ; repeat bra.s Eni_Loop ; =========================================================================== ; loc_1772: EniDec_01: .loop: move.w a4,(a1)+ ; copy literal copy word dbf d2,.loop ; repeat bra.s Eni_Loop ; =========================================================================== ; loc_177A: EniDec_100: bsr.w EniDec_FetchInlineValue ; loc_177E: .loop: move.w d1,(a1)+ ; copy inline value dbf d2,.loop ; repeat bra.s Eni_Loop ; =========================================================================== ; loc_1786: EniDec_101: bsr.w EniDec_FetchInlineValue ; loc_178A: .loop: move.w d1,(a1)+ ; copy inline value addq.w #1,d1 ; increment dbf d2,.loop ; repeat bra.s Eni_Loop ; =========================================================================== ; loc_1794: EniDec_110: bsr.w EniDec_FetchInlineValue ; loc_1798: .loop: move.w d1,(a1)+ ; copy inline value subq.w #1,d1 ; decrement dbf d2,.loop ; repeat bra.s Eni_Loop ; =========================================================================== ; loc_17A2: EniDec_111: cmpi.w #$F,d2 beq.s EniDec_Done ; loc_17A8: .loop: bsr.w EniDec_FetchInlineValue ; fetch new inline value move.w d1,(a1)+ ; copy it dbf d2,.loop ; and repeat bra.s Eni_Loop ; =========================================================================== ; loc_17B4: EniDec_Index: bra.s EniDec_00 bra.s EniDec_00 bra.s EniDec_01 bra.s EniDec_01 bra.s EniDec_100 bra.s EniDec_101 bra.s EniDec_110 bra.s EniDec_111 ; =========================================================================== ; loc_17C4: EniDec_Done: subq.w #1,a0 ; go back by one byte cmpi.w #16,d6 ; were we going to start on a completely new byte? bne.s .notnewbyte ; if not, branch subq.w #1,a0 ; and another one if needed ; loc_17CE: .notnewbyte: move.w a0,d0 lsr.w #1,d0 ; are we on an odd byte? bcc.s .evenbyte ; if not, branch addq.w #1,a0 ; ensure we're on an even byte ; loc_17D6: .evenbyte: rts ; --------------------------------------------------------------------------- ; Part of the Enigma decompressor ; Fetches an inline copy value and stores it in d1 ; --------------------------------------------------------------------------- ; loc_17DC: EniDec_FetchInlineValue: move.w a3,d3 ; copy starting art tile move.b d4,d1 ; copy PCCVH bitfield add.b d1,d1 ; is the priority bit set? bcc.s .skippriority ; if not, branch subq.w #1,d6 btst d6,d5 ; is the priority bit set in the inline render flags? beq.s .skippriority ; if not, branch ori.w #$8000,d3 ; otherwise set priority bit in art tile ; loc_17EE: .skippriority: add.b d1,d1 ; is the high palette line bit set? bcc.s .skiphighpal ; if not, branch subq.w #1,d6 btst d6,d5 beq.s .skiphighpal addi.w #$4000,d3 ; set second palette line bit ; loc_17FC: .skiphighpal: add.b d1,d1 ; is the low palette line bit set? bcc.s .skiplowpal ; if not, branch subq.w #1,d6 btst d6,d5 beq.s .skiplowpal addi.w #$2000,d3 ; set first palette line bit ; loc_180A: .skiplowpal: add.b d1,d1 ; is the vertical flip flag set? bcc.s .skipyflip ; if not, branch subq.w #1,d6 btst d6,d5 beq.s .skipyflip ori.w #$1000,d3 ; set Y-flip bit ; loc_1818: .skipyflip: add.b d1,d1 ; is the horizontal flip flag set? bcc.s .skipxflip ; if not, branch subq.w #1,d6 btst d6,d5 beq.s .skipxflip ori.w #$800,d3 ; set X-flip bit ; loc_1826: .skipxflip: move.w d5,d1 move.w d6,d7 sub.w a5,d7 ; subtract length in bits of inline copy value bcc.s .enoughbits ; branch if a new word doesn't need to be read move.w d7,d6 addi.w #16,d6 neg.w d7 ; calculate bit deficit lsl.w d7,d1 ; and make space for that many bits move.b (a0),d5 ; get next byte rol.b d7,d5 ; and rotate the required bits into the lowest positions add.w d7,d7 and.w EniDec_Masks-2(pc,d7.w),d5 add.w d5,d1 ; combine upper bits with lower bits ; loc_1844: .maskvalue: move.w a5,d0 ; get length in bits of inline copy value add.w d0,d0 and.w EniDec_Masks-2(pc,d0.w),d1 ; mask value appropriately add.w d3,d1 ; add starting art tile move.b (a0)+,d5 lsl.w #8,d5 move.b (a0)+,d5 ; get next word rts ; =========================================================================== ; loc_1856: .enoughbits: beq.s .justenough ; if the word has been exactly exhausted, branch lsr.w d7,d1 ; get inline copy value move.w a5,d0 add.w d0,d0 and.w EniDec_Masks-2(pc,d0.w),d1 ; and mask it appropriately add.w d3,d1 ; add starting art tile move.w a5,d0 bra.s EniDec_FetchByte ; =========================================================================== ; loc_1868: .justenough: moveq #16,d6 ; reset shift value bra.s .maskvalue ; =========================================================================== ; word_186C: EniDec_Masks: dc.w 1, 3, 7, $F dc.w $1F, $3F, $7F, $FF dc.w $1FF, $3FF, $7FF, $FFF dc.w $1FFF,$3FFF,$7FFF,$FFFF ; =========================================================================== ; sub_188C: EniDec_FetchByte: sub.w d0,d6 ; subtract length of current entry from shift value so that next entry is read next time around cmpi.w #9,d6 ; does a new byte need to be read? bhs.s .locret ; if not, branch addq.w #8,d6 asl.w #8,d5 move.b (a0)+,d5 .locret: rts ; End of function EniDec_FetchByte ; ===========================================================================
oeis/341/A341859.asm
neoneye/loda-programs
11
26540
; A341859: Decimal expansion of 4 - (8/5)*sqrt(5). ; Submitted by <NAME> ; 4,2,2,2,9,1,2,3,6,0,0,0,3,3,6,4,8,5,7,4,5,3,2,2,1,3,0,0,2,9,9,5,8,0,2,3,2,9,5,0,1,0,6,2,4,6,2,1,5,5,8,8,4,1,1,6,6,5,6,4,4,0,7,3,4,3,1,6,6,5,1,8,9,7,9,5,1,2,1,6,0,9,3,6,9,3,6,9,4,6,5,9,3,9,4,8,3,6 mov $3,$0 mul $3,2 lpb $3 add $6,$2 add $1,$6 add $1,64 mov $5,$2 mov $2,$1 mul $2,16 sub $3,1 lpe mov $1,$5 mov $4,10 pow $4,$0 mul $4,4 div $2,$4 add $2,1 div $1,$2 mov $0,$1 add $0,$4 mod $0,10
RW/Language/FinTerm.agda
VictorCMiraldo/agda-rw
16
14083
open import Prelude renaming (_++_ to _++-List_) open import Data.Maybe using (Maybe; just; nothing) open import Data.Nat using (ℕ; suc; zero; _+_; _≤_; z≤n; s≤s; _≤?_) renaming (decTotalOrder to decTotalOrder-ℕ) open import Data.Nat.Properties as ℕ-Props open import Data.Nat.Properties.Simple using (+-suc; +-comm) open import Data.Fin using (Fin; toℕ; fromℕ≤) renaming (inject+ to finject; raise to fraise; zero to fzero; suc to fsuc) open import Relation.Binary.PropositionalEquality as P using (_≡_; refl; cong; sym) open import Algebra using (module CommutativeSemiring; module DistributiveLattice) open import Relation.Binary using (module DecTotalOrder) open import RW.Language.RTerm open import RW.Language.RTermUtils using (typeArity; typeResult) -- Utility Module to handle (RTerm (Fin n)), or, -- finite-scope terms. -- -- Adapted from "Auto In Agda", by <NAME> and <NAME>. -- https://github.com/pepijnkokke/AutoInAgda -- module RW.Language.FinTerm where ----------------------------------------- -- Unification/Instantiation -- by Structural Recursion -- -- We have to bypass some problems with the termination checker; -- The trick is to represent variables using a finite datatype, -- this way we can prove that the index of the variables to be -- replaced decreases. -- -- To work with FinTerms, as we'll call them: FinTerm : ℕ → Set FinTerm = RTerm ∘ Fin -- We're going to need a lot of machinery to inject and raise -- FinTerms in loads of different contexts. -- -- The beginning of this module is reserved for that boilerplate. -- -------------------------------------------- -- Fin Boilerplate record Inject (T : ℕ → Set) : Set where constructor inj field inject : ∀ {m} n → T m → T (m + n) inject≤ : ∀ {m n} → m ≤ n → T m → T n inject≤ {m} {n} p t = P.subst T (sym (Δ-correct p)) (inject (Δ p) t) open Inject {{...}} using (inject; inject≤) record Raise (T : ℕ → Set) : Set where constructor rai field raise : ∀ {m} n → T m → T (n + m) raise≤ : ∀ {m n} → m ≤ n → T m → T n raise≤ {m} {n} p t = P.subst T (sym (P.trans (Δ-correct p) (+-comm m (Δ p)))) (raise (Δ p) t) open Raise {{...}} using (raise; raise≤) instance InjectFin : Inject Fin InjectFin = inj finject RaiseFin : Raise Fin RaiseFin = rai fraise InjectRTerm : Inject FinTerm InjectRTerm = inj (λ n → replace-A (ovar ∘ inject n)) RaiseRTerm : Raise FinTerm RaiseRTerm = rai (λ n → replace-A (ovar ∘ raise n)) InjectRTerms : Inject (List ∘ FinTerm) InjectRTerms = inj (λ n → map (inject n)) RaiseRTerms : Raise (List ∘ FinTerm) RaiseRTerms = rai (λ n → map (raise n)) open DistributiveLattice ℕ-Props.distributiveLattice using (_∧_; ∧-comm) public open DecTotalOrder decTotalOrder-ℕ using (total) public private supremumLemma : ∀{m n} → m ≤ n → m ∧ n ≡ n supremumLemma z≤n = refl supremumLemma (s≤s p) = cong suc (supremumLemma p) -- Match indexes of injectable types. match : ∀{m n} {I J} ⦃ i : Inject I ⦄ ⦃ j : Inject J ⦄ → I m → J n → I (m ∧ n) × J (m ∧ n) match {m} {n} i j with total m n ...| i1 m≤n rewrite supremumLemma m≤n = inject≤ m≤n i , j ...| i2 n≤m rewrite ∧-comm m n | supremumLemma n≤m = i , inject≤ n≤m j -- Conversion of regular terms to finite terms. mutual R2FinTerm : RTerm ℕ → ∃ FinTerm R2FinTerm (ovar x) = suc x , ovar (fromℕ x) R2FinTerm (ivar n) = 0 , ivar n R2FinTerm (rlit l) = 0 , rlit l R2FinTerm (rlam t) with R2FinTerm t ...| (n , t') = n , rlam t' R2FinTerm (rapp n ts) with R2FinTerm* ts ...| (k , l) = k , rapp n l R2FinTerm* : List (RTerm ℕ) → ∃ (List ∘ FinTerm) R2FinTerm* [] = 0 , [] R2FinTerm* (x ∷ xs) with R2FinTerm x | R2FinTerm* xs ...| kx , x' | kxs , xs' with match x' xs' ...| rx , rxs = kx ∧ kxs , rx ∷ rxs Fin2RTerm : ∀{n} → FinTerm n → RTerm ℕ Fin2RTerm = replace-A (ovar ∘ toℕ) R2FinType : RTerm ℕ → ∃ FinTerm R2FinType t with typeArity t ...| ar = ar , replace-A fix-ovars t where fix-ovars : ℕ → FinTerm ar fix-ovars fn with suc fn ≤? ar ...| yes prf = ovar (fromℕ≤ prf) ...| no _ = ivar fn Fin2RTerm⊥ : FinTerm zero → RTerm ⊥ Fin2RTerm⊥ = replace-A (λ ())
src/http/util-http-rest.ads
Letractively/ada-util
0
10804
----------------------------------------------------------------------- -- util-http-rest -- REST API support -- Copyright (C) 2012, 2013 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Serialize.IO; with Util.Http.Clients; with Util.Serialize.Mappers.Record_Mapper; -- The <b>Util.Http.Rest</b> package defines a REST client type which helps in writing -- REST client APIs. A REST client is similar to an HTTP client but it provides additional -- operations that are useful in REST APIs. package Util.Http.Rest is -- ----------------------- -- REST client -- ----------------------- type Client is new Util.Http.Clients.Client with private; -- Execute an HTTP GET operation using the <b>Http</b> client on the given <b>URI</b>. -- Upon successful reception of the response, parse the JSON result and populate the -- serialization context associated with the parser. procedure Get (Http : in out Client; URI : in String; Parser : in out Util.Serialize.IO.Parser'Class); -- Execute an HTTP GET operation on the given <b>URI</b> and parse the JSON response -- into the target object refered to by <b>Into</b> by using the mapping described -- in <b>Mapping</b>. generic -- Package that maps the element into a record. with package Element_Mapper is new Util.Serialize.Mappers.Record_Mapper (<>); procedure Rest_Get (URI : in String; Mapping : in Util.Serialize.Mappers.Mapper_Access; Path : in String := ""; Into : in Element_Mapper.Element_Type_Access); private type Client is new Util.Http.Clients.Client with record Status : Natural := 0; end record; end Util.Http.Rest;
src/04,9034-TitleTextBeenHooked.asm
JixunMoe/ContraNES1TranslationPatch
1
23127
<filename>src/04,9034-TitleTextBeenHooked.asm ; 04:9034 ; 011044 ;>04:9034:C9 11 CMP #$11 ; 04:9036:B0 65 BCS $909D .org $9034 jmp $ADC0
tools-src/gnu/gcc/gcc/ada/g-spipat.ads
enfoTek/tomato.linksys.e2000.nvram-mod
80
25806
<filename>tools-src/gnu/gcc/gcc/ada/g-spipat.ads ------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . S P I T B O L . P A T T E R N S -- -- -- -- S p e c -- -- -- -- $Revision$ -- -- -- Copyright (C) 1997-1999 Ada Core Technologies, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- SPITBOL-like pattern construction and matching -- This child package of GNAT.SPITBOL provides a complete implementation -- of the SPITBOL-like pattern construction and matching operations. This -- package is based on Macro-SPITBOL created by <NAME>. ------------------------------------------------------------ -- Summary of Pattern Matching Packages in GNAT Hierarchy -- ------------------------------------------------------------ -- There are three related packages that perform pattern maching functions. -- the following is an outline of these packages, to help you determine -- which is best for your needs. -- GNAT.Regexp (files g-regexp.ads/g-regexp.adb) -- This is a simple package providing Unix-style regular expression -- matching with the restriction that it matches entire strings. It -- is particularly useful for file name matching, and in particular -- it provides "globbing patterns" that are useful in implementing -- unix or DOS style wild card matching for file names. -- GNAT.Regpat (files g-regpat.ads/g-regpat.adb) -- This is a more complete implementation of Unix-style regular -- expressions, copied from the original V7 style regular expression -- library written in C by <NAME>. It is functionally the -- same as this library, and uses the same internal data structures -- stored in a binary compatible manner. -- GNAT.Spitbol.Patterns (files g-spipat.ads/g-spipat.adb) -- This is a completely general patterm matching package based on the -- pattern language of SNOBOL4, as implemented in SPITBOL. The pattern -- language is modeled on context free grammars, with context sensitive -- extensions that provide full (type 0) computational capabilities. with Ada.Finalization; use Ada.Finalization; with Ada.Strings.Maps; use Ada.Strings.Maps; with Ada.Text_IO; use Ada.Text_IO; package GNAT.Spitbol.Patterns is pragma Elaborate_Body (Patterns); ------------------------------- -- Pattern Matching Tutorial -- ------------------------------- -- A pattern matching operation (a call to one of the Match subprograms) -- takes a subject string and a pattern, and optionally a replacement -- string. The replacement string option is only allowed if the subject -- is a variable. -- The pattern is matched against the subject string, and either the -- match fails, or it succeeds matching a contiguous substring. If a -- replacement string is specified, then the subject string is modified -- by replacing the matched substring with the given replacement. -- Concatenation and Alternation -- ============================= -- A pattern consists of a series of pattern elements. The pattern is -- built up using either the concatenation operator: -- A & B -- which means match A followed immediately by matching B, or the -- alternation operator: -- A or B -- which means first attempt to match A, and then if that does not -- succeed, match B. -- There is full backtracking, which means that if a given pattern -- element fails to match, then previous alternatives are matched. -- For example if we have the pattern: -- (A or B) & (C or D) & (E or F) -- First we attempt to match A, if that succeeds, then we go on to try -- to match C, and if that succeeds, we go on to try to match E. If E -- fails, then we try F. If F fails, then we go back and try matching -- D instead of C. Let's make this explicit using a specific example, -- and introducing the simplest kind of pattern element, which is a -- literal string. The meaning of this pattern element is simply to -- match the characters that correspond to the string characters. Now -- let's rewrite the above pattern form with specific string literals -- as the pattern elements: -- ("ABC" or "AB") & ("DEF" or "CDE") & ("GH" or "IJ") -- The following strings will be attempted in sequence: -- ABC . DEF . GH -- ABC . DEF . IJ -- ABC . CDE . GH -- ABC . CDE . IJ -- AB . DEF . GH -- AB . DEF . IJ -- AB . CDE . GH -- AB . CDE . IJ -- Here we use the dot simply to separate the pieces of the string -- matched by the three separate elements. -- Moving the Start Point -- ====================== -- A pattern is not required to match starting at the first character -- of the string, and is not required to match to the end of the string. -- The first attempt does indeed attempt to match starting at the first -- character of the string, trying all the possible alternatives. But -- if all alternatives fail, then the starting point of the match is -- moved one character, and all possible alternatives are attempted at -- the new anchor point. -- The entire match fails only when every possible starting point has -- been attempted. As an example, suppose that we had the subject -- string -- "ABABCDEIJKL" -- matched using the pattern in the previous example: -- ("ABC" or "AB") & ("DEF" or "CDE") & ("GH" or "IJ") -- would succeed, afer two anchor point moves: -- "ABABCDEIJKL" -- ^^^^^^^ -- matched -- section -- This mode of pattern matching is called the unanchored mode. It is -- also possible to put the pattern matcher into anchored mode by -- setting the global variable Anchored_Mode to True. This will cause -- all subsequent matches to be performed in anchored mode, where the -- match is required to start at the first character. -- We will also see later how the effect of an anchored match can be -- obtained for a single specified anchor point if this is desired. -- Other Pattern Elements -- ====================== -- In addition to strings (or single characters), there are many special -- pattern elements that correspond to special predefined alternations: -- Arb Matches any string. First it matches the null string, and -- then on a subsequent failure, matches one character, and -- then two characters, and so on. It only fails if the -- entire remaining string is matched. -- Bal Matches a non-empty string that is parentheses balanced -- with respect to ordinary () characters. Examples of -- balanced strings are "ABC", "A((B)C)", and "A(B)C(D)E". -- Bal matches the shortest possible balanced string on the -- first attempt, and if there is a subsequent failure, -- attempts to extend the string. -- Cancel Immediately aborts the entire pattern match, signalling -- failure. This is a specialized pattern element, which is -- useful in conjunction with some of the special pattern -- elements that have side effects. -- Fail The null alternation. Matches no possible strings, so it -- always signals failure. This is a specialized pattern -- element, which is useful in conjunction with some of the -- special pattern elements that have side effects. -- Fence Matches the null string at first, and then if a failure -- causes alternatives to be sought, aborts the match (like -- a Cancel). Note that using Fence at the start of a pattern -- has the same effect as matching in anchored mode. -- Rest Matches from the current point to the last character in -- the string. This is a specialized pattern element, which -- is useful in conjunction with some of the special pattern -- elements that have side effects. -- Succeed Repeatedly matches the null string (it is equivalent to -- the alternation ("" or "" or "" ....). This is a special -- pattern element, which is useful in conjunction with some -- of the special pattern elements that have side effects. -- Pattern Construction Functions -- ============================== -- The following functions construct additional pattern elements -- Any(S) Where S is a string, matches a single character that is -- any one of the characters in S. Fails if the current -- character is not one of the given set of characters. -- Arbno(P) Where P is any pattern, matches any number of instances -- of the pattern, starting with zero occurrences. It is -- thus equivalent to ("" or (P & ("" or (P & ("" ....)))). -- The pattern P may contain any number of pattern elements -- including the use of alternatiion and concatenation. -- Break(S) Where S is a string, matches a string of zero or more -- characters up to but not including a break character -- that is one of the characters given in the string S. -- Can match the null string, but cannot match the last -- character in the string, since a break character is -- required to be present. -- BreakX(S) Where S is a string, behaves exactly like Break(S) when -- it first matches, but if a string is successfully matched, -- then a susequent failure causes an attempt to extend the -- matched string. -- Fence(P) Where P is a pattern, attempts to match the pattern P -- including trying all possible alternatives of P. If none -- of these alternatives succeeds, then the Fence pattern -- fails. If one alternative succeeds, then the pattern -- match proceeds, but on a subsequent failure, no attempt -- is made to search for alternative matches of P. The -- pattern P may contain any number of pattern elements -- including the use of alternatiion and concatenation. -- Len(N) Where N is a natural number, matches the given number of -- characters. For example, Len(10) matches any string that -- is exactly ten characters long. -- NotAny(S) Where S is a string, matches a single character that is -- not one of the characters of S. Fails if the current -- characer is one of the given set of characters. -- NSpan(S) Where S is a string, matches a string of zero or more -- characters that is among the characters given in the -- string. Always matches the longest possible such string. -- Always succeeds, since it can match the null string. -- Pos(N) Where N is a natural number, matches the null string -- if exactly N characters have been matched so far, and -- otherwise fails. -- Rpos(N) Where N is a natural number, matches the null string -- if exactly N characters remain to be matched, and -- otherwise fails. -- Rtab(N) Where N is a natural number, matches characters from -- the current position until exactly N characters remain -- to be matched in the string. Fails if fewer than N -- unmatched characters remain in the string. -- Tab(N) Where N is a natural number, matches characters from -- the current position until exactly N characters have -- been matched in all. Fails if more than N characters -- have already been matched. -- Span(S) Where S is a string, matches a string of one or more -- characters that is among the characters given in the -- string. Always matches the longest possible such string. -- Fails if the current character is not one of the given -- set of characters. -- Recursive Pattern Matching -- ========================== -- The plus operator (+P) where P is a pattern variable, creates -- a recursive pattern that will, at pattern matching time, follow -- the pointer to obtain the referenced pattern, and then match this -- pattern. This may be used to construct recursive patterns. Consider -- for example: -- P := ("A" or ("B" & (+P))) -- On the first attempt, this pattern attempts to match the string "A". -- If this fails, then the alternative matches a "B", followed by an -- attempt to match P again. This second attempt first attempts to -- match "A", and so on. The result is a pattern that will match a -- string of B's followed by a single A. -- This particular example could simply be written as NSpan('B') & 'A', -- but the use of recursive patterns in the general case can construct -- complex patterns which could not otherwise be built. -- Pattern Assignment Operations -- ============================= -- In addition to the overall result of a pattern match, which indicates -- success or failure, it is often useful to be able to keep track of -- the pieces of the subject string that are matched by individual -- pattern elements, or subsections of the pattern. -- The pattern assignment operators allow this capability. The first -- form is the immediate assignment: -- P * S -- Here P is an arbitrary pattern, and S is a variable of type VString -- that will be set to the substring matched by P. This assignment -- happens during pattern matching, so if P matches more than once, -- then the assignment happens more than once. -- The deferred assignment operation: -- P ** S -- avoids these multiple assignments by deferring the assignment to the -- end of the match. If the entire match is successful, and if the -- pattern P was part of the successful match, then at the end of the -- matching operation the assignment to S of the string matching P is -- performed. -- The cursor assignment operation: -- Setcur(N'Access) -- assigns the current cursor position to the natural variable N. The -- cursor position is defined as the count of characters that have been -- matched so far (including any start point moves). -- Finally the operations * and ** may be used with values of type -- Text_IO.File_Access. The effect is to do a Put_Line operation of -- the matched substring. These are particularly useful in debugging -- pattern matches. -- Deferred Matching -- ================= -- The pattern construction functions (such as Len and Any) all permit -- the use of pointers to natural or string values, or functions that -- return natural or string values. These forms cause the actual value -- to be obtained at pattern matching time. This allows interesting -- possibilities for constructing dynamic patterns as illustrated in -- the examples section. -- In addition the (+S) operator may be used where S is a pointer to -- string or function returning string, with a similar deferred effect. -- A special use of deferred matching is the construction of predicate -- functions. The element (+P) where P is an access to a function that -- returns a Boolean value, causes the function to be called at the -- time the element is matched. If the function returns True, then the -- null string is matched, if the function returns False, then failure -- is signalled and previous alternatives are sought. -- Deferred Replacement -- ==================== -- The simple model given for pattern replacement (where the matched -- substring is replaced by the string given as the third argument to -- Match) works fine in simple cases, but this approach does not work -- in the case where the expression used as the replacement string is -- dependent on values set by the match. -- For example, suppose we want to find an instance of a parenthesized -- character, and replace the parentheses with square brackets. At first -- glance it would seem that: -- Match (Subject, '(' & Len (1) * Char & ')', '[' & Char & ']'); -- would do the trick, but that does not work, because the third -- argument to Match gets evaluated too early, before the call to -- Match, and before the pattern match has had a chance to set Char. -- To solve this problem we provide the deferred replacement capability. -- With this approach, which of course is only needed if the pattern -- involved has side effects, is to do the match in two stages. The -- call to Match sets a pattern result in a variable of the private -- type Match_Result, and then a subsequent Replace operation uses -- this Match_Result object to perform the required replacement. -- Using this approach, we can now write the above operation properly -- in a manner that will work: -- M : Match_Result; -- ... -- Match (Subject, '(' & Len (1) * Char & ')', M); -- Replace (M, '[' & Char & ']'); -- As with other Match cases, there is a function and procedure form -- of this match call. A call to Replace after a failed match has no -- effect. Note that Subject should not be modified between the calls. -- Examples of Pattern Matching -- ============================ -- First a simple example of the use of pattern replacement to remove -- a line number from the start of a string. We assume that the line -- number has the form of a string of decimal digits followed by a -- period, followed by one or more spaces. -- Digs : constant Pattern := Span("0123456789"); -- Lnum : constant Pattern := Pos(0) & Digs & '.' & Span(' '); -- Now to use this pattern we simply do a match with a replacement: -- Match (Line, Lnum, ""); -- which replaces the line number by the null string. Note that it is -- also possible to use an Ada.Strings.Maps.Character_Set value as an -- argument to Span and similar functions, and in particular all the -- useful constants 'in Ada.Strings.Maps.Constants are available. This -- means that we could define Digs as: -- Digs : constant Pattern := Span(Decimal_Digit_Set); -- The style we use here, of defining constant patterns and then using -- them is typical. It is possible to build up patterns dynamically, -- but it is usually more efficient to build them in pieces in advance -- using constant declarations. Note in particular that although it is -- possible to construct a pattern directly as an argument for the -- Match routine, it is much more efficient to preconstruct the pattern -- as we did in this example. -- Now let's look at the use of pattern assignment to break a -- string into sections. Suppose that the input string has two -- unsigned decimal integers, separated by spaces or a comma, -- with spaces allowed anywhere. Then we can isolate the two -- numbers with the following pattern: -- Num1, Num2 : aliased VString; -- B : constant Pattern := NSpan(' '); -- N : constant Pattern := Span("0123456789"); -- T : constant Pattern := -- NSpan(' ') & N * Num1 & Span(" ,") & N * Num2; -- The match operation Match (" 124, 257 ", T) would assign the -- string 124 to Num1 and the string 257 to Num2. -- Now let's see how more complex elements can be built from the -- set of primitive elements. The following pattern matches strings -- that have the syntax of Ada 95 based literals: -- Digs : constant Pattern := Span(Decimal_Digit_Set); -- UDigs : constant Pattern := Digs & Arbno('_' & Digs); -- Edig : constant Pattern := Span(Hexadecimal_Digit_Set); -- UEdig : constant Pattern := Edig & Arbno('_' & Edig); -- Bnum : constant Pattern := Udigs & '#' & UEdig & '#'; -- A match against Bnum will now match the desired strings, e.g. -- it will match 16#123_abc#, but not a#b#. However, this pattern -- is not quite complete, since it does not allow colons to replace -- the pound signs. The following is more complete: -- Bchar : constant Pattern := Any("#:"); -- Bnum : constant Pattern := Udigs & Bchar & UEdig & Bchar; -- but that is still not quite right, since it allows # and : to be -- mixed, and they are supposed to be used consistently. We solve -- this by using a deferred match. -- Temp : aliased VString; -- Bnum : constant Pattern := -- Udigs & Bchar * Temp & UEdig & (+Temp) -- Here the first instance of the base character is stored in Temp, and -- then later in the pattern we rematch the value that was assigned. -- For an example of a recursive pattern, let's define a pattern -- that is like the built in Bal, but the string matched is balanced -- with respect to square brackets or curly brackets. -- The language for such strings might be defined in extended BNF as -- ELEMENT ::= <any character other than [] or {}> -- | '[' BALANCED_STRING ']' -- | '{' BALANCED_STRING '}' -- BALANCED_STRING ::= ELEMENT {ELEMENT} -- Here we use {} to indicate zero or more occurrences of a term, as -- is common practice in extended BNF. Now we can translate the above -- BNF into recursive patterns as follows: -- Element, Balanced_String : aliased Pattern; -- . -- . -- . -- Element := NotAny ("[]{}") -- or -- ('[' & (+Balanced_String) & ']') -- or -- ('{' & (+Balanced_String) & '}'); -- Balanced_String := Element & Arbno (Element); -- Note the important use of + here to refer to a pattern not yet -- defined. Note also that we use assignments precisely because we -- cannot refer to as yet undeclared variables in initializations. -- Now that this pattern is constructed, we can use it as though it -- were a new primitive pattern element, and for example, the match: -- Match ("xy[ab{cd}]", Balanced_String * Current_Output & Fail); -- will generate the output: -- x -- xy -- xy[ab{cd}] -- y -- y[ab{cd}] -- [ab{cd}] -- a -- ab -- ab{cd} -- b -- b{cd} -- {cd} -- c -- cd -- d -- Note that the function of the fail here is simply to force the -- pattern Balanced_String to match all possible alternatives. Studying -- the operation of this pattern in detail is highly instructive. -- Finally we give a rather elaborate example of the use of deferred -- matching. The following declarations build up a pattern which will -- find the longest string of decimal digits in the subject string. -- Max, Cur : VString; -- Loc : Natural; -- function GtS return Boolean is -- begin -- return Length (Cur) > Length (Max); -- end GtS; -- Digit : constant Character_Set := Decimal_Digit_Set; -- Digs : constant Pattern := Span(Digit); -- Find : constant Pattern := -- "" * Max & Fence & -- initialize Max to null -- BreakX (Digit) & -- scan looking for digits -- ((Span(Digit) * Cur & -- assign next string to Cur -- (+GtS'Unrestricted_Access) & -- check size(Cur) > Size(Max) -- Setcur(Loc'Access)) -- if so, save location -- * Max) & -- and assign to Max -- Fail; -- seek all alternatives -- As we see from the comments here, complex patterns like this take -- on aspects of sequential programs. In fact they are sequential -- programs with general backtracking. In this pattern, we first use -- a pattern assignment that matches null and assigns it to Max, so -- that it is initialized for the new match. Now BreakX scans to the -- next digit. Arb would do here, but BreakX will be more efficient. -- Once we have found a digit, we scan out the longest string of -- digits with Span, and assign it to Cur. The deferred call to GtS -- tests if the string we assigned to Cur is the longest so far. If -- not, then failure is signalled, and we seek alternatives (this -- means that BreakX will extend and look for the next digit string). -- If the call to GtS succeeds then the matched string is assigned -- as the largest string so far into Max and its location is saved -- in Loc. Finally Fail forces the match to fail and seek alternatives, -- so that the entire string is searched. -- If the pattern Find is matched against a string, the variable Max -- at the end of the pattern will have the longest string of digits, -- and Loc will be the starting character location of the string. For -- example, Match("ab123cd4657ef23", Find) will assign "4657" to Max -- and 11 to Loc (indicating that the string ends with the eleventh -- character of the string). -- Note: the use of Unrestricted_Access to reference GtS will not -- be needed if GtS is defined at the outer level, but definitely -- will be necessary if GtS is a nested function (in which case of -- course the scope of the pattern Find will be restricted to this -- nested scope, and this cannot be checked, i.e. use of the pattern -- outside this scope is erroneous). Generally it is a good idea to -- define patterns and the functions they call at the outer level -- where possible, to avoid such problems. -- Correspondence with Pattern Matching in SPITBOL -- =============================================== -- Generally the Ada syntax and names correspond closely to SPITBOL -- syntax for pattern matching construction. -- The basic pattern construction operators are renamed as follows: -- Spitbol Ada -- (space) & -- | or -- $ * -- . ** -- The Ada operators were chosen so that the relative precedences of -- these operators corresponds to that of the Spitbol operators, but -- as always, the use of parentheses is advisable to clarify. -- The pattern construction operators all have similar names except for -- Spitbol Ada -- Abort Cancel -- Rem Rest -- where we have clashes with Ada reserved names. -- Ada requires the use of 'Access to refer to functions used in the -- pattern match, and often the use of 'Unrestricted_Access may be -- necessary to get around the scope restrictions if the functions -- are not declared at the outer level. -- The actual pattern matching syntax is modified in Ada as follows: -- Spitbol Ada -- X Y Match (X, Y); -- X Y = Z Match (X, Y, Z); -- and pattern failure is indicated by returning a Boolean result from -- the Match function (True for success, False for failure). ----------------------- -- Type Declarations -- ----------------------- type Pattern is private; -- Type representing a pattern. This package provides a complete set of -- operations for constructing patterns that can be used in the pattern -- matching operations provided. type Boolean_Func is access function return Boolean; -- General Boolean function type. When this type is used as a formal -- parameter type in this package, it indicates a deferred predicate -- pattern. The function will be called when the pattern element is -- matched and failure signalled if False is returned. type Natural_Func is access function return Natural; -- General Natural function type. When this type is used as a formal -- parameter type in this package, it indicates a deferred pattern. -- The function will be called when the pattern element is matched -- to obtain the currently referenced Natural value. type VString_Func is access function return VString; -- General VString function type. When this type is used as a formal -- parameter type in this package, it indicates a deferred pattern. -- The function will be called when the pattern element is matched -- to obtain the currently referenced string value. subtype PString is String; -- This subtype is used in the remainder of the package to indicate a -- formal parameter that is converted to its corresponding pattern, -- i.e. a pattern that matches the characters of the string. subtype PChar is Character; -- Similarly, this subtype is used in the remainder of the package to -- indicate a formal parameter that is converted to its corresponding -- pattern, i.e. a pattern that matches this one character. subtype VString_Var is VString; subtype Pattern_Var is Pattern; -- These synonyms are used as formal parameter types to a function where, -- if the language allowed, we would use in out parameters, but we are -- not allowed to have in out parameters for functions. Instead we pass -- actuals which must be variables, and with a bit of trickery in the -- body, manage to interprete them properly as though they were indeed -- in out parameters. -------------------------------- -- Basic Pattern Construction -- -------------------------------- function "&" (L : Pattern; R : Pattern) return Pattern; function "&" (L : PString; R : Pattern) return Pattern; function "&" (L : Pattern; R : PString) return Pattern; function "&" (L : PChar; R : Pattern) return Pattern; function "&" (L : Pattern; R : PChar) return Pattern; -- Pattern concatenation. Matches L followed by R. function "or" (L : Pattern; R : Pattern) return Pattern; function "or" (L : PString; R : Pattern) return Pattern; function "or" (L : Pattern; R : PString) return Pattern; function "or" (L : PString; R : PString) return Pattern; function "or" (L : PChar; R : Pattern) return Pattern; function "or" (L : Pattern; R : PChar) return Pattern; function "or" (L : PChar; R : PChar) return Pattern; function "or" (L : PString; R : PChar) return Pattern; function "or" (L : PChar; R : PString) return Pattern; -- Pattern alternation. Creates a pattern that will first try to match -- L and then on a subsequent failure, attempts to match R instead. ---------------------------------- -- Pattern Assignment Functions -- ---------------------------------- function "*" (P : Pattern; Var : VString_Var) return Pattern; function "*" (P : PString; Var : VString_Var) return Pattern; function "*" (P : PChar; Var : VString_Var) return Pattern; -- Matches P, and if the match succeeds, assigns the matched substring -- to the given VString variable S. This assignment happens as soon as -- the substring is matched, and if the pattern P1 is matched more than -- once during the course of the match, then the assignment will occur -- more than once. function "**" (P : Pattern; Var : VString_Var) return Pattern; function "**" (P : PString; Var : VString_Var) return Pattern; function "**" (P : PChar; Var : VString_Var) return Pattern; -- Like "*" above, except that the assignment happens at most once -- after the entire match is completed successfully. If the match -- fails, then no assignment takes place. ---------------------------------- -- Deferred Matching Operations -- ---------------------------------- function "+" (Str : VString_Var) return Pattern; -- Here Str must be a VString variable. This function constructs a -- pattern which at pattern matching time will access the current -- value of this variable, and match against these characters. function "+" (Str : VString_Func) return Pattern; -- Constructs a pattern which at pattern matching time calls the given -- function, and then matches against the string or character value -- that is returned by the call. function "+" (P : Pattern_Var) return Pattern; -- Here P must be a Pattern variable. This function constructs a -- pattern which at pattern matching time will access the current -- value of this variable, and match against the pattern value. function "+" (P : Boolean_Func) return Pattern; -- Constructs a predicate pattern function that at pattern matching time -- calls the given function. If True is returned, then the pattern matches. -- If False is returned, then failure is signalled. -------------------------------- -- Pattern Building Functions -- -------------------------------- function Arb return Pattern; -- Constructs a pattern that will match any string. On the first attempt, -- the pattern matches a null string, then on each successive failure, it -- matches one more character, and only fails if matching the entire rest -- of the string. function Arbno (P : Pattern) return Pattern; function Arbno (P : PString) return Pattern; function Arbno (P : PChar) return Pattern; -- Pattern repetition. First matches null, then on a subsequent failure -- attempts to match an additional instance of the given pattern. -- Equivalent to (but more efficient than) P & ("" or (P & ("" or ... function Any (Str : String) return Pattern; function Any (Str : VString) return Pattern; function Any (Str : Character) return Pattern; function Any (Str : Character_Set) return Pattern; function Any (Str : access VString) return Pattern; function Any (Str : VString_Func) return Pattern; -- Constructs a pattern that matches a single character that is one of -- the characters in the given argument. The pattern fails if the current -- character is not in Str. function Bal return Pattern; -- Constructs a pattern that will match any non-empty string that is -- parentheses balanced with respect to the normal parentheses characters. -- Attempts to extend the string if a subsequent failure occurs. function Break (Str : String) return Pattern; function Break (Str : VString) return Pattern; function Break (Str : Character) return Pattern; function Break (Str : Character_Set) return Pattern; function Break (Str : access VString) return Pattern; function Break (Str : VString_Func) return Pattern; -- Constructs a pattern that matches a (possibly null) string which -- is immediately followed by a character in the given argument. This -- character is not part of the matched string. The pattern fails if -- the remaining characters to be matched do not include any of the -- characters in Str. function BreakX (Str : String) return Pattern; function BreakX (Str : VString) return Pattern; function BreakX (Str : Character) return Pattern; function BreakX (Str : Character_Set) return Pattern; function BreakX (Str : access VString) return Pattern; function BreakX (Str : VString_Func) return Pattern; -- Like Break, but the pattern attempts to extend on a failure to find -- the next occurrence of a character in Str, and only fails when the -- last such instance causes a failure. function Cancel return Pattern; -- Constructs a pattern that immediately aborts the entire match function Fail return Pattern; -- Constructs a pattern that always fails. function Fence return Pattern; -- Constructs a pattern that matches null on the first attempt, and then -- causes the entire match to be aborted if a subsequent failure occurs. function Fence (P : Pattern) return Pattern; -- Constructs a pattern that first matches P. if P fails, then the -- constructed pattern fails. If P succeeds, then the match proceeds, -- but if subsequent failure occurs, alternatives in P are not sought. -- The idea of Fence is that each time the pattern is matched, just -- one attempt is made to match P, without trying alternatives. function Len (Count : Natural) return Pattern; function Len (Count : access Natural) return Pattern; function Len (Count : Natural_Func) return Pattern; -- Constructs a pattern that matches exactly the given number of -- characters. The pattern fails if fewer than this number of characters -- remain to be matched in the string. function NotAny (Str : String) return Pattern; function NotAny (Str : VString) return Pattern; function NotAny (Str : Character) return Pattern; function NotAny (Str : Character_Set) return Pattern; function NotAny (Str : access VString) return Pattern; function NotAny (Str : VString_Func) return Pattern; -- Constructs a pattern that matches a single character that is not -- one of the characters in the given argument. The pattern Fails if -- the current character is in Str. function NSpan (Str : String) return Pattern; function NSpan (Str : VString) return Pattern; function NSpan (Str : Character) return Pattern; function NSpan (Str : Character_Set) return Pattern; function NSpan (Str : access VString) return Pattern; function NSpan (Str : VString_Func) return Pattern; -- Constructs a pattern that matches the longest possible string -- consisting entirely of characters from the given argument. The -- string may be empty, so this pattern always succeeds. function Pos (Count : Natural) return Pattern; function Pos (Count : access Natural) return Pattern; function Pos (Count : Natural_Func) return Pattern; -- Constructs a pattern that matches the null string if exactly Count -- characters have already been matched, and otherwise fails. function Rest return Pattern; -- Constructs a pattern that always succeeds, matching the remaining -- unmatched characters in the pattern. function Rpos (Count : Natural) return Pattern; function Rpos (Count : access Natural) return Pattern; function Rpos (Count : Natural_Func) return Pattern; -- Constructs a pattern that matches the null string if exactly Count -- characters remain to be matched in the string, and otherwise fails. function Rtab (Count : Natural) return Pattern; function Rtab (Count : access Natural) return Pattern; function Rtab (Count : Natural_Func) return Pattern; -- Constructs a pattern that matches from the current location until -- exactly Count characters remain to be matched in the string. The -- pattern fails if fewer than Count characters remain to be matched. function Setcur (Var : access Natural) return Pattern; -- Constructs a pattern that matches the null string, and assigns the -- current cursor position in the string. This value is the number of -- characters matched so far. So it is zero at the start of the match. function Span (Str : String) return Pattern; function Span (Str : VString) return Pattern; function Span (Str : Character) return Pattern; function Span (Str : Character_Set) return Pattern; function Span (Str : access VString) return Pattern; function Span (Str : VString_Func) return Pattern; -- Constructs a pattern that matches the longest possible string -- consisting entirely of characters from the given argument. The -- string cannot be empty , so the pattern fails if the current -- character is not one of the characters in Str. function Succeed return Pattern; -- Constructs a pattern that succeeds matching null, both on the first -- attempt, and on any rematch attempt, i.e. it is equivalent to an -- infinite alternation of null strings. function Tab (Count : Natural) return Pattern; function Tab (Count : access Natural) return Pattern; function Tab (Count : Natural_Func) return Pattern; -- Constructs a pattern that from the current location until Count -- characters have been matched. The pattern fails if more than Count -- characters have already been matched. --------------------------------- -- Pattern Matching Operations -- --------------------------------- -- The Match function performs an actual pattern matching operation. -- The versions with three parameters perform a match without modifying -- the subject string and return a Boolean result indicating if the -- match is successful or not. The Anchor parameter is set to True to -- obtain an anchored match in which the pattern is required to match -- the first character of the string. In an unanchored match, which is -- the default, successive attempts are made to match the given pattern -- at each character of the subject string until a match succeeds, or -- until all possibilities have failed. -- Note that pattern assignment functions in the pattern may generate -- side effects, so these functions are not necessarily pure. Anchored_Mode : Boolean := False; -- This global variable can be set True to cause all subsequent pattern -- matches to operate in anchored mode. In anchored mode, no attempt is -- made to move the anchor point, so that if the match succeeds it must -- succeed starting at the first character. Note that the effect of -- anchored mode may be achieved in individual pattern matches by using -- Fence or Pos(0) at the start of the pattern. Pattern_Stack_Overflow : exception; -- Exception raised if internal pattern matching stack overflows. This -- is typically the result of runaway pattern recursion. If there is a -- genuine case of stack overflow, then either the match must be broken -- down into simpler steps, or the stack limit must be reset. Stack_Size : constant Positive := 2000; -- Size used for internal pattern matching stack. Increase this size if -- complex patterns cause Pattern_Stack_Overflow to be raised. -- Simple match functions. The subject is matched against the pattern. -- Any immediate or deferred assignments or writes are executed, and -- the returned value indicates whether or not the match succeeded. function Match (Subject : VString; Pat : Pattern) return Boolean; function Match (Subject : VString; Pat : PString) return Boolean; function Match (Subject : String; Pat : Pattern) return Boolean; function Match (Subject : String; Pat : PString) return Boolean; -- Replacement functions. The subject is matched against the pattern. -- Any immediate or deferred assignments or writes are executed, and -- the returned value indicates whether or not the match succeeded. -- If the match succeeds, then the matched part of the subject string -- is replaced by the given Replace string. function Match (Subject : VString_Var; Pat : Pattern; Replace : VString) return Boolean; function Match (Subject : VString_Var; Pat : PString; Replace : VString) return Boolean; function Match (Subject : VString_Var; Pat : Pattern; Replace : String) return Boolean; function Match (Subject : VString_Var; Pat : PString; Replace : String) return Boolean; -- Simple match procedures. The subject is matched against the pattern. -- Any immediate or deferred assignments or writes are executed. No -- indication of success or failure is returned. procedure Match (Subject : VString; Pat : Pattern); procedure Match (Subject : VString; Pat : PString); procedure Match (Subject : String; Pat : Pattern); procedure Match (Subject : String; Pat : PString); -- Replacement procedures. The subject is matched against the pattern. -- Any immediate or deferred assignments or writes are executed. No -- indication of success or failure is returned. If the match succeeds, -- then the matched part of the subject string is replaced by the given -- Replace string. procedure Match (Subject : in out VString; Pat : Pattern; Replace : VString); procedure Match (Subject : in out VString; Pat : PString; Replace : VString); procedure Match (Subject : in out VString; Pat : Pattern; Replace : String); procedure Match (Subject : in out VString; Pat : PString; Replace : String); -- Deferred Replacement type Match_Result is private; -- Type used to record result of pattern match subtype Match_Result_Var is Match_Result; -- This synonyms is used as a formal parameter type to a function where, -- if the language allowed, we would use an in out parameter, but we are -- not allowed to have in out parameters for functions. Instead we pass -- actuals which must be variables, and with a bit of trickery in the -- body, manage to interprete them properly as though they were indeed -- in out parameters. function Match (Subject : VString_Var; Pat : Pattern; Result : Match_Result_Var) return Boolean; procedure Match (Subject : in out VString; Pat : Pattern; Result : out Match_Result); procedure Replace (Result : in out Match_Result; Replace : VString); -- Given a previous call to Match which set Result, performs a pattern -- replacement if the match was successful. Has no effect if the match -- failed. This call should immediately follow the Match call. ------------------------ -- Debugging Routines -- ------------------------ -- Debugging pattern matching operations can often be quite complex, -- since there is no obvious way to trace the progress of the match. -- The declarations in this section provide some debugging assistance. Debug_Mode : Boolean := False; -- This global variable can be set True to generate debugging on all -- subsequent calls to Match. The debugging output is a full trace of -- the actions of the pattern matcher, written to Standard_Output. The -- level of this information is intended to be comprehensible at the -- abstract level of this package declaration. However, note that the -- use of this switch often generates large amounts of output. function "*" (P : Pattern; Fil : File_Access) return Pattern; function "*" (P : PString; Fil : File_Access) return Pattern; function "*" (P : PChar; Fil : File_Access) return Pattern; function "**" (P : Pattern; Fil : File_Access) return Pattern; function "**" (P : PString; Fil : File_Access) return Pattern; function "**" (P : PChar; Fil : File_Access) return Pattern; -- These are similar to the corresponding pattern assignment operations -- except that instead of setting the value of a variable, the matched -- substring is written to the appropriate file. This can be useful in -- following the progress of a match without generating the full amount -- of information obtained by setting Debug_Mode to True. Terminal : constant File_Access := Standard_Error; Output : constant File_Access := Standard_Output; -- Two handy synonyms for use with the above pattern write operations. -- Finally we have some routines that are useful for determining what -- patterns are in use, particularly if they are constructed dynamically. function Image (P : Pattern) return String; function Image (P : Pattern) return VString; -- This procedures yield strings that corresponds to the syntax needed -- to create the given pattern using the functions in this package. The -- form of this string is such that it could actually be compiled and -- evaluated to yield the required pattern except for references to -- variables and functions, which are output using one of the following -- forms: -- -- access Natural NP(16#...#) -- access Pattern PP(16#...#) -- access VString VP(16#...#) -- -- Natural_Func NF(16#...#) -- VString_Func VF(16#...#) -- -- where 16#...# is the hex representation of the integer address that -- corresponds to the given access value procedure Dump (P : Pattern); -- This procedure writes information about the pattern to Standard_Out. -- The format of this information is keyed to the internal data structures -- used to implement patterns. The information provided by Dump is thus -- more precise than that yielded by Image, but is also a bit more obscure -- (i.e. it cannot be interpreted solely in terms of this spec, you have -- to know something about the data structures). ------------------ -- Private Part -- ------------------ private type PE; -- Pattern element, a pattern is a plex structure of PE's. This type -- is defined and sdescribed in the body of this package. type PE_Ptr is access all PE; -- Pattern reference. PE's use PE_Ptr values to reference other PE's type Pattern is new Controlled with record Stk : Natural; -- Maximum number of stack entries required for matching this -- pattern. See description of pattern history stack in body. P : PE_Ptr; -- Pointer to initial pattern element for pattern end record; pragma Finalize_Storage_Only (Pattern); procedure Adjust (Object : in out Pattern); -- Adjust routine used to copy pattern objects procedure Finalize (Object : in out Pattern); -- Finalization routine used to release storage allocated for a pattern. type VString_Ptr is access all VString; type Match_Result is record Var : VString_Ptr; -- Pointer to subject string. Set to null if match failed. Start : Natural; -- Starting index position (1's origin) of matched section of -- subject string. Only valid if Var is non-null. Stop : Natural; -- Ending index position (1's origin) of matched section of -- subject string. Only valid if Var is non-null. end record; pragma Volatile (Match_Result); -- This ensures that the Result parameter is passed by reference, so -- that we can play our games with the bogus Match_Result_Var parameter -- in the function case to treat it as though it were an in out parameter. end GNAT.Spitbol.Patterns;
test/asset/agda-stdlib-1.0/Function/Inverse.agda
omega12345/agda-mode
0
2550
<reponame>omega12345/agda-mode<filename>test/asset/agda-stdlib-1.0/Function/Inverse.agda ------------------------------------------------------------------------ -- The Agda standard library -- -- Inverses ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Function.Inverse where open import Level open import Function using (flip) open import Function.Bijection hiding (id; _∘_; bijection) open import Function.Equality as F using (_⟶_) renaming (_∘_ to _⟪∘⟫_) open import Function.LeftInverse as Left hiding (id; _∘_) open import Relation.Binary open import Relation.Binary.PropositionalEquality as P using (_≗_; _≡_) open import Relation.Unary using (Pred) ------------------------------------------------------------------------ -- Inverses record _InverseOf_ {f₁ f₂ t₁ t₂} {From : Setoid f₁ f₂} {To : Setoid t₁ t₂} (from : To ⟶ From) (to : From ⟶ To) : Set (f₁ ⊔ f₂ ⊔ t₁ ⊔ t₂) where field left-inverse-of : from LeftInverseOf to right-inverse-of : from RightInverseOf to ------------------------------------------------------------------------ -- The set of all inverses between two setoids record Inverse {f₁ f₂ t₁ t₂} (From : Setoid f₁ f₂) (To : Setoid t₁ t₂) : Set (f₁ ⊔ f₂ ⊔ t₁ ⊔ t₂) where field to : From ⟶ To from : To ⟶ From inverse-of : from InverseOf to open _InverseOf_ inverse-of public left-inverse : LeftInverse From To left-inverse = record { to = to ; from = from ; left-inverse-of = left-inverse-of } open LeftInverse left-inverse public using (injective; injection) bijection : Bijection From To bijection = record { to = to ; bijective = record { injective = injective ; surjective = record { from = from ; right-inverse-of = right-inverse-of } } } open Bijection bijection public using (equivalence; surjective; surjection; right-inverse; to-from; from-to) ------------------------------------------------------------------------ -- The set of all inverses between two sets (i.e. inverses with -- propositional equality) infix 3 _↔_ _↔̇_ _↔_ : ∀ {f t} → Set f → Set t → Set _ From ↔ To = Inverse (P.setoid From) (P.setoid To) _↔̇_ : ∀ {i f t} {I : Set i} → Pred I f → Pred I t → Set _ From ↔̇ To = ∀ {i} → From i ↔ To i inverse : ∀ {f t} {From : Set f} {To : Set t} → (to : From → To) (from : To → From) → (∀ x → from (to x) ≡ x) → (∀ x → to (from x) ≡ x) → From ↔ To inverse to from from∘to to∘from = record { to = P.→-to-⟶ to ; from = P.→-to-⟶ from ; inverse-of = record { left-inverse-of = from∘to ; right-inverse-of = to∘from } } ------------------------------------------------------------------------ -- If two setoids are in bijective correspondence, then there is an -- inverse between them fromBijection : ∀ {f₁ f₂ t₁ t₂} {From : Setoid f₁ f₂} {To : Setoid t₁ t₂} → Bijection From To → Inverse From To fromBijection b = record { to = Bijection.to b ; from = Bijection.from b ; inverse-of = record { left-inverse-of = Bijection.left-inverse-of b ; right-inverse-of = Bijection.right-inverse-of b } } ------------------------------------------------------------------------ -- Inverse is an equivalence relation -- Reflexivity id : ∀ {s₁ s₂} → Reflexive (Inverse {s₁} {s₂}) id {x = S} = record { to = F.id ; from = F.id ; inverse-of = record { left-inverse-of = LeftInverse.left-inverse-of id′ ; right-inverse-of = LeftInverse.left-inverse-of id′ } } where id′ = Left.id {S = S} -- Transitivity infixr 9 _∘_ _∘_ : ∀ {f₁ f₂ m₁ m₂ t₁ t₂} → TransFlip (Inverse {f₁} {f₂} {m₁} {m₂}) (Inverse {m₁} {m₂} {t₁} {t₂}) (Inverse {f₁} {f₂} {t₁} {t₂}) f ∘ g = record { to = to f ⟪∘⟫ to g ; from = from g ⟪∘⟫ from f ; inverse-of = record { left-inverse-of = LeftInverse.left-inverse-of (Left._∘_ (left-inverse f) (left-inverse g)) ; right-inverse-of = LeftInverse.left-inverse-of (Left._∘_ (right-inverse g) (right-inverse f)) } } where open Inverse -- Symmetry. sym : ∀ {f₁ f₂ t₁ t₂} → Sym (Inverse {f₁} {f₂} {t₁} {t₂}) (Inverse {t₁} {t₂} {f₁} {f₂}) sym inv = record { from = to ; to = from ; inverse-of = record { left-inverse-of = right-inverse-of ; right-inverse-of = left-inverse-of } } where open Inverse inv ------------------------------------------------------------------------ -- Transformations map : ∀ {f₁ f₂ t₁ t₂} {From : Setoid f₁ f₂} {To : Setoid t₁ t₂} {f₁′ f₂′ t₁′ t₂′} {From′ : Setoid f₁′ f₂′} {To′ : Setoid t₁′ t₂′} → (t : (From ⟶ To) → (From′ ⟶ To′)) → (f : (To ⟶ From) → (To′ ⟶ From′)) → (∀ {to from} → from InverseOf to → f from InverseOf t to) → Inverse From To → Inverse From′ To′ map t f pres eq = record { to = t to ; from = f from ; inverse-of = pres inverse-of } where open Inverse eq zip : ∀ {f₁₁ f₂₁ t₁₁ t₂₁} {From₁ : Setoid f₁₁ f₂₁} {To₁ : Setoid t₁₁ t₂₁} {f₁₂ f₂₂ t₁₂ t₂₂} {From₂ : Setoid f₁₂ f₂₂} {To₂ : Setoid t₁₂ t₂₂} {f₁ f₂ t₁ t₂} {From : Setoid f₁ f₂} {To : Setoid t₁ t₂} → (t : (From₁ ⟶ To₁) → (From₂ ⟶ To₂) → (From ⟶ To)) → (f : (To₁ ⟶ From₁) → (To₂ ⟶ From₂) → (To ⟶ From)) → (∀ {to₁ from₁ to₂ from₂} → from₁ InverseOf to₁ → from₂ InverseOf to₂ → f from₁ from₂ InverseOf t to₁ to₂) → Inverse From₁ To₁ → Inverse From₂ To₂ → Inverse From To zip t f pres eq₁ eq₂ = record { to = t (to eq₁) (to eq₂) ; from = f (from eq₁) (from eq₂) ; inverse-of = pres (inverse-of eq₁) (inverse-of eq₂) } where open Inverse
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr40.ads
best08618/asylo
7
715
pragma Assertion_Policy(Check); package Discr40 is subtype Element is Integer; type Vector is array (Positive range <>) of Element; type Stack (Max_Length : Natural) is record Length : Natural; Data : Vector (1 .. Max_Length); end record; function Not_Full (S : Stack) return Boolean is (S.Length < S.Max_Length); procedure Push (S: in out Stack; E : Element) with Pre => Not_Full(S), -- Precodition Post => -- Postcondition (S.Length = S'Old.Length + 1) and (S.Data (S.Length) = E) and (for all J in 1 .. S'Old.Length => S.Data(J) = S'Old.Data(J)); end Discr40;
llvm-gcc-4.2-2.9/gcc/ada/a-taster.ads
vidkidz/crossbridge
1
6764
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T A S K _ T E R M I N A T I O N -- -- -- -- S p e c -- -- -- -- Copyright (C) 2005, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Task_Identification; with Ada.Exceptions; package Ada.Task_Termination is pragma Preelaborate (Task_Termination); type Cause_Of_Termination is (Normal, Abnormal, Unhandled_Exception); type Termination_Handler is access protected procedure (Cause : Cause_Of_Termination; T : Ada.Task_Identification.Task_Id; X : Ada.Exceptions.Exception_Occurrence); procedure Set_Dependents_Fallback_Handler (Handler : Termination_Handler); function Current_Task_Fallback_Handler return Termination_Handler; procedure Set_Specific_Handler (T : Ada.Task_Identification.Task_Id; Handler : Termination_Handler); function Specific_Handler (T : Ada.Task_Identification.Task_Id) return Termination_Handler; end Ada.Task_Termination;
programs/oeis/017/A017185.asm
neoneye/loda
22
99653
; A017185: 9*n+2. ; 2,11,20,29,38,47,56,65,74,83,92,101,110,119,128,137,146,155,164,173,182,191,200,209,218,227,236,245,254,263,272,281,290,299,308,317,326,335,344,353,362,371,380,389,398,407,416,425,434,443,452,461,470,479,488,497,506,515,524,533,542,551,560,569,578,587,596,605,614,623,632,641,650,659,668,677,686,695,704,713,722,731,740,749,758,767,776,785,794,803,812,821,830,839,848,857,866,875,884,893 mul $0,9 add $0,2
code.asm
llamaking136/Video-to-Text-Kernel
0
26345
[GLOBAL gdt_flush] ; Allows the C code to call gdt_flush(). gdt_flush: mov eax, [esp+4] ; Get the pointer to the GDT, passed as a parameter. lgdt [eax] ; Load the new GDT pointer mov ax, 0x10 ; 0x10 is the offset in the GDT to our data segment mov ds, ax ; Load all data segment selectors mov es, ax mov fs, ax mov gs, ax mov ss, ax jmp 0x08:.flush ; 0x08 is the offset to our code segment: Far jump! .flush: ret [GLOBAL idt_flush] ; Allows the C code to call idt_flush(). idt_flush: mov eax, [esp+4] ; Get the pointer to the IDT, passed as a parameter. lidt [eax] ; Load the IDT pointer. ret ; This macro creates a stub for an ISR which does NOT pass it's own ; error code (adds a dummy errcode byte). %macro ISR_NOERRCODE 1 global isr%1 isr%1: cli ; Disable interrupts firstly. push byte 0 ; Push a dummy error code. push byte %1 ; Push the interrupt number. jmp isr_common_stub ; Go to our common handler code. %endmacro ; This macro creates a stub for an ISR which passes it's own ; error code. %macro ISR_ERRCODE 1 global isr%1 isr%1: cli ; Disable interrupts. push byte %1 ; Push the interrupt number jmp isr_common_stub %endmacro ; This macro creates a stub for an IRQ - the first parameter is ; the IRQ number, the second is the ISR number it is remapped to. %macro IRQ 2 global irq%1 irq%1: cli push byte 0 push byte %2 jmp irq_common_stub %endmacro ISR_NOERRCODE 0 ISR_NOERRCODE 1 ISR_NOERRCODE 2 ISR_NOERRCODE 3 ISR_NOERRCODE 4 ISR_NOERRCODE 5 ISR_NOERRCODE 6 ISR_NOERRCODE 7 ISR_ERRCODE 8 ISR_NOERRCODE 9 ISR_ERRCODE 10 ISR_ERRCODE 11 ISR_ERRCODE 12 ISR_ERRCODE 13 ISR_ERRCODE 14 ISR_NOERRCODE 15 ISR_NOERRCODE 16 ISR_NOERRCODE 17 ISR_NOERRCODE 18 ISR_NOERRCODE 19 ISR_NOERRCODE 20 ISR_NOERRCODE 21 ISR_NOERRCODE 22 ISR_NOERRCODE 23 ISR_NOERRCODE 24 ISR_NOERRCODE 25 ISR_NOERRCODE 26 ISR_NOERRCODE 27 ISR_NOERRCODE 28 ISR_NOERRCODE 29 ISR_NOERRCODE 30 ISR_NOERRCODE 31 IRQ 0, 32 IRQ 1, 33 IRQ 2, 34 IRQ 3, 35 IRQ 4, 36 IRQ 5, 37 IRQ 6, 38 IRQ 7, 39 IRQ 8, 40 IRQ 9, 41 IRQ 10, 42 IRQ 11, 43 IRQ 12, 44 IRQ 13, 45 IRQ 14, 46 IRQ 15, 47 ; In isr.c extern isr_handler ; This is our common ISR stub. It saves the processor state, sets ; up for kernel mode segments, calls the C-level fault handler, ; and finally restores the stack frame. isr_common_stub: pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax mov ax, ds ; Lower 16-bits of eax = ds. push eax ; save the data segment descriptor mov ax, 0x10 ; load the kernel data segment descriptor mov ds, ax mov es, ax mov fs, ax mov gs, ax call isr_handler pop ebx ; reload the original data segment descriptor mov ds, bx mov es, bx mov fs, bx mov gs, bx popa ; Pops edi,esi,ebp... add esp, 8 ; Cleans up the pushed error code and pushed ISR number sti iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP ; In isr.c extern irq_handler ; This is our common IRQ stub. It saves the processor state, sets ; up for kernel mode segments, calls the C-level fault handler, ; and finally restores the stack frame. irq_common_stub: pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax mov ax, ds ; Lower 16-bits of eax = ds. push eax ; save the data segment descriptor mov ax, 0x10 ; load the kernel data segment descriptor mov ds, ax mov es, ax mov fs, ax mov gs, ax call irq_handler pop ebx ; reload the original data segment descriptor mov ds, bx mov es, bx mov fs, bx mov gs, bx popa ; Pops edi,esi,ebp... add esp, 8 ; Cleans up the pushed error code and pushed ISR number sti iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP
programs/oeis/346/A346633.asm
neoneye/loda
22
25264
; A346633: Sum of even-indexed parts (even bisection) of the n-th composition in standard order. ; 0,0,0,1,0,1,2,1,0,1,2,1,3,2,1,2,0,1,2,1,3,2,1,2,4,3,2,3,1,2,3,2,0,1,2,1,3,2,1,2,4,3,2,3,1,2,3,2,5,4,3,4,2,3,4,3,1,2,3,2,4,3,2,3,0,1,2,1,3,2,1,2,4,3,2,3,1,2,3,2,5,4,3,4,2,3,4 lpb $0 mov $2,$0 div $0,2 seq $2,102393 ; A wicked evil sequence. mov $3,$2 min $3,1 add $1,$3 lpe mov $0,$1
data/pokemon/dex_entries/oddish.asm
AtmaBuster/pokeplat-gen2
6
167311
<gh_stars>1-10 db "WEED@" ; species name db "During the day, it" next "stays in the cold" next "underground to" page "avoid the sun." next "It grows by bath-" next "ing in moonlight.@"
programs/oeis/242/A242963.asm
karttu/loda
0
242532
<filename>programs/oeis/242/A242963.asm ; A242963: Numbers n such that A242962(n) = sigma(n) = A000203(n). ; 5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71 pow $2,$0 pow $1,$2 add $1,$0 add $1,5
agda/LRTree.agda
bgbianchi/sorting
6
16235
<gh_stars>1-10 module LRTree {A : Set} where open import Data.List data Tag : Set where left : Tag right : Tag data LRTree : Set where empty : LRTree leaf : A → LRTree node : Tag → LRTree → LRTree → LRTree insert : A → LRTree → LRTree insert x empty = leaf x insert x (leaf y) = node left (leaf y) (leaf x) insert x (node left l r) = node right (insert x l) r insert x (node right l r) = node left l (insert x r) flatten : LRTree → List A flatten empty = [] flatten (leaf x) = x ∷ [] flatten (node _ l r) = flatten l ++ flatten r
test/psubd.asm
killvxk/AssemblyLine
147
91572
<reponame>killvxk/AssemblyLine SECTION .text GLOBAL test test: psubd xmm0, xmm0 psubd xmm0, xmm1 psubd xmm0, xmm2 psubd xmm0, xmm3 psubd xmm0, xmm4 psubd xmm0, xmm5 psubd xmm0, xmm6 psubd xmm0, xmm7 psubd xmm0, xmm8 psubd xmm0, xmm9 psubd xmm0, xmm10 psubd xmm0, xmm11 psubd xmm0, xmm12 psubd xmm0, xmm13 psubd xmm0, xmm14 psubd xmm0, xmm15 psubd xmm1, xmm0 psubd xmm1, xmm1 psubd xmm1, xmm2 psubd xmm1, xmm3 psubd xmm1, xmm4 psubd xmm1, xmm5 psubd xmm1, xmm6 psubd xmm1, xmm7 psubd xmm1, xmm8 psubd xmm1, xmm9 psubd xmm1, xmm10 psubd xmm1, xmm11 psubd xmm1, xmm12 psubd xmm1, xmm13 psubd xmm1, xmm14 psubd xmm1, xmm15 psubd xmm2, xmm0 psubd xmm2, xmm1 psubd xmm2, xmm2 psubd xmm2, xmm3 psubd xmm2, xmm4 psubd xmm2, xmm5 psubd xmm2, xmm6 psubd xmm2, xmm7 psubd xmm2, xmm8 psubd xmm2, xmm9 psubd xmm2, xmm10 psubd xmm2, xmm11 psubd xmm2, xmm12 psubd xmm2, xmm13 psubd xmm2, xmm14 psubd xmm2, xmm15 psubd xmm3, xmm0 psubd xmm3, xmm1 psubd xmm3, xmm2 psubd xmm3, xmm3 psubd xmm3, xmm4 psubd xmm3, xmm5 psubd xmm3, xmm6 psubd xmm3, xmm7 psubd xmm3, xmm8 psubd xmm3, xmm9 psubd xmm3, xmm10 psubd xmm3, xmm11 psubd xmm3, xmm12 psubd xmm3, xmm13 psubd xmm3, xmm14 psubd xmm3, xmm15 psubd xmm4, xmm0 psubd xmm4, xmm1 psubd xmm4, xmm2 psubd xmm4, xmm3 psubd xmm4, xmm4 psubd xmm4, xmm5 psubd xmm4, xmm6 psubd xmm4, xmm7 psubd xmm4, xmm8 psubd xmm4, xmm9 psubd xmm4, xmm10 psubd xmm4, xmm11 psubd xmm4, xmm12 psubd xmm4, xmm13 psubd xmm4, xmm14 psubd xmm4, xmm15 psubd xmm5, xmm0 psubd xmm5, xmm1 psubd xmm5, xmm2 psubd xmm5, xmm3 psubd xmm5, xmm4 psubd xmm5, xmm5 psubd xmm5, xmm6 psubd xmm5, xmm7 psubd xmm5, xmm8 psubd xmm5, xmm9 psubd xmm5, xmm10 psubd xmm5, xmm11 psubd xmm5, xmm12 psubd xmm5, xmm13 psubd xmm5, xmm14 psubd xmm5, xmm15 psubd xmm6, xmm0 psubd xmm6, xmm1 psubd xmm6, xmm2 psubd xmm6, xmm3 psubd xmm6, xmm4 psubd xmm6, xmm5 psubd xmm6, xmm6 psubd xmm6, xmm7 psubd xmm6, xmm8 psubd xmm6, xmm9 psubd xmm6, xmm10 psubd xmm6, xmm11 psubd xmm6, xmm12 psubd xmm6, xmm13 psubd xmm6, xmm14 psubd xmm6, xmm15 psubd xmm7, xmm0 psubd xmm7, xmm1 psubd xmm7, xmm2 psubd xmm7, xmm3 psubd xmm7, xmm4 psubd xmm7, xmm5 psubd xmm7, xmm6 psubd xmm7, xmm7 psubd xmm7, xmm8 psubd xmm7, xmm9 psubd xmm7, xmm10 psubd xmm7, xmm11 psubd xmm7, xmm12 psubd xmm7, xmm13 psubd xmm7, xmm14 psubd xmm7, xmm15 psubd xmm8, xmm0 psubd xmm8, xmm1 psubd xmm8, xmm2 psubd xmm8, xmm3 psubd xmm8, xmm4 psubd xmm8, xmm5 psubd xmm8, xmm6 psubd xmm8, xmm7 psubd xmm8, xmm8 psubd xmm8, xmm9 psubd xmm8, xmm10 psubd xmm8, xmm11 psubd xmm8, xmm12 psubd xmm8, xmm13 psubd xmm8, xmm14 psubd xmm8, xmm15 psubd xmm9, xmm0 psubd xmm9, xmm1 psubd xmm9, xmm2 psubd xmm9, xmm3 psubd xmm9, xmm4 psubd xmm9, xmm5 psubd xmm9, xmm6 psubd xmm9, xmm7 psubd xmm9, xmm8 psubd xmm9, xmm9 psubd xmm9, xmm10 psubd xmm9, xmm11 psubd xmm9, xmm12 psubd xmm9, xmm13 psubd xmm9, xmm14 psubd xmm9, xmm15 psubd xmm10, xmm0 psubd xmm10, xmm1 psubd xmm10, xmm2 psubd xmm10, xmm3 psubd xmm10, xmm4 psubd xmm10, xmm5 psubd xmm10, xmm6 psubd xmm10, xmm7 psubd xmm10, xmm8 psubd xmm10, xmm9 psubd xmm10, xmm10 psubd xmm10, xmm11 psubd xmm10, xmm12 psubd xmm10, xmm13 psubd xmm10, xmm14 psubd xmm10, xmm15 psubd xmm11, xmm0 psubd xmm11, xmm1 psubd xmm11, xmm2 psubd xmm11, xmm3 psubd xmm11, xmm4 psubd xmm11, xmm5 psubd xmm11, xmm6 psubd xmm11, xmm7 psubd xmm11, xmm8 psubd xmm11, xmm9 psubd xmm11, xmm10 psubd xmm11, xmm11 psubd xmm11, xmm12 psubd xmm11, xmm13 psubd xmm11, xmm14 psubd xmm11, xmm15 psubd xmm12, xmm0 psubd xmm12, xmm1 psubd xmm12, xmm2 psubd xmm12, xmm3 psubd xmm12, xmm4 psubd xmm12, xmm5 psubd xmm12, xmm6 psubd xmm12, xmm7 psubd xmm12, xmm8 psubd xmm12, xmm9 psubd xmm12, xmm10 psubd xmm12, xmm11 psubd xmm12, xmm12 psubd xmm12, xmm13 psubd xmm12, xmm14 psubd xmm12, xmm15 psubd xmm13, xmm0 psubd xmm13, xmm1 psubd xmm13, xmm2 psubd xmm13, xmm3 psubd xmm13, xmm4 psubd xmm13, xmm5 psubd xmm13, xmm6 psubd xmm13, xmm7 psubd xmm13, xmm8 psubd xmm13, xmm9 psubd xmm13, xmm10 psubd xmm13, xmm11 psubd xmm13, xmm12 psubd xmm13, xmm13 psubd xmm13, xmm14 psubd xmm13, xmm15 psubd xmm14, xmm0 psubd xmm14, xmm1 psubd xmm14, xmm2 psubd xmm14, xmm3 psubd xmm14, xmm4 psubd xmm14, xmm5 psubd xmm14, xmm6 psubd xmm14, xmm7 psubd xmm14, xmm8 psubd xmm14, xmm9 psubd xmm14, xmm10 psubd xmm14, xmm11 psubd xmm14, xmm12 psubd xmm14, xmm13 psubd xmm14, xmm14 psubd xmm14, xmm15 psubd xmm0, xmm0 psubd xmm0, xmm1 psubd xmm0, xmm2 psubd xmm0, xmm3 psubd xmm0, xmm4 psubd xmm0, xmm5 psubd xmm0, xmm6 psubd xmm0, xmm7 psubd xmm0, xmm8 psubd xmm0, xmm9 psubd xmm0, xmm10 psubd xmm0, xmm11 psubd xmm0, xmm12 psubd xmm0, xmm13 psubd xmm0, xmm14 psubd xmm0, xmm15
Kernel64/Interrupts.asm
sbarisic/Kernel
3
3585
<reponame>sbarisic/Kernel section .text extern int_handler2 global testint testint: ;xchg bx, bx int 8 ret %macro INT_HANDLER_NOERR 1 global int_handler_%1 int_handler_%1: cli push dword 0 push qword %1 jmp int_handler %endmacro %macro INT_HANDLER_ERR 1 global int_handler_%1 int_handler_%1: cli push qword %1 jmp int_handler %endmacro global int_handler int_handler: push rdx push rcx mov dword edx, [esp+16] ; Error mov dword ecx, [esp+12] ; IntNum ; Push all push rax push rbx push rsi push rdi push rbp push rsp push r8 push r9 push r10 push r11 push r12 push r13 push r14 push r15 call int_handler2 xchg bx, bx ; Pop all pop r15 pop r14 pop r13 pop r12 pop r11 pop r10 pop r9 pop r8 pop rsp pop rbp pop rdi pop rsi pop rbx pop rax pop rcx pop rdx add esp, 8 ; Pop 2 ints sti iretq INT_HANDLER_NOERR 0 INT_HANDLER_NOERR 1 INT_HANDLER_NOERR 2 INT_HANDLER_NOERR 3 INT_HANDLER_NOERR 4 INT_HANDLER_NOERR 5 INT_HANDLER_NOERR 6 INT_HANDLER_NOERR 7 INT_HANDLER_ERR 8 INT_HANDLER_NOERR 9 INT_HANDLER_ERR 10 INT_HANDLER_ERR 11 INT_HANDLER_ERR 12 INT_HANDLER_ERR 13 INT_HANDLER_ERR 14 INT_HANDLER_NOERR 15
src/main/antlr4/DescriptionLogics.g4
pseifer/shar
1
6595
grammar DescriptionLogics; @header { package de.pseifer.shar.parsing; } formula: formula0 EOF; formula0: concept_with_context | formula1; concept_with_context: formula1 '@' GROUP_LEFT axiom GROUP_RIGHT; axiom: (subsumption)+; subsumption: formula0 SQSUBSETEQ formula0; formula1: union | formula2; formula2: intersection | formula3; formula3: paren_formula | negated_formula | universal | existential | greater | less | exactly | top | bottom | nominal | concept; union: formula3 UNION formula3 | formula3 UNION union; intersection: formula3 INTERSECTION formula3 | formula3 INTERSECTION intersection; negated_formula: NOT formula3; paren_formula: GROUP_LEFT formula1 GROUP_RIGHT; universal: UNIVERSAL role DOT formula3; existential: EXISTENTIAL role DOT formula3; greater: GREATER role DOT formula3; less: LESS role DOT formula3; exactly: EXACTLY role DOT formula3; top: TOP; bottom: BOTTOM; concept: IRI; nominal: NOMINAL_LEFT IRI NOMINAL_RIGHT; role: IRI | '-' role; /* IRI */ IRI: PREFIXED_IRI | FULL_IRI; FULL_IRI: '<' ~('>')+ '>'; PREFIXED_IRI: PREFIX NAME; PREFIX: CHARACTER* ':'; NAME: CHARACTER+; /* TYPES: TODO */ /* TOKEN */ GREATER: '>=' NUMBER; LESS: '<=' NUMBER; EXACTLY: '==' NUMBER; NUMBER: ('0' .. '9')+; CHARACTER: ('0' .. '9' | 'a' .. 'z' | 'A' .. 'Z' | '_'); WHITESPACE: (' ' | '\t' | '\r' | '\n')+ -> skip; UNION: '|' | '⊔'; INTERSECTION: '&' | '⊓'; UNIVERSAL: '#A' | '∀'; EXISTENTIAL: '#E' | '∃'; NOT: '!' | '¬'; TOP: '#t' | '⊤'; BOTTOM: '#f' | '⊥'; NOMINAL_LEFT: '{'; NOMINAL_RIGHT: '}'; GROUP_LEFT: '('; GROUP_RIGHT: ')'; DOT: '.'; SQSUBSETEQ: '⊑' | ':<='; AXIOMSEP: ';';
src/OrdUtil.agda
shinji-kono/zf-in-agda
5
1890
open import Level open import Ordinals module OrdUtil {n : Level} (O : Ordinals {n} ) where open import logic open import nat open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ ) open import Data.Empty open import Relation.Binary.PropositionalEquality open import Relation.Nullary open import Relation.Binary hiding (_⇔_) open Ordinals.Ordinals O open Ordinals.IsOrdinals isOrdinal open Ordinals.IsNext isNext o<-dom : { x y : Ordinal } → x o< y → Ordinal o<-dom {x} _ = x o<-cod : { x y : Ordinal } → x o< y → Ordinal o<-cod {_} {y} _ = y o<-subst : {Z X z x : Ordinal } → Z o< X → Z ≡ z → X ≡ x → z o< x o<-subst df refl refl = df o<¬≡ : { ox oy : Ordinal } → ox ≡ oy → ox o< oy → ⊥ o<¬≡ {ox} {oy} eq lt with trio< ox oy o<¬≡ {ox} {oy} eq lt | tri< a ¬b ¬c = ¬b eq o<¬≡ {ox} {oy} eq lt | tri≈ ¬a b ¬c = ¬a lt o<¬≡ {ox} {oy} eq lt | tri> ¬a ¬b c = ¬b eq o<> : {x y : Ordinal } → y o< x → x o< y → ⊥ o<> {ox} {oy} lt tl with trio< ox oy o<> {ox} {oy} lt tl | tri< a ¬b ¬c = ¬c lt o<> {ox} {oy} lt tl | tri≈ ¬a b ¬c = ¬a tl o<> {ox} {oy} lt tl | tri> ¬a ¬b c = ¬a tl osuc-< : { x y : Ordinal } → y o< osuc x → x o< y → ⊥ osuc-< {x} {y} y<ox x<y with osuc-≡< y<ox osuc-< {x} {y} y<ox x<y | case1 refl = o<¬≡ refl x<y osuc-< {x} {y} y<ox x<y | case2 y<x = o<> x<y y<x osucc : {ox oy : Ordinal } → oy o< ox → osuc oy o< osuc ox ---- y < osuc y < x < osuc x ---- y < osuc y = x < osuc x ---- y < osuc y > x < osuc x -> y = x ∨ x < y → ⊥ osucc {ox} {oy} oy<ox with trio< (osuc oy) ox osucc {ox} {oy} oy<ox | tri< a ¬b ¬c = ordtrans a <-osuc osucc {ox} {oy} oy<ox | tri≈ ¬a refl ¬c = <-osuc osucc {ox} {oy} oy<ox | tri> ¬a ¬b c with osuc-≡< c osucc {ox} {oy} oy<ox | tri> ¬a ¬b c | case1 eq = ⊥-elim (o<¬≡ (sym eq) oy<ox) osucc {ox} {oy} oy<ox | tri> ¬a ¬b c | case2 lt = ⊥-elim (o<> lt oy<ox) osucprev : {ox oy : Ordinal } → osuc oy o< osuc ox → oy o< ox osucprev {ox} {oy} oy<ox with trio< oy ox osucprev {ox} {oy} oy<ox | tri< a ¬b ¬c = a osucprev {ox} {oy} oy<ox | tri≈ ¬a b ¬c = ⊥-elim (o<¬≡ (cong (λ k → osuc k) b) oy<ox ) osucprev {ox} {oy} oy<ox | tri> ¬a ¬b c = ⊥-elim (o<> (osucc c) oy<ox ) open _∧_ osuc2 : ( x y : Ordinal ) → ( osuc x o< osuc (osuc y )) ⇔ (x o< osuc y) proj2 (osuc2 x y) lt = osucc lt proj1 (osuc2 x y) ox<ooy with osuc-≡< ox<ooy proj1 (osuc2 x y) ox<ooy | case1 ox=oy = o<-subst <-osuc refl ox=oy proj1 (osuc2 x y) ox<ooy | case2 ox<oy = ordtrans <-osuc ox<oy _o≤_ : Ordinal → Ordinal → Set n a o≤ b = a o< osuc b -- (a ≡ b) ∨ ( a o< b ) xo<ab : {oa ob : Ordinal } → ( {ox : Ordinal } → ox o< oa → ox o< ob ) → oa o< osuc ob xo<ab {oa} {ob} a→b with trio< oa ob xo<ab {oa} {ob} a→b | tri< a ¬b ¬c = ordtrans a <-osuc xo<ab {oa} {ob} a→b | tri≈ ¬a refl ¬c = <-osuc xo<ab {oa} {ob} a→b | tri> ¬a ¬b c = ⊥-elim ( o<¬≡ refl (a→b c ) ) maxα : Ordinal → Ordinal → Ordinal maxα x y with trio< x y maxα x y | tri< a ¬b ¬c = y maxα x y | tri> ¬a ¬b c = x maxα x y | tri≈ ¬a refl ¬c = x omin : Ordinal → Ordinal → Ordinal omin x y with trio< x y omin x y | tri< a ¬b ¬c = x omin x y | tri> ¬a ¬b c = y omin x y | tri≈ ¬a refl ¬c = x min1 : {x y z : Ordinal } → z o< x → z o< y → z o< omin x y min1 {x} {y} {z} z<x z<y with trio< x y min1 {x} {y} {z} z<x z<y | tri< a ¬b ¬c = z<x min1 {x} {y} {z} z<x z<y | tri≈ ¬a refl ¬c = z<x min1 {x} {y} {z} z<x z<y | tri> ¬a ¬b c = z<y -- -- max ( osuc x , osuc y ) -- omax : ( x y : Ordinal ) → Ordinal omax x y with trio< x y omax x y | tri< a ¬b ¬c = osuc y omax x y | tri> ¬a ¬b c = osuc x omax x y | tri≈ ¬a refl ¬c = osuc x omax< : ( x y : Ordinal ) → x o< y → osuc y ≡ omax x y omax< x y lt with trio< x y omax< x y lt | tri< a ¬b ¬c = refl omax< x y lt | tri≈ ¬a b ¬c = ⊥-elim (¬a lt ) omax< x y lt | tri> ¬a ¬b c = ⊥-elim (¬a lt ) omax≤ : ( x y : Ordinal ) → x o≤ y → osuc y ≡ omax x y omax≤ x y le with trio< x y omax≤ x y le | tri< a ¬b ¬c = refl omax≤ x y le | tri≈ ¬a refl ¬c = refl omax≤ x y le | tri> ¬a ¬b c with osuc-≡< le omax≤ x y le | tri> ¬a ¬b c | case1 eq = ⊥-elim (¬b eq) omax≤ x y le | tri> ¬a ¬b c | case2 x<y = ⊥-elim (¬a x<y) omax≡ : ( x y : Ordinal ) → x ≡ y → osuc y ≡ omax x y omax≡ x y eq with trio< x y omax≡ x y eq | tri< a ¬b ¬c = ⊥-elim (¬b eq ) omax≡ x y eq | tri≈ ¬a refl ¬c = refl omax≡ x y eq | tri> ¬a ¬b c = ⊥-elim (¬b eq ) omax-x : ( x y : Ordinal ) → x o< omax x y omax-x x y with trio< x y omax-x x y | tri< a ¬b ¬c = ordtrans a <-osuc omax-x x y | tri> ¬a ¬b c = <-osuc omax-x x y | tri≈ ¬a refl ¬c = <-osuc omax-y : ( x y : Ordinal ) → y o< omax x y omax-y x y with trio< x y omax-y x y | tri< a ¬b ¬c = <-osuc omax-y x y | tri> ¬a ¬b c = ordtrans c <-osuc omax-y x y | tri≈ ¬a refl ¬c = <-osuc omxx : ( x : Ordinal ) → omax x x ≡ osuc x omxx x with trio< x x omxx x | tri< a ¬b ¬c = ⊥-elim (¬b refl ) omxx x | tri> ¬a ¬b c = ⊥-elim (¬b refl ) omxx x | tri≈ ¬a refl ¬c = refl omxxx : ( x : Ordinal ) → omax x (omax x x ) ≡ osuc (osuc x) omxxx x = trans ( cong ( λ k → omax x k ) (omxx x )) (sym ( omax< x (osuc x) <-osuc )) open _∧_ o≤-refl : { i j : Ordinal } → i ≡ j → i o≤ j o≤-refl {i} {j} eq = subst (λ k → i o< osuc k ) eq <-osuc OrdTrans : Transitive _o≤_ OrdTrans a≤b b≤c with osuc-≡< a≤b | osuc-≡< b≤c OrdTrans a≤b b≤c | case1 refl | case1 refl = <-osuc OrdTrans a≤b b≤c | case1 refl | case2 a≤c = ordtrans a≤c <-osuc OrdTrans a≤b b≤c | case2 a≤c | case1 refl = ordtrans a≤c <-osuc OrdTrans a≤b b≤c | case2 a<b | case2 b<c = ordtrans (ordtrans a<b b<c) <-osuc OrdPreorder : Preorder n n n OrdPreorder = record { Carrier = Ordinal ; _≈_ = _≡_ ; _∼_ = _o≤_ ; isPreorder = record { isEquivalence = record { refl = refl ; sym = sym ; trans = trans } ; reflexive = o≤-refl ; trans = OrdTrans } } FExists : {m l : Level} → ( ψ : Ordinal → Set m ) → {p : Set l} ( P : { y : Ordinal } → ψ y → ¬ p ) → (exists : ¬ (∀ y → ¬ ( ψ y ) )) → ¬ p FExists {m} {l} ψ {p} P = contra-position ( λ p y ψy → P {y} ψy p ) nexto∅ : {x : Ordinal} → o∅ o< next x nexto∅ {x} with trio< o∅ x nexto∅ {x} | tri< a ¬b ¬c = ordtrans a x<nx nexto∅ {x} | tri≈ ¬a b ¬c = subst (λ k → k o< next x) (sym b) x<nx nexto∅ {x} | tri> ¬a ¬b c = ⊥-elim ( ¬x<0 c ) next< : {x y z : Ordinal} → x o< next z → y o< next x → y o< next z next< {x} {y} {z} x<nz y<nx with trio< y (next z) next< {x} {y} {z} x<nz y<nx | tri< a ¬b ¬c = a next< {x} {y} {z} x<nz y<nx | tri≈ ¬a b ¬c = ⊥-elim (¬nx<nx x<nz (subst (λ k → k o< next x) b y<nx) (λ w nz=ow → o<¬≡ nz=ow (subst₂ (λ j k → j o< k ) (sym nz=ow) nz=ow (osuc<nx (subst (λ k → w o< k ) (sym nz=ow) <-osuc) )))) next< {x} {y} {z} x<nz y<nx | tri> ¬a ¬b c = ⊥-elim (¬nx<nx x<nz (ordtrans c y<nx ) (λ w nz=ow → o<¬≡ (sym nz=ow) (osuc<nx (subst (λ k → w o< k ) (sym nz=ow) <-osuc )))) osuc< : {x y : Ordinal} → osuc x ≡ y → x o< y osuc< {x} {y} refl = <-osuc nexto=n : {x y : Ordinal} → x o< next (osuc y) → x o< next y nexto=n {x} {y} x<noy = next< (osuc<nx x<nx) x<noy nexto≡ : {x : Ordinal} → next x ≡ next (osuc x) nexto≡ {x} with trio< (next x) (next (osuc x) ) -- next x o< next (osuc x ) -> osuc x o< next x o< next (osuc x) -> next x ≡ osuc z -> z o o< next x -> osuc z o< next x -> next x o< next x nexto≡ {x} | tri< a ¬b ¬c = ⊥-elim (¬nx<nx (osuc<nx x<nx ) a (λ z eq → o<¬≡ (sym eq) (osuc<nx (osuc< (sym eq))))) nexto≡ {x} | tri≈ ¬a b ¬c = b -- next (osuc x) o< next x -> osuc x o< next (osuc x) o< next x -> next (osuc x) ≡ osuc z -> z o o< next (osuc x) ... nexto≡ {x} | tri> ¬a ¬b c = ⊥-elim (¬nx<nx (ordtrans <-osuc x<nx) c (λ z eq → o<¬≡ (sym eq) (osuc<nx (osuc< (sym eq))))) next-is-limit : {x y : Ordinal} → ¬ (next x ≡ osuc y) next-is-limit {x} {y} eq = o<¬≡ (sym eq) (osuc<nx y<nx) where y<nx : y o< next x y<nx = osuc< (sym eq) omax<next : {x y : Ordinal} → x o< y → omax x y o< next y omax<next {x} {y} x<y = subst (λ k → k o< next y ) (omax< _ _ x<y ) (osuc<nx x<nx) x<ny→≡next : {x y : Ordinal} → x o< y → y o< next x → next x ≡ next y x<ny→≡next {x} {y} x<y y<nx with trio< (next x) (next y) x<ny→≡next {x} {y} x<y y<nx | tri< a ¬b ¬c = -- x < y < next x < next y ∧ next x = osuc z ⊥-elim ( ¬nx<nx y<nx a (λ z eq → o<¬≡ (sym eq) (osuc<nx (subst (λ k → z o< k ) (sym eq) <-osuc )))) x<ny→≡next {x} {y} x<y y<nx | tri≈ ¬a b ¬c = b x<ny→≡next {x} {y} x<y y<nx | tri> ¬a ¬b c = -- x < y < next y < next x ⊥-elim ( ¬nx<nx (ordtrans x<y x<nx) c (λ z eq → o<¬≡ (sym eq) (osuc<nx (subst (λ k → z o< k ) (sym eq) <-osuc )))) ≤next : {x y : Ordinal} → x o≤ y → next x o≤ next y ≤next {x} {y} x≤y with trio< (next x) y ≤next {x} {y} x≤y | tri< a ¬b ¬c = ordtrans a (ordtrans x<nx <-osuc ) ≤next {x} {y} x≤y | tri≈ ¬a refl ¬c = (ordtrans x<nx <-osuc ) ≤next {x} {y} x≤y | tri> ¬a ¬b c with osuc-≡< x≤y ≤next {x} {y} x≤y | tri> ¬a ¬b c | case1 refl = o≤-refl refl -- x = y < next x ≤next {x} {y} x≤y | tri> ¬a ¬b c | case2 x<y = o≤-refl (x<ny→≡next x<y c) -- x ≤ y < next x x<ny→≤next : {x y : Ordinal} → x o< next y → next x o≤ next y x<ny→≤next {x} {y} x<ny with trio< x y x<ny→≤next {x} {y} x<ny | tri< a ¬b ¬c = ≤next (ordtrans a <-osuc ) x<ny→≤next {x} {y} x<ny | tri≈ ¬a refl ¬c = o≤-refl refl x<ny→≤next {x} {y} x<ny | tri> ¬a ¬b c = o≤-refl (sym ( x<ny→≡next c x<ny )) omax<nomax : {x y : Ordinal} → omax x y o< next (omax x y ) omax<nomax {x} {y} with trio< x y omax<nomax {x} {y} | tri< a ¬b ¬c = subst (λ k → osuc y o< k ) nexto≡ (osuc<nx x<nx ) omax<nomax {x} {y} | tri≈ ¬a refl ¬c = subst (λ k → osuc x o< k ) nexto≡ (osuc<nx x<nx ) omax<nomax {x} {y} | tri> ¬a ¬b c = subst (λ k → osuc x o< k ) nexto≡ (osuc<nx x<nx ) omax<nx : {x y z : Ordinal} → x o< next z → y o< next z → omax x y o< next z omax<nx {x} {y} {z} x<nz y<nz with trio< x y omax<nx {x} {y} {z} x<nz y<nz | tri< a ¬b ¬c = osuc<nx y<nz omax<nx {x} {y} {z} x<nz y<nz | tri≈ ¬a refl ¬c = osuc<nx y<nz omax<nx {x} {y} {z} x<nz y<nz | tri> ¬a ¬b c = osuc<nx x<nz nn<omax : {x nx ny : Ordinal} → x o< next nx → x o< next ny → x o< next (omax nx ny) nn<omax {x} {nx} {ny} xnx xny with trio< nx ny nn<omax {x} {nx} {ny} xnx xny | tri< a ¬b ¬c = subst (λ k → x o< k ) nexto≡ xny nn<omax {x} {nx} {ny} xnx xny | tri≈ ¬a refl ¬c = subst (λ k → x o< k ) nexto≡ xny nn<omax {x} {nx} {ny} xnx xny | tri> ¬a ¬b c = subst (λ k → x o< k ) nexto≡ xnx record OrdinalSubset (maxordinal : Ordinal) : Set (suc n) where field os→ : (x : Ordinal) → x o< maxordinal → Ordinal os← : Ordinal → Ordinal os←limit : (x : Ordinal) → os← x o< maxordinal os-iso← : {x : Ordinal} → os→ (os← x) (os←limit x) ≡ x os-iso→ : {x : Ordinal} → (lt : x o< maxordinal ) → os← (os→ x lt) ≡ x module o≤-Reasoning {n : Level} (O : Ordinals {n} ) where -- open inOrdinal O resp-o< : _o<_ Respects₂ _≡_ resp-o< = resp₂ _o<_ trans1 : {i j k : Ordinal} → i o< j → j o< osuc k → i o< k trans1 {i} {j} {k} i<j j<ok with osuc-≡< j<ok trans1 {i} {j} {k} i<j j<ok | case1 refl = i<j trans1 {i} {j} {k} i<j j<ok | case2 j<k = ordtrans i<j j<k trans2 : {i j k : Ordinal} → i o< osuc j → j o< k → i o< k trans2 {i} {j} {k} i<oj j<k with osuc-≡< i<oj trans2 {i} {j} {k} i<oj j<k | case1 refl = j<k trans2 {i} {j} {k} i<oj j<k | case2 i<j = ordtrans i<j j<k open import Relation.Binary.Reasoning.Base.Triple (Preorder.isPreorder OrdPreorder) ordtrans --<-trans (resp₂ _o<_) --(resp₂ _<_) (λ x → ordtrans x <-osuc ) --<⇒≤ trans1 --<-transˡ trans2 --<-transʳ public -- hiding (_≈⟨_⟩_)
src/Bundles.agda
Akshobhya1234/Agda-Algebra
0
11492
{-# OPTIONS --without-K --safe #-} module Bundles where open import Algebra.Core open import Relation.Binary open import Level open import Algebra.Bundles open import Algebra.Structures open import Structures ------------------------------------------------------------------------ -- Bundles with 1 binary operation ------------------------------------------------------------------------ record IdempotentMagma c ℓ : Set (suc (c ⊔ ℓ)) where infixl 7 _∙_ infix 4 _≈_ field Carrier : Set c _≈_ : Rel Carrier ℓ _∙_ : Op₂ Carrier isIdempotentMagma : IsIdempotentMagma _≈_ _∙_ open IsIdempotentMagma isIdempotentMagma public magma : Magma c ℓ magma = record { isMagma = isMagma } open Magma magma public using (rawMagma) record AlternateMagma c ℓ : Set (suc (c ⊔ ℓ)) where infixl 7 _∙_ infix 4 _≈_ field Carrier : Set c _≈_ : Rel Carrier ℓ _∙_ : Op₂ Carrier isAlternateMagma : IsAlternateMagma _≈_ _∙_ open IsAlternateMagma isAlternateMagma public magma : Magma c ℓ magma = record { isMagma = isMagma } open Magma magma public using (rawMagma) record FlexibleMagma c ℓ : Set (suc (c ⊔ ℓ)) where infixl 7 _∙_ infix 4 _≈_ field Carrier : Set c _≈_ : Rel Carrier ℓ _∙_ : Op₂ Carrier isFlexibleMagma : IsFlexibleMagma _≈_ _∙_ open IsFlexibleMagma isFlexibleMagma public magma : Magma c ℓ magma = record { isMagma = isMagma } open Magma magma public using (rawMagma) record MedialMagma c ℓ : Set (suc (c ⊔ ℓ)) where infixl 7 _∙_ infix 4 _≈_ field Carrier : Set c _≈_ : Rel Carrier ℓ _∙_ : Op₂ Carrier isMedialMagma : IsMedialMagma _≈_ _∙_ open IsMedialMagma isMedialMagma public magma : Magma c ℓ magma = record { isMagma = isMagma } open Magma magma public using (rawMagma) record SemimedialMagma c ℓ : Set (suc (c ⊔ ℓ)) where infixl 7 _∙_ infix 4 _≈_ field Carrier : Set c _≈_ : Rel Carrier ℓ _∙_ : Op₂ Carrier isSemimedialMagma : IsSemimedialMagma _≈_ _∙_ open IsSemimedialMagma isSemimedialMagma public magma : Magma c ℓ magma = record { isMagma = isMagma } open Magma magma public using (rawMagma) record LatinQuasigroup c ℓ : Set (suc (c ⊔ ℓ)) where infixl 7 _∙_ infix 4 _≈_ field Carrier : Set c _≈_ : Rel Carrier ℓ _∙_ : Op₂ Carrier isLatinQuasigroup : IsLatinQuasigroup _≈_ _∙_ open IsLatinQuasigroup isLatinQuasigroup public magma : Magma c ℓ magma = record { isMagma = isMagma } open Magma magma public using (_≉_; rawMagma) record InverseSemigroup c ℓ : Set (suc (c ⊔ ℓ)) where infixl 7 _∙_ infix 4 _≈_ field Carrier : Set c _≈_ : Rel Carrier ℓ _∙_ : Op₂ Carrier isInverseSemigroup : IsInverseSemigroup _≈_ _∙_ open IsInverseSemigroup isInverseSemigroup public magma : Magma c ℓ magma = record { isMagma = isMagma } open Magma magma public using (_≉_; rawMagma) ------------------------------------------------------------------------ -- Bundles with 1 binary operation and 1 element ------------------------------------------------------------------------ record LeftUnitalMagma c ℓ : Set (suc (c ⊔ ℓ)) where infixl 7 _∙_ infix 4 _≈_ field Carrier : Set c _≈_ : Rel Carrier ℓ _∙_ : Op₂ Carrier ε : Carrier isLeftUnitalMagma : IsLeftUnitalMagma _≈_ _∙_ ε open IsLeftUnitalMagma isLeftUnitalMagma public magma : Magma c ℓ magma = record { isMagma = isMagma } open Magma magma public using (rawMagma) record RightUnitalMagma c ℓ : Set (suc (c ⊔ ℓ)) where infixl 7 _∙_ infix 4 _≈_ field Carrier : Set c _≈_ : Rel Carrier ℓ _∙_ : Op₂ Carrier ε : Carrier isRightUnitalMagma : IsRightUnitalMagma _≈_ _∙_ ε open IsRightUnitalMagma isRightUnitalMagma public magma : Magma c ℓ magma = record { isMagma = isMagma } open Magma magma public using (rawMagma) ------------------------------------------------------------------------ -- Bundles with 2 binary operations, 1 unary operation & 1 element ------------------------------------------------------------------------ record NonAssociativeRing c ℓ : Set (suc (c ⊔ ℓ)) where infix 8 -_ infixl 7 _*_ infixl 6 _+_ infix 4 _≈_ field Carrier : Set c _≈_ : Rel Carrier ℓ _+_ : Op₂ Carrier _*_ : Op₂ Carrier -_ : Op₁ Carrier 0# : Carrier 1# : Carrier isNonAssociativeRing : IsNonAssociativeRing _≈_ _+_ _*_ -_ 0# 1# open IsNonAssociativeRing isNonAssociativeRing public +-abelianGroup : AbelianGroup _ _ +-abelianGroup = record { isAbelianGroup = +-isAbelianGroup } open AbelianGroup +-abelianGroup public using () renaming (group to +-group; invertibleMagma to +-invertibleMagma; invertibleUnitalMagma to +-invertibleUnitalMagma) ------------------------------------------------------------------------ -- Bundles with 3 binary operation and 1 element ------------------------------------------------------------------------ record Pique c ℓ : Set (suc (c ⊔ ℓ)) where infixl 7 _∙_ infixl 7 _\\_ infixl 7 _//_ infix 4 _≈_ field Carrier : Set c _≈_ : Rel Carrier ℓ _∙_ : Op₂ Carrier _\\_ : Op₂ Carrier _//_ : Op₂ Carrier ε : Carrier isPique : IsPique _≈_ _∙_ _\\_ _//_ ε open IsPique isPique public record LeftBolLoop c ℓ : Set (suc (c ⊔ ℓ)) where field Carrier : Set c _≈_ : Rel Carrier ℓ _∙_ : Op₂ Carrier _\\_ : Op₂ Carrier _//_ : Op₂ Carrier ε : Carrier isLeftBolLoop : IsLeftBolLoop _≈_ _∙_ _\\_ _//_ ε open IsLeftBolLoop isLeftBolLoop public loop : Loop _ _ loop = record { isLoop = isLoop } open Loop loop public using (quasigroup) record RightBolLoop c ℓ : Set (suc (c ⊔ ℓ)) where field Carrier : Set c _≈_ : Rel Carrier ℓ _∙_ : Op₂ Carrier _\\_ : Op₂ Carrier _//_ : Op₂ Carrier ε : Carrier isRightBolLoop : IsRightBolLoop _≈_ _∙_ _\\_ _//_ ε open IsRightBolLoop isRightBolLoop public loop : Loop _ _ loop = record { isLoop = isLoop } open Loop loop public using (quasigroup) record MoufangLoop c ℓ : Set (suc (c ⊔ ℓ)) where field Carrier : Set c _≈_ : Rel Carrier ℓ _∙_ : Op₂ Carrier _\\_ : Op₂ Carrier _//_ : Op₂ Carrier ε : Carrier isMoufangLoop : IsMoufangLoop _≈_ _∙_ _\\_ _//_ ε open IsMoufangLoop isMoufangLoop public loop : Loop _ _ loop = record { isLoop = isLoop } open Loop loop public using (quasigroup)
external/source/shellcode/windows/x86/src/stager/stager_bind_tcp_rc4.asm
madhavarao-yejarla/VoIP
35
163788
<reponame>madhavarao-yejarla/VoIP ;-----------------------------------------------------------------------------; ; Authors: <NAME> (stephen_fewer[at]harmonysecurity[dot]com) ; <NAME> (schierlm[at]gmx[dot]de) [RC4 support] ; Compatible: Windows 7, 2008, Vista, 2003, XP, 2000, NT4 ; Version: 1.0 (31 December 2012) ; Size: 413 bytes ; Build: >build.py stager_bind_tcp_rc4 ;-----------------------------------------------------------------------------; [BITS 32] [ORG 0] cld ; Clear the direction flag. call start ; Call start, this pushes the address of 'api_call' onto the stack. %include "./src/block/block_api.asm" start: ; pop ebp ; pop off the address of 'api_call' for calling later. %include "./src/block/block_bind_tcp.asm" ; By here we will have performed the bind_tcp connection and EDI will be our socket. %include "./src/block/block_recv_rc4.asm" ; By now we will have received in the second stage into a RWX buffer and be executing it
samples/blsmonitor/monitor_ram.asm
retro16/blastsdk
10
84718
dumpscroll ds 4 ; RAM dump scrolling address addr ds 4 value ds 4 cursor ds 2 ; Column index (0-16) lastinput ds 2 ; Last value of CDATA1 mode ds 1 ; 0-3 inrepeat ds 1 ; Auto-repeat timer
Appl/Art/Decks/GeoDeck/LMWin.asm
steakknife/pcgeos
504
85005
LMWin label byte word C_BLACK Bitmap <71,100,BMC_PACKBITS,BMF_MONO> db 0xf8, 0x00 db 0xf8, 0x00 db 0x00, 0x0f, 0xfa, 0xff, 0x00, 0xe0 db 0x00, 0x95, 0xfa, 0x55, 0x00, 0x50 db 0xf9, 0xaa, 0x00, 0xa8 db 0x00, 0xb5, 0xfa, 0x55, 0x00, 0x58 db 0xfd, 0xaa, 0x00, 0xba, 0xfe, 0xaa, 0x00, 0xa8 db 0x00, 0xb5, 0xfe, 0x55, 0x00, 0x6d, 0xfe, 0x55, 0x00, 0x58 db 0xf9, 0xaa, 0x00, 0xa8 db 0x00, 0xb5, 0xfe, 0x55, 0x00, 0x4d, 0xfe, 0x55, 0x00, 0x58 db 0x00, 0xaa, 0xfe, 0xff, 0x04, 0xcf, 0xff, 0xff, 0xfe, 0xa8 db 0x08, 0xb5, 0x40, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x05, 0x58 db 0x08, 0xaa, 0xdf, 0xff, 0xff, 0xef, 0xff, 0xff, 0xf6, 0xa8 db 0x08, 0xb5, 0x5f, 0xff, 0xff, 0xef, 0xff, 0xff, 0xf5, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x00, 0x28, 0x00, 0x00, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x01, 0xc7, 0x00, 0x00, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x06, 0x28, 0xc0, 0x00, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x18, 0x10, 0x30, 0x00, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x20, 0x00, 0x5f, 0xe0, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x40, 0x00, 0x3f, 0x38, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x01, 0x80, 0x00, 0x67, 0xfc, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x02, 0x00, 0x00, 0xf8, 0x32, 0x35, 0x58 db 0x08, 0xaf, 0xf8, 0x04, 0x00, 0x01, 0x60, 0x0f, 0x3f, 0xe8 db 0x08, 0xb8, 0x04, 0x04, 0x00, 0x03, 0x43, 0x87, 0xc0, 0x38 db 0x08, 0xa8, 0x04, 0x0b, 0x80, 0x03, 0x87, 0x82, 0xc0, 0x28 db 0x08, 0xb9, 0xf2, 0x08, 0x7c, 0x07, 0x8f, 0x82, 0xdf, 0x38 db 0x08, 0xa9, 0x52, 0x08, 0x03, 0xfd, 0x0f, 0x81, 0xd5, 0x28 db 0x08, 0xb9, 0x59, 0x08, 0x00, 0x05, 0x03, 0x81, 0xf5, 0x38 db 0x08, 0xa9, 0x58, 0x88, 0x00, 0x07, 0x03, 0x81, 0xf5, 0x28 db 0x08, 0xb9, 0x5c, 0x48, 0x00, 0x07, 0x03, 0x81, 0x75, 0x38 db 0x08, 0xa9, 0x5a, 0x38, 0x00, 0x07, 0x03, 0x81, 0x75, 0x28 db 0x08, 0xb4, 0xd9, 0x00, 0x00, 0x06, 0x87, 0xc3, 0xf6, 0x58 db 0x08, 0xac, 0xd8, 0xc0, 0x00, 0x02, 0x8f, 0xe3, 0xb6, 0x68 db 0x08, 0xb4, 0xd8, 0x38, 0x00, 0x07, 0xcf, 0xe5, 0xb6, 0x58 db 0x08, 0xac, 0xd8, 0x08, 0x00, 0x0b, 0xe0, 0x0d, 0x36, 0x68 db 0x08, 0xb6, 0x58, 0x08, 0x00, 0x17, 0x98, 0x3e, 0x34, 0xd8 db 0x08, 0xaa, 0x58, 0x04, 0x00, 0x2f, 0xff, 0xcc, 0x34, 0xa8 db 0x08, 0xb6, 0x58, 0x04, 0x00, 0x5f, 0xf9, 0xf8, 0x34, 0xd8 db 0x08, 0xab, 0x38, 0x04, 0x00, 0xbf, 0xff, 0xf0, 0x39, 0xa8 db 0x08, 0xb5, 0x38, 0x04, 0x01, 0x7f, 0xef, 0xd0, 0x39, 0x58 db 0x08, 0xaa, 0x98, 0x04, 0x02, 0xff, 0xdf, 0xd0, 0x32, 0xa8 db 0x08, 0xb5, 0x98, 0x04, 0x05, 0xff, 0xbf, 0xd0, 0x33, 0x58 db 0x08, 0xaa, 0xc8, 0x02, 0x0b, 0xff, 0x5f, 0xd0, 0x26, 0xa8 db 0x08, 0xb5, 0x48, 0x02, 0x17, 0xfe, 0xdf, 0xd0, 0x25, 0x58 db 0x08, 0xaa, 0xe4, 0x02, 0x2f, 0xfd, 0x5f, 0xd0, 0x4e, 0xa8 db 0x08, 0xb5, 0x64, 0x02, 0x5f, 0xfa, 0xdf, 0xd0, 0x4d, 0x58 db 0x08, 0xaa, 0xd2, 0x01, 0xbf, 0xf4, 0x5f, 0xd0, 0x96, 0xa8 db 0x08, 0xb5, 0x59, 0x01, 0x7f, 0xe8, 0xdf, 0xd1, 0x35, 0x58 db 0x08, 0xaa, 0xdc, 0xc2, 0xff, 0xd0, 0x5f, 0xd6, 0x76, 0xa8 db 0x08, 0xb5, 0x5a, 0x35, 0xff, 0xa0, 0xdf, 0xd8, 0xb5, 0x58 db 0x08, 0xaa, 0xd9, 0x08, 0x0f, 0x41, 0x5f, 0xd1, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0xdf, 0xee, 0x80, 0xdf, 0xde, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x30, 0x6d, 0x01, 0x5f, 0xd8, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x0f, 0xea, 0x02, 0xdf, 0xd0, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x24, 0x01, 0x5f, 0xd0, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x28, 0x02, 0xdf, 0xd0, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x30, 0x01, 0x5d, 0xd0, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x30, 0x02, 0xda, 0xd0, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x08, 0x05, 0x55, 0x50, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x08, 0x02, 0xc8, 0x90, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x04, 0x05, 0x50, 0x50, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x02, 0x0a, 0xe0, 0x30, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x01, 0x05, 0x40, 0x10, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x00, 0xce, 0x00, 0x00, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x03, 0x05, 0x80, 0x00, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x04, 0x0a, 0xc0, 0x00, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x03, 0x05, 0x80, 0x00, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x02, 0x05, 0x80, 0x00, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x03, 0x03, 0x80, 0x00, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x04, 0x05, 0x40, 0x00, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x18, 0x02, 0xb0, 0x00, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x20, 0x01, 0x58, 0x00, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x40, 0x02, 0xac, 0x00, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x80, 0x01, 0x56, 0x00, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x01, 0x00, 0x02, 0xab, 0x00, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x01, 0x00, 0x01, 0x55, 0x00, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0xc0, 0x02, 0xae, 0x00, 0x36, 0xa8 db 0x08, 0xb5, 0x58, 0x00, 0x3c, 0x05, 0x78, 0x00, 0x35, 0x58 db 0x08, 0xaa, 0xd8, 0x00, 0x03, 0xff, 0x80, 0x00, 0x36, 0xa8 db 0x01, 0xb5, 0x58, 0xfc, 0x00, 0x01, 0x35, 0x58 db 0x01, 0xaa, 0xdf, 0xfc, 0xff, 0x01, 0xf6, 0xa8 db 0x01, 0xb5, 0x5f, 0xfc, 0xff, 0x01, 0xf5, 0x58 db 0x01, 0xaa, 0xc0, 0xfc, 0x00, 0x01, 0x06, 0xa8 db 0x01, 0xb5, 0x7f, 0xfc, 0xff, 0x01, 0xfd, 0x58 db 0xf9, 0xaa, 0x00, 0xa8 db 0x00, 0xb5, 0xfa, 0x55, 0x00, 0x58 db 0xf9, 0xaa, 0x00, 0xa8 db 0x00, 0xb5, 0xfa, 0x55, 0x00, 0x58 db 0xf9, 0xaa, 0x00, 0xa8 db 0x00, 0xb5, 0xfa, 0x55, 0x00, 0x58 db 0x00, 0x9a, 0xfa, 0xaa, 0x00, 0xb0 db 0x00, 0x0f, 0xfa, 0xff, 0x00, 0xe0 db 0xf8, 0x00 db 0xf8, 0x00
src/main/antlr/LanguageParser.g4
Yurati/Compiler
0
736
parser grammar LanguageParser; options { tokenVocab=LanguageLexer; } parse : block EOF ; block : stat* ; stat : assignment | if_stat | while_stat | for_stat | do_while_stat | print | OTHER {System.err.println("Unknown character: " + $OTHER.text);} ; assignment : FUNC type ID ASSIGN expr SEMICOLON | ID ASSIGN expr SEMICOLON ; type : WHOLE | DOULOT | INSCRIPTION ; if_stat : UNLESS condition_block (ELSE stat_block)? ; condition : LPAREN expr RPAREN ; condition_block : condition stat_block ; stat_block : LBRACE block RBRACE | stat ; while_stat : NOTTHISTIME condition_block ; for_stat : AGAINST for_condition ; for_condition : LPAREN assignment expr SEMICOLON assignment RPAREN stat_block ; do_while_stat : DONT stat_block NOTTHISTIME condition block ; print : PRINT expr SEMICOLON ; expr : BANG expr #notExpr | expr op=(MUL | DIV) expr #multiplicationExpr | expr op=(ADD | SUB) expr #additiveExpr | expr op=(LTEQ | GTEQ | LT | GT) expr #relationalExpr | expr op=(EQUAL | NOTEQUAL) expr #equalityExpr | expr AND expr #andExpr | expr OR expr #orExpr | atom #atomExpr ; atom : LPAREN expr RPAREN #parExpr | (WHOLE_VALUE | DOULOT_VALUE) #numberAtom | (TRUE | FALSE) #booleanAtom | ID #idAtom | INSCRIPTION_VALUE #stringAtom | NOPELITERAL #nilAtom ;
Transynther/x86/_processed/NC/_ht_zr_/i7-7700_9_0xca_notsx.log_18437_417.asm
ljhsiun2/medusa
9
175981
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r15 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x1d57f, %rcx nop nop cmp %rdx, %rdx mov (%rcx), %eax nop nop nop nop xor $19386, %r13 lea addresses_D_ht+0xda6d, %rsi lea addresses_A_ht+0x16bcf, %rdi nop nop nop nop nop add $45326, %rax mov $109, %rcx rep movsb nop nop nop sub $32822, %rsi lea addresses_normal_ht+0x1330d, %rsi lea addresses_WT_ht+0x1b521, %rdi nop nop sub %rdx, %rdx mov $48, %rcx rep movsb nop nop inc %rcx lea addresses_WC_ht+0x13e0d, %rsi lea addresses_normal_ht+0x1d70d, %rdi xor $8345, %rax mov $42, %rcx rep movsw nop nop nop and $32890, %r13 lea addresses_D_ht+0x280d, %rdi nop nop nop nop nop cmp %r12, %r12 vmovups (%rdi), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $0, %xmm2, %rsi nop nop and %rdx, %rdx lea addresses_normal_ht+0x11f0d, %rdx nop nop nop nop nop sub $62651, %r13 and $0xffffffffffffffc0, %rdx vmovntdqa (%rdx), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $0, %xmm1, %r12 nop nop nop nop xor %rdi, %rdi lea addresses_UC_ht+0x1900d, %rsi lea addresses_UC_ht+0xf68f, %rdi nop nop nop nop nop dec %r15 mov $28, %rcx rep movsw nop nop nop nop nop xor $16086, %rdx lea addresses_D_ht+0x1e2ad, %r12 add $42485, %rax mov $0x6162636465666768, %rdi movq %rdi, %xmm0 and $0xffffffffffffffc0, %r12 movntdq %xmm0, (%r12) nop cmp $15745, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r15 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %rax push %rcx push %rsi // Faulty Load mov $0x2e97bd0000000b0d, %r13 nop nop nop sub %rcx, %rcx vmovups (%r13), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %r14 lea oracles, %rax and $0xff, %r14 shlq $12, %r14 mov (%rax,%r14,1), %r14 pop %rsi pop %rcx pop %rax pop %r14 pop %r13 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': 32, 'congruent': 0, 'same': True, 'type': 'addresses_NC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'} {'src': {'congruent': 10, 'same': True, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 8, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 3, 'same': True, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'dst': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'00': 1842, '44': 14050, '48': 205, '46': 2340} 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 46 44 44 44 00 48 44 44 44 44 44 44 44 44 44 00 44 00 44 44 44 48 44 44 46 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 46 44 44 44 44 44 46 00 44 46 00 44 44 44 44 00 44 44 46 46 44 44 48 44 44 44 44 44 44 00 46 44 44 44 44 44 00 44 44 44 44 44 44 46 44 44 46 00 44 44 00 44 44 00 46 00 44 44 46 44 44 48 44 44 44 44 44 44 44 00 44 44 44 44 46 44 44 44 44 44 44 44 44 44 46 44 46 44 44 44 44 44 00 44 44 00 00 00 44 46 44 44 46 44 44 44 44 44 46 00 44 44 46 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 00 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 00 44 46 44 44 44 44 44 44 44 44 46 44 00 44 46 46 44 44 00 44 44 44 44 44 44 44 44 44 46 44 44 46 00 44 44 44 44 44 44 00 44 00 44 44 44 44 44 48 44 44 00 44 44 44 44 48 46 44 44 44 44 46 48 44 44 44 44 44 46 44 44 46 44 44 44 44 46 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 46 44 44 46 44 44 44 44 44 44 44 44 44 44 44 46 46 46 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 00 44 44 44 44 44 44 00 44 44 44 44 00 44 44 44 44 00 00 00 44 44 44 48 00 44 44 44 44 44 00 44 44 44 44 44 44 44 46 44 44 46 44 44 44 46 46 46 44 44 44 44 44 44 44 44 46 44 44 44 44 44 00 44 44 46 44 44 44 44 44 44 44 46 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 46 44 46 46 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 46 00 44 44 44 44 44 44 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 46 44 44 00 44 44 46 00 44 44 46 44 00 44 44 46 00 44 44 46 44 44 44 44 46 44 44 44 44 44 44 46 46 44 44 44 44 44 44 44 44 44 44 44 44 00 44 46 44 44 44 44 44 44 44 44 46 44 44 46 00 44 44 44 00 44 44 44 00 44 44 44 00 00 44 44 44 44 44 44 44 44 44 44 46 44 44 44 46 44 44 44 44 46 44 44 44 44 44 44 44 00 44 46 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 44 46 46 46 44 44 44 44 44 44 44 46 44 44 44 46 44 44 44 44 44 44 44 44 00 44 46 44 00 00 44 44 44 44 46 44 44 44 44 44 44 44 44 00 46 44 44 44 44 44 44 46 46 46 44 44 44 44 00 44 46 00 44 44 44 44 44 44 46 44 44 44 44 44 00 44 44 44 44 44 44 44 48 44 44 44 44 44 00 44 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 00 44 44 46 44 44 44 00 46 44 44 46 44 46 44 46 44 44 46 44 44 00 44 46 46 44 46 00 44 44 44 44 44 44 44 46 44 44 44 44 44 44 46 44 44 44 44 44 44 44 44 44 00 44 46 46 44 46 44 44 44 44 44 44 00 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 48 44 44 44 44 00 46 44 44 44 44 44 44 44 00 44 44 44 44 46 00 46 44 44 44 44 00 00 00 44 44 44 44 44 44 44 46 44 44 44 44 44 44 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 46 44 46 44 46 00 44 00 44 46 44 00 44 00 44 44 44 46 44 46 44 44 44 44 44 44 44 44 44 44 46 44 44 46 44 00 00 44 46 44 44 44 44 00 44 44 44 46 44 44 44 44 46 44 00 44 46 46 44 44 00 44 44 44 46 00 44 46 46 44 44 46 44 44 44 44 44 44 44 44 00 44 46 44 00 44 46 44 00 44 44 44 44 44 44 46 44 44 44 00 44 44 */
oeis/279/A279312.asm
neoneye/loda-programs
11
10611
<gh_stars>10-100 ; A279312: Number of subsets of {1, 2, 3, ..., n} that include no consecutive even integers. ; Submitted by <NAME> ; 1,2,4,8,12,24,40,80,128,256,416,832,1344,2688,4352,8704,14080,28160,45568,91136,147456,294912,477184,954368,1544192,3088384,4997120,9994240,16171008,32342016,52330496 mov $1,$0 sub $0,1 gcd $0,2 div $1,2 add $1,1 seq $1,63727 ; a(n) = 2*a(n-1) + 4*a(n-2), a(0)=1, a(1)=2. mul $0,$1 div $0,2
tools/grammar/src/main/antlr4/org/opencypher/tools/antlr/bnf/BNF.g4
Arogova/openCypher
654
7825
/* [The "BSD licence"] Copyright (c) 2013 <NAME> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ /* sql bnf * differs from bnf as known to antlr list of grammars in how multiplicity is shown * ... is + * */ grammar BNF; rulelist : header? rule_* EOF ; header : description ; description : descriptionLine+ ; // descriptionLine* // DESCRIPTION_END // ; // descriptionLine : NORMAL_TEXT ; // //DESCRIPTION_START : '(*' ; // [\r]? [\n]; //DESCRIPTION_CONTENT : ~[\r\n] ; //DESCRIPTION_END : '*)'; // ~[\r\n]* [\r\n] ; //HEADER_LINEEND : [\r]? [\n] ; rule_ : description? lhs ASSIGN rhs ; lhs : LT ruleid GT ; rhs : bnfsymbols+ | alternatives ; bnfsymbols : bnfsymbol+ ; alternatives : alternative (BAR alternative)* ; alternative : element* ; element : optionalitem | requireditem | text | id | characterset | normaltext ; optionalitem : REND alternatives LEND ELLIPSIS? ; requireditem : RBRACE alternatives LBRACE ELLIPSIS? ; // this was ID,not WORD, but ID allows space text : UNICODE_LITERAL | ID | CHARACTER_LITERAL | INTEGER_LITERAL ; id : LT ruleref GT ELLIPSIS? ; characterset : '$' ( namedcharacterset | exclusioncharacterset | listcharacterset) '$' ; normaltext : NORMAL_TEXT ; namedcharacterset : ID ; exclusioncharacterset : '~'listcharacterset ; listcharacterset : '[' text+ ']' ; ruleref : ID ; ruleid : ID ; bnfsymbol : ASSIGN | LBRACE | RBRACE | LEND | REND | BAR | GT | LT | ELLIPSIS | DOUBLE_EXCLAM | DOLLAR ; ASSIGN : '::=' ; LBRACE : '}' ; RBRACE : '{' ; // who chose these names ? LEND : ']' ; REND : '[' ; BAR : '|' ; GT : '>' ; LT : '<' ; ELLIPSIS : '...' ; DOUBLE_EXCLAM : '!!' ; // now used for charset delimitation DOLLAR : '$' ; // allow hyphens and underscore, but not space //WORD // : ('a'..'z'|'A'..'Z') ('a'..'z'|'A'..'Z'|'0'..'9'|'-'|'_')* // ; // and space ID : ('a'..'z'|'A'..'Z') ('a'..'z'|'A'..'Z'|'0'..'9'|'-'|' '|'_')* ; // "normal english text" is a single line and an alternative NORMAL_TEXT : '!!' ~[\r\n]* ; // comments distinct from "normal text" ? SINGLE_LINE_COMMENT : '//' ~[\r\n]* -> channel(HIDDEN) ; INTEGER_LITERAL : '0'..'9'+ ; // this was // CHARACTER_LITERAL : [(),&.\*:=/%+!~;?_"\'`@\\'^-] ; // but \* and \' were disallowed at 4.7.2. Not sure if it meant \ or *. Assumi CHARACTER_LITERAL : [(),&.*:=/%+!~;?_"'`@\\^-] ; // : '(' | ')' | ',' | '&' | '.' | '-' | '*' | ':' | '=' | '/' | '%' | '+' | '!' // | '~' | ';' | '?' | '_' | '"' | '\'' | '`' | '@' | '\\' // added for gql // | '^' // added for cypher via bnf (for now) // | '..' // ; // modified from http://www.rpatk.net/rpatk/doc/doxygen/rpadoc/html/rpa_bnf.html // (which had [ ] round it UNICODE_LITERAL : '\\u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ; fragment HEX_DIGIT : [0123456789ABCDEFabcdef] ; // whitespace goes to hidden so we can handle block comments (i hope) WS : [ \r\n\t] -> skip ; //fragment MINUS : '-' ;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt13_pkg.ads
best08618/asylo
7
12516
package Opt13_Pkg is N : Natural := 0; type My_Type is private; procedure Allocate (T : out My_Type); private type Data; type My_Type is access Data; end Opt13_Pkg;
test/Fail/Erased-cubical-Open-public/Erased.agda
cagix/agda
1,989
17191
{-# OPTIONS --erased-cubical #-} module Erased-cubical-Open-public.Erased (_ : Set₁) where postulate A : Set
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/noreturn4.ads
best08618/asylo
7
17337
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/noreturn4.ads<gh_stars>1-10 package Noreturn4 is procedure P1 (Msg : String); procedure P1 (Msg : String; Val : Integer); pragma No_Return (P1); procedure Fatal_Error (X : Integer); pragma No_Return (Fatal_Error); end Noreturn4;
libsrc/_DEVELOPMENT/arch/zx/esxdos/c/sdcc_iy/errno_from_esxdos.asm
jpoikela/z88dk
640
2852
<reponame>jpoikela/z88dk ; uchar errno_from_esxdos(uchar code) SECTION code_clib SECTION code_esxdos PUBLIC _errno_from_esxdos EXTERN asm_errno_from_esxdos _errno_from_esxdos: pop af pop hl push hl push af jp asm_errno_from_esxdos
src/tk/tk-ttkentry.ads
thindil/tashy2
2
20976
<filename>src/tk/tk-ttkentry.ads -- Copyright (c) 2021 <NAME> <<EMAIL>> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Tcl.Strings; use Tcl.Strings; with Tk.Widget; use Tk.Widget; with Tk.TtkWidget; use Tk.TtkWidget; -- ****h* Tk/TtkEntry -- FUNCTION -- Provides code for manipulate Tk widget ttk::entry -- SOURCE package Tk.TtkEntry is -- **** --## rule off REDUCEABLE_SCOPE -- ****t* TtkEntry/TtkEntry.Ttk_Entry -- FUNCTION -- The Tk identifier of the ttk::entry -- HISTORY -- 8.6.0 - Added -- SOURCE subtype Ttk_Entry is Ttk_Widget; -- **** -- ****t* TtkEntry/TtkEntry.Entry_State_Type -- FUNCTION -- Available states of Ttk_Entry widget -- OPTIONS -- NONE - Used mostly when setting default state for widget -- NORMAL - The normal state of widget, can be edited -- DISABLED - The widget can't be edited and text can't be selected -- READONLY - The widget can't be edited but text can be selected -- HISTORY -- 8.6.0 - Added -- SOURCE type Entry_State_Type is (NONE, NORMAL, DISABLED, READONLY) with Default_Value => NONE; -- **** -- ****d* TtkEntry/TtkEntry.Default_Entry_State -- FUNCTION -- The default state of the Ttk_Entry widget -- HISTORY -- 8.6.0 - Added -- SOURCE Default_Entry_State: constant Entry_State_Type := NORMAL; -- **** -- ****t* TtkEntry/TtkEntry.Validate_Type -- FUNCTION -- Available types of Ttk_Entry widget text validation -- OPTIONS -- EMPTY - Used mostly when setting default validation state for -- widget -- NONE - No validation of text -- FOCUS - Validate text when Ttk_Widget receive or loss focus -- FOCUSIN - Validate text when Ttk_Widget receive focus -- FOCUSOUT - Validate text when Ttk_Widget loss focus -- KEY - Validate text before insert or delete it -- VALIDATEALL - Validate text for all above conditions -- HISTORY -- 8.6.0 - Added -- SOURCE type Validate_Type is (EMPTY, NONE, FOCUS, FOCUSIN, FOCUSOUT, KEY, VALIDATEALL) with Default_Value => EMPTY; -- **** -- ****d* TtkEntry/TtkEntry.Default_Validate -- FUNCTION -- The default validation condition for Ttk_Entry widget -- HISTORY -- 8.6.0 - Added -- SOURCE Default_Validate: constant Validate_Type := EMPTY; -- **** -- ****s* TtkEntry/TtkEntry.Ttk_Entry_Options -- FUNCTION -- Data structure for all available options for the Tk Ttk_Entry -- OPTIONS -- X_Scroll_Command - Tcl command used to communicate with the horizontal -- scrollbars. When the view of the Ttk_Entry changes, it -- will execute that command with two parameters. The -- first is fraction between 1 and 0 for the first -- visible position in the entry, the second, also -- fraction between 1 and 0 is the last visible position -- in the entry. -- Export_Selection - If true, synchronize selection in Ttk_Entry with the -- system selection (deselect other windows selections, etc.) -- Invalid_Command - Tcl command which will be executed when the content of -- Ttk_Entry is invalid -- Justify - Specifies how the text in Ttk_Entry should be justified -- Show - If True, show the content of the Ttk_Entry. If false, -- show the content as bullet or "*". -- State - The state of the Ttk_Entry -- Text_Variable - The name of the Tcl variable which contains the content -- of the Ttk_Entry. When its value change, the content -- will be changed too and vice versa. -- Validation - Set the validation mode for the Ttk_Entry -- Validate_Command - Tcl command which will be executed to validate the -- content of the Ttk_Entry. That command must return 1 -- for valid content and 0 for invalid. -- Width - The width of Ttk_Entry in characters -- HISTORY -- 8.6.0 - Added -- SOURCE type Ttk_Entry_Options is new Ttk_Widget_Options with record X_Scroll_Command: Tcl_String := Null_Tcl_String; Export_Selection: Extended_Boolean := NONE; Invalid_Command: Tcl_String := Null_Tcl_String; Justify: Justify_Type := NONE; Show: Extended_Boolean := NONE; State: Entry_State_Type := NONE; Text_Variable: Tcl_String := Null_Tcl_String; Validation: Validate_Type := EMPTY; Validate_Command: Tcl_String := Null_Tcl_String; Width: Natural := 0; end record; -- **** -- ****t* TtkEntry/TtkEntry.Entry_Index_Type -- FUNCTION -- Available types of Ttk_Entry indices -- OPTIONS -- LASTCHARACTER - The position just after the last character in Ttk_Entry -- INSERT - The current position of the insert cursor in Ttk_Entry -- SELECTIONFIRST - The first character in the selection in Ttk_Entry -- SELECTIONLAST - The last character in the selection in Ttk_Entry -- NONE - Used mostly when setting empty position in Ttk_Entry -- HISTORY -- 8.6.0 - Added -- SOURCE type Entry_Index_Type is (LASTCHARACTER, INSERT, SELECTIONFIRST, SELECTIONLAST, NONE) with Default_Value => NONE; -- **** -- ****d* TtkEntry/TtkEntry.Default_Entry_Index -- FUNCTION -- The default type of Ttk_Entry indice -- HISTORY -- 8.6.0 - Added -- SOURCE Default_Entry_Index: constant Entry_Index_Type := NONE; -- **** -- ****t* TtkEntry/TtkEntry.Fraction_Type -- FUNCTION -- Type used to get or set visible fraction of Ttk_Entry. Value 0 means the -- start of the Ttk_Entry on the left, 1.0 end of the Ttk_Entry on the -- right. -- HISTORY -- 8.6.0 - Added -- SOURCE type Fraction_Type is digits 2 range 0.0 .. 1.0 with Default_Value => 0.0; -- **** -- ****d* TtkEntry/TtkEntry.Default_Fraction -- FUNCTION -- Default fraciton value for Ttk_Entry (left side of the widget) -- HISTORY -- 8.6.0 - Added -- SOURCE Default_Fraction: constant Fraction_Type := 0.0; -- **** -- ****t* TtkEntry/TtkEntry.Scroll_Unit_Type -- FUNCTION -- Types of unit used in setting scrolling position -- OPTIONS -- UNITS - The value used to scroll is in characters -- PAGES - The value used to scroll is in screens -- HISTORY -- 8.6.0 - Added -- SOURCE type Scroll_Unit_Type is (UNITS, PAGES) with Default_Value => UNITS; -- **** -- ****d* TtkEntry/TtkEntry.Default_Scroll_Unit -- FUNCTION -- Default type of unit used in setting scrolling position -- HISTORY -- 8.6.0 - Added -- SOURCE Default_Scroll_Unit: constant Scroll_Unit_Type := UNITS; -- **** -- ****t* TtkEntry/TtkEntry.Fractions_Array -- FUNCTION -- Used to get the current view fraction of the Ttk_Entry. The first value -- is the fraction of the first visible element in the widget. The second -- value is the fraction of the last visible element in the widget. -- HISTORY -- 8.6.0 - Added -- SOURCE type Fractions_Array is array(1 .. 2) of Fraction_Type with Default_Component_Value => Default_Fraction; -- **** -- ****d* TtkEntry/TtkEntry.Default_Fractions_Array -- FUNCTION -- The default or empty array of fractions -- HISTORY -- 8.6.0 - Added -- SOURCE Default_Fractions_Array: constant Fractions_Array := (others => <>); -- **** -- ****f* TtkEntry/TtkEntry.Create_(function) -- FUNCTION -- Create a new Tk ttk::entry widget with the selected pathname and options -- PARAMETERS -- Path_Name - Tk pathname for the newly created entry -- Options - Options for the newly created entry -- Interpreter - Tcl interpreter on which the entry will be created. Can -- be empty. Default value is the default Tcl interpreter -- RESULT -- The Tk identifier of the newly created entry widget -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Create the entry with pathname .myentry, with width 15 characters -- My_Entry: constant Ttk_Entry := Create(".myentry", (Width => 15, others => <>)); -- SEE ALSO -- TtkEntry.Create_(procedure) -- COMMANDS -- ttk::entry Path_Name Options -- SOURCE function Create (Path_Name: Tk_Path_String; Options: Ttk_Entry_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) return Ttk_Entry with Pre'Class => Path_Name'Length > 0 and Interpreter /= Null_Interpreter, Test_Case => (Name => "Test_Create_TtkEntry1", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Create_(procedure) -- FUNCTION -- Create a new Tk ttk::entry widget with the selected pathname and options -- PARAMETERS -- Entry_Widget - Ttk_Entry identifier which will be returned -- Path_Name - Tk pathname for the newly created entry -- Options - Options for the newly created entry -- Interpreter - Tcl interpreter on which the entry will be created. Can -- be empty. Default value is the default Tcl interpreter -- OUTPUT -- The Entry_Widget parameter as Tk identifier of the newly created entry widget -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Create the entry with pathname .myentry, disabled by default -- declare -- My_Entry: Ttk_Entry; -- begin -- Create(My_Entry, ".myentry", (State => DISABLED, others => <>)); -- end; -- SEE ALSO -- TtkEntry.Create_(function) -- COMMANDS -- ttk::entry Path_Name Options -- SOURCE procedure Create (Entry_Widget: out Ttk_Entry; Path_Name: Tk_Path_String; Options: Ttk_Entry_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) with Pre'Class => Path_Name'Length > 0 and Interpreter /= Null_Interpreter, Test_Case => (Name => "Test_Create_TtkEntry2", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Get_Options -- FUNCTION -- Get all values of Tk options of the selected entry -- PARAMETERS -- Entry_Widget - Ttk_Entry which options' values will be taken -- RESULT -- Ttk_Entry_Options record with values of the selected entry options -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get all values of option of Ttk_Entry with pathname .myentry -- My_Entry_Options: constant Ttk_Entry_Options := Get_Options(Get_Widget(".myentry")); -- SEE ALSO -- TtkEntry.Configure -- COMMANDS -- Entry_Widget configure -- SOURCE function Get_Options(Entry_Widget: Ttk_Entry) return Ttk_Entry_Options with Pre'Class => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Get_Options_TtkEntry", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Configure -- FUNCTION -- Set the selected options for the selected Ttk_Entry -- PARAMETERS -- Entry_Widget - Ttk_Entry which options will be set -- Options - The record with new values for the entry options -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Disable entry with pathname .myentry -- Configure(Get_Widget(".myentry"), (State => DISABLED, others => <>)); -- SEE ALSO -- TtkEntry.Get_Options -- COMMANDS -- Entry_Widget configure Options -- SOURCE procedure Configure (Entry_Widget: Ttk_Entry; Options: Ttk_Entry_Options) with Pre'Class => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Configure_TtkEntry", Mode => Nominal); -- **** -- ****d* TtkEntry/TtkEntry.Default_Ttk_Entry_Options -- FUNCTION -- The default options for the Ttk_Entry -- HISTORY -- 8.6.0 - Added -- SOURCE Default_Ttk_Entry_Options: constant Ttk_Entry_Options := Ttk_Entry_Options'(others => <>); -- **** -- ****f* TtkEntry/TtkEntry.Get_Bounding_Box_(numeric_index) -- FUNCTION -- Get the bouding box for the character in Ttk_Entry with the selected -- numerical index -- PARAMETERS -- Entry_Widget - The Ttk_Entry widget which bouding box will be get -- Index - The index or X coordinate of the character in -- Entry_Widget. -- Is_Index - If True, Index is numerical index of the character. If -- False, Index is X coordinate of the character. Can be -- empty. Default value is True. -- RESULT -- BBox_Data with 4 values. The first two are staring point (x, y) of -- the bounding box, the third is width and the fourth is height of the -- bounding box. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get the bouding box of the second character in Ttk_Entry My_Entry widget -- Bounding_Box: constant BBox_Data := Get_Bounding_Box(My_Entry, 1); -- SEE ALSO -- TtkEntry.Get_Bounding_Box_(entry_index_type) -- COMMANDS -- Entry_Widget bbox Index -- SOURCE function Get_Bounding_Box (Entry_Widget: Ttk_Entry; Index: Natural; Is_Index: Boolean := True) return Bbox_Data with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Bounding_Box", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Get_Bounding_Box_(entry_index_type) -- FUNCTION -- Get the bouding box for the character in Ttk_Entry with the selected -- Entry_Index_Type index -- PARAMETERS -- Entry_Widget - The Ttk_Entry widget which bouding box will be get -- Index - The index of the character in Entry_Widget. -- RESULT -- BBox_Data with 4 values. The first two are staring point (x, y) of -- the bounding box, the third is width and the fourth is height of the -- bounding box. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get the bouding box of the last character in Ttk_Entry My_Entry widget -- Bounding_Box: constant BBox_Data := Get_Bounding_Box(My_Entry, LASTCHARACTER); -- SEE ALSO -- TtkEntry.Get_Bounding_Box_(numerical_index) -- COMMANDS -- Entry_Widget bbox Index -- SOURCE function Get_Bounding_Box (Entry_Widget: Ttk_Entry; Index: Entry_Index_Type) return Bbox_Data with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Bounding_Box2", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Delete_(natural_indexes) -- FUNCTION -- Delete one or more elements from the Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry widget in which the characters will be -- deleted -- First - The index or X coordinate of the first character to -- delete -- Last - The index or X coordinate after the last character -- to delete. Can be empty. Default value is 0. -- Is_First_Index - If True, the First index is numerical index, otherwise -- it is X coordinate. Can be empty. Default value is -- True. -- Is_Last_Index - If True, the Last index is numerical index, otherwise -- it is X coordinate. Can be empty. Default value is -- True. Means nothing if Last is equal to 0. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Delete the first character in Ttk_Entry My_Entry -- Delete(My_Entry, 0); -- SEE ALSO -- TtkEntry.Delete_(entry_index_type), -- TtkEntry.Delete_(numerical_entry_index_type), -- TtkEntry.Delete_(entry_index_type_numerical) -- COMMANDS -- Entry_Widget delete First ?Last? -- SOURCE procedure Delete (Entry_Widget: Ttk_Entry; First: Natural; Last: Natural := 0; Is_First_Index, Is_Last_Index: Boolean := True) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Delete", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Delete_(entry_index_type) -- FUNCTION -- Delete one or more elements from the Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry widget in which the characters will be -- deleted -- First - The index of the first character to delete -- Last - The index after the last character to delete. Can be -- empty. Default value is NONE. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Delete the last character in Ttk_Entry My_Entry -- Delete(My_Entry, LASTCHARACTER); -- SEE ALSO -- TtkEntry.Delete_(numerical_indexes), -- TtkEntry.Delete_(numerical_entry_index_type), -- TtkEntry.Delete_(entry_index_type_numerical) -- COMMANDS -- Entry_Widget delete First ?Last? -- SOURCE procedure Delete (Entry_Widget: Ttk_Entry; First: Entry_Index_Type; Last: Entry_Index_Type := NONE) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Delete2", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Delete_(numerical_entry_index_type) -- FUNCTION -- Delete one or more elements from the Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry widget in which the characters will be -- deleted -- First - The index or X coordinate of the first character to -- delete -- Last - The index after the last character to delete. Can be -- empty. Default value is NONE. -- Is_First_Index - If True, the First index is numerical index, otherwise -- it is X coordinate. Can be empty. Default value is -- True. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Delete the whole content of the Ttk_Entry My_Entry -- Delete(My_Entry, 0, LASTCHARACTER); -- SEE ALSO -- TtkEntry.Delete_(numerical_indexes), -- TtkEntry.Delete_(entry_index_type), -- TtkEntry.Delete_(entry_index_type_numerical) -- COMMANDS -- Entry_Widget delete First ?Last? -- SOURCE procedure Delete (Entry_Widget: Ttk_Entry; First: Natural; Last: Entry_Index_Type := NONE; Is_First_Index: Boolean := True) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Delete3", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Delete_(entry_index_type_numerical) -- FUNCTION -- Delete one or more elements from the Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry widget in which the characters will be -- deleted -- First - The index of the first character to delete -- Last - The index or X coordinate after the last character -- to delete. Can be empty. Default value is 0. -- Is_Last_Index - If True, the Last index is numerical index, otherwise -- it is X coordinate. Can be empty. Default value is -- True. Means nothing if Last is equal to 0. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Delete the last selected character in Ttk_Entry My_Entry -- Delete(My_Entry, SELECTIONLAST); -- SEE ALSO -- TtkEntry.Delete_(numerical_indexes), -- TtkEntry.Delete_(entry_index_type), -- TtkEntry.Delete_(numerical_entry_index_type), -- COMMANDS -- Entry_Widget delete First ?Last? -- SOURCE procedure Delete (Entry_Widget: Ttk_Entry; First: Entry_Index_Type; Last: Natural := 0; Is_Last_Index: Boolean := True) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Delete4", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Get_Text -- FUNCTION -- Get the content of the selected Ttk_Entry -- PARAMETERS -- Entry_Widget - Ttk_Entry which content will be get -- RESULT -- String with the content of the selected Entry_Widget -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get the content of Ttk_Entry My_Entry -- My_Text: constant String := Get_Text(My_Entry); -- COMMANDS -- Entry_Widget get -- SOURCE function Get_Text(Entry_Widget: Ttk_Entry) return String with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Get_Text", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Set_Insert_Cursor_(numerical_index) -- FUNCTION -- Set the insertion cursor to the selected position in the selected -- Ttk_Entry -- PARAMETERS -- Entry_Widget - Ttk_Entry in which the insertion cursor will be set -- Index - The index or X coordinate of the character on which -- the insertion cursor will be set -- Is_Index - If True, Index is numerical index of the character. If -- False, Index is X coordinate of the character. Can be -- empty. Default value is True. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Set the insertion cursor at the beginning of Ttk_Entry My_Entry -- Set_Insert_Cursor(My_Entry, 0); -- SEE ALSO -- TtkEntry.Set_Insert_Cursor_(entry_index_type) -- COMMANDS -- Entry_Widget icursor Index -- SOURCE procedure Set_Insert_Cursor (Entry_Widget: Ttk_Entry; Index: Natural; Is_Index: Boolean := True) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Set_Insert_Cursor", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Set_Insert_Cursor_(entry_index_type) -- FUNCTION -- Set the insertion cursor to the selected position in the selected -- Ttk_Entry -- PARAMETERS -- Entry_Widget - Ttk_Entry in which the insertion cursor will be set -- Index - The index of the character on which the insertion -- cursor will be set -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Set the insertion cursor at the end of Ttk_Entry My_Entry -- Set_Insert_Cursor(My_Entry, LASTCHARACTER); -- SEE ALSO -- TtkEntry.Set_Insert_Cursor_(numerical_index) -- COMMANDS -- Entry_Widget icursor Index -- SOURCE procedure Set_Insert_Cursor (Entry_Widget: Ttk_Entry; Index: Entry_Index_Type) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Set_Insert_Cursor2", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Get_Index_(x_coordinate) -- FUNCTION -- Get the numerical index of the character in Ttk_Entry at the selected -- X coordinate -- PARAMETERS -- Entry_Widget - Ttk_Entry in which the index will be get -- X - The X coordinate at which the index will be get -- RESULT -- The numerical index of the character at the selected X position in -- Entry_Widget -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get the numerical index at start of My_Entry Ttk_Entry widget -- Index: constant Natural := Get_Index(My_Entry, 0); -- SEE ALSO -- TtkEntry.Get_Index_(entry_index_type) -- COMAMNDS -- Entry_Widget index X -- SOURCE function Get_Index(Entry_Widget: Ttk_Entry; X: Natural) return Natural with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Get_Index", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Get_Index_(entry_index_type) -- FUNCTION -- Get the numerical index of the character in Ttk_Entry at the selected -- Entry_Index_Type index -- PARAMETERS -- Entry_Widget - Ttk_Entry in which the index will be get -- Index - The Entry_Index_Type index at which the index will be get -- RESULT -- The numerical index of the character at the selected Index in Entry_Widget -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get the numerical index at end of My_Entry Ttk_Entry widget -- Index: constant Natural := Get_Index(My_Entry, LASTCHARACTER); -- SEE ALSO -- TtkEntry.Get_Index_(x_coordinate) -- COMAMNDS -- Entry_Widget index Index -- SOURCE function Get_Index (Entry_Widget: Ttk_Entry; Index: Entry_Index_Type) return Natural with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Get_Index2", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Insert_Text_(numerical_index) -- FUNCTION -- Insert the text at the selected position into the selected Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry in which the text will be inserted -- Index - The index or X coordinate of the character on which -- the text will be inserted -- Text - The text to insert to the Ttk_Entry -- Is_Index - If True, Index is numerical index of the character. If -- False, Index is X coordinate of the character. Can be -- empty. Default value is True. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Insert text my text at the start of My_Entry widget -- Insert_Text(My_Entry, 0, To_Tcl_String("my text")); -- SEE ALSO -- TtkEntry.Insert_Text_(entry_index_type) -- COMMANDS -- Entry_Widget insert Index Text -- SOURCE procedure Insert_Text (Entry_Widget: Ttk_Entry; Index: Natural; Text: Tcl_String; Is_Index: Boolean := True) with Pre => Entry_Widget /= Null_Widget and Length(Source => Text) > 0, Test_Case => (Name => "Test_Insert_Text", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Insert_Text_(entry_index_type) -- FUNCTION -- Insert the text at the selected position into the selected Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry in which the text will be inserted -- Index - The index of the character in Entry_Widget at which the -- text will be inserted -- Text - The text to insert to the Ttk_Entry -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Insert text my text at the end of My_Entry widget -- Insert_Text(My_Entry, LASTCHARACTER, To_Tcl_String("my text")); -- SEE ALSO -- TtkEntry.Insert_Text_(numerical_index) -- COMMANDS -- Entry_Widget insert Index Text -- SOURCE procedure Insert_Text (Entry_Widget: Ttk_Entry; Index: Entry_Index_Type; Text: Tcl_String) with Pre => Entry_Widget /= Null_Widget and Length(Source => Text) > 0, Test_Case => (Name => "Test_Insert_Text", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Selection_Clear -- FUNCTION -- Clear the selection in the selected Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry which selection will be cleared -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Clear the selection in My_Entry widget -- Selection_Clear(My_Entry); -- COMMANDS -- Entry_Widget selection clear -- SOURCE procedure Selection_Clear(Entry_Widget: Ttk_Entry) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Selection_Clear", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Selection_Present -- FUNCTION -- Check if the selection is set in the selected Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry which will be check for a selection -- RESULT -- True if there is a character selected in the Entry_Widget, otherwise -- False -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Check if selection exists in widget My_Entry -- Has_Selection: constant Boolean := Selection_Present(My_Entry); -- COMMANDS -- Entry_Widget selection present -- SOURCE function Selection_Present(Entry_Widget: Ttk_Entry) return Boolean with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Selection_Present", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Selection_Range_(numeric_indexes) -- FUNCTION -- Set the selection in the selected Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry in which the selection will be set -- Start_Index - The index or X coordinate of the first character in -- the selection -- End_Index - The index or X coordinate of the last character in -- the selection -- Is_Start_Index - If True, the Start_Index index is numerical index, -- otherwise it is X coordinate. Can be empty. Default -- value is True. -- Is_End_Index - If True, the End_Index index is numerical index, -- otherwise it is X coordinate. Can be empty. Default -- value is True. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Set the selection in My_Entry widget to the first two characters -- Selection_Range(My_Entry, 0, 1); -- SEE ALSO -- TtkEntry.Selection_Range_(entry_index_type), -- TtkEntry.Selection_Range_(numerical_entry_index_type), -- TtkEntry.Selection_Range_(entry_index_type_numerical) -- COMMANDS -- Entry_Widget selection range Start_Index End_Index -- SOURCE procedure Selection_Range (Entry_Widget: Ttk_Entry; Start_Index, End_Index: Natural; Is_Start_Index, Is_End_Index: Boolean := True) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Selection_Range", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Selection_Range_(entry_index_type) -- FUNCTION -- Set the selection in the selected Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry in which the selection will be set -- Start_Index - The index of the first character in the selection -- End_Index - The index of the last character in the selection -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Set the selection in My_Entry widget from the insertion cursor to the end -- Selection_Range(My_Entry, INSERT, LASTCHARACTER); -- SEE ALSO -- TtkEntry.Selection_Range_(numerical_indexes), -- TtkEntry.Selection_Range_(numerical_entry_index_type), -- TtkEntry.Selection_Range_(entry_index_type_numerical) -- COMMANDS -- Entry_Widget selection range Start_Index End_Index -- SOURCE procedure Selection_Range (Entry_Widget: Ttk_Entry; Start_Index, End_Index: Entry_Index_Type) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Selection_Range2", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Selection_Range_(numerical_entry_index_type) -- FUNCTION -- Set the selection in the selected Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry in which the selection will be set -- Start_Index - The index or X coordinate of the first character in -- the selection -- End_Index - The index of the last character in the selection -- Is_Start_Index - If True, the Start_Index index is numerical index, -- otherwise it is X coordinate. Can be empty. Default -- value is True. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Set the selection in My_Entry widget to the all characters -- Selection_Range(My_Entry, 0, LASTCHARACTER); -- SEE ALSO -- TtkEntry.Selection_Range_(numerical_indexes), -- TtkEntry.Selection_Range_(entry_index_type), -- TtkEntry.Selection_Range_(entry_index_type_numerical) -- COMMANDS -- Entry_Widget selection range Start_Index End_Index -- SOURCE procedure Selection_Range (Entry_Widget: Ttk_Entry; Start_Index: Natural; End_Index: Entry_Index_Type; Is_Start_Index: Boolean := True) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Selection_Range3", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Selection_Range_(entry_index_type_numerical) -- FUNCTION -- Set the selection in the selected Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry in which the selection will be set -- Start_Index - The index of the first character in the selection -- End_Index - The index or X coordinate of the last character in -- the selection -- Is_End_Index - If True, the End_Index index is numerical index, -- otherwise it is X coordinate. Can be empty. Default -- value is True. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Set the selection in My_Entry widget from insertion cursor to 10th character -- Selection_Range(My_Entry, INSERT, 9); -- SEE ALSO -- TtkEntry.Selection_Range_(numerical_indexes), -- TtkEntry.Selection_Range_(entry_index_type), -- TtkEntry.Selection_Range_(numerical_entry_index_type), -- COMMANDS -- Entry_Widget selection range Start_Index End_Index -- SOURCE procedure Selection_Range (Entry_Widget: Ttk_Entry; Start_Index: Entry_Index_Type; End_Index: Natural; Is_End_Index: Boolean := True) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Selection_Range4", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.Validate -- FUNCTION -- Revalidate the content of the selected Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry which content will be validated -- RESULT -- If content is valid, return True, otherwise False -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Validate the content of My_Entry widget -- Is_Valid: constant Boolean := Validate(My_Entry); -- COMMANDS -- Entry_Widget validate -- SOURCE function Validate(Entry_Widget: Ttk_Entry) return Boolean with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_Validate", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.X_View -- FUNCTION -- Get the fraction of currently visible part of the selected Ttk_Entry -- PARAMETERS -- Entry_Widget - The Ttk_Entry which visible part coordinates will be -- get -- RESULT -- Factions_Array, where the first element is start point of visible part, -- the second is the end point of visible part of Entry_Widget -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get the visible coordinates of My_Entry widget -- Visible_Part: constant Fractions_Array := X_View(My_Entry); -- COMMANDS -- Entry_Widget xview -- SOURCE function X_View(Entry_Widget: Ttk_Entry) return Fractions_Array with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_X_View", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.X_View_Adjust_(numerical_index) -- FUNCTION -- Adjust the view of the Ttk_Entry so the selected character will be -- displayed at the left edge of the widget -- PARAMETERS -- Entry_Widget - The Ttk_Entry which view will be adjusted -- Index - The index or X coordinate of the character to which -- the Ttk_Entry view will be adjusted -- Is_Index - If True, Index is numerical index of the character. If -- False, Index is X coordinate of the character. Can be -- empty. Default value is True. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Adjust My_Entry so it will show the content from the first character -- X_View_Adjust(My_Entry, 0); -- SEE ALSO -- X_View_Adjust_(entry_index_type) -- COMMANDS -- Entry_Widget xview adjust Index -- SOURCE procedure X_View_Adjust (Entry_Widget: Ttk_Entry; Index: Natural; Is_Index: Boolean := True) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_X_View_Adjust", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.X_View_Adjust_(entry_index_type) -- FUNCTION -- Adjust the view of the Ttk_Entry so the selected character will be -- displayed at the left edge of the widget -- PARAMETERS -- Entry_Widget - The Ttk_Entry which view will be adjusted -- Index - The index of the character to which the Ttk_Entry -- view will be adjusted -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Adjust My_Entry so it will show the content from the insertion cursor -- X_View_Adjust(My_Entry, INSERT); -- SEE ALSO -- X_View_Adjust_(numeric_index) -- COMMANDS -- Entry_Widget xview adjust Index procedure X_View_Adjust (Entry_Widget: Ttk_Entry; Index: Entry_Index_Type) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_X_View_Adjust2", Mode => Nominal); -- **** -- ****f* TtkEntry/TtkEntry.X_View_Move_To -- FUNCTION -- Move Ttk_Entry view by the selected fraction. The selected fraction -- will be displayed at the left edge of the widget. -- PARAMETERS -- Entry_Widget - The Ttk_Entry which view will be moved -- Fraction - The fraction about which the view will be moved -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Move view of My_Entry by half -- X_View_Move_To(My_Entry, 0.5); -- COMMANDS -- Entry_Widget xview moveto Fraction -- SOURCE procedure X_View_Move_To (Entry_Widget: Ttk_Entry; Fraction: Fraction_Type) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_X_View_Move_To", Mode => Nominal); -- **** -- ****f* TtkEntry/Ttk_Entry.X_View_Scroll -- FUNCTION -- Shift the view in the Ttk_Entry on the left or right. -- PARAMETERS -- Entry_Widget - The Ttk_Entry which will be shifted -- Number - The amount of units. If it is positive then move to -- the right, if negative, move to the left -- What - If UNITS then move by selected amount of characters, -- when PAGES then amount of screens -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Scroll My_Entry by two screens -- X_View_Scroll(My_Entry, 2, PAGES); -- SOURCE procedure X_View_Scroll (Entry_Widget: Ttk_Entry; Number: Integer; What: Scroll_Unit_Type) with Pre => Entry_Widget /= Null_Widget, Test_Case => (Name => "Test_X_View_Scroll", Mode => Nominal); -- **** --## rule on REDUCEABLE_SCOPE end Tk.TtkEntry;
src/gdb/gdb-7.11/gdb/testsuite/gdb.ada/packed_tagged/comp_bug.adb
aps337/unum-sdk
31
11572
-- Copyright 2008-2016 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. procedure Comp_Bug is type Number_T (Exists : Boolean := False) is record case Exists is when True => Value : Natural range 0 .. 255; when False => null; end case; end record; pragma Pack (Number_T); X : Number_T; -- brobecker/2007-09-06: At the time when this issue (G904-017) was -- reported, the problem only reproduced if the variable was declared -- inside a function (in other words, stored on stack). Although -- the issue probably still existed when I tried moving this variable -- to a package spec, the symptoms inside GDB disappeared. begin X := (Exists => True, Value => 10); if X.Exists then -- STOP X.Value := X.Value + 1; end if; end Comp_Bug;
src/util/oli/qdos/fjcb.asm
olifink/qspread
0
20950
; find jcb of job 19/08-92 O.Fink ; include win1_keys_qdos_sms include win1_keys_sys include win1_keys_jcb include win1_keys_err include win1_mac_oli section utility xdef ut_fjcb ;+++ ; find address of job control block (jcb) ; ; Entry Exit ; d1.l job ID (or -1) preserved ; a1 adr of jcb ; ; error codes: err.ijob ;--- ut_fjcb subr a0/d1/d2/d3 move.l d1,d3 moveq #sms.info,d0 trap #do.sms2 tst.l d3 bpl.s lb move.l d1,d3 lb move.l d3,d2 move.l sys_jbtt(a0),d0 ; check size of job tabe sub.l sys_jbtb(a0),d0 lsr.l #2,d0 sub.w d2,d0 bmi.s err_exit mulu #4,d2 ; check entry in jt move.l sys_jbtb(a0),a0 move.l (a0,d2.l),d0 bmi.s err_exit move.l d0,a0 ; check job tag swap d3 cmp.w jcb_tag(a0),d3 bne.s err_exit move.l a0,a1 moveq #0,d0 exit subend err_exit moveq #err.ijob,d0 bra.s exit end
lib/memory.adb
jweese/Ada_Vent_19
1
8229
with Ada.Containers.Vectors; with Ada.IO_Exceptions; package body Memory is package IO is new Ada.Text_IO.Integer_IO(Value); function Read_Comma_Separated( From: File_Type := Standard_Input) return Block is package Vec is new Ada.Containers.Vectors( Index_type => Address, Element_Type => Value); V: Vec.Vector := Vec.Empty_Vector; Curr: Value; Comma: Character; begin loop IO.Get(From, Curr); V.Append(Curr); exit when Ada.Text_IO.End_Of_File(From); Ada.Text_IO.Get(From, Comma); if Comma /= ',' then raise Ada.IO_Exceptions.Data_Error; end if; end loop; declare Result: Block(V.First_Index .. V.Last_Index); begin for Addr in Result'Range loop Result(Addr) := V(Addr); end loop; return Result; end; end Read_Comma_Separated; end Memory;
src/test/ref/useuninitialized.asm
jbrandwood/kickc
2
166614
// Use an uninitialized variable - should use the default value (0)! // Commodore 64 PRG executable file .file [name="useuninitialized.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(main) .const b = 3 .const s = 1 .segment Code main: { .label screen = $400 // *screen = b lda #b sta screen // *(screen+1) = s lda #s sta screen+1 // } rts }
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/aggr19.adb
best08618/asylo
7
23610
-- { dg-do run } with Aggr19_Pkg; use Aggr19_Pkg; procedure Aggr19 is C : Rec5 := (Ent => (Kind => Two, Node => (L => (D => True, Pos => 1 )), I => 0)); A : Rec5 := C; begin Proc (A); if A /= C then raise Program_Error; end if; end;
programs/oeis/078/A078627.asm
karttu/loda
0
176159
; A078627: Write n in binary; repeatedly sum the "digits" until reaching 1; a(n) = 1 + number of steps required. ; 1,2,3,2,3,3,4,2,3,3,4,3,4,4,3,2,3,3,4,3,4,4,3,3,4,4,3,4,3,3,4,2,3,3,4,3,4,4,3,3,4,4,3,4,3,3,4,3,4,4,3,4,3,3,4,4,3,3,4,3,4,4,4,2,3,3,4,3,4,4,3,3,4,4,3,4,3,3,4,3,4,4,3,4,3,3,4,4,3,3,4,3,4,4,4,3,4,4,3,4,3,3,4,4,3,3,4,3,4,4,4,4,3,3,4,3,4,4,4,3,4,4,4,4,4,4,5,2,3,3,4,3,4,4,3,3,4,4,3,4,3,3,4,3,4,4,3,4,3,3,4,4,3,3,4,3,4,4,4,3,4,4,3,4,3,3,4,4,3,3,4,3,4,4,4,4,3,3,4,3,4,4,4,3,4,4,4,4,4,4,5,3,4,4,3,4,3,3,4,4,3,3,4,3,4,4,4,4,3,3,4,3,4,4,4,3,4,4,4,4,4,4,5,4,3,3,4,3,4,4,4,3,4,4,4,4,4,4,5,3,4,4,4,4,4,4,5,4,4,4 mov $2,$0 lpb $0,1 add $2,1 mov $0,$2 lpb $0,1 div $2,2 sub $0,$2 lpe sub $0,1 add $1,$2 mov $2,$0 lpe add $1,1
src/features/eventqueue.asm
FranchuFranchu/fran-os
1
167817
<reponame>FranchuFranchu/fran-os BITS 32 ; Allocate space for 0xFE event queue lists ; Last vector points to next vector table kernel_eventqueue_vectors: times 0xFF dd 0 kernel_eventqueue_on_next_tick_vectors: times 0xFF dd 0 kernel_eventqueue_sleeping_processes: %rep 0xFF dd 0 ; Address to return to dd 0 ; Interrupts to wait until it's reached %endrep kernel_eventqueue_setup: mov ax, 1000 cli out 0x40, al ; Set low byte of reload value rol ax, 8 ; al = high byte, ah = low byte out 0x40, al ; Set high byte of reload value rol ax, 8 ; al = low byte, ah = high byte (ax = original reload value) mov eax, kernel_pit_irq_handler mov ebx, 20h call kernel_define_interrupt sti ret PIT_OSCILLATION_S equ 11 ; pit oscillations in second PIT_OSCILLATION_MS equ 1 ; pit oscillations in a milisecond PIT_OSCILLATION_AS equ 0;.01 ; pit oscillations in a microsecond ; fuck the precision is too low PIT_INCREMENT_EACH_TIME equ 1 ; Make sure its prime kernel_pit_counter dd 0 ; loops back on 2**32 ns, or 3600 seconds (an hour) kernel_pit_irq_handler: pusha call kernel_execute_all_eventqueues call kernel_eventqueue_oscillation_pit mov al, 0x20 out 0x20, al popa iret kernel_eventqueue_oscillation_1s: mov al, "a" call kernel_terminal_putchar ret kernel_eventqueue_oscillation_1ms: ret kernel_eventqueue_oscillation_pit: ; Substract 1 from all sleeping processes pusha mov ebx, kernel_eventqueue_sleeping_processes - 8 mov ecx, 0 .look_for_empty: inc ecx mov eax, [ebx + 4] dec eax mov [ebx + 4], eax add ebx, 8 ; Skip to next entry cmp ecx, 0xFF jne .look_for_empty popa ret kernel_eventqueue_oscillation_1as: ret ; IN = EDX: Time in PIT interrupts ; OUT = All registers get changed ; Wait for the amount of time specified in ECX (in PIT interrupts), then return kernel_eventqueue_sleep: pop ecx ; Return value was pushed to stack. Pop it to ECX mov eax, ecx ; We do this so that EAX does not get damaged mov ebx, kernel_eventqueue_sleeping_processes - 8 .look_for_empty: add ebx, 8 ; Skip to next entry cmp dword [ebx], 0 ; If the address is 0, it means its unused jne .look_for_empty mov dword [ebx], eax mov dword [ebx + 4], edx ; Don't return. Just wait until an interrupt happens .halt: hlt cmp dword [ebx + 8], 0 jne .halt jmp [ebx] kernel_execute_all_eventqueues: mov ebx, kernel_eventqueue_vectors .loopy: cmp dword [ebx], 0 je .done call kernel_execute_eventqueue add ebx, 4 .done: mov ebx, kernel_eventqueue_on_next_tick_vectors .loopy2: cmp dword [ebx], 0 je .done2 call [ebx] add ebx, 4 .done2: ret kernel_execute_eventqueue: pusha mov ecx, 0 mov ebx, [ebx] ; Now EBX points to a single event queue list ; Store vector to call in ESI mov esi, [ebx] ; Store empty space before queue start in CL mov cl, [ebx + 4] ; Store total queue size in DL mov dl, [ebx + 5] ; if empty space equals total size it means the queue is empty mov dl, cl call kernel_string_convert_1hex call kernel_terminal_putchar shr ax, 8 call kernel_string_convert_1hex call kernel_terminal_putchar shr ax, 8 jne .done ; Push EBX for later use push ebx add ebx, 8 ; Add the header size add ebx, ecx; Reach the start of the queue ; Move one item in the queue to EAX and clear it mov eax, [ebx] mov dword [ebx], 0 ; Increment the empty space size by one as we just removed one item pop ebx inc cl mov byte [ebx + 4], cl ; Execute the function requested by the queue call esi mov al, "b" call kernel_terminal_putchar .done: mov al, "a" call kernel_terminal_putchar popa ret
examples/outdated-and-incorrect/univ/proofs.agda
asr/agda-kanso
1
6690
module proofs where open import univ open import cwf open import Base open import Nat open import help {- lem-id∘ : {Γ Δ : Con}(σ : Γ ─→ Δ) -> id ∘ σ == σ lem-id∘ (el < σ , pσ >) = eq \x -> ref lem-∘id : {Γ Δ : Con}(σ : Γ ─→ Δ) -> σ ∘ id == σ lem-∘id (el < σ , pσ >) = eq \x -> ref lem-∘assoc : {Γ Δ Θ Ξ : Con}(σ : Θ ─→ Ξ)(δ : Δ ─→ Θ)(θ : Γ ─→ Δ) -> (σ ∘ δ) ∘ θ == σ ∘ (δ ∘ θ) lem-∘assoc (el < σ , pσ >) (el < δ , pδ >) (el < θ , pθ >) = eq \x -> ref -} lem-/∘ : {Γ Δ Θ : Con}(A : Type Γ)(σ : Δ ─→ Γ)(δ : Θ ─→ Δ) -> A / σ ∘ δ =Ty A / σ / δ lem-/∘ A (el < _ , _ >) (el < _ , _ >) = eqTy \x -> refS {- lem-//id : {Γ : Con}{A : Type Γ}{u : Elem Γ A} -> u // id =El castElem lem-/id u lem-//id {Γ}{A}{elem (el < u , pu >)} = eqEl (eq prf) where prf : (x : El Γ) -> _ prf x = chain> u x === _ << u (refS << x) by pu (sym (ref<< x)) === _ << u (refS << x) by pfi _ _ _ where open module C11 = Chain _==_ (ref {_}) (trans {_}) lem-//∘ : {Γ Δ Θ : Con}{A : Type Γ}(u : Elem Γ A)(σ : Δ ─→ Γ)(δ : Θ ─→ Δ) -> u // σ ∘ δ =El castElem (lem-/∘ A σ δ) (u // σ // δ) lem-//∘ {Γ}{Δ}{Θ} (elem (el < u , pu >)) σ'@(el < σ , _ >) δ'@(el < δ , _ >) = eqEl (eq prf) where prf : (x : El Θ) -> _ prf x = chain> u (σ (δ x)) === _ << u (σ (δ (refS << x))) by pu (p─→ σ' (p─→ δ' (sym (ref<< x)))) === _ << u (σ (δ (refS << x))) by pfi _ _ _ where open module C12 = Chain _==_ (ref {_}) (trans {_}) lem-wk∘σ,,u : {Γ Δ : Con}{A : Type Γ}(σ : Δ ─→ Γ)(u : Elem Δ (A / σ)) -> wk ∘ (σ ,, u) == σ lem-wk∘σ,,u (el < σ , pσ >) (elem (el < u , pu >)) = eq \x -> ref lem-/wk∘σ,,u : {Γ Δ : Con}(A : Type Γ)(σ : Δ ─→ Γ)(u : Elem Δ (A / σ)) -> A / wk / (σ ,, u) =Ty A / σ lem-/wk∘σ,,u A (el < σ , pσ >) (elem (el < u , pu >)) = eqTy \x -> refS lem-vz/σ,,u : {Γ Δ : Con}{A : Type Γ}(σ : Δ ─→ Γ)(u : Elem Δ (A / σ)) -> vz // (σ ,, u) =El castElem (lem-/wk∘σ,,u A σ u) u lem-vz/σ,,u (el < σ , pσ >) (elem (el < u , pu >)) = eqEl (eq \x -> prf x) where prf : (x : El _) -> u x == _ << u (refS << x) prf x = chain> u x === _ << u (refS << x) by pu (sym (ref<< x)) === _ << u (refS << x) by pfi _ _ _ where open module C15 = Chain _==_ (ref {_}) (trans {_}) lem-σ,,u∘ : {Γ Δ Θ : Con}{A : Type Γ} (σ : Δ ─→ Γ)(u : Elem Δ (A / σ))(δ : Θ ─→ Δ) -> (σ ,, u) ∘ δ == (σ ∘ δ ,, castElem (lem-/∘ A σ δ) (u // δ)) lem-σ,,u∘ (el < σ , _ >) (elem (el < u , pu >)) δ'@(el < δ , _ >) = eq \x -> eq < ref , prf x > where prf : (x : El _) -> u (δ x) == _ << _ << u (δ (refS << x)) prf x = chain> u (δ x) === _ << u (δ (refS << x)) by pu (p─→ δ' (sym (ref<< x))) === _ << _ << u (δ (refS << x)) by sym (casttrans _ _ _ _) where open module C15 = Chain _==_ (ref {_}) (trans {_}) lem-wk,,vz : {Γ : Con}{A : Type Γ} -> (wk ,, vz) == id {Γ , A} lem-wk,,vz {Γ}{A} = eq prf where prf : (x : El (Γ , A)) -> _ prf (el < x , y >) = ref -} lem-Π/ : {Γ Δ : Con}{A : Type Γ}(B : Type (Γ , A))(σ : Δ ─→ Γ) -> Π A B / σ =Ty Π (A / σ) (B / (σ ∘ wk ,, castElem (lem-/∘ A σ wk) vz)) lem-Π/ B (el < σ , pσ >) = eqTy \x -> eqS < refS , (\y -> pFam B (eq < ref , prf x y >)) > where postulate prf : (x : El _)(y : El _) -> y == _ << _ << _ << _ << y -- prf x y = -- chain> y -- === _ << _ << y by sym (castref2 _ _ y) -- === _ << _ << _ << y by trans<< _ _ _ -- === _ << _ << _ << _ << y by trans<< _ _ _ -- where open module C16 = Chain _==_ (ref {_}) (trans {_}) {- lem-β : {Γ : Con}{A : Type Γ}{B : Type (Γ , A)} (v : Elem (Γ , A) B)(u : Elem Γ A) -> (ƛ v) ∙ u =El v // [ u ] lem-β {Γ}{A}{B} (elem (el < v , pv >)) (elem (el < u , pu >)) = eqEl (eq \x -> prf x _ _) where prf : (x : El Γ)(q : _ =S _)(p : _ =S _) -> p << v (el < x , u x >) == v (el < x , q << u (refS << x) >) prf x q p = chain> p << v (el < x , u x >) === p << q0 << v (el < x , q1 << u (refS << x) >) by p<< p (pv (eqSnd (pu (sym (ref<< x))))) === q2 << v (el < x , q1 << u (refS << x) >) by sym (trans<< p q0 _) === q2 << q3 << v (el < x , q << u (refS << x) >) by p<< q2 (pv (eqSnd (pfi q1 q _))) === v (el < x , q << u (refS << x) >) by castref2 q2 q3 _ where open module C17 = Chain _==_ (ref {_}) (trans {_}) q0 = _ q1 = _ q2 = _ q3 = _ -}
programs/oeis/028/A028993.asm
neoneye/loda
22
174106
<reponame>neoneye/loda ; A028993: Odd 10-gonal (or decagonal) numbers. ; 1,27,85,175,297,451,637,855,1105,1387,1701,2047,2425,2835,3277,3751,4257,4795,5365,5967,6601,7267,7965,8695,9457,10251,11077,11935,12825,13747,14701,15687,16705,17755,18837,19951,21097,22275,23485,24727,26001,27307,28645,30015,31417,32851,34317,35815,37345,38907,40501,42127,43785,45475,47197,48951,50737,52555,54405,56287,58201,60147,62125,64135,66177,68251,70357,72495,74665,76867,79101,81367,83665,85995,88357,90751,93177,95635,98125,100647,103201,105787,108405,111055,113737,116451,119197,121975,124785,127627,130501,133407,136345,139315,142317,145351,148417,151515,154645,157807 mov $1,16 mul $1,$0 add $1,10 mul $1,$0 add $1,1 mov $0,$1
source/league/league-characters.adb
svn2github/matreshka
24
11218
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2015, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.Internals.Unicode.Properties; package body League.Characters is use type Matreshka.Internals.Unicode.Code_Unit_32; --------- -- "<" -- --------- not overriding function "<" (Left : Universal_Character; Right : Universal_Character) return Boolean is begin return Left.Code < Right.Code; end "<"; --------- -- "<" -- --------- not overriding function "<" (Left : Universal_Character; Right : Wide_Wide_Character) return Boolean is begin return Left.Code < Wide_Wide_Character'Pos (Right); end "<"; --------- -- "<" -- --------- not overriding function "<" (Left : Wide_Wide_Character; Right : Universal_Character) return Boolean is begin return Wide_Wide_Character'Pos (Left) < Right.Code; end "<"; ---------- -- "<=" -- ---------- not overriding function "<=" (Left : Universal_Character; Right : Universal_Character) return Boolean is begin return Left.Code <= Right.Code; end "<="; ---------- -- "<=" -- ---------- not overriding function "<=" (Left : Universal_Character; Right : Wide_Wide_Character) return Boolean is begin return Left.Code <= Wide_Wide_Character'Pos (Right); end "<="; ---------- -- "<=" -- ---------- not overriding function "<=" (Left : Wide_Wide_Character; Right : Universal_Character) return Boolean is begin return Wide_Wide_Character'Pos (Left) <= Right.Code; end "<="; --------- -- "=" -- --------- overriding function "=" (Left : Universal_Character; Right : Universal_Character) return Boolean is begin return Left.Code = Right.Code; end "="; --------- -- "=" -- --------- not overriding function "=" (Left : Universal_Character; Right : Wide_Wide_Character) return Boolean is begin return Left.Code = Wide_Wide_Character'Pos (Right); end "="; --------- -- "=" -- --------- not overriding function "=" (Left : Wide_Wide_Character; Right : Universal_Character) return Boolean is begin return Wide_Wide_Character'Pos (Left) = Right.Code; end "="; --------- -- ">" -- --------- not overriding function ">" (Left : Universal_Character; Right : Universal_Character) return Boolean is begin return Left.Code > Right.Code; end ">"; --------- -- ">" -- --------- not overriding function ">" (Left : Universal_Character; Right : Wide_Wide_Character) return Boolean is begin return Left.Code > Wide_Wide_Character'Pos (Right); end ">"; --------- -- ">" -- --------- not overriding function ">" (Left : Wide_Wide_Character; Right : Universal_Character) return Boolean is begin return Wide_Wide_Character'Pos (Left) > Right.Code; end ">"; ---------- -- ">=" -- ---------- not overriding function ">=" (Left : Universal_Character; Right : Universal_Character) return Boolean is begin return Left.Code >= Right.Code; end ">="; ---------- -- ">=" -- ---------- not overriding function ">=" (Left : Universal_Character; Right : Wide_Wide_Character) return Boolean is begin return Left.Code >= Wide_Wide_Character'Pos (Right); end ">="; ---------- -- ">=" -- ---------- not overriding function ">=" (Left : Wide_Wide_Character; Right : Universal_Character) return Boolean is begin return Wide_Wide_Character'Pos (Left) >= Right.Code; end ">="; ---------------------- -- General_Category -- ---------------------- function General_Category (Self : Universal_Character'Class) return General_Category_Values is begin if Self.Code in Matreshka.Internals.Unicode.Code_Point then return Matreshka.Internals.Unicode.Properties.General_Category (Self.Code); else raise Constraint_Error with "Invalid Unicode code point"; end if; end General_Category; -------------- -- Is_Digit -- -------------- function Is_Digit (Self : Universal_Character'Class) return Boolean is begin return Self.General_Category in Decimal_Number .. Other_Number; end Is_Digit; -------------------- -- Is_ID_Continue -- -------------------- function Is_ID_Continue (Self : Universal_Character'Class) return Boolean is begin return Self.Code in Matreshka.Internals.Unicode.Code_Point and then Matreshka.Internals.Unicode.Properties.Is_ID_Continue (Self.Code); end Is_ID_Continue; ----------------- -- Is_ID_Start -- ----------------- function Is_ID_Start (Self : Universal_Character'Class) return Boolean is begin return Self.Code in Matreshka.Internals.Unicode.Code_Point and then Matreshka.Internals.Unicode.Properties.Is_ID_Start (Self.Code); end Is_ID_Start; -------------------------------- -- Is_Noncharacter_Code_Point -- -------------------------------- function Is_Noncharacter_Code_Point (Self : Universal_Character'Class) return Boolean is begin return Self.Code in Matreshka.Internals.Unicode.Code_Point and then Matreshka.Internals.Unicode.Properties.Is_Noncharacter_Code_Point (Self.Code); end Is_Noncharacter_Code_Point; -------------------- -- Is_Punctuation -- -------------------- function Is_Punctuation (Self : Universal_Character'Class) return Boolean is begin return Self.General_Category in Connector_Punctuation .. Other_Punctuation; end Is_Punctuation; -------------- -- Is_Valid -- -------------- function Is_Valid (Self : Universal_Character'Class) return Boolean is begin return Matreshka.Internals.Unicode.Is_Valid (Self.Code); end Is_Valid; -------------------- -- Is_White_Space -- -------------------- function Is_White_Space (Self : Universal_Character'Class) return Boolean is begin return Self.Code in Matreshka.Internals.Unicode.Code_Point and then Matreshka.Internals.Unicode.Properties.Is_White_Space (Self.Code); end Is_White_Space; ---------------------- -- East_Asian_Width -- ---------------------- function East_Asian_Width (Self : Universal_Character'Class) return East_Asian_Width_Values is begin if Self.Code in Matreshka.Internals.Unicode.Code_Point then return Matreshka.Internals.Unicode.Properties.East_Asian_Width (Self.Code); else raise Constraint_Error with "Invalid Unicode code point"; end if; end East_Asian_Width; --------------- -- Lowercase -- --------------- function Lowercase (Self : Universal_Character'Class) return Boolean is begin return Self.Code in Matreshka.Internals.Unicode.Code_Point and then Matreshka.Internals.Unicode.Properties.Lowercase (Self.Code); end Lowercase; ----------------------------- -- Simple_Casefold_Mapping -- ----------------------------- function Simple_Casefold_Mapping (Self : Universal_Character'Class) return Universal_Character is begin return (Code => Matreshka.Internals.Unicode.Properties.Simple_Casefold_Mapping (Self.Code)); end Simple_Casefold_Mapping; ------------------------------ -- Simple_Lowercase_Mapping -- ------------------------------ function Simple_Lowercase_Mapping (Self : Universal_Character'Class) return Universal_Character is begin return (Code => Matreshka.Internals.Unicode.Properties.Simple_Lowercase_Mapping (Self.Code)); end Simple_Lowercase_Mapping; ------------------------------ -- Simple_Titlecase_Mapping -- ------------------------------ function Simple_Titlecase_Mapping (Self : Universal_Character'Class) return Universal_Character is begin return (Code => Matreshka.Internals.Unicode.Properties.Simple_Titlecase_Mapping (Self.Code)); end Simple_Titlecase_Mapping; ------------------------------ -- Simple_Uppercase_Mapping -- ------------------------------ function Simple_Uppercase_Mapping (Self : Universal_Character'Class) return Universal_Character is begin return (Code => Matreshka.Internals.Unicode.Properties.Simple_Uppercase_Mapping (Self.Code)); end Simple_Uppercase_Mapping; ---------------------------- -- To_Universal_Character -- ---------------------------- function To_Universal_Character (Self : Wide_Wide_Character) return Universal_Character is begin return Universal_Character'(Code => Wide_Wide_Character'Pos (Self)); end To_Universal_Character; ---------------------------- -- To_Wide_Wide_Character -- ---------------------------- function To_Wide_Wide_Character (Self : Universal_Character'Class) return Wide_Wide_Character is begin return Wide_Wide_Character'Val (Self.Code); end To_Wide_Wide_Character; --------------- -- Uppercase -- --------------- function Uppercase (Self : Universal_Character'Class) return Boolean is begin return Self.Code in Matreshka.Internals.Unicode.Code_Point and then Matreshka.Internals.Unicode.Properties.Uppercase (Self.Code); end Uppercase; end League.Characters;
04 Fades/2 Fade down.applescript
streth11/Qlab-Scripts
0
1989
<filename>04 Fades/2 Fade down.applescript -- @description Fade down -- @author <NAME> -- @link bensmithsound.uk -- @source <NAME> (adapted) -- @version 1.1 -- @testedmacos 10.13.6 -- @testedqlab 4.6.9 -- @about Create a fade down cue for the selected audio/video/fade/group cue -- @separateprocess FALSE -- @changelog -- v1.1 + if no cue name, script uses file name -- v1.0 + init -- USER DEFINED VARIABLES ----------------- set userLevel to -3 set kindString to "Fade down: " ---------- END OF USER DEFINED VARIABLES -- -- RUN SCRIPT ----------------------------- tell front workspace set originalCue to last item of (selected as list) set originalCueType to q type of originalCue -- Make a fade for each audio file in a selected group if originalCueType is "Group" then set cuesToFade to (cues in originalCue) set originalCueName to q name of originalCue make type "Group" set fadeGroup to last item of (selected as list) set fadeGroupID to uniqueID of fadeGroup set q name of fadeGroup to kindString & originalCueName repeat with eachCue in cuesToFade if q type of eachCue is "Audio" then try make type "Fade" set newCue to last item of (selected as list) set cue target of newCue to eachCue if q name of eachCue is not "" then set q name of newCue to kindString & (q name of eachCue) else set eachFile to file target of eachCue as alias tell application "System Events" set eachName to name of eachFile end tell set q name of newCue to kindString & eachName end if set currentLevel to eachCue getLevel row 0 column 0 newCue setLevel row 0 column 0 db (currentLevel + userLevel) set newCueID to uniqueID of newCue move cue id newCueID of parent of newCue to end of fadeGroup end try end if end repeat -- Make a fade for an audio or video cue else if originalCueType is in {"Audio", "Video"} then make type "Fade" set newCue to last item of (selected as list) set cue target of newCue to originalCue set currentLevel to originalCue getLevel row 0 column 0 newCue setLevel row 0 column 0 db (currentLevel + userLevel) if q name of originalCue is not "" then set q name of newCue to kindString & q name of originalCue else set originalFile to file target of originalCue as alias tell application "System Events" set originalName to name of originalFile end tell set q name of newCue to kindString & originalName end if -- Make a fade for an audio or video cue, from a fade cue which targets the original cue else if originalCueType is "Fade" then set originalCueTarget to cue target of originalCue if q type of originalCueTarget is not "Group" then make type "Fade" set newCue to last item of (selected as list) set cue target of newCue to originalCueTarget set currentLevel to originalCue getLevel row 0 column 0 newCue setLevel row 0 column 0 db (currentLevel + userLevel) if q name of originalCueTarget is not "" then set q name of newCue to kindString & q name of originalCueTarget else set originalFile to file target of originalCueTarget as alias tell application "System Events" set originalName to name of originalFile end tell set q name of newCue to kindString & originalName end if end if end if end tell
libsrc/math/genmath/c/sccz80/poly.asm
jpoikela/z88dk
640
84528
<gh_stars>100-1000 ; Small C+ Math Library ; More polynomial evaluation SECTION code_fp PUBLIC poly EXTERN pushfa EXTERN ldbchl EXTERN fadd EXTERN fmul EXTERN dload ; .poly CALL pushfa LD A,(HL) INC HL CALL dload DEFB $FE ;"ignore next byte" .POL3 POP AF POP BC POP IX POP DE DEC A RET Z PUSH DE PUSH IX PUSH BC PUSH AF PUSH HL CALL fmul POP HL CALL ldbchl PUSH HL CALL fadd POP HL JR POL3 ;
src/Actions/action_upload_vramdata.asm
SavagePencil/TriloTrackerSMSReplayerApp
0
94166
.IFNDEF __ACTION_UPLOAD_VRAMDATA_ASM__ .DEFINE __ACTION_UPLOAD_VRAMDATA_ASM__ .INCLUDE "Modules/execute_buffer.asm" .SECTION "Action - Upload Data to VRAM Indirect" FREE ; Uploads data to VRAM that is located elsewhere (e.g., ROM). .STRUCT sAction_UploadVRAMData_Indirect ExecuteEntry INSTANCEOF sExecuteEntry ; Callback DestVRAMLoc DW ; Where in VRAM will this go? Length DW ; Length in bytes? pData DW ; Where's the src data? .ENDST ;============================================================================== ; Action_UploadVRAMData_Indirect ; Execute Buffer action to upload data that is pointed to into VRAM. ; INPUTS: DE: Start of sAction_UploadVRAMData_Indirect ; OUTPUTS: DE: Next byte in Execute Buffer ; Destroys Everything ;============================================================================== Action_UploadVRAMData_Indirect: ex de, hl ; Get DestVRAM Loc ld e, (hl) inc hl ld d, (hl) inc hl ; Get Length of Data ld c, (hl) inc hl ld b, (hl) inc hl ; Get Ptr to Data ld a, (hl) inc hl push hl ; Preserve next pos ld h, (hl) ld l, a call VDP_UploadDataToVRAMLoc pop de inc de ret .ENDS .SECTION "Action - Upload VRAM Data Implicit" FREE ; Uploads data that is located here in the execute buffer (not pointed to elsewhere) to VRAM. .STRUCT sAction_UploadVRAMData_Implicit ExecuteEntry INSTANCEOF sExecuteEntry ; Callback DestVRAMLoc DW ; Where in VRAM will this go? Length DW ; Length in bytes? ; Data goes after this, of variable size. .ENDST ;============================================================================== ; Action_UploadVRAMData_Implicit ; Execute Buffer action to upload data in the buffer to VRAM. ; INPUTS: DE: Start of sAction_UploadVRAMData_Implicit ; OUTPUTS: DE: Next byte in Execute Buffer ; Destroys Everything ;============================================================================== Action_UploadVRAMData_Implicit: ex de, hl ; Get DestVRAM Loc ld e, (hl) inc hl ld d, (hl) inc hl ; Get Length of Data ld c, (hl) inc hl ld b, (hl) inc hl ; HL now points to the implicit data. call VDP_UploadDataToVRAMLoc ; HL now points to byte past end of buffer, which is perfect. Now move it to DE ex de, hl @Done: ret .ENDS .SECTION "Action - Upload VRAM List Implicit" FREE ; Uploads data that is located here in the execute buffer (not pointed to elsewhere) to VRAM. ; Data is uploaded as a sequence of linear runs. .STRUCT sAction_UploadVRAMList_Implicit ExecuteEntry INSTANCEOF sExecuteEntry ; Callback NumRuns DB ; How many runs? ; A series of sAction_UploadVRAMList_Run go after this. .ENDST .STRUCT sAction_UploadVRAMList_Run VRAMLoc DW ; Start pos of run RunLengthInBytes DB ; #/bytes in run. ; Data goes after this, of variable size. .ENDST ;============================================================================== ; Action_UploadVRAMList_Implicit ; Execute Buffer action to upload data in the buffer to VRAM. ; INPUTS: DE: Start of sAction_UploadVRAMList_Implicit ; OUTPUTS: DE: Next byte in Execute Buffer ; Destroys Everything ;============================================================================== Action_UploadVRAMList_Implicit: ex de, hl ld d, (hl) ; Get #/runs inc hl ; Point to first Run ld c, VDP_DATA_PORT -: ; Start of sAction_UploadNameTable_Run ld a, (hl) ; VRAM loc inc hl out (VDP_CONTROL_PORT), a ld a, (hl) inc hl or VDP_COMMAND_MASK_VRAM_WRITE out (VDP_CONTROL_PORT), a ld b, (hl) ; Get run length inc hl otir ; UL VRAM data dec d ; Next run jp nz, - ; HL now points to byte past end of buffer, which is perfect. Now move it to DE ex de, hl ret .ENDS .SECTION "Action - Upload VRAM List Indirect" FREE ; Uploads data that is located elsewhere (e.g., ROM) to VRAM. ; Data is uploaded as a sequence of linear runs. .STRUCT sAction_UploadVRAMList_Indirect ExecuteEntry INSTANCEOF sExecuteEntry ; Callback pHeader DW ; Pointer to sAction_UploadVRAMList_Indirect_Header .ENDST .STRUCT sAction_UploadVRAMList_Indirect_Header NumRuns DB ; How many runs? ; A series of sAction_UploadVRAMList_Run go after this. .ENDST ;============================================================================== ; Action_UploadVRAMList_Indirect ; Execute Buffer action to upload data that is pointed to into VRAM. ; INPUTS: DE: Start of sAction_UploadVRAMList_Indirect ; OUTPUTS: DE: Next byte in Execute Buffer ; Destroys Everything ;============================================================================== Action_UploadVRAMList_Indirect: ld a, (de) ld l, a inc de ld a, (de) ld h, a inc de ; DE points to next byte in Execute Buffer, HL holds the ptr to sAction_UploadVRAMList_Indirect_Header push de ld d, (hl) ; Get #/runs inc hl ; Point to first Run ld c, VDP_DATA_PORT -: ; Start of sAction_UploadVRAMList_Run ld a, (hl) ; VRAM loc inc hl out (VDP_CONTROL_PORT), a ld a, (hl) inc hl or VDP_COMMAND_MASK_VRAM_WRITE out (VDP_CONTROL_PORT), a ld b, (hl) ; Run length inc hl otir dec d ; Next run jp nz, - pop de ret .ENDS .SECTION "Action - Upload String Indirect" FREE ; Uploads a string to VRAM that is located elsewhere (e.g., ROM). .STRUCT sAction_UploadString_Indirect ExecuteEntry INSTANCEOF sExecuteEntry ; Callback Row DB ; Row of string Col DB ; Column of string Attribute DB ; Attribute to interleave between string characters Length DB ; Length in bytes? pData DW ; Where's the src data? .ENDST ;============================================================================== ; Action_UploadString_Indirect ; Execute Buffer action to upload a string (one byte per char) ; INPUTS: DE: Start of sAction_UploadString_Indirect ; OUTPUTS: DE: Next byte in Execute Buffer ; Destroys Everything ;============================================================================== Action_UploadString_Indirect: ex de, hl ; Get Row ld d, (hl) inc hl ; Get Col ld e, (hl) inc hl ; Get Attribute ld c, (hl) inc hl ; Get Length ld b, (hl) inc hl ; HL points to the pData push hl ld a, (hl) inc hl ld h, (hl) ld l, a call VDP_UploadStringToNameTable pop de ; DE == pData ; Move past the pData inc de inc de ret .ENDS .SECTION "Action - Upload 1bpp Data to VRAM Implicit" FREE .STRUCT sColorRemap_1bpp Color0s DB ; What palette entry to substitute for 0s? Color1s DB ; ...and the 1s? .ENDST .STRUCT sAction_Upload1bppToVRAM_Payload DestVRAMLoc DW ; Where is it going? SourceLength DW ; How many bytes is the source data? ColorRemaps INSTANCEOF sColorRemap_1bpp ; How are the colors being remapped? p1bppData DW ; Where is the data? .ENDST .MACRO DECLARE_UPLOAD_1BPP_TO_VRAM_PAYLOAD ARGS DEST_PATTERN_VRAM_LOC, SOURCE_PATTERN_DATA, SOURCE_PATTERN_LENGTH, COLOR_REMAP_0s, COLOR_REMAP_1s .DSTRUCT INSTANCEOF sAction_Upload1bppToVRAM_Payload VALUES DestVRAMLoc .DW DEST_PATTERN_VRAM_LOC SourceLength .DW SOURCE_PATTERN_LENGTH p1bppData .DW SOURCE_PATTERN_DATA ColorRemaps.Color0s .DB COLOR_REMAP_0s ColorRemaps.Color1s .DB COLOR_REMAP_1s .ENDST .ENDM ; Converts 1bpp graphical data and uploads it to VRAM, remapping the color values. ; The payload is embedded directly into the execute buffer. .STRUCT sAction_Upload1bppToVRAM_Implicit ExecuteEntry INSTANCEOF sExecuteEntry ; Callback Payload INSTANCEOF sAction_Upload1bppToVRAM_Payload .ENDST ;============================================================================== ; Action_Upload1bppToVRAM_Implicit ; Execute Buffer action to upload 1bpp graphical data to VRAM. The payload ; is embedded directly into the execute buffer. ; INPUTS: DE: Start of sAction_Upload1bppToVRAM_Implicit ; OUTPUTS: DE: Next byte in Execute Buffer ; Destroys Everything ;============================================================================== Action_Upload1bppToVRAM_Implicit: ; Get the Dest VRAM loc ex de, hl ; HL points to sAction_Upload1bppToVRAM_Implicit.DestVRAMLoc ld e, (hl) inc hl ld d, (hl) ; Set the VRAM loc before we actually upload stuff. SET_VRAM_WRITE_LOC_FROM_DE inc hl ; Now to SourceLength ld c, (hl) inc hl ld b, (hl) ; BC has the len inc hl ; Now to palette remaps ld e, (hl) ; 0s color inc hl ld d, (hl) ; 1s color inc hl ; Now to pData ld a, (hl) inc hl push hl ; Preserve it ld h, (hl) ld l, a call Tile_Upload1BPPWithPaletteRemaps_VRAMPtrSet pop de ; Restore it *TO DE* inc de ; Move past last byte in this Action ret .ENDS .SECTION "Action - Upload 1bpp Data to VRAM Indirect" FREE ; Converts 1bpp graphical data and uploads it to VRAM, remapping the color values. ; The payload is stored as a pointer in the execute buffer. .STRUCT sAction_Upload1bppToVRAM_Indirect ExecuteEntry INSTANCEOF sExecuteEntry ; Callback pPayload DW ; Pointer to an sAction_Upload1bppToVRAM_Payload .ENDST ;============================================================================== ; Action_Upload1bppToVRAM_Indirect ; Execute Buffer action to upload 1bpp graphical data to VRAM. The payload ; is stored as a pointer in the execute buffer. ; INPUTS: DE: Start of sAction_Upload1bppToVRAM_Indirect ; OUTPUTS: DE: Next byte in Execute Buffer ; Destroys Everything ;============================================================================== Action_Upload1bppToVRAM_Indirect: ; Get the pointer value. ld a, (de) ld l, a inc de ld a, (de) ld h, a inc de push de ; Get the Dest VRAM loc ; HL points to sAction_Upload1bppToVRAM_Indirect.DestVRAMLoc ld e, (hl) inc hl ld d, (hl) ; Set the VRAM loc before we actually upload stuff. SET_VRAM_WRITE_LOC_FROM_DE inc hl ; Now to SourceLength ld c, (hl) inc hl ld b, (hl) ; BC has the len inc hl ; Now to palette remaps ld e, (hl) ; 0s color inc hl ld d, (hl) ; 1s color inc hl ; Now to pData ld a, (hl) inc hl ld h, (hl) ld l, a call Tile_Upload1BPPWithPaletteRemaps_VRAMPtrSet pop de ; Restore to next byte in Execute Buffer. ret .ENDS .ENDIF ; __ACTION_UPLOAD_VRAMDATA_ASM__
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-imgdec.ads
orb-zhuchen/Orb
0
10962
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . I M G _ D E C -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Image for decimal fixed types where the size of the corresponding integer -- type does not exceed Integer'Size (also used for Text_IO.Decimal_IO output) package System.Img_Dec is pragma Pure; procedure Image_Decimal (V : Integer; S : in out String; P : out Natural; Scale : Integer); -- Computes fixed_type'Image (V), where V is the integer value (in units of -- delta) of a decimal type whose Scale is as given and stores the result -- S (1 .. P), updating P to the value of L. The image is given by the -- rules in RM 3.5(34) for fixed-point type image functions. The caller -- guarantees that S is long enough to hold the result. S need not have a -- lower bound of 1. procedure Set_Image_Decimal (V : Integer; S : in out String; P : in out Natural; Scale : Integer; Fore : Natural; Aft : Natural; Exp : Natural); -- Sets the image of V, where V is the integer value (in units of delta) -- of a decimal type with the given Scale, starting at S (P + 1), updating -- P to point to the last character stored, the caller promises that the -- buffer is large enough and no check is made for this. Constraint_Error -- will not necessarily be raised if this requirement is violated, since -- it is perfectly valid to compile this unit with checks off. The Fore, -- Aft and Exp values can be set to any valid values for the case of use -- by Text_IO.Decimal_IO. Note that there is no leading space stored. procedure Set_Decimal_Digits (Digs : in out String; NDigs : Natural; S : out String; P : in out Natural; Scale : Integer; Fore : Natural; Aft : Natural; Exp : Natural); -- This procedure has the same semantics as Set_Image_Decimal, except that -- the value in Digs (1 .. NDigs) is given as a string of decimal digits -- preceded by either a minus sign or a space (i.e. the integer image of -- the value in units of delta). The call may destroy the value in Digs, -- which is why Digs is in-out (this happens if rounding is required). -- Set_Decimal_Digits is shared by all the decimal image routines. end System.Img_Dec;
Chapter_10/Program 10.4/Program_10.4b_MASM_64.asm
chen150182055/Assembly
272
169295
; Program 10.4b ; Windows API Calls - MASM (64-bit) ; Copyright (c) 2019 <NAME> extrn GetCurrentProcessId : proc extrn ExitProcess : proc extrn MessageBoxA : proc .DATA output BYTE "Computer Architecture",0 caption BYTE "Message", 0 decimal QWORD 10 PID QWORD 0 button QWORD 0 .CODE _main PROC ; Print "Computer Architecture" push rbp ; save frame pointer sub rsp, 10h ; reserve for return and rbp sub rsp, 20h ; reserve shadow space for regs xor rcx, rcx ; 0 handle owner lea rdx, output ; pass text address lea r8, caption ; pass caption address xor r9, r9 ; 0 MB_OK call MessageBoxA mov button, rax ; save button clicked call GetCurrentProcessId mov PID, rax mov rdi, OFFSET [PID+3] ; Pointer to end of PID string convert: xor rdx, rdx div decimal ; Divide by 10 add rdx, 48 ; Add 48 to remainder mov BYTE PTR [rdi], dl ; Store dec rdi ; Next digit cmp rax, 0 ; Is EAX = 0? jg convert ; If greater than 0, more digits xor rcx, rcx ; 0 handle owner lea rdx, PID ; pass text address lea r8, caption ; pass caption address xor r9, r9 ; 0 MB_OK call MessageBoxA mov button, rax ; save button clicked add rsp, 30h ; clean up stack, may need removed depending on Version pop rbp ; restore frame pointer xor rcx, rcx call ExitProcess _main ENDP END
programs/oeis/151/A151793.asm
jmorken/loda
1
85591
; A151793: Partial sums of A151782. ; 1,9,17,73,81,137,193,585,593,649,705,1097,1153,1545,1937,4681,4689,4745,4801,5193,5249,5641,6033,8777,8833,9225,9617,12361,12753,15497,18241,37449,37457,37513,37569,37961,38017,38409,38801,41545,41601,41993,42385,45129 mov $3,$0 mov $5,$0 lpb $5 mov $0,$3 sub $5,1 sub $0,$5 mov $4,$0 mov $6,1 mul $6,$0 lpb $2 lpb $4 div $6,2 sub $4,$6 lpe mov $0,$4 sub $2,1 lpe mov $2,7 mov $4,7 pow $4,$0 add $1,$4 lpe div $1,7 mul $1,8 add $1,1
7800openbios.asm
7800-devtools/7800OpenBIOS
1
18260
<filename>7800openbios.asm ; ** Atari 7800 OpenBIOS ; ********************************************************************** ; ** Created by <NAME> and <NAME>, 2021 ; ** ; ** the BIOS source code is provided here under the CC0 license. ; ** https://creativecommons.org/publicdomain/zero/1.0/legalcode ; ** ; ** The in-BIOS game is all-rights-reserved, and not covered under the ; ** CC0. Please contact the authors for terms before redistributing. ; ********************************************************************** processor 6502 ; ********************************************************************** ; ** BIOS TUNING ; ********************************************************************** DISPLAYTIME = 10 ; length of fuji display in half-second ticks SKIPMODE = 0 ; 0=hold B+W skips fuji, 1=no B+W skips fuji ; ********************************************************************** ; ** Register defines... ; ********************************************************************** ; ** TIA/INPTCTRL 00-1F... INPTCTRL = $01 ;Input control write-only INPT0 = $08 ;Paddle Control Input 0 read-only INPT1 = $09 ;Paddle Control Input 1 read-only INPT2 = $0A ;Paddle Control Input 2 read-only INPT3 = $0B ;Paddle Control Input 3 read-only INPT4B = $08 ;Joystick 0 Fire 1 read-only INPT4A = $09 ;Joystick 0 Fire 1 read-only INPT5B = $0A ;Joystick 1 Fire 0 read-only INPT5A = $0B ;Joystick 1 Fire 1 read-only INPT4R = $08 ;Joystick 0 Fire 1 read-only INPT4L = $09 ;Joystick 0 Fire 1 read-only INPT5R = $0A ;Joystick 1 Fire 0 read-only INPT5L = $0B ;Joystick 1 Fire 1 read-only INPT4 = $0C ;Player 0 Fire Button Input read-only INPT5 = $0D ;Player 1 Fire Button Input read-only AUDC0 = $15 ;Audio Control Channel 0 write-only AUDC1 = $16 ;Audio Control Channel 1 write-only AUDF0 = $17 ;Audio Frequency Channel 0 write-only AUDF1 = $18 ;Audio Frequency Channel 1 write-only AUDV0 = $19 ;Audio Volume Channel 0 write-only AUDV1 = $1A ;Audio Volume Channel 1 write-only ; MARIA 20-3F... BACKGRND = $20 ;Background Color write-only P0C1 = $21 ;Palette 0 - Color 1 write-only P0C2 = $22 ;Palette 0 - Color 2 write-only P0C3 = $23 ;Palette 0 - Color 3 write-only WSYNC = $24 ;Wait For Sync write-only P1C1 = $25 ;Palette 1 - Color 1 write-only P1C2 = $26 ;Palette 1 - Color 2 write-only P1C3 = $27 ;Palette 1 - Color 3 write-only MSTAT = $28 ;Maria Status read-only P2C1 = $29 ;Palette 2 - Color 1 write-only P2C2 = $2A ;Palette 2 - Color 2 write-only P2C3 = $2B ;Palette 2 - Color 3 write-only DPPH = $2C ;Display List List Pointer High write-only P3C1 = $2D ;Palette 3 - Color 1 write-only P3C2 = $2E ;Palette 3 - Color 2 write-only P3C3 = $2F ;Palette 3 - Color 3 write-only DPPL = $30 ;Display List List Pointer Low write-only P4C1 = $31 ;Palette 4 - Color 1 write-only P4C2 = $32 ;Palette 4 - Color 2 write-only P4C3 = $33 ;Palette 4 - Color 3 write-only CHARBASE = $34 ;Character Base Address write-only CHBASE = $34 ;Character Base Address write-only P5C1 = $35 ;Palette 5 - Color 1 write-only P5C2 = $36 ;Palette 5 - Color 2 write-only P5C3 = $37 ;Palette 5 - Color 3 write-only OFFSET = $38 ;Unused - Store zero here write-only P6C1 = $39 ;Palette 6 - Color 1 write-only P6C2 = $3A ;Palette 6 - Color 2 write-only P6C3 = $3B ;Palette 6 - Color 3 write-only CTRL = $3C ;Maria Control Register write-only P7C1 = $3D ;Palette 7 - Color 1 write-only P7C2 = $3E ;Palette 7 - Color 2 write-only P7C3 = $3F ;Palette 7 - Color 3 write-only ; ** PIA 280-2FF... SWCHA = $280 ;P0, P1 Joystick Directional Input read-write SWCHB = $282 ;Console Switches read-write CTLSWA = $281 ;I/O Control for SCHWA read-write SWACNT = $281 ;VCS name for above read-write CTLSWB = $283 ;I/O Control for SCHWB read-write SWBCNT = $283 ;VCS name for above read-write TIM1T = $294 ;Set 1 CLK Interval (838 nsec/interval) write-only TIM8T = $295 ;Set 8 CLK Interval (6.7 usec/interval) write-only TIM64T = $296 ;Set 64 CLK Interval (63.6 usec/interval) write-only T1024T = $297 ;Set 1024 CLK Interval (858.2 usec/interval) write-only TIM64TI = $29E ;Interrupt timer 64T write-only SEG.U data ORG $40 ; ********************************************************************** ; ** Zero page memory for the BIOS. The in-BIOS game can use any/all of ; ** the ZP memory. ; ********************************************************************** ; ** frame counter FrameCounter ds.b 1 ; ** 32-frames counter FrameCounter32 ds.b 1 ; ** The color of the first line of the fuji colorbar FujiColor ds.b 1 ; ** The BIOS wipes the Fuji display in and out. This is the index to ; ** the wipe state. WipeLevel ds.b 1 ; ** our NMI pointer for "JMP (NMIRoutine)" NMIRoutine ds.b 1 NMIRoutineHi ds.b 1 ; ** temp memory pointers, currently only used for clearing memory Temp1Lo ds.b 1 Temp1 = Temp1Lo Temp1Hi ds.b 1 ; ** type of Cart in the slot CartTypeDetected ds.b 1 echo "" echo " *****************************************************************" echo " ** BIOS Build Info (non-game)" echo " ** --------------------------" echo " ** Zero Page bytes free: ",($FF-*)d if (*>$FF) echo "ABORT: Too many zero page locations defined!" ERR endif ; ********************************************************************** ; ** Some BIOS specfic defines... ; ********************************************************************** DllRam = $2600 ; to 187F DlRam = $2680 ; to 199f. 12 bytes each visible DL, plus 2 zeros CartCheckRam = $2300 ; to 27FF ; ********************************************************************** ; ** Start of the ROM... ; ********************************************************************** SEG ROM ORG $C000,0 ; ************* ; ********************************************************************** ; ** Game graphics block or other data. ; ** Resides in 8k from C000 to DFFF ; ********************************************************************** incbin "kiloparsec.bl1" ; ********************************************************************** ; ** Long section of fuji graphics data follows. Skip ahead to "Start" ; ** to get to the code. ; ********************************************************************** ORG $E000,0 fuji00 HEX 000ffffc3fffffff0ffffc000000000000000000000000 fuji01 HEX 000ffffc3fffffff0ffffc000000000000000000000000 fuji02 HEX 000ffffc3fffffff0ffffc000000000000000000000000 fuji03 HEX 001ffffc3fffffff0ffffe000000000000000000000000 fuji04 HEX 003ffff83fffffff07ffff000000000000000000000000 fuji05 HEX 007ffff83fffffff07ffff800000000000000000000000 fuji06 HEX 01fffff03fffffff03ffffe00000000000000000000000 fuji07 HEX 07ffffe03fffffff01fffff00000000000000000000000 fuji08 HEX 1fffffc03fffffff00fffffe0000000000000000000000 fuji09 HEX ffffff803fffffff007fffffc000000000000000000000 fuji10 HEX fffffe003fffffff001ffffff800000000000000000000 ORG $E100,0 ; ************* ;fuji00 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji01 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji02 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji03 HEX 001ffffc3fffffff0ffffe000000000000000000000000 ;fuji04 HEX 003ffff83fffffff07ffff000000000000000000000000 ;fuji05 HEX 007ffff83fffffff07ffff800000000000000000000000 ;fuji06 HEX 01fffff03fffffff03ffffc00000000000000000000000 ;fuji07 HEX 07ffffe03fffffff01fffff00000000000000000000000 ;fuji08 HEX 1fffffc03fffffff00fffffc0000000000000000000000 ;fuji09 HEX 7fffff803fffffff007fffff8000000000000000000000 ;fuji10 HEX fffffe003fffffff001ffffff800000000000000000000 ORG $E200,0 ; ************* ;fuji00 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji01 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji02 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji03 HEX 001ffffc3fffffff0ffffe000000000000000000000000 ;fuji04 HEX 003ffff83fffffff07ffff000000000000000000000000 ;fuji05 HEX 007ffff83fffffff07ffff800000000000000000000000 ;fuji06 HEX 01fffff03fffffff03ffffc00000000000000000000000 ;fuji07 HEX 03ffffe03fffffff01fffff00000000000000000000000 ;fuji08 HEX 1fffffc03fffffff00fffffc0000000000000000000000 ;fuji09 HEX 7fffff803fffffff007fffff8000000000000000000000 ;fuji10 HEX fffffe003fffffff001ffffff000000000000000000000 ORG $E300,0 ; ************* ;fuji00 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji01 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji02 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji03 HEX 001ffffc3fffffff0ffffe000000000000000000000000 ;fuji04 HEX 003ffffc3fffffff0fffff000000000000000000000000 ;fuji05 HEX 007ffff83fffffff07ffff800000000000000000000000 ;fuji06 HEX 00fffff03fffffff03ffffc00000000000000000000000 ;fuji07 HEX 03ffffe03fffffff01fffff00000000000000000000000 ;fuji08 HEX 0fffffc03fffffff00fffffc0000000000000000000000 ;fuji09 HEX 7fffff803fffffff007fffff8000000000000000000000 ;fuji10 HEX ffffff003fffffff003ffffff000000000000000000000 ORG $E400,0 ; ************* ;fuji00 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji01 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji02 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji03 HEX 001ffffc3fffffff0ffffe000000000000000000000000 ;fuji04 HEX 003ffffc3fffffff0fffff000000000000000000000000 ;fuji05 HEX 007ffff83fffffff07ffff800000000000000000000000 ;fuji06 HEX 00fffff83fffffff07ffffc00000000000000000000000 ;fuji07 HEX 03fffff03fffffff03ffffe00000000000000000000000 ;fuji08 HEX 0fffffe03fffffff01fffffc0000000000000000000000 ;fuji09 HEX 3fffff803fffffff007fffff0000000000000000000000 ;fuji10 HEX ffffff003fffffff003fffffe000000000000000000000 ORG $E500,0 ; ************* ;fuji00 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji01 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji02 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji03 HEX 001ffffc3fffffff0ffffe000000000000000000000000 ;fuji04 HEX 003ffffc3fffffff0fffff000000000000000000000000 ;fuji05 HEX 007ffff83fffffff07ffff800000000000000000000000 ;fuji06 HEX 00fffff83fffffff07ffffc00000000000000000000000 ;fuji07 HEX 03fffff03fffffff03ffffe00000000000000000000000 ;fuji08 HEX 0fffffe03fffffff01fffff80000000000000000000000 ;fuji09 HEX 3fffff803fffffff007fffff0000000000000000000000 ;fuji10 HEX ffffff003fffffff003fffffe000000000000000000000 ORG $E600,0 ; ************* ;fuji00 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji01 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji02 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji03 HEX 001ffffc3fffffff0ffffe000000000000000000000000 ;fuji04 HEX 001ffffc3fffffff0ffffe000000000000000000000000 ;fuji05 HEX 003ffff83fffffff07ffff000000000000000000000000 ;fuji06 HEX 00fffff83fffffff07ffff800000000000000000000000 ;fuji07 HEX 03fffff03fffffff03ffffe00000000000000000000000 ;fuji08 HEX 0fffffe03fffffff01fffff80000000000000000000000 ;fuji09 HEX 3fffffc03fffffff00fffffe0000000000000000000000 ;fuji10 HEX ffffff003fffffff003fffffe000000000000000000000 ORG $E700,0 ; ************* ;fuji00 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji01 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji02 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji03 HEX 000ffffc3fffffff0ffffc000000000000000000000000 ;fuji04 HEX 001ffffc3fffffff0ffffe000000000000000000000000 ;fuji05 HEX 003ffff83fffffff07ffff000000000000000000000000 ;fuji06 HEX 00fffff83fffffff07ffff800000000000000000000000 ;fuji07 HEX 01fffff03fffffff03ffffe00000000000000000000000 ;fuji08 HEX 07ffffe03fffffff01fffff80000000000000000000000 ;fuji09 HEX 1fffffc03fffffff00fffffe0000000000000000000000 ;fuji10 HEX ffffff003fffffff003fffffc000000000000000000000 ORG $E800,0 ; ************* fuji11 HEX fffff0003fffffff0003ffffffc0000000000000000000 fuji12 HEX ffffc0003fffffff0000fffffffe000000000000000000 fuji13 HEX fffc00003fffffff00000ffffffff80000000000000000 fuji14 HEX ffc000003fffffff000000fffffffff000000000000000 fuji15 HEX f80000003fffffff00000007fffffffff8000000000000 fuji16 HEX 000000003fffffff000000001fffffffffff8000000000 fuji17 HEX 000000003fffffff00000000003fffffffffffff000000 fuji18 HEX 000000003fffffff0000000000003ffffffffffffffffc fuji19 HEX 000000003fffffff000000000000001ffffffffffffffc text00 HEX 0000ffff0fffffffff0ffff00003fffffffc07fe text01 HEX 0003ffffc0007fe0003ffffc0003fe0001ff87fe ORG $E900,0 ; ************* ;fuji11 HEX fffff8003fffffff0007ffffff80000000000000000000 ;fuji12 HEX ffffc0003fffffff0000fffffffc000000000000000000 ;fuji13 HEX fffe00003fffffff00001ffffffff00000000000000000 ;fuji14 HEX ffc000003fffffff000000ffffffffe000000000000000 ;fuji15 HEX f80000003fffffff00000007fffffffff0000000000000 ;fuji16 HEX 000000003fffffff000000003ffffffffffe0000000000 ;fuji17 HEX 000000003fffffff00000000007ffffffffffffc000000 ;fuji18 HEX 000000003fffffff0000000000007fffffffffffffffe0 ;fuji19 HEX 000000003fffffff000000000000003ffffffffffffffc ;text00 HEX 00007ffe0fffffffff07ffe00003fffffff807fe ;text01 HEX 0003ffffc0007fe0003ffffc0003fe0003ff87fe ORG $EA00,0 ; ************* ;fuji11 HEX fffff8003fffffff0007ffffff00000000000000000000 ;fuji12 HEX ffffc0003fffffff0000fffffff8000000000000000000 ;fuji13 HEX fffe00003fffffff00001fffffffe00000000000000000 ;fuji14 HEX ffe000003fffffff000001ffffffffc000000000000000 ;fuji15 HEX fc0000003fffffff0000000fffffffffe0000000000000 ;fuji16 HEX 800000003fffffff000000007ffffffffff80000000000 ;fuji17 HEX 000000003fffffff0000000000fffffffffffff0000000 ;fuji18 HEX 000000003fffffff000000000000fffffffffffffffe00 ;fuji19 HEX 000000003fffffff00000000000000fffffffffffffffc ;text00 HEX 00007ffe0fffffffff07ffe00003fffffff007fe ;text01 HEX 0001ffff80007fe0001ffff80003fe0003ff87fe ORG $EB00,0 ; ************* ;fuji11 HEX fffffc003fffffff000fffffff00000000000000000000 ;fuji12 HEX ffffe0003fffffff0001fffffff8000000000000000000 ;fuji13 HEX fffe00003fffffff00001fffffffc00000000000000000 ;fuji14 HEX ffe000003fffffff000001ffffffff8000000000000000 ;fuji15 HEX fe0000003fffffff0000001fffffffffc0000000000000 ;fuji16 HEX 800000003fffffff000000007ffffffffff00000000000 ;fuji17 HEX 000000003fffffff0000000001ffffffffffffc0000000 ;fuji18 HEX 000000003fffffff000000000001ffffffffffffffe000 ;fuji19 HEX 000000003fffffff00000000000001fffffffffffffffc ;text00 HEX 00007ffe0fffffffff07ffe00003ffffffe007fe ;text01 HEX 0001ffff80007fe0001ffff80003fe0007ff07fe ORG $EC00,0 ; ************* ;fuji11 HEX fffffc003fffffff000ffffffe00000000000000000000 ;fuji12 HEX ffffe0003fffffff0001fffffff0000000000000000000 ;fuji13 HEX ffff00003fffffff00003fffffffc00000000000000000 ;fuji14 HEX fff000003fffffff000003ffffffff0000000000000000 ;fuji15 HEX fe0000003fffffff0000001fffffffff00000000000000 ;fuji16 HEX c00000003fffffff00000000ffffffffffe00000000000 ;fuji17 HEX 000000003fffffff0000000003ffffffffffff00000000 ;fuji18 HEX 000000003fffffff000000000003ffffffffffffff8000 ;fuji19 HEX 000000003fffffff00000000000003fffffffffffffffc ;text00 HEX 00003ffc0fffffffff03ffc00003ffffffc007fe ;text01 HEX 0001ffff80007fe0001ffff80003fe000fff07fe ORG $ED00,0 ; ************* ;fuji11 HEX fffffc003fffffff000ffffffe00000000000000000000 ;fuji12 HEX fffff0003fffffff0003ffffffe0000000000000000000 ;fuji13 HEX ffff80003fffffff00007fffffff800000000000000000 ;fuji14 HEX fff800003fffffff000007fffffffe0000000000000000 ;fuji15 HEX ff0000003fffffff0000003ffffffffe00000000000000 ;fuji16 HEX e00000003fffffff00000001ffffffffff800000000000 ;fuji17 HEX 000000003fffffff0000000007fffffffffffc00000000 ;fuji18 HEX 000000003fffffff000000000007fffffffffffffc0000 ;fuji19 HEX 000000003fffffff00000000000007fffffffffffffffc ;text00 HEX 00003ffc0fffffffff03ffc00001ffffff8007fe ;text01 HEX 0001ffff80007fe0001ffff80003fe001fff07fe ORG $EE00,0 ; ************* ;fuji11 HEX fffffc003fffffff000ffffffc00000000000000000000 ;fuji12 HEX fffff0003fffffff0003ffffffe0000000000000000000 ;fuji13 HEX ffff80003fffffff00007fffffff000000000000000000 ;fuji14 HEX fff800003fffffff000007fffffffe0000000000000000 ;fuji15 HEX ff0000003fffffff0000007ffffffffc00000000000000 ;fuji16 HEX e00000003fffffff00000001ffffffffff000000000000 ;fuji17 HEX 000000003fffffff0000000007fffffffffff000000000 ;fuji18 HEX 000000003fffffff00000000000ffffffffffffff00000 ;fuji19 HEX 000000003fffffff0000000000000ffffffffffffffffc ;text00 HEX 00001ff80fffffffff01ff800000fffffe0007fe ;text01 HEX 0000ffff00007fe0000ffff00003fe007ffe07fe ORG $EF00,0 ; ************* ;fuji11 HEX fffffc003fffffff000ffffffc00000000000000000000 ;fuji12 HEX fffff0003fffffff0003ffffffc0000000000000000000 ;fuji13 HEX ffff80003fffffff00007ffffffe000000000000000000 ;fuji14 HEX fff800003fffffff000007fffffffc0000000000000000 ;fuji15 HEX ff8000003fffffff0000007ffffffff800000000000000 ;fuji16 HEX f00000003fffffff00000003fffffffffc000000000000 ;fuji17 HEX 000000003fffffff000000000fffffffffffc000000000 ;fuji18 HEX 000000003fffffff00000000001fffffffffffffc00000 ;fuji19 HEX 000000003fffffff0000000000001ffffffffffffffffc ;text00 HEX 00000ff00fffffffff00ff0000003ffff00007fe ;text01 HEX 0000ffff0fffffffff0ffff00003fffffffe07fe ORG $F000,0 ; ************* text02 HEX 000ffc3ff0007fe000ffc3ff0003fe0007ff07fe text03 HEX 007ff00ffe007fe007ff00ffe003fe3fffe007fe text04 HEX 01ffffffff807fe01ffffffff803fe0ffc0007fe text05 HEX 0ffe00007ff07fe0ffe00007ff03fe007fe007fe text06 HEX 3ff000000ffc7fe3ff000000ffc3fe0003ff07fe text07 HEX 0000000000000000000000000000000000000000 text08 HEX 0ffffff87fc1ff0007ffe1fff80000fffc3fff00 text09 HEX 00007f00fe003f81fc0000000fe03f80000001fc text10 HEX 000ff0003ffffe07f000000003f8fe000000007f text11 HEX 00fe0003f8000fe3f800000007f07f00000000fe text12 HEX 1fe00001fc001fc01ff80007fe0003ff0000ffc0 text13 HEX 3c000000007f00000000ffc0000000001ff80000 ORG $F100,0 ; ************* ;text02 HEX 000ffc3ff0007fe000ffc3ff0003fe0003ff07fe ;text03 HEX 003ff00ffc007fe003ff00ffc003fe1ffff007fe ;text04 HEX 01ffffffff807fe01ffffffff803fe0ff80007fe ;text05 HEX 0ffe00007ff07fe0ffe00007ff03fe00ffc007fe ;text06 HEX 3ff800001ffc7fe3ff800001ffc3fe0007ff07fe ;text07 HEX 0000000000000000000000000000000000000000 ;text08 HEX 3ffffff83ffffe0003fffffff000007ffffffe00 ;text09 HEX 00007f80fc001f80fe0000001fc01fc0000003f8 ;text10 HEX 0007f0001ffffc07f000000003f8fe000000007f ;text11 HEX 00ff0003f8000fe3f800000007f07f00000000fe ;text12 HEX 0fe00001fc001fc03fe00001ff0007fc00003fe0 ;text13 HEX 7e00000003ffe000000ffffc00000001ffff8000 ORG $F200,0 ; ************* ;text02 HEX 000ffc3ff0007fe000ffc3ff0003fe0003ff87fe ;text03 HEX 003ff00ffc007fe003ff00ffc003fe0ffff807fe ;text04 HEX 00ffffffff007fe00ffffffff003fe1ff00007fe ;text05 HEX 07ffffffffe07fe07ffffffffe03fe01ffc007fe ;text06 HEX 3ff800001ffc7fe3ff800001ffc3fe000ffe07fe ;text07 HEX 0000000000000000000000000000000000000000 ;text08 HEX 7ffffffc3ffffe0001ffffffe000003ffffffc00 ;text09 HEX 00003f80fc001f80ff0000003fc01fe0000007f8 ;text10 HEX 0007f8001ffffc07f000000003f8fe000000007f ;text11 HEX 007f0003fc001fe3f800000007f07f00000000fe ;text12 HEX 0ff00001f8000fc07fc00000ff800ff800001ff0 ;text13 HEX fe0000000ffff800003fffff00000007ffffe000 ORG $F300,0 ; ************* ;text02 HEX 0007fe7fe0007fe0007fe7fe0003fe0001ff87fe ;text03 HEX 003ff00ffc007fe003ff00ffc003fe03fffc07fe ;text04 HEX 00ffc003ff007fe00ffc003ff003fe1ff00007fe ;text05 HEX 07ffffffffe07fe07ffffffffe03fe01ff8007fe ;text06 HEX 1ff800001ff87fe1ff800001ff83fe000ffc07fe ;text07 HEX 0000000000000000000000000000000000000000 ;text08 HEX 7ffffffc1ffffc00007fffff8000000ffffff000 ;text09 HEX 00003fc0fc001f807f8000007f800ff000000ff0 ;text10 HEX 0003f8003ffffe03f000000003f07e000000007e ;text11 HEX 007f8001fc001fc3f000000003f07e000000007e ;text12 HEX 07f00003f8000fe07f8000007f800ff000000ff0 ;text13 HEX ff0000001ffffc00007fffff8000000ffffff000 ORG $F400,0 ; ************* ;text02 HEX 0007fe7fe0007fe0007fe7fe0003fe0001ff87fe ;text03 HEX 001ff81ff8007fe001ff81ff8003fe00fffc07fe ;text04 HEX 00ffc003ff007fe00ffc003ff003fe3ff80007fe ;text05 HEX 03ffffffffc07fe03ffffffffc03fe03ff0007fe ;text06 HEX 1ffc00003ff87fe1ffc00003ff83fe001ffc07fe ;text07 HEX 7fe0000007fe7fe7fe0000007fe3fe0000ffe7fe ;text08 HEX 7ffffffc0ffff800003fffff00000007ffffe000 ;text09 HEX 00001fe0fc001f807fc00000ff800ff800001ff0 ;text10 HEX 0003fc003ffffe03f800000007f07f00000000fe ;text11 HEX 003f8001fe003fc7f000000003f8fe000000007f ;text12 HEX 07f80003f8000fe0ff0000003fc01fe0000007f8 ;text13 HEX 7f0000003ffffe0001ffffffe000003ffffffc00 ORG $F500,0 ; ************* ;text02 HEX 0007fe7fe0007fe0007fe7fe0003fe0001ff87fe ;text03 HEX 001ff81ff8007fe001ff81ff8003fe003ffe07fe ;text04 HEX 007fe007fe007fe007fe007fe003fe3ffe0007fe ;text05 HEX 03ffffffffc07fe03ffffffffc03fe03ff0007fe ;text06 HEX 1ffc00003ff87fe1ffc00003ff83fe003ff807fe ;text07 HEX 7fe0000007fe7fe7fe0000007fe3fe0001ffc7fe ;text08 HEX 3ffffff803ffe000000ffffc00000001ffff8000 ;text09 HEX 00001fe0fc001f803fe00001ff0007fc00003fe0 ;text10 HEX 0001fe007fc1ff03f800000007f07f00000000fe ;text11 HEX 001fc000ff80ff87f000000003f8fe000000007f ;text12 HEX 03f80003f8000fe0fe0000001fc01fc0000003f8 ;text13 HEX 7f8000007fffff0003fffffff000007ffffffe00 ORG $F600,0 ; ************* ;text02 HEX 0003fe7fc0007fe0003fe7fc0003fe0001ff87fe ;text03 HEX 001ff81ff8007fe001ff81ff8003fe001ffe07fe ;text04 HEX 007fe007fe007fe007fe007fe003fe3fff8007fe ;text05 HEX 03ffffffffc07fe03ffffffffc03fe07fe0007fe ;text06 HEX 0ffc00003ff07fe0ffc00003ff03fe003ff007fe ;text07 HEX 7ff000000ffe7fe7ff000000ffe3fe0001ffc7fe ;text08 HEX 0ffffff000ff80000000ffc0000000001ff80000 ;text09 HEX 00000ff0fe003f801ff80007fe0003ff0000ffc0 ;text10 HEX 0000fe007f007f03f800000007f07f00000000fe ;text11 HEX 001fe000ffffff87f000000003f8fe000000007f ;text12 HEX 01fc0003f8000fe1fc0000000fe03f80000001fc ;text13 HEX 3f800000ffc1ff8007ffe1fff80000fffc3fff00 ORG $F700,0 ; ************* ;text02 HEX 0003ffffc0007fe0003ffffc0003fe0001ff87fe ;text03 HEX 001ffc3ff8007fe001ffc3ff8003fe000fff07fe ;text04 HEX 007fe007fe007fe007fe007fe003fe3fffc007fe ;text05 HEX 01ffffffff807fe01ffffffff803fe07fc0007fe ;text06 HEX 0ffc00003ff07fe0ffc00003ff03fe007ff007fe ;text07 HEX 3ff000000ffc7fe3ff000000ffc3fe0003ff87fe ;text08 HEX 0000000000000000000000000000000000000000 ;text09 HEX 00000ff07f007f000ffe001ffc0001ffc003ff80 ;text10 HEX 0000ff00fe003f81fc0000000fe03f80000001fc ;text11 HEX 000fe0007fffff07f000000003f8fe000000007f ;text12 HEX 01fe0003f8000fe1fc0000000fe03f80000001fc ;text13 HEX 1fc00000fe003f800ffe001ffc0001ffc003ff80 ; ********************************************************************** ; ** Bios code start ; ********************************************************************** ORG $F800 RESET Start lda #$00 ; Make sure volume is off. Also INPTCTRL=0 because INPTCTRL sta AUDV0 ; listens to all TIA locations until locked. sta AUDV1 ; Initialize the hardware sei cld lda #$02 sta INPTCTRL ; enable BIOS+Maria ldx #$FF txs ; setup the 6502 stack lda #$7F sta CTRL ; disable DMA lda #$00 sta BACKGRND ; black background ; ** Before we clear memory, here are some notes about handling RAM+ROM ; ** when BIOS mode is enabled... ; ** ; ** The BIOS ROM and Cart-ROM are banked via INPTCTRL. When INPTCTRL is ; ** set to BIOS-enabled, the Cart doesn't see the address lines ; ** A12+A14+A15. ; ** ; ** This forces many high addresses to appear very-low to the cart, but ; ** also has side-effects: ; ** ; ** -the BIOS can't access RAM below $2000 without bus-conflict with ; ** VCS carts and the CC2. If the VCS carts are ARM based, the conflicts ; ** seem to cause the ARM to crash. ; ** ; ** -the 6502 can't access BIOS ROM from Cxxx or Dxxx while a cart is ; ** plugged-in, or else the cart will see it as a request for 0xxx. ; ** This isn't a big for a ROM-based cart, but it will bus conflict with ; ** any carts that respond to 0xxx. I'm looking at you, CC2, but it could ; ** could also mess with homebrew devices in the 450-45F range. ; ** Clear 2000-27FF, pg0+pg1 memory. ClearMemPages lda #0 tay ; y=0 sta Temp1Lo ldx #$20 ClearMemPagesLoop stx Temp1Hi ; needed here for when we step on ZP memory sta (Temp1Lo),y ;Store data iny ;Next byte bne ClearMemPagesLoop inx cpx #$28 bne ClearMemPagesLoop ; ** Copy the 2600 Bootstrap to RIOT RAM ldx #$7F Copy2600CodeLoop lda Start2600,x sta $0480,x dex bpl Copy2600CodeLoop ; ** Setup the in-memory cart-check and in-memory 7800 cart-execute ldy #0 SetupCartCheckLoop lda CartCheckRom,y sta CartCheckRam,y dey bne SetupCartCheckLoop ; ** Clear TIA+MARIA registers lda #$00 tax Load7800CartClearLoop sta $01,x inx cpx #$2C bne Load7800CartClearLoop ; ** Re-set INPTCTRL, because the TIA register clear also hit INPTCTRL lda #$02 sta INPTCTRL lda #$FF ldx #$3F Load7800CartClearLoop2 sta $2000,x sta $2100,x dex bpl Load7800CartClearLoop2 ; ** Check the underlying cart and set CartTypeDetected jmp CartCheckRam CartReturnFromRam ; ** Check if a 2600 cart is inserted. If so, run it right away, no fuji lda CartTypeDetected cmp #1 bne skipGoto2600mode jmp Goto2600mode skipGoto2600mode ; ** setup the BIOS NMI pointer while DMA is still off. lda #<BIOSNMI sta NMIRoutine lda #>BIOSNMI sta NMIRoutineHi ; ** copy DL objects from ROM into RAM ldy #0 CopyDLRom lda DLROM,y sta DlRam+24,y iny cpy #(DLROMEND-DLROM) bne CopyDLRom ; ** copy DLL from ROM into RAM, but keep the logo hidden for the wipe lda #12 sta WipeLevel jsr UpdateDLLRom ; ********************************************************************** ; ** Start the display, and do the main loop. ; ********************************************************************** jsr WaitForVblankEnd jsr WaitForVblankStart lda #>DllRam sta DPPH lda #<DllRam sta DPPL lda #%01000011 ; enable DMA, RM=320A/C sta CTRL lda #$0f sta P0C2 sta P1C2 Main MainLoop ; ** We're at the top of vblank, so we can modify the DL to perform the ; ** wipe. ldy #0 ; fade-in lda FrameCounter32 beq contWipeUpdate ldy #1 ; fade-out cmp #(DISPLAYTIME-1) beq contWipeUpdate jmp skipWipeUpdate contWipeUpdate lda FrameCounter lsr bcs skipWipeUpdate and #15 eor WipeDirTable,y sta WipeLevel jsr UpdateDLLRom skipWipeUpdate LeaveLoaderCheck ; ** react to B+W to skip the fuji lda SWCHB and #%00001000 bne CheckFrameCounter jmp LeaveLoader CheckFrameCounter ; ** Check if the display time has expired... lda FrameCounter32 cmp #DISPLAYTIME bne skipLeaveLoader jmp LeaveLoader skipLeaveLoader jsr WaitForVblankEnd ; *** We're at the top of the visible screen ; *** ...but we have nothing to do here. jsr WaitForVblankStart jmp MainLoop WipeDirTable .byte 15,0 ; ** Utility routines LeaveLoader ; ** Leave the loader and launch the cart or BIOS game, ; ** depending on CartTypeDetected lda #$60 sta CTRL sta WSYNC lda CartTypeDetected bne skipGameStart sta $8000 ; If we're here, no cart is inserted. jmp GameStart skipGameStart ; If we're here, a 7800 cart is inserted jmp Load7800CartRam Load7800CartRam = (Load7800CartRom - CartCheckRom + CartCheckRam) ; The ROM routine we use to check the underlying cart type. ; Don't use JMP or JSR in here, except to exit back to ROM. CartCheckRom lda #$06 sta INPTCTRL ; switch to cart rom lda #$00 sta CartTypeDetected ; Do Rom checks and set CartTypeDetected: ; 0 = no cart ; 1 = 2600 ; 2 = 7800 ; ** Start with this 2600 test first. The others seem to reliably crash ; ** ARM based carts... lda $1BEA ; see if the 4k mirror ROM is interfering with Maria RAM eor #$FF sta $1BEA tay cpy $1BEA bne Set2600CartMode ; ** Then move on to empty cart tests... ldy #$FF ;Compare FE00-FE7F with FE80-FEFF ldx #$7F ;if they aren't the same start internal game CompareMemoryLoop lda $FE00,x ; first iteration is $FE7F ($FE00 + $7F) cmp $FD80,y ; first iteration is $FE7F ($FD80 + $FF) bne CartCheckRomReturn dey ; dex ; bpl CompareMemoryLoop lda $FFFC ;If reset vector contains $FFFF and $FFFD ;start internal game cmp #$FF ; beq CartCheckRomReturn lda $FFFC ;If reset vectore contains $0000 ora $FFFD ;start internal game beq CartCheckRomReturn ; ** Then back to the 2600 tests... lda $FFF8 ;Check region verification ora #$FE cmp #$FF bne Set2600CartMode lda $FFF8 eor #$F0 and #$F0 bne Set2600CartMode lda $FFF9 ;Check ROM start and #$0B cmp #$03 bne Set2600CartMode lda $FFF9 ;If ROM start page <4 branch and #$F0 ; cmp #$40 ; bcc Set2600CartMode ;Start 2600 mode? sbc #$01 cmp $FFFD bcs Set2600CartMode ;Start 2600 mode? ldx #$05 CompareMemoryLoop2 lda $FFFA,x cmp $DFFA,x ; If it's a 2600 cart, the 6502 vectors. bne Set7800CartMode ; will match at FFFx, DFFx, BFFx, etc.. cmp $BFFA,x ; Checking multiple mirrors may seem bne Set7800CartMode ; excessive, but Galaga has a copy of cmp $9FFA,x ; it's cart vectors at DFFx. bne Set7800CartMode cmp $7FFA,x bne Set7800CartMode cmp $5FFA,x bne Set7800CartMode dex bpl CompareMemoryLoop2 bmi Set2600CartMode ; always taken Set7800CartMode inc CartTypeDetected Set2600CartMode inc CartTypeDetected CartCheckRomReturn lda #$02 ; switch back to BIOS rom sta INPTCTRL ; switch to cart rom jmp CartReturnFromRam Load7800CartRom ; We set the 6502 state similar to when leaving the NTSC BIOS. lda #$FF sta $40 sta $41 sta $42 sta $43 sta $44 sta $45 sta $46 sta $47 sta $48 lda #$60 sta CTRL Load7800CartWait bit MSTAT bpl Load7800CartWait ldx #$06 ; both the NTSC and PAL BIOS do the rather odd init below. stx INPTCTRL ldx #$FF txs cld jmp ($FFFC) Goto2600mode lda #$02 sta $01 jmp $0480 ;Execute 2600 Cart WaitForVblankEnd bit MSTAT bmi WaitForVblankEnd rts WaitForVblankStart bit MSTAT bpl WaitForVblankStart rts UpdateDLLRom ldy #(DLLROMEND-DLLROM-1) CopyDLLRom lda DLLROM,y sta DllRam,y dey bpl CopyDLLRom ; ** Routine to blank the DLs for wipe reveal. WipeLevel ranges from 0 ; ** to 12 BlankDLRom ldy #0 ldx #(22*3) lda WipeLevel asl adc WipeLevel sta Temp1 ; Temp1 = WipeLevel * 3 BlankDLRomLoop cpy Temp1 beq BlankEnd lda #>BLANKDL sta DllRam+VISIBLEOFFSET+1,y sta DllRam+VISIBLEOFFSET-2,x lda #<BLANKDL sta DllRam+VISIBLEOFFSET+2,y sta DllRam+VISIBLEOFFSET-1,x dex dex dex iny iny iny jmp BlankDLRomLoop BlankEnd rts ; ************** DLL data ****** DLLROM ; Overscan lines: 25 .byte $0F ; 16 lines .byte >BLANKDL .byte <BLANKDL .byte $07 ; 8 lines .byte >BLANKDL .byte <BLANKDL .byte $80 ; 1 line, with NMI .byte >BLANKDL .byte <BLANKDL VISIBLEStart VISIBLEOFFSET = (VISIBLEStart-DLLROM) ; Visible lines: 192 DLMEMVAL SET DlRam BLANKDL = DLMEMVAL + 10 ; first visible DL terminator used for blank zones echo " ** DL Memory Start: ",(DLMEMVAL) REPEAT 24 .byte $07 ; 8 lines .byte >DLMEMVAL .byte <DLMEMVAL DLMEMVAL SET DLMEMVAL + 12 ; 12 = 2x5-byte objects + 2-byte terminator REPEND echo " ** DL Memory End: ",(DLMEMVAL-1) echo " ** DL Memory Size: ",(DLMEMVAL-1-DlRam) VISIBLEEND VISIBLESIZE = (VISIBLEEND-VISIBLEStart) ; More overscan lines: 80 REPEAT 5 .byte $0F ; 16 lines .byte >BLANKDL .byte <BLANKDL REPEND ; Total provided lines = 25 + 192 + 80 = 297 ; Required, NTSC:243, PAL:293 DLLROMEND echo " ** DLL ROM Start: ",(DLLROM) echo " ** DLL ROM End: ",(DLLROMEND) echo " ** DLL ROM Size: ",(DLLROMEND-DLLROM)d DLROM ; zone 0 .byte <fuji00,$40,>fuji00,$09,$04 .byte $00,$00,$00,$00,$00 .byte $00,$00 ; zone 1 .byte <fuji01,$40,>fuji01,$09,$04 .byte $00,$00,$00,$00,$00 .byte $00,$00 ; zone 2 .byte <fuji02,$40,>fuji02,$09,$04 .byte <text00,$40,>text00,$2c,$4c .byte $00,$00 ; zone 3 .byte <fuji03,$40,>fuji03,$09,$04 .byte <text01,$40,>text01,$2c,$4c .byte $00,$00 ; zone 4 .byte <fuji04,$40,>fuji04,$09,$04 .byte <text02,$40,>text02,$2c,$4c .byte $00,$00 ; zone 5 .byte <fuji05,$40,>fuji05,$09,$04 .byte <text03,$40,>text03,$2c,$4c .byte $00,$00 ; zone 6 .byte <fuji06,$40,>fuji06,$09,$04 .byte <text04,$40,>text04,$2c,$4c .byte $00,$00 ; zone 7 .byte <fuji07,$40,>fuji07,$09,$04 .byte <text05,$40,>text05,$2c,$4c .byte $00,$00 ; zone 8 .byte <fuji08,$40,>fuji08,$09,$04 .byte <text06,$40,>text06,$2c,$4c .byte $00,$00 ; zone 9 .byte <fuji09,$40,>fuji09,$09,$04 .byte <text07,$40,>text07,$2c,$4c .byte $00,$00 ; zone 10 .byte <fuji10,$40,>fuji10,$09,$04 .byte <text08,$40,>text08,$2c,$4c .byte $00,$00 ; zone 11 .byte <fuji11,$40,>fuji11,$09,$04 .byte <text09,$40,>text09,$2c,$4c .byte $00,$00 ; zone 12 .byte <fuji12,$40,>fuji12,$09,$04 .byte <text10,$40,>text10,$2c,$4c .byte $00,$00 ; zone 13 .byte <fuji13,$40,>fuji13,$09,$04 .byte <text11,$40,>text11,$2c,$4c .byte $00,$00 ; zone 14 .byte <fuji14,$40,>fuji14,$09,$04 .byte <text12,$40,>text12,$2c,$4c .byte $00,$00 ; zone 15 .byte <fuji15,$40,>fuji15,$09,$04 .byte <text13,$40,>text13,$2c,$4c .byte $00,$00 ; zone 16 .byte <fuji16,$40,>fuji16,$09,$04 .byte $00,$00,$00,$00,$00 .byte $00,$00 ; zone 17 .byte <fuji17,$40,>fuji17,$09,$04 .byte $00,$00,$00,$00,$00 .byte $00,$00 ; zone 18 .byte <fuji18,$40,>fuji18,$09,$04 .byte $00,$00,$00,$00,$00 .byte $00,$00 ; zone 19 .byte <fuji19,$40,>fuji19,$09,$04 .byte $00,$00,$00,$00,$00 .byte $00,$00 DLROMEND NMI jmp (NMIRoutine) BIOSNMI pha tya pha txa pha cld inc FrameCounter lda FrameCounter and #31 bne SkipFrameCounter32Update inc FrameCounter32 SkipFrameCounter32Update lda FrameCounter and #3 bne SkipFujiColorIncrement inc FujiColor SkipFujiColorIncrement ldy #192 ldx FujiColor FujiColorsLoop stx WSYNC stx P0C2 inx dey bne FujiColorsLoop ; restore the registers pla tax pla tay pla rti IRQ RTI ; ********************************************************************** ; *** The 2600 Boot Loader. Actually runs from $480. ; ********************************************************************** Start2600 lda #$00 tax sta $01 ;Turn off MARIA Start2600_LOOPCLEARTIA sta $03,x ;Clear TIA registers inx ; cpx #$2A ; bne Start2600_LOOPCLEARTIA sta $02 ;WSYNC lda #$04 nop bmi Start2600_BRANCH2 ldx #$04 Start2600_LOOP2 dex bpl Start2600_LOOP2 txs sta $0110 jsr $04CB jsr $04CB sta $11 sta $1B sta $1C sta $0F nop sta $02 lda #$00 nop bmi Start2600_BRANCH2 bit $03 bmi Start2600_BRANCH3 Start2600_BRANCH2 lda #$02 sta $09 sta $F112 bne Start2600_BRANCH4 Start2600_BRANCH3 bit $02 bmi Start2600_BRANCH5 lda #$02 sta $06 sta $F118 sta $F460 bne Start2600_BRANCH4 Start2600_BRANCH5 sta $2C lda #$08 sta $1B jsr $04CB nop bit $02 bmi Start2600_BRANCH2 Start2600_BRANCH4 lda #$FD sta $08 jmp ($FFFC) jsr $F444 lda $82 bpl Start2600_BRANCH6 lda #$00 Start2600_BRANCH6 asl asl clc adc $83 sta $55 lda #$01 rts ;END OF CODE AT $480 ORG $FC00 ; ********************************************************************** ; ** Second game block. There's just under 1k of extra game data that ; ** can go here. If your 8k game doesn't need it, you can skip it. ; ********************************************************************** incbin "kiloparsec.bl2" GameStart ; Starts Internal Game LDA #$13 ;LOCK IN MARIA MODE STA INPTCTRL jsr GameStart_SCREENOF GameStart_01 bit MSTAT bmi GameStart_01 jmp $CBCC ;Entry Point of Game GameStart_SCREENOF BIT MSTAT ;IS VBLANK ENDED YET? BMI GameStart_SCREENOF GameStart_SCREENON BIT MSTAT ;IS VBLANK STARTED YET? BPL GameStart_SCREENON RTS echo " **",($FFF7-*)d,"bytes of BIOS ROM free." echo " *****************************************************************" ; ** 7800 bytes and 6502 vectors ORG $FFF8 .byte $FF ;Region verification .byte $F7 ;ROM checksum $f000-$ffff .word NMI .word RESET .word IRQ
sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
ala/spark
0
1937
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * This file is an adaptation of Presto's presto-parser/src/main/antlr4/com/facebook/presto/sql/parser/SqlBase.g4 grammar. */ grammar SqlBase; @members { /** * Verify whether current token is a valid decimal token (which contains dot). * Returns true if the character that follows the token is not a digit or letter or underscore. * * For example: * For char stream "2.3", "2." is not a valid decimal token, because it is followed by digit '3'. * For char stream "2.3_", "2.3" is not a valid decimal token, because it is followed by '_'. * For char stream "2.3W", "2.3" is not a valid decimal token, because it is followed by 'W'. * For char stream "12.0D 34.E2+0.12 " 12.0D is a valid decimal token because it is folllowed * by a space. 34.E2 is a valid decimal token because it is followed by symbol '+' * which is not a digit or letter or underscore. */ public boolean isValidDecimal() { int nextChar = _input.LA(1); if (nextChar >= 'A' && nextChar <= 'Z' || nextChar >= '0' && nextChar <= '9' || nextChar == '_') { return false; } else { return true; } } } tokens { DELIMITER } singleStatement : statement EOF ; singleExpression : namedExpression EOF ; singleTableIdentifier : tableIdentifier EOF ; singleDataType : dataType EOF ; statement : query #statementDefault | USE db=identifier #use | CREATE DATABASE (IF NOT EXISTS)? identifier (COMMENT comment=STRING)? locationSpec? (WITH DBPROPERTIES tablePropertyList)? #createDatabase | ALTER DATABASE identifier SET DBPROPERTIES tablePropertyList #setDatabaseProperties | DROP DATABASE (IF EXISTS)? identifier (RESTRICT | CASCADE)? #dropDatabase | createTableHeader ('(' colTypeList ')')? tableProvider (OPTIONS options=tablePropertyList)? (PARTITIONED BY partitionColumnNames=identifierList)? bucketSpec? locationSpec? (COMMENT comment=STRING)? (AS? query)? #createTable | createTableHeader ('(' columns=colTypeList ')')? (COMMENT comment=STRING)? (PARTITIONED BY '(' partitionColumns=colTypeList ')')? bucketSpec? skewSpec? rowFormat? createFileFormat? locationSpec? (TBLPROPERTIES tablePropertyList)? (AS? query)? #createHiveTable | CREATE TABLE (IF NOT EXISTS)? target=tableIdentifier LIKE source=tableIdentifier locationSpec? #createTableLike | ANALYZE TABLE tableIdentifier partitionSpec? COMPUTE STATISTICS (identifier | FOR COLUMNS identifierSeq)? #analyze | ALTER (TABLE | VIEW) from=tableIdentifier RENAME TO to=tableIdentifier #renameTable | ALTER (TABLE | VIEW) tableIdentifier SET TBLPROPERTIES tablePropertyList #setTableProperties | ALTER (TABLE | VIEW) tableIdentifier UNSET TBLPROPERTIES (IF EXISTS)? tablePropertyList #unsetTableProperties | ALTER TABLE tableIdentifier partitionSpec? CHANGE COLUMN? identifier colType colPosition? #changeColumn | ALTER TABLE tableIdentifier (partitionSpec)? SET SERDE STRING (WITH SERDEPROPERTIES tablePropertyList)? #setTableSerDe | ALTER TABLE tableIdentifier (partitionSpec)? SET SERDEPROPERTIES tablePropertyList #setTableSerDe | ALTER TABLE tableIdentifier ADD (IF NOT EXISTS)? partitionSpecLocation+ #addTablePartition | ALTER VIEW tableIdentifier ADD (IF NOT EXISTS)? partitionSpec+ #addTablePartition | ALTER TABLE tableIdentifier from=partitionSpec RENAME TO to=partitionSpec #renameTablePartition | ALTER TABLE tableIdentifier DROP (IF EXISTS)? partitionSpec (',' partitionSpec)* PURGE? #dropTablePartitions | ALTER VIEW tableIdentifier DROP (IF EXISTS)? partitionSpec (',' partitionSpec)* #dropTablePartitions | ALTER TABLE tableIdentifier partitionSpec? SET locationSpec #setTableLocation | ALTER TABLE tableIdentifier RECOVER PARTITIONS #recoverPartitions | DROP TABLE (IF EXISTS)? tableIdentifier PURGE? #dropTable | DROP VIEW (IF EXISTS)? tableIdentifier #dropTable | CREATE (OR REPLACE)? (GLOBAL? TEMPORARY)? VIEW (IF NOT EXISTS)? tableIdentifier identifierCommentList? (COMMENT STRING)? (PARTITIONED ON identifierList)? (TBLPROPERTIES tablePropertyList)? AS query #createView | CREATE (OR REPLACE)? GLOBAL? TEMPORARY VIEW tableIdentifier ('(' colTypeList ')')? tableProvider (OPTIONS tablePropertyList)? #createTempViewUsing | ALTER VIEW tableIdentifier AS? query #alterViewQuery | CREATE TEMPORARY? FUNCTION qualifiedName AS className=STRING (USING resource (',' resource)*)? #createFunction | DROP TEMPORARY? FUNCTION (IF EXISTS)? qualifiedName #dropFunction | EXPLAIN (LOGICAL | FORMATTED | EXTENDED | CODEGEN)? statement #explain | SHOW TABLES ((FROM | IN) db=identifier)? (LIKE? pattern=STRING)? #showTables | SHOW TABLE EXTENDED ((FROM | IN) db=identifier)? LIKE pattern=STRING partitionSpec? #showTable | SHOW DATABASES (LIKE pattern=STRING)? #showDatabases | SHOW TBLPROPERTIES table=tableIdentifier ('(' key=tablePropertyKey ')')? #showTblProperties | SHOW COLUMNS (FROM | IN) tableIdentifier ((FROM | IN) db=identifier)? #showColumns | SHOW PARTITIONS tableIdentifier partitionSpec? #showPartitions | SHOW identifier? FUNCTIONS (LIKE? (qualifiedName | pattern=STRING))? #showFunctions | SHOW CREATE TABLE tableIdentifier #showCreateTable | (DESC | DESCRIBE) FUNCTION EXTENDED? describeFuncName #describeFunction | (DESC | DESCRIBE) DATABASE EXTENDED? identifier #describeDatabase | (DESC | DESCRIBE) TABLE? option=(EXTENDED | FORMATTED)? tableIdentifier partitionSpec? describeColName? #describeTable | REFRESH TABLE tableIdentifier #refreshTable | REFRESH .*? #refreshResource | CACHE LAZY? TABLE tableIdentifier (AS? query)? #cacheTable | UNCACHE TABLE (IF EXISTS)? tableIdentifier #uncacheTable | CLEAR CACHE #clearCache | LOAD DATA LOCAL? INPATH path=STRING OVERWRITE? INTO TABLE tableIdentifier partitionSpec? #loadData | TRUNCATE TABLE tableIdentifier partitionSpec? #truncateTable | MSCK REPAIR TABLE tableIdentifier #repairTable | op=(ADD | LIST) identifier .*? #manageResource | SET ROLE .*? #failNativeCommand | SET .*? #setConfiguration | RESET #resetConfiguration | unsupportedHiveNativeCommands .*? #failNativeCommand ; unsupportedHiveNativeCommands : kw1=CREATE kw2=ROLE | kw1=DROP kw2=ROLE | kw1=GRANT kw2=ROLE? | kw1=REVOKE kw2=ROLE? | kw1=SHOW kw2=GRANT | kw1=SHOW kw2=ROLE kw3=GRANT? | kw1=SHOW kw2=PRINCIPALS | kw1=SHOW kw2=ROLES | kw1=SHOW kw2=CURRENT kw3=ROLES | kw1=EXPORT kw2=TABLE | kw1=IMPORT kw2=TABLE | kw1=SHOW kw2=COMPACTIONS | kw1=SHOW kw2=CREATE kw3=TABLE | kw1=SHOW kw2=TRANSACTIONS | kw1=SHOW kw2=INDEXES | kw1=SHOW kw2=LOCKS | kw1=CREATE kw2=INDEX | kw1=DROP kw2=INDEX | kw1=ALTER kw2=INDEX | kw1=LOCK kw2=TABLE | kw1=LOCK kw2=DATABASE | kw1=UNLOCK kw2=TABLE | kw1=UNLOCK kw2=DATABASE | kw1=CREATE kw2=TEMPORARY kw3=MACRO | kw1=DROP kw2=TEMPORARY kw3=MACRO | kw1=ALTER kw2=TABLE tableIdentifier kw3=NOT kw4=CLUSTERED | kw1=ALTER kw2=TABLE tableIdentifier kw3=CLUSTERED kw4=BY | kw1=ALTER kw2=TABLE tableIdentifier kw3=NOT kw4=SORTED | kw1=ALTER kw2=TABLE tableIdentifier kw3=SKEWED kw4=BY | kw1=ALTER kw2=TABLE tableIdentifier kw3=NOT kw4=SKEWED | kw1=ALTER kw2=TABLE tableIdentifier kw3=NOT kw4=STORED kw5=AS kw6=DIRECTORIES | kw1=ALTER kw2=TABLE tableIdentifier kw3=SET kw4=SKEWED kw5=LOCATION | kw1=ALTER kw2=TABLE tableIdentifier kw3=EXCHANGE kw4=PARTITION | kw1=ALTER kw2=TABLE tableIdentifier kw3=ARCHIVE kw4=PARTITION | kw1=ALTER kw2=TABLE tableIdentifier kw3=UNARCHIVE kw4=PARTITION | kw1=ALTER kw2=TABLE tableIdentifier kw3=TOUCH | kw1=ALTER kw2=TABLE tableIdentifier partitionSpec? kw3=COMPACT | kw1=ALTER kw2=TABLE tableIdentifier partitionSpec? kw3=CONCATENATE | kw1=ALTER kw2=TABLE tableIdentifier partitionSpec? kw3=SET kw4=FILEFORMAT | kw1=ALTER kw2=TABLE tableIdentifier partitionSpec? kw3=ADD kw4=COLUMNS | kw1=ALTER kw2=TABLE tableIdentifier partitionSpec? kw3=REPLACE kw4=COLUMNS | kw1=START kw2=TRANSACTION | kw1=COMMIT | kw1=ROLLBACK | kw1=DFS | kw1=DELETE kw2=FROM ; createTableHeader : CREATE TEMPORARY? EXTERNAL? TABLE (IF NOT EXISTS)? tableIdentifier ; bucketSpec : CLUSTERED BY identifierList (SORTED BY orderedIdentifierList)? INTO INTEGER_VALUE BUCKETS ; skewSpec : SKEWED BY identifierList ON (constantList | nestedConstantList) (STORED AS DIRECTORIES)? ; locationSpec : LOCATION STRING ; query : ctes? queryNoWith ; insertInto : INSERT OVERWRITE TABLE tableIdentifier (partitionSpec (IF NOT EXISTS)?)? | INSERT INTO TABLE? tableIdentifier partitionSpec? ; partitionSpecLocation : partitionSpec locationSpec? ; partitionSpec : PARTITION '(' partitionVal (',' partitionVal)* ')' ; partitionVal : identifier (EQ constant)? ; describeFuncName : qualifiedName | STRING | comparisonOperator | arithmeticOperator | predicateOperator ; describeColName : identifier ('.' (identifier | STRING))* ; ctes : WITH namedQuery (',' namedQuery)* ; namedQuery : name=identifier AS? '(' query ')' ; tableProvider : USING qualifiedName ; tablePropertyList : '(' tableProperty (',' tableProperty)* ')' ; tableProperty : key=tablePropertyKey (EQ? value=tablePropertyValue)? ; tablePropertyKey : identifier ('.' identifier)* | STRING ; tablePropertyValue : INTEGER_VALUE | DECIMAL_VALUE | booleanValue | STRING ; constantList : '(' constant (',' constant)* ')' ; nestedConstantList : '(' constantList (',' constantList)* ')' ; createFileFormat : STORED AS fileFormat | STORED BY storageHandler ; fileFormat : INPUTFORMAT inFmt=STRING OUTPUTFORMAT outFmt=STRING #tableFileFormat | identifier #genericFileFormat ; storageHandler : STRING (WITH SERDEPROPERTIES tablePropertyList)? ; resource : identifier STRING ; queryNoWith : insertInto? queryTerm queryOrganization #singleInsertQuery | fromClause multiInsertQueryBody+ #multiInsertQuery ; queryOrganization : (ORDER BY order+=sortItem (',' order+=sortItem)*)? (CLUSTER BY clusterBy+=expression (',' clusterBy+=expression)*)? (DISTRIBUTE BY distributeBy+=expression (',' distributeBy+=expression)*)? (SORT BY sort+=sortItem (',' sort+=sortItem)*)? windows? (LIMIT limit=expression)? ; multiInsertQueryBody : insertInto? querySpecification queryOrganization ; queryTerm : queryPrimary #queryTermDefault | left=queryTerm operator=(INTERSECT | UNION | EXCEPT | SETMINUS) setQuantifier? right=queryTerm #setOperation ; queryPrimary : querySpecification #queryPrimaryDefault | TABLE tableIdentifier #table | inlineTable #inlineTableDefault1 | '(' queryNoWith ')' #subquery ; sortItem : expression ordering=(ASC | DESC)? (NULLS nullOrder=(LAST | FIRST))? ; querySpecification : (((SELECT kind=TRANSFORM '(' namedExpressionSeq ')' | kind=MAP namedExpressionSeq | kind=REDUCE namedExpressionSeq)) inRowFormat=rowFormat? (RECORDWRITER recordWriter=STRING)? USING script=STRING (AS (identifierSeq | colTypeList | ('(' (identifierSeq | colTypeList) ')')))? outRowFormat=rowFormat? (RECORDREADER recordReader=STRING)? fromClause? (WHERE where=booleanExpression)?) | ((kind=SELECT hint? setQuantifier? namedExpressionSeq fromClause? | fromClause (kind=SELECT setQuantifier? namedExpressionSeq)?) lateralView* (WHERE where=booleanExpression)? aggregation? (HAVING having=booleanExpression)? windows?) ; hint : '/*+' hintStatement '*/' ; hintStatement : hintName=identifier | hintName=identifier '(' parameters+=identifier parameters+=identifier ')' | hintName=identifier '(' parameters+=identifier (',' parameters+=identifier)* ')' ; fromClause : FROM relation (',' relation)* lateralView* ; aggregation : GROUP BY groupingExpressions+=expression (',' groupingExpressions+=expression)* ( WITH kind=ROLLUP | WITH kind=CUBE | kind=GROUPING SETS '(' groupingSet (',' groupingSet)* ')')? ; groupingSet : '(' (expression (',' expression)*)? ')' | expression ; lateralView : LATERAL VIEW (OUTER)? qualifiedName '(' (expression (',' expression)*)? ')' tblName=identifier (AS? colName+=identifier (',' colName+=identifier)*)? ; setQuantifier : DISTINCT | ALL ; relation : relationPrimary joinRelation* ; joinRelation : (joinType) JOIN right=relationPrimary joinCriteria? | NATURAL joinType JOIN right=relationPrimary ; joinType : INNER? | CROSS | LEFT OUTER? | LEFT SEMI | RIGHT OUTER? | FULL OUTER? | LEFT? ANTI ; joinCriteria : ON booleanExpression | USING '(' identifier (',' identifier)* ')' ; sample : TABLESAMPLE '(' ( (percentage=(INTEGER_VALUE | DECIMAL_VALUE) sampleType=PERCENTLIT) | (expression sampleType=ROWS) | sampleType=BYTELENGTH_LITERAL | (sampleType=BUCKET numerator=INTEGER_VALUE OUT OF denominator=INTEGER_VALUE (ON (identifier | qualifiedName '(' ')'))?)) ')' ; identifierList : '(' identifierSeq ')' ; identifierSeq : identifier (',' identifier)* ; orderedIdentifierList : '(' orderedIdentifier (',' orderedIdentifier)* ')' ; orderedIdentifier : identifier ordering=(ASC | DESC)? ; identifierCommentList : '(' identifierComment (',' identifierComment)* ')' ; identifierComment : identifier (COMMENT STRING)? ; relationPrimary : tableIdentifier sample? (AS? strictIdentifier)? #tableName | '(' queryNoWith ')' sample? (AS? strictIdentifier)? #aliasedQuery | '(' relation ')' sample? (AS? strictIdentifier)? #aliasedRelation | inlineTable #inlineTableDefault2 | identifier '(' (expression (',' expression)*)? ')' #tableValuedFunction ; inlineTable : VALUES expression (',' expression)* (AS? identifier identifierList?)? ; rowFormat : ROW FORMAT SERDE name=STRING (WITH SERDEPROPERTIES props=tablePropertyList)? #rowFormatSerde | ROW FORMAT DELIMITED (FIELDS TERMINATED BY fieldsTerminatedBy=STRING (ESCAPED BY escapedBy=STRING)?)? (COLLECTION ITEMS TERMINATED BY collectionItemsTerminatedBy=STRING)? (MAP KEYS TERMINATED BY keysTerminatedBy=STRING)? (LINES TERMINATED BY linesSeparatedBy=STRING)? (NULL DEFINED AS nullDefinedAs=STRING)? #rowFormatDelimited ; tableIdentifier : (db=identifier '.')? table=identifier ; namedExpression : expression (AS? (identifier | identifierList))? ; namedExpressionSeq : namedExpression (',' namedExpression)* ; expression : booleanExpression ; booleanExpression : NOT booleanExpression #logicalNot | predicated #booleanDefault | left=booleanExpression operator=AND right=booleanExpression #logicalBinary | left=booleanExpression operator=OR right=booleanExpression #logicalBinary | EXISTS '(' query ')' #exists ; // workaround for: // https://github.com/antlr/antlr4/issues/780 // https://github.com/antlr/antlr4/issues/781 predicated : valueExpression predicate? ; predicate : NOT? kind=BETWEEN lower=valueExpression AND upper=valueExpression | NOT? kind=IN '(' expression (',' expression)* ')' | NOT? kind=IN '(' query ')' | NOT? kind=(RLIKE | LIKE) pattern=valueExpression | IS NOT? kind=NULL ; valueExpression : primaryExpression #valueExpressionDefault | operator=(MINUS | PLUS | TILDE) valueExpression #arithmeticUnary | left=valueExpression operator=(ASTERISK | SLASH | PERCENT | DIV) right=valueExpression #arithmeticBinary | left=valueExpression operator=(PLUS | MINUS) right=valueExpression #arithmeticBinary | left=valueExpression operator=AMPERSAND right=valueExpression #arithmeticBinary | left=valueExpression operator=HAT right=valueExpression #arithmeticBinary | left=valueExpression operator=PIPE right=valueExpression #arithmeticBinary | left=valueExpression comparisonOperator right=valueExpression #comparison ; primaryExpression : name=(CURRENT_DATE | CURRENT_TIMESTAMP) #timeFunctionCall | CASE whenClause+ (ELSE elseExpression=expression)? END #searchedCase | CASE value=expression whenClause+ (ELSE elseExpression=expression)? END #simpleCase | CAST '(' expression AS dataType ')' #cast | constant #constantDefault | ASTERISK #star | qualifiedName '.' ASTERISK #star | '(' expression (',' expression)+ ')' #rowConstructor | '(' query ')' #subqueryExpression | qualifiedName '(' (setQuantifier? expression (',' expression)*)? ')' (OVER windowSpec)? #functionCall | value=primaryExpression '[' index=valueExpression ']' #subscript | identifier #columnReference | base=primaryExpression '.' fieldName=identifier #dereference | '(' expression ')' #parenthesizedExpression ; constant : NULL #nullLiteral | interval #intervalLiteral | identifier STRING #typeConstructor | number #numericLiteral | booleanValue #booleanLiteral | STRING+ #stringLiteral ; comparisonOperator : EQ | NEQ | NEQJ | LT | LTE | GT | GTE | NSEQ ; arithmeticOperator : PLUS | MINUS | ASTERISK | SLASH | PERCENT | DIV | TILDE | AMPERSAND | PIPE | HAT ; predicateOperator : OR | AND | IN | NOT ; booleanValue : TRUE | FALSE ; interval : INTERVAL intervalField* ; intervalField : value=intervalValue unit=identifier (TO to=identifier)? ; intervalValue : (PLUS | MINUS)? (INTEGER_VALUE | DECIMAL_VALUE) | STRING ; colPosition : FIRST | AFTER identifier ; dataType : complex=ARRAY '<' dataType '>' #complexDataType | complex=MAP '<' dataType ',' dataType '>' #complexDataType | complex=STRUCT ('<' complexColTypeList? '>' | NEQ) #complexDataType | identifier ('(' INTEGER_VALUE (',' INTEGER_VALUE)* ')')? #primitiveDataType ; colTypeList : colType (',' colType)* ; colType : identifier dataType (COMMENT STRING)? ; complexColTypeList : complexColType (',' complexColType)* ; complexColType : identifier ':' dataType (COMMENT STRING)? ; whenClause : WHEN condition=expression THEN result=expression ; windows : WINDOW namedWindow (',' namedWindow)* ; namedWindow : identifier AS windowSpec ; windowSpec : name=identifier #windowRef | '(' ( CLUSTER BY partition+=expression (',' partition+=expression)* | ((PARTITION | DISTRIBUTE) BY partition+=expression (',' partition+=expression)*)? ((ORDER | SORT) BY sortItem (',' sortItem)*)?) windowFrame? ')' #windowDef ; windowFrame : frameType=RANGE start=frameBound | frameType=ROWS start=frameBound | frameType=RANGE BETWEEN start=frameBound AND end=frameBound | frameType=ROWS BETWEEN start=frameBound AND end=frameBound ; frameBound : UNBOUNDED boundType=(PRECEDING | FOLLOWING) | boundType=CURRENT ROW | expression boundType=(PRECEDING | FOLLOWING) ; qualifiedName : identifier ('.' identifier)* ; identifier : strictIdentifier | ANTI | FULL | INNER | LEFT | SEMI | RIGHT | NATURAL | JOIN | CROSS | ON | UNION | INTERSECT | EXCEPT | SETMINUS ; strictIdentifier : IDENTIFIER #unquotedIdentifier | quotedIdentifier #quotedIdentifierAlternative | nonReserved #unquotedIdentifier ; quotedIdentifier : BACKQUOTED_IDENTIFIER ; number : MINUS? DECIMAL_VALUE #decimalLiteral | MINUS? INTEGER_VALUE #integerLiteral | MINUS? BIGINT_LITERAL #bigIntLiteral | MINUS? SMALLINT_LITERAL #smallIntLiteral | MINUS? TINYINT_LITERAL #tinyIntLiteral | MINUS? DOUBLE_LITERAL #doubleLiteral | MINUS? BIGDECIMAL_LITERAL #bigDecimalLiteral ; nonReserved : SHOW | TABLES | COLUMNS | COLUMN | PARTITIONS | FUNCTIONS | DATABASES | ADD | OVER | PARTITION | RANGE | ROWS | PRECEDING | FOLLOWING | CURRENT | ROW | LAST | FIRST | AFTER | MAP | ARRAY | STRUCT | LATERAL | WINDOW | REDUCE | TRANSFORM | USING | SERDE | SERDEPROPERTIES | RECORDREADER | DELIMITED | FIELDS | TERMINATED | COLLECTION | ITEMS | KEYS | ESCAPED | LINES | SEPARATED | EXTENDED | REFRESH | CLEAR | CACHE | UNCACHE | LAZY | GLOBAL | TEMPORARY | OPTIONS | GROUPING | CUBE | ROLLUP | EXPLAIN | FORMAT | LOGICAL | FORMATTED | CODEGEN | TABLESAMPLE | USE | TO | BUCKET | PERCENTLIT | OUT | OF | SET | RESET | VIEW | REPLACE | IF | NO | DATA | START | TRANSACTION | COMMIT | ROLLBACK | SORT | CLUSTER | DISTRIBUTE | UNSET | TBLPROPERTIES | SKEWED | STORED | DIRECTORIES | LOCATION | EXCHANGE | ARCHIVE | UNARCHIVE | FILEFORMAT | TOUCH | COMPACT | CONCATENATE | CHANGE | CASCADE | RESTRICT | BUCKETS | CLUSTERED | SORTED | PURGE | INPUTFORMAT | OUTPUTFORMAT | DBPROPERTIES | DFS | TRUNCATE | COMPUTE | LIST | STATISTICS | ANALYZE | PARTITIONED | EXTERNAL | DEFINED | RECORDWRITER | REVOKE | GRANT | LOCK | UNLOCK | MSCK | REPAIR | RECOVER | EXPORT | IMPORT | LOAD | VALUES | COMMENT | ROLE | ROLES | COMPACTIONS | PRINCIPALS | TRANSACTIONS | INDEX | INDEXES | LOCKS | OPTION | LOCAL | INPATH | ASC | DESC | LIMIT | RENAME | SETS | AT | NULLS | OVERWRITE | ALL | ALTER | AS | BETWEEN | BY | CREATE | DELETE | DESCRIBE | DROP | EXISTS | FALSE | FOR | GROUP | IN | INSERT | INTO | IS |LIKE | NULL | ORDER | OUTER | TABLE | TRUE | WITH | RLIKE | AND | CASE | CAST | DISTINCT | DIV | ELSE | END | FUNCTION | INTERVAL | MACRO | OR | STRATIFY | THEN | UNBOUNDED | WHEN | DATABASE | SELECT | FROM | WHERE | HAVING | TO | TABLE | WITH | NOT | CURRENT_DATE | CURRENT_TIMESTAMP ; SELECT: 'SELECT'; FROM: 'FROM'; ADD: 'ADD'; AS: 'AS'; ALL: 'ALL'; DISTINCT: 'DISTINCT'; WHERE: 'WHERE'; GROUP: 'GROUP'; BY: 'BY'; GROUPING: 'GROUPING'; SETS: 'SETS'; CUBE: 'CUBE'; ROLLUP: 'ROLLUP'; ORDER: 'ORDER'; HAVING: 'HAVING'; LIMIT: 'LIMIT'; AT: 'AT'; OR: 'OR'; AND: 'AND'; IN: 'IN'; NOT: 'NOT' | '!'; NO: 'NO'; EXISTS: 'EXISTS'; BETWEEN: 'BETWEEN'; LIKE: 'LIKE'; RLIKE: 'RLIKE' | 'REGEXP'; IS: 'IS'; NULL: 'NULL'; TRUE: 'TRUE'; FALSE: 'FALSE'; NULLS: 'NULLS'; ASC: 'ASC'; DESC: 'DESC'; FOR: 'FOR'; INTERVAL: 'INTERVAL'; CASE: 'CASE'; WHEN: 'WHEN'; THEN: 'THEN'; ELSE: 'ELSE'; END: 'END'; JOIN: 'JOIN'; CROSS: 'CROSS'; OUTER: 'OUTER'; INNER: 'INNER'; LEFT: 'LEFT'; SEMI: 'SEMI'; RIGHT: 'RIGHT'; FULL: 'FULL'; NATURAL: 'NATURAL'; ON: 'ON'; LATERAL: 'LATERAL'; WINDOW: 'WINDOW'; OVER: 'OVER'; PARTITION: 'PARTITION'; RANGE: 'RANGE'; ROWS: 'ROWS'; UNBOUNDED: 'UNBOUNDED'; PRECEDING: 'PRECEDING'; FOLLOWING: 'FOLLOWING'; CURRENT: 'CURRENT'; FIRST: 'FIRST'; AFTER: 'AFTER'; LAST: 'LAST'; ROW: 'ROW'; WITH: 'WITH'; VALUES: 'VALUES'; CREATE: 'CREATE'; TABLE: 'TABLE'; VIEW: 'VIEW'; REPLACE: 'REPLACE'; INSERT: 'INSERT'; DELETE: 'DELETE'; INTO: 'INTO'; DESCRIBE: 'DESCRIBE'; EXPLAIN: 'EXPLAIN'; FORMAT: 'FORMAT'; LOGICAL: 'LOGICAL'; CODEGEN: 'CODEGEN'; CAST: 'CAST'; SHOW: 'SHOW'; TABLES: 'TABLES'; COLUMNS: 'COLUMNS'; COLUMN: 'COLUMN'; USE: 'USE'; PARTITIONS: 'PARTITIONS'; FUNCTIONS: 'FUNCTIONS'; DROP: 'DROP'; UNION: 'UNION'; EXCEPT: 'EXCEPT'; SETMINUS: 'MINUS'; INTERSECT: 'INTERSECT'; TO: 'TO'; TABLESAMPLE: 'TABLESAMPLE'; STRATIFY: 'STRATIFY'; ALTER: 'ALTER'; RENAME: 'RENAME'; ARRAY: 'ARRAY'; MAP: 'MAP'; STRUCT: 'STRUCT'; COMMENT: 'COMMENT'; SET: 'SET'; RESET: 'RESET'; DATA: 'DATA'; START: 'START'; TRANSACTION: 'TRANSACTION'; COMMIT: 'COMMIT'; ROLLBACK: 'ROLLBACK'; MACRO: 'MACRO'; IF: 'IF'; EQ : '=' | '=='; NSEQ: '<=>'; NEQ : '<>'; NEQJ: '!='; LT : '<'; LTE : '<=' | '!>'; GT : '>'; GTE : '>=' | '!<'; PLUS: '+'; MINUS: '-'; ASTERISK: '*'; SLASH: '/'; PERCENT: '%'; DIV: 'DIV'; TILDE: '~'; AMPERSAND: '&'; PIPE: '|'; HAT: '^'; PERCENTLIT: 'PERCENT'; BUCKET: 'BUCKET'; OUT: 'OUT'; OF: 'OF'; SORT: 'SORT'; CLUSTER: 'CLUSTER'; DISTRIBUTE: 'DISTRIBUTE'; OVERWRITE: 'OVERWRITE'; TRANSFORM: 'TRANSFORM'; REDUCE: 'REDUCE'; USING: 'USING'; SERDE: 'SERDE'; SERDEPROPERTIES: 'SERDEPROPERTIES'; RECORDREADER: 'RECORDREADER'; RECORDWRITER: 'RECORDWRITER'; DELIMITED: 'DELIMITED'; FIELDS: 'FIELDS'; TERMINATED: 'TERMINATED'; COLLECTION: 'COLLECTION'; ITEMS: 'ITEMS'; KEYS: 'KEYS'; ESCAPED: 'ESCAPED'; LINES: 'LINES'; SEPARATED: 'SEPARATED'; FUNCTION: 'FUNCTION'; EXTENDED: 'EXTENDED'; REFRESH: 'REFRESH'; CLEAR: 'CLEAR'; CACHE: 'CACHE'; UNCACHE: 'UNCACHE'; LAZY: 'LAZY'; FORMATTED: 'FORMATTED'; GLOBAL: 'GLOBAL'; TEMPORARY: 'TEMPORARY' | 'TEMP'; OPTIONS: 'OPTIONS'; UNSET: 'UNSET'; TBLPROPERTIES: 'TBLPROPERTIES'; DBPROPERTIES: 'DBPROPERTIES'; BUCKETS: 'BUCKETS'; SKEWED: 'SKEWED'; STORED: 'STORED'; DIRECTORIES: 'DIRECTORIES'; LOCATION: 'LOCATION'; EXCHANGE: 'EXCHANGE'; ARCHIVE: 'ARCHIVE'; UNARCHIVE: 'UNARCHIVE'; FILEFORMAT: 'FILEFORMAT'; TOUCH: 'TOUCH'; COMPACT: 'COMPACT'; CONCATENATE: 'CONCATENATE'; CHANGE: 'CHANGE'; CASCADE: 'CASCADE'; RESTRICT: 'RESTRICT'; CLUSTERED: 'CLUSTERED'; SORTED: 'SORTED'; PURGE: 'PURGE'; INPUTFORMAT: 'INPUTFORMAT'; OUTPUTFORMAT: 'OUTPUTFORMAT'; DATABASE: 'DATABASE' | 'SCHEMA'; DATABASES: 'DATABASES' | 'SCHEMAS'; DFS: 'DFS'; TRUNCATE: 'TRUNCATE'; ANALYZE: 'ANALYZE'; COMPUTE: 'COMPUTE'; LIST: 'LIST'; STATISTICS: 'STATISTICS'; PARTITIONED: 'PARTITIONED'; EXTERNAL: 'EXTERNAL'; DEFINED: 'DEFINED'; REVOKE: 'REVOKE'; GRANT: 'GRANT'; LOCK: 'LOCK'; UNLOCK: 'UNLOCK'; MSCK: 'MSCK'; REPAIR: 'REPAIR'; RECOVER: 'RECOVER'; EXPORT: 'EXPORT'; IMPORT: 'IMPORT'; LOAD: 'LOAD'; ROLE: 'ROLE'; ROLES: 'ROLES'; COMPACTIONS: 'COMPACTIONS'; PRINCIPALS: 'PRINCIPALS'; TRANSACTIONS: 'TRANSACTIONS'; INDEX: 'INDEX'; INDEXES: 'INDEXES'; LOCKS: 'LOCKS'; OPTION: 'OPTION'; ANTI: 'ANTI'; LOCAL: 'LOCAL'; INPATH: 'INPATH'; CURRENT_DATE: 'CURRENT_DATE'; CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'; STRING : '\'' ( ~('\''|'\\') | ('\\' .) )* '\'' | '\"' ( ~('\"'|'\\') | ('\\' .) )* '\"' ; BIGINT_LITERAL : DIGIT+ 'L' ; SMALLINT_LITERAL : DIGIT+ 'S' ; TINYINT_LITERAL : DIGIT+ 'Y' ; BYTELENGTH_LITERAL : DIGIT+ ('B' | 'K' | 'M' | 'G') ; INTEGER_VALUE : DIGIT+ ; DECIMAL_VALUE : DIGIT+ EXPONENT | DECIMAL_DIGITS EXPONENT? {isValidDecimal()}? ; DOUBLE_LITERAL : DIGIT+ EXPONENT? 'D' | DECIMAL_DIGITS EXPONENT? 'D' {isValidDecimal()}? ; BIGDECIMAL_LITERAL : DIGIT+ EXPONENT? 'BD' | DECIMAL_DIGITS EXPONENT? 'BD' {isValidDecimal()}? ; IDENTIFIER : (LETTER | DIGIT | '_')+ ; BACKQUOTED_IDENTIFIER : '`' ( ~'`' | '``' )* '`' ; fragment DECIMAL_DIGITS : DIGIT+ '.' DIGIT* | '.' DIGIT+ ; fragment EXPONENT : 'E' [+-]? DIGIT+ ; fragment DIGIT : [0-9] ; fragment LETTER : [A-Z] ; SIMPLE_COMMENT : '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN) ; BRACKETED_EMPTY_COMMENT : '/**/' -> channel(HIDDEN) ; BRACKETED_COMMENT : '/*' ~[+] .*? '*/' -> channel(HIDDEN) ; WS : [ \r\n\t]+ -> channel(HIDDEN) ; // Catch-all for anything we can't recognize. // We use this to be able to ignore and recover all the text // when splitting statements with DelimiterLexer UNRECOGNIZED : . ;
oeis/112/A112456.asm
neoneye/loda-programs
11
18319
<filename>oeis/112/A112456.asm ; A112456: Least triangular number divisible by n-th prime. ; Submitted by <NAME> ; 6,3,10,21,55,78,136,171,253,406,465,666,820,903,1081,1378,1711,1830,2211,2485,2628,3081,3403,3916,4656,5050,5253,5671,5886,6328,8001,8515,9316,9591,11026,11325,12246,13203,13861,14878,15931,16290,18145,18528,19306 seq $0,40 ; The prime numbers. bin $0,2 add $1,$0 mov $2,6 lpb $1 add $1,$0 mov $0,$2 trn $1,3 lpe
oeis/322/A322450.asm
neoneye/loda-programs
11
15970
<reponame>neoneye/loda-programs<filename>oeis/322/A322450.asm ; A322450: Number of permutations of [2n] in which the size of the last cycle is n and the cycles are ordered by increasing smallest elements. ; Submitted by <NAME>(s3.) ; 1,1,4,60,2016,120960,11404800,1556755200,290594304000,71137485619200,22117290983424000,8515157028618240000,3977233344443842560000,2215887149047283712000000,1451849260055780288102400000,1105220249217462744317952000000,967392782844461507967713280000000,964813068756876277279799377920000000,1087699785935383676807015930265600000000,1376375309122634504631597958158090240000000,1942655436304518415108598260943133081600000000,3041138783014891555288187459403704696832000000000 mov $1,1 mov $2,1 mov $3,$0 lpb $3 mul $1,$0 mul $2,$3 add $1,$2 mul $1,$0 mov $4,$0 cmp $4,0 mov $5,$0 add $5,$4 div $1,$5 sub $3,1 mul $1,$3 mov $2,$1 max $3,1 lpe mov $0,$2
programs/oeis/052/A052905.asm
karttu/loda
1
21163
; A052905: a(n) = (n^2 + 7*n + 2)/2. ; 1,5,10,16,23,31,40,50,61,73,86,100,115,131,148,166,185,205,226,248,271,295,320,346,373,401,430,460,491,523,556,590,625,661,698,736,775,815,856,898,941,985,1030,1076,1123,1171,1220,1270,1321,1373,1426,1480,1535,1591,1648,1706,1765,1825,1886,1948,2011,2075,2140,2206,2273,2341,2410,2480,2551,2623,2696,2770,2845,2921,2998,3076,3155,3235,3316,3398,3481,3565,3650,3736,3823,3911,4000,4090,4181,4273,4366,4460,4555,4651,4748,4846,4945,5045,5146,5248,5351,5455,5560,5666,5773,5881,5990,6100,6211,6323,6436,6550,6665,6781,6898,7016,7135,7255,7376,7498,7621,7745,7870,7996,8123,8251,8380,8510,8641,8773,8906,9040,9175,9311,9448,9586,9725,9865,10006,10148,10291,10435,10580,10726,10873,11021,11170,11320,11471,11623,11776,11930,12085,12241,12398,12556,12715,12875,13036,13198,13361,13525,13690,13856,14023,14191,14360,14530,14701,14873,15046,15220,15395,15571,15748,15926,16105,16285,16466,16648,16831,17015,17200,17386,17573,17761,17950,18140,18331,18523,18716,18910,19105,19301,19498,19696,19895,20095,20296,20498,20701,20905,21110,21316,21523,21731,21940,22150,22361,22573,22786,23000,23215,23431,23648,23866,24085,24305,24526,24748,24971,25195,25420,25646,25873,26101,26330,26560,26791,27023,27256,27490,27725,27961,28198,28436,28675,28915,29156,29398,29641,29885,30130,30376,30623,30871,31120,31370,31621,31873 add $0,4 bin $0,2 mov $1,$0 sub $1,5
source/containers/a-cwacho.adb
ytomino/drake
33
16959
package body Ada.Containers.Weak_Access_Holders is procedure Add_Weak (Item : Weak_Holder_Access) is begin Item.Previous := null; Item.Next := Item.Data.Weak_List; if Item.Next /= null then Item.Next.Previous := Item; end if; Item.Data.Weak_List := Item; end Add_Weak; procedure Remove_Weak (Item : Weak_Holder_Access) is begin if Item.Previous /= null then pragma Assert (Item.Previous.Next = Item); Item.Previous.Next := Item.Next; else pragma Assert (Item.Data.Weak_List = Item); Item.Data.Weak_List := Item.Next; end if; if Item.Next /= null then pragma Assert (Item.Next.Previous = Item); Item.Next.Previous := Item.Previous; end if; end Remove_Weak; procedure Clear_Weaks ( List : in out Data; Null_Data : not null Data_Access) is I : Weak_Holder_Access := List.Weak_List; begin while I /= null loop declare Next : constant Weak_Holder_Access := I.Next; begin I.Data := Null_Data; I.Previous := null; I.Next := null; I := Next; end; end loop; end Clear_Weaks; end Ada.Containers.Weak_Access_Holders;
games/Giftpia/Main.asm
BttrDrgn/GC-Translation
1
3057
// GameCube "Giftpia" Japanese To English Translation by krom (<NAME>): endian msb // GameCube PPC requires Big-Endian Encoding (Most Significant Bit) output "../../output/Giftpia [U].iso", create origin $000000; insert "../../isos/Giftpia [J].iso" // Include Japanese Giftpia ISO macro Text(OFFSET, TEXT) { map 0, 0, 256 // Map Default ASCII Chars origin {OFFSET} db {TEXT} // ASCII Text To Print } macro TextShiftJIS(OFFSET, TEXT) { // Map Shift-JIS Words map ' ', $8140 map $2C, $8143 // Comma "," map '.', $8144 map ':', $8146 map '?', $8148 map '!', $8149 map '~', $8160 map '\s', $8166 // Single Quote "'" map '\d', $8168 // Double Quote '"' map '+', $817B map '&', $8195 map '0', $824F, 10 // Map Numbers map 'A', $8260, 26 // Map English "Upper Case" Characters map 'a', $8281, 26 // Map English "Lower Case" Characters origin {OFFSET} dw {TEXT} // Shift-JIS Text To Print } //Region Text($3, "E") include "Banner.asm" include "Menus.asm"
src/arch/x86/mach-i386/cpu/atomic.asm
MUYIio/Mini-OS
5
82134
[section .text] [bits 32] ;lock 锁定的是内存地址,所以操作对象值必须时内存才行 global mem_atomic_add mem_atomic_add: mov eax, [esp + 4] ; a mov ebx, [esp + 8] ; b lock add [eax], ebx ; *a += b ret global mem_atomic_sub mem_atomic_sub: mov eax, [esp + 4] mov ebx, [esp + 8] lock sub [eax], ebx ret global mem_atomic_inc mem_atomic_inc: mov eax, [esp + 4] lock inc dword [eax] ret global mem_atomic_dec mem_atomic_dec: mov eax, [esp + 4] lock dec dword [eax] ret global mem_atomic_or mem_atomic_or: mov eax, [esp + 4] mov ebx, [esp + 8] lock or [eax], ebx ret global mem_atomic_and mem_atomic_and: mov eax, [esp + 4] mov ebx, [esp + 8] lock and [eax], ebx ret
test/Fail/Issue215.agda
redfish64/autonomic-agda
1
11064
<gh_stars>1-10 module Issue215 where open import Imports.Bool {-# COMPILED_DATA Bool Bool True False #-}
src/Categories/Functor/Cartesian/Properties.agda
bond15/agda-categories
0
14328
<gh_stars>0 {-# OPTIONS --without-K --safe #-} -- Some of the obvious properties of cartesian functors module Categories.Functor.Cartesian.Properties where open import Data.Product using (_,_; proj₁; proj₂) open import Level open import Categories.Category.Core using (Category) open import Categories.Category.Cartesian open import Categories.Category.Product using (Product; _⁂_) open import Categories.Functor using (Functor; _∘F_) renaming (id to idF) open import Categories.Functor.Cartesian open import Categories.Morphism.Reasoning open import Categories.NaturalTransformation hiding (id) import Categories.Object.Product as OP private variable o ℓ e o′ ℓ′ e′ o″ ℓ″ e″ : Level idF-Cartesian : {A : Category o ℓ e} {CA : Cartesian A} → CartesianF CA CA idF idF-Cartesian {A = A} {CA} = record { ε = id ; ⊗-homo = ntHelper record { η = λ _ → id ; commute = λ _ → id-comm-sym A } } where open Category A ∘-Cartesian : {A : Category o ℓ e} {B : Category o′ ℓ′ e′} {C : Category o″ ℓ″ e″} {CA : Cartesian A} {CB : Cartesian B} {CC : Cartesian C} {F : Functor B C} {G : Functor A B} (CF : CartesianF CB CC F) (CG : CartesianF CA CB G) → CartesianF CA CC (F ∘F G) ∘-Cartesian {B = B} {C} {CA} {CB} {CC} {F} {G} CF CG = record { ε = F.₁ CG.ε ∘ CF.ε ; ⊗-homo = ntHelper record { η = λ X → F.₁ (NTG.η X) ∘ NTF.η (Functor.F₀ (G ⁂ G) X) ; commute = λ { {A} {B} f → let GGA = F₀ (G ⁂ G) A in let GGB = F₀ (G ⁂ G) B in let GGf = F₁ (G ⁂ G) f in begin (F.₁ (NTG.η B) ∘ NTF.η GGB) ∘ F₁ (⊗ CC ∘F ((F ∘F G) ⁂ (F ∘F G))) f ≈⟨ C.assoc ⟩ F.₁ (NTG.η B) ∘ NTF.η GGB ∘ F₁ (⊗ CC ∘F ((F ∘F G) ⁂ (F ∘F G))) f ≈⟨ (refl⟩∘⟨ NTF.commute GGf) ⟩ F.₁ (NTG.η B) ∘ (F.₁ (F₁ (⊗ CB) GGf) ∘ NTF.η GGA) ≈⟨ C.sym-assoc ⟩ (F.₁ (NTG.η B) ∘ F.₁ (F₁ (⊗ CB) GGf)) ∘ NTF.η GGA ≈˘⟨ (F.homomorphism ⟩∘⟨refl) ⟩ (F.₁ (NTG.η B B.∘ F₁ (⊗ CB) GGf)) ∘ NTF.η GGA ≈⟨ (F.F-resp-≈ (NTG.commute f) ⟩∘⟨refl) ⟩ F.F₁ (F₁ G (F₁ (⊗ CA) f) B.∘ NTG.η A) ∘ NTF.η GGA ≈⟨ (F.homomorphism ⟩∘⟨refl) ⟩ (F₁ ((F ∘F G) ∘F ⊗ CA) f ∘ F.₁ (NTG.η A)) ∘ NTF.η GGA ≈⟨ C.assoc ⟩ F₁ ((F ∘F G) ∘F ⊗ CA) f ∘ F.₁ (NTG.η A) ∘ NTF.η GGA ∎} } } where module CF = CartesianF CF module CG = CartesianF CG module NTF = NaturalTransformation CF.⊗-homo module NTG = NaturalTransformation CG.⊗-homo module F = Functor F module B = Category B module C = Category C open C using (_≈_; _∘_) open C.HomReasoning open Cartesian CC using (products) open Functor open OP C using (Product) open Product open Cartesian using (⊗)
Library/Trans/Graphics/Bitmap/Dib/Export/exportDIB.asm
steakknife/pcgeos
504
99761
<reponame>steakknife/pcgeos COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: exportDIB.asm AUTHOR: <NAME>, Mar 12, 1992 ROUTINES: Name Description ---- ----------- INT ExportDIB Exports a GString to the DIB format. The resulting bitmap is stored in the indicated file INT ETDDeleteTempFile destroy Temp File and Bitmap in it INT ETDSetBitmapType set the BMType according to the bitcount- will be complex with a palette, unless 24bit INT ETDCreateTempVMFile Creates a temp VM File- this will be used to play The Gstring into- Creating a bitmap which can then be converted out to DIB INT ETDCBitmapToDIB Write out a slice of scanlines into the specified DIB File INT ETDSetUpDIBHeader Sets up the DIB FIle Header and DIB info header in the specified file. These structures are as follows: FILEHEADER: DBFH_type BitmapType DBFH_size dword DBFH_reserved dword DBFH_offBit dword INT ETDWritePaletteToDIB Writes the default Geos color table to the DIB file specified INT ETDCalculateStripSizeAndOffset calculates the number of scanlines that will fit in a 100K block, as well as the offset to translate the bitmap such that any remain. scanlines(remainder of scanlines/(scanlines/block)) will be handled first. The DIB format has the origin at the lower left, and the CBitmap's origin is the upper left, therefore, the last scanline in the DIB is the first one in the bitmap. REVISION HISTORY: Name Date Description ---- ---- ----------- MS 3/12/92 Initial revision DESCRIPTION: The routines in this file export a Gstring to a Device Independent Bitmap(DIB). The DIB will then be processed by one of the bitmap translation libraries which will take the DIB as input and output the appropriate format. $Id: exportDIB.asm,v 1.1 97/04/07 11:29:08 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ExportCode segment resource ;start of code resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ExportHugeBitmapToDIB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Exports a Huge Bitmap to a DIB metafile format CALLED BY: ExportDIB PASS: bx -VMFile hptr si -VMBlock hptr di -DIBFile (lower word of stream pointer) dl -Bitcount byte RETURN: ax -will be zero if the export was successful otherwise will contain TransError bx: -if ax = TE_CUSTOM will contain handle of error text DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- MS 3/13/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ExportHugeBitmapToDIB proc near uses cx,dx,si,di,ds exportInfo local ExportInfo .enter mov exportInfo.ETDFrame.EDF_VMFile,bx mov exportInfo.ETDFrame.EDF_VMBlock,si mov exportInfo.ETDFrame.EDF_DIBFile,di mov exportInfo.ETDFrame.EDF_exportOptions,dl ; first get the height, width, and bit count of the Bitmap mov di,si ; di <= VM block call HugeArrayLockDir ; bx.di = HugeBitmap mov ds, ax mov si, offset EB_bm mov bx, ds:[si].B_height mov ax, ds:[si].B_width mov cl,dl clr ch ; cx is the bit count call HugeArrayUnlockDir ; ds is the segment ; determine number of bytes/scanline and number bytes/normalized ; scanline on long boundary call ETDGetScanlineSize mov dx,exportInfo.EBInfo.EBI_scanlineSize add dx,exportInfo.EBInfo.EBI_scanlineDiff mov di,exportInfo.ETDFrame.EDF_DIBFile call ETDSetUpDIBHeader jc done ;error code will be in ax mov exportInfo.EBInfo.EBI_initStripSize, 0 mov exportInfo.EBInfo.EBI_stripSize, bx ; handle in one strip mov cx, exportInfo.ETDFrame.EDF_DIBFile mov bx, exportInfo.ETDFrame.EDF_VMFile mov ax, exportInfo.ETDFrame.EDF_VMBlock ;bx.ax = HugeArray call ETDCBitmapToDIB jc done ; error code in ax mov ax,TE_NO_ERROR done: .leave ret ExportHugeBitmapToDIB endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ExportGStringToDIB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Exports a GString to a DIB metafile format CALLED BY: ExportDIB PASS: bx -VMFile hptr si -VMBlock hptr di -DIBFile (lower word of stream pointer) dl -Bitcount byte RETURN: ax -will be zero if the export was successful otherwise will contain TransError bx: -if ax = TE_CUSTOM will contain handle of error text DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- MS 3/13/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ExportGStringToDIB proc near uses cx,dx,si,di,bp,es,ds exportInfo local ExportInfo .enter ;save input parameters mov exportInfo.ETDFrame.EDF_VMFile,bx mov exportInfo.ETDFrame.EDF_VMBlock,si mov exportInfo.ETDFrame.EDF_DIBFile,di mov exportInfo.ETDFrame.EDF_exportOptions,dl mov cl,GST_VMEM ;cl is the type of handle in bx call GrLoadGString ;returns si = GString Handle ;get the GString bounds so we know what size to make the bitmap clr dx,di ;dx=Control flag,di = GState call GrGetGStringBounds ;si = GString sub cx,ax ;width in pixels mov ax,GSSPT_BEGINNING ;set back to GString beginning call GrSetGStringPos ;need to reset Gstring pos,as this is ;affected by call to GrGetGStringBounds mov ax,cx ;set width in pixels sub dx,bx ;height in pixels mov bx,dx clr ch mov cl,exportInfo.ETDFrame.EDF_exportOptions cmp ax,0 je errorEmpty cmp bx,0 jne continue ;convenient places to put some error stubs, to avoid long jums errorEmpty: mov ax,TE_NOTHING_TO_EXPORT jmp done errorDIB: add sp,2 ;fixup stack pointer to leave jmp done continue: push ax ;save the width of the Bitmap call ETDCalculateStripSizeAndOffset ;set up the DIBBitmap FileHeader and Info structure in the specified DIBFile mov dx,exportInfo.EBInfo.EBI_scanlineSize add dx,exportInfo.EBInfo.EBI_scanlineDiff mov di,exportInfo.ETDFrame.EDF_DIBFile call ETDSetUpDIBHeader jc errorDIB ;error code will be in ax ;Create and open a temp VM File pass bp = IMPEX_TEMP_VM_FILE push bp ;save to access locals segmov es,ss,bx ;stack frame lea di,exportInfo.tempVMFilename mov ax,IMPEX_TEMP_VM_FILE call ImpexCreateTempFile ;es:di = temp filename buffer tst ax ;ret bp = file handle mov bx,bp pop bp jnz errorDIB ;error code in ax ;Create a Bitmap to play GString into push bx ;save VM file handle mov ax,TGIT_THREAD_HANDLE ;get thread handle clr bx ;...for the current thread call ThreadGetInfo ;ax = thread handle mov_tr di,ax ;di = thread handle pop bx ;restore VM file handle call ETDSetBitmapType ;ax = bitmap type pop cx ;cx = width, mov dx,exportInfo.EBInfo.EBI_stripSize;dx = height push bx ;TempVM,bx = VMFile Handle call GrCreateBitmap ;ax=VM BLock- bx.ax = Huge Array Handle push di ;GState push bx,ax ;bx = temp VMB:H ;Set the default text color mapping to dither mov al, ColorMapMode<0, CMT_DITHER> call GrSetTextColorMap ;Play the GString into the Bitmap, and then convert it to a DIB moreBitmap: ;Play the GString into a bitmap mov bx,exportInfo.EBInfo.EBI_yTrans ;x,y = offset to start drawing at clr ax,cx,dx ;dx.cx = x trans( WWF) bx.ax = ytrans call GrApplyTranslation ;move window over bitmap call GrSaveState ;Drawing GString may affect this clr ax,bx,dx ;xtrans call GrDrawGString ;di = GState target,si = Gstring mov ax,GSSPT_BEGINNING ;set back to GString beginning call GrSetGStringPos ;need to reset Gstring pos call GrRestoreState ;restore Gstate ;advance so next strip will be drawn pop bx,ax ;get VMFile:Block cmp dx,GSRT_FAULT ;if GrDrawGString unsuccessful je errorExport push bx,ax ;save Huge array handle ;convert to DIB File mov cx,exportInfo.ETDFrame.EDF_DIBFile call ETDCBitmapToDIB jc cleanup ;loop back up to moreBitmap call GrClearBitmap ;pass di = GState dec exportInfo.EBInfo.EBI_numStrips ;are there any more strips to draw? cmp exportInfo.EBInfo.EBI_numStrips,0 jne moreBitmap ;destroy the temp bitmap, and the VMfile it is in mov ax,TE_NO_ERROR ;successful export operation cleanup: add sp,4 ; pop bx,ax delete: pop di ;gstate handle pop bx ;VMFileHandle call ETDDeleteTempFile jc errorDelete done: .leave ret errorExport: mov ax,TE_EXPORT_ERROR jmp delete errorDelete: mov ax,TE_FILE_ERROR jmp done ExportGStringToDIB endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ExportDIB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Exports a GString to the DIB format. The resulting bitmap is stored in the indicated file CALLED BY: ImpexExportGraphicsConvertToDIBMetafile PASS: bx -VMFile hptr si -VMBlock hptr di -DIBFile (lower word of stream pointer) cx -ClipboardItemFormat( CIF_BITMAP or CIF_GRAPHICS_STRING) dx -Bitcount word ax -maufacturer's ID RETURN: ax -will be zero if the export was successful otherwise will contain TransError bx: -if ax = TE_CUSTOM will contain handle of error text DESTROYED: nothing PSEUDO CODE/STRATEGY: *Lock the block to access ExportFrame *Calculate StripSize and the number of strips: stripsize = num scanlines that fit in 100k block numStrips = num 100k blocks needed to hold bitmap (the idea here is to repeatedly play the Gstring into a VM Bitmap, which is of 100k block size or less,and translate it each time.In this way only 100k of data is produced each time,keeping down the memory allocation, and the window is just moved down the bitmap, in order that the entire bitmap is produced, one chunk at a time.) *Setup the DIB header *Create bitmap in a temp VMFile,setting type as specified in the export options and vertical size stripsize *load the Gstring *For Num Strips: play Gstring into Bitmap write out scanlines to DIB Translate so next chunk of bitmap data will be generated *clean up- destroy VM and Bitmap KNOWN BUGS/SIDE EFFECTS/IDEAS: * the DIB source file stream pointer is passed to the DIB Library in bx. This is actually the low word of the stream pointer, as the high word is always zero. ALL OF THE FOLLOWING DIB ROUTINES DEPEND UPON THIS!!! REVISION HISTORY: Name Date Description ---- ---- ----------- MS 3/12/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ExportDIB proc near .enter ; first check to make sure this is not a 24-bit Export, ; as we do not support that yet cmp dx, 24 je unsupported24bit ; do we recognize the Manufacturer's ID? cmp ax, MANUFACTURER_ID_GEOWORKS jne invalidManufacturerID ; are we being passed a GSTRING or a HUGE BIIMAP ? cmp cx, CIF_BITMAP jne GString call ExportHugeBitmapToDIB jmp done GString: mov ax, TE_EXPORT_INVALID_CLIPBOARD_FORMAT cmp cx, CIF_GRAPHICS_STRING jne done call ExportGStringToDIB done: .leave ret invalidManufacturerID: mov ax, TE_EXPORT_INVALID_CLIPBOARD_FORMAT jmp done unsupported24bit: mov ax, TE_EXPORT_NOT_SUPPORTED jmp done ExportDIB endp ;----------------------------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ETDDeleteTempFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: destroy Temp File and Bitmap in it CALLED BY: ExportDIB PASS: di -handle of GState holding Bitmap bx -VM File RETURN: carry set on error DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- MS 5/ 1/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ETDDeleteTempFile proc near uses ax,ds,dx exportInfo local ExportInfo .enter inherit mov al,BMD_LEAVE_DATA call GrDestroyBitmap mov ax,IMPEX_TEMP_VM_FILE segmov ds,ss,dx lea dx,exportInfo.tempVMFilename call ImpexDeleteTempFile tst ax jz done stc ;an error has occurred in File Delete done: .leave ret ETDDeleteTempFile endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ETDSetBitmapType %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: set the BMType according to the bitcount- will be complex with a palette, unless 24bit CALLED BY: ExportDIB PASS: cx= bitcount RETURN: ax = bitmapType DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- MS 3/23/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ETDSetBitmapType proc near .enter cmp cx,1 jne fourBit mov ax,BMF_MONO or mask BMT_COMPLEX or mask BMT_PALETTE jmp done fourBit: cmp cx,4 jne eightBit mov ax,BMF_4BIT or mask BMT_COMPLEX or mask BMT_PALETTE jmp done eightBit: cmp cx,8 jne twentyFourBit mov ax,BMF_8BIT or mask BMT_COMPLEX or mask BMT_PALETTE jmp done twentyFourBit: mov ax,BMF_24BIT or mask BMT_COMPLEX done: .leave ret ETDSetBitmapType endp ;------------------------------------------------------------------------ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ETDCBitmapToDIB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write out a slice of scanlines into the specified DIB File CALLED BY: ExportDIB PASS: cx: DIB File( lower word of stream pointer) bx.ax -HugeArray Handle RETURN: carry set if error ax = error DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- MS 3/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ETDCBitmapToDIB proc near uses es,bx,cx,dx,si,di,bp exportInfo local ExportInfo .enter inherit EC < push bx,ax EC < mov di,ax EC < call ECCheckHugeArray ;for num scanlines,write to file mov di,ax ;VM Block Handle of HugeArray mov ax,exportInfo.EBInfo.EBI_stripSize mov exportInfo.EBInfo.EBI_yTrans,ax EC < tst ax EC < ERROR_Z EXPORT_DIB_INVALID ;this should NEVER be zero tst exportInfo.EBInfo.EBI_initStripSize jz notFirstStrip mov ax,exportInfo.EBInfo.EBI_initStripSize clr exportInfo.EBInfo.EBI_initStripSize notFirstStrip: dec ax ;process scanline x-1 -> 0 push ax ;save num scanlines in the strip push cx ;save DIB File Handle clr dx ;dx.ax holds scanline desired call HugeArrayLock ;ds:si pointer to scanline ;ax = num after,cx = num before pop bx ;bx is the DIB File,dx = size ;EC < cmp dx,exportInfo.EBInfo.EBI_scanlineSize ;EC < ERROR_NE EXPORT_DIB_INVALID mov di,cx ;di= numb of scanlines before next blk writeScanlineLoop: ; check to see if it is a monochrome bitmap, if so,then we must invert ; it to be consistent with the 0= white, 1= black paradigm cmp exportInfo.ETDFrame.EDF_exportOptions,1 je invertMonochrome writeScanline: mov dx,si ;ds:dx is buffer to read from clr al ;flags=0 mov cx,exportInfo.EBInfo.EBI_scanlineSize call FWrite ;ax = error,cx = numbytes written jc cont ;error in file write mov cx,exportInfo.EBInfo.EBI_scanlineDiff jcxz cont push ds segmov ds,ss ;ds:dx = buffer to read from lea dx,exportInfo.scanBuff clr al ;flags call FWrite ;write out extra bytes pop ds ;restore ds cont: pop cx ;num of scanlines jc errorWrite jcxz done ;any more left? dec cx ;we just read one push cx ;save away num scanlines EC < tst di ;this should NEVER be zero EC < ERROR_Z EXPORT_DIB_INVALID dec di cmp di,0 je nextBlock ;now move to next block sub si,exportInfo.EBInfo.EBI_scanlineSize jmp writeScanlineLoop nextBlock: ;pass ds:si = pointer to element, get pointer to prev call HugeArrayPrev ;ds:di = first element, mov di,ax ;ax = num prev(0 if first),dx = size jmp writeScanlineLoop done: EC < pop bx,di EC < call ECCheckHugeArray call HugeArrayUnlock ;ds = pointer to element block .leave ret invertMonochrome: ; the bitmap is monochrome, so flip all the bits so it will be consistent ; with the 0=white, 1 = black Monochrome bitmap color scheme push si,di,cx segmov es,ds,dx mov di,si mov cx,exportInfo.EBInfo.EBI_scanlineSize mov dl,0xff invertLoop: lodsb xor al,dl stosb loop invertLoop pop si,di,cx jmp writeScanline errorWrite: mov ax,TE_FILE_WRITE jmp done ETDCBitmapToDIB endp ;----------------------------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ETDSetUpDIBHeader %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sets up the DIB FIle Header and DIB info header in the specified file. These structures are as follows: FILEHEADER: DBFH_type BitmapType DBFH_size dword DBFH_reserved dword DBFH_offBit dword INFOHEADER: DBI_size dword DBI_width dword DBI_height dword DBI_planes word DBI_bitCount word DBI_compress dword DBI_isize dword DBI_xRes dword DBI_yRes dword DBI_colorUsed dword DBI_colorImp dword *for more info see dib.def CALLED BY: ExportDIB PASS: di DIB File (lower word of stream pointer) ax -bitmap width bx -bitmap height cx -BitCount dx -ScanlineSize RETURN: ax is error if carry set DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- MS 3/16/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ETDSetUpDIBHeader proc near uses bx,cx,dx,si,di,bp,ds locals local DIBBitmapHeader .enter mov locals.DB_fileHeader.DBFH_type,BITMAP mov locals.DB_info.DBI_width.high,0 mov locals.DB_info.DBI_width.low,ax mov locals.DB_info.DBI_height.high,0 mov locals.DB_info.DBI_height.low,bx mov locals.DB_info.DBI_bitCnt,cx clr ax cmp cx,24 je twFourBit mov ax,1 ;num colors = 2^Bitcount shl ax,cl twFourBit: push ax ;num entries in color table clr cx movdw locals.DB_info.DBI_colorUsed,cxax movdw locals.DB_info.DBI_colorImp,cxax ;num colors important=numUsed shl ax,1 ;ax = size of color table shl ax,1 ;4bytes/entry push ax ;size color table ;add color table size header and info add ax,size DIBBitmapHeader ;data right after hdr & color table movdw locals.DB_fileHeader.DBFH_offBit,cxax mov cx,ax mov ax,dx ;add size of image mul bx movdw locals.DB_info.DBI_iSize,dxax clr bx adddw dxax,bxcx movdw locals.DB_fileHeader.DBFH_size,dxax clr cx movdw locals.DB_fileHeader.DBFH_reserved,bxcx mov locals.DB_info.DBI_size.high,0 mov locals.DB_info.DBI_size.low,size DIBBitmapInfo mov locals.DB_info.DBI_planes,1 movdw locals.DB_info.DBI_compress,bxcx movdw locals.DB_info.DBI_xRes,bxcx movdw locals.DB_info.DBI_yRes,bxcx ;now write the header to the specified DIB File mov bx,di ;file to write to mov cx,size DIBBitmapHeader ;number of bytes to write segmov ds,ss ;write from the local structure lea dx,locals clr al ;so returns errors call FWrite pop dx ;size color table (bytes) pop cx ;num colors in table jc errorWrite ;error will be in ax jcxz done ;24bit,no colortable ;write the palette default palette to the DIBFile call ETDWritePaletteToDIB done: .leave ret errorWrite: mov ax,TE_FILE_WRITE jmp done ETDSetUpDIBHeader endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ETDWritePaletteToDIB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Writes the default Geos color table to the DIB file specified CALLED BY: SetUpDIBHeader PASS: bx -DIBFile (lower word of stream pointer) dx -size color table cx -numEntries RETURN: carry set if error error in ax- DESTROYED: nothing PSEUDO CODE/STRATEGY: -calls GrGetPalette, which will return all 256 RGB triples -Writes out the appropriate number to a DIB File, first converting the triples into DIB RGBQuad format: i.e. RGBQuad{ BYTE rgbBlue; BYTE rgbGreen; BYTE rgbRed; BYTE rgbReserved; } KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- MS 3/18/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ETDWritePaletteToDIB proc near uses bx,cx,dx,si,di,bp,ds,es .enter mov bp,bx ;save DIBFileHandle mov ax,dx ;ax is size to allocate mov si,cx ;cx = numEntries,save in si mov cx,ALLOC_DYNAMIC_LOCK ;cx = HeapFlags and heapAllocFlags call MemAlloc jc errorMem ;ret:bx = handle ax = seg push bx ;ColorTable buffer segmov es,ax ;es:di will be dest clr di ;di =assoc window ; set up assuming will be monochrome ; movdw es:[di], 0x00000000 ; 0 entry is white movdw es:[di+4], 0x00ffffff ; 1 entry is black cmp si,2 ; if monochrome, set by hand je writeTable ; it is not monochrome, so get default palette ; mov al,GPT_DEFAULT call GrGetPalette ;bx = handle to call MemLock ;bx = block to lock,return ax = segment jc errorLock clr di ;es:di is the destination mov cx,si ;num entries segmov ds,ax ;ds points to palette mov si,2 ;ds:si = palette push bx ;save handle to palette clr bh ;for reserved byte writeColorTable: ; moves ds:si->es:di- because these are RGB bytes, and a word is ; loaded and stored, the order will be reversed. ; lodsw ;ax<-GR mov bl,al ;bh = R, ah =G lodsb ;al = B stosw ;stores BG to es:di mov ax,bx ;ax = 0R stosw ;store R0 loop writeColorTable pop bx ;get handle to palette call MemFree ;pass memBlock to unlock in bx writeTable: mov bx,bp ;bx = fileHandle clr al ;al = flags -0 mov cx,dx ;cx= size of colorTable segmov ds,es ;ds:dx = file from which to write clr dx call FWrite ;ax= error,cx = numbytes jc errorWrite pop bx ;get handle to the color table buffer call MemFree ;free this also clc done: .leave ret errorLock: mov ax,TE_EXPORT_ERROR jmp error errorWrite: mov ax,TE_FILE_WRITE error: pop bx ;get handle to the color table buffer call MemFree ;free this also jmp done errorMem: mov ax,TE_EXPORT_ERROR jmp done ETDWritePaletteToDIB endp ;------------------------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ETDGetScanlineSize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Determine the number of bytes per scanline, as well as the number of bytes if the scanline is aligned on a long boundary. This information is stored in the inherited exportInfo CALLED BY: ETDCalculateStripSizeAndOffset PASS: cx -BitCount bx -bitmap height ax -bitmap width RETURN: update exportInfo struct DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- MS 3/13/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ETDGetScanlineSize proc near uses ax,bx,cx,dx exportInfo local ExportInfo .enter inherit mul cx ;(pixels/scanline)*(bits/pixel) mov dx,ax ;save bytes/scanline add ax,7 ;(bits/scanline)+7 mov cl,3 ;div by 8 shr ax,cl ;bytes/scanline mov exportInfo.EBInfo.EBI_scanlineSize,ax add dx,31 ;want to align on long boundary mov cl,5 ;div by 32 shr dx,cl ;bits+31/32 shl dx,1 shl dx,1 ;mult by 4 sub dx,ax ;get difference and set mov exportInfo.EBInfo.EBI_scanlineDiff,dx movdw exportInfo.scanBuff,0 ;make sure buff that you will write ;any additional bytes out from is .leave ret ETDGetScanlineSize endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ETDCalculateStripSizeAndOffset %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: calculates the number of scanlines that will fit into our temporary bitmap (of size DIB_EXPORT_BUFF_SIZE), as well as the offset to translate the bitmap such that any remaining scanlines(remainder of scanlines/(scanlines/block)) will be handled first. The DIB format has the origin at the lower left, and the CBitmap's origin is the upper left, therefore, the last scanline in the DIB is the first one in the bitmap. CALLED BY: ExportDIB PASS: cx -BitCount bx -bitmap height ax -bitmap width RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- MS 3/13/92 Initial version Don 8/04/94 Fixed comparison error & reduced buffer size %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ETDCalculateStripSizeAndOffset proc near uses ax,bx,cx,dx,si,di,bp exportInfo local ExportInfo .enter inherit ;calulate bytes/scanline = ((pixels/scanline)*(bits/pixel)+7)*(byte/8bits) call ETDGetScanlineSize mov cx, exportInfo.EBInfo.EBI_scanlineSize CheckHack <DIB_EXPORT_BUFF_SIZE lt 65536> mov ax, DIB_EXPORT_BUFF_SIZE;rough size of temporary bitmap clr dx div cx ;ax = num scanlines in temporary bitmap cmp ax,bx ;num scans/temp > num/bitmap? jb moreThanOneStrip mov exportInfo.EBInfo.EBI_stripSize,bx mov exportInfo.EBInfo.EBI_numStrips,1 mov exportInfo.EBInfo.EBI_initStripSize,bx mov exportInfo.EBInfo.EBI_yTrans,0 jmp done moreThanOneStrip: mov exportInfo.EBInfo.EBI_stripSize,ax ;set strip size ;now need #blocks/bitmap = (#scanline/bitmap)/( scanlines/block) mov cx,ax ;num scanlines/block mov ax,bx ;(num scanline/bitmap) clr dx ;dxax/cx result in ax, remainder in dx div cx inc ax ;there is at least one mov exportInfo.EBInfo.EBI_numStrips,ax ;set number of strips/bitmap ;numscanlines-remainder = where to translate to tst dx ;is there a remainder? jnz remainder ;yes, set init trans and strip size mov dx,exportInfo.EBInfo.EBI_stripSize ;initial strip and ytrans = strip size mov exportInfo.EBInfo.EBI_initStripSize,dx ;set initial stripSize sub bx,dx ;num scanlines from the end jmp setTrans remainder: ;if dx not zero,initial size is rem mov exportInfo.EBInfo.EBI_initStripSize,dx sub bx,dx ;dx = remainder, setTrans: neg bx ;set the translation mov exportInfo.EBInfo.EBI_yTrans,bx done: .leave ret ETDCalculateStripSizeAndOffset endp ;--------------------------------------------------------------------------- ExportCode ends
kernel/nano_core/src/boot/arch_x86_64/multiboot_header.asm
jacob-earle/Theseus
1,822
12304
<filename>kernel/nano_core/src/boot/arch_x86_64/multiboot_header.asm ; Declare a multiboot2-compliant header, which indicates this program iss a bootable kernel image. ; This must be the first section in the kernel image, which is accomplished via our linker script. ; It must also be aligned to a 4-byte boundary. section .multiboot_header ; Permissions are the same as .rodata by default align 4 multiboot_header_start: dd 0xe85250d6 ; Multiboot2 header magic number dd 0 ; Run in protected i386 (32-bit) mode dd multiboot_header_end - multiboot_header_start ; header length ; checksum dd 0x100000000 - (0xe85250d6 + 0 + (multiboot_header_end - multiboot_header_start)) ; Place optional header tags here, after the checksum above. Documentation is here: ; <https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html#Header-tags> ; Note: all tags must be aligned to 8-byte boundaries. ; Below is the framebuffer tag, used to request a graphical (non-text) framebuffer and specify its size. ; By default, we ask the bootloader to switch modes to a graphical framebuffer for us, ; though this can be disabled by defining `VGA_TEXT_MODE`. ; ; NOTE: TODO: uncomment the below sections when we are ready to enable ; early boot-time usage of the graphical framebuffer by default. ; ; %ifndef VGA_TEXT_MODE ; align 8 ; dw 5 ; type (5 means framebuffer tag) ; dw 0 ; flags. Bit 0 = `1` means this tag is optional, Bit 0 = `0` means it's mandatory. ; dd 20 ; size of this tag (20) ; dd 1280 ; width (in pixels) ; dd 1024 ; height (in pixels) ; dd 32 ; depth (pixel size in bits) ; %endif ; This marks the end of the tag region. align 8 dw 0 ; type (0 means terminator tag) dw 0 ; flags dd 8 ; size of this tag multiboot_header_end:
agda-stdlib/src/Data/Nat/Induction.agda
DreamLinuxer/popl21-artifact
5
9902
------------------------------------------------------------------------ -- The Agda standard library -- -- Various forms of induction for natural numbers ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Nat.Induction where open import Function open import Data.Nat.Base open import Data.Nat.Properties using (≤⇒≤′) open import Data.Product open import Data.Unit open import Induction open import Induction.WellFounded as WF open import Level using (Lift) open import Relation.Binary.PropositionalEquality open import Relation.Unary ------------------------------------------------------------------------ -- Re-export accessability open WF public using (Acc; acc) ------------------------------------------------------------------------ -- Ordinary induction Rec : ∀ ℓ → RecStruct ℕ ℓ ℓ Rec ℓ P zero = Lift ℓ ⊤ Rec ℓ P (suc n) = P n recBuilder : ∀ {ℓ} → RecursorBuilder (Rec ℓ) recBuilder P f zero = _ recBuilder P f (suc n) = f n (recBuilder P f n) rec : ∀ {ℓ} → Recursor (Rec ℓ) rec = build recBuilder ------------------------------------------------------------------------ -- Complete induction CRec : ∀ ℓ → RecStruct ℕ ℓ ℓ CRec ℓ P zero = Lift ℓ ⊤ CRec ℓ P (suc n) = P n × CRec ℓ P n cRecBuilder : ∀ {ℓ} → RecursorBuilder (CRec ℓ) cRecBuilder P f zero = _ cRecBuilder P f (suc n) = f n ih , ih where ih = cRecBuilder P f n cRec : ∀ {ℓ} → Recursor (CRec ℓ) cRec = build cRecBuilder ------------------------------------------------------------------------ -- Complete induction based on _<′_ <′-Rec : ∀ {ℓ} → RecStruct ℕ ℓ ℓ <′-Rec = WfRec _<′_ mutual <′-wellFounded : WellFounded _<′_ <′-wellFounded n = acc (<′-wellFounded′ n) <′-wellFounded′ : ∀ n → <′-Rec (Acc _<′_) n <′-wellFounded′ (suc n) .n ≤′-refl = <′-wellFounded n <′-wellFounded′ (suc n) m (≤′-step m<n) = <′-wellFounded′ n m m<n module _ {ℓ} where open WF.All <′-wellFounded ℓ public renaming ( wfRecBuilder to <′-recBuilder ; wfRec to <′-rec ) hiding (wfRec-builder) ------------------------------------------------------------------------ -- Complete induction based on _<_ <-Rec : ∀ {ℓ} → RecStruct ℕ ℓ ℓ <-Rec = WfRec _<_ <-wellFounded : WellFounded _<_ <-wellFounded = Subrelation.wellFounded ≤⇒≤′ <′-wellFounded module _ {ℓ} where open WF.All <-wellFounded ℓ public renaming ( wfRecBuilder to <-recBuilder ; wfRec to <-rec ) hiding (wfRec-builder) ------------------------------------------------------------------------ -- DEPRECATED NAMES ------------------------------------------------------------------------ -- Please use the new names as continuing support for the old names is -- not guaranteed. -- Version 0.15 rec-builder = recBuilder {-# WARNING_ON_USAGE rec-builder "Warning: rec-builder was deprecated in v0.15. Please use recBuilder instead." #-} cRec-builder = cRecBuilder {-# WARNING_ON_USAGE cRec-builder "Warning: cRec-builder was deprecated in v0.15. Please use cRecBuilder instead." #-} <′-rec-builder = <′-recBuilder {-# WARNING_ON_USAGE <′-rec-builder "Warning: <′-rec-builder was deprecated in v0.15. Please use <′-recBuilder instead." #-} <-rec-builder = <-recBuilder {-# WARNING_ON_USAGE <-rec-builder "Warning: <-rec-builder was deprecated in v0.15. Please use <-recBuilder instead." #-} <′-well-founded = <′-wellFounded {-# WARNING_ON_USAGE <′-well-founded "Warning: <′-well-founded was deprecated in v0.15. Please use <′-wellFounded instead." #-} <′-well-founded′ = <′-wellFounded′ {-# WARNING_ON_USAGE <′-well-founded′ "Warning: <′-well-founded′ was deprecated in v0.15. Please use <′-wellFounded′ instead." #-} <-well-founded = <-wellFounded {-# WARNING_ON_USAGE <-well-founded "Warning: <-well-founded was deprecated in v0.15. Please use <-wellFounded instead." #-}
programs/oeis/191/A191404.asm
jmorken/loda
1
99868
; A191404: A000201(n)+A000201(n+3). ; 4,7,11,13,17,20,23,27,29,33,37,39,43,46,49,53,55,59,62,65,69,71,75,79,81,85,88,91,95,97,101,105,107,111,114,117,121,123,127,130,133,137,139,143,147,149,153,156,159,163,165,169,172,175,179,181,185,189,191,195,198,201,205,207,211,215,217,221,224,227 mov $1,$0 mov $5,$0 lpb $1 lpb $0 mov $2,$1 cal $2,60145 ; a(n) = floor(n/tau) - floor(n/(1 + tau)). mov $0,$2 add $0,1 add $1,3 lpe mov $1,2 lpe mov $4,$0 cmp $4,0 add $0,$4 mov $1,$0 add $1,3 mov $3,$5 mul $3,3 add $1,$3
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/loop_optimization14_pkg.ads
best08618/asylo
7
25232
package Loop_Optimization14_Pkg is procedure Proc (B : in out Boolean); end Loop_Optimization14_Pkg;
MailArchiver.scpt
Matsuo3rd/mac-mail-archiver
0
1137
# Account source archive property archiveAccount : "PROS" # Mailbox target archive root property archiveMailbox : "PROS Archive" # Archive Months timewindow property archiveMonthsTimeWindow : 12 # Prevent same-day archiving process property preventSameDayArchiving : true # Log file name property logFile : "EmailArchiver.log" set userLocale to user locale of (system info) if userLocale is "fr_FR" then set notificationMsg to " messages archivés" set notificationTitle to "Emails Archiver" set notificationCompletedSubtitle to "Archivage terminé" set ignoreTheseMailboxes to {"Suivis", "Brouillons", "Messages envoyés", "Corbeille", "Spam", "Historique des conversations", "Journal", "Archive", "Tâches", "Notes", "Boîte d'envoi", "Éléments envoyés", "Éléments supprimés", "Courrier indésirable"} else set notificationMsg to " messages archived" set notificationTitle to "Emails Archiver" set notificationCompletedSubtitle to "Processing is complete" set ignoreTheseMailboxes to {"all mail", "archive", "archived", "drafts", "junk", "junk e-mail", "sent", "sent items", "sent messages", "spam"} end if set archiveDateReference to addMonths onto (current date) by -archiveMonthsTimeWindow property lastRunTime : missing value if (preventSameDayArchiving is true and lastRunTime is not missing value) and (my dateFormatYYYYMMDD(current date) is equal to my dateFormatYYYYMMDD(lastRunTime)) then my logToFile("Emails archiving already executed today") error number -128 end if display notification "Emails archiving started" with title notificationTitle my logToFile("Emails archiving started") #https://superuser.com/questions/33177/apple-mail-doesnt-apply-rules-unless-i-choose-apply-rules-manually tell application "Mail" try set movedMsgCount to 0 set theMailboxes to every mailbox of account archiveAccount repeat with eachMailbox in theMailboxes try if ignoreTheseMailboxes does not contain name of eachMailbox then my logToFile("Scanning Mailbox \"" & name of eachMailbox & "\"") set messagesToArchive to (every message of eachMailbox whose date received ≤ archiveDateReference) if (count of messagesToArchive) > 0 then set mailboxMovedMsgCount to 0 # Map mailbox hierarchy set parentList to {} set nextContainer to eachMailbox repeat set the beginning of parentList to (name of nextContainer) set nextContainer to container of nextContainer if (class of nextContainer is not container) then exit repeat end if end repeat set sourceMailbox to my convertListToString(parentList, "/") set the beginning of parentList to (archiveMailbox) set targetMailbox to my convertListToString(parentList, "/") # Appends / to mailbox end -see https://discussions.apple.com/thread/7330780 make new mailbox with properties {name:targetMailbox & "/"} repeat with messageToArchive in messagesToArchive move messageToArchive to mailbox targetMailbox #my logToFile("Message \"" & subject of messageToArchive & "\" moved to mailbox \"" & (name of mailbox of messageToArchive) & "\"") set mailboxMovedMsgCount to mailboxMovedMsgCount + 1 end repeat my logToFile("Scanning Mailbox \"" & sourceMailbox & "\" completed. " & (mailboxMovedMsgCount as string) & " messages moved") set movedMsgCount to movedMsgCount + mailboxMovedMsgCount end if else my logToFile("Scanning Mailbox \"" & name of eachMailbox & "\" ignored") end if on error errStr number errorNumber display notification errStr & " " & errorNumber my logToFile(errStr & " " & errorNumber) end try end repeat set lastRunTime to (current date) display notification (movedMsgCount as string) & " " & notificationMsg with title notificationTitle subtitle notificationCompletedSubtitle my logToFile("Emails archiving completed: " & (movedMsgCount as string) & " messages archived") on error errStr number errorNumber display notification errStr & " " & errorNumber my logToFile(errStr & " " & errorNumber) end try end tell on logToFile(logData) #log (logData) set d to (get current date) set logData to d & " " & logData set the logPath to ((path to library folder from user domain) as string) & "Logs:" & logFile try set the openFile to open for access file logPath with write permission write (logData as string) & linefeed to the openFile starting at eof as «class utf8» close access the openFile return true on error try close access file logPath end try return false end try end logToFile on convertListToString(theList, theDelimiter) set AppleScript's text item delimiters to theDelimiter set theString to theList as string set AppleScript's text item delimiters to "" return theString end convertListToString # from https://macscripter.net/viewtopic.php?id=24737 on addMonths onto oldDate by m -- returns a date copy oldDate to newDate -- Convert the month-offset parameter to years and months set {y, m} to {m div 12, m mod 12} -- If the month offset is negative (-1 to -11), make it positive from a year previously if m < 0 then set {y, m} to {y - 1, m + 12} -- Add the year offset into the new date's year set newDate's year to (newDate's year) + y -- Add the odd months (at 32 days per month) and set the day if m is not 0 then tell newDate to set {day, day} to {32 * m, day} -- If the day's now wrong, it doesn't exist in the target month -- Subtract the overflow into the following month to return to the last day of the target month if newDate's day is not oldDate's day then set newDate to newDate - (newDate's day) * days return newDate end addMonths on dateFormatYYYYMMDD(old_date) set {year:y, month:m, day:d} to old_date set ymd to (y * 10000 + m * 100 + d) as string set new_date to (text items 1 thru 4 of ymd as string) & (text items 5 thru 6 of ymd as string) & (text items 7 thru 8 of ymd as string) return new_date end dateFormatYYYYMMDD
programs/oeis/295/A295905.asm
karttu/loda
1
1856
; A295905: Number of (not necessarily maximum) cliques in the n X n knight graph. ; 2,5,18,41,74,117,170,233,306,389,482,585,698,821,954,1097,1250,1413,1586,1769,1962,2165,2378,2601,2834,3077,3330,3593,3866,4149,4442,4745,5058,5381,5714,6057,6410,6773,7146,7529,7922,8325,8738,9161,9594,10037,10490,10953 mov $1,$0 mul $0,5 sub $0,2 mul $1,$0 add $1,2
add-2-sets.asm
AustinZuniga/Assembly-Addition-of-2-sets
0
170109
stseg segment db 32 dup(?) stseg ends ;---------------- dtseg segment org 0020h data_in db 10d,20d,15d,25d,30d org 0030h data_in2 db 11d,12d,17d,18d,19d org 0040h sum db ? dtseg ends ;---------------- cdseg segment main proc far assume cs:cdseg, ds:dtseg, ss:stseg mov ax,dtseg mov ds,ax mov si,offset data_in mov di,offset data_in2 mov cx,06 mov dl,00 mov_loop: mov al,[si] mov bl,[di] add al,bl add dl,al mov sum,dl inc si inc di dec cx jnz mov_loop mov ah,4ch int 21h main endp cdseg ends end main
line_stuff.ads
ddugovic/words
4
5569
with TEXT_IO; with INFLECTIONS_PACKAGE; use INFLECTIONS_PACKAGE; with DICTIONARY_PACKAGE; use DICTIONARY_PACKAGE; with ADDONS_PACKAGE; use ADDONS_PACKAGE; with UNIQUES_PACKAGE; use UNIQUES_PACKAGE; package LINE_STUFF is use TEXT_IO; type DICTIONARY_ITEM; type DICTIONARY_LIST is access DICTIONARY_ITEM; type DICTIONARY_ITEM is record DE : DICTIONARY_ENTRY := NULL_DICTIONARY_ENTRY; SUCC : DICTIONARY_LIST; end record; type DICTIONARY is array (CHARACTER) of DICTIONARY_LIST; NULL_DICTIONARY : DICTIONARY := (others => null); --DICT, UNIQUES, QUES : DICTIONARY := NULL_DICTIONARY; DICT, UNIQUES : DICTIONARY := NULL_DICTIONARY; DICT_LOC : DICTIONARY := NULL_DICTIONARY; type TACKON_LINE is record POFS : PART_OF_SPEECH_TYPE := TACKON; TACK : STEM_TYPE := NULL_STEM_TYPE; ENTR : TACKON_ENTRY := NULL_TACKON_ENTRY; MEAN : MEANING_TYPE := NULL_MEANING_TYPE; end record; NULL_TACKON_LINE : TACKON_LINE; package TACKON_LINE_IO is DEFAULT_WIDTH : NATURAL; procedure GET(F : in FILE_TYPE; P : out TACKON_LINE); procedure GET(P : out TACKON_LINE); procedure PUT(F : in FILE_TYPE; P : in TACKON_LINE); procedure PUT(P : in TACKON_LINE); procedure GET(S : in STRING; P : out TACKON_LINE; LAST : out INTEGER); procedure PUT(S : out STRING; P : in TACKON_LINE); end TACKON_LINE_IO; type PREFIX_LINE is record POFS : PART_OF_SPEECH_TYPE := PREFIX; FIX : FIX_TYPE := NULL_FIX_TYPE; CONNECT : CHARACTER := ' '; ENTR : PREFIX_ENTRY := NULL_PREFIX_ENTRY; MEAN : MEANING_TYPE := NULL_MEANING_TYPE; end record; NULL_PREFIX_LINE : PREFIX_LINE; package PREFIX_LINE_IO is DEFAULT_WIDTH : NATURAL; procedure GET(F : in FILE_TYPE; P : out PREFIX_LINE); procedure GET(P : out PREFIX_LINE); procedure PUT(F : in FILE_TYPE; P : in PREFIX_LINE); procedure PUT(P : in PREFIX_LINE); procedure GET(S : in STRING; P : out PREFIX_LINE; LAST : out INTEGER); procedure PUT(S : out STRING; P : in PREFIX_LINE); end PREFIX_LINE_IO; type SUFFIX_LINE is record POFS : PART_OF_SPEECH_TYPE := SUFFIX; FIX : FIX_TYPE := NULL_FIX_TYPE; CONNECT : CHARACTER := ' '; ENTR : SUFFIX_ENTRY := NULL_SUFFIX_ENTRY; MEAN : MEANING_TYPE := NULL_MEANING_TYPE; end record; NULL_SUFFIX_LINE : SUFFIX_LINE; package SUFFIX_LINE_IO is DEFAULT_WIDTH : NATURAL; procedure GET(F : in FILE_TYPE; P : out SUFFIX_LINE); procedure GET(P : out SUFFIX_LINE); procedure PUT(F : in FILE_TYPE; P : in SUFFIX_LINE); procedure PUT(P : in SUFFIX_LINE); procedure GET(S : in STRING; P : out SUFFIX_LINE; LAST : out INTEGER); procedure PUT(S : out STRING; P : in SUFFIX_LINE); end SUFFIX_LINE_IO; type UNIQUE_ENTRY is record STEM : STEM_TYPE := NULL_STEM_TYPE; QUAL : QUALITY_RECORD := NULL_QUALITY_RECORD; KIND : KIND_ENTRY := NULL_KIND_ENTRY; TRAN : TRANSLATION_RECORD := NULL_TRANSLATION_RECORD; end record; package UNIQUE_ENTRY_IO is DEFAULT_WIDTH : FIELD; procedure GET(F : in FILE_TYPE; P : out UNIQUE_ENTRY); procedure GET(P : out UNIQUE_ENTRY); procedure PUT(F : in FILE_TYPE; P : in UNIQUE_ENTRY); procedure PUT(P : in UNIQUE_ENTRY); procedure GET(S : in STRING; P : out UNIQUE_ENTRY; LAST : out INTEGER); procedure PUT(S : out STRING; P : in UNIQUE_ENTRY); end UNIQUE_ENTRY_IO; procedure LOAD_STEM_FILE(D_K : DICTIONARY_KIND); procedure LOAD_DICTIONARY(DICT : in out DICTIONARY; DICTIONARY_FILE_NAME : STRING); procedure LOAD_UNIQUES(UNQ : in out LATIN_UNIQUES; FILE_NAME : in STRING); end LINE_STUFF;
VM-unlucky-ram-upgrade/artur-augustyniak/3_stack_pivotish.asm
foralost/zrozumiec-programowanie-cwiczenia
29
18822
%include "vm.inc" vpop r0 vpop r0 vpop r0 vpop r0 ; vm inicjalnie ma sp ustawiony na self.sp.v = 0x10000 vpop r0 ; wykonujac n * vpop możemy przesunac sie w zakres niedostepny via jmp/call vpop r0 ; $ python -c "print hex(0x10000 + n * 4)" ; jesli n == 6 to sp = 0x10018 vset r0, 0xff vpush r0 ; umieszczam na stosie dowolny kod, demonstracyjnie opcode voff vset r1, 0x10014 vpush r1 ; umieszczam na stosie adres opcode'u wstawionego wyzej vret ; vret zdejmuje ze stosu adres jego 'wykonywalnej czesci'
scripts/lab4.asm
etdv-thevoid/pokemon-rgb-enhanced
1
101506
Lab4Script: jp EnableAutoTextBoxDrawing Lab4TextPointers: dw Lab4Text1 dw Lab4Text2 Lab4Script_GetFossilsInBag: ; construct a list of all fossils in the player's bag xor a ld [wFilteredBagItemsCount], a ld de, wFilteredBagItems ld hl, FossilsList .loop ld a, [hli] and a jr z, .done push hl push de ld [wd11e], a ld b, a predef GetQuantityOfItemInBag pop de pop hl ld a, b and a jr z, .loop ; A fossil's in the bag ld a, [wd11e] ld [de], a inc de push hl ld hl, wFilteredBagItemsCount inc [hl] pop hl jr .loop .done ld a, $ff ld [de], a ret FossilsList: db DOME_FOSSIL db HELIX_FOSSIL db OLD_AMBER db $00 Lab4Text1: TX_ASM CheckEvent EVENT_GAVE_FOSSIL_TO_LAB jr nz, .asm_75d96 ld hl, Lab4Text_75dc6 call PrintText call Lab4Script_GetFossilsInBag ld a, [wFilteredBagItemsCount] and a jr z, .asm_75d8d callba GiveFossilToCinnabarLab jr .asm_75d93 .asm_75d8d ld hl, Lab4Text_75dcb call PrintText .asm_75d93 jp TextScriptEnd .asm_75d96 CheckEventAfterBranchReuseA EVENT_LAB_STILL_REVIVING_FOSSIL, EVENT_GAVE_FOSSIL_TO_LAB jr z, .asm_75da2 ld hl, Lab4Text_75dd0 call PrintText jr .asm_75d93 .asm_75da2 call LoadFossilItemAndMonNameBank1D ld hl, Lab4Text_75dd5 call PrintText SetEvent EVENT_LAB_HANDING_OVER_FOSSIL_MON ld a, [wFossilMon] ld b, a ld c, 5 call GivePokemon jr nc, .asm_75d93 ResetEvents EVENT_GAVE_FOSSIL_TO_LAB, EVENT_LAB_STILL_REVIVING_FOSSIL, EVENT_LAB_HANDING_OVER_FOSSIL_MON jr .asm_75d93 Lab4Text_75dc6: TX_FAR _Lab4Text_75dc6 db "@" Lab4Text_75dcb: TX_FAR _Lab4Text_75dcb db "@" Lab4Text_75dd0: TX_FAR _Lab4Text_75dd0 db "@" Lab4Text_75dd5: TX_FAR _Lab4Text_75dd5 db "@" Lab4Text2: TX_ASM ld a, $3 ld [wWhichTrade], a predef DoInGameTradeDialogue jp TextScriptEnd LoadFossilItemAndMonNameBank1D: jpba LoadFossilItemAndMonName
projects/08/FunctionCalls/StaticsTest/StaticsTest.asm
WuShaoa/Nand2Tetris
0
163597
<filename>projects/08/FunctionCalls/StaticsTest/StaticsTest.asm<gh_stars>0 @256 D=A @SP M=D @__Sys.init$return1__ D=A @SP A=M M=D @SP M=M+1 @LCL D=M @SP A=M M=D @SP M=M+1 @ARG D=M @SP A=M M=D @SP M=M+1 @THIS D=M @SP A=M M=D @SP M=M+1 @THAT D=M @SP A=M M=D @SP M=M+1 @SP D=M @0 D=D-A @5 D=D-A @ARG M=D @SP D=M @LCL M=D @Sys.init 0;JMP (__Sys.init$return1__) (Class1.set) @ARG D=M @0 A=D+A D=M @SP A=M M=D @SP M=M+1 @Class1.0 D=A @R15 M=D @SP M=M-1 A=M D=M @R15 A=M M=D @ARG D=M @1 A=D+A D=M @SP A=M M=D @SP M=M+1 @Class1.1 D=A @R15 M=D @SP M=M-1 A=M D=M @R15 A=M M=D @0 D=A @SP A=M M=D @SP M=M+1 @LCL D=M @R14 M=D @5 A=D-A D=M @R15 M=D @SP M=M-1 A=M D=M @ARG A=M M=D @ARG D=M+1 @SP M=D @R14 D=M @1 A=D-A D=M @THAT M=D @R14 D=M @2 A=D-A D=M @THIS M=D @R14 D=M @3 A=D-A D=M @ARG M=D @R14 D=M @4 A=D-A D=M @LCL M=D @R15 A=M 0;JMP (Class1.get) @Class1.0 D=M @SP A=M M=D @SP M=M+1 @Class1.1 D=M @SP A=M M=D @SP M=M+1 @SP M=M-1 A=M D=M @SP M=M-1 A=M D=M-D @SP A=M M=D @SP M=M+1 @LCL D=M @R14 M=D @5 A=D-A D=M @R15 M=D @SP M=M-1 A=M D=M @ARG A=M M=D @ARG D=M+1 @SP M=D @R14 D=M @1 A=D-A D=M @THAT M=D @R14 D=M @2 A=D-A D=M @THIS M=D @R14 D=M @3 A=D-A D=M @ARG M=D @R14 D=M @4 A=D-A D=M @LCL M=D @R15 A=M 0;JMP (Class2.set) @ARG D=M @0 A=D+A D=M @SP A=M M=D @SP M=M+1 @Class2.0 D=A @R15 M=D @SP M=M-1 A=M D=M @R15 A=M M=D @ARG D=M @1 A=D+A D=M @SP A=M M=D @SP M=M+1 @Class2.1 D=A @R15 M=D @SP M=M-1 A=M D=M @R15 A=M M=D @0 D=A @SP A=M M=D @SP M=M+1 @LCL D=M @R14 M=D @5 A=D-A D=M @R15 M=D @SP M=M-1 A=M D=M @ARG A=M M=D @ARG D=M+1 @SP M=D @R14 D=M @1 A=D-A D=M @THAT M=D @R14 D=M @2 A=D-A D=M @THIS M=D @R14 D=M @3 A=D-A D=M @ARG M=D @R14 D=M @4 A=D-A D=M @LCL M=D @R15 A=M 0;JMP (Class2.get) @Class2.0 D=M @SP A=M M=D @SP M=M+1 @Class2.1 D=M @SP A=M M=D @SP M=M+1 @SP M=M-1 A=M D=M @SP M=M-1 A=M D=M-D @SP A=M M=D @SP M=M+1 @LCL D=M @R14 M=D @5 A=D-A D=M @R15 M=D @SP M=M-1 A=M D=M @ARG A=M M=D @ARG D=M+1 @SP M=D @R14 D=M @1 A=D-A D=M @THAT M=D @R14 D=M @2 A=D-A D=M @THIS M=D @R14 D=M @3 A=D-A D=M @ARG M=D @R14 D=M @4 A=D-A D=M @LCL M=D @R15 A=M 0;JMP (Sys.init) @6 D=A @SP A=M M=D @SP M=M+1 @8 D=A @SP A=M M=D @SP M=M+1 @__Class1.set$return2__ D=A @SP A=M M=D @SP M=M+1 @LCL D=M @SP A=M M=D @SP M=M+1 @ARG D=M @SP A=M M=D @SP M=M+1 @THIS D=M @SP A=M M=D @SP M=M+1 @THAT D=M @SP A=M M=D @SP M=M+1 @SP D=M @2 D=D-A @5 D=D-A @ARG M=D @SP D=M @LCL M=D @Class1.set 0;JMP (__Class1.set$return2__) @5 D=A @R15 M=D @SP M=M-1 A=M D=M @R15 A=M M=D @23 D=A @SP A=M M=D @SP M=M+1 @15 D=A @SP A=M M=D @SP M=M+1 @__Class2.set$return3__ D=A @SP A=M M=D @SP M=M+1 @LCL D=M @SP A=M M=D @SP M=M+1 @ARG D=M @SP A=M M=D @SP M=M+1 @THIS D=M @SP A=M M=D @SP M=M+1 @THAT D=M @SP A=M M=D @SP M=M+1 @SP D=M @2 D=D-A @5 D=D-A @ARG M=D @SP D=M @LCL M=D @Class2.set 0;JMP (__Class2.set$return3__) @5 D=A @R15 M=D @SP M=M-1 A=M D=M @R15 A=M M=D @__Class1.get$return4__ D=A @SP A=M M=D @SP M=M+1 @LCL D=M @SP A=M M=D @SP M=M+1 @ARG D=M @SP A=M M=D @SP M=M+1 @THIS D=M @SP A=M M=D @SP M=M+1 @THAT D=M @SP A=M M=D @SP M=M+1 @SP D=M @0 D=D-A @5 D=D-A @ARG M=D @SP D=M @LCL M=D @Class1.get 0;JMP (__Class1.get$return4__) @__Class2.get$return5__ D=A @SP A=M M=D @SP M=M+1 @LCL D=M @SP A=M M=D @SP M=M+1 @ARG D=M @SP A=M M=D @SP M=M+1 @THIS D=M @SP A=M M=D @SP M=M+1 @THAT D=M @SP A=M M=D @SP M=M+1 @SP D=M @0 D=D-A @5 D=D-A @ARG M=D @SP D=M @LCL M=D @Class2.get 0;JMP (__Class2.get$return5__) (Sys.init$WHILE) @Sys.init$WHILE 0;JMP
examples/TT.agda
asr/agda-kanso
1
2297
{-# OPTIONS --allow-unsolved-metas --no-termination-check #-} module TT where module Prelude where -- Props ------------------------------------------------------------------ data True : Set where tt : True data False : Set where postulate falseE : (A : Set) -> False -> A infix 3 _/\_ data _/\_ (P Q : Set) : Set where andI : P -> Q -> P /\ Q -- Zero and One ----------------------------------------------------------- data Zero : Set where data One : Set where unit : One -- Natural numbers -------------------------------------------------------- data Nat : Set where zero : Nat suc : Nat -> Nat _+_ : Nat -> Nat -> Nat zero + m = m suc n + m = suc (n + m) module NatEq where infix 5 _==_ _==_ : Nat -> Nat -> Set zero == zero = True suc n == suc m = n == m _ == _ = False rewriteEq : (C : Nat -> Set){m n : Nat} -> m == n -> C n -> C m rewriteEq C {zero} {zero} _ x = x rewriteEq C {suc _} {suc _} eq x = rewriteEq (\z -> C (suc z)) eq x rewriteEq C {zero} {suc _} () _ rewriteEq C {suc _} {zero} () _ module Chain {A : Set}(_==_ : A -> A -> Set) (_trans_ : {x y z : A} -> x == y -> y == z -> x == z) where infixl 4 _=-=_ infixl 4 _===_ infixr 8 _since_ _=-=_ : (x : A){y : A} -> x == y -> x == y x =-= xy = xy _===_ : {x y z : A} -> x == y -> y == z -> x == z xy === yz = xy trans yz _since_ : {x : A}(y : A) -> x == y -> x == y y since xy = xy module Fin where open Prelude -- Finite sets ------------------------------------------------------------ data Suc (A : Set) : Set where fzero' : Suc A fsuc' : A -> Suc A mutual data Fin (n : Nat) : Set where finI : Fin' n -> Fin n Fin' : Nat -> Set Fin' zero = Zero Fin' (suc n) = Suc (Fin n) fzero : {n : Nat} -> Fin (suc n) fzero = finI fzero' fsuc : {n : Nat} -> Fin n -> Fin (suc n) fsuc i = finI (fsuc' i) finE : {n : Nat} -> Fin n -> Fin' n finE (finI i) = i module FinEq where infix 5 _==_ _==_ : {n : Nat} -> Fin n -> Fin n -> Set _==_ {suc _} (finI fzero' ) (finI fzero' ) = True _==_ {suc _} (finI (fsuc' i)) (finI (fsuc' j)) = i == j _==_ _ _ = False rewriteEq : {n : Nat}(C : Fin n -> Set){i j : Fin n} -> i == j -> C j -> C i rewriteEq {suc _} C {finI fzero' } {finI fzero' } eq x = x rewriteEq {suc _} C {finI (fsuc' i)} {finI (fsuc' j)} eq x = rewriteEq (\z -> C (fsuc z)) eq x rewriteEq {suc _} C {finI (fsuc' _)} {finI fzero' } () _ rewriteEq {suc _} C {finI fzero' } {finI (fsuc' _)} () _ rewriteEq {zero} C {finI ()} {_} _ _ module Vec where open Prelude open Fin infixr 15 _::_ -- Vectors ---------------------------------------------------------------- data Nil : Set where nil' : Nil data Cons (A As : Set) : Set where cons' : A -> As -> Cons A As mutual data Vec (A : Set)(n : Nat) : Set where vecI : Vec' A n -> Vec A n Vec' : Set -> Nat -> Set Vec' A zero = Nil Vec' A (suc n) = Cons A (Vec A n) nil : {A : Set} -> Vec A zero nil = vecI nil' _::_ : {A : Set}{n : Nat} -> A -> Vec A n -> Vec A (suc n) x :: xs = vecI (cons' x xs) vecE : {A : Set}{n : Nat} -> Vec A n -> Vec' A n vecE (vecI xs) = xs vec : {A : Set}(n : Nat) -> A -> Vec A n vec zero _ = nil vec (suc n) x = x :: vec n x map : {n : Nat}{A B : Set} -> (A -> B) -> Vec A n -> Vec B n map {zero} f (vecI nil') = nil map {suc n} f (vecI (cons' x xs)) = f x :: map f xs _!_ : {n : Nat}{A : Set} -> Vec A n -> Fin n -> A _!_ {zero } _ (finI ()) _!_ {suc n} (vecI (cons' x _ )) (finI fzero') = x _!_ {suc n} (vecI (cons' _ xs)) (finI (fsuc' i)) = xs ! i tabulate : {n : Nat}{A : Set} -> (Fin n -> A) -> Vec A n tabulate {zero} f = nil tabulate {suc n} f = f fzero :: tabulate (\x -> f (fsuc x)) module Untyped where open Prelude open Fin open Vec Name = Nat data Expr (n : Nat) : Set where eVar : Fin n -> Expr n eApp : Expr n -> Expr n -> Expr n eLam : Expr (suc n) -> Expr n eSet : Expr n eEl : Expr n ePi : Expr n eCon : Name -> Expr n module ExprEq where infix 5 _==_ _==_ : {n : Nat} -> Expr n -> Expr n -> Set eVar i == eVar j = FinEq._==_ i j eApp e1 e2 == eApp e3 e4 = e1 == e3 /\ e2 == e4 eLam e1 == eLam e2 = e1 == e2 eSet == eSet = True eEl == eEl = True ePi == ePi = True eCon f == eCon g = NatEq._==_ f g _ == _ = False rewriteEq : {n : Nat}(C : Expr n -> Set){r s : Expr n} -> r == s -> C s -> C r rewriteEq C {eVar i } {eVar j } eq x = FinEq.rewriteEq (\z -> C (eVar z)) eq x rewriteEq C {eLam e1 } {eLam e2 } eq x = rewriteEq (\z -> C (eLam z)) eq x rewriteEq C {eSet } {eSet } eq x = x rewriteEq C {eEl } {eEl } eq x = x rewriteEq C {ePi } {ePi } eq x = x rewriteEq C {eCon f } {eCon g } eq x = NatEq.rewriteEq (\z -> C (eCon z)) eq x rewriteEq C {eApp e1 e2} {eApp e3 e4} (andI eq13 eq24) x = rewriteEq (\z -> C (eApp z e2)) eq13 ( rewriteEq (\z -> C (eApp e3 z)) eq24 x ) rewriteEq C {eVar _} {eLam _ } () _ rewriteEq C {eVar _} {eSet } () _ rewriteEq C {eVar _} {eEl } () _ rewriteEq C {eVar _} {eCon _ } () _ rewriteEq C {eVar _} {ePi } () _ rewriteEq C {eVar _} {eApp _ _} () _ rewriteEq C {eLam _} {eVar _ } () _ rewriteEq C {eLam _} {eSet } () _ rewriteEq C {eLam _} {eEl } () _ rewriteEq C {eLam _} {eCon _ } () _ rewriteEq C {eLam _} {ePi } () _ rewriteEq C {eLam _} {eApp _ _} () _ rewriteEq C {eSet } {eLam _ } () _ rewriteEq C {eSet } {eVar _ } () _ rewriteEq C {eSet } {eEl } () _ rewriteEq C {eSet } {eCon _ } () _ rewriteEq C {eSet } {ePi } () _ rewriteEq C {eSet } {eApp _ _} () _ rewriteEq C {eEl } {eLam _ } () _ rewriteEq C {eEl } {eSet } () _ rewriteEq C {eEl } {eVar _ } () _ rewriteEq C {eEl } {eCon _ } () _ rewriteEq C {eEl } {ePi } () _ rewriteEq C {eEl } {eApp _ _} () _ rewriteEq C {eCon _} {eLam _ } () _ rewriteEq C {eCon _} {eSet } () _ rewriteEq C {eCon _} {eEl } () _ rewriteEq C {eCon _} {eVar _ } () _ rewriteEq C {eCon _} {ePi } () _ rewriteEq C {eCon _} {eApp _ _} () _ rewriteEq C {ePi } {eLam _ } () _ rewriteEq C {ePi } {eSet } () _ rewriteEq C {ePi } {eEl } () _ rewriteEq C {ePi } {eCon _ } () _ rewriteEq C {ePi } {eVar _ } () _ rewriteEq C {ePi } {eApp _ _} () _ rewriteEq C {eApp _ _} {eLam _ } () _ rewriteEq C {eApp _ _} {eSet } () _ rewriteEq C {eApp _ _} {eEl } () _ rewriteEq C {eApp _ _} {eCon _ } () _ rewriteEq C {eApp _ _} {ePi } () _ rewriteEq C {eApp _ _} {eVar _ } () _ module Typed where open Prelude open Fin open Vec infixl 15 _&_ infix 13 _!!_ infix 5 _==_ -- Contexts --------------------------------------------------------------- data CSuc (n : Nat) : Set Context' : Nat -> Set Context' zero = Nil Context' (suc n) = CSuc n data Context (n : Nat) : Set data Type {n : Nat}(Γ : Context n) : Set data CSuc n where ext : (Γ : Context n) -> Type Γ -> Context' (suc n) data Context n where ctxI : Context' n -> Context n -- Types ------------------------------------------------------------------ _&_ : {n : Nat}(Γ : Context n) -> Type Γ -> Context (suc n) data Term {n : Nat}(Γ : Context n)(A : Type Γ) : Set data Type {n} Γ where SET : Type Γ Pi : (A : Type Γ) -> Type (Γ & A) -> Type Γ El : Term Γ SET -> Type Γ Γ & A = ctxI (ext Γ A) -- Variables -------------------------------------------------------------- data VarSuc {n : Nat}(Γ : Context n)(B : Type Γ)(A : Type (Γ & B)) : Set Var' : {n : Nat}(Γ : Context n) -> Type Γ -> Set Var' {zero} Γ A = Zero Var' {suc n} (ctxI (ext Γ B)) A = VarSuc Γ B A _==_ : {n : Nat}{Γ : Context n} -> Type Γ -> Type Γ -> Set data Ren {n m : Nat}(Γ : Context n)(Δ : Context m) : Set rename : {n m : Nat}{Γ : Context n}{Δ : Context m} -> Ren Γ Δ -> Type Γ -> Type Δ upR : {n : Nat}{Γ : Context n}{A : Type Γ} -> Ren Γ (Γ & A) data Var {n : Nat}(Γ : Context n)(A : Type Γ) : Set data VarSuc {n} Γ B A where vzero_ : A == rename upR B -> Var' (Γ & B) A vsuc_ : (C : Type Γ) -> A == rename upR C -> Var Γ C -> Var' (Γ & B) A data Var {n} Γ A where varI : Var' Γ A -> Var Γ A -- Terms ------------------------------------------------------------------ data Sub {n m : Nat}(Γ : Context n)(Δ : Context m) : Set subst : {n m : Nat}{Γ : Context n}{Δ : Context m} -> Sub Γ Δ -> Type Γ -> Type Δ down : {n : Nat}{Γ : Context n}{A : Type Γ} -> Term Γ A -> Sub (Γ & A) Γ data Term {n} Γ A where var : (x : Var Γ A) -> Term Γ A app : {B : Type Γ}{C : Type (Γ & B)} -> Term Γ (Pi B C) -> (t : Term Γ B) -> A == subst (down t) C -> Term Γ A lam : {B : Type Γ}{C : Type (Γ & B)} -> Term (Γ & B) C -> A == Pi B C -> Term Γ A -- Context manipulation --------------------------------------------------- ∅ : Context zero ∅ = ctxI nil' _!!_ : {n : Nat}(Γ : Context n) -> Fin n -> Type Γ _!!_ {zero} _ (finI ()) _!!_ {suc _} (ctxI (ext Γ A)) (finI fzero') = rename upR A _!!_ {suc _} (ctxI (ext Γ A)) (finI (fsuc' i)) = rename upR (Γ !! i) -- Renamings -------------------------------------------------------------- data ConsRen {n m : Nat}(Γ : Context n)(A : Type Γ)(Δ : Context m) : Set Ren' : {n m : Nat} -> Context n -> Context m -> Set Ren' {zero} {m} (ctxI nil') Δ = Nil Ren' {suc n} {m} (ctxI (ext Γ A)) Δ = ConsRen Γ A Δ data ConsRen {n m} Γ A Δ where extRen' : (ρ : Ren Γ Δ) -> Var Δ (rename ρ A) -> Ren' (Γ & A) Δ data Ren {n m} Γ Δ where renI : Ren' Γ Δ -> Ren Γ Δ -- Performing renamings --------------------------------------------------- rename' : {n m : Nat}{Γ : Context n}{Δ : Context m} -> Ren Γ Δ -> Type Γ -> Type Δ rename ρ SET = SET rename ρ A = rename' ρ A liftR : {n m : Nat}{Γ : Context n}{A : Type Γ}{Δ : Context m} -> (ρ : Ren Γ Δ) -> Ren (Γ & A) (Δ & rename ρ A) renameTerm : {n m : Nat}{Γ : Context n}{Δ : Context m}{A : Type Γ} (ρ : Ren Γ Δ) -> Term Γ A -> Term Δ (rename ρ A) rename' ρ SET = SET rename' ρ (Pi A B) = Pi (rename ρ A) (rename (liftR ρ) B) rename' ρ (El t) = El (renameTerm ρ t) lookupR : {n m : Nat}{Γ : Context n}{A : Type Γ}{Δ : Context m} (ρ : Ren Γ Δ)(x : Var Γ A) -> Var Δ (rename ρ A) cong : {n m : Nat}{Γ : Context n}{Δ : Context m}(f : Type Γ -> Type Δ) {A B : Type Γ} -> A == B -> f A == f B _trans_ : {n : Nat}{Γ : Context n}{A B C : Type Γ} -> A == B -> B == C -> A == C renameSubstCommute : {n m : Nat}{Γ : Context n}{Δ : Context m}{A : Type Γ}{B : Type (Γ & A)} {ρ : Ren Γ Δ}{t : Term Γ A} -> rename ρ (subst (down t) B) == subst (down (renameTerm ρ t)) (rename (liftR ρ) B) renameTerm ρ (var x) = var (lookupR ρ x) renameTerm {_}{_}{_}{_}{A} ρ (app{_}{C} s t eq) = app (renameTerm ρ s) (renameTerm ρ t) (cong (rename ρ) eq trans renameSubstCommute) renameTerm ρ (lam t eq) = lam (renameTerm (liftR ρ) t) (cong (rename ρ) eq) lookupR {zero} _ (varI ()) lookupR {suc n} {_} {ctxI (ext Γ B)} {A} {Δ} (renI (extRen' ρ z)) (varI (vzero_ eq)) = {!!} lookupR {suc n} {_} {ctxI (ext Γ B)} {A} {Δ} (renI (extRen' ρ z)) (varI (vsuc_ C eq x)) = {!!} -- Building renamings ----------------------------------------------------- extRen : {n m : Nat}{Γ : Context n}{A : Type Γ}{Δ : Context m} (ρ : Ren Γ Δ) -> Var Δ (rename ρ A) -> Ren (Γ & A) Δ extRen ρ x = renI (extRen' ρ x) _coR_ : {n m p : Nat}{Γ : Context n}{Δ : Context m}{Θ : Context p} -> Ren Δ Θ -> Ren Γ Δ -> Ren Γ Θ liftR {_}{_}{_}{A} ρ = extRen (upR coR ρ) (varI {!!}) idR : {n : Nat} {Γ : Context n} -> Ren Γ Γ idR = {!!} _coR_ = {!!} upR = {!!} -- Substitutions ---------------------------------------------------------- data ConsSub {n m : Nat}(Γ : Context n)(A : Type Γ)(Δ : Context m) : Set Sub' : {n m : Nat} -> Context n -> Context m -> Set Sub' {zero} {m} (ctxI nil') Δ = Nil Sub' {suc n} {m} (ctxI (ext Γ A)) Δ = ConsSub Γ A Δ data ConsSub {n m} Γ A Δ where extSub' : (σ : Sub Γ Δ) -> Term Δ (subst σ A) -> Sub' (Γ & A) Δ data Sub {n m} Γ Δ where subI : Sub' Γ Δ -> Sub Γ Δ -- Performing substitution ------------------------------------------------ subst' : {n m : Nat}{Γ : Context n}{Δ : Context m} -> Sub Γ Δ -> Type Γ -> Type Δ subst σ SET = SET subst σ A = subst' σ A liftS : {n m : Nat}{Γ : Context n}{A : Type Γ}{Δ : Context m} -> (σ : Sub Γ Δ) -> Sub (Γ & A) (Δ & subst σ A) substTerm : {n m : Nat}{Γ : Context n}{Δ : Context m}{A : Type Γ} -> (σ : Sub Γ Δ) -> Term Γ A -> Term Δ (subst σ A) subst' σ (Pi A B) = Pi (subst σ A) (subst (liftS σ) B) subst' σ (El t) = El (substTerm σ t) subst' σ SET = SET substTerm σ (var x) = {!!} substTerm σ (app s t eq) = {!!} substTerm σ (lam t eq) = {!!} -- Building substitutions ------------------------------------------------- liftS {_}{_}{_}{A} σ = {!!} -- extSub (upS ∘ σ) (var fzero (substCompose upS σ A)) -- Works with hidden args to substCompose when inlined in subst -- but not here. Weird. topS : {n : Nat}{Γ : Context n} -> Sub ∅ Γ topS = subI nil' extSub : {n m : Nat}{Γ : Context n}{A : Type Γ}{Δ : Context m} (σ : Sub Γ Δ) -> Term Δ (subst σ A) -> Sub (Γ & A) Δ extSub σ t = subI (extSub' σ t) idS : {n : Nat}{Γ : Context n} -> Sub Γ Γ idS {zero} {ctxI nil'} = topS idS {suc _} {ctxI (ext Γ A)} = {!!} -- extSub upS (var fzero refl) convert : {n : Nat}{Γ : Context n}{A B : Type Γ} -> A == B -> Term Γ B -> Term Γ A _∘_ : {n m p : Nat}{Γ : Context n}{Δ : Context m}{Θ : Context p} -> Sub Δ Θ -> Sub Γ Δ -> Sub Γ Θ substCompose : {n m p : Nat}{Γ : Context n}{Δ : Context m}{Θ : Context p} (σ : Sub Δ Θ)(δ : Sub Γ Δ)(A : Type Γ) -> subst (σ ∘ δ) A == subst σ (subst δ A) _∘_ {zero} {_}{_} {ctxI nil'} _ _ = topS _∘_ {suc _}{_}{_} {ctxI (ext Γ A)} σ (subI (extSub' δ t)) = extSub (σ ∘ δ) (convert (substCompose σ δ A) (substTerm σ t)) upS : {n : Nat}{Γ : Context n}{A : Type Γ} -> Sub Γ (Γ & A) upS = {!!} substId : {n : Nat}{Γ : Context n}{A : Type Γ} -> subst idS A == A down t = extSub idS (convert substId t) -- Convertibility --------------------------------------------------------- A == B = {!!} refl : {n : Nat}{Γ : Context n}{A : Type Γ} -> A == A refl = {!!} cong f eq = {!!} ab trans bc = {!!} convert eq t = {!!} -- Properties ------------------------------------------------------------- renameId : {n : Nat}{Γ : Context n}{A : Type Γ} -> rename idR A == A renameId = {!!} renameCompose : {n m p : Nat}{Γ : Context n}{Δ : Context m}{Θ : Context p} (σ : Ren Δ Θ)(δ : Ren Γ Δ)(A : Type Γ) -> rename (σ coR δ) A == rename σ (rename δ A) renameCompose σ δ A = {!!} substId = {!!} substCompose σ δ A = {!!} renameSubstCommute = {!!}
libsrc/_DEVELOPMENT/adt/wv_priority_queue/c/sdcc_iy/wv_priority_queue_push.asm
jpoikela/z88dk
640
168893
; int wv_priority_queue_push(wv_priority_queue_t *q, void *item) SECTION code_clib SECTION code_adt_wv_priority_queue PUBLIC _wv_priority_queue_push EXTERN asm_wv_priority_queue_push _wv_priority_queue_push: pop af pop hl pop bc push bc push hl push af jp asm_wv_priority_queue_push
libsrc/_DEVELOPMENT/temp/sp1/zx/c/sccz80/sp1_DeleteSpr.asm
meesokim/z88dk
0
27498
<filename>libsrc/_DEVELOPMENT/temp/sp1/zx/c/sccz80/sp1_DeleteSpr.asm ; void __FASTCALL__ sp1_DeleteSpr(struct sp1_ss *s) SECTION code_temp_sp1 PUBLIC sp1_DeleteSpr sp1_DeleteSpr: INCLUDE "temp/sp1/zx/sprites/asm_sp1_DeleteSpr.asm"
example/src/clic_ex-commands-double_dash.adb
alire-project/clic
9
29738
<filename>example/src/clic_ex-commands-double_dash.adb package body CLIC_Ex.Commands.Double_Dash is Upper_Case : aliased Boolean := False; ------------- -- Execute -- ------------- overriding procedure Execute (Cmd : in out Instance; Args : AAA.Strings.Vector) is begin if Upper_Case then Ada.Text_IO.Put_Line (AAA.Strings.To_Upper_Case (Args.Flatten)); else Ada.Text_IO.Put_Line (Args.Flatten); end if; end Execute; -------------------- -- Setup_Switches -- -------------------- overriding procedure Setup_Switches (Cmd : in out Instance; Config : in out CLIC.Subcommand.Switches_Configuration) is begin CLIC.Subcommand.Define_Switch (Config, Output => Upper_Case'Access, Long_Switch => "--upper"); end Setup_Switches; end CLIC_Ex.Commands.Double_Dash;
code/hello.asm
edadma/mos6502
4
96470
_stdioChar_ = "8000" org $8000 chio rb org $9000 start ldy #0 .1 lda message,y beq .2 sta chio iny bne .1 .2 lda #'\n' sta chio brk message db "Hello World!\0" org $FFFC dw start
libsrc/math/zxmath/ldfabc.asm
meesokim/z88dk
0
16346
<reponame>meesokim/z88dk ; ; Z88dk Generic Floating Point Math Library ; ; FA = bc ix de PUBLIC ldfabc EXTERN fa .ldfabc LD (fa),DE LD (fa+2),IX LD (fa+4),BC RET
tools-src/gnu/gcc/gcc/ada/sfn_scan.ads
enfoTek/tomato.linksys.e2000.nvram-mod
80
5648
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S F N _ S C A N -- -- -- -- S p e c -- -- -- -- $Revision$ -- -- -- Copyright (C) 2000-2001 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 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides a stand alone capability for scanning a gnat.adc -- file for Source_File_Name pragmas. This is for use in tools other than -- the compiler, which want to scan source file name pragmas without the -- overhead of the full compiler scanner and parser. -- Note that neither the package spec, nor the package body, of this -- unit contains any with statements at all. This is a compeltely -- independent package, suitable for incorporation into tools that do -- not access any other units in the GNAT compiler or tools sources. -- This package is NOT task safe, so multiple tasks that may call the -- Scan_SFN_Pragmas procedure at the same time are responsibible for -- avoiding such multiple calls by appropriate synchronization. package SFN_Scan is -- The call to SFN_Scan passes pointers to two procedures that are -- used to store the results of scanning any Source_File_Name pragmas -- that are encountered. The following access types define the form -- of these procedures: type Set_File_Name_Ptr is access procedure (Typ : Character; U : String; F : String); -- The procedure with this profile is called when a Source_File_Name -- pragma of the form having a unit name parameter. Typ is 'b' for -- a body file name, and 's' for a spec file name. U is a string that -- contains the unit name, exactly as it appeared in the source file, -- and F is the file taken from the second parameter. type Set_File_Name_Pattern_Ptr is access procedure (Pat : String; Typ : Character; Dot : String; Cas : Character); -- This is called to process a Source_File_Name pragma whose first -- argument is a file pattern. Pat is this pattern string, which -- contains an asterisk to correspond to the unit. Typ is one of -- ('b'/'s'/'u') for body/spec/subunit, Dot is the separator string -- for child/subunit names (default is "."), and Cas is one of -- ('l'/'u'/'m') indicating the required case for the file name. -- The default setting for Cas is 'l' if no parameter is present. Cursor : Natural; -- Used to record the cursor value if a syntax error is found Syntax_Error_In_GNAT_ADC : exception; -- Exception raised if a syntax error is found procedure Scan_SFN_Pragmas (Source : String; SFN_Ptr : Set_File_Name_Ptr; SFNP_Ptr : Set_File_Name_Pattern_Ptr); -- This is the procedure called to scan a gnat.adc file. The Source -- parameter points to the full text of the file, with normal line end -- characters, in the format normally read by the compiler. The two -- parameters SFN_Ptr and SFNP_Ptr point to procedures that will be -- called to register Source_File_Name pragmas as they are found. -- -- If a syntax error is found, then Syntax_Error_In_GNAT_ADC is raised, -- and the location SFN_Scan.Cursor contains the approximate index of -- the error in the source string. -- -- The scan assumes that it is dealing with a valid gnat.adc file, -- that includes only pragmas and comments. It does not do a full -- syntax correctness scan by any means, but if it does find anything -- that it can tell is wrong it will immediately raise the exception -- to indicate the aproximate location of the error end SFN_Scan;
Etapa 02/Aula 10 - Subrotinas/codes/a10e01.asm
bellorini/unioeste
6
19725
<reponame>bellorini/unioeste ; Aula 10 - Subprogramas ; arquivo: a10e01.asm ; objetivo: demonstrar chamada de procedimento ; nasm -f elf64 a10e01.asm ; ld a10e01.o -o a10e01.x %define _exit 60 %define _write 1 section .data strOla : db "You can't take the sky from me", 10, 0 strOlaL : equ $-strOla section .text global _start _start: ; RSP = ? ; PUSH fim ; RIP = ? call iboserenity ; ADDR = ? ; RSP = ? fim: ; addr = ? mov rax, _exit mov rdi, 0 syscall ; imprimeBalladofSerenity() iboserenity: ; addr = ? mov rax, _write mov rdi, 1 lea rsi, [strOla] mov rdx, strOlaL syscall lret: ; POP ret
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/s-imfi64.ads
JCGobbi/Nucleo-STM32G474RE
0
7373
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . I M G _ F I X E D _ 6 4 -- -- -- -- S p e c -- -- -- -- Copyright (C) 2020-2021, 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. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains the routines for supporting the Image attribute for -- ordinary fixed point types up to 64-bit small and mantissa. with Interfaces; with System.Arith_64; with System.Image_F; package System.Img_Fixed_64 is pragma Pure; subtype Int64 is Interfaces.Integer_64; package Impl is new Image_F (Int64, Arith_64.Scaled_Divide64); procedure Image_Fixed64 (V : Int64; S : in out String; P : out Natural; Num : Int64; Den : Int64; For0 : Natural; Aft0 : Natural) renames Impl.Image_Fixed; procedure Set_Image_Fixed64 (V : Int64; S : in out String; P : in out Natural; Num : Int64; Den : Int64; For0 : Natural; Aft0 : Natural; Fore : Natural; Aft : Natural; Exp : Natural) renames Impl.Set_Image_Fixed; end System.Img_Fixed_64;
src/css-core-sheets.ads
stcarrez/ada-css
3
339
----------------------------------------------------------------------- -- css-core-sheets -- CSS stylesheet representation -- Copyright (C) 2017 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with CSS.Core.Styles; with CSS.Core.Vectors; with CSS.Core.Values; with CSS.Core.Properties; with CSS.Core.Medias; package CSS.Core.Sheets is type CSSStylesheet is new CSS.Core.StyleSheet with record Rules : CSS.Core.Vectors.Vector; Values : CSS.Core.Values.Repository_Type; end record; type CSSStylesheet_Access is access all CSSStylesheet'Class; -- Create a CSS rule. function Create_Rule (Document : in CSSStyleSheet) return Styles.CSSStyleRule_Access; -- Create a CSS font-face rule. function Create_Rule (Document : in CSSStyleSheet) return Styles.CSSFontfaceRule_Access; -- Create a CSS media rule. function Create_Rule (Document : in CSSStyleSheet) return Medias.CSSMediaRule_Access; -- Append the CSS rule to the document. procedure Append (Document : in out CSSStylesheet; Rule : in Styles.CSSStyleRule_Access; Line : in Natural; Column : in Natural); -- Append the media rule to the document. procedure Append (Document : in out CSSStylesheet; Rule : in Medias.CSSMediaRule_Access; Line : in Natural; Column : in Natural); -- Append the font-face rule to the document. procedure Append (Document : in out CSSStylesheet; Rule : in Styles.CSSFontfaceRule_Access; Line : in Natural; Column : in Natural); -- Append the CSS rule to the media. procedure Append (Document : in out CSSStylesheet; Media : in Medias.CSSMediaRule_Access; Rule : in Styles.CSSStyleRule_Access; Line : in Natural; Column : in Natural); -- Iterate over the properties of each CSS rule. The <tt>Process</tt> procedure -- is called with the CSS rule and the property as parameter. procedure Iterate_Properties (Document : in CSSStylesheet; Process : not null access procedure (Rule : in Styles.CSSStyleRule'Class; Property : in Properties.CSSProperty)); end CSS.Core.Sheets;
programs/oeis/179/A179081.asm
jmorken/loda
1
23998
<filename>programs/oeis/179/A179081.asm ; A179081: Parity of sum of digits of n. ; 0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1 lpb $0 add $1,$0 div $0,10 lpe mod $1,2
src/sys/encoders/util-encoders-hmac-sha1.ads
RREE/ada-util
60
13251
----------------------------------------------------------------------- -- util-encoders-hmac-sha1 -- Compute HMAC-SHA1 authentication code -- Copyright (C) 2011, 2012, 2017, 2019 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Streams; with Ada.Finalization; with Util.Encoders.SHA1; -- The <b>Util.Encodes.HMAC.SHA1</b> package generates HMAC-SHA1 authentication -- (See RFC 2104 - HMAC: Keyed-Hashing for Message Authentication). package Util.Encoders.HMAC.SHA1 is pragma Preelaborate; -- Sign the data string with the key and return the HMAC-SHA1 code in binary. function Sign (Key : in String; Data : in String) return Util.Encoders.SHA1.Hash_Array; -- Sign the data string with the key and return the HMAC-SHA1 code as hexadecimal string. function Sign (Key : in String; Data : in String) return Util.Encoders.SHA1.Digest; -- Sign the data array with the key and return the HMAC-SHA256 code in the result. procedure Sign (Key : in Ada.Streams.Stream_Element_Array; Data : in Ada.Streams.Stream_Element_Array; Result : out Util.Encoders.SHA1.Hash_Array); -- Sign the data string with the key and return the HMAC-SHA1 code as base64 string. -- When <b>URL</b> is True, use the base64 URL alphabet to encode in base64. function Sign_Base64 (Key : in String; Data : in String; URL : in Boolean := False) return Util.Encoders.SHA1.Base64_Digest; -- ------------------------------ -- HMAC-SHA1 Context -- ------------------------------ type Context is limited private; -- Set the hmac private key. The key must be set before calling any <b>Update</b> -- procedure. procedure Set_Key (E : in out Context; Key : in String); -- Set the hmac private key. The key must be set before calling any <b>Update</b> -- procedure. procedure Set_Key (E : in out Context; Key : in Ada.Streams.Stream_Element_Array); -- Update the hash with the string. procedure Update (E : in out Context; S : in String); -- Update the hash with the string. procedure Update (E : in out Context; S : in Ada.Streams.Stream_Element_Array); -- Computes the HMAC-SHA1 with the private key and the data collected by -- the <b>Update</b> procedures. Returns the raw binary hash in <b>Hash</b>. procedure Finish (E : in out Context; Hash : out Util.Encoders.SHA1.Hash_Array); -- Computes the HMAC-SHA1 with the private key and the data collected by -- the <b>Update</b> procedures. Returns the hexadecimal hash in <b>Hash</b>. procedure Finish (E : in out Context; Hash : out Util.Encoders.SHA1.Digest); -- Computes the HMAC-SHA1 with the private key and the data collected by -- the <b>Update</b> procedures. Returns the base64 hash in <b>Hash</b>. -- When <b>URL</b> is True, use the base64 URL alphabet to encode in base64. procedure Finish_Base64 (E : in out Context; Hash : out Util.Encoders.SHA1.Base64_Digest; URL : in Boolean := False); -- ------------------------------ -- HMAC-SHA1 encoder -- ------------------------------ -- This <b>Encoder</b> translates the (binary) input stream into -- an SHA1 hexadecimal stream. The encoding alphabet is: 0123456789ABCDEF. type Encoder is new Util.Encoders.Transformer with private; -- Encodes the binary input stream represented by <b>Data</b> into -- an SHA-1 hash output stream <b>Into</b>. -- -- If the transformer does not have enough room to write the result, -- it must return in <b>Encoded</b> the index of the last encoded -- position in the <b>Data</b> stream. -- -- The transformer returns in <b>Last</b> the last valid position -- in the output stream <b>Into</b>. -- -- The <b>Encoding_Error</b> exception is raised if the input -- stream cannot be transformed. overriding procedure Transform (E : in out Encoder; Data : in Ada.Streams.Stream_Element_Array; Into : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Encoded : out Ada.Streams.Stream_Element_Offset); private type Encoder is new Util.Encoders.Transformer with null record; type Context is new Ada.Finalization.Limited_Controlled with record SHA : Util.Encoders.SHA1.Context; Key : Ada.Streams.Stream_Element_Array (0 .. 63); Key_Len : Ada.Streams.Stream_Element_Offset; end record; -- Initialize the SHA-1 context. overriding procedure Initialize (E : in out Context); end Util.Encoders.HMAC.SHA1;
src/asm/make_masm.asm
msaf1980/sc
62
10435
<reponame>msaf1980/sc ; Copyright (c) 2016 <NAME> ; License: https://opensource.org/licenses/ISC ; IFDEF SC_WIN64 INCLUDE make_x86_64_ms_pe_masm.asm ENDIF IFDEF SC_WIN32 INCLUDE make_i386_ms_pe_masm.asm ENDIF END
Kernel/Architecture/x86/i386/SafeOperations.asm
UltraOS/Ultra
44
81258
<filename>Kernel/Architecture/x86/i386/SafeOperations.asm %define safe_copy_memory _ZN6kernel16safe_copy_memoryEPKvPvm %define length_of_user_string _ZN6kernel21length_of_user_stringEPKv %define copy_until_null_or_n_from_user _ZN6kernel30copy_until_null_or_n_from_userEPKvPvm ; Safe function ABI: ; During a safe operation E(R)BX contains the address to go to in case of a fault, ; E(R)IP gets set to this address in case of a fault by the memory manager. section .safe_operations ; Copies exactly bytes into dst, returns 1 if success or 0 if faulted. ; bool safe_copy_memory(void* src, void* dst, size_t bytes) global safe_copy_memory safe_copy_memory: ; preserve non-scratch registers push esi push edi push ebx mov esi, [esp + 16] ; src mov edi, [esp + 20] ; dst mov ecx, [esp + 24] ; bytes mov ebx, .on_access_violation ; label to jump to in case of a fault rep movsb mov eax, 1 jmp .done .on_access_violation: mov eax, 0 .done: pop ebx pop edi pop esi ret ; Returns string length including the null terminator, or 0 if faulted ; size_t length_of_user_string(void* str) global length_of_user_string length_of_user_string: ; preserve non-scratch push ecx push edi push ebx mov ebx, .on_access_violation mov eax, 0 ; null terminator mov ecx, 0xFFFFFFFF mov edi, [esp + 16] repnz scasb mov eax, 0xFFFFFFFF sub eax, ecx jmp .done .on_access_violation: mov eax, 0 .done: pop ebx pop edi pop ecx ret ; Copies up to max_length or up to the null byte to the dst from src. ; Returns the number of bytes copied including the null byte, or 0 if faulted. ; size_t copy_until_null_or_n_from_user(void* src, void* dst, size_t max_length) global copy_until_null_or_n_from_user copy_until_null_or_n_from_user: ; preserve non-scratch push ebx push esi push edi mov ebx, .on_access_violation xor eax, eax mov edi, [esp + 16] mov esi, [esp + 20] mov ecx, [esp + 24] .next: ; if (length == 0) return or ecx, ecx jz .done ; char c = *src mov dl, byte [edi] ; *dst = c mov [esi], dl ; bytes_copied++ inc eax ; if (c == \0) return or dl, dl jz .done ; src++, dst++, length-- inc edi inc esi dec ecx jmp .next .on_access_violation: mov eax, 0 .done: pop edi pop esi pop ebx ret
demo_asm/demostring.asm
sfauvel/demo-assembler
0
83880
; ----------------------------------------------------------------------------- ; A 64-bit functions ; ----------------------------------------------------------------------------- global say_hello global say_hello_world global say_hello_world_and_new_line section .text say_hello: mov rax, hello ret say_hello_world: mov rax, helloworld ret say_hello_world_and_new_line: mov rax, helloworld_and_return ret section .data hello: db "Hello", 0 ; End with 0 unless string continue with the next one bye: db "Bye", 0 helloworld: db "Hello" ; Without 0 at the end, string continue with next declearation db " " world: db "World", 0 helloworld_and_return: db "Hello World", 10, 13, 0