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
tests/struct/fields_types.asm
cizo2000/sjasmplus
220
173693
; Based on documentation example (definitions same as tests/docs_examples/c_structures.asm) ; But this test does focus on stressing initializers syntax STRUCT substr1 sm00 BYTE '1' ENDS STRUCT substr2 byte '2' sub0 substr1 '3' byte '4' sub1 substr1 '5' byte '6' ENDS STRUCT str, 1 m00 byte 'A' m01 db 'B' m02 defb 'C' m03 word 'ED' m04 dw 'GF' m05 defw 'IH' m06 d24 'LKJ' m07 dword 'PONM' m08 dd 'TSRQ' m09 defd 'XWVU' m10 block 1, 'Y' m11 ds 1, 'Z' m12 defs 1, 'a' m13 # 1, 'b' m14 align 2, 'c' m15 ## 4, 'd' ; 2x 'd' m16 substr2 ENDS DEVICE ZXSPECTRUM48 ORG 0x8000 ds 0x4000, '_' ; fill memory with '_' ORG 0x8000 ;; first set testing init-values list structure parsing d01 str : ALIGN 4, "\n" ; "_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdd23456\n\n\n" d02 str {{{'!'}}} : ALIGN 4, "\n" ; "_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdd2!456\n\n\n" d03 str {'!'{'!'{'!'}}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd!!456\n\n\n" d04 str {'!'{'!',{'!'}}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd!!456\n\n\n" d05 str {'!'{'!',,{'!'}}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd!34!6\n\n\n" d06 str {'!'{,'!',{'!'}}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd2!4!6\n\n\n" d07 str {'!'{,'!','!'}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd2!!56\n\n\n" d08 str {'!'{'!',,{'!'},'!'}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd!34!!\n\n\n" d09 str {'!'{'!',{'!'},'!'}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd!!!56\n\n\n" d10 str {,'!',,'!!',{{'!'}}} : ALIGN 4, "\n" ; "_A!C!!FGHIJKLMNOPQRSTUVWXYZabcdd2!456\n\n\n" d11 str {,'!',,'!!',{'!'}} : ALIGN 4, "\n" ; "_A!C!!FGHIJKLMNOPQRSTUVWXYZabcdd!3456\n\n\n" ;; identical test cases as d02..d11, but without the top-level enclosing {} d12 str ,{{'!'}} : ALIGN 4, "\n" ; ^^^ Needs at least some hint the first { is not global level => "," added ; "_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdd2!456\n\n\n" d13 str '!'{'!'{'!'}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd!!456\n\n\n" d14 str '!'{'!',{'!'}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd!!456\n\n\n" d15 str '!'{'!',,{'!'}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd!34!6\n\n\n" d16 str '!'{,'!',{'!'}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd2!4!6\n\n\n" d17 str '!'{,'!','!'} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd2!!56\n\n\n" d18 str '!'{'!',,{'!'},'!'} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd!34!!\n\n\n" d19 str '!'{'!',{'!'},'!'} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd!!!56\n\n\n" d20 str ,'!',,'!!',{{'!'}} : ALIGN 4, "\n" ; "_A!C!!FGHIJKLMNOPQRSTUVWXYZabcdd2!456\n\n\n" d21 str ,'!',,'!!',{'!'} : ALIGN 4, "\n" ; "_A!C!!FGHIJKLMNOPQRSTUVWXYZabcdd!3456\n\n\n" ;; few more extra tests d22 str {'!'{'!',{'!'}'!'}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd!!!56\n\n\n" d23 str {'!'{'!',{}'!'}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd!3!56\n\n\n" @d24 str {'!'{'!',{},'!'}} : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd!3!56\n\n\n" ;; value warnings w0 str '!!' : ALIGN 4, "\n" ; "_!BCDEFGHIJKLMNOPQRSTUVWXYZabcdd23456\n\n\n" SAVEBIN "fields_types.bin", 0x8000, $-0x8000
parsers/src/main/goslin/SwissLipids.g4
lifs-tools/jg
4
5905
/* * MIT License * * Copyright (c) the authors (listed in global LICENSE file) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the 'Software'), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions:; * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHether IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ grammar SwissLipids; /* first rule is always start rule */ lipid : lipid_pure EOF | lipid_pure adduct_info EOF; lipid_pure : fatty_acid | gl | pl | sl | st; /* adduct information */ adduct_info : adduct_sep | adduct_separator adduct_sep; adduct_sep : '[M' adduct ']' charge_sign | '[M' adduct ']' charge charge_sign; adduct : adduct_set; adduct_set : adduct_element | adduct_element adduct_set; adduct_element : element | element number | number element | plus_minus element | plus_minus element number | plus_minus number element; /* fatty acyl rules */ fa : fa_core | fa_lcb_prefix fa_core | fa_core fa_lcb_suffix | fa_lcb_prefix fa_core fa_lcb_suffix; fa_core : carbon carbon_db_separator db | ether carbon carbon_db_separator db; lcb : lcb_core | fa_lcb_prefix lcb_core | lcb_core fa_lcb_suffix | fa_lcb_prefix lcb_core fa_lcb_suffix; lcb_core : hydroxyl carbon carbon_db_separator db; carbon : number; db : db_count | db_count db_positions; db_count : number; db_positions : ROB db_position RCB; db_position : db_single_position | db_position db_position_separator db_position; db_single_position : db_position_number | db_position_number cistrans; db_position_number : number; cistrans : 'E' | 'Z'; ether : 'O-' | 'P-'; hydroxyl : 'm' | 'd' | 't'; fa_lcb_suffix : fa_lcb_suffix_core | fa_lcb_suffix_separator fa_lcb_suffix_core | ROB fa_lcb_suffix_core RCB; fa_lcb_suffix_core : fa_lcb_suffix_number fa_lcb_suffix_type | fa_lcb_suffix_number fa_lcb_suffix_separator fa_lcb_suffix_type; fa_lcb_suffix_type : 'OH' | 'me'; fa_lcb_suffix_number : number; fa_lcb_prefix : fa_lcb_prefix_type | fa_lcb_prefix_type fa_lcb_prefix_separator; fa_lcb_prefix_type : 'iso'; /* different fatty acyl types */ fa_species : fa; fa2 : fa2_sorted | fa2_unsorted; fa2_sorted : fa sorted_fa_separator fa; fa2_unsorted : fa unsorted_fa_separator fa; fa3 : fa3_sorted | fa3_unsorted; fa3_sorted : fa sorted_fa_separator fa sorted_fa_separator fa; fa3_unsorted : fa unsorted_fa_separator fa unsorted_fa_separator fa; fa4 : fa4_sorted | fa4_unsorted; fa4_sorted : fa sorted_fa_separator fa sorted_fa_separator fa sorted_fa_separator fa; fa4_unsorted : fa unsorted_fa_separator fa unsorted_fa_separator fa unsorted_fa_separator fa; /* fatty acid rules */ fatty_acid : fa_hg fa_fa | fa_hg headgroup_separator fa_fa | mediator; fa_hg : 'FA' | 'fatty acid' | 'fatty alcohol' | 'NAE' | 'GP-NAE'; fa_fa : ROB fa RCB; /* mediator rules */ mediator : mediator_single | mediator_single headgroup_separator med_positions; mediator_single : mediator_single mediator_single | mediator_single '-' mediator_single | db_positions | med_positions | 'KETE' | 'keto' | 'oxo' | 'Hp' | 'EPE' | 'ETE' | 'ODE' | 'EPT' | 'H' | 'LXA4' | 'hydroxy' | 'Di' | 'RvE1' | 'glyceryl' | 'EpETrE' | 'DHE' | 'ETrE' | 'DHA' | 'DoHA' | 'LTB4' | 'PGE2' | ' PGE2' | 'PGF2alpha' | 'trihydroxy' | 'TriH' | 'OTrE' | 'dihydroxy' | 'Ep' | 'LXB4' | 'Tri' | 'PAHSA' | 'MUFA' | 'GPGP' | 'GPIP' | 'PGE1' | 'PGG2' | 'SFA' | 'PUFA' | 'PGI2' | 'TXA2' | 'CoA' | 'FAOH' | 'EA' | 'beta' | 'PGH2' | 'LTD4' | 'kete' | 'DPE' | ' PGD2' | 'PGD2' | 'PGF2' | 'LTC4' | 'LTA4' | 'PGD1' | 'PGA1' | 'LTDE4' | 'epoxyoleate' | 'epoxystearate' | 'carboxy' | 'PGH1' | 'EtrE' | 'HXA3' | 'HxA3' | 'HXA3-C'; med_positions : med_position | ROB med_position RCB; med_position : med_position med_position_separator med_position | number med_suffix | number; med_suffix : 'S' | 'R'; /* glycerolipid rules */ gl : gl_regular | gl_mono | gl_molecular; gl_regular : gl_hg gl_fa | gl_hg headgroup_separator gl_fa; gl_fa : ROB fa_species RCB | ROB fa3 RCB; gl_hg : 'MG' | 'DG' | 'TG' | 'MAG' | 'DAG' | 'TAG'; gl_molecular : gl_molecular_hg gl_molecular_fa | gl_molecular_hg headgroup_separator gl_molecular_fa; gl_molecular_fa : ROB fa2 RCB; gl_molecular_hg : 'DG' | 'DAG'; gl_mono : gl_mono_hg gl_mono_fa | gl_mono_hg headgroup_separator gl_mono_fa; gl_mono_fa : ROB fa_species RCB | ROB fa2 RCB; gl_mono_hg : 'MHDG' | 'DHDG' | 'MGDG' | 'DGDG'; /* phospholipid rules */ pl : pl_regular | pl_three | pl_four; pl_regular : pl_hg pl_fa | pl_hg headgroup_separator pl_fa; pl_fa : ROB fa_species RCB | ROB fa2 RCB; pl_hg : 'LPA' | 'LPC' | 'LPE' | 'LPG' | 'LPI' | 'LPS' | 'PA' | 'PC' | 'PE' | 'PG' | 'PI' | 'PS' | 'PGP' | 'PIP' | 'PIP[3]' | 'PIP[4]' | 'PIP[5]' | 'PIP2' | 'PIP2[3,4]' | 'PIP2[3,5]' | 'PIP2[4,5]' | 'PIP3' | 'PIP3[3,4,5]' | 'CDP-DAG'; pl_three : pl_three_hg pl_three_fa | pl_three_hg headgroup_separator pl_three_fa; pl_three_fa : ROB fa_species RCB | ROB fa3 RCB; pl_three_hg : 'NAPE'; pl_four : pl_four_hg pl_four_fa | pl_four_hg headgroup_separator pl_four_fa; pl_four_fa : ROB fa_species RCB | ROB fa2 RCB | ROB fa4 RCB; pl_four_hg : 'BMP' | 'LBPA' | 'Lysobisphosphatidate' | 'CL' | 'MLCL' | 'DLCL'; /* sphingolipid rules */ sl : sl_hg sl_lcb | sl_hg headgroup_separator sl_lcb; sl_hg : sl_hg_names | sl_hg_prefix sl_hg_names | sl_hg_names sl_hg_suffix | sl_hg_prefix sl_hg_names sl_hg_suffix; sl_hg_names : 'HexCer' | 'Hex2Cer' | 'SM' | 'PE-Cer' | 'Cer' | 'CerP' | 'Gb3' | 'GA2' | 'GA1' | 'GM3' | 'GM2' | 'GM1' | 'GD3' | 'GT3' | 'GD1' | 'GT1' | 'GQ1' | 'GM4' | 'GD2' | 'GT2' | 'GP1' | 'GD1a' | 'GM1b' | 'GT1b' | 'GQ1b' | 'GT1a' | 'GQ1c' | 'GP1c' | 'GD1c' | 'GD1b' | 'GT1c' | 'IPC' | 'MIPC' | 'M(IP)2C' | 'Gb3Cer' | 'Gb4Cer' | 'Forssman' | 'MSGG' | 'DSGG' | 'NOR1' | 'NORint' | 'NOR2' | 'Globo-H' | 'Globo-A' | 'SB1a' | 'SM1b' | 'SM1a' | 'Branched-Forssman' | 'Globo-B' | 'Para-Forssman' | 'Globo-Lex-9'; sl_hg_prefix : sl_hg_prefix '-' | sl_hg_prefix sl_hg_prefix | ROB sl_hg_prefix RCB | 'Glc' | 'NAc' | 'Gal' | 'Fuc' | 'SO3' | 'NeuGc' | 'i' | 'NeuAc' | 'Lac' | 'Lex' | '(3\'-sulfo)' | 'Ac-O-9' | '(alpha2-8)' | '(alpha2-6)' | 'NeuAc' | 'Sulfo'; sl_hg_suffix : sl_hg_suffix sl_hg_suffix | sl_hg_suffix '/' | ROB sl_hg_suffix RCB | 'NeuAc' | 'NeuGc' | ' alpha'; sl_lcb : sl_lcb_species | sl_lcb_subspecies; sl_lcb_species : ROB lcb RCB; sl_lcb_subspecies : ROB lcb sorted_fa_separator fa RCB; /* sterol rules */ st : st_species | st_sub1 | st_sub2; st_species : st_species_hg st_species_fa | st_species_hg headgroup_separator st_species_fa; st_species_hg : 'SE'; st_species_fa : ROB fa_species RCB; st_sub1 : st_sub1_hg st_sub1_fa | st_sub1_hg headgroup_separator st_sub1_fa; st_sub1_hg : 'CE'; st_sub1_fa : ROB fa RCB; st_sub2 : st_sub2_hg sorted_fa_separator fa RCB; st_sub2_hg : 'SE' ROB number COLON number; /* separators */ SPACE : ' '; COLON : ':'; SEMICOLON : ';'; DASH : '-'; UNDERSCORE : '_'; SLASH : '/'; BACKSLASH : '\\'; COMMA: ','; ROB: '('; RCB: ')'; unsorted_fa_separator : UNDERSCORE; adduct_separator : SPACE; sorted_fa_separator : SLASH; headgroup_separator : SPACE; carbon_db_separator : COLON; db_position_separator : COMMA; med_position_separator : COMMA; fa_lcb_suffix_separator : DASH; fa_lcb_prefix_separator : DASH; number : digit | digit number; digit : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'; element: 'C' | 'H' | 'N' | 'O' | 'P' | 'S' | 'Br' | 'I' | 'F' | 'Cl' | 'As'; charge : '1' | '2' | '3' | '4'; charge_sign : plus_minus; plus_minus : '-' | '+';
Transynther/x86/_processed/AVXALIGN/_ht_zr_/i9-9900K_12_0xca_notsx.log_21829_1681.asm
ljhsiun2/medusa
9
10421
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r8 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_WC_ht+0xae20, %r8 nop xor $19861, %rax movups (%r8), %xmm2 vpextrq $1, %xmm2, %r11 nop nop nop nop sub %rdi, %rdi lea addresses_UC_ht+0x1a730, %rbp nop dec %r11 mov (%rbp), %r8w cmp %rdi, %rdi lea addresses_WC_ht+0x11560, %r10 nop nop nop nop cmp %rbp, %rbp mov (%r10), %di nop nop nop sub $4294, %r8 lea addresses_D_ht+0xb0, %r10 nop nop nop inc %r12 mov (%r10), %rdi nop nop nop nop xor %r12, %r12 lea addresses_WT_ht+0xfbb0, %r11 clflush (%r11) nop nop nop sub $10566, %r12 movb (%r11), %al nop cmp %r12, %r12 lea addresses_D_ht+0x8af0, %rbp nop nop nop nop add %rdi, %rdi movb (%rbp), %r10b nop nop nop nop xor $60815, %r12 lea addresses_UC_ht+0x6970, %r8 nop nop nop nop xor $2236, %rdi mov (%r8), %r10w nop and %rdi, %rdi lea addresses_UC_ht+0x184a8, %rsi lea addresses_UC_ht+0x1ecc0, %rdi nop nop nop nop nop cmp $13646, %r8 mov $47, %rcx rep movsb nop nop nop nop and $14579, %rcx lea addresses_WC_ht+0x16e74, %r10 nop nop nop cmp $60756, %r11 mov (%r10), %rcx nop nop inc %rax lea addresses_A_ht+0x1c070, %rdi xor %r10, %r10 movb $0x61, (%rdi) add %r11, %r11 lea addresses_normal_ht+0x43c, %rsi lea addresses_D_ht+0x53f0, %rdi clflush (%rsi) nop nop and %rax, %rax mov $79, %rcx rep movsw nop nop and %r11, %r11 pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r8 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r15 push %rax push %rbx push %rdx // Store lea addresses_RW+0x6040, %r10 nop nop xor $15735, %rbx movb $0x51, (%r10) nop nop nop nop nop cmp $31574, %rax // Faulty Load mov $0x2a95ec00000000b0, %rdx nop add %r10, %r10 vmovntdqa (%rdx), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $0, %xmm3, %rax lea oracles, %r10 and $0xff, %rax shlq $12, %rax mov (%r10,%rax,1), %rax pop %rdx pop %rbx pop %rax pop %r15 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_NC', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 8}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}, 'dst': {'same': True, 'congruent': 4, 'type': 'addresses_UC_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_D_ht'}} {'00': 3515, '44': 18314} 00 00 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 44 44 44 00 00 44 44 44 44 44 44 00 44 44 44 44 44 44 44 44 44 44 00 00 44 44 44 00 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 00 00 44 44 44 44 00 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 00 00 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 44 44 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 44 44 44 44 00 00 44 44 44 44 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 00 44 44 44 44 00 00 00 00 00 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 00 00 00 44 00 00 00 00 44 44 44 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 00 00 00 44 44 44 44 44 44 44 44 00 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 00 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 00 44 00 44 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 00 00 00 00 00 00 00 44 44 00 00 44 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 00 44 44 44 44 44 44 44 44 44 00 00 00 00 00 44 44 44 44 44 44 44 44 44 00 00 44 44 44 44 44 44 44 00 44 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 44 44 44 44 44 44 44 00 00 00 00 44 00 44 44 00 00 00 00 00 44 44 44 44 44 44 00 44 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 00 44 00 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 00 00 00 00 00 00 00 00 00 00 00 00 44 44 44 44 44 44 44 00 00 44 44 44 44 44 44 44 44 44 44 00 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 00 00 44 44 44 44 44 44 44 44 44 00 00 44 44 44 44 44 44 44 44 44 00 00 44 44 44 00 00 00 44 44 00 00 00 00 00 44 00 00 44 44 44 44 44 44 44 00 00 00 00 44 44 44 44 44 44 44 */
hc11e4th.asm
tonypdmtr/eForth
1
86820
;******************************************************************************* ;* Language : Motorola/Freescale/NXP 68HC11 Assembly Language (aspisys.com/ASM11) ;******************************************************************************* ; ; 68HC11 eForth for the Motorola FREEWARE assembler ; ; This version of eForth runs on the Motorola 68HC11 microcontrollers. ; The source code itself is derived from the original 8051 eForth as ; developed by Dr. <NAME>. I have rewritten the source to use the ; Motorola FREEWARE assembler, and have added features of interest ; to users of the 'HC11 family: ; ; 1. This code creates separate name and code areas, per conventional ; eForth. The two areas, however, are intertwined throughout the ; object file, rather than growing inward from opposite ends of the ; memory space during assembly as done in the original 8051 code. ; ; At execution time, the name and code pointers are aimed at addresses ; selected by the user at assembly time. From then on, the name and ; code areas expand as normal (code area grows toward higher memory, ; name area grows toward lower memory). ; ; 2. The object created by this source code is fully ROMable and ; fits in about 7K of EPROM. Upon execution, a word called TASK is ; moved into the RAM area and the name and code pointers are initialized. ; ; 3. Like the original eForth, this version is word-aligned in all ; respects. This imposes a tiny size penalty and a minor speed penalty ; over a typical byte-aligned 68HC11 Forth. ; ; 4. I have not added any code for interrupt vectoring. You should bring ; this up initially by burning it into EPROM and running it by a G command ; in BUFFALO. (Alternatively, you could download the S19 file via serial ; port into RAM.) Later, you can add your own interrupt vectoring, move ; the code into the $ffff area, and disable BUFFALO. This would let you ; execute eForth directly on power-up. ; ; 5. I have added the word NOOP (for no-operation). It is an empty word ; that simply serves as the execution code for TASK. ; ; This is a straight-up, no-frills porting of 8051 eForth to the 68HC11. ; I have not added words you will likely miss, such as CONSTANT and C,. ; Nor have I rewritten any high-level words in assembly language; since ; FIND and NUMBER are high-level, you can expect slow compilation. ; ; But eForth is intended to be a starting point; feel free to extend and ; modify as you like. ; ; I place this source code in the public domain. I cannot guarantee ; to support or maintain it, and I certainly do not take any responsibility ; for whatever you do with or to this code, nor for any effects this code ; generates, either directly or indirectly. I wrote this code primarily ; for pleasure, and I hope you enjoy playing with it and learning from it. ; ; If you have any questions or comments, you can reach me at: ; ; <NAME> ; 2133 186th Pl., SE ; Bothell, WA 98012 ; (206) 483-0447 ; Internet: <EMAIL> ;******************************************************************************* #ListOff #Uses exp-f1.inc #ListOn ;******************************************************************************* ; Macros ;******************************************************************************* token macro label,'string'[,c|i] mset #',' mreq 1,2:label,'string' mstr 2 align 2 #temp :index fdb ~1~ #ifz :temp-1 fdb 0 ; link of 0 means first entry #else fdb _link{:temp-1} #endif #temp1 #ifparm ~3~ = c #temp1 COMPO #else ifparm ~3~ = i #temp1 IMMED #else ifparm ~3~ = ic #temp1 IMMED+COMPO #else ifparm ~3~ = ci #temp1 IMMED+COMPO #else ifnb ~3~ merror Unexpected: ~3~ #endif _link{:temp} fcb :temp1+:2-2 ;length of literal without quotes fcc ~2~ #ifz :2\2 fcb 0 ; null-fill cell #endif #ifndef ~1~ ~1~ proc #endif #ifdef ADD_NOP_JMP_DOLST nop jmp dolst #endif endm ;******************************************************************************* COMPO equ $40 ; lexicon compile only bit IMMED equ $80 ; lexicon immediate bit MASKK equ $1f7f ; lexicon bit mask CELL_SIZE equ 2 ; size of a cell DEFAULT_RADIX equ 10 VOCSS equ 8 ; depth of vocabulary stack VER equ 1 ; version number EXT equ 0 ; extension number ERR equ 27 ; error escape TRUE equ -1 ; eForth true flag FALSE equ 0 ; eForth false flag #if :cpu = 6811 ; (will leave NON_JMP undefined if ported) NOP_JMP equ $017E ; nop-jmp opcodes (68HC11) #endif ;=============================================================================== ; RAM allocation: +-------------------------------+ top of RAM (RAMEND) ; | return stack grows down | ; | \/ | ; | \/ | ; +-------------------------------+ ; | text input buffer | ; +-------------------------------+ ; | data stack grows down | ; | \/ | ; | \/ | ; +-------------------------------+ ; | /\ | ; | /\ | ; | user area grows up | ; +-------------------------------| ; | name dictionary grows down | ; | \/ | ; | \/ | ; +-------------------------------+ ; | /\ | ; | /\ | ; | code dictionary grows up | ; +-------------------------------+ bottom of RAM (RAMBEG) ;=============================================================================== ; You can customize the memory usage of this eForth by changing the ; values assigned to the following equates. All sizes are in bytes ; and must be even numbers. RAMBEG equ $a000 ; bottom of ram memory RAMEND equ $bfff ; top of ram memory ROMBEG equ $c000 ; bottom of rom memory us equ $100 ; user area size in bytes rts equ $100 ; return stack/tib size dts equ $100 ; data stack size ; These equates fix the relative positions of eForth's buffers and ; stack areas. rpp equ RAMEND&$fffe ; start of return stack (rp0) tibb equ rpp-rts ; start of tib, body of rtn stack spp equ tibb-2 ; start of data stack (sp0) upp equ spp-dts-us-$10 ; start of user area (up) NAMEE equ upp-$10&$fffe ; initial name dictionary (word align) CODEE equ RAMBEG ; initial code dictionary ;******************************************************************************* ; Allocation of 68HC11 working registers. These registers should stay ; in the zero-page area for faster execution speed. ;******************************************************************************* #RAM ;******************************************************************************* org $0022 ?ip rmb 2 ; 2 bytes for IP ;******************************************************************************* #ROM ; Start of 'hc11 eForth code ;******************************************************************************* ; ROM-based default data values. These are automatically ; preloaded into the user area upon reset. uzero fdb:4 0 ; reserved fdb spp ; sp0 fdb rpp ; rp0 fdb qrx ; '?key fdb txsto ; 'emit fdb accep ; 'expect fdb ktap ; 'tap fdb txsto ; 'echo fdb dotok ; 'prompt fdb DEFAULT_RADIX ; base fdb 0 ; tmp fdb 0 ; span fdb 0 ; >in fdb 0 ; #tib fdb tibb ; tib fdb 0 ; csp fdb inter ; 'eval fdb numbq ; 'number fdb 0 ; hld fdb 0 ; handler fdb 0 ; context pointer fdb:VOCSS 0 ; vocabulary stack (VOCSS deep) fdb 0 ; current pointer fdb 0 ; vocabulary link pointer fdb CODEE ; cp fdb 0 ; np (overwritten at powerup) fdb 0 ; last (overwritten at powerup) fdb 0 ; forth (overwritten at powerup) fdb 0 ; vocabulary link #size uzero ; The following code is copied to the start of the RAM name ; dictionary space on powerup. ntask fdb noop ; 'code' for task fdb coldlink ; link 'back' to cold #ppc fcs LEN@@,'TASK' LEN@@ equ *-:ppc-2 ; (-1 for zero fill and -1 for length byte) #size ntask ;******************************************************************************* ; Start of the compiler; jump here on power-up. ; Note that serial port initialization can occur here and at !IO; if ; you change any initialization code here, be sure to duplicate the ; changes in !IO. Start proc sei lda #%10110011 ; turn on a/d, use edge irq, enable ; delay after stop, set slow clk to ; watchdog sta OPTION lda #$30 ; 9600 BAUD @ 2MHz bus sta BAUD clr SCCR1 ; 8-bit xfers lda #$0c sta SCCR2 ; no interrupts, enable r & t lds #spp-2 ; temp start of data stack ldy #rpp ; temp start of return stack ldx #cold1 ; point to first instruction bra ?next2 ; and start it up ;******************************************************************************* ; The forth inner interpreter ; Entry can occur at one of three locations, depending on the action ; needed. ; Entry at pushd pushes the word in A:B onto the data stack, then ; falls into ?next. Use this entry point when leaving a low-level ; definition that must also push a result (in D) onto the data ; stack. ; Entry at ?next simply moves to the next low-level definition in ; the thread. Use this entry point when leaving a low-level ; definition that does not need to save any results onto the data ; stack. ; Entry at ?next2 uses the value in X as the current IP (instruction ; pointer) and calculates the next executable address from it. Use ; this entry point when changing execution threads; for example, see ; the code at ?BRANCH. pushd proc pshd ; save D as word on stack and fall into ?next ?next ldx ?ip ; get current ip ?next2 ldb #2 ; ip = ip + 2 abx stx ?ip dex:2 ; x = ip - 2 ldx ,x ; x = (x) jmp ,x ; go to (x) dolst ldb #4 ; x = x + 4 abx ; (to jump around NOP JMP DOLST) ldd ?ip ; get old IP std ,y ; save on return stack dey:2 ; make room on return stack bra ?next2 ; and go to next level exit ldb #2 ; y = y + 2 aby ldx ,y ; pull old IP from return stack bra ?next2 ; and go to previous level ;******************************************************************************* ; Each eForth word contains a header of the following format: ; fdb label points to executable code ; fdb prev_name points back to previous name ; this_name: ; fcb options+n n = length of name in bytes ; fcc 'XXXX' string containing word's name ; fcb 0 word-alignment IF n IS EVEN! ; label: ; ----- start of assembly code for XXXX ; where options is IMMED if this is an IMMEDIATE word and COMPO if ; this is a COMPILE-ONLY word. Note that the line containing fcb 0 is ; optional; it should only appear if the word's name contains an even ; number of characters. Look over several definitions below ; for examples of building headers. ; Note that all low-level (assembly language) definitions begin with the ; phrase: ; align 2 ;WAS: org *+1&$fffe ; This forces the definition to be word-aligned. This org statement is ; not necessary for high-level definitions. ; Note also that all embedded strings (usually following an 'fdb dotqp') ; must contain an even number of bytes INCLUDING THE LENGTH BYTE. If ; necessary, use a 'fcb 0' to pad out to the next word address. Check ; the definitions below for examples. ; If you add customized low-level definitions, observe the following ; register usage: ; The hardware stack (S-register) serves as eForth's data stack. You must ; always push and pull data in word-wide sequences. Never leave the data ; stack having pushed or pulled an odd number of bytes. ; The Y-register defines eForth's return stack. All accesses must be ; word-wide. See the code at >R and R> for examples of using the Y-register ; as a stack pointer. ; The X-register may be freely trashed in your code, with one possible ; exception. If you leave your new definition with a jump to ?next2, ; X must point to the next threaded address to execute. See the code in ; BRANCH for an example. ; The A- and B-registers may also be used freely, again with one possible ; exception. If you leave your new definition with a jump to pushd, ; A:B will be pushed onto the data stack prior to executing the next ; word in the thread. ;******************************************************************************* ; The kernel ;******************************************************************************* ;******************************************************************************* ; dolit ( -- w ) ; push an inline literal. @token dolit,'doLIT',c ldx ?ip ; get addr of next word ldd ,x ; get data at that addr inx:2 ; now bump IP stx ?ip bra pushd ; and save on stack ;******************************************************************************* ; dolist ( a -- ) ; process colon list. @token dolst,'doLIST',c ; points back into inner interpreter ;******************************************************************************* ; next ( -- ) ; run time code for the single index loop. ; : next ( -- ) \ hilevel model ; r> r> dup if 1 - >r @ >r exit then drop cell+ >r ; @token donxt,'next',c ldd 2,y ; get counter on return stack beq Cont@@ ; branch if loop is done decd ; no, bump the counter std 2,y ; and replace on stack bra bran ; and branch back to top Cont@@ iny:2 ; done, burn counter from stack ldx ?ip ; get the IP inx:2 ; and get addr past branch target bra ?next2 ; and go do next word ;******************************************************************************* ; ?branch ( f -- ) ; branch if flag is zero. @token qbran,'?branch',c puld ; get TOS to D cmpd #0 ; did we get a 0? bne Old@@ ; branch if not ldx ?ip ; yes, get next word as addr ldx ,x ; now get contents as new IP bra ?next2 ; and jump there Old@@ ldx ?ip ; get old ip inx:2 ; and move past branch addr jmp ?next2 ; and jump there ;******************************************************************************* ; branch ( -- ) ; branch to an inline address. @token bran,'branch',c ; use code inside ?BRANCH ;******************************************************************************* ; execute ( ca -- ) ; execute the word at ca. @token execu,'EXECUTE' pulx ; get ca from TOS jmp ,x ; and go do it ;******************************************************************************* ; exit ( -- ) ; terminate a colon definition. @token exit,'EXIT' ; points back into inner interpreter ;******************************************************************************* ; ! ( u a -- ) ; store u into address a. @token store,'!' pulx ; get the addr puld ; get the word std ,x ; and save to addr jmp ?next ;******************************************************************************* ; @ ( a -- w ) ; push memory location to the data stack. @token at,'@' pulx ; get the addr ldd ,x ; get the data there jmp pushd ; and save it ;******************************************************************************* ; c! ( c b -- ) ; pop the data stack to byte memory. @token cstor,'C!' pulx ; get the addr puld ; get the data (only low byte counts) stb ,x ; save to addr jmp ?next ;******************************************************************************* ; c@ ( b -- c ) ; push byte memory location to the data stack. @token cat,'C@' pulx ; get the addr ldb ,x ; get the data clra ; make MSB = 0 jmp pushd ; and save it ;******************************************************************************* ; >r ( w -- ) ; push the data stack to the return stack. @token tor,'>R',c puld ; get the data at TOS std ,y ; save on return stack dey:2 ; and make room jmp ?next ;******************************************************************************* ; r@ ( -- w ) ; copy top of return stack to the data stack. @token rat,'R@' ldd 2,y ; get top value on return stack jmp pushd ; and save to data stack ;******************************************************************************* ; r> ( -- w ) ; pop the return stack to the data stack. @token rfrom,'R>' iny:2 ; count this value ldd ,y ; get top value on return stack jmp pushd ; now save it ;******************************************************************************* ; rp@ ( -- a ) ; push the current rp to the data stack. @token rpat,'RP@' pshy ; save return pointer jmp ?next ;******************************************************************************* ; rp! ( a -- ) ; set the return stack pointer. @token rpsto,'RP!',c puly ; use new return pointer jmp ?next ;******************************************************************************* ; sp@ ( -- a ) ; push the current data stack pointer. @token spat,'SP@' tsx ; get current stack pointer dex ; adjust for tsx instr pshx ; and save on data stack jmp ?next ;******************************************************************************* ; sp! ( a -- ) ; set the data stack pointer. @token spsto,'SP!' pulx ; get new stack pointer inx ; prepare for txs txs ; and make it count jmp ?next ;******************************************************************************* ; dup ( w -- w w ) ; duplicate the top stack item. @token dup,'DUP' pulx ; get TOS pshx:2 ; save it back, and a copy jmp ?next ;******************************************************************************* ; drop ( w -- ) ; discard top stack item. @token drop,'DROP' pulx ; burn a data item jmp ?next ;******************************************************************************* ; swap ( w1 w2 -- w2 w1 ) ; exchange top two stack items. @token swap,'SWAP' pulx ; get top item puld ; get second item pshx ; save top item jmp pushd ; and save second item ;******************************************************************************* ; over ( w1 w2 -- w1 w2 w1 ) ; copy second stack item to top. @token over,'OVER' tsx ; get the stack pointer ldd 2,x ; get second item jmp pushd ; and push onto stack ;******************************************************************************* ; 0< ( n -- t ) ; return true if n is negative. @token zless,'0<' puld ; get TOS tsta ; check high bit bmi True@@ ; branch if negative ldd #FALSE ; get the flag jmp pushd ; and set it True@@ ldd #TRUE ; get the flag jmp pushd ; and set it ;******************************************************************************* ; and ( w w -- w ) ; bitwise and. @token and,'AND' puld ; get TOS tsx ; get stack pointer anda ,x ; and do the and andb 1,x std ,x ; save back to stack jmp ?next ;******************************************************************************* ; or ( w w -- w ) ; bitwise inclusive or. @token or,'OR' puld ; get TOS tsx ; get stack pointer ora ,x ; and do the and orb 1,x std ,x ; save back to stack jmp ?next ;******************************************************************************* ; xor ( w w -- w ) ; bitwise exclusive or. @token xor,'XOR' puld ; get TOS tsx ; get stack pointer eora ,x ; and do the and eorb 1,x std ,x ; save back to stack jmp ?next ;******************************************************************************* ; um+ ( w w -- w cy ) ; add two numbers, return the sum and carry flag. @token uplus,'UM+' puld ; get TOS tsx ; get the stack pointer addd ,x ; and add second item std ,x ; put back on stack ldd #0 ; presume false rolb ; move carry into word jmp pushd ; and save on stack ;******************************************************************************* ; device dependent i/o ;******************************************************************************* ;******************************************************************************* ; !io ( -- ) ; initialize the serial i/o devices. @token stoio,'!IO' lda #$30 ; 9600 BAUD sta BAUD lda #$00 ; 8-bit xfers sta SCCR1 lda #$0c sta SCCR2 ; no interrupts, enable r & t jmp ?next ;******************************************************************************* ; ?rx ( -- c t | f ) ; return input character and true, or a false if no input. @token qrx,'?RX' clra ; assume no char available ldb SCSR ; get serial status reg andb #%00100000 ; check RDRF bit beq Save@@ ; branch if nothing there ldb SCDR ; char; move into B pshd ; save char to stack as word ldd #TRUE ; get the flag Save@@ jmp pushd ; and save flag ;******************************************************************************* ; tx! ( c -- ) ; send character c to the output device. @token txsto,'TX!' puld ; get char from TOS, char is in B Loop@@ lda SCSR ; time to send? bpl Loop@@ ; loop until time stb SCDR ; write char to SCI jmp ?next ;******************************************************************************* ; system and user variables ;******************************************************************************* ADD_NOP_JMP_DOLST ;from this point on after @token ;******************************************************************************* ; dovar ( -- a ) ; run time routine for variable and create. @token dovar,'doVAR',c fdb rfrom,exit ;******************************************************************************* ; up ( -- a ) ; pointer to the user area. @token up,'UP' fdb dovar fdb upp ;******************************************************************************* ; douser ( -- a ) ; run time routine for user variables. @token douse,'doUSER',c fdb rfrom,at,up,at,plus,exit ;******************************************************************************* ; sp0 ( -- a ) ; pointer to bottom of the data stack. @token szero,'SP0' fdb douse,8,exit ;******************************************************************************* ; rp0 ( -- a ) ; pointer to bottom of the return stack. @token rzero,'RP0' fdb douse,10,exit ;******************************************************************************* ; '?key ( -- a ) ; execution vector of ?key. @token tqkey,"'?key" fdb douse,12,exit ;******************************************************************************* ; 'emit ( -- a ) ; execution vector of emit. @token temit,"'emit" fdb douse,14,exit ;******************************************************************************* ; 'expect ( -- a ) ; execution vector of expect. @token texpe,"'expect" fdb douse,16,exit ;******************************************************************************* ; 'tap ( -- a ) ; execution vector of tap. @token ttap,"'tap" fdb douse,18,exit ;******************************************************************************* ; 'echo ( -- a ) ; execution vector of echo. @token techo,"'echo" fdb douse,20,exit ;******************************************************************************* ; 'prompt ( -- a ) ; execution vector of prompt. @token tprom,"'prompt" fdb douse,22,exit ;******************************************************************************* ; base ( -- a ) ; storage of the radix base for numeric i/o. @token base,'BASE' fdb douse,24,exit ;******************************************************************************* ; tmp ( -- a ) ; a temporary storage location used in parse and find. @token temp,'tmp',c fdb douse,26,exit ;******************************************************************************* ; span ( -- a ) ; hold character count received by expect. @token span,'SPAN' fdb douse,28,exit ;******************************************************************************* ; >in ( -- a ) ; hold the character pointer while parsing input stream. @token inn,'>IN' fdb douse,30,exit ;******************************************************************************* ; #tib ( -- a ) ; hold the current count and address of the terminal input buffer. @token ntib,'#TIB' fdb douse,32,exit ;******************************************************************************* ; csp ( -- a ) ; hold the stack pointer for error checking. @token csp,'CSP' fdb douse,36,exit ;******************************************************************************* ; 'eval ( -- a ) ; execution vector of eval. @token teval,"'eval" fdb douse,38,exit ;******************************************************************************* ; 'number ( -- a ) ; execution vector of number?. @token tnumb,"'number" fdb douse,40,exit ;******************************************************************************* ; hld ( -- a ) ; hold a pointer in building a numeric output string. @token hld,'HLD' fdb douse,42,exit ;******************************************************************************* ; handler ( -- a ) ; hold the return stack pointer for error handling. @token handl,'HANDLER' fdb douse,44,exit ;******************************************************************************* ; context ( -- a ) ; a area to specify vocabulary search order. @token cntxt,'CONTEXT' fdb douse,46,exit ;******************************************************************************* ; current ( -- a ) ; point to the vocabulary to be extended. @token crrnt,'CURRENT' fdb douse,64,exit ;******************************************************************************* ; cp ( -- a ) ; point to the top of the code dictionary. @token cp,'CP' fdb douse,68,exit ;******************************************************************************* ; np ( -- a ) ; point to the bottom of the name dictionary. @token np,'NP' fdb douse,70,exit ;******************************************************************************* ; last ( -- a ) ; point to the last name in the name dictionary. @token last,'LAST' fdb douse,72,exit ;******************************************************************************* ; forth ( -- a ) ; point to the last name in the name dictionary. @token vfrth,'forth' fdb douse,74,exit ;******************************************************************************* ; WARNING: Next available user area offset is 78. ;******************************************************************************* ;******************************************************************************* ; common functions ;******************************************************************************* ;******************************************************************************* ; forth ( -- ) ; make forth the context vocabulary. @token forth,'FORTH' fdb vfrth,cntxt,store,exit ;******************************************************************************* ; ?dup ( w -- w w | 0 ) ; dup tos if its is not zero. @token qdup,'?DUP' fdb dup fdb qbran,qdup1 fdb dup qdup1 fdb exit ;******************************************************************************* ; rot ( w1 w2 w3 -- w2 w3 w1 ) ; rot 3rd item to top. @token rot,'ROT' fdb tor,swap,rfrom,swap,exit ;******************************************************************************* ; 2drop ( w w -- ) ; discard two items on stack. @token ddrop,'2DROP' fdb drop,drop,exit ;******************************************************************************* ; 2dup ( w1 w2 -- w1 w2 w1 w2 ) ; duplicate top two items. @token ddup,'2DUP' fdb over,over,exit ;******************************************************************************* ; + ( w w -- sum ) ; add top two items. @token plus,'+' fdb uplus,drop,exit ;******************************************************************************* ; d+ ( d d -- d ) ; double addition, as an example using um+. @token dplus,'D+' fdb tor,swap,tor,uplus fdb rfrom,rfrom,plus,plus,exit ;******************************************************************************* ; not ( w -- w ) ; one's complement of tos. @token inver,'NOT' fdb dolit,-1,xor,exit ;******************************************************************************* ; negate ( n -- -n ) ; two's complement of tos. @token negat,'NEGATE' fdb inver,dolit,1,plus,exit ;******************************************************************************* ; dnegate ( d -- -d ) ; two's complement of top double. @token dnega,'DNEGATE' fdb inver,tor,inver fdb dolit,1,uplus fdb rfrom,plus,exit ;******************************************************************************* ; - ( n1 n2 -- n1-n2 ) ; subtraction. @token sub,'-' fdb negat,plus,exit ;******************************************************************************* ; abs ( n -- n ) ; return the absolute value of n. @token abs,'ABS' fdb dup,zless fdb qbran,abs1 fdb negat abs1 fdb exit ;******************************************************************************* ; = ( w w -- t ) ; return true if top two are equal. @token equal,'=' fdb xor fdb qbran,equ1 fdb dolit,FALSE,exit ; false flag equ1 fdb dolit,TRUE,exit ; true flag ;******************************************************************************* ; u< ( u u -- t ) ; unsigned compare of top two items. @token uless,'U<' fdb ddup,xor,zless fdb qbran,ules1 fdb swap,drop,zless,exit ules1 fdb sub,zless,exit ;******************************************************************************* ; < ( n1 n2 -- t ) ; signed compare of top two items. @token less,'<' fdb ddup,xor,zless fdb qbran,less1 fdb drop,zless,exit less1 fdb sub,zless,exit ;******************************************************************************* ; max ( n n -- n ) ; return the greater of two top stack items. @token max,'MAX' fdb ddup,less fdb qbran,max1 fdb swap max1 fdb drop,exit ;******************************************************************************* ; min ( n n -- n ) ; return the smaller of top two stack items. @token min,'MIN' fdb ddup,swap,less fdb qbran,min1 fdb swap min1 fdb drop,exit ;******************************************************************************* ; within ( u ul uh -- t ) ; return true if u is within the range of ul and uh. @token withi,'WITHIN' fdb over,sub,tor ; ul <= u < uh fdb sub,rfrom,uless,exit ;******************************************************************************* ; divide ;******************************************************************************* ;******************************************************************************* ; um/mod ( udl udh u -- ur uq ) ; unsigned divide of a double by a single. return mod and quotient. @token ummod,'UM/MOD' fdb ddup,uless fdb qbran,umm4 fdb negat,dolit,15,tor umm1 fdb tor,dup,uplus fdb tor,tor,dup,uplus fdb rfrom,plus,dup fdb rfrom,rat,swap,tor fdb uplus,rfrom,or fdb qbran,umm2 fdb tor,drop,dolit,1,plus,rfrom fdb bran,umm3 umm2 fdb drop umm3 fdb rfrom fdb donxt,umm1 fdb drop,swap,exit umm4 fdb drop,ddrop fdb dolit,-1,dup,exit ; overflow, return max ;******************************************************************************* ; m/mod ( d n -- r q ) ; signed floored divide of double by single. return mod and quotient. @token msmod,'M/MOD' fdb dup,zless,dup,tor fdb qbran,mmod1 fdb negat,tor,dnega,rfrom mmod1 fdb tor,dup,zless fdb qbran,mmod2 fdb rat,plus mmod2 fdb rfrom,ummod,rfrom fdb qbran,mmod3 fdb swap,negat,swap mmod3 fdb exit ;******************************************************************************* ; /mod ( n n -- r q ) ; signed divide. return mod and quotient. @token slmod,'/MOD' fdb over,zless,swap,msmod,exit ;******************************************************************************* ; mod ( n n -- r ) ; signed divide. return mod only. @token mod,'MOD' fdb slmod,drop,exit ;******************************************************************************* ; / ( n n -- q ) ; signed divide. return quotient only. @token slash,'/' fdb slmod,swap,drop,exit ;******************************************************************************* ; multiply ;******************************************************************************* ;******************************************************************************* ; um* ( u u -- ud ) ; unsigned multiply. return double product. @token umsta,'UM*' fdb dolit,0,swap,dolit,15,tor umst1 fdb dup,uplus,tor,tor fdb dup,uplus,rfrom,plus,rfrom fdb qbran,umst2 fdb tor,over,uplus,rfrom,plus umst2 fdb donxt,umst1 fdb rot,drop,exit ;******************************************************************************* ; * ( n n -- n ) ; signed multiply. return single product. @token star,'*' fdb umsta,drop,exit ;******************************************************************************* ; m* ( n n -- d ) ; signed multiply. return double product. @token mstar,'M*' fdb ddup,xor,zless,tor fdb abs,swap,abs,umsta fdb rfrom fdb qbran,msta1 fdb dnega msta1 fdb exit ;******************************************************************************* ; */mod ( n1 n2 n3 -- r q ) ; multiply n1 and n2, then divide by n3. return mod and quotient. @token ssmod,'*/MOD' fdb tor,mstar,rfrom,msmod,exit ;******************************************************************************* ; */ ( n1 n2 n3 -- q ) ; multiply n1 by n2, then divide by n3. return quotient only. @token stasl,'*/' fdb ssmod,swap,drop,exit ;******************************************************************************* ; miscellaneous ;******************************************************************************* ;******************************************************************************* ; cell+ ( a -- a ) ; add cell size in byte to address. @token cellp,'CELL+' fdb dolit,CELL_SIZE,plus,exit ;******************************************************************************* ; cell- ( a -- a ) ; subtract cell size in byte from address. @token cellm,'CELL-' fdb dolit,0-CELL_SIZE,plus,exit ;******************************************************************************* ; cells ( n -- n ) ; multiply tos by cell size in bytes. @token cells,'CELLS' fdb dolit,CELL_SIZE,star,exit ;******************************************************************************* ; aligned ( b -- a ) ; align address to the cell boundary. @token algnd,'ALIGNED' fdb dup,dolit,0,dolit,CELL_SIZE fdb ummod,drop,dup fdb qbran,algn1 fdb dolit,CELL_SIZE,swap,sub algn1 fdb plus,exit ;******************************************************************************* ; bl ( -- 32 ) ; return 32, the blank character. @token blank,'BL' fdb dolit,' ',exit ; literal space ;******************************************************************************* ; >char ( c -- c ) ; filter non-printing characters. @token tchar,'>CHAR' fdb dolit,$7F,and,dup ; mask msb fdb dolit,127,blank,withi ; check for printable fdb qbran,tcha1 ; branch if printable fdb drop,dolit,'_' ; literal underscore tcha1 fdb exit ;******************************************************************************* ; depth ( -- n ) ; return the depth of the data stack. @token depth,'DEPTH' fdb spat,szero,at,swap,sub fdb dolit,CELL_SIZE,slash,exit ;******************************************************************************* ; pick ( ... +n -- ... w ) ; copy the nth stack item to tos. @token pick,'PICK' fdb dolit,1,plus,cells fdb dolit,1,plus fdb spat,plus,at,exit ;******************************************************************************* ; memory access ;******************************************************************************* ;******************************************************************************* ; +! ( n a -- ) ; add n to the contents at address a. @token pstor,'+!' fdb swap,over,at,plus fdb swap,store,exit ;******************************************************************************* ; 2! ( d a -- ) ; store the double integer to address a. @token dstor,'2!' fdb swap,over,store fdb cellp,store,exit ;******************************************************************************* ; 2@ ( a -- d ) ; fetch double integer from address a. @token dat,'2@' fdb dup,cellp,at fdb swap,at,exit ;******************************************************************************* ; count ( b -- b +n ) ; return count byte of a string and add 1 to byte address. @token count,'COUNT' fdb dup,dolit,1,plus fdb swap,cat,exit ;******************************************************************************* ; here ( -- a ) ; return the top of the code dictionary. @token here,'HERE' fdb cp,at,exit ;******************************************************************************* ; pad ( -- a ) ; return the address of a temporary buffer. @token pad,'PAD' fdb here,dolit,80,plus,exit ;******************************************************************************* ; tib ( -- a ) ; return the address of the terminal input buffer. @token tib,'TIB' fdb ntib,cellp,at,exit ;******************************************************************************* ; @execute ( a -- ) ; execute vector stored in address a. @token atexe,'@EXECUTE' fdb at,qdup ; ?address or zero fdb qbran,exe1 fdb execu ; execute if non-zero exe1 fdb exit ; do nothing if zero ;******************************************************************************* ; cmove ( b1 b2 u -- ) ; copy u bytes from b1 to b2. @token cmove,'CMOVE' fdb tor fdb bran,cmov2 cmov1 fdb tor,dup,cat fdb rat,cstor fdb dolit,1,plus fdb rfrom,dolit,1,plus cmov2 fdb donxt,cmov1 fdb ddrop,exit ;******************************************************************************* ; fill ( b u c -- ) ; fill u bytes of character c to area beginning at b. @token fill,'FILL' fdb swap,tor,swap fdb bran,fill2 fill1 fdb ddup,cstor,dolit,1,plus fill2 fdb donxt,fill1 fdb ddrop,exit ;******************************************************************************* ; -trailing ( b u -- b u ) ; adjust the count to eliminate trailing white space. @token dtrai,'-TRAILING' fdb tor fdb bran,dtra2 dtra1 fdb blank,over,rat,plus,cat,less fdb qbran,dtra2 fdb rfrom,dolit,1,plus,exit ; adjusted count dtra2 fdb donxt,dtra1 fdb dolit,0,exit ; count=0 ;******************************************************************************* ; pack$ ( b u a -- a ) ; build a counted string with u characters from b. null fill. @token packs,'PACK$' fdb algnd,dup,tor ; strings only on cell boundary fdb over,dup,dolit,0 fdb dolit,CELL_SIZE,ummod,drop ; count mod cell fdb sub,over,plus fdb dolit,0,swap,store ; null fill cell fdb ddup,cstor,dolit,1,plus ; save count fdb swap,cmove,rfrom,exit ; move string ;******************************************************************************* ; numeric output, single precision ;******************************************************************************* ;******************************************************************************* ; digit ( u -- c ) ; convert digit u to a character. @token digit,'DIGIT' fdb dolit,9,over,less fdb dolit,7,and,plus fdb dolit,'0',plus,exit ; literal 0 ;******************************************************************************* ; extract ( n base -- n c ) ; extract the least significant digit from n. @token extrc,'EXTRACT' fdb dolit,0,swap,ummod fdb swap,digit,exit ;******************************************************************************* ; <# ( -- ) ; initiate the numeric output process. @token bdigs,'<#' fdb pad,hld,store,exit ;******************************************************************************* ; hold ( c -- ) ; insert a character into the numeric output string. @token hold,'HOLD' fdb hld,at,dolit,1,sub fdb dup,hld,store,cstor,exit ;******************************************************************************* ; # ( u -- u ) ; extract one digit from u and append the digit to output string. @token dig,'#' fdb base,at,extrc,hold,exit ;******************************************************************************* ; #s ( u -- 0 ) ; convert u until all digits are added to the output string. @token digs,'#S' digs1 fdb dig,dup fdb qbran,digs2 fdb bran,digs1 digs2 fdb exit ;******************************************************************************* ; sign ( n -- ) ; add a minus sign to the numeric output string. @token sign,'SIGN' fdb zless fdb qbran,sign1 fdb dolit,'-',hold ; literal minus sign sign1 fdb exit ;******************************************************************************* ; #> ( w -- b u ) ; prepare the output string to be type'd. @token edigs,'#>' fdb drop,hld,at fdb pad,over,sub,exit ;******************************************************************************* ; str ( n -- b u ) ; convert a signed integer to a numeric string. @token str,'str' fdb dup,tor,abs fdb bdigs,digs,rfrom fdb sign,edigs,exit ;******************************************************************************* ; hex ( -- ) ; use radix 16 as base for numeric conversions. @token hex,'HEX' fdb dolit,16,base,store,exit ;******************************************************************************* ; decimal ( -- ) ; use radix 10 as base for numeric conversions. @token decim,'DECIMAL' fdb dolit,10,base,store,exit ;******************************************************************************* ; numeric input, single precision ;******************************************************************************* ;******************************************************************************* ; digit? ( c base -- u t ) ; convert a character to its numeric value. a flag indicates success. @token digtq,'DIGIT?' fdb tor,dolit,'0',sub ; literal 0 fdb dolit,9,over,less fdb qbran,dgtq1 fdb dolit,7,sub fdb dup,dolit,10,less,or dgtq1 fdb dup,rfrom,uless,exit ;******************************************************************************* ; number? ( a -- n t | a f ) ; convert a number string to integer. push a flag on tos. @token numbq,'NUMBER?' fdb base,at,tor,dolit,0,over,count fdb over,cat,dolit,'$',equal ; literal $ fdb qbran,numq1 fdb hex,swap,dolit,1,plus fdb swap,dolit,1,sub numq1 fdb over,cat,dolit,'-',equal,tor ; literal minus sign fdb swap,rat,sub,swap,rat,plus,qdup fdb qbran,numq6 fdb dolit,1,sub,tor numq2 fdb dup,tor,cat,base,at,digtq fdb qbran,numq4 fdb swap,base,at,star,plus,rfrom fdb dolit,1,plus fdb donxt,numq2 fdb rat,swap,drop fdb qbran,numq3 fdb negat numq3 fdb swap fdb bran,numq5 numq4 fdb rfrom,rfrom,ddrop,ddrop,dolit,0 numq5 fdb dup numq6 fdb rfrom,ddrop fdb rfrom,base,store,exit ;******************************************************************************* ; basic i/o ;******************************************************************************* ;******************************************************************************* ; ?key ( -- c t | f ) ; return input character and true, or a false if no input. @token qkey,'?KEY' fdb tqkey,atexe,exit ;******************************************************************************* ; key ( -- c ) ; wait for and return an input character. @token key,'KEY' key1 fdb qkey fdb qbran,key1 fdb exit ;******************************************************************************* ; emit ( c -- ) ; send a character to the output device. @token emit,'EMIT' fdb temit,atexe,exit ;******************************************************************************* ; nuf? ( -- t ) ; return false if no input, else pause and if cr return true. @token nufq,'NUF?' fdb qkey,dup fdb qbran,nufq1 fdb ddrop,key,dolit,CR,equal nufq1 fdb exit ;******************************************************************************* ; pace ( -- ) ; send a pace character for the file downloading process. @token pace,'PACE' fdb dolit,11,emit,exit ;******************************************************************************* ; space ( -- ) ; send the blank character to the output device. @token space,'SPACE' fdb blank,emit,exit ;******************************************************************************* ; spaces ( +n -- ) ; send n spaces to the output device. @token spacs,'SPACES' fdb dolit,0,max,tor fdb bran,char2 char1 fdb space char2 fdb donxt,char1 fdb exit ;******************************************************************************* ; type ( b u -- ) ; output u characters from b. @token typee,'TYPE' fdb tor fdb bran,type2 type1 fdb dup,cat,emit fdb dolit,1,plus type2 fdb donxt,type1 fdb drop,exit ;******************************************************************************* ; cr ( -- ) ; output a carriage return and a line feed. @token crr,'CR' fdb dolit,CR,emit fdb dolit,LF,emit,exit ;******************************************************************************* ; do$ ( -- a ) ; return the address of a compiled string. @token dostr,'do$',c fdb rfrom,rat,rfrom,count,plus fdb algnd,tor,swap,tor,exit ;******************************************************************************* ; $"| ( -- a ) ; run time routine compiled by $". return address of a compiled string. @token strqp,'$"|',c fdb dostr,exit ; force a call to do$ ;******************************************************************************* ; ."| ( -- ) ; run time routine of ." . output a compiled string. @token dotqp,'."|',c fdb dostr,count,typee,exit ;******************************************************************************* ; .r ( n +n -- ) ; display an integer in a field of n columns, right justified. @token dotr,'.R' fdb tor,str,rfrom,over,sub fdb spacs,typee,exit ;******************************************************************************* ; u.r ( u +n -- ) ; display an unsigned integer in n column, right justified. @token udotr,'U.R' fdb tor,bdigs,digs,edigs fdb rfrom,over,sub fdb spacs,typee,exit ;******************************************************************************* ; u. ( u -- ) ; display an unsigned integer in free format. @token udot,'U.' fdb bdigs,digs,edigs fdb space,typee,exit ;******************************************************************************* ; . ( w -- ) ; display an integer in free format, preceeded by a space. @token dot,'.' fdb base,at,dolit,10,xor ; ?decimal fdb qbran,dot1 fdb udot,exit ; no, display unsigned dot1 fdb str,space,typee,exit ; yes, display signed ;******************************************************************************* ; ? ( a -- ) ; display the contents in a memory cell. @token quest,'?' fdb at,dot,exit ;******************************************************************************* ; parsing ;******************************************************************************* ;******************************************************************************* ; parse ( b u c -- b u delta ; <string> ) ; scan string delimited by c. return found string and its offset. @token pars,'parse' fdb temp,store,over,tor,dup fdb qbran,pars8 fdb dolit,1,sub,temp,at,blank,equal fdb qbran,pars3 fdb tor pars1 fdb blank,over,cat ; skip leading blanks only fdb sub,zless,inver fdb qbran,pars2 fdb dolit,1,plus fdb donxt,pars1 fdb rfrom,drop,dolit,0,dup,exit pars2 fdb rfrom pars3 fdb over,swap fdb tor pars4 fdb temp,at,over,cat,sub ; scan for delimiter fdb temp,at,blank,equal fdb qbran,pars5 fdb zless pars5 fdb qbran,pars6 fdb dolit,1,plus fdb donxt,pars4 fdb dup,tor fdb bran,pars7 pars6 fdb rfrom,drop,dup fdb dolit,1,plus,tor pars7 fdb over,sub fdb rfrom,rfrom,sub,exit pars8 fdb over,rfrom,sub,exit ;******************************************************************************* ; parse ( c -- b u ; <string> ) ; scan input stream and return counted string delimited by c. @token parse,'PARSE' fdb tor,tib,inn,at,plus ; current input buffer pointer fdb ntib,at,inn,at,sub ; remaining count fdb rfrom,pars,inn,pstor,exit ;******************************************************************************* ; .( ( -- ) ; output following string up to next ) . @token dotpr,'.(',i fdb dolit,')',parse,typee,exit ; literal ) ;******************************************************************************* ; ( ( -- ) ; ignore following string up to next ) . a comment. @token paren,'(',i fdb dolit,')',parse,ddrop,exit ; literal ) ;******************************************************************************* ; \ ( -- ) ; ignore following text till the end of line. @token bksla,'\',i fdb ntib,at,inn,store,exit ;******************************************************************************* ; char ( -- c ) ; parse next word and return its first character. @token char,'CHAR' fdb blank,parse,drop,cat,exit ;******************************************************************************* ; token ( -- a ; <string> ) ; parse a word from input stream and copy it to name dictionary. @token token,'TOKEN' fdb blank,parse,dolit,31,min fdb np,at,over,sub,cellm fdb packs,exit ;******************************************************************************* ; word ( c -- a ; <string> ) ; parse a word from input stream and copy it to code dictionary. @token word,'WORD' fdb parse,here,packs,exit ;******************************************************************************* ; dictionary search ;******************************************************************************* ;******************************************************************************* ; name> ( na -- ca ) ; return a code address given a name address. @token namet,'NAME>' fdb cellm,cellm,at,exit ;******************************************************************************* ; same? ( a a u -- a a f \ -0+ ) ; compare u cells in two strings. return 0 if identical. @token sameq,'SAME?' fdb tor fdb bran,same2 same1 fdb over,rat,cells,plus,at fdb over,rat,cells,plus,at fdb sub,qdup fdb qbran,same2 fdb rfrom,drop,exit ; strings not equal same2 fdb donxt,same1 fdb dolit,0,exit ; strings equal ;******************************************************************************* ; find ( a va -- ca na | a f ) ; search a vocabulary for a string. return ca and na if succeeded. @token find,'find' fdb swap,dup,cat fdb dolit,CELL_SIZE,slash,temp,store fdb dup,at,tor,cellp,swap find1 fdb at,dup fdb qbran,find6 fdb dup,at,dolit,MASKK,and,rat,xor fdb qbran,find2 fdb cellp,dolit,TRUE ; true flag fdb bran,find3 find2 fdb cellp,temp,at,sameq find3 fdb bran,find4 find6 fdb rfrom,drop fdb swap,cellm,swap,exit find4 fdb qbran,find5 fdb cellm,cellm fdb bran,find1 find5 fdb rfrom,drop,swap,drop fdb cellm fdb dup,namet,swap,exit ;******************************************************************************* ; name? ( a -- ca na | a f ) ; search all context vocabularies for a string. @token nameq,'NAME?' fdb cntxt,dup,dat,xor ; ?context=also fdb qbran,namq1 fdb cellm ; no, start with context namq1 fdb tor namq2 fdb rfrom,cellp,dup,tor ; next in search order fdb at,qdup fdb qbran,namq3 fdb find,qdup ; search vocabulary fdb qbran,namq2 fdb rfrom,drop,exit ; found name namq3 fdb rfrom,drop ; name not found fdb dolit,FALSE,exit ; false flag ;******************************************************************************* ; terminal response ;******************************************************************************* ;******************************************************************************* ; ^h ( bot eot cur -- bot eot cur ) ; backup the cursor by one character. @token bksp,'^H' fdb tor,over,rfrom,swap,over,xor fdb qbran,back1 fdb dolit,BS,techo,atexe,dolit,1,sub fdb blank,techo,atexe fdb dolit,BS,techo,atexe back1 fdb exit ;******************************************************************************* ; tap ( bot eot cur c -- bot eot cur ) ; accept and echo the key stroke and bump the cursor. @token tap,'TAP' fdb dup,techo,atexe fdb over,cstor,dolit,1,plus,exit ;******************************************************************************* ; ktap ( bot eot cur c -- bot eot cur ) ; process a key stroke, CR or backspace. @token ktap,'kTAP' fdb dup,dolit,CR,xor fdb qbran,ktap2 fdb dolit,BS,xor fdb qbran,ktap1 fdb blank,tap,exit ktap1 fdb bksp,exit ktap2 fdb drop,swap,drop,dup,exit ;******************************************************************************* ; accept ( b u -- b u ) ; accept characters to input buffer. return with actual count. @token accep,'accept' fdb over,plus,over accp1 fdb ddup,xor fdb qbran,accp4 fdb key,dup ; fdb blank,sub,dolit,95,uless fdb blank,dolit,127,withi fdb qbran,accp2 fdb tap fdb bran,accp3 accp2 fdb ttap,atexe accp3 fdb bran,accp1 accp4 fdb drop,over,sub,exit ;******************************************************************************* ; expect ( b u -- ) ; accept input stream and store count in span. @token expec,'EXPECT' fdb texpe,atexe,span,store,drop,exit ;******************************************************************************* ; query ( -- ) ; accept input stream to terminal input buffer. @token query,'QUERY' fdb tib,dolit,80,texpe,atexe,ntib,store fdb drop,dolit,0,inn,store,exit ;******************************************************************************* ; error handling ;******************************************************************************* ;******************************************************************************* ; catch ( ca -- 0 | err# ) ; execute word at ca and set up an error frame for it. @token catch,'CATCH' fdb spat,tor,handl,at,tor ; save error frame fdb rpat,handl,store,execu ; execute fdb rfrom,handl,store ; restore error frame fdb rfrom,drop,dolit,0,exit ; no error ;******************************************************************************* ; throw ( err# -- err# ) ; reset system to current local error frame an update error flag. @token throw,'THROW' fdb handl,at,rpsto ; restore return stack fdb rfrom,handl,store ; restore handler frame fdb rfrom,swap,tor,spsto ; restore data stack fdb drop,rfrom,exit ;******************************************************************************* ; null$ ( -- a ) ; return address of a null string with zero count. @token nulls,'NULL$' fdb dovar ; emulate create fdb 0 fcb 99,111,121,111,116,101 ;******************************************************************************* ; abort ( -- ) ; reset data stack and jump to quit. @token abort,'ABORT' fdb nulls,throw ;******************************************************************************* ; abort" ( f -- ) ; run time routine of abort" . abort with a message. @token aborq,'abort"',c fdb qbran,abor1 ; text flag fdb dostr,throw ; pass error string abor1 fdb dostr,drop,exit ; drop error ;******************************************************************************* ; the text interpreter ;******************************************************************************* ;******************************************************************************* ; $interpret ( a -- ) ; interpret a word. if failed, try to convert it to an integer. @token inter,'$INTERPRET' fdb nameq,qdup ; ?defined fdb qbran,inte1 ; fdb at,dolit,compo,and ; ?compile only lexicon bits fdb cat,dolit,COMPO,and ; ?compile only lexicon bits fdb aborq fcb 13 fcc ' compile only' fdb execu,exit ; execute defined word inte1 fdb tnumb,atexe ; convert a number fdb qbran,inte2 fdb exit inte2 fdb throw ; error ;******************************************************************************* ; [ ( -- ) ; start the text interpreter. @token lbrac,'[',i fdb dolit,inter,teval,store,exit ;******************************************************************************* ; .ok ( -- ) ; display 'ok' only while interpreting. @token dotok,'.OK' fdb dolit,inter,teval,at,equal fdb qbran,doto1 fdb dotqp fcb 3 fcc ' ok' doto1 fdb crr,exit ;******************************************************************************* ; ?stack ( -- ) ; abort if the data stack underflows. @token qstac,'?STACK' fdb depth,zless ; check only for underflow fdb aborq fcb 10 fcc ' underflow ' ; extra space for align fdb exit ;******************************************************************************* ; eval ( -- ) ; interpret the input stream. @token eval,'EVAL' eval1 fdb token,dup,cat ; ?input stream empty fdb qbran,eval2 fdb teval,atexe,qstac ; evaluate input, check stack fdb bran,eval1 eval2 fdb drop,tprom,atexe,exit ; prompt ;******************************************************************************* ; shell ;******************************************************************************* ;******************************************************************************* ; preset ( -- ) ; reset data stack pointer and the terminal input buffer. @token prese,'PRESET' fdb szero,at,spsto fdb dolit,tibb,ntib,cellp,store,exit ;******************************************************************************* ; xio ( a a a -- ) ; reset the i/o vectors 'expect, 'tap, 'echo and 'prompt. @token xio,'xio',c fdb dolit,accep,texpe,dstor fdb techo,dstor,exit ;******************************************************************************* ; file ( -- ) ; select i/o vectors for file download. @token file,'FILE' fdb dolit,pace,dolit,drop fdb dolit,ktap,xio,exit ;******************************************************************************* ; hand ( -- ) ; select i/o vectors for terminal interface. @token hand,'HAND' fdb dolit,dotok,dolit,emit fdb dolit,ktap,xio,exit ;******************************************************************************* ; i/o ( -- a ) ; array to store default i/o vectors. @token islo,'I/O' fdb dovar ; emulate create fdb qrx,txsto ; default i/o vectors ;******************************************************************************* ; console ( -- ) ; initiate terminal interface. @token conso,'CONSOLE' fdb islo,dat,tqkey,dstor ; restore default i/o device fdb hand,exit ; keyboard input ;******************************************************************************* ; quit ( -- ) ; reset return stack pointer and start text interpreter. @token quit,'QUIT' fdb rzero,at,rpsto ; reset return stack pointer quit1 fdb lbrac ; start interpretation quit2 fdb query ; get input fdb dolit,eval,catch,qdup ; evaluate input fdb qbran,quit2 ; continue till error fdb tprom,at,swap ; save input device fdb conso,nulls,over,xor ; ?display error message fdb qbran,quit3 fdb space,count,typee ; error message fdb dotqp fcb 3 fcc ' ? ' ; error prompt quit3 fdb dolit,dotok,xor ; ?file input fdb qbran,quit4 fdb dolit,ERR,emit ; file error, tell host quit4 fdb prese ; some cleanup fdb bran,quit1 ;******************************************************************************* ; The compiler ;******************************************************************************* ;******************************************************************************* ; ' ( -- ca ) ; search context vocabularies for the next word in input stream. @token tick,"'" fdb token,nameq ; ?defined fdb qbran,tick1 fdb exit ; yes, push code address tick1 fdb throw ; no, error ;******************************************************************************* ; allot ( n -- ) ; allocate n bytes to the code dictionary. @token allot,'ALLOT' fdb cp,pstor,exit ; adjust code pointer ;******************************************************************************* ; , ( w -- ) ; compile an integer into the code dictionary. @token comma,',' fdb here,dup,cellp ; cell boundary fdb cp,store,store,exit ; adjust code pointer, compile ;******************************************************************************* ; [compile] ( -- ; <string> ) ; compile the next immediate word into code dictionary. @token bcomp,'[COMPILE]',i fdb tick,comma,exit ;******************************************************************************* ; compile ( -- ) ; compile the next address in colon list to code dictionary. @token compi,'COMPILE',c fdb rfrom,dup,at,comma ; compile address fdb cellp,tor,exit ; adjust return address ;******************************************************************************* ; literal ( w -- ) ; compile tos to code dictionary as an integer literal. @token liter,'LITERAL',i fdb compi,dolit,comma,exit ;******************************************************************************* ; $," ( -- ) ; compile a literal string up to next " . @token scomq,'$,"' fdb dolit,'"',word ; literal " (move word to dictionary) fdb count,plus,algnd ; calculate aligned end of string fdb cp,store,exit ; adjust the code pointer ;******************************************************************************* ; recurse ( -- ) ; make the current word available for compilation. @token recur,'RECURSE',i fdb last,at,namet,comma,exit ;******************************************************************************* ; structures ;******************************************************************************* ;******************************************************************************* ; for ( -- a ) ; start a for-next loop structure in a colon definition. @token for,'FOR',i fdb compi,tor,here,exit ;******************************************************************************* ; begin ( -- a ) ; start an infinite or indefinite loop structure. @token begin,'BEGIN',i fdb here,exit ;******************************************************************************* ; next ( a -- ) ; terminate a for-next loop structure. @token next,'NEXT',i fdb compi,donxt,comma,exit ;******************************************************************************* ; until ( a -- ) ; terminate a begin-until indefinite loop structure. @token until,'UNTIL',i fdb compi,qbran,comma,exit ;******************************************************************************* ; again ( a -- ) ; terminate a begin-again infinite loop structure. @token again,'AGAIN',i fdb compi,bran,comma,exit ;******************************************************************************* ; if ( -- a ) ; begin a conditional branch structure. @token if,'IF',i fdb compi,qbran,here fdb dolit,0,comma,exit ;******************************************************************************* ; ahead ( -- a ) ; compile a forward branch instruction. @token ahead,'AHEAD',i fdb compi,bran,here,dolit,0,comma,exit ;******************************************************************************* ; repeat ( a a -- ) ; terminate a begin-while-repeat indefinite loop. @token repea,'REPEAT',i fdb again,here,swap,store,exit ;******************************************************************************* ; then ( a -- ) ; terminate a conditional branch structure. @token then,'THEN',i fdb here,swap,store,exit ;******************************************************************************* ; aft ( a -- a a ) ; jump to then in a for-aft-then-next loop the first time through. @token aft,'AFT',i fdb drop,ahead,begin,swap,exit ;******************************************************************************* ; else ( a -- a ) ; start the false clause in an if-else-then structure. @token else,'ELSE',i fdb ahead,swap,then,exit ;******************************************************************************* ; while ( a -- a a ) ; conditional branch out of a begin-while-repeat loop. @token while,'WHILE',i fdb if,swap,exit ;******************************************************************************* ; abort" ( -- ; <string> ) ; conditional abort with an error message. @token abrtq,'ABORT"',i fdb compi,aborq,scomq,exit ;******************************************************************************* ; $" ( -- ; <string> ) ; compile an inline string literal. @token strq,'$"',i fdb compi,strqp,scomq,exit ;******************************************************************************* ; ." ( -- ; <string> ) ; compile an inline string literal to be typed out at run time. @token dotq,'."',i fdb compi,dotqp,scomq,exit ;******************************************************************************* ; name compiler ;******************************************************************************* ;******************************************************************************* ; ?unique ( a -- a ) ; display a warning message if the word already exists. @token uniqu,'?UNIQUE' fdb dup,nameq ; ?name exists fdb qbran,uniq1 ; redefinitions are ok fdb dotqp fcb 7 fcc ' redef ' ; but warn the user fdb over,count,typee ; just in case its not planned uniq1 fdb drop,exit ;******************************************************************************* ; $,n ( na -- ) ; build a new dictionary name using the string at na. @token sname,'$,n' fdb dup,cat ; ?null input fdb qbran,snam1 fdb uniqu ; ?redefinition fdb dup,last,store ; save na for vocab link fdb here,algnd,swap ; align code address fdb cellm ; link address fdb crrnt,at,at,over,store fdb cellm,dup,np,store ; adjust name pointer fdb store,exit ; save code pointer snam1 fdb strqp fcb 5 fcc ' name' ; null input fdb throw ;******************************************************************************* ; forth compiler ;******************************************************************************* ;******************************************************************************* ; $compile ( a -- ) ; compile next word to code dictionary as a token or literal. @token scomp,'$COMPILE' fdb nameq,qdup ; ?defined fdb qbran,scom2 ; fdb at,dolit,IMMED,and ; ?immediate fdb cat,dolit,IMMED,and ; ?immediate fdb qbran,scom1 fdb execu,exit ; its immediate, execute scom1 fdb comma,exit ; its not immediate, compile scom2 fdb tnumb,atexe ; try to convert to number fdb qbran,scom3 fdb liter,exit ; compile number as integer scom3 fdb throw ; error ;******************************************************************************* ; overt ( -- ) ; link a new word into the current vocabulary. @token overt,'OVERT' fdb last,at,crrnt,at,store,exit ;******************************************************************************* ; ; ( -- ) ; terminate a colon definition. @token semis,';',ic fdb compi,exit,lbrac,overt,exit ;******************************************************************************* ; ] ( -- ) ; start compiling the words in the input stream. @token rbrac,']' fdb dolit,scomp,teval,store,exit ;******************************************************************************* ; call, ( ca -- ) ; assemble a call instruction to ca. @token callc,'call,' fdb dolit,NOP_JMP,comma ; insert NOP and JMP fdb comma,exit ; insert address ; fdb dolit,calll,comma ; direct threaded code ; fdb comma,exit ; dtc 8086 relative call ;******************************************************************************* ; : ( -- ; <string> ) ; start a new colon definition using next word as its name. @token colon,':' fdb token,sname,dolit,dolst ; add call to list proc fdb callc,rbrac,exit ;******************************************************************************* ; immediate ( -- ) ; make the last compiled word an immediate word. @token immedi,'IMMEDIATE' fdb dolit,IMMED,last,at,cat,or fdb last,at,cstor,exit ; fdb dolit,IMMED,last,at,at,or ; fdb last,at,store,exit ;******************************************************************************* ; defining words ;******************************************************************************* ;******************************************************************************* ; user ( u -- ; <string> ) ; compile a new user variable. @token user,'USER' fdb token,sname,overt fdb dolit,dolst,callc ; add call to list proc fdb compi,douse,comma,exit ;******************************************************************************* ; create ( -- ; <string> ) ; compile a new array entry without allocating code space. @token creat,'CREATE' fdb token,sname,overt fdb dolit,dolst,callc fdb compi,dovar,exit ;******************************************************************************* ; variable ( -- ; <string> ) ; compile a new variable initialized to 0. @token varia,'VARIABLE' fdb creat,dolit,0,comma,exit ;******************************************************************************* ; tools ;******************************************************************************* ;******************************************************************************* ; _type ( b u -- ) ; display a string. filter non-printing characters. @token utype,'_TYPE' fdb tor ; start count down loop fdb bran,utyp2 ; skip first pass utyp1 fdb dup,cat,tchar,emit ; display only printable fdb dolit,1,plus ; increment address utyp2 fdb donxt,utyp1 ; loop till done fdb drop,exit ;******************************************************************************* ; dm+ ( a u -- a ) ; dump u bytes from , leaving a+u on the stack. @token dmp,'dm+' fdb over,dolit,4,udotr ; display address fdb space,tor ; start count down loop fdb bran,pdum2 ; skip first pass pdum1 fdb dup,cat,dolit,3,udotr ; display numeric data fdb dolit,1,plus ; increment address pdum2 fdb donxt,pdum1 ; loop till done fdb exit ;******************************************************************************* ; dump ( a u -- ) ; dump u bytes from a, in a formatted manner. @token dump,'DUMP' fdb base,at,tor,hex ; save radix, set hex fdb dolit,16,slash ; change count to lines fdb tor ; start count down loop dump1 fdb crr,dolit,16,ddup,dmp ; display numeric fdb rot,rot fdb space,space,utype ; display printable characters fdb nufq,inver ; user control fdb qbran,dump2 fdb donxt,dump1 ; loop till done fdb bran,dump3 dump2 fdb rfrom,drop ; cleanup loop stack, early exit dump3 fdb drop,rfrom,base,store ; restore radix fdb exit ;******************************************************************************* ; .s ( ... -- ... ) ; display the contents of the data stack. @token dots,'.S' fdb crr,depth ; stack depth fdb tor ; start count down loop fdb bran,dots2 ; skip first pass dots1 fdb rat,pick,dot ; index stack, display contents dots2 fdb donxt,dots1 ; loop till done fdb dotqp fcb 4 fcc ' <sp ' ; extra space for align fdb exit ;******************************************************************************* ; !csp ( -- ) ; save stack pointer in csp for error checking. @token stcsp,'!CSP' fdb spat,csp,store,exit ; save pointer ;******************************************************************************* ; ?csp ( -- ) ; abort if stack pointer differs from that saved in csp. @token qcsp,'?CSP' fdb spat,csp,at,xor ; compare pointers fdb aborq ; abort if different fcb 6 fcc 'stacks ' ; extra space for align fdb exit ;******************************************************************************* ; >name ( ca -- na | f ) ; convert code address to a name address. @token tname,'>NAME' fdb crrnt ; vocabulary link tnam1 fdb cellp,at,qdup ; check all vocabularies fdb qbran,tnam4 fdb ddup tnam2 fdb at,dup ; ?last word in a vocabulary fdb qbran,tnam3 fdb ddup,namet,xor ; compare fdb qbran,tnam3 fdb cellm ; continue with next word fdb bran,tnam2 tnam3 fdb swap,drop,qdup fdb qbran,tnam1 fdb swap,drop,swap,drop,exit tnam4 fdb drop,dolit,FALSE,exit ; false flag ;******************************************************************************* ; .id ( na -- ) ; display the name at address. @token dotid,'.ID' fdb qdup ; if zero no name fdb qbran,doti1 fdb count,dolit,$1F,and ; mask lexicon bits fdb utype,exit ; display name string doti1 fdb dotqp fcb 9 fcc ' {','noname}' fdb exit ;******************************************************************************* ; see ( -- ; <string> ) ; a simple decompiler. @token see,'SEE' fdb tick ; starting address fdb crr,cellp see1 fdb cellp,dup,at,dup ; ?does it contain a zero fdb qbran,see2 fdb tname ; ?is it a name see2 fdb qdup ; name address or zero fdb qbran,see3 fdb space,dotid ; display name fdb bran,see4 see3 fdb dup,at,udot ; display number see4 fdb nufq ; user control fdb qbran,see1 fdb drop,exit ;******************************************************************************* ; words ( -- ) ; display the names in the context vocabulary. @token words,'WORDS' fdb crr,cntxt,at ; only in context wors1 fdb at,qdup ; ?at end of list fdb qbran,wors2 fdb dup,space,dotid ; display a name fdb cellm,nufq ; user control fdb qbran,wors1 fdb drop wors2 fdb exit ;******************************************************************************* ; hardware reset ;******************************************************************************* ;******************************************************************************* ; ver ( -- n ) ; return the version number of this implementation. @token versn,'VER' fdb dolit,VER<8|EXT,exit ;******************************************************************************* ; hi ( -- ) ; display the sign-on message of eforth. @token hi,'hi' fdb stoio,crr ; initialize i/o fdb dotqp fcb 17 fcc ' 68hc11 eforth v ' ; model fdb base,at,hex ; save radix fdb versn,bdigs,dig,dig fdb dolit,'.',hold ; literal . fdb digs,edigs,typee ; format version number fdb base,store,crr,exit ; restore radix ;******************************************************************************* ; 'boot ( -- a ) ; the application startup vector. @token tboot,"'BOOT" fdb dovar fdb hi ; application to boot ;******************************************************************************* ; noop ( -- ) ; no-operation (runtime code for TASK) @token noop,'NOOP' fdb exit ;******************************************************************************* ; cold ( -- ) ; the hilevel cold start sequence. ; NOTE: cold must be the last word in the assembly language source ; file. TASK connects into the ROM-based dictionary by referencing ; COLDLINK in the following definition. coldlink equ *+4 @token cold,'COLD' cold1 fdb dolit,uzero,dolit,upp fdb dolit,::uzero ; initialize user area fdb cmove,prese ; initialize stack and tib fdb dolit,ntask ; initialize RAM name dictionary fdb dolit,NAMEE-::ntask fdb dolit,::ntask fdb cmove fdb dolit,NAMEE-::ntask ; initialize name pointer fdb np,store fdb dolit,NAMEE-::ntask+4 ; calc start of name in TASK fdb dup,last,store ; initialize LAST fdb vfrth,store ; initialize forth vocabulary ptr fdb tboot,atexe ; application boot fdb forth,cntxt,at,dup ; initialize search order fdb crrnt,dstor,overt fdb quit ; start interpretation fdb bran,cold1 ; just in case @vector Vreset,Start
alloy4fun_models/trashltl/models/1/hctjS83QNJoDevzGY.als
Kaixi26/org.alloytools.alloy
0
3059
<reponame>Kaixi26/org.alloytools.alloy open main pred idhctjS83QNJoDevzGY_prop2 { historically (no File until some File) } pred __repair { idhctjS83QNJoDevzGY_prop2 } check __repair { idhctjS83QNJoDevzGY_prop2 <=> prop2o }
regge-io.ads
leo-brewin/Regge
0
7848
<filename>regge-io.ads generic package regge.io is function str (source : in Integer; width : in Integer := 0) return string; function str (source : in Real; width : in Integer := 10) return string; function read_command_arg (the_arg : Integer) return Integer; procedure read_lattice; num : Integer; -- which one of the 8 datasets to read/check simp01 : Array (1 .. n_simp1_max) of Array1dIntg (1 .. 2); -- vertices of each leg -- used only in the io end regge.io;
asm/Ctrl_Break.asm
metlinskyi/archive
0
28448
; cod segment assume es:cod, ds:dan mov ax,dan mov ds,ax ; mov ax,351bh int 21h mov wordptr vec_1bh,bx mov wordptr vec_1bh+2,es ; mov ax,251bh push ds push cs pop ds lea dx,break int 21h ; mov ax,2523h lea dx,ctrlc int 21h pop ds ; ring:mov ah,02h mov dl,sym int 21h ; jmp ring ; break:push ax push es push cx push si push di mov ax,0b800h ; mov es,ax mov di,offs; lea si,break_mes mov cx,len_break rep movsb add offs,170 ; inc sym ; pop di pop si pop cx pop es pop ax iret ; ctrl: ; lds dx,vec_1bh mov ax,251bh int 21h ; mov ax,4c00h int 21h cod ends dan segment vec_1bh dd 0 sym db 'a' offs dw 800 break_mes db 'b',4,'r',2,'e',1,'a',4,'k',2 len_break equ $-break_mes dan ends end
test/Fail/Issue3566.agda
shlevy/agda
1,989
8300
<reponame>shlevy/agda postulate A : Set P : A → Set p : (a : A) → P a record R : Set where field a : A b : P _ b = p a test : A test = R.b
3-mid/impact/source/3d/dynamics/impact-d3-space-dynamic-discrete.adb
charlie5/lace
20
17231
<gh_stars>10-100 with impact.d3.Transform_Util, impact.d3.Scalar; with ada.Unchecked_Deallocation; with impact.d3.collision.overlapped_pair_Callback.cached; with impact.d3.Vector; with impact.d3.Transform; with impact.d3.Shape.convex.internal.sphere; with impact.d3.Joint.contact; with impact.d3.constraint_Solver.sequential_impulse; with impact.d3.Object; -- #include "impact.d3.Space.dynamic.discrete.h" -- -- //collision detection -- #include "BulletCollision/CollisionDispatch/impact.d3.Dispatcher.collision.h" -- #include "BulletCollision/BroadphaseCollision/btSimpleBroadphase.h" -- #include "BulletCollision/BroadphaseCollision/impact.d3.collision.Algorithm.h" -- #include "BulletCollision/CollisionShapes/impact.d3.Shape.h" -- #include "BulletCollision/CollisionDispatch/impact.d3.simulation_island_Manager.h" -- #include "LinearMath/impact.d3.TransformUtil.h" -- #include "LinearMath/btQuickprof.h" -- -- //rigidbody & constraints -- #include "BulletDynamics/Dynamics/impact.d3.Object.rigid.h" -- #include "BulletDynamics/ConstraintSolver/impact.d3.constraint_Solver.sequential_impulse.h" -- #include "BulletDynamics/ConstraintSolver/impact.d3.contact_solver_Info.h" -- #include "BulletDynamics/ConstraintSolver/impact.d3.Joint.h" -- #include "BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h" -- #include "BulletDynamics/ConstraintSolver/impact.d3.Joint.hinge.h" -- #include "BulletDynamics/ConstraintSolver/btConeTwistConstraint.h" -- #include "BulletDynamics/ConstraintSolver/impact.d3.Joint.any.h" -- #include "BulletDynamics/ConstraintSolver/btSliderConstraint.h" -- #include "BulletDynamics/ConstraintSolver/impact.d3.Joint.contact.h" -- -- -- #include "LinearMath/btIDebugDraw.h" -- #include "BulletCollision/CollisionShapes/impact.d3.Shape.convex.internal.sphere.h" -- -- -- #include "BulletDynamics/Dynamics/impact.d3.Action.h" -- #include "LinearMath/btQuickprof.h" -- #include "LinearMath/impact.d3.motion_State.h" -- -- #include "LinearMath/btSerializer.h" package body impact.d3.Space.dynamic.discrete is --- Forge -- package body Forge is function to_Space (dispatcher : access impact.d3.Dispatcher.item'Class; pairCache : access impact.d3.collision.Broadphase.Item'Class; constraintSolver : in impact.d3.constraint_Solver.view; CollisionConfiguration : access impact.d3.collision.Configuration.Item'Class) return Item is use type impact.d3.constraint_Solver.view; begin return Self : Item do impact.d3.Space.dynamic.Forge.define (impact.d3.Space.dynamic.item (Self), dispatcher, pairCache, collisionConfiguration); Self.m_constraintSolver := constraintSolver; Self.m_gravity := (0.0, -10.0, 0.0); Self.m_localTime := 0.0; Self.m_synchronizeAllMotionStates := False; Self.m_profileTimings := 0; if Self.m_constraintSolver = null then Self.m_constraintSolver := new impact.d3.constraint_Solver.sequential_impulse.item; Self.m_ownsConstraintSolver := True; else Self.m_ownsConstraintSolver := False; end if; Self.m_islandManager := new impact.d3.simulation_island_Manager.item; Self.m_ownsIslandManager := True; end return; end to_Space; end Forge; overriding procedure destruct (Self : in out Item) is procedure free is new ada.Unchecked_Deallocation (impact.d3.simulation_island_Manager.item'Class, impact.d3.simulation_island_Manager.view); procedure free is new ada.Unchecked_Deallocation (impact.d3.constraint_Solver.item'Class, impact.d3.constraint_Solver.view); begin if Self.m_ownsIslandManager then -- only delete it when we created it Self.m_islandManager.destruct; free (Self.m_islandManager); end if; if Self.m_ownsConstraintSolver then Self.m_constraintSolver.destruct; free (Self.m_constraintSolver); end if; end destruct; --- Attributes -- overriding function stepSimulation (Self : access Item; timeStep : in Real; maxSubSteps : in Integer := 1; fixedTimeStep : in Real := 1.0/60.0) return Integer is use impact.d3.Scalar; numSimulationSubSteps : Integer := 0; the_fixedTimeStep : Real := fixedTimeStep; the_maxSubSteps : Integer := maxSubSteps; pragma Unreferenced (the_maxSubSteps); begin if maxSubSteps /= 0 then Self.m_localTime := Self.m_localTime + the_fixedTimeStep; if Self.m_localTime >= the_fixedTimeStep then numSimulationSubSteps := Integer (Self.m_localTime / the_fixedTimeStep); Self.m_localTime := Self.m_localTime - Real (numSimulationSubSteps) * the_fixedTimeStep; end if; else the_fixedTimeStep := timeStep; Self.m_localTime := timeStep; if btFuzzyZero (timeStep) then numSimulationSubSteps := 0; the_maxSubSteps := 0; else numSimulationSubSteps := 1; the_maxSubSteps := 1; end if; end if; -- Skipping debug if numSimulationSubSteps /= 0 then declare clampedSimulationSteps : constant Integer := (if numSimulationSubSteps > maxSubSteps then maxSubSteps else numSimulationSubSteps); begin Self.saveKinematicState (the_fixedTimeStep * Real (clampedSimulationSteps)); Self.applyGravity; for I in 1 .. clampedSimulationSteps loop Self.internalSingleStepSimulation (the_fixedTimeStep); Self.synchronizeMotionStates; end loop; end; else Self.synchronizeMotionStates; end if; Self.clearForces; return numSimulationSubSteps; end stepSimulation; -- int impact.d3.Space.dynamic.discrete::stepSimulation( impact.d3.Scalar timeStep,int maxSubSteps, impact.d3.Scalar fixedTimeStep) -- { -- startProfiling(timeStep); -- -- BT_PROFILE("stepSimulation"); -- -- int numSimulationSubSteps = 0; -- -- if (maxSubSteps) -- { -- //fixed timestep with interpolation -- m_localTime += timeStep; -- if (m_localTime >= fixedTimeStep) -- { -- numSimulationSubSteps = int( m_localTime / fixedTimeStep); -- m_localTime -= numSimulationSubSteps * fixedTimeStep; -- } -- } else -- { -- //variable timestep -- fixedTimeStep = timeStep; -- m_localTime = timeStep; -- if (btFuzzyZero(timeStep)) -- { -- numSimulationSubSteps = 0; -- maxSubSteps = 0; -- } else -- { -- numSimulationSubSteps = 1; -- maxSubSteps = 1; -- } -- } -- -- //process some debugging flags -- if (getDebugDrawer()) -- { -- btIDebugDraw* debugDrawer = getDebugDrawer (); -- gDisableDeactivation = (debugDrawer->getDebugMode() & btIDebugDraw::DBG_NoDeactivation) != 0; -- } -- if (numSimulationSubSteps) -- { -- -- //clamp the number of substeps, to prevent simulation grinding spiralling down to a halt -- int clampedSimulationSteps = (numSimulationSubSteps > maxSubSteps)? maxSubSteps : numSimulationSubSteps; -- -- saveKinematicState(fixedTimeStep*clampedSimulationSteps); -- -- applyGravity(); -- -- -- -- for (int i=0;i<clampedSimulationSteps;i++) -- { -- internalSingleStepSimulation(fixedTimeStep); -- synchronizeMotionStates(); -- } -- -- } else -- { -- synchronizeMotionStates(); -- } -- -- clearForces(); -- -- #ifndef BT_NO_PROFILE -- CProfileManager::Increment_Frame_Counter(); -- #endif //BT_NO_PROFILE -- -- return numSimulationSubSteps; -- } procedure synchronizeSingleMotionState (Self : in out Item; the_body : access impact.d3.Object.rigid.Item'Class) is begin if the_body.getMotionState /= null and not the_body.isStaticOrKinematicObject then declare interpolatedTransform : Transform_3d; begin impact.d3.transform_Util.integrateTransform (the_body.getInterpolationWorldTransform, the_body.getInterpolationLinearVelocity, the_body.getInterpolationAngularVelocity, Self.m_localTime * the_body.getHitFraction, interpolatedTransform ); the_body.getMotionState.setWorldTransform (interpolatedTransform); end; end if; end synchronizeSingleMotionState; -- void impact.d3.Space.dynamic.discrete::synchronizeSingleMotionState(impact.d3.Object.rigid* body) -- { -- btAssert(body); -- -- if (body->getMotionState() && !body->isStaticOrKinematicObject()) -- { -- //we need to call the update at least once, even for sleeping objects -- //otherwise the 'graphics' transform never updates properly -- ///@todo: add 'dirty' flag -- //if (body->getActivationState() != ISLAND_SLEEPING) -- { -- impact.d3.Transform interpolatedTransform; -- impact.d3.TransformUtil::integrateTransform(body->getInterpolationWorldTransform(), -- body->getInterpolationLinearVelocity(),body->getInterpolationAngularVelocity(),m_localTime*body->getHitFraction(),interpolatedTransform); -- body->getMotionState()->setWorldTransform(interpolatedTransform); -- } -- } -- } overriding procedure synchronizeMotionStates (Self : in out Item) is begin if Self.m_synchronizeAllMotionStates then for I in 1 .. Integer (Self.get_m_collisionObjects.Length) loop declare colObj : constant impact.d3.Object.view := Self.get_m_collisionObjects.Element (I).all'Access; the_body : constant impact.d3.Object.rigid.view := impact.d3.Object.rigid.view (colObj); begin if the_body /= null then Self.synchronizeSingleMotionState (the_body); end if; end; end loop; else for I in 1 .. Integer (Self.m_nonStaticRigidBodies.Length) loop declare the_body : constant access impact.d3.Object.rigid.Item := Self.m_nonStaticRigidBodies.Element (I); begin if the_body.isActive then Self.synchronizeSingleMotionState (the_body); end if; end; end loop; end if; end synchronizeMotionStates; -- void impact.d3.Space.dynamic.discrete::synchronizeMotionStates() -- { -- BT_PROFILE("synchronizeMotionStates"); -- if (m_synchronizeAllMotionStates) -- { -- //iterate over all collision objects -- for ( int i=0;i<m_collisionObjects.size();i++) -- { -- impact.d3.Object* colObj = m_collisionObjects[i]; -- impact.d3.Object.rigid* body = impact.d3.Object.rigid::upcast(colObj); -- if (body) -- synchronizeSingleMotionState(body); -- } -- } else -- { -- //iterate over all active rigid bodies -- for ( int i=0;i<m_nonStaticRigidBodies.size();i++) -- { -- impact.d3.Object.rigid* body = m_nonStaticRigidBodies[i]; -- if (body->isActive()) -- synchronizeSingleMotionState(body); -- } -- } -- } overriding procedure addConstraint (Self : in out Item; constraint : access impact.d3.Joint.Item'Class; disableCollisionsBetweenLinkedBodies : Boolean := False) is begin raise Program_Error; -- tbd -- Self.m_constraints.push_back (constraint); -- -- if disableCollisionsBetweenLinkedBodies then -- constraint.getRigidBodyA.addConstraintRef (Self, constraint); -- constraint.getRigidBodyB.addConstraintRef (Self, constraint); -- end if; end addConstraint; -- void impact.d3.Space.dynamic.discrete::addConstraint(impact.d3.Joint* constraint,bool disableCollisionsBetweenLinkedBodies) -- { -- m_constraints.push_back(constraint); -- if (disableCollisionsBetweenLinkedBodies) -- { -- constraint->getRigidBodyA().addConstraintRef(constraint); -- constraint->getRigidBodyB().addConstraintRef(constraint); -- } -- } overriding procedure removeConstraint (Self : in out Item; constraint : access impact.d3.Joint.Item'Class) is begin raise Program_Error; -- tbd -- Self.m_constraints.remove (constraint); -- constraint.getRigidBodyA.removeConstraintRef (constraint); -- constraint.getRigidBodyB.removeConstraintRef (constraint); end removeConstraint; -- void impact.d3.Space.dynamic.discrete::removeConstraint(impact.d3.Joint* constraint) -- { -- m_constraints.remove(constraint); -- constraint->getRigidBodyA().removeConstraintRef(constraint); -- constraint->getRigidBodyB().removeConstraintRef(constraint); -- } procedure addAction (Self : in out Item; Action_Interface : access impact.d3.Action.Item'Class) is begin raise Program_Error; -- tbd -- Self.m_actions.push_back (action); end addAction; -- void impact.d3.Space.dynamic.discrete::addAction(impact.d3.Action* action) -- { -- m_actions.push_back(action); -- } procedure removeAction (Self : in out Item; Action_Interface : access impact.d3.Action.Item'Class) is begin raise Program_Error; -- tbd -- Self.m_actions.remove (action); end removeAction; -- void impact.d3.Space.dynamic.discrete::removeAction(impact.d3.Action* action) -- { -- m_actions.remove(action); -- } function getSimulationIslandManager (Self : in Item) return access impact.d3.simulation_island_Manager.Item'Class is begin return Self.m_islandManager; end getSimulationIslandManager; -- impact.d3.simulation_island_Manager* getSimulationIslandManager() -- { -- return m_islandManager; -- } -- function getCollisionWorld (Self : access Item) return impact.d3.Space.view -- is -- begin -- return impact.d3.Space.view (Self); -- end getCollisionWorld; -- impact.d3.Space* getCollisionWorld() -- { -- return this; -- } overriding procedure setGravity (Self : in out Item; gravity : in Vector_3) is use impact.d3.Object.rigid; use type Flags; begin Self.m_gravity := gravity; for I in 1 .. Integer (Self.m_nonStaticRigidBodies.Length) loop declare the_body : constant access impact.d3.Object.rigid.Item := Self.m_nonStaticRigidBodies.Element (I); begin if the_body.isActive and then not ((the_body.getFlags and BT_DISABLE_WORLD_GRAVITY) /= 0) then the_body.setGravity (gravity); end if; end; end loop; end setGravity; -- void impact.d3.Space.dynamic.discrete::setGravity(const impact.d3.Vector& gravity) -- { -- m_gravity = gravity; -- for ( int i=0;i<m_nonStaticRigidBodies.size();i++) -- { -- impact.d3.Object.rigid* body = m_nonStaticRigidBodies[i]; -- if (body->isActive() && !(body->getFlags() &BT_DISABLE_WORLD_GRAVITY)) -- { -- body->setGravity(gravity); -- } -- } -- } overriding function getGravity (Self : in Item) return Vector_3 is begin return Self.m_gravity; end getGravity; -- impact.d3.Vector impact.d3.Space.dynamic.discrete::getGravity () const -- { -- return m_gravity; -- } -- procedure addCollisionObject (Self : in out Item; -- collisionObject : access impact.d3.Object.impact.d3.Object'Class; -- collisionFilterGroup : in CollisionFilterGroups := StaticFilter; -- collisionFilterMask : in CollisionFilterGroups := AllFilter xor StaticFilter) -- is -- begin -- impact.d3.Space.addCollisionObject (impact.d3.Space.item (Self), -- collisionObject, -- collisionFilterGroup, -- collisionFilterMask); -- end addCollisionObject; -- void impact.d3.Space.dynamic.discrete::addCollisionObject(impact.d3.Object* collisionObject,short int collisionFilterGroup,short int collisionFilterMask) -- { -- impact.d3.Space::addCollisionObject(collisionObject,collisionFilterGroup,collisionFilterMask); -- } overriding procedure addRigidBody (Self : in out Item; the_body : access impact.d3.Object.rigid.Item'Class) is use impact.d3.Object.rigid; use impact.d3.Object; use type Flags; begin if not the_body.isStaticOrKinematicObject and then (the_body.getFlags and BT_DISABLE_WORLD_GRAVITY) = 0 then the_body.setGravity (Self.m_gravity); end if; if the_body.getCollisionShape /= null then if not the_body.isStaticObject then Self.m_nonStaticRigidBodies.append (the_body.all'Access); else the_body.setActivationState (ISLAND_SLEEPING); end if; declare function Crap_A (Exp : Boolean) return CollisionFilterGroups is begin if Exp then return impact.d3.collision.Proxy.DefaultFilter; else return impact.d3.collision.Proxy.StaticFilter; end if; end Crap_A; function Crap_B (Exp : Boolean) return CollisionFilterGroups is begin if Exp then return impact.d3.collision.Proxy.AllFilter; else return impact.d3.collision.Proxy.AllFilter xor impact.d3.collision.Proxy.StaticFilter; end if; end Crap_B; isDynamic : constant Boolean := not (the_body.isStaticObject or the_body.isKinematicObject); collisionFilterGroup : constant CollisionFilterGroups := Crap_A (isDynamic); collisionFilterMask : constant CollisionFilterGroups := Crap_B (isDynamic); begin addCollisionObject (Self, the_body.all'Access, collisionFilterGroup, collisionFilterMask); end; end if; end addRigidBody; -- void impact.d3.Space.dynamic.discrete::addRigidBody(impact.d3.Object.rigid* body) -- { -- if (!body->isStaticOrKinematicObject() && !(body->getFlags() &BT_DISABLE_WORLD_GRAVITY)) -- { -- body->setGravity(m_gravity); -- } -- -- if (body->getCollisionShape()) -- { -- if (!body->isStaticObject()) -- { -- m_nonStaticRigidBodies.push_back(body); -- } else -- { -- body->setActivationState(ISLAND_SLEEPING); -- } -- -- bool isDynamic = !(body->isStaticObject() || body->isKinematicObject()); -- short collisionFilterGroup = isDynamic? short(impact.d3.collision.Proxy::DefaultFilter) : short(impact.d3.collision.Proxy::StaticFilter); -- short collisionFilterMask = isDynamic? short(impact.d3.collision.Proxy::AllFilter) : short(impact.d3.collision.Proxy::AllFilter ^ impact.d3.collision.Proxy::StaticFilter); -- -- addCollisionObject(body,collisionFilterGroup,collisionFilterMask); -- } -- } procedure addRigidBody (Self : in out Item; the_body : access impact.d3.Object.rigid.Item'Class; group : in CollisionFilterGroups; mask : in CollisionFilterGroups ) is use impact.d3.Object.rigid; use impact.d3.Object; use type Flags; begin if not the_body.isStaticOrKinematicObject and then not ((the_body.getFlags and BT_DISABLE_WORLD_GRAVITY) /= 0) then the_body.setGravity (Self.m_gravity); end if; if the_body.getCollisionShape /= null then if not the_body.isStaticObject then Self.m_nonStaticRigidBodies.append (the_body.all'Access); else the_body.setActivationState (ISLAND_SLEEPING); end if; addCollisionObject (Self, the_body, group, mask); end if; end addRigidBody; -- void impact.d3.Space.dynamic.discrete::addRigidBody(impact.d3.Object.rigid* body, short group, short mask) -- { -- if (!body->isStaticOrKinematicObject() && !(body->getFlags() &BT_DISABLE_WORLD_GRAVITY)) -- { -- body->setGravity(m_gravity); -- } -- -- if (body->getCollisionShape()) -- { -- if (!body->isStaticObject()) -- { -- m_nonStaticRigidBodies.push_back(body); -- } -- else -- { -- body->setActivationState(ISLAND_SLEEPING); -- } -- addCollisionObject(body,group,mask); -- } -- } procedure removeRigidBody (Self : in out Item; the_body : access impact.d3.Object.rigid.Item'Class) is the_Index : constant Index := Self.m_nonStaticRigidBodies.find_Index (the_body.all'Access); begin if the_Index /= 0 then Self.m_nonStaticRigidBodies.delete (the_Index); end if; impact.d3.Space.removeCollisionObject (impact.d3.Space.item (Self), the_body); end removeRigidBody; -- void impact.d3.Space.dynamic.discrete::removeRigidBody(impact.d3.Object.rigid* body) -- { -- m_nonStaticRigidBodies.remove(body); -- impact.d3.Space::removeCollisionObject(body); -- } overriding procedure removeCollisionObject (Self : in out Item; collisionObject : access impact.d3.Object.item'Class) is the_body : constant impact.d3.Object.rigid.view := impact.d3.Object.rigid.view (collisionObject); begin if the_body /= null then Self.removeRigidBody (the_body); else impact.d3.Space.removeCollisionObject (impact.d3.Space.item (Self), collisionObject); end if; end removeCollisionObject; -- void impact.d3.Space.dynamic.discrete::removeCollisionObject(impact.d3.Object* collisionObject) -- { -- impact.d3.Object.rigid* body = impact.d3.Object.rigid::upcast(collisionObject); -- if (body) -- removeRigidBody(body); -- else -- impact.d3.Space::removeCollisionObject(collisionObject); -- } procedure setConstraintSolver (Self : in out Item; solver : access impact.d3.constraint_Solver.Item'Class) is procedure free is new ada.Unchecked_Deallocation (impact.d3.constraint_Solver.Item'Class, impact.d3.constraint_Solver.View); begin if Self.m_ownsConstraintSolver then free (Self.m_constraintSolver); end if; Self.m_ownsConstraintSolver := False; Self.m_constraintSolver := solver.all'Access; end setConstraintSolver; -- void impact.d3.Space.dynamic.discrete::setConstraintSolver(impact.d3.constraint_Solver* solver) -- { -- if (m_ownsConstraintSolver) -- { -- btAlignedFree( m_constraintSolver); -- } -- m_ownsConstraintSolver = false; -- m_constraintSolver = solver; -- } overriding function getConstraintSolver (Self : in Item) return access impact.d3.constraint_Solver.Item'Class is begin return Self.m_constraintSolver; end getConstraintSolver; -- impact.d3.constraint_Solver* impact.d3.Space.dynamic.discrete::getConstraintSolver() -- { -- return m_constraintSolver; -- } overriding function getNumConstraints (Self : in Item) return Integer is begin return Integer (Self.m_constraints.Length); end getNumConstraints; -- int impact.d3.Space.dynamic.discrete::getNumConstraints() const -- { -- return int(m_constraints.size()); -- } overriding function getConstraint (Self : in Item; index : in Integer) return access impact.d3.Joint.Item'Class is begin return Self.m_constraints.Element (index); end getConstraint; -- impact.d3.Joint* impact.d3.Space.dynamic.discrete::getConstraint(int index) -- { -- return m_constraints[index]; -- } overriding function getWorldType (Self : in Item) return impact.d3.Space.dynamic.Kind is pragma Unreferenced (Self); -- BT_DISCRETE_DYNAMICS_WORLD : impact.d3.Space.dynamic.Kind; begin return discrete_Kind; -- BT_DISCRETE_DYNAMICS_WORLD; end getWorldType; -- virtual impact.d3.Space.dynamicType getWorldType() const -- { -- return BT_DISCRETE_DYNAMICS_WORLD; -- } overriding procedure clearForces (Self : in out Item) is begin for I in 1 .. Integer (Self.m_nonStaticRigidBodies.Length) loop declare The_Body : constant access impact.d3.Object.rigid.Item'Class := Self.m_nonStaticRigidBodies.Element (I); begin The_Body.clearForces; end; end loop; end clearForces; -- void impact.d3.Space.dynamic.discrete::clearForces() -- { -- ///@todo: iterate over awake simulation islands! -- for ( int i=0;i<m_nonStaticRigidBodies.size();i++) -- { -- impact.d3.Object.rigid* body = m_nonStaticRigidBodies[i]; -- //need to check if next line is ok -- //it might break backward compatibility (people applying forces on sleeping objects get never cleared and accumulate on wake-up -- body->clearForces(); -- } -- } -- procedure applyGravity (Self : in out Item) is begin for I in 1 .. Integer (Self.m_nonStaticRigidBodies.Length) loop declare The_Body : constant access impact.d3.Object.rigid.Item'Class := Self.m_nonStaticRigidBodies.Element (I); begin if The_Body.isActive then The_Body.applyGravity; end if; end; end loop; end applyGravity; -- ///apply gravity, call this once per timestep -- void impact.d3.Space.dynamic.discrete::applyGravity() -- { -- ///@todo: iterate over awake simulation islands! -- for ( int i=0;i<m_nonStaticRigidBodies.size();i++) -- { -- impact.d3.Object.rigid* body = m_nonStaticRigidBodies[i]; -- if (body->isActive()) -- { -- body->applyGravity(); -- } -- } -- } -- procedure setNumTasks (Self : in Item; -- numTasks : in Integer) -- is -- begin -- null; -- end setNumTasks; procedure setSynchronizeAllMotionStates (Self : in out Item; synchronizeAll : in Boolean) is begin Self.m_synchronizeAllMotionStates := synchronizeAll; end setSynchronizeAllMotionStates; -- void setSynchronizeAllMotionStates(bool synchronizeAll) -- { -- m_synchronizeAllMotionStates = synchronizeAll; -- } function getSynchronizeAllMotionStates (Self : in Item) return Boolean is begin return Self.m_synchronizeAllMotionStates; end getSynchronizeAllMotionStates; -- bool getSynchronizeAllMotionStates() const -- { -- return m_synchronizeAllMotionStates; -- } -- procedure serialize (Self : in Item; -- serializer : access btSerializer.Item'Class) -- is -- begin -- null; -- end serialize; procedure predictUnconstraintMotion (Self : in out Item; timeStep : in Real) is use impact.d3.Object; begin for I in 1 .. Integer (Self.m_nonStaticRigidBodies.Length) loop declare the_body : constant access impact.d3.Object.rigid.Item := Self.m_nonStaticRigidBodies.Element (I); begin if not the_body.isStaticOrKinematicObject then the_body.integrateVelocities (timeStep); the_body.applyDamping (timeStep); the_body.predictIntegratedTransform (timeStep, the_body.getInterpolationWorldTransform.all); end if; end; end loop; end predictUnconstraintMotion; -- void impact.d3.Space.dynamic.discrete::predictUnconstraintMotion(impact.d3.Scalar timeStep) -- { -- BT_PROFILE("predictUnconstraintMotion"); -- for ( int i=0;i<m_nonStaticRigidBodies.size();i++) -- { -- impact.d3.Object.rigid* body = m_nonStaticRigidBodies[i]; -- if (!body->isStaticOrKinematicObject()) -- { -- body->integrateVelocities( timeStep); -- //damping -- body->applyDamping(timeStep); -- -- body->predictIntegratedTransform(timeStep,body->getInterpolationWorldTransform()); -- } -- } -- } procedure calculateSimulationIslands (Self : access Item) is numConstraints : constant Integer := Integer (Self.m_constraints.Length); begin Self.getSimulationIslandManager.updateActivationState (Self, -- .getCollisionWorld, Self.getDispatcher); for I in 1 .. numConstraints loop declare constraint : constant access impact.d3.Joint.Item := Self.m_constraints.Element (I); colObj0 : constant impact.d3.Object.rigid.view := constraint.getRigidBodyA; colObj1 : constant impact.d3.Object.rigid.view := constraint.getRigidBodyB; begin if colObj0 /= null and then not colObj0.isStaticOrKinematicObject and then colObj1 /= null and then not colObj1.isStaticOrKinematicObject then if colObj0.isActive or else colObj1.isActive then Self.getSimulationIslandManager.getUnionFind.unite (colObj0.getIslandTag, colObj1.getIslandTag); end if; end if; end; end loop; -- Store the island id in each body -- Self.getSimulationIslandManager.storeIslandActivationState (Self); end calculateSimulationIslands; -- void impact.d3.Space.dynamic.discrete::calculateSimulationIslands() -- { -- BT_PROFILE("calculateSimulationIslands"); -- -- getSimulationIslandManager()->updateActivationState(getCollisionWorld(),getCollisionWorld()->getDispatcher()); -- -- { -- int i; -- int numConstraints = int(m_constraints.size()); -- for (i=0;i< numConstraints ; i++ ) -- { -- impact.d3.Joint* constraint = m_constraints[i]; -- -- const impact.d3.Object.rigid* colObj0 = &constraint->getRigidBodyA(); -- const impact.d3.Object.rigid* colObj1 = &constraint->getRigidBodyB(); -- -- if (((colObj0) && (!(colObj0)->isStaticOrKinematicObject())) && -- ((colObj1) && (!(colObj1)->isStaticOrKinematicObject()))) -- { -- if (colObj0->isActive() || colObj1->isActive()) -- { -- -- getSimulationIslandManager()->getUnionFind().unite((colObj0)->getIslandTag(), -- (colObj1)->getIslandTag()); -- } -- } -- } -- } -- -- //Store the island id in each body -- getSimulationIslandManager()->storeIslandActivationState(getCollisionWorld()); -- -- -- } function btGetConstraintIslandId (lhs : in impact.d3.Joint.Item'Class) return Integer is rcolObj0 : impact.d3.Object.item'Class renames impact.d3.Object.item'Class (lhs.getRigidBodyA.all); rcolObj1 : impact.d3.Object.item'Class renames impact.d3.Object.item'Class (lhs.getRigidBodyB.all); islandId : Integer; begin if rcolObj0.getIslandTag >= 0 then islandId := rcolObj0.getIslandTag; else islandId := rcolObj1.getIslandTag; end if; return islandId; end btGetConstraintIslandId; -- -- SIMD_FORCE_INLINE int btGetConstraintIslandId(const impact.d3.Joint* lhs) -- { -- int islandId; -- -- const impact.d3.Object& rcolObj0 = lhs->getRigidBodyA(); -- const impact.d3.Object& rcolObj1 = lhs->getRigidBodyB(); -- islandId= rcolObj0.getIslandTag()>=0?rcolObj0.getIslandTag():rcolObj1.getIslandTag(); -- return islandId; -- -- } overriding procedure ProcessIsland (Self : access InplaceSolverIslandCallback; bodies : access impact.d3.Object.Vector; manifolds : access impact.d3.Manifold.Vector; islandId : in Integer ) is use type ada.Containers.Count_type; unused : math.Real; pragma Unreferenced (unused); begin if islandId < 0 then if manifolds.Length + Self.m_sortedConstraints.Length > 0 then -- we don't split islands, so all constraints/contact manifolds/bodies are passed into the solver regardless the island id unused := Self.m_solver.solveGroup (bodies, -- Integer (bodies.Length), manifolds, -- Integer (manifolds), Self.m_sortedConstraints, -- Self.m_numConstraints, Self.m_solverInfo.all, Self.m_dispatcher.all); null; end if; else -- also add all non-contact constraints/joints for this island declare use impact.d3.Joint.Vectors; -- startConstraint : access impact.d3.Joint.Item := null; startConstraint : Integer; numCurConstraints : Integer := 0; the_island_Constraints : aliased impact.d3.Joint.Vector; unused : math.Real; pragma Unreferenced (unused); i : Integer := 0; begin -- find the first constraint for this island -- while i < Integer (Self.m_sortedConstraints.Length) loop if btGetConstraintIslandId (Self.m_sortedConstraints.Element (i + 1).all) = islandId then -- startConstraint := Self.m_sortedConstraints.all (I); startConstraint := I; exit; end if; i := i + 1; end loop; -- count the number of constraints in this island -- while i < Integer (Self.m_sortedConstraints.Length) loop if btGetConstraintIslandId (Self.m_sortedConstraints.Element (i + 1).all) = islandId then the_island_Constraints.append (Self.m_sortedConstraints.Element (i + 1)); numCurConstraints := numCurConstraints + 1; end if; i := i + 1; end loop; if Self.m_solverInfo.m_minimumSolverBatchSize <= 1 then -- only call solveGroup if there is some work: avoid virtual function call, its overhead can be excessive -- if Integer (manifolds.Length) + numCurConstraints /= 0 then unused := Self.m_solver.solveGroup (bodies .all'Access, manifolds.all'Access, the_island_Constraints'Access, Self.m_solverInfo.all, Self.m_dispatcher.all); end if; else for I in 1 .. Integer (bodies.Length) loop Self.m_bodies.append (bodies.Element (I)); end loop; for I in 1 .. Integer (manifolds.Length) loop Self.m_manifolds.append (manifolds.Element (I)); end loop; for I in 1 .. numCurConstraints loop Self.m_constraints.append (Self.m_sortedConstraints.Element (startConstraint + I - 1)); end loop; if Integer (Self.m_constraints.Length) + Integer (Self.m_manifolds.Length) > Self.m_solverInfo.m_minimumSolverBatchSize then processConstraints (Self.all); else null; end if; end if; end; end if; end ProcessIsland; procedure processConstraints (Self : in out InplaceSolverIslandCallback) is use type ada.Containers.Count_Type; begin if Self.m_manifolds.Length + Self.m_constraints.Length > 0 then declare bodies : constant access impact.d3.Object.Vector := Self.m_bodies 'Access; manifold : constant access impact.d3.Manifold.Vector := Self.m_manifolds 'Access; constraints : constant access impact.d3.Joint.Vector := Self.m_constraints'Access; unused : math.Real; pragma Unreferenced (unused); begin -- m_solver->solveGroup( bodies,m_bodies.size(),manifold, m_manifolds.size(),constraints, m_constraints.size() ,m_solverInfo,m_debugDrawer,m_stackAlloc,m_dispatcher); unused := Self.m_solver.solveGroup (bodies, manifold, constraints, Self.m_solverInfo.all, Self.m_dispatcher.all); end; end if; Self.m_bodies .reserve_Capacity (0); Self.m_bodies.Clear; Self.m_manifolds .reserve_Capacity (0); Self.m_manifolds.Clear; Self.m_constraints.reserve_Capacity (0); Self.m_constraints.Clear; end processConstraints; procedure solveConstraints (Self : access Item; solverInfo : access impact.d3.contact_solver_Info.Item'Class) is function to_InplaceSolverIslandCallback (solverInfo : access impact.d3.contact_solver_Info.Item'Class; solver : access impact.d3.constraint_Solver.Item'Class; sortedConstraints : access impact.d3.Joint.Vector; dispatcher : access impact.d3.Dispatcher.item'Class) return InplaceSolverIslandCallback is Self : InplaceSolverIslandCallback; begin Self.m_solverInfo := solverInfo; Self.m_solver := solver; Self.m_sortedConstraints := sortedConstraints; Self.m_dispatcher := dispatcher; return Self; end to_InplaceSolverIslandCallback; begin declare use impact.d3.Joint.Vectors; sortedConstraints : aliased impact.d3.Joint.Vector; function "<" (L, R : in impact.d3.Joint.view) return Boolean is rIslandId0, lIslandId0 : Integer; begin rIslandId0 := btGetConstraintIslandId (R.all); lIslandId0 := btGetConstraintIslandId (L.all); return lIslandId0 < rIslandId0; end "<"; package Sorter is new impact.d3.Joint.Vectors.Generic_Sorting ("<"); -- class btSortConstraintOnIslandPredicate -- { -- public: -- -- bool operator() ( const impact.d3.Joint* lhs, const impact.d3.Joint* rhs ) -- { -- int rIslandId0,lIslandId0; -- rIslandId0 = btGetConstraintIslandId(rhs); -- lIslandId0 = btGetConstraintIslandId(lhs); -- return lIslandId0 < rIslandId0; -- } -- }; begin sortedConstraints.reserve_Capacity (Self.m_constraints.Length); -- tbd: probly unneeded. sortedConstraints := Self.m_constraints; -- for I in 1 .. Integer (getNumConstraints (Self.all)) loop -- sortedConstraints (I) := Self.m_constraints (I); -- end loop; Sorter.sort (sortedConstraints); -- sortedConstraints.quickSort (btSortConstraintOnIslandPredicate (Self)); declare -- constraintsPtr : access impact.d3.Joint.Item := sortedConstraints'access; solverCallback : aliased InplaceSolverIslandCallback := to_InplaceSolverIslandCallback (solverInfo, Self.m_constraintSolver, sortedConstraints'Unchecked_Access, Self.getDispatcher); begin Self.m_constraintSolver.prepareSolve (Self.getNumCollisionObjects, Self.getDispatcher.getNumManifolds); -- Solve all the constraints for this island. -- Self.m_islandManager.buildAndProcessIslands (Self.getDispatcher, Self, solverCallback'Access); solverCallback.processConstraints; Self.m_constraintSolver.allSolved (solverInfo.all); end; end; end solveConstraints; -- sortedConstraints.quickSort(btSortConstraintOnIslandPredicate()); -- -- impact.d3.Joint** constraintsPtr = getNumConstraints() ? &sortedConstraints[0] : 0; -- -- InplaceSolverIslandCallback solverCallback( solverInfo, m_constraintSolver, constraintsPtr,sortedConstraints.size(), m_debugDrawer,m_stackAlloc,m_dispatcher1); -- -- m_constraintSolver->prepareSolve(getCollisionWorld()->getNumCollisionObjects(), getCollisionWorld()->getDispatcher()->getNumManifolds()); -- -- /// solve all the constraints for this island -- m_islandManager->buildAndProcessIslands(getCollisionWorld()->getDispatcher(),getCollisionWorld(),&solverCallback); -- -- solverCallback.processConstraints(); -- -- m_constraintSolver->allSolved(solverInfo, m_debugDrawer, m_stackAlloc); -- void impact.d3.Space.dynamic.discrete::solveConstraints(impact.d3.contact_solver_Info& solverInfo) -- { -- struct InplaceSolverIslandCallback : public impact.d3.simulation_island_Manager::IslandCallback -- { -- -- impact.d3.contact_solver_Info& m_solverInfo; -- impact.d3.constraint_Solver* m_solver; -- impact.d3.Joint** m_sortedConstraints; -- int m_numConstraints; -- btIDebugDraw* m_debugDrawer; -- btStackAlloc* m_stackAlloc; -- impact.d3.Dispatcher* m_dispatcher; -- -- btAlignedObjectArray<impact.d3.Object*> m_bodies; -- btAlignedObjectArray<impact.d3.Manifold*> m_manifolds; -- btAlignedObjectArray<impact.d3.Joint*> m_constraints; -- -- -- InplaceSolverIslandCallback( -- impact.d3.contact_solver_Info& solverInfo, -- impact.d3.constraint_Solver* solver, -- impact.d3.Joint** sortedConstraints, -- int numConstraints, -- btIDebugDraw* debugDrawer, -- btStackAlloc* stackAlloc, -- impact.d3.Dispatcher* dispatcher) -- :m_solverInfo(solverInfo), -- m_solver(solver), -- m_sortedConstraints(sortedConstraints), -- m_numConstraints(numConstraints), -- m_debugDrawer(debugDrawer), -- m_stackAlloc(stackAlloc), -- m_dispatcher(dispatcher) -- { -- -- } -- -- -- InplaceSolverIslandCallback& operator=(InplaceSolverIslandCallback& other) -- { -- btAssert(0); -- (void)other; -- return *this; -- } -- virtual void ProcessIsland(impact.d3.Object** bodies,int numBodies,impact.d3.Manifold** manifolds,int numManifolds, int islandId) -- { -- if (islandId<0) -- { -- if (numManifolds + m_numConstraints) -- { -- ///we don't split islands, so all constraints/contact manifolds/bodies are passed into the solver regardless the island id -- m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,&m_sortedConstraints[0],m_numConstraints,m_solverInfo,m_debugDrawer,m_stackAlloc,m_dispatcher); -- } -- } else -- { -- //also add all non-contact constraints/joints for this island -- impact.d3.Joint** startConstraint = 0; -- int numCurConstraints = 0; -- int i; -- -- //find the first constraint for this island -- for (i=0;i<m_numConstraints;i++) -- { -- if (btGetConstraintIslandId(m_sortedConstraints[i]) == islandId) -- { -- startConstraint = &m_sortedConstraints[i]; -- break; -- } -- } -- //count the number of constraints in this island -- for (;i<m_numConstraints;i++) -- { -- if (btGetConstraintIslandId(m_sortedConstraints[i]) == islandId) -- { -- numCurConstraints++; -- } -- } -- -- if (m_solverInfo.m_minimumSolverBatchSize<=1) -- { -- ///only call solveGroup if there is some work: avoid virtual function call, its overhead can be excessive -- if (numManifolds + numCurConstraints) -- { -- m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,startConstraint,numCurConstraints,m_solverInfo,m_debugDrawer,m_stackAlloc,m_dispatcher); -- } -- } else -- { -- -- for (i=0;i<numBodies;i++) -- m_bodies.push_back(bodies[i]); -- for (i=0;i<numManifolds;i++) -- m_manifolds.push_back(manifolds[i]); -- for (i=0;i<numCurConstraints;i++) -- m_constraints.push_back(startConstraint[i]); -- if ((m_constraints.size()+m_manifolds.size())>m_solverInfo.m_minimumSolverBatchSize) -- { -- processConstraints(); -- } else -- { -- //printf("deferred\n"); -- } -- } -- } -- } -- void processConstraints() -- { -- if (m_manifolds.size() + m_constraints.size()>0) -- { -- -- impact.d3.Object** bodies = m_bodies.size()? &m_bodies[0]:0; -- impact.d3.Manifold** manifold = m_manifolds.size()?&m_manifolds[0]:0; -- impact.d3.Joint** constraints = m_constraints.size()?&m_constraints[0]:0; -- -- m_solver->solveGroup( bodies,m_bodies.size(),manifold, m_manifolds.size(),constraints, m_constraints.size() ,m_solverInfo,m_debugDrawer,m_stackAlloc,m_dispatcher); -- } -- m_bodies.resize(0); -- m_manifolds.resize(0); -- m_constraints.resize(0); -- -- } -- -- }; -- -- -- -- //sorted version of all impact.d3.Joint, based on islandId -- btAlignedObjectArray<impact.d3.Joint*> sortedConstraints; -- sortedConstraints.resize( m_constraints.size()); -- int i; -- for (i=0;i<getNumConstraints();i++) -- { -- sortedConstraints[i] = m_constraints[i]; -- } -- -- // btAssert(0); -- -- -- -- sortedConstraints.quickSort(btSortConstraintOnIslandPredicate()); -- -- impact.d3.Joint** constraintsPtr = getNumConstraints() ? &sortedConstraints[0] : 0; -- -- InplaceSolverIslandCallback solverCallback( solverInfo, m_constraintSolver, constraintsPtr,sortedConstraints.size(), m_debugDrawer,m_stackAlloc,m_dispatcher1); -- -- m_constraintSolver->prepareSolve(getCollisionWorld()->getNumCollisionObjects(), getCollisionWorld()->getDispatcher()->getNumManifolds()); -- -- /// solve all the constraints for this island -- m_islandManager->buildAndProcessIslands(getCollisionWorld()->getDispatcher(),getCollisionWorld(),&solverCallback); -- -- solverCallback.processConstraints(); -- -- m_constraintSolver->allSolved(solverInfo, m_debugDrawer, m_stackAlloc); -- } procedure updateActivationState (Self : in Item; timeStep : in Real) is use impact.d3.Object.rigid; begin for I in 1 .. Integer (Self.m_nonStaticRigidBodies.Length) loop declare use impact.d3.Object; the_body : constant access impact.d3.Object.rigid.Item := Self.m_nonStaticRigidBodies.Element (I); begin if the_body /= null then the_body.updateDeactivation (timeStep); if the_body.wantsSleeping then if the_body.isStaticOrKinematicObject then the_body.setActivationState (ISLAND_SLEEPING); else if the_body.getActivationState = ACTIVE_TAG then the_body.setActivationState (WANTS_DEACTIVATION); end if; if the_body.getActivationState = ISLAND_SLEEPING then the_body.setAngularVelocity ((0.0, 0.0, 0.0)); the_body.setLinearVelocity ((0.0, 0.0, 0.0)); end if; end if; else if the_body.getActivationState /= DISABLE_DEACTIVATION then the_body.setActivationState (ACTIVE_TAG); end if; end if; end if; end; end loop; end updateActivationState; -- void impact.d3.Space.dynamic.discrete::updateActivationState(impact.d3.Scalar timeStep) -- { -- BT_PROFILE("updateActivationState"); -- -- for ( int i=0;i<m_nonStaticRigidBodies.size();i++) -- { -- impact.d3.Object.rigid* body = m_nonStaticRigidBodies[i]; -- if (body) -- { -- body->updateDeactivation(timeStep); -- -- if (body->wantsSleeping()) -- { -- if (body->isStaticOrKinematicObject()) -- { -- body->setActivationState(ISLAND_SLEEPING); -- } else -- { -- if (body->getActivationState() == ACTIVE_TAG) -- body->setActivationState( WANTS_DEACTIVATION ); -- if (body->getActivationState() == ISLAND_SLEEPING) -- { -- body->setAngularVelocity(impact.d3.Vector(0,0,0)); -- body->setLinearVelocity(impact.d3.Vector(0,0,0)); -- } -- -- } -- } else -- { -- if (body->getActivationState() != DISABLE_DEACTIVATION) -- body->setActivationState( ACTIVE_TAG ); -- } -- } -- } -- } -- procedure updateActions (Self : in out Item; timeStep : in Real) is begin null; -- tbd -- for I in 1 .. Self.m_actions.Length loop -- Self.m_actions(I).updateAction (Self, timeStep); -- end loop; end updateActions; -- void impact.d3.Space.dynamic.discrete::updateActions(impact.d3.Scalar timeStep) -- { -- BT_PROFILE("updateActions"); -- -- for ( int i=0;i<m_actions.size();i++) -- { -- m_actions[i]->updateAction( this, timeStep); -- } -- } procedure startProfiling (Self : in Item; timeStep : in Real) is begin null; end startProfiling; procedure internalSingleStepSimulation (Self : access item; timeStep : in Real) is use impact.d3.Space.dynamic; begin if Self.m_internalPreTickCallback /= null then Self.m_internalPreTickCallback.all (Self, timeStep); end if; predictUnconstraintMotion (Self.all, timeStep); declare dispatchInfo : constant access impact.d3.Dispatcher.DispatcherInfo := Self.getDispatchInfo; begin dispatchInfo.m_timeStep := timeStep; dispatchInfo.m_stepCount := 0; end; Self.performDiscreteCollisionDetection; Self.calculateSimulationIslands; -- tbd ... Self.getSolverInfo.m_timeStep := timeStep; Self.solveConstraints (Self.getSolverInfo); Self.integrateTransforms (timeStep); Self.updateActions (timeStep); Self.updateActivationState (timeStep); if Self.m_internalTickCallback /= null then Self.m_internalPreTickCallback.all (Self, timeStep); end if; end internalSingleStepSimulation; -- void impact.d3.Space.dynamic.discrete::internalSingleStepSimulation(impact.d3.Scalar timeStep) -- { -- -- BT_PROFILE("internalSingleStepSimulation"); -- -- if(0 != m_internalPreTickCallback) { -- (*m_internalPreTickCallback)(this, timeStep); -- } -- -- ///apply gravity, predict motion -- predictUnconstraintMotion(timeStep); -- -- impact.d3.DispatcherInfo& dispatchInfo = getDispatchInfo(); -- -- dispatchInfo.m_timeStep = timeStep; -- dispatchInfo.m_stepCount = 0; -- dispatchInfo.m_debugDraw = getDebugDrawer(); -- -- -- ///perform collision detection -- performDiscreteCollisionDetection(); -- -- -- calculateSimulationIslands(); -- -- -- getSolverInfo().m_timeStep = timeStep; -- -- -- -- ///solve contact and other joint constraints -- solveConstraints(getSolverInfo()); -- -- ///CallbackTriggers(); -- -- ///integrate transforms -- integrateTransforms(timeStep); -- -- ///update vehicle simulation -- updateActions(timeStep); -- -- updateActivationState( timeStep ); -- -- if(0 != m_internalTickCallback) { -- (*m_internalTickCallback)(this, timeStep); -- } -- } procedure saveKinematicState (Self : in out Item; timeStep : in Real) is begin for I in 1 .. Integer (Self.m_nonStaticRigidBodies.Length) loop declare colObj : constant impact.d3.Object.view := Self.get_m_collisionObjects.Element (I).all'Access; the_body : constant impact.d3.Object.rigid.view := impact.d3.Object.rigid.view (colObj); begin if the_body /= null and then the_body.getActivationState /= Object.ISLAND_SLEEPING then if the_body.isKinematicObject then the_body.saveKinematicState (timeStep); end if; end if; end; end loop; end saveKinematicState; -- void impact.d3.Space.dynamic.discrete::saveKinematicState(impact.d3.Scalar timeStep) -- { -- ///would like to iterate over m_nonStaticRigidBodies, but unfortunately old API allows -- ///to switch status _after_ adding kinematic objects to the world -- ///fix it for Bullet 3.x release -- for (int i=0;i<m_collisionObjects.size();i++) -- { -- impact.d3.Object* colObj = m_collisionObjects[i]; -- impact.d3.Object.rigid* body = impact.d3.Object.rigid::upcast(colObj); -- if (body && body->getActivationState() != ISLAND_SLEEPING) -- { -- if (body->isKinematicObject()) -- { -- //to calculate velocities next frame -- body->saveKinematicState(timeStep); -- } -- } -- } -- -- } --- btClosestNotMeConvexResultCallback -- type btClosestNotMeConvexResultCallback is new impact.d3.Space.ClosestConvexResultCallback with record m_me : access impact.d3.Object.item'Class; m_allowedPenetration : math.Real; m_pairCache : access impact.d3.collision.overlapped_pair_Callback.cached.item'Class; m_dispatcher : access impact.d3.Dispatcher.item'Class; end record; overriding function needsCollision (Self : in btClosestNotMeConvexResultCallback; proxy0 : access impact.d3.collision.Proxy.item'Class) return Boolean; overriding function addSingleResult (Self : access btClosestNotMeConvexResultCallback; convexResult : access impact.d3.Space.LocalConvexResult; normalInWorldSpace : in Boolean ) return math.Real; function to_btClosestNotMeConvexResultCallback (me : access impact.d3.Object.item'Class; fromA, toA : in math.Vector_3; pairCache : access impact.d3.collision.overlapped_pair_Callback.cached.item'Class; dispatcher : access impact.d3.Dispatcher.item'Class) return btClosestNotMeConvexResultCallback is Self : constant btClosestNotMeConvexResultCallback := (impact.d3.Space.Forge.to_ClosestConvexResultCallback (fromA, toA) with m_me => me, m_allowedPenetration => 0.0, m_pairCache => pairCache, m_dispatcher => dispatcher); begin return Self; end to_btClosestNotMeConvexResultCallback; overriding function addSingleResult (Self : access btClosestNotMeConvexResultCallback; convexResult : access impact.d3.Space.LocalConvexResult; normalInWorldSpace : in Boolean ) return math.Real is use impact.d3.Space; use math.Vectors; use impact.d3.Vector; begin if convexResult.m_hitCollisionObject = Self.m_me then return 1.0; elsif not convexResult.m_hitCollisionObject.hasContactResponse then return 1.0; end if; declare linVelA : constant Vector_3 := Self.m_convexToWorld - Self.m_convexFromWorld; linVelB : constant Vector_3 := (0.0, 0.0, 0.0); relativeVelocity : constant Vector_3 := linVelA - linVelB; begin if dot (convexResult.m_hitNormalLocal, relativeVelocity) >= -Self.m_allowedPenetration then return 1.0; end if; end; return impact.d3.Space.addSingleResult (ClosestConvexResultCallback_view (Self), convexResult, normalInWorldSpace); end addSingleResult; overriding function needsCollision (Self : in btClosestNotMeConvexResultCallback; proxy0 : access impact.d3.collision.Proxy.item'Class) return Boolean is begin if proxy0.m_clientObject = Self.m_me then return False; elsif not impact.d3.Space.needsCollision (ClosestConvexResultCallback (Self), proxy0) then return False; end if; declare otherObj : constant impact.d3.Object.view := impact.d3.Object.view (proxy0.m_clientObject); begin if Self.m_dispatcher.needsResponse (Self.m_me, otherObj) then return True; end if; end; return False; end needsCollision; -- class btClosestNotMeConvexResultCallback : public impact.d3.Space::ClosestConvexResultCallback -- { -- public: -- -- impact.d3.Object* m_me; -- impact.d3.Scalar m_allowedPenetration; -- impact.d3.collision.overlapped_pair_Callback.cached* m_pairCache; -- impact.d3.Dispatcher* m_dispatcher; -- public: -- btClosestNotMeConvexResultCallback (impact.d3.Object* me,const impact.d3.Vector& fromA,const impact.d3.Vector& toA,impact.d3.collision.overlapped_pair_Callback.cached* pairCache,impact.d3.Dispatcher* dispatcher) : -- impact.d3.Space::ClosestConvexResultCallback(fromA,toA), -- m_me(me), -- m_allowedPenetration(0.0f), -- m_pairCache(pairCache), -- m_dispatcher(dispatcher) -- { -- } -- virtual impact.d3.Scalar addSingleResult(impact.d3.Space::LocalConvexResult& convexResult,bool normalInWorldSpace) -- { -- if (convexResult.m_hitCollisionObject == m_me) -- return 1.0f; -- -- //ignore result if there is no contact response -- if(!convexResult.m_hitCollisionObject->hasContactResponse()) -- return 1.0f; -- -- impact.d3.Vector linVelA,linVelB; -- linVelA = m_convexToWorld-m_convexFromWorld; -- linVelB = impact.d3.Vector(0,0,0);//toB.getOrigin()-fromB.getOrigin(); -- -- impact.d3.Vector relativeVelocity = (linVelA-linVelB); -- //don't report time of impact for motion away from the contact normal (or causes minor penetration) -- if (convexResult.m_hitNormalLocal.dot(relativeVelocity)>=-m_allowedPenetration) -- return 1.f; -- -- return ClosestConvexResultCallback::addSingleResult (convexResult, normalInWorldSpace); -- } -- virtual bool needsCollision(impact.d3.collision.Proxy* proxy0) const -- { -- //don't collide with itself -- if (proxy0->m_clientObject == m_me) -- return false; -- -- ///don't do CCD when the collision filters are not matching -- if (!ClosestConvexResultCallback::needsCollision(proxy0)) -- return false; -- -- impact.d3.Object* otherObj = (impact.d3.Object*) proxy0->m_clientObject; -- -- //call needsResponse, see http://code.google.com/p/bullet/issues/detail?id=179 -- if (m_dispatcher->needsResponse(m_me,otherObj)) -- { -- return true; -- } -- -- return false; -- } -- -- -- }; procedure integrateTransforms (Self : in out Item; timeStep : in Real) is use impact.d3.Transform; use impact.d3.Vector; use math.Vectors; use impact.d3.Shape.convex.internal.sphere; predictedTrans : Transform_3d; begin for I in 1 .. Integer (Self.m_nonStaticRigidBodies.Length) loop declare the_body : constant access impact.d3.Object.rigid.Item := Self.m_nonStaticRigidBodies.Element (I); Continue : Boolean := False; begin the_body.setHitFraction (1.0); if the_body.isActive and not the_body.isStaticOrKinematicObject then the_body.predictIntegratedTransform (timeStep, predictedTrans); declare squareMotion : math.Real := Length2 (getOrigin (predictedTrans) - getOrigin (the_body.getWorldTransform.all)); begin if Self.getDispatchInfo.m_useContinuous and then the_body.getCcdSquareMotionThreshold /= 0.0 and then the_body.getCcdSquareMotionThreshold < squareMotion then declare sweepResults : aliased btClosestNotMeConvexResultCallback := to_btClosestNotMeConvexResultCallback (the_body, getOrigin (the_body.getWorldTransform.all), getOrigin (predictedTrans), Self.getPairCache, Self.getDispatcher); tmpSphere : constant impact.d3.Shape.convex.internal.sphere.Item := to_sphere_Shape (the_body.getCcdSweptSphereRadius); begin sweepResults.m_allowedPenetration := Self.getDispatchInfo.m_allowedCcdPenetration; sweepResults.m_collisionFilterGroup := the_body.getBroadphaseProxy.m_collisionFilterGroup; sweepResults.m_collisionFilterMask := the_body.getBroadphaseProxy.m_collisionFilterMask; declare modifiedPredictedTrans : Transform_3d := predictedTrans; depth : Real := 0.0; appliedImpulse : Real := 0.0; pragma Unreferenced (appliedImpulse); begin setBasis (modifiedPredictedTrans, getBasis (the_body.getWorldTransform.all)); Self.convexSweepTest (tmpSphere, the_body.getWorldTransform.all, modifiedPredictedTrans, sweepResults'Access); if hasHit (sweepResults) and then sweepResults.m_closestHitFraction < 1.0 then the_body.setHitFraction (sweepResults.m_closestHitFraction); the_body.predictIntegratedTransform (timeStep * the_body.getHitFraction, predictedTrans); the_body.setHitFraction (0.0); the_body.proceedToTransform (predictedTrans); appliedImpulse := impact.d3.Joint.contact.resolveSingleCollision (the_body, sweepResults.m_hitCollisionObject, sweepResults.m_hitPointWorld, sweepResults.m_hitNormalWorld, self.getSolverInfo.all, depth); continue := True; end if; end; end; end if; end; else predictedTrans := math.null_Transform_3d; end if; if not continue then the_body.proceedToTransform (predictedTrans); end if; end; end loop; end integrateTransforms; -- void impact.d3.Space.dynamic.discrete::integrateTransforms(impact.d3.Scalar timeStep) -- { -- BT_PROFILE("integrateTransforms"); -- impact.d3.Transform predictedTrans; -- for ( int i=0;i<m_nonStaticRigidBodies.size();i++) -- { -- impact.d3.Object.rigid* body = m_nonStaticRigidBodies[i]; -- body->setHitFraction(1.f); -- -- if (body->isActive() && (!body->isStaticOrKinematicObject())) -- { -- -- body->predictIntegratedTransform(timeStep, predictedTrans); -- -- impact.d3.Scalar squareMotion = (predictedTrans.getOrigin()-body->getWorldTransform().getOrigin()).length2(); -- -- -- -- if (getDispatchInfo().m_useContinuous && body->getCcdSquareMotionThreshold() && body->getCcdSquareMotionThreshold() < squareMotion) -- { -- BT_PROFILE("CCD motion clamping"); -- if (body->getCollisionShape()->isConvex()) -- { -- gNumClampedCcdMotions++; -- #ifdef USE_STATIC_ONLY -- class StaticOnlyCallback : public btClosestNotMeConvexResultCallback -- { -- public: -- -- StaticOnlyCallback (impact.d3.Object* me,const impact.d3.Vector& fromA,const impact.d3.Vector& toA,impact.d3.collision.overlapped_pair_Callback.cached* pairCache,impact.d3.Dispatcher* dispatcher) : -- btClosestNotMeConvexResultCallback(me,fromA,toA,pairCache,dispatcher) -- { -- } -- -- virtual bool needsCollision(impact.d3.collision.Proxy* proxy0) const -- { -- impact.d3.Object* otherObj = (impact.d3.Object*) proxy0->m_clientObject; -- if (!otherObj->isStaticOrKinematicObject()) -- return false; -- return btClosestNotMeConvexResultCallback::needsCollision(proxy0); -- } -- }; -- -- StaticOnlyCallback sweepResults(body,body->getWorldTransform().getOrigin(),predictedTrans.getOrigin(),getBroadphase()->getOverlappingPairCache(),getDispatcher()); -- #else -- btClosestNotMeConvexResultCallback sweepResults(body,body->getWorldTransform().getOrigin(),predictedTrans.getOrigin(),getBroadphase()->getOverlappingPairCache(),getDispatcher()); -- #endif -- //impact.d3.Shape.convex* convexShape = static_cast<impact.d3.Shape.convex*>(body->getCollisionShape()); -- impact.d3.Shape.convex.internal.sphere tmpSphere(body->getCcdSweptSphereRadius());//impact.d3.Shape.convex* convexShape = static_cast<impact.d3.Shape.convex*>(body->getCollisionShape()); -- sweepResults.m_allowedPenetration=getDispatchInfo().m_allowedCcdPenetration; -- -- sweepResults.m_collisionFilterGroup = body->getBroadphaseProxy()->m_collisionFilterGroup; -- sweepResults.m_collisionFilterMask = body->getBroadphaseProxy()->m_collisionFilterMask; -- impact.d3.Transform modifiedPredictedTrans = predictedTrans; -- modifiedPredictedTrans.setBasis(body->getWorldTransform().getBasis()); -- -- convexSweepTest(&tmpSphere,body->getWorldTransform(),modifiedPredictedTrans,sweepResults); -- if (sweepResults.hasHit() && (sweepResults.m_closestHitFraction < 1.f)) -- { -- -- //printf("clamped integration to hit fraction = %f\n",fraction); -- body->setHitFraction(sweepResults.m_closestHitFraction); -- body->predictIntegratedTransform(timeStep*body->getHitFraction(), predictedTrans); -- body->setHitFraction(0.f); -- body->proceedToTransform( predictedTrans); -- -- //response between two dynamic objects without friction, assuming 0 penetration depth -- impact.d3.Scalar appliedImpulse = 0.f; -- impact.d3.Scalar depth = 0.f; -- appliedImpulse = resolveSingleCollision(body,sweepResults.m_hitCollisionObject,sweepResults.m_hitPointWorld,sweepResults.m_hitNormalWorld,getSolverInfo(), depth); -- -- -- continue; -- } -- } -- } -- -- -- body->proceedToTransform( predictedTrans); -- } -- } -- } end impact.d3.Space.dynamic.discrete; -- -- -- -- -- void impact.d3.Space.dynamic.discrete::addVehicle(impact.d3.Action* vehicle) -- { -- addAction(vehicle); -- } -- void impact.d3.Space.dynamic.discrete::removeVehicle(impact.d3.Action* vehicle) -- { -- removeAction(vehicle); -- } -- void impact.d3.Space.dynamic.discrete::addCharacter(impact.d3.Action* character) -- { -- addAction(character); -- } -- void impact.d3.Space.dynamic.discrete::removeCharacter(impact.d3.Action* character) -- { -- removeAction(character); -- } -- ///internal debugging variable. this value shouldn't be too high -- int gNumClampedCcdMotions=0;
programs/oeis/090/A090169.asm
neoneye/loda
22
103219
<reponame>neoneye/loda ; A090169: a(n) = floor( 3*n/2 ) + floor( 2*n/3 ). ; 0,1,4,6,8,10,13,14,17,19,21,23,26,27,30,32,34,36,39,40,43,45,47,49,52,53,56,58,60,62,65,66,69,71,73,75,78,79,82,84,86,88,91,92,95,97,99,101,104,105,108,110,112,114,117,118,121,123,125,127,130,131,134,136,138 mov $1,$0 mul $1,2 mov $3,$0 div $0,2 mov $2,$1 mul $2,2 div $2,6 add $0,$2 add $0,$3
programs/oeis/340/A340074.asm
neoneye/loda
22
10389
; A340074: a(n) = gcd(A003961(n)-1, A339904(n)). ; 1,1,1,1,3,1,5,1,1,1,3,1,1,1,1,1,9,1,11,1,1,1,7,1,3,1,1,1,15,1,9,1,1,1,1,1,5,1,1,1,21,1,23,1,3,1,13,1,5,1,1,1,29,1,9,1,1,1,15,1,33,1,1,1,1,1,35,1,1,5,9,1,39,1,1,1,1,1,41,1,1,1,11,1,3,1,1,1,3,1,1,1,1,1,1,1,25,1,3,1 seq $0,253885 ; Permutation of even numbers: a(n) = A003961(n+1) - 1. seq $0,49559 ; a(n) = gcd(n - 1, phi(n)). lpb $0 dif $0,2 lpe
programs/oeis/011/A011858.asm
neoneye/loda
22
28655
; A011858: a(n) = floor( n*(n-1)/5 ). ; 0,0,0,1,2,4,6,8,11,14,18,22,26,31,36,42,48,54,61,68,76,84,92,101,110,120,130,140,151,162,174,186,198,211,224,238,252,266,281,296,312,328,344,361,378,396,414,432,451,470,490,510,530,551,572,594,616,638,661,684,708,732,756,781,806,832,858,884,911,938,966,994,1022,1051,1080,1110,1140,1170,1201,1232,1264,1296,1328,1361,1394,1428,1462,1496,1531,1566,1602,1638,1674,1711,1748,1786,1824,1862,1901,1940 mov $1,$0 sub $0,1 mul $0,$1 div $0,5
source/neslib_asm/neslib.asm
cppchriscpp/through-dimensions
1
10443
<reponame>cppchriscpp/through-dimensions ;NES hardware-dependent functions by Shiru (<EMAIL>) ;with improvements by VEG ;Feel free to do anything you want with this code, consider it Public Domain ; NOTE: Edits by cppchriscpp: ; - Added mmc1 bank swapping ; - Made the nmi and music_play methods support swapping to a set SOUND_BANK before reading data. ; - Added second split method with y split support from na_th_an's NESDev code ; - Messed with the original split method to make it trigger a little later. ; - Problematic PAL bugfix removed; only supporting NTSC with this engine. ; - Added reset method to reset system to initial state ; - Added a simple wait for sprite0 hit, to allow us to do C things. ; - Added a handler to nmi to allow switching chr banks at the very start of nmi (mixed with functions in bank_helpers) ;modified to work with the FamiTracker music driver .export _pal_all,_pal_bg,_pal_spr,_pal_col,_pal_clear .export _pal_bright,_pal_spr_bright,_pal_bg_bright .export _ppu_off,_ppu_on_all,_ppu_on_bg,_ppu_on_spr,_ppu_mask,_ppu_system .export _oam_clear,_oam_size,_oam_spr,_oam_meta_spr,_oam_hide_rest .export _ppu_wait_frame,_ppu_wait_nmi .export _scroll,_split .export _bank_spr,_bank_bg .export _vram_read,_vram_write .export _music_play,_music_stop,_music_pause, _music_play_nonstop .export _sfx_play .export _pad_poll,_pad_trigger,_pad_state .export _rand8,_rand16,_set_rand .export _vram_adr,_vram_put,_vram_fill,_vram_inc,_vram_unrle .export _set_vram_update,_flush_vram_update .export _memcpy,_memfill,_delay .export nmi_update .export _split_y,_reset,_wait_for_sprite0_hit ;NMI handler nmi: ; Due to quirks of the MMC1 mapper, there's a chance this flips when we're in the middle of switching PRG banks. ; If this happens, we need to catch it, quickly return to what we were doing, then re-trigger the nmi update. pha lda BANK_WRITE_IP cmp #1 bne @continue ; If we were in the middle of switching banks, set a flag to check later... inc BANK_WRITE_IP pla ; then return from the interrupt without doing anything else. rti @continue: ; Not in the middle of a bank switch, so run the nmi_update method as normal. pla jsr nmi_update rti nmi_update: pha txa pha tya pha lda <PPU_MASK_VAR ;if rendering is disabled, do not access the VRAM at all and #%00011000 bne @doUpdate jmp @skipAll @doUpdate: lda nmiChrTileBank cmp #NO_CHR_BANK beq @no_chr_chg jsr _set_chr_bank_0 @no_chr_chg: lda #>OAM_BUF ;update OAM sta PPU_OAM_DMA lda <PAL_UPDATE ;update palette if needed bne @updPal jmp @updVRAM @updPal: ldx #0 stx <PAL_UPDATE lda #$3f sta PPU_ADDR stx PPU_ADDR ldy PAL_BUF ;background color, remember it in X lda (PAL_BG_PTR),y sta PPU_DATA tax .repeat 3,I ldy PAL_BUF+1+I lda (PAL_BG_PTR),y sta PPU_DATA .endrepeat .repeat 3,J stx PPU_DATA ;background color .repeat 3,I ldy PAL_BUF+5+(J*4)+I lda (PAL_BG_PTR),y sta PPU_DATA .endrepeat .endrepeat .repeat 4,J stx PPU_DATA ;background color .repeat 3,I ldy PAL_BUF+17+(J*4)+I lda (PAL_SPR_PTR),y sta PPU_DATA .endrepeat .endrepeat @updVRAM: lda <VRAM_UPDATE beq @skipUpd lda #0 sta <VRAM_UPDATE lda <NAME_UPD_ENABLE beq @skipUpd jsr _flush_vram_update_nmi @skipUpd: lda #0 sta PPU_ADDR sta PPU_ADDR lda <SCROLL_X sta PPU_SCROLL lda <SCROLL_Y sta PPU_SCROLL lda <PPU_CTRL_VAR sta PPU_CTRL @skipAll: lda <PPU_MASK_VAR sta PPU_MASK inc <FRAME_CNT1 inc <FRAME_CNT2 lda <FRAME_CNT2 cmp #6 bne @skipNtsc lda #0 sta <FRAME_CNT2 @skipNtsc: ; Bank swapping time! Switch to the music bank for sfx, etc... lda BP_BANK sta NMI_BANK_TEMP lda #SOUND_BANK sta BP_BANK jsr _set_prg_bank_raw ;play music, the code is modified to put data into output buffer instead of APU registers lda <MUSIC_PLAY ror bcc :+ jsr ft_music_play jmp :++ : lda #$30 ;mute channels when music does not play sta <BUF_4000 sta <BUF_4004 sta <BUF_400C lda #$00 sta <BUF_4008 : ;process all sound effect streams .if(FT_SFX_ENABLE) .if FT_SFX_STREAMS>0 ldx #FT_SFX_CH0 jsr _FT2SfxUpdate .endif .if FT_SFX_STREAMS>1 ldx #FT_SFX_CH1 jsr _FT2SfxUpdate .endif .if FT_SFX_STREAMS>2 ldx #FT_SFX_CH2 jsr _FT2SfxUpdate .endif .if FT_SFX_STREAMS>3 ldx #FT_SFX_CH3 jsr _FT2SfxUpdate .endif .endif ;send data from the output buffer to the APU lda <BUF_4000 sta $4000 lda <BUF_4001 sta $4001 lda <BUF_4002 sta $4002 lda <BUF_4003 cmp <PREV_4003 beq :+ sta <PREV_4003 sta $4003 : lda <BUF_4004 sta $4004 lda <BUF_4005 sta $4005 lda <BUF_4006 sta $4006 lda <BUF_4007 cmp <PREV_4007 beq :+ sta <PREV_4007 sta $4007 : lda <BUF_4008 sta $4008 lda <BUF_4009 sta $4009 lda <BUF_400A sta $400A lda <BUF_400B sta $400B lda <BUF_400C sta $400C lda <BUF_400D sta $400D lda <BUF_400E sta $400E lda <BUF_400F sta $400F lda NMI_BANK_TEMP sta BP_BANK jsr _set_prg_bank_raw pla tay pla tax pla irq: rts ;famitone sound effects code and structures FT_VARS=FT_BASE_ADR .if(FT_PAL_SUPPORT) .if(FT_NTSC_SUPPORT) FT_PITCH_FIX = (FT_PAL_SUPPORT|FT_NTSC_SUPPORT) ;add PAL/NTSC pitch correction code only when both modes are enabled .endif .endif ;zero page variables FT_TEMP_PTR = FT_TEMP ;word FT_TEMP_PTR_L = FT_TEMP_PTR+0 FT_TEMP_PTR_H = FT_TEMP_PTR+1 FT_TEMP_VAR1 = FT_TEMP+2 ;sound effect stream variables, 2 bytes and 15 bytes per stream ;when sound effects are disabled, this memory is not used FT_PAL_ADJUST = FT_VARS+0 FT_SFX_ADR_L = FT_VARS+1 FT_SFX_ADR_H = FT_VARS+2 FT_SFX_BASE_ADR = FT_VARS+3 FT_SFX_STRUCT_SIZE = 15 FT_SFX_REPEAT = FT_SFX_BASE_ADR+0 FT_SFX_PTR_L = FT_SFX_BASE_ADR+1 FT_SFX_PTR_H = FT_SFX_BASE_ADR+2 FT_SFX_OFF = FT_SFX_BASE_ADR+3 FT_SFX_BUF = FT_SFX_BASE_ADR+4 ;11 bytes ;aliases for sound effect channels to use in user calls FT_SFX_CH0 = FT_SFX_STRUCT_SIZE*0 FT_SFX_CH1 = FT_SFX_STRUCT_SIZE*1 FT_SFX_CH2 = FT_SFX_STRUCT_SIZE*2 FT_SFX_CH3 = FT_SFX_STRUCT_SIZE*3 .if(FT_SFX_ENABLE) ;------------------------------------------------------------------------------ ; init sound effects player, set pointer to data ; in: X,Y is address of sound effects data ;------------------------------------------------------------------------------ FamiToneSfxInit: stx <TEMP+0 sty <TEMP+1 ldy #0 ; @cppchriscpp change: ; Disable the famitracker PAL features... it has a weird bug where if I disable PAL, this var ; is no longer defined, and ca65 does not like that. ; .if(FT_PITCH_FIX) ; lda FT_PAL_ADJUST ;add 2 to the sound list pointer for PAL ; bne @ntsc ; iny ; iny @ntsc: ; .endif lda (TEMP),y ;read and store pointer to the effects list sta FT_SFX_ADR_L iny lda (TEMP),y sta FT_SFX_ADR_H ldx #FT_SFX_CH0 ;init all the streams @set_channels: jsr _FT2SfxClearChannel txa clc adc #FT_SFX_STRUCT_SIZE tax cpx #FT_SFX_CH0+FT_SFX_STRUCT_SIZE*FT_SFX_STREAMS bne @set_channels rts ;internal routine, clears output buffer of a sound effect ;in: A is 0 ; X is offset of sound effect stream _FT2SfxClearChannel: lda #0 sta FT_SFX_PTR_H,x ;this stops the effect sta FT_SFX_REPEAT,x sta FT_SFX_OFF,x sta FT_SFX_BUF+6,x ;mute triangle lda #$30 sta FT_SFX_BUF+0,x ;mute pulse1 sta FT_SFX_BUF+3,x ;mute pulse2 sta FT_SFX_BUF+9,x ;mute noise rts ;------------------------------------------------------------------------------ ; play sound effect ; in: A is a number of the sound effect 0..127 ; X is offset of sound effect channel, should be FT_SFX_CH0..FT_SFX_CH3 ;------------------------------------------------------------------------------ FamiToneSfxPlay: asl a ;get offset in the effects list tay jsr _FT2SfxClearChannel ;stops the effect if it plays lda FT_SFX_ADR_L sta <TEMP+0 lda FT_SFX_ADR_H sta <TEMP+1 lda (TEMP),y ;read effect pointer from the table sta FT_SFX_PTR_L,x ;store it iny lda (TEMP),y sta FT_SFX_PTR_H,x ;this write enables the effect rts ;internal routine, update one sound effect stream ;in: X is offset of sound effect stream _FT2SfxUpdate: lda FT_SFX_REPEAT,x ;check if repeat counter is not zero beq @no_repeat dec FT_SFX_REPEAT,x ;decrement and return bne @update_buf ;just mix with output buffer @no_repeat: lda FT_SFX_PTR_H,x ;check if MSB of the pointer is not zero bne @sfx_active rts ;return otherwise, no active effect @sfx_active: sta <FT_TEMP_PTR_H ;load effect pointer into temp lda FT_SFX_PTR_L,x sta <FT_TEMP_PTR_L ldy FT_SFX_OFF,x clc @read_byte: lda (FT_TEMP_PTR),y ;read byte of effect bmi @get_data ;if bit 7 is set, it is a register write beq @eof iny sta FT_SFX_REPEAT,x ;if bit 7 is reset, it is number of repeats tya sta FT_SFX_OFF,x jmp @update_buf @get_data: iny stx <FT_TEMP_VAR1 ;it is a register write adc <FT_TEMP_VAR1 ;get offset in the effect output buffer and #$7f tax lda (FT_TEMP_PTR),y ;read value iny sta FT_SFX_BUF,x ;store into output buffer ldx <FT_TEMP_VAR1 jmp @read_byte ;and read next byte @eof: sta FT_SFX_PTR_H,x ;mark channel as inactive @update_buf: lda <BUF_4000 ;compare effect output buffer with main output buffer and #$0f ;if volume of pulse 1 of effect is higher than that of the sta <FT_TEMP_VAR1 ;main buffer, overwrite the main buffer value with the new one lda FT_SFX_BUF+0,x and #$0f cmp <FT_TEMP_VAR1 bcc @no_pulse1 lda FT_SFX_BUF+0,x sta <BUF_4000 lda FT_SFX_BUF+1,x sta <BUF_4002 lda FT_SFX_BUF+2,x sta <BUF_4003 @no_pulse1: lda <BUF_4004 ;same for pulse 2 and #$0f sta <FT_TEMP_VAR1 lda FT_SFX_BUF+3,x and #$0f cmp <FT_TEMP_VAR1 bcc @no_pulse2 lda FT_SFX_BUF+3,x sta <BUF_4004 lda FT_SFX_BUF+4,x sta <BUF_4006 lda FT_SFX_BUF+5,x sta <BUF_4007 @no_pulse2: lda FT_SFX_BUF+6,x ;overwrite triangle of main output buffer if it is active beq @no_triangle sta <BUF_4008 lda FT_SFX_BUF+7,x sta <BUF_400A lda FT_SFX_BUF+8,x sta <BUF_400B @no_triangle: lda <BUF_400C ;same as for pulse 1 and 2, but for noise and #$0f sta <FT_TEMP_VAR1 lda FT_SFX_BUF+9,x and #$0f cmp <FT_TEMP_VAR1 bcc @no_noise lda FT_SFX_BUF+9,x sta <BUF_400C lda FT_SFX_BUF+10,x sta <BUF_400E @no_noise: rts .endif ;void __fastcall__ pal_all(const char *data); _pal_all: sta <PTR stx <PTR+1 ldx #$00 lda #$20 pal_copy: sta <LEN ldy #$00 @0: lda (PTR),y sta PAL_BUF,x inx iny dec <LEN bne @0 inc <PAL_UPDATE rts ;void __fastcall__ pal_bg(const char *data); _pal_bg: sta <PTR stx <PTR+1 ldx #$00 lda #$10 bne pal_copy ;bra ;void __fastcall__ pal_spr(const char *data); _pal_spr: sta <PTR stx <PTR+1 ldx #$10 txa bne pal_copy ;bra ;void __fastcall__ pal_col(unsigned char index,unsigned char color); _pal_col: sta <PTR jsr popa and #$1f tax lda <PTR sta PAL_BUF,x inc <PAL_UPDATE rts ;void __fastcall__ pal_clear(void); _pal_clear: lda #$0f ldx #0 @1: sta PAL_BUF,x inx cpx #$20 bne @1 stx <PAL_UPDATE rts ;void __fastcall__ pal_spr_bright(unsigned char bright); _pal_spr_bright: tax lda palBrightTableL,x sta <PAL_SPR_PTR lda palBrightTableH,x ;MSB is never zero sta <PAL_SPR_PTR+1 sta <PAL_UPDATE rts ;void __fastcall__ pal_bg_bright(unsigned char bright); _pal_bg_bright: tax lda palBrightTableL,x sta <PAL_BG_PTR lda palBrightTableH,x ;MSB is never zero sta <PAL_BG_PTR+1 sta <PAL_UPDATE rts ;void __fastcall__ pal_bright(unsigned char bright); _pal_bright: jsr _pal_spr_bright txa jmp _pal_bg_bright ;void __fastcall__ ppu_off(void); _ppu_off: lda <PPU_MASK_VAR and #%11100111 sta <PPU_MASK_VAR jmp _ppu_wait_nmi ;void __fastcall__ ppu_on_all(void); _ppu_on_all: lda <PPU_MASK_VAR ora #%00011000 ppu_onoff: sta <PPU_MASK_VAR jmp _ppu_wait_nmi ;void __fastcall__ ppu_on_bg(void); _ppu_on_bg: lda <PPU_MASK_VAR ora #%00001000 bne ppu_onoff ;bra ;void __fastcall__ ppu_on_spr(void); _ppu_on_spr: lda <PPU_MASK_VAR ora #%00010000 bne ppu_onoff ;bra ;void __fastcall__ ppu_mask(unsigned char mask); _ppu_mask: sta <PPU_MASK_VAR rts ;unsigned char __fastcall__ ppu_system(void); _ppu_system: lda <NTSC_MODE rts ;void __fastcall__ oam_clear(void); _oam_clear: ldx #0 lda #$ff @1: sta OAM_BUF,x inx inx inx inx bne @1 rts ;void __fastcall__ oam_size(unsigned char size); _oam_size: asl a asl a asl a asl a asl a and #$20 sta <TEMP lda <PPU_CTRL_VAR and #$df ora <TEMP sta <PPU_CTRL_VAR rts ;unsigned char __fastcall__ oam_spr(unsigned char x,unsigned char y,unsigned char chrnum,unsigned char attr,unsigned char sprid); _oam_spr: tax ldy #0 ;four popa calls replacement lda (sp),y iny sta OAM_BUF+2,x lda (sp),y iny sta OAM_BUF+1,x lda (sp),y iny sta OAM_BUF+0,x lda (sp),y sta OAM_BUF+3,x lda <sp clc adc #4 sta <sp bcc @1 inc <sp+1 @1: txa clc adc #4 rts ;unsigned char __fastcall__ oam_meta_spr(unsigned char x,unsigned char y,unsigned char sprid,const unsigned char *data); _oam_meta_spr: sta <PTR stx <PTR+1 ldy #2 ;three popa calls replacement, performed in reversed order lda (sp),y dey sta <SCRX lda (sp),y dey sta <SCRY lda (sp),y tax @1: lda (PTR),y ;x offset cmp #$80 beq @2 iny clc adc <SCRX sta OAM_BUF+3,x lda (PTR),y ;y offset iny clc adc <SCRY sta OAM_BUF+0,x lda (PTR),y ;tile iny sta OAM_BUF+1,x lda (PTR),y ;attribute iny sta OAM_BUF+2,x inx inx inx inx jmp @1 @2: lda <sp adc #2 ;carry is always set here, so it adds 3 sta <sp bcc @3 inc <sp+1 @3: txa rts ;void __fastcall__ oam_hide_rest(unsigned char sprid); _oam_hide_rest: tax lda #240 @1: sta OAM_BUF,x inx inx inx inx bne @1 rts ;void __fastcall__ ppu_wait_frame(void); _ppu_wait_frame: lda #1 sta <VRAM_UPDATE lda <FRAME_CNT1 @1: cmp <FRAME_CNT1 beq @1 lda <NTSC_MODE beq @3 @2: lda <FRAME_CNT2 cmp #5 beq @2 @3: rts ;void __fastcall__ ppu_wait_nmi(void); _ppu_wait_nmi: lda #1 sta <VRAM_UPDATE lda <FRAME_CNT1 @1: cmp <FRAME_CNT1 beq @1 rts ;void __fastcall__ vram_unrle(const unsigned char *data); _vram_unrle: tay stx <RLE_HIGH lda #0 sta <RLE_LOW lda (RLE_LOW),y sta <RLE_TAG iny bne @1 inc <RLE_HIGH @1: lda (RLE_LOW),y iny bne @11 inc <RLE_HIGH @11: cmp <RLE_TAG beq @2 sta PPU_DATA sta <RLE_BYTE bne @1 @2: lda (RLE_LOW),y beq @4 iny bne @21 inc <RLE_HIGH @21: tax lda <RLE_BYTE @3: sta PPU_DATA dex bne @3 beq @1 @4: rts ;void __fastcall__ scroll(unsigned int x,unsigned int y); _scroll: sta <TEMP txa ; bne @1 lda <TEMP cmp #240 bcs @1 sta <SCROLL_Y lda #0 sta <TEMP beq @2 ;bra @1: sec lda <TEMP sbc #240 sta <SCROLL_Y lda #2 sta <TEMP @2: jsr popax sta <SCROLL_X txa and #$01 ora <TEMP sta <TEMP lda <PPU_CTRL_VAR and #$fc ora <TEMP sta <PPU_CTRL_VAR rts ;;void __fastcall__ split(unsigned int x,unsigned int y); _split: jsr popax sta <SCROLL_X1 txa and #$01 sta <TEMP lda <PPU_CTRL_VAR and #$fc ora <TEMP sta <PPU_CTRL_VAR1 @3: bit PPU_STATUS bvs @3 @4: bit PPU_STATUS bvc @4 ; Wait a few cycles to align with the *next* line. ; @cppchriscpp hack ldx #0 @looper: inx cpx #44 bne @looper lda <SCROLL_X1 sta PPU_SCROLL lda #0 sta PPU_SCROLL lda <PPU_CTRL_VAR1 sta PPU_CTRL rts ;;void __fastcall__ wait_for_sprite0_hit(); _wait_for_sprite0_hit: lda <PPU_CTRL_VAR and #$fc ora <TEMP sta <PPU_CTRL_VAR1 @3: bit PPU_STATUS bvs @3 @4: bit PPU_STATUS bvc @4 ; Wait a few cycles to align with the *next* line. ; @cppchriscpp hack ldx #0 @looper: inx cpx #44 bne @looper rts ;;void __fastcall__ split_y(unsigned int x,unsigned int y); ; Using na_tha_an's trickery for y scroll from here: https://forums.nesdev.com/viewtopic.php?f=2&t=16435 ; Thanks dude! ; Extract SCROLL_Y1, SCROLL_X1, WRITE1 from parameters. _split_y: sta <TEMP txa bne @1 lda <TEMP cmp #240 bcs @1 sta <SCROLL_Y1 lda #0 sta <TEMP beq @2 ;bra @1: sec lda <TEMP sbc #240 sta <SCROLL_Y1 lda #8 ;; Bit 3 sta <TEMP @2: jsr popax sta <SCROLL_X1 txa and #$01 asl a asl a ;; Bit 2 ora <TEMP ;; From Y sta <WRITE1 ;; Store! ; Calculate WRITE2 = ((Y & $F8) << 2) | (X >> 3) lda <SCROLL_Y1 and #$F8 asl a asl a sta <TEMP ;; TEMP = (Y & $F8) << 2 lda <SCROLL_X1 lsr a lsr a lsr a ;; A = (X >> 3) ora <TEMP ;; A = (X >> 3) | ((Y & $F8) << 2) sta <WRITE2 ;; Store! ; Wait for sprite 0 hit @3: bit PPU_STATUS bvs @3 @4: bit PPU_STATUS bvc @4 ; Wait a few cycles to align with the *next* line. ; @cppchriscpp hack ldx #0 @looper: inx cpx #44 bne @looper ; Set scroll value lda PPU_STATUS lda <WRITE1 sta PPU_ADDR lda <SCROLL_Y1 sta PPU_SCROLL lda <SCROLL_X1 ldx <WRITE2 sta PPU_SCROLL stx PPU_ADDR rts ;void __fastcall__ bank_spr(unsigned char n); _bank_spr: and #$01 asl a asl a asl a sta <TEMP lda <PPU_CTRL_VAR and #%11110111 ora <TEMP sta <PPU_CTRL_VAR rts ;void __fastcall__ bank_bg(unsigned char n); _bank_bg: and #$01 asl a asl a asl a asl a sta <TEMP lda <PPU_CTRL_VAR and #%11101111 ora <TEMP sta <PPU_CTRL_VAR rts ;void __fastcall__ vram_read(unsigned char *dst,unsigned int size); _vram_read: sta <TEMP stx <TEMP+1 jsr popax sta <TEMP+2 stx <TEMP+3 lda PPU_DATA ldy #0 @1: lda PPU_DATA sta (TEMP+2),y inc <TEMP+2 bne @2 inc <TEMP+3 @2: lda <TEMP bne @3 dec <TEMP+1 @3: dec <TEMP lda <TEMP ora <TEMP+1 bne @1 rts ;void __fastcall__ vram_write(unsigned char *src,unsigned int size); _vram_write: sta <TEMP stx <TEMP+1 jsr popax sta <TEMP+2 stx <TEMP+3 ldy #0 @1: lda (TEMP+2),y sta PPU_DATA inc <TEMP+2 bne @2 inc <TEMP+3 @2: lda <TEMP bne @3 dec <TEMP+1 @3: dec <TEMP lda <TEMP ora <TEMP+1 bne @1 rts ;void __fastcall__ music_play(unsigned char song); _music_play: ; @cppchriscpp Edit - forcing a swap to the music bank ; Need to temporarily swap banks to pull this off. tax ; Put our song into x for a moment... ; Being extra careful and setting BP_BANK to ours in case an nmi fires while we're doing this. lda BP_BANK pha lda #SOUND_BANK sta BP_BANK mmc1_register_write MMC1_PRG txa ; bring back the song number! ldx #<music_data stx <ft_music_addr+0 ldx #>music_data stx <ft_music_addr+1 ldx <NTSC_MODE jsr ft_music_init lda #1 sta <MUSIC_PLAY ; Remember when we stored the old bank into BP_BANK and swapped? Time to roll back. pla sta BP_BANK mmc1_register_write MMC1_PRG rts _music_play_nonstop: jmp _music_play ; @cppchriscpp Edit - forcing a swap to the music bank ; @cppchriscpp Edit 2 - Duplicating this function to not stop the music on swap when called this way. Same signature ; Need to temporarily swap banks to pull this off. tax ; Put our song into x for a moment... ; Being extra careful and setting BP_BANK to ours in case an nmi fires while we're doing this. lda BP_BANK pha lda #SOUND_BANK sta BP_BANK mmc1_register_write MMC1_PRG txa ; bring back the song number! ldx #<music_data stx <ft_music_addr+0 ldx #>music_data stx <ft_music_addr+1 ldx <NTSC_MODE jsr ft_music_init_b lda #1 sta <MUSIC_PLAY ; Remember when we stored the old bank into BP_BANK and swapped? Time to roll back. pla sta BP_BANK mmc1_register_write MMC1_PRG rts ;void __fastcall__ music_stop(void); _music_stop: ldx #<music_dummy_data stx <ft_music_addr+0 ldx #>music_dummy_data stx <ft_music_addr+1 lda #0 ldx <NTSC_MODE jsr ft_music_init lda #0 sta <MUSIC_PLAY rts ;void __fastcall__ music_pause(unsigned char pause); _music_pause: inc <MUSIC_PLAY rts ;void __fastcall__ sfx_play(unsigned char sound,unsigned char channel); _sfx_play: .if(FT_SFX_ENABLE) ; TODO: Should I be blocking interrupts while doing weird bank stuff? ; @cppchriscpp Edit - forcing a swap to the music bank ; Need to temporarily swap banks to pull this off. tay ; Put our song into y for a moment... ; Being extra careful and setting BP_BANK to ours in case an nmi fires while we're doing this. lda BP_BANK pha lda #SOUND_BANK sta BP_BANK mmc1_register_write MMC1_PRG tya ; bring back the song number! and #$03 tax lda @sfxPriority,x tax jsr popa jsr FamiToneSfxPlay ; Remember when we stored the old bank into BP_BANK and swapped? Time to roll back. pla sta BP_BANK mmc1_register_write MMC1_PRG rts @sfxPriority: .byte FT_SFX_CH0,FT_SFX_CH1,FT_SFX_CH2,FT_SFX_CH3 .else rts .endif ;unsigned char __fastcall__ pad_poll(unsigned char pad); _pad_poll: tay ldx #0 @padPollPort: lda #1 sta CTRL_PORT1 lda #0 sta CTRL_PORT1 lda #8 sta <TEMP @padPollLoop: lda CTRL_PORT1,y lsr a ror <PAD_BUF,x dec <TEMP bne @padPollLoop inx cpx #3 bne @padPollPort lda <PAD_BUF cmp <PAD_BUF+1 beq @done cmp <PAD_BUF+2 beq @done lda <PAD_BUF+1 @done: sta <PAD_STATE,y tax eor <PAD_STATEP,y and <PAD_STATE ,y sta <PAD_STATET,y txa sta <PAD_STATEP,y rts ;unsigned char __fastcall__ pad_trigger(unsigned char pad); _pad_trigger: pha jsr _pad_poll pla tax lda <PAD_STATET,x rts ;unsigned char __fastcall__ pad_state(unsigned char pad); _pad_state: tax lda <PAD_STATE,x rts ;unsigned char __fastcall__ rand8(void); ;Galois random generator, found somewhere ;out: A random number 0..255 rand1: lda <RAND_SEED asl a bcc @1 eor #$cf @1: sta <RAND_SEED rts rand2: lda <RAND_SEED+1 asl a bcc @1 eor #$d7 @1: sta <RAND_SEED+1 rts _rand8: jsr rand1 jsr rand2 adc <RAND_SEED rts ;unsigned int __fastcall__ rand16(void); _rand16: jsr rand1 tax jsr rand2 rts ;void __fastcall__ set_rand(unsigned char seed); _set_rand: sta <RAND_SEED stx <RAND_SEED+1 rts ;void __fastcall__ set_vram_update(unsigned char *buf); _set_vram_update: sta <NAME_UPD_ADR+0 stx <NAME_UPD_ADR+1 ora <NAME_UPD_ADR+1 sta <NAME_UPD_ENABLE rts ;void __fastcall__ flush_vram_update(unsigned char *buf); _flush_vram_update: sta <NAME_UPD_ADR+0 stx <NAME_UPD_ADR+1 _flush_vram_update_nmi: ldy #0 @updName: lda (NAME_UPD_ADR),y iny cmp #$40 ;is it a non-sequental write? bcs @updNotSeq sta PPU_ADDR lda (NAME_UPD_ADR),y iny sta PPU_ADDR lda (NAME_UPD_ADR),y iny sta PPU_DATA jmp @updName @updNotSeq: tax lda <PPU_CTRL_VAR cpx #$80 ;is it a horizontal or vertical sequence? bcc @updHorzSeq cpx #$ff ;is it end of the update? beq @updDone @updVertSeq: ora #$04 bne @updNameSeq ;bra @updHorzSeq: and #$fb @updNameSeq: sta PPU_CTRL txa and #$3f sta PPU_ADDR lda (NAME_UPD_ADR),y iny sta PPU_ADDR lda (NAME_UPD_ADR),y iny tax @updNameLoop: lda (NAME_UPD_ADR),y iny sta PPU_DATA dex bne @updNameLoop lda <PPU_CTRL_VAR sta PPU_CTRL jmp @updName @updDone: rts ;void __fastcall__ vram_adr(unsigned int adr); _vram_adr: stx PPU_ADDR sta PPU_ADDR rts ;void __fastcall__ vram_put(unsigned char n); _vram_put: sta PPU_DATA rts ;void __fastcall__ vram_fill(unsigned char n,unsigned int len); _vram_fill: sta <LEN stx <LEN+1 jsr popa ldx <LEN+1 beq @2 ldx #0 @1: sta PPU_DATA dex bne @1 dec <LEN+1 bne @1 @2: ldx <LEN beq @4 @3: sta PPU_DATA dex bne @3 @4: rts ;void __fastcall__ vram_inc(unsigned char n); _vram_inc: ora #0 beq @1 lda #$04 @1: sta <TEMP lda <PPU_CTRL_VAR and #$fb ora <TEMP sta <PPU_CTRL_VAR sta PPU_CTRL rts ;void __fastcall__ memcpy(void *dst,void *src,unsigned int len); _memcpy: sta <LEN stx <LEN+1 jsr popax sta <SRC stx <SRC+1 jsr popax sta <DST stx <DST+1 ldx #0 @1: lda <LEN+1 beq @2 jsr @3 dec <LEN+1 inc <SRC+1 inc <DST+1 jmp @1 @2: ldx <LEN beq @5 @3: ldy #0 @4: lda (SRC),y sta (DST),y iny dex bne @4 @5: rts ;void __fastcall__ memfill(void *dst,unsigned char value,unsigned int len); _memfill: sta <LEN stx <LEN+1 jsr popa sta <TEMP jsr popax sta <DST stx <DST+1 ldx #0 @1: lda <LEN+1 beq @2 jsr @3 dec <LEN+1 inc <DST+1 jmp @1 @2: ldx <LEN beq @5 @3: ldy #0 lda <TEMP @4: sta (DST),y iny dex bne @4 @5: rts ;void __fastcall__ delay(unsigned char frames); _delay: tax @1: jsr _ppu_wait_nmi dex bne @1 rts ;void __fastcall__ reset(); _reset: jmp _exit palBrightTableL: .byte <palBrightTable0,<palBrightTable1,<palBrightTable2 .byte <palBrightTable3,<palBrightTable4,<palBrightTable5 .byte <palBrightTable6,<palBrightTable7,<palBrightTable8 palBrightTableH: .byte >palBrightTable0,>palBrightTable1,>palBrightTable2 .byte >palBrightTable3,>palBrightTable4,>palBrightTable5 .byte >palBrightTable6,>palBrightTable7,>palBrightTable8 palBrightTable0: .byte $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f ;black palBrightTable1: .byte $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f palBrightTable2: .byte $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f palBrightTable3: .byte $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f palBrightTable4: .byte $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0a,$0b,$0c,$0f,$0f,$0f ;normal colors palBrightTable5: .byte $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1a,$1b,$1c,$00,$00,$00 palBrightTable6: .byte $10,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2a,$2b,$2c,$10,$10,$10 ;$10 because $20 is the same as $30 palBrightTable7: .byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$20,$20,$20 palBrightTable8: .byte $30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30 ;white .byte $30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30 .byte $30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30 .byte $30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30 ; .include "famitone2.s"
programs/oeis/025/A025821.asm
neoneye/loda
22
175470
; A025821: Expansion of 1/((1-x^2)(1-x^8)(1-x^9)). ; 1,0,1,0,1,0,1,0,2,1,2,1,2,1,2,1,3,2,4,2,4,2,4,2,5,3,6,4,6,4,6,4,7,5,8,6,9,6,9,6,10,7,11,8,12,9,12,9,13,10,14,11,15,12,16,12,17,13,18,14,19,15,20,16,21,17,22,18,23 mov $3,$0 mov $5,2 lpb $5 sub $5,1 add $0,$5 sub $0,1 mov $2,$5 mov $4,$0 max $4,0 seq $4,29025 ; Expansion of 1/((1-x)(1-x^2)(1-x^8)(1-x^9)). mul $2,$4 add $1,$2 lpe min $3,1 mul $3,$4 sub $1,$3 mov $0,$1
src/Parser/mml.g4
nanase/SharpMML
0
7405
<filename>src/Parser/mml.g4 /* * The MIT License (MIT) * * Copyright (c) 2016 <NAME> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KKEY_IND, * EXPRESS OR IMPLIED, KEY_INCLUDKEY_ING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS KEY_FOR A PARTICULAR PURPOSE AND * NONKEY_INFRKEY_INGEMENT. KEY_IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE KEY_FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER KEY_IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISKEY_ING * FROM, OUT OF OR KEY_IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALKEY_INGS KEY_IN THE SOFTWARE. * */ grammar MML; @lexer::header { using System; using System.Collections.Generic; using System.Text.RegularExpressions; } /* * parser rules */ program : ( NEWLINE | statement )* EOF ; statement : expression NEWLINE ; expression : tempo | volume | length | octave | voice ; tempo : TEMPO INTEGER ; volume : VOLUME INTEGER ; length : LENGTH INTEGER ; octave : OCTAVE INTEGER ; voice : note (AND note)* ; note : NOTE accidential? note_length? dots? | NOTE accidential? PERCENTAGE note_length | REST note_length? dots? | REST PERCENTAGE note_length ; accidential : SHARP | PLUS | MINUS | DOUBLE_SHARP | DOUBLE_PLUS | DOUBLE_MINUS ; note_length : INTEGER ; dots : DOT+ ; /* * lexer rules */ NEWLINE : ( '\r'? '\n' | '\r' ) SPACES? ; NOTE : [A-Ga-g] ; SHARP: '#'; PLUS: '+'; MINUS: '-'; DOUBLE_SHARP: '##'; DOUBLE_PLUS: '++'; DOUBLE_MINUS: '--'; REST : [Rr] ; INTEGER : DIGIT_NON_ZERO DIGIT* ; DOT : '.' ; AND : '&' ; OCTAVE : [Oo] ; OCTAVE_LEFT : '<' ; OCTAVE_RIGHT : '>' ; LENGTH : 'L' ; VOLUME : 'V' ; PRAGMA : '@' ; PERCENTAGE : '%' ; TEMPO : [Tt] ; SKIP_ : ( SPACES | COMMENT | LINE_JOINING ) -> skip ; UNKNOWN_CHAR : . ; /* * fragments */ fragment DIGIT : [0-9] ; fragment DIGIT_NON_ZERO : [1-9] ; fragment SPACES : [ \t]+ ; fragment COMMENT : '/*' .*? '*/' ; fragment LINE_JOINING : '\\' SPACES? ( '\r'? '\n' | '\r' ) ;
oeis/154/A154957.asm
neoneye/loda-programs
11
97723
<gh_stars>10-100 ; A154957: A symmetric (0,1)-triangle. ; Submitted by <NAME>(s4) ; 1,1,1,1,0,1,1,0,0,1,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,0 lpb $0 add $2,1 sub $0,$2 mov $1,$2 sub $1,$0 lpe min $1,$0 mov $0,$1 add $0,1 mod $0,2
P6/data_P6_2/ALUTest161.asm
alxzzhou/BUAA_CO_2020
1
101055
<reponame>alxzzhou/BUAA_CO_2020<gh_stars>1-10 sltu $0,$4,$3 lhu $4,2($0) addiu $1,$0,-16042 sltu $1,$1,$3 nor $4,$2,$3 xori $4,$1,35128 sltu $4,$3,$3 nor $0,$3,$3 and $3,$3,$3 andi $6,$6,58587 subu $0,$1,$3 lh $3,2($0) sltu $0,$0,$3 srav $4,$3,$3 lhu $1,14($0) sltiu $6,$3,26362 lhu $4,12($0) slt $3,$3,$3 sw $1,16($0) lb $3,3($0) sra $3,$5,8 lw $0,16($0) sltu $3,$1,$3 xori $4,$2,40196 srav $3,$3,$3 lh $4,12($0) lhu $3,8($0) ori $5,$1,30345 sra $3,$3,26 nor $4,$4,$3 lbu $4,6($0) nor $5,$6,$3 lh $3,16($0) subu $5,$5,$3 sw $1,0($0) sb $5,10($0) addiu $4,$6,28795 srav $5,$6,$3 lb $5,14($0) andi $5,$1,62128 xor $5,$5,$3 lw $4,12($0) lbu $6,5($0) lbu $4,12($0) addu $0,$0,$3 andi $3,$3,56105 nor $4,$1,$3 addiu $3,$5,24798 ori $1,$1,1126 ori $3,$3,4012 addu $0,$0,$3 lhu $4,0($0) addiu $5,$1,25093 sra $5,$3,6 andi $5,$5,62293 addiu $3,$3,7333 srl $5,$5,27 sb $1,13($0) subu $0,$3,$3 xori $1,$0,29491 addu $3,$3,$3 sra $3,$4,17 sh $4,8($0) xori $3,$5,62001 sltiu $4,$3,-24683 lh $5,10($0) lhu $3,8($0) lh $0,2($0) nor $1,$3,$3 addiu $3,$3,-4353 sltu $4,$3,$3 slti $4,$4,-1971 or $1,$3,$3 xori $0,$3,59231 lw $5,4($0) srl $3,$3,7 sb $4,15($0) nor $1,$6,$3 sw $3,8($0) xori $3,$1,51817 subu $4,$3,$3 lbu $3,3($0) sll $3,$1,20 slt $3,$3,$3 and $3,$3,$3 subu $4,$4,$3 nor $3,$5,$3 addiu $3,$4,-32396 addu $4,$4,$3 addiu $6,$3,-25080 srl $3,$3,14 subu $3,$5,$3 sll $1,$4,2 slt $4,$4,$3 sll $3,$4,7 nor $5,$4,$3 lh $4,10($0) subu $6,$3,$3 subu $5,$3,$3 xori $4,$4,20532 addiu $4,$4,-15429 addiu $1,$0,-10071 sb $3,4($0) sltiu $4,$1,14668 sra $3,$2,26 sra $3,$1,10 sltu $3,$4,$3 addiu $6,$0,14671 srav $0,$1,$3 and $4,$4,$3 andi $4,$4,60410 lbu $4,0($0) addiu $1,$5,19585 srlv $3,$3,$3 lhu $0,0($0) subu $5,$3,$3 sltu $3,$6,$3 lh $4,10($0) addu $4,$4,$3 addiu $4,$3,-13361 xor $4,$3,$3 sltu $6,$6,$3 sra $3,$3,16 addu $3,$2,$3 subu $1,$6,$3 xori $1,$2,51861 srav $4,$4,$3 addu $5,$2,$3 sw $0,16($0) srav $4,$4,$3 lb $3,6($0) sb $3,4($0) sltu $3,$4,$3 sra $4,$4,15 lbu $4,0($0) subu $3,$4,$3 subu $3,$3,$3 lhu $3,2($0) subu $1,$1,$3 subu $0,$3,$3 sb $5,12($0) nor $1,$3,$3 sra $5,$4,21 lw $6,4($0) lbu $0,5($0) xor $3,$3,$3 and $6,$3,$3 ori $0,$4,28120 srav $3,$5,$3 subu $0,$1,$3 andi $1,$3,24281 srav $3,$2,$3 subu $6,$1,$3 subu $3,$0,$3 srav $1,$4,$3 sw $3,16($0) sw $3,8($0) sltiu $4,$5,14390 lb $5,7($0) ori $1,$1,42354 sb $6,11($0) sw $1,0($0) addu $3,$3,$3 sh $3,4($0) srl $4,$4,20 srl $6,$6,11 lbu $1,11($0) lhu $4,2($0) subu $1,$1,$3 addu $4,$4,$3 lb $3,8($0) sra $1,$3,20 slt $0,$6,$3 xor $1,$2,$3 slti $6,$5,17411 srlv $4,$4,$3 lbu $3,2($0) addiu $0,$3,-4822 sra $5,$1,23 ori $1,$1,34558 sllv $3,$3,$3 sh $0,8($0) sltu $0,$3,$3 sltiu $5,$3,-27865 subu $6,$3,$3 slt $3,$1,$3 lw $5,12($0) nor $4,$5,$3 sh $5,0($0) sh $6,6($0) xori $1,$1,44008 xori $4,$4,36859 lbu $0,15($0) addu $5,$5,$3 lbu $5,9($0) slti $3,$0,-6693 sw $1,12($0) sb $4,9($0) andi $5,$3,9953 and $3,$4,$3 sb $1,5($0) ori $5,$6,50770 sra $1,$0,2 and $4,$4,$3 and $5,$0,$3 sltu $5,$2,$3 sll $6,$5,1 srl $1,$5,6 lw $3,4($0) slti $4,$5,29593 lhu $3,6($0) sltiu $1,$6,18099 andi $0,$0,50533 sll $6,$6,15 sllv $4,$4,$3 subu $3,$3,$3 sra $1,$2,22 addu $0,$3,$3 lh $1,14($0) subu $4,$5,$3 addu $1,$5,$3 srlv $5,$3,$3 andi $4,$5,47494 and $4,$3,$3 lw $4,8($0) or $3,$0,$3 slti $1,$4,28018 sw $4,8($0) lb $3,3($0) sw $0,4($0) lw $3,16($0) subu $3,$1,$3 sll $4,$4,29 srlv $3,$3,$3 addu $0,$1,$3 xori $5,$5,53483 and $0,$4,$3 lb $6,0($0) ori $3,$3,62612 andi $3,$3,57857 sltu $4,$4,$3 addiu $3,$5,8686 lb $0,1($0) addu $5,$3,$3 xori $3,$1,26463 srlv $4,$6,$3 lb $0,5($0) addu $3,$3,$3 ori $6,$4,45369 addu $4,$1,$3 lbu $1,13($0) addiu $1,$5,13815 sltiu $6,$3,-10063 sltiu $1,$3,15734 subu $4,$3,$3 xori $6,$3,6396 lhu $5,0($0) sll $3,$4,22 srav $3,$3,$3 sra $3,$6,20 sra $5,$3,23 sb $3,16($0) sltiu $4,$5,20234 nor $4,$4,$3 srlv $4,$3,$3 subu $6,$6,$3 subu $6,$4,$3 slti $6,$3,21023 srlv $3,$4,$3 sltu $5,$5,$3 subu $1,$1,$3 sltu $3,$4,$3 subu $4,$1,$3 slti $4,$4,-13489 sw $1,0($0) or $4,$2,$3 lhu $0,0($0) lw $1,12($0) lbu $5,14($0) ori $3,$0,41123 or $3,$4,$3 slti $6,$4,18673 lb $3,16($0) sllv $4,$1,$3 lh $4,12($0) addu $5,$5,$3 nor $6,$6,$3 or $3,$0,$3 srlv $3,$4,$3 addu $1,$6,$3 lhu $1,16($0) ori $1,$3,20353 addiu $3,$3,25393 sll $3,$5,24 lw $5,4($0) ori $3,$3,42515 addu $0,$3,$3 andi $3,$3,38677 sll $5,$3,13 andi $5,$5,8529 srlv $3,$3,$3 sltiu $1,$3,6077 sll $3,$3,18 xor $3,$5,$3 lbu $6,13($0) or $1,$6,$3 sw $3,16($0) xor $3,$4,$3 srl $1,$4,8 addiu $5,$3,-24841 lh $1,8($0) addiu $3,$4,24252 sltu $1,$4,$3 slti $4,$5,977 andi $1,$3,18708 srlv $5,$1,$3 xori $3,$1,14600 nor $6,$3,$3 lbu $3,1($0) sltu $0,$6,$3 and $3,$3,$3 sra $5,$5,29 slti $3,$5,-32070 addu $5,$0,$3 and $4,$4,$3 lw $3,8($0) slti $1,$3,-6115 sllv $4,$4,$3 sltu $5,$3,$3 subu $0,$4,$3 sw $4,16($0) nor $5,$4,$3 subu $3,$6,$3 sltu $3,$0,$3 srlv $4,$2,$3 subu $3,$3,$3 andi $4,$0,59246 andi $4,$3,30611 srlv $5,$3,$3 sb $5,4($0) sh $3,6($0) sltu $4,$1,$3 sll $0,$3,31 sltu $1,$1,$3 addiu $0,$6,2924 sll $3,$6,23 addu $1,$1,$3 addu $1,$4,$3 slt $3,$4,$3 ori $3,$3,57810 srl $4,$4,11 sh $4,4($0) sb $3,2($0) sltiu $6,$6,31352 sltiu $3,$3,-20685 addiu $3,$3,16410 sw $5,4($0) lb $1,16($0) sltu $4,$3,$3 lw $5,0($0) xor $5,$3,$3 slti $6,$3,-26774 slt $3,$1,$3 lhu $3,10($0) addiu $3,$3,-29824 andi $3,$3,19865 nor $5,$4,$3 lw $4,16($0) lw $3,12($0) xori $1,$1,64897 sltiu $4,$3,-20186 lbu $4,8($0) subu $3,$5,$3 addu $3,$3,$3 lh $5,6($0) srav $3,$0,$3 addiu $5,$5,-27654 addu $3,$1,$3 sb $3,6($0) addiu $1,$4,-32301 lb $4,7($0) sb $3,1($0) sra $4,$4,18 srav $3,$5,$3 addu $6,$4,$3 lb $1,11($0) slt $1,$1,$3 xori $4,$3,3628 slti $4,$4,-10171 srl $1,$6,29 lh $4,0($0) lw $6,8($0) xor $5,$5,$3 xor $1,$4,$3 sltu $1,$4,$3 sh $5,2($0) srl $4,$1,29 addu $5,$4,$3 nor $6,$3,$3 sh $6,8($0) sra $4,$3,6 addiu $4,$4,6268 subu $3,$4,$3 slt $4,$3,$3 addiu $1,$6,-5422 sll $5,$3,17 subu $5,$5,$3 sllv $4,$1,$3 ori $6,$3,13790 andi $1,$3,44519 ori $4,$0,52366 slti $1,$0,21460 and $4,$4,$3 nor $1,$5,$3 xor $4,$5,$3 sra $6,$4,24 sll $3,$0,25 slti $4,$1,11176 sb $4,3($0) lbu $1,10($0) slt $4,$4,$3 lw $3,0($0) slti $3,$1,-28685 lw $1,4($0) xori $1,$3,59952 sll $1,$1,5 lbu $4,0($0) srav $3,$3,$3 and $3,$3,$3 addu $5,$5,$3 sltiu $6,$6,23280 slti $1,$6,-28169 lb $1,5($0) sra $1,$4,28 srl $3,$3,5 srav $0,$0,$3 sw $4,8($0) sltiu $6,$3,-9961 srlv $1,$1,$3 srlv $3,$3,$3 and $4,$4,$3 subu $3,$3,$3 sllv $5,$4,$3 srlv $6,$6,$3 subu $5,$5,$3 lbu $4,14($0) and $3,$3,$3 sll $4,$3,31 andi $3,$5,33290 ori $4,$5,26887 sh $1,8($0) srlv $1,$1,$3 lw $4,8($0) xori $1,$3,54886 lw $3,16($0) sltiu $0,$2,-24682 sra $3,$3,19 addiu $3,$3,17411 xor $3,$3,$3 sb $3,8($0) or $6,$5,$3 ori $5,$0,17270 xor $3,$5,$3 lw $4,4($0) sll $3,$3,25 slt $6,$3,$3 srlv $5,$1,$3 lb $4,12($0) sw $5,8($0) and $0,$0,$3 lb $5,8($0) sll $5,$5,7 srlv $5,$3,$3 addiu $3,$5,11833 slt $5,$1,$3 lhu $4,8($0) sltiu $2,$2,-18466 srav $1,$1,$3 slt $3,$3,$3 lhu $6,2($0) sh $5,12($0) addu $0,$0,$3 sll $2,$2,9 srlv $1,$1,$3 addu $1,$4,$3 sb $6,9($0) srav $4,$0,$3 lh $4,0($0) andi $5,$3,63387 xor $3,$2,$3 srl $3,$3,25 srav $1,$4,$3 slti $4,$5,13769 sb $3,0($0) srl $4,$1,29 xor $1,$4,$3 and $3,$1,$3 or $3,$3,$3 sllv $3,$4,$3 ori $0,$5,22485 sllv $4,$1,$3 addu $5,$3,$3 andi $4,$5,2710 lb $5,4($0) lb $6,4($0) lw $3,16($0) addu $4,$4,$3 sra $4,$4,4 addiu $4,$3,2677 sra $1,$3,19 subu $0,$3,$3 srlv $5,$6,$3 lw $3,0($0) subu $1,$4,$3 lhu $1,0($0) and $3,$3,$3 lh $3,4($0) sltu $4,$4,$3 srlv $5,$0,$3 srl $1,$1,3 sb $1,0($0) sra $3,$1,24 xor $0,$5,$3 sltu $3,$4,$3 subu $6,$3,$3 sll $4,$4,28 sb $4,5($0) addiu $3,$1,17660 sb $3,9($0) lb $4,4($0) sra $1,$1,5 lbu $1,16($0) xori $1,$3,3742 sllv $6,$5,$3 ori $1,$4,47427 sll $1,$4,3 lbu $5,3($0) sltu $3,$4,$3 addiu $4,$4,28775 or $3,$3,$3 srav $5,$3,$3 sb $4,14($0) addu $3,$3,$3 lbu $3,5($0) srl $1,$4,7 sw $1,16($0) xor $4,$5,$3 ori $3,$4,33686 nor $3,$3,$3 slti $0,$3,20684 sltiu $3,$3,19142 slti $6,$1,6639 lhu $3,2($0) lbu $4,9($0) sltiu $5,$5,20580 lh $3,6($0) lw $3,8($0) lw $3,8($0) ori $3,$3,5938 addu $3,$6,$3 ori $5,$0,21248 or $4,$3,$3 srl $1,$1,29 slti $3,$3,-22356 addiu $4,$4,14041 xor $1,$4,$3 xor $4,$4,$3 sw $3,8($0) xori $1,$4,31067 sll $4,$4,2 nor $1,$6,$3 srav $1,$1,$3 sll $4,$4,30 sll $5,$4,26 addu $1,$6,$3 ori $5,$5,35157 srlv $3,$3,$3 lh $3,6($0) lh $3,2($0) srav $1,$3,$3 srav $1,$1,$3 sltu $5,$5,$3 lw $4,0($0) srl $5,$4,14 andi $0,$5,43635 addiu $3,$3,18782 srav $1,$4,$3 or $1,$3,$3 andi $3,$5,18901 lw $4,0($0) slti $0,$4,-10993 addu $5,$3,$3 addu $4,$1,$3 sltu $5,$6,$3 addiu $5,$1,10466 and $1,$3,$3 xor $0,$1,$3 slti $5,$4,20817 subu $3,$1,$3 lh $4,14($0) sll $5,$5,16 addiu $4,$4,-10744 lbu $0,8($0) sb $3,0($0) lb $4,9($0) slt $1,$1,$3 sltiu $4,$1,4292 sltu $5,$4,$3 addu $5,$5,$3 xori $0,$4,10055 sb $3,2($0) sra $1,$3,8 lw $1,8($0) sltiu $5,$3,-24204 addu $3,$3,$3 lh $3,8($0) lbu $5,5($0) lhu $5,10($0) sh $5,6($0) lbu $4,10($0) subu $1,$1,$3 sw $1,8($0) sw $6,4($0) addiu $5,$4,-1832 slt $3,$3,$3 and $5,$4,$3 addiu $3,$4,-20662 nor $5,$5,$3 srl $3,$3,8 addu $5,$3,$3 sb $3,16($0) andi $4,$4,18527 sra $3,$4,5 slti $1,$3,-18709 sh $1,8($0) sh $4,10($0) lbu $0,7($0) or $0,$3,$3 xor $0,$0,$3 lb $6,1($0) addu $0,$0,$3 ori $3,$4,39457 srav $3,$1,$3 subu $4,$3,$3 lbu $6,14($0) srl $5,$5,5 srl $4,$3,5 sb $3,2($0) addu $4,$3,$3 sh $3,6($0) lhu $1,8($0) addiu $5,$1,-285 sb $3,16($0) addu $4,$5,$3 lbu $4,11($0) sll $4,$1,23 sra $4,$0,19 xor $3,$3,$3 srl $0,$0,18 sra $6,$3,6 sw $4,16($0) addiu $3,$5,10967 slti $4,$3,17328 subu $5,$4,$3 sllv $0,$0,$3 addu $5,$5,$3 srl $1,$1,28 ori $4,$3,14176 addu $0,$3,$3 addu $6,$3,$3 lh $4,12($0) lb $5,2($0) or $4,$5,$3 sllv $1,$4,$3 sh $4,4($0) srl $3,$6,20 addiu $0,$5,32665 ori $3,$3,34593 lh $4,14($0) addu $6,$2,$3 addu $3,$1,$3 lbu $4,5($0) or $4,$0,$3 addiu $6,$1,-18947 lh $3,2($0) slt $3,$4,$3 srav $3,$3,$3 addu $1,$2,$3 sll $5,$1,5 sw $1,12($0) addu $1,$1,$3 sltu $3,$3,$3 nor $1,$3,$3 lb $5,5($0) srl $3,$0,21 sltiu $0,$0,-21525 sll $6,$6,1 sltu $3,$4,$3 addiu $0,$0,30219 lh $3,12($0) xori $5,$3,38601 andi $4,$4,30802 xor $5,$3,$3 srav $1,$2,$3 sltu $1,$2,$3 sll $5,$5,18 addiu $1,$3,3332 nor $4,$4,$3 sltiu $5,$3,-6244 lh $1,8($0) lhu $5,2($0) xor $3,$1,$3 sllv $1,$1,$3 addiu $4,$4,25222 addu $4,$4,$3 slti $1,$4,-31229 sll $4,$4,2 or $3,$4,$3 srl $3,$3,8 sll $4,$3,14 srlv $4,$4,$3 subu $6,$6,$3 sll $4,$4,12 nor $6,$2,$3 lh $6,10($0) subu $1,$1,$3 or $3,$3,$3 lhu $3,10($0) sw $5,0($0) addu $3,$4,$3 srl $4,$4,8 subu $3,$4,$3 slti $4,$3,-4282 srl $4,$1,25 addiu $3,$3,29670 andi $6,$6,26095 sb $4,3($0) sllv $3,$3,$3 addiu $3,$3,12262 srav $5,$3,$3 sllv $3,$6,$3 lb $1,2($0) lw $4,16($0) addiu $4,$5,11897 addiu $5,$3,15620 sll $1,$5,19 nor $5,$3,$3 lb $3,3($0) lb $4,12($0) or $4,$1,$3 sltiu $4,$4,-24323 xor $3,$6,$3 addiu $0,$3,-31017 addu $3,$4,$3 andi $1,$0,10061 lh $5,12($0) srl $5,$1,25 slt $3,$0,$3 xor $3,$3,$3 xor $3,$3,$3 lh $3,4($0) lbu $4,15($0) addiu $1,$0,23254 slt $6,$6,$3 srlv $1,$3,$3 xori $0,$3,23202 lhu $3,0($0) sh $3,12($0) sllv $4,$0,$3 lb $3,11($0) andi $1,$1,59425 subu $1,$5,$3 addu $4,$3,$3 xori $4,$4,44845 srlv $1,$3,$3 lw $3,4($0) sllv $0,$1,$3 sb $1,11($0) addiu $3,$3,-27129 and $3,$2,$3 addu $0,$6,$3 nor $4,$5,$3 sw $5,4($0) ori $6,$3,12908 nor $0,$3,$3 srl $3,$1,4 addu $4,$3,$3 and $6,$6,$3 andi $6,$3,8188 srlv $3,$3,$3 sb $3,0($0) xor $3,$3,$3 sllv $4,$5,$3 sra $4,$4,31 sltiu $5,$4,15225 andi $5,$4,51570 lh $2,16($0) sltiu $6,$3,22222 sllv $3,$3,$3 slt $4,$5,$3 srav $0,$4,$3 srav $3,$2,$3 subu $3,$3,$3 subu $3,$6,$3 lhu $1,2($0) subu $1,$3,$3 srlv $5,$6,$3 sb $3,15($0) sltu $3,$3,$3 addiu $1,$5,24695 sw $4,0($0) or $3,$3,$3 srlv $0,$2,$3 lhu $5,16($0) srav $4,$3,$3 ori $0,$6,58668 addiu $3,$3,-21352 srl $1,$4,4 srl $6,$4,3 or $1,$3,$3 sltiu $4,$4,28142 lbu $4,10($0) sra $3,$3,27 subu $6,$0,$3 lbu $4,13($0) sra $3,$1,23 addiu $3,$0,22210 andi $0,$4,41408 xori $5,$4,4730 sra $4,$1,29 sw $3,8($0) andi $4,$6,64592 lh $4,0($0) or $6,$1,$3 addu $1,$3,$3 addu $4,$0,$3 ori $1,$2,48971 lhu $0,6($0) sra $4,$5,14 addiu $5,$1,13346 srlv $3,$3,$3 sllv $1,$5,$3 xor $3,$1,$3 sra $4,$6,22 and $1,$3,$3 srav $3,$3,$3 sb $4,9($0) lbu $4,11($0) srav $3,$0,$3 srl $1,$1,11 sw $0,8($0) sllv $5,$5,$3 sll $3,$3,6 subu $4,$5,$3 sltiu $5,$3,10708 addiu $4,$5,13215 nor $4,$0,$3 srl $3,$3,27 srl $3,$3,19 or $4,$3,$3 subu $0,$1,$3 lb $4,5($0) andi $5,$4,44862 lw $3,8($0) addu $1,$3,$3 srav $3,$3,$3 and $3,$5,$3 lw $5,16($0) addu $4,$6,$3 addiu $5,$2,13720 srlv $4,$1,$3 xori $1,$1,54151 sllv $3,$4,$3 subu $4,$3,$3 sw $3,4($0) lw $4,4($0) sllv $1,$5,$3 addu $3,$4,$3 subu $3,$3,$3 andi $4,$4,31298 srav $5,$5,$3 addiu $5,$4,-25232 sra $1,$6,31 addiu $0,$0,31206 sll $4,$3,3 sra $3,$5,27 or $1,$3,$3 xor $1,$4,$3
src/words_engine/words_engine-pearse_code.ads
spr93/whitakers-words
204
5369
-- WORDS, a Latin dictionary, by <NAME> (USAF, Retired) -- -- Copyright <NAME> (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. -- -- These codes are named for classicist and WORDS redistributor Roger Pearse -- package Words_Engine.Pearse_Code is type Symbol is ( Unknown, -- 00 Inflection, -- 01 Citation_Form, -- 02 Gloss, -- 03 Unknowns_2, -- 04 Affix, -- 05 Trick -- 06 ); function Format (S : Symbol) return String; end Words_Engine.Pearse_Code;
sources/isal/include/multibinary.asm
intel/qpl
11
90903
<reponame>intel/qpl ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright (C) 2022 Intel Corporation ; ; SPDX-License-Identifier: MIT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; %ifndef _MULTIBINARY_ASM_ %define _MULTIBINARY_ASM_ %ifidn __OUTPUT_FORMAT__, elf32 %define mbin_def_ptr dd %define mbin_ptr_sz dword %define mbin_rdi edi %define mbin_rsi esi %define mbin_rax eax %define mbin_rbx ebx %define mbin_rcx ecx %define mbin_rdx edx %else %define mbin_def_ptr dq %define mbin_ptr_sz qword %define mbin_rdi rdi %define mbin_rsi rsi %define mbin_rax rax %define mbin_rbx rbx %define mbin_rcx rcx %define mbin_rdx rdx %endif %ifndef AS_FEATURE_LEVEL %define AS_FEATURE_LEVEL 4 %endif ;;;; ; multibinary macro: ; creates the visable entry point that uses HW optimized call pointer ; creates the init of the HW optimized call pointer ;;;; %macro mbin_interface 1 ;;;; ; *_dispatched is defaulted to *_mbinit and replaced on first call. ; Therefore, *_dispatch_init is only executed on first call. ;;;; section .data %1_dispatched: mbin_def_ptr %1_mbinit section .text mk_global %1, function %1_mbinit: endbranch ;;; only called the first time to setup hardware match call %1_dispatch_init ;;; falls thru to execute the hw optimized code %1: endbranch jmp mbin_ptr_sz [%1_dispatched] %endmacro ;;;;; ; mbin_dispatch_init parameters ; Use this function when SSE/00/01 is a minimum requirement ; 1-> function name ; 2-> SSE/00/01 optimized function used as base ; 3-> AVX or AVX/02 opt func ; 4-> AVX2 or AVX/04 opt func ;;;;; %macro mbin_dispatch_init 4 section .text %1_dispatch_init: push mbin_rsi push mbin_rax push mbin_rbx push mbin_rcx push mbin_rdx lea mbin_rsi, [%2 WRT_OPT] ; Default to SSE 00/01 mov eax, 1 cpuid and ecx, (FLAG_CPUID1_ECX_AVX | FLAG_CPUID1_ECX_OSXSAVE) cmp ecx, (FLAG_CPUID1_ECX_AVX | FLAG_CPUID1_ECX_OSXSAVE) lea mbin_rbx, [%3 WRT_OPT] ; AVX (gen2) opt func jne _%1_init_done ; AVX is not available so end mov mbin_rsi, mbin_rbx ;; Try for AVX2 xor ecx, ecx mov eax, 7 cpuid test ebx, FLAG_CPUID7_EBX_AVX2 lea mbin_rbx, [%4 WRT_OPT] ; AVX (gen4) opt func cmovne mbin_rsi, mbin_rbx ;; Does it have xmm and ymm support xor ecx, ecx xgetbv and eax, FLAG_XGETBV_EAX_XMM_YMM cmp eax, FLAG_XGETBV_EAX_XMM_YMM je _%1_init_done lea mbin_rsi, [%2 WRT_OPT] _%1_init_done: pop mbin_rdx pop mbin_rcx pop mbin_rbx pop mbin_rax mov [%1_dispatched], mbin_rsi pop mbin_rsi ret %endmacro ;;;;; ; mbin_dispatch_init2 parameters ; Cases where only base functions are available ; 1-> function name ; 2-> base function ;;;;; %macro mbin_dispatch_init2 2 section .text %1_dispatch_init: push mbin_rsi lea mbin_rsi, [%2 WRT_OPT] ; Default mov [%1_dispatched], mbin_rsi pop mbin_rsi ret %endmacro ;;;;; ; mbin_dispatch_init_clmul 3 parameters ; Use this case for CRC which needs both SSE4_1 and CLMUL ; 1-> function name ; 2-> base function ; 3-> SSE4_1 and CLMUL optimized function ; 4-> AVX/02 opt func ; 5-> AVX512/10 opt func ;;;;; %macro mbin_dispatch_init_clmul 5 section .text %1_dispatch_init: push mbin_rsi push mbin_rax push mbin_rbx push mbin_rcx push mbin_rdx push mbin_rdi lea mbin_rsi, [%2 WRT_OPT] ; Default - use base function mov eax, 1 cpuid mov ebx, ecx ; save cpuid1.ecx test ecx, FLAG_CPUID1_ECX_SSE4_1 jz _%1_init_done test ecx, FLAG_CPUID1_ECX_CLMUL jz _%1_init_done lea mbin_rsi, [%3 WRT_OPT] ; SSE possible so use 00/01 opt ;; Test for XMM_YMM support/AVX test ecx, FLAG_CPUID1_ECX_OSXSAVE je _%1_init_done xor ecx, ecx xgetbv ; xcr -> edx:eax mov edi, eax ; save xgetvb.eax and eax, FLAG_XGETBV_EAX_XMM_YMM cmp eax, FLAG_XGETBV_EAX_XMM_YMM jne _%1_init_done test ebx, FLAG_CPUID1_ECX_AVX je _%1_init_done lea mbin_rsi, [%4 WRT_OPT] ; AVX/02 opt %if AS_FEATURE_LEVEL >= 10 ;; Test for AVX2 xor ecx, ecx mov eax, 7 cpuid test ebx, FLAG_CPUID7_EBX_AVX2 je _%1_init_done ; No AVX2 possible ;; Test for AVX512 and edi, FLAG_XGETBV_EAX_ZMM_OPM cmp edi, FLAG_XGETBV_EAX_ZMM_OPM jne _%1_init_done ; No AVX512 possible and ebx, FLAGS_CPUID7_EBX_AVX512_G1 cmp ebx, FLAGS_CPUID7_EBX_AVX512_G1 jne _%1_init_done and ecx, FLAGS_CPUID7_ECX_AVX512_G2 cmp ecx, FLAGS_CPUID7_ECX_AVX512_G2 lea mbin_rbx, [%5 WRT_OPT] ; AVX512/10 opt cmove mbin_rsi, mbin_rbx %endif _%1_init_done: pop mbin_rdi pop mbin_rdx pop mbin_rcx pop mbin_rbx pop mbin_rax mov [%1_dispatched], mbin_rsi pop mbin_rsi ret %endmacro ;;;;; ; mbin_dispatch_init5 parameters ; 1-> function name ; 2-> base function ; 3-> SSE4_2 or 00/01 optimized function ; 4-> AVX/02 opt func ; 5-> AVX2/04 opt func ;;;;; %macro mbin_dispatch_init5 5 section .text %1_dispatch_init: push mbin_rsi push mbin_rax push mbin_rbx push mbin_rcx push mbin_rdx lea mbin_rsi, [%2 WRT_OPT] ; Default - use base function mov eax, 1 cpuid ; Test for SSE4.2 test ecx, FLAG_CPUID1_ECX_SSE4_2 lea mbin_rbx, [%3 WRT_OPT] ; SSE opt func cmovne mbin_rsi, mbin_rbx and ecx, (FLAG_CPUID1_ECX_AVX | FLAG_CPUID1_ECX_OSXSAVE) cmp ecx, (FLAG_CPUID1_ECX_AVX | FLAG_CPUID1_ECX_OSXSAVE) lea mbin_rbx, [%4 WRT_OPT] ; AVX (gen2) opt func jne _%1_init_done ; AVX is not available so end mov mbin_rsi, mbin_rbx ;; Try for AVX2 xor ecx, ecx mov eax, 7 cpuid test ebx, FLAG_CPUID7_EBX_AVX2 lea mbin_rbx, [%5 WRT_OPT] ; AVX (gen4) opt func cmovne mbin_rsi, mbin_rbx ;; Does it have xmm and ymm support xor ecx, ecx xgetbv and eax, FLAG_XGETBV_EAX_XMM_YMM cmp eax, FLAG_XGETBV_EAX_XMM_YMM je _%1_init_done lea mbin_rsi, [%3 WRT_OPT] _%1_init_done: pop mbin_rdx pop mbin_rcx pop mbin_rbx pop mbin_rax mov [%1_dispatched], mbin_rsi pop mbin_rsi ret %endmacro %if AS_FEATURE_LEVEL >= 6 ;;;;; ; mbin_dispatch_init6 parameters ; 1-> function name ; 2-> base function ; 3-> SSE4_2 or 00/01 optimized function ; 4-> AVX/02 opt func ; 5-> AVX2/04 opt func ; 6-> AVX512/06 opt func ;;;;; %macro mbin_dispatch_init6 6 section .text %1_dispatch_init: push mbin_rsi push mbin_rax push mbin_rbx push mbin_rcx push mbin_rdx push mbin_rdi lea mbin_rsi, [%2 WRT_OPT] ; Default - use base function mov eax, 1 cpuid mov ebx, ecx ; save cpuid1.ecx test ecx, FLAG_CPUID1_ECX_SSE4_2 je _%1_init_done ; Use base function if no SSE4_2 lea mbin_rsi, [%3 WRT_OPT] ; SSE possible so use 00/01 opt ;; Test for XMM_YMM support/AVX test ecx, FLAG_CPUID1_ECX_OSXSAVE je _%1_init_done xor ecx, ecx xgetbv ; xcr -> edx:eax mov edi, eax ; save xgetvb.eax and eax, FLAG_XGETBV_EAX_XMM_YMM cmp eax, FLAG_XGETBV_EAX_XMM_YMM jne _%1_init_done test ebx, FLAG_CPUID1_ECX_AVX je _%1_init_done lea mbin_rsi, [%4 WRT_OPT] ; AVX/02 opt ;; Test for AVX2 xor ecx, ecx mov eax, 7 cpuid test ebx, FLAG_CPUID7_EBX_AVX2 je _%1_init_done ; No AVX2 possible lea mbin_rsi, [%5 WRT_OPT] ; AVX2/04 opt func ;; Test for AVX512 and edi, FLAG_XGETBV_EAX_ZMM_OPM cmp edi, FLAG_XGETBV_EAX_ZMM_OPM jne _%1_init_done ; No AVX512 possible and ebx, FLAGS_CPUID7_EBX_AVX512_G1 cmp ebx, FLAGS_CPUID7_EBX_AVX512_G1 lea mbin_rbx, [%6 WRT_OPT] ; AVX512/06 opt cmove mbin_rsi, mbin_rbx _%1_init_done: pop mbin_rdi pop mbin_rdx pop mbin_rcx pop mbin_rbx pop mbin_rax mov [%1_dispatched], mbin_rsi pop mbin_rsi ret %endmacro %else %macro mbin_dispatch_init6 6 mbin_dispatch_init5 %1, %2, %3, %4, %5 %endmacro %endif %if AS_FEATURE_LEVEL >= 10 ;;;;; ; mbin_dispatch_init7 parameters ; 1-> function name ; 2-> base function ; 3-> SSE4_2 or 00/01 optimized function ; 4-> AVX/02 opt func ; 5-> AVX2/04 opt func ; 6-> AVX512/06 opt func ; 7-> AVX512 Update/10 opt func ;;;;; %macro mbin_dispatch_init7 7 section .text %1_dispatch_init: push mbin_rsi push mbin_rax push mbin_rbx push mbin_rcx push mbin_rdx push mbin_rdi lea mbin_rsi, [%2 WRT_OPT] ; Default - use base function mov eax, 1 cpuid mov ebx, ecx ; save cpuid1.ecx test ecx, FLAG_CPUID1_ECX_SSE4_2 je _%1_init_done ; Use base function if no SSE4_2 lea mbin_rsi, [%3 WRT_OPT] ; SSE possible so use 00/01 opt ;; Test for XMM_YMM support/AVX test ecx, FLAG_CPUID1_ECX_OSXSAVE je _%1_init_done xor ecx, ecx xgetbv ; xcr -> edx:eax mov edi, eax ; save xgetvb.eax and eax, FLAG_XGETBV_EAX_XMM_YMM cmp eax, FLAG_XGETBV_EAX_XMM_YMM jne _%1_init_done test ebx, FLAG_CPUID1_ECX_AVX je _%1_init_done lea mbin_rsi, [%4 WRT_OPT] ; AVX/02 opt ;; Test for AVX2 xor ecx, ecx mov eax, 7 cpuid test ebx, FLAG_CPUID7_EBX_AVX2 je _%1_init_done ; No AVX2 possible lea mbin_rsi, [%5 WRT_OPT] ; AVX2/04 opt func ;; Test for AVX512 and edi, FLAG_XGETBV_EAX_ZMM_OPM cmp edi, FLAG_XGETBV_EAX_ZMM_OPM jne _%1_init_done ; No AVX512 possible and ebx, FLAGS_CPUID7_EBX_AVX512_G1 cmp ebx, FLAGS_CPUID7_EBX_AVX512_G1 lea mbin_rbx, [%6 WRT_OPT] ; AVX512/06 opt cmove mbin_rsi, mbin_rbx and ecx, FLAGS_CPUID7_ECX_AVX512_G2 cmp ecx, FLAGS_CPUID7_ECX_AVX512_G2 lea mbin_rbx, [%7 WRT_OPT] ; AVX512/06 opt cmove mbin_rsi, mbin_rbx _%1_init_done: pop mbin_rdi pop mbin_rdx pop mbin_rcx pop mbin_rbx pop mbin_rax mov [%1_dispatched], mbin_rsi pop mbin_rsi ret %endmacro %else %macro mbin_dispatch_init7 7 mbin_dispatch_init6 %1, %2, %3, %4, %5, %6 %endmacro %endif %endif ; ifndef _MULTIBINARY_ASM_
cpu/interrupt.asm
Menotdan/flametest
0
166026
<filename>cpu/interrupt.asm<gh_stars>0 ; Defined in isr.c [extern isr_handler] [extern irq_handler] ; Common ISR code isr_common_stub: ; 1. Save CPU state pushad ; 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 ; kernel data segment descriptor mov ds, ax mov es, ax mov fs, ax mov gs, ax push esp ; 2. Call C handler call isr_handler pop eax ; 3. Restore state pop eax mov ds, ax mov es, ax mov fs, ax mov gs, ax popad 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 ; Common IRQ code. Identical to ISR code except for the 'call' ; and the 'pop ebx' irq_common_stub: pushad mov ax, ds push eax mov ax, 0x10 ;0x10 mov ds, ax mov es, ax mov fs, ax mov gs, ax push esp ; At this point ESP is a pointer to where DS (and the rest ; of the interrupt handler state resides) ; Push ESP as 1st parameter as it's a ; pointer to a registers_t call irq_handler pop ebx ; Remove the saved ESP on the stack. Efficient to just pop it ; into any register. You could have done: add esp, 4 as well pop ebx mov ds, bx mov es, bx mov fs, bx mov gs, bx popad add esp, 8 sti iret ; We don't get information about which interrupt was caller ; when the handler is run, so we will need to have a different handler ; for every interrupt. ; Furthermore, some interrupts push an error code onto the stack but others ; don't, so we will push a dummy error code for those which don't, so that ; we have a consistent stack for all of them. ; First make the ISRs global global isr0 global isr1 global isr2 global isr3 global isr4 global isr5 global isr6 global isr7 global isr8 global isr9 global isr10 global isr11 global isr12 global isr13 global isr14 global isr15 global isr16 global isr17 global isr18 global isr19 global isr20 global isr21 global isr22 global isr23 global isr24 global isr25 global isr26 global isr27 global isr28 global isr29 global isr30 global isr31 ; IRQs global irq0 global irq1 global irq2 global irq3 global irq4 global irq5 global irq6 global irq7 global irq8 global irq9 global irq10 global irq11 global irq12 global irq13 global irq14 global irq15 ; 0: Divide By Zero Exception isr0: cli push byte 0 push byte 0 jmp isr_common_stub ; 1: Debug Exception isr1: cli push byte 0 push byte 1 jmp isr_common_stub ; 2: Non Maskable Interrupt Exception isr2: cli push byte 0 push byte 2 jmp isr_common_stub ; 3: Int 3 Exception isr3: cli push byte 0 push byte 3 jmp isr_common_stub ; 4: INTO Exception isr4: cli push byte 0 push byte 4 jmp isr_common_stub ; 5: Out of Bounds Exception isr5: cli push byte 0 push byte 5 jmp isr_common_stub ; 6: Invalid Opcode Exception isr6: cli push byte 0 push byte 6 jmp isr_common_stub ; 7: Coprocessor Not Available Exception isr7: cli push byte 0 push byte 7 jmp isr_common_stub ; 8: Double Fault Exception (With Error Code!) isr8: cli push byte 8 jmp isr_common_stub ; 9: Coprocessor Segment Overrun Exception isr9: cli push byte 0 push byte 9 jmp isr_common_stub ; 10: Bad TSS Exception (With Error Code!) isr10: cli push byte 10 jmp isr_common_stub ; 11: Segment Not Present Exception (With Error Code!) isr11: cli push byte 11 jmp isr_common_stub ; 12: Stack Fault Exception (With Error Code!) isr12: cli push byte 12 jmp isr_common_stub ; 13: General Protection Fault Exception (With Error Code!) isr13: cli push byte 13 jmp isr_common_stub ; 14: Page Fault Exception (With Error Code!) isr14: cli push byte 14 jmp isr_common_stub ; 15: Reserved Exception isr15: cli push byte 0 push byte 15 jmp isr_common_stub ; 16: Floating Point Exception isr16: cli push byte 0 push byte 16 jmp isr_common_stub ; 17: Alignment Check Exception isr17: cli push byte 0 push byte 17 jmp isr_common_stub ; 18: Machine Check Exception isr18: cli push byte 0 push byte 18 jmp isr_common_stub ; 19: Reserved isr19: cli push byte 0 push byte 19 jmp isr_common_stub ; 20: Reserved isr20: cli push byte 0 push byte 20 jmp isr_common_stub ; 21: Reserved isr21: cli push byte 0 push byte 21 jmp isr_common_stub ; 22: Reserved isr22: cli push byte 0 push byte 22 jmp isr_common_stub ; 23: Reserved isr23: cli push byte 0 push byte 23 jmp isr_common_stub ; 24: Reserved isr24: cli push byte 0 push byte 24 jmp isr_common_stub ; 25: Reserved isr25: cli push byte 0 push byte 25 jmp isr_common_stub ; 26: Reserved isr26: cli push byte 0 push byte 26 jmp isr_common_stub ; 27: Reserved isr27: cli push byte 0 push byte 27 jmp isr_common_stub ; 28: Reserved isr28: cli push byte 0 push byte 28 jmp isr_common_stub ; 29: Reserved isr29: cli push byte 0 push byte 29 jmp isr_common_stub ; 30: Reserved isr30: cli push byte 0 push byte 30 jmp isr_common_stub ; 31: Reserved isr31: cli push byte 0 push byte 31 jmp isr_common_stub ; IRQ handlers irq0: cli push byte 0 push byte 32 jmp irq_common_stub irq1: cli push byte 1 push byte 33 jmp irq_common_stub irq2: cli push byte 2 push byte 34 jmp irq_common_stub irq3: cli push byte 3 push byte 35 jmp irq_common_stub irq4: cli push byte 4 push byte 36 jmp irq_common_stub irq5: cli push byte 5 push byte 37 jmp irq_common_stub irq6: cli push byte 6 push byte 38 jmp irq_common_stub irq7: cli push byte 7 push byte 39 jmp irq_common_stub irq8: cli push byte 8 push byte 40 jmp irq_common_stub irq9: cli push byte 9 push byte 41 jmp irq_common_stub irq10: cli push byte 10 push byte 42 jmp irq_common_stub irq11: cli push byte 11 push byte 43 jmp irq_common_stub irq12: cli push byte 12 push byte 44 jmp irq_common_stub irq13: cli push byte 13 push byte 45 jmp irq_common_stub irq14: cli push byte 14 push byte 46 jmp irq_common_stub irq15: cli push byte 15 push byte 47 jmp irq_common_stub
src/oled_sh1106-display.adb
KLOC-Karsten/adaoled
0
29092
with GPIO; with SPI; with Interfaces; use Interfaces; with Ada.Text_IO; package body OLED_SH1106.Display is procedure Reset is begin GPIO.Write(OLED_RST, 1); delay 0.1; GPIO.Write(OLED_RST, 0); delay 0.1; GPIO.Write(OLED_RST, 1); delay 0.1; end Reset; procedure Write_Reg(Reg: Unsigned_8) is begin GPIO.Write(OLED_DC, 0); SPI.Write(Reg); end Write_Reg; procedure Start_Data is begin GPIO.Write(OLED_DC, 1); end Start_Data; procedure Write_Data(Data: Unsigned_8) is begin SPI.Write(Data); end Write_Data; procedure Init_Reg is begin Write_Reg(16#AE#); -- --turn off oled panel Write_Reg(16#02#); -- ---set low column address Write_Reg(16#10#); -- ---set high column address Write_Reg(16#40#); -- --set start line address Set Mapping RAM Display Start Line (0x00~0x3F) Write_Reg(16#81#); -- --set contrast control register Write_Reg(16#A0#); -- --Set SEG/Column Mapping Write_Reg(16#C0#); -- Set COM/Row Scan Direction Write_Reg(16#A6#); -- --set normal display Write_Reg(16#A8#); -- --set multiplex ratio(1 to 64) Write_Reg(16#3F#); -- --1/64 duty Write_Reg(16#D3#); -- -set display offset Shift Mapping RAM Counter (0x00~0x3F) Write_Reg(16#00#); -- -not offset Write_Reg(16#d5#); -- --set display clock divide ratio/oscillator frequency Write_Reg(16#80#); -- --set divide ratio, Set Clock as 100 Frames/Sec Write_Reg(16#D9#); -- --set pre-charge period Write_Reg(16#F1#); -- Set Pre-Charge as 15 Clocks & Discharge as 1 Clock Write_Reg(16#DA#); -- --set com pins hardware configuration Write_Reg(16#12#); Write_Reg(16#DB#); -- --set vcomh Write_Reg(16#40#); -- Set VCOM Deselect Level Write_Reg(16#20#); -- -Set Page Addressing Mode (0x00/0x01/0x02) Write_Reg(16#02#); -- Write_Reg(16#A4#); -- Disable Entire Display On (0xa4/0xa5) Write_Reg(16#A6#); -- Disable Inverse Display On (0xa6/a7) end Init_Reg; procedure Init_GPIOs is begin GPIO.Set_Mode(OLED_RST, GPIO.MODE_OUTPUT); GPIO.Set_Mode(OLED_DC, GPIO.MODE_OUTPUT); GPIO.Set_Mode(OLED_CS, GPIO.MODE_OUTPUT); GPIO.Set_Mode(KEY_UP_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY_DOWN_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY_LEFT_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY_RIGHT_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY_PRESS_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY1_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY2_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY3_PIN, GPIO.MODE_INPUT); end Init_GPIOs; function Module_Init return Boolean is begin if GPIO.Init = 0 then return false; end if; Init_GPIOs; SPI.Start; SPI.Set_Bit_Order(SPI.BIT_ORDER_MSBFIRST); SPI.Set_Data_Mode(SPI.MODE0); SPI.Set_Clock_Divider(SPI.CLOCK_DIVIDER_128); SPI.Set_Chip_Select(SPI.CS0); SPI.Set_Chip_Select_Polarity(SPI.CS0, SPI.LOW); return true; end Module_Init; end OLED_SH1106.Display;
SMT-Extension/examples/int1.als
philippemerle/Alloy2CVC4
1
1805
<gh_stars>1-10 sig a, b, c, d in Int {} fact add{plus[a,b] = c + d} fact subtract{minus[a,b] = c - d} fact notEqual{a != c and b != d} fact nonzero {a > 0 and b > 0 and c > 0 and d > 0}
oeis/228/A228842.asm
neoneye/loda-programs
11
241759
; A228842: Binomial transform of A014448. ; 2,6,28,144,752,3936,20608,107904,564992,2958336,15490048,81106944,424681472,2223661056,11643240448,60964798464,319215828992,1671435780096,8751751364608,45824765067264,239941584945152,1256350449401856,6578336356630528,34444616342175744,180354352626532352,944347650390491136,4944668491836817408,25890620349458939904,135565048129406369792,709827807378602459136,3716706651753989275648,19460928681009525817344,101898745479041197801472,533548758150209083539456,2793697566985089710030848 mov $1,2 lpb $0 sub $0,1 mul $1,2 sub $1,1 add $2,$1 add $1,$2 mul $2,2 lpe mov $0,$1
u7bg/include/u7bg-segments.asm
JohnGlassmyer/UltimaHacks
68
96795
<filename>u7bg/include/u7bg-segments.asm ; u7.exe (0xACE60 bytes) ; segments.asm generated by UltimaPatcher on 20180908 ; https://github.com/JohnGlassmyer/UltimaHacks defineSegment 0, 0x0000, 0x0000 defineSegment 1, 0x0008, 0x0428 defineSegment 2, 0x0010, 0x042E defineSegment 3, 0x0018, 0x0504 defineSegment 4, 0x0020, 0x05DC defineSegment 5, 0x0028, 0x07DA defineSegment 6, 0x0030, 0x0890 defineSegment 7, 0x0038, 0x0928 defineSegment 8, 0x0040, 0x0A31 defineSegment 9, 0x0048, 0x0ABE defineSegment 10, 0x0050, 0x0AE7 defineSegment 11, 0x0058, 0x0B49 defineSegment 12, 0x0060, 0x0B62 defineSegment 13, 0x0068, 0x0CBD defineSegment 14, 0x0070, 0x0CF8 defineSegment 15, 0x0078, 0x0D05 defineSegment 16, 0x0080, 0x0D1F ;defineSegment 17, 0x0088, 0x0D54 ; zero-length segment defineSegment 18, 0x0090, 0x0D54 defineSegment 19, 0x0098, 0x0D62 defineSegment 20, 0x00A0, 0x0D8F ;defineSegment 21, 0x00A8, 0x0D91 ; zero-length segment defineSegment 22, 0x00B0, 0x0D91 defineSegment 23, 0x00B8, 0x0DBF defineSegment 24, 0x00C0, 0x0EDF defineSegment 25, 0x00C8, 0x0EE5 ;defineSegment 26, 0x00D0, 0x0FD5 ; zero-length segment defineSegment 27, 0x00D8, 0x0FD5 defineSegment 28, 0x00E0, 0x13B5 defineSegment 29, 0x00E8, 0x13BE defineSegment 30, 0x00F0, 0x13DE defineSegment 31, 0x00F8, 0x1407 defineSegment 32, 0x0100, 0x1503 defineSegment 33, 0x0108, 0x1529 defineSegment 34, 0x0110, 0x1546 defineSegment 35, 0x0118, 0x1573 defineSegment 36, 0x0120, 0x15AC defineSegment 37, 0x0128, 0x15B8 defineSegment 38, 0x0130, 0x16F5 defineSegment 39, 0x0138, 0x1731 defineSegment 40, 0x0140, 0x1740 defineSegment 41, 0x0148, 0x1746 ;defineSegment 42, 0x0150, 0x19AA ; zero-length segment defineSegment 43, 0x0158, 0x19AA defineSegment 44, 0x0160, 0x19B1 defineSegment 45, 0x0168, 0x19B7 defineSegment 46, 0x0170, 0x19BF defineSegment 47, 0x0178, 0x1A50 defineSegment 48, 0x0180, 0x1AF6 defineSegment 49, 0x0188, 0x1B4A defineSegment 50, 0x0190, 0x1BD9 defineSegment 51, 0x0198, 0x1BED defineSegment 52, 0x01A0, 0x1BF3 defineSegment 53, 0x01A8, 0x1BF8 defineSegment 54, 0x01B0, 0x1C2A defineSegment 55, 0x01B8, 0x1C3A defineSegment 56, 0x01C0, 0x1C3E defineSegment 57, 0x01C8, 0x1CCF defineSegment 58, 0x01D0, 0x1D5D defineSegment 59, 0x01D8, 0x1D73 defineSegment 60, 0x01E0, 0x1DE8 defineSegment 61, 0x01E8, 0x1FDA defineSegment 62, 0x01F0, 0x1FFD defineSegment 63, 0x01F8, 0x20C9 defineSegment 64, 0x0200, 0x20D2 defineSegment 65, 0x0208, 0x20DD defineSegment 66, 0x0210, 0x2191 defineSegment 67, 0x0218, 0x2197 defineSegment 68, 0x0220, 0x219F defineSegment 69, 0x0228, 0x21C5 defineSegment 70, 0x0230, 0x21F0 defineSegment 71, 0x0238, 0x227F defineSegment 72, 0x0240, 0x2345 defineSegment 73, 0x0248, 0x25CC defineSegment 74, 0x0250, 0x25E0 defineSegment 75, 0x0258, 0x2603 defineSegment 76, 0x0260, 0x2614 defineSegment 77, 0x0268, 0x2673 defineSegment 78, 0x0270, 0x2680 defineSegment 79, 0x0278, 0x26C9 defineSegment 80, 0x0280, 0x26CE ;defineSegment 81, 0x0288, 0x26D2 ; zero-length segment defineSegment 82, 0x0290, 0x26D2 defineSegment 83, 0x0298, 0x26F0 defineSegment 84, 0x02A0, 0x27A1 ;defineSegment 85, 0x02A8, 0x2807 ; zero-length segment defineSegment 86, 0x02B0, 0x2807 defineSegment 87, 0x02B8, 0x2A9C defineSegment 88, 0x02C0, 0x2BD8 defineSegment 89, 0x02C8, 0x2BE2 defineSegment 90, 0x02D0, 0x2BEB defineSegment 91, 0x02D8, 0x2D20 defineSegment 92, 0x02E0, 0x2D2F defineSegment 93, 0x02E8, 0x2D5E defineSegment 94, 0x02F0, 0x2E4E defineSegment 95, 0x02F8, 0x2E58 defineSegment 96, 0x0300, 0x2E5F defineSegment 97, 0x0308, 0x30DB defineSegment 98, 0x0310, 0x30F9 defineSegment 99, 0x0318, 0x3104 defineSegment 100, 0x0320, 0x3158 defineSegment 101, 0x0328, 0x3168 ;defineSegment 102, 0x0330, 0x3178 ; zero-length segment defineSegment 103, 0x0338, 0x3178 defineSegment 104, 0x0340, 0x3183 defineSegment 105, 0x0348, 0x31BC defineSegment 106, 0x0350, 0x31CB defineSegment 107, 0x0358, 0x3296 defineSegment 108, 0x0360, 0x32B0 defineSegment 109, 0x0368, 0x32E6 defineSegment 110, 0x0370, 0x331D ;defineSegment 111, 0x0378, 0x332E ; zero-length segment ;defineSegment 112, 0x0380, 0x332E ; zero-length segment ;defineSegment 113, 0x0388, 0x332E ; zero-length segment defineSegment 114, 0x0390, 0x332E defineSegment 115, 0x0398, 0x3469 defineSegment 116, 0x03A0, 0x3472 defineSegment 117, 0x03A8, 0x3527 defineSegment 118, 0x03B0, 0x355D defineSegment 119, 0x03B8, 0x369F defineSegment 120, 0x03C0, 0x389D defineSegment 121, 0x03C8, 0x38A0 defineSegment 122, 0x03D0, 0x38A2 defineSegment 123, 0x03D8, 0x38A4 defineSegment 124, 0x03E0, 0x38B6 defineSegment 125, 0x03E8, 0x38B9 defineSegment 126, 0x03F0, 0x38C4 defineSegment 127, 0x03F8, 0x38CD defineSegment 128, 0x0400, 0x38E7 defineSegment 129, 0x0408, 0x38EB defineSegment 130, 0x0410, 0x38F6 defineSegment 131, 0x0418, 0x3905 defineSegment 132, 0x0420, 0x390A defineSegment 133, 0x0428, 0x390D defineSegment 134, 0x0430, 0x3910 defineSegment 135, 0x0438, 0x3912 ;defineSegment 136, 0x0440, 0x3916 ; zero-length segment defineSegment 137, 0x0448, 0x3916 defineSegment 138, 0x0450, 0x3920 defineSegment 139, 0x0458, 0x39EE defineSegment 140, 0x0460, 0x3A02 defineSegment 141, 0x0468, 0x3A09 defineSegment 142, 0x0470, 0x3A1D defineSegment 143, 0x0478, 0x3A21 defineSegment 144, 0x0480, 0x3A26 defineSegment 145, 0x0488, 0x3A37 ;defineSegment 146, 0x0490, 0x3A4D ; zero-length segment ;defineSegment 147, 0x0498, 0x3A4D ; zero-length segment ;defineSegment 148, 0x04A0, 0x3A4D ; zero-length segment defineSegment 149, 0x04A8, 0x3A4D ;defineSegment 150, 0x04B0, 0x3A4F ; zero-length segment ;defineSegment 151, 0x04B8, 0x3A4F ; zero-length segment ;defineSegment 152, 0x04C0, 0x3A4F ; zero-length segment ;defineSegment 153, 0x04C8, 0x3A4F ; zero-length segment defineSegment 154, 0x04D0, 0x3A4F ;defineSegment 155, 0x04D8, 0x3A5C ; zero-length segment defineSegment 156, 0x04E0, 0x3A5C defineSegment 157, 0x04E8, 0x3A6F defineSegment 158, 0x04F0, 0x3A70 defineSegment 159, 0x04F8, 0x3A77 defineSegment 160, 0x0500, 0x3A7F defineSegment 161, 0x0508, 0x3A83 ;defineSegment 162, 0x0510, 0x3A88 ; zero-length segment ;defineSegment 163, 0x0518, 0x3A88 ; zero-length segment ;defineSegment 164, 0x0520, 0x3A88 ; zero-length segment ;defineSegment 165, 0x0528, 0x3A88 ; zero-length segment ;defineSegment 166, 0x0530, 0x3A88 ; zero-length segment ;defineSegment 167, 0x0538, 0x3A88 ; zero-length segment ;defineSegment 168, 0x0540, 0x3A88 ; zero-length segment defineSegment 169, 0x0548, 0x3A88 ;defineSegment 170, 0x0550, 0x3A95 ; zero-length segment ;defineSegment 171, 0x0558, 0x3A95 ; zero-length segment ;defineSegment 172, 0x0560, 0x3A95 ; zero-length segment ;defineSegment 173, 0x0568, 0x3A95 ; zero-length segment defineSegment 174, 0x0570, 0x3A95 ;defineSegment 175, 0x0578, 0x3AB8 ; zero-length segment ;defineSegment 176, 0x0580, 0x3AB8 ; zero-length segment defineSegment 177, 0x0588, 0x3AB8 ;defineSegment 178, 0x0590, 0x3AC4 ; zero-length segment ;defineSegment 179, 0x0598, 0x3AC4 ; zero-length segment defineSegment 180, 0x05A0, 0x3AC4 defineSegment 181, 0x05A8, 0x3AC7 defineSegment 182, 0x05B0, 0x3ADA defineSegment 183, 0x05B8, 0x3B12 defineSegment 184, 0x05C0, 0x3B19 defineSegment 185, 0x05C8, 0x3B1F defineSegment 186, 0x05D0, 0x3B30 defineSegment 187, 0x05D8, 0x3B49 ;defineSegment 188, 0x05E0, 0x3B82 ; zero-length segment defineSegment 189, 0x05E8, 0x3B82 defineSegment 190, 0x05F0, 0x3B84 defineSegment 191, 0x05F8, 0x3B84 ;defineSegment 192, 0x0600, 0x3C19 ; zero-length segment defineSegment 193, 0x0608, 0x3C19 defineSegment 194, 0x0610, 0x3C1E defineSegment 195, 0x0618, 0x3C21 defineSegment 196, 0x0620, 0x3C27 ;defineSegment 197, 0x0628, 0x3C2A ; zero-length segment ;defineSegment 198, 0x0630, 0x3C2A ; zero-length segment defineSegment 199, 0x0638, 0x3C2A defineSegment 200, 0x0640, 0x3C34 defineSegment 201, 0x0648, 0x3C36 defineSegment 202, 0x0650, 0x3C36 defineSegment 203, 0x0658, 0x3C36 defineSegment 204, 0x0660, 0x3C36 ;defineSegment 205, 0x0668, 0x3CEB ; zero-length segment defineSegment 206, 0x0670, 0x3CEB defineSegment 207, 0x0678, 0x3CF2 defineSegment 208, 0x0680, 0x3CF7 defineSegment 209, 0x0688, 0x3CFB defineSegment 210, 0x0690, 0x3CFE defineSegment 211, 0x0698, 0x3D01 defineSegment 212, 0x06A0, 0x3D04 defineSegment 213, 0x06A8, 0x3D0B defineSegment 214, 0x06B0, 0x3D0E defineSegment 215, 0x06B8, 0x3D16 defineSegment 216, 0x06C0, 0x3D1B defineSegment 217, 0x06C8, 0x3D20 defineSegment 218, 0x06D0, 0x3D2A defineSegment 219, 0x06D8, 0x3D2D defineSegment 220, 0x06E0, 0x3D37 defineSegment 221, 0x06E8, 0x3D3C defineSegment 222, 0x06F0, 0x3D43 defineSegment 223, 0x06F8, 0x3D47 defineSegment 224, 0x0700, 0x3D51 defineSegment 225, 0x0708, 0x3D56 defineSegment 226, 0x0710, 0x3D5C defineSegment 227, 0x0718, 0x3D62 defineSegment 228, 0x0720, 0x3D67 defineSegment 229, 0x0728, 0x3D6D defineSegment 230, 0x0730, 0x3D70 defineSegment 231, 0x0738, 0x3D74 defineSegment 232, 0x0740, 0x3D77 defineSegment 233, 0x0748, 0x3D7A defineSegment 234, 0x0750, 0x3D7E defineSegment 235, 0x0758, 0x3D81 defineSegment 236, 0x0760, 0x3D86 defineSegment 237, 0x0768, 0x3D8C defineSegment 238, 0x0770, 0x3D91 defineSegment 239, 0x0778, 0x3D95 defineSegment 240, 0x0780, 0x3D9A defineSegment 241, 0x0788, 0x3D9F defineSegment 242, 0x0790, 0x3DA6 defineSegment 243, 0x0798, 0x3DAA defineSegment 244, 0x07A0, 0x3DAF defineSegment 245, 0x07A8, 0x3DB6 defineSegment 246, 0x07B0, 0x3DBC defineSegment 247, 0x07B8, 0x3DBF defineSegment 248, 0x07C0, 0x3DCB defineSegment 249, 0x07C8, 0x3DCE defineSegment 250, 0x07D0, 0x3DD7 defineSegment 251, 0x07D8, 0x3DDA defineSegment 252, 0x07E0, 0x3DDF defineSegment 253, 0x07E8, 0x3DE2 defineSegment 254, 0x07F0, 0x3DE5 defineSegment 255, 0x07F8, 0x3DEB defineSegment 256, 0x0800, 0x3DF1 defineSegment 257, 0x0808, 0x3DF5 defineSegment 258, 0x0810, 0x3DF8 defineSegment 259, 0x0818, 0x3DFD defineSegment 260, 0x0820, 0x3E01 defineSegment 261, 0x0828, 0x3E06 defineSegment 262, 0x0830, 0x3E0E defineSegment 263, 0x0838, 0x3E11 defineSegment 264, 0x0840, 0x3E15 defineSegment 265, 0x0848, 0x3E19 defineSegment 266, 0x0850, 0x3E20 defineSegment 267, 0x0858, 0x3E25 defineSegment 268, 0x0860, 0x3E2C defineSegment 269, 0x0868, 0x3E30 defineSegment 270, 0x0870, 0x3E39 defineSegment 271, 0x0878, 0x3E3C defineSegment 272, 0x0880, 0x3E45 defineSegment 273, 0x0888, 0x3E49 defineSegment 274, 0x0890, 0x3E4C defineSegment 275, 0x0898, 0x3E4F defineSegment 276, 0x08A0, 0x3E52 defineSegment 277, 0x08A8, 0x3E55 defineSegment 278, 0x08B0, 0x3E58 defineSegment 279, 0x08B8, 0x3E5B defineSegment 280, 0x08C0, 0x3E5E defineSegment 281, 0x08C8, 0x3E61 defineSegment 282, 0x08D0, 0x3E64 defineSegment 283, 0x08D8, 0x3E67 defineSegment 284, 0x08E0, 0x3E6A defineSegment 285, 0x08E8, 0x3E6D defineSegment 286, 0x08F0, 0x3E70 defineSegment 287, 0x08F8, 0x3E73 defineSegment 288, 0x0900, 0x3E77 defineSegment 289, 0x0908, 0x3E7A defineSegment 290, 0x0910, 0x3E7D defineSegment 291, 0x0918, 0x3E80 defineSegment 292, 0x0920, 0x3E83 defineSegment 293, 0x0928, 0x3E86 defineSegment 294, 0x0930, 0x3E89 defineSegment 295, 0x0938, 0x3E8C defineSegment 296, 0x0940, 0x3E8F defineSegment 297, 0x0948, 0x3E92 defineSegment 298, 0x0950, 0x3E95 defineSegment 299, 0x0958, 0x3E98 defineSegment 300, 0x0960, 0x3E9B defineSegment 301, 0x0968, 0x3E9E defineSegment 302, 0x0970, 0x3EA1 defineSegment 303, 0x0978, 0x3EA4 defineSegment 304, 0x0980, 0x3EA7 defineSegment 305, 0x0988, 0x3EAA defineSegment 306, 0x0990, 0x3EAD defineSegment 307, 0x0998, 0x3EB0 defineSegment 308, 0x09A0, 0x3EB3 defineSegment 309, 0x09A8, 0x3EB6 defineSegment 310, 0x09B0, 0x3EB9 defineSegment 311, 0x09B8, 0x3EBC defineSegment 312, 0x09C0, 0x3EBF defineSegment 313, 0x09C8, 0x3EC2 defineSegment 314, 0x09D0, 0x3EC5 defineSegment 315, 0x09D8, 0x3ECD defineSegment 316, 0x09E0, 0x3ED0 defineSegment 317, 0x09E8, 0x3ED6 defineSegment 318, 0x09F0, 0x3EDC defineSegment 319, 0x09F8, 0x3EE2 defineSegment 320, 0x0A00, 0x3EEC defineSegment 321, 0x0A08, 0x3EF2 defineSegment 322, 0x0A10, 0x3EF8 defineSegment 323, 0x0A18, 0x3F05 defineSegment 324, 0x0A20, 0x3F0D defineSegment 325, 0x0A28, 0x3F10 defineSegment 326, 0x0A30, 0x3F13 defineSegment 327, 0x0A38, 0x3F1A defineSegment 328, 0x0A40, 0x3F20 defineSegment 329, 0x0A48, 0x3F29 defineSegment 330, 0x0A50, 0x3F33 defineSegment 331, 0x0A58, 0x3F37 defineSegment 332, 0x0A60, 0x3F3A defineSegment 333, 0x0A68, 0x3F3F defineSegment 334, 0x0A70, 0x3F42 defineSegment 335, 0x0A78, 0x3F46 defineSegment 336, 0x0A80, 0x3F4B defineSegment 337, 0x0A88, 0x3F57 defineSegment 338, 0x0A90, 0x3F62 defineSegment 339, 0x0A98, 0x3F68 defineSegment 340, 0x0AA0, 0x3F7B defineSegment 341, 0x0AA8, 0x3F8A defineSegment 342, 0x0AB0, 0x3F96 defineSegment 343, 0x0AB8, 0x3FA4 defineSegment 344, 0x0AC0, 0x3FAB defineSegment 345, 0x0AC8, 0x3FB3 defineSegment 346, 0x0AD0, 0x3FB6 defineSegment 347, 0x0AD8, 0x3FBA defineSegment 348, 0x0AE0, 0x3FC0 defineSegment 349, 0x0AE8, 0x3FC8 defineSegment 350, 0x0AF0, 0x4718 defineSegment 351, 0x0AF8, 0x4718 defineSegment 352, 0x0B00, 0x4718 defineSegment 353, 0x0B08, 0x4718 defineSegment 354, 0x0B10, 0x4732 defineSegment 355, 0x0B18, 0x4732 defineSegment 356, 0x0B20, 0x473B defineSegment 357, 0x0B28, 0x473B defineSegment 358, 0x0B30, 0x49E2 defineSegment 359, 0x0B38, 0x49E3
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0.log_21829_954.asm
ljhsiun2/medusa
9
9909
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r15 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x19faf, %rax clflush (%rax) nop nop nop nop add %rbx, %rbx mov (%rax), %edi add $12960, %rcx lea addresses_normal_ht+0xc7fb, %rax nop nop nop nop xor $14159, %r15 vmovups (%rax), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %rdx nop nop nop nop nop sub %rdi, %rdi lea addresses_WC_ht+0xba7b, %rcx nop nop nop and $23473, %rsi movups (%rcx), %xmm0 vpextrq $0, %xmm0, %rbx nop nop add $25621, %rsi lea addresses_WT_ht+0x1cb7b, %rsi lea addresses_normal_ht+0x6c7b, %rdi nop sub $61426, %r13 mov $35, %rcx rep movsb nop and $39858, %rsi lea addresses_A_ht+0x188db, %rsi lea addresses_normal_ht+0x6f5b, %rdi nop nop nop nop cmp %rbx, %rbx mov $112, %rcx rep movsb nop nop nop nop dec %rsi lea addresses_WT_ht+0x1347b, %rdx nop nop sub $47213, %rax vmovups (%rdx), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %rcx nop and %rsi, %rsi lea addresses_D_ht+0x847b, %rdi nop nop nop nop nop sub %r15, %r15 and $0xffffffffffffffc0, %rdi vmovaps (%rdi), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %rax add $39507, %rdi lea addresses_WC_ht+0x247b, %rdi nop nop nop nop nop and $53164, %rcx vmovups (%rdi), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %rbx add %r13, %r13 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r15 pop %r13 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r8 push %rbp push %rdx // Faulty Load lea addresses_WT+0xd47b, %rbp lfence mov (%rbp), %r13 lea oracles, %r8 and $0xff, %r13 shlq $12, %r13 mov (%r8,%r13,1), %r13 pop %rdx pop %rbp pop %r8 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': True, 'congruent': 6, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 10, 'type': 'addresses_normal_ht'}} {'src': {'same': False, 'congruent': 5, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 1, 'type': 'addresses_normal_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_D_ht', 'AVXalign': True, 'size': 32}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': True, 'congruent': 10, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
gfx/sgb/pal_packets.asm
Dev727/ancientplatinum
28
243449
<filename>gfx/sgb/pal_packets.asm ; macros taken from pokered's data/sgb_packets.asm ; names taken from pandocs ; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_Palette_Commands sgb_pal_set: MACRO db (SGB_PAL_SET << 3) + 1 dw PREDEFPAL_\1, PREDEFPAL_\2, PREDEFPAL_\3, PREDEFPAL_\4 ds 7 ENDM sgb_pal01: MACRO db (SGB_PAL01 << 3) + 1 ENDM sgb_pal23: MACRO db (SGB_PAL23 << 3) + 1 ENDM PalPacket_GSTitleScreen: sgb_pal_set GS_TITLE_SCREEN_0, GS_TITLE_SCREEN_1, GS_TITLE_SCREEN_2, GS_TITLE_SCREEN_3 PalPacket_MagnetTrain: sgb_pal_set BETA_SHINY_GREENMON, CGB_BADGE, RB_BROWNMON, 00 PalPacket_BetaPoker: sgb_pal_set BETA_POKER_0, BETA_POKER_1, BETA_POKER_2, BETA_POKER_3 PalPacket_UnownPuzzle: sgb_pal_set UNOWN_PUZZLE, UNOWN_PUZZLE, UNOWN_PUZZLE, UNOWN_PUZZLE PalPacket_9bd6: sgb_pal_set 00, 00, 00, 00 PalPacket_GSIntroShellderLapras: sgb_pal_set GS_INTRO_SHELLDER_LAPRAS, 00, 00, 00 UnreferencedPalPacket_BetaIntroLapras: sgb_pal_set BETA_INTRO_LAPRAS, 00, 00, 00 PalPacket_GSIntroJigglypuffPikachu: sgb_pal_set GS_INTRO_JIGGLYPUFF_PIKACHU_BG, GS_INTRO_JIGGLYPUFF_PIKACHU_OB, 00, 00 PalPacket_GSIntroStartersTransition: sgb_pal_set GS_INTRO_STARTERS_TRANSITION, 00, 00, 00 PalPacket_BetaIntroVenusaur: sgb_pal_set BETA_INTRO_VENUSAUR, 00, 00, 00 PalPacket_Pack: sgb_pal_set PACK, 00, 00, 00 PalPacket_BetaPikachuMinigame: sgb_pal_set GS_INTRO_JIGGLYPUFF_PIKACHU_OB, 00, 00, 00 PalPacket_PartyMenu: sgb_pal_set PARTY_ICON, HP_GREEN, HP_YELLOW, HP_RED PalPacket_BattleGrayscale: sgb_pal_set BLACKOUT, BLACKOUT, BLACKOUT, BLACKOUT PalPacket_Pokegear: sgb_pal_set POKEGEAR, 00, 00, 00 UnreferencedPalPacket_9c86: sgb_pal_set PACK, 00, 00, 00 PalPacket_SlotMachine: sgb_pal_set SLOT_MACHINE_0, SLOT_MACHINE_1, SLOT_MACHINE_2, SLOT_MACHINE_3 PalPacket_BetaTitleScreen: sgb_pal_set BETA_LOGO_1, BETA_LOGO_2, DIPLOMA, RB_PURPLEMON PalPacket_Diploma: sgb_pal_set DIPLOMA, 00, 00, 00 PalPacket_TradeTube: sgb_pal_set TRADE_TUBE, 00, 00, 00 PalPacket_GamefreakLogo: sgb_pal_set GS_INTRO_GAMEFREAK_LOGO, 00, 00, 00 PalPacket_9ce6: sgb_pal01 RGB 31, 31, 31 rept 6 RGB 00, 00, 00 endr ds 1 PalPacket_9cf6: sgb_pal23 RGB 31, 31, 31 rept 6 RGB 00, 00, 00 endr ds 1
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_4565_396.asm
ljhsiun2/medusa
9
19035
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r15 push %rcx push %rdi push %rsi lea addresses_D_ht+0x1984, %rsi lea addresses_WT_ht+0x19380, %rdi nop nop dec %r11 mov $98, %rcx rep movsq nop nop nop and %r15, %r15 lea addresses_A_ht+0xc3d9, %rsi lea addresses_A_ht+0x182f9, %rdi add %r12, %r12 mov $54, %rcx rep movsl nop nop nop nop nop cmp $54388, %r15 pop %rsi pop %rdi pop %rcx pop %r15 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r14 push %rax push %rbp push %rdi // Load lea addresses_normal+0x3ce4, %rbp nop nop nop nop nop inc %r14 mov (%rbp), %r12d nop nop nop nop nop xor %rbp, %rbp // Load mov $0x72aa00000000824, %r14 nop sub %r12, %r12 movb (%r14), %r10b nop nop nop dec %rax // Faulty Load lea addresses_PSE+0x13d04, %rbp nop and $24691, %rax mov (%rbp), %r14w lea oracles, %rdi and $0xff, %r14 shlq $12, %r14 mov (%rdi,%r14,1), %r14 pop %rdi pop %rbp pop %rax pop %r14 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_PSE', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_NC', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_PSE', 'same': True, 'size': 2, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'} {'33': 4565} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
src/util/oli/wm/miav.asm
olifink/qspread
0
91044
<filename>src/util/oli/wm/miav.asm ; make a menu item available and redraw it include win1_mac_oli include win1_keys_wstatus include win1_keys_wman section prog xdef xwm_miav ;+++ ; make a menu item available and redraw it ; ; Entry Exit ; d2.w item number ; a0 channel id ; a3 subwindow defn ; a4 wwork ; ; errors: ioss ;--- xwm_miav subr d3 move.b #wsi.mkav,(a1,d2.w) moveq #wm.drsel,d3 jsr wm.mdraw(a2) bne.s exit bclr #wsi..chg,(a1,d2.w) exit subend end
src/protect2.adb
shintakezou/adaplayground
0
1764
<filename>src/protect2.adb -- -- See protect.adb -- -- This test proves that multiple readers on a protected -- object are possible when using function: in the example -- protect.adb the problem was the delay. -- -- (Hence the name One_A_Time must refer to the writers) -- with Ada.Text_IO; use Ada.Text_IO; with Ada.Calendar; use Ada.Calendar; procedure Protect2 is procedure Put_Time_Diff (D : in Time) is T : Duration := Clock - D; begin Put (Duration'Image (T)); end Put_Time_Diff; protected One_A_Time is function Read (Id : String) return Integer; procedure Write (X : Integer); private V : Integer := 2; T : Time := Clock; end One_A_Time; protected body One_A_Time is function Read (Id : String) return Integer is begin Put_Time_Diff (T); Put_Line (" OAT reads for " & Id); return V; end Read; procedure Write (X : Integer) is begin Put_Time_Diff (T); Put_Line (" OAT starts writing..."); delay 5.0; V := X; Put_Time_Diff (T); Put_Line (" OAT ended writing..."); end Write; end One_A_Time; task Reader1; task Reader2; task body Reader1 is I : Integer := One_A_Time.Read ("R1"); begin loop exit when I = 0; I := One_A_Time.Read ("R1"); delay 0.5; end loop; end Reader1; task body Reader2 is I : Integer := One_A_Time.Read ("R2"); begin loop exit when I = 0; I := One_A_Time.Read ("R2"); delay 0.5; end loop; end Reader2; T : Time := Clock; begin -- The main writes Put_Time_Diff (T); Put_Line (" ET writes 1..."); One_A_Time.Write (1); Put_Time_Diff (T); Put_Line (" ET has written 1"); delay 5.0; Put_Time_Diff (T); Put_Line (" ET writes 0..."); One_A_Time.Write (0); Put_Time_Diff (T); Put_Line (" ET has written 0"); end;
oeis/307/A307621.asm
neoneye/loda-programs
11
88798
; A307621: Number of cycles in the n-dipyramidal graph. ; Submitted by <NAME> ; 1,6,22,63,151,316,596,1037,1693,2626,3906,5611,7827,10648,14176,18521,23801,30142,37678,46551,56911,68916,82732,98533,116501,136826,159706,185347,213963,245776,281016,319921,362737,409718,461126,517231,578311,644652,716548,794301 mov $1,$0 pow $0,2 mul $0,2 mul $1,2 add $1,$0 add $0,13 mul $1,$0 mov $0,$1 div $0,12 add $0,1
bb-runtimes/arm/sam/samv71/setup_pll.adb
JCGobbi/Nucleo-STM32G474RE
0
5219
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- Copyright (C) 2013-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ pragma Restrictions (No_Elaboration_Code); -- This subprogram is called before elaboration pragma Warnings (Off); with System.SAMV71; use System.SAMV71; pragma Warnings (On); with Interfaces.SAM; use Interfaces.SAM; with Interfaces.SAM.EFC; use Interfaces.SAM.EFC; with Interfaces.SAM.PMC; use Interfaces.SAM.PMC; with System.BB.Board_Parameters; procedure Setup_Pll is Master_Clock : Natural; FWS : EFC_EEFC_FMR_FWS_Field; begin -- Set FWS to max to handle clock changes below EFC_Periph.EEFC_FMR := (FWS => 6, CLOE => 1, others => <>); -- 31.17 Recommended Programming Sequence -- 1. If the Main crystal oscillator is not required, the PLL and divider -- can be directly configured (Step 6.) else this oscillator must be -- started (Step 2.). null; -- 2. Enable the Main crystal oscillator by setting CKGR_MOR.MOSCXTEN. -- The user can define a startup time. This can be done by configuring -- the appropriate value in CKGR_MOR.MOSCXTST. Once this register has -- been correctly configured, the user must wait for PMC_SR.MOSCXTS to -- be set. This can be done either by polling PMC_SR.MOSCXTS, or by -- waiting for the interrupt line to be raised if the associated -- interrupt source (MOSCXTS) has been enabled in PMC_IER. PMC_Periph.CKGR_MOR := (MOSCXTEN => 1, MOSCRCEN => 1, MOSCXTST => 8, KEY => <PASSWORD>wd, others => <>); while PMC_Periph.PMC_SR.MOSCXTS = 0 loop null; end loop; -- 3. Switch MAINCK to the Main crystal oscillator by setting -- CKGR_MOR.MOSCSEL. PMC_Periph.CKGR_MOR := (MOSCXTEN => 1, MOSCRCEN => 1, MOSCXTST => 8, KEY => <PASSWORD>wd, MOSCSEL => 1, others => <>); -- 4. Wait for PMC_SR.MOSCSELS to be set to ensure the switch is complete. while PMC_Periph.PMC_SR.MOSCSELS = 0 loop null; end loop; -- 5. Check MAINCK frequency: -- This Frequency Can Be Measured Via CKGR_MCFR. -- Read CKGR_MCFR until The MAINFRDY Field is Set, After Which The -- User Can Read CKGR_MCFR.MAINF By Performing An Additional Read. -- This Provides The Number of Main Clock Cycles That Have Been -- Counted During A Period of 16 SLCK Cycles. -- If MAINF = 0, switch MAINCK to the Main RC Oscillator by clearing -- CKGR_MOR.MOSCSEL. If MAINF /= 0, proceed to Step 6 while PMC_Periph.CKGR_MCFR.MAINFRDY = 0 loop null; end loop; if PMC_Periph.CKGR_MCFR.MAINF = 0 then PMC_Periph.CKGR_MOR.MOSCSEL := 0; end if; -- 6. Set PLLA and Divider (if not required, proceed to Step 7.): -- All parameters needed to configure PLLA and the divider are located -- in CKGR_PLLAR. -- CKGR_PLLAR.DIVA is used to control the divider. This parameter can be -- Programmed Between 0 and 127. Divider Output is Divider Input Divided -- By DIVA Parameter. By Default, DIVA Field is Cleared Which Means That -- The Divider and PLLA Are Turned Off. -- CKGR_PLLAR.MULA is The PLLA Multiplier Factor. This Parameter Can Be -- Programmed Between 0 and 62. if MULA is Cleared, PLLA Will Be Turned -- Off, Otherwise The PLLA Output Frequency is PLLA Input Frequency -- Multiplied By (MULA + 1). -- CKGR_PLLAR.PLLACOUNT specifies the number of SLCK cycles before -- PMC_SR.LOCKA is set after CKGR_PLLAR has been written. -- Once CKGR_PLLAR Has Been Written, The User Must Wait for PMC_SR.LOCKA -- To Be Set. This Can Be Done Either By Polling PMC_SR.LOCKA or By -- Waiting for The Interrupt Line To Be Raised if The Associated -- Interrupt Source (LOCKA) Has Been Enabled in PMC_IER. all Fields in -- CKGR_PLLAR Can Be Programmed in A Single Write Operation. if MULA or -- DIVA is Modified, The LOCKA Bit Goes Low To Indicate That PLLA is not -- Yet Ready. when PLLA is Locked, LOCKA is Set Again. The User Must Wait -- for The LOCKA Bit To Be Set Before Using The PLLA Output Clock. PMC_Periph.CKGR_PLLAR := (ONE => 1, MULA => System.BB.Board_Parameters.PLL_MULA - 1, DIVA => System.BB.Board_Parameters.PLL_DIVA, PLLACOUNT => 16#3F#, others => <>); while PMC_Periph.PMC_SR.LOCKA = 0 loop null; end loop; -- 7. Select MCK and HCLK: -- MCK and HCLK are configurable via PMC_MCKR. -- CSS is Used To select The Clock Source of MCK and HCLK. By Default, The -- Selected Clock Source is MAINCK. -- PRES is used to define the HCLK and MCK prescaler.s The user can choose -- between different values (1, 2, 3, 4, 8, 16, 32, 64). Prescaler output -- is the selected clock source frequency divided by the PRES value. -- MDIV is used to define the MCK divider. It is possible to choose between -- different values (0, 1, 2, 3). MCK output is the HCLK frequency -- divided by 1, 2, 3 or 4, depending on the value programmed in MDIV. -- By default, MDIV is cleared, which indicates that the HCLK is equal -- to MCK. -- Once the PMC_MCKR has been written, the user must wait for PMC_SR.MCKRDY -- to be set. This can be done either by polling PMC_SR.MCKRDY or by -- waiting for the interrupt line to be raised if the associated -- interrupt source (MCKRDY) has been enabled in PMC_IER. PMC_MCKR -- must not be programmed in a single write operation. The programming -- sequence for PMC_MCKR is as follows : -- If a new value for PMC_MCKR.CSS corresponds to any of the available -- PLL clocks : -- a. Program PMC_MCKR.PRES. -- b. Wait for PMC_SR.MCKRDY to be set. -- c. Program PMC_MCKR.MDIV. -- d. Wait for PMC_SR.MCKRDY to be set. -- e. Program PMC_MCKR.CSS. -- f. Wait for PMC_SR.MCKRDY to be set. -- If a new value for PMC_MCKR.CSS corresponds to MAINCK or SLCK: -- a. Program PMC_MCKR.CSS. -- b. Wait for PMC_SR.MCKRDY to be set. -- c. Program PMC_MCKR.PRES. -- d. Wait for PMC_SR.MCKRDY to be set. -- If CSS, MDIV or PRES are modified at any stage, the MCKRDY bit goes -- low to indicate that MCK and HCLK are not yet ready. The user -- must wait for MCKRDY bit to be set again before using MCK and -- HCLK. -- MCK is MAINCK divided by 2. PMC_Periph.PMC_MCKR.PRES := Clk_1; while PMC_Periph.PMC_SR.MCKRDY = 0 loop null; end loop; pragma Warnings (Off); PMC_Periph.PMC_MCKR.MDIV := (if System.BB.Board_Parameters.Clock_Frequency > 150_000_000 then PMC.Pck_Div2 else PMC.Eq_Pck); pragma Warnings (On); while PMC_Periph.PMC_SR.MCKRDY = 0 loop null; end loop; PMC_Periph.PMC_MCKR.CSS := PMC.Plla_Clk; while PMC_Periph.PMC_SR.MCKRDY = 0 loop null; end loop; -- 8. Select the Programmable clocks (PCKx): -- PCKx are controlled via registers PMC_SCER, PMC_SCDR and PMC_SCSR. -- PCKx Can Be Enabled and / or Disabled Via PMC_SCER and PMC_SCDR. -- Three PCKx Can Be Used. PMC_SCSR Indicates Which PCKx is Enabled. -- By Default all PCKx Are Disabled. -- PMC_PCKx Registers Are Used To Configure PCKx. -- PMC_PCKx.CSS is used to select the PCKx divider source. Several clock -- Options are available : -- MAINCK, SLCK, MCK, PLLACK, UPLLCKDIV -- SLCK is The Default Clock Source. -- PMC_PCKx.PRES is Used To Control The PCKx Prescaler. It is Possible To -- Choose Between Different Values (1 To 256). PCKx Output is Prescaler -- Input Divided By PRES. By Default, The PRES Value is Cleared Which -- Means That PCKx is Equal To Slow Clock. -- Once PMC_PCKx Has Been Configured, The Corresponding PCKx Must Be -- Enabled and The User Must Wait for PMC_SR.PCKRDYx To Be Set. This -- Can Be Done Either By Polling PMC_SR.PCKRDYx or By Waiting for The -- Interrupt Line To Be Raised if The Associated Interrupt Source -- (PCKRDYx) Has Been Enabled in PMC_IER. all Parameters in PMC_PCKx -- Can Be Programmed in A Single Write Operation. -- If The PMC_PCKx.CSS and PMC_PCKx.PRES Parameters Are To Be Modified, -- The Corresponding PCKx Must Be Disabled First. The Parameters Can -- then Be Modified. Once This Has Been Done, The User Must Re - Enable -- PCKx and Wait for The PCKRDYx Bit To Be Set. null; -- 9. Enable the peripheral clocks -- Once all of The Previous Steps Have Been Completed, The Peripheral -- Clocks Can Be Enabled and / or Disabled Via Registers PMC_PCERx and -- PMC_PCDRx. null; case PMC_Periph.PMC_MCKR.MDIV is when Eq_Pck => Master_Clock := System.BB.Board_Parameters.Clock_Frequency; when Pck_Div2 => Master_Clock := System.BB.Board_Parameters.Clock_Frequency / 2; when Pck_Div4 => Master_Clock := System.BB.Board_Parameters.Clock_Frequency / 4; when Pck_Div3 => Master_Clock := System.BB.Board_Parameters.Clock_Frequency / 3; end case; if Master_Clock < 23_000_000 then FWS := 0; elsif Master_Clock < 46_000_000 then FWS := 1; elsif Master_Clock < 69_000_000 then FWS := 2; elsif Master_Clock < 92_000_000 then FWS := 3; elsif Master_Clock < 115_000_000 then FWS := 4; elsif Master_Clock < 138_000_000 then FWS := 5; else FWS := 6; end if; EFC_Periph.EEFC_FMR := (FWS => FWS, CLOE => 1, others => <>); end Setup_Pll;
2021-2022-sem1/lab05/4-sets/sets.asm
adinasm/iocla-demos
0
17054
%include "../io.mac" section .text global main extern printf main: ;cele doua multimi se gasesc in eax si ebx mov eax, 139 ; 1000 1011 -> {7, 3, 1, 0} mov ebx, 169 ; 1010 1001 -> {7, 5, 3, 0} PRINTF32 `%u\n\x0`, eax ; afiseaza prima multime PRINTF32 `%u\n\x0`, ebx ; afiseaza cea de-a doua multime ; TODO1: reuniunea a doua multimi ; or ; TODO2: adaugarea unui element in multime ; 0100 0000 ; mov edx, 1 ; shl edx, 2 -> edx = 4 ; or ; TODO3: intersectia a doua multimi ; and ; TODO4: complementul unei multimi ; not ATENTIE ; TODO5: eliminarea unui element ; 1 << x; not; and ; TODO6: diferenta de multimi EAX-EBX ; A \ B = (A ^ B) ^ B xor eax, eax ret
ejercicios5/prueba_es_impar_montana.adb
iyan22/AprendeAda
0
6104
with ada.text_io, es_impar_montana; use Ada.Text_Io; procedure Prueba_Es_Impar_Montana is n1:integer:=0; begin -- caso de prueba 1: n1:=165; Put_line(" 165 --> TRUE"); put("Y tu programa dice que:"); Put_line("--> "& Boolean'Image(es_impar_montana(n1))); new_line; -- caso de prueba 2: n1:=3769572; Put_line("3769572 --> TRUE"); put("Y tu programa dice que:"); Put_line("--> "& Boolean'Image(es_impar_montana(n1))); new_line; -- caso de prueba 3: n1:=1; Put_line(" 1 --> TRUE"); put("Y tu programa dice que:"); Put_line("--> "& Boolean'Image(es_impar_montana(n1))); new_line; -- caso de prueba 4: n1:= 25; Put_line(" 25 --> FALSE (numero par de digitos)"); put("Y tu programa dice que:"); Put_line("--> "& Boolean'Image(es_impar_montana(n1))); new_line; -- caso de prueba 5: n1:= 129; Put_line(" 129 --> FALSE (2 no es el maximo)"); put("Y tu programa dice que:"); Put_line("--> "& Boolean'Image(es_impar_montana(n1))); New_Line; -- caso de prueba 6: n1:= 356; Put_line(" 356 --> FALSE (5 no es el maximo)"); put("Y tu programa dice que:"); Put_line("--> "& Boolean'Image(es_impar_montana(n1))); new_line; end Prueba_Es_Impar_Montana;
oeis/016/A016894.asm
neoneye/loda-programs
11
89952
; A016894: (5n+3)^10. ; 59049,1073741824,137858491849,3570467226624,41426511213649,296196766695424,1531578985264449,6278211847988224,21611482313284249,64925062108545024,174887470365513049,430804206899405824,984930291881790849,2113922820157210624,4297625829703557649,8335775831236199424,15516041187205853449,27850097600940212224,48398230717929318249,81707280688754689024,134391637934412192049,215892499727278669824,339456738992222314849,523383555379856794624,792594609605189126649,1180591620717411303424 mul $0,5 add $0,3 pow $0,10
programs/oeis/095/A095671.asm
neoneye/loda
22
1927
; A095671: Ninth column (m=8) of (1,4)-Pascal triangle A095666. ; 4,33,153,525,1485,3663,8151,16731,32175,58630,102102,171054,277134,436050,668610,1001946,1470942,2119887,3004375,4193475,5772195,7844265,10535265,13996125,18407025,23981724,30972348,39674668,50433900,63651060,79789908,99384516,123047496,151478925,185476005,225943497,273904969,330514899,397071675,475031535,566023491,671865282,794580402,936416250,1099863450,1287676390,1502895030,1748868030,2029277250,2348163675,2709954819,3119493663,3582069183,4103448525,4689910885,5348283153,6085977381,6911030136,7832143800,8858729880,10000954392,11269785384,12677042664,14235449800,15958688460,17861455161,19959520497,22269790917,24810373125,27600641175,30661306335,34014489795,37683798295,41694402750,46073119950,50848497414,56050901478,61712608698,67867900650,74553162210,81806983398,89670264871,98186327151,107401023675,117362857755,128123103537,139735931049,152258535429,165751270425,180277786260,195905171956,212704102212,230748988932,250118137500,270893907900,293162880780,317016028560,342548891685,369861760125,399059860225 lpb $0 mov $2,$0 sub $0,1 seq $2,95670 ; Eighth column (m=7) of (1,4)-Pascal triangle A095666. add $1,$2 lpe add $1,4 mov $0,$1
Cubical/Foundations/Filler.agda
Schippmunk/cubical
0
13727
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Foundations.Filler where open import Cubical.Foundations.Prelude private variable ℓ ℓ' : Level A : Type ℓ cube-cong : {a b : A} {p p' q q' : a ≡ b} (P : p ≡ p') (Q : q ≡ q') → (p ≡ q) ≡ (p' ≡ q') cube-cong {p = p} {p' = p'} {q = q} {q' = q'} P Q = p ≡ q ≡⟨ cong (_≡ q) P ⟩ p' ≡ q ≡⟨ cong (p' ≡_) Q ⟩ p' ≡ q' ∎
tests/game-test_data-tests-attributesdata_container.ads
thindil/steamsky
80
26033
<filename>tests/game-test_data-tests-attributesdata_container.ads package Game.Test_Data.Tests.AttributesData_Container is end Game.Test_Data.Tests.AttributesData_Container;
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_846.asm
ljhsiun2/medusa
9
174227
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r15 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x4772, %r10 clflush (%r10) xor $7130, %rax mov $0x6162636465666768, %rdx movq %rdx, %xmm3 and $0xffffffffffffffc0, %r10 movntdq %xmm3, (%r10) and %rdx, %rdx lea addresses_A_ht+0x17032, %rcx nop nop nop nop add $10327, %rdi movw $0x6162, (%rcx) nop nop nop add $5858, %rcx lea addresses_WC_ht+0x7e32, %r10 nop nop nop nop nop sub %rdx, %rdx vmovups (%r10), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $0, %xmm1, %rcx nop nop nop nop nop dec %rcx lea addresses_A_ht+0x3df2, %r12 inc %r10 and $0xffffffffffffffc0, %r12 movntdqa (%r12), %xmm5 vpextrq $1, %xmm5, %rcx nop nop dec %rax lea addresses_D_ht+0x188a2, %rsi lea addresses_normal_ht+0x26d2, %rdi nop nop nop add $59060, %r10 mov $31, %rcx rep movsw nop nop nop sub %r10, %r10 lea addresses_WT_ht+0x89c9, %rsi lea addresses_D_ht+0x14842, %rdi nop nop nop nop sub $64740, %r15 mov $36, %rcx rep movsb nop nop nop nop add $20357, %rax lea addresses_UC_ht+0x11b32, %r15 nop nop nop nop nop cmp %rdx, %rdx movw $0x6162, (%r15) nop nop and $45876, %rsi lea addresses_D_ht+0x11716, %rdx nop nop xor %rsi, %rsi movb (%rdx), %r12b cmp %rdx, %rdx lea addresses_WC_ht+0x163f5, %rsi lea addresses_WT_ht+0x18632, %rdi nop nop dec %r12 mov $28, %rcx rep movsw nop nop nop nop sub %rax, %rax pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r15 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %rbx push %rdi push %rsi // Faulty Load lea addresses_A+0xe32, %r10 nop nop xor $13943, %r11 movb (%r10), %bl lea oracles, %r10 and $0xff, %rbx shlq $12, %rbx mov (%r10,%rbx,1), %rbx pop %rsi pop %rdi pop %rbx pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 2, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_A_ht', 'AVXalign': True, 'size': 2}} {'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'NT': True, 'same': True, 'congruent': 6, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}} {'src': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}} {'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_WT_ht'}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
unittests/ASM/PrimaryGroup/2_C0_03.asm
cobalt2727/FEX
628
104347
%ifdef CONFIG { "RegData": { "RBX": "0x40", "RCX": "0x00", "RDX": "0x60", "RSI": "0x20", "R8": "0x1", "R9": "0x1", "R10": "0x0", "R11": "0x0" } } %endif mov rbx, 0x02 mov rcx, 0x02 mov rdx, 0x80 mov rsi, 0x80 stc rcr bl, 2 lahf mov r8w, ax shr r8, 8 and r8, 1 ; We only care about carry flag here clc rcr cl, 2 lahf mov r9w, ax shr r9, 8 and r9, 1 ; We only care about carry flag here stc rcr dl, 2 lahf mov r10w, ax shr r10, 8 and r10, 1 ; We only care about carry flag here clc rcr sil, 2 lahf mov r11w, ax shr r11, 8 and r11, 1 ; We only care about carry flag here hlt
scripts/code_dasm.asm
aamatevosyan/ispras_cpp_cpu
0
240193
<reponame>aamatevosyan/ispras_cpp_cpu in pop ax in in in call label_51 push ax ja label_39 out hlt label_39: in sqrt hlt label_51: add add ret
oeis/227/A227016.asm
neoneye/loda-programs
11
3594
<reponame>neoneye/loda-programs<filename>oeis/227/A227016.asm ; A227016: Floor(M(g(n-1)+1,..,g(n))), where M = harmonic mean and g(n) = n(n + 1)(n + 2)/6. ; Submitted by <NAME>(s3.) ; 1,2,7,14,27,45,69,101,141,191,252,323,408,506,618,746,890,1052,1233,1432,1653,1895,2159,2447,2759,3097,3462,3853,4274,4724,5204,5716,6260,6838,7451,8098,8783,9505,10265,11065,11905,12787,13712,14679,15692,16750,17854,19006,20206,21456,22757,24108,25513,26971,28483,30051,31675,33357,35098,36897,38758,40680,42664,44712,46824,49002,51247,53558,55939,58389,60909,63501,66165,68903,71716,74603,77568,80610,83730,86930,90210,93572,97017,100544,104157,107855,111639,115511,119471,123521,127662,131893 mov $1,$0 add $0,2 mul $0,2 bin $0,3 sub $0,2 add $1,12 sub $0,$1 div $0,8 add $0,2
engine/debug/debug_party.asm
opiter09/ASM-Machina
1
242083
; This function is a debugging feature to give the player <NAME>'s ; favorite Pokemon. This is indicated by the overpowered Exeggutor, which ; Ishihara (president of Creatures Inc.) said was his favorite Pokemon in an ABC ; interview on February 8, 2000. ; "Exeggutor is my favorite. That's because I was always using this character ; while I was debugging the program." ; http://www.ign.com/articles/2000/02/09/abc-news-pokamon-chat-transcript SetIshiharaTeam: ld de, IshiharaTeam .loop ld a, [de] cp -1 ret z ld [wcf91], a inc de ld a, [de] ld [wCurEnemyLVL], a inc de call AddPartyMon jr .loop IshiharaTeam: db EXEGGUTOR, 90 IF DEF(_DEBUG) db MEW, 5 ELSE db MEW, 20 ENDC db JOLTEON, 56 db DUGTRIO, 56 db ARTICUNO, 57 IF DEF(_DEBUG) db PIKACHU, 5 ENDC db -1 ; end DebugStart: IF DEF(_DEBUG) xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a ; Fly anywhere. dec a ; $ff ld [wTownVisitedFlag], a ld [wTownVisitedFlag + 1], a ; Get all badges except Earth Badge. ld a, $ff ^ (1 << BIT_EARTHBADGE) ld [wObtainedBadges], a call SetIshiharaTeam ; Exeggutor gets four HM moves. ld hl, wPartyMon1Moves ld a, FLY ld [hli], a ld a, CUT ld [hli], a ld a, SURF ld [hli], a ld a, STRENGTH ld [hl], a ld hl, wPartyMon1PP ld a, 15 ld [hli], a ld a, 30 ld [hli], a ld a, 15 ld [hli], a ld [hl], a ; Jolteon gets Thunderbolt. ld hl, wPartyMon3Moves + 3 ld a, THUNDERBOLT ld [hl], a ld hl, wPartyMon3PP + 3 ld a, 15 ld [hl], a ; Articuno gets Fly. ld hl, wPartyMon5Moves ld a, FLY ld [hl], a ld hl, wPartyMon5PP ld a, 15 ld [hl], a ; Pikachu gets Surf. ld hl, wPartyMon6Moves + 2 ld a, SURF ld [hl], a ld hl, wPartyMon6PP + 2 ld a, 15 ld [hl], a ; Get some debug items. ld hl, wNumBagItems ld de, DebugItemsList .items_loop ld a, [de] cp -1 jr z, .items_end ld [wcf91], a inc de ld a, [de] inc de ld [wItemQuantity], a call AddItemToInventory jr .items_loop .items_end ; Complete the Pokédex. ld hl, wPokedexOwned call DebugSetPokedexEntries ld hl, wPokedexSeen call DebugSetPokedexEntries SetEvent EVENT_GOT_POKEDEX ; Rival chose Squirtle, ; Player chose Charmander. ld hl, wRivalStarter ld a, STARTER2 ld [hli], a inc hl ; hl = wPlayerStarter ld a, STARTER1 ld [hl], a ret DebugSetPokedexEntries: ld b, wPokedexOwnedEnd - wPokedexOwned - 1 ld a, %11111111 .loop ld [hli], a dec b jr nz, .loop ld [hl], %01111111 ret DebugItemsList: db BICYCLE, 1 db FULL_RESTORE, 99 db FULL_HEAL, 99 db ESCAPE_ROPE, 99 db RARE_CANDY, 99 db MASTER_BALL, 99 db TOWN_MAP, 1 db SECRET_KEY, 1 db CARD_KEY, 1 db S_S_TICKET, 1 db LIFT_KEY, 1 db -1 ; end DebugUnusedList: db -1 ; end ELSE ret ENDC
bb-runtimes/src/s-textio__prep.adb
JCGobbi/Nucleo-STM32G474RE
0
2223
<reponame>JCGobbi/Nucleo-STM32G474RE ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . T E X T _ I O -- -- -- -- B o d y -- -- -- -- Copyright (C) 2010-2012, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Minimal output procedure with System.IOPorts; use System.IOPorts; with Interfaces; use Interfaces; package body System.Text_IO is Uthr : constant Port_Id := 16#3f8# + 0; Ulsr : constant Port_Id := 16#3f8# + 5; Dr : constant Unsigned_8 := 2#0000_0001#; Thre : constant Unsigned_8 := 2#0010_0000#; --------- -- Get -- --------- function Get return Character is begin return Character'Val (Inb (Uthr)); end Get; ---------------- -- Initialize -- ---------------- procedure Initialize is begin Initialized := True; end Initialize; ----------------- -- Is_Rx_Ready -- ----------------- function Is_Rx_Ready return Boolean is begin return (Inb (Ulsr) and Dr) /= 0; end Is_Rx_Ready; ----------------- -- Is_Tx_Ready -- ----------------- function Is_Tx_Ready return Boolean is begin return (Inb (Ulsr) and Thre) /= 0; end Is_Tx_Ready; --------- -- Put -- --------- procedure Put (C : Character) is begin Outb (Uthr, Character'Pos (C)); end Put; ---------------------------- -- Use_Cr_Lf_For_New_Line -- ---------------------------- function Use_Cr_Lf_For_New_Line return Boolean is begin return False; end Use_Cr_Lf_For_New_Line; end System.Text_IO;
oeis/152/A152620.asm
neoneye/loda-programs
11
81435
<gh_stars>10-100 ; A152620: a(n)=-8*a(n-1)-6*a(n-2), n>1 ; a(0)=1, a(1)=-2 . ; Submitted by <NAME> ; 1,-2,10,-68,484,-3464,24808,-177680,1272592,-9114656,65281696,-467565632,3348834880,-23985285248,171789272704,-1230402470144,8812484124928,-63117458178560,452064760678912,-3237813336359936 mov $2,-1 pow $2,$0 lpb $0 sub $0,1 add $1,$2 add $2,$1 mul $1,6 lpe mov $0,$2
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_441.asm
ljhsiun2/medusa
9
246827
.global s_prepare_buffers s_prepare_buffers: push %r12 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x505d, %rsi lea addresses_UC_ht+0x4ffd, %rdi nop nop inc %rbp mov $41, %rcx rep movsl nop nop nop inc %rbx lea addresses_normal_ht+0xd6ac, %rdx nop sub $19413, %rsi movups (%rdx), %xmm7 vpextrq $1, %xmm7, %rbp inc %rdi lea addresses_A_ht+0x1aead, %rsi lea addresses_WT_ht+0x1ba10, %rdi nop nop add %r12, %r12 mov $97, %rcx rep movsq nop nop nop nop nop and $11876, %r12 lea addresses_WT_ht+0x1cbfd, %r12 nop xor $27259, %rdi vmovups (%r12), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %rdx nop sub %rsi, %rsi lea addresses_A_ht+0x114b5, %rdx clflush (%rdx) nop nop and $22087, %rsi movb (%rdx), %bl nop nop sub $55714, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %rax push %rbx push %rcx push %rdi // Faulty Load lea addresses_normal+0x2ffd, %r13 nop nop nop add $21348, %rax movups (%r13), %xmm1 vpextrq $1, %xmm1, %rbx lea oracles, %r11 and $0xff, %rbx shlq $12, %rbx mov (%r11,%rbx,1), %rbx pop %rdi pop %rcx pop %rbx pop %rax pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': True, 'congruent': 5, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_A_ht', 'AVXalign': True, 'size': 1}, 'OP': 'LOAD'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
src/test/resources/testData/format/test_block_indent.scpt
stigger/AppleScript-IDEA
18
1203
tell application "Finder" adding folder items to set eof "" to 123 end tell
apply.asm
mp81ss/apply
0
23712
.386 .MODEL FLAT .CODE apply PROC NEAR C PUBLIC pop eax pop ecx push eax jmp ecx apply ENDP END
exit_vim.applescript
haframjolk/exit-vim-button
0
3215
set esc to 53 -- Key code of esc key -- Activate Terminal before getting windows to make sure indexes are correct tell application "Terminal" to activate delay 0.35 -- Wait to allow switching of windows/spaces -- Get all terminal windows tell application "System Events" set term_windows to name of windows of (application "Terminal") end tell -- Find vim window set i to 1 repeat with window_name in term_windows if window_name contains " vim " then set vim_window to i end if set i to i + 1 end repeat try tell application "System Events" -- Make vim window the frontmost window tell process "Terminal" perform action "AXRaise" of window vim_window set vim_window to missing value -- Reset value of vim_window so it won't persist between runs set frontmost to true end tell -- Exit vim keystroke (key code esc) keystroke ":q!" keystroke return end tell on error display dialog "No vim windows currently open." buttons {"OK"} default button 1 end try
lib/strcmp.asm
argymouz/alan-compiler
0
23093
<filename>lib/strcmp.asm ; int strcmp (char * s1, char * s2); ; ---------------------------------- ; This function compares the null terminated strings s1 ; and s2. Pointers to both strings are passed. The result ; is : ; ; -1 : if s1 < s2 ; 0 : if s1 = s2 ; 1 : if s1 > s2 section .code global _strcmp _strcmp push rbp mov rbp, rsp push rdi push rsi next: mov al, byte [rdi] ; Load next character of s1 mov ah, byte [rsi] ; Load next character of s2 cmp al, ah ; Compare jnz ok ; If different, ok or al, al jz ok ; If the end of both, ok inc rsi inc rdi jmp short next ok: jb minus ; Flags contain the result ja plus xor rax, rax ; result = 0 jmp short store minus: mov ax, -1 ; result = -1 jmp short store plus: mov ax, 1 ; result store: pop rsi pop rdi pop rbp ret
test/Fail/Issue3257.tex.agda
cruhland/agda
1,989
8393
<reponame>cruhland/agda postulate A : Set
libsrc/_DEVELOPMENT/l/z80/ascii/num_to_txt/l_utoh.asm
jpoikela/z88dk
640
89440
<filename>libsrc/_DEVELOPMENT/l/z80/ascii/num_to_txt/l_utoh.asm INCLUDE "config_private.inc" SECTION code_clib SECTION code_l PUBLIC l_utoh ; write unsigned hex integer to ascii buffer (no termination) ; ; enter : hl = unsigned integer ; de = char *buffer ; carry reset (implementation may write leading zeroes if carry set) ; ; exit : de = char *buffer (one byte past last char written) ; ; uses : af, bc, de, hl IF __CLIB_OPT_NUM2TXT_SELECT & $08 EXTERN l_fast_utoh defc l_utoh = l_fast_utoh ELSE EXTERN l_small_utoh defc l_utoh = l_small_utoh ENDIF
libsrc/spectrum/if1_init_file.asm
dex4er/deb-z88dk
1
15816
<gh_stars>1-10 ; ; ZX IF1 & Microdrive functions ; ; int if1_init_file (int drive, int name, struct M_CHAN buffer); ; ; This is the original BASIC structure with no added values/flags. ; ; ; Open a file for writing ; ; $Id: if1_init_file.asm,v 1.1 2006/05/23 21:47:25 stefano Exp $ ; XLIB if1_init_file LIB if1_setname filename: defs 10 if1_init_file: rst 8 defb 31h ; Create Interface 1 system vars if required pop af pop hl ;buffer pop de ;filename pop bc ;driveno push bc push de push hl push af push hl ld a,c ld ($5cd6),a push de ld hl,filename ; filename location push hl call if1_setname ld ($5cda),hl ; length pop hl ld ($5cdc),hl ; pointer to filename pop de ;rst 8 ; Erase if file exists ? ;defb 24h rst 8 defb 22h ; Open temporary 'M' channel (touch) ; Now IX points to the newly created channel push ix pop hl ;ld a,h ;or l ;and a ;ld de,4 ; Experimentally corrected ;add hl,de ; with this offset pop de ; buffer ld bc,253h ;ld bc,37h ldir ; take a copy of the file buffer header xor a rst 8 defb 21h ; stop microdrive motor rst 8 defb 2Ch ; Reclaim the channel ; ..I need the initialized buffer only ; here we could check for free space ; and eventually give the "microdrive full" error ld hl,0 ret
bb-runtimes/runtimes/zfp-stm32g474/gnat/s-bbbopa.ads
JCGobbi/Nucleo-STM32G474RE
0
27456
<filename>bb-runtimes/runtimes/zfp-stm32g474/gnat/s-bbbopa.ads ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . B O A R D _ P A R A M E T E R S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2016-2017, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- -- The port of GNARL to bare board targets was initially developed by the -- -- Real-Time Systems Group at the Technical University of Madrid. -- -- -- ------------------------------------------------------------------------------ package System.BB.Board_Parameters is pragma No_Elaboration_Code_All; pragma Pure; -------------------- -- Hardware clock -- -------------------- Main_Clock_Frequency : constant := 150_000_000; -- With 24 MHz HSE clock + PLL use 150 MHz, -- with 16 MHz HSI clock + PLL use 150 MHz, -- with 24 MHz HSE clock - PLL use 24 MHz, -- with 16 MHz HSI clock - PLL use 16 MHz. HSE_Clock_Frequency : constant := 24_000_000; -- Frequency of High Speed External clock. LSE_Clock_Frequency : constant := 32_768; -- Frequency of Low Speed External clock. HSI_Clock_Frequency : constant := 16_000_000; -- Frequency of High Speed Internal clock. HSI48_Clock_Frequency : constant := 48_000_000; -- Frequency of High Speed Internal clock. LSI_Clock_Frequency : constant := 32_000; -- Frequency of Low Speed Internal clock. end System.BB.Board_Parameters;
arch/ARM/STM32/svd/stm32l4x2/stm32_svd-exti.ads
morbos/Ada_Drivers_Library
2
24509
-- This spec has been automatically generated from STM32L4x2.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.EXTI is pragma Preelaborate; --------------- -- Registers -- --------------- -- IMR1_MR array type IMR1_MR_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Interrupt mask register type IMR1_Register (As_Array : Boolean := False) is record case As_Array is when False => -- MR as a value Val : HAL.UInt32; when True => -- MR as an array Arr : IMR1_MR_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for IMR1_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- EMR1_MR array type EMR1_MR_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Event mask register type EMR1_Register (As_Array : Boolean := False) is record case As_Array is when False => -- MR as a value Val : HAL.UInt32; when True => -- MR as an array Arr : EMR1_MR_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for EMR1_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- RTSR1_TR array type RTSR1_TR_Field_Array is array (0 .. 16) of Boolean with Component_Size => 1, Size => 17; -- Type definition for RTSR1_TR type RTSR1_TR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TR as a value Val : HAL.UInt17; when True => -- TR as an array Arr : RTSR1_TR_Field_Array; end case; end record with Unchecked_Union, Size => 17; for RTSR1_TR_Field use record Val at 0 range 0 .. 16; Arr at 0 range 0 .. 16; end record; -- RTSR1_TR array type RTSR1_TR_Field_Array_1 is array (18 .. 22) of Boolean with Component_Size => 1, Size => 5; -- Type definition for RTSR1_TR type RTSR1_TR_Field_1 (As_Array : Boolean := False) is record case As_Array is when False => -- TR as a value Val : HAL.UInt5; when True => -- TR as an array Arr : RTSR1_TR_Field_Array_1; end case; end record with Unchecked_Union, Size => 5; for RTSR1_TR_Field_1 use record Val at 0 range 0 .. 4; Arr at 0 range 0 .. 4; end record; -- Rising Trigger selection register type RTSR1_Register is record -- Rising trigger event configuration of line 0 TR : RTSR1_TR_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_17_17 : HAL.Bit := 16#0#; -- Rising trigger event configuration of line 18 TR_1 : RTSR1_TR_Field_1 := (As_Array => False, Val => 16#0#); -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RTSR1_Register use record TR at 0 range 0 .. 16; Reserved_17_17 at 0 range 17 .. 17; TR_1 at 0 range 18 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- FTSR1_TR array type FTSR1_TR_Field_Array is array (0 .. 16) of Boolean with Component_Size => 1, Size => 17; -- Type definition for FTSR1_TR type FTSR1_TR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TR as a value Val : HAL.UInt17; when True => -- TR as an array Arr : FTSR1_TR_Field_Array; end case; end record with Unchecked_Union, Size => 17; for FTSR1_TR_Field use record Val at 0 range 0 .. 16; Arr at 0 range 0 .. 16; end record; -- FTSR1_TR array type FTSR1_TR_Field_Array_1 is array (18 .. 22) of Boolean with Component_Size => 1, Size => 5; -- Type definition for FTSR1_TR type FTSR1_TR_Field_1 (As_Array : Boolean := False) is record case As_Array is when False => -- TR as a value Val : HAL.UInt5; when True => -- TR as an array Arr : FTSR1_TR_Field_Array_1; end case; end record with Unchecked_Union, Size => 5; for FTSR1_TR_Field_1 use record Val at 0 range 0 .. 4; Arr at 0 range 0 .. 4; end record; -- Falling Trigger selection register type FTSR1_Register is record -- Falling trigger event configuration of line 0 TR : FTSR1_TR_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_17_17 : HAL.Bit := 16#0#; -- Falling trigger event configuration of line 18 TR_1 : FTSR1_TR_Field_1 := (As_Array => False, Val => 16#0#); -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FTSR1_Register use record TR at 0 range 0 .. 16; Reserved_17_17 at 0 range 17 .. 17; TR_1 at 0 range 18 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- SWIER1_SWIER array type SWIER1_SWIER_Field_Array is array (0 .. 16) of Boolean with Component_Size => 1, Size => 17; -- Type definition for SWIER1_SWIER type SWIER1_SWIER_Field (As_Array : Boolean := False) is record case As_Array is when False => -- SWIER as a value Val : HAL.UInt17; when True => -- SWIER as an array Arr : SWIER1_SWIER_Field_Array; end case; end record with Unchecked_Union, Size => 17; for SWIER1_SWIER_Field use record Val at 0 range 0 .. 16; Arr at 0 range 0 .. 16; end record; -- SWIER1_SWIER array type SWIER1_SWIER_Field_Array_1 is array (18 .. 22) of Boolean with Component_Size => 1, Size => 5; -- Type definition for SWIER1_SWIER type SWIER1_SWIER_Field_1 (As_Array : Boolean := False) is record case As_Array is when False => -- SWIER as a value Val : HAL.UInt5; when True => -- SWIER as an array Arr : SWIER1_SWIER_Field_Array_1; end case; end record with Unchecked_Union, Size => 5; for SWIER1_SWIER_Field_1 use record Val at 0 range 0 .. 4; Arr at 0 range 0 .. 4; end record; -- Software interrupt event register type SWIER1_Register is record -- Software Interrupt on line 0 SWIER : SWIER1_SWIER_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_17_17 : HAL.Bit := 16#0#; -- Software Interrupt on line 18 SWIER_1 : SWIER1_SWIER_Field_1 := (As_Array => False, Val => 16#0#); -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SWIER1_Register use record SWIER at 0 range 0 .. 16; Reserved_17_17 at 0 range 17 .. 17; SWIER_1 at 0 range 18 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- PR1_PR array type PR1_PR_Field_Array is array (0 .. 16) of Boolean with Component_Size => 1, Size => 17; -- Type definition for PR1_PR type PR1_PR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- PR as a value Val : HAL.UInt17; when True => -- PR as an array Arr : PR1_PR_Field_Array; end case; end record with Unchecked_Union, Size => 17; for PR1_PR_Field use record Val at 0 range 0 .. 16; Arr at 0 range 0 .. 16; end record; -- PR1_PR array type PR1_PR_Field_Array_1 is array (18 .. 22) of Boolean with Component_Size => 1, Size => 5; -- Type definition for PR1_PR type PR1_PR_Field_1 (As_Array : Boolean := False) is record case As_Array is when False => -- PR as a value Val : HAL.UInt5; when True => -- PR as an array Arr : PR1_PR_Field_Array_1; end case; end record with Unchecked_Union, Size => 5; for PR1_PR_Field_1 use record Val at 0 range 0 .. 4; Arr at 0 range 0 .. 4; end record; -- Pending register type PR1_Register is record -- Pending bit 0 PR : PR1_PR_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_17_17 : HAL.Bit := 16#0#; -- Pending bit 18 PR_1 : PR1_PR_Field_1 := (As_Array => False, Val => 16#0#); -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PR1_Register use record PR at 0 range 0 .. 16; Reserved_17_17 at 0 range 17 .. 17; PR_1 at 0 range 18 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- IMR2_MR array type IMR2_MR_Field_Array is array (32 .. 39) of Boolean with Component_Size => 1, Size => 8; -- Type definition for IMR2_MR type IMR2_MR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- MR as a value Val : HAL.UInt8; when True => -- MR as an array Arr : IMR2_MR_Field_Array; end case; end record with Unchecked_Union, Size => 8; for IMR2_MR_Field use record Val at 0 range 0 .. 7; Arr at 0 range 0 .. 7; end record; -- Interrupt mask register type IMR2_Register is record -- Interrupt Mask on external/internal line 32 MR : IMR2_MR_Field := (As_Array => False, Val => 16#1#); -- unspecified Reserved_8_31 : HAL.UInt24 := 16#FFFFFF#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for IMR2_Register use record MR at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- EMR2_MR array type EMR2_MR_Field_Array is array (32 .. 39) of Boolean with Component_Size => 1, Size => 8; -- Type definition for EMR2_MR type EMR2_MR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- MR as a value Val : HAL.UInt8; when True => -- MR as an array Arr : EMR2_MR_Field_Array; end case; end record with Unchecked_Union, Size => 8; for EMR2_MR_Field use record Val at 0 range 0 .. 7; Arr at 0 range 0 .. 7; end record; -- Event mask register type EMR2_Register is record -- Event mask on external/internal line 32 MR : EMR2_MR_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EMR2_Register use record MR at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- RTSR2_RT array type RTSR2_RT_Field_Array is array (35 .. 38) of Boolean with Component_Size => 1, Size => 4; -- Type definition for RTSR2_RT type RTSR2_RT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- RT as a value Val : HAL.UInt4; when True => -- RT as an array Arr : RTSR2_RT_Field_Array; end case; end record with Unchecked_Union, Size => 4; for RTSR2_RT_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- Rising Trigger selection register type RTSR2_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Rising trigger event configuration bit of line 35 RT : RTSR2_RT_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RTSR2_Register use record Reserved_0_2 at 0 range 0 .. 2; RT at 0 range 3 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; -- FTSR2_FT array type FTSR2_FT_Field_Array is array (35 .. 38) of Boolean with Component_Size => 1, Size => 4; -- Type definition for FTSR2_FT type FTSR2_FT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- FT as a value Val : HAL.UInt4; when True => -- FT as an array Arr : FTSR2_FT_Field_Array; end case; end record with Unchecked_Union, Size => 4; for FTSR2_FT_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- Falling Trigger selection register type FTSR2_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Falling trigger event configuration bit of line 35 FT : FTSR2_FT_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FTSR2_Register use record Reserved_0_2 at 0 range 0 .. 2; FT at 0 range 3 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; -- SWIER2_SWI array type SWIER2_SWI_Field_Array is array (35 .. 38) of Boolean with Component_Size => 1, Size => 4; -- Type definition for SWIER2_SWI type SWIER2_SWI_Field (As_Array : Boolean := False) is record case As_Array is when False => -- SWI as a value Val : HAL.UInt4; when True => -- SWI as an array Arr : SWIER2_SWI_Field_Array; end case; end record with Unchecked_Union, Size => 4; for SWIER2_SWI_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- Software interrupt event register type SWIER2_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Software interrupt on line 35 SWI : SWIER2_SWI_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SWIER2_Register use record Reserved_0_2 at 0 range 0 .. 2; SWI at 0 range 3 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; -- PR2_PIF array type PR2_PIF_Field_Array is array (35 .. 38) of Boolean with Component_Size => 1, Size => 4; -- Type definition for PR2_PIF type PR2_PIF_Field (As_Array : Boolean := False) is record case As_Array is when False => -- PIF as a value Val : HAL.UInt4; when True => -- PIF as an array Arr : PR2_PIF_Field_Array; end case; end record with Unchecked_Union, Size => 4; for PR2_PIF_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- Pending register type PR2_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Pending interrupt flag on line 35 PIF : PR2_PIF_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PR2_Register use record Reserved_0_2 at 0 range 0 .. 2; PIF at 0 range 3 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- External interrupt/event controller type EXTI_Peripheral is record -- Interrupt mask register IMR1 : aliased IMR1_Register; -- Event mask register EMR1 : aliased EMR1_Register; -- Rising Trigger selection register RTSR1 : aliased RTSR1_Register; -- Falling Trigger selection register FTSR1 : aliased FTSR1_Register; -- Software interrupt event register SWIER1 : aliased SWIER1_Register; -- Pending register PR1 : aliased PR1_Register; -- Interrupt mask register IMR2 : aliased IMR2_Register; -- Event mask register EMR2 : aliased EMR2_Register; -- Rising Trigger selection register RTSR2 : aliased RTSR2_Register; -- Falling Trigger selection register FTSR2 : aliased FTSR2_Register; -- Software interrupt event register SWIER2 : aliased SWIER2_Register; -- Pending register PR2 : aliased PR2_Register; end record with Volatile; for EXTI_Peripheral use record IMR1 at 16#0# range 0 .. 31; EMR1 at 16#4# range 0 .. 31; RTSR1 at 16#8# range 0 .. 31; FTSR1 at 16#C# range 0 .. 31; SWIER1 at 16#10# range 0 .. 31; PR1 at 16#14# range 0 .. 31; IMR2 at 16#20# range 0 .. 31; EMR2 at 16#24# range 0 .. 31; RTSR2 at 16#28# range 0 .. 31; FTSR2 at 16#2C# range 0 .. 31; SWIER2 at 16#30# range 0 .. 31; PR2 at 16#34# range 0 .. 31; end record; -- External interrupt/event controller EXTI_Periph : aliased EXTI_Peripheral with Import, Address => System'To_Address (16#40010400#); end STM32_SVD.EXTI;
oeis/283/A283369.asm
neoneye/loda-programs
11
18038
<gh_stars>10-100 ; A283369: a(n) = Sum_{d|n} d^(4*d + 1). ; Submitted by <NAME> ; 1,513,1594324,17179869697,476837158203126,28430288029931296212,3219905755813179726837608,633825300114114700765531472385,202755595904452569706561330874548093,100000000000000000000000000476837158203638,72890483685103052142902866787761839379440139452,75836984583351248111063210627854747804680985471636948,109395050288514219040366056833567359441133418834382438145054,213450921303606651848590460653409581488790305151145083522375563624 add $0,1 mov $1,1 mov $2,$0 lpb $0 mov $3,$2 dif $3,$0 cmp $3,$2 cmp $3,0 mul $3,$0 mov $4,$0 sub $0,1 mul $4,4 lpb $4 add $4,1 pow $3,$4 add $1,$3 mod $4,1 lpe lpe mov $0,$1
maps/Route21.asm
Dev727/ancientplatinum
28
7547
<gh_stars>10-100 object_const_def ; object_event constants const ROUTE21_SWIMMER_GIRL const ROUTE21_SWIMMER_GUY const ROUTE21_FISHER Route21_MapScripts: db 0 ; scene scripts db 0 ; callbacks TrainerSwimmermSeth: trainer SWIMMERM, SETH, EVENT_BEAT_SWIMMERM_SETH, SwimmermSethSeenText, SwimmermSethBeatenText, 0, .Script .Script: endifjustbattled opentext writetext SwimmermSethAfterBattleText waitbutton closetext end TrainerSwimmerfNikki: trainer SWIMMERF, NIKKI, EVENT_BEAT_SWIMMERF_NIKKI, SwimmerfNikkiSeenText, SwimmerfNikkiBeatenText, 0, .Script .Script: endifjustbattled opentext writetext SwimmerfNikkiAfterBattleText waitbutton closetext end TrainerFisherArnold: trainer FISHER, ARNOLD, EVENT_BEAT_FISHER_ARNOLD, FisherArnoldSeenText, FisherArnoldBeatenText, 0, .Script .Script: endifjustbattled opentext writetext FisherArnoldAfterBattleText waitbutton closetext end SwimmermSethSeenText: text "Land ho! Gotta" line "keep going!" done SwimmermSethBeatenText: text "Glug…" done SwimmermSethAfterBattleText: text "This arrogant guy" line "was at CINNABAR's" cont "volcano." done SwimmerfNikkiSeenText: text "If I win, you have" line "to help me with my" cont "suntan lotion!" done SwimmerfNikkiBeatenText: text "I'm worried about" line "sunburn…" done SwimmerfNikkiAfterBattleText: text "I have to watch" line "out for blemishes" cont "caused by the sun." done FisherArnoldSeenText: text "I'm bored by fish-" line "ing. Let's battle!" done FisherArnoldBeatenText: text "Utter failure…" done FisherArnoldAfterBattleText: text "I'll just go back" line "to fishing…" done Route21_MapEvents: db 0, 0 ; filler db 0 ; warp events db 0 ; coord events db 0 ; bg events db 3 ; object events object_event 11, 16, SPRITE_SWIMMER_GIRL, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_TRAINER, 3, TrainerSwimmerfNikki, -1 object_event 2, 30, SPRITE_SWIMMER_GUY, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 4, TrainerSwimmermSeth, -1 object_event 14, 22, SPRITE_FISHER, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_TRAINER, 1, TrainerFisherArnold, -1
VirtualMachine/Win32/UnitTests/Conditionals/test1_Boolean.asm
ObjectPascalInterpreter/BookPart_3
8
82456
# Test 1 pushb true halt
oeis/027/A027788.asm
neoneye/loda-programs
11
244524
; A027788: a(n) = 15*(n+1)*C(n+2,15)/2. ; 105,1800,16320,104040,523260,2209320,8139600,26860680,80901810,225544440,588376800,1448655000,3389852700,7582037400,16287339600,33738060600,67621543875,131530532400,248917996800,459351961200,828225505800,1461574422000,2528333935200,4293282020400,7165139588100,11765913428880,19029682468800,30341771491920,47732786859240,74146496500560,113806250442720,172711831683600,259307625069405,385374177968760,567209052930240,827179868856600,1195753211782500,1714128387917400,2437635622858800,3440095242910200 mov $1,$0 add $0,15 bin $0,$1 add $1,14 mul $0,$1 div $0,2 mul $0,15
oeis/027/A027138.asm
neoneye/loda-programs
11
1178
; A027138: a(n) = Sum_{k=0..2n} (k+1) * A027113(n, 2n-k). ; Submitted by <NAME> ; 1,7,26,85,264,803,2422,7281,21860,65599,196818,590477,1771456,5314395,15943214,47829673,143489052,430467191,1291401610,3874204869,11622614648,34867843987,104603532006,313810596065,941431788244,2824295364783,8472886094402,25418658283261,76255974849840,228767924549579,686303773648798,2058911320946457,6176733962839436,18530201888518375,55590605665555194,166771816996665653,500315450989997032,1500946352969991171,4502839058909973590,13508517176729920849,40525551530189762628,121576654590569287967 add $0,1 mov $1,3 pow $1,$0 mul $1,10 div $1,9 sub $1,$0 mov $0,$1 sub $0,1
agda-stdlib-0.9/src/Relation/Binary/PropositionalEquality/Core.agda
qwe2/try-agda
1
14768
------------------------------------------------------------------------ -- The Agda standard library -- -- Propositional equality ------------------------------------------------------------------------ -- This file contains some core definitions which are reexported by -- Relation.Binary.PropositionalEquality. module Relation.Binary.PropositionalEquality.Core where open import Level open import Relation.Binary.Core open import Relation.Binary.Consequences.Core ------------------------------------------------------------------------ -- Some properties sym : ∀ {a} {A : Set a} → Symmetric (_≡_ {A = A}) sym refl = refl trans : ∀ {a} {A : Set a} → Transitive (_≡_ {A = A}) trans refl eq = eq subst : ∀ {a p} {A : Set a} → Substitutive (_≡_ {A = A}) p subst P refl p = p resp₂ : ∀ {a ℓ} {A : Set a} (∼ : Rel A ℓ) → ∼ Respects₂ _≡_ resp₂ _∼_ = subst⟶resp₂ _∼_ subst isEquivalence : ∀ {a} {A : Set a} → IsEquivalence (_≡_ {A = A}) isEquivalence = record { refl = refl ; sym = sym ; trans = trans }
regtests/asf-applications-tests.adb
jquorning/ada-asf
12
18950
----------------------------------------------------------------------- -- asf-applications-tests - ASF Application tests using ASFUnit -- Copyright (C) 2011, 2012, 2015, 2017, 2021 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Log; with Util.Test_Caller; with ASF.Tests; with ASF.Events.Faces.Actions; with ASF.Requests.Mockup; with ASF.Responses.Mockup; with ASF.Applications.Main; with ASF.Applications.Main.Configs; with ASF.Models.Selects; with ASF.Contexts.Faces; pragma Warnings (Off); -- gcc complains that the package is not referenced but it is! with ASF.Contexts.Flash; pragma Warnings (On); package body ASF.Applications.Tests is use ASF.Tests; use Util.Tests; package Caller is new Util.Test_Caller (Test, "Applications"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test service HTTP invalid method", Test_Invalid_Request'Access); Caller.Add_Test (Suite, "Test service HTTP GET (File_Servlet)", Test_Get_File'Access); Caller.Add_Test (Suite, "Test service HTTP GET 404", Test_Get_404'Access); Caller.Add_Test (Suite, "Test service HTTP GET (Measure_Servlet)", Test_Get_Measures'Access); Caller.Add_Test (Suite, "Test service HTTP POST+INVOKE_APPLICATION (inputText)", Test_Form_Post'Access); Caller.Add_Test (Suite, "Test service HTTP POST+PROCESS_VALIDATION (inputText)", Test_Form_Post_Validation_Error'Access); Caller.Add_Test (Suite, "Test service HTTP POST+PROCESS_VALIDATION (selectOneMenu)", Test_Form_Post_Select'Access); Caller.Add_Test (Suite, "Test AJAX bean method invocation", Test_Ajax_Action'Access); Caller.Add_Test (Suite, "Test AJAX invalid requests", Test_Ajax_Action_Error'Access); Caller.Add_Test (Suite, "Test POST/REDIRECT/GET with flash object", Test_Flash_Object'Access); Caller.Add_Test (Suite, "Test GET+POST request with the default navigation", Test_Default_Navigation_Rule'Access); Caller.Add_Test (Suite, "Test GET with view parameters", Test_View_Params'Access); Caller.Add_Test (Suite, "Test GET with view action", Test_View_Action'Access); Caller.Add_Test (Suite, "Test GET with request parameter injection from URI", Test_View_Inject_Parameter'Access); end Add_Tests; package Save_Binding is new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Form_Bean, Method => Save, Name => "save"); Binding_Array : aliased constant Util.Beans.Methods.Method_Binding_Array := (Save_Binding.Proxy'Access, Save_Binding.Proxy'Access); -- ------------------------------ -- Get the value identified by the name. -- ------------------------------ overriding function Get_Value (From : in Form_Bean; Name : in String) return Util.Beans.Objects.Object is begin if Name = "email" then return Util.Beans.Objects.To_Object (From.Email); elsif Name = "password" then return Util.Beans.Objects.To_Object (From.Password); elsif Name = "name" then return Util.Beans.Objects.To_Object (From.Name); elsif Name = "gender" then return Util.Beans.Objects.To_Object (From.Gender); elsif Name = "genderList" then declare List : ASF.Models.Selects.Select_Item_List; begin ASF.Models.Selects.Append (List, ASF.Models.Selects.Create_Select_Item ("None", "0")); ASF.Models.Selects.Append (List, ASF.Models.Selects.Create_Select_Item ("Mrs", "1")); ASF.Models.Selects.Append (List, ASF.Models.Selects.Create_Select_Item ("Mr", "2")); ASF.Models.Selects.Append (List, ASF.Models.Selects.Create_Select_Item ("Mss", "3")); return ASF.Models.Selects.To_Object (List); end; elsif Name = "called" then return Util.Beans.Objects.To_Object (From.Called); else return Util.Beans.Objects.Null_Object; end if; end Get_Value; -- ------------------------------ -- Set the value identified by the name. -- ------------------------------ overriding procedure Set_Value (From : in out Form_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin -- Simulate a Set_Value that raises some exception during the Update_Values phase. if Util.Beans.Objects.To_String (Value) = "error" then From.Perm_Error := True; raise Constraint_Error; end if; if Name = "email" then From.Email := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "password" then From.Password := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "name" then From.Name := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "gender" then From.Gender := Util.Beans.Objects.To_Unbounded_String (Value); end if; end Set_Value; -- ------------------------------ -- This bean provides some methods that can be used in a Method_Expression -- ------------------------------ overriding function Get_Method_Bindings (From : in Form_Bean) return Util.Beans.Methods.Method_Binding_Array_Access is pragma Unreferenced (From); begin return Binding_Array'Access; end Get_Method_Bindings; -- ------------------------------ -- Create a form bean. -- ------------------------------ function Create_Form_Bean return Util.Beans.Basic.Readonly_Bean_Access is Result : constant Form_Bean_Access := new Form_Bean; begin return Result.all'Access; end Create_Form_Bean; -- ------------------------------ -- Create a list of forms. -- ------------------------------ function Create_Form_List return Util.Beans.Basic.Readonly_Bean_Access is Result : constant Form_Lists.List_Bean_Access := new Form_Lists.List_Bean; Form : Form_Bean; begin for I in 1 .. 100 loop Form.Name := To_Unbounded_String ("Name" & Integer'Image (I)); Form.Email := To_Unbounded_String ("Joe" & Integer'Image (I) & "@gmail.com"); Result.List.Append (Form); end loop; return Result.all'Access; end Create_Form_List; -- ------------------------------ -- Initialize the ASF application for the unit test. -- ------------------------------ procedure Initialize_Test_Application is use type ASF.Applications.Main.Application_Access; Fact : ASF.Applications.Main.Application_Factory; Config : constant String := Util.Tests.Get_Path ("regtests/config/test-config.xml"); begin if ASF.Tests.Get_Application = null then ASF.Tests.Initialize (Util.Tests.Get_Properties, Factory => Fact); end if; ASF.Applications.Main.Configs.Read_Configuration (App => ASF.Tests.Get_Application.all, File => Config); ASF.Tests.Get_Application.Start; end Initialize_Test_Application; -- ------------------------------ -- Initialize the test application -- ------------------------------ overriding procedure Set_Up (T : in out Test) is pragma Unreferenced (T); begin Initialize_Test_Application; end Set_Up; -- ------------------------------ -- Action to authenticate a user (password authentication). -- ------------------------------ procedure Save (Data : in out Form_Bean; Outcome : in out Unbounded_String) is use Util.Beans.Objects; begin if Data.Def_Nav then Outcome := To_Unbounded_String ("form-default-result"); else Outcome := To_Unbounded_String ("success"); end if; Data.Called := Data.Called + 1; if Data.Use_Flash then declare Ctx : constant ASF.Contexts.Faces.Faces_Context_Access := ASF.Contexts.Faces.Current; begin Ctx.Get_Flash.Set_Attribute ("name", To_Object (Data.Name)); Ctx.Get_Flash.Set_Attribute ("email", To_Object (Data.Email)); Ctx.Get_Flash.Set_Keep_Messages (True); Ctx.Add_Message (Client_Id => "", Message => "Message saved in the flash context"); end; end if; if Data.Perm_Error then raise Test_Exception; end if; end Save; -- ------------------------------ -- Test an invalid HTTP request. -- ------------------------------ procedure Test_Invalid_Request (T : in out Test) is Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; begin -- Unknown method Request.Set_Method ("BLAB"); Request.Set_Request_URI ("/asfunit/views/set.xhtml"); Do_Req (Request, Reply); Assert_Equals (T, ASF.Responses.SC_NOT_IMPLEMENTED, Reply.Get_Status, "Invalid response"); -- PUT on a file is not allowed Request.Set_Method ("PUT"); Request.Set_Request_URI ("/asfunit/views/set.xhtml"); Do_Req (Request, Reply); Assert_Equals (T, ASF.Responses.SC_METHOD_NOT_ALLOWED, Reply.Get_Status, "Invalid response"); -- POST on a file is not allowed Request.Set_Method ("POST"); Request.Set_Request_URI ("/asfunit/views/set.xhtml"); Do_Req (Request, Reply); Assert_Equals (T, ASF.Responses.SC_METHOD_NOT_ALLOWED, Reply.Get_Status, "Invalid response"); -- DELETE on a file is not allowed Request.Set_Method ("DELETE"); Request.Set_Request_URI ("/asfunit/views/set.xhtml"); Do_Req (Request, Reply); Assert_Equals (T, ASF.Responses.SC_METHOD_NOT_ALLOWED, Reply.Get_Status, "Invalid response"); end Test_Invalid_Request; -- ------------------------------ -- Test a GET request on a static file served by the File_Servlet. -- ------------------------------ procedure Test_Get_404 (T : in out Test) is Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; begin Do_Get (Request, Reply, "/file-does-not-exist.txt", "test-404.html"); Assert_Equals (T, ASF.Responses.SC_NOT_FOUND, Reply.Get_Status, "Invalid response"); Assert_Matches (T, ".*This is a 404 error page.*", Reply, "Invalid 404 page returned", Status => ASF.Responses.SC_NOT_FOUND); Do_Get (Request, Reply, "/file-does-not-exist.js", "test-404.html"); Assert_Equals (T, ASF.Responses.SC_NOT_FOUND, Reply.Get_Status, "Invalid response"); Assert_Matches (T, ".*This is a 404 error page.*", Reply, "Invalid 404 page returned", Status => ASF.Responses.SC_NOT_FOUND); end Test_Get_404; -- ------------------------------ -- Test a GET request on a static file served by the File_Servlet. -- ------------------------------ procedure Test_Get_File (T : in out Test) is Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; begin Do_Get (Request, Reply, "/views/set.xhtml", "get-file-set.txt"); Assert_Contains (T, "<c:set var=""user"" value=""<NAME>""/>", Reply, "Wrong content"); Assert_Header (T, "Content-Type", "text/plain", Reply, "Content-Type"); Do_Get (Request, Reply, "/views/set.html", "get-file-set.html"); Assert_Matches (T, "^\s*<NAME>\s?$", Reply, "Wrong content"); Assert_Header (T, "Content-Type", "text/html", Reply, "Content-Type"); Do_Get (Request, Reply, "/js/asf.js", "get-file-asf.js"); Assert_Matches (T, "^\s*var ASF = {};\s?$", Reply, "Wrong content"); Assert_Header (T, "Content-Type", "text/javascript", Reply, "Content-Type"); Do_Get (Request, Reply, "/css/asf.css", "get-file-asf.css"); Assert_Matches (T, "^.*asf.css.*$", Reply, "Wrong content"); Assert_Header (T, "Content-Type", "text/css", Reply, "Content-Type"); end Test_Get_File; -- ------------------------------ -- Test a GET request on the measure servlet -- ------------------------------ procedure Test_Get_Measures (T : in out Test) is Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; begin Do_Get (Request, Reply, "/stats.xml", "stats.xml"); -- We must get at least one measure value (assuming the Test_Get_File test -- was executed). Assert_Matches (T, "<time count=""\d+"" time=""\d+.\d+ [um]s"" title="".*""/>", Reply, "Wrong content"); end Test_Get_Measures; -- ------------------------------ -- Test a GET+POST request with submitted values and an action method called on the bean. -- ------------------------------ procedure Test_Form_Post (T : in out Test) is use Util.Beans.Objects; Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Form : aliased Form_Bean; begin Request.Set_Attribute ("form", To_Object (Value => Form'Unchecked_Access, Storage => STATIC)); Do_Get (Request, Reply, "/tests/form-text.html", "form-text.txt"); Assert_Matches (T, ".*<label for=.name.>Name</label>.*", Reply, "Wrong form content"); Assert_Matches (T, ".*<input type=.text. name=.name. value=.. id=.name.*", Reply, "Wrong form content"); Request.Set_Parameter ("formText", "1"); Request.Set_Parameter ("name", "John"); Request.Set_Parameter ("password", "<PASSWORD>"); Request.Set_Parameter ("email", "<EMAIL>"); Request.Set_Parameter ("ok", "1"); Do_Post (Request, Reply, "/tests/form-text.html", "form-text-post-1.txt"); Assert_Matches (T, ".*success exact.*", Reply, "Wrong form content"); Assert_Equals (T, "John", Form.Name, "Form name not saved in the bean"); Assert_Equals (T, "<PASSWORD>", Form.Password, "Form password not saved in the bean"); Assert_Equals (T, "<EMAIL>", Form.Email, "Form email not saved in the bean"); Assert_Equals (T, 1, Form.Called, "save action was not called"); end Test_Form_Post; -- ------------------------------ -- Test a POST request with an invalid submitted value -- ------------------------------ procedure Test_Form_Post_Validation_Error (T : in out Test) is use Util.Beans.Objects; Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Form : aliased Form_Bean; begin Request.Set_Attribute ("form", To_Object (Value => Form'Unchecked_Access, Storage => STATIC)); -- Post with password too short and empty email Request.Set_Parameter ("ok", "1"); Request.Set_Parameter ("formText", "1"); Request.Set_Parameter ("name", "John"); Request.Set_Parameter ("password", "12"); Request.Set_Parameter ("email", ""); Do_Post (Request, Reply, "/tests/form-text.html", "form-text-post-1.txt"); Assert_Matches (T, ".*<input type=.text. name=.name. value=.John. id=.name.*", Reply, "Wrong form content"); Assert_Matches (T, ".*Validation Error: Length is less than " & "allowable minimum of '4'.*", Reply, "Missing error message"); -- No field should be modified. Assert_Equals (T, "", Form.Name, "Form name was saved in the bean"); Assert_Equals (T, "", Form.Password, "Form password was saved in the bean"); Assert_Equals (T, "", Form.Email, "Form email was saved in the bean"); Request.Set_Parameter ("ok", "1"); Request.Set_Parameter ("email", "1"); Request.Set_Parameter ("password", "<PASSWORD>"); Request.Set_Parameter ("name", "<PASSWORD>"); Do_Post (Request, Reply, "/tests/form-text.html", "form-text-post-2.txt"); Assert_Matches (T, ".*<span class=.error.>Invalid email address</span>.*", Reply, "Invalid error message for email"); Assert_Matches (T, ".*<span class=.error.>Invalid name</span>.*", Reply, "Invalid error message for name"); Request.Set_Parameter ("ok", "1"); Request.Set_Parameter ("email", "1dddddd"); Request.Set_Parameter ("password", "<PASSWORD>"); Request.Set_Parameter ("name", "1222222222"); Do_Post (Request, Reply, "/tests/form-text.html", "form-text-post-3.txt"); Assert_Matches (T, ".*Validation Error: Length is greater than " & "allowable maximum of '10'.*", Reply, "Invalid error message for password"); Request.Set_Parameter ("ok", "1"); Request.Set_Parameter ("email", "error"); Request.Set_Parameter ("password", "<PASSWORD>"); Request.Set_Parameter ("name", "<PASSWORD>"); Do_Post (Request, Reply, "/tests/form-text.html", "form-text-post-4.txt"); Assert_Matches (T, ".*<span class=.error.>Validation Error: Value is not correct.*", Reply, "Invalid error message for name"); Assert_Equals (T, 0, Form.Called, "Save method should not be called"); end Test_Form_Post_Validation_Error; -- ------------------------------ -- Test a GET+POST request with form having <h:selectOneMenu> element. -- ------------------------------ procedure Test_Form_Post_Select (T : in out Test) is use Util.Beans.Objects; Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Form : aliased Form_Bean; begin Request.Set_Attribute ("form", To_Object (Value => Form'Unchecked_Access, Storage => STATIC)); Do_Get (Request, Reply, "/tests/form-select.html", "form-select.txt"); Assert_Matches (T, ".*<label for=.gender.>Gender</label>.*", Reply, "Wrong form content"); Assert_Matches (T, ".*<select name=.gender.*", Reply, "Wrong form content"); Request.Set_Parameter ("formSelect", "1"); Request.Set_Parameter ("gender", "2"); Do_Post (Request, Reply, "/tests/form-select.html", "form-select-post.txt"); Assert_Matches (T, ".*<option value=.2. selected=.selected.*", Reply, "Wrong form content"); Request.Set_Parameter ("formSelect", "1"); Request.Set_Parameter ("gender", "3"); Do_Post (Request, Reply, "/tests/form-select.html", "form-select-post2.txt"); Assert_Matches (T, ".*<option value=.3. selected=.selected.*", Reply, "Wrong form content"); end Test_Form_Post_Select; -- ------------------------------ -- Test a POST request to invoke a bean method. -- ------------------------------ procedure Test_Ajax_Action (T : in out Test) is use Util.Beans.Objects; Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Form : aliased Form_Bean; begin Request.Set_Attribute ("form", To_Object (Value => Form'Unchecked_Access, Storage => STATIC)); Do_Post (Request, Reply, "/ajax/form/save", "ajax-action-1.txt"); Assert_Equals (T, 1, Form.Called, "Save method was not called"); end Test_Ajax_Action; -- ------------------------------ -- Test a POST request to invoke a bean method. -- Verify that invalid requests raise an error. -- ------------------------------ procedure Test_Ajax_Action_Error (T : in out Test) is use Util.Beans.Objects; Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Form : aliased Form_Bean; begin Request.Set_Attribute ("form", To_Object (Value => Form'Unchecked_Access, Storage => STATIC)); Do_Post (Request, Reply, "/ajax/", "ajax-error-1.txt"); Assert_Equals (T, ASF.Responses.SC_NOT_FOUND, Reply.Get_Status, "Invalid error response 1"); Do_Post (Request, Reply, "/ajax/a", "ajax-error-2.txt"); Assert_Equals (T, ASF.Responses.SC_NOT_FOUND, Reply.Get_Status, "Invalid error response 2"); Do_Post (Request, Reply, "/ajax/a/", "ajax-error-3.txt"); Assert_Equals (T, ASF.Responses.SC_NOT_FOUND, Reply.Get_Status, "Invalid error response 3"); Do_Post (Request, Reply, "/ajax//c", "ajax-error-4.txt"); Assert_Equals (T, ASF.Responses.SC_NOT_FOUND, Reply.Get_Status, "Invalid error response 4"); Do_Post (Request, Reply, "/ajax/form/savex", "ajax-error-5.txt"); Assert_Equals (T, ASF.Responses.SC_NOT_FOUND, Reply.Get_Status, "Invalid error response 5"); Do_Post (Request, Reply, "/ajax/formx/save", "ajax-error-6.txt"); Assert_Equals (T, ASF.Responses.SC_NOT_FOUND, Reply.Get_Status, "Invalid error response 6"); end Test_Ajax_Action_Error; -- ------------------------------ -- Test a POST/REDIRECT/GET request with a flash information passed in between. -- ------------------------------ procedure Test_Flash_Object (T : in out Test) is use Util.Beans.Objects; Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Form : aliased Form_Bean; Path : constant String := Util.Tests.Get_Path ("regtests/config/test-config.xml"); App : constant ASF.Applications.Main.Application_Access := ASF.Tests.Get_Application; begin ASF.Applications.Main.Configs.Read_Configuration (App.all, Path); Form.Use_Flash := True; Request.Set_Attribute ("form", To_Object (Value => Form'Unchecked_Access, Storage => STATIC)); Do_Get (Request, Reply, "/tests/form-text-redirect.html", "form-text-flash.txt"); Assert_Matches (T, ".*<label for=.name.>Name</label>.*", Reply, "Wrong form content"); Assert_Matches (T, ".*<input type=.text. name=.name. value=.. id=.name.*", Reply, "Wrong form content"); Request.Set_Parameter ("formText", "1"); Request.Set_Parameter ("name", "John"); Request.Set_Parameter ("password", "<PASSWORD>"); Request.Set_Parameter ("email", "<EMAIL>"); Request.Set_Parameter ("ok", "1"); Do_Post (Request, Reply, "/tests/form-text-redirect.html", "form-text-post-flash.txt"); -- The navigation rule should redirect to the GET page. Assert_Redirect (T, "/asfunit/tests/flash-data.html", Reply, "Invalid response"); Request.Set_Cookie (Reply); Do_Get (Request, Reply, "/tests/flash-data.html", "flash-data.txt"); Assert_Matches (T, ".*Name: John.*", Reply, "Wrong form content"); Assert_Matches (T, ".*Email: <EMAIL>", Reply, "Wrong form content"); Assert_Matches (T, ".*Message saved in the flash context.*", Reply, "Message was not restored"); Request.Set_Cookie (Reply); Do_Get (Request, Reply, "/tests/flash-data.html", "flash-data-2.txt"); Assert_Matches (T, ".*Name: Email:", Reply, "Wrong form content"); end Test_Flash_Object; -- ------------------------------ -- Test a GET+POST request with the default navigation rule based on the outcome. -- ------------------------------ procedure Test_Default_Navigation_Rule (T : in out Test) is use Util.Beans.Objects; Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Form : aliased Form_Bean; begin Form.Def_Nav := True; Request.Set_Attribute ("form", To_Object (Value => Form'Unchecked_Access, Storage => STATIC)); Do_Get (Request, Reply, "/tests/form-text-default.html", "form-text-default.txt"); Assert_Matches (T, ".*<label for=.name.>Name</label>.*", Reply, "Wrong form content"); Assert_Matches (T, ".*<input type=.text. name=.name. value=.. id=.name.*", Reply, "Wrong form content"); Request.Set_Parameter ("formText", "1"); Request.Set_Parameter ("name", "John"); Request.Set_Parameter ("password", "<PASSWORD>"); Request.Set_Parameter ("email", "<EMAIL>"); Request.Set_Parameter ("ok", "1"); Do_Post (Request, Reply, "/tests/form-text-default.html", "form-text-post-default.txt"); Assert_Matches (T, ".*Email: <EMAIL> Name: John.*", Reply, "Wrong form content"); end Test_Default_Navigation_Rule; -- ------------------------------ -- Test a GET request with meta data and view parameters. -- ------------------------------ procedure Test_View_Params (T : in out Test) is use Util.Beans.Objects; Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Form : aliased Form_Bean; Path : constant String := Util.Tests.Get_Path ("regtests/config/test-config.xml"); App : constant ASF.Applications.Main.Application_Access := ASF.Tests.Get_Application; begin ASF.Applications.Main.Configs.Read_Configuration (App.all, Path); Form.Use_Flash := True; Request.Set_Attribute ("form", To_Object (Value => Form'Unchecked_Access, Storage => STATIC)); Do_Get (Request, Reply, "/tests/view-params.html?name=John&email=<EMAIL>&is_a=male", "view-params.txt"); Assert_Equals (T, "John", Form.Name, "View parameter for name was not set"); Assert_Equals (T, "<EMAIL>", Form.Email, "View parameter for email was not set"); Assert_Equals (T, "male", Form.Gender, "View parameter for gender was not set"); Assert_Matches (T, ".*Name: John Email: <EMAIL> Gender: male", Reply, "Wrong generated content"); end Test_View_Params; -- ------------------------------ -- Test a GET request with meta data and view action. -- ------------------------------ procedure Test_View_Action (T : in out Test) is use Util.Beans.Objects; Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Form : aliased Form_Bean; Path : constant String := Util.Tests.Get_Path ("regtests/config/test-config.xml"); App : constant ASF.Applications.Main.Application_Access := ASF.Tests.Get_Application; begin ASF.Applications.Main.Configs.Read_Configuration (App.all, Path); Form.Use_Flash := True; Request.Set_Attribute ("form", To_Object (Value => Form'Unchecked_Access, Storage => STATIC)); Do_Get (Request, Reply, "/tests/view-action.html?name=John&email=<EMAIL>&is_a=male", "view-action.txt"); Assert_Equals (T, 1, Form.Called, "View action was not called"); Assert_Equals (T, "John", Form.Name, "View parameter for name was not set"); Assert_Equals (T, "<EMAIL>", Form.Email, "View parameter for email was not set"); Assert_Equals (T, "male", Form.Gender, "View parameter for gender was not set"); Assert_Matches (T, ".*Name: John Email: <EMAIL> Gender: male", Reply, "Wrong generated content"); end Test_View_Action; -- ------------------------------ -- Test a GET request with pretty URL and request parameter injection. -- ------------------------------ procedure Test_View_Inject_Parameter (T : in out Test) is use Util.Beans.Objects; Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Form : aliased Form_Bean; Path : constant String := Util.Tests.Get_Path ("regtests/config/test-inject.xml"); App : constant ASF.Applications.Main.Application_Access := ASF.Tests.Get_Application; begin ASF.Applications.Main.Configs.Read_Configuration (App.all, Path); App.Dump_Routes (Util.Log.INFO_LEVEL); Form.Use_Flash := True; Request.Set_Attribute ("user", To_Object (Value => Form'Unchecked_Access, Storage => STATIC)); Do_Get (Request, Reply, "/users/john/view", "view-user.txt"); Assert_Equals (T, 0, Form.Called, "View action must not be called"); Assert_Equals (T, "john", Form.Name, "View parameter for name was not set"); Assert_Matches (T, ".*Name: john Email: Gender: ", Reply, "Wrong generated content"); Do_Get (Request, Reply, "/users/harry/potter/view", "view-user2.txt"); Assert_Equals (T, "harry", Form.Name, "View parameter for name was not set"); Assert_Equals (T, "potter", Form.Email, "View parameter for email was not set"); Assert_Matches (T, ".*Name: harry Email: potter Gender: ", Reply, "Wrong generated content"); Do_Get (Request, Reply, "/users/Gandalf/Mithrandir/view/wizard", "view-user3.txt"); Assert_Equals (T, "Gandalf", Form.Name, "View parameter for name was not set"); Assert_Equals (T, "Mithrandir", Form.Email, "View parameter for email was not set"); Assert_Equals (T, "wizard", Form.Gender, "View parameter for gender was not set"); Assert_Matches (T, ".*Name: Gandalf Email: Mithrandir Gender: wizard", Reply, "Wrong generated content"); end Test_View_Inject_Parameter; end ASF.Applications.Tests;
oeis/061/A061647.asm
neoneye/loda-programs
11
20882
; A061647: Beginning at the well for the topograph of a positive definite quadratic form with values 1, 1, 1 at a superbase (i.e., 1, 1 and 1 are the vonorms of the superbase), these numbers indicate the labels of the edges of the topograph on a path of greatest ascent. ; Submitted by <NAME> ; 1,3,9,23,61,159,417,1091,2857,7479,19581,51263,134209,351363,919881,2408279,6304957,16506591,43214817,113137859,296198761,775458423,2030176509,5315071103,13915036801,36430039299,95375081097,249695203991,653710530877,1711436388639,4480598635041,11730359516483,30710479914409,80401080226743,210492760765821,551077202070719,1442738845446337,3777139334268291,9888679157358537,25888898137807319,67778015256063421,177445147630382943,464557427635085409,1216227135274873283,3184123978189534441 mul $0,2 mov $3,1 lpb $0 sub $0,2 sub $2,1 add $3,1 add $2,$3 div $2,2 mul $2,2 add $3,$2 lpe mov $0,$3 sub $0,1 mul $0,2 add $0,1
agda-stdlib/src/Data/List/Relation/Unary/Unique/Propositional/Properties.agda
DreamLinuxer/popl21-artifact
5
15184
<reponame>DreamLinuxer/popl21-artifact ------------------------------------------------------------------------ -- The Agda standard library -- -- Properties of unique lists (setoid equality) ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.List.Relation.Unary.Unique.Propositional.Properties where open import Data.Fin.Base using (Fin) open import Data.List.Base open import Data.List.Relation.Binary.Disjoint.Propositional open import Data.List.Relation.Unary.All as All using (All; []; _∷_) open import Data.List.Relation.Unary.AllPairs as AllPairs using (AllPairs) open import Data.List.Relation.Unary.Unique.Propositional import Data.List.Relation.Unary.Unique.Setoid.Properties as Setoid open import Data.Nat.Base open import Data.Nat.Properties using (<⇒≢) open import Function using (id; _∘_) open import Relation.Binary using (Rel; Setoid) open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; sym; setoid) open import Relation.Unary using (Pred; Decidable) open import Relation.Nullary using (¬_) ------------------------------------------------------------------------ -- Introduction (⁺) and elimination (⁻) rules for list operations ------------------------------------------------------------------------ -- map module _ {a b} {A : Set a} {B : Set b} where map⁺ : ∀ {f} → (∀ {x y} → f x ≡ f y → x ≡ y) → ∀ {xs} → Unique xs → Unique (map f xs) map⁺ = Setoid.map⁺ (setoid A) (setoid B) ------------------------------------------------------------------------ -- ++ module _ {a} {A : Set a} where ++⁺ : ∀ {xs ys} → Unique xs → Unique ys → Disjoint xs ys → Unique (xs ++ ys) ++⁺ = Setoid.++⁺ (setoid A) ------------------------------------------------------------------------ -- concat module _ {a} {A : Set a} where concat⁺ : ∀ {xss} → All Unique xss → AllPairs Disjoint xss → Unique (concat xss) concat⁺ = Setoid.concat⁺ (setoid A) ------------------------------------------------------------------------ -- take & drop module _ {a} {A : Set a} where drop⁺ : ∀ {xs} n → Unique xs → Unique (drop n xs) drop⁺ = Setoid.drop⁺ (setoid A) take⁺ : ∀ {xs} n → Unique xs → Unique (take n xs) take⁺ = Setoid.take⁺ (setoid A) ------------------------------------------------------------------------ -- applyUpTo & upTo module _ {a} {A : Set a} where applyUpTo⁺₁ : ∀ f n → (∀ {i j} → i < j → j < n → f i ≢ f j) → Unique (applyUpTo f n) applyUpTo⁺₁ = Setoid.applyUpTo⁺₁ (setoid A) applyUpTo⁺₂ : ∀ f n → (∀ i j → f i ≢ f j) → Unique (applyUpTo f n) applyUpTo⁺₂ = Setoid.applyUpTo⁺₂ (setoid A) ------------------------------------------------------------------------ -- upTo upTo⁺ : ∀ n → Unique (upTo n) upTo⁺ n = applyUpTo⁺₁ id n (λ i<j _ → <⇒≢ i<j) ------------------------------------------------------------------------ -- applyDownFrom module _ {a} {A : Set a} where applyDownFrom⁺₁ : ∀ f n → (∀ {i j} → j < i → i < n → f i ≢ f j) → Unique (applyDownFrom f n) applyDownFrom⁺₁ = Setoid.applyDownFrom⁺₁ (setoid A) applyDownFrom⁺₂ : ∀ f n → (∀ i j → f i ≢ f j) → Unique (applyDownFrom f n) applyDownFrom⁺₂ = Setoid.applyDownFrom⁺₂ (setoid A) ------------------------------------------------------------------------ -- downFrom downFrom⁺ : ∀ n → Unique (downFrom n) downFrom⁺ n = applyDownFrom⁺₁ id n (λ j<i _ → <⇒≢ j<i ∘ sym) ------------------------------------------------------------------------ -- tabulate module _ {a} {A : Set a} where tabulate⁺ : ∀ {n} {f : Fin n → A} → (∀ {i j} → f i ≡ f j → i ≡ j) → Unique (tabulate f) tabulate⁺ = Setoid.tabulate⁺ (setoid A) ------------------------------------------------------------------------ -- allFin allFin⁺ : ∀ n → Unique (allFin n) allFin⁺ n = tabulate⁺ id ------------------------------------------------------------------------ -- filter module _ {a p} {A : Set a} {P : Pred _ p} (P? : Decidable P) where filter⁺ : ∀ {xs} → Unique xs → Unique (filter P? xs) filter⁺ = Setoid.filter⁺ (setoid A) P?
alloy4fun_models/trashltl/models/4/Br5a6azREg7yJH9Mo.als
Kaixi26/org.alloytools.alloy
0
2756
open main pred idBr5a6azREg7yJH9Mo_prop5 { eventually File' = File - Trash } pred __repair { idBr5a6azREg7yJH9Mo_prop5 } check __repair { idBr5a6azREg7yJH9Mo_prop5 <=> prop5o }
du.asm
younger15/xv6-public
0
174733
_du: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" #include "fcntl.h" int main(int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 57 push %edi e: 56 push %esi f: 53 push %ebx 10: 51 push %ecx 11: 81 ec 40 04 00 00 sub $0x440,%esp 17: 8b 41 04 mov 0x4(%ecx),%eax int fd = open("UserList", O_RDONLY); 1a: 6a 00 push $0x0 1c: 68 50 09 00 00 push $0x950 #include "stat.h" #include "user.h" #include "fcntl.h" int main(int argc, char *argv[]) { 21: 89 85 c4 fb ff ff mov %eax,-0x43c(%ebp) int fd = open("UserList", O_RDONLY); 27: e8 d6 04 00 00 call 502 <open> 2c: 89 c3 mov %eax,%ebx char c; char name[32]; int nameFound = 0; //char *names = nameList; char buf[1024]; int checkReadFile = read(fd, buf,sizeof buf); 2e: 8d 85 e8 fb ff ff lea -0x418(%ebp),%eax 34: 83 c4 0c add $0xc,%esp 37: 68 00 04 00 00 push $0x400 3c: 50 push %eax 3d: 53 push %ebx 3e: e8 97 04 00 00 call 4da <read> 43: 89 c6 mov %eax,%esi close(fd); 45: 89 1c 24 mov %ebx,(%esp) 48: e8 9d 04 00 00 call 4ea <close> if(checkReadFile < 0) 4d: 83 c4 10 add $0x10,%esp 50: 85 f6 test %esi,%esi 52: 0f 88 fd 01 00 00 js 255 <main+0x255> { printf(1,"Can't find user list\n"); } else { if (strcmp(argv[1],"Admin")==0) 58: 8b 85 c4 fb ff ff mov -0x43c(%ebp),%eax 5e: 83 ec 08 sub $0x8,%esp 61: 68 6f 09 00 00 push $0x96f 66: ff 70 04 pushl 0x4(%eax) 69: e8 42 02 00 00 call 2b0 <strcmp> 6e: 83 c4 10 add $0x10,%esp 71: 85 c0 test %eax,%eax 73: 0f 84 ef 01 00 00 je 268 <main+0x268> 79: 31 f6 xor %esi,%esi 7b: 31 d2 xor %edx,%edx } else { do { c = buf[i]; 7d: 0f b6 84 35 e8 fb ff movzbl -0x418(%ebp,%esi,1),%eax 84: ff i++; 85: 8d 7e 01 lea 0x1(%esi),%edi if (c == ':') 88: 3c 3a cmp $0x3a,%al 8a: 74 27 je b3 <main+0xb3> 8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi j = 0; } else { name[j] = c; 90: 88 84 15 c8 fb ff ff mov %al,-0x438(%ebp,%edx,1) j++; 97: 83 c2 01 add $0x1,%edx } }while (c != '\0'); 9a: 84 c0 test %al,%al 9c: 0f 84 57 01 00 00 je 1f9 <main+0x1f9> a2: 89 fe mov %edi,%esi } else { do { c = buf[i]; a4: 0f b6 84 35 e8 fb ff movzbl -0x418(%ebp,%esi,1),%eax ab: ff i++; ac: 8d 7e 01 lea 0x1(%esi),%edi if (c == ':') af: 3c 3a cmp $0x3a,%al b1: 75 dd jne 90 <main+0x90> { char* p = argv[1]; b3: 8b 85 c4 fb ff ff mov -0x43c(%ebp),%eax char* q = name; while (j > 0 && *p && *p == *q) b9: 85 d2 test %edx,%edx { c = buf[i]; i++; if (c == ':') { char* p = argv[1]; bb: 8b 58 04 mov 0x4(%eax),%ebx char* q = name; while (j > 0 && *p && *p == *q) be: 74 54 je 114 <main+0x114> c0: 0f b6 03 movzbl (%ebx),%eax c3: 84 c0 test %al,%al c5: 0f 84 25 01 00 00 je 1f0 <main+0x1f0> cb: 3a 85 c8 fb ff ff cmp -0x438(%ebp),%al d1: 0f 85 19 01 00 00 jne 1f0 <main+0x1f0> d7: 8d 43 01 lea 0x1(%ebx),%eax da: 01 d3 add %edx,%ebx dc: 8d 95 c8 fb ff ff lea -0x438(%ebp),%edx e2: eb 1a jmp fe <main+0xfe> e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi e8: 0f b6 08 movzbl (%eax),%ecx eb: 84 c9 test %cl,%cl ed: 0f 84 fd 00 00 00 je 1f0 <main+0x1f0> f3: 83 c0 01 add $0x1,%eax f6: 3a 0a cmp (%edx),%cl f8: 0f 85 f2 00 00 00 jne 1f0 <main+0x1f0> { p++; q++; fe: 83 c2 01 add $0x1,%edx i++; if (c == ':') { char* p = argv[1]; char* q = name; while (j > 0 && *p && *p == *q) 101: 39 d8 cmp %ebx,%eax 103: 75 e3 jne e8 <main+0xe8> 105: eb 0d jmp 114 <main+0x114> 107: 89 f6 mov %esi,%esi 109: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi if (j == 0) { // name found nameFound = 1; i-=2; while (buf[i] != ':' && i > 0) // return to the last ':' 110: 85 f6 test %esi,%esi 112: 7e 0d jle 121 <main+0x121> } if (j == 0) { // name found nameFound = 1; i-=2; 114: 83 ee 01 sub $0x1,%esi while (buf[i] != ':' && i > 0) // return to the last ':' 117: 80 bc 35 e8 fb ff ff cmpb $0x3a,-0x418(%ebp,%esi,1) 11e: 3a 11f: 75 ef jne 110 <main+0x110> i--; i++; 121: 8d 56 01 lea 0x1(%esi),%edx 124: 8d 4e 02 lea 0x2(%esi),%ecx 127: 0f b6 84 15 e8 fb ff movzbl -0x418(%ebp,%edx,1),%eax 12e: ff while (buf[i] != ':') 12f: 3c 3a cmp $0x3a,%al 131: 74 30 je 163 <main+0x163> { int k = i; while (buf[k] != '\0') 133: 84 c0 test %al,%al 135: 0f 84 40 01 00 00 je 27b <main+0x27b> 13b: 8d 85 e8 fb ff ff lea -0x418(%ebp),%eax 141: 01 c8 add %ecx,%eax 143: 90 nop 144: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi { buf[k] = buf[k+1]; 148: 0f b6 18 movzbl (%eax),%ebx 14b: 83 c0 01 add $0x1,%eax 14e: 88 58 fe mov %bl,-0x2(%eax) i--; i++; while (buf[i] != ':') { int k = i; while (buf[k] != '\0') 151: 80 78 ff 00 cmpb $0x0,-0x1(%eax) 155: 75 f1 jne 148 <main+0x148> 157: 0f b6 84 15 e8 fb ff movzbl -0x418(%ebp,%edx,1),%eax 15e: ff nameFound = 1; i-=2; while (buf[i] != ':' && i > 0) // return to the last ':' i--; i++; while (buf[i] != ':') 15f: 3c 3a cmp $0x3a,%al 161: 75 d0 jne 133 <main+0x133> 163: 8d 85 e8 fb ff ff lea -0x418(%ebp),%eax 169: 01 c1 add %eax,%ecx 16b: 89 cb mov %ecx,%ebx 16d: 8d 76 00 lea 0x0(%esi),%esi } int k = i; // delete ':' while (buf[k] != '\0') { buf[k] = buf[k+1]; 170: 0f b6 03 movzbl (%ebx),%eax 173: 83 c3 01 add $0x1,%ebx 176: 88 43 fe mov %al,-0x2(%ebx) } } int k = i; // delete ':' while (buf[k] != '\0') 179: 80 7b ff 00 cmpb $0x0,-0x1(%ebx) 17d: 75 f1 jne 170 <main+0x170> 17f: 0f b6 84 15 e8 fb ff movzbl -0x418(%ebp,%edx,1),%eax 186: ff { buf[k] = buf[k+1]; k++; } while (buf[i] != ':') 187: 3c 3a cmp $0x3a,%al 189: 74 28 je 1b3 <main+0x1b3> { int k = i; while (buf[k] != '\0') 18b: 84 c0 test %al,%al 18d: 0f 84 ea 00 00 00 je 27d <main+0x27d> 193: 89 c8 mov %ecx,%eax 195: 8d 76 00 lea 0x0(%esi),%esi { buf[k] = buf[k+1]; 198: 0f b6 18 movzbl (%eax),%ebx 19b: 83 c0 01 add $0x1,%eax 19e: 88 58 fe mov %bl,-0x2(%eax) k++; } while (buf[i] != ':') { int k = i; while (buf[k] != '\0') 1a1: 80 78 ff 00 cmpb $0x0,-0x1(%eax) 1a5: 75 f1 jne 198 <main+0x198> 1a7: 0f b6 84 15 e8 fb ff movzbl -0x418(%ebp,%edx,1),%eax 1ae: ff while (buf[k] != '\0') { buf[k] = buf[k+1]; k++; } while (buf[i] != ':') 1af: 3c 3a cmp $0x3a,%al 1b1: 75 d8 jne 18b <main+0x18b> } i--; // delete ':' k = i; while (buf[k] != '\0') 1b3: 80 bc 35 e8 fb ff ff cmpb $0x0,-0x418(%ebp,%esi,1) 1ba: 00 1bb: 74 1a je 1d7 <main+0x1d7> 1bd: 8d 85 e8 fb ff ff lea -0x418(%ebp),%eax 1c3: 01 c2 add %eax,%edx 1c5: 8d 76 00 lea 0x0(%esi),%esi { buf[k] = buf[k+1]; 1c8: 0f b6 02 movzbl (%edx),%eax 1cb: 83 c2 01 add $0x1,%edx 1ce: 88 42 fe mov %al,-0x2(%edx) } i--; // delete ':' k = i; while (buf[k] != '\0') 1d1: 80 7a ff 00 cmpb $0x0,-0x1(%edx) 1d5: 75 f1 jne 1c8 <main+0x1c8> j++; } }while (c != '\0'); if (nameFound == 1) printf(1,"User deleted\n"); 1d7: 52 push %edx 1d8: 52 push %edx 1d9: 68 8a 09 00 00 push $0x98a 1de: 6a 01 push $0x1 1e0: e8 4b 04 00 00 call 630 <printf> 1e5: 83 c4 10 add $0x10,%esp 1e8: eb 20 jmp 20a <main+0x20a> 1ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1f0: 31 d2 xor %edx,%edx 1f2: 89 fe mov %edi,%esi 1f4: e9 ab fe ff ff jmp a4 <main+0xa4> else printf(1,"User name not found\n"); 1f9: 50 push %eax 1fa: 50 push %eax 1fb: 68 98 09 00 00 push $0x998 200: 6a 01 push $0x1 202: e8 29 04 00 00 call 630 <printf> 207: 83 c4 10 add $0x10,%esp } } fd = open("UserList", O_RDWR); 20a: 83 ec 08 sub $0x8,%esp 20d: 6a 02 push $0x2 20f: 68 50 09 00 00 push $0x950 214: e8 e9 02 00 00 call 502 <open> if(fd >= 0) 219: 83 c4 10 add $0x10,%esp 21c: 85 c0 test %eax,%eax else printf(1,"User name not found\n"); } } fd = open("UserList", O_RDWR); 21e: 89 c3 mov %eax,%ebx if(fd >= 0) 220: 78 2e js 250 <main+0x250> { write(fd,buf,strlen(buf)+1); 222: 8d 85 e8 fb ff ff lea -0x418(%ebp),%eax 228: 83 ec 0c sub $0xc,%esp 22b: 50 push %eax 22c: e8 cf 00 00 00 call 300 <strlen> 231: 83 c4 0c add $0xc,%esp 234: 83 c0 01 add $0x1,%eax 237: 50 push %eax 238: 8d 85 e8 fb ff ff lea -0x418(%ebp),%eax 23e: 50 push %eax 23f: 53 push %ebx 240: e8 9d 02 00 00 call 4e2 <write> close(fd); 245: 89 1c 24 mov %ebx,(%esp) 248: e8 9d 02 00 00 call 4ea <close> 24d: 83 c4 10 add $0x10,%esp } exit(); 250: e8 6d 02 00 00 call 4c2 <exit> char buf[1024]; int checkReadFile = read(fd, buf,sizeof buf); close(fd); if(checkReadFile < 0) { printf(1,"Can't find user list\n"); 255: 53 push %ebx 256: 53 push %ebx 257: 68 59 09 00 00 push $0x959 25c: 6a 01 push $0x1 25e: e8 cd 03 00 00 call 630 <printf> 263: 83 c4 10 add $0x10,%esp 266: eb a2 jmp 20a <main+0x20a> } else { if (strcmp(argv[1],"Admin")==0) { printf(1,"Cannot delete Admin\n"); 268: 51 push %ecx 269: 51 push %ecx 26a: 68 75 09 00 00 push $0x975 26f: 6a 01 push $0x1 271: e8 ba 03 00 00 call 630 <printf> 276: 83 c4 10 add $0x10,%esp 279: eb 8f jmp 20a <main+0x20a> 27b: eb fe jmp 27b <main+0x27b> 27d: eb fe jmp 27d <main+0x27d> 27f: 90 nop 00000280 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 280: 55 push %ebp 281: 89 e5 mov %esp,%ebp 283: 53 push %ebx 284: 8b 45 08 mov 0x8(%ebp),%eax 287: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 28a: 89 c2 mov %eax,%edx 28c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 290: 83 c1 01 add $0x1,%ecx 293: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 297: 83 c2 01 add $0x1,%edx 29a: 84 db test %bl,%bl 29c: 88 5a ff mov %bl,-0x1(%edx) 29f: 75 ef jne 290 <strcpy+0x10> ; return os; } 2a1: 5b pop %ebx 2a2: 5d pop %ebp 2a3: c3 ret 2a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 2aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 000002b0 <strcmp>: int strcmp(const char *p, const char *q) { 2b0: 55 push %ebp 2b1: 89 e5 mov %esp,%ebp 2b3: 56 push %esi 2b4: 53 push %ebx 2b5: 8b 55 08 mov 0x8(%ebp),%edx 2b8: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 2bb: 0f b6 02 movzbl (%edx),%eax 2be: 0f b6 19 movzbl (%ecx),%ebx 2c1: 84 c0 test %al,%al 2c3: 75 1e jne 2e3 <strcmp+0x33> 2c5: eb 29 jmp 2f0 <strcmp+0x40> 2c7: 89 f6 mov %esi,%esi 2c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 2d0: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 2d3: 0f b6 02 movzbl (%edx),%eax p++, q++; 2d6: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 2d9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx 2dd: 84 c0 test %al,%al 2df: 74 0f je 2f0 <strcmp+0x40> 2e1: 89 f1 mov %esi,%ecx 2e3: 38 d8 cmp %bl,%al 2e5: 74 e9 je 2d0 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; 2e7: 29 d8 sub %ebx,%eax } 2e9: 5b pop %ebx 2ea: 5e pop %esi 2eb: 5d pop %ebp 2ec: c3 ret 2ed: 8d 76 00 lea 0x0(%esi),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 2f0: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; 2f2: 29 d8 sub %ebx,%eax } 2f4: 5b pop %ebx 2f5: 5e pop %esi 2f6: 5d pop %ebp 2f7: c3 ret 2f8: 90 nop 2f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000300 <strlen>: uint strlen(const char *s) { 300: 55 push %ebp 301: 89 e5 mov %esp,%ebp 303: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 306: 80 39 00 cmpb $0x0,(%ecx) 309: 74 12 je 31d <strlen+0x1d> 30b: 31 d2 xor %edx,%edx 30d: 8d 76 00 lea 0x0(%esi),%esi 310: 83 c2 01 add $0x1,%edx 313: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 317: 89 d0 mov %edx,%eax 319: 75 f5 jne 310 <strlen+0x10> ; return n; } 31b: 5d pop %ebp 31c: c3 ret uint strlen(const char *s) { int n; for(n = 0; s[n]; n++) 31d: 31 c0 xor %eax,%eax ; return n; } 31f: 5d pop %ebp 320: c3 ret 321: eb 0d jmp 330 <memset> 323: 90 nop 324: 90 nop 325: 90 nop 326: 90 nop 327: 90 nop 328: 90 nop 329: 90 nop 32a: 90 nop 32b: 90 nop 32c: 90 nop 32d: 90 nop 32e: 90 nop 32f: 90 nop 00000330 <memset>: void* memset(void *dst, int c, uint n) { 330: 55 push %ebp 331: 89 e5 mov %esp,%ebp 333: 57 push %edi 334: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 337: 8b 4d 10 mov 0x10(%ebp),%ecx 33a: 8b 45 0c mov 0xc(%ebp),%eax 33d: 89 d7 mov %edx,%edi 33f: fc cld 340: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 342: 89 d0 mov %edx,%eax 344: 5f pop %edi 345: 5d pop %ebp 346: c3 ret 347: 89 f6 mov %esi,%esi 349: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000350 <strchr>: char* strchr(const char *s, char c) { 350: 55 push %ebp 351: 89 e5 mov %esp,%ebp 353: 53 push %ebx 354: 8b 45 08 mov 0x8(%ebp),%eax 357: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 35a: 0f b6 10 movzbl (%eax),%edx 35d: 84 d2 test %dl,%dl 35f: 74 1d je 37e <strchr+0x2e> if(*s == c) 361: 38 d3 cmp %dl,%bl 363: 89 d9 mov %ebx,%ecx 365: 75 0d jne 374 <strchr+0x24> 367: eb 17 jmp 380 <strchr+0x30> 369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 370: 38 ca cmp %cl,%dl 372: 74 0c je 380 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 374: 83 c0 01 add $0x1,%eax 377: 0f b6 10 movzbl (%eax),%edx 37a: 84 d2 test %dl,%dl 37c: 75 f2 jne 370 <strchr+0x20> if(*s == c) return (char*)s; return 0; 37e: 31 c0 xor %eax,%eax } 380: 5b pop %ebx 381: 5d pop %ebp 382: c3 ret 383: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 389: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000390 <gets>: char* gets(char *buf, int max) { 390: 55 push %ebp 391: 89 e5 mov %esp,%ebp 393: 57 push %edi 394: 56 push %esi 395: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 396: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 398: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 39b: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 39e: eb 29 jmp 3c9 <gets+0x39> cc = read(0, &c, 1); 3a0: 83 ec 04 sub $0x4,%esp 3a3: 6a 01 push $0x1 3a5: 57 push %edi 3a6: 6a 00 push $0x0 3a8: e8 2d 01 00 00 call 4da <read> if(cc < 1) 3ad: 83 c4 10 add $0x10,%esp 3b0: 85 c0 test %eax,%eax 3b2: 7e 1d jle 3d1 <gets+0x41> break; buf[i++] = c; 3b4: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 3b8: 8b 55 08 mov 0x8(%ebp),%edx 3bb: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 3bd: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 3bf: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 3c3: 74 1b je 3e0 <gets+0x50> 3c5: 3c 0d cmp $0xd,%al 3c7: 74 17 je 3e0 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 3c9: 8d 5e 01 lea 0x1(%esi),%ebx 3cc: 3b 5d 0c cmp 0xc(%ebp),%ebx 3cf: 7c cf jl 3a0 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 3d1: 8b 45 08 mov 0x8(%ebp),%eax 3d4: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 3d8: 8d 65 f4 lea -0xc(%ebp),%esp 3db: 5b pop %ebx 3dc: 5e pop %esi 3dd: 5f pop %edi 3de: 5d pop %ebp 3df: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 3e0: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 3e3: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 3e5: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 3e9: 8d 65 f4 lea -0xc(%ebp),%esp 3ec: 5b pop %ebx 3ed: 5e pop %esi 3ee: 5f pop %edi 3ef: 5d pop %ebp 3f0: c3 ret 3f1: eb 0d jmp 400 <stat> 3f3: 90 nop 3f4: 90 nop 3f5: 90 nop 3f6: 90 nop 3f7: 90 nop 3f8: 90 nop 3f9: 90 nop 3fa: 90 nop 3fb: 90 nop 3fc: 90 nop 3fd: 90 nop 3fe: 90 nop 3ff: 90 nop 00000400 <stat>: int stat(const char *n, struct stat *st) { 400: 55 push %ebp 401: 89 e5 mov %esp,%ebp 403: 56 push %esi 404: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 405: 83 ec 08 sub $0x8,%esp 408: 6a 00 push $0x0 40a: ff 75 08 pushl 0x8(%ebp) 40d: e8 f0 00 00 00 call 502 <open> if(fd < 0) 412: 83 c4 10 add $0x10,%esp 415: 85 c0 test %eax,%eax 417: 78 27 js 440 <stat+0x40> return -1; r = fstat(fd, st); 419: 83 ec 08 sub $0x8,%esp 41c: ff 75 0c pushl 0xc(%ebp) 41f: 89 c3 mov %eax,%ebx 421: 50 push %eax 422: e8 f3 00 00 00 call 51a <fstat> 427: 89 c6 mov %eax,%esi close(fd); 429: 89 1c 24 mov %ebx,(%esp) 42c: e8 b9 00 00 00 call 4ea <close> return r; 431: 83 c4 10 add $0x10,%esp 434: 89 f0 mov %esi,%eax } 436: 8d 65 f8 lea -0x8(%ebp),%esp 439: 5b pop %ebx 43a: 5e pop %esi 43b: 5d pop %ebp 43c: c3 ret 43d: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 440: b8 ff ff ff ff mov $0xffffffff,%eax 445: eb ef jmp 436 <stat+0x36> 447: 89 f6 mov %esi,%esi 449: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000450 <atoi>: return r; } int atoi(const char *s) { 450: 55 push %ebp 451: 89 e5 mov %esp,%ebp 453: 53 push %ebx 454: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 457: 0f be 11 movsbl (%ecx),%edx 45a: 8d 42 d0 lea -0x30(%edx),%eax 45d: 3c 09 cmp $0x9,%al 45f: b8 00 00 00 00 mov $0x0,%eax 464: 77 1f ja 485 <atoi+0x35> 466: 8d 76 00 lea 0x0(%esi),%esi 469: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 470: 8d 04 80 lea (%eax,%eax,4),%eax 473: 83 c1 01 add $0x1,%ecx 476: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 47a: 0f be 11 movsbl (%ecx),%edx 47d: 8d 5a d0 lea -0x30(%edx),%ebx 480: 80 fb 09 cmp $0x9,%bl 483: 76 eb jbe 470 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 485: 5b pop %ebx 486: 5d pop %ebp 487: c3 ret 488: 90 nop 489: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000490 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 490: 55 push %ebp 491: 89 e5 mov %esp,%ebp 493: 56 push %esi 494: 53 push %ebx 495: 8b 5d 10 mov 0x10(%ebp),%ebx 498: 8b 45 08 mov 0x8(%ebp),%eax 49b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 49e: 85 db test %ebx,%ebx 4a0: 7e 14 jle 4b6 <memmove+0x26> 4a2: 31 d2 xor %edx,%edx 4a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 4a8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 4ac: 88 0c 10 mov %cl,(%eax,%edx,1) 4af: 83 c2 01 add $0x1,%edx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 4b2: 39 da cmp %ebx,%edx 4b4: 75 f2 jne 4a8 <memmove+0x18> *dst++ = *src++; return vdst; } 4b6: 5b pop %ebx 4b7: 5e pop %esi 4b8: 5d pop %ebp 4b9: c3 ret 000004ba <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 4ba: b8 01 00 00 00 mov $0x1,%eax 4bf: cd 40 int $0x40 4c1: c3 ret 000004c2 <exit>: SYSCALL(exit) 4c2: b8 02 00 00 00 mov $0x2,%eax 4c7: cd 40 int $0x40 4c9: c3 ret 000004ca <wait>: SYSCALL(wait) 4ca: b8 03 00 00 00 mov $0x3,%eax 4cf: cd 40 int $0x40 4d1: c3 ret 000004d2 <pipe>: SYSCALL(pipe) 4d2: b8 04 00 00 00 mov $0x4,%eax 4d7: cd 40 int $0x40 4d9: c3 ret 000004da <read>: SYSCALL(read) 4da: b8 05 00 00 00 mov $0x5,%eax 4df: cd 40 int $0x40 4e1: c3 ret 000004e2 <write>: SYSCALL(write) 4e2: b8 10 00 00 00 mov $0x10,%eax 4e7: cd 40 int $0x40 4e9: c3 ret 000004ea <close>: SYSCALL(close) 4ea: b8 15 00 00 00 mov $0x15,%eax 4ef: cd 40 int $0x40 4f1: c3 ret 000004f2 <kill>: SYSCALL(kill) 4f2: b8 06 00 00 00 mov $0x6,%eax 4f7: cd 40 int $0x40 4f9: c3 ret 000004fa <exec>: SYSCALL(exec) 4fa: b8 07 00 00 00 mov $0x7,%eax 4ff: cd 40 int $0x40 501: c3 ret 00000502 <open>: SYSCALL(open) 502: b8 0f 00 00 00 mov $0xf,%eax 507: cd 40 int $0x40 509: c3 ret 0000050a <mknod>: SYSCALL(mknod) 50a: b8 11 00 00 00 mov $0x11,%eax 50f: cd 40 int $0x40 511: c3 ret 00000512 <unlink>: SYSCALL(unlink) 512: b8 12 00 00 00 mov $0x12,%eax 517: cd 40 int $0x40 519: c3 ret 0000051a <fstat>: SYSCALL(fstat) 51a: b8 08 00 00 00 mov $0x8,%eax 51f: cd 40 int $0x40 521: c3 ret 00000522 <link>: SYSCALL(link) 522: b8 13 00 00 00 mov $0x13,%eax 527: cd 40 int $0x40 529: c3 ret 0000052a <mkdir>: SYSCALL(mkdir) 52a: b8 14 00 00 00 mov $0x14,%eax 52f: cd 40 int $0x40 531: c3 ret 00000532 <chdir>: SYSCALL(chdir) 532: b8 09 00 00 00 mov $0x9,%eax 537: cd 40 int $0x40 539: c3 ret 0000053a <dup>: SYSCALL(dup) 53a: b8 0a 00 00 00 mov $0xa,%eax 53f: cd 40 int $0x40 541: c3 ret 00000542 <getpid>: SYSCALL(getpid) 542: b8 0b 00 00 00 mov $0xb,%eax 547: cd 40 int $0x40 549: c3 ret 0000054a <sbrk>: SYSCALL(sbrk) 54a: b8 0c 00 00 00 mov $0xc,%eax 54f: cd 40 int $0x40 551: c3 ret 00000552 <sleep>: SYSCALL(sleep) 552: b8 0d 00 00 00 mov $0xd,%eax 557: cd 40 int $0x40 559: c3 ret 0000055a <uptime>: SYSCALL(uptime) 55a: b8 0e 00 00 00 mov $0xe,%eax 55f: cd 40 int $0x40 561: c3 ret 00000562 <cps>: SYSCALL(cps) 562: b8 16 00 00 00 mov $0x16,%eax 567: cd 40 int $0x40 569: c3 ret 0000056a <userTag>: SYSCALL(userTag) 56a: b8 17 00 00 00 mov $0x17,%eax 56f: cd 40 int $0x40 571: c3 ret 00000572 <changeUser>: SYSCALL(changeUser) 572: b8 18 00 00 00 mov $0x18,%eax 577: cd 40 int $0x40 579: c3 ret 0000057a <getUser>: SYSCALL(getUser) 57a: b8 19 00 00 00 mov $0x19,%eax 57f: cd 40 int $0x40 581: c3 ret 00000582 <changeOwner>: SYSCALL(changeOwner) 582: b8 1a 00 00 00 mov $0x1a,%eax 587: cd 40 int $0x40 589: c3 ret 58a: 66 90 xchg %ax,%ax 58c: 66 90 xchg %ax,%ax 58e: 66 90 xchg %ax,%ax 00000590 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 590: 55 push %ebp 591: 89 e5 mov %esp,%ebp 593: 57 push %edi 594: 56 push %esi 595: 53 push %ebx 596: 89 c6 mov %eax,%esi 598: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 59b: 8b 5d 08 mov 0x8(%ebp),%ebx 59e: 85 db test %ebx,%ebx 5a0: 74 7e je 620 <printint+0x90> 5a2: 89 d0 mov %edx,%eax 5a4: c1 e8 1f shr $0x1f,%eax 5a7: 84 c0 test %al,%al 5a9: 74 75 je 620 <printint+0x90> neg = 1; x = -xx; 5ab: 89 d0 mov %edx,%eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 5ad: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) x = -xx; 5b4: f7 d8 neg %eax 5b6: 89 75 c0 mov %esi,-0x40(%ebp) } else { x = xx; } i = 0; 5b9: 31 ff xor %edi,%edi 5bb: 8d 5d d7 lea -0x29(%ebp),%ebx 5be: 89 ce mov %ecx,%esi 5c0: eb 08 jmp 5ca <printint+0x3a> 5c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 5c8: 89 cf mov %ecx,%edi 5ca: 31 d2 xor %edx,%edx 5cc: 8d 4f 01 lea 0x1(%edi),%ecx 5cf: f7 f6 div %esi 5d1: 0f b6 92 b4 09 00 00 movzbl 0x9b4(%edx),%edx }while((x /= base) != 0); 5d8: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 5da: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 5dd: 75 e9 jne 5c8 <printint+0x38> if(neg) 5df: 8b 45 c4 mov -0x3c(%ebp),%eax 5e2: 8b 75 c0 mov -0x40(%ebp),%esi 5e5: 85 c0 test %eax,%eax 5e7: 74 08 je 5f1 <printint+0x61> buf[i++] = '-'; 5e9: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 5ee: 8d 4f 02 lea 0x2(%edi),%ecx 5f1: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi 5f5: 8d 76 00 lea 0x0(%esi),%esi 5f8: 0f b6 07 movzbl (%edi),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 5fb: 83 ec 04 sub $0x4,%esp 5fe: 83 ef 01 sub $0x1,%edi 601: 6a 01 push $0x1 603: 53 push %ebx 604: 56 push %esi 605: 88 45 d7 mov %al,-0x29(%ebp) 608: e8 d5 fe ff ff call 4e2 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 60d: 83 c4 10 add $0x10,%esp 610: 39 df cmp %ebx,%edi 612: 75 e4 jne 5f8 <printint+0x68> putc(fd, buf[i]); } 614: 8d 65 f4 lea -0xc(%ebp),%esp 617: 5b pop %ebx 618: 5e pop %esi 619: 5f pop %edi 61a: 5d pop %ebp 61b: c3 ret 61c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; } else { x = xx; 620: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 622: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 629: eb 8b jmp 5b6 <printint+0x26> 62b: 90 nop 62c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000630 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 630: 55 push %ebp 631: 89 e5 mov %esp,%ebp 633: 57 push %edi 634: 56 push %esi 635: 53 push %ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 636: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 639: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 63c: 8b 75 0c mov 0xc(%ebp),%esi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 63f: 8b 7d 08 mov 0x8(%ebp),%edi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 642: 89 45 d0 mov %eax,-0x30(%ebp) 645: 0f b6 1e movzbl (%esi),%ebx 648: 83 c6 01 add $0x1,%esi 64b: 84 db test %bl,%bl 64d: 0f 84 b0 00 00 00 je 703 <printf+0xd3> 653: 31 d2 xor %edx,%edx 655: eb 39 jmp 690 <printf+0x60> 657: 89 f6 mov %esi,%esi 659: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 660: 83 f8 25 cmp $0x25,%eax 663: 89 55 d4 mov %edx,-0x2c(%ebp) state = '%'; 666: ba 25 00 00 00 mov $0x25,%edx state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 66b: 74 18 je 685 <printf+0x55> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 66d: 8d 45 e2 lea -0x1e(%ebp),%eax 670: 83 ec 04 sub $0x4,%esp 673: 88 5d e2 mov %bl,-0x1e(%ebp) 676: 6a 01 push $0x1 678: 50 push %eax 679: 57 push %edi 67a: e8 63 fe ff ff call 4e2 <write> 67f: 8b 55 d4 mov -0x2c(%ebp),%edx 682: 83 c4 10 add $0x10,%esp 685: 83 c6 01 add $0x1,%esi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 688: 0f b6 5e ff movzbl -0x1(%esi),%ebx 68c: 84 db test %bl,%bl 68e: 74 73 je 703 <printf+0xd3> c = fmt[i] & 0xff; if(state == 0){ 690: 85 d2 test %edx,%edx uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 692: 0f be cb movsbl %bl,%ecx 695: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 698: 74 c6 je 660 <printf+0x30> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 69a: 83 fa 25 cmp $0x25,%edx 69d: 75 e6 jne 685 <printf+0x55> if(c == 'd'){ 69f: 83 f8 64 cmp $0x64,%eax 6a2: 0f 84 f8 00 00 00 je 7a0 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 6a8: 81 e1 f7 00 00 00 and $0xf7,%ecx 6ae: 83 f9 70 cmp $0x70,%ecx 6b1: 74 5d je 710 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 6b3: 83 f8 73 cmp $0x73,%eax 6b6: 0f 84 84 00 00 00 je 740 <printf+0x110> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 6bc: 83 f8 63 cmp $0x63,%eax 6bf: 0f 84 ea 00 00 00 je 7af <printf+0x17f> putc(fd, *ap); ap++; } else if(c == '%'){ 6c5: 83 f8 25 cmp $0x25,%eax 6c8: 0f 84 c2 00 00 00 je 790 <printf+0x160> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 6ce: 8d 45 e7 lea -0x19(%ebp),%eax 6d1: 83 ec 04 sub $0x4,%esp 6d4: c6 45 e7 25 movb $0x25,-0x19(%ebp) 6d8: 6a 01 push $0x1 6da: 50 push %eax 6db: 57 push %edi 6dc: e8 01 fe ff ff call 4e2 <write> 6e1: 83 c4 0c add $0xc,%esp 6e4: 8d 45 e6 lea -0x1a(%ebp),%eax 6e7: 88 5d e6 mov %bl,-0x1a(%ebp) 6ea: 6a 01 push $0x1 6ec: 50 push %eax 6ed: 57 push %edi 6ee: 83 c6 01 add $0x1,%esi 6f1: e8 ec fd ff ff call 4e2 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 6f6: 0f b6 5e ff movzbl -0x1(%esi),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 6fa: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 6fd: 31 d2 xor %edx,%edx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 6ff: 84 db test %bl,%bl 701: 75 8d jne 690 <printf+0x60> putc(fd, c); } state = 0; } } } 703: 8d 65 f4 lea -0xc(%ebp),%esp 706: 5b pop %ebx 707: 5e pop %esi 708: 5f pop %edi 709: 5d pop %ebp 70a: c3 ret 70b: 90 nop 70c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); 710: 83 ec 0c sub $0xc,%esp 713: b9 10 00 00 00 mov $0x10,%ecx 718: 6a 00 push $0x0 71a: 8b 5d d0 mov -0x30(%ebp),%ebx 71d: 89 f8 mov %edi,%eax 71f: 8b 13 mov (%ebx),%edx 721: e8 6a fe ff ff call 590 <printint> ap++; 726: 89 d8 mov %ebx,%eax 728: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 72b: 31 d2 xor %edx,%edx if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); ap++; 72d: 83 c0 04 add $0x4,%eax 730: 89 45 d0 mov %eax,-0x30(%ebp) 733: e9 4d ff ff ff jmp 685 <printf+0x55> 738: 90 nop 739: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; 740: 8b 45 d0 mov -0x30(%ebp),%eax 743: 8b 18 mov (%eax),%ebx ap++; 745: 83 c0 04 add $0x4,%eax 748: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) s = "(null)"; 74b: b8 ad 09 00 00 mov $0x9ad,%eax 750: 85 db test %ebx,%ebx 752: 0f 44 d8 cmove %eax,%ebx while(*s != 0){ 755: 0f b6 03 movzbl (%ebx),%eax 758: 84 c0 test %al,%al 75a: 74 23 je 77f <printf+0x14f> 75c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 760: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 763: 8d 45 e3 lea -0x1d(%ebp),%eax 766: 83 ec 04 sub $0x4,%esp 769: 6a 01 push $0x1 ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; 76b: 83 c3 01 add $0x1,%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 76e: 50 push %eax 76f: 57 push %edi 770: e8 6d fd ff ff call 4e2 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 775: 0f b6 03 movzbl (%ebx),%eax 778: 83 c4 10 add $0x10,%esp 77b: 84 c0 test %al,%al 77d: 75 e1 jne 760 <printf+0x130> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 77f: 31 d2 xor %edx,%edx 781: e9 ff fe ff ff jmp 685 <printf+0x55> 786: 8d 76 00 lea 0x0(%esi),%esi 789: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 790: 83 ec 04 sub $0x4,%esp 793: 88 5d e5 mov %bl,-0x1b(%ebp) 796: 8d 45 e5 lea -0x1b(%ebp),%eax 799: 6a 01 push $0x1 79b: e9 4c ff ff ff jmp 6ec <printf+0xbc> } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 7a0: 83 ec 0c sub $0xc,%esp 7a3: b9 0a 00 00 00 mov $0xa,%ecx 7a8: 6a 01 push $0x1 7aa: e9 6b ff ff ff jmp 71a <printf+0xea> 7af: 8b 5d d0 mov -0x30(%ebp),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 7b2: 83 ec 04 sub $0x4,%esp 7b5: 8b 03 mov (%ebx),%eax 7b7: 6a 01 push $0x1 7b9: 88 45 e4 mov %al,-0x1c(%ebp) 7bc: 8d 45 e4 lea -0x1c(%ebp),%eax 7bf: 50 push %eax 7c0: 57 push %edi 7c1: e8 1c fd ff ff call 4e2 <write> 7c6: e9 5b ff ff ff jmp 726 <printf+0xf6> 7cb: 66 90 xchg %ax,%ax 7cd: 66 90 xchg %ax,%ax 7cf: 90 nop 000007d0 <free>: static Header base; static Header *freep; void free(void *ap) { 7d0: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 7d1: a1 58 0c 00 00 mov 0xc58,%eax static Header base; static Header *freep; void free(void *ap) { 7d6: 89 e5 mov %esp,%ebp 7d8: 57 push %edi 7d9: 56 push %esi 7da: 53 push %ebx 7db: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 7de: 8b 10 mov (%eax),%edx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; 7e0: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 7e3: 39 c8 cmp %ecx,%eax 7e5: 73 19 jae 800 <free+0x30> 7e7: 89 f6 mov %esi,%esi 7e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 7f0: 39 d1 cmp %edx,%ecx 7f2: 72 1c jb 810 <free+0x40> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 7f4: 39 d0 cmp %edx,%eax 7f6: 73 18 jae 810 <free+0x40> static Header base; static Header *freep; void free(void *ap) { 7f8: 89 d0 mov %edx,%eax Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 7fa: 39 c8 cmp %ecx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 7fc: 8b 10 mov (%eax),%edx free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 7fe: 72 f0 jb 7f0 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 800: 39 d0 cmp %edx,%eax 802: 72 f4 jb 7f8 <free+0x28> 804: 39 d1 cmp %edx,%ecx 806: 73 f0 jae 7f8 <free+0x28> 808: 90 nop 809: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(bp + bp->s.size == p->s.ptr){ 810: 8b 73 fc mov -0x4(%ebx),%esi 813: 8d 3c f1 lea (%ecx,%esi,8),%edi 816: 39 d7 cmp %edx,%edi 818: 74 19 je 833 <free+0x63> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 81a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 81d: 8b 50 04 mov 0x4(%eax),%edx 820: 8d 34 d0 lea (%eax,%edx,8),%esi 823: 39 f1 cmp %esi,%ecx 825: 74 23 je 84a <free+0x7a> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 827: 89 08 mov %ecx,(%eax) freep = p; 829: a3 58 0c 00 00 mov %eax,0xc58 } 82e: 5b pop %ebx 82f: 5e pop %esi 830: 5f pop %edi 831: 5d pop %ebp 832: c3 ret bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 833: 03 72 04 add 0x4(%edx),%esi 836: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 839: 8b 10 mov (%eax),%edx 83b: 8b 12 mov (%edx),%edx 83d: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 840: 8b 50 04 mov 0x4(%eax),%edx 843: 8d 34 d0 lea (%eax,%edx,8),%esi 846: 39 f1 cmp %esi,%ecx 848: 75 dd jne 827 <free+0x57> p->s.size += bp->s.size; 84a: 03 53 fc add -0x4(%ebx),%edx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; 84d: a3 58 0c 00 00 mov %eax,0xc58 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 852: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 855: 8b 53 f8 mov -0x8(%ebx),%edx 858: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } 85a: 5b pop %ebx 85b: 5e pop %esi 85c: 5f pop %edi 85d: 5d pop %ebp 85e: c3 ret 85f: 90 nop 00000860 <malloc>: return freep; } void* malloc(uint nbytes) { 860: 55 push %ebp 861: 89 e5 mov %esp,%ebp 863: 57 push %edi 864: 56 push %esi 865: 53 push %ebx 866: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 869: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 86c: 8b 15 58 0c 00 00 mov 0xc58,%edx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 872: 8d 78 07 lea 0x7(%eax),%edi 875: c1 ef 03 shr $0x3,%edi 878: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 87b: 85 d2 test %edx,%edx 87d: 0f 84 a3 00 00 00 je 926 <malloc+0xc6> 883: 8b 02 mov (%edx),%eax 885: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 888: 39 cf cmp %ecx,%edi 88a: 76 74 jbe 900 <malloc+0xa0> 88c: 81 ff 00 10 00 00 cmp $0x1000,%edi 892: be 00 10 00 00 mov $0x1000,%esi 897: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx 89e: 0f 43 f7 cmovae %edi,%esi 8a1: ba 00 80 00 00 mov $0x8000,%edx 8a6: 81 ff ff 0f 00 00 cmp $0xfff,%edi 8ac: 0f 46 da cmovbe %edx,%ebx 8af: eb 10 jmp 8c1 <malloc+0x61> 8b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 8b8: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 8ba: 8b 48 04 mov 0x4(%eax),%ecx 8bd: 39 cf cmp %ecx,%edi 8bf: 76 3f jbe 900 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 8c1: 39 05 58 0c 00 00 cmp %eax,0xc58 8c7: 89 c2 mov %eax,%edx 8c9: 75 ed jne 8b8 <malloc+0x58> char *p; Header *hp; if(nu < 4096) nu = 4096; p = sbrk(nu * sizeof(Header)); 8cb: 83 ec 0c sub $0xc,%esp 8ce: 53 push %ebx 8cf: e8 76 fc ff ff call 54a <sbrk> if(p == (char*)-1) 8d4: 83 c4 10 add $0x10,%esp 8d7: 83 f8 ff cmp $0xffffffff,%eax 8da: 74 1c je 8f8 <malloc+0x98> return 0; hp = (Header*)p; hp->s.size = nu; 8dc: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); 8df: 83 ec 0c sub $0xc,%esp 8e2: 83 c0 08 add $0x8,%eax 8e5: 50 push %eax 8e6: e8 e5 fe ff ff call 7d0 <free> return freep; 8eb: 8b 15 58 0c 00 00 mov 0xc58,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) 8f1: 83 c4 10 add $0x10,%esp 8f4: 85 d2 test %edx,%edx 8f6: 75 c0 jne 8b8 <malloc+0x58> return 0; 8f8: 31 c0 xor %eax,%eax 8fa: eb 1c jmp 918 <malloc+0xb8> 8fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) 900: 39 cf cmp %ecx,%edi 902: 74 1c je 920 <malloc+0xc0> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 904: 29 f9 sub %edi,%ecx 906: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 909: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 90c: 89 78 04 mov %edi,0x4(%eax) } freep = prevp; 90f: 89 15 58 0c 00 00 mov %edx,0xc58 return (void*)(p + 1); 915: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 918: 8d 65 f4 lea -0xc(%ebp),%esp 91b: 5b pop %ebx 91c: 5e pop %esi 91d: 5f pop %edi 91e: 5d pop %ebp 91f: c3 ret base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) prevp->s.ptr = p->s.ptr; 920: 8b 08 mov (%eax),%ecx 922: 89 0a mov %ecx,(%edx) 924: eb e9 jmp 90f <malloc+0xaf> Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; 926: c7 05 58 0c 00 00 5c movl $0xc5c,0xc58 92d: 0c 00 00 930: c7 05 5c 0c 00 00 5c movl $0xc5c,0xc5c 937: 0c 00 00 base.s.size = 0; 93a: b8 5c 0c 00 00 mov $0xc5c,%eax 93f: c7 05 60 0c 00 00 00 movl $0x0,0xc60 946: 00 00 00 949: e9 3e ff ff ff jmp 88c <malloc+0x2c>
dropin/src/yaml-destination-c_string.ads
robdaemon/AdaYaml
32
20400
<filename>dropin/src/yaml-destination-c_string.ads -- part of AdaYaml, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "copying.txt" with Interfaces.C; with System; package Yaml.Destination.C_String is type Instance is new Destination.Instance with private; function As_Destination (Raw : System.Address; Size : Interfaces.C.size_t; Size_Written : access Interfaces.C.size_t) return Pointer; overriding procedure Write_Data (D : in out Instance; Buffer : String); private type Instance is new Destination.Instance with record Raw : System.Address; Size : Integer; Size_Written : access Interfaces.C.size_t; end record; end Yaml.Destination.C_String;
programs/oeis/027/A027659.asm
karttu/loda
1
22797
<reponame>karttu/loda<gh_stars>1-10 ; A027659: a(n) = binomial(n+2,2) + binomial(n+3,3) + binomial(n+4,4) + binomial(n+5,5). ; 4,18,52,121,246,455,784,1278,1992,2992,4356,6175,8554,11613,15488,20332,26316,33630,42484,53109,65758,80707,98256,118730,142480,169884,201348,237307,278226,324601,376960,435864,501908,575722,657972,749361,850630,962559,1085968,1221718,1370712,1533896,1712260,1906839,2118714,2349013,2598912,2869636,3162460,3478710,3819764,4187053,4582062,5006331,5461456,5949090,6470944,7028788,7624452,8259827,8936866,9657585,10424064,11238448,12102948,13019842,13991476,15020265,16108694,17259319,18474768,19757742,21111016,22537440,24039940,25621519,27285258,29034317,30871936,32801436,34826220,36949774,39175668,41507557,43949182,46504371,49177040,51971194,54890928,57940428,61123972,64445931,67910770,71523049,75287424,79208648,83291572,87541146,91962420,96560545,101340774,106308463,111469072,116828166,122391416,128164600,134153604,140364423,146803162,153476037,160389376,167549620,174963324,182637158,190577908,198792477,207287886,216071275,225149904,234531154,244222528,254231652,264566276,275234275,286243650,297602529,309319168,321401952,333859396,346700146,359932980,373566809,387610678,402073767,416965392,432295006,448072200,464306704,481008388,498187263,515853482,534017341,552689280,571879884,591599884,611860158,632671732,654045781,675993630,698526755,721656784,745395498,769754832,794746876,820383876,846678235,873642514,901289433,929631872,958682872,988455636,1018963530,1050220084,1082238993,1115034118,1148619487,1183009296,1218217910,1254259864,1291149864,1328902788,1367533687,1407057786,1447490485,1488847360,1531144164,1574396828,1618621462,1663834356,1710051981,1757290990,1805568219,1854900688,1905305602,1956800352,2009402516,2063129860,2118000339,2174032098,2231243473,2289652992,2349279376,2410141540,2472258594,2535649844,2600334793,2666333142,2733664791,2802349840,2872408590,2943861544,3016729408,3091033092,3166793711,3244032586,3322771245,3403031424,3484835068,3568204332,3653161582,3739729396,3827930565,3917788094,4009325203,4102565328,4197532122,4294249456,4392741420,4493032324,4595146699,4699109298,4804945097,4912679296,5022337320,5133944820,5247527674,5363111988,5480724097,5600390566,5722138191,5845994000,5971985254,6100139448,6230484312,6363047812,6497858151,6634943770,6774333349,6916055808,7060140308,7206616252,7355513286,7506861300,7660690429,7817031054,7975913803,8137369552,8301429426,8468124800,8637487300 add $0,6 mov $2,$0 bin $0,5 sub $0,$2 mov $1,$0 add $1,4
data/cookies.asm
martendo7/cookie-shooter-gb
3
244675
INCLUDE "defines.inc" SECTION "Cookie Data", ROM0 MACRO hitbox ; Y, H, X, W DB (COOKIE_WIDTH - \1) / 2 DB \1 DB (COOKIE_HEIGHT - \1) / 2 DB \1 ENDM CookieHitboxTable:: hitbox 12 ; COOKIE_SIZE_16 hitbox 10 ; COOKIE_SIZE_14 hitbox 8 ; COOKIE_SIZE_12 hitbox 6 ; COOKIE_SIZE_10 hitbox 4 ; COOKIE_SIZE_8 .end:: ; Points values in BCD CookiePointsTable:: DW $25 ; COOKIE_SIZE_16 DW $50 ; COOKIE_SIZE_14 DW $75 ; COOKIE_SIZE_12 DW $100 ; COOKIE_SIZE_10 DW $125 ; COOKIE_SIZE_8 .end::
programs/oeis/116/A116922.asm
jmorken/loda
1
88781
; A116922: a(n) = smallest integer >= n/2 which is coprime to n. ; 1,1,2,3,3,5,4,5,5,7,6,7,7,9,8,9,9,11,10,11,11,13,12,13,13,15,14,15,15,17,16,17,17,19,18,19,19,21,20,21,21,23,22,23,23,25,24,25,25,27,26,27,27,29,28,29,29,31,30,31,31,33,32,33,33,35,34,35,35,37,36,37,37,39,38,39,39,41,40,41,41,43,42,43,43,45,44,45,45,47,46,47,47,49,48,49,49,51,50,51,51,53,52,53,53,55,54,55,55,57,56,57,57,59,58,59,59,61,60,61,61,63,62,63,63,65,64,65,65,67,66,67,67,69,68,69,69,71,70,71,71,73,72,73,73,75,74,75,75,77,76,77,77,79,78,79,79,81,80,81,81,83,82,83,83,85,84,85,85,87,86,87,87,89,88,89,89,91,90,91,91,93,92,93,93,95,94,95,95,97,96,97,97,99,98,99,99,101,100,101,101,103,102,103,103,105,104,105,105,107,106,107,107,109,108,109,109,111,110,111,111,113,112,113,113,115,114,115,115,117,116,117,117,119,118,119,119,121,120,121,121,123,122,123,123,125,124,125,125,127 sub $0,1 lpb $0 mov $2,$0 add $2,$0 gcd $0,4 mov $1,$0 sub $0,$0 div $2,2 add $1,$2 lpe div $1,2 add $1,1
src/asm/win64/readm34t.asm
Pantarheon/libkoliba
0
6157
;; readm34t.asm ;; ;; Copyright 2021 G. <NAME> ;; All rights reserved ;; ;; nasm -f win64 readm34t.asm section .text default rel EXTERN KOLIBA_ScanM34tFormat, KOLIBA_ResetMatrix EXTERN KOLIBA_ReadDoublesFromOpenFile, fopen, fclose GLOBAL KOLIBA_ReadM34tFromOpenFile, KOLIBA_ReadM34tFromNamedFile KOLIBA_ReadM34tFromOpenFile: ; On Entry: ; ; RCX = address of output KOLIBA_MATRIX ; RDX = handle of FILE to read from ; ; On Exit: ; ; RAX = KOLIBA_MATRIX on success, NULL on failure mov r8d, 12 lea r9, [KOLIBA_ScanM34tFormat] lea r10, [KOLIBA_ResetMatrix] jmp KOLIBA_ReadDoublesFromOpenFile align 16, int3 KOLIBA_ReadM34tFromNamedFile: ; On Entry: ; ; RCX = address of KOLIBA_MATRIX to read to ; RDX = file name to read from. push rbx sub rsp, 6*8 sub eax, eax mov rbx, rcx jrcxz .done mov rcx, rdx lea rdx, [rsp+40] jrcxz .done mov dword [rdx], 'rb' call fopen test rax, rax mov rcx, rbx mov rdx, rax je .done mov rbx, rdx call KOLIBA_ReadM34tFromOpenFile mov rcx, rbx mov rbx, rax call fclose mov rax, rbx .done: add rsp, 6*8 pop rbx ret section .drectve info db '-export:KOLIBA_ReadM34tFromOpenFile ' db '-export:KOLIBA_ReadM34tFromNamedFile '
Code/main.asm
msklywenn/GB-GameOfLife
9
160457
<filename>Code/main.asm<gh_stars>1-10 INCLUDE "hardware.inc" INCLUDE "utils.inc" _VRAM_BG_TILES EQU $9000 EMPTY_BG_TILE EQU 17 ANIMATE EQU %01 STEP EQU %10 EXPORT GameboyType SECTION "Main Memory", HRAM Control: ds 1 GameboyType: ds 1 SECTION "Header", ROM0[$100] EntryPoint: di jp Start REPT $150 - $104 db 0 ENDR SECTION "Main", ROM0[$150] Start: ldh [GameboyType], a ; enable sound ld a, $80 ld [rNR52], a ; sound ON ld a, $77 ldh [rNR50], a ; max volume on both speakers ld a, $99 ldh [rNR51], a ; channels 1 (pulse) and 4 (noise) on both speakers ; enable v-blank interrupt ld a, IEF_VBLANK ld [rIE], a HaltAndClearInterrupts ; load 18 tiles ; 0..15: 2x2 cell combinations ; 16: sprite selection tile ; 17: empty tile ld de, _VRAM_BG_TILES ld hl, BackgroundTiles ld bc, BackgroundTilesEnd - BackgroundTiles call VideoMemoryCopy IF !DEF(SKIP_INTRO) HaltAndClearInterrupts call Intro ELSE ld a, LCDCF_ON ldh [rLCDC], a ENDC ; copy sprite tiles HaltAndClearInterrupts ld de, _VRAM ld hl, SpriteTiles ld bc, SpriteTilesEnd - SpriteTiles call VideoMemoryCopy ; clear OAM over 4 frames HaltAndClearInterrupts ld hl, _OAMRAM ld d, 0 REPT 2 ld bc, 40 * 2 call MemorySet HaltAndClearInterrupts ENDR ; copy default map into 20x18 automata buffer ld hl, DefaultMap ld de, Buffer0 ld c, 18 .loopY ld b, 20 .loopX ld a, [hl+] ld [de], a inc de dec b jr nz, .loopX dec c jr z, .next ld a, l add a, 32 - 20 ld l, a jr nc, .loopY inc h jr .loopY .next ; set scrolling to (0, 0) xor a ldh [rSCX], a ldh [rSCY], a ; animate by default ld a, ANIMATE ldh [Control], a call InitJoypad call InitAutomata call InitRender call InitEdit ; load bg and obj palette [0=black, 1=dark gray, 2=light gray, 3=white] ld a, %11100100 ldh [rBGP], a ldh [rOBP0], a ; enable h-blank interrupt in lcd stat ld a, STATF_MODE00 ld [rSTAT], a ClearAndEnableInterrupts .mainloop ; animate if a control bit is set ldh a, [Control] or a jr z, .interact call StartRender call UpdateAutomata call WaitRender call SwapBuffers ; clear step bit ldh a, [Control] and a, ~STEP ldh [Control], a jr .checkpause .interact HaltAndClearInterrupts call EditOldBuffer ; step if B is pressed ldh a, [JoypadDown] and a, PADF_B jr z, .checkpause ; enable step bit in control ld a, STEP ldh [Control], a ; do sound ld a, $6E ldh [rNR10], a ; sweep ld a, (%01 << 6) + 30 ldh [rNR11], a ; pattern + sound length ld a, $33 ldh [rNR12], a ; init volume + envelope sweep FREQUENCY = 220 ld a, LOW(PULSE_FREQUENCY) ldh [rNR13], a ld a, SOUND_START | HIGH(PULSE_FREQUENCY) ldh [rNR14], a .checkpause call UpdateJoypad ldh a, [JoypadDown] and a, PADF_START jr z, .mainloop ldh a, [Control] xor a, ANIMATE ldh [Control], a and a, ANIMATE call Jingle ; toggle sprites ldh a, [rLCDC] xor a, LCDCF_OBJON ldh [rLCDC], a jr .mainloop EXPORT Jingle SECTION "Jingle", ROM0 Jingle: ; load initial frequency into HL FREQUENCY = 330 ld hl, PULSE_FREQUENCY ; load step to be added to frequency in DE ; based on if a != 0 or not or a jr z, .up .down ld de, 100 jr .do .up ld de, -100 .do ; load note count ld b, 3 .loop ; play pulse channel 1 with frequency set in HL xor a ldh [rNR10], a ; sweep ld a, (%01 << 6) + 30 ldh [rNR11], a ; pattern + sound length ld a, $F1 ldh [rNR12], a ; init volume + envelope sweep ld a, l ldh [rNR13], a ld a, h or a, SOUND_START ldh [rNR14], a ; add DE to HL frequency add hl, de ; wait ~166ms ld c, 6 .delay HaltAndClearInterrupts dec c jr nz, .delay ; repeat a few times dec b ret z jr .loop
programs/oeis/291/A291773.asm
neoneye/loda
22
25711
; A291773: Domination number of the n-Apollonian network. ; 1,1,3,4,7,16,43,124,367,1096,3283,9844,29527,88576,265723,797164,2391487,7174456,21523363,64570084,193710247,581130736,1743392203,5230176604,15690529807,47071589416,141214768243,423644304724,1270932914167,3812798742496,11438396227483,34315188682444,102945566047327,308836698141976,926510094425923,2779530283277764,8338590849833287,25015772549499856,75047317648499563,225141952945498684,675425858836496047,2026277576509488136,6078832729528464403,18236498188585393204,54709494565756179607,164128483697268538816,492385451091805616443,1477156353275416849324,4431469059826250547967,13294407179478751643896,39883221538436254931683,119649664615308764795044,358948993845926294385127,1076846981537778883155376,3230540944613336649466123,9691622833840009948398364,29074868501520029845195087,87224605504560089535585256,261673816513680268606755763,785021449541040805820267284,2355064348623122417460801847,7065193045869367252382405536,21195579137608101757147216603,63586737412824305271441649804,190760212238472915814324949407,572280636715418747442974848216,1716841910146256242328924544643,5150525730438768726986773633924,15451577191316306180960320901767,46354731573948918542880962705296,139064194721846755628642888115883,417192584165540266885928664347644,1251577752496620800657785993042927,3754733257489862401973357979128776,11264199772469587205920073937386323,33792599317408761617760221812158964,101377797952226284853280665436476887,304133393856678854559841996309430656,912400181570036563679525988928291963 mov $2,$0 lpb $0 mov $0,$2 sub $0,2 mov $1,3 pow $1,$0 add $1,3 lpe div $1,2 add $1,1 mov $0,$1
src/Generics/Constructions/DecEq.agda
flupe/generics
11
6731
{-# OPTIONS --safe #-} module Generics.Constructions.DecEq where open import Generics.Prelude hiding (lookup; _≟_) open import Generics.Telescope open import Generics.Desc open import Generics.All open import Generics.HasDesc import Generics.Helpers as Helpers import Data.Fin.Properties as Fin import Data.Product.Properties as Product open import Relation.Nullary.Decidable as Decidable open import Data.Empty open import Relation.Nullary open import Relation.Binary using (DecidableEquality) open import Relation.Nullary.Product record DecEq {l} (A : Set l) : Set l where field _≟_ : DecidableEquality A open DecEq ⦃...⦄ public module _ {P I ℓ} {A : Indexed P I ℓ} (H : HasDesc {P} {I} {ℓ} A) where data HigherOrderArgumentsNotSupported : Set where -- Predicate preventing the use of Higher-order inductive arguments OnlyFO : ∀ {V} → ConDesc P V I → Setω OnlyFO (var _) = Liftω ⊤ OnlyFO (π _ _ _) = Liftω HigherOrderArgumentsNotSupported OnlyFO (A ⊗ B) = OnlyFO A ×ω OnlyFO B open HasDesc H open Helpers P I DecEq (const ⊤) OnlyFO DecEqHelpers : ∀ p → Setω DecEqHelpers p = Helpers p D private irr≡ : ∀ {l} (A : Set l) (x y : Irr A) → x ≡ y irr≡ A (irrv _) (irrv _) = refl private module _ {p} (DH : DecEqHelpers p) where variable V : ExTele P v : ⟦ V ⟧tel p i : ⟦ I ⟧tel p mutual decEqIndArg-wf : ∀ (C : ConDesc P V I) → OnlyFO C → (x y : ⟦ C ⟧IndArg A′ (p , v)) → AllIndArgω Acc C x → AllIndArgω Acc C y → Dec (x ≡ y) decEqIndArg-wf (var i) H x y ax ay = decEq-wf x y ax ay decEqIndArg-wf (A ⊗ B) (HA , HB) (xa , xb) (ya , yb) (axa , axb) (aya , ayb) = map′ (λ (p , q) → cong₂ _,_ p q) (λ p → cong proj₁ p , cong proj₂ p) (decEqIndArg-wf _ HA xa ya axa aya ×-dec decEqIndArg-wf _ HB xb yb axb ayb) decEqIndArg-wf (π i S C) () decEqCon-wf : (C : ConDesc P V I) ⦃ H : ConHelper p C ⦄ (x y : ⟦ C ⟧Con A′ (p , v , i)) → AllConω Acc C x → AllConω Acc C y → Dec (x ≡ y) decEqCon-wf ._ ⦃ var ⦄ refl refl _ _ = yes refl decEqCon-wf ._ ⦃ pi-irr ⦃ _ ⦄ ⦃ H ⦄ ⦄ (irrv _ , x) (irrv _ , y) ax ay with decEqCon-wf _ ⦃ H ⦄ x y ax ay ... | yes refl = yes refl ... | no p = no (p ∘ λ {refl → refl}) decEqCon-wf ._ ⦃ pi-rel ⦃ dec ⦄ ⦃ H ⦄ ⦄ (s₁ , x) (s₂ , y) ax ay with dec .DecEq._≟_ s₁ s₂ ... | no p = no (p ∘ (λ { refl → refl })) ... | yes refl with decEqCon-wf _ ⦃ H ⦄ x y ax ay ... | yes refl = yes refl ... | no p = no (p ∘ (λ { refl → refl })) decEqCon-wf ._ ⦃ prod ⦃ HA ⦄ ⦄ (xa , xb) (ya , yb) (axa , axb) (aya , ayb) = map′ (λ (p , q) → cong₂ _,_ p q) (λ p → cong proj₁ p , cong proj₂ p) (decEqIndArg-wf _ HA xa ya axa aya ×-dec decEqCon-wf _ xb yb axb ayb) decEqData-wf : (x y : ⟦ D ⟧Data A′ (p , i)) → AllDataω Acc D x → AllDataω Acc D y → Decω (x ≡ω y) decEqData-wf (k₁ , x) (k₂ , y) ax ay with k₁ Fin.≟ k₂ decEqData-wf (k , x) (k , y) ax ay | yes refl with decEqCon-wf _ ⦃ lookupHelper DH k ⦄ x y ax ay decEqData-wf (k , x) (k , y) ax ay | yes refl | yes refl = yesω refl decEqData-wf (k , x) (k , y) ax ay | yes refl | no x≢y = noω λ { refl → x≢y refl } decEqData-wf (k₁ , x) (k₂ , y) ax ay | no k₁≢k₂ = noω λ { refl → k₁≢k₂ refl } decEq-wf : (x y : A′ (p , i)) → Acc x → Acc y → Dec (x ≡ y) decEq-wf x y (acc ax) (acc ay) with decEqData-wf (split x) (split y) ax ay ... | yesω p = yes (split-injective p) ... | noω p = no (λ e → p (cong≡ω split e)) deriveDecEq : ∀ {p} ⦃ DH : DecEqHelpers p ⦄ {i} → DecEq (A′ (p , i)) deriveDecEq ⦃ DH ⦄ .DecEq._≟_ x y = decEq-wf DH x y (wf x) (wf y)
src/security.ads
jquorning/ada-security
19
27861
----------------------------------------------------------------------- -- security -- Security -- Copyright (C) 2010, 2011, 2012, 2015, 2017, 2018, 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. ----------------------------------------------------------------------- -- = Security = -- The `Security` package provides a security framework that allows -- an application to use OpenID or OAuth security frameworks. This security -- framework was first developed within the Ada Server Faces project. -- It was moved to a separate project so that it can easyly be used with AWS. -- This package defines abstractions that are close or similar to Java -- security package. -- -- The security framework uses the following abstractions: -- -- * **Policy and policy manager**: -- The `Policy` defines and implements the set of security rules that specify how to -- protect the system or resources. The `Policy_Manager` maintains the security policies. -- -- * **Principal**: -- The `Principal` is the entity that can be authenticated. A principal is obtained -- after successful authentication of a user or of a system through an authorization process. -- The OpenID or OAuth authentication processes generate such security principal. -- -- * **Permission**: -- The `Permission` represents an access to a system or application resource. -- A permission is checked by using the security policy manager. The policy manager uses a -- security controller to enforce the permission. -- -- The `Security_Context` holds the contextual information that the security controller -- can use to verify the permission. The security context is associated with a principal and -- a set of policy context. -- -- == Overview == -- An application will create a security policy manager and register one or several security -- policies (yellow). The framework defines a simple role based security policy and an URL -- security policy intended to provide security in web applications. The security policy manager -- reads some security policy configuration file which allows the security policies to configure -- and create the security controllers. These controllers will enforce the security according -- to the application security rules. All these components are built only once when -- an application starts. -- -- A user is authenticated through an authentication system which creates a `Principal` -- instance that identifies the user (green). The security framework provides two authentication -- systems: OpenID and OAuth 2.0 OpenID Connect. -- -- [images/ModelOverview.png] -- -- When a permission must be enforced, a security context is created and linked to the -- `Principal` instance (blue). Additional security policy context can be added depending -- on the application context. To check the permission, the security policy manager is called -- and it will ask a security controller to verify the permission. -- -- The framework allows an application to plug its own security policy, its own policy context, -- its own principal and authentication mechanism. -- -- @include security-permissions.ads -- -- == Principal == -- A principal is created by using either the [Security_Auth OpenID], -- the [Security_OAuth OAuth] or another authentication mechanism. The authentication produces -- an object that must implement the `Principal` interface. For example: -- -- P : Security.Auth.Principal_Access := Security.Auth.Create_Principal (Auth); -- -- or -- -- P : Security.OAuth.Clients.Access_Token_Access := Security.OAuth.Clients.Create_Access_Token -- -- The principal is then stored in a security context. -- -- @include security-contexts.ads -- package Security is pragma Preelaborate; -- ------------------------------ -- Principal -- ------------------------------ type Principal is limited interface; type Principal_Access is access all Principal'Class; -- Get the principal name. function Get_Name (From : in Principal) return String is abstract; end Security;
programs/oeis/147/A147631.asm
neoneye/loda
22
247302
<gh_stars>10-100 ; A147631: 9-factorial numbers (6). ; 1,7,112,2800,95200,4093600,212867200,12984899200,908942944000,71806492576000,6318971346688000,612940220628736000,64971663386646016000,7471741289464291840000,926495919893572188160000 mul $0,9 trn $0,2 seq $0,114806 ; Nonuple factorial, 9-factorial, n!9, n!!!!!!!!!.
case-studies/performance/equivalence/alloy/model/program.als
uwplse/memsynth
19
1718
module program abstract sig Processor {} abstract sig Location { finalValue: lone Int -- which value wins? } one sig SyncLoc extends Location {} -- null location used for syncs sig Loc extends Location {} abstract sig MemoryEvent { proc: one Processor, pc: one Int, loc: one Location, data: one Int, po: set MemoryEvent, dp: set MemoryEvent, -- x->y in dep == y depends on x } abstract sig Write extends MemoryEvent {} abstract sig Read extends MemoryEvent {} abstract sig Barrier extends MemoryEvent {} abstract sig Sync extends Barrier {} abstract sig Lwsync extends Barrier {} -- Create the program order relation for Alglave fact { po = {e1, e2: MemoryEvent | pc[e1] < pc[e2] and proc[e1] = proc[e2]} } -- shorthand for writing programs pred memOp[p: Processor, c: Int, op: MemoryEvent, var: Location, d: Int] { proc[op] = p and pc[op] = c and loc[op] = var and data[op] = d } pred Processor.write[c: Int, op: Write, var: Location, d: Int] { memOp[this, c, op, var, d] } pred Processor.read[c: Int, op: Read, var: Location, d: Int] { memOp[this, c, op, var, d] } pred Processor.sync[c: Int, op: Sync] { memOp[this, c, op, SyncLoc, 0] } pred Processor.lwsync[c: Int, op: Lwsync] { memOp[this, c, op, SyncLoc, 0] } -- op1.dep[op2] == op1 depends on op2 == op2->op1 in dep pred MemoryEvent.dep[other: MemoryEvent] { other->this in dp } pred Location.final[c: Int] { this.finalValue = c }
programs/oeis/308/A308604.asm
neoneye/loda
22
16873
; A308604: Number of (not necessarily maximal) cliques in the n X n fiveleaper graph. ; 2,5,10,17,34,73,126,193,274,369,478,601,738,889,1054,1233,1426,1633,1854,2089,2338,2601,2878,3169,3474,3793,4126,4473,4834,5209,5598,6001,6418,6849,7294,7753,8226,8713,9214,9729,10258,10801,11358,11929,12514,13113,13726,14353,14994,15649,16318,17001,17698,18409,19134,19873,20626,21393,22174,22969,23778,24601,25438,26289,27154,28033,28926,29833,30754,31689,32638,33601,34578,35569,36574,37593,38626,39673,40734,41809,42898,44001,45118,46249,47394,48553,49726,50913,52114,53329,54558,55801,57058,58329,59614,60913,62226,63553,64894,66249 mov $2,$0 mov $3,$0 sub $3,2 mov $6,$0 lpb $0 mov $0,3 add $2,$3 mul $3,3 sub $3,3 mul $2,$3 div $2,2 add $2,2 trn $5,1 add $5,3 lpe add $2,1 mul $2,2 mul $5,2 add $5,2 sub $2,$5 mov $1,$2 add $1,2 mov $4,$6 mul $4,$6 add $1,$4 mov $0,$1
src/Ada/syscalls/ewok-syscalls-reset.adb
wookey-project/ewok-legacy
0
1885
-- -- Copyright 2018 The wookey project team <<EMAIL>> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with ewok.tasks; use ewok.tasks; with ewok.tasks_shared; use ewok.tasks_shared; with ewok.perm; use ewok.perm; with ewok.debug; with m4.scb; package body ewok.syscalls.reset with spark_mode => off is procedure sys_reset (caller_id : in ewok.tasks_shared.t_task_id; mode : in ewok.tasks_shared.t_task_mode) is begin if not ewok.perm.ressource_is_granted (PERM_RES_TSK_RESET, caller_id) then set_return_value (caller_id, mode, SYS_E_DENIED); ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE); return; end if; m4.scb.reset; debug.panic ("soc.nvic.reset failed !?!"); end sys_reset; end ewok.syscalls.reset;
src/Lens/Non-dependent/Higher/Coherently/Coinductive/Erased.agda
nad/dependent-lenses
3
14690
------------------------------------------------------------------------ -- A variant of Coherently with an erased field ------------------------------------------------------------------------ {-# OPTIONS --cubical --guardedness #-} import Equality.Path as P module Lens.Non-dependent.Higher.Coherently.Coinductive.Erased {e⁺} (eq : ∀ {a p} → P.Equality-with-paths a p e⁺) where open P.Derived-definitions-and-properties eq import Equality.Path.Univalence as EPU open import Logical-equivalence using (_⇔_) open import Prelude open import Bijection equality-with-J as B using (_↔_) import Bijection P.equality-with-J as PB open import Equality.Path.Isomorphisms eq open import Equivalence equality-with-J as Eq using (_≃_) import Equivalence P.equality-with-J as PEq open import Equivalence.Erased equality-with-J as EEq using (_≃ᴱ_) open import Function-universe equality-with-J hiding (_∘_) import Function-universe P.equality-with-J as PF open import H-level.Truncation.Propositional.One-step eq as O using (∥_∥¹; ∥∥¹ᴱ→∥∥¹) open import H-level.Truncation.Propositional.One-step.Erased eq as OE using (∥_∥¹ᴱ) open import Univalence-axiom equality-with-J import Univalence-axiom P.equality-with-J as PU open import Lens.Non-dependent.Higher.Coherently.Coinductive eq as C using (Coherently) private variable a b ℓ p p₁ p₂ : Level A A₁ A₂ B C : Type a x y : A f : A → B -- A variant of -- Lens.Non-dependent.Higher.Coherently.Coinductive.Coherently with an -- erased "coherent" field. record Coherentlyᴱ {A : Type a} {B : Type b} (P : {A : Type a} → (A → B) → Type p) (@0 step : {A : Type a} (f : A → B) → P f → ∥ A ∥¹ᴱ → B) (f : A → B) : Type p where coinductive field property : P f @0 coherent : Coherentlyᴱ P step (step f property) open Coherentlyᴱ public -- A preservation lemma for Coherentlyᴱ. (See also Coherentlyᴱ-cong -- below.) @0 Coherentlyᴱ-cong′ : {P : {A : Type a} → (A → B) → Type p} {step : {A : Type a} (f : A → B) → P f → ∥ A ∥¹ᴱ → B} → Univalence a → (A₁≃A₂ : A₁ ≃ A₂) → Coherentlyᴱ P step (f ∘ _≃_.to A₁≃A₂) ≃ Coherentlyᴱ P step f Coherentlyᴱ-cong′ {f = f} {P = P} {step = step} univ A₁≃A₂ = ≃-elim₁ univ (λ A₁≃A₂ → Coherentlyᴱ P step (f ∘ _≃_.to A₁≃A₂) ≃ Coherentlyᴱ P step f) Eq.id A₁≃A₂ -- Coherently can be converted to Coherentlyᴱ in a certain way -- (assuming univalence). Coherently→Coherentlyᴱ : {P : {A : Type a} → (A → B) → Type p} {step : {A : Type a} (f : A → B) → P f → ∥ A ∥¹ → B} → @0 Univalence a → Coherently P step f → Coherentlyᴱ P (λ f p → step f p ∘ ∥∥¹ᴱ→∥∥¹) f Coherently→Coherentlyᴱ _ c .property = c .C.property Coherently→Coherentlyᴱ univ c .coherent = Coherently→Coherentlyᴱ univ (_≃_.from (C.Coherently-cong′ univ O.∥∥¹ᴱ≃∥∥¹) (c .C.coherent)) -- In erased contexts Coherently and Coherentlyᴱ are, in a certain -- sense, logically equivalent (assuming univalence). @0 Coherentlyᴱ⇔Coherently : {P : {A : Type a} → (A → B) → Type p} {step : {A : Type a} (f : A → B) → P f → ∥ A ∥¹ → B} → Univalence a → Coherentlyᴱ P (λ f p → step f p ∘ ∥∥¹ᴱ→∥∥¹) f ⇔ Coherently P step f Coherentlyᴱ⇔Coherently univ ._⇔_.from = Coherently→Coherentlyᴱ univ Coherentlyᴱ⇔Coherently univ ._⇔_.to c .C.property = c .property Coherentlyᴱ⇔Coherently univ ._⇔_.to c .C.coherent = Coherentlyᴱ⇔Coherently univ ._⇔_.to (_≃_.to (Coherentlyᴱ-cong′ univ O.∥∥¹ᴱ≃∥∥¹) (c .coherent)) private -- A preservation lemma for Coherentlyᴱ. -- -- The lemma does not use the univalence argument, instead it uses -- EPU.univ (and EPU.≃⇒≡) directly. Coherentlyᴱ-cong-≡ : Block "Coherentlyᴱ-cong-≡" → {A : Type a} {P₁ P₂ : {A : Type a} → (A → B) → Type p} {step₁ : {A : Type a} (f : A → B) → P₁ f → ∥ A ∥¹ᴱ → B} {step₂ : {A : Type a} (f : A → B) → P₂ f → ∥ A ∥¹ᴱ → B} {f : A → B} → Univalence p → (P₁≃P₂ : {A : Type a} (f : A → B) → P₁ f ≃ P₂ f) → ({A : Type a} (f : A → B) (x : P₂ f) → step₁ f (_≃_.from (P₁≃P₂ f) x) ≡ step₂ f x) → Coherentlyᴱ P₁ step₁ f P.≡ Coherentlyᴱ P₂ step₂ f Coherentlyᴱ-cong-≡ {a = a} {B = B} {p = p} ⊠ {P₁ = P₁} {P₂ = P₂} {step₁ = step₁} {step₂ = step₂} {f = f} _ P₁≃P₂′ step₁≡step₂ = P.cong (λ ((P , step) : ∃ λ (P : (A : Type a) → (A → B) → Type p) → {A : Type a} (f : A → B) → P A f → ∥ A ∥¹ᴱ → B) → Coherentlyᴱ (P _) step f) $ Σ-≡,≡→≡′ (P.⟨ext⟩ λ A → P.⟨ext⟩ λ (f : A → B) → EPU.≃⇒≡ (P₁≃P₂ f)) (P.implicit-extensionality P.ext λ A → P.⟨ext⟩ λ f → P.subst (λ P → {A : Type a} (f : A → B) → P A f → ∥ A ∥¹ᴱ → B) (P.⟨ext⟩ λ A → P.⟨ext⟩ λ (f : A → B) → EPU.≃⇒≡ (P₁≃P₂ f)) step₁ f P.≡⟨ P.trans (P.cong (_$ f) $ P.sym $ P.push-subst-implicit-application (P.⟨ext⟩ λ A → P.⟨ext⟩ λ (f : A → B) → EPU.≃⇒≡ (P₁≃P₂ f)) (λ P A → (f : A → B) → P A f → ∥ A ∥¹ᴱ → B) {f = const _} {g = step₁}) $ P.sym $ P.push-subst-application (P.⟨ext⟩ λ A → P.⟨ext⟩ λ (f : A → B) → EPU.≃⇒≡ (P₁≃P₂ f)) (λ P f → P A f → ∥ A ∥¹ᴱ → B) {f = const f} {g = step₁} ⟩ P.subst (λ P → P A f → ∥ A ∥¹ᴱ → B) (P.⟨ext⟩ λ A → P.⟨ext⟩ λ (f : A → B) → EPU.≃⇒≡ (P₁≃P₂ f)) (step₁ f) P.≡⟨⟩ P.subst (λ P → P → ∥ A ∥¹ᴱ → B) (EPU.≃⇒≡ (P₁≃P₂ f)) (step₁ f) P.≡⟨ P.sym $ PU.transport-theorem (λ P → P → ∥ A ∥¹ᴱ → B) (PF.→-cong₁ _) (λ _ → P.refl) EPU.univ (P₁≃P₂ f) (step₁ f) ⟩ PF.→-cong₁ _ (P₁≃P₂ f) (step₁ f) P.≡⟨⟩ step₁ f ∘ PEq._≃_.from (P₁≃P₂ f) P.≡⟨ P.⟨ext⟩ (_↔_.to ≡↔≡ ∘ step₁≡step₂ f) ⟩∎ step₂ f ∎) where P₁≃P₂ : {A : Type a} (f : A → B) → P₁ f PEq.≃ P₂ f P₁≃P₂ f = _↔_.to ≃↔≃ (P₁≃P₂′ f) Σ-≡,≡→≡′ : {P : A → Type b} {p₁ p₂ : Σ A P} → (p : proj₁ p₁ P.≡ proj₁ p₂) → P.subst P p (proj₂ p₁) P.≡ proj₂ p₂ → p₁ P.≡ p₂ Σ-≡,≡→≡′ {P = P} {p₁ = _ , y₁} {p₂ = _ , y₂} p q i = p i , lemma i where lemma : P.[ (λ i → P (p i)) ] y₁ ≡ y₂ lemma = PB._↔_.from (P.heterogeneous↔homogeneous _) q -- A "computation rule". to-Coherentlyᴱ-cong-≡-property : (bl : Block "Coherentlyᴱ-cong-≡") {A : Type a} {B : Type b} {P₁ P₂ : {A : Type a} → (A → B) → Type p} {step₁ : {A : Type a} (f : A → B) → P₁ f → ∥ A ∥¹ᴱ → B} {step₂ : {A : Type a} (f : A → B) → P₂ f → ∥ A ∥¹ᴱ → B} {f : A → B} (univ : Univalence p) (P₁≃P₂ : {A : Type a} (f : A → B) → P₁ f ≃ P₂ f) (step₁≡step₂ : {A : Type a} (f : A → B) (x : P₂ f) → step₁ f (_≃_.from (P₁≃P₂ f) x) ≡ step₂ f x) (c : Coherentlyᴱ P₁ step₁ f) → PU.≡⇒→ (Coherentlyᴱ-cong-≡ bl univ P₁≃P₂ step₁≡step₂) c .property P.≡ _≃_.to (P₁≃P₂ f) (c .property) to-Coherentlyᴱ-cong-≡-property ⊠ {P₁ = P₁} {P₂ = P₂} {f = f} _ P₁≃P₂ step₁≡step₂ c = P.transport (λ _ → P₂ f) P.0̲ (_≃_.to (P₁≃P₂ f) (P.transport (λ _ → P₁ f) P.0̲ (c .property))) P.≡⟨ P.cong (_$ _≃_.to (P₁≃P₂ f) (P.transport (λ _ → P₁ f) P.0̲ (c .property))) $ P.transport-refl P.0̲ ⟩ _≃_.to (P₁≃P₂ f) (P.transport (λ _ → P₁ f) P.0̲ (c .property)) P.≡⟨ P.cong (λ g → _≃_.to (P₁≃P₂ f) (g (c .property))) $ P.transport-refl P.0̲ ⟩∎ _≃_.to (P₁≃P₂ f) (c .property) ∎ -- Another "computation rule". from-Coherentlyᴱ-cong-≡-property : (bl : Block "Coherentlyᴱ-cong-≡") {A : Type a} {B : Type b} {P₁ P₂ : {A : Type a} → (A → B) → Type p} {step₁ : {A : Type a} (f : A → B) → P₁ f → ∥ A ∥¹ᴱ → B} {step₂ : {A : Type a} (f : A → B) → P₂ f → ∥ A ∥¹ᴱ → B} {f : A → B} (univ : Univalence p) (P₁≃P₂ : {A : Type a} (f : A → B) → P₁ f ≃ P₂ f) (step₁≡step₂ : {A : Type a} (f : A → B) (x : P₂ f) → step₁ f (_≃_.from (P₁≃P₂ f) x) ≡ step₂ f x) (c : Coherentlyᴱ P₂ step₂ f) → PEq._≃_.from (PU.≡⇒≃ (Coherentlyᴱ-cong-≡ bl {step₁ = step₁} univ P₁≃P₂ step₁≡step₂)) c .property P.≡ _≃_.from (P₁≃P₂ f) (c .property) from-Coherentlyᴱ-cong-≡-property ⊠ {P₁ = P₁} {P₂ = P₂} {f = f} _ P₁≃P₂ step₁≡step₂ c = P.transport (λ _ → P₁ f) P.0̲ (_≃_.from (P₁≃P₂ f) (P.transport (λ _ → P₂ f) P.0̲ (c .property))) P.≡⟨ P.cong (_$ _≃_.from (P₁≃P₂ f) (P.transport (λ _ → P₂ f) P.0̲ (c .property))) $ P.transport-refl P.0̲ ⟩ _≃_.from (P₁≃P₂ f) (P.transport (λ _ → P₂ f) P.0̲ (c .property)) P.≡⟨ P.cong (λ g → _≃_.from (P₁≃P₂ f) (g (c .property))) $ P.transport-refl P.0̲ ⟩∎ _≃_.from (P₁≃P₂ f) (c .property) ∎ -- A preservation lemma for Coherentlyᴱ. -- -- The two directions of this equivalence compute the property -- fields in certain ways, see the "unit tests" below. -- -- Note that P₁ and P₂ have to target the same universe. A more -- general result is given below (Coherentlyᴱ-cong). Coherentlyᴱ-cong-≃ᴱ : {A : Type a} {P₁ P₂ : {A : Type a} → (A → B) → Type p} {@0 step₁ : {A : Type a} (f : A → B) → P₁ f → ∥ A ∥¹ᴱ → B} {@0 step₂ : {A : Type a} (f : A → B) → P₂ f → ∥ A ∥¹ᴱ → B} {f : A → B} → @0 Univalence p → (P₁≃P₂ : {A : Type a} (f : A → B) → P₁ f ≃ᴱ P₂ f) → @0 ({A : Type a} (f : A → B) (x : P₂ f) → step₁ f (_≃ᴱ_.from (P₁≃P₂ f) x) ≡ step₂ f x) → Coherentlyᴱ P₁ step₁ f ≃ᴱ Coherentlyᴱ P₂ step₂ f Coherentlyᴱ-cong-≃ᴱ {P₁ = P₁} {P₂ = P₂} {step₁ = step₁} {step₂ = step₂} {f = f} univ P₁≃P₂ step₁≡step₂ = block λ bl → EEq.[≃]→≃ᴱ (EEq.[proofs] (Eq.with-other-inverse (Eq.with-other-function (equiv bl) (to bl) (_↔_.from ≡↔≡ ∘ ≡to bl)) (from bl) (_↔_.from ≡↔≡ ∘ ≡from bl))) where @0 equiv : Block "Coherentlyᴱ-cong-≡" → Coherentlyᴱ P₁ step₁ f ≃ Coherentlyᴱ P₂ step₂ f equiv bl = _↔_.from ≃↔≃ $ PU.≡⇒≃ $ Coherentlyᴱ-cong-≡ bl univ (EEq.≃ᴱ→≃ ∘ P₁≃P₂) step₁≡step₂ to : Block "Coherentlyᴱ-cong-≡" → Coherentlyᴱ P₁ step₁ f → Coherentlyᴱ P₂ step₂ f to _ c .property = _≃ᴱ_.to (P₁≃P₂ f) (c .property) to bl c .coherent = P.subst (Coherentlyᴱ P₂ step₂) (P.cong (step₂ f) $ to-Coherentlyᴱ-cong-≡-property bl univ (EEq.≃ᴱ→≃ ∘ P₁≃P₂) step₁≡step₂ c) $ _≃_.to (equiv bl) c .coherent @0 ≡to : ∀ bl c → _≃_.to (equiv bl) c P.≡ to bl c ≡to bl c i .property = to-Coherentlyᴱ-cong-≡-property bl univ (EEq.≃ᴱ→≃ ∘ P₁≃P₂) step₁≡step₂ c i ≡to bl c i .coherent = lemma i where lemma : P.[ (λ i → Coherentlyᴱ P₂ step₂ (step₂ f (to-Coherentlyᴱ-cong-≡-property bl univ (EEq.≃ᴱ→≃ ∘ P₁≃P₂) step₁≡step₂ c i))) ] _≃_.to (equiv bl) c .coherent ≡ P.subst (Coherentlyᴱ P₂ step₂) (P.cong (step₂ f) $ to-Coherentlyᴱ-cong-≡-property bl univ (EEq.≃ᴱ→≃ ∘ P₁≃P₂) step₁≡step₂ c) (_≃_.to (equiv bl) c .coherent) lemma = PB._↔_.from (P.heterogeneous↔homogeneous _) P.refl from : Block "Coherentlyᴱ-cong-≡" → Coherentlyᴱ P₂ step₂ f → Coherentlyᴱ P₁ step₁ f from _ c .property = _≃ᴱ_.from (P₁≃P₂ f) (c .property) from bl c .coherent = P.subst (Coherentlyᴱ P₁ step₁) (P.cong (step₁ f) $ from-Coherentlyᴱ-cong-≡-property bl univ (EEq.≃ᴱ→≃ ∘ P₁≃P₂) step₁≡step₂ c) $ _≃_.from (equiv bl) c .coherent @0 ≡from : ∀ bl c → _≃_.from (equiv bl) c P.≡ from bl c ≡from bl c i .property = from-Coherentlyᴱ-cong-≡-property bl univ (EEq.≃ᴱ→≃ ∘ P₁≃P₂) step₁≡step₂ c i ≡from bl c i .coherent = lemma i where lemma : P.[ (λ i → Coherentlyᴱ P₁ step₁ (step₁ f (from-Coherentlyᴱ-cong-≡-property bl univ (EEq.≃ᴱ→≃ ∘ P₁≃P₂) step₁≡step₂ c i))) ] _≃_.from (equiv bl) c .coherent ≡ P.subst (Coherentlyᴱ P₁ step₁) (P.cong (step₁ f) $ from-Coherentlyᴱ-cong-≡-property bl univ (EEq.≃ᴱ→≃ ∘ P₁≃P₂) step₁≡step₂ c) (_≃_.from (equiv bl) c .coherent) lemma = PB._↔_.from (P.heterogeneous↔homogeneous _) P.refl -- Unit tests that ensure that Coherentlyᴱ-cong-≃ᴱ computes the -- property fields in certain ways. module _ {A : Type a} {P₁ P₂ : {A : Type a} → (A → B) → Type p} {@0 step₁ : {A : Type a} (f : A → B) → P₁ f → ∥ A ∥¹ᴱ → B} {@0 step₂ : {A : Type a} (f : A → B) → P₂ f → ∥ A ∥¹ᴱ → B} {f : A → B} {@0 univ : Univalence p} {P₁≃P₂ : {A : Type a} (f : A → B) → P₁ f ≃ᴱ P₂ f} {@0 step₁≡step₂ : {A : Type a} (f : A → B) (x : P₂ f) → step₁ f (_≃ᴱ_.from (P₁≃P₂ f) x) ≡ step₂ f x} where _ : {c : Coherentlyᴱ P₁ step₁ f} → _≃ᴱ_.to (Coherentlyᴱ-cong-≃ᴱ univ P₁≃P₂ step₁≡step₂) c .property ≡ _≃ᴱ_.to (P₁≃P₂ f) (c .property) _ = refl _ _ : {c : Coherentlyᴱ P₂ step₂ f} → _≃ᴱ_.from (Coherentlyᴱ-cong-≃ᴱ {step₁ = step₁} univ P₁≃P₂ step₁≡step₂) c .property ≡ _≃ᴱ_.from (P₁≃P₂ f) (c .property) _ = refl _ -- A lemma involving Coherentlyᴱ and ↑. Coherentlyᴱ-↑ : {A : Type a} {P : {A : Type a} → (A → B) → Type p} {@0 step : {A : Type a} (f : A → B) → P f → ∥ A ∥¹ᴱ → B} {f : A → B} → Coherentlyᴱ (↑ ℓ ∘ P) ((_∘ lower) ∘ step) f ≃ Coherentlyᴱ P step f Coherentlyᴱ-↑ {ℓ = ℓ} {P = P} {step = step} = Eq.↔→≃ to from (_↔_.from ≡↔≡ ∘ to-from) (_↔_.from ≡↔≡ ∘ from-to) where to : Coherentlyᴱ (↑ ℓ ∘ P) ((_∘ lower) ∘ step) f → Coherentlyᴱ P step f to c .property = lower (c .property) to c .coherent = to (c .coherent) from : Coherentlyᴱ P step f → Coherentlyᴱ (↑ ℓ ∘ P) ((_∘ lower) ∘ step) f from c .property = lift (c .property) from c .coherent = from (c .coherent) to-from : (c : Coherentlyᴱ P step f) → to (from c) P.≡ c to-from c i .property = c .property to-from c i .coherent = to-from (c .coherent) i from-to : (c : Coherentlyᴱ (↑ ℓ ∘ P) ((_∘ lower) ∘ step) f) → from (to c) P.≡ c from-to c i .property = c .property from-to c i .coherent = from-to (c .coherent) i -- A preservation lemma for Coherentlyᴱ. -- -- The two directions of this equivalence compute the property -- fields in certain ways, see the "unit tests" below. Coherentlyᴱ-cong : {A : Type a} {P₁ : {A : Type a} → (A → B) → Type p₁} {P₂ : {A : Type a} → (A → B) → Type p₂} {@0 step₁ : {A : Type a} (f : A → B) → P₁ f → ∥ A ∥¹ᴱ → B} {@0 step₂ : {A : Type a} (f : A → B) → P₂ f → ∥ A ∥¹ᴱ → B} {f : A → B} → @0 Univalence (p₁ ⊔ p₂) → (P₁≃P₂ : {A : Type a} (f : A → B) → P₁ f ≃ᴱ P₂ f) → @0 ({A : Type a} (f : A → B) (x : P₂ f) → step₁ f (_≃ᴱ_.from (P₁≃P₂ f) x) ≡ step₂ f x) → Coherentlyᴱ P₁ step₁ f ≃ᴱ Coherentlyᴱ P₂ step₂ f Coherentlyᴱ-cong {p₁ = p₁} {p₂ = p₂} {P₁ = P₁} {P₂ = P₂} {step₁ = step₁} {step₂ = step₂} {f = f} univ P₁≃P₂ step₁≡step₂ = Coherentlyᴱ P₁ step₁ f ↔⟨ inverse Coherentlyᴱ-↑ ⟩ Coherentlyᴱ (↑ p₂ ∘ P₁) ((_∘ lower) ∘ step₁) f ↝⟨ Coherentlyᴱ-cong-≃ᴱ univ (λ f → ↑ p₂ (P₁ f) ↔⟨ B.↑↔ ⟩ P₁ f ↝⟨ P₁≃P₂ f ⟩ P₂ f ↔⟨ inverse B.↑↔ ⟩□ ↑ p₁ (P₂ f) □) ((_∘ lower) ∘ step₁≡step₂) ⟩ Coherentlyᴱ (↑ p₁ ∘ P₂) ((_∘ lower) ∘ step₂) f ↔⟨ Coherentlyᴱ-↑ ⟩□ Coherentlyᴱ P₂ step₂ f □ -- Unit tests that ensure that Coherentlyᴱ-cong computes the property -- fields in certain ways. module _ {A : Type a} {P₁ : {A : Type a} → (A → B) → Type p₁} {P₂ : {A : Type a} → (A → B) → Type p₂} {@0 step₁ : {A : Type a} (f : A → B) → P₁ f → ∥ A ∥¹ᴱ → B} {@0 step₂ : {A : Type a} (f : A → B) → P₂ f → ∥ A ∥¹ᴱ → B} {f : A → B} {@0 univ : Univalence (p₁ ⊔ p₂)} {P₁≃P₂ : {A : Type a} (f : A → B) → P₁ f ≃ᴱ P₂ f} {@0 step₁≡step₂ : {A : Type a} (f : A → B) (x : P₂ f) → step₁ f (_≃ᴱ_.from (P₁≃P₂ f) x) ≡ step₂ f x} where _ : {c : Coherentlyᴱ P₁ step₁ f} → _≃ᴱ_.to (Coherentlyᴱ-cong univ P₁≃P₂ step₁≡step₂) c .property ≡ _≃ᴱ_.to (P₁≃P₂ f) (c .property) _ = refl _ _ : {c : Coherentlyᴱ P₂ step₂ f} → _≃ᴱ_.from (Coherentlyᴱ-cong {step₁ = step₁} univ P₁≃P₂ step₁≡step₂) c .property ≡ _≃ᴱ_.from (P₁≃P₂ f) (c .property) _ = refl _ -- A "computation rule". subst-Coherentlyᴱ-property : ∀ {B : Type b} {P : C → {A : Type a} → (A → B) → Type p} {@0 step : (c : C) {A : Type a} (f : A → B) → P c f → ∥ A ∥¹ᴱ → B} {f : C → A → B} {eq : x ≡ y} {c} → subst (λ x → Coherentlyᴱ (P x) (step x) (f x)) eq c .property ≡ subst (λ x → P x (f x)) eq (c .property) subst-Coherentlyᴱ-property {P = P} {step = step} {f = f} {eq = eq} {c = c} = elim¹ (λ eq → subst (λ x → Coherentlyᴱ (P x) (step x) (f x)) eq c .property ≡ subst (λ x → P x (f x)) eq (c .property)) (subst (λ x → Coherentlyᴱ (P x) (step x) (f x)) (refl _) c .property ≡⟨ cong property $ subst-refl _ _ ⟩ c .property ≡⟨ sym $ subst-refl _ _ ⟩∎ subst (λ x → P x (f x)) (refl _) (c .property) ∎) eq
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/g-shsh32.ads
JCGobbi/Nucleo-STM32G474RE
0
20052
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . S E C U R E _ H A S H E S . S H A 2 _ 3 2 -- -- -- -- S p e c -- -- -- -- Copyright (C) 2009-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 provides support for the 32-bit FIPS PUB 180-3 functions -- SHA-224 and SHA-256. -- This is an internal unit and should not be used directly in applications. -- Use GNAT.SHA224 and GNAT.SHA256 instead. with Interfaces; with GNAT.Byte_Swapping; with GNAT.Secure_Hashes.SHA2_Common; package GNAT.Secure_Hashes.SHA2_32 is subtype Word is Interfaces.Unsigned_32; package Hash_State is new Hash_Function_State (Word => Word, Swap => GNAT.Byte_Swapping.Swap4, Hash_Bit_Order => System.High_Order_First); -- SHA-224 and SHA-256 operate on 32-bit big endian words K : constant Hash_State.State (0 .. 63) := (16#428a2f98#, 16#71374491#, 16#b5c0fbcf#, 16#e9b5dba5#, 16#3956c25b#, 16#59f111f1#, 16#923f82a4#, 16#ab1c5ed5#, 16#d807aa98#, 16#12835b01#, 16#243185be#, 16#550c7dc3#, 16#72be5d74#, 16#80deb1fe#, 16#9bdc06a7#, 16#c19bf174#, 16#e49b69c1#, 16#efbe4786#, 16#0fc19dc6#, 16#240ca1cc#, 16#2de92c6f#, 16#4a7484aa#, 16#5cb0a9dc#, 16#76f988da#, 16#983e5152#, 16#a831c66d#, 16#b00327c8#, 16#bf597fc7#, 16#c6e00bf3#, 16#d5a79147#, 16#06ca6351#, 16#14292967#, 16#27b70a85#, 16#2e1b2138#, 16#4d2c6dfc#, 16#53380d13#, 16#650a7354#, 16#766a0abb#, 16#81c2c92e#, 16#92722c85#, 16#a2bfe8a1#, 16#a81a664b#, 16#c24b8b70#, 16#c76c51a3#, 16#d192e819#, 16#d6990624#, 16#f40e3585#, 16#106aa070#, 16#19a4c116#, 16#1e376c08#, 16#2748774c#, 16#34b0bcb5#, 16#391c0cb3#, 16#4ed8aa4a#, 16#5b9cca4f#, 16#682e6ff3#, 16#748f82ee#, 16#78a5636f#, 16#84c87814#, 16#8cc70208#, 16#90befffa#, 16#a4506ceb#, 16#bef9a3f7#, 16#c67178f2#); -- Constants from FIPS PUB 180-3 function Sigma0 (X : Word) return Word; function Sigma1 (X : Word) return Word; function S0 (X : Word) return Word; function S1 (X : Word) return Word; pragma Inline (Sigma0, Sigma1, S0, S1); -- Elementary functions Sigma^256_0, Sigma^256_1, sigma^256_0, sigma^256_1 -- from FIPS PUB 180-3. procedure Transform is new SHA2_Common.Transform (Hash_State => Hash_State, K => K, Rounds => 64, Sigma0 => Sigma0, Sigma1 => Sigma1, S0 => S0, S1 => S1); SHA224_Init_State : constant Hash_State.State (0 .. 7) := (0 => 16#c1059ed8#, 1 => 16#367cd507#, 2 => 16#3070dd17#, 3 => 16#f70e5939#, 4 => 16#ffc00b31#, 5 => 16#68581511#, 6 => 16#64f98fa7#, 7 => 16#befa4fa4#); SHA256_Init_State : constant Hash_State.State (0 .. 7) := (0 => 16#6a09e667#, 1 => 16#bb67ae85#, 2 => 16#3c6ef372#, 3 => 16#a54ff53a#, 4 => 16#510e527f#, 5 => 16#9b05688c#, 6 => 16#1f83d9ab#, 7 => 16#5be0cd19#); -- Initialization vectors from FIPS PUB 180-3 end GNAT.Secure_Hashes.SHA2_32;
src/timers/TimerFactory.asm
sharksym/vgmplay-sharksym
6
104013
; ; Timer factory ; ; Creates the highest-resolution timer suitable for the system. ; TimerFactory: MACRO lineTimer: dw 0 oplTimer: dw 0 vBlankTimer: VBlankTimer vBlankTimerFactory: StaticFactory vBlankTimer, VBlankTimer_Construct, VBlankTimer_Destruct turboRTimer: TurboRTimer turboRTimerFactory: StaticFactory turboRTimer, TurboRTimer_Construct, TurboRTimer_Destruct ENDM ; hl = callback ; ix = this ; ix <- timer ; f <- c: succeeded TimerFactory_Create: call TimerFactory_CreateTurboRTimer call nc,TimerFactory_CreateOPLTimer call nc,TimerFactory_CreateLineTimer call nc,TimerFactory_CreateVBlankTimer ret ; ix = this TimerFactory_Destroy: push ix call TimerFactory_DestroyVBlankTimer pop ix push ix call TimerFactory_DestroyLineTimer pop ix push ix call TimerFactory_DestroyOPLTimer pop ix push ix call TimerFactory_DestroyTurboRTimer pop ix ret ; hl = callback ; ix = this ; ix <- timer ; f <- c: succeeded TimerFactory_CreateVBlankTimer: ld de,TimerFactory.vBlankTimerFactory add ix,de jp StaticFactory_Create ; ix = this TimerFactory_DestroyVBlankTimer: ld de,TimerFactory.vBlankTimerFactory add ix,de jp StaticFactory_Destroy ; hl = callback ; ix = this ; ix <- timer ; f <- c: succeeded TimerFactory_CreateLineTimer: push hl call LineTimer_Detect pop hl ret nc ld a,(ix + TimerFactory.lineTimer) or (ix + TimerFactory.lineTimer + 1) ret nz push ix call LineTimer_class.New call LineTimer_Construct ld e,ixl ld d,ixh ex (sp),ix ld (ix + TimerFactory.lineTimer),e ld (ix + TimerFactory.lineTimer + 1),d pop ix scf ret ; ix = this TimerFactory_DestroyLineTimer: ld e,(ix + TimerFactory.lineTimer) ld d,(ix + TimerFactory.lineTimer + 1) ld a,e or d ret z ld (ix + TimerFactory.lineTimer),0 ld (ix + TimerFactory.lineTimer + 1),0 ld ixl,e ld ixh,d call LineTimer_Destruct call LineTimer_class.Delete and a ret ; hl = callback ; ix = this ; ix <- timer ; f <- c: succeeded TimerFactory_CreateOPLTimer: push hl call OPLTimer_Detect pop hl ret nc ld a,(ix + TimerFactory.oplTimer) or (ix + TimerFactory.oplTimer + 1) ret nz push ix call OPLTimer_class.New call OPLTimer_Construct ld e,ixl ld d,ixh ex (sp),ix ld (ix + TimerFactory.oplTimer),e ld (ix + TimerFactory.oplTimer + 1),d pop ix scf ret ; ix = this TimerFactory_DestroyOPLTimer: ld e,(ix + TimerFactory.oplTimer) ld d,(ix + TimerFactory.oplTimer + 1) ld a,e or d ret z ld (ix + TimerFactory.oplTimer),0 ld (ix + TimerFactory.oplTimer + 1),0 ld ixl,e ld ixh,d call OPLTimer_Destruct call OPLTimer_class.Delete and a ret ; hl = callback ; ix = this ; ix <- timer ; f <- c: succeeded TimerFactory_CreateTurboRTimer: push hl call TurboRTimer_Detect pop hl ret nc ld de,TimerFactory.turboRTimerFactory add ix,de jp StaticFactory_Create ; ix = this TimerFactory_DestroyTurboRTimer: ld de,TimerFactory.turboRTimerFactory add ix,de jp StaticFactory_Destroy
oeis/158/A158634.asm
neoneye/loda-programs
11
14262
<gh_stars>10-100 ; A158634: a(n) = 46*n^2 - 1. ; Submitted by <NAME> ; 45,183,413,735,1149,1655,2253,2943,3725,4599,5565,6623,7773,9015,10349,11775,13293,14903,16605,18399,20285,22263,24333,26495,28749,31095,33533,36063,38685,41399,44205,47103,50093,53175,56349,59615,62973,66423,69965,73599,77325,81143,85053,89055,93149,97335,101613,105983,110445,114999,119645,124383,129213,134135,139149,144255,149453,154743,160125,165599,171165,176823,182573,188415,194349,200375,206493,212703,219005,225399,231885,238463,245133,251895,258749,265695,272733,279863,287085,294399 add $0,1 pow $0,2 mul $0,46 sub $0,1
iAlloy-dataset-master/mutant_version_set/grandpa3/v1/grandpa3.als
jringert/alloy-diff
1
3192
<reponame>jringert/alloy-diff module language/grandpa3 //JOR//open util/integer [] as integer abstract sig Person { father: (lone Man), mother: (lone Woman) } sig Man extends Person { wife: (lone Woman) } sig Woman extends Person { husband: (lone Man) } pred ownGrandpa[p: Person] { (p in (grandpas[p])) } pred SocialConvention1[] { (no ((wife + husband) & (^(mother + father)))) } pred SocialConvention2[] { (let parent = (mother + father) { ((no m: (one Man) { ((some (m.wife)) && ((m.wife) in ((m.(*parent)).mother))) }) && (no w: (one Woman) { ((some (w.husband)) && ((w.husband) in ((w.(*parent)).father))) })) }) } fun grandpas[p: Person] : (set Person) { (let parent = (((mother + father) + (father.wife)) + (mother.husband)) { (((p.parent).parent) & Man) }) } fact Biology { (no p: (one Person) { (p in (p.(^(mother + father)))) }) } fact Terminology { (wife = (~husband)) } fact SocialConvention { (no ((wife + husband) & (^(mother + father)))) } assert NoSelfFather { (no m: (one Man) { (m = (m.father)) }) } assert Same { ((SocialConvention1[]) <=> (SocialConvention2[])) } run ownGrandpa for 40 run SocialConvention1 for 40 run SocialConvention2 for 40 check NoSelfFather for 40 check Same for 7
ada/test/sarge_test.adb
irieger/Sarge
0
5732
<filename>ada/test/sarge_test.adb -- sarge_test.adb - Implementation file for the Sarge command line argument parser test. -- Revision 0 -- Features: -- - -- Notes: -- - -- 2019/04/10, <NAME> with Sarge; with Ada.Text_IO; use Ada.Text_IO; procedure Sarge_test is begin -- Create Sarge instance, set stuff, parse stuff. Sarge.setArgument("h", "help", "Get help.", Boolean.False); Sarge.setArgument("k", "kittens", "K is for kittens. Everyone needs kittens in their life.", True); Sarge.setArgument("n", "number", "Gimme a number. Any number.", True); Sarge.setArgument("a", "apple", "Just an apple.", False); Sarge.setArgument("b", "bear", "Look, it's a bear.", False); Sarge.setDescription("Sarge command line argument parsing testing app. For demonstration purposes and testing."); Sarge.setUsage("sarge_test <options>"); if Sarge.parseArguments /= True then put_line("Couldn't parse arguments..."); return; end if; put_line("Number of flags found: " & Sarge.flagCount); if Sarge.exists("help") /= False then Sarge.printHelp; else put_line("No help requested..."); end if; -- end Sarge_test;
src/gen-model-packages.ads
jquorning/dynamo
15
16583
<gh_stars>10-100 ----------------------------------------------------------------------- -- gen-model-packages -- Packages holding model, query representation -- Copyright (C) 2009 - 2021 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Containers.Hashed_Maps; with Ada.Strings.Unbounded.Hash; with Util.Beans.Objects; with Util.Beans.Objects.Vectors; with Util.Strings.Sets; with Gen.Model.List; with Gen.Model.Mappings; limited with Gen.Model.Enums; limited with Gen.Model.Tables; limited with Gen.Model.Queries; limited with Gen.Model.Beans; limited with Gen.Model.Stypes; package Gen.Model.Packages is -- ------------------------------ -- Model Definition -- ------------------------------ -- The <b>Model_Definition</b> contains the complete model from one or -- several files. It maintains a list of Ada packages that must be generated. type Model_Definition is new Definition with private; type Model_Definition_Access is access all Model_Definition'Class; -- Validate the definition by checking and reporting problems to the logger interface. overriding procedure Validate (Def : in out Model_Definition; Log : in out Util.Log.Logging'Class); -- ------------------------------ -- Package Definition -- ------------------------------ -- The <b>Package_Definition</b> holds the tables, queries and other information -- that must be generated for a given Ada package. type Package_Definition is new Definition with private; type Package_Definition_Access is access all Package_Definition'Class; -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. overriding function Get_Value (From : in Package_Definition; Name : in String) return UBO.Object; -- Prepare the generation of the package: -- o identify the column types which are used -- o build a list of package for the with clauses. overriding procedure Prepare (O : in out Package_Definition); -- Validate the definition by checking and reporting problems to the logger interface. overriding procedure Validate (Def : in out Package_Definition; Log : in out Util.Log.Logging'Class); -- Initialize the package instance overriding procedure Initialize (O : in out Package_Definition); -- Find the type identified by the name. function Find_Type (From : in Package_Definition; Name : in UString) return Gen.Model.Mappings.Mapping_Definition_Access; -- Get the model which contains all the package definitions. function Get_Model (From : in Package_Definition) return Model_Definition_Access; -- Returns True if the package is a pre-defined package and must not be generated. function Is_Predefined (From : in Package_Definition) return Boolean; -- Set the package as a pre-defined package. procedure Set_Predefined (From : in out Package_Definition); -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. overriding function Get_Value (From : Model_Definition; Name : String) return UBO.Object; -- Initialize the model definition instance. overriding procedure Initialize (O : in out Model_Definition); -- Returns True if the model contains at least one package. function Has_Packages (O : in Model_Definition) return Boolean; -- Register or find the package knowing its name procedure Register_Package (O : in out Model_Definition; Name : in UString; Result : out Package_Definition_Access); -- Register the declaration of the given enum in the model. procedure Register_Enum (O : in out Model_Definition; Enum : access Gen.Model.Enums.Enum_Definition'Class); -- Register the declaration of the given data type in the model. procedure Register_Stype (O : in out Model_Definition; Stype : access Gen.Model.Stypes.Stype_Definition'Class); -- Register the declaration of the given table in the model. procedure Register_Table (O : in out Model_Definition; Table : access Gen.Model.Tables.Table_Definition'Class); -- Register the declaration of the given query in the model. procedure Register_Query (O : in out Model_Definition; Table : access Gen.Model.Queries.Query_File_Definition'Class); -- Register the declaration of the given bean in the model. procedure Register_Bean (O : in out Model_Definition; Bean : access Gen.Model.Beans.Bean_Definition'Class); -- Register a type mapping. The <b>From</b> type describes a type in the XML -- configuration files (hibernate, query, ...) and the <b>To</b> represents the -- corresponding Ada type. procedure Register_Type (O : in out Model_Definition; From : in String; To : in String); -- Find the type identified by the name. function Find_Type (From : in Model_Definition; Name : in UString) return Gen.Model.Mappings.Mapping_Definition_Access; -- Set the directory name associated with the model. This directory name allows to -- save and build a model in separate directories for the application, the unit tests -- and others. procedure Set_Dirname (O : in out Model_Definition; Target_Dir : in String; Model_Dir : in String); -- Get the directory name associated with the model. function Get_Dirname (O : in Model_Definition) return String; -- Get the directory name which contains the model. function Get_Model_Directory (O : in Model_Definition) return String; -- Enable the generation of the Ada package given by the name. By default all the Ada -- packages found in the model are generated. When called, this enables the generation -- only for the Ada packages registered here. procedure Enable_Package_Generation (Model : in out Model_Definition; Name : in String); -- Returns True if the generation is enabled for the given package name. function Is_Generation_Enabled (Model : in Model_Definition; Name : in String) return Boolean; -- Iterate over the model tables. procedure Iterate_Tables (Model : in Model_Definition; Process : not null access procedure (Item : in out Tables.Table_Definition)); -- Iterate over the model enums. procedure Iterate_Enums (Model : in Model_Definition; Process : not null access procedure (Item : in out Enums.Enum_Definition)); -- Prepare the generation of the package: -- o identify the column types which are used -- o build a list of package for the with clauses. overriding procedure Prepare (O : in out Model_Definition); package Package_Map is new Ada.Containers.Hashed_Maps (Key_Type => UString, Element_Type => Package_Definition_Access, Hash => Ada.Strings.Unbounded.Hash, Equivalent_Keys => "="); subtype Package_Cursor is Package_Map.Cursor; -- Get the first package of the model definition. function First (From : Model_Definition) return Package_Cursor; -- Returns true if the package cursor contains a valid package function Has_Element (Position : Package_Cursor) return Boolean renames Package_Map.Has_Element; -- Returns the package definition. function Element (Position : Package_Cursor) return Package_Definition_Access renames Package_Map.Element; -- Move the iterator to the next package definition. procedure Next (Position : in out Package_Cursor) renames Package_Map.Next; private package Table_List is new Gen.Model.List (T => Definition, T_Access => Definition_Access); -- Returns False if the <tt>Left</tt> table does not depend on <tt>Right</tt>. -- Returns True if the <tt>Left</tt> table depends on the <tt>Right</tt> table. function Dependency_Compare (Left, Right : in Definition_Access) return Boolean; -- Sort the tables on their dependency. procedure Dependency_Sort is new Table_List.Sort_On ("<" => Dependency_Compare); subtype Table_List_Definition is Table_List.List_Definition; subtype Enum_List_Definition is Table_List.List_Definition; subtype Types_List_Definition is Table_List.List_Definition; subtype Stype_List_Definition is Table_List.List_Definition; type List_Object is new Util.Beans.Basic.List_Bean with record Values : UBO.Vectors.Vector; Row : Natural; Value_Bean : UBO.Object; end record; -- Get the number of elements in the list. overriding function Get_Count (From : in List_Object) return Natural; -- Set the current row index. Valid row indexes start at 1. overriding procedure Set_Row_Index (From : in out List_Object; Index : in Natural); -- Get the element at the current row index. overriding function Get_Row (From : in List_Object) return UBO.Object; -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. overriding function Get_Value (From : in List_Object; Name : in String) return UBO.Object; type Package_Definition is new Definition with record -- Enums defined in the package. Enums : aliased Enum_List_Definition; Enums_Bean : UBO.Object; -- Simple data types defined in the package. Stypes : aliased Stype_List_Definition; Stypes_Bean : UBO.Object; -- Hibernate tables Tables : aliased Table_List_Definition; Tables_Bean : UBO.Object; -- Custom queries Queries : aliased Table_List_Definition; Queries_Bean : UBO.Object; -- Ada Beans Beans : aliased Table_List_Definition; Beans_Bean : UBO.Object; -- A list of external packages which are used (used for with clause generation). Used_Spec_Types : aliased List_Object; Used_Spec : UBO.Object; -- A list of external packages which are used (used for with clause generation). Used_Body_Types : aliased List_Object; Used_Body : UBO.Object; -- A map of all types defined in this package. Types : Gen.Model.Mappings.Mapping_Maps.Map; -- The base name for the package (ex: gen-model-users) Base_Name : UString; -- The global model (used to resolve types from other packages). Model : Model_Definition_Access; -- True if the package uses Ada.Calendar.Time Uses_Calendar_Time : Boolean := False; -- True if the package is a pre-defined package (ie, defined by a UML profile). Is_Predefined : Boolean := False; end record; type Model_Definition is new Definition with record -- List of all enums. Enums : aliased Enum_List_Definition; Enums_Bean : UBO.Object; -- Simple data types defined in the package. Stypes : aliased Stype_List_Definition; Stypes_Bean : UBO.Object; -- List of all tables. Tables : aliased Table_List_Definition; Tables_Bean : UBO.Object; -- List of all queries. Queries : aliased Table_List_Definition; Queries_Bean : UBO.Object; -- Ada Beans Beans : aliased Table_List_Definition; Beans_Bean : UBO.Object; -- Map of all packages. Packages : Package_Map.Map; -- Directory associated with the model ('src', 'samples', 'regtests', ...). Dir_Name : UString; -- Directory that contains the SQL and model files. DB_Name : UString; -- When not empty, a list of packages that must be taken into account for the generation. -- By default all packages and tables defined in the model are generated. Gen_Packages : Util.Strings.Sets.Set; end record; end Gen.Model.Packages;
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0.log_21829_1030.asm
ljhsiun2/medusa
9
18569
.global s_prepare_buffers s_prepare_buffers: push %r12 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x1b0cd, %rsi lea addresses_A_ht+0x1d549, %rdi nop nop nop nop nop sub %rbx, %rbx mov $15, %rcx rep movsl nop nop nop sub %r12, %r12 lea addresses_WC_ht+0x10735, %rdx nop nop nop nop inc %rbx mov (%rdx), %si sub %rbx, %rbx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r8 push %rax push %rcx push %rdi push %rsi // Store lea addresses_PSE+0x18cd, %rsi clflush (%rsi) nop nop nop nop and $35938, %r12 mov $0x5152535455565758, %rdi movq %rdi, %xmm4 movntdq %xmm4, (%rsi) nop nop nop nop nop add $28149, %rax // Faulty Load lea addresses_PSE+0xc0cd, %rsi nop nop nop nop nop cmp %rcx, %rcx mov (%rsi), %rdi lea oracles, %rsi and $0xff, %rdi shlq $12, %rdi mov (%rsi,%rdi,1), %rdi pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 11, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 16}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': True, 'size': 8}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}} {'src': {'NT': False, 'same': True, 'congruent': 3, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
oeis/198/A198855.asm
neoneye/loda-programs
11
247119
; A198855: a(n) = 7*8^n - 1. ; 6,55,447,3583,28671,229375,1835007,14680063,117440511,939524095,7516192767,60129542143,481036337151,3848290697215,30786325577727,246290604621823,1970324836974591,15762598695796735,126100789566373887,1008806316530991103,8070450532247928831,64563604257983430655,516508834063867445247,4132070672510939561983,33056565380087516495871,264452523040700131966975,2115620184325601055735807,16924961474604808445886463,135399691796838467567091711,1083197534374707740536733695,8665580274997661924293869567 mov $1,8 pow $1,$0 sub $1,1 mul $1,7 add $1,6 mov $0,$1
Transynther/x86/_processed/NONE/_zr_xt_/i7-7700_9_0x48.log_21829_1684.asm
ljhsiun2/medusa
9
23931
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r8 push %rax push %rcx push %rdi push %rsi lea addresses_UC_ht+0xfb76, %rsi lea addresses_UC_ht+0x61ff, %rdi add $50269, %r11 mov $16, %rcx rep movsb xor $40093, %rcx lea addresses_WT_ht+0x1ef76, %r8 nop nop nop nop nop sub $63791, %r14 movb (%r8), %r11b nop nop nop nop xor $7415, %r14 lea addresses_UC_ht+0x1ae76, %rsi lea addresses_WT_ht+0x132ae, %rdi nop sub $1536, %rax mov $48, %rcx rep movsq nop nop nop nop sub %rsi, %rsi pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r8 push %rax push %rcx push %rdi // Faulty Load lea addresses_WT+0x4176, %rdi nop nop add $2134, %r12 mov (%rdi), %r8 lea oracles, %rax and $0xff, %r8 shlq $12, %r8 mov (%rax,%r8,1), %r8 pop %rdi pop %rcx pop %rax pop %r8 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': True, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 8, 'size': 1, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': True}} {'39': 6726, '00': 15103} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
alloy4fun_models/trashltl/models/11/3m3PdmJi2FLGis6GL.als
Kaixi26/org.alloytools.alloy
0
2201
<reponame>Kaixi26/org.alloytools.alloy open main pred id3m3PdmJi2FLGis6GL_prop12 { all f : File | (always eventually f in Trash) implies (always eventually f not in Trash) } pred __repair { id3m3PdmJi2FLGis6GL_prop12 } check __repair { id3m3PdmJi2FLGis6GL_prop12 <=> prop12o }
test/Compiler/simple/VecReverse.agda
redfish64/autonomic-agda
0
13462
<reponame>redfish64/autonomic-agda module _ where open import Common.Prelude open import Lib.Vec _∘_ : ∀ {a b c} {A : Set a} {B : A → Set b} {C : ∀ x → B x → Set c} (f : ∀ {x} (y : B x) → C x y) (g : ∀ x → B x) → ∀ x → C x (g x) (f ∘ g) x = f (g x) sum : ∀ {n} → Vec Nat n → Nat sum (x ∷ xs) = x + sum xs sum [] = 0 foldl : ∀ {A}{B : Nat → Set} → (∀ {n} → B n → A → B (suc n)) → B 0 → ∀ {n} → Vec A n → B n foldl {B = B} f z (x ∷ xs) = foldl {B = λ n → B (suc n)} f (f z x) xs foldl f z [] = z reverse : ∀ {A n} → Vec A n → Vec A n reverse = foldl {B = Vec _} (λ xs x → x ∷ xs) [] downFrom : ∀ n → Vec Nat n downFrom zero = [] downFrom (suc n) = n ∷ downFrom n main : IO Unit main = printNat (sum (reverse (downFrom 6000)))
SDG/SDG.agda
wrrnhttn/agda-sdg
1
11881
<reponame>wrrnhttn/agda-sdg<filename>SDG/SDG.agda {-# OPTIONS --without-K #-} open import SDG.Extra.OrderedAlgebra module SDG.SDG {r₁ r₂} (R : OrderedCommutativeRing r₁ r₂) where open OrderedCommutativeRing R renaming (Carrier to Rc) open import Data.Product open import Data.Sum open import Algebra -- note: SDG should probably be a record if i need to -- use some particular topos model --nilsqr : {!!} nilsqr = λ x → (x * x) ≈ 0# nilsqr-0# : nilsqr 0# nilsqr-0# = zeroˡ 0# --D : {!!} D = Σ[ x ∈ Rc ] (nilsqr x) D→R : D → Rc D→R d = proj₁ d R→D : (x : Rc) → nilsqr x → D R→D x nilsqr = x , nilsqr d0 : D d0 = R→D 0# nilsqr-0# postulate kock-lawvere : ∀ (g : D → Rc) → ∃! _≈_ (λ b → ∀ (d : D) → ((g d) ≈ ((g d0) + (D→R d * b)))) -- these definitions are modified from previous development based on Bell: gₓ : ∀ (f : Rc → Rc) (x : Rc) → (D → Rc) gₓ f x d = f (x + D→R d) ∃!b : ∀ (f : Rc → Rc) (x : Rc) → ∃! _≈_ (λ b → ∀ (d : D) → ((gₓ f x d) ≈ ((gₓ f x d0) + (D→R d * b)))) ∃!b f x = kock-lawvere (gₓ f x) _′ : (f : Rc → Rc) → (Rc → Rc) (f ′) x = proj₁ (∃!b f x)
libsrc/_DEVELOPMENT/adt/b_array/z80/asm_b_array_insert_n.asm
jpoikela/z88dk
640
82145
<filename>libsrc/_DEVELOPMENT/adt/b_array/z80/asm_b_array_insert_n.asm ; =============================================================== ; Mar 2014 ; =============================================================== ; ; size_t b_array_insert_n(b_array_t *a, size_t idx, size_t n, int c) ; ; Insert n bytes before array.data[idx], fill that area with ; char c and return the index of the first char inserted. ; ; =============================================================== SECTION code_clib SECTION code_adt_b_array PUBLIC asm_b_array_insert_n EXTERN asm_b_array_insert_block, asm_memset, error_mc asm_b_array_insert_n: ; enter : hl = array * ; de = n ; bc = idx ; a = char c ; ; exit : success ; ; de = & array.data[idx] ; hl = idx of first char inserted ; carry reset ; ; fail ; ; hl = -1 ; carry set ; ; uses : af, bc, de, hl push bc ; save idx push af ; save char push de ; save n call asm_b_array_insert_block pop bc ; bc = n pop de ; d = char jp c, error_mc - 1 ld e,d ; e = char call asm_memset ; fill inserted block pop de ; de = idx ex de,hl ret
src/boot/boot_sector_32bit_mode.asm
Sage-of-Mirrors/gOS
1
5235
<filename>src/boot/boot_sector_32bit_mode.asm<gh_stars>1-10 ; Simple boot sector that prints "Hello!" to the screen. [org 0x7C00] mov bp, 0x9000 ; Put the stack above us in memory, at address 0x9000. mov sp, bp mov bx, REAL_MODE_MSG call print_string call print_newline call switch_to_pm jmp $ %include "print_util.asm" %include "gdt.asm" %include "print_util_pm.asm" %include "switch_to_pm.asm" [bits 32] BEGIN_PM: mov ebx, PROT_MODE_MSG call print_string_pm jmp $ REAL_MODE_MSG: db "Booted into 16-bit mode...", 0 PROT_MODE_MSG: db "Successfully switched to 32-bit protected mode!", 0 ; Padding/magic times 510-($-$$) db 0 dw 0xaa55
id5/id1728q.ada
hulpke/smallgrp
5
17914
<reponame>hulpke/smallgrp ############################################################################# ## #W id1728q.ada GAP library of id's <NAME> ## ID_GROUP_TREE.next[1728].next[443].next[105]:= rec( fp:= [ 479, 1197, 2177, 2390, 5114, 5777, 6422, 6628, 6723, 6793, 7115, 7388, 8116, 8243, 9040, 10061, 10377, 11067, 11293, 11628, 12542, 14829, 15419, 15778, 17250, 18438, 20740, 22748, 25106, 28477, 28893, 29796, 30543, 32110, 32918, 33586, 34694, 36166, 38005, 38018, 38436, 38790, 40262, 41239, 42614, 43378, 43774, 44405, 45619, 46362, 46785, 47029, 47492, 47881, 48388, 49134, 50502, 51324, 51639, 51851, 52407, 52746, 52878, 53116, 53584, 54405, 54994, 56004, 56067, 56229, 57878, 59456, 60091, 62298, 62392, 63419, 63720, 65231, 65673, 66780, 69544, 69619, 70753, 70778, 71246, 71498, 71542, 71991, 72685, 73478, 73775, 74196, 74260, 75332, 75695, 78314, 80129, 81447, 81647, 82838, 83173, 83859, 84455, 85634, 85644, 85749, 85827, 86567, 87282, 87932, 87952, 88040, 88648, 89074, 90035, 90096, 92118, 92438, 92751, 93387, 93670, 93858, 94063, 94189, 94494, 98721 ], next:= [ 37578, 37318, 34908, 34075, 35783, 37507, 34850, 37364, 34497, 34124, 34098, 37219, 35240, 34965, 34860, 34142, 37367, rec( desc:= [ 302026 ], fp:= [ 8600, 24392, 56120, 97401 ], next:= [ 37510, rec( desc:= [ 112003 ], fp:= [ 2, 12 ], next:= [ 35152, 34599 ] ), rec( desc:= [ 112003 ], fp:= [ 2, 12 ], next:= [ 35033, 37448 ] ), 35136 ] ), rec( desc:= [ 110003 ], fp:= [ 4, 14, 212 ], next:= [ 35155, 35151, 35154 ] ), 34958, 35976, 34959, 35032, 35670, 34687, 35738, 36450, rec( desc:= [ 125007 ], fp:= [ 8, 612 ], next:= [ 34125, 34146 ] ), 34983, 37416, 34910, 35140, 34152, rec( desc:= [ 108003 ], fp:= [ 2, 12 ], next:= [ 35138, 34688 ] ), rec( desc:= [ 120007 ], fp:= [ 4, 14 ], next:= [ 35740, 36162 ] ), 34940, 34854, 35719, 34520, rec( desc:= [ 118007 ], fp:= [ 2, 12 ], next:= [ 36229, 35788 ] ), 37308, 34917, rec( desc:= [ 113003 ], fp:= [ 4, 14, 212 ], next:= [ 35176, 35172, 35175 ] ), rec( desc:= [ 119007 ], fp:= [ 8, 612 ], next:= [ 35751, 35766 ] ), 34156, rec( desc:= [ 120007 ], fp:= [ 616, 814, 1012 ], next:= [ rec( desc:= [ 122007 ], fp:= [ 214, 412 ], next:= [ 35721, 36194 ] ), 36167, 35776 ] ), 34977, 36290, 36444, 34879, rec( desc:= [ 125007 ], fp:= [ 10, 614 ], next:= [ 34478, 34180 ] ), 34920, rec( desc:= [ 111003 ], fp:= [ 4, 212 ], next:= [ 34503, 34946 ] ), 37324, 34969, rec( desc:= [ 123007 ], fp:= [ 8, 612 ], next:= [ 34107, 34084 ] ), 37385, 35178, rec( desc:= [ 120007 ], fp:= [ 10, 614, 812 ], next:= [ 35791, 36152, 36181 ] ), 34942, 34904, 35711, rec( desc:= [ 121007 ], fp:= [ 18, 414 ], next:= [ 34341, 34331 ] ), 36447, rec( desc:= [ 125007 ], fp:= [ 8, 612 ], next:= [ 37419, 37479 ] ), 34111, 34256, 34936, 35726, 34080, rec( desc:= [ 110003 ], fp:= [ 4, 14 ], next:= [ 36221, 35181 ] ), 36170, 34100, 34141, 35011, 37563, 34282, 34560, 34154, 37481, rec( desc:= [ 123007 ], fp:= [ 8, 612 ], next:= [ 34121, 34473 ] ), 37330, 34944, 34938, 34104, 34109, 37374, 35754, 34966, 34149, rec( desc:= [ 108003 ], fp:= [ 2, 12 ], next:= [ 35150, 35815 ] ), 35008, rec( desc:= [ 110003 ], fp:= [ 4, 212 ], next:= [ 35120, 34269 ] ), 34921, 34333, 34114, 35035, rec( desc:= [ 125007 ], fp:= [ 2214, 2412 ], next:= [ 34077, 34102 ] ), 37218, 34595, 34494, 36387, 37315, 34469, 34527, 37184, 34882, 37327, 35745, 37459, 34157, rec( desc:= [ 302028 ], fp:= [ 723, 83541 ], next:= [ 34213, 34181 ] ), 37167, 37567, 34120, 34155, 35812, 34502, 35221, 34876, 34935, 35037, 37566, 36317, 37347, 36230 ] );
src/el-contexts-tls.adb
My-Colaborations/ada-el
0
20
----------------------------------------------------------------------- -- EL.Contexts.TLS -- EL context and Thread Local Support -- Copyright (C) 2015 <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. ----------------------------------------------------------------------- package body EL.Contexts.TLS is Context : EL.Contexts.ELContext_Access := null; pragma Thread_Local_Storage (Context); -- ------------------------------ -- Get the current EL context associated with the current thread. -- ------------------------------ function Current return EL.Contexts.ELContext_Access is begin return Context; end Current; -- ------------------------------ -- Initialize and setup a new per-thread EL context. -- ------------------------------ overriding procedure Initialize (Obj : in out TLS_Context) is begin Obj.Previous := Context; Context := Obj'Unchecked_Access; EL.Contexts.Default.Default_Context (Obj).Initialize; end Initialize; -- ------------------------------ -- Restore the previouse per-thread EL context. -- ------------------------------ overriding procedure Finalize (Obj : in out TLS_Context) is begin Context := Obj.Previous; EL.Contexts.Default.Default_Context (Obj).Finalize; end Finalize; end EL.Contexts.TLS;
Common/tests/arrayTest.asm
Martin-H1/6502
3
99293
; ----------------------------------------------------------------------------- ; Test for array functions under py65mon. ; <NAME> <<EMAIL>> ; ----------------------------------------------------------------------------- .word $8000 .org $8000 .outfile "tests/arrayTest.rom" .alias RamSize $7EFF ; default $8000 for 32 kb x 8 bit RAM .alias heap_base $0400 ; The heap starts on page 4. .alias heap_size $4000 ; It's size is 16 KB. .require "../data.asm" .advance $c000 .require "../array.asm" .require "../conio.asm" .require "../heap.asm" .require "../math16.asm" .require "../print.asm" .require "../stack.asm" .require "../string.asm" .require "mockConio.asm" ; Main entry point for the test main: ldx #SP0 ; Reset stack pointer `pushzero jsr mockConIOInit `pushi heap_size `pushi heap_base jsr hinit jsr alloc_test jsr append_test jsr getat_test jsr setat_test jsr delat_test jsr findFirst_test jsr findLast_test jsr hfree ; dealloc array. jsr oneItem_test brk .scope _name: .byte "*** alloc test ***",0 alloc_test: `println _name `pushi $05 jsr arrayAlloc `dup jsr arrayPrint rts .scend .scope _name: .byte "*** append test ***",0 append_test: `println _name `pushi $dead jsr arrayAppend ; Append returns the array pointer! `dup jsr arrayPrint `pushTrue jsr arrayAppend `dup jsr arrayPrint `pushzero jsr arrayAppend ; keep appending to force realloc `pushzero jsr arrayAppend `pushzero jsr arrayAppend `pushzero jsr arrayAppend `dup jsr arrayPrint rts .scend .scope _name: .byte "*** getAt test ***",0 _msg1: .byte "item at ",0 _msg2: .byte " = ",0 getat_test: `println _name `dup `pushi 1 `print _msg1 jsr printtos jsr arrayGetAt `print _msg2 jsr printtosln `drop `dup `pushi 0 `print _msg1 jsr printtos jsr arrayGetAt `print _msg2 jsr printtosln `drop rts .scend .scope _name: .byte "*** setAt test ***",0 _msg1: .byte "item at ",0 _msg2: .byte " = ",0 setat_test: `println _name `pushi $05 * `over `over `dup jsr arraySetAt `dectos `toszero? bne - `drop `dup jsr arrayPrint rts .scend .scope _name: .byte "*** delAt test ***",0 _msg1: .byte "item at ",0 _msg2: .byte " = ",0 delat_test: `println _name `dup `pushi 1 jsr arrayDeleteAt `dup jsr arrayPrint rts .scend .scope _name: .byte "*** findFirst test ***",0 _msg1: .byte "Found 1 at ",0 _msg2: .byte "Found 2 at ",0 _msg3: .byte "Found dead at ",0 findFirst_test: `println _name `pushi 2 jsr arrayAppend `dup jsr arrayPrint `dup `pushi 01 jsr arrayFindFirst `print _msg1 jsr printTosln `drop `dup `pushi 02 jsr arrayFindFirst `print _msg2 jsr printTosln `drop `dup `pushi $dead jsr arrayFindFirst `print _msg3 jsr printTosln `drop rts .scend .scope _name: .byte "*** findLast test ***",0 _msg1: .byte "Found 1 at ",0 _msg2: .byte "Found 2 at ",0 _msg3: .byte "Found dead at ",0 findLast_test: `println _name `dup jsr arrayPrint `dup `pushi 01 jsr arrayFindLast `print _msg1 jsr printTosln `drop `dup `pushi 02 jsr arrayFindLast `print _msg2 jsr printTosln `drop `dup `pushi $dead jsr arrayFindFirst `print _msg3 jsr printTosln `drop rts .scend .scope _name: .byte "*** oneItem test ***",0 _msg1: .byte "Found 1 at ",0 _msg2: .byte "Found 2 at ",0 _msg3: .byte "Found $DEAD at ",0 oneItem_test: `println _name `pushi $05 jsr arrayAlloc `pushi $dead jsr arrayAppend `dup jsr arrayPrint `dup `pushi 01 jsr arrayFindLast `print _msg1 jsr printTosln `drop `dup `pushi $dead jsr arrayFindLast `print _msg3 jsr printTosln `drop rts .scend .require "../vectors.asm"
libsrc/games/vg5k/joystick.asm
RC2014Z80/z88dk
8
88237
; ; Generic game device library - VG-5000 port ; <NAME> - 2014 ; ; $Id: joystick.asm,v 1.3 2016-06-16 19:33:59 dom Exp $ ; SECTION code_clib PUBLIC joystick PUBLIC _joystick EXTERN getk .joystick ._joystick ;__FASTALL__ : joystick no. in HL ;ld a,l call getk ld a,l ld l,0 cp ' ' jr nz,no_fire1_a set 4,l jr j_done .no_fire1_a cp '1' jr nz,no_fire2_a set 5,l jr j_done .no_fire2_a cp 9 jr nz,no_up_a set 3,l jr j_done .no_up_a cp 10 jr nz,no_down_a set 2,l jr j_done .no_down_a cp 8 jr nz,no_left_a set 1,l jr j_done .no_left_a cp 7 jr nz,no_right_a set 0,l .no_right_a .j_done ret
unicode-utf8_stream_decoder.adb
annexi-strayline/ASAP-Unicode
1
21218
<reponame>annexi-strayline/ASAP-Unicode ------------------------------------------------------------------------------ -- -- -- Unicode Utilities -- -- UTF-8 Stream Decoder -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2019, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * <NAME> (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Characters.Conversions; with Unicode.UTF8_Stream_Decoder.Codec; package body Unicode.UTF8_Stream_Decoder is -- -- Stream Decoders -- ----------------- -- Decode_Next -- (Wide_Wide_Character) ----------------- function Decode_Next (UTF8_Stream : not null access Root_Stream_Type'Class) return Wide_Wide_Character is use Codec; Buffer: Sequence_Array (1 .. 4) := (others => 0); Last, Continuation: Stream_Element_Offset; Status: Decode_Status; begin return Result: Wide_Wide_Character do -- Load next octet (hoping for a valid starting octet) Stream_Element'Read (UTF8_Stream, Buffer(1)); -- Phase 1, check for sync and then mult-byte sequence Try_Decode (Sequence => Buffer(1 .. 1), Last => Last, Continuation_Bytes => Continuation, Result => Result, Status => Status); -- See if we have an indicated multi-byte condition if Status = Short_Load then -- Load the expected number of octets and re-run declare -- The (verified) postcondition of Try_Decode promises that -- Continuation will be 1 .. 3. Therefore we know that the -- above range will never be larger than 2 .. 3 + 1 = 4 pragma Suppress (Index_Check); pragma Suppress (Length_Check); pragma Suppress (Overflow_Check); pragma Suppress (Range_Check); -- 2 .. 2, 2 .. 3, 2 .. 4 - all ok -- Also note that the components of Sequence_Array is -- a modular type - and therefore Overflow_Check and -- Range_Check do not apply to those (the return values) -- anyways. begin Sequence_Array'Read (UTF8_Stream, Buffer(2 .. Continuation + 1)); end; -- Run Try_Decode again for the final Result Try_Decode (Sequence => Buffer(1 .. Continuation + 1), Last => Last, Continuation_Bytes => Continuation, Result => Result, Status => Status); end if; -- Note that the postcondition of Try_Decode promises that if Status -- is not "Success", then Result will always be -- Unicode_Replacement_Character end return; end Decode_Next; ----------------- -- Decode_Next -- (Wide_Character) ----------------- function Decode_Next (UTF8_Stream : not null access Root_Stream_Type'Class) return Wide_Character is use Ada.Characters.Conversions; Full_Char: Wide_Wide_Character := Decode_Next (UTF8_Stream); begin if not Is_Wide_Character (Full_Char) then raise Insufficient_Width with "Encoded character is not within the range of Wide_Character"; else return To_Wide_Character (Full_Char); end if; end Decode_Next; ----------------- -- Decode_Next -- (Character) ----------------- function Decode_Next (UTF8_Stream : not null access Root_Stream_Type'Class) return Character is use Ada.Characters.Conversions; Full_Char: Wide_Wide_Character := Decode_Next (UTF8_Stream); begin if not Is_Character (Full_Char) then raise Insufficient_Width with "Encoded character is not within the range of Character"; else return To_Character (Full_Char); end if; end Decode_Next; -- Buffer Decoders --------------------------------------------------------- ----------------- -- Decode_Next -- (Wide_Wide_Character) ----------------- procedure Decode_Next (Buffer : in Stream_Element_Array; Last : out Stream_Element_Offset; Result : out Wide_Wide_Character) is use Codec; Start : Stream_Element_Offset := Buffer'First; Continuation: Stream_Element_Offset; Status : Decode_Status; Sequence_Last: Sequence_Index; begin if Buffer'Length = 0 then raise Short_Buffer with "Buffer is empty."; end if; Last := Buffer'First; -- Phase 1, check for sync and then mult-byte sequence Try_Decode (Sequence => Sequence_Array'(1 => Buffer(Buffer'First)), Last => Sequence_Last, Continuation_Bytes => Continuation, Result => Result, Status => Status); -- See if we have an indicated multi-byte condition if Status = Short_Load then -- Check that we can actually provide the required number of -- continuation bytes. if Buffer'First + Continuation > Buffer'Last then raise Short_Buffer; end if; -- Re-run with the Load the expected number of octets declare -- The (verified) postcondition of Try_Decode promises that -- Continuation will be 1 .. 3. Therefore we know that the -- above range will never be larger than 2 .. 3 + 1 = 4 pragma Suppress (Index_Check); pragma Suppress (Length_Check); pragma Suppress (Overflow_Check); pragma Suppress (Range_Check); -- 2 .. 2, 2 .. 3, 2 .. 4 - all ok -- Also note that the components of Sequence_Array is -- a modular type - and therefore Overflow_Check and -- Range_Check do not apply to those (the return values) -- anyways. Sequence: constant Sequence_Array(1 .. 1 + Continuation) := Sequence_Array (Buffer(Buffer'First .. Buffer'First + Continuation)); -- 1 + Continuation must be: 2, 3, 4 -- Buffer'First + Continuation must be <= Buffer'Last, due -- to the if statement above begin -- Run Try_Decode again for the final Result Try_Decode (Sequence => Sequence, Last => Sequence_Last, Continuation_Bytes => Continuation, Result => Result, Status => Status); end; end if; Last := Buffer'First + Continuation; if Status /= Success then Result := Unicode_Replacement_Character; end if; end Decode_Next; ----------------- -- Decode_Next -- (Wide_Character) ----------------- procedure Decode_Next (Buffer : in Stream_Element_Array; Last : out Stream_Element_Offset; Result : out Wide_Character) is use Ada.Characters.Conversions; Full_Char: Wide_Wide_Character; Temp_Last: Stream_Element_Offset; begin Decode_Next (Buffer => Buffer, Last => Temp_Last, Result => Full_Char); if not Is_Wide_Character (Full_Char) then raise Insufficient_Width with "Encoded character is not within the range of Wide_Character"; else Result := To_Wide_Character (Full_Char); Last := Temp_Last; end if; end Decode_Next; ----------------- -- Decode_Next -- (Character) ----------------- procedure Decode_Next (Buffer : in Stream_Element_Array; Last : out Stream_Element_Offset; Result : out Character) is use Ada.Characters.Conversions; Full_Char: Wide_Wide_Character; Temp_Last: Stream_Element_Offset; begin Decode_Next (Buffer => Buffer, Last => Temp_Last, Result => Full_Char); if not Is_Character (Full_Char) then raise Insufficient_Width with "Encoded character is not within the range of Character"; else Result := To_Character (Full_Char); Last := Temp_Last; end if; end Decode_Next; end Unicode.UTF8_Stream_Decoder;
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_6957_1454.asm
ljhsiun2/medusa
9
4432
<filename>Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_6957_1454.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r9 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x1bf81, %rsi lea addresses_UC_ht+0xb1e6, %rdi nop nop nop inc %r12 mov $38, %rcx rep movsb nop nop nop cmp %r10, %r10 lea addresses_WC_ht+0x1561c, %rcx nop nop nop dec %rdi movb (%rcx), %r10b nop nop nop nop and %rcx, %rcx lea addresses_WT_ht+0x173a9, %rax nop nop nop nop nop sub %rdx, %rdx mov $0x6162636465666768, %rsi movq %rsi, %xmm7 vmovups %ymm7, (%rax) nop inc %r10 lea addresses_normal_ht+0x14d29, %rdx nop nop sub $36764, %rax mov (%rdx), %r10d nop nop nop nop nop and %r12, %r12 lea addresses_WC_ht+0x7aa9, %r12 nop cmp $43625, %rcx vmovups (%r12), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %rdx nop nop nop cmp $3938, %rax lea addresses_WT_ht+0xcca9, %rsi lea addresses_UC_ht+0x4529, %rdi clflush (%rsi) xor $30238, %r9 mov $108, %rcx rep movsq sub %r10, %r10 lea addresses_normal_ht+0x25d9, %rax nop dec %rdx movw $0x6162, (%rax) nop nop nop nop nop xor %r10, %r10 lea addresses_WT_ht+0x2cc1, %rsi lea addresses_normal_ht+0x19845, %rdi nop nop inc %rax mov $109, %rcx rep movsq nop nop and %rsi, %rsi lea addresses_WT_ht+0x5029, %rcx nop inc %rsi mov $0x6162636465666768, %r12 movq %r12, %xmm6 movups %xmm6, (%rcx) nop xor $45496, %r10 lea addresses_A_ht+0x19609, %rcx nop nop cmp %r10, %r10 movl $0x61626364, (%rcx) sub %r9, %r9 lea addresses_WT_ht+0x184a9, %rdi clflush (%rdi) nop nop nop xor $38446, %rcx mov $0x6162636465666768, %rdx movq %rdx, %xmm5 movups %xmm5, (%rdi) nop nop nop nop dec %rsi lea addresses_normal_ht+0x1a0a9, %rsi lea addresses_UC_ht+0x1b0e9, %rdi nop xor %r9, %r9 mov $13, %rcx rep movsw nop nop nop add %rcx, %rcx lea addresses_A_ht+0x10329, %rsi lea addresses_UC_ht+0x13fd9, %rdi nop nop nop nop nop and $48989, %r10 mov $23, %rcx rep movsw nop sub $4128, %rax lea addresses_normal_ht+0x1c6a9, %rsi nop add %rcx, %rcx movb $0x61, (%rsi) nop dec %r10 lea addresses_UC_ht+0x140a9, %rsi nop nop mfence movl $0x61626364, (%rsi) nop add $6248, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r9 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r14 push %r8 push %rbx push %rdi push %rdx // Store lea addresses_D+0x1c6a9, %r14 nop nop inc %rdx mov $0x5152535455565758, %r12 movq %r12, %xmm5 vmovups %ymm5, (%r14) nop nop nop sub $63527, %r8 // Store mov $0x7f094b0000000ea9, %r10 clflush (%r10) nop and %r12, %r12 mov $0x5152535455565758, %rdx movq %rdx, %xmm7 movups %xmm7, (%r10) nop inc %r8 // Store lea addresses_WT+0x121a9, %r12 nop nop nop nop xor %rdi, %rdi movw $0x5152, (%r12) cmp $48196, %r14 // Faulty Load lea addresses_A+0x11ca9, %rdi nop nop nop sub %r8, %r8 movb (%rdi), %r14b lea oracles, %rdi and $0xff, %r14 shlq $12, %r14 mov (%rdi,%r14,1), %r14 pop %rdx pop %rdi pop %rbx pop %r8 pop %r14 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 8, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': True, 'NT': True, 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'00': 6957} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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/294/A294774.asm
karttu/loda
1
7867
<reponame>karttu/loda<gh_stars>1-10 ; A294774: a(n) = 2*n^2 + 2*n + 5. ; 5,9,17,29,45,65,89,117,149,185,225,269,317,369,425,485,549,617,689,765,845,929,1017,1109,1205,1305,1409,1517,1629,1745,1865,1989,2117,2249,2385,2525,2669,2817,2969,3125,3285,3449,3617,3789,3965,4145,4329,4517,4709,4905,5105,5309,5517,5729,5945,6165,6389,6617,6849,7085,7325,7569,7817,8069,8325,8585,8849,9117,9389,9665,9945,10229,10517,10809,11105,11405,11709,12017,12329,12645,12965,13289,13617,13949,14285,14625,14969,15317,15669,16025,16385,16749,17117,17489,17865,18245,18629,19017,19409,19805,20205,20609,21017,21429,21845,22265,22689,23117,23549,23985,24425,24869,25317,25769,26225,26685,27149,27617,28089,28565,29045,29529,30017,30509,31005,31505,32009,32517,33029,33545,34065,34589,35117,35649,36185,36725,37269,37817,38369,38925,39485,40049,40617,41189,41765,42345,42929,43517,44109,44705,45305,45909,46517,47129,47745,48365,48989,49617,50249,50885,51525,52169,52817,53469,54125,54785,55449,56117,56789,57465,58145,58829,59517,60209,60905,61605,62309,63017,63729,64445,65165,65889,66617,67349,68085,68825,69569,70317,71069,71825,72585,73349,74117,74889,75665,76445,77229,78017,78809,79605,80405,81209,82017,82829,83645,84465,85289,86117,86949,87785,88625,89469,90317,91169,92025,92885,93749,94617,95489,96365,97245,98129,99017,99909,100805,101705,102609,103517,104429,105345,106265,107189,108117,109049,109985,110925,111869,112817,113769,114725,115685,116649,117617,118589,119565,120545,121529,122517,123509,124505 sub $1,$0 bin $1,2 mul $1,4 add $1,5