max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
oeis/202/A202900.asm
neoneye/loda-programs
11
93754
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A202900: Number of n X 2 0..1 arrays with every one equal to some NW, E or S neighbor. ; Submitted by <NAME> ; 1,4,14,40,116,344,1016,2992,8816,25984,76576,225664,665024,1959808,5775488,17020160,50157824,147813376,435600896,1283700736,3783021568,11148433408,32854046720,96819736576,285324406784,840841134080,2477929668608,7302372818944,21519839510528,63418220904448,186891298177024,550762175856640,1623077036294144,4783151750840320,14095782368903168,41539781914001408,122416297038577664,360756582970556416,1063137141908307968,3133028296249311232,9232925761091928064,27209112095121473536,80184309953482194944 mul $0,2 seq $0,164402 ; Number of binary strings of length n with no substrings equal to 0010 or 0110.
PRG/maps/World3O.asm
narfman0/smb3_pp1
0
104324
.byte MAPOBJ_HELP, MAPOBJ_EMPTY, MAPOBJ_HAMMERBRO, MAPOBJ_HAMMERBRO, MAPOBJ_CANOE, MAPOBJ_EMPTY, MAPOBJ_EMPTY, MAPOBJ_EMPTY, MAPOBJ_EMPTY
oeis/019/A019485.asm
neoneye/loda-programs
11
241006
<filename>oeis/019/A019485.asm ; A019485: a(n) = 2*a(n-1) + 2*a(n-2) - 3*a(n-3). ; Submitted by <NAME> ; 2,5,12,28,65,150,346,797,1836,4228,9737,22422,51634,118901,273804,630508,1451921,3343446,7699210,17729549,40827180,94015828,216497369,498544854,1148036962,2643671525,6087782412,14018796988 mov $2,3 mov $4,3 lpb $0 sub $0,1 mov $1,$2 add $1,$2 mov $3,$2 mov $2,$4 add $2,4 add $4,$3 add $4,$1 lpe mov $0,$4 div $0,3 add $0,1
Documentation/Delphi 7/php4delphid7.als
KashaketCompany/php4delphi
4
405
<gh_stars>1-10 tcustomphplibrary_functions tcustomphplibrary_libraryname tcustomphplibrary_locked tcustomphplibrary_object tcustomphplibrary_refresh tdispatchobject_object tdispatchobject_proc tfunctionparam_name tfunctionparam_object tfunctionparam_paramtype tfunctionparam_value tfunctionparam_zendvalue tfunctionparam_zendvariable tfunctionparams_add tfunctionparams_items tfunctionparams_object tfunctionparams_parambyname tfunctionparams_values tphpcomponent_about tphpcomponent_object tphpconstant_name tphpconstant_object tphpconstant_value tphpconstants_add tphpconstants_indexof tphpconstants_items tphpconstants_object tphpengine_constantcount tphpengine_constants tphpengine_dllfolder tphpengine_engineactive tphpengine_handleerrors tphpengine_htmlerrors tphpengine_inipath tphpengine_lockengine tphpengine_maxinputtime tphpengine_object tphpengine_onengineshutdown tphpengine_onenginestartup tphpengine_onlogmessage tphpengine_onscripterror tphpengine_prepareforshutdown tphpengine_registerglobals tphpengine_reportdllerror tphpengine_requestlist tphpengine_safemode tphpengine_safemodegid tphpengine_shutdownandwaitfor tphpengine_shutdownengine tphpengine_startupengine tphpengine_unlockengine tphpengine_waitforshutdown tphpfunctions_add tphpfunctions_functionbyname tphpfunctions_object tphpheader_header tphpheader_object tphpheaders_add tphpheaders_getheaders tphpheaders_items tphpheaders_object tphplibrarian_addlibrary tphplibrarian_count tphplibrarian_getlibrary tphplibrarian_libraries tphplibrarian_object tphplibrarian_removelibrary tphplibrary_functions tphplibrary_libraryname tphplibrary_object tphpsimplelibrary_object tphpsimplelibrary_registermethod tphpvariable_asboolean tphpvariable_asfloat tphpvariable_asinteger tphpvariable_asstring tphpvariable_name tphpvariable_object tphpvariable_value tphpvariables_add tphpvariables_addrawstring tphpvariables_byname tphpvariables_getvariables tphpvariables_object tpsvcustomphp_afterexecute tpsvcustomphp_beforeexecute tpsvcustomphp_contenttype tpsvcustomphp_engineactive tpsvcustomphp_execute tpsvcustomphp_executemethod tpsvcustomphp_filename tpsvcustomphp_headers tpsvcustomphp_maxexecutiontime tpsvcustomphp_object tpsvcustomphp_onreadpost tpsvcustomphp_onreadresult tpsvcustomphp_onrequestshutdown tpsvcustomphp_onrequeststartup tpsvcustomphp_poststream tpsvcustomphp_requesttype tpsvcustomphp_resultbuffer tpsvcustomphp_runcode tpsvcustomphp_sessionactive tpsvcustomphp_threadsaferesourcemanager tpsvcustomphp_usedelimiters tpsvcustomphp_variablebyname tpsvcustomphp_variablecount tpsvcustomphp_variables tpsvcustomphp_virtualcode tpsvphp_about tpsvphp_afterexecute tpsvphp_beforeexecute tpsvphp_contenttype tpsvphp_filename tpsvphp_maxexecutiontime tpsvphp_object tpsvphp_onreadpost tpsvphp_onreadresult tpsvphp_onrequestshutdown tpsvphp_onrequeststartup tpsvphp_requesttype tpsvphp_usedelimiters tpsvphp_variables tzendvariable_asboolean tzendvariable_asdate tzendvariable_asdatetime tzendvariable_asfloat tzendvariable_asinteger tzendvariable_asstring tzendvariable_astime tzendvariable_asvariant tzendvariable_aszendvariable tzendvariable_datatype tzendvariable_isnull tzendvariable_object tzendvariable_typename tzendvariable_unassign
WIP/demo.applescript
Rolias/applescripts
1
482
tell application "System Preferences" activate set the current pane to pane "com.apple.preference.displays" end tell tell application "System Events" tell process "System Preferences" set frontmost to true tell tab group 1 of window 1 click radio button "Display" click radio button "Scaled" end tell end tell end tell
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48_notsx.log_21829_1632.asm
ljhsiun2/medusa
9
18233
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %rdi push %rdx lea addresses_A_ht+0x20d8, %r12 cmp $18217, %r13 and $0xffffffffffffffc0, %r12 vmovaps (%r12), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $0, %xmm7, %rdi nop nop xor %rdx, %rdx pop %rdx pop %rdi pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r8 push %r9 push %rbp push %rcx push %rdi push %rsi // Store lea addresses_UC+0x2638, %r12 nop dec %rcx movl $0x51525354, (%r12) nop nop nop nop nop add $15893, %r8 // REPMOV lea addresses_UC+0x138d8, %rsi lea addresses_PSE+0xf0d8, %rdi nop nop nop nop nop add %r8, %r8 mov $57, %rcx rep movsb nop nop nop nop sub %rcx, %rcx // Store lea addresses_PSE+0x11208, %r9 nop nop sub %r12, %r12 movw $0x5152, (%r9) nop nop nop nop nop dec %rsi // Store lea addresses_WT+0x1b6d8, %rdi nop nop nop nop nop sub $29032, %rsi mov $0x5152535455565758, %r13 movq %r13, %xmm0 vmovups %ymm0, (%rdi) nop inc %r13 // Load lea addresses_RW+0x190d8, %rdi clflush (%rdi) nop lfence mov (%rdi), %r8w nop nop nop xor $19803, %rbp // Store lea addresses_UC+0xd58, %r8 nop add %r9, %r9 mov $0x5152535455565758, %rcx movq %rcx, (%r8) cmp $18991, %rbp // Load mov $0x7adc6400000008d8, %r12 nop sub $63492, %r8 mov (%r12), %rdi nop dec %rsi // Load mov $0x32e7c30000000cd8, %rsi clflush (%rsi) nop xor %rdi, %rdi movaps (%rsi), %xmm2 vpextrq $1, %xmm2, %rbp dec %rbp // Store mov $0x42539b00000000b8, %r9 nop nop nop nop and %rbp, %rbp movb $0x51, (%r9) nop nop nop nop xor $41229, %r9 // Faulty Load mov $0x7adc6400000008d8, %r8 xor $9306, %r9 mov (%r8), %r13 lea oracles, %rdi and $0xff, %r13 shlq $12, %r13 mov (%rdi,%r13,1), %r13 pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_NC', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC', 'congruent': 5}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 10, 'type': 'addresses_PSE'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_UC'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_PSE', 'congruent': 4}, 'OP': 'STOR'} {'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT', 'congruent': 7}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_RW', 'congruent': 9}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC', 'congruent': 7}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': True, 'size': 8, 'type': 'addresses_NC', 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_NC', 'congruent': 10}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_NC', 'congruent': 4}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_NC', 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 11}} {'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 */
src/Web/Semantic/DL/Category/Properties/Composition/RespectsEquiv.agda
agda/agda-web-semantic
9
6050
open import Web.Semantic.DL.ABox.Interp using ( _*_ ) open import Web.Semantic.DL.Category.Object using ( Object ) open import Web.Semantic.DL.Category.Morphism using ( _⇒_ ; _≣_ ; _⊑_ ; _,_ ) open import Web.Semantic.DL.Category.Composition using ( _∙_ ) open import Web.Semantic.DL.Category.Properties.Composition.Lemmas using ( compose-left ; compose-mid ; compose-right ; compose-resp-⊨b ) open import Web.Semantic.DL.Signature using ( Signature ) open import Web.Semantic.DL.TBox using ( TBox ) open import Web.Semantic.Util using ( left ; right ) module Web.Semantic.DL.Category.Properties.Composition.RespectsEquiv {Σ : Signature} {S T : TBox Σ} where compose-resp-⊑ : ∀ {A B C : Object S T} (F₁ F₂ : A ⇒ B) (G₁ G₂ : B ⇒ C) → (F₁ ⊑ F₂) → (G₁ ⊑ G₂) → (F₁ ∙ G₁ ⊑ F₂ ∙ G₂) compose-resp-⊑ F₁ F₂ G₁ G₂ F₁⊑F₂ G₁⊑G₂ I I⊨STA I⊨F₁⟫G₁ = compose-resp-⊨b F₂ G₂ I (F₁⊑F₂ (left * I) I⊨STA (compose-left F₁ G₁ I I⊨F₁⟫G₁)) (G₁⊑G₂ (right * I) (compose-mid F₁ G₁ I I⊨STA I⊨F₁⟫G₁) (compose-right F₁ G₁ I I⊨F₁⟫G₁)) compose-resp-≣ : ∀ {A B C : Object S T} {F₁ F₂ : A ⇒ B} {G₁ G₂ : B ⇒ C} → (F₁ ≣ F₂) → (G₁ ≣ G₂) → (F₁ ∙ G₁ ≣ F₂ ∙ G₂) compose-resp-≣ {A} {B} {C} {F₁} {F₂} {G₁} {G₂} (F₁⊑F₂ , F₂⊑F₁) (G₁⊑G₂ , G₂⊑G₁) = ( compose-resp-⊑ F₁ F₂ G₁ G₂ F₁⊑F₂ G₁⊑G₂ , compose-resp-⊑ F₂ F₁ G₂ G₁ F₂⊑F₁ G₂⊑G₁ )
src/hmac.ads
AntonMeep/hmac
0
22275
<filename>src/hmac.ads with Ada.Streams; use Ada.Streams; with SHA1; with SHA2; with HMAC_Generic; package HMAC with Pure, Preelaborate is package HMAC_SHA_1 is new HMAC_Generic (Element => Stream_Element, Index => Stream_Element_Offset, Element_Array => Stream_Element_Array, Digest_Length => SHA1.Digest_Length, Block_Length => SHA1.Block_Length, Hash_Context => SHA1.Context, Hash_Initialize => SHA1.Initialize, Hash_Update => SHA1.Update, Hash_Finalize => SHA1.Finalize); package HMAC_SHA_224 is new HMAC_Generic (Element => Stream_Element, Index => Stream_Element_Offset, Element_Array => Stream_Element_Array, Digest_Length => SHA2.SHA_224.Digest_Length, Block_Length => SHA2.SHA_224.Block_Length, Hash_Context => SHA2.SHA_224.Context, Hash_Initialize => SHA2.SHA_224.Initialize, Hash_Update => SHA2.SHA_224.Update, Hash_Finalize => SHA2.SHA_224.Finalize); package HMAC_SHA_256 is new HMAC_Generic (Element => Stream_Element, Index => Stream_Element_Offset, Element_Array => Stream_Element_Array, Digest_Length => SHA2.SHA_256.Digest_Length, Block_Length => SHA2.SHA_256.Block_Length, Hash_Context => SHA2.SHA_256.Context, Hash_Initialize => SHA2.SHA_256.Initialize, Hash_Update => SHA2.SHA_256.Update, Hash_Finalize => SHA2.SHA_256.Finalize); package HMAC_SHA_384 is new HMAC_Generic (Element => Stream_Element, Index => Stream_Element_Offset, Element_Array => Stream_Element_Array, Digest_Length => SHA2.SHA_384.Digest_Length, Block_Length => SHA2.SHA_384.Block_Length, Hash_Context => SHA2.SHA_384.Context, Hash_Initialize => SHA2.SHA_384.Initialize, Hash_Update => SHA2.SHA_384.Update, Hash_Finalize => SHA2.SHA_384.Finalize); package HMAC_SHA_512 is new HMAC_Generic (Element => Stream_Element, Index => Stream_Element_Offset, Element_Array => Stream_Element_Array, Digest_Length => SHA2.SHA_512.Digest_Length, Block_Length => SHA2.SHA_512.Block_Length, Hash_Context => SHA2.SHA_512.Context, Hash_Initialize => SHA2.SHA_512.Initialize, Hash_Update => SHA2.SHA_512.Update, Hash_Finalize => SHA2.SHA_512.Finalize); end HMAC;
p2/xv6/ln.asm
szhu0513/-xv6-New-System-Call---Screenshot
0
2190
_ln: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.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: 53 push %ebx e: 51 push %ecx f: 8b 59 04 mov 0x4(%ecx),%ebx if(argc != 3){ 12: 83 39 03 cmpl $0x3,(%ecx) 15: 74 14 je 2b <main+0x2b> printf(2, "Usage: ln old new\n"); 17: 83 ec 08 sub $0x8,%esp 1a: 68 ec 05 00 00 push $0x5ec 1f: 6a 02 push $0x2 21: e8 0d 03 00 00 call 333 <printf> exit(); 26: e8 be 01 00 00 call 1e9 <exit> } if(link(argv[1], argv[2]) < 0) 2b: 83 ec 08 sub $0x8,%esp 2e: ff 73 08 pushl 0x8(%ebx) 31: ff 73 04 pushl 0x4(%ebx) 34: e8 10 02 00 00 call 249 <link> 39: 83 c4 10 add $0x10,%esp 3c: 85 c0 test %eax,%eax 3e: 78 05 js 45 <main+0x45> printf(2, "link %s %s: failed\n", argv[1], argv[2]); exit(); 40: e8 a4 01 00 00 call 1e9 <exit> printf(2, "link %s %s: failed\n", argv[1], argv[2]); 45: ff 73 08 pushl 0x8(%ebx) 48: ff 73 04 pushl 0x4(%ebx) 4b: 68 ff 05 00 00 push $0x5ff 50: 6a 02 push $0x2 52: e8 dc 02 00 00 call 333 <printf> 57: 83 c4 10 add $0x10,%esp 5a: eb e4 jmp 40 <main+0x40> 0000005c <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 5c: 55 push %ebp 5d: 89 e5 mov %esp,%ebp 5f: 53 push %ebx 60: 8b 45 08 mov 0x8(%ebp),%eax 63: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 66: 89 c2 mov %eax,%edx 68: 0f b6 19 movzbl (%ecx),%ebx 6b: 88 1a mov %bl,(%edx) 6d: 8d 52 01 lea 0x1(%edx),%edx 70: 8d 49 01 lea 0x1(%ecx),%ecx 73: 84 db test %bl,%bl 75: 75 f1 jne 68 <strcpy+0xc> ; return os; } 77: 5b pop %ebx 78: 5d pop %ebp 79: c3 ret 0000007a <strcmp>: int strcmp(const char *p, const char *q) { 7a: 55 push %ebp 7b: 89 e5 mov %esp,%ebp 7d: 8b 4d 08 mov 0x8(%ebp),%ecx 80: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) 83: eb 06 jmp 8b <strcmp+0x11> p++, q++; 85: 83 c1 01 add $0x1,%ecx 88: 83 c2 01 add $0x1,%edx while(*p && *p == *q) 8b: 0f b6 01 movzbl (%ecx),%eax 8e: 84 c0 test %al,%al 90: 74 04 je 96 <strcmp+0x1c> 92: 3a 02 cmp (%edx),%al 94: 74 ef je 85 <strcmp+0xb> return (uchar)*p - (uchar)*q; 96: 0f b6 c0 movzbl %al,%eax 99: 0f b6 12 movzbl (%edx),%edx 9c: 29 d0 sub %edx,%eax } 9e: 5d pop %ebp 9f: c3 ret 000000a0 <strlen>: uint strlen(const char *s) { a0: 55 push %ebp a1: 89 e5 mov %esp,%ebp a3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) a6: ba 00 00 00 00 mov $0x0,%edx ab: eb 03 jmp b0 <strlen+0x10> ad: 83 c2 01 add $0x1,%edx b0: 89 d0 mov %edx,%eax b2: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) b6: 75 f5 jne ad <strlen+0xd> ; return n; } b8: 5d pop %ebp b9: c3 ret 000000ba <memset>: void* memset(void *dst, int c, uint n) { ba: 55 push %ebp bb: 89 e5 mov %esp,%ebp bd: 57 push %edi be: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : c1: 89 d7 mov %edx,%edi c3: 8b 4d 10 mov 0x10(%ebp),%ecx c6: 8b 45 0c mov 0xc(%ebp),%eax c9: fc cld ca: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } cc: 89 d0 mov %edx,%eax ce: 5f pop %edi cf: 5d pop %ebp d0: c3 ret 000000d1 <strchr>: char* strchr(const char *s, char c) { d1: 55 push %ebp d2: 89 e5 mov %esp,%ebp d4: 8b 45 08 mov 0x8(%ebp),%eax d7: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) db: 0f b6 10 movzbl (%eax),%edx de: 84 d2 test %dl,%dl e0: 74 09 je eb <strchr+0x1a> if(*s == c) e2: 38 ca cmp %cl,%dl e4: 74 0a je f0 <strchr+0x1f> for(; *s; s++) e6: 83 c0 01 add $0x1,%eax e9: eb f0 jmp db <strchr+0xa> return (char*)s; return 0; eb: b8 00 00 00 00 mov $0x0,%eax } f0: 5d pop %ebp f1: c3 ret 000000f2 <gets>: char* gets(char *buf, int max) { f2: 55 push %ebp f3: 89 e5 mov %esp,%ebp f5: 57 push %edi f6: 56 push %esi f7: 53 push %ebx f8: 83 ec 1c sub $0x1c,%esp fb: 8b 7d 08 mov 0x8(%ebp),%edi int i, cc; char c; for(i=0; i+1 < max; ){ fe: bb 00 00 00 00 mov $0x0,%ebx 103: 8d 73 01 lea 0x1(%ebx),%esi 106: 3b 75 0c cmp 0xc(%ebp),%esi 109: 7d 2e jge 139 <gets+0x47> cc = read(0, &c, 1); 10b: 83 ec 04 sub $0x4,%esp 10e: 6a 01 push $0x1 110: 8d 45 e7 lea -0x19(%ebp),%eax 113: 50 push %eax 114: 6a 00 push $0x0 116: e8 e6 00 00 00 call 201 <read> if(cc < 1) 11b: 83 c4 10 add $0x10,%esp 11e: 85 c0 test %eax,%eax 120: 7e 17 jle 139 <gets+0x47> break; buf[i++] = c; 122: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 126: 88 04 1f mov %al,(%edi,%ebx,1) if(c == '\n' || c == '\r') 129: 3c 0a cmp $0xa,%al 12b: 0f 94 c2 sete %dl 12e: 3c 0d cmp $0xd,%al 130: 0f 94 c0 sete %al buf[i++] = c; 133: 89 f3 mov %esi,%ebx if(c == '\n' || c == '\r') 135: 08 c2 or %al,%dl 137: 74 ca je 103 <gets+0x11> break; } buf[i] = '\0'; 139: c6 04 1f 00 movb $0x0,(%edi,%ebx,1) return buf; } 13d: 89 f8 mov %edi,%eax 13f: 8d 65 f4 lea -0xc(%ebp),%esp 142: 5b pop %ebx 143: 5e pop %esi 144: 5f pop %edi 145: 5d pop %ebp 146: c3 ret 00000147 <stat>: int stat(const char *n, struct stat *st) { 147: 55 push %ebp 148: 89 e5 mov %esp,%ebp 14a: 56 push %esi 14b: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 14c: 83 ec 08 sub $0x8,%esp 14f: 6a 00 push $0x0 151: ff 75 08 pushl 0x8(%ebp) 154: e8 d0 00 00 00 call 229 <open> if(fd < 0) 159: 83 c4 10 add $0x10,%esp 15c: 85 c0 test %eax,%eax 15e: 78 24 js 184 <stat+0x3d> 160: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); 162: 83 ec 08 sub $0x8,%esp 165: ff 75 0c pushl 0xc(%ebp) 168: 50 push %eax 169: e8 d3 00 00 00 call 241 <fstat> 16e: 89 c6 mov %eax,%esi close(fd); 170: 89 1c 24 mov %ebx,(%esp) 173: e8 99 00 00 00 call 211 <close> return r; 178: 83 c4 10 add $0x10,%esp } 17b: 89 f0 mov %esi,%eax 17d: 8d 65 f8 lea -0x8(%ebp),%esp 180: 5b pop %ebx 181: 5e pop %esi 182: 5d pop %ebp 183: c3 ret return -1; 184: be ff ff ff ff mov $0xffffffff,%esi 189: eb f0 jmp 17b <stat+0x34> 0000018b <atoi>: int atoi(const char *s) { 18b: 55 push %ebp 18c: 89 e5 mov %esp,%ebp 18e: 53 push %ebx 18f: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; 192: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 197: eb 10 jmp 1a9 <atoi+0x1e> n = n*10 + *s++ - '0'; 199: 8d 1c 80 lea (%eax,%eax,4),%ebx 19c: 8d 04 1b lea (%ebx,%ebx,1),%eax 19f: 83 c1 01 add $0x1,%ecx 1a2: 0f be d2 movsbl %dl,%edx 1a5: 8d 44 02 d0 lea -0x30(%edx,%eax,1),%eax while('0' <= *s && *s <= '9') 1a9: 0f b6 11 movzbl (%ecx),%edx 1ac: 8d 5a d0 lea -0x30(%edx),%ebx 1af: 80 fb 09 cmp $0x9,%bl 1b2: 76 e5 jbe 199 <atoi+0xe> return n; } 1b4: 5b pop %ebx 1b5: 5d pop %ebp 1b6: c3 ret 000001b7 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 1b7: 55 push %ebp 1b8: 89 e5 mov %esp,%ebp 1ba: 56 push %esi 1bb: 53 push %ebx 1bc: 8b 45 08 mov 0x8(%ebp),%eax 1bf: 8b 5d 0c mov 0xc(%ebp),%ebx 1c2: 8b 55 10 mov 0x10(%ebp),%edx char *dst; const char *src; dst = vdst; 1c5: 89 c1 mov %eax,%ecx src = vsrc; while(n-- > 0) 1c7: eb 0d jmp 1d6 <memmove+0x1f> *dst++ = *src++; 1c9: 0f b6 13 movzbl (%ebx),%edx 1cc: 88 11 mov %dl,(%ecx) 1ce: 8d 5b 01 lea 0x1(%ebx),%ebx 1d1: 8d 49 01 lea 0x1(%ecx),%ecx while(n-- > 0) 1d4: 89 f2 mov %esi,%edx 1d6: 8d 72 ff lea -0x1(%edx),%esi 1d9: 85 d2 test %edx,%edx 1db: 7f ec jg 1c9 <memmove+0x12> return vdst; } 1dd: 5b pop %ebx 1de: 5e pop %esi 1df: 5d pop %ebp 1e0: c3 ret 000001e1 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 1e1: b8 01 00 00 00 mov $0x1,%eax 1e6: cd 40 int $0x40 1e8: c3 ret 000001e9 <exit>: SYSCALL(exit) 1e9: b8 02 00 00 00 mov $0x2,%eax 1ee: cd 40 int $0x40 1f0: c3 ret 000001f1 <wait>: SYSCALL(wait) 1f1: b8 03 00 00 00 mov $0x3,%eax 1f6: cd 40 int $0x40 1f8: c3 ret 000001f9 <pipe>: SYSCALL(pipe) 1f9: b8 04 00 00 00 mov $0x4,%eax 1fe: cd 40 int $0x40 200: c3 ret 00000201 <read>: SYSCALL(read) 201: b8 05 00 00 00 mov $0x5,%eax 206: cd 40 int $0x40 208: c3 ret 00000209 <write>: SYSCALL(write) 209: b8 10 00 00 00 mov $0x10,%eax 20e: cd 40 int $0x40 210: c3 ret 00000211 <close>: SYSCALL(close) 211: b8 15 00 00 00 mov $0x15,%eax 216: cd 40 int $0x40 218: c3 ret 00000219 <kill>: SYSCALL(kill) 219: b8 06 00 00 00 mov $0x6,%eax 21e: cd 40 int $0x40 220: c3 ret 00000221 <exec>: SYSCALL(exec) 221: b8 07 00 00 00 mov $0x7,%eax 226: cd 40 int $0x40 228: c3 ret 00000229 <open>: SYSCALL(open) 229: b8 0f 00 00 00 mov $0xf,%eax 22e: cd 40 int $0x40 230: c3 ret 00000231 <mknod>: SYSCALL(mknod) 231: b8 11 00 00 00 mov $0x11,%eax 236: cd 40 int $0x40 238: c3 ret 00000239 <unlink>: SYSCALL(unlink) 239: b8 12 00 00 00 mov $0x12,%eax 23e: cd 40 int $0x40 240: c3 ret 00000241 <fstat>: SYSCALL(fstat) 241: b8 08 00 00 00 mov $0x8,%eax 246: cd 40 int $0x40 248: c3 ret 00000249 <link>: SYSCALL(link) 249: b8 13 00 00 00 mov $0x13,%eax 24e: cd 40 int $0x40 250: c3 ret 00000251 <mkdir>: SYSCALL(mkdir) 251: b8 14 00 00 00 mov $0x14,%eax 256: cd 40 int $0x40 258: c3 ret 00000259 <chdir>: SYSCALL(chdir) 259: b8 09 00 00 00 mov $0x9,%eax 25e: cd 40 int $0x40 260: c3 ret 00000261 <dup>: SYSCALL(dup) 261: b8 0a 00 00 00 mov $0xa,%eax 266: cd 40 int $0x40 268: c3 ret 00000269 <getpid>: SYSCALL(getpid) 269: b8 0b 00 00 00 mov $0xb,%eax 26e: cd 40 int $0x40 270: c3 ret 00000271 <sbrk>: SYSCALL(sbrk) 271: b8 0c 00 00 00 mov $0xc,%eax 276: cd 40 int $0x40 278: c3 ret 00000279 <sleep>: SYSCALL(sleep) 279: b8 0d 00 00 00 mov $0xd,%eax 27e: cd 40 int $0x40 280: c3 ret 00000281 <uptime>: SYSCALL(uptime) 281: b8 0e 00 00 00 mov $0xe,%eax 286: cd 40 int $0x40 288: c3 ret 00000289 <getofilecnt>: SYSCALL(getofilecnt) 289: b8 16 00 00 00 mov $0x16,%eax 28e: cd 40 int $0x40 290: c3 ret 00000291 <getofilenext>: SYSCALL(getofilenext) 291: b8 17 00 00 00 mov $0x17,%eax 296: cd 40 int $0x40 298: c3 ret 00000299 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 299: 55 push %ebp 29a: 89 e5 mov %esp,%ebp 29c: 83 ec 1c sub $0x1c,%esp 29f: 88 55 f4 mov %dl,-0xc(%ebp) write(fd, &c, 1); 2a2: 6a 01 push $0x1 2a4: 8d 55 f4 lea -0xc(%ebp),%edx 2a7: 52 push %edx 2a8: 50 push %eax 2a9: e8 5b ff ff ff call 209 <write> } 2ae: 83 c4 10 add $0x10,%esp 2b1: c9 leave 2b2: c3 ret 000002b3 <printint>: static void printint(int fd, int xx, int base, int sgn) { 2b3: 55 push %ebp 2b4: 89 e5 mov %esp,%ebp 2b6: 57 push %edi 2b7: 56 push %esi 2b8: 53 push %ebx 2b9: 83 ec 2c sub $0x2c,%esp 2bc: 89 c7 mov %eax,%edi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 2be: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 2c2: 0f 95 c3 setne %bl 2c5: 89 d0 mov %edx,%eax 2c7: c1 e8 1f shr $0x1f,%eax 2ca: 84 c3 test %al,%bl 2cc: 74 10 je 2de <printint+0x2b> neg = 1; x = -xx; 2ce: f7 da neg %edx neg = 1; 2d0: c7 45 d4 01 00 00 00 movl $0x1,-0x2c(%ebp) } else { x = xx; } i = 0; 2d7: be 00 00 00 00 mov $0x0,%esi 2dc: eb 0b jmp 2e9 <printint+0x36> neg = 0; 2de: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) 2e5: eb f0 jmp 2d7 <printint+0x24> do{ buf[i++] = digits[x % base]; 2e7: 89 c6 mov %eax,%esi 2e9: 89 d0 mov %edx,%eax 2eb: ba 00 00 00 00 mov $0x0,%edx 2f0: f7 f1 div %ecx 2f2: 89 c3 mov %eax,%ebx 2f4: 8d 46 01 lea 0x1(%esi),%eax 2f7: 0f b6 92 1c 06 00 00 movzbl 0x61c(%edx),%edx 2fe: 88 54 35 d8 mov %dl,-0x28(%ebp,%esi,1) }while((x /= base) != 0); 302: 89 da mov %ebx,%edx 304: 85 db test %ebx,%ebx 306: 75 df jne 2e7 <printint+0x34> 308: 89 c3 mov %eax,%ebx if(neg) 30a: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) 30e: 74 16 je 326 <printint+0x73> buf[i++] = '-'; 310: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) 315: 8d 5e 02 lea 0x2(%esi),%ebx 318: eb 0c jmp 326 <printint+0x73> while(--i >= 0) putc(fd, buf[i]); 31a: 0f be 54 1d d8 movsbl -0x28(%ebp,%ebx,1),%edx 31f: 89 f8 mov %edi,%eax 321: e8 73 ff ff ff call 299 <putc> while(--i >= 0) 326: 83 eb 01 sub $0x1,%ebx 329: 79 ef jns 31a <printint+0x67> } 32b: 83 c4 2c add $0x2c,%esp 32e: 5b pop %ebx 32f: 5e pop %esi 330: 5f pop %edi 331: 5d pop %ebp 332: c3 ret 00000333 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 333: 55 push %ebp 334: 89 e5 mov %esp,%ebp 336: 57 push %edi 337: 56 push %esi 338: 53 push %ebx 339: 83 ec 1c sub $0x1c,%esp char *s; int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; 33c: 8d 45 10 lea 0x10(%ebp),%eax 33f: 89 45 e4 mov %eax,-0x1c(%ebp) state = 0; 342: be 00 00 00 00 mov $0x0,%esi for(i = 0; fmt[i]; i++){ 347: bb 00 00 00 00 mov $0x0,%ebx 34c: eb 14 jmp 362 <printf+0x2f> c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); 34e: 89 fa mov %edi,%edx 350: 8b 45 08 mov 0x8(%ebp),%eax 353: e8 41 ff ff ff call 299 <putc> 358: eb 05 jmp 35f <printf+0x2c> } } else if(state == '%'){ 35a: 83 fe 25 cmp $0x25,%esi 35d: 74 25 je 384 <printf+0x51> for(i = 0; fmt[i]; i++){ 35f: 83 c3 01 add $0x1,%ebx 362: 8b 45 0c mov 0xc(%ebp),%eax 365: 0f b6 04 18 movzbl (%eax,%ebx,1),%eax 369: 84 c0 test %al,%al 36b: 0f 84 23 01 00 00 je 494 <printf+0x161> c = fmt[i] & 0xff; 371: 0f be f8 movsbl %al,%edi 374: 0f b6 c0 movzbl %al,%eax if(state == 0){ 377: 85 f6 test %esi,%esi 379: 75 df jne 35a <printf+0x27> if(c == '%'){ 37b: 83 f8 25 cmp $0x25,%eax 37e: 75 ce jne 34e <printf+0x1b> state = '%'; 380: 89 c6 mov %eax,%esi 382: eb db jmp 35f <printf+0x2c> if(c == 'd'){ 384: 83 f8 64 cmp $0x64,%eax 387: 74 49 je 3d2 <printf+0x9f> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 389: 83 f8 78 cmp $0x78,%eax 38c: 0f 94 c1 sete %cl 38f: 83 f8 70 cmp $0x70,%eax 392: 0f 94 c2 sete %dl 395: 08 d1 or %dl,%cl 397: 75 63 jne 3fc <printf+0xc9> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 399: 83 f8 73 cmp $0x73,%eax 39c: 0f 84 84 00 00 00 je 426 <printf+0xf3> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 3a2: 83 f8 63 cmp $0x63,%eax 3a5: 0f 84 b7 00 00 00 je 462 <printf+0x12f> putc(fd, *ap); ap++; } else if(c == '%'){ 3ab: 83 f8 25 cmp $0x25,%eax 3ae: 0f 84 cc 00 00 00 je 480 <printf+0x14d> putc(fd, c); } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 3b4: ba 25 00 00 00 mov $0x25,%edx 3b9: 8b 45 08 mov 0x8(%ebp),%eax 3bc: e8 d8 fe ff ff call 299 <putc> putc(fd, c); 3c1: 89 fa mov %edi,%edx 3c3: 8b 45 08 mov 0x8(%ebp),%eax 3c6: e8 ce fe ff ff call 299 <putc> } state = 0; 3cb: be 00 00 00 00 mov $0x0,%esi 3d0: eb 8d jmp 35f <printf+0x2c> printint(fd, *ap, 10, 1); 3d2: 8b 7d e4 mov -0x1c(%ebp),%edi 3d5: 8b 17 mov (%edi),%edx 3d7: 83 ec 0c sub $0xc,%esp 3da: 6a 01 push $0x1 3dc: b9 0a 00 00 00 mov $0xa,%ecx 3e1: 8b 45 08 mov 0x8(%ebp),%eax 3e4: e8 ca fe ff ff call 2b3 <printint> ap++; 3e9: 83 c7 04 add $0x4,%edi 3ec: 89 7d e4 mov %edi,-0x1c(%ebp) 3ef: 83 c4 10 add $0x10,%esp state = 0; 3f2: be 00 00 00 00 mov $0x0,%esi 3f7: e9 63 ff ff ff jmp 35f <printf+0x2c> printint(fd, *ap, 16, 0); 3fc: 8b 7d e4 mov -0x1c(%ebp),%edi 3ff: 8b 17 mov (%edi),%edx 401: 83 ec 0c sub $0xc,%esp 404: 6a 00 push $0x0 406: b9 10 00 00 00 mov $0x10,%ecx 40b: 8b 45 08 mov 0x8(%ebp),%eax 40e: e8 a0 fe ff ff call 2b3 <printint> ap++; 413: 83 c7 04 add $0x4,%edi 416: 89 7d e4 mov %edi,-0x1c(%ebp) 419: 83 c4 10 add $0x10,%esp state = 0; 41c: be 00 00 00 00 mov $0x0,%esi 421: e9 39 ff ff ff jmp 35f <printf+0x2c> s = (char*)*ap; 426: 8b 45 e4 mov -0x1c(%ebp),%eax 429: 8b 30 mov (%eax),%esi ap++; 42b: 83 c0 04 add $0x4,%eax 42e: 89 45 e4 mov %eax,-0x1c(%ebp) if(s == 0) 431: 85 f6 test %esi,%esi 433: 75 28 jne 45d <printf+0x12a> s = "(null)"; 435: be 13 06 00 00 mov $0x613,%esi 43a: 8b 7d 08 mov 0x8(%ebp),%edi 43d: eb 0d jmp 44c <printf+0x119> putc(fd, *s); 43f: 0f be d2 movsbl %dl,%edx 442: 89 f8 mov %edi,%eax 444: e8 50 fe ff ff call 299 <putc> s++; 449: 83 c6 01 add $0x1,%esi while(*s != 0){ 44c: 0f b6 16 movzbl (%esi),%edx 44f: 84 d2 test %dl,%dl 451: 75 ec jne 43f <printf+0x10c> state = 0; 453: be 00 00 00 00 mov $0x0,%esi 458: e9 02 ff ff ff jmp 35f <printf+0x2c> 45d: 8b 7d 08 mov 0x8(%ebp),%edi 460: eb ea jmp 44c <printf+0x119> putc(fd, *ap); 462: 8b 7d e4 mov -0x1c(%ebp),%edi 465: 0f be 17 movsbl (%edi),%edx 468: 8b 45 08 mov 0x8(%ebp),%eax 46b: e8 29 fe ff ff call 299 <putc> ap++; 470: 83 c7 04 add $0x4,%edi 473: 89 7d e4 mov %edi,-0x1c(%ebp) state = 0; 476: be 00 00 00 00 mov $0x0,%esi 47b: e9 df fe ff ff jmp 35f <printf+0x2c> putc(fd, c); 480: 89 fa mov %edi,%edx 482: 8b 45 08 mov 0x8(%ebp),%eax 485: e8 0f fe ff ff call 299 <putc> state = 0; 48a: be 00 00 00 00 mov $0x0,%esi 48f: e9 cb fe ff ff jmp 35f <printf+0x2c> } } } 494: 8d 65 f4 lea -0xc(%ebp),%esp 497: 5b pop %ebx 498: 5e pop %esi 499: 5f pop %edi 49a: 5d pop %ebp 49b: c3 ret 0000049c <free>: static Header base; static Header *freep; void free(void *ap) { 49c: 55 push %ebp 49d: 89 e5 mov %esp,%ebp 49f: 57 push %edi 4a0: 56 push %esi 4a1: 53 push %ebx 4a2: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; 4a5: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 4a8: a1 b8 08 00 00 mov 0x8b8,%eax 4ad: eb 02 jmp 4b1 <free+0x15> 4af: 89 d0 mov %edx,%eax 4b1: 39 c8 cmp %ecx,%eax 4b3: 73 04 jae 4b9 <free+0x1d> 4b5: 39 08 cmp %ecx,(%eax) 4b7: 77 12 ja 4cb <free+0x2f> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 4b9: 8b 10 mov (%eax),%edx 4bb: 39 c2 cmp %eax,%edx 4bd: 77 f0 ja 4af <free+0x13> 4bf: 39 c8 cmp %ecx,%eax 4c1: 72 08 jb 4cb <free+0x2f> 4c3: 39 ca cmp %ecx,%edx 4c5: 77 04 ja 4cb <free+0x2f> 4c7: 89 d0 mov %edx,%eax 4c9: eb e6 jmp 4b1 <free+0x15> break; if(bp + bp->s.size == p->s.ptr){ 4cb: 8b 73 fc mov -0x4(%ebx),%esi 4ce: 8d 3c f1 lea (%ecx,%esi,8),%edi 4d1: 8b 10 mov (%eax),%edx 4d3: 39 d7 cmp %edx,%edi 4d5: 74 19 je 4f0 <free+0x54> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 4d7: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 4da: 8b 50 04 mov 0x4(%eax),%edx 4dd: 8d 34 d0 lea (%eax,%edx,8),%esi 4e0: 39 ce cmp %ecx,%esi 4e2: 74 1b je 4ff <free+0x63> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 4e4: 89 08 mov %ecx,(%eax) freep = p; 4e6: a3 b8 08 00 00 mov %eax,0x8b8 } 4eb: 5b pop %ebx 4ec: 5e pop %esi 4ed: 5f pop %edi 4ee: 5d pop %ebp 4ef: c3 ret bp->s.size += p->s.ptr->s.size; 4f0: 03 72 04 add 0x4(%edx),%esi 4f3: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 4f6: 8b 10 mov (%eax),%edx 4f8: 8b 12 mov (%edx),%edx 4fa: 89 53 f8 mov %edx,-0x8(%ebx) 4fd: eb db jmp 4da <free+0x3e> p->s.size += bp->s.size; 4ff: 03 53 fc add -0x4(%ebx),%edx 502: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 505: 8b 53 f8 mov -0x8(%ebx),%edx 508: 89 10 mov %edx,(%eax) 50a: eb da jmp 4e6 <free+0x4a> 0000050c <morecore>: static Header* morecore(uint nu) { 50c: 55 push %ebp 50d: 89 e5 mov %esp,%ebp 50f: 53 push %ebx 510: 83 ec 04 sub $0x4,%esp 513: 89 c3 mov %eax,%ebx char *p; Header *hp; if(nu < 4096) 515: 3d ff 0f 00 00 cmp $0xfff,%eax 51a: 77 05 ja 521 <morecore+0x15> nu = 4096; 51c: bb 00 10 00 00 mov $0x1000,%ebx p = sbrk(nu * sizeof(Header)); 521: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax 528: 83 ec 0c sub $0xc,%esp 52b: 50 push %eax 52c: e8 40 fd ff ff call 271 <sbrk> if(p == (char*)-1) 531: 83 c4 10 add $0x10,%esp 534: 83 f8 ff cmp $0xffffffff,%eax 537: 74 1c je 555 <morecore+0x49> return 0; hp = (Header*)p; hp->s.size = nu; 539: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 53c: 83 c0 08 add $0x8,%eax 53f: 83 ec 0c sub $0xc,%esp 542: 50 push %eax 543: e8 54 ff ff ff call 49c <free> return freep; 548: a1 b8 08 00 00 mov 0x8b8,%eax 54d: 83 c4 10 add $0x10,%esp } 550: 8b 5d fc mov -0x4(%ebp),%ebx 553: c9 leave 554: c3 ret return 0; 555: b8 00 00 00 00 mov $0x0,%eax 55a: eb f4 jmp 550 <morecore+0x44> 0000055c <malloc>: void* malloc(uint nbytes) { 55c: 55 push %ebp 55d: 89 e5 mov %esp,%ebp 55f: 53 push %ebx 560: 83 ec 04 sub $0x4,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 563: 8b 45 08 mov 0x8(%ebp),%eax 566: 8d 58 07 lea 0x7(%eax),%ebx 569: c1 eb 03 shr $0x3,%ebx 56c: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ 56f: 8b 0d b8 08 00 00 mov 0x8b8,%ecx 575: 85 c9 test %ecx,%ecx 577: 74 04 je 57d <malloc+0x21> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 579: 8b 01 mov (%ecx),%eax 57b: eb 4d jmp 5ca <malloc+0x6e> base.s.ptr = freep = prevp = &base; 57d: c7 05 b8 08 00 00 bc movl $0x8bc,0x8b8 584: 08 00 00 587: c7 05 bc 08 00 00 bc movl $0x8bc,0x8bc 58e: 08 00 00 base.s.size = 0; 591: c7 05 c0 08 00 00 00 movl $0x0,0x8c0 598: 00 00 00 base.s.ptr = freep = prevp = &base; 59b: b9 bc 08 00 00 mov $0x8bc,%ecx 5a0: eb d7 jmp 579 <malloc+0x1d> if(p->s.size >= nunits){ if(p->s.size == nunits) 5a2: 39 da cmp %ebx,%edx 5a4: 74 1a je 5c0 <malloc+0x64> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 5a6: 29 da sub %ebx,%edx 5a8: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 5ab: 8d 04 d0 lea (%eax,%edx,8),%eax p->s.size = nunits; 5ae: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; 5b1: 89 0d b8 08 00 00 mov %ecx,0x8b8 return (void*)(p + 1); 5b7: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 5ba: 83 c4 04 add $0x4,%esp 5bd: 5b pop %ebx 5be: 5d pop %ebp 5bf: c3 ret prevp->s.ptr = p->s.ptr; 5c0: 8b 10 mov (%eax),%edx 5c2: 89 11 mov %edx,(%ecx) 5c4: eb eb jmp 5b1 <malloc+0x55> for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 5c6: 89 c1 mov %eax,%ecx 5c8: 8b 00 mov (%eax),%eax if(p->s.size >= nunits){ 5ca: 8b 50 04 mov 0x4(%eax),%edx 5cd: 39 da cmp %ebx,%edx 5cf: 73 d1 jae 5a2 <malloc+0x46> if(p == freep) 5d1: 39 05 b8 08 00 00 cmp %eax,0x8b8 5d7: 75 ed jne 5c6 <malloc+0x6a> if((p = morecore(nunits)) == 0) 5d9: 89 d8 mov %ebx,%eax 5db: e8 2c ff ff ff call 50c <morecore> 5e0: 85 c0 test %eax,%eax 5e2: 75 e2 jne 5c6 <malloc+0x6a> return 0; 5e4: b8 00 00 00 00 mov $0x0,%eax 5e9: eb cf jmp 5ba <malloc+0x5e>
SuperMerge/~SuperMerge_3_MOVE~ALEX.applescript
AlexanderGalen/applescripts
3
2751
<reponame>AlexanderGalen/applescripts property firstRow : 2 --these subroutines take a mac path as parameters. they fail if there is nothing in the folder so it checks first and does nothing if folder is empty --copy functions will replace existing files on cp_all(source, destination) set source to quoted form of POSIX path of source set destination to quoted form of POSIX path of destination do shell script "cp -Rpf " & source & "* " & destination end cp_all on cp(source, destination) set source to quoted form of POSIX path of source set destination to quoted form of POSIX path of destination do shell script "cp -Rpf " & source & " " & destination end cp on rm_all(source) tell application "Finder" set theFiles to entire contents of folder source as alias list end tell if theFiles is not {} then set source to quoted form of POSIX path of source do shell script "rm -d -f " & source & "*" end if end rm_all on rm(source) set source to quoted form of POSIX path of source do shell script "rm -d -f " & source end rm on logToFile(logText, LogFile) set openedFile to open for access file LogFile with write permission write (logText & return) to openedFile starting at eof close access openedFile end logToFile --initializing some variables set copyvar to true set LogFile to "HOM_Shortrun:Merge Error Log.txt" set errorOccured to false set ExitVariable to "" set superMergeDB to "HOM_Shortrun:Databases:Supermerge.THIS.txt" set activeJobsFolder to "HOM_Shortrun:~HOM Active Jobs:" set clientImagesFolder to "HOM_Shortrun:SUPERmergeIN:CLIENT Images:" set mergedQuarkDocsFolder to "HOM_Shortrun:SUPERmergeOUT:Merged Quark Docs:" tell application "Microsoft Excel" to open superMergeDB set i to firstRow repeat while ExitVariable is not "Exit" --first chunk of psuedo repeat loop repeat 1 times --resets value of prevArt, prevInfo, prevJob, and copyvar to avoid jobs copying previous folder from previous row in DB set prevArt to "" set prevInfo to "" set prevJob to "" --this one caused me problems. --it was getting set to true when a job was found in printed or active jobs, but then when the next job was in the archives, it stayed true, and when the script checks which place to copy from by checking that variable, it found it true and used 'FinishedOldPath' to copy, which was still set as the value from the previous row. set copyvar to true set FinishedArchivePath to "" set FinishedOldPath to "" tell application "Microsoft Excel" tell row i set imageNames to {value of cell 13, value of cell 14, value of cell 15, value of cell 16, value of cell 29, value of cell 30, value of cell 31, value of cell 32, value of cell 33} set jobNumber to string value of cell 1 set quarkName to string value of cell 1 & ".HOM.qxp" set prevArt to string value of cell 34 set prevInfo to string value of cell 35 end tell end tell --sets variables specific to this row set thisQuarkDoc to mergedQuarkDocsFolder & quarkName as string set thisJobFolder to activeJobsFolder & jobNumber as string --does a full exit if it finds no value for job number in database: when it reaches the end of the database --the check for 0 is because excel was returning 0 as the value for an empty cell and I don't know why if jobNumber is "" or jobNumber is 0 then set ExitVariable to "Exit" exit repeat end if tell application "Finder" if not (exists folder jobNumber of folder activeJobsFolder) then make new folder at folder activeJobsFolder with properties {name:jobNumber} end if end tell cp(thisQuarkDoc, thisJobFolder) if prevArt is not "" then try set prevJob to find text "[0-9]{6}" in prevArt with regexp and string result set skipvar to false set textToLog to false on error errStr number errorNumber set textToLog to true set logText to (current date) & tab & jobNumber & tab & tab & tab & errStr & tab & errorNumber as text set skipvar to true set prevJob to "" end try else if prevInfo is not "" then try set prevJob to find text "[0-9]{6}" in prevInfo with regexp and string result set skipvar to false set textToLog to false on error errStr number errorNumber set textToLog to true set logText to (current date) & tab & jobNumber & tab & tab & tab & errStr & tab & errorNumber as text set skipvar to true set prevJob to "" end try else set skipvar to true set textToLog to false end if --skips over copying old job if the result of value check determines that it should be skipped if textToLog then set errorOccured to true logToFile(logText, LogFile) end if if skipvar then set skipvar to false exit repeat end if --this whole chunk is my (Alex) copy old job to new folder script --whole copying process is wrapped in a try block. If it fails, it just continues on to the next job. try --this is for if the job is in the older archives if prevJob is less than 226000 then set copyvar to false set Chars to characters of prevJob set First3 to item 1 of Chars & item 2 of Chars & item 3 of Chars as string set OldPth to "ARCHIVES VINTAGE:HOM Archive Jobs:" & First3 & "xxx.jobs:" set thisSource to OldPth & prevJob -- shell script that finds and copies old job folder to new one log thisSource log thisJobFolder cp_all(thisSource, thisJobFolder) end if --Checks Various folders where old job might be tell application "Finder" --checks for old job in HOM Calendars 2006; copies if found if exists "HOM_Shortrun:HOM Calendars 2006:" & prevJob then set FinishedOldPath to "HOM_Shortrun:HOM Calendars 2006:" & prevJob --checks if _1 is appended to end of folder name in 2006 calendars else if exists "HOM_Shortrun:HOM Calendars 2006:" & prevJob & "_1" then set FinishedOldPath to "HOM_Shortrun:HOM Calendars 2006:" & prevJob & "_1" --checks for old job in HOM Calendars PRINTED; copies if found else if exists "HOM_Shortrun:HOM Calendars PRINTED:" & prevJob then set FinishedOldPath to "HOM_Shortrun:HOM Calendars PRINTED:" & prevJob --checks if _1 is appended to end of folder name in HOM Calendars PRINTED else if exists "HOM_Shortrun:HOM Calendars PRINTED:" & prevJob & "_1" then set FinishedOldPath to "HOM_Shortrun:HOM Calendars PRINTED:" & prevJob & "_1" --checks for old job in HOM Printed Jobs; copies if found else if exists "HOM_Shortrun:~HOM Printed Jobs:" & prevJob then set FinishedOldPath to "HOM_Shortrun:~HOM Printed Jobs:" & prevJob --checks if _1 is appended to end of folder name in Printed else if exists "HOM_Shortrun:~HOM Printed Jobs:" & prevJob & "_1" then set FinishedOldPath to "HOM_Shortrun:~HOM Printed Jobs:" & prevJob & "_1" --checks for old job in Active Jobs; copies if found else if exists "HOM_Shortrun:~HOM Active Jobs:" & prevJob then set FinishedOldPath to "HOM_Shortrun:~HOM Active Jobs:" & prevJob --checks if _1 is appended to end of folder name in active else if exists "HOM_Shortrun:~HOM Active Jobs:" & prevJob & "_1" then set FinishedOldPath to "HOM_Shortrun:~HOM Active Jobs:" & prevJob & "_1" --if none of those exist, checks the archives for the folder else set copyvar to false --converts prevJob back into a string set prevJob to prevJob as string set OldPth to "HOM_Shortrun:~HOM Archive Jobs:" & characters 1 thru 3 of prevJob & "xxx.jobs:" as string set FinishedArchivePath to OldPth & prevJob end if end tell --duplicates whichever path was found to exist into the Active Job Folder if copyvar then log FinishedOldPath log thisJobFolder cp(FinishedOldPath, thisJobFolder) else log FinishedArchivePath log thisJobFolder cp_all(FinishedArchivePath, thisJobFolder) end if on error errStr number errorNumber set errorOccured to true set logText to (current date) & tab & jobNumber & tab & tab & prevJob & tab & errStr & tab & errorNumber as text logToFile(logText, LogFile) end try --end of the copy old folder to new folder end repeat --end of first pseudo repeat loop and beginning of second repeat 1 times --moves image files to Job Folder in Active Jobs repeat with thisImage in imageNames --sets variables specific to this row set thisImagePath to clientImagesFolder & thisImage if contents of thisImage is not "" then try cp(thisImagePath, thisJobFolder) on error errStr number errorNumber set errorOccured to true set logText to (current date) & tab & jobNumber & tab & thisImage & tab & tab & errStr & tab & errorNumber as text logToFile(logText, LogFile) end try end if end repeat set i to i + 1 end repeat end repeat --loops through again, and deletes client images from client images folder if --they were sucessfully copied into the job folder set ExitVariable to "" set i to firstRow repeat while ExitVariable is not "Exit" tell application "Microsoft Excel" tell row i set imageNames to {value of cell 13, value of cell 14, value of cell 15, value of cell 16, value of cell 29, value of cell 30, value of cell 31, value of cell 32, value of cell 33} set jobNumber to string value of cell 1 set quarkName to string value of cell 1 & ".HOM.qxp" end tell end tell if jobNumber is "" then exit repeat repeat with thisImage in imageNames --sets variable specific to this row if contents of thisImage is not "" then tell application "Finder" if (exists file thisImage of folder jobNumber of folder activeJobsFolder) then set fileToDelete to clientImagesFolder & thisImage as string else set fileToDelete to "" end if end tell if fileToDelete is not "" then rm(fileToDelete) end if end if end repeat set i to i + 1 end repeat tell application "Microsoft Excel" close active workbook saving no end tell --moves unprocessed images from their folders into original client images set originalImagesFolder to "HOM_Shortrun:SUPERmergeOUT:Original Client Images:" set pdfsToProcessFolder to "HOM_Shortrun:PDFs to process:" set imagesToProcessFolder to "HOM_Shortrun:Process Client Images:" try cp_all(pdfsToProcessFolder, originalImagesFolder) set clearFail to false on error set clearFail to true end try try rm_all(pdfsToProcessFolder) set clearFail to false on error set clearFail to true end try try cp_all(imagesToProcessFolder, originalImagesFolder) set clearFail to false on error set clearFail to true end try try rm_all(imagesToProcessFolder) set clearFail to false on error set clearFail to true end try --displays a dialog to alert user if there were any errors, or exit cleanly if not if errorOccured then tell application "Microsoft Excel" open file "HOM_Shortrun:Merge Error Log.txt" end tell display dialog "Some jobs did not process correctly" end if if clearFail then display dialog "Process image folders may not have been cleared out successfully" end if
alloy4fun_models/trainstlt/models/4/6CAboyGNzJ8ekxsiu.als
Kaixi26/org.alloytools.alloy
0
3149
<gh_stars>0 open main pred id6CAboyGNzJ8ekxsiu_prop5 { always (all t:Train|(one t.pos:> Exit and some t.pos.prox => no t.pos')) always (all t:Train| (one t.pos and some t.pos.prox ) => (t.pos' in t.pos.prox or t.pos'=t.pos) ) } pred __repair { id6CAboyGNzJ8ekxsiu_prop5 } check __repair { id6CAboyGNzJ8ekxsiu_prop5 <=> prop5o }
WSpiceBuilder/src/MATLABParser.g4
lintondf/WSpice
0
5609
parser grammar MATLABParser; options { tokenVocab=MATLABLexer;} @header { package wspice; } fileDecl : (functionDecl | classDecl)? (functionDecl* | partialFunctionDecl*) | partialFunctionDecl+ | statBlock+ // Script | EOF ; script : statBlock* ; endStat // : (NL|COMMA|SEMI) NL* : (NL|COMMA|SEMI) ; endStatNL : NL+ ; // Function declaration without the closing end partialFunctionDecl : FUNCTION outArgs? ID inArgs? endStat statBlock* ; // Normal function declaration including closing end functionDecl : partialFunctionDecl END endStatNL NL* ; // Functions inside method blocks can be comma or semi separated methodDecl : partialFunctionDecl END endStat ; classDecl : CLASSDEF ID endStat (propBlockDecl|methodBlockDecl)* END (EOF|endStat) NL* ; propBlockDecl : PROPERTIES endStat prop* END endStat ; methodBlockDecl : METHODS endStat methodDecl* END endStat ; outArgs : ID EQUALS | LBRACK ID (COMMA ID)* RBRACK EQUALS ; inArgs : LPAREN ID (COMMA ID)* RPAREN | LPAREN RPAREN ; prop : ID (EQUALS expr)? endStat ; idRef : ID (DOT ID)* ; statBlock : (stat endStat*) ; ifStat : IF expr endStat statBlock* (ELSEIF expr endStat statBlock*)* (ELSE endStat? statBlock*)? END ; whileStat : WHILE expr endStat statBlock* END ; forStat : FOR idRef EQUALS expr endStat statBlock* END ; caseStat : SWITCH expr endStat (CASE expr endStat statBlock*)* (OTHERWISE endStat statBlock*)? END ; scalarAssignStat : idRef EQUALS expr ; arrayAssignStat : arrayRef EQUALS expr ; stat : scalarAssignStat | arrayAssignStat | ifStat | forStat | whileStat | caseStat | expr // | NL ; arrayRef : idRef LPAREN exprArrayList RPAREN | idRef LPAREN COLON RPAREN | idRef LPAREN RPAREN ; arrayExpr : LBRACK exprArrayList RBRACK | LBRACK RBRACK ; cellExpr : LBRACE exprArrayList RBRACE | LBRACE RBRACE ; expr : arrayRef | expr (TRANS|CTRANS) | expr (MPOW|POW) expr | (PLUS|MINUS|NOT) expr | expr (MTIMES|TIMES|MLDIVIDE|LDIVIDE|MRDIVIDE|RDIVIDE) expr | expr (PLUS|MINUS) expr | expr COLON expr (COLON expr)? | expr (NOT|EQUALTO|NOTEQUALTO|GT|LT|GE|LE) expr | expr VECAND expr | expr VECOR expr | expr SCALAND expr | expr SCALOR expr | idRef | INT | FLOAT | SCI | STRING | arrayExpr | cellExpr | LPAREN expr RPAREN ; exprList : expr (',' expr)* ; exprArrayList : expr (COMMA? expr)* #hcat | expr ((SEMI|NL) expr)* #vcat // : expr (COMMA? exprArrayList)* #hcat // | expr ((SEMI|NL) exprArrayList)* #vcat ;
Task/Loops-Infinite/AppleScript/loops-infinite.applescript
LaudateCorpus1/RosettaCodeData
1
2960
repeat log "SPAM" end repeat
programs/oeis/047/A047375.asm
karttu/loda
0
243157
; A047375: Numbers that are congruent to {0, 4, 5} mod 7. ; 0,4,5,7,11,12,14,18,19,21,25,26,28,32,33,35,39,40,42,46,47,49,53,54,56,60,61,63,67,68,70,74,75,77,81,82,84,88,89,91,95,96,98,102,103,105,109,110,112,116,117,119,123,124,126,130,131,133,137,138,140 mov $1,$0 mov $2,$0 lpb $2,1 trn $2,2 add $2,3 add $1,$2 trn $2,4 sub $1,$2 lpe
.emacs.d/elpa/wisi-2.1.1/sal-gen_unbounded_definite_min_heaps_fibonacci.adb
caqg/linux-home
0
26693
-- Abstract: -- -- See spec. -- -- Copyright (C) 2017 - 2019 Free Software Foundation, Inc. -- -- This library is free software; you can redistribute it and/or modify it -- under terms of the GNU General Public License as published by the Free -- Software Foundation; either version 3, or (at your option) any later -- version. This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- TABILITY 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. pragma License (Modified_GPL); with Ada.Unchecked_Deallocation; with Long_Float_Elementary_Functions; package body SAL.Gen_Unbounded_Definite_Min_Heaps_Fibonacci is ---------- -- local subprogram specs (as needed), alphabetical order procedure Insert_Into_Root_List (Heap : in out Heap_Type; X : in Node_Access); procedure Link (Y, X : in Node_Access); procedure Remove_From_List (X : in Node_Access); procedure Swap (A, B : in out Node_Access); ---------- -- local subprogram bodies, alphabetical order function Add (Heap : in out Heap_Type; Item : in Element_Type) return Node_Access is X : constant Node_Access := new Node'(Item, null, null, null, null, 0, False); begin -- [1] 19.2 FIB-HEAP-INSERT if Heap.Min = null then Heap.Min := X; Heap.Min.Left := Heap.Min; Heap.Min.Right := Heap.Min; else Insert_Into_Root_List (Heap, X); if Key (Item) < Key (Heap.Min.Element) then Heap.Min := X; end if; end if; Heap.Count := Heap.Count + 1; return X; end Add; procedure Consolidate (Heap : in out Heap_Type) is -- [1] 19.4 max degree of Fibonacci heap Phi : constant := 1.61803398874989484820458683436563811772; -- https://oeis.org/A001622/constant Max_Degree : constant Integer := Integer (Long_Float_Elementary_Functions.Log (Long_Float (Heap.Count), Base => Phi)); -- [1] 19.2 CONSOLIDATE A : array (0 .. Max_Degree) of Node_Access := (others => null); W : Node_Access := Heap.Min; Last : Node_Access := Heap.Min; X, Y : Node_Access; D : Integer; Min_Key : Key_Type; begin loop X := W; W := W.Right; D := X.Degree; loop exit when A (D) = null; Y := A (D); if Key (Y.Element) < Key (X.Element) then Swap (X, Y); end if; if Y = Last and W /= Last then Last := Y.Right; end if; Link (Y, X); A (D) := null; D := D + 1; exit when D = A'Last; end loop; A (D) := X; exit when W = Last; end loop; Heap.Min := null; for I in A'Range loop if A (I) /= null then if Heap.Min = null then Heap.Min := A (I); Heap.Min.Left := Heap.Min; Heap.Min.Right := Heap.Min; Min_Key := Key (Heap.Min.Element); else Insert_Into_Root_List (Heap, A (I)); if Key (A (I).Element) < Min_Key then Heap.Min := A (I); Min_Key := Key (A (I).Element); end if; end if; end if; end loop; end Consolidate; procedure Copy_Node (Old_Obj : in Node_Access; New_Obj : in out Heap_Type) is Child : Node_Access; begin if Old_Obj = null then return; end if; if Old_Obj.Child /= null then Child := Old_Obj.Child; loop Add (New_Obj, Child.Element); Child := Child.Right; exit when Child = Old_Obj.Child; end loop; end if; Add (New_Obj, Old_Obj.Element); end Copy_Node; procedure Free is new Ada.Unchecked_Deallocation (Node, Node_Access); procedure Free_Node (Item : in out Node_Access) is Child : Node_Access; Temp : Node_Access; begin if Item = null then return; end if; -- Parent has already been free'd -- Siblings are freed by caller -- Free children if Item.Child /= null then Child := Item.Child; loop Temp := Child; Child := Child.Right; Free_Node (Temp); exit when Child = Item.Child; end loop; end if; Free (Item); end Free_Node; procedure Insert_Into_Root_List (Heap : in out Heap_Type; X : in Node_Access) is begin -- match [1] fig 19.3 X.Right := Heap.Min; X.Left := Heap.Min.Left; Heap.Min.Left.Right := X; Heap.Min.Left := X; end Insert_Into_Root_List; procedure Link (Y, X : in Node_Access) is begin -- [1] 19.2 FIB-HEAP-LINK Remove_From_List (Y); Y.Parent := X; X.Degree := X.Degree + 1; if X.Child = null then X.Child := Y; Y.Right := Y; Y.Left := Y; else -- Insert Y into X child list Y.Right := X.Child; Y.Left := X.Child.Left; X.Child.Left.Right := Y; X.Child.Left := Y; end if; Y.Mark := False; end Link; procedure Remove_From_List (X : in Node_Access) is begin X.Left.Right := X.Right; X.Right.Left := X.Left; end Remove_From_List; procedure Swap (A, B : in out Node_Access) is C : constant Node_Access := A; begin A := B; B := C; end Swap; ---------- -- Visible operations overriding procedure Initialize (Object : in out Heap_Type) is begin -- Min is null by default. Object.Count := 0; end Initialize; overriding procedure Finalize (Object : in out Heap_Type) is Next : Node_Access := Object.Min; Temp : Node_Access; begin if Next = null then return; end if; loop Temp := Next; Next := Next.Right; Free_Node (Temp); exit when Next = Object.Min; end loop; Object.Min := null; Object.Count := 0; end Finalize; overriding procedure Adjust (Object : in out Heap_Type) is Old_Obj : Node_Access := Object.Min; Last : constant Node_Access := Old_Obj; begin if Old_Obj = null then return; end if; Object.Min := null; Object.Count := 0; loop Copy_Node (Old_Obj, Object); Old_Obj := Old_Obj.Right; exit when Old_Obj = Last; end loop; end Adjust; procedure Clear (Heap : in out Heap_Type) is begin Finalize (Heap); end Clear; function Count (Heap : in Heap_Type) return Base_Peek_Type is begin return Heap.Count; end Count; function Remove (Heap : in out Heap_Type) return Element_Type is Z : Node_Access := Heap.Min; Child, Temp : Node_Access; begin if Heap.Count = 0 then raise Container_Empty; end if; -- [1] 19.2 FIB-HEAP-EXTRACT-MIN Child := Z.Child; for I in 1 .. Z.Degree loop Temp := Child; Child := Child.Right; Temp.Parent := null; Insert_Into_Root_List (Heap, Temp); end loop; Remove_From_List (Z); if Z.Right = Z then Heap.Min := null; else Heap.Min := Z.Right; Consolidate (Heap); end if; Heap.Count := Heap.Count - 1; return Result : constant Element_Type := Z.Element do Free (Z); end return; end Remove; function Min_Key (Heap : in out Heap_Type) return Key_Type is begin return Key (Heap.Min.Element); end Min_Key; procedure Drop (Heap : in out Heap_Type) is Junk : Element_Type := Remove (Heap); pragma Unreferenced (Junk); begin null; end Drop; procedure Add (Heap : in out Heap_Type; Item : in Element_Type) is X : constant Node_Access := Add (Heap, Item); pragma Unreferenced (X); begin null; end Add; function Add (Heap : in out Heap_Type; Item : in Element_Type) return Element_Access is X : constant Node_Access := Add (Heap, Item); begin return X.all.Element'Access; end Add; function Peek (Heap : in Heap_Type) return Constant_Reference_Type is begin return (Element => Heap.Min.all.Element'Access); end Peek; procedure Process (Heap : in Heap_Type; Process_Element : access procedure (Element : in Element_Type)) is type Cursor is record -- Every node is in a circular list. List_Origin is the node where we -- entered the list, so we know when we are done. Node : Node_Access; List_Origin : Node_Access; end record; Cur : Cursor := (Heap.Min, Heap.Min); procedure Process_Node (Cur : in out Cursor) is Next_Cur : Cursor; begin loop if Cur.Node.Child /= null then Next_Cur := (Cur.Node.Child, Cur.Node.Child); Process_Node (Next_Cur); end if; Process_Element (Cur.Node.Element); Cur.Node := Cur.Node.Right; exit when Cur.Node = Cur.List_Origin; end loop; end Process_Node; begin if Cur.Node /= null then Process_Node (Cur); end if; end Process; end SAL.Gen_Unbounded_Definite_Min_Heaps_Fibonacci;
stage2/boot2.asm
amrwc/8086-graphics
5
29585
<reponame>amrwc/8086-graphics<gh_stars>1-10 ORG 9000h jmp Stage_2_Start %include "print_functions_16_SF.asm" %include "graphics_line.asm" %include "graphics_colour_menu.asm" ; Assignment Stage 2 -- draw a line using Bresenham’s algorithm, ; but pass the values using the stack frame. Stage_2_Start: push word horizontal_line call Console_WriteLine_16 call New_Line_16 call Graphics_Line ;____________________ Halt: mov ax, 0003h ; Clear screen int 10h push word goodbye_message call Console_Write_16 hlt ;____________________ ; Data horizontal_line: db '____________________', 0 goodbye_message: db 'Goodbye!', 0 ;____________________ times 3584 - ($ - $$) db 0
src/test/resources/testData/parse/live_samples/native_classes.scpt
stigger/AppleScript-IDEA
18
4686
<reponame>stigger/AppleScript-IDEA --- Choose an application to watch --- Choose an application to open when this application is activated --- Can also be used for watching/launching documents/files/scripts (ostensibly. hasn't been tested) --- NOTE: sometimes does not work with applications that have multiple names tell application "Finder" set wapp_name to choose file with prompt "What application should I watch?" default location "/Applications" tell application "Finder" to set {dispName, nameExt, isHidden} to the {displayed name, name extension, extension hidden} of wapp_name if isHidden or nameExt is equal to "" then dispName else (characters 1 through (-2 - (count of nameExt)) of dispName) as text end if set baseName to result set fwapp_name to baseName delay 0.4 set oapp_name to choose file with prompt "What application should open when " & fwapp_name & " is activated?" set poapp_name to POSIX path of oapp_name tell application "Finder" to set {odispName, onameExt, oisHidden} to the {displayed name, name extension, extension hidden} of oapp_name if oisHidden or onameExt is equal to "" then odispName else (characters 1 through (-2 - (count of onameExt)) of odispName) as text end if set obaseName to result set foapp_name to obaseName repeat tell application "System Events" set process_list to the name of every process whose visible is true if process_list contains fwapp_name then open oapp_name exit repeat else delay 10 end if end tell end repeat end tell word 1 --- http://www.scriptogr.am/unforswearing --- http://www.github.com/unforswearing --- <EMAIL>
programs/oeis/040/A040404.asm
jmorken/loda
1
474
; A040404: Continued fraction for sqrt(425). ; 20,1,1,1,1,1,1,40,1,1,1,1,1,1,40,1,1,1,1,1,1,40,1,1,1,1,1,1,40,1,1,1,1,1,1,40,1,1,1,1,1,1,40,1,1,1,1,1,1,40,1,1,1,1,1,1,40,1,1,1,1,1,1,40,1,1,1,1,1,1,40,1,1,1,1,1,1,40,1,1,1,1,1,1,40,1,1 mov $4,2 mov $5,$0 lpb $4 mov $0,$5 sub $4,1 add $0,$4 sub $0,1 div $0,7 mov $2,$4 mov $3,$0 add $3,1 add $3,$0 mul $3,20 sub $3,$0 sub $3,1 lpb $2 mov $1,$3 sub $2,1 lpe lpe lpb $5 sub $1,$3 mov $5,0 lpe add $1,1
programs/oeis/092/A092754.asm
neoneye/loda
22
92625
<gh_stars>10-100 ; A092754: a(1)=1, a(2n)=2a(n)+1, a(2n+1)=2a(n)+2. ; 1,3,4,7,8,9,10,15,16,17,18,19,20,21,22,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163 mov $1,$0 mov $2,1 lpb $1 mul $2,2 trn $1,$2 lpe add $0,$2
6/filereader/filereader_2nasm_poly.asm
91fc7b/SLAE
0
169973
<gh_stars>0 global _start section .text _start: xor eax,eax xor ebx,ebx xor ecx,ecx xor edx,edx jmp two one: pop ebx ;mov al,0x5 add al,10 sub al,5 xor ecx,ecx int 0x80 mov esi,eax jmp read exit: ;mov al,0x1 xor eax,eax inc al xor ebx,ebx int 0x80 read: mov ebx,esi ;mov al,0x3 mov al,10 sub al,7 sub esp,0x1 lea ecx,[esp] mov dl,0x1 int 0x80 xor ebx,ebx cmp ebx,eax je exit ;mov al,0x4 mov al,1 add al,3 ;mov bl,0x1 xor ebx,ebx inc ebx ;mov dl,0x1 xor edx,edx inc edx int 0x80 add esp,0x1 jmp read two: call one message db '/etc/passwd'
libsrc/_DEVELOPMENT/arch/zxn/nextos/z80/__nextos_pageout.asm
jpoikela/z88dk
640
94107
SECTION code_arch PUBLIC __nextos_page_out EXTERN __nextos_head EXTERN __IO_NEXTREG_REG, __REG_MMU0 __nextos_page_out: ; restore former 8k page before nextos was brought in ; ; enter : a = former 8k page before page in ; ; exit : former 8k page restored in memory ; ; uses : af, bc', l' exx ld l,a ld a,__nextos_head/256 ; section address start rlca rlca rlca and $07 ; a = mmu page nextos belongs in add a,__REG_MMU0 ld bc,__IO_NEXTREG_REG out (c),a inc b out (c),l exx ret
u7-common/patch-eop-determineItemBulk.asm
JohnGlassmyer/UltimaHacks
68
80041
; Calculate an item's bulk (an integer used to determined whether an item ; will fit into a container). Unless the item is a flexible container (a bag or ; backpack), this is done as in the original game, by looking up the value in a ; table indexed by item-type. However, if the item is a flexible container, ; then its bulk is instead determined to be the sum of the total bulk of its ; contents and one eighth of its table value. ; ; This makes flexible containers less bulky when they are empty or only ; partially full, in particular allowing more bags to fit within a backpack ; and allowing bags and/or backpacks to be placed within each other. ; ; (The original game had no concept of flexible containers; an empty bag would ; take up as much space as a full bag.) [bits 16] startPatch EXE_LENGTH, eop-determineItemBulk ITEM_TYPE_BACKPACK EQU 801 ITEM_TYPE_BAG EQU 802 startBlockAt addr_eop_determineItemBulk push bp mov bp, sp ; bp-based stack frame: %assign arg_ibo 0x04 %assign ____callerIp 0x02 %assign ____callerBp 0x00 %assign var_itemBulk -0x02 add sp, var_itemBulk push si push di mov es, word [dseg_itemBufferSegment] ; get type mov bx, [bp+arg_ibo] mov ax, [es:bx+4] and ax, 0x3FF cmp ax, ITEM_TYPE_BAG jz flexibleContainer cmp ax, ITEM_TYPE_BACKPACK jz flexibleContainer jmp short notFlexibleContainer flexibleContainer: ; bulk = contentsBulk + max(containerBulk / 8, 1) push ax callFromOverlay getItemTypeBulk pop cx shr ax, 3 cmp ax, 0 jnz haveWeightOfContainer mov ax, 1 haveWeightOfContainer: mov [bp+var_itemBulk], ax lea ax, [bp+arg_ibo] push ax callFromOverlay determineBulkOfContents pop cx mov bx, [bp+var_itemBulk] add ax, bx jmp short procEnd notFlexibleContainer: push ax callFromOverlay getItemTypeBulk pop cx procEnd: ; return ax = bulk of item pop di pop si mov sp, bp pop bp retn endBlockAt off_eop_determineItemBulk_end endPatch
agda/examples-that-run/getline/src-agda/getline.agda
haroldcarr/learn-haskell-coq-ml-etc
36
918
<filename>agda/examples-that-run/getline/src-agda/getline.agda module getline where -- https://github.com/alhassy/AgdaCheatSheet#interacting-with-the-real-world-compilation-haskell-and-io open import Data.Nat using (ℕ; suc) open import Data.Nat.Show using (show) open import Data.Char using (Char) open import Data.List as L using (map; sum; upTo) open import Function using (_$_; const; _∘_) open import Data.String as S using (String; _++_; fromList) open import Agda.Builtin.Unit using (⊤) open import Codata.Musical.Colist using (take) open import Codata.Musical.Costring using (Costring) open import Data.Vec.Bounded as B using (toList) open import Agda.Builtin.Coinduction using (♯_) open import IO as IO using (run ; putStrLn ; IO) import IO.Primitive as Primitive infixr 1 _>>=_ _>>_ _>>=_ : ∀ {ℓ} {α β : Set ℓ} → IO α → (α → IO β) → IO β this >>= f = ♯ this IO.>>= λ x → ♯ f x _>>_ : ∀{ℓ} {α β : Set ℓ} → IO α → IO β → IO β x >> y = x >>= const y postulate getLine∞ : Primitive.IO Costring {-# FOREIGN GHC toColist :: [a] -> MAlonzo.Code.Codata.Musical.Colist.AgdaColist a toColist [] = MAlonzo.Code.Codata.Musical.Colist.Nil toColist (x : xs) = MAlonzo.Code.Codata.Musical.Colist.Cons x (MAlonzo.RTE.Sharp (toColist xs)) #-} {- Haskell's prelude is implicitly available; this is for demonstration. -} {-# FOREIGN GHC import Prelude as Haskell #-} {-# COMPILE GHC getLine∞ = fmap toColist Haskell.getLine #-} -- (1) -- getLine : IO Costring -- getLine = IO.lift getLine∞ getLine : IO String getLine = IO.lift $ getLine∞ Primitive.>>= (Primitive.return ∘ S.fromList ∘ B.toList ∘ take 100) postulate readInt : L.List Char → ℕ {-# COMPILE GHC readInt = \x -> read x :: Integer #-} main : Primitive.IO ⊤ main = run do putStrLn "Hello, world! I'm a compiled Agda program!" IO.putStrLn "What is your name?:" name ← getLine IO.putStrLn "Please enter a number:" num ← getLine let tri = show $ sum $ upTo $ suc $ readInt $ S.toList num putStrLn $ "The triangle number of " ++ num ++ " is " ++ tri putStrLn ("Bye, " ++ name) -- IO.putStrLn∞ ("Bye, " ++ name) {- If using approach (1) above. -}
src/seven.ads
JeremyGrosser/sensors
1
5436
<reponame>JeremyGrosser/sensors -- -- Copyright (C) 2021 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: BSD-3-Clause -- -- Adafruit 16x8 LED Matrix Driver Backpack - HT16K33 Breakout -- https://www.adafruit.com/product/1427 -- with HAL; use HAL; with HT16K33; package Seven is type Device is new HT16K33.Device with private; subtype Position is Integer range 1 .. 4; subtype Digit is Integer range 0 .. 9; subtype Point_Number is Integer range 1 .. 4; procedure Set_Digit (This : in out Device; Pos : Position; Val : Digit); procedure Set_Colon (This : in out Device; On : Boolean); procedure Set_Point (This : in out Device; Num : Point_Number; On : Boolean); private Numbers : constant array (Digit) of UInt8 := (0 => 16#3F#, 1 => 16#06#, 2 => 16#5B#, 3 => 16#4F#, 4 => 16#66#, 5 => 16#6D#, 6 => 16#7D#, 7 => 16#07#, 8 => 16#7F#, 9 => 16#6F#); Points : constant array (Point_Number) of HT16K33.Output_Index := (7, 23, 55, 71); type Device is new HT16K33.Device with null record; end Seven;
Data/Num/Core.agda
banacorn/numeral
1
8673
module Data.Num.Core where open import Data.Num.Digit public open import Data.Nat open import Data.Nat.Properties open import Data.Nat.Properties.Simple open import Data.Nat.Properties.Extra open import Data.Fin as Fin using (Fin; fromℕ≤; inject≤; toℕ; zero; suc; #_) open import Data.Fin.Properties as FinProps using (bounded; toℕ-fromℕ≤) open import Function open import Relation.Binary.PropositionalEquality open import Relation.Nullary open import Relation.Nullary.Negation open import Relation.Nullary.Decidable open import Relation.Binary open import Function.Equality using (_⟶_) open ≡-Reasoning open ≤-Reasoning renaming (begin_ to start_; _∎ to _□; _≡⟨_⟩_ to _≈⟨_⟩_) open DecTotalOrder decTotalOrder using (reflexive) renaming (refl to ≤-refl) ------------------------------------------------------------------------ -- Numbers ------------------------------------------------------------------------ infixr 5 _∷_ data Numeral : ℕ → ℕ → ℕ → Set where _∙ : ∀ {b d o} → Digit d → Numeral b d o _∷_ : ∀ {b d o} → Digit d → Numeral b d o → Numeral b d o MMXVI : Numeral 10 10 0 MMXVI = # 6 ∷ # 1 ∷ # 0 ∷ (# 2) ∙ ------------------------------------------------------------------------ -- Converting from Numeral to ℕ ------------------------------------------------------------------------ ⟦_⟧ : ∀ {b d o} → (xs : Numeral b d o) → ℕ ⟦_⟧ {_} {_} {o} (x ∙) = Digit-toℕ x o ⟦_⟧ {b} {_} {o} (x ∷ xs) = Digit-toℕ x o + ⟦ xs ⟧ * b Num-lower-bound : ∀ {b d o} → (xs : Numeral b (suc d) o) → ⟦ xs ⟧ ≥ o Num-lower-bound {_} {_} {o} (x ∙) = Digit-lower-bound o x Num-lower-bound {b} {d} {o} (x ∷ xs) = start o ≤⟨ m≤m+n o (⟦ xs ⟧ * b) ⟩ o + ⟦ xs ⟧ * b ≤⟨ +n-mono (⟦ xs ⟧ * b) (Digit-lower-bound o x) ⟩ Digit-toℕ x o + ⟦ xs ⟧ * b □ -- the least significant digit lsd : ∀ {b d o} → (xs : Numeral b d o) → Digit d lsd (x ∙ ) = x lsd (x ∷ xs) = x lsd-toℕ : ∀ {b d o} → (xs : Numeral b d o) → Digit-toℕ (lsd xs) o ≤ ⟦ xs ⟧ lsd-toℕ (x ∙) = ≤-refl lsd-toℕ {b} {d} {o} (x ∷ xs) = m≤m+n (Digit-toℕ x o) (⟦ xs ⟧ * b) ------------------------------------------------------------------------ -- View of Num ------------------------------------------------------------------------ data NumView : ℕ → ℕ → ℕ → Set where NullBase : ∀ d o → NumView 0 (suc d) o NoDigits : ∀ b o → NumView b 0 o AllZeros : ∀ b → NumView (suc b) 1 0 Proper : ∀ b d o → (proper : suc d + o ≥ 2) → NumView (suc b) (suc d) o numView : ∀ b d o → NumView b d o numView b zero o = NoDigits b o numView zero (suc d) o = NullBase d o numView (suc b) (suc zero) zero = AllZeros b numView (suc b) (suc zero) (suc o) = Proper b zero (suc o) (s≤s (s≤s z≤n)) numView (suc b) (suc (suc d)) o = Proper b (suc d) o (s≤s (s≤s z≤n)) ------------------------------------------------------------------------ -- Properties of Num ------------------------------------------------------------------------ NoDigits-explode : ∀ {b o a} {Whatever : Set a} → (xs : Numeral b 0 o) → Whatever NoDigits-explode (() ∙ ) NoDigits-explode (() ∷ xs) toℕ-NullBase : ∀ {d o} → (x : Digit d) → (xs : Numeral 0 d o) → ⟦ x ∷ xs ⟧ ≡ Digit-toℕ x o toℕ-NullBase {d} {o} x xs = begin Digit-toℕ x o + ⟦ xs ⟧ * 0 ≡⟨ cong (λ w → Digit-toℕ x o + w) (*-right-zero ⟦ xs ⟧) ⟩ Digit-toℕ x o + 0 ≡⟨ +-right-identity (Digit-toℕ x o) ⟩ Digit-toℕ x o ∎ toℕ-AllZeros : ∀ {b} → (xs : Numeral b 1 0) → ⟦ xs ⟧ ≡ 0 toℕ-AllZeros (zero ∙ ) = refl toℕ-AllZeros (suc () ∙ ) toℕ-AllZeros {b} (zero ∷ xs) = cong (λ w → w * b) (toℕ-AllZeros xs) toℕ-AllZeros (suc () ∷ xs) n∷-mono-strict : ∀ {b d o} → (x : Fin d) (xs : Numeral (suc b) d o) → (y : Fin d) (ys : Numeral (suc b) d o) → Digit-toℕ x o ≡ Digit-toℕ y o → ⟦ xs ⟧ < ⟦ ys ⟧ → ⟦ x ∷ xs ⟧ < ⟦ y ∷ ys ⟧ n∷-mono-strict {b} {d} {o} x xs y ys ⟦x⟧≡⟦y⟧ ⟦xs⟧<⟦ys⟧ = start suc (Digit-toℕ x o) + ⟦ xs ⟧ * suc b ≈⟨ sym (+-suc (Digit-toℕ x o) (⟦ xs ⟧ * suc b)) ⟩ Digit-toℕ x o + suc (⟦ xs ⟧ * suc b) ≤⟨ n+-mono (Digit-toℕ x o) (s≤s (n≤m+n b (⟦ xs ⟧ * suc b))) ⟩ Digit-toℕ x o + (suc ⟦ xs ⟧) * suc b ≤⟨ (reflexive ⟦x⟧≡⟦y⟧) +-mono (*n-mono (suc b) ⟦xs⟧<⟦ys⟧) ⟩ Digit-toℕ y o + ⟦ ys ⟧ * suc b □ ∷ns-mono-strict : ∀ {b d o} → (x : Fin d) (xs : Numeral b d o) → (y : Fin d) (ys : Numeral b d o) → ⟦ xs ⟧ ≡ ⟦ ys ⟧ → Digit-toℕ x o < Digit-toℕ y o → ⟦ x ∷ xs ⟧ < ⟦ y ∷ ys ⟧ ∷ns-mono-strict {b} {d} {o} x xs y ys ⟦xs⟧≡⟦ys⟧ ⟦x⟧<⟦y⟧ = start suc ⟦ x ∷ xs ⟧ ≤⟨ ⟦x⟧<⟦y⟧ +-mono *n-mono b (reflexive ⟦xs⟧≡⟦ys⟧) ⟩ ⟦ y ∷ ys ⟧ □ tail-mono-strict : ∀ {b d o} → (x : Fin d) (xs : Numeral b d o) → (y : Fin d) (ys : Numeral b d o) → Greatest x → ⟦ x ∷ xs ⟧ < ⟦ y ∷ ys ⟧ → ⟦ xs ⟧ < ⟦ ys ⟧ tail-mono-strict {b} {_} {o} x xs y ys greatest p = *n-mono-strict-inverse b ⟦∷xs⟧<⟦∷ys⟧ where ⟦x⟧≥⟦y⟧ : Digit-toℕ x o ≥ Digit-toℕ y o ⟦x⟧≥⟦y⟧ = greatest-of-all o x y greatest ⟦∷xs⟧<⟦∷ys⟧ : ⟦ xs ⟧ * b < ⟦ ys ⟧ * b ⟦∷xs⟧<⟦∷ys⟧ = +-mono-contra ⟦x⟧≥⟦y⟧ p tail-mono-strict-Null : ∀ {b d o} → (x : Fin d) → (y : Fin d) (ys : Numeral b d o) → Greatest x → ⟦ _∙ {b} {d} {o} x ⟧ < ⟦ y ∷ ys ⟧ → 0 < ⟦ ys ⟧ tail-mono-strict-Null {b} {_} {o} x y ys greatest p = *n-mono-strict-inverse b ⟦∷∙⟧<⟦∷ys⟧ where ⟦x⟧≥⟦y⟧ : Digit-toℕ x o ≥ Digit-toℕ y o ⟦x⟧≥⟦y⟧ = greatest-of-all o x y greatest ⟦∷∙⟧<⟦∷ys⟧ : 0 < ⟦ ys ⟧ * b ⟦∷∙⟧<⟦∷ys⟧ = +-mono-contra ⟦x⟧≥⟦y⟧ $ start suc (Digit-toℕ x o) + 0 ≈⟨ +-right-identity (suc (Digit-toℕ x o)) ⟩ suc (Digit-toℕ x o) ≤⟨ p ⟩ ⟦ y ∷ ys ⟧ □
oeis/348/A348407.asm
neoneye/loda-programs
11
244079
<filename>oeis/348/A348407.asm ; A348407: a(n) = ((n+1)*3*2^(n+1) + 29*2^n + (-1)^n)/9. ; Submitted by <NAME>(s2) ; 4,9,21,47,105,231,505,1095,2361,5063,10809,22983,48697,102855,216633,455111,953913,1995207,4165177,8679879,18058809,37515719,77827641,161247687,333680185,689729991,1424199225,2937876935,6054710841,12467335623,25650499129,52732654023,108328619577 mov $2,$0 lpb $2 add $0,$1 add $0,6 mul $0,2 add $0,$2 cmp $1,0 sub $2,1 lpe div $0,3 add $0,4
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/unchecked_convert8.ads
best08618/asylo
7
22427
<reponame>best08618/asylo<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/unchecked_convert8.ads<gh_stars>1-10 package Unchecked_Convert8 is procedure Dummy; end Unchecked_Convert8;
oeis/144/A144411.asm
neoneye/loda-programs
11
8998
<filename>oeis/144/A144411.asm ; A144411: Odd nonprime gaps adjusted to be {2,1,0,-1}: a(n)=A067970(n)/2-2. ; Submitted by <NAME>(s1) ; 2,1,1,0,-1,1,-1,0,1,0,-1,0,-1,1,-1,0,1,-1,0,0,-1,0,-1,-1,0,1,1,0,-1,-1,-1,-1,-1,0,0,-1,1,-1,-1,-1,1,-1,0,-1,0,0,-1,0,-1,1,-1,-1,-1,1,1,-1,-1,-1,-1,0,-1,-1,-1,-1,0,1,0,-1,1,-1,-1,-1,0,-1,0,-1,0,-1,1,-1,0,1,-1,-1,-1,0,-1,-1,-1,-1,-1,0,1,0,-1,-1,-1,-1,-1,0 seq $0,196274 ; Half of the gaps A067970 between odd nonprimes A014076. sub $0,2
include/sf-graphics-view.ads
Fabien-Chouteau/ASFML
0
28644
--////////////////////////////////////////////////////////// -- SFML - Simple and Fast Multimedia Library -- Copyright (C) 2007-2015 <NAME> (<EMAIL>) -- This software is provided 'as-is', without any express or implied warranty. -- In no event will the authors be held liable for any damages arising from the use of this software. -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it freely, -- subject to the following restrictions: -- 1. The origin of this software must not be misrepresented; -- you must not claim that you wrote the original software. -- If you use this software in a product, an acknowledgment -- in the product documentation would be appreciated but is not required. -- 2. Altered source versions must be plainly marked as such, -- and must not be misrepresented as being the original software. -- 3. This notice may not be removed or altered from any source distribution. --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// with Sf.Graphics.Rect; with Sf.System.Vector2; package Sf.Graphics.View is --////////////////////////////////////////////////////////// --/ @brief Create a default view --/ --/ This function creates a default view of (0, 0, 1000, 1000) --/ --/ @return A new sfView object --/ --////////////////////////////////////////////////////////// function create return sfView_Ptr; --////////////////////////////////////////////////////////// --/ @brief Construct a view from a rectangle --/ --/ @param rectangle Rectangle defining the zone to display --/ --/ @return A new sfView object --/ --////////////////////////////////////////////////////////// function createFromRect (rectangle : Sf.Graphics.Rect.sfFloatRect) return sfView_Ptr; --////////////////////////////////////////////////////////// --/ @brief Copy an existing view --/ --/ @param view View to copy --/ --/ @return Copied object --/ --////////////////////////////////////////////////////////// function copy (view : sfView_Ptr) return sfView_Ptr; --////////////////////////////////////////////////////////// --/ @brief Destroy an existing view --/ --/ @param view View to destroy --/ --////////////////////////////////////////////////////////// procedure destroy (view : sfView_Ptr); --////////////////////////////////////////////////////////// --/ @brief Set the center of a view --/ --/ @param view View object --/ @param center New center --/ --////////////////////////////////////////////////////////// procedure setCenter (view : sfView_Ptr; center : Sf.System.Vector2.sfVector2f); --////////////////////////////////////////////////////////// --/ @brief Set the size of a view --/ --/ @param view View object --/ @param size New size of the view --/ --////////////////////////////////////////////////////////// procedure setSize (view : sfView_Ptr; size : Sf.System.Vector2.sfVector2f); --////////////////////////////////////////////////////////// --/ @brief Set the orientation of a view --/ --/ The default rotation of a view is 0 degree. --/ --/ @param view View object --/ @param angle New angle, in degrees --/ --////////////////////////////////////////////////////////// procedure setRotation (view : sfView_Ptr; angle : float); --////////////////////////////////////////////////////////// --/ @brief Set the target viewport of a view --/ --/ The viewport is the rectangle into which the contents of the --/ view are displayed, expressed as a factor (between 0 and 1) --/ of the size of the render target to which the view is applied. --/ For example, a view which takes the left side of the target would --/ be defined by a rect of (0, 0, 0.5, 1). --/ By default, a view has a viewport which covers the entire target. --/ --/ @param view View object --/ @param viewport New viewport rectangle --/ --////////////////////////////////////////////////////////// procedure setViewport (view : sfView_Ptr; viewport : Sf.Graphics.Rect.sfFloatRect); --////////////////////////////////////////////////////////// --/ @brief Reset a view to the given rectangle --/ --/ Note that this function resets the rotation angle to 0. --/ --/ @param view View object --/ @param rectangle Rectangle defining the zone to display --/ --////////////////////////////////////////////////////////// procedure reset (view : sfView_Ptr; rectangle : Sf.Graphics.Rect.sfFloatRect); --////////////////////////////////////////////////////////// --/ @brief Get the center of a view --/ --/ @param view View object --/ --/ @return Center of the view --/ --////////////////////////////////////////////////////////// function getCenter (view : sfView_Ptr) return Sf.System.Vector2.sfVector2f; --////////////////////////////////////////////////////////// --/ @brief Get the size of a view --/ --/ @param view View object --/ --/ @return Size of the view --/ --////////////////////////////////////////////////////////// function getSize (view : sfView_Ptr) return Sf.System.Vector2.sfVector2f; --////////////////////////////////////////////////////////// --/ @brief Get the current orientation of a view --/ --/ @param view View object --/ --/ @return Rotation angle of the view, in degrees --/ --////////////////////////////////////////////////////////// function getRotation (view : sfView_Ptr) return float; --////////////////////////////////////////////////////////// --/ @brief Get the target viewport rectangle of a view --/ --/ @param view View object --/ --/ @return Viewport rectangle, expressed as a factor of the target size --/ --////////////////////////////////////////////////////////// function getViewport (view : sfView_Ptr) return Sf.Graphics.Rect.sfFloatRect; --////////////////////////////////////////////////////////// --/ @brief Move a view relatively to its current position --/ --/ @param view View object --/ @param offset Offset --/ --////////////////////////////////////////////////////////// procedure move (view : sfView_Ptr; offset : Sf.System.Vector2.sfVector2f); --////////////////////////////////////////////////////////// --/ @brief Rotate a view relatively to its current orientation --/ --/ @param view View object --/ @param angle Angle to rotate, in degrees --/ --////////////////////////////////////////////////////////// procedure rotate (view : sfView_Ptr; angle : float); --////////////////////////////////////////////////////////// --/ @brief Resize a view rectangle relatively to its current size --/ --/ Resizing the view simulates a zoom, as the zone displayed on --/ screen grows or shrinks. --/ @a factor is a multiplier: --/ @li 1 keeps the size unchanged --/ @li > 1 makes the view bigger (objects appear smaller) --/ @li < 1 makes the view smaller (objects appear bigger) --/ --/ @param view View object --/ @param factor Zoom factor to apply --/ --////////////////////////////////////////////////////////// procedure zoom (view : sfView_Ptr; factor : float); private pragma Import (C, create, "sfView_create"); pragma Import (C, createFromRect, "sfView_createFromRect"); pragma Import (C, copy, "sfView_copy"); pragma Import (C, destroy, "sfView_destroy"); pragma Import (C, setCenter, "sfView_setCenter"); pragma Import (C, setSize, "sfView_setSize"); pragma Import (C, setRotation, "sfView_setRotation"); pragma Import (C, setViewport, "sfView_setViewport"); pragma Import (C, reset, "sfView_reset"); pragma Import (C, getCenter, "sfView_getCenter"); pragma Import (C, getSize, "sfView_getSize"); pragma Import (C, getRotation, "sfView_getRotation"); pragma Import (C, getViewport, "sfView_getViewport"); pragma Import (C, move, "sfView_move"); pragma Import (C, rotate, "sfView_rotate"); pragma Import (C, zoom, "sfView_zoom"); end Sf.Graphics.View;
test/Succeed/Issue2912.agda
shlevy/agda
1,989
5828
{-# OPTIONS -Werror -WnoEmptyRewritePragma #-} {-# REWRITE #-}
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/slice6.adb
best08618/asylo
7
13082
-- { dg-do compile } -- { dg-options "-gnatws" } with Slice6_Pkg; use Slice6_Pkg; procedure Slice6 is procedure Send (V_LENGTH : SHORT_INTEGER) is V : Integer; V_BLOCK : T_BLOCK (1 .. 4096); for V_BLOCK use at V'Address; V_MSG : T_MSG ; begin V_MSG := (V_LENGTH, 1, V_BLOCK (1 .. V_LENGTH)); end; begin null; end;
248b/sierlynxi/sierlynxi.asm
42Bastian/lynx_hacking
12
177173
*************** * 32Byte **************** ;;; ROM sets this address screen0 equ $2000 run $200 IFND LNX ;; Setup needed if loaded via BLL/Handy lda #8 sta $fff9 cli lda #$20 stz $fd94 sta $fd95 stz $fd50 ldy #2 ENDIF Start:: ldy #31 .00 tya sta $fda0,y dey bpl .00 .0 lda #$20 sta 1 asl tay .1 lda 0 and 1 sta (0) inc 0 bne .1 inc 1 dey bne .1 bra .0 End: size set End-Start free set 32-size IF free > 0 REPT free dc.b 0 ENDR ENDIF echo "Size:%dsize Free:%dfree"
sw/552tests/rand_complex/t_3_all.asm
JPShen-UWM/ThreadKraken
1
89403
// seed 3 lbi r0, 200 // icount 0 slbi r0, 221 // icount 1 lbi r1, 79 // icount 2 slbi r1, 68 // icount 3 lbi r2, 138 // icount 4 slbi r2, 111 // icount 5 lbi r3, 45 // icount 6 slbi r3, 59 // icount 7 lbi r4, 128 // icount 8 slbi r4, 155 // icount 9 lbi r5, 41 // icount 10 slbi r5, 3 // icount 11 lbi r6, 238 // icount 12 slbi r6, 172 // icount 13 lbi r7, 16 // icount 14 slbi r7, 232 // icount 15 sll r7, r7, r2 // icount 16 slbi r5, 1 // icount 17 j 14 // icount 18 nop // icount 19 nop // icount 20 nop // icount 21 nop // icount 22 nop // icount 23 nop // icount 24 nop // icount 25 lbi r1, 0 // icount 26 lbi r6, 0 // icount 27 nop // to align branch icount 28 beqz r2, 24 // icount 29 slt r1, r2, r7 // icount 30 xori r0, r5, 12 // icount 31 ror r4, r0, r7 // icount 32 rori r2, r5, 3 // icount 33 andn r5, r4, r4 // icount 34 nop // to align meminst icount 35 andni r5, r5, 1 // icount 36 ld r3, r5, 8 // icount 37 rol r4, r1, r1 // icount 38 srl r4, r1, r4 // icount 39 ror r0, r6, r3 // icount 40 lbi r0, 4 // icount 41 slt r7, r5, r0 // icount 42 seq r6, r7, r2 // icount 43 andni r2, r2, 1 // icount 44 st r5, r2, 12 // icount 45 xori r2, r3, 12 // icount 46 xor r5, r4, r4 // icount 47 andn r4, r1, r7 // icount 48 ror r0, r0, r7 // icount 49 slbi r6, 15 // icount 50 add r7, r0, r7 // icount 51 andni r0, r0, 1 // icount 52 st r0, r0, 0 // icount 53 add r4, r4, r0 // icount 54 srli r5, r7, 6 // icount 55 subi r6, r2, 14 // icount 56 lbi r2, 8 // icount 57 ror r0, r0, r5 // icount 58 addi r4, r7, 9 // icount 59 lbi r3, 14 // icount 60 rori r1, r3, 4 // icount 61 j 20 // icount 62 nop // icount 63 nop // icount 64 nop // icount 65 nop // icount 66 nop // icount 67 nop // icount 68 nop // icount 69 nop // icount 70 nop // icount 71 nop // icount 72 addi r7, r7, 9 // icount 73 andni r7, r7, 1 // icount 74 ld r1, r7, 6 // icount 75 srl r3, r0, r1 // icount 76 lbi r1, 0 // icount 77 lbi r6, 0 // icount 78 beqz r5, 16 // icount 79 rol r6, r3, r7 // icount 80 sle r5, r4, r5 // icount 81 slli r4, r7, 3 // icount 82 nop // to align meminst icount 83 andni r1, r1, 1 // icount 84 ld r1, r1, 14 // icount 85 subi r5, r5, 7 // icount 86 add r0, r6, r4 // icount 87 sub r7, r5, r2 // icount 88 sle r4, r1, r0 // icount 89 sll r4, r4, r4 // icount 90 sle r7, r5, r1 // icount 91 andn r7, r5, r6 // icount 92 sub r6, r2, r5 // icount 93 subi r7, r3, 15 // icount 94 slbi r5, 3 // icount 95 lbi r6, 0 // icount 96 nop // to align meminst icount 97 andni r6, r6, 1 // icount 98 st r4, r6, 10 // icount 99 lbi r3, 0 // icount 100 lbi r4, 0 // icount 101 nop // to align branch icount 102 bnez r1, 24 // icount 103 slt r2, r4, r1 // icount 104 roli r2, r5, 15 // icount 105 add r4, r5, r7 // icount 106 sle r0, r2, r2 // icount 107 andni r7, r7, 1 // icount 108 ld r5, r7, 4 // icount 109 andn r1, r6, r7 // icount 110 subi r2, r6, 0 // icount 111 sub r1, r1, r7 // icount 112 roli r5, r1, 6 // icount 113 andni r6, r6, 1 // icount 114 ld r1, r6, 12 // icount 115 subi r3, r2, 15 // icount 116 srli r0, r2, 13 // icount 117 rol r6, r6, r2 // icount 118 roli r4, r2, 8 // icount 119 xori r0, r0, 1 // icount 120 roli r2, r6, 8 // icount 121 sll r4, r6, r6 // icount 122 sll r3, r6, r3 // icount 123 sub r0, r2, r3 // icount 124 rori r5, r0, 4 // icount 125 add r2, r0, r2 // icount 126 nop // to align meminst icount 127 andni r3, r3, 1 // icount 128 st r1, r3, 4 // icount 129 rori r2, r6, 10 // icount 130 nop // to align meminst icount 131 andni r0, r0, 1 // icount 132 st r5, r0, 2 // icount 133 j 24 // icount 134 nop // icount 135 nop // icount 136 nop // icount 137 nop // icount 138 nop // icount 139 nop // icount 140 nop // icount 141 nop // icount 142 nop // icount 143 nop // icount 144 nop // icount 145 nop // icount 146 j 8 // icount 147 nop // icount 148 nop // icount 149 nop // icount 150 nop // icount 151 j 10 // icount 152 nop // icount 153 nop // icount 154 nop // icount 155 nop // icount 156 nop // icount 157 lbi r4, 0 // icount 158 lbi r2, 0 // icount 159 nop // to align branch icount 160 bltz r6, 0 // icount 161 sll r3, r1, r3 // icount 162 nop // to align meminst icount 163 andni r4, r4, 1 // icount 164 ld r2, r4, 2 // icount 165 sco r4, r6, r1 // icount 166 lbi r5, 0 // icount 167 lbi r4, 0 // icount 168 bltz r2, 8 // icount 169 lbi r0, 14 // icount 170 xor r6, r5, r6 // icount 171 andn r1, r2, r5 // icount 172 slli r7, r1, 10 // icount 173 andn r2, r6, r7 // icount 174 nop // to align meminst icount 175 andni r4, r4, 1 // icount 176 ld r2, r4, 10 // icount 177 lbi r7, 1 // icount 178 nop // to align meminst icount 179 andni r2, r2, 1 // icount 180 ld r7, r2, 14 // icount 181 j 10 // icount 182 nop // icount 183 nop // icount 184 nop // icount 185 nop // icount 186 nop // icount 187 j 16 // icount 188 nop // icount 189 nop // icount 190 nop // icount 191 nop // icount 192 nop // icount 193 nop // icount 194 nop // icount 195 nop // icount 196 j 14 // icount 197 nop // icount 198 nop // icount 199 nop // icount 200 nop // icount 201 nop // icount 202 nop // icount 203 nop // icount 204 j 16 // icount 205 nop // icount 206 nop // icount 207 nop // icount 208 nop // icount 209 nop // icount 210 nop // icount 211 nop // icount 212 nop // icount 213 roli r5, r2, 12 // icount 214 lbi r0, 0 // icount 215 lbi r1, 0 // icount 216 bgez r7, 12 // icount 217 sll r4, r1, r2 // icount 218 sll r5, r2, r3 // icount 219 sll r3, r7, r1 // icount 220 nop // to align meminst icount 221 andni r0, r0, 1 // icount 222 stu r4, r0, 0 // icount 223 sle r0, r7, r5 // icount 224 subi r3, r3, 6 // icount 225 rori r1, r4, 4 // icount 226 roli r3, r3, 4 // icount 227 slt r6, r3, r1 // icount 228 srl r4, r5, r0 // icount 229 addi r7, r4, 14 // icount 230 sll r2, r7, r7 // icount 231 j 24 // icount 232 nop // icount 233 nop // icount 234 nop // icount 235 nop // icount 236 nop // icount 237 nop // icount 238 nop // icount 239 nop // icount 240 nop // icount 241 nop // icount 242 nop // icount 243 nop // icount 244 add r3, r0, r6 // icount 245 j 28 // icount 246 nop // icount 247 nop // icount 248 nop // icount 249 nop // icount 250 nop // icount 251 nop // icount 252 nop // icount 253 nop // icount 254 nop // icount 255 nop // icount 256 nop // icount 257 nop // icount 258 nop // icount 259 nop // icount 260 j 16 // icount 261 nop // icount 262 nop // icount 263 nop // icount 264 nop // icount 265 nop // icount 266 nop // icount 267 nop // icount 268 nop // icount 269 lbi r3, 0 // icount 270 lbi r5, 0 // icount 271 nop // to align branch icount 272 bltz r3, 4 // icount 273 lbi r6, 1 // icount 274 addi r6, r0, 15 // icount 275 srl r5, r5, r5 // icount 276 roli r0, r4, 10 // icount 277 lbi r4, 0 // icount 278 lbi r3, 0 // icount 279 nop // to align branch icount 280 bgez r6, 28 // icount 281 srl r0, r6, r7 // icount 282 addi r1, r0, 7 // icount 283 xori r7, r5, 12 // icount 284 slli r0, r0, 7 // icount 285 xori r0, r6, 14 // icount 286 rol r0, r0, r0 // icount 287 slt r4, r1, r7 // icount 288 srl r7, r1, r1 // icount 289 rol r6, r2, r1 // icount 290 nop // to align meminst icount 291 andni r4, r4, 1 // icount 292 st r3, r4, 4 // icount 293 add r1, r0, r6 // icount 294 seq r7, r7, r3 // icount 295 sll r0, r5, r6 // icount 296 sll r3, r3, r1 // icount 297 srli r2, r1, 15 // icount 298 roli r3, r4, 5 // icount 299 rori r5, r1, 8 // icount 300 nop // to align meminst icount 301 andni r0, r0, 1 // icount 302 stu r4, r0, 10 // icount 303 rol r7, r0, r7 // icount 304 ror r2, r1, r0 // icount 305 andni r7, r1, 5 // icount 306 lbi r5, 3 // icount 307 andni r6, r3, 0 // icount 308 rol r1, r7, r2 // icount 309 srl r3, r3, r6 // icount 310 slbi r6, 10 // icount 311 sco r1, r7, r3 // icount 312 subi r7, r5, 4 // icount 313 srl r6, r4, r0 // icount 314 sll r1, r0, r3 // icount 315 lbi r5, 0 // icount 316 lbi r6, 0 // icount 317 nop // to align branch icount 318 bgez r1, 32 // icount 319 srl r0, r3, r0 // icount 320 slbi r2, 3 // icount 321 rol r1, r7, r1 // icount 322 sll r0, r2, r0 // icount 323 slbi r6, 15 // icount 324 rol r1, r1, r3 // icount 325 srl r5, r1, r5 // icount 326 sco r3, r0, r5 // icount 327 andni r2, r2, 1 // icount 328 stu r0, r2, 10 // icount 329 sub r1, r2, r5 // icount 330 add r5, r1, r6 // icount 331 addi r2, r4, 2 // icount 332 sub r7, r7, r4 // icount 333 srl r4, r4, r3 // icount 334 roli r4, r0, 3 // icount 335 rol r3, r4, r3 // icount 336 xori r4, r5, 5 // icount 337 add r7, r1, r1 // icount 338 add r7, r0, r3 // icount 339 slt r5, r5, r6 // icount 340 subi r7, r6, 7 // icount 341 srl r1, r7, r6 // icount 342 andni r4, r0, 14 // icount 343 roli r3, r0, 1 // icount 344 xor r1, r7, r5 // icount 345 srl r4, r3, r1 // icount 346 xor r6, r3, r1 // icount 347 rol r1, r3, r4 // icount 348 addi r7, r5, 10 // icount 349 add r7, r3, r7 // icount 350 srl r2, r7, r4 // icount 351 lbi r2, 3 // icount 352 j 10 // icount 353 nop // icount 354 nop // icount 355 nop // icount 356 nop // icount 357 nop // icount 358 srli r3, r5, 13 // icount 359 sll r3, r6, r7 // icount 360 lbi r0, 0 // icount 361 lbi r6, 0 // icount 362 bnez r3, 32 // icount 363 andni r6, r6, 1 // icount 364 stu r3, r6, 4 // icount 365 slli r7, r4, 10 // icount 366 andn r6, r0, r5 // icount 367 andn r5, r3, r1 // icount 368 rori r0, r6, 10 // icount 369 lbi r2, 14 // icount 370 rori r1, r5, 8 // icount 371 rori r0, r2, 10 // icount 372 nop // to align meminst icount 373 andni r5, r5, 1 // icount 374 ld r0, r5, 6 // icount 375 roli r6, r0, 9 // icount 376 add r0, r2, r2 // icount 377 slbi r6, 4 // icount 378 srli r3, r6, 3 // icount 379 andn r3, r3, r5 // icount 380 slbi r7, 1 // icount 381 subi r2, r3, 15 // icount 382 ror r5, r7, r2 // icount 383 andni r5, r5, 1 // icount 384 st r4, r5, 4 // icount 385 seq r0, r0, r2 // icount 386 rol r5, r7, r6 // icount 387 ror r5, r0, r1 // icount 388 xor r4, r2, r5 // icount 389 xori r3, r6, 1 // icount 390 sub r5, r4, r0 // icount 391 sub r1, r5, r6 // icount 392 slt r4, r1, r4 // icount 393 srli r1, r4, 0 // icount 394 andn r4, r0, r4 // icount 395 sco r4, r0, r5 // icount 396 rori r0, r3, 4 // icount 397 sle r5, r5, r2 // icount 398 andni r6, r0, 6 // icount 399 andni r2, r2, 1 // icount 400 stu r3, r2, 6 // icount 401 sco r1, r5, r3 // icount 402 ror r1, r1, r3 // icount 403 sle r0, r2, r3 // icount 404 andn r2, r0, r4 // icount 405 seq r4, r2, r4 // icount 406 j 0 // icount 407 sll r4, r5, r7 // icount 408 j 30 // icount 409 nop // icount 410 nop // icount 411 nop // icount 412 nop // icount 413 nop // icount 414 nop // icount 415 nop // icount 416 nop // icount 417 nop // icount 418 nop // icount 419 nop // icount 420 nop // icount 421 nop // icount 422 nop // icount 423 nop // icount 424 andn r2, r0, r1 // icount 425 lbi r6, 0 // icount 426 lbi r6, 0 // icount 427 nop // to align branch icount 428 beqz r1, 4 // icount 429 sle r0, r4, r0 // icount 430 srl r4, r1, r4 // icount 431 andn r6, r4, r1 // icount 432 seq r4, r1, r4 // icount 433 j 16 // icount 434 nop // icount 435 nop // icount 436 nop // icount 437 nop // icount 438 nop // icount 439 nop // icount 440 nop // icount 441 nop // icount 442 xori r0, r7, 4 // icount 443 j 4 // icount 444 nop // icount 445 nop // icount 446 addi r5, r4, 7 // icount 447 lbi r7, 0 // icount 448 lbi r0, 0 // icount 449 nop // to align branch icount 450 bgez r7, 8 // icount 451 xor r0, r4, r6 // icount 452 rol r6, r4, r4 // icount 453 lbi r3, 8 // icount 454 sub r3, r4, r5 // icount 455 lbi r3, 2 // icount 456 addi r5, r4, 10 // icount 457 andni r3, r3, 1 // icount 458 stu r1, r3, 8 // icount 459 andni r2, r2, 1 // icount 460 stu r3, r2, 4 // icount 461 seq r5, r5, r3 // icount 462 lbi r1, 0 // icount 463 lbi r7, 0 // icount 464 beqz r5, 24 // icount 465 srl r0, r3, r3 // icount 466 sco r6, r4, r6 // icount 467 xor r7, r4, r4 // icount 468 andn r7, r1, r4 // icount 469 xor r1, r2, r1 // icount 470 slli r6, r1, 12 // icount 471 ror r0, r3, r1 // icount 472 nop // to align meminst icount 473 andni r6, r6, 1 // icount 474 ld r3, r6, 14 // icount 475 lbi r0, 10 // icount 476 srl r7, r0, r5 // icount 477 seq r7, r0, r5 // icount 478 srl r0, r7, r6 // icount 479 ror r1, r2, r4 // icount 480 xor r3, r6, r5 // icount 481 andni r6, r6, 1 // icount 482 stu r3, r6, 14 // icount 483 sle r0, r4, r1 // icount 484 slbi r6, 0 // icount 485 add r6, r0, r7 // icount 486 srl r3, r3, r4 // icount 487 sub r6, r6, r6 // icount 488 ror r1, r7, r0 // icount 489 srl r1, r7, r0 // icount 490 roli r3, r6, 13 // icount 491 andni r3, r3, 1 // icount 492 ld r2, r3, 4 // icount 493 lbi r1, 2 // icount 494 slli r2, r0, 4 // icount 495 roli r5, r1, 14 // icount 496 rori r2, r4, 0 // icount 497 slbi r4, 0 // icount 498 srli r6, r5, 4 // icount 499 sub r6, r2, r3 // icount 500 j 4 // icount 501 nop // icount 502 nop // icount 503 j 18 // icount 504 nop // icount 505 nop // icount 506 nop // icount 507 nop // icount 508 nop // icount 509 nop // icount 510 nop // icount 511 nop // icount 512 nop // icount 513 roli r1, r0, 10 // icount 514 j 20 // icount 515 nop // icount 516 nop // icount 517 nop // icount 518 nop // icount 519 nop // icount 520 nop // icount 521 nop // icount 522 nop // icount 523 nop // icount 524 nop // icount 525 ror r0, r2, r4 // icount 526 slli r2, r4, 14 // icount 527 j 26 // icount 528 nop // icount 529 nop // icount 530 nop // icount 531 nop // icount 532 nop // icount 533 nop // icount 534 nop // icount 535 nop // icount 536 nop // icount 537 nop // icount 538 nop // icount 539 nop // icount 540 nop // icount 541 lbi r6, 0 // icount 542 lbi r6, 0 // icount 543 nop // to align branch icount 544 bgez r7, 24 // icount 545 sub r7, r6, r7 // icount 546 andni r2, r2, 0 // icount 547 xori r0, r7, 6 // icount 548 srl r3, r3, r6 // icount 549 roli r0, r1, 13 // icount 550 andn r2, r3, r6 // icount 551 subi r3, r7, 0 // icount 552 addi r5, r5, 8 // icount 553 andni r6, r6, 1 // icount 554 st r2, r6, 14 // icount 555 xori r6, r6, 8 // icount 556 xor r1, r0, r7 // icount 557 srli r5, r1, 0 // icount 558 slli r4, r2, 6 // icount 559 srli r7, r4, 2 // icount 560 xori r1, r5, 1 // icount 561 ror r0, r1, r2 // icount 562 xori r2, r6, 14 // icount 563 ror r4, r3, r2 // icount 564 nop // to align meminst icount 565 andni r4, r4, 1 // icount 566 ld r6, r4, 14 // icount 567 andni r5, r5, 1 // icount 568 ld r5, r5, 14 // icount 569 sle r1, r4, r1 // icount 570 nop // to align meminst icount 571 andni r2, r2, 1 // icount 572 stu r6, r2, 2 // icount 573 rori r4, r6, 0 // icount 574 add r1, r7, r1 // icount 575 lbi r6, 8 // icount 576 slbi r1, 15 // icount 577 j 18 // icount 578 nop // icount 579 nop // icount 580 nop // icount 581 nop // icount 582 nop // icount 583 nop // icount 584 nop // icount 585 nop // icount 586 nop // icount 587 srl r2, r0, r4 // icount 588 j 22 // icount 589 nop // icount 590 nop // icount 591 nop // icount 592 nop // icount 593 nop // icount 594 nop // icount 595 nop // icount 596 nop // icount 597 nop // icount 598 nop // icount 599 nop // icount 600 j 30 // icount 601 nop // icount 602 nop // icount 603 nop // icount 604 nop // icount 605 nop // icount 606 nop // icount 607 nop // icount 608 nop // icount 609 nop // icount 610 nop // icount 611 nop // icount 612 nop // icount 613 nop // icount 614 nop // icount 615 nop // icount 616 roli r1, r0, 11 // icount 617 j 8 // icount 618 nop // icount 619 nop // icount 620 nop // icount 621 nop // icount 622 j 26 // icount 623 nop // icount 624 nop // icount 625 nop // icount 626 nop // icount 627 nop // icount 628 nop // icount 629 nop // icount 630 nop // icount 631 nop // icount 632 nop // icount 633 nop // icount 634 nop // icount 635 nop // icount 636 lbi r6, 0 // icount 637 lbi r1, 0 // icount 638 bgez r3, 4 // icount 639 sco r2, r7, r5 // icount 640 slt r1, r6, r3 // icount 641 sll r7, r7, r6 // icount 642 srl r5, r7, r7 // icount 643 sub r1, r6, r0 // icount 644 andni r5, r2, 2 // icount 645 lbi r3, 0 // icount 646 lbi r4, 0 // icount 647 nop // to align branch icount 648 bnez r0, 4 // icount 649 andni r2, r5, 10 // icount 650 addi r7, r3, 8 // icount 651 sle r2, r4, r5 // icount 652 slt r7, r6, r5 // icount 653 j 28 // icount 654 nop // icount 655 nop // icount 656 nop // icount 657 nop // icount 658 nop // icount 659 nop // icount 660 nop // icount 661 nop // icount 662 nop // icount 663 nop // icount 664 nop // icount 665 nop // icount 666 nop // icount 667 nop // icount 668 j 22 // icount 669 nop // icount 670 nop // icount 671 nop // icount 672 nop // icount 673 nop // icount 674 nop // icount 675 nop // icount 676 nop // icount 677 nop // icount 678 nop // icount 679 nop // icount 680 lbi r1, 0 // icount 681 lbi r3, 0 // icount 682 bltz r5, 16 // icount 683 srli r6, r7, 1 // icount 684 sco r7, r5, r7 // icount 685 addi r2, r3, 8 // icount 686 sle r4, r0, r3 // icount 687 slli r6, r6, 9 // icount 688 roli r1, r6, 7 // icount 689 subi r4, r0, 3 // icount 690 rori r7, r3, 11 // icount 691 rori r3, r4, 9 // icount 692 subi r0, r2, 14 // icount 693 add r7, r5, r4 // icount 694 andn r5, r6, r2 // icount 695 slli r1, r6, 12 // icount 696 nop // to align meminst icount 697 andni r0, r0, 1 // icount 698 ld r7, r0, 10 // icount 699 xori r5, r5, 4 // icount 700 ror r0, r5, r2 // icount 701 rol r7, r0, r3 // icount 702 lbi r3, 0 // icount 703 lbi r6, 0 // icount 704 bgez r4, 28 // icount 705 slt r0, r2, r6 // icount 706 srl r4, r1, r1 // icount 707 sll r2, r4, r2 // icount 708 nop // to align meminst icount 709 andni r6, r6, 1 // icount 710 ld r5, r6, 14 // icount 711 addi r7, r0, 2 // icount 712 subi r4, r0, 11 // icount 713 add r5, r7, r0 // icount 714 srl r4, r6, r5 // icount 715 addi r0, r0, 10 // icount 716 seq r4, r1, r0 // icount 717 andni r3, r1, 7 // icount 718 seq r0, r0, r1 // icount 719 add r2, r4, r0 // icount 720 slbi r2, 1 // icount 721 slli r4, r1, 13 // icount 722 rol r5, r1, r1 // icount 723 xori r1, r7, 11 // icount 724 sco r3, r5, r2 // icount 725 sle r7, r5, r5 // icount 726 subi r3, r3, 6 // icount 727 sub r5, r1, r4 // icount 728 sle r6, r1, r0 // icount 729 slt r7, r2, r3 // icount 730 slli r3, r6, 8 // icount 731 slt r0, r4, r0 // icount 732 sll r4, r0, r4 // icount 733 andni r5, r1, 11 // icount 734 rol r3, r6, r1 // icount 735 lbi r1, 0 // icount 736 lbi r7, 0 // icount 737 nop // to align branch icount 738 bgez r3, 12 // icount 739 rol r0, r7, r3 // icount 740 srl r1, r5, r0 // icount 741 add r2, r0, r3 // icount 742 slli r6, r1, 6 // icount 743 rol r6, r0, r3 // icount 744 lbi r3, 10 // icount 745 andni r5, r5, 1 // icount 746 stu r1, r5, 4 // icount 747 add r1, r2, r4 // icount 748 seq r0, r3, r3 // icount 749 seq r4, r5, r5 // icount 750 nop // to align meminst icount 751 andni r7, r7, 1 // icount 752 st r6, r7, 4 // icount 753 addi r5, r1, 2 // icount 754 lbi r7, 0 // icount 755 lbi r7, 0 // icount 756 bgez r6, 8 // icount 757 sub r0, r7, r5 // icount 758 nop // to align meminst icount 759 andni r0, r0, 1 // icount 760 st r0, r0, 10 // icount 761 rol r1, r7, r5 // icount 762 xori r4, r4, 14 // icount 763 ror r6, r4, r5 // icount 764 rol r0, r2, r2 // icount 765 addi r5, r6, 10 // icount 766 srli r1, r3, 13 // icount 767 sll r5, r2, r4 // icount 768 nop // to align meminst icount 769 andni r6, r6, 1 // icount 770 st r7, r6, 4 // icount 771 sll r7, r6, r6 // icount 772 j 30 // icount 773 nop // icount 774 nop // icount 775 nop // icount 776 nop // icount 777 nop // icount 778 nop // icount 779 nop // icount 780 nop // icount 781 nop // icount 782 nop // icount 783 nop // icount 784 nop // icount 785 nop // icount 786 nop // icount 787 nop // icount 788 addi r0, r5, 11 // icount 789 j 8 // icount 790 nop // icount 791 nop // icount 792 nop // icount 793 nop // icount 794 halt // icount 795
programs/oeis/335/A335025.asm
karttu/loda
0
17059
; A335025: Largest side lengths of almost-equilateral Heronian triangles. ; 5,15,53,195,725,2703,10085,37635,140453,524175,1956245,7300803,27246965,101687055,379501253,1416317955,5285770565,19726764303,73621286645,274758382275,1025412242453,3826890587535,14282150107685,53301709843203,198924689265125,742397047217295,2770663499604053 mov $1,8 mov $2,$0 mov $3,8 lpb $2,1 lpb $3,1 mov $0,4 sub $3,$3 lpe add $0,$1 add $0,$1 add $1,$0 sub $2,1 lpe sub $1,8 div $1,4 mul $1,2 add $1,5
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_182.asm
ljhsiun2/medusa
9
20762
<reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_182.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r15 push %r9 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x1012f, %r15 nop nop nop nop nop and $64986, %r10 mov $0x6162636465666768, %rbx movq %rbx, %xmm1 and $0xffffffffffffffc0, %r15 movaps %xmm1, (%r15) nop nop nop nop nop cmp %rax, %rax lea addresses_A_ht+0x98ef, %rbp nop nop nop add %r13, %r13 mov $0x6162636465666768, %r9 movq %r9, %xmm2 vmovups %ymm2, (%rbp) nop nop sub %rbp, %rbp lea addresses_D_ht+0x1424f, %rsi lea addresses_WC_ht+0x1cf2f, %rdi nop nop nop nop nop add $8185, %rbp mov $35, %rcx rep movsw nop cmp %rcx, %rcx lea addresses_A_ht+0x1d2f, %rsi lea addresses_WT_ht+0x154af, %rdi clflush (%rdi) nop nop nop nop and %rax, %rax mov $45, %rcx rep movsb nop nop nop nop nop inc %rbp lea addresses_UC_ht+0xe02f, %rdi clflush (%rdi) nop nop cmp %rcx, %rcx mov $0x6162636465666768, %r9 movq %r9, (%rdi) xor %rbp, %rbp pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r9 pop %r15 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r15 push %r8 push %rax push %rbp push %rbx push %rsi // Faulty Load mov $0xb20f9000000092f, %rsi cmp %rbp, %rbp movaps (%rsi), %xmm2 vpextrq $0, %xmm2, %r15 lea oracles, %rbx and $0xff, %r15 shlq $12, %r15 mov (%rbx,%r15,1), %r15 pop %rsi pop %rbx pop %rbp pop %rax pop %r8 pop %r15 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': True, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': True, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_UC_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 */
ecdsa128/src/GFp_src/src/multiply.asm
FloydZ/Crypto-Hash
11
166690
<gh_stars>10-100 .686p .mmx .model flat,stdcall option casemap:none option prologue:none option epilogue:none include ..\..\lib\gfp.inc .data? mulSpace VBIGINT<> .code multiply proc ptrA:DWORD, ptrB:DWORD, ptrC:DWORD ;c=ab pushad mov esi, dword ptr [esp+20h+4] mov edi, dword ptr [esp+20h+8] mov eax, dword ptr [esi] mul dword ptr [edi] xor ecx, ecx mov dword ptr [mulSpace], eax mov ebp, edx mov eax, dword ptr [esi+4] mul dword ptr [edi] xor ebx, ebx add ebp, eax adc ecx, edx mov eax, dword ptr [esi] mul dword ptr [edi+4] add eax, ebp adc ecx, edx mov dword ptr [mulSpace+4], eax adc ebx, 0 mov eax, dword ptr [esi+8] mul dword ptr [edi] xor ebp, ebp add ecx, eax adc ebx, edx mov eax, dword ptr [esi+4] mul dword ptr [edi+4] add ecx, eax adc ebx, edx adc ebp, 0 mov eax, dword ptr [esi] mul dword ptr [edi+8] add eax, ecx adc ebx, edx mov dword ptr [mulSpace+8], eax adc ebp, 0 mov eax, dword ptr [esi+12] mul dword ptr [edi] xor ecx, ecx add ebx, eax adc ebp, edx mov eax, dword ptr [esi+8] mul dword ptr [edi+4] add ebx, eax adc ebp, edx adc ecx, 0 mov eax, dword ptr [esi+4] mul dword ptr [edi+8] add ebx, eax adc ebp, edx adc ecx, 0 mov eax, dword ptr [esi] mul dword ptr [edi+12] add eax, ebx adc ebp, edx mov dword ptr [mulSpace+12], eax adc ecx, 0 mov eax, dword ptr [esi+12] mul dword ptr [edi+4] xor ebx, ebx add ebp, eax adc ecx, edx mov eax, dword ptr [esi+8] mul dword ptr [edi+8] add ebp, eax adc ecx, edx adc ebx, 0 mov eax, dword ptr [esi+4] mul dword ptr [edi+12] add eax, ebp adc ecx, edx mov dword ptr [mulSpace+16], eax adc ebx, 0 mov eax, dword ptr [esi+12] mul dword ptr [edi+8] xor ebp, ebp add ecx, eax adc ebx, edx mov eax, dword ptr [esi+8] mul dword ptr [edi+12] add ecx, eax adc ebx, edx adc ebp, 0 mov eax, dword ptr [esi+12] mul dword ptr [edi+12] add eax, ebx adc edx, ebp ;+20=ecx, +24=eax, +28=edx mov esi, dword ptr [esp+20h+12] ;ptrOut mov edi, offset mulSpace mov dword ptr [esi+20], ecx mov dword ptr [esi+24], eax mov dword ptr [esi+28], edx mov eax, dword ptr [edi] mov ebx, dword ptr [edi+4] mov ecx, dword ptr [edi+8] mov edx, dword ptr [edi+12] mov ebp, dword ptr [edi+16] mov dword ptr [esi+ 0], eax mov dword ptr [esi+ 4], ebx mov dword ptr [esi+ 8], ecx mov dword ptr [esi+12], edx mov dword ptr [esi+16], ebp and dword ptr [edi ], 0 and dword ptr [edi+4 ], 0 and dword ptr [edi+8 ], 0 and dword ptr [edi+12], 0 and dword ptr [edi+16], 0 popad ret 12 multiply endp end
src/firmware-tests/Platform/Arithmetic32/Negate/NegateATest.asm
pete-restall/Cluck2Sesame-Prototype
1
174682
<reponame>pete-restall/Cluck2Sesame-Prototype<gh_stars>1-10 #include "Platform.inc" #include "FarCalls.inc" #include "Arithmetic32.inc" #include "TestFixture.inc" radix decimal udata global expectedRAA global expectedRAB global expectedRAC global expectedRAD global expectedCarry global expectedZero global carry global zero expectedRAA res 1 expectedRAB res 1 expectedRAC res 1 expectedRAD res 1 expectedCarry res 1 expectedZero res 1 capturedStatus res 1 carry res 1 zero res 1 NegateATest code global testArrange testArrange: banksel carry clrf carry clrf zero setCarryToOppositeOfExpected: movlw 0xff andwf expectedCarry, W bcf STATUS, C btfsc STATUS, Z bsf STATUS, C setZeroToOppositeOfExpected: movlw 0xff andwf expectedZero, W testAct: fcall negateA32 swapf STATUS, W banksel capturedStatus movwf capturedStatus swapf capturedStatus btfsc capturedStatus, C bsf carry, 0 btfsc capturedStatus, Z bsf zero, 0 testAssert: .aliasForAssert RAA, _a .aliasForAssert expectedRAA, _b .assert "_a == _b, 'RAA expectation failure.'" .aliasForAssert RAB, _a .aliasForAssert expectedRAB, _b .assert "_a == _b, 'RAB expectation failure.'" .aliasForAssert RAC, _a .aliasForAssert expectedRAC, _b .assert "_a == _b, 'RAC expectation failure.'" .aliasForAssert RAD, _a .aliasForAssert expectedRAD, _b .assert "_a == _b, 'RAD expectation failure.'" banksel carry .assert "carry == expectedCarry, 'Carry expectation failure.'" .assert "zero == expectedZero, 'Zero expectation failure.'" return end
oeis/167/A167325.asm
neoneye/loda-programs
11
104138
<filename>oeis/167/A167325.asm ; A167325: Totally multiplicative sequence with a(p) = 6*(p+3) for prime p. ; Submitted by <NAME> ; 1,30,36,900,48,1080,60,27000,1296,1440,84,32400,96,1800,1728,810000,120,38880,132,43200,2160,2520,156,972000,2304,2880,46656,54000,192,51840,204,24300000,3024,3600,2880,1166400,240,3960,3456,1296000,264,64800,276,75600,62208,4680,300,29160000,3600,69120,4320,86400,336,1399680,4032,1620000,4752,5760,372,1555200,384,6120,77760,729000000,4608,90720,420,108000,5616,86400,444,34992000,456,7200,82944,118800,5040,103680,492,38880000,1679616,7920,516,1944000,5760,8280,6912,2268000,552,1866240,5760 add $0,1 mov $1,1 lpb $0 mov $3,$0 lpb $3 mov $4,$0 mov $6,$2 cmp $6,0 add $2,$6 mod $4,$2 cmp $4,0 cmp $4,0 mov $5,$2 add $2,1 cmp $5,1 max $4,$5 sub $3,$4 lpe mov $5,1 lpb $0 dif $0,$2 mul $1,6 mul $5,$2 add $5,3 mul $1,$5 trn $2,8 lpe lpe mov $0,$1
primeNumber.asm
nathalie-tate/MIPS
0
18384
# primeNumber.asm # <NAME> # This code is freely available to be modified and distrubuted under the terms # of the MIT License. # # Checks if the entered number is prime # Note that this is an extremely inefficient solution, but I don't feel like # coding a better solution in assembly code .data PROMPT1:.asciiz "Please enter an integer: " PROMPT2:.asciiz "Your number is prime.\n" PROMPT3:.asciiz "Your number is not prime.\n" .text .globl main main: li $v0, 4 la $a0, PROMPT1 syscall #Ask for user input li $v0, 5 syscall #Accept user input move $s0, $v0 #Store user input in $s0 li $t1, 1 #initialize variables li $t2, 2 slt $t0, $s0, $t2 #not prime if < 2 beq $t1, $t0, NOTPRIME LOOP: beq $s0, $t2, PRIME #prime div $s0, $t2 mfhi $t0 beq $t0, $zero, NOTPRIME #not prime if remainder == 0 addi $t2, $t2, 1 #increment j LOOP PRIME: li $v0, 4 la $a0, PROMPT2 syscall #Display results li $v0, 10 syscall #Exit NOTPRIME: li $v0, 4 la $a0, PROMPT3 syscall #Display results li $v0, 10 syscall #Exit
main/replays.asm
zlatkok/swospp
12
89698
[list -] %include "swos.inc" %include "swsmenu.inc" [list +] section .text bits 32 global CheckForFastReplay CheckForFastReplay: %ifdef DEBUG extern DumpVariables call DumpVariables ; write out debug variables %endif test byte [replayStatus], 1 jz .out test byte [replayStatus], 4 jz .out xor byte [rplFrameSkip], 1 test byte [rplFrameSkip], 1 jz .out pop eax ; get rid of return address .out: cmp word [EGA_graphics], -1 retn global MyHilPtrIncrement MyHilPtrIncrement: mov eax, [nextGoalPtr] cmp [A1], eax jnz .out mov bx, [rplHandle] test bx, bx jz .reset_ptr mov cx, 19000 mov edx, [goalBasePtr] mov ah, 0x40 int 0x21 jc .set_error cmp ax, 19000 jz .reset_ptr .set_error: mov byte [saveErrors], 1 .reset_ptr: mov eax, [goalBasePtr] mov [A1], eax .out: retn global MyHilPtrAdd MyHilPtrAdd: mov eax, [nextGoalPtr] cmp [A0], eax jnz .out test byte [replayStatus], 1 jz .reset_ptr mov bx, [rplHandle] mov cx, 19000 mov edx, [goalBasePtr] mov ah, 0x3f int 0x21 .reset_ptr: mov eax, [goalBasePtr] mov [A0], eax .out: retn global OpenReplayFile OpenReplayFile: mov word [rplHandle], 0 ; rplHandle will be zero in case of an error mov byte [saveErrors], 0 mov edx, tmp_filename xor ecx, ecx mov ah, 0x3c int 0x21 ; try to open file for writing jc .out mov [rplHandle], ax mov bx, ax xor cx, cx mov dx, 3626 ; leave room for header (3626 bytes) mov ax, 0x4200 int 0x21 jc .close_file or byte [replayStatus], 2 ; set recording flag jmp .out .close_file: mov ah, 0x3e ; if can't seek, close file int 0x21 mov word [rplHandle], 0 ; set rplHandle to zero to indicate error .out: mov dword [A0], g_currentMenu retn ; CloseReplayFile ; ; in: ; eax - if true it's normal call, just retn, otherwise called from SWOS ; global CloseReplayFile CloseReplayFile: push eax sub esp, byte 4 mov esi, rplHandle mov bx, [esi] test bx, bx jz near .out ; if file wasn't opened, nothing to do inc byte [saveErrors] ; anticipate error mov eax, [currentHilPtr] cmp eax, [nextGoalPtr] jz .nothing_left mov ecx, eax mov edx, [goalBasePtr] sub ecx, edx mov ah, 0x40 int 0x21 ; save remaining stuff jc .close_file .nothing_left: xor cx, cx xor dx, dx mov ax, 0x4201 int 0x21 ; get current position jc .close_file mov [esp], ax ; save current position mov [esp + 2], dx xor dx, dx xor cx, cx mov ax, 0x4200 ; seek to beginning int 0x21 jc .close_file push word [hilNumGoals] ; save number of goals for normal hils mov word [hilNumGoals], 1 ; important - this will look just like one highlight mov ah, 0x40 mov ecx, 3626 mov edx, hilFileBuffer int 0x21 ; write hil header pop word [hilNumGoals] ; restore original number of goals jc .close_file mov dx, [esp] ; restore previous position mov cx, [esp + 2] mov ax, 0x4200 int 0x21 mov dword [esi], -1 push byte 4 mov ah, 0x40 mov edx, esi pop ecx int 0x21 ; save replay terminator (-1) jc .close_file or byte [replayStatus], 8 ; all OK, we have a replay - set flag mov esi, tmp_filename mov edi, selectedFile push byte 13 pop ecx rep movsb dec byte [saveErrors] ; restore errors as it was .close_file: mov ah, 0x3e int 0x21 ; close file mov word [rplHandle], 0 ; clear handle .out: and byte [replayStatus], ~2 ; clear recording flag add esp, byte 4 pop eax test eax, eax jnz .retn mov ax, [isGameFriendly] ; recreate the test or ax, ax .retn: retn global ShowReplaysMenu ShowReplaysMenu: mov dword [A6], replaysMenu calla ShowMenu retn InitReplays: xor ebx, ebx mov al, [replayStatus] and al, 8 cmp bl, al ; al greater than zero? sbb ebx, ebx ; ebx = al > 0 ? -1 : 0 neg ebx ; ebx = al > 0 ? 1 : 0 mov ecx, ebx mov edx, ebx shl ecx, 2 add ecx, edx ; ecx = al > 0 ? 5 : 0 add cl, 9 ; ecx = al > 0 ? 14 : 9 neg ebx ; ebx = al > 0 ? -1 : 0 not ebx ; ebx = al > 0 ? 0 : -1 neg ebx ; ebx = al > 0 ? 0 : 1 mov edi, ebx ; CalcMenuEntryAddress trashes bx mov [D0], word 2 calla CalcMenuEntryAddress mov esi, [A0] mov [esi + MenuEntry.isDisabled], di ; disable or enable view/save replay buttons mov [esi + MenuEntry.backAndFrameColor], cx ; set color - green or gray for disabled entry mov [D0], word 4 calla CalcMenuEntryAddress mov esi, [A0] mov [esi + MenuEntry.isDisabled], di mov [esi + MenuEntry.backAndFrameColor], cx mov al, [saveErrors] ; check rpl file errors test al, al jz .out mov dword [A0], err_msg calla ShowErrorMenu .out: retn ViewReplay: mov edx, selectedFile mov ax, 0x3d00 int 0x21 jnc play_it .cant_open: mov dword [A0], cant_open_str calla ShowErrorMenu retn play_it: mov [rplHandle], ax mov bx, ax mov ecx, 19000 + 3626 mov edx, hilFileBuffer mov ah, 0x3f int 0x21 jc read_error test eax, eax jz read_error ; check for zero-sized file cmp eax, ecx jnz read_error ; check for too small filesize mov edi, hilFilename mov esi, selectedFile push byte 13 pop ecx rep movsb and byte [replayStatus], ~4 ; turn off fast replay or byte [replayStatus], 1 ; set playing flag calla ShowHighlights and byte [replayStatus], ~1 mov bx, [rplHandle] ; close file mov ah, 0x3e int 0x21 mov word [hilNumGoals], 0 ; reset highlights retn read_error: mov ah, 0x3e int 0x21 mov dword [A0], err_reading calla ShowErrorMenu retn LoadReplay: mov eax, load_replay_str mov [A0], eax mov [A1], eax mov dword [D0], 'LPR.' calla GetFilenameAndExtension jnz .out mov esi, [A0] mov edi, selectedFile push byte 13 pop ecx rep movsb ; copy selected name to our buffer or byte [replayStatus], 8 .out: jmp InitReplays SaveReplay: mov eax, saveFilename ; zero out default save name mov byte [eax], 0 mov [A0], eax mov dword [A1], save_replay_str mov dword [D0], 'LPR.' calla SelectFileToSaveDialog jnz near .out mov esi, [A0] mov edi, selectedFile push byte 13 pop ecx rep cmpsb ; compare selected file with destination jne .copy mov dword [A0], cant_copy_to_itself calla ShowErrorMenu jmp short SaveReplay .copy: mov edx, selectedFile mov ax, 0x3d00 int 0x21 jc ViewReplay.cant_open mov esi, eax mov edx, [A0] xor ecx, ecx mov ah, 0x3c int 0x21 jc ViewReplay.cant_open mov edi, eax mov edx, foundFilenamesBuffer .copy_loop: mov ebx, esi mov cx, 0x4000 mov ah, 0x3f int 0x21 jc read_error test eax, eax jz .copy_over mov ecx, eax mov ah, 0x40 mov ebx, edi int 0x21 jnc .copy_loop mov dword [A0], err_writing calla ShowErrorMenu .copy_over: mov ebx, esi mov ah, 0x3e int 0x21 mov ebx, edi int 0x21 .out: retn section .bss rplHandle: resd 1 selectedFile: resb 13 saveFilename: resb 13 saveErrors: resb 1 ; bit 0 set = playing (1) ; bit 1 set = recording (2) ; bit 2 set = fast replay (4) ; bit 3 set = we have replay to show (8) ; global replayStatus replayStatus: resb 1 global rplFrameSkip rplFrameSkip: resb 1 section .rdata load_replay_str: db "LOAD REPLAY", 0 save_replay_str: db "SAVE REPLAY", 0 tmp_filename: db "LASTGAME.RPL", 0 err_msg: db "WARNING: FILE MAY BE CORRUPTED", 0 cant_open_str: db "FILE COULD NOT BE OPENED", 0 err_reading: db "ERROR READING FILE", 0 err_writing: db "ERROR WRITING FILE", 0 cant_copy_to_itself: db "CANT COPY FILE TO ITSELF", 0 error_copying: db "ERROR COPYING FILE", 0 section .data StartMenu replaysMenu, InitReplays, 0, 0, 3 StartEntry 92, 0, 120, 15 EntryColor 0x17 EntryString 0, "REPLAYS" EndEntry StartEntry 102, 185, 100, 15 NextEntries -1, -1, 4, -1 EntryColor 12 EntryString 0, aExit OnSelect SetExitMenuFlag EndEntry StartEntry 82, 60, 140, 15 NextEntries -1, -1, -1, 3 EntryColor 14 EntryString 0, "VIEW REPLAY" OnSelect ViewReplay EndEntry StartEntry 82, 90, 140, 15 NextEntries -1, -1, 2, 4 EntryColor 14 EntryString 0, "LOAD REPLAY" OnSelect LoadReplay EndEntry StartEntry 82, 120, 140, 15 NextEntries -1, -1, 3, 1 EntryColor 14 EntryString 0, "SAVE REPLAY" OnSelect SaveReplay EndEntry EndMenu
src/main/antlr/bsvtokami/BSV.g4
acw1251/bsvtokami
4
987
grammar BSV; @header { package bsvtokami; } packagedef : packagedecl packagestmt* endpackage? EOF | packagestmt* EOF ; packagedecl : 'package' pkgname=packageide ';' ; endpackage : 'endpackage' ( ':' pkgname=packageide )? ; PPTOK : '`'[a-zA-Z0-9_]+ -> channel(2) ; UpperCaseIdentifier : [A-Z][a-zA-Z0-9_]* ; LowerCaseIdentifier : [a-z_][a-zA-Z0-9_]* ; DollarIdentifier : [$][a-z][a-zA-Z0-9_$]* ; EscapedOperator : [\\][-A-Za-z0-9=+_*&^%$#@!~<>?/|]+ ; lowerCaseIdentifier : LowerCaseIdentifier | EscapedOperator ; upperCaseIdentifier : UpperCaseIdentifier ; anyidentifier : lowerCaseIdentifier | upperCaseIdentifier ; exportdecl : 'export' exportitem (',' exportitem)* ';' ; exportitem : packageide '::' '*' | anyidentifier ('(' '..' ')')? ; importdecl : 'import' (upperCaseIdentifier '::')+ '*' ';' ; packagestmt : interfacedecl | typedefsynonym | typedefenum | typedefstruct | typedeftaggedunion | typeclassdecl | typeclassinstance | externcimport | varbinding | functiondef | moduledef | importdecl | exportdecl ; packageide : upperCaseIdentifier ; interfacedecl : attributeinstance* 'interface' typedeftype ';' (interfacememberdecl)* 'endinterface' (':' typeide)? ; interfacememberdecl : methodproto | subinterfacedecl ; methodproto : attributeinstance* 'method' bsvtype name=lowerCaseIdentifier ('(' methodprotoformals? ')')? provisos? ';' ; methodprotoformals : methodprotoformal (',' methodprotoformal)* ; methodprotoformal : attributeinstance* bsvtype? name=lowerCaseIdentifier ; subinterfacedecl : attributeinstance* 'interface' bsvtype lowerCaseIdentifier ';' ; typedeftype : typeide typeformals? ; typeformals : '#' '(' typeformal (',' typeformal)* ')' ; typeformal : numeric=('numeric'|'numeric')? 'type' typeide ; typedefsynonym : attributeinstance* 'typedef' bsvtype typedeftype ';' ; typedefenum : 'typedef' 'enum' '{' typedefenumelement (',' typedefenumelement)* '}' upperCaseIdentifier derives? ';' ; typedefenumelement : tag=upperCaseIdentifier '[' from=IntLiteral (':' to=IntLiteral)? ']' ('=' tagval=IntLiteral)? | tag=upperCaseIdentifier ('=' tagval=IntLiteral)? ; typedefstruct : attributeinstance* 'typedef' 'struct' '{' (structmember)* '}' typedeftype derives? ';' ; typedeftaggedunion : attributeinstance* 'typedef' 'union' 'tagged'? '{' (unionmember)* '}' typedeftype derives? ';' ; structmember : bsvtype lowerCaseIdentifier ';' | subunion lowerCaseIdentifier ';' ; unionmember : bsvtype upperCaseIdentifier ';' | substruct upperCaseIdentifier ';' | subunion upperCaseIdentifier ';' ; substruct : 'struct' '{' (structmember)* '}' ; subunion : 'union' 'tagged'? '{' (unionmember)* '}' ; derives : 'deriving' '(' typeide (',' typeide)* ')' ; moduleinst: /* MIT BSV: "new" */ attributeinstance* ('let' | t=bsvtype) var=lowerCaseIdentifier '=' 'new' rhs=expression ';' ; tuplebind : '{' lowerCaseIdentifier (',' lowerCaseIdentifier)+ '}' ; varinit : var=lowerCaseIdentifier ('=' rhs=expression)? | tuplebind '=' rhs=expression ; varbinding : attributeinstance* ('let' | t=bsvtype) varinit (',' varinit)* ';' ; actionbinding: attributeinstance* ('let' | t=bsvtype) var=lowerCaseIdentifier ('[' arraydim=expression ']')? '<-' rhs=expression ';' ; patternbinding: attributeinstance* 'match' pattern op=('<-'|'=') rhs=expression ';' ; typeclassdecl : attributeinstance* 'typeclass' typeclasside typeformals provisos? typedepends? ';' overloadeddecl* 'endtypeclass' (':' typeclasside)? ; typeclasside : upperCaseIdentifier ; typedepends : 'dependencies' '(' typedepend (',' typedepend)* ')' ; typedepend : typelist 'determines' typelist ; typelist : typeide | '(' typeide (',' typeide)* ')' ; overloadeddecl : attributeinstance* ( functionproto ('=' defaultdef=expression)? ';' | moduleproto | varbinding ) ; tctype : bsvtype | functionproto ; typeclassinstance : attributeinstance* 'instance' typeclasside '#' '(' tctype (',' tctype)* ')' provisos? ';' overloadeddef* 'endinstance' (':' typeclasside)? ; overloadeddef : varassign | functiondef | moduledef ; moduledef : attributeinstance* moduleproto (modulestmt)* 'endmodule' (':' lowerCaseIdentifier)? ; moduleproto : /* MIT BSV module proto */ 'module' moduleinterface=bsvtype name=lowerCaseIdentifier '(' moduleprotoformals? ')' provisos? ';' /* Classic BSV module proto */ | 'module' ('[' monad=expression ']')? name=lowerCaseIdentifier '(' moduleinterface=bsvtype ')' provisos? ';' | 'module' ('[' monad=expression ']')? name=lowerCaseIdentifier '#' '(' moduleprotoformals? ')' '(' moduleinterface=bsvtype ')' provisos? ';' ; moduleprotoformals : moduleprotoformal (',' moduleprotoformal)* ; moduleprotoformal : attributeinstance* 'parameter'? bsvtype name=lowerCaseIdentifier | functionproto ; modulestmt : methoddef | moduledef | moduleinst | subinterfacedef | stmt ; methoddef : 'method' bsvtype? name=lowerCaseIdentifier ('(' methodformals? ')')? provisos? methodcond? ';' (stmt)* 'endmethod' (':' lowerCaseIdentifier)? | 'method' bsvtype? name=lowerCaseIdentifier ('(' methodformals? ')')? methodcond? '=' expression ';' ; methodformals : methodformal (',' methodformal)* ; methodformal : attributeinstance* bsvtype? name=lowerCaseIdentifier | functionproto ; methodcond : /* MIT BSV allows when, Classic BSV: if */ ('when'|'if') '(' expression ')' ; subinterfacedef : 'interface' upperCaseIdentifier lowerCaseIdentifier ';' (interfacestmt)* 'endinterface' (':' lowerCaseIdentifier)? | 'interface' upperCaseIdentifier? lowerCaseIdentifier '=' expression ';' ; ruledef : attributeinstance* 'rule' name=lowerCaseIdentifier rulecond? ';' stmt* 'endrule' (':' lowerCaseIdentifier)? ; rulecond : /* MIT BSV allows when, Classic BSV: optional if */ ('when'|'if'|) '(' expression ')' ; functiondef : attributeinstance* functionproto ';' (stmt)* 'endfunction' (':' lowerCaseIdentifier)? | functionproto '=' expression ';' ; functionproto : 'function' bsvtype? name=lowerCaseIdentifier ('(' methodformals? ')')? provisos? ; externcimport : 'import' '"BDPI"' (lowerCaseIdentifier '=')? 'function' bsvtype lowerCaseIdentifier '(' externcfuncargs? ')' ';' ; externcfuncargs : externcfuncarg (',' externcfuncarg)* ; externcfuncarg : bsvtype lowerCaseIdentifier? ; varassign : attributeinstance* lvalue op=('='|'<-') expression ';' | attributeinstance* '{' lvalue (',' lvalue)* '}' op=('='|'<-') expression ';' ; lvalue : lowerCaseIdentifier | exprprimary '.' lowerCaseIdentifier | exprprimary '[' index=expression ']' | exprprimary '[' msb=expression ((':' lsb=expression) | ('+:' widthup=IntLiteral) | ('-:' widthdown=IntLiteral)) ']' ; bsvtype : typeide ('#' '(' bsvtype (',' bsvtype)* ')')? | var=lowerCaseIdentifier | typenat | '(' bsvtype ')' ; typeide : (pkg=upperCaseIdentifier '::')* name=upperCaseIdentifier | typevar=lowerCaseIdentifier ; typenat : IntLiteral ; expression : pred=expression '?' expression ':' expression #condexpr | expression 'matches' pattern patterncond* #matchesexpr | 'case' '(' expression ')' (('matches' caseexprpatitem+) | caseexpritem*) caseexprdefaultitem? 'endcase' #caseexpr | binopexpr #operatorexpr ; caseexprpatitem : (pattern patterncond*) ':' body=expression ';' ; caseexpritem : match=expression (',' altmatches=expression)*':' body=expression ';' ; caseexprdefaultitem : 'default' ':' body=expression ';' ; patterncond : ('&&&' expression) ; binopexpr : left=binopexpr op=('**' | '**') right=binopexpr | left=binopexpr op=('*' | '/' | '%' | '**') right=binopexpr | left=binopexpr op=('+' | '-') right=binopexpr | left=binopexpr op=('<<' | '>>') right=binopexpr | left=binopexpr op=('<' | '<=' | '>' | '>=') right=binopexpr | left=binopexpr op=('==' | '!=') right=binopexpr | left=binopexpr op=('&' | '^' | '^~' | '~^') right=binopexpr | left=binopexpr op=('|' | '|') right=binopexpr | left=binopexpr op=('&&' | '&&&') right=binopexpr | left=binopexpr op=('||' | '||') right=binopexpr | unopexpr ; unopexpr : op=('!' | '~' | '&' | '~&' | '|' | '~|' | '^' | '^~' | '~^') exprprimary | op=('+' | '-') right=exprprimary | exprprimary ; exprprimary : '(' expression ')' #parenexpr | exprprimary '.' field=anyidentifier #fieldexpr | ( bsvtype | ( '(' bsvtype ')' ) ) '\'' exprprimary #castexpr | (pkg=upperCaseIdentifier '::')* var=lowerCaseIdentifier #varexpr | IntLiteral #intliteral | RealLiteral #realliteral | StringLiteral #stringliteral | '?' #undefinedexpr | ('valueOf'|'valueof') '(' bsvtype ')' #valueofexpr | '{' expression (',' expression)* '}' #bitconcat | array=exprprimary '[' msb=expression ((':' lsb=expression) | ('+:' widthup=IntLiteral) | ('-:' widthdown=IntLiteral))? ']' #arraysub | fcn=exprprimary '(' (expression (',' expression)*)? ')' #callexpr | 'when' '(' (expression (',' expression)*)? ')' #whenexpr | fcn=DollarIdentifier ( '(' (expression (',' expression)*)? ')' )? #syscallexpr | 'clocked_by' exprprimary #clockedbyexpr | 'reset_by' exprprimary #resetbyexpr | bsvtype '’' ( ('{' expression (',' expression)* '}' ) | ( '(' expression ')' ) ) #typeassertionexpr /* MIT BSV: optional tagged */ | 'tagged'? (upperCaseIdentifier '::')* tag=upperCaseIdentifier (('{' memberbinds '}')|exprprimary|) #taggedunionexpr | 'interface' bsvtype (';')? (interfacestmt)* 'endinterface' (':' typeide)? #interfaceexpr | beginendblock #blockexpr | actionvalueblock #actionvalueblockexpr ; memberbinds : memberbind (',' memberbind)* ; memberbind : field=lowerCaseIdentifier ':' expression ; interfacestmt : methoddef | subinterfacedef | varbinding | varassign ; beginendblock : attributeinstance* 'begin' (':' lowerCaseIdentifier)? (stmt)* 'end' (':' lowerCaseIdentifier)? ; /* MIT BSV does not need actionblock */ actionblock : attributeinstance* 'action' (stmt)* 'endaction' ; /* MIT BSV does not need actionblock */ actionvalueblock : attributeinstance* 'actionvalue' (stmt)* 'endactionvalue' ; regwrite : lhs=lvalue '<=' rhs=expression ; stmt : varbinding | actionbinding | patternbinding | varassign | functiondef | ruledef | regwrite ';' | beginendblock | ifstmt | casestmt | forstmt | whilestmt | expression ';' | returnstmt | actionblock | actionvalueblock ; ifstmt : 'if' '(' expression ')' stmt ('else' stmt)? ; /* MIT BSV: requires "matches" */ casestmt : 'case' '(' expression ')' (('matches' casestmtpatitem+) | casestmtitem*) casestmtdefaultitem? 'endcase' ; casestmtitem : match=expression (',' altmatches=expression)* ':' stmt ; casestmtpatitem : pattern patterncond* ':' stmt ; casestmtdefaultitem : 'default' (':')? stmt ; whilestmt : 'while' '(' expression ')' stmt ; forstmt : 'for' '(' forinit ';' fortest ';' forincr ')' stmt ; forinit : bsvtype var=lowerCaseIdentifier '=' expression (',' simplevardeclassign)* ; simplevardeclassign : bsvtype? var=lowerCaseIdentifier '=' expression ; fortest : expression ; forincr : varincr (',' varincr)* ; varincr : lowerCaseIdentifier '=' expression ; returnstmt : 'return' expression ';' ; pattern : '.' var=lowerCaseIdentifier | '.*' | constantpattern | taggedunionpattern | tuplepattern | '(' pattern ')' ; constantpattern : IntLiteral | IntPattern | RealLiteral | StringLiteral ; IntLiteral : ([1-9][0-9]*)?('\''[hdob]?)?[0-9a-fA-F_]+ ; IntPattern : ([1-9][0-9]*)?('\''[hdob]?)?[0-9a-fA-F_?]+ ; RealLiteral : [0-9]+'.'[0-9]+ ; StringLiteral : '"' (~ [\f\n\r\t"])* '"' ; taggedunionpattern : /* MIT BSV: optional "tagged" */ 'tagged'? tag=upperCaseIdentifier pattern? | tag=upperCaseIdentifier '{' lowerCaseIdentifier ':' pattern (',' lowerCaseIdentifier ':' pattern)* '}' ; tuplepattern : '{' pattern (',' pattern)* '}' ; attributeinstance : '(*' attrspec (',' attrspec)* '*)' ; attrspec : attrname=anyidentifier ('=' expression)? ; provisos : 'provisos' '(' proviso (',' proviso)* ')' ; proviso : (pkg=upperCaseIdentifier '::')? var=upperCaseIdentifier '#' '(' bsvtype (',' bsvtype)* ')' ; WS : [ \f\n\r\t]+ -> skip ; ONE_LINE_COMMENT : '//' .*? '\r'? '\n' -> channel (3) ; INLINE_COMMENT : '/*' .*? '*/' -> channel (3) ;
Scripts/Style_Pack_Maker.applescript
CaptureJuan/WPprojects
0
2126
<filename>Scripts/Style_Pack_Maker.applescript use AppleScript version "2.4" -- Yosemite (10.10) or later use scripting additions --Copyright 2021 Shootmachine.co on makeCOStylePackFromFolder(aFolder) tell application "Finder" set parentFolder to (container of aFolder) as alias set quotedPosixParent to (quoted form of (POSIX path of parentFolder)) set packName to name of aFolder set packFilename to packName & ".costylepack" end tell do shell script "cd " & quotedPosixParent & " ; zip -rX " & quoted form of packFilename & " " & quoted form of packName & " -x \"*.DS_Store\"" end makeCOStylePackFromFolder on open Dropped_Items -- could be folders or files repeat with inputFolder in Dropped_Items my makeCOStylePackFromFolder(inputFolder) end repeat end open on run set inputFolder to choose folder with prompt "Select a folder (of Styles) to turn into a Style pack" my makeCOStylePackFromFolder(inputFolder) end run
test/test_system.applescript
darricktheprogrammer/Yaasl
1
4657
property parent : script "ASUnit" property suite : makeTestSuite("System") set suite's loggers to {ConsoleLogger} autorun(suite) script BaseSystemTest property parent : TestSet(me) property systemlib : missing value property NO_ERROR : "0: no error" property startup_disk : missing value -- System log should be available on all systems, so it is good for alias testing property systemlog : item 1 of (list disks) & ":private:var:log:system.log" on setUp() tell application "System Events" to set startup_disk to name of startup disk tell application "System Events" set top_level to POSIX path of (container of container of (path to me)) & "/" end tell set systemlib to load script (top_level & "system.scpt") end setUp end script script PathData property parent : BaseSystemTest script ExistsPath_HFSOfExistingPath_ReturnsTrue property parent : UnitTest(me) set path_exists to my systemlib's exists_path((path to desktop as string)) assertEqual(true, path_exists) end script script ExistsPath_HFSOfNonExistingPath_ReturnsFalse property parent : UnitTest(me) set path_exists to my systemlib's exists_path("No:path:exists:") assertEqual(false, path_exists) end script script ExistsPath_PosixOfExistingPath_ReturnsTrue property parent : UnitTest(me) set path_exists to my systemlib's exists_path(POSIX path of (path to desktop as string)) assertEqual(true, path_exists) end script script ExistsPath_PosixOfNonExistingPath_ReturnsFalse property parent : UnitTest(me) set path_exists to my systemlib's exists_path("/No/path/exists") assertEqual(false, path_exists) end script script ExistsPath_ExistingAlias_ReturnsTrue property parent : UnitTest(me) set path_exists to my systemlib's exists_path(path to desktop) assertEqual(true, path_exists) end script script ExistsPath_ExistingDiskItem_ReturnsTrue property parent : UnitTest(me) tell application "System Events" set the_path to disk item (path to desktop as string) end tell set path_exists to my systemlib's exists_path(the_path) assertEqual(true, path_exists) end script -- script ParentDir_FileAlias_ReturnsParentDirectory -- property parent : UnitTest(me) -- set pardir to my systemlib's parent_dir(alias my systemlog) -- assertEqual("Kobol:private:var:log", pardir) -- end script -- script ParentDir_HFSString_ReturnsParentDirectory -- property parent : UnitTest(me) -- set pardir to my systemlib's parent_dir(alias "Kobol:private:var:log:system.log") -- assertEqual("Kobol:private:var:log", pardir) -- end script -- script PathParts_ExistingAlias_ReturnsParts -- property parent : UnitTest(me) -- -- system log should be available on all systems -- set parts to my systemlib's path_parts(alias "Kobol:private:var:log:system.log") -- assertEqual({"Kobol:private:var:log", "system", "log"}, parts) -- end script script PathParts_HFSString_ReturnsParts property parent : UnitTest(me) set parts to my systemlib's path_parts("test:path:filename.ext") assertEqual({"test:path", "filename", "ext"}, parts) end script script PathParts_PosixString_ReturnsParts property parent : UnitTest(me) set parts to my systemlib's path_parts("/test/path/filename.ext") assertEqual({"/test/path", "filename", "ext"}, parts) end script script PathParts_MissingExtension_ReturnsEmptyString property parent : UnitTest(me) set parts to my systemlib's path_parts("/test/path/filename") assertEqual("", item -1 of parts) end script script PathParts_MultipleDotsInFilename_ReturnsLastAsExtension property parent : UnitTest(me) set parts to my systemlib's path_parts("/test/path/filename.1.0.ext") assertEqual("ext", item -1 of parts) end script script PathParts_Directory_ReturnsFolderNameWithoutExtension property parent : UnitTest(me) set parts to my systemlib's path_parts("/test/path/foldername/") assertEqual({"/test/path", "foldername", ""}, parts) end script script PathParts_RootDirectory_ReturnsParts property parent : UnitTest(me) set parts to my systemlib's path_parts("/test/") assertEqual({"/", "test", ""}, parts) end script script PathParts_FilenameOnly_ReturnsFilename property parent : UnitTest(me) set parts to my systemlib's path_parts("test") assertEqual({"", "test", ""}, parts) end script script DiskOf_GivenPosixPath_ReturnsDisk property parent : UnitTest(me) set disk_name to my systemlib's disk_of("/Volumes/diskname/dir/file.txt") assertEqual("diskname", disk_name) end script script DiskOf_GivenHFSPathToConnectedDisk_ReturnsDisk property parent : UnitTest(me) set disk_name to my systemlib's disk_of("Macintosh HD:Users:dir:file.txt") assertEqual("Macintosh HD", disk_name) end script script DiskOf_GivenHFSPathToUnconnectedDisk_ReturnsDisk property parent : UnitTest(me) set disk_name to my systemlib's disk_of("diskname:Users:dir:file.txt") assertEqual("diskname", disk_name) end script script DiskOf_GivenHFSPosixFile_ReturnsDisk property parent : UnitTest(me) set disk_name to my systemlib's disk_of("Macintosh HD:Volumes:diskname:dir:file.txt") assertEqual("diskname", disk_name) end script end script
test/fail/Issue256.agda
asr/agda-kanso
1
10597
<reponame>asr/agda-kanso {-# OPTIONS --universe-polymorphism #-} module Issue256 where open import Imports.Level const : ∀ {a b} {A : Set a} {B : Set b} → A → B → A const x = λ _ → x level : ∀ {ℓ} → Set ℓ → Level level {ℓ} _ = ℓ -- termination check should fail for the following definition ℓ : Level ℓ = const zero (Set ℓ) -- A : Set (suc {!ℓ!}) -- A = Set (level A)
programs/oeis/267/A267755.asm
neoneye/loda
22
165484
<reponame>neoneye/loda ; A267755: Expansion of (1 + 2*x + x^2 + x^3 + 4*x^4 + 2*x^5)/(1 - x - x^5 + x^6). ; 1,3,4,5,9,12,14,15,16,20,23,25,26,27,31,34,36,37,38,42,45,47,48,49,53,56,58,59,60,64,67,69,70,71,75,78,80,81,82,86,89,91,92,93,97,100,102,103,104,108,111,113,114,115,119,122,124,125,126,130,133,135,136,137,141,144,146,147,148,152,155,157,158,159,163,166,168,169,170,174,177,179,180,181,185,188,190,191,192,196,199,201,202,203,207,210,212,213,214,218 mov $2,$0 add $2,1 mov $6,$0 lpb $2 mov $0,$6 sub $2,1 sub $0,$2 mov $5,2 lpb $0 mul $5,25769 sub $5,$0 lpb $5 mov $0,0 mov $4,3 mod $5,5 lpe trn $5,1 lpe mul $4,$5 mov $3,$4 div $3,3 add $3,1 add $1,$3 lpe mov $0,$1
src/botio.adb
Hamster-Furtif/JeremyPlusPlus
0
12017
with montecarlo, ada.Text_IO, ada.Integer_Text_IO, opstrat, read_preflop; use montecarlo, ada.Text_IO, ada.Integer_Text_IO, opstrat, read_preflop; package body botIO is function splitLine(line : String; line_length : Integer) return T_command is word_begin : Integer := 1; word_count : Integer := 0; command :T_command; begin for i in 1..line_length loop if line(i) = ' ' or line(i) = ',' then if(word_count = 0) then command.pars(0) := To_Unbounded_String(line(line'First..i-1)); command.prefix := T_prefix'Value(line(line'First..i-1)); else command.pars(word_count) := To_Unbounded_String( line(word_begin..i-1) ); end if; word_begin := i+1; word_count := word_count +1; end if; end loop; command.pars(word_count) := To_Unbounded_String(line(word_begin..line_length)); command.size := word_count; return command; end splitLine; procedure readSettings(command : T_command; game : in out T_game) is settings_replaced : T_settings := get_settings(game); begin if To_String(command.pars(1)) = "hand_per_level" then set_hands_per_lvl(settings_replaced,Integer'Value(To_String(command.pars(2)))); elsif To_String(command.pars(1)) = "timebank" then set_timebank_max(settings_replaced,Integer'Value(To_String(command.pars(2)))); elsif To_String(command.pars(1)) = "time_per_move" then set_timebank_sup(settings_replaced,Integer'Value(To_String(command.pars(2)))); end if; set_settings(game,settings_replaced); end readSettings; procedure readUpdateGame(command : T_command; game : in out T_game) is begin if(To_String(command.pars(1)) = "hand") then set_round(game,Integer'Value(To_String(command.pars(2)))); elsif (To_String(command.pars(1)) = "stack") then if(command.pars(2) = "self") then set_my_money(game,Integer'Value(To_String(command.pars(3)))); else set_op_money(game,Integer'Value(To_String(command.pars(3)))); end if; elsif (To_String(command.pars(1)) = "button") then set_button_is_mine(game, command.pars(2) = "self"); set_round(game, get_round(game)+ 1); elsif (To_String(command.pars(1)) = "small_blind") then set_small_blind(game,Integer'value(To_String(command.pars(2)))); elsif (To_String(command.pars(1)) = "big_blind") then set_big_blind(game,Integer'value(To_String(command.pars(2)))); end if; end readUpdateGame; procedure readUpdateHand(command : T_command; game : in out T_game; logic : in out T_logic) is hand_replaced : T_set := get_hand(game); op_hand_replaced : T_set := get_op_hand(game); table_replaced : T_set := get_table(game); begin if(To_String(command.pars(1)) = "hand") then if(To_String(command.pars(2)) = "self") then emptySet(hand_replaced); addToSet(parseCard(To_String(command.pars(3))), hand_replaced); addToSet(parseCard(To_String(command.pars(4))), hand_replaced); set_hand(game, hand_replaced); set_winning_chances(logic, Get_Winning_Chance(get_card(get_hand(game),0), get_card(get_hand(game),1))); else emptySet(op_hand_replaced); addToSet(parseCard(To_String(command.pars(3))), op_hand_replaced); addToSet(parseCard(To_String(command.pars(4))), op_hand_replaced); set_op_hand(game,op_hand_replaced); if (get_current_move(logic) = bet) then add_bluff(logic, opIsBluffing(op_hand_replaced)); end if; end if; elsif(To_String(command.pars(1)) = "table") then emptySet(table_replaced); for i in 2..(command.size-1) loop addToSet(parseCard(To_String(command.pars(i))), table_replaced); end loop; set_table(game,table_replaced); set_winning_chances(logic, chancesOfWinning(get_hand(game),get_table(game))); elsif(To_String(command.pars(1)) = "pot") then set_pot(game,Integer'Value(To_String(command.pars(2)))); elsif(To_String(command.pars(1)) = "amount_to_call") then set_amount_to_call(game,Integer'Value(To_String(command.pars(2)))); elsif(To_String(command.pars(1)) = "min_bet") then set_min_bet(game,Integer'Value(To_String(command.pars(2)))); elsif (To_String(command.pars(1)) = "move") then if(To_String(command.pars(2)) = "other" ) then if (To_String(command.pars(3)) = "bet") then set_op_money(game, get_op_money(game) - Integer'Value(To_String(command.pars(4)))); set_current_move(logic, bet); else set_current_move(logic, none); end if; end if; elsif (To_String(command.pars(1)) = "win") then if(To_String(command.pars(2)) = "other") then set_op_money(game, get_op_money(game) + Integer'Value(To_String(command.pars(3)))); else set_my_money(game, get_my_money(game) + Integer'Value(To_String(command.pars(3)))); end if; if (get_size(get_op_hand(game)) > 0) then null; end if; end if; end readUpdateHand; procedure printCard(card : in T_card) is begin Put_Line(Standard_Error, ""); Put(Standard_Error, get_rank(card)+1); Put(Standard_Error, " of "); Put(Standard_Error, (T_colour'Image(get_colour(card)))); Put_Line(Standard_Error, ""); end printCard; function parseCard(str : in String) return T_card is card : T_card; values : String := "23456789TJQKA"; begin for i in 1..values'Length loop if values(i) = str(str'First) then set_rank(card,i-1); end if; end loop; case str(str'First + 1) is when 'c' => set_colour(card, T_colour'Value("clovers")); when 's' => set_colour(card, T_colour'Value("spades")); when 'h' => set_colour(card, T_colour'Value("hearts")); when 'd' => set_colour(card, T_colour'Value("diamonds")); when others => set_colour(card, T_colour'Value("empty")); end case; return card; end parseCard; end botIO;
agda/SNat/Properties.agda
bgbianchi/sorting
6
9204
<gh_stars>1-10 {-# OPTIONS --sized-types #-} module SNat.Properties where open import Size open import SNat open import SNat.Order open import SNat.Order.Properties open import SNat.Sum lemma-≅subtyping : {ι ι' : Size}{m : SNat {ι}}{n : SNat {ι'}} → m ≅ n → m ≅ subtyping n lemma-≅subtyping z≅z = z≅z lemma-≅subtyping (s≅s m≅n) = s≅s (lemma-≅subtyping m≅n) lemma-subtyping≅ : {ι ι' : Size}{m : SNat {ι}}{n : SNat {ι'}} → m ≅ n → subtyping m ≅ n lemma-subtyping≅ z≅z = z≅z lemma-subtyping≅ (s≅s m≅n) = s≅s (lemma-subtyping≅ m≅n) lemma-subtyping≅subtyping : {ι ι' : Size}{m : SNat {ι}}{n : SNat {ι'}} → m ≅ n → subtyping m ≅ subtyping n lemma-subtyping≅subtyping z≅z = z≅z lemma-subtyping≅subtyping (s≅s m≅n) = s≅s (lemma-subtyping≅subtyping m≅n) lemma-≤′subtyping : {ι ι' : Size}{m : SNat {ι}}{n : SNat {ι'}} → m ≤′ n → m ≤′ subtyping n lemma-≤′subtyping (≤′-eq m≅n) = ≤′-eq (lemma-≅subtyping m≅n) lemma-≤′subtyping (≤′-step m≤′n) = ≤′-step (lemma-≤′subtyping m≤′n) lemma-subtyping≤′ : {ι ι' : Size}{m : SNat {ι}}{n : SNat {ι'}} → m ≤′ n → subtyping m ≤′ n lemma-subtyping≤′ (≤′-eq m≅n) = ≤′-eq (lemma-subtyping≅ m≅n) lemma-subtyping≤′ (≤′-step m≤′n) = ≤′-step (lemma-subtyping≤′ m≤′n) lemma-subtyping≤subtyping : {ι ι' : Size}{m : SNat {ι}}{n : SNat {ι'}} → m ≤ n → subtyping m ≤ subtyping n lemma-subtyping≤subtyping (z≤n n) = z≤n (subtyping n) lemma-subtyping≤subtyping (s≤s m≤n) = s≤s (lemma-subtyping≤subtyping m≤n) lemma-subtyping≤′subtyping : {ι ι' : Size}{m : SNat {ι}}{n : SNat {ι'}} → m ≤′ n → subtyping m ≤′ subtyping n lemma-subtyping≤′subtyping m≤′n = lemma-≤-≤′ (lemma-subtyping≤subtyping (lemma-≤′-≤ m≤′n)) -- lemma-≅-/2 : {ι ι' : Size}{m : SNat {ι}}{n : SNat {ι'}} → m ≅ n → m /2 ≅ n /2 lemma-≅-/2 z≅z = z≅z lemma-≅-/2 (s≅s z≅z) = z≅z lemma-≅-/2 (s≅s (s≅s m≅n)) = s≅s (lemma-subtyping≅subtyping (lemma-≅-/2 m≅n)) lemma-n/2≤′sn/2 : {ι : Size}(n : SNat {ι}) → n /2 ≤′ (succ n) /2 lemma-n/2≤′sn/2 zero = lemma-z≤′n zero lemma-n/2≤′sn/2 (succ zero) = lemma-z≤′n (succ zero) lemma-n/2≤′sn/2 (succ (succ n)) = lemma-s≤′s (lemma-subtyping≤′subtyping (lemma-n/2≤′sn/2 n)) -- lemma-m≤′m+n : (m n : SNat) → m ≤′ (m + n) lemma-m≤′m+n zero n = lemma-z≤′n n lemma-m≤′m+n (succ m) n = lemma-s≤′s (lemma-m≤′m+n m n) lemma-2m≤′m+n+m+n : (m n : SNat) → (m + m) ≤′ ((m + n) + (m + n)) lemma-2m≤′m+n+m+n m n rewrite +-assoc-left (m + n) m n | +-comm (m + n) m | +-assoc-left m m n | +-assoc-right (m + m) n n = lemma-m≤′m+n (m + m) (n + n) lemma-2m≅2n : {m n : SNat} → m ≅ n → (m + m) ≅ (n + n) lemma-2m≅2n z≅z = z≅z lemma-2m≅2n (s≅s {m = m} {n = n} m≅n) rewrite +-assoc-succ m m | +-assoc-succ n n = s≅s (s≅s (lemma-2m≅2n m≅n)) lemma-2m≤′2n : {m n : SNat} → m ≤′ n → (m + m) ≤′ (n + n) lemma-2m≤′2n (≤′-eq m≅n) = ≤′-eq (lemma-2m≅2n m≅n) lemma-2m≤′2n (≤′-step {n = n} m≤′n) rewrite +-assoc-succ n n = ≤′-step (≤′-step (lemma-2m≤′2n m≤′n)) lemma-n≤′2n : (n : SNat) → n ≤′ (n + n) lemma-n≤′2n n = lemma-m≤′m+n n n +-right-monotony-≅ : {m n : SNat}(k : SNat) → m ≅ n → (m + k) ≅ (n + k) +-right-monotony-≅ k z≅z = refl≅ +-right-monotony-≅ k (s≅s m≅n) = s≅s (+-right-monotony-≅ k m≅n) +-right-monotony-≤′ : {m n : SNat}(k : SNat) → m ≤′ n → (m + k) ≤′ (n + k) +-right-monotony-≤′ k (≤′-eq m≅n) = ≤′-eq (+-right-monotony-≅ k m≅n) +-right-monotony-≤′ k (≤′-step m≤′n) = ≤′-step (+-right-monotony-≤′ k m≤′n) +-left-monotony-≤′ : {m n : SNat}(k : SNat) → m ≤′ n → (k + m) ≤′ (k + n) +-left-monotony-≤′ {m} {n} k m≤′n rewrite +-comm k m | +-comm k n = +-right-monotony-≤′ k m≤′n lemma-4m≤′n+m+n+m : {m n : SNat} → m ≤′ n → ((m + m) + (m + m)) ≤′ ((n + m) + (n + m)) lemma-4m≤′n+m+n+m {m} {n} m≤′n rewrite +-comm n m = lemma-2m≤′2n (+-left-monotony-≤′ m m≤′n) lemma-n≤′2n/2 : (n : SNat) → n ≤′ (n + n) /2 lemma-n≤′2n/2 zero = ≤′-eq z≅z lemma-n≤′2n/2 (succ n) rewrite +-assoc-succ (succ n) n = lemma-s≤′s (lemma-≤′subtyping (lemma-n≤′2n/2 n)) lemma-2n/2≤′n : (n : SNat) → (n + n) /2 ≤′ n lemma-2n/2≤′n zero = refl≤′ lemma-2n/2≤′n (succ n) rewrite +-assoc-succ (succ n) n = lemma-s≤′s (lemma-subtyping≤′ (lemma-2n/2≤′n n)) lemma-n+1≤′2n+2/2 : (n : SNat) → succ n ≤′ (succ (succ (n + n))) /2 lemma-n+1≤′2n+2/2 zero = refl≤′ lemma-n+1≤′2n+2/2 (succ n) rewrite +-assoc-succ (succ n) n = lemma-s≤′s (lemma-≤′subtyping (lemma-s≤′s (lemma-≤′subtyping (lemma-n≤′2n/2 n))))
cohesion/david_jaz_261/LEM.agda
glangmead/formalization
6
4614
{-# OPTIONS --without-K --rewriting #-} module LEM where open import Basics open import Flat open import Bool open import lib.Basics open import lib.types.Bool open import Bool open import lib.NType2 open import Axiom.LEM public flat-set-has-dec-eq : {@♭ i : ULevel} (@♭ A : hSet i) → has-dec-eq (♭ (∈ A)) flat-set-has-dec-eq A = λ {(x ^♭) (y ^♭) → LEM (_==ₚ_ {A = ♭ₙ A} (x ^♭) (y ^♭))} discrete-set-has-dec-eq : {@♭ i : ULevel} (@♭ A : hSet i) → (@♭ _ : (∈ A) is-discrete) → has-dec-eq (∈ A) discrete-set-has-dec-eq A p = transport has-dec-eq (discrete-id p) (flat-set-has-dec-eq A) _=bool=ₚ_ : {@♭ i : ULevel} {@♭ A : hSet i} {@♭ p : (∈ A) is-discrete} (x y : ∈ A) → Bool _=bool=ₚ_ {A = A} {p = p} x y = _=bool=_ {_} {∈ A} {discrete-set-has-dec-eq A p} x y un¬¬-crisp : {@♭ i : ULevel} {@♭ P : PropT i} (nnp : ¬ (¬ (P holds))) → P holds un¬¬-crisp {P = P} nnp with (LEM P) ... | (inl p) = p ... | (inr np) = quodlibet (nnp np) ♭PropT₀≃Bool : ♭ PropT₀ ≃ Bool ♭PropT₀≃Bool = equiv to fro to-fro fro-to where to : ♭ PropT₀ → Bool to (P ^♭) = Dec-Prop-to-Bool P (LEM P) fro : Bool → ♭ PropT₀ fro = Bool-to-♭PropT₀ to-fro : (b : Bool) → to (fro b) == b to-fro true = Dec-Prop-to-Bool-true-id True (LEM True) unit to-fro false = Dec-Prop-to-Bool-false-id False (LEM False) quodlibet fro-to : (P : ♭ PropT₀) → fro (to P) == P fro-to (P ^♭) = case P (LEM P) where case₀♭ : (@♭ P : PropT₀) → ♭ (P holds) → fro (to (P ^♭)) == (P ^♭) case₀♭ P (p ^♭) = fro (to (P ^♭)) =⟨ (ap fro (Dec-Prop-to-Bool-true-id P (LEM P) p)) ⟩ fro true -- Since P holds, it equals true =⟨ ! (♭-ap _^♭ (P holds-by p implies-=-True)) ⟩ P ^♭ =∎ case₁♭ : (@♭ P : PropT₀) → ♭ (¬ (P holds)) → fro (to (P ^♭)) == (P ^♭) case₁♭ P (np ^♭) = fro (to (P ^♭)) =⟨ (ap fro (Dec-Prop-to-Bool-false-id P (LEM P) np)) ⟩ fro false =⟨ ! (♭-ap _^♭ (¬- P holds-by np implies-=-False)) ⟩ P ^♭ =∎ case : (@♭ P : PropT₀) → (@♭ d : Dec (P holds)) → fro (to (P ^♭)) == (P ^♭) case P (inl p ) = case₀♭ P (p ^♭) case P (inr np) = case₁♭ P (np ^♭) {- -- We prove that this equivalence preserves the relevant logical structure. module ♭PropT₀≃Bool-properties where preserves-⇒ : {@♭ P Q : PropT₀} (p : (P ⇒ Q) holds) → (((–> ♭PropT₀≃Bool) (P ^♭)) ≤b ((–> ♭PropT₀≃Bool) (Q ^♭))) holds preserves-⇒ {P} {Q} p = {!!} -- As a corollary, we find that the points of the upper naturals are the conaturals. module Points-Of-Upper-Naturals-Are-Conaturals where open import UpperNaturals open import Conaturals theorem : ℕ∞ ≃ ♭ ℕ↑ theorem = {!!} -}
src/Expansion/CCS.agda
nad/up-to
0
13888
------------------------------------------------------------------------ -- Lemmas related to expansion and CCS ------------------------------------------------------------------------ {-# OPTIONS --sized-types #-} open import Prelude hiding (module W; step-→) module Expansion.CCS {ℓ} {Name : Type ℓ} where open import Equality.Propositional open import Prelude.Size open import Function-universe equality-with-J hiding (id; _∘_) import Bisimilarity.CCS as SL import Bisimilarity.Equational-reasoning-instances import Bisimilarity.Weak.Equational-reasoning-instances open import Equational-reasoning import Expansion.Equational-reasoning-instances open import Labelled-transition-system.CCS Name open import Relation open import Bisimilarity CCS as S using (_∼_) open import Bisimilarity.Weak CCS as W using (_≈_; force) open import Expansion CCS import Labelled-transition-system.Equational-reasoning-instances CCS as Dummy -- Some lemmas used to prove the congruence lemmas below as well as -- similar results in Bisimilarity.Weak.CCS. module Cong-lemmas ({R} R′ : Proc ∞ → Proc ∞ → Type ℓ) ⦃ _ : Reflexive R′ ⦄ ⦃ _ : Convertible R R′ ⦄ ⦃ _ : Convertible R′ R′ ⦄ ⦃ _ : Transitive′ R′ _∼_ ⦄ ⦃ _ : Transitive _∼_ R′ ⦄ {_[_]↝_ : Proc ∞ → Label → Proc ∞ → Type ℓ} (right-to-left : ∀ {P Q} → R P Q → ∀ {Q′ μ} → Q [ μ ]⟶ Q′ → ∃ λ P′ → P [ μ ]↝ P′ × R′ P′ Q′) ⦃ _ : ∀ {μ} → Convertible _[ μ ]↝_ _[ μ ]↝_ ⦄ ⦃ _ : ∀ {μ} → Convertible _[ μ ]⟶_ _[ μ ]↝_ ⦄ (↝→[]⇒ : ∀ {P Q a} → P [ name a ]↝ Q → P [ name a ]⇒ Q) ([]⇒→↝ : ∀ {P Q} → P [ τ ]⇒ Q → P [ τ ]↝ Q) (map-↝ : {F : Proc ∞ → Proc ∞} → (∀ {P P′ μ} → P [ μ ]⟶ P′ → F P [ μ ]⟶ F P′) → ∀ {P P′ μ} → P [ μ ]↝ P′ → F P [ μ ]↝ F P′) (map-↝′ : ∀ {μ} {F : Proc ∞ → Proc ∞} → (∀ {P P′ μ} → Silent μ → P [ μ ]⟶ P′ → F P [ μ ]⟶ F P′) → (∀ {P P′} → P [ μ ]⟶ P′ → F P [ μ ]⟶ F P′) → ∀ {P P′} → P [ μ ]↝ P′ → F P [ μ ]↝ F P′) (zip-↝ : {F : Proc ∞ → Proc ∞ → Proc ∞} → (∀ {P P′ Q μ} → P [ μ ]⟶ P′ → F P Q [ μ ]⟶ F P′ Q) → (∀ {P Q Q′ μ} → Q [ μ ]⟶ Q′ → F P Q [ μ ]⟶ F P Q′) → ∀ {μ₁ μ₂ μ₃} → (Silent μ₁ → Silent μ₂ → Silent μ₃) → (∀ {P P′ Q} → P [ μ₁ ]⟶ P′ → Silent μ₂ → F P Q [ μ₃ ]⟶ F P′ Q) → (∀ {P Q Q′} → Silent μ₁ → Q [ μ₂ ]⟶ Q′ → F P Q [ μ₃ ]⟶ F P Q′) → (∀ {P P′ Q Q′} → P [ μ₁ ]⟶ P′ → Q [ μ₂ ]⟶ Q′ → F P Q [ μ₃ ]⟶ F P′ Q′) → ∀ {P P′ Q Q′} → P [ μ₁ ]↝ P′ → Q [ μ₂ ]↝ Q′ → F P Q [ μ₃ ]↝ F P′ Q′) (!-lemma : (∀ {P Q μ} → P [ μ ]⇒ Q → ! P [ μ ]⇒ ! P ∣ Q) → ∀ {P Q μ} → P [ μ ]↝ Q → ∃ λ P′ → ((! P) [ μ ]↝ P′) × P′ ∼ ! P ∣ Q) where private infix -3 rl-result-↝ rl-result-↝ : ∀ {P P′ Q′} μ → P [ μ ]↝ P′ → R′ P′ Q′ → ∃ λ P′ → (P [ μ ]↝ P′) × R′ P′ Q′ rl-result-↝ _ P↝P′ P′≳′Q′ = _ , P↝P′ , P′≳′Q′ syntax rl-result-↝ μ P↝P′ P′≳′Q′ = P↝P′ ↝[ μ ] P′≳′Q′ ∣-cong : (∀ {P P′ Q Q′} → R′ P P′ → R′ Q Q′ → R′ (P ∣ Q) (P′ ∣ Q′)) → ∀ {P₁ P₂ Q₁ Q₂ R₂ μ} → R P₁ P₂ → R Q₁ Q₂ → P₂ ∣ Q₂ [ μ ]⟶ R₂ → ∃ λ R₁ → ((P₁ ∣ Q₁) [ μ ]↝ R₁) × R′ R₁ R₂ ∣-cong _∣-cong′_ P₁≳P₂ Q₁≳Q₂ = λ where (par-left tr) → Σ-map (_∣ _) (Σ-map (map-↝ par-left) (_∣-cong′ convert Q₁≳Q₂)) (right-to-left P₁≳P₂ tr) (par-right tr) → Σ-map (_ ∣_) (Σ-map (map-↝ par-right) (convert P₁≳P₂ ∣-cong′_)) (right-to-left Q₁≳Q₂ tr) (par-τ tr₁ tr₂) → Σ-zip _∣_ (Σ-zip (zip-↝ par-left par-right (λ ()) (λ _ ()) (λ ()) par-τ) _∣-cong′_) (right-to-left P₁≳P₂ tr₁) (right-to-left Q₁≳Q₂ tr₂) ·-cong : ∀ {P₁ P₂ Q₂ μ μ′} → R′ (force P₁) (force P₂) → μ · P₂ [ μ′ ]⟶ Q₂ → ∃ λ Q₁ → ((μ · P₁) [ μ′ ]↝ Q₁) × R′ Q₁ Q₂ ·-cong P₁≳P₂ action = _ , convert (⟶: action) , P₁≳P₂ ⟨ν⟩-cong : (∀ {a P P′} → R′ P P′ → R′ (⟨ν a ⟩ P) (⟨ν a ⟩ P′)) → ∀ {a μ P P′ Q′} → R P P′ → ⟨ν a ⟩ P′ [ μ ]⟶ Q′ → ∃ λ Q → (⟨ν a ⟩ P [ μ ]↝ Q) × R′ Q Q′ ⟨ν⟩-cong ⟨ν⟩-cong′ {a} {μ} {P} P≳P′ (restriction {P′ = Q′} a∉μ P′⟶Q′) = case right-to-left P≳P′ P′⟶Q′ of λ where (Q , P↝Q , Q≳′Q′) → ⟨ν a ⟩ P →⟨ map-↝′ (restriction ∘ ∉τ) (restriction a∉μ) P↝Q ⟩■ ↝[ μ ] ⟨ν a ⟩ Q ∼⟨ ⟨ν⟩-cong′ Q≳′Q′ ⟩■ ⟨ν a ⟩ Q′ !-cong-lemma₁ : ∀ {P Q μ} → P [ μ ]⇒ Q → ! P [ μ ]⇒ ! P ∣ Q !-cong-lemma₁ {P} {Q} {μ} = λ where (steps {q′ = Q′} done P⟶Q′ Q′⇒Q) → ! P [ μ ]⇒⟨ replication (par-right P⟶Q′) ⟩ ! P ∣ Q′ →⟨ map-⇒ par-right Q′⇒Q ⟩■ ! P ∣ Q (steps {p′ = P″} {q′ = Q′} (step {q = P′} {μ = μ′} μ′s P⟶P′ P′⇒P″) P″⟶Q′ Q′⇒Q) → ! P →⟨ ⟶→⇒ μ′s (replication (par-right P⟶P′)) ⟩ ! P ∣ P′ →⟨ map-⇒ par-right P′⇒P″ ⟩ ! P ∣ P″ [ μ ]⇒⟨ par-right P″⟶Q′ ⟩ ! P ∣ Q′ →⟨ map-⇒ par-right Q′⇒Q ⟩■ ! P ∣ Q !-cong-lemma₂ : ∀ {P Q₁ Q₂ a} → P [ name a ]⇒ Q₁ → P [ name (co a) ]⇒ Q₂ → ∃ λ R → ! P [ τ ]⇒ R × R ∼ (! P ∣ Q₁) ∣ Q₂ !-cong-lemma₂ {P} {Q₁} {Q₂} {a} = λ where (steps {q′ = Q₁′} done P⟶Q₁′ Q₁′⇒Q₁) (steps {q′ = Q₂′} done P⟶Q₂′ Q₂′⇒Q₂) → _ , (! P [ τ ]⇒⟨ replication (par-τ (replication (par-right P⟶Q₁′)) P⟶Q₂′) ⟩ (! P ∣ Q₁′) ∣ Q₂′ →⟨ zip-⇒ par-left par-right (map-⇒ par-right Q₁′⇒Q₁) Q₂′⇒Q₂ ⟩■ (! P ∣ Q₁) ∣ Q₂) , reflexive (steps {q′ = Q₁′} done P⟶Q₁′ Q₁′⇒Q₁) (steps {p′ = P₂″} {q′ = Q₂′} (step {q = P₂′} {μ = μ} μs P⟶P₂′ P₂′⇒P₂″) P₂″⟶Q₂′ Q₂′⇒Q₂) → _ , (! P →⟨ ⟶→⇒ μs (replication (par-right P⟶P₂′)) ⟩ ! P ∣ P₂′ →⟨ map-⇒ par-right P₂′⇒P₂″ ⟩ ! P ∣ P₂″ [ τ ]⇒⟨ par-τ (replication (par-right P⟶Q₁′)) P₂″⟶Q₂′ ⟩ (! P ∣ Q₁′) ∣ Q₂′ →⟨ zip-⇒ par-left par-right (map-⇒ par-right Q₁′⇒Q₁) Q₂′⇒Q₂ ⟩■ (! P ∣ Q₁) ∣ Q₂) , reflexive (steps {p′ = P₁″} {q′ = Q₁′} (step {q = P₁′} {μ = μ} μs P⟶P₁′ P₁′⇒P₁″) P₁″⟶Q₁′ Q₁′⇒Q₁) (steps {q′ = Q₂′} done P⟶Q₂′ Q₂′⇒Q₂) → _ , (! P →⟨ ⟶→⇒ μs (replication (par-right P⟶P₁′)) ⟩ ! P ∣ P₁′ →⟨ map-⇒ par-right P₁′⇒P₁″ ⟩ ! P ∣ P₁″ [ τ ]⇒⟨ par-τ′ (sym $ co-involutive a) (replication (par-right P⟶Q₂′)) P₁″⟶Q₁′ ⟩ (! P ∣ Q₂′) ∣ Q₁′ →⟨ zip-⇒ par-left par-right (map-⇒ par-right Q₂′⇒Q₂) Q₁′⇒Q₁ ⟩■ (! P ∣ Q₂) ∣ Q₁) , ((! P ∣ Q₂) ∣ Q₁ ∼⟨ SL.swap-rightmost ⟩■ (! P ∣ Q₁) ∣ Q₂) (steps {p′ = P₁″} {q′ = Q₁′} (step {q = P₁′} {μ = μ₁} μ₁s P⟶P₁′ P₁′⇒P₁″) P₁″⟶Q₁′ Q₁′⇒Q₁) (steps {p′ = P₂″} {q′ = Q₂′} (step {q = P₂′} {μ = μ₂} μ₂s P⟶P₂′ P₂′⇒P₂″) P₂″⟶Q₂′ Q₂′⇒Q₂) → _ , (! P →⟨ ⟶→⇒ μ₂s (replication (par-right P⟶P₂′)) ⟩ ! P ∣ P₂′ →⟨ ⟶→⇒ μ₁s (par-left (replication (par-right P⟶P₁′))) ⟩ (! P ∣ P₁′) ∣ P₂′ →⟨ zip-⇒ par-left par-right (map-⇒ par-right P₁′⇒P₁″) P₂′⇒P₂″ ⟩ (! P ∣ P₁″) ∣ P₂″ [ τ ]⇒⟨ par-τ (par-right P₁″⟶Q₁′) P₂″⟶Q₂′ ⟩ (! P ∣ Q₁′) ∣ Q₂′ →⟨ zip-⇒ par-left par-right (map-⇒ par-right Q₁′⇒Q₁) Q₂′⇒Q₂ ⟩■ (! P ∣ Q₁) ∣ Q₂) , reflexive !-cong : (∀ {P P′ Q Q′} → R′ P P′ → R′ Q Q′ → R′ (P ∣ Q) (P′ ∣ Q′)) → (∀ {P P′} → R′ P P′ → R′ (! P) (! P′)) → ∀ {P P′ Q′ μ} → R P P′ → ! P′ [ μ ]⟶ Q′ → ∃ λ Q → ((! P) [ μ ]↝ Q) × R′ Q Q′ !-cong _∣-cong′_ !-cong′_ {P} {P′} {Q′} {μ} P≳P′ !P′⟶Q′ = case SL.6-1-3-2 !P′⟶Q′ of λ where (inj₁ (P″ , P′⟶P″ , Q′∼!P′∣P″)) → let Q , P↝Q , Q≳′P″ = right-to-left P≳P′ P′⟶P″ R , !P↝R , R∼!P∣Q = !-lemma !-cong-lemma₁ P↝Q in ! P →⟨ !P↝R ⟩■ ↝[ μ ] R ∼⟨ R∼!P∣Q ⟩ ! P ∣ Q ∼′⟨ (!-cong′ (convert P≳P′)) ∣-cong′ Q≳′P″ ⟩ ! P′ ∣ P″ ∼⟨ symmetric Q′∼!P′∣P″ ⟩■ Q′ (inj₂ (refl , P″ , P‴ , a , P′⟶P″ , P′⟶P‴ , Q′∼!P′∣P″∣P‴)) → let Q₁ , P↝Q₁ , Q₁≳′P″ = right-to-left P≳P′ P′⟶P″ Q₂ , P↝Q₂ , Q₂≳′P‴ = right-to-left P≳P′ P′⟶P‴ R , !P⇒R , R∼[!P∣Q₁]∣Q₂ = !-cong-lemma₂ (↝→[]⇒ P↝Q₁) (↝→[]⇒ P↝Q₂) in ! P →⟨ []⇒→↝ !P⇒R ⟩■ ↝[ τ ] R ∼⟨ R∼[!P∣Q₁]∣Q₂ ⟩ (! P ∣ Q₁) ∣ Q₂ ∼′⟨ ((!-cong′ (convert P≳P′)) ∣-cong′ Q₁≳′P″) ∣-cong′ Q₂≳′P‴ ⟩ (! P′ ∣ P″) ∣ P‴ ∼⟨ symmetric Q′∼!P′∣P″∣P‴ ⟩■ Q′ ⊕·-cong : ∀ {P Q Q′ S′ μ μ′} → R′ (force Q) (force Q′) → P ⊕ μ · Q′ [ μ′ ]⟶ S′ → ∃ λ S → ((P ⊕ μ · Q) [ μ′ ]↝ S) × R′ S S′ ⊕·-cong {P} {Q} {Q′} {S′} {μ} {μ′} Q≳Q′ = λ where (sum-left P⟶S′) → P ⊕ μ · Q →⟨ ⟶: sum-left P⟶S′ ⟩■ ↝[ μ′ ] S′ ■ (sum-right action) → P ⊕ μ · Q →⟨ ⟶: sum-right action ⟩■ ↝[ μ ] force Q ∼⟨ Q≳Q′ ⟩■ force Q′ ·⊕·-cong : ∀ {μ₁ μ₂ P₁ P₁′ P₂ P₂′ S′ μ} → R′ (force P₁) (force P₁′) → R′ (force P₂) (force P₂′) → μ₁ · P₁′ ⊕ μ₂ · P₂′ [ μ ]⟶ S′ → ∃ λ S → ((μ₁ · P₁ ⊕ μ₂ · P₂) [ μ ]↝ S) × R′ S S′ ·⊕·-cong {μ₁} {μ₂} {P₁} {P₁′} {P₂} {P₂′} P₁≳P₁′ P₂≳P₂′ = λ where (sum-left action) → μ₁ · P₁ ⊕ μ₂ · P₂ →⟨ ⟶: sum-left action ⟩■ ↝[ μ₁ ] force P₁ ∼⟨ P₁≳P₁′ ⟩■ force P₁′ (sum-right action) → μ₁ · P₁ ⊕ μ₂ · P₂ →⟨ ⟶: sum-right action ⟩■ ↝[ μ₂ ] force P₂ ∼⟨ P₂≳P₂′ ⟩■ force P₂′ private module CL {i} = Cong-lemmas [ i ]_≳′_ right-to-left id id map-[]⇒ map-[]⇒′ (λ f g _ _ _ → zip-[]⇒ f g) (λ hyp P⇒Q → _ , hyp P⇒Q , reflexive) mutual -- _∣_ preserves the expansion relation. infix 6 _∣-cong_ _∣-cong′_ _∣-cong_ : ∀ {i P P′ Q Q′} → [ i ] P ≳ P′ → [ i ] Q ≳ Q′ → [ i ] P ∣ Q ≳ P′ ∣ Q′ _∣-cong_ {i} P≳P′ Q≳Q′ = ⟨ lr P≳P′ Q≳Q′ , CL.∣-cong _∣-cong′_ P≳P′ Q≳Q′ ⟩ where lr : ∀ {P P′ Q Q′ R μ} → [ i ] P ≳ P′ → [ i ] Q ≳ Q′ → P ∣ Q [ μ ]⟶ R → ∃ λ R′ → P′ ∣ Q′ [ μ ]⟶̂ R′ × [ i ] R ≳′ R′ lr P≳P′ Q≳Q′ (par-left tr) = Σ-map (_∣ _) (Σ-map (map-⟶̂ par-left) (_∣-cong′ convert {a = ℓ} Q≳Q′)) (left-to-right P≳P′ tr) lr P≳P′ Q≳Q′ (par-right tr) = Σ-map (_ ∣_) (Σ-map (map-⟶̂ par-right) (convert {a = ℓ} P≳P′ ∣-cong′_)) (left-to-right Q≳Q′ tr) lr P≳P′ Q≳Q′ (par-τ tr₁ tr₂) = Σ-zip _∣_ (Σ-zip (zip-⟶̂ (λ ()) (λ _ ()) (λ ()) par-τ) _∣-cong′_) (left-to-right P≳P′ tr₁) (left-to-right Q≳Q′ tr₂) _∣-cong′_ : ∀ {i P P′ Q Q′} → [ i ] P ≳′ P′ → [ i ] Q ≳′ Q′ → [ i ] P ∣ Q ≳′ P′ ∣ Q′ force (P≳P′ ∣-cong′ Q≳Q′) = force P≳P′ ∣-cong force Q≳Q′ -- _·_ preserves the expansion relation. infix 12 _·-cong_ _·-cong′_ _·-cong_ : ∀ {i μ μ′ P P′} → μ ≡ μ′ → [ i ] force P ≳′ force P′ → [ i ] μ · P ≳ μ′ · P′ _·-cong_ {i} {μ} {P = P} {P′} refl P≳P′ = ⟨ lr , CL.·-cong P≳P′ ⟩ where lr : ∀ {Q μ″} → μ · P [ μ″ ]⟶ Q → ∃ λ Q′ → μ · P′ [ μ″ ]⟶̂ Q′ × [ i ] Q ≳′ Q′ lr action = _ , ⟶→⟶̂ action , P≳P′ _·-cong′_ : ∀ {i μ μ′ P P′} → μ ≡ μ′ → [ i ] force P ≳′ force P′ → [ i ] μ · P ≳′ μ′ · P′ force (μ≡μ′ ·-cong′ P≳P′) = μ≡μ′ ·-cong P≳P′ -- _∙_ preserves the expansion relation. infix 12 _∙-cong_ _∙-cong′_ _∙-cong_ : ∀ {i μ μ′ P P′} → μ ≡ μ′ → [ i ] P ≳ P′ → [ i ] μ ∙ P ≳ μ′ ∙ P′ refl ∙-cong P≳P′ = refl ·-cong convert {a = ℓ} P≳P′ _∙-cong′_ : ∀ {i μ μ′ P P′} → μ ≡ μ′ → [ i ] P ≳′ P′ → [ i ] μ ∙ P ≳′ μ′ ∙ P′ force (μ≡μ′ ∙-cong′ P≳P′) = μ≡μ′ ∙-cong force P≳P′ -- _∙ turns equal actions into processes related by the expansion -- relation. infix 12 _∙-cong _∙-cong′ _∙-cong : ∀ {μ μ′} → μ ≡ μ′ → μ ∙ ≳ μ′ ∙ refl ∙-cong = reflexive _∙-cong′ : ∀ {μ μ′} → μ ≡ μ′ → μ ∙ ≳′ μ′ ∙ refl ∙-cong′ = reflexive mutual -- ⟨ν_⟩ preserves the expansion relation. ⟨ν_⟩-cong : ∀ {i a a′ P P′} → a ≡ a′ → [ i ] P ≳ P′ → [ i ] ⟨ν a ⟩ P ≳ ⟨ν a′ ⟩ P′ ⟨ν_⟩-cong {i} {a} {P = P} {P′} refl P≳P′ = ⟨ lr , CL.⟨ν⟩-cong ⟨ν refl ⟩-cong′ P≳P′ ⟩ where lr : ∀ {Q μ} → ⟨ν a ⟩ P [ μ ]⟶ Q → ∃ λ Q′ → ⟨ν a ⟩ P′ [ μ ]⟶̂ Q′ × [ i ] Q ≳′ Q′ lr {μ = μ} (restriction {P′ = Q} a∉μ P⟶Q) with left-to-right P≳P′ P⟶Q ... | Q′ , step P′⟶Q′ , Q≳′Q′ = ⟨ν a ⟩ Q ∼⟨ ⟨ν refl ⟩-cong′ Q≳′Q′ ⟩■ ⟨ν a ⟩ Q′ ⟵̂[ μ ] ←⟨ ⟶: restriction a∉μ P′⟶Q′ ⟩■ ⟨ν a ⟩ P′ ... | _ , done μs , Q≳′P′ = ⟨ν a ⟩ Q ∼⟨ ⟨ν refl ⟩-cong′ Q≳′P′ ⟩■ ⟨ν a ⟩ P′ ⟵̂[ μ ] ←⟨ ⟶̂: done μs ⟩■ ⟨ν a ⟩ P′ ⟨ν_⟩-cong′ : ∀ {i a a′ P P′} → a ≡ a′ → [ i ] P ≳′ P′ → [ i ] ⟨ν a ⟩ P ≳′ ⟨ν a′ ⟩ P′ force (⟨ν a≡a′ ⟩-cong′ P≳P′) = ⟨ν a≡a′ ⟩-cong (force P≳P′) mutual -- !_ preserves the expansion relation. infix 10 !-cong_ !-cong′_ !-cong_ : ∀ {i P P′} → [ i ] P ≳ P′ → [ i ] ! P ≳ ! P′ !-cong_ {i} {P} {P′} P≳P′ = ⟨ lr , CL.!-cong _∣-cong′_ !-cong′_ P≳P′ ⟩ where lr : ∀ {Q μ} → ! P [ μ ]⟶ Q → ∃ λ Q′ → ! P′ [ μ ]⟶̂ Q′ × [ i ] Q ≳′ Q′ lr {Q} {μ} !P⟶Q = case SL.6-1-3-2 !P⟶Q of λ where (inj₁ (P″ , P⟶P″ , Q∼!P∣P″)) → case left-to-right P≳P′ P⟶P″ of λ where (_ , done s , P″≳′P′) → case silent≡τ s of λ where refl → _ , (! P′ ■) , (Q ∼⟨ Q∼!P∣P″ ⟩ ! P ∣ P″ ∼′⟨ !-cong′ (convert {a = ℓ} P≳P′) ∣-cong′ P″≳′P′ ⟩ S.∼: ! P′ ∣ P′ ∼⟨ SL.6-1-2 ⟩■ ! P′) (Q′ , step P′⟶Q′ , P″≳′Q′) → _ , (! P′ ∣ Q′ ←⟨ ⟶: replication (par-right P′⟶Q′) ⟩■ ! P′) , (Q ∼⟨ Q∼!P∣P″ ⟩ ! P ∣ P″ ∼⟨ !-cong′ (convert {a = ℓ} P≳P′) ∣-cong′ P″≳′Q′ ⟩■ ! P′ ∣ Q′) (inj₂ (refl , P″ , P‴ , a , P⟶P″ , P⟶P‴ , Q≳!P∣P″∣P‴)) → case left-to-right P≳P′ P⟶P″ ,′ left-to-right P≳P′ P⟶P‴ of λ where ((Q′ , step P′⟶Q′ , P″≳′Q′) , (Q″ , step P′⟶Q″ , P‴≳′Q″)) → _ , ((! P′ ∣ Q′) ∣ Q″ ←⟨ ⟶: replication (par-τ (replication (par-right P′⟶Q′)) P′⟶Q″) ⟩■ ! P′) , (Q ∼⟨ Q≳!P∣P″∣P‴ ⟩ (! P ∣ P″) ∣ P‴ ∼⟨ (!-cong′ (convert {a = ℓ} P≳P′) ∣-cong′ P″≳′Q′) ∣-cong′ P‴≳′Q″ ⟩■ (! P′ ∣ Q′) ∣ Q″) ((_ , done () , _) , _) (_ , (_ , done () , _)) !-cong′_ : ∀ {i P P′} → [ i ] P ≳′ P′ → [ i ] ! P ≳′ ! P′ force (!-cong′ P≳P′) = !-cong (force P≳P′) -- It is not necessarily the case that, if P expands P′, then P ⊕ Q is -- weakly bisimilar to P′ ⊕ Q (assuming that Name is inhabited). -- -- I based the counterexample on one in "Enhancements of the -- bisimulation proof method" by Pous and Sangiorgi. ¬⊕-congˡ-≳≈ : Name → ¬ (∀ {P P′ Q} → P ≳ P′ → P ⊕ Q ≈ P′ ⊕ Q) ¬⊕-congˡ-≳≈ x = (∀ {P P′ Q} → P ≳ P′ → P ⊕ Q ≈ P′ ⊕ Q) ↝⟨ _$ τa≳a ⟩ τ ∙ (a ∙) ⊕ b ∙ ≈ a ∙ ⊕ b ∙ ↝⟨ τa⊕b≉a⊕b ⟩□ ⊥ □ where a = x , true b = x , false τa≳a : ∀ {a} → τ ∙ (a ∙) ≳ a ∙ τa≳a {a} = ⟨ (λ where action → a ∙ ■ ⟵̂[ τ ] a ∙ ■) , (λ where action → τ ∙ (a ∙) →⟨ ⟶: action ⟩ a ∙ →⟨ ⟶: action ⟩■ ⇒[ name a ] ∅ ■) ⟩ τa⊕b≉a⊕b : ¬ τ ∙ (a ∙) ⊕ b ∙ ≈ a ∙ ⊕ b ∙ τa⊕b≉a⊕b τa⊕b≈a⊕b with W.left-to-right τa⊕b≈a⊕b (sum-left action) ... | _ , non-silent ¬s _ , _ = ⊥-elim (¬s _) ... | _ , silent _ (step () (sum-left action) _) , _ ... | _ , silent _ (step () (sum-right action) _) , _ ... | _ , silent _ done , a≈′a⊕b with W.right-to-left (force a≈′a⊕b) (sum-right action) ... | _ , silent () _ , _ ... | _ , non-silent _ (steps done () _) , _ ... | _ , non-silent _ (steps (step () action _) _ _) , _ -- It is not necessarily the case that, if Q expands Q′, then P ⊕ Q is -- weakly bisimilar to P ⊕ Q′ (assuming that Name is inhabited). ¬⊕-congʳ-≳≈ : Name → ¬ (∀ {P Q Q′} → Q ≳ Q′ → P ⊕ Q ≈ P ⊕ Q′) ¬⊕-congʳ-≳≈ x ⊕-congʳ-≳≈ = ¬⊕-congˡ-≳≈ x ⊕-congˡ-≳≈ where ⊕-congˡ-≳≈ : ∀ {P P′ Q} → P ≳ P′ → P ⊕ Q ≈ P′ ⊕ Q ⊕-congˡ-≳≈ {P} {P′} {Q} P≳P′ = P ⊕ Q ∼⟨ SL.⊕-comm ⟩ Q ⊕ P ∼′⟨ ⊕-congʳ-≳≈ P≳P′ ⟩ S.∼: Q ⊕ P′ ∼⟨ SL.⊕-comm ⟩■ P′ ⊕ Q -- _⊕_ does not, in general, preserve the expansion relation in its -- first argument (assuming that Name is inhabited). ¬⊕-congˡ : Name → ¬ (∀ {P P′ Q} → P ≳ P′ → P ⊕ Q ≳ P′ ⊕ Q) ¬⊕-congˡ x = (∀ {P P′ Q} → P ≳ P′ → P ⊕ Q ≳ P′ ⊕ Q) ↝⟨ W.≳⇒≈ ∘_ ⟩ (∀ {P P′ Q} → P ≳ P′ → P ⊕ Q ≈ P′ ⊕ Q) ↝⟨ ¬⊕-congˡ-≳≈ x ⟩□ ⊥ □ -- _⊕_ does not, in general, preserve the expansion relation in its -- second argument (assuming that Name is inhabited). ¬⊕-congʳ : Name → ¬ (∀ {P Q Q′} → Q ≳ Q′ → P ⊕ Q ≳ P ⊕ Q′) ¬⊕-congʳ x = (∀ {P Q Q′} → Q ≳ Q′ → P ⊕ Q ≳ P ⊕ Q′) ↝⟨ W.≳⇒≈ ∘_ ⟩ (∀ {P Q Q′} → Q ≳ Q′ → P ⊕ Q ≈ P ⊕ Q′) ↝⟨ ¬⊕-congʳ-≳≈ x ⟩□ ⊥ □ -- Some congruence lemmas for combinations of _⊕_ and _·_. ⊕·-cong : ∀ {i P μ Q Q′} → [ i ] force Q ≳′ force Q′ → [ i ] P ⊕ μ · Q ≳ P ⊕ μ · Q′ ⊕·-cong {i} {P} {μ} {Q} {Q′} Q≳Q′ = ⟨ lr , CL.⊕·-cong Q≳Q′ ⟩ where lr : ∀ {R μ′} → P ⊕ μ · Q [ μ′ ]⟶ R → ∃ λ R′ → P ⊕ μ · Q′ [ μ′ ]⟶̂ R′ × [ i ] R ≳′ R′ lr {R} {μ′} = λ where (sum-left P⟶R) → R ■ ⟵̂[ μ′ ] ←⟨ ⟶: sum-left P⟶R ⟩■ P ⊕ μ · Q′ (sum-right action) → force Q ∼⟨ Q≳Q′ ⟩■ force Q′ ⟵̂[ μ ] ←⟨ ⟶: sum-right action ⟩■ P ⊕ μ · Q′ ⊕·-cong′ : ∀ {i P μ Q Q′} → [ i ] force Q ≳′ force Q′ → [ i ] P ⊕ μ · Q ≳′ P ⊕ μ · Q′ force (⊕·-cong′ Q≳Q′) = ⊕·-cong Q≳Q′ ·⊕-cong : ∀ {i P P′ μ Q} → [ i ] force P ≳′ force P′ → [ i ] μ · P ⊕ Q ≳ μ · P′ ⊕ Q ·⊕-cong {P = P} {P′} {μ} {Q} P≳P′ = μ · P ⊕ Q ∼⟨ SL.⊕-comm ⟩ Q ⊕ μ · P ∼′⟨ ⊕·-cong P≳P′ ⟩ S.∼: Q ⊕ μ · P′ ∼⟨ SL.⊕-comm ⟩■ μ · P′ ⊕ Q ·⊕-cong′ : ∀ {i P P′ μ Q} → [ i ] force P ≳′ force P′ → [ i ] μ · P ⊕ Q ≳′ μ · P′ ⊕ Q force (·⊕-cong′ P≳P′) = ·⊕-cong P≳P′ infix 8 _·⊕·-cong_ _·⊕·-cong′_ _·⊕·-cong_ : ∀ {i μ₁ μ₂ P₁ P₁′ P₂ P₂′} → [ i ] force P₁ ≳′ force P₁′ → [ i ] force P₂ ≳′ force P₂′ → [ i ] μ₁ · P₁ ⊕ μ₂ · P₂ ≳ μ₁ · P₁′ ⊕ μ₂ · P₂′ _·⊕·-cong_ {i} {μ₁} {μ₂} {P₁} {P₁′} {P₂} {P₂′} P₁≳P₁′ P₂≳P₂′ = ⟨ lr , CL.·⊕·-cong P₁≳P₁′ P₂≳P₂′ ⟩ where lr : ∀ {R μ} → μ₁ · P₁ ⊕ μ₂ · P₂ [ μ ]⟶ R → ∃ λ R′ → μ₁ · P₁′ ⊕ μ₂ · P₂′ [ μ ]⟶̂ R′ × [ i ] R ≳′ R′ lr = λ where (sum-left action) → force P₁ ∼⟨ P₁≳P₁′ ⟩■ force P₁′ ⟵̂[ μ₁ ] ←⟨ ⟶: sum-left action ⟩■ μ₁ · P₁′ ⊕ μ₂ · P₂′ (sum-right action) → force P₂ ∼⟨ P₂≳P₂′ ⟩■ force P₂′ ⟵̂[ μ₂ ] ←⟨ ⟶: sum-right action ⟩■ μ₁ · P₁′ ⊕ μ₂ · P₂′ _·⊕·-cong′_ : ∀ {i μ₁ μ₂ P₁ P₁′ P₂ P₂′} → [ i ] force P₁ ≳′ force P₁′ → [ i ] force P₂ ≳′ force P₂′ → [ i ] μ₁ · P₁ ⊕ μ₂ · P₂ ≳′ μ₁ · P₁′ ⊕ μ₂ · P₂′ force (P₁≳′P₁′ ·⊕·-cong′ P₂≳′P₂′) = P₁≳′P₁′ ·⊕·-cong P₂≳′P₂′ -- _[_] preserves the expansion relation for non-degenerate contexts. -- (This result is related to Theorem 6.5.25 in "Enhancements of the -- bisimulation proof method" by Pous and Sangiorgi.) infix 5 _[_]-cong _[_]-cong′ _[_]-cong : ∀ {i n Ps Qs} {C : Context ∞ n} → Non-degenerate ∞ C → (∀ x → [ i ] Ps x ≳ Qs x) → [ i ] C [ Ps ] ≳ C [ Qs ] hole [ Ps≳Qs ]-cong = Ps≳Qs _ ∅ [ Ps≳Qs ]-cong = reflexive D₁ ∣ D₂ [ Ps≳Qs ]-cong = (D₁ [ Ps≳Qs ]-cong) ∣-cong (D₂ [ Ps≳Qs ]-cong) action D [ Ps≳Qs ]-cong = refl ·-cong λ { .force → force D [ Ps≳Qs ]-cong } ⟨ν⟩ D [ Ps≳Qs ]-cong = ⟨ν refl ⟩-cong (D [ Ps≳Qs ]-cong) ! D [ Ps≳Qs ]-cong = !-cong (D [ Ps≳Qs ]-cong) D₁ ⊕ D₂ [ Ps≳Qs ]-cong = ⊕-cong Ps≳Qs D₁ D₂ where _[_]-cong′ : ∀ {i n Ps Qs} {C : Context ∞ n} → Non-degenerate′ ∞ C → (∀ x → [ i ] Ps x ≳ Qs x) → [ i ] C [ Ps ] ≳′ C [ Qs ] force (D [ Ps≳Qs ]-cong′) = force D [ Ps≳Qs ]-cong ⊕-cong : ∀ {i n Ps Qs} {C₁ C₂ : Context ∞ n} → (∀ x → [ i ] Ps x ≳ Qs x) → Non-degenerate-summand ∞ C₁ → Non-degenerate-summand ∞ C₂ → [ i ] (C₁ [ Ps ]) ⊕ (C₂ [ Ps ]) ≳ (C₁ [ Qs ]) ⊕ (C₂ [ Qs ]) ⊕-cong {Ps = Ps} {Qs} Ps≳Qs = λ where (process P₁) (process P₂) → (context P₁ [ Ps ]) ⊕ (context P₂ [ Ps ]) ∼⟨ symmetric (SL.≡→∼ (context-[] P₁) SL.⊕-cong SL.≡→∼ (context-[] P₂)) ⟩ P₁ ⊕ P₂ ∼⟨ SL.≡→∼ (context-[] P₁) SL.⊕-cong SL.≡→∼ (context-[] P₂) ⟩■ (context P₁ [ Qs ]) ⊕ (context P₂ [ Qs ]) (process P₁) (action {μ = μ₂} {C = C₂} D₂) → (context P₁ [ Ps ]) ⊕ μ₂ · (C₂ [ Ps ]′) ∼⟨ symmetric (SL.≡→∼ (context-[] P₁)) SL.⊕-cong (_ ■) ⟩ P₁ ⊕ μ₂ · (C₂ [ Ps ]′) ∼′⟨ ⊕·-cong (D₂ [ Ps≳Qs ]-cong′) ⟩ S.∼: P₁ ⊕ μ₂ · (C₂ [ Qs ]′) ∼⟨ SL.≡→∼ (context-[] P₁) SL.⊕-cong (_ ■) ⟩■ (context P₁ [ Qs ]) ⊕ μ₂ · (C₂ [ Qs ]′) (action {μ = μ₁} {C = C₁} D₁) (process P₂) → μ₁ · (C₁ [ Ps ]′) ⊕ (context P₂ [ Ps ]) ∼⟨ (_ ■) SL.⊕-cong symmetric (SL.≡→∼ (context-[] P₂)) ⟩ μ₁ · (C₁ [ Ps ]′) ⊕ P₂ ∼′⟨ ·⊕-cong (D₁ [ Ps≳Qs ]-cong′) ⟩ S.∼: μ₁ · (C₁ [ Qs ]′) ⊕ P₂ ∼⟨ (_ ■) SL.⊕-cong SL.≡→∼ (context-[] P₂) ⟩■ μ₁ · (C₁ [ Qs ]′) ⊕ (context P₂ [ Qs ]) (action {μ = μ₁} {C = C₁} D₁) (action {μ = μ₂} {C = C₂} D₂) → μ₁ · (C₁ [ Ps ]′) ⊕ μ₂ · (C₂ [ Ps ]′) ∼⟨ (D₁ [ Ps≳Qs ]-cong′) ·⊕·-cong (D₂ [ Ps≳Qs ]-cong′) ⟩■ μ₁ · (C₁ [ Qs ]′) ⊕ μ₂ · (C₂ [ Qs ]′) _[_]-cong′ : ∀ {i n Ps Qs} {C : Context ∞ n} → Non-degenerate ∞ C → (∀ x → [ i ] Ps x ≳′ Qs x) → [ i ] C [ Ps ] ≳′ C [ Qs ] force (C [ Ps≳Qs ]-cong′) = C [ (λ x → force (Ps≳Qs x)) ]-cong
programs/oeis/266/A266387.asm
karttu/loda
1
169128
<reponame>karttu/loda ; A266387: Number of orbits of Aut(Z^7) as function of the infinity norm n of the representative lattice point of the orbit, when the cardinality of the orbit is equal to 322560. ; 0,0,0,0,0,7,42,147,392,882,1764,3234,5544,9009,14014,21021,30576,43316,59976,81396,108528,142443,184338,235543,297528,371910,460460,565110,687960,831285,997542,1189377,1409632,1661352,1947792,2272424,2638944,3051279,3513594,4030299,4606056,5245786,5954676,6738186,7602056,8552313,9595278,10737573,11986128,13348188,14831320,16443420,18192720,20087795,22137570,24351327,26738712,29309742,32074812,35044702,38230584,41644029,45297014,49201929,53371584,57819216,62558496,67603536,72968896,78669591,84721098,91139363,97940808,105142338,112761348,120815730,129323880,138304705,147777630,157762605,168280112,179351172,190997352,203240772,216104112,229610619,243784114,258648999,274230264,290553494,307644876,325531206,344239896,363798981,384237126,405583633,427868448,451122168,475376048,500662008,527012640,554461215,583041690,612788715,643737640,675924522,709386132,744159962,780284232,817797897,856740654,897152949,939075984,982551724,1027622904,1074333036,1122726416,1172848131,1224744066,1278460911,1334046168,1391548158,1451016028,1512499758,1576050168,1641718925,1709558550,1779622425,1851964800,1926640800,2003706432,2083218592,2165235072,2249814567,2337016682,2426901939,2519531784,2614968594,2713275684,2814517314,2918758696,3026066001,3136506366,3250147901,3367059696,3487311828,3610975368,3738122388,3868825968,4003160203,4141200210,4283022135,4428703160,4578321510,4731956460,4889688342,5051598552,5217769557,5388284902,5563229217,5742688224,5926748744,6115498704,6309027144,6507424224,6710781231,6919190586,7132745851,7351541736,7575674106,7805239988,8040337578,8281066248,8527526553,8779820238,9038050245,9302320720,9572737020,9849405720,10132434620,10421932752,10718010387,11020779042,11330351487,11646841752,11970365134,12301038204,12638978814,12984306104,13337140509,13697603766,14065818921,14441910336,14826003696,15218226016,15618705648,16027572288,16444956983,16870992138,17305811523,17749550280,18202344930,18664333380,19135654930,19616450280,20106861537,20607032222,21117107277,21637233072,22167557412,22708229544,23259400164,23821221424,24393846939,24977431794,25572132551,26178107256,26795515446,27424518156,28065277926,28717958808,29382726373,30059747718,30749191473,31451227808,32166028440,32893766640,33634617240,34388756640,35156362815,35937615322,36732695307,37541785512,38365070282,39202735572,40054968954,40921959624,41803898409,42700977774,43613391829,44541336336,45485008716,46444608056,47420335116,48412392336,49420983843,50446315458,51488594703,52548030808,53624834718 mov $1,$0 bin $1,5 mul $1,7
ada-containers-indefinite_holders.ads
mgrojo/adalib
15
19712
<filename>ada-containers-indefinite_holders.ads -- Standard Ada library specification -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- generic type Element_Type (<>) is private; with function "=" (Left, Right : Element_Type) return Boolean is <>; package Ada.Containers.Indefinite_Holders is pragma Preelaborate(Indefinite_Holders); pragma Remote_Types(Indefinite_Holders); type Holder is tagged private; pragma Preelaborable_Initialization (Holder); Empty_Holder : constant Holder; function "=" (Left, Right : Holder) return Boolean; function To_Holder (New_Item : Element_Type) return Holder; function Is_Empty (Container : Holder) return Boolean; procedure Clear (Container : in out Holder); function Element (Container : Holder) return Element_Type; procedure Replace_Element (Container : in out Holder; New_Item : in Element_Type); procedure Query_Element (Container : in Holder; Process : not null access procedure (Element : in Element_Type)); procedure Update_Element (Container : in out Holder; Process : not null access procedure (Element : in out Element_Type)); type Constant_Reference_Type (Element : not null access constant Element_Type) is private with Implicit_Dereference => Element; type Reference_Type (Element : not null access Element_Type) is private with Implicit_Dereference => Element; function Constant_Reference (Container : aliased in Holder) return Constant_Reference_Type; function Reference (Container : aliased in out Holder) return Reference_Type; procedure Assign (Target : in out Holder; Source : in Holder); function Copy (Source : Holder) return Holder; procedure Move (Target : in out Holder; Source : in out Holder); private -- not specified by the language end Ada.Containers.Indefinite_Holders;
Cubical/Reflection/RecordEquiv.agda
dan-iel-lee/cubical
0
2127
{- Reflection-based tools for converting between iterated record types, particularly between record types and iterated Σ-types. Currently requires eta equality. See end of file for examples. -} {-# OPTIONS --cubical --no-import-sorts --no-exact-split --safe #-} module Cubical.Reflection.RecordEquiv where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Equiv open import Cubical.Data.List as List open import Cubical.Data.Nat open import Cubical.Data.Maybe open import Cubical.Data.Sigma import Agda.Builtin.Reflection as R open import Cubical.Reflection.Base Projections = List R.Name -- Describes a correspondence between two iterated record types Assoc = List (Projections × Projections) -- Describes a correspondence between a record type and an iterated Σ-types; -- more convenient than Assoc for this special case data ΣFormat : Type where leaf : R.Name → ΣFormat _,_ : ΣFormat → ΣFormat → ΣFormat infixr 4 _,_ module Internal where flipAssoc : Assoc → Assoc flipAssoc = List.map λ {p .fst → p .snd; p .snd → p .fst} list→ΣFormat : List R.Name → Maybe ΣFormat list→ΣFormat [] = nothing list→ΣFormat (x ∷ []) = just (leaf x) list→ΣFormat (x ∷ y ∷ xs) = map-Maybe (leaf x ,_) (list→ΣFormat (y ∷ xs)) recordName→ΣFormat : R.Name → R.TC (Maybe ΣFormat) recordName→ΣFormat name = R.getDefinition name >>= go where go : R.Definition → R.TC (Maybe ΣFormat) go (R.record-type c fs) = R.returnTC (list→ΣFormat (List.map (λ {(R.arg _ n) → n}) fs)) go _ = R.typeError (R.strErr "Not a record type name:" ∷ R.nameErr name ∷ []) ΣFormat→Assoc : ΣFormat → Assoc ΣFormat→Assoc = go [] where go : List R.Name → ΣFormat → Assoc go prefix (leaf fieldName) = [ prefix , [ fieldName ] ] go prefix (sig₁ , sig₂) = go (quote fst ∷ prefix) sig₁ ++ go (quote snd ∷ prefix) sig₂ MaybeΣFormat→Assoc : Maybe ΣFormat → Assoc MaybeΣFormat→Assoc nothing = [ [] , [] ] MaybeΣFormat→Assoc (just sig) = ΣFormat→Assoc sig convertTerm : Assoc → R.Term → R.Term convertTerm al term = R.pat-lam (List.map makeClause al) [] where makeClause : Projections × Projections → R.Clause makeClause (projl , projr) = R.clause [] (goPat [] projr) (goTm projl) where goPat : List (R.Arg R.Pattern) → List R.Name → List (R.Arg R.Pattern) goPat acc [] = acc goPat acc (π ∷ projs) = goPat (varg (R.proj π) ∷ acc) projs goTm : List R.Name → R.Term goTm [] = term goTm (π ∷ projs) = R.def π [ varg (goTm projs) ] convertFun : Assoc → R.Term convertFun al = vlam "ρ" (convertTerm al (v 0)) convertMacro : Assoc → R.Term → R.TC Unit convertMacro al hole = R.unify hole (convertFun al) equivMacro : Assoc → R.Term → R.TC Unit equivMacro al hole = newMeta R.unknown >>= λ hole₁ → newMeta R.unknown >>= λ hole₂ → let iso : R.Term iso = R.pat-lam ( R.clause [] [ varg (R.proj (quote Iso.fun)) ] hole₁ ∷ R.clause [] [ varg (R.proj (quote Iso.inv)) ] hole₂ ∷ R.clause [] [ varg (R.proj (quote Iso.rightInv)) ] (vlam "_" (R.def (quote refl) [])) ∷ R.clause [] [ varg (R.proj (quote Iso.leftInv)) ] (vlam "_" (R.def (quote refl) [])) ∷ [] ) [] in R.unify hole (R.def (quote isoToEquiv) [ varg iso ]) >> convertMacro al hole₁ >> convertMacro (flipAssoc al) hole₂ open Internal macro -- ΣFormat → <Σ-Type> ≃ <RecordType> Σ≃Record : ΣFormat → R.Term → R.TC Unit Σ≃Record sig = equivMacro (ΣFormat→Assoc sig) -- ΣFormat → <RecordType> ≃ <Σ-Type> Record≃Σ : ΣFormat → R.Term → R.TC Unit Record≃Σ sig = equivMacro (flipAssoc (ΣFormat→Assoc sig)) -- <RecordTypeName> → <Σ-Type> ≃ <RecordType> FlatΣ≃Record : R.Name → R.Term → R.TC Unit FlatΣ≃Record name hole = recordName→ΣFormat name >>= λ sig → equivMacro (MaybeΣFormat→Assoc sig) hole -- <RecordTypeName> → <RecordType> ≃ <Σ-Type> Record≃FlatΣ : R.Name → R.Term → R.TC Unit Record≃FlatΣ name hole = recordName→ΣFormat name >>= λ sig → equivMacro (flipAssoc (MaybeΣFormat→Assoc sig)) hole -- ΣFormat → <RecordType₁> ≃ <RecordType₂> Record≃Record : Assoc → R.Term → R.TC Unit Record≃Record = equivMacro module Example where private variable ℓ ℓ' : Level A : Type ℓ B : A → Type ℓ' record Example {A : Type ℓ} (B : A → Type ℓ') : Type (ℓ-max ℓ ℓ') where field cool : A fun : A wow : B cool open Example {- Example: Equivalence between a Σ-type and record type using FlatΣ≃Record -} Example0 : (Σ[ a ∈ A ] Σ[ a' ∈ A ] B a) ≃ Example B Example0 = FlatΣ≃Record Example Example0' : Example B ≃ (Σ[ a ∈ A ] Σ[ a' ∈ A ] B a) Example0' = Record≃FlatΣ Example Example0'' : Unit ≃ Unit -- any record with no fields is equivalent to unit Example0'' = FlatΣ≃Record Unit {- Example: Equivalence between an arbitrarily arrange Σ-type and record type using Σ≃Record -} Example1 : (Σ[ p ∈ A × A ] B (p .snd)) ≃ Example B Example1 = Σ≃Record ((leaf (quote fun) , leaf (quote cool)) , leaf (quote wow)) {- Example: Equivalence between arbitrary iterated record types (less convenient) using Record≃Record -} record Inner {A : Type ℓ} (B : A → Type ℓ') (a : A) : Type (ℓ-max ℓ ℓ') where field fun' : A wow' : B a record Outer {A : Type ℓ} (B : A → Type ℓ') : Type (ℓ-max ℓ ℓ') where field cool' : A inner : B cool' open Inner open Outer Example2 : Example B ≃ Outer (Inner B) Example2 = Record≃Record ( ([ quote cool ] , [ quote cool' ]) ∷ ([ quote fun ] , (quote fun' ∷ quote inner ∷ [])) ∷ ([ quote wow ] , (quote wow' ∷ quote inner ∷ [])) ∷ [] )
eliteNext.asm
ped7g/EliteNext
0
17312
DEVICE ZXSPECTRUMNEXT DEFINE DOUBLEBUFFER 1 CSPECTMAP eliteN.map OPT --zxnext=cspect --syntax=a --reversepop DEBUGSEGSIZE equ 1 DEBUGLOGSUMMARY equ 1 ;DEBUGLOGDETAIL equ 1 ;---------------------------------------------------------------------------------------------------------------------------------- ; Game Defines ScreenLocal EQU 0 ScreenGalactic EQU ScreenLocal + 1 ScreenMarket EQU ScreenGalactic + 1 ScreenMarketDsp EQU ScreenMarket + 1 ScreenStatus EQU ScreenMarketDsp + 1 ScreenInvent EQU ScreenStatus + 1 ScreenPlanet EQU ScreenInvent + 1 ScreenEquip EQU ScreenPlanet + 1 ScreenLaunch EQU ScreenEquip + 1 ScreenFront EQU ScreenLaunch + 1 ScreenAft EQU ScreenFront+1 ScreenLeft EQU ScreenAft+1 ScreenRight EQU ScreenLeft+1 ScreenDocking EQU ScreenRight+1 ScreenHyperspace EQU ScreenDocking+1 ;---------------------------------------------------------------------------------------------------------------------------------- ; Colour Defines INCLUDE "./Hardware/L2ColourDefines.asm" INCLUDE "./Hardware/L1ColourDefines.asm" ;---------------------------------------------------------------------------------------------------------------------------------- ; Total screen list ; Local Chart ; Galactic Chart ; Market Prices ; Inventory ; Comander status ; System Data ; Mission Briefing ; missio completion ; Docked Menu (only place otehr than pause you can load and save) ; Pause Menu (only place you can load from ) ; byint and selling equipment ; bying and selling stock INCLUDE "./Hardware/register_defines.asm" INCLUDE "./Layer2Graphics/layer2_defines.asm" INCLUDE "./Hardware/memory_bank_defines.asm" INCLUDE "./Hardware/screen_equates.asm" INCLUDE "./Data/ShipModelEquates.asm" INCLUDE "./Macros/MMUMacros.asm" INCLUDE "./Macros/ShiftMacros.asm" INCLUDE "./Macros/MathsMacros.asm" INCLUDE "./Macros/CopyByteMacros.asm" INCLUDE "./Macros/generalMacros.asm" INCLUDE "./Macros/ldCopyMacros.asm" INCLUDE "./Macros/ldIndexedMacros.asm" INCLUDE "./Variables/general_variables_macros.asm" charactersetaddr equ 15360 STEPDEBUG equ 1 ORG $8000 di ; "STARTUP" MMUSelectLayer1 call l1_cls ld a,7 call l1_attr_cls_to_a ld a,$FF call l1_set_border MMUSelectSpriteBank call sprite_load_sprite_data Initialise: MMUSelectLayer2 call l2_initialise ClearForceTransition TidyDEBUG: ld a,16 ld (TidyCounter),a TestText: xor a ld (JSTX),a MMUSelectCmdrData call defaultCommander DEBUGCODE: ClearSafeZone ; just set in open space so compas treacks su n MMUSelectSpriteBank call init_sprites IFDEF DOUBLEBUFFER MMUSelectLayer2 call l2_cls call l2_flip_buffers ENDIF ; Set up all 8 galaxies, 7later this will be pre built and loaded into memory from files InitialiseGalaxies: call ResetUniv ; Reset ship data call ResetGalaxy ; Reset each galaxy copying in code call SeedAllGalaxies .ClearLayer2Buffers: MMUSelectLayer2 call l2_cls IFDEF DOUBLEBUFFER MMUSelectLayer2 call l2_flip_buffers ENDIF ;.Sa MMUSelectUniverseN 0 ;InitialiseDemoShip: call ClearFreeSlotList ; call FindNextFreeSlotInA ; ld b,a ; ld a,13 ;Coriolis station ; call InitialiseShipAUnivB ; xor a InitialiseMainLoop: xor a ld (CurrentUniverseAI),a ld a,3 ld (MenuIdMax),a ld a,$FF ; Starts Docked ld (DockedFlag),a ; call InitialiseFrontView call InitialiseCommander MMUSelectUniverseN 2 call SetInitialShipPosition MMUSelectStockTable call generate_stock_market ;..MAIN GAME LOOP.................................................................................................................. ;.................................................................................................................................. MainLoop: call doRandom ; redo the seeds every frame call scan_keyboard ;.. This bit allows cycling of ships on universe 0 in demo......................................................................... DemoOfShipsDEBUG: call TestForNextShip ;.. Check if keyboard scanning is allowed by screen. If this is set then skip all keyboard and AI.................................. InputBlockerCheck: ld a,$0 JumpIfAEqNusng $01, SkipInputHandlers ; as we are in a transition the whole update AI is skipped call ViewKeyTest call TestPauseMode ld a,(GamePaused) cp 0 jr nz,MainLoop call MovementKeyTest ;.. Process cursor keys for respective screen if the address is 0 then we skill just skip movement................................. HandleMovement: ld a,(CallCursorRoutine+2) IfAIsZeroGoto TestAreWeDocked ;.. Handle displaying correct screen .............................................................................................. HandleBankSelect: ld a,$00 MMUSelectScreenA CallCursorRoutine: call $0000 ;.. Check to see if we are docked as if we are (or are docking.launching then no AI/Ship updates occur............................. ;.. Also end up here if we have the screen input blocker set SkipInputHandlers: ;.. For Docked flag its - 0 = in free space, FF = Docked, FE transition, FD = Setup open space and transition to not docked TestAreWeDocked: ld a,(DockedFlag) ; if if we are in free space do universe update JumpIfANENusng 0, SkipUniveseUpdate ; else we skip it. As we are also in dock/transition then no models should be updated so we dont; need to draw ;.. If we get here then we are in game running mode regardless of which screen we are on, so update AI............................. ;.. we do one universe slot each loop update ...................................................................................... ;.. First update Sun............................................................................................................... .UpdateShips: call UpdateUniverseObjects JumpIfMemNeNusng ScreenTransitionForced, $FF, BruteForceChange ; if we docked then a transition would have been forced CheckIfViewUpdate: ld a,$00 ; if this is set to a view number then we process a view cp 0 ; . jr z, MenusLoop ; This will change as more screens are added TODO ;..Processing a view............................................................................................................... ;..Display any message ............................................................................................................ ld a,(MessageCount) jr z,.NoMessages ; note message end will tidy up display .NoMessages: ld hl,(InnerHyperCount) ld a,h or l jr z,.NoHyperspace ; note message end will tidy up display call HyperSpaceMessage .NoHyperspace: MMUSelectLayer2 call l2_cls MMUSelectLayer1 .UpdateSun: MMUSelectSun .DEBUGFORCE: ;ld hl,$0000 ;ld (SBnKxlo),hl ;ld (SBnKylo),hl ;xor a ;ld (SBnKxsgn),a ;ld (SBnKysgn),a ;ld hl,$0200 ;ld (SBnKzlo),hl ;ld a,$00 ;ld (SBnKzsgn),a call SunUpdateAndRender ;..Later this will be done via self modifying code to load correct stars routine for view.......................................... DrawDustForwards: ld a,$DF ld (line_gfx_colour),a DustUpdateBank: MMUSelectViewFront ; This needs to be self modifying DustUpdateRoutine: call DustForward ; This needs to be self modifying PrepLayer2: MMUSelectLayer2 ; Clear layer 2 for graphics ; call l2_cls ;ProcessSun: call DrawForwardSun ProcessPlanet: ProcessShipModels: call DrawForwardShips ; Draw all ships (this may need to be self modifying) call UpdateConsole ; Update display console on layer 1 jp LoopRepeatPoint ; And we are done with views, so check if there was a special command to do ;..If we were not in views then we were in display screens/menus................................................................... MenusLoop: ld hl,(ScreenLoopJP+1) ld a,h or l jp z,LoopRepeatPoint ;..This is the screen update routine for menus..................................................................................... ;.. Also used by transition routines SkipUniveseUpdate: JumpIfMemZero ScreenLoopJP+1,LoopRepeatPoint ScreenLoopBank: ld a,$0 MMUSelectScreenA ScreenLoopJP: call $0000 LoopRepeatPoint: ld a,(DockedFlag) HandleLaunched: JumpIfAEqNusng $FD, WeHaveCompletedLaunch JumpIfAEqNusng $FE, WeAreInTransition JumpIfAEqNusng $FC, WeAreHJumping JumpIfAEqNusng $FB, WeAreHEntering JumpIfAEqNusng $FA, WeHaveCompletedHJump jp DoubleBufferCheck WeHaveCompletedLaunch: call LaunchedFromStation jp DoubleBufferCheck WeAreHJumping: call hyperspace_Lightning jp c,DoubleBufferCheck ld a,$FB ld (DockedFlag),a jp DoubleBufferCheck WeAreHEntering: ld a,$FA ld (DockedFlag),a jp DoubleBufferCheck WeHaveCompletedHJump: ld a,(Galaxy) ; DEBUG as galaxy n is not working MMUSelectGalaxyA ld hl,(TargetPlanetX) ld (PresentSystemX),hl ld b,h ld c,l CorrectPostJumpFuel ForceTransition ScreenFront ; This will also trigger stars ld a,$00 ld (DockedFlag),a call GalaxyGenerateDesc ; bc holds new system to generate system call copy_working_to_system ; and propogate copies of seeds call copy_working_to_galaxy ; . call get_planet_data_working_seed ; sort out system data ;call GetDigramGalaxySeed ; . MMUSelectStockTable ; . call generate_stock_market ; generate new prices call ClearUnivSlotList ; clear out any ships call ResetPlayerShip HalveFugitiveStatus ; halves status and brings bit into carry MMUSelectSun call CreateSun ; create the local sun and set position based on seed ;TODO call generateSunAndPlanetPos ; uses current carry state too ;TODO.CreateSun: call SetSunSlot ; PROBABLY NOT NEEDED NOW MMUSelectShipBank1 ; PROBABLY NOT NEEDED NOW call GetShipBankId ;;SELECT CORRECT BANK MMUSelectUniverseN 0 ;;TODO call CopyBodyToUniverse ;;TODO call CreateSun ;;TODOCreatePlanet: call SetPlanetSlot ;;TODO MMUSelectShipBank1 ;;TODO call GetShipBankId ;;TODO MMUSelectUniverseBankN 1 ;;TODO call CopyBodyToUniverse ; reset main loop counters ; from BBC TT18 jump code ; need to set system corrodinates, flush out univere ships etc ; set up new star system and landing location in system ; reset ship speed etc (RES2) ; update legal status, missle indicatrions, planet data block, sun data block (SOLAR) ; put planet into data blokc 1 of FRIN ; put sun inot data block (NWWSHIP) ; need to look at in system warp code (WARP) - note we need to -reorg all to code for teh station as that will never be in slot 0 WeAreInTransition: DoubleBufferCheck: ld a,00 IFDEF DOUBLEBUFFER cp 0 jp z,TestTransition MMUSelectLayer2 ld a,(varL2_BUFFER_MODE) cp 0 call nz,l2_flip_buffers ENDIF TestTransition: ld a,(ScreenTransitionForced) ; was there a bruite force screen change in any update loop cp $FF jp z,MainLoop BruteForceChange: ld d,a ld e,ScreenMapRow mul ld ix,ScreenKeyMap add ix,de ; Force screen transition call SetScreenAIX jp MainLoop ;..Hyperspace counter............................................................................................................ HyperSpaceMessage: MMUSelectLayer1 call DisplayHyperCountDown .UpdateHyperCountdown: ld hl,(InnerHyperCount) dec l jr nz,.decHyperInnerOnly dec h ret m .resetHyperInner: ld l,$0B push hl ld d,12 ld a,L1ColourPaperBlack | L1ColourInkYellow call l1_attr_cls_2DlinesA ld d,12 * 8 call l1_cls_2_lines_d ld de,$6000 ld hl,Hyp_centeredTarget call l1_print_at ld de,$6800 ld hl,Hyp_centeredCharging call l1_print_at pop hl .decHyperInnerOnly: ld (InnerHyperCount),hl ret .HyperCountDone: ld hl,0 ld (InnerHyperCount),hl ld d,12 ld a,L1ColourPaperBlack | L1ColourInkBlack call l1_attr_cls_2DlinesA ld d,12 * 8 call l1_cls_2_lines_d ForceTransition ScreenHyperspace ; transition to hyperspace ret ;.................................................................................................................................. ;..Update Universe Objects......................................................................................................... UpdateUniverseObjects: xor a ld (SelectedUniverseSlot),a .UpdateUniverseLoop: ld d,a ; d is unaffected by GetTypeInSlotA ;.. If the slot is empty (FF) then skip this slot.................................................................................. call GetTypeAtSlotA cp $FF jr z,.ProcessedUniverseSlot .UniverseObjectFound: ld a,d ; Get back Universe slot as we want it MMUSelectUniverseA ; and we apply roll and pitch call ApplyMyRollAndPitch call ApplyShipRollAndPitch ;.. If its a space station then see if we are ready to dock........................................................................ .CheckIfDockable: ld a,(ShipTypeAddr) ; Now we have the correct bank JumpIfANENusng ShipTypeStation, .NotDockingCheck ; if its not a station so we don't test docking .IsDockableAngryCheck: JumpOnMemBitSet ShipNewBitsAddr, 4, .NotDockingCheck ; if it is angry then we dont test docking call DockingCheck ; So it is a candiate to test docking. Now we do the position and angle checks ReturnIfMemEquN ScreenTransitionForced, $FF ; if we docked then a transition would have been forced .NotDockingCheck: CallIfMemEqMemusng SelectedUniverseSlot, CurrentUniverseAI, UpdateShip .ProcessedUniverseSlot: ld a,(SelectedUniverseSlot) ; Move to next ship cycling if need be to 0 inc a ; . JumpIfAGTENusng UniverseListSize, .UpdateAICounter ; . ld (SelectedUniverseSlot),a jp .UpdateUniverseLoop .UpdateAICounter: ld a,(CurrentUniverseAI) inc a cp 12 jr c,.IterateAI xor a .IterateAI: ld (CurrentUniverseAI),a ret ;.................................................................................................................................. ;.. Quickly eliminate space stations too far away.................................................................................. DockingCheck: ld bc,(UBnKxlo) ld hl,(UBnKylo) ld de,(UBnKzlo) ld a,b or h or d ret nz .CheckIfInRangeLo: ld a,c or l or e and %11000000 ; Note we should make this 1 test for scoop or collision too ret nz ;.. Now check to see if we are comming in at a viable angle........................................................................ .CheckDockingAngle: ld a,(UBnkrotmatNosevZ+1) ; get get high byte of rotmat ReturnIfALTNusng 214 ; this is the magic angle to be within 26 degrees +/- call GetStationVectorToWork ; Normalise position into XX15 as in effect its a vector from out ship to it given we are always 0,0,0, returns with A holding vector z bit 7,a ; if its negative ret nz ; we are flying away from it ReturnIfALTNusng 89 ; if the axis <89 the we are not in the 22 degree angle ld a,(UBnkrotmatRoofvX+1) ; get roof vector high and SignMask8Bit ReturnIfALTNusng 80 ; note 80 decimal for 36.6 degrees ;.. Its passed all validation and we are docking................................................................................... .AreDocking: MMUSelectLayer1 ld a,$6 call l1_set_border .EnterDockingBay: ForceTransition ScreenDocking ret ;.................................................................................................................................. ;; TODODrawForwardSun: MMUSelectSun ;; TODO ld a,(SunKShipType) ;; TODO.ProcessBody: cp 129 ;; TODO jr nz,.ProcessPlanet ;; TODO.ProcessSun: call ProcessSun ;; TODO ;; TODOProcessSun: call CheckSunDistance ;; TODO ;; TODO ret ;; TODO.ProcessPlanet: call ProcessPlanet ;; TODO ret ;.................................................................................................................................. DrawForwardShips: xor a DrawShipLoop: ld (CurrentShipUniv),a call GetTypeAtSlotA cp $FF jr z,ProcessedDrawShip ; Add in a fast check for ship behind to process nodes and if behind jump to processed Draw ship SelectShipToDraw: ld a,(CurrentShipUniv) MMUSelectUniverseA ; Need check for exploding here .ProcessUnivShip: call ProcessShip ;; call ProcessUnivShip UpdateRadar: ;;;Does nothing ld a,BankFrontView ;;;Does nothing MMUSelectScreenA ;;;Does nothing ld a,(CurrentShipUniv) ;;;Does nothing MMUSelectUniverseA call UpdateScannerShip ProcessedDrawShip: ld a,(CurrentShipUniv) inc a JumpIfALTNusng UniverseListSize, DrawShipLoop DrawSunCompass: MMUSelectSun ; For now for the sun we will take high bytes so it scales down call UpdateScannerSun ret ;.................................................................................................................................. CurrentShipUniv: DB 0 ;;;ProcessUnivShip: call CheckDistance ; Will check for negative Z and skip (how do we deal with read and side views? perhaps minsky transformation handles that?) ;;; ret c ;;; ld a,(UbnkDrawAsDot) ;;; and a ;;; jr z,.CarryOnWithDraw ;;;.itsJustADot: ld bc,(UBnkNodeArray) ; if its at dot range ;;; ld a,$FF ; just draw a pixel ;;; MMUSelectLayer2 ; then go to update radar ;;; call l2_plot_pixel ; ;;; ClearCarryFlag ;;; ret ;;;.ProcessShipNodes: call ProcessShip ;;; ;;;call ProcessNodes ; it hink here we need the star and planet special cases ;;;.DrawShip: call CullV2 ; culling but over aggressive backface assumes all 0 up front TOFIX ;;; call PrepLines ; LL72, process lines and clip, ciorrectly processing face visibility now ;;; ld a,(CurrentShipUniv) ;;; MMUSelectUniverseA ;;; call DrawLines ;;; ClearCarryFlag ;;; ret TestForNextShip: ld a,c_Pressed_Quit call is_key_pressed ret nz ld a,(currentDemoShip) inc a cp 44 jr nz,.TestOK xor a .TestOK: ld (currentDemoShip),a call ClearUnivSlotList ld a,(currentDemoShip) ld b,a xor a call SetSlotAToTypeB MMUSelectUniverseN 2 call ResetUBnkData ; call the routine in the paged in bank, each universe bank will hold a code copy local to it ld a,(currentDemoShip) MMUSelectShipBank1 call GetShipBankId MMUSelectShipBankA ld a,b call CopyShipToUniverse call SetInitialShipPosition call DEBUGSETNODES ret ;---------------------------------------------------------------------------------------------------------------------------------- NeedAMessageQueue: UpdateCountdownNumber: ld a,(OuterHyperCount) ld de,Hyp_counter ld c, -100 call .Num1 ld c,-10 call .Num1 ld c,-1 .Num1: ld b,'0'-1 .Num2: inc b add a,c jr c,.Num2 sub c push bc push af ld a,c cp -1 ld a,b ld (de),a inc de pop af pop bc ret ;---------------------------------------------------------------------------------------------------------------------------------- Hyp_message DB "To:" Hyp_to DS 32 Hyp_space1 DB " " Hyp_dist_amount DB "0.0" Hyp_decimal DB "." Hyp_fraction DB "0" Hyp_dis_ly DB " LY",0 Hyp_charging DB "Charging:" Hyp_counter DB "000",0 Hyp_centeredTarget DS 32 Hyp_centeredEol DB 0 Hyp_bufferpadding DS 32 ; just in case we get a buffer ovverun. shoudl never get beyond 32 chars Hyp_centeredCharging DS 32 Hyp_centeredEol2 DB 0 Hyp_bufferpadding2 DS 32 ; just in case we get a buffer ovverun. shoudl never get beyond 32 chars MainCopyLoop: ld a,(hl) cp 0 ret z ld (de),a inc hl inc de jr MainCopyLoop CountLengthHL: ld b,0 .CountLenLoop: ld a,(hl) cp 0 jr z,.DoneCount inc b inc hl jr .CountLenLoop .DoneCount: ld a,32 sub b sra a ret MainClearTextLoop: ld b,a ld a,32 .ClearLoop: ld (hl),a inc hl djnz .ClearLoop ret DisplayHyperCountDown: ld de,Hyp_to ld hl,name_expanded call MainCopyLoop .DoneName: xor a ld (de),a ld (Hyp_message+31),a ; max out at 32 characters .CentreJustify: ld hl,Hyp_message call CountLengthHL ld hl,Hyp_centeredTarget call MainClearTextLoop ex de,hl ld hl,Hyp_message call MainCopyLoop xor a ld (Hyp_centeredEol),a ld hl,Hyp_counter ; clear counter digits ld a,32 ; clear counter digits ld (hl),a ; clear counter digits inc hl ; clear counter digits ld (hl),a ; clear counter digits inc hl ; clear counter digits ld (hl),a ; clear counter digits call UpdateCountdownNumber ld hl,Hyp_charging call CountLengthHL ld hl,Hyp_centeredCharging call MainClearTextLoop ex de,hl ld hl,Hyp_charging call MainCopyLoop xor a ld (Hyp_centeredEol2),a ret ;DisplayTargetAndRange ;DisplayCountDownNumber ;---------------------------------------------------------------------------------------------------------------------------------- TestPauseMode: ld a,(GamePaused) cp 0 jr nz,.TestForResume .CheckViewMode: ld a,(ScreenIndex) ; we can only pause if not on screen view ReturnIfAGTENusng ScreenFront .CheckPauseKey: ld a,c_Pressed_Freeze call is_key_pressed ret nz .PausePressed: ld a,$FF ; doesn't really matter if we were in pause already as resume is a different key ld (GamePaused),a ret .TestForResume: ld a,c_Pressed_Resume ; In pause loop so we can check for resume key call is_key_pressed ret nz .ResumePressed: xor a ld (GamePaused),a ; Resume pressed to reset pause state ret TestQuit: ld a,c_Pressed_Quit call is_key_pressed ret currentDemoShip: DB 13;$12 ; 13 - corirollis ;---------------------------------------------------------------------------------------------------------------------------------- UpdateShip: ; call DEBUGSETNODES ; call DEBUGSETPOS ld hl,TidyCounter dec (hl) ret nz ld a,16 ld (TidyCounter),a ; call TIDY TIDY IS BROKEN ; add AI in here too ret InitialiseShipAUnivB: push af ld a,b MMUSelectUniverseA ; load up register into universe bank call ResetUBnkData ; call the routine in the paged in bank, each universe bank will hold a code copy local to it MMUSelectShipBank1 pop af call CopyShipToUniverse ret GetStationVectorToWork: ld hl,UBnKxlo ld de,varVector9ByteWork ldi ldi ldi ldi ldi ldi ldi ldi ldi .CalcNormalToXX15: ld hl, (varVector9ByteWork) ; X ld de, (varVector9ByteWork+3); Y ld bc, (varVector9ByteWork+6); Z ld a,l or e or c or 1 ld ixl,a ; or all bytes and with 1 so we have at least a 1 ld a,h or d or b ; or all high bytes but don't worry about 1 as its sorted on low bytes .MulBy2Loop: push bc ld b,ixl sla b ; Shift ixl left ld ixl,b pop bc rl a ; roll into a jr c,.TA2 ; if bit rolled out of rl a then we can't shift any more to the left ShiftHLLeft1 ; Shift Left X ShiftDELeft1 ; Shift Left Y ShiftBCLeft1 ; Shift Left Z jr .MulBy2Loop ; no need to do jr nc as the first check looks for high bits across all X Y and Z .TA2: ld a,(varVector9ByteWork+2); x sign srl h or h ld (XX15VecX),a ; note this is now a signed highbyte ld a,(varVector9ByteWork+5); y sign srl d or d ld (XX15VecY),a ; note this is now a signed highbyte ld a,(varVector9ByteWork+8); y sign srl b or b ld (XX15VecZ),a ; note this is now a signed highbyte call normaliseXX1596fast ret ; will return with a holding Vector Z TidyCounter DB 0 INCLUDE "./debugMatrices.asm" ;TODO Optimisation ; Need this table to handle differnet events ; 1-main loop update - just general updates specfic to that screen that are not galaxy or stars, e.g. update heat, console ; cursor key, joystick press ; cursor key, joystick press ; non cursor keys presses ; ; First byte is now docked flag ; ; Padded to 8 bytes to allow a * 8 for addressing ; Byte 0 - Docked flag : 0 = not applicable (always read), 1 = only whilst docked, 2 = only when not docked, 3 = No keypress allowed ; Byte 1 - Screen Id ; Byte 2,3 - address of keypress table ; Byte 4 - Bank with Display code ; Byte 5,6 - Function for display ; Byte 7,8 - Main loop update routine ; Byte 9 - Draw stars Y/N ; byte 10 - Input Blocker (set to 1 will not allow keyboard screen change until flagged, used by transition screens and pause menus) ; byte 11 - Double Buffering 0 = no, 1 = yes ; byte 12,13 - cursor key input routine ; byte 14 - HyperspaceBlock - can not select this screen if in hyperpace - 00 can , 01 can not ; byte 15 padding at the momnent (should add in an "AI enabled flag" for optimistation, hold previous value and on change create ships ; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ScreenKeyMap: DB 0, ScreenLocal , low addr_Pressed_LocalChart, high addr_Pressed_LocalChart, BankMenuShrCht, low draw_local_chart_menu, high draw_local_chart_menu, $00, $00, $00,$00,$00,low local_chart_cursors, high local_chart_cursors, $01,$00;low loop_local_chart_menu, high loop_local_chart_menu ScreenKeyGalactic: DB 0, ScreenGalactic , low addr_Pressed_GalacticChrt, high addr_Pressed_GalacticChrt, BankMenuGalCht, low draw_galactic_chart_menu,high draw_galactic_chart_menu, low loop_gc_menu, high loop_gc_menu, $00,$00,$00,low galctic_chart_cursors, high galctic_chart_cursors, $01,$00 DB 1, ScreenMarket , low addr_Pressed_MarketPrices, high addr_Pressed_MarketPrices, BankMenuMarket, low draw_market_prices_menu, high draw_market_prices_menu, low loop_market_menu, high loop_market_menu, $00,$00,$00,$00, $00, $01,$00 DB 2, ScreenMarketDsp , low addr_Pressed_MarketPrices, high addr_Pressed_MarketPrices, BankMenuMarket, low draw_market_prices_menu, high draw_market_prices_menu, $00, $00, $00,$00,$00,$00, $00, $01,$00 ScreenCmdr: DB 0, ScreenStatus , low addr_Pressed_Status, high addr_Pressed_Status, BankMenuStatus, low draw_status_menu, high draw_status_menu, low loop_STAT_menu, high loop_STAT_menu, $00,$00,$00,$00, $00, $01,$00 DB 0, ScreenInvent , low addr_Pressed_Inventory, high addr_Pressed_Inventory, BankMenuInvent, low draw_inventory_menu, high draw_inventory_menu, $00, $00, $00,$00,$00,$00, $00, $01,$00 DB 0, ScreenPlanet , low addr_Pressed_PlanetData, high addr_Pressed_PlanetData, BankMenuSystem, low draw_system_data_menu, high draw_system_data_menu, $00, $00, $00,$00,$00,$00, $00, $01,$00 DB 1, ScreenEquip , low addr_Pressed_Equip, high addr_Pressed_Equip, BankMenuEquipS, low draw_eqshp_menu, high draw_eqshp_menu, low loop_eqshp_menu, high loop_eqshp_menu, $00,$00,$00,$00, $00, $01,$00 DB 1, ScreenLaunch , low addr_Pressed_Launch, high addr_Pressed_Launch, BankLaunchShip, low draw_launch_ship, high draw_launch_ship, low loop_launch_ship, high loop_launch_ship, $00,$01,$01,$00, $00, $01,$00 ScreenKeyFront: DB 2, ScreenFront , low addr_Pressed_Front, high addr_Pressed_Front, BankFrontView, low draw_front_view, high draw_front_view, $00, $00, $01,$00,$01,low input_front_view, high input_front_view, $00,$00 DB 2, ScreenAft , low addr_Pressed_Front, high addr_Pressed_Front, BankFrontView, low draw_front_view, high draw_front_view, $00, $00, $01,$00,$01,low input_front_view, high input_front_view, $00,$00 DB 2, ScreenLeft , low addr_Pressed_Front, high addr_Pressed_Front, BankFrontView, low draw_front_view, high draw_front_view, $00, $00, $01,$00,$01,low input_front_view, high input_front_view, $00,$00 DB 2, ScreenRight , low addr_Pressed_Front, high addr_Pressed_Front, BankFrontView, low draw_front_view, high draw_front_view, $00, $00, $01,$00,$01,low input_front_view, high input_front_view, $00,$00 DB 3, ScreenDocking , $FF, $FF, BankLaunchShip, low draw_docking_ship, high draw_docking_ship, low loop_docking_ship,high loop_docking_ship, $00,$01,$01,$00, $00, $01,$00 DB 1, ScreenHyperspace, $FF, $FF, BankFrontView, low draw_hyperspace, high draw_hyperspace, low loop_hyperspace, high loop_hyperspace, $00,$01,$01,$00 ; DB low addr_Pressed_Aft, high addr_Pressed_Aft, BankMenuGalCht, low SelectFrontView, high SelectFrontView, $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 ; DB low addr_Pressed_Left, high addr_Pressed_Left, BankMenuGalCht, low SelectFrontView, high SelectFrontView, $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 ; DB low addr_Pressed_Right, high addr_Pressed_Right, BankMenuGalCht, low SelectFrontView, high SelectFrontView, $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 ScreenMapRow EQU ScreenKeyGalactic - ScreenKeyMap ScreenMapLen EQU ($ - ScreenKeyMap) / ScreenMapRow ScreenViewsStart EQU (ScreenKeyFront - ScreenKeyMap)/ScreenMapRow ScreenTransitionForced DB $FF INCLUDE "./GameEngine/resetUniverse.asm" ;---------------------------------------------------------------------------------------------------------------------------------- LaunchedFromStation: MMUSelectSun call CreateSun ; create the local sun and set position based on seed call ClearUnivSlotList ld a,1 call SetSlot1ToSpaceStation ; set slot 1 to space station MMUSelectUniverseA ; Prep Target universe MMUSelectShipBank1 ; Bank in the ship model code ld a,CoriloisStation call GetShipBankId MMUSelectShipBankA ; Select the correct bank found ld a,b ; Select the correct ship call CopyShipToUniverse .BuiltStation: call ResetStationLaunch .NowInFlight: xor a ld (DockedFlag),a ForceTransition ScreenFront call ResetPlayerShip ret InitialiseCommander: ld a,(ScreenCmdr+1) ld ix,ScreenCmdr jp SetScreenAIX InitialiseFrontView: ld a,(ScreenKeyFront+1) ld ix,ScreenKeyFront jp SetScreenAIX ; false ret here as we get it free from jp ;---------------------------------------------------------------------------------------------------------------------------------- SetScreenAIX: ld (ScreenIndex),a ; Set screen index to a ClearForceTransition ; In case it was called by a brute force change in an update loop ld (ScreenChanged),a ; Set screen changed to FF ld a,(ix+4) ; Screen Map Byte 4 - Bank with Display code ld (ScreenLoopBank+1),a ; setup loop ld (HandleBankSelect+1),a ; setup cursor keys MMUSelectScreenA ld a,(ix+5) ; Screen Map Byte 5 - Function for display ld (ScreenUpdateAddr+1),a ld a,(ix+6) ; Screen Map Byte 6 - Function for display ld (ScreenUpdateAddr+2),a ld a,(ix+7) ; Screen Map Byte 7 - Main loop update routine ld (ScreenLoopJP+1),a ld a,(ix+8) ; Screen Map Byte 8 - Main loop update routine ld (ScreenLoopJP+2),a ld a,(ix+9) ; Screen Map Byte 9 - Draw stars Y/N ld (CheckIfViewUpdate+1),a ; Set flag to determine if we are on an exterior view ld a,(ix+10) ; Screen Map Byte 10 - Input Blocker (set to 1 will not allow keyboard screen change until flagged, used by transition screens and pause menus) ld (InputBlockerCheck+1),a ; Set flag to block transitions as needed e.g. launch screen ld a,(ix+11) ; Screen Map Byte 11 - Double Buffering 0 = no, 1 = yes ld (DoubleBufferCheck+1),a ld a,(ix+12) ld (CallCursorRoutine+1),a ld a,(ix+13) ld (CallCursorRoutine+2),a ScreenUpdateAddr: jp $0000 ; We can just drop out now and also get a free ret from caller ;---------------------------------------------------------------------------------------------------------------------------------- ViewKeyTest: ld a,(ScreenIndex) ld c,a ld b,ScreenMapLen ; For now until add screens are added ld ix,ScreenKeyMap ld hl,(InnerHyperCount) ld a,h or l ld iyh,a ViewScanLoop: ld a,iyh .HyperspaceCountdown: and a jr z,.DockedFlag ld a,(ix+14) cp 1 jp z,NotReadNextKey .DockedFlag: ld a,(ix+0) ; Screen Map Byte 0 Docked flag ; 0 = not applicable (always read), 1 = only whilst docked, 2 = only when not docked, 3 = No keypress allowed cp 3 ; if not selectable then don't scan this (becuase its a transition screen) jr z,NotReadNextKey ; cp 0 ; if itr a always read skip docking check jr z,.NoDocCheck .DocCheck: ld d,a ld a,(DockedFlag) cp 0 ; if we are docked jr z,.NotDockedCheck .DockedCheck: ld a,d cp 1 ; if we are docked and its a dock only then scan jr nz,NotReadNextKey jr .NoDocCheck .NotDockedCheck: ld a,d cp 2 ; if we are not docked and its a flight only then scan jr nz,NotReadNextKey .NoDocCheck: ld a,(ix+1) ; Screen Map Byte 1 Screen Id cp c ; is the index the current screen, if so skip the scan ld e,a jr z,NotReadNextKey ld a,(ix+2) ; Screen Map Byte 2 - address of keypress table cp $FF ; if upper byte is FF then we do not respond jr z,NotReadNextKey ld (ReadKeyAddr+1),a ; Poke address into the ld hl,(....) below ld a,(ix+3) ; Screen Map Byte 3 - address of keypress table ld (ReadKeyAddr+2),a ReadKeyAddr: ld hl,($0000) ; address is entry in the pointer table to the actual keypress ld a,(hl) ; now fetch the actual keypress IfAIsZeroGoto NotReadNextKey .ValidScreenChange: ld a,e jp SetScreenAIX ;--- CODE WILL NOT FALL TO HERE --- NotReadNextKey: ld de,ScreenMapRow add ix,de ; we have only processed 3 of 8 bytes at here djnz ViewScanLoop ret SetInitialShipPosition: ld hl,$0000 ld (UBnKxlo),hl ld hl,$0000 ld (UBnKylo),hl ld hl,$03B4 ld (UBnKzlo),hl xor a ld (UBnKxsgn),a ld (UBnKysgn),a ld (UBnKzsgn),a ; call Reset TODO call InitialiseOrientation ;#00; ld a,1 ld (DELTA),a ld hl,4 ld (DELTA4),hl ret INCLUDE "./Views/ConsoleDrawing.asm" ;.absXhi: ; ld a,ScannerX ; JumpOnBitSet d,7,ScannerNegX ; add a,e ; jp ScannerZCoord ;ScannerNegX: sub e ;ScannerZCoord: ld e,a ; srl c ; srl c ; ld a,ScannerY ; JumpOnBitSet b,7,ScannerNegZ ; sub c ; jp ScannerYCoord ;ScannerNegZ: add a,c ;ScannerYCoord: ld d,a ; now de = pixel pos d = y e = x for base of stick X & Z , so need Y Stick height ; JumpOnBitSet h,7,ScannerStickDown ; sub l ; a already holds actual Y ; JumpIfAGTENusng 128,ScannerHeightDone ; ld a,128 ; jp ScannerHeightDone ;ScannerStickDown: add a,l ; JumpIfAGTENusng 191,ScannerHeightDone ; ld a,191 ;ScannerHeightDone: ld c,e ; Now sort out line from point DE horzontal by a ; ld b,d ; ld d,a ; cp b ; jp z,Scanner0Height ; ld e,194 ; Should be coloured based on status but this will do for now ; push bc ; push de ; MMUSelectLayer2 ; call l2_draw_vert_line_to ; pop de ; pop bc ;Scanner0Height: ld b,d ; push bc ; ld a,255 ; MMUSelectLayer2 ; call l2_plot_pixel ; pop bc ; inc c ; ld a,255 ; MMUSelectLayer2 ; call l2_plot_pixel ret SeedGalaxy0: xor a MMUSelectGalaxyA ld ix,galaxy_data xor a ld (XSAV),a call copy_galaxy_to_system SeedGalaxy0Loop: push ix pop de ld hl,SystemSeed call copy_seed push ix pop hl add hl,8 push hl pop ix call next_system_seed ld a,(XSAV) dec a cp 0 ret z ld (XSAV),a jr nz,SeedGalaxy0Loop ret ;include "./ModelRender/testdrawing.asm" XX12PVarQ DW 0 XX12PVarR DW 0 XX12PVarS DW 0 XX12PVarResult1 DW 0 XX12PVarResult2 DW 0 XX12PVarResult3 DW 0 XX12PVarSign2 DB 0 XX12PVarSign1 DB 0 ; Note reversed so BC can do a little endian fetch XX12PVarSign3 DB 0 include "./Maths/Utilities/XX12EquNodeDotOrientation.asm" include "ModelRender/CopyXX12ToXX15.asm" include "ModelRender/CopyXX15ToXX12.asm" include "./Maths/Utilities/ScaleXX16Matrix197.asm" include "./Universe/StarRoutines.asm" ; include "Universe/move_object-MVEIT.asm" ; include "./ModelRender/draw_object.asm" ; include "./ModelRender/draw_ship_point.asm" ; include "./ModelRender/drawforwards-LL17.asm" INCLUDE "./Hardware/memfill_dma.asm" INCLUDE "./Hardware/memcopy_dma.asm" INCLUDE "./Hardware/keyboard.asm" INCLUDE "./Variables/constant_equates.asm" INCLUDE "./Variables/general_variables.asm" INCLUDE "./Variables/UniverseSlotRoutines.asm" INCLUDE "./Variables/EquipmentVariables.asm" INCLUDE "./Variables/random_number.asm" INCLUDE "./Variables/galaxy_seed.asm" INCLUDE "./Tables/text_tables.asm" INCLUDE "./Tables/dictionary.asm" INCLUDE "./Tables/name_digrams.asm" ;INCLUDE "Tables/inwk_table.asm" This is no longer needed as we will write to univer object bank ; Include all maths libraries to test assembly INCLUDE "./Maths/addhldesigned.asm" INCLUDE "./Maths/addhlasigned.asm" INCLUDE "./Maths/Utilities/AddDEToCash.asm" INCLUDE "./Maths/DIVD3B2.asm" INCLUDE "./Maths/multiply.asm" INCLUDE "./Maths/asm_square.asm" INCLUDE "./Maths/asm_sqrt.asm" INCLUDE "./Maths/asm_divide.asm" INCLUDE "./Maths/asm_unitvector.asm" INCLUDE "./Maths/compare16.asm" INCLUDE "./Maths/negate16.asm" INCLUDE "./Maths/normalise96.asm" INCLUDE "./Maths/binary_to_decimal.asm" include "./Maths/ADDHLDESignBC.asm" ;INCLUDE "badd_ll38.asm" ;;INCLUDE "XX12equXX15byXX16.asm" INCLUDE "./Maths/Utilities/AequAdivQmul96-TIS2.asm" INCLUDE "./Maths/Utilities/AequAmulQdiv256-FMLTU.asm" INCLUDE "./Maths/Utilities/PRequSpeedDivZZdiv8-DV42-DV42IYH.asm" INCLUDE "./Maths/Utilities/AequDmulEdiv256usgn-DEFMUTL.asm" ;INCLUDE "AP2equAPmulQunsgEorP-MLTU2.asm" ;INCLUDE "APequPmulQUnsg-MULTU.asm" ;INCLUDE "APequPmulX-MU11.asm" INCLUDE "./Maths/Utilities/APequQmulA-MULT1.asm" INCLUDE "./Maths/Utilities/badd_ll38.asm" INCLUDE "./Maths/Utilities/moveship4-MVS4.asm" ;INCLUDE "MoveShip5-MVS5.asm" ;INCLUDE "PAequAmulQusgn-MLU2.asm" ;INCLUDE "PAequDustYIdxYmulQ-MLU1.asm" ;INCLUDE "PlanetP12addInwkX-MVT6.asm" INCLUDE "./Maths/Utilities/RequAmul256divQ-BFRDIV.asm" INCLUDE "./Maths/Utilities/RequAdivQ-LL61.asm" ; INCLUDE "./Maths/Utilities/RSequABSrs-LL129.asm" INCLUDE "./Maths/Utilities/RSequQmulA-MULT12.asm" ;INCLUDE "SwapRotmapXY-PUS1.asm" INCLUDE "./Maths/Utilities/tidy.asm" INCLUDE "./Maths/Utilities/LL28AequAmul256DivD.asm" INCLUDE "./Maths/Utilities/XAequMinusXAPplusRSdiv96-TIS1.asm" ;INCLUDE "XAequQmuilAaddRS-MAD-ADD.asm" ;INCLUDE "XHiYLoequPA-gc3.asm" ;INCLUDE "XHiYLoequPmulAmul4-gc2.asm" ;INCLUDE "XLoYHiequPmulQmul4-gcash.asm" ;INCLUDE "XX12equXX15byXX16-LL51.asm" ; INCLUDE "./Maths/Utilities/XYeqyx1loSmulMdiv256-Ll120-LL123.asm" INCLUDE "./Drive/drive_access.asm" INCLUDE "./Menus/common_menu.asm" ; ARCHIVED INCLUDE "Menus/draw_fuel_and_crosshair.asm" ;INCLUDE "./title_page.asm" ; Blocks dependent on variables in Universe Banks ; Bank 49 ; SEG RESETUNIVSEG ;seg CODE_SEG, 4: $0000, $8000 ; flat address ;seg RESETUNIVSEG, BankResetUniv: StartOfBank, ResetUniverseAddr ; ORG ResetUniverseAddr ;INCLUDE "./GameEngine/resetUniverse.asm" ; Bank 50 SLOT MenuShrChtAddr PAGE BankMenuShrCht ORG MenuShrChtAddr,BankMenuShrCht INCLUDE "./Menus/short_range_chart_menu.asm" ; Bank 51 SLOT MenuGalChtAddr PAGE BankMenuGalCht ORG MenuGalChtAddr INCLUDE "./Menus//galactic_chart_menu.asm" ; Bank 52 SLOT MenuInventAddr PAGE BankMenuInvent ORG MenuInventAddr INCLUDE "./Menus/inventory_menu.asm" ; Bank 53 SLOT MenuSystemAddr PAGE BankMenuSystem ORG MenuSystemAddr INCLUDE "./Menus/system_data_menu.asm" ; Bank 54 SLOT MenuMarketAddr PAGE BankMenuMarket ORG MenuMarketAddr INCLUDE "./Menus/market_prices_menu.asm" ; Bank 66 SLOT DispMarketAddr PAGE BankDispMarket ORG DispMarketAddr INCLUDE "./Menus/market_prices_disp.asm" ; Bank 55 SLOT StockTableAddr PAGE BankStockTable ORG StockTableAddr INCLUDE "./Tables/stock_table.asm" ; Bank 57 SLOT LAYER2Addr PAGE BankLAYER2 ORG LAYER2Addr INCLUDE "./Layer2Graphics/layer2_bank_select.asm" INCLUDE "./Layer2Graphics/layer2_cls.asm" INCLUDE "./Layer2Graphics/layer2_initialise.asm" INCLUDE "./Layer2Graphics/l2_flip_buffers.asm" INCLUDE "./Layer2Graphics/layer2_plot_pixel.asm" INCLUDE "./Layer2Graphics/layer2_print_character.asm" INCLUDE "./Layer2Graphics/layer2_draw_box.asm" INCLUDE "./Layer2Graphics/asm_l2_plot_horizontal.asm" INCLUDE "./Layer2Graphics/asm_l2_plot_vertical.asm" INCLUDE "./Layer2Graphics/layer2_plot_diagonal.asm" INCLUDE "./Layer2Graphics/asm_l2_plot_triangle.asm" INCLUDE "./Layer2Graphics/asm_l2_fill_triangle.asm" INCLUDE "./Layer2Graphics/layer2_plot_circle.asm" INCLUDE "./Layer2Graphics/layer2_plot_circle_fill.asm" INCLUDE "./Layer2Graphics/l2_draw_any_line.asm" INCLUDE "./Layer2Graphics/clearLines-LL155.asm" INCLUDE "./Layer2Graphics/l2_draw_line_v2.asm" ; Bank 56 ------------------------------------------------------------------------------------------------------------------------ SLOT CMDRDATAAddr PAGE BankCmdrData ORG CMDRDATAAddr, BankCmdrData INCLUDE "./Commander/commanderData.asm" INCLUDE "./Commander/zero_player_cargo.asm" ; Bank 58 ------------------------------------------------------------------------------------------------------------------------ SLOT LAYER1Addr PAGE BankLAYER1 ORG LAYER1Addr, BankLAYER1 INCLUDE "./Layer1Graphics/layer1_attr_utils.asm" INCLUDE "./Layer1Graphics/layer1_cls.asm" INCLUDE "./Layer1Graphics/layer1_print_at.asm" ; Bank 59 ------------------------------------------------------------------------------------------------------------------------ ; In the first copy of the banks the "Non number" labels exist. They will map directly in other banks ; as the is aligned and data tables are after that ; need to make the ship index tables same size in each to simplify further SLOT ShipModelsAddr PAGE BankShipModels1 ORG ShipModelsAddr, BankShipModels1 INCLUDE "./Data/ShipModelMacros.asm" INCLUDE "./Data/ShipBank1Label.asm" GetShipBankId: GetShipBank1Id: MGetShipBankId ShipBankTable CopyVertsToUniv: CopyVertsToUniv1: McopyVertsToUniverse CopyEdgesToUniv: CopyEdgesToUniv1: McopyEdgesToUniverse CopyNormsToUniv: CopyNormsToUniv1: McopyNormsToUniverse ShipBankTable: ShipBankTable1: MShipBankTable CopyShipToUniverse: CopyShipToUniverse1 MCopyShipToUniverse BankShipModels1 CopyBodyToUniverse: CopyBodyToUniverse1: MCopyBodyToUniverse CopyShipToUniverse1 INCLUDE "./Data/ShipModelMetaData1.asm" ; Bank 67 ------------------------------------------------------------------------------------------------------------------------ SLOT ShipModelsAddr PAGE BankShipModels2 ORG ShipModelsAddr, BankShipModels2 INCLUDE "./Data/ShipBank2Label.asm" GetShipBank2Id: MGetShipBankId ShipBankTable2 CopyVertsToUniv2: McopyVertsToUniverse CopyEdgesToUniv2: McopyEdgesToUniverse CopyNormsToUniv2: McopyNormsToUniverse ShipBankTable2: MShipBankTable CopyShipToUniverse2 MCopyShipToUniverse BankShipModels2 CopyBodyToUniverse2: MCopyBodyToUniverse CopyShipToUniverse2 INCLUDE "./Data/ShipModelMetaData2.asm" ; Bank 68 ------------------------------------------------------------------------------------------------------------------------ SLOT ShipModelsAddr PAGE BankShipModels3 ORG ShipModelsAddr, BankShipModels3 INCLUDE "./Data/ShipBank3Label.asm" GetShipBank3Id: MGetShipBankId ShipBankTable3 CopyVertsToUniv3: McopyVertsToUniverse CopyEdgesToUniv3: McopyEdgesToUniverse CopyNormsToUniv3: McopyNormsToUniverse ShipBankTable3: MShipBankTable CopyShipToUniverse3 MCopyShipToUniverse BankShipModels3 CopyBodyToUniverse3: MCopyBodyToUniverse CopyShipToUniverse3 INCLUDE "./Data/ShipModelMetaData3.asm" ;;Privisioned for more models ; Bank 69 ------------------------------------------------------------------------------------------------------------------------ ;;Privisioned for more models SLOT ShipModelsAddr ;;Privisioned for more models PAGE BankShipModels4 ;;Privisioned for more models ORG ShipModelsAddr, BankShipModels4 ; Bank 60 ------------------------------------------------------------------------------------------------------------------------ SLOT SpritemembankAddr PAGE BankSPRITE ORG SpritemembankAddr, BankSPRITE INCLUDE "./Layer3Sprites/sprite_routines.asm" INCLUDE "./Layer3Sprites/sprite_load.asm" INCLUDE "./Layer3Sprites/SpriteSheet.asm" ; Bank 61 ------------------------------------------------------------------------------------------------------------------------ SLOT ConsoleImageAddr PAGE BankConsole ORG ConsoleImageAddr, BankConsole INCLUDE "./Images/ConsoleImageData.asm" ; Bank 62 ------------------------------------------------------------------------------------------------------------------------ SLOT ViewFrontAddr PAGE BankFrontView ORG ViewFrontAddr INCLUDE "./Views/Front_View.asm" ; Bank 63 ------------------------------------------------------------------------------------------------------------------------ SLOT MenuStatusAddr PAGE BankMenuStatus ORG MenuStatusAddr INCLUDE "./Menus/status_menu.asm" ; Bank 64 ------------------------------------------------------------------------------------------------------------------------ SLOT MenuEquipSAddr PAGE BankMenuEquipS ORG MenuEquipSAddr INCLUDE "./Menus/equip_ship_menu.asm" SLOT LaunchShipAddr PAGE BankLaunchShip ORG LaunchShipAddr INCLUDE "./Transitions/launch_ship.asm" ; Bank 70 ------------------------------------------------------------------------------------------------------------------------ SLOT UniverseBankAddr PAGE BankUNIVDATA0 ORG UniverseBankAddr,BankUNIVDATA0 INCLUDE "./Universe/univ_ship_data.asm" SLOT UniverseBankAddr PAGE BankUNIVDATA1 ORG UniverseBankAddr,BankUNIVDATA1 UNIVDATABlock1 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT UniverseBankAddr PAGE BankUNIVDATA2 ORG UniverseBankAddr,BankUNIVDATA2 UNIVDATABlock2 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT UniverseBankAddr PAGE BankUNIVDATA3 ORG UniverseBankAddr,BankUNIVDATA3 UNIVDATABlock3 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT UniverseBankAddr PAGE BankUNIVDATA4 ORG UniverseBankAddr,BankUNIVDATA4 UNIVDATABlock4 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT UniverseBankAddr PAGE BankUNIVDATA5 ORG UniverseBankAddr,BankUNIVDATA5 UNIVDATABlock5 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT UniverseBankAddr PAGE BankUNIVDATA6 ORG UniverseBankAddr,BankUNIVDATA6 UNIVDATABlock6 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT UniverseBankAddr PAGE BankUNIVDATA7 ORG UniverseBankAddr,BankUNIVDATA7 UNIVDATABlock7 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT UniverseBankAddr PAGE BankUNIVDATA8 ORG UniverseBankAddr,BankUNIVDATA8 UNIVDATABlock8 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT UniverseBankAddr PAGE BankUNIVDATA8 ORG UniverseBankAddr,BankUNIVDATA9 UNIVDATABlock9 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT UniverseBankAddr PAGE BankUNIVDATA10 ORG UniverseBankAddr,BankUNIVDATA10 UNIVDATABlock10 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT UniverseBankAddr PAGE BankUNIVDATA11 ORG UniverseBankAddr,BankUNIVDATA11 UNIVDATABlock11 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT UniverseBankAddr PAGE BankUNIVDATA12 ORG UniverseBankAddr,BankUNIVDATA12 UNIVDATABlock12 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT GalaxyDataAddr PAGE BankGalaxyData0 ORG GalaxyDataAddr, BankGalaxyData0 INCLUDE "./Universe/galaxy_data.asm" DISPLAY "Galaxy Data - Bytes free ",/D, $2000 - ($- GalaxyDataAddr) ; Bank 83 ------------------------------------------------------------------------------------------------------------------------ SLOT SunBankAddr PAGE BankSunData ORG SunBankAddr,BankSunData INCLUDE "./Universe/Sun/sun_data.asm" ; Bank 84 ------------------------------------------------------------------------------------------------------------------------ SLOT PlanetBankAddr PAGE BankPlanetData ORG PlanetBankAddr,BankPlanetData ;TODO INCLUDE "./Universe/planet_data.asm" SLOT GalaxyDataAddr PAGE BankGalaxyData1 ORG GalaxyDataAddr, BankGalaxyData1 GALAXYDATABlock1 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT GalaxyDataAddr PAGE BankGalaxyData2 ORG GalaxyDataAddr, BankGalaxyData2 GALAXYDATABlock2 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT GalaxyDataAddr PAGE BankGalaxyData3 ORG GalaxyDataAddr, BankGalaxyData3 GALAXYDATABlock3 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT GalaxyDataAddr PAGE BankGalaxyData4 ORG GalaxyDataAddr, BankGalaxyData4 GALAXYDATABlock4 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT GalaxyDataAddr PAGE BankGalaxyData5 ORG GalaxyDataAddr,BankGalaxyData5 GALAXYDATABlock5 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT GalaxyDataAddr PAGE BankGalaxyData6 ORG GalaxyDataAddr,BankGalaxyData6 GALAXYDATABlock6 DB $FF DS $1FFF ; just allocate 8000 bytes for now SLOT GalaxyDataAddr PAGE BankGalaxyData7 ORG GalaxyDataAddr,BankGalaxyData7 GALAXYDATABlock7 DB $FF DS $1FFF ; just allocate 8000 bytes for now SAVENEX OPEN "EliteN.nex", $8000 , $7F00 SAVENEX CFG 0,0,0,1 SAVENEX AUTO SAVENEX CLOSE
source/schedTest.asm
hamedmiir/OS-Lab-Scheduling
0
175865
_schedTest: file format elf32-i386 Disassembly of section .text: 00000000 <main>: void lotteryTest(); void multilevelQueue(); void showProcessScheduling(); int main(int argc, char const *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: 51 push %ecx e: 83 ec 04 sub $0x4,%esp set_lottery_ticket(50, getpid()); 11: e8 c1 07 00 00 call 7d7 <getpid> 16: 83 ec 08 sub $0x8,%esp 19: 50 push %eax 1a: 6a 32 push $0x32 1c: e8 f6 07 00 00 call 817 <set_lottery_ticket> multilevelQueue(); 21: e8 0a 03 00 00 call 330 <multilevelQueue> exit(); 26: e8 2c 07 00 00 call 757 <exit> 2b: 66 90 xchg %ax,%ax 2d: 66 90 xchg %ax,%ax 2f: 90 nop 00000030 <showProcessScheduling>: } void showProcessScheduling() { 30: 55 push %ebp 31: 89 e5 mov %esp,%ebp show_processes_scheduling(); } 33: 5d pop %ebp show_processes_scheduling(); 34: e9 ee 07 00 00 jmp 827 <show_processes_scheduling> 39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000040 <priorityTest>: void priorityTest() { 40: 55 push %ebp 41: 89 e5 mov %esp,%ebp 43: 56 push %esi 44: 53 push %ebx set_sched_queue(PRIORITY, getpid()); 45: e8 8d 07 00 00 call 7d7 <getpid> 4a: 83 ec 08 sub $0x8,%esp 4d: 50 push %eax 4e: 6a 01 push $0x1 50: e8 ca 07 00 00 call 81f <set_sched_queue> set_priority(0, getpid()); 55: e8 7d 07 00 00 call 7d7 <getpid> 5a: 59 pop %ecx 5b: 5b pop %ebx 5c: 50 push %eax 5d: 6a 00 push $0x0 int pid = getpid(); 5f: bb 03 00 00 00 mov $0x3,%ebx set_priority(0, getpid()); 64: e8 a6 07 00 00 call 80f <set_priority> int pid = getpid(); 69: e8 69 07 00 00 call 7d7 <getpid> 6e: 83 c4 10 add $0x10,%esp 71: 89 c6 mov %eax,%esi int i; for(i = 1; i < NCHILD; i++) { if(pid > 0) 73: 85 f6 test %esi,%esi 75: 7f 49 jg c0 <priorityTest+0x80> for(i = 1; i < NCHILD; i++) 77: 83 eb 01 sub $0x1,%ebx 7a: 75 f7 jne 73 <priorityTest+0x33> break; } } if(pid < 0) 7c: 85 f6 test %esi,%esi 7e: 0f 88 ab 00 00 00 js 12f <priorityTest+0xef> { printf(2, "fork error\n"); } else if(pid == 0) 84: 74 48 je ce <priorityTest+0x8e> } else { int i; for(i = 0; i < NCHILD; i++) wait(); 86: e8 d4 06 00 00 call 75f <wait> 8b: e8 cf 06 00 00 call 75f <wait> 90: e8 ca 06 00 00 call 75f <wait> 95: e8 c5 06 00 00 call 75f <wait> printf(1, "Main user program finished pid %d\n", getpid()); 9a: e8 38 07 00 00 call 7d7 <getpid> 9f: 83 ec 04 sub $0x4,%esp a2: 50 push %eax a3: 68 4c 0c 00 00 push $0xc4c a8: 6a 01 push $0x1 aa: e8 21 08 00 00 call 8d0 <printf> af: 83 c4 10 add $0x10,%esp } } b2: 8d 65 f8 lea -0x8(%ebp),%esp b5: 5b pop %ebx b6: 5e pop %esi b7: 5d pop %ebp b8: c3 ret b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi pid = fork(); c0: e8 8a 06 00 00 call 74f <fork> if(pid > 0) c5: 83 f8 00 cmp $0x0,%eax pid = fork(); c8: 89 c6 mov %eax,%esi if(pid > 0) ca: 7f 44 jg 110 <priorityTest+0xd0> if(pid == 0 ) cc: 75 a9 jne 77 <priorityTest+0x37> ownPid = getpid(); ce: e8 04 07 00 00 call 7d7 <getpid> d3: bb 40 0d 03 00 mov $0x30d40,%ebx d8: 89 c6 mov %eax,%esi da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi delay(200000000); e0: 83 ec 0c sub $0xc,%esp e3: 68 00 c2 eb 0b push $0xbebc200 e8: e8 33 06 00 00 call 720 <delay> for(i = 0 ; i < 200000 ; i++) ed: 83 c4 10 add $0x10,%esp f0: 83 eb 01 sub $0x1,%ebx f3: 75 eb jne e0 <priorityTest+0xa0> printf(1, "%d\n", ownPid); f5: 83 ec 04 sub $0x4,%esp f8: 56 push %esi f9: 68 34 0c 00 00 push $0xc34 fe: 6a 01 push $0x1 100: e8 cb 07 00 00 call 8d0 <printf> 105: 83 c4 10 add $0x10,%esp } 108: 8d 65 f8 lea -0x8(%ebp),%esp 10b: 5b pop %ebx 10c: 5e pop %esi 10d: 5d pop %ebp 10e: c3 ret 10f: 90 nop set_sched_queue(PRIORITY, pid); 110: 83 ec 08 sub $0x8,%esp 113: 50 push %eax 114: 6a 01 push $0x1 116: e8 04 07 00 00 call 81f <set_sched_queue> set_priority(10-i, pid); 11b: 58 pop %eax 11c: 8d 43 06 lea 0x6(%ebx),%eax 11f: 5a pop %edx 120: 56 push %esi 121: 50 push %eax 122: e8 e8 06 00 00 call 80f <set_priority> 127: 83 c4 10 add $0x10,%esp 12a: e9 48 ff ff ff jmp 77 <priorityTest+0x37> printf(2, "fork error\n"); 12f: 83 ec 08 sub $0x8,%esp 132: 68 28 0c 00 00 push $0xc28 137: 6a 02 push $0x2 139: e8 92 07 00 00 call 8d0 <printf> 13e: 83 c4 10 add $0x10,%esp } 141: 8d 65 f8 lea -0x8(%ebp),%esp 144: 5b pop %ebx 145: 5e pop %esi 146: 5d pop %ebp 147: c3 ret 148: 90 nop 149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000150 <SJFTest>: void SJFTest(){ 150: 55 push %ebp 151: 89 e5 mov %esp,%ebp 153: 56 push %esi 154: 53 push %ebx int pid = getpid(); set_sched_queue(SJF, getpid()); 155: bb 0c 00 00 00 mov $0xc,%ebx int pid = getpid(); 15a: e8 78 06 00 00 call 7d7 <getpid> 15f: 89 c6 mov %eax,%esi set_sched_queue(SJF, getpid()); 161: e8 71 06 00 00 call 7d7 <getpid> 166: 83 ec 08 sub $0x8,%esp 169: 50 push %eax 16a: 6a 02 push $0x2 16c: e8 ae 06 00 00 call 81f <set_sched_queue> 171: 83 c4 10 add $0x10,%esp int i; for(i = 1; i < NCHILD; i++) { if(pid > 0) 174: 85 f6 test %esi,%esi 176: 7f 50 jg 1c8 <SJFTest+0x78> 178: 83 c3 02 add $0x2,%ebx for(i = 1; i < NCHILD; i++) 17b: 83 fb 12 cmp $0x12,%ebx 17e: 75 f4 jne 174 <SJFTest+0x24> if(pid == 0 ) break; } } if(pid < 0) 180: 85 f6 test %esi,%esi 182: 0f 88 b4 00 00 00 js 23c <SJFTest+0xec> { printf(2, "fork error\n"); } else if(pid == 0) 188: 74 4c je 1d6 <SJFTest+0x86> } else { int i; for(i = 0; i < NCHILD + 1; i++) wait(); 18a: e8 d0 05 00 00 call 75f <wait> 18f: e8 cb 05 00 00 call 75f <wait> 194: e8 c6 05 00 00 call 75f <wait> 199: e8 c1 05 00 00 call 75f <wait> 19e: e8 bc 05 00 00 call 75f <wait> printf(1, "Main user program finished pid %d\n", getpid()); 1a3: e8 2f 06 00 00 call 7d7 <getpid> 1a8: 83 ec 04 sub $0x4,%esp 1ab: 50 push %eax 1ac: 68 4c 0c 00 00 push $0xc4c 1b1: 6a 01 push $0x1 1b3: e8 18 07 00 00 call 8d0 <printf> 1b8: 83 c4 10 add $0x10,%esp } } 1bb: 8d 65 f8 lea -0x8(%ebp),%esp 1be: 5b pop %ebx 1bf: 5e pop %esi 1c0: 5d pop %ebp 1c1: c3 ret 1c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi pid = fork(); 1c8: e8 82 05 00 00 call 74f <fork> if(pid > 0) 1cd: 83 f8 00 cmp $0x0,%eax pid = fork(); 1d0: 89 c6 mov %eax,%esi if(pid > 0) 1d2: 7f 4c jg 220 <SJFTest+0xd0> if(pid == 0 ) 1d4: 75 a2 jne 178 <SJFTest+0x28> ownPid = getpid(); 1d6: e8 fc 05 00 00 call 7d7 <getpid> 1db: bb 20 4e 00 00 mov $0x4e20,%ebx 1e0: 89 c6 mov %eax,%esi 1e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi delay(200000000); 1e8: 83 ec 0c sub $0xc,%esp 1eb: 68 00 c2 eb 0b push $0xbebc200 1f0: e8 2b 05 00 00 call 720 <delay> for(i = 0 ; i < 20000 ; i++) 1f5: 83 c4 10 add $0x10,%esp 1f8: 83 eb 01 sub $0x1,%ebx 1fb: 75 eb jne 1e8 <SJFTest+0x98> printf(1, "%d\n", ownPid); 1fd: 83 ec 04 sub $0x4,%esp 200: 56 push %esi 201: 68 34 0c 00 00 push $0xc34 206: 6a 01 push $0x1 208: e8 c3 06 00 00 call 8d0 <printf> 20d: 83 c4 10 add $0x10,%esp } 210: 8d 65 f8 lea -0x8(%ebp),%esp 213: 5b pop %ebx 214: 5e pop %esi 215: 5d pop %ebp 216: c3 ret 217: 89 f6 mov %esi,%esi 219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi set_sched_queue(SJF, pid); 220: 83 ec 08 sub $0x8,%esp 223: 50 push %eax 224: 6a 02 push $0x2 226: e8 f4 05 00 00 call 81f <set_sched_queue> set_burst_time(10 + 2*i, pid); 22b: 58 pop %eax 22c: 5a pop %edx 22d: 56 push %esi 22e: 53 push %ebx 22f: e8 d3 05 00 00 call 807 <set_burst_time> 234: 83 c4 10 add $0x10,%esp 237: e9 3c ff ff ff jmp 178 <SJFTest+0x28> printf(2, "fork error\n"); 23c: 83 ec 08 sub $0x8,%esp 23f: 68 28 0c 00 00 push $0xc28 244: 6a 02 push $0x2 246: e8 85 06 00 00 call 8d0 <printf> 24b: 83 c4 10 add $0x10,%esp } 24e: 8d 65 f8 lea -0x8(%ebp),%esp 251: 5b pop %ebx 252: 5e pop %esi 253: 5d pop %ebp 254: c3 ret 255: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000260 <lotteryTest>: void lotteryTest(){ 260: 55 push %ebp 261: 89 e5 mov %esp,%ebp 263: 56 push %esi 264: 53 push %ebx int pid = getpid(); 265: bb 03 00 00 00 mov $0x3,%ebx 26a: e8 68 05 00 00 call 7d7 <getpid> 26f: 89 c6 mov %eax,%esi int i; for(i = 1; i < NCHILD; i++) { if(pid > 0) 271: 85 f6 test %esi,%esi 273: 7f 2b jg 2a0 <lotteryTest+0x40> for(i = 1; i < NCHILD; i++) 275: 83 eb 01 sub $0x1,%ebx 278: 75 f7 jne 271 <lotteryTest+0x11> } } if(pid < 0) 27a: 85 f6 test %esi,%esi 27c: 0f 88 8d 00 00 00 js 30f <lotteryTest+0xaf> { printf(2, "fork error\n"); } else if(pid == 0) 282: 74 2a je 2ae <lotteryTest+0x4e> } else { int i; for(i = 0; i < NCHILD; i++) wait(); 284: e8 d6 04 00 00 call 75f <wait> 289: e8 d1 04 00 00 call 75f <wait> 28e: e8 cc 04 00 00 call 75f <wait> } } 293: 8d 65 f8 lea -0x8(%ebp),%esp 296: 5b pop %ebx 297: 5e pop %esi 298: 5d pop %ebp wait(); 299: e9 c1 04 00 00 jmp 75f <wait> 29e: 66 90 xchg %ax,%ax pid = fork(); 2a0: e8 aa 04 00 00 call 74f <fork> if(pid > 0) 2a5: 83 f8 00 cmp $0x0,%eax pid = fork(); 2a8: 89 c6 mov %eax,%esi if(pid > 0) 2aa: 7f 44 jg 2f0 <lotteryTest+0x90> if(pid == 0 ) 2ac: 75 c7 jne 275 <lotteryTest+0x15> ownPid = getpid(); 2ae: e8 24 05 00 00 call 7d7 <getpid> 2b3: bb 00 2d 31 01 mov $0x1312d00,%ebx 2b8: 89 c6 mov %eax,%esi 2ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi delay(2000000000); 2c0: 83 ec 0c sub $0xc,%esp 2c3: 68 00 94 35 77 push $0x77359400 2c8: e8 53 04 00 00 call 720 <delay> for(i = 0 ; i < 20000000 ; i++) 2cd: 83 c4 10 add $0x10,%esp 2d0: 83 eb 01 sub $0x1,%ebx 2d3: 75 eb jne 2c0 <lotteryTest+0x60> printf(1, "%d\n", ownPid); 2d5: 83 ec 04 sub $0x4,%esp 2d8: 56 push %esi 2d9: 68 34 0c 00 00 push $0xc34 2de: 6a 01 push $0x1 2e0: e8 eb 05 00 00 call 8d0 <printf> 2e5: 83 c4 10 add $0x10,%esp } 2e8: 8d 65 f8 lea -0x8(%ebp),%esp 2eb: 5b pop %ebx 2ec: 5e pop %esi 2ed: 5d pop %ebp 2ee: c3 ret 2ef: 90 nop set_sched_queue(LOTTERY, pid); 2f0: 83 ec 08 sub $0x8,%esp 2f3: 50 push %eax 2f4: 6a 03 push $0x3 2f6: e8 24 05 00 00 call 81f <set_sched_queue> set_lottery_ticket(10-i, pid); 2fb: 58 pop %eax 2fc: 8d 43 06 lea 0x6(%ebx),%eax 2ff: 5a pop %edx 300: 56 push %esi 301: 50 push %eax 302: e8 10 05 00 00 call 817 <set_lottery_ticket> 307: 83 c4 10 add $0x10,%esp 30a: e9 66 ff ff ff jmp 275 <lotteryTest+0x15> printf(2, "fork error\n"); 30f: 83 ec 08 sub $0x8,%esp 312: 68 28 0c 00 00 push $0xc28 317: 6a 02 push $0x2 319: e8 b2 05 00 00 call 8d0 <printf> 31e: 83 c4 10 add $0x10,%esp } 321: 8d 65 f8 lea -0x8(%ebp),%esp 324: 5b pop %ebx 325: 5e pop %esi 326: 5d pop %ebp 327: c3 ret 328: 90 nop 329: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000330 <multilevelQueue>: void multilevelQueue() { 330: 55 push %ebp 331: 89 e5 mov %esp,%ebp 333: 57 push %edi 334: 56 push %esi 335: 53 push %ebx set_priority(NCHILD * 3 - i, pid); } else if( i < NCHILD * 2) { set_sched_queue(SJF, pid); set_burst_time(NCHILD * 5 - i, pid); 336: be 14 00 00 00 mov $0x14,%esi for(i = 0; i < 3 * NCHILD; i++) 33b: 31 db xor %ebx,%ebx void multilevelQueue() { 33d: 83 ec 0c sub $0xc,%esp int pid = getpid(); 340: e8 92 04 00 00 call 7d7 <getpid> 345: 89 c7 mov %eax,%edi 347: eb 0f jmp 358 <multilevelQueue+0x28> 349: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(i = 0; i < 3 * NCHILD; i++) 350: 83 c3 01 add $0x1,%ebx 353: 83 fb 0c cmp $0xc,%ebx 356: 74 50 je 3a8 <multilevelQueue+0x78> if(pid > 0) 358: 85 ff test %edi,%edi 35a: 7e f4 jle 350 <multilevelQueue+0x20> pid = fork(); 35c: e8 ee 03 00 00 call 74f <fork> if(pid > 0) 361: 83 f8 00 cmp $0x0,%eax pid = fork(); 364: 89 c7 mov %eax,%edi if(pid > 0) 366: 0f 8e 84 00 00 00 jle 3f0 <multilevelQueue+0xc0> if(i < NCHILD) 36c: 83 fb 03 cmp $0x3,%ebx 36f: 0f 8e cb 00 00 00 jle 440 <multilevelQueue+0x110> else if( i < NCHILD * 2) 375: 83 fb 07 cmp $0x7,%ebx 378: 0f 8f ea 00 00 00 jg 468 <multilevelQueue+0x138> set_sched_queue(SJF, pid); 37e: 83 ec 08 sub $0x8,%esp 381: 50 push %eax 382: 6a 02 push $0x2 384: e8 96 04 00 00 call 81f <set_sched_queue> set_burst_time(NCHILD * 5 - i, pid); 389: 59 pop %ecx 38a: 58 pop %eax 38b: 89 f0 mov %esi,%eax 38d: 57 push %edi 38e: 29 d8 sub %ebx,%eax for(i = 0; i < 3 * NCHILD; i++) 390: 83 c3 01 add $0x1,%ebx set_burst_time(NCHILD * 5 - i, pid); 393: 50 push %eax 394: e8 6e 04 00 00 call 807 <set_burst_time> 399: 83 c4 10 add $0x10,%esp for(i = 0; i < 3 * NCHILD; i++) 39c: 83 fb 0c cmp $0xc,%ebx 39f: 75 b7 jne 358 <multilevelQueue+0x28> 3a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } } } if(pid < 0) 3a8: 85 ff test %edi,%edi 3aa: 0f 88 00 01 00 00 js 4b0 <multilevelQueue+0x180> { printf(2, "fork error\n"); } else if(pid == 0 && (queue == LOTTERY || queue == SJF)) 3b0: 74 4d je 3ff <multilevelQueue+0xcf> { printf(1, "IO bound process with pid %d finished\n", getpid()); } else { show_processes_scheduling(); 3b2: bb 0c 00 00 00 mov $0xc,%ebx 3b7: e8 6b 04 00 00 call 827 <show_processes_scheduling> 3bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi int i; for(i = 0; i < NCHILD * 3 ; i++) wait(); 3c0: e8 9a 03 00 00 call 75f <wait> for(i = 0; i < NCHILD * 3 ; i++) 3c5: 83 eb 01 sub $0x1,%ebx 3c8: 75 f6 jne 3c0 <multilevelQueue+0x90> printf(1, "main program with pid %d finished\n", getpid()); 3ca: e8 08 04 00 00 call 7d7 <getpid> 3cf: 83 ec 04 sub $0x4,%esp 3d2: 50 push %eax 3d3: 68 70 0c 00 00 push $0xc70 3d8: 6a 01 push $0x1 3da: e8 f1 04 00 00 call 8d0 <printf> 3df: 83 c4 10 add $0x10,%esp } 3e2: 8d 65 f4 lea -0xc(%ebp),%esp 3e5: 5b pop %ebx 3e6: 5e pop %esi 3e7: 5f pop %edi 3e8: 5d pop %ebp 3e9: c3 ret 3ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(pid == 0 ) 3f0: 0f 85 5a ff ff ff jne 350 <multilevelQueue+0x20> queue = i < NCHILD ? PRIORITY : i < NCHILD * 2 ? SJF : LOTTERY; 3f6: 83 fb 03 cmp $0x3,%ebx 3f9: 0f 8e 91 00 00 00 jle 490 <multilevelQueue+0x160> for(i = 0; i < 3 * NCHILD; i++) 3ff: bb 90 d0 03 00 mov $0x3d090,%ebx 404: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi delay(2000000000); 408: 83 ec 0c sub $0xc,%esp 40b: 68 00 94 35 77 push $0x77359400 410: e8 0b 03 00 00 call 720 <delay> for(i = 0 ; i < 250000 ; i++) 415: 83 c4 10 add $0x10,%esp 418: 83 eb 01 sub $0x1,%ebx 41b: 75 eb jne 408 <multilevelQueue+0xd8> printf(1, "pid %d finished\n", getpid()); 41d: e8 b5 03 00 00 call 7d7 <getpid> 422: 83 ec 04 sub $0x4,%esp 425: 50 push %eax 426: 68 38 0c 00 00 push $0xc38 42b: 6a 01 push $0x1 42d: e8 9e 04 00 00 call 8d0 <printf> { 432: 83 c4 10 add $0x10,%esp 435: 8d 65 f4 lea -0xc(%ebp),%esp 438: 5b pop %ebx 439: 5e pop %esi 43a: 5f pop %edi 43b: 5d pop %ebp 43c: c3 ret 43d: 8d 76 00 lea 0x0(%esi),%esi set_sched_queue(PRIORITY, pid); 440: 83 ec 08 sub $0x8,%esp 443: 50 push %eax 444: 6a 01 push $0x1 446: e8 d4 03 00 00 call 81f <set_sched_queue> set_priority(NCHILD * 3 - i, pid); 44b: 58 pop %eax 44c: b8 0c 00 00 00 mov $0xc,%eax 451: 5a pop %edx 452: 29 d8 sub %ebx,%eax 454: 57 push %edi 455: 50 push %eax 456: e8 b4 03 00 00 call 80f <set_priority> 45b: 83 c4 10 add $0x10,%esp 45e: e9 ed fe ff ff jmp 350 <multilevelQueue+0x20> 463: 90 nop 464: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi set_sched_queue(LOTTERY, pid); 468: 83 ec 08 sub $0x8,%esp 46b: 50 push %eax 46c: 6a 03 push $0x3 46e: e8 ac 03 00 00 call 81f <set_sched_queue> set_lottery_ticket(NCHILD * 4 - i, pid); 473: 58 pop %eax 474: b8 10 00 00 00 mov $0x10,%eax 479: 5a pop %edx 47a: 29 d8 sub %ebx,%eax 47c: 57 push %edi 47d: 50 push %eax 47e: e8 94 03 00 00 call 817 <set_lottery_ticket> 483: 83 c4 10 add $0x10,%esp 486: e9 c5 fe ff ff jmp 350 <multilevelQueue+0x20> 48b: 90 nop 48c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi printf(1, "IO bound process with pid %d finished\n", getpid()); 490: e8 42 03 00 00 call 7d7 <getpid> 495: 83 ec 04 sub $0x4,%esp 498: 50 push %eax 499: 68 94 0c 00 00 push $0xc94 49e: 6a 01 push $0x1 4a0: e8 2b 04 00 00 call 8d0 <printf> 4a5: 83 c4 10 add $0x10,%esp 4a8: 8d 65 f4 lea -0xc(%ebp),%esp 4ab: 5b pop %ebx 4ac: 5e pop %esi 4ad: 5f pop %edi 4ae: 5d pop %ebp 4af: c3 ret printf(2, "fork error\n"); 4b0: 83 ec 08 sub $0x8,%esp 4b3: 68 28 0c 00 00 push $0xc28 4b8: 6a 02 push $0x2 4ba: e8 11 04 00 00 call 8d0 <printf> 4bf: 83 c4 10 add $0x10,%esp 4c2: 8d 65 f4 lea -0xc(%ebp),%esp 4c5: 5b pop %ebx 4c6: 5e pop %esi 4c7: 5f pop %edi 4c8: 5d pop %ebp 4c9: c3 ret 4ca: 66 90 xchg %ax,%ax 4cc: 66 90 xchg %ax,%ax 4ce: 66 90 xchg %ax,%ax 000004d0 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 4d0: 55 push %ebp 4d1: 89 e5 mov %esp,%ebp 4d3: 53 push %ebx 4d4: 8b 45 08 mov 0x8(%ebp),%eax 4d7: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 4da: 89 c2 mov %eax,%edx 4dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 4e0: 83 c1 01 add $0x1,%ecx 4e3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 4e7: 83 c2 01 add $0x1,%edx 4ea: 84 db test %bl,%bl 4ec: 88 5a ff mov %bl,-0x1(%edx) 4ef: 75 ef jne 4e0 <strcpy+0x10> ; return os; } 4f1: 5b pop %ebx 4f2: 5d pop %ebp 4f3: c3 ret 4f4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 4fa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000500 <strcmp>: int strcmp(const char *p, const char *q) { 500: 55 push %ebp 501: 89 e5 mov %esp,%ebp 503: 53 push %ebx 504: 8b 55 08 mov 0x8(%ebp),%edx 507: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 50a: 0f b6 02 movzbl (%edx),%eax 50d: 0f b6 19 movzbl (%ecx),%ebx 510: 84 c0 test %al,%al 512: 75 1c jne 530 <strcmp+0x30> 514: eb 2a jmp 540 <strcmp+0x40> 516: 8d 76 00 lea 0x0(%esi),%esi 519: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 520: 83 c2 01 add $0x1,%edx while(*p && *p == *q) 523: 0f b6 02 movzbl (%edx),%eax p++, q++; 526: 83 c1 01 add $0x1,%ecx 529: 0f b6 19 movzbl (%ecx),%ebx while(*p && *p == *q) 52c: 84 c0 test %al,%al 52e: 74 10 je 540 <strcmp+0x40> 530: 38 d8 cmp %bl,%al 532: 74 ec je 520 <strcmp+0x20> return (uchar)*p - (uchar)*q; 534: 29 d8 sub %ebx,%eax } 536: 5b pop %ebx 537: 5d pop %ebp 538: c3 ret 539: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 540: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; 542: 29 d8 sub %ebx,%eax } 544: 5b pop %ebx 545: 5d pop %ebp 546: c3 ret 547: 89 f6 mov %esi,%esi 549: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000550 <strlen>: uint strlen(const char *s) { 550: 55 push %ebp 551: 89 e5 mov %esp,%ebp 553: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 556: 80 39 00 cmpb $0x0,(%ecx) 559: 74 15 je 570 <strlen+0x20> 55b: 31 d2 xor %edx,%edx 55d: 8d 76 00 lea 0x0(%esi),%esi 560: 83 c2 01 add $0x1,%edx 563: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 567: 89 d0 mov %edx,%eax 569: 75 f5 jne 560 <strlen+0x10> ; return n; } 56b: 5d pop %ebp 56c: c3 ret 56d: 8d 76 00 lea 0x0(%esi),%esi for(n = 0; s[n]; n++) 570: 31 c0 xor %eax,%eax } 572: 5d pop %ebp 573: c3 ret 574: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 57a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000580 <memset>: void* memset(void *dst, int c, uint n) { 580: 55 push %ebp 581: 89 e5 mov %esp,%ebp 583: 57 push %edi 584: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 587: 8b 4d 10 mov 0x10(%ebp),%ecx 58a: 8b 45 0c mov 0xc(%ebp),%eax 58d: 89 d7 mov %edx,%edi 58f: fc cld 590: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 592: 89 d0 mov %edx,%eax 594: 5f pop %edi 595: 5d pop %ebp 596: c3 ret 597: 89 f6 mov %esi,%esi 599: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000005a0 <strchr>: char* strchr(const char *s, char c) { 5a0: 55 push %ebp 5a1: 89 e5 mov %esp,%ebp 5a3: 53 push %ebx 5a4: 8b 45 08 mov 0x8(%ebp),%eax 5a7: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 5aa: 0f b6 10 movzbl (%eax),%edx 5ad: 84 d2 test %dl,%dl 5af: 74 1d je 5ce <strchr+0x2e> if(*s == c) 5b1: 38 d3 cmp %dl,%bl 5b3: 89 d9 mov %ebx,%ecx 5b5: 75 0d jne 5c4 <strchr+0x24> 5b7: eb 17 jmp 5d0 <strchr+0x30> 5b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 5c0: 38 ca cmp %cl,%dl 5c2: 74 0c je 5d0 <strchr+0x30> for(; *s; s++) 5c4: 83 c0 01 add $0x1,%eax 5c7: 0f b6 10 movzbl (%eax),%edx 5ca: 84 d2 test %dl,%dl 5cc: 75 f2 jne 5c0 <strchr+0x20> return (char*)s; return 0; 5ce: 31 c0 xor %eax,%eax } 5d0: 5b pop %ebx 5d1: 5d pop %ebp 5d2: c3 ret 5d3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 5d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000005e0 <gets>: char* gets(char *buf, int max) { 5e0: 55 push %ebp 5e1: 89 e5 mov %esp,%ebp 5e3: 57 push %edi 5e4: 56 push %esi 5e5: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 5e6: 31 f6 xor %esi,%esi 5e8: 89 f3 mov %esi,%ebx { 5ea: 83 ec 1c sub $0x1c,%esp 5ed: 8b 7d 08 mov 0x8(%ebp),%edi for(i=0; i+1 < max; ){ 5f0: eb 2f jmp 621 <gets+0x41> 5f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cc = read(0, &c, 1); 5f8: 8d 45 e7 lea -0x19(%ebp),%eax 5fb: 83 ec 04 sub $0x4,%esp 5fe: 6a 01 push $0x1 600: 50 push %eax 601: 6a 00 push $0x0 603: e8 67 01 00 00 call 76f <read> if(cc < 1) 608: 83 c4 10 add $0x10,%esp 60b: 85 c0 test %eax,%eax 60d: 7e 1c jle 62b <gets+0x4b> break; buf[i++] = c; 60f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 613: 83 c7 01 add $0x1,%edi 616: 88 47 ff mov %al,-0x1(%edi) if(c == '\n' || c == '\r') 619: 3c 0a cmp $0xa,%al 61b: 74 23 je 640 <gets+0x60> 61d: 3c 0d cmp $0xd,%al 61f: 74 1f je 640 <gets+0x60> for(i=0; i+1 < max; ){ 621: 83 c3 01 add $0x1,%ebx 624: 3b 5d 0c cmp 0xc(%ebp),%ebx 627: 89 fe mov %edi,%esi 629: 7c cd jl 5f8 <gets+0x18> 62b: 89 f3 mov %esi,%ebx break; } buf[i] = '\0'; return buf; } 62d: 8b 45 08 mov 0x8(%ebp),%eax buf[i] = '\0'; 630: c6 03 00 movb $0x0,(%ebx) } 633: 8d 65 f4 lea -0xc(%ebp),%esp 636: 5b pop %ebx 637: 5e pop %esi 638: 5f pop %edi 639: 5d pop %ebp 63a: c3 ret 63b: 90 nop 63c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 640: 8b 75 08 mov 0x8(%ebp),%esi 643: 8b 45 08 mov 0x8(%ebp),%eax 646: 01 de add %ebx,%esi 648: 89 f3 mov %esi,%ebx buf[i] = '\0'; 64a: c6 03 00 movb $0x0,(%ebx) } 64d: 8d 65 f4 lea -0xc(%ebp),%esp 650: 5b pop %ebx 651: 5e pop %esi 652: 5f pop %edi 653: 5d pop %ebp 654: c3 ret 655: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 659: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000660 <stat>: int stat(const char *n, struct stat *st) { 660: 55 push %ebp 661: 89 e5 mov %esp,%ebp 663: 56 push %esi 664: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 665: 83 ec 08 sub $0x8,%esp 668: 6a 00 push $0x0 66a: ff 75 08 pushl 0x8(%ebp) 66d: e8 25 01 00 00 call 797 <open> if(fd < 0) 672: 83 c4 10 add $0x10,%esp 675: 85 c0 test %eax,%eax 677: 78 27 js 6a0 <stat+0x40> return -1; r = fstat(fd, st); 679: 83 ec 08 sub $0x8,%esp 67c: ff 75 0c pushl 0xc(%ebp) 67f: 89 c3 mov %eax,%ebx 681: 50 push %eax 682: e8 28 01 00 00 call 7af <fstat> close(fd); 687: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 68a: 89 c6 mov %eax,%esi close(fd); 68c: e8 ee 00 00 00 call 77f <close> return r; 691: 83 c4 10 add $0x10,%esp } 694: 8d 65 f8 lea -0x8(%ebp),%esp 697: 89 f0 mov %esi,%eax 699: 5b pop %ebx 69a: 5e pop %esi 69b: 5d pop %ebp 69c: c3 ret 69d: 8d 76 00 lea 0x0(%esi),%esi return -1; 6a0: be ff ff ff ff mov $0xffffffff,%esi 6a5: eb ed jmp 694 <stat+0x34> 6a7: 89 f6 mov %esi,%esi 6a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000006b0 <atoi>: int atoi(const char *s) { 6b0: 55 push %ebp 6b1: 89 e5 mov %esp,%ebp 6b3: 53 push %ebx 6b4: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 6b7: 0f be 11 movsbl (%ecx),%edx 6ba: 8d 42 d0 lea -0x30(%edx),%eax 6bd: 3c 09 cmp $0x9,%al n = 0; 6bf: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 6c4: 77 1f ja 6e5 <atoi+0x35> 6c6: 8d 76 00 lea 0x0(%esi),%esi 6c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 6d0: 8d 04 80 lea (%eax,%eax,4),%eax 6d3: 83 c1 01 add $0x1,%ecx 6d6: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax while('0' <= *s && *s <= '9') 6da: 0f be 11 movsbl (%ecx),%edx 6dd: 8d 5a d0 lea -0x30(%edx),%ebx 6e0: 80 fb 09 cmp $0x9,%bl 6e3: 76 eb jbe 6d0 <atoi+0x20> return n; } 6e5: 5b pop %ebx 6e6: 5d pop %ebp 6e7: c3 ret 6e8: 90 nop 6e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 000006f0 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 6f0: 55 push %ebp 6f1: 89 e5 mov %esp,%ebp 6f3: 56 push %esi 6f4: 53 push %ebx 6f5: 8b 5d 10 mov 0x10(%ebp),%ebx 6f8: 8b 45 08 mov 0x8(%ebp),%eax 6fb: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 6fe: 85 db test %ebx,%ebx 700: 7e 14 jle 716 <memmove+0x26> 702: 31 d2 xor %edx,%edx 704: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 708: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 70c: 88 0c 10 mov %cl,(%eax,%edx,1) 70f: 83 c2 01 add $0x1,%edx while(n-- > 0) 712: 39 d3 cmp %edx,%ebx 714: 75 f2 jne 708 <memmove+0x18> return vdst; } 716: 5b pop %ebx 717: 5e pop %esi 718: 5d pop %ebp 719: c3 ret 71a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 00000720 <delay>: void delay(int numberOfClocks) { 720: 55 push %ebp 721: 89 e5 mov %esp,%ebp 723: 53 push %ebx 724: 83 ec 04 sub $0x4,%esp int firstClock = uptime(); 727: e8 c3 00 00 00 call 7ef <uptime> 72c: 89 c3 mov %eax,%ebx int incClock = uptime(); 72e: e8 bc 00 00 00 call 7ef <uptime> while(incClock >= (firstClock + numberOfClocks) ) 733: 03 5d 08 add 0x8(%ebp),%ebx 736: 39 d8 cmp %ebx,%eax 738: 7c 0f jl 749 <delay+0x29> 73a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi { incClock = uptime(); 740: e8 aa 00 00 00 call 7ef <uptime> while(incClock >= (firstClock + numberOfClocks) ) 745: 39 d8 cmp %ebx,%eax 747: 7d f7 jge 740 <delay+0x20> } } 749: 83 c4 04 add $0x4,%esp 74c: 5b pop %ebx 74d: 5d pop %ebp 74e: c3 ret 0000074f <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 74f: b8 01 00 00 00 mov $0x1,%eax 754: cd 40 int $0x40 756: c3 ret 00000757 <exit>: SYSCALL(exit) 757: b8 02 00 00 00 mov $0x2,%eax 75c: cd 40 int $0x40 75e: c3 ret 0000075f <wait>: SYSCALL(wait) 75f: b8 03 00 00 00 mov $0x3,%eax 764: cd 40 int $0x40 766: c3 ret 00000767 <pipe>: SYSCALL(pipe) 767: b8 04 00 00 00 mov $0x4,%eax 76c: cd 40 int $0x40 76e: c3 ret 0000076f <read>: SYSCALL(read) 76f: b8 05 00 00 00 mov $0x5,%eax 774: cd 40 int $0x40 776: c3 ret 00000777 <write>: SYSCALL(write) 777: b8 10 00 00 00 mov $0x10,%eax 77c: cd 40 int $0x40 77e: c3 ret 0000077f <close>: SYSCALL(close) 77f: b8 15 00 00 00 mov $0x15,%eax 784: cd 40 int $0x40 786: c3 ret 00000787 <kill>: SYSCALL(kill) 787: b8 06 00 00 00 mov $0x6,%eax 78c: cd 40 int $0x40 78e: c3 ret 0000078f <exec>: SYSCALL(exec) 78f: b8 07 00 00 00 mov $0x7,%eax 794: cd 40 int $0x40 796: c3 ret 00000797 <open>: SYSCALL(open) 797: b8 0f 00 00 00 mov $0xf,%eax 79c: cd 40 int $0x40 79e: c3 ret 0000079f <mknod>: SYSCALL(mknod) 79f: b8 11 00 00 00 mov $0x11,%eax 7a4: cd 40 int $0x40 7a6: c3 ret 000007a7 <unlink>: SYSCALL(unlink) 7a7: b8 12 00 00 00 mov $0x12,%eax 7ac: cd 40 int $0x40 7ae: c3 ret 000007af <fstat>: SYSCALL(fstat) 7af: b8 08 00 00 00 mov $0x8,%eax 7b4: cd 40 int $0x40 7b6: c3 ret 000007b7 <link>: SYSCALL(link) 7b7: b8 13 00 00 00 mov $0x13,%eax 7bc: cd 40 int $0x40 7be: c3 ret 000007bf <mkdir>: SYSCALL(mkdir) 7bf: b8 14 00 00 00 mov $0x14,%eax 7c4: cd 40 int $0x40 7c6: c3 ret 000007c7 <chdir>: SYSCALL(chdir) 7c7: b8 09 00 00 00 mov $0x9,%eax 7cc: cd 40 int $0x40 7ce: c3 ret 000007cf <dup>: SYSCALL(dup) 7cf: b8 0a 00 00 00 mov $0xa,%eax 7d4: cd 40 int $0x40 7d6: c3 ret 000007d7 <getpid>: SYSCALL(getpid) 7d7: b8 0b 00 00 00 mov $0xb,%eax 7dc: cd 40 int $0x40 7de: c3 ret 000007df <sbrk>: SYSCALL(sbrk) 7df: b8 0c 00 00 00 mov $0xc,%eax 7e4: cd 40 int $0x40 7e6: c3 ret 000007e7 <sleep>: SYSCALL(sleep) 7e7: b8 0d 00 00 00 mov $0xd,%eax 7ec: cd 40 int $0x40 7ee: c3 ret 000007ef <uptime>: SYSCALL(uptime) 7ef: b8 0e 00 00 00 mov $0xe,%eax 7f4: cd 40 int $0x40 7f6: c3 ret 000007f7 <incNum>: SYSCALL(incNum) 7f7: b8 16 00 00 00 mov $0x16,%eax 7fc: cd 40 int $0x40 7fe: c3 ret 000007ff <getprocs>: SYSCALL(getprocs) 7ff: b8 17 00 00 00 mov $0x17,%eax 804: cd 40 int $0x40 806: c3 ret 00000807 <set_burst_time>: SYSCALL(set_burst_time) 807: b8 18 00 00 00 mov $0x18,%eax 80c: cd 40 int $0x40 80e: c3 ret 0000080f <set_priority>: SYSCALL(set_priority) 80f: b8 19 00 00 00 mov $0x19,%eax 814: cd 40 int $0x40 816: c3 ret 00000817 <set_lottery_ticket>: SYSCALL(set_lottery_ticket) 817: b8 1a 00 00 00 mov $0x1a,%eax 81c: cd 40 int $0x40 81e: c3 ret 0000081f <set_sched_queue>: SYSCALL(set_sched_queue) 81f: b8 1b 00 00 00 mov $0x1b,%eax 824: cd 40 int $0x40 826: c3 ret 00000827 <show_processes_scheduling>: SYSCALL(show_processes_scheduling) 827: b8 1c 00 00 00 mov $0x1c,%eax 82c: cd 40 int $0x40 82e: c3 ret 82f: 90 nop 00000830 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 830: 55 push %ebp 831: 89 e5 mov %esp,%ebp 833: 57 push %edi 834: 56 push %esi 835: 53 push %ebx 836: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 839: 85 d2 test %edx,%edx { 83b: 89 45 c0 mov %eax,-0x40(%ebp) neg = 1; x = -xx; 83e: 89 d0 mov %edx,%eax if(sgn && xx < 0){ 840: 79 76 jns 8b8 <printint+0x88> 842: f6 45 08 01 testb $0x1,0x8(%ebp) 846: 74 70 je 8b8 <printint+0x88> x = -xx; 848: f7 d8 neg %eax neg = 1; 84a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) } else { x = xx; } i = 0; 851: 31 f6 xor %esi,%esi 853: 8d 5d d7 lea -0x29(%ebp),%ebx 856: eb 0a jmp 862 <printint+0x32> 858: 90 nop 859: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi do{ buf[i++] = digits[x % base]; 860: 89 fe mov %edi,%esi 862: 31 d2 xor %edx,%edx 864: 8d 7e 01 lea 0x1(%esi),%edi 867: f7 f1 div %ecx 869: 0f b6 92 c4 0c 00 00 movzbl 0xcc4(%edx),%edx }while((x /= base) != 0); 870: 85 c0 test %eax,%eax buf[i++] = digits[x % base]; 872: 88 14 3b mov %dl,(%ebx,%edi,1) }while((x /= base) != 0); 875: 75 e9 jne 860 <printint+0x30> if(neg) 877: 8b 45 c4 mov -0x3c(%ebp),%eax 87a: 85 c0 test %eax,%eax 87c: 74 08 je 886 <printint+0x56> buf[i++] = '-'; 87e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1) 883: 8d 7e 02 lea 0x2(%esi),%edi 886: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi 88a: 8b 7d c0 mov -0x40(%ebp),%edi 88d: 8d 76 00 lea 0x0(%esi),%esi 890: 0f b6 06 movzbl (%esi),%eax write(fd, &c, 1); 893: 83 ec 04 sub $0x4,%esp 896: 83 ee 01 sub $0x1,%esi 899: 6a 01 push $0x1 89b: 53 push %ebx 89c: 57 push %edi 89d: 88 45 d7 mov %al,-0x29(%ebp) 8a0: e8 d2 fe ff ff call 777 <write> while(--i >= 0) 8a5: 83 c4 10 add $0x10,%esp 8a8: 39 de cmp %ebx,%esi 8aa: 75 e4 jne 890 <printint+0x60> putc(fd, buf[i]); } 8ac: 8d 65 f4 lea -0xc(%ebp),%esp 8af: 5b pop %ebx 8b0: 5e pop %esi 8b1: 5f pop %edi 8b2: 5d pop %ebp 8b3: c3 ret 8b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; 8b8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 8bf: eb 90 jmp 851 <printint+0x21> 8c1: eb 0d jmp 8d0 <printf> 8c3: 90 nop 8c4: 90 nop 8c5: 90 nop 8c6: 90 nop 8c7: 90 nop 8c8: 90 nop 8c9: 90 nop 8ca: 90 nop 8cb: 90 nop 8cc: 90 nop 8cd: 90 nop 8ce: 90 nop 8cf: 90 nop 000008d0 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 8d0: 55 push %ebp 8d1: 89 e5 mov %esp,%ebp 8d3: 57 push %edi 8d4: 56 push %esi 8d5: 53 push %ebx 8d6: 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++){ 8d9: 8b 75 0c mov 0xc(%ebp),%esi 8dc: 0f b6 1e movzbl (%esi),%ebx 8df: 84 db test %bl,%bl 8e1: 0f 84 b3 00 00 00 je 99a <printf+0xca> ap = (uint*)(void*)&fmt + 1; 8e7: 8d 45 10 lea 0x10(%ebp),%eax 8ea: 83 c6 01 add $0x1,%esi state = 0; 8ed: 31 ff xor %edi,%edi ap = (uint*)(void*)&fmt + 1; 8ef: 89 45 d4 mov %eax,-0x2c(%ebp) 8f2: eb 2f jmp 923 <printf+0x53> 8f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 8f8: 83 f8 25 cmp $0x25,%eax 8fb: 0f 84 a7 00 00 00 je 9a8 <printf+0xd8> write(fd, &c, 1); 901: 8d 45 e2 lea -0x1e(%ebp),%eax 904: 83 ec 04 sub $0x4,%esp 907: 88 5d e2 mov %bl,-0x1e(%ebp) 90a: 6a 01 push $0x1 90c: 50 push %eax 90d: ff 75 08 pushl 0x8(%ebp) 910: e8 62 fe ff ff call 777 <write> 915: 83 c4 10 add $0x10,%esp 918: 83 c6 01 add $0x1,%esi for(i = 0; fmt[i]; i++){ 91b: 0f b6 5e ff movzbl -0x1(%esi),%ebx 91f: 84 db test %bl,%bl 921: 74 77 je 99a <printf+0xca> if(state == 0){ 923: 85 ff test %edi,%edi c = fmt[i] & 0xff; 925: 0f be cb movsbl %bl,%ecx 928: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 92b: 74 cb je 8f8 <printf+0x28> state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 92d: 83 ff 25 cmp $0x25,%edi 930: 75 e6 jne 918 <printf+0x48> if(c == 'd'){ 932: 83 f8 64 cmp $0x64,%eax 935: 0f 84 05 01 00 00 je a40 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 93b: 81 e1 f7 00 00 00 and $0xf7,%ecx 941: 83 f9 70 cmp $0x70,%ecx 944: 74 72 je 9b8 <printf+0xe8> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 946: 83 f8 73 cmp $0x73,%eax 949: 0f 84 99 00 00 00 je 9e8 <printf+0x118> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 94f: 83 f8 63 cmp $0x63,%eax 952: 0f 84 08 01 00 00 je a60 <printf+0x190> putc(fd, *ap); ap++; } else if(c == '%'){ 958: 83 f8 25 cmp $0x25,%eax 95b: 0f 84 ef 00 00 00 je a50 <printf+0x180> write(fd, &c, 1); 961: 8d 45 e7 lea -0x19(%ebp),%eax 964: 83 ec 04 sub $0x4,%esp 967: c6 45 e7 25 movb $0x25,-0x19(%ebp) 96b: 6a 01 push $0x1 96d: 50 push %eax 96e: ff 75 08 pushl 0x8(%ebp) 971: e8 01 fe ff ff call 777 <write> 976: 83 c4 0c add $0xc,%esp 979: 8d 45 e6 lea -0x1a(%ebp),%eax 97c: 88 5d e6 mov %bl,-0x1a(%ebp) 97f: 6a 01 push $0x1 981: 50 push %eax 982: ff 75 08 pushl 0x8(%ebp) 985: 83 c6 01 add $0x1,%esi } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 988: 31 ff xor %edi,%edi write(fd, &c, 1); 98a: e8 e8 fd ff ff call 777 <write> for(i = 0; fmt[i]; i++){ 98f: 0f b6 5e ff movzbl -0x1(%esi),%ebx write(fd, &c, 1); 993: 83 c4 10 add $0x10,%esp for(i = 0; fmt[i]; i++){ 996: 84 db test %bl,%bl 998: 75 89 jne 923 <printf+0x53> } } } 99a: 8d 65 f4 lea -0xc(%ebp),%esp 99d: 5b pop %ebx 99e: 5e pop %esi 99f: 5f pop %edi 9a0: 5d pop %ebp 9a1: c3 ret 9a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi state = '%'; 9a8: bf 25 00 00 00 mov $0x25,%edi 9ad: e9 66 ff ff ff jmp 918 <printf+0x48> 9b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printint(fd, *ap, 16, 0); 9b8: 83 ec 0c sub $0xc,%esp 9bb: b9 10 00 00 00 mov $0x10,%ecx 9c0: 6a 00 push $0x0 9c2: 8b 7d d4 mov -0x2c(%ebp),%edi 9c5: 8b 45 08 mov 0x8(%ebp),%eax 9c8: 8b 17 mov (%edi),%edx 9ca: e8 61 fe ff ff call 830 <printint> ap++; 9cf: 89 f8 mov %edi,%eax 9d1: 83 c4 10 add $0x10,%esp state = 0; 9d4: 31 ff xor %edi,%edi ap++; 9d6: 83 c0 04 add $0x4,%eax 9d9: 89 45 d4 mov %eax,-0x2c(%ebp) 9dc: e9 37 ff ff ff jmp 918 <printf+0x48> 9e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi s = (char*)*ap; 9e8: 8b 45 d4 mov -0x2c(%ebp),%eax 9eb: 8b 08 mov (%eax),%ecx ap++; 9ed: 83 c0 04 add $0x4,%eax 9f0: 89 45 d4 mov %eax,-0x2c(%ebp) if(s == 0) 9f3: 85 c9 test %ecx,%ecx 9f5: 0f 84 8e 00 00 00 je a89 <printf+0x1b9> while(*s != 0){ 9fb: 0f b6 01 movzbl (%ecx),%eax state = 0; 9fe: 31 ff xor %edi,%edi s = (char*)*ap; a00: 89 cb mov %ecx,%ebx while(*s != 0){ a02: 84 c0 test %al,%al a04: 0f 84 0e ff ff ff je 918 <printf+0x48> a0a: 89 75 d0 mov %esi,-0x30(%ebp) a0d: 89 de mov %ebx,%esi a0f: 8b 5d 08 mov 0x8(%ebp),%ebx a12: 8d 7d e3 lea -0x1d(%ebp),%edi a15: 8d 76 00 lea 0x0(%esi),%esi write(fd, &c, 1); a18: 83 ec 04 sub $0x4,%esp s++; a1b: 83 c6 01 add $0x1,%esi a1e: 88 45 e3 mov %al,-0x1d(%ebp) write(fd, &c, 1); a21: 6a 01 push $0x1 a23: 57 push %edi a24: 53 push %ebx a25: e8 4d fd ff ff call 777 <write> while(*s != 0){ a2a: 0f b6 06 movzbl (%esi),%eax a2d: 83 c4 10 add $0x10,%esp a30: 84 c0 test %al,%al a32: 75 e4 jne a18 <printf+0x148> a34: 8b 75 d0 mov -0x30(%ebp),%esi state = 0; a37: 31 ff xor %edi,%edi a39: e9 da fe ff ff jmp 918 <printf+0x48> a3e: 66 90 xchg %ax,%ax printint(fd, *ap, 10, 1); a40: 83 ec 0c sub $0xc,%esp a43: b9 0a 00 00 00 mov $0xa,%ecx a48: 6a 01 push $0x1 a4a: e9 73 ff ff ff jmp 9c2 <printf+0xf2> a4f: 90 nop write(fd, &c, 1); a50: 83 ec 04 sub $0x4,%esp a53: 88 5d e5 mov %bl,-0x1b(%ebp) a56: 8d 45 e5 lea -0x1b(%ebp),%eax a59: 6a 01 push $0x1 a5b: e9 21 ff ff ff jmp 981 <printf+0xb1> putc(fd, *ap); a60: 8b 7d d4 mov -0x2c(%ebp),%edi write(fd, &c, 1); a63: 83 ec 04 sub $0x4,%esp putc(fd, *ap); a66: 8b 07 mov (%edi),%eax write(fd, &c, 1); a68: 6a 01 push $0x1 ap++; a6a: 83 c7 04 add $0x4,%edi putc(fd, *ap); a6d: 88 45 e4 mov %al,-0x1c(%ebp) write(fd, &c, 1); a70: 8d 45 e4 lea -0x1c(%ebp),%eax a73: 50 push %eax a74: ff 75 08 pushl 0x8(%ebp) a77: e8 fb fc ff ff call 777 <write> ap++; a7c: 89 7d d4 mov %edi,-0x2c(%ebp) a7f: 83 c4 10 add $0x10,%esp state = 0; a82: 31 ff xor %edi,%edi a84: e9 8f fe ff ff jmp 918 <printf+0x48> s = "(null)"; a89: bb bc 0c 00 00 mov $0xcbc,%ebx while(*s != 0){ a8e: b8 28 00 00 00 mov $0x28,%eax a93: e9 72 ff ff ff jmp a0a <printf+0x13a> a98: 66 90 xchg %ax,%ax a9a: 66 90 xchg %ax,%ax a9c: 66 90 xchg %ax,%ax a9e: 66 90 xchg %ax,%ax 00000aa0 <free>: static Header base; static Header *freep; void free(void *ap) { aa0: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) aa1: a1 cc 10 00 00 mov 0x10cc,%eax { aa6: 89 e5 mov %esp,%ebp aa8: 57 push %edi aa9: 56 push %esi aaa: 53 push %ebx aab: 8b 5d 08 mov 0x8(%ebp),%ebx bp = (Header*)ap - 1; aae: 8d 4b f8 lea -0x8(%ebx),%ecx ab1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) ab8: 39 c8 cmp %ecx,%eax aba: 8b 10 mov (%eax),%edx abc: 73 32 jae af0 <free+0x50> abe: 39 d1 cmp %edx,%ecx ac0: 72 04 jb ac6 <free+0x26> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) ac2: 39 d0 cmp %edx,%eax ac4: 72 32 jb af8 <free+0x58> break; if(bp + bp->s.size == p->s.ptr){ ac6: 8b 73 fc mov -0x4(%ebx),%esi ac9: 8d 3c f1 lea (%ecx,%esi,8),%edi acc: 39 fa cmp %edi,%edx ace: 74 30 je b00 <free+0x60> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; ad0: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ ad3: 8b 50 04 mov 0x4(%eax),%edx ad6: 8d 34 d0 lea (%eax,%edx,8),%esi ad9: 39 f1 cmp %esi,%ecx adb: 74 3a je b17 <free+0x77> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; add: 89 08 mov %ecx,(%eax) freep = p; adf: a3 cc 10 00 00 mov %eax,0x10cc } ae4: 5b pop %ebx ae5: 5e pop %esi ae6: 5f pop %edi ae7: 5d pop %ebp ae8: c3 ret ae9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) af0: 39 d0 cmp %edx,%eax af2: 72 04 jb af8 <free+0x58> af4: 39 d1 cmp %edx,%ecx af6: 72 ce jb ac6 <free+0x26> { af8: 89 d0 mov %edx,%eax afa: eb bc jmp ab8 <free+0x18> afc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp->s.size += p->s.ptr->s.size; b00: 03 72 04 add 0x4(%edx),%esi b03: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; b06: 8b 10 mov (%eax),%edx b08: 8b 12 mov (%edx),%edx b0a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ b0d: 8b 50 04 mov 0x4(%eax),%edx b10: 8d 34 d0 lea (%eax,%edx,8),%esi b13: 39 f1 cmp %esi,%ecx b15: 75 c6 jne add <free+0x3d> p->s.size += bp->s.size; b17: 03 53 fc add -0x4(%ebx),%edx freep = p; b1a: a3 cc 10 00 00 mov %eax,0x10cc p->s.size += bp->s.size; b1f: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; b22: 8b 53 f8 mov -0x8(%ebx),%edx b25: 89 10 mov %edx,(%eax) } b27: 5b pop %ebx b28: 5e pop %esi b29: 5f pop %edi b2a: 5d pop %ebp b2b: c3 ret b2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000b30 <malloc>: return freep; } void* malloc(uint nbytes) { b30: 55 push %ebp b31: 89 e5 mov %esp,%ebp b33: 57 push %edi b34: 56 push %esi b35: 53 push %ebx b36: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; b39: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ b3c: 8b 15 cc 10 00 00 mov 0x10cc,%edx nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; b42: 8d 78 07 lea 0x7(%eax),%edi b45: c1 ef 03 shr $0x3,%edi b48: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ b4b: 85 d2 test %edx,%edx b4d: 0f 84 9d 00 00 00 je bf0 <malloc+0xc0> b53: 8b 02 mov (%edx),%eax b55: 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){ b58: 39 cf cmp %ecx,%edi b5a: 76 6c jbe bc8 <malloc+0x98> b5c: 81 ff 00 10 00 00 cmp $0x1000,%edi b62: bb 00 10 00 00 mov $0x1000,%ebx b67: 0f 43 df cmovae %edi,%ebx p = sbrk(nu * sizeof(Header)); b6a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi b71: eb 0e jmp b81 <malloc+0x51> b73: 90 nop b74: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ b78: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ b7a: 8b 48 04 mov 0x4(%eax),%ecx b7d: 39 f9 cmp %edi,%ecx b7f: 73 47 jae bc8 <malloc+0x98> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) b81: 39 05 cc 10 00 00 cmp %eax,0x10cc b87: 89 c2 mov %eax,%edx b89: 75 ed jne b78 <malloc+0x48> p = sbrk(nu * sizeof(Header)); b8b: 83 ec 0c sub $0xc,%esp b8e: 56 push %esi b8f: e8 4b fc ff ff call 7df <sbrk> if(p == (char*)-1) b94: 83 c4 10 add $0x10,%esp b97: 83 f8 ff cmp $0xffffffff,%eax b9a: 74 1c je bb8 <malloc+0x88> hp->s.size = nu; b9c: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); b9f: 83 ec 0c sub $0xc,%esp ba2: 83 c0 08 add $0x8,%eax ba5: 50 push %eax ba6: e8 f5 fe ff ff call aa0 <free> return freep; bab: 8b 15 cc 10 00 00 mov 0x10cc,%edx if((p = morecore(nunits)) == 0) bb1: 83 c4 10 add $0x10,%esp bb4: 85 d2 test %edx,%edx bb6: 75 c0 jne b78 <malloc+0x48> return 0; } } bb8: 8d 65 f4 lea -0xc(%ebp),%esp return 0; bbb: 31 c0 xor %eax,%eax } bbd: 5b pop %ebx bbe: 5e pop %esi bbf: 5f pop %edi bc0: 5d pop %ebp bc1: c3 ret bc2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(p->s.size == nunits) bc8: 39 cf cmp %ecx,%edi bca: 74 54 je c20 <malloc+0xf0> p->s.size -= nunits; bcc: 29 f9 sub %edi,%ecx bce: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; bd1: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; bd4: 89 78 04 mov %edi,0x4(%eax) freep = prevp; bd7: 89 15 cc 10 00 00 mov %edx,0x10cc } bdd: 8d 65 f4 lea -0xc(%ebp),%esp return (void*)(p + 1); be0: 83 c0 08 add $0x8,%eax } be3: 5b pop %ebx be4: 5e pop %esi be5: 5f pop %edi be6: 5d pop %ebp be7: c3 ret be8: 90 nop be9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; bf0: c7 05 cc 10 00 00 d0 movl $0x10d0,0x10cc bf7: 10 00 00 bfa: c7 05 d0 10 00 00 d0 movl $0x10d0,0x10d0 c01: 10 00 00 base.s.size = 0; c04: b8 d0 10 00 00 mov $0x10d0,%eax c09: c7 05 d4 10 00 00 00 movl $0x0,0x10d4 c10: 00 00 00 c13: e9 44 ff ff ff jmp b5c <malloc+0x2c> c18: 90 nop c19: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi prevp->s.ptr = p->s.ptr; c20: 8b 08 mov (%eax),%ecx c22: 89 0a mov %ecx,(%edx) c24: eb b1 jmp bd7 <malloc+0xa7>
sw/test_cases/xor1.asm
JPShen-UWM/ThreadKraken
1
98880
<reponame>JPShen-UWM/ThreadKraken lbi r21 0xF0 lbi r22 0x0F xor r23 r21 r22 kill r0
src/asis/asis-compilation_units.ads
My-Colaborations/dynamo
15
22726
<filename>src/asis/asis-compilation_units.ads ------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT INTERFACE COMPONENTS -- -- -- -- A S I S . C O M P I L A T I O N _ U N I T S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2006-2010, Free Software Foundation, Inc. -- -- -- -- This specification is adapted from the Ada Semantic Interface -- -- Specification Standard (ISO/IEC 15291) for use with GNAT. In accordance -- -- with the copyright of that document, you can freely copy and modify this -- -- specification, provided that if you redistribute a modified version, any -- -- changes that you have made are clearly indicated. -- -- -- -- This specification also contains suggestions and discussion items -- -- related to revising the ASIS Standard according to the changes proposed -- -- for the new revision of the Ada standard. The copyright notice above, -- -- and the license provisions that follow apply solely to these suggestions -- -- and discussion items that are separated by the corresponding comment -- -- sentinels -- -- -- -- ASIS-for-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 -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. ASIS-for-GNAT is distributed in the hope that it will be use- -- -- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- -- -- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -- -- Public License for more details. You should have received a copy of the -- -- GNU General Public License distributed with ASIS-for-GNAT; see file -- -- COPYING. If not, write to the Free Software Foundation, 51 Franklin -- -- Street, Fifth Floor, Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the -- -- Software Engineering Laboratory of the Swiss Federal Institute of -- -- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the -- -- Scientific Research Computer Center of Moscow State University (SRCC -- -- MSU), Russia, with funding partially provided by grants from the Swiss -- -- National Science Foundation and the Swiss Academy of Engineering -- -- Sciences. ASIS-for-GNAT is now maintained by AdaCore -- -- (http://www.adacore.com). -- -- -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 10 package Asis.Compilation_Units -- Suggestions related to changing this specification to accept new Ada -- features as defined in incoming revision of the Ada Standard (ISO 8652) -- are marked by following comment sentinels: -- -- --|A2005 start -- ... the suggestion goes here ... -- --|A2005 end -- -- and the discussion items are marked by the comment sentinels of the form: -- -- --|D2005 start -- ... the discussion item goes here ... -- --|D2005 end ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Asis.Ada_Environments.Containers; package Asis.Compilation_Units is ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Asis.Compilation_Units encapsulates a set of queries that implement the -- ASIS Compilation_Unit abstraction. -- -- More than one compilation unit may be manipulated at one time. (The exact -- number is subject to implementation specific limitations.) -- -- A specific Compilation_Unit value is valid (usable) for as long as the ASIS -- Context variable, used to create it, remains open. Once an ASIS Context is -- closed, all associated Compilation_Unit values become invalid. It is -- erroneous to use an invalid Compilation_Unit value. -- ------------------------------------------------------------------------------ -- 10.1 function Unit_Kind ------------------------------------------------------------------------------ function Unit_Kind (Compilation_Unit : Asis.Compilation_Unit) return Asis.Unit_Kinds; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the compilation unit to query -- -- Returns the Unit_Kinds value of the compilation unit. -- Returns Not_A_Unit for a Nil_Compilation_Unit. -- -- All Unit_Kinds are expected. -- -- Returns An_Unknown_Unit for any compilation unit that exists, but that -- does not have semantic element information available through ASIS. -- -- Returns a nonexistent kind for units that have name-only entries in the -- environment Context. Such entries may exist for names because: -- -- - They represent an illegal compilation unit added to the environment. -- -- - They are referenced by some existing unit, but the program text for the -- referenced unit has never been supplied, compiled, or otherwise -- inserted into the environment. -- -- - They represent a separate subunit that has never been supplied, -- compiled, or otherwise inserted into the environment. -- -- - The unit may have existed at one time but the semantic information is no -- longer available. It may be inconsistent, have been removed by some -- user or Ada environment operations, or simply have been lost as the -- result of some sort of failure. -- ------------------------------------------------------------------------------ -- 10.2 function Unit_Class ------------------------------------------------------------------------------ function Unit_Class (Compilation_Unit : Asis.Compilation_Unit) return Asis.Unit_Classes; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the compilation unit to query -- -- Returns the Unit_Classes value of the compilation unit. -- Returns Not_A_Class for a Nil_Compilation_Unit. -- -- All Unit_Kinds are expected. -- ------------------------------------------------------------------------------ -- 10.3 function Unit_Origin ------------------------------------------------------------------------------ function Unit_Origin (Compilation_Unit : Asis.Compilation_Unit) return Asis.Unit_Origins; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the compilation unit to query -- -- Returns the Unit_Origins value of the unit. -- Returns Not_An_Origin for a compilation_unit whose Unit_Kind is -- Not_A_Unit, An_Unknown_Unit, A_Nonexistent_Declaration, or -- A_Nonexistent_Body. -- -- All Unit_Kinds are expected. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 10.4 function Enclosing_Context ------------------------------------------------------------------------------ function Enclosing_Context (Compilation_Unit : Asis.Compilation_Unit) return Asis.Context; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose Context is required -- -- Returns the Context containing the compilation unit. -- -- Compilation units always remember the ASIS Context and Container from -- which they were obtained. -- -- Because Context is limited private, this function is only intended to be -- used to supply a Context parameter for other queries. This conveniently -- eliminates the need to make the original Context visible at the place of -- each call where a Context parameter is required. -- -- Two Compilation_Unit values, that represent the same physical compilation -- units (same Ada implementor Context implementation unit value) will test as -- Is_Equal, but not Is_Identical, if they were obtained from different open -- ASIS Context variables. -- -- Raises ASIS_Inappropriate_Compilation_Unit if the unit is a -- Nil_Compilation_Unit. -- ------------------------------------------------------------------------------ -- 10.5 function Enclosing_Container ------------------------------------------------------------------------------ function Enclosing_Container (Compilation_Unit : Asis.Compilation_Unit) return Asis.Ada_Environments.Containers.Container; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose Container is required -- -- Returns the Container of the Context containing the compilation unit. -- Compilation units always remember the ASIS Context and Container from -- which they were obtained. -- -- Raises ASIS_Inappropriate_Compilation_Unit if the unit is a -- Nil_Compilation_Unit. -- ------------------------------------------------------------------------------ -- 10.6 function Library_Unit_Declaration ------------------------------------------------------------------------------ function Library_Unit_Declaration (Name : Wide_String; The_Context : Asis.Context) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Name - Specifies the defining program unit name -- The_Context - Specifies a program Context environment -- -- Returns the library_unit_declaration or library_unit_renaming_declaration -- with the name, contained in The_Context. -- -- This query will never return a unit with A_Configuration_Compilation or -- a nonexistent unit kind. It will never return a unit with A_Procedure_Body -- or A_Function_Body unit kind even though the unit is interpreted as both -- the declaration and body of a library procedure or library function. -- (Reference Manual 10.1.4(4). -- -- A Nil_Compilation_Unit is returned if no such declaration exists. -- -- Any non-Nil result will have an Enclosing_Context value that Is_Identical -- to the Context. Never returns a unit with a nonexistent unit kind. -- ------------------------------------------------------------------------------ -- 10.7 function Compilation_Unit_Body ------------------------------------------------------------------------------ function Compilation_Unit_Body (Name : Wide_String; The_Context : Asis.Context) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Name - Specifies the defining_program_unit_name -- The_Context - Specifies a program Context environment -- -- Returns the library_unit_body or subunit with the name, contained -- in the library. -- -- A Nil_Compilation_Unit is returned if no such body exists. -- -- Any non-Nil result will have an Enclosing_Context value that Is_Identical -- to The_Context. Never returns a unit with a nonexistent unit kind. -- ------------------------------------------------------------------------------ -- 10.8 function Library_Unit_Declarations ------------------------------------------------------------------------------ function Library_Unit_Declarations (The_Context : Asis.Context) return Asis.Compilation_Unit_List; ------------------------------------------------------------------------------ -- The_Context - Specifies a program Context environment -- -- Returns a list of all library_unit_declaration and -- library_unit_renaming_declaration elements contained in The_Context. -- Individual units will appear only once in an order that is not defined. -- -- A Nil_Compilation_Unit_List is returned if there are no declarations of -- library units within The_Context. -- -- This query will never return a unit with A_Configuration_Compilation or -- a nonexistent unit kind. It will never return a unit with A_Procedure_Body -- or A_Function_Body unit kind even though the unit is interpreted as both -- the declaration and body of a library procedure or library function. -- (Reference Manual 10.1.4(4). -- -- All units in the result will have an Enclosing_Context value that -- Is_Identical to The_Context. -- ------------------------------------------------------------------------------ -- 10.9 function Compilation_Unit_Bodies ------------------------------------------------------------------------------ function Compilation_Unit_Bodies (The_Context : Asis.Context) return Asis.Compilation_Unit_List; ------------------------------------------------------------------------------ -- The_Context - Specifies a program Context environment -- -- Returns a list of all library_unit_body and subunit elements contained in -- The_Context. Individual units will appear only once in an order that is not -- defined. -- -- A Nil_Compilation_Unit_List is returned if there are no bodies within -- The_Context. -- -- This query will never return a unit with A_Configuration_Compilation or -- a nonexistent unit kind. -- -- All units in the result will have an Enclosing_Context value that -- Is_Identical to The_Context. -- ------------------------------------------------------------------------------ -- 10.10 function Compilation_Units ------------------------------------------------------------------------------ function Compilation_Units (The_Context : Asis.Context) return Asis.Compilation_Unit_List; ------------------------------------------------------------------------------ -- The_Context - Specifies a program Context environment -- -- Returns a list of all compilation units contained in The_Context. -- Individual units will appear only once in an order that is not defined. -- -- A Nil_Compilation_Unit_List is returned if there are no units within -- The_Context. -- -- This query will never return a unit with A_Configuration_Compilation or -- a nonexistent unit kind. -- -- All units in the result will have an Enclosing_Context value that -- Is_Identical to The_Context. -- ------------------------------------------------------------------------------ -- 10.11 function Corresponding_Children ------------------------------------------------------------------------------ function Corresponding_Children (Library_Unit : Asis.Compilation_Unit) return Asis.Compilation_Unit_List; function Corresponding_Children (Library_Unit : Asis.Compilation_Unit; The_Context : Asis.Context) return Asis.Compilation_Unit_List; ------------------------------------------------------------------------------ -- Library_Unit - Specifies the library unit whose children are desired -- The_Context - Specifies a program Context environment -- -- Returns a list of the child units for the given parent library unit. -- -- Both the declaration and body (if any) of each child unit are returned. -- Descendants beyond immediate children (i.e., children of children) are not -- returned by this query. -- -- Use the compilation unit relationship queries -- with a Relation_Kinds of Descendants to create a list of children, children -- of children, and so on. -- -- Returns a Nil_Compilation_Unit_List for all library unit arguments that -- do not have any child units contained in The_Context. -- -- These two function calls will always produce identical results: -- -- Units := Corresponding_Children ( Unit ); -- Units := Corresponding_Children ( Unit, Enclosing_Context ( Unit )); -- -- Any non-Nil result will have an Enclosing_Context value that Is_Identical -- to The_Context. -- -- The Enclosing_Context for any non-Nil result will always be The_Context, -- regardless of the Enclosing_Context value for the Library_Unit argument. -- This query is one means of obtaining (Is_Equal) child units -- from separate ASIS Context values whose underlying implementations -- overlap. -- -- Appropriate Unit_Kinds: -- A_Package -- A_Generic_Package -- A_Package_Instance -- -- Returns Unit_Kinds: -- A_Procedure -- A_Function -- A_Package -- A_Generic_Procedure -- A_Generic_Function -- A_Generic_Package -- A_Procedure_Instance -- A_Function_Instance -- A_Package_Instance -- A_Procedure_Renaming -- A_Function_Renaming -- A_Package_Renaming -- A_Generic_Procedure_Renaming -- A_Generic_Function_Renaming -- A_Generic_Package_Renaming -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- An_Unknown_Unit -- -- If the declaration of a child is inconsistent with the argument of the -- query, neither the declaration nor the body is returned. If the -- declaration of a child is consistent with the argument, but the body -- is not, the declaration is returned, and for the body, the result of -- the Corresponding_Body query applied to the declaration is returned. -- ------------------------------------------------------------------------------ -- 10.12 function Corresponding_Parent_Declaration ------------------------------------------------------------------------------ function Corresponding_Parent_Declaration (Library_Unit : Asis.Compilation_Unit) return Asis.Compilation_Unit; function Corresponding_Parent_Declaration (Library_Unit : Asis.Compilation_Unit; The_Context : Asis.Context) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Library_Unit - Specifies the unit whose parent is desired -- The_Context - Specifies a program Context environment -- -- Returns the parent unit of the given library unit. -- -- Returns a Nil_Compilation_Unit if the Library_Unit argument represents -- package Standard. Root Library_Unit arguments return the package Standard. -- -- Returns A_Nonexistent_Declaration when the Library_Unit has a -- parent_unit_name denoted in the defining_program_unit_name but the parent -- unit is not contained in The_Context. -- -- These two function calls will always produce identical results: -- -- Unit := Corresponding_Parent_Declaration (Unit); -- Unit := Corresponding_Parent_Declaration (Unit, Enclosing_Context (Unit)); -- -- Any non-Nil result will have an Enclosing_Context value that Is_Identical -- to The_Context. -- -- The Enclosing_Context for any non-Nil result will always be The_Context, -- regardless of the Enclosing_Context value for the Library_Unit -- argument. This query is one means of obtaining (Is_Equal) parent units -- from separate ASIS Context values whose underlying implementations -- overlap. -- -- Appropriate Unit_Kinds: -- A_Procedure -- A_Function -- A_Package -- A_Generic_Procedure -- A_Generic_Function -- A_Generic_Package -- A_Procedure_Instance -- A_Function_Instance -- A_Package_Instance -- A_Procedure_Renaming -- A_Function_Renaming -- A_Package_Renaming -- A_Generic_Procedure_Renaming -- A_Generic_Function_Renaming -- A_Generic_Package_Renaming -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- -- Returns Unit_Kinds: -- Not_A_Unit -- A_Package -- A_Generic_Package -- A_Package_Instance -- A_Nonexistent_Declaration -- An_Unknown_Unit -- -- If a parent is inconsistent with a child passed as the argument, -- A_Nonexistent_Declaration shall be returned. -- ------------------------------------------------------------------------------ -- 10.13 function Corresponding_Declaration ------------------------------------------------------------------------------ function Corresponding_Declaration (Library_Item : Asis.Compilation_Unit) return Asis.Compilation_Unit; function Corresponding_Declaration (Library_Item : Asis.Compilation_Unit; The_Context : Asis.Context) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Library_Item - Specifies the library_item whose declaration is desired -- The_Context - Specifies a program Context environment -- -- Returns the corresponding library_unit_declaration, if any, for the -- library_unit_body. The corresponding library unit is the unit upon which -- the library_unit_body depends semantically. -- -- Returns a unit that Is_Equal to the argument if: -- -- - the argument is a library_unit_declaration, -- a library_unit_renaming_declaration, or a subunit. -- -- - the argument is A_Nonexistent_Declaration or A_Nonexistent_Body. -- -- Returns a Nil_Compilation_Unit for library_unit_body arguments that do -- not have a corresponding library unit contained in The_Context. -- -- All Unit_Kinds are appropriate except Not_A_Unit. -- -- Appropriate Unit_Kinds: -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- An_Unknown_Unit -- See Implementation Permissions -- -- Appropriate Unit_Kinds returning the argument Library_Item: -- A_Procedure -- A_Function -- A_Package -- A_Generic_Procedure -- A_Generic_Function -- A_Generic_Package -- A_Procedure_Instance -- A_Function_Instance -- A_Package_Instance -- A_Procedure_Renaming -- A_Function_Renaming -- A_Package_Renaming -- A_Generic_Procedure_Renaming -- A_Generic_Function_Renaming -- A_Generic_Package_Renaming -- A_Procedure_Body_Subunit -- A_Function_Body_Subunit -- A_Package_Body_Subunit -- A_Task_Body_Subunit -- A_Protected_Body_Subunit -- A_Nonexistent_Declaration -- A_Nonexistent_Body -- -- Returns all Unit Kinds. -- -- If the declaration of an argument Element is inconsistent with the -- argument, A_Nonexistent_Declaration shall be returned. (For a unit -- A_Procedure_Body or A_Function_Body kind, the solution may be in any -- case, to return Nil_Compilation_Unit if the unit is of -- A_Public_Declaration_And_Body kind.) -- -- --|IR Implementation Requirements: -- --|IR -- --|IR Any non-Nil result will have an Enclosing_Context value that -- --|IR Is_Identical to The_Context. -- --|IR -- --|IR These two function calls will always produce identical results: -- --|IR -- --|IR Unit := Corresponding_Declaration (Unit); -- --|IR Unit := Corresponding_Declaration (Unit, Enclosing_Context (Unit)); -- --|IR -- --|IR The Enclosing_Context for any non-Nil result will always be -- --|IR The_Context, regardless of the Enclosing_Context value for the -- --|IR Library_Item argument. This query is one means of obtaining -- --|IR corresponding (Is_Equal) units from separate ASIS Context values -- --|IR whose underlying implementations overlap. -- --|IR -- --|IP Implementation Permissions: -- --|IP -- --|IP The handling of An_Unknown_Unit is implementation specific. The -- --|IP expected use for An_Unknown_Unit is to hide proprietary -- --|IP implementation details contained within unit bodies. In these cases, -- --|IP it should be possible to obtain an appropriate -- --|IP library_unit_declaration when starting with An_Unknown_Unit. Some -- --|IP implementors may choose to simply return the An_Unknown_Unit argument -- --|IP in all cases. ------------------------------------------------------------------------------ -- 10.14 function Corresponding_Body ------------------------------------------------------------------------------ function Corresponding_Body (Library_Item : Asis.Compilation_Unit) return Asis.Compilation_Unit; function Corresponding_Body (Library_Item : Asis.Compilation_Unit; The_Context : Asis.Context) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Library_Item - Specifies the library_item whose body is desired -- The_Context - Specifies a program Context environment -- -- Returns the corresponding library_unit_body, if any, for the -- library_unit_declaration. The corresponding library_unit_body is the unit -- that depends semantically on the library_unit_declaration. -- -- Returns a unit that Is_Equal to the argument if: -- -- - the argument is a an instance of a library_unit_declaration, -- a library_unit_body, a library_unit_renaming_declaration, or a subunit. -- -- - the argument is A_Nonexistent_Declaration or A_Nonexistent_Body. -- -- Returns a Nil_Compilation_Unit for library_unit_declaration arguments that -- do not have a corresponding library_unit_body contained in The_Context. -- -- All Unit_Kinds are appropriate except Not_A_Unit. -- -- Appropriate Unit_Kinds: -- A_Procedure -- A_Function -- A_Package -- A_Generic_Procedure -- A_Generic_Function -- A_Generic_Package -- An_Unknown_Unit -- See Implementation Permissions -- -- Appropriate Unit_Kinds returning the argument Library_Item: -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- A_Procedure_Instance -- A_Function_Instance -- A_Package_Instance -- A_Procedure_Renaming -- A_Function_Renaming -- A_Package_Renaming -- A_Generic_Procedure_Renaming -- A_Generic_Function_Renaming -- A_Generic_Package_Renaming -- A_Procedure_Body_Subunit -- A_Function_Body_Subunit -- A_Package_Body_Subunit -- A_Task_Body_Subunit -- A_Protected_Body_Subunit -- A_Nonexistent_Declaration -- A_Nonexistent_Body -- -- Returns all Unit Kinds. -- -- If the argument Element requires a body to be presented to make up a -- complete partition containing this Element, but The_Context does not -- contain the corresponding body, or the body contained in The_Context -- is inconsistent with the argument Element, A_Nonexistent_Body shall -- be returned. -- -- --|IR Implementation Requirements: -- --|IR -- --|IR Any non-Nil result will have an Enclosing_Context value that -- --|IR Is_Identical to The_Context. -- --|IR -- --|IR These two function calls will always produce identical results: -- --|IR -- --|IR Unit := Corresponding_Body( Unit ); -- --|IR Unit := Corresponding_Body( Unit, Enclosing_Context ( Unit )); -- --|IR -- --|IR The Enclosing_Context for any non-Nil result will always be -- --|IR The_Context, regardless of the Enclosing_Context value for the -- --|IR Library_Item argument. This query is one means of obtaining -- --|IR corresponding (Is_Equal) units from separate ASIS Context values -- --|IR whose underlying implementations overlap. -- --|IR -- --|IP Implementation Permissions: -- --|IP -- --|IP The handling of An_Unknown_Unit is implementation specific. The -- --|IP expected use for An_Unknown_Unit is to hide proprietary -- --|IP implementation details contained within unit bodies. In some cases, -- --|IP it could be possible to obtain an appropriate library_unit_body when -- --|IP starting with An_Unknown_Unit. Some implementors may choose to simply -- --|IP return the An_Unknown_Unit argument in all cases. ------------------------------------------------------------------------------ -- 10.15 function Is_Nil ------------------------------------------------------------------------------ function Is_Nil (Right : Asis.Compilation_Unit) return Boolean; ------------------------------------------------------------------------------ -- Right - Specifies the unit to test -- -- Returns True if the compilation_unit is a Nil_Compilation_Unit. -- ------------------------------------------------------------------------------ -- 10.16 function Is_Nil ------------------------------------------------------------------------------ function Is_Nil (Right : Asis.Compilation_Unit_List) return Boolean; ------------------------------------------------------------------------------ -- Right - Specifies the unit list to test -- -- Returns True if the compilation_unit list has a length of zero. -- ------------------------------------------------------------------------------ -- 10.17 function Is_Equal ------------------------------------------------------------------------------ function Is_Equal (Left : Asis.Compilation_Unit; Right : Asis.Compilation_Unit) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the first unit to compare -- Right - Specifies the second unit to compare -- -- Returns True if Left and Right represent the same physical compilation unit -- or if both are Nil_Compilation_Unit values. The two units may or may not -- be from the same ASIS Context variable. ("The same physical compilation -- unit" have the same version, as defined by Reference Manual E.3(5) -- and the same program text.) -- -- Two nonexistent units are Is_Equal if they have the same Name and -- Unit_Kind. -- ------------------------------------------------------------------------------ -- 10.18 function Is_Identical ------------------------------------------------------------------------------ function Is_Identical (Left : Asis.Compilation_Unit; Right : Asis.Compilation_Unit) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the first unit to compare -- Right - Specifies the second unit to compare -- -- Returns True if Left and Right represent the same physical compilation -- unit, from the same open ASIS Context variable, or, if both are -- Nil_Compilation_Unit values. ("The same physical compilation -- unit" have the same version, as defined by Reference Manual E.3(5) -- and the same program text.) -- -- Two nonexistent units are Is_Identical if they have the same -- Unique_Name and the same Enclosing_Context. -- ------------------------------------------------------------------------------ -- 10.19 function Unit_Full_Name ------------------------------------------------------------------------------ function Unit_Full_Name (Compilation_Unit : Asis.Compilation_Unit) return Wide_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose name is desired -- -- Returns the string image of the fully expanded Ada name of the given -- compilation unit. This may be a simple name ("A") of a root library -- unit, or an expanded name ("A.B") of a subunit or non-root child unit. -- An expanded name shall contain the full parent_unit_name as its prefix. -- Returns a null string only if A_Configuration_Compilation or a -- Nil_Compilation_Unit is given. -- -- The case of names returned by this query may vary between implementations. -- Implementors are encouraged, but not required, to return names in the -- same case as was used in the original compilation text. -- -- All Unit_Kinds are appropriate. -- ------------------------------------------------------------------------------ -- 10.20 function Unique_Name ------------------------------------------------------------------------------ function Unique_Name (Compilation_Unit : Asis.Compilation_Unit) return Wide_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose name is desired -- -- Returns a string that uniquely identifies the given compilation unit -- within the underlying Ada Context implementation. The result may vary -- depending on the ASIS implementation. The unique name may include the name -- and parameters of the Context, file system paths, library files, version -- numbers, kind, or any other information that an implementation may need -- to uniquely identify the compilation unit. -- -- Returns a null string only if a Nil_Compilation_Unit is given. -- -- All Unit_Kinds are appropriate. -- ------------------------------------------------------------------------------ -- 10.21 function Exist ------------------------------------------------------------------------------ function Exists (Compilation_Unit : Asis.Compilation_Unit) return Boolean; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to test -- -- Returns False for any unit with Not_A_Unit or nonexistent kind. -- Returns True for all other unit kinds. -- -- All Unit_Kinds are expected. -- ------------------------------------------------------------------------------ -- 10.22 function Can_Be_Main_Program ------------------------------------------------------------------------------ function Can_Be_Main_Program (Compilation_Unit : Asis.Compilation_Unit) return Boolean; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to test -- -- Returns True if the Compilation_Unit exists and is a subprogram -- library_unit_declaration, library_unit_renaming_declaration, or -- library_unit_body that can be used as a main subprogram. See Reference -- Manual 10.2(7). -- -- Returns False otherwise. -- -- Results of this function may vary according to the requirements an Ada -- implementation may impose on a main subprogram. -- -- All Unit_Kinds are expected. -- ------------------------------------------------------------------------------ -- 10.23 function Is_Body_Required ------------------------------------------------------------------------------ function Is_Body_Required (Compilation_Unit : Asis.Compilation_Unit) return Boolean; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to test -- -- Returns True if the Compilation_Unit exists and is a library -- package_declaration that requires a body. See Reference Manual 7.2(4). -- -- All Unit_Kinds are expected. -- ------------------------------------------------------------------------------ -- 10.24 function Text_Name ------------------------------------------------------------------------------ function Text_Name (Compilation_Unit : Asis.Compilation_Unit) return Wide_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose text name is desired -- -- Returns the name of the text, or other structure, that was the source -- of the compilation that resulted in this Compilation_Unit. Returns a -- null string if the unit has a Nil or nonexistent kind, or if the text -- name is not available for any reason. -- -- Ada has no concept of source or text file. -- Text_Name availability is a required feature of ASIS. -- Results of this function may vary among implementations. -- -- All Unit_Kinds are appropriate. -- ------------------------------------------------------------------------------ -- 10.25 function Text_Form ------------------------------------------------------------------------------ function Text_Form (Compilation_Unit : Asis.Compilation_Unit) return Wide_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose text form is desired -- -- Returns the Form parameter (as for Text_Io.Open) for the text, or -- other structure, that was the source of the compilation that resulted in -- this Compilation_Unit. Returns a null string if the unit has a Nil or -- nonexistent kind, if the text was created with an empty Form parameter, -- or if the text Form parameter value is not available for any reason. -- -- Ada has no concept of source or text file. -- Text_Form availability is a required feature of ASIS. -- Results of this function may vary among implementations. -- -- All Unit_Kinds are appropriate. -- ------------------------------------------------------------------------------ -- 10.26 function Object_Name ------------------------------------------------------------------------------ function Object_Name (Compilation_Unit : Asis.Compilation_Unit) return Wide_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose object name is desired -- -- Returns the name of the object, or other structure, that contains the -- binary result of the compilation for this Compilation_Unit. Returns -- a null string if the unit has a Nil or nonexistent kind, or if the -- object name is not available for any reason. -- -- All Unit_Kinds are appropriate. -- ------------------------------------------------------------------------------ -- 10.27 function Object_Form ------------------------------------------------------------------------------ function Object_Form (Compilation_Unit : Asis.Compilation_Unit) return Wide_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose object form is desired -- -- Returns the Form parameter (as for Text_Io.Open) for the object, or -- other structure, that was the machine-code result of the compilation of -- this Compilation_Unit. Returns a null string if the unit has a Nil or -- nonexistent kind, if the object was created with an empty Form parameter, -- or if the object Form parameter value is not available for any reason. -- -- All Unit_Kinds are appropriate. -- ------------------------------------------------------------------------------ -- 10.28 function Compilation_Command_Line_Options ------------------------------------------------------------------------------ function Compilation_Command_Line_Options (Compilation_Unit : Asis.Compilation_Unit) return Wide_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to query -- -- Returns the command line options used to compile the Compilation_Unit. -- Returns null string if the unit has a Nil or nonexistent unit kind, or -- if the command line options are not available for any reason. -- -- All Unit_Kinds are appropriate. -- ------------------------------------------------------------------------------ -- 10.29 function Has_Attribute ------------------------------------------------------------------------------ function Has_Attribute (Compilation_Unit : Asis.Compilation_Unit; Attribute : Wide_String) return Boolean; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to query -- Attribute - Specifies the name of the attribute to query -- -- Returns True if the compilation unit has the given attribute. -- -- Returns False if the unit is a Nil_Compilation_Unit argument, the -- Attribute does not exist, or the implementation does not support -- attributes. -- -- All Unit_Kinds are expected. -- -- Results of this query may vary across ASIS implementations. -- ------------------------------------------------------------------------------ -- 10.30 function Attribute_Value_Delimiter ------------------------------------------------------------------------------ function Attribute_Value_Delimiter return Wide_String; ------------------------------------------------------------------------------ -- Returns the string used as a delimiter separating individual values -- within the string Attribute_Values of a compilation unit. -- -- Results of this query may vary across ASIS implementations. The result -- can be a null string for implementations that do not support attributes, -- or that do not support more than one attribute. -- ------------------------------------------------------------------------------ -- 10.31 function Attribute_Values ------------------------------------------------------------------------------ function Attribute_Values (Compilation_Unit : Asis.Compilation_Unit; Attribute : Wide_String) return Wide_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to query -- Attribute - Specifies the name of the attribute to query -- -- Returns a string containing zero or more images of values that are -- associated with the given attribute. When more than one value is returned, -- the Attribute_Value_Delimiter string is used to separate the individual -- values. Returns a null string if the unit is a Nil_Compilation_Unit -- argument, the unit has no values for this Attribute, or the implementation -- does not support attributes. -- -- All Unit_Kinds are appropriate. -- -- Results of this query may vary across ASIS implementations. -- ------------------------------------------------------------------------------ -- 10.32 function Subunits ------------------------------------------------------------------------------ function Subunits (Parent_Body : Asis.Compilation_Unit) return Asis.Compilation_Unit_List; function Subunits (Parent_Body : Asis.Compilation_Unit; The_Context : Asis.Context) return Asis.Compilation_Unit_List; ------------------------------------------------------------------------------ -- Parent_Body - Specifies the parent unit to query -- The_Context - Specifies the program Context to use for context -- -- Returns a complete list of subunit values, with one value for each body -- stub that appears in the given Parent_Body. Returns a -- Nil_Compilation_Unit_List if the parent unit does not contain any body -- stubs. Every unit in the result will have an Enclosing_Context that -- Is_Identical to The_Context. -- -- These two function calls will always produce identical results: -- -- SUnits := Subunits ( PUnit ); -- SUnits := Subunits ( PUnit, Enclosing_Context ( PUnit )); -- -- The result may include unit values with a nonexistent unit kind. It -- includes values for subunits that exist in The_Context as -- well as values for subunits that do not exist, but whose name can be -- deduced from the body stub and the name of the parent unit. These -- nonexistent units are known to be library_unit_body elements so their unit -- kind is A_Nonexistent_Body. -- -- Subunit lists are also available through the Semantic_Dependence_Order -- query using the Family relation. -- -- Raises ASIS_Inappropriate_Compilation_Unit if the unit is a -- Nil_Compilation_Unit. -- -- If a subunit is absent or if it is inconsistent with the argument Element, -- A_Nonexistent_Body shall be returned for it. -- -- --|D2005 start -- The list of appropriate unit kinds is missing here. It should be: -- -- Appropriate Unit_Kinds: -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- A_Procedure_Body_Subunit -- A_Function_Body_Subunit -- A_Package_Body_Subunit -- A_Task_Body_Subunit -- A_Protected_Body_Subunit -- --|D2005 end -- -- Returns Unit_Kinds: -- A_Nonexistent_Body -- A_Procedure_Body_Subunit -- A_Function_Body_Subunit -- A_Package_Body_Subunit -- A_Task_Body_Subunit -- A_Protected_Body_Subunit -- ------------------------------------------------------------------------------ -- 10.33 function Corresponding_Subunit_Parent_Body ------------------------------------------------------------------------------ function Corresponding_Subunit_Parent_Body (Subunit : Asis.Compilation_Unit) return Asis.Compilation_Unit; function Corresponding_Subunit_Parent_Body (Subunit : Asis.Compilation_Unit; The_Context : Asis.Context) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Subunit - Specifies the subunit to query -- The_Context - Specifies the program Context to use for context -- -- Returns the Compilation_Unit containing the body stub of the given Subunit. -- Returns a Nil_Compilation_Unit if the subunit parent is not contained in -- The_Context. Any non-Nil result will have an Enclosing_Context value that -- Is_Identical to The_Context. -- -- These two function calls will always produce identical results: -- -- PUnit := Corresponding_Subunit_Parent_Body ( SUnit ); -- PUnit := Corresponding_Subunit_Parent_Body ( SUnit, -- Enclosing_Context ( SUnit )); -- -- Appropriate Unit_Kinds: -- A_Procedure_Body_Subunit -- A_Function_Body_Subunit -- A_Package_Body_Subunit -- A_Task_Body_Subunit -- A_Protected_Body_Subunit -- -- Returns Unit_Kinds: -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- A_Procedure_Body_Subunit -- A_Function_Body_Subunit -- A_Package_Body_Subunit -- A_Task_Body_Subunit -- A_Protected_Body_Subunit -- -- If the corresponding body does not exist in The_Context, or if it exists, -- but is inconsistent with the argument Element, then A_Nonexistent_Body -- shall be returned. -- ------------------------------------------------------------------------------ -- To locate the parent of a subunit that is not itself a subunit, -- repeatedly call Corresponding_Subunit_Parent_Body until a unit that -- is not a subunit is returned. -- ------------------------------------------------------------------------------ -- 10.34 function Debug_Image ------------------------------------------------------------------------------ function Debug_Image (Compilation_Unit : Asis.Compilation_Unit) return Wide_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies a unit to convert -- -- Returns a string value containing implementation-defined debug -- information associated with the compilation unit. -- -- The return value uses Asis.Text.Delimiter_Image to separate the lines -- of multi-line results. The return value does not end with -- Asis.Text.Delimiter_Image. -- -- These values are intended for two purposes. They are suitable for -- inclusion in problem reports sent to the ASIS implementor. They can be -- presumed to contain information useful when debugging the implementation -- itself. They are also suitable for use by the ASIS application when -- printing simple application debugging messages during application -- development. They are intended to be, to some worthwhile degree, -- intelligible to the user. -- end Asis.Compilation_Units;
programs/oeis/117/A117676.asm
jmorken/loda
1
91088
<reponame>jmorken/loda ; A117676: Squares for which the digital root is also a square. ; 0,1,4,9,36,49,64,81,100,121,144,225,256,289,324,361,400,441,576,625,676,729,784,841,900,1089,1156,1225,1296,1369,1444,1521,1764,1849,1936,2025,2116,2209,2304,2601,2704,2809,2916,3025,3136,3249,3600,3721,3844,3969,4096,4225,4356,4761,4900,5041,5184,5329,5476,5625,6084,6241,6400,6561,6724,6889,7056,7569,7744,7921,8100,8281,8464,8649,9216,9409,9604,9801,10000,10201,10404,11025,11236,11449,11664,11881,12100,12321,12996,13225,13456,13689,13924,14161,14400,15129,15376,15625,15876,16129,16384,16641,17424,17689,17956,18225,18496,18769,19044,19881,20164,20449,20736,21025,21316,21609,22500,22801,23104,23409,23716,24025,24336,25281,25600,25921,26244,26569,26896,27225,28224,28561,28900,29241,29584,29929,30276,31329,31684,32041,32400,32761,33124,33489,34596,34969,35344,35721,36100,36481,36864,38025,38416,38809,39204,39601,40000,40401,41616,42025,42436,42849,43264,43681,44100,45369,45796,46225,46656,47089,47524,47961,49284,49729,50176,50625,51076,51529,51984,53361,53824,54289,54756,55225,55696,56169,57600,58081,58564,59049,59536,60025,60516,62001,62500,63001,63504,64009,64516,65025,66564,67081,67600,68121,68644,69169,69696,71289,71824,72361,72900,73441,73984,74529,76176,76729,77284,77841,78400,78961,79524,81225,81796,82369,82944,83521,84100,84681,86436,87025,87616,88209,88804,89401,90000,91809,92416,93025,93636,94249,94864,95481,97344,97969,98596,99225,99856,100489,101124,103041 mov $1,$0 add $1,$0 lpb $0 sub $0,7 add $1,4 lpe pow $1,2 div $1,4
oeis/267/A267811.asm
neoneye/loda-programs
11
163026
; A267811: Binary representation of the n-th iteration of the "Rule 217" elementary cellular automaton starting with a single ON (black) cell. ; Submitted by <NAME>(s2.) ; 1,1,11011,1110111,111101111,11111011111,1111110111111,111111101111111,11111111011111111,1111111110111111111,111111111101111111111,11111111111011111111111,1111111111110111111111111,111111111111101111111111111,11111111111111011111111111111,1111111111111110111111111111111,111111111111111101111111111111111,11111111111111111011111111111111111,1111111111111111110111111111111111111,111111111111111111101111111111111111111,11111111111111111111011111111111111111111 lpb $0 mov $2,$0 mov $0,1 seq $2,332120 ; a(n) = 2*(10^(2n+1)-1)/9 - 2*10^n. lpe mov $0,$2 div $0,4 mul $0,2 add $0,1
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/RLStatement.g4
klniu/shardingsphere
1
441
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ grammar RLStatement; import Symbol, Keyword, MySQLKeyword, Literals, BaseRule; change : changeMasterTo | changeReplicationFilter ; changeMasterTo : CHANGE MASTER TO masterDefs channelOption? ; changeReplicationFilter : CHANGE REPLICATION FILTER filterDefs channelOption? ; startSlave : START SLAVE threadTypes? utilOption? connectionOptions channelOption? ; stopSlave : STOP SLAVE threadTypes channelOption* ; groupReplication : startGroupReplication | stopGroupReplication ; startGroupReplication : START GROUP_REPLICATION ; stopGroupReplication : STOP GROUP_REPLICATION ; purgeBinaryLog : PURGE (BINARY | MASTER) LOGS (TO logName | BEFORE datetimeExpr) ; threadTypes : threadType+ ; threadType : IO_THREAD | SQL_THREAD ; utilOption : UNTIL ((SQL_BEFORE_GTIDS | SQL_AFTER_GTIDS) EQ_ identifier | MASTER_LOG_FILE EQ_ string_ COMMA_ MASTER_LOG_POS EQ_ NUMBER_ | RELAY_LOG_FILE EQ_ string_ COMMA_ RELAY_LOG_POS EQ_ NUMBER_ | SQL_AFTER_MTS_GAPS) ; connectionOptions : (USER EQ_ string_)? (PASSWORD EQ_ string_)? (DEFAULT_AUTH EQ_ string_)? (PLUGIN_DIR EQ_ string_)? ; masterDefs : masterDef (COMMA_ masterDef)* ; masterDef : MASTER_BIND EQ_ string_ | MASTER_HOST EQ_ string_ | MASTER_USER EQ_ string_ | MASTER_PASSWORD EQ_ string_ | MASTER_PORT EQ_ NUMBER_ | PRIVILEGE_CHECKS_USER EQ_ (ACCOUNT | NULL) | REQUIRE_ROW_FORMAT EQ_ NUMBER_ | MASTER_CONNECT_RETRY EQ_ NUMBER_ | MASTER_RETRY_COUNT EQ_ NUMBER_ | MASTER_DELAY EQ_ NUMBER_ | MASTER_HEARTBEAT_PERIOD EQ_ NUMBER_ | MASTER_LOG_FILE EQ_ string_ | MASTER_LOG_POS EQ_ NUMBER_ | MASTER_AUTO_POSITION EQ_ NUMBER_ | RELAY_LOG_FILE EQ_ string_ | RELAY_LOG_POS EQ_ NUMBER_ | MASTER_COMPRESSION_ALGORITHMS EQ_ string_ | MASTER_ZSTD_COMPRESSION_LEVEL EQ_ NUMBER_ | MASTER_SSL EQ_ NUMBER_ | MASTER_SSL_CA EQ_ string_ | MASTER_SSL_CAPATH EQ_ string_ | MASTER_SSL_CERT EQ_ string_ | MASTER_SSL_CRL EQ_ string_ | MASTER_SSL_CRLPATH EQ_ string_ | MASTER_SSL_KEY EQ_ string_ | MASTER_SSL_CIPHER EQ_ string_ | MASTER_SSL_VERIFY_SERVER_CERT EQ_ NUMBER_ | MASTER_TLS_VERSION EQ_ string_ | MASTER_TLS_CIPHERSUITES EQ_ string_ | MASTER_PUBLIC_KEY_PATH EQ_ string_ | GET_MASTER_PUBLIC_KEY EQ_ NUMBER_ | IGNORE_SERVER_IDS EQ_ LP_ ignoreServerIds RP_ ; ignoreServerIds : ignoreServerId (COMMA_ ignoreServerId) ; ignoreServerId : NUMBER_ ; filterDefs : filterDef (COMMA_ filterDef)* ; filterDef : REPLICATE_DO_DB EQ_ LP_ schemaNames? RP_ | REPLICATE_IGNORE_DB EQ_ LP_ schemaNames? RP_ | REPLICATE_DO_TABLE EQ_ LP_ tableList? RP_ | REPLICATE_IGNORE_TABLE EQ_ LP_ tableList? RP_ | REPLICATE_WILD_DO_TABLE EQ_ LP_ wildTables? RP_ | REPLICATE_WILD_IGNORE_TABLE EQ_ LP_ wildTables? RP_ | REPLICATE_REWRITE_DB EQ_ LP_ schemaPairs? RP_ ; wildTables : wildTable (COMMA_ wildTable)* ; wildTable : string_ ;
source/gmp.adb
ytomino/gmp-ada
4
10011
<reponame>ytomino/gmp-ada with C.string; package body GMP is function Version return String is S : constant C.char_const_ptr := C.gmp.qqgmp_version; Length : constant Natural := Natural (C.string.strlen (S)); Result : String (1 .. Length); for Result'Address use S.all'Address; begin return Result; end Version; function Default_Precision return Precision is begin return Precision (C.gmp.gmpf_get_default_prec); end Default_Precision; procedure mpz_set_Long_Long_Integer ( rop : not null access C.gmp.mpz_struct; op : in Long_Long_Integer) is subtype ui is Long_Long_Integer range Long_Long_Integer (C.unsigned_long'First) .. Long_Long_Integer ( C.unsigned_long_long'Min ( C.unsigned_long_long (C.unsigned_long'Last), C.unsigned_long_long (Long_Long_Integer'Last))); op_in_ui : constant Boolean := op in ui; begin if op_in_ui then C.gmp.mpz_set_ui (rop, C.unsigned_long'Mod (op)); else declare subtype si is Long_Long_Integer range Long_Long_Integer (C.signed_long'First) .. Long_Long_Integer (C.signed_long'Last); pragma Warnings (Off); -- always True in 64bit environment op_in_si : constant Boolean := op in si; pragma Warnings (On); begin if op_in_si then C.gmp.mpz_set_si (rop, C.signed_long (op)); else C.gmp.mpz_set_si ( rop, C.signed_long (C.Shift_Right_Arithmetic ( C.signed_long_long (op), C.unsigned_long'Size))); C.gmp.mpz_mul_2exp ( rop, rop, C.unsigned_long'Size); C.gmp.mpz_add_ui ( rop, rop, C.unsigned_long'Mod (op)); end if; end; end if; end mpz_set_Long_Long_Integer; end GMP;
alloy4fun_models/trashltl/models/5/fCg8cDjn7j3R7k7f4.als
Kaixi26/org.alloytools.alloy
0
2192
open main pred idfCg8cDjn7j3R7k7f4_prop6 { all f: File | historically f in Trash implies always f in Trash } pred __repair { idfCg8cDjn7j3R7k7f4_prop6 } check __repair { idfCg8cDjn7j3R7k7f4_prop6 <=> prop6o }
grammars/LegalOpinion.g4
OpenLawsGR/judgments2AKN
5
4270
grammar LegalOpinion; akomaNtoso : judgment EOF; //------------------------------- JUDGMENT --------------------------------------------------// judgment : header judgmentBody conclusions?; header : personalLegalOpinion? caseNmuber? docProponent? headerPar+; judgmentBody : introduction? (background motivation decision | background_alt motivation decision); //------------------------------- HEADER --------------------------------------------------// personalLegalOpinion: (PERSONAL SPACE LEGAL_OPINION | LEGAL_OPINION SPACE BRACKET PERSONAL BRACKET) (NEXT_LINE | SPACE); caseNmuber: (NUMBER_TEXT SPACE docType SPACE? ANO_KATO? SPACE? | docType (SPACE NUMBER_TEXT)? SPACE | NUMBER_TEXT SPACE) docNumber NEXT_LINE ; docType: LEGAL_OPINION; docNumber: NUM SPACE? SLASH SPACE? NUM; docProponent: (OF SPACE)? NSK (SPACE BRACKET TMHMA_TEXT SPACE TMIMA_ID BRACKET)? NEXT_LINE; headerPar : (PAR | BRACKET | ALL_CHARS | SPECIAL_CHARS | SPACE | COMMA | NUMBER_TEXT | NUM | HYPHEN | SLASH | ANO_KATO | EMBEDDED_TEXT | OF | CONCLUSTION_START| TMIMA_ID | TMHMA_TEXT | APOSTROPHE | NSK | PAR_2 | PERSONAL)+ NEXT_LINE* ; questionInfo: QUESTION_NUM (BRACKET | ALL_CHARS | SPECIAL_CHARS | SPACE | COMMA | NUMBER_TEXT | NUM | HYPHEN | SLASH | ANO_KATO | EMBEDDED_TEXT | OF | TMIMA_ID | TMHMA_TEXT | NSK| PAR| APOSTROPHE | LEGAL_OPINION | NEXT_LINE)+ NEXT_LINE?; headerLastPar: BASE_ON_QUESTIONS (ALL_CHARS | SPACE | COMMA | NUMBER_TEXT | ANO_KATO | TMIMA_ID | OF| NEXT_LINE | NSK | BRACKET | APOSTROPHE | NUM | SPECIAL_CHARS | SLASH | LEGAL_OPINION| HYPHEN | EMBEDDED_TEXT)+; //------------------------------- END HEADER --------------------------------------------------// // ------------------------------- judgmentBody --------------------------------------------// //------------------------------ background ---------------------------------// introduction: questionInfo+ headerLastPar*; background: backgroundDivision; backgroundDivision: backgroundDivisionHeading alinea? backgroundDivisionParagraph*; //backgroundDivision: heading backgroundDivisionParagraph+; backgroundDivisionHeading: SECTIONS_DIVISION ; backgroundDivisionParagraph: backgroundDivisionParagraphNum SPACE? content; backgroundDivisionParagraphNum: PAR | PAR_2; //backgroundDivisionAlinea: backgroundDivisionAlineaContent; //backgroundDivisionAlineaContent: contentPar; alinea:content; //alineaContent: content; content: contentPar; contentPar: (ALL_CHARS | SPECIAL_CHARS | SPACE | COMMA | SLASH | NUM | NEXT_LINE | HYPHEN | NUMBER_TEXT| EMBEDDED_TEXT | ANO_KATO | BRACKET | LEGAL_OPINION | OF | APOSTROPHE | TMIMA_ID | NSK | BASE_ON_QUESTIONS |PERSONAL)+; //This is when sections are split not by Latin numbering but uppercase letters (A. B. etc) background_alt: backgroundDivision_alt; backgroundDivision_alt: backgroundDivisionHeading_alt alinea? backgroundDivisionParagraph_alt*; backgroundDivisionHeading_alt: PAR_2; backgroundDivisionParagraph_alt: PAR SPACE? content; //------------------------------ END background ---------------------------------// //------------------------------ motivation ---------------------------------// motivation : motivationDivision+ | motivationDivision_alt+; motivationDivision : motivationHeading alinea? motivationDivisionParagraph*; motivationHeading : SECTIONS_DIVISION ; motivationDivisionParagraph: motivParNum SPACE? content; motivParNum: PAR | PAR_2; //alinea: alineaContent; //This is when sections are split not by Latin numbering but uppercase letters (A. B. etc) //motivation_alt: motivationDivision_alt+; motivationDivision_alt: motivationHeading_alt alinea? motivationDivisionParagraph_alt*; motivationHeading_alt: PAR_2; motivationDivisionParagraph_alt: motivParNum_alt SPACE? content; motivParNum_alt: PAR; //------------------------------ END motivation ---------------------------------// //------------------------------ decision -----------------------------------// decision : decisionDivision | decisionDivision_alt; decisionDivision : decisionHeading alinea? decisionDivisionParagraph*; decisionHeading: SECTIONS_DIVISION ; //decisionDivisionParagraph: backgroundDivisionParagraphNum? decisionContent; decisionDivisionParagraph: backgroundDivisionParagraphNum SPACE? decisionContent; decisionContent: decisionContentPar; decisionContentPar: (ALL_CHARS | SPECIAL_CHARS | SPACE | COMMA | SLASH | NUM | NEXT_LINE | HYPHEN | NUMBER_TEXT| EMBEDDED_TEXT | ANO_KATO | BRACKET | LEGAL_OPINION | SECTIONS_DIVISION| OF | APOSTROPHE | TMIMA_ID | NSK | BASE_ON_QUESTIONS)+; //This is when sections are split not by Latin numbering but uppercase letters (A. B. etc) //decision_alt: decisionDivision_alt; decisionDivision_alt: decisionHeading_alt alinea? decisionDivisionParagraph_alt*; decisionHeading_alt: PAR_2; decisionDivisionParagraph_alt: motivParNum_alt SPACE? content; //------------------------------ END decision -----------------------------------// //-------------------------------END judgmentBody ---------------------------------// //------------------------------ conclusions ---------------------------------// conclusions: conclusionStart conclusionPar+; conclusionStart: NEXT_LINE CONCLUSTION_START NEXT_LINE; conclusionPar: headerPar; //------------------------------ END conclusions ---------------------------------// //------------------------------- END JUDGMENT --------------------------------------------------// //------------------------------------TOKENS---------------------------------------------------------------------// CONCLUSTION_START: 'ΘΕΩΡΗΘΗΚΕ' | 'ΘΕΩΡΗΘΗΚΕ Ο ΕΙΣΗΓΗΤΗΣ' | 'ΘΕΩΡΗΘΗΚΕ Ο Εισηγητής' | 'Θεωρήθηκε' | 'ΘΕΩΡΗΘΗΚΕ' | 'Ο Γνωμοδοτών' | 'Ο ΓΝΩΜΟΔΟΤΩΝ' | 'Αθήνα' SPACE (NUM HYPHEN?)+ ; PAR : NEXT_LINE NUM DOT HYPHEN? SPACE //| //NEXT_LINE LOWER DOT HYPHEN? SPACE ; PAR_2: NEXT_LINE UPPER DOT HYPHEN? SPACE; SECTIONS_DIVISION: NEXT_LINE LATIN DOT SPACE? (HISTORY_HEADER | DECISION_HEADER | MOTIVATION_HEADER) DOT? | NEXT_LINE LATIN DOT SPACE? | HISTORY_HEADER | DECISION_HEADER | MOTIVATION_HEADER ; //SECTIONS_DIVISION_ALT: PAR; //BACKGR_DIV_HEADING : SECTION_DIVISION SPACE? (HISTORY_HEADER | DECISION_HEADER) DOT? | SECTION_DIVISION | HISTORY_HEADER | DECISION_HEADER; //MOTIV_DIV_HEADING : SECTION_DIVISION SPACE? MOTIVATION_HEADER? | MOTIVATION_HEADER | SECTION_DIVISION; //DECISION_DIV_HEADING: SECTION_DIVISION SPACE? ?; //SECTION_DIVISION : NEXT_LINE LATIN DOT SPACE? NEXT_LINE?; EMBEDDED_TEXT: '"'.*?'"' | '«'.*?~('@')'»' | '“'.*?'”'; PERSONAL: 'ΑΤΟΜΙΚΗ' | 'Ατομική'; NUMBER_TEXT: 'Αριθμός' | 'υπ΄αριθ' DOT | 'Aριθμός' | 'Αριθµός' | 'ΑΡΙΘΜΟΣ' | 'υπ’' SPACE 'αριθμ' DOT | 'Αριθµ' DOT | 'Αριθμ' DOT | 'Αρ' DOT ; LEGAL_OPINION: 'ΓΝΩΜΟΔΟΤΗΣΗ' | 'ΓΝΩΜΟΔΟΤΗΣHΣ' | 'ΓΝΩΜΟΔΟΤΗΣΗΣ' | 'Γνωμοδότησης' | 'Γνωμοδότηση' | 'Γνωμοδοτήσεως' | 'Γνωµοδοτήσεως' | 'γνωμοδότησης' ; OF: 'ΤΟΥ' | 'του' | 'ΤΟ' | 'Το'; NSK: ('ΝΟΜΙΚΟ' SPACE 'ΣΥΜΒΟΥΛΙΟ' | 'ΝΟΜΙΚΟΥ' SPACE 'ΣΥΜΒΟΥΛΙΟΥ') SPACE OF SPACE 'ΚΡΑΤΟΥΣ' | 'Νομικό' SPACE 'Συμβούλιο' SPACE OF SPACE 'Κράτους' ; HISTORY_HEADER: 'Ιστορικό' DOT? | 'ΙΣΤΟΡΙΚΟ' DOT? | 'ΙΣΤΟΡΙΚΟ ΤΗΣ ΥΠΟΘΕΣΗΣ' | 'ΙΣΤΟΡΙΚΟ ΚΑΙ ΓΝΩΜΟΔΟΤΗΣΗ ΝΣΚ' SPACE NUM SLASH NUM | 'Σύντομο' SPACE 'Ιστορικό' | 'ΔΟΘΕΝ' SPACE 'ΙΣΤΟΡΙΚΟ' ; MOTIVATION_HEADER: 'Εφαρμοστέες διατάξεις' | 'Σχετικές διατάξεις' | '- ΚΡΙΣΙΜΕΣ ΔΙΑΤΑΞΕΙΣ' DOT?| 'ΚΡΙΣΙΜΕΣ ΔΙΑΤΑΞΕΙΣ' DOT?| 'Κρίσιμες διατάξεις' | 'Ερμηνεία της διάταξης - Υπαγωγή' | 'Ερμηνεία των διατάξεων' DOT?| 'ΕΡΜΗΝΕΙΑ ΤΩΝ ΔΙΑΤΑΞΕΩΝ' | 'Ερμηνεία και εφαρμογή διατάξεων' | 'Ερμηνεία και εφαρμογή των διατάξεων' | 'Ερμηνεία διατάξεων' | 'ΕΡΜΗΝΕΙΑ ΚΑΙ ΕΦΑΡΜΟΓΗ ΤΩΝ ΔΙΑΤΑΞΕΩΝ' | 'Νομοθετικό πλαίσιο' DOT?| 'Νομοθετικό Πλαίσιο' DOT?| 'Nομοθετικό πλαίσιο' DOT?| 'ΝΟΜΟΘΕΤΙΚΟ ΠΛΑΙΣΙΟ' DOT?| 'ΝΟΜΙΚΟΠΛΑΙΣΙΟ' DOT | 'Ανάλυση' | 'ΤΟ ΚΟΙΝΟΤΙΚΟ, ΕΘΝΙΚΟ KAI ΕΙΔΙΚΟ ΝΟΜΙΚΟ ΠΛΑΙΣΙΟ ΤΗΣ' (NEXT_LINE | SPACE) 'ΥΠΟΘΕΣΗΣ' | 'ΤΑ ΕΡΩΤΗΜΑΤΑ' | 'ΤΕΘΕΝΤΑ ΕΡΩΤΗΜΑΤΑ' | 'ΤΟ EΝΩΣΙΑΚΟ ΚΑΙ ΕΘΝΙΚΟ ΝΟΜΟΘΕΤΙΚΟ ΚΑΙ ΝΟΜΟΛΟΓΙΑΚΟ ΠΛΑΙΣΙΟ' | 'ΕΡΜΗΝΕΙΑ – ΥΠΑΓΩΓΗ' | 'ΝΟΜΙΚΟ ΠΛΑΙΣΙΟ ΤΗΣ ΥΠΟΘΕΣΗΣ' | 'ΣΥΜΠΕΡΑΣΜΑTA' | 'ΣΥΜΠΕΡΑΣΜΑΤΑ' | 'ΣΥΜΠΕΡΑΣΜΑ' | 'Συμπέρασμα' | 'ΤΟ ΕΙΔΙΚΟ ΝΟΜΙΚΟ ΠΛΑΙΣΙΟ' ; DECISION_HEADER: '- Απάντηση' | 'Απάντηση' | 'ΑΠΑΝΤΗΣΕΙΣ' | 'ΑΠΑΝΤΗΣΗ' ; BASE_ON_QUESTIONS: 'Επί' SPACE 'των' SPACE 'ερωτημάτων' | 'Επί' SPACE OF SPACE 'ανωτέρω' SPACE 'ερωτήματος' | 'Επί' SPACE OF SPACE 'ως' SPACE 'άνω' SPACE 'ερωτήματος' | 'Επί' SPACE OF SPACE 'ερωτήματος' | 'Επί' SPACE 'των' SPACE 'ανωτέρω' SPACE 'ερωτημάτων' | 'Επί' SPACE OF SPACE 'παραπάνω' SPACE 'ερωτήματος' | 'Επί' SPACE 'των' SPACE 'ως' SPACE 'άνω' SPACE 'ερωτημάτων' | 'Επί' SPACE 'των' SPACE 'ως' SPACE 'άνω' SPACE 'ερωτηµάτων' ; QUESTION_NUM: NUMBER_TEXT SPACE ('Ερωτήματος' | 'Ερωτήµατος' | 'ερωτήματος' | 'ΕΡΩΤΗΜΑΤΟΣ') SPACE? ANO_KATO | NUMBER_TEXT SPACE ANO_KATO | 'Ερώτημα' SPACE? ANO_KATO | ('Περίληψη' | 'ΠΕΡΙΛΗΨΗ') SPACE ('ερωτήματος' | 'Ερωτήματος' | 'Ερωτήµατος' | 'ερωτημάτων' | 'ΕΡΩΤΗΜΑΤΟΣ') SPACE? ANO_KATO | 'Περίληψη' SPACE? ANO_KATO | 'Έγγραφο' SPACE 'Ερωτήματος' SPACE? ANO_KATO | 'Ερωτάται' ANO_KATO | 'Αριθμός' SPACE 'Eρωτήματος' | 'Περίληψη' SPACE 'Ερωτημάτων' | 'Θέμα' SPACE '(περίληψη ερωτήματος)' ; NUM : [0-9]+ ; SLASH : '/'; COMMA : ','; NEXT_LINE: '\n'; BRACKET: '(' | ')'; HYPHEN: ('-' | '–' | '−'); //LATIN : 'Ι' | 'ΙΙ' | 'II' | 'ΙΙΙ' | 'ΙV' | 'IV' | 'V'; ANO_KATO: ':'; TMHMA_TEXT: 'ΤΜΗΜΑ'; TMIMA_ID: ('Α' | 'Β' | 'Γ' | 'Δ' | 'Ε' | 'ΣΤ') APOSTROPHE; APOSTROPHE: [’΄'`´ʽ‘ʹ]; ALL_CHARS : ([Α-Ωα-ωάέήίόύϋώϊΐΆΈΉΊΌΎΏΪ] | [A-Za-z] | [üéâşţöí] | '∆' | 'Ω' | 'Т' | 'Е' | 'µ' |'×' )+; SPECIAL_CHARS: ( '¶' | '$' | '·' | '•' | '°' | '·'| '…' | '%' | '{' | '}' | '!' | '.'| '¾' | '²' | '½' | ']' | '[' | '¦' | '+' | '-' | '–' | '¬' | '−' | '?' | '‐'| '_'| '£' | '€' | '*' | '@' | '=' | '\\' | '/' | '‰' | '^' | '&' | '>' | '<' | '~' | '¼' | '§' | '“' | '”' | '»' | [|] | '"' | '¨' | '«' | ';' | '#' | '' ); SPACE : ([\r\t ] | ' ')+ ; //-------------------------------------FRAGMENTS-------------------------------------------------// fragment UPPER: ('Α' | 'Β' | 'Γ' | 'Δ' | 'Ε' | 'E' | 'ΣΤ') ; fragment LATIN: 'Ι' | 'I' | 'ΙΙ' | 'II' | 'ΙI' | 'ΙΙΙ' | 'IΙΙ' | 'III' | 'ΙV' | 'IV' | 'V' | 'VI' | 'VII' ; fragment LOWER: 'α' | 'β' | 'γ' | 'δ' | 'ε' | 'στ'; fragment DOT : '.';
Keyboard Maestro/Get Current Zettel Date.applescript
samvtran/AppleScripts
0
3593
#@osa-lang:AppleScript use AppleScript version "2.4" -- Yosemite (10.10) or later use scripting additions use framework "Foundation" use zt : script "zettel" return zt's zettelFromDate:(current date)
data/text_predef_pointers.asm
opiter09/ASM-Machina
1
13503
<gh_stars>1-10 add_tx_pre: MACRO \1_id:: dw \1 ENDM TextPredefs:: add_tx_pre CardKeySuccessText ; 01 add_tx_pre CardKeyFailText ; 02 add_tx_pre RedBedroomPCText ; 03 add_tx_pre RedBedroomSNESText ; 04 add_tx_pre PushStartText ; 05 add_tx_pre SaveOptionText ; 06 add_tx_pre StrengthsAndWeaknessesText ; 07 add_tx_pre OakLabEmailText ; 08 add_tx_pre AerodactylFossilText ; 09 add_tx_pre Route15UpstairsBinocularsText ; 0A add_tx_pre KabutopsFossilText ; 0B add_tx_pre GymStatueText1 ; 0C add_tx_pre GymStatueText2 ; 0D add_tx_pre BookcaseText ; 0E add_tx_pre ViridianCityPokecenterBenchGuyText ; 0F add_tx_pre PewterCityPokecenterBenchGuyText ; 10 add_tx_pre CeruleanCityPokecenterBenchGuyText ; 11 add_tx_pre LavenderCityPokecenterBenchGuyText ; 12 add_tx_pre VermilionCityPokecenterBenchGuyText ; 13 add_tx_pre CeladonCityPokecenterBenchGuyText ; 14 add_tx_pre CeladonCityHotelText ; 15 add_tx_pre FuchsiaCityPokecenterBenchGuyText ; 16 add_tx_pre CinnabarIslandPokecenterBenchGuyText ; 17 add_tx_pre SaffronCityPokecenterBenchGuyText ; 18 add_tx_pre MtMoonPokecenterBenchGuyText ; 19 add_tx_pre RockTunnelPokecenterBenchGuyText ; 1A add_tx_pre UnusedBenchGuyText1 ; 1B XXX unused add_tx_pre UnusedBenchGuyText2 ; 1C XXX unused add_tx_pre UnusedBenchGuyText3 ; 1D XXX unused add_tx_pre UnusedPredefText ; 1E XXX unused add_tx_pre PokemonCenterPCText ; 1F add_tx_pre ViridianSchoolNotebook ; 20 add_tx_pre ViridianSchoolBlackboard ; 21 add_tx_pre JustAMomentText ; 22 add_tx_pre OpenBillsPCText ; 23 add_tx_pre FoundHiddenItemText ; 24 add_tx_pre HiddenItemBagFullText ; 25 XXX unused add_tx_pre VermilionGymTrashText ; 26 add_tx_pre IndigoPlateauHQText ; 27 add_tx_pre GameCornerOutOfOrderText ; 28 add_tx_pre GameCornerOutToLunchText ; 29 add_tx_pre GameCornerSomeonesKeysText ; 2A add_tx_pre FoundHiddenCoinsText ; 2B add_tx_pre DroppedHiddenCoinsText ; 2C add_tx_pre BillsHouseMonitorText ; 2D add_tx_pre BillsHouseInitiatedText ; 2E add_tx_pre BillsHousePokemonList ; 2F add_tx_pre MagazinesText ; 30 add_tx_pre CinnabarGymQuiz ; 31 add_tx_pre GameCornerNoCoinsText ; 32 add_tx_pre GameCornerCoinCaseText ; 33 add_tx_pre LinkCableHelp ; 34 add_tx_pre TMNotebook ; 35 add_tx_pre FightingDojoText ; 36 add_tx_pre EnemiesOnEverySideText ; 37 add_tx_pre WhatGoesAroundComesAroundText ; 38 add_tx_pre NewBicycleText ; 39 add_tx_pre IndigoPlateauStatues ; 3A add_tx_pre VermilionGymTrashSuccessText1 ; 3B add_tx_pre VermilionGymTrashSuccessText2 ; 3C XXX unused add_tx_pre VermilionGymTrashSuccessText3 ; 3D add_tx_pre VermilionGymTrashFailText ; 3E add_tx_pre TownMapText ; 3F add_tx_pre BookOrSculptureText ; 40 add_tx_pre ElevatorText ; 41 add_tx_pre PokemonStuffText ; 42
source/amf/dd/amf-internals-dg_radial_gradients.adb
svn2github/matreshka
24
13631
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.DG.Canvases; with AMF.Elements; with AMF.Internals.Helpers; with AMF.Internals.Tables.DD_Attributes; with AMF.Visitors.DG_Iterators; with AMF.Visitors.DG_Visitors; package body AMF.Internals.DG_Radial_Gradients is ------------------ -- Get_Center_X -- ------------------ overriding function Get_Center_X (Self : not null access constant DG_Radial_Gradient_Proxy) return AMF.Real is begin return AMF.Internals.Tables.DD_Attributes.Internal_Get_Center_X (Self.Element); end Get_Center_X; ------------------ -- Set_Center_X -- ------------------ overriding procedure Set_Center_X (Self : not null access DG_Radial_Gradient_Proxy; To : AMF.Real) is begin AMF.Internals.Tables.DD_Attributes.Internal_Set_Center_X (Self.Element, To); end Set_Center_X; ------------------ -- Get_Center_Y -- ------------------ overriding function Get_Center_Y (Self : not null access constant DG_Radial_Gradient_Proxy) return AMF.Real is begin return AMF.Internals.Tables.DD_Attributes.Internal_Get_Center_Y (Self.Element); end Get_Center_Y; ------------------ -- Set_Center_Y -- ------------------ overriding procedure Set_Center_Y (Self : not null access DG_Radial_Gradient_Proxy; To : AMF.Real) is begin AMF.Internals.Tables.DD_Attributes.Internal_Set_Center_Y (Self.Element, To); end Set_Center_Y; ---------------- -- Get_Radius -- ---------------- overriding function Get_Radius (Self : not null access constant DG_Radial_Gradient_Proxy) return AMF.Real is begin return AMF.Internals.Tables.DD_Attributes.Internal_Get_Radius (Self.Element); end Get_Radius; ---------------- -- Set_Radius -- ---------------- overriding procedure Set_Radius (Self : not null access DG_Radial_Gradient_Proxy; To : AMF.Real) is begin AMF.Internals.Tables.DD_Attributes.Internal_Set_Radius (Self.Element, To); end Set_Radius; ----------------- -- Get_Focus_X -- ----------------- overriding function Get_Focus_X (Self : not null access constant DG_Radial_Gradient_Proxy) return AMF.Real is begin return AMF.Internals.Tables.DD_Attributes.Internal_Get_Focus_X (Self.Element); end Get_Focus_X; ----------------- -- Set_Focus_X -- ----------------- overriding procedure Set_Focus_X (Self : not null access DG_Radial_Gradient_Proxy; To : AMF.Real) is begin AMF.Internals.Tables.DD_Attributes.Internal_Set_Focus_X (Self.Element, To); end Set_Focus_X; ----------------- -- Get_Focus_Y -- ----------------- overriding function Get_Focus_Y (Self : not null access constant DG_Radial_Gradient_Proxy) return AMF.Real is begin return AMF.Internals.Tables.DD_Attributes.Internal_Get_Focus_Y (Self.Element); end Get_Focus_Y; ----------------- -- Set_Focus_Y -- ----------------- overriding procedure Set_Focus_Y (Self : not null access DG_Radial_Gradient_Proxy; To : AMF.Real) is begin AMF.Internals.Tables.DD_Attributes.Internal_Set_Focus_Y (Self.Element, To); end Set_Focus_Y; -------------- -- Get_Stop -- -------------- overriding function Get_Stop (Self : not null access constant DG_Radial_Gradient_Proxy) return AMF.DG.Set_Of_DG_Gradient_Stop is begin return AMF.Internals.Tables.DD_Attributes.Internal_Get_Stop (Self.Element); end Get_Stop; ---------------- -- Get_Canvas -- ---------------- overriding function Get_Canvas (Self : not null access constant DG_Radial_Gradient_Proxy) return AMF.DG.Canvases.DG_Canvas_Access is begin return AMF.DG.Canvases.DG_Canvas_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.DD_Attributes.Internal_Get_Canvas (Self.Element))); end Get_Canvas; ---------------- -- Set_Canvas -- ---------------- overriding procedure Set_Canvas (Self : not null access DG_Radial_Gradient_Proxy; To : AMF.DG.Canvases.DG_Canvas_Access) is begin AMF.Internals.Tables.DD_Attributes.Internal_Set_Canvas (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Canvas; ------------------- -- Get_Transform -- ------------------- overriding function Get_Transform (Self : not null access constant DG_Radial_Gradient_Proxy) return AMF.DG.Sequence_Of_DG_Transform is begin return AMF.Internals.Tables.DD_Attributes.Internal_Get_Transform (Self.Element); end Get_Transform; ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant DG_Radial_Gradient_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.DG_Visitors.DG_Visitor'Class then AMF.Visitors.DG_Visitors.DG_Visitor'Class (Visitor).Enter_Radial_Gradient (AMF.DG.Radial_Gradients.DG_Radial_Gradient_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant DG_Radial_Gradient_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.DG_Visitors.DG_Visitor'Class then AMF.Visitors.DG_Visitors.DG_Visitor'Class (Visitor).Leave_Radial_Gradient (AMF.DG.Radial_Gradients.DG_Radial_Gradient_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant DG_Radial_Gradient_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.DG_Iterators.DG_Iterator'Class then AMF.Visitors.DG_Iterators.DG_Iterator'Class (Iterator).Visit_Radial_Gradient (Visitor, AMF.DG.Radial_Gradients.DG_Radial_Gradient_Access (Self), Control); end if; end Visit_Element; end AMF.Internals.DG_Radial_Gradients;
oeis/220/A220336.asm
neoneye/loda-programs
11
2715
; A220336: A modified Engel expansion for 4*sqrt(2) - 5. ; Submitted by <NAME> ; 2,4,6,2,18,34,2,578,1154,2,665858,1331714,2,886731088898,1773462177794,2,1572584048032918633353218,3145168096065837266706434,2,4946041176255201878775086487573351061418968498178,9892082352510403757550172975146702122837936996354 mov $5,2 lpb $0 sub $0,1 mul $1,$3 sub $3,$4 mul $3,2 mov $4,$2 mov $2,$3 add $2,$1 mul $2,2 add $3,$5 mov $1,$3 add $5,$4 mov $3,$5 mov $5,$4 lpe mov $0,$1 add $0,2
app/src/modules/Folder/pwm.asm
whxru/Mini-C
0
175773
<reponame>whxru/Mini-C .DATA .TEXT 0x1168 start: sh $a0,0xfc30($0) sh $a1,0xfc32($0) sh $a2,0xfc34($0) eret
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0x48.log_557_221.asm
ljhsiun2/medusa
9
89714
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r14 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x1e22b, %r12 nop dec %rsi movl $0x61626364, (%r12) nop nop nop add $24486, %r11 lea addresses_WC_ht+0x13a2b, %r14 cmp %rbx, %rbx movb (%r14), %r12b nop nop and %rsi, %rsi lea addresses_UC_ht+0x1ebfb, %r14 nop nop nop nop xor %rsi, %rsi movups (%r14), %xmm3 vpextrq $1, %xmm3, %rbp nop add $14610, %rbx lea addresses_A_ht+0x1bf4f, %rsi lea addresses_A_ht+0x1a9eb, %rdi nop nop nop nop nop dec %r12 mov $66, %rcx rep movsq nop nop nop nop nop add %rbx, %rbx lea addresses_A_ht+0x1122b, %rsi lea addresses_normal_ht+0xec2b, %rdi cmp $39269, %rbp mov $38, %rcx rep movsl nop xor %rbx, %rbx lea addresses_UC_ht+0x1125, %rcx nop cmp $32799, %rsi mov $0x6162636465666768, %rbp movq %rbp, %xmm3 movups %xmm3, (%rcx) nop nop nop add $27984, %r11 lea addresses_WT_ht+0xd2b, %rsi lea addresses_UC_ht+0x16a2b, %rdi and %rbx, %rbx mov $109, %rcx rep movsq nop inc %rbx lea addresses_A_ht+0x124b9, %r14 nop cmp %r12, %r12 mov $0x6162636465666768, %rdi movq %rdi, %xmm4 movups %xmm4, (%r14) add %rbp, %rbp lea addresses_WT_ht+0x1262b, %rbp nop nop nop add $38294, %r11 mov (%rbp), %rsi nop nop and %rcx, %rcx lea addresses_D_ht+0x922b, %rsi lea addresses_WC_ht+0x173ed, %rdi nop xor $20734, %r11 mov $16, %rcx rep movsl nop nop nop nop nop and %rsi, %rsi lea addresses_UC_ht+0x842b, %rsi lea addresses_WT_ht+0x129d2, %rdi clflush (%rdi) nop nop inc %rbp mov $3, %rcx rep movsl nop dec %r14 lea addresses_A_ht+0x1ce2b, %rsi lea addresses_WC_ht+0x131bb, %rdi clflush (%rdi) nop nop nop sub %r11, %r11 mov $25, %rcx rep movsw nop nop nop nop nop add %rbp, %rbp lea addresses_WT_ht+0x19a2b, %rbp nop add %rsi, %rsi mov $0x6162636465666768, %rdi movq %rdi, (%rbp) nop nop xor $755, %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r14 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r13 push %rax push %rdi push %rdx // Store lea addresses_PSE+0x141db, %rdx cmp %r10, %r10 movl $0x51525354, (%rdx) nop add $46618, %rdx // Store lea addresses_WT+0xc3ab, %r10 nop nop nop add %rdi, %rdi movw $0x5152, (%r10) nop nop cmp $28774, %r10 // Store lea addresses_A+0x12a2b, %r11 clflush (%r11) nop nop nop sub %r12, %r12 mov $0x5152535455565758, %rdx movq %rdx, (%r11) nop nop xor $31386, %r11 // Store lea addresses_UC+0x1fc2b, %r11 nop nop and %r13, %r13 movl $0x51525354, (%r11) inc %r12 // Faulty Load lea addresses_A+0x12a2b, %r13 nop nop nop nop nop inc %r10 mov (%r13), %rdx lea oracles, %rdi and $0xff, %rdx shlq $12, %rdx mov (%rdi,%rdx,1), %rdx pop %rdx pop %rdi pop %rax pop %r13 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 6, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': True, 'congruent': 9, 'size': 4, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 11, 'size': 4, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': True, 'congruent': 8, 'size': 8, 'same': True, 'NT': False}} {'58': 557} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
Sources/Globe_3d/globe_3d-portals.ads
ForYouEyesOnly/Space-Convoy
1
18188
package GLOBE_3D.Portals is -- Methods provided for clipping through screen rectangles procedure Intersect (A, B : Rectangle; C : out Rectangle; non_empty : out Boolean); procedure Find_bounding_box ( o : Object_3D'Class; face : Positive; b : out Rectangle; success : out Boolean ); procedure Draw_boundary (main, clip : Rectangle); end GLOBE_3D.Portals;
src/main/fragment/mos6502-common/vboyy=vbom1.asm
jbrandwood/kickc
2
245103
ldy {m1}
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_51.asm
ljhsiun2/medusa
9
242891
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r15 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_UC_ht+0xbc9c, %r9 nop sub %rax, %rax movl $0x61626364, (%r9) nop and %rsi, %rsi lea addresses_normal_ht+0x874c, %r15 nop nop nop cmp %rcx, %rcx movb (%r15), %al nop cmp $17327, %rcx lea addresses_WC_ht+0xe89c, %rcx nop nop nop cmp %r10, %r10 vmovups (%rcx), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $1, %xmm6, %r15 nop nop nop dec %rax lea addresses_WT_ht+0x38b4, %rsi lea addresses_D_ht+0x89c, %rdi nop inc %rax mov $49, %rcx rep movsb and %r9, %r9 lea addresses_WC_ht+0x1349c, %rsi nop nop nop nop nop inc %rcx movw $0x6162, (%rsi) xor %rax, %rax lea addresses_WC_ht+0x1ce3c, %r9 nop nop sub $56166, %rax movb $0x61, (%r9) nop nop nop nop dec %rcx lea addresses_A_ht+0x3746, %rsi lea addresses_normal_ht+0x2e9c, %rdi sub $894, %r12 mov $122, %rcx rep movsb and $21106, %r12 lea addresses_WC_ht+0x1a09c, %rsi lea addresses_D_ht+0x1e0dc, %rdi nop nop nop nop cmp %r15, %r15 mov $38, %rcx rep movsl add $11542, %rdi lea addresses_A_ht+0x29c, %r10 lfence mov (%r10), %edi nop nop xor %rdi, %rdi lea addresses_D_ht+0x10834, %rsi lea addresses_UC_ht+0x1edc, %rdi nop xor $56325, %r10 mov $32, %rcx rep movsw nop nop nop nop cmp $59994, %rsi lea addresses_A_ht+0x1d71c, %rsi lea addresses_D_ht+0x2b00, %rdi clflush (%rdi) nop and $15336, %r15 mov $6, %rcx rep movsl nop nop nop nop dec %r10 lea addresses_WT_ht+0x114c0, %r10 sub $8035, %r15 movw $0x6162, (%r10) nop nop nop cmp $26781, %r12 lea addresses_UC_ht+0xf89c, %rsi lea addresses_A_ht+0xa3a0, %rdi cmp %r10, %r10 mov $11, %rcx rep movsq nop nop cmp $30938, %rax pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r15 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %rax push %rcx push %rdi // Faulty Load lea addresses_RW+0x509c, %r10 clflush (%r10) nop nop nop nop cmp %rcx, %rcx mov (%r10), %r14w lea oracles, %rdi and $0xff, %r14 shlq $12, %r14 mov (%rdi,%r14,1), %r14 pop %rdi pop %rcx pop %rax pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 2, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': True, 'size': 1, 'NT': True, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 0, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}} {'src': {'congruent': 9, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 4, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': True, 'type': 'addresses_A_ht'}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
2020 Fall E C E 252/HW10/item16.asm
jsswd888/2020_FALL_UW_MADISON
0
178296
<filename>2020 Fall E C E 252/HW10/item16.asm .ORIG x0200 START ; LD R0, S1 ; ST R0, S2 ADD R0, R0, #0 BRp APPLE BRnz BANANA BR ORANGE APPLE ADD R1, R2, R3 BANANA ADD R4, R5, R6 ORANGE ADD R0, R1, R4 DONE BR DONE S1 .STRINGZ "XYZ" S2 .STRINGZ "123" .END
lang/german/ptab.asm
olifink/smsqe
0
102421
; Text for printer aborted section language xdef met_ptab met_ptab dc.b 0,27,'******* ABGEBROCHEN *******' end
Driver/Keyboard/Canadian/CSA-z243.200-91/keyboard.asm
steakknife/pcgeos
504
171193
<filename>Driver/Keyboard/Canadian/CSA-z243.200-91/keyboard.asm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC/GEOS FILE: keyboard.asm AUTHOR: <NAME>, Jul 8, 1991 REVISION HISTORY: Name Date Description ---- ---- ----------- Gene 7/ 8/91 Initial revision DESCRIPTION: Manager file for keyboard driver $Id: keyboard.asm,v 1.1 97/04/18 11:47:25 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ include keyboardGeode.def include keyboardConstant.def idata segment ; ; number of accentables ; _NUM_ACCENTABLES equ KBD_NUM_ACCENTABLES include kmapCanCSA.def idata ends include keyboardVariable.def include keyboardHotkey.asm include keyboardInit.asm include keyboardProcess.asm include keyboardUtils.asm KbdExtendedInfoSeg segment lmem LMEM_TYPE_GENERAL DriverExtendedInfoTable < {}, length kbdNameTable, offset kbdNameTable, 0 > kbdNameTable lptr.char kbdStr lptr.char 0 kbdStr chunk.char "CAN/CSA-Z243.200-91 Keyboard",0 KbdExtendedInfoSeg ends end
maps/RivalHouse1F.asm
AtmaBuster/pokeplat-gen2
6
12978
object_const_def ; object_event constants const RIVALHOUSE1F_OBJECT1 RivalHouse1F_MapScripts: db 0 ; scene scripts db 0 ; callbacks RivalHouse1F_RivalsMomScript: faceplayer checkevent EVENT_TALKED_TO_RIVAL_IN_ROOM iftrue .AfterRival jumptext .CallingOnRivalText .AfterRival: checkevent EVENT_TALKED_TO_RIVALS_MOM_AFTER_RIVAL iftrue .SecondTalk setevent EVENT_TALKED_TO_RIVALS_MOM_AFTER_RIVAL jumptext .RocketedOffText .SecondTalk: checkevent EVENT_GOT_STARTER iftrue .AfterMon jumptext .WaitingText .AfterMon: checkevent EVENT_GOT_POKEDEX iftrue .AfterDex jumptext .AfterMonText .AfterDex: jumptext .AfterDexText .CallingOnRivalText: text "<RIVAL>'s MOM: Oh," line "hi, <PLAYER>." para "Are you looking" line "for <RIVAL>?" para "He was gone for a" line "second, but then" cont "he came running" cont "right back home." para "He just can't sit" line "still. Who does he" cont "take after?" done .RocketedOffText: text "<RIVAL>'s MOM: That" line "kid rocketed off" cont "again like usual." para "I'd guess he would" line "be at ROUTE 201 by" cont "now." para "He just can't sit" line "still. Who does he" cont "take after?" done .WaitingText: text "<RIVAL>'s MOM: My" line "<RIVAL> should be" cont "out on ROUTE 201" cont "by now." para "He just can't sit" line "still. Who does he" cont "take after?" done .AfterMonText: text "<RIVAL>'s MOM: Oh," line "you've become" cont "friends with a" cont "#MON, too." done .AfterDexText: text "<RIVAL>'s MOM: My" line "<RIVAL> took off" cont "like a rocket as" cont "usual." para "He was shouting" line "something about" cont "becoming the" cont "greatest TRAINER" cont "ever…" para "He just can't sit" line "still. Who does he" cont "take after?" done RivalHouse1F_MapEvents: db 0, 0 ; filler db 3 ; warp events warp_event 6, 7, TWINLEAF_TOWN, 2 warp_event 7, 7, TWINLEAF_TOWN, 2 warp_event 9, 0, RIVAL_HOUSE_2F, 1 db 0 ; coord events db 0 ; bg events db 1 ; object events object_event 7, 4, SPRITE_POKEFAN_F, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, RivalHouse1F_RivalsMomScript, -1
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0x48.log_21829_1366.asm
ljhsiun2/medusa
9
13487
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %rbx push %rcx push %rdi push %rsi lea addresses_WT_ht+0x14b86, %rsi lea addresses_WC_ht+0x16f06, %rdi nop add %rbx, %rbx mov $41, %rcx rep movsb nop nop nop cmp $22175, %rbx pop %rsi pop %rdi pop %rcx pop %rbx ret .global s_faulty_load s_faulty_load: push %r10 push %r15 push %r8 push %r9 push %rdi push %rdx push %rsi // Store mov $0x106, %rdx nop nop nop nop nop add $14115, %r8 mov $0x5152535455565758, %r15 movq %r15, (%rdx) nop nop nop cmp $6907, %r9 // Store mov $0xf06, %r9 sub %rsi, %rsi movb $0x51, (%r9) and $32341, %r9 // Store lea addresses_PSE+0x1f706, %rdx nop nop nop nop dec %r8 mov $0x5152535455565758, %rsi movq %rsi, (%rdx) nop nop cmp $44084, %rdi // Faulty Load lea addresses_PSE+0x1f706, %r15 nop nop nop nop inc %rdx mov (%r15), %r9 lea oracles, %rdi and $0xff, %r9 shlq $12, %r9 mov (%rdi,%r9,1), %r9 pop %rsi pop %rdx pop %rdi pop %r9 pop %r8 pop %r15 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}} {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
PIC/FILO.asm
StxGuy/EmbeddedSystems
0
198
<filename>PIC/FILO.asm ;-----------------------------; ; STACK/FILO FOR PIC ; ; ; ; Por: Prof. <NAME> ; ; 03/Sep/2020 ; ;-----------------------------; list p = 16f877a ; Specify processor include <p16f877a.inc> ; Include mapping tmp equ 0x20 ; byte to be tested stack equ 0x21 ; counter org 0x00 ; Program starts at 0x00 goto INICIO INICIO: movlw 0x22 ; Initialize the stack movwf stack movlw 0x1A ; Push 0x1A and 0x1B call PUSH movlw 0x1B call PUSH nop call POP movwf tmp ; Store it in tmp for visualization call POP movwf tmp goto FIM PUSH: movwf tmp ; Store W movf stack,0 ; Pointer to the stack movwf FSR movf tmp,0 ; Recover data to be stored movwf INDF ; push data into stack incf stack,1 ; stack ++ return POP: decf stack,1 ; stack -- movf stack,0 ; Pointer to the stack movwf FSR movf INDF,0 return FIM: nop END
programs/oeis/168/A168194.asm
neoneye/loda
22
169804
<filename>programs/oeis/168/A168194.asm<gh_stars>10-100 ; A168194: a(n) = n^4*(n^3 + 1)/2. ; 0,1,72,1134,8320,39375,140616,412972,1050624,2394765,5005000,9750906,17926272,31388539,52725960,85455000,134250496,205211097,306162504,447001030,640080000,900641511,1247296072,1702552644,2293401600,3051953125,4016133576,5230442322,6746771584,8625291795,10935405000,13756768816,17180393472,21309814449,26262343240,32170398750,39182921856,47466875647,57208833864,68616660060,81921280000,97378549821,115271222472,135911014954,159640778880,186836776875,217911067336,253314000072,293536825344,339114418825,390628125000,448708721526,514039507072,587359515159,669466856520,761222192500,863552342016,977454024597,1103997742024,1244331801090,1399686480000,1571378340931,1760814691272,1969498196064,2199031644160,2451122870625,2727589837896,3030365878222,3361505099904,3723187959855,4117727005000,4547572785036,5015319939072,5523713458669,6075655129800,6674210156250,7322613966976,8024279209947,8782802934984,9601973968120,10485780480000,11438417750841,12464296134472,13568049223974,14754542221440,16028880514375,17396418461256,18862768388772,20433809803264,22115698818885,23914877805000,25838085255346,27892365881472,30085080932979,32423918747080,34916905530000,37572416372736,40399186503697,43406322780744,46603315425150 mov $1,$0 pow $0,4 pow $1,7 add $0,$1 div $0,2
programs/oeis/073/A073556.asm
neoneye/loda
22
88895
; A073556: Number of Fibonacci numbers F(k), k <= 10^n, which end in 9. ; 0,13,133,1333,13333,133333,1333333,13333333,133333333,1333333333,13333333333,133333333333,1333333333333,13333333333333,133333333333333,1333333333333333,13333333333333333,133333333333333333,1333333333333333333,13333333333333333333,133333333333333333333,1333333333333333333333,13333333333333333333333 mov $1,1 lpb $0 mov $1,$0 mov $0,0 seq $1,73553 ; Number of Fibonacci numbers F(k), k <= 10^n, which end in 5. lpe sub $1,1 mov $0,$1
old/Homotopy/VanKampen/Guide.agda
timjb/HoTT-Agda
294
7874
<gh_stars>100-1000 {-# OPTIONS --without-K #-} open import Base module Homotopy.VanKampen.Guide where open import Homotopy.Truncation open import Homotopy.Connected record legend i (city : Set i) : Set (suc i) where constructor leg_,_,_ field name : Set i loc : name → city all-listed : ∀ c → [ hfiber loc c ] id-legend : ∀ {i} (A : Set i) → legend i A id-legend A = leg A , id A , λ x → proj $ x , refl private module Book {i} {city : Set i} {l : legend i city} where open legend l private data #guide : Set i where #point : name → #guide guide : Set i guide = #guide point : name → guide point = #point postulate -- HIT route : ∀ n₁ n₂ → loc n₁ ≡ loc n₂ → point n₁ ≡ point n₂ guide-rec : ∀ {l} (P : guide → Set l) (point* : (n : name) → P (point n)) (route* : ∀ n₁ n₂ (p : loc n₁ ≡ loc n₂) → transport P (route n₁ n₂ p) (point* n₁) ≡ point* n₂) → (x : guide) → P x guide-rec P point* route* (#point n) = point* n postulate -- HIT guide-β-route : ∀ {l} (P : guide → Set l) (point* : (n : name) → P (point n)) (route* : ∀ n₁ n₂ (p : loc n₁ ≡ loc n₂) → transport P (route n₁ n₂ p) (point* n₁) ≡ point* n₂) n₁ n₂ (p : loc n₁ ≡ loc n₂) → apd (guide-rec {l} P point* route*) (route n₁ n₂ p) ≡ route* n₁ n₂ p guide-rec-nondep : ∀ {l} (P : Set l) (point* : name → P) (route* : ∀ n₁ n₂ → loc n₁ ≡ loc n₂ → point* n₁ ≡ point* n₂) → (guide → P) guide-rec-nondep P point* route* (#point n) = point* n postulate -- HIT guide-β-route-nondep : ∀ {l} (P : Set l) (point* : name → P) (route* : ∀ n₁ n₂ → loc n₁ ≡ loc n₂ → point* n₁ ≡ point* n₂) n₁ n₂ (p : loc n₁ ≡ loc n₂) → ap (guide-rec-nondep P point* route*) (route n₁ n₂ p) ≡ route* n₁ n₂ p open Book public hiding (guide) module _ {i} {city : Set i} (l : legend i city) where open legend l guide : Set i guide = Book.guide {i} {city} {l} visit : guide → city visit = guide-rec-nondep city loc (λ _ _ p → p) visit-β-route : ∀ n₁ n₂ (p : loc n₁ ≡ loc n₂) → ap visit (route n₁ n₂ p) ≡ p visit-β-route = guide-β-route-nondep city loc (λ _ _ p → p) private drawn-as-one : ∀ c → is-contr (π₀ $ hfiber visit c) drawn-as-one c = []-extend-nondep ⦃ is-connected-is-prop ⟨0⟩ ⦄ ( λ {(n₁ , p₁) → proj (point n₁ , p₁) , π₀-extend ⦃ λ _ → ≡-is-set $ π₀-is-set $ hfiber visit c ⦄ ( uncurry $ guide-rec (λ x → ∀ p₂ → proj (x , p₂) ≡ proj (point n₁ , p₁)) (λ n₂ p₂ → ap proj let p₃ = p₂ ∘ ! p₁ in Σ-eq (route n₂ n₁ p₃) $ transport (λ x → visit x ≡ c) (route n₂ n₁ p₃) p₂ ≡⟨ trans-app≡cst visit c (route n₂ n₁ p₃) p₂ ⟩ ! (ap visit (route n₂ n₁ p₃)) ∘ p₂ ≡⟨ ap (λ x → ! x ∘ p₂) $ visit-β-route n₂ n₁ p₃ ⟩ ! (p₂ ∘ ! p₁) ∘ p₂ ≡⟨ ap (λ x → x ∘ p₂) $ opposite-concat p₂ (! p₁) ⟩ (! (! p₁) ∘ ! p₂) ∘ p₂ ≡⟨ concat-assoc (! (! p₁)) (! p₂) p₂ ⟩ ! (! p₁) ∘ (! p₂ ∘ p₂) ≡⟨ ap (λ x → ! (! p₁) ∘ x) $ opposite-left-inverse p₂ ⟩ ! (! p₁) ∘ refl ≡⟨ refl-right-unit $ ! (! p₁) ⟩ ! (! p₁) ≡⟨ opposite-opposite p₁ ⟩∎ p₁ ∎) (λ _ _ _ → funext λ _ → prop-has-all-paths (π₀-is-set _ _ _) _ _))}) (all-listed c) private visit-fiber-rec′ : ∀ {j} (P : city → Set j) (h₀-point : ∀ n → P (loc n)) (h₁-route : ∀ n₁ n₂ r → transport P r (h₀-point n₁) ≡ h₀-point n₂) → (∀ c → hfiber visit c → P c) visit-fiber-rec′ P h₀-p h₁-r c (pt , p₁) = transport P p₁ $ guide-rec (P ◯ visit) h₀-p (λ n₁ n₂ r → transport (P ◯ visit) (route n₁ n₂ r) (h₀-p n₁) ≡⟨ ! $ trans-ap P visit (route n₁ n₂ r) $ h₀-p n₁ ⟩ transport P (ap visit $ route n₁ n₂ r) (h₀-p n₁) ≡⟨ ap (λ x → transport P x $ h₀-p n₁) $ visit-β-route n₁ n₂ r ⟩ transport P r (h₀-p n₁) ≡⟨ h₁-r n₁ n₂ r ⟩∎ h₀-p n₂ ∎) pt visit-fiber-rec : ∀ {j} (P : city → Set j) ⦃ _ : ∀ (c : city) → is-set $ P c ⦄ (h₀-point : ∀ n → P (loc n)) (h₁-route : ∀ n₁ n₂ r → transport P r (h₀-point n₁) ≡ h₀-point n₂) → (∀ c → P c) visit-fiber-rec P ⦃ P-is-set ⦄ h₀-p h₁-r c = π₀-extend-nondep ⦃ P-is-set c ⦄ (visit-fiber-rec′ P h₀-p h₁-r c) (π₁ $ drawn-as-one c) visit-fiber-β-loc : ∀ {j} (P : city → Set j) ⦃ P-is-set : ∀ (c : city) → is-set $ P c ⦄ (h₀-p : ∀ n → P (loc n)) (h₁-r : ∀ n₁ n₂ r → transport P r (h₀-p n₁) ≡ h₀-p n₂) → ∀ n → visit-fiber-rec P ⦃ P-is-set ⦄ h₀-p h₁-r (loc n) ≡ h₀-p n visit-fiber-β-loc P ⦃ P-is-set ⦄ h₀-p h₁-r n = visit-fiber-rec P ⦃ P-is-set ⦄ h₀-p h₁-r (loc n) ≡⟨ ap (π₀-extend-nondep ⦃ P-is-set $ loc n ⦄ (visit-fiber-rec′ P h₀-p h₁-r $ loc n)) $ ! $ π₂ (drawn-as-one $ loc n) (proj $ point n , refl) ⟩∎ h₀-p n ∎ private loc-fiber-rec′ : ∀ {j} (P : city → Set j) (h₀-point : ∀ n → P (loc n)) → (∀ c → hfiber loc c → P c) loc-fiber-rec′ P h₀-p c (n , p) = transport P p (h₀-p n) loc-fiber-rec : ∀ {j} (P : city → Set j) ⦃ _ : ∀ c → is-prop $ P c ⦄ (h₀-point : ∀ n → P (loc n)) → (∀ c → P c) loc-fiber-rec P ⦃ P-is-prop ⦄ h₀-p c = []-extend-nondep ⦃ P-is-prop c ⦄ (loc-fiber-rec′ P h₀-p c) (all-listed c) loc-fiber-β-loc : ∀ {j} (P : city → Set j) ⦃ P-is-prop : ∀ (c : city) → is-prop $ P c ⦄ (h₀-p : ∀ n → P (loc n)) → ∀ n → loc-fiber-rec P ⦃ P-is-prop ⦄ h₀-p (loc n) ≡ h₀-p n loc-fiber-β-loc P ⦃ P-is-prop ⦄ h₀-p n = loc-fiber-rec P ⦃ P-is-prop ⦄ h₀-p (loc n) ≡⟨ ap ([]-extend-nondep ⦃ P-is-prop $ loc n ⦄ (loc-fiber-rec′ P h₀-p $ loc n)) $ prop-has-all-paths []-is-prop (all-listed $ loc n) $ proj $ n , refl ⟩∎ h₀-p n ∎ -- Did I preserve the computational contents for identity legend? private module IdTest {i} {city : Set i} where open legend (id-legend city) visit-fiber-β-id : ∀ {j} (P : city → Set j) ⦃ P-is-set : ∀ (c : city) → is-set $ P c ⦄ (h₀-p : ∀ n → P n) (h₁-r : ∀ n₁ n₂ r → transport P r (h₀-p n₁) ≡ h₀-p n₂) → ∀ n → visit-fiber-rec (id-legend city) P ⦃ P-is-set ⦄ h₀-p h₁-r n ≡ h₀-p n visit-fiber-β-id P ⦃ P-is-set ⦄ h₀-p h₁-r n = refl loc-fiber-β-id : ∀ {j} (P : city → Set j) ⦃ P-is-prop : ∀ (c : city) → is-prop $ P c ⦄ (h₀-p : ∀ n → P n) → ∀ n → loc-fiber-rec (id-legend city) P ⦃ P-is-prop ⦄ h₀-p n ≡ h₀-p n loc-fiber-β-id P ⦃ P-is-prop ⦄ h₀-p n = refl
library/fmGUI_ManageScripts/fmGUI_ManageScripts_SearchBoxFind.applescript
NYHTC/applescript-fm-helper
1
844
-- fmGUI_ManageScripts_SearchBoxFind({searchCriteria:null, delayTime:0.25, maxDelay:2, delayIncreaseBy:0.25}) -- <NAME>, NYHTC -- Specify the contents of the search box in the Script Workspace, which activates a live-filter type of search. (* HISTORY 2020-03-03 ( dshockley, hdu ): Updated as standalone function for fm-scripts git repository. 2017-06-07 ( eshagdar ): created. REQUIRES: fmGUI_AppFrontMost fmGUI_ManageScripts_Open *) on run fmGUI_ManageScripts_SearchBoxFind({}) end run -------------------- -- START OF CODE -------------------- on fmGUI_ManageScripts_SearchBoxFind(prefs) -- version 2020-03-04-1528 try set defaultPrefs to {searchCriteria:null, delayTime:0.25, maxDelay:2, delayIncreaseBy:0.25} set prefs to prefs & defaultPrefs fmGUI_AppFrontMost() fmGUI_ManageScripts_Open({}) tell application "System Events" tell application process "FileMaker Pro Advanced" set searchField to text field 1 of splitter group 1 of window 1 set focused of searchField to true delay delayTime of prefs keystroke "a" using command down delay 0.01 key code 51 -- clear the search box delay delayTime of prefs set value of searchField to searchCriteria of prefs keystroke tab set isSearchFound to false if value of searchField is equal to searchCriteria of prefs then set isSearchFound to true end tell end tell if isSearchFound then -- successfully managed to search return true else if delayTime of prefs is less than maxDelay of prefs then -- not enough delay, so try again fmGUI_ManageScripts_SearchBoxFind({delayTime:(delayTime of prefs) + (delayIncreaseBy of prefs)} & prefs) else -- failed to seach, even with max delay return false end if on error errMsg number errNum error "Couldn't fmGUI_ManageScripts_SearchBoxFind - " & errMsg number errNum end try end fmGUI_ManageScripts_SearchBoxFind -------------------- -- END OF CODE -------------------- on fmGUI_AppFrontMost() tell application "htcLib" to fmGUI_AppFrontMost() end fmGUI_AppFrontMost on fmGUI_ManageScripts_Open(prefs) tell application "htcLib" to fmGUI_ManageScripts_Open(prefs) end fmGUI_ManageScripts_Open
internal/iantlr/gengine.g4
Cluas/gengine
0
3110
grammar gengine; primary: ruleEntity+; ruleEntity: RULE ruleName ruleDescription? salience? BEGIN ruleContent END; ruleName : stringLiteral; ruleDescription : stringLiteral; salience : SALIENCE integer; ruleContent : statements; statements: statement* returnStmt? ; statement : ifStmt | functionCall | methodCall | threeLevelCall | assignment | concStatement ; concStatement : CONC LR_BRACE ( functionCall | methodCall | threeLevelCall | assignment )* RR_BRACE; expression : mathExpression | expression comparisonOperator expression | expression logicalOperator expression | notOperator ? expressionAtom | notOperator ? LR_BRACKET expression RR_BRACKET ; mathExpression : mathExpression mathMdOperator mathExpression | mathExpression mathPmOperator mathExpression | expressionAtom | LR_BRACKET mathExpression RR_BRACKET ; expressionAtom : functionCall | methodCall | threeLevelCall | constant | mapVar | variable ; assignment : (mapVar | variable) assignOperator (mathExpression| expression); returnStmt : RETURN expression?; ifStmt : IF expression LR_BRACE statements RR_BRACE elseIfStmt* elseStmt? ; elseIfStmt : ELSE IF expression LR_BRACE statements RR_BRACE; elseStmt : ELSE LR_BRACE statements RR_BRACE; constant : booleanLiteral | integer | realLiteral | stringLiteral | atName | atId | atDesc | atSal ; functionArgs : (constant | variable | functionCall | methodCall | threeLevelCall | mapVar | expression) (','(constant | variable | functionCall | methodCall | threeLevelCall | mapVar | expression))* ; integer : MINUS? INT; realLiteral : MINUS? REAL_LITERAL; stringLiteral: DQUOTA_STRING ; booleanLiteral : TRUE | FALSE; functionCall : SIMPLENAME LR_BRACKET functionArgs? RR_BRACKET; methodCall : DOTTEDNAME LR_BRACKET functionArgs? RR_BRACKET; threeLevelCall : DOUBLEDOTTEDNAME LR_BRACKET functionArgs? RR_BRACKET; variable : SIMPLENAME | DOTTEDNAME | DOUBLEDOTTEDNAME; mathPmOperator : PLUS | MINUS ; mathMdOperator : MUL | DIV ; comparisonOperator : GT | LT | GTE | LTE | EQUALS | NOTEQUALS ; logicalOperator : AND | OR ; assignOperator: ASSIGN | SET | PLUSEQUAL | MINUSEQUAL | MULTIEQUAL | DIVEQUAL ; notOperator: NOT; mapVar: variable LSQARE (integer |stringLiteral | variable ) RSQARE; atName : '@name'; atId : '@id'; atDesc : '@desc'; atSal : '@sal'; fragment DEC_DIGIT : [0-9]; fragment A : [aA] ; fragment B : [bB] ; fragment C : [cC] ; fragment D : [dD] ; fragment E : [eE] ; fragment F : [fF] ; fragment G : [gG] ; fragment H : [hH] ; fragment I : [iI] ; fragment J : [jJ] ; fragment K : [kK] ; fragment L : [lL] ; fragment M : [mM] ; fragment N : [nN] ; fragment O : [oO] ; fragment P : [pP] ; fragment Q : [qQ] ; fragment R : [rR] ; fragment S : [sS] ; fragment T : [tT] ; fragment U : [uU] ; fragment V : [vV] ; fragment W : [wW] ; fragment X : [xX] ; fragment Y : [yY] ; fragment Z : [zZ] ; fragment EXPONENT_NUM_PART : ('E'| 'e') '-'? DEC_DIGIT+; NIL : N I L; RULE : R U L E ; AND : '&&' ; OR : '||' ; CONC : C O N C; IF : I F; ELSE : E L S E; RETURN : R E T U R N; TRUE : T R U E ; FALSE : F A L S E ; NULL_LITERAL : N U L L ; SALIENCE : S A L I E N C E ; BEGIN : B E G I N; END : E N D; SIMPLENAME : ('a'..'z' |'A'..'Z'| '_')+ ( ('0'..'9') | ('a'..'z' |'A'..'Z') | '_' )* ; INT : '0'..'9' + ; PLUS : '+' ; MINUS : '-' ; DIV : '/' ; MUL : '*' ; EQUALS : '==' ; GT : '>' ; LT : '<' ; GTE : '>=' ; LTE : '<=' ; NOTEQUALS : '!=' ; NOT : '!' ; ASSIGN : ':=' ; SET : '='; PLUSEQUAL : '+='; MINUSEQUAL : '-='; MULTIEQUAL : '*='; DIVEQUAL : '/='; LSQARE : '[' ; RSQARE : ']' ; SEMICOLON : ';' ; LR_BRACE : '{'; RR_BRACE : '}'; LR_BRACKET : '('; RR_BRACKET : ')'; DOT : '.' ; DQUOTA_STRING : '"' ( '\\'. | '""' | ~('"'| '\\') )* '"'; DOTTEDNAME : SIMPLENAME DOT SIMPLENAME ; DOUBLEDOTTEDNAME : SIMPLENAME DOT SIMPLENAME DOT SIMPLENAME; REAL_LITERAL : (DEC_DIGIT+)? '.' DEC_DIGIT+ | DEC_DIGIT+ '.' EXPONENT_NUM_PART | (DEC_DIGIT+)? '.' (DEC_DIGIT+ EXPONENT_NUM_PART) | DEC_DIGIT+ EXPONENT_NUM_PART ; SL_COMMENT: '//' .*? '\n' -> skip ; WS : [ \t\n\r]+ -> skip ;
notes/FOT/Common/FOL/Existential/Elimination.agda
asr/fotc
11
6795
----------------------------------------------------------------------------- -- Existential elimination ----------------------------------------------------------------------------- {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOT.Common.FOL.Existential.Elimination where ----------------------------------------------------------------------------- postulate D : Set module ∃₁ where -- Type theoretical version -- We add 3 to the fixities of the Agda standard library 0.8.1 (see -- Data/Product.agda). infixr 7 _,_ -- The existential quantifier type on D. data ∃ (A : D → Set) : Set where _,_ : (x : D) → A x → ∃ A -- Sugar syntax for the existential quantifier. syntax ∃ (λ x → e) = ∃[ x ] e -- The existential proyections. ∃-proj₁ : ∀ {A} → ∃ A → D ∃-proj₁ (x , _) = x ∃-proj₂ : ∀ {A} → (h : ∃ A) → A (∃-proj₁ h) ∃-proj₂ (_ , Ax) = Ax -- Some examples -- The order of quantifiers of the same sort is irrelevant. ∃-ord : {A² : D → D → Set} → (∃[ x ] ∃[ y ] A² x y) → (∃[ y ] ∃[ x ] A² x y) ∃-ord (x , y , h) = y , x , h ----------------------------------------------------------------------------- module ∃₂ where -- First-order logic version -- We add 3 to the fixities of the Agda standard library 0.8.1 (see -- Data/Product.agda). infixr 7 _,_ -- The existential quantifier type on D. data ∃ (A : D → Set) : Set where _,_ : (x : D) → A x → ∃ A -- Sugar syntax for the existential quantifier. syntax ∃ (λ x → e) = ∃[ x ] e -- Existential elimination -- ∃x.A(x) A(x) → B -- ------------------------ -- B -- NB. We do not use the usual type theory elimination with two -- projections because we are working in first-order logic where we -- do need extract a witness from an existence proof. ∃-elim : {A : D → Set}{B : Set} → ∃ A → ((x : D) → A x → B) → B ∃-elim (x , Ax) h = h x Ax -- Some examples -- The order of quantifiers of the same sort is irrelevant. ∃-ord : {A² : D → D → Set} → (∃[ x ] ∃[ y ] A² x y) → (∃[ y ] ∃[ x ] A² x y) ∃-ord h = ∃-elim h (λ x h₁ → ∃-elim h₁ (λ y prf → y , x , prf)) -- A proof non-FOL valid non-FOL : {A : D → Set} → ∃ A → D non-FOL h = ∃-elim h (λ x _ → x) ----------------------------------------------------------------------------- module ∃₃ where -- First-order logic version -- A different version from the existential introduction -- A(x) -- ------------ -- ∃x.A(x) -- The existential quantifier type on D. data ∃ (A : D → Set) : Set where ∃-intro : ((x : D) → A x) → ∃ A -- Sugar syntax for the existential quantifier. syntax ∃ (λ x → e) = ∃[ x ] e postulate d : D -- Existential elimination. -- NB. It is neccesary that D ≢ ∅. ∃-elim : {A : D → Set}{B : Set} → ∃ A → ((x : D) → A x → B) → B ∃-elim (∃-intro h₁) h₂ = h₂ d (h₁ d) -- Some examples -- Impossible -- thm : {A : D → Set} → ∃[ x ] A x → ∃[ y ] A y -- thm h = ∃-elim h (λ x prf → {!!})
software/atommc2/cfg.asm
AtomicRoland/AtomFpga
25
20367
<reponame>AtomicRoland/AtomFpga<gh_stars>10-100 ;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~ ; ; *PBD ([val]) ; ; *PBD - Print the current port B direction register in hex. ; *PBD 7F - Set the direction register. ; ; Port B is 8 bits wide and each bit's direction is independently controllable. ; A set bit in the direction register indicates an 1nput and a clear bit represents ; an 0utput. ; STARPBD: lda #CMD_GET_PORT_DDR sta $ce jmp do_cfg_cmd ;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~ ; ; *PBV ([val]) ; ; *PBV - Print the state of port B in hex. ; *PBV 7F - Write value to port B. ; ; If a port B bit is set as an input, you will read the value present on the port. ; If it is an output you will see the last value written to it. ; STARPBV: lda #CMD_READ_PORT sta $ce jmp do_cfg_cmd ;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~;~~ ; ; *CFG ([val]) ; ; *CFG - Print the current port B direction register in hex. ; *CFG NN - Set the config byte to the specified hex value. ; ; Bit 7 controls whether the boot loader is entered. 1 = enter, 0 = don't enter. ; 6 controls the action of the SHIFT key on boot. 1 = SHIFT+BREAK runs menu, 0 = menu runs unless SHIFT-BREAK pressed. ; 5 controls whether the interface generates an IRQ on reset. 1 = generate, 0 = don't. ; STARCFG: lda #CMD_GET_CFG_BYTE sta $ce ; fall into ... ; ; do_cmd_cfg: is used by *CFG, *PBD and *PBV ; ; It rlies on the set port code having a function code one more than the get port code : ; ; get value set value ; CMD_GET_PORT_DDR $A0 CMD_SET_PORT_DDR $A1 ; CMD_READ_PORT $A2 CMD_WRITE_PORT $A3 ; CMD_GET_CFG_BYTE $F0 CMD_SET_CFG_BYTE $F1 ; do_cfg_cmd: ldx #$cb ; scan parameter - print existing val if none jsr RDOPTAD bne @param1valid lda $ce ; read config register FASTCMD jsr HEXOUT jmp OSCRLF @param1valid: lda $cb ; get read parameter writeportFAST ALATCH_REG ; $b40e ; latch the value jsr interwritedelay ldx $ce ; Load function code inx ; change get code to put txa writeportFAST ACMD_REG ; $b40f rts
test/Succeed/Issue2894.agda
cruhland/agda
1,989
5745
record ⊤ : Set where no-eta-equality constructor tt data D : ⊤ → Set where d : (x : ⊤) → D x test : (g : D tt) → Set test (d tt) = ⊤
test/asm/quine.asm
dannye/rgbds
2
92279
<gh_stars>1-10 N:MACRO FOR I,_NARG SHIFT I PRINT STRSUB("\n\"\\ INRT1,ABCDEFGHMOPSUn_(+-:)",\1+1,1) SHIFT-I ENDR REPT _NARG-1 PRINT"\1," SHIFT ENDR PRINT"\1\n" ENDM N 5,28,18,10,12,6,19,0,15,19,6,3,4,9,24,5,10,6,16,0,21,17,4,15,7,3,4,0,20,6,4,5,7,3,21,7,6,21,22,11,25,1,2,23,2,1,2,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,1,9,2,8,26,8,9,8,29,0,21,17,4,15,7,27,4,0,14,5,13,6,0,6,14,20,7,3,24,5,10,6,16,27,8,0,20,6,4,5,7,1,2,8,9,1,0,21,17,4,15,7,0,14,5,13,6,0,20,6,4,5,7,1,2,8,2,23,1,0,14,5,13,18,0,3,5,3
oeis/097/A097250.asm
neoneye/loda-programs
11
163299
; A097250: Smallest m such that A097249(m) = n; from n=1 onwards, twice the primorials, 2*A002110(n). ; 1,4,12,60,420,4620,60060,1021020,19399380,446185740,12939386460,401120980260,14841476269620,608500527054420,26165522663340060,1229779565176982820,65178316954380089460,3845520700308425278140,234576762718813941966540,15716643102160534111758180,1115881660253397921934830780,81459361198498048301242646940,6435289534681345815798169108260,534129031378551702711248035985580,47537483792691101541301075202716620,4611135927891036849506204294663512140,465724728716994721800126633761014726140 seq $0,2110 ; Primorial numbers (first definition): product of first n primes. Sometimes written prime(n)#. mul $0,2 sub $0,1 mov $1,1 lpb $0 sub $1,$0 mov $0,$1 lpe add $0,1
resources/scripts/scrape/duckduckgo.ads
Elon143/Amass
7,053
15639
-- Copyright 2021 <NAME>. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. name = "DuckDuckGo" type = "scrape" function start() set_rate_limit(1) end function vertical(ctx, domain) local vurl = "https://html.duckduckgo.com/html/?q=site:" .. domain .. " -site:www." .. domain scrape(ctx, {['url']=vurl}) end
tools-src/gnu/gcc/gcc/ada/exp_vfpt.ads
enfoTek/tomato.linksys.e2000.nvram-mod
80
4059
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ V F P T -- -- -- -- S p e c -- -- -- -- $Revision$ -- -- -- Copyright (C) 1997 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains specialized routines for handling the expansion -- of arithmetic and conversion operations involving Vax format floating- -- point formats as used on the Vax and the Alpha. with Types; use Types; package Exp_VFpt is procedure Expand_Vax_Arith (N : Node_Id); -- The node N is an arithmetic node (N_Op_Abs, N_Op_Add, N_Op_Sub, -- N_Op_Div, N_Op_Mul, N_Op_Minus where the operands are in Vax -- float format. This procedure expands the necessary call. procedure Expand_Vax_Comparison (N : Node_Id); -- The node N is an arithmetic comparison node where the types to -- be compared are in Vax float format. This procedure expands the -- necessary call. procedure Expand_Vax_Conversion (N : Node_Id); -- The node N is a type conversion node where either the source or -- the target type, or both, are Vax floating-point type. procedure Expand_Vax_Real_Literal (N : Node_Id); -- The node N is a real literal node where the type is a Vax -- floating-point type. This procedure rewrites the node to eliminate -- the occurrence of such constants. end Exp_VFpt;
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c35505c.ada
best08618/asylo
7
1529
-- C35505C.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT CONSTRAINT_ERROR IS RAISED FOR 'SUCC' AND 'PRED', -- IF THE RETURNED VALUES WOULD BE OUTSIDE OF THE BASE TYPE, -- WHEN THE PREFIX IS A FORMAL DISCRETE TYPE WHOSE ACTUAL ARGUMENT -- IS A USER-DEFINED ENUMERATION TYPE. -- HISTORY: -- RJW 06/05/86 CREATED ORIGINAL TEST. -- VCL 08/19/87 REMOVED THE FUNCTION 'IDENT' IN THE GENERIC -- PROCEDURE 'P' AND REPLACED ALL CALLS TO 'IDENT' -- WITH "T'VAL(IDENT_INT(T'POS(...)))". WITH REPORT; USE REPORT; PROCEDURE C35505C IS TYPE B IS ('Z', 'X', Z, X); SUBTYPE C IS B RANGE 'X' .. Z; BEGIN TEST ( "C35505C", "CHECK THAT 'SUCC' AND 'PRED' RAISE " & "CONSTRAINT_ERROR APPROPRIATELY WHEN THE " & "PREFIX IS A FORMAL DISCRETE TYPE WHOSE " & "ARGUMENT IS A USER-DEFINED ENUMERATION TYPE" ); DECLARE GENERIC TYPE T IS (<>); STR : STRING; PROCEDURE P; PROCEDURE P IS BEGIN BEGIN IF T'PRED (T'VAL (IDENT_INT (T'POS (T'BASE'FIRST)))) = T'FIRST THEN FAILED ( "CONSTRAINT_ERROR NOT RAISED FOR " & STR & "'PRED - 1" ); ELSE FAILED ( "CONSTRAINT_ERROR NOT RAISED FOR " & STR & "'PRED - 2" ); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED FOR " & STR & "'PRED - 1" ); END; BEGIN IF T'SUCC (T'VAL (IDENT_INT (T'POS (T'BASE'LAST)))) = T'LAST THEN FAILED ( "CONSTRAINT_ERROR NOT RAISED FOR " & STR & "'SUCC - 1" ); ELSE FAILED ( "CONSTRAINT_ERROR NOT RAISED FOR " & STR & "'SUCC - 2" ); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED FOR " & STR & "'SUCC - 1" ); END; END P; PROCEDURE PB IS NEW P (B, "B"); PROCEDURE PC IS NEW P (C, "C"); BEGIN PB; PC; END; RESULT; END C35505C;
Transynther/x86/_processed/AVXALIGN/_st_zr_sm_/i7-7700_9_0xca_notsx.log_21829_1912.asm
ljhsiun2/medusa
9
243252
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r9 push %rbp push %rbx push %rdi lea addresses_A_ht+0xffec, %rbx clflush (%rbx) nop nop nop sub $48960, %r9 movb (%rbx), %r10b nop dec %rdi lea addresses_D_ht+0x950c, %r9 nop nop nop nop nop cmp $21791, %rdi movb (%r9), %bl nop nop nop nop add $8961, %rdi pop %rdi pop %rbx pop %rbp pop %r9 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r13 push %r8 push %rdi push %rdx // Store lea addresses_PSE+0x1e98, %r11 nop and $47985, %r13 movb $0x51, (%r11) nop nop nop add $29974, %r13 // Store lea addresses_PSE+0x198c, %r13 nop nop nop nop nop cmp $58633, %rdi mov $0x5152535455565758, %r11 movq %r11, (%r13) nop nop nop nop sub $24380, %r11 // Store lea addresses_UC+0x1520c, %rdx nop nop nop nop sub $604, %r10 movw $0x5152, (%rdx) nop dec %r12 // Store mov $0xf4c, %rdi nop nop nop nop and %r8, %r8 mov $0x5152535455565758, %rdx movq %rdx, %xmm2 movups %xmm2, (%rdi) nop cmp %r13, %r13 // Store lea addresses_D+0x1248c, %r10 nop nop nop nop nop sub $35292, %r13 mov $0x5152535455565758, %rdi movq %rdi, %xmm2 movups %xmm2, (%r10) nop nop sub %rdi, %rdi // Store mov $0x6c9e43000000084c, %r11 clflush (%r11) nop nop and $13124, %rdi movw $0x5152, (%r11) // Exception!!! nop nop nop mov (0), %r12 nop nop nop nop nop add $65424, %r11 // Faulty Load mov $0x6c9e43000000084c, %r8 nop inc %r13 mov (%r8), %r12d lea oracles, %r8 and $0xff, %r12 shlq $12, %r12 mov (%r8,%r12,1), %r12 pop %rdx pop %rdi pop %r8 pop %r13 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_NC'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_NC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'00': 2235, '52': 19594} 52 52 52 52 52 52 52 00 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 00 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 00 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 00 00 52 52 52 52 00 52 00 00 52 52 52 52 52 52 52 52 00 52 00 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 00 00 52 52 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 00 52 52 00 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 00 52 00 52 52 52 52 00 00 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 00 52 52 00 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 52 52 00 52 00 52 00 52 52 00 52 00 00 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 00 52 00 52 00 52 52 52 52 52 00 52 52 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 00 52 52 52 */
Driver/Printer/DotMatrix/Oki9/oki9ControlCodes.asm
steakknife/pcgeos
504
179067
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1990 -- All Rights Reserved PROJECT: PC GEOS MODULE: Okidata Print Driver FILE: oki9ControlCodes.asm AUTHOR: <NAME>, 1 March 1990 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 3/1/90 Initial revision Dave 5/92 Initial 2.0 version DC_ESCRIPTION: This file contains all the style setting routines for the oki9 driver. $Id: oki9ControlCodes.asm,v 1.1 97/04/18 11:53:41 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ;***************************************************************************** ; ;CONTROL CODES FOR THE OKI 9-PIN PRINTERS..... ; ; the first byte is the byte count for the control code. ; ;***************************************************************************** ;__________Job Control______________________________________ pr_codes_ResetPrinter label byte byte 1 byte C_DC1 ;enable printing. pr_codes_InitPrinter label byte byte 15 ;byte count byte C_ESC,"%C001" ;set margin all the way to left. byte 01eh ;set 10-pitch byte C_ESC,04bh ;reset superscript byte C_ESC,04dh ;reset subscript byte C_ESC,"I" ;reset bold byte C_ESC,"D" ;reset underline pr_codes_InitTextMode label byte byte C_NULL ;count ;__________Cursor Control______________________________________ pr_codes_InitPaperLength label byte byte 8 byte C_ESC,"%9",PR_MAX_LINE_FEED ;set line spacing to max byte C_ESC,"F99" ;set the form length to 99 line pr_codes_FormFeed label byte byte 6 byte C_ESC,"%9",2 ;set 2/144" line spacing. byte C_ESC,"F" ;set the page length. pr_codes_SetTab label byte byte 2,C_ESC,C_HT pr_codes_DoTab label byte byte 2,C_CR,C_HT pr_codes_SetLineFeed label byte byte 3,C_ESC,"%","9" pr_codes_SetMaxLineFeed label byte byte 4,C_ESC,"%","9",PR_MAX_LINE_FEED pr_codes_Do1ScanlineFeed label byte byte 5,C_ESC,"%","9",1,C_LF ;__________Graphics Control______________________________________ pr_codes_EnterGraphics label byte byte 3,C_CR,1ch,03h pr_codes_ExitGraphics label byte byte 2, 03h, 02h ;__________Pitch Control______________________________________ pr_codes_Set5Pitch label byte byte 2, 01eh, 01fh pr_codes_Set6Pitch label byte byte 2, 01ch, 01fh pr_codes_Set10Pitch label byte byte 1, 01eh pr_codes_Set12Pitch label byte byte 1, 01ch pr_codes_Set17Pitch label byte byte 1, 01dh pr_codes_SetProportional label byte byte C_NULL ;no proport. code, but code has to be present. ;__________Style Control______________________________________ pr_codes_SetSubscript label byte byte 2,C_ESC,"L" pr_codes_SetSuperscript label byte byte 2,C_ESC,"J" pr_codes_SetNLQ label byte byte 2,C_ESC,"1" pr_codes_SetBold label byte byte 2,C_ESC,"H" pr_codes_SetItalic label byte byte 2,C_ESC,"T" pr_codes_SetUnderline label byte byte 2,C_ESC,"C" pr_codes_ResetSuperscript label byte byte 2,C_ESC,04bh pr_codes_ResetSubscript label byte byte 2,C_ESC,04dh pr_codes_ResetNLQ label byte byte 2,C_ESC,"0" pr_codes_ResetBold label byte byte 2,C_ESC,"I" pr_codes_ResetItalic label byte byte 2,C_ESC,"I" pr_codes_ResetUnderline label byte byte 2,C_ESC,"D"
libsrc/_DEVELOPMENT/temp/sp1/zx/c/sdcc_iy/sp1_PutSprClr_callee.asm
jpoikela/z88dk
640
177052
<reponame>jpoikela/z88dk ; void sp1_PutSprClr(uchar **sprdest, struct sp1_ap *src, uchar n) SECTION code_clib SECTION code_temp_sp1 PUBLIC _sp1_PutSprClr_callee EXTERN asm_sp1_PutSprClr _sp1_PutSprClr_callee: pop af pop hl pop de pop bc push af ld b,c jp asm_sp1_PutSprClr
old/Homotopy/Truncation.agda
timjb/HoTT-Agda
294
4620
<filename>old/Homotopy/Truncation.agda {-# OPTIONS --without-K #-} open import Base import Homotopy.TruncationHIT as T {- The definition of the truncation is in TruncationHIT, here I just make some arguments implicit, define easier to use helper functions and prove the universal property -} module Homotopy.Truncation {i} where τ : (n : ℕ₋₂) → (Set i → Set i) τ = T.τ proj : {n : ℕ₋₂} {A : Set i} → (A → τ n A) proj {n} {A} = T.proj n A τ-is-truncated : (n : ℕ₋₂) (A : Set i) → is-truncated n (τ n A) τ-is-truncated = T.τ-is-truncated τ-is-truncated#instance : {n : ℕ₋₂} {A : Set i} → is-truncated n (τ n A) τ-is-truncated#instance = T.τ-is-truncated _ _ τ-extend : ∀ {j} {n : ℕ₋₂} {A : Set i} {P : (τ n A) → Set j} ⦃ p : (x : τ n A) → is-truncated n (P x) ⦄ (f : (x : A) → P (proj x)) → ((x : τ n A) → P x) τ-extend {j} {n} {A} {P} ⦃ p ⦄ f = T.τ-rec _ _ _ f {transp} p where abstract transp : (pa : n ≡ ⟨-2⟩) (x y : τ n A) (x* : P x) (y* : P y) → transport P (T.hack-prop n A pa x y) x* ≡ y* transp pa x y x* y* = π₁ (contr-is-prop (transport (λ m → is-truncated m _) pa (p y)) _ _) τ-extend-nondep : ∀ {j} {n : ℕ₋₂} {A : Set i} {B : Set j} ⦃ p : is-truncated n B ⦄ → ((f : A → B) → (τ n A → B)) τ-extend-nondep {j} {n} {A} {B} ⦃ p ⦄ f = T.τ-rec-nondep _ _ _ f {transp} p where abstract transp : (pa : n ≡ ⟨-2⟩) (x y : τ n A) (x* y* : B) → x* ≡ y* transp pa x y x* y* = π₁ (contr-is-prop (transport (λ m → is-truncated m _) pa p) _ _) -- Special syntax for hProp-reflection [_] : Set i → Set i [_] = τ ⟨-1⟩ abstract []-is-prop : {A : Set i} → is-prop [ A ] []-is-prop = T.τ-is-truncated _ _ []-extend : ∀ {j} {A : Set i} {P : [ A ] → Set j} ⦃ p : (x : [ A ]) → is-prop (P x) ⦄ (f : (x : A) → P (proj x)) → ((x : [ A ]) → P x) []-extend f = τ-extend f []-extend-nondep : ∀ {j} {A : Set i} {B : Set j} ⦃ p : is-prop B ⦄ → ((f : A → B) → ([ A ] → B)) []-extend-nondep f = τ-extend-nondep f -- Special syntax for hSet-reflection π₀ : Set i → Set i π₀ = τ ⟨0⟩ π₀-is-set : (A : Set i) → is-set (π₀ A) π₀-is-set A = T.τ-is-truncated _ _ π₀-extend : ∀ {j} {A : Set i} {P : π₀ A → Set j} ⦃ p : (x : π₀ A) → is-set (P x) ⦄ (f : (x : A) → P (proj x)) → ((x : π₀ A) → P x) π₀-extend f = τ-extend f π₀-extend-nondep : ∀ {j} {A : Set i} {B : Set j} ⦃ p : is-set B ⦄ → ((f : A → B) → (π₀ A → B)) π₀-extend-nondep f = τ-extend-nondep f -- Universal property of the truncation abstract τ-up : ∀ {j} (n : ℕ₋₂) (A : Set i) (B : Set j) ⦃ p : is-truncated n B ⦄ → is-equiv (λ (f : τ n A → B) → (λ x → f (proj x))) τ-up n A B ⦃ p ⦄ = iso-is-eq _ (τ-extend-nondep) (λ _ → refl) (λ f → funext (τ-extend ⦃ p = λ x → ≡-is-truncated n p ⦄ (λ x → refl))) τ-extend-nondep-is-equiv : ∀ {j} (n : ℕ₋₂) (A : Set i) (B : Set j) ⦃ p : is-truncated n B ⦄ → is-equiv (τ-extend-nondep {n = n} {A} {B}) τ-extend-nondep-is-equiv n A B ⦃ p ⦄ = iso-is-eq _ (λ f → f ◯ proj) (λ f → funext (τ-extend ⦃ λ x → ≡-is-truncated n p ⦄ (λ x → refl))) (λ _ → refl) -- Equivalence associated to the universal property τ-equiv : ∀ {j} (n : ℕ₋₂) (A : Set i) (B : Set j) ⦃ p : is-truncated n B ⦄ → (τ n A → B) ≃ (A → B) τ-equiv n A B = (_ , τ-up n _ _) -- Equivalence associated to the universal property τ-extend-equiv : ∀ {j} (n : ℕ₋₂) (A : Set i) (B : Set j) ⦃ p : is-truncated n B ⦄ → (A → B) ≃ (τ n A → B) τ-extend-equiv n A B = (τ-extend-nondep , τ-extend-nondep-is-equiv n A B) τ-fmap : {n : ℕ₋₂} {A B : Set i} → ((A → B) → (τ n A → τ n B)) τ-fmap f = τ-extend-nondep (proj ◯ f) τ-fpmap : {n : ℕ₋₂} {A B : Set i} {f g : A → B} (h : (a : A) → f a ≡ g a) → ((a : τ n A) → τ-fmap f a ≡ τ-fmap g a) τ-fpmap h = τ-extend ⦃ λ _ → ≡-is-truncated _ (τ-is-truncated _ _) ⦄ (ap proj ◯ h)
oeis/160/A160076.asm
neoneye/loda-programs
11
166378
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A160076: Numerator of Hermite(n, 17/26). ; Submitted by <NAME> ; 1,17,-49,-12325,-159839,13946137,507212239,-19660157773,-1534286839615,27078190344737,5127629801969359,-4354576731731957,-19138555408161520031,-307693278714841022935,78864026725309421626319,2796693049208887888175843,-352296833660767673546447999,-21113562182354716149544574927,1665367049114740877655632428495,156766152152396687973974945140283,-8029962602824122220746897388410079,-1196248552798211688456767884751284423,36660449157276020819096423622162905551,9518531874281194469289165192587320363795 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 mul $2,17 mul $3,-338 mul $3,$0 lpe mov $0,$1
oeis/065/A065344.asm
neoneye/loda-programs
11
25944
<reponame>neoneye/loda-programs ; A065344: a(n) = Mod( binomial(2*n,n), (n+1)*(n+2) ). ; Submitted by <NAME> ; 2,6,0,10,0,28,48,0,0,88,0,0,140,120,0,0,0,0,0,0,0,0,0,0,468,0,0,580,0,496,704,0,0,420,0,0,494,0,0,574,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2016,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4320,0,0,4648,0,0,4988,0,0,2670,0,0,2852,0,0,3040,0,0,0,0,0,0 mov $1,$0 mov $2,1 add $2,$0 add $0,$2 bin $0,$1 add $2,2 bin $2,2 mod $0,$2 mul $0,2
externals/mpir-3.0.0/mpn/x86/pentium4/sse2/sqr_basecase.asm
JaminChan/eos_win
1
13319
<gh_stars>1-10 dnl Intel Pentium-4 mpn_sqr_basecase -- square an mpn number. dnl Copyright 2001, 2002 Free Software Foundation, Inc. dnl dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public License as dnl published by the Free Software Foundation; either version 2.1 of the dnl License, or (at your option) any later version. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with the GNU MP Library; see the file COPYING.LIB. If dnl not, write to the Free Software Foundation, Inc., 51 Franklin Street, dnl Fifth Floor, Boston, MA 02110-1301, USA. include(`../config.m4') C P4: approx 3.5 cycles per crossproduct, or 7 cycles per triangular C product, at around 30x30 limbs. C void mpn_sqr_basecase (mp_ptr dst, mp_srcptr src, mp_size_t size); C C The algorithm is basically the same as mpn/generic/sqr_basecase.c, but a C lot of function call overheads are avoided, especially when the size is C small. C C On small sizes there's only a small speedup over mpn_mul_basecase, C presumably branch mispredictions are a bigger fraction of the work done. C It's not clear how to help this. defframe(PARAM_SIZE,12) defframe(PARAM_SRC, 8) defframe(PARAM_DST, 4) TEXT ALIGN(8) PROLOGUE(mpn_sqr_basecase) deflit(`FRAME',0) movl PARAM_SIZE, %edx movl PARAM_SRC, %eax movl PARAM_DST, %ecx cmpl $2, %edx je L(two_limbs) ja L(three_or_more) C ----------------------------------------------------------------------------- C one limb only C eax src C ebx C ecx dst C edx movl (%eax), %eax mull %eax movl %eax, (%ecx) movl %edx, 4(%ecx) ret C ----------------------------------------------------------------------------- L(two_limbs): C eax src C ebx C ecx dst C edx size movd (%eax), %mm1 movd 4(%eax), %mm0 pmuludq %mm1, %mm0 C src[0]*src[1] pmuludq %mm1, %mm1 C src[0]^2 movd 4(%eax), %mm2 pmuludq %mm2, %mm2 C src[1]^2 movd %mm1, (%ecx) C dst[0] psrlq $32, %mm1 pcmpeqd %mm3, %mm3 psrlq $32, %mm3 C 0x00000000FFFFFFFF pand %mm0, %mm3 C low(src[0]*src[1]) psrlq $32, %mm0 C high(src[0]*src[1]) psllq $1, %mm3 C 2*low(src[0]*src[1]) paddq %mm3, %mm1 C high(src[0]^2) movd %mm1, 4(%ecx) C dst[1] pcmpeqd %mm4, %mm4 psrlq $32, %mm4 C 0x00000000FFFFFFFF pand %mm2, %mm4 C low(src[1]^2) psrlq $32, %mm2 C high(src[1]^2) psllq $1, %mm0 C 2*high(src[0]*src[1]) psrlq $32, %mm1 C carry paddq %mm1, %mm0 paddq %mm4, %mm0 C low(src[1]^2) movd %mm0, 8(%ecx) C dst[2] psrlq $32, %mm0 C carry paddq %mm2, %mm0 C high(src[1]^2) movd %mm0, 12(%ecx) C dst[3] ASSERT(z,` psrlq $32, %mm0 movd %mm0, %eax orl %eax, %eax') emms ret C ----------------------------------------------------------------------------- L(three_or_more): C eax src C ebx C ecx dst C edx size C esi C edi C ebp C C First multiply src[0]*src[1..size-1] and store at dst[1..size]. defframe(SAVE_ESI, -4) defframe(SAVE_EDI, -8) defframe(SAVE_EBP, -12) deflit(STACK_SPACE, 12) subl $STACK_SPACE, %esp FRAME_subl_esp(STACK_SPACE) pxor %mm0, %mm0 C initial carry movd (%eax), %mm7 C multiplier movl %esi, SAVE_ESI movl %edi, SAVE_EDI movl %ebp, SAVE_EBP movl %eax, %esi movl %ecx, %edi subl $1, %edx C First multiply src[0]*src[1..size-1] and store at dst[1..size]. L(mul1): C eax src, incrementing C ebx C ecx dst, incrementing C edx counter, size-1 iterations C esi src C edi dst C ebp C C mm0 carry limb C mm7 multiplier movd 4(%eax), %mm1 addl $4, %eax pmuludq %mm7, %mm1 paddq %mm1, %mm0 movd %mm0, 4(%ecx) addl $4, %ecx psrlq $32, %mm0 subl $1, %edx jnz L(mul1) movl PARAM_SIZE, %ebp subl $3, %ebp jz L(corner) C Add products src[n]*src[n+1..size-1] at dst[2*n-1...], for C n=1..size-2. The last two products, which are the end corner of C the product triangle, are handled separately to save looping C overhead. L(outer): C eax C ebx C ecx C edx C esi src, incrementing C edi dst, incrementing C ebp size, decrementing C C mm0 prev carry movd 4(%esi), %mm7 C multiplier movd %mm0, 4(%ecx) C prev carry leal 8(%esi), %eax C next src addl $4, %esi leal 8(%edi), %ecx C next dst addl $8, %edi leal 1(%ebp), %edx C counter pxor %mm0, %mm0 C initial carry limb, clear carry flag L(inner): C eax src, incrementing C edx C ecx dst, incrementing C edx counter C esi outer src C edi outer dst C ebp outer size C C mm0 carry movd (%eax), %mm1 leal 4(%eax), %eax movd 4(%ecx),%mm2 pmuludq %mm7, %mm1 paddq %mm2, %mm1 paddq %mm1, %mm0 subl $1, %edx movd %mm0, 4(%ecx) psrlq $32, %mm0 leal 4(%ecx), %ecx jnz L(inner) subl $1, %ebp jnz L(outer) L(corner): C esi &src[size-3] C edi &dst[2*size-6] C mm0 carry C C +-----+-----+-- C | mm0 | dst so far C +-----+-----+-- C +-----+-----+ C | | | src[size-2]*src[size-1] C +-----+-----+ movd 4(%esi), %mm1 movd 8(%esi), %mm2 pmuludq %mm2, %mm1 C src[size-1]*src[size-2] movl PARAM_SRC, %eax movd (%eax), %mm2 pmuludq %mm2, %mm2 C src[0]^2 pcmpeqd %mm7, %mm7 psrlq $32, %mm7 movl PARAM_DST, %edx movd 4(%edx), %mm3 C dst[1] paddq %mm1, %mm0 movd %mm0, 12(%edi) C dst[2*size-3] psrlq $32, %mm0 movd %mm0, 16(%edi) C dst[2*size-2] movd %mm2, (%edx) C dst[0] psrlq $32, %mm2 psllq $1, %mm3 C 2*dst[1] paddq %mm3, %mm2 movd %mm2, 4(%edx) psrlq $32, %mm2 movl PARAM_SIZE, %ecx subl $2, %ecx C Now form squares on the diagonal src[0]^2,...,src[size-1]^2, and C add to the triangular parts dst[1..2*size-2] with those left C shifted by 1 bit. L(diag): C eax src, incrementing C ebx C ecx counter, size-2 iterations C edx dst, incrementing C esi C edi C ebp C C mm2 carry C mm7 0x00000000FFFFFFFF movd 4(%eax), %mm0 C src limb addl $4, %eax pmuludq %mm0, %mm0 movq %mm7, %mm1 pand %mm0, %mm1 C diagonal low psrlq $32, %mm0 C diagonal high movd 8(%edx), %mm3 psllq $1, %mm3 C 2*dst[i] paddq %mm3, %mm1 paddq %mm1, %mm2 movd %mm2, 8(%edx) psrlq $32, %mm2 movd 12(%edx), %mm3 psllq $1, %mm3 C 2*dst[i+1] paddq %mm3, %mm0 paddq %mm0, %mm2 movd %mm2, 12(%edx) addl $8, %edx psrlq $32, %mm2 subl $1, %ecx jnz L(diag) movd 4(%eax), %mm0 C src[size-1] pmuludq %mm0, %mm0 pand %mm0, %mm7 C diagonal low psrlq $32, %mm0 C diagonal high movd 8(%edx), %mm3 C dst[2*size-2] psllq $1, %mm3 paddq %mm3, %mm7 paddq %mm7, %mm2 movd %mm2, 8(%edx) psrlq $32, %mm2 paddq %mm0, %mm2 movd %mm2, 12(%edx) C dst[2*size-1] ASSERT(z,` C no further carry psrlq $32, %mm2 movd %mm2, %eax orl %eax, %eax') movl SAVE_ESI, %esi movl SAVE_EDI, %edi movl SAVE_EBP, %ebp addl $STACK_SPACE, %esp emms ret EPILOGUE()
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2_notsx.log_5363_1119.asm
ljhsiun2/medusa
9
19560
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r13 push %r15 push %rbp push %rbx push %rcx push %rdi push %rdx // Store lea addresses_WC+0x601b, %rcx nop nop nop nop nop cmp $3029, %rdx movb $0x51, (%rcx) nop nop inc %rcx // Store lea addresses_D+0x17cf, %rcx sub %r13, %r13 movw $0x5152, (%rcx) nop xor $48862, %rcx // Faulty Load lea addresses_D+0x17cf, %rdi nop nop nop nop and $62165, %rcx mov (%rdi), %edx lea oracles, %rbx and $0xff, %rdx shlq $12, %rdx mov (%rbx,%rdx,1), %rdx pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r15 pop %r13 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'52': 5363} 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 */
libgnat/gnat/last_chance_handler.ads
PThierry/ewok-kernel
65
7211
with System; package Last_Chance_Handler is procedure Last_Chance_Handler (File : System.Address; Line : Integer); pragma Export (C, Last_Chance_Handler, "__gnat_last_chance_handler"); pragma No_Return (Last_Chance_Handler); end Last_Chance_Handler;
HdGfxLib/libgfxinit/common/hw-gfx-gma-display_probing.adb
jam3st/edk2
1
12792
<reponame>jam3st/edk2 -- -- Copyright (C) 2015-2016 secunet Security Networks AG -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- with HW.GFX.I2C; with HW.GFX.EDID; with HW.GFX.GMA.Config; with HW.GFX.GMA.Config_Helpers; with HW.GFX.GMA.I2C; with HW.GFX.GMA.DP_Aux_Ch; with HW.GFX.GMA.Panel; with HW.GFX.GMA.Power_And_Clocks; with HW.Debug; with GNAT.Source_Info; package body HW.GFX.GMA.Display_Probing is function Port_Configured (Configs : Pipe_Configs; Port : Port_Type) return Boolean with Global => null is begin return Configs (Primary).Port = Port or Configs (Secondary).Port = Port or Configs (Tertiary).Port = Port; end Port_Configured; -- DP and HDMI share physical pins. function Sibling_Port (Port : Port_Type) return Port_Type is begin return (case Port is when HDMI1 => DP1, when HDMI2 => DP2, when HDMI3 => DP3, when DP1 => HDMI1, when DP2 => HDMI2, when DP3 => HDMI3, when others => Disabled); end Sibling_Port; function Has_Sibling_Port (Port : Port_Type) return Boolean is begin return Sibling_Port (Port) /= Disabled; end Has_Sibling_Port; function Is_DVI_I (Port : Active_Port_Type) return Boolean with Global => null is begin return Config.Have_DVI_I and (Port = Analog or Config_Helpers.To_PCH_Port (Port) = Config.Analog_I2C_Port); end Is_DVI_I; procedure Read_EDID (Raw_EDID : out EDID.Raw_EDID_Data; Port : in Active_Port_Type; Success : out Boolean) with Post => (if Success then EDID.Valid (Raw_EDID)) is Raw_EDID_Length : GFX.I2C.Transfer_Length := Raw_EDID'Length; begin pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); for I in 1 .. 2 loop if Config_Helpers.To_Display_Type (Port) = DP then -- May need power to read edid declare Temp_Configs : Pipe_Configs := Cur_Configs; begin Temp_Configs (Primary).Port := Port; Power_And_Clocks.Power_Up (Cur_Configs, Temp_Configs); end; declare DP_Port : constant GMA.DP_Port := (case Port is when Internal => DP_A, when DP1 => DP_B, when DP2 => DP_C, when DP3 => DP_D, when others => GMA.DP_Port'First); begin DP_Aux_Ch.I2C_Read (Port => DP_Port, Address => 16#50#, Length => Raw_EDID_Length, Data => Raw_EDID, Success => Success); end; else I2C.I2C_Read (Port => (if Port = Analog then Config.Analog_I2C_Port else Config_Helpers.To_PCH_Port (Port)), Address => 16#50#, Length => Raw_EDID_Length, Data => Raw_EDID, Success => Success); end if; exit when not Success; -- don't retry if reading itself failed pragma Debug (Debug.Put_Buffer ("EDID", Raw_EDID, Raw_EDID_Length)); EDID.Sanitize (Raw_EDID, Success); exit when Success; end loop; end Read_EDID; procedure Probe_Port (Pipe_Cfg : in out Pipe_Config; Port : in Active_Port_Type; Success : out Boolean) with Pre => True is Raw_EDID : EDID.Raw_EDID_Data := (others => 16#00#); begin Success := Config.Valid_Port (Port); if Success then if Port = Internal then Panel.Wait_On; end if; Read_EDID (Raw_EDID, Port, Success); end if; if Success and then ((not Is_DVI_I (Port) or EDID.Compatible_Display (Raw_EDID, Config_Helpers.To_Display_Type (Port))) and EDID.Has_Preferred_Mode (Raw_EDID)) then Pipe_Cfg.Port := Port; Pipe_Cfg.Mode := EDID.Preferred_Mode (Raw_EDID); pragma Warnings (GNATprove, Off, "unused assignment to ""Raw_EDID""", Reason => "We just want to check if it's readable."); if Has_Sibling_Port (Port) then -- Probe sibling port too and bail out if something is detected. -- This is a precaution for adapters that expose the pins of a -- port for both HDMI/DVI and DP (like some ThinkPad docks). A -- user might have attached both by accident and there are ru- -- mors of displays that got fried by applying the wrong signal. declare Have_Sibling_EDID : Boolean; begin Read_EDID (Raw_EDID, Sibling_Port (Port), Have_Sibling_EDID); if Have_Sibling_EDID then Pipe_Cfg.Port := Disabled; Success := False; end if; end; end if; pragma Warnings (GNATprove, On, "unused assignment to ""Raw_EDID"""); else Success := False; end if; end Probe_Port; procedure Scan_Ports (Configs : out Pipe_Configs; Ports : in Port_List := All_Ports; Max_Pipe : in Pipe_Index := Pipe_Index'Last; Keep_Power : in Boolean := False) is Probe_Internal : Boolean := False; Port_Idx : Port_List_Range := Port_List_Range'First; Success : Boolean; begin Configs := (Pipe_Index => (Port => Disabled, Mode => Invalid_Mode, Cursor => Default_Cursor, Framebuffer => Default_FB)); -- Turn panel on early to probe other ports during the power on delay. for Idx in Port_List_Range loop exit when Ports (Idx) = Disabled; if Ports (Idx) = Internal then Panel.On (Wait => False); Probe_Internal := True; exit; end if; end loop; for Pipe in Pipe_Index range Pipe_Index'First .. Pipe_Index'Min (Max_Pipe, Config.Max_Pipe) loop while Ports (Port_Idx) /= Disabled loop if not Port_Configured (Configs, Ports (Port_Idx)) and (not Has_Sibling_Port (Ports (Port_Idx)) or not Port_Configured (Configs, Sibling_Port (Ports (Port_Idx)))) then Probe_Port (Configs (Pipe), Ports (Port_Idx), Success); else Success := False; end if; exit when Port_Idx = Port_List_Range'Last; Port_Idx := Port_List_Range'Succ (Port_Idx); exit when Success; end loop; end loop; -- Restore power settings if not Keep_Power then Power_And_Clocks.Power_Set_To (Cur_Configs); end if; -- Turn panel power off if probing failed. if Probe_Internal and not Port_Configured (Configs, Internal) then Panel.Off; end if; end Scan_Ports; end HW.GFX.GMA.Display_Probing;